@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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ColorPicker.js","names":["hint","input.frame","styles.frame","styles.swatch","styles.nativePicker","input.frameInput","styles.text","frame$1","ColorPicker","props","inner","setInner","useState","defaultValue","textRef","useRef","current","value","parsed","parseColor","isInvalidColor","hex","toHex","hint$1","handleChange","event","onChange","onValueChange","handlePick","node","setRef","
|
|
1
|
+
{"version":3,"file":"ColorPicker.js","names":["hint","Field","input.frame","styles.frame","styles.swatch","styles.nativePicker","input.frameInput","styles.text","BaseField","frame$1","Field$1","ColorPicker","props","inner","setInner","useState","defaultValue","textRef","useRef","current","value","parsed","parseColor","isInvalidColor","hex","toHex","hint$1","handleChange","event","onChange","onValueChange","handlePick","node","setRef","cleanup","ref","fieldProps","clsx","className","frame","disabled","swatch","toCss","Ban","pickerLabel","nativePicker","Input","frameInput","text","Field"],"sources":["../../../src/components/ColorPicker/ColorPicker.tsx"],"sourcesContent":["import { Field as BaseField } from '@base-ui/react/field'\nimport { Input } from '@base-ui/react/input'\nimport { clsx } from 'clsx'\nimport { Ban } from 'lucide-react'\nimport { useRef, useState, type ChangeEvent, type ComponentProps, type Ref } from 'react'\n\nimport { parseColor, toCss, toHex } from './color'\nimport * as styles from './ColorPicker.css'\nimport * as input from '../../styles/input.css'\nimport { Field, type FieldBaseProps, type FieldOptionProps } from '../Field/Field'\n\nexport interface ColorPickerProps\n extends\n FieldBaseProps,\n FieldOptionProps,\n Omit<ComponentProps<'input'>, 'ref' | 'type' | 'value' | 'defaultValue'> {\n /** The colour text. Use with `onValueChange` to control it. */\n value?: string\n /** The initial colour text, when uncontrolled. */\n defaultValue?: string\n /** Called with the text as typed or picked, e.g. `#0B6B4F` or `rgb(0 0 0)`. */\n onValueChange?: (value: string) => void\n /** Accessible name of the swatch that opens the browser's colour picker. */\n pickerLabel?: string\n /** Forwarded to the text input. */\n ref?: Ref<HTMLInputElement>\n}\n\n/**\n * A text input for any CSS colour (hex, rgb(), a name…) with a swatch that opens the browser's\n * colour picker. Values not written as hex show their hex alongside.\n */\nexport function ColorPicker({\n label,\n description,\n error,\n required,\n hideLabel,\n fieldProps,\n disabled,\n className,\n value,\n defaultValue = '',\n onChange,\n onValueChange,\n pickerLabel = 'Choose colour',\n ref,\n ...props\n}: ColorPickerProps) {\n const [inner, setInner] = useState(defaultValue)\n const textRef = useRef<HTMLInputElement | null>(null)\n const current = value ?? inner\n const parsed = parseColor(current)\n const isInvalidColor = current.trim() !== '' && !parsed\n const hex = parsed ? toHex(parsed) : undefined\n const hint = isInvalidColor\n ? 'Not a colour'\n : hex !== current.trim().toUpperCase()\n ? hex\n : undefined\n\n const handleChange = (event: ChangeEvent<HTMLInputElement>) => {\n setInner(event.target.value)\n onChange?.(event)\n onValueChange?.(event.target.value)\n }\n\n // Writes the picked colour into the text input as if typed, so its onChange (and form libraries) see it.\n const handlePick = (event: ChangeEvent<HTMLInputElement>) => {\n const node = textRef.current\n if (!node) return\n const descriptor = Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, 'value')\n descriptor?.set?.call(node, event.target.value.toUpperCase())\n node.dispatchEvent(new Event('input', { bubbles: true }))\n }\n\n const setRef = (node: HTMLInputElement | null) => {\n textRef.current = node\n let cleanup: void | (() => void) = undefined\n if (typeof ref === 'function') cleanup = ref(node)\n else if (ref) ref.current = node\n // After the caller's ref, which may write a value (react-hook-form's `register` does).\n if (node && value === undefined && node.value !== inner) setInner(node.value)\n return cleanup\n }\n\n return (\n <Field\n {...fieldProps}\n label={label}\n description={description}\n error={error}\n required={required}\n hideLabel={hideLabel}\n disabled={disabled}\n className={clsx(fieldProps?.className, className)}\n >\n <div\n className={clsx(input.frame, styles.frame)}\n data-disabled={disabled || undefined}\n data-invalid={isInvalidColor || undefined}\n >\n <label\n className={styles.swatch}\n data-empty={!parsed || undefined}\n style={parsed ? { background: toCss(parsed) } : undefined}\n >\n {!parsed && <Ban size=\"1em\" aria-hidden />}\n <input\n type=\"color\"\n aria-label={pickerLabel}\n className={styles.nativePicker}\n disabled={disabled}\n value={parsed ? toHex({ ...parsed, a: 1 }).toLowerCase() : '#000000'}\n onChange={handlePick}\n />\n </label>\n <Input\n spellCheck={false}\n autoComplete=\"off\"\n {...props}\n ref={setRef}\n value={current}\n required={required}\n disabled={disabled}\n onChange={handleChange}\n className={clsx(input.frameInput, styles.text)}\n />\n {hint && (\n // A description, so screen readers hear the hex or \"Not a colour\" with the input.\n <BaseField.Description\n render={<span />}\n className={clsx(input.adornment, styles.hint)}\n data-not-colour={isInvalidColor || undefined}\n >\n {hint}\n </BaseField.Description>\n )}\n </div>\n </Field>\n )\n}\n"],"mappings":";;;;;;;;;;;AAgCA,SAAgBW,EAAY,EAC1B,UACA,gBACA,UACA,aACA,cACA,eACA,aACA,cACA,UACA,kBAAe,IACf,aACA,kBACA,iBAAc,iBACd,QACA,GAAGC,KACgB;CACnB,IAAM,CAACC,GAAOC,KAAYC,EAASC,CAAY,GACzCC,IAAUC,EAAgC,IAAI,GAC9CC,IAAUC,KAASP,GACnBQ,IAASC,EAAWH,CAAO,GAC3BI,IAAiBJ,EAAQ,KAAK,MAAM,MAAM,CAACE,GAC3CG,IAAMH,IAASI,EAAMJ,CAAM,IAAI,KAAA,GAC/BrB,IAAOuB,IACT,iBACAC,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YAAY,IAAI;MAC3D,UAAUU;KACX,CAAA,CACI;;IACP,kBAACe,GAAD;KACE,YAAY;KACZ,cAAa;KACb,GAAIlC;KACJ,KAAKqB;KACL,OAAOd;KACG;KACA;KACV,UAAUQ;KACV,WAAWU,EAAK/B,GAAkBC,CAAW;IAC9C,CAAA;IACAP,KAEC,kBAACQ,EAAU,aAAX;KACE,QAAQ,kBAAC,QAAD,CAAO,CAAA;KACf,WAAW6B,EAAK,aAAiB,SAAW;KAC5C,mBAAiBd,KAAkB,KAAA;KAElC,UAAAvB;IACoB,CAAA;GAEtB;;CACA,CAAA;AAEX"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ColorPicker.styles.js","names":["frame","swatch","nativePicker","text","hint"],"sources":["../../../src/components/ColorPicker/ColorPicker.css.ts"],"sourcesContent":["import { style } from '@vanilla-extract/css'\n\nimport { vars } from '../../tokens/contract.css'\nimport { fontSize, radius, space } from '../../tokens/scale'\n\nexport const frame = style({ paddingInlineStart: space['1.5'] })\n\nexport const swatch = style({\n position: 'relative',\n display: 'grid',\n placeItems: 'center',\n flexShrink: 0,\n width: '2rem',\n height: '2rem',\n border: `1px solid ${vars.color.border}`,\n borderRadius: radius.md,\n cursor: 'pointer',\n selectors: {\n '&:has(:focus-visible)': { outline: `2px solid ${vars.color.focusRing}`, outlineOffset: 1 },\n '&:has(:disabled)': { cursor: 'not-allowed' },\n '&[data-empty]': {\n backgroundColor: vars.color.surfaceSunken,\n color: vars.color.inkMuted,\n },\n },\n})\n\nexport const nativePicker = style({\n position: 'absolute',\n inset: 0,\n width: '100%',\n height: '100%',\n opacity: 0,\n cursor: 'inherit',\n})\n\nexport const text = style({ fontFamily: vars.font.mono, paddingInlineStart: space['2.5'] })\n\nexport const hint = style({\n paddingInlineEnd: space['4'],\n fontFamily: vars.font.mono,\n fontSize: fontSize.xs,\n selectors: { '&[data-
|
|
1
|
+
{"version":3,"file":"ColorPicker.styles.js","names":["frame","swatch","nativePicker","text","hint"],"sources":["../../../src/components/ColorPicker/ColorPicker.css.ts"],"sourcesContent":["import { style } from '@vanilla-extract/css'\n\nimport { vars } from '../../tokens/contract.css'\nimport { fontSize, radius, space } from '../../tokens/scale'\n\nexport const frame = style({ paddingInlineStart: space['1.5'] })\n\nexport const swatch = style({\n position: 'relative',\n display: 'grid',\n placeItems: 'center',\n flexShrink: 0,\n width: '2rem',\n height: '2rem',\n border: `1px solid ${vars.color.border}`,\n borderRadius: radius.md,\n cursor: 'pointer',\n selectors: {\n '&:has(:focus-visible)': { outline: `2px solid ${vars.color.focusRing}`, outlineOffset: 1 },\n '&:has(:disabled)': { cursor: 'not-allowed' },\n '&[data-empty]': {\n backgroundColor: vars.color.surfaceSunken,\n color: vars.color.inkMuted,\n },\n },\n})\n\nexport const nativePicker = style({\n position: 'absolute',\n inset: 0,\n width: '100%',\n height: '100%',\n opacity: 0,\n cursor: 'inherit',\n})\n\nexport const text = style({ fontFamily: vars.font.mono, paddingInlineStart: space['2.5'] })\n\nexport const hint = style({\n paddingInlineEnd: space['4'],\n fontFamily: vars.font.mono,\n fontSize: fontSize.xs,\n selectors: { '&[data-not-colour]': { color: vars.color.dangerInk } },\n})\n"],"mappings":""}
|
|
@@ -4,39 +4,62 @@ import { ReactNode, Ref } from 'react';
|
|
|
4
4
|
import { FieldBaseProps, FieldOptionProps, PartProps } from '../Field/Field';
|
|
5
5
|
import { PortalContainerTarget } from '../PortalContainer';
|
|
6
6
|
export interface ComboboxOption {
|
|
7
|
+
/** What `value` and `onValueChange` use. Unique within the options. */
|
|
7
8
|
value: string;
|
|
9
|
+
/** The text shown in the list and, once picked, in the input. Typing filters on it. */
|
|
8
10
|
label: string;
|
|
11
|
+
/** A muted line under the label in the list. Screen readers announce it as the option's description. Not filtered on. */
|
|
12
|
+
description?: ReactNode;
|
|
13
|
+
/** Muted text at the end of the row, e.g. "32–50 wpm". Also part of the option's description. */
|
|
14
|
+
detail?: ReactNode;
|
|
15
|
+
/** Shown but can't be picked. */
|
|
9
16
|
disabled?: boolean;
|
|
10
17
|
}
|
|
11
|
-
|
|
18
|
+
type UnsupportedRootProps = 'isItemEqualToValue' | 'itemToStringLabel' | 'itemToStringValue' | 'filteredItems' | 'grid' | 'inline' | 'virtualized';
|
|
19
|
+
export interface ComboboxProps extends FieldBaseProps, FieldOptionProps, Omit<BaseCombobox.Root.Props<string, false, ComboboxOption>, 'children' | 'items' | 'multiple' | 'value' | 'defaultValue' | 'onValueChange' | 'inputRef' | UnsupportedRootProps> {
|
|
20
|
+
/** The choices, in order. */
|
|
12
21
|
options: ComboboxOption[];
|
|
22
|
+
/** Shown in the empty input. */
|
|
13
23
|
placeholder?: string;
|
|
24
|
+
/** The picked option's `value`, or `null` for none. Use with `onValueChange` to control it. */
|
|
14
25
|
value?: string | null;
|
|
26
|
+
/** The initially picked option's `value`, when uncontrolled. */
|
|
15
27
|
defaultValue?: string | null;
|
|
28
|
+
/** Called with the picked option's `value`, or `null` when cleared (Clear button, or a form reset). */
|
|
16
29
|
onValueChange?: (value: string | null) => void;
|
|
17
30
|
/** Shown when nothing matches the typed text. */
|
|
18
31
|
emptyMessage?: ReactNode;
|
|
32
|
+
/** Width of the dropdown when it should be wider than the field, e.g. `'24rem'`. Never narrower than the field. */
|
|
33
|
+
popupWidth?: string;
|
|
19
34
|
/** Where the dropdown renders. Defaults to the nearest `PortalContainer`, else `document.body`. */
|
|
20
35
|
portalContainer?: PortalContainerTarget;
|
|
21
36
|
/** Forwarded to the visible text input. */
|
|
22
37
|
ref?: Ref<HTMLInputElement>;
|
|
38
|
+
/** Goes on the field's root element. */
|
|
23
39
|
className?: string;
|
|
40
|
+
/** Accessible name of the Clear button. */
|
|
41
|
+
clearLabel?: string;
|
|
24
42
|
/** Props for the text input (role `combobox`), e.g. `{ 'data-testid': 'retailer' }`. */
|
|
25
43
|
inputProps?: PartProps<BaseCombobox.Input.Props>;
|
|
26
44
|
/** Props for the dropdown, e.g. `{ 'data-testid': 'retailer-options' }`. */
|
|
27
45
|
popupProps?: PartProps<BaseCombobox.Popup.Props>;
|
|
28
46
|
}
|
|
29
47
|
/** Filterable single-choice dropdown: type to narrow the options, then pick one. */
|
|
30
|
-
export declare function Combobox({ label, description, error, required,
|
|
31
|
-
export interface AutocompleteProps extends FieldBaseProps, FieldOptionProps, Omit<BaseAutocomplete.Root.Props<string>, 'children' | 'items' | 'value' | 'defaultValue'> {
|
|
48
|
+
export declare function Combobox({ label, description, error, required, hideLabel, fieldProps, disabled, className, options, placeholder, onValueChange, emptyMessage, popupWidth, portalContainer, ref, clearLabel, inputProps, popupProps, ...props }: ComboboxProps): import('react').JSX.Element;
|
|
49
|
+
export interface AutocompleteProps extends FieldBaseProps, FieldOptionProps, Omit<BaseAutocomplete.Root.Props<string>, 'children' | 'items' | 'value' | 'defaultValue' | UnsupportedRootProps> {
|
|
32
50
|
/** Suggestions shown while typing. Any text is allowed. */
|
|
33
51
|
suggestions: string[];
|
|
52
|
+
/** Shown in the empty input. */
|
|
34
53
|
placeholder?: string;
|
|
54
|
+
/** The text. Use with `onValueChange` to control it. */
|
|
35
55
|
value?: string;
|
|
56
|
+
/** The initial text, when uncontrolled. */
|
|
36
57
|
defaultValue?: string;
|
|
37
58
|
/** Where the suggestions render. Defaults to the nearest `PortalContainer`, else `document.body`. */
|
|
38
59
|
portalContainer?: PortalContainerTarget;
|
|
60
|
+
/** Forwarded to the text input. */
|
|
39
61
|
ref?: Ref<HTMLInputElement>;
|
|
62
|
+
/** Goes on the field's root element. */
|
|
40
63
|
className?: string;
|
|
41
64
|
/** Shows a Clear button while there's text. */
|
|
42
65
|
clearable?: boolean;
|
|
@@ -55,4 +78,5 @@ export interface AutocompleteProps extends FieldBaseProps, FieldOptionProps, Omi
|
|
|
55
78
|
popupProps?: PartProps<BaseAutocomplete.Popup.Props>;
|
|
56
79
|
}
|
|
57
80
|
/** Free-text input with suggestions. The value is whatever is typed or picked. */
|
|
58
|
-
export declare function Autocomplete({ label, description, error, required,
|
|
81
|
+
export declare function Autocomplete({ label, description, error, required, hideLabel, fieldProps, disabled, className, suggestions, placeholder, portalContainer, ref, clearable, clearLabel, onValueChange, onItemSelect, onClear, inputProps, popupProps, ...props }: AutocompleteProps): import('react').JSX.Element;
|
|
82
|
+
export {};
|
|
@@ -1,156 +1,177 @@
|
|
|
1
|
-
import { empty as e, frame as t, frameButton as n, frameInput as r, input as i,
|
|
2
|
-
import { Field as
|
|
3
|
-
import { usePortalContainer as
|
|
4
|
-
import { useMemo as
|
|
5
|
-
import { clsx as
|
|
6
|
-
import { Check as
|
|
7
|
-
import { jsx as
|
|
8
|
-
import { Autocomplete as
|
|
9
|
-
import { Combobox as
|
|
1
|
+
import { empty as e, frame as t, frameButton as n, frameInput as r, input as i, list as a, option as o, optionBody as s, optionIndicator as c, popup as l, positioner as u } from "../../styles/input.styles.js";
|
|
2
|
+
import { Field as d } from "../Field/Field.js";
|
|
3
|
+
import { usePortalContainer as f } from "../PortalContainer/PortalContainer.js";
|
|
4
|
+
import { useId as p, useMemo as m } from "react";
|
|
5
|
+
import { clsx as h } from "clsx";
|
|
6
|
+
import { Check as g, ChevronDown as _, X as v } from "lucide-react";
|
|
7
|
+
import { jsx as y, jsxs as b } from "react/jsx-runtime";
|
|
8
|
+
import { Autocomplete as x } from "@base-ui/react/autocomplete";
|
|
9
|
+
import { Combobox as S } from "@base-ui/react/combobox";
|
|
10
10
|
// src/components/Combobox/Combobox.tsx
|
|
11
|
-
function
|
|
12
|
-
let
|
|
11
|
+
function C({ label: i, description: x, error: C, required: w, hideLabel: T, fieldProps: E, disabled: D, className: O, options: k, placeholder: A, onValueChange: j, emptyMessage: M = "No matches", popupWidth: N, portalContainer: P, ref: F, clearLabel: I = "Clear", inputProps: L, popupProps: R, ...z }) {
|
|
12
|
+
let B = f(P), V = p(), H = m(() => S.createItems(k, {
|
|
13
13
|
getValue: (e) => e.value,
|
|
14
14
|
getLabel: (e) => e.label
|
|
15
|
-
}), [
|
|
16
|
-
return /* @__PURE__ */
|
|
17
|
-
...
|
|
15
|
+
}), [k]);
|
|
16
|
+
return /* @__PURE__ */ y(d, {
|
|
17
|
+
...E,
|
|
18
18
|
label: i,
|
|
19
|
-
description:
|
|
20
|
-
error:
|
|
21
|
-
required:
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
disabled: O,
|
|
33
|
-
onValueChange: (e) => M?.(e),
|
|
34
|
-
children: [/* @__PURE__ */ v(b.InputGroup, {
|
|
19
|
+
description: x,
|
|
20
|
+
error: C,
|
|
21
|
+
required: w,
|
|
22
|
+
hideLabel: T,
|
|
23
|
+
disabled: D,
|
|
24
|
+
className: h(E?.className, O),
|
|
25
|
+
children: /* @__PURE__ */ b(S.Root, {
|
|
26
|
+
...z,
|
|
27
|
+
items: H,
|
|
28
|
+
required: w,
|
|
29
|
+
disabled: D,
|
|
30
|
+
onValueChange: (e) => j?.(e),
|
|
31
|
+
children: [/* @__PURE__ */ b(S.InputGroup, {
|
|
35
32
|
className: t,
|
|
36
33
|
children: [
|
|
37
|
-
/* @__PURE__ */
|
|
38
|
-
|
|
39
|
-
...I,
|
|
34
|
+
/* @__PURE__ */ y(S.Input, {
|
|
35
|
+
...L,
|
|
40
36
|
ref: F,
|
|
41
|
-
placeholder:
|
|
42
|
-
className:
|
|
37
|
+
placeholder: A,
|
|
38
|
+
className: h(r, L?.className)
|
|
43
39
|
}),
|
|
44
|
-
/* @__PURE__ */
|
|
40
|
+
/* @__PURE__ */ y(S.Clear, {
|
|
45
41
|
className: n,
|
|
46
|
-
"aria-label":
|
|
47
|
-
children: /* @__PURE__ */
|
|
42
|
+
"aria-label": I,
|
|
43
|
+
children: /* @__PURE__ */ y(v, {
|
|
48
44
|
size: "1em",
|
|
49
45
|
"aria-hidden": !0
|
|
50
46
|
})
|
|
51
47
|
}),
|
|
52
|
-
/* @__PURE__ */
|
|
48
|
+
/* @__PURE__ */ y(S.Trigger, {
|
|
53
49
|
className: n,
|
|
54
|
-
children: /* @__PURE__ */ _
|
|
50
|
+
children: /* @__PURE__ */ y(_, {
|
|
55
51
|
size: "1.125em",
|
|
56
52
|
"aria-hidden": !0
|
|
57
53
|
})
|
|
58
54
|
})
|
|
59
55
|
]
|
|
60
|
-
}), /* @__PURE__ */
|
|
61
|
-
container:
|
|
62
|
-
children: /* @__PURE__ */
|
|
63
|
-
className:
|
|
56
|
+
}), /* @__PURE__ */ y(S.Portal, {
|
|
57
|
+
container: B,
|
|
58
|
+
children: /* @__PURE__ */ y(S.Positioner, {
|
|
59
|
+
className: u,
|
|
64
60
|
sideOffset: 4,
|
|
65
|
-
positionMethod:
|
|
66
|
-
children: /* @__PURE__ */
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
61
|
+
positionMethod: B ? "fixed" : "absolute",
|
|
62
|
+
children: /* @__PURE__ */ b(S.Popup, {
|
|
63
|
+
style: N ? { width: N } : void 0,
|
|
64
|
+
...R,
|
|
65
|
+
className: h(l, R?.className),
|
|
66
|
+
children: [/* @__PURE__ */ y(S.Empty, { children: /* @__PURE__ */ y("div", {
|
|
70
67
|
className: e,
|
|
71
|
-
children:
|
|
72
|
-
}) }), /* @__PURE__ */
|
|
73
|
-
value: e.value,
|
|
74
|
-
disabled: e.disabled,
|
|
68
|
+
children: M
|
|
69
|
+
}) }), /* @__PURE__ */ y(S.List, {
|
|
75
70
|
className: a,
|
|
76
|
-
children:
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
71
|
+
children: (e, t) => {
|
|
72
|
+
let n = `${V}-${t}`, r = e.description != null || e.detail != null;
|
|
73
|
+
return /* @__PURE__ */ b(S.Item, {
|
|
74
|
+
value: e.value,
|
|
75
|
+
disabled: e.disabled,
|
|
76
|
+
className: o,
|
|
77
|
+
"aria-labelledby": r ? `${n}-label` : void 0,
|
|
78
|
+
"aria-describedby": r ? h(e.description != null && `${n}-description`, e.detail != null && `${n}-detail`) : void 0,
|
|
79
|
+
children: [
|
|
80
|
+
/* @__PURE__ */ b("span", {
|
|
81
|
+
className: s,
|
|
82
|
+
children: [/* @__PURE__ */ y("span", {
|
|
83
|
+
id: `${n}-label`,
|
|
84
|
+
children: e.label
|
|
85
|
+
}), e.description != null && /* @__PURE__ */ y("span", {
|
|
86
|
+
id: `${n}-description`,
|
|
87
|
+
className: "_12aoxdma",
|
|
88
|
+
children: e.description
|
|
89
|
+
})]
|
|
90
|
+
}),
|
|
91
|
+
e.detail != null && /* @__PURE__ */ y("span", {
|
|
92
|
+
id: `${n}-detail`,
|
|
93
|
+
className: "_12aoxdmb",
|
|
94
|
+
children: e.detail
|
|
95
|
+
}),
|
|
96
|
+
/* @__PURE__ */ y(S.ItemIndicator, {
|
|
97
|
+
className: c,
|
|
98
|
+
children: /* @__PURE__ */ y(g, {
|
|
99
|
+
size: "1.14em",
|
|
100
|
+
"aria-hidden": !0
|
|
101
|
+
})
|
|
102
|
+
})
|
|
103
|
+
]
|
|
104
|
+
}, e.value);
|
|
105
|
+
}
|
|
106
|
+
})]
|
|
84
107
|
})
|
|
85
108
|
})
|
|
86
109
|
})]
|
|
87
110
|
})
|
|
88
111
|
});
|
|
89
112
|
}
|
|
90
|
-
function
|
|
91
|
-
let
|
|
92
|
-
return /* @__PURE__ */
|
|
93
|
-
...
|
|
113
|
+
function w({ label: e, description: s, error: c, required: p, hideLabel: m, fieldProps: g, disabled: _, className: S, suggestions: C, placeholder: w, portalContainer: T, ref: E, clearable: D = !1, clearLabel: O = "Clear", onValueChange: k, onItemSelect: A, onClear: j, inputProps: M, popupProps: N, ...P }) {
|
|
114
|
+
let F = f(T);
|
|
115
|
+
return /* @__PURE__ */ y(d, {
|
|
116
|
+
...g,
|
|
94
117
|
label: e,
|
|
95
|
-
description:
|
|
96
|
-
error:
|
|
97
|
-
required:
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
items: E,
|
|
107
|
-
required: m,
|
|
108
|
-
disabled: w,
|
|
118
|
+
description: s,
|
|
119
|
+
error: c,
|
|
120
|
+
required: p,
|
|
121
|
+
hideLabel: m,
|
|
122
|
+
disabled: _,
|
|
123
|
+
className: h(g?.className, S),
|
|
124
|
+
children: /* @__PURE__ */ b(x.Root, {
|
|
125
|
+
...P,
|
|
126
|
+
items: C,
|
|
127
|
+
required: p,
|
|
128
|
+
disabled: _,
|
|
109
129
|
onValueChange: (e, t) => {
|
|
110
|
-
|
|
130
|
+
k?.(e, t), t.reason === "item-press" && A?.(e), e === "" && (t.reason === "clear-press" || t.reason === "escape-key") && j?.();
|
|
111
131
|
},
|
|
112
|
-
children: [
|
|
132
|
+
children: [D ? /* @__PURE__ */ b(x.InputGroup, {
|
|
113
133
|
className: t,
|
|
114
|
-
children: [/* @__PURE__ */
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
}), /* @__PURE__ */ _(y.Clear, {
|
|
134
|
+
children: [/* @__PURE__ */ y(x.Input, {
|
|
135
|
+
...M,
|
|
136
|
+
ref: E,
|
|
137
|
+
placeholder: w,
|
|
138
|
+
className: h(r, M?.className)
|
|
139
|
+
}), /* @__PURE__ */ y(x.Clear, {
|
|
121
140
|
className: n,
|
|
122
|
-
"aria-label":
|
|
123
|
-
children: /* @__PURE__ */
|
|
141
|
+
"aria-label": O,
|
|
142
|
+
children: /* @__PURE__ */ y(v, {
|
|
124
143
|
size: "1em",
|
|
125
144
|
"aria-hidden": !0
|
|
126
145
|
})
|
|
127
146
|
})]
|
|
128
|
-
}) : /* @__PURE__ */
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
className: c,
|
|
147
|
+
}) : /* @__PURE__ */ y(x.Input, {
|
|
148
|
+
...M,
|
|
149
|
+
ref: E,
|
|
150
|
+
placeholder: w,
|
|
151
|
+
className: h(i, M?.className)
|
|
152
|
+
}), /* @__PURE__ */ y(x.Portal, {
|
|
153
|
+
container: F,
|
|
154
|
+
children: /* @__PURE__ */ y(x.Positioner, {
|
|
155
|
+
className: u,
|
|
138
156
|
sideOffset: 4,
|
|
139
|
-
positionMethod:
|
|
140
|
-
children: /* @__PURE__ */
|
|
141
|
-
...
|
|
142
|
-
className:
|
|
143
|
-
children: /* @__PURE__ */
|
|
144
|
-
value: e,
|
|
157
|
+
positionMethod: F ? "fixed" : "absolute",
|
|
158
|
+
children: /* @__PURE__ */ y(x.Popup, {
|
|
159
|
+
...N,
|
|
160
|
+
className: h(l, N?.className),
|
|
161
|
+
children: /* @__PURE__ */ y(x.List, {
|
|
145
162
|
className: a,
|
|
146
|
-
children: e
|
|
147
|
-
|
|
163
|
+
children: (e) => /* @__PURE__ */ y(x.Item, {
|
|
164
|
+
value: e,
|
|
165
|
+
className: o,
|
|
166
|
+
children: e
|
|
167
|
+
}, e)
|
|
168
|
+
})
|
|
148
169
|
})
|
|
149
170
|
})
|
|
150
171
|
})]
|
|
151
172
|
})
|
|
152
173
|
});
|
|
153
174
|
}
|
|
154
|
-
export {
|
|
175
|
+
export { w as Autocomplete, C as Combobox };
|
|
155
176
|
|
|
156
177
|
//# sourceMappingURL=Combobox.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Combobox.js","names":["Combobox","BaseCombobox","input.frame","input.frameInput","input.frameButton","input.positioner","input.popup","input.empty","option","input.option","input.optionIndicator","Autocomplete","BaseAutocomplete","input.input","Combobox$1","props","container","usePortalContainer","portalContainer","items","useMemo","Combobox","options","option","Field","fieldProps","clsx","className","onValueChange","value","frame","ariaRequired","required","showRequired","inputProps","frameInput","frameButton","X","ChevronDown","positioner","popupProps","popup","empty","emptyMessage","option$1","optionIndicator","Check","Autocomplete$1","Autocomplete","suggestions","next","details","onItemSelect","onClear","clearable","clearLabel","input","suggestion"],"sources":["../../../src/components/Combobox/Combobox.tsx"],"sourcesContent":["import { Autocomplete as BaseAutocomplete } from '@base-ui/react/autocomplete'\nimport { Combobox as BaseCombobox } from '@base-ui/react/combobox'\nimport { clsx } from 'clsx'\nimport { Check, ChevronDown, X } from 'lucide-react'\nimport { useMemo, type ReactNode, type Ref } from 'react'\n\nimport * as input from '../../styles/input.css'\nimport {\n ariaRequired,\n Field,\n type FieldBaseProps,\n type FieldOptionProps,\n type PartProps,\n} from '../Field/Field'\nimport { usePortalContainer, type PortalContainerTarget } from '../PortalContainer'\n\nexport interface ComboboxOption {\n value: string\n label: string\n disabled?: boolean\n}\n\nexport interface ComboboxProps\n extends\n FieldBaseProps,\n FieldOptionProps,\n Omit<\n BaseCombobox.Root.Props<string, false, ComboboxOption>,\n 'children' | 'items' | 'multiple' | 'value' | 'defaultValue' | 'onValueChange' | 'inputRef'\n > {\n options: ComboboxOption[]\n placeholder?: string\n value?: string | null\n defaultValue?: string | null\n onValueChange?: (value: string | null) => void\n /** Shown when nothing matches the typed text. */\n emptyMessage?: ReactNode\n /** Where the dropdown renders. Defaults to the nearest `PortalContainer`, else `document.body`. */\n portalContainer?: PortalContainerTarget\n /** Forwarded to the visible text input. */\n ref?: Ref<HTMLInputElement>\n className?: string\n /** Props for the text input (role `combobox`), e.g. `{ 'data-testid': 'retailer' }`. */\n inputProps?: PartProps<BaseCombobox.Input.Props>\n /** Props for the dropdown, e.g. `{ 'data-testid': 'retailer-options' }`. */\n popupProps?: PartProps<BaseCombobox.Popup.Props>\n}\n\n/** Filterable single-choice dropdown: type to narrow the options, then pick one. */\nexport function Combobox({\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,\n onValueChange,\n emptyMessage = 'No matches',\n portalContainer,\n ref,\n inputProps,\n popupProps,\n ...props\n}: ComboboxProps) {\n const container = usePortalContainer(portalContainer)\n const items = useMemo(\n () =>\n BaseCombobox.createItems(options, {\n getValue: (option) => option.value,\n getLabel: (option) => option.label,\n }),\n [options],\n )\n\n return (\n <Field\n {...fieldProps}\n label={label}\n description={description}\n error={error}\n required={required}\n showRequired={showRequired}\n requiredIndicator={requiredIndicator}\n optionalText={optionalText}\n hideLabel={hideLabel}\n disabled={disabled}\n className={clsx(fieldProps?.className, className)}\n >\n <BaseCombobox.Root\n {...props}\n items={items}\n required={required}\n disabled={disabled}\n onValueChange={(value) => onValueChange?.(value)}\n >\n <BaseCombobox.InputGroup className={input.frame}>\n <BaseCombobox.Input\n aria-required={ariaRequired(required, showRequired)}\n {...inputProps}\n ref={ref}\n placeholder={placeholder}\n className={clsx(input.frameInput, inputProps?.className)}\n />\n <BaseCombobox.Clear className={input.frameButton} aria-label=\"Clear\">\n <X size=\"1em\" aria-hidden />\n </BaseCombobox.Clear>\n <BaseCombobox.Trigger className={input.frameButton}>\n <ChevronDown size=\"1.125em\" aria-hidden />\n </BaseCombobox.Trigger>\n </BaseCombobox.InputGroup>\n <BaseCombobox.Portal container={container}>\n <BaseCombobox.Positioner\n className={input.positioner}\n sideOffset={4}\n positionMethod={container ? 'fixed' : 'absolute'}\n >\n <BaseCombobox.Popup\n {...popupProps}\n className={clsx(input.popup, popupProps?.className)}\n >\n <BaseCombobox.Empty>\n <div className={input.empty}>{emptyMessage}</div>\n </BaseCombobox.Empty>\n <BaseCombobox.List>\n {(option: ComboboxOption) => (\n <BaseCombobox.Item\n key={option.value}\n value={option.value}\n disabled={option.disabled}\n className={input.option}\n >\n {option.label}\n <BaseCombobox.ItemIndicator className={input.optionIndicator}>\n <Check size=\"1.14em\" aria-hidden />\n </BaseCombobox.ItemIndicator>\n </BaseCombobox.Item>\n )}\n </BaseCombobox.List>\n </BaseCombobox.Popup>\n </BaseCombobox.Positioner>\n </BaseCombobox.Portal>\n </BaseCombobox.Root>\n </Field>\n )\n}\n\nexport interface AutocompleteProps\n extends\n FieldBaseProps,\n FieldOptionProps,\n Omit<BaseAutocomplete.Root.Props<string>, 'children' | 'items' | 'value' | 'defaultValue'> {\n /** Suggestions shown while typing. Any text is allowed. */\n suggestions: string[]\n placeholder?: string\n value?: string\n defaultValue?: string\n /** Where the suggestions render. Defaults to the nearest `PortalContainer`, else `document.body`. */\n portalContainer?: PortalContainerTarget\n ref?: Ref<HTMLInputElement>\n className?: string\n /** Shows a Clear button while there's text. */\n clearable?: boolean\n /** Accessible name of the Clear button. */\n clearLabel?: string\n /**\n * Called when a suggestion is picked by click or Enter (not while typing or arrowing through the\n * list). `onValueChange` still fires for every change.\n */\n onItemSelect?: (value: string) => void\n /** Called when the text is cleared with the Clear button, or Escape while the suggestions are closed. Not when it's deleted by typing. */\n onClear?: () => void\n /** Props for the text input (role `combobox`), e.g. `{ 'data-testid': 'branch-filter' }`. */\n inputProps?: PartProps<BaseAutocomplete.Input.Props>\n /** Props for the suggestions popup. */\n popupProps?: PartProps<BaseAutocomplete.Popup.Props>\n}\n\n/** Free-text input with suggestions. The value is whatever is typed or picked. */\nexport function Autocomplete({\n label,\n description,\n error,\n required,\n showRequired,\n requiredIndicator,\n optionalText,\n hideLabel,\n fieldProps,\n disabled,\n className,\n suggestions,\n placeholder,\n portalContainer,\n ref,\n clearable = false,\n clearLabel = 'Clear',\n onValueChange,\n onItemSelect,\n onClear,\n inputProps,\n popupProps,\n ...props\n}: AutocompleteProps) {\n const container = usePortalContainer(portalContainer)\n return (\n <Field\n {...fieldProps}\n label={label}\n description={description}\n error={error}\n required={required}\n showRequired={showRequired}\n requiredIndicator={requiredIndicator}\n optionalText={optionalText}\n hideLabel={hideLabel}\n disabled={disabled}\n className={clsx(fieldProps?.className, className)}\n >\n <BaseAutocomplete.Root\n {...props}\n items={suggestions}\n required={required}\n disabled={disabled}\n onValueChange={(next, details) => {\n onValueChange?.(next, details)\n if (details.reason === 'item-press') onItemSelect?.(next)\n if (next === '' && (details.reason === 'clear-press' || details.reason === 'escape-key'))\n onClear?.()\n }}\n >\n {clearable ? (\n <BaseAutocomplete.InputGroup className={input.frame}>\n <BaseAutocomplete.Input\n aria-required={ariaRequired(required, showRequired)}\n {...inputProps}\n ref={ref}\n placeholder={placeholder}\n className={clsx(input.frameInput, inputProps?.className)}\n />\n <BaseAutocomplete.Clear className={input.frameButton} aria-label={clearLabel}>\n <X size=\"1em\" aria-hidden />\n </BaseAutocomplete.Clear>\n </BaseAutocomplete.InputGroup>\n ) : (\n <BaseAutocomplete.Input\n aria-required={ariaRequired(required, showRequired)}\n {...inputProps}\n ref={ref}\n placeholder={placeholder}\n className={clsx(input.input, inputProps?.className)}\n />\n )}\n <BaseAutocomplete.Portal container={container}>\n <BaseAutocomplete.Positioner\n className={input.positioner}\n sideOffset={4}\n positionMethod={container ? 'fixed' : 'absolute'}\n >\n <BaseAutocomplete.Popup\n {...popupProps}\n className={clsx(input.popup, popupProps?.className)}\n >\n <BaseAutocomplete.List>\n {(suggestion: string) => (\n <BaseAutocomplete.Item\n key={suggestion}\n value={suggestion}\n className={input.option}\n >\n {suggestion}\n </BaseAutocomplete.Item>\n )}\n </BaseAutocomplete.List>\n </BaseAutocomplete.Popup>\n </BaseAutocomplete.Positioner>\n </BaseAutocomplete.Portal>\n </BaseAutocomplete.Root>\n </Field>\n )\n}\n"],"mappings":";;;;;;;;;;AAiDA,SAAgBA,EAAS,EACvB,UACA,gBACA,UACA,aACA,iBACA,sBACA,iBACA,cACA,eACA,aACA,cACA,YACA,gBACA,kBACA,kBAAe,cACf,oBACA,QACA,eACA,eACA,GAAGe,KACa;CAChB,IAAMC,IAAYC,EAAmBC,CAAe,GAC9CC,IAAQC,QAEVnB,EAAa,YAAYqB,GAAS;EAChC,WAAW,MAAWC,EAAO;EAC7B,WAAW,MAAWA,EAAO;CAC/B,CAAC,GACH,CAACD,CAAO,CACV;CAEA,OACE,kBAACE,GAAD;EACE,GAAIC;EACG;EACM;EACN;EACG;EACI;EACK;EACL;EACH;EACD;EACV,WAAWC,EAAKD,GAAY,WA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B,OAAlB;MACE,GAAI4B;MACJ,WAAWd,EAAKpB,GAAakC,GAAY,SAAS;MAElD,UAAA,kBAAC5B,EAAiB,MAAlB,EAAA,WACI,MACA,kBAACA,EAAiB,MAAlB;OAEE,OAAO6C;OACP,WAAWhD;OAEV,UAAAgD;MACoB,GALhBA,CAKgB,EAEJ,CAAA;KACD,CAAA;IACG,CAAA;GACN,CAAA,CACJ;;CAClB,CAAA;AAEX"}
|
|
1
|
+
{"version":3,"file":"Combobox.js","names":["Combobox","BaseCombobox","input.frame","input.frameInput","input.frameButton","input.positioner","input.popup","input.empty","input.list","option","input.option","input.optionBody","input.optionIndicator","Autocomplete","BaseAutocomplete","input.input","Combobox$1","props","container","usePortalContainer","portalContainer","idPrefix","useId","items","useMemo","Combobox","options","option","Field","fieldProps","clsx","className","onValueChange","value","frame","inputProps","frameInput","frameButton","clearLabel","X","ChevronDown","positioner","popupWidth","popupProps","popup","empty","emptyMessage","list","id","index","extra","option$1","optionBody","optionIndicator","Check","Autocomplete$1","Autocomplete","suggestions","next","details","onItemSelect","onClear","clearable","input","suggestion"],"sources":["../../../src/components/Combobox/Combobox.tsx"],"sourcesContent":["import { Autocomplete as BaseAutocomplete } from '@base-ui/react/autocomplete'\nimport { Combobox as BaseCombobox } from '@base-ui/react/combobox'\nimport { clsx } from 'clsx'\nimport { Check, ChevronDown, X } from 'lucide-react'\nimport { useId, useMemo, type ReactNode, type Ref } from 'react'\n\nimport * as input from '../../styles/input.css'\nimport { Field, type FieldBaseProps, type FieldOptionProps, type PartProps } from '../Field/Field'\nimport { usePortalContainer, type PortalContainerTarget } from '../PortalContainer'\n\nexport interface ComboboxOption {\n /** What `value` and `onValueChange` use. Unique within the options. */\n value: string\n /** The text shown in the list and, once picked, in the input. Typing filters on it. */\n label: string\n /** A muted line under the label in the list. Screen readers announce it as the option's description. Not filtered on. */\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\n// Options are always `{ value, label }` strings, so these Base UI props would only break matching or rendering.\ntype UnsupportedRootProps =\n | 'isItemEqualToValue'\n | 'itemToStringLabel'\n | 'itemToStringValue'\n | 'filteredItems'\n | 'grid'\n | 'inline'\n | 'virtualized'\n\nexport interface ComboboxProps\n extends\n FieldBaseProps,\n FieldOptionProps,\n Omit<\n BaseCombobox.Root.Props<string, false, ComboboxOption>,\n | 'children'\n | 'items'\n | 'multiple'\n | 'value'\n | 'defaultValue'\n | 'onValueChange'\n | 'inputRef'\n | UnsupportedRootProps\n > {\n /** The choices, in order. */\n options: ComboboxOption[]\n /** Shown in the empty input. */\n placeholder?: string\n /** The picked option's `value`, or `null` for none. Use with `onValueChange` to control it. */\n value?: string | null\n /** The initially picked option's `value`, when uncontrolled. */\n defaultValue?: string | null\n /** Called with the picked option's `value`, or `null` when cleared (Clear button, or a form reset). */\n onValueChange?: (value: string | null) => void\n /** Shown when nothing matches the typed text. */\n emptyMessage?: 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 /** Forwarded to the visible text input. */\n ref?: Ref<HTMLInputElement>\n /** Goes on the field's root element. */\n className?: string\n /** Accessible name of the Clear button. */\n clearLabel?: string\n /** Props for the text input (role `combobox`), e.g. `{ 'data-testid': 'retailer' }`. */\n inputProps?: PartProps<BaseCombobox.Input.Props>\n /** Props for the dropdown, e.g. `{ 'data-testid': 'retailer-options' }`. */\n popupProps?: PartProps<BaseCombobox.Popup.Props>\n}\n\n/** Filterable single-choice dropdown: type to narrow the options, then pick one. */\nexport function Combobox({\n label,\n description,\n error,\n required,\n hideLabel,\n fieldProps,\n disabled,\n className,\n options,\n placeholder,\n onValueChange,\n emptyMessage = 'No matches',\n popupWidth,\n portalContainer,\n ref,\n clearLabel = 'Clear',\n inputProps,\n popupProps,\n ...props\n}: ComboboxProps) {\n const container = usePortalContainer(portalContainer)\n const idPrefix = useId()\n const items = useMemo(\n () =>\n BaseCombobox.createItems(options, {\n getValue: (option) => option.value,\n getLabel: (option) => option.label,\n }),\n [options],\n )\n\n return (\n <Field\n {...fieldProps}\n label={label}\n description={description}\n error={error}\n required={required}\n hideLabel={hideLabel}\n disabled={disabled}\n className={clsx(fieldProps?.className, className)}\n >\n <BaseCombobox.Root\n {...props}\n items={items}\n required={required}\n disabled={disabled}\n onValueChange={(value) => onValueChange?.(value)}\n >\n <BaseCombobox.InputGroup className={input.frame}>\n <BaseCombobox.Input\n {...inputProps}\n ref={ref}\n placeholder={placeholder}\n className={clsx(input.frameInput, inputProps?.className)}\n />\n <BaseCombobox.Clear className={input.frameButton} aria-label={clearLabel}>\n <X size=\"1em\" aria-hidden />\n </BaseCombobox.Clear>\n <BaseCombobox.Trigger className={input.frameButton}>\n <ChevronDown size=\"1.125em\" aria-hidden />\n </BaseCombobox.Trigger>\n </BaseCombobox.InputGroup>\n <BaseCombobox.Portal container={container}>\n <BaseCombobox.Positioner\n className={input.positioner}\n sideOffset={4}\n positionMethod={container ? 'fixed' : 'absolute'}\n >\n <BaseCombobox.Popup\n style={popupWidth ? { width: popupWidth } : undefined}\n {...popupProps}\n className={clsx(input.popup, popupProps?.className)}\n >\n <BaseCombobox.Empty>\n <div className={input.empty}>{emptyMessage}</div>\n </BaseCombobox.Empty>\n <BaseCombobox.List className={input.list}>\n {(option: ComboboxOption, index: number) => {\n const id = `${idPrefix}-${index}`\n const extra = option.description != null || option.detail != null\n return (\n <BaseCombobox.Item\n key={option.value}\n value={option.value}\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 <span id={`${id}-label`}>{option.label}</span>\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 <BaseCombobox.ItemIndicator className={input.optionIndicator}>\n <Check size=\"1.14em\" aria-hidden />\n </BaseCombobox.ItemIndicator>\n </BaseCombobox.Item>\n )\n }}\n </BaseCombobox.List>\n </BaseCombobox.Popup>\n </BaseCombobox.Positioner>\n </BaseCombobox.Portal>\n </BaseCombobox.Root>\n </Field>\n )\n}\n\nexport interface AutocompleteProps\n extends\n FieldBaseProps,\n FieldOptionProps,\n Omit<\n BaseAutocomplete.Root.Props<string>,\n 'children' | 'items' | 'value' | 'defaultValue' | UnsupportedRootProps\n > {\n /** Suggestions shown while typing. Any text is allowed. */\n suggestions: string[]\n /** Shown in the empty input. */\n placeholder?: string\n /** The text. Use with `onValueChange` to control it. */\n value?: string\n /** The initial text, when uncontrolled. */\n defaultValue?: string\n /** Where the suggestions render. Defaults to the nearest `PortalContainer`, else `document.body`. */\n portalContainer?: PortalContainerTarget\n /** Forwarded to the text input. */\n ref?: Ref<HTMLInputElement>\n /** Goes on the field's root element. */\n className?: string\n /** Shows a Clear button while there's text. */\n clearable?: boolean\n /** Accessible name of the Clear button. */\n clearLabel?: string\n /**\n * Called when a suggestion is picked by click or Enter (not while typing or arrowing through the\n * list). `onValueChange` still fires for every change.\n */\n onItemSelect?: (value: string) => void\n /** Called when the text is cleared with the Clear button, or Escape while the suggestions are closed. Not when it's deleted by typing. */\n onClear?: () => void\n /** Props for the text input (role `combobox`), e.g. `{ 'data-testid': 'branch-filter' }`. */\n inputProps?: PartProps<BaseAutocomplete.Input.Props>\n /** Props for the suggestions popup. */\n popupProps?: PartProps<BaseAutocomplete.Popup.Props>\n}\n\n/** Free-text input with suggestions. The value is whatever is typed or picked. */\nexport function Autocomplete({\n label,\n description,\n error,\n required,\n hideLabel,\n fieldProps,\n disabled,\n className,\n suggestions,\n placeholder,\n portalContainer,\n ref,\n clearable = false,\n clearLabel = 'Clear',\n onValueChange,\n onItemSelect,\n onClear,\n inputProps,\n popupProps,\n ...props\n}: AutocompleteProps) {\n const container = usePortalContainer(portalContainer)\n return (\n <Field\n {...fieldProps}\n label={label}\n description={description}\n error={error}\n required={required}\n hideLabel={hideLabel}\n disabled={disabled}\n className={clsx(fieldProps?.className, className)}\n >\n <BaseAutocomplete.Root\n {...props}\n items={suggestions}\n required={required}\n disabled={disabled}\n onValueChange={(next, details) => {\n onValueChange?.(next, details)\n if (details.reason === 'item-press') onItemSelect?.(next)\n if (next === '' && (details.reason === 'clear-press' || details.reason === 'escape-key'))\n onClear?.()\n }}\n >\n {clearable ? (\n <BaseAutocomplete.InputGroup className={input.frame}>\n <BaseAutocomplete.Input\n {...inputProps}\n ref={ref}\n placeholder={placeholder}\n className={clsx(input.frameInput, inputProps?.className)}\n />\n <BaseAutocomplete.Clear className={input.frameButton} aria-label={clearLabel}>\n <X size=\"1em\" aria-hidden />\n </BaseAutocomplete.Clear>\n </BaseAutocomplete.InputGroup>\n ) : (\n <BaseAutocomplete.Input\n {...inputProps}\n ref={ref}\n placeholder={placeholder}\n className={clsx(input.input, inputProps?.className)}\n />\n )}\n <BaseAutocomplete.Portal container={container}>\n <BaseAutocomplete.Positioner\n className={input.positioner}\n sideOffset={4}\n positionMethod={container ? 'fixed' : 'absolute'}\n >\n <BaseAutocomplete.Popup\n {...popupProps}\n className={clsx(input.popup, popupProps?.className)}\n >\n <BaseAutocomplete.List className={input.list}>\n {(suggestion: string) => (\n <BaseAutocomplete.Item\n key={suggestion}\n value={suggestion}\n className={input.option}\n >\n {suggestion}\n </BaseAutocomplete.Item>\n )}\n </BaseAutocomplete.List>\n </BaseAutocomplete.Popup>\n </BaseAutocomplete.Positioner>\n </BaseAutocomplete.Portal>\n </BaseAutocomplete.Root>\n </Field>\n )\n}\n"],"mappings":";;;;;;;;;;AA6EA,SAAgBA,EAAS,EACvB,UACA,gBACA,UACA,aACA,cACA,eACA,aACA,cACA,YACA,gBACA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 @@
|
|
|
1
|
+
import { ButtonProps } from '../Button';
|
|
2
|
+
export interface CopyButtonProps extends Omit<ButtonProps, 'children' | 'icon' | 'iconOnly' | 'loading' | 'loadingLabel' | 'render'> {
|
|
3
|
+
/** The text copied to the clipboard. */
|
|
4
|
+
value: string;
|
|
5
|
+
/** Accessible name. Default "Copy"; say what's copied, e.g. "Copy run ID". */
|
|
6
|
+
label?: string;
|
|
7
|
+
/** Announced after copying. Default "Copied". */
|
|
8
|
+
copiedLabel?: string;
|
|
9
|
+
}
|
|
10
|
+
/** Icon button that copies `value` to the clipboard, shows a check briefly and announces it. */
|
|
11
|
+
export declare function CopyButton({ value, label, copiedLabel, variant, size, onClick, ...props }: CopyButtonProps): import('react').JSX.Element;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { visuallyHidden as e } from "../../styles/shared.styles.js";
|
|
2
|
+
import { Button as t } from "../Button/Button.js";
|
|
3
|
+
import { useEffect as n, useRef as r, useState as i } from "react";
|
|
4
|
+
import { Check as a, Copy as o } from "lucide-react";
|
|
5
|
+
import { Fragment as s, jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
6
|
+
// src/components/CopyButton/CopyButton.tsx
|
|
7
|
+
var u = 1500;
|
|
8
|
+
function d({ value: d, label: f = "Copy", copiedLabel: p = "Copied", variant: m = "ghost", size: h = "sm", onClick: g, ..._ }) {
|
|
9
|
+
let [v, y] = i(!1), b = r(void 0);
|
|
10
|
+
n(() => () => clearTimeout(b.current), []);
|
|
11
|
+
let x = async () => {
|
|
12
|
+
try {
|
|
13
|
+
await navigator.clipboard.writeText(d);
|
|
14
|
+
} catch {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
y(!0), clearTimeout(b.current), b.current = setTimeout(() => y(!1), u);
|
|
18
|
+
}, S = (e) => {
|
|
19
|
+
g?.(e), e.defaultPrevented || x();
|
|
20
|
+
}, C = v ? a : o;
|
|
21
|
+
return /* @__PURE__ */ l(s, { children: [/* @__PURE__ */ c(t, {
|
|
22
|
+
..._,
|
|
23
|
+
variant: m,
|
|
24
|
+
size: h,
|
|
25
|
+
iconOnly: !0,
|
|
26
|
+
icon: /* @__PURE__ */ c(C, {
|
|
27
|
+
size: "1.08em",
|
|
28
|
+
"aria-hidden": !0
|
|
29
|
+
}),
|
|
30
|
+
onClick: S,
|
|
31
|
+
children: f
|
|
32
|
+
}), /* @__PURE__ */ c("span", {
|
|
33
|
+
role: "status",
|
|
34
|
+
className: e,
|
|
35
|
+
children: v ? p : ""
|
|
36
|
+
})] });
|
|
37
|
+
}
|
|
38
|
+
export { d as CopyButton };
|
|
39
|
+
|
|
40
|
+
//# sourceMappingURL=CopyButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CopyButton.js","names":["_Fragment","RESET_MS","CopyButton","props","copied","setCopied","useState","timer","useRef","copy","value","handleClick","onClick","event","Glyph","Check","Copy","Fragment","Button","label","visuallyHidden","copiedLabel"],"sources":["../../../src/components/CopyButton/CopyButton.tsx"],"sourcesContent":["import { Check, Copy } from 'lucide-react'\nimport { useEffect, useRef, useState, type MouseEvent } from 'react'\n\nimport { visuallyHidden } from '../../styles/shared.css'\nimport { Button, type ButtonProps } from '../Button'\n\nexport interface CopyButtonProps extends Omit<\n ButtonProps,\n 'children' | 'icon' | 'iconOnly' | 'loading' | 'loadingLabel' | 'render'\n> {\n /** The text copied to the clipboard. */\n value: string\n /** Accessible name. Default \"Copy\"; say what's copied, e.g. \"Copy run ID\". */\n label?: string\n /** Announced after copying. Default \"Copied\". */\n copiedLabel?: string\n}\n\nconst RESET_MS = 1500\n\n/** Icon button that copies `value` to the clipboard, shows a check briefly and announces it. */\nexport function CopyButton({\n value,\n label = 'Copy',\n copiedLabel = 'Copied',\n variant = 'ghost',\n size = 'sm',\n onClick,\n ...props\n}: CopyButtonProps) {\n const [copied, setCopied] = useState(false)\n const timer = useRef<ReturnType<typeof setTimeout>>(undefined)\n useEffect(() => () => clearTimeout(timer.current), [])\n\n const copy = async () => {\n try {\n await navigator.clipboard.writeText(value)\n } catch {\n return // Clipboard blocked (permissions or insecure context): leave the icon unchanged.\n }\n setCopied(true)\n clearTimeout(timer.current)\n timer.current = setTimeout(() => setCopied(false), RESET_MS)\n }\n\n const handleClick = (event: MouseEvent<HTMLButtonElement>) => {\n onClick?.(event)\n if (!event.defaultPrevented) void copy()\n }\n\n const Glyph = copied ? Check : Copy\n return (\n <>\n <Button\n {...props}\n variant={variant}\n size={size}\n iconOnly\n icon={<Glyph size=\"1.08em\" aria-hidden />}\n onClick={handleClick}\n >\n {label}\n </Button>\n {/* Kept mounted so screen readers notice when the text appears. */}\n <span role=\"status\" className={visuallyHidden}>\n {copied ? copiedLabel : ''}\n </span>\n </>\n )\n}\n"],"mappings":";;;;;;AAkBA,IAAMC,IAAW;AAGjB,SAAgBC,EAAW,EACzB,UACA,WAAQ,QACR,iBAAc,UACd,aAAU,SACV,UAAO,MACP,YACA,GAAGC,KACe;CAClB,IAAM,CAACC,GAAQC,KAAaC,EAAS,EAAK,GACpCC,IAAQC,EAAsC,KAAA,CAAS;CAC7D,cAAsB,aAAaD,EAAM,OAAO,GAAG,CAAC,CAAC;CAErD,IAAME,IAAO,YAAY;EACvB,IAAI;GACF,MAAM,UAAU,UAAU,UAAUC,CAAK;EAC3C,QAAQ;GACN;EACF;EAGA,AAFAL,EAAU,EAAI,GACd,aAAaE,EAAM,OAAO,GAC1B,EAAM,UAAU,iBAAiBF,EAAU,EAAK,GAAGJ,CAAQ;CAC7D,GAEMU,KAAe,MAAyC;EAE5D,AADAC,IAAUC,CAAK,GACVA,EAAM,oBAAkBJ,EAAU;CACzC,GAEMK,IAAQV,IAASW,IAAQC;CAC/B,OACE,kBAAAhB,GAAA,EAAA,UAAA,CACE,kBAACkB,GAAD;EACE,GAAIf;EACK;EACH;EACN,UAAA;EACA,MAAM,kBAACW,GAAD;GAAO,MAAK;GAAS,eAAA;EAAa,CAAA;EACxC,SAASH;EAER,UAAAQ;CACK,CAAA,GAER,kBAAC,QAAD;EAAM,MAAK;EAAS,WAAWC;EAC5B,UAAAhB,IAASiB,IAAc;CACpB,CAAA,CACN,EAAA,CAAA;AAEN"}
|
|
@@ -4,7 +4,9 @@ import { DateRange, DateRangePreset } from './presets';
|
|
|
4
4
|
import { FieldBaseProps, FieldOptionProps, PartProps } from '../Field/Field';
|
|
5
5
|
import { PortalContainerTarget } from '../PortalContainer';
|
|
6
6
|
export interface DateRangePickerProps extends FieldBaseProps, FieldOptionProps {
|
|
7
|
+
/** The applied range, for a controlled picker. Use with `onValueChange`. */
|
|
7
8
|
value?: DateRange;
|
|
9
|
+
/** The initial range, for an uncontrolled picker. */
|
|
8
10
|
defaultValue?: DateRange;
|
|
9
11
|
/**
|
|
10
12
|
* Called with the new range on Apply or when a quick range is chosen. `details.preset` is the
|
|
@@ -17,9 +19,9 @@ export interface DateRangePickerProps extends FieldBaseProps, FieldOptionProps {
|
|
|
17
19
|
placeholder?: string;
|
|
18
20
|
/** Quick ranges beside the calendar. Replaces the defaults; `[]` hides the list. */
|
|
19
21
|
presets?: DateRangePreset[];
|
|
20
|
-
/** Earliest selectable day. */
|
|
22
|
+
/** Earliest selectable day. Ranges, including quick ranges, are clamped to start no earlier. */
|
|
21
23
|
minDate?: Date;
|
|
22
|
-
/** Latest selectable day. */
|
|
24
|
+
/** Latest selectable day. Ranges, including quick ranges, are clamped to end by the end of it. */
|
|
23
25
|
maxDate?: Date;
|
|
24
26
|
/** First day of the week (0 is Sunday). */
|
|
25
27
|
weekStartsOn?: 0 | 1 | 2 | 3 | 4 | 5 | 6;
|
|
@@ -31,10 +33,15 @@ export interface DateRangePickerProps extends FieldBaseProps, FieldOptionProps {
|
|
|
31
33
|
timeZone?: string;
|
|
32
34
|
/** Where the popup renders. Defaults to the nearest `PortalContainer`, else `document.body`. */
|
|
33
35
|
portalContainer?: PortalContainerTarget;
|
|
36
|
+
/** Accessible name of the quick ranges list. */
|
|
34
37
|
presetsLabel?: string;
|
|
38
|
+
/** Text of the button that applies the picked range. */
|
|
35
39
|
applyLabel?: string;
|
|
40
|
+
/** Text of the button that discards the picked range. */
|
|
36
41
|
cancelLabel?: string;
|
|
42
|
+
/** Label of the start time input (with `withTime`). */
|
|
37
43
|
startTimeLabel?: string;
|
|
44
|
+
/** Label of the end time input (with `withTime`). */
|
|
38
45
|
endTimeLabel?: string;
|
|
39
46
|
/** Goes on the field root. */
|
|
40
47
|
className?: string;
|
|
@@ -48,4 +55,4 @@ export interface DateRangePickerProps extends FieldBaseProps, FieldOptionProps {
|
|
|
48
55
|
* Clicking a quick range applies it straight away; calendar picks apply with the Apply button.
|
|
49
56
|
* Escape or Cancel discards the draft.
|
|
50
57
|
*/
|
|
51
|
-
export declare function DateRangePicker({ label, description, error, required,
|
|
58
|
+
export declare function DateRangePicker({ label, description, error, required, hideLabel, fieldProps, disabled, className, value, defaultValue, onValueChange, placeholder, presets, minDate, maxDate, weekStartsOn, locale, withTime, timeZone, portalContainer, presetsLabel, applyLabel, cancelLabel, startTimeLabel, endTimeLabel, triggerProps, popupProps, }: DateRangePickerProps): import('react').JSX.Element;
|