@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
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
/* empty css */
|
|
2
|
+
/* empty css */
|
|
2
3
|
/* empty css */
|
|
3
4
|
// src/components/Table/Table.css.ts
|
|
4
|
-
var e = "_1t5z8gj0
|
|
5
|
-
left: "
|
|
6
|
-
center: "
|
|
7
|
-
right: "
|
|
8
|
-
},
|
|
9
|
-
export {
|
|
5
|
+
var e = "_1t5z8gj0", t = "_1t5z8gj1", n = "_1t5z8gj2", r = "_1t5z8gj3", i = "_1t5z8gj4", a = "_1t5z8gj5", o = "_1t5z8gj7", s = "_1t5z8gj8", c = "_1t5z8gj9 tyvs8e0", l = "_1t5z8gja", u = "_1t5z8gjb", d = "_1t5z8gjc", f = "_1t5z8gjd", p = "_1t5z8gje", m = {
|
|
6
|
+
left: "_1t5z8gjf",
|
|
7
|
+
center: "_1t5z8gjg",
|
|
8
|
+
right: "_1t5z8gjh"
|
|
9
|
+
}, h = "_1t5z8gji", g = "_1t5z8gjj", _ = "_1t5z8gjk", v = "_1t5z8gjl", y = "_1t5z8gjm", b = "_1t5z8gjn tyvs8e0";
|
|
10
|
+
export { m as align, a as caption, f as cell, y as clickableRow, v as empty, n as footer, e as frame, p as groupCell, s as headerCell, r as loadMore, _ as mono, d as row, b as rowAction, g as secondary, c as sortButton, l as sortIcon, u as sortIconIdle, o as staleBar, i as table, h as truncate, t as wrapper };
|
|
10
11
|
|
|
11
12
|
//# sourceMappingURL=Table.styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Table.styles.js","names":["wrapper","table","headerCell","row","cell","align","secondary","empty","clickableRow","rowAction"],"sources":["../../../src/components/Table/Table.css.ts"],"sourcesContent":["import { style } from '@vanilla-extract/css'\n\nimport { focusRing } from '../../styles/shared.css'\nimport { vars } from '../../tokens/contract.css'\nimport { fontSize, fontWeight, radius, space } from '../../tokens/scale'\n\nexport const
|
|
1
|
+
{"version":3,"file":"Table.styles.js","names":["frame","wrapper","footer","loadMore","table","caption","staleBar","headerCell","sortButton","sortIcon","sortIconIdle","row","cell","groupCell","align","truncate","secondary","mono","empty","clickableRow","rowAction"],"sources":["../../../src/components/Table/Table.css.ts"],"sourcesContent":["import { globalStyle, keyframes, style } from '@vanilla-extract/css'\n\nimport { focusRing } from '../../styles/shared.css'\nimport { vars } from '../../tokens/contract.css'\nimport { fontSize, fontWeight, radius, space } from '../../tokens/scale'\nimport { card } from '../Card/Card.css'\n\n/** The card frame around the scroll box and footer. */\nexport const frame = style({\n position: 'relative',\n overflow: 'clip',\n border: `1px solid ${vars.color.border}`,\n borderRadius: radius.xl,\n backgroundColor: vars.color.surface,\n fontFamily: vars.font.sans,\n})\n\n/** Scrolls the table sideways. Its focus ring is drawn on the frame, which clips it. */\nexport const wrapper = style({\n overflowX: 'auto',\n selectors: { '&:focus-visible': { outline: 'none' } },\n})\n\nglobalStyle(`${frame}:has(> ${wrapper}:focus-visible)`, {\n outline: `2px solid ${vars.color.focusRing}`,\n outlineOffset: 2,\n})\n\n// Inside a Card, the card is the frame. Corners still clip at a flush card's edges.\nconst inCard = `${card.classNames.base} ${frame}`\nconst innerRadius = `calc(${radius.xl} - 1px)`\nglobalStyle(inCard, { border: 0, borderRadius: 0, backgroundColor: 'transparent' })\nglobalStyle(`${inCard}:first-child`, {\n borderStartStartRadius: innerRadius,\n borderStartEndRadius: innerRadius,\n})\nglobalStyle(`${inCard}:last-child`, {\n borderEndStartRadius: innerRadius,\n borderEndEndRadius: innerRadius,\n})\n\nexport const footer = style({\n display: 'flex',\n flexWrap: 'wrap',\n alignItems: 'center',\n justifyContent: 'space-between',\n gap: space['3'],\n paddingBlock: space['3'],\n paddingInline: space['6'],\n borderTop: `1px solid ${vars.color.border}`,\n fontSize: fontSize.md,\n color: vars.color.ink,\n})\n\nexport const loadMore = style({ marginInline: 'auto' })\n\nexport const table = style({\n width: '100%',\n borderCollapse: 'collapse',\n fontFamily: vars.font.sans,\n // Body size, like the rest of the page.\n fontSize: fontSize.md,\n color: vars.color.ink,\n})\n\nexport const caption = style({\n paddingBlock: space['3'],\n paddingInline: space['6'],\n borderBottom: `1px solid ${vars.color.border}`,\n fontWeight: fontWeight.semibold,\n textAlign: 'left',\n})\n\n// Stale: a bar slides along the top edge. It appears after 300ms so quick loads don't flicker.\n// Rows aren't dimmed: any useful fade takes muted text and badges below 4.5:1 contrast.\nconst slide = keyframes({\n from: { transform: 'translateX(-100%)' },\n to: { transform: 'translateX(250%)' },\n})\n\nexport const staleBar = style({\n position: 'absolute',\n insetBlockStart: 0,\n insetInlineStart: 0,\n zIndex: 1,\n width: '40%',\n height: space['0.5'],\n backgroundColor: vars.color.accent,\n opacity: 0,\n pointerEvents: 'none',\n visibility: 'hidden',\n selectors: {\n '[data-stale] > &': {\n opacity: 1,\n visibility: 'visible',\n transition: 'opacity 150ms ease 300ms, visibility 0s 300ms',\n animation: `${slide} 1.2s ease-in-out infinite`,\n },\n },\n '@media': {\n '(prefers-reduced-motion: reduce)': {\n width: '100%',\n selectors: { '[data-stale] > &': { animation: 'none' } },\n },\n },\n})\n\nglobalStyle(`${table} > tbody + tbody`, { borderTop: `1px solid ${vars.color.border}` })\n\nconst compact = '[data-density=\"compact\"] &'\n\nexport const headerCell = style({\n paddingBlock: space['4'],\n paddingInline: space['6'],\n backgroundColor: vars.color.surfaceSunken,\n borderBottom: `1px solid ${vars.color.border}`,\n color: vars.color.inkMuted,\n fontSize: fontSize.sm,\n fontWeight: fontWeight.medium,\n textAlign: 'left',\n whiteSpace: 'nowrap',\n selectors: { [compact]: { paddingBlock: space['2'], paddingInline: space['4'] } },\n})\n\n/** The button in a sortable column's header. */\nexport const sortButton = style([\n focusRing,\n {\n display: 'inline-flex',\n alignItems: 'center',\n gap: space['1'],\n padding: 0,\n border: 0,\n borderRadius: radius.sm,\n background: 'none',\n color: 'inherit',\n font: 'inherit',\n cursor: 'pointer',\n selectors: { '&:hover': { color: vars.color.ink } },\n },\n])\n\nexport const sortIcon = style({ flexShrink: 0 })\nexport const sortIconIdle = style({ flexShrink: 0, color: vars.color.inkSubtle })\n\nexport const row = style({\n selectors: { '&:not(:last-child)': { borderBottom: `1px solid ${vars.color.border}` } },\n})\n\nexport const cell = style({\n paddingBlock: space['4'],\n paddingInline: space['6'],\n verticalAlign: 'middle',\n selectors: { [compact]: { paddingBlock: space['2'], paddingInline: space['4'] } },\n})\n\n/** A full-width group heading row. */\nexport const groupCell = style({\n paddingBlock: space['2'],\n paddingInline: space['6'],\n backgroundColor: vars.color.surfaceSunken,\n borderBottom: `1px solid ${vars.color.border}`,\n color: vars.color.inkMuted,\n fontSize: fontSize.sm,\n fontWeight: fontWeight.semibold,\n textAlign: 'left',\n selectors: { [compact]: { paddingBlock: space['1.5'], paddingInline: space['4'] } },\n})\n\nexport const align = {\n left: style({ textAlign: 'left' }),\n center: style({ textAlign: 'center' }),\n right: style({ textAlign: 'right', fontVariantNumeric: 'tabular-nums' }),\n}\n\nexport const truncate = style({\n display: 'block',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n whiteSpace: 'nowrap',\n})\n\nexport const secondary = style({\n display: 'block',\n marginTop: space['0.5'],\n fontSize: fontSize.sm,\n color: vars.color.inkMuted,\n})\n\nexport const mono = style({ fontFamily: vars.font.mono })\n\nexport const empty = style({\n paddingBlock: space['8'],\n paddingInline: space['6'],\n color: vars.color.inkMuted,\n textAlign: 'center',\n})\n\n/** A row with `onRowClick`: the whole row is a click target. */\nexport const clickableRow = style({\n cursor: 'pointer',\n selectors: { '&:hover': { backgroundColor: vars.color.surfaceHover } },\n})\n\n/** The button or link in a clickable row's primary cell. Looks like the cell's text. */\nexport const rowAction = style([\n focusRing,\n {\n display: 'block',\n width: '100%',\n padding: 0,\n border: 0,\n background: 'none',\n color: 'inherit',\n font: 'inherit',\n textAlign: 'inherit',\n textDecoration: 'none',\n cursor: 'pointer',\n },\n])\n"],"mappings":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { Table } from './Table';
|
|
2
|
-
export type { TableCellProps, TableColumn, TableHeaderCellProps, TableProps, TableRootProps, } from './Table';
|
|
2
|
+
export type { SortDirection, SortState, TableCellProps, TableColumn, TableGroupRowProps, TableHeaderCellProps, TableLoadMoreProps, TableProps, TableRootProps, TableRowProps, TableSecondaryProps, } from './Table';
|
|
@@ -4,23 +4,37 @@ import { PartProps } from '../Field/Field';
|
|
|
4
4
|
type ClassName = {
|
|
5
5
|
className?: string;
|
|
6
6
|
};
|
|
7
|
-
|
|
7
|
+
/** Typed value props: `Value` is a union of tab values, e.g. `'general' | 'advanced'`. */
|
|
8
|
+
export interface TabsValueProps<Value extends string = string> {
|
|
9
|
+
/** The active tab's value (controlled). */
|
|
10
|
+
value?: Value;
|
|
11
|
+
/** The tab active at first (uncontrolled). */
|
|
12
|
+
defaultValue?: Value;
|
|
13
|
+
/** Called with the newly active tab's value. */
|
|
14
|
+
onValueChange?: (value: Value, eventDetails: BaseTabs.Root.ChangeEventDetails) => void;
|
|
15
|
+
}
|
|
16
|
+
export type TabsRootProps<Value extends string = string> = Omit<BaseTabs.Root.Props, 'className' | keyof TabsValueProps> & TabsValueProps<Value> & ClassName;
|
|
8
17
|
export type TabsListProps = Omit<BaseTabs.List.Props, 'className'> & ClassName;
|
|
9
18
|
export type TabsPanelProps = Omit<BaseTabs.Panel.Props, 'className'> & ClassName;
|
|
10
19
|
export interface TabsTabProps extends Omit<BaseTabs.Tab.Props, 'className'>, ClassName {
|
|
11
20
|
/** Shown muted after the label, e.g. the number of items in the panel. */
|
|
12
21
|
count?: ReactNode;
|
|
13
22
|
}
|
|
14
|
-
declare function Root({ className, ...props }: TabsRootProps): import('react').JSX.Element;
|
|
23
|
+
declare function Root<Value extends string = string>({ className, ...props }: TabsRootProps<Value>): import('react').JSX.Element;
|
|
15
24
|
/** The tab row. Includes the accent underline indicator. */
|
|
16
25
|
declare function List({ className, children, activateOnFocus, ...props }: TabsListProps): import('react').JSX.Element;
|
|
17
26
|
declare function Tab({ className, count, children, ...props }: TabsTabProps): import('react').JSX.Element;
|
|
18
27
|
declare function Panel({ className, ...props }: TabsPanelProps): import('react').JSX.Element;
|
|
19
|
-
export interface TabItem {
|
|
20
|
-
value
|
|
28
|
+
export interface TabItem<Value extends string = string> {
|
|
29
|
+
/** Unique key, used by `value`/`defaultValue`/`onValueChange`. */
|
|
30
|
+
value: Value;
|
|
31
|
+
/** Tab text. */
|
|
21
32
|
label: ReactNode;
|
|
33
|
+
/** Shown muted after the label, e.g. the number of items in the panel. */
|
|
22
34
|
count?: ReactNode;
|
|
35
|
+
/** The panel shown while this tab is active. */
|
|
23
36
|
content: ReactNode;
|
|
37
|
+
/** Can't be selected. */
|
|
24
38
|
disabled?: boolean;
|
|
25
39
|
/** Keeps this panel in the DOM (hidden) while another tab is active. Overrides the `Tabs` prop. */
|
|
26
40
|
keepMounted?: boolean;
|
|
@@ -29,8 +43,9 @@ export interface TabItem {
|
|
|
29
43
|
/** Props for the panel (role `tabpanel`). */
|
|
30
44
|
panelProps?: PartProps<BaseTabs.Panel.Props>;
|
|
31
45
|
}
|
|
32
|
-
export interface TabsProps extends Omit<TabsRootProps
|
|
33
|
-
|
|
46
|
+
export interface TabsProps<Value extends string = string> extends Omit<TabsRootProps<Value>, 'children'> {
|
|
47
|
+
/** The tabs, in order. The first enabled one is selected unless `value`/`defaultValue` says otherwise. */
|
|
48
|
+
items: TabItem<Value>[];
|
|
34
49
|
/**
|
|
35
50
|
* Keeps hidden panels in the DOM, so form fields in other tabs stay registered and keep their
|
|
36
51
|
* state. Panels unmount while hidden by default.
|
|
@@ -41,9 +56,9 @@ export interface TabsProps extends Omit<TabsRootProps, 'children'> {
|
|
|
41
56
|
}
|
|
42
57
|
/**
|
|
43
58
|
* Underline tabs. Pass `items`, or compose `Tabs.Root`, `Tabs.List`, `Tabs.Tab` and `Tabs.Panel`.
|
|
44
|
-
* Defaults to the first item.
|
|
59
|
+
* Defaults to the first enabled item.
|
|
45
60
|
*/
|
|
46
|
-
declare function TabsComponent({ items, defaultValue, keepMounted, listProps, ...props }: TabsProps): import('react').JSX.Element;
|
|
61
|
+
declare function TabsComponent<Value extends string = string>({ items, defaultValue, keepMounted, listProps, ...props }: TabsProps<Value>): import('react').JSX.Element;
|
|
47
62
|
/** Underline tabs with optional counts ("Conversation 13"). Pass `items`, or compose `Tabs.Root`, `Tabs.List`, `Tabs.Tab` and `Tabs.Panel`. */
|
|
48
63
|
export declare const Tabs: typeof TabsComponent & {
|
|
49
64
|
Root: typeof Root;
|
|
@@ -35,7 +35,7 @@ function p({ className: e, ...t }) {
|
|
|
35
35
|
});
|
|
36
36
|
}
|
|
37
37
|
function m({ items: e, defaultValue: t, keepMounted: n = !1, listProps: r, ...i }) {
|
|
38
|
-
let o = t ?? e
|
|
38
|
+
let o = t ?? e.find((e) => !e.disabled)?.value;
|
|
39
39
|
return /* @__PURE__ */ c(u, {
|
|
40
40
|
defaultValue: o,
|
|
41
41
|
...i,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tabs.js","names":["BaseTabs","styles.root","styles.list","styles.indicator","styles.tab","count","styles.panel","Tabs","Root","props","Tabs","clsx","root","className","List","list","children","indicator","Tab","count$1","tab","Panel","panel","TabsComponent","initial","defaultValue","items","
|
|
1
|
+
{"version":3,"file":"Tabs.js","names":["BaseTabs","styles.root","styles.list","styles.indicator","styles.tab","count","styles.panel","Tabs","Root","props","Tabs","clsx","root","className","List","list","children","indicator","Tab","count$1","tab","Panel","panel","TabsComponent","initial","defaultValue","items","item","listProps","keepMounted","Tabs$1"],"sources":["../../../src/components/Tabs/Tabs.tsx"],"sourcesContent":["import { Tabs as BaseTabs } from '@base-ui/react/tabs'\nimport { clsx } from 'clsx'\nimport type { ReactNode } from 'react'\n\nimport * as styles from './Tabs.css'\nimport type { PartProps } from '../Field/Field'\n\ntype ClassName = { className?: string }\n\n/** Typed value props: `Value` is a union of tab values, e.g. `'general' | 'advanced'`. */\nexport interface TabsValueProps<Value extends string = string> {\n /** The active tab's value (controlled). */\n value?: Value\n /** The tab active at first (uncontrolled). */\n defaultValue?: Value\n /** Called with the newly active tab's value. */\n onValueChange?: (value: Value, eventDetails: BaseTabs.Root.ChangeEventDetails) => void\n}\n\nexport type TabsRootProps<Value extends string = string> = Omit<\n BaseTabs.Root.Props,\n 'className' | keyof TabsValueProps\n> &\n TabsValueProps<Value> &\n ClassName\nexport type TabsListProps = Omit<BaseTabs.List.Props, 'className'> & ClassName\nexport type TabsPanelProps = Omit<BaseTabs.Panel.Props, 'className'> & ClassName\nexport interface TabsTabProps extends Omit<BaseTabs.Tab.Props, 'className'>, ClassName {\n /** Shown muted after the label, e.g. the number of items in the panel. */\n count?: ReactNode\n}\n\nfunction Root<Value extends string = string>({ className, ...props }: TabsRootProps<Value>) {\n return <BaseTabs.Root className={clsx(styles.root, className)} {...props} />\n}\n\n/** The tab row. Includes the accent underline indicator. */\nfunction List({ className, children, activateOnFocus = true, ...props }: TabsListProps) {\n return (\n <BaseTabs.List\n className={clsx(styles.list, className)}\n activateOnFocus={activateOnFocus}\n {...props}\n >\n {children}\n <BaseTabs.Indicator className={styles.indicator} />\n </BaseTabs.List>\n )\n}\n\nfunction Tab({ className, count, children, ...props }: TabsTabProps) {\n return (\n <BaseTabs.Tab className={clsx(styles.tab, className)} {...props}>\n {children}\n {count != null && <span className={styles.count}>{count}</span>}\n </BaseTabs.Tab>\n )\n}\n\nfunction Panel({ className, ...props }: TabsPanelProps) {\n return <BaseTabs.Panel className={clsx(styles.panel, className)} {...props} />\n}\n\nexport interface TabItem<Value extends string = string> {\n /** Unique key, used by `value`/`defaultValue`/`onValueChange`. */\n value: Value\n /** Tab text. */\n label: ReactNode\n /** Shown muted after the label, e.g. the number of items in the panel. */\n count?: ReactNode\n /** The panel shown while this tab is active. */\n content: ReactNode\n /** Can't be selected. */\n disabled?: boolean\n /** Keeps this panel in the DOM (hidden) while another tab is active. Overrides the `Tabs` prop. */\n keepMounted?: boolean\n /** Props for the tab (role `tab`), e.g. `{ 'data-testid': 'tab-config' }`. */\n tabProps?: PartProps<BaseTabs.Tab.Props>\n /** Props for the panel (role `tabpanel`). */\n panelProps?: PartProps<BaseTabs.Panel.Props>\n}\n\nexport interface TabsProps<Value extends string = string> extends Omit<\n TabsRootProps<Value>,\n 'children'\n> {\n /** The tabs, in order. The first enabled one is selected unless `value`/`defaultValue` says otherwise. */\n items: TabItem<Value>[]\n /**\n * Keeps hidden panels in the DOM, so form fields in other tabs stay registered and keep their\n * state. Panels unmount while hidden by default.\n */\n keepMounted?: boolean\n /** Props for the tab row (role `tablist`). */\n listProps?: PartProps<BaseTabs.List.Props>\n}\n\n/**\n * Underline tabs. Pass `items`, or compose `Tabs.Root`, `Tabs.List`, `Tabs.Tab` and `Tabs.Panel`.\n * Defaults to the first enabled item.\n */\nfunction TabsComponent<Value extends string = string>({\n items,\n defaultValue,\n keepMounted = false,\n listProps,\n ...props\n}: TabsProps<Value>) {\n const initial = defaultValue ?? items.find((item) => !item.disabled)?.value\n return (\n <Root<Value> defaultValue={initial} {...props}>\n <List {...listProps}>\n {items.map((item) => (\n <Tab\n {...item.tabProps}\n key={item.value}\n value={item.value}\n count={item.count}\n disabled={item.disabled}\n >\n {item.label}\n </Tab>\n ))}\n </List>\n {items.map((item) => (\n <Panel\n {...item.panelProps}\n key={item.value}\n value={item.value}\n keepMounted={item.keepMounted ?? keepMounted}\n >\n {item.content}\n </Panel>\n ))}\n </Root>\n )\n}\n\n/** Underline tabs with optional counts (\"Conversation 13\"). Pass `items`, or compose `Tabs.Root`, `Tabs.List`, `Tabs.Tab` and `Tabs.Panel`. */\nexport const Tabs = Object.assign(TabsComponent, { Root, List, Tab, Panel })\n"],"mappings":";;;;;;AAgCA,SAASQ,EAAoC,EAAE,cAAW,GAAGC,KAA+B;CAC1F,OAAO,kBAACT,EAAS,MAAV;EAAe,WAAWW,EAAKV,GAAaY,CAAS;EAAG,GAAIJ;CAAQ,CAAA;AAC7E;AAGA,SAASK,EAAK,EAAE,cAAW,aAAU,qBAAkB,IAAM,GAAGL,KAAwB;CACtF,OACE,kBAACT,EAAS,MAAV;EACE,WAAWW,EAAKT,GAAaW,CAAS;EACrB;EACjB,GAAIJ;EAHN,UAAA,CAKGO,GACD,kBAAChB,EAAS,WAAV,EAAoB,WAAWG,EAAmB,CAAA,CACrC;;AAEnB;AAEA,SAASe,EAAI,EAAE,cAAW,OAAAC,GAAO,aAAU,GAAGV,KAAuB;CACnE,OACE,kBAACT,EAAS,KAAV;EAAc,WAAWW,EAAKP,GAAYS,CAAS;EAAG,GAAIJ;EAA1D,UAAA,CACGO,GACAX,KAAS,QAAQ,kBAAC,QAAD;GAAM,WAAW;GAAe,UAAAA;EAAY,CAAA,CAClD;;AAElB;AAEA,SAASgB,EAAM,EAAE,cAAW,GAAGZ,KAAyB;CACtD,OAAO,kBAACT,EAAS,OAAV;EAAgB,WAAWW,EAAKL,GAAcO,CAAS;EAAG,GAAIJ;CAAQ,CAAA;AAC/E;AAwCA,SAASc,EAA6C,EACpD,UACA,iBACA,iBAAc,IACd,cACA,GAAGd,KACgB;CACnB,IAAMe,IAAUC,KAAgBC,EAAM,MAAM,MAAS,CAACC,EAAK,QAAQ,CAAC,EAAE;CACtE,OACE,kBAACnB,GAAD;EAAa,cAAcgB;EAAS,GAAIf;EAAxC,UAAA,CACE,kBAACK,GAAD;GAAM,GAAIc;GACP,UAAAF,EAAM,KAAK,MACV,kBAACR,GAAD;IACE,GAAIS,EAAK;IACT,KAAKA,EAAK;IACV,OAAOA,EAAK;IACZ,OAAOA,EAAK;IACZ,UAAUA,EAAK;GAGZ,GADFA,EAAK,KACH,CACN;EACG,CAAA,GACLD,EAAM,KAAK,MACV,kBAACL,GAAD;GACE,GAAIM,EAAK;GACT,KAAKA,EAAK;GACV,OAAOA,EAAK;GACZ,aAAaA,EAAK,eAAeE;EAG5B,GADJF,EAAK,OACD,CACR,CACG;;AAEV;AAGA,IAAapB,IAAO,OAAO,OAAOgB,GAAe;CAAE;CAAM;CAAM;CAAK;AAAM,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tabs.styles.js","names":["root","list","tab","count","indicator","panel"],"sources":["../../../src/components/Tabs/Tabs.css.ts"],"sourcesContent":["import { style } from '@vanilla-extract/css'\n\nimport { focusRing } from '../../styles/shared.css'\nimport { vars } from '../../tokens/contract.css'\nimport { fontSize, fontWeight, radius, space } from '../../tokens/scale'\n\nexport const root = style({ fontFamily: vars.font.sans, color: vars.color.ink })\n\nexport const list = style({\n position: 'relative',\n display: 'flex',\n gap: space['6'],\n borderBottom: `1px solid ${vars.color.border}`,\n})\n\nexport const tab = style([\n focusRing,\n {\n display: 'inline-flex',\n alignItems: 'baseline',\n gap: space['2'],\n margin: 0,\n paddingBlock: space['3'],\n paddingInline: 0,\n border: 0,\n borderRadius: radius.sm,\n background: 'none',\n color: vars.color.inkMuted,\n fontFamily: 'inherit',\n fontSize: fontSize.lg,\n fontWeight: fontWeight.medium,\n whiteSpace: 'nowrap',\n cursor: 'pointer',\n transition: 'color 120ms',\n selectors: {\n '&:hover:not([data-disabled])': { color: vars.color.ink },\n '&[data-active]': { color: vars.color.ink },\n '&[data-disabled]': { cursor: 'not-allowed', color: vars.color.inkSubtle },\n },\n },\n])\n\nexport const count = style({\n fontSize: fontSize.sm,\n fontWeight: fontWeight.normal,\n color: vars.color.inkSubtle,\n})\n\nexport const indicator = style({\n position: 'absolute',\n bottom: -1,\n left: 0,\n height:
|
|
1
|
+
{"version":3,"file":"Tabs.styles.js","names":["root","list","tab","count","indicator","panel"],"sources":["../../../src/components/Tabs/Tabs.css.ts"],"sourcesContent":["import { style } from '@vanilla-extract/css'\n\nimport { focusRing } from '../../styles/shared.css'\nimport { vars } from '../../tokens/contract.css'\nimport { fontSize, fontWeight, radius, space } from '../../tokens/scale'\n\nexport const root = style({ fontFamily: vars.font.sans, color: vars.color.ink })\n\nexport const list = style({\n position: 'relative',\n display: 'flex',\n gap: space['6'],\n borderBottom: `1px solid ${vars.color.border}`,\n})\n\nexport const tab = style([\n focusRing,\n {\n display: 'inline-flex',\n alignItems: 'baseline',\n gap: space['2'],\n margin: 0,\n paddingBlock: space['3'],\n paddingInline: 0,\n border: 0,\n borderRadius: radius.sm,\n background: 'none',\n color: vars.color.inkMuted,\n fontFamily: 'inherit',\n fontSize: fontSize.lg,\n fontWeight: fontWeight.medium,\n whiteSpace: 'nowrap',\n cursor: 'pointer',\n transition: 'color 120ms',\n selectors: {\n '&:hover:not([data-disabled])': { color: vars.color.ink },\n '&[data-active]': { color: vars.color.ink },\n '&[data-disabled]': { cursor: 'not-allowed', color: vars.color.inkSubtle },\n },\n },\n])\n\nexport const count = style({\n fontSize: fontSize.sm,\n fontWeight: fontWeight.normal,\n color: vars.color.inkSubtle,\n})\n\nexport const indicator = style({\n position: 'absolute',\n bottom: -1,\n left: 0,\n height: '0.125rem',\n width: 'var(--active-tab-width)',\n translate: 'var(--active-tab-left)',\n borderRadius: radius.full,\n backgroundColor: vars.color.accent,\n transition: 'translate 200ms, width 200ms',\n '@media': { '(prefers-reduced-motion: reduce)': { transition: 'none' } },\n})\n\nexport const panel = style([focusRing, { paddingBlock: space['4'], borderRadius: radius.sm }])\n"],"mappings":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { Tabs } from './Tabs';
|
|
2
|
-
export type { TabItem, TabsListProps, TabsPanelProps, TabsProps, TabsRootProps, TabsTabProps, } from './Tabs';
|
|
2
|
+
export type { TabItem, TabsListProps, TabsPanelProps, TabsProps, TabsRootProps, TabsTabProps, TabsValueProps, } from './Tabs';
|
|
@@ -1,4 +1,37 @@
|
|
|
1
1
|
export declare const tag: import('@vanilla-extract/recipes').RuntimeFn<{
|
|
2
|
+
tone: {
|
|
3
|
+
neutral: {};
|
|
4
|
+
accent: {
|
|
5
|
+
backgroundColor: string;
|
|
6
|
+
borderColor: string;
|
|
7
|
+
color: string;
|
|
8
|
+
};
|
|
9
|
+
success: {
|
|
10
|
+
backgroundColor: string;
|
|
11
|
+
borderColor: string;
|
|
12
|
+
color: string;
|
|
13
|
+
};
|
|
14
|
+
warning: {
|
|
15
|
+
backgroundColor: string;
|
|
16
|
+
borderColor: string;
|
|
17
|
+
color: string;
|
|
18
|
+
};
|
|
19
|
+
danger: {
|
|
20
|
+
backgroundColor: string;
|
|
21
|
+
borderColor: string;
|
|
22
|
+
color: string;
|
|
23
|
+
};
|
|
24
|
+
info: {
|
|
25
|
+
backgroundColor: string;
|
|
26
|
+
borderColor: string;
|
|
27
|
+
color: string;
|
|
28
|
+
};
|
|
29
|
+
highlight: {
|
|
30
|
+
backgroundColor: string;
|
|
31
|
+
borderColor: string;
|
|
32
|
+
color: string;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
2
35
|
selected: {
|
|
3
36
|
true: {
|
|
4
37
|
backgroundColor: `var(--${string})`;
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { ComponentProps } from 'react';
|
|
2
|
+
export type TagTone = 'neutral' | 'accent' | 'success' | 'warning' | 'danger' | 'info' | 'highlight';
|
|
2
3
|
export interface TagProps extends ComponentProps<'span'> {
|
|
3
|
-
/**
|
|
4
|
+
/** Colour. `neutral` (default) is plain; the others carry meaning, as in `Badge`. */
|
|
5
|
+
tone?: TagTone;
|
|
6
|
+
/** Accent-tinted with a leading check, e.g. the active value in a group of tags. */
|
|
4
7
|
selected?: boolean;
|
|
5
8
|
}
|
|
6
9
|
/** A small rectangular mono label, e.g. an input method or event type. */
|
|
7
|
-
export declare function Tag({ selected, className, ...props }: TagProps): import('react').JSX.Element;
|
|
10
|
+
export declare function Tag({ tone, selected, className, children, ...props }: TagProps): import('react').JSX.Element;
|
|
@@ -1,13 +1,30 @@
|
|
|
1
1
|
import { tag as e } from "./Tag.styles.js";
|
|
2
|
+
import "../../styles/shared.styles.js";
|
|
2
3
|
import { clsx as t } from "clsx";
|
|
3
|
-
import {
|
|
4
|
+
import { Check as n } from "lucide-react";
|
|
5
|
+
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
4
6
|
// src/components/Tag/Tag.tsx
|
|
5
|
-
function
|
|
6
|
-
return /* @__PURE__ */
|
|
7
|
-
className: t(e({
|
|
8
|
-
|
|
7
|
+
function a({ tone: a = "neutral", selected: o = !1, className: s, children: c, ...l }) {
|
|
8
|
+
return /* @__PURE__ */ i("span", {
|
|
9
|
+
className: t(e({
|
|
10
|
+
tone: a,
|
|
11
|
+
selected: o
|
|
12
|
+
}), s),
|
|
13
|
+
...l,
|
|
14
|
+
children: [
|
|
15
|
+
o && /* @__PURE__ */ r(n, {
|
|
16
|
+
size: "1em",
|
|
17
|
+
strokeWidth: 2.5,
|
|
18
|
+
"aria-hidden": !0
|
|
19
|
+
}),
|
|
20
|
+
c,
|
|
21
|
+
o && /* @__PURE__ */ r("span", {
|
|
22
|
+
className: "tyvs8e1",
|
|
23
|
+
children: " (selected)"
|
|
24
|
+
})
|
|
25
|
+
]
|
|
9
26
|
});
|
|
10
27
|
}
|
|
11
|
-
export {
|
|
28
|
+
export { a as Tag };
|
|
12
29
|
|
|
13
30
|
//# sourceMappingURL=Tag.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tag.js","names":["styles.tag","Tag","props","clsx","tag","className"],"sources":["../../../src/components/Tag/Tag.tsx"],"sourcesContent":["import { clsx } from 'clsx'\nimport type { ComponentProps } from 'react'\n\nimport * as styles from './Tag.css'\n\nexport interface TagProps extends ComponentProps<'span'> {\n /** Accent-tinted, e.g. the active value in a group of tags. */\n selected?: boolean\n}\n\n/** A small rectangular mono label, e.g. an input method or event type. */\nexport function Tag({ selected = false
|
|
1
|
+
{"version":3,"file":"Tag.js","names":["styles.tag","Tag","props","clsx","tag","className","selected","Check","children"],"sources":["../../../src/components/Tag/Tag.tsx"],"sourcesContent":["import { clsx } from 'clsx'\nimport { Check } from 'lucide-react'\nimport type { ComponentProps } from 'react'\n\nimport * as styles from './Tag.css'\nimport { visuallyHidden } from '../../styles/shared.css'\n\nexport type TagTone = 'neutral' | 'accent' | 'success' | 'warning' | 'danger' | 'info' | 'highlight'\n\nexport interface TagProps extends ComponentProps<'span'> {\n /** Colour. `neutral` (default) is plain; the others carry meaning, as in `Badge`. */\n tone?: TagTone\n /** Accent-tinted with a leading check, e.g. the active value in a group of tags. */\n selected?: boolean\n}\n\n/** A small rectangular mono label, e.g. an input method or event type. */\nexport function Tag({\n tone = 'neutral',\n selected = false,\n className,\n children,\n ...props\n}: TagProps) {\n return (\n <span className={clsx(styles.tag({ tone, selected }), className)} {...props}>\n {selected && <Check size=\"1em\" strokeWidth={2.5} aria-hidden />}\n {children}\n {selected && <span className={visuallyHidden}> (selected)</span>}\n </span>\n )\n}\n"],"mappings":";;;;;;AAiBA,SAAgBC,EAAI,EAClB,UAAO,WACP,cAAW,IACX,cACA,aACA,GAAGC,KACQ;CACX,OACE,kBAAC,QAAD;EAAM,WAAWC,EAAKH,EAAW;GAAE;GAAM;EAAS,CAAC,GAAGK,CAAS;EAAG,GAAIH;EAAtE,UAAA;GACGI,KAAY,kBAACC,GAAD;IAAO,MAAK;IAAM,aAAa;IAAK,eAAA;GAAa,CAAA;GAC7DC;GACAF,KAAY,kBAAC,QAAD;IAAM,WAAA;IAA2B,UAAA;GAAiB,CAAA;EAC3D;;AAEV"}
|
|
@@ -3,7 +3,18 @@ import { createRuntimeFn as e } from "@vanilla-extract/recipes/createRuntimeFn";
|
|
|
3
3
|
// src/components/Tag/Tag.css.ts
|
|
4
4
|
var t = e({
|
|
5
5
|
defaultClassName: "at4kg60",
|
|
6
|
-
variantClassNames: {
|
|
6
|
+
variantClassNames: {
|
|
7
|
+
tone: {
|
|
8
|
+
neutral: "at4kg61",
|
|
9
|
+
accent: "at4kg62",
|
|
10
|
+
success: "at4kg63",
|
|
11
|
+
warning: "at4kg64",
|
|
12
|
+
danger: "at4kg65",
|
|
13
|
+
info: "at4kg66",
|
|
14
|
+
highlight: "at4kg67"
|
|
15
|
+
},
|
|
16
|
+
selected: { true: "at4kg68" }
|
|
17
|
+
},
|
|
7
18
|
defaultVariants: {},
|
|
8
19
|
compoundVariants: []
|
|
9
20
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tag.styles.js","names":["_7a468","tag","createRuntimeFn"],"sources":["../../../src/components/Tag/Tag.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 tag = recipe({\n base: {\n display: 'inline-flex',\n alignItems: 'center',\n paddingBlock: space['0.5'],\n paddingInline: space['1.5'],\n border: `1px solid ${vars.color.border}`,\n borderRadius: radius.sm,\n backgroundColor: vars.color.surface,\n color: vars.color.ink,\n fontFamily: vars.font.mono,\n fontSize: fontSize.xs,\n fontWeight: fontWeight.medium,\n lineHeight: 1.4,\n whiteSpace: 'nowrap',\n },\n variants: {\n selected: {\n true: {\n backgroundColor: vars.color.accentSubtle,\n borderColor: vars.color.accent,\n color: vars.color.accentInk,\n },\n },\n },\n})\n"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"Tag.styles.js","names":["_7a468","tag","createRuntimeFn"],"sources":["../../../src/components/Tag/Tag.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\nconst tone = (backgroundColor: string, borderColor: string, color: string) => ({\n backgroundColor,\n borderColor,\n color,\n})\n\nexport const tag = recipe({\n base: {\n display: 'inline-flex',\n alignItems: 'center',\n gap: space['1'],\n paddingBlock: space['0.5'],\n paddingInline: space['1.5'],\n border: `1px solid ${vars.color.border}`,\n borderRadius: radius.sm,\n backgroundColor: vars.color.surface,\n color: vars.color.ink,\n fontFamily: vars.font.mono,\n fontSize: fontSize.xs,\n fontWeight: fontWeight.medium,\n lineHeight: 1.4,\n whiteSpace: 'nowrap',\n },\n variants: {\n // Tinted fill, ink text, and the tone's fill colour as the border.\n tone: {\n neutral: {},\n accent: tone(vars.color.accentSubtle, vars.color.accent, vars.color.accentInk),\n success: tone(vars.color.successSubtle, vars.color.success, vars.color.successInk),\n warning: tone(vars.color.warningSubtle, vars.color.warning, vars.color.warningInk),\n danger: tone(vars.color.dangerSubtle, vars.color.danger, vars.color.dangerInk),\n info: tone(vars.color.infoSubtle, vars.color.info, vars.color.infoInk),\n highlight: tone(\n vars.color.highlightSubtle,\n vars.color.highlightBorder,\n vars.color.highlightInk,\n ),\n },\n // After `tone`, so it wins.\n selected: {\n true: {\n backgroundColor: vars.color.accentSubtle,\n borderColor: vars.color.accent,\n color: vars.color.accentInk,\n },\n },\n },\n})\n"],"mappings":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { Tag } from './Tag';
|
|
2
|
-
export type { TagProps } from './Tag';
|
|
2
|
+
export type { TagProps, TagTone } from './Tag';
|
|
@@ -1,7 +1,18 @@
|
|
|
1
1
|
import { ComponentProps, Ref } from 'react';
|
|
2
|
-
import { FieldBaseProps, FieldOptionProps } from '../Field/Field';
|
|
2
|
+
import { FieldBaseProps, FieldOptionProps, PartProps } from '../Field/Field';
|
|
3
|
+
/**
|
|
4
|
+
* Native input props (`id`, `name`, `placeholder`…) go on the `<input>`, except `className`, which
|
|
5
|
+
* goes on the field's root. Use `inputProps` for a class or anything else meant only for the `<input>`.
|
|
6
|
+
*/
|
|
3
7
|
export interface TextInputProps extends FieldBaseProps, FieldOptionProps, Omit<ComponentProps<'input'>, 'ref'> {
|
|
8
|
+
/** Forwarded to the `<input>` (for form libraries, and to focus it). */
|
|
4
9
|
ref?: Ref<HTMLInputElement>;
|
|
10
|
+
/** Goes on the `<input>`, so `<label htmlFor>` and `getElementById(id).focus()` work. */
|
|
11
|
+
id?: string;
|
|
12
|
+
/** Goes on the field's root element, not the `<input>`. Use `inputProps.className` for that. */
|
|
13
|
+
className?: string;
|
|
14
|
+
/** Extra props for the `<input>`, e.g. `{ className, 'data-testid': 'name' }`. */
|
|
15
|
+
inputProps?: PartProps<Omit<ComponentProps<'input'>, 'ref'>>;
|
|
5
16
|
/** Shows "count/maxLength" inside the input. Needs `maxLength`, which stops typing at the limit. */
|
|
6
17
|
showCount?: boolean;
|
|
7
18
|
/**
|
|
@@ -13,4 +24,4 @@ export interface TextInputProps extends FieldBaseProps, FieldOptionProps, Omit<C
|
|
|
13
24
|
onValueChange?: (value: string) => void;
|
|
14
25
|
}
|
|
15
26
|
/** Single-line text input with a label. Spread `register('name')` from react-hook-form onto it. */
|
|
16
|
-
export declare function TextInput({ label, description, error, required,
|
|
27
|
+
export declare function TextInput({ label, description, error, required, hideLabel, fieldProps, disabled, className, showCount, countLimit, maxLength, value, defaultValue, onChange, onValueChange, ref, inputProps, ...props }: TextInputProps): import('react').JSX.Element;
|
|
@@ -1,62 +1,59 @@
|
|
|
1
1
|
import { counter as e } from "./TextInput.styles.js";
|
|
2
2
|
import { useCharCount as t } from "./useCharCount.js";
|
|
3
3
|
import { adornment as n, counter as r, frame as i, frameInput as a, input as o } from "../../styles/input.styles.js";
|
|
4
|
-
import { Field as s
|
|
5
|
-
import { clsx as
|
|
6
|
-
import { jsx as
|
|
7
|
-
import { Input as
|
|
4
|
+
import { Field as s } from "../Field/Field.js";
|
|
5
|
+
import { clsx as c } from "clsx";
|
|
6
|
+
import { jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
7
|
+
import { Input as d } from "@base-ui/react/input";
|
|
8
8
|
// src/components/TextInput/TextInput.tsx
|
|
9
|
-
function
|
|
10
|
-
let
|
|
11
|
-
value:
|
|
12
|
-
defaultValue:
|
|
13
|
-
maxLength:
|
|
14
|
-
showCount:
|
|
15
|
-
countLimit:
|
|
16
|
-
}),
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
},
|
|
20
|
-
|
|
21
|
-
},
|
|
22
|
-
|
|
23
|
-
...
|
|
24
|
-
ref:
|
|
25
|
-
value:
|
|
26
|
-
defaultValue:
|
|
27
|
-
maxLength:
|
|
28
|
-
required:
|
|
29
|
-
disabled:
|
|
30
|
-
onChange:
|
|
31
|
-
className:
|
|
9
|
+
function f({ label: f, description: p, error: m, required: h, hideLabel: g, fieldProps: _, disabled: v, className: y, showCount: b = !1, countLimit: x, maxLength: S, value: C, defaultValue: w, onChange: T, onValueChange: E, ref: D, inputProps: O, ...k }) {
|
|
10
|
+
let A = t({
|
|
11
|
+
value: C,
|
|
12
|
+
defaultValue: w,
|
|
13
|
+
maxLength: S,
|
|
14
|
+
showCount: b,
|
|
15
|
+
countLimit: x
|
|
16
|
+
}), j = (e) => {
|
|
17
|
+
let t = typeof D == "function" ? D(e) : void 0;
|
|
18
|
+
return D && typeof D != "function" && (D.current = e), e && A.setLength(e.value.length), t;
|
|
19
|
+
}, M = (e) => {
|
|
20
|
+
A.setLength(e.target.value.length), T?.(e), E?.(e.target.value);
|
|
21
|
+
}, N = A.limit !== void 0, P = /* @__PURE__ */ l(d, {
|
|
22
|
+
...k,
|
|
23
|
+
...O,
|
|
24
|
+
ref: j,
|
|
25
|
+
value: C,
|
|
26
|
+
defaultValue: w,
|
|
27
|
+
maxLength: S,
|
|
28
|
+
required: h,
|
|
29
|
+
disabled: v,
|
|
30
|
+
onChange: M,
|
|
31
|
+
className: c(N ? a : o, O?.className)
|
|
32
32
|
});
|
|
33
|
-
return /* @__PURE__ */
|
|
34
|
-
...
|
|
35
|
-
label:
|
|
36
|
-
description:
|
|
37
|
-
error:
|
|
38
|
-
required:
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
disabled: S,
|
|
44
|
-
className: l(x?.className, C),
|
|
45
|
-
children: R ? /* @__PURE__ */ d("div", {
|
|
33
|
+
return /* @__PURE__ */ l(s, {
|
|
34
|
+
..._,
|
|
35
|
+
label: f,
|
|
36
|
+
description: p,
|
|
37
|
+
error: m,
|
|
38
|
+
required: h,
|
|
39
|
+
hideLabel: g,
|
|
40
|
+
disabled: v,
|
|
41
|
+
className: c(_?.className, y),
|
|
42
|
+
children: N ? /* @__PURE__ */ u("div", {
|
|
46
43
|
className: i,
|
|
47
|
-
"data-disabled":
|
|
48
|
-
children: [
|
|
49
|
-
className:
|
|
50
|
-
"data-over":
|
|
44
|
+
"data-disabled": v || void 0,
|
|
45
|
+
children: [P, /* @__PURE__ */ u("span", {
|
|
46
|
+
className: c(n, r, e),
|
|
47
|
+
"data-over": A.over,
|
|
51
48
|
children: [
|
|
52
|
-
|
|
49
|
+
A.count,
|
|
53
50
|
"/",
|
|
54
|
-
|
|
51
|
+
A.limit
|
|
55
52
|
]
|
|
56
53
|
})]
|
|
57
|
-
}) :
|
|
54
|
+
}) : P
|
|
58
55
|
});
|
|
59
56
|
}
|
|
60
|
-
export {
|
|
57
|
+
export { f as TextInput };
|
|
61
58
|
|
|
62
59
|
//# sourceMappingURL=TextInput.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextInput.js","names":["input.frameInput","input.input","input.frame","input.adornment","input.counter","styles.counter","counter$1","TextInput","props","
|
|
1
|
+
{"version":3,"file":"TextInput.js","names":["counter","input.frameInput","input.input","input.frame","input.adornment","input.counter","styles.counter","counter$1","TextInput","props","counter$2","useCharCount","setRef","cleanup","ref","node","handleChange","event","onChange","onValueChange","hasCounter","control","Input","inputProps","clsx","frameInput","input","Field","fieldProps","className","frame","disabled","adornment","counter"],"sources":["../../../src/components/TextInput/TextInput.tsx"],"sourcesContent":["import { Input } from '@base-ui/react/input'\nimport { clsx } from 'clsx'\nimport type { ChangeEvent, ComponentProps, Ref } from 'react'\n\nimport * as styles from './TextInput.css'\nimport { useCharCount } from './useCharCount'\nimport * as input from '../../styles/input.css'\nimport { Field, type FieldBaseProps, type FieldOptionProps, type PartProps } from '../Field/Field'\n\n/**\n * Native input props (`id`, `name`, `placeholder`…) go on the `<input>`, except `className`, which\n * goes on the field's root. Use `inputProps` for a class or anything else meant only for the `<input>`.\n */\nexport interface TextInputProps\n extends FieldBaseProps, FieldOptionProps, Omit<ComponentProps<'input'>, 'ref'> {\n /** Forwarded to the `<input>` (for form libraries, and to focus it). */\n ref?: Ref<HTMLInputElement>\n /** Goes on the `<input>`, so `<label htmlFor>` and `getElementById(id).focus()` work. */\n id?: string\n /** Goes on the field's root element, not the `<input>`. Use `inputProps.className` for that. */\n className?: string\n /** Extra props for the `<input>`, e.g. `{ className, 'data-testid': 'name' }`. */\n inputProps?: PartProps<Omit<ComponentProps<'input'>, 'ref'>>\n /** Shows \"count/maxLength\" inside the input. Needs `maxLength`, which stops typing at the limit. */\n showCount?: boolean\n /**\n * Soft limit: shows \"count/countLimit\" without setting native `maxLength`, so people can type\n * past it. Over the limit the count turns red and gets `data-over=\"true\"`; show an `error` too.\n */\n countLimit?: number\n /** Called with the new string value on every change. */\n onValueChange?: (value: string) => void\n}\n\n/** Single-line text input with a label. Spread `register('name')` from react-hook-form onto it. */\nexport function TextInput({\n label,\n description,\n error,\n required,\n hideLabel,\n fieldProps,\n disabled,\n className,\n showCount = false,\n countLimit,\n maxLength,\n value,\n defaultValue,\n onChange,\n onValueChange,\n ref,\n inputProps,\n ...props\n}: TextInputProps) {\n const counter = useCharCount({ value, defaultValue, maxLength, showCount, countLimit })\n\n // Re-runs every render, so the count picks up values set outside React (react-hook-form's\n // default values and `reset`). The caller's ref runs first because it may set the value.\n const setRef = (node: HTMLInputElement | null) => {\n const cleanup = typeof ref === 'function' ? ref(node) : undefined\n if (ref && typeof ref !== 'function') ref.current = node\n if (node) counter.setLength(node.value.length)\n return cleanup\n }\n\n const handleChange = (event: ChangeEvent<HTMLInputElement>) => {\n counter.setLength(event.target.value.length)\n onChange?.(event)\n onValueChange?.(event.target.value)\n }\n const hasCounter = counter.limit !== undefined\n\n const control = (\n <Input\n {...props}\n {...inputProps}\n ref={setRef}\n value={value}\n defaultValue={defaultValue}\n maxLength={maxLength}\n required={required}\n disabled={disabled}\n onChange={handleChange}\n className={clsx(hasCounter ? input.frameInput : input.input, inputProps?.className)}\n />\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 {hasCounter ? (\n <div className={input.frame} data-disabled={disabled || undefined}>\n {control}\n <span\n className={clsx(input.adornment, input.counter, styles.counter)}\n data-over={counter.over}\n >\n {counter.count}/{counter.limit}\n </span>\n </div>\n ) : (\n control\n )}\n </Field>\n )\n}\n"],"mappings":";;;;;;;;AAmCA,SAAgBQ,EAAU,EACxB,UACA,gBACA,UACA,aACA,cACA,eACA,aACA,cACA,eAAY,IACZ,eACA,cACA,UACA,iBACA,aACA,kBACA,QACA,eACA,GAAGC,KACc;CACjB,IAAMT,IAAUW,EAAa;EAAE;EAAO;EAAc;EAAW;EAAW;CAAW,CAAC,GAIhFC,KAAU,MAAkC;EAChD,IAAMC,IAAU,OAAOC,KAAQ,aAAaA,EAAIC,CAAI,IAAI,KAAA;EAGxD,OAFID,KAAO,OAAOA,KAAQ,eAAY,EAAI,UAAUC,IAChDA,KAAML,EAAQ,UAAUK,EAAK,MAAM,MAAM,GACtCF;CACT,GAEMG,KAAgB,MAAyC;EAG7D,AAFAN,EAAQ,UAAUO,EAAM,OAAO,MAAM,MAAM,GAC3CC,IAAWD,CAAK,GAChBE,IAAgBF,EAAM,OAAO,KAAK;CACpC,GACMG,IAAapB,EAAQ,UAAU,KAAA,GAE/BqB,IACJ,kBAACC,GAAD;EACE,GAAIb;EACJ,GAAIc;EACJ,KAAKX;EACE;EACO;EACH;EACD;EACA;EACV,UAAUI;EACV,WAAWQ,EAAKJ,IAAanB,IAAmBC,GAAaqB,GAAY,SAAS;CACnF,CAAA;CAGH,OACE,kBAACI,GAAD;EACE,GAAIC;EACG;EACM;EACN;EACG;EACC;EACD;EACV,WAAWJ,EAAKI,GAAY,WAAWC,CAAS;EAE/C,UAAAT,IACC,kBAAC,OAAD;GAAK,WAAWjB;GAAa,iBAAe4B,KAAY,KAAA;GAAxD,UAAA,CACGV,GACD,kBAAC,QAAD;IACE,WAAWG,EAAKpB,GAAiBC,GAAeC,CAAc;IAC9D,aAAWN,EAAQ;IAFrB,UAAA;KAIGA,EAAQ;KAAM;KAAEA,EAAQ;IACrB;GACH,CAAA,CAAA;EAEL,CAAA,IAAAqB;CAEG,CAAA;AAEX"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { ComponentProps, Ref } from 'react';
|
|
2
2
|
import { FieldBaseProps, FieldOptionProps } from '../Field/Field';
|
|
3
3
|
export interface TextareaProps extends FieldBaseProps, FieldOptionProps, Omit<ComponentProps<'textarea'>, 'ref'> {
|
|
4
|
+
/** Lines shown when empty (default 3). It then grows with its content, up to 15 lines, and scrolls after that. */
|
|
5
|
+
rows?: number;
|
|
6
|
+
/** Forwarded to the `<textarea>` (for form libraries). */
|
|
4
7
|
ref?: Ref<HTMLTextAreaElement>;
|
|
5
8
|
/** Shows "count/maxLength" under the textarea. Needs `maxLength`, which stops typing at the limit. */
|
|
6
9
|
showCount?: boolean;
|
|
@@ -12,5 +15,5 @@ export interface TextareaProps extends FieldBaseProps, FieldOptionProps, Omit<Co
|
|
|
12
15
|
/** Called with the new string value on every change. */
|
|
13
16
|
onValueChange?: (value: string) => void;
|
|
14
17
|
}
|
|
15
|
-
/** Multi-line text input with a label. */
|
|
16
|
-
export declare function Textarea({ label, description, error, required,
|
|
18
|
+
/** Multi-line text input with a label. Grows to fit its content (CSS `field-sizing`; browsers without it get a resize handle). */
|
|
19
|
+
export declare function Textarea({ label, description, error, required, hideLabel, fieldProps, disabled, className, rows, showCount, countLimit, maxLength, value, defaultValue, onChange, onValueChange, ref, ...props }: TextareaProps): import('react').JSX.Element;
|
|
@@ -1,55 +1,55 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { rowsProperty as e, textarea as t } from "./Textarea.styles.js";
|
|
2
2
|
import "../../styles/input.styles.js";
|
|
3
|
-
import { Field as
|
|
3
|
+
import { Field as n } from "../Field/Field.js";
|
|
4
4
|
import { useCharCount as r } from "../TextInput/useCharCount.js";
|
|
5
5
|
import { clsx as i } from "clsx";
|
|
6
6
|
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
7
7
|
import { Field as s } from "@base-ui/react/field";
|
|
8
8
|
// src/components/Textarea/Textarea.tsx
|
|
9
|
-
function c({ label: c, description: l, error: u, required: d,
|
|
10
|
-
let
|
|
11
|
-
value:
|
|
12
|
-
defaultValue:
|
|
13
|
-
maxLength:
|
|
14
|
-
showCount:
|
|
15
|
-
countLimit:
|
|
16
|
-
}),
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
},
|
|
20
|
-
|
|
9
|
+
function c({ label: c, description: l, error: u, required: d, hideLabel: f, fieldProps: p, disabled: m, className: h, rows: g = 3, showCount: _ = !1, countLimit: v, maxLength: y, value: b, defaultValue: x, onChange: S, onValueChange: C, ref: w, ...T }) {
|
|
10
|
+
let E = r({
|
|
11
|
+
value: b,
|
|
12
|
+
defaultValue: x,
|
|
13
|
+
maxLength: y,
|
|
14
|
+
showCount: _,
|
|
15
|
+
countLimit: v
|
|
16
|
+
}), D = (e) => {
|
|
17
|
+
let t = typeof w == "function" ? w(e) : void 0;
|
|
18
|
+
return w && typeof w != "function" && (w.current = e), e && E.setLength(e.value.length), t;
|
|
19
|
+
}, O = (e) => {
|
|
20
|
+
E.setLength(e.target.value.length), S?.(e), C?.(e.target.value);
|
|
21
21
|
};
|
|
22
|
-
return /* @__PURE__ */ o(
|
|
23
|
-
...
|
|
22
|
+
return /* @__PURE__ */ o(n, {
|
|
23
|
+
...p,
|
|
24
24
|
label: c,
|
|
25
25
|
description: l,
|
|
26
26
|
error: u,
|
|
27
27
|
required: d,
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
hideLabel: h,
|
|
32
|
-
disabled: _,
|
|
33
|
-
className: i(g?.className, v),
|
|
28
|
+
hideLabel: f,
|
|
29
|
+
disabled: m,
|
|
30
|
+
className: i(p?.className, h),
|
|
34
31
|
children: [/* @__PURE__ */ a(s.Control, { render: /* @__PURE__ */ a("textarea", {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
maxLength: S,
|
|
32
|
+
...T,
|
|
33
|
+
ref: D,
|
|
34
|
+
rows: g,
|
|
35
|
+
value: b,
|
|
36
|
+
defaultValue: x,
|
|
37
|
+
maxLength: y,
|
|
42
38
|
required: d,
|
|
43
|
-
disabled:
|
|
44
|
-
onChange:
|
|
45
|
-
className:
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
39
|
+
disabled: m,
|
|
40
|
+
onChange: O,
|
|
41
|
+
className: t,
|
|
42
|
+
style: {
|
|
43
|
+
...T.style,
|
|
44
|
+
[e]: g
|
|
45
|
+
}
|
|
46
|
+
}) }), E.limit !== void 0 && /* @__PURE__ */ o("span", {
|
|
47
|
+
className: i("_12aoxdme", "_3gmpop1"),
|
|
48
|
+
"data-over": E.over,
|
|
49
49
|
children: [
|
|
50
|
-
|
|
50
|
+
E.count,
|
|
51
51
|
"/",
|
|
52
|
-
|
|
52
|
+
E.limit
|
|
53
53
|
]
|
|
54
54
|
})]
|
|
55
55
|
});
|