@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,34 @@
|
|
|
1
|
+
import { RenderProp } from "../contracts/render.js";
|
|
2
|
+
import { ComponentPropsWithRef, ReactElement, ReactNode } from "react";
|
|
3
|
+
//#region src/progress-bar/progress-bar.d.ts
|
|
4
|
+
/** Figma "Tone" (Brand, Warning, Critical) plus `success` and `neutral`. */
|
|
5
|
+
export type ProgressBarTone = "brand" | "success" | "warning" | "critical" | "neutral";
|
|
6
|
+
export interface ProgressBarState {
|
|
7
|
+
tone: ProgressBarTone;
|
|
8
|
+
/** The clamped value, or `null` while indeterminate. */
|
|
9
|
+
value: number | null;
|
|
10
|
+
max: number;
|
|
11
|
+
indeterminate: boolean;
|
|
12
|
+
}
|
|
13
|
+
export interface ProgressBarProps extends Omit<ComponentPropsWithRef<"div">, "children"> {
|
|
14
|
+
/** Clamped to `0…max`. @default 0 */
|
|
15
|
+
value?: number;
|
|
16
|
+
/** Must be above zero. @default 100 */
|
|
17
|
+
max?: number;
|
|
18
|
+
/** The visible name. Without it, name the bar with `aria-label` or `aria-labelledby`. */
|
|
19
|
+
label?: ReactNode;
|
|
20
|
+
/** Shows the value as a percentage beside the label (hidden from assistive technology, which reads the bar itself). @default true */
|
|
21
|
+
showValue?: boolean;
|
|
22
|
+
/** Work is under way but its amount is unknown: the bar has no value. @default false */
|
|
23
|
+
indeterminate?: boolean;
|
|
24
|
+
/** @default 'brand' */
|
|
25
|
+
tone?: ProgressBarTone;
|
|
26
|
+
/** BCP 47 tag for the percentage. @default 'en-US' */
|
|
27
|
+
locale?: string;
|
|
28
|
+
/** Replaces the shown percentage and is read instead of it, for example "3 of 5 steps". */
|
|
29
|
+
valueText?: string;
|
|
30
|
+
/** Composition of the root; the native `<progress>` inside keeps its semantics. */
|
|
31
|
+
render?: RenderProp<ProgressBarState>;
|
|
32
|
+
}
|
|
33
|
+
export declare function ProgressBar({ value, max, label, showValue, indeterminate, tone, locale, valueText, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, render, className, ...rest }: ProgressBarProps): ReactElement;
|
|
34
|
+
//#endregion
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { cx } from "../_internal/cx.js";
|
|
2
|
+
import { renderElement } from "../contracts/render.js";
|
|
3
|
+
import { useId } from "react";
|
|
4
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
//#region src/progress-bar/progress-bar.tsx
|
|
6
|
+
function ProgressBar({ value = 0, max = 100, label, showValue = true, indeterminate = false, tone = "brand", locale = "en-US", valueText, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, render, className, ...rest }) {
|
|
7
|
+
const labelId = useId();
|
|
8
|
+
const range = Number.isFinite(max) && max > 0 ? max : 100;
|
|
9
|
+
const current = indeterminate ? null : clamp(value, range);
|
|
10
|
+
const shown = current === null ? void 0 : valueText ?? new Intl.NumberFormat(locale, {
|
|
11
|
+
style: "percent",
|
|
12
|
+
maximumFractionDigits: 0
|
|
13
|
+
}).format(current / range);
|
|
14
|
+
const hasLabel = label != null;
|
|
15
|
+
const hasValue = showValue && shown !== void 0;
|
|
16
|
+
return renderElement("div", render, {
|
|
17
|
+
tone,
|
|
18
|
+
value: current,
|
|
19
|
+
max: range,
|
|
20
|
+
indeterminate
|
|
21
|
+
}, {
|
|
22
|
+
"data-slot": "progress-bar",
|
|
23
|
+
"data-tone": tone,
|
|
24
|
+
...rest,
|
|
25
|
+
className: cx("nz-progress-bar", className),
|
|
26
|
+
children: /* @__PURE__ */ jsxs(Fragment, { children: [(hasLabel || hasValue) && /* @__PURE__ */ jsxs("div", {
|
|
27
|
+
className: "nz-progress-bar-header",
|
|
28
|
+
"data-slot": "progress-bar-header",
|
|
29
|
+
children: [hasLabel && /* @__PURE__ */ jsx("span", {
|
|
30
|
+
id: labelId,
|
|
31
|
+
className: "nz-progress-bar-label",
|
|
32
|
+
"data-slot": "progress-bar-label",
|
|
33
|
+
children: label
|
|
34
|
+
}), hasValue && /* @__PURE__ */ jsx("span", {
|
|
35
|
+
className: "nz-progress-bar-value",
|
|
36
|
+
"data-slot": "progress-bar-value",
|
|
37
|
+
"aria-hidden": "true",
|
|
38
|
+
children: shown
|
|
39
|
+
})]
|
|
40
|
+
}), /* @__PURE__ */ jsx("progress", {
|
|
41
|
+
className: "nz-progress-bar-track",
|
|
42
|
+
"data-slot": "progress-bar-track",
|
|
43
|
+
max: range,
|
|
44
|
+
value: current ?? void 0,
|
|
45
|
+
"aria-label": ariaLabel,
|
|
46
|
+
"aria-labelledby": ariaLabelledBy ?? (hasLabel ? labelId : void 0),
|
|
47
|
+
"aria-valuetext": current === null ? void 0 : valueText
|
|
48
|
+
})] })
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
function clamp(value, max) {
|
|
52
|
+
return Number.isFinite(value) ? Math.min(Math.max(value, 0), max) : 0;
|
|
53
|
+
}
|
|
54
|
+
//#endregion
|
|
55
|
+
export { ProgressBar };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ProgressRing } from "./progress-ring.js";
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { RenderProp } from "../contracts/render.js";
|
|
2
|
+
import { ComponentPropsWithRef, ReactElement, ReactNode } from "react";
|
|
3
|
+
//#region src/progress-ring/progress-ring.d.ts
|
|
4
|
+
export type ProgressRingTone = "brand" | "success" | "warning" | "critical" | "neutral";
|
|
5
|
+
/** 48 / 72 / 96 px; Figma draws only 72. */
|
|
6
|
+
export type ProgressRingSize = "sm" | "md" | "lg";
|
|
7
|
+
export interface ProgressRingState {
|
|
8
|
+
tone: ProgressRingTone;
|
|
9
|
+
size: ProgressRingSize;
|
|
10
|
+
/** The value clamped to `0…max`. */
|
|
11
|
+
value: number;
|
|
12
|
+
max: number;
|
|
13
|
+
}
|
|
14
|
+
export interface ProgressRingProps extends Omit<ComponentPropsWithRef<"div">, "role"> {
|
|
15
|
+
/** Figma "Value" (25 / 50 / 75 / 100 there). Clamped to `0…max`. */
|
|
16
|
+
value: number;
|
|
17
|
+
/** Must be above zero. @default 100 */
|
|
18
|
+
max?: number;
|
|
19
|
+
/** @default 'brand' */
|
|
20
|
+
tone?: ProgressRingTone;
|
|
21
|
+
/** @default 'md' */
|
|
22
|
+
size?: ProgressRingSize;
|
|
23
|
+
/**
|
|
24
|
+
* Exposes the ring as a `meter` (a measurement, such as a goal reached) instead of a `progressbar`
|
|
25
|
+
* (work under way). @default false
|
|
26
|
+
*/
|
|
27
|
+
meter?: boolean;
|
|
28
|
+
/** BCP 47 tag for the percentage. @default 'en-US' */
|
|
29
|
+
locale?: string;
|
|
30
|
+
/** What assistive technology reads instead of the percentage. Set it whenever `children` shows something else. */
|
|
31
|
+
valueText?: string;
|
|
32
|
+
/** The centre, shown to sighted users only (the ring's children are presentational). @default the percentage */
|
|
33
|
+
children?: ReactNode;
|
|
34
|
+
/** Name the ring with `aria-label` or `aria-labelledby`. */
|
|
35
|
+
render?: RenderProp<ProgressRingState>;
|
|
36
|
+
}
|
|
37
|
+
export declare function ProgressRing({ value, max, tone, size, meter, locale, valueText, render, className, children, ...rest }: ProgressRingProps): ReactElement;
|
|
38
|
+
//#endregion
|
|
@@ -0,0 +1,67 @@
|
|
|
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/progress-ring/progress-ring.tsx
|
|
5
|
+
const CENTRE = 36;
|
|
6
|
+
/** Figma's inner-radius ratio 0.8 at 72 px: a 7.2-unit ring on the 32.4 radius midline. */
|
|
7
|
+
const STROKE = 7.2;
|
|
8
|
+
const RADIUS = CENTRE - STROKE / 2;
|
|
9
|
+
function ProgressRing({ value, max = 100, tone = "brand", size = "md", meter = false, locale = "en-US", valueText, render, className, children, ...rest }) {
|
|
10
|
+
const range = Number.isFinite(max) && max > 0 ? max : 100;
|
|
11
|
+
const current = Number.isFinite(value) ? Math.min(Math.max(value, 0), range) : 0;
|
|
12
|
+
const percent = new Intl.NumberFormat(locale, {
|
|
13
|
+
style: "percent",
|
|
14
|
+
maximumFractionDigits: 0
|
|
15
|
+
}).format(current / range);
|
|
16
|
+
const arc = current / range * 100;
|
|
17
|
+
return renderElement("div", render, {
|
|
18
|
+
tone,
|
|
19
|
+
size,
|
|
20
|
+
value: current,
|
|
21
|
+
max: range
|
|
22
|
+
}, {
|
|
23
|
+
role: meter ? "meter" : "progressbar",
|
|
24
|
+
"aria-valuenow": current,
|
|
25
|
+
"aria-valuemin": 0,
|
|
26
|
+
"aria-valuemax": range,
|
|
27
|
+
"aria-valuetext": valueText ?? percent,
|
|
28
|
+
"data-slot": "progress-ring",
|
|
29
|
+
"data-tone": tone,
|
|
30
|
+
"data-size": size,
|
|
31
|
+
...rest,
|
|
32
|
+
className: cx("nz-progress-ring", className),
|
|
33
|
+
children: /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("svg", {
|
|
34
|
+
className: "nz-progress-ring-svg",
|
|
35
|
+
viewBox: `0 0 72 72`,
|
|
36
|
+
"aria-hidden": "true",
|
|
37
|
+
focusable: "false",
|
|
38
|
+
children: [/* @__PURE__ */ jsx("circle", {
|
|
39
|
+
className: "nz-progress-ring-track",
|
|
40
|
+
"data-slot": "progress-ring-track",
|
|
41
|
+
cx: CENTRE,
|
|
42
|
+
cy: CENTRE,
|
|
43
|
+
r: RADIUS,
|
|
44
|
+
fill: "none",
|
|
45
|
+
strokeWidth: STROKE
|
|
46
|
+
}), /* @__PURE__ */ jsx("circle", {
|
|
47
|
+
className: "nz-progress-ring-fill",
|
|
48
|
+
"data-slot": "progress-ring-fill",
|
|
49
|
+
cx: CENTRE,
|
|
50
|
+
cy: CENTRE,
|
|
51
|
+
r: RADIUS,
|
|
52
|
+
fill: "none",
|
|
53
|
+
strokeWidth: STROKE,
|
|
54
|
+
pathLength: 100,
|
|
55
|
+
strokeDasharray: `${arc} 100`,
|
|
56
|
+
transform: `rotate(-90 ${CENTRE} ${CENTRE})`
|
|
57
|
+
})]
|
|
58
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
59
|
+
className: "nz-progress-ring-label",
|
|
60
|
+
"data-slot": "progress-ring-label",
|
|
61
|
+
"aria-hidden": "true",
|
|
62
|
+
children: children ?? percent
|
|
63
|
+
})] })
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
//#endregion
|
|
67
|
+
export { ProgressRing };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { RadioGroup, RadioGroupChangeReason, RadioGroupProps } from "./radio-group.js";
|
|
2
|
+
import { Radio, RadioProps, RadioState } from "./radio-group.client.js";
|
|
3
|
+
export { Radio, RadioGroup, type RadioGroupChangeReason, type RadioGroupProps, type RadioProps, type RadioState };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { RenderProp } from "../contracts/render.js";
|
|
2
|
+
import { ComponentPropsWithRef, ReactElement, ReactNode } from "react";
|
|
3
|
+
//#region src/radio-group/radio-group.client.d.ts
|
|
4
|
+
/** What a `render` function receives for the root `<label>`. */
|
|
5
|
+
export interface RadioState {
|
|
6
|
+
disabled: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface RadioProps extends Omit<ComponentPropsWithRef<"input">, "type" | "value" | "name" | "checked" | "defaultChecked" | "required" | "readOnly" | "children" | "size"> {
|
|
9
|
+
/** Submitted under the group's name when this radio is checked. */
|
|
10
|
+
value: string;
|
|
11
|
+
/** Composition of the root `<label>`, the hit target. */
|
|
12
|
+
render?: RenderProp<RadioState>;
|
|
13
|
+
/** The label, after the circle. */
|
|
14
|
+
children?: ReactNode;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* One option of a `RadioGroup`. `className` and `style` go on the root `<label>`; every other
|
|
18
|
+
* attribute, `ref` included, goes on the native `<input>`. Name, checked state and `required` come
|
|
19
|
+
* from the group.
|
|
20
|
+
*/
|
|
21
|
+
export declare function Radio({ value, disabled, render, className, style, children, ...rest }: RadioProps): ReactElement;
|
|
22
|
+
//#endregion
|
|
@@ -0,0 +1,70 @@
|
|
|
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 { createContext, use, useMemo } from "react";
|
|
9
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
+
//#region src/radio-group/radio-group.client.tsx
|
|
11
|
+
const RadioGroupContext = createContext(null);
|
|
12
|
+
/** Internal: rendered only by `RadioGroup`. Every prop but `onValueChange` is serialisable. */
|
|
13
|
+
function RadioGroupScope({ name, value, defaultValue, required, onValueChange, children }) {
|
|
14
|
+
const scope = useMemo(() => ({
|
|
15
|
+
name,
|
|
16
|
+
value,
|
|
17
|
+
defaultValue,
|
|
18
|
+
required,
|
|
19
|
+
onValueChange
|
|
20
|
+
}), [
|
|
21
|
+
name,
|
|
22
|
+
value,
|
|
23
|
+
defaultValue,
|
|
24
|
+
required,
|
|
25
|
+
onValueChange
|
|
26
|
+
]);
|
|
27
|
+
return /* @__PURE__ */ jsx(RadioGroupContext, {
|
|
28
|
+
value: scope,
|
|
29
|
+
children
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* One option of a `RadioGroup`. `className` and `style` go on the root `<label>`; every other
|
|
34
|
+
* attribute, `ref` included, goes on the native `<input>`. Name, checked state and `required` come
|
|
35
|
+
* from the group.
|
|
36
|
+
*/
|
|
37
|
+
function Radio({ value, disabled, render, className, style, children, ...rest }) {
|
|
38
|
+
const group = use(RadioGroupContext);
|
|
39
|
+
const controlled = group !== null && group.value !== void 0;
|
|
40
|
+
const own = {
|
|
41
|
+
name: group?.name,
|
|
42
|
+
required: group?.required === true ? true : void 0,
|
|
43
|
+
disabled,
|
|
44
|
+
checked: controlled ? group.value === value : void 0,
|
|
45
|
+
defaultChecked: !controlled && group?.defaultValue !== void 0 ? group.defaultValue === value : void 0,
|
|
46
|
+
onChange(event) {
|
|
47
|
+
if (event.currentTarget.checked) group?.onValueChange?.(value, details("input", event.nativeEvent));
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
const state = { disabled: disabled === true };
|
|
51
|
+
return renderElement("label", render, state, {
|
|
52
|
+
"data-slot": "radio",
|
|
53
|
+
...stateAttrs(state),
|
|
54
|
+
className: cx("nz-radio nz-hit-target", className),
|
|
55
|
+
style,
|
|
56
|
+
children: /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("input", {
|
|
57
|
+
...mergeProps(own, rest),
|
|
58
|
+
type: "radio",
|
|
59
|
+
value,
|
|
60
|
+
className: "nz-radio-input",
|
|
61
|
+
"data-slot": "radio-input"
|
|
62
|
+
}), presented(children) && /* @__PURE__ */ jsx("span", {
|
|
63
|
+
className: "nz-radio-label",
|
|
64
|
+
"data-slot": "radio-label",
|
|
65
|
+
children
|
|
66
|
+
})] })
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
//#endregion
|
|
70
|
+
export { Radio, RadioGroupScope };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ChangeDetails } from "../contracts/details.js";
|
|
2
|
+
import { Orientation } from "../contracts/state.js";
|
|
3
|
+
import { FieldsetProps } from "../fieldset/fieldset.js";
|
|
4
|
+
import { ReactElement, ReactNode } from "react";
|
|
5
|
+
//#region src/radio-group/radio-group.d.ts
|
|
6
|
+
/** Every change comes from the native `change` event of the radio that became checked. */
|
|
7
|
+
export type RadioGroupChangeReason = "input";
|
|
8
|
+
export interface RadioGroupProps extends Omit<FieldsetProps, "children" | "role" | "name" | "defaultValue" | "onChange"> {
|
|
9
|
+
/** The name every radio submits under. @default a generated name, unique per group */
|
|
10
|
+
name?: string;
|
|
11
|
+
/** Controlled: the checked radio's `value`, or `null` for none. */
|
|
12
|
+
value?: string | null;
|
|
13
|
+
/** Uncontrolled initial value. */
|
|
14
|
+
defaultValue?: string;
|
|
15
|
+
/** Called with the newly checked radio's `value`, after that radio's own `onChange`. */
|
|
16
|
+
onValueChange?: (value: string, details: ChangeDetails<RadioGroupChangeReason>) => void;
|
|
17
|
+
/** Layout of the radios; native arrow keys move both ways either way. @default 'vertical' */
|
|
18
|
+
orientation?: Orientation;
|
|
19
|
+
/** `Radio` elements, possibly with other content between them. */
|
|
20
|
+
children?: ReactNode;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* A native `<fieldset role="radiogroup">` with a `<legend>` (Fieldset), plus `aria-required` and
|
|
24
|
+
* `aria-invalid`, which role `group` does not allow but `radiogroup` does (FIELD-CONTRACT.md).
|
|
25
|
+
* `required` marks the legend and makes every radio `required`; `disabled` is the fieldset's own.
|
|
26
|
+
*/
|
|
27
|
+
export declare function RadioGroup({ name, value, defaultValue, onValueChange, orientation, required, className, children, ...rest }: RadioGroupProps): ReactElement;
|
|
28
|
+
//#endregion
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { cx } from "../_internal/cx.js";
|
|
2
|
+
import { presented } from "../_internal/field.js";
|
|
3
|
+
import { Fieldset } from "../fieldset/fieldset.js";
|
|
4
|
+
import { RadioGroupScope } from "./radio-group.client.js";
|
|
5
|
+
import { useId } from "react";
|
|
6
|
+
import { jsx } from "react/jsx-runtime";
|
|
7
|
+
//#region src/radio-group/radio-group.tsx
|
|
8
|
+
/**
|
|
9
|
+
* A native `<fieldset role="radiogroup">` with a `<legend>` (Fieldset), plus `aria-required` and
|
|
10
|
+
* `aria-invalid`, which role `group` does not allow but `radiogroup` does (FIELD-CONTRACT.md).
|
|
11
|
+
* `required` marks the legend and makes every radio `required`; `disabled` is the fieldset's own.
|
|
12
|
+
*/
|
|
13
|
+
function RadioGroup({ name, value, defaultValue, onValueChange, orientation = "vertical", required = false, className, children, ...rest }) {
|
|
14
|
+
const generated = useId();
|
|
15
|
+
return /* @__PURE__ */ jsx(Fieldset, {
|
|
16
|
+
...rest,
|
|
17
|
+
required,
|
|
18
|
+
role: "radiogroup",
|
|
19
|
+
"aria-required": required || void 0,
|
|
20
|
+
"aria-invalid": presented(rest.error) || void 0,
|
|
21
|
+
"data-slot": "radio-group",
|
|
22
|
+
"data-orientation": orientation,
|
|
23
|
+
className: cx("nz-radio-group", className),
|
|
24
|
+
children: /* @__PURE__ */ jsx(RadioGroupScope, {
|
|
25
|
+
name: name ?? `${generated}-radio`,
|
|
26
|
+
value,
|
|
27
|
+
defaultValue,
|
|
28
|
+
required,
|
|
29
|
+
onValueChange,
|
|
30
|
+
children
|
|
31
|
+
})
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
//#endregion
|
|
35
|
+
export { RadioGroup };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { RankedListAction, RankedListActionProps, RankedListItem, RankedListItemProps, RankedListItemState, RankedListLabels, RankedListRoot, RankedListRootProps, RankedListRootState, RankedListTitleLevel } from "./ranked-list.js";
|
|
2
|
+
import { ranked_list_parts_d_exports } from "./ranked-list.parts.js";
|
|
3
|
+
export { ranked_list_parts_d_exports as RankedList, RankedListAction, type RankedListActionProps, RankedListItem, type RankedListItemProps, type RankedListItemState, type RankedListLabels, RankedListRoot, type RankedListRootProps, type RankedListRootState, type RankedListTitleLevel };
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { RenderProp } from "../contracts/render.js";
|
|
2
|
+
import { DataStatus } from "../_internal/data-status.js";
|
|
3
|
+
import { ComponentPropsWithRef, ReactElement, ReactNode } from "react";
|
|
4
|
+
//#region src/ranked-list/ranked-list.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* RankedList's own strings (§16.4): serialisable, English defaults, Metric's wording. `{label}` is
|
|
7
|
+
* replaced by the `title` (left out when there is none).
|
|
8
|
+
*/
|
|
9
|
+
export interface RankedListLabels {
|
|
10
|
+
/** Static, visually hidden text while loading (§16.5: no live region). @default 'Loading {label}' */
|
|
11
|
+
loading: string;
|
|
12
|
+
/** Shown when there is nothing to rank and no `empty` slot. @default 'No data' */
|
|
13
|
+
empty: string;
|
|
14
|
+
/** The InlineError message on a load failure with no `error` slot. @default 'Could not load {label}' */
|
|
15
|
+
error: string;
|
|
16
|
+
}
|
|
17
|
+
export type RankedListTitleLevel = 2 | 3 | 4 | 5 | 6;
|
|
18
|
+
export interface RankedListRootState {
|
|
19
|
+
status: DataStatus;
|
|
20
|
+
pending: boolean;
|
|
21
|
+
}
|
|
22
|
+
export interface RankedListRootProps extends Omit<ComponentPropsWithRef<"div">, "title"> {
|
|
23
|
+
/** The heading ("Top channels"); it also names the list. */
|
|
24
|
+
title?: ReactNode;
|
|
25
|
+
/** The heading level; its look is Heading/H4 at every level. @default 3 */
|
|
26
|
+
titleLevel?: RankedListTitleLevel;
|
|
27
|
+
/** The header's end, for example `<RankedList.Action href="/channels">View all</RankedList.Action>`. */
|
|
28
|
+
action?: ReactNode;
|
|
29
|
+
/**
|
|
30
|
+
* The value a full bar stands for. @default the largest value among the direct
|
|
31
|
+
* `RankedList.Item` children (the leader); pass it when the items are wrapped in your own components
|
|
32
|
+
*/
|
|
33
|
+
max?: number;
|
|
34
|
+
/** Every item's number format, unless the item sets its own (`Intl.NumberFormatOptions`). */
|
|
35
|
+
format?: Intl.NumberFormatOptions;
|
|
36
|
+
/** BCP 47 tag for every item's value. @default 'en-US' */
|
|
37
|
+
locale?: string;
|
|
38
|
+
/**
|
|
39
|
+
* The data lifecycle (§16.5). A ready list with no items is `empty`. @default 'ready'
|
|
40
|
+
*/
|
|
41
|
+
status?: DataStatus;
|
|
42
|
+
/**
|
|
43
|
+
* A refresh is in flight while the rows show: `data-pending` and `aria-busy` (ready only, as in
|
|
44
|
+
* Metric). @default false
|
|
45
|
+
*/
|
|
46
|
+
pending?: boolean;
|
|
47
|
+
/** Replaces the empty message. */
|
|
48
|
+
empty?: ReactNode;
|
|
49
|
+
/** Replaces the error message, for example an `InlineError` with a retry `action`. */
|
|
50
|
+
error?: ReactNode;
|
|
51
|
+
/**
|
|
52
|
+
* How many rows loading, empty and error reserve, so the box does not change when the data
|
|
53
|
+
* arrives. Pass the number of rows you show (Figma: 5; "max ~6 rows, then View all"). @default 5
|
|
54
|
+
*/
|
|
55
|
+
rows?: number;
|
|
56
|
+
labels?: Partial<RankedListLabels>;
|
|
57
|
+
/** Composition of the root (Card's surface through the `nz-card` class). */
|
|
58
|
+
render?: RenderProp<RankedListRootState>;
|
|
59
|
+
/** `RankedList.Item` elements, the leader first. */
|
|
60
|
+
children?: ReactNode;
|
|
61
|
+
}
|
|
62
|
+
export interface RankedListItemState {
|
|
63
|
+
/** value ÷ max, from 0 to 1. */
|
|
64
|
+
ratio: number;
|
|
65
|
+
}
|
|
66
|
+
export interface RankedListItemProps extends Omit<ComponentPropsWithRef<"li">, "children"> {
|
|
67
|
+
label: ReactNode;
|
|
68
|
+
value: number;
|
|
69
|
+
/** Overrides the list's `max` for this row. */
|
|
70
|
+
max?: number | undefined;
|
|
71
|
+
/** Overrides the list's `format`. */
|
|
72
|
+
format?: Intl.NumberFormatOptions | undefined;
|
|
73
|
+
/** @default the list's `locale`, else 'en-US' */
|
|
74
|
+
locale?: string | undefined;
|
|
75
|
+
render?: RenderProp<RankedListItemState>;
|
|
76
|
+
}
|
|
77
|
+
export interface RankedListActionProps extends ComponentPropsWithRef<"a"> {
|
|
78
|
+
/** The router's link, for example `render={<Link href="/channels" />}`. It must render an `<a>`. */
|
|
79
|
+
render?: RenderProp<Record<string, never>>;
|
|
80
|
+
}
|
|
81
|
+
export declare function RankedListRoot({ title, titleLevel, action, max, format, locale, status, pending, empty, error, rows, labels, render, className, children, ...rest }: RankedListRootProps): ReactElement;
|
|
82
|
+
export declare function RankedListItem({ label, value, max, format, locale, render, className, ...rest }: RankedListItemProps): ReactElement;
|
|
83
|
+
/** "View all": a real link, at least 24 px tall (WCAG 2.5.8; figma/04 issue 7). */
|
|
84
|
+
export declare function RankedListAction({ render, className, ...rest }: RankedListActionProps): ReactElement;
|
|
85
|
+
//#endregion
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { cx } from "../_internal/cx.js";
|
|
2
|
+
import { renderElement } from "../contracts/render.js";
|
|
3
|
+
import { InlineError } from "../inline-error/inline-error.js";
|
|
4
|
+
import { dataStatusAttrs } from "../_internal/data-status.js";
|
|
5
|
+
import { NumberValue } from "../number-value/number-value.js";
|
|
6
|
+
import { Skeleton } from "../skeleton/skeleton.js";
|
|
7
|
+
import { Children, cloneElement, isValidElement, useId } from "react";
|
|
8
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
//#region src/ranked-list/ranked-list.tsx
|
|
10
|
+
/** Percent of the track, 0–100 with up to 3 decimals: deterministic attribute text. */
|
|
11
|
+
function percent(value, max) {
|
|
12
|
+
const ratio = max > 0 && Number.isFinite(value) ? Math.min(1, Math.max(0, value / max)) : 0;
|
|
13
|
+
return `${Number((ratio * 100).toFixed(3))}%`;
|
|
14
|
+
}
|
|
15
|
+
function Bar({ width }) {
|
|
16
|
+
return /* @__PURE__ */ jsx("svg", {
|
|
17
|
+
className: "nz-ranked-list-bar",
|
|
18
|
+
"data-slot": "ranked-list-bar",
|
|
19
|
+
width: "100%",
|
|
20
|
+
height: "100%",
|
|
21
|
+
"aria-hidden": "true",
|
|
22
|
+
focusable: "false",
|
|
23
|
+
children: /* @__PURE__ */ jsx("rect", {
|
|
24
|
+
className: "nz-ranked-list-fill",
|
|
25
|
+
width,
|
|
26
|
+
height: "100%",
|
|
27
|
+
rx: "3"
|
|
28
|
+
})
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
/** `template` with `{label}` replaced by the title node, or dropped when there is no title. */
|
|
32
|
+
function fill(template, title) {
|
|
33
|
+
const at = template.indexOf("{label}");
|
|
34
|
+
if (at < 0) return template;
|
|
35
|
+
const before = template.slice(0, at);
|
|
36
|
+
const after = template.slice(at + 7);
|
|
37
|
+
if (title == null) return `${before.trimEnd()}${after.trimStart()}`.trim();
|
|
38
|
+
if (typeof title === "string" || typeof title === "number") return `${before}${title}${after}`;
|
|
39
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
40
|
+
before,
|
|
41
|
+
title,
|
|
42
|
+
after
|
|
43
|
+
] });
|
|
44
|
+
}
|
|
45
|
+
/** A row of the ready geometry with no content, for loading and for the reserved height. */
|
|
46
|
+
function PlaceholderRow({ skeleton }) {
|
|
47
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
48
|
+
className: "nz-ranked-list-placeholder",
|
|
49
|
+
"data-slot": "ranked-list-placeholder",
|
|
50
|
+
children: [/* @__PURE__ */ jsxs("span", {
|
|
51
|
+
className: "nz-ranked-list-row",
|
|
52
|
+
children: [skeleton && /* @__PURE__ */ jsx(Skeleton, { className: "nz-ranked-list-skeleton-label" }), skeleton && /* @__PURE__ */ jsx(Skeleton, { className: "nz-ranked-list-skeleton-value" })]
|
|
53
|
+
}), /* @__PURE__ */ jsx("span", { className: "nz-ranked-list-track" })]
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
function RankedListRoot({ title, titleLevel = 3, action, max, format, locale, status = "ready", pending = false, empty, error, rows = 5, labels, render, className, children, ...rest }) {
|
|
57
|
+
const titleId = `${useId()}-title`;
|
|
58
|
+
const items = Children.toArray(children);
|
|
59
|
+
const ranked = items.filter((child) => isValidElement(child) && child.type === RankedListItem);
|
|
60
|
+
const resolved = status === "ready" && items.length === 0 ? "empty" : status;
|
|
61
|
+
const leader = max ?? Math.max(0, ...ranked.map((item) => item.props.value));
|
|
62
|
+
const reserve = Array.from({ length: Math.max(0, Math.floor(rows)) }, (_, index) => index);
|
|
63
|
+
const Heading = `h${titleLevel}`;
|
|
64
|
+
let body;
|
|
65
|
+
if (resolved === "ready") body = /* @__PURE__ */ jsx("ol", {
|
|
66
|
+
className: "nz-ranked-list-list",
|
|
67
|
+
"data-slot": "ranked-list-list",
|
|
68
|
+
"aria-labelledby": title != null ? titleId : void 0,
|
|
69
|
+
children: items.map((child) => isValidElement(child) && child.type === RankedListItem ? cloneElement(child, {
|
|
70
|
+
max: child.props.max ?? leader,
|
|
71
|
+
format: child.props.format ?? format,
|
|
72
|
+
locale: child.props.locale ?? locale
|
|
73
|
+
}) : child)
|
|
74
|
+
});
|
|
75
|
+
else {
|
|
76
|
+
const message = resolved === "loading" ? /* @__PURE__ */ jsx("span", {
|
|
77
|
+
className: "nz-visually-hidden",
|
|
78
|
+
children: fill(labels?.loading ?? "Loading {label}", title)
|
|
79
|
+
}) : resolved === "error" ? error ?? /* @__PURE__ */ jsx(InlineError, { children: fill(labels?.error ?? "Could not load {label}", title) }) : empty ?? /* @__PURE__ */ jsx("p", {
|
|
80
|
+
className: "nz-ranked-list-empty",
|
|
81
|
+
children: fill(labels?.empty ?? "No data", title)
|
|
82
|
+
});
|
|
83
|
+
body = /* @__PURE__ */ jsxs("div", {
|
|
84
|
+
className: "nz-ranked-list-status",
|
|
85
|
+
"data-slot": "ranked-list-status",
|
|
86
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
87
|
+
className: "nz-ranked-list-reserve",
|
|
88
|
+
"aria-hidden": "true",
|
|
89
|
+
children: reserve.map((index) => /* @__PURE__ */ jsx(PlaceholderRow, { skeleton: resolved === "loading" }, index))
|
|
90
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
91
|
+
className: "nz-ranked-list-message",
|
|
92
|
+
"data-slot": "ranked-list-message",
|
|
93
|
+
children: message
|
|
94
|
+
})]
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
const busy = resolved === "ready" && pending;
|
|
98
|
+
return renderElement("div", render, {
|
|
99
|
+
status: resolved,
|
|
100
|
+
pending: busy
|
|
101
|
+
}, {
|
|
102
|
+
"data-slot": "ranked-list",
|
|
103
|
+
...dataStatusAttrs(resolved, busy),
|
|
104
|
+
...rest,
|
|
105
|
+
className: cx("nz-card", "nz-ranked-list", className),
|
|
106
|
+
children: /* @__PURE__ */ jsxs(Fragment, { children: [(title != null || action != null) && /* @__PURE__ */ jsxs("div", {
|
|
107
|
+
className: "nz-ranked-list-header",
|
|
108
|
+
"data-slot": "ranked-list-header",
|
|
109
|
+
children: [title != null && /* @__PURE__ */ jsx(Heading, {
|
|
110
|
+
className: "nz-ranked-list-title",
|
|
111
|
+
"data-slot": "ranked-list-title",
|
|
112
|
+
id: titleId,
|
|
113
|
+
children: title
|
|
114
|
+
}), action]
|
|
115
|
+
}), body] })
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
function RankedListItem({ label, value, max, format, locale = "en-US", render, className, ...rest }) {
|
|
119
|
+
const width = percent(value, max ?? value);
|
|
120
|
+
const ratio = Number.parseFloat(width) / 100;
|
|
121
|
+
return renderElement("li", render, { ratio }, {
|
|
122
|
+
"data-slot": "ranked-list-item",
|
|
123
|
+
...rest,
|
|
124
|
+
className: cx("nz-ranked-list-item", className),
|
|
125
|
+
children: /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("span", {
|
|
126
|
+
className: "nz-ranked-list-row",
|
|
127
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
128
|
+
className: "nz-ranked-list-label",
|
|
129
|
+
"data-slot": "ranked-list-label",
|
|
130
|
+
children: label
|
|
131
|
+
}), /* @__PURE__ */ jsx(NumberValue, {
|
|
132
|
+
className: "nz-ranked-list-value",
|
|
133
|
+
value,
|
|
134
|
+
format: format ?? {},
|
|
135
|
+
locale
|
|
136
|
+
})]
|
|
137
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
138
|
+
className: "nz-ranked-list-track",
|
|
139
|
+
"data-slot": "ranked-list-track",
|
|
140
|
+
children: /* @__PURE__ */ jsx(Bar, { width })
|
|
141
|
+
})] })
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
/** "View all": a real link, at least 24 px tall (WCAG 2.5.8; figma/04 issue 7). */
|
|
145
|
+
function RankedListAction({ render, className, ...rest }) {
|
|
146
|
+
return renderElement("a", render, {}, {
|
|
147
|
+
"data-slot": "ranked-list-action",
|
|
148
|
+
...rest,
|
|
149
|
+
className: cx("nz-ranked-list-action", className)
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
//#endregion
|
|
153
|
+
export { RankedListAction, RankedListItem, RankedListRoot };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { RankedListAction, RankedListItem, RankedListRoot } from "./ranked-list.js";
|
|
2
|
+
declare namespace ranked_list_parts_d_exports {
|
|
3
|
+
export { RankedListAction as Action, RankedListItem as Item, RankedListRoot as Root };
|
|
4
|
+
}
|
|
5
|
+
//#endregion
|
|
6
|
+
export { RankedListAction as Action, RankedListItem as Item, RankedListRoot as Root, ranked_list_parts_d_exports };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { __exportAll } from "../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { RankedListAction, RankedListItem, RankedListRoot } from "./ranked-list.js";
|
|
3
|
+
//#region src/ranked-list/ranked-list.parts.ts
|
|
4
|
+
var ranked_list_parts_exports = /* @__PURE__ */ __exportAll({
|
|
5
|
+
Action: () => RankedListAction,
|
|
6
|
+
Item: () => RankedListItem,
|
|
7
|
+
Root: () => RankedListRoot
|
|
8
|
+
});
|
|
9
|
+
//#endregion
|
|
10
|
+
export { RankedListAction as Action, RankedListItem as Item, RankedListRoot as Root, ranked_list_parts_exports };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SearchField } from "./search-field.client.js";
|