@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,153 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { c } from "react/compiler-runtime";
|
|
3
|
+
import { useRef } from "react";
|
|
4
|
+
import { Dialog } from "@base-ui/react/dialog";
|
|
5
|
+
import { cn } from "../../utils/cn.js";
|
|
6
|
+
import { findFirstField } from "../../utils/first-field.js";
|
|
7
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
// src/patterns/Drawer/Drawer.tsx
|
|
9
|
+
var SIDE = {
|
|
10
|
+
start: [
|
|
11
|
+
"inset-s-0 border-e",
|
|
12
|
+
"data-starting-style:-translate-x-full data-ending-style:-translate-x-full",
|
|
13
|
+
"rtl:data-starting-style:translate-x-full rtl:data-ending-style:translate-x-full"
|
|
14
|
+
].join(" "),
|
|
15
|
+
end: [
|
|
16
|
+
"inset-e-0 border-s",
|
|
17
|
+
"data-starting-style:translate-x-full data-ending-style:translate-x-full",
|
|
18
|
+
"rtl:data-starting-style:-translate-x-full rtl:data-ending-style:-translate-x-full"
|
|
19
|
+
].join(" ")
|
|
20
|
+
};
|
|
21
|
+
var PADDING = {
|
|
22
|
+
none: "",
|
|
23
|
+
medium: "gap-6.25 px-4.5 py-8"
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* A full-height panel that slides in at one edge over a dimmed page: navigation on a narrow screen (`start`), or
|
|
27
|
+
* filters and details (`end`). A header (glyph, title, an action), scrolling content and a footer; with
|
|
28
|
+
* `hideTitle`, only the content. Opening it puts the cursor in its first field, if it has one; Escape or a click
|
|
29
|
+
* on the page closes it, and focus stays inside while it is open.
|
|
30
|
+
*/
|
|
31
|
+
var Drawer = (t0) => {
|
|
32
|
+
const $ = c(31);
|
|
33
|
+
const { open, onOpenChange, title, hideTitle: t1, side: t2, icon, headerAction, children, footer, onSubmit, padding: t3, className } = t0;
|
|
34
|
+
const hideTitle = t1 === void 0 ? false : t1;
|
|
35
|
+
const side = t2 === void 0 ? "end" : t2;
|
|
36
|
+
const padding = t3 === void 0 ? "medium" : t3;
|
|
37
|
+
const contentRef = useRef(null);
|
|
38
|
+
const t4 = PADDING[padding];
|
|
39
|
+
let t5;
|
|
40
|
+
if ($[0] !== t4) {
|
|
41
|
+
t5 = cn("flex min-h-0 flex-1 flex-col overflow-y-auto", t4);
|
|
42
|
+
$[0] = t4;
|
|
43
|
+
$[1] = t5;
|
|
44
|
+
} else t5 = $[1];
|
|
45
|
+
let t6;
|
|
46
|
+
if ($[2] !== children || $[3] !== t5) {
|
|
47
|
+
t6 = /* @__PURE__ */ jsx("div", {
|
|
48
|
+
ref: contentRef,
|
|
49
|
+
className: t5,
|
|
50
|
+
children
|
|
51
|
+
});
|
|
52
|
+
$[2] = children;
|
|
53
|
+
$[3] = t5;
|
|
54
|
+
$[4] = t6;
|
|
55
|
+
} else t6 = $[4];
|
|
56
|
+
let t7;
|
|
57
|
+
if ($[5] !== footer) {
|
|
58
|
+
t7 = footer ? /* @__PURE__ */ jsx("div", {
|
|
59
|
+
className: "min-h-16.75 shrink-0 border-t border-line-subtle px-5.5 py-3.25",
|
|
60
|
+
children: footer
|
|
61
|
+
}) : null;
|
|
62
|
+
$[5] = footer;
|
|
63
|
+
$[6] = t7;
|
|
64
|
+
} else t7 = $[6];
|
|
65
|
+
let t8;
|
|
66
|
+
if ($[7] !== t6 || $[8] !== t7) {
|
|
67
|
+
t8 = /* @__PURE__ */ jsxs(Fragment$1, { children: [t6, t7] });
|
|
68
|
+
$[7] = t6;
|
|
69
|
+
$[8] = t7;
|
|
70
|
+
$[9] = t8;
|
|
71
|
+
} else t8 = $[9];
|
|
72
|
+
const body = t8;
|
|
73
|
+
let t9;
|
|
74
|
+
if ($[10] === Symbol.for("react.memo_cache_sentinel")) {
|
|
75
|
+
t9 = /* @__PURE__ */ jsx(Dialog.Backdrop, { className: "fixed inset-0 z-1100 bg-scrim backdrop-blur-[2px] transition-opacity duration-200 ease-standard data-starting-style:opacity-0 data-ending-style:opacity-0" });
|
|
76
|
+
$[10] = t9;
|
|
77
|
+
} else t9 = $[10];
|
|
78
|
+
let t10;
|
|
79
|
+
if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
|
|
80
|
+
t10 = () => findFirstField(contentRef.current) ?? true;
|
|
81
|
+
$[11] = t10;
|
|
82
|
+
} else t10 = $[11];
|
|
83
|
+
const t11 = SIDE[side];
|
|
84
|
+
let t12;
|
|
85
|
+
if ($[12] !== className || $[13] !== t11) {
|
|
86
|
+
t12 = cn("fixed inset-y-0 z-1100 box-border flex w-[min(320px,85vw)] flex-col overflow-hidden", "border-line bg-surface text-fg shadow-lg outline-none", "transition-[opacity,translate] duration-200 ease-standard data-starting-style:opacity-0 data-ending-style:opacity-0", t11, className);
|
|
87
|
+
$[12] = className;
|
|
88
|
+
$[13] = t11;
|
|
89
|
+
$[14] = t12;
|
|
90
|
+
} else t12 = $[14];
|
|
91
|
+
let t13;
|
|
92
|
+
if ($[15] !== headerAction || $[16] !== hideTitle || $[17] !== icon || $[18] !== title) {
|
|
93
|
+
t13 = hideTitle ? /* @__PURE__ */ jsx(Dialog.Title, {
|
|
94
|
+
className: "sr-only",
|
|
95
|
+
children: title
|
|
96
|
+
}) : /* @__PURE__ */ jsxs("div", {
|
|
97
|
+
className: "flex min-h-14.5 shrink-0 items-center justify-between gap-3 border-b border-line-subtle px-4.5",
|
|
98
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
99
|
+
className: "flex items-center gap-2.5",
|
|
100
|
+
children: [icon ? /* @__PURE__ */ jsx("span", {
|
|
101
|
+
className: "inline-flex text-primary-active [&_svg]:size-3.75",
|
|
102
|
+
children: icon
|
|
103
|
+
}) : null, /* @__PURE__ */ jsx(Dialog.Title, {
|
|
104
|
+
className: "m-0 text-body-lg font-semibold text-fg",
|
|
105
|
+
children: title
|
|
106
|
+
})]
|
|
107
|
+
}), headerAction]
|
|
108
|
+
});
|
|
109
|
+
$[15] = headerAction;
|
|
110
|
+
$[16] = hideTitle;
|
|
111
|
+
$[17] = icon;
|
|
112
|
+
$[18] = title;
|
|
113
|
+
$[19] = t13;
|
|
114
|
+
} else t13 = $[19];
|
|
115
|
+
let t14;
|
|
116
|
+
if ($[20] !== body || $[21] !== onSubmit) {
|
|
117
|
+
t14 = onSubmit ? /* @__PURE__ */ jsx("form", {
|
|
118
|
+
noValidate: true,
|
|
119
|
+
className: "flex min-h-0 flex-1 flex-col",
|
|
120
|
+
onSubmit,
|
|
121
|
+
children: body
|
|
122
|
+
}) : body;
|
|
123
|
+
$[20] = body;
|
|
124
|
+
$[21] = onSubmit;
|
|
125
|
+
$[22] = t14;
|
|
126
|
+
} else t14 = $[22];
|
|
127
|
+
let t15;
|
|
128
|
+
if ($[23] !== t12 || $[24] !== t13 || $[25] !== t14) {
|
|
129
|
+
t15 = /* @__PURE__ */ jsxs(Dialog.Portal, { children: [t9, /* @__PURE__ */ jsxs(Dialog.Popup, {
|
|
130
|
+
initialFocus: t10,
|
|
131
|
+
className: t12,
|
|
132
|
+
children: [t13, t14]
|
|
133
|
+
})] });
|
|
134
|
+
$[23] = t12;
|
|
135
|
+
$[24] = t13;
|
|
136
|
+
$[25] = t14;
|
|
137
|
+
$[26] = t15;
|
|
138
|
+
} else t15 = $[26];
|
|
139
|
+
let t16;
|
|
140
|
+
if ($[27] !== onOpenChange || $[28] !== open || $[29] !== t15) {
|
|
141
|
+
t16 = /* @__PURE__ */ jsx(Dialog.Root, {
|
|
142
|
+
open,
|
|
143
|
+
onOpenChange,
|
|
144
|
+
children: t15
|
|
145
|
+
});
|
|
146
|
+
$[27] = onOpenChange;
|
|
147
|
+
$[28] = open;
|
|
148
|
+
$[29] = t15;
|
|
149
|
+
$[30] = t16;
|
|
150
|
+
} else t16 = $[30];
|
|
151
|
+
return t16;
|
|
152
|
+
};
|
|
153
|
+
export { Drawer };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import type { ToneName } from "../../types/tone.js";
|
|
3
|
+
export interface EmptyStateProps {
|
|
4
|
+
/** What the view has none of, e.g. "No projects yet". */
|
|
5
|
+
title: string;
|
|
6
|
+
/** A line under the title: why, or what to do next. */
|
|
7
|
+
description?: string | undefined;
|
|
8
|
+
/** The glyph on the disc or tile. Default a magnifying glass. */
|
|
9
|
+
icon?: ReactNode | undefined;
|
|
10
|
+
/** The disc's colour, for `variant="page"`. Default neutral. */
|
|
11
|
+
tone?: ToneName | undefined;
|
|
12
|
+
/** An optional call to action, e.g. a "Clear filters" button. */
|
|
13
|
+
action?: ReactNode | undefined;
|
|
14
|
+
/**
|
|
15
|
+
* The live region it is. "polite" (default) is a status region (`role="status"`): a change to its text while it
|
|
16
|
+
* is shown is announced at the next pause, but one that appears with its text is often not announced at all.
|
|
17
|
+
* "assertive", for a failure, is an alert (`role="alert"`), which is announced when it appears.
|
|
18
|
+
*/
|
|
19
|
+
announce?: "polite" | "assertive" | undefined;
|
|
20
|
+
/**
|
|
21
|
+
* "page" fills a page or a card: an icon on a large disc. "inline" sits in a
|
|
22
|
+
* table's place (Figma's empty row): a small teal tile, a 13px title, one line.
|
|
23
|
+
*/
|
|
24
|
+
variant?: "page" | "inline" | undefined;
|
|
25
|
+
/** Classes for the outer element, e.g. a height. */
|
|
26
|
+
className?: string | undefined;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* What a view shows when it has nothing to show: a title, an optional line, an icon and a call to action. It is a
|
|
30
|
+
* status region by default and an alert with `announce="assertive"` for a failure. A status region that appears
|
|
31
|
+
* with its text is often not announced, so where an empty result must be heard as it happens (a search that
|
|
32
|
+
* found nothing), also say so in a region that is already on the page, such as a results count.
|
|
33
|
+
* `variant="inline"` is the compact form for a table's empty row.
|
|
34
|
+
*/
|
|
35
|
+
export declare const EmptyState: ({ title, description, icon, tone, action, announce, variant, className, }: EmptyStateProps) => import("react").JSX.Element;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Search } from "lucide-react";
|
|
3
|
+
import { IconTile } from "../../components/IconTile/IconTile.js";
|
|
4
|
+
import { StateIcon } from "../../components/StateIcon/StateIcon.js";
|
|
5
|
+
import { cn } from "../../utils/cn.js";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
// src/patterns/EmptyState/EmptyState.tsx
|
|
8
|
+
/**
|
|
9
|
+
* What a view shows when it has nothing to show: a title, an optional line, an icon and a call to action. It is a
|
|
10
|
+
* status region by default and an alert with `announce="assertive"` for a failure. A status region that appears
|
|
11
|
+
* with its text is often not announced, so where an empty result must be heard as it happens (a search that
|
|
12
|
+
* found nothing), also say so in a region that is already on the page, such as a results count.
|
|
13
|
+
* `variant="inline"` is the compact form for a table's empty row.
|
|
14
|
+
*/
|
|
15
|
+
var EmptyState = ({ title, description, icon = /* @__PURE__ */ jsx(Search, {}), tone = "neutral", action, announce = "polite", variant = "page", className }) => {
|
|
16
|
+
const isInline = variant === "inline";
|
|
17
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
18
|
+
role: announce === "assertive" ? "alert" : "status",
|
|
19
|
+
className: cn("flex flex-col items-center justify-center px-4 text-center", isInline ? "min-h-65 py-8" : "gap-1 py-12", className),
|
|
20
|
+
children: [
|
|
21
|
+
isInline ? /* @__PURE__ */ jsx(IconTile, {
|
|
22
|
+
icon,
|
|
23
|
+
size: "small",
|
|
24
|
+
className: "mb-2.5"
|
|
25
|
+
}) : /* @__PURE__ */ jsx(StateIcon, {
|
|
26
|
+
icon,
|
|
27
|
+
tone
|
|
28
|
+
}),
|
|
29
|
+
/* @__PURE__ */ jsx("p", {
|
|
30
|
+
className: cn("m-0", isInline ? "text-body-sm font-semibold text-fg-body" : "mt-3 text-body-sm font-bold text-fg"),
|
|
31
|
+
children: title
|
|
32
|
+
}),
|
|
33
|
+
description ? /* @__PURE__ */ jsx("p", {
|
|
34
|
+
className: cn("m-0", isInline ? "mt-1.25 text-body-sm text-fg-secondary" : "max-w-xs text-tiny text-fg-secondary"),
|
|
35
|
+
children: description
|
|
36
|
+
}) : null,
|
|
37
|
+
action ? /* @__PURE__ */ jsx("div", {
|
|
38
|
+
className: "mt-3",
|
|
39
|
+
children: action
|
|
40
|
+
}) : null
|
|
41
|
+
]
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
export { EmptyState };
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { type Ref } from "react";
|
|
2
|
+
/** The texts of the upload. The design system has no i18n, so the caller supplies them. */
|
|
3
|
+
export interface FileUploadLabels {
|
|
4
|
+
/** What the drop area says before the button, e.g. "Drag files here or". */
|
|
5
|
+
drop: string;
|
|
6
|
+
/** The button that opens the file chooser, e.g. "Browse files". */
|
|
7
|
+
browse: string;
|
|
8
|
+
/** Accessible name of the button that removes a file, from its name: `(name) => `Remove ${name}``. */
|
|
9
|
+
remove: (fileName: string) => string;
|
|
10
|
+
}
|
|
11
|
+
/** Why a file was not added. */
|
|
12
|
+
export type FileUploadRejectionReason = "type" | "size" | "count";
|
|
13
|
+
export interface FileUploadRejection {
|
|
14
|
+
file: File;
|
|
15
|
+
/**
|
|
16
|
+
* `type`: not in `accept`. `size`: larger than `maxSize`. `count`: no room for it: there are `maxFiles` already,
|
|
17
|
+
* or, without `multiple`, another file of the same drop was taken.
|
|
18
|
+
*/
|
|
19
|
+
reason: FileUploadRejectionReason;
|
|
20
|
+
}
|
|
21
|
+
/** What the app knows of a file that is being sent: how far it is, or what went wrong. */
|
|
22
|
+
export interface FileUploadStatus {
|
|
23
|
+
/** From 0 to 100. A bar shows while it is a number. */
|
|
24
|
+
progress?: number | undefined;
|
|
25
|
+
/** The message, in the user's language, shown in red under the file. */
|
|
26
|
+
error?: string | undefined;
|
|
27
|
+
}
|
|
28
|
+
export interface FileUploadProps {
|
|
29
|
+
/** The chosen files, in the order they were added. */
|
|
30
|
+
value: readonly File[];
|
|
31
|
+
/** Called with the new list when files are added or removed. */
|
|
32
|
+
onValueChange: (files: File[]) => void;
|
|
33
|
+
labels: FileUploadLabels;
|
|
34
|
+
/** The kinds of file it takes, as the file input writes them: `"image/*,.pdf"`. Anything if omitted. */
|
|
35
|
+
accept?: string | undefined;
|
|
36
|
+
/**
|
|
37
|
+
* Let several files be chosen. Otherwise a new choice replaces the one before, and of several files dropped at
|
|
38
|
+
* once the first that passes is taken and the others are reported to `onReject` as `count`.
|
|
39
|
+
*/
|
|
40
|
+
multiple?: boolean | undefined;
|
|
41
|
+
/** The largest a file may be, in bytes. */
|
|
42
|
+
maxSize?: number | undefined;
|
|
43
|
+
/** The most files the list takes. */
|
|
44
|
+
maxFiles?: number | undefined;
|
|
45
|
+
/**
|
|
46
|
+
* Called with the files that were not added and why, so the app can tell the person in its own words. The files
|
|
47
|
+
* that were fine are added regardless.
|
|
48
|
+
*/
|
|
49
|
+
onReject?: ((rejections: FileUploadRejection[]) => void) | undefined;
|
|
50
|
+
/** Progress and errors of the files, by file: the app sets them as it sends them. */
|
|
51
|
+
statuses?: ReadonlyMap<File, FileUploadStatus> | undefined;
|
|
52
|
+
/** A line in the drop area under the button: the limits, e.g. "PNG or JPG, up to 5 MB". */
|
|
53
|
+
description?: string | undefined;
|
|
54
|
+
/**
|
|
55
|
+
* The locale that writes the sizes, a BCP 47 tag. If omitted, the runtime's default locale (the browser's, or the
|
|
56
|
+
* server's when rendered there), not the page's `lang`.
|
|
57
|
+
*/
|
|
58
|
+
locale?: string | undefined;
|
|
59
|
+
disabled?: boolean | undefined;
|
|
60
|
+
/** Draws the drop area red and marks it invalid for assistive technology. */
|
|
61
|
+
invalid?: boolean | undefined;
|
|
62
|
+
/**
|
|
63
|
+
* The field's name in a submitted form. A hidden file input holds the chosen files, so a form the browser submits
|
|
64
|
+
* itself sends them under this name (where the browser can set a file input's files, as current browsers can).
|
|
65
|
+
*/
|
|
66
|
+
name?: string | undefined;
|
|
67
|
+
id?: string | undefined;
|
|
68
|
+
/** The accessible name of the drop area, for an upload with no label element of its own. */
|
|
69
|
+
"aria-label"?: string | undefined;
|
|
70
|
+
/** The id of the element that names the drop area, such as a field's label. */
|
|
71
|
+
"aria-labelledby"?: string | undefined;
|
|
72
|
+
/** The ids of the field's message and hint. They describe the drop area and its Browse button, which takes the focus. */
|
|
73
|
+
"aria-describedby"?: string | undefined;
|
|
74
|
+
/** The upload was left. */
|
|
75
|
+
onBlur?: (() => void) | undefined;
|
|
76
|
+
/** The button that opens the chooser, for a form library to focus the first invalid field. */
|
|
77
|
+
buttonRef?: Ref<HTMLButtonElement> | undefined;
|
|
78
|
+
className?: string | undefined;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* A drop area and a button for choosing files, and the list of what was chosen, each with its size, a progress
|
|
82
|
+
* bar if the app reports one, and a button that removes it. Files are checked against `accept`, `maxSize` and
|
|
83
|
+
* `maxFiles` as they are added; what is refused is reported, not shown, so the app words it. The drop is for the
|
|
84
|
+
* pointer; the button is for everyone else. Sending the files is the app's; a form the browser submits itself
|
|
85
|
+
* sends them under `name`. A file's error is announced when the app sets it, and describes its Remove button.
|
|
86
|
+
*/
|
|
87
|
+
export declare const FileUpload: ({ value, onValueChange, labels, accept, multiple, maxSize, maxFiles, onReject, statuses, description, locale, disabled, invalid, name, id, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, onBlur, buttonRef, className, }: FileUploadProps) => import("react").JSX.Element;
|