@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,152 @@
|
|
|
1
|
+
import { RenderProp } from "../contracts/render.js";
|
|
2
|
+
import { ChangeDetails, OpenReason } from "../contracts/details.js";
|
|
3
|
+
import "../_internal/engine-part.js";
|
|
4
|
+
import { Align, Side } from "../contracts/state.js";
|
|
5
|
+
import { CSSProperties, ComponentPropsWithRef, HTMLAttributeAnchorTarget, HTMLAttributeReferrerPolicy, ReactElement, ReactNode } from "react";
|
|
6
|
+
//#region src/menu/menu.contract.d.ts
|
|
7
|
+
/** Logical side; the resolved physical side is `data-side` on the popup. */
|
|
8
|
+
export type MenuSide = "top" | "bottom" | "start" | "end";
|
|
9
|
+
/** Figma Menu Item `State=Critical`. `critical` items sit last, after a separator. */
|
|
10
|
+
export type MenuItemTone = "neutral" | "critical";
|
|
11
|
+
/** Why a checkbox item changed: the item was activated (pointer, touch or keyboard). */
|
|
12
|
+
export type MenuCheckedReason = "item-press";
|
|
13
|
+
/**
|
|
14
|
+
* Strings the engine renders (§9.3 rule 7). Engine-owned with React Aria (not overridable): `dismiss`,
|
|
15
|
+
* the visually hidden "Dismiss" buttons at both ends of the popup.
|
|
16
|
+
*/
|
|
17
|
+
export interface MenuLabels {
|
|
18
|
+
dismiss: string;
|
|
19
|
+
}
|
|
20
|
+
export interface MenuRootProps {
|
|
21
|
+
open?: boolean;
|
|
22
|
+
defaultOpen?: boolean;
|
|
23
|
+
/** `details.reason` is `'unknown'` with React Aria, which reports no cause. */
|
|
24
|
+
onOpenChange?: (open: boolean, details: ChangeDetails<OpenReason>) => void;
|
|
25
|
+
children: ReactNode;
|
|
26
|
+
}
|
|
27
|
+
export interface MenuTriggerState {
|
|
28
|
+
open: boolean;
|
|
29
|
+
pressed: boolean;
|
|
30
|
+
focusVisible: boolean;
|
|
31
|
+
disabled: boolean;
|
|
32
|
+
}
|
|
33
|
+
export interface MenuPopupState {
|
|
34
|
+
entering: boolean;
|
|
35
|
+
exiting: boolean;
|
|
36
|
+
side: Side;
|
|
37
|
+
}
|
|
38
|
+
export interface MenuItemState {
|
|
39
|
+
highlighted: boolean;
|
|
40
|
+
disabled: boolean;
|
|
41
|
+
focusVisible: boolean;
|
|
42
|
+
/** Checkbox and radio items only; always `false` on a plain item. */
|
|
43
|
+
checked: boolean;
|
|
44
|
+
}
|
|
45
|
+
export interface MenuTriggerProps extends Omit<ComponentPropsWithRef<"button">, "children"> {
|
|
46
|
+
/**
|
|
47
|
+
* Must render a `<button>`, for example an `IconButton` for a row's "…" menu:
|
|
48
|
+
* `render={<IconButton label="More actions" icon={<Ellipsis />} />}`.
|
|
49
|
+
*/
|
|
50
|
+
render?: RenderProp<MenuTriggerState>;
|
|
51
|
+
children?: ReactNode;
|
|
52
|
+
}
|
|
53
|
+
export interface MenuPopupProps {
|
|
54
|
+
/** @default 'bottom' */
|
|
55
|
+
side?: MenuSide;
|
|
56
|
+
/** @default 'start' */
|
|
57
|
+
align?: Align;
|
|
58
|
+
/** Distance from the trigger in px. @default 8 */
|
|
59
|
+
sideOffset?: number;
|
|
60
|
+
/** Portal container. Defaults to the parent overlay, else `document.body` (§12.1 L2). */
|
|
61
|
+
container?: Element | null;
|
|
62
|
+
/** Names the menu when the trigger's text does not (the trigger names it by default). */
|
|
63
|
+
"aria-label"?: string;
|
|
64
|
+
className?: string;
|
|
65
|
+
style?: CSSProperties;
|
|
66
|
+
children: ReactNode;
|
|
67
|
+
}
|
|
68
|
+
/** What every item kind shares. */
|
|
69
|
+
interface MenuItemBaseProps extends Omit<ComponentPropsWithRef<"div">, "children" | "id"> {
|
|
70
|
+
/** Typeahead text; defaults to `children` when it is a string. */
|
|
71
|
+
textValue?: string;
|
|
72
|
+
disabled?: boolean;
|
|
73
|
+
/** Called when the item is activated by pointer, touch or keyboard (Enter or Space). */
|
|
74
|
+
onAction?: () => void;
|
|
75
|
+
/** Whether activating the item closes the menu. @default true (false for a checkbox item) */
|
|
76
|
+
closeOnSelect?: boolean;
|
|
77
|
+
/** A leading glyph (16 px), for example `<Copy />` from `@nizivo/icons`. Decorative. */
|
|
78
|
+
icon?: ReactNode;
|
|
79
|
+
/**
|
|
80
|
+
* A keyboard shortcut drawn at the end with `Kbd` (`"mod+d"`), and announced through
|
|
81
|
+
* `aria-keyshortcuts`. A visual hint: the app implements the shortcut itself.
|
|
82
|
+
*/
|
|
83
|
+
shortcut?: string;
|
|
84
|
+
/** @default 'neutral' */
|
|
85
|
+
tone?: MenuItemTone;
|
|
86
|
+
children: ReactNode;
|
|
87
|
+
}
|
|
88
|
+
export interface MenuItemProps extends MenuItemBaseProps {
|
|
89
|
+
/** Makes the item a link item: it renders an `<a>` and Enter follows it (§9.3 rule 3). */
|
|
90
|
+
href?: string;
|
|
91
|
+
target?: HTMLAttributeAnchorTarget;
|
|
92
|
+
rel?: string;
|
|
93
|
+
download?: boolean | string;
|
|
94
|
+
hrefLang?: string;
|
|
95
|
+
ping?: string;
|
|
96
|
+
referrerPolicy?: HTMLAttributeReferrerPolicy;
|
|
97
|
+
/**
|
|
98
|
+
* Renders a `<div>`, or an `<a>` with `href`. A router link works through `render`:
|
|
99
|
+
* `render={<Link href="/orders" />}` (the element's `href` makes it a link item, §9.3 rule 3).
|
|
100
|
+
*/
|
|
101
|
+
render?: RenderProp<MenuItemState>;
|
|
102
|
+
}
|
|
103
|
+
export interface MenuCheckboxItemProps extends MenuItemBaseProps {
|
|
104
|
+
checked?: boolean;
|
|
105
|
+
/**
|
|
106
|
+
* The popup unmounts on close, so the Root keeps an uncontrolled item's state, keyed by the item's
|
|
107
|
+
* text (`textValue`, or string `children`): two checkbox items with the same text in one menu share
|
|
108
|
+
* it, and an item with neither starts from `defaultChecked` on every open. Use `checked` for state
|
|
109
|
+
* the app owns.
|
|
110
|
+
*/
|
|
111
|
+
defaultChecked?: boolean;
|
|
112
|
+
onCheckedChange?: (checked: boolean, details: ChangeDetails<MenuCheckedReason>) => void;
|
|
113
|
+
/** Replaces the check glyph shown while checked. */
|
|
114
|
+
indicator?: ReactNode;
|
|
115
|
+
/** Must render a `<div>`. */
|
|
116
|
+
render?: RenderProp<MenuItemState>;
|
|
117
|
+
}
|
|
118
|
+
export interface MenuRadioGroupProps extends Omit<ComponentPropsWithRef<"section">, "id" | "defaultValue"> {
|
|
119
|
+
value?: string | null;
|
|
120
|
+
/**
|
|
121
|
+
* The popup unmounts on close, so the Root keeps an uncontrolled group's choice, keyed by its
|
|
122
|
+
* items' `value`s (radio items placed directly, or through fragments and wrapper elements).
|
|
123
|
+
*/
|
|
124
|
+
defaultValue?: string | null;
|
|
125
|
+
/** `details.reason` is `'unknown'` with React Aria, which reports no cause. */
|
|
126
|
+
onValueChange?: (value: string, details: ChangeDetails<MenuCheckedReason>) => void;
|
|
127
|
+
/** Must render a `<section>`. */
|
|
128
|
+
render?: RenderProp<Record<string, never>>;
|
|
129
|
+
}
|
|
130
|
+
export interface MenuRadioItemProps extends MenuItemBaseProps {
|
|
131
|
+
/** The value the group reports when this item is chosen. */
|
|
132
|
+
value: string;
|
|
133
|
+
/** Replaces the check glyph shown while chosen. */
|
|
134
|
+
indicator?: ReactNode;
|
|
135
|
+
/** Must render a `<div>`. */
|
|
136
|
+
render?: RenderProp<MenuItemState>;
|
|
137
|
+
}
|
|
138
|
+
type NoState = Record<string, never>;
|
|
139
|
+
export interface MenuGroupProps extends Omit<ComponentPropsWithRef<"section">, "id"> {
|
|
140
|
+
/** Must render a `<section>`. */
|
|
141
|
+
render?: RenderProp<NoState>;
|
|
142
|
+
}
|
|
143
|
+
export interface MenuGroupLabelProps extends Omit<ComponentPropsWithRef<"header">, "id"> {
|
|
144
|
+
/** Must render a `<header>`. */
|
|
145
|
+
render?: RenderProp<NoState>;
|
|
146
|
+
}
|
|
147
|
+
export interface MenuSeparatorProps extends Omit<ComponentPropsWithRef<"div">, "children"> {
|
|
148
|
+
/** Must render a `<div>`. */
|
|
149
|
+
render?: RenderProp<NoState>;
|
|
150
|
+
}
|
|
151
|
+
//#endregion
|
|
152
|
+
export type { OpenReason };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { MenuCheckboxItem, MenuGroup, MenuGroupLabel, MenuItem, MenuPopup, MenuRadioGroup, MenuRadioItem, MenuRoot, MenuSeparator, MenuTrigger } from "./menu.client.js";
|
|
2
|
+
declare namespace menu_parts_d_exports {
|
|
3
|
+
export { MenuCheckboxItem as CheckboxItem, MenuGroup as Group, MenuGroupLabel as GroupLabel, MenuItem as Item, MenuPopup as Popup, MenuRadioGroup as RadioGroup, MenuRadioItem as RadioItem, MenuRoot as Root, MenuSeparator as Separator, MenuTrigger as Trigger };
|
|
4
|
+
}
|
|
5
|
+
//#endregion
|
|
6
|
+
export { MenuCheckboxItem as CheckboxItem, MenuGroup as Group, MenuGroupLabel as GroupLabel, MenuItem as Item, MenuPopup as Popup, MenuRadioGroup as RadioGroup, MenuRadioItem as RadioItem, MenuRoot as Root, MenuSeparator as Separator, MenuTrigger as Trigger, menu_parts_d_exports };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { __exportAll } from "../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { MenuCheckboxItem, MenuGroup, MenuGroupLabel, MenuItem, MenuPopup, MenuRadioGroup, MenuRadioItem, MenuRoot, MenuSeparator, MenuTrigger } from "./menu.client.js";
|
|
3
|
+
//#region src/menu/menu.parts.ts
|
|
4
|
+
var menu_parts_exports = /* @__PURE__ */ __exportAll({
|
|
5
|
+
CheckboxItem: () => MenuCheckboxItem,
|
|
6
|
+
Group: () => MenuGroup,
|
|
7
|
+
GroupLabel: () => MenuGroupLabel,
|
|
8
|
+
Item: () => MenuItem,
|
|
9
|
+
Popup: () => MenuPopup,
|
|
10
|
+
RadioGroup: () => MenuRadioGroup,
|
|
11
|
+
RadioItem: () => MenuRadioItem,
|
|
12
|
+
Root: () => MenuRoot,
|
|
13
|
+
Separator: () => MenuSeparator,
|
|
14
|
+
Trigger: () => MenuTrigger
|
|
15
|
+
});
|
|
16
|
+
//#endregion
|
|
17
|
+
export { MenuCheckboxItem as CheckboxItem, MenuGroup as Group, MenuGroupLabel as GroupLabel, MenuItem as Item, MenuPopup as Popup, MenuRadioGroup as RadioGroup, MenuRadioItem as RadioItem, MenuRoot as Root, MenuSeparator as Separator, MenuTrigger as Trigger, menu_parts_exports };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Meter } from "./meter.js";
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { RenderProp } from "../contracts/render.js";
|
|
2
|
+
import { ComponentPropsWithRef, ReactElement, ReactNode } from "react";
|
|
3
|
+
//#region src/meter/meter.d.ts
|
|
4
|
+
/** The colour of the optimum region. Outside it the browser's ranges pick warning, then critical. */
|
|
5
|
+
export type MeterTone = "brand" | "success" | "warning" | "critical" | "neutral";
|
|
6
|
+
export interface MeterState {
|
|
7
|
+
tone: MeterTone;
|
|
8
|
+
/** The value clamped to `min…max`. */
|
|
9
|
+
value: number;
|
|
10
|
+
min: number;
|
|
11
|
+
max: number;
|
|
12
|
+
}
|
|
13
|
+
export interface MeterProps extends Omit<ComponentPropsWithRef<"div">, "children"> {
|
|
14
|
+
/** A measurement within a known range (storage used, stock left), not progress. Clamped to `min…max`. */
|
|
15
|
+
value: number;
|
|
16
|
+
/** @default 0 */
|
|
17
|
+
min?: number;
|
|
18
|
+
/** Must be above `min`. @default 100 */
|
|
19
|
+
max?: number;
|
|
20
|
+
/** Upper end of the low range. */
|
|
21
|
+
low?: number;
|
|
22
|
+
/** Lower end of the high range. */
|
|
23
|
+
high?: number;
|
|
24
|
+
/**
|
|
25
|
+
* The best value. Without it the browser puts the optimum in the middle of the range. For a quota or
|
|
26
|
+
* usage meter where high is bad, set `optimum={min}`; for stock, where low is bad, set `optimum={max}`.
|
|
27
|
+
*/
|
|
28
|
+
optimum?: number;
|
|
29
|
+
/** The visible name. Without it, name the meter with `aria-label` or `aria-labelledby`. */
|
|
30
|
+
label?: ReactNode;
|
|
31
|
+
/** Shows the value beside the label (hidden from assistive technology, which reads the meter itself). @default true */
|
|
32
|
+
showValue?: boolean;
|
|
33
|
+
/** @default 'brand' */
|
|
34
|
+
tone?: MeterTone;
|
|
35
|
+
/** BCP 47 tag for the percentage. @default 'en-US' */
|
|
36
|
+
locale?: string;
|
|
37
|
+
/** Replaces the shown percentage and is read instead of it, for example "310 of 500". */
|
|
38
|
+
valueText?: string;
|
|
39
|
+
/** Composition of the root; the native `<meter>` inside keeps its semantics. */
|
|
40
|
+
render?: RenderProp<MeterState>;
|
|
41
|
+
}
|
|
42
|
+
export declare function Meter({ value, min, max, low, high, optimum, label, showValue, tone, locale, valueText, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, render, className, ...rest }: MeterProps): ReactElement;
|
|
43
|
+
//#endregion
|
|
@@ -0,0 +1,59 @@
|
|
|
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/meter/meter.tsx
|
|
6
|
+
function Meter({ value, min = 0, max = 100, low, high, optimum, label, showValue = true, tone = "brand", locale = "en-US", valueText, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, render, className, ...rest }) {
|
|
7
|
+
const labelId = useId();
|
|
8
|
+
const lo = Number.isFinite(min) ? min : 0;
|
|
9
|
+
const hi = Number.isFinite(max) && max > lo ? max : lo + 100;
|
|
10
|
+
const current = Number.isFinite(value) ? Math.min(Math.max(value, lo), hi) : lo;
|
|
11
|
+
const shown = valueText ?? new Intl.NumberFormat(locale, {
|
|
12
|
+
style: "percent",
|
|
13
|
+
maximumFractionDigits: 0
|
|
14
|
+
}).format((current - lo) / (hi - lo));
|
|
15
|
+
const hasLabel = label != null;
|
|
16
|
+
return renderElement("div", render, {
|
|
17
|
+
tone,
|
|
18
|
+
value: current,
|
|
19
|
+
min: lo,
|
|
20
|
+
max: hi
|
|
21
|
+
}, {
|
|
22
|
+
"data-slot": "meter",
|
|
23
|
+
"data-tone": tone,
|
|
24
|
+
...rest,
|
|
25
|
+
className: cx("nz-meter", className),
|
|
26
|
+
children: /* @__PURE__ */ jsxs(Fragment, { children: [(hasLabel || showValue) && /* @__PURE__ */ jsxs("div", {
|
|
27
|
+
className: "nz-meter-header",
|
|
28
|
+
"data-slot": "meter-header",
|
|
29
|
+
children: [hasLabel && /* @__PURE__ */ jsx("span", {
|
|
30
|
+
id: labelId,
|
|
31
|
+
className: "nz-meter-label",
|
|
32
|
+
"data-slot": "meter-label",
|
|
33
|
+
children: label
|
|
34
|
+
}), showValue && /* @__PURE__ */ jsx("span", {
|
|
35
|
+
className: "nz-meter-value",
|
|
36
|
+
"data-slot": "meter-value",
|
|
37
|
+
"aria-hidden": "true",
|
|
38
|
+
children: shown
|
|
39
|
+
})]
|
|
40
|
+
}), /* @__PURE__ */ jsx("meter", {
|
|
41
|
+
className: "nz-meter-track",
|
|
42
|
+
"data-slot": "meter-track",
|
|
43
|
+
min: lo,
|
|
44
|
+
max: hi,
|
|
45
|
+
value: current,
|
|
46
|
+
low: finite(low),
|
|
47
|
+
high: finite(high),
|
|
48
|
+
optimum: finite(optimum),
|
|
49
|
+
"aria-label": ariaLabel,
|
|
50
|
+
"aria-labelledby": ariaLabelledBy ?? (hasLabel ? labelId : void 0),
|
|
51
|
+
"aria-valuetext": valueText
|
|
52
|
+
})] })
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
function finite(value) {
|
|
56
|
+
return value !== void 0 && Number.isFinite(value) ? value : void 0;
|
|
57
|
+
}
|
|
58
|
+
//#endregion
|
|
59
|
+
export { Meter };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Metric, metricLabels } from "./metric.js";
|
|
@@ -0,0 +1,72 @@
|
|
|
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/metric/metric.d.ts
|
|
5
|
+
/** `default`: Numeric/KPI, the change on its own row (KPI Tile). `display`: Numeric/Display, the change beside the number (Revenue Card). */
|
|
6
|
+
export type MetricSize = "default" | "display";
|
|
7
|
+
/**
|
|
8
|
+
* Strings Metric renders (§16.4), all visually hidden or replaceable by a slot. `{label}` is replaced
|
|
9
|
+
* by the `label` prop.
|
|
10
|
+
*/
|
|
11
|
+
export interface MetricLabels {
|
|
12
|
+
/** Static text while `status="loading"` (§16.5: `aria-busy` plus this, no live region). @default 'Loading {label}' */
|
|
13
|
+
loading: string;
|
|
14
|
+
/** Read after the "—" when there is no value and no `empty` slot. @default 'No data' */
|
|
15
|
+
empty: string;
|
|
16
|
+
/** The InlineError message when loading failed and there is no `error` slot. @default 'Could not load {label}' */
|
|
17
|
+
error: string;
|
|
18
|
+
}
|
|
19
|
+
/** English defaults of Metric's strings; KpiTile and TrendCard use them too. */
|
|
20
|
+
export declare const metricLabels: MetricLabels;
|
|
21
|
+
export interface MetricState {
|
|
22
|
+
/** The status as rendered: `'empty'` when a ready metric has no value. */
|
|
23
|
+
status: DataStatus;
|
|
24
|
+
pending: boolean;
|
|
25
|
+
size: MetricSize;
|
|
26
|
+
}
|
|
27
|
+
/** The value and status props Metric, KpiTile and TrendCard share. */
|
|
28
|
+
export interface MetricDataProps {
|
|
29
|
+
/** The name of the number, for example "Total sales". Also names the status texts. */
|
|
30
|
+
label: ReactNode;
|
|
31
|
+
/** The number. `null` or `undefined` (or `NaN`) with `status="ready"` renders the empty state. */
|
|
32
|
+
value?: number | null | undefined;
|
|
33
|
+
/** `Intl.NumberFormat` options for the value. @default {} */
|
|
34
|
+
format?: Intl.NumberFormatOptions | undefined;
|
|
35
|
+
/** BCP 47 tag for the value and a numeric `delta`. @default 'en-US' */
|
|
36
|
+
locale?: string | undefined;
|
|
37
|
+
/**
|
|
38
|
+
* The change. A number renders `<Delta value={delta} locale={locale} />` (a fraction: `0.124` is
|
|
39
|
+
* "+12.4%"); pass your own `<Delta … />` element for another format, a tone or an icon.
|
|
40
|
+
*/
|
|
41
|
+
delta?: number | ReactElement | undefined;
|
|
42
|
+
/** Visible text after the delta, for example "vs last week". */
|
|
43
|
+
comparison?: ReactNode | undefined;
|
|
44
|
+
/** §16.5 lifecycle. @default 'ready' */
|
|
45
|
+
status?: DataStatus | undefined;
|
|
46
|
+
/** A refresh is in flight while the value shows: `data-pending` and `aria-busy`. */
|
|
47
|
+
pending?: boolean | undefined;
|
|
48
|
+
/** Replaces the "—" of the empty state. */
|
|
49
|
+
empty?: ReactNode | undefined;
|
|
50
|
+
/** Replaces the InlineError of the error state, for example one with a Retry `action`. */
|
|
51
|
+
error?: ReactNode | undefined;
|
|
52
|
+
labels?: Partial<MetricLabels> | undefined;
|
|
53
|
+
}
|
|
54
|
+
export interface MetricProps extends MetricDataProps, Omit<ComponentPropsWithRef<"div">, "children"> {
|
|
55
|
+
/** @default 'default' */
|
|
56
|
+
size?: MetricSize;
|
|
57
|
+
/**
|
|
58
|
+
* A small chart at the end of the value row, for example a Sparkline; shown while ready. Its box is
|
|
59
|
+
* at most the row's (KpiTile draws it at 88 × 28, Figma's tile).
|
|
60
|
+
*/
|
|
61
|
+
chart?: ReactNode;
|
|
62
|
+
/** The id of the label element, for an enclosing group's `aria-labelledby` (KpiTile sets it). */
|
|
63
|
+
labelId?: string;
|
|
64
|
+
/**
|
|
65
|
+
* Keep the change row's height when there is no `delta` and no `comparison`, so the box is the same
|
|
66
|
+
* whatever a fallback passes (KpiTile and TrendCard set it: Figma's tile and card always have it).
|
|
67
|
+
*/
|
|
68
|
+
reserveChange?: boolean;
|
|
69
|
+
render?: RenderProp<MetricState>;
|
|
70
|
+
}
|
|
71
|
+
export declare function Metric({ label, value, format, locale, delta, comparison, status, pending, empty, error, labels, size, chart, labelId, reserveChange, render, className, ...rest }: MetricProps): ReactElement;
|
|
72
|
+
//#endregion
|
|
@@ -0,0 +1,116 @@
|
|
|
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 { Delta } from "../delta/delta.js";
|
|
5
|
+
import { dataStatusAttrs } from "../_internal/data-status.js";
|
|
6
|
+
import { NumberValue } from "../number-value/number-value.js";
|
|
7
|
+
import { Skeleton } from "../skeleton/skeleton.js";
|
|
8
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
//#region src/metric/metric.tsx
|
|
10
|
+
/** English defaults of Metric's strings; KpiTile and TrendCard use them too. */
|
|
11
|
+
const metricLabels = {
|
|
12
|
+
loading: "Loading {label}",
|
|
13
|
+
empty: "No data",
|
|
14
|
+
error: "Could not load {label}"
|
|
15
|
+
};
|
|
16
|
+
/** `template` with its `{label}` replaced by the label node (which may be an element). */
|
|
17
|
+
function fillLabel(template, label) {
|
|
18
|
+
const at = template.indexOf("{label}");
|
|
19
|
+
if (at < 0) return template;
|
|
20
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
21
|
+
template.slice(0, at),
|
|
22
|
+
label,
|
|
23
|
+
template.slice(at + 7)
|
|
24
|
+
] });
|
|
25
|
+
}
|
|
26
|
+
/** The status Metric renders: a ready metric without a finite-or-infinite number is empty. */
|
|
27
|
+
function resolveStatus(status, value) {
|
|
28
|
+
return status === "ready" && (value == null || Number.isNaN(value)) ? "empty" : status;
|
|
29
|
+
}
|
|
30
|
+
function Metric({ label, value, format, locale = "en-US", delta, comparison, status = "ready", pending = false, empty, error, labels, size = "default", chart, labelId, reserveChange = false, render, className, ...rest }) {
|
|
31
|
+
const L = {
|
|
32
|
+
...metricLabels,
|
|
33
|
+
...labels
|
|
34
|
+
};
|
|
35
|
+
const st = resolveStatus(status, value);
|
|
36
|
+
const ready = st === "ready";
|
|
37
|
+
const busy = ready && pending;
|
|
38
|
+
let shown;
|
|
39
|
+
if (st === "loading") shown = /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Skeleton, {
|
|
40
|
+
shape: "block",
|
|
41
|
+
className: "nz-metric-value-skeleton"
|
|
42
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
43
|
+
className: "nz-visually-hidden",
|
|
44
|
+
children: fillLabel(L.loading, label)
|
|
45
|
+
})] });
|
|
46
|
+
else if (st === "error") shown = error ?? /* @__PURE__ */ jsx(InlineError, { children: fillLabel(L.error, label) });
|
|
47
|
+
else if (st === "empty") shown = empty ?? /* @__PURE__ */ jsxs("span", {
|
|
48
|
+
className: "nz-metric-empty",
|
|
49
|
+
"data-slot": "metric-empty",
|
|
50
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
51
|
+
"aria-hidden": "true",
|
|
52
|
+
children: "—"
|
|
53
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
54
|
+
className: "nz-visually-hidden",
|
|
55
|
+
children: fillLabel(L.empty, label)
|
|
56
|
+
})]
|
|
57
|
+
});
|
|
58
|
+
else shown = /* @__PURE__ */ jsx(NumberValue, {
|
|
59
|
+
className: "nz-metric-value",
|
|
60
|
+
value: value ?? 0,
|
|
61
|
+
format,
|
|
62
|
+
locale
|
|
63
|
+
});
|
|
64
|
+
const hasChange = delta !== void 0 || comparison != null;
|
|
65
|
+
let change;
|
|
66
|
+
if (hasChange || reserveChange) change = /* @__PURE__ */ jsx("div", {
|
|
67
|
+
className: "nz-metric-change",
|
|
68
|
+
"data-slot": "metric-change",
|
|
69
|
+
children: st === "loading" && hasChange ? /* @__PURE__ */ jsx(Skeleton, {
|
|
70
|
+
shape: "block",
|
|
71
|
+
className: "nz-metric-change-skeleton"
|
|
72
|
+
}) : ready && /* @__PURE__ */ jsxs(Fragment, { children: [typeof delta === "number" ? /* @__PURE__ */ jsx(Delta, {
|
|
73
|
+
value: delta,
|
|
74
|
+
locale
|
|
75
|
+
}) : delta, comparison != null && /* @__PURE__ */ jsx("span", {
|
|
76
|
+
className: "nz-metric-comparison",
|
|
77
|
+
"data-slot": "metric-comparison",
|
|
78
|
+
children: comparison
|
|
79
|
+
})] })
|
|
80
|
+
});
|
|
81
|
+
return renderElement("div", render, {
|
|
82
|
+
status: st,
|
|
83
|
+
pending: busy,
|
|
84
|
+
size
|
|
85
|
+
}, {
|
|
86
|
+
"data-slot": "metric",
|
|
87
|
+
"data-size": size,
|
|
88
|
+
...dataStatusAttrs(st, busy),
|
|
89
|
+
...rest,
|
|
90
|
+
className: cx("nz-metric", className),
|
|
91
|
+
children: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
92
|
+
/* @__PURE__ */ jsx("div", {
|
|
93
|
+
className: "nz-metric-label",
|
|
94
|
+
"data-slot": "metric-label",
|
|
95
|
+
id: labelId,
|
|
96
|
+
children: label
|
|
97
|
+
}),
|
|
98
|
+
/* @__PURE__ */ jsxs("div", {
|
|
99
|
+
className: "nz-metric-value-row",
|
|
100
|
+
"data-slot": "metric-value-row",
|
|
101
|
+
children: [
|
|
102
|
+
shown,
|
|
103
|
+
size === "display" && change,
|
|
104
|
+
chart != null && ready && /* @__PURE__ */ jsx("div", {
|
|
105
|
+
className: "nz-metric-chart",
|
|
106
|
+
"data-slot": "metric-chart",
|
|
107
|
+
children: chart
|
|
108
|
+
})
|
|
109
|
+
]
|
|
110
|
+
}),
|
|
111
|
+
size === "default" && change
|
|
112
|
+
] })
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
//#endregion
|
|
116
|
+
export { Metric, fillLabel, metricLabels, resolveStatus };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { MobileTabBarItem, MobileTabBarItemProps, MobileTabBarItemState, MobileTabBarLabels, MobileTabBarRoot, MobileTabBarRootProps } from "./mobile-tab-bar.js";
|
|
2
|
+
import { MobileTabBarMore, MobileTabBarMoreLabels, MobileTabBarMoreProps } from "./mobile-tab-bar-more.client.js";
|
|
3
|
+
import { mobile_tab_bar_parts_d_exports } from "./mobile-tab-bar.parts.js";
|
|
4
|
+
export { mobile_tab_bar_parts_d_exports as MobileTabBar, MobileTabBarItem, type MobileTabBarItemProps, type MobileTabBarItemState, type MobileTabBarLabels, MobileTabBarMore, type MobileTabBarMoreLabels, type MobileTabBarMoreProps, MobileTabBarRoot, type MobileTabBarRootProps };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { MobileTabBarItem, MobileTabBarRoot } from "./mobile-tab-bar.js";
|
|
2
|
+
import { MobileTabBarMore } from "./mobile-tab-bar-more.client.js";
|
|
3
|
+
import { mobile_tab_bar_parts_exports } from "./mobile-tab-bar.parts.js";
|
|
4
|
+
export { mobile_tab_bar_parts_exports as MobileTabBar, MobileTabBarItem, MobileTabBarMore, MobileTabBarRoot };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useLayoutEffect, useRef } from "react";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
//#region src/mobile-tab-bar/mobile-tab-bar-inset.client.tsx
|
|
5
|
+
const INSET = "--nz-layout-bottom-inset";
|
|
6
|
+
const MARK = "data-nz-bottom-bar";
|
|
7
|
+
function MobileTabBarInset() {
|
|
8
|
+
const ref = useRef(null);
|
|
9
|
+
useLayoutEffect(() => {
|
|
10
|
+
const bar = ref.current?.parentElement;
|
|
11
|
+
if (bar == null || typeof ResizeObserver === "undefined") return void 0;
|
|
12
|
+
const root = document.documentElement;
|
|
13
|
+
const write = () => {
|
|
14
|
+
const height = bar.getBoundingClientRect().height;
|
|
15
|
+
if (height > 0) {
|
|
16
|
+
root.style.setProperty(INSET, `${height}px`);
|
|
17
|
+
root.setAttribute(MARK, "");
|
|
18
|
+
} else {
|
|
19
|
+
root.style.removeProperty(INSET);
|
|
20
|
+
root.removeAttribute(MARK);
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
write();
|
|
24
|
+
const observer = new ResizeObserver(write);
|
|
25
|
+
observer.observe(bar);
|
|
26
|
+
return () => {
|
|
27
|
+
observer.disconnect();
|
|
28
|
+
root.style.removeProperty(INSET);
|
|
29
|
+
root.removeAttribute(MARK);
|
|
30
|
+
};
|
|
31
|
+
}, []);
|
|
32
|
+
return /* @__PURE__ */ jsx("span", {
|
|
33
|
+
ref,
|
|
34
|
+
hidden: true
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
//#endregion
|
|
38
|
+
export { MobileTabBarInset };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { DrawerTriggerProps } from "../drawer/drawer.contract.js";
|
|
2
|
+
import { ReactElement, ReactNode } from "react";
|
|
3
|
+
//#region src/mobile-tab-bar/mobile-tab-bar-more.client.d.ts
|
|
4
|
+
/** Strings this part renders (§16.4). */
|
|
5
|
+
export interface MobileTabBarMoreLabels {
|
|
6
|
+
/** The button's label in the bar, and the sheet's title. @default 'More' */
|
|
7
|
+
more: string;
|
|
8
|
+
/** The sheet's close button. @default 'Close' */
|
|
9
|
+
close: string;
|
|
10
|
+
}
|
|
11
|
+
export interface MobileTabBarMoreProps extends Omit<DrawerTriggerProps, "render" | "children"> {
|
|
12
|
+
/**
|
|
13
|
+
* The page being shown is one of the sheet's: draws the bar's filled indicator on More. It is a
|
|
14
|
+
* button, so nothing is announced; the sheet's link carries `aria-current`. @default false
|
|
15
|
+
*/
|
|
16
|
+
current?: boolean;
|
|
17
|
+
/** The glyph in the bar. Defaults to the internal `ellipsis` (Lucide's). */
|
|
18
|
+
icon?: ReactNode;
|
|
19
|
+
/** The sheet's title, when it differs from the button's label. */
|
|
20
|
+
heading?: ReactNode;
|
|
21
|
+
labels?: Partial<MobileTabBarMoreLabels>;
|
|
22
|
+
/** The sheet's content: the other destinations, usually `NavItem`s. */
|
|
23
|
+
children: ReactNode;
|
|
24
|
+
}
|
|
25
|
+
export declare function MobileTabBarMore({ current, icon, heading, labels: labelsProp, className, children, ...rest }: MobileTabBarMoreProps): ReactElement;
|
|
26
|
+
//#endregion
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cx } from "../_internal/cx.js";
|
|
3
|
+
import { useLabels } from "../config/config.client.js";
|
|
4
|
+
import { EllipsisGlyph } from "../_internal/glyphs.js";
|
|
5
|
+
import { DrawerBody, DrawerClose, DrawerHeader, DrawerPopup, DrawerRoot, DrawerTitle, DrawerTrigger } from "../drawer/drawer.client.js";
|
|
6
|
+
import { useState } from "react";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
//#region src/mobile-tab-bar/mobile-tab-bar-more.client.tsx
|
|
9
|
+
function MobileTabBarMore({ current = false, icon, heading, labels: labelsProp, className, children, ...rest }) {
|
|
10
|
+
const labels = useLabels("mobileTabBarMore", labelsProp);
|
|
11
|
+
const [open, setOpen] = useState(false);
|
|
12
|
+
const more = labels?.more ?? "More";
|
|
13
|
+
const closeOnLink = (event) => {
|
|
14
|
+
if (event.target instanceof Element && event.target.closest("a[href]") !== null) setOpen(false);
|
|
15
|
+
};
|
|
16
|
+
return /* @__PURE__ */ jsx("li", {
|
|
17
|
+
className: "nz-mobile-tab-bar-more",
|
|
18
|
+
"data-slot": "mobile-tab-bar-more",
|
|
19
|
+
children: /* @__PURE__ */ jsxs(DrawerRoot, {
|
|
20
|
+
open,
|
|
21
|
+
onOpenChange: setOpen,
|
|
22
|
+
children: [/* @__PURE__ */ jsx(DrawerTrigger, {
|
|
23
|
+
...rest,
|
|
24
|
+
render: (props) => /* @__PURE__ */ jsxs("button", {
|
|
25
|
+
...props,
|
|
26
|
+
type: "button",
|
|
27
|
+
"data-slot": "mobile-tab-bar-more-trigger",
|
|
28
|
+
"data-current": current ? "" : void 0,
|
|
29
|
+
className: cx("nz-mobile-tab-bar-more-trigger", typeof props["className"] === "string" ? props["className"] : void 0, className),
|
|
30
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
31
|
+
className: "nz-mobile-tab-bar-more-indicator",
|
|
32
|
+
"data-slot": "mobile-tab-bar-more-indicator",
|
|
33
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
34
|
+
className: "nz-mobile-tab-bar-icon",
|
|
35
|
+
"aria-hidden": "true",
|
|
36
|
+
children: icon ?? /* @__PURE__ */ jsx(EllipsisGlyph, {})
|
|
37
|
+
})
|
|
38
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
39
|
+
className: "nz-mobile-tab-bar-more-label",
|
|
40
|
+
"data-slot": "mobile-tab-bar-more-label",
|
|
41
|
+
children: more
|
|
42
|
+
})]
|
|
43
|
+
})
|
|
44
|
+
}), /* @__PURE__ */ jsxs(DrawerPopup, {
|
|
45
|
+
side: "bottom",
|
|
46
|
+
children: [
|
|
47
|
+
/* @__PURE__ */ jsx(DrawerHeader, { children: /* @__PURE__ */ jsx(DrawerTitle, { children: heading ?? more }) }),
|
|
48
|
+
/* @__PURE__ */ jsx(DrawerClose, { labels: { close: labels?.close ?? "Close" } }),
|
|
49
|
+
/* @__PURE__ */ jsx(DrawerBody, {
|
|
50
|
+
className: "nz-mobile-tab-bar-more-sheet",
|
|
51
|
+
onClick: closeOnLink,
|
|
52
|
+
children
|
|
53
|
+
})
|
|
54
|
+
]
|
|
55
|
+
})]
|
|
56
|
+
})
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
//#endregion
|
|
60
|
+
export { MobileTabBarMore };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { RenderProp } from "../contracts/render.js";
|
|
2
|
+
import { ComponentPropsWithRef, ReactElement, ReactNode } from "react";
|
|
3
|
+
//#region src/mobile-tab-bar/mobile-tab-bar.d.ts
|
|
4
|
+
/** Strings this part renders (§16.4). */
|
|
5
|
+
export interface MobileTabBarLabels {
|
|
6
|
+
/** The navigation landmark's name. @default 'Primary' */
|
|
7
|
+
nav: string;
|
|
8
|
+
}
|
|
9
|
+
export interface MobileTabBarItemState {
|
|
10
|
+
current: boolean;
|
|
11
|
+
}
|
|
12
|
+
export interface MobileTabBarRootProps extends ComponentPropsWithRef<"nav"> {
|
|
13
|
+
labels?: Partial<MobileTabBarLabels>;
|
|
14
|
+
/** The destinations: `MobileTabBar.Item`s, and `MobileTabBarMore` last. Five at most fit. */
|
|
15
|
+
children: ReactNode;
|
|
16
|
+
}
|
|
17
|
+
export interface MobileTabBarItemProps extends Omit<ComponentPropsWithRef<"a">, "children"> {
|
|
18
|
+
/** The page being shown: `aria-current="page"` and the filled indicator. @default false */
|
|
19
|
+
current?: boolean;
|
|
20
|
+
/** A decorative 20 px glyph in the indicator; it is `aria-hidden`. */
|
|
21
|
+
icon: ReactNode;
|
|
22
|
+
/**
|
|
23
|
+
* A count on the icon's corner, such as open orders. It is part of the link's text, so it is
|
|
24
|
+
* announced with the label: write it so it reads well there ("12 open").
|
|
25
|
+
*/
|
|
26
|
+
count?: ReactNode;
|
|
27
|
+
/** The router's link, for example `render={<Link href="/orders" />}`. It must render an `<a>`. */
|
|
28
|
+
render?: RenderProp<MobileTabBarItemState>;
|
|
29
|
+
/** The label under the icon. */
|
|
30
|
+
children: ReactNode;
|
|
31
|
+
}
|
|
32
|
+
/** The `<nav>` and its list, with the bottom-inset island. */
|
|
33
|
+
export declare function MobileTabBarRoot({ labels, className, children, ...rest }: MobileTabBarRootProps): ReactElement;
|
|
34
|
+
/**
|
|
35
|
+
* One destination: a list item around a link, with its icon in Figma's indicator pill and its label
|
|
36
|
+
* under it. Props other than `icon`, `count` and `current` go to the link.
|
|
37
|
+
*/
|
|
38
|
+
export declare function MobileTabBarItem({ current, icon, count, render, className, children, ...rest }: MobileTabBarItemProps): ReactElement;
|
|
39
|
+
//#endregion
|