@doist/reactist 28.7.2 → 28.7.3
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/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 +14 -18
- 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
|
@@ -1,132 +1,132 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { StaticToastProps } from './static-toast';
|
|
3
|
-
import type { Space } from '../utils/common-types';
|
|
4
|
-
/**
|
|
5
|
-
* The props needed to fire up a new notification toast.
|
|
6
|
-
*/
|
|
7
|
-
type ToastProps = StaticToastProps & {
|
|
8
|
-
/**
|
|
9
|
-
* The number of seconds the toast is expected to be shown before it is dismissed automatically,
|
|
10
|
-
* or false to disable auto-dismiss.
|
|
11
|
-
*
|
|
12
|
-
* It defaults to whatever is the autoDismissDelay set in the ToastsProvider.
|
|
13
|
-
*/
|
|
14
|
-
autoDismissDelay?: number | false;
|
|
15
|
-
/**
|
|
16
|
-
* The label for the button that dismisses the toast.
|
|
17
|
-
*
|
|
18
|
-
* It defaults to the value set in the ToastsProvider, but individual toasts can have a
|
|
19
|
-
* different value if needed.
|
|
20
|
-
*/
|
|
21
|
-
dismissLabel?: string;
|
|
22
|
-
/**
|
|
23
|
-
* Whether to show the dismiss button or not.
|
|
24
|
-
*
|
|
25
|
-
* Use this value with care. If combined with disabling `autoDismissDelay`, it may leave you
|
|
26
|
-
* with toasts that the user won't be able to dismiss at will. It then is your responsibility to
|
|
27
|
-
* dismiss the toast by calling the function returned by `showToast`.
|
|
28
|
-
*/
|
|
29
|
-
showDismissButton?: boolean;
|
|
30
|
-
};
|
|
31
|
-
type ShowToastAction = (props: ToastProps) => () => void;
|
|
32
|
-
/**
|
|
33
|
-
* The props needed by the ToastsProvider component.
|
|
34
|
-
*
|
|
35
|
-
* @see ToastsProvider
|
|
36
|
-
*/
|
|
37
|
-
type ToastsProviderProps = {
|
|
38
|
-
/**
|
|
39
|
-
* The default label to apply to toast dismiss buttons.
|
|
40
|
-
*
|
|
41
|
-
* This is useful in environments that need locatization, so you do not need to pass the same
|
|
42
|
-
* translated label every time you trigger a toast.
|
|
43
|
-
*
|
|
44
|
-
* However, you can still apply a different label to a specific toast, by passing a different
|
|
45
|
-
* value when calling showToast.
|
|
46
|
-
*
|
|
47
|
-
* @default 'Close'
|
|
48
|
-
*/
|
|
49
|
-
defaultDismissLabel?: string;
|
|
50
|
-
/**
|
|
51
|
-
* The default number of seconds after which the toast will be dismissed automatically.
|
|
52
|
-
*
|
|
53
|
-
* You can pass a different value to a specific toast when calling `showToast`. You can even
|
|
54
|
-
* pass `false` if you want a certain toast to never be dismissed automatically.
|
|
55
|
-
*
|
|
56
|
-
* @default 10 (seconds)
|
|
57
|
-
*/
|
|
58
|
-
defaultAutoDismissDelay?: number;
|
|
59
|
-
/**
|
|
60
|
-
* The padding used to separate the toasts from the viewport borders.
|
|
61
|
-
*
|
|
62
|
-
* @default 'large'
|
|
63
|
-
*/
|
|
64
|
-
padding?: Space;
|
|
65
|
-
/**
|
|
66
|
-
* The app wrapped by the provider.
|
|
67
|
-
*/
|
|
68
|
-
children: NonNullable<React.ReactNode>;
|
|
69
|
-
/**
|
|
70
|
-
* Custom classname for the toasts container, if you need to fine-tune the position or other styles
|
|
71
|
-
*/
|
|
72
|
-
containerClassName?: string;
|
|
73
|
-
};
|
|
74
|
-
/**
|
|
75
|
-
* Provides the state management and rendering of the toasts currently active.
|
|
76
|
-
*
|
|
77
|
-
* You need to render this near the top of your app components tree, in order to `useToasts`.
|
|
78
|
-
*
|
|
79
|
-
* @see useToasts
|
|
80
|
-
*/
|
|
81
|
-
declare function ToastsProvider({ children, padding, defaultAutoDismissDelay, defaultDismissLabel, containerClassName, }: ToastsProviderProps): React.JSX.Element;
|
|
82
|
-
/**
|
|
83
|
-
* Provides a function `showToast` that shows a new toast every time you call it.
|
|
84
|
-
*
|
|
85
|
-
* ```jsx
|
|
86
|
-
* const showToast = useToasts()
|
|
87
|
-
*
|
|
88
|
-
* <button onClick={() => showToast({ message: 'Hello' })}>
|
|
89
|
-
* Say hello
|
|
90
|
-
* </button>
|
|
91
|
-
* ```
|
|
92
|
-
*
|
|
93
|
-
* All toasts fired via this function are rendered in a global fixed location, and stacked one on
|
|
94
|
-
* top of the other.
|
|
95
|
-
*
|
|
96
|
-
* When called, `showToast` returns a function that dismisses the toast when called.
|
|
97
|
-
*
|
|
98
|
-
* @see ToastsProvider
|
|
99
|
-
*/
|
|
100
|
-
declare function useToasts(): ShowToastAction;
|
|
101
|
-
/**
|
|
102
|
-
* Adds a toast to be rendered, stacked alongside any other currently active toasts.
|
|
103
|
-
*
|
|
104
|
-
* For most situations, you should prefer to use the `showToast` function obtained from `useToasts`.
|
|
105
|
-
* This component is provided for convenience to render toasts in the markup, but it has some
|
|
106
|
-
* peculiarities, which are discussed below.
|
|
107
|
-
*
|
|
108
|
-
* Internally, this calls `showToast`. It is provided for two reasons:
|
|
109
|
-
*
|
|
110
|
-
* 1. Convenience, when you want to fire a toast in markup/jsx code. Keep in mind, though, that
|
|
111
|
-
* toasts rendered in this way will be removed from view when the context where it is rendered
|
|
112
|
-
* is unmounted. Unlike toasts fired with `showToast`, which will normally be dismissed, either
|
|
113
|
-
* by the user or after a delay. They'll still be animated on their way out, though.
|
|
114
|
-
* 2. When combined with disabling dismissing it (e.g. `showDismissButton={false}` and
|
|
115
|
-
* `autoDismissDelay={false}` it provides a way to show "permanent" toasts that only go away when
|
|
116
|
-
* the component ceases to be rendered).
|
|
117
|
-
*
|
|
118
|
-
* This is useful for cases when the consumer wants to control when a toast is visible, and to keep
|
|
119
|
-
* it visible based on an app-specific condition.
|
|
120
|
-
*
|
|
121
|
-
* Something important to note about this component is that it triggers the toast based on the props
|
|
122
|
-
* passed when first rendered, and it does not update the toast if these props change on subsequent
|
|
123
|
-
* renders. In this sense, this is an imperative component, more than a descriptive one. This is
|
|
124
|
-
* done to simplify the internals, and to keep it in line with how `showToast` works: you fire up a
|
|
125
|
-
* toast imperatively, and you loose control over it. It remains rendered according to the props you
|
|
126
|
-
* first passed.
|
|
127
|
-
*
|
|
128
|
-
* @see useToasts
|
|
129
|
-
*/
|
|
130
|
-
declare function Toast(props: ToastProps): null;
|
|
131
|
-
export { Toast, ToastsProvider, useToasts };
|
|
132
|
-
export type { ToastProps, ToastsProviderProps };
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { StaticToastProps } from './static-toast';
|
|
3
|
+
import type { Space } from '../utils/common-types';
|
|
4
|
+
/**
|
|
5
|
+
* The props needed to fire up a new notification toast.
|
|
6
|
+
*/
|
|
7
|
+
type ToastProps = StaticToastProps & {
|
|
8
|
+
/**
|
|
9
|
+
* The number of seconds the toast is expected to be shown before it is dismissed automatically,
|
|
10
|
+
* or false to disable auto-dismiss.
|
|
11
|
+
*
|
|
12
|
+
* It defaults to whatever is the autoDismissDelay set in the ToastsProvider.
|
|
13
|
+
*/
|
|
14
|
+
autoDismissDelay?: number | false;
|
|
15
|
+
/**
|
|
16
|
+
* The label for the button that dismisses the toast.
|
|
17
|
+
*
|
|
18
|
+
* It defaults to the value set in the ToastsProvider, but individual toasts can have a
|
|
19
|
+
* different value if needed.
|
|
20
|
+
*/
|
|
21
|
+
dismissLabel?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Whether to show the dismiss button or not.
|
|
24
|
+
*
|
|
25
|
+
* Use this value with care. If combined with disabling `autoDismissDelay`, it may leave you
|
|
26
|
+
* with toasts that the user won't be able to dismiss at will. It then is your responsibility to
|
|
27
|
+
* dismiss the toast by calling the function returned by `showToast`.
|
|
28
|
+
*/
|
|
29
|
+
showDismissButton?: boolean;
|
|
30
|
+
};
|
|
31
|
+
type ShowToastAction = (props: ToastProps) => () => void;
|
|
32
|
+
/**
|
|
33
|
+
* The props needed by the ToastsProvider component.
|
|
34
|
+
*
|
|
35
|
+
* @see ToastsProvider
|
|
36
|
+
*/
|
|
37
|
+
type ToastsProviderProps = {
|
|
38
|
+
/**
|
|
39
|
+
* The default label to apply to toast dismiss buttons.
|
|
40
|
+
*
|
|
41
|
+
* This is useful in environments that need locatization, so you do not need to pass the same
|
|
42
|
+
* translated label every time you trigger a toast.
|
|
43
|
+
*
|
|
44
|
+
* However, you can still apply a different label to a specific toast, by passing a different
|
|
45
|
+
* value when calling showToast.
|
|
46
|
+
*
|
|
47
|
+
* @default 'Close'
|
|
48
|
+
*/
|
|
49
|
+
defaultDismissLabel?: string;
|
|
50
|
+
/**
|
|
51
|
+
* The default number of seconds after which the toast will be dismissed automatically.
|
|
52
|
+
*
|
|
53
|
+
* You can pass a different value to a specific toast when calling `showToast`. You can even
|
|
54
|
+
* pass `false` if you want a certain toast to never be dismissed automatically.
|
|
55
|
+
*
|
|
56
|
+
* @default 10 (seconds)
|
|
57
|
+
*/
|
|
58
|
+
defaultAutoDismissDelay?: number;
|
|
59
|
+
/**
|
|
60
|
+
* The padding used to separate the toasts from the viewport borders.
|
|
61
|
+
*
|
|
62
|
+
* @default 'large'
|
|
63
|
+
*/
|
|
64
|
+
padding?: Space;
|
|
65
|
+
/**
|
|
66
|
+
* The app wrapped by the provider.
|
|
67
|
+
*/
|
|
68
|
+
children: NonNullable<React.ReactNode>;
|
|
69
|
+
/**
|
|
70
|
+
* Custom classname for the toasts container, if you need to fine-tune the position or other styles
|
|
71
|
+
*/
|
|
72
|
+
containerClassName?: string;
|
|
73
|
+
};
|
|
74
|
+
/**
|
|
75
|
+
* Provides the state management and rendering of the toasts currently active.
|
|
76
|
+
*
|
|
77
|
+
* You need to render this near the top of your app components tree, in order to `useToasts`.
|
|
78
|
+
*
|
|
79
|
+
* @see useToasts
|
|
80
|
+
*/
|
|
81
|
+
declare function ToastsProvider({ children, padding, defaultAutoDismissDelay, defaultDismissLabel, containerClassName, }: ToastsProviderProps): React.JSX.Element;
|
|
82
|
+
/**
|
|
83
|
+
* Provides a function `showToast` that shows a new toast every time you call it.
|
|
84
|
+
*
|
|
85
|
+
* ```jsx
|
|
86
|
+
* const showToast = useToasts()
|
|
87
|
+
*
|
|
88
|
+
* <button onClick={() => showToast({ message: 'Hello' })}>
|
|
89
|
+
* Say hello
|
|
90
|
+
* </button>
|
|
91
|
+
* ```
|
|
92
|
+
*
|
|
93
|
+
* All toasts fired via this function are rendered in a global fixed location, and stacked one on
|
|
94
|
+
* top of the other.
|
|
95
|
+
*
|
|
96
|
+
* When called, `showToast` returns a function that dismisses the toast when called.
|
|
97
|
+
*
|
|
98
|
+
* @see ToastsProvider
|
|
99
|
+
*/
|
|
100
|
+
declare function useToasts(): ShowToastAction;
|
|
101
|
+
/**
|
|
102
|
+
* Adds a toast to be rendered, stacked alongside any other currently active toasts.
|
|
103
|
+
*
|
|
104
|
+
* For most situations, you should prefer to use the `showToast` function obtained from `useToasts`.
|
|
105
|
+
* This component is provided for convenience to render toasts in the markup, but it has some
|
|
106
|
+
* peculiarities, which are discussed below.
|
|
107
|
+
*
|
|
108
|
+
* Internally, this calls `showToast`. It is provided for two reasons:
|
|
109
|
+
*
|
|
110
|
+
* 1. Convenience, when you want to fire a toast in markup/jsx code. Keep in mind, though, that
|
|
111
|
+
* toasts rendered in this way will be removed from view when the context where it is rendered
|
|
112
|
+
* is unmounted. Unlike toasts fired with `showToast`, which will normally be dismissed, either
|
|
113
|
+
* by the user or after a delay. They'll still be animated on their way out, though.
|
|
114
|
+
* 2. When combined with disabling dismissing it (e.g. `showDismissButton={false}` and
|
|
115
|
+
* `autoDismissDelay={false}` it provides a way to show "permanent" toasts that only go away when
|
|
116
|
+
* the component ceases to be rendered).
|
|
117
|
+
*
|
|
118
|
+
* This is useful for cases when the consumer wants to control when a toast is visible, and to keep
|
|
119
|
+
* it visible based on an app-specific condition.
|
|
120
|
+
*
|
|
121
|
+
* Something important to note about this component is that it triggers the toast based on the props
|
|
122
|
+
* passed when first rendered, and it does not update the toast if these props change on subsequent
|
|
123
|
+
* renders. In this sense, this is an imperative component, more than a descriptive one. This is
|
|
124
|
+
* done to simplify the internals, and to keep it in line with how `showToast` works: you fire up a
|
|
125
|
+
* toast imperatively, and you loose control over it. It remains rendered according to the props you
|
|
126
|
+
* first passed.
|
|
127
|
+
*
|
|
128
|
+
* @see useToasts
|
|
129
|
+
*/
|
|
130
|
+
declare function Toast(props: ToastProps): null;
|
|
131
|
+
export { Toast, ToastsProvider, useToasts };
|
|
132
|
+
export type { ToastProps, ToastsProviderProps };
|
package/lib/toast/use-toasts.js
CHANGED
|
@@ -1,2 +1,167 @@
|
|
|
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 react = require('@ariakit/react');
|
|
8
|
+
var commonHelpers = require('../utils/common-helpers.js');
|
|
9
|
+
var box = require('../box/box.js');
|
|
10
|
+
var stack = require('../stack/stack.js');
|
|
11
|
+
var staticToast = require('./static-toast.js');
|
|
12
|
+
var toast_module = require('./toast.module.css.js');
|
|
13
|
+
var toastAnimation = require('./toast-animation.js');
|
|
14
|
+
|
|
15
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
16
|
+
|
|
17
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
18
|
+
|
|
19
|
+
/** @private */
|
|
20
|
+
var InternalToast = React__default["default"].forwardRef(function InternalToast(_a, ref) {
|
|
21
|
+
var message = _a.message, description = _a.description, icon = _a.icon, action = _a.action, autoDismissDelay = _a.autoDismissDelay, dismissLabel = _a.dismissLabel, _b = _a.showDismissButton, showDismissButton = _b === void 0 ? true : _b, toastId = _a.toastId, onDismiss = _a.onDismiss, onRemoveToast = _a.onRemoveToast;
|
|
22
|
+
var timeoutRef = React__default["default"].useRef();
|
|
23
|
+
var removeToast = React__default["default"].useCallback(function removeToast() {
|
|
24
|
+
onRemoveToast(toastId);
|
|
25
|
+
onDismiss === null || onDismiss === void 0 ? void 0 : onDismiss();
|
|
26
|
+
}, [onDismiss, onRemoveToast, toastId]);
|
|
27
|
+
var startTimeout = React__default["default"].useCallback(function startTimeout() {
|
|
28
|
+
if (!autoDismissDelay)
|
|
29
|
+
return;
|
|
30
|
+
timeoutRef.current = window.setTimeout(removeToast, autoDismissDelay * 1000);
|
|
31
|
+
}, [autoDismissDelay, removeToast]);
|
|
32
|
+
var stopTimeout = React__default["default"].useCallback(function stopTimeout() {
|
|
33
|
+
clearTimeout(timeoutRef.current);
|
|
34
|
+
timeoutRef.current = undefined;
|
|
35
|
+
}, []);
|
|
36
|
+
React__default["default"].useEffect(function setupAutoDismiss() {
|
|
37
|
+
stopTimeout();
|
|
38
|
+
startTimeout();
|
|
39
|
+
return stopTimeout;
|
|
40
|
+
}, [startTimeout, stopTimeout]);
|
|
41
|
+
/**
|
|
42
|
+
* If the action is toast action object and not a custom element,
|
|
43
|
+
* the `onClick` property is wrapped in another handler responsible
|
|
44
|
+
* for removing the toast when the action is triggered.
|
|
45
|
+
*/
|
|
46
|
+
var actionWithCustomActionHandler = React__default["default"].useMemo(function () {
|
|
47
|
+
var _a;
|
|
48
|
+
if (!staticToast.isActionObject(action)) {
|
|
49
|
+
return action;
|
|
50
|
+
}
|
|
51
|
+
return tslib.__assign(tslib.__assign({}, action), { closeToast: (_a = action.closeToast) !== null && _a !== void 0 ? _a : true, onClick: function handleActionClick() {
|
|
52
|
+
var _a;
|
|
53
|
+
if (!action) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
action.onClick();
|
|
57
|
+
if ((_a = action.closeToast) !== null && _a !== void 0 ? _a : true) {
|
|
58
|
+
removeToast();
|
|
59
|
+
}
|
|
60
|
+
} });
|
|
61
|
+
}, [action, removeToast]);
|
|
62
|
+
return (React__default["default"].createElement(staticToast.StaticToast, { ref: ref, message: message, description: description, icon: icon, action: actionWithCustomActionHandler, onDismiss: showDismissButton ? removeToast : undefined, dismissLabel: dismissLabel,
|
|
63
|
+
// @ts-expect-error
|
|
64
|
+
onMouseEnter: stopTimeout, onMouseLeave: startTimeout }));
|
|
65
|
+
});
|
|
66
|
+
var ToastsContext = React__default["default"].createContext(function () { return function () { return undefined; }; });
|
|
67
|
+
/**
|
|
68
|
+
* Provides the state management and rendering of the toasts currently active.
|
|
69
|
+
*
|
|
70
|
+
* You need to render this near the top of your app components tree, in order to `useToasts`.
|
|
71
|
+
*
|
|
72
|
+
* @see useToasts
|
|
73
|
+
*/
|
|
74
|
+
function ToastsProvider(_a) {
|
|
75
|
+
var children = _a.children, _b = _a.padding, padding = _b === void 0 ? 'large' : _b, _c = _a.defaultAutoDismissDelay /* seconds */, defaultAutoDismissDelay = _c === void 0 ? 10 : _c /* seconds */, _d = _a.defaultDismissLabel, defaultDismissLabel = _d === void 0 ? 'Close' : _d, containerClassName = _a.containerClassName;
|
|
76
|
+
var _e = React__default["default"].useState([]), toasts = _e[0], setToasts = _e[1];
|
|
77
|
+
var _f = toastAnimation.useToastsAnimation(), mappedRef = _f.mappedRef, animateRemove = _f.animateRemove;
|
|
78
|
+
var removeToast = React__default["default"].useCallback(function onRemoveToast(toastId) {
|
|
79
|
+
animateRemove(toastId, function () {
|
|
80
|
+
setToasts(function (list) {
|
|
81
|
+
var index = list.findIndex(function (n) { return n.toastId === toastId; });
|
|
82
|
+
if (index < 0)
|
|
83
|
+
return list;
|
|
84
|
+
var copy = tslib.__spreadArray([], list, true);
|
|
85
|
+
copy.splice(index, 1);
|
|
86
|
+
return copy;
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
}, [animateRemove]);
|
|
90
|
+
var showToast = React__default["default"].useCallback(function showToast(props) {
|
|
91
|
+
var toastId = commonHelpers.generateElementId('toast');
|
|
92
|
+
var newToast = tslib.__assign(tslib.__assign({ autoDismissDelay: defaultAutoDismissDelay, dismissLabel: defaultDismissLabel }, props), { toastId: toastId });
|
|
93
|
+
setToasts(function (list) { return tslib.__spreadArray(tslib.__spreadArray([], list, true), [newToast], false); });
|
|
94
|
+
return function () { return removeToast(toastId); };
|
|
95
|
+
}, [defaultAutoDismissDelay, defaultDismissLabel, removeToast]);
|
|
96
|
+
return (React__default["default"].createElement(ToastsContext.Provider, { value: showToast },
|
|
97
|
+
children,
|
|
98
|
+
React__default["default"].createElement(react.Portal, null, toasts.length === 0 ? null : (React__default["default"].createElement(box.Box, { className: [toast_module["default"].stackedToastsView, containerClassName], position: "fixed", width: "full", paddingX: padding, paddingBottom: padding, "data-testid": "toasts-container" },
|
|
99
|
+
React__default["default"].createElement(stack.Stack, { space: "medium" }, toasts.map(function (_a) {
|
|
100
|
+
var toastId = _a.toastId, props = tslib.__rest(_a, ["toastId"]);
|
|
101
|
+
return (React__default["default"].createElement(InternalToast, tslib.__assign({ key: toastId, ref: mappedRef(toastId), toastId: toastId, onRemoveToast: removeToast }, props)));
|
|
102
|
+
})))))));
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Provides a function `showToast` that shows a new toast every time you call it.
|
|
106
|
+
*
|
|
107
|
+
* ```jsx
|
|
108
|
+
* const showToast = useToasts()
|
|
109
|
+
*
|
|
110
|
+
* <button onClick={() => showToast({ message: 'Hello' })}>
|
|
111
|
+
* Say hello
|
|
112
|
+
* </button>
|
|
113
|
+
* ```
|
|
114
|
+
*
|
|
115
|
+
* All toasts fired via this function are rendered in a global fixed location, and stacked one on
|
|
116
|
+
* top of the other.
|
|
117
|
+
*
|
|
118
|
+
* When called, `showToast` returns a function that dismisses the toast when called.
|
|
119
|
+
*
|
|
120
|
+
* @see ToastsProvider
|
|
121
|
+
*/
|
|
122
|
+
function useToasts() {
|
|
123
|
+
return React__default["default"].useContext(ToastsContext);
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Adds a toast to be rendered, stacked alongside any other currently active toasts.
|
|
127
|
+
*
|
|
128
|
+
* For most situations, you should prefer to use the `showToast` function obtained from `useToasts`.
|
|
129
|
+
* This component is provided for convenience to render toasts in the markup, but it has some
|
|
130
|
+
* peculiarities, which are discussed below.
|
|
131
|
+
*
|
|
132
|
+
* Internally, this calls `showToast`. It is provided for two reasons:
|
|
133
|
+
*
|
|
134
|
+
* 1. Convenience, when you want to fire a toast in markup/jsx code. Keep in mind, though, that
|
|
135
|
+
* toasts rendered in this way will be removed from view when the context where it is rendered
|
|
136
|
+
* is unmounted. Unlike toasts fired with `showToast`, which will normally be dismissed, either
|
|
137
|
+
* by the user or after a delay. They'll still be animated on their way out, though.
|
|
138
|
+
* 2. When combined with disabling dismissing it (e.g. `showDismissButton={false}` and
|
|
139
|
+
* `autoDismissDelay={false}` it provides a way to show "permanent" toasts that only go away when
|
|
140
|
+
* the component ceases to be rendered).
|
|
141
|
+
*
|
|
142
|
+
* This is useful for cases when the consumer wants to control when a toast is visible, and to keep
|
|
143
|
+
* it visible based on an app-specific condition.
|
|
144
|
+
*
|
|
145
|
+
* Something important to note about this component is that it triggers the toast based on the props
|
|
146
|
+
* passed when first rendered, and it does not update the toast if these props change on subsequent
|
|
147
|
+
* renders. In this sense, this is an imperative component, more than a descriptive one. This is
|
|
148
|
+
* done to simplify the internals, and to keep it in line with how `showToast` works: you fire up a
|
|
149
|
+
* toast imperatively, and you loose control over it. It remains rendered according to the props you
|
|
150
|
+
* first passed.
|
|
151
|
+
*
|
|
152
|
+
* @see useToasts
|
|
153
|
+
*/
|
|
154
|
+
function Toast(props) {
|
|
155
|
+
var showToast = useToasts();
|
|
156
|
+
var propsRef = React__default["default"].useRef(props);
|
|
157
|
+
React__default["default"].useEffect(function () {
|
|
158
|
+
var dismissToast = showToast(propsRef.current);
|
|
159
|
+
return dismissToast;
|
|
160
|
+
}, [showToast]);
|
|
161
|
+
return null;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
exports.Toast = Toast;
|
|
165
|
+
exports.ToastsProvider = ToastsProvider;
|
|
166
|
+
exports.useToasts = useToasts;
|
|
2
167
|
//# sourceMappingURL=use-toasts.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-toasts.js","sources":["../../src/toast/use-toasts.tsx"],"sourcesContent":["import React from 'react'\nimport { Portal } from '@ariakit/react'\n\nimport { generateElementId } from '../utils/common-helpers'\nimport { Box } from '../box'\nimport { Stack } from '../stack'\nimport { isActionObject, StaticToast, StaticToastProps } from './static-toast'\n\nimport styles from './toast.module.css'\n\nimport type { Space } from '../utils/common-types'\nimport { useToastsAnimation } from './toast-animation'\n\n/**\n * The props needed to fire up a new notification toast.\n */\ntype ToastProps = StaticToastProps & {\n /**\n * The number of seconds the toast is expected to be shown before it is dismissed automatically,\n * or false to disable auto-dismiss.\n *\n * It defaults to whatever is the autoDismissDelay set in the ToastsProvider.\n */\n autoDismissDelay?: number | false\n\n /**\n * The label for the button that dismisses the toast.\n *\n * It defaults to the value set in the ToastsProvider, but individual toasts can have a\n * different value if needed.\n */\n dismissLabel?: string\n\n /**\n * Whether to show the dismiss button or not.\n *\n * Use this value with care. If combined with disabling `autoDismissDelay`, it may leave you\n * with toasts that the user won't be able to dismiss at will. It then is your responsibility to\n * dismiss the toast by calling the function returned by `showToast`.\n */\n showDismissButton?: boolean\n}\n\n//\n// InternalToast component and its props\n//\n\ntype InternalToastProps = Omit<ToastProps, 'autoDismissDelay' | 'dismissLabel'> &\n Required<Pick<ToastProps, 'autoDismissDelay' | 'dismissLabel'>> & {\n toastId: string\n onRemoveToast: (toastId: string) => void\n }\n\n/** @private */\nconst InternalToast = React.forwardRef<HTMLDivElement, InternalToastProps>(function InternalToast(\n {\n message,\n description,\n icon,\n action,\n autoDismissDelay,\n dismissLabel,\n showDismissButton = true,\n toastId,\n onDismiss,\n onRemoveToast,\n },\n ref,\n) {\n const timeoutRef = React.useRef<number | undefined>()\n\n const removeToast = React.useCallback(\n function removeToast() {\n onRemoveToast(toastId)\n onDismiss?.()\n },\n [onDismiss, onRemoveToast, toastId],\n )\n\n const startTimeout = React.useCallback(\n function startTimeout() {\n if (!autoDismissDelay) return\n timeoutRef.current = window.setTimeout(removeToast, autoDismissDelay * 1000)\n },\n [autoDismissDelay, removeToast],\n )\n\n const stopTimeout = React.useCallback(function stopTimeout() {\n clearTimeout(timeoutRef.current)\n timeoutRef.current = undefined\n }, [])\n\n React.useEffect(\n function setupAutoDismiss() {\n stopTimeout()\n startTimeout()\n\n return stopTimeout\n },\n [startTimeout, stopTimeout],\n )\n\n /**\n * If the action is toast action object and not a custom element,\n * the `onClick` property is wrapped in another handler responsible\n * for removing the toast when the action is triggered.\n */\n const actionWithCustomActionHandler = React.useMemo(() => {\n if (!isActionObject(action)) {\n return action\n }\n\n return {\n ...action,\n closeToast: action.closeToast ?? true,\n onClick: function handleActionClick() {\n if (!action) {\n return\n }\n\n action.onClick()\n\n if (action.closeToast ?? true) {\n removeToast()\n }\n },\n }\n }, [action, removeToast])\n\n return (\n <StaticToast\n ref={ref}\n message={message}\n description={description}\n icon={icon}\n action={actionWithCustomActionHandler}\n onDismiss={showDismissButton ? removeToast : undefined}\n dismissLabel={dismissLabel}\n // @ts-expect-error\n onMouseEnter={stopTimeout}\n onMouseLeave={startTimeout}\n />\n )\n})\n\n//\n// Internal state and context\n//\n\ntype InternalToastEntry = Omit<InternalToastProps, 'onRemoveToast'>\ntype ToastsList = readonly InternalToastEntry[]\n\ntype ShowToastAction = (props: ToastProps) => () => void\nconst ToastsContext = React.createContext<ShowToastAction>(() => () => undefined)\n\n/**\n * The props needed by the ToastsProvider component.\n *\n * @see ToastsProvider\n */\ntype ToastsProviderProps = {\n /**\n * The default label to apply to toast dismiss buttons.\n *\n * This is useful in environments that need locatization, so you do not need to pass the same\n * translated label every time you trigger a toast.\n *\n * However, you can still apply a different label to a specific toast, by passing a different\n * value when calling showToast.\n *\n * @default 'Close'\n */\n defaultDismissLabel?: string\n\n /**\n * The default number of seconds after which the toast will be dismissed automatically.\n *\n * You can pass a different value to a specific toast when calling `showToast`. You can even\n * pass `false` if you want a certain toast to never be dismissed automatically.\n *\n * @default 10 (seconds)\n */\n defaultAutoDismissDelay?: number\n\n /**\n * The padding used to separate the toasts from the viewport borders.\n *\n * @default 'large'\n */\n padding?: Space\n\n /**\n * The app wrapped by the provider.\n */\n children: NonNullable<React.ReactNode>\n\n /**\n * Custom classname for the toasts container, if you need to fine-tune the position or other styles\n */\n containerClassName?: string\n}\n\n/**\n * Provides the state management and rendering of the toasts currently active.\n *\n * You need to render this near the top of your app components tree, in order to `useToasts`.\n *\n * @see useToasts\n */\nfunction ToastsProvider({\n children,\n padding = 'large',\n defaultAutoDismissDelay = 10 /* seconds */,\n defaultDismissLabel = 'Close',\n containerClassName,\n}: ToastsProviderProps) {\n const [toasts, setToasts] = React.useState<ToastsList>([])\n const { mappedRef, animateRemove } = useToastsAnimation()\n\n const removeToast = React.useCallback(\n function onRemoveToast(toastId: string) {\n animateRemove(toastId, () => {\n setToasts((list) => {\n const index = list.findIndex((n) => n.toastId === toastId)\n if (index < 0) return list\n const copy = [...list]\n copy.splice(index, 1)\n return copy\n })\n })\n },\n [animateRemove],\n )\n\n const showToast = React.useCallback(\n function showToast(props: ToastProps) {\n const toastId = generateElementId('toast')\n const newToast: InternalToastEntry = {\n autoDismissDelay: defaultAutoDismissDelay,\n dismissLabel: defaultDismissLabel,\n ...props,\n toastId,\n }\n setToasts((list) => [...list, newToast])\n return () => removeToast(toastId)\n },\n [defaultAutoDismissDelay, defaultDismissLabel, removeToast],\n )\n\n return (\n <ToastsContext.Provider value={showToast}>\n {children}\n <Portal>\n {toasts.length === 0 ? null : (\n <Box\n className={[styles.stackedToastsView, containerClassName]}\n position=\"fixed\"\n width=\"full\"\n paddingX={padding}\n paddingBottom={padding}\n data-testid=\"toasts-container\"\n >\n <Stack space=\"medium\">\n {toasts.map(({ toastId, ...props }) => (\n <InternalToast\n key={toastId}\n ref={mappedRef(toastId)}\n toastId={toastId}\n onRemoveToast={removeToast}\n {...props}\n />\n ))}\n </Stack>\n </Box>\n )}\n </Portal>\n </ToastsContext.Provider>\n )\n}\n\n/**\n * Provides a function `showToast` that shows a new toast every time you call it.\n *\n * ```jsx\n * const showToast = useToasts()\n *\n * <button onClick={() => showToast({ message: 'Hello' })}>\n * Say hello\n * </button>\n * ```\n *\n * All toasts fired via this function are rendered in a global fixed location, and stacked one on\n * top of the other.\n *\n * When called, `showToast` returns a function that dismisses the toast when called.\n *\n * @see ToastsProvider\n */\nfunction useToasts() {\n return React.useContext(ToastsContext)\n}\n\n/**\n * Adds a toast to be rendered, stacked alongside any other currently active toasts.\n *\n * For most situations, you should prefer to use the `showToast` function obtained from `useToasts`.\n * This component is provided for convenience to render toasts in the markup, but it has some\n * peculiarities, which are discussed below.\n *\n * Internally, this calls `showToast`. It is provided for two reasons:\n *\n * 1. Convenience, when you want to fire a toast in markup/jsx code. Keep in mind, though, that\n * toasts rendered in this way will be removed from view when the context where it is rendered\n * is unmounted. Unlike toasts fired with `showToast`, which will normally be dismissed, either\n * by the user or after a delay. They'll still be animated on their way out, though.\n * 2. When combined with disabling dismissing it (e.g. `showDismissButton={false}` and\n * `autoDismissDelay={false}` it provides a way to show \"permanent\" toasts that only go away when\n * the component ceases to be rendered).\n *\n * This is useful for cases when the consumer wants to control when a toast is visible, and to keep\n * it visible based on an app-specific condition.\n *\n * Something important to note about this component is that it triggers the toast based on the props\n * passed when first rendered, and it does not update the toast if these props change on subsequent\n * renders. In this sense, this is an imperative component, more than a descriptive one. This is\n * done to simplify the internals, and to keep it in line with how `showToast` works: you fire up a\n * toast imperatively, and you loose control over it. It remains rendered according to the props you\n * first passed.\n *\n * @see useToasts\n */\nfunction Toast(props: ToastProps) {\n const showToast = useToasts()\n const propsRef = React.useRef<ToastProps>(props)\n React.useEffect(() => {\n const dismissToast = showToast(propsRef.current)\n return dismissToast\n }, [showToast])\n return null\n}\n\nexport { Toast, ToastsProvider, useToasts }\nexport type { ToastProps, ToastsProviderProps }\n"],"names":["InternalToast","React","forwardRef","message","description","icon","action","autoDismissDelay","dismissLabel","showDismissButton","toastId","onDismiss","onRemoveToast","ref","timeoutRef","useRef","removeToast","useCallback","startTimeout","current","window","setTimeout","stopTimeout","clearTimeout","undefined","useEffect","actionWithCustomActionHandler","useMemo","isActionObject","_objectSpread","objectSpread2","closeToast","onClick","createElement","StaticToast","onMouseEnter","onMouseLeave","ToastsContext","createContext","useToasts","useContext","props","showToast","propsRef","children","padding","defaultAutoDismissDelay","defaultDismissLabel","containerClassName","toasts","setToasts","useState","mappedRef","animateRemove","useToastsAnimation","list","index","findIndex","n","copy","splice","generateElementId","newToast","Provider","value","Portal","length","Box","className","styles","stackedToastsView","position","width","paddingX","paddingBottom","Stack","space","map","_ref","_objectWithoutProperties","objectWithoutProperties","_excluded","key"],"mappings":"0dAsDMA,EAAgBC,EAAK,QAACC,YAA+C,UACvEC,QACIA,EADJC,YAEIA,EAFJC,KAGIA,EAHJC,OAIIA,EAJJC,iBAKIA,EALJC,aAMIA,EANJC,kBAOIA,GAAoB,EAPxBC,QAQIA,EARJC,UASIA,EATJC,cAUIA,GAEJC,GAEA,MAAMC,EAAab,UAAMc,SAEnBC,EAAcf,EAAAA,QAAMgB,aACtB,WACIL,EAAcF,GACL,MAATC,GAAAA,MAEJ,CAACA,EA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ACnBwC,EAAWK,IACP,MAAMC,EAAQD,EAAKE,UAAWC,GAAMA,EAAEhD,UAAYA,GAClD,GAAI8C,EAAQ,EAAG,OAAOD,EACtB,MAAMI,EAAO,IAAIJ,GAEjB,OADAI,EAAKC,OAAOJ,EAAO,GACZG,QAInB,CAACN,IAGCX,EAAYzC,EAAK,QAACgB,aACpB,SAAmBwB,GACf,MAAM/B,EAAUmD,oBAAkB,SAC5BC,EAAQjC,EAAAC,cAAAD,gBAAA,CACVtB,iBAAkBuC,EAClBtC,aAAcuC,GACXN,GAHO,GAAA,CAIV/B,QAAAA,IAGJ,OADAwC,EAAWK,GAAS,IAAIA,EAAMO,IACvB,IAAM9C,EAAYN,KAE7B,CAACoC,EAAyBC,EAAqB/B,IAGnD,OACIf,wBAACoC,EAAc0B,SAAS,CAAAC,MAAOtB,GAC1BE,EACD3C,EAAC,QAAAgC,cAAAgC,EAAAA,YACsB,IAAlBhB,EAAOiB,OAAe,KACnBjE,UAAAgC,cAACkC,EAAAA,IACG,CAAAC,UAAW,CAACC,EAAAA,QAAOC,kBAAmBtB,GACtCuB,SAAS,QACTC,MAAM,OACNC,SAAU5B,EACV6B,cAAe7B,gBACH,oBAEZ5C,EAAC,QAAAgC,cAAA0C,QAAM,CAAAC,MAAM,UACR3B,EAAO4B,IAAIC,IAAA,IAACpE,QAAEA,GAAHoE,EAAerC,EAAfsC,EAAAC,wBAAAF,EAAAG,GAAA,OACRhF,UAAAgC,cAACjC,EAAD6B,gBAAA,CACIqD,IAAKxE,EACLG,IAAKuC,EAAU1C,GACfA,QAASA,EACTE,cAAeI,GACXyB"}
|
|
1
|
+
{"version":3,"file":"use-toasts.js","sources":["../../src/toast/use-toasts.tsx"],"sourcesContent":[null],"names":["React","isActionObject","__assign","StaticToast","useToastsAnimation","__spreadArray","generateElementId","Portal","Box","styles","Stack","__rest"],"mappings":";;;;;;;;;;;;;;;;;;AAqDA;AACA,IAAM,aAAa,GAAGA,yBAAK,CAAC,UAAU,CAAqC,S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AAC,CAAA;AACf,IAAA,OAAO,IAAI,CAAA;AACf;;;;;;"}
|
package/lib/tooltip/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { Tooltip, TooltipProvider } from './tooltip';
|
|
2
|
-
export type { TooltipProps } from './tooltip';
|
|
1
|
+
export { Tooltip, TooltipProvider } from './tooltip';
|
|
2
|
+
export type { TooltipProps } from './tooltip';
|
package/lib/tooltip/tooltip.d.ts
CHANGED
|
@@ -1,72 +1,72 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import type { TooltipStoreState, TooltipStore } from '@ariakit/react';
|
|
3
|
-
import type { ObfuscatedClassName } from '../utils/common-types';
|
|
4
|
-
declare function TooltipProvider({ showTimeout, hideTimeout, children, }: React.PropsWithChildren<{
|
|
5
|
-
showTimeout?: number;
|
|
6
|
-
hideTimeout?: number;
|
|
7
|
-
}>): React.JSX.Element;
|
|
8
|
-
interface TooltipProps extends ObfuscatedClassName {
|
|
9
|
-
/**
|
|
10
|
-
* The element that triggers the tooltip. Generally a button or link.
|
|
11
|
-
*
|
|
12
|
-
* It should be an interactive element accessible both via mouse and keyboard interactions.
|
|
13
|
-
*/
|
|
14
|
-
children: React.ReactNode;
|
|
15
|
-
/**
|
|
16
|
-
* The content to show in the tooltip.
|
|
17
|
-
*
|
|
18
|
-
* It can be rich content provided via React elements, or string content. It should not include
|
|
19
|
-
* interactive elements inside it. This includes links or buttons.
|
|
20
|
-
*
|
|
21
|
-
* You can provide a function instead of the content itself. In this case, the function should
|
|
22
|
-
* return the desired content. This is useful if the content is expensive to generate. It can
|
|
23
|
-
* also be useful if the content dynamically changes often, so every time you trigger the
|
|
24
|
-
* tooltip the content may have changed (e.g. if you show a ticking time clock in the tooltip).
|
|
25
|
-
*
|
|
26
|
-
* The trigger element will be associated to this content via `aria-describedby`. This means
|
|
27
|
-
* that the tooltip content will be read by assistive technologies such as screen readers. It
|
|
28
|
-
* will likely read this content right after reading the trigger element label.
|
|
29
|
-
*/
|
|
30
|
-
content: React.ReactNode | (() => React.ReactNode);
|
|
31
|
-
/**
|
|
32
|
-
* How to place the tooltip relative to its trigger element.
|
|
33
|
-
*
|
|
34
|
-
* The possible values are "top", "bottom", "left", "right". Additionally, any of these values
|
|
35
|
-
* can be combined with `-start` or `-end` for even more control. For instance `top-start` will
|
|
36
|
-
* place the tooltip at the top, but with the start (e.g. left) side of the toolip and the
|
|
37
|
-
* trigger aligned. If neither `-start` or `-end` are provided, the tooltip is centered along
|
|
38
|
-
* the vertical or horizontal axis with the trigger.
|
|
39
|
-
*
|
|
40
|
-
* The position is enforced whenever possible, but tooltips can appear in different positions
|
|
41
|
-
* if the specified one would make the tooltip intersect with the viewport edges.
|
|
42
|
-
*
|
|
43
|
-
* @default 'top'
|
|
44
|
-
*/
|
|
45
|
-
position?: TooltipStoreState['placement'];
|
|
46
|
-
/**
|
|
47
|
-
* The separation (in pixels) between the trigger element and the tooltip.
|
|
48
|
-
* @default 3
|
|
49
|
-
*/
|
|
50
|
-
gapSize?: number;
|
|
51
|
-
/**
|
|
52
|
-
* Whether to show an arrow-like element attached to the tooltip, and pointing towards the
|
|
53
|
-
* trigger element.
|
|
54
|
-
* @default false
|
|
55
|
-
*/
|
|
56
|
-
withArrow?: boolean;
|
|
57
|
-
/**
|
|
58
|
-
* The amount of time in milliseconds to wait before showing the tooltip
|
|
59
|
-
* Use `<TooltipContext.Provider>` to set a global value for all tooltips
|
|
60
|
-
* @default 500
|
|
61
|
-
*/
|
|
62
|
-
showTimeout?: number;
|
|
63
|
-
/**
|
|
64
|
-
* The amount of time in milliseconds to wait before hiding the tooltip
|
|
65
|
-
* Use `<TooltipContext.Provider>` to set a global value for all tooltips
|
|
66
|
-
* @default 100
|
|
67
|
-
*/
|
|
68
|
-
hideTimeout?: number;
|
|
69
|
-
}
|
|
70
|
-
declare const Tooltip: React.ForwardRefExoticComponent<TooltipProps & React.RefAttributes<TooltipStore>>;
|
|
71
|
-
export type { TooltipProps };
|
|
72
|
-
export { Tooltip, TooltipProvider };
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { TooltipStoreState, TooltipStore } from '@ariakit/react';
|
|
3
|
+
import type { ObfuscatedClassName } from '../utils/common-types';
|
|
4
|
+
declare function TooltipProvider({ showTimeout, hideTimeout, children, }: React.PropsWithChildren<{
|
|
5
|
+
showTimeout?: number;
|
|
6
|
+
hideTimeout?: number;
|
|
7
|
+
}>): React.JSX.Element;
|
|
8
|
+
interface TooltipProps extends ObfuscatedClassName {
|
|
9
|
+
/**
|
|
10
|
+
* The element that triggers the tooltip. Generally a button or link.
|
|
11
|
+
*
|
|
12
|
+
* It should be an interactive element accessible both via mouse and keyboard interactions.
|
|
13
|
+
*/
|
|
14
|
+
children: React.ReactNode;
|
|
15
|
+
/**
|
|
16
|
+
* The content to show in the tooltip.
|
|
17
|
+
*
|
|
18
|
+
* It can be rich content provided via React elements, or string content. It should not include
|
|
19
|
+
* interactive elements inside it. This includes links or buttons.
|
|
20
|
+
*
|
|
21
|
+
* You can provide a function instead of the content itself. In this case, the function should
|
|
22
|
+
* return the desired content. This is useful if the content is expensive to generate. It can
|
|
23
|
+
* also be useful if the content dynamically changes often, so every time you trigger the
|
|
24
|
+
* tooltip the content may have changed (e.g. if you show a ticking time clock in the tooltip).
|
|
25
|
+
*
|
|
26
|
+
* The trigger element will be associated to this content via `aria-describedby`. This means
|
|
27
|
+
* that the tooltip content will be read by assistive technologies such as screen readers. It
|
|
28
|
+
* will likely read this content right after reading the trigger element label.
|
|
29
|
+
*/
|
|
30
|
+
content: React.ReactNode | (() => React.ReactNode);
|
|
31
|
+
/**
|
|
32
|
+
* How to place the tooltip relative to its trigger element.
|
|
33
|
+
*
|
|
34
|
+
* The possible values are "top", "bottom", "left", "right". Additionally, any of these values
|
|
35
|
+
* can be combined with `-start` or `-end` for even more control. For instance `top-start` will
|
|
36
|
+
* place the tooltip at the top, but with the start (e.g. left) side of the toolip and the
|
|
37
|
+
* trigger aligned. If neither `-start` or `-end` are provided, the tooltip is centered along
|
|
38
|
+
* the vertical or horizontal axis with the trigger.
|
|
39
|
+
*
|
|
40
|
+
* The position is enforced whenever possible, but tooltips can appear in different positions
|
|
41
|
+
* if the specified one would make the tooltip intersect with the viewport edges.
|
|
42
|
+
*
|
|
43
|
+
* @default 'top'
|
|
44
|
+
*/
|
|
45
|
+
position?: TooltipStoreState['placement'];
|
|
46
|
+
/**
|
|
47
|
+
* The separation (in pixels) between the trigger element and the tooltip.
|
|
48
|
+
* @default 3
|
|
49
|
+
*/
|
|
50
|
+
gapSize?: number;
|
|
51
|
+
/**
|
|
52
|
+
* Whether to show an arrow-like element attached to the tooltip, and pointing towards the
|
|
53
|
+
* trigger element.
|
|
54
|
+
* @default false
|
|
55
|
+
*/
|
|
56
|
+
withArrow?: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* The amount of time in milliseconds to wait before showing the tooltip
|
|
59
|
+
* Use `<TooltipContext.Provider>` to set a global value for all tooltips
|
|
60
|
+
* @default 500
|
|
61
|
+
*/
|
|
62
|
+
showTimeout?: number;
|
|
63
|
+
/**
|
|
64
|
+
* The amount of time in milliseconds to wait before hiding the tooltip
|
|
65
|
+
* Use `<TooltipContext.Provider>` to set a global value for all tooltips
|
|
66
|
+
* @default 100
|
|
67
|
+
*/
|
|
68
|
+
hideTimeout?: number;
|
|
69
|
+
}
|
|
70
|
+
declare const Tooltip: React.ForwardRefExoticComponent<TooltipProps & React.RefAttributes<TooltipStore>>;
|
|
71
|
+
export type { TooltipProps };
|
|
72
|
+
export { Tooltip, TooltipProvider };
|