@15gifts/back-office-kit 0.1.0-alpha.0 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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 +8 -3
- 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
|
@@ -3,9 +3,20 @@ import { visuallyHidden as t } from "../../styles/shared.styles.js";
|
|
|
3
3
|
import { clsx as n } from "clsx";
|
|
4
4
|
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
5
5
|
// src/components/EnvironmentChip/EnvironmentChip.tsx
|
|
6
|
-
|
|
6
|
+
var a = [
|
|
7
|
+
[/pre-?prod|stag|uat|\bqa\b|test/, "highlight"],
|
|
8
|
+
[/prod|live/, "danger"],
|
|
9
|
+
[/dev|ephemeral|preview|sandbox|demo/, "info"]
|
|
10
|
+
];
|
|
11
|
+
function o(e) {
|
|
12
|
+
let t = e.toLowerCase();
|
|
13
|
+
return a.find(([e]) => e.test(t))?.[1] ?? "neutral";
|
|
14
|
+
}
|
|
15
|
+
function s({ environment: a, className: s, ...c }) {
|
|
16
|
+
let l = o(a);
|
|
7
17
|
return /* @__PURE__ */ i("span", {
|
|
8
|
-
className: n(e({ tone:
|
|
18
|
+
className: n(e({ tone: l }), s),
|
|
19
|
+
"data-tone": l,
|
|
9
20
|
...c,
|
|
10
21
|
children: [/* @__PURE__ */ r("span", {
|
|
11
22
|
"aria-hidden": !0,
|
|
@@ -16,6 +27,6 @@ function a({ environment: a, tone: o = "highlight", className: s, ...c }) {
|
|
|
16
27
|
}), a] })]
|
|
17
28
|
});
|
|
18
29
|
}
|
|
19
|
-
export {
|
|
30
|
+
export { s as EnvironmentChip, o as environmentTone };
|
|
20
31
|
|
|
21
32
|
//# sourceMappingURL=EnvironmentChip.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EnvironmentChip.js","names":["styles.chip","EnvironmentChip","props","clsx","chip","className","visuallyHidden"
|
|
1
|
+
{"version":3,"file":"EnvironmentChip.js","names":["styles.chip","TONES","environmentTone","name","environment","pattern","EnvironmentChip","props","tone","clsx","chip","className","visuallyHidden"],"sources":["../../../src/components/EnvironmentChip/EnvironmentChip.tsx"],"sourcesContent":["import { clsx } from 'clsx'\nimport type { ComponentProps } from 'react'\n\nimport * as styles from './EnvironmentChip.css'\nimport { visuallyHidden } from '../../styles/shared.css'\n\nexport type EnvironmentTone = 'danger' | 'highlight' | 'info' | 'neutral'\n\nconst TONES: [RegExp, EnvironmentTone][] = [\n // Checked in order: \"preprod\" is a test environment, not production.\n [/pre-?prod|stag|uat|\\bqa\\b|test/, 'highlight'],\n [/prod|live/, 'danger'],\n [/dev|ephemeral|preview|sandbox|demo/, 'info'],\n]\n\n/**\n * The colour an environment name gets: production and live are `danger`; staging, UAT, QA, test\n * and pre-prod are `highlight`; dev, ephemeral, preview, sandbox and demo are `info`; anything\n * else (e.g. local) is `neutral`.\n */\nexport function environmentTone(environment: string): EnvironmentTone {\n const name = environment.toLowerCase()\n return TONES.find(([pattern]) => pattern.test(name))?.[1] ?? 'neutral'\n}\n\nexport interface EnvironmentChipProps extends ComponentProps<'span'> {\n /** Environment name, shown as given, e.g. \"Staging\". Its colour comes from the name (see `environmentTone`). */\n environment: string\n}\n\n/**\n * Shows which environment the app is pointed at, coloured by its name so production always stands\n * out. Put it in the TopBar `end` slot.\n */\nexport function EnvironmentChip({ environment, className, ...props }: EnvironmentChipProps) {\n const tone = environmentTone(environment)\n return (\n <span className={clsx(styles.chip({ tone }), className)} data-tone={tone} {...props}>\n <span aria-hidden>●</span>\n <span>\n <span className={visuallyHidden}>Environment: </span>\n {environment}\n </span>\n </span>\n )\n}\n"],"mappings":";;;;;AAQA,IAAMC,IAAqC;CAEzC,CAAC,kCAAkC,WAAW;CAC9C,CAAC,aAAa,QAAQ;CACtB,CAAC,sCAAsC,MAAM;AAC/C;AAOA,SAAgBC,EAAgB,GAAsC;CACpE,IAAMC,IAAOC,EAAY,YAAY;CACrC,OAAOH,EAAM,MAAM,CAACI,OAAaA,EAAQ,KAAKF,CAAI,CAAC,CAAC,GAAG,MAAM;AAC/D;AAWA,SAAgBG,EAAgB,EAAE,gBAAa,cAAW,GAAGC,KAA+B;CAC1F,IAAMC,IAAON,EAAgBE,CAAW;CACxC,OACE,kBAAC,QAAD;EAAM,WAAWK,EAAKT,EAAY,EAAE,QAAK,CAAC,GAAGW,CAAS;EAAG,aAAWH;EAAM,GAAID;EAA9E,UAAA,CACE,kBAAC,QAAD;GAAM,eAAA;GAAY,UAAA;EAAO,CAAA,GACzB,kBAAC,QAAD,EAAA,UAAA,CACE,kBAAC,QAAD;GAAM,WAAWK;GAAgB,UAAA;EAAmB,CAAA,GACnDR,CACG,EAAA,CAAA,CACF;;AAEV"}
|
|
@@ -6,9 +6,10 @@ var t = e({
|
|
|
6
6
|
variantClassNames: { tone: {
|
|
7
7
|
highlight: "_1iu246r1",
|
|
8
8
|
danger: "_1iu246r2",
|
|
9
|
-
|
|
9
|
+
info: "_1iu246r3",
|
|
10
|
+
neutral: "_1iu246r4"
|
|
10
11
|
} },
|
|
11
|
-
defaultVariants: {
|
|
12
|
+
defaultVariants: {},
|
|
12
13
|
compoundVariants: []
|
|
13
14
|
});
|
|
14
15
|
export { t as chip };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EnvironmentChip.styles.js","names":["_7a468","chip","createRuntimeFn"],"sources":["../../../src/components/EnvironmentChip/EnvironmentChip.css.ts"],"sourcesContent":["import { recipe } from '@vanilla-extract/recipes'\n\nimport { vars } from '../../tokens/contract.css'\nimport { fontSize, fontWeight, radius, space } from '../../tokens/scale'\n\nexport const chip = recipe({\n base: {\n display: 'inline-flex',\n alignItems: 'center',\n gap: space['1.5'],\n height: '1.75rem',\n paddingInline: space['2.5'],\n borderRadius: radius.full,\n border: '1px solid',\n fontFamily: vars.font.sans,\n fontSize: fontSize.xs,\n fontWeight: fontWeight.medium,\n
|
|
1
|
+
{"version":3,"file":"EnvironmentChip.styles.js","names":["_7a468","chip","createRuntimeFn"],"sources":["../../../src/components/EnvironmentChip/EnvironmentChip.css.ts"],"sourcesContent":["import { recipe } from '@vanilla-extract/recipes'\n\nimport { vars } from '../../tokens/contract.css'\nimport { fontSize, fontWeight, radius, space } from '../../tokens/scale'\n\nexport const chip = recipe({\n base: {\n display: 'inline-flex',\n alignItems: 'center',\n gap: space['1.5'],\n height: '1.75rem',\n paddingInline: space['2.5'],\n borderRadius: radius.full,\n border: '1px solid',\n fontFamily: vars.font.sans,\n fontSize: fontSize.xs,\n fontWeight: fontWeight.medium,\n whiteSpace: 'nowrap',\n },\n variants: {\n tone: {\n highlight: {\n backgroundColor: vars.color.highlightSubtle,\n borderColor: vars.color.highlight,\n color: vars.color.highlightInk,\n },\n danger: {\n backgroundColor: vars.color.dangerSubtle,\n borderColor: vars.color.danger,\n color: vars.color.dangerInk,\n },\n info: {\n backgroundColor: vars.color.infoSubtle,\n borderColor: vars.color.info,\n color: vars.color.infoInk,\n },\n neutral: {\n backgroundColor: vars.color.neutralSubtle,\n borderColor: vars.color.border,\n color: vars.color.neutralInk,\n },\n },\n },\n})\n"],"mappings":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { EnvironmentChip } from './EnvironmentChip';
|
|
2
|
-
export type { EnvironmentChipProps } from './EnvironmentChip';
|
|
1
|
+
export { EnvironmentChip, environmentTone } from './EnvironmentChip';
|
|
2
|
+
export type { EnvironmentChipProps, EnvironmentTone } from './EnvironmentChip';
|
|
@@ -3,7 +3,6 @@ export declare const messageInset: `var(--${string})`;
|
|
|
3
3
|
export declare const root: string;
|
|
4
4
|
export declare const label: string;
|
|
5
5
|
export declare const required: string;
|
|
6
|
-
export declare const optional: string;
|
|
7
6
|
export declare const description: string;
|
|
8
7
|
export declare const error: string;
|
|
9
8
|
export declare const errorIcon: string;
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { Field as BaseField } from '@base-ui/react/field';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
-
/** How a field marks whether it's required. */
|
|
4
|
-
export type RequiredIndicator = 'asterisk' | 'optional-note' | 'none';
|
|
5
3
|
/** The label, description and error props every input shares. */
|
|
6
4
|
export interface FieldBaseProps {
|
|
7
5
|
/** Visible label, also the input's accessible name. */
|
|
@@ -10,8 +8,12 @@ export interface FieldBaseProps {
|
|
|
10
8
|
description?: ReactNode;
|
|
11
9
|
/** Error message. When set, the input is marked invalid and the message is announced. */
|
|
12
10
|
error?: ReactNode;
|
|
13
|
-
/**
|
|
11
|
+
/**
|
|
12
|
+
* Native `required`: the label gets an asterisk and the browser blocks submitting an empty
|
|
13
|
+
* field. When a form library validates instead, keep `required` and put `noValidate` on the `<form>`.
|
|
14
|
+
*/
|
|
14
15
|
required?: boolean;
|
|
16
|
+
/** Disables the input and greys out the label. */
|
|
15
17
|
disabled?: boolean;
|
|
16
18
|
}
|
|
17
19
|
/** `data-*` attributes, e.g. `{ 'data-testid': 'name-field' }`. */
|
|
@@ -24,47 +26,28 @@ export type PartProps<P> = Partial<Omit<P, 'className' | 'children'>> & {
|
|
|
24
26
|
} & DataAttributes;
|
|
25
27
|
/** Props for the `Field` root element (the wrapper around label, input and messages). */
|
|
26
28
|
export type FieldRootProps = Omit<BaseField.Root.Props, 'children' | 'invalid' | 'disabled'> & DataAttributes;
|
|
27
|
-
/**
|
|
28
|
-
export interface
|
|
29
|
-
/**
|
|
30
|
-
* `asterisk` (default) marks required fields with `*`. `optional-note` instead adds `optionalText`
|
|
31
|
-
* to fields that aren't required. `none` shows neither.
|
|
32
|
-
*/
|
|
33
|
-
requiredIndicator?: RequiredIndicator;
|
|
34
|
-
/**
|
|
35
|
-
* Shows the field as required (marker and `aria-required`) without native `required`, e.g. when
|
|
36
|
-
* a form library validates instead of the browser.
|
|
37
|
-
*/
|
|
38
|
-
showRequired?: boolean;
|
|
39
|
-
/** Text for `requiredIndicator="optional-note"`. */
|
|
40
|
-
optionalText?: ReactNode;
|
|
41
|
-
}
|
|
42
|
-
/** How the label shows: required/optional markers, and whether it's visible at all. */
|
|
43
|
-
export interface FieldLabelProps extends FieldIndicatorProps {
|
|
29
|
+
/** Options every labelled input takes besides `FieldBaseProps`. */
|
|
30
|
+
export interface FieldOptionProps {
|
|
44
31
|
/** Hides the label visually. It still names the input for screen readers and tests. */
|
|
45
32
|
hideLabel?: boolean;
|
|
46
|
-
}
|
|
47
|
-
/** Extra options every labelled input takes: label markers, `hideLabel` and `fieldProps`. */
|
|
48
|
-
export interface FieldOptionProps extends FieldLabelProps {
|
|
49
33
|
/** Props for the field's root element, e.g. `{ 'data-testid': 'name-field' }`. `className` already goes there. */
|
|
50
34
|
fieldProps?: FieldRootProps;
|
|
51
35
|
}
|
|
52
|
-
/** `aria-required` for `showRequired` without native `required`. */
|
|
53
|
-
export declare const ariaRequired: (required?: boolean, showRequired?: boolean) => true | undefined;
|
|
54
36
|
/** Adds `visuallyHidden` when `hideLabel` is set. */
|
|
55
37
|
export declare const labelClass: (className: string | undefined, hideLabel?: boolean) => string | undefined;
|
|
56
|
-
export interface FieldProps extends FieldBaseProps,
|
|
38
|
+
export interface FieldProps extends FieldBaseProps, Pick<FieldOptionProps, 'hideLabel'>, Omit<BaseField.Root.Props, 'className' | 'children' | 'invalid'> {
|
|
57
39
|
className?: string;
|
|
58
40
|
children?: ReactNode;
|
|
59
41
|
}
|
|
60
42
|
/** The label text plus the required marker. Used inside `Field.Label` or a part's own label. */
|
|
61
|
-
export declare function FieldLabelText({ label, required
|
|
43
|
+
export declare function FieldLabelText({ label, required }: Pick<FieldBaseProps, 'label' | 'required'>): import('react').JSX.Element;
|
|
62
44
|
export declare const hasError: (error: ReactNode) => boolean;
|
|
63
45
|
/**
|
|
64
46
|
* Wraps a form control with a label, description and error message. Base UI wires up the label,
|
|
65
47
|
* `aria-describedby` and invalid state for any Base UI control (or `Field.Control`) inside it.
|
|
48
|
+
* Here `required` only adds the asterisk, so put `required` on the control too.
|
|
66
49
|
*/
|
|
67
|
-
export declare function Field({ label, description, error, required,
|
|
50
|
+
export declare function Field({ label, description, error, required, hideLabel, className, children, ...props }: FieldProps): import('react').JSX.Element;
|
|
68
51
|
/** The description (a `<div>`, so it can hold block content) and error parts, for components that lay out their own `Field.Root`. */
|
|
69
52
|
export declare function FieldMessages({ description, error, ids, }: Pick<FieldBaseProps, 'description' | 'error'> & {
|
|
70
53
|
ids?: {
|
|
@@ -5,65 +5,54 @@ import { CircleAlert as n } from "lucide-react";
|
|
|
5
5
|
import { Fragment as r, jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
6
6
|
import { Field as o } from "@base-ui/react/field";
|
|
7
7
|
// src/components/Field/Field.tsx
|
|
8
|
-
var s = (e,
|
|
9
|
-
function
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
className: "oe0y263",
|
|
16
|
-
children: "*"
|
|
17
|
-
}),
|
|
18
|
-
!c && o === "optional-note" && /* @__PURE__ */ a(r, { children: [" ", /* @__PURE__ */ i("span", {
|
|
19
|
-
className: "oe0y264",
|
|
20
|
-
children: s
|
|
21
|
-
})] })
|
|
22
|
-
] });
|
|
8
|
+
var s = (e, n) => t(e, n && "tyvs8e1") || void 0;
|
|
9
|
+
function c({ label: e, required: t }) {
|
|
10
|
+
return /* @__PURE__ */ a(r, { children: [e, t && /* @__PURE__ */ i("span", {
|
|
11
|
+
"aria-hidden": !0,
|
|
12
|
+
className: "oe0y263",
|
|
13
|
+
children: "*"
|
|
14
|
+
})] });
|
|
23
15
|
}
|
|
24
|
-
var
|
|
25
|
-
function
|
|
26
|
-
let
|
|
16
|
+
var l = (e) => e != null && e !== !1 && e !== "";
|
|
17
|
+
function u({ label: n, description: r, error: u, required: f, hideLabel: p, className: m, children: h, ...g }) {
|
|
18
|
+
let _ = l(u);
|
|
27
19
|
return /* @__PURE__ */ a(o.Root, {
|
|
28
|
-
...
|
|
29
|
-
invalid:
|
|
30
|
-
className: t(e,
|
|
20
|
+
...g,
|
|
21
|
+
invalid: _ || void 0,
|
|
22
|
+
className: t(e, m),
|
|
31
23
|
children: [
|
|
32
24
|
n != null && /* @__PURE__ */ i(o.Label, {
|
|
33
|
-
className:
|
|
34
|
-
children: /* @__PURE__ */ i(
|
|
25
|
+
className: s("oe0y262", p),
|
|
26
|
+
children: /* @__PURE__ */ i(c, {
|
|
35
27
|
label: n,
|
|
36
|
-
required:
|
|
37
|
-
showRequired: p,
|
|
38
|
-
requiredIndicator: m,
|
|
39
|
-
optionalText: h
|
|
28
|
+
required: f
|
|
40
29
|
})
|
|
41
30
|
}),
|
|
42
|
-
|
|
43
|
-
/* @__PURE__ */ i(
|
|
31
|
+
h,
|
|
32
|
+
/* @__PURE__ */ i(d, {
|
|
44
33
|
description: r,
|
|
45
|
-
error:
|
|
34
|
+
error: u
|
|
46
35
|
})
|
|
47
36
|
]
|
|
48
37
|
});
|
|
49
38
|
}
|
|
50
|
-
function
|
|
39
|
+
function d({ description: e, error: t, ids: s }) {
|
|
51
40
|
return /* @__PURE__ */ a(r, { children: [e != null && /* @__PURE__ */ i(o.Description, {
|
|
52
41
|
id: s?.description,
|
|
53
42
|
render: /* @__PURE__ */ i("div", {}),
|
|
54
|
-
className: "
|
|
43
|
+
className: "oe0y264",
|
|
55
44
|
children: e
|
|
56
|
-
}),
|
|
45
|
+
}), l(t) && /* @__PURE__ */ a(o.Error, {
|
|
57
46
|
id: s?.error,
|
|
58
47
|
match: !0,
|
|
59
|
-
className: "
|
|
48
|
+
className: "oe0y265",
|
|
60
49
|
children: [/* @__PURE__ */ i(n, {
|
|
61
50
|
size: "1.08em",
|
|
62
51
|
"aria-hidden": !0,
|
|
63
|
-
className: "
|
|
52
|
+
className: "oe0y266"
|
|
64
53
|
}), /* @__PURE__ */ i("span", { children: t })]
|
|
65
54
|
})] });
|
|
66
55
|
}
|
|
67
|
-
export {
|
|
56
|
+
export { u as Field, c as FieldLabelText, d as FieldMessages, l as hasError, s as labelClass };
|
|
68
57
|
|
|
69
58
|
//# sourceMappingURL=Field.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Field.js","names":["
|
|
1
|
+
{"version":3,"file":"Field.js","names":["_Fragment","required","Field","BaseField","styles.root","label","description","error","labelClass","clsx","className","hideLabel","FieldLabelText","required$1","Fragment","label","hasError","error","Field$1","label$1","props","invalid","Field","root","children","FieldMessages","description$1","error$1","ids","CircleAlert"],"sources":["../../../src/components/Field/Field.tsx"],"sourcesContent":["import { Field as BaseField } from '@base-ui/react/field'\nimport { clsx } from 'clsx'\nimport { CircleAlert } from 'lucide-react'\nimport type { ReactNode } from 'react'\n\nimport * as styles from './Field.css'\nimport { visuallyHidden } from '../../styles/shared.css'\n\n/** The label, description and error props every input shares. */\nexport interface FieldBaseProps {\n /** Visible label, also the input's accessible name. */\n label?: ReactNode\n /** Help text under the input, linked with `aria-describedby`. */\n description?: ReactNode\n /** Error message. When set, the input is marked invalid and the message is announced. */\n error?: ReactNode\n /**\n * Native `required`: the label gets an asterisk and the browser blocks submitting an empty\n * field. When a form library validates instead, keep `required` and put `noValidate` on the `<form>`.\n */\n required?: boolean\n /** Disables the input and greys out the label. */\n disabled?: boolean\n}\n\n/** `data-*` attributes, e.g. `{ 'data-testid': 'name-field' }`. */\nexport type DataAttributes = { [key: `data-${string}`]: string | number | boolean | undefined }\n\n/** Props for an inner part (trigger, popup, item…): its own props plus `data-*`, with a string `className`. */\nexport type PartProps<P> = Partial<Omit<P, 'className' | 'children'>> & {\n className?: string\n} & DataAttributes\n\n/** Props for the `Field` root element (the wrapper around label, input and messages). */\nexport type FieldRootProps = Omit<BaseField.Root.Props, 'children' | 'invalid' | 'disabled'> &\n DataAttributes\n\n/** Options every labelled input takes besides `FieldBaseProps`. */\nexport interface FieldOptionProps {\n /** Hides the label visually. It still names the input for screen readers and tests. */\n hideLabel?: boolean\n /** Props for the field's root element, e.g. `{ 'data-testid': 'name-field' }`. `className` already goes there. */\n fieldProps?: FieldRootProps\n}\n\n/** Adds `visuallyHidden` when `hideLabel` is set. */\nexport const labelClass = (className: string | undefined, hideLabel?: boolean) =>\n clsx(className, hideLabel && visuallyHidden) || undefined\n\nexport interface FieldProps\n extends\n FieldBaseProps,\n Pick<FieldOptionProps, 'hideLabel'>,\n Omit<BaseField.Root.Props, 'className' | 'children' | 'invalid'> {\n className?: string\n children?: ReactNode\n}\n\n/** The label text plus the required marker. Used inside `Field.Label` or a part's own label. */\nexport function FieldLabelText({ label, required }: Pick<FieldBaseProps, 'label' | 'required'>) {\n return (\n <>\n {label}\n {required && (\n <span aria-hidden className={styles.required}>\n *\n </span>\n )}\n </>\n )\n}\n\nexport const hasError = (error: ReactNode) => error != null && error !== false && error !== ''\n\n/**\n * Wraps a form control with a label, description and error message. Base UI wires up the label,\n * `aria-describedby` and invalid state for any Base UI control (or `Field.Control`) inside it.\n * Here `required` only adds the asterisk, so put `required` on the control too.\n */\nexport function Field({\n label,\n description,\n error,\n required,\n hideLabel,\n className,\n children,\n ...props\n}: FieldProps) {\n const invalid = hasError(error)\n return (\n <BaseField.Root\n {...props}\n invalid={invalid || undefined}\n className={clsx(styles.root, className)}\n >\n {label != null && (\n <BaseField.Label className={labelClass(styles.label, hideLabel)}>\n <FieldLabelText label={label} required={required} />\n </BaseField.Label>\n )}\n {children}\n <FieldMessages description={description} error={error} />\n </BaseField.Root>\n )\n}\n\n/** The description (a `<div>`, so it can hold block content) and error parts, for components that lay out their own `Field.Root`. */\nexport function FieldMessages({\n description,\n error,\n ids,\n}: Pick<FieldBaseProps, 'description' | 'error'> & {\n ids?: { description: string; error: string }\n}) {\n return (\n <>\n {description != null && (\n <BaseField.Description\n id={ids?.description}\n render={<div />}\n className={styles.description}\n >\n {description}\n </BaseField.Description>\n )}\n {hasError(error) && (\n <BaseField.Error id={ids?.error} match className={styles.error}>\n <CircleAlert size=\"1.08em\" aria-hidden className={styles.errorIcon} />\n <span>{error}</span>\n </BaseField.Error>\n )}\n </>\n )\n}\n"],"mappings":";;;;;;;AA8CA,IAAaQ,KAAc,GAA+B,MACxDC,EAAKC,GAAWC,KAAA,SAA2B,KAAK,KAAA;AAYlD,SAAgBC,EAAe,EAAE,UAAO,UAAAC,KAAwD;CAC9F,OACE,kBAAAb,GAAA,EAAA,UAAA,CACGe,GACAd,KACC,kBAAC,QAAD;EAAM,eAAA;EAAY,WAAW;EAAiB,UAAA;CAExC,CAAA,CAER,EAAA,CAAA;AAEN;AAEA,IAAae,KAAY,MAAqBC,KAAS,QAAQA,MAAU,MAASA,MAAU;AAO5F,SAAgBf,EAAM,EACpB,OAAAiB,GACA,gBACA,UACA,aACA,cACA,cACA,aACA,GAAGC,KACU;CACb,IAAMC,IAAUL,EAASC,CAAK;CAC9B,OACE,kBAACd,EAAU,MAAX;EACE,GAAIiB;EACJ,SAASC,KAAW,KAAA;EACpB,WAAWZ,EAAKL,GAAaM,CAAS;EAHxC,UAAA;GAKGL,KAAS,QACR,kBAACF,EAAU,OAAX;IAAiB,WAAWK,EAAW,WAAcG,CAAS;IAC5D,UAAA,kBAACC,GAAD;KAAuB,OAAAO;KAAiB;IAAW,CAAA;GACpC,CAAA;GAElBK;GACD,kBAACC,GAAD;IAA4B;IAAoB;GAAQ,CAAA;EAC1C;;AAEpB;AAGA,SAAgBA,EAAc,EAC5B,aAAAC,GACA,OAAAC,GACA,UAGC;CACD,OACE,kBAAA3B,GAAA,EAAA,UAAA,CACGM,KAAe,QACd,kBAACH,EAAU,aAAX;EACE,IAAIyB,GAAK;EACT,QAAQ,kBAAC,OAAD,CAAM,CAAA;EACd,WAAW;EAEV,UAAAtB;CACoB,CAAA,GAExBU,EAAST,CAAK,KACb,kBAACJ,EAAU,OAAX;EAAiB,IAAIyB,GAAK;EAAO,OAAA;EAAM,WAAW;EAAlD,UAAA,CACE,kBAACC,GAAD;GAAa,MAAK;GAAS,eAAA;GAAY,WAAW;EAAmB,CAAA,GACrE,kBAAC,QAAD,EAAA,UAAOtB,EAAY,CAAA,CACJ;CAEnB,CAAA,CAAA,EAAA,CAAA;AAEN"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* empty css */
|
|
2
2
|
// src/components/Field/Field.css.ts
|
|
3
|
-
var e = "oe0y261", t = "oe0y262", n = "oe0y263", r = "oe0y264", i = "oe0y265", a = "oe0y266", o = "oe0y267", s = "oe0y268", c = "oe0y269
|
|
4
|
-
export {
|
|
3
|
+
var e = "oe0y261", t = "oe0y262", n = "oe0y263", r = "oe0y264", i = "oe0y265", a = "oe0y266", o = "oe0y267", s = "oe0y268", c = "oe0y269 oe0y262";
|
|
4
|
+
export { r as description, i as error, a as errorIcon, s as fieldset, o as inlineLabel, t as label, c as legend, n as required, e as root };
|
|
5
5
|
|
|
6
6
|
//# sourceMappingURL=Field.styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Field.styles.js","names":["root","label","required","
|
|
1
|
+
{"version":3,"file":"Field.styles.js","names":["root","label","required","description","error","errorIcon","inlineLabel","fieldset","legend"],"sources":["../../../src/components/Field/Field.css.ts"],"sourcesContent":["import { createVar, style } from '@vanilla-extract/css'\n\nimport { vars } from '../../tokens/contract.css'\nimport { fontSize, fontWeight, lineHeight, space } from '../../tokens/scale'\n\n/** Indents the description and error, e.g. to line up with a checkbox's label text. */\nexport const messageInset = createVar()\n\nexport const root = style({\n vars: { [messageInset]: '0px' },\n display: 'flex',\n flexDirection: 'column',\n gap: space['1.5'],\n minWidth: 0,\n fontFamily: vars.font.sans,\n color: vars.color.ink,\n})\n\nexport const label = style({\n display: 'inline-flex',\n alignItems: 'center',\n gap: space['2'],\n fontSize: fontSize.md,\n fontWeight: fontWeight.medium,\n lineHeight: lineHeight.tight,\n color: vars.color.ink,\n wordBreak: 'break-word',\n selectors: { '&[data-disabled]': { color: vars.color.inkMuted } },\n})\n\nexport const required = style({ color: vars.color.dangerInk, marginInlineStart: `-${space['1']}` })\n\nexport const description = style({\n margin: 0,\n paddingInlineStart: messageInset,\n fontSize: fontSize.md,\n lineHeight: lineHeight.normal,\n color: vars.color.inkMuted,\n})\n\nexport const error = style({\n display: 'flex',\n paddingInlineStart: messageInset,\n alignItems: 'flex-start',\n gap: space['1.5'],\n fontSize: fontSize.sm,\n lineHeight: lineHeight.normal,\n color: vars.color.dangerInk,\n})\n\nexport const errorIcon = style({ flexShrink: 0, marginBlockStart: '0.15em' })\n\n/** A label wrapping a checkbox, switch or radio and its text. */\nexport const inlineLabel = style({\n display: 'inline-flex',\n alignItems: 'center',\n gap: space['2.5'],\n alignSelf: 'flex-start',\n fontSize: fontSize.md,\n lineHeight: lineHeight.normal,\n color: vars.color.ink,\n cursor: 'pointer',\n selectors: { '&[data-disabled]': { cursor: 'not-allowed', color: vars.color.inkMuted } },\n})\n\n/** A `<fieldset>` reset to lay out like a field. */\nexport const fieldset = style({\n display: 'flex',\n flexDirection: 'column',\n gap: space['1.5'],\n minWidth: 0,\n margin: 0,\n padding: 0,\n border: 0,\n})\n\nexport const legend = style([label, { padding: 0 }])\n"],"mappings":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { Field } from './Field';
|
|
2
|
-
export type { DataAttributes, FieldBaseProps,
|
|
2
|
+
export type { DataAttributes, FieldBaseProps, FieldOptionProps, FieldProps, FieldRootProps, PartProps, } from './Field';
|
|
@@ -3,6 +3,7 @@ import { ReactNode } from 'react';
|
|
|
3
3
|
export interface FieldsetProps extends Omit<BaseFieldset.Root.Props, 'className'> {
|
|
4
4
|
/** The card's title. */
|
|
5
5
|
legend: ReactNode;
|
|
6
|
+
/** Help text under the legend, linked with `aria-describedby`. A `<div>`, so it can hold block content. */
|
|
6
7
|
description?: ReactNode;
|
|
7
8
|
className?: string;
|
|
8
9
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Fieldset.js","names":["Fieldset","BaseFieldset","description","styles.fieldset","styles.legend","legend","styles.body","Fieldset$1","legend$1","description$1","props","descriptionId","useId","Fieldset","clsx","fieldset","className","legend","body"],"sources":["../../../src/components/Fieldset/Fieldset.tsx"],"sourcesContent":["import { Fieldset as BaseFieldset } from '@base-ui/react/fieldset'\nimport { clsx } from 'clsx'\nimport { useId, type ReactNode } from 'react'\n\nimport * as styles from './Fieldset.css'\n\nexport interface FieldsetProps extends Omit<BaseFieldset.Root.Props, 'className'> {\n /** The card's title. */\n legend: ReactNode\n description?: ReactNode\n className?: string\n}\n\n/** A titled card of related fields. Nested fieldsets render as an indented group instead of a card. */\nexport function Fieldset({ legend, description, className, children, ...props }: FieldsetProps) {\n const descriptionId = useId()\n return (\n <BaseFieldset.Root\n aria-describedby={description != null ? descriptionId : undefined}\n {...props}\n className={clsx(styles.fieldset, className)}\n >\n <BaseFieldset.Legend className={styles.legend}>{legend}</BaseFieldset.Legend>\n {description != null && (\n <div id={descriptionId} className={styles.description}>\n {description}\n </div>\n )}\n <div className={styles.body}>{children}</div>\n </BaseFieldset.Root>\n )\n}\n"],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"Fieldset.js","names":["Fieldset","BaseFieldset","description","styles.fieldset","styles.legend","legend","styles.body","Fieldset$1","legend$1","description$1","props","descriptionId","useId","Fieldset","clsx","fieldset","className","legend","body"],"sources":["../../../src/components/Fieldset/Fieldset.tsx"],"sourcesContent":["import { Fieldset as BaseFieldset } from '@base-ui/react/fieldset'\nimport { clsx } from 'clsx'\nimport { useId, type ReactNode } from 'react'\n\nimport * as styles from './Fieldset.css'\n\nexport interface FieldsetProps extends Omit<BaseFieldset.Root.Props, 'className'> {\n /** The card's title. */\n legend: ReactNode\n /** Help text under the legend, linked with `aria-describedby`. A `<div>`, so it can hold block content. */\n description?: ReactNode\n className?: string\n}\n\n/** A titled card of related fields. Nested fieldsets render as an indented group instead of a card. */\nexport function Fieldset({ legend, description, className, children, ...props }: FieldsetProps) {\n const descriptionId = useId()\n return (\n <BaseFieldset.Root\n aria-describedby={description != null ? descriptionId : undefined}\n {...props}\n className={clsx(styles.fieldset, className)}\n >\n <BaseFieldset.Legend className={styles.legend}>{legend}</BaseFieldset.Legend>\n {description != null && (\n <div id={descriptionId} className={styles.description}>\n {description}\n </div>\n )}\n <div className={styles.body}>{children}</div>\n </BaseFieldset.Root>\n )\n}\n"],"mappings":";;;;;;AAeA,SAAgBA,EAAS,EAAE,QAAAQ,GAAQ,aAAAC,GAAa,cAAW,aAAU,GAAGC,KAAwB;CAC9F,IAAMC,IAAgBC,EAAM;CAC5B,OACE,kBAACX,EAAa,MAAd;EACE,oBAAkBC,KAAe,OAAuB,KAAA,IAAhBS;EACxC,GAAID;EACJ,WAAWI,EAAKX,GAAiBa,CAAS;EAH5C,UAAA;GAKE,kBAACf,EAAa,QAAd;IAAqB,WAAWG;IAAgB,UAAAC;GAA4B,CAAA;GAC3EH,KAAe,QACd,kBAAC,OAAD;IAAK,IAAIS;IAAe,WAAW;IAChC,UAAAT;GACE,CAAA;GAEP,kBAAC,OAAD;IAAK,WAAWI;IAAc;GAAc,CAAA;EAC3B;;AAEvB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Fieldset.styles.js","names":["fieldset","legend","description","body"],"sources":["../../../src/components/Fieldset/Fieldset.css.ts"],"sourcesContent":["import { globalStyle, style } from '@vanilla-extract/css'\n\nimport { vars } from '../../tokens/contract.css'\nimport { fontSize, fontWeight, lineHeight, radius, space } from '../../tokens/scale'\n\n/** Each top-level fieldset is its own card. */\nexport const fieldset = style({\n minWidth: 0,\n margin: 0,\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\n//
|
|
1
|
+
{"version":3,"file":"Fieldset.styles.js","names":["fieldset","legend","description","body"],"sources":["../../../src/components/Fieldset/Fieldset.css.ts"],"sourcesContent":["import { globalStyle, style } from '@vanilla-extract/css'\n\nimport { vars } from '../../tokens/contract.css'\nimport { fontSize, fontWeight, lineHeight, radius, space } from '../../tokens/scale'\n\n/** Each top-level fieldset is its own card. */\nexport const fieldset = style({\n minWidth: 0,\n margin: 0,\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\n// Base UI's Legend is a <div>, so it sits inside the card without floating. (A float plus\n// `clear` on the body swallowed the body's top margin when there was no description.)\nexport const legend = style({\n padding: 0,\n fontSize: fontSize.lg,\n fontWeight: fontWeight.semibold,\n lineHeight: lineHeight.tight,\n})\n\nexport const description = style({\n margin: 0,\n paddingTop: space['1'],\n maxWidth: '80ch',\n fontSize: fontSize.sm,\n lineHeight: lineHeight.normal,\n color: vars.color.inkMuted,\n})\n\n/** The fields, under a hairline. */\nexport const body = style({\n display: 'flex',\n flexDirection: 'column',\n gap: space['5'],\n marginTop: space['4'],\n paddingTop: space['5'],\n borderTop: `1px solid ${vars.color.border}`,\n})\n\n// A fieldset inside another is marked by a rule down its left, not another card.\nglobalStyle(`${fieldset} ${fieldset}`, {\n padding: `${space['0.5']} 0 ${space['0.5']} ${space['4']}`,\n border: 'none',\n borderLeft: `2px solid ${vars.color.border}`,\n borderRadius: 0,\n background: 'none',\n})\nglobalStyle(`${fieldset} ${fieldset} ${body}`, {\n marginTop: space['3'],\n paddingTop: 0,\n borderTop: 'none',\n})\nglobalStyle(`${fieldset} ${fieldset} ${legend}`, { fontSize: fontSize.md })\n"],"mappings":""}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { StackGap } from '../Stack/Stack.css';
|
|
2
|
+
/** The column gap, so the responsive template can subtract it. */
|
|
3
|
+
export declare const gapVar: `var(--${string})`;
|
|
4
|
+
export declare const grid: import('@vanilla-extract/recipes').RuntimeFn<{
|
|
5
|
+
gap: Record<StackGap, {
|
|
6
|
+
vars: Record<string, string>;
|
|
7
|
+
}>;
|
|
8
|
+
align: {
|
|
9
|
+
start: {
|
|
10
|
+
alignItems: "start";
|
|
11
|
+
};
|
|
12
|
+
center: {
|
|
13
|
+
alignItems: "center";
|
|
14
|
+
};
|
|
15
|
+
end: {
|
|
16
|
+
alignItems: "end";
|
|
17
|
+
};
|
|
18
|
+
stretch: {
|
|
19
|
+
alignItems: "stretch";
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
}>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ComponentProps } from 'react';
|
|
2
|
+
import { StackGap } from '../Stack/Stack.css';
|
|
3
|
+
export interface GridProps extends ComponentProps<'div'> {
|
|
4
|
+
/**
|
|
5
|
+
* A number gives that many equal columns. A string is a `grid-template-columns` value, e.g.
|
|
6
|
+
* `'1fr 20rem'` for content beside a sidebar. Default `1`.
|
|
7
|
+
*/
|
|
8
|
+
columns?: number | string;
|
|
9
|
+
/**
|
|
10
|
+
* Responsive: columns are at least this wide (e.g. `'16rem'`), so the grid drops to fewer columns
|
|
11
|
+
* as it narrows, down to one. With a number of `columns` it never goes above that number; on its
|
|
12
|
+
* own it fits as many as there's room for. Ignored when `columns` is a string.
|
|
13
|
+
*/
|
|
14
|
+
minColumnWidth?: string;
|
|
15
|
+
/** Space between cells: `'1'` 4px, `'2'` 8px, `'3'` 12px, `'4'` 16px (default), `'6'` 24px, `'8'` 32px. */
|
|
16
|
+
gap?: StackGap;
|
|
17
|
+
/** Vertical alignment in each row. `start` (default) keeps fields top-aligned when one has a description. */
|
|
18
|
+
align?: 'start' | 'center' | 'end' | 'stretch';
|
|
19
|
+
}
|
|
20
|
+
/** Grid layout, e.g. form fields in rows or cards in a responsive grid. */
|
|
21
|
+
export declare function Grid({ columns, minColumnWidth, gap, align, className, style, ...props }: GridProps): import('react').JSX.Element;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { gapVar as e, grid as t } from "./Grid.styles.js";
|
|
2
|
+
import { clsx as n } from "clsx";
|
|
3
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
4
|
+
// src/components/Grid/Grid.tsx
|
|
5
|
+
function i(t, n) {
|
|
6
|
+
return typeof t == "string" ? t : n ? t === void 0 ? `repeat(auto-fit, minmax(min(100%, ${n}), 1fr))` : `repeat(auto-fill, minmax(min(100%, max(${n}, ${`(100% - ${t - 1} * ${e}) / ${t}`})), 1fr))` : `repeat(${t ?? 1}, minmax(0, 1fr))`;
|
|
7
|
+
}
|
|
8
|
+
function a({ columns: e, minColumnWidth: a, gap: o = "4", align: s = "start", className: c, style: l, ...u }) {
|
|
9
|
+
return /* @__PURE__ */ r("div", {
|
|
10
|
+
className: n(t({
|
|
11
|
+
gap: o,
|
|
12
|
+
align: s
|
|
13
|
+
}), c),
|
|
14
|
+
style: {
|
|
15
|
+
gridTemplateColumns: i(e, a),
|
|
16
|
+
...l
|
|
17
|
+
},
|
|
18
|
+
...u
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
export { a as Grid };
|
|
22
|
+
|
|
23
|
+
//# sourceMappingURL=Grid.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Grid.js","names":["styles.gapVar","styles.grid","template","columns","minColumnWidth","gapVar","Grid","props","clsx","grid","className","style"],"sources":["../../../src/components/Grid/Grid.tsx"],"sourcesContent":["import { clsx } from 'clsx'\nimport type { ComponentProps } from 'react'\n\nimport * as styles from './Grid.css'\nimport type { StackGap } from '../Stack/Stack.css'\n\nexport interface GridProps extends ComponentProps<'div'> {\n /**\n * A number gives that many equal columns. A string is a `grid-template-columns` value, e.g.\n * `'1fr 20rem'` for content beside a sidebar. Default `1`.\n */\n columns?: number | string\n /**\n * Responsive: columns are at least this wide (e.g. `'16rem'`), so the grid drops to fewer columns\n * as it narrows, down to one. With a number of `columns` it never goes above that number; on its\n * own it fits as many as there's room for. Ignored when `columns` is a string.\n */\n minColumnWidth?: string\n /** Space between cells: `'1'` 4px, `'2'` 8px, `'3'` 12px, `'4'` 16px (default), `'6'` 24px, `'8'` 32px. */\n gap?: StackGap\n /** Vertical alignment in each row. `start` (default) keeps fields top-aligned when one has a description. */\n align?: 'start' | 'center' | 'end' | 'stretch'\n}\n\nfunction template(columns: number | string | undefined, minColumnWidth: string | undefined) {\n if (typeof columns === 'string') return columns\n if (!minColumnWidth) return `repeat(${columns ?? 1}, minmax(0, 1fr))`\n if (columns === undefined) return `repeat(auto-fit, minmax(min(100%, ${minColumnWidth}), 1fr))`\n // Each column is at least 1/columns of the row (less the gaps), so no more than `columns` fit.\n const share = `(100% - ${columns - 1} * ${styles.gapVar}) / ${columns}`\n return `repeat(auto-fill, minmax(min(100%, max(${minColumnWidth}, ${share})), 1fr))`\n}\n\n/** Grid layout, e.g. form fields in rows or cards in a responsive grid. */\nexport function Grid({\n columns,\n minColumnWidth,\n gap = '4',\n align = 'start',\n className,\n style,\n ...props\n}: GridProps) {\n return (\n <div\n className={clsx(styles.grid({ gap, align }), className)}\n style={{ gridTemplateColumns: template(columns, minColumnWidth), ...style }}\n {...props}\n />\n )\n}\n"],"mappings":";;;;AAwBA,SAASE,EAAS,GAAsC,GAAoC;CAM1F,OALI,OAAOC,KAAY,WAAiBA,IACnCC,IACDD,MAAY,KAAA,IAAkB,qCAAqCC,EAAe,YAG/E,0CAA0CA,EAAe,IAAI,WAD3CD,IAAU,EAAE,KAAKH,EAAc,MAAMG,IACY,aAJ9C,UAAUA,KAAW,EAAE;AAKrD;AAGA,SAAgBG,EAAK,EACnB,YACA,mBACA,SAAM,KACN,WAAQ,SACR,cACA,UACA,GAAGC,KACS;CACZ,OACE,kBAAC,OAAD;EACE,WAAWC,EAAKP,EAAY;GAAE;GAAK;EAAM,CAAC,GAAGS,CAAS;EACtD,OAAO;GAAE,qBAAqBR,EAASC,GAASC,CAAc;GAAG,GAAGO;EAAM;EAC1E,GAAIJ;CACL,CAAA;AAEL"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/* empty css */
|
|
2
|
+
/* empty css */
|
|
3
|
+
import { createRuntimeFn as e } from "@vanilla-extract/recipes/createRuntimeFn";
|
|
4
|
+
// src/components/Grid/Grid.css.ts
|
|
5
|
+
var t = "var(--_13fdgeh0)", n = e({
|
|
6
|
+
defaultClassName: "_13fdgeh1",
|
|
7
|
+
variantClassNames: {
|
|
8
|
+
gap: {
|
|
9
|
+
1: "_13fdgeh2",
|
|
10
|
+
2: "_13fdgeh3",
|
|
11
|
+
3: "_13fdgeh4",
|
|
12
|
+
4: "_13fdgeh5",
|
|
13
|
+
6: "_13fdgeh6",
|
|
14
|
+
8: "_13fdgeh7"
|
|
15
|
+
},
|
|
16
|
+
align: {
|
|
17
|
+
start: "_13fdgeh8",
|
|
18
|
+
center: "_13fdgeh9",
|
|
19
|
+
end: "_13fdgeha",
|
|
20
|
+
stretch: "_13fdgehb"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
defaultVariants: {},
|
|
24
|
+
compoundVariants: []
|
|
25
|
+
});
|
|
26
|
+
export { t as gapVar, n as grid };
|
|
27
|
+
|
|
28
|
+
//# sourceMappingURL=Grid.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Grid.styles.js","names":["_7a468","gapVar","grid","createRuntimeFn"],"sources":["../../../src/components/Grid/Grid.css.ts"],"sourcesContent":["import { createVar } from '@vanilla-extract/css'\nimport { recipe } from '@vanilla-extract/recipes'\n\nimport { space } from '../../tokens/scale'\nimport { gaps, type StackGap } from '../Stack/Stack.css'\n\n/** The column gap, so the responsive template can subtract it. */\nexport const gapVar = createVar()\n\nexport const grid = recipe({\n base: {\n display: 'grid',\n gap: gapVar,\n minWidth: 0,\n },\n variants: {\n gap: Object.fromEntries(gaps.map((key) => [key, { vars: { [gapVar]: space[key] } }])) as Record<\n StackGap,\n { vars: Record<string, string> }\n >,\n align: {\n start: { alignItems: 'start' },\n center: { alignItems: 'center' },\n end: { alignItems: 'end' },\n stretch: { alignItems: 'stretch' },\n },\n },\n})\n"],"mappings":""}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ComponentProps, Key, ReactNode } from 'react';
|
|
2
2
|
export interface ListProps<T> extends Omit<ComponentProps<'div'>, 'children'> {
|
|
3
|
+
/** The items. `null` or empty shows `emptyState`. */
|
|
3
4
|
items?: readonly T[] | null;
|
|
4
5
|
/** Row content. Defaults to the item itself, so strings need no template. */
|
|
5
6
|
renderItem?: (item: T, index: number) => ReactNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"List.js","names":["styles.wrapper","styles.list","styles.row","styles.empty","defaultKey","item","List","props","clsx","wrapper","className","items","list","row","renderItem","index","getKey","empty","EmptyLine","emptyState"],"sources":["../../../src/components/List/List.tsx"],"sourcesContent":["import { clsx } from 'clsx'\nimport type { ComponentProps, Key, ReactNode } from 'react'\n\nimport { EmptyLine } from '../EmptyLine'\nimport * as styles from './List.css'\n\nexport interface ListProps<T> extends Omit<ComponentProps<'div'>, 'children'> {\n items?: readonly T[] | null\n /** Row content. Defaults to the item itself, so strings need no template. */\n renderItem?: (item: T, index: number) => ReactNode\n /** Row key. Defaults to the item if it's a string, else its JSON. */\n getKey?: (item: T, index: number) => Key\n /** Shown when there are no items. */\n emptyState?: ReactNode\n}\n\nconst defaultKey = (item: unknown): Key => (typeof item === 'string' ? item : JSON.stringify(item))\n\n/** Simple list with a built-in empty state. */\nexport function List<T>({\n items,\n renderItem = (item) => item as ReactNode,\n getKey = defaultKey,\n emptyState = 'No items',\n className,\n ...props\n}: ListProps<T>) {\n return (\n <div className={clsx(styles.wrapper, className)} {...props}>\n {items?.length ? (\n <ul className={styles.list}>\n {items.map((item, index) => (\n <li key={getKey(item, index)} className={styles.row}>\n {renderItem(item, index)}\n </li>\n ))}\n </ul>\n ) : (\n <div className={styles.empty}>\n <EmptyLine bare>{emptyState}</EmptyLine>\n </div>\n )}\n </div>\n )\n}\n"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"List.js","names":["styles.wrapper","styles.list","styles.row","styles.empty","defaultKey","item","List","props","clsx","wrapper","className","items","list","row","renderItem","index","getKey","empty","EmptyLine","emptyState"],"sources":["../../../src/components/List/List.tsx"],"sourcesContent":["import { clsx } from 'clsx'\nimport type { ComponentProps, Key, ReactNode } from 'react'\n\nimport { EmptyLine } from '../EmptyLine'\nimport * as styles from './List.css'\n\nexport interface ListProps<T> extends Omit<ComponentProps<'div'>, 'children'> {\n /** The items. `null` or empty shows `emptyState`. */\n items?: readonly T[] | null\n /** Row content. Defaults to the item itself, so strings need no template. */\n renderItem?: (item: T, index: number) => ReactNode\n /** Row key. Defaults to the item if it's a string, else its JSON. */\n getKey?: (item: T, index: number) => Key\n /** Shown when there are no items. */\n emptyState?: ReactNode\n}\n\nconst defaultKey = (item: unknown): Key => (typeof item === 'string' ? item : JSON.stringify(item))\n\n/** Simple list with a built-in empty state. */\nexport function List<T>({\n items,\n renderItem = (item) => item as ReactNode,\n getKey = defaultKey,\n emptyState = 'No items',\n className,\n ...props\n}: ListProps<T>) {\n return (\n <div className={clsx(styles.wrapper, className)} {...props}>\n {items?.length ? (\n <ul className={styles.list}>\n {items.map((item, index) => (\n <li key={getKey(item, index)} className={styles.row}>\n {renderItem(item, index)}\n </li>\n ))}\n </ul>\n ) : (\n <div className={styles.empty}>\n <EmptyLine bare>{emptyState}</EmptyLine>\n </div>\n )}\n </div>\n )\n}\n"],"mappings":";;;;;AAiBA,IAAMI,KAAc,MAAwB,OAAOC,KAAS,WAAWA,IAAO,KAAK,UAAUA,CAAI;AAGjG,SAAgBC,EAAQ,EACtB,UACA,iBAAc,MAASD,GACvB,YAASD,GACT,gBAAa,YACb,cACA,GAAGG,KACY;CACf,OACE,kBAAC,OAAD;EAAK,WAAWC,EAAKR,GAAgBU,CAAS;EAAG,GAAIH;EAClD,UAAAI,GAAO,SACN,kBAAC,MAAD;GAAI,WAAWV;GACZ,UAAAU,EAAM,KAAK,GAAM,MAChB,kBAAC,MAAD;IAA8B,WAAWT;IACtC,UAAAY,EAAWT,GAAMU,CAAK;GACrB,GAFKC,EAAOX,GAAMU,CAAK,CAEvB,CACL;EACC,CAAA,IAEJ,kBAAC,OAAD;GAAK,WAAWZ;GACd,UAAA,kBAACe,GAAD;IAAW,MAAA;IAAM,UAAAC;GAAsB,CAAA;EACpC,CAAA;CAEJ,CAAA;AAET"}
|
|
@@ -5,7 +5,7 @@ export interface LoaderProps extends ComponentProps<'span'> {
|
|
|
5
5
|
* 16px base, converted to rem so they scale with the text-size setting.
|
|
6
6
|
*/
|
|
7
7
|
size?: number | string;
|
|
8
|
-
/**
|
|
8
|
+
/** Text announced to screen readers. Pass `null` when a visible label sits next to it. */
|
|
9
9
|
label?: string | null;
|
|
10
10
|
}
|
|
11
11
|
/** Indeterminate spinner. Inherits the current text colour. */
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { loader as e } from "./Loader.styles.js";
|
|
2
|
+
import "../../styles/shared.styles.js";
|
|
2
3
|
import { clsx as t } from "clsx";
|
|
3
4
|
import { jsx as n } from "react/jsx-runtime";
|
|
4
5
|
// src/components/Loader/Loader.tsx
|
|
@@ -7,7 +8,6 @@ function i({ size: i = "1rem", label: a = "Loading", className: o, style: s, ...
|
|
|
7
8
|
let l = typeof i == "number" ? r(i) : i;
|
|
8
9
|
return /* @__PURE__ */ n("span", {
|
|
9
10
|
role: a ? "status" : void 0,
|
|
10
|
-
"aria-label": a ?? void 0,
|
|
11
11
|
"aria-hidden": !a || void 0,
|
|
12
12
|
className: t(e, o),
|
|
13
13
|
style: {
|
|
@@ -15,7 +15,11 @@ function i({ size: i = "1rem", label: a = "Loading", className: o, style: s, ...
|
|
|
15
15
|
height: l,
|
|
16
16
|
...s
|
|
17
17
|
},
|
|
18
|
-
...c
|
|
18
|
+
...c,
|
|
19
|
+
children: a && /* @__PURE__ */ n("span", {
|
|
20
|
+
className: "tyvs8e1",
|
|
21
|
+
children: a
|
|
22
|
+
})
|
|
19
23
|
});
|
|
20
24
|
}
|
|
21
25
|
export { i as Loader };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Loader.js","names":["styles.loader","toRem","px","Loader","props","length","size","label","clsx","loader","className","style"],"sources":["../../../src/components/Loader/Loader.tsx"],"sourcesContent":["import { clsx } from 'clsx'\nimport type { ComponentProps } from 'react'\n\nimport * as styles from './Loader.css'\n\nexport interface LoaderProps extends ComponentProps<'span'> {\n /**\n * Diameter as a CSS length, e.g. `'1em'` to match the surrounding text. Numbers are px at the\n * 16px base, converted to rem so they scale with the text-size setting.\n */\n size?: number | string\n /**
|
|
1
|
+
{"version":3,"file":"Loader.js","names":["styles.loader","toRem","px","Loader","props","length","size","label","clsx","loader","className","style"],"sources":["../../../src/components/Loader/Loader.tsx"],"sourcesContent":["import { clsx } from 'clsx'\nimport type { ComponentProps } from 'react'\n\nimport * as styles from './Loader.css'\nimport { visuallyHidden } from '../../styles/shared.css'\n\nexport interface LoaderProps extends ComponentProps<'span'> {\n /**\n * Diameter as a CSS length, e.g. `'1em'` to match the surrounding text. Numbers are px at the\n * 16px base, converted to rem so they scale with the text-size setting.\n */\n size?: number | string\n /** Text announced to screen readers. Pass `null` when a visible label sits next to it. */\n label?: string | null\n}\n\nconst toRem = (px: number) => `${+(px / 16).toFixed(4)}rem`\n\n/** Indeterminate spinner. Inherits the current text colour. */\nexport function Loader({\n size = '1rem',\n label = 'Loading',\n className,\n style,\n ...props\n}: LoaderProps) {\n const length = typeof size === 'number' ? toRem(size) : size\n return (\n <span\n role={label ? 'status' : undefined}\n aria-hidden={label ? undefined : true}\n className={clsx(styles.loader, className)}\n style={{ width: length, height: length, ...style }}\n {...props}\n >\n {/* Text, not aria-label: screen readers announce a status's content, not its name. */}\n {label && <span className={visuallyHidden}>{label}</span>}\n </span>\n )\n}\n"],"mappings":";;;;;AAgBA,IAAMC,KAAS,MAAe,GAAG,EAAEC,IAAK,GAAA,CAAI,QAAQ,CAAC,EAAE;AAGvD,SAAgBC,EAAO,EACrB,UAAO,QACP,WAAQ,WACR,cACA,UACA,GAAGC,KACW;CACd,IAAMC,IAAS,OAAOC,KAAS,WAAWL,EAAMK,CAAI,IAAIA;CACxD,OACE,kBAAC,QAAD;EACE,MAAMC,IAAQ,WAAW,KAAA;EACzB,eAAa,MAAQ,KAAA;EACrB,WAAWC,EAAKR,GAAeU,CAAS;EACxC,OAAO;GAAE,OAAOL;GAAQ,QAAQA;GAAQ,GAAGM;EAAM;EACjD,GAAIP;EAGH,UAAAG,KAAS,kBAAC,QAAD;GAAM,WAAA;GAA4B,UAAAA;EAAY,CAAA;CACpD,CAAA;AAEV"}
|