@doist/reactist 28.7.0 → 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 +2093 -3829
- 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 -139
- 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 -75
- 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 -30
- 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 -75
- 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 -211
- 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 -201
- 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 +16 -23
- package/styles/avatar.css +3 -3
- package/styles/avatar.module.css.css +1 -1
- package/styles/badge.css +3 -3
- package/styles/badge.module.css.css +1 -1
- package/styles/banner.css +7 -7
- package/styles/banner.module.css.css +1 -1
- package/styles/base-field.css +5 -5
- package/styles/base-field.module.css.css +1 -1
- package/styles/box.css +2 -2
- package/styles/box.module.css.css +1 -1
- package/styles/button.css +5 -5
- package/styles/button.module.css.css +1 -1
- package/styles/checkbox-field.css +4 -4
- package/styles/checkbox-field.module.css.css +1 -1
- package/styles/columns.css +2 -2
- package/styles/divider.css +2 -2
- package/styles/heading.css +3 -3
- package/styles/heading.module.css.css +1 -1
- package/styles/hidden-visually.css +3 -3
- package/styles/hidden-visually.module.css.css +1 -1
- package/styles/hidden.css +2 -2
- package/styles/index.css +5 -5
- package/styles/loading.css +3 -3
- package/styles/menu.css +1 -1
- package/styles/modal.css +6 -6
- package/styles/modal.module.css.css +1 -1
- package/styles/notice.css +2 -2
- package/styles/password-field.css +8 -8
- package/styles/progress-bar.module.css.css +1 -1
- package/styles/prose.css +3 -3
- package/styles/prose.module.css.css +1 -1
- package/styles/reactist.css +31 -31
- package/styles/select-field.css +6 -6
- package/styles/select-field.module.css.css +1 -1
- package/styles/spinner.css +1 -1
- package/styles/static-toast.css +7 -7
- package/styles/switch-field.css +7 -7
- package/styles/switch-field.module.css.css +1 -1
- package/styles/tabs.css +3 -3
- package/styles/tabs.module.css.css +1 -1
- package/styles/text-area.css +6 -6
- package/styles/text-area.module.css.css +1 -1
- package/styles/text-field.css +6 -6
- package/styles/text-field.module.css.css +1 -1
- package/styles/text-link.css +3 -3
- package/styles/text-link.module.css.css +1 -1
- package/styles/text.css +3 -3
- package/styles/text.module.css.css +1 -1
- package/styles/toast.module.css.css +1 -1
- package/styles/tooltip.css +3 -3
- package/styles/tooltip.module.css.css +1 -1
- package/styles/use-toasts.css +7 -7
- package/styles/width.module.css.css +1 -1
- 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/tooltip/tooltip.js
CHANGED
|
@@ -1,2 +1,68 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var React = require('react');
|
|
6
|
+
var react = require('@ariakit/react');
|
|
7
|
+
var box = require('../box/box.js');
|
|
8
|
+
var tooltip_module = require('./tooltip.module.css.js');
|
|
9
|
+
|
|
10
|
+
function _interopNamespace(e) {
|
|
11
|
+
if (e && e.__esModule) return e;
|
|
12
|
+
var n = Object.create(null);
|
|
13
|
+
if (e) {
|
|
14
|
+
Object.keys(e).forEach(function (k) {
|
|
15
|
+
if (k !== 'default') {
|
|
16
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
17
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function () { return e[k]; }
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
n["default"] = e;
|
|
25
|
+
return Object.freeze(n);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
29
|
+
|
|
30
|
+
var defaultShowTimeout = 500;
|
|
31
|
+
var defaultHideTimeout = 100;
|
|
32
|
+
var TooltipContext = React__namespace.createContext({
|
|
33
|
+
showTimeout: defaultShowTimeout,
|
|
34
|
+
hideTimeout: defaultHideTimeout
|
|
35
|
+
});
|
|
36
|
+
function TooltipProvider(_a) {
|
|
37
|
+
var _b = _a.showTimeout, showTimeout = _b === void 0 ? defaultShowTimeout : _b, _c = _a.hideTimeout, hideTimeout = _c === void 0 ? defaultHideTimeout : _c, children = _a.children;
|
|
38
|
+
var value = React__namespace.useMemo(function () { return ({ showTimeout: showTimeout, hideTimeout: hideTimeout }); }, [showTimeout, hideTimeout]);
|
|
39
|
+
return React__namespace.createElement(TooltipContext.Provider, { value: value }, children);
|
|
40
|
+
}
|
|
41
|
+
var Tooltip = React__namespace.forwardRef(function (_a, ref) {
|
|
42
|
+
var children = _a.children, content = _a.content, _b = _a.position, position = _b === void 0 ? 'top' : _b, _c = _a.gapSize, gapSize = _c === void 0 ? 3 : _c, _d = _a.withArrow, withArrow = _d === void 0 ? false : _d, showTimeout = _a.showTimeout, hideTimeout = _a.hideTimeout, exceptionallySetClassName = _a.exceptionallySetClassName;
|
|
43
|
+
var _e = React__namespace.useContext(TooltipContext), globalShowTimeout = _e.showTimeout, globalHideTimeout = _e.hideTimeout;
|
|
44
|
+
var tooltip = react.useTooltipStore({
|
|
45
|
+
placement: position,
|
|
46
|
+
showTimeout: showTimeout !== null && showTimeout !== void 0 ? showTimeout : globalShowTimeout,
|
|
47
|
+
hideTimeout: hideTimeout !== null && hideTimeout !== void 0 ? hideTimeout : globalHideTimeout
|
|
48
|
+
});
|
|
49
|
+
React__namespace.useImperativeHandle(ref, function () { return tooltip; }, [tooltip]);
|
|
50
|
+
var isOpen = tooltip.useState('open');
|
|
51
|
+
var child = React__namespace.Children.only(children);
|
|
52
|
+
if (!child) {
|
|
53
|
+
return child;
|
|
54
|
+
}
|
|
55
|
+
if (typeof child.ref === 'string') {
|
|
56
|
+
throw new Error('Tooltip: String refs cannot be used as they cannot be forwarded');
|
|
57
|
+
}
|
|
58
|
+
return (React__namespace.createElement(React__namespace.Fragment, null,
|
|
59
|
+
React__namespace.createElement(react.TooltipAnchor, { render: child, store: tooltip, ref: child.ref }),
|
|
60
|
+
isOpen && content ? (React__namespace.createElement(react.Tooltip, { store: tooltip, gutter: gapSize, render: React__namespace.createElement(box.Box, { className: [tooltip_module["default"].tooltip, exceptionallySetClassName], background: "toast", borderRadius: "standard", paddingX: "small", paddingY: "xsmall", maxWidth: "medium", width: "fitContent", overflow: "hidden", textAlign: "center" }) },
|
|
61
|
+
withArrow ? React__namespace.createElement(react.TooltipArrow, null) : null,
|
|
62
|
+
typeof content === 'function' ? content() : content)) : null));
|
|
63
|
+
});
|
|
64
|
+
Tooltip.displayName = 'Tooltip';
|
|
65
|
+
|
|
66
|
+
exports.Tooltip = Tooltip;
|
|
67
|
+
exports.TooltipProvider = TooltipProvider;
|
|
2
68
|
//# sourceMappingURL=tooltip.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tooltip.js","sources":["../../src/tooltip/tooltip.tsx"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"tooltip.js","sources":["../../src/tooltip/tooltip.tsx"],"sourcesContent":[null],"names":["React","useTooltipStore","TooltipAnchor","AriakitTooltip","Box","styles","TooltipArrow"],"mappings":"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"}
|
|
@@ -1,2 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var modules_95f1407a = {"tooltip":"_487c82cd"};
|
|
6
|
+
|
|
7
|
+
exports["default"] = modules_95f1407a;
|
|
2
8
|
//# sourceMappingURL=tooltip.module.css.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tooltip.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"tooltip.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare function generateElementId(prefix: string): string;
|
|
2
|
-
export declare function useId(providedId?: string): string;
|
|
1
|
+
export declare function generateElementId(prefix: string): string;
|
|
2
|
+
export declare function useId(providedId?: string): string;
|
|
@@ -1,2 +1,45 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var React = require('react');
|
|
6
|
+
|
|
7
|
+
function _interopNamespace(e) {
|
|
8
|
+
if (e && e.__esModule) return e;
|
|
9
|
+
var n = Object.create(null);
|
|
10
|
+
if (e) {
|
|
11
|
+
Object.keys(e).forEach(function (k) {
|
|
12
|
+
if (k !== 'default') {
|
|
13
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
14
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: function () { return e[k]; }
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
n["default"] = e;
|
|
22
|
+
return Object.freeze(n);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
26
|
+
|
|
27
|
+
var uid = 0;
|
|
28
|
+
function uniqueId() {
|
|
29
|
+
return uid++;
|
|
30
|
+
}
|
|
31
|
+
function generateElementId(prefix) {
|
|
32
|
+
var num = uniqueId();
|
|
33
|
+
return "".concat(prefix, "-").concat(num);
|
|
34
|
+
}
|
|
35
|
+
function useId(providedId) {
|
|
36
|
+
var ref = React__namespace.useRef(providedId !== null && providedId !== void 0 ? providedId : null);
|
|
37
|
+
if (!ref.current) {
|
|
38
|
+
ref.current = generateElementId('element');
|
|
39
|
+
}
|
|
40
|
+
return ref.current;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
exports.generateElementId = generateElementId;
|
|
44
|
+
exports.useId = useId;
|
|
2
45
|
//# sourceMappingURL=common-helpers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common-helpers.js","sources":["../../src/utils/common-helpers.ts"],"sourcesContent":[
|
|
1
|
+
{"version":3,"file":"common-helpers.js","sources":["../../src/utils/common-helpers.ts"],"sourcesContent":[null],"names":["React"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,IAAI,GAAG,GAAG,CAAC,CAAA;AACX,SAAS,QAAQ,GAAA;IACb,OAAO,GAAG,EAAE,CAAA;AAChB,CAAC;AAEK,SAAU,iBAAiB,CAAC,MAAc,EAAA;AAC5C,IAAA,IAAM,GAAG,GAAG,QAAQ,EAAE,CAAA;AACtB,IAAA,OAAO,EAAG,CAAA,MAAA,CAAA,MAAM,EAAI,GAAA,CAAA,CAAA,MAAA,CAAA,GAAG,CAAE,CAAA;AAC7B,CAAC;AAEK,SAAU,KAAK,CAAC,UAAmB,EAAA;AACrC,IAAA,IAAM,GAAG,GAAGA,gBAAK,CAAC,MAAM,CAAgB,UAAU,KAAV,IAAA,IAAA,UAAU,KAAV,KAAA,CAAA,GAAA,UAAU,GAAI,IAAI,CAAC,CAAA;AAC3D,IAAA,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE;AACd,QAAA,GAAG,CAAC,OAAO,GAAG,iBAAiB,CAAC,SAAS,CAAC,CAAA;AAC7C,KAAA;IACD,OAAO,GAAG,CAAC,OAAO,CAAA;AACtB;;;;;"}
|
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
import type classNames from 'classnames';
|
|
2
|
-
import type { HTMLAttributes } from 'react';
|
|
3
|
-
export type Space = 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge';
|
|
4
|
-
export type SpaceWithNegatives = Space | '-xsmall' | '-small' | '-medium' | '-large' | '-xlarge' | '-xxlarge';
|
|
5
|
-
export type Tone = 'normal' | 'secondary' | 'danger' | 'positive';
|
|
6
|
-
export type AlertTone = 'info' | 'positive' | 'caution' | 'critical';
|
|
7
|
-
export type DividerWeight = 'primary' | 'secondary' | 'tertiary' | 'none';
|
|
8
|
-
type ClassValue = Parameters<typeof classNames>[number];
|
|
9
|
-
export type WithEnhancedClassName<T = unknown> = T extends HTMLElement ? Omit<HTMLAttributes<T>, 'className'> & {
|
|
10
|
-
className?: ClassValue;
|
|
11
|
-
} : T extends {
|
|
12
|
-
className?: unknown;
|
|
13
|
-
} ? Omit<T, 'className'> & {
|
|
14
|
-
className?: ClassValue;
|
|
15
|
-
} : T & {
|
|
16
|
-
className?: ClassValue;
|
|
17
|
-
};
|
|
18
|
-
export interface OpenInNewTab {
|
|
19
|
-
openInNewTab?: boolean;
|
|
20
|
-
target?: never;
|
|
21
|
-
rel?: never;
|
|
22
|
-
}
|
|
23
|
-
export type ObfuscatedClassName = {
|
|
24
|
-
/**
|
|
25
|
-
* Used internally to set the `className` prop of the main container element for this component.
|
|
26
|
-
*
|
|
27
|
-
* Aside from the different name, the prop behaves the same as the native `className`. The only
|
|
28
|
-
* reason for the name change is to discourage applying custom CSS to the design system
|
|
29
|
-
* components, which are supposed to _eventually_ provide all the styling features we may need.
|
|
30
|
-
*
|
|
31
|
-
* This prop is meant to be used only in certain circumstances, when you really need a escape
|
|
32
|
-
* hatch to apply custom styles to a component. Before reaching for this feature, try harder to
|
|
33
|
-
* see if you can solve your needs with what the design system provides.
|
|
34
|
-
*
|
|
35
|
-
* For instance, instead of applying layout-related styles to a non-layout component, consider
|
|
36
|
-
* wrapping it inside a layout component.
|
|
37
|
-
*
|
|
38
|
-
* @see PolymorphicComponent
|
|
39
|
-
*/
|
|
40
|
-
exceptionallySetClassName?: string;
|
|
41
|
-
};
|
|
42
|
-
export {};
|
|
1
|
+
import type classNames from 'classnames';
|
|
2
|
+
import type { HTMLAttributes } from 'react';
|
|
3
|
+
export type Space = 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' | 'xxlarge';
|
|
4
|
+
export type SpaceWithNegatives = Space | '-xsmall' | '-small' | '-medium' | '-large' | '-xlarge' | '-xxlarge';
|
|
5
|
+
export type Tone = 'normal' | 'secondary' | 'danger' | 'positive';
|
|
6
|
+
export type AlertTone = 'info' | 'positive' | 'caution' | 'critical';
|
|
7
|
+
export type DividerWeight = 'primary' | 'secondary' | 'tertiary' | 'none';
|
|
8
|
+
type ClassValue = Parameters<typeof classNames>[number];
|
|
9
|
+
export type WithEnhancedClassName<T = unknown> = T extends HTMLElement ? Omit<HTMLAttributes<T>, 'className'> & {
|
|
10
|
+
className?: ClassValue;
|
|
11
|
+
} : T extends {
|
|
12
|
+
className?: unknown;
|
|
13
|
+
} ? Omit<T, 'className'> & {
|
|
14
|
+
className?: ClassValue;
|
|
15
|
+
} : T & {
|
|
16
|
+
className?: ClassValue;
|
|
17
|
+
};
|
|
18
|
+
export interface OpenInNewTab {
|
|
19
|
+
openInNewTab?: boolean;
|
|
20
|
+
target?: never;
|
|
21
|
+
rel?: never;
|
|
22
|
+
}
|
|
23
|
+
export type ObfuscatedClassName = {
|
|
24
|
+
/**
|
|
25
|
+
* Used internally to set the `className` prop of the main container element for this component.
|
|
26
|
+
*
|
|
27
|
+
* Aside from the different name, the prop behaves the same as the native `className`. The only
|
|
28
|
+
* reason for the name change is to discourage applying custom CSS to the design system
|
|
29
|
+
* components, which are supposed to _eventually_ provide all the styling features we may need.
|
|
30
|
+
*
|
|
31
|
+
* This prop is meant to be used only in certain circumstances, when you really need a escape
|
|
32
|
+
* hatch to apply custom styles to a component. Before reaching for this feature, try harder to
|
|
33
|
+
* see if you can solve your needs with what the design system provides.
|
|
34
|
+
*
|
|
35
|
+
* For instance, instead of applying layout-related styles to a non-layout component, consider
|
|
36
|
+
* wrapping it inside a layout component.
|
|
37
|
+
*
|
|
38
|
+
* @see PolymorphicComponent
|
|
39
|
+
*/
|
|
40
|
+
exceptionallySetClassName?: string;
|
|
41
|
+
};
|
|
42
|
+
export {};
|
|
@@ -1,135 +1,135 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import type { ObfuscatedClassName } from './common-types';
|
|
3
|
-
type Merge<P1, P2> = Omit<P1, keyof P2> & P2;
|
|
4
|
-
type EmptyObject = {
|
|
5
|
-
[K in any]: never;
|
|
6
|
-
};
|
|
7
|
-
type ObfuscateClassNameMode = 'keepClassName' | 'obfuscateClassName' | 'omitClassName';
|
|
8
|
-
/**
|
|
9
|
-
* If a set of props include the `className` prop, we replace it with a `exceptionallySetClassName`
|
|
10
|
-
* prop instead.
|
|
11
|
-
*
|
|
12
|
-
* This can be customized via the second generic parameter, as there are cases where it may be
|
|
13
|
-
* needed to omit this behaviour and keep the `className`. You can also instruct it to remove the
|
|
14
|
-
* `className` prop while not replacing it with the `exceptionallySetClassName` one.
|
|
15
|
-
*
|
|
16
|
-
* @see ObfuscatedClassName['exceptionallySetClassName'] for details about this prop
|
|
17
|
-
* @see PolymorphicComponent for details about this feature
|
|
18
|
-
*/
|
|
19
|
-
type WithObfuscatedClassName<Props, ShouldObfuscateClassName extends ObfuscateClassNameMode> = 'className' extends keyof Props ? ShouldObfuscateClassName extends 'obfuscateClassName' ? Omit<Props, 'className'> & ObfuscatedClassName : ShouldObfuscateClassName extends 'omitClassName' ? Omit<Props, 'className'> : ShouldObfuscateClassName extends 'keepClassName' ? Props : never : Props;
|
|
20
|
-
type PolymorphicProp<ComponentType extends React.ElementType> = {
|
|
21
|
-
/**
|
|
22
|
-
* Used to instruct this component what React element to render as. It can be both a string
|
|
23
|
-
* representing a HTML tag name, or a React component.
|
|
24
|
-
*
|
|
25
|
-
* When using this prop, the component you apply it to will also recognize in its props types
|
|
26
|
-
* all the props from the component or HTML element you are rendering it as.
|
|
27
|
-
*
|
|
28
|
-
* Some uses for this feature:
|
|
29
|
-
*
|
|
30
|
-
* - Using some of our layout components, while at the same time being able to set them to use
|
|
31
|
-
* semantic HTML elements needed for accessibility purposes (e.g. `nav`, `main`, etc).
|
|
32
|
-
* - Using a design system link component, but have it internally use a client-side router link
|
|
33
|
-
* implemented via a React component (e.g. react-router's `Link`).
|
|
34
|
-
*
|
|
35
|
-
* Keep in mind that not all compositions of this kind may work well, especially when composing
|
|
36
|
-
* with another React component and not with a HTML tag name. In particular, if the components
|
|
37
|
-
* being composed have opposing concerns of clashing features (e.g. they have contradicting
|
|
38
|
-
* styles applied to them) things may not go well. In those cases prefer to nest them instead.
|
|
39
|
-
*
|
|
40
|
-
* @see PolymorphicComponent
|
|
41
|
-
*/
|
|
42
|
-
as?: ComponentType;
|
|
43
|
-
};
|
|
44
|
-
/**
|
|
45
|
-
* Given a component or element type, and a set of additional props, this builds the entire set of
|
|
46
|
-
* props for a polymorphic component.
|
|
47
|
-
*
|
|
48
|
-
* It does three things:
|
|
49
|
-
*
|
|
50
|
-
* 1. it merges the element type props with the `OwnProps`
|
|
51
|
-
* 2. it adds the `as` prop to allow for polymorphism to happen
|
|
52
|
-
* 3. it optionally obfuscates or omits the className prop if present
|
|
53
|
-
*
|
|
54
|
-
* @see PolymorphicProp
|
|
55
|
-
* @see WithObfuscatedClassName
|
|
56
|
-
*/
|
|
57
|
-
type PolymorphicComponentProps<ComponentType extends React.ElementType, OwnProps, ShouldObfuscateClassName extends ObfuscateClassNameMode> = Merge<WithObfuscatedClassName<React.ComponentProps<ComponentType>, ShouldObfuscateClassName>, OwnProps & PolymorphicProp<ComponentType>>;
|
|
58
|
-
type ElementTagNameMap = HTMLElementTagNameMap & Pick<SVGElementTagNameMap, Exclude<keyof SVGElementTagNameMap, keyof HTMLElementTagNameMap>>;
|
|
59
|
-
type ElementByTag<TagName extends keyof ElementTagNameMap> = ElementTagNameMap[TagName];
|
|
60
|
-
type ElementByTagOrAny<ComponentType extends React.ElementType> = ComponentType extends keyof ElementTagNameMap ? ElementByTag<ComponentType> : any;
|
|
61
|
-
/**
|
|
62
|
-
* The function passed to React.forwardRef, but typed in a way that's prepared for polymorphism via
|
|
63
|
-
* the `as` prop. It also allows to specify if the `className` prop should be obfuscated or omitted.
|
|
64
|
-
*
|
|
65
|
-
* @see PolymorphicComponentProps
|
|
66
|
-
* @see WithObfuscatedClassName
|
|
67
|
-
*/
|
|
68
|
-
interface ForwardRefFunction<ComponentType extends React.ElementType, OwnProps, ShouldObfuscateClassName extends ObfuscateClassNameMode> {
|
|
69
|
-
(props: PolymorphicComponentProps<ComponentType, OwnProps, ShouldObfuscateClassName>, ref: ((instance: ElementByTagOrAny<ComponentType> | null) => void) | React.MutableRefObject<ElementByTagOrAny<ComponentType> | null> | null): React.ReactElement | null;
|
|
70
|
-
displayName?: string;
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* A component that can customize the React element type that it renders (a.k.a. a polymorphic
|
|
74
|
-
* component). This is achieved by passing a prop `as={ElementType}` or `as="html-tag-name"`.
|
|
75
|
-
*
|
|
76
|
-
* It transparently takes care of forwarding refs, and properly sets the ref type depending on the
|
|
77
|
-
* element type.
|
|
78
|
-
*
|
|
79
|
-
* ## Recognizing props based on the polymorphic type
|
|
80
|
-
*
|
|
81
|
-
* The `ComponentType` argument sets the default type for the `as` prop. Whatever the `as` prop
|
|
82
|
-
* component or HTML element is, the type system will automatically allow you to pass props that are
|
|
83
|
-
* not explicitly defined by you, but that are recognized as valid props to be passed to the
|
|
84
|
-
* component you are rendering.
|
|
85
|
-
*
|
|
86
|
-
* For instance, see the following example:
|
|
87
|
-
*
|
|
88
|
-
* ```jsx
|
|
89
|
-
* <Box as="label" htmlFor="field-id">Hello</Box>
|
|
90
|
-
* ```
|
|
91
|
-
*
|
|
92
|
-
* The `htmlFor` prop is exclusive to label elements. If you omit the `as="label"` prop, the type
|
|
93
|
-
* system will consider the `htmlFor` prop to be an error. The same happens if you pass a value of
|
|
94
|
-
* an incorrect type to such prop. For instance, the example below will issue a type error:
|
|
95
|
-
*
|
|
96
|
-
* ```jsx
|
|
97
|
-
* <Box as="label" htmlFor={123}>Hello</Box>
|
|
98
|
-
* ```
|
|
99
|
-
*
|
|
100
|
-
* ## Omitting or obfuscating the `className` prop
|
|
101
|
-
*
|
|
102
|
-
* If a set of props include the `className` prop, we replace it with a `exceptionallySetClassName`
|
|
103
|
-
* prop instead.
|
|
104
|
-
*
|
|
105
|
-
* This is to discourage customizing design system components via custom styling, while still
|
|
106
|
-
* leaving the door open to do it as an escape hatch when the design system still has shortcomings
|
|
107
|
-
* with respect to the product designs we want to achieve.
|
|
108
|
-
*
|
|
109
|
-
* The cumbersome name also serves the purpose of aiding in easily searching for the places in the
|
|
110
|
-
* code where this escape hatch was needed, in order to identify areas where the design system
|
|
111
|
-
* components need to improve to better match our needs.
|
|
112
|
-
*
|
|
113
|
-
* This behaviour can be customized via an optional second generic argument that allows to disable
|
|
114
|
-
* this feature, or to omit the `className` altogether without replacing it with the obfuscated prop
|
|
115
|
-
* name.
|
|
116
|
-
*
|
|
117
|
-
* @deprecated Use Ariakit's composition instead (https://ariakit.org/guide/composition)
|
|
118
|
-
*/
|
|
119
|
-
interface PolymorphicComponent<ComponentType extends React.ElementType, OwnProps, ShouldObfuscateClassName extends ObfuscateClassNameMode = 'obfuscateClassName'> {
|
|
120
|
-
<TT extends React.ElementType = ComponentType>(props: PolymorphicComponentProps<TT, OwnProps, ShouldObfuscateClassName>): React.ReactElement | null;
|
|
121
|
-
readonly $$typeof: symbol;
|
|
122
|
-
defaultProps?: Partial<PolymorphicComponentProps<ComponentType, OwnProps, ShouldObfuscateClassName>>;
|
|
123
|
-
propTypes?: React.WeakValidationMap<PolymorphicComponentProps<ComponentType, OwnProps, ShouldObfuscateClassName>>;
|
|
124
|
-
displayName?: string;
|
|
125
|
-
}
|
|
126
|
-
/**
|
|
127
|
-
* A wrapper to use React.forwardRef with polymorphic components in a type-safe manner. This is a
|
|
128
|
-
* convenience over merely using React.forwardRef directly, and then manually forcing the resulting
|
|
129
|
-
* value to be typed using `as PolymorphicComponent<…>`.
|
|
130
|
-
*
|
|
131
|
-
* @deprecated Use Ariakit's composition instead (https://ariakit.org/guide/composition)
|
|
132
|
-
*/
|
|
133
|
-
declare function polymorphicComponent<ComponentType extends React.ElementType = 'div', OwnProps = EmptyObject, ShouldObfuscateClassName extends ObfuscateClassNameMode = 'obfuscateClassName'>(render: ForwardRefFunction<ComponentType, OwnProps, ShouldObfuscateClassName>): PolymorphicComponent<ComponentType, OwnProps, ShouldObfuscateClassName>;
|
|
134
|
-
export type { PolymorphicComponent };
|
|
135
|
-
export { polymorphicComponent };
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { ObfuscatedClassName } from './common-types';
|
|
3
|
+
type Merge<P1, P2> = Omit<P1, keyof P2> & P2;
|
|
4
|
+
type EmptyObject = {
|
|
5
|
+
[K in any]: never;
|
|
6
|
+
};
|
|
7
|
+
type ObfuscateClassNameMode = 'keepClassName' | 'obfuscateClassName' | 'omitClassName';
|
|
8
|
+
/**
|
|
9
|
+
* If a set of props include the `className` prop, we replace it with a `exceptionallySetClassName`
|
|
10
|
+
* prop instead.
|
|
11
|
+
*
|
|
12
|
+
* This can be customized via the second generic parameter, as there are cases where it may be
|
|
13
|
+
* needed to omit this behaviour and keep the `className`. You can also instruct it to remove the
|
|
14
|
+
* `className` prop while not replacing it with the `exceptionallySetClassName` one.
|
|
15
|
+
*
|
|
16
|
+
* @see ObfuscatedClassName['exceptionallySetClassName'] for details about this prop
|
|
17
|
+
* @see PolymorphicComponent for details about this feature
|
|
18
|
+
*/
|
|
19
|
+
type WithObfuscatedClassName<Props, ShouldObfuscateClassName extends ObfuscateClassNameMode> = 'className' extends keyof Props ? ShouldObfuscateClassName extends 'obfuscateClassName' ? Omit<Props, 'className'> & ObfuscatedClassName : ShouldObfuscateClassName extends 'omitClassName' ? Omit<Props, 'className'> : ShouldObfuscateClassName extends 'keepClassName' ? Props : never : Props;
|
|
20
|
+
type PolymorphicProp<ComponentType extends React.ElementType> = {
|
|
21
|
+
/**
|
|
22
|
+
* Used to instruct this component what React element to render as. It can be both a string
|
|
23
|
+
* representing a HTML tag name, or a React component.
|
|
24
|
+
*
|
|
25
|
+
* When using this prop, the component you apply it to will also recognize in its props types
|
|
26
|
+
* all the props from the component or HTML element you are rendering it as.
|
|
27
|
+
*
|
|
28
|
+
* Some uses for this feature:
|
|
29
|
+
*
|
|
30
|
+
* - Using some of our layout components, while at the same time being able to set them to use
|
|
31
|
+
* semantic HTML elements needed for accessibility purposes (e.g. `nav`, `main`, etc).
|
|
32
|
+
* - Using a design system link component, but have it internally use a client-side router link
|
|
33
|
+
* implemented via a React component (e.g. react-router's `Link`).
|
|
34
|
+
*
|
|
35
|
+
* Keep in mind that not all compositions of this kind may work well, especially when composing
|
|
36
|
+
* with another React component and not with a HTML tag name. In particular, if the components
|
|
37
|
+
* being composed have opposing concerns of clashing features (e.g. they have contradicting
|
|
38
|
+
* styles applied to them) things may not go well. In those cases prefer to nest them instead.
|
|
39
|
+
*
|
|
40
|
+
* @see PolymorphicComponent
|
|
41
|
+
*/
|
|
42
|
+
as?: ComponentType;
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Given a component or element type, and a set of additional props, this builds the entire set of
|
|
46
|
+
* props for a polymorphic component.
|
|
47
|
+
*
|
|
48
|
+
* It does three things:
|
|
49
|
+
*
|
|
50
|
+
* 1. it merges the element type props with the `OwnProps`
|
|
51
|
+
* 2. it adds the `as` prop to allow for polymorphism to happen
|
|
52
|
+
* 3. it optionally obfuscates or omits the className prop if present
|
|
53
|
+
*
|
|
54
|
+
* @see PolymorphicProp
|
|
55
|
+
* @see WithObfuscatedClassName
|
|
56
|
+
*/
|
|
57
|
+
type PolymorphicComponentProps<ComponentType extends React.ElementType, OwnProps, ShouldObfuscateClassName extends ObfuscateClassNameMode> = Merge<WithObfuscatedClassName<React.ComponentProps<ComponentType>, ShouldObfuscateClassName>, OwnProps & PolymorphicProp<ComponentType>>;
|
|
58
|
+
type ElementTagNameMap = HTMLElementTagNameMap & Pick<SVGElementTagNameMap, Exclude<keyof SVGElementTagNameMap, keyof HTMLElementTagNameMap>>;
|
|
59
|
+
type ElementByTag<TagName extends keyof ElementTagNameMap> = ElementTagNameMap[TagName];
|
|
60
|
+
type ElementByTagOrAny<ComponentType extends React.ElementType> = ComponentType extends keyof ElementTagNameMap ? ElementByTag<ComponentType> : any;
|
|
61
|
+
/**
|
|
62
|
+
* The function passed to React.forwardRef, but typed in a way that's prepared for polymorphism via
|
|
63
|
+
* the `as` prop. It also allows to specify if the `className` prop should be obfuscated or omitted.
|
|
64
|
+
*
|
|
65
|
+
* @see PolymorphicComponentProps
|
|
66
|
+
* @see WithObfuscatedClassName
|
|
67
|
+
*/
|
|
68
|
+
interface ForwardRefFunction<ComponentType extends React.ElementType, OwnProps, ShouldObfuscateClassName extends ObfuscateClassNameMode> {
|
|
69
|
+
(props: PolymorphicComponentProps<ComponentType, OwnProps, ShouldObfuscateClassName>, ref: ((instance: ElementByTagOrAny<ComponentType> | null) => void) | React.MutableRefObject<ElementByTagOrAny<ComponentType> | null> | null): React.ReactElement | null;
|
|
70
|
+
displayName?: string;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* A component that can customize the React element type that it renders (a.k.a. a polymorphic
|
|
74
|
+
* component). This is achieved by passing a prop `as={ElementType}` or `as="html-tag-name"`.
|
|
75
|
+
*
|
|
76
|
+
* It transparently takes care of forwarding refs, and properly sets the ref type depending on the
|
|
77
|
+
* element type.
|
|
78
|
+
*
|
|
79
|
+
* ## Recognizing props based on the polymorphic type
|
|
80
|
+
*
|
|
81
|
+
* The `ComponentType` argument sets the default type for the `as` prop. Whatever the `as` prop
|
|
82
|
+
* component or HTML element is, the type system will automatically allow you to pass props that are
|
|
83
|
+
* not explicitly defined by you, but that are recognized as valid props to be passed to the
|
|
84
|
+
* component you are rendering.
|
|
85
|
+
*
|
|
86
|
+
* For instance, see the following example:
|
|
87
|
+
*
|
|
88
|
+
* ```jsx
|
|
89
|
+
* <Box as="label" htmlFor="field-id">Hello</Box>
|
|
90
|
+
* ```
|
|
91
|
+
*
|
|
92
|
+
* The `htmlFor` prop is exclusive to label elements. If you omit the `as="label"` prop, the type
|
|
93
|
+
* system will consider the `htmlFor` prop to be an error. The same happens if you pass a value of
|
|
94
|
+
* an incorrect type to such prop. For instance, the example below will issue a type error:
|
|
95
|
+
*
|
|
96
|
+
* ```jsx
|
|
97
|
+
* <Box as="label" htmlFor={123}>Hello</Box>
|
|
98
|
+
* ```
|
|
99
|
+
*
|
|
100
|
+
* ## Omitting or obfuscating the `className` prop
|
|
101
|
+
*
|
|
102
|
+
* If a set of props include the `className` prop, we replace it with a `exceptionallySetClassName`
|
|
103
|
+
* prop instead.
|
|
104
|
+
*
|
|
105
|
+
* This is to discourage customizing design system components via custom styling, while still
|
|
106
|
+
* leaving the door open to do it as an escape hatch when the design system still has shortcomings
|
|
107
|
+
* with respect to the product designs we want to achieve.
|
|
108
|
+
*
|
|
109
|
+
* The cumbersome name also serves the purpose of aiding in easily searching for the places in the
|
|
110
|
+
* code where this escape hatch was needed, in order to identify areas where the design system
|
|
111
|
+
* components need to improve to better match our needs.
|
|
112
|
+
*
|
|
113
|
+
* This behaviour can be customized via an optional second generic argument that allows to disable
|
|
114
|
+
* this feature, or to omit the `className` altogether without replacing it with the obfuscated prop
|
|
115
|
+
* name.
|
|
116
|
+
*
|
|
117
|
+
* @deprecated Use Ariakit's composition instead (https://ariakit.org/guide/composition)
|
|
118
|
+
*/
|
|
119
|
+
interface PolymorphicComponent<ComponentType extends React.ElementType, OwnProps, ShouldObfuscateClassName extends ObfuscateClassNameMode = 'obfuscateClassName'> {
|
|
120
|
+
<TT extends React.ElementType = ComponentType>(props: PolymorphicComponentProps<TT, OwnProps, ShouldObfuscateClassName>): React.ReactElement | null;
|
|
121
|
+
readonly $$typeof: symbol;
|
|
122
|
+
defaultProps?: Partial<PolymorphicComponentProps<ComponentType, OwnProps, ShouldObfuscateClassName>>;
|
|
123
|
+
propTypes?: React.WeakValidationMap<PolymorphicComponentProps<ComponentType, OwnProps, ShouldObfuscateClassName>>;
|
|
124
|
+
displayName?: string;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* A wrapper to use React.forwardRef with polymorphic components in a type-safe manner. This is a
|
|
128
|
+
* convenience over merely using React.forwardRef directly, and then manually forcing the resulting
|
|
129
|
+
* value to be typed using `as PolymorphicComponent<…>`.
|
|
130
|
+
*
|
|
131
|
+
* @deprecated Use Ariakit's composition instead (https://ariakit.org/guide/composition)
|
|
132
|
+
*/
|
|
133
|
+
declare function polymorphicComponent<ComponentType extends React.ElementType = 'div', OwnProps = EmptyObject, ShouldObfuscateClassName extends ObfuscateClassNameMode = 'obfuscateClassName'>(render: ForwardRefFunction<ComponentType, OwnProps, ShouldObfuscateClassName>): PolymorphicComponent<ComponentType, OwnProps, ShouldObfuscateClassName>;
|
|
134
|
+
export type { PolymorphicComponent };
|
|
135
|
+
export { polymorphicComponent };
|
|
@@ -1,2 +1,40 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var React = require('react');
|
|
6
|
+
|
|
7
|
+
function _interopNamespace(e) {
|
|
8
|
+
if (e && e.__esModule) return e;
|
|
9
|
+
var n = Object.create(null);
|
|
10
|
+
if (e) {
|
|
11
|
+
Object.keys(e).forEach(function (k) {
|
|
12
|
+
if (k !== 'default') {
|
|
13
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
14
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: function () { return e[k]; }
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
n["default"] = e;
|
|
22
|
+
return Object.freeze(n);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
26
|
+
|
|
27
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
28
|
+
/**
|
|
29
|
+
* A wrapper to use React.forwardRef with polymorphic components in a type-safe manner. This is a
|
|
30
|
+
* convenience over merely using React.forwardRef directly, and then manually forcing the resulting
|
|
31
|
+
* value to be typed using `as PolymorphicComponent<…>`.
|
|
32
|
+
*
|
|
33
|
+
* @deprecated Use Ariakit's composition instead (https://ariakit.org/guide/composition)
|
|
34
|
+
*/
|
|
35
|
+
function polymorphicComponent(render) {
|
|
36
|
+
return React__namespace.forwardRef(render);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
exports.polymorphicComponent = polymorphicComponent;
|
|
2
40
|
//# sourceMappingURL=polymorphism.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"polymorphism.js","sources":["../../src/utils/polymorphism.ts"],"sourcesContent":[
|
|
1
|
+
{"version":3,"file":"polymorphism.js","sources":["../../src/utils/polymorphism.ts"],"sourcesContent":[null],"names":["React"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAoLA;;;;;;AAMG;AACH,SAAS,oBAAoB,CAI3B,MAA6E,EAAA;AAC3E,IAAA,OAAOA,gBAAK,CAAC,UAAU,CAAC,MAAM,CAI7B,CAAA;AACL;;;;"}
|