@nizivo/react 0.0.0-stage → 0.2.0
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/LICENSE +202 -0
- package/README.md +120 -2
- package/THIRD_PARTY_NOTICES +68 -0
- package/dist/_engines/react-aria/dialog.client.js +126 -0
- package/dist/_engines/react-aria/dom-allowlist.js +19 -0
- package/dist/_engines/react-aria/dom.js +31 -0
- package/dist/_engines/react-aria/drawer.client.js +8 -0
- package/dist/_engines/react-aria/file-upload.client.js +50 -0
- package/dist/_engines/react-aria/locale.client.js +13 -0
- package/dist/_engines/react-aria/menu.client.js +229 -0
- package/dist/_engines/react-aria/open-state.client.js +53 -0
- package/dist/_engines/react-aria/outside-press.client.js +61 -0
- package/dist/_engines/react-aria/overlay.client.js +46 -0
- package/dist/_engines/react-aria/popover.client.js +148 -0
- package/dist/_engines/react-aria/popup.client.js +153 -0
- package/dist/_engines/react-aria/select.client.js +180 -0
- package/dist/_engines/react-aria/tabs.client.js +95 -0
- package/dist/_engines/react-aria/toast.client.js +38 -0
- package/dist/_engines/react-aria/tooltip.client.js +72 -0
- package/dist/_internal/cx.js +11 -0
- package/dist/_internal/data-status.d.ts +3 -0
- package/dist/_internal/data-status.js +13 -0
- package/dist/_internal/engine-part.d.ts +1 -0
- package/dist/_internal/field.js +20 -0
- package/dist/_internal/glyphs.js +87 -0
- package/dist/_internal/keys.js +62 -0
- package/dist/_internal/modal.client.js +54 -0
- package/dist/_internal/nested-focus.js +33 -0
- package/dist/_internal/overlay.d.ts +9 -0
- package/dist/_virtual/_rolldown/runtime.js +13 -0
- package/dist/alert/alert-dismiss.client.d.ts +32 -0
- package/dist/alert/alert-dismiss.client.js +38 -0
- package/dist/alert/alert.d.ts +28 -0
- package/dist/alert/alert.js +44 -0
- package/dist/alert/index.d.ts +3 -0
- package/dist/alert/index.js +3 -0
- package/dist/app-shell/app-shell.d.ts +24 -0
- package/dist/app-shell/app-shell.js +56 -0
- package/dist/app-shell/index.d.ts +2 -0
- package/dist/app-shell/index.js +1 -0
- package/dist/augment.d.ts +13 -0
- package/dist/augment.js +0 -0
- package/dist/avatar/avatar.d.ts +96 -0
- package/dist/avatar/avatar.js +94 -0
- package/dist/avatar/index.d.ts +2 -0
- package/dist/avatar/index.js +1 -0
- package/dist/badge/badge.d.ts +19 -0
- package/dist/badge/badge.js +22 -0
- package/dist/badge/index.d.ts +2 -0
- package/dist/badge/index.js +1 -0
- package/dist/banner/banner-dismiss.client.d.ts +32 -0
- package/dist/banner/banner-dismiss.client.js +38 -0
- package/dist/banner/banner.d.ts +34 -0
- package/dist/banner/banner.js +47 -0
- package/dist/banner/index.d.ts +3 -0
- package/dist/banner/index.js +3 -0
- package/dist/breadcrumb/breadcrumb.d.ts +46 -0
- package/dist/breadcrumb/breadcrumb.js +46 -0
- package/dist/breadcrumb/breadcrumb.parts.d.ts +6 -0
- package/dist/breadcrumb/breadcrumb.parts.js +9 -0
- package/dist/breadcrumb/index.d.ts +3 -0
- package/dist/breadcrumb/index.js +3 -0
- package/dist/button/button.d.ts +55 -0
- package/dist/button/button.js +62 -0
- package/dist/button/index.d.ts +2 -0
- package/dist/button/index.js +1 -0
- package/dist/card/card.d.ts +64 -0
- package/dist/card/card.js +62 -0
- package/dist/card/card.parts.d.ts +6 -0
- package/dist/card/card.parts.js +14 -0
- package/dist/card/index.d.ts +3 -0
- package/dist/card/index.js +3 -0
- package/dist/checkbox/checkbox.client.d.ts +37 -0
- package/dist/checkbox/checkbox.client.js +81 -0
- package/dist/checkbox/index.d.ts +2 -0
- package/dist/checkbox/index.js +1 -0
- package/dist/chip-group/chip-group.client.d.ts +88 -0
- package/dist/chip-group/chip-group.client.js +157 -0
- package/dist/chip-group/index.d.ts +2 -0
- package/dist/chip-group/index.js +1 -0
- package/dist/choice-card/choice-card.client.d.ts +66 -0
- package/dist/choice-card/choice-card.client.js +138 -0
- package/dist/choice-card/index.d.ts +2 -0
- package/dist/choice-card/index.js +1 -0
- package/dist/config/config.client.d.ts +24 -0
- package/dist/config/config.client.js +33 -0
- package/dist/config/index.d.ts +2 -0
- package/dist/config/index.js +1 -0
- package/dist/container/container.d.ts +13 -0
- package/dist/container/container.js +16 -0
- package/dist/container/index.d.ts +2 -0
- package/dist/container/index.js +1 -0
- package/dist/contracts/details.d.ts +13 -0
- package/dist/contracts/details.js +9 -0
- package/dist/contracts/index.d.ts +5 -0
- package/dist/contracts/index.js +5 -0
- package/dist/contracts/merge-props.d.ts +16 -0
- package/dist/contracts/merge-props.js +76 -0
- package/dist/contracts/render.d.ts +17 -0
- package/dist/contracts/render.js +43 -0
- package/dist/contracts/state.d.ts +42 -0
- package/dist/contracts/state.js +42 -0
- package/dist/css/alert.css +2 -0
- package/dist/css/app-shell.css +2 -0
- package/dist/css/avatar.css +2 -0
- package/dist/css/badge.css +2 -0
- package/dist/css/banner.css +2 -0
- package/dist/css/base.css +2 -0
- package/dist/css/breadcrumb.css +2 -0
- package/dist/css/button.css +2 -0
- package/dist/css/card.css +2 -0
- package/dist/css/checkbox.css +2 -0
- package/dist/css/chip-group.css +2 -0
- package/dist/css/choice-card.css +2 -0
- package/dist/css/container.css +2 -0
- package/dist/css/delta.css +2 -0
- package/dist/css/dialog.css +2 -0
- package/dist/css/drawer.css +2 -0
- package/dist/css/empty-state.css +2 -0
- package/dist/css/field.css +2 -0
- package/dist/css/fieldset.css +2 -0
- package/dist/css/file-upload.css +2 -0
- package/dist/css/form.css +2 -0
- package/dist/css/grid.css +2 -0
- package/dist/css/heading.css +2 -0
- package/dist/css/icon-button.css +2 -0
- package/dist/css/image.css +2 -0
- package/dist/css/inline-error.css +2 -0
- package/dist/css/inline.css +2 -0
- package/dist/css/input.css +2 -0
- package/dist/css/kbd.css +2 -0
- package/dist/css/kpi-tile.css +2 -0
- package/dist/css/menu.css +2 -0
- package/dist/css/meter.css +2 -0
- package/dist/css/metric.css +2 -0
- package/dist/css/mobile-tab-bar.css +2 -0
- package/dist/css/mobile-top-bar.css +2 -0
- package/dist/css/motion.css +2 -0
- package/dist/css/native-select.css +2 -0
- package/dist/css/nav-item.css +2 -0
- package/dist/css/number-value.css +2 -0
- package/dist/css/page-header.css +2 -0
- package/dist/css/pagination.css +2 -0
- package/dist/css/password-input.css +2 -0
- package/dist/css/popover.css +2 -0
- package/dist/css/progress-bar.css +2 -0
- package/dist/css/progress-ring.css +2 -0
- package/dist/css/radio-group.css +2 -0
- package/dist/css/ranked-list.css +2 -0
- package/dist/css/search-field.css +2 -0
- package/dist/css/segmented-control.css +2 -0
- package/dist/css/select.css +2 -0
- package/dist/css/separator.css +2 -0
- package/dist/css/sidebar.css +2 -0
- package/dist/css/skeleton.css +2 -0
- package/dist/css/split.css +2 -0
- package/dist/css/stack.css +2 -0
- package/dist/css/sticky-bar.css +2 -0
- package/dist/css/switch.css +2 -0
- package/dist/css/tab-nav.css +2 -0
- package/dist/css/table-selection.css +2 -0
- package/dist/css/table.css +2 -0
- package/dist/css/tabs.css +2 -0
- package/dist/css/text.css +2 -0
- package/dist/css/textarea.css +2 -0
- package/dist/css/toast.css +2 -0
- package/dist/css/tooltip.css +2 -0
- package/dist/css/top-bar.css +2 -0
- package/dist/css/trend-card.css +2 -0
- package/dist/delta/delta.d.ts +32 -0
- package/dist/delta/delta.js +50 -0
- package/dist/delta/index.d.ts +2 -0
- package/dist/delta/index.js +1 -0
- package/dist/dialog/dialog.client.d.ts +25 -0
- package/dist/dialog/dialog.client.js +145 -0
- package/dist/dialog/dialog.contract.d.ts +97 -0
- package/dist/dialog/dialog.parts.d.ts +6 -0
- package/dist/dialog/dialog.parts.js +15 -0
- package/dist/dialog/index.d.ts +5 -0
- package/dist/dialog/index.js +3 -0
- package/dist/drawer/drawer.client.d.ts +25 -0
- package/dist/drawer/drawer.client.js +154 -0
- package/dist/drawer/drawer.contract.d.ts +98 -0
- package/dist/drawer/drawer.parts.d.ts +6 -0
- package/dist/drawer/drawer.parts.js +16 -0
- package/dist/drawer/index.d.ts +5 -0
- package/dist/drawer/index.js +3 -0
- package/dist/empty-state/empty-state.d.ts +18 -0
- package/dist/empty-state/empty-state.js +32 -0
- package/dist/empty-state/index.d.ts +2 -0
- package/dist/empty-state/index.js +1 -0
- package/dist/field/field-scope.client.d.ts +50 -0
- package/dist/field/field-scope.client.js +212 -0
- package/dist/field/field-static.d.ts +122 -0
- package/dist/field/field-static.js +159 -0
- package/dist/field/field.d.ts +5 -0
- package/dist/field/field.js +53 -0
- package/dist/field/index.d.ts +4 -0
- package/dist/field/index.js +4 -0
- package/dist/fieldset/fieldset.d.ts +36 -0
- package/dist/fieldset/fieldset.js +63 -0
- package/dist/fieldset/index.d.ts +2 -0
- package/dist/fieldset/index.js +1 -0
- package/dist/file-upload/file-upload.client.d.ts +9 -0
- package/dist/file-upload/file-upload.client.js +406 -0
- package/dist/file-upload/file-upload.contract.d.ts +112 -0
- package/dist/file-upload/index.d.ts +3 -0
- package/dist/file-upload/index.js +1 -0
- package/dist/file-upload/seam.d.ts +1 -0
- package/dist/form/form.client.d.ts +38 -0
- package/dist/form/form.client.js +127 -0
- package/dist/form/form.d.ts +36 -0
- package/dist/form/form.js +29 -0
- package/dist/form/index.d.ts +4 -0
- package/dist/form/index.js +4 -0
- package/dist/form/submit-button.client.d.ts +20 -0
- package/dist/form/submit-button.client.js +19 -0
- package/dist/grid/grid.d.ts +38 -0
- package/dist/grid/grid.js +28 -0
- package/dist/grid/index.d.ts +2 -0
- package/dist/grid/index.js +1 -0
- package/dist/heading/heading.d.ts +30 -0
- package/dist/heading/heading.js +26 -0
- package/dist/heading/index.d.ts +2 -0
- package/dist/heading/index.js +1 -0
- package/dist/i18n/format-label.d.ts +24 -0
- package/dist/i18n/format-label.js +19 -0
- package/dist/i18n/index.d.ts +2 -0
- package/dist/i18n/index.js +1 -0
- package/dist/icon-button/icon-button-static.d.ts +23 -0
- package/dist/icon-button/icon-button-static.js +83 -0
- package/dist/icon-button/icon-button.client.js +29 -0
- package/dist/icon-button/icon-button.contract.d.ts +89 -0
- package/dist/icon-button/icon-button.d.ts +5 -0
- package/dist/icon-button/icon-button.js +21 -0
- package/dist/icon-button/index.d.ts +4 -0
- package/dist/icon-button/index.js +3 -0
- package/dist/image/image.d.ts +28 -0
- package/dist/image/image.js +24 -0
- package/dist/image/index.d.ts +2 -0
- package/dist/image/index.js +1 -0
- package/dist/index.d.ts +174 -0
- package/dist/index.js +96 -0
- package/dist/inline/index.d.ts +2 -0
- package/dist/inline/index.js +1 -0
- package/dist/inline/inline.d.ts +16 -0
- package/dist/inline/inline.js +14 -0
- package/dist/inline-error/index.d.ts +2 -0
- package/dist/inline-error/index.js +1 -0
- package/dist/inline-error/inline-error.d.ts +17 -0
- package/dist/inline-error/inline-error.js +33 -0
- package/dist/input/index.d.ts +2 -0
- package/dist/input/index.js +1 -0
- package/dist/input/input.client.d.ts +39 -0
- package/dist/input/input.client.js +82 -0
- package/dist/kbd/index.d.ts +2 -0
- package/dist/kbd/index.js +1 -0
- package/dist/kbd/kbd.d.ts +19 -0
- package/dist/kbd/kbd.js +68 -0
- package/dist/kpi-tile/index.d.ts +2 -0
- package/dist/kpi-tile/index.js +1 -0
- package/dist/kpi-tile/kpi-tile.d.ts +30 -0
- package/dist/kpi-tile/kpi-tile.js +48 -0
- package/dist/locales/en-US.d.ts +77 -0
- package/dist/locales/en-US.js +83 -0
- package/dist/menu/index.d.ts +5 -0
- package/dist/menu/index.js +3 -0
- package/dist/menu/menu.client.d.ts +14 -0
- package/dist/menu/menu.client.js +152 -0
- package/dist/menu/menu.contract.d.ts +152 -0
- package/dist/menu/menu.parts.d.ts +6 -0
- package/dist/menu/menu.parts.js +17 -0
- package/dist/meter/index.d.ts +2 -0
- package/dist/meter/index.js +1 -0
- package/dist/meter/meter.d.ts +43 -0
- package/dist/meter/meter.js +59 -0
- package/dist/metric/index.d.ts +2 -0
- package/dist/metric/index.js +1 -0
- package/dist/metric/metric.d.ts +72 -0
- package/dist/metric/metric.js +116 -0
- package/dist/mobile-tab-bar/index.d.ts +4 -0
- package/dist/mobile-tab-bar/index.js +4 -0
- package/dist/mobile-tab-bar/mobile-tab-bar-inset.client.js +38 -0
- package/dist/mobile-tab-bar/mobile-tab-bar-more.client.d.ts +26 -0
- package/dist/mobile-tab-bar/mobile-tab-bar-more.client.js +60 -0
- package/dist/mobile-tab-bar/mobile-tab-bar.d.ts +39 -0
- package/dist/mobile-tab-bar/mobile-tab-bar.js +54 -0
- package/dist/mobile-tab-bar/mobile-tab-bar.parts.d.ts +6 -0
- package/dist/mobile-tab-bar/mobile-tab-bar.parts.js +9 -0
- package/dist/mobile-top-bar/index.d.ts +2 -0
- package/dist/mobile-top-bar/index.js +1 -0
- package/dist/mobile-top-bar/mobile-top-bar.d.ts +17 -0
- package/dist/mobile-top-bar/mobile-top-bar.js +31 -0
- package/dist/motion/count-up.client.d.ts +39 -0
- package/dist/motion/count-up.client.js +109 -0
- package/dist/motion/index.d.ts +2 -0
- package/dist/motion/index.js +1 -0
- package/dist/native-select/index.d.ts +2 -0
- package/dist/native-select/index.js +1 -0
- package/dist/native-select/native-select.d.ts +43 -0
- package/dist/native-select/native-select.js +56 -0
- package/dist/nav-item/index.d.ts +2 -0
- package/dist/nav-item/index.js +1 -0
- package/dist/nav-item/nav-item.d.ts +35 -0
- package/dist/nav-item/nav-item.js +50 -0
- package/dist/number-value/index.d.ts +2 -0
- package/dist/number-value/index.js +1 -0
- package/dist/number-value/number-value.d.ts +25 -0
- package/dist/number-value/number-value.js +26 -0
- package/dist/page-header/index.d.ts +2 -0
- package/dist/page-header/index.js +1 -0
- package/dist/page-header/page-header.d.ts +19 -0
- package/dist/page-header/page-header.js +39 -0
- package/dist/pagination/index.d.ts +2 -0
- package/dist/pagination/index.js +1 -0
- package/dist/pagination/pagination.d.ts +74 -0
- package/dist/pagination/pagination.js +136 -0
- package/dist/password-input/index.d.ts +2 -0
- package/dist/password-input/index.js +1 -0
- package/dist/password-input/password-input.client.d.ts +52 -0
- package/dist/password-input/password-input.client.js +106 -0
- package/dist/popover/index.d.ts +5 -0
- package/dist/popover/index.js +3 -0
- package/dist/popover/popover.client.d.ts +20 -0
- package/dist/popover/popover.client.js +113 -0
- package/dist/popover/popover.contract.d.ts +88 -0
- package/dist/popover/popover.parts.d.ts +6 -0
- package/dist/popover/popover.parts.js +13 -0
- package/dist/progress-bar/index.d.ts +2 -0
- package/dist/progress-bar/index.js +1 -0
- package/dist/progress-bar/progress-bar.d.ts +34 -0
- package/dist/progress-bar/progress-bar.js +55 -0
- package/dist/progress-ring/index.d.ts +2 -0
- package/dist/progress-ring/index.js +1 -0
- package/dist/progress-ring/progress-ring.d.ts +38 -0
- package/dist/progress-ring/progress-ring.js +67 -0
- package/dist/radio-group/index.d.ts +3 -0
- package/dist/radio-group/index.js +3 -0
- package/dist/radio-group/radio-group.client.d.ts +22 -0
- package/dist/radio-group/radio-group.client.js +70 -0
- package/dist/radio-group/radio-group.d.ts +28 -0
- package/dist/radio-group/radio-group.js +35 -0
- package/dist/ranked-list/index.d.ts +3 -0
- package/dist/ranked-list/index.js +3 -0
- package/dist/ranked-list/ranked-list.d.ts +85 -0
- package/dist/ranked-list/ranked-list.js +153 -0
- package/dist/ranked-list/ranked-list.parts.d.ts +6 -0
- package/dist/ranked-list/ranked-list.parts.js +10 -0
- package/dist/search-field/index.d.ts +2 -0
- package/dist/search-field/index.js +1 -0
- package/dist/search-field/search-field.client.d.ts +55 -0
- package/dist/search-field/search-field.client.js +136 -0
- package/dist/segmented-control/index.d.ts +3 -0
- package/dist/segmented-control/index.js +3 -0
- package/dist/segmented-control/segmented-control.client.d.ts +61 -0
- package/dist/segmented-control/segmented-control.client.js +156 -0
- package/dist/segmented-control/segmented-control.parts.d.ts +6 -0
- package/dist/segmented-control/segmented-control.parts.js +9 -0
- package/dist/select/index.d.ts +5 -0
- package/dist/select/index.js +3 -0
- package/dist/select/select.client.d.ts +12 -0
- package/dist/select/select.client.js +152 -0
- package/dist/select/select.contract.d.ts +119 -0
- package/dist/select/select.parts.d.ts +6 -0
- package/dist/select/select.parts.js +15 -0
- package/dist/separator/index.d.ts +2 -0
- package/dist/separator/index.js +1 -0
- package/dist/separator/separator.d.ts +26 -0
- package/dist/separator/separator.js +23 -0
- package/dist/sidebar/index.d.ts +4 -0
- package/dist/sidebar/index.js +4 -0
- package/dist/sidebar/sidebar-item.client.d.ts +10 -0
- package/dist/sidebar/sidebar-item.client.js +55 -0
- package/dist/sidebar/sidebar.d.ts +45 -0
- package/dist/sidebar/sidebar.js +62 -0
- package/dist/sidebar/sidebar.parts.d.ts +6 -0
- package/dist/sidebar/sidebar.parts.js +11 -0
- package/dist/skeleton/index.d.ts +2 -0
- package/dist/skeleton/index.js +1 -0
- package/dist/skeleton/skeleton.d.ts +20 -0
- package/dist/skeleton/skeleton.js +19 -0
- package/dist/split/index.d.ts +3 -0
- package/dist/split/index.js +3 -0
- package/dist/split/split.d.ts +28 -0
- package/dist/split/split.js +33 -0
- package/dist/split/split.parts.d.ts +6 -0
- package/dist/split/split.parts.js +10 -0
- package/dist/stack/index.d.ts +2 -0
- package/dist/stack/index.js +1 -0
- package/dist/stack/stack.d.ts +17 -0
- package/dist/stack/stack.js +14 -0
- package/dist/sticky-bar/index.d.ts +2 -0
- package/dist/sticky-bar/index.js +1 -0
- package/dist/sticky-bar/sticky-bar.d.ts +16 -0
- package/dist/sticky-bar/sticky-bar.js +26 -0
- package/dist/styles.css +595 -0
- package/dist/switch/index.d.ts +2 -0
- package/dist/switch/index.js +1 -0
- package/dist/switch/switch.client.d.ts +33 -0
- package/dist/switch/switch.client.js +63 -0
- package/dist/tab-nav/index.d.ts +3 -0
- package/dist/tab-nav/index.js +3 -0
- package/dist/tab-nav/tab-nav.d.ts +36 -0
- package/dist/tab-nav/tab-nav.js +47 -0
- package/dist/tab-nav/tab-nav.parts.d.ts +6 -0
- package/dist/tab-nav/tab-nav.parts.js +9 -0
- package/dist/table/index.d.ts +3 -0
- package/dist/table/index.js +3 -0
- package/dist/table/table.d.ts +101 -0
- package/dist/table/table.js +121 -0
- package/dist/table/table.parts.d.ts +6 -0
- package/dist/table/table.parts.js +18 -0
- package/dist/table-selection/index.d.ts +3 -0
- package/dist/table-selection/index.js +3 -0
- package/dist/table-selection/table-selection.client.d.ts +14 -0
- package/dist/table-selection/table-selection.client.js +84 -0
- package/dist/table-selection/table-selection.d.ts +34 -0
- package/dist/table-selection/table-selection.js +50 -0
- package/dist/tabs/index.d.ts +4 -0
- package/dist/tabs/index.js +3 -0
- package/dist/tabs/tabs.client.d.ts +8 -0
- package/dist/tabs/tabs.client.js +68 -0
- package/dist/tabs/tabs.contract.d.ts +89 -0
- package/dist/tabs/tabs.parts.d.ts +6 -0
- package/dist/tabs/tabs.parts.js +11 -0
- package/dist/text/index.d.ts +2 -0
- package/dist/text/index.js +1 -0
- package/dist/text/text.d.ts +32 -0
- package/dist/text/text.js +17 -0
- package/dist/textarea/index.d.ts +2 -0
- package/dist/textarea/index.js +1 -0
- package/dist/textarea/textarea.client.d.ts +18 -0
- package/dist/textarea/textarea.client.js +31 -0
- package/dist/theme-script/index.d.ts +2 -0
- package/dist/theme-script/index.js +1 -0
- package/dist/theme-script/theme-script.d.ts +43 -0
- package/dist/theme-script/theme-script.js +46 -0
- package/dist/toast/index.d.ts +4 -0
- package/dist/toast/index.js +3 -0
- package/dist/toast/seam.d.ts +2 -0
- package/dist/toast/store.d.ts +19 -0
- package/dist/toast/store.js +136 -0
- package/dist/toast/toast.contract.d.ts +56 -0
- package/dist/toast/toaster.client.d.ts +10 -0
- package/dist/toast/toaster.client.js +305 -0
- package/dist/tooltip/index.d.ts +5 -0
- package/dist/tooltip/index.js +3 -0
- package/dist/tooltip/tooltip.client.d.ts +12 -0
- package/dist/tooltip/tooltip.client.js +51 -0
- package/dist/tooltip/tooltip.contract.d.ts +60 -0
- package/dist/tooltip/tooltip.parts.d.ts +6 -0
- package/dist/tooltip/tooltip.parts.js +10 -0
- package/dist/top-bar/index.d.ts +2 -0
- package/dist/top-bar/index.js +1 -0
- package/dist/top-bar/top-bar.d.ts +17 -0
- package/dist/top-bar/top-bar.js +35 -0
- package/dist/trend-card/index.d.ts +2 -0
- package/dist/trend-card/index.js +1 -0
- package/dist/trend-card/trend-card.d.ts +34 -0
- package/dist/trend-card/trend-card.js +74 -0
- package/package.json +447 -3
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { use, useEffect, useLayoutEffect, useRef, useState } from "react";
|
|
3
|
+
import { OverlayTriggerStateContext, PopoverContext } from "react-aria-components";
|
|
4
|
+
//#region src/_engines/react-aria/popup.client.tsx
|
|
5
|
+
const TABBABLE = "a[href], area[href], button, input, select, textarea, iframe, summary, [tabindex], [contenteditable]:not([contenteditable=\"false\"])";
|
|
6
|
+
/**
|
|
7
|
+
* The tabbable element after (or before) `from` in its dialog, else in the document, skipping `skip`
|
|
8
|
+
* (the popup itself). `inert` is not checked: the engine marks the page inert while the popup is
|
|
9
|
+
* open, and lifts it as the popup closes.
|
|
10
|
+
*/
|
|
11
|
+
function adjacentTabbable(from, backwards, skip) {
|
|
12
|
+
const root = from.closest("[role=\"dialog\"], [role=\"alertdialog\"], dialog") ?? from.ownerDocument;
|
|
13
|
+
const order = backwards ? Node.DOCUMENT_POSITION_PRECEDING : Node.DOCUMENT_POSITION_FOLLOWING;
|
|
14
|
+
const candidates = [...root.querySelectorAll(TABBABLE)].filter((element) => element.tabIndex >= 0 && !element.matches(":disabled") && (skip === null || !skip.contains(element)) && !from.contains(element) && (from.compareDocumentPosition(element) & order) !== 0 && element.getClientRects().length > 0);
|
|
15
|
+
return backwards ? candidates.at(-1) : candidates[0];
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Tab and Shift+Tab out of a menu or listbox popup (§12.2 Dismiss stack; APG menu button): the popup
|
|
19
|
+
* closes and focus moves to the element after (or before) its trigger. React Aria 1.22.1 keeps Tab
|
|
20
|
+
* inside its modal popovers, so the adapter handles the key on the popup's list element.
|
|
21
|
+
*/
|
|
22
|
+
function useTabOut(popup) {
|
|
23
|
+
const state = use(OverlayTriggerStateContext);
|
|
24
|
+
const context = use(PopoverContext);
|
|
25
|
+
const trigger = typeof context === "object" && context !== null && "triggerRef" in context ? context.triggerRef : void 0;
|
|
26
|
+
return (event) => {
|
|
27
|
+
if (event.key !== "Tab" || event.altKey || event.ctrlKey || event.metaKey) return;
|
|
28
|
+
const from = typeof trigger === "object" && trigger !== null && "current" in trigger ? trigger.current : void 0;
|
|
29
|
+
if (state === null || !(from instanceof HTMLElement)) return;
|
|
30
|
+
event.preventDefault();
|
|
31
|
+
event.stopPropagation();
|
|
32
|
+
const target = adjacentTabbable(from, event.shiftKey, popup.current) ?? from;
|
|
33
|
+
state.close();
|
|
34
|
+
requestAnimationFrame(() => target.focus());
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
function isElementRef(value) {
|
|
38
|
+
return typeof value === "object" && value !== null && "current" in value && (value.current === null || value.current instanceof HTMLElement);
|
|
39
|
+
}
|
|
40
|
+
/** The enclosing MenuTrigger's, Select's or DialogTrigger's trigger, from the engine's PopoverContext. */
|
|
41
|
+
function useTriggerRef() {
|
|
42
|
+
const context = use(PopoverContext);
|
|
43
|
+
const ref = typeof context === "object" && context !== null && "triggerRef" in context ? context.triggerRef : void 0;
|
|
44
|
+
return isElementRef(ref) ? ref : void 0;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Popups the family closed itself on an outside press (outside-press.client.tsx). The press lands on
|
|
48
|
+
* the popup's underlay, so no control took focus, but a modal parent's FocusScope moves focus to its
|
|
49
|
+
* first control as the popup's content leaves (React Aria's containment fallback), before any
|
|
50
|
+
* restore: the chain runs for these even though focus is no longer on <body> (O-12).
|
|
51
|
+
*/
|
|
52
|
+
const CLOSED_OUTSIDE = /* @__PURE__ */ new WeakSet();
|
|
53
|
+
/** Marks `popup` as closed by the family's outside press, for ReturnFocus. */
|
|
54
|
+
function returnAfterClose(popup) {
|
|
55
|
+
CLOSED_OUTSIDE.add(popup);
|
|
56
|
+
}
|
|
57
|
+
/** The family's open popups and their triggers: the parent-overlay step below. */
|
|
58
|
+
const OPEN = /* @__PURE__ */ new Map();
|
|
59
|
+
/**
|
|
60
|
+
* React Aria's FocusScope dispatches this cancelable event on the element it is about to focus when a
|
|
61
|
+
* scope unmounts with focus lost to <body> (react-aria 3.53.1, FocusScope `restoreFocusToElement`); a
|
|
62
|
+
* prevented event leaves focus alone. It is how `returnFocus` overrides the engine's choice.
|
|
63
|
+
*/
|
|
64
|
+
const ENGINE_RESTORE = "react-aria-focus-scope-restore";
|
|
65
|
+
/** A focus target: on the page, and not <body> (where focus is when nothing has it). */
|
|
66
|
+
const usable = (element) => element instanceof HTMLElement && element.isConnected && element !== element.ownerDocument.body;
|
|
67
|
+
/** Whether the popup is still in the DOM: Strict Mode's mount-time replay of the effect. */
|
|
68
|
+
const mounted = (popup) => popup.current?.isConnected === true;
|
|
69
|
+
/** The element a `returnFocus` ref or function names, if any. */
|
|
70
|
+
const named = (target) => typeof target === "function" ? target() : typeof target === "object" ? target.current : null;
|
|
71
|
+
/**
|
|
72
|
+
* Focus return (§12.2): `returnFocus` (`true`, an element ref, a function returning one, or `false`)
|
|
73
|
+
* → the original trigger if still connected → the element that had focus as the popup opened → the
|
|
74
|
+
* parent overlay's trigger (a Dialog opened from a Menu item returns to the Menu button) → <body>,
|
|
75
|
+
* with a development warning. Rendered inside every modal popup of the family (Dialog, Menu,
|
|
76
|
+
* Select).
|
|
77
|
+
*
|
|
78
|
+
* React Aria returns focus to the element that had it when the popup opened, which covers the
|
|
79
|
+
* common case; this completes the chain where it has nowhere to go: a popup open on the server
|
|
80
|
+
* (`defaultOpen`) or opened from code with nothing focused, and a Dialog opened from an item of a
|
|
81
|
+
* Menu that had no focus origin of its own loses its opener with the Menu. Each popup registers
|
|
82
|
+
* itself while open, so one opened from inside another records that one's trigger as its parent
|
|
83
|
+
* step. It never moves focus that went somewhere (an outside click on a control, Tab out of a
|
|
84
|
+
* menu).
|
|
85
|
+
*/
|
|
86
|
+
function ReturnFocus({ trigger, popup, target = true }) {
|
|
87
|
+
const [origin] = useState(() => {
|
|
88
|
+
const opener = globalThis.document?.activeElement;
|
|
89
|
+
let parent;
|
|
90
|
+
for (const [open, openTrigger] of OPEN) if (opener != null && open.current?.contains(opener)) parent = openTrigger?.current;
|
|
91
|
+
return [opener, parent];
|
|
92
|
+
});
|
|
93
|
+
const latest = useRef(target);
|
|
94
|
+
useLayoutEffect(() => {
|
|
95
|
+
latest.current = target;
|
|
96
|
+
});
|
|
97
|
+
const shown = useRef(false);
|
|
98
|
+
useEffect(() => {
|
|
99
|
+
if (mounted(popup)) shown.current = true;
|
|
100
|
+
});
|
|
101
|
+
useLayoutEffect(() => {
|
|
102
|
+
const element = trigger?.current;
|
|
103
|
+
OPEN.set(popup, trigger);
|
|
104
|
+
return () => {
|
|
105
|
+
OPEN.delete(popup);
|
|
106
|
+
const doc = document;
|
|
107
|
+
let handled = false;
|
|
108
|
+
const onRestore = (event) => {
|
|
109
|
+
const own = latest.current;
|
|
110
|
+
const to = own === false ? void 0 : [named(own), element].find(usable);
|
|
111
|
+
if (event.defaultPrevented || mounted(popup) || own !== false && to === void 0) return;
|
|
112
|
+
event.preventDefault();
|
|
113
|
+
handled = true;
|
|
114
|
+
to?.focus();
|
|
115
|
+
};
|
|
116
|
+
doc.addEventListener(ENGINE_RESTORE, onRestore, true);
|
|
117
|
+
requestAnimationFrame(() => {
|
|
118
|
+
doc.removeEventListener(ENGINE_RESTORE, onRestore, true);
|
|
119
|
+
const own = latest.current;
|
|
120
|
+
const outside = CLOSED_OUTSIDE.delete(popup);
|
|
121
|
+
if (handled || !shown.current || own === false || mounted(popup) || (doc.activeElement ?? doc.body) !== doc.body && !outside) return;
|
|
122
|
+
const next = [
|
|
123
|
+
named(own),
|
|
124
|
+
element,
|
|
125
|
+
...origin
|
|
126
|
+
].find(usable);
|
|
127
|
+
if (next) next.focus();
|
|
128
|
+
else if (process.env.NODE_ENV !== "production") console.warn("Nizivo: an overlay closed and focus had nowhere to return (its trigger, the element that opened it and its parent overlay are gone), so it is on <body>. Pass `returnFocus` an element that stays on the page.");
|
|
129
|
+
});
|
|
130
|
+
};
|
|
131
|
+
}, [
|
|
132
|
+
trigger,
|
|
133
|
+
popup,
|
|
134
|
+
origin
|
|
135
|
+
]);
|
|
136
|
+
return null;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Moves focus to the leaf's initial-focus element (§12.2 Focus on open; Dialog, Drawer, Popover). A
|
|
140
|
+
* child of the content element, so its effect runs before React Aria's own focus-the-dialog effect (a
|
|
141
|
+
* parent's), which then sees focus inside and leaves it; and after FocusScope recorded the trigger to
|
|
142
|
+
* return focus to.
|
|
143
|
+
*/
|
|
144
|
+
function InitialFocus({ content, resolve }) {
|
|
145
|
+
useEffect(() => {
|
|
146
|
+
const element = content.current;
|
|
147
|
+
if (element === null || element.contains(element.ownerDocument.activeElement)) return;
|
|
148
|
+
resolve(element)?.focus();
|
|
149
|
+
}, [content, resolve]);
|
|
150
|
+
return null;
|
|
151
|
+
}
|
|
152
|
+
//#endregion
|
|
153
|
+
export { InitialFocus, ReturnFocus, returnAfterClose, useTabOut, useTriggerRef };
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { mergeProps } from "../../contracts/merge-props.js";
|
|
3
|
+
import { details } from "../../contracts/details.js";
|
|
4
|
+
import { stateAttrs } from "../../contracts/state.js";
|
|
5
|
+
import { defined, engineDom } from "./dom.js";
|
|
6
|
+
import { EngineLocale } from "./locale.client.js";
|
|
7
|
+
import { popupStyle, resolveSide, toPlacement } from "./overlay.client.js";
|
|
8
|
+
import { PopupKey, useOpenState } from "./open-state.client.js";
|
|
9
|
+
import { ReturnFocus, useTabOut, useTriggerRef } from "./popup.client.js";
|
|
10
|
+
import { OutsidePress } from "./outside-press.client.js";
|
|
11
|
+
import { createElement, use, useEffect, useLayoutEffect, useRef } from "react";
|
|
12
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { Button, Header, ListBox, ListBoxItem, ListBoxSection, Popover, Select, SelectStateContext, SelectValue, Separator, useLocale } from "react-aria-components";
|
|
14
|
+
//#region src/_engines/react-aria/select.client.tsx
|
|
15
|
+
/**
|
|
16
|
+
* React Aria 1.22.1 resets the state on the form's `reset`, then the browser resets the hidden native
|
|
17
|
+
* <select> to its empty first option, and React never writes the value back (its prop did not
|
|
18
|
+
* change after the reset): the trigger showed the default while FormData had ''. After the browser's
|
|
19
|
+
* reset, the hidden <select> takes the state's value again.
|
|
20
|
+
*/
|
|
21
|
+
function FormReset({ root }) {
|
|
22
|
+
const value = use(SelectStateContext)?.value;
|
|
23
|
+
const latest = useRef(value);
|
|
24
|
+
useLayoutEffect(() => {
|
|
25
|
+
latest.current = value;
|
|
26
|
+
});
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
const select = root.current?.querySelector("select");
|
|
29
|
+
const form = select?.form;
|
|
30
|
+
const onReset = () => {
|
|
31
|
+
setTimeout(() => {
|
|
32
|
+
if (select) select.value = String(latest.current ?? "");
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
form?.addEventListener("reset", onReset);
|
|
36
|
+
return () => form?.removeEventListener("reset", onReset);
|
|
37
|
+
}, [root]);
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
const Root = ({ value, defaultValue, onValueChange, open, defaultOpen, onOpenChange, name, required, disabled, invalid, placeholder, "aria-label": label, "aria-labelledby": labelledBy, render, children, ...dom }) => {
|
|
41
|
+
const root = useRef(null);
|
|
42
|
+
const [isOpen, setOpen, popupKey] = useOpenState(open, defaultOpen, onOpenChange);
|
|
43
|
+
return /* @__PURE__ */ jsx(EngineLocale, { children: /* @__PURE__ */ jsxs(Select, {
|
|
44
|
+
...defined({
|
|
45
|
+
value,
|
|
46
|
+
defaultValue,
|
|
47
|
+
name,
|
|
48
|
+
isRequired: required,
|
|
49
|
+
isDisabled: disabled,
|
|
50
|
+
isInvalid: invalid,
|
|
51
|
+
placeholder,
|
|
52
|
+
"aria-label": label,
|
|
53
|
+
"aria-labelledby": labelledBy
|
|
54
|
+
}),
|
|
55
|
+
isOpen,
|
|
56
|
+
onOpenChange: setOpen,
|
|
57
|
+
onChange: (key) => onValueChange?.(key == null ? null : String(key), details("unknown")),
|
|
58
|
+
validationBehavior: "native",
|
|
59
|
+
render: (p, rp) => {
|
|
60
|
+
const s = {
|
|
61
|
+
open: rp.isOpen,
|
|
62
|
+
disabled: rp.isDisabled
|
|
63
|
+
};
|
|
64
|
+
const attrs = stateAttrs({
|
|
65
|
+
...s,
|
|
66
|
+
required: rp.isRequired,
|
|
67
|
+
invalid
|
|
68
|
+
});
|
|
69
|
+
return render(mergeProps(engineDom(p), dom, attrs, { ref: root }), s);
|
|
70
|
+
},
|
|
71
|
+
children: [/* @__PURE__ */ jsx(PopupKey, {
|
|
72
|
+
value: popupKey,
|
|
73
|
+
children
|
|
74
|
+
}), /* @__PURE__ */ jsx(FormReset, { root })]
|
|
75
|
+
}) });
|
|
76
|
+
};
|
|
77
|
+
const Trigger = ({ id, "aria-label": label, "aria-describedby": describedBy, render, children, ...dom }) => {
|
|
78
|
+
const open = use(SelectStateContext)?.isOpen ?? false;
|
|
79
|
+
return /* @__PURE__ */ jsx(Button, {
|
|
80
|
+
...defined({
|
|
81
|
+
id,
|
|
82
|
+
"aria-label": label,
|
|
83
|
+
"aria-describedby": describedBy
|
|
84
|
+
}),
|
|
85
|
+
render: (p, rp) => {
|
|
86
|
+
const s = {
|
|
87
|
+
open,
|
|
88
|
+
pressed: rp.isPressed && !open,
|
|
89
|
+
focusVisible: rp.isFocusVisible,
|
|
90
|
+
disabled: rp.isDisabled
|
|
91
|
+
};
|
|
92
|
+
return render(mergeProps(engineDom(p), dom, stateAttrs(s)), s);
|
|
93
|
+
},
|
|
94
|
+
children
|
|
95
|
+
});
|
|
96
|
+
};
|
|
97
|
+
const Value = ({ render, children, ...dom }) => /* @__PURE__ */ jsx(SelectValue, {
|
|
98
|
+
render: (p, rp) => {
|
|
99
|
+
const s = { placeholder: rp.isPlaceholder };
|
|
100
|
+
return render(mergeProps(engineDom(p), dom, stateAttrs(s)), s);
|
|
101
|
+
},
|
|
102
|
+
children
|
|
103
|
+
});
|
|
104
|
+
const Popup = ({ side, align, sideOffset, container, list, render, children, ...dom }) => {
|
|
105
|
+
const { direction } = useLocale();
|
|
106
|
+
const popup = useRef(null);
|
|
107
|
+
const tabOut = useTabOut(popup);
|
|
108
|
+
const trigger = useTriggerRef();
|
|
109
|
+
const key = use(PopupKey);
|
|
110
|
+
return /* @__PURE__ */ jsxs(Popover, {
|
|
111
|
+
placement: toPlacement(side, align),
|
|
112
|
+
offset: sideOffset,
|
|
113
|
+
...defined({ UNSTABLE_portalContainer: container ?? void 0 }),
|
|
114
|
+
render: (p, rp) => {
|
|
115
|
+
const s = {
|
|
116
|
+
entering: rp.isEntering,
|
|
117
|
+
exiting: rp.isExiting,
|
|
118
|
+
side: resolveSide(rp.placement, side, direction)
|
|
119
|
+
};
|
|
120
|
+
const engine = {
|
|
121
|
+
...engineDom(p),
|
|
122
|
+
style: popupStyle(p.style)
|
|
123
|
+
};
|
|
124
|
+
const attrs = stateAttrs({
|
|
125
|
+
open: !rp.isExiting,
|
|
126
|
+
...s,
|
|
127
|
+
align
|
|
128
|
+
});
|
|
129
|
+
return render(mergeProps(engine, dom, attrs, { ref: popup }), s);
|
|
130
|
+
},
|
|
131
|
+
children: [
|
|
132
|
+
/* @__PURE__ */ jsx(ReturnFocus, {
|
|
133
|
+
trigger,
|
|
134
|
+
popup
|
|
135
|
+
}),
|
|
136
|
+
/* @__PURE__ */ jsx(OutsidePress, { popup }),
|
|
137
|
+
/* @__PURE__ */ jsx(ListBox, {
|
|
138
|
+
render: (p) => createElement("div", mergeProps(engineDom(p), list, { onKeyDown: tabOut })),
|
|
139
|
+
children
|
|
140
|
+
})
|
|
141
|
+
]
|
|
142
|
+
}, key);
|
|
143
|
+
};
|
|
144
|
+
const Item = ({ value, textValue, disabled, render, children, ...dom }) => /* @__PURE__ */ jsx(ListBoxItem, {
|
|
145
|
+
id: value,
|
|
146
|
+
...defined({
|
|
147
|
+
textValue,
|
|
148
|
+
isDisabled: disabled
|
|
149
|
+
}),
|
|
150
|
+
render: (p, rp) => {
|
|
151
|
+
const s = {
|
|
152
|
+
highlighted: rp.isFocused,
|
|
153
|
+
selected: rp.isSelected,
|
|
154
|
+
disabled: rp.isDisabled,
|
|
155
|
+
focusVisible: rp.isFocusVisible
|
|
156
|
+
};
|
|
157
|
+
return render(mergeProps(engineDom(p), dom, stateAttrs(s)), s);
|
|
158
|
+
},
|
|
159
|
+
children
|
|
160
|
+
});
|
|
161
|
+
const Group = ({ render, children, ...dom }) => /* @__PURE__ */ jsx(ListBoxSection, {
|
|
162
|
+
render: (p) => render(mergeProps(engineDom(p), dom), {}),
|
|
163
|
+
children
|
|
164
|
+
});
|
|
165
|
+
const GroupLabel = ({ render, children, ...dom }) => /* @__PURE__ */ jsx(Header, {
|
|
166
|
+
render: (p) => render(mergeProps(engineDom(p), dom), {}),
|
|
167
|
+
children
|
|
168
|
+
});
|
|
169
|
+
/** ARIA allows only option and group inside a listbox (axe aria-required-children), so the rule is
|
|
170
|
+
* presentational: React Aria's role="separator" and its orientation are dropped. */
|
|
171
|
+
function presentational(props) {
|
|
172
|
+
const { role: _role, "aria-orientation": _orientation, ...rest } = engineDom(props);
|
|
173
|
+
return {
|
|
174
|
+
...rest,
|
|
175
|
+
role: "presentation"
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
const Separator$1 = ({ render, ...dom }) => /* @__PURE__ */ jsx(Separator, { render: (p) => render(mergeProps(presentational(p), dom), {}) });
|
|
179
|
+
//#endregion
|
|
180
|
+
export { Group, GroupLabel, Item, Popup, Root, Separator$1 as Separator, Trigger, Value };
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { mergeProps } from "../../contracts/merge-props.js";
|
|
3
|
+
import { details } from "../../contracts/details.js";
|
|
4
|
+
import { stateAttrs } from "../../contracts/state.js";
|
|
5
|
+
import { defined, engineDom } from "./dom.js";
|
|
6
|
+
import { EngineLocale } from "./locale.client.js";
|
|
7
|
+
import { createContext, use } from "react";
|
|
8
|
+
import { jsx } from "react/jsx-runtime";
|
|
9
|
+
import { I18nProvider, Tab, TabList, TabPanel, Tabs, useLocale } from "react-aria-components";
|
|
10
|
+
//#region src/_engines/react-aria/tabs.client.tsx
|
|
11
|
+
/**
|
|
12
|
+
* The nearest Tabs root's `dir`, for its list. A root without `dir` inherits it, so a strip nested in
|
|
13
|
+
* the panel of a `dir` root keys the way CSS lays it out (the attribute is inherited). Unset at every
|
|
14
|
+
* level: the direction of the locale (EngineLocale).
|
|
15
|
+
*/
|
|
16
|
+
const Dir = createContext(void 0);
|
|
17
|
+
/**
|
|
18
|
+
* The arrows' direction (M26). React Aria has one direction input, the locale `I18nProvider` is
|
|
19
|
+
* given, and only the tab list reads it (`useTabList` and `useSelectableCollection`, for the
|
|
20
|
+
* arrows). So the list alone gets a locale whose direction is `dir`: the scope's locale when it
|
|
21
|
+
* already has that direction (every render without `dir` is unchanged), else `ar` or `en`. Nothing
|
|
22
|
+
* in the list formats, collates or speaks a string (the tabs delegate has no type-ahead), and each
|
|
23
|
+
* tab's content gets the scope's locale back (`Tab`), so that locale only carries the direction to
|
|
24
|
+
* the list's own hooks. A script subtag (`en-Arab-US`) would keep the language, but
|
|
25
|
+
* WebKit 27.2 derives `Intl.Locale` text direction from the language only and reads it as `ltr`.
|
|
26
|
+
* The provider is always rendered, so changing `dir` never remounts the list and drops focus.
|
|
27
|
+
*/
|
|
28
|
+
function Directed({ children }) {
|
|
29
|
+
const dir = use(Dir);
|
|
30
|
+
const { locale, direction } = useLocale();
|
|
31
|
+
return /* @__PURE__ */ jsx(I18nProvider, {
|
|
32
|
+
locale: dir === void 0 || dir === direction ? locale : dir === "rtl" ? "ar" : "en",
|
|
33
|
+
children
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
const Root = ({ value, defaultValue, onValueChange, activationMode, disabled, render, children, ...dom }) => {
|
|
37
|
+
const inherited = use(Dir);
|
|
38
|
+
return /* @__PURE__ */ jsx(EngineLocale, { children: /* @__PURE__ */ jsx(Dir, {
|
|
39
|
+
value: dom.dir ?? inherited,
|
|
40
|
+
children: /* @__PURE__ */ jsx(Tabs, {
|
|
41
|
+
...defined({
|
|
42
|
+
selectedKey: value,
|
|
43
|
+
defaultSelectedKey: defaultValue,
|
|
44
|
+
isDisabled: disabled
|
|
45
|
+
}),
|
|
46
|
+
keyboardActivation: activationMode,
|
|
47
|
+
onSelectionChange: (key) => onValueChange?.(String(key), details("unknown")),
|
|
48
|
+
render: (p) => {
|
|
49
|
+
const s = { disabled: disabled === true };
|
|
50
|
+
return render(mergeProps(engineDom(p), dom, stateAttrs(s)), s);
|
|
51
|
+
},
|
|
52
|
+
children
|
|
53
|
+
})
|
|
54
|
+
}) });
|
|
55
|
+
};
|
|
56
|
+
const List = ({ "aria-label": label, "aria-labelledby": labelledBy, "aria-describedby": describedBy, render, children, ...dom }) => /* @__PURE__ */ jsx(Directed, { children: /* @__PURE__ */ jsx(TabList, {
|
|
57
|
+
...defined({
|
|
58
|
+
"aria-label": label,
|
|
59
|
+
"aria-labelledby": labelledBy,
|
|
60
|
+
"aria-describedby": describedBy
|
|
61
|
+
}),
|
|
62
|
+
render: (p, rp) => {
|
|
63
|
+
const s = { disabled: rp.state.isDisabled };
|
|
64
|
+
return render(mergeProps(engineDom(p), dom, stateAttrs(s)), s);
|
|
65
|
+
},
|
|
66
|
+
children
|
|
67
|
+
}) });
|
|
68
|
+
const Tab$1 = ({ value, disabled, render, children, ...dom }) => /* @__PURE__ */ jsx(Tab, {
|
|
69
|
+
id: value,
|
|
70
|
+
...defined({ isDisabled: disabled }),
|
|
71
|
+
render: (p, rp) => {
|
|
72
|
+
const s = {
|
|
73
|
+
selected: rp.isSelected,
|
|
74
|
+
disabled: rp.isDisabled,
|
|
75
|
+
focusVisible: rp.isFocusVisible
|
|
76
|
+
};
|
|
77
|
+
return render(mergeProps(engineDom(p), dom, stateAttrs(s)), s);
|
|
78
|
+
},
|
|
79
|
+
children: /* @__PURE__ */ jsx(EngineLocale, { children })
|
|
80
|
+
});
|
|
81
|
+
const Panel = ({ value, keepMounted, render, children, ...dom }) => /* @__PURE__ */ jsx(TabPanel, {
|
|
82
|
+
id: value,
|
|
83
|
+
shouldForceMount: keepMounted,
|
|
84
|
+
render: (p, rp) => {
|
|
85
|
+
const s = {
|
|
86
|
+
selected: !rp.isInert,
|
|
87
|
+
focusVisible: rp.isFocusVisible
|
|
88
|
+
};
|
|
89
|
+
const hidden = rp.isInert ? { hidden: true } : void 0;
|
|
90
|
+
return render(mergeProps(engineDom(p), dom, hidden, stateAttrs({ focusVisible: s.focusVisible })), s);
|
|
91
|
+
},
|
|
92
|
+
children
|
|
93
|
+
});
|
|
94
|
+
//#endregion
|
|
95
|
+
export { List, Panel, Root, Tab$1 as Tab };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { markTopLayer } from "./overlay.client.js";
|
|
3
|
+
import { useToast, useToastRegion } from "react-aria/useToast";
|
|
4
|
+
//#region src/_engines/react-aria/toast.client.tsx
|
|
5
|
+
/** The ToastState the hooks read, over the store: React Aria never adds a toast here. */
|
|
6
|
+
function state(options) {
|
|
7
|
+
return {
|
|
8
|
+
visibleToasts: options.toasts.map((toast) => ({
|
|
9
|
+
key: toast.id,
|
|
10
|
+
content: toast
|
|
11
|
+
})),
|
|
12
|
+
add: () => "",
|
|
13
|
+
close: options.close,
|
|
14
|
+
pauseAll: options.pause,
|
|
15
|
+
resumeAll: options.resume
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
function useRegion(options, ref) {
|
|
19
|
+
const { regionProps } = useToastRegion({ "aria-label": options.label }, state(options), ref);
|
|
20
|
+
return regionProps;
|
|
21
|
+
}
|
|
22
|
+
function useItem(toast, options, ref) {
|
|
23
|
+
const { toastProps, titleProps, descriptionProps } = useToast({ toast: {
|
|
24
|
+
key: toast.id,
|
|
25
|
+
content: toast
|
|
26
|
+
} }, state(options), ref);
|
|
27
|
+
const { "aria-describedby": describedBy, ...rest } = toastProps;
|
|
28
|
+
return {
|
|
29
|
+
toastProps: toast.description === void 0 ? rest : {
|
|
30
|
+
...rest,
|
|
31
|
+
"aria-describedby": describedBy
|
|
32
|
+
},
|
|
33
|
+
messageProps: titleProps,
|
|
34
|
+
descriptionProps
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
//#endregion
|
|
38
|
+
export { markTopLayer, useItem, useRegion };
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { mergeProps } from "../../contracts/merge-props.js";
|
|
3
|
+
import { stateAttrs } from "../../contracts/state.js";
|
|
4
|
+
import { defined, engineDom } from "./dom.js";
|
|
5
|
+
import { EngineLocale } from "./locale.client.js";
|
|
6
|
+
import { popupStyle, resolveSide, toPlacement } from "./overlay.client.js";
|
|
7
|
+
import { useOpenState } from "./open-state.client.js";
|
|
8
|
+
import { use } from "react";
|
|
9
|
+
import { jsx } from "react/jsx-runtime";
|
|
10
|
+
import { Tooltip, TooltipTrigger, TooltipTriggerStateContext, useLocale } from "react-aria-components";
|
|
11
|
+
import { useFocusable } from "react-aria/useFocusable";
|
|
12
|
+
import { useObjectRef } from "react-aria/useObjectRef";
|
|
13
|
+
//#region src/_engines/react-aria/tooltip.client.tsx
|
|
14
|
+
const Root = ({ open, defaultOpen, onOpenChange, delay, disabled, children }) => {
|
|
15
|
+
const [isOpen, setOpen, key] = useOpenState(open, defaultOpen, onOpenChange);
|
|
16
|
+
return /* @__PURE__ */ jsx(EngineLocale, { children: /* @__PURE__ */ jsx(TooltipTrigger, {
|
|
17
|
+
delay,
|
|
18
|
+
isOpen,
|
|
19
|
+
onOpenChange: setOpen,
|
|
20
|
+
...defined({ isDisabled: disabled }),
|
|
21
|
+
children
|
|
22
|
+
}, key) });
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* The trigger is the consumer's own element (often a server `<Button>`), so it takes the engine's
|
|
26
|
+
* hover/focus props through `useFocusable` instead of a React Aria `Button`.
|
|
27
|
+
*/
|
|
28
|
+
const Trigger = ({ render, ...dom }) => {
|
|
29
|
+
const ref = useObjectRef();
|
|
30
|
+
const { focusableProps } = useFocusable({}, ref);
|
|
31
|
+
const s = { open: use(TooltipTriggerStateContext)?.isOpen ?? false };
|
|
32
|
+
return render(mergeProps(engineDom(focusableProps), { ref }, dom, stateAttrs(s)), s);
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* React Aria 1.22.1 closes a tooltip "instantly" (no exit animation) when another one opens during
|
|
36
|
+
* the warm-up period, as Tab moves across tooltip triggers. Its exit state is then left "exiting"
|
|
37
|
+
* with no element to animate, so the next ordinary close of that tooltip (a press on its trigger,
|
|
38
|
+
* after the keyboard, with no pointer move that would reopen it first) mounts an unpositioned popup
|
|
39
|
+
* in `data-exiting` that never leaves. Keying the engine's Tooltip on that instant close remounts it
|
|
40
|
+
* with a fresh exit state; it renders nothing in either state, so nothing visible remounts.
|
|
41
|
+
*/
|
|
42
|
+
function instantlyClosed(state) {
|
|
43
|
+
return state !== null && !state.isOpen && state.shouldSkipAnimation === true;
|
|
44
|
+
}
|
|
45
|
+
const Popup = ({ side, align, sideOffset, container, render, children, ...dom }) => {
|
|
46
|
+
const { direction } = useLocale();
|
|
47
|
+
return /* @__PURE__ */ jsx(Tooltip, {
|
|
48
|
+
placement: toPlacement(side, align),
|
|
49
|
+
offset: sideOffset,
|
|
50
|
+
...defined({ UNSTABLE_portalContainer: container ?? void 0 }),
|
|
51
|
+
render: (p, rp) => {
|
|
52
|
+
const s = {
|
|
53
|
+
entering: rp.isEntering,
|
|
54
|
+
exiting: rp.isExiting,
|
|
55
|
+
side: resolveSide(rp.placement, side, direction)
|
|
56
|
+
};
|
|
57
|
+
const engine = {
|
|
58
|
+
...engineDom(p),
|
|
59
|
+
style: popupStyle(p.style)
|
|
60
|
+
};
|
|
61
|
+
const attrs = stateAttrs({
|
|
62
|
+
open: rp.state.isOpen,
|
|
63
|
+
...s,
|
|
64
|
+
align
|
|
65
|
+
});
|
|
66
|
+
return render(mergeProps(engine, dom, attrs), s);
|
|
67
|
+
},
|
|
68
|
+
children
|
|
69
|
+
}, instantlyClosed(use(TooltipTriggerStateContext)) ? "instant" : "live");
|
|
70
|
+
};
|
|
71
|
+
//#endregion
|
|
72
|
+
export { Popup, Root, Trigger };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//#region src/_internal/cx.ts
|
|
2
|
+
/** Joins class names, skipping empty values and repeated classes. Never exported from the package. */
|
|
3
|
+
function cx(...parts) {
|
|
4
|
+
const classes = /* @__PURE__ */ new Set();
|
|
5
|
+
for (const part of parts) if (part) {
|
|
6
|
+
for (const name of part.split(/\s+/)) if (name !== "") classes.add(name);
|
|
7
|
+
}
|
|
8
|
+
return [...classes].join(" ");
|
|
9
|
+
}
|
|
10
|
+
//#endregion
|
|
11
|
+
export { cx };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
//#region src/_internal/data-status.ts
|
|
2
|
+
/** The §16.5 attributes for a resolved status (ready with no value is 'empty' upstream). */
|
|
3
|
+
function dataStatusAttrs(status, pending) {
|
|
4
|
+
return {
|
|
5
|
+
"data-loading": status === "loading" ? "" : void 0,
|
|
6
|
+
"data-empty": status === "empty" ? "" : void 0,
|
|
7
|
+
"data-error": status === "error" ? "" : void 0,
|
|
8
|
+
"data-pending": pending ? "" : void 0,
|
|
9
|
+
"aria-busy": status === "loading" || pending || void 0
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
//#endregion
|
|
13
|
+
export { dataStatusAttrs };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { ComponentPropsWithRef, JSX, ReactElement, ReactNode } from "react";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
//#region src/_internal/field.ts
|
|
2
|
+
/**
|
|
3
|
+
* Whether a message node renders something. `null`, `undefined`, booleans and `''` render nothing,
|
|
4
|
+
* so `error={failed && 'Enter a price'}` presents no error when `failed` is false.
|
|
5
|
+
*/
|
|
6
|
+
function presented(node) {
|
|
7
|
+
return node != null && typeof node !== "boolean" && node !== "";
|
|
8
|
+
}
|
|
9
|
+
/** Joins id references for `aria-describedby`, skipping empty ones; `undefined` when none remain. */
|
|
10
|
+
function joinIds(...ids) {
|
|
11
|
+
const joined = ids.filter((id) => typeof id === "string" && id !== "").join(" ");
|
|
12
|
+
return joined === "" ? void 0 : joined;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Marks a server-safe control (NativeSelect) that Field wires as plain props when it is placed
|
|
16
|
+
* directly inside, as if it were a function child: zero JS, and the label still points at it.
|
|
17
|
+
*/
|
|
18
|
+
const FIELD_CONTROL = Symbol.for("nizivo.field-control");
|
|
19
|
+
//#endregion
|
|
20
|
+
export { FIELD_CONTROL, joinIds, presented };
|