@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,50 @@
|
|
|
1
|
+
import { cx } from "../_internal/cx.js";
|
|
2
|
+
import { CheckGlyph, MinusGlyph } from "../_internal/glyphs.js";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
//#region src/table-selection/table-selection.tsx
|
|
5
|
+
/**
|
|
6
|
+
* The header's checkbox: checks or clears every row of its `TableSelection`, and shows the mixed
|
|
7
|
+
* state when some are selected. It submits nothing. Without `TableSelection` it does nothing.
|
|
8
|
+
*/
|
|
9
|
+
function TableSelectAll({ labels, className, ...rest }) {
|
|
10
|
+
return /* @__PURE__ */ jsxs("label", {
|
|
11
|
+
"data-slot": "table-select-all",
|
|
12
|
+
className: cx("nz-table-select-all nz-checkbox nz-hit-target", className),
|
|
13
|
+
children: [/* @__PURE__ */ jsx("input", {
|
|
14
|
+
"aria-label": labels?.selectAll ?? "Select all rows",
|
|
15
|
+
...rest,
|
|
16
|
+
type: "checkbox",
|
|
17
|
+
className: "nz-table-select-all-input nz-checkbox-input",
|
|
18
|
+
"data-slot": "table-select-all-input"
|
|
19
|
+
}), /* @__PURE__ */ jsxs("span", {
|
|
20
|
+
className: "nz-table-select-all-indicator nz-checkbox-indicator",
|
|
21
|
+
"data-slot": "table-select-all-indicator",
|
|
22
|
+
"aria-hidden": "true",
|
|
23
|
+
children: [/* @__PURE__ */ jsx(CheckGlyph, {}), /* @__PURE__ */ jsx(MinusGlyph, {})]
|
|
24
|
+
})]
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* A row's checkbox: a native input that submits `value` under `name` with its form (pass `form` to
|
|
29
|
+
* reach a form outside the table). The row shows `bg/brand-subtle` while it is checked, through CSS.
|
|
30
|
+
*/
|
|
31
|
+
function TableSelectRow({ name = "ids", className, ...rest }) {
|
|
32
|
+
return /* @__PURE__ */ jsxs("label", {
|
|
33
|
+
"data-slot": "table-select-row",
|
|
34
|
+
className: cx("nz-table-select-row nz-checkbox nz-hit-target", className),
|
|
35
|
+
children: [/* @__PURE__ */ jsx("input", {
|
|
36
|
+
name,
|
|
37
|
+
...rest,
|
|
38
|
+
type: "checkbox",
|
|
39
|
+
className: "nz-table-select-row-input nz-checkbox-input",
|
|
40
|
+
"data-slot": "table-select-row-input"
|
|
41
|
+
}), /* @__PURE__ */ jsxs("span", {
|
|
42
|
+
className: "nz-table-select-row-indicator nz-checkbox-indicator",
|
|
43
|
+
"data-slot": "table-select-row-indicator",
|
|
44
|
+
"aria-hidden": "true",
|
|
45
|
+
children: [/* @__PURE__ */ jsx(CheckGlyph, {}), /* @__PURE__ */ jsx(MinusGlyph, {})]
|
|
46
|
+
})]
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
//#endregion
|
|
50
|
+
export { TableSelectAll, TableSelectRow };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { TabsActivationMode, TabsListProps, TabsListState, TabsPanelProps, TabsPanelState, TabsRootProps, TabsRootState, TabsTabProps, TabsTabState, TabsValueReason } from "./tabs.contract.js";
|
|
2
|
+
import { TabsList, TabsPanel, TabsRoot, TabsTab } from "./tabs.client.js";
|
|
3
|
+
import { tabs_parts_d_exports } from "./tabs.parts.js";
|
|
4
|
+
export { tabs_parts_d_exports as Tabs, type TabsActivationMode, TabsList, type TabsListProps, type TabsListState, TabsPanel, type TabsPanelProps, type TabsPanelState, TabsRoot, type TabsRootProps, type TabsRootState, TabsTab, type TabsTabProps, type TabsTabState, type TabsValueReason };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { TabsListProps, TabsPanelProps, TabsRootProps, TabsTabProps } from "./tabs.contract.js";
|
|
2
|
+
import { JSX } from "react";
|
|
3
|
+
//#region src/tabs/tabs.client.d.ts
|
|
4
|
+
export declare function TabsRoot({ activationMode, className, render, ...rest }: TabsRootProps): JSX.Element;
|
|
5
|
+
export declare function TabsList({ className, render, ...rest }: TabsListProps): JSX.Element;
|
|
6
|
+
export declare function TabsTab({ icon, count, className, render, children, ...rest }: TabsTabProps): JSX.Element;
|
|
7
|
+
export declare function TabsPanel({ keepMounted, className, render, ...rest }: TabsPanelProps): JSX.Element;
|
|
8
|
+
//#endregion
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cx } from "../_internal/cx.js";
|
|
3
|
+
import { toRenderFn } from "../contracts/render.js";
|
|
4
|
+
import { List, Panel, Root, Tab } from "../_engines/react-aria/tabs.client.js";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
//#region src/tabs/tabs.client.tsx
|
|
7
|
+
function TabsRoot({ activationMode = "automatic", className, render, ...rest }) {
|
|
8
|
+
return /* @__PURE__ */ jsx(Root, {
|
|
9
|
+
...rest,
|
|
10
|
+
activationMode,
|
|
11
|
+
className: cx("nz-tabs", className),
|
|
12
|
+
"data-slot": "tabs",
|
|
13
|
+
render: toRenderFn(render, "div")
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
function TabsList({ className, render, ...rest }) {
|
|
17
|
+
return /* @__PURE__ */ jsx(List, {
|
|
18
|
+
...rest,
|
|
19
|
+
className: cx("nz-tabs-list", className),
|
|
20
|
+
"data-slot": "tabs-list",
|
|
21
|
+
render: toRenderFn(render, "div")
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
function TabsTab({ icon, count, className, render, children, ...rest }) {
|
|
25
|
+
return /* @__PURE__ */ jsxs(Tab, {
|
|
26
|
+
...rest,
|
|
27
|
+
className: cx("nz-tabs-tab", className),
|
|
28
|
+
"data-slot": "tabs-tab",
|
|
29
|
+
"data-focus-inset": "",
|
|
30
|
+
render: toRenderFn(render, "div"),
|
|
31
|
+
children: [
|
|
32
|
+
icon != null && /* @__PURE__ */ jsx("span", {
|
|
33
|
+
className: "nz-tabs-icon",
|
|
34
|
+
"data-slot": "tabs-icon",
|
|
35
|
+
"aria-hidden": "true",
|
|
36
|
+
children: icon
|
|
37
|
+
}),
|
|
38
|
+
/* @__PURE__ */ jsxs("span", {
|
|
39
|
+
className: "nz-tabs-label",
|
|
40
|
+
"data-slot": "tabs-label",
|
|
41
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
42
|
+
className: "nz-tabs-text",
|
|
43
|
+
children
|
|
44
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
45
|
+
className: "nz-tabs-sizer",
|
|
46
|
+
"aria-hidden": "true",
|
|
47
|
+
children
|
|
48
|
+
})]
|
|
49
|
+
}),
|
|
50
|
+
count != null && /* @__PURE__ */ jsx("span", {
|
|
51
|
+
className: "nz-tabs-count",
|
|
52
|
+
"data-slot": "tabs-count",
|
|
53
|
+
children: count
|
|
54
|
+
})
|
|
55
|
+
]
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
function TabsPanel({ keepMounted = false, className, render, ...rest }) {
|
|
59
|
+
return /* @__PURE__ */ jsx(Panel, {
|
|
60
|
+
...rest,
|
|
61
|
+
keepMounted,
|
|
62
|
+
className: cx("nz-tabs-panel", className),
|
|
63
|
+
"data-slot": "tabs-panel",
|
|
64
|
+
render: toRenderFn(render, "div")
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
//#endregion
|
|
68
|
+
export { TabsList, TabsPanel, TabsRoot, TabsTab };
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { RenderProp } from "../contracts/render.js";
|
|
2
|
+
import { ChangeDetails } from "../contracts/details.js";
|
|
3
|
+
import "../_internal/engine-part.js";
|
|
4
|
+
import { ComponentPropsWithRef, ReactElement, ReactNode } from "react";
|
|
5
|
+
//#region src/tabs/tabs.contract.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* Why the selected tab changed. React Aria reports no cause, so with it `details.reason` is always
|
|
8
|
+
* `'unknown'` (§9.3 rule 2); the names are the causes an engine that reports one would use.
|
|
9
|
+
*/
|
|
10
|
+
export type TabsValueReason = "tab-press" | "keyboard";
|
|
11
|
+
/**
|
|
12
|
+
* When a tab is selected (WAI-ARIA APG tabs).
|
|
13
|
+
* - `automatic`: an arrow key moves focus and selects the tab it lands on (the APG default, for
|
|
14
|
+
* panels that show without a noticeable delay);
|
|
15
|
+
* - `manual`: arrow keys only move focus; Enter or Space selects (for panels that are slow to show).
|
|
16
|
+
*/
|
|
17
|
+
export type TabsActivationMode = "automatic" | "manual";
|
|
18
|
+
export interface TabsRootState {
|
|
19
|
+
disabled: boolean;
|
|
20
|
+
}
|
|
21
|
+
export interface TabsListState {
|
|
22
|
+
disabled: boolean;
|
|
23
|
+
}
|
|
24
|
+
export interface TabsTabState {
|
|
25
|
+
selected: boolean;
|
|
26
|
+
disabled: boolean;
|
|
27
|
+
focusVisible: boolean;
|
|
28
|
+
}
|
|
29
|
+
export interface TabsPanelState {
|
|
30
|
+
/** The panel's tab is selected. False only on a `keepMounted` panel whose tab is not. */
|
|
31
|
+
selected: boolean;
|
|
32
|
+
focusVisible: boolean;
|
|
33
|
+
}
|
|
34
|
+
export interface TabsRootProps extends Omit<ComponentPropsWithRef<"div">, "children" | "defaultValue" | "onChange" | "id" | "dir"> {
|
|
35
|
+
/** Controlled: the selected tab's `value`. */
|
|
36
|
+
value?: string;
|
|
37
|
+
/** The tab selected at first (uncontrolled). Defaults to the first tab that is not disabled. */
|
|
38
|
+
defaultValue?: string;
|
|
39
|
+
/** Called when the user selects a tab. `details.reason` is `'unknown'` with React Aria. */
|
|
40
|
+
onValueChange?: (value: string, details: ChangeDetails<TabsValueReason>) => void;
|
|
41
|
+
/** @default 'automatic' */
|
|
42
|
+
activationMode?: TabsActivationMode;
|
|
43
|
+
/** Disables every tab. The selected panel still shows. */
|
|
44
|
+
disabled?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* The strip's reading direction (M26), rendered as the root's `dir` attribute: the layout and the
|
|
47
|
+
* arrow keys follow it (in `rtl`, ArrowLeft moves to the next tab). Unset, nothing is rendered and
|
|
48
|
+
* the arrows follow the direction of the `NizivoConfig` scope's `locale`. Nothing reads the DOM, so
|
|
49
|
+
* a `dir` attribute set higher up does not turn the arrows: a strip whose direction differs from
|
|
50
|
+
* its locale's sets it here. `'auto'` is not accepted for the same reason.
|
|
51
|
+
*/
|
|
52
|
+
dir?: "ltr" | "rtl";
|
|
53
|
+
/** Must render a `<div>`. */
|
|
54
|
+
render?: RenderProp<TabsRootState>;
|
|
55
|
+
/** One `Tabs.List` and its `Tabs.Panel`s. */
|
|
56
|
+
children: ReactNode;
|
|
57
|
+
}
|
|
58
|
+
export interface TabsListProps extends Omit<ComponentPropsWithRef<"div">, "children" | "id"> {
|
|
59
|
+
/** Must render a `<div>`. */
|
|
60
|
+
render?: RenderProp<TabsListState>;
|
|
61
|
+
/** `Tabs.Tab` elements. */
|
|
62
|
+
children: ReactNode;
|
|
63
|
+
}
|
|
64
|
+
export interface TabsTabProps extends Omit<ComponentPropsWithRef<"div">, "children" | "id" | "onClick"> {
|
|
65
|
+
/** Pairs the tab with the `Tabs.Panel` of the same `value`. */
|
|
66
|
+
value: string;
|
|
67
|
+
disabled?: boolean;
|
|
68
|
+
/** A decorative glyph before the label (16 px). */
|
|
69
|
+
icon?: ReactNode;
|
|
70
|
+
/** A count after the label, such as the number of orders in a status. */
|
|
71
|
+
count?: ReactNode;
|
|
72
|
+
/** Must render a `<div>`. */
|
|
73
|
+
render?: RenderProp<TabsTabState>;
|
|
74
|
+
children: ReactNode;
|
|
75
|
+
}
|
|
76
|
+
export interface TabsPanelProps extends Omit<ComponentPropsWithRef<"div">, "children" | "id"> {
|
|
77
|
+
/** The `value` of the tab that shows this panel. */
|
|
78
|
+
value: string;
|
|
79
|
+
/**
|
|
80
|
+
* Keeps the panel mounted, `hidden`, while its tab is not selected, so its state (a scroll
|
|
81
|
+
* position, a form draft) survives switching. Without it only the selected panel is rendered, on
|
|
82
|
+
* the server too. @default false
|
|
83
|
+
*/
|
|
84
|
+
keepMounted?: boolean;
|
|
85
|
+
/** Must render a `<div>`. */
|
|
86
|
+
render?: RenderProp<TabsPanelState>;
|
|
87
|
+
children?: ReactNode;
|
|
88
|
+
}
|
|
89
|
+
//#endregion
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { TabsList, TabsPanel, TabsRoot, TabsTab } from "./tabs.client.js";
|
|
2
|
+
declare namespace tabs_parts_d_exports {
|
|
3
|
+
export { TabsList as List, TabsPanel as Panel, TabsRoot as Root, TabsTab as Tab };
|
|
4
|
+
}
|
|
5
|
+
//#endregion
|
|
6
|
+
export { TabsList as List, TabsPanel as Panel, TabsRoot as Root, TabsTab as Tab, tabs_parts_d_exports };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { __exportAll } from "../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { TabsList, TabsPanel, TabsRoot, TabsTab } from "./tabs.client.js";
|
|
3
|
+
//#region src/tabs/tabs.parts.ts
|
|
4
|
+
var tabs_parts_exports = /* @__PURE__ */ __exportAll({
|
|
5
|
+
List: () => TabsList,
|
|
6
|
+
Panel: () => TabsPanel,
|
|
7
|
+
Root: () => TabsRoot,
|
|
8
|
+
Tab: () => TabsTab
|
|
9
|
+
});
|
|
10
|
+
//#endregion
|
|
11
|
+
export { TabsList as List, TabsPanel as Panel, TabsRoot as Root, TabsTab as Tab, tabs_parts_exports };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Text } from "./text.js";
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { RenderProp } from "../contracts/render.js";
|
|
2
|
+
import { ComponentPropsWithRef, ReactElement } from "react";
|
|
3
|
+
//#region src/text/text.d.ts
|
|
4
|
+
/** The Figma text styles as lowercase names (`Nizivo/Label/M` → `label-m`), plus the 12 px proposals. */
|
|
5
|
+
export type TextVariant = "display-l" | "display-m" | "heading-h1" | "heading-h2" | "heading-h3" | "heading-h4" | "body-l" | "body-m" | "body-m-strong" | "body-s" | "label-l" | "label-m" | "label-m-strong" | "label-s" | "numeric-display" | "numeric-kpi" | "numeric-l" | "numeric-m" | "mono-m" | "mono-m-strong";
|
|
6
|
+
/**
|
|
7
|
+
* The `text/*` colour tokens. `accent` paints `--nz-text-brand`, since Figma has no accent text for page
|
|
8
|
+
* surfaces (M38; `--nz-text-inverse-accent` is for `bg/inverse`).
|
|
9
|
+
*
|
|
10
|
+
* Deprecated: `'accent'`, which looks exactly like `'brand'`; use `'brand'`. It keeps working; its
|
|
11
|
+
* removal is deferred to 1.0, or to when Figma adds an accent text for page surfaces (M42).
|
|
12
|
+
* TypeScript cannot deprecate one member of a union type, so this note is the marker. Card's and
|
|
13
|
+
* KpiTile's `tone="accent"`, a surface, are not deprecated.
|
|
14
|
+
*/
|
|
15
|
+
export type TextTone = "primary" | "secondary" | "tertiary" | "disabled" | "inverse" | "on-brand" | "on-accent" | "on-critical" | "brand" | "accent" | "success" | "warning" | "critical" | "info";
|
|
16
|
+
export interface TextState {
|
|
17
|
+
variant: TextVariant;
|
|
18
|
+
tone: TextTone | undefined;
|
|
19
|
+
}
|
|
20
|
+
export interface TextProps extends ComponentPropsWithRef<"p"> {
|
|
21
|
+
/** The text style. 12 px exists only as `body-s` and `label-s` (§15.1). @default 'body-m' */
|
|
22
|
+
variant?: TextVariant;
|
|
23
|
+
/**
|
|
24
|
+
* A `text/*` colour. Absent, the colour is inherited from the surface. Deprecated value:
|
|
25
|
+
* `'accent'`, which paints `--nz-text-brand`; use `'brand'` (M42; removal deferred to 1.0).
|
|
26
|
+
*/
|
|
27
|
+
tone?: TextTone;
|
|
28
|
+
/** Another element or component, for example `render={<span />}` or `render={<label htmlFor="sku" />}`. */
|
|
29
|
+
render?: RenderProp<TextState>;
|
|
30
|
+
}
|
|
31
|
+
export declare function Text({ variant, tone, render, className, ...rest }: TextProps): ReactElement;
|
|
32
|
+
//#endregion
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { cx } from "../_internal/cx.js";
|
|
2
|
+
import { renderElement } from "../contracts/render.js";
|
|
3
|
+
//#region src/text/text.tsx
|
|
4
|
+
function Text({ variant = "body-m", tone, render, className, ...rest }) {
|
|
5
|
+
return renderElement("p", render, {
|
|
6
|
+
variant,
|
|
7
|
+
tone
|
|
8
|
+
}, {
|
|
9
|
+
"data-slot": "text",
|
|
10
|
+
"data-variant": variant,
|
|
11
|
+
"data-tone": tone,
|
|
12
|
+
...rest,
|
|
13
|
+
className: cx("nz-text", className)
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
//#endregion
|
|
17
|
+
export { Text };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Textarea } from "./textarea.client.js";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ComponentPropsWithRef, JSX } from "react";
|
|
2
|
+
//#region src/textarea/textarea.client.d.ts
|
|
3
|
+
export interface TextareaProps extends Omit<ComponentPropsWithRef<"textarea">, "children"> {
|
|
4
|
+
/**
|
|
5
|
+
* Visible lines of text. The height is the larger of these rows and 112 px (Figma 7367:316; the
|
|
6
|
+
* `--nz-textarea-min-block-size` hook lowers it), so up to 4 rows of Body/M sit at 112 px. Where
|
|
7
|
+
* the textarea grows with its content, that is also its minimum (1 to 10; a larger value keeps a
|
|
8
|
+
* 3-line minimum there). @default 3
|
|
9
|
+
*/
|
|
10
|
+
rows?: number;
|
|
11
|
+
/**
|
|
12
|
+
* An error message is presented for this textarea (§8.3). Inside a Field, the Field sets it; an
|
|
13
|
+
* explicit value here wins.
|
|
14
|
+
*/
|
|
15
|
+
invalid?: boolean;
|
|
16
|
+
}
|
|
17
|
+
export declare function Textarea({ rows, id, name, required, disabled, readOnly, invalid, "aria-invalid": ariaInvalid, "aria-describedby": describedBy, className, ...rest }: TextareaProps): JSX.Element;
|
|
18
|
+
//#endregion
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cx } from "../_internal/cx.js";
|
|
3
|
+
import { mergeProps } from "../contracts/merge-props.js";
|
|
4
|
+
import { stateAttrs } from "../contracts/state.js";
|
|
5
|
+
import { useFieldControl } from "../field/field-scope.client.js";
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
//#region src/textarea/textarea.client.tsx
|
|
8
|
+
function Textarea({ rows = 3, id, name, required, disabled, readOnly, invalid, "aria-invalid": ariaInvalid, "aria-describedby": describedBy, className, ...rest }) {
|
|
9
|
+
const field = useFieldControl({
|
|
10
|
+
id,
|
|
11
|
+
name,
|
|
12
|
+
required,
|
|
13
|
+
disabled,
|
|
14
|
+
readOnly,
|
|
15
|
+
invalid: invalid ?? (ariaInvalid === true || ariaInvalid === "true" ? true : void 0),
|
|
16
|
+
"aria-describedby": describedBy
|
|
17
|
+
});
|
|
18
|
+
return /* @__PURE__ */ jsx("textarea", {
|
|
19
|
+
...mergeProps(field.controlProps, rest),
|
|
20
|
+
...stateAttrs({
|
|
21
|
+
invalid: field.invalid,
|
|
22
|
+
disabled: field.disabled,
|
|
23
|
+
readOnly: field.readOnly
|
|
24
|
+
}),
|
|
25
|
+
rows,
|
|
26
|
+
className: cx("nz-textarea", className),
|
|
27
|
+
"data-slot": "textarea"
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
//#endregion
|
|
31
|
+
export { Textarea };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ThemeScript, themeScript } from "./theme-script.js";
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { ReactElement } from "react";
|
|
2
|
+
//#region src/theme-script/theme-script.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* The script `ThemeScript` renders, for frameworks that inline it themselves (Astro:
|
|
5
|
+
* `<script is:inline set:html={themeScript} />`; Vite: a `transformIndexHtml` tag) or that allow it
|
|
6
|
+
* by hash under a strict CSP. It runs in `<head>`, before `<body>` exists, and sets two attributes on
|
|
7
|
+
* `<html>`:
|
|
8
|
+
*
|
|
9
|
+
* - **`data-nz-theme`, the reader's saved theme.** It reads `localStorage` key `nz-theme`; when the
|
|
10
|
+
* value is `"light"`, `"dark"` or `"system"`, it sets `data-nz-theme` to that value, replacing what
|
|
11
|
+
* the server rendered (the server's value is the app's default; the stored one is the reader's
|
|
12
|
+
* choice). `"system"` is set as is, not resolved: CSS follows the operating system from it, live,
|
|
13
|
+
* with no listener. With nothing stored, any other value, or storage blocked (a sandboxed frame,
|
|
14
|
+
* disabled site data), the attribute is left as the server rendered it. A theme switch saves the
|
|
15
|
+
* choice with `localStorage.setItem('nz-theme', value)` and sets the attribute itself.
|
|
16
|
+
* - **`data-nz-platform`**: `"apple"` when the platform string matches `/mac|iphone|ipad|ipod/i`,
|
|
17
|
+
* else `"other"`. The platform string is `navigator.userAgentData.platform` where the browser has
|
|
18
|
+
* it (Chromium: `"macOS"`, `"Windows"`, …), else `navigator.platform` (`"MacIntel"`, `"iPhone"`,
|
|
19
|
+
* `"iPad"`; iPadOS reports `"MacIntel"`, which is still Apple). It never reads the user-agent
|
|
20
|
+
* string. A value already on `<html>` (set by the server, or by a test) is kept. Kbd reads the
|
|
21
|
+
* attribute to show `⌘K` or `Ctrl+K`.
|
|
22
|
+
*
|
|
23
|
+
* Each half runs in its own `try`, so blocked storage never stops the platform half, and the script
|
|
24
|
+
* never throws into the page.
|
|
25
|
+
*
|
|
26
|
+
* Under a strict CSP, allow it by hash: `script-src 'sha256-nA1HUQWDdDUFqqoxWbjzCzcYSjzWLEe0pwDdRCMGqOw='`.
|
|
27
|
+
* The hash changes only when the script does, and a change is called out in the changelog.
|
|
28
|
+
*/
|
|
29
|
+
export declare const themeScript: string;
|
|
30
|
+
export interface ThemeScriptProps {
|
|
31
|
+
/** The CSP nonce for the inline script (`script-src 'nonce-…'`). Not needed with a hash allowlist. */
|
|
32
|
+
nonce?: string;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Sets page-level attributes before first paint, so nothing changes once the page has painted: the
|
|
36
|
+
* reader's saved theme (`data-nz-theme` from `localStorage` key `nz-theme`: `light`, `dark` or
|
|
37
|
+
* `system`) and `data-nz-platform` (`apple` or `other`). The rules are on `themeScript`. Render it in
|
|
38
|
+
* `<head>` (`<head><ThemeScript nonce={nonce} /></head>` in a root layout), put the app's default
|
|
39
|
+
* theme on `<html>` (`data-nz-theme="system"`, or none for light), and put `suppressHydrationWarning`
|
|
40
|
+
* on `<html>`, whose attributes the script changes.
|
|
41
|
+
*/
|
|
42
|
+
export declare function ThemeScript({ nonce }: ThemeScriptProps): ReactElement;
|
|
43
|
+
//#endregion
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
//#region src/theme-script/theme-script.tsx
|
|
3
|
+
/**
|
|
4
|
+
* The script `ThemeScript` renders, for frameworks that inline it themselves (Astro:
|
|
5
|
+
* `<script is:inline set:html={themeScript} />`; Vite: a `transformIndexHtml` tag) or that allow it
|
|
6
|
+
* by hash under a strict CSP. It runs in `<head>`, before `<body>` exists, and sets two attributes on
|
|
7
|
+
* `<html>`:
|
|
8
|
+
*
|
|
9
|
+
* - **`data-nz-theme`, the reader's saved theme.** It reads `localStorage` key `nz-theme`; when the
|
|
10
|
+
* value is `"light"`, `"dark"` or `"system"`, it sets `data-nz-theme` to that value, replacing what
|
|
11
|
+
* the server rendered (the server's value is the app's default; the stored one is the reader's
|
|
12
|
+
* choice). `"system"` is set as is, not resolved: CSS follows the operating system from it, live,
|
|
13
|
+
* with no listener. With nothing stored, any other value, or storage blocked (a sandboxed frame,
|
|
14
|
+
* disabled site data), the attribute is left as the server rendered it. A theme switch saves the
|
|
15
|
+
* choice with `localStorage.setItem('nz-theme', value)` and sets the attribute itself.
|
|
16
|
+
* - **`data-nz-platform`**: `"apple"` when the platform string matches `/mac|iphone|ipad|ipod/i`,
|
|
17
|
+
* else `"other"`. The platform string is `navigator.userAgentData.platform` where the browser has
|
|
18
|
+
* it (Chromium: `"macOS"`, `"Windows"`, …), else `navigator.platform` (`"MacIntel"`, `"iPhone"`,
|
|
19
|
+
* `"iPad"`; iPadOS reports `"MacIntel"`, which is still Apple). It never reads the user-agent
|
|
20
|
+
* string. A value already on `<html>` (set by the server, or by a test) is kept. Kbd reads the
|
|
21
|
+
* attribute to show `⌘K` or `Ctrl+K`.
|
|
22
|
+
*
|
|
23
|
+
* Each half runs in its own `try`, so blocked storage never stops the platform half, and the script
|
|
24
|
+
* never throws into the page.
|
|
25
|
+
*
|
|
26
|
+
* Under a strict CSP, allow it by hash: `script-src 'sha256-nA1HUQWDdDUFqqoxWbjzCzcYSjzWLEe0pwDdRCMGqOw='`.
|
|
27
|
+
* The hash changes only when the script does, and a change is called out in the changelog.
|
|
28
|
+
*/
|
|
29
|
+
const themeScript = "(function(d){try{var t=localStorage.getItem(\"nz-theme\");if(/^(light|dark|system)$/.test(t))d.setAttribute(\"data-nz-theme\",t)}catch(e){}try{if(!d.hasAttribute(\"data-nz-platform\")){var n=navigator,p=(n.userAgentData&&n.userAgentData.platform)||n.platform||\"\";d.setAttribute(\"data-nz-platform\",/mac|iphone|ipad|ipod/i.test(p)?\"apple\":\"other\")}}catch(e){}})(document.documentElement)";
|
|
30
|
+
/**
|
|
31
|
+
* Sets page-level attributes before first paint, so nothing changes once the page has painted: the
|
|
32
|
+
* reader's saved theme (`data-nz-theme` from `localStorage` key `nz-theme`: `light`, `dark` or
|
|
33
|
+
* `system`) and `data-nz-platform` (`apple` or `other`). The rules are on `themeScript`. Render it in
|
|
34
|
+
* `<head>` (`<head><ThemeScript nonce={nonce} /></head>` in a root layout), put the app's default
|
|
35
|
+
* theme on `<html>` (`data-nz-theme="system"`, or none for light), and put `suppressHydrationWarning`
|
|
36
|
+
* on `<html>`, whose attributes the script changes.
|
|
37
|
+
*/
|
|
38
|
+
function ThemeScript({ nonce }) {
|
|
39
|
+
return /* @__PURE__ */ jsx("script", {
|
|
40
|
+
suppressHydrationWarning: true,
|
|
41
|
+
...nonce === void 0 ? {} : { nonce },
|
|
42
|
+
dangerouslySetInnerHTML: { __html: themeScript }
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
//#endregion
|
|
46
|
+
export { ThemeScript, themeScript };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Politeness, ToastAction, ToastOptions, ToastTone, ToasterLabels, ToasterProps } from "./toast.contract.js";
|
|
2
|
+
import { Toaster } from "./toaster.client.js";
|
|
3
|
+
import { announce, toast } from "./store.js";
|
|
4
|
+
export { type Politeness, type ToastAction, type ToastOptions, type ToastTone, Toaster, type ToasterLabels, type ToasterProps, announce, toast };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import "./seam.js";
|
|
2
|
+
import { Politeness, ToastOptions } from "./toast.contract.js";
|
|
3
|
+
//#region src/toast/store.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Shows a toast and returns its id. A toast with an action, or a critical one, stays until it is
|
|
6
|
+
* dismissed; any other leaves after `timeout` (5 s). Every toast is spoken once through the Toaster's
|
|
7
|
+
* announcer: polite, or assertive when critical. Render one `<Toaster />` in the app's root layout.
|
|
8
|
+
*/
|
|
9
|
+
export declare const toast: ((message: string, options?: ToastOptions) => string) & {
|
|
10
|
+
/** Removes the toast with this id, or every toast. */
|
|
11
|
+
dismiss: (id?: string) => void;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Speaks `message` through the Toaster's announcer, a live region that is on the page before any
|
|
15
|
+
* message and stays reachable above a modal. For status a sighted user sees some other way: "Saved",
|
|
16
|
+
* "3 results". Needs a mounted `<Toaster />`.
|
|
17
|
+
*/
|
|
18
|
+
export declare function announce(message: string, politeness?: Politeness): void;
|
|
19
|
+
//#endregion
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
//#region src/toast/store.ts
|
|
2
|
+
const TIMEOUT = 5e3;
|
|
3
|
+
let entries = [];
|
|
4
|
+
let snapshot = [];
|
|
5
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
6
|
+
/** Why the clock is stopped: the region (`region`: hover, focus within), the page (`hidden`). */
|
|
7
|
+
const pauses = /* @__PURE__ */ new Set();
|
|
8
|
+
/** Ids a Toaster shows; a waiting toast's clock does not run. */
|
|
9
|
+
let shown = /* @__PURE__ */ new Set();
|
|
10
|
+
let hosts = 0;
|
|
11
|
+
let next = 0;
|
|
12
|
+
let speaker;
|
|
13
|
+
function emit() {
|
|
14
|
+
snapshot = entries.map((entry) => entry.record);
|
|
15
|
+
for (const listener of listeners) listener();
|
|
16
|
+
}
|
|
17
|
+
function stop(entry) {
|
|
18
|
+
if (entry.handle === void 0) return;
|
|
19
|
+
clearTimeout(entry.handle);
|
|
20
|
+
entry.handle = void 0;
|
|
21
|
+
if (entry.remaining !== null) entry.remaining -= Date.now() - entry.started;
|
|
22
|
+
}
|
|
23
|
+
/** Runs each clock that may run: a shown toast that leaves on its own, a Toaster mounted, no pause. */
|
|
24
|
+
function sync() {
|
|
25
|
+
const running = hosts > 0 && pauses.size === 0;
|
|
26
|
+
for (const entry of entries) if (!running || !shown.has(entry.record.id) || entry.remaining === null) stop(entry);
|
|
27
|
+
else if (entry.handle === void 0) {
|
|
28
|
+
const { id } = entry.record;
|
|
29
|
+
entry.started = Date.now();
|
|
30
|
+
entry.handle = setTimeout(() => dismiss(id), Math.max(0, entry.remaining));
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
/** The text a toast speaks: its message, then its description. */
|
|
34
|
+
function spoken(record) {
|
|
35
|
+
if (record.description === void 0) return record.message;
|
|
36
|
+
const separator = /[.!?…:]$/.test(record.message) ? " " : ". ";
|
|
37
|
+
return record.message + separator + record.description;
|
|
38
|
+
}
|
|
39
|
+
function add(message, options = {}) {
|
|
40
|
+
const tone = options.tone ?? "neutral";
|
|
41
|
+
const timeout = options.action !== void 0 || tone === "critical" ? null : options.timeout ?? TIMEOUT;
|
|
42
|
+
const id = options.id ?? `nz-toast-${next += 1}`;
|
|
43
|
+
const record = {
|
|
44
|
+
id,
|
|
45
|
+
message,
|
|
46
|
+
tone,
|
|
47
|
+
description: options.description,
|
|
48
|
+
action: options.action,
|
|
49
|
+
timeout
|
|
50
|
+
};
|
|
51
|
+
const entry = {
|
|
52
|
+
record,
|
|
53
|
+
onClose: options.onClose,
|
|
54
|
+
remaining: timeout,
|
|
55
|
+
started: 0,
|
|
56
|
+
handle: void 0
|
|
57
|
+
};
|
|
58
|
+
const at = entries.findIndex((existing) => existing.record.id === id);
|
|
59
|
+
if (at === -1) entries = [...entries, entry];
|
|
60
|
+
else {
|
|
61
|
+
const previous = entries[at];
|
|
62
|
+
if (previous !== void 0) stop(previous);
|
|
63
|
+
entries = entries.with(at, entry);
|
|
64
|
+
}
|
|
65
|
+
emit();
|
|
66
|
+
sync();
|
|
67
|
+
announce(spoken(record), tone === "critical" ? "assertive" : "polite");
|
|
68
|
+
return id;
|
|
69
|
+
}
|
|
70
|
+
/** Removes one toast, or every toast with no id. */
|
|
71
|
+
function dismiss(id) {
|
|
72
|
+
const leaving = entries.filter((entry) => id === void 0 || entry.record.id === id);
|
|
73
|
+
if (leaving.length === 0) return;
|
|
74
|
+
for (const entry of leaving) stop(entry);
|
|
75
|
+
entries = entries.filter((entry) => !leaving.includes(entry));
|
|
76
|
+
emit();
|
|
77
|
+
for (const entry of leaving) entry.onClose?.();
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Shows a toast and returns its id. A toast with an action, or a critical one, stays until it is
|
|
81
|
+
* dismissed; any other leaves after `timeout` (5 s). Every toast is spoken once through the Toaster's
|
|
82
|
+
* announcer: polite, or assertive when critical. Render one `<Toaster />` in the app's root layout.
|
|
83
|
+
*/
|
|
84
|
+
const toast = Object.assign(add, { dismiss });
|
|
85
|
+
/**
|
|
86
|
+
* Speaks `message` through the Toaster's announcer, a live region that is on the page before any
|
|
87
|
+
* message and stays reachable above a modal. For status a sighted user sees some other way: "Saved",
|
|
88
|
+
* "3 results". Needs a mounted `<Toaster />`.
|
|
89
|
+
*/
|
|
90
|
+
function announce(message, politeness = "polite") {
|
|
91
|
+
if (speaker !== void 0) speaker(message, politeness);
|
|
92
|
+
else if (process.env.NODE_ENV !== "production") console.warn(`Nizivo: announce("${message}") ran with no <Toaster /> mounted, so nothing spoke it.`);
|
|
93
|
+
}
|
|
94
|
+
function subscribe(listener) {
|
|
95
|
+
listeners.add(listener);
|
|
96
|
+
return () => listeners.delete(listener);
|
|
97
|
+
}
|
|
98
|
+
function getSnapshot() {
|
|
99
|
+
return snapshot;
|
|
100
|
+
}
|
|
101
|
+
const EMPTY = [];
|
|
102
|
+
/** The server renders no toast: the queue is the browser's. */
|
|
103
|
+
function getServerSnapshot() {
|
|
104
|
+
return EMPTY;
|
|
105
|
+
}
|
|
106
|
+
/** A Toaster mounted; clocks run while one is. Returns its unmount. */
|
|
107
|
+
function attach() {
|
|
108
|
+
hosts += 1;
|
|
109
|
+
sync();
|
|
110
|
+
return () => {
|
|
111
|
+
hosts -= 1;
|
|
112
|
+
sync();
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
/** The ids the Toaster shows: the newest `limit`. */
|
|
116
|
+
function show(ids) {
|
|
117
|
+
shown = new Set(ids);
|
|
118
|
+
sync();
|
|
119
|
+
}
|
|
120
|
+
function pause(reason) {
|
|
121
|
+
pauses.add(reason);
|
|
122
|
+
sync();
|
|
123
|
+
}
|
|
124
|
+
function resume(reason) {
|
|
125
|
+
pauses.delete(reason);
|
|
126
|
+
sync();
|
|
127
|
+
}
|
|
128
|
+
/** The announcer registers here while mounted. Returns its unregister. */
|
|
129
|
+
function speakThrough(speak) {
|
|
130
|
+
speaker = speak;
|
|
131
|
+
return () => {
|
|
132
|
+
if (speaker === speak) speaker = void 0;
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
//#endregion
|
|
136
|
+
export { announce, attach, getServerSnapshot, getSnapshot, pause, resume, show, speakThrough, subscribe, toast };
|