@primecoderin/fast-ui-react 0.0.0-stage → 0.1.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/CHANGELOG.md +90 -0
- package/LICENSE +21 -0
- package/README.md +180 -3
- package/dist/_virtual/_rolldown/runtime.js +12 -0
- package/dist/charts.d.ts +7 -0
- package/dist/charts.js +7 -0
- package/dist/components/Avatar/Avatar.d.ts +12 -0
- package/dist/components/Avatar/Avatar.js +92 -0
- package/dist/components/Button/Button.d.ts +44 -0
- package/dist/components/Button/Button.js +221 -0
- package/dist/components/Checkbox/CheckboxBox.d.ts +33 -0
- package/dist/components/Checkbox/CheckboxBox.js +148 -0
- package/dist/components/CodeSnippet/CodeSnippet.d.ts +26 -0
- package/dist/components/CodeSnippet/CodeSnippet.js +153 -0
- package/dist/components/Collapsible/Collapsible.d.ts +20 -0
- package/dist/components/Collapsible/Collapsible.js +97 -0
- package/dist/components/Container/Container.d.ts +301 -0
- package/dist/components/Container/Container.js +20 -0
- package/dist/components/FloatingActionButton/FloatingActionButton.d.ts +22 -0
- package/dist/components/FloatingActionButton/FloatingActionButton.js +141 -0
- package/dist/components/Grid/Grid.d.ts +311 -0
- package/dist/components/Grid/Grid.js +30 -0
- package/dist/components/IconTile/IconTile.d.ts +12 -0
- package/dist/components/IconTile/IconTile.js +70 -0
- package/dist/components/InlineError/InlineError.d.ts +9 -0
- package/dist/components/InlineError/InlineError.js +62 -0
- package/dist/components/Kbd/Kbd.d.ts +11 -0
- package/dist/components/Kbd/Kbd.js +31 -0
- package/dist/components/Link/Link.d.ts +18 -0
- package/dist/components/Link/Link.js +68 -0
- package/dist/components/Menu/ContextMenu.d.ts +18 -0
- package/dist/components/Menu/ContextMenu.js +68 -0
- package/dist/components/Menu/Menu.d.ts +86 -0
- package/dist/components/Menu/Menu.js +394 -0
- package/dist/components/OtpInput/OtpInput.d.ts +32 -0
- package/dist/components/OtpInput/OtpInput.js +177 -0
- package/dist/components/Popover/HoverPopover.d.ts +22 -0
- package/dist/components/Popover/HoverPopover.js +74 -0
- package/dist/components/Popover/Popover.d.ts +21 -0
- package/dist/components/Popover/Popover.js +64 -0
- package/dist/components/ProgressBar/ProgressBar.d.ts +17 -0
- package/dist/components/ProgressBar/ProgressBar.js +44 -0
- package/dist/components/Rating/Rating.d.ts +49 -0
- package/dist/components/Rating/Rating.js +241 -0
- package/dist/components/ScrollArea/ScrollArea.d.ts +23 -0
- package/dist/components/ScrollArea/ScrollArea.js +90 -0
- package/dist/components/SegmentedControl/SegmentedControl.d.ts +29 -0
- package/dist/components/SegmentedControl/SegmentedControl.js +99 -0
- package/dist/components/Separator/Separator.d.ts +9 -0
- package/dist/components/Separator/Separator.js +34 -0
- package/dist/components/Skeleton/Skeleton.d.ts +31 -0
- package/dist/components/Skeleton/Skeleton.js +152 -0
- package/dist/components/Slider/Slider.d.ts +54 -0
- package/dist/components/Slider/Slider.js +178 -0
- package/dist/components/Spinner/Spinner.d.ts +17 -0
- package/dist/components/Spinner/Spinner.js +118 -0
- package/dist/components/Stack/Stack.d.ts +302 -0
- package/dist/components/Stack/Stack.js +14 -0
- package/dist/components/StateIcon/StateIcon.d.ts +11 -0
- package/dist/components/StateIcon/StateIcon.js +65 -0
- package/dist/components/StatusBadge/StatusBadge.d.ts +19 -0
- package/dist/components/StatusBadge/StatusBadge.js +82 -0
- package/dist/components/Tabs/Tabs.d.ts +28 -0
- package/dist/components/Tabs/Tabs.js +109 -0
- package/dist/components/Tag/Tag.d.ts +11 -0
- package/dist/components/Tag/Tag.js +66 -0
- package/dist/components/Toast/AppToaster.d.ts +8 -0
- package/dist/components/Toast/AppToaster.js +135 -0
- package/dist/components/Toast/toast-manager.d.ts +28 -0
- package/dist/components/Toast/toast-manager.js +47 -0
- package/dist/components/ToggleButton/ToggleButton.d.ts +26 -0
- package/dist/components/ToggleButton/ToggleButton.js +106 -0
- package/dist/components/ToggleGroup/ToggleGroup.d.ts +32 -0
- package/dist/components/ToggleGroup/ToggleGroup.js +79 -0
- package/dist/components/Tooltip/Tooltip.d.ts +16 -0
- package/dist/components/Tooltip/Tooltip.js +58 -0
- package/dist/components/Tooltip/TooltipGroup.d.ts +22 -0
- package/dist/components/Tooltip/TooltipGroup.js +65 -0
- package/dist/components/Typography/Typography.d.ts +17 -0
- package/dist/components/Typography/Typography.js +100 -0
- package/dist/editor-forms.d.ts +1 -0
- package/dist/editor-forms.js +1 -0
- package/dist/editor.d.ts +1 -0
- package/dist/editor.js +1 -0
- package/dist/fonts/LICENSE +93 -0
- package/dist/fonts/inter-cyrillic-ext-wght-normal.woff2 +0 -0
- package/dist/fonts/inter-cyrillic-wght-normal.woff2 +0 -0
- package/dist/fonts/inter-greek-ext-wght-normal.woff2 +0 -0
- package/dist/fonts/inter-greek-wght-normal.woff2 +0 -0
- package/dist/fonts/inter-latin-ext-wght-normal.woff2 +0 -0
- package/dist/fonts/inter-latin-wght-normal.woff2 +0 -0
- package/dist/fonts/inter-vietnamese-wght-normal.woff2 +0 -0
- package/dist/fonts.css +69 -0
- package/dist/forms.d.ts +22 -0
- package/dist/forms.js +23 -0
- package/dist/foundation.css +23 -0
- package/dist/global.css +116 -0
- package/dist/hooks/useAppToast.d.ts +12 -0
- package/dist/hooks/useAppToast.js +29 -0
- package/dist/icons/icons.d.ts +43 -0
- package/dist/icons/icons.js +44 -0
- package/dist/index.d.ts +106 -0
- package/dist/index.js +101 -0
- package/dist/patterns/Accordion/Accordion.d.ts +35 -0
- package/dist/patterns/Accordion/Accordion.js +139 -0
- package/dist/patterns/Alert/Alert.d.ts +38 -0
- package/dist/patterns/Alert/Alert.js +151 -0
- package/dist/patterns/AppShell/AppShell.d.ts +39 -0
- package/dist/patterns/AppShell/AppShell.js +218 -0
- package/dist/patterns/Breadcrumbs/Breadcrumbs.d.ts +21 -0
- package/dist/patterns/Breadcrumbs/Breadcrumbs.js +73 -0
- package/dist/patterns/Calendar/Calendar.d.ts +59 -0
- package/dist/patterns/Calendar/Calendar.js +283 -0
- package/dist/patterns/Calendar/DateRangePicker.d.ts +53 -0
- package/dist/patterns/Calendar/DateRangePicker.js +266 -0
- package/dist/patterns/Calendar/FormDateRangeField.d.ts +24 -0
- package/dist/patterns/Calendar/FormDateRangeField.js +138 -0
- package/dist/patterns/Card/Card.d.ts +26 -0
- package/dist/patterns/Card/Card.js +125 -0
- package/dist/patterns/Carousel/Carousel.d.ts +33 -0
- package/dist/patterns/Carousel/Carousel.js +127 -0
- package/dist/patterns/Cascader/Cascader.d.ts +53 -0
- package/dist/patterns/Cascader/Cascader.js +371 -0
- package/dist/patterns/Cascader/FormCascaderField.d.ts +21 -0
- package/dist/patterns/Cascader/FormCascaderField.js +130 -0
- package/dist/patterns/Charts/AreaChart.d.ts +13 -0
- package/dist/patterns/Charts/AreaChart.js +220 -0
- package/dist/patterns/Charts/BarChart.d.ts +11 -0
- package/dist/patterns/Charts/BarChart.js +220 -0
- package/dist/patterns/Charts/DonutChart.d.ts +37 -0
- package/dist/patterns/Charts/DonutChart.js +215 -0
- package/dist/patterns/Charts/GaugeChart.d.ts +44 -0
- package/dist/patterns/Charts/GaugeChart.js +210 -0
- package/dist/patterns/Charts/LineChart.d.ts +14 -0
- package/dist/patterns/Charts/LineChart.js +222 -0
- package/dist/patterns/Charts/Sparkline.d.ts +24 -0
- package/dist/patterns/Charts/Sparkline.js +81 -0
- package/dist/patterns/Charts/chart-parts.d.ts +139 -0
- package/dist/patterns/Charts/chart-parts.js +385 -0
- package/dist/patterns/Charts/gauge-math.d.ts +20 -0
- package/dist/patterns/Charts/gauge-math.js +21 -0
- package/dist/patterns/Charts/sparkline-path.d.ts +11 -0
- package/dist/patterns/Charts/sparkline-path.js +24 -0
- package/dist/patterns/ColorPicker/ColorPicker.d.ts +50 -0
- package/dist/patterns/ColorPicker/ColorPicker.js +590 -0
- package/dist/patterns/ColorPicker/FormColorField.d.ts +21 -0
- package/dist/patterns/ColorPicker/FormColorField.js +130 -0
- package/dist/patterns/ColorPicker/color-value.d.ts +19 -0
- package/dist/patterns/ColorPicker/color-value.js +72 -0
- package/dist/patterns/Combobox/Autocomplete.d.ts +48 -0
- package/dist/patterns/Combobox/Autocomplete.js +158 -0
- package/dist/patterns/Combobox/Combobox.d.ts +52 -0
- package/dist/patterns/Combobox/Combobox.js +195 -0
- package/dist/patterns/Combobox/ComboboxPopup.d.ts +24 -0
- package/dist/patterns/Combobox/ComboboxPopup.js +107 -0
- package/dist/patterns/Combobox/FormAutocompleteField.d.ts +17 -0
- package/dist/patterns/Combobox/FormAutocompleteField.js +119 -0
- package/dist/patterns/Combobox/FormComboboxField.d.ts +18 -0
- package/dist/patterns/Combobox/FormComboboxField.js +119 -0
- package/dist/patterns/Combobox/FormMultiSelectField.d.ts +18 -0
- package/dist/patterns/Combobox/FormMultiSelectField.js +119 -0
- package/dist/patterns/Combobox/MultiSelect.d.ts +54 -0
- package/dist/patterns/Combobox/MultiSelect.js +175 -0
- package/dist/patterns/CommandPalette/CommandPalette.d.ts +50 -0
- package/dist/patterns/CommandPalette/CommandPalette.js +193 -0
- package/dist/patterns/DataTable/DataTable.d.ts +107 -0
- package/dist/patterns/DataTable/DataTable.js +364 -0
- package/dist/patterns/DateTimePicker/DateTimePanel.d.ts +28 -0
- package/dist/patterns/DateTimePicker/DateTimePanel.js +444 -0
- package/dist/patterns/DateTimePicker/DateTimePicker.d.ts +75 -0
- package/dist/patterns/DateTimePicker/DateTimePicker.js +271 -0
- package/dist/patterns/DateTimePicker/FormDateTimeField.d.ts +32 -0
- package/dist/patterns/DateTimePicker/FormDateTimeField.js +148 -0
- package/dist/patterns/DateTimePicker/TimeSliders.d.ts +14 -0
- package/dist/patterns/DateTimePicker/TimeSliders.js +206 -0
- package/dist/patterns/DateTimePicker/picker-labels.d.ts +30 -0
- package/dist/patterns/DateTimePicker/picker-labels.js +23 -0
- package/dist/patterns/DateTimePicker/picker-values.d.ts +98 -0
- package/dist/patterns/DateTimePicker/picker-values.js +194 -0
- package/dist/patterns/DescriptionList/DescriptionList.d.ts +20 -0
- package/dist/patterns/DescriptionList/DescriptionList.js +57 -0
- package/dist/patterns/Dialog/Dialog.d.ts +26 -0
- package/dist/patterns/Dialog/Dialog.js +212 -0
- package/dist/patterns/Drawer/Drawer.d.ts +33 -0
- package/dist/patterns/Drawer/Drawer.js +153 -0
- package/dist/patterns/EmptyState/EmptyState.d.ts +35 -0
- package/dist/patterns/EmptyState/EmptyState.js +44 -0
- package/dist/patterns/FileUpload/FileUpload.d.ts +87 -0
- package/dist/patterns/FileUpload/FileUpload.js +417 -0
- package/dist/patterns/FileUpload/FormFileUploadField.d.ts +19 -0
- package/dist/patterns/FileUpload/FormFileUploadField.js +117 -0
- package/dist/patterns/FileUpload/add-files.d.ts +26 -0
- package/dist/patterns/FileUpload/add-files.js +35 -0
- package/dist/patterns/FileUpload/file-size.d.ts +14 -0
- package/dist/patterns/FileUpload/file-size.js +44 -0
- package/dist/patterns/FormField/CheckboxField.d.ts +26 -0
- package/dist/patterns/FormField/CheckboxField.js +97 -0
- package/dist/patterns/FormField/FieldFrame.d.ts +85 -0
- package/dist/patterns/FormField/FieldFrame.js +257 -0
- package/dist/patterns/FormField/FormCheckboxField.d.ts +17 -0
- package/dist/patterns/FormField/FormCheckboxField.js +92 -0
- package/dist/patterns/FormField/FormRadioGroupField.d.ts +16 -0
- package/dist/patterns/FormField/FormRadioGroupField.js +97 -0
- package/dist/patterns/FormField/FormRatingField.d.ts +19 -0
- package/dist/patterns/FormField/FormRatingField.js +119 -0
- package/dist/patterns/FormField/FormSelectField.d.ts +16 -0
- package/dist/patterns/FormField/FormSelectField.js +91 -0
- package/dist/patterns/FormField/FormSliderField.d.ts +22 -0
- package/dist/patterns/FormField/FormSliderField.js +128 -0
- package/dist/patterns/FormField/FormSwitchField.d.ts +19 -0
- package/dist/patterns/FormField/FormSwitchField.js +88 -0
- package/dist/patterns/FormField/FormTextAreaField.d.ts +12 -0
- package/dist/patterns/FormField/FormTextAreaField.js +91 -0
- package/dist/patterns/FormField/FormTextField.d.ts +23 -0
- package/dist/patterns/FormField/FormTextField.js +103 -0
- package/dist/patterns/FormField/RadioGroupField.d.ts +38 -0
- package/dist/patterns/FormField/RadioGroupField.js +201 -0
- package/dist/patterns/FormField/SelectField.d.ts +43 -0
- package/dist/patterns/FormField/SelectField.js +211 -0
- package/dist/patterns/FormField/SwitchField.d.ts +27 -0
- package/dist/patterns/FormField/SwitchField.js +105 -0
- package/dist/patterns/FormField/TextAreaField.d.ts +37 -0
- package/dist/patterns/FormField/TextAreaField.js +134 -0
- package/dist/patterns/FormField/TextField.d.ts +51 -0
- package/dist/patterns/FormField/TextField.js +256 -0
- package/dist/patterns/FormField/error-message.d.ts +6 -0
- package/dist/patterns/FormField/error-message.js +8 -0
- package/dist/patterns/FormField/field-styles.d.ts +44 -0
- package/dist/patterns/FormField/field-styles.js +89 -0
- package/dist/patterns/FormField/field-types.d.ts +4 -0
- package/dist/patterns/FormField/use-field-ids.d.ts +18 -0
- package/dist/patterns/FormField/use-field-ids.js +53 -0
- package/dist/patterns/List/List.d.ts +38 -0
- package/dist/patterns/List/List.js +174 -0
- package/dist/patterns/MentionsInput/FormMentionsField.d.ts +18 -0
- package/dist/patterns/MentionsInput/FormMentionsField.js +124 -0
- package/dist/patterns/MentionsInput/MentionsInput.d.ts +57 -0
- package/dist/patterns/MentionsInput/MentionsInput.js +133 -0
- package/dist/patterns/MentionsInput/mention-text.d.ts +24 -0
- package/dist/patterns/MentionsInput/mention-text.js +31 -0
- package/dist/patterns/Menubar/Menubar.d.ts +22 -0
- package/dist/patterns/Menubar/Menubar.js +79 -0
- package/dist/patterns/NavigationMenu/NavigationMenu.d.ts +27 -0
- package/dist/patterns/NavigationMenu/NavigationMenu.js +104 -0
- package/dist/patterns/NumberField/FormNumberField.d.ts +18 -0
- package/dist/patterns/NumberField/FormNumberField.js +119 -0
- package/dist/patterns/NumberField/NumberField.d.ts +57 -0
- package/dist/patterns/NumberField/NumberField.js +242 -0
- package/dist/patterns/Pagination/Pagination.d.ts +31 -0
- package/dist/patterns/Pagination/Pagination.js +275 -0
- package/dist/patterns/Pagination/page-items.d.ts +18 -0
- package/dist/patterns/Pagination/page-items.js +40 -0
- package/dist/patterns/PhoneField/FormPhoneField.d.ts +22 -0
- package/dist/patterns/PhoneField/FormPhoneField.js +97 -0
- package/dist/patterns/PhoneField/PhoneField.d.ts +60 -0
- package/dist/patterns/PhoneField/PhoneField.js +448 -0
- package/dist/patterns/PhoneField/phone-value.d.ts +26 -0
- package/dist/patterns/PhoneField/phone-value.js +38 -0
- package/dist/patterns/QRCode/QRCode.d.ts +37 -0
- package/dist/patterns/QRCode/QRCode.js +120 -0
- package/dist/patterns/QRCode/qr-path.d.ts +7 -0
- package/dist/patterns/QRCode/qr-path.js +25 -0
- package/dist/patterns/ResizablePanels/ResizablePanels.d.ts +34 -0
- package/dist/patterns/ResizablePanels/ResizablePanels.js +175 -0
- package/dist/patterns/ResizablePanels/panel-sizes.d.ts +31 -0
- package/dist/patterns/ResizablePanels/panel-sizes.js +54 -0
- package/dist/patterns/RichTextEditor/FormRichTextField.d.ts +18 -0
- package/dist/patterns/RichTextEditor/FormRichTextField.js +118 -0
- package/dist/patterns/RichTextEditor/RichTextEditor.d.ts +71 -0
- package/dist/patterns/RichTextEditor/RichTextEditor.js +453 -0
- package/dist/patterns/SearchInput/SearchInput.d.ts +26 -0
- package/dist/patterns/SearchInput/SearchInput.js +98 -0
- package/dist/patterns/SideNav/SideNav.d.ts +50 -0
- package/dist/patterns/SideNav/SideNav.js +269 -0
- package/dist/patterns/Stat/Stat.d.ts +51 -0
- package/dist/patterns/Stat/Stat.js +292 -0
- package/dist/patterns/Stepper/Stepper.d.ts +35 -0
- package/dist/patterns/Stepper/Stepper.js +110 -0
- package/dist/patterns/TagGroup/TagGroup.d.ts +44 -0
- package/dist/patterns/TagGroup/TagGroup.js +151 -0
- package/dist/patterns/TagsInput/FormTagsInputField.d.ts +18 -0
- package/dist/patterns/TagsInput/FormTagsInputField.js +124 -0
- package/dist/patterns/TagsInput/TagsInput.d.ts +51 -0
- package/dist/patterns/TagsInput/TagsInput.js +97 -0
- package/dist/patterns/Timeline/Timeline.d.ts +29 -0
- package/dist/patterns/Timeline/Timeline.js +85 -0
- package/dist/patterns/Toolbar/Toolbar.d.ts +31 -0
- package/dist/patterns/Toolbar/Toolbar.js +105 -0
- package/dist/patterns/Tour/Tour.d.ts +38 -0
- package/dist/patterns/Tour/Tour.js +333 -0
- package/dist/patterns/TransferList/FormTransferListField.d.ts +19 -0
- package/dist/patterns/TransferList/FormTransferListField.js +117 -0
- package/dist/patterns/TransferList/TransferList.d.ts +53 -0
- package/dist/patterns/TransferList/TransferList.js +441 -0
- package/dist/patterns/TreeSelect/FormTreeSelectField.d.ts +28 -0
- package/dist/patterns/TreeSelect/FormTreeSelectField.js +88 -0
- package/dist/patterns/TreeSelect/TreeSelect.d.ts +49 -0
- package/dist/patterns/TreeSelect/TreeSelect.js +375 -0
- package/dist/patterns/TreeView/TreeView.d.ts +40 -0
- package/dist/patterns/TreeView/TreeView.js +296 -0
- package/dist/provider/DesignSystemProvider.d.ts +54 -0
- package/dist/provider/DesignSystemProvider.js +270 -0
- package/dist/provider/nonce.d.ts +7 -0
- package/dist/provider/nonce.js +13 -0
- package/dist/styles.css +2 -0
- package/dist/theme/chart-palette.d.ts +51 -0
- package/dist/theme/chart-palette.js +112 -0
- package/dist/theme/create-theme.d.ts +52 -0
- package/dist/theme/create-theme.js +75 -0
- package/dist/theme/style-element.d.ts +28 -0
- package/dist/theme/style-element.js +79 -0
- package/dist/theme/tenant-branding.d.ts +48 -0
- package/dist/theme/tenant-branding.js +65 -0
- package/dist/theme/theme-switch.d.ts +25 -0
- package/dist/theme/theme-switch.js +90 -0
- package/dist/theme/token-names.d.ts +3 -0
- package/dist/theme/token-names.js +166 -0
- package/dist/theme.css +241 -0
- package/dist/tokens.css +383 -0
- package/dist/types/direction.d.ts +4 -0
- package/dist/types/tone.d.ts +7 -0
- package/dist/utils/cn.d.ts +7 -0
- package/dist/utils/cn.js +50 -0
- package/dist/utils/first-field.d.ts +8 -0
- package/dist/utils/first-field.js +10 -0
- package/dist/utils/layout.d.ts +33 -0
- package/dist/utils/layout.js +30 -0
- package/dist/utils/popup.d.ts +12 -0
- package/dist/utils/popup.js +27 -0
- package/docs/accessibility.md +61 -0
- package/docs/advanced-components.md +38 -0
- package/docs/ai-assistants.md +44 -0
- package/docs/architecture.md +65 -0
- package/docs/browser-support.md +30 -0
- package/docs/charts.md +56 -0
- package/docs/components.md +2928 -0
- package/docs/conventions.md +19 -0
- package/docs/customization.md +79 -0
- package/docs/dates-files-data.md +48 -0
- package/docs/design-principles.md +50 -0
- package/docs/faq.md +68 -0
- package/docs/forms.md +114 -0
- package/docs/getting-started.md +64 -0
- package/docs/icons.md +48 -0
- package/docs/internationalization.md +64 -0
- package/docs/layout-and-navigation.md +51 -0
- package/docs/nextjs.md +69 -0
- package/docs/releasing.md +41 -0
- package/docs/testing.md +242 -0
- package/docs/theming.md +118 -0
- package/docs/typescript.md +62 -0
- package/llms-full.txt +4574 -0
- package/llms.txt +52 -0
- package/package.json +166 -6
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { type ReactElement, type ReactNode } from "react";
|
|
2
|
+
/** An item that goes somewhere or does something; the part of a group's item that has no `children`. */
|
|
3
|
+
export interface SideNavLeaf {
|
|
4
|
+
/** Identifies the item: `current` is the `id` of the one that is open. */
|
|
5
|
+
id: string;
|
|
6
|
+
label: string;
|
|
7
|
+
/** A glyph before the label. In the collapsed bar it is all that shows, so give one to every top-level item. */
|
|
8
|
+
icon?: ReactNode | undefined;
|
|
9
|
+
href?: string | undefined;
|
|
10
|
+
/** The app's router link, `<RouterLink to="/orders" />`, to render in place of the plain `<a>`. */
|
|
11
|
+
render?: ReactElement | undefined;
|
|
12
|
+
/** For an item with neither `href` nor `render`: it is a button, and this is what it does. */
|
|
13
|
+
onSelect?: (() => void) | undefined;
|
|
14
|
+
/** At the end of the row, e.g. a count of new orders. Hidden in the collapsed bar. */
|
|
15
|
+
badge?: ReactNode | undefined;
|
|
16
|
+
}
|
|
17
|
+
export interface SideNavItem extends SideNavLeaf {
|
|
18
|
+
/** Makes the item a button that opens a list of these (one level; they cannot have their own). */
|
|
19
|
+
children?: readonly SideNavLeaf[] | undefined;
|
|
20
|
+
}
|
|
21
|
+
export interface SideNavSection {
|
|
22
|
+
id: string;
|
|
23
|
+
/** A small heading over the section's items. Leave it out for a section with none. */
|
|
24
|
+
label?: string | undefined;
|
|
25
|
+
items: readonly SideNavItem[];
|
|
26
|
+
}
|
|
27
|
+
export interface SideNavProps {
|
|
28
|
+
sections: readonly SideNavSection[];
|
|
29
|
+
/** The `id` of the item for the page the person is on: it is highlighted and gets `aria-current="page"`. */
|
|
30
|
+
current?: string | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* Show only the icons: a narrow bar, each item named by a tooltip (and, for a screen reader, by its label). A
|
|
33
|
+
* group's list does not fit there, so choosing a group calls `onExpandRequest`.
|
|
34
|
+
*/
|
|
35
|
+
collapsed?: boolean | undefined;
|
|
36
|
+
/** Called when a group is chosen in the collapsed bar: expand the bar. */
|
|
37
|
+
onExpandRequest?: (() => void) | undefined;
|
|
38
|
+
/** Called after an item is chosen, e.g. to close a drawer the navigation sits in. */
|
|
39
|
+
onNavigate?: (() => void) | undefined;
|
|
40
|
+
/** Accessible name of the navigation, e.g. "Main". */
|
|
41
|
+
"aria-label": string;
|
|
42
|
+
className?: string | undefined;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* The navigation down the side of an app: sections of items with glyphs, the page the person is on highlighted,
|
|
46
|
+
* groups that open a list under them, and a collapsed form that is only icons. It is a `<nav>`; the current item
|
|
47
|
+
* is `aria-current="page"`. Put it in AppShell, which gives it a column and turns it into a drawer on a narrow
|
|
48
|
+
* screen.
|
|
49
|
+
*/
|
|
50
|
+
export declare const SideNav: ({ sections, current, collapsed, onExpandRequest, onNavigate, "aria-label": ariaLabel, className, }: SideNavProps) => import("react").JSX.Element;
|
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { c } from "react/compiler-runtime";
|
|
3
|
+
import { useId, useState } from "react";
|
|
4
|
+
import { Collapsible } from "@base-ui/react/collapsible";
|
|
5
|
+
import { ChevronDown } from "lucide-react";
|
|
6
|
+
import { cn } from "../../utils/cn.js";
|
|
7
|
+
import { Link } from "../../components/Link/Link.js";
|
|
8
|
+
import { Tooltip } from "../../components/Tooltip/Tooltip.js";
|
|
9
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
+
// src/patterns/SideNav/SideNav.tsx
|
|
11
|
+
var ROW = cn("group/row flex min-h-10 w-full cursor-pointer items-center gap-3 rounded-md border-0 bg-transparent px-3 text-start text-body-sm font-medium text-fg-body no-underline outline-none", "transition-colors duration-150 ease-standard hover:bg-subtle hover:text-fg hover:no-underline focus-visible:no-underline", "focus-visible:ring-2 focus-visible:ring-focus focus-visible:ring-inset", "aria-[current=page]:bg-primary-light aria-[current=page]:text-primary-text data-current:text-primary-text", "[&_svg]:size-4.5 [&_svg]:shrink-0");
|
|
12
|
+
var hasCurrent = (item, current) => current !== void 0 && (item.id === current || (item.children?.some((child) => child.id === current) ?? false));
|
|
13
|
+
/**
|
|
14
|
+
* A group in the expanded bar: a button that opens and closes its list. It starts open when the current page is in
|
|
15
|
+
* it, and opens again whenever `current` moves to a page in it (a route change), so the current link is never
|
|
16
|
+
* hidden; in between, the person opens and closes it as they like.
|
|
17
|
+
*/
|
|
18
|
+
var SideNavGroup = (t0) => {
|
|
19
|
+
const $ = c(21);
|
|
20
|
+
const { item, current, children } = t0;
|
|
21
|
+
let t1;
|
|
22
|
+
if ($[0] !== current || $[1] !== item) {
|
|
23
|
+
t1 = hasCurrent(item, current);
|
|
24
|
+
$[0] = current;
|
|
25
|
+
$[1] = item;
|
|
26
|
+
$[2] = t1;
|
|
27
|
+
} else t1 = $[2];
|
|
28
|
+
const containsCurrent = t1;
|
|
29
|
+
const [open, setOpen] = useState(containsCurrent);
|
|
30
|
+
const [seenCurrent, setSeenCurrent] = useState(current);
|
|
31
|
+
if (current !== seenCurrent) {
|
|
32
|
+
setSeenCurrent(current);
|
|
33
|
+
if (containsCurrent) setOpen(true);
|
|
34
|
+
}
|
|
35
|
+
let t2;
|
|
36
|
+
if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
|
|
37
|
+
t2 = (next) => {
|
|
38
|
+
setOpen(next);
|
|
39
|
+
};
|
|
40
|
+
$[3] = t2;
|
|
41
|
+
} else t2 = $[3];
|
|
42
|
+
let t3;
|
|
43
|
+
if ($[4] === Symbol.for("react.memo_cache_sentinel")) {
|
|
44
|
+
t3 = cn(ROW, "group/trigger");
|
|
45
|
+
$[4] = t3;
|
|
46
|
+
} else t3 = $[4];
|
|
47
|
+
let t4;
|
|
48
|
+
if ($[5] !== containsCurrent) {
|
|
49
|
+
t4 = containsCurrent ? { "data-current": "" } : {};
|
|
50
|
+
$[5] = containsCurrent;
|
|
51
|
+
$[6] = t4;
|
|
52
|
+
} else t4 = $[6];
|
|
53
|
+
let t5;
|
|
54
|
+
if ($[7] !== item.label) {
|
|
55
|
+
t5 = /* @__PURE__ */ jsx("span", {
|
|
56
|
+
className: "min-w-0 flex-1 truncate",
|
|
57
|
+
children: item.label
|
|
58
|
+
});
|
|
59
|
+
$[7] = item.label;
|
|
60
|
+
$[8] = t5;
|
|
61
|
+
} else t5 = $[8];
|
|
62
|
+
let t6;
|
|
63
|
+
if ($[9] === Symbol.for("react.memo_cache_sentinel")) {
|
|
64
|
+
t6 = /* @__PURE__ */ jsx(ChevronDown, {
|
|
65
|
+
"aria-hidden": "true",
|
|
66
|
+
className: "size-4 shrink-0 text-fg-secondary transition-transform duration-200 ease-standard group-data-panel-open/trigger:rotate-180 motion-reduce:transition-none"
|
|
67
|
+
});
|
|
68
|
+
$[9] = t6;
|
|
69
|
+
} else t6 = $[9];
|
|
70
|
+
let t7;
|
|
71
|
+
if ($[10] !== item.icon || $[11] !== t4 || $[12] !== t5) {
|
|
72
|
+
t7 = /* @__PURE__ */ jsxs(Collapsible.Trigger, {
|
|
73
|
+
className: t3,
|
|
74
|
+
...t4,
|
|
75
|
+
children: [
|
|
76
|
+
item.icon,
|
|
77
|
+
t5,
|
|
78
|
+
t6
|
|
79
|
+
]
|
|
80
|
+
});
|
|
81
|
+
$[10] = item.icon;
|
|
82
|
+
$[11] = t4;
|
|
83
|
+
$[12] = t5;
|
|
84
|
+
$[13] = t7;
|
|
85
|
+
} else t7 = $[13];
|
|
86
|
+
let t8;
|
|
87
|
+
if ($[14] === Symbol.for("react.memo_cache_sentinel")) {
|
|
88
|
+
t8 = cn("h-(--collapsible-panel-height) overflow-hidden transition-[height] duration-200 ease-standard motion-reduce:transition-none", "data-ending-style:h-0 data-starting-style:h-0");
|
|
89
|
+
$[14] = t8;
|
|
90
|
+
} else t8 = $[14];
|
|
91
|
+
let t9;
|
|
92
|
+
if ($[15] !== children) {
|
|
93
|
+
t9 = /* @__PURE__ */ jsx(Collapsible.Panel, {
|
|
94
|
+
className: t8,
|
|
95
|
+
children
|
|
96
|
+
});
|
|
97
|
+
$[15] = children;
|
|
98
|
+
$[16] = t9;
|
|
99
|
+
} else t9 = $[16];
|
|
100
|
+
let t10;
|
|
101
|
+
if ($[17] !== open || $[18] !== t7 || $[19] !== t9) {
|
|
102
|
+
t10 = /* @__PURE__ */ jsxs(Collapsible.Root, {
|
|
103
|
+
open,
|
|
104
|
+
onOpenChange: t2,
|
|
105
|
+
children: [t7, t9]
|
|
106
|
+
});
|
|
107
|
+
$[17] = open;
|
|
108
|
+
$[18] = t7;
|
|
109
|
+
$[19] = t9;
|
|
110
|
+
$[20] = t10;
|
|
111
|
+
} else t10 = $[20];
|
|
112
|
+
return t10;
|
|
113
|
+
};
|
|
114
|
+
/**
|
|
115
|
+
* The navigation down the side of an app: sections of items with glyphs, the page the person is on highlighted,
|
|
116
|
+
* groups that open a list under them, and a collapsed form that is only icons. It is a `<nav>`; the current item
|
|
117
|
+
* is `aria-current="page"`. Put it in AppShell, which gives it a column and turns it into a drawer on a narrow
|
|
118
|
+
* screen.
|
|
119
|
+
*/
|
|
120
|
+
var SideNav = (t0) => {
|
|
121
|
+
const $ = c(24);
|
|
122
|
+
const { sections, current, collapsed: t1, onExpandRequest, onNavigate, "aria-label": ariaLabel, className } = t0;
|
|
123
|
+
const collapsed = t1 === void 0 ? false : t1;
|
|
124
|
+
const idPrefix = useId();
|
|
125
|
+
let t2;
|
|
126
|
+
if ($[0] !== collapsed || $[1] !== current || $[2] !== onNavigate) {
|
|
127
|
+
t2 = (item, nested) => {
|
|
128
|
+
const content = /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
129
|
+
nested ? null : item.icon,
|
|
130
|
+
/* @__PURE__ */ jsx("span", {
|
|
131
|
+
className: cn("min-w-0 flex-1 truncate", collapsed && "sr-only"),
|
|
132
|
+
children: item.label
|
|
133
|
+
}),
|
|
134
|
+
item.badge && !collapsed ? /* @__PURE__ */ jsx("span", {
|
|
135
|
+
className: "shrink-0 text-caption text-fg-secondary",
|
|
136
|
+
children: item.badge
|
|
137
|
+
}) : null
|
|
138
|
+
] });
|
|
139
|
+
const common = {
|
|
140
|
+
className: cn(ROW, nested && "min-h-9 font-normal", collapsed && "justify-center px-0"),
|
|
141
|
+
...current === item.id ? { "aria-current": "page" } : {},
|
|
142
|
+
onClick: () => {
|
|
143
|
+
item.onSelect?.();
|
|
144
|
+
onNavigate?.();
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
const row = item.href || item.render ? /* @__PURE__ */ jsx(Link, {
|
|
148
|
+
tone: "inherit",
|
|
149
|
+
underline: "hover",
|
|
150
|
+
...item.href ? { href: item.href } : {},
|
|
151
|
+
...item.render ? { render: item.render } : {},
|
|
152
|
+
...common,
|
|
153
|
+
children: content
|
|
154
|
+
}) : /* @__PURE__ */ jsx("button", {
|
|
155
|
+
type: "button",
|
|
156
|
+
...common,
|
|
157
|
+
children: content
|
|
158
|
+
});
|
|
159
|
+
return collapsed ? /* @__PURE__ */ jsx(Tooltip, {
|
|
160
|
+
content: item.label,
|
|
161
|
+
side: "inline-end",
|
|
162
|
+
children: row
|
|
163
|
+
}) : row;
|
|
164
|
+
};
|
|
165
|
+
$[0] = collapsed;
|
|
166
|
+
$[1] = current;
|
|
167
|
+
$[2] = onNavigate;
|
|
168
|
+
$[3] = t2;
|
|
169
|
+
} else t2 = $[3];
|
|
170
|
+
const leaf = t2;
|
|
171
|
+
let t3;
|
|
172
|
+
if ($[4] !== collapsed || $[5] !== current || $[6] !== leaf || $[7] !== onExpandRequest) {
|
|
173
|
+
t3 = (item_0) => {
|
|
174
|
+
if (!item_0.children) return /* @__PURE__ */ jsx("li", { children: leaf(item_0, false) }, item_0.id);
|
|
175
|
+
if (collapsed) {
|
|
176
|
+
const containsCurrent = hasCurrent(item_0, current);
|
|
177
|
+
const row_0 = /* @__PURE__ */ jsxs("button", {
|
|
178
|
+
type: "button",
|
|
179
|
+
className: cn(ROW, "justify-center px-0"),
|
|
180
|
+
...containsCurrent ? {
|
|
181
|
+
"data-current": "",
|
|
182
|
+
"aria-current": "true"
|
|
183
|
+
} : {},
|
|
184
|
+
onClick: () => {
|
|
185
|
+
onExpandRequest?.();
|
|
186
|
+
},
|
|
187
|
+
children: [item_0.icon, /* @__PURE__ */ jsx("span", {
|
|
188
|
+
className: "sr-only",
|
|
189
|
+
children: item_0.label
|
|
190
|
+
})]
|
|
191
|
+
});
|
|
192
|
+
return /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(Tooltip, {
|
|
193
|
+
content: item_0.label,
|
|
194
|
+
side: "inline-end",
|
|
195
|
+
children: row_0
|
|
196
|
+
}) }, item_0.id);
|
|
197
|
+
}
|
|
198
|
+
return /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsx(SideNavGroup, {
|
|
199
|
+
item: item_0,
|
|
200
|
+
current,
|
|
201
|
+
children: /* @__PURE__ */ jsx("ul", {
|
|
202
|
+
className: "m-0 mt-0.5 ms-5.5 flex list-none flex-col gap-0.5 border-s border-line p-0 ps-2",
|
|
203
|
+
children: item_0.children.map((child) => /* @__PURE__ */ jsx("li", { children: leaf(child, true) }, child.id))
|
|
204
|
+
})
|
|
205
|
+
}) }, item_0.id);
|
|
206
|
+
};
|
|
207
|
+
$[4] = collapsed;
|
|
208
|
+
$[5] = current;
|
|
209
|
+
$[6] = leaf;
|
|
210
|
+
$[7] = onExpandRequest;
|
|
211
|
+
$[8] = t3;
|
|
212
|
+
} else t3 = $[8];
|
|
213
|
+
const entry = t3;
|
|
214
|
+
let t4;
|
|
215
|
+
if ($[9] !== className) {
|
|
216
|
+
t4 = cn("flex min-h-0 flex-col gap-4 overflow-y-auto p-3", className);
|
|
217
|
+
$[9] = className;
|
|
218
|
+
$[10] = t4;
|
|
219
|
+
} else t4 = $[10];
|
|
220
|
+
let t5;
|
|
221
|
+
if ($[11] !== collapsed || $[12] !== entry || $[13] !== idPrefix || $[14] !== sections) {
|
|
222
|
+
let t6;
|
|
223
|
+
if ($[16] !== collapsed || $[17] !== entry || $[18] !== idPrefix) {
|
|
224
|
+
t6 = (section, index) => {
|
|
225
|
+
const headingId = `${idPrefix}-${section.id}`;
|
|
226
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
227
|
+
className: "flex flex-col gap-1",
|
|
228
|
+
children: [section.label ? collapsed ? index > 0 ? /* @__PURE__ */ jsx("span", {
|
|
229
|
+
"aria-hidden": "true",
|
|
230
|
+
className: "mx-2 h-px bg-line"
|
|
231
|
+
}) : null : /* @__PURE__ */ jsx("p", {
|
|
232
|
+
id: headingId,
|
|
233
|
+
className: "m-0 px-3 pb-1 text-tiny font-semibold text-fg-tertiary",
|
|
234
|
+
children: section.label
|
|
235
|
+
}) : null, /* @__PURE__ */ jsx("ul", {
|
|
236
|
+
...section.label && !collapsed ? { "aria-labelledby": headingId } : {},
|
|
237
|
+
...section.label && collapsed ? { "aria-label": section.label } : {},
|
|
238
|
+
className: "m-0 flex list-none flex-col gap-0.5 p-0",
|
|
239
|
+
children: section.items.map(entry)
|
|
240
|
+
})]
|
|
241
|
+
}, section.id);
|
|
242
|
+
};
|
|
243
|
+
$[16] = collapsed;
|
|
244
|
+
$[17] = entry;
|
|
245
|
+
$[18] = idPrefix;
|
|
246
|
+
$[19] = t6;
|
|
247
|
+
} else t6 = $[19];
|
|
248
|
+
t5 = sections.map(t6);
|
|
249
|
+
$[11] = collapsed;
|
|
250
|
+
$[12] = entry;
|
|
251
|
+
$[13] = idPrefix;
|
|
252
|
+
$[14] = sections;
|
|
253
|
+
$[15] = t5;
|
|
254
|
+
} else t5 = $[15];
|
|
255
|
+
let t6;
|
|
256
|
+
if ($[20] !== ariaLabel || $[21] !== t4 || $[22] !== t5) {
|
|
257
|
+
t6 = /* @__PURE__ */ jsx("nav", {
|
|
258
|
+
"aria-label": ariaLabel,
|
|
259
|
+
className: t4,
|
|
260
|
+
children: t5
|
|
261
|
+
});
|
|
262
|
+
$[20] = ariaLabel;
|
|
263
|
+
$[21] = t4;
|
|
264
|
+
$[22] = t5;
|
|
265
|
+
$[23] = t6;
|
|
266
|
+
} else t6 = $[23];
|
|
267
|
+
return t6;
|
|
268
|
+
};
|
|
269
|
+
export { SideNav };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import { type IconTileTone } from "../../components/IconTile/IconTile.js";
|
|
3
|
+
export interface StatTrend {
|
|
4
|
+
/** The change as shown, e.g. "+8.4% vs last month". */
|
|
5
|
+
text: string;
|
|
6
|
+
/** Which way the number moved. */
|
|
7
|
+
direction: "up" | "down";
|
|
8
|
+
/**
|
|
9
|
+
* Whether that is good news. Up is not always good (an error rate) and down is
|
|
10
|
+
* not always bad, so the colour follows this, not `direction`.
|
|
11
|
+
*/
|
|
12
|
+
sentiment: "positive" | "negative" | "neutral";
|
|
13
|
+
}
|
|
14
|
+
export interface StatProps {
|
|
15
|
+
label: string;
|
|
16
|
+
/** The figure, formatted by the caller. */
|
|
17
|
+
value: ReactNode;
|
|
18
|
+
/** A line of context under the figure, e.g. "this month". */
|
|
19
|
+
description?: string | undefined;
|
|
20
|
+
/** A glyph in a tile beside the label. A strip shows none. */
|
|
21
|
+
icon?: ReactNode | undefined;
|
|
22
|
+
/** The icon tile's colour. */
|
|
23
|
+
tone?: IconTileTone | undefined;
|
|
24
|
+
trend?: StatTrend | undefined;
|
|
25
|
+
className?: string | undefined;
|
|
26
|
+
}
|
|
27
|
+
/** `cards`: a row of separate cards. `strip`: one card split into cells, each figure in the brand colour. */
|
|
28
|
+
export type StatGroupVariant = "cards" | "strip";
|
|
29
|
+
export interface StatGroupProps {
|
|
30
|
+
/** Accessible name of the list, e.g. "Order summary". */
|
|
31
|
+
"aria-label": string;
|
|
32
|
+
variant?: StatGroupVariant | undefined;
|
|
33
|
+
/** The `Stat`s. */
|
|
34
|
+
children: ReactNode;
|
|
35
|
+
className?: string | undefined;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* One figure with its label, and optionally a line of context, an icon and a trend. On its own it is a card;
|
|
39
|
+
* inside a `StatGroup` it is one of the group's items, drawn as the group's variant asks.
|
|
40
|
+
*/
|
|
41
|
+
export declare const Stat: (props: StatProps) => import("react").JSX.Element;
|
|
42
|
+
/**
|
|
43
|
+
* A named list of `Stat`s in a row, as separate cards (`cards`) or one card split into cells (`strip`). The
|
|
44
|
+
* items stack on a narrow screen.
|
|
45
|
+
*
|
|
46
|
+
* <StatGroup aria-label="Order summary">
|
|
47
|
+
* <Stat label="Orders" value={128} description="this month" icon={<ShoppingCart />} />
|
|
48
|
+
* <Stat label="Failed" value={4} icon={<CircleAlert />} tone="error" />
|
|
49
|
+
* </StatGroup>
|
|
50
|
+
*/
|
|
51
|
+
export declare const StatGroup: ({ "aria-label": ariaLabel, variant, children, className }: StatGroupProps) => import("react").JSX.Element;
|
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { c } from "react/compiler-runtime";
|
|
3
|
+
import { createContext, useContext } from "react";
|
|
4
|
+
import { ArrowDown, ArrowUp } from "lucide-react";
|
|
5
|
+
import { cn } from "../../utils/cn.js";
|
|
6
|
+
import { IconTile } from "../../components/IconTile/IconTile.js";
|
|
7
|
+
import { Card } from "../Card/Card.js";
|
|
8
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
// src/patterns/Stat/Stat.tsx
|
|
10
|
+
var TREND_TONE = {
|
|
11
|
+
positive: "text-success-text",
|
|
12
|
+
negative: "text-error-text",
|
|
13
|
+
neutral: "text-fg-secondary"
|
|
14
|
+
};
|
|
15
|
+
/** The group a Stat is in, so it renders as a list item of that kind; `null` on its own. */
|
|
16
|
+
var GroupVariant = createContext(null);
|
|
17
|
+
var Trend = (t0) => {
|
|
18
|
+
const $ = c(9);
|
|
19
|
+
const { trend, className } = t0;
|
|
20
|
+
const Icon = trend.direction === "down" ? ArrowDown : ArrowUp;
|
|
21
|
+
const t1 = TREND_TONE[trend.sentiment];
|
|
22
|
+
let t2;
|
|
23
|
+
if ($[0] !== className || $[1] !== t1) {
|
|
24
|
+
t2 = cn("flex items-center gap-1 text-tiny", t1, className);
|
|
25
|
+
$[0] = className;
|
|
26
|
+
$[1] = t1;
|
|
27
|
+
$[2] = t2;
|
|
28
|
+
} else t2 = $[2];
|
|
29
|
+
let t3;
|
|
30
|
+
if ($[3] !== Icon) {
|
|
31
|
+
t3 = /* @__PURE__ */ jsx(Icon, { "aria-hidden": "true" });
|
|
32
|
+
$[3] = Icon;
|
|
33
|
+
$[4] = t3;
|
|
34
|
+
} else t3 = $[4];
|
|
35
|
+
let t4;
|
|
36
|
+
if ($[5] !== t2 || $[6] !== t3 || $[7] !== trend.text) {
|
|
37
|
+
t4 = /* @__PURE__ */ jsxs("div", {
|
|
38
|
+
className: t2,
|
|
39
|
+
children: [t3, trend.text]
|
|
40
|
+
});
|
|
41
|
+
$[5] = t2;
|
|
42
|
+
$[6] = t3;
|
|
43
|
+
$[7] = trend.text;
|
|
44
|
+
$[8] = t4;
|
|
45
|
+
} else t4 = $[8];
|
|
46
|
+
return t4;
|
|
47
|
+
};
|
|
48
|
+
/** A Stat as a card: the label with its icon tile, the figure, then the context and the trend. */
|
|
49
|
+
var StatCard = (t0) => {
|
|
50
|
+
const $ = c(22);
|
|
51
|
+
const { label, value, description, icon, tone: t1, trend, className } = t0;
|
|
52
|
+
const tone = t1 === void 0 ? "brand" : t1;
|
|
53
|
+
let t2;
|
|
54
|
+
if ($[0] !== className) {
|
|
55
|
+
t2 = cn("h-full p-4", className);
|
|
56
|
+
$[0] = className;
|
|
57
|
+
$[1] = t2;
|
|
58
|
+
} else t2 = $[1];
|
|
59
|
+
let t3;
|
|
60
|
+
if ($[2] !== label) {
|
|
61
|
+
t3 = /* @__PURE__ */ jsx("span", {
|
|
62
|
+
className: "text-tiny font-semibold text-fg-secondary",
|
|
63
|
+
children: label
|
|
64
|
+
});
|
|
65
|
+
$[2] = label;
|
|
66
|
+
$[3] = t3;
|
|
67
|
+
} else t3 = $[3];
|
|
68
|
+
let t4;
|
|
69
|
+
if ($[4] !== icon || $[5] !== tone) {
|
|
70
|
+
t4 = icon ? /* @__PURE__ */ jsx(IconTile, {
|
|
71
|
+
icon,
|
|
72
|
+
tone,
|
|
73
|
+
size: "small"
|
|
74
|
+
}) : null;
|
|
75
|
+
$[4] = icon;
|
|
76
|
+
$[5] = tone;
|
|
77
|
+
$[6] = t4;
|
|
78
|
+
} else t4 = $[6];
|
|
79
|
+
let t5;
|
|
80
|
+
if ($[7] !== t3 || $[8] !== t4) {
|
|
81
|
+
t5 = /* @__PURE__ */ jsxs("div", {
|
|
82
|
+
className: "flex items-center justify-between gap-3",
|
|
83
|
+
children: [t3, t4]
|
|
84
|
+
});
|
|
85
|
+
$[7] = t3;
|
|
86
|
+
$[8] = t4;
|
|
87
|
+
$[9] = t5;
|
|
88
|
+
} else t5 = $[9];
|
|
89
|
+
let t6;
|
|
90
|
+
if ($[10] !== value) {
|
|
91
|
+
t6 = /* @__PURE__ */ jsx("div", {
|
|
92
|
+
className: "text-figure leading-none font-black text-fg tabular-nums",
|
|
93
|
+
children: value
|
|
94
|
+
});
|
|
95
|
+
$[10] = value;
|
|
96
|
+
$[11] = t6;
|
|
97
|
+
} else t6 = $[11];
|
|
98
|
+
let t7;
|
|
99
|
+
if ($[12] !== description) {
|
|
100
|
+
t7 = description ? /* @__PURE__ */ jsx("div", {
|
|
101
|
+
className: "-mt-1.5 text-caption font-normal text-fg-tertiary",
|
|
102
|
+
children: description
|
|
103
|
+
}) : null;
|
|
104
|
+
$[12] = description;
|
|
105
|
+
$[13] = t7;
|
|
106
|
+
} else t7 = $[13];
|
|
107
|
+
let t8;
|
|
108
|
+
if ($[14] !== trend) {
|
|
109
|
+
t8 = trend ? /* @__PURE__ */ jsx(Trend, {
|
|
110
|
+
trend,
|
|
111
|
+
className: "-mt-1.5"
|
|
112
|
+
}) : null;
|
|
113
|
+
$[14] = trend;
|
|
114
|
+
$[15] = t8;
|
|
115
|
+
} else t8 = $[15];
|
|
116
|
+
let t9;
|
|
117
|
+
if ($[16] !== t2 || $[17] !== t5 || $[18] !== t6 || $[19] !== t7 || $[20] !== t8) {
|
|
118
|
+
t9 = /* @__PURE__ */ jsxs(Card, {
|
|
119
|
+
className: t2,
|
|
120
|
+
children: [
|
|
121
|
+
t5,
|
|
122
|
+
t6,
|
|
123
|
+
t7,
|
|
124
|
+
t8
|
|
125
|
+
]
|
|
126
|
+
});
|
|
127
|
+
$[16] = t2;
|
|
128
|
+
$[17] = t5;
|
|
129
|
+
$[18] = t6;
|
|
130
|
+
$[19] = t7;
|
|
131
|
+
$[20] = t8;
|
|
132
|
+
$[21] = t9;
|
|
133
|
+
} else t9 = $[21];
|
|
134
|
+
return t9;
|
|
135
|
+
};
|
|
136
|
+
/** A Stat as a cell of a strip: the figure in the brand colour beside its label and context. */
|
|
137
|
+
var StatCell = (t0) => {
|
|
138
|
+
const $ = c(18);
|
|
139
|
+
const { label, value, description, trend, className } = t0;
|
|
140
|
+
let t1;
|
|
141
|
+
if ($[0] !== className) {
|
|
142
|
+
t1 = cn("flex min-h-21.5 items-center gap-3.5 px-6 py-4.75 not-first:border-t not-first:border-line sm:not-first:border-s sm:not-first:border-t-0", className);
|
|
143
|
+
$[0] = className;
|
|
144
|
+
$[1] = t1;
|
|
145
|
+
} else t1 = $[1];
|
|
146
|
+
let t2;
|
|
147
|
+
if ($[2] !== value) {
|
|
148
|
+
t2 = /* @__PURE__ */ jsx("span", {
|
|
149
|
+
className: "text-figure text-primary-large tabular-nums",
|
|
150
|
+
children: value
|
|
151
|
+
});
|
|
152
|
+
$[2] = value;
|
|
153
|
+
$[3] = t2;
|
|
154
|
+
} else t2 = $[3];
|
|
155
|
+
let t3;
|
|
156
|
+
if ($[4] !== label) {
|
|
157
|
+
t3 = /* @__PURE__ */ jsx("span", {
|
|
158
|
+
className: "mb-1 text-body-sm font-semibold text-fg",
|
|
159
|
+
children: label
|
|
160
|
+
});
|
|
161
|
+
$[4] = label;
|
|
162
|
+
$[5] = t3;
|
|
163
|
+
} else t3 = $[5];
|
|
164
|
+
let t4;
|
|
165
|
+
if ($[6] !== description) {
|
|
166
|
+
t4 = description ? /* @__PURE__ */ jsx("span", {
|
|
167
|
+
className: "text-caption font-normal text-fg-tertiary",
|
|
168
|
+
children: description
|
|
169
|
+
}) : null;
|
|
170
|
+
$[6] = description;
|
|
171
|
+
$[7] = t4;
|
|
172
|
+
} else t4 = $[7];
|
|
173
|
+
let t5;
|
|
174
|
+
if ($[8] !== trend) {
|
|
175
|
+
t5 = trend ? /* @__PURE__ */ jsx(Trend, { trend }) : null;
|
|
176
|
+
$[8] = trend;
|
|
177
|
+
$[9] = t5;
|
|
178
|
+
} else t5 = $[9];
|
|
179
|
+
let t6;
|
|
180
|
+
if ($[10] !== t3 || $[11] !== t4 || $[12] !== t5) {
|
|
181
|
+
t6 = /* @__PURE__ */ jsxs("span", {
|
|
182
|
+
className: "flex min-w-0 flex-col",
|
|
183
|
+
children: [
|
|
184
|
+
t3,
|
|
185
|
+
t4,
|
|
186
|
+
t5
|
|
187
|
+
]
|
|
188
|
+
});
|
|
189
|
+
$[10] = t3;
|
|
190
|
+
$[11] = t4;
|
|
191
|
+
$[12] = t5;
|
|
192
|
+
$[13] = t6;
|
|
193
|
+
} else t6 = $[13];
|
|
194
|
+
let t7;
|
|
195
|
+
if ($[14] !== t1 || $[15] !== t2 || $[16] !== t6) {
|
|
196
|
+
t7 = /* @__PURE__ */ jsxs("li", {
|
|
197
|
+
className: t1,
|
|
198
|
+
children: [t2, t6]
|
|
199
|
+
});
|
|
200
|
+
$[14] = t1;
|
|
201
|
+
$[15] = t2;
|
|
202
|
+
$[16] = t6;
|
|
203
|
+
$[17] = t7;
|
|
204
|
+
} else t7 = $[17];
|
|
205
|
+
return t7;
|
|
206
|
+
};
|
|
207
|
+
/**
|
|
208
|
+
* One figure with its label, and optionally a line of context, an icon and a trend. On its own it is a card;
|
|
209
|
+
* inside a `StatGroup` it is one of the group's items, drawn as the group's variant asks.
|
|
210
|
+
*/
|
|
211
|
+
var Stat = (props) => {
|
|
212
|
+
const $ = c(6);
|
|
213
|
+
const group = useContext(GroupVariant);
|
|
214
|
+
if (group === "strip") {
|
|
215
|
+
let t0;
|
|
216
|
+
if ($[0] !== props) {
|
|
217
|
+
t0 = /* @__PURE__ */ jsx(StatCell, { ...props });
|
|
218
|
+
$[0] = props;
|
|
219
|
+
$[1] = t0;
|
|
220
|
+
} else t0 = $[1];
|
|
221
|
+
return t0;
|
|
222
|
+
}
|
|
223
|
+
if (group === "cards") {
|
|
224
|
+
let t0;
|
|
225
|
+
if ($[2] !== props) {
|
|
226
|
+
t0 = /* @__PURE__ */ jsx("li", {
|
|
227
|
+
className: "min-w-0",
|
|
228
|
+
children: /* @__PURE__ */ jsx(StatCard, { ...props })
|
|
229
|
+
});
|
|
230
|
+
$[2] = props;
|
|
231
|
+
$[3] = t0;
|
|
232
|
+
} else t0 = $[3];
|
|
233
|
+
return t0;
|
|
234
|
+
}
|
|
235
|
+
let t0;
|
|
236
|
+
if ($[4] !== props) {
|
|
237
|
+
t0 = /* @__PURE__ */ jsx(StatCard, { ...props });
|
|
238
|
+
$[4] = props;
|
|
239
|
+
$[5] = t0;
|
|
240
|
+
} else t0 = $[5];
|
|
241
|
+
return t0;
|
|
242
|
+
};
|
|
243
|
+
var GROUP = {
|
|
244
|
+
cards: "m-0 grid list-none gap-3 p-0 sm:auto-cols-fr sm:grid-flow-col",
|
|
245
|
+
strip: "m-0 grid list-none overflow-hidden rounded-lg border border-line bg-surface p-0 sm:auto-cols-fr sm:grid-flow-col"
|
|
246
|
+
};
|
|
247
|
+
/**
|
|
248
|
+
* A named list of `Stat`s in a row, as separate cards (`cards`) or one card split into cells (`strip`). The
|
|
249
|
+
* items stack on a narrow screen.
|
|
250
|
+
*
|
|
251
|
+
* <StatGroup aria-label="Order summary">
|
|
252
|
+
* <Stat label="Orders" value={128} description="this month" icon={<ShoppingCart />} />
|
|
253
|
+
* <Stat label="Failed" value={4} icon={<CircleAlert />} tone="error" />
|
|
254
|
+
* </StatGroup>
|
|
255
|
+
*/
|
|
256
|
+
var StatGroup = (t0) => {
|
|
257
|
+
const $ = c(10);
|
|
258
|
+
const { "aria-label": ariaLabel, variant: t1, children, className } = t0;
|
|
259
|
+
const variant = t1 === void 0 ? "cards" : t1;
|
|
260
|
+
const t2 = GROUP[variant];
|
|
261
|
+
let t3;
|
|
262
|
+
if ($[0] !== className || $[1] !== t2) {
|
|
263
|
+
t3 = cn(t2, className);
|
|
264
|
+
$[0] = className;
|
|
265
|
+
$[1] = t2;
|
|
266
|
+
$[2] = t3;
|
|
267
|
+
} else t3 = $[2];
|
|
268
|
+
let t4;
|
|
269
|
+
if ($[3] !== ariaLabel || $[4] !== children || $[5] !== t3) {
|
|
270
|
+
t4 = /* @__PURE__ */ jsx("ul", {
|
|
271
|
+
"aria-label": ariaLabel,
|
|
272
|
+
className: t3,
|
|
273
|
+
children
|
|
274
|
+
});
|
|
275
|
+
$[3] = ariaLabel;
|
|
276
|
+
$[4] = children;
|
|
277
|
+
$[5] = t3;
|
|
278
|
+
$[6] = t4;
|
|
279
|
+
} else t4 = $[6];
|
|
280
|
+
let t5;
|
|
281
|
+
if ($[7] !== t4 || $[8] !== variant) {
|
|
282
|
+
t5 = /* @__PURE__ */ jsx(GroupVariant.Provider, {
|
|
283
|
+
value: variant,
|
|
284
|
+
children: t4
|
|
285
|
+
});
|
|
286
|
+
$[7] = t4;
|
|
287
|
+
$[8] = variant;
|
|
288
|
+
$[9] = t5;
|
|
289
|
+
} else t5 = $[9];
|
|
290
|
+
return t5;
|
|
291
|
+
};
|
|
292
|
+
export { Stat, StatGroup };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export interface StepperStep {
|
|
2
|
+
/** Identifies the step. */
|
|
3
|
+
id: string;
|
|
4
|
+
label: string;
|
|
5
|
+
/** A line under the label, e.g. "Name and address". */
|
|
6
|
+
description?: string | undefined;
|
|
7
|
+
/** The step needs attention (its form has an error). It is drawn red, and `labels.error` is read with it. */
|
|
8
|
+
error?: boolean | undefined;
|
|
9
|
+
}
|
|
10
|
+
/** The words a screen reader hears with the state of a step. The design system has no i18n, so the caller supplies them. */
|
|
11
|
+
export interface StepperLabels {
|
|
12
|
+
/** Read after the name of a step that is done, e.g. "Completed". */
|
|
13
|
+
completed: string;
|
|
14
|
+
/** Read after the name of a step with `error`, e.g. "Needs attention". */
|
|
15
|
+
error?: string | undefined;
|
|
16
|
+
}
|
|
17
|
+
export interface StepperProps {
|
|
18
|
+
steps: readonly StepperStep[];
|
|
19
|
+
/** The index of the step the person is on: those before it are done, those after it are ahead. */
|
|
20
|
+
current: number;
|
|
21
|
+
labels: StepperLabels;
|
|
22
|
+
/** A row (default) or a column. */
|
|
23
|
+
orientation?: "horizontal" | "vertical" | undefined;
|
|
24
|
+
/** Makes the steps that are done buttons, so the person can go back to one. Called with its index. */
|
|
25
|
+
onStepClick?: ((index: number) => void) | undefined;
|
|
26
|
+
/** Accessible name of the list, e.g. "Checkout progress". */
|
|
27
|
+
"aria-label": string;
|
|
28
|
+
className?: string | undefined;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* The steps of a process and where the person is in it: done, current, ahead. An ordered list, so a screen reader
|
|
32
|
+
* announces "step 2 of 4"; the current step is `aria-current="step"` and a step that is done says so through
|
|
33
|
+
* `labels.completed`. With `onStepClick` the steps that are done are buttons that go back.
|
|
34
|
+
*/
|
|
35
|
+
export declare const Stepper: ({ steps, current, labels, orientation, onStepClick, "aria-label": ariaLabel, className, }: StepperProps) => import("react").JSX.Element;
|