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-b2c, plasma-web): Modal refinement #629

Merged
merged 2 commits into from
Aug 2, 2023

Conversation

kayman233
Copy link
Contributor

@kayman233 kayman233 commented Jul 25, 2023

Добавлены новые свойства для компонента Modal:

  • сloseOnEsc?: boolean - Закрывать модальное окно при нажатии на ESC(по умолчанию true).
  • сloseOnOverlayClick?: boolean - Закрывать модальное окно при нажатии вне области модального окна(по умолчанию true).
  • onEscKeyDown?: (event: KeyboardEvent) => void - Обработчик клика при нажатии на ESC(если не передан, то при нажатии используется onClose).
  • onOverlayClick?: (event: React.MouseEvent<HTMLDivElement>) => void - Обработчик клика при нажатии вне области модального окна(если не передан, то при нажатии используется onClose).
  • initialFocusRef?: React.RefObject<HTMLElement> - Первый элемент для фокуса внутри модального окна.
  • focusLaterRef?: React.RefObject<HTMLElement> - Элемент для фокуса после закрытия модального окна(по умолчанию фокус на последнем перед открытием активном элементе).
  • showCloseButton?: boolean - Отображать кнопку "закрыть"(по умолчанию true).
🐤 Download canary assets:
color
color_plasma_b2c_ios-swift--canary.629.5736515470.swift
color_plasma_b2c_kotlin--canary.629.5736515470.kt
color_plasma_b2c_react-native--canary.629.5736515470.ts
color_plasma_b2c_xml--canary.629.5736515470.xml
color_sberHealth_ios-swift--canary.629.5736515470.swift
color_sberHealth_kotlin--canary.629.5736515470.kt
color_sberHealth_react-native--canary.629.5736515470.ts
color_sberHealth_xml--canary.629.5736515470.xml
color_sbermarket_business_ios-swift--canary.629.5736515470.swift
color_sbermarket_business_kotlin--canary.629.5736515470.kt
color_sbermarket_business_react-native--canary.629.5736515470.ts
color_sbermarket_business_xml--canary.629.5736515470.xml
color_sbermarket_ios-swift--canary.629.5736515470.swift
color_sbermarket_kotlin--canary.629.5736515470.kt
color_sbermarket_metro_ios-swift--canary.629.5736515470.swift
color_sbermarket_metro_kotlin--canary.629.5736515470.kt
color_sbermarket_metro_react-native--canary.629.5736515470.ts
color_sbermarket_metro_xml--canary.629.5736515470.xml
color_sbermarket_react-native--canary.629.5736515470.ts
color_sbermarket_selgros_ios-swift--canary.629.5736515470.swift
color_sbermarket_selgros_kotlin--canary.629.5736515470.kt
color_sbermarket_selgros_react-native--canary.629.5736515470.ts
color_sbermarket_selgros_xml--canary.629.5736515470.xml
color_sbermarket_wlbusiness_ios-swift--canary.629.5736515470.swift
color_sbermarket_wlbusiness_kotlin--canary.629.5736515470.kt
color_sbermarket_wlbusiness_react-native--canary.629.5736515470.ts
color_sbermarket_wlbusiness_xml--canary.629.5736515470.xml
color_sbermarket_xml--canary.629.5736515470.xml
color_sberonline_ios-swift--canary.629.5736515470.swift
color_sberonline_kotlin--canary.629.5736515470.kt
color_sberonline_react-native--canary.629.5736515470.ts
color_sberonline_xml--canary.629.5736515470.xml
color_sberprime_ios-swift--canary.629.5736515470.swift
color_sberprime_kotlin--canary.629.5736515470.kt
color_sberprime_react-native--canary.629.5736515470.ts
color_sberprime_xml--canary.629.5736515470.xml
color_stylesSalute_ios-swift--canary.629.5736515470.swift
color_stylesSalute_kotlin--canary.629.5736515470.kt
color_stylesSalute_react-native--canary.629.5736515470.ts
color_stylesSalute_xml--canary.629.5736515470.xml
shadow
shadow_plasma_b2c_react-native--canary.629.5736515470.ts
shadow_sberHealth_react-native--canary.629.5736515470.ts
shadow_sbermarket_business_react-native--canary.629.5736515470.ts
shadow_sbermarket_metro_react-native--canary.629.5736515470.ts
shadow_sbermarket_react-native--canary.629.5736515470.ts
shadow_sbermarket_selgros_react-native--canary.629.5736515470.ts
shadow_sbermarket_wlbusiness_react-native--canary.629.5736515470.ts
shadow_sberonline_react-native--canary.629.5736515470.ts
shadow_sberprime_react-native--canary.629.5736515470.ts
shadow_stylesSalute_react-native--canary.629.5736515470.ts
typo
typo_mage_ios-swift--canary.629.5736515470.swift
typo_mage_kotlin--canary.629.5736515470.kt
typo_mage_react-native--canary.629.5736515470.ts
typo_plasma_ios-swift--canary.629.5736515470.swift
typo_plasma_kotlin--canary.629.5736515470.kt
typo_plasma_react-native--canary.629.5736515470.ts
typo_ruler_ios-swift--canary.629.5736515470.swift
typo_ruler_kotlin--canary.629.5736515470.kt
typo_ruler_react-native--canary.629.5736515470.ts
typo_sage_ios-swift--canary.629.5736515470.swift
typo_sage_kotlin--canary.629.5736515470.kt
typo_sage_react-native--canary.629.5736515470.ts
typo_sbermarket_ios-swift--canary.629.5736515470.swift
typo_sbermarket_kotlin--canary.629.5736515470.kt
typo_sbermarket_react-native--canary.629.5736515470.ts
typo_soulmate_ios-swift--canary.629.5736515470.swift
typo_soulmate_kotlin--canary.629.5736515470.kt
typo_soulmate_react-native--canary.629.5736515470.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]
npm install @salutejs/[email protected]
npm install @salutejs/[email protected]
npm install @salutejs/[email protected]
npm install @salutejs/[email protected]
npm install @salutejs/[email protected]
npm install @salutejs/[email protected]
npm install @salutejs/[email protected]
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]
yarn add @salutejs/[email protected]
yarn add @salutejs/[email protected]
yarn add @salutejs/[email protected]
yarn add @salutejs/[email protected]
yarn add @salutejs/[email protected]
yarn add @salutejs/[email protected]
yarn add @salutejs/[email protected]
yarn add @salutejs/[email protected]
yarn add @salutejs/[email protected]
yarn add @salutejs/[email protected]
yarn add @salutejs/[email protected]

@Salute-Eva
Copy link
Contributor

Theme Builder app deployed!

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

@Salute-Eva
Copy link
Contributor

@Salute-Eva
Copy link
Contributor

Component performance testing

Result: 🟢 Success

Check out report in job artifacts!

@kayman233 kayman233 force-pushed the kayman233/modal-new-feats.PLASMA-1820 branch from 0f3659c to 347ca6b Compare July 26, 2023 08:43
@Salute-Eva
Copy link
Contributor

Theme Builder app deployed!

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

@Salute-Eva
Copy link
Contributor

@Salute-Eva
Copy link
Contributor

Component performance testing

Result: 🟢 Success

Check out report in job artifacts!

@kayman233 kayman233 force-pushed the kayman233/modal-new-feats.PLASMA-1820 branch from 347ca6b to b535015 Compare July 26, 2023 09:44
@Salute-Eva
Copy link
Contributor

Theme Builder app deployed!

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

@Salute-Eva
Copy link
Contributor

@Salute-Eva
Copy link
Contributor

Component performance testing

Result: 🟢 Success

Check out report in job artifacts!

@kayman233 kayman233 marked this pull request as ready for review July 26, 2023 10:46
@kayman233 kayman233 force-pushed the kayman233/modal-new-feats.PLASMA-1820 branch from b535015 to 951f5c1 Compare July 27, 2023 07:07
@Salute-Eva
Copy link
Contributor

Theme Builder app deployed!

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

@Salute-Eva
Copy link
Contributor

@Salute-Eva
Copy link
Contributor

Component performance testing

Result: 🟢 Success

Check out report in job artifacts!

@kayman233 kayman233 force-pushed the kayman233/modal-new-feats.PLASMA-1820 branch from 951f5c1 to 8049ce4 Compare July 31, 2023 07:25
@Salute-Eva
Copy link
Contributor

Theme Builder app deployed!

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

@Salute-Eva
Copy link
Contributor

@Salute-Eva
Copy link
Contributor

Component performance testing

Result: 🟢 Success

Check out report in job artifacts!

focusLaterRef?: React_2.RefObject<HTMLElement>;
initialFocusRef?: React_2.RefObject<HTMLElement>;
isCloseOnEsc?: boolean;
isCloseOnOverlayClick?: boolean;
Copy link
Contributor

Choose a reason for hiding this comment

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

если честно мне не нравится писать через is
почему не просто
closeOnEsc?

у нас много мест где написано через is ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ну кстати да, в данном случае наверное без is лучше

@@ -906,7 +907,13 @@ export const Modal: FC<ModalProps>;

// @public (undocumented)
export interface ModalProps extends ModalViewProps {
focusLaterRef?: React_2.RefObject<HTMLElement>;
Copy link
Contributor

Choose a reason for hiding this comment

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

focusLater тоже звучит странно

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ну у меня в голове были еще focusAfter или focusAfterClose

@@ -923,6 +930,7 @@ export interface ModalViewProps extends React_2.HTMLAttributes<HTMLDivElement> {
children?: React_2.ReactNode;
closeButtonAriaLabel?: string;
onClose?: () => void;
showCloseIcon?: boolean;
Copy link
Contributor

Choose a reason for hiding this comment

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

тут же унас не isShowCloseIcon
и почему icon ? именно в иконке дело ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

сделал showCloseButton, так кажется получше

@@ -25,8 +25,10 @@ export class FocusManager {
};

// добавление на фокус после анмаунта
public markForFocusLater = () => {
this.focusLaterElements.push(document.activeElement as HTMLElement);
public markForFocusLater = (focusLaterNode?: React.RefObject<HTMLElement>) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

focusLater это уже в API focus-trap ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

да, ну логику focus-trap расширили

@kayman233 kayman233 force-pushed the kayman233/modal-new-feats.PLASMA-1820 branch from 8049ce4 to 5c3a7e1 Compare August 1, 2023 20:52
@Salute-Eva
Copy link
Contributor

Theme Builder app deployed!

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

@Salute-Eva
Copy link
Contributor

@Salute-Eva
Copy link
Contributor

Component performance testing

Result: 🟢 Success

Check out report in job artifacts!

@kayman233 kayman233 force-pushed the kayman233/modal-new-feats.PLASMA-1820 branch from 5c3a7e1 to 1677f30 Compare August 2, 2023 08:21
@Salute-Eva
Copy link
Contributor

Theme Builder app deployed!

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

@kayman233 kayman233 force-pushed the kayman233/modal-new-feats.PLASMA-1820 branch from 1677f30 to 6d52dd0 Compare August 2, 2023 08:26
@Salute-Eva
Copy link
Contributor

Theme Builder app deployed!

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

@Salute-Eva
Copy link
Contributor

@Salute-Eva
Copy link
Contributor

Component performance testing

Result: 🟢 Success

Check out report in job artifacts!

@kayman233 kayman233 added this pull request to the merge queue Aug 2, 2023
Merged via the queue into dev with commit d912390 Aug 2, 2023
@kayman233 kayman233 deleted the kayman233/modal-new-feats.PLASMA-1820 branch August 2, 2023 13:47
@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], @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], @salutejs/[email protected], @salutejs/[email protected] 🚀

1 similar comment
@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], @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], @salutejs/[email protected], @salutejs/[email protected] 🚀

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

Successfully merging this pull request may close these issues.

5 participants