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-core, plasma-web, plasma-b2c): ModalBase component #774

Merged
merged 2 commits into from
Sep 29, 2023

Conversation

kayman233
Copy link
Contributor

@kayman233 kayman233 commented Sep 26, 2023

Реализован компонент ModalBase, сделанный на основе PopupBase, который сохраняет все его свойства(исключая frame), но также добавляет:

  • withBlur?: boolean - Нужно ли применять blur для подложки.
  • с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).

Также добавлено поле overlay?: React.ReactNode для PopupBase.

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

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]
@salutejs/[email protected]
@salutejs/[email protected]
@salutejs/[email protected]
@salutejs/[email protected]
@salutejs/[email protected]

Changelog

🐛 Bug Fix

  • @salutejs/plasma-b2c, @salutejs/plasma-core, @salutejs/plasma-hope, @salutejs/plasma-web
    • fix(plasma-core): refactor in PopupBase/ModalBase #774 (@kayman233)
    • feat(plasma-core, plasma-web, plasma-b2c): ModalBase component #774 (@kayman233)
  • @salutejs/plasma-new-hope
    • chore(plasma-new-hope): remove plasma-old theme #782 (@Yeti-or)
    • chore(plasma-new-hope): add sds_engineer theme #782 (@Yeti-or)

Authors: 2

@Salute-Eva
Copy link
Contributor

Theme Builder app deployed!

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

@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-base.PLASMA-2070 branch from f71ea01 to 3b4f15d Compare September 26, 2023 11:18
@Salute-Eva
Copy link
Contributor

Theme Builder app deployed!

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

@Salute-Eva
Copy link
Contributor

Component performance testing

Result: 🟢 Success

Check out report in job artifacts!

@Salute-Eva
Copy link
Contributor

@kayman233 kayman233 force-pushed the kayman233/modal-base.PLASMA-2070 branch from 3b4f15d to 6940969 Compare September 26, 2023 12:32
@Salute-Eva
Copy link
Contributor

Theme Builder app deployed!

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

@Salute-Eva
Copy link
Contributor

Component performance testing

Result: 🟢 Success

Check out report in job artifacts!

@Salute-Eva
Copy link
Contributor

@kayman233 kayman233 force-pushed the kayman233/modal-base.PLASMA-2070 branch from 6940969 to 507f435 Compare September 26, 2023 12:58
@kayman233 kayman233 marked this pull request as ready for review September 26, 2023 12:59
@Salute-Eva
Copy link
Contributor

Theme Builder app deployed!

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

@Salute-Eva
Copy link
Contributor

Component performance testing

Result: 🟢 Success

Check out report in job artifacts!

@Salute-Eva
Copy link
Contributor

@kayman233 kayman233 force-pushed the kayman233/modal-base.PLASMA-2070 branch from 507f435 to 63cfdf7 Compare September 27, 2023 18:24
@Salute-Eva
Copy link
Contributor

Theme Builder app deployed!

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

Copy link
Contributor

@Yeti-or Yeti-or left a comment

Choose a reason for hiding this comment

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

Можно ребебейз то я уже плыву в одинаковых изменениях после radiobox/lcheckobxo/link/...

@kayman233
Copy link
Contributor Author

Можно ребебейз то я уже плыву в одинаковых изменениях после radiobox/lcheckobxo/link/...

вот отребейзил, мб надо обновить страницу

@Salute-Eva
Copy link
Contributor

@Salute-Eva
Copy link
Contributor

Component performance testing

Result: 🔴 Fail

Check out report in job artifacts!

Top 5 significant rerender changes:
packages/plasma-ui/src/components/Pickers/Pickers.perftest.tsx#DatePicker: 5325.91%

@Salute-Eva
Copy link
Contributor

Component performance testing

Result: 🟢 Success

Check out report in job artifacts!

@Salute-Eva
Copy link
Contributor

Theme Builder app deployed!

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

@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-base.PLASMA-2070 branch from b9b15b3 to e052d20 Compare September 29, 2023 14:16
*/
const getLastModal = (items: ModalInfo[]) => {
const modals = items.filter((item: ModalInfo) => item?.info?.isModal);
const lastModal = modals && (modals[modals.length - 1] as ModalInfo);

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-774/

@Salute-Eva
Copy link
Contributor

Component performance testing

Result: 🟢 Success

Check out report in job artifacts!

@Salute-Eva
Copy link
Contributor

popupInfo={modalInfo}
overlay={
<StyledOverlay
transparent={getIdLastModal(popupController.items) !== innerId}
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.

не очень понял вопрос. Просто теперь еще его можем прокидывать

Copy link
Contributor Author

Choose a reason for hiding this comment

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

а, про транспарент. Да, типо только самый верхний оверлей виден

@kayman233 kayman233 added this pull request to the merge queue Sep 29, 2023
Merged via the queue into dev with commit 9eb47ae Sep 29, 2023
23 of 24 checks passed
@kayman233 kayman233 deleted the kayman233/modal-base.PLASMA-2070 branch September 29, 2023 15:20
@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] 🚀

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] 🚀

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.

6 participants