@doist/reactist 28.7.2 → 28.7.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1457 -0
- package/CODE_OF_CONDUCT.md +83 -0
- package/CONTRIBUTING.md +46 -0
- package/dist/reactist.cjs.development.js +2091 -3811
- package/dist/reactist.cjs.development.js.map +1 -1
- package/dist/reactist.cjs.production.min.js +1 -1
- package/dist/reactist.cjs.production.min.js.map +1 -1
- package/es/avatar/avatar.js +35 -30
- package/es/avatar/avatar.js.map +1 -1
- package/es/avatar/utils.js +19 -22
- package/es/avatar/utils.js.map +1 -1
- package/es/badge/badge.js +5 -16
- package/es/badge/badge.js.map +1 -1
- package/es/banner/banner.js +39 -115
- package/es/banner/banner.js.map +1 -1
- package/es/banner/banner.module.css.js +1 -1
- package/es/base-field/base-field.js +80 -162
- package/es/base-field/base-field.js.map +1 -1
- package/es/base-field/base-field.module.css.js +1 -1
- package/es/box/box.js +61 -137
- package/es/box/box.js.map +1 -1
- package/es/button/button.js +42 -95
- package/es/button/button.js.map +1 -1
- package/es/checkbox-field/checkbox-field.js +46 -73
- package/es/checkbox-field/checkbox-field.js.map +1 -1
- package/es/checkbox-field/checkbox-field.module.css.js +1 -1
- package/es/checkbox-field/checkbox-icon.js +28 -55
- package/es/checkbox-field/checkbox-icon.js.map +1 -1
- package/es/checkbox-field/use-fork-ref.js +29 -25
- package/es/checkbox-field/use-fork-ref.js.map +1 -1
- package/es/columns/columns.js +22 -46
- package/es/columns/columns.js.map +1 -1
- package/es/columns/columns.module.css.js +1 -1
- package/es/components/color-picker/color-picker.js +45 -66
- package/es/components/color-picker/color-picker.js.map +1 -1
- package/es/components/deprecated-button/deprecated-button.js +11 -34
- package/es/components/deprecated-button/deprecated-button.js.map +1 -1
- package/es/components/deprecated-dropdown/dropdown.js +136 -197
- package/es/components/deprecated-dropdown/dropdown.js.map +1 -1
- package/es/components/deprecated-input/input.js +6 -10
- package/es/components/deprecated-input/input.js.map +1 -1
- package/es/components/deprecated-select/select.js +7 -31
- package/es/components/deprecated-select/select.js.map +1 -1
- package/es/components/key-capturer/key-capturer.js +130 -171
- package/es/components/key-capturer/key-capturer.js.map +1 -1
- package/es/components/keyboard-shortcut/keyboard-shortcut.js +48 -79
- package/es/components/keyboard-shortcut/keyboard-shortcut.js.map +1 -1
- package/es/components/progress-bar/progress-bar.js +8 -20
- package/es/components/progress-bar/progress-bar.js.map +1 -1
- package/es/components/time/time-utils.js +52 -64
- package/es/components/time/time-utils.js.map +1 -1
- package/es/components/time/time.js +90 -114
- package/es/components/time/time.js.map +1 -1
- package/es/divider/divider.js +4 -13
- package/es/divider/divider.js.map +1 -1
- package/es/heading/heading.js +19 -28
- package/es/heading/heading.js.map +1 -1
- package/es/hidden/hidden.js +36 -45
- package/es/hidden/hidden.js.map +1 -1
- package/es/hidden-visually/hidden-visually.js +7 -13
- package/es/hidden-visually/hidden-visually.js.map +1 -1
- package/es/icons/alert-icon.js +18 -64
- package/es/icons/alert-icon.js.map +1 -1
- package/es/icons/banner-icon.js +25 -97
- package/es/icons/banner-icon.js.map +1 -1
- package/es/icons/close-icon.js +3 -9
- package/es/icons/close-icon.js.map +1 -1
- package/es/icons/password-hidden-icon.js +6 -23
- package/es/icons/password-hidden-icon.js.map +1 -1
- package/es/icons/password-visible-icon.js +5 -16
- package/es/icons/password-visible-icon.js.map +1 -1
- package/es/inline/inline.js +8 -23
- package/es/inline/inline.js.map +1 -1
- package/es/loading/loading.js +17 -28
- package/es/loading/loading.js.map +1 -1
- package/es/menu/menu.js +127 -260
- package/es/menu/menu.js.map +1 -1
- package/es/modal/modal.js +143 -272
- package/es/modal/modal.js.map +1 -1
- package/es/modal/modal.module.css.js +1 -1
- package/es/notice/notice.js +8 -21
- package/es/notice/notice.js.map +1 -1
- package/es/notice/notice.module.css.js +1 -1
- package/es/password-field/password-field.js +10 -24
- package/es/password-field/password-field.js.map +1 -1
- package/es/prose/prose.js +10 -15
- package/es/prose/prose.js.map +1 -1
- package/es/select-field/select-field.js +14 -51
- package/es/select-field/select-field.js.map +1 -1
- package/es/spinner/spinner.js +6 -20
- package/es/spinner/spinner.js.map +1 -1
- package/es/stack/stack.js +15 -27
- package/es/stack/stack.js.map +1 -1
- package/es/switch-field/switch-field.js +38 -73
- package/es/switch-field/switch-field.js.map +1 -1
- package/es/switch-field/switch-field.module.css.js +1 -1
- package/es/tabs/tabs.js +120 -207
- package/es/tabs/tabs.js.map +1 -1
- package/es/text/text.js +16 -25
- package/es/text/text.js.map +1 -1
- package/es/text-area/text-area.js +54 -111
- package/es/text-area/text-area.js.map +1 -1
- package/es/text-field/text-field.js +30 -84
- package/es/text-field/text-field.js.map +1 -1
- package/es/text-link/text-link.js +9 -20
- package/es/text-link/text-link.js.map +1 -1
- package/es/text-link/text-link.module.css.js +1 -1
- package/es/toast/static-toast.js +35 -70
- package/es/toast/static-toast.js.map +1 -1
- package/es/toast/toast-animation.js +121 -159
- package/es/toast/toast-animation.js.map +1 -1
- package/es/toast/use-toasts.js +134 -197
- package/es/toast/use-toasts.js.map +1 -1
- package/es/tooltip/tooltip.js +31 -69
- package/es/tooltip/tooltip.js.map +1 -1
- package/es/utils/common-helpers.js +9 -13
- package/es/utils/common-helpers.js.map +1 -1
- package/es/utils/polymorphism.js +7 -8
- package/es/utils/polymorphism.js.map +1 -1
- package/es/utils/responsive-props.js +57 -66
- package/es/utils/responsive-props.js.map +1 -1
- package/lib/avatar/avatar.d.ts +21 -21
- package/lib/avatar/avatar.js +69 -1
- package/lib/avatar/avatar.js.map +1 -1
- package/lib/avatar/avatar.module.css.js +7 -1
- package/lib/avatar/avatar.module.css.js.map +1 -1
- package/lib/avatar/index.d.ts +1 -1
- package/lib/avatar/utils.d.ts +3 -3
- package/lib/avatar/utils.js +30 -1
- package/lib/avatar/utils.js.map +1 -1
- package/lib/badge/badge.d.ts +15 -15
- package/lib/badge/badge.js +36 -1
- package/lib/badge/badge.js.map +1 -1
- package/lib/badge/badge.module.css.js +7 -1
- package/lib/badge/badge.module.css.js.map +1 -1
- package/lib/badge/index.d.ts +1 -1
- package/lib/banner/banner.d.ts +87 -87
- package/lib/banner/banner.js +79 -1
- package/lib/banner/banner.js.map +1 -1
- package/lib/banner/banner.module.css.js +7 -1
- package/lib/banner/banner.module.css.js.map +1 -1
- package/lib/banner/index.d.ts +2 -2
- package/lib/banner/story-promo-image.d.ts +4 -4
- package/lib/base-field/base-field.d.ts +139 -139
- package/lib/base-field/base-field.js +127 -1
- package/lib/base-field/base-field.js.map +1 -1
- package/lib/base-field/base-field.module.css.js +7 -1
- package/lib/base-field/base-field.module.css.js.map +1 -1
- package/lib/base-field/index.d.ts +1 -1
- package/lib/box/box.d.ts +73 -73
- package/lib/box/box.js +103 -1
- package/lib/box/box.js.map +1 -1
- package/lib/box/box.module.css.js +7 -1
- package/lib/box/box.module.css.js.map +1 -1
- package/lib/box/gap.module.css.js +7 -1
- package/lib/box/gap.module.css.js.map +1 -1
- package/lib/box/index.d.ts +1 -1
- package/lib/box/margin.module.css.js +7 -1
- package/lib/box/margin.module.css.js.map +1 -1
- package/lib/box/padding.module.css.js +7 -1
- package/lib/box/padding.module.css.js.map +1 -1
- package/lib/box/width.module.css.js +7 -1
- package/lib/box/width.module.css.js.map +1 -1
- package/lib/button/button.d.ts +127 -127
- package/lib/button/button.js +86 -1
- package/lib/button/button.js.map +1 -1
- package/lib/button/button.module.css.js +7 -1
- package/lib/button/button.module.css.js.map +1 -1
- package/lib/button/index.d.ts +1 -1
- package/lib/checkbox-field/checkbox-field.d.ts +40 -40
- package/lib/checkbox-field/checkbox-field.js +82 -1
- package/lib/checkbox-field/checkbox-field.js.map +1 -1
- package/lib/checkbox-field/checkbox-field.module.css.js +7 -1
- package/lib/checkbox-field/checkbox-field.module.css.js.map +1 -1
- package/lib/checkbox-field/checkbox-icon.d.ts +8 -8
- package/lib/checkbox-field/checkbox-icon.js +59 -1
- package/lib/checkbox-field/checkbox-icon.js.map +1 -1
- package/lib/checkbox-field/index.d.ts +1 -1
- package/lib/checkbox-field/use-fork-ref.d.ts +11 -11
- package/lib/checkbox-field/use-fork-ref.js +42 -1
- package/lib/checkbox-field/use-fork-ref.js.map +1 -1
- package/lib/columns/columns.d.ts +20 -20
- package/lib/columns/columns.js +57 -1
- package/lib/columns/columns.js.map +1 -1
- package/lib/columns/columns.module.css.js +7 -1
- package/lib/columns/columns.module.css.js.map +1 -1
- package/lib/columns/index.d.ts +1 -1
- package/lib/components/color-picker/color-picker.d.ts +29 -29
- package/lib/components/color-picker/color-picker.js +86 -1
- package/lib/components/color-picker/color-picker.js.map +1 -1
- package/lib/components/color-picker/index.d.ts +3 -3
- package/lib/components/color-picker/index.js +11 -1
- package/lib/components/color-picker/index.js.map +1 -1
- package/lib/components/deprecated-button/deprecated-button.d.ts +54 -54
- package/lib/components/deprecated-button/deprecated-button.js +49 -1
- package/lib/components/deprecated-button/deprecated-button.js.map +1 -1
- package/lib/components/deprecated-button/index.d.ts +4 -4
- package/lib/components/deprecated-button/index.js +9 -1
- package/lib/components/deprecated-button/index.js.map +1 -1
- package/lib/components/deprecated-dropdown/dropdown.d.ts +55 -55
- package/lib/components/deprecated-dropdown/dropdown.js +182 -1
- package/lib/components/deprecated-dropdown/dropdown.js.map +1 -1
- package/lib/components/deprecated-dropdown/index.d.ts +2 -2
- package/lib/components/deprecated-dropdown/index.js +9 -1
- package/lib/components/deprecated-dropdown/index.js.map +1 -1
- package/lib/components/deprecated-input/index.d.ts +2 -2
- package/lib/components/deprecated-input/index.js +9 -1
- package/lib/components/deprecated-input/index.js.map +1 -1
- package/lib/components/deprecated-input/input.d.ts +10 -10
- package/lib/components/deprecated-input/input.js +41 -1
- package/lib/components/deprecated-input/input.js.map +1 -1
- package/lib/components/deprecated-select/index.d.ts +2 -2
- package/lib/components/deprecated-select/index.js +9 -1
- package/lib/components/deprecated-select/index.js.map +1 -1
- package/lib/components/deprecated-select/select.d.ts +33 -33
- package/lib/components/deprecated-select/select.js +43 -1
- package/lib/components/deprecated-select/select.js.map +1 -1
- package/lib/components/icons/CloseIcon.svg.d.ts +3 -3
- package/lib/components/icons/ThinQuestionMarkIcon.svg.d.ts +3 -3
- package/lib/components/icons/ThreeDotsIcon.svg.d.ts +12 -12
- package/lib/components/key-capturer/index.d.ts +3 -3
- package/lib/components/key-capturer/index.js +11 -1
- package/lib/components/key-capturer/index.js.map +1 -1
- package/lib/components/key-capturer/key-capturer.d.ts +40 -40
- package/lib/components/key-capturer/key-capturer.js +171 -1
- package/lib/components/key-capturer/key-capturer.js.map +1 -1
- package/lib/components/keyboard-shortcut/index.d.ts +2 -2
- package/lib/components/keyboard-shortcut/index.js +9 -1
- package/lib/components/keyboard-shortcut/index.js.map +1 -1
- package/lib/components/keyboard-shortcut/keyboard-shortcut.d.ts +44 -44
- package/lib/components/keyboard-shortcut/keyboard-shortcut.js +97 -1
- package/lib/components/keyboard-shortcut/keyboard-shortcut.js.map +1 -1
- package/lib/components/progress-bar/index.d.ts +2 -2
- package/lib/components/progress-bar/index.js +9 -1
- package/lib/components/progress-bar/index.js.map +1 -1
- package/lib/components/progress-bar/progress-bar.d.ts +14 -14
- package/lib/components/progress-bar/progress-bar.js +44 -1
- package/lib/components/progress-bar/progress-bar.js.map +1 -1
- package/lib/components/progress-bar/progress-bar.module.css.js +7 -1
- package/lib/components/progress-bar/progress-bar.module.css.js.map +1 -1
- package/lib/components/time/index.d.ts +2 -2
- package/lib/components/time/index.js +9 -1
- package/lib/components/time/index.js.map +1 -1
- package/lib/components/time/time-utils.d.ts +19 -19
- package/lib/components/time/time-utils.js +69 -1
- package/lib/components/time/time-utils.js.map +1 -1
- package/lib/components/time/time.d.ts +39 -39
- package/lib/components/time/time.js +124 -1
- package/lib/components/time/time.js.map +1 -1
- package/lib/divider/divider.d.ts +8 -8
- package/lib/divider/divider.js +36 -1
- package/lib/divider/divider.js.map +1 -1
- package/lib/divider/divider.module.css.js +7 -1
- package/lib/divider/divider.module.css.js.map +1 -1
- package/lib/divider/index.d.ts +1 -1
- package/lib/heading/heading.d.ts +112 -112
- package/lib/heading/heading.js +51 -1
- package/lib/heading/heading.js.map +1 -1
- package/lib/heading/heading.module.css.js +7 -1
- package/lib/heading/heading.module.css.js.map +1 -1
- package/lib/heading/index.d.ts +1 -1
- package/lib/hidden/hidden.d.ts +49 -49
- package/lib/hidden/hidden.js +70 -1
- package/lib/hidden/hidden.js.map +1 -1
- package/lib/hidden/hidden.module.css.js +7 -1
- package/lib/hidden/hidden.module.css.js.map +1 -1
- package/lib/hidden/index.d.ts +1 -1
- package/lib/hidden-visually/hidden-visually.d.ts +11 -11
- package/lib/hidden-visually/hidden-visually.js +40 -1
- package/lib/hidden-visually/hidden-visually.js.map +1 -1
- package/lib/hidden-visually/hidden-visually.module.css.js +7 -1
- package/lib/hidden-visually/hidden-visually.module.css.js.map +1 -1
- package/lib/hidden-visually/index.d.ts +1 -1
- package/lib/hooks/use-previous/index.d.ts +1 -1
- package/lib/hooks/use-previous/use-previous.d.ts +15 -15
- package/lib/icons/alert-icon.d.ts +6 -6
- package/lib/icons/alert-icon.js +56 -1
- package/lib/icons/alert-icon.js.map +1 -1
- package/lib/icons/banner-icon.d.ts +6 -6
- package/lib/icons/banner-icon.js +68 -1
- package/lib/icons/banner-icon.js.map +1 -1
- package/lib/icons/banner-icon.module.css.js +7 -1
- package/lib/icons/banner-icon.module.css.js.map +1 -1
- package/lib/icons/close-icon.d.ts +3 -3
- package/lib/icons/close-icon.js +33 -1
- package/lib/icons/close-icon.js.map +1 -1
- package/lib/icons/password-hidden-icon.d.ts +3 -3
- package/lib/icons/password-hidden-icon.js +36 -1
- package/lib/icons/password-hidden-icon.js.map +1 -1
- package/lib/icons/password-visible-icon.d.ts +3 -3
- package/lib/icons/password-visible-icon.js +35 -1
- package/lib/icons/password-visible-icon.js.map +1 -1
- package/lib/index.d.ts +38 -38
- package/lib/index.js +106 -1
- package/lib/index.js.map +1 -1
- package/lib/inline/index.d.ts +1 -1
- package/lib/inline/inline.d.ts +12 -12
- package/lib/inline/inline.js +40 -1
- package/lib/inline/inline.js.map +1 -1
- package/lib/loading/index.d.ts +1 -1
- package/lib/loading/loading.d.ts +26 -26
- package/lib/loading/loading.js +49 -1
- package/lib/loading/loading.js.map +1 -1
- package/lib/menu/index.d.ts +2 -2
- package/lib/menu/menu.d.ts +128 -128
- package/lib/menu/menu.js +179 -1
- package/lib/menu/menu.js.map +1 -1
- package/lib/modal/index.d.ts +1 -1
- package/lib/modal/modal-stories-components.d.ts +47 -47
- package/lib/modal/modal.d.ts +185 -185
- package/lib/modal/modal.js +209 -1
- package/lib/modal/modal.js.map +1 -1
- package/lib/modal/modal.module.css.js +7 -1
- package/lib/modal/modal.module.css.js.map +1 -1
- package/lib/notice/index.d.ts +1 -1
- package/lib/notice/notice.d.ts +10 -10
- package/lib/notice/notice.js +42 -1
- package/lib/notice/notice.js.map +1 -1
- package/lib/notice/notice.module.css.js +7 -1
- package/lib/notice/notice.module.css.js.map +1 -1
- package/lib/password-field/index.d.ts +1 -1
- package/lib/password-field/password-field.d.ts +10 -10
- package/lib/password-field/password-field.js +43 -1
- package/lib/password-field/password-field.js.map +1 -1
- package/lib/prose/index.d.ts +2 -2
- package/lib/prose/prose-example.d.ts +1 -1
- package/lib/prose/prose.d.ts +44 -44
- package/lib/prose/prose.js +42 -1
- package/lib/prose/prose.js.map +1 -1
- package/lib/prose/prose.module.css.js +7 -1
- package/lib/prose/prose.module.css.js.map +1 -1
- package/lib/select-field/index.d.ts +1 -1
- package/lib/select-field/select-field.d.ts +7 -7
- package/lib/select-field/select-field.js +48 -1
- package/lib/select-field/select-field.js.map +1 -1
- package/lib/select-field/select-field.module.css.js +7 -1
- package/lib/select-field/select-field.module.css.js.map +1 -1
- package/lib/spinner/index.d.ts +1 -1
- package/lib/spinner/spinner.d.ts +5 -5
- package/lib/spinner/spinner.js +36 -1
- package/lib/spinner/spinner.js.map +1 -1
- package/lib/spinner/spinner.module.css.js +7 -1
- package/lib/spinner/spinner.module.css.js.map +1 -1
- package/lib/stack/index.d.ts +1 -1
- package/lib/stack/stack.d.ts +15 -15
- package/lib/stack/stack.js +52 -1
- package/lib/stack/stack.js.map +1 -1
- package/lib/switch-field/index.d.ts +1 -1
- package/lib/switch-field/switch-field.d.ts +19 -19
- package/lib/switch-field/switch-field.js +74 -1
- package/lib/switch-field/switch-field.js.map +1 -1
- package/lib/switch-field/switch-field.module.css.js +7 -1
- package/lib/switch-field/switch-field.module.css.js.map +1 -1
- package/lib/tabs/index.d.ts +1 -1
- package/lib/tabs/tabs.d.ts +125 -125
- package/lib/tabs/tabs.js +177 -1
- package/lib/tabs/tabs.js.map +1 -1
- package/lib/tabs/tabs.module.css.js +7 -1
- package/lib/tabs/tabs.module.css.js.map +1 -1
- package/lib/text/index.d.ts +1 -1
- package/lib/text/text.d.ts +47 -47
- package/lib/text/text.js +49 -1
- package/lib/text/text.js.map +1 -1
- package/lib/text/text.module.css.js +7 -1
- package/lib/text/text.module.css.js.map +1 -1
- package/lib/text-area/index.d.ts +1 -1
- package/lib/text-area/text-area.d.ts +39 -39
- package/lib/text-area/text-area.js +92 -1
- package/lib/text-area/text-area.js.map +1 -1
- package/lib/text-area/text-area.module.css.js +7 -1
- package/lib/text-area/text-area.module.css.js.map +1 -1
- package/lib/text-field/index.d.ts +1 -1
- package/lib/text-field/text-field.d.ts +18 -18
- package/lib/text-field/text-field.js +63 -1
- package/lib/text-field/text-field.js.map +1 -1
- package/lib/text-field/text-field.module.css.js +7 -1
- package/lib/text-field/text-field.module.css.js.map +1 -1
- package/lib/text-link/index.d.ts +1 -1
- package/lib/text-link/text-link.d.ts +9 -9
- package/lib/text-link/text-link.js +41 -1
- package/lib/text-link/text-link.js.map +1 -1
- package/lib/text-link/text-link.module.css.js +7 -1
- package/lib/text-link/text-link.module.css.js.map +1 -1
- package/lib/toast/index.d.ts +4 -4
- package/lib/toast/static-toast.d.ts +63 -63
- package/lib/toast/static-toast.js +59 -1
- package/lib/toast/static-toast.js.map +1 -1
- package/lib/toast/toast-animation.d.ts +50 -50
- package/lib/toast/toast-animation.js +141 -1
- package/lib/toast/toast-animation.js.map +1 -1
- package/lib/toast/toast.module.css.js +7 -1
- package/lib/toast/toast.module.css.js.map +1 -1
- package/lib/toast/use-toasts.d.ts +132 -132
- package/lib/toast/use-toasts.js +166 -1
- package/lib/toast/use-toasts.js.map +1 -1
- package/lib/tooltip/index.d.ts +2 -2
- package/lib/tooltip/tooltip.d.ts +72 -72
- package/lib/tooltip/tooltip.js +67 -1
- package/lib/tooltip/tooltip.js.map +1 -1
- package/lib/tooltip/tooltip.module.css.js +7 -1
- package/lib/tooltip/tooltip.module.css.js.map +1 -1
- package/lib/utils/common-helpers.d.ts +2 -2
- package/lib/utils/common-helpers.js +44 -1
- package/lib/utils/common-helpers.js.map +1 -1
- package/lib/utils/common-types.d.ts +42 -42
- package/lib/utils/polymorphism.d.ts +135 -135
- package/lib/utils/polymorphism.js +39 -1
- package/lib/utils/polymorphism.js.map +1 -1
- package/lib/utils/responsive-props.d.ts +44 -44
- package/lib/utils/responsive-props.js +70 -1
- package/lib/utils/responsive-props.js.map +1 -1
- package/lib/utils/storybook-helper.d.ts +55 -0
- package/lib/utils/test-helpers.d.ts +22 -22
- package/package.json +32 -26
- package/styles/avatar.css +2 -2
- package/styles/avatar.module.css.css +1 -1
- package/styles/badge.css +2 -2
- package/styles/badge.module.css.css +1 -1
- package/styles/banner.css +6 -6
- package/styles/banner.module.css.css +1 -1
- package/styles/base-field.css +4 -4
- package/styles/base-field.module.css.css +1 -1
- package/styles/box.css +1 -1
- package/styles/box.module.css.css +1 -1
- package/styles/button.css +4 -4
- package/styles/button.module.css.css +1 -1
- package/styles/checkbox-field.css +3 -3
- package/styles/checkbox-field.module.css.css +1 -1
- package/styles/columns.css +1 -1
- package/styles/divider.css +1 -1
- package/styles/heading.css +2 -2
- package/styles/heading.module.css.css +1 -1
- package/styles/hidden-visually.css +2 -2
- package/styles/hidden-visually.module.css.css +1 -1
- package/styles/hidden.css +1 -1
- package/styles/index.css +4 -4
- package/styles/loading.css +2 -2
- package/styles/menu.css +1 -1
- package/styles/modal.css +5 -5
- package/styles/modal.module.css.css +1 -1
- package/styles/notice.css +1 -1
- package/styles/password-field.css +7 -7
- package/styles/progress-bar.module.css.css +1 -1
- package/styles/prose.css +2 -2
- package/styles/prose.module.css.css +1 -1
- package/styles/reactist.css +30 -30
- package/styles/select-field.css +5 -5
- package/styles/select-field.module.css.css +1 -1
- package/styles/spinner.css +1 -1
- package/styles/static-toast.css +6 -6
- package/styles/switch-field.css +6 -6
- package/styles/switch-field.module.css.css +1 -1
- package/styles/tabs.css +2 -2
- package/styles/tabs.module.css.css +1 -1
- package/styles/text-area.css +5 -5
- package/styles/text-area.module.css.css +1 -1
- package/styles/text-field.css +5 -5
- package/styles/text-field.module.css.css +1 -1
- package/styles/text-link.css +2 -2
- package/styles/text-link.module.css.css +1 -1
- package/styles/text.css +2 -2
- package/styles/text.module.css.css +1 -1
- package/styles/toast.module.css.css +1 -1
- package/styles/tooltip.css +2 -2
- package/styles/tooltip.module.css.css +1 -1
- package/styles/use-toasts.css +6 -6
- package/es/_virtual/_rollupPluginBabelHelpers.js +0 -91
- package/es/_virtual/_rollupPluginBabelHelpers.js.map +0 -1
- package/lib/_virtual/_rollupPluginBabelHelpers.js +0 -2
- package/lib/_virtual/_rollupPluginBabelHelpers.js.map +0 -1
package/lib/modal/modal.d.ts
CHANGED
|
@@ -1,185 +1,185 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { DialogOptions, PortalOptions } from '@ariakit/react';
|
|
3
|
-
import { IconButtonProps } from '../button';
|
|
4
|
-
import type { ObfuscatedClassName } from '../utils/common-types';
|
|
5
|
-
import type { DividerProps } from '../divider';
|
|
6
|
-
type ModalWidth = 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'full';
|
|
7
|
-
type ModalHeightMode = 'expand' | 'fitContent';
|
|
8
|
-
type DivProps = Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLDivElement>, HTMLDivElement>, 'className' | 'children' | `aria-label` | `aria-labelledby`>;
|
|
9
|
-
export interface ModalProps extends DivProps, ObfuscatedClassName {
|
|
10
|
-
/**
|
|
11
|
-
* The content of the modal.
|
|
12
|
-
*/
|
|
13
|
-
children: React.ReactNode;
|
|
14
|
-
/**
|
|
15
|
-
* Whether the modal is open and visible or not.
|
|
16
|
-
*/
|
|
17
|
-
isOpen: boolean;
|
|
18
|
-
/**
|
|
19
|
-
* Called when the user triggers closing the modal.
|
|
20
|
-
*/
|
|
21
|
-
onDismiss?(): void;
|
|
22
|
-
/**
|
|
23
|
-
* A descriptive setting for how wide the modal should aim to be, depending on how much space
|
|
24
|
-
* it has on screen.
|
|
25
|
-
* @default 'medium'
|
|
26
|
-
*/
|
|
27
|
-
width?: ModalWidth;
|
|
28
|
-
/**
|
|
29
|
-
* A descriptive setting for how tall the modal should aim to be.
|
|
30
|
-
*
|
|
31
|
-
* - 'expand': the modal aims to fill most of the available screen height, leaving only a small
|
|
32
|
-
* padding above and below.
|
|
33
|
-
* - 'fitContent': the modal shrinks to the smallest size that allow it to fit its content.
|
|
34
|
-
*
|
|
35
|
-
* In either case, if content does not fit, the content of the main body is set to scroll
|
|
36
|
-
* (provided you use `ModalBody`) so that the modal never has to strech vertically beyond the
|
|
37
|
-
* viewport boundaries.
|
|
38
|
-
*
|
|
39
|
-
* If you do not use `ModalBody`, the modal still prevents overflow, and you are in charge of
|
|
40
|
-
* the inner layout to ensure scroll, or whatever other strategy you may want.
|
|
41
|
-
*/
|
|
42
|
-
height?: ModalHeightMode;
|
|
43
|
-
/**
|
|
44
|
-
* The weight to apply to all dividers rendered inside the modal.
|
|
45
|
-
*/
|
|
46
|
-
dividers?: DividerProps['weight'];
|
|
47
|
-
/**
|
|
48
|
-
* Whether to set or not the focus initially to the first focusable element inside the modal.
|
|
49
|
-
*/
|
|
50
|
-
autoFocus?: boolean;
|
|
51
|
-
/**
|
|
52
|
-
* Controls if the modal is dismissed when pressing "Escape".
|
|
53
|
-
*/
|
|
54
|
-
hideOnEscape?: DialogOptions['hideOnEscape'];
|
|
55
|
-
/**
|
|
56
|
-
* Controls if the modal is dismissed when clicking outside the modal body, on the overlay.
|
|
57
|
-
*/
|
|
58
|
-
hideOnInteractOutside?: DialogOptions['hideOnInteractOutside'];
|
|
59
|
-
/**
|
|
60
|
-
* An escape hatch in case you need to provide a custom class name to the overlay element.
|
|
61
|
-
*/
|
|
62
|
-
exceptionallySetOverlayClassName?: string;
|
|
63
|
-
/**
|
|
64
|
-
* Defines a string value that labels the current modal for assistive technologies.
|
|
65
|
-
*/
|
|
66
|
-
'aria-label'?: string;
|
|
67
|
-
/**
|
|
68
|
-
* Identifies the element (or elements) that labels the current modal for assistive technologies.
|
|
69
|
-
*/
|
|
70
|
-
'aria-labelledby'?: string;
|
|
71
|
-
/**
|
|
72
|
-
* An HTML element or a memoized callback function that returns an HTML element to be used as
|
|
73
|
-
* the portal element. By default, the portal element will be a `div` element appended to the
|
|
74
|
-
* `document.body`.
|
|
75
|
-
*
|
|
76
|
-
* @default HTMLDivElement
|
|
77
|
-
*
|
|
78
|
-
* @example
|
|
79
|
-
* const [portal, setPortal] = useState(null);
|
|
80
|
-
* <Portal portalElement={portal} />;
|
|
81
|
-
* <div ref={setPortal} />;
|
|
82
|
-
*
|
|
83
|
-
* @example
|
|
84
|
-
* const getPortalElement = useCallback(() => {
|
|
85
|
-
* const div = document.createElement("div");
|
|
86
|
-
* const portalRoot = document.getElementById("portal-root");
|
|
87
|
-
* portalRoot.appendChild(div);
|
|
88
|
-
* return div;
|
|
89
|
-
* }, []);
|
|
90
|
-
* <Portal portalElement={getPortalElement} />;
|
|
91
|
-
*/
|
|
92
|
-
portalElement?: PortalOptions['portalElement'];
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* Renders a modal that sits on top of the rest of the content in the entire page.
|
|
96
|
-
*
|
|
97
|
-
* Follows the WAI-ARIA Dialog (Modal) Pattern.
|
|
98
|
-
*
|
|
99
|
-
* @see ModalHeader
|
|
100
|
-
* @see ModalFooter
|
|
101
|
-
* @see ModalBody
|
|
102
|
-
*/
|
|
103
|
-
export declare function Modal({ isOpen, onDismiss, height, dividers, width, exceptionallySetClassName, exceptionallySetOverlayClassName, autoFocus, hideOnEscape, hideOnInteractOutside, children, portalElement, onKeyDown, className, ...props }: ModalProps): React.JSX.Element | null;
|
|
104
|
-
export interface ModalCloseButtonProps extends Omit<IconButtonProps, 'type' | 'variant' | 'icon' | 'disabled' | 'loading' | 'tabIndex' | 'ref'> {
|
|
105
|
-
/**
|
|
106
|
-
* The descriptive label of the button.
|
|
107
|
-
*/
|
|
108
|
-
'aria-label': string;
|
|
109
|
-
}
|
|
110
|
-
/**
|
|
111
|
-
* The close button rendered by ModalHeader. Provided independently so that consumers can customize
|
|
112
|
-
* the button's label.
|
|
113
|
-
*
|
|
114
|
-
* @see ModalHeader
|
|
115
|
-
*/
|
|
116
|
-
export declare function ModalCloseButton(props: ModalCloseButtonProps): React.JSX.Element;
|
|
117
|
-
export interface ModalHeaderProps extends DivProps, ObfuscatedClassName {
|
|
118
|
-
/**
|
|
119
|
-
* The content of the header.
|
|
120
|
-
*/
|
|
121
|
-
children: React.ReactNode;
|
|
122
|
-
/**
|
|
123
|
-
* Allows to provide a custom button element, or to omit the close button if set to false.
|
|
124
|
-
* @see ModalCloseButton
|
|
125
|
-
*/
|
|
126
|
-
button?: React.ReactNode | boolean;
|
|
127
|
-
/**
|
|
128
|
-
* Whether to render a divider line below the header.
|
|
129
|
-
* @default false
|
|
130
|
-
*/
|
|
131
|
-
withDivider?: boolean;
|
|
132
|
-
}
|
|
133
|
-
/**
|
|
134
|
-
* Renders a standard modal header area with an optional close button.
|
|
135
|
-
*
|
|
136
|
-
* @see Modal
|
|
137
|
-
* @see ModalFooter
|
|
138
|
-
* @see ModalBody
|
|
139
|
-
*/
|
|
140
|
-
export declare function ModalHeader({ children, button, withDivider, exceptionallySetClassName, ...props }: ModalHeaderProps): React.JSX.Element;
|
|
141
|
-
export interface ModalBodyProps extends DivProps, ObfuscatedClassName {
|
|
142
|
-
/**
|
|
143
|
-
* The content of the modal body.
|
|
144
|
-
*/
|
|
145
|
-
children: React.ReactNode;
|
|
146
|
-
}
|
|
147
|
-
/**
|
|
148
|
-
* Renders the body of a modal.
|
|
149
|
-
*
|
|
150
|
-
* Convenient to use alongside ModalHeader and/or ModalFooter as needed. It ensures, among other
|
|
151
|
-
* things, that the content of the modal body expands or contracts depending on the modal height
|
|
152
|
-
* setting or the size of the content. The body content also automatically scrolls when it's too
|
|
153
|
-
* large to fit the available space.
|
|
154
|
-
*
|
|
155
|
-
* @see Modal
|
|
156
|
-
* @see ModalHeader
|
|
157
|
-
* @see ModalFooter
|
|
158
|
-
*/
|
|
159
|
-
export declare const ModalBody: React.ForwardRefExoticComponent<Omit<ModalBodyProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
160
|
-
export interface ModalFooterProps extends DivProps, ObfuscatedClassName {
|
|
161
|
-
/**
|
|
162
|
-
* The contant of the modal footer.
|
|
163
|
-
*/
|
|
164
|
-
children: React.ReactNode;
|
|
165
|
-
/**
|
|
166
|
-
* Whether to render a divider line below the footer.
|
|
167
|
-
* @default false
|
|
168
|
-
*/
|
|
169
|
-
withDivider?: boolean;
|
|
170
|
-
}
|
|
171
|
-
/**
|
|
172
|
-
* Renders a standard modal footer area.
|
|
173
|
-
*
|
|
174
|
-
* @see Modal
|
|
175
|
-
* @see ModalHeader
|
|
176
|
-
* @see ModalBody
|
|
177
|
-
*/
|
|
178
|
-
export declare function ModalFooter({ exceptionallySetClassName, withDivider, ...props }: ModalFooterProps): React.JSX.Element;
|
|
179
|
-
export type ModalActionsProps = ModalFooterProps;
|
|
180
|
-
/**
|
|
181
|
-
* A specific version of the ModalFooter, tailored to showing an inline list of actions (buttons).
|
|
182
|
-
* @see ModalFooter
|
|
183
|
-
*/
|
|
184
|
-
export declare function ModalActions({ children, ...props }: ModalActionsProps): React.JSX.Element;
|
|
185
|
-
export {};
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { DialogOptions, PortalOptions } from '@ariakit/react';
|
|
3
|
+
import { IconButtonProps } from '../button';
|
|
4
|
+
import type { ObfuscatedClassName } from '../utils/common-types';
|
|
5
|
+
import type { DividerProps } from '../divider';
|
|
6
|
+
type ModalWidth = 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'full';
|
|
7
|
+
type ModalHeightMode = 'expand' | 'fitContent';
|
|
8
|
+
type DivProps = Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLDivElement>, HTMLDivElement>, 'className' | 'children' | `aria-label` | `aria-labelledby`>;
|
|
9
|
+
export interface ModalProps extends DivProps, ObfuscatedClassName {
|
|
10
|
+
/**
|
|
11
|
+
* The content of the modal.
|
|
12
|
+
*/
|
|
13
|
+
children: React.ReactNode;
|
|
14
|
+
/**
|
|
15
|
+
* Whether the modal is open and visible or not.
|
|
16
|
+
*/
|
|
17
|
+
isOpen: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Called when the user triggers closing the modal.
|
|
20
|
+
*/
|
|
21
|
+
onDismiss?(): void;
|
|
22
|
+
/**
|
|
23
|
+
* A descriptive setting for how wide the modal should aim to be, depending on how much space
|
|
24
|
+
* it has on screen.
|
|
25
|
+
* @default 'medium'
|
|
26
|
+
*/
|
|
27
|
+
width?: ModalWidth;
|
|
28
|
+
/**
|
|
29
|
+
* A descriptive setting for how tall the modal should aim to be.
|
|
30
|
+
*
|
|
31
|
+
* - 'expand': the modal aims to fill most of the available screen height, leaving only a small
|
|
32
|
+
* padding above and below.
|
|
33
|
+
* - 'fitContent': the modal shrinks to the smallest size that allow it to fit its content.
|
|
34
|
+
*
|
|
35
|
+
* In either case, if content does not fit, the content of the main body is set to scroll
|
|
36
|
+
* (provided you use `ModalBody`) so that the modal never has to strech vertically beyond the
|
|
37
|
+
* viewport boundaries.
|
|
38
|
+
*
|
|
39
|
+
* If you do not use `ModalBody`, the modal still prevents overflow, and you are in charge of
|
|
40
|
+
* the inner layout to ensure scroll, or whatever other strategy you may want.
|
|
41
|
+
*/
|
|
42
|
+
height?: ModalHeightMode;
|
|
43
|
+
/**
|
|
44
|
+
* The weight to apply to all dividers rendered inside the modal.
|
|
45
|
+
*/
|
|
46
|
+
dividers?: DividerProps['weight'];
|
|
47
|
+
/**
|
|
48
|
+
* Whether to set or not the focus initially to the first focusable element inside the modal.
|
|
49
|
+
*/
|
|
50
|
+
autoFocus?: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Controls if the modal is dismissed when pressing "Escape".
|
|
53
|
+
*/
|
|
54
|
+
hideOnEscape?: DialogOptions['hideOnEscape'];
|
|
55
|
+
/**
|
|
56
|
+
* Controls if the modal is dismissed when clicking outside the modal body, on the overlay.
|
|
57
|
+
*/
|
|
58
|
+
hideOnInteractOutside?: DialogOptions['hideOnInteractOutside'];
|
|
59
|
+
/**
|
|
60
|
+
* An escape hatch in case you need to provide a custom class name to the overlay element.
|
|
61
|
+
*/
|
|
62
|
+
exceptionallySetOverlayClassName?: string;
|
|
63
|
+
/**
|
|
64
|
+
* Defines a string value that labels the current modal for assistive technologies.
|
|
65
|
+
*/
|
|
66
|
+
'aria-label'?: string;
|
|
67
|
+
/**
|
|
68
|
+
* Identifies the element (or elements) that labels the current modal for assistive technologies.
|
|
69
|
+
*/
|
|
70
|
+
'aria-labelledby'?: string;
|
|
71
|
+
/**
|
|
72
|
+
* An HTML element or a memoized callback function that returns an HTML element to be used as
|
|
73
|
+
* the portal element. By default, the portal element will be a `div` element appended to the
|
|
74
|
+
* `document.body`.
|
|
75
|
+
*
|
|
76
|
+
* @default HTMLDivElement
|
|
77
|
+
*
|
|
78
|
+
* @example
|
|
79
|
+
* const [portal, setPortal] = useState(null);
|
|
80
|
+
* <Portal portalElement={portal} />;
|
|
81
|
+
* <div ref={setPortal} />;
|
|
82
|
+
*
|
|
83
|
+
* @example
|
|
84
|
+
* const getPortalElement = useCallback(() => {
|
|
85
|
+
* const div = document.createElement("div");
|
|
86
|
+
* const portalRoot = document.getElementById("portal-root");
|
|
87
|
+
* portalRoot.appendChild(div);
|
|
88
|
+
* return div;
|
|
89
|
+
* }, []);
|
|
90
|
+
* <Portal portalElement={getPortalElement} />;
|
|
91
|
+
*/
|
|
92
|
+
portalElement?: PortalOptions['portalElement'];
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Renders a modal that sits on top of the rest of the content in the entire page.
|
|
96
|
+
*
|
|
97
|
+
* Follows the WAI-ARIA Dialog (Modal) Pattern.
|
|
98
|
+
*
|
|
99
|
+
* @see ModalHeader
|
|
100
|
+
* @see ModalFooter
|
|
101
|
+
* @see ModalBody
|
|
102
|
+
*/
|
|
103
|
+
export declare function Modal({ isOpen, onDismiss, height, dividers, width, exceptionallySetClassName, exceptionallySetOverlayClassName, autoFocus, hideOnEscape, hideOnInteractOutside, children, portalElement, onKeyDown, className, ...props }: ModalProps): React.JSX.Element | null;
|
|
104
|
+
export interface ModalCloseButtonProps extends Omit<IconButtonProps, 'type' | 'variant' | 'icon' | 'disabled' | 'loading' | 'tabIndex' | 'ref'> {
|
|
105
|
+
/**
|
|
106
|
+
* The descriptive label of the button.
|
|
107
|
+
*/
|
|
108
|
+
'aria-label': string;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* The close button rendered by ModalHeader. Provided independently so that consumers can customize
|
|
112
|
+
* the button's label.
|
|
113
|
+
*
|
|
114
|
+
* @see ModalHeader
|
|
115
|
+
*/
|
|
116
|
+
export declare function ModalCloseButton(props: ModalCloseButtonProps): React.JSX.Element;
|
|
117
|
+
export interface ModalHeaderProps extends DivProps, ObfuscatedClassName {
|
|
118
|
+
/**
|
|
119
|
+
* The content of the header.
|
|
120
|
+
*/
|
|
121
|
+
children: React.ReactNode;
|
|
122
|
+
/**
|
|
123
|
+
* Allows to provide a custom button element, or to omit the close button if set to false.
|
|
124
|
+
* @see ModalCloseButton
|
|
125
|
+
*/
|
|
126
|
+
button?: React.ReactNode | boolean;
|
|
127
|
+
/**
|
|
128
|
+
* Whether to render a divider line below the header.
|
|
129
|
+
* @default false
|
|
130
|
+
*/
|
|
131
|
+
withDivider?: boolean;
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Renders a standard modal header area with an optional close button.
|
|
135
|
+
*
|
|
136
|
+
* @see Modal
|
|
137
|
+
* @see ModalFooter
|
|
138
|
+
* @see ModalBody
|
|
139
|
+
*/
|
|
140
|
+
export declare function ModalHeader({ children, button, withDivider, exceptionallySetClassName, ...props }: ModalHeaderProps): React.JSX.Element;
|
|
141
|
+
export interface ModalBodyProps extends DivProps, ObfuscatedClassName {
|
|
142
|
+
/**
|
|
143
|
+
* The content of the modal body.
|
|
144
|
+
*/
|
|
145
|
+
children: React.ReactNode;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Renders the body of a modal.
|
|
149
|
+
*
|
|
150
|
+
* Convenient to use alongside ModalHeader and/or ModalFooter as needed. It ensures, among other
|
|
151
|
+
* things, that the content of the modal body expands or contracts depending on the modal height
|
|
152
|
+
* setting or the size of the content. The body content also automatically scrolls when it's too
|
|
153
|
+
* large to fit the available space.
|
|
154
|
+
*
|
|
155
|
+
* @see Modal
|
|
156
|
+
* @see ModalHeader
|
|
157
|
+
* @see ModalFooter
|
|
158
|
+
*/
|
|
159
|
+
export declare const ModalBody: React.ForwardRefExoticComponent<Omit<ModalBodyProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
160
|
+
export interface ModalFooterProps extends DivProps, ObfuscatedClassName {
|
|
161
|
+
/**
|
|
162
|
+
* The contant of the modal footer.
|
|
163
|
+
*/
|
|
164
|
+
children: React.ReactNode;
|
|
165
|
+
/**
|
|
166
|
+
* Whether to render a divider line below the footer.
|
|
167
|
+
* @default false
|
|
168
|
+
*/
|
|
169
|
+
withDivider?: boolean;
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Renders a standard modal footer area.
|
|
173
|
+
*
|
|
174
|
+
* @see Modal
|
|
175
|
+
* @see ModalHeader
|
|
176
|
+
* @see ModalBody
|
|
177
|
+
*/
|
|
178
|
+
export declare function ModalFooter({ exceptionallySetClassName, withDivider, ...props }: ModalFooterProps): React.JSX.Element;
|
|
179
|
+
export type ModalActionsProps = ModalFooterProps;
|
|
180
|
+
/**
|
|
181
|
+
* A specific version of the ModalFooter, tailored to showing an inline list of actions (buttons).
|
|
182
|
+
* @see ModalFooter
|
|
183
|
+
*/
|
|
184
|
+
export declare function ModalActions({ children, ...props }: ModalActionsProps): React.JSX.Element;
|
|
185
|
+
export {};
|
package/lib/modal/modal.js
CHANGED
|
@@ -1,2 +1,210 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var tslib = require('tslib');
|
|
6
|
+
var React = require('react');
|
|
7
|
+
var classNames = require('classnames');
|
|
8
|
+
var FocusLock = require('react-focus-lock');
|
|
9
|
+
var ariaHidden = require('aria-hidden');
|
|
10
|
+
var react = require('@ariakit/react');
|
|
11
|
+
var closeIcon = require('../icons/close-icon.js');
|
|
12
|
+
var columns = require('../columns/columns.js');
|
|
13
|
+
var inline = require('../inline/inline.js');
|
|
14
|
+
var divider = require('../divider/divider.js');
|
|
15
|
+
var box = require('../box/box.js');
|
|
16
|
+
var button = require('../button/button.js');
|
|
17
|
+
var modal_module = require('./modal.module.css.js');
|
|
18
|
+
|
|
19
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
20
|
+
|
|
21
|
+
function _interopNamespace(e) {
|
|
22
|
+
if (e && e.__esModule) return e;
|
|
23
|
+
var n = Object.create(null);
|
|
24
|
+
if (e) {
|
|
25
|
+
Object.keys(e).forEach(function (k) {
|
|
26
|
+
if (k !== 'default') {
|
|
27
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
28
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
29
|
+
enumerable: true,
|
|
30
|
+
get: function () { return e[k]; }
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
n["default"] = e;
|
|
36
|
+
return Object.freeze(n);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
40
|
+
var classNames__default = /*#__PURE__*/_interopDefaultLegacy(classNames);
|
|
41
|
+
var FocusLock__default = /*#__PURE__*/_interopDefaultLegacy(FocusLock);
|
|
42
|
+
|
|
43
|
+
var ModalContext = React__namespace.createContext({
|
|
44
|
+
onDismiss: undefined,
|
|
45
|
+
height: 'fitContent',
|
|
46
|
+
dividers: undefined
|
|
47
|
+
});
|
|
48
|
+
function isNotInternalFrame(element) {
|
|
49
|
+
return !(element.ownerDocument === document && element.tagName.toLowerCase() === 'iframe');
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Renders a modal that sits on top of the rest of the content in the entire page.
|
|
53
|
+
*
|
|
54
|
+
* Follows the WAI-ARIA Dialog (Modal) Pattern.
|
|
55
|
+
*
|
|
56
|
+
* @see ModalHeader
|
|
57
|
+
* @see ModalFooter
|
|
58
|
+
* @see ModalBody
|
|
59
|
+
*/
|
|
60
|
+
function Modal(_a) {
|
|
61
|
+
var isOpen = _a.isOpen, onDismiss = _a.onDismiss, _b = _a.height, height = _b === void 0 ? 'fitContent' : _b, dividers = _a.dividers, _c = _a.width, width = _c === void 0 ? 'medium' : _c, exceptionallySetClassName = _a.exceptionallySetClassName, exceptionallySetOverlayClassName = _a.exceptionallySetOverlayClassName, _d = _a.autoFocus, autoFocus = _d === void 0 ? true : _d, _e = _a.hideOnEscape, hideOnEscape = _e === void 0 ? true : _e, _f = _a.hideOnInteractOutside, hideOnInteractOutside = _f === void 0 ? true : _f, children = _a.children, portalElement = _a.portalElement, onKeyDown = _a.onKeyDown;
|
|
62
|
+
// @ts-expect-error we want to make sure to not pass it to the Dialog component
|
|
63
|
+
_a.className; var props = tslib.__rest(_a, ["isOpen", "onDismiss", "height", "dividers", "width", "exceptionallySetClassName", "exceptionallySetOverlayClassName", "autoFocus", "hideOnEscape", "hideOnInteractOutside", "children", "portalElement", "onKeyDown", "className"]);
|
|
64
|
+
var setOpen = React__namespace.useCallback(function (visible) {
|
|
65
|
+
if (!visible) {
|
|
66
|
+
onDismiss === null || onDismiss === void 0 ? void 0 : onDismiss();
|
|
67
|
+
}
|
|
68
|
+
}, [onDismiss]);
|
|
69
|
+
var store = react.useDialogStore({ open: isOpen, setOpen: setOpen });
|
|
70
|
+
var contextValue = React__namespace.useMemo(function () { return ({ onDismiss: onDismiss, height: height, dividers: dividers }); }, [
|
|
71
|
+
onDismiss,
|
|
72
|
+
height,
|
|
73
|
+
dividers,
|
|
74
|
+
]);
|
|
75
|
+
var portalRef = React__namespace.useRef(null);
|
|
76
|
+
var dialogRef = React__namespace.useRef(null);
|
|
77
|
+
var backdropRef = React__namespace.useRef(null);
|
|
78
|
+
var handleBackdropClick = React__namespace.useCallback(function (event) {
|
|
79
|
+
var _a, _b;
|
|
80
|
+
if (
|
|
81
|
+
// The focus lock element takes up the same space as the backdrop and is where the event bubbles up from,
|
|
82
|
+
// so instead of checking the backdrop as the event target, we need to make sure it's just above the dialog
|
|
83
|
+
!((_a = dialogRef.current) === null || _a === void 0 ? void 0 : _a.contains(event.target)) &&
|
|
84
|
+
(
|
|
85
|
+
// Events fired from other portals will bubble up to the backdrop, even if it isn't a child in the DOM
|
|
86
|
+
(_b = backdropRef.current) === null || _b === void 0 ? void 0 : _b.contains(event.target))) {
|
|
87
|
+
event.stopPropagation();
|
|
88
|
+
onDismiss === null || onDismiss === void 0 ? void 0 : onDismiss();
|
|
89
|
+
}
|
|
90
|
+
}, [onDismiss]);
|
|
91
|
+
React__namespace.useLayoutEffect(function disableAccessibilityTreeOutside() {
|
|
92
|
+
if (!isOpen || !portalRef.current) {
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
return ariaHidden.hideOthers(portalRef.current);
|
|
96
|
+
}, [isOpen]);
|
|
97
|
+
var handleKeyDown = React__namespace.useCallback(function handleKeyDown(event) {
|
|
98
|
+
if (hideOnEscape &&
|
|
99
|
+
onDismiss != null &&
|
|
100
|
+
event.key === 'Escape' &&
|
|
101
|
+
!event.defaultPrevented) {
|
|
102
|
+
event.stopPropagation();
|
|
103
|
+
onDismiss();
|
|
104
|
+
}
|
|
105
|
+
onKeyDown === null || onKeyDown === void 0 ? void 0 : onKeyDown(event);
|
|
106
|
+
}, [onDismiss, hideOnEscape, onKeyDown]);
|
|
107
|
+
if (!isOpen) {
|
|
108
|
+
return null;
|
|
109
|
+
}
|
|
110
|
+
return (React__namespace.createElement(react.Portal, { portalRef: portalRef, portalElement: portalElement },
|
|
111
|
+
React__namespace.createElement(box.Box, { "data-testid": "modal-overlay", "data-overlay": true, className: classNames__default["default"](modal_module["default"].overlay, modal_module["default"][height], modal_module["default"][width], exceptionallySetOverlayClassName),
|
|
112
|
+
/**
|
|
113
|
+
* We're using `onPointerDown` instead of `onClick` to prevent the modal from
|
|
114
|
+
* closing when the click starts inside the modal and ends on the backdrop.
|
|
115
|
+
*/
|
|
116
|
+
onPointerDown: hideOnInteractOutside ? handleBackdropClick : undefined, ref: backdropRef },
|
|
117
|
+
React__namespace.createElement(FocusLock__default["default"], { autoFocus: autoFocus, whiteList: isNotInternalFrame, returnFocus: true, crossFrame: false },
|
|
118
|
+
React__namespace.createElement(react.Dialog, tslib.__assign({}, props, { ref: dialogRef, render: React__namespace.createElement(box.Box, { borderRadius: "full", background: "default", display: "flex", flexDirection: "column", overflow: "hidden", height: height === 'expand' ? 'full' : undefined, flexGrow: height === 'expand' ? 1 : 0 }), className: classNames__default["default"](exceptionallySetClassName, modal_module["default"].container), store: store, preventBodyScroll: true,
|
|
119
|
+
// Disable focus lock as we set up our own using ReactFocusLock
|
|
120
|
+
modal: false, autoFocus: false, autoFocusOnShow: false, autoFocusOnHide: false,
|
|
121
|
+
// Disable portal and backdrop as we control their markup
|
|
122
|
+
portal: false, backdrop: false, hideOnInteractOutside: false, hideOnEscape: false, onKeyDown: handleKeyDown }),
|
|
123
|
+
React__namespace.createElement(ModalContext.Provider, { value: contextValue }, children))))));
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* The close button rendered by ModalHeader. Provided independently so that consumers can customize
|
|
127
|
+
* the button's label.
|
|
128
|
+
*
|
|
129
|
+
* @see ModalHeader
|
|
130
|
+
*/
|
|
131
|
+
function ModalCloseButton(props) {
|
|
132
|
+
var onDismiss = React__namespace.useContext(ModalContext).onDismiss;
|
|
133
|
+
var _a = React__namespace.useState(false), includeInTabOrder = _a[0], setIncludeInTabOrder = _a[1];
|
|
134
|
+
var _b = React__namespace.useState(false), isMounted = _b[0], setIsMounted = _b[1];
|
|
135
|
+
React__namespace.useEffect(function skipAutoFocus() {
|
|
136
|
+
if (isMounted) {
|
|
137
|
+
setIncludeInTabOrder(true);
|
|
138
|
+
}
|
|
139
|
+
else {
|
|
140
|
+
setIsMounted(true);
|
|
141
|
+
}
|
|
142
|
+
}, [isMounted]);
|
|
143
|
+
return (React__namespace.createElement(button.IconButton, tslib.__assign({}, props, { variant: "quaternary", onClick: onDismiss, icon: React__namespace.createElement(closeIcon.CloseIcon, null), tabIndex: includeInTabOrder ? 0 : -1 })));
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Renders a standard modal header area with an optional close button.
|
|
147
|
+
*
|
|
148
|
+
* @see Modal
|
|
149
|
+
* @see ModalFooter
|
|
150
|
+
* @see ModalBody
|
|
151
|
+
*/
|
|
152
|
+
function ModalHeader(_a) {
|
|
153
|
+
var children = _a.children, _b = _a.button, button = _b === void 0 ? true : _b, _c = _a.withDivider, withDivider = _c === void 0 ? false : _c, exceptionallySetClassName = _a.exceptionallySetClassName, props = tslib.__rest(_a, ["children", "button", "withDivider", "exceptionallySetClassName"]);
|
|
154
|
+
var dividers = React__namespace.useContext(ModalContext).dividers;
|
|
155
|
+
return (React__namespace.createElement(React__namespace.Fragment, null,
|
|
156
|
+
React__namespace.createElement(box.Box, tslib.__assign({}, props, { as: "header", paddingLeft: "large", paddingRight: button === false || button === null ? 'large' : 'small', paddingY: "small", className: exceptionallySetClassName }),
|
|
157
|
+
React__namespace.createElement(columns.Columns, { space: "large", alignY: "center" },
|
|
158
|
+
React__namespace.createElement(columns.Column, { width: "auto" }, children),
|
|
159
|
+
button === false || button === null ? (React__namespace.createElement("div", { className: modal_module["default"].headerContent })) : (React__namespace.createElement(columns.Column, { width: "content", exceptionallySetClassName: modal_module["default"].buttonContainer, "data-testid": "button-container" }, typeof button === 'boolean' ? (React__namespace.createElement(ModalCloseButton, { "aria-label": "Close modal", autoFocus: false })) : (button))))),
|
|
160
|
+
withDivider ? React__namespace.createElement(divider.Divider, { weight: dividers }) : null));
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Renders the body of a modal.
|
|
164
|
+
*
|
|
165
|
+
* Convenient to use alongside ModalHeader and/or ModalFooter as needed. It ensures, among other
|
|
166
|
+
* things, that the content of the modal body expands or contracts depending on the modal height
|
|
167
|
+
* setting or the size of the content. The body content also automatically scrolls when it's too
|
|
168
|
+
* large to fit the available space.
|
|
169
|
+
*
|
|
170
|
+
* @see Modal
|
|
171
|
+
* @see ModalHeader
|
|
172
|
+
* @see ModalFooter
|
|
173
|
+
*/
|
|
174
|
+
var ModalBody = React.forwardRef(function ModalBody(_a, ref) {
|
|
175
|
+
var exceptionallySetClassName = _a.exceptionallySetClassName, children = _a.children, props = tslib.__rest(_a, ["exceptionallySetClassName", "children"]);
|
|
176
|
+
var height = React__namespace.useContext(ModalContext).height;
|
|
177
|
+
return (React__namespace.createElement(box.Box, tslib.__assign({}, props, { ref: ref, className: exceptionallySetClassName, flexGrow: height === 'expand' ? 1 : 0, height: height === 'expand' ? 'full' : undefined, overflow: "auto" }),
|
|
178
|
+
React__namespace.createElement(box.Box, { padding: "large", paddingBottom: "xxlarge" }, children)));
|
|
179
|
+
});
|
|
180
|
+
/**
|
|
181
|
+
* Renders a standard modal footer area.
|
|
182
|
+
*
|
|
183
|
+
* @see Modal
|
|
184
|
+
* @see ModalHeader
|
|
185
|
+
* @see ModalBody
|
|
186
|
+
*/
|
|
187
|
+
function ModalFooter(_a) {
|
|
188
|
+
var exceptionallySetClassName = _a.exceptionallySetClassName, _b = _a.withDivider, withDivider = _b === void 0 ? false : _b, props = tslib.__rest(_a, ["exceptionallySetClassName", "withDivider"]);
|
|
189
|
+
var dividers = React__namespace.useContext(ModalContext).dividers;
|
|
190
|
+
return (React__namespace.createElement(React__namespace.Fragment, null,
|
|
191
|
+
withDivider ? React__namespace.createElement(divider.Divider, { weight: dividers }) : null,
|
|
192
|
+
React__namespace.createElement(box.Box, tslib.__assign({ as: "footer" }, props, { className: exceptionallySetClassName, padding: "large" }))));
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* A specific version of the ModalFooter, tailored to showing an inline list of actions (buttons).
|
|
196
|
+
* @see ModalFooter
|
|
197
|
+
*/
|
|
198
|
+
function ModalActions(_a) {
|
|
199
|
+
var children = _a.children, props = tslib.__rest(_a, ["children"]);
|
|
200
|
+
return (React__namespace.createElement(ModalFooter, tslib.__assign({}, props),
|
|
201
|
+
React__namespace.createElement(inline.Inline, { align: "right", space: "large" }, children)));
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
exports.Modal = Modal;
|
|
205
|
+
exports.ModalActions = ModalActions;
|
|
206
|
+
exports.ModalBody = ModalBody;
|
|
207
|
+
exports.ModalCloseButton = ModalCloseButton;
|
|
208
|
+
exports.ModalFooter = ModalFooter;
|
|
209
|
+
exports.ModalHeader = ModalHeader;
|
|
2
210
|
//# sourceMappingURL=modal.js.map
|