@primecoderin/fast-ui-react 0.0.0-stage → 1.0.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 +106 -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 +40 -0
- package/docs/testing.md +242 -0
- package/docs/theming.md +118 -0
- package/docs/typescript.md +62 -0
- package/llms-full.txt +4573 -0
- package/llms.txt +52 -0
- package/package.json +193 -6
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import { type GaugeBand } from "./gauge-math.js";
|
|
3
|
+
export type { GaugeBand } from "./gauge-math.js";
|
|
4
|
+
export interface GaugeChartProps {
|
|
5
|
+
/**
|
|
6
|
+
* The value to show. A value outside the range is drawn at the nearer end, and the meter's value
|
|
7
|
+
* (`aria-valuenow`) is held in the range too (a value that is not a number counts as the minimum), while its text
|
|
8
|
+
* (`aria-valuetext`) still says the value as it is.
|
|
9
|
+
*/
|
|
10
|
+
value: number;
|
|
11
|
+
/** The least the gauge can show. Default 0. */
|
|
12
|
+
min?: number | undefined;
|
|
13
|
+
/** The most the gauge can show. Default 100. */
|
|
14
|
+
max?: number | undefined;
|
|
15
|
+
/**
|
|
16
|
+
* What it measures, e.g. "CPU load". It names the gauge for a screen reader, which hears it as a meter with its
|
|
17
|
+
* value, minimum and maximum.
|
|
18
|
+
*/
|
|
19
|
+
"aria-label": string;
|
|
20
|
+
/** Writes a number: in the middle of the gauge, at its ends and in what a screen reader hears. `(n) => `${n}%``. */
|
|
21
|
+
formatValue?: ((value: number) => string) | undefined;
|
|
22
|
+
/**
|
|
23
|
+
* Colours by value, from the lowest: `[{ upTo: 60, color: "var(--fast-tone-success-solid)" }, ...]`. The arc takes
|
|
24
|
+
* the colour of the band the value is in, so it turns amber and then red as the value climbs.
|
|
25
|
+
*/
|
|
26
|
+
bands?: readonly GaugeBand[] | undefined;
|
|
27
|
+
/** The arc's colour when there are no bands: a CSS colour or variable. The first chart token if omitted. */
|
|
28
|
+
color?: string | undefined;
|
|
29
|
+
/** Under the value, in the middle: what it is, e.g. "CPU load". Hidden from a screen reader, which has `aria-label`. */
|
|
30
|
+
label?: ReactNode | undefined;
|
|
31
|
+
/** Show the minimum and the maximum under the ends of the arc. */
|
|
32
|
+
showRange?: boolean | undefined;
|
|
33
|
+
/** The width in pixels; the height is a little over half. Default 200. */
|
|
34
|
+
size?: number | undefined;
|
|
35
|
+
/** Extra classes for the gauge. Merged last. */
|
|
36
|
+
className?: string | undefined;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* A dial with a half circle for the arc: where one value stands between a minimum and a maximum (load, quota used,
|
|
40
|
+
* a score). It is a `role="meter"`, so a screen reader hears the name, the value and the range, and the arc is
|
|
41
|
+
* drawn by the eye only. The colour can follow bands, so a value turns from green to red as it climbs. The arc
|
|
42
|
+
* always fills from the left, like any dial, whatever the page's direction. It is a plain SVG.
|
|
43
|
+
*/
|
|
44
|
+
export declare const GaugeChart: ({ value, min, max, "aria-label": ariaLabel, formatValue, bands, color, label, showRange, size, className, }: GaugeChartProps) => import("react").JSX.Element;
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { c } from "react/compiler-runtime";
|
|
3
|
+
import { useDirection } from "@base-ui/react/direction-provider";
|
|
4
|
+
import { cn } from "../../utils/cn.js";
|
|
5
|
+
import { clampGaugeValue, gaugeBandColor, gaugeFraction } from "./gauge-math.js";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
// src/patterns/Charts/GaugeChart.tsx
|
|
8
|
+
var ARC = "M 20 100 A 80 80 0 0 1 180 100";
|
|
9
|
+
/**
|
|
10
|
+
* A dial with a half circle for the arc: where one value stands between a minimum and a maximum (load, quota used,
|
|
11
|
+
* a score). It is a `role="meter"`, so a screen reader hears the name, the value and the range, and the arc is
|
|
12
|
+
* drawn by the eye only. The colour can follow bands, so a value turns from green to red as it climbs. The arc
|
|
13
|
+
* always fills from the left, like any dial, whatever the page's direction. It is a plain SVG.
|
|
14
|
+
*/
|
|
15
|
+
var GaugeChart = (t0) => {
|
|
16
|
+
const $ = c(55);
|
|
17
|
+
const { value, min: t1, max: t2, "aria-label": ariaLabel, formatValue, bands, color, label, showRange: t3, size: t4, className } = t0;
|
|
18
|
+
const min = t1 === void 0 ? 0 : t1;
|
|
19
|
+
const max = t2 === void 0 ? 100 : t2;
|
|
20
|
+
const showRange = t3 === void 0 ? false : t3;
|
|
21
|
+
const size = t4 === void 0 ? 200 : t4;
|
|
22
|
+
const direction = useDirection();
|
|
23
|
+
let t5;
|
|
24
|
+
if ($[0] !== formatValue) {
|
|
25
|
+
t5 = (n) => formatValue ? formatValue(n) : String(n);
|
|
26
|
+
$[0] = formatValue;
|
|
27
|
+
$[1] = t5;
|
|
28
|
+
} else t5 = $[1];
|
|
29
|
+
const write = t5;
|
|
30
|
+
const fraction = gaugeFraction(value, min, max);
|
|
31
|
+
let held;
|
|
32
|
+
let t6;
|
|
33
|
+
if ($[2] !== bands || $[3] !== color || $[4] !== max || $[5] !== min || $[6] !== value) {
|
|
34
|
+
held = clampGaugeValue(value, min, max);
|
|
35
|
+
t6 = (bands ? gaugeBandColor(held, bands) : void 0) ?? color ?? "var(--fast-chart-1)";
|
|
36
|
+
$[2] = bands;
|
|
37
|
+
$[3] = color;
|
|
38
|
+
$[4] = max;
|
|
39
|
+
$[5] = min;
|
|
40
|
+
$[6] = value;
|
|
41
|
+
$[7] = held;
|
|
42
|
+
$[8] = t6;
|
|
43
|
+
} else {
|
|
44
|
+
held = $[7];
|
|
45
|
+
t6 = $[8];
|
|
46
|
+
}
|
|
47
|
+
const stroke = t6;
|
|
48
|
+
let t7;
|
|
49
|
+
if ($[9] !== value || $[10] !== write) {
|
|
50
|
+
t7 = write(value);
|
|
51
|
+
$[9] = value;
|
|
52
|
+
$[10] = write;
|
|
53
|
+
$[11] = t7;
|
|
54
|
+
} else t7 = $[11];
|
|
55
|
+
let t8;
|
|
56
|
+
if ($[12] !== className) {
|
|
57
|
+
t8 = cn("relative inline-flex flex-col items-center", className);
|
|
58
|
+
$[12] = className;
|
|
59
|
+
$[13] = t8;
|
|
60
|
+
} else t8 = $[13];
|
|
61
|
+
let t9;
|
|
62
|
+
if ($[14] !== size) {
|
|
63
|
+
t9 = { width: size };
|
|
64
|
+
$[14] = size;
|
|
65
|
+
$[15] = t9;
|
|
66
|
+
} else t9 = $[15];
|
|
67
|
+
const t10 = size * 112 / 200;
|
|
68
|
+
let t11;
|
|
69
|
+
if ($[16] === Symbol.for("react.memo_cache_sentinel")) {
|
|
70
|
+
t11 = /* @__PURE__ */ jsx("path", {
|
|
71
|
+
d: ARC,
|
|
72
|
+
fill: "none",
|
|
73
|
+
stroke: "var(--fast-chart-grid)",
|
|
74
|
+
strokeWidth: 16,
|
|
75
|
+
strokeLinecap: "round"
|
|
76
|
+
});
|
|
77
|
+
$[16] = t11;
|
|
78
|
+
} else t11 = $[16];
|
|
79
|
+
const t12 = `${String(fraction * 100)} 100`;
|
|
80
|
+
const t13 = fraction === 0 ? "none" : void 0;
|
|
81
|
+
let t14;
|
|
82
|
+
if ($[17] !== t13) {
|
|
83
|
+
t14 = { display: t13 };
|
|
84
|
+
$[17] = t13;
|
|
85
|
+
$[18] = t14;
|
|
86
|
+
} else t14 = $[18];
|
|
87
|
+
let t15;
|
|
88
|
+
if ($[19] !== stroke || $[20] !== t12 || $[21] !== t14) {
|
|
89
|
+
t15 = /* @__PURE__ */ jsx("path", {
|
|
90
|
+
d: ARC,
|
|
91
|
+
fill: "none",
|
|
92
|
+
stroke,
|
|
93
|
+
strokeWidth: 16,
|
|
94
|
+
strokeLinecap: "round",
|
|
95
|
+
pathLength: 100,
|
|
96
|
+
strokeDasharray: t12,
|
|
97
|
+
style: t14,
|
|
98
|
+
className: "transition-[stroke-dasharray,stroke] duration-400 ease-standard motion-reduce:transition-none"
|
|
99
|
+
});
|
|
100
|
+
$[19] = stroke;
|
|
101
|
+
$[20] = t12;
|
|
102
|
+
$[21] = t14;
|
|
103
|
+
$[22] = t15;
|
|
104
|
+
} else t15 = $[22];
|
|
105
|
+
let t16;
|
|
106
|
+
if ($[23] !== size || $[24] !== t10 || $[25] !== t15) {
|
|
107
|
+
t16 = /* @__PURE__ */ jsxs("svg", {
|
|
108
|
+
"aria-hidden": "true",
|
|
109
|
+
viewBox: "0 0 200 112",
|
|
110
|
+
width: size,
|
|
111
|
+
height: t10,
|
|
112
|
+
className: "block overflow-visible",
|
|
113
|
+
children: [t11, t15]
|
|
114
|
+
});
|
|
115
|
+
$[23] = size;
|
|
116
|
+
$[24] = t10;
|
|
117
|
+
$[25] = t15;
|
|
118
|
+
$[26] = t16;
|
|
119
|
+
} else t16 = $[26];
|
|
120
|
+
let t17;
|
|
121
|
+
if ($[27] !== value || $[28] !== write) {
|
|
122
|
+
t17 = write(value);
|
|
123
|
+
$[27] = value;
|
|
124
|
+
$[28] = write;
|
|
125
|
+
$[29] = t17;
|
|
126
|
+
} else t17 = $[29];
|
|
127
|
+
let t18;
|
|
128
|
+
if ($[30] !== t17) {
|
|
129
|
+
t18 = /* @__PURE__ */ jsx("span", {
|
|
130
|
+
className: "text-h3 leading-[1.1] font-semibold tabular-nums text-fg",
|
|
131
|
+
children: t17
|
|
132
|
+
});
|
|
133
|
+
$[30] = t17;
|
|
134
|
+
$[31] = t18;
|
|
135
|
+
} else t18 = $[31];
|
|
136
|
+
let t19;
|
|
137
|
+
if ($[32] !== label) {
|
|
138
|
+
t19 = label ? /* @__PURE__ */ jsx("span", {
|
|
139
|
+
className: "text-caption text-fg-secondary",
|
|
140
|
+
children: label
|
|
141
|
+
}) : null;
|
|
142
|
+
$[32] = label;
|
|
143
|
+
$[33] = t19;
|
|
144
|
+
} else t19 = $[33];
|
|
145
|
+
let t20;
|
|
146
|
+
if ($[34] !== direction || $[35] !== t18 || $[36] !== t19) {
|
|
147
|
+
t20 = /* @__PURE__ */ jsxs("div", {
|
|
148
|
+
"aria-hidden": "true",
|
|
149
|
+
dir: direction,
|
|
150
|
+
className: "absolute inset-x-0 bottom-0 flex flex-col items-center",
|
|
151
|
+
children: [t18, t19]
|
|
152
|
+
});
|
|
153
|
+
$[34] = direction;
|
|
154
|
+
$[35] = t18;
|
|
155
|
+
$[36] = t19;
|
|
156
|
+
$[37] = t20;
|
|
157
|
+
} else t20 = $[37];
|
|
158
|
+
let t21;
|
|
159
|
+
if ($[38] !== direction || $[39] !== max || $[40] !== min || $[41] !== showRange || $[42] !== write) {
|
|
160
|
+
t21 = showRange ? /* @__PURE__ */ jsxs("div", {
|
|
161
|
+
"aria-hidden": "true",
|
|
162
|
+
className: "mt-1 flex w-full justify-between px-0.5 text-caption text-fg-secondary tabular-nums",
|
|
163
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
164
|
+
dir: direction,
|
|
165
|
+
children: write(min)
|
|
166
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
167
|
+
dir: direction,
|
|
168
|
+
children: write(max)
|
|
169
|
+
})]
|
|
170
|
+
}) : null;
|
|
171
|
+
$[38] = direction;
|
|
172
|
+
$[39] = max;
|
|
173
|
+
$[40] = min;
|
|
174
|
+
$[41] = showRange;
|
|
175
|
+
$[42] = write;
|
|
176
|
+
$[43] = t21;
|
|
177
|
+
} else t21 = $[43];
|
|
178
|
+
let t22;
|
|
179
|
+
if ($[44] !== ariaLabel || $[45] !== held || $[46] !== max || $[47] !== min || $[48] !== t16 || $[49] !== t20 || $[50] !== t21 || $[51] !== t7 || $[52] !== t8 || $[53] !== t9) {
|
|
180
|
+
t22 = /* @__PURE__ */ jsxs("div", {
|
|
181
|
+
role: "meter",
|
|
182
|
+
"aria-label": ariaLabel,
|
|
183
|
+
"aria-valuemin": min,
|
|
184
|
+
"aria-valuemax": max,
|
|
185
|
+
"aria-valuenow": held,
|
|
186
|
+
"aria-valuetext": t7,
|
|
187
|
+
dir: "ltr",
|
|
188
|
+
className: t8,
|
|
189
|
+
style: t9,
|
|
190
|
+
children: [
|
|
191
|
+
t16,
|
|
192
|
+
t20,
|
|
193
|
+
t21
|
|
194
|
+
]
|
|
195
|
+
});
|
|
196
|
+
$[44] = ariaLabel;
|
|
197
|
+
$[45] = held;
|
|
198
|
+
$[46] = max;
|
|
199
|
+
$[47] = min;
|
|
200
|
+
$[48] = t16;
|
|
201
|
+
$[49] = t20;
|
|
202
|
+
$[50] = t21;
|
|
203
|
+
$[51] = t7;
|
|
204
|
+
$[52] = t8;
|
|
205
|
+
$[53] = t9;
|
|
206
|
+
$[54] = t22;
|
|
207
|
+
} else t22 = $[54];
|
|
208
|
+
return t22;
|
|
209
|
+
};
|
|
210
|
+
export { GaugeChart };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type CartesianChartProps } from "./chart-parts.js";
|
|
2
|
+
export interface LineChartProps extends CartesianChartProps {
|
|
3
|
+
/** How the line runs between points: straight (default), smoothed (`monotone`) or in steps. */
|
|
4
|
+
curve?: "linear" | "monotone" | "step" | undefined;
|
|
5
|
+
/** Mark each point with a dot. Default off; the dot under the pointer always shows. */
|
|
6
|
+
showDots?: boolean | undefined;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Lines over a shared x axis: a trend over time, a few measures side by side. The colours are the chart tokens, so
|
|
10
|
+
* it follows the theme and a tenant's branding, and each line after the first is dashed or dotted in its own way (the
|
|
11
|
+
* legend shows the same), so the lines differ by more than colour. The drawing is for the eyes; a screen reader gets
|
|
12
|
+
* the data as a table. It is an SVG, drawn by Recharts, and fills the width of its container.
|
|
13
|
+
*/
|
|
14
|
+
export declare const LineChart: ({ data, xKey, xLabel, series, "aria-label": ariaLabel, height, formatX, formatValue, hideLegend, hideGrid, curve, showDots, className, }: LineChartProps) => import("react").JSX.Element;
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { c } from "react/compiler-runtime";
|
|
3
|
+
import { CartesianGrid, Line, LineChart as LineChart$1, ResponsiveContainer, Tooltip, XAxis, YAxis } from "recharts";
|
|
4
|
+
import { AXIS_LINE, AXIS_TICK, CURSOR_STROKE, ChartDataTable, ChartFrame, ChartLegend, ChartTooltip, GRID_STROKE, seriesColor, seriesDash, useChartFontVersion, usePrefersReducedMotion } from "./chart-parts.js";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
// src/patterns/Charts/LineChart.tsx
|
|
7
|
+
/**
|
|
8
|
+
* Lines over a shared x axis: a trend over time, a few measures side by side. The colours are the chart tokens, so
|
|
9
|
+
* it follows the theme and a tenant's branding, and each line after the first is dashed or dotted in its own way (the
|
|
10
|
+
* legend shows the same), so the lines differ by more than colour. The drawing is for the eyes; a screen reader gets
|
|
11
|
+
* the data as a table. It is an SVG, drawn by Recharts, and fills the width of its container.
|
|
12
|
+
*/
|
|
13
|
+
var LineChart = (t0) => {
|
|
14
|
+
const $ = c(55);
|
|
15
|
+
const { data, xKey, xLabel, series, "aria-label": ariaLabel, height: t1, formatX, formatValue, hideLegend: t2, hideGrid: t3, curve: t4, showDots: t5, className } = t0;
|
|
16
|
+
const height = t1 === void 0 ? 240 : t1;
|
|
17
|
+
const hideLegend = t2 === void 0 ? false : t2;
|
|
18
|
+
const hideGrid = t3 === void 0 ? false : t3;
|
|
19
|
+
const curve = t4 === void 0 ? "linear" : t4;
|
|
20
|
+
const showDots = t5 === void 0 ? false : t5;
|
|
21
|
+
const reduceMotion = usePrefersReducedMotion();
|
|
22
|
+
const font = useChartFontVersion();
|
|
23
|
+
const t6 = font.probe;
|
|
24
|
+
let t7;
|
|
25
|
+
if ($[0] !== className) {
|
|
26
|
+
t7 = className ? { className } : {};
|
|
27
|
+
$[0] = className;
|
|
28
|
+
$[1] = t7;
|
|
29
|
+
} else t7 = $[1];
|
|
30
|
+
let t8;
|
|
31
|
+
if ($[2] !== hideLegend || $[3] !== series) {
|
|
32
|
+
t8 = hideLegend ? null : /* @__PURE__ */ jsx(ChartLegend, { items: series.map(_temp) });
|
|
33
|
+
$[2] = hideLegend;
|
|
34
|
+
$[3] = series;
|
|
35
|
+
$[4] = t8;
|
|
36
|
+
} else t8 = $[4];
|
|
37
|
+
let t9;
|
|
38
|
+
if ($[5] !== ariaLabel || $[6] !== data || $[7] !== formatValue || $[8] !== formatX || $[9] !== series || $[10] !== xKey || $[11] !== xLabel) {
|
|
39
|
+
t9 = /* @__PURE__ */ jsx(ChartDataTable, {
|
|
40
|
+
caption: ariaLabel,
|
|
41
|
+
data,
|
|
42
|
+
xKey,
|
|
43
|
+
xLabel,
|
|
44
|
+
series,
|
|
45
|
+
formatX,
|
|
46
|
+
formatValue
|
|
47
|
+
});
|
|
48
|
+
$[5] = ariaLabel;
|
|
49
|
+
$[6] = data;
|
|
50
|
+
$[7] = formatValue;
|
|
51
|
+
$[8] = formatX;
|
|
52
|
+
$[9] = series;
|
|
53
|
+
$[10] = xKey;
|
|
54
|
+
$[11] = xLabel;
|
|
55
|
+
$[12] = t9;
|
|
56
|
+
} else t9 = $[12];
|
|
57
|
+
const t10 = font.version;
|
|
58
|
+
let t11;
|
|
59
|
+
if ($[13] !== data) {
|
|
60
|
+
t11 = [...data];
|
|
61
|
+
$[13] = data;
|
|
62
|
+
$[14] = t11;
|
|
63
|
+
} else t11 = $[14];
|
|
64
|
+
let t12;
|
|
65
|
+
if ($[15] === Symbol.for("react.memo_cache_sentinel")) {
|
|
66
|
+
t12 = {
|
|
67
|
+
top: 8,
|
|
68
|
+
right: 8,
|
|
69
|
+
bottom: 0,
|
|
70
|
+
left: 0
|
|
71
|
+
};
|
|
72
|
+
$[15] = t12;
|
|
73
|
+
} else t12 = $[15];
|
|
74
|
+
let t13;
|
|
75
|
+
if ($[16] !== hideGrid) {
|
|
76
|
+
t13 = hideGrid ? null : /* @__PURE__ */ jsx(CartesianGrid, {
|
|
77
|
+
vertical: false,
|
|
78
|
+
stroke: GRID_STROKE
|
|
79
|
+
});
|
|
80
|
+
$[16] = hideGrid;
|
|
81
|
+
$[17] = t13;
|
|
82
|
+
} else t13 = $[17];
|
|
83
|
+
let t14;
|
|
84
|
+
if ($[18] !== formatX) {
|
|
85
|
+
t14 = formatX ? { tickFormatter: formatX } : {};
|
|
86
|
+
$[18] = formatX;
|
|
87
|
+
$[19] = t14;
|
|
88
|
+
} else t14 = $[19];
|
|
89
|
+
let t15;
|
|
90
|
+
if ($[20] !== t14 || $[21] !== xKey) {
|
|
91
|
+
t15 = /* @__PURE__ */ jsx(XAxis, {
|
|
92
|
+
dataKey: xKey,
|
|
93
|
+
tickLine: false,
|
|
94
|
+
axisLine: AXIS_LINE,
|
|
95
|
+
tick: AXIS_TICK,
|
|
96
|
+
...t14
|
|
97
|
+
});
|
|
98
|
+
$[20] = t14;
|
|
99
|
+
$[21] = xKey;
|
|
100
|
+
$[22] = t15;
|
|
101
|
+
} else t15 = $[22];
|
|
102
|
+
let t16;
|
|
103
|
+
if ($[23] !== formatValue) {
|
|
104
|
+
t16 = /* @__PURE__ */ jsx(YAxis, {
|
|
105
|
+
width: "auto",
|
|
106
|
+
tickLine: false,
|
|
107
|
+
axisLine: false,
|
|
108
|
+
tick: AXIS_TICK,
|
|
109
|
+
...formatValue ? { tickFormatter: formatValue } : {}
|
|
110
|
+
});
|
|
111
|
+
$[23] = formatValue;
|
|
112
|
+
$[24] = t16;
|
|
113
|
+
} else t16 = $[24];
|
|
114
|
+
let t17;
|
|
115
|
+
if ($[25] !== formatValue || $[26] !== formatX) {
|
|
116
|
+
t17 = /* @__PURE__ */ jsx(Tooltip, {
|
|
117
|
+
cursor: CURSOR_STROKE,
|
|
118
|
+
content: (props) => /* @__PURE__ */ jsx(ChartTooltip, {
|
|
119
|
+
...props,
|
|
120
|
+
formatLabel: formatX,
|
|
121
|
+
formatValue
|
|
122
|
+
})
|
|
123
|
+
});
|
|
124
|
+
$[25] = formatValue;
|
|
125
|
+
$[26] = formatX;
|
|
126
|
+
$[27] = t17;
|
|
127
|
+
} else t17 = $[27];
|
|
128
|
+
let t18;
|
|
129
|
+
if ($[28] !== curve || $[29] !== font.version || $[30] !== reduceMotion || $[31] !== series || $[32] !== showDots) {
|
|
130
|
+
let t19;
|
|
131
|
+
if ($[34] !== curve || $[35] !== font.version || $[36] !== reduceMotion || $[37] !== showDots) {
|
|
132
|
+
t19 = (item_0, index_0) => /* @__PURE__ */ jsx(Line, {
|
|
133
|
+
type: curve,
|
|
134
|
+
dataKey: item_0.key,
|
|
135
|
+
name: item_0.label,
|
|
136
|
+
stroke: seriesColor(index_0, item_0.color),
|
|
137
|
+
strokeWidth: 2,
|
|
138
|
+
...seriesDash(index_0) ? { strokeDasharray: seriesDash(index_0) } : {},
|
|
139
|
+
dot: showDots ? {
|
|
140
|
+
r: 3,
|
|
141
|
+
strokeWidth: 0,
|
|
142
|
+
fill: seriesColor(index_0, item_0.color)
|
|
143
|
+
} : false,
|
|
144
|
+
activeDot: {
|
|
145
|
+
r: 4,
|
|
146
|
+
strokeWidth: 2,
|
|
147
|
+
stroke: "var(--fast-surface)"
|
|
148
|
+
},
|
|
149
|
+
isAnimationActive: !reduceMotion && font.version === 0,
|
|
150
|
+
animationDuration: 400
|
|
151
|
+
}, item_0.key);
|
|
152
|
+
$[34] = curve;
|
|
153
|
+
$[35] = font.version;
|
|
154
|
+
$[36] = reduceMotion;
|
|
155
|
+
$[37] = showDots;
|
|
156
|
+
$[38] = t19;
|
|
157
|
+
} else t19 = $[38];
|
|
158
|
+
t18 = series.map(t19);
|
|
159
|
+
$[28] = curve;
|
|
160
|
+
$[29] = font.version;
|
|
161
|
+
$[30] = reduceMotion;
|
|
162
|
+
$[31] = series;
|
|
163
|
+
$[32] = showDots;
|
|
164
|
+
$[33] = t18;
|
|
165
|
+
} else t18 = $[33];
|
|
166
|
+
let t19;
|
|
167
|
+
if ($[39] !== font.version || $[40] !== t11 || $[41] !== t13 || $[42] !== t15 || $[43] !== t16 || $[44] !== t17 || $[45] !== t18) {
|
|
168
|
+
t19 = /* @__PURE__ */ jsx(ResponsiveContainer, {
|
|
169
|
+
width: "100%",
|
|
170
|
+
height: "100%",
|
|
171
|
+
children: /* @__PURE__ */ jsxs(LineChart$1, {
|
|
172
|
+
data: t11,
|
|
173
|
+
margin: t12,
|
|
174
|
+
accessibilityLayer: false,
|
|
175
|
+
children: [
|
|
176
|
+
t13,
|
|
177
|
+
t15,
|
|
178
|
+
t16,
|
|
179
|
+
t17,
|
|
180
|
+
t18
|
|
181
|
+
]
|
|
182
|
+
}, t10)
|
|
183
|
+
});
|
|
184
|
+
$[39] = font.version;
|
|
185
|
+
$[40] = t11;
|
|
186
|
+
$[41] = t13;
|
|
187
|
+
$[42] = t15;
|
|
188
|
+
$[43] = t16;
|
|
189
|
+
$[44] = t17;
|
|
190
|
+
$[45] = t18;
|
|
191
|
+
$[46] = t19;
|
|
192
|
+
} else t19 = $[46];
|
|
193
|
+
let t20;
|
|
194
|
+
if ($[47] !== ariaLabel || $[48] !== font.probe || $[49] !== height || $[50] !== t19 || $[51] !== t7 || $[52] !== t8 || $[53] !== t9) {
|
|
195
|
+
t20 = /* @__PURE__ */ jsx(ChartFrame, {
|
|
196
|
+
"aria-label": ariaLabel,
|
|
197
|
+
height,
|
|
198
|
+
fontProbe: t6,
|
|
199
|
+
...t7,
|
|
200
|
+
legend: t8,
|
|
201
|
+
table: t9,
|
|
202
|
+
children: t19
|
|
203
|
+
});
|
|
204
|
+
$[47] = ariaLabel;
|
|
205
|
+
$[48] = font.probe;
|
|
206
|
+
$[49] = height;
|
|
207
|
+
$[50] = t19;
|
|
208
|
+
$[51] = t7;
|
|
209
|
+
$[52] = t8;
|
|
210
|
+
$[53] = t9;
|
|
211
|
+
$[54] = t20;
|
|
212
|
+
} else t20 = $[54];
|
|
213
|
+
return t20;
|
|
214
|
+
};
|
|
215
|
+
function _temp(item, index) {
|
|
216
|
+
return {
|
|
217
|
+
label: item.label,
|
|
218
|
+
color: seriesColor(index, item.color),
|
|
219
|
+
line: { dash: seriesDash(index) }
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
export { LineChart };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export interface SparklineProps {
|
|
2
|
+
/** The numbers, in order, oldest first. Two or more draw a line; the line is scaled to fit the box. */
|
|
3
|
+
values: readonly number[];
|
|
4
|
+
/**
|
|
5
|
+
* What it says, in words, since the line itself has no numbers: "Sales, last 7 days: rising, 12 percent". A
|
|
6
|
+
* screen reader reads this as the sparkline's name.
|
|
7
|
+
*/
|
|
8
|
+
"aria-label": string;
|
|
9
|
+
/** A CSS colour or variable. The first chart token if omitted. */
|
|
10
|
+
color?: string | undefined;
|
|
11
|
+
/** A line (default), or a line with the area under it filled. */
|
|
12
|
+
variant?: "line" | "area" | undefined;
|
|
13
|
+
/** Width in pixels. Default 96. */
|
|
14
|
+
width?: number | undefined;
|
|
15
|
+
/** Height in pixels. Default 32. */
|
|
16
|
+
height?: number | undefined;
|
|
17
|
+
className?: string | undefined;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* A tiny line chart with no axes or labels, to sit in a stat card or a table row and show a trend at a glance.
|
|
21
|
+
* It is a plain SVG, not Recharts, so it costs next to nothing to put in every row. It is an image to a screen
|
|
22
|
+
* reader, named by `aria-label`.
|
|
23
|
+
*/
|
|
24
|
+
export declare const Sparkline: ({ values, "aria-label": ariaLabel, color, variant, width, height, className }: SparklineProps) => import("react").JSX.Element;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { c } from "react/compiler-runtime";
|
|
3
|
+
import { cn } from "../../utils/cn.js";
|
|
4
|
+
import { sparklineAreaPath, sparklinePath } from "./sparkline-path.js";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
// src/patterns/Charts/Sparkline.tsx
|
|
7
|
+
/**
|
|
8
|
+
* A tiny line chart with no axes or labels, to sit in a stat card or a table row and show a trend at a glance.
|
|
9
|
+
* It is a plain SVG, not Recharts, so it costs next to nothing to put in every row. It is an image to a screen
|
|
10
|
+
* reader, named by `aria-label`.
|
|
11
|
+
*/
|
|
12
|
+
var Sparkline = (t0) => {
|
|
13
|
+
const $ = c(18);
|
|
14
|
+
const { values, "aria-label": ariaLabel, color, variant: t1, width: t2, height: t3, className } = t0;
|
|
15
|
+
const variant = t1 === void 0 ? "line" : t1;
|
|
16
|
+
const width = t2 === void 0 ? 96 : t2;
|
|
17
|
+
const height = t3 === void 0 ? 32 : t3;
|
|
18
|
+
const stroke = color ?? "var(--fast-chart-1)";
|
|
19
|
+
let t4;
|
|
20
|
+
if ($[0] !== className) {
|
|
21
|
+
t4 = cn("inline-block shrink-0 overflow-visible", className);
|
|
22
|
+
$[0] = className;
|
|
23
|
+
$[1] = t4;
|
|
24
|
+
} else t4 = $[1];
|
|
25
|
+
let t5;
|
|
26
|
+
if ($[2] !== stroke || $[3] !== values || $[4] !== variant) {
|
|
27
|
+
t5 = variant === "area" ? /* @__PURE__ */ jsx("path", {
|
|
28
|
+
d: sparklineAreaPath(values),
|
|
29
|
+
fill: stroke,
|
|
30
|
+
fillOpacity: .18,
|
|
31
|
+
stroke: "none"
|
|
32
|
+
}) : null;
|
|
33
|
+
$[2] = stroke;
|
|
34
|
+
$[3] = values;
|
|
35
|
+
$[4] = variant;
|
|
36
|
+
$[5] = t5;
|
|
37
|
+
} else t5 = $[5];
|
|
38
|
+
let t6;
|
|
39
|
+
if ($[6] !== values) {
|
|
40
|
+
t6 = sparklinePath(values);
|
|
41
|
+
$[6] = values;
|
|
42
|
+
$[7] = t6;
|
|
43
|
+
} else t6 = $[7];
|
|
44
|
+
let t7;
|
|
45
|
+
if ($[8] !== stroke || $[9] !== t6) {
|
|
46
|
+
t7 = /* @__PURE__ */ jsx("path", {
|
|
47
|
+
d: t6,
|
|
48
|
+
fill: "none",
|
|
49
|
+
stroke,
|
|
50
|
+
strokeWidth: 2,
|
|
51
|
+
strokeLinejoin: "round",
|
|
52
|
+
strokeLinecap: "round",
|
|
53
|
+
vectorEffect: "non-scaling-stroke"
|
|
54
|
+
});
|
|
55
|
+
$[8] = stroke;
|
|
56
|
+
$[9] = t6;
|
|
57
|
+
$[10] = t7;
|
|
58
|
+
} else t7 = $[10];
|
|
59
|
+
let t8;
|
|
60
|
+
if ($[11] !== ariaLabel || $[12] !== height || $[13] !== t4 || $[14] !== t5 || $[15] !== t7 || $[16] !== width) {
|
|
61
|
+
t8 = /* @__PURE__ */ jsxs("svg", {
|
|
62
|
+
role: "img",
|
|
63
|
+
"aria-label": ariaLabel,
|
|
64
|
+
width,
|
|
65
|
+
height,
|
|
66
|
+
viewBox: "0 0 100 100",
|
|
67
|
+
preserveAspectRatio: "none",
|
|
68
|
+
className: t4,
|
|
69
|
+
children: [t5, t7]
|
|
70
|
+
});
|
|
71
|
+
$[11] = ariaLabel;
|
|
72
|
+
$[12] = height;
|
|
73
|
+
$[13] = t4;
|
|
74
|
+
$[14] = t5;
|
|
75
|
+
$[15] = t7;
|
|
76
|
+
$[16] = width;
|
|
77
|
+
$[17] = t8;
|
|
78
|
+
} else t8 = $[17];
|
|
79
|
+
return t8;
|
|
80
|
+
};
|
|
81
|
+
export { Sparkline };
|