@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,66 @@
|
|
|
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 } from "react/jsx-runtime";
|
|
6
|
+
// src/components/Tag/Tag.tsx
|
|
7
|
+
/**
|
|
8
|
+
* A small pill that labels rather than reports a status: the account a group
|
|
9
|
+
* belongs to (neutral), a count such as "9 modules" (brand). Figma's
|
|
10
|
+
* `.account-pill`, `.count-badge` and the module rows' permission count.
|
|
11
|
+
*/
|
|
12
|
+
var tagVariants = cva("inline-flex shrink-0 items-center gap-1 rounded-pill whitespace-nowrap", {
|
|
13
|
+
variants: {
|
|
14
|
+
tone: {
|
|
15
|
+
neutral: "bg-subtle text-fg-secondary",
|
|
16
|
+
brand: "bg-primary-light text-primary-text"
|
|
17
|
+
},
|
|
18
|
+
size: {
|
|
19
|
+
small: "px-2 py-1.25 text-tiny leading-[1.25]",
|
|
20
|
+
medium: "px-2.25 py-1.25 text-caption leading-[1.25] font-normal",
|
|
21
|
+
large: "px-2.5 py-1.5 text-caption leading-[1.25] font-normal"
|
|
22
|
+
},
|
|
23
|
+
strong: {
|
|
24
|
+
true: "font-semibold",
|
|
25
|
+
false: ""
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
defaultVariants: {
|
|
29
|
+
tone: "neutral",
|
|
30
|
+
size: "medium",
|
|
31
|
+
strong: false
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
/** A pill that labels: a category (neutral) or a count (brand). A status takes StatusBadge instead. */
|
|
35
|
+
var Tag = (t0) => {
|
|
36
|
+
const $ = c(8);
|
|
37
|
+
const { children, tone: t1, size: t2, strong: t3, className } = t0;
|
|
38
|
+
const tone = t1 === void 0 ? "neutral" : t1;
|
|
39
|
+
const size = t2 === void 0 ? "medium" : t2;
|
|
40
|
+
const strong = t3 === void 0 ? false : t3;
|
|
41
|
+
let t4;
|
|
42
|
+
if ($[0] !== className || $[1] !== size || $[2] !== strong || $[3] !== tone) {
|
|
43
|
+
t4 = cn(tagVariants({
|
|
44
|
+
tone,
|
|
45
|
+
size,
|
|
46
|
+
strong
|
|
47
|
+
}), className);
|
|
48
|
+
$[0] = className;
|
|
49
|
+
$[1] = size;
|
|
50
|
+
$[2] = strong;
|
|
51
|
+
$[3] = tone;
|
|
52
|
+
$[4] = t4;
|
|
53
|
+
} else t4 = $[4];
|
|
54
|
+
let t5;
|
|
55
|
+
if ($[5] !== children || $[6] !== t4) {
|
|
56
|
+
t5 = /* @__PURE__ */ jsx("span", {
|
|
57
|
+
className: t4,
|
|
58
|
+
children
|
|
59
|
+
});
|
|
60
|
+
$[5] = children;
|
|
61
|
+
$[6] = t4;
|
|
62
|
+
$[7] = t5;
|
|
63
|
+
} else t5 = $[7];
|
|
64
|
+
return t5;
|
|
65
|
+
};
|
|
66
|
+
export { Tag };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ToastLabels } from "./toast-manager.js";
|
|
2
|
+
/**
|
|
3
|
+
* The stack of toasts. Rendered once, by DesignSystemProvider; raise a toast
|
|
4
|
+
* with `useAppToast`. F6 jumps into the stack for keyboard users.
|
|
5
|
+
*/
|
|
6
|
+
export declare const AppToaster: ({ labels }: {
|
|
7
|
+
labels: ToastLabels;
|
|
8
|
+
}) => import("react").JSX.Element;
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { c } from "react/compiler-runtime";
|
|
3
|
+
import { Toast } from "@base-ui/react/toast";
|
|
4
|
+
import { useDirection } from "@base-ui/react/direction-provider";
|
|
5
|
+
import { Bell, Check, Shield, X } from "lucide-react";
|
|
6
|
+
import { cn } from "../../utils/cn.js";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
// src/components/Toast/AppToaster.tsx
|
|
9
|
+
var isIntent = (type) => type === "success" || type === "error" || type === "warning" || type === "info";
|
|
10
|
+
/** Figma's notification glyphs: a check, a shield for attention, a cross, a bell for an update. */
|
|
11
|
+
var ICONS = {
|
|
12
|
+
success: /* @__PURE__ */ jsx(Check, { "aria-hidden": "true" }),
|
|
13
|
+
warning: /* @__PURE__ */ jsx(Shield, { "aria-hidden": "true" }),
|
|
14
|
+
error: /* @__PURE__ */ jsx(X, { "aria-hidden": "true" }),
|
|
15
|
+
info: /* @__PURE__ */ jsx(Bell, { "aria-hidden": "true" })
|
|
16
|
+
};
|
|
17
|
+
/** Each kind's border, icon tile and life bar. */
|
|
18
|
+
var TONES = {
|
|
19
|
+
success: {
|
|
20
|
+
border: "border-success-border",
|
|
21
|
+
tile: "bg-success-wash text-success-text",
|
|
22
|
+
bar: "bg-success-solid"
|
|
23
|
+
},
|
|
24
|
+
warning: {
|
|
25
|
+
border: "border-warning-border",
|
|
26
|
+
tile: "bg-warning-wash text-warning-text",
|
|
27
|
+
bar: "bg-warning-solid"
|
|
28
|
+
},
|
|
29
|
+
error: {
|
|
30
|
+
border: "border-error-border",
|
|
31
|
+
tile: "bg-error-wash text-destructive",
|
|
32
|
+
bar: "bg-error-solid"
|
|
33
|
+
},
|
|
34
|
+
info: {
|
|
35
|
+
border: "border-info-border",
|
|
36
|
+
tile: "bg-info-tint text-info-text",
|
|
37
|
+
bar: "bg-info-solid"
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Top end of the page, below the top bar. The toasts are a plain column: the
|
|
42
|
+
* newest at the bottom, the oldest leaving first.
|
|
43
|
+
*/
|
|
44
|
+
var VIEWPORT = "fixed inset-e-5 top-21 z-1300 m-0 box-border flex w-[min(360px,calc(100vw-28px))] flex-col gap-2.5 p-0 outline-none";
|
|
45
|
+
/** Figma's `.notification`: a white card on the kind's border, sliding in from the end edge. */
|
|
46
|
+
var ROOT = [
|
|
47
|
+
"group/toast relative box-border flex min-h-18.5 items-start gap-2.75 overflow-hidden rounded-lg border bg-surface py-3.25 ps-3.25 pe-9.5 text-fg shadow-lg",
|
|
48
|
+
"transition-[opacity,translate,scale] duration-250 ease-standard",
|
|
49
|
+
"data-starting-style:translate-x-4.5 data-starting-style:scale-98 data-starting-style:opacity-0",
|
|
50
|
+
"data-ending-style:translate-x-4.5 data-ending-style:opacity-0",
|
|
51
|
+
"rtl:data-starting-style:-translate-x-4.5 rtl:data-ending-style:-translate-x-4.5",
|
|
52
|
+
"data-limited:opacity-0"
|
|
53
|
+
].join(" ");
|
|
54
|
+
/** A toast is swiped away down or towards the edge it sits at: the right, or the left in right to left. */
|
|
55
|
+
var SWIPE_LTR = ["down", "right"];
|
|
56
|
+
var SWIPE_RTL = ["down", "left"];
|
|
57
|
+
var ToastList = (t0) => {
|
|
58
|
+
const $ = c(7);
|
|
59
|
+
const { labels } = t0;
|
|
60
|
+
const { toasts } = Toast.useToastManager();
|
|
61
|
+
const direction = useDirection();
|
|
62
|
+
let t1;
|
|
63
|
+
if ($[0] !== direction || $[1] !== labels || $[2] !== toasts) {
|
|
64
|
+
let t2;
|
|
65
|
+
if ($[4] !== direction || $[5] !== labels) {
|
|
66
|
+
t2 = (toast) => {
|
|
67
|
+
const intent = isIntent(toast.type) ? toast.type : "info";
|
|
68
|
+
const tone = TONES[intent];
|
|
69
|
+
return /* @__PURE__ */ jsxs(Toast.Root, {
|
|
70
|
+
toast,
|
|
71
|
+
swipeDirection: direction === "rtl" ? SWIPE_RTL : SWIPE_LTR,
|
|
72
|
+
className: cn(ROOT, tone.border),
|
|
73
|
+
children: [
|
|
74
|
+
/* @__PURE__ */ jsx("span", {
|
|
75
|
+
className: cn("inline-flex size-8.5 shrink-0 items-center justify-center rounded-[9px] [&_svg]:size-4.25 [&_svg]:stroke-2", tone.tile),
|
|
76
|
+
children: ICONS[intent]
|
|
77
|
+
}),
|
|
78
|
+
/* @__PURE__ */ jsxs("div", {
|
|
79
|
+
className: "flex min-w-0 flex-col gap-1 pt-px",
|
|
80
|
+
children: [/* @__PURE__ */ jsx(Toast.Title, {
|
|
81
|
+
className: "m-0 text-body-sm font-semibold text-fg",
|
|
82
|
+
children: labels.titles[intent]
|
|
83
|
+
}), /* @__PURE__ */ jsx(Toast.Description, { className: "m-0 text-caption leading-[1.45] font-normal text-fg-secondary" })]
|
|
84
|
+
}),
|
|
85
|
+
/* @__PURE__ */ jsx(Toast.Close, {
|
|
86
|
+
"aria-label": labels.dismiss,
|
|
87
|
+
className: "absolute inset-e-2.25 top-2.5 inline-flex size-6.25 items-center justify-center rounded-[7px] border-0 bg-transparent p-0 text-fg-tertiary transition-colors duration-150 ease-standard hover:bg-subtle hover:text-fg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus [&_svg]:size-3.25",
|
|
88
|
+
children: /* @__PURE__ */ jsx(X, { "aria-hidden": "true" })
|
|
89
|
+
}),
|
|
90
|
+
/* @__PURE__ */ jsx("i", {
|
|
91
|
+
"aria-hidden": "true",
|
|
92
|
+
className: cn("absolute inset-x-0 bottom-0 h-0.75 origin-left animate-toast-life rtl:origin-right group-data-expanded/toast:[animation-play-state:paused]", tone.bar)
|
|
93
|
+
}, toast.updateKey)
|
|
94
|
+
]
|
|
95
|
+
}, toast.id);
|
|
96
|
+
};
|
|
97
|
+
$[4] = direction;
|
|
98
|
+
$[5] = labels;
|
|
99
|
+
$[6] = t2;
|
|
100
|
+
} else t2 = $[6];
|
|
101
|
+
t1 = toasts.map(t2);
|
|
102
|
+
$[0] = direction;
|
|
103
|
+
$[1] = labels;
|
|
104
|
+
$[2] = toasts;
|
|
105
|
+
$[3] = t1;
|
|
106
|
+
} else t1 = $[3];
|
|
107
|
+
return t1;
|
|
108
|
+
};
|
|
109
|
+
/**
|
|
110
|
+
* The stack of toasts. Rendered once, by DesignSystemProvider; raise a toast
|
|
111
|
+
* with `useAppToast`. F6 jumps into the stack for keyboard users.
|
|
112
|
+
*/
|
|
113
|
+
var AppToaster = (t0) => {
|
|
114
|
+
const $ = c(5);
|
|
115
|
+
const { labels } = t0;
|
|
116
|
+
let t1;
|
|
117
|
+
if ($[0] !== labels) {
|
|
118
|
+
t1 = /* @__PURE__ */ jsx(ToastList, { labels });
|
|
119
|
+
$[0] = labels;
|
|
120
|
+
$[1] = t1;
|
|
121
|
+
} else t1 = $[1];
|
|
122
|
+
let t2;
|
|
123
|
+
if ($[2] !== labels.region || $[3] !== t1) {
|
|
124
|
+
t2 = /* @__PURE__ */ jsx(Toast.Portal, { children: /* @__PURE__ */ jsx(Toast.Viewport, {
|
|
125
|
+
"aria-label": labels.region,
|
|
126
|
+
className: VIEWPORT,
|
|
127
|
+
children: t1
|
|
128
|
+
}) });
|
|
129
|
+
$[2] = labels.region;
|
|
130
|
+
$[3] = t1;
|
|
131
|
+
$[4] = t2;
|
|
132
|
+
} else t2 = $[4];
|
|
133
|
+
return t2;
|
|
134
|
+
};
|
|
135
|
+
export { AppToaster };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/** How long a toast stays; the life bar under it drains over the same time. */
|
|
2
|
+
export declare const TOAST_TIMEOUT_MS = 5000;
|
|
3
|
+
/** At most this many toasts are shown; a newer one pushes out the oldest. */
|
|
4
|
+
export declare const TOAST_LIMIT = 4;
|
|
5
|
+
export type ToastIntent = "success" | "error" | "warning" | "info";
|
|
6
|
+
/** The words of a toast. The design system has no i18n, so the app supplies them. */
|
|
7
|
+
export interface ToastLabels {
|
|
8
|
+
/** The bold first line of each kind, e.g. success "Success", error "Unable to complete". */
|
|
9
|
+
titles: Record<ToastIntent, string>;
|
|
10
|
+
/** Accessible name of a toast's dismiss button. */
|
|
11
|
+
dismiss: string;
|
|
12
|
+
/** Accessible name of the region that holds the toasts, e.g. "Notifications". */
|
|
13
|
+
region: string;
|
|
14
|
+
}
|
|
15
|
+
/** The toasts' words in English, what the provider shows for any the app does not give. */
|
|
16
|
+
export declare const ENGLISH_TOAST_LABELS: ToastLabels;
|
|
17
|
+
/**
|
|
18
|
+
* The one toast manager of the app. DesignSystemProvider hands it to Base UI's
|
|
19
|
+
* Toast.Provider, and `useAppToast` queues through it, so a toast can be raised
|
|
20
|
+
* from any component without that component re-rendering as toasts come and go.
|
|
21
|
+
*/
|
|
22
|
+
export declare const appToastManager: import("@base-ui/react").ToastManager<any>;
|
|
23
|
+
type ToastOptions = Parameters<typeof appToastManager.add>[0];
|
|
24
|
+
/** Shows a toast now, or as soon as the toaster is listening. */
|
|
25
|
+
export declare const showToast: (options: ToastOptions) => void;
|
|
26
|
+
/** Called by DesignSystemProvider: true once its toaster has subscribed, false when it unmounts. */
|
|
27
|
+
export declare const setToasterReady: (ready: boolean) => void;
|
|
28
|
+
export {};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Toast } from "@base-ui/react/toast";
|
|
3
|
+
// src/components/Toast/toast-manager.ts
|
|
4
|
+
/** How long a toast stays; the life bar under it drains over the same time. */
|
|
5
|
+
var TOAST_TIMEOUT_MS = 5e3;
|
|
6
|
+
/** The toasts' words in English, what the provider shows for any the app does not give. */
|
|
7
|
+
var ENGLISH_TOAST_LABELS = {
|
|
8
|
+
titles: {
|
|
9
|
+
success: "Success",
|
|
10
|
+
warning: "Attention",
|
|
11
|
+
error: "Unable to complete",
|
|
12
|
+
info: "Update"
|
|
13
|
+
},
|
|
14
|
+
dismiss: "Dismiss notification",
|
|
15
|
+
region: "Notifications"
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* The one toast manager of the app. DesignSystemProvider hands it to Base UI's
|
|
19
|
+
* Toast.Provider, and `useAppToast` queues through it, so a toast can be raised
|
|
20
|
+
* from any component without that component re-rendering as toasts come and go.
|
|
21
|
+
*/
|
|
22
|
+
var appToastManager = Toast.createToastManager();
|
|
23
|
+
/**
|
|
24
|
+
* Whether a toaster is listening. Base UI's Toast.Provider subscribes in an effect, and React runs a parent's
|
|
25
|
+
* effects after its children's, so a toast raised in a component's mount effect (a "session expired" notice
|
|
26
|
+
* on load) would reach the manager before anyone listens and be lost. DesignSystemProvider sets this once the
|
|
27
|
+
* toaster has subscribed; until then toasts wait here and are shown as soon as it does.
|
|
28
|
+
*/
|
|
29
|
+
var isToasterReady = false;
|
|
30
|
+
var pendingToasts = [];
|
|
31
|
+
/** A page with no provider would otherwise hold its toasts for ever. */
|
|
32
|
+
var MAX_PENDING_TOASTS = 20;
|
|
33
|
+
/** Shows a toast now, or as soon as the toaster is listening. */
|
|
34
|
+
var showToast = (options) => {
|
|
35
|
+
if (isToasterReady) {
|
|
36
|
+
appToastManager.add(options);
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
if (pendingToasts.length < MAX_PENDING_TOASTS) pendingToasts.push(options);
|
|
40
|
+
};
|
|
41
|
+
/** Called by DesignSystemProvider: true once its toaster has subscribed, false when it unmounts. */
|
|
42
|
+
var setToasterReady = (ready) => {
|
|
43
|
+
isToasterReady = ready;
|
|
44
|
+
if (!ready) return;
|
|
45
|
+
for (const options of pendingToasts.splice(0)) appToastManager.add(options);
|
|
46
|
+
};
|
|
47
|
+
export { ENGLISH_TOAST_LABELS, TOAST_TIMEOUT_MS, appToastManager, setToasterReady, showToast };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* A button that stays pressed: white with a grey border, teal and tinted while pressed. The sizes are Button's
|
|
4
|
+
* (small 30px, medium 42px, large 48px). ToggleGroup builds its items from the same classes.
|
|
5
|
+
*/
|
|
6
|
+
export declare const toggleVariants: (props?: ({
|
|
7
|
+
size?: "small" | "medium" | "large" | null | undefined;
|
|
8
|
+
iconOnly?: boolean | null | undefined;
|
|
9
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
10
|
+
export interface ToggleButtonProps {
|
|
11
|
+
/** Whether the button is pressed. */
|
|
12
|
+
pressed: boolean;
|
|
13
|
+
/** Called with the new state when the person presses or releases the button. */
|
|
14
|
+
onPressedChange: (pressed: boolean) => void;
|
|
15
|
+
/** The label. Leave it out for a glyph alone, and give `aria-label`. */
|
|
16
|
+
children?: ReactNode | undefined;
|
|
17
|
+
/** A glyph before the label. */
|
|
18
|
+
icon?: ReactNode | undefined;
|
|
19
|
+
size?: "small" | "medium" | "large" | undefined;
|
|
20
|
+
disabled?: boolean | undefined;
|
|
21
|
+
/** The accessible name, for a button with no text of its own. */
|
|
22
|
+
"aria-label"?: string | undefined;
|
|
23
|
+
className?: string | undefined;
|
|
24
|
+
}
|
|
25
|
+
/** A two-state button (bold, favourite, mute): `aria-pressed` follows `pressed`. For one choice among several, see ToggleGroup. */
|
|
26
|
+
export declare const ToggleButton: ({ pressed, onPressedChange, children, icon, size, disabled, "aria-label": ariaLabel, className, }: ToggleButtonProps) => import("react").JSX.Element;
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { c } from "react/compiler-runtime";
|
|
3
|
+
import { Toggle } from "@base-ui/react/toggle";
|
|
4
|
+
import { cva } from "class-variance-authority";
|
|
5
|
+
import { cn } from "../../utils/cn.js";
|
|
6
|
+
import { jsxs } from "react/jsx-runtime";
|
|
7
|
+
// src/components/ToggleButton/ToggleButton.tsx
|
|
8
|
+
/**
|
|
9
|
+
* A button that stays pressed: white with a grey border, teal and tinted while pressed. The sizes are Button's
|
|
10
|
+
* (small 30px, medium 42px, large 48px). ToggleGroup builds its items from the same classes.
|
|
11
|
+
*/
|
|
12
|
+
var toggleVariants = cva([
|
|
13
|
+
"inline-flex shrink-0 cursor-pointer select-none items-center justify-center gap-2 whitespace-nowrap rounded-md border border-line bg-surface font-semibold text-fg-body outline-none",
|
|
14
|
+
"transition-[color,background-color,border-color] duration-150 ease-standard",
|
|
15
|
+
"not-data-disabled:hover:border-primary not-data-disabled:hover:text-primary-text",
|
|
16
|
+
"data-pressed:border-primary data-pressed:bg-primary-light data-pressed:text-primary-text",
|
|
17
|
+
"focus-visible:ring-2 focus-visible:ring-focus focus-visible:ring-offset-2 focus-visible:ring-offset-page",
|
|
18
|
+
"data-disabled:cursor-not-allowed data-disabled:opacity-48"
|
|
19
|
+
], {
|
|
20
|
+
variants: {
|
|
21
|
+
size: {
|
|
22
|
+
small: "h-7.5 px-3 text-caption [&_svg]:size-3.75",
|
|
23
|
+
medium: "h-10.5 px-4 text-body-sm [&_svg]:size-4.25",
|
|
24
|
+
large: "h-12 px-5 text-body [&_svg]:size-4.5"
|
|
25
|
+
},
|
|
26
|
+
iconOnly: {
|
|
27
|
+
true: "px-0",
|
|
28
|
+
false: ""
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
compoundVariants: [
|
|
32
|
+
{
|
|
33
|
+
iconOnly: true,
|
|
34
|
+
size: "small",
|
|
35
|
+
className: "w-7.5"
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
iconOnly: true,
|
|
39
|
+
size: "medium",
|
|
40
|
+
className: "w-10.5"
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
iconOnly: true,
|
|
44
|
+
size: "large",
|
|
45
|
+
className: "w-12"
|
|
46
|
+
}
|
|
47
|
+
],
|
|
48
|
+
defaultVariants: {
|
|
49
|
+
size: "medium",
|
|
50
|
+
iconOnly: false
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
/** A two-state button (bold, favourite, mute): `aria-pressed` follows `pressed`. For one choice among several, see ToggleGroup. */
|
|
54
|
+
var ToggleButton = (t0) => {
|
|
55
|
+
const $ = c(17);
|
|
56
|
+
const { pressed, onPressedChange, children, icon, size: t1, disabled: t2, "aria-label": ariaLabel, className } = t0;
|
|
57
|
+
const size = t1 === void 0 ? "medium" : t1;
|
|
58
|
+
const disabled = t2 === void 0 ? false : t2;
|
|
59
|
+
let t3;
|
|
60
|
+
if ($[0] !== onPressedChange) {
|
|
61
|
+
t3 = (next) => {
|
|
62
|
+
onPressedChange(next);
|
|
63
|
+
};
|
|
64
|
+
$[0] = onPressedChange;
|
|
65
|
+
$[1] = t3;
|
|
66
|
+
} else t3 = $[1];
|
|
67
|
+
let t4;
|
|
68
|
+
if ($[2] !== ariaLabel) {
|
|
69
|
+
t4 = ariaLabel ? { "aria-label": ariaLabel } : {};
|
|
70
|
+
$[2] = ariaLabel;
|
|
71
|
+
$[3] = t4;
|
|
72
|
+
} else t4 = $[3];
|
|
73
|
+
let t5;
|
|
74
|
+
if ($[4] !== children || $[5] !== className || $[6] !== icon || $[7] !== size) {
|
|
75
|
+
t5 = cn(toggleVariants({
|
|
76
|
+
size,
|
|
77
|
+
iconOnly: children === void 0 && icon !== void 0
|
|
78
|
+
}), className);
|
|
79
|
+
$[4] = children;
|
|
80
|
+
$[5] = className;
|
|
81
|
+
$[6] = icon;
|
|
82
|
+
$[7] = size;
|
|
83
|
+
$[8] = t5;
|
|
84
|
+
} else t5 = $[8];
|
|
85
|
+
let t6;
|
|
86
|
+
if ($[9] !== children || $[10] !== disabled || $[11] !== icon || $[12] !== pressed || $[13] !== t3 || $[14] !== t4 || $[15] !== t5) {
|
|
87
|
+
t6 = /* @__PURE__ */ jsxs(Toggle, {
|
|
88
|
+
pressed,
|
|
89
|
+
onPressedChange: t3,
|
|
90
|
+
disabled,
|
|
91
|
+
...t4,
|
|
92
|
+
className: t5,
|
|
93
|
+
children: [icon, children]
|
|
94
|
+
});
|
|
95
|
+
$[9] = children;
|
|
96
|
+
$[10] = disabled;
|
|
97
|
+
$[11] = icon;
|
|
98
|
+
$[12] = pressed;
|
|
99
|
+
$[13] = t3;
|
|
100
|
+
$[14] = t4;
|
|
101
|
+
$[15] = t5;
|
|
102
|
+
$[16] = t6;
|
|
103
|
+
} else t6 = $[16];
|
|
104
|
+
return t6;
|
|
105
|
+
};
|
|
106
|
+
export { ToggleButton, toggleVariants };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
export interface ToggleGroupItem {
|
|
3
|
+
value: string;
|
|
4
|
+
/** The item's text. With `hideLabel` it is only the accessible name. */
|
|
5
|
+
label: string;
|
|
6
|
+
/** A glyph before the label (or instead of it, with `hideLabel`). */
|
|
7
|
+
icon?: ReactNode | undefined;
|
|
8
|
+
/** Show the glyph alone; the label stays the accessible name. */
|
|
9
|
+
hideLabel?: boolean | undefined;
|
|
10
|
+
disabled?: boolean | undefined;
|
|
11
|
+
}
|
|
12
|
+
export interface ToggleGroupProps {
|
|
13
|
+
items: readonly ToggleGroupItem[];
|
|
14
|
+
/** The `value`s of the pressed items. */
|
|
15
|
+
value: readonly string[];
|
|
16
|
+
/** Called with the `value`s of the pressed items. */
|
|
17
|
+
onValueChange: (value: string[]) => void;
|
|
18
|
+
/** Let several items be pressed at once (bold and italic). Otherwise pressing one releases the other. */
|
|
19
|
+
multiple?: boolean | undefined;
|
|
20
|
+
size?: "small" | "medium" | "large" | undefined;
|
|
21
|
+
disabled?: boolean | undefined;
|
|
22
|
+
/** Accessible name of the group, e.g. "Text style". */
|
|
23
|
+
"aria-label": string;
|
|
24
|
+
className?: string | undefined;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Buttons joined in a row, each pressed or not. One at a time by default, any number with `multiple`; pressing
|
|
28
|
+
* the pressed item releases it, so the value can be empty. For a choice that is always one of several, with the
|
|
29
|
+
* arrow keys moving and choosing, see SegmentedControl. The arrow keys move between the items; Space or Enter
|
|
30
|
+
* presses.
|
|
31
|
+
*/
|
|
32
|
+
export declare const ToggleGroup: ({ items, value, onValueChange, multiple, size, disabled, "aria-label": ariaLabel, className, }: ToggleGroupProps) => import("react").JSX.Element;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { c } from "react/compiler-runtime";
|
|
3
|
+
import { Toggle } from "@base-ui/react/toggle";
|
|
4
|
+
import { ToggleGroup as ToggleGroup$1 } from "@base-ui/react/toggle-group";
|
|
5
|
+
import { cn } from "../../utils/cn.js";
|
|
6
|
+
import { toggleVariants } from "../ToggleButton/ToggleButton.js";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
// src/components/ToggleGroup/ToggleGroup.tsx
|
|
9
|
+
/**
|
|
10
|
+
* Buttons joined in a row, each pressed or not. One at a time by default, any number with `multiple`; pressing
|
|
11
|
+
* the pressed item releases it, so the value can be empty. For a choice that is always one of several, with the
|
|
12
|
+
* arrow keys moving and choosing, see SegmentedControl. The arrow keys move between the items; Space or Enter
|
|
13
|
+
* presses.
|
|
14
|
+
*/
|
|
15
|
+
var ToggleGroup = (t0) => {
|
|
16
|
+
const $ = c(17);
|
|
17
|
+
const { items, value, onValueChange, multiple: t1, size: t2, disabled: t3, "aria-label": ariaLabel, className } = t0;
|
|
18
|
+
const multiple = t1 === void 0 ? false : t1;
|
|
19
|
+
const size = t2 === void 0 ? "medium" : t2;
|
|
20
|
+
const disabled = t3 === void 0 ? false : t3;
|
|
21
|
+
let t4;
|
|
22
|
+
if ($[0] !== onValueChange) {
|
|
23
|
+
t4 = (next) => {
|
|
24
|
+
onValueChange(next);
|
|
25
|
+
};
|
|
26
|
+
$[0] = onValueChange;
|
|
27
|
+
$[1] = t4;
|
|
28
|
+
} else t4 = $[1];
|
|
29
|
+
let t5;
|
|
30
|
+
if ($[2] !== className) {
|
|
31
|
+
t5 = cn("inline-flex", className);
|
|
32
|
+
$[2] = className;
|
|
33
|
+
$[3] = t5;
|
|
34
|
+
} else t5 = $[3];
|
|
35
|
+
let t6;
|
|
36
|
+
if ($[4] !== items || $[5] !== size) {
|
|
37
|
+
let t7;
|
|
38
|
+
if ($[7] !== size) {
|
|
39
|
+
t7 = (item) => /* @__PURE__ */ jsxs(Toggle, {
|
|
40
|
+
value: item.value,
|
|
41
|
+
disabled: item.disabled,
|
|
42
|
+
...item.hideLabel ? { "aria-label": item.label } : {},
|
|
43
|
+
className: cn(toggleVariants({
|
|
44
|
+
size,
|
|
45
|
+
iconOnly: item.hideLabel === true
|
|
46
|
+
}), "rounded-none first:rounded-s-md last:rounded-e-md not-first:-ms-px data-pressed:z-1 focus-visible:z-2"),
|
|
47
|
+
children: [item.icon, item.hideLabel ? null : item.label]
|
|
48
|
+
}, item.value);
|
|
49
|
+
$[7] = size;
|
|
50
|
+
$[8] = t7;
|
|
51
|
+
} else t7 = $[8];
|
|
52
|
+
t6 = items.map(t7);
|
|
53
|
+
$[4] = items;
|
|
54
|
+
$[5] = size;
|
|
55
|
+
$[6] = t6;
|
|
56
|
+
} else t6 = $[6];
|
|
57
|
+
let t7;
|
|
58
|
+
if ($[9] !== ariaLabel || $[10] !== disabled || $[11] !== multiple || $[12] !== t4 || $[13] !== t5 || $[14] !== t6 || $[15] !== value) {
|
|
59
|
+
t7 = /* @__PURE__ */ jsx(ToggleGroup$1, {
|
|
60
|
+
value,
|
|
61
|
+
onValueChange: t4,
|
|
62
|
+
multiple,
|
|
63
|
+
disabled,
|
|
64
|
+
"aria-label": ariaLabel,
|
|
65
|
+
className: t5,
|
|
66
|
+
children: t6
|
|
67
|
+
});
|
|
68
|
+
$[9] = ariaLabel;
|
|
69
|
+
$[10] = disabled;
|
|
70
|
+
$[11] = multiple;
|
|
71
|
+
$[12] = t4;
|
|
72
|
+
$[13] = t5;
|
|
73
|
+
$[14] = t6;
|
|
74
|
+
$[15] = value;
|
|
75
|
+
$[16] = t7;
|
|
76
|
+
} else t7 = $[16];
|
|
77
|
+
return t7;
|
|
78
|
+
};
|
|
79
|
+
export { ToggleGroup };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ReactElement, ReactNode } from "react";
|
|
2
|
+
/** Inverted: dark on a light page, light on a dark one. */
|
|
3
|
+
export declare const TOOLTIP: string;
|
|
4
|
+
interface TooltipProps {
|
|
5
|
+
content: ReactNode;
|
|
6
|
+
/** The element the tooltip describes. It is the trigger itself, so it keeps its own props. */
|
|
7
|
+
children: ReactElement;
|
|
8
|
+
/** `inline-start` and `inline-end` follow the text direction. */
|
|
9
|
+
side?: "top" | "bottom" | "left" | "right" | "inline-start" | "inline-end" | undefined;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* A short label shown on hover and keyboard focus. Supplementary only: it never
|
|
13
|
+
* appears on touch, so the trigger must have its own accessible name.
|
|
14
|
+
*/
|
|
15
|
+
export declare const Tooltip: ({ content, children, side }: TooltipProps) => import("react").JSX.Element;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { c } from "react/compiler-runtime";
|
|
3
|
+
import { Tooltip as Tooltip$1 } from "@base-ui/react/tooltip";
|
|
4
|
+
import { positioner } from "../../utils/popup.js";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
// src/components/Tooltip/Tooltip.tsx
|
|
7
|
+
/** Inverted: dark on a light page, light on a dark one. */
|
|
8
|
+
var TOOLTIP = [
|
|
9
|
+
"box-border max-w-70 rounded-sm bg-fg px-2 py-1.5 text-caption text-surface",
|
|
10
|
+
"origin-(--transform-origin) transition-[opacity,scale] duration-150 ease-standard",
|
|
11
|
+
"data-starting-style:scale-96 data-starting-style:opacity-0",
|
|
12
|
+
"data-ending-style:scale-96 data-ending-style:opacity-0"
|
|
13
|
+
].join(" ");
|
|
14
|
+
/**
|
|
15
|
+
* A short label shown on hover and keyboard focus. Supplementary only: it never
|
|
16
|
+
* appears on touch, so the trigger must have its own accessible name.
|
|
17
|
+
*/
|
|
18
|
+
var Tooltip = (t0) => {
|
|
19
|
+
const $ = c(10);
|
|
20
|
+
const { content, children, side: t1 } = t0;
|
|
21
|
+
const side = t1 === void 0 ? "top" : t1;
|
|
22
|
+
let t2;
|
|
23
|
+
if ($[0] !== children) {
|
|
24
|
+
t2 = /* @__PURE__ */ jsx(Tooltip$1.Trigger, { render: children });
|
|
25
|
+
$[0] = children;
|
|
26
|
+
$[1] = t2;
|
|
27
|
+
} else t2 = $[1];
|
|
28
|
+
let t3;
|
|
29
|
+
if ($[2] !== content) {
|
|
30
|
+
t3 = /* @__PURE__ */ jsx(Tooltip$1.Popup, {
|
|
31
|
+
className: TOOLTIP,
|
|
32
|
+
children: content
|
|
33
|
+
});
|
|
34
|
+
$[2] = content;
|
|
35
|
+
$[3] = t3;
|
|
36
|
+
} else t3 = $[3];
|
|
37
|
+
let t4;
|
|
38
|
+
if ($[4] !== side || $[5] !== t3) {
|
|
39
|
+
t4 = /* @__PURE__ */ jsx(Tooltip$1.Portal, { children: /* @__PURE__ */ jsx(Tooltip$1.Positioner, {
|
|
40
|
+
className: positioner,
|
|
41
|
+
side,
|
|
42
|
+
sideOffset: 8,
|
|
43
|
+
children: t3
|
|
44
|
+
}) });
|
|
45
|
+
$[4] = side;
|
|
46
|
+
$[5] = t3;
|
|
47
|
+
$[6] = t4;
|
|
48
|
+
} else t4 = $[6];
|
|
49
|
+
let t5;
|
|
50
|
+
if ($[7] !== t2 || $[8] !== t4) {
|
|
51
|
+
t5 = /* @__PURE__ */ jsxs(Tooltip$1.Root, { children: [t2, t4] });
|
|
52
|
+
$[7] = t2;
|
|
53
|
+
$[8] = t4;
|
|
54
|
+
$[9] = t5;
|
|
55
|
+
} else t5 = $[9];
|
|
56
|
+
return t5;
|
|
57
|
+
};
|
|
58
|
+
export { TOOLTIP, Tooltip };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ReactElement, ReactNode } from "react";
|
|
2
|
+
interface TooltipGroupTriggerProps {
|
|
3
|
+
content: ReactNode;
|
|
4
|
+
/** The element the tooltip describes. It is the trigger itself, so it keeps its own props. */
|
|
5
|
+
children: ReactElement;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Many triggers, one tooltip: for a table of metrics where every figure explains
|
|
9
|
+
* itself on hover and a tooltip each would mean hundreds of them. Render the
|
|
10
|
+
* group's `Host` once, anywhere under the triggers' page, and wrap each figure in
|
|
11
|
+
* a `Trigger`. Like Tooltip it is supplementary, shown on hover and keyboard focus
|
|
12
|
+
* only, so the figure needs its own accessible name.
|
|
13
|
+
*
|
|
14
|
+
* const metrics = createTooltipGroup(); // once, at module level
|
|
15
|
+
* <metrics.Host />
|
|
16
|
+
* <metrics.Trigger content="Monthly total"><span>0.0</span></metrics.Trigger>
|
|
17
|
+
*/
|
|
18
|
+
export declare const createTooltipGroup: () => {
|
|
19
|
+
Host: () => import("react").JSX.Element;
|
|
20
|
+
Trigger: ({ content, children }: TooltipGroupTriggerProps) => import("react").JSX.Element;
|
|
21
|
+
};
|
|
22
|
+
export {};
|