@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,62 @@
|
|
|
1
|
+
import { cx } from "../_internal/cx.js";
|
|
2
|
+
import { renderElement } from "../contracts/render.js";
|
|
3
|
+
//#region src/card/card.tsx
|
|
4
|
+
function CardRoot({ tone = "surface", padding = "md", elevation = 0, render, className, ...rest }) {
|
|
5
|
+
return renderElement("div", render, {
|
|
6
|
+
tone,
|
|
7
|
+
padding,
|
|
8
|
+
elevation
|
|
9
|
+
}, {
|
|
10
|
+
"data-slot": "card",
|
|
11
|
+
"data-tone": tone,
|
|
12
|
+
"data-padding": padding,
|
|
13
|
+
"data-elevation": elevation === 1 ? "1" : void 0,
|
|
14
|
+
"data-nz-scheme": tone === "inverse" ? "inverse" : void 0,
|
|
15
|
+
...rest,
|
|
16
|
+
className: cx("nz-card", className)
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
function CardHeader({ render, className, ...rest }) {
|
|
20
|
+
return renderElement("div", render, {}, {
|
|
21
|
+
"data-slot": "card-header",
|
|
22
|
+
...rest,
|
|
23
|
+
className: cx("nz-card-header", className)
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
function CardTitle({ level = 3, render, className, ...rest }) {
|
|
27
|
+
return renderElement(`h${level}`, render, {}, {
|
|
28
|
+
"data-slot": "card-title",
|
|
29
|
+
...rest,
|
|
30
|
+
className: cx("nz-card-title", className)
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
function CardDescription({ render, className, ...rest }) {
|
|
34
|
+
return renderElement("p", render, {}, {
|
|
35
|
+
"data-slot": "card-description",
|
|
36
|
+
...rest,
|
|
37
|
+
className: cx("nz-card-description", className)
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
function CardAction({ render, className, ...rest }) {
|
|
41
|
+
return renderElement("div", render, {}, {
|
|
42
|
+
"data-slot": "card-action",
|
|
43
|
+
...rest,
|
|
44
|
+
className: cx("nz-card-action", className)
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
function CardBody({ render, className, ...rest }) {
|
|
48
|
+
return renderElement("div", render, {}, {
|
|
49
|
+
"data-slot": "card-body",
|
|
50
|
+
...rest,
|
|
51
|
+
className: cx("nz-card-body", className)
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
function CardFooter({ render, className, ...rest }) {
|
|
55
|
+
return renderElement("div", render, {}, {
|
|
56
|
+
"data-slot": "card-footer",
|
|
57
|
+
...rest,
|
|
58
|
+
className: cx("nz-card-footer", className)
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
//#endregion
|
|
62
|
+
export { CardAction, CardBody, CardDescription, CardFooter, CardHeader, CardRoot, CardTitle };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { CardAction, CardBody, CardDescription, CardFooter, CardHeader, CardRoot, CardTitle } from "./card.js";
|
|
2
|
+
declare namespace card_parts_d_exports {
|
|
3
|
+
export { CardAction as Action, CardBody as Body, CardDescription as Description, CardFooter as Footer, CardHeader as Header, CardRoot as Root, CardTitle as Title };
|
|
4
|
+
}
|
|
5
|
+
//#endregion
|
|
6
|
+
export { CardAction as Action, CardBody as Body, CardDescription as Description, CardFooter as Footer, CardHeader as Header, CardRoot as Root, CardTitle as Title, card_parts_d_exports };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { __exportAll } from "../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { CardAction, CardBody, CardDescription, CardFooter, CardHeader, CardRoot, CardTitle } from "./card.js";
|
|
3
|
+
//#region src/card/card.parts.ts
|
|
4
|
+
var card_parts_exports = /* @__PURE__ */ __exportAll({
|
|
5
|
+
Action: () => CardAction,
|
|
6
|
+
Body: () => CardBody,
|
|
7
|
+
Description: () => CardDescription,
|
|
8
|
+
Footer: () => CardFooter,
|
|
9
|
+
Header: () => CardHeader,
|
|
10
|
+
Root: () => CardRoot,
|
|
11
|
+
Title: () => CardTitle
|
|
12
|
+
});
|
|
13
|
+
//#endregion
|
|
14
|
+
export { CardAction as Action, CardBody as Body, CardDescription as Description, CardFooter as Footer, CardHeader as Header, CardRoot as Root, CardTitle as Title, card_parts_exports };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { CardAction, CardActionProps, CardBody, CardBodyProps, CardDescription, CardDescriptionProps, CardElevation, CardFooter, CardFooterProps, CardHeader, CardHeaderProps, CardPadding, CardRoot, CardRootProps, CardRootState, CardTitle, CardTitleLevel, CardTitleProps, CardTone } from "./card.js";
|
|
2
|
+
import { card_parts_d_exports } from "./card.parts.js";
|
|
3
|
+
export { card_parts_d_exports as Card, CardAction, type CardActionProps, CardBody, type CardBodyProps, CardDescription, type CardDescriptionProps, type CardElevation, CardFooter, type CardFooterProps, CardHeader, type CardHeaderProps, type CardPadding, CardRoot, type CardRootProps, type CardRootState, CardTitle, type CardTitleLevel, type CardTitleProps, type CardTone };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { CardAction, CardBody, CardDescription, CardFooter, CardHeader, CardRoot, CardTitle } from "./card.js";
|
|
2
|
+
import { card_parts_exports } from "./card.parts.js";
|
|
3
|
+
export { card_parts_exports as Card, CardAction, CardBody, CardDescription, CardFooter, CardHeader, CardRoot, CardTitle };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { RenderProp } from "../contracts/render.js";
|
|
2
|
+
import { ChangeDetails } from "../contracts/details.js";
|
|
3
|
+
import { ComponentPropsWithRef, ReactElement, ReactNode } from "react";
|
|
4
|
+
//#region src/checkbox/checkbox.client.d.ts
|
|
5
|
+
/** `'indeterminate'` is the mixed state of a "select all" box; it submits as unchecked. */
|
|
6
|
+
export type CheckboxCheckedState = boolean | "indeterminate";
|
|
7
|
+
/** Every change comes from the native `change` event: a click, Space, or a click on the label. */
|
|
8
|
+
export type CheckboxChangeReason = "input";
|
|
9
|
+
/** What a `render` function receives for the root `<label>`. */
|
|
10
|
+
export interface CheckboxState {
|
|
11
|
+
/** An error message is presented (the Field's, or the `invalid` prop). */
|
|
12
|
+
invalid: boolean;
|
|
13
|
+
disabled: boolean;
|
|
14
|
+
required: boolean;
|
|
15
|
+
}
|
|
16
|
+
export interface CheckboxProps extends Omit<ComponentPropsWithRef<"input">, "type" | "checked" | "defaultChecked" | "children" | "readOnly" | "size"> {
|
|
17
|
+
/** Controlled state. `'indeterminate'` shows the dash; a click then reports `true`. */
|
|
18
|
+
checked?: CheckboxCheckedState;
|
|
19
|
+
/** Uncontrolled initial state. @default false */
|
|
20
|
+
defaultChecked?: CheckboxCheckedState;
|
|
21
|
+
/** Called after the consumer's own `onChange`, unless it called `preventDefault()`. */
|
|
22
|
+
onCheckedChange?: (checked: boolean, details: ChangeDetails<CheckboxChangeReason>) => void;
|
|
23
|
+
/** An error message is presented for this box. Inside a Field, the Field decides. */
|
|
24
|
+
invalid?: boolean;
|
|
25
|
+
/** Replaces the internal check and dash glyphs (decorative), shown while checked or mixed. */
|
|
26
|
+
indicator?: ReactNode;
|
|
27
|
+
/** Composition of the root `<label>`, the hit target. */
|
|
28
|
+
render?: RenderProp<CheckboxState>;
|
|
29
|
+
/** The label, after the box. Without one, name the box with `aria-label`. */
|
|
30
|
+
children?: ReactNode;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* `className` and `style` go on the root `<label>`; every other attribute, `ref` included, goes on the
|
|
34
|
+
* native `<input>`, so form libraries (`register`, `setFocus`) reach the real control.
|
|
35
|
+
*/
|
|
36
|
+
export declare function Checkbox({ id, name, required, disabled, invalid, "aria-describedby": describedBy, checked, defaultChecked, onCheckedChange, indicator, render, className, style, children, ...rest }: CheckboxProps): ReactElement;
|
|
37
|
+
//#endregion
|
|
@@ -0,0 +1,81 @@
|
|
|
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 { CheckGlyph, MinusGlyph } from "../_internal/glyphs.js";
|
|
6
|
+
import { details } from "../contracts/details.js";
|
|
7
|
+
import { stateAttrs } from "../contracts/state.js";
|
|
8
|
+
import { presented } from "../_internal/field.js";
|
|
9
|
+
import { useFieldControl } from "../field/field-scope.client.js";
|
|
10
|
+
import { useLayoutEffect, useRef } from "react";
|
|
11
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
12
|
+
//#region src/checkbox/checkbox.client.tsx
|
|
13
|
+
/**
|
|
14
|
+
* `className` and `style` go on the root `<label>`; every other attribute, `ref` included, goes on the
|
|
15
|
+
* native `<input>`, so form libraries (`register`, `setFocus`) reach the real control.
|
|
16
|
+
*/
|
|
17
|
+
function Checkbox({ id, name, required, disabled, invalid, "aria-describedby": describedBy, checked, defaultChecked, onCheckedChange, indicator, render, className, style, children, ...rest }) {
|
|
18
|
+
const field = useFieldControl({
|
|
19
|
+
id,
|
|
20
|
+
name,
|
|
21
|
+
required,
|
|
22
|
+
disabled,
|
|
23
|
+
invalid,
|
|
24
|
+
"aria-describedby": describedBy
|
|
25
|
+
});
|
|
26
|
+
const { readOnly: _readOnly, ...control } = field.controlProps;
|
|
27
|
+
const input = useRef(null);
|
|
28
|
+
const initiallyMixed = useRef(defaultChecked === "indeterminate");
|
|
29
|
+
const mixed = checked === void 0 ? void 0 : checked === "indeterminate";
|
|
30
|
+
useLayoutEffect(() => {
|
|
31
|
+
const element = input.current;
|
|
32
|
+
if (element === null) return;
|
|
33
|
+
if (mixed !== void 0) element.indeterminate = mixed;
|
|
34
|
+
else if (initiallyMixed.current) {
|
|
35
|
+
element.indeterminate = true;
|
|
36
|
+
initiallyMixed.current = false;
|
|
37
|
+
}
|
|
38
|
+
}, [mixed]);
|
|
39
|
+
const own = {
|
|
40
|
+
...control,
|
|
41
|
+
ref: input,
|
|
42
|
+
checked: checked === void 0 ? void 0 : checked === true,
|
|
43
|
+
defaultChecked: defaultChecked === void 0 ? void 0 : defaultChecked === true,
|
|
44
|
+
onChange(event) {
|
|
45
|
+
if (mixed === true) event.currentTarget.indeterminate = true;
|
|
46
|
+
onCheckedChange?.(event.currentTarget.checked, details("input", event.nativeEvent));
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
const state = {
|
|
50
|
+
invalid: field.invalid,
|
|
51
|
+
disabled: field.disabled,
|
|
52
|
+
required: field.required
|
|
53
|
+
};
|
|
54
|
+
return renderElement("label", render, state, {
|
|
55
|
+
"data-slot": "checkbox",
|
|
56
|
+
...stateAttrs(state),
|
|
57
|
+
className: cx("nz-checkbox nz-hit-target", className),
|
|
58
|
+
style,
|
|
59
|
+
children: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
60
|
+
/* @__PURE__ */ jsx("input", {
|
|
61
|
+
...mergeProps(own, rest),
|
|
62
|
+
type: "checkbox",
|
|
63
|
+
className: "nz-checkbox-input",
|
|
64
|
+
"data-slot": "checkbox-input"
|
|
65
|
+
}),
|
|
66
|
+
/* @__PURE__ */ jsx("span", {
|
|
67
|
+
className: "nz-checkbox-indicator",
|
|
68
|
+
"data-slot": "checkbox-indicator",
|
|
69
|
+
"aria-hidden": "true",
|
|
70
|
+
children: indicator ?? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(CheckGlyph, {}), /* @__PURE__ */ jsx(MinusGlyph, {})] })
|
|
71
|
+
}),
|
|
72
|
+
presented(children) && /* @__PURE__ */ jsx("span", {
|
|
73
|
+
className: "nz-checkbox-label",
|
|
74
|
+
"data-slot": "checkbox-label",
|
|
75
|
+
children
|
|
76
|
+
})
|
|
77
|
+
] })
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
//#endregion
|
|
81
|
+
export { Checkbox };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Checkbox } from "./checkbox.client.js";
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { RenderProp } from "../contracts/render.js";
|
|
2
|
+
import { ChangeDetails } from "../contracts/details.js";
|
|
3
|
+
import { ComponentPropsWithRef, JSX, ReactNode } from "react";
|
|
4
|
+
//#region src/chip-group/chip-group.client.d.ts
|
|
5
|
+
/** Why the value changed: the user checked or cleared an input (a pointer or a key). */
|
|
6
|
+
export type ChipGroupChangeReason = "input";
|
|
7
|
+
/** ChipGroup's own strings (§16.4): serialisable, English defaults. */
|
|
8
|
+
export interface ChipGroupLabels {
|
|
9
|
+
/**
|
|
10
|
+
* Describes an `unavailable` chip (out of stock), read after its name; the strike-through is
|
|
11
|
+
* only visual. @default 'Unavailable'
|
|
12
|
+
*/
|
|
13
|
+
unavailable: string;
|
|
14
|
+
}
|
|
15
|
+
export interface ChipGroupState {
|
|
16
|
+
multiple: boolean;
|
|
17
|
+
disabled: boolean;
|
|
18
|
+
invalid: boolean;
|
|
19
|
+
}
|
|
20
|
+
/** What `onValueChange` receives: the checked value, or with `multiple` every checked value. */
|
|
21
|
+
export type ChipGroupValue<M extends boolean> = M extends true ? string[] : string;
|
|
22
|
+
/**
|
|
23
|
+
* `M` is `true` when `multiple` is: TypeScript infers it from the prop, so `value`, `defaultValue`
|
|
24
|
+
* and `onValueChange` take arrays exactly when the chips are checkboxes.
|
|
25
|
+
*/
|
|
26
|
+
export interface ChipGroupProps<M extends boolean = false> extends Omit<ComponentPropsWithRef<"div">, "defaultValue" | "onChange" | "role"> {
|
|
27
|
+
/**
|
|
28
|
+
* Any number of values: native checkboxes under `role="group"`. Without it, one value: native
|
|
29
|
+
* radios under `role="radiogroup"`. @default false
|
|
30
|
+
*/
|
|
31
|
+
multiple?: M;
|
|
32
|
+
/** Controlled: the checked chip's `value` (or `null` for none); with `multiple`, every one's. */
|
|
33
|
+
value?: M extends true ? readonly string[] : string | null;
|
|
34
|
+
/** The chip, or with `multiple` the chips, checked at first (`form.reset()` returns to them). */
|
|
35
|
+
defaultValue?: M extends true ? readonly string[] : string;
|
|
36
|
+
/**
|
|
37
|
+
* Called when the user checks a chip (or, with `multiple`, checks or clears one), with every checked
|
|
38
|
+
* value in document order; `details.event` is the native `change` event.
|
|
39
|
+
*/
|
|
40
|
+
onValueChange?: (value: ChipGroupValue<M>, details: ChangeDetails<ChipGroupChangeReason>) => void;
|
|
41
|
+
/**
|
|
42
|
+
* A choice must be made before the form submits. One value only: on checkboxes the browser would
|
|
43
|
+
* require every one.
|
|
44
|
+
*/
|
|
45
|
+
required?: M extends true ? never : boolean;
|
|
46
|
+
/**
|
|
47
|
+
* The inputs' shared name, and the `FormData` key (a multiple group submits one entry per checked
|
|
48
|
+
* chip). Without one (and outside a named Field), a generated name groups the inputs.
|
|
49
|
+
*/
|
|
50
|
+
name?: string;
|
|
51
|
+
/** The `<form>` the inputs belong to, when they are outside it. */
|
|
52
|
+
form?: string;
|
|
53
|
+
/** Disables every chip. */
|
|
54
|
+
disabled?: boolean;
|
|
55
|
+
/** An error message is presented (set by a Field). */
|
|
56
|
+
invalid?: boolean;
|
|
57
|
+
labels?: Partial<ChipGroupLabels>;
|
|
58
|
+
render?: RenderProp<ChipGroupState>;
|
|
59
|
+
/** `Chip` elements. */
|
|
60
|
+
children?: ReactNode;
|
|
61
|
+
}
|
|
62
|
+
export interface ChipState {
|
|
63
|
+
disabled: boolean;
|
|
64
|
+
unavailable: boolean;
|
|
65
|
+
}
|
|
66
|
+
export interface ChipProps extends Omit<ComponentPropsWithRef<"label">, "htmlFor" | "aria-label"> {
|
|
67
|
+
/** This chip's value: what `onValueChange` receives and the form submits. */
|
|
68
|
+
value: string;
|
|
69
|
+
disabled?: boolean;
|
|
70
|
+
/**
|
|
71
|
+
* Out of stock, or otherwise not available: it keeps its colour, gets a strike-through and is
|
|
72
|
+
* described as `labels.unavailable`. It can still be chosen (to show "Notify me", for example);
|
|
73
|
+
* add `disabled` to stop that. @default false
|
|
74
|
+
*/
|
|
75
|
+
unavailable?: boolean;
|
|
76
|
+
/**
|
|
77
|
+
* A swatch or glyph before the text (Figma Type=Colour), in a 24 px circle; decorative. A colour
|
|
78
|
+
* is data: pass an element with that background, such as `<span style={{ background: '#2e5a3c' }} />`.
|
|
79
|
+
*/
|
|
80
|
+
leading?: ReactNode;
|
|
81
|
+
/** Names a chip with no text (a swatch only): it goes on the input, which is what is announced. */
|
|
82
|
+
"aria-label"?: string;
|
|
83
|
+
render?: RenderProp<ChipState>;
|
|
84
|
+
children?: ReactNode;
|
|
85
|
+
}
|
|
86
|
+
export declare function ChipGroup<M extends boolean = false>({ multiple: multipleProp, value: valueProp, defaultValue: defaultValueProp, onValueChange: onValueChangeProp, name, form, required: requiredProp, disabled, invalid, labels: labelsProp, "aria-describedby": describedBy, "aria-labelledby": labelledBy, render, className, children, ...rest }: ChipGroupProps<M>): JSX.Element;
|
|
87
|
+
export declare function Chip({ value, disabled, unavailable, leading, "aria-label": ariaLabel, render, className, children, ...rest }: ChipProps): JSX.Element;
|
|
88
|
+
//#endregion
|
|
@@ -0,0 +1,157 @@
|
|
|
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 { useLabels } from "../config/config.client.js";
|
|
6
|
+
import { details } from "../contracts/details.js";
|
|
7
|
+
import { stateAttrs } from "../contracts/state.js";
|
|
8
|
+
import { useFieldControl } from "../field/field-scope.client.js";
|
|
9
|
+
import { clearFocus, definedProps, markFocus, markKeyDown } from "../_internal/nested-focus.js";
|
|
10
|
+
import { createContext, use, useId, useMemo } from "react";
|
|
11
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
12
|
+
//#region src/chip-group/chip-group.client.tsx
|
|
13
|
+
const GroupContext = createContext(null);
|
|
14
|
+
function ChipGroup({ multiple: multipleProp, value: valueProp, defaultValue: defaultValueProp, onValueChange: onValueChangeProp, name, form, required: requiredProp, disabled, invalid, labels: labelsProp, "aria-describedby": describedBy, "aria-labelledby": labelledBy, render, className, children, ...rest }) {
|
|
15
|
+
const labels = useLabels("chipGroup", labelsProp);
|
|
16
|
+
const multiple = multipleProp === true;
|
|
17
|
+
const value = valueProp;
|
|
18
|
+
const defaultValue = defaultValueProp;
|
|
19
|
+
const required = requiredProp;
|
|
20
|
+
const onValueChange = onValueChangeProp;
|
|
21
|
+
const field = useFieldControl({
|
|
22
|
+
name,
|
|
23
|
+
required: multiple ? false : required,
|
|
24
|
+
disabled,
|
|
25
|
+
invalid,
|
|
26
|
+
"aria-describedby": describedBy
|
|
27
|
+
});
|
|
28
|
+
const generated = useId();
|
|
29
|
+
const { required: inputRequired, onInvalid, onInput, onBlur } = field.controlProps;
|
|
30
|
+
const groupName = field.name ?? generated;
|
|
31
|
+
const unavailable = labels?.unavailable ?? "Unavailable";
|
|
32
|
+
const group = useMemo(() => {
|
|
33
|
+
const controlled = value !== void 0;
|
|
34
|
+
const has = (list, item) => typeof list === "string" ? list === item : list?.includes(item) === true;
|
|
35
|
+
return {
|
|
36
|
+
name: groupName,
|
|
37
|
+
multiple,
|
|
38
|
+
checkedProps: (item) => controlled ? { checked: has(value, item) } : { defaultChecked: has(defaultValue, item) },
|
|
39
|
+
disabled: field.disabled,
|
|
40
|
+
invalid: field.invalid,
|
|
41
|
+
unavailable,
|
|
42
|
+
input: definedProps({
|
|
43
|
+
required: multiple ? void 0 : inputRequired,
|
|
44
|
+
form,
|
|
45
|
+
onInvalid,
|
|
46
|
+
onInput,
|
|
47
|
+
onBlur
|
|
48
|
+
}),
|
|
49
|
+
onChange(item, event) {
|
|
50
|
+
if (onValueChange === void 0) return;
|
|
51
|
+
const target = event.currentTarget;
|
|
52
|
+
if (!multiple) {
|
|
53
|
+
if (target.checked) onValueChange(item, details("input", event.nativeEvent));
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
const checked = [...target.closest("[data-slot=\"chip-group\"]")?.querySelectorAll("input[data-slot=\"chip-input\"]") ?? []].filter((input) => input.name === groupName && input.checked).map((input) => input.value);
|
|
57
|
+
onValueChange(checked, details("input", event.nativeEvent));
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
}, [
|
|
61
|
+
groupName,
|
|
62
|
+
multiple,
|
|
63
|
+
value,
|
|
64
|
+
defaultValue,
|
|
65
|
+
field.disabled,
|
|
66
|
+
field.invalid,
|
|
67
|
+
unavailable,
|
|
68
|
+
inputRequired,
|
|
69
|
+
form,
|
|
70
|
+
onInvalid,
|
|
71
|
+
onInput,
|
|
72
|
+
onBlur,
|
|
73
|
+
onValueChange
|
|
74
|
+
]);
|
|
75
|
+
return /* @__PURE__ */ jsx(GroupContext, {
|
|
76
|
+
value: group,
|
|
77
|
+
children: renderElement("div", render, {
|
|
78
|
+
multiple,
|
|
79
|
+
disabled: field.disabled,
|
|
80
|
+
invalid: field.invalid
|
|
81
|
+
}, {
|
|
82
|
+
"data-slot": "chip-group",
|
|
83
|
+
...stateAttrs({
|
|
84
|
+
disabled: field.disabled,
|
|
85
|
+
invalid: field.invalid,
|
|
86
|
+
required: field.required
|
|
87
|
+
}),
|
|
88
|
+
...rest,
|
|
89
|
+
role: multiple ? "group" : "radiogroup",
|
|
90
|
+
"aria-labelledby": labelledBy ?? field.labelledBy,
|
|
91
|
+
"aria-describedby": field.describedBy,
|
|
92
|
+
"aria-invalid": !multiple && field.invalid ? true : void 0,
|
|
93
|
+
"aria-required": !multiple && field.required ? true : void 0,
|
|
94
|
+
className: cx("nz-chip-group", className),
|
|
95
|
+
children
|
|
96
|
+
})
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
function Chip({ value, disabled, unavailable = false, leading, "aria-label": ariaLabel, render, className, children, ...rest }) {
|
|
100
|
+
const group = use(GroupContext);
|
|
101
|
+
if (group === null) throw new Error("Chip must be inside ChipGroup");
|
|
102
|
+
const off = disabled === true || group.disabled;
|
|
103
|
+
const noteId = useId();
|
|
104
|
+
const strike = unavailable ? /* @__PURE__ */ jsx("span", {
|
|
105
|
+
className: "nz-chip-strike",
|
|
106
|
+
"data-slot": "chip-strike",
|
|
107
|
+
"aria-hidden": "true"
|
|
108
|
+
}) : null;
|
|
109
|
+
return renderElement("label", render, {
|
|
110
|
+
disabled: off,
|
|
111
|
+
unavailable
|
|
112
|
+
}, {
|
|
113
|
+
"data-slot": "chip",
|
|
114
|
+
...stateAttrs({ disabled: off }),
|
|
115
|
+
...rest,
|
|
116
|
+
className: cx("nz-chip", className),
|
|
117
|
+
children: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
118
|
+
/* @__PURE__ */ jsx("input", {
|
|
119
|
+
...mergeProps(group.input, {
|
|
120
|
+
onChange: (event) => group.onChange(value, event),
|
|
121
|
+
onFocus: markFocus,
|
|
122
|
+
onBlur: clearFocus,
|
|
123
|
+
onKeyDown: markKeyDown
|
|
124
|
+
}),
|
|
125
|
+
...group.checkedProps(value),
|
|
126
|
+
type: group.multiple ? "checkbox" : "radio",
|
|
127
|
+
className: "nz-chip-input",
|
|
128
|
+
"data-slot": "chip-input",
|
|
129
|
+
name: group.name,
|
|
130
|
+
value,
|
|
131
|
+
disabled: off || void 0,
|
|
132
|
+
"aria-label": ariaLabel,
|
|
133
|
+
"aria-describedby": unavailable ? noteId : void 0,
|
|
134
|
+
"aria-invalid": group.multiple && group.invalid ? true : void 0
|
|
135
|
+
}),
|
|
136
|
+
leading != null && /* @__PURE__ */ jsxs("span", {
|
|
137
|
+
className: "nz-chip-leading",
|
|
138
|
+
"data-slot": "chip-leading",
|
|
139
|
+
"aria-hidden": "true",
|
|
140
|
+
children: [leading, strike]
|
|
141
|
+
}),
|
|
142
|
+
children != null && /* @__PURE__ */ jsx("span", {
|
|
143
|
+
className: "nz-chip-label",
|
|
144
|
+
"data-slot": "chip-label",
|
|
145
|
+
children
|
|
146
|
+
}),
|
|
147
|
+
leading == null && strike,
|
|
148
|
+
unavailable && /* @__PURE__ */ jsx("span", {
|
|
149
|
+
id: noteId,
|
|
150
|
+
hidden: true,
|
|
151
|
+
children: group.unavailable
|
|
152
|
+
})
|
|
153
|
+
] })
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
//#endregion
|
|
157
|
+
export { Chip, ChipGroup };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { Chip, ChipGroup, ChipGroupChangeReason, ChipGroupLabels, ChipGroupProps, ChipGroupState, ChipGroupValue, ChipProps, ChipState } from "./chip-group.client.js";
|
|
2
|
+
export { Chip, ChipGroup, type ChipGroupChangeReason, type ChipGroupLabels, type ChipGroupProps, type ChipGroupState, type ChipGroupValue, type ChipProps, type ChipState };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Chip, ChipGroup } from "./chip-group.client.js";
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { RenderProp } from "../contracts/render.js";
|
|
2
|
+
import { ChangeDetails } from "../contracts/details.js";
|
|
3
|
+
import { ComponentPropsWithRef, JSX, ReactNode } from "react";
|
|
4
|
+
//#region src/choice-card/choice-card.client.d.ts
|
|
5
|
+
/** Why the value changed: the user checked a radio (a pointer or a key). */
|
|
6
|
+
export type ChoiceCardChangeReason = "input";
|
|
7
|
+
export interface ChoiceCardGroupState {
|
|
8
|
+
disabled: boolean;
|
|
9
|
+
invalid: boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface ChoiceCardGroupProps extends Omit<ComponentPropsWithRef<"div">, "defaultValue" | "onChange" | "role"> {
|
|
12
|
+
/** Controlled: the checked card's `value`, or `null` for none. */
|
|
13
|
+
value?: string | null;
|
|
14
|
+
/** The card checked at first (uncontrolled; `form.reset()` returns to it). */
|
|
15
|
+
defaultValue?: string;
|
|
16
|
+
/** Called when the user checks a card; `details.event` is the native `change` event. */
|
|
17
|
+
onValueChange?: (value: string, details: ChangeDetails<ChoiceCardChangeReason>) => void;
|
|
18
|
+
/**
|
|
19
|
+
* The radios' shared name, and the `FormData` key. Without one (and outside a named Field), a
|
|
20
|
+
* generated name groups the radios.
|
|
21
|
+
*/
|
|
22
|
+
name?: string;
|
|
23
|
+
/** The `<form>` the radios belong to, when they are outside it. */
|
|
24
|
+
form?: string;
|
|
25
|
+
/** A choice must be made before the form submits. */
|
|
26
|
+
required?: boolean;
|
|
27
|
+
/** Disables every card. */
|
|
28
|
+
disabled?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* An error message is presented (set by a Field): the checked card, or every card when none is
|
|
31
|
+
* checked, shows the critical edge.
|
|
32
|
+
*/
|
|
33
|
+
invalid?: boolean;
|
|
34
|
+
render?: RenderProp<ChoiceCardGroupState>;
|
|
35
|
+
/** `ChoiceCard` elements, possibly with other content between them (an "Add" row). */
|
|
36
|
+
children?: ReactNode;
|
|
37
|
+
}
|
|
38
|
+
export interface ChoiceCardState {
|
|
39
|
+
disabled: boolean;
|
|
40
|
+
}
|
|
41
|
+
export interface ChoiceCardProps extends Omit<ComponentPropsWithRef<"label">, "htmlFor"> {
|
|
42
|
+
/** This card's value: what `onValueChange` receives and the form submits. */
|
|
43
|
+
value: string;
|
|
44
|
+
disabled?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* A mark after the radio, such as a card brand's logo (Figma's 44 × 30 Mark); decorative, so put
|
|
47
|
+
* the brand's name in the text too.
|
|
48
|
+
*/
|
|
49
|
+
leading?: ReactNode;
|
|
50
|
+
/**
|
|
51
|
+
* A second line, such as "Expires 08/28". It describes the radio (`aria-describedby`) instead of
|
|
52
|
+
* joining its name.
|
|
53
|
+
*/
|
|
54
|
+
description?: ReactNode;
|
|
55
|
+
/**
|
|
56
|
+
* Content at the card's end, such as a "Default" `Badge` (Figma's Show default): composition, not a
|
|
57
|
+
* prop. Its text joins the radio's name, after `children`.
|
|
58
|
+
*/
|
|
59
|
+
trailing?: ReactNode;
|
|
60
|
+
render?: RenderProp<ChoiceCardState>;
|
|
61
|
+
/** The radio's name, such as "Visa ending in 4242". */
|
|
62
|
+
children: ReactNode;
|
|
63
|
+
}
|
|
64
|
+
export declare function ChoiceCardGroup({ value, defaultValue, onValueChange, name, form, required, disabled, invalid, "aria-describedby": describedBy, "aria-labelledby": labelledBy, render, className, children, ...rest }: ChoiceCardGroupProps): JSX.Element;
|
|
65
|
+
export declare function ChoiceCard({ value, disabled, leading, description, trailing, render, className, children, ...rest }: ChoiceCardProps): JSX.Element;
|
|
66
|
+
//#endregion
|