Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(plasma-new-hope): Add calendar with new architecture #821

Merged
merged 8 commits into from
Nov 3, 2023

Conversation

TitanKuzmich
Copy link
Contributor

@TitanKuzmich TitanKuzmich commented Oct 26, 2023

Release Notes

Добавлена реализация компонента Calendar в новой архитектуре.

Добавлены сборки компонента для новых тем plasma_web, plasma_b2c, sds_engineer.

Добавлены сборки компонента для старых библиотек @salutejs/plasma-web, @salutejs/plasma-b2c.

Удалён компонент Calendar из @salutejs/plasma-hope.

Поправил небольшой баг (issue) с типизацией для mergeConfig: если у компонента были обязательные пропсы ts ругался, что их не хватает в самом конфиге.

fixes: #597

⚡ Component performance testing

Result: 🟢 OK

⚡ Component performance testing

Result: 🟢 OK

⚡ Component performance testing

Result: 🟢 OK

⚡ Component performance testing

Result: 🟢 OK

⚡ Component performance testing

Result: 🟢 OK

🐤 Download canary assets:
borderRadius
borderRadius_default_react-native--canary.821.6742702609.ts
borderRadius_plasma_b2c_react-native--canary.821.6742702609.ts
borderRadius_plasma_web_react-native--canary.821.6742702609.ts
borderRadius_sberHealth_react-native--canary.821.6742702609.ts
borderRadius_sbermarket_business_react-native--canary.821.6742702609.ts
borderRadius_sbermarket_metro_react-native--canary.821.6742702609.ts
borderRadius_sbermarket_react-native--canary.821.6742702609.ts
borderRadius_sbermarket_selgros_react-native--canary.821.6742702609.ts
borderRadius_sbermarket_wlbusiness_react-native--canary.821.6742702609.ts
borderRadius_sberonline_react-native--canary.821.6742702609.ts
borderRadius_sberprime_react-native--canary.821.6742702609.ts
borderRadius_stylesSalute_react-native--canary.821.6742702609.ts
color
color_default_ios-swift--canary.821.6742702609.swift
color_default_kotlin--canary.821.6742702609.kt
color_default_react-native--canary.821.6742702609.ts
color_default_xml--canary.821.6742702609.xml
color_plasma_b2c_ios-swift--canary.821.6742702609.swift
color_plasma_b2c_kotlin--canary.821.6742702609.kt
color_plasma_b2c_react-native--canary.821.6742702609.ts
color_plasma_b2c_xml--canary.821.6742702609.xml
color_plasma_web_ios-swift--canary.821.6742702609.swift
color_plasma_web_kotlin--canary.821.6742702609.kt
color_plasma_web_react-native--canary.821.6742702609.ts
color_plasma_web_xml--canary.821.6742702609.xml
color_sberHealth_ios-swift--canary.821.6742702609.swift
color_sberHealth_kotlin--canary.821.6742702609.kt
color_sberHealth_react-native--canary.821.6742702609.ts
color_sberHealth_xml--canary.821.6742702609.xml
color_sbermarket_business_ios-swift--canary.821.6742702609.swift
color_sbermarket_business_kotlin--canary.821.6742702609.kt
color_sbermarket_business_react-native--canary.821.6742702609.ts
color_sbermarket_business_xml--canary.821.6742702609.xml
color_sbermarket_ios-swift--canary.821.6742702609.swift
color_sbermarket_kotlin--canary.821.6742702609.kt
color_sbermarket_metro_ios-swift--canary.821.6742702609.swift
color_sbermarket_metro_kotlin--canary.821.6742702609.kt
color_sbermarket_metro_react-native--canary.821.6742702609.ts
color_sbermarket_metro_xml--canary.821.6742702609.xml
color_sbermarket_react-native--canary.821.6742702609.ts
color_sbermarket_selgros_ios-swift--canary.821.6742702609.swift
color_sbermarket_selgros_kotlin--canary.821.6742702609.kt
color_sbermarket_selgros_react-native--canary.821.6742702609.ts
color_sbermarket_selgros_xml--canary.821.6742702609.xml
color_sbermarket_wlbusiness_ios-swift--canary.821.6742702609.swift
color_sbermarket_wlbusiness_kotlin--canary.821.6742702609.kt
color_sbermarket_wlbusiness_react-native--canary.821.6742702609.ts
color_sbermarket_wlbusiness_xml--canary.821.6742702609.xml
color_sbermarket_xml--canary.821.6742702609.xml
color_sberonline_ios-swift--canary.821.6742702609.swift
color_sberonline_kotlin--canary.821.6742702609.kt
color_sberonline_react-native--canary.821.6742702609.ts
color_sberonline_xml--canary.821.6742702609.xml
color_sberprime_ios-swift--canary.821.6742702609.swift
color_sberprime_kotlin--canary.821.6742702609.kt
color_sberprime_react-native--canary.821.6742702609.ts
color_sberprime_xml--canary.821.6742702609.xml
color_stylesSalute_ios-swift--canary.821.6742702609.swift
color_stylesSalute_kotlin--canary.821.6742702609.kt
color_stylesSalute_react-native--canary.821.6742702609.ts
color_stylesSalute_xml--canary.821.6742702609.xml
shadow
shadow_default_react-native--canary.821.6742702609.ts
shadow_plasma_b2c_react-native--canary.821.6742702609.ts
shadow_plasma_web_react-native--canary.821.6742702609.ts
shadow_sberHealth_react-native--canary.821.6742702609.ts
shadow_sbermarket_business_react-native--canary.821.6742702609.ts
shadow_sbermarket_metro_react-native--canary.821.6742702609.ts
shadow_sbermarket_react-native--canary.821.6742702609.ts
shadow_sbermarket_selgros_react-native--canary.821.6742702609.ts
shadow_sbermarket_wlbusiness_react-native--canary.821.6742702609.ts
shadow_sberonline_react-native--canary.821.6742702609.ts
shadow_sberprime_react-native--canary.821.6742702609.ts
shadow_stylesSalute_react-native--canary.821.6742702609.ts
spacing
spacing_default_react-native--canary.821.6742702609.ts
spacing_plasma_b2c_react-native--canary.821.6742702609.ts
spacing_plasma_web_react-native--canary.821.6742702609.ts
spacing_sberHealth_react-native--canary.821.6742702609.ts
spacing_sbermarket_business_react-native--canary.821.6742702609.ts
spacing_sbermarket_metro_react-native--canary.821.6742702609.ts
spacing_sbermarket_react-native--canary.821.6742702609.ts
spacing_sbermarket_selgros_react-native--canary.821.6742702609.ts
spacing_sbermarket_wlbusiness_react-native--canary.821.6742702609.ts
spacing_sberonline_react-native--canary.821.6742702609.ts
spacing_sberprime_react-native--canary.821.6742702609.ts
spacing_stylesSalute_react-native--canary.821.6742702609.ts
typo
typo_mage_ios-swift--canary.821.6742702609.swift
typo_mage_kotlin--canary.821.6742702609.kt
typo_mage_react-native--canary.821.6742702609.ts
typo_plasma_ios-swift--canary.821.6742702609.swift
typo_plasma_kotlin--canary.821.6742702609.kt
typo_plasma_react-native--canary.821.6742702609.ts
typo_ruler_ios-swift--canary.821.6742702609.swift
typo_ruler_kotlin--canary.821.6742702609.kt
typo_ruler_react-native--canary.821.6742702609.ts
typo_sage_ios-swift--canary.821.6742702609.swift
typo_sage_kotlin--canary.821.6742702609.kt
typo_sage_react-native--canary.821.6742702609.ts
typo_sbermarket_ios-swift--canary.821.6742702609.swift
typo_sbermarket_kotlin--canary.821.6742702609.kt
typo_sbermarket_react-native--canary.821.6742702609.ts
typo_soulmate_ios-swift--canary.821.6742702609.swift
typo_soulmate_kotlin--canary.821.6742702609.kt
typo_soulmate_react-native--canary.821.6742702609.ts
📦 Published PR as canary version: Canary Versions

✨ Test out this PR locally via:

npm install @salutejs/[email protected]
npm install @salutejs/[email protected]
npm install @salutejs/[email protected]
npm install @salutejs/[email protected]
# or 
yarn add @salutejs/[email protected]
yarn add @salutejs/[email protected]
yarn add @salutejs/[email protected]
yarn add @salutejs/[email protected]

Version

Published prerelease version: @salutejs/[email protected]
@salutejs/[email protected]
@salutejs/[email protected]
@salutejs/[email protected]
@salutejs/[email protected]
@salutejs/[email protected]
@salutejs/[email protected]
@salutejs/[email protected]
@salutejs/[email protected]
@salutejs/[email protected]

Changelog

Release Notes

feat(plasma-new-hope): Add calendar with new architecture (#821)

Добавлена реализация компонента Calendar в новой архитектуре.

Добавлены сборки компонента для новых тем plasma_web, plasma_b2c, sds_engineer.

Добавлены сборки компонента для старых библиотек @salutejs/plasma-web, @salutejs/plasma-b2c.

Удалён компонент Calendar из @salutejs/plasma-hope.

Поправил небольшой баг (issue) с типизацией для mergeConfig: если у компонента были обязательные пропсы ts ругался, что их не хватает в самом конфиге.

fixes: #597

⚡ Component performance testing

Result: 🟢 OK

⚡ Component performance testing

Result: 🟢 OK

⚡ Component performance testing

Result: 🟢 OK

⚡ Component performance testing

Result: 🟢 OK

⚡ Component performance testing

Result: 🟢 OK


🚀 Enhancement

  • @salutejs/plasma-new-hope
  • @salutejs/plasma-b2c, @salutejs/plasma-new-hope, @salutejs/plasma-web
  • @salutejs/plasma-hope
  • @salutejs/plasma-b2c, @salutejs/plasma-hope, @salutejs/plasma-web

Authors: 1


const getRefs = useCallback(
(element: HTMLDivElement, i: number, j: number) => {
outerRefs.current[i][j] = element;

Check warning

Code scanning / Semgrep

Semgrep Finding: gitlab.eslint.detect-object-injection Warning

Bracket object notation with user input is present, this might allow an attacker to access all properties of the object and even it's prototype, leading to possible code execution.

const getRefs = useCallback(
(element: HTMLDivElement, i: number, j: number) => {
outerRefs.current[i][j] = element;

Check warning

Code scanning / Semgrep

Semgrep Finding: gitlab.eslint.detect-object-injection Warning

Bracket object notation with user input is present, this might allow an attacker to access all properties of the object and even it's prototype, leading to possible code execution.

const getRefs = useCallback(
(element: HTMLDivElement, i: number, j: number) => {
outerRefs.current[i][j] = element;

Check warning

Code scanning / Semgrep

Semgrep Finding: gitlab.eslint.detect-object-injection Warning

Bracket object notation with user input is present, this might allow an attacker to access all properties of the object and even it's prototype, leading to possible code execution.

const getRefs = useCallback(
(element: HTMLDivElement, i: number, j: number) => {
outerRefs.current[i][j] = element;

Check warning

Code scanning / Semgrep

Semgrep Finding: gitlab.eslint.detect-object-injection Warning

Bracket object notation with user input is present, this might allow an attacker to access all properties of the object and even it's prototype, leading to possible code execution.
@Salute-Eva
Copy link
Contributor

Theme Builder app deployed!

http://plasma.sberdevices.ru/pr/plasma-theme-builder-pr-821/

@TitanKuzmich TitanKuzmich changed the base branch from dev to master October 26, 2023 14:24
@TitanKuzmich TitanKuzmich changed the base branch from master to dev October 26, 2023 14:24
@TitanKuzmich TitanKuzmich force-pushed the plasma-2085/refactor-calendar branch from 3706cc7 to 1fe5406 Compare October 26, 2023 15:33
export const IconRoot: React.FC<IconRootProps> = ({ icon: IconComponent, size, color, className }) => {
const c = color || 'var(--plasma-colors-primary)';

const w = `${sizeMap[size]}rem`;

Check warning

Code scanning / Semgrep

Semgrep Finding: gitlab.eslint.detect-object-injection Warning

Bracket object notation with user input is present, this might allow an attacker to access all properties of the object and even it's prototype, leading to possible code execution.
@Salute-Eva
Copy link
Contributor

Theme Builder app deployed!

http://plasma.sberdevices.ru/pr/plasma-theme-builder-pr-821/

@Yeti-or
Copy link
Contributor

Yeti-or commented Oct 27, 2023

Удалён компонент TextArea из @salutejs/plasma-hope. - это точно должно быть в этом пр ? cc @neretin-trike

packages/plasma-b2c/api/plasma-b2c.api.md Outdated Show resolved Hide resolved
const [prevValue, setPrevValue] = useState(value);
const [outOfRangeKey, setOutOfRangeKey] = useState<number>(0);

const [state, dispatch] = useReducer(reducer, getInitialState(value, [5, 6], type));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

а что такое [5,6] ?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

по-моему это размерность, только чего уже не помню )

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Размер сетки для календаря для useKeyNavigation


${flexCenter()};

&.${String(classes.daySideLeft)} {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

почему приходится к строке явно приводить?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Особенность linaria. Иначе не собираются стили

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

надо собрать все такие места куда-то в проблемы с linaria и начинать править их babel процессор или писать своё =/

@@ -0,0 +1,100 @@
import React, { forwardRef, memo } from 'react';

import { cx } from '../../../../utils';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

что-то меня смущает что приходится использовать cx =/

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ну это кастомная штука, кажется в таком случае норм

packages/plasma-new-hope/src/mixins/index.ts Show resolved Hide resolved
@TitanKuzmich TitanKuzmich force-pushed the plasma-2085/refactor-calendar branch from 1fe5406 to 8b26a2e Compare October 27, 2023 10:48
@Salute-Eva
Copy link
Contributor

Theme Builder app deployed!

http://plasma.sberdevices.ru/pr/plasma-theme-builder-pr-821/

@TitanKuzmich TitanKuzmich force-pushed the plasma-2085/refactor-calendar branch from 8b26a2e to 496b57b Compare October 27, 2023 11:37
@Salute-Eva
Copy link
Contributor

Theme Builder app deployed!

http://plasma.sberdevices.ru/pr/plasma-theme-builder-pr-821/

@Salute-Eva
Copy link
Contributor

@@ -89,7 +81,7 @@ export interface Calendar extends HTMLAttributes<HTMLDivElement> {
/**
* Выбранное значение.
*/
value: CalendarValueType;
value?: CalendarValueType;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

это безопасное изменение но обратно уже будет поломка API
тут точно опциональное?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TitanKuzmich

А почему стало опционально?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Вернул как было


&.${String(classes.daySideRight)} {
&:before {
right: ${({ offset }) => `${offset}px`};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

этот offset часто меняется?
потому что если да, то для styled-components это жопа

если разок за жизнь компонента то ок

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Yeti-or Объясни пожалуйста почему - это жопа?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

offset меняется один раз для CalendarDayItem по hover при выборе range. Он может быть 0 или -1 пиксель
image

packages/plasma-new-hope/src/mixins/index.ts Show resolved Hide resolved
packages/plasma-new-hope/src/mixins/index.ts Show resolved Hide resolved

const onChangeValue = action('onChangeValue');

const StyledCalendar = styled(Calendar)`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

я тут только понял что это сторя, почем нам нужно календарь стилизовать в сторей?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Для поповера стилизацию сделал небольшую. Можно и без нее сделать

@Salute-Eva
Copy link
Contributor

@Salute-Eva
Copy link
Contributor

Theme Builder app deployed!

http://plasma.sberdevices.ru/pr/plasma-theme-builder-pr-821/

@TitanKuzmich TitanKuzmich force-pushed the plasma-2085/refactor-calendar branch from 82b2548 to eca7b3f Compare November 2, 2023 17:11
@Salute-Eva
Copy link
Contributor

Theme Builder app deployed!

http://plasma.sberdevices.ru/pr/plasma-theme-builder-pr-821/

@Salute-Eva
Copy link
Contributor

@TitanKuzmich TitanKuzmich force-pushed the plasma-2085/refactor-calendar branch from eca7b3f to 842d204 Compare November 3, 2023 08:07
@Salute-Eva
Copy link
Contributor

Theme Builder app deployed!

http://plasma.sberdevices.ru/pr/plasma-theme-builder-pr-821/

@Salute-Eva
Copy link
Contributor

@TitanKuzmich TitanKuzmich added this pull request to the merge queue Nov 3, 2023
Merged via the queue into dev with commit 707fefa Nov 3, 2023
22 checks passed
@TitanKuzmich TitanKuzmich deleted the plasma-2085/refactor-calendar branch November 3, 2023 11:05
@Salute-Eva
Copy link
Contributor

🚀 This PR is included in version: @salutejs/[email protected], @salutejs/[email protected], @salutejs/[email protected], @salutejs/[email protected], @salutejs/[email protected], @salutejs/[email protected], @salutejs/[email protected], @salutejs/[email protected] 🚀

2 similar comments
@Salute-Eva
Copy link
Contributor

🚀 This PR is included in version: @salutejs/[email protected], @salutejs/[email protected], @salutejs/[email protected], @salutejs/[email protected], @salutejs/[email protected], @salutejs/[email protected], @salutejs/[email protected], @salutejs/[email protected] 🚀

@Salute-Eva
Copy link
Contributor

🚀 This PR is included in version: @salutejs/[email protected], @salutejs/[email protected], @salutejs/[email protected], @salutejs/[email protected], @salutejs/[email protected], @salutejs/[email protected], @salutejs/[email protected], @salutejs/[email protected] 🚀

@Salute-Eva
Copy link
Contributor

🚀 This PR is included in version: @salutejs/[email protected], @salutejs/[email protected], @salutejs/[email protected], @salutejs/[email protected], @salutejs/[email protected], @salutejs/[email protected], @salutejs/[email protected], @salutejs/[email protected] 🚀

4 similar comments
@Salute-Eva
Copy link
Contributor

🚀 This PR is included in version: @salutejs/[email protected], @salutejs/[email protected], @salutejs/[email protected], @salutejs/[email protected], @salutejs/[email protected], @salutejs/[email protected], @salutejs/[email protected], @salutejs/[email protected] 🚀

@Salute-Eva
Copy link
Contributor

🚀 This PR is included in version: @salutejs/[email protected], @salutejs/[email protected], @salutejs/[email protected], @salutejs/[email protected], @salutejs/[email protected], @salutejs/[email protected], @salutejs/[email protected], @salutejs/[email protected] 🚀

@Salute-Eva
Copy link
Contributor

🚀 This PR is included in version: @salutejs/[email protected], @salutejs/[email protected], @salutejs/[email protected], @salutejs/[email protected], @salutejs/[email protected], @salutejs/[email protected], @salutejs/[email protected], @salutejs/[email protected] 🚀

@Salute-Eva
Copy link
Contributor

🚀 This PR is included in version: @salutejs/[email protected], @salutejs/[email protected], @salutejs/[email protected], @salutejs/[email protected], @salutejs/[email protected], @salutejs/[email protected], @salutejs/[email protected], @salutejs/[email protected] 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

plasma-web: Calendar - redesign & refactoring ( PLASMA-2085 )
5 participants