@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,152 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { c } from "react/compiler-runtime";
|
|
3
|
+
import { cva } from "class-variance-authority";
|
|
4
|
+
import { cn } from "../../utils/cn.js";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
// src/components/Skeleton/Skeleton.tsx
|
|
7
|
+
/** Figma's loading bars are `h-3` pills in the border grey, pulsing. */
|
|
8
|
+
var skeletonItemVariants = cva("block animate-pulse rounded-pill bg-line", {
|
|
9
|
+
variants: { size: {
|
|
10
|
+
12: "h-3",
|
|
11
|
+
16: "h-4"
|
|
12
|
+
} },
|
|
13
|
+
defaultVariants: { size: 12 }
|
|
14
|
+
});
|
|
15
|
+
/** One placeholder bar. Decorative: the region around it carries the label. */
|
|
16
|
+
var SkeletonItem = (t0) => {
|
|
17
|
+
const $ = c(8);
|
|
18
|
+
const { size: t1, width, className } = t0;
|
|
19
|
+
const size = t1 === void 0 ? 12 : t1;
|
|
20
|
+
let t2;
|
|
21
|
+
if ($[0] !== className || $[1] !== size) {
|
|
22
|
+
t2 = cn(skeletonItemVariants({ size }), className);
|
|
23
|
+
$[0] = className;
|
|
24
|
+
$[1] = size;
|
|
25
|
+
$[2] = t2;
|
|
26
|
+
} else t2 = $[2];
|
|
27
|
+
let t3;
|
|
28
|
+
if ($[3] !== width) {
|
|
29
|
+
t3 = width ? { width } : void 0;
|
|
30
|
+
$[3] = width;
|
|
31
|
+
$[4] = t3;
|
|
32
|
+
} else t3 = $[4];
|
|
33
|
+
let t4;
|
|
34
|
+
if ($[5] !== t2 || $[6] !== t3) {
|
|
35
|
+
t4 = /* @__PURE__ */ jsx("span", {
|
|
36
|
+
"aria-hidden": "true",
|
|
37
|
+
className: t2,
|
|
38
|
+
style: t3
|
|
39
|
+
});
|
|
40
|
+
$[5] = t2;
|
|
41
|
+
$[6] = t3;
|
|
42
|
+
$[7] = t4;
|
|
43
|
+
} else t4 = $[7];
|
|
44
|
+
return t4;
|
|
45
|
+
};
|
|
46
|
+
/** Placeholder lines for text that has not arrived. */
|
|
47
|
+
var SkeletonText = (t0) => {
|
|
48
|
+
const $ = c(5);
|
|
49
|
+
const { label, lines: t1 } = t0;
|
|
50
|
+
const lines = t1 === void 0 ? 3 : t1;
|
|
51
|
+
let t2;
|
|
52
|
+
if ($[0] !== lines) {
|
|
53
|
+
t2 = Array.from({ length: lines }, (_, index) => /* @__PURE__ */ jsx(SkeletonItem, { width: index === lines - 1 && lines > 1 ? "60%" : "100%" }, index));
|
|
54
|
+
$[0] = lines;
|
|
55
|
+
$[1] = t2;
|
|
56
|
+
} else t2 = $[1];
|
|
57
|
+
let t3;
|
|
58
|
+
if ($[2] !== label || $[3] !== t2) {
|
|
59
|
+
t3 = /* @__PURE__ */ jsx("div", {
|
|
60
|
+
role: "progressbar",
|
|
61
|
+
"aria-busy": "true",
|
|
62
|
+
"aria-label": label,
|
|
63
|
+
className: "flex flex-col gap-2",
|
|
64
|
+
children: t2
|
|
65
|
+
});
|
|
66
|
+
$[2] = label;
|
|
67
|
+
$[3] = t2;
|
|
68
|
+
$[4] = t3;
|
|
69
|
+
} else t3 = $[4];
|
|
70
|
+
return t3;
|
|
71
|
+
};
|
|
72
|
+
/** Placeholder for a card: a heading line and two lines of text. */
|
|
73
|
+
var SkeletonCard = (t0) => {
|
|
74
|
+
const $ = c(5);
|
|
75
|
+
const { label } = t0;
|
|
76
|
+
let t1;
|
|
77
|
+
let t2;
|
|
78
|
+
let t3;
|
|
79
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
80
|
+
t1 = /* @__PURE__ */ jsx(SkeletonItem, {
|
|
81
|
+
size: 16,
|
|
82
|
+
width: "50%"
|
|
83
|
+
});
|
|
84
|
+
t2 = /* @__PURE__ */ jsx(SkeletonItem, { width: "100%" });
|
|
85
|
+
t3 = /* @__PURE__ */ jsx(SkeletonItem, { width: "70%" });
|
|
86
|
+
$[0] = t1;
|
|
87
|
+
$[1] = t2;
|
|
88
|
+
$[2] = t3;
|
|
89
|
+
} else {
|
|
90
|
+
t1 = $[0];
|
|
91
|
+
t2 = $[1];
|
|
92
|
+
t3 = $[2];
|
|
93
|
+
}
|
|
94
|
+
let t4;
|
|
95
|
+
if ($[3] !== label) {
|
|
96
|
+
t4 = /* @__PURE__ */ jsxs("div", {
|
|
97
|
+
role: "progressbar",
|
|
98
|
+
"aria-busy": "true",
|
|
99
|
+
"aria-label": label,
|
|
100
|
+
className: "flex flex-col gap-3 rounded-lg border border-line bg-surface p-4",
|
|
101
|
+
children: [
|
|
102
|
+
t1,
|
|
103
|
+
t2,
|
|
104
|
+
t3
|
|
105
|
+
]
|
|
106
|
+
});
|
|
107
|
+
$[3] = label;
|
|
108
|
+
$[4] = t4;
|
|
109
|
+
} else t4 = $[4];
|
|
110
|
+
return t4;
|
|
111
|
+
};
|
|
112
|
+
/** Placeholder rows for a table that is loading. */
|
|
113
|
+
var SkeletonTable = (t0) => {
|
|
114
|
+
const $ = c(8);
|
|
115
|
+
const { label, rows: t1, columns: t2 } = t0;
|
|
116
|
+
const rows = t1 === void 0 ? 5 : t1;
|
|
117
|
+
const columns = t2 === void 0 ? 4 : t2;
|
|
118
|
+
let t3;
|
|
119
|
+
if ($[0] !== columns || $[1] !== rows) {
|
|
120
|
+
let t4;
|
|
121
|
+
if ($[3] !== columns) {
|
|
122
|
+
t4 = (_, row) => /* @__PURE__ */ jsx("div", {
|
|
123
|
+
className: "flex gap-3",
|
|
124
|
+
children: Array.from({ length: columns }, _temp)
|
|
125
|
+
}, row);
|
|
126
|
+
$[3] = columns;
|
|
127
|
+
$[4] = t4;
|
|
128
|
+
} else t4 = $[4];
|
|
129
|
+
t3 = Array.from({ length: rows }, t4);
|
|
130
|
+
$[0] = columns;
|
|
131
|
+
$[1] = rows;
|
|
132
|
+
$[2] = t3;
|
|
133
|
+
} else t3 = $[2];
|
|
134
|
+
let t4;
|
|
135
|
+
if ($[5] !== label || $[6] !== t3) {
|
|
136
|
+
t4 = /* @__PURE__ */ jsx("div", {
|
|
137
|
+
role: "progressbar",
|
|
138
|
+
"aria-busy": "true",
|
|
139
|
+
"aria-label": label,
|
|
140
|
+
className: "flex flex-col gap-3 p-4",
|
|
141
|
+
children: t3
|
|
142
|
+
});
|
|
143
|
+
$[5] = label;
|
|
144
|
+
$[6] = t3;
|
|
145
|
+
$[7] = t4;
|
|
146
|
+
} else t4 = $[7];
|
|
147
|
+
return t4;
|
|
148
|
+
};
|
|
149
|
+
function _temp(__0, column) {
|
|
150
|
+
return /* @__PURE__ */ jsx(SkeletonItem, { className: "flex-1" }, column);
|
|
151
|
+
}
|
|
152
|
+
export { SkeletonCard, SkeletonItem, SkeletonTable, SkeletonText };
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/** The thumb: a white disc with a teal ring, which grows a focus ring from the keyboard. Also the colour picker's. */
|
|
2
|
+
export declare const SLIDER_THUMB: string;
|
|
3
|
+
/** A slider's value: one number, or the numbers of a range (a thumb each). */
|
|
4
|
+
type SliderValue = number | readonly number[];
|
|
5
|
+
export interface SliderProps<TValue extends SliderValue = number> {
|
|
6
|
+
/** One number for one thumb, an array for a range (a thumb for each number, kept in order). */
|
|
7
|
+
value: TValue;
|
|
8
|
+
/** Called while the thumb moves, with a number (one thumb) or an array (a range). */
|
|
9
|
+
onValueChange: (value: TValue extends number ? number : number[]) => void;
|
|
10
|
+
/** Called once a drag or key press ends: the moment to save, where `onValueChange` would be too often. */
|
|
11
|
+
onValueCommitted?: ((value: TValue extends number ? number : number[]) => void) | undefined;
|
|
12
|
+
/** The least value, at the start of the track (Home goes there). Default 0. */
|
|
13
|
+
min?: number | undefined;
|
|
14
|
+
/** The greatest value, at the end of the track (End goes there). Default 100. */
|
|
15
|
+
max?: number | undefined;
|
|
16
|
+
/** What one arrow key press changes. Default 1. */
|
|
17
|
+
step?: number | undefined;
|
|
18
|
+
/** What Page Up and Page Down (or Shift and an arrow) change. Default 10. */
|
|
19
|
+
largeStep?: number | undefined;
|
|
20
|
+
/** The least distance between two thumbs of a range, in steps. */
|
|
21
|
+
minStepsBetweenValues?: number | undefined;
|
|
22
|
+
/** Greys the slider out; its thumbs cannot be moved or focused. */
|
|
23
|
+
disabled?: boolean | undefined;
|
|
24
|
+
/** Marks each thumb's range input invalid (`aria-invalid`) for assistive technology. */
|
|
25
|
+
invalid?: boolean | undefined;
|
|
26
|
+
/** Writes a value as text for a screen reader, e.g. `(text) => `${text} km``. The number as formatted if omitted. */
|
|
27
|
+
getValueText?: ((formattedValue: string, value: number, index: number) => string) | undefined;
|
|
28
|
+
/** The thumb's name, for one thumb with no label element of its own. A range names each thumb with `thumbLabels`. */
|
|
29
|
+
"aria-label"?: string | undefined;
|
|
30
|
+
/** The id of the element that names the slider, such as a field's label. */
|
|
31
|
+
"aria-labelledby"?: string | undefined;
|
|
32
|
+
/** The ids of the field's message and hint, read after the name. Given to each thumb's range input. */
|
|
33
|
+
"aria-describedby"?: string | undefined;
|
|
34
|
+
/** Names the thumbs of a range in order, e.g. ["Minimum price", "Maximum price"]. */
|
|
35
|
+
thumbLabels?: readonly string[] | undefined;
|
|
36
|
+
/** The field's name in a submitted form. */
|
|
37
|
+
name?: string | undefined;
|
|
38
|
+
/** The slider was left. */
|
|
39
|
+
onBlur?: (() => void) | undefined;
|
|
40
|
+
/**
|
|
41
|
+
* The id of the first thumb's element: the `<div>` drawn on the track, not the range input inside it, whose id
|
|
42
|
+
* Base UI sets. So a `<label htmlFor>` cannot name the slider; name it with `aria-labelledby` or `aria-label`.
|
|
43
|
+
*/
|
|
44
|
+
id?: string | undefined;
|
|
45
|
+
/** Classes for the slider's outer element (the full-width group around the track), merged last. */
|
|
46
|
+
className?: string | undefined;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* A slider for a number between `min` and `max`, or for a range of two. The arrow keys move a thumb by `step`,
|
|
50
|
+
* Page Up and Page Down by `largeStep`, Home and End to the ends; dragging the track moves the nearest thumb.
|
|
51
|
+
* It follows the page's direction: in right to left the minimum is at the right.
|
|
52
|
+
*/
|
|
53
|
+
export declare const Slider: <TValue extends SliderValue = number>({ value, onValueChange, onValueCommitted, min, max, step, largeStep, minStepsBetweenValues, disabled, invalid, getValueText, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, thumbLabels, name, onBlur, id, className, }: SliderProps<TValue>) => import("react").JSX.Element;
|
|
54
|
+
export {};
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { c } from "react/compiler-runtime";
|
|
3
|
+
import { useLayoutEffect, useRef } from "react";
|
|
4
|
+
import { Slider as Slider$1 } from "@base-ui/react/slider";
|
|
5
|
+
import { cn } from "../../utils/cn.js";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
// src/components/Slider/Slider.tsx
|
|
8
|
+
/** The thumb: a white disc with a teal ring, which grows a focus ring from the keyboard. Also the colour picker's. */
|
|
9
|
+
var SLIDER_THUMB = [
|
|
10
|
+
"box-border block size-4.5 rounded-full border-2 border-primary bg-surface shadow-sm outline-none",
|
|
11
|
+
"transition-[box-shadow,scale] duration-150 ease-standard",
|
|
12
|
+
"has-focus-visible:ring-3 has-focus-visible:ring-primary/30 data-dragging:scale-110",
|
|
13
|
+
"data-disabled:border-fg-disabled data-disabled:bg-subtle"
|
|
14
|
+
].join(" ");
|
|
15
|
+
/**
|
|
16
|
+
* A slider for a number between `min` and `max`, or for a range of two. The arrow keys move a thumb by `step`,
|
|
17
|
+
* Page Up and Page Down by `largeStep`, Home and End to the ends; dragging the track moves the nearest thumb.
|
|
18
|
+
* It follows the page's direction: in right to left the minimum is at the right.
|
|
19
|
+
*/
|
|
20
|
+
var Slider = (t0) => {
|
|
21
|
+
const $ = c(42);
|
|
22
|
+
const { value, onValueChange, onValueCommitted, min: t1, max: t2, step: t3, largeStep, minStepsBetweenValues, disabled: t4, invalid: t5, getValueText, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, thumbLabels, name, onBlur, id, className } = t0;
|
|
23
|
+
const min = t1 === void 0 ? 0 : t1;
|
|
24
|
+
const max = t2 === void 0 ? 100 : t2;
|
|
25
|
+
const step = t3 === void 0 ? 1 : t3;
|
|
26
|
+
const disabled = t4 === void 0 ? false : t4;
|
|
27
|
+
const invalid = t5 === void 0 ? false : t5;
|
|
28
|
+
const thumbs = typeof value === "number" ? 1 : value.length;
|
|
29
|
+
let t6;
|
|
30
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
31
|
+
t6 = [];
|
|
32
|
+
$[0] = t6;
|
|
33
|
+
} else t6 = $[0];
|
|
34
|
+
const inputs = useRef(t6);
|
|
35
|
+
let t7;
|
|
36
|
+
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
|
|
37
|
+
t7 = /* @__PURE__ */ new WeakSet();
|
|
38
|
+
$[1] = t7;
|
|
39
|
+
} else t7 = $[1];
|
|
40
|
+
const markedInvalid = useRef(t7);
|
|
41
|
+
let t8;
|
|
42
|
+
if ($[2] !== invalid || $[3] !== thumbs) {
|
|
43
|
+
t8 = () => {
|
|
44
|
+
for (const input of inputs.current.slice(0, thumbs)) {
|
|
45
|
+
if (!input) continue;
|
|
46
|
+
if (invalid && !input.hasAttribute("aria-invalid")) {
|
|
47
|
+
input.setAttribute("aria-invalid", "true");
|
|
48
|
+
markedInvalid.current.add(input);
|
|
49
|
+
} else if (!invalid && markedInvalid.current.has(input)) {
|
|
50
|
+
input.removeAttribute("aria-invalid");
|
|
51
|
+
markedInvalid.current.delete(input);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
$[2] = invalid;
|
|
56
|
+
$[3] = thumbs;
|
|
57
|
+
$[4] = t8;
|
|
58
|
+
} else t8 = $[4];
|
|
59
|
+
useLayoutEffect(t8);
|
|
60
|
+
const t9 = value;
|
|
61
|
+
let t10;
|
|
62
|
+
if ($[5] !== onValueChange) {
|
|
63
|
+
t10 = (next) => {
|
|
64
|
+
onValueChange(next);
|
|
65
|
+
};
|
|
66
|
+
$[5] = onValueChange;
|
|
67
|
+
$[6] = t10;
|
|
68
|
+
} else t10 = $[6];
|
|
69
|
+
let t11;
|
|
70
|
+
if ($[7] !== onValueCommitted) {
|
|
71
|
+
t11 = onValueCommitted ? { onValueCommitted: (next_0) => {
|
|
72
|
+
onValueCommitted(next_0);
|
|
73
|
+
} } : {};
|
|
74
|
+
$[7] = onValueCommitted;
|
|
75
|
+
$[8] = t11;
|
|
76
|
+
} else t11 = $[8];
|
|
77
|
+
let t12;
|
|
78
|
+
if ($[9] !== largeStep) {
|
|
79
|
+
t12 = largeStep === void 0 ? {} : { largeStep };
|
|
80
|
+
$[9] = largeStep;
|
|
81
|
+
$[10] = t12;
|
|
82
|
+
} else t12 = $[10];
|
|
83
|
+
let t13;
|
|
84
|
+
if ($[11] !== minStepsBetweenValues) {
|
|
85
|
+
t13 = minStepsBetweenValues === void 0 ? {} : { minStepsBetweenValues };
|
|
86
|
+
$[11] = minStepsBetweenValues;
|
|
87
|
+
$[12] = t13;
|
|
88
|
+
} else t13 = $[12];
|
|
89
|
+
let t14;
|
|
90
|
+
if ($[13] !== name) {
|
|
91
|
+
t14 = name ? { name } : {};
|
|
92
|
+
$[13] = name;
|
|
93
|
+
$[14] = t14;
|
|
94
|
+
} else t14 = $[14];
|
|
95
|
+
let t15;
|
|
96
|
+
if ($[15] !== ariaLabelledBy) {
|
|
97
|
+
t15 = ariaLabelledBy ? { "aria-labelledby": ariaLabelledBy } : {};
|
|
98
|
+
$[15] = ariaLabelledBy;
|
|
99
|
+
$[16] = t15;
|
|
100
|
+
} else t15 = $[16];
|
|
101
|
+
let t16;
|
|
102
|
+
if ($[17] !== className) {
|
|
103
|
+
t16 = cn("w-full", className);
|
|
104
|
+
$[17] = className;
|
|
105
|
+
$[18] = t16;
|
|
106
|
+
} else t16 = $[18];
|
|
107
|
+
let t17;
|
|
108
|
+
if ($[19] === Symbol.for("react.memo_cache_sentinel")) {
|
|
109
|
+
t17 = /* @__PURE__ */ jsx(Slider$1.Indicator, { className: "rounded-pill bg-primary data-disabled:bg-fg-disabled" });
|
|
110
|
+
$[19] = t17;
|
|
111
|
+
} else t17 = $[19];
|
|
112
|
+
let t18;
|
|
113
|
+
if ($[20] !== ariaDescribedBy || $[21] !== ariaLabel || $[22] !== getValueText || $[23] !== id || $[24] !== onBlur || $[25] !== thumbLabels || $[26] !== thumbs) {
|
|
114
|
+
t18 = /* @__PURE__ */ jsx(Slider$1.Control, {
|
|
115
|
+
className: "flex w-full touch-none items-center py-2 select-none data-disabled:cursor-not-allowed",
|
|
116
|
+
children: /* @__PURE__ */ jsxs(Slider$1.Track, {
|
|
117
|
+
className: "relative h-1.5 w-full rounded-pill bg-line data-disabled:bg-subtle",
|
|
118
|
+
children: [t17, Array.from({ length: thumbs }, (_, index) => /* @__PURE__ */ jsx(Slider$1.Thumb, {
|
|
119
|
+
index,
|
|
120
|
+
inputRef: (input_0) => {
|
|
121
|
+
inputs.current[index] = input_0;
|
|
122
|
+
},
|
|
123
|
+
...index === 0 && id ? { id } : {},
|
|
124
|
+
...ariaDescribedBy ? { "aria-describedby": ariaDescribedBy } : {},
|
|
125
|
+
...thumbLabels?.[index] ? { "aria-label": thumbLabels[index] } : {},
|
|
126
|
+
...thumbs === 1 && ariaLabel && !thumbLabels?.[0] ? { "aria-label": ariaLabel } : {},
|
|
127
|
+
...getValueText ? { getAriaValueText: getValueText } : {},
|
|
128
|
+
...onBlur ? { onBlur: () => {
|
|
129
|
+
onBlur();
|
|
130
|
+
} } : {},
|
|
131
|
+
className: cn(SLIDER_THUMB, "cursor-grab data-dragging:cursor-grabbing data-disabled:cursor-not-allowed")
|
|
132
|
+
}, index))]
|
|
133
|
+
})
|
|
134
|
+
});
|
|
135
|
+
$[20] = ariaDescribedBy;
|
|
136
|
+
$[21] = ariaLabel;
|
|
137
|
+
$[22] = getValueText;
|
|
138
|
+
$[23] = id;
|
|
139
|
+
$[24] = onBlur;
|
|
140
|
+
$[25] = thumbLabels;
|
|
141
|
+
$[26] = thumbs;
|
|
142
|
+
$[27] = t18;
|
|
143
|
+
} else t18 = $[27];
|
|
144
|
+
let t19;
|
|
145
|
+
if ($[28] !== disabled || $[29] !== max || $[30] !== min || $[31] !== step || $[32] !== t10 || $[33] !== t11 || $[34] !== t12 || $[35] !== t13 || $[36] !== t14 || $[37] !== t15 || $[38] !== t16 || $[39] !== t18 || $[40] !== t9) {
|
|
146
|
+
t19 = /* @__PURE__ */ jsx(Slider$1.Root, {
|
|
147
|
+
value: t9,
|
|
148
|
+
onValueChange: t10,
|
|
149
|
+
...t11,
|
|
150
|
+
min,
|
|
151
|
+
max,
|
|
152
|
+
step,
|
|
153
|
+
...t12,
|
|
154
|
+
...t13,
|
|
155
|
+
disabled,
|
|
156
|
+
...t14,
|
|
157
|
+
...t15,
|
|
158
|
+
className: t16,
|
|
159
|
+
children: t18
|
|
160
|
+
});
|
|
161
|
+
$[28] = disabled;
|
|
162
|
+
$[29] = max;
|
|
163
|
+
$[30] = min;
|
|
164
|
+
$[31] = step;
|
|
165
|
+
$[32] = t10;
|
|
166
|
+
$[33] = t11;
|
|
167
|
+
$[34] = t12;
|
|
168
|
+
$[35] = t13;
|
|
169
|
+
$[36] = t14;
|
|
170
|
+
$[37] = t15;
|
|
171
|
+
$[38] = t16;
|
|
172
|
+
$[39] = t18;
|
|
173
|
+
$[40] = t9;
|
|
174
|
+
$[41] = t19;
|
|
175
|
+
} else t19 = $[41];
|
|
176
|
+
return t19;
|
|
177
|
+
};
|
|
178
|
+
export { SLIDER_THUMB, Slider };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface SpinnerProps {
|
|
2
|
+
/** "tiny" (14px) inside a button, "medium" (20px, the default) on its own, "large" (32px) in an empty area. */
|
|
3
|
+
size?: "tiny" | "medium" | "large" | undefined;
|
|
4
|
+
/**
|
|
5
|
+
* What is loading, e.g. "Loading results". With a label the spinner is a status region (`role="status"`): it
|
|
6
|
+
* goes on the page empty and the label goes into it a moment later, as visually hidden text, so that it is a
|
|
7
|
+
* change screen readers report rather than a region that arrives with its text, which they often miss. Without a
|
|
8
|
+
* label it is decorative (inside a busy button, say).
|
|
9
|
+
*/
|
|
10
|
+
label?: string | undefined;
|
|
11
|
+
/** Draw in the colour of the surrounding text instead of the teal on a grey ring. */
|
|
12
|
+
inherit?: boolean | undefined;
|
|
13
|
+
/** Classes for the ring itself, e.g. a margin. */
|
|
14
|
+
className?: string | undefined;
|
|
15
|
+
}
|
|
16
|
+
/** A spinning arc on a faint ring. */
|
|
17
|
+
export declare const Spinner: ({ size, label, inherit, className }: SpinnerProps) => import("react").JSX.Element;
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { c } from "react/compiler-runtime";
|
|
3
|
+
import { useEffect, useState } from "react";
|
|
4
|
+
import { cva } from "class-variance-authority";
|
|
5
|
+
import { cn } from "../../utils/cn.js";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
// src/components/Spinner/Spinner.tsx
|
|
8
|
+
/** Figma: a 2px ring with a rounded arc, 14px inside a button and 20px on its own. */
|
|
9
|
+
var spinnerVariants = cva("shrink-0 animate-spin", {
|
|
10
|
+
variants: { size: {
|
|
11
|
+
tiny: "size-3.5",
|
|
12
|
+
medium: "size-5",
|
|
13
|
+
large: "size-8"
|
|
14
|
+
} },
|
|
15
|
+
defaultVariants: { size: "medium" }
|
|
16
|
+
});
|
|
17
|
+
/**
|
|
18
|
+
* How long the status region is on the page, empty, before the label goes into it. Screen readers report a
|
|
19
|
+
* change to a live region they already know; a region that arrives with its text is often not announced, and
|
|
20
|
+
* one filled in the same moment it arrives fares no better.
|
|
21
|
+
*/
|
|
22
|
+
var LABEL_DELAY_MS = 100;
|
|
23
|
+
/** A spinning arc on a faint ring. */
|
|
24
|
+
var Spinner = (t0) => {
|
|
25
|
+
const $ = c(18);
|
|
26
|
+
const { size, label, inherit: t1, className } = t0;
|
|
27
|
+
const inherit = t1 === void 0 ? false : t1;
|
|
28
|
+
const hasLabel = Boolean(label);
|
|
29
|
+
const [isReady, setIsReady] = useState(false);
|
|
30
|
+
let t2;
|
|
31
|
+
let t3;
|
|
32
|
+
if ($[0] !== hasLabel) {
|
|
33
|
+
t2 = () => {
|
|
34
|
+
if (!hasLabel) {
|
|
35
|
+
setIsReady(false);
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
const timer = setTimeout(() => {
|
|
39
|
+
setIsReady(true);
|
|
40
|
+
}, LABEL_DELAY_MS);
|
|
41
|
+
return () => {
|
|
42
|
+
clearTimeout(timer);
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
t3 = [hasLabel];
|
|
46
|
+
$[0] = hasLabel;
|
|
47
|
+
$[1] = t2;
|
|
48
|
+
$[2] = t3;
|
|
49
|
+
} else {
|
|
50
|
+
t2 = $[1];
|
|
51
|
+
t3 = $[2];
|
|
52
|
+
}
|
|
53
|
+
useEffect(t2, t3);
|
|
54
|
+
let t4;
|
|
55
|
+
if ($[3] !== className || $[4] !== size) {
|
|
56
|
+
t4 = cn(spinnerVariants({ size }), className);
|
|
57
|
+
$[3] = className;
|
|
58
|
+
$[4] = size;
|
|
59
|
+
$[5] = t4;
|
|
60
|
+
} else t4 = $[5];
|
|
61
|
+
const t5 = inherit ? "stroke-current opacity-30" : "stroke-line";
|
|
62
|
+
let t6;
|
|
63
|
+
if ($[6] !== t5) {
|
|
64
|
+
t6 = /* @__PURE__ */ jsx("circle", {
|
|
65
|
+
cx: "10",
|
|
66
|
+
cy: "10",
|
|
67
|
+
r: "8",
|
|
68
|
+
strokeWidth: "2.5",
|
|
69
|
+
className: t5
|
|
70
|
+
});
|
|
71
|
+
$[6] = t5;
|
|
72
|
+
$[7] = t6;
|
|
73
|
+
} else t6 = $[7];
|
|
74
|
+
const t7 = inherit ? "stroke-current" : "stroke-primary";
|
|
75
|
+
let t8;
|
|
76
|
+
if ($[8] !== t7) {
|
|
77
|
+
t8 = /* @__PURE__ */ jsx("path", {
|
|
78
|
+
d: "M18 10a8 8 0 01-8 8",
|
|
79
|
+
strokeWidth: "2.5",
|
|
80
|
+
strokeLinecap: "round",
|
|
81
|
+
className: t7
|
|
82
|
+
});
|
|
83
|
+
$[8] = t7;
|
|
84
|
+
$[9] = t8;
|
|
85
|
+
} else t8 = $[9];
|
|
86
|
+
let t9;
|
|
87
|
+
if ($[10] !== t4 || $[11] !== t6 || $[12] !== t8) {
|
|
88
|
+
t9 = /* @__PURE__ */ jsxs("svg", {
|
|
89
|
+
viewBox: "0 0 20 20",
|
|
90
|
+
fill: "none",
|
|
91
|
+
"aria-hidden": "true",
|
|
92
|
+
className: t4,
|
|
93
|
+
children: [t6, t8]
|
|
94
|
+
});
|
|
95
|
+
$[10] = t4;
|
|
96
|
+
$[11] = t6;
|
|
97
|
+
$[12] = t8;
|
|
98
|
+
$[13] = t9;
|
|
99
|
+
} else t9 = $[13];
|
|
100
|
+
const ring = t9;
|
|
101
|
+
let t10;
|
|
102
|
+
if ($[14] !== isReady || $[15] !== label || $[16] !== ring) {
|
|
103
|
+
t10 = label ? /* @__PURE__ */ jsxs("span", {
|
|
104
|
+
role: "status",
|
|
105
|
+
className: "inline-flex shrink-0",
|
|
106
|
+
children: [ring, /* @__PURE__ */ jsx("span", {
|
|
107
|
+
className: "sr-only",
|
|
108
|
+
children: isReady ? label : ""
|
|
109
|
+
})]
|
|
110
|
+
}) : ring;
|
|
111
|
+
$[14] = isReady;
|
|
112
|
+
$[15] = label;
|
|
113
|
+
$[16] = ring;
|
|
114
|
+
$[17] = t10;
|
|
115
|
+
} else t10 = $[17];
|
|
116
|
+
return t10;
|
|
117
|
+
};
|
|
118
|
+
export { Spinner };
|