@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,768 @@
|
|
|
1
|
+
<!-- index: ./index.md -->
|
|
2
|
+
# action-bar
|
|
3
|
+
|
|
4
|
+
`data-ui="action-bar"` · Row of actions that overflow into a menu.
|
|
5
|
+
|
|
6
|
+
## Examples
|
|
7
|
+
|
|
8
|
+
### Playground
|
|
9
|
+
|
|
10
|
+
One bar with every axis on it, driven by the controls below the canvas. Tab through it: each action is its own stop, in the order the form is read, and no arrow key is bound.
|
|
11
|
+
|
|
12
|
+
Excerpt — not a complete module
|
|
13
|
+
|
|
14
|
+
```tsx
|
|
15
|
+
<ActionBar aria-label="Order actions">
|
|
16
|
+
<ActionBarStatus>Draft saved at 14:07</ActionBarStatus>
|
|
17
|
+
<ActionBarActions>
|
|
18
|
+
<ActionBarAction>
|
|
19
|
+
<Button variant="ghost" tone="secondary">
|
|
20
|
+
Discard changes
|
|
21
|
+
</Button>
|
|
22
|
+
</ActionBarAction>
|
|
23
|
+
<ActionBarAction>
|
|
24
|
+
<Button>Submit for approval</Button>
|
|
25
|
+
</ActionBarAction>
|
|
26
|
+
</ActionBarActions>
|
|
27
|
+
</ActionBar>;
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### Which action gives way first
|
|
31
|
+
|
|
32
|
+
Narrow the stage and watch the order: the action ranked hide goes without a trace, the low one becomes a menu row, the high one follows it, and the pinned action never moves. Position decides nothing here — the rank does.
|
|
33
|
+
|
|
34
|
+
Example
|
|
35
|
+
|
|
36
|
+
```tsx
|
|
37
|
+
import {
|
|
38
|
+
ActionBar,
|
|
39
|
+
ActionBarAction,
|
|
40
|
+
ActionBarActions,
|
|
41
|
+
ActionBarOverflow,
|
|
42
|
+
} from '@slotted/react/action-bar';
|
|
43
|
+
import { Button } from '@slotted/react/button';
|
|
44
|
+
import { MenuItem } from '@slotted/react/menu';
|
|
45
|
+
|
|
46
|
+
export default function ActionBarPriorityExample() {
|
|
47
|
+
return (
|
|
48
|
+
<ActionBar aria-label="Purchase order PO-4521 actions" variant="raised">
|
|
49
|
+
<ActionBarActions>
|
|
50
|
+
<ActionBarAction priority="hide">
|
|
51
|
+
<Button variant="ghost">Preview PDF</Button>
|
|
52
|
+
</ActionBarAction>
|
|
53
|
+
<ActionBarAction counterpart={<MenuItem>Duplicate order</MenuItem>}>
|
|
54
|
+
<Button variant="ghost">Duplicate order</Button>
|
|
55
|
+
</ActionBarAction>
|
|
56
|
+
<ActionBarAction priority="high" counterpart={<MenuItem>Send back to buyer</MenuItem>}>
|
|
57
|
+
<Button variant="outline">Send back to buyer</Button>
|
|
58
|
+
</ActionBarAction>
|
|
59
|
+
<ActionBarAction>
|
|
60
|
+
<Button>Approve</Button>
|
|
61
|
+
</ActionBarAction>
|
|
62
|
+
<ActionBarOverflow />
|
|
63
|
+
</ActionBarActions>
|
|
64
|
+
</ActionBar>
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### What is left over, behind one control
|
|
70
|
+
|
|
71
|
+
The surface holds what gave way and what was never in the bar, in the bar’s own order, with a rule wherever one of the bar’s own rules divided two of them. The trigger’s name is the count, not three dots.
|
|
72
|
+
|
|
73
|
+
Excerpt — not a complete module
|
|
74
|
+
|
|
75
|
+
```tsx
|
|
76
|
+
<ActionBarActions>
|
|
77
|
+
<ActionBarAction priority="always" counterpart={<MenuItem>View history</MenuItem>}>
|
|
78
|
+
<Button variant="ghost">View history</Button>
|
|
79
|
+
</ActionBarAction>
|
|
80
|
+
<ActionBarAction>
|
|
81
|
+
<Button>Approve</Button>
|
|
82
|
+
</ActionBarAction>
|
|
83
|
+
<ActionBarOverflow label={(hidden) => `${hidden} more actions`} />
|
|
84
|
+
</ActionBarActions>;
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### The action that confirms does not move
|
|
88
|
+
|
|
89
|
+
Four bars on one stage: no message, a short one, one that fills the bar, and a secondary action removed by a permission filter. Read the right edge — the action that confirms is on the same pixel in all four.
|
|
90
|
+
|
|
91
|
+
Excerpt — not a complete module
|
|
92
|
+
|
|
93
|
+
```tsx
|
|
94
|
+
// The run carries margin-inline-start: auto, so what grows or leaves
|
|
95
|
+
// moves what is *before* the last action and never the last action.
|
|
96
|
+
<ActionBar aria-label="Order actions">
|
|
97
|
+
{dirty ? <ActionBarStatus>{message}</ActionBarStatus> : null}
|
|
98
|
+
<ActionBarActions>
|
|
99
|
+
{canReturn ? (
|
|
100
|
+
<ActionBarAction>
|
|
101
|
+
<Button variant="ghost">Send back</Button>
|
|
102
|
+
</ActionBarAction>
|
|
103
|
+
) : null}
|
|
104
|
+
<ActionBarAction>
|
|
105
|
+
<Button loading={saving}>Approve</Button>
|
|
106
|
+
</ActionBarAction>
|
|
107
|
+
</ActionBarActions>
|
|
108
|
+
</ActionBar>;
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### A destructive action, and the rule beside it
|
|
112
|
+
|
|
113
|
+
The first bar keeps “Void invoice” away from the two frequent actions with the bar’s own rule. The second is the case nobody writes down: the action that confirms is the destructive one, and the rule separates it from the action that keeps the record.
|
|
114
|
+
|
|
115
|
+
Example
|
|
116
|
+
|
|
117
|
+
```tsx
|
|
118
|
+
import {
|
|
119
|
+
ActionBar,
|
|
120
|
+
ActionBarAction,
|
|
121
|
+
ActionBarActions,
|
|
122
|
+
ActionBarSeparator,
|
|
123
|
+
} from '@slotted/react/action-bar';
|
|
124
|
+
import { Button } from '@slotted/react/button';
|
|
125
|
+
import { Stack } from '@slotted/react/stack';
|
|
126
|
+
|
|
127
|
+
export default function ActionBarDangerExample() {
|
|
128
|
+
return (
|
|
129
|
+
<Stack gap={3}>
|
|
130
|
+
<ActionBar aria-label="Invoice INV-20418 actions" variant="raised">
|
|
131
|
+
<ActionBarActions>
|
|
132
|
+
<ActionBarAction>
|
|
133
|
+
<Button tone="danger" variant="ghost">
|
|
134
|
+
Void invoice
|
|
135
|
+
</Button>
|
|
136
|
+
</ActionBarAction>
|
|
137
|
+
<ActionBarSeparator />
|
|
138
|
+
<ActionBarAction>
|
|
139
|
+
<Button tone="secondary" variant="ghost">
|
|
140
|
+
Discard changes
|
|
141
|
+
</Button>
|
|
142
|
+
</ActionBarAction>
|
|
143
|
+
<ActionBarAction>
|
|
144
|
+
<Button>Save invoice</Button>
|
|
145
|
+
</ActionBarAction>
|
|
146
|
+
</ActionBarActions>
|
|
147
|
+
</ActionBar>
|
|
148
|
+
|
|
149
|
+
<ActionBar aria-label="Confirm voiding of invoice INV-20418" variant="raised">
|
|
150
|
+
<ActionBarActions>
|
|
151
|
+
<ActionBarAction>
|
|
152
|
+
<Button tone="secondary" variant="ghost">
|
|
153
|
+
Keep invoice
|
|
154
|
+
</Button>
|
|
155
|
+
</ActionBarAction>
|
|
156
|
+
<ActionBarSeparator />
|
|
157
|
+
<ActionBarAction>
|
|
158
|
+
<Button tone="danger">Void invoice</Button>
|
|
159
|
+
</ActionBarAction>
|
|
160
|
+
</ActionBarActions>
|
|
161
|
+
</ActionBar>
|
|
162
|
+
</Stack>
|
|
163
|
+
);
|
|
164
|
+
}
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
### The sentence at the start
|
|
168
|
+
|
|
169
|
+
Four things a product actually puts there — a timestamp, a dirty-state marker, an inline message and a validation count — and the same two actions under each. The slot takes what room is left and shortens itself rather than pushing.
|
|
170
|
+
|
|
171
|
+
Example
|
|
172
|
+
|
|
173
|
+
```tsx
|
|
174
|
+
import {
|
|
175
|
+
ActionBar,
|
|
176
|
+
ActionBarAction,
|
|
177
|
+
ActionBarActions,
|
|
178
|
+
ActionBarStatus,
|
|
179
|
+
} from '@slotted/react/action-bar';
|
|
180
|
+
import { Button } from '@slotted/react/button';
|
|
181
|
+
import { InlineMessage } from '@slotted/react/inline-message';
|
|
182
|
+
import { Stack } from '@slotted/react/stack';
|
|
183
|
+
import { StatusIndicator } from '@slotted/react/status-indicator';
|
|
184
|
+
|
|
185
|
+
export default function ActionBarStatusExample() {
|
|
186
|
+
return (
|
|
187
|
+
<Stack gap={3}>
|
|
188
|
+
<ActionBar aria-label="Order SO-20418 actions, no status" variant="raised">
|
|
189
|
+
<ActionBarActions>
|
|
190
|
+
<ActionBarAction>
|
|
191
|
+
<Button tone="secondary" variant="ghost">
|
|
192
|
+
Discard
|
|
193
|
+
</Button>
|
|
194
|
+
</ActionBarAction>
|
|
195
|
+
<ActionBarAction>
|
|
196
|
+
<Button>Save order</Button>
|
|
197
|
+
</ActionBarAction>
|
|
198
|
+
</ActionBarActions>
|
|
199
|
+
</ActionBar>
|
|
200
|
+
|
|
201
|
+
<ActionBar aria-label="Order SO-20418 actions, saved time" variant="raised">
|
|
202
|
+
<ActionBarStatus>Draft saved at 14:07</ActionBarStatus>
|
|
203
|
+
<ActionBarActions>
|
|
204
|
+
<ActionBarAction>
|
|
205
|
+
<Button tone="secondary" variant="ghost">
|
|
206
|
+
Discard
|
|
207
|
+
</Button>
|
|
208
|
+
</ActionBarAction>
|
|
209
|
+
<ActionBarAction>
|
|
210
|
+
<Button>Save order</Button>
|
|
211
|
+
</ActionBarAction>
|
|
212
|
+
</ActionBarActions>
|
|
213
|
+
</ActionBar>
|
|
214
|
+
|
|
215
|
+
<ActionBar aria-label="Order SO-20418 actions, missing fields" variant="raised">
|
|
216
|
+
<ActionBarStatus>
|
|
217
|
+
<StatusIndicator status="warning">3 required fields are empty</StatusIndicator>
|
|
218
|
+
</ActionBarStatus>
|
|
219
|
+
<ActionBarActions>
|
|
220
|
+
<ActionBarAction>
|
|
221
|
+
<Button tone="secondary" variant="ghost">
|
|
222
|
+
Discard
|
|
223
|
+
</Button>
|
|
224
|
+
</ActionBarAction>
|
|
225
|
+
<ActionBarAction>
|
|
226
|
+
<Button>Save order</Button>
|
|
227
|
+
</ActionBarAction>
|
|
228
|
+
</ActionBarActions>
|
|
229
|
+
</ActionBar>
|
|
230
|
+
|
|
231
|
+
<ActionBar aria-label="Order SO-20418 actions, credit limit" variant="raised">
|
|
232
|
+
<ActionBarStatus>
|
|
233
|
+
<InlineMessage tone="danger">
|
|
234
|
+
The order total of 18,400 USD is above the 15,000 USD credit limit of Harbor Outfitters.
|
|
235
|
+
</InlineMessage>
|
|
236
|
+
</ActionBarStatus>
|
|
237
|
+
<ActionBarActions>
|
|
238
|
+
<ActionBarAction>
|
|
239
|
+
<Button tone="secondary" variant="ghost">
|
|
240
|
+
Discard
|
|
241
|
+
</Button>
|
|
242
|
+
</ActionBarAction>
|
|
243
|
+
<ActionBarAction>
|
|
244
|
+
<Button>Save order</Button>
|
|
245
|
+
</ActionBarAction>
|
|
246
|
+
</ActionBarActions>
|
|
247
|
+
</ActionBar>
|
|
248
|
+
</Stack>
|
|
249
|
+
);
|
|
250
|
+
}
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
### The bar a selection brings
|
|
254
|
+
|
|
255
|
+
Table owns the selection and its count; Action Bar supplies the place, the ranks and the entry. Toggle the selection and watch the bar arrive from below rather than appear — and leave the document when it goes, rather than staying hidden and still reachable by Tab.
|
|
256
|
+
|
|
257
|
+
Example
|
|
258
|
+
|
|
259
|
+
```tsx
|
|
260
|
+
import { useState } from 'react';
|
|
261
|
+
|
|
262
|
+
import {
|
|
263
|
+
ActionBar,
|
|
264
|
+
ActionBarAction,
|
|
265
|
+
ActionBarActions,
|
|
266
|
+
ActionBarSeparator,
|
|
267
|
+
ActionBarStatus,
|
|
268
|
+
} from '@slotted/react/action-bar';
|
|
269
|
+
import { Button } from '@slotted/react/button';
|
|
270
|
+
import { Inline } from '@slotted/react/inline';
|
|
271
|
+
import { Stack } from '@slotted/react/stack';
|
|
272
|
+
|
|
273
|
+
export default function ActionBarBulkExample() {
|
|
274
|
+
const [selected, setSelected] = useState(true);
|
|
275
|
+
|
|
276
|
+
return (
|
|
277
|
+
<Stack gap={3}>
|
|
278
|
+
<Inline>
|
|
279
|
+
<Button variant="outline" onClick={() => setSelected(!selected)}>
|
|
280
|
+
{selected ? 'Clear selection' : 'Select 12 invoices'}
|
|
281
|
+
</Button>
|
|
282
|
+
</Inline>
|
|
283
|
+
<ActionBar aria-label="Selected invoices actions" present={selected} variant="raised">
|
|
284
|
+
<ActionBarStatus>12 invoices selected</ActionBarStatus>
|
|
285
|
+
<ActionBarActions>
|
|
286
|
+
<ActionBarAction>
|
|
287
|
+
<Button variant="ghost">Export to CSV</Button>
|
|
288
|
+
</ActionBarAction>
|
|
289
|
+
<ActionBarSeparator />
|
|
290
|
+
<ActionBarAction>
|
|
291
|
+
<Button tone="danger">Void invoices</Button>
|
|
292
|
+
</ActionBarAction>
|
|
293
|
+
</ActionBarActions>
|
|
294
|
+
</ActionBar>
|
|
295
|
+
</Stack>
|
|
296
|
+
);
|
|
297
|
+
}
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
### Stuck to the end of what scrolls
|
|
301
|
+
|
|
302
|
+
Scroll the panel: the bar stays at the bottom and the last line of content scrolls up to it rather than under it. Inside a Page it reads --slotted-page-sticky-bottom and stops above that page’s own footer instead of covering it.
|
|
303
|
+
|
|
304
|
+
Example
|
|
305
|
+
|
|
306
|
+
```tsx
|
|
307
|
+
import {
|
|
308
|
+
ActionBar,
|
|
309
|
+
ActionBarAction,
|
|
310
|
+
ActionBarActions,
|
|
311
|
+
ActionBarStatus,
|
|
312
|
+
} from '@slotted/react/action-bar';
|
|
313
|
+
import { Button } from '@slotted/react/button';
|
|
314
|
+
import { ScrollArea } from '@slotted/react/scroll-area';
|
|
315
|
+
import { Stack } from '@slotted/react/stack';
|
|
316
|
+
import { Text } from '@slotted/react/typography';
|
|
317
|
+
|
|
318
|
+
const LINES = [
|
|
319
|
+
'Waterproof shell jacket, 24 units',
|
|
320
|
+
'Trail running shoes, 40 units',
|
|
321
|
+
'Insulated bottle 750 ml, 120 units',
|
|
322
|
+
'Merino base layer, 60 units',
|
|
323
|
+
'Camp stove, 18 units',
|
|
324
|
+
'Headlamp 400 lumens, 75 units',
|
|
325
|
+
'Dry bag 20 L, 90 units',
|
|
326
|
+
'Trekking poles, 32 units',
|
|
327
|
+
];
|
|
328
|
+
|
|
329
|
+
export default function ActionBarStickyExample() {
|
|
330
|
+
return (
|
|
331
|
+
<ScrollArea maxBlockSize="14rem" messages={{ label: 'Lines of order SO-20418' }}>
|
|
332
|
+
<ScrollArea.Content>
|
|
333
|
+
<Stack gap={3}>
|
|
334
|
+
{LINES.map((line) => (
|
|
335
|
+
<Text key={line} size="sm">
|
|
336
|
+
{line}
|
|
337
|
+
</Text>
|
|
338
|
+
))}
|
|
339
|
+
<ActionBar aria-label="Order SO-20418 actions" sticky variant="raised">
|
|
340
|
+
<ActionBarStatus>8 lines</ActionBarStatus>
|
|
341
|
+
<ActionBarActions>
|
|
342
|
+
<ActionBarAction>
|
|
343
|
+
<Button>Save changes</Button>
|
|
344
|
+
</ActionBarAction>
|
|
345
|
+
</ActionBarActions>
|
|
346
|
+
</ActionBar>
|
|
347
|
+
</Stack>
|
|
348
|
+
</ScrollArea.Content>
|
|
349
|
+
</ScrollArea>
|
|
350
|
+
);
|
|
351
|
+
}
|
|
352
|
+
```
|
|
353
|
+
|
|
354
|
+
### Where the run sits
|
|
355
|
+
|
|
356
|
+
end is the anchor and the default; start puts the run beside the status; center places it in what is left. The field disagrees about this one — Salesforce centers a docked footer, Polaris ends it, Fluent starts it — so it is an axis.
|
|
357
|
+
|
|
358
|
+
Example
|
|
359
|
+
|
|
360
|
+
```tsx
|
|
361
|
+
import {
|
|
362
|
+
ActionBar,
|
|
363
|
+
ActionBarAction,
|
|
364
|
+
ActionBarActions,
|
|
365
|
+
ActionBarStatus,
|
|
366
|
+
} from '@slotted/react/action-bar';
|
|
367
|
+
import { Button } from '@slotted/react/button';
|
|
368
|
+
import { Stack } from '@slotted/react/stack';
|
|
369
|
+
|
|
370
|
+
export default function ActionBarAlignExample() {
|
|
371
|
+
return (
|
|
372
|
+
<Stack gap={3}>
|
|
373
|
+
<ActionBar aria-label="Actions at the end" align="end" variant="raised">
|
|
374
|
+
<ActionBarStatus>Draft saved at 14:07</ActionBarStatus>
|
|
375
|
+
<ActionBarActions>
|
|
376
|
+
<ActionBarAction>
|
|
377
|
+
<Button tone="secondary" variant="ghost">
|
|
378
|
+
Discard changes
|
|
379
|
+
</Button>
|
|
380
|
+
</ActionBarAction>
|
|
381
|
+
<ActionBarAction>
|
|
382
|
+
<Button>Save order</Button>
|
|
383
|
+
</ActionBarAction>
|
|
384
|
+
</ActionBarActions>
|
|
385
|
+
</ActionBar>
|
|
386
|
+
|
|
387
|
+
<ActionBar aria-label="Actions at the start" align="start" variant="raised">
|
|
388
|
+
<ActionBarStatus>Draft saved at 14:07</ActionBarStatus>
|
|
389
|
+
<ActionBarActions>
|
|
390
|
+
<ActionBarAction>
|
|
391
|
+
<Button tone="secondary" variant="ghost">
|
|
392
|
+
Discard changes
|
|
393
|
+
</Button>
|
|
394
|
+
</ActionBarAction>
|
|
395
|
+
<ActionBarAction>
|
|
396
|
+
<Button>Save order</Button>
|
|
397
|
+
</ActionBarAction>
|
|
398
|
+
</ActionBarActions>
|
|
399
|
+
</ActionBar>
|
|
400
|
+
|
|
401
|
+
<ActionBar aria-label="Actions at the center" align="center" variant="raised">
|
|
402
|
+
<ActionBarStatus>Draft saved at 14:07</ActionBarStatus>
|
|
403
|
+
<ActionBarActions>
|
|
404
|
+
<ActionBarAction>
|
|
405
|
+
<Button tone="secondary" variant="ghost">
|
|
406
|
+
Discard changes
|
|
407
|
+
</Button>
|
|
408
|
+
</ActionBarAction>
|
|
409
|
+
<ActionBarAction>
|
|
410
|
+
<Button>Save order</Button>
|
|
411
|
+
</ActionBarAction>
|
|
412
|
+
</ActionBarActions>
|
|
413
|
+
</ActionBar>
|
|
414
|
+
</Stack>
|
|
415
|
+
);
|
|
416
|
+
}
|
|
417
|
+
```
|
|
418
|
+
|
|
419
|
+
### The step the bar sits at
|
|
420
|
+
|
|
421
|
+
The size moves the bar’s own inset, gap, minimum height and rule — and it reaches the buttons through the Button family’s own defaults, so a bar does not make a consumer repeat size on every control. A button that states its own still wins.
|
|
422
|
+
|
|
423
|
+
Example
|
|
424
|
+
|
|
425
|
+
```tsx
|
|
426
|
+
import {
|
|
427
|
+
ActionBar,
|
|
428
|
+
ActionBarAction,
|
|
429
|
+
ActionBarActions,
|
|
430
|
+
ActionBarStatus,
|
|
431
|
+
} from '@slotted/react/action-bar';
|
|
432
|
+
import { Button } from '@slotted/react/button';
|
|
433
|
+
import { Stack } from '@slotted/react/stack';
|
|
434
|
+
|
|
435
|
+
export default function ActionBarSizesExample() {
|
|
436
|
+
return (
|
|
437
|
+
<Stack gap={3}>
|
|
438
|
+
<ActionBar aria-label="Small bar" size="sm" variant="raised">
|
|
439
|
+
<ActionBarStatus>Draft saved at 14:07</ActionBarStatus>
|
|
440
|
+
<ActionBarActions>
|
|
441
|
+
<ActionBarAction>
|
|
442
|
+
<Button tone="secondary" variant="ghost">
|
|
443
|
+
Discard changes
|
|
444
|
+
</Button>
|
|
445
|
+
</ActionBarAction>
|
|
446
|
+
<ActionBarAction>
|
|
447
|
+
<Button>Save order</Button>
|
|
448
|
+
</ActionBarAction>
|
|
449
|
+
</ActionBarActions>
|
|
450
|
+
</ActionBar>
|
|
451
|
+
|
|
452
|
+
<ActionBar aria-label="Medium bar" size="md" variant="raised">
|
|
453
|
+
<ActionBarStatus>Draft saved at 14:07</ActionBarStatus>
|
|
454
|
+
<ActionBarActions>
|
|
455
|
+
<ActionBarAction>
|
|
456
|
+
<Button tone="secondary" variant="ghost">
|
|
457
|
+
Discard changes
|
|
458
|
+
</Button>
|
|
459
|
+
</ActionBarAction>
|
|
460
|
+
<ActionBarAction>
|
|
461
|
+
<Button>Save order</Button>
|
|
462
|
+
</ActionBarAction>
|
|
463
|
+
</ActionBarActions>
|
|
464
|
+
</ActionBar>
|
|
465
|
+
|
|
466
|
+
<ActionBar aria-label="Large bar" size="lg" variant="raised">
|
|
467
|
+
<ActionBarStatus>Draft saved at 14:07</ActionBarStatus>
|
|
468
|
+
<ActionBarActions>
|
|
469
|
+
<ActionBarAction>
|
|
470
|
+
<Button size="sm" tone="secondary" variant="ghost">
|
|
471
|
+
Discard changes
|
|
472
|
+
</Button>
|
|
473
|
+
</ActionBarAction>
|
|
474
|
+
<ActionBarAction>
|
|
475
|
+
<Button>Save order</Button>
|
|
476
|
+
</ActionBarAction>
|
|
477
|
+
</ActionBarActions>
|
|
478
|
+
</ActionBar>
|
|
479
|
+
</Stack>
|
|
480
|
+
);
|
|
481
|
+
}
|
|
482
|
+
```
|
|
483
|
+
|
|
484
|
+
### Whether the bar paints a ground
|
|
485
|
+
|
|
486
|
+
plain is the default and paints nothing — a bar inside a Page footer is already standing on a ground that Page painted. raised takes the surface and one hairline at the top, which is the bar with no page around it: a drawer, a dialog, a card.
|
|
487
|
+
|
|
488
|
+
Example
|
|
489
|
+
|
|
490
|
+
```tsx
|
|
491
|
+
import { ActionBar, ActionBarAction, ActionBarActions } from '@slotted/react/action-bar';
|
|
492
|
+
import { Button } from '@slotted/react/button';
|
|
493
|
+
import { Card, CardBody, CardFooter } from '@slotted/react/card';
|
|
494
|
+
import { Stack } from '@slotted/react/stack';
|
|
495
|
+
import { Text } from '@slotted/react/typography';
|
|
496
|
+
|
|
497
|
+
export default function ActionBarVariantExample() {
|
|
498
|
+
return (
|
|
499
|
+
<Stack gap={4}>
|
|
500
|
+
<Card>
|
|
501
|
+
<CardBody>
|
|
502
|
+
<Text>Order SO-20418 ships on Friday.</Text>
|
|
503
|
+
</CardBody>
|
|
504
|
+
<CardFooter>
|
|
505
|
+
<ActionBar aria-label="Order SO-20418 actions in a card" variant="plain">
|
|
506
|
+
<ActionBarActions>
|
|
507
|
+
<ActionBarAction>
|
|
508
|
+
<Button tone="secondary" variant="ghost">
|
|
509
|
+
Cancel order
|
|
510
|
+
</Button>
|
|
511
|
+
</ActionBarAction>
|
|
512
|
+
<ActionBarAction>
|
|
513
|
+
<Button>Confirm shipment</Button>
|
|
514
|
+
</ActionBarAction>
|
|
515
|
+
</ActionBarActions>
|
|
516
|
+
</ActionBar>
|
|
517
|
+
</CardFooter>
|
|
518
|
+
</Card>
|
|
519
|
+
|
|
520
|
+
<ActionBar aria-label="Order SO-20418 actions on their own" variant="raised">
|
|
521
|
+
<ActionBarActions>
|
|
522
|
+
<ActionBarAction>
|
|
523
|
+
<Button tone="secondary" variant="ghost">
|
|
524
|
+
Cancel order
|
|
525
|
+
</Button>
|
|
526
|
+
</ActionBarAction>
|
|
527
|
+
<ActionBarAction>
|
|
528
|
+
<Button>Confirm shipment</Button>
|
|
529
|
+
</ActionBarAction>
|
|
530
|
+
</ActionBarActions>
|
|
531
|
+
</ActionBar>
|
|
532
|
+
</Stack>
|
|
533
|
+
);
|
|
534
|
+
}
|
|
535
|
+
```
|
|
536
|
+
|
|
537
|
+
### The bar on a phone
|
|
538
|
+
|
|
539
|
+
Below 24rem of container a bar with no overflow control becomes a full-width column with the action that confirms on top, and the collapse stops running — a column has room for everything, so there is no menu. A bar with an overflow control keeps one row: the actions without a counterpart stay and the rest fold into the menu. The DOM order does not change, so Tab still reads the form’s order.
|
|
540
|
+
|
|
541
|
+
Example
|
|
542
|
+
|
|
543
|
+
```tsx
|
|
544
|
+
import {
|
|
545
|
+
ActionBar,
|
|
546
|
+
ActionBarAction,
|
|
547
|
+
ActionBarActions,
|
|
548
|
+
ActionBarOverflow,
|
|
549
|
+
} from '@slotted/react/action-bar';
|
|
550
|
+
import { Button } from '@slotted/react/button';
|
|
551
|
+
import { MenuItem } from '@slotted/react/menu';
|
|
552
|
+
import { Stack } from '@slotted/react/stack';
|
|
553
|
+
|
|
554
|
+
export default function ActionBarStackedExample() {
|
|
555
|
+
return (
|
|
556
|
+
<Stack gap={4}>
|
|
557
|
+
<ActionBar aria-label="Order SO-20418 actions without a menu" variant="raised">
|
|
558
|
+
<ActionBarActions>
|
|
559
|
+
<ActionBarAction>
|
|
560
|
+
<Button tone="secondary" variant="ghost">
|
|
561
|
+
Discard all changes
|
|
562
|
+
</Button>
|
|
563
|
+
</ActionBarAction>
|
|
564
|
+
<ActionBarAction>
|
|
565
|
+
<Button variant="outline">Save as draft</Button>
|
|
566
|
+
</ActionBarAction>
|
|
567
|
+
<ActionBarAction>
|
|
568
|
+
<Button>Submit for approval</Button>
|
|
569
|
+
</ActionBarAction>
|
|
570
|
+
</ActionBarActions>
|
|
571
|
+
</ActionBar>
|
|
572
|
+
|
|
573
|
+
<ActionBar aria-label="Order SO-20418 actions with a menu" variant="raised">
|
|
574
|
+
<ActionBarActions>
|
|
575
|
+
<ActionBarAction counterpart={<MenuItem>Discard all changes</MenuItem>}>
|
|
576
|
+
<Button tone="secondary" variant="ghost">
|
|
577
|
+
Discard all changes
|
|
578
|
+
</Button>
|
|
579
|
+
</ActionBarAction>
|
|
580
|
+
<ActionBarAction counterpart={<MenuItem>Save as draft</MenuItem>}>
|
|
581
|
+
<Button variant="outline">Save as draft</Button>
|
|
582
|
+
</ActionBarAction>
|
|
583
|
+
<ActionBarAction>
|
|
584
|
+
<Button>Submit for approval</Button>
|
|
585
|
+
</ActionBarAction>
|
|
586
|
+
<ActionBarOverflow />
|
|
587
|
+
</ActionBarActions>
|
|
588
|
+
</ActionBar>
|
|
589
|
+
</Stack>
|
|
590
|
+
);
|
|
591
|
+
}
|
|
592
|
+
```
|
|
593
|
+
|
|
594
|
+
### Content the application chose
|
|
595
|
+
|
|
596
|
+
Two long labels, a reference number with no spaces in it, and an action mid-flight. The bar never truncates a label: it wraps, or the action goes to the menu where there is a whole row for it.
|
|
597
|
+
|
|
598
|
+
Excerpt — not a complete module
|
|
599
|
+
|
|
600
|
+
```tsx
|
|
601
|
+
<ActionBar aria-label="Order actions" variant="raised">
|
|
602
|
+
<ActionBarStatus>Draft saved at 14:07</ActionBarStatus>
|
|
603
|
+
<ActionBarActions>
|
|
604
|
+
<ActionBarAction>
|
|
605
|
+
<Button variant="ghost">Discard all changes</Button>
|
|
606
|
+
</ActionBarAction>
|
|
607
|
+
<ActionBarAction>
|
|
608
|
+
<Button loading>Submit for approval</Button>
|
|
609
|
+
</ActionBarAction>
|
|
610
|
+
</ActionBarActions>
|
|
611
|
+
</ActionBar>;
|
|
612
|
+
```
|
|
613
|
+
|
|
614
|
+
### Setting it once, and standing beside other families
|
|
615
|
+
|
|
616
|
+
The provider carries the four decisions an application takes once. The bar is what goes inside a Page footer, inside a Drawer and under a Table — and every part can be rendered as the consumer’s own element.
|
|
617
|
+
|
|
618
|
+
Excerpt — not a complete module
|
|
619
|
+
|
|
620
|
+
```tsx
|
|
621
|
+
<ActionBarDefaultsProvider size="sm" variant="plain">
|
|
622
|
+
<Page
|
|
623
|
+
footer={
|
|
624
|
+
<ActionBar aria-label="Order actions" render={(props) => <div {...props} />}>
|
|
625
|
+
<ActionBarActions>
|
|
626
|
+
<ActionBarAction>
|
|
627
|
+
<Button>Submit order</Button>
|
|
628
|
+
</ActionBarAction>
|
|
629
|
+
</ActionBarActions>
|
|
630
|
+
</ActionBar>
|
|
631
|
+
}
|
|
632
|
+
>
|
|
633
|
+
<PageBody>…</PageBody>
|
|
634
|
+
</Page>
|
|
635
|
+
</ActionBarDefaultsProvider>;
|
|
636
|
+
```
|
|
637
|
+
|
|
638
|
+
### The keyboard, and what a reader hears
|
|
639
|
+
|
|
640
|
+
Tab reaches each action in the order the author wrote it. The bar is role="group" with the consumer’s own name; a fieldset around it is how it goes out of action, and the platform takes the controls out of the tab order with it.
|
|
641
|
+
|
|
642
|
+
Excerpt — not a complete module
|
|
643
|
+
|
|
644
|
+
```tsx
|
|
645
|
+
<fieldset disabled={submitting}>
|
|
646
|
+
<ActionBar aria-label="Order actions">
|
|
647
|
+
<ActionBarActions>
|
|
648
|
+
<ActionBarAction>
|
|
649
|
+
<Button variant="ghost">Discard changes</Button>
|
|
650
|
+
</ActionBarAction>
|
|
651
|
+
<ActionBarAction>
|
|
652
|
+
<Button>Save order</Button>
|
|
653
|
+
</ActionBarAction>
|
|
654
|
+
</ActionBarActions>
|
|
655
|
+
</ActionBar>
|
|
656
|
+
</fieldset>;
|
|
657
|
+
```
|
|
658
|
+
|
|
659
|
+
### defaults.tsx
|
|
660
|
+
|
|
661
|
+
Example
|
|
662
|
+
|
|
663
|
+
```tsx
|
|
664
|
+
import {
|
|
665
|
+
ActionBar,
|
|
666
|
+
ActionBarAction,
|
|
667
|
+
ActionBarActions,
|
|
668
|
+
ActionBarDefaultsProvider,
|
|
669
|
+
ActionBarStatus,
|
|
670
|
+
} from '@slotted/react/action-bar';
|
|
671
|
+
import { Button } from '@slotted/react/button';
|
|
672
|
+
import { Stack } from '@slotted/react/stack';
|
|
673
|
+
|
|
674
|
+
export default function ActionBarDefaultsExample() {
|
|
675
|
+
return (
|
|
676
|
+
<ActionBarDefaultsProvider align="start" size="sm" variant="raised">
|
|
677
|
+
<Stack gap={3}>
|
|
678
|
+
<ActionBar aria-label="Bar with the defaults">
|
|
679
|
+
<ActionBarStatus>Draft saved at 14:07</ActionBarStatus>
|
|
680
|
+
<ActionBarActions>
|
|
681
|
+
<ActionBarAction>
|
|
682
|
+
<Button tone="secondary" variant="ghost">
|
|
683
|
+
Discard changes
|
|
684
|
+
</Button>
|
|
685
|
+
</ActionBarAction>
|
|
686
|
+
<ActionBarAction>
|
|
687
|
+
<Button>Save order</Button>
|
|
688
|
+
</ActionBarAction>
|
|
689
|
+
</ActionBarActions>
|
|
690
|
+
</ActionBar>
|
|
691
|
+
|
|
692
|
+
<ActionBar aria-label="Bar with its own align and size" align="end" size="lg">
|
|
693
|
+
<ActionBarStatus>Draft saved at 14:07</ActionBarStatus>
|
|
694
|
+
<ActionBarActions>
|
|
695
|
+
<ActionBarAction>
|
|
696
|
+
<Button tone="secondary" variant="ghost">
|
|
697
|
+
Discard changes
|
|
698
|
+
</Button>
|
|
699
|
+
</ActionBarAction>
|
|
700
|
+
<ActionBarAction>
|
|
701
|
+
<Button>Save order</Button>
|
|
702
|
+
</ActionBarAction>
|
|
703
|
+
</ActionBarActions>
|
|
704
|
+
</ActionBar>
|
|
705
|
+
</Stack>
|
|
706
|
+
</ActionBarDefaultsProvider>
|
|
707
|
+
);
|
|
708
|
+
}
|
|
709
|
+
```
|
|
710
|
+
|
|
711
|
+
### overflow-menu.tsx
|
|
712
|
+
|
|
713
|
+
Example
|
|
714
|
+
|
|
715
|
+
```tsx
|
|
716
|
+
import { useState } from 'react';
|
|
717
|
+
|
|
718
|
+
import {
|
|
719
|
+
ActionBar,
|
|
720
|
+
ActionBarAction,
|
|
721
|
+
ActionBarActions,
|
|
722
|
+
ActionBarOverflow,
|
|
723
|
+
ActionBarSeparator,
|
|
724
|
+
} from '@slotted/react/action-bar';
|
|
725
|
+
import { Button } from '@slotted/react/button';
|
|
726
|
+
import { MenuItem } from '@slotted/react/menu';
|
|
727
|
+
import { Stack } from '@slotted/react/stack';
|
|
728
|
+
import { Text } from '@slotted/react/typography';
|
|
729
|
+
|
|
730
|
+
export default function ActionBarOverflowMenuExample() {
|
|
731
|
+
const [hidden, setHidden] = useState(0);
|
|
732
|
+
|
|
733
|
+
return (
|
|
734
|
+
<Stack gap={3}>
|
|
735
|
+
<ActionBar
|
|
736
|
+
aria-label="Invoice INV-20418 actions"
|
|
737
|
+
onOverflowChange={setHidden}
|
|
738
|
+
variant="raised"
|
|
739
|
+
>
|
|
740
|
+
<ActionBarActions>
|
|
741
|
+
<ActionBarAction priority="always" counterpart={<MenuItem>View history</MenuItem>}>
|
|
742
|
+
<Button variant="ghost">View history</Button>
|
|
743
|
+
</ActionBarAction>
|
|
744
|
+
<ActionBarAction counterpart={<MenuItem>Export to CSV</MenuItem>}>
|
|
745
|
+
<Button variant="ghost">Export to CSV</Button>
|
|
746
|
+
</ActionBarAction>
|
|
747
|
+
<ActionBarAction counterpart={<MenuItem>Print remittance</MenuItem>}>
|
|
748
|
+
<Button variant="ghost">Print remittance</Button>
|
|
749
|
+
</ActionBarAction>
|
|
750
|
+
<ActionBarSeparator />
|
|
751
|
+
<ActionBarAction counterpart={<MenuItem>Void invoice</MenuItem>}>
|
|
752
|
+
<Button tone="danger" variant="ghost">
|
|
753
|
+
Void invoice
|
|
754
|
+
</Button>
|
|
755
|
+
</ActionBarAction>
|
|
756
|
+
<ActionBarAction>
|
|
757
|
+
<Button>Record payment</Button>
|
|
758
|
+
</ActionBarAction>
|
|
759
|
+
<ActionBarOverflow label={(count) => `More invoice actions (${count})`} />
|
|
760
|
+
</ActionBarActions>
|
|
761
|
+
</ActionBar>
|
|
762
|
+
<Text size="sm" tone="muted">
|
|
763
|
+
Actions that gave way: {hidden}
|
|
764
|
+
</Text>
|
|
765
|
+
</Stack>
|
|
766
|
+
);
|
|
767
|
+
}
|
|
768
|
+
```
|