@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
|
@@ -0,0 +1,631 @@
|
|
|
1
|
+
<!-- index: ./index.md -->
|
|
2
|
+
# transfer
|
|
3
|
+
|
|
4
|
+
`data-ui="transfer"` · Moves items between two lists.
|
|
5
|
+
|
|
6
|
+
## Examples
|
|
7
|
+
|
|
8
|
+
### Playground
|
|
9
|
+
|
|
10
|
+
Twelve people and a project team of three. Change size, layout, search, select-all and order in the controls below; every request is written under the transfer.
|
|
11
|
+
|
|
12
|
+
Excerpt — not a complete module
|
|
13
|
+
|
|
14
|
+
```tsx
|
|
15
|
+
const [team, setTeam] = useState<readonly string[]>(['ana', 'kenji', 'marta']);
|
|
16
|
+
|
|
17
|
+
<Transfer
|
|
18
|
+
aria-label="Project team"
|
|
19
|
+
items={people}
|
|
20
|
+
onTargetKeysChange={(keys) => setTeam(keys)}
|
|
21
|
+
targetKeys={team}
|
|
22
|
+
/>;
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### Selecting, then moving
|
|
26
|
+
|
|
27
|
+
Click, Shift+click and Control+A select inside a pane; the box in the header selects every visible enabled item and goes half-filled when some are. Add moves the selection and clears it.
|
|
28
|
+
|
|
29
|
+
Excerpt — not a complete module
|
|
30
|
+
|
|
31
|
+
```tsx
|
|
32
|
+
<Transfer
|
|
33
|
+
items={people}
|
|
34
|
+
onSelectedKeysChange={(keys, request) => setSelected(keys)}
|
|
35
|
+
selectedKeys={selected}
|
|
36
|
+
/>;
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Searching a pane
|
|
40
|
+
|
|
41
|
+
Type fabian or design: the label and the description are searched in the locale, accents apart. The count says 1 of 12 shown, Add all moves only what is shown, and nothing matching says so over a search mark.
|
|
42
|
+
|
|
43
|
+
Example
|
|
44
|
+
|
|
45
|
+
```tsx
|
|
46
|
+
import { Transfer } from '@slotted/react/transfer';
|
|
47
|
+
import type { TransferItem } from '@slotted/react/transfer';
|
|
48
|
+
|
|
49
|
+
const PRODUCTS: TransferItem[] = [
|
|
50
|
+
{ key: 'cast-iron', label: 'Cast iron skillet', description: 'Cookware' },
|
|
51
|
+
{ key: 'canvas-tote', label: 'Canvas tote bag', description: 'Bags' },
|
|
52
|
+
{ key: 'candle-set', label: 'Candle set', description: 'Home fragrance' },
|
|
53
|
+
{ key: 'ceramic-mug', label: 'Ceramic mug', description: 'Tableware' },
|
|
54
|
+
{ key: 'cutting-board', label: 'Walnut cutting board', description: 'Kitchen' },
|
|
55
|
+
{ key: 'carbon-pan', label: 'Carbon steel pan', description: 'Cookware' },
|
|
56
|
+
{ key: 'linen-apron', label: 'Linen apron', description: 'Textiles' },
|
|
57
|
+
{ key: 'enamel-pot', label: 'Enamel stock pot', description: 'Cookware' },
|
|
58
|
+
{ key: 'cotton-napkins', label: 'Cotton napkins', description: 'Textiles' },
|
|
59
|
+
];
|
|
60
|
+
|
|
61
|
+
/** A word of the label starts with the query. */
|
|
62
|
+
const startsAWord = (item: TransferItem, query: string) =>
|
|
63
|
+
item.label
|
|
64
|
+
.toLowerCase()
|
|
65
|
+
.split(' ')
|
|
66
|
+
.some((word) => word.startsWith(query.trim().toLowerCase()));
|
|
67
|
+
|
|
68
|
+
export default function TransferSearch() {
|
|
69
|
+
return (
|
|
70
|
+
<Transfer
|
|
71
|
+
aria-label="Products in the spring sale"
|
|
72
|
+
defaultSourceQuery="ca"
|
|
73
|
+
defaultTargetKeys={['linen-apron']}
|
|
74
|
+
filter={startsAWord}
|
|
75
|
+
items={PRODUCTS}
|
|
76
|
+
/>
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### An order the reader decides
|
|
82
|
+
|
|
83
|
+
Under reorderable the target keeps the order of targetKeys: a move joins the end, Up and Down move the selection one place, and Alt+ArrowUp/Down does the same from the list. Without it the target follows the collection.
|
|
84
|
+
|
|
85
|
+
Excerpt — not a complete module
|
|
86
|
+
|
|
87
|
+
```tsx
|
|
88
|
+
<Transfer items={widgets} messages={{ target: 'On the dashboard' }} reorderable />;
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### Dragging between the panes
|
|
92
|
+
|
|
93
|
+
Drag a person across: a selected person carries the pane’s selection with them. In a reorderable target a line shows where the drop lands; a drop inside the source is refused, and Escape cancels.
|
|
94
|
+
|
|
95
|
+
Excerpt — not a complete module
|
|
96
|
+
|
|
97
|
+
```tsx
|
|
98
|
+
<Transfer items={people} reorderable />;
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### One pane at a time
|
|
102
|
+
|
|
103
|
+
Below 36rem of its own width the transfer becomes two steps: the switch names the pane, Add and Add all stand under the source and Remove over the target. layout="steps" fixes it at any width.
|
|
104
|
+
|
|
105
|
+
Excerpt — not a complete module
|
|
106
|
+
|
|
107
|
+
```tsx
|
|
108
|
+
<Transfer items={people} layout="steps" onPaneChange={(pane) => setPane(pane)} pane={pane} />;
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### Disabled, read-only, invalid and required
|
|
112
|
+
|
|
113
|
+
Disabled greys both panes and stops every control. Read-only keeps the lists reachable and selectable and refuses every move. Invalid draws the danger edge on both panes; required is carried to both lists.
|
|
114
|
+
|
|
115
|
+
Example
|
|
116
|
+
|
|
117
|
+
```tsx
|
|
118
|
+
import { Stack } from '@slotted/react/stack';
|
|
119
|
+
import { Transfer } from '@slotted/react/transfer';
|
|
120
|
+
import type { TransferItem } from '@slotted/react/transfer';
|
|
121
|
+
|
|
122
|
+
const SUPPLIERS: TransferItem[] = [
|
|
123
|
+
{ key: 'acme', label: 'Acme Packaging', description: 'Net 30' },
|
|
124
|
+
{ key: 'harbor', label: 'Harbor Freight Lines', description: 'Net 45' },
|
|
125
|
+
{ key: 'summit', label: 'Summit Paper Co.', description: 'Net 30' },
|
|
126
|
+
{ key: 'pacific', label: 'Pacific Labels', description: 'Net 15' },
|
|
127
|
+
];
|
|
128
|
+
|
|
129
|
+
export default function TransferStates() {
|
|
130
|
+
return (
|
|
131
|
+
<Stack gap={6}>
|
|
132
|
+
<Transfer
|
|
133
|
+
aria-label="Approved suppliers, disabled"
|
|
134
|
+
defaultTargetKeys={['acme']}
|
|
135
|
+
disabled
|
|
136
|
+
items={SUPPLIERS}
|
|
137
|
+
rows={3}
|
|
138
|
+
/>
|
|
139
|
+
<Transfer
|
|
140
|
+
aria-label="Approved suppliers, read-only"
|
|
141
|
+
defaultTargetKeys={['harbor']}
|
|
142
|
+
items={SUPPLIERS}
|
|
143
|
+
readOnly
|
|
144
|
+
rows={3}
|
|
145
|
+
/>
|
|
146
|
+
<Transfer
|
|
147
|
+
aria-label="Approved suppliers, invalid"
|
|
148
|
+
invalid
|
|
149
|
+
items={SUPPLIERS}
|
|
150
|
+
required
|
|
151
|
+
rows={3}
|
|
152
|
+
/>
|
|
153
|
+
</Stack>
|
|
154
|
+
);
|
|
155
|
+
}
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
### Two thousand items
|
|
159
|
+
|
|
160
|
+
virtual with an itemSize windows both lists, so a directory of two thousand people scrolls without drawing them all. Typeahead, Shift+click and the moves work across the whole set.
|
|
161
|
+
|
|
162
|
+
Excerpt — not a complete module
|
|
163
|
+
|
|
164
|
+
```tsx
|
|
165
|
+
<Transfer itemSize={34} items={directory} virtual />;
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
### A source that arrives in pages
|
|
169
|
+
|
|
170
|
+
loading marks the source busy; hasMore draws the loading row at its end and onLoadMore asks for the next page when the reader reaches it.
|
|
171
|
+
|
|
172
|
+
Example
|
|
173
|
+
|
|
174
|
+
```tsx
|
|
175
|
+
import { useState } from 'react';
|
|
176
|
+
import { Transfer } from '@slotted/react/transfer';
|
|
177
|
+
import type { TransferItem } from '@slotted/react/transfer';
|
|
178
|
+
|
|
179
|
+
const CUSTOMERS = ['Ridgeline Outfitters', 'Harbor & Pine', 'Meridian Home', 'Copper Kettle Co.'];
|
|
180
|
+
const PAGE_SIZE = 10;
|
|
181
|
+
const TOTAL = 40;
|
|
182
|
+
|
|
183
|
+
const orderAt = (index: number): TransferItem => ({
|
|
184
|
+
key: `ORD-${1001 + index}`,
|
|
185
|
+
label: `Order ${1001 + index}`,
|
|
186
|
+
description: CUSTOMERS[index % CUSTOMERS.length] ?? '',
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
/** Stands in for the request that reads the next page of orders. */
|
|
190
|
+
const fetchOrders = (from: number) =>
|
|
191
|
+
new Promise<TransferItem[]>((resolve) => {
|
|
192
|
+
setTimeout(() => resolve(Array.from({ length: PAGE_SIZE }, (_, i) => orderAt(from + i))), 1200);
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
export default function TransferLoading() {
|
|
196
|
+
const [orders, setOrders] = useState<TransferItem[]>(() =>
|
|
197
|
+
Array.from({ length: PAGE_SIZE }, (_, index) => orderAt(index)),
|
|
198
|
+
);
|
|
199
|
+
const [loading, setLoading] = useState(false);
|
|
200
|
+
|
|
201
|
+
const handleLoadMore = async () => {
|
|
202
|
+
if (loading) return;
|
|
203
|
+
setLoading(true);
|
|
204
|
+
const page = await fetchOrders(orders.length);
|
|
205
|
+
setOrders((current) => [...current, ...page]);
|
|
206
|
+
setLoading(false);
|
|
207
|
+
};
|
|
208
|
+
|
|
209
|
+
return (
|
|
210
|
+
<Transfer
|
|
211
|
+
aria-label="Orders to consolidate"
|
|
212
|
+
hasMore={orders.length < TOTAL}
|
|
213
|
+
items={orders}
|
|
214
|
+
loading={loading}
|
|
215
|
+
onLoadMore={handleLoadMore}
|
|
216
|
+
/>
|
|
217
|
+
);
|
|
218
|
+
}
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
### Content the transfer does not choose
|
|
222
|
+
|
|
223
|
+
A description under the name, an unbroken permission key, a translated title that wraps, and a chosen key the collection does not hold — drawn with the key itself, in the muted mono ink, never dropped.
|
|
224
|
+
|
|
225
|
+
Example
|
|
226
|
+
|
|
227
|
+
```tsx
|
|
228
|
+
import { ListboxLabel, ListboxMeta } from '@slotted/react/listbox';
|
|
229
|
+
import { Transfer } from '@slotted/react/transfer';
|
|
230
|
+
import type { TransferItem } from '@slotted/react/transfer';
|
|
231
|
+
import { Text } from '@slotted/react/typography';
|
|
232
|
+
|
|
233
|
+
interface Permission extends TransferItem {
|
|
234
|
+
scope: string;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
const PERMISSIONS: Permission[] = [
|
|
238
|
+
{ key: 'orders.view', label: 'View orders', scope: 'Orders' },
|
|
239
|
+
{ key: 'orders.refund', label: 'Refund orders', scope: 'Orders' },
|
|
240
|
+
{ key: 'orders.cancel', label: 'Cancel shipped orders', scope: 'Orders', disabled: true },
|
|
241
|
+
{ key: 'stock.adjust', label: 'Adjust stock counts', scope: 'Inventory' },
|
|
242
|
+
{ key: 'invoices.export', label: 'Export invoices', scope: 'Finance' },
|
|
243
|
+
{ key: 'payouts.approve', label: 'Approve supplier payouts', scope: 'Finance' },
|
|
244
|
+
];
|
|
245
|
+
|
|
246
|
+
export default function TransferContent() {
|
|
247
|
+
return (
|
|
248
|
+
<Transfer
|
|
249
|
+
aria-label="Permissions of the support role"
|
|
250
|
+
defaultTargetKeys={['orders.view', 'orders.refund', 'legacy.reports.export']}
|
|
251
|
+
items={PERMISSIONS}
|
|
252
|
+
renderFooter={(side) => (
|
|
253
|
+
<Text size="sm" tone="muted">
|
|
254
|
+
{side === 'source' ? 'Not granted to the role' : 'Granted to the role'}
|
|
255
|
+
</Text>
|
|
256
|
+
)}
|
|
257
|
+
renderItem={(permission) => (
|
|
258
|
+
<>
|
|
259
|
+
<ListboxLabel>{permission.label}</ListboxLabel>
|
|
260
|
+
<ListboxMeta>{permission.scope}</ListboxMeta>
|
|
261
|
+
</>
|
|
262
|
+
)}
|
|
263
|
+
/>
|
|
264
|
+
);
|
|
265
|
+
}
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
### In a form
|
|
269
|
+
|
|
270
|
+
Inside a Field the transfer takes the label, the description and the disabled state; name submits one hidden input per chosen key, so a bare form posts the set.
|
|
271
|
+
|
|
272
|
+
Excerpt — not a complete module
|
|
273
|
+
|
|
274
|
+
```tsx
|
|
275
|
+
<Field required>
|
|
276
|
+
<FieldLabel>Reviewers</FieldLabel>
|
|
277
|
+
<Transfer items={people} name="reviewers" />
|
|
278
|
+
<FieldDescription>At least one reviewer signs the release.</FieldDescription>
|
|
279
|
+
</Field>;
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
### Words for another product
|
|
283
|
+
|
|
284
|
+
Every word is a message: the titles, the four moves, the counts and the announcements. The language in force sets them once; an instance lays its own over them.
|
|
285
|
+
|
|
286
|
+
Excerpt — not a complete module
|
|
287
|
+
|
|
288
|
+
```tsx
|
|
289
|
+
<Transfer
|
|
290
|
+
items={permissions}
|
|
291
|
+
messages={{ target: 'Granted', moveToTarget: 'Grant', moveToSource: 'Revoke' }}
|
|
292
|
+
/>;
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
### Keyboard
|
|
296
|
+
|
|
297
|
+
In either list Enter moves the selection — or the option you are on — to the other side; Delete sends it back from the target; Control+ArrowRight and Control+ArrowLeft move toward that side, mirrored in right-to-left; Alt+ArrowUp/Down reorders. Space selects.
|
|
298
|
+
|
|
299
|
+
Excerpt — not a complete module
|
|
300
|
+
|
|
301
|
+
```tsx
|
|
302
|
+
<Transfer items={people} reorderable />;
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
### Names, shortcuts and announcements
|
|
306
|
+
|
|
307
|
+
Each pane is a group named by its title and each list a listbox named the same. The moves carry aria-keyshortcuts, and every move is announced politely: “2 moved to Chosen”.
|
|
308
|
+
|
|
309
|
+
Excerpt — not a complete module
|
|
310
|
+
|
|
311
|
+
```tsx
|
|
312
|
+
<Transfer items={people} messages={{ moved: '{count} added to {pane}' }} />;
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
### controlled.tsx
|
|
316
|
+
|
|
317
|
+
Example
|
|
318
|
+
|
|
319
|
+
```tsx
|
|
320
|
+
import { useState } from 'react';
|
|
321
|
+
import { Stack } from '@slotted/react/stack';
|
|
322
|
+
import { Transfer } from '@slotted/react/transfer';
|
|
323
|
+
import type { TransferItem } from '@slotted/react/transfer';
|
|
324
|
+
import { Text } from '@slotted/react/typography';
|
|
325
|
+
|
|
326
|
+
const PEOPLE: TransferItem[] = [
|
|
327
|
+
{ key: 'anna', label: 'Anna Stone', description: 'Warehouse operations' },
|
|
328
|
+
{ key: 'bruce', label: 'Bruce Lane', description: 'Finance' },
|
|
329
|
+
{ key: 'carla', label: 'Carla Day', description: 'Customer support' },
|
|
330
|
+
{ key: 'daniel', label: 'Daniel Okafor', description: 'Procurement' },
|
|
331
|
+
{ key: 'elise', label: 'Elise Pratt', description: 'Merchandising' },
|
|
332
|
+
{ key: 'fabian', label: 'Fabian Nash', description: 'Logistics' },
|
|
333
|
+
{ key: 'grace', label: 'Grace Park', description: 'Finance' },
|
|
334
|
+
{ key: 'hugh', label: 'Hugh Mason', description: 'Warehouse operations' },
|
|
335
|
+
];
|
|
336
|
+
|
|
337
|
+
export default function TransferControlled() {
|
|
338
|
+
const [recipients, setRecipients] = useState<readonly string[]>(['anna', 'bruce']);
|
|
339
|
+
const [selected, setSelected] = useState<readonly string[]>([]);
|
|
340
|
+
|
|
341
|
+
const names = PEOPLE.filter((person) => recipients.includes(person.key)).map(
|
|
342
|
+
(person) => person.label,
|
|
343
|
+
);
|
|
344
|
+
|
|
345
|
+
return (
|
|
346
|
+
<Stack gap={4}>
|
|
347
|
+
<Transfer
|
|
348
|
+
aria-label="Recipients of the stock report"
|
|
349
|
+
items={PEOPLE}
|
|
350
|
+
onSelectedKeysChange={setSelected}
|
|
351
|
+
onTargetKeysChange={setRecipients}
|
|
352
|
+
selectedKeys={selected}
|
|
353
|
+
targetKeys={recipients}
|
|
354
|
+
/>
|
|
355
|
+
<Text size="sm" tone="muted">
|
|
356
|
+
Recipients: {names.length > 0 ? names.join(', ') : 'nobody'}. {selected.length} selected.
|
|
357
|
+
</Text>
|
|
358
|
+
</Stack>
|
|
359
|
+
);
|
|
360
|
+
}
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
### form.tsx
|
|
364
|
+
|
|
365
|
+
Example
|
|
366
|
+
|
|
367
|
+
```tsx
|
|
368
|
+
import { useState } from 'react';
|
|
369
|
+
import type { SubmitEvent } from 'react';
|
|
370
|
+
import { Button } from '@slotted/react/button';
|
|
371
|
+
import { Inline } from '@slotted/react/inline';
|
|
372
|
+
import { Stack } from '@slotted/react/stack';
|
|
373
|
+
import { Transfer } from '@slotted/react/transfer';
|
|
374
|
+
import type { TransferItem } from '@slotted/react/transfer';
|
|
375
|
+
import { Text } from '@slotted/react/typography';
|
|
376
|
+
|
|
377
|
+
const APPROVERS: TransferItem[] = [
|
|
378
|
+
{ key: 'anna', label: 'Anna Stone', description: 'Warehouse operations' },
|
|
379
|
+
{ key: 'bruce', label: 'Bruce Lane', description: 'Finance' },
|
|
380
|
+
{ key: 'carla', label: 'Carla Day', description: 'Customer support' },
|
|
381
|
+
{ key: 'daniel', label: 'Daniel Okafor', description: 'Procurement' },
|
|
382
|
+
{ key: 'elise', label: 'Elise Pratt', description: 'Merchandising' },
|
|
383
|
+
{ key: 'fabian', label: 'Fabian Nash', description: 'Logistics' },
|
|
384
|
+
];
|
|
385
|
+
|
|
386
|
+
export default function TransferForm() {
|
|
387
|
+
const [posted, setPosted] = useState<string | null>(null);
|
|
388
|
+
|
|
389
|
+
const handleSubmit = (event: SubmitEvent<HTMLFormElement>) => {
|
|
390
|
+
event.preventDefault();
|
|
391
|
+
const keys = new FormData(event.currentTarget).getAll('approvers');
|
|
392
|
+
setPosted(keys.length > 0 ? keys.join(', ') : 'nothing');
|
|
393
|
+
};
|
|
394
|
+
|
|
395
|
+
return (
|
|
396
|
+
<form onSubmit={handleSubmit}>
|
|
397
|
+
<Stack gap={4}>
|
|
398
|
+
<Transfer
|
|
399
|
+
aria-label="Approvers of purchase orders"
|
|
400
|
+
defaultTargetKeys={['bruce']}
|
|
401
|
+
items={APPROVERS}
|
|
402
|
+
name="approvers"
|
|
403
|
+
/>
|
|
404
|
+
<Inline gap={3} align="center">
|
|
405
|
+
<Button type="submit">Save</Button>
|
|
406
|
+
{posted && (
|
|
407
|
+
<Text size="sm" tone="muted">
|
|
408
|
+
Posted {posted}
|
|
409
|
+
</Text>
|
|
410
|
+
)}
|
|
411
|
+
</Inline>
|
|
412
|
+
</Stack>
|
|
413
|
+
</form>
|
|
414
|
+
);
|
|
415
|
+
}
|
|
416
|
+
```
|
|
417
|
+
|
|
418
|
+
### layout.tsx
|
|
419
|
+
|
|
420
|
+
Example
|
|
421
|
+
|
|
422
|
+
```tsx
|
|
423
|
+
import { useState } from 'react';
|
|
424
|
+
import { Stack } from '@slotted/react/stack';
|
|
425
|
+
import { Transfer } from '@slotted/react/transfer';
|
|
426
|
+
import type { TransferItem, TransferSide } from '@slotted/react/transfer';
|
|
427
|
+
import { Text } from '@slotted/react/typography';
|
|
428
|
+
|
|
429
|
+
const WAREHOUSES: TransferItem[] = [
|
|
430
|
+
{ key: 'seattle', label: 'Seattle', description: 'Pacific Northwest' },
|
|
431
|
+
{ key: 'reno', label: 'Reno', description: 'Mountain West' },
|
|
432
|
+
{ key: 'dallas', label: 'Dallas', description: 'South Central' },
|
|
433
|
+
{ key: 'columbus', label: 'Columbus', description: 'Midwest' },
|
|
434
|
+
{ key: 'atlanta', label: 'Atlanta', description: 'Southeast' },
|
|
435
|
+
{ key: 'newark', label: 'Newark', description: 'Northeast' },
|
|
436
|
+
];
|
|
437
|
+
|
|
438
|
+
export default function TransferLayout() {
|
|
439
|
+
const [pane, setPane] = useState<TransferSide>('source');
|
|
440
|
+
|
|
441
|
+
return (
|
|
442
|
+
<Stack gap={6}>
|
|
443
|
+
<Transfer
|
|
444
|
+
aria-label="Warehouses in two columns"
|
|
445
|
+
defaultTargetKeys={['seattle']}
|
|
446
|
+
items={WAREHOUSES}
|
|
447
|
+
layout="columns"
|
|
448
|
+
rows={4}
|
|
449
|
+
/>
|
|
450
|
+
<Transfer
|
|
451
|
+
aria-label="Warehouses in two steps"
|
|
452
|
+
defaultTargetKeys={['seattle']}
|
|
453
|
+
items={WAREHOUSES}
|
|
454
|
+
layout="steps"
|
|
455
|
+
onPaneChange={setPane}
|
|
456
|
+
pane={pane}
|
|
457
|
+
rows={4}
|
|
458
|
+
/>
|
|
459
|
+
<Text size="sm" tone="muted">
|
|
460
|
+
Step shown: {pane === 'source' ? 'Available' : 'Chosen'}.
|
|
461
|
+
</Text>
|
|
462
|
+
</Stack>
|
|
463
|
+
);
|
|
464
|
+
}
|
|
465
|
+
```
|
|
466
|
+
|
|
467
|
+
### messages.tsx
|
|
468
|
+
|
|
469
|
+
Example
|
|
470
|
+
|
|
471
|
+
```tsx
|
|
472
|
+
import { Transfer } from '@slotted/react/transfer';
|
|
473
|
+
import type { TransferItem } from '@slotted/react/transfer';
|
|
474
|
+
|
|
475
|
+
const ROLES: TransferItem[] = [
|
|
476
|
+
{ key: 'picker', label: 'Picker', description: 'Scans and picks orders' },
|
|
477
|
+
{ key: 'packer', label: 'Packer', description: 'Packs and labels parcels' },
|
|
478
|
+
{ key: 'receiver', label: 'Receiver', description: 'Books inbound shipments' },
|
|
479
|
+
{ key: 'counter', label: 'Cycle counter', description: 'Counts bins against the system' },
|
|
480
|
+
{ key: 'lead', label: 'Shift lead', description: 'Assigns work and approves overrides' },
|
|
481
|
+
];
|
|
482
|
+
|
|
483
|
+
const MESSAGES = {
|
|
484
|
+
source: 'Not granted',
|
|
485
|
+
target: 'Granted',
|
|
486
|
+
moveToTarget: 'Grant',
|
|
487
|
+
moveAllToTarget: 'Grant all',
|
|
488
|
+
moveToSource: 'Revoke',
|
|
489
|
+
moveAllToSource: 'Revoke all',
|
|
490
|
+
count: '{total, plural, one {# role} other {# roles}}',
|
|
491
|
+
moved: '{count} roles set to {pane}',
|
|
492
|
+
movedOne: '{item} set to {pane}',
|
|
493
|
+
};
|
|
494
|
+
|
|
495
|
+
export default function TransferMessages() {
|
|
496
|
+
return (
|
|
497
|
+
<Transfer
|
|
498
|
+
aria-label="Roles of a warehouse user"
|
|
499
|
+
defaultTargetKeys={['picker']}
|
|
500
|
+
items={ROLES}
|
|
501
|
+
messages={MESSAGES}
|
|
502
|
+
rows={5}
|
|
503
|
+
/>
|
|
504
|
+
);
|
|
505
|
+
}
|
|
506
|
+
```
|
|
507
|
+
|
|
508
|
+
### reorder.tsx
|
|
509
|
+
|
|
510
|
+
Example
|
|
511
|
+
|
|
512
|
+
```tsx
|
|
513
|
+
import { useState } from 'react';
|
|
514
|
+
import { Stack } from '@slotted/react/stack';
|
|
515
|
+
import { Transfer } from '@slotted/react/transfer';
|
|
516
|
+
import type { TransferItem } from '@slotted/react/transfer';
|
|
517
|
+
import { Text } from '@slotted/react/typography';
|
|
518
|
+
|
|
519
|
+
const WIDGETS: TransferItem[] = [
|
|
520
|
+
{ key: 'revenue', label: 'Revenue', description: 'Month to date, against target' },
|
|
521
|
+
{ key: 'orders', label: 'Orders', description: 'Placed today, by channel' },
|
|
522
|
+
{ key: 'stock', label: 'Low stock', description: 'Products below the reorder point' },
|
|
523
|
+
{ key: 'returns', label: 'Returns', description: 'Open return requests by age' },
|
|
524
|
+
{ key: 'fulfillment', label: 'Fulfillment time', description: 'Paid to shipped, median' },
|
|
525
|
+
{ key: 'shipping', label: 'Shipping cost', description: 'Per order, by carrier' },
|
|
526
|
+
{ key: 'reviews', label: 'Customer reviews', description: 'Average rating, last 30 days' },
|
|
527
|
+
];
|
|
528
|
+
|
|
529
|
+
export default function TransferReorder() {
|
|
530
|
+
const [shown, setShown] = useState<readonly string[]>(['revenue', 'orders', 'stock']);
|
|
531
|
+
|
|
532
|
+
const labels = shown.map((key) => WIDGETS.find((widget) => widget.key === key)?.label ?? key);
|
|
533
|
+
|
|
534
|
+
return (
|
|
535
|
+
<Stack gap={4}>
|
|
536
|
+
<Transfer
|
|
537
|
+
aria-label="Dashboard widgets"
|
|
538
|
+
items={WIDGETS}
|
|
539
|
+
messages={{ target: 'On the dashboard' }}
|
|
540
|
+
onTargetKeysChange={setShown}
|
|
541
|
+
reorderable
|
|
542
|
+
searchable={false}
|
|
543
|
+
selectAll={false}
|
|
544
|
+
targetKeys={shown}
|
|
545
|
+
/>
|
|
546
|
+
<Text size="sm" tone="muted">
|
|
547
|
+
Drawn in this order: {labels.join(', ')}.
|
|
548
|
+
</Text>
|
|
549
|
+
</Stack>
|
|
550
|
+
);
|
|
551
|
+
}
|
|
552
|
+
```
|
|
553
|
+
|
|
554
|
+
### sizes.tsx
|
|
555
|
+
|
|
556
|
+
Example
|
|
557
|
+
|
|
558
|
+
```tsx
|
|
559
|
+
import { Stack } from '@slotted/react/stack';
|
|
560
|
+
import { Transfer } from '@slotted/react/transfer';
|
|
561
|
+
import type { TransferItem } from '@slotted/react/transfer';
|
|
562
|
+
|
|
563
|
+
const STORES: TransferItem[] = [
|
|
564
|
+
{ key: 'seattle', label: 'Seattle flagship', description: 'Opened 2014' },
|
|
565
|
+
{ key: 'portland', label: 'Portland Pearl', description: 'Opened 2017' },
|
|
566
|
+
{ key: 'austin', label: 'Austin South Congress', description: 'Opened 2019' },
|
|
567
|
+
{ key: 'denver', label: 'Denver Larimer', description: 'Opened 2021' },
|
|
568
|
+
{ key: 'chicago', label: 'Chicago Fulton Market', description: 'Opened 2023' },
|
|
569
|
+
];
|
|
570
|
+
|
|
571
|
+
export default function TransferSizes() {
|
|
572
|
+
return (
|
|
573
|
+
<Stack gap={6}>
|
|
574
|
+
<Transfer
|
|
575
|
+
aria-label="Stores, size sm"
|
|
576
|
+
defaultTargetKeys={['seattle']}
|
|
577
|
+
items={STORES}
|
|
578
|
+
rows={3}
|
|
579
|
+
size="sm"
|
|
580
|
+
/>
|
|
581
|
+
<Transfer
|
|
582
|
+
aria-label="Stores, size md"
|
|
583
|
+
defaultTargetKeys={['portland']}
|
|
584
|
+
items={STORES}
|
|
585
|
+
rows={3}
|
|
586
|
+
size="md"
|
|
587
|
+
/>
|
|
588
|
+
<Transfer
|
|
589
|
+
aria-label="Stores, size lg"
|
|
590
|
+
defaultTargetKeys={['austin']}
|
|
591
|
+
items={STORES}
|
|
592
|
+
rows={3}
|
|
593
|
+
size="lg"
|
|
594
|
+
/>
|
|
595
|
+
</Stack>
|
|
596
|
+
);
|
|
597
|
+
}
|
|
598
|
+
```
|
|
599
|
+
|
|
600
|
+
### virtual.tsx
|
|
601
|
+
|
|
602
|
+
Example
|
|
603
|
+
|
|
604
|
+
```tsx
|
|
605
|
+
import { Transfer } from '@slotted/react/transfer';
|
|
606
|
+
import type { TransferItem } from '@slotted/react/transfer';
|
|
607
|
+
|
|
608
|
+
const NAMES = [
|
|
609
|
+
'Shipping box',
|
|
610
|
+
'Bubble mailer',
|
|
611
|
+
'Packing tape',
|
|
612
|
+
'Pallet wrap',
|
|
613
|
+
'Barcode label',
|
|
614
|
+
'Void fill',
|
|
615
|
+
'Corner guard',
|
|
616
|
+
'Carton sealer',
|
|
617
|
+
'Pick tote',
|
|
618
|
+
'Dunnage bag',
|
|
619
|
+
];
|
|
620
|
+
const SIZES = ['XS', 'S', 'M', 'L', 'XL', '2XL', '3XL', 'Bulk'];
|
|
621
|
+
|
|
622
|
+
const PRODUCTS: TransferItem[] = Array.from({ length: 2000 }, (_, index) => ({
|
|
623
|
+
key: `SKU-${String(index + 1).padStart(4, '0')}`,
|
|
624
|
+
label: `${NAMES[index % NAMES.length]}, ${SIZES[Math.floor(index / NAMES.length) % SIZES.length]}`,
|
|
625
|
+
description: `SKU-${String(index + 1).padStart(4, '0')}`,
|
|
626
|
+
}));
|
|
627
|
+
|
|
628
|
+
export default function TransferVirtual() {
|
|
629
|
+
return <Transfer aria-label="Packaging catalog" itemSize={34} items={PRODUCTS} virtual />;
|
|
630
|
+
}
|
|
631
|
+
```
|