@slotted/react 0.1.0-beta.42 → 0.1.0-beta.43
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/{app-shell-D54YkU7E.js → app-shell-DsWhsSMU.js} +3 -2
- package/dist/app-shell.js +1 -1
- package/dist/attachment-TZykYNu5.js +300 -0
- package/dist/attachment.js +2 -2
- package/dist/{avatar-group-bJaZE1_C.js → avatar-group-Bzmmj2HI.js} +2 -1
- package/dist/avatar-group.js +1 -1
- package/dist/{carousel-B9nMK7Yf.js → carousel-CRNz-T3g.js} +1 -1
- package/dist/carousel.js +1 -1
- package/dist/{command-palette-C90CzfQi.js → command-palette-Bgf5tfCI.js} +160 -156
- package/dist/command-palette.js +1 -1
- package/dist/{data-grid-D106baPp.js → data-grid-DUft3rJb.js} +1 -1
- package/dist/data-grid.js +1 -1
- package/dist/{data-list-BA0xrySM.js → data-list-Dv3orBtf.js} +15 -15
- package/dist/data-list.js +1 -1
- package/dist/detail-panel-Cke3ZFU3.js +342 -0
- package/dist/detail-panel.js +2 -2
- package/dist/docs/action-bar.examples.md +768 -0
- package/dist/docs/action-bar.json +74 -50
- package/dist/docs/action-bar.md +49 -311
- package/dist/docs/app-shell.examples.md +1221 -64
- package/dist/docs/app-shell.json +92 -60
- package/dist/docs/app-shell.md +92 -57
- package/dist/docs/attachment.examples.md +689 -0
- package/dist/docs/attachment.json +69 -37
- package/dist/docs/attachment.md +44 -203
- package/dist/docs/avatar-group.json +111 -23
- package/dist/docs/avatar-group.md +487 -28
- package/dist/docs/button-group.json +98 -2
- package/dist/docs/button-group.md +411 -8
- package/dist/docs/calendar.examples.md +512 -0
- package/dist/docs/calendar.json +72 -24
- package/dist/docs/calendar.md +18 -147
- package/dist/docs/carousel.examples.md +868 -0
- package/dist/docs/carousel.json +58 -50
- package/dist/docs/carousel.md +66 -300
- package/dist/docs/cascader.examples.md +1269 -0
- package/dist/docs/cascader.json +72 -16
- package/dist/docs/cascader.md +78 -154
- package/dist/docs/chart.examples.md +734 -24
- package/dist/docs/chart.json +93 -13
- package/dist/docs/chart.md +28 -7
- package/dist/docs/clock.json +71 -15
- package/dist/docs/clock.md +326 -21
- package/dist/docs/code-block.json +79 -55
- package/dist/docs/code-block.md +417 -74
- package/dist/docs/color-picker.json +60 -12
- package/dist/docs/color-picker.md +245 -22
- package/dist/docs/column-manager.examples.md +764 -0
- package/dist/docs/column-manager.json +68 -12
- package/dist/docs/column-manager.md +44 -203
- package/dist/docs/command-palette.examples.md +747 -0
- package/dist/docs/command-palette.json +48 -24
- package/dist/docs/command-palette.md +60 -339
- package/dist/docs/currency-field.examples.md +355 -73
- package/dist/docs/currency-field.json +96 -64
- package/dist/docs/currency-field.md +57 -50
- package/dist/docs/dashboard-grid.examples.md +629 -0
- package/dist/docs/dashboard-grid.json +64 -16
- package/dist/docs/dashboard-grid.md +34 -152
- package/dist/docs/data-list.examples.md +1556 -0
- package/dist/docs/data-list.json +58 -18
- package/dist/docs/data-list.md +139 -224
- package/dist/docs/date-field.examples.md +543 -0
- package/dist/docs/date-field.json +64 -24
- package/dist/docs/date-field.md +22 -168
- package/dist/docs/datetime-field.examples.md +699 -0
- package/dist/docs/datetime-field.json +79 -31
- package/dist/docs/datetime-field.md +24 -269
- package/dist/docs/datetime-range-picker.examples.md +682 -0
- package/dist/docs/datetime-range-picker.json +117 -61
- package/dist/docs/datetime-range-picker.md +59 -224
- package/dist/docs/description-list.examples.md +652 -0
- package/dist/docs/description-list.json +49 -25
- package/dist/docs/description-list.md +33 -188
- package/dist/docs/detail-panel.examples.md +1177 -0
- package/dist/docs/detail-panel.json +69 -53
- package/dist/docs/detail-panel.md +114 -324
- package/dist/docs/entity-picker.examples.md +1037 -0
- package/dist/docs/entity-picker.json +66 -18
- package/dist/docs/entity-picker.md +56 -246
- package/dist/docs/event-calendar.examples.md +749 -49
- package/dist/docs/event-calendar.json +46 -22
- package/dist/docs/event-calendar.md +81 -11
- package/dist/docs/field-group.examples.md +554 -0
- package/dist/docs/field-group.json +98 -34
- package/dist/docs/field-group.md +55 -133
- package/dist/docs/filter-bar.examples.md +772 -0
- package/dist/docs/filter-bar.json +41 -25
- package/dist/docs/filter-bar.md +42 -246
- package/dist/docs/form.examples.md +579 -0
- package/dist/docs/form.json +87 -39
- package/dist/docs/form.md +53 -177
- package/dist/docs/fullscreen.examples.md +558 -0
- package/dist/docs/fullscreen.json +58 -18
- package/dist/docs/fullscreen.md +50 -169
- package/dist/docs/highlight.json +57 -25
- package/dist/docs/highlight.md +402 -50
- package/dist/docs/icon.json +85 -5
- package/dist/docs/icon.md +401 -10
- package/dist/docs/image.examples.md +670 -0
- package/dist/docs/image.json +44 -28
- package/dist/docs/image.md +24 -176
- package/dist/docs/import-export-center.examples.md +1280 -0
- package/dist/docs/import-export-center.json +67 -27
- package/dist/docs/import-export-center.md +121 -226
- package/dist/docs/list-item.examples.md +769 -0
- package/dist/docs/list-item.json +110 -38
- package/dist/docs/list-item.md +84 -201
- package/dist/docs/listbox.examples.md +858 -0
- package/dist/docs/listbox.json +76 -28
- package/dist/docs/listbox.md +41 -263
- package/dist/docs/markdown.json +79 -55
- package/dist/docs/markdown.md +581 -85
- package/dist/docs/media-viewer.examples.md +1038 -0
- package/dist/docs/media-viewer.json +70 -15
- package/dist/docs/media-viewer.md +84 -135
- package/dist/docs/message-scroller.examples.md +1193 -0
- package/dist/docs/message-scroller.json +41 -17
- package/dist/docs/message-scroller.md +80 -134
- package/dist/docs/message.examples.md +944 -0
- package/dist/docs/message.json +64 -16
- package/dist/docs/message.md +34 -326
- package/dist/docs/meter.json +58 -26
- package/dist/docs/meter.md +312 -32
- package/dist/docs/navigation-menu.examples.md +1107 -0
- package/dist/docs/navigation-menu.json +57 -41
- package/dist/docs/navigation-menu.md +105 -298
- package/dist/docs/notification-center.examples.md +1045 -0
- package/dist/docs/notification-center.json +71 -15
- package/dist/docs/notification-center.md +76 -266
- package/dist/docs/otp-input.examples.md +490 -0
- package/dist/docs/otp-input.json +65 -25
- package/dist/docs/otp-input.md +20 -191
- package/dist/docs/page-header.examples.md +1041 -0
- package/dist/docs/page-header.json +75 -43
- package/dist/docs/page-header.md +79 -291
- package/dist/docs/page.examples.md +633 -0
- package/dist/docs/page.json +48 -16
- package/dist/docs/page.md +62 -129
- package/dist/docs/prompt-composer.examples.md +630 -0
- package/dist/docs/prompt-composer.json +66 -18
- package/dist/docs/prompt-composer.md +35 -161
- package/dist/docs/prose.json +69 -37
- package/dist/docs/prose.md +393 -75
- package/dist/docs/rating.examples.md +525 -0
- package/dist/docs/rating.json +92 -28
- package/dist/docs/rating.md +27 -241
- package/dist/docs/saved-views.examples.md +1108 -0
- package/dist/docs/saved-views.json +53 -21
- package/dist/docs/saved-views.md +86 -171
- package/dist/docs/scroll-area.examples.md +837 -0
- package/dist/docs/scroll-area.json +64 -24
- package/dist/docs/scroll-area.md +57 -140
- package/dist/docs/section.examples.md +676 -0
- package/dist/docs/section.json +68 -20
- package/dist/docs/section.md +39 -162
- package/dist/docs/segmented-control.examples.md +480 -0
- package/dist/docs/segmented-control.json +76 -28
- package/dist/docs/segmented-control.md +20 -191
- package/dist/docs/side-navigation.examples.md +1468 -0
- package/dist/docs/side-navigation.json +53 -53
- package/dist/docs/side-navigation.md +79 -354
- package/dist/docs/slider.examples.md +505 -0
- package/dist/docs/slider.json +91 -51
- package/dist/docs/slider.md +47 -212
- package/dist/docs/sparkline.json +60 -36
- package/dist/docs/sparkline.md +447 -71
- package/dist/docs/split-button.examples.md +509 -0
- package/dist/docs/split-button.json +73 -41
- package/dist/docs/split-button.md +64 -194
- package/dist/docs/splitter.examples.md +921 -0
- package/dist/docs/splitter.json +94 -46
- package/dist/docs/splitter.md +75 -182
- package/dist/docs/stat-card.examples.md +725 -0
- package/dist/docs/stat-card.json +89 -41
- package/dist/docs/stat-card.md +55 -227
- package/dist/docs/status-indicator.json +80 -32
- package/dist/docs/status-indicator.md +409 -65
- package/dist/docs/stepper.json +53 -21
- package/dist/docs/stepper.md +369 -48
- package/dist/docs/table-of-contents.examples.md +550 -0
- package/dist/docs/table-of-contents.json +60 -28
- package/dist/docs/table-of-contents.md +70 -205
- package/dist/docs/tags-input.examples.md +541 -0
- package/dist/docs/tags-input.json +64 -16
- package/dist/docs/tags-input.md +15 -262
- package/dist/docs/time-field.examples.md +587 -0
- package/dist/docs/time-field.json +69 -29
- package/dist/docs/time-field.md +21 -223
- package/dist/docs/time-picker.json +117 -53
- package/dist/docs/time-picker.md +499 -54
- package/dist/docs/time-range-picker.examples.md +750 -0
- package/dist/docs/time-range-picker.json +139 -75
- package/dist/docs/time-range-picker.md +63 -225
- package/dist/docs/timeline.examples.md +617 -0
- package/dist/docs/timeline.json +44 -28
- package/dist/docs/timeline.md +34 -208
- package/dist/docs/toolbar.json +56 -16
- package/dist/docs/toolbar.md +357 -63
- package/dist/docs/top-navigation.examples.md +1206 -140
- package/dist/docs/top-navigation.json +49 -33
- package/dist/docs/top-navigation.md +87 -36
- package/dist/docs/tour.examples.md +960 -0
- package/dist/docs/tour.json +57 -25
- package/dist/docs/tour.md +60 -244
- package/dist/docs/transfer.examples.md +631 -0
- package/dist/docs/transfer.json +80 -16
- package/dist/docs/transfer.md +41 -170
- package/dist/docs/typography.json +96 -0
- package/dist/docs/typography.md +352 -4
- package/dist/docs/upload.examples.md +555 -53
- package/dist/docs/upload.json +62 -30
- package/dist/docs/upload.md +46 -11
- package/dist/docs/wizard.examples.md +1389 -0
- package/dist/docs/wizard.json +89 -49
- package/dist/docs/wizard.md +122 -263
- package/dist/{entity-picker-CC4VoC3p.js → entity-picker-C78f3Z0o.js} +9 -6
- package/dist/entity-picker.js +1 -1
- package/dist/{event-calendar-CjmF_e0H.js → event-calendar-DJPoCi-O.js} +1 -1
- package/dist/event-calendar.js +1 -1
- package/dist/{filter-bar-B3QJD7SZ.js → filter-bar-D61wiQFP.js} +1 -1
- package/dist/filter-bar.js +1 -1
- package/dist/{import-export-center-CW8YVZev.js → import-export-center-mqvmlzwB.js} +44 -36
- package/dist/import-export-center.js +1 -1
- package/dist/index.js +58 -58
- package/dist/{markdown-BdskE4-L.js → markdown-8CtV4k44.js} +2 -2
- package/dist/markdown.js +1 -1
- package/dist/{media-viewer-zEXcwfEY.js → media-viewer-C_cbuAq-.js} +64 -60
- package/dist/media-viewer.js +2 -2
- package/dist/message-P91bEGyV.js +455 -0
- package/dist/message.js +2 -2
- package/dist/{page-header-DmwBGwlm.js → page-header-jeAIQSZM.js} +103 -108
- package/dist/page-header.js +1 -1
- package/dist/section-CVTQdWBl.js +216 -0
- package/dist/section.js +2 -2
- package/dist/{segmented-control-CbK7SurB.js → segmented-control-BSMVjukr.js} +1 -1
- package/dist/segmented-control.js +1 -1
- package/dist/{side-navigation-CKRETc8E.js → side-navigation-BQzBxz2B.js} +179 -179
- package/dist/side-navigation.js +1 -1
- package/dist/{stat-card-CL3Xe6pV.js → stat-card-BpGZiFbG.js} +12 -14
- package/dist/stat-card.js +1 -1
- package/dist/{stepper-DHdrANZI.js → stepper-Cxb_tHnA.js} +130 -127
- package/dist/stepper.js +2 -2
- package/dist/styles/carousel.css +1 -1
- package/dist/styles/index.css +1 -1
- package/dist/styles.css +1 -1
- package/dist/{timeline-BiL2CXfn.js → timeline-ZngK6zLC.js} +9 -6
- package/dist/timeline.js +1 -1
- package/dist/top-navigation-YSEQzBhD.js +744 -0
- package/dist/top-navigation.js +2 -2
- package/dist/{transfer-sKUvmEKe.js → transfer-Cv5yQuTN.js} +1 -1
- package/dist/transfer.js +1 -1
- package/dist/types/attachment/attachment-parts.d.ts +24 -11
- package/dist/types/attachment/attachment-parts.d.ts.map +1 -1
- package/dist/types/attachment/attachment.d.ts +3 -3
- package/dist/types/attachment/attachment.d.ts.map +1 -1
- package/dist/types/avatar-group/avatar-group.d.ts.map +1 -1
- package/dist/types/carousel/carousel-parts.d.ts +2 -2
- package/dist/types/command-palette/command-palette.d.ts.map +1 -1
- package/dist/types/data-list/data-list.d.ts.map +1 -1
- package/dist/types/detail-panel/detail-panel-parts.d.ts +10 -3
- package/dist/types/detail-panel/detail-panel-parts.d.ts.map +1 -1
- package/dist/types/detail-panel/detail-panel.d.ts.map +1 -1
- package/dist/types/detail-panel/detail-panel.types.d.ts +7 -0
- package/dist/types/detail-panel/detail-panel.types.d.ts.map +1 -1
- package/dist/types/entity-picker/entity-picker.d.ts.map +1 -1
- package/dist/types/import-export-center/import-export-center.d.ts.map +1 -1
- package/dist/types/media-viewer/index.d.ts +2 -2
- package/dist/types/media-viewer/index.d.ts.map +1 -1
- package/dist/types/media-viewer/media-viewer-bar.d.ts +3 -1
- package/dist/types/media-viewer/media-viewer-bar.d.ts.map +1 -1
- package/dist/types/media-viewer/media-viewer.types.d.ts +1 -0
- package/dist/types/media-viewer/media-viewer.types.d.ts.map +1 -1
- package/dist/types/message/message-parts.d.ts +7 -0
- package/dist/types/message/message-parts.d.ts.map +1 -1
- package/dist/types/message/message.d.ts.map +1 -1
- package/dist/types/page-header/page-header-parts.d.ts.map +1 -1
- package/dist/types/section/section-parts.d.ts +16 -8
- package/dist/types/section/section-parts.d.ts.map +1 -1
- package/dist/types/section/section.d.ts.map +1 -1
- package/dist/types/segmented-control/segmented-control-parts.d.ts.map +1 -1
- package/dist/types/side-navigation/side-navigation-parts.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-parts.d.ts +3 -3
- package/dist/types/stat-card/stat-card-parts.d.ts.map +1 -1
- package/dist/types/stepper/stepper-parts.d.ts +11 -2
- package/dist/types/stepper/stepper-parts.d.ts.map +1 -1
- package/dist/types/stepper/stepper.d.ts.map +1 -1
- package/dist/types/timeline/timeline-parts.d.ts.map +1 -1
- package/dist/types/top-navigation/top-navigation.d.ts.map +1 -1
- package/dist/{wizard-4c0X7Bx_.js → wizard-Dfryz1id.js} +214 -214
- package/dist/wizard.js +1 -1
- package/package.json +6 -6
- package/dist/attachment-MqczA38F.js +0 -292
- package/dist/detail-panel-EImAtksY.js +0 -327
- package/dist/message-D1Dd6Y2k.js +0 -452
- package/dist/section-D_qOfdxR.js +0 -213
- package/dist/top-navigation-D8IHPOmm.js +0 -744
|
@@ -336,7 +336,7 @@
|
|
|
336
336
|
{
|
|
337
337
|
"name": "onClick on ColumnManagerTrigger",
|
|
338
338
|
"payload": "the element’s own event",
|
|
339
|
-
"when": "Runs before
|
|
339
|
+
"when": "Runs before ColumnManagerTrigger toggles the layer; preventDefault() keeps it closed."
|
|
340
340
|
}
|
|
341
341
|
],
|
|
342
342
|
"accessibility": [
|
|
@@ -344,7 +344,7 @@
|
|
|
344
344
|
"The root is a group named by its heading and each zone a group named by its label, so a reader hears Pinned to start before the columns in it. A checkbox is named by the column and its status — “Order Required”, “Region Hidden for space” — and described by the column’s description through the checkbox’s own aria-describedby.",
|
|
345
345
|
"Alt+ArrowUp/Down on a grip is the rearrangeable listbox’s move: the column moves one place within its zone, focus stays on the grip, and the live announcer says “Customer moved to position 3”. A pointer drag runs through @slotted/core/drag, whose Escape cancels the drag before the layer sees it.",
|
|
346
346
|
"The trigger says aria-haspopup=\"dialog\", aria-expanded and aria-controls; its count is aria-hidden and a visually hidden sentence carries it, so the name is “Columns 3 hidden columns” and the number is never read as a bare digit.",
|
|
347
|
-
"A disabled grip keeps its focus stop with aria-disabled, so a reader finds out why it does not move; disabled boxes are the
|
|
347
|
+
"A disabled grip keeps its focus stop with aria-disabled, so a reader finds out why it does not move; disabled boxes are the Checkbox’s native disabled."
|
|
348
348
|
]
|
|
349
349
|
}
|
|
350
350
|
},
|
|
@@ -413,24 +413,24 @@
|
|
|
413
413
|
"title": "In a drawer at the end",
|
|
414
414
|
"note": "The same panel as the drawer family at side end, size sm, for a grid with many columns: the list takes the drawer’s height and is not capped.",
|
|
415
415
|
"language": "tsx",
|
|
416
|
-
"source": "<ColumnManager
|
|
417
|
-
"verdict": "
|
|
416
|
+
"source": "import type { GridColumn } from '@slotted/core/grid';\nimport { ColumnManager, ColumnManagerTrigger } from '@slotted/react/column-manager';\nimport type { ColumnManagerHandle } from '@slotted/react/column-manager';\nimport { Inline } from '@slotted/react/inline';\nimport { Stack } from '@slotted/react/stack';\nimport { Text } from '@slotted/react/typography';\nimport { useRef, useState } from 'react';\n\nconst COLUMNS: GridColumn[] = [\n { id: 'number', label: 'Order', hideable: false },\n { id: 'customer', label: 'Customer' },\n {\n id: 'status',\n label: 'Status',\n description: 'Fulfilment stage, updated when the ship date is confirmed',\n },\n {\n id: 'total',\n label: 'Total',\n kind: 'number',\n description: 'Order value with tax, in the order currency',\n },\n { id: 'due', label: 'Due date', description: 'The date promised to the customer' },\n { id: 'owner', label: 'Owner' },\n { id: 'notes', label: 'Notes' },\n { id: 'actions', label: 'Actions', kind: 'actions', reorderable: false },\n];\n\nexport default function ColumnManagerDrawerExample() {\n const manager = useRef<ColumnManagerHandle>(null);\n const [open, setOpen] = useState(false);\n\n return (\n <Stack gap={3}>\n <Inline>\n <ColumnManagerTrigger manager={manager}>Columns</ColumnManagerTrigger>\n </Inline>\n <Text size=\"sm\" tone=\"muted\">\n {open ? 'The drawer is open.' : 'The drawer is closed.'}\n </Text>\n\n <ColumnManager\n columns={COLUMNS}\n onOpenChange={setOpen}\n open={open}\n presentation=\"drawer\"\n ref={manager}\n />\n </Stack>\n );\n}\n",
|
|
417
|
+
"verdict": "example"
|
|
418
418
|
},
|
|
419
419
|
{
|
|
420
420
|
"id": "confirm",
|
|
421
421
|
"title": "Apply once",
|
|
422
422
|
"note": "Under apply=\"confirm\" every action edits a draft: hide two columns and move one, and the log stays empty until Apply asks once with the reason submit and every key that moved. Cancel discards the draft.",
|
|
423
423
|
"language": "tsx",
|
|
424
|
-
"source": "
|
|
425
|
-
"verdict": "
|
|
424
|
+
"source": "import type { GridColumn, GridColumnState } from '@slotted/core/grid';\nimport { ColumnManager } from '@slotted/react/column-manager';\nimport type { ColumnManagerRequest } from '@slotted/react/column-manager';\nimport { Stack } from '@slotted/react/stack';\nimport { Text } from '@slotted/react/typography';\nimport { useState } from 'react';\n\nconst COLUMNS: GridColumn[] = [\n { id: 'number', label: 'Order', hideable: false },\n { id: 'customer', label: 'Customer' },\n {\n id: 'status',\n label: 'Status',\n description: 'Fulfilment stage, updated when the ship date is confirmed',\n },\n {\n id: 'total',\n label: 'Total',\n kind: 'number',\n description: 'Order value with tax, in the order currency',\n },\n { id: 'due', label: 'Due date', description: 'The date promised to the customer' },\n { id: 'owner', label: 'Owner' },\n { id: 'notes', label: 'Notes' },\n { id: 'actions', label: 'Actions', kind: 'actions', reorderable: false },\n];\n\nexport default function ColumnManagerConfirmExample() {\n const [last, setLast] = useState('Nothing applied yet.');\n\n function handleChange(_next: GridColumnState, request: ColumnManagerRequest) {\n setLast(`Applied: ${request.changes.join(', ')}. Reason: ${request.reason}.`);\n }\n\n return (\n <Stack gap={4}>\n <ColumnManager\n apply=\"confirm\"\n columns={COLUMNS}\n onColumnStateChange={handleChange}\n presentation=\"inline\"\n />\n <Text size=\"sm\" tone=\"muted\">\n {last}\n </Text>\n </Stack>\n );\n}\n",
|
|
425
|
+
"verdict": "example"
|
|
426
426
|
},
|
|
427
427
|
{
|
|
428
428
|
"id": "search",
|
|
429
429
|
"title": "Search by name and description",
|
|
430
430
|
"note": "Type “date”: Due date matches by its name and Status by its description. “regiao” finds Região — case and accents fall away. While a query stands every grip is disabled, because a place in a subset is not a place in the list.",
|
|
431
431
|
"language": "tsx",
|
|
432
|
-
"source": "
|
|
433
|
-
"verdict": "
|
|
432
|
+
"source": "import type { GridColumn } from '@slotted/core/grid';\nimport { ColumnManager } from '@slotted/react/column-manager';\n\nconst COLUMNS: GridColumn[] = [\n { id: 'number', label: 'Order', hideable: false },\n { id: 'customer', label: 'Customer', description: 'The account that placed the order' },\n {\n id: 'status',\n label: 'Status',\n description: 'Fulfilment stage, updated when the ship date is confirmed',\n },\n {\n id: 'total',\n label: 'Total',\n kind: 'number',\n description: 'Order value with tax, in the order currency',\n },\n { id: 'due', label: 'Due date', description: 'The date promised to the customer' },\n { id: 'shipped', label: 'Shipped', description: 'The date the carrier collected the parcel' },\n { id: 'owner', label: 'Owner', description: 'The sales representative who owns the account' },\n { id: 'carrier', label: 'Carrier' },\n];\n\nexport default function ColumnManagerSearchExample() {\n return <ColumnManager columns={COLUMNS} presentation=\"inline\" />;\n}\n",
|
|
433
|
+
"verdict": "example"
|
|
434
434
|
},
|
|
435
435
|
{
|
|
436
436
|
"id": "locked",
|
|
@@ -453,16 +453,16 @@
|
|
|
453
453
|
"title": "Reorder by pointer and by keyboard",
|
|
454
454
|
"note": "Drag a grip: the row dims and a line marks where it lands, inside its zone only. Or focus a grip and press Alt+ArrowDown: the column moves one place, “Customer moved to position 3” is announced, and focus stays on the grip.",
|
|
455
455
|
"language": "tsx",
|
|
456
|
-
"source": "
|
|
457
|
-
"verdict": "
|
|
456
|
+
"source": "import type { GridColumn, GridColumnState } from '@slotted/core/grid';\nimport { normalizeColumnState } from '@slotted/core/grid';\nimport { ColumnManager } from '@slotted/react/column-manager';\nimport type { ColumnManagerRequest } from '@slotted/react/column-manager';\nimport { Stack } from '@slotted/react/stack';\nimport { Text } from '@slotted/react/typography';\nimport { useState } from 'react';\n\nconst COLUMNS: GridColumn[] = [\n { id: 'number', label: 'Order', hideable: false },\n { id: 'customer', label: 'Customer' },\n {\n id: 'status',\n label: 'Status',\n description: 'Fulfilment stage, updated when the ship date is confirmed',\n },\n {\n id: 'total',\n label: 'Total',\n kind: 'number',\n description: 'Order value with tax, in the order currency',\n },\n { id: 'due', label: 'Due date', description: 'The date promised to the customer' },\n { id: 'owner', label: 'Owner' },\n { id: 'notes', label: 'Notes' },\n { id: 'actions', label: 'Actions', kind: 'actions', reorderable: false },\n];\n\nconst START = { pinned: { start: ['number'], end: ['actions'] } };\n\nexport default function ColumnManagerReorderExample() {\n const [state, setState] = useState(() => normalizeColumnState(START, COLUMNS));\n const [last, setLast] = useState('No request yet.');\n\n function handleChange(next: GridColumnState, request: ColumnManagerRequest) {\n setState(next);\n setLast(`change: ${request.change}, reason: ${request.reason}`);\n }\n\n return (\n <Stack gap={4}>\n <ColumnManager\n columnState={state}\n columns={COLUMNS}\n onColumnStateChange={handleChange}\n presentation=\"inline\"\n />\n <Text size=\"sm\" tone=\"muted\">\n {last}\n </Text>\n </Stack>\n );\n}\n",
|
|
457
|
+
"verdict": "example"
|
|
458
458
|
},
|
|
459
459
|
{
|
|
460
460
|
"id": "pinning",
|
|
461
461
|
"title": "Pinning",
|
|
462
462
|
"note": "Order is pinned to the start and Actions to the end, each in its section. Open a row’s pin to move it between zones; a pinned column’s pin is in the accent ink, and a move never crosses a zone.",
|
|
463
463
|
"language": "tsx",
|
|
464
|
-
"source": "
|
|
465
|
-
"verdict": "
|
|
464
|
+
"source": "import type { GridColumn } from '@slotted/core/grid';\nimport { ColumnManager } from '@slotted/react/column-manager';\n\nconst COLUMNS: GridColumn[] = [\n { id: 'number', label: 'Order', hideable: false },\n { id: 'customer', label: 'Customer' },\n {\n id: 'status',\n label: 'Status',\n description: 'Fulfilment stage, updated when the ship date is confirmed',\n },\n {\n id: 'total',\n label: 'Total',\n kind: 'number',\n description: 'Order value with tax, in the order currency',\n },\n { id: 'due', label: 'Due date', description: 'The date promised to the customer' },\n { id: 'owner', label: 'Owner' },\n { id: 'notes', label: 'Notes' },\n { id: 'actions', label: 'Actions', kind: 'actions', reorderable: false },\n];\n\nconst START = { pinned: { start: ['number', 'customer'], end: ['actions'] } };\n\nexport default function ColumnManagerPinningExample() {\n return <ColumnManager columns={COLUMNS} defaultColumnState={START} presentation=\"inline\" />;\n}\n",
|
|
465
|
+
"verdict": "example"
|
|
466
466
|
},
|
|
467
467
|
{
|
|
468
468
|
"id": "reset-and-show-all",
|
|
@@ -503,6 +503,62 @@
|
|
|
503
503
|
"language": "tsx",
|
|
504
504
|
"source": "<SlottedProvider catalogs={{ 'pt-BR': PT_BR }} locale=\"pt-BR\">\n <App />\n</SlottedProvider>;\n",
|
|
505
505
|
"verdict": "excerpt"
|
|
506
|
+
},
|
|
507
|
+
{
|
|
508
|
+
"id": "basic",
|
|
509
|
+
"title": "basic.tsx",
|
|
510
|
+
"note": null,
|
|
511
|
+
"language": "tsx",
|
|
512
|
+
"source": "import type { GridColumn } from '@slotted/core/grid';\nimport { ColumnManager, ColumnManagerTrigger } from '@slotted/react/column-manager';\nimport type { ColumnManagerHandle } from '@slotted/react/column-manager';\nimport { Inline } from '@slotted/react/inline';\nimport { useRef } from 'react';\n\nconst COLUMNS: GridColumn[] = [\n { id: 'number', label: 'Order', hideable: false },\n { id: 'customer', label: 'Customer' },\n {\n id: 'status',\n label: 'Status',\n description: 'Fulfilment stage, updated when the ship date is confirmed',\n },\n {\n id: 'total',\n label: 'Total',\n kind: 'number',\n description: 'Order value with tax, in the order currency',\n },\n { id: 'due', label: 'Due date', description: 'The date promised to the customer' },\n { id: 'owner', label: 'Owner' },\n { id: 'notes', label: 'Notes' },\n { id: 'actions', label: 'Actions', kind: 'actions', reorderable: false },\n];\n\nconst DEFAULTS = { hidden: ['notes'], pinned: { start: ['number'], end: ['actions'] } };\n\nexport default function ColumnManagerBasicExample() {\n const manager = useRef<ColumnManagerHandle>(null);\n\n return (\n <>\n <Inline>\n <ColumnManagerTrigger manager={manager}>Columns</ColumnManagerTrigger>\n </Inline>\n\n <ColumnManager columns={COLUMNS} defaultColumnState={DEFAULTS} ref={manager} />\n </>\n );\n}\n",
|
|
513
|
+
"verdict": "example"
|
|
514
|
+
},
|
|
515
|
+
{
|
|
516
|
+
"id": "count",
|
|
517
|
+
"title": "count.tsx",
|
|
518
|
+
"note": null,
|
|
519
|
+
"language": "tsx",
|
|
520
|
+
"source": "import type { GridColumn } from '@slotted/core/grid';\nimport { ColumnManager, ColumnManagerTrigger } from '@slotted/react/column-manager';\nimport type { ColumnManagerHandle } from '@slotted/react/column-manager';\nimport { Inline } from '@slotted/react/inline';\nimport { useRef } from 'react';\n\nconst COLUMNS: GridColumn[] = [\n { id: 'number', label: 'Order', hideable: false },\n { id: 'customer', label: 'Customer' },\n {\n id: 'status',\n label: 'Status',\n description: 'Fulfilment stage, updated when the ship date is confirmed',\n },\n {\n id: 'total',\n label: 'Total',\n kind: 'number',\n description: 'Order value with tax, in the order currency',\n },\n { id: 'due', label: 'Due date', description: 'The date promised to the customer' },\n { id: 'owner', label: 'Owner' },\n { id: 'notes', label: 'Notes' },\n { id: 'actions', label: 'Actions', kind: 'actions', reorderable: false },\n];\n\nconst ORDERS = { hidden: [] };\nconst SHIPMENTS = { hidden: ['notes'] };\nconst INVOICES = { hidden: ['customer', 'status', 'owner', 'notes'] };\n\nexport default function ColumnManagerCountExample() {\n const orders = useRef<ColumnManagerHandle>(null);\n const shipments = useRef<ColumnManagerHandle>(null);\n const invoices = useRef<ColumnManagerHandle>(null);\n\n return (\n <>\n <Inline gap={3}>\n <ColumnManagerTrigger manager={orders}>Orders</ColumnManagerTrigger>\n <ColumnManagerTrigger manager={shipments}>Shipments</ColumnManagerTrigger>\n <ColumnManagerTrigger manager={invoices}>Invoices</ColumnManagerTrigger>\n </Inline>\n\n <ColumnManager columns={COLUMNS} defaultColumnState={ORDERS} ref={orders} />\n <ColumnManager columns={COLUMNS} defaultColumnState={SHIPMENTS} ref={shipments} />\n <ColumnManager columns={COLUMNS} defaultColumnState={INVOICES} ref={invoices} />\n </>\n );\n}\n",
|
|
521
|
+
"verdict": "example"
|
|
522
|
+
},
|
|
523
|
+
{
|
|
524
|
+
"id": "data-grid",
|
|
525
|
+
"title": "data-grid.tsx",
|
|
526
|
+
"note": null,
|
|
527
|
+
"language": "tsx",
|
|
528
|
+
"source": "import type { GridColumn, GridColumnState, GridOutOfSpace } from '@slotted/core/grid';\nimport { normalizeColumnState } from '@slotted/core/grid';\nimport { ColumnManager, ColumnManagerTrigger } from '@slotted/react/column-manager';\nimport type { ColumnManagerHandle } from '@slotted/react/column-manager';\nimport { DataGrid } from '@slotted/react/data-grid';\nimport { Inline } from '@slotted/react/inline';\nimport { Stack } from '@slotted/react/stack';\nimport { useRef, useState } from 'react';\n\ninterface Order {\n id: string;\n number: string;\n customer: string;\n status: string;\n total: number;\n due: string;\n owner: string;\n}\n\nconst ROWS: Order[] = [\n {\n id: 'o1',\n number: 'SO-2026-01842',\n customer: 'Northwind Fabrication',\n status: 'Partial',\n total: 12480,\n due: '2026-09-24',\n owner: 'Marta Silva',\n },\n {\n id: 'o2',\n number: 'SO-2026-01843',\n customer: 'Helios Automation',\n status: 'Approval',\n total: 4120,\n due: '2026-09-26',\n owner: 'Daniel Okafor',\n },\n {\n id: 'o3',\n number: 'SO-2026-01844',\n customer: 'Pacific Rail Supply',\n status: 'Shipped',\n total: 31900,\n due: '2026-09-19',\n owner: 'Ana Ribeiro',\n },\n {\n id: 'o4',\n number: 'SO-2026-01845',\n customer: 'Tannery Row Leather',\n status: 'Draft',\n total: 860,\n due: '2026-10-02',\n owner: 'Marta Silva',\n },\n {\n id: 'o5',\n number: 'SO-2026-01846',\n customer: 'Lumen Optics',\n status: 'Delivered',\n total: 15230,\n due: '2026-09-12',\n owner: 'Kenji Mori',\n },\n];\n\nconst USD = new Intl.NumberFormat('en-US', { currency: 'USD', style: 'currency' });\n\nconst COLUMNS: GridColumn<Order>[] = [\n {\n id: 'number',\n label: 'Order',\n accessor: 'number',\n hideable: false,\n rowHeader: true,\n width: 140,\n },\n { id: 'customer', label: 'Customer', accessor: 'customer', width: 190 },\n { id: 'status', label: 'Status', accessor: 'status', width: 110 },\n {\n id: 'total',\n label: 'Total',\n accessor: 'total',\n kind: 'number',\n width: 110,\n format: (value) => (typeof value === 'number' ? USD.format(value) : ''),\n },\n { id: 'due', label: 'Due date', accessor: 'due', width: 120 },\n { id: 'owner', label: 'Owner', accessor: 'owner', width: 140 },\n];\n\nconst NO_ROOM_LOST: GridOutOfSpace = { popin: [], hidden: [] };\n\nexport default function ColumnManagerDataGridExample() {\n const manager = useRef<ColumnManagerHandle>(null);\n const [state, setState] = useState(() => normalizeColumnState({}, COLUMNS));\n const [outOfSpace, setOutOfSpace] = useState(NO_ROOM_LOST);\n\n function handleChange(next: GridColumnState) {\n setState(next);\n }\n\n function handleManage() {\n manager.current?.show();\n }\n\n return (\n <Stack gap={4}>\n <Inline>\n <ColumnManagerTrigger manager={manager}>Columns</ColumnManagerTrigger>\n </Inline>\n\n <DataGrid\n aria-label=\"Orders\"\n columnState={state}\n columns={COLUMNS}\n height=\"16rem\"\n onColumnStateChange={handleChange}\n onManageColumns={handleManage}\n onOutOfSpaceChange={setOutOfSpace}\n rowKey=\"id\"\n rows={ROWS}\n />\n\n <ColumnManager\n columnState={state}\n columns={COLUMNS}\n onColumnStateChange={handleChange}\n outOfSpace={outOfSpace}\n ref={manager}\n />\n </Stack>\n );\n}\n",
|
|
529
|
+
"verdict": "example"
|
|
530
|
+
},
|
|
531
|
+
{
|
|
532
|
+
"id": "defaults",
|
|
533
|
+
"title": "defaults.tsx",
|
|
534
|
+
"note": null,
|
|
535
|
+
"language": "tsx",
|
|
536
|
+
"source": "import type { GridColumn } from '@slotted/core/grid';\nimport {\n ColumnManager,\n ColumnManagerProvider,\n ColumnManagerTrigger,\n} from '@slotted/react/column-manager';\nimport type { ColumnManagerHandle } from '@slotted/react/column-manager';\nimport { Inline } from '@slotted/react/inline';\nimport { useRef } from 'react';\n\nconst COLUMNS: GridColumn[] = [\n { id: 'number', label: 'Order', hideable: false },\n { id: 'customer', label: 'Customer' },\n {\n id: 'status',\n label: 'Status',\n description: 'Fulfilment stage, updated when the ship date is confirmed',\n },\n {\n id: 'total',\n label: 'Total',\n kind: 'number',\n description: 'Order value with tax, in the order currency',\n },\n { id: 'due', label: 'Due date', description: 'The date promised to the customer' },\n { id: 'owner', label: 'Owner' },\n { id: 'notes', label: 'Notes' },\n { id: 'actions', label: 'Actions', kind: 'actions', reorderable: false },\n];\n\nexport default function ColumnManagerDefaultsExample() {\n const orders = useRef<ColumnManagerHandle>(null);\n const shipments = useRef<ColumnManagerHandle>(null);\n\n return (\n <ColumnManagerProvider apply=\"confirm\" presentation=\"drawer\">\n <Inline gap={3}>\n <ColumnManagerTrigger manager={orders}>Orders</ColumnManagerTrigger>\n <ColumnManagerTrigger manager={shipments}>Shipments</ColumnManagerTrigger>\n </Inline>\n\n <ColumnManager columns={COLUMNS} ref={orders} />\n <ColumnManager columns={COLUMNS} presentation=\"popover\" ref={shipments} />\n </ColumnManagerProvider>\n );\n}\n",
|
|
537
|
+
"verdict": "example"
|
|
538
|
+
},
|
|
539
|
+
{
|
|
540
|
+
"id": "required",
|
|
541
|
+
"title": "required.tsx",
|
|
542
|
+
"note": null,
|
|
543
|
+
"language": "tsx",
|
|
544
|
+
"source": "import type { GridColumn } from '@slotted/core/grid';\nimport { ColumnManager } from '@slotted/react/column-manager';\n\nconst COLUMNS: GridColumn[] = [\n { id: 'number', label: 'Order', hideable: false },\n { id: 'customer', label: 'Customer' },\n { id: 'status', label: 'Status' },\n { id: 'total', label: 'Total', kind: 'number' },\n { id: 'due', label: 'Due date' },\n];\n\nconst START = { hidden: ['status', 'total', 'due'] };\n\nexport default function ColumnManagerRequiredExample() {\n return <ColumnManager columns={COLUMNS} defaultColumnState={START} presentation=\"inline\" />;\n}\n",
|
|
545
|
+
"verdict": "example"
|
|
546
|
+
},
|
|
547
|
+
{
|
|
548
|
+
"id": "restore",
|
|
549
|
+
"title": "restore.tsx",
|
|
550
|
+
"note": null,
|
|
551
|
+
"language": "tsx",
|
|
552
|
+
"source": "import type { GridColumn, GridColumnState } from '@slotted/core/grid';\nimport { normalizeColumnState } from '@slotted/core/grid';\nimport { ColumnManager } from '@slotted/react/column-manager';\nimport type { ColumnManagerRequest } from '@slotted/react/column-manager';\nimport { Stack } from '@slotted/react/stack';\nimport { Text } from '@slotted/react/typography';\nimport { useState } from 'react';\n\nconst COLUMNS: GridColumn[] = [\n { id: 'number', label: 'Order', hideable: false },\n { id: 'customer', label: 'Customer' },\n {\n id: 'status',\n label: 'Status',\n description: 'Fulfilment stage, updated when the ship date is confirmed',\n },\n {\n id: 'total',\n label: 'Total',\n kind: 'number',\n description: 'Order value with tax, in the order currency',\n },\n { id: 'due', label: 'Due date', description: 'The date promised to the customer' },\n { id: 'owner', label: 'Owner' },\n { id: 'notes', label: 'Notes' },\n { id: 'actions', label: 'Actions', kind: 'actions', reorderable: false },\n];\n\nconst DEFAULTS = { hidden: ['notes'], pinned: { start: ['number'], end: ['actions'] } };\nconst START = { ...DEFAULTS, hidden: ['notes', 'owner', 'due', 'total'] };\n\nexport default function ColumnManagerRestoreExample() {\n const [state, setState] = useState(() => normalizeColumnState(START, COLUMNS));\n const [last, setLast] = useState('No request yet.');\n\n function handleChange(next: GridColumnState, request: ColumnManagerRequest) {\n setState(next);\n setLast(`change: ${request.change}, reason: ${request.reason}`);\n }\n\n return (\n <Stack gap={4}>\n <ColumnManager\n columnState={state}\n columns={COLUMNS}\n defaultColumnState={DEFAULTS}\n onColumnStateChange={handleChange}\n presentation=\"inline\"\n />\n <Text size=\"sm\" tone=\"muted\">\n {last}\n </Text>\n </Stack>\n );\n}\n",
|
|
553
|
+
"verdict": "example"
|
|
554
|
+
},
|
|
555
|
+
{
|
|
556
|
+
"id": "space",
|
|
557
|
+
"title": "space.tsx",
|
|
558
|
+
"note": null,
|
|
559
|
+
"language": "tsx",
|
|
560
|
+
"source": "import type { GridColumn, GridOutOfSpace } from '@slotted/core/grid';\nimport { ColumnManager } from '@slotted/react/column-manager';\n\nconst COLUMNS: GridColumn[] = [\n { id: 'number', label: 'Order', hideable: false },\n { id: 'customer', label: 'Customer' },\n {\n id: 'status',\n label: 'Status',\n description: 'Fulfilment stage, updated when the ship date is confirmed',\n },\n {\n id: 'total',\n label: 'Total',\n kind: 'number',\n description: 'Order value with tax, in the order currency',\n },\n { id: 'due', label: 'Due date', description: 'The date promised to the customer' },\n { id: 'owner', label: 'Owner' },\n { id: 'notes', label: 'Notes' },\n { id: 'actions', label: 'Actions', kind: 'actions', reorderable: false },\n];\n\nconst OUT_OF_SPACE: GridOutOfSpace = { popin: ['owner'], hidden: ['notes'] };\n\nexport default function ColumnManagerSpaceExample() {\n return <ColumnManager columns={COLUMNS} outOfSpace={OUT_OF_SPACE} presentation=\"inline\" />;\n}\n",
|
|
561
|
+
"verdict": "example"
|
|
506
562
|
}
|
|
507
563
|
]
|
|
508
564
|
}
|
|
@@ -11,18 +11,50 @@ import { ColumnManager, ColumnManagerTrigger, ColumnManagerRoot, ColumnManagerPr
|
|
|
11
11
|
|
|
12
12
|
## Minimal example
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
Example
|
|
15
15
|
|
|
16
16
|
```tsx
|
|
17
|
-
|
|
17
|
+
import type { GridColumn } from '@slotted/core/grid';
|
|
18
|
+
import { ColumnManager, ColumnManagerTrigger } from '@slotted/react/column-manager';
|
|
19
|
+
import type { ColumnManagerHandle } from '@slotted/react/column-manager';
|
|
20
|
+
import { Inline } from '@slotted/react/inline';
|
|
21
|
+
import { useRef } from 'react';
|
|
22
|
+
|
|
23
|
+
const COLUMNS: GridColumn[] = [
|
|
24
|
+
{ id: 'number', label: 'Order', hideable: false },
|
|
25
|
+
{ id: 'customer', label: 'Customer' },
|
|
26
|
+
{
|
|
27
|
+
id: 'status',
|
|
28
|
+
label: 'Status',
|
|
29
|
+
description: 'Fulfilment stage, updated when the ship date is confirmed',
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
id: 'total',
|
|
33
|
+
label: 'Total',
|
|
34
|
+
kind: 'number',
|
|
35
|
+
description: 'Order value with tax, in the order currency',
|
|
36
|
+
},
|
|
37
|
+
{ id: 'due', label: 'Due date', description: 'The date promised to the customer' },
|
|
38
|
+
{ id: 'owner', label: 'Owner' },
|
|
39
|
+
{ id: 'notes', label: 'Notes' },
|
|
40
|
+
{ id: 'actions', label: 'Actions', kind: 'actions', reorderable: false },
|
|
41
|
+
];
|
|
42
|
+
|
|
43
|
+
const DEFAULTS = { hidden: ['notes'], pinned: { start: ['number'], end: ['actions'] } };
|
|
18
44
|
|
|
19
|
-
|
|
20
|
-
<
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
45
|
+
export default function ColumnManagerBasicExample() {
|
|
46
|
+
const manager = useRef<ColumnManagerHandle>(null);
|
|
47
|
+
|
|
48
|
+
return (
|
|
49
|
+
<>
|
|
50
|
+
<Inline>
|
|
51
|
+
<ColumnManagerTrigger manager={manager}>Columns</ColumnManagerTrigger>
|
|
52
|
+
</Inline>
|
|
53
|
+
|
|
54
|
+
<ColumnManager columns={COLUMNS} defaultColumnState={DEFAULTS} ref={manager} />
|
|
55
|
+
</>
|
|
56
|
+
);
|
|
57
|
+
}
|
|
26
58
|
```
|
|
27
59
|
|
|
28
60
|
## Anatomy
|
|
@@ -79,7 +111,7 @@ const manager = useRef<ColumnManagerHandle>(null);
|
|
|
79
111
|
| --- | --- | --- |
|
|
80
112
|
| `onColumnStateChange` | `(state: GridColumnState, request: ChangeRequest<GridColumnState> & { change, changes })` | Before the state moves: a box (pointer, keyboard), a move (pointer, keyboard), a pin, Show all, Restore defaults (clear), or Apply under confirm (submit). change is changes[0]; changes lists every key that differs. cancel() refuses it. |
|
|
81
113
|
| `onOpenChange` | `(open: boolean, request: ChangeRequest<boolean>)` | Before the layer opens or closes: the trigger (pointer, keyboard), Escape, a press outside, the back gesture in a drawer, Apply and Cancel, or the handle (programmatic). |
|
|
82
|
-
| `onClick on ColumnManagerTrigger` | `the element’s own event` | Runs before
|
|
114
|
+
| `onClick on ColumnManagerTrigger` | `the element’s own event` | Runs before ColumnManagerTrigger toggles the layer; preventDefault() keeps it closed. |
|
|
83
115
|
|
|
84
116
|
## Axes and defaults
|
|
85
117
|
|
|
@@ -94,7 +126,7 @@ const manager = useRef<ColumnManagerHandle>(null);
|
|
|
94
126
|
- The root is a group named by its heading and each zone a group named by its label, so a reader hears Pinned to start before the columns in it. A checkbox is named by the column and its status — “Order Required”, “Region Hidden for space” — and described by the column’s description through the checkbox’s own aria-describedby.
|
|
95
127
|
- Alt+ArrowUp/Down on a grip is the rearrangeable listbox’s move: the column moves one place within its zone, focus stays on the grip, and the live announcer says “Customer moved to position 3”. A pointer drag runs through @slotted/core/drag, whose Escape cancels the drag before the layer sees it.
|
|
96
128
|
- The trigger says aria-haspopup="dialog", aria-expanded and aria-controls; its count is aria-hidden and a visually hidden sentence carries it, so the name is “Columns 3 hidden columns” and the number is never read as a bare digit.
|
|
97
|
-
- A disabled grip keeps its focus stop with aria-disabled, so a reader finds out why it does not move; disabled boxes are the
|
|
129
|
+
- A disabled grip keeps its focus stop with aria-disabled, so a reader finds out why it does not move; disabled boxes are the Checkbox’s native disabled.
|
|
98
130
|
|
|
99
131
|
## Tokens
|
|
100
132
|
|
|
@@ -102,195 +134,4 @@ const manager = useRef<ColumnManagerHandle>(null);
|
|
|
102
134
|
|
|
103
135
|
## Examples
|
|
104
136
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
The default presentation: a popover anchored on the trigger, 22rem wide, the search focused on open. Escape and a press outside close it and focus returns to the trigger.
|
|
108
|
-
|
|
109
|
-
Excerpt — not a complete module
|
|
110
|
-
|
|
111
|
-
```tsx
|
|
112
|
-
<ColumnManager columns={columns} presentation="popover" ref={manager} />;
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
### In a drawer at the end
|
|
116
|
-
|
|
117
|
-
The same panel as the drawer family at side end, size sm, for a grid with many columns: the list takes the drawer’s height and is not capped.
|
|
118
|
-
|
|
119
|
-
Excerpt — not a complete module
|
|
120
|
-
|
|
121
|
-
```tsx
|
|
122
|
-
<ColumnManager columns={columns} presentation="drawer" ref={manager} />;
|
|
123
|
-
```
|
|
124
|
-
|
|
125
|
-
### Apply once
|
|
126
|
-
|
|
127
|
-
Under apply="confirm" every action edits a draft: hide two columns and move one, and the log stays empty until Apply asks once with the reason submit and every key that moved. Cancel discards the draft.
|
|
128
|
-
|
|
129
|
-
Excerpt — not a complete module
|
|
130
|
-
|
|
131
|
-
```tsx
|
|
132
|
-
<ColumnManager
|
|
133
|
-
apply="confirm"
|
|
134
|
-
columnState={state}
|
|
135
|
-
columns={columns}
|
|
136
|
-
onColumnStateChange={(next, request) => {
|
|
137
|
-
// request.reason === 'submit', request.changes === ['order', 'hidden']
|
|
138
|
-
setState(next);
|
|
139
|
-
}}
|
|
140
|
-
/>;
|
|
141
|
-
```
|
|
142
|
-
|
|
143
|
-
### Search by name and description
|
|
144
|
-
|
|
145
|
-
Type “date”: Due date matches by its name and Status by its description. “regiao” finds Região — case and accents fall away. While a query stands every grip is disabled, because a place in a subset is not a place in the list.
|
|
146
|
-
|
|
147
|
-
Excerpt — not a complete module
|
|
148
|
-
|
|
149
|
-
```tsx
|
|
150
|
-
const columns: GridColumn<Order>[] = [
|
|
151
|
-
{
|
|
152
|
-
id: 'status',
|
|
153
|
-
label: 'Status',
|
|
154
|
-
description: 'Fulfilment stage, updated when the ship date is set',
|
|
155
|
-
},
|
|
156
|
-
{ id: 'due', label: 'Due date', description: 'The date promised to the customer' },
|
|
157
|
-
];
|
|
158
|
-
```
|
|
159
|
-
|
|
160
|
-
### Required, and the last shown column
|
|
161
|
-
|
|
162
|
-
Order is hideable: false — ticked, disabled and marked Required. With every other column hidden, the last shown one is disabled too: the manager never asks for a grid with no column.
|
|
163
|
-
|
|
164
|
-
Excerpt — not a complete module
|
|
165
|
-
|
|
166
|
-
```tsx
|
|
167
|
-
const columns = [{ id: 'number', label: 'Order', hideable: false }, ...rest];
|
|
168
|
-
```
|
|
169
|
-
|
|
170
|
-
### Hidden for space, shown in row
|
|
171
|
-
|
|
172
|
-
The grid moved Owner into its rows’ pop-in and hid Região for room. Their boxes keep the reader’s value and their status says where they are; the sets never enter the state.
|
|
173
|
-
|
|
174
|
-
Excerpt — not a complete module
|
|
175
|
-
|
|
176
|
-
```tsx
|
|
177
|
-
<DataGrid columns={columns} onOutOfSpaceChange={setOutOfSpace} rows={orders} />;
|
|
178
|
-
<ColumnManager columns={columns} outOfSpace={outOfSpace} />;
|
|
179
|
-
```
|
|
180
|
-
|
|
181
|
-
### Reorder by pointer and by keyboard
|
|
182
|
-
|
|
183
|
-
Drag a grip: the row dims and a line marks where it lands, inside its zone only. Or focus a grip and press Alt+ArrowDown: the column moves one place, “Customer moved to position 3” is announced, and focus stays on the grip.
|
|
184
|
-
|
|
185
|
-
Excerpt — not a complete module
|
|
186
|
-
|
|
187
|
-
```tsx
|
|
188
|
-
<ColumnManager
|
|
189
|
-
columnState={state}
|
|
190
|
-
columns={columns}
|
|
191
|
-
onColumnStateChange={(next, request) => {
|
|
192
|
-
if (request.change === 'order') saveOrder(next.order);
|
|
193
|
-
setState(next);
|
|
194
|
-
}}
|
|
195
|
-
/>;
|
|
196
|
-
```
|
|
197
|
-
|
|
198
|
-
### Pinning
|
|
199
|
-
|
|
200
|
-
Order is pinned to the start and Actions to the end, each in its section. Open a row’s pin to move it between zones; a pinned column’s pin is in the accent ink, and a move never crosses a zone.
|
|
201
|
-
|
|
202
|
-
Excerpt — not a complete module
|
|
203
|
-
|
|
204
|
-
```tsx
|
|
205
|
-
<ColumnManager
|
|
206
|
-
columns={columns}
|
|
207
|
-
defaultColumnState={{ pinned: { start: ['number'], end: ['actions'] } }}
|
|
208
|
-
/>;
|
|
209
|
-
```
|
|
210
|
-
|
|
211
|
-
### Show all and Restore defaults
|
|
212
|
-
|
|
213
|
-
Four columns hidden against a default of one. Show all asks for none hidden; Restore defaults asks for defaultColumnState with the reason clear. Each is disabled while it would change nothing.
|
|
214
|
-
|
|
215
|
-
Excerpt — not a complete module
|
|
216
|
-
|
|
217
|
-
```tsx
|
|
218
|
-
<ColumnManager
|
|
219
|
-
columnState={state}
|
|
220
|
-
columns={columns}
|
|
221
|
-
defaultColumnState={defaults}
|
|
222
|
-
onColumnStateChange={(next, request) => {
|
|
223
|
-
if (request.reason === 'clear') toast('Columns restored');
|
|
224
|
-
setState(next);
|
|
225
|
-
}}
|
|
226
|
-
/>;
|
|
227
|
-
```
|
|
228
|
-
|
|
229
|
-
### The count on the trigger
|
|
230
|
-
|
|
231
|
-
No count at zero, a chip at one and at twelve. The chip is aria-hidden and a visually hidden sentence names the trigger — “Columns 12 hidden columns” — so the number is heard once, as words.
|
|
232
|
-
|
|
233
|
-
Excerpt — not a complete module
|
|
234
|
-
|
|
235
|
-
```tsx
|
|
236
|
-
<ColumnManagerTrigger
|
|
237
|
-
manager={manager}
|
|
238
|
-
render={({ children, ...props }) => (
|
|
239
|
-
<Button {...props} size="sm" variant="ghost">
|
|
240
|
-
{children}
|
|
241
|
-
</Button>
|
|
242
|
-
)}
|
|
243
|
-
>
|
|
244
|
-
Columns
|
|
245
|
-
</ColumnManagerTrigger>;
|
|
246
|
-
```
|
|
247
|
-
|
|
248
|
-
### With the data grid
|
|
249
|
-
|
|
250
|
-
The grid and the manager share one column state. Manage columns… in any column menu opens the manager the toolbar trigger opens; narrow the room and the grid’s outOfSpace reaches the list as Shown in row and Hidden for space.
|
|
251
|
-
|
|
252
|
-
Excerpt — not a complete module
|
|
253
|
-
|
|
254
|
-
```tsx
|
|
255
|
-
<>
|
|
256
|
-
<ColumnManagerTrigger manager={manager}>Columns</ColumnManagerTrigger>
|
|
257
|
-
<DataGrid
|
|
258
|
-
columnState={state}
|
|
259
|
-
columns={columns}
|
|
260
|
-
onColumnStateChange={(next) => setState(next)}
|
|
261
|
-
onManageColumns={() => manager.current?.show()}
|
|
262
|
-
onOutOfSpaceChange={setOutOfSpace}
|
|
263
|
-
rowKey="id"
|
|
264
|
-
rows={orders}
|
|
265
|
-
/>
|
|
266
|
-
<ColumnManager
|
|
267
|
-
columnState={state}
|
|
268
|
-
columns={columns}
|
|
269
|
-
onColumnStateChange={(next) => setState(next)}
|
|
270
|
-
outOfSpace={outOfSpace}
|
|
271
|
-
ref={manager}
|
|
272
|
-
/>
|
|
273
|
-
</>;
|
|
274
|
-
```
|
|
275
|
-
|
|
276
|
-
### Keyboard
|
|
277
|
-
|
|
278
|
-
Tab walks the search, then each row’s checkbox, grip and pin, then the footer. Space toggles a box; Alt+ArrowUp/Down on a grip moves the column; Enter on a pin opens its menu; Escape during a drag cancels it.
|
|
279
|
-
|
|
280
|
-
Excerpt — not a complete module
|
|
281
|
-
|
|
282
|
-
```tsx
|
|
283
|
-
<ColumnManager columns={columns} presentation="inline" />;
|
|
284
|
-
```
|
|
285
|
-
|
|
286
|
-
### Names, descriptions and announcements
|
|
287
|
-
|
|
288
|
-
The panel is a group named Columns and each zone a group named by its label. A box is named by the column and its status and described by its description; a keyboard move is announced politely with the new position.
|
|
289
|
-
|
|
290
|
-
Excerpt — not a complete module
|
|
291
|
-
|
|
292
|
-
```tsx
|
|
293
|
-
<SlottedProvider catalogs={{ 'pt-BR': PT_BR }} locale="pt-BR">
|
|
294
|
-
<App />
|
|
295
|
-
</SlottedProvider>;
|
|
296
|
-
```
|
|
137
|
+
See [column-manager.examples.md](./column-manager.examples.md).
|