@slotted/react 0.1.0-beta.45 → 0.1.0-beta.46
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/dist/{chart-C4uPgUW8.js → chart-sewqbbm-.js} +385 -383
- package/dist/chart.js +1 -1
- package/dist/dashboard-grid-CBqqgiKr.js +1238 -0
- package/dist/dashboard-grid.js +1 -1
- package/dist/{detail-panel-Czs05E_D.js → detail-panel-WW2-BwEP.js} +2 -2
- package/dist/detail-panel.js +1 -1
- package/dist/docs/chart.json +15 -1
- package/dist/docs/chart.md +4 -2
- package/dist/docs/dashboard-grid.json +9 -2
- package/dist/docs/dashboard-grid.md +2 -1
- package/dist/docs/field.json +1 -1
- package/dist/docs/field.md +1 -1
- package/dist/docs/guidelines/index.md +1 -1
- package/dist/docs/guidelines/overviews.md +1 -1
- package/dist/docs/guidelines/record-pages.md +3 -3
- package/dist/docs/menu.json +1 -1
- package/dist/docs/menu.md +1 -1
- package/dist/docs/page-header.examples.md +120 -76
- package/dist/docs/page-header.json +57 -5
- package/dist/docs/page-header.md +14 -1
- package/dist/docs/popover.json +1 -1
- package/dist/docs/popover.md +1 -1
- package/dist/docs/select.json +1 -1
- package/dist/docs/select.md +1 -1
- package/dist/docs/stat-card.examples.md +121 -0
- package/dist/docs/stat-card.json +205 -0
- package/dist/docs/stat-card.md +51 -1
- package/dist/index.js +64 -64
- package/dist/page-header-nMgl8RZu.js +395 -0
- package/dist/page-header.js +2 -2
- package/dist/page.js +1 -1
- package/dist/stat-card-Bt92l0qa.js +344 -0
- package/dist/stat-card.js +2 -2
- package/dist/styles/chart.css +1 -1
- package/dist/styles/dashboard-grid.css +1 -1
- package/dist/styles/detail-panel.css +1 -1
- package/dist/styles/index.css +4 -4
- package/dist/styles/page-header.css +1 -1
- package/dist/styles/stat-card.css +7 -1
- package/dist/styles.css +1 -1
- package/dist/types/chart/chart.d.ts.map +1 -1
- package/dist/types/chart/chart.types.d.ts +8 -0
- package/dist/types/chart/chart.types.d.ts.map +1 -1
- package/dist/types/chart/index.d.ts +1 -1
- package/dist/types/chart/index.d.ts.map +1 -1
- package/dist/types/dashboard-grid/dashboard-grid-context.d.ts +6 -0
- package/dist/types/dashboard-grid/dashboard-grid-context.d.ts.map +1 -1
- package/dist/types/dashboard-grid/dashboard-grid.d.ts +1 -1
- package/dist/types/dashboard-grid/dashboard-grid.d.ts.map +1 -1
- package/dist/types/dashboard-grid/dashboard-grid.types.d.ts +8 -0
- package/dist/types/dashboard-grid/dashboard-grid.types.d.ts.map +1 -1
- package/dist/types/dashboard-grid/index.d.ts +1 -1
- package/dist/types/dashboard-grid/index.d.ts.map +1 -1
- package/dist/types/dashboard-grid/use-edit-status.d.ts +8 -0
- package/dist/types/dashboard-grid/use-edit-status.d.ts.map +1 -0
- package/dist/types/page-header/index.d.ts +2 -1
- package/dist/types/page-header/index.d.ts.map +1 -1
- package/dist/types/page-header/page-header-notice.d.ts +10 -0
- package/dist/types/page-header/page-header-notice.d.ts.map +1 -0
- package/dist/types/page-header/page-header.types.d.ts +17 -0
- package/dist/types/page-header/page-header.types.d.ts.map +1 -1
- package/dist/types/select/use-select-sheet.d.ts +2 -2
- package/dist/types/stat-card/delta-run.d.ts +15 -0
- package/dist/types/stat-card/delta-run.d.ts.map +1 -0
- package/dist/types/stat-card/index.d.ts +3 -1
- package/dist/types/stat-card/index.d.ts.map +1 -1
- package/dist/types/stat-card/stat-card-delta.d.ts.map +1 -1
- package/dist/types/stat-card/stat-card-group.d.ts +10 -0
- package/dist/types/stat-card/stat-card-group.d.ts.map +1 -0
- package/dist/types/stat-card/stat-card.types.d.ts +38 -0
- package/dist/types/stat-card/stat-card.types.d.ts.map +1 -1
- package/dist/types/stat-card/stat-delta.d.ts +9 -0
- package/dist/types/stat-card/stat-delta.d.ts.map +1 -0
- package/package.json +6 -6
- package/dist/dashboard-grid-_3H4G0dP.js +0 -1207
- package/dist/page-header-DK896DGD.js +0 -367
- package/dist/stat-card-D6NMjkZM.js +0 -295
- /package/dist/{page-DT8L0iRT.js → use-page-size-class-Cv1DbtKx.js} +0 -0
|
@@ -76,6 +76,9 @@
|
|
|
76
76
|
"subheading",
|
|
77
77
|
"actions",
|
|
78
78
|
"navigation",
|
|
79
|
+
"notice",
|
|
80
|
+
"notice-label",
|
|
81
|
+
"notice-value",
|
|
79
82
|
"header-area",
|
|
80
83
|
"figure",
|
|
81
84
|
"content",
|
|
@@ -152,7 +155,7 @@
|
|
|
152
155
|
"part": "marks",
|
|
153
156
|
"element": "div",
|
|
154
157
|
"required": false,
|
|
155
|
-
"purpose": "The status beside the heading — a Tag, a Badge, a StatusIndicator — centered on the heading’s line. It wraps when there are many. Below 600 pixels it
|
|
158
|
+
"purpose": "The status beside the heading — a Tag, a Badge, a StatusIndicator — centered on the heading’s line. It wraps when there are many. Below 600 pixels it is not drawn, so the header is as tall at every width whatever the marks say; what waits on the record is a notice."
|
|
156
159
|
},
|
|
157
160
|
{
|
|
158
161
|
"part": "subheading",
|
|
@@ -170,7 +173,25 @@
|
|
|
170
173
|
"part": "navigation",
|
|
171
174
|
"element": "div",
|
|
172
175
|
"required": false,
|
|
173
|
-
"purpose": "The previous and next record, after the actions at the far end of the row, set apart by a rule. Below 600 pixels
|
|
176
|
+
"purpose": "The previous and next record, after the actions at the far end of the row, set apart by a rule. Below 600 pixels it is one more column at the row’s end."
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
"part": "notice",
|
|
180
|
+
"element": "button",
|
|
181
|
+
"required": false,
|
|
182
|
+
"purpose": "What waits on the record — a difference to resolve, an overdue item, a closed record to reopen — under the title row and across the title area, only while it waits: the comfortable target tall, in the tone’s surface and text. Below 600 pixels it stays where the marks are not drawn."
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
"part": "notice-label",
|
|
186
|
+
"element": "span",
|
|
187
|
+
"required": true,
|
|
188
|
+
"purpose": "The label at the start, one line, cut with an ellipsis before the value."
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
"part": "notice-value",
|
|
192
|
+
"element": "span",
|
|
193
|
+
"required": false,
|
|
194
|
+
"purpose": "The figure at the end, in tabular figures and the semibold weight, never cut; a chevron that follows the reading direction comes after it."
|
|
174
195
|
},
|
|
175
196
|
{
|
|
176
197
|
"part": "header-area",
|
|
@@ -228,6 +249,20 @@
|
|
|
228
249
|
}
|
|
229
250
|
],
|
|
230
251
|
"api": [
|
|
252
|
+
{
|
|
253
|
+
"name": "value",
|
|
254
|
+
"type": "ReactNode",
|
|
255
|
+
"defaultValue": "—",
|
|
256
|
+
"appliesTo": "PageHeaderNotice",
|
|
257
|
+
"description": "The figure at the notice’s end, in tabular figures: the amount, the count, the date."
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
"name": "tone",
|
|
261
|
+
"type": "'neutral' | 'accent' | 'secondary' | 'info' | 'success' | 'warning' | 'danger'",
|
|
262
|
+
"defaultValue": "warning",
|
|
263
|
+
"appliesTo": "PageHeaderNotice",
|
|
264
|
+
"description": "The weight of what waits on the record: the tone’s surface, text and hover."
|
|
265
|
+
},
|
|
231
266
|
{
|
|
232
267
|
"name": "expanded",
|
|
233
268
|
"type": "boolean",
|
|
@@ -470,8 +505,25 @@
|
|
|
470
505
|
"--slotted-tone-accent-subtle-hover",
|
|
471
506
|
"--slotted-tone-accent-surface",
|
|
472
507
|
"--slotted-tone-accent-text",
|
|
508
|
+
"--slotted-tone-danger-subtle-hover",
|
|
509
|
+
"--slotted-tone-danger-surface",
|
|
510
|
+
"--slotted-tone-danger-text",
|
|
511
|
+
"--slotted-tone-info-subtle-hover",
|
|
512
|
+
"--slotted-tone-info-surface",
|
|
513
|
+
"--slotted-tone-info-text",
|
|
514
|
+
"--slotted-tone-neutral-subtle-hover",
|
|
515
|
+
"--slotted-tone-neutral-surface",
|
|
516
|
+
"--slotted-tone-neutral-text",
|
|
473
517
|
"--slotted-tone-secondary-subtle-active",
|
|
474
518
|
"--slotted-tone-secondary-subtle-hover",
|
|
519
|
+
"--slotted-tone-secondary-surface",
|
|
520
|
+
"--slotted-tone-secondary-text",
|
|
521
|
+
"--slotted-tone-success-subtle-hover",
|
|
522
|
+
"--slotted-tone-success-surface",
|
|
523
|
+
"--slotted-tone-success-text",
|
|
524
|
+
"--slotted-tone-warning-subtle-hover",
|
|
525
|
+
"--slotted-tone-warning-surface",
|
|
526
|
+
"--slotted-tone-warning-text",
|
|
475
527
|
"--slotted-toolbar-inset",
|
|
476
528
|
"--slotted-z-index-sticky"
|
|
477
529
|
],
|
|
@@ -527,7 +579,7 @@
|
|
|
527
579
|
{
|
|
528
580
|
"id": "navigation",
|
|
529
581
|
"title": "Previous and next record",
|
|
530
|
-
"note": "The two arrows at the far end of the title row move between orders without leaving the screen; the heading, the breadcrumb page and the facts follow. Below 600 pixels the pair
|
|
582
|
+
"note": "The two arrows at the far end of the title row move between orders without leaving the screen; the heading, the breadcrumb page and the facts follow. Below 600 pixels the pair stays at the row’s end, after the actions.",
|
|
531
583
|
"language": "tsx",
|
|
532
584
|
"source": "<PageHeaderNavigation>\n <IconButton aria-label=\"Previous order\" onClick={previous} variant=\"ghost\">\n <ChevronLeft />\n </IconButton>\n <IconButton aria-label=\"Next order\" onClick={next} variant=\"ghost\">\n <ChevronRight />\n </IconButton>\n</PageHeaderNavigation>;\n",
|
|
533
585
|
"verdict": "excerpt"
|
|
@@ -575,9 +627,9 @@
|
|
|
575
627
|
{
|
|
576
628
|
"id": "narrow",
|
|
577
629
|
"title": "Below 600 pixels",
|
|
578
|
-
"note": "The family answers its own inline size: the header is not sticky and scrolls away with the page, nothing collapses it on scroll and the toggle still folds the area in place; the breadcrumbs go and the way back stays, the title steps down, the subheading
|
|
630
|
+
"note": "The family answers its own inline size: the header is not sticky and scrolls away with the page, nothing collapses it on scroll and the toggle still folds the area in place; the breadcrumbs go and the way back stays, the title steps down, the visual, the title and the actions share one row, the heading and the subheading take one line each, the marks are not drawn, and the figure takes a row above the content. Loose actions and the navigation stay on the row at their own width and never wrap; an action that does not fit belongs in an overflow menu. Actions written as Toolbar overflow=\"menu\", each item with its counterpart, take what a plain title leaves on the row, and a full row of their own under a rich one (a visual, marks or a subheading); either way they fold what does not fit into the menu, where every action is still reachable.",
|
|
579
631
|
"language": "tsx",
|
|
580
|
-
"source": "import { Avatar } from '@slotted/react/avatar';\nimport {\n Breadcrumb,\n BreadcrumbItem,\n BreadcrumbLink,\n BreadcrumbList,\n BreadcrumbPage,\n} from '@slotted/react/breadcrumb';\nimport {
|
|
632
|
+
"source": "import { Avatar } from '@slotted/react/avatar';\nimport {\n Breadcrumb,\n BreadcrumbItem,\n BreadcrumbLink,\n BreadcrumbList,\n BreadcrumbPage,\n} from '@slotted/react/breadcrumb';\nimport { IconButton } from '@slotted/react/button';\nimport { Glyph } from '@slotted/react/icon';\nimport { Menu, MenuContent, MenuItem, MenuTrigger } from '@slotted/react/menu';\nimport {\n PageHeader,\n PageHeaderActions,\n PageHeaderArea,\n PageHeaderBack,\n PageHeaderBreadcrumbs,\n PageHeaderContent,\n PageHeaderControls,\n PageHeaderDescription,\n PageHeaderFigure,\n PageHeaderHeading,\n PageHeaderMarks,\n PageHeaderNav,\n PageHeaderNavigation,\n PageHeaderNotice,\n PageHeaderPin,\n PageHeaderSubheading,\n PageHeaderTitle,\n PageHeaderTitleArea,\n PageHeaderTitleRow,\n PageHeaderToggle,\n PageHeaderVisual,\n} from '@slotted/react/page-header';\nimport { Stack } from '@slotted/react/stack';\nimport { Tag } from '@slotted/react/tag';\n\nconst ACTIONS = ['Track', 'Reschedule', 'Notify carrier'];\n\nexport default function PageHeaderNarrow() {\n return (\n <Stack gap={8}>\n <PageHeader>\n <PageHeaderTitleArea>\n <PageHeaderNav>\n <PageHeaderBack href=\"#\">Shipments</PageHeaderBack>\n <PageHeaderBreadcrumbs>\n <Breadcrumb>\n <BreadcrumbList>\n <BreadcrumbItem>\n <BreadcrumbLink href=\"#\">Logistics</BreadcrumbLink>\n </BreadcrumbItem>\n <BreadcrumbItem>\n <BreadcrumbLink href=\"#\">Shipments</BreadcrumbLink>\n </BreadcrumbItem>\n <BreadcrumbItem>\n <BreadcrumbPage>SH-88213</BreadcrumbPage>\n </BreadcrumbItem>\n </BreadcrumbList>\n </Breadcrumb>\n </PageHeaderBreadcrumbs>\n </PageHeaderNav>\n <PageHeaderTitleRow>\n <PageHeaderVisual>\n <Avatar name=\"Pacific Cold Chain\" shape=\"square\" size=\"lg\" tone=\"info\" />\n </PageHeaderVisual>\n <PageHeaderTitle>\n <PageHeaderHeading>Shipment SH-88213</PageHeaderHeading>\n <PageHeaderSubheading>Pacific Cold Chain · Seattle to Reno</PageHeaderSubheading>\n </PageHeaderTitle>\n <PageHeaderActions>\n <OverflowMenu label=\"Shipment actions\" />\n </PageHeaderActions>\n <PageHeaderNavigation>\n <IconButton aria-label=\"Previous shipment\" variant=\"ghost\">\n <Glyph name=\"chevron-left\" />\n </IconButton>\n <IconButton aria-label=\"Next shipment\" variant=\"ghost\">\n <Glyph name=\"chevron-right\" />\n </IconButton>\n </PageHeaderNavigation>\n </PageHeaderTitleRow>\n <PageHeaderNotice tone=\"danger\" value=\"06:40\">\n Held at the Portland cross-dock since\n </PageHeaderNotice>\n </PageHeaderTitleArea>\n <PageHeaderArea>\n <PageHeaderFigure>\n <Avatar name=\"Refrigerated trailer\" shape=\"square\" size=\"xl\" tone=\"secondary\" />\n </PageHeaderFigure>\n <PageHeaderContent>\n <PageHeaderDescription>\n Refrigerated load of 18 pallets, held at the Portland cross-dock since 06:40 for a\n carrier inspection.\n </PageHeaderDescription>\n </PageHeaderContent>\n </PageHeaderArea>\n <PageHeaderControls>\n <PageHeaderToggle />\n <PageHeaderPin />\n </PageHeaderControls>\n </PageHeader>\n\n {/* The extreme content: one line each, no marks, no action on a line of its own. */}\n <PageHeader>\n <PageHeaderTitleArea>\n <PageHeaderTitleRow>\n <PageHeaderVisual>\n <Avatar name=\"Northwind Freight\" size=\"md\" />\n </PageHeaderVisual>\n <PageHeaderTitle>\n <PageHeaderHeading>\n Carrier invoice INV-2026-118734 for the Pacific Northwest region\n </PageHeaderHeading>\n <PageHeaderMarks>\n <Tag size=\"sm\">Freight</Tag>\n <Tag size=\"sm\">Q4</Tag>\n <Tag size=\"sm\" tone=\"warning\">\n Under review\n </Tag>\n </PageHeaderMarks>\n <PageHeaderSubheading>\n Northwind Freight LLC · Net 45 · Tacoma, Portland and Boise fleets\n </PageHeaderSubheading>\n </PageHeaderTitle>\n <PageHeaderActions>\n <OverflowMenu label=\"Invoice actions\" />\n </PageHeaderActions>\n </PageHeaderTitleRow>\n <PageHeaderNotice value=\"$12,480.00\">Difference to resolve</PageHeaderNotice>\n </PageHeaderTitleArea>\n </PageHeader>\n </Stack>\n );\n}\n\n/** Every labelled action of the record, behind one icon on a narrow header. */\nfunction OverflowMenu({ label }: { label: string }) {\n return (\n <Menu>\n <MenuTrigger\n render={(props) => (\n <IconButton {...props} aria-label={label} variant=\"ghost\">\n <Glyph name=\"ellipsis\" />\n </IconButton>\n )}\n />\n <MenuContent>\n {ACTIONS.map((action) => (\n <MenuItem key={action}>{action}</MenuItem>\n ))}\n </MenuContent>\n </Menu>\n );\n}\n",
|
|
581
633
|
"verdict": "example"
|
|
582
634
|
},
|
|
583
635
|
{
|
package/dist/docs/page-header.md
CHANGED
|
@@ -88,6 +88,9 @@ export default function PageHeaderBasic() {
|
|
|
88
88
|
| `subheading` | p | no |
|
|
89
89
|
| `actions` | div | no |
|
|
90
90
|
| `navigation` | div | no |
|
|
91
|
+
| `notice` | button | no |
|
|
92
|
+
| `notice-label` | span | yes |
|
|
93
|
+
| `notice-value` | span | no |
|
|
91
94
|
| `header-area` | div, role="region" | no |
|
|
92
95
|
| `figure` | div | no |
|
|
93
96
|
| `content` | div | no |
|
|
@@ -102,6 +105,8 @@ export default function PageHeaderBasic() {
|
|
|
102
105
|
|
|
103
106
|
| Name | Type | Default | Applies to | Description |
|
|
104
107
|
| --- | --- | --- | --- | --- |
|
|
108
|
+
| `value` | `ReactNode` | — | PageHeaderNotice | The figure at the notice’s end, in tabular figures: the amount, the count, the date. |
|
|
109
|
+
| `tone` | `'neutral' \| 'accent' \| 'secondary' \| 'info' \| 'success' \| 'warning' \| 'danger'` | warning | PageHeaderNotice | The weight of what waits on the record: the tone’s surface, text and hover. |
|
|
105
110
|
| `expanded` | `boolean` | true | PageHeader | Present means the consumer owns the header area’s state, for the life of the component. True while the area is at rest, pinned or revealed; false while it is scrolled past or collapsed by the control. |
|
|
106
111
|
| `defaultExpanded` | `boolean` | — | PageHeader | The value an uncontrolled header area starts from, read once. |
|
|
107
112
|
| `pinned` | `boolean` | false | PageHeader | Present means the consumer owns the pin’s state. Pinned, the whole header stays while the page scrolls. |
|
|
@@ -149,9 +154,17 @@ export default function PageHeaderBasic() {
|
|
|
149
154
|
- A snapped heading written with data-when is display: none in the other state, so the accessibility tree holds one heading at a time and a screen reader’s heading list never shows the title twice.
|
|
150
155
|
- The reason on every request is what lets a product tell the reader’s own move from the scroll’s: pointer and keyboard are the reader, programmatic is the application, and scroll is the page. The Angular binding emits the same request on expandedRequest and pinnedRequest.
|
|
151
156
|
|
|
157
|
+
## Narrow containers
|
|
158
|
+
|
|
159
|
+
- When: below 600 pixels of the header’s own inline size, by the container query page-header and not the viewport, so a header beside a navigation rail on a desk takes the narrow form too.
|
|
160
|
+
- What the family does: the visual, the title and the actions share one row, the title taking what the other two leave; the heading and the subheading keep one line each, cut with an ellipsis and whole in the title attribute; the marks are not drawn; the notice stays under the row; the breadcrumbs go and the way back stays; a Toolbar with overflow="menu" takes what a plain title leaves, and a row of its own under a rich one.
|
|
161
|
+
- What to provide: a subheading of one short line; icon-only actions, with every labelled action moved into the overflow menu; what waits on the record as a PageHeaderNotice, not as a mark.
|
|
162
|
+
- Anti-patterns: a labelled primary action left on the row, which takes the title’s width and cuts the heading; a normal state shown as a mark or a notice (reconciled, up to date), because only the exception asks for the reader’s action; the same fact in the visual, the heading and the subheading, which share one row and one line each.
|
|
163
|
+
- Examples: the narrow example draws a realistic header — a visual, a heading, a subheading, a notice and an overflow IconButton — and an extreme one — a long heading, a long subheading, three marks and a notice — which keeps one line each, draws no marks and no action on a line of its own.
|
|
164
|
+
|
|
152
165
|
## Tokens
|
|
153
166
|
|
|
154
|
-
`--slotted-action-gap`, `--slotted-avatar-size-lg`, `--slotted-avatar-size-md`, `--slotted-avatar-size-sm`, `--slotted-avatar-size-xl`, `--slotted-avatar-size-xs`, `--slotted-border-subtle`, `--slotted-border-width-thin`, `--slotted-control-gap-sm`, `--slotted-control-height-md`, `--slotted-control-height-sm`, `--slotted-control-icon-size-md`, `--slotted-control-icon-size-sm`, `--slotted-control-padding-inline-lg`, `--slotted-control-padding-inline-md`, `--slotted-control-padding-inline-sm`, `--slotted-control-radius`, `--slotted-disabled-foreground`, `--slotted-duration-medium`, `--slotted-duration-short`, `--slotted-easing-standard`, `--slotted-focus-ring-color`, `--slotted-focus-ring-offset`, `--slotted-focus-ring-width`, `--slotted-font-family-heading`, `--slotted-font-family-sans`, `--slotted-font-size-2xl`, `--slotted-font-size-3xl`, `--slotted-font-size-lg`, `--slotted-font-size-md`, `--slotted-font-size-sm`, `--slotted-font-size-xl`, `--slotted-font-weight-medium`, `--slotted-font-weight-semibold`, `--slotted-line-height-2xl`, `--slotted-line-height-3xl`, `--slotted-line-height-lg`, `--slotted-line-height-md`, `--slotted-line-height-sm`, `--slotted-line-height-xl`, `--slotted-material-backdrop`, `--slotted-page-header-backdrop-filter`, `--slotted-page-header-background`, `--slotted-page-header-border`, `--slotted-page-header-control-size`, `--slotted-page-header-description-measure`, `--slotted-page-header-gap`, `--slotted-page-header-ground-duration`, `--slotted-page-header-ground-easing`, `--slotted-page-header-heading-size-lg`, `--slotted-page-header-heading-size-md`, `--slotted-page-header-heading-size-sm`, `--slotted-page-header-inset`, `--slotted-page-header-padding-block`, `--slotted-page-header-radius`, `--slotted-page-header-shadow`, `--slotted-page-header-snapped-heading-size-lg`, `--slotted-page-header-snapped-heading-size-md`, `--slotted-page-header-snapped-heading-size-sm`, `--slotted-radius-full`, `--slotted-radius-lg`, `--slotted-radius-sm`, `--slotted-shadow-sm`, `--slotted-space-1`, `--slotted-space-2`, `--slotted-space-3`, `--slotted-space-4`, `--slotted-space-5`, `--slotted-space-6`, `--slotted-surface`, `--slotted-surface-material`, `--slotted-target-comfortable`, `--slotted-target-min`, `--slotted-text`, `--slotted-text-muted`, `--slotted-tone-accent-subtle-hover`, `--slotted-tone-accent-surface`, `--slotted-tone-accent-text`, `--slotted-tone-secondary-subtle-active`, `--slotted-tone-secondary-subtle-hover`, `--slotted-toolbar-inset`, `--slotted-z-index-sticky`
|
|
167
|
+
`--slotted-action-gap`, `--slotted-avatar-size-lg`, `--slotted-avatar-size-md`, `--slotted-avatar-size-sm`, `--slotted-avatar-size-xl`, `--slotted-avatar-size-xs`, `--slotted-border-subtle`, `--slotted-border-width-thin`, `--slotted-control-gap-sm`, `--slotted-control-height-md`, `--slotted-control-height-sm`, `--slotted-control-icon-size-md`, `--slotted-control-icon-size-sm`, `--slotted-control-padding-inline-lg`, `--slotted-control-padding-inline-md`, `--slotted-control-padding-inline-sm`, `--slotted-control-radius`, `--slotted-disabled-foreground`, `--slotted-duration-medium`, `--slotted-duration-short`, `--slotted-easing-standard`, `--slotted-focus-ring-color`, `--slotted-focus-ring-offset`, `--slotted-focus-ring-width`, `--slotted-font-family-heading`, `--slotted-font-family-sans`, `--slotted-font-size-2xl`, `--slotted-font-size-3xl`, `--slotted-font-size-lg`, `--slotted-font-size-md`, `--slotted-font-size-sm`, `--slotted-font-size-xl`, `--slotted-font-weight-medium`, `--slotted-font-weight-semibold`, `--slotted-line-height-2xl`, `--slotted-line-height-3xl`, `--slotted-line-height-lg`, `--slotted-line-height-md`, `--slotted-line-height-sm`, `--slotted-line-height-xl`, `--slotted-material-backdrop`, `--slotted-page-header-backdrop-filter`, `--slotted-page-header-background`, `--slotted-page-header-border`, `--slotted-page-header-control-size`, `--slotted-page-header-description-measure`, `--slotted-page-header-gap`, `--slotted-page-header-ground-duration`, `--slotted-page-header-ground-easing`, `--slotted-page-header-heading-size-lg`, `--slotted-page-header-heading-size-md`, `--slotted-page-header-heading-size-sm`, `--slotted-page-header-inset`, `--slotted-page-header-padding-block`, `--slotted-page-header-radius`, `--slotted-page-header-shadow`, `--slotted-page-header-snapped-heading-size-lg`, `--slotted-page-header-snapped-heading-size-md`, `--slotted-page-header-snapped-heading-size-sm`, `--slotted-radius-full`, `--slotted-radius-lg`, `--slotted-radius-sm`, `--slotted-shadow-sm`, `--slotted-space-1`, `--slotted-space-2`, `--slotted-space-3`, `--slotted-space-4`, `--slotted-space-5`, `--slotted-space-6`, `--slotted-surface`, `--slotted-surface-material`, `--slotted-target-comfortable`, `--slotted-target-min`, `--slotted-text`, `--slotted-text-muted`, `--slotted-tone-accent-subtle-hover`, `--slotted-tone-accent-surface`, `--slotted-tone-accent-text`, `--slotted-tone-danger-subtle-hover`, `--slotted-tone-danger-surface`, `--slotted-tone-danger-text`, `--slotted-tone-info-subtle-hover`, `--slotted-tone-info-surface`, `--slotted-tone-info-text`, `--slotted-tone-neutral-subtle-hover`, `--slotted-tone-neutral-surface`, `--slotted-tone-neutral-text`, `--slotted-tone-secondary-subtle-active`, `--slotted-tone-secondary-subtle-hover`, `--slotted-tone-secondary-surface`, `--slotted-tone-secondary-text`, `--slotted-tone-success-subtle-hover`, `--slotted-tone-success-surface`, `--slotted-tone-success-text`, `--slotted-tone-warning-subtle-hover`, `--slotted-tone-warning-surface`, `--slotted-tone-warning-text`, `--slotted-toolbar-inset`, `--slotted-z-index-sticky`
|
|
155
168
|
|
|
156
169
|
## Examples
|
|
157
170
|
|
package/dist/docs/popover.json
CHANGED
|
@@ -343,7 +343,7 @@
|
|
|
343
343
|
"type": "'popover' | 'auto'",
|
|
344
344
|
"defaultValue": "popover",
|
|
345
345
|
"appliesTo": "Popover",
|
|
346
|
-
"description": "auto presents the panel as a bottom sheet under (max-width: 480px) and (pointer: coarse): modal, with a scrim, a grip and focus held in it, headed by PopoverTitle or by the panel’s aria-label. It reads the drawer’s surface, radius, scrim and motion tokens."
|
|
346
|
+
"description": "auto presents the panel as a bottom sheet under (max-width: 480px) and (pointer: coarse): modal, with a scrim, a grip and focus held in it, headed by PopoverTitle or by the panel’s aria-label. A pull down on the grip, or a touch on the body while what it holds is at its top, moves the sheet and dismisses it past half its height. It reads the drawer’s surface, radius, scrim and motion tokens."
|
|
347
347
|
},
|
|
348
348
|
{
|
|
349
349
|
"name": "disabled",
|
package/dist/docs/popover.md
CHANGED
|
@@ -128,7 +128,7 @@ export default function PopoverBasic() {
|
|
|
128
128
|
| `followPointer` | `boolean \| 'x' \| 'y' \| 'entry'` | false | Popover | Whether the panel stands against the pointer over the trigger instead of the trigger's box, for a trigger with no small point of its own. true follows the pointer; x takes its horizontal position on the trigger's edge; y the converse; entry holds the point it opened at: where the pointer pressed for a popover, where it entered for a hover card. Opened from the keyboard, it stands against the trigger. |
|
|
129
129
|
| `hideWhenDetached` | `boolean` | false | Popover | Whether the panel hides when its anchor scrolls out of view. It is off, unlike Tooltip’s, so a task the reader is halfway through does not disappear when the row behind it scrolls. |
|
|
130
130
|
| `portal` | `boolean` | true | Popover | Whether the layer is rendered into the shared portal root at the end of the document. The portalled layer keeps the theme, color scheme, density and direction of the region it was opened from. |
|
|
131
|
-
| `presentation` | `'popover' \| 'auto'` | popover | Popover | auto presents the panel as a bottom sheet under (max-width: 480px) and (pointer: coarse): modal, with a scrim, a grip and focus held in it, headed by PopoverTitle or by the panel’s aria-label. It reads the drawer’s surface, radius, scrim and motion tokens. |
|
|
131
|
+
| `presentation` | `'popover' \| 'auto'` | popover | Popover | auto presents the panel as a bottom sheet under (max-width: 480px) and (pointer: coarse): modal, with a scrim, a grip and focus held in it, headed by PopoverTitle or by the panel’s aria-label. A pull down on the grip, or a touch on the body while what it holds is at its top, moves the sheet and dismisses it past half its height. It reads the drawer’s surface, radius, scrim and motion tokens. |
|
|
132
132
|
| `disabled` | `boolean` | false | Popover | Whether the popover never opens. It does not disable the trigger; set disabled on the trigger element for that. |
|
|
133
133
|
| `messages` | `Partial<PopoverMessages>` | — | Popover | Text that replaces the language’s messages for this popover, key by key. close is the close button’s accessible name; an aria-label on PopoverClose takes precedence. |
|
|
134
134
|
| `sideOffset` | `number` | 0 | Popover | Extra distance from the anchor in pixels, added to the standard gap. |
|
package/dist/docs/select.json
CHANGED
|
@@ -673,7 +673,7 @@
|
|
|
673
673
|
"type": "'popover' | 'auto'",
|
|
674
674
|
"defaultValue": "popover",
|
|
675
675
|
"appliesTo": "Select, SelectDefaultsProvider",
|
|
676
|
-
"description": "auto draws the listbox in a bottom sheet under (max-width: 480px) and (pointer: coarse): modal, headed by the field’s label, every option at least --slotted-target-min tall, dismissed by its grip, its scrim, Escape and the platform’s way back, with focus given back to the trigger. A select with search keeps its anchored list, because the on-screen keyboard covers the bottom of the screen."
|
|
676
|
+
"description": "auto draws the listbox in a bottom sheet under (max-width: 480px) and (pointer: coarse): modal, headed by the field’s label, every option at least --slotted-target-min tall, dismissed by a pull down on its grip or its body, its scrim, Escape and the platform’s way back, with focus given back to the trigger. A select with search keeps its anchored list, because the on-screen keyboard covers the bottom of the screen."
|
|
677
677
|
},
|
|
678
678
|
{
|
|
679
679
|
"name": "fullWidth",
|
package/dist/docs/select.md
CHANGED
|
@@ -127,7 +127,7 @@ export default function SelectBasic() {
|
|
|
127
127
|
| `shift` | `boolean` | true | Select | Whether the list may slide along its edge to stay in view. |
|
|
128
128
|
| `hideWhenDetached` | `boolean` | true | Select | Whether the list hides while its control is scrolled out of view. |
|
|
129
129
|
| `portal` | `boolean` | true | Select | Whether the list renders at the end of the document instead of inside the control. |
|
|
130
|
-
| `presentation` | `'popover' \| 'auto'` | popover | Select, SelectDefaultsProvider | auto draws the listbox in a bottom sheet under (max-width: 480px) and (pointer: coarse): modal, headed by the field’s label, every option at least --slotted-target-min tall, dismissed by its grip, its scrim, Escape and the platform’s way back, with focus given back to the trigger. A select with search keeps its anchored list, because the on-screen keyboard covers the bottom of the screen. |
|
|
130
|
+
| `presentation` | `'popover' \| 'auto'` | popover | Select, SelectDefaultsProvider | auto draws the listbox in a bottom sheet under (max-width: 480px) and (pointer: coarse): modal, headed by the field’s label, every option at least --slotted-target-min tall, dismissed by a pull down on its grip or its body, its scrim, Escape and the platform’s way back, with focus given back to the trigger. A select with search keeps its anchored list, because the on-screen keyboard covers the bottom of the screen. |
|
|
131
131
|
| `fullWidth` | `boolean` | true | Select | Whether the control fills its container. false sizes it to its widest value. |
|
|
132
132
|
| `disabled` | `boolean` | false | Select | Disables the control and takes it out of the tab order. When unset, the select takes the state of its field. |
|
|
133
133
|
| `readOnly` | `boolean` | false | Select | Keeps the value visible and focusable and never opens the list. When unset, the select takes the state of its field. |
|
|
@@ -440,6 +440,41 @@ Excerpt — not a complete module
|
|
|
440
440
|
</SlottedProvider>;
|
|
441
441
|
```
|
|
442
442
|
|
|
443
|
+
### A change in a row, and the DOM it reaches
|
|
444
|
+
|
|
445
|
+
Excerpt — not a complete module
|
|
446
|
+
|
|
447
|
+
```tsx
|
|
448
|
+
<StatDelta value={-0.073} goodWhen="down" />;
|
|
449
|
+
```
|
|
450
|
+
|
|
451
|
+
### Anatomy, as it reaches the DOM
|
|
452
|
+
|
|
453
|
+
Excerpt — not a complete module
|
|
454
|
+
|
|
455
|
+
```tsx
|
|
456
|
+
<span data-ui="stat-card" data-part="root" data-variant="delta">
|
|
457
|
+
<span data-part="delta" data-trend="down" data-tone="success">
|
|
458
|
+
<span aria-hidden="true" data-part="indicator">
|
|
459
|
+
…
|
|
460
|
+
</span>
|
|
461
|
+
<span data-ui="visually-hidden">down </span>−7.3%
|
|
462
|
+
</span>
|
|
463
|
+
</span>;
|
|
464
|
+
```
|
|
465
|
+
|
|
466
|
+
### A page’s figures, by its size class
|
|
467
|
+
|
|
468
|
+
Excerpt — not a complete module
|
|
469
|
+
|
|
470
|
+
```tsx
|
|
471
|
+
<StatCardGroup>
|
|
472
|
+
<StatCard attention="danger">…</StatCard>
|
|
473
|
+
<StatCard>…</StatCard>
|
|
474
|
+
<StatCard>…</StatCard>
|
|
475
|
+
</StatCardGroup>;
|
|
476
|
+
```
|
|
477
|
+
|
|
443
478
|
### attention.tsx
|
|
444
479
|
|
|
445
480
|
Example
|
|
@@ -544,6 +579,38 @@ export default function StatCardCount() {
|
|
|
544
579
|
}
|
|
545
580
|
```
|
|
546
581
|
|
|
582
|
+
### delta.tsx
|
|
583
|
+
|
|
584
|
+
Example
|
|
585
|
+
|
|
586
|
+
```tsx
|
|
587
|
+
import { StatDelta } from '@slotted/react/stat-card';
|
|
588
|
+
|
|
589
|
+
const ROWS = [
|
|
590
|
+
{ label: 'Open orders', value: 1510, delta: 0.124, goodWhen: 'up' },
|
|
591
|
+
{ label: 'Average lead time', value: 4.6, delta: -0.073, goodWhen: 'down' },
|
|
592
|
+
{ label: 'Returns', value: 38, delta: 0, goodWhen: 'down' },
|
|
593
|
+
] as const;
|
|
594
|
+
|
|
595
|
+
export default function StatCardDelta() {
|
|
596
|
+
return (
|
|
597
|
+
<table>
|
|
598
|
+
<tbody>
|
|
599
|
+
{ROWS.map((row) => (
|
|
600
|
+
<tr key={row.label}>
|
|
601
|
+
<th scope="row">{row.label}</th>
|
|
602
|
+
<td>{row.value}</td>
|
|
603
|
+
<td>
|
|
604
|
+
<StatDelta goodWhen={row.goodWhen} value={row.delta} />
|
|
605
|
+
</td>
|
|
606
|
+
</tr>
|
|
607
|
+
))}
|
|
608
|
+
</tbody>
|
|
609
|
+
</table>
|
|
610
|
+
);
|
|
611
|
+
}
|
|
612
|
+
```
|
|
613
|
+
|
|
547
614
|
### format.tsx
|
|
548
615
|
|
|
549
616
|
Example
|
|
@@ -613,6 +680,60 @@ export default function StatCardFormat() {
|
|
|
613
680
|
}
|
|
614
681
|
```
|
|
615
682
|
|
|
683
|
+
### group.tsx
|
|
684
|
+
|
|
685
|
+
Example
|
|
686
|
+
|
|
687
|
+
```tsx
|
|
688
|
+
import {
|
|
689
|
+
StatCard,
|
|
690
|
+
StatCardComparison,
|
|
691
|
+
StatCardDelta,
|
|
692
|
+
StatCardFigure,
|
|
693
|
+
StatCardGroup,
|
|
694
|
+
StatCardHeader,
|
|
695
|
+
StatCardLabel,
|
|
696
|
+
StatCardValue,
|
|
697
|
+
} from '@slotted/react/stat-card';
|
|
698
|
+
|
|
699
|
+
const FIGURES = [
|
|
700
|
+
{ label: 'Open balance', value: 38000, note: 'Of a total line of $38,000.00' },
|
|
701
|
+
{
|
|
702
|
+
label: 'Overdue',
|
|
703
|
+
value: 4120,
|
|
704
|
+
note: 'Three invoices past 30 days',
|
|
705
|
+
delta: 0.12,
|
|
706
|
+
attention: 'danger',
|
|
707
|
+
},
|
|
708
|
+
{ label: 'Paid this month', value: 12900, note: 'Eleven invoices', delta: -0.04 },
|
|
709
|
+
] as const;
|
|
710
|
+
|
|
711
|
+
export default function StatCardGroupExample() {
|
|
712
|
+
return (
|
|
713
|
+
<StatCardGroup>
|
|
714
|
+
{FIGURES.map((figure) => (
|
|
715
|
+
<StatCard
|
|
716
|
+
key={figure.label}
|
|
717
|
+
size="sm"
|
|
718
|
+
{...('attention' in figure ? { attention: figure.attention } : {})}
|
|
719
|
+
{...('delta' in figure ? { delta: figure.delta } : {})}
|
|
720
|
+
goodWhen="down"
|
|
721
|
+
>
|
|
722
|
+
<StatCardHeader>
|
|
723
|
+
<StatCardLabel>{figure.label}</StatCardLabel>
|
|
724
|
+
</StatCardHeader>
|
|
725
|
+
<StatCardFigure>
|
|
726
|
+
<StatCardValue value={figure.value} />
|
|
727
|
+
{'delta' in figure ? <StatCardDelta /> : null}
|
|
728
|
+
<StatCardComparison>{figure.note}</StatCardComparison>
|
|
729
|
+
</StatCardFigure>
|
|
730
|
+
</StatCard>
|
|
731
|
+
))}
|
|
732
|
+
</StatCardGroup>
|
|
733
|
+
);
|
|
734
|
+
}
|
|
735
|
+
```
|
|
736
|
+
|
|
616
737
|
### parts.tsx
|
|
617
738
|
|
|
618
739
|
Example
|
package/dist/docs/stat-card.json
CHANGED
|
@@ -91,6 +91,41 @@
|
|
|
91
91
|
"trend",
|
|
92
92
|
"message"
|
|
93
93
|
]
|
|
94
|
+
},
|
|
95
|
+
"statDelta": {
|
|
96
|
+
"nativeElement": "span",
|
|
97
|
+
"defaults": {
|
|
98
|
+
"format": "percent",
|
|
99
|
+
"goodWhen": "up"
|
|
100
|
+
},
|
|
101
|
+
"capabilities": [
|
|
102
|
+
"appearance",
|
|
103
|
+
"content"
|
|
104
|
+
],
|
|
105
|
+
"states": [
|
|
106
|
+
"default"
|
|
107
|
+
],
|
|
108
|
+
"parts": [
|
|
109
|
+
"root",
|
|
110
|
+
"delta",
|
|
111
|
+
"indicator"
|
|
112
|
+
]
|
|
113
|
+
},
|
|
114
|
+
"statCardGroup": {
|
|
115
|
+
"nativeElement": "div",
|
|
116
|
+
"defaults": {
|
|
117
|
+
"form": "auto"
|
|
118
|
+
},
|
|
119
|
+
"capabilities": [
|
|
120
|
+
"appearance",
|
|
121
|
+
"content"
|
|
122
|
+
],
|
|
123
|
+
"states": [
|
|
124
|
+
"default"
|
|
125
|
+
],
|
|
126
|
+
"parts": [
|
|
127
|
+
"root"
|
|
128
|
+
]
|
|
94
129
|
}
|
|
95
130
|
},
|
|
96
131
|
"docs": {
|
|
@@ -377,6 +412,132 @@
|
|
|
377
412
|
"A missing or failed value is a dash and a message, in the DOM and in the tree; a card never announces a stale number as current.",
|
|
378
413
|
"The value is never truncated. A number wider than the trend’s room takes the room; a number wider than the card breaks; nothing is clipped or hidden behind an ellipsis."
|
|
379
414
|
]
|
|
415
|
+
},
|
|
416
|
+
"statDelta": {
|
|
417
|
+
"imports": {
|
|
418
|
+
"source": "import { StatDelta } from '@slotted/react';"
|
|
419
|
+
},
|
|
420
|
+
"anatomy": [
|
|
421
|
+
{
|
|
422
|
+
"part": "root",
|
|
423
|
+
"element": "span",
|
|
424
|
+
"required": true,
|
|
425
|
+
"purpose": "The delta of a card where no card is — a row of a list, a table cell — carrying data-variant=\"delta\". It draws no frame and reads the body size at a medium weight."
|
|
426
|
+
},
|
|
427
|
+
{
|
|
428
|
+
"part": "delta",
|
|
429
|
+
"element": "span",
|
|
430
|
+
"required": true,
|
|
431
|
+
"purpose": "The card’s own delta part, carrying data-trend and data-tone, so one set of rules paints the delta on a card and on its own."
|
|
432
|
+
},
|
|
433
|
+
{
|
|
434
|
+
"part": "indicator",
|
|
435
|
+
"element": "span",
|
|
436
|
+
"required": true,
|
|
437
|
+
"purpose": "trending-up in a directional icon box, turned over for a fall, and minus for no change; aria-hidden."
|
|
438
|
+
}
|
|
439
|
+
],
|
|
440
|
+
"api": [
|
|
441
|
+
{
|
|
442
|
+
"name": "value",
|
|
443
|
+
"type": "number | undefined",
|
|
444
|
+
"defaultValue": "—",
|
|
445
|
+
"appliesTo": "StatDelta",
|
|
446
|
+
"description": "The change. Unset, nothing is drawn."
|
|
447
|
+
},
|
|
448
|
+
{
|
|
449
|
+
"name": "format",
|
|
450
|
+
"type": "'percent' | 'decimal'",
|
|
451
|
+
"defaultValue": "percent",
|
|
452
|
+
"appliesTo": "StatDelta",
|
|
453
|
+
"description": "percent reads the value as a fraction, at most one fraction digit; decimal reads it as it is. The sign is shown except on zero, and a fall takes the minus sign."
|
|
454
|
+
},
|
|
455
|
+
{
|
|
456
|
+
"name": "formatOptions",
|
|
457
|
+
"type": "Intl.NumberFormatOptions",
|
|
458
|
+
"defaultValue": "—",
|
|
459
|
+
"appliesTo": "StatDelta",
|
|
460
|
+
"description": "Laid over the format’s own options."
|
|
461
|
+
},
|
|
462
|
+
{
|
|
463
|
+
"name": "goodWhen",
|
|
464
|
+
"type": "'up' | 'down' | 'none'",
|
|
465
|
+
"defaultValue": "up",
|
|
466
|
+
"appliesTo": "StatDelta",
|
|
467
|
+
"description": "Which way is good: the tone is derived from the direction and this, never from the sign."
|
|
468
|
+
},
|
|
469
|
+
{
|
|
470
|
+
"name": "tone",
|
|
471
|
+
"type": "'neutral' | 'accent' | 'secondary' | 'info' | 'success' | 'warning' | 'danger'",
|
|
472
|
+
"defaultValue": "—",
|
|
473
|
+
"appliesTo": "StatDelta",
|
|
474
|
+
"description": "An explicit tone, which wins over the derived one."
|
|
475
|
+
},
|
|
476
|
+
{
|
|
477
|
+
"name": "locale",
|
|
478
|
+
"type": "string",
|
|
479
|
+
"defaultValue": "—",
|
|
480
|
+
"appliesTo": "StatDelta",
|
|
481
|
+
"description": "The locale the change is written in; the language in force when absent."
|
|
482
|
+
},
|
|
483
|
+
{
|
|
484
|
+
"name": "messages",
|
|
485
|
+
"type": "Partial<StatCardMessages>",
|
|
486
|
+
"defaultValue": "—",
|
|
487
|
+
"appliesTo": "StatDelta",
|
|
488
|
+
"description": "Words laid over the language in force: the direction words up, down and flat."
|
|
489
|
+
}
|
|
490
|
+
],
|
|
491
|
+
"composition": [
|
|
492
|
+
{
|
|
493
|
+
"name": "children",
|
|
494
|
+
"type": "ReactNode",
|
|
495
|
+
"defaultValue": "—",
|
|
496
|
+
"appliesTo": "StatDelta",
|
|
497
|
+
"description": "Written in place of the formatted change, after the direction word."
|
|
498
|
+
}
|
|
499
|
+
],
|
|
500
|
+
"events": [],
|
|
501
|
+
"accessibility": [
|
|
502
|
+
"The change reads its direction before its number — “down −7.3%” — from a visually hidden word; the indicator is aria-hidden.",
|
|
503
|
+
"The tone is never the only channel: the indicator turns, the word is read, the sign is written."
|
|
504
|
+
]
|
|
505
|
+
},
|
|
506
|
+
"statCardGroup": {
|
|
507
|
+
"imports": {
|
|
508
|
+
"source": "import { StatCardGroup } from '@slotted/react';"
|
|
509
|
+
},
|
|
510
|
+
"anatomy": [
|
|
511
|
+
{
|
|
512
|
+
"part": "root",
|
|
513
|
+
"element": "div",
|
|
514
|
+
"required": true,
|
|
515
|
+
"purpose": "Holds the page’s figures, carrying data-variant=\"group\" and data-form. grid: the tiles each card draws, in columns of the card’s least width. panel: one surface, the card’s fill, edge and corners, and each card a row of one height."
|
|
516
|
+
}
|
|
517
|
+
],
|
|
518
|
+
"api": [
|
|
519
|
+
{
|
|
520
|
+
"name": "form",
|
|
521
|
+
"type": "'auto' | 'grid' | 'panel'",
|
|
522
|
+
"defaultValue": "auto",
|
|
523
|
+
"appliesTo": "StatCardGroup",
|
|
524
|
+
"description": "auto draws the panel in the compact size class — the page’s, or the viewport’s outside a page — and the grid otherwise."
|
|
525
|
+
}
|
|
526
|
+
],
|
|
527
|
+
"composition": [
|
|
528
|
+
{
|
|
529
|
+
"name": "children",
|
|
530
|
+
"type": "ReactNode",
|
|
531
|
+
"defaultValue": "—",
|
|
532
|
+
"appliesTo": "StatCardGroup",
|
|
533
|
+
"description": "The StatCards. In the panel the first in danger, else in warning, else the first, leads at the figure’s size with its trend; every other card is a row with its label and value on one line and its comparison and delta under them."
|
|
534
|
+
}
|
|
535
|
+
],
|
|
536
|
+
"events": [],
|
|
537
|
+
"accessibility": [
|
|
538
|
+
"The panel moves the lead to the top by order, not in the DOM: the reading and focus order stay the order the page wrote, which is the order of the desk’s tiles.",
|
|
539
|
+
"Each card keeps its group role and its name; the rows are the same figures, read the same way."
|
|
540
|
+
]
|
|
380
541
|
}
|
|
381
542
|
},
|
|
382
543
|
"tokens": [
|
|
@@ -389,11 +550,13 @@
|
|
|
389
550
|
"--slotted-font-size-2xl",
|
|
390
551
|
"--slotted-font-size-3xl",
|
|
391
552
|
"--slotted-font-size-4xl",
|
|
553
|
+
"--slotted-font-size-lg",
|
|
392
554
|
"--slotted-font-size-md",
|
|
393
555
|
"--slotted-font-size-sm",
|
|
394
556
|
"--slotted-font-size-xl",
|
|
395
557
|
"--slotted-font-size-xs",
|
|
396
558
|
"--slotted-font-weight-medium",
|
|
559
|
+
"--slotted-font-weight-regular",
|
|
397
560
|
"--slotted-font-weight-semibold",
|
|
398
561
|
"--slotted-letter-spacing-tighter",
|
|
399
562
|
"--slotted-line-height-2xl",
|
|
@@ -478,11 +641,13 @@
|
|
|
478
641
|
"--slotted-text-muted",
|
|
479
642
|
"--slotted-tone-accent-text",
|
|
480
643
|
"--slotted-tone-danger-border",
|
|
644
|
+
"--slotted-tone-danger-surface",
|
|
481
645
|
"--slotted-tone-danger-text",
|
|
482
646
|
"--slotted-tone-info-text",
|
|
483
647
|
"--slotted-tone-secondary-text",
|
|
484
648
|
"--slotted-tone-success-text",
|
|
485
649
|
"--slotted-tone-warning-border",
|
|
650
|
+
"--slotted-tone-warning-surface",
|
|
486
651
|
"--slotted-tone-warning-text"
|
|
487
652
|
],
|
|
488
653
|
"examples": [
|
|
@@ -574,6 +739,30 @@
|
|
|
574
739
|
"source": "<SlottedProvider locale=\"pt-BR\" catalogs={{ 'pt-BR': PT_BR }}>\n <Dashboard />\n</SlottedProvider>;\n",
|
|
575
740
|
"verdict": "excerpt"
|
|
576
741
|
},
|
|
742
|
+
{
|
|
743
|
+
"id": "stat-delta-react-anatomy",
|
|
744
|
+
"title": "A change in a row, and the DOM it reaches",
|
|
745
|
+
"note": null,
|
|
746
|
+
"language": "tsx",
|
|
747
|
+
"source": "<StatDelta value={-0.073} goodWhen=\"down\" />;\n",
|
|
748
|
+
"verdict": "excerpt"
|
|
749
|
+
},
|
|
750
|
+
{
|
|
751
|
+
"id": "stat-delta-react-dom",
|
|
752
|
+
"title": "Anatomy, as it reaches the DOM",
|
|
753
|
+
"note": null,
|
|
754
|
+
"language": "tsx",
|
|
755
|
+
"source": "<span data-ui=\"stat-card\" data-part=\"root\" data-variant=\"delta\">\n <span data-part=\"delta\" data-trend=\"down\" data-tone=\"success\">\n <span aria-hidden=\"true\" data-part=\"indicator\">\n …\n </span>\n <span data-ui=\"visually-hidden\">down </span>−7.3%\n </span>\n</span>;\n",
|
|
756
|
+
"verdict": "excerpt"
|
|
757
|
+
},
|
|
758
|
+
{
|
|
759
|
+
"id": "stat-card-group-react",
|
|
760
|
+
"title": "A page’s figures, by its size class",
|
|
761
|
+
"note": null,
|
|
762
|
+
"language": "tsx",
|
|
763
|
+
"source": "<StatCardGroup>\n <StatCard attention=\"danger\">…</StatCard>\n <StatCard>…</StatCard>\n <StatCard>…</StatCard>\n</StatCardGroup>;\n",
|
|
764
|
+
"verdict": "excerpt"
|
|
765
|
+
},
|
|
577
766
|
{
|
|
578
767
|
"id": "attention",
|
|
579
768
|
"title": "attention.tsx",
|
|
@@ -598,6 +787,14 @@
|
|
|
598
787
|
"source": "import { useState } from 'react';\n\nimport { Button } from '@slotted/react/button';\nimport { Inline } from '@slotted/react/inline';\nimport { Stack } from '@slotted/react/stack';\nimport {\n StatCard,\n StatCardComparison,\n StatCardFigure,\n StatCardHeader,\n StatCardLabel,\n StatCardPeriod,\n StatCardValue,\n} from '@slotted/react/stat-card';\n\nconst USD = { style: 'currency', currency: 'USD', maximumFractionDigits: 0 } as const;\n\nexport default function StatCardCount() {\n const [revenue, setRevenue] = useState(184200);\n\n function handleBook() {\n setRevenue((current) => current + 2450);\n }\n\n return (\n <Stack gap={4}>\n <StatCard>\n <StatCardHeader>\n <StatCardLabel>Revenue today</StatCardLabel>\n </StatCardHeader>\n <StatCardFigure>\n <StatCardValue formatOptions={USD} transition=\"count\" value={revenue} />\n <StatCardComparison>\n from $171,800 <StatCardPeriod>yesterday</StatCardPeriod>\n </StatCardComparison>\n </StatCardFigure>\n </StatCard>\n\n <Inline>\n <Button onClick={handleBook}>Book an order</Button>\n </Inline>\n </Stack>\n );\n}\n",
|
|
599
788
|
"verdict": "example"
|
|
600
789
|
},
|
|
790
|
+
{
|
|
791
|
+
"id": "delta",
|
|
792
|
+
"title": "delta.tsx",
|
|
793
|
+
"note": null,
|
|
794
|
+
"language": "tsx",
|
|
795
|
+
"source": "import { StatDelta } from '@slotted/react/stat-card';\n\nconst ROWS = [\n { label: 'Open orders', value: 1510, delta: 0.124, goodWhen: 'up' },\n { label: 'Average lead time', value: 4.6, delta: -0.073, goodWhen: 'down' },\n { label: 'Returns', value: 38, delta: 0, goodWhen: 'down' },\n] as const;\n\nexport default function StatCardDelta() {\n return (\n <table>\n <tbody>\n {ROWS.map((row) => (\n <tr key={row.label}>\n <th scope=\"row\">{row.label}</th>\n <td>{row.value}</td>\n <td>\n <StatDelta goodWhen={row.goodWhen} value={row.delta} />\n </td>\n </tr>\n ))}\n </tbody>\n </table>\n );\n}\n",
|
|
796
|
+
"verdict": "example"
|
|
797
|
+
},
|
|
601
798
|
{
|
|
602
799
|
"id": "format",
|
|
603
800
|
"title": "format.tsx",
|
|
@@ -606,6 +803,14 @@
|
|
|
606
803
|
"source": "import { Grid } from '@slotted/react/grid';\nimport {\n StatCard,\n StatCardDelta,\n StatCardFigure,\n StatCardHeader,\n StatCardLabel,\n StatCardUnit,\n StatCardValue,\n} from '@slotted/react/stat-card';\n\nconst COMPACT_USD = { style: 'currency', currency: 'USD', notation: 'compact' } as const;\nconst USD = { style: 'currency', currency: 'USD' } as const;\nconst EUR = { style: 'currency', currency: 'EUR' } as const;\n\nexport default function StatCardFormat() {\n return (\n <Grid columns={2} gap={4}>\n <StatCard delta={0.087}>\n <StatCardHeader>\n <StatCardLabel>Revenue</StatCardLabel>\n </StatCardHeader>\n <StatCardFigure>\n <StatCardValue formatOptions={COMPACT_USD} value={1234567} />\n <StatCardDelta />\n </StatCardFigure>\n </StatCard>\n\n <StatCard delta={0.021}>\n <StatCardHeader>\n <StatCardLabel>Average order value</StatCardLabel>\n </StatCardHeader>\n <StatCardFigure>\n <StatCardValue emphasis=\"whole\" formatOptions={USD} value={128.45} />\n <StatCardDelta />\n </StatCardFigure>\n </StatCard>\n\n <StatCard delta={0.032} locale=\"de-DE\">\n <StatCardHeader>\n <StatCardLabel>Revenue, Hamburg</StatCardLabel>\n </StatCardHeader>\n <StatCardFigure>\n <StatCardValue formatOptions={EUR} value={48210.5} />\n <StatCardDelta />\n </StatCardFigure>\n </StatCard>\n\n <StatCard goodWhen=\"down\">\n <StatCardHeader>\n <StatCardLabel>Average lead time</StatCardLabel>\n </StatCardHeader>\n <StatCardFigure>\n <StatCardValue>\n 5.2<StatCardUnit>days</StatCardUnit>\n </StatCardValue>\n <StatCardDelta format=\"decimal\" value={-0.3} />\n </StatCardFigure>\n </StatCard>\n </Grid>\n );\n}\n",
|
|
607
804
|
"verdict": "example"
|
|
608
805
|
},
|
|
806
|
+
{
|
|
807
|
+
"id": "group",
|
|
808
|
+
"title": "group.tsx",
|
|
809
|
+
"note": null,
|
|
810
|
+
"language": "tsx",
|
|
811
|
+
"source": "import {\n StatCard,\n StatCardComparison,\n StatCardDelta,\n StatCardFigure,\n StatCardGroup,\n StatCardHeader,\n StatCardLabel,\n StatCardValue,\n} from '@slotted/react/stat-card';\n\nconst FIGURES = [\n { label: 'Open balance', value: 38000, note: 'Of a total line of $38,000.00' },\n {\n label: 'Overdue',\n value: 4120,\n note: 'Three invoices past 30 days',\n delta: 0.12,\n attention: 'danger',\n },\n { label: 'Paid this month', value: 12900, note: 'Eleven invoices', delta: -0.04 },\n] as const;\n\nexport default function StatCardGroupExample() {\n return (\n <StatCardGroup>\n {FIGURES.map((figure) => (\n <StatCard\n key={figure.label}\n size=\"sm\"\n {...('attention' in figure ? { attention: figure.attention } : {})}\n {...('delta' in figure ? { delta: figure.delta } : {})}\n goodWhen=\"down\"\n >\n <StatCardHeader>\n <StatCardLabel>{figure.label}</StatCardLabel>\n </StatCardHeader>\n <StatCardFigure>\n <StatCardValue value={figure.value} />\n {'delta' in figure ? <StatCardDelta /> : null}\n <StatCardComparison>{figure.note}</StatCardComparison>\n </StatCardFigure>\n </StatCard>\n ))}\n </StatCardGroup>\n );\n}\n",
|
|
812
|
+
"verdict": "example"
|
|
813
|
+
},
|
|
609
814
|
{
|
|
610
815
|
"id": "parts",
|
|
611
816
|
"title": "parts.tsx",
|