@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 @@
|
|
|
1
|
+
export { Switch } from "./switch.client.js";
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { RenderProp } from "../contracts/render.js";
|
|
2
|
+
import { ChangeDetails } from "../contracts/details.js";
|
|
3
|
+
import { ComponentPropsWithRef, ReactElement, ReactNode } from "react";
|
|
4
|
+
//#region src/switch/switch.client.d.ts
|
|
5
|
+
/** Every change comes from the native `change` event: a click, Space, or a click on the label. */
|
|
6
|
+
export type SwitchChangeReason = "input";
|
|
7
|
+
/** What a `render` function receives for the root `<label>`. */
|
|
8
|
+
export interface SwitchState {
|
|
9
|
+
/** An error message is presented (the Field's, or the `invalid` prop). */
|
|
10
|
+
invalid: boolean;
|
|
11
|
+
disabled: boolean;
|
|
12
|
+
required: boolean;
|
|
13
|
+
}
|
|
14
|
+
export interface SwitchProps extends Omit<ComponentPropsWithRef<"input">, "type" | "role" | "children" | "readOnly" | "size"> {
|
|
15
|
+
/** Controlled state: on or off. */
|
|
16
|
+
checked?: boolean;
|
|
17
|
+
/** Uncontrolled initial state. @default false */
|
|
18
|
+
defaultChecked?: boolean;
|
|
19
|
+
/** Called after the consumer's own `onChange`, unless it called `preventDefault()`. */
|
|
20
|
+
onCheckedChange?: (checked: boolean, details: ChangeDetails<SwitchChangeReason>) => void;
|
|
21
|
+
/** An error message is presented for this switch. Inside a Field, the Field decides. */
|
|
22
|
+
invalid?: boolean;
|
|
23
|
+
/** Composition of the root `<label>`, the hit target. */
|
|
24
|
+
render?: RenderProp<SwitchState>;
|
|
25
|
+
/** The label, after the track. Without one, name the switch with `aria-label`. */
|
|
26
|
+
children?: ReactNode;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* `className` and `style` go on the root `<label>`; every other attribute, `ref` included, goes on the
|
|
30
|
+
* native `<input>`. With `name`, the form submits `value` (default `"on"`) while the switch is on.
|
|
31
|
+
*/
|
|
32
|
+
export declare function Switch({ id, name, required, disabled, invalid, "aria-describedby": describedBy, onCheckedChange, render, className, style, children, ...rest }: SwitchProps): ReactElement;
|
|
33
|
+
//#endregion
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cx } from "../_internal/cx.js";
|
|
3
|
+
import { mergeProps } from "../contracts/merge-props.js";
|
|
4
|
+
import { renderElement } from "../contracts/render.js";
|
|
5
|
+
import { details } from "../contracts/details.js";
|
|
6
|
+
import { stateAttrs } from "../contracts/state.js";
|
|
7
|
+
import { presented } from "../_internal/field.js";
|
|
8
|
+
import { useFieldControl } from "../field/field-scope.client.js";
|
|
9
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
+
//#region src/switch/switch.client.tsx
|
|
11
|
+
/**
|
|
12
|
+
* `className` and `style` go on the root `<label>`; every other attribute, `ref` included, goes on the
|
|
13
|
+
* native `<input>`. With `name`, the form submits `value` (default `"on"`) while the switch is on.
|
|
14
|
+
*/
|
|
15
|
+
function Switch({ id, name, required, disabled, invalid, "aria-describedby": describedBy, onCheckedChange, render, className, style, children, ...rest }) {
|
|
16
|
+
const field = useFieldControl({
|
|
17
|
+
id,
|
|
18
|
+
name,
|
|
19
|
+
required,
|
|
20
|
+
disabled,
|
|
21
|
+
invalid,
|
|
22
|
+
"aria-describedby": describedBy
|
|
23
|
+
});
|
|
24
|
+
const { readOnly: _readOnly, ...control } = field.controlProps;
|
|
25
|
+
const own = {
|
|
26
|
+
...control,
|
|
27
|
+
onChange(event) {
|
|
28
|
+
onCheckedChange?.(event.currentTarget.checked, details("input", event.nativeEvent));
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
const state = {
|
|
32
|
+
invalid: field.invalid,
|
|
33
|
+
disabled: field.disabled,
|
|
34
|
+
required: field.required
|
|
35
|
+
};
|
|
36
|
+
return renderElement("label", render, state, {
|
|
37
|
+
"data-slot": "switch",
|
|
38
|
+
...stateAttrs(state),
|
|
39
|
+
className: cx("nz-switch nz-hit-target", className),
|
|
40
|
+
style,
|
|
41
|
+
children: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
42
|
+
/* @__PURE__ */ jsx("input", {
|
|
43
|
+
...mergeProps(own, rest),
|
|
44
|
+
type: "checkbox",
|
|
45
|
+
role: "switch",
|
|
46
|
+
className: "nz-switch-input",
|
|
47
|
+
"data-slot": "switch-input"
|
|
48
|
+
}),
|
|
49
|
+
/* @__PURE__ */ jsx("span", {
|
|
50
|
+
className: "nz-switch-thumb",
|
|
51
|
+
"data-slot": "switch-thumb",
|
|
52
|
+
"aria-hidden": "true"
|
|
53
|
+
}),
|
|
54
|
+
presented(children) && /* @__PURE__ */ jsx("span", {
|
|
55
|
+
className: "nz-switch-label",
|
|
56
|
+
"data-slot": "switch-label",
|
|
57
|
+
children
|
|
58
|
+
})
|
|
59
|
+
] })
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
//#endregion
|
|
63
|
+
export { Switch };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { TabNavLink, TabNavLinkProps, TabNavLinkState, TabNavRoot, TabNavRootProps } from "./tab-nav.js";
|
|
2
|
+
import { tab_nav_parts_d_exports } from "./tab-nav.parts.js";
|
|
3
|
+
export { tab_nav_parts_d_exports as TabNav, TabNavLink, type TabNavLinkProps, type TabNavLinkState, TabNavRoot, type TabNavRootProps };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { RenderProp } from "../contracts/render.js";
|
|
2
|
+
import { ComponentPropsWithRef, ReactElement, ReactNode } from "react";
|
|
3
|
+
//#region src/tab-nav/tab-nav.d.ts
|
|
4
|
+
export interface TabNavRootProps extends ComponentPropsWithRef<"nav"> {
|
|
5
|
+
/**
|
|
6
|
+
* Names the landmark ("Order status"). A page with more than one navigation landmark needs a
|
|
7
|
+
* name on each.
|
|
8
|
+
*/
|
|
9
|
+
"aria-label"?: string;
|
|
10
|
+
/** Must render a navigation landmark (a `<nav>`, or an element with `role="navigation"`). */
|
|
11
|
+
render?: RenderProp<Record<string, never>>;
|
|
12
|
+
}
|
|
13
|
+
export interface TabNavLinkState {
|
|
14
|
+
current: boolean;
|
|
15
|
+
}
|
|
16
|
+
export interface TabNavLinkProps extends Omit<ComponentPropsWithRef<"a">, "children"> {
|
|
17
|
+
/**
|
|
18
|
+
* The link to the page being shown: sets `aria-current="page"` and draws the indicator. The page
|
|
19
|
+
* knows its own route, so it says which link is current (a router's `usePathname` needs a client
|
|
20
|
+
* component; a server page reads its params). @default false
|
|
21
|
+
*/
|
|
22
|
+
current?: boolean;
|
|
23
|
+
/** A decorative glyph before the label (16 px). */
|
|
24
|
+
icon?: ReactNode;
|
|
25
|
+
/** A count after the label, such as the number of orders in a status. */
|
|
26
|
+
count?: ReactNode;
|
|
27
|
+
/**
|
|
28
|
+
* The router's link, for example `render={<Link href="/orders?status=open" />}` (Next.js, React
|
|
29
|
+
* Router, TanStack Router, Astro's plain `<a>`). It must render an `<a>`.
|
|
30
|
+
*/
|
|
31
|
+
render?: RenderProp<TabNavLinkState>;
|
|
32
|
+
children: ReactNode;
|
|
33
|
+
}
|
|
34
|
+
export declare function TabNavRoot({ render, className, ...rest }: TabNavRootProps): ReactElement;
|
|
35
|
+
export declare function TabNavLink({ current, icon, count, render, className, children, ...rest }: TabNavLinkProps): ReactElement;
|
|
36
|
+
//#endregion
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { cx } from "../_internal/cx.js";
|
|
2
|
+
import { renderElement } from "../contracts/render.js";
|
|
3
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
//#region src/tab-nav/tab-nav.tsx
|
|
5
|
+
function TabNavRoot({ render, className, ...rest }) {
|
|
6
|
+
return renderElement("nav", render, {}, {
|
|
7
|
+
"data-slot": "tab-nav",
|
|
8
|
+
...rest,
|
|
9
|
+
className: cx("nz-tab-nav", className)
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
function TabNavLink({ current = false, icon, count, render, className, children, ...rest }) {
|
|
13
|
+
return renderElement("a", render, { current }, {
|
|
14
|
+
"data-slot": "tab-nav-link",
|
|
15
|
+
"data-focus-inset": "",
|
|
16
|
+
...rest,
|
|
17
|
+
"aria-current": current ? "page" : rest["aria-current"],
|
|
18
|
+
className: cx("nz-tab-nav-link", className),
|
|
19
|
+
children: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
20
|
+
icon != null && /* @__PURE__ */ jsx("span", {
|
|
21
|
+
className: "nz-tab-nav-icon",
|
|
22
|
+
"data-slot": "tab-nav-icon",
|
|
23
|
+
"aria-hidden": "true",
|
|
24
|
+
children: icon
|
|
25
|
+
}),
|
|
26
|
+
/* @__PURE__ */ jsxs("span", {
|
|
27
|
+
className: "nz-tab-nav-label",
|
|
28
|
+
"data-slot": "tab-nav-label",
|
|
29
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
30
|
+
className: "nz-tab-nav-text",
|
|
31
|
+
children
|
|
32
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
33
|
+
className: "nz-tab-nav-sizer",
|
|
34
|
+
"aria-hidden": "true",
|
|
35
|
+
children
|
|
36
|
+
})]
|
|
37
|
+
}),
|
|
38
|
+
count != null && /* @__PURE__ */ jsx("span", {
|
|
39
|
+
className: "nz-tab-nav-count",
|
|
40
|
+
"data-slot": "tab-nav-count",
|
|
41
|
+
children: count
|
|
42
|
+
})
|
|
43
|
+
] })
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
//#endregion
|
|
47
|
+
export { TabNavLink, TabNavRoot };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { __exportAll } from "../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { TabNavLink, TabNavRoot } from "./tab-nav.js";
|
|
3
|
+
//#region src/tab-nav/tab-nav.parts.ts
|
|
4
|
+
var tab_nav_parts_exports = /* @__PURE__ */ __exportAll({
|
|
5
|
+
Link: () => TabNavLink,
|
|
6
|
+
Root: () => TabNavRoot
|
|
7
|
+
});
|
|
8
|
+
//#endregion
|
|
9
|
+
export { TabNavLink as Link, TabNavRoot as Root, tab_nav_parts_exports };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { TableBody, TableCaption, TableCaptionProps, TableCell, TableCellProps, TableCellState, TableContainer, TableContainerProps, TableFooter, TableHead, TableHeadProps, TableHeadState, TableHeader, TableRoot, TableRootProps, TableRow, TableRowLink, TableRowLinkProps, TableRowProps, TableRowState, TableSectionProps, TableSort, TableSortButton, TableSortButtonProps } from "./table.js";
|
|
2
|
+
import { table_parts_d_exports } from "./table.parts.js";
|
|
3
|
+
export { table_parts_d_exports as Table, TableBody, TableCaption, type TableCaptionProps, TableCell, type TableCellProps, type TableCellState, TableContainer, type TableContainerProps, TableFooter, TableHead, type TableHeadProps, type TableHeadState, TableHeader, TableRoot, type TableRootProps, TableRow, TableRowLink, type TableRowLinkProps, type TableRowProps, type TableRowState, type TableSectionProps, type TableSort, TableSortButton, type TableSortButtonProps };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { TableBody, TableCaption, TableCell, TableContainer, TableFooter, TableHead, TableHeader, TableRoot, TableRow, TableRowLink, TableSortButton } from "./table.js";
|
|
2
|
+
import { table_parts_exports } from "./table.parts.js";
|
|
3
|
+
export { table_parts_exports as Table, TableBody, TableCaption, TableCell, TableContainer, TableFooter, TableHead, TableHeader, TableRoot, TableRow, TableRowLink, TableSortButton };
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { RenderProp } from "../contracts/render.js";
|
|
2
|
+
import { ComponentPropsWithRef, ReactElement } from "react";
|
|
3
|
+
//#region src/table/table.d.ts
|
|
4
|
+
type Empty = Record<string, never>;
|
|
5
|
+
export type TableSort = "ascending" | "descending";
|
|
6
|
+
export interface TableContainerProps extends ComponentPropsWithRef<"div"> {
|
|
7
|
+
/**
|
|
8
|
+
* Names the container as a scrollable region and puts it in the Tab order, so a keyboard can
|
|
9
|
+
* scroll a table wider than the screen (Safari and Firefox do not focus a scroller on their own).
|
|
10
|
+
* Give it when the table can scroll sideways and its rows hold no link or control.
|
|
11
|
+
*/
|
|
12
|
+
label?: string;
|
|
13
|
+
render?: RenderProp<Empty>;
|
|
14
|
+
}
|
|
15
|
+
export interface TableRootProps extends ComponentPropsWithRef<"table"> {
|
|
16
|
+
render?: RenderProp<Empty>;
|
|
17
|
+
}
|
|
18
|
+
export interface TableCaptionProps extends ComponentPropsWithRef<"caption"> {
|
|
19
|
+
/**
|
|
20
|
+
* Keeps the caption as the table's accessible name but hides it from sight, for a table whose
|
|
21
|
+
* card already shows a heading. @default false
|
|
22
|
+
*/
|
|
23
|
+
visuallyHidden?: boolean;
|
|
24
|
+
render?: RenderProp<Empty>;
|
|
25
|
+
}
|
|
26
|
+
export interface TableSectionProps extends ComponentPropsWithRef<"tbody"> {
|
|
27
|
+
render?: RenderProp<Empty>;
|
|
28
|
+
}
|
|
29
|
+
export interface TableRowState {
|
|
30
|
+
selected: boolean;
|
|
31
|
+
interactive: boolean;
|
|
32
|
+
}
|
|
33
|
+
export interface TableRowProps extends ComponentPropsWithRef<"tr"> {
|
|
34
|
+
/** `data-selected` (never `aria-selected` inside a table, §16.2). @default false */
|
|
35
|
+
selected?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* The whole row is the hit area of its `Table.RowLink` (a stretched link) and shows Figma's hover.
|
|
38
|
+
* Other controls in the row stay above the link. @default false
|
|
39
|
+
*/
|
|
40
|
+
interactive?: boolean;
|
|
41
|
+
render?: RenderProp<TableRowState>;
|
|
42
|
+
}
|
|
43
|
+
export interface TableHeadState {
|
|
44
|
+
sort: TableSort | undefined;
|
|
45
|
+
numeric: boolean;
|
|
46
|
+
}
|
|
47
|
+
export interface TableHeadProps extends ComponentPropsWithRef<"th"> {
|
|
48
|
+
/** The column's current sort: `aria-sort` and `data-sort` on the `<th>`. */
|
|
49
|
+
sort?: TableSort;
|
|
50
|
+
/** A column of numbers: end-aligned, tabular figures. @default false */
|
|
51
|
+
numeric?: boolean;
|
|
52
|
+
/** `row` for a row header in the body. @default 'col' */
|
|
53
|
+
scope?: "col" | "row" | "colgroup" | "rowgroup";
|
|
54
|
+
render?: RenderProp<TableHeadState>;
|
|
55
|
+
}
|
|
56
|
+
export interface TableCellState {
|
|
57
|
+
numeric: boolean;
|
|
58
|
+
}
|
|
59
|
+
export interface TableCellProps extends ComponentPropsWithRef<"td"> {
|
|
60
|
+
/** A number: end-aligned, tabular figures. @default false */
|
|
61
|
+
numeric?: boolean;
|
|
62
|
+
render?: RenderProp<TableCellState>;
|
|
63
|
+
}
|
|
64
|
+
export interface TableSortButtonProps extends ComponentPropsWithRef<"button"> {
|
|
65
|
+
/**
|
|
66
|
+
* The same page sorted by this column, for example `href="?sort=-total"`: the part renders an
|
|
67
|
+
* `<a>`, and the URL holds the state. With neither `href` nor `render` it is a
|
|
68
|
+
* `<button type="button">` for your own handler.
|
|
69
|
+
*/
|
|
70
|
+
href?: string;
|
|
71
|
+
/** The router's link, for example `render={<Link href="?sort=-total" />}`. */
|
|
72
|
+
render?: RenderProp<Empty>;
|
|
73
|
+
}
|
|
74
|
+
export interface TableRowLinkProps extends ComponentPropsWithRef<"a"> {
|
|
75
|
+
/** The router's link, for example `render={<Link href="/orders/1042" />}`. It must render an `<a>`. */
|
|
76
|
+
render?: RenderProp<Empty>;
|
|
77
|
+
}
|
|
78
|
+
/** The table's box: the border, the radius and the horizontal scroll of a wide table. */
|
|
79
|
+
export declare function TableContainer({ label, render, className, ...rest }: TableContainerProps): ReactElement;
|
|
80
|
+
export declare function TableRoot({ render, className, ...rest }: TableRootProps): ReactElement;
|
|
81
|
+
/** The table's name. Give every table one: a caption, or `aria-labelledby` to a visible heading. */
|
|
82
|
+
export declare function TableCaption({ visuallyHidden, render, className, ...rest }: TableCaptionProps): ReactElement;
|
|
83
|
+
export declare function TableHeader({ render, className, ...rest }: TableSectionProps): ReactElement;
|
|
84
|
+
export declare function TableBody({ render, className, ...rest }: TableSectionProps): ReactElement;
|
|
85
|
+
export declare function TableFooter({ render, className, ...rest }: TableSectionProps): ReactElement;
|
|
86
|
+
export declare function TableRow({ selected, interactive, render, className, ...rest }: TableRowProps): ReactElement;
|
|
87
|
+
export declare function TableHead({ sort, numeric, scope, render, className, ...rest }: TableHeadProps): ReactElement;
|
|
88
|
+
export declare function TableCell({ numeric, render, className, ...rest }: TableCellProps): ReactElement;
|
|
89
|
+
/**
|
|
90
|
+
* The column's label as a control. Its arrow follows the `sort` of the `Table.Head` it sits in
|
|
91
|
+
* (up for ascending, down for descending, both ways when unsorted) through CSS, so it needs no
|
|
92
|
+
* client code; the `<th>`'s `aria-sort` tells assistive technology the current order.
|
|
93
|
+
*/
|
|
94
|
+
export declare function TableSortButton({ href, render, className, children, ...rest }: TableSortButtonProps): ReactElement;
|
|
95
|
+
/**
|
|
96
|
+
* A row's link, usually its first cell's text (Figma Order Row: the order number). In a row with
|
|
97
|
+
* `interactive`, it stretches over the whole row.
|
|
98
|
+
*/
|
|
99
|
+
export declare function TableRowLink({ render, className, ...rest }: TableRowLinkProps): ReactElement;
|
|
100
|
+
//#endregion
|
|
101
|
+
export {};
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { cx } from "../_internal/cx.js";
|
|
2
|
+
import { renderElement } from "../contracts/render.js";
|
|
3
|
+
import { ChevronGlyph, ChevronsUpDownGlyph } from "../_internal/glyphs.js";
|
|
4
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
//#region src/table/table.tsx
|
|
6
|
+
/** The table's box: the border, the radius and the horizontal scroll of a wide table. */
|
|
7
|
+
function TableContainer({ label, render, className, ...rest }) {
|
|
8
|
+
return renderElement("div", render, {}, {
|
|
9
|
+
"data-slot": "table-container",
|
|
10
|
+
...label === void 0 ? {} : {
|
|
11
|
+
role: "region",
|
|
12
|
+
"aria-label": label,
|
|
13
|
+
tabIndex: 0
|
|
14
|
+
},
|
|
15
|
+
...rest,
|
|
16
|
+
className: cx("nz-table-container", className)
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
function TableRoot({ render, className, ...rest }) {
|
|
20
|
+
return renderElement("table", render, {}, {
|
|
21
|
+
"data-slot": "table",
|
|
22
|
+
...rest,
|
|
23
|
+
className: cx("nz-table", className)
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
/** The table's name. Give every table one: a caption, or `aria-labelledby` to a visible heading. */
|
|
27
|
+
function TableCaption({ visuallyHidden = false, render, className, ...rest }) {
|
|
28
|
+
return renderElement("caption", render, {}, {
|
|
29
|
+
"data-slot": "table-caption",
|
|
30
|
+
...rest,
|
|
31
|
+
className: cx("nz-table-caption", visuallyHidden && "nz-visually-hidden", className)
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
function TableHeader({ render, className, ...rest }) {
|
|
35
|
+
return renderElement("thead", render, {}, {
|
|
36
|
+
"data-slot": "table-header",
|
|
37
|
+
...rest,
|
|
38
|
+
className: cx("nz-table-header", className)
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
function TableBody({ render, className, ...rest }) {
|
|
42
|
+
return renderElement("tbody", render, {}, {
|
|
43
|
+
"data-slot": "table-body",
|
|
44
|
+
...rest,
|
|
45
|
+
className: cx("nz-table-body", className)
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
function TableFooter({ render, className, ...rest }) {
|
|
49
|
+
return renderElement("tfoot", render, {}, {
|
|
50
|
+
"data-slot": "table-footer",
|
|
51
|
+
...rest,
|
|
52
|
+
className: cx("nz-table-footer", className)
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
function TableRow({ selected = false, interactive = false, render, className, ...rest }) {
|
|
56
|
+
return renderElement("tr", render, {
|
|
57
|
+
selected,
|
|
58
|
+
interactive
|
|
59
|
+
}, {
|
|
60
|
+
"data-slot": "table-row",
|
|
61
|
+
"data-selected": selected ? "" : void 0,
|
|
62
|
+
"data-interactive": interactive ? "" : void 0,
|
|
63
|
+
...rest,
|
|
64
|
+
className: cx("nz-table-row", className)
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
function TableHead({ sort, numeric = false, scope = "col", render, className, ...rest }) {
|
|
68
|
+
return renderElement("th", render, {
|
|
69
|
+
sort,
|
|
70
|
+
numeric
|
|
71
|
+
}, {
|
|
72
|
+
"data-slot": "table-head",
|
|
73
|
+
"data-sort": sort,
|
|
74
|
+
"data-numeric": numeric ? "" : void 0,
|
|
75
|
+
"aria-sort": sort,
|
|
76
|
+
scope,
|
|
77
|
+
...rest,
|
|
78
|
+
className: cx("nz-table-head", className)
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
function TableCell({ numeric = false, render, className, ...rest }) {
|
|
82
|
+
return renderElement("td", render, { numeric }, {
|
|
83
|
+
"data-slot": "table-cell",
|
|
84
|
+
"data-numeric": numeric ? "" : void 0,
|
|
85
|
+
...rest,
|
|
86
|
+
className: cx("nz-table-cell", className)
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* The column's label as a control. Its arrow follows the `sort` of the `Table.Head` it sits in
|
|
91
|
+
* (up for ascending, down for descending, both ways when unsorted) through CSS, so it needs no
|
|
92
|
+
* client code; the `<th>`'s `aria-sort` tells assistive technology the current order.
|
|
93
|
+
*/
|
|
94
|
+
function TableSortButton({ href, render, className, children, ...rest }) {
|
|
95
|
+
return renderElement(href === void 0 ? "button" : "a", render, {}, {
|
|
96
|
+
"data-slot": "table-sort-button",
|
|
97
|
+
href,
|
|
98
|
+
type: href !== void 0 || render !== void 0 ? void 0 : "button",
|
|
99
|
+
...rest,
|
|
100
|
+
className: cx("nz-table-sort-button", "nz-hit-target", className),
|
|
101
|
+
children: /* @__PURE__ */ jsxs(Fragment, { children: [children, /* @__PURE__ */ jsxs("span", {
|
|
102
|
+
className: "nz-table-sort-icon",
|
|
103
|
+
"data-slot": "table-sort-icon",
|
|
104
|
+
"aria-hidden": "true",
|
|
105
|
+
children: [/* @__PURE__ */ jsx(ChevronsUpDownGlyph, {}), /* @__PURE__ */ jsx(ChevronGlyph, {})]
|
|
106
|
+
})] })
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* A row's link, usually its first cell's text (Figma Order Row: the order number). In a row with
|
|
111
|
+
* `interactive`, it stretches over the whole row.
|
|
112
|
+
*/
|
|
113
|
+
function TableRowLink({ render, className, ...rest }) {
|
|
114
|
+
return renderElement("a", render, {}, {
|
|
115
|
+
"data-slot": "table-row-link",
|
|
116
|
+
...rest,
|
|
117
|
+
className: cx("nz-table-row-link", className)
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
//#endregion
|
|
121
|
+
export { TableBody, TableCaption, TableCell, TableContainer, TableFooter, TableHead, TableHeader, TableRoot, TableRow, TableRowLink, TableSortButton };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { TableBody, TableCaption, TableCell, TableContainer, TableFooter, TableHead, TableHeader, TableRoot, TableRow, TableRowLink, TableSortButton } from "./table.js";
|
|
2
|
+
declare namespace table_parts_d_exports {
|
|
3
|
+
export { TableBody as Body, TableCaption as Caption, TableCell as Cell, TableContainer as Container, TableFooter as Footer, TableHead as Head, TableHeader as Header, TableRoot as Root, TableRow as Row, TableRowLink as RowLink, TableSortButton as SortButton };
|
|
4
|
+
}
|
|
5
|
+
//#endregion
|
|
6
|
+
export { TableBody as Body, TableCaption as Caption, TableCell as Cell, TableContainer as Container, TableFooter as Footer, TableHead as Head, TableHeader as Header, TableRoot as Root, TableRow as Row, TableRowLink as RowLink, TableSortButton as SortButton, table_parts_d_exports };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { __exportAll } from "../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { TableBody, TableCaption, TableCell, TableContainer, TableFooter, TableHead, TableHeader, TableRoot, TableRow, TableRowLink, TableSortButton } from "./table.js";
|
|
3
|
+
//#region src/table/table.parts.ts
|
|
4
|
+
var table_parts_exports = /* @__PURE__ */ __exportAll({
|
|
5
|
+
Body: () => TableBody,
|
|
6
|
+
Caption: () => TableCaption,
|
|
7
|
+
Cell: () => TableCell,
|
|
8
|
+
Container: () => TableContainer,
|
|
9
|
+
Footer: () => TableFooter,
|
|
10
|
+
Head: () => TableHead,
|
|
11
|
+
Header: () => TableHeader,
|
|
12
|
+
Root: () => TableRoot,
|
|
13
|
+
Row: () => TableRow,
|
|
14
|
+
RowLink: () => TableRowLink,
|
|
15
|
+
SortButton: () => TableSortButton
|
|
16
|
+
});
|
|
17
|
+
//#endregion
|
|
18
|
+
export { TableBody as Body, TableCaption as Caption, TableCell as Cell, TableContainer as Container, TableFooter as Footer, TableHead as Head, TableHeader as Header, TableRoot as Root, TableRow as Row, TableRowLink as RowLink, TableSortButton as SortButton, table_parts_exports };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { TableSelection, TableSelectionProps } from "./table-selection.client.js";
|
|
2
|
+
import { TableSelectAll, TableSelectAllProps, TableSelectRow, TableSelectRowProps, TableSelectionLabels } from "./table-selection.js";
|
|
3
|
+
export { TableSelectAll, type TableSelectAllProps, TableSelectRow, type TableSelectRowProps, TableSelection, type TableSelectionLabels, type TableSelectionProps };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { RenderProp } from "../contracts/render.js";
|
|
2
|
+
import { ComponentPropsWithRef, ReactElement } from "react";
|
|
3
|
+
//#region src/table-selection/table-selection.client.d.ts
|
|
4
|
+
export interface TableSelectionProps extends Omit<ComponentPropsWithRef<"div">, "ref"> {
|
|
5
|
+
/**
|
|
6
|
+
* The selected rows' values, after every change (and once on mount when a row is already
|
|
7
|
+
* checked, for example by the browser's form restoration). For a client owner; a Server Component
|
|
8
|
+
* reads the selection from the form.
|
|
9
|
+
*/
|
|
10
|
+
onSelectionChange?: (ids: string[]) => void;
|
|
11
|
+
render?: RenderProp<Record<string, never>>;
|
|
12
|
+
}
|
|
13
|
+
export declare function TableSelection({ onSelectionChange, render, className, ...rest }: TableSelectionProps): ReactElement;
|
|
14
|
+
//#endregion
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cx } from "../_internal/cx.js";
|
|
3
|
+
import { renderElement } from "../contracts/render.js";
|
|
4
|
+
import { useEffect, useRef } from "react";
|
|
5
|
+
//#region src/table-selection/table-selection.client.tsx
|
|
6
|
+
const ROW = "[data-slot=\"table-select-row-input\"]";
|
|
7
|
+
const ALL = "[data-slot=\"table-select-all-input\"]";
|
|
8
|
+
function TableSelection({ onSelectionChange, render, className, ...rest }) {
|
|
9
|
+
const root = useRef(null);
|
|
10
|
+
const report = useRef(onSelectionChange);
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
report.current = onSelectionChange;
|
|
13
|
+
});
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
const element = root.current;
|
|
16
|
+
if (element === null) return void 0;
|
|
17
|
+
const rows = () => [...element.querySelectorAll(ROW)];
|
|
18
|
+
let last = "";
|
|
19
|
+
let anchor;
|
|
20
|
+
let shift = false;
|
|
21
|
+
/** The select-all boxes follow the rows; the owner hears of a changed selection. */
|
|
22
|
+
const sync = () => {
|
|
23
|
+
const all = rows().filter((input) => !input.disabled);
|
|
24
|
+
const checked = all.filter((input) => input.checked);
|
|
25
|
+
for (const box of element.querySelectorAll(ALL)) {
|
|
26
|
+
box.checked = all.length > 0 && checked.length === all.length;
|
|
27
|
+
box.indeterminate = checked.length > 0 && checked.length < all.length;
|
|
28
|
+
}
|
|
29
|
+
const ids = rows().filter((input) => input.checked).map((input) => input.value);
|
|
30
|
+
const key = ids.join("\0");
|
|
31
|
+
if (key !== last) {
|
|
32
|
+
last = key;
|
|
33
|
+
report.current?.(ids);
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
const onClick = (event) => {
|
|
37
|
+
shift = event.shiftKey;
|
|
38
|
+
};
|
|
39
|
+
const onChange = (event) => {
|
|
40
|
+
const target = event.target;
|
|
41
|
+
if (!(target instanceof HTMLInputElement)) return;
|
|
42
|
+
if (target.matches(ALL)) {
|
|
43
|
+
for (const input of rows()) if (!input.disabled) input.checked = target.checked;
|
|
44
|
+
anchor = void 0;
|
|
45
|
+
} else if (target.matches(ROW)) {
|
|
46
|
+
const list = rows();
|
|
47
|
+
if (shift && anchor !== void 0 && anchor !== target && list.includes(anchor)) {
|
|
48
|
+
const [a, b] = [list.indexOf(anchor), list.indexOf(target)];
|
|
49
|
+
for (const input of list.slice(Math.min(a, b), Math.max(a, b) + 1)) if (!input.disabled) input.checked = target.checked;
|
|
50
|
+
}
|
|
51
|
+
anchor = target;
|
|
52
|
+
} else return;
|
|
53
|
+
shift = false;
|
|
54
|
+
sync();
|
|
55
|
+
};
|
|
56
|
+
const onKeyDown = (event) => {
|
|
57
|
+
if (event.key !== "Escape" || event.defaultPrevented) return;
|
|
58
|
+
const checked = rows().filter((input) => input.checked && !input.disabled);
|
|
59
|
+
if (checked.length === 0) return;
|
|
60
|
+
for (const input of checked) input.checked = false;
|
|
61
|
+
event.preventDefault();
|
|
62
|
+
event.stopPropagation();
|
|
63
|
+
anchor = void 0;
|
|
64
|
+
sync();
|
|
65
|
+
};
|
|
66
|
+
element.addEventListener("click", onClick, true);
|
|
67
|
+
element.addEventListener("change", onChange);
|
|
68
|
+
element.addEventListener("keydown", onKeyDown);
|
|
69
|
+
sync();
|
|
70
|
+
return () => {
|
|
71
|
+
element.removeEventListener("click", onClick, true);
|
|
72
|
+
element.removeEventListener("change", onChange);
|
|
73
|
+
element.removeEventListener("keydown", onKeyDown);
|
|
74
|
+
};
|
|
75
|
+
}, []);
|
|
76
|
+
return renderElement("div", render, {}, {
|
|
77
|
+
"data-slot": "table-selection",
|
|
78
|
+
ref: root,
|
|
79
|
+
...rest,
|
|
80
|
+
className: cx("nz-table-selection", className)
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
//#endregion
|
|
84
|
+
export { TableSelection };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { ComponentPropsWithRef, ReactElement } from "react";
|
|
2
|
+
//#region src/table-selection/table-selection.d.ts
|
|
3
|
+
/** Row selection's own strings (§16.4): serialisable, English defaults. */
|
|
4
|
+
export interface TableSelectionLabels {
|
|
5
|
+
/** The select-all checkbox's name. @default 'Select all rows' */
|
|
6
|
+
selectAll: string;
|
|
7
|
+
}
|
|
8
|
+
type CheckboxInputProps = Omit<ComponentPropsWithRef<"input">, "type" | "children" | "checked" | "defaultChecked">;
|
|
9
|
+
export interface TableSelectAllProps extends CheckboxInputProps {
|
|
10
|
+
/** An `aria-label` wins over `labels.selectAll`. */
|
|
11
|
+
labels?: Partial<TableSelectionLabels>;
|
|
12
|
+
}
|
|
13
|
+
export interface TableSelectRowProps extends CheckboxInputProps {
|
|
14
|
+
/** The row's id: what a form receives under `name` when the row is selected. */
|
|
15
|
+
value: string;
|
|
16
|
+
/** The checkbox's name, unique per row, for example "Select order 1042". */
|
|
17
|
+
"aria-label": string;
|
|
18
|
+
/** @default 'ids' */
|
|
19
|
+
name?: string;
|
|
20
|
+
/** Selected when the page loads. @default false */
|
|
21
|
+
defaultChecked?: boolean;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* The header's checkbox: checks or clears every row of its `TableSelection`, and shows the mixed
|
|
25
|
+
* state when some are selected. It submits nothing. Without `TableSelection` it does nothing.
|
|
26
|
+
*/
|
|
27
|
+
export declare function TableSelectAll({ labels, className, ...rest }: TableSelectAllProps): ReactElement;
|
|
28
|
+
/**
|
|
29
|
+
* A row's checkbox: a native input that submits `value` under `name` with its form (pass `form` to
|
|
30
|
+
* reach a form outside the table). The row shows `bg/brand-subtle` while it is checked, through CSS.
|
|
31
|
+
*/
|
|
32
|
+
export declare function TableSelectRow({ name, className, ...rest }: TableSelectRowProps): ReactElement;
|
|
33
|
+
//#endregion
|
|
34
|
+
export {};
|