@15gifts/back-office-kit 0.1.0-alpha.0 → 0.1.0-alpha.1
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/README.md +9 -6
- package/dist/browser/back-office-kit.js +6649 -5932
- package/dist/components/Alert/Alert.css.d.ts +1 -0
- package/dist/components/Alert/Alert.d.ts +12 -2
- package/dist/components/Alert/Alert.js +33 -29
- package/dist/components/Alert/Alert.js.map +1 -1
- package/dist/components/Alert/Alert.styles.js +2 -2
- package/dist/components/Alert/Alert.styles.js.map +1 -1
- package/dist/components/AppShell/AppShell.css.d.ts +2 -0
- package/dist/components/AppShell/AppShell.d.ts +3 -1
- package/dist/components/AppShell/AppShell.js +42 -26
- package/dist/components/AppShell/AppShell.js.map +1 -1
- package/dist/components/AppShell/AppShell.styles.js +3 -2
- package/dist/components/AppShell/AppShell.styles.js.map +1 -1
- package/dist/components/Avatar/Avatar.d.ts +1 -0
- package/dist/components/Avatar/Avatar.js.map +1 -1
- package/dist/components/Badge/Badge.css.d.ts +5 -0
- package/dist/components/Badge/Badge.d.ts +4 -1
- package/dist/components/Badge/Badge.js +6 -5
- package/dist/components/Badge/Badge.js.map +1 -1
- package/dist/components/Badge/Badge.styles.js +16 -15
- package/dist/components/Badge/Badge.styles.js.map +1 -1
- package/dist/components/Breadcrumbs/Breadcrumbs.css.d.ts +2 -0
- package/dist/components/Breadcrumbs/Breadcrumbs.d.ts +2 -0
- package/dist/components/Breadcrumbs/Breadcrumbs.js +27 -27
- package/dist/components/Breadcrumbs/Breadcrumbs.js.map +1 -1
- package/dist/components/Breadcrumbs/Breadcrumbs.styles.js +2 -2
- package/dist/components/Breadcrumbs/Breadcrumbs.styles.js.map +1 -1
- package/dist/components/Button/Button.css.d.ts +1 -1
- package/dist/components/Button/Button.d.ts +5 -4
- package/dist/components/Button/Button.js +21 -21
- package/dist/components/Button/Button.js.map +1 -1
- package/dist/components/Button/Button.styles.js.map +1 -1
- package/dist/components/Card/Card.css.d.ts +2 -0
- package/dist/components/Card/Card.d.ts +7 -1
- package/dist/components/Card/Card.js +33 -22
- package/dist/components/Card/Card.js.map +1 -1
- package/dist/components/Card/Card.styles.js +2 -2
- package/dist/components/Card/Card.styles.js.map +1 -1
- package/dist/components/ChatTranscript/ChatTranscript.d.ts +2 -2
- package/dist/components/ChatTranscript/ChatTranscript.js +74 -71
- package/dist/components/ChatTranscript/ChatTranscript.js.map +1 -1
- package/dist/components/Checkbox/Checkbox.d.ts +2 -1
- package/dist/components/Checkbox/Checkbox.js +30 -34
- package/dist/components/Checkbox/Checkbox.js.map +1 -1
- package/dist/components/Checkbox/Checkbox.styles.js.map +1 -1
- package/dist/components/CheckboxGroup/CheckboxGroup.css.d.ts +2 -0
- package/dist/components/CheckboxGroup/CheckboxGroup.d.ts +28 -0
- package/dist/components/CheckboxGroup/CheckboxGroup.js +66 -0
- package/dist/components/CheckboxGroup/CheckboxGroup.js.map +1 -0
- package/dist/components/CheckboxGroup/CheckboxGroup.styles.js +10 -0
- package/dist/components/CheckboxGroup/CheckboxGroup.styles.js.map +1 -0
- package/dist/components/CheckboxGroup/index.d.ts +2 -0
- package/dist/components/Chip/Chip.css.d.ts +2 -0
- package/dist/components/Chip/Chip.d.ts +15 -3
- package/dist/components/Chip/Chip.js +35 -16
- package/dist/components/Chip/Chip.js.map +1 -1
- package/dist/components/Chip/Chip.styles.js +2 -2
- package/dist/components/Chip/Chip.styles.js.map +1 -1
- package/dist/components/Chip/index.d.ts +1 -1
- package/dist/components/ColorPicker/ColorPicker.d.ts +3 -1
- package/dist/components/ColorPicker/ColorPicker.js +46 -47
- package/dist/components/ColorPicker/ColorPicker.js.map +1 -1
- package/dist/components/ColorPicker/ColorPicker.styles.js.map +1 -1
- package/dist/components/Combobox/Combobox.d.ts +28 -4
- package/dist/components/Combobox/Combobox.js +130 -109
- package/dist/components/Combobox/Combobox.js.map +1 -1
- package/dist/components/CopyButton/CopyButton.d.ts +11 -0
- package/dist/components/CopyButton/CopyButton.js +40 -0
- package/dist/components/CopyButton/CopyButton.js.map +1 -0
- package/dist/components/CopyButton/index.d.ts +2 -0
- package/dist/components/DateRangePicker/DateRangePicker.d.ts +10 -3
- package/dist/components/DateRangePicker/DateRangePicker.js +107 -110
- package/dist/components/DateRangePicker/DateRangePicker.js.map +1 -1
- package/dist/components/DateRangePicker/DateRangePicker.styles.js +2 -2
- package/dist/components/DateRangePicker/DateRangePicker.styles.js.map +1 -1
- package/dist/components/DateTimeInput/DateTimeInput.d.ts +1 -1
- package/dist/components/DateTimeInput/DateTimeInput.js +20 -28
- package/dist/components/DateTimeInput/DateTimeInput.js.map +1 -1
- package/dist/components/DateTimeInput/DateTimeInput.styles.js +1 -0
- package/dist/components/DescriptionList/DescriptionList.d.ts +8 -0
- package/dist/components/DescriptionList/DescriptionList.js +2 -1
- package/dist/components/DescriptionList/DescriptionList.js.map +1 -1
- package/dist/components/DetailsSummary/DetailsSummary.css.d.ts +1 -0
- package/dist/components/DetailsSummary/DetailsSummary.d.ts +5 -1
- package/dist/components/DetailsSummary/DetailsSummary.js +15 -15
- package/dist/components/DetailsSummary/DetailsSummary.js.map +1 -1
- package/dist/components/DetailsSummary/DetailsSummary.styles.js +10 -2
- package/dist/components/DetailsSummary/DetailsSummary.styles.js.map +1 -1
- package/dist/components/DetailsSummary/index.d.ts +1 -1
- package/dist/components/Drawer/Drawer.css.d.ts +3 -0
- package/dist/components/Drawer/Drawer.d.ts +24 -3
- package/dist/components/Drawer/Drawer.js +55 -46
- package/dist/components/Drawer/Drawer.js.map +1 -1
- package/dist/components/Drawer/Drawer.styles.js +7 -2
- package/dist/components/Drawer/Drawer.styles.js.map +1 -1
- package/dist/components/EmptyState/EmptyState.css.d.ts +16 -0
- package/dist/components/EmptyState/EmptyState.d.ts +15 -0
- package/dist/components/EmptyState/EmptyState.js +37 -0
- package/dist/components/EmptyState/EmptyState.js.map +1 -0
- package/dist/components/EmptyState/EmptyState.styles.js +15 -0
- package/dist/components/EmptyState/EmptyState.styles.js.map +1 -0
- package/dist/components/EmptyState/index.d.ts +2 -0
- package/dist/components/EnvironmentChip/EnvironmentChip.css.d.ts +5 -0
- package/dist/components/EnvironmentChip/EnvironmentChip.d.ts +13 -5
- package/dist/components/EnvironmentChip/EnvironmentChip.js +14 -3
- package/dist/components/EnvironmentChip/EnvironmentChip.js.map +1 -1
- package/dist/components/EnvironmentChip/EnvironmentChip.styles.js +3 -2
- package/dist/components/EnvironmentChip/EnvironmentChip.styles.js.map +1 -1
- package/dist/components/EnvironmentChip/index.d.ts +2 -2
- package/dist/components/Field/Field.css.d.ts +0 -1
- package/dist/components/Field/Field.d.ts +11 -28
- package/dist/components/Field/Field.js +25 -36
- package/dist/components/Field/Field.js.map +1 -1
- package/dist/components/Field/Field.styles.js +2 -2
- package/dist/components/Field/Field.styles.js.map +1 -1
- package/dist/components/Field/index.d.ts +1 -1
- package/dist/components/Fieldset/Fieldset.d.ts +1 -0
- package/dist/components/Fieldset/Fieldset.js.map +1 -1
- package/dist/components/Fieldset/Fieldset.styles.js.map +1 -1
- package/dist/components/Grid/Grid.css.d.ts +22 -0
- package/dist/components/Grid/Grid.d.ts +21 -0
- package/dist/components/Grid/Grid.js +23 -0
- package/dist/components/Grid/Grid.js.map +1 -0
- package/dist/components/Grid/Grid.styles.js +28 -0
- package/dist/components/Grid/Grid.styles.js.map +1 -0
- package/dist/components/Grid/index.d.ts +2 -0
- package/dist/components/List/List.d.ts +1 -0
- package/dist/components/List/List.js.map +1 -1
- package/dist/components/Loader/Loader.d.ts +1 -1
- package/dist/components/Loader/Loader.js +6 -2
- package/dist/components/Loader/Loader.js.map +1 -1
- package/dist/components/Menu/Menu.d.ts +25 -1
- package/dist/components/Menu/Menu.js +1 -1
- package/dist/components/Menu/Menu.js.map +1 -1
- package/dist/components/Menu/Menu.styles.js.map +1 -1
- package/dist/components/MetricBar/MetricBar.css.d.ts +5 -0
- package/dist/components/MetricBar/MetricBar.d.ts +9 -1
- package/dist/components/MetricBar/MetricBar.js +38 -22
- package/dist/components/MetricBar/MetricBar.js.map +1 -1
- package/dist/components/MetricBar/MetricBar.styles.js +15 -10
- package/dist/components/MetricBar/MetricBar.styles.js.map +1 -1
- package/dist/components/Modal/Modal.d.ts +6 -0
- package/dist/components/Modal/Modal.js +25 -28
- package/dist/components/Modal/Modal.js.map +1 -1
- package/dist/components/Modal/Modal.styles.js +2 -1
- package/dist/components/Modal/Modal.styles.js.map +1 -1
- package/dist/components/NavRail/NavRail.css.d.ts +2 -0
- package/dist/components/NavRail/NavRail.d.ts +22 -7
- package/dist/components/NavRail/NavRail.js +79 -58
- package/dist/components/NavRail/NavRail.js.map +1 -1
- package/dist/components/NavRail/NavRail.styles.js +3 -2
- package/dist/components/NavRail/NavRail.styles.js.map +1 -1
- package/dist/components/NavRail/index.d.ts +1 -1
- package/dist/components/NumberInput/NumberInput.d.ts +9 -1
- package/dist/components/NumberInput/NumberInput.js +37 -31
- package/dist/components/NumberInput/NumberInput.js.map +1 -1
- package/dist/components/PageHeader/PageHeader.css.d.ts +1 -1
- package/dist/components/PageHeader/PageHeader.d.ts +3 -1
- package/dist/components/PageHeader/PageHeader.js +21 -23
- package/dist/components/PageHeader/PageHeader.js.map +1 -1
- package/dist/components/PageHeader/PageHeader.styles.js +1 -1
- package/dist/components/PageHeader/PageHeader.styles.js.map +1 -1
- package/dist/components/Pagination/Pagination.d.ts +5 -0
- package/dist/components/Pagination/Pagination.js.map +1 -1
- package/dist/components/Popover/Popover.d.ts +9 -1
- package/dist/components/Popover/Popover.js +7 -6
- package/dist/components/Popover/Popover.js.map +1 -1
- package/dist/components/Popover/Popover.styles.js.map +1 -1
- package/dist/components/PortalContainer/PortalContainer.d.ts +1 -0
- package/dist/components/PortalContainer/PortalContainer.js.map +1 -1
- package/dist/components/ProgressBar/ProgressBar.css.d.ts +3 -0
- package/dist/components/ProgressBar/ProgressBar.d.ts +5 -1
- package/dist/components/ProgressBar/ProgressBar.js +21 -7
- package/dist/components/ProgressBar/ProgressBar.js.map +1 -1
- package/dist/components/ProgressBar/ProgressBar.styles.js +6 -6
- package/dist/components/ProgressBar/ProgressBar.styles.js.map +1 -1
- package/dist/components/RadioCards/RadioCards.d.ts +8 -2
- package/dist/components/RadioCards/RadioCards.js +40 -44
- package/dist/components/RadioCards/RadioCards.js.map +1 -1
- package/dist/components/SaveBar/SaveBar.d.ts +6 -1
- package/dist/components/SaveBar/SaveBar.js +1 -2
- package/dist/components/SaveBar/SaveBar.js.map +1 -1
- package/dist/components/SaveBar/SaveBar.styles.js.map +1 -1
- package/dist/components/Select/Select.css.d.ts +2 -0
- package/dist/components/Select/Select.d.ts +32 -5
- package/dist/components/Select/Select.js +91 -62
- package/dist/components/Select/Select.js.map +1 -1
- package/dist/components/Select/Select.styles.js +3 -2
- package/dist/components/Select/Select.styles.js.map +1 -1
- package/dist/components/Skeleton/Skeleton.d.ts +2 -0
- package/dist/components/Skeleton/Skeleton.js +20 -19
- package/dist/components/Skeleton/Skeleton.js.map +1 -1
- package/dist/components/Stack/Stack.css.d.ts +4 -1
- package/dist/components/Stack/Stack.d.ts +7 -3
- package/dist/components/Stack/Stack.js.map +1 -1
- package/dist/components/Stack/Stack.styles.js +16 -23
- package/dist/components/Stack/Stack.styles.js.map +1 -1
- package/dist/components/StatCard/StatCard.d.ts +3 -0
- package/dist/components/StatCard/StatCard.js.map +1 -1
- package/dist/components/StatCard/StatCard.styles.js.map +1 -1
- package/dist/components/StatsGrid/StatsGrid.d.ts +3 -6
- package/dist/components/StatsGrid/StatsGrid.js +3 -7
- package/dist/components/StatsGrid/StatsGrid.js.map +1 -1
- package/dist/components/StatusBadge/StatusBadge.d.ts +3 -2
- package/dist/components/StatusBadge/StatusBadge.js.map +1 -1
- package/dist/components/Switch/Switch.d.ts +2 -1
- package/dist/components/Switch/Switch.js +27 -31
- package/dist/components/Switch/Switch.js.map +1 -1
- package/dist/components/Switcher/Switcher.css.d.ts +0 -1
- package/dist/components/Switcher/Switcher.d.ts +13 -1
- package/dist/components/Switcher/Switcher.js +35 -35
- package/dist/components/Switcher/Switcher.js.map +1 -1
- package/dist/components/Switcher/Switcher.styles.js +2 -2
- package/dist/components/Switcher/Switcher.styles.js.map +1 -1
- package/dist/components/Table/Table.css.d.ts +16 -1
- package/dist/components/Table/Table.d.ts +110 -13
- package/dist/components/Table/Table.js +214 -102
- package/dist/components/Table/Table.js.map +1 -1
- package/dist/components/Table/Table.styles.js +7 -6
- package/dist/components/Table/Table.styles.js.map +1 -1
- package/dist/components/Table/index.d.ts +1 -1
- package/dist/components/Tabs/Tabs.d.ts +23 -8
- package/dist/components/Tabs/Tabs.js +1 -1
- package/dist/components/Tabs/Tabs.js.map +1 -1
- package/dist/components/Tabs/Tabs.styles.js.map +1 -1
- package/dist/components/Tabs/index.d.ts +1 -1
- package/dist/components/Tag/Tag.css.d.ts +33 -0
- package/dist/components/Tag/Tag.d.ts +5 -2
- package/dist/components/Tag/Tag.js +23 -6
- package/dist/components/Tag/Tag.js.map +1 -1
- package/dist/components/Tag/Tag.styles.js +12 -1
- package/dist/components/Tag/Tag.styles.js.map +1 -1
- package/dist/components/Tag/index.d.ts +1 -1
- package/dist/components/TextInput/TextInput.d.ts +13 -2
- package/dist/components/TextInput/TextInput.js +45 -48
- package/dist/components/TextInput/TextInput.js.map +1 -1
- package/dist/components/Textarea/Textarea.css.d.ts +2 -0
- package/dist/components/Textarea/Textarea.d.ts +5 -2
- package/dist/components/Textarea/Textarea.js +37 -37
- package/dist/components/Textarea/Textarea.js.map +1 -1
- package/dist/components/Textarea/Textarea.styles.js +3 -2
- package/dist/components/Textarea/Textarea.styles.js.map +1 -1
- package/dist/components/ThemeMenu/ThemeMenu.d.ts +13 -0
- package/dist/components/ThemeMenu/ThemeMenu.js +52 -0
- package/dist/components/ThemeMenu/ThemeMenu.js.map +1 -0
- package/dist/components/ThemeMenu/index.d.ts +2 -0
- package/dist/components/ThemePicker/ThemePicker.d.ts +9 -1
- package/dist/components/ThemePicker/ThemePicker.js +3 -1
- package/dist/components/ThemePicker/ThemePicker.js.map +1 -1
- package/dist/components/TimeInput/TimeInput.d.ts +10 -0
- package/dist/components/TimeInput/TimeInput.js +29 -0
- package/dist/components/TimeInput/TimeInput.js.map +1 -0
- package/dist/components/TimeInput/index.d.ts +2 -0
- package/dist/components/ToggleGroup/ToggleGroup.d.ts +30 -10
- package/dist/components/ToggleGroup/ToggleGroup.js +60 -59
- package/dist/components/ToggleGroup/ToggleGroup.js.map +1 -1
- package/dist/components/ToggleGroup/ToggleGroup.styles.js.map +1 -1
- package/dist/components/ToggleGroup/index.d.ts +1 -1
- package/dist/components/Tooltip/Tooltip.css.d.ts +0 -1
- package/dist/components/Tooltip/Tooltip.d.ts +9 -5
- package/dist/components/Tooltip/Tooltip.js +9 -9
- package/dist/components/Tooltip/Tooltip.js.map +1 -1
- package/dist/components/Tooltip/Tooltip.styles.js +2 -2
- package/dist/components/Tooltip/Tooltip.styles.js.map +1 -1
- package/dist/components/TopBar/TopBar.styles.js.map +1 -1
- package/dist/components/UserMenu/UserMenu.d.ts +4 -3
- package/dist/components/UserMenu/UserMenu.js.map +1 -1
- package/dist/examples/Crm.css.d.ts +3 -0
- package/dist/examples/ExampleShell.d.ts +28 -0
- package/dist/examples/Expenses.css.d.ts +2 -0
- package/dist/examples/HiringTracker.css.d.ts +13 -0
- package/dist/examples/SalesPipeline.css.d.ts +11 -0
- package/dist/foundations/Foundations.css.d.ts +1 -1
- package/dist/index.d.ts +6 -0
- package/dist/index.js +51 -45
- package/dist/styles/input.css.d.ts +8 -0
- package/dist/styles/input.styles.js +3 -2
- package/dist/styles/input.styles.js.map +1 -1
- package/dist/styles/shared.css.d.ts +5 -0
- package/dist/styles/shared.styles.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/theme/fontSize.d.ts +4 -4
- package/dist/theme/fontSize.js +8 -23
- package/dist/theme/fontSize.js.map +1 -1
- package/dist/theme/htmlSetting.d.ts +14 -0
- package/dist/theme/htmlSetting.js +33 -0
- package/dist/theme/htmlSetting.js.map +1 -0
- package/dist/theme/theme.d.ts +4 -4
- package/dist/theme/theme.js +18 -33
- package/dist/theme/theme.js.map +1 -1
- package/dist/tokens/index.d.ts +0 -2
- package/dist/tokens.js +1 -2
- package/package.json +6 -2
- package/skills/back-office-kit/SKILL.md +27 -14
- package/skills/back-office-kit/references/artifact-template.html +1 -0
- package/skills/back-office-kit/references/components.md +482 -251
- package/skills/back-office-kit/references/install.md +27 -4
- package/skills/back-office-kit/references/migrate.md +58 -2
- package/skills/back-office-kit/references/patterns.md +129 -33
- package/skills/back-office-kit/references/testing.md +26 -22
- package/dist/tokens/sprinkles.css.d.ts +0 -38
- package/dist/tokens/sprinkles.styles.js +0 -349
- package/dist/tokens/sprinkles.styles.js.map +0 -1
|
@@ -1,24 +1,51 @@
|
|
|
1
1
|
import { Select as BaseSelect } from '@base-ui/react/select';
|
|
2
|
-
import { Ref } from 'react';
|
|
2
|
+
import { ReactNode, Ref } from 'react';
|
|
3
3
|
import { FieldBaseProps, FieldOptionProps, PartProps } from '../Field/Field';
|
|
4
4
|
import { PortalContainerTarget } from '../PortalContainer';
|
|
5
5
|
export interface SelectOption {
|
|
6
|
+
/**
|
|
7
|
+
* What `value` and `onValueChange` use. Unique within the options. `''` works as a real choice
|
|
8
|
+
* (e.g. "All sites"), but like a native `<select>` it doesn't satisfy `required`.
|
|
9
|
+
*/
|
|
6
10
|
value: string;
|
|
11
|
+
/** The text shown in the list and, once picked, in the trigger. Typeahead matches it. */
|
|
7
12
|
label: string;
|
|
13
|
+
/** A muted line under the label in the list. Screen readers announce it as the option's description. */
|
|
14
|
+
description?: ReactNode;
|
|
15
|
+
/** Muted text at the end of the row, e.g. "32–50 wpm". Also part of the option's description. */
|
|
16
|
+
detail?: ReactNode;
|
|
17
|
+
/** Shown but can't be picked. */
|
|
8
18
|
disabled?: boolean;
|
|
9
19
|
}
|
|
10
|
-
export interface SelectProps extends FieldBaseProps, FieldOptionProps, Omit<BaseSelect.Root.Props<string>, 'children' | 'items' | 'multiple' | 'inputRef' | 'value' | 'defaultValue' | 'onValueChange'> {
|
|
20
|
+
export interface SelectProps extends FieldBaseProps, FieldOptionProps, Omit<BaseSelect.Root.Props<string>, 'children' | 'items' | 'multiple' | 'inputRef' | 'value' | 'defaultValue' | 'onValueChange' | 'isItemEqualToValue' | 'itemToStringLabel' | 'itemToStringValue'> {
|
|
21
|
+
/** The choices, in order. */
|
|
11
22
|
options: SelectOption[];
|
|
12
|
-
/** Shown while nothing is selected. */
|
|
23
|
+
/** Shown while nothing is selected, or when `value` matches no option. */
|
|
13
24
|
placeholder?: string;
|
|
25
|
+
/**
|
|
26
|
+
* The picked option's `value`, or `null` for none. Use with `onValueChange` to control it.
|
|
27
|
+
* A value that matches no option shows the placeholder.
|
|
28
|
+
*/
|
|
14
29
|
value?: string | null;
|
|
30
|
+
/** The initially picked option's `value`, when uncontrolled. */
|
|
15
31
|
defaultValue?: string | null;
|
|
16
|
-
/**
|
|
32
|
+
/**
|
|
33
|
+
* Called when the value changes. Re-picking the current option doesn't call it. Picking from
|
|
34
|
+
* the list always gives an option's `value`; `null` only comes from a form reset back to an
|
|
35
|
+
* empty initial value, so with a picked initial value it's safe to treat it as a `string`.
|
|
36
|
+
*/
|
|
17
37
|
onValueChange?: (value: string | null) => void;
|
|
38
|
+
/** What the trigger shows for the picked option (`null` when none matches). Defaults to its `label`, else the placeholder. */
|
|
39
|
+
renderValue?: (option: SelectOption | null) => ReactNode;
|
|
40
|
+
/** Width of the dropdown when it should be wider than the field, e.g. `'24rem'`. Never narrower than the field. */
|
|
41
|
+
popupWidth?: string;
|
|
18
42
|
/** Where the dropdown renders. Defaults to the nearest `PortalContainer`, else `document.body`. */
|
|
19
43
|
portalContainer?: PortalContainerTarget;
|
|
44
|
+
/** Goes on the trigger button, so `<label htmlFor>` and `getElementById(id).focus()` work. */
|
|
45
|
+
id?: string;
|
|
20
46
|
/** Forwarded to the hidden input that holds the value (for form libraries). */
|
|
21
47
|
ref?: Ref<HTMLInputElement>;
|
|
48
|
+
/** Goes on the field's root element. */
|
|
22
49
|
className?: string;
|
|
23
50
|
/** Props for the trigger button (role `combobox`), e.g. `{ 'data-testid': 'plan-select' }`. */
|
|
24
51
|
triggerProps?: PartProps<BaseSelect.Trigger.Props>;
|
|
@@ -26,4 +53,4 @@ export interface SelectProps extends FieldBaseProps, FieldOptionProps, Omit<Base
|
|
|
26
53
|
popupProps?: PartProps<BaseSelect.Popup.Props>;
|
|
27
54
|
}
|
|
28
55
|
/** Single-choice dropdown with a label. */
|
|
29
|
-
export declare function Select({ label, description, error, required,
|
|
56
|
+
export declare function Select({ label, description, error, required, hideLabel, fieldProps, disabled, className, options, placeholder, value, defaultValue, onValueChange, renderValue, popupWidth, portalContainer, ref, triggerProps, popupProps, ...props }: SelectProps): import('react').JSX.Element;
|
|
@@ -1,82 +1,111 @@
|
|
|
1
|
-
import { icon as e,
|
|
2
|
-
import { option as
|
|
3
|
-
import { Field as
|
|
1
|
+
import { icon as e, placeholder as t, trigger as n, value as r } from "./Select.styles.js";
|
|
2
|
+
import { list as i, option as a, optionBody as o, optionIndicator as s, popup as c, positioner as l } from "../../styles/input.styles.js";
|
|
3
|
+
import { Field as u, FieldLabelText as d, labelClass as f } from "../Field/Field.js";
|
|
4
4
|
import "../Field/Field.styles.js";
|
|
5
|
-
import { usePortalContainer as
|
|
6
|
-
import { useRef as
|
|
7
|
-
import { clsx as
|
|
8
|
-
import { Check as
|
|
9
|
-
import { jsx as
|
|
10
|
-
import { Select as
|
|
5
|
+
import { usePortalContainer as p } from "../PortalContainer/PortalContainer.js";
|
|
6
|
+
import { useId as m, useRef as h } from "react";
|
|
7
|
+
import { clsx as g } from "clsx";
|
|
8
|
+
import { Check as _, ChevronDown as v } from "lucide-react";
|
|
9
|
+
import { jsx as y, jsxs as b } from "react/jsx-runtime";
|
|
10
|
+
import { Select as x } from "@base-ui/react/select";
|
|
11
11
|
// src/components/Select/Select.tsx
|
|
12
|
-
function
|
|
13
|
-
let
|
|
14
|
-
return /* @__PURE__ */
|
|
12
|
+
function S({ label: S, description: C, error: w, required: T, hideLabel: E, fieldProps: D, disabled: O, className: k, options: A, placeholder: j = "Select an option", value: M, defaultValue: N, onValueChange: P, renderValue: F, popupWidth: I, portalContainer: L, ref: R, triggerProps: z, popupProps: B, ...V }) {
|
|
13
|
+
let H = p(L), U = m(), W = h(M ?? N ?? null), G = A.some((e) => e.value === ""), K = (e) => e === "" && G ? null : e, q = (e) => e === null && G ? "" : e, J = (e) => A.find((t) => t.value === q(e));
|
|
14
|
+
return /* @__PURE__ */ y(u, {
|
|
15
15
|
...D,
|
|
16
|
-
description:
|
|
17
|
-
error:
|
|
16
|
+
description: C,
|
|
17
|
+
error: w,
|
|
18
18
|
disabled: O,
|
|
19
|
-
className:
|
|
20
|
-
children: /* @__PURE__ */
|
|
21
|
-
...
|
|
22
|
-
|
|
23
|
-
required: S,
|
|
19
|
+
className: g(D?.className, k),
|
|
20
|
+
children: /* @__PURE__ */ b(x.Root, {
|
|
21
|
+
...V,
|
|
22
|
+
required: T,
|
|
24
23
|
disabled: O,
|
|
25
|
-
value: M,
|
|
26
|
-
defaultValue: N,
|
|
27
|
-
inputRef:
|
|
24
|
+
value: K(M),
|
|
25
|
+
defaultValue: K(N),
|
|
26
|
+
inputRef: R,
|
|
28
27
|
onValueChange: (e) => {
|
|
29
|
-
let t = M === void 0 ?
|
|
30
|
-
|
|
28
|
+
let t = q(e), n = M === void 0 ? W.current : M;
|
|
29
|
+
W.current = t, t !== n && P?.(t);
|
|
31
30
|
},
|
|
32
31
|
children: [
|
|
33
|
-
|
|
34
|
-
className:
|
|
35
|
-
children: /* @__PURE__ */
|
|
36
|
-
label:
|
|
37
|
-
required:
|
|
38
|
-
showRequired: C,
|
|
39
|
-
requiredIndicator: w,
|
|
40
|
-
optionalText: T
|
|
32
|
+
S != null && /* @__PURE__ */ y(x.Label, {
|
|
33
|
+
className: f("oe0y262", E),
|
|
34
|
+
children: /* @__PURE__ */ y(d, {
|
|
35
|
+
label: S,
|
|
36
|
+
required: T
|
|
41
37
|
})
|
|
42
38
|
}),
|
|
43
|
-
/* @__PURE__ */
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
39
|
+
/* @__PURE__ */ b(x.Trigger, {
|
|
40
|
+
...z,
|
|
41
|
+
className: g(n, z?.className),
|
|
42
|
+
children: [/* @__PURE__ */ y(x.Value, {
|
|
43
|
+
className: r,
|
|
44
|
+
children: (e) => {
|
|
45
|
+
let n = J(e) ?? null;
|
|
46
|
+
return F ? F(n) : n ? n.label : /* @__PURE__ */ y("span", {
|
|
47
|
+
className: t,
|
|
48
|
+
children: j
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
}), /* @__PURE__ */ y(x.Icon, {
|
|
51
52
|
className: e,
|
|
52
|
-
children: /* @__PURE__ */
|
|
53
|
+
children: /* @__PURE__ */ y(v, {
|
|
53
54
|
size: "1.125em",
|
|
54
55
|
"aria-hidden": !0
|
|
55
56
|
})
|
|
56
57
|
})]
|
|
57
58
|
}),
|
|
58
|
-
/* @__PURE__ */
|
|
59
|
-
container:
|
|
60
|
-
children: /* @__PURE__ */
|
|
61
|
-
className:
|
|
62
|
-
positionMethod:
|
|
59
|
+
/* @__PURE__ */ y(x.Portal, {
|
|
60
|
+
container: H,
|
|
61
|
+
children: /* @__PURE__ */ y(x.Positioner, {
|
|
62
|
+
className: l,
|
|
63
|
+
positionMethod: H ? "fixed" : "absolute",
|
|
63
64
|
sideOffset: 4,
|
|
64
65
|
alignItemWithTrigger: !1,
|
|
65
|
-
children: /* @__PURE__ */
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
66
|
+
children: /* @__PURE__ */ y(x.Popup, {
|
|
67
|
+
style: I ? { width: I } : void 0,
|
|
68
|
+
...B,
|
|
69
|
+
className: g(c, B?.className),
|
|
70
|
+
children: /* @__PURE__ */ y(x.List, {
|
|
71
|
+
className: i,
|
|
72
|
+
children: A.map((e, t) => {
|
|
73
|
+
let n = `${U}-${t}`, r = e.description != null || e.detail != null;
|
|
74
|
+
return /* @__PURE__ */ b(x.Item, {
|
|
75
|
+
value: K(e.value),
|
|
76
|
+
label: e.label,
|
|
77
|
+
disabled: e.disabled,
|
|
78
|
+
className: a,
|
|
79
|
+
"aria-labelledby": r ? `${n}-label` : void 0,
|
|
80
|
+
"aria-describedby": r ? g(e.description != null && `${n}-description`, e.detail != null && `${n}-detail`) : void 0,
|
|
81
|
+
children: [
|
|
82
|
+
/* @__PURE__ */ b("span", {
|
|
83
|
+
className: o,
|
|
84
|
+
children: [/* @__PURE__ */ y(x.ItemText, {
|
|
85
|
+
id: `${n}-label`,
|
|
86
|
+
children: e.label
|
|
87
|
+
}), e.description != null && /* @__PURE__ */ y("span", {
|
|
88
|
+
id: `${n}-description`,
|
|
89
|
+
className: "_12aoxdma",
|
|
90
|
+
children: e.description
|
|
91
|
+
})]
|
|
92
|
+
}),
|
|
93
|
+
e.detail != null && /* @__PURE__ */ y("span", {
|
|
94
|
+
id: `${n}-detail`,
|
|
95
|
+
className: "_12aoxdmb",
|
|
96
|
+
children: e.detail
|
|
97
|
+
}),
|
|
98
|
+
/* @__PURE__ */ y(x.ItemIndicator, {
|
|
99
|
+
className: s,
|
|
100
|
+
children: /* @__PURE__ */ y(_, {
|
|
101
|
+
size: "1.14em",
|
|
102
|
+
"aria-hidden": !0
|
|
103
|
+
})
|
|
104
|
+
})
|
|
105
|
+
]
|
|
106
|
+
}, e.value);
|
|
107
|
+
})
|
|
108
|
+
})
|
|
80
109
|
})
|
|
81
110
|
})
|
|
82
111
|
})
|
|
@@ -84,6 +113,6 @@ function y({ label: y, description: b, error: x, required: S, showRequired: C, r
|
|
|
84
113
|
})
|
|
85
114
|
});
|
|
86
115
|
}
|
|
87
|
-
export {
|
|
116
|
+
export { S as Select };
|
|
88
117
|
|
|
89
118
|
//# sourceMappingURL=Select.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Select.js","names":["Select","value","BaseSelect","label","styles.trigger","styles.value","styles.icon","input.positioner","input.popup","option","input.option","input.optionIndicator","Select$1","label$1","value$1","props","container","usePortalContainer","portalContainer","lastValue","useRef","defaultValue","Field","fieldProps","clsx","className","Select","options","ref","current","next","onValueChange","labelClass","hideLabel","FieldLabelText","ariaRequired","required","showRequired","triggerProps","trigger","value","icon","ChevronDown","positioner","popupProps","popup","option$1","option","optionIndicator","Check"],"sources":["../../../src/components/Select/Select.tsx"],"sourcesContent":["import { Select as BaseSelect } from '@base-ui/react/select'\nimport { clsx } from 'clsx'\nimport { Check, ChevronDown } from 'lucide-react'\nimport { useRef, type Ref } from 'react'\n\nimport * as styles from './Select.css'\nimport * as input from '../../styles/input.css'\nimport {\n ariaRequired,\n Field,\n FieldLabelText,\n labelClass,\n type FieldBaseProps,\n type FieldOptionProps,\n type PartProps,\n} from '../Field/Field'\nimport * as fieldStyles from '../Field/Field.css'\nimport { usePortalContainer, type PortalContainerTarget } from '../PortalContainer'\n\nexport interface SelectOption {\n value: string\n label: string\n disabled?: boolean\n}\n\nexport interface SelectProps\n extends\n FieldBaseProps,\n FieldOptionProps,\n Omit<\n BaseSelect.Root.Props<string>,\n 'children' | 'items' | 'multiple' | 'inputRef' | 'value' | 'defaultValue' | 'onValueChange'\n > {\n options: SelectOption[]\n /** Shown while nothing is selected. */\n placeholder?: string\n value?: string | null\n defaultValue?: string | null\n /** Called when the value changes. Re-picking the current option doesn't call it. */\n onValueChange?: (value: string | null) => void\n /** Where the dropdown renders. Defaults to the nearest `PortalContainer`, else `document.body`. */\n portalContainer?: PortalContainerTarget\n /** Forwarded to the hidden input that holds the value (for form libraries). */\n ref?: Ref<HTMLInputElement>\n className?: string\n /** Props for the trigger button (role `combobox`), e.g. `{ 'data-testid': 'plan-select' }`. */\n triggerProps?: PartProps<BaseSelect.Trigger.Props>\n /** Props for the dropdown (role `listbox`), e.g. `{ 'data-testid': 'plan-options' }`. */\n popupProps?: PartProps<BaseSelect.Popup.Props>\n}\n\n/** Single-choice dropdown with a label. */\nexport function Select({\n label,\n description,\n error,\n required,\n showRequired,\n requiredIndicator,\n optionalText,\n hideLabel,\n fieldProps,\n disabled,\n className,\n options,\n placeholder = 'Select an option',\n value,\n defaultValue,\n onValueChange,\n portalContainer,\n ref,\n triggerProps,\n popupProps,\n ...props\n}: SelectProps) {\n const container = usePortalContainer(portalContainer)\n // Uncontrolled value, so a re-pick of the current option can be ignored.\n const lastValue = useRef(value ?? defaultValue ?? null)\n return (\n <Field\n {...fieldProps}\n description={description}\n error={error}\n disabled={disabled}\n className={clsx(fieldProps?.className, className)}\n >\n <BaseSelect.Root\n {...props}\n items={options}\n required={required}\n disabled={disabled}\n value={value}\n defaultValue={defaultValue}\n inputRef={ref}\n onValueChange={(next) => {\n const current = value !== undefined ? value : lastValue.current\n lastValue.current = next\n if (next !== current) onValueChange?.(next)\n }}\n >\n {label != null && (\n <BaseSelect.Label className={labelClass(fieldStyles.label, hideLabel)}>\n <FieldLabelText\n label={label}\n required={required}\n showRequired={showRequired}\n requiredIndicator={requiredIndicator}\n optionalText={optionalText}\n />\n </BaseSelect.Label>\n )}\n <BaseSelect.Trigger\n aria-required={ariaRequired(required, showRequired)}\n {...triggerProps}\n className={clsx(styles.trigger, triggerProps?.className)}\n >\n <BaseSelect.Value className={styles.value} placeholder={placeholder} />\n <BaseSelect.Icon className={styles.icon}>\n <ChevronDown size=\"1.125em\" aria-hidden />\n </BaseSelect.Icon>\n </BaseSelect.Trigger>\n <BaseSelect.Portal container={container}>\n <BaseSelect.Positioner\n className={input.positioner}\n positionMethod={container ? 'fixed' : 'absolute'}\n sideOffset={4}\n alignItemWithTrigger={false}\n >\n <BaseSelect.Popup {...popupProps} className={clsx(input.popup, popupProps?.className)}>\n <BaseSelect.List>\n {options.map((option) => (\n <BaseSelect.Item\n key={option.value}\n value={option.value}\n disabled={option.disabled}\n className={input.option}\n >\n <BaseSelect.ItemText>{option.label}</BaseSelect.ItemText>\n <BaseSelect.ItemIndicator className={input.optionIndicator}>\n <Check size=\"1.14em\" aria-hidden />\n </BaseSelect.ItemIndicator>\n </BaseSelect.Item>\n ))}\n </BaseSelect.List>\n </BaseSelect.Popup>\n </BaseSelect.Positioner>\n </BaseSelect.Portal>\n </BaseSelect.Root>\n </Field>\n )\n}\n"],"mappings":";;;;;;;;;;;AAoDA,SAAgBA,EAAO,EACrB,OAAAa,GACA,gBACA,UACA,aACA,iBACA,sBACA,iBACA,cACA,eACA,aACA,cACA,YACA,iBAAc,oBACd,OAAAC,GACA,iBACA,kBACA,oBACA,QACA,iBACA,eACA,GAAGC,KACW;CACd,IAAMC,IAAYC,EAAmBC,CAAe,GAE9CC,IAAYC,EAAOnB,KAASoB,KAAgB,IAAI;CACtD,OACE,kBAACC,GAAD;EACE,GAAIC;EACS;EACN;EACG;EACV,WAAWC,EAAKD,GAAY,WAAWE,CAAS;EAEhD,UAAA,kBAACvB,EAAW,MAAZ;GACE,GAAIa;GACJ,OAAOY;GACG;GACA;GACH,OAAAb;GACO;GACd,UAAUc;GACV,gBAAgB,MAAS;IACvB,IAAMC,IAAU5B,MAAU,KAAA,IAAoBkB,EAAU,UAAlBlB;IAEtC,AADA,EAAU,UAAU6B,GAChBA,MAASD,KAASE,IAAgBD,CAAI;GAC5C;GAZF,UAAA;IAcG3B,KAAS,QACR,kBAACD,EAAW,OAAZ;KAAkB,WAAW8B,EAAW,WAAmBC,CAAS;KAClE,UAAA,kBAACC,GAAD;MACS,OAAArB;MACG;MACI;MACK;MACL;KACf,CAAA;IACe,CAAA;IAEpB,kBAACX,EAAW,SAAZ;KACE,iBAAeiC,EAAaC,GAAUC,CAAY;KAClD,GAAIC;KACJ,WAAWd,EAAKpB,GAAgBkC,GAAc,SAAS;KAHzD,UAAA,CAKE,kBAACpC,EAAW,OAAZ;MAAkB,WAAWG;MAA2B;KAAc,CAAA,GACtE,kBAACH,EAAW,MAAZ;MAAiB,WAAWI;MAC1B,UAAA,kBAACoC,GAAD;OAAa,MAAK;OAAU,eAAA;MAAa,CAAA;KAC1B,CAAA,CACC;;IACpB,kBAACxC,EAAW,QAAZ;KAA8B;KAC5B,UAAA,kBAACA,EAAW,YAAZ;MACE,WAAWK;MACX,gBAAgBS,IAAY,UAAU;MACtC,YAAY;MACZ,sBAAsB;MAEtB,UAAA,kBAACd,EAAW,OAAZ;OAAkB,GAAI0C;OAAY,WAAWpB,EAAKhB,GAAaoC,GAAY,SAAS;OAClF,UAAA,kBAAC1C,EAAW,MAAZ,EAAA,UACGyB,EAAQ,KAAK,MACZ,kBAACzB,EAAW,MAAZ;QAEE,OAAOO,EAAO;QACd,UAAUA,EAAO;QACjB,WAAWC;QAJb,UAAA,CAME,kBAACR,EAAW,UAAZ,EAAA,UAAsBO,EAAO,MAA2B,CAAA,GACxD,kBAACP,EAAW,eAAZ;SAA0B,WAAWS;SACnC,UAAA,kBAACsC,GAAD;UAAO,MAAK;UAAS,eAAA;SAAa,CAAA;QACV,CAAA,CACX;OATV,GAAAxC,EAAO,KASG,CAClB,EACc,CAAA;MACD,CAAA;KACG,CAAA;IACN,CAAA;GACJ;;CACZ,CAAA;AAEX"}
|
|
1
|
+
{"version":3,"file":"Select.js","names":["Select","value","BaseSelect","label","styles.trigger","styles.value","styles.placeholder","placeholder","styles.icon","input.positioner","input.popup","input.list","option","input.option","input.optionBody","input.optionIndicator","Select$1","label$1","placeholder$1","value$1","props","container","usePortalContainer","portalContainer","idPrefix","useId","lastValue","useRef","defaultValue","hasEmptyOption","options","option","toBase","v","fromBase","findOption","Field","fieldProps","clsx","className","Select","ref","next","baseNext","current","onValueChange","labelClass","hideLabel","FieldLabelText","triggerProps","trigger","value","renderValue","placeholder","icon","ChevronDown","positioner","popupWidth","popupProps","popup","list","id","index","extra","option$1","optionBody","optionIndicator","Check"],"sources":["../../../src/components/Select/Select.tsx"],"sourcesContent":["import { Select as BaseSelect } from '@base-ui/react/select'\nimport { clsx } from 'clsx'\nimport { Check, ChevronDown } from 'lucide-react'\nimport { useId, useRef, type ReactNode, type Ref } from 'react'\n\nimport * as styles from './Select.css'\nimport * as input from '../../styles/input.css'\nimport {\n Field,\n FieldLabelText,\n labelClass,\n type FieldBaseProps,\n type FieldOptionProps,\n type PartProps,\n} from '../Field/Field'\nimport * as fieldStyles from '../Field/Field.css'\nimport { usePortalContainer, type PortalContainerTarget } from '../PortalContainer'\n\nexport interface SelectOption {\n /**\n * What `value` and `onValueChange` use. Unique within the options. `''` works as a real choice\n * (e.g. \"All sites\"), but like a native `<select>` it doesn't satisfy `required`.\n */\n value: string\n /** The text shown in the list and, once picked, in the trigger. Typeahead matches it. */\n label: string\n /** A muted line under the label in the list. Screen readers announce it as the option's description. */\n description?: ReactNode\n /** Muted text at the end of the row, e.g. \"32–50 wpm\". Also part of the option's description. */\n detail?: ReactNode\n /** Shown but can't be picked. */\n disabled?: boolean\n}\n\nexport interface SelectProps\n extends\n FieldBaseProps,\n FieldOptionProps,\n Omit<\n BaseSelect.Root.Props<string>,\n | 'children'\n | 'items'\n | 'multiple'\n | 'inputRef'\n | 'value'\n | 'defaultValue'\n | 'onValueChange'\n // Options are always `{ value, label }` strings, so these would only break the matching.\n | 'isItemEqualToValue'\n | 'itemToStringLabel'\n | 'itemToStringValue'\n > {\n /** The choices, in order. */\n options: SelectOption[]\n /** Shown while nothing is selected, or when `value` matches no option. */\n placeholder?: string\n /**\n * The picked option's `value`, or `null` for none. Use with `onValueChange` to control it.\n * A value that matches no option shows the placeholder.\n */\n value?: string | null\n /** The initially picked option's `value`, when uncontrolled. */\n defaultValue?: string | null\n /**\n * Called when the value changes. Re-picking the current option doesn't call it. Picking from\n * the list always gives an option's `value`; `null` only comes from a form reset back to an\n * empty initial value, so with a picked initial value it's safe to treat it as a `string`.\n */\n onValueChange?: (value: string | null) => void\n /** What the trigger shows for the picked option (`null` when none matches). Defaults to its `label`, else the placeholder. */\n renderValue?: (option: SelectOption | null) => ReactNode\n /** Width of the dropdown when it should be wider than the field, e.g. `'24rem'`. Never narrower than the field. */\n popupWidth?: string\n /** Where the dropdown renders. Defaults to the nearest `PortalContainer`, else `document.body`. */\n portalContainer?: PortalContainerTarget\n /** Goes on the trigger button, so `<label htmlFor>` and `getElementById(id).focus()` work. */\n id?: string\n /** Forwarded to the hidden input that holds the value (for form libraries). */\n ref?: Ref<HTMLInputElement>\n /** Goes on the field's root element. */\n className?: string\n /** Props for the trigger button (role `combobox`), e.g. `{ 'data-testid': 'plan-select' }`. */\n triggerProps?: PartProps<BaseSelect.Trigger.Props>\n /** Props for the dropdown (role `listbox`), e.g. `{ 'data-testid': 'plan-options' }`. */\n popupProps?: PartProps<BaseSelect.Popup.Props>\n}\n\n/** Single-choice dropdown with a label. */\nexport function Select({\n label,\n description,\n error,\n required,\n hideLabel,\n fieldProps,\n disabled,\n className,\n options,\n placeholder = 'Select an option',\n value,\n defaultValue,\n onValueChange,\n renderValue,\n popupWidth,\n portalContainer,\n ref,\n triggerProps,\n popupProps,\n ...props\n}: SelectProps) {\n const container = usePortalContainer(portalContainer)\n const idPrefix = useId()\n // Uncontrolled value, so a re-pick of the current option can be ignored.\n const lastValue = useRef(value ?? defaultValue ?? null)\n // Base UI treats `''` as \"nothing picked\", so an `''` option is held as `null` inside it.\n const hasEmptyOption = options.some((option) => option.value === '')\n const toBase = (v: string | null | undefined) => (v === '' && hasEmptyOption ? null : v)\n const fromBase = (v: string | null) => (v === null && hasEmptyOption ? '' : v)\n const findOption = (v: string | null) => options.find((option) => option.value === fromBase(v))\n return (\n <Field\n {...fieldProps}\n description={description}\n error={error}\n disabled={disabled}\n className={clsx(fieldProps?.className, className)}\n >\n <BaseSelect.Root\n {...props}\n required={required}\n disabled={disabled}\n value={toBase(value)}\n defaultValue={toBase(defaultValue)}\n inputRef={ref}\n onValueChange={(baseNext) => {\n const next = fromBase(baseNext)\n const current = value !== undefined ? value : lastValue.current\n lastValue.current = next\n if (next !== current) onValueChange?.(next)\n }}\n >\n {label != null && (\n <BaseSelect.Label className={labelClass(fieldStyles.label, hideLabel)}>\n <FieldLabelText label={label} required={required} />\n </BaseSelect.Label>\n )}\n <BaseSelect.Trigger\n {...triggerProps}\n className={clsx(styles.trigger, triggerProps?.className)}\n >\n <BaseSelect.Value className={styles.value}>\n {(current: string | null) => {\n const option = findOption(current) ?? null\n if (renderValue) return renderValue(option)\n return option ? (\n option.label\n ) : (\n <span className={styles.placeholder}>{placeholder}</span>\n )\n }}\n </BaseSelect.Value>\n <BaseSelect.Icon className={styles.icon}>\n <ChevronDown size=\"1.125em\" aria-hidden />\n </BaseSelect.Icon>\n </BaseSelect.Trigger>\n <BaseSelect.Portal container={container}>\n <BaseSelect.Positioner\n className={input.positioner}\n positionMethod={container ? 'fixed' : 'absolute'}\n sideOffset={4}\n alignItemWithTrigger={false}\n >\n <BaseSelect.Popup\n style={popupWidth ? { width: popupWidth } : undefined}\n {...popupProps}\n className={clsx(input.popup, popupProps?.className)}\n >\n <BaseSelect.List className={input.list}>\n {options.map((option, index) => {\n const id = `${idPrefix}-${index}`\n const extra = option.description != null || option.detail != null\n return (\n <BaseSelect.Item\n key={option.value}\n value={toBase(option.value)}\n label={option.label}\n disabled={option.disabled}\n className={input.option}\n aria-labelledby={extra ? `${id}-label` : undefined}\n aria-describedby={\n extra\n ? clsx(\n option.description != null && `${id}-description`,\n option.detail != null && `${id}-detail`,\n )\n : undefined\n }\n >\n <span className={input.optionBody}>\n <BaseSelect.ItemText id={`${id}-label`}>{option.label}</BaseSelect.ItemText>\n {option.description != null && (\n <span id={`${id}-description`} className={input.optionDescription}>\n {option.description}\n </span>\n )}\n </span>\n {option.detail != null && (\n <span id={`${id}-detail`} className={input.optionDetail}>\n {option.detail}\n </span>\n )}\n <BaseSelect.ItemIndicator className={input.optionIndicator}>\n <Check size=\"1.14em\" aria-hidden />\n </BaseSelect.ItemIndicator>\n </BaseSelect.Item>\n )\n })}\n </BaseSelect.List>\n </BaseSelect.Popup>\n </BaseSelect.Positioner>\n </BaseSelect.Portal>\n </BaseSelect.Root>\n </Field>\n )\n}\n"],"mappings":";;;;;;;;;;;AAwFA,SAAgBA,EAAO,EACrB,OAAAiB,GACA,gBACA,UACA,aACA,cACA,eACA,aACA,cACA,YACA,aAAAC,IAAc,oBACd,OAAAC,GACA,iBACA,kBACA,gBACA,eACA,oBACA,QACA,iBACA,eACA,GAAGC,KACW;CACd,IAAMC,IAAYC,EAAmBC,CAAe,GAC9CC,IAAWC,EAAM,GAEjBC,IAAYC,EAAO1B,KAAS2B,KAAgB,IAAI,GAEhDC,IAAiBC,EAAQ,MAAM,MAAWC,EAAO,UAAU,EAAE,GAC7DC,KAAU,MAAkCC,MAAM,MAAMJ,IAAiB,OAAOI,GAChFC,KAAY,MAAsBD,MAAM,QAAQJ,IAAiB,KAAKI,GACtEE,KAAc,MAAqBL,EAAQ,MAAM,MAAWC,EAAO,UAAUG,EAASD,CAAC,CAAC;CAC9F,OACE,kBAACG,GAAD;EACE,GAAIC;EACS;EACN;EACG;EACV,WAAWC,EAAKD,GAAY,WAAWE,CAAS;EAEhD,UAAA,kBAACrC,EAAW,MAAZ;GACE,GAAIkB;GACM;GACA;GACV,OAAOY,EAAO/B,CAAK;GACnB,cAAc+B,EAAOJ,CAAY;GACjC,UAAUa;GACV,gBAAgB,MAAa;IAC3B,IAAMC,IAAOR,EAASS,CAAQ,GACxBC,IAAU3C,MAAU,KAAA,IAAoByB,EAAU,UAAlBzB;IAEtC,AADA,EAAU,UAAUyC,GAChBA,MAASE,KAASC,IAAgBH,CAAI;GAC5C;GAZF,UAAA;IAcGvC,KAAS,QACR,kBAACD,EAAW,OAAZ;KAAkB,WAAW4C,EAAW,WAAmBC,CAAS;KAClE,UAAA,kBAACC,GAAD;MAAuB,OAAA/B;MAAiB;KAAW,CAAA;IACnC,CAAA;IAEpB,kBAACf,EAAW,SAAZ;KACE,GAAI+C;KACJ,WAAWX,EAAKlC,GAAgB6C,GAAc,SAAS;KAFzD,UAAA,CAIE,kBAAC/C,EAAW,OAAZ;MAAkB,WAAWG;MACzB,WAAA,MAA2B;OAC3B,IAAM0B,IAASI,EAAWS,CAAO,KAAK;OAEtC,OADIQ,IAAoBA,EAAYrB,CAAM,IACnCA,IACLA,EAAO,QAEP,kBAAC,QAAD;QAAM,WAAWzB;QAAqB,UAAAC;OAAkB,CAAA;MAE5D;KACgB,CAAA,GAClB,kBAACL,EAAW,MAAZ;MAAiB,WAAWM;MAC1B,UAAA,kBAAC+C,GAAD;OAAa,MAAK;OAAU,eAAA;MAAa,CAAA;KAC1B,CAAA,CACC;;IACpB,kBAACrD,EAAW,QAAZ;KAA8B;KAC5B,UAAA,kBAACA,EAAW,YAAZ;MACE,WAAWO;MACX,gBAAgBY,IAAY,UAAU;MACtC,YAAY;MACZ,sBAAsB;MAEtB,UAAA,kBAACnB,EAAW,OAAZ;OACE,OAAOuD,IAAa,EAAE,OAAOA,EAAW,IAAI,KAAA;OAC5C,GAAIC;OACJ,WAAWpB,EAAK5B,GAAagD,GAAY,SAAS;OAElD,UAAA,kBAACxD,EAAW,MAAZ;QAAiB,WAAWS;QACzB,UAAAmB,EAAQ,KAAK,GAAQ,MAAU;SAC9B,IAAM+B,IAAK,GAAGrC,EAAS,GAAGsC,KACpBC,IAAQnD,EAAO,eAAe,QAAQA,EAAO,UAAU;SAC7D,OACE,kBAACV,EAAW,MAAZ;UAEE,OAAO8B,EAAOpB,EAAO,KAAK;UAC1B,OAAOA,EAAO;UACd,UAAUA,EAAO;UACjB,WAAWC;UACX,mBAAiBkD,IAAQ,GAAGF,EAAG,UAAU,KAAA;UACzC,oBACEE,IACIzB,EACE1B,EAAO,eAAe,QAAQ,GAAGiD,EAAG,eACpCjD,EAAO,UAAU,QAAQ,GAAGiD,EAAG,QACjC,IACA,KAAA;UAbR,UAAA;WAgBE,kBAAC,QAAD;YAAM,WAAW/C;YAAjB,UAAA,CACE,kBAACZ,EAAW,UAAZ;aAAqB,IAAI,GAAG2D,EAAG;aAAU,UAAAjD,EAAO;YAA2B,CAAA,GAC1EA,EAAO,eAAe,QACrB,kBAAC,QAAD;aAAM,IAAI,GAAGiD,EAAG;aAAe,WAAW;aACvC,UAAAjD,EAAO;YACJ,CAAA,CAEJ;;WACLA,EAAO,UAAU,QAChB,kBAAC,QAAD;YAAM,IAAI,GAAGiD,EAAG;YAAU,WAAW;YAClC,UAAAjD,EAAO;WACJ,CAAA;WAER,kBAACV,EAAW,eAAZ;YAA0B,WAAWa;YACnC,UAAA,kBAACoD,GAAD;aAAO,MAAK;aAAS,eAAA;YAAa,CAAA;WACV,CAAA;UACX;SA/BV,GAAAvD,EAAO,KA+BG;QAErB,CAAC;OACc,CAAA;MACD,CAAA;KACG,CAAA;IACN,CAAA;GACJ;;CACZ,CAAA;AAEX"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
/* empty css */
|
|
1
2
|
/* empty css */
|
|
2
3
|
/* empty css */
|
|
3
4
|
// src/components/Select/Select.css.ts
|
|
4
|
-
var e = "cnkfjn0 _12aoxdm0", t = "cnkfjn1", n = "cnkfjn2";
|
|
5
|
-
export {
|
|
5
|
+
var e = "cnkfjn0 _12aoxdm0", t = "cnkfjn1", n = "cnkfjn2", r = "cnkfjn3";
|
|
6
|
+
export { r as icon, n as placeholder, e as trigger, t as value };
|
|
6
7
|
|
|
7
8
|
//# sourceMappingURL=Select.styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Select.styles.js","names":["trigger","value","icon"],"sources":["../../../src/components/Select/Select.css.ts"],"sourcesContent":["import { style } from '@vanilla-extract/css'\n\nimport { input } from '../../styles/input.css'\nimport { vars } from '../../tokens/contract.css'\nimport { space } from '../../tokens/scale'\n\nexport const trigger = style([\n input,\n {\n justifyContent: 'space-between',\n gap: space['3'],\n paddingInlineEnd: space['3'],\n cursor: 'pointer',\n userSelect: 'none',\n },\n])\n\nexport const value = style({\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap',\n
|
|
1
|
+
{"version":3,"file":"Select.styles.js","names":["trigger","value","placeholder","icon"],"sources":["../../../src/components/Select/Select.css.ts"],"sourcesContent":["import { style } from '@vanilla-extract/css'\n\nimport { input } from '../../styles/input.css'\nimport { vars } from '../../tokens/contract.css'\nimport { space } from '../../tokens/scale'\n\nexport const trigger = style([\n input,\n {\n justifyContent: 'space-between',\n gap: space['3'],\n paddingInlineEnd: space['3'],\n cursor: 'pointer',\n userSelect: 'none',\n },\n])\n\nexport const value = style({\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap',\n})\n\n/** Also used when `value` matches no option, which Base UI doesn't flag as a placeholder. */\nexport const placeholder = style({ color: vars.color.inkSubtle })\n\nexport const icon = style({\n display: 'inline-flex',\n flexShrink: 0,\n color: vars.color.inkMuted,\n transition: 'transform 120ms',\n selectors: { [`${trigger}[data-popup-open] &`]: { transform: 'rotate(180deg)' } },\n '@media': { '(prefers-reduced-motion: reduce)': { transition: 'none' } },\n})\n"],"mappings":""}
|
|
@@ -2,7 +2,9 @@ import { ComponentProps, CSSProperties } from 'react';
|
|
|
2
2
|
export interface SkeletonProps extends ComponentProps<'span'> {
|
|
3
3
|
/** `text` is a line of text, `circle` is an avatar (sized by `height`). */
|
|
4
4
|
variant?: 'block' | 'text' | 'circle';
|
|
5
|
+
/** A CSS length. Numbers are px at the 16px base, converted to rem so they scale with the text-size setting. */
|
|
5
6
|
width?: CSSProperties['width'];
|
|
7
|
+
/** A CSS length. Numbers are px at the 16px base, converted to rem (like `width`). */
|
|
6
8
|
height?: CSSProperties['height'];
|
|
7
9
|
/** For `text`, renders this many lines, the last one shorter. */
|
|
8
10
|
lines?: number;
|
|
@@ -2,36 +2,37 @@ import { lines as e, skeleton as t } from "./Skeleton.styles.js";
|
|
|
2
2
|
import { clsx as n } from "clsx";
|
|
3
3
|
import { jsx as r } from "react/jsx-runtime";
|
|
4
4
|
// src/components/Skeleton/Skeleton.tsx
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
var i = (e) => typeof e == "number" ? `${+(e / 16).toFixed(4)}rem` : e;
|
|
6
|
+
function a({ variant: a = "block", width: o, height: s, lines: c = 1, className: l, style: u, ...d }) {
|
|
7
|
+
let f = i(o), p = i(s), m = a === "circle" ? {
|
|
8
|
+
width: p ?? f ?? "2.5rem",
|
|
9
|
+
height: p ?? f ?? "2.5rem"
|
|
9
10
|
} : {
|
|
10
|
-
width:
|
|
11
|
-
height:
|
|
11
|
+
width: f ?? "100%",
|
|
12
|
+
height: p ?? (a === "block" ? "1rem" : void 0)
|
|
12
13
|
};
|
|
13
|
-
return
|
|
14
|
+
return a === "text" && c > 1 ? /* @__PURE__ */ r("span", {
|
|
14
15
|
"aria-hidden": !0,
|
|
15
|
-
className: n(e,
|
|
16
|
-
style:
|
|
17
|
-
...
|
|
18
|
-
children: Array.from({ length:
|
|
19
|
-
className: t({ variant:
|
|
16
|
+
className: n(e, l),
|
|
17
|
+
style: u,
|
|
18
|
+
...d,
|
|
19
|
+
children: Array.from({ length: c }, (e, n) => /* @__PURE__ */ r("span", {
|
|
20
|
+
className: t({ variant: a }),
|
|
20
21
|
style: {
|
|
21
|
-
...
|
|
22
|
-
width: n ===
|
|
22
|
+
...m,
|
|
23
|
+
width: n === c - 1 ? "60%" : m.width
|
|
23
24
|
}
|
|
24
25
|
}, n))
|
|
25
26
|
}) : /* @__PURE__ */ r("span", {
|
|
26
27
|
"aria-hidden": !0,
|
|
27
|
-
className: n(t({ variant:
|
|
28
|
+
className: n(t({ variant: a }), l),
|
|
28
29
|
style: {
|
|
29
|
-
...
|
|
30
|
-
...
|
|
30
|
+
...m,
|
|
31
|
+
...u
|
|
31
32
|
},
|
|
32
|
-
...
|
|
33
|
+
...d
|
|
33
34
|
});
|
|
34
35
|
}
|
|
35
|
-
export {
|
|
36
|
+
export { a as Skeleton };
|
|
36
37
|
|
|
37
38
|
//# sourceMappingURL=Skeleton.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Skeleton.js","names":["lines","styles.lines","styles.skeleton","Skeleton","lines$1","props","
|
|
1
|
+
{"version":3,"file":"Skeleton.js","names":["lines","styles.lines","styles.skeleton","toRem","length","Skeleton","lines$1","props","w","width","h","height","size","variant","clsx","lines","className","skeleton","i","style"],"sources":["../../../src/components/Skeleton/Skeleton.tsx"],"sourcesContent":["import { clsx } from 'clsx'\nimport type { ComponentProps, CSSProperties } from 'react'\n\nimport * as styles from './Skeleton.css'\n\nexport interface SkeletonProps extends ComponentProps<'span'> {\n /** `text` is a line of text, `circle` is an avatar (sized by `height`). */\n variant?: 'block' | 'text' | 'circle'\n /** A CSS length. Numbers are px at the 16px base, converted to rem so they scale with the text-size setting. */\n width?: CSSProperties['width']\n /** A CSS length. Numbers are px at the 16px base, converted to rem (like `width`). */\n height?: CSSProperties['height']\n /** For `text`, renders this many lines, the last one shorter. */\n lines?: number\n}\n\nconst toRem = <T,>(length: T) =>\n typeof length === 'number' ? `${+(length / 16).toFixed(4)}rem` : length\n\n/**\n * A pulsing placeholder shaped like the content that's loading. Hidden from assistive tech;\n * mark the loading region with `aria-busy` instead.\n */\nexport function Skeleton({\n variant = 'block',\n width,\n height,\n lines = 1,\n className,\n style,\n ...props\n}: SkeletonProps) {\n const w = toRem(width)\n const h = toRem(height)\n const size: CSSProperties =\n variant === 'circle'\n ? { width: h ?? w ?? '2.5rem', height: h ?? w ?? '2.5rem' }\n : { width: w ?? '100%', height: h ?? (variant === 'block' ? '1rem' : undefined) }\n\n if (variant === 'text' && lines > 1) {\n return (\n <span aria-hidden className={clsx(styles.lines, className)} style={style} {...props}>\n {Array.from({ length: lines }, (_, i) => (\n <span\n key={i}\n className={styles.skeleton({ variant })}\n style={{ ...size, width: i === lines - 1 ? '60%' : size.width }}\n />\n ))}\n </span>\n )\n }\n\n return (\n <span\n aria-hidden\n className={clsx(styles.skeleton({ variant }), className)}\n style={{ ...size, ...style }}\n {...props}\n />\n )\n}\n"],"mappings":";;;;AAgBA,IAAMG,KAAa,MACjB,OAAOC,KAAW,WAAW,GAAG,EAAEA,IAAS,GAAA,CAAI,QAAQ,CAAC,EAAE,OAAOA;AAMnE,SAAgBC,EAAS,EACvB,aAAU,SACV,UACA,WACA,OAAAC,IAAQ,GACR,cACA,UACA,GAAGC,KACa;CAChB,IAAMC,IAAIL,EAAMM,CAAK,GACfC,IAAIP,EAAMQ,CAAM,GAChBC,IACJC,MAAY,WACR;EAAE,OAAOH,KAAKF,KAAK;EAAU,QAAQE,KAAKF,KAAK;CAAS,IACxD;EAAE,OAAOA,KAAK;EAAQ,QAAQE,MAAMG,MAAY,UAAU,SAAS,KAAA;CAAW;CAgBpF,OAdIA,MAAY,UAAUb,IAAQ,IAE9B,kBAAC,QAAD;EAAM,eAAA;EAAY,WAAWc,EAAKb,GAAce,CAAS;EAAU;EAAO,GAAIT;EAC3E,UAAA,MAAM,KAAK,EAAE,QAAQP,EAAM,IAAI,GAAG,MACjC,kBAAC,QAAD;GAEE,WAAWE,EAAgB,EAAE,WAAQ,CAAC;GACtC,OAAO;IAAE,GAAGU;IAAM,OAAOM,MAAMlB,IAAQ,IAAI,QAAQY,EAAK;GAAM;EAC/D,GAHMM,CAGN,CACF;CACG,CAAA,IAKR,kBAAC,QAAD;EACE,eAAA;EACA,WAAWJ,EAAKZ,EAAgB,EAAE,WAAQ,CAAC,GAAGc,CAAS;EACvD,OAAO;GAAE,GAAGJ;GAAM,GAAGO;EAAM;EAC3B,GAAIZ;CACL,CAAA;AAEL"}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { RecipeVariants } from '@vanilla-extract/recipes';
|
|
2
|
+
/** The deliberate spacing steps, so layouts stay consistent across apps. */
|
|
3
|
+
export declare const gaps: readonly ["1", "2", "3", "4", "6", "8"];
|
|
4
|
+
export type StackGap = (typeof gaps)[number];
|
|
2
5
|
export declare const stack: import('@vanilla-extract/recipes').RuntimeFn<{
|
|
3
6
|
direction: {
|
|
4
7
|
column: {
|
|
@@ -8,7 +11,7 @@ export declare const stack: import('@vanilla-extract/recipes').RuntimeFn<{
|
|
|
8
11
|
flexDirection: "row";
|
|
9
12
|
};
|
|
10
13
|
};
|
|
11
|
-
gap: Record<
|
|
14
|
+
gap: Record<StackGap, {
|
|
12
15
|
gap: string;
|
|
13
16
|
}>;
|
|
14
17
|
align: {
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import { ComponentProps } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { StackGap } from './Stack.css';
|
|
3
3
|
export interface StackProps extends ComponentProps<'div'> {
|
|
4
|
+
/** `column` (default) stacks children; `row` lines them up. */
|
|
4
5
|
direction?: 'column' | 'row';
|
|
5
|
-
/** Space between children,
|
|
6
|
-
gap?:
|
|
6
|
+
/** Space between children: `'1'` 4px, `'2'` 8px, `'3'` 12px, `'4'` 16px (default), `'6'` 24px, `'8'` 32px. */
|
|
7
|
+
gap?: StackGap;
|
|
8
|
+
/** Cross-axis alignment (`align-items`). */
|
|
7
9
|
align?: 'start' | 'center' | 'end' | 'stretch' | 'baseline';
|
|
10
|
+
/** Main-axis distribution (`justify-content`). */
|
|
8
11
|
justify?: 'start' | 'center' | 'end' | 'between';
|
|
12
|
+
/** Let children wrap onto new lines, e.g. a row of filters. */
|
|
9
13
|
wrap?: boolean;
|
|
10
14
|
}
|
|
11
15
|
/** Flex layout that spaces its children. Renders nothing when it has no children. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Stack.js","names":["styles.stack","Stack","props","Children","children","clsx","stack","className"],"sources":["../../../src/components/Stack/Stack.tsx"],"sourcesContent":["import { clsx } from 'clsx'\nimport { Children, type ComponentProps } from 'react'\n\nimport * as styles from './Stack.css'\nimport type {
|
|
1
|
+
{"version":3,"file":"Stack.js","names":["styles.stack","Stack","props","Children","children","clsx","stack","className"],"sources":["../../../src/components/Stack/Stack.tsx"],"sourcesContent":["import { clsx } from 'clsx'\nimport { Children, type ComponentProps } from 'react'\n\nimport * as styles from './Stack.css'\nimport type { StackGap } from './Stack.css'\n\nexport interface StackProps extends ComponentProps<'div'> {\n /** `column` (default) stacks children; `row` lines them up. */\n direction?: 'column' | 'row'\n /** Space between children: `'1'` 4px, `'2'` 8px, `'3'` 12px, `'4'` 16px (default), `'6'` 24px, `'8'` 32px. */\n gap?: StackGap\n /** Cross-axis alignment (`align-items`). */\n align?: 'start' | 'center' | 'end' | 'stretch' | 'baseline'\n /** Main-axis distribution (`justify-content`). */\n justify?: 'start' | 'center' | 'end' | 'between'\n /** Let children wrap onto new lines, e.g. a row of filters. */\n wrap?: boolean\n}\n\n/** Flex layout that spaces its children. Renders nothing when it has no children. */\nexport function Stack({\n direction = 'column',\n gap = '4',\n align,\n justify,\n wrap = false,\n className,\n children,\n ...props\n}: StackProps) {\n if (Children.toArray(children).length === 0) return null\n return (\n <div\n className={clsx(styles.stack({ direction, gap, align, justify, wrap }), className)}\n {...props}\n >\n {children}\n </div>\n )\n}\n"],"mappings":";;;;;AAoBA,SAAgBC,EAAM,EACpB,eAAY,UACZ,SAAM,KACN,UACA,YACA,UAAO,IACP,cACA,aACA,GAAGC,KACU;CAEb,OADIC,EAAS,QAAQC,CAAQ,CAAC,CAAC,WAAW,IAAU,OAElD,kBAAC,OAAD;EACE,WAAWC,EAAKL,EAAa;GAAE;GAAW;GAAK;GAAO;GAAS;EAAK,CAAC,GAAGO,CAAS;EACjF,GAAIL;EAEH;CACE,CAAA;AAET"}
|
|
@@ -9,34 +9,27 @@ var t = e({
|
|
|
9
9
|
row: "gr5eiw2"
|
|
10
10
|
},
|
|
11
11
|
gap: {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
6: "gr5eiw9",
|
|
19
|
-
8: "gr5eiwa",
|
|
20
|
-
10: "gr5eiwb",
|
|
21
|
-
12: "gr5eiwc",
|
|
22
|
-
"0.5": "gr5eiwd",
|
|
23
|
-
"1.5": "gr5eiwe",
|
|
24
|
-
"2.5": "gr5eiwf"
|
|
12
|
+
1: "gr5eiw3",
|
|
13
|
+
2: "gr5eiw4",
|
|
14
|
+
3: "gr5eiw5",
|
|
15
|
+
4: "gr5eiw6",
|
|
16
|
+
6: "gr5eiw7",
|
|
17
|
+
8: "gr5eiw8"
|
|
25
18
|
},
|
|
26
19
|
align: {
|
|
27
|
-
start: "
|
|
28
|
-
center: "
|
|
29
|
-
end: "
|
|
30
|
-
stretch: "
|
|
31
|
-
baseline: "
|
|
20
|
+
start: "gr5eiw9",
|
|
21
|
+
center: "gr5eiwa",
|
|
22
|
+
end: "gr5eiwb",
|
|
23
|
+
stretch: "gr5eiwc",
|
|
24
|
+
baseline: "gr5eiwd"
|
|
32
25
|
},
|
|
33
26
|
justify: {
|
|
34
|
-
start: "
|
|
35
|
-
center: "
|
|
36
|
-
end: "
|
|
37
|
-
between: "
|
|
27
|
+
start: "gr5eiwe",
|
|
28
|
+
center: "gr5eiwf",
|
|
29
|
+
end: "gr5eiwg",
|
|
30
|
+
between: "gr5eiwh"
|
|
38
31
|
},
|
|
39
|
-
wrap: { true: "
|
|
32
|
+
wrap: { true: "gr5eiwi" }
|
|
40
33
|
},
|
|
41
34
|
defaultVariants: {},
|
|
42
35
|
compoundVariants: []
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Stack.styles.js","names":["_7a468","stack","createRuntimeFn"],"sources":["../../../src/components/Stack/Stack.css.ts"],"sourcesContent":["import { recipe, type RecipeVariants } from '@vanilla-extract/recipes'\n\nimport { space
|
|
1
|
+
{"version":3,"file":"Stack.styles.js","names":["_7a468","stack","createRuntimeFn"],"sources":["../../../src/components/Stack/Stack.css.ts"],"sourcesContent":["import { recipe, type RecipeVariants } from '@vanilla-extract/recipes'\n\nimport { space } from '../../tokens/scale'\n\n/** The deliberate spacing steps, so layouts stay consistent across apps. */\nexport const gaps = ['1', '2', '3', '4', '6', '8'] as const\nexport type StackGap = (typeof gaps)[number]\n\nexport const stack = recipe({\n base: { display: 'flex', minWidth: 0 },\n variants: {\n direction: {\n column: { flexDirection: 'column' },\n row: { flexDirection: 'row' },\n },\n gap: Object.fromEntries(gaps.map((key) => [key, { gap: space[key] }])) as Record<\n StackGap,\n { gap: string }\n >,\n align: {\n start: { alignItems: 'flex-start' },\n center: { alignItems: 'center' },\n end: { alignItems: 'flex-end' },\n stretch: { alignItems: 'stretch' },\n baseline: { alignItems: 'baseline' },\n },\n justify: {\n start: { justifyContent: 'flex-start' },\n center: { justifyContent: 'center' },\n end: { justifyContent: 'flex-end' },\n between: { justifyContent: 'space-between' },\n },\n wrap: { true: { flexWrap: 'wrap' } },\n },\n})\n\nexport type StackVariants = NonNullable<RecipeVariants<typeof stack>>\n"],"mappings":""}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { ComponentProps, ReactNode } from 'react';
|
|
2
2
|
export interface StatCardProps extends Omit<ComponentProps<'div'>, 'children'> {
|
|
3
|
+
/** What the number is, e.g. "Objective achieved". */
|
|
3
4
|
label: ReactNode;
|
|
5
|
+
/** The headline number, formatted, e.g. "64%". */
|
|
4
6
|
value: ReactNode;
|
|
7
|
+
/** Small muted context under the value, e.g. "7 of 11 judged". */
|
|
5
8
|
caption?: ReactNode;
|
|
6
9
|
}
|
|
7
10
|
/** A headline number on a card, e.g. "Objective achieved 64%". */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StatCard.js","names":["styles.card","styles.label","label","styles.value","value","caption","StatCard","label$1","value$1","caption$1","props","clsx","card","className","label","value"],"sources":["../../../src/components/StatCard/StatCard.tsx"],"sourcesContent":["import { clsx } from 'clsx'\nimport type { ComponentProps, ReactNode } from 'react'\n\nimport * as styles from './StatCard.css'\n\nexport interface StatCardProps extends Omit<ComponentProps<'div'>, 'children'> {\n label: ReactNode\n value: ReactNode\n caption?: ReactNode\n}\n\n/** A headline number on a card, e.g. \"Objective achieved 64%\". */\nexport function StatCard({ label, value, caption, className, ...props }: StatCardProps) {\n return (\n <div className={clsx(styles.card, className)} {...props}>\n <p className={styles.label}>{label}</p>\n <p className={styles.value}>{value}</p>\n {caption && <p className={styles.caption}>{caption}</p>}\n </div>\n )\n}\n"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"StatCard.js","names":["styles.card","styles.label","label","styles.value","value","caption","StatCard","label$1","value$1","caption$1","props","clsx","card","className","label","value"],"sources":["../../../src/components/StatCard/StatCard.tsx"],"sourcesContent":["import { clsx } from 'clsx'\nimport type { ComponentProps, ReactNode } from 'react'\n\nimport * as styles from './StatCard.css'\n\nexport interface StatCardProps extends Omit<ComponentProps<'div'>, 'children'> {\n /** What the number is, e.g. \"Objective achieved\". */\n label: ReactNode\n /** The headline number, formatted, e.g. \"64%\". */\n value: ReactNode\n /** Small muted context under the value, e.g. \"7 of 11 judged\". */\n caption?: ReactNode\n}\n\n/** A headline number on a card, e.g. \"Objective achieved 64%\". */\nexport function StatCard({ label, value, caption, className, ...props }: StatCardProps) {\n return (\n <div className={clsx(styles.card, className)} {...props}>\n <p className={styles.label}>{label}</p>\n <p className={styles.value}>{value}</p>\n {caption && <p className={styles.caption}>{caption}</p>}\n </div>\n )\n}\n"],"mappings":";;;;AAeA,SAAgBM,EAAS,EAAE,OAAAC,GAAO,OAAAC,GAAO,SAAAC,GAAS,cAAW,GAAGC,KAAwB;CACtF,OACE,kBAAC,OAAD;EAAK,WAAWC,EAAKX,GAAaa,CAAS;EAAG,GAAIH;EAAlD,UAAA;GACE,kBAAC,KAAD;IAAG,WAAWT;IAAe,UAAAC;GAAS,CAAA;GACtC,kBAAC,KAAD;IAAG,WAAWC;IAAe,UAAAC;GAAS,CAAA;GACrCC,KAAW,kBAAC,KAAD;IAAG,WAAW;IAAiB,UAAAA;GAAW,CAAA;EACnD;;AAET"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StatCard.styles.js","names":["card","label","value","caption"],"sources":["../../../src/components/StatCard/StatCard.css.ts"],"sourcesContent":["import { style } from '@vanilla-extract/css'\n\nimport { vars } from '../../tokens/contract.css'\nimport { fontSize, fontWeight, lineHeight, radius, space } from '../../tokens/scale'\n\nexport const card = style({\n display: 'flex',\n flexDirection: 'column',\n gap: space['1'],\n padding: space['6'],\n border: `1px solid ${vars.color.border}`,\n borderRadius: radius
|
|
1
|
+
{"version":3,"file":"StatCard.styles.js","names":["card","label","value","caption"],"sources":["../../../src/components/StatCard/StatCard.css.ts"],"sourcesContent":["import { style } from '@vanilla-extract/css'\n\nimport { vars } from '../../tokens/contract.css'\nimport { fontSize, fontWeight, lineHeight, radius, space } from '../../tokens/scale'\n\nexport const card = style({\n display: 'flex',\n flexDirection: 'column',\n gap: space['1'],\n padding: space['6'],\n border: `1px solid ${vars.color.border}`,\n borderRadius: radius.xl,\n backgroundColor: vars.color.surface,\n color: vars.color.ink,\n fontFamily: vars.font.sans,\n})\n\nexport const label = style({ margin: 0, fontSize: fontSize.md, color: vars.color.inkMuted })\n\nexport const value = style({\n margin: 0,\n fontSize: fontSize['3xl'],\n fontWeight: fontWeight.semibold,\n lineHeight: lineHeight.tight,\n fontVariantNumeric: 'tabular-nums',\n})\n\nexport const caption = style({ margin: 0, fontSize: fontSize.sm, color: vars.color.inkMuted })\n"],"mappings":""}
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
import { ComponentProps } from 'react';
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
/** Responsive grid for stat tiles. Columns fill the row and wrap below `minColumnWidth`. */
|
|
7
|
-
export declare function StatsGrid({ minColumnWidth, className, style, ...props }: StatsGridProps): import('react').JSX.Element;
|
|
2
|
+
export type StatsGridProps = ComponentProps<'div'>;
|
|
3
|
+
/** Responsive grid for stat tiles. Columns fill the row and wrap when narrower than 14rem. */
|
|
4
|
+
export declare function StatsGrid({ className, ...props }: StatsGridProps): import('react').JSX.Element;
|
|
@@ -2,14 +2,10 @@ import { grid as e } from "./StatsGrid.styles.js";
|
|
|
2
2
|
import { clsx as t } from "clsx";
|
|
3
3
|
import { jsx as n } from "react/jsx-runtime";
|
|
4
4
|
// src/components/StatsGrid/StatsGrid.tsx
|
|
5
|
-
function r({
|
|
5
|
+
function r({ className: r, ...i }) {
|
|
6
6
|
return /* @__PURE__ */ n("div", {
|
|
7
|
-
className: t(e,
|
|
8
|
-
|
|
9
|
-
gridTemplateColumns: `repeat(auto-fit, minmax(min(${r}, 100%), 1fr))`,
|
|
10
|
-
...a
|
|
11
|
-
} : a,
|
|
12
|
-
...o
|
|
7
|
+
className: t(e, r),
|
|
8
|
+
...i
|
|
13
9
|
});
|
|
14
10
|
}
|
|
15
11
|
export { r as StatsGrid };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StatsGrid.js","names":["styles.grid","StatsGrid","props","clsx","grid","className"
|
|
1
|
+
{"version":3,"file":"StatsGrid.js","names":["styles.grid","StatsGrid","props","clsx","grid","className"],"sources":["../../../src/components/StatsGrid/StatsGrid.tsx"],"sourcesContent":["import { clsx } from 'clsx'\nimport type { ComponentProps } from 'react'\n\nimport * as styles from './StatsGrid.css'\n\nexport type StatsGridProps = ComponentProps<'div'>\n\n/** Responsive grid for stat tiles. Columns fill the row and wrap when narrower than 14rem. */\nexport function StatsGrid({ className, ...props }: StatsGridProps) {\n return <div className={clsx(styles.grid, className)} {...props} />\n}\n"],"mappings":";;;;AAQA,SAAgBC,EAAU,EAAE,cAAW,GAAGC,KAAyB;CACjE,OAAO,kBAAC,OAAD;EAAK,WAAWC,EAAKH,GAAaK,CAAS;EAAG,GAAIH;CAAQ,CAAA;AACnE"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { ComponentProps } from 'react';
|
|
1
|
+
import { ComponentProps, ReactNode } from 'react';
|
|
2
2
|
export type Status = 'queued' | 'running' | 'paused' | 'completed' | 'failed' | 'cancelled';
|
|
3
3
|
export interface StatusBadgeProps extends ComponentProps<'span'> {
|
|
4
|
+
/** Sets the colour and the default label. */
|
|
4
5
|
status: Status;
|
|
5
6
|
/** Overrides the default label (the capitalised status). */
|
|
6
|
-
children?:
|
|
7
|
+
children?: ReactNode;
|
|
7
8
|
}
|
|
8
9
|
/** A pill showing a run's status as a coloured dot and label. */
|
|
9
10
|
export declare function StatusBadge({ status, className, children, ...props }: StatusBadgeProps): import('react').JSX.Element;
|