@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,229 @@
|
|
|
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 { 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 { Children, createContext, createElement, isValidElement, use, useRef, useState } from "react";
|
|
12
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { Button, Header, Menu, MenuItem, MenuSection, MenuTrigger, Popover, RootMenuTriggerStateContext, Separator, useLocale } from "react-aria-components";
|
|
14
|
+
//#region src/_engines/react-aria/menu.client.tsx
|
|
15
|
+
/**
|
|
16
|
+
* Uncontrolled checkbox and radio state, kept by the Root: the popup and everything in it unmount on
|
|
17
|
+
* close, so state held there would reset on every open. A checkbox item is identified by its text, a
|
|
18
|
+
* radio group by its items' values; without either, the state lasts while the popup is open.
|
|
19
|
+
*/
|
|
20
|
+
const Kept = createContext(null);
|
|
21
|
+
function useKept(key, initial, read) {
|
|
22
|
+
const store = use(Kept);
|
|
23
|
+
const [value, setValue] = useState(() => {
|
|
24
|
+
const kept = key === void 0 ? void 0 : store?.get(key);
|
|
25
|
+
return read(kept) ? kept : initial;
|
|
26
|
+
});
|
|
27
|
+
return [value, (next) => {
|
|
28
|
+
if (key !== void 0) store?.set(key, next);
|
|
29
|
+
setValue(next);
|
|
30
|
+
}];
|
|
31
|
+
}
|
|
32
|
+
const isBoolean = (value) => typeof value === "boolean";
|
|
33
|
+
const isChoice = (value) => typeof value === "string" || value === null;
|
|
34
|
+
/** The `value` props of the radio items under `children`, through fragments and wrappers. */
|
|
35
|
+
function itemValues(children, out = []) {
|
|
36
|
+
Children.forEach(children, (child) => {
|
|
37
|
+
if (!isValidElement(child)) return;
|
|
38
|
+
if (typeof child.props.value === "string") out.push(child.props.value);
|
|
39
|
+
else itemValues(child.props.children, out);
|
|
40
|
+
});
|
|
41
|
+
return out;
|
|
42
|
+
}
|
|
43
|
+
const Root = ({ open, defaultOpen, onOpenChange, children }) => {
|
|
44
|
+
const [store] = useState(() => /* @__PURE__ */ new Map());
|
|
45
|
+
const [isOpen, setOpen, key] = useOpenState(open, defaultOpen, onOpenChange);
|
|
46
|
+
return /* @__PURE__ */ jsx(EngineLocale, { children: /* @__PURE__ */ jsx(Kept, {
|
|
47
|
+
value: store,
|
|
48
|
+
children: /* @__PURE__ */ jsx(MenuTrigger, {
|
|
49
|
+
isOpen,
|
|
50
|
+
onOpenChange: setOpen,
|
|
51
|
+
children
|
|
52
|
+
}, key)
|
|
53
|
+
}) });
|
|
54
|
+
};
|
|
55
|
+
const Trigger = ({ render, children, ...dom }) => {
|
|
56
|
+
const open = use(RootMenuTriggerStateContext)?.isOpen ?? false;
|
|
57
|
+
return /* @__PURE__ */ jsx(Button, {
|
|
58
|
+
render: (p, rp) => {
|
|
59
|
+
const s = {
|
|
60
|
+
open,
|
|
61
|
+
pressed: rp.isPressed && !open,
|
|
62
|
+
focusVisible: rp.isFocusVisible,
|
|
63
|
+
disabled: rp.isDisabled
|
|
64
|
+
};
|
|
65
|
+
return render(mergeProps(engineDom(p), dom, stateAttrs(s)), s);
|
|
66
|
+
},
|
|
67
|
+
children
|
|
68
|
+
});
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* The engine names the menu by its trigger (`aria-labelledby`), which would outrank an `aria-label`
|
|
72
|
+
* the leaf passes; with one, the label names the menu instead.
|
|
73
|
+
*/
|
|
74
|
+
function listDom(engine, list) {
|
|
75
|
+
const out = engineDom(engine);
|
|
76
|
+
if (list["aria-label"] !== void 0) delete out["aria-labelledby"];
|
|
77
|
+
return out;
|
|
78
|
+
}
|
|
79
|
+
const Popup = ({ side, align, sideOffset, container, list, render, children, ...dom }) => {
|
|
80
|
+
const { direction } = useLocale();
|
|
81
|
+
const popup = useRef(null);
|
|
82
|
+
const tabOut = useTabOut(popup);
|
|
83
|
+
const trigger = useTriggerRef();
|
|
84
|
+
return /* @__PURE__ */ jsxs(Popover, {
|
|
85
|
+
placement: toPlacement(side, align),
|
|
86
|
+
offset: sideOffset,
|
|
87
|
+
...defined({ UNSTABLE_portalContainer: container ?? void 0 }),
|
|
88
|
+
render: (p, rp) => {
|
|
89
|
+
const s = {
|
|
90
|
+
entering: rp.isEntering,
|
|
91
|
+
exiting: rp.isExiting,
|
|
92
|
+
side: resolveSide(rp.placement, side, direction)
|
|
93
|
+
};
|
|
94
|
+
const engine = {
|
|
95
|
+
...engineDom(p),
|
|
96
|
+
style: popupStyle(p.style)
|
|
97
|
+
};
|
|
98
|
+
const attrs = stateAttrs({
|
|
99
|
+
open: !rp.isExiting,
|
|
100
|
+
...s,
|
|
101
|
+
align
|
|
102
|
+
});
|
|
103
|
+
return render(mergeProps(engine, dom, attrs, { ref: popup }), s);
|
|
104
|
+
},
|
|
105
|
+
children: [
|
|
106
|
+
/* @__PURE__ */ jsx(ReturnFocus, {
|
|
107
|
+
trigger,
|
|
108
|
+
popup
|
|
109
|
+
}),
|
|
110
|
+
/* @__PURE__ */ jsx(OutsidePress, { popup }),
|
|
111
|
+
/* @__PURE__ */ jsx(Menu, {
|
|
112
|
+
render: (p) => createElement("div", mergeProps(listDom(p, list), list, { onKeyDown: tabOut })),
|
|
113
|
+
children
|
|
114
|
+
})
|
|
115
|
+
]
|
|
116
|
+
});
|
|
117
|
+
};
|
|
118
|
+
const Item = ({ textValue, disabled, onAction, closeOnSelect, href, target, rel, download, hrefLang, ping, referrerPolicy, render, children, ...dom }) => /* @__PURE__ */ jsx(MenuItem, {
|
|
119
|
+
...defined({
|
|
120
|
+
textValue,
|
|
121
|
+
isDisabled: disabled,
|
|
122
|
+
onAction,
|
|
123
|
+
shouldCloseOnSelect: closeOnSelect,
|
|
124
|
+
href,
|
|
125
|
+
target,
|
|
126
|
+
rel,
|
|
127
|
+
download,
|
|
128
|
+
hrefLang,
|
|
129
|
+
ping,
|
|
130
|
+
referrerPolicy
|
|
131
|
+
}),
|
|
132
|
+
render: (p, rp) => {
|
|
133
|
+
const s = {
|
|
134
|
+
highlighted: rp.isFocused,
|
|
135
|
+
disabled: rp.isDisabled,
|
|
136
|
+
focusVisible: rp.isFocusVisible,
|
|
137
|
+
checked: false
|
|
138
|
+
};
|
|
139
|
+
return render(mergeProps(engineDom(p), dom, stateAttrs(s)), s);
|
|
140
|
+
},
|
|
141
|
+
children
|
|
142
|
+
});
|
|
143
|
+
/**
|
|
144
|
+
* React Aria derives checkbox semantics from a selection scope (a Menu or MenuSection with
|
|
145
|
+
* `selectionMode`), which would turn every item in that scope into a checkbox. A checkbox item owns
|
|
146
|
+
* its own state instead: the adapter keeps it, toggles it on the item's action and writes the
|
|
147
|
+
* `menuitemcheckbox` role and `aria-checked` the engine would have written.
|
|
148
|
+
*/
|
|
149
|
+
const CheckboxItem = ({ checked, defaultChecked, onCheckedChange, textValue, disabled, onAction, closeOnSelect, render, children, ...dom }) => {
|
|
150
|
+
const [own, setOwn] = useKept(textValue === void 0 ? void 0 : `checkbox:${textValue}`, defaultChecked ?? false, isBoolean);
|
|
151
|
+
const isChecked = checked ?? own;
|
|
152
|
+
return /* @__PURE__ */ jsx(MenuItem, {
|
|
153
|
+
...defined({
|
|
154
|
+
textValue,
|
|
155
|
+
isDisabled: disabled
|
|
156
|
+
}),
|
|
157
|
+
shouldCloseOnSelect: closeOnSelect ?? false,
|
|
158
|
+
onAction: () => {
|
|
159
|
+
const next = !isChecked;
|
|
160
|
+
if (checked === void 0) setOwn(next);
|
|
161
|
+
onCheckedChange?.(next, details("item-press"));
|
|
162
|
+
onAction?.();
|
|
163
|
+
},
|
|
164
|
+
render: (p, rp) => {
|
|
165
|
+
const s = {
|
|
166
|
+
highlighted: rp.isFocused,
|
|
167
|
+
disabled: rp.isDisabled,
|
|
168
|
+
focusVisible: rp.isFocusVisible,
|
|
169
|
+
checked: isChecked
|
|
170
|
+
};
|
|
171
|
+
const aria = {
|
|
172
|
+
role: "menuitemcheckbox",
|
|
173
|
+
"aria-checked": isChecked
|
|
174
|
+
};
|
|
175
|
+
return render(mergeProps(engineDom(p), aria, dom, stateAttrs(s)), s);
|
|
176
|
+
},
|
|
177
|
+
children
|
|
178
|
+
});
|
|
179
|
+
};
|
|
180
|
+
/** A single-selection scope: React Aria gives its items `menuitemradio` and `aria-checked`. */
|
|
181
|
+
const RadioGroup = ({ value, defaultValue, onValueChange, render, children, ...dom }) => {
|
|
182
|
+
const values = itemValues(children);
|
|
183
|
+
const [own, setOwn] = useKept(values.length === 0 ? void 0 : `radio:${values.join("\0")}`, defaultValue ?? null, isChoice);
|
|
184
|
+
const current = value === void 0 ? own : value;
|
|
185
|
+
return /* @__PURE__ */ jsx(MenuSection, {
|
|
186
|
+
selectionMode: "single",
|
|
187
|
+
disallowEmptySelection: true,
|
|
188
|
+
selectedKeys: current === null ? [] : [current],
|
|
189
|
+
onSelectionChange: (selection) => {
|
|
190
|
+
if (selection === "all") return;
|
|
191
|
+
const [key] = selection;
|
|
192
|
+
if (key === void 0) return;
|
|
193
|
+
if (value === void 0) setOwn(String(key));
|
|
194
|
+
onValueChange?.(String(key), details("unknown"));
|
|
195
|
+
},
|
|
196
|
+
render: (p) => render(mergeProps(engineDom(p), dom), {}),
|
|
197
|
+
children
|
|
198
|
+
});
|
|
199
|
+
};
|
|
200
|
+
const RadioItem = ({ value, textValue, disabled, onAction, closeOnSelect, render, children, ...dom }) => /* @__PURE__ */ jsx(MenuItem, {
|
|
201
|
+
id: value,
|
|
202
|
+
...defined({
|
|
203
|
+
textValue,
|
|
204
|
+
isDisabled: disabled,
|
|
205
|
+
onAction,
|
|
206
|
+
shouldCloseOnSelect: closeOnSelect
|
|
207
|
+
}),
|
|
208
|
+
render: (p, rp) => {
|
|
209
|
+
const s = {
|
|
210
|
+
highlighted: rp.isFocused,
|
|
211
|
+
disabled: rp.isDisabled,
|
|
212
|
+
focusVisible: rp.isFocusVisible,
|
|
213
|
+
checked: rp.isSelected
|
|
214
|
+
};
|
|
215
|
+
return render(mergeProps(engineDom(p), dom, stateAttrs(s)), s);
|
|
216
|
+
},
|
|
217
|
+
children
|
|
218
|
+
});
|
|
219
|
+
const Group = ({ render, children, ...dom }) => /* @__PURE__ */ jsx(MenuSection, {
|
|
220
|
+
render: (p) => render(mergeProps(engineDom(p), dom), {}),
|
|
221
|
+
children
|
|
222
|
+
});
|
|
223
|
+
const GroupLabel = ({ render, children, ...dom }) => /* @__PURE__ */ jsx(Header, {
|
|
224
|
+
render: (p) => render(mergeProps(engineDom(p), dom), {}),
|
|
225
|
+
children
|
|
226
|
+
});
|
|
227
|
+
const Separator$1 = ({ render, ...dom }) => /* @__PURE__ */ jsx(Separator, { render: (p) => render(mergeProps(engineDom(p), dom), {}) });
|
|
228
|
+
//#endregion
|
|
229
|
+
export { CheckboxItem, Group, GroupLabel, Item, Popup, RadioGroup, RadioItem, Root, Separator$1 as Separator, Trigger };
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { details } from "../../contracts/details.js";
|
|
3
|
+
import { createContext, useLayoutEffect, useRef, useState } from "react";
|
|
4
|
+
//#region src/_engines/react-aria/open-state.client.tsx
|
|
5
|
+
/**
|
|
6
|
+
* The key, for a popup part whose Root keeps other state in the engine (Select's value): that part
|
|
7
|
+
* remounts its popup instead.
|
|
8
|
+
*/
|
|
9
|
+
const PopupKey = createContext(0);
|
|
10
|
+
/**
|
|
11
|
+
* `[isOpen, setOpen, key]` for the engine: the consumer's `open`, else the Root's own state, and the
|
|
12
|
+
* key to render the engine's root with.
|
|
13
|
+
*/
|
|
14
|
+
function useOpenState(open, defaultOpen, onOpenChange) {
|
|
15
|
+
const [own, setOwn] = useState(defaultOpen ?? false);
|
|
16
|
+
const [key, setKey] = useState(0);
|
|
17
|
+
const controlled = open !== void 0;
|
|
18
|
+
const isOpen = controlled ? open : own;
|
|
19
|
+
const latest = useRef({
|
|
20
|
+
controlled,
|
|
21
|
+
onOpenChange
|
|
22
|
+
});
|
|
23
|
+
useLayoutEffect(() => {
|
|
24
|
+
latest.current = {
|
|
25
|
+
controlled,
|
|
26
|
+
onOpenChange
|
|
27
|
+
};
|
|
28
|
+
});
|
|
29
|
+
const seenClosed = useRef(false);
|
|
30
|
+
const armed = useRef(false);
|
|
31
|
+
useLayoutEffect(() => {
|
|
32
|
+
if (!isOpen) seenClosed.current = true;
|
|
33
|
+
armed.current = isOpen && seenClosed.current;
|
|
34
|
+
}, [isOpen]);
|
|
35
|
+
useLayoutEffect(() => () => {
|
|
36
|
+
if (!armed.current) return;
|
|
37
|
+
armed.current = false;
|
|
38
|
+
if (!latest.current.controlled) setOwn(false);
|
|
39
|
+
setKey((k) => k + 1);
|
|
40
|
+
latest.current.onOpenChange?.(false, details("hidden"));
|
|
41
|
+
}, []);
|
|
42
|
+
const setOpen = (next) => {
|
|
43
|
+
if (!controlled) setOwn(next);
|
|
44
|
+
onOpenChange?.(next, details("unknown"));
|
|
45
|
+
};
|
|
46
|
+
return [
|
|
47
|
+
isOpen,
|
|
48
|
+
setOpen,
|
|
49
|
+
key
|
|
50
|
+
];
|
|
51
|
+
}
|
|
52
|
+
//#endregion
|
|
53
|
+
export { PopupKey, useOpenState };
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { returnAfterClose } from "./popup.client.js";
|
|
3
|
+
import { use, useEffect, useLayoutEffect, useRef } from "react";
|
|
4
|
+
import { OverlayTriggerStateContext } from "react-aria-components";
|
|
5
|
+
//#region src/_engines/react-aria/outside-press.client.tsx
|
|
6
|
+
/**
|
|
7
|
+
* The family's open popups, in open order. Its own list, not popup.client's registry: a Select's
|
|
8
|
+
* hidden collection pass registers and unregisters there under the same ref. Only entries on the
|
|
9
|
+
* page count.
|
|
10
|
+
*/
|
|
11
|
+
const STACK = [];
|
|
12
|
+
const onPage = (popup) => popup.current?.isConnected === true;
|
|
13
|
+
/**
|
|
14
|
+
* Outside press for a popup opened inside another overlay (§12.2 Dismiss stack). React Aria's
|
|
15
|
+
* useInteractOutside ignores every press inside an element marked top-layer, and the family's
|
|
16
|
+
* nested-portal containers carry that mark (§12.1 L2), so a press on a nested popup's underlay, or
|
|
17
|
+
* anywhere else in its parent's container, never reached the engine's dismiss logic: a Select or
|
|
18
|
+
* Menu inside a Dialog stayed open (weeks 4 to 12; found in week 13). The family completes it: a
|
|
19
|
+
* press that starts and ends outside `popup`, inside a top-layer element that is not Nizivo's own
|
|
20
|
+
* top layer (the toast region and announcer, `data-nz-top-layer`, dismiss nothing) and not on a
|
|
21
|
+
* tooltip, closes `popup` when it is the topmost. Every other press stays with the engine. The
|
|
22
|
+
* element is read at the press: a Select's popup is attached after this component's first effect.
|
|
23
|
+
*/
|
|
24
|
+
function OutsidePress({ popup, dismissable = true }) {
|
|
25
|
+
const context = use(OverlayTriggerStateContext);
|
|
26
|
+
const state = useRef(context);
|
|
27
|
+
useLayoutEffect(() => {
|
|
28
|
+
state.current = context;
|
|
29
|
+
});
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
STACK.push(popup);
|
|
32
|
+
const ours = (event) => {
|
|
33
|
+
const element = popup.current;
|
|
34
|
+
const { target } = event;
|
|
35
|
+
if (!dismissable || event.button > 0 || element === null || !(target instanceof Element) || element.contains(target)) return false;
|
|
36
|
+
const host = target.closest("[data-react-aria-top-layer]");
|
|
37
|
+
return host !== null && host.closest("[data-nz-top-layer]") === null && target.closest("[role=\"tooltip\"]") === null && STACK.findLast(onPage) === popup;
|
|
38
|
+
};
|
|
39
|
+
let started = false;
|
|
40
|
+
const down = (event) => {
|
|
41
|
+
started = ours(event);
|
|
42
|
+
};
|
|
43
|
+
const up = (event) => {
|
|
44
|
+
if (started && ours(event)) {
|
|
45
|
+
returnAfterClose(popup);
|
|
46
|
+
state.current?.close();
|
|
47
|
+
}
|
|
48
|
+
started = false;
|
|
49
|
+
};
|
|
50
|
+
document.addEventListener("pointerdown", down, true);
|
|
51
|
+
document.addEventListener("pointerup", up, true);
|
|
52
|
+
return () => {
|
|
53
|
+
STACK.splice(STACK.lastIndexOf(popup), 1);
|
|
54
|
+
document.removeEventListener("pointerdown", down, true);
|
|
55
|
+
document.removeEventListener("pointerup", up, true);
|
|
56
|
+
};
|
|
57
|
+
}, [popup, dismissable]);
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
//#endregion
|
|
61
|
+
export { OutsidePress };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { UNSAFE_PortalProvider } from "react-aria/PortalProvider";
|
|
4
|
+
//#region src/_engines/react-aria/overlay.client.tsx
|
|
5
|
+
/** Nested overlays rendered inside `children` portal into `container` (§12.1 L2). */
|
|
6
|
+
function OverlayScope({ container, children }) {
|
|
7
|
+
return /* @__PURE__ */ jsx(UNSAFE_PortalProvider, {
|
|
8
|
+
getContainer: () => container.current ?? (typeof document === "undefined" ? null : document.body),
|
|
9
|
+
children
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
/** React Aria's inert exemption, as props for an element the adapter renders itself. */
|
|
13
|
+
const TOP_LAYER = { "data-react-aria-top-layer": "" };
|
|
14
|
+
/** Maps Nizivo's `data-nz-top-layer` to React Aria's inert exemption. */
|
|
15
|
+
function markTopLayer(element) {
|
|
16
|
+
element.setAttribute("data-react-aria-top-layer", "");
|
|
17
|
+
return () => element.removeAttribute("data-react-aria-top-layer");
|
|
18
|
+
}
|
|
19
|
+
/** Logical side + alignment → a React Aria placement. */
|
|
20
|
+
function toPlacement(side, align) {
|
|
21
|
+
if (align === "center") return side;
|
|
22
|
+
if (side === "top" || side === "bottom") return `${side} ${align}`;
|
|
23
|
+
return `${side} ${align === "start" ? "top" : "bottom"}`;
|
|
24
|
+
}
|
|
25
|
+
/** The resolved physical side: the engine's placement after flip and RTL, else the requested side. */
|
|
26
|
+
function resolveSide(placement, requested, direction) {
|
|
27
|
+
if (placement === "top" || placement === "bottom" || placement === "left" || placement === "right") return placement;
|
|
28
|
+
if (requested === "start") return direction === "rtl" ? "right" : "left";
|
|
29
|
+
if (requested === "end") return direction === "rtl" ? "left" : "right";
|
|
30
|
+
return requested;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* The engine's positioning style without its fixed `z-index` (popups sit in the one
|
|
34
|
+
* `--nz-z-overlay` band, §12.1), plus the runtime variables Nizivo documents (§8.3).
|
|
35
|
+
*/
|
|
36
|
+
function popupStyle(style) {
|
|
37
|
+
if (typeof style !== "object" || style === null) return void 0;
|
|
38
|
+
const out = {};
|
|
39
|
+
for (const [key, value] of Object.entries(style)) if (key !== "zIndex") out[key] = value;
|
|
40
|
+
if (out["--trigger-width"] != null) out["--nz-trigger-width"] = out["--trigger-width"];
|
|
41
|
+
if (out["--trigger-anchor-point"] != null) out["--nz-transform-origin"] = out["--trigger-anchor-point"];
|
|
42
|
+
if (typeof out["maxHeight"] === "number") out["--nz-available-height"] = `${out["maxHeight"]}px`;
|
|
43
|
+
return out;
|
|
44
|
+
}
|
|
45
|
+
//#endregion
|
|
46
|
+
export { OverlayScope, TOP_LAYER, markTopLayer, popupStyle, resolveSide, toPlacement };
|
|
@@ -0,0 +1,148 @@
|
|
|
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 { OverlayScope, markTopLayer, popupStyle, resolveSide, toPlacement } from "./overlay.client.js";
|
|
7
|
+
import { useOpenState } from "./open-state.client.js";
|
|
8
|
+
import { InitialFocus, ReturnFocus, useTriggerRef } from "./popup.client.js";
|
|
9
|
+
import { OutsidePress } from "./outside-press.client.js";
|
|
10
|
+
import { createElement, use, useCallback, useRef } from "react";
|
|
11
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
12
|
+
import { Button, Dialog, DialogTrigger, Heading, OverlayTriggerStateContext, Popover, Text, useLocale } from "react-aria-components";
|
|
13
|
+
//#region src/_engines/react-aria/popover.client.tsx
|
|
14
|
+
const Root = ({ open, defaultOpen, onOpenChange, children }) => {
|
|
15
|
+
const [isOpen, setOpen, key] = useOpenState(open, defaultOpen, onOpenChange);
|
|
16
|
+
return /* @__PURE__ */ jsx(EngineLocale, { children: /* @__PURE__ */ jsx(DialogTrigger, {
|
|
17
|
+
isOpen,
|
|
18
|
+
onOpenChange: setOpen,
|
|
19
|
+
children
|
|
20
|
+
}, key) });
|
|
21
|
+
};
|
|
22
|
+
const Trigger = ({ render, children, ...dom }) => {
|
|
23
|
+
const open = use(OverlayTriggerStateContext)?.isOpen ?? false;
|
|
24
|
+
return /* @__PURE__ */ jsx(Button, {
|
|
25
|
+
render: (p, rp) => {
|
|
26
|
+
const s = {
|
|
27
|
+
open,
|
|
28
|
+
pressed: rp.isPressed && !open,
|
|
29
|
+
focusVisible: rp.isFocusVisible,
|
|
30
|
+
disabled: rp.isDisabled
|
|
31
|
+
};
|
|
32
|
+
return render(mergeProps(engineDom(p), dom, stateAttrs(s)), s);
|
|
33
|
+
},
|
|
34
|
+
children
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* The nested-portal container (§12.1 L2): a box-less element right after the popup, in the
|
|
39
|
+
* container the popup portaled into, so overlays opened inside the popover paint above it. It is not
|
|
40
|
+
* inside the popup, which scrolls (a clip) and scales while it enters. The engine hides everything
|
|
41
|
+
* outside a modal popover, so it carries the family's top-layer exemption, as the Dialog's does: a
|
|
42
|
+
* tooltip portaled there stays hoverable (WCAG 1.4.13). Created here, not by React, because the
|
|
43
|
+
* engine owns the popup's portal and nothing can render a sibling into it. A hidden anchor inside
|
|
44
|
+
* the popup makes it with a stable callback ref: in the commit that inserts the popup, so a tooltip
|
|
45
|
+
* shown by the initial focus (a passive effect) already finds it; a ref merged into the popup's own
|
|
46
|
+
* props would be a new function, detached and attached again, on every render.
|
|
47
|
+
*/
|
|
48
|
+
function useNestedContainer() {
|
|
49
|
+
const container = useRef(null);
|
|
50
|
+
return {
|
|
51
|
+
container,
|
|
52
|
+
anchor: useCallback((element) => {
|
|
53
|
+
const popup = element?.parentElement;
|
|
54
|
+
if (popup == null) return void 0;
|
|
55
|
+
const nested = popup.ownerDocument.createElement("div");
|
|
56
|
+
nested.style.display = "contents";
|
|
57
|
+
const undo = markTopLayer(nested);
|
|
58
|
+
popup.after(nested);
|
|
59
|
+
container.current = nested;
|
|
60
|
+
return () => {
|
|
61
|
+
undo();
|
|
62
|
+
nested.remove();
|
|
63
|
+
if (container.current === nested) container.current = null;
|
|
64
|
+
};
|
|
65
|
+
}, [])
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
const Popup = ({ side, align, sideOffset, container, contentProps, initialFocus, "aria-label": label, "aria-labelledby": labelledBy, "aria-describedby": describedBy, render, children, ...dom }) => {
|
|
69
|
+
const { direction } = useLocale();
|
|
70
|
+
const popup = useRef(null);
|
|
71
|
+
const content = useRef(null);
|
|
72
|
+
const { container: nested, anchor } = useNestedContainer();
|
|
73
|
+
const trigger = useTriggerRef();
|
|
74
|
+
return /* @__PURE__ */ jsxs(Popover, {
|
|
75
|
+
placement: toPlacement(side, align),
|
|
76
|
+
offset: sideOffset,
|
|
77
|
+
...defined({ UNSTABLE_portalContainer: container ?? void 0 }),
|
|
78
|
+
render: (p, rp) => {
|
|
79
|
+
const s = {
|
|
80
|
+
entering: rp.isEntering,
|
|
81
|
+
exiting: rp.isExiting,
|
|
82
|
+
side: resolveSide(rp.placement, side, direction)
|
|
83
|
+
};
|
|
84
|
+
const engine = {
|
|
85
|
+
...engineDom(p),
|
|
86
|
+
style: popupStyle(p.style)
|
|
87
|
+
};
|
|
88
|
+
const attrs = stateAttrs({
|
|
89
|
+
open: !rp.isExiting,
|
|
90
|
+
...s,
|
|
91
|
+
align
|
|
92
|
+
});
|
|
93
|
+
return render(mergeProps(engine, dom, attrs, { ref: popup }), s);
|
|
94
|
+
},
|
|
95
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
96
|
+
hidden: true,
|
|
97
|
+
ref: anchor
|
|
98
|
+
}), /* @__PURE__ */ jsxs(Dialog, {
|
|
99
|
+
...defined({
|
|
100
|
+
"aria-label": label,
|
|
101
|
+
"aria-labelledby": labelledBy,
|
|
102
|
+
"aria-describedby": describedBy
|
|
103
|
+
}),
|
|
104
|
+
render: (p) => createElement("section", mergeProps(engineDom(p), contentProps, { ref: content })),
|
|
105
|
+
children: [
|
|
106
|
+
/* @__PURE__ */ jsx(InitialFocus, {
|
|
107
|
+
content,
|
|
108
|
+
resolve: initialFocus
|
|
109
|
+
}),
|
|
110
|
+
/* @__PURE__ */ jsx(ReturnFocus, {
|
|
111
|
+
trigger,
|
|
112
|
+
popup
|
|
113
|
+
}),
|
|
114
|
+
/* @__PURE__ */ jsx(OutsidePress, { popup }),
|
|
115
|
+
/* @__PURE__ */ jsx(OverlayScope, {
|
|
116
|
+
container: nested,
|
|
117
|
+
children
|
|
118
|
+
})
|
|
119
|
+
]
|
|
120
|
+
})]
|
|
121
|
+
});
|
|
122
|
+
};
|
|
123
|
+
const Title = ({ level, render, children, ...dom }) => /* @__PURE__ */ jsx(Heading, {
|
|
124
|
+
slot: "title",
|
|
125
|
+
level,
|
|
126
|
+
render: (p) => render(mergeProps(engineDom(p), dom), {}),
|
|
127
|
+
children
|
|
128
|
+
});
|
|
129
|
+
const Description = ({ render, children, ...dom }) => /* @__PURE__ */ jsx(Text, {
|
|
130
|
+
slot: "description",
|
|
131
|
+
elementType: "p",
|
|
132
|
+
render: (p) => render(mergeProps(engineDom(p), dom), {}),
|
|
133
|
+
children
|
|
134
|
+
});
|
|
135
|
+
const Close = ({ render, children, ...dom }) => /* @__PURE__ */ jsx(Button, {
|
|
136
|
+
slot: "close",
|
|
137
|
+
render: (p, rp) => {
|
|
138
|
+
const s = {
|
|
139
|
+
pressed: rp.isPressed,
|
|
140
|
+
focusVisible: rp.isFocusVisible,
|
|
141
|
+
disabled: rp.isDisabled
|
|
142
|
+
};
|
|
143
|
+
return render(mergeProps(engineDom(p), dom, stateAttrs(s)), s);
|
|
144
|
+
},
|
|
145
|
+
children
|
|
146
|
+
});
|
|
147
|
+
//#endregion
|
|
148
|
+
export { Close, Description, Popup, Root, Title, Trigger };
|