@espressif/dashboard-ui-components 1.14.0 → 1.15.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/.claude/rules/dashboard-ui-consumption.md +34 -0
- package/.cursor/rules/dashboard-ui-consumption.mdc +1 -0
- package/CHANGELOG.md +88 -1
- package/README.md +18 -2
- package/dist/common/index.d.ts +3 -3
- package/dist/common/my-account-menu/my-account-menu.js +3 -3
- package/dist/components/async-multi-select/async-multi-select.js +4 -8
- package/dist/components/async-multi-select/index.d.ts +5 -1
- package/dist/components/avatar/avatar.js +1 -1
- package/dist/components/bottom-sheet/_hooks/use-sheet-drag.js +1 -1
- package/dist/components/breadcrumb/index.d.ts +4 -1
- package/dist/components/button/button.js +2 -2
- package/dist/components/button/flash-button.js +4 -4
- package/dist/components/cards/index.d.ts +1 -1
- package/dist/components/cards/section-card.js +2 -2
- package/dist/components/carousel/carousel.js +8 -4
- package/dist/components/carousel/index.d.ts +8 -0
- package/dist/components/combobox/index.d.ts +3 -1
- package/dist/components/coverflow/coverflow.js +3 -2
- package/dist/components/coverflow/index.d.ts +2 -0
- package/dist/components/data-table/data-table.js +8 -4
- package/dist/components/data-table/index.d.ts +5 -1
- package/dist/components/date-range-picker/date-range-picker.js +5 -5
- package/dist/components/date-range-picker/index.d.ts +9 -1
- package/dist/components/dialog/index.d.ts +3 -1
- package/dist/components/facet-filters/active-filters.js +2 -1
- package/dist/components/facet-filters/filter-group.js +2 -1
- package/dist/components/facet-filters/index.d.ts +4 -0
- package/dist/components/file-upload/file-upload.js +2 -2
- package/dist/components/file-upload/index.d.ts +2 -0
- package/dist/components/horizontal-stepper/horizontal-stepper.js +2 -2
- package/dist/components/index.d.ts +5 -5
- package/dist/components/key-value-manager/index.d.ts +8 -0
- package/dist/components/key-value-manager/key-value-manager-table.js +4 -4
- package/dist/components/key-value-manager/key-value-manager.js +5 -1
- package/dist/components/key-value-manager/key-value-manager.props.js +5 -1
- package/dist/components/list-details/index.d.ts +1 -1
- package/dist/components/nav-bar/index.d.ts +19 -2
- package/dist/components/nav-bar/nav-bar-mobile-menu.js +4 -3
- package/dist/components/nav-bar/nav-bar.js +10 -7
- package/dist/components/sheet/index.d.ts +3 -1
- package/dist/components/sidebar/index.d.ts +13 -6
- package/dist/components/sidebar/sidebar.js +4 -2
- package/dist/components/simple-paginated-list/index.d.ts +11 -2
- package/dist/components/simple-paginated-list/simple-paginated-list.js +3 -3
- package/dist/components/stat-card/index.d.ts +2 -0
- package/dist/components/stat-card/stat-card.js +2 -2
- package/dist/components/tag/index.d.ts +2 -0
- package/dist/components/tag/tag.js +2 -2
- package/dist/components/tag-input/index.d.ts +5 -0
- package/dist/components/tag-input/tag-input.js +5 -3
- package/dist/components/transfer-list/index.d.ts +22 -2
- package/dist/components/transfer-list/transfer-list.js +30 -8
- package/dist/components/user-type-badge/index.d.ts +2 -0
- package/dist/components/user-type-badge/user-type-badge.js +3 -2
- package/dist/core/animate-ui/components/radix/dialog.js +2 -2
- package/dist/core/animate-ui/components/radix/sheet.js +3 -3
- package/dist/core/animate-ui/components/radix/sidebar.js +4 -4
- package/dist/core/animate-ui/components/radix/toggle-group.js +4 -4
- package/dist/core/animate-ui/primitives/animate/tooltip.js +3 -0
- package/dist/core/breadcrumb.js +2 -2
- package/dist/core/button/craft-button.js +4 -4
- package/dist/core/combobox/combobox.js +2 -2
- package/dist/index.d.ts +7 -7
- package/dist/layouts/index.d.ts +81 -35
- package/dist/layouts/minimal-workspace-layout/minimal-workspace-layout.js +8 -2
- package/dist/layouts/shared/account-menu-props.js +3 -2
- package/dist/layouts/workspace-layout/account-menu/account-menu.js +19 -8
- package/dist/layouts/workspace-layout/breadcrumbs/workspace-breadcrumbs.js +14 -11
- package/dist/layouts/workspace-layout/header/header.js +3 -3
- package/dist/layouts/workspace-layout/workspace-layout.js +13 -5
- package/dist/{my-account-menu.props-C7DK71WC.d.ts → my-account-menu.props-V3kFdvCZ.d.ts} +2 -0
- package/dist/{section-card-DqQeQkzU.d.ts → section-card-Bs3sKQtv.d.ts} +6 -1
- package/dist/{types-CkXflqg7.d.ts → types-CoZOfz4S.d.ts} +12 -1
- package/dist/utils/color.js +10 -1
- package/dist/utils/index.d.ts +6 -1
- package/dist/utils/variant.js +38 -38
- package/package.json +4 -2
- package/src/styles/colors.css +23 -2
|
@@ -73,6 +73,7 @@ export function Example() {
|
|
|
73
73
|
|
|
74
74
|
- Add the library's styles once in your Tailwind v4 entry CSS: `@import "@espressif/dashboard-ui-components/styles";`. That file already declares the `@source` for the compiled `dist/`, so no extra `content`/`@source` entry is needed.
|
|
75
75
|
- Retheme by redeclaring the CSS custom properties (design tokens) **after** the `@import`, in both `:root` and `.dark` (or `[data-theme="dark"]`). Override `--font-sans` / `--font-mono` inside an `@theme` block.
|
|
76
|
+
- `primary`, `warning` and `disabled` have a text token, `--color-{primary,warning,disabled}-text`: variants draw text and icons in it, fills keep the base colour. When an app re-colours one of those three, it sets the matching `-text` token too (light and dark), at 4.5:1 on the page and on the colour's `/5` and `/10` tints. For text in those colours in app markup use `text-warning-text` (etc.), not `text-warning`, which is the fill colour. Solid `warning` and `disabled` surfaces (white text) fill with `--color-{warning,disabled}-solid`, a shade deeper than the base colour; retheme those with the base colour too.
|
|
76
77
|
- Layout heights: use `--espd-shell-header-height`, `--espd-workspace-layout-footer-height` and
|
|
77
78
|
`--espd-workspace-layout-hidden-footer-height`. The old names (`--espd-header-height`,
|
|
78
79
|
`--espd-footer-height`, `--espd-hidden-footer-height`) are deprecated fallbacks: do not use them
|
|
@@ -173,6 +174,39 @@ Things agents get wrong:
|
|
|
173
174
|
- For a link that looks like a button use `asChild`, never a Button that navigates in `onClick`:
|
|
174
175
|
`<Button asChild startIcon={<Plus />}><Link to="/new">Add</Link></Button>`. With `disabled`/`loading` the link gets `aria-disabled`, `tabIndex={-1}` and its clicks are cancelled.
|
|
175
176
|
|
|
177
|
+
## Showing an app in another language (1.15)
|
|
178
|
+
|
|
179
|
+
The library ships English only and translates nothing. Every word it writes
|
|
180
|
+
itself (visible or for screen readers) is an optional prop whose default is that
|
|
181
|
+
English: pass the app's own translated words. Several strings → a `labels`
|
|
182
|
+
object; one string → a `<thing>Label` prop. Function labels receive what they
|
|
183
|
+
name (`goToSlide: (n) => …`, `deleteItem: (key) => …`).
|
|
184
|
+
|
|
185
|
+
- Shell: `WorkspaceLayout` / `MinimalWorkspaceLayout` take `accountMenuLabels`
|
|
186
|
+
(the account menu: `menu`, `colorTheme`, `darkMode`, `lightMode`, `language`,
|
|
187
|
+
`logout`) and `labels` (`WorkspaceLayoutLabels` / `MinimalWorkspaceLayoutLabels`:
|
|
188
|
+
sidebar toggle/expand/collapse, the phone sheet's `closeSidebar`,
|
|
189
|
+
`sidebarTitle`, `sidebarDescription`; `breadcrumbs` on WorkspaceLayout).
|
|
190
|
+
`MyAccountMenu` `triggerLabel`; `Sidebar` `labels`; `SidebarTrigger` `label`.
|
|
191
|
+
- Overlays: `closeLabel` on every `DialogContent` and `SheetContent` (the X
|
|
192
|
+
button). Pass it everywhere, e.g. through one small app wrapper.
|
|
193
|
+
- `NavBar` `labels` (+ `moreLabel`), `Carousel` `labels` (`pagination`,
|
|
194
|
+
`goToSlide`, `roleDescription`, `slideRoleDescription`, …), `Coverflow`
|
|
195
|
+
`labels.roleDescription`.
|
|
196
|
+
- Data: `DataTable` `selectAllLabel` / `selectRowLabel` (plus its existing
|
|
197
|
+
`previousLabel`, `nextLabel`, `pageLabel`, …), `SimplePaginatedList` `labels`,
|
|
198
|
+
`KeyValueManager` `labels`, `TransferList` `labels`, `DateRangePicker`
|
|
199
|
+
`startDateLabel` / `endDateLabel` / `cancelLabel` / `applyLabel` (plus
|
|
200
|
+
`clearLabel`, `presetLabels`, `placeholder`).
|
|
201
|
+
- Small ones: `StatCard` `infoIconLabel`, `SectionCard` `toggleLabel`,
|
|
202
|
+
`UserTypeBadge` `label`, `BreadcrumbEllipsis` `moreLabel`, `Tag` `deleteLabel`,
|
|
203
|
+
`TagInput` `removeTagLabel`, `FileUpload` `removeFileLabel`,
|
|
204
|
+
`AsyncCombobox` `loadMoreLabel`, `AsyncMultiSelect` `removeLabel` / `moreLabel`,
|
|
205
|
+
`FacetFiltersLabels.clearSearch`, `ActiveFilterTag.deleteLabel`.
|
|
206
|
+
|
|
207
|
+
Dates and numbers that a component formats itself (calendar month names,
|
|
208
|
+
`StatCard` values, file sizes) are not localized by these props.
|
|
209
|
+
|
|
176
210
|
## Optional peer dependencies
|
|
177
211
|
|
|
178
212
|
Install only when the feature is used:
|
|
@@ -67,6 +67,7 @@ export function Example() {
|
|
|
67
67
|
|
|
68
68
|
- Add the library's styles once in your Tailwind v4 entry CSS: `@import "@espressif/dashboard-ui-components/styles";`. It already declares the `@source` for `dist/`.
|
|
69
69
|
- Retheme by redeclaring the CSS custom properties (design tokens) **after** the `@import`, in both `:root` and `.dark` (or `[data-theme="dark"]`). Override `--font-sans` / `--font-mono` inside an `@theme` block.
|
|
70
|
+
- `primary`, `warning` and `disabled` have a text token, `--color-{primary,warning,disabled}-text`: variants draw text and icons in it, fills keep the base colour. When an app re-colours one of those three, it sets the matching `-text` token too (light and dark), at 4.5:1 on the page and on the colour's `/5` and `/10` tints. For text in those colours in app markup use `text-warning-text` (etc.), not `text-warning`, which is the fill colour. Solid `warning` and `disabled` surfaces (white text) fill with `--color-{warning,disabled}-solid`, a shade deeper than the base colour; retheme those with the base colour too.
|
|
70
71
|
- Pick `./theme.css` instead of `./styles` only when the app has its own `@import "tailwindcss"` (or legacy CSS a reset would break); then the app styles `body` itself.
|
|
71
72
|
- Dark mode applies under `.dark` **or** `[data-theme="dark"]` on an ancestor; override dark tokens under the selector the app uses. The library has no `prefers-color-scheme` handling.
|
|
72
73
|
- `MinimalWorkspaceLayout` (from `/layouts`) is the header-less alternative to `WorkspaceLayout` with the same props: switch by renaming the component. It has no header bar or status footer (`footerConfig`, `hideBreadcrumbs`, `sidebarConfig.allowCollapsible` / `variant` do not exist on it), starts collapsed (`defaultSidebarOpen` defaults to `false`), and puts `topRightContent` (fallback `headerConfig.rightContent`) over the content. Theme it with the `--espd-minimal-workspace-layout-*` tokens, not `className` overrides on its parts: the sidebar surface defaults to the page background (`-sidebar-background`, `-sidebar-background-expanded`), and its border, shadow and row accent are derived from that surface unless `-sidebar-border-color`, `-sidebar-elevation` or `-sidebar-accent` are set. Keep `-sidebar-width-collapsed` within 48–56px. With `sidebarConfig.hideWhenCollapsed` the collapsed sidebar is hidden instead of a rail: a click on the content's left edge peeks it over the content until the pointer leaves it, and `MinimalWorkspaceSidebarTrigger` (from `/layouts`, placed in `topRightContent`) opens it inline; a peek never reaches `onSidebarOpenChange`. Do not build an edge or trigger in the app. The edge strip and the peek shadow are `-edge-color`, `-edge-width` and `-sidebar-overlay-elevation`. A page with a toolbar of its own passes `hideMobileTopBar`: the layout then draws no phone top bar, and a `MinimalWorkspaceSidebarTrigger` in that toolbar is the phone's menu button (it renders nothing on a phone otherwise). Do not build a phone menu button in the app.
|
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,93 @@ All notable changes to this project are documented here. The format is based on
|
|
|
4
4
|
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres
|
|
5
5
|
to [Semantic Versioning](https://semver.org/).
|
|
6
6
|
|
|
7
|
+
## [1.15.0] - 2026-11-26
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
- **Labels for an app shown in another language.** Every word the library itself
|
|
11
|
+
puts on screen or reads to a screen reader can now be passed in; each defaults
|
|
12
|
+
to the English it said before, so nothing changes for an app that passes none.
|
|
13
|
+
- `AccountMenu` `labels` (`AccountMenuLabels`: `menu`, `colorTheme`,
|
|
14
|
+
`darkMode`, `lightMode`, `language`, `logout`), and `accountMenuLabels` on
|
|
15
|
+
`WorkspaceLayout` and `MinimalWorkspaceLayout`.
|
|
16
|
+
- `MyAccountMenu` `triggerLabel` (was always "My Account").
|
|
17
|
+
- `DialogContent` and `SheetContent` `closeLabel` (was always "Close").
|
|
18
|
+
- `NavBar` `labels` (`NavBarLabels`: `navigation`, `openMenu`, `moreItems`,
|
|
19
|
+
`mobileNavigation`, `back`, `close`).
|
|
20
|
+
- `Carousel` `labels`: `pagination` ("Carousel pagination"), `goToSlide`
|
|
21
|
+
(the dots), `roleDescription` and `slideRoleDescription` ("carousel" /
|
|
22
|
+
"slide"). `CoverflowLabels.roleDescription`.
|
|
23
|
+
- `WorkspaceLayout` `labels` (`WorkspaceLayoutLabels`: `toggleSidebar`,
|
|
24
|
+
`closeSidebar`, `sidebarTitle`, `sidebarDescription`, `breadcrumbs`);
|
|
25
|
+
`MinimalWorkspaceLayoutLabels` gains `closeSidebar`, `sidebarTitle` and
|
|
26
|
+
`sidebarDescription` (the phone sheet). `WorkspaceHeader`
|
|
27
|
+
`toggleSidebarLabel`.
|
|
28
|
+
- `Sidebar` `labels` (`SidebarLabels`: `close`, `mobileTitle`,
|
|
29
|
+
`mobileDescription`); `SidebarTrigger` `label`; `SidebarPrimitive`
|
|
30
|
+
`mobileTitle` / `mobileDescription`.
|
|
31
|
+
- `BreadcrumbEllipsis` `moreLabel`, `StatCard` `infoIconLabel`,
|
|
32
|
+
`SectionCard` `toggleLabel`, `UserTypeBadge` `label`, `Tag` `deleteLabel`,
|
|
33
|
+
`TagInput` `removeTagLabel`, `FileUpload` `removeFileLabel`,
|
|
34
|
+
`AsyncCombobox` `loadMoreLabel`, `AsyncMultiSelect` `removeLabel` and
|
|
35
|
+
`moreLabel`.
|
|
36
|
+
- `DataTable` `selectAllLabel` / `selectRowLabel`; `DateRangePicker`
|
|
37
|
+
`startDateLabel`, `endDateLabel`, `cancelLabel`, `applyLabel`.
|
|
38
|
+
- `SimplePaginatedList` `labels` (`previousPage`, `nextPage`);
|
|
39
|
+
`KeyValueManagerLabels` gains `previousPage`, `nextPage`, `deleteItem` and
|
|
40
|
+
`clearSearch`; `TransferList` `labels` (`TransferListLabels`: `selectAll`,
|
|
41
|
+
`search`, `searchPlaceholder`, `cancelSearch`, `clearSearch`, `moveTo`).
|
|
42
|
+
- `FacetFiltersLabels.clearSearch` and `ActiveFilterTag.deleteLabel`.
|
|
43
|
+
|
|
44
|
+
## [1.14.1] - 2026-11-26
|
|
45
|
+
|
|
46
|
+
### Added
|
|
47
|
+
- **Text tokens for colours too light to read as text:** `--color-primary-text`,
|
|
48
|
+
`--color-warning-text` and `--color-disabled-text`, with their `text-*-text`
|
|
49
|
+
utilities. They keep the colour's hue and only darken it (lighten in dark mode)
|
|
50
|
+
until text in it reaches WCAG AA's 4.5:1 on the page, a card and the colour's
|
|
51
|
+
own tints. In dark mode `primary` and `warning` already pass, so their text
|
|
52
|
+
tokens follow the base colour.
|
|
53
|
+
- **Solid fill tokens:** `--color-warning-solid` and `--color-disabled-solid`, the
|
|
54
|
+
fill under white text on a solid surface (see Changed), and a `"solid"` target
|
|
55
|
+
for `resolveColor`, which returns that fill (`"bg"` stays the colour itself).
|
|
56
|
+
|
|
57
|
+
### Changed
|
|
58
|
+
- **Text in `primary`, `warning` and `disabled` is darker in the light theme**, in
|
|
59
|
+
every `soft`, `outline`, `gradient` and `glow` variant (Alert, Badge, Tag, Toast,
|
|
60
|
+
cards and anything else that takes `color` and `variant`). Fills, borders,
|
|
61
|
+
rings and glows keep their colours. Worst contrast before → after:
|
|
62
|
+
|
|
63
|
+
| Text | Light value | Before | After |
|
|
64
|
+
|------|-------------|--------|-------|
|
|
65
|
+
| `primary` | `#0071e3` → `#0065d6` | 4.0:1 | 4.7:1 |
|
|
66
|
+
| `warning` | `#c0993c` → `#8d6700` | 2.4:1 | 4.6:1 |
|
|
67
|
+
| `disabled` | `#9e9e9e` → `#6d6d6d` | 2.4:1 | 4.6:1 |
|
|
68
|
+
| `disabled` (dark) | `#616161` → `#7b7b7b` | 3.2:1 | 4.6:1 |
|
|
69
|
+
|
|
70
|
+
- **Solid `warning` and `disabled` fills are a shade deeper in the light theme**,
|
|
71
|
+
so their white text reads: `#956f00` (was `#c0993c`) and `#757575` (was
|
|
72
|
+
`#9e9e9e`), 4.6:1 (was 2.7:1). This shows wherever a solid warning or disabled
|
|
73
|
+
surface carries text or an icon: the `solid` variant (Badge, Alert's icon
|
|
74
|
+
circle, Tag, Toast), Button, CraftButton, FlashButton, ToggleGroup's selected
|
|
75
|
+
item, Avatar and HorizontalStepper. Tints, borders, progress bars, timeline
|
|
76
|
+
dots and charts keep the base colour. Dark mode is unchanged.
|
|
77
|
+
- **`--color-mist-secondary` is `#5a616f`** (was `#6B7280`) in the light theme,
|
|
78
|
+
so `mist` descriptions reach 4.5:1 (were 3.6:1) on the mist fill and border.
|
|
79
|
+
- An app that re-colours `primary`, `warning` or `disabled` should set the
|
|
80
|
+
matching `-text` (and, for warning and disabled, `-solid`) token too. To keep
|
|
81
|
+
the 1.14.0 look, set those tokens back to the base colour.
|
|
82
|
+
- Components that use `text-primary`, `text-warning` or `text-disabled` directly
|
|
83
|
+
(outside the variants) are not changed yet; that follows in a later release.
|
|
84
|
+
|
|
85
|
+
### Fixed
|
|
86
|
+
- **Tooltips** no longer leave a timer running after their provider unmounts.
|
|
87
|
+
A tooltip that was opening or closing at that moment updated the state of an
|
|
88
|
+
unmounted component; in a test run the timer fired after the DOM environment
|
|
89
|
+
had been torn down and failed the run with `window is not defined`.
|
|
90
|
+
- **BottomSheet**: after a touch drag, the first tap on ✕ (or on the handle) no
|
|
91
|
+
longer gets swallowed. The sheet now swallows only the click a drag ends in,
|
|
92
|
+
which a mouse fires and a touch swipe does not.
|
|
93
|
+
|
|
7
94
|
## [1.14.0] - 2026-11-22
|
|
8
95
|
|
|
9
96
|
**Text sizes now come from roles, and the defaults change some sizes.** Nothing
|
|
@@ -101,7 +188,7 @@ move. Stay on 1.13.x until you are ready.
|
|
|
101
188
|
`body` (14px) otherwise.
|
|
102
189
|
- **What moves, by component** (default size, px; phone / from 768px where they
|
|
103
190
|
differ). The full list, one row per class, is in
|
|
104
|
-
`docs/plans/2026-11-22-type-scale-
|
|
191
|
+
`docs/plans/2026-11-22-type-scale-inventory__done.md` in the repository, and
|
|
105
192
|
before/after screenshots of eight demo pages (Typography, Alert, Input,
|
|
106
193
|
Button, Card, Dialog, Badge, List) at 360px and 1280px are in
|
|
107
194
|
`docs/plans/type-scale-screenshots/`.
|
package/README.md
CHANGED
|
@@ -193,10 +193,14 @@ Use Tailwind v4's `@theme` block to declare a new token. Tailwind will generate
|
|
|
193
193
|
|
|
194
194
|
All tokens live in the library's [`src/styles/colors.css`](./src/styles/colors.css) and [`src/styles/globals.css`](./src/styles/globals.css). Grouped for reference:
|
|
195
195
|
|
|
196
|
-
**Brand colours** — `--color-primary` + `-light` / `-dark` / `-foreground`, `--color-secondary` + `-foreground` / `-container` / `-container-foreground`, `--color-tertiary` (same shape as secondary)
|
|
196
|
+
**Brand colours** — `--color-primary` + `-light` / `-dark` / `-foreground` / `-text`, `--color-secondary` + `-foreground` / `-container` / `-container-foreground`, `--color-tertiary` (same shape as secondary)
|
|
197
197
|
|
|
198
198
|
**Status colours** — `--color-error`, `--color-warning`, `--color-success`, `--color-info` (each with `-light` / `-dark` / `-foreground`), plus `--color-destructive` + `-foreground`, `--color-disabled` + `-foreground`
|
|
199
199
|
|
|
200
|
+
**Text in a colour** — `--color-primary-text`, `--color-warning-text`, `--color-disabled-text`: the colour as text on the page and on that colour's own tints, where the fill colour itself is too light to read (WCAG AA, 4.5:1). Variants (`soft`, `outline`, `gradient`, `glow`) draw their text and icons with them; fills, borders and glows keep the base colour. In dark mode the first two follow the base colour. When you retheme `--color-primary`, `--color-warning` or `--color-disabled`, set the matching `-text` token too, light and dark.
|
|
201
|
+
|
|
202
|
+
**Solid fills that carry text** — `--color-warning-solid` and `--color-disabled-solid`: the fill under white text on a solid `warning` or `disabled` surface (the `solid` variant, Button, Avatar, ToggleGroup, a solid IconAvatar). The base amber and grey are too light for white text (2.7:1), so these are a shade deeper (4.6:1). Tints, borders, progress bars and charts keep the base colour; `resolveColor(color, "solid")` returns this fill, `"bg"` the colour itself. In dark mode they follow the base colour and its dark ink.
|
|
203
|
+
|
|
200
204
|
**Surface / neutral colours** — `--color-background`, `--color-foreground` (+ `-secondary`, `-muted`, `-disabled`), `--color-card`, `--color-popover`, `--color-muted`, `--color-accent` (each with `-foreground`), `--color-surface` (+ `-foreground`, `-variant`, `-variant-foreground`, `-container-lowest`, `-container-low`, `-container`, `-container-high`, `-container-highest`), `--color-border`, `--color-input`, `--color-ring`
|
|
201
205
|
|
|
202
206
|
**Sidebar** — `--color-sidebar`, `-foreground`, `-primary`, `-primary-foreground`, `-accent`, `-accent-foreground`, `-border`, `-ring`
|
|
@@ -942,7 +946,7 @@ optimizeDeps: {
|
|
|
942
946
|
To deploy the demo to AWS (S3 + CloudFront):
|
|
943
947
|
|
|
944
948
|
1. In `demo/`, copy `.env.example` to `.env` and set `S3_BUCKET` and `CLOUDFRONT_ID`.
|
|
945
|
-
2. Ensure AWS credentials are configured
|
|
949
|
+
2. Ensure AWS credentials are configured: the default profile, or `AWS_PROFILE` in `demo/.env`.
|
|
946
950
|
3. From the repo root:
|
|
947
951
|
|
|
948
952
|
```bash
|
|
@@ -951,6 +955,18 @@ npm run deploy:demo
|
|
|
951
955
|
|
|
952
956
|
This builds the demo, syncs `demo/dist` to the S3 bucket, and creates a CloudFront invalidation. The live demo is served from [https://dqsptdnp5qxr0.cloudfront.net](https://dqsptdnp5qxr0.cloudfront.net).
|
|
953
957
|
|
|
958
|
+
**Deep links.** The demo routes in the browser (`/components/bottom-sheet` has no file in the bucket). A CloudFront Function, `esp-ui-component-library-demo-spa-routing`, runs on every viewer request of the distribution: a path whose last segment has no dot gets `/index.html` with status 200, and a path with an extension goes to S3 unchanged, so a missing file still answers 404. Its source is [`demo/cloudfront/spa-routing.js`](demo/cloudfront/spa-routing.js). `deploy:demo` does not touch it. After changing the file, update and publish the function (the second `--if-match` is the ETag the first command prints):
|
|
959
|
+
|
|
960
|
+
```bash
|
|
961
|
+
aws cloudfront update-function --name esp-ui-component-library-demo-spa-routing \
|
|
962
|
+
--if-match "$(aws cloudfront describe-function --name esp-ui-component-library-demo-spa-routing --query ETag --output text)" \
|
|
963
|
+
--function-config "Comment=esp-ui-component-library demo: serve index.html for client-side routes,Runtime=cloudfront-js-2.0" \
|
|
964
|
+
--function-code fileb://demo/cloudfront/spa-routing.js
|
|
965
|
+
aws cloudfront publish-function --name esp-ui-component-library-demo-spa-routing --if-match <ETag from update-function>
|
|
966
|
+
```
|
|
967
|
+
|
|
968
|
+
Do not route deep links with a CloudFront custom error response (404 → `/index.html` as 200): it turns every missing file into a 200 as well.
|
|
969
|
+
|
|
954
970
|
Build the library:
|
|
955
971
|
|
|
956
972
|
```bash
|
package/dist/common/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React$1 from 'react';
|
|
2
|
-
import { A as AppLogoProps, M as MyAccountMenuProps } from '../my-account-menu.props-
|
|
3
|
-
export { L as LogoAsset, a as LogoAssetConfig, b as LogoVariantSet } from '../my-account-menu.props-
|
|
2
|
+
import { A as AppLogoProps, M as MyAccountMenuProps } from '../my-account-menu.props-V3kFdvCZ.js';
|
|
3
|
+
export { L as LogoAsset, a as LogoAssetConfig, b as LogoVariantSet } from '../my-account-menu.props-V3kFdvCZ.js';
|
|
4
4
|
import { C as Color } from '../index-BQANnKs9.js';
|
|
5
5
|
import '../list.props-DP_xPTqU.js';
|
|
6
6
|
import '../style-axes-DSQ2DGc5.js';
|
|
@@ -36,7 +36,7 @@ declare function CopyrightCard({ text, logoSrc, logoAlt, href, logoOnly, }: Copy
|
|
|
36
36
|
*/
|
|
37
37
|
declare function PageLoader(): React$1.JSX.Element;
|
|
38
38
|
|
|
39
|
-
declare function MyAccountMenu({ name, email, imageUrl, minWidth, menuItems, avatarColor, badgeColor, badgeIcon, triggerVariant, side, align, }: MyAccountMenuProps): React$1.JSX.Element;
|
|
39
|
+
declare function MyAccountMenu({ name, email, imageUrl, minWidth, menuItems, avatarColor, badgeColor, badgeIcon, triggerVariant, side, align, triggerLabel, }: MyAccountMenuProps): React$1.JSX.Element;
|
|
40
40
|
|
|
41
41
|
declare function FooterCard(): React$1.JSX.Element;
|
|
42
42
|
|
|
@@ -5,7 +5,7 @@ import Menu$1 from "../../components/menu/menu.js";
|
|
|
5
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
import { ChevronsUpDown } from "lucide-react";
|
|
7
7
|
//#region src/common/my-account-menu/my-account-menu.tsx
|
|
8
|
-
function MyAccountMenu({ name, email, imageUrl, minWidth = "200px", menuItems, avatarColor, badgeColor, badgeIcon, triggerVariant = "avatar", side, align = "end" }) {
|
|
8
|
+
function MyAccountMenu({ name, email, imageUrl, minWidth = "200px", menuItems, avatarColor, badgeColor, badgeIcon, triggerVariant = "avatar", side, align = "end", triggerLabel = "My Account" }) {
|
|
9
9
|
const avatar = /* @__PURE__ */ jsx(Avatar, {
|
|
10
10
|
name: name || email,
|
|
11
11
|
imageUrl,
|
|
@@ -39,7 +39,7 @@ function MyAccountMenu({ name, email, imageUrl, minWidth = "200px", menuItems, a
|
|
|
39
39
|
}),
|
|
40
40
|
/* @__PURE__ */ jsx("span", {
|
|
41
41
|
className: "sr-only",
|
|
42
|
-
children:
|
|
42
|
+
children: triggerLabel
|
|
43
43
|
})
|
|
44
44
|
]
|
|
45
45
|
}) : /* @__PURE__ */ jsxs(Button, {
|
|
@@ -48,7 +48,7 @@ function MyAccountMenu({ name, email, imageUrl, minWidth = "200px", menuItems, a
|
|
|
48
48
|
className: "rounded-full",
|
|
49
49
|
children: [avatar, /* @__PURE__ */ jsx("span", {
|
|
50
50
|
className: "sr-only",
|
|
51
|
-
children:
|
|
51
|
+
children: triggerLabel
|
|
52
52
|
})]
|
|
53
53
|
}),
|
|
54
54
|
side,
|
|
@@ -23,7 +23,7 @@ function normalizeValue(value, multiple) {
|
|
|
23
23
|
if (Array.isArray(value)) return value;
|
|
24
24
|
return multiple ? [value] : [value];
|
|
25
25
|
}
|
|
26
|
-
function AsyncMultiSelect({ options, multiple = true, value, onValueChange, onSearchChange, hasMore = false, onLoadMore, isLoading = false, disabled = false, placeholder = "Select...", emptyText = "No results.", searchPlaceholder = "Search...", label, required, size = "default", className, clearable = false, maxDisplayedBadges = 3, portal = true, renderOption, action, radius, border }) {
|
|
26
|
+
function AsyncMultiSelect({ options, multiple = true, value, onValueChange, onSearchChange, hasMore = false, onLoadMore, isLoading = false, disabled = false, placeholder = "Select...", emptyText = "No results.", searchPlaceholder = "Search...", removeLabel = (optionLabel) => `Remove ${optionLabel}`, moreLabel = (count) => `+${count} more`, label, required, size = "default", className, clearable = false, maxDisplayedBadges = 3, portal = true, renderOption, action, radius, border }) {
|
|
27
27
|
const axes = useStyleAxes({
|
|
28
28
|
radius,
|
|
29
29
|
border
|
|
@@ -104,16 +104,12 @@ function AsyncMultiSelect({ options, multiple = true, value, onValueChange, onSe
|
|
|
104
104
|
onKeyDown: (e) => {
|
|
105
105
|
if (e.key === "Enter" || e.key === " ") handleRemove(opt.value, e);
|
|
106
106
|
},
|
|
107
|
-
"aria-label":
|
|
107
|
+
"aria-label": removeLabel(opt.label),
|
|
108
108
|
children: /* @__PURE__ */ jsx(X, { className: "size-3" })
|
|
109
109
|
})]
|
|
110
|
-
}, opt.value)), remaining > 0 && /* @__PURE__ */
|
|
110
|
+
}, opt.value)), remaining > 0 && /* @__PURE__ */ jsx("span", {
|
|
111
111
|
className: "type-caption text-muted-foreground",
|
|
112
|
-
children:
|
|
113
|
-
"+",
|
|
114
|
-
remaining,
|
|
115
|
-
" more"
|
|
116
|
-
]
|
|
112
|
+
children: moreLabel(remaining)
|
|
117
113
|
})]
|
|
118
114
|
});
|
|
119
115
|
}
|
|
@@ -32,6 +32,10 @@ interface AsyncMultiSelectProps extends Pick<StyleAxisProps, "radius" | "border"
|
|
|
32
32
|
placeholder?: string;
|
|
33
33
|
emptyText?: string;
|
|
34
34
|
searchPlaceholder?: string;
|
|
35
|
+
/** Accessible name of a selected badge's remove button. Default `` label => `Remove ${label}` ``. */
|
|
36
|
+
removeLabel?: (label: string) => string;
|
|
37
|
+
/** Text after the badges when more are selected than shown. Default `` count => `+${count} more` ``. */
|
|
38
|
+
moreLabel?: (count: number) => string;
|
|
35
39
|
label?: React.ReactNode;
|
|
36
40
|
required?: boolean;
|
|
37
41
|
size?: Size;
|
|
@@ -58,6 +62,6 @@ interface AsyncMultiSelectProps extends Pick<StyleAxisProps, "radius" | "border"
|
|
|
58
62
|
action?: AsyncMultiSelectAction;
|
|
59
63
|
}
|
|
60
64
|
|
|
61
|
-
declare function AsyncMultiSelect({ options, multiple, value, onValueChange, onSearchChange, hasMore, onLoadMore, isLoading, disabled, placeholder, emptyText, searchPlaceholder, label, required, size, className, clearable, maxDisplayedBadges, portal, renderOption, action, radius, border, }: AsyncMultiSelectProps): React.JSX.Element;
|
|
65
|
+
declare function AsyncMultiSelect({ options, multiple, value, onValueChange, onSearchChange, hasMore, onLoadMore, isLoading, disabled, placeholder, emptyText, searchPlaceholder, removeLabel, moreLabel, label, required, size, className, clearable, maxDisplayedBadges, portal, renderOption, action, radius, border, }: AsyncMultiSelectProps): React.JSX.Element;
|
|
62
66
|
|
|
63
67
|
export { AsyncMultiSelect, type AsyncMultiSelectOption, type AsyncMultiSelectProps };
|
|
@@ -15,7 +15,7 @@ function Avatar({ name, imageUrl, size = "default", className, badgeColor, badge
|
|
|
15
15
|
const showIconBadge = badgeIcon != null && badgeIcon !== false;
|
|
16
16
|
const colorResolved = !showIconBadge && badgeColor != null ? resolveColor(badgeColor, "bg") : void 0;
|
|
17
17
|
const hasBadge = showIconBadge || Boolean(colorResolved);
|
|
18
|
-
const fill = resolveColor(color, "
|
|
18
|
+
const fill = resolveColor(color, "solid");
|
|
19
19
|
const onFill = resolveColor(color, "fg");
|
|
20
20
|
const avatar = /* @__PURE__ */ jsxs(Avatar$1, {
|
|
21
21
|
className: cn(sizeClasses[size], className),
|
|
@@ -66,9 +66,9 @@ function useSheetDrag(sheet, rest, onRest) {
|
|
|
66
66
|
}
|
|
67
67
|
return {
|
|
68
68
|
onPointerDown(event) {
|
|
69
|
+
swallowClick.current = false;
|
|
69
70
|
const control = event.target.closest("button, a, input");
|
|
70
71
|
if (event.button !== 0 || !sheet.current || control && !control.hasAttribute("data-sheet-grip")) return;
|
|
71
|
-
swallowClick.current = false;
|
|
72
72
|
event.currentTarget.setPointerCapture?.(event.pointerId);
|
|
73
73
|
const startHeight = sheet.current.getBoundingClientRect().height;
|
|
74
74
|
gesture.current = {
|
|
@@ -14,7 +14,10 @@ declare const BreadcrumbSeparator: {
|
|
|
14
14
|
displayName: string;
|
|
15
15
|
};
|
|
16
16
|
declare const BreadcrumbEllipsis: {
|
|
17
|
-
({ className, ...props }: React.ComponentProps<"span">
|
|
17
|
+
({ className, moreLabel, ...props }: React.ComponentProps<"span"> & {
|
|
18
|
+
/** Screen-reader text for the collapsed items. Default "More". */
|
|
19
|
+
moreLabel?: string;
|
|
20
|
+
}): React.JSX.Element;
|
|
18
21
|
displayName: string;
|
|
19
22
|
};
|
|
20
23
|
|
|
@@ -45,14 +45,14 @@ var presetButtonColors = {
|
|
|
45
45
|
link: "text-success"
|
|
46
46
|
},
|
|
47
47
|
warning: {
|
|
48
|
-
default: "bg-warning text-warning-foreground hover:bg-warning/90",
|
|
48
|
+
default: "bg-warning-solid text-warning-foreground hover:bg-warning-solid/90",
|
|
49
49
|
outline: "border-warning/30 text-warning hover:bg-warning/5 hover:border-warning",
|
|
50
50
|
glow: "border-warning/30 text-warning hover:bg-warning/5 hover:border-warning shadow-glow shadow-warning/45",
|
|
51
51
|
ghost: "text-warning hover:bg-warning/10",
|
|
52
52
|
link: "text-warning"
|
|
53
53
|
},
|
|
54
54
|
disabled: {
|
|
55
|
-
default: "bg-disabled text-disabled-foreground",
|
|
55
|
+
default: "bg-disabled-solid text-disabled-foreground",
|
|
56
56
|
outline: "border-disabled/30 text-disabled",
|
|
57
57
|
glow: "border-disabled/30 text-disabled shadow-glow shadow-disabled/45",
|
|
58
58
|
ghost: "text-disabled",
|
|
@@ -14,8 +14,8 @@ var flashButtonBgClasses = {
|
|
|
14
14
|
error: "bg-error hover:bg-background text-error-foreground",
|
|
15
15
|
info: "bg-info hover:bg-background text-info-foreground",
|
|
16
16
|
success: "bg-success hover:bg-background text-success-foreground",
|
|
17
|
-
warning: "bg-warning hover:bg-background text-warning-foreground",
|
|
18
|
-
disabled: "bg-disabled hover:bg-background text-disabled-foreground",
|
|
17
|
+
warning: "bg-warning-solid hover:bg-background text-warning-foreground",
|
|
18
|
+
disabled: "bg-disabled-solid hover:bg-background text-disabled-foreground",
|
|
19
19
|
gray: "bg-gray hover:bg-background text-gray-foreground",
|
|
20
20
|
mist: "bg-mist hover:bg-background text-mist-foreground"
|
|
21
21
|
};
|
|
@@ -26,8 +26,8 @@ var flashOverlayClasses = {
|
|
|
26
26
|
error: "bg-error",
|
|
27
27
|
info: "bg-info",
|
|
28
28
|
success: "bg-success",
|
|
29
|
-
warning: "bg-warning",
|
|
30
|
-
disabled: "bg-disabled",
|
|
29
|
+
warning: "bg-warning-solid",
|
|
30
|
+
disabled: "bg-disabled-solid",
|
|
31
31
|
gray: "bg-gray",
|
|
32
32
|
mist: "bg-mist"
|
|
33
33
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React$1 from 'react';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
3
|
import { k as StyleAxisProps } from '../../style-axes-DSQ2DGc5.js';
|
|
4
|
-
export { S as SectionCard, a as SectionCardProps, b as SectionCardSize, c as SectionCardVariant } from '../../section-card-
|
|
4
|
+
export { S as SectionCard, a as SectionCardProps, b as SectionCardSize, c as SectionCardVariant } from '../../section-card-Bs3sKQtv.js';
|
|
5
5
|
import '../../index-BQANnKs9.js';
|
|
6
6
|
import '../../variant-DjdaxfIA.js';
|
|
7
7
|
|
|
@@ -210,7 +210,7 @@ function TruncatedLineWithTooltip({ className, textStyle, tooltipContent, childr
|
|
|
210
210
|
children: tooltip
|
|
211
211
|
});
|
|
212
212
|
}
|
|
213
|
-
function SectionCard({ icon, primaryText, secondaryText, truncateSecondaryText = true, actions, allowCollapse: allowCollapseProp = true, hideCollapseIcon = false, defaultOpen = true, open: controlledOpen, size = "default", variant = "outline", color = "gray", children, className, style, fillHeight: fillHeightProp = false, onOpenChange, expandOnHover = false, radius, elevation }) {
|
|
213
|
+
function SectionCard({ icon, primaryText, secondaryText, truncateSecondaryText = true, actions, allowCollapse: allowCollapseProp = true, hideCollapseIcon = false, toggleLabel: toggleLabelProp, defaultOpen = true, open: controlledOpen, size = "default", variant = "outline", color = "gray", children, className, style, fillHeight: fillHeightProp = false, onOpenChange, expandOnHover = false, radius, elevation }) {
|
|
214
214
|
const allowCollapse = expandOnHover ? false : allowCollapseProp;
|
|
215
215
|
const fillHeight = expandOnHover ? false : fillHeightProp;
|
|
216
216
|
const hover = useHoverExpand(expandOnHover, onOpenChange);
|
|
@@ -227,7 +227,7 @@ function SectionCard({ icon, primaryText, secondaryText, truncateSecondaryText =
|
|
|
227
227
|
}, [defaultOpen]);
|
|
228
228
|
const isOpenControlled = controlledOpen !== void 0;
|
|
229
229
|
const open = isOpenControlled ? controlledOpen : uncontrolledOpen;
|
|
230
|
-
const toggleLabel = typeof primaryText === "string" ? `Toggle ${primaryText}` : "Toggle section";
|
|
230
|
+
const toggleLabel = toggleLabelProp ?? (typeof primaryText === "string" ? `Toggle ${primaryText}` : "Toggle section");
|
|
231
231
|
const hasPrimaryText = hasRenderableContent(primaryText);
|
|
232
232
|
const hasSecondaryText = hasRenderableContent(secondaryText);
|
|
233
233
|
const hasHeaderText = hasPrimaryText || hasSecondaryText;
|
|
@@ -30,19 +30,19 @@ function getDotWindow(total, maxDots, selectedIndex) {
|
|
|
30
30
|
if (start > total - maxDots) start = total - maxDots;
|
|
31
31
|
return Array.from({ length: maxDots }, (_, i) => start + i);
|
|
32
32
|
}
|
|
33
|
-
function DotsRow({ total, maxDots, selectedIndex, orientation, onDotClick }) {
|
|
33
|
+
function DotsRow({ total, maxDots, selectedIndex, orientation, onDotClick, label = "Carousel pagination", goToSlide = (index) => `Go to slide ${index}` }) {
|
|
34
34
|
const window = getDotWindow(total, maxDots, selectedIndex);
|
|
35
35
|
return /* @__PURE__ */ jsx("div", {
|
|
36
36
|
className: cn("flex items-center justify-center gap-1.5", orientation === "horizontal" ? "mt-3 flex-row" : "ml-3 flex-col"),
|
|
37
37
|
role: "tablist",
|
|
38
|
-
"aria-label":
|
|
38
|
+
"aria-label": label,
|
|
39
39
|
children: window.map((index) => {
|
|
40
40
|
const isActive = index === selectedIndex;
|
|
41
41
|
return /* @__PURE__ */ jsx("button", {
|
|
42
42
|
type: "button",
|
|
43
43
|
role: "tab",
|
|
44
44
|
"aria-selected": isActive,
|
|
45
|
-
"aria-label":
|
|
45
|
+
"aria-label": goToSlide(index + 1),
|
|
46
46
|
onClick: () => onDotClick(index),
|
|
47
47
|
className: cn("rounded-full transition-all duration-200 ease-out", "focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2", orientation === "horizontal" ? isActive ? "h-2 w-4 bg-foreground" : "h-2 w-2 bg-muted-foreground/40 hover:bg-muted-foreground/60" : isActive ? "h-4 w-2 bg-foreground" : "h-2 w-2 bg-muted-foreground/40 hover:bg-muted-foreground/60")
|
|
48
48
|
}, index);
|
|
@@ -98,7 +98,9 @@ function CarouselNavigation({ props, state, placement, maxDots }) {
|
|
|
98
98
|
maxDots,
|
|
99
99
|
selectedIndex: state.selectedIndex,
|
|
100
100
|
orientation,
|
|
101
|
-
onDotClick: state.scrollTo
|
|
101
|
+
onDotClick: state.scrollTo,
|
|
102
|
+
label: labels?.pagination,
|
|
103
|
+
goToSlide: labels?.goToSlide
|
|
102
104
|
});
|
|
103
105
|
if (navigation === "custom" && renderNavigation) return /* @__PURE__ */ jsx("div", {
|
|
104
106
|
className: cn(orientation === "horizontal" ? "mt-3" : "ml-3"),
|
|
@@ -214,10 +216,12 @@ function Carousel(props) {
|
|
|
214
216
|
plugins,
|
|
215
217
|
className: cn("min-w-0 flex-1", beside && (orientation === "horizontal" ? "px-11" : "py-11")),
|
|
216
218
|
"aria-label": labels?.carousel,
|
|
219
|
+
"aria-roledescription": labels?.roleDescription ?? "carousel",
|
|
217
220
|
children: [
|
|
218
221
|
/* @__PURE__ */ jsx(CarouselContent, { children: data.map((item, index) => /* @__PURE__ */ jsx(CarouselItem, {
|
|
219
222
|
className: itemClassName,
|
|
220
223
|
"aria-label": labels?.slide?.(index + 1, data.length),
|
|
224
|
+
"aria-roledescription": labels?.slideRoleDescription ?? "slide",
|
|
221
225
|
children: item.content
|
|
222
226
|
}, item.id)) }),
|
|
223
227
|
sideArrows && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(CarouselPrevious, {
|
|
@@ -21,6 +21,14 @@ interface CarouselLabels {
|
|
|
21
21
|
next?: string;
|
|
22
22
|
/** Each slide's name, 1-based ("2 of 5: Air Mouse"). */
|
|
23
23
|
slide?: (index: number, total: number) => string;
|
|
24
|
+
/** The row of dots under the slides. Default "Carousel pagination". */
|
|
25
|
+
pagination?: string;
|
|
26
|
+
/** One dot, 1-based. Default `` index => `Go to slide ${index}` ``. */
|
|
27
|
+
goToSlide?: (index: number) => string;
|
|
28
|
+
/** What a screen reader calls the carousel (`aria-roledescription`). Default "carousel". */
|
|
29
|
+
roleDescription?: string;
|
|
30
|
+
/** What a screen reader calls each slide (`aria-roledescription`). Default "slide". */
|
|
31
|
+
slideRoleDescription?: string;
|
|
24
32
|
}
|
|
25
33
|
/** Where a slide comes to rest in the viewport when it is selected. */
|
|
26
34
|
type CarouselAlign = 'start' | 'center' | 'end';
|
|
@@ -22,7 +22,9 @@ interface AsyncComboboxProps extends Pick<StyleAxisProps, "radius" | "border"> {
|
|
|
22
22
|
clearable?: boolean;
|
|
23
23
|
hasMore?: boolean;
|
|
24
24
|
onLoadMore?: () => void;
|
|
25
|
+
/** The button that loads more options. Default "Load more". */
|
|
26
|
+
loadMoreLabel?: string;
|
|
25
27
|
}
|
|
26
|
-
declare function AsyncCombobox({ value, onValueChange, options, onSearchChange, isLoading, placeholder, emptyText, searchPlaceholder, label, required, disabled, className, clearable, hasMore, onLoadMore, radius, border, }: AsyncComboboxProps): React.JSX.Element;
|
|
28
|
+
declare function AsyncCombobox({ value, onValueChange, options, onSearchChange, isLoading, placeholder, emptyText, searchPlaceholder, label, required, disabled, className, clearable, hasMore, onLoadMore, loadMoreLabel, radius, border, }: AsyncComboboxProps): React.JSX.Element;
|
|
27
29
|
|
|
28
30
|
export { AsyncCombobox, type AsyncComboboxProps, type ComboboxOption };
|
|
@@ -24,7 +24,8 @@ var DEFAULT_LABELS = {
|
|
|
24
24
|
next: "Next",
|
|
25
25
|
pick: "Choose an item",
|
|
26
26
|
show: (name) => `Show ${name}`,
|
|
27
|
-
open: (name) => `Open ${name}
|
|
27
|
+
open: (name) => `Open ${name}`,
|
|
28
|
+
roleDescription: "carousel"
|
|
28
29
|
};
|
|
29
30
|
/** The default face: the item's image, or the fallback when there is none or it fails to load. */
|
|
30
31
|
function ImageFace({ item, state, variant, fallback }) {
|
|
@@ -138,7 +139,7 @@ function Coverflow(props) {
|
|
|
138
139
|
ref: root,
|
|
139
140
|
"data-slot": "coverflow",
|
|
140
141
|
role: "region",
|
|
141
|
-
"aria-roledescription":
|
|
142
|
+
"aria-roledescription": labels?.roleDescription ?? DEFAULT_LABELS.roleDescription,
|
|
142
143
|
"aria-labelledby": labelledBy,
|
|
143
144
|
"aria-label": labelledBy ? void 0 : labels?.carousel ?? DEFAULT_LABELS.carousel,
|
|
144
145
|
className: cn("flex flex-col gap-6", className),
|
|
@@ -27,6 +27,8 @@ interface CoverflowLabels {
|
|
|
27
27
|
show?: (name: string) => string;
|
|
28
28
|
/** The front card, when `onOpen` is set. Default `Open ${name}`. */
|
|
29
29
|
open?: (name: string) => string;
|
|
30
|
+
/** What a screen reader calls the region (`aria-roledescription`). Default "carousel". */
|
|
31
|
+
roleDescription?: string;
|
|
30
32
|
}
|
|
31
33
|
/** The card's proportions; sets the card width per breakpoint, the reflection depth and the stage height together. */
|
|
32
34
|
type CoverflowAspect = 'square' | 'landscape';
|
|
@@ -16,7 +16,7 @@ import { Columns2 } from "lucide-react";
|
|
|
16
16
|
import { getCoreRowModel, getPaginationRowModel, useReactTable } from "@tanstack/react-table";
|
|
17
17
|
//#region src/components/data-table/data-table.tsx
|
|
18
18
|
var edgeShadowClass = "pointer-events-none absolute inset-y-0 z-[3] w-4 from-black/10 to-transparent opacity-0 transition-opacity dark:from-black/40";
|
|
19
|
-
function DataTable({ columns, data, tableActionsContent, isFetching, pageIndex = 0, hasNextPage = false, hasPrevPage = false, onNextPage, onPrevPage, pageSize = 5, onPageSizeChange, pageSizeOptions = DEFAULT_PAGE_SIZE_OPTIONS, showColumnVisibilitySelector = true, columnVisibilityLabel = "Columns", noResultsHeading = "No results", noResultsDescription = "No results found. Try adjusting your search or filter to find what you're looking for.", noResultsAction, noResultsIllustration, hideNoResultsIllustration, pageLabel, previousLabel = "Previous", nextLabel = "Next", pageSizeOptionLabel, onRowClick, showBorder = false, rowSelection, onRowSelectionChange, getRowId, enableMultiRowSelection = true, enableRowSelection = false, tableRowClassName, getRowClassName, className, hidePaginationControls = false, radius, border, density }) {
|
|
19
|
+
function DataTable({ columns, data, tableActionsContent, isFetching, pageIndex = 0, hasNextPage = false, hasPrevPage = false, onNextPage, onPrevPage, pageSize = 5, onPageSizeChange, pageSizeOptions = DEFAULT_PAGE_SIZE_OPTIONS, showColumnVisibilitySelector = true, columnVisibilityLabel = "Columns", noResultsHeading = "No results", noResultsDescription = "No results found. Try adjusting your search or filter to find what you're looking for.", noResultsAction, noResultsIllustration, hideNoResultsIllustration, pageLabel, previousLabel = "Previous", nextLabel = "Next", selectAllLabel = "Select all", selectRowLabel = "Select row", pageSizeOptionLabel, onRowClick, showBorder = false, rowSelection, onRowSelectionChange, getRowId, enableMultiRowSelection = true, enableRowSelection = false, tableRowClassName, getRowClassName, className, hidePaginationControls = false, radius, border, density }) {
|
|
20
20
|
const { partStyle } = useStyleAxes({
|
|
21
21
|
radius,
|
|
22
22
|
border
|
|
@@ -38,16 +38,20 @@ function DataTable({ columns, data, tableActionsContent, isFetching, pageIndex =
|
|
|
38
38
|
header: enableMultiRowSelection ? ({ table: t }) => /* @__PURE__ */ jsx(Checkbox, {
|
|
39
39
|
checked: t.getIsAllPageRowsSelected() ? true : t.getIsSomePageRowsSelected() ? "indeterminate" : false,
|
|
40
40
|
onCheckedChange: (value) => t.toggleAllPageRowsSelected(!!value),
|
|
41
|
-
"aria-label":
|
|
41
|
+
"aria-label": selectAllLabel
|
|
42
42
|
}) : void 0,
|
|
43
43
|
cell: ({ row }) => /* @__PURE__ */ jsx(Checkbox, {
|
|
44
44
|
checked: row.getIsSelected(),
|
|
45
45
|
disabled: !row.getCanSelect(),
|
|
46
46
|
onCheckedChange: (value) => row.toggleSelected(!!value),
|
|
47
47
|
onClick: (e) => e.stopPropagation(),
|
|
48
|
-
"aria-label":
|
|
48
|
+
"aria-label": selectRowLabel
|
|
49
49
|
})
|
|
50
|
-
}), [
|
|
50
|
+
}), [
|
|
51
|
+
enableMultiRowSelection,
|
|
52
|
+
selectAllLabel,
|
|
53
|
+
selectRowLabel
|
|
54
|
+
]);
|
|
51
55
|
const tableColumns = useMemo(() => enableRowSelection ? [selectColumn, ...columns] : columns, [
|
|
52
56
|
enableRowSelection,
|
|
53
57
|
selectColumn,
|
|
@@ -41,6 +41,10 @@ interface DataTableProps<TData, TValue> extends Pick<StyleAxisProps, "radius" |
|
|
|
41
41
|
pageLabel?: string;
|
|
42
42
|
previousLabel?: string;
|
|
43
43
|
nextLabel?: string;
|
|
44
|
+
/** Accessible name of the header checkbox that selects every row. Default "Select all". */
|
|
45
|
+
selectAllLabel?: string;
|
|
46
|
+
/** Accessible name of each row's select checkbox. Default "Select row". */
|
|
47
|
+
selectRowLabel?: string;
|
|
44
48
|
pageSizeOptionLabel?: (size: number) => string;
|
|
45
49
|
onRowClick?: (row: TData) => void;
|
|
46
50
|
showBorder?: boolean;
|
|
@@ -57,7 +61,7 @@ interface DataTableProps<TData, TValue> extends Pick<StyleAxisProps, "radius" |
|
|
|
57
61
|
className?: string;
|
|
58
62
|
hidePaginationControls?: boolean;
|
|
59
63
|
}
|
|
60
|
-
declare function DataTable<TData, TValue>({ columns, data, tableActionsContent, isFetching, pageIndex, hasNextPage, hasPrevPage, onNextPage, onPrevPage, pageSize, onPageSizeChange, pageSizeOptions, showColumnVisibilitySelector, columnVisibilityLabel, noResultsHeading, noResultsDescription, noResultsAction, noResultsIllustration, hideNoResultsIllustration, pageLabel, previousLabel, nextLabel, pageSizeOptionLabel, onRowClick, showBorder, rowSelection, onRowSelectionChange, getRowId, enableMultiRowSelection, enableRowSelection, tableRowClassName, getRowClassName, className, hidePaginationControls, radius, border, density, }: DataTableProps<TData, TValue>): React.JSX.Element;
|
|
64
|
+
declare function DataTable<TData, TValue>({ columns, data, tableActionsContent, isFetching, pageIndex, hasNextPage, hasPrevPage, onNextPage, onPrevPage, pageSize, onPageSizeChange, pageSizeOptions, showColumnVisibilitySelector, columnVisibilityLabel, noResultsHeading, noResultsDescription, noResultsAction, noResultsIllustration, hideNoResultsIllustration, pageLabel, previousLabel, nextLabel, selectAllLabel, selectRowLabel, pageSizeOptionLabel, onRowClick, showBorder, rowSelection, onRowSelectionChange, getRowId, enableMultiRowSelection, enableRowSelection, tableRowClassName, getRowClassName, className, hidePaginationControls, radius, border, density, }: DataTableProps<TData, TValue>): React.JSX.Element;
|
|
61
65
|
|
|
62
66
|
/** Responsive options read from a column's `meta`. */
|
|
63
67
|
interface DataTableColumnMeta {
|
|
@@ -30,7 +30,7 @@ var parseDateOrNull = (value, dateFormat) => {
|
|
|
30
30
|
const parsed = parse(value, dateFormat, /* @__PURE__ */ new Date());
|
|
31
31
|
return isValid(parsed) ? parsed : null;
|
|
32
32
|
};
|
|
33
|
-
function DateRangePicker({ presets, presetLabels, allowCustom = false, lockEndToToday = false, disableFutureDates = false, dateFormat = DEFAULT_DATE_FORMAT, onChange, onPresetChange, onDraftChange, selectedPresetId, selectedStartDate, selectedEndDate, clearable = false, clearLabel = "Clear", onClear, trigger, placeholder = "Select date range", label, size, hideIcon = false, disabled = false, required = false, rounded = false, radius, popoverRadius, popoverElevation, error, errorContent, startHelperContent, endHelperContent, hintContent, align = "start", side = "bottom", className }) {
|
|
33
|
+
function DateRangePicker({ presets, presetLabels, allowCustom = false, lockEndToToday = false, disableFutureDates = false, dateFormat = DEFAULT_DATE_FORMAT, onChange, onPresetChange, onDraftChange, selectedPresetId, selectedStartDate, selectedEndDate, clearable = false, clearLabel = "Clear", onClear, startDateLabel = "Start date", endDateLabel = "End date", cancelLabel = "Cancel", applyLabel = "Apply", trigger, placeholder = "Select date range", label, size, hideIcon = false, disabled = false, required = false, rounded = false, radius, popoverRadius, popoverElevation, error, errorContent, startHelperContent, endHelperContent, hintContent, align = "start", side = "bottom", className }) {
|
|
34
34
|
const [open, setOpen] = React$1.useState(false);
|
|
35
35
|
const popoverAxes = useStyleAxes({
|
|
36
36
|
radius: popoverRadius,
|
|
@@ -182,7 +182,7 @@ function DateRangePicker({ presets, presetLabels, allowCustom = false, lockEndTo
|
|
|
182
182
|
color: "error",
|
|
183
183
|
size: isInline ? void 0 : "sm",
|
|
184
184
|
onClick: () => handleOpenChange(false),
|
|
185
|
-
children:
|
|
185
|
+
children: cancelLabel
|
|
186
186
|
});
|
|
187
187
|
const applyButton = /* @__PURE__ */ jsx(Button, {
|
|
188
188
|
variant: "outline",
|
|
@@ -190,7 +190,7 @@ function DateRangePicker({ presets, presetLabels, allowCustom = false, lockEndTo
|
|
|
190
190
|
size: isInline ? void 0 : "sm",
|
|
191
191
|
disabled: !isRangeComplete,
|
|
192
192
|
onClick: handleApply,
|
|
193
|
-
children:
|
|
193
|
+
children: applyLabel
|
|
194
194
|
});
|
|
195
195
|
const calendarBody = /* @__PURE__ */ jsxs("div", {
|
|
196
196
|
className: "flex flex-col h-full justify-between",
|
|
@@ -213,7 +213,7 @@ function DateRangePicker({ presets, presetLabels, allowCustom = false, lockEndTo
|
|
|
213
213
|
className: cn(isInline ? "grid w-full grid-cols-2 gap-3" : "flex items-center gap-3"),
|
|
214
214
|
children: [/* @__PURE__ */ jsx(Input, {
|
|
215
215
|
size: "sm",
|
|
216
|
-
label:
|
|
216
|
+
label: startDateLabel,
|
|
217
217
|
value: startInputValue,
|
|
218
218
|
placeholder: dateFormat.toLowerCase(),
|
|
219
219
|
onChange: handleStartInputChange,
|
|
@@ -221,7 +221,7 @@ function DateRangePicker({ presets, presetLabels, allowCustom = false, lockEndTo
|
|
|
221
221
|
className: isInline ? "w-full min-w-0" : "w-32"
|
|
222
222
|
}), /* @__PURE__ */ jsx(Input, {
|
|
223
223
|
size: "sm",
|
|
224
|
-
label:
|
|
224
|
+
label: endDateLabel,
|
|
225
225
|
value: endInputValue,
|
|
226
226
|
placeholder: dateFormat.toLowerCase(),
|
|
227
227
|
onChange: handleEndInputChange,
|