@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
|
@@ -23,7 +23,7 @@ Excerpt — not a complete module
|
|
|
23
23
|
|
|
24
24
|
### The frame with nothing in it
|
|
25
25
|
|
|
26
|
-
Every part the contract declares, drawn as its own name. Everything else
|
|
26
|
+
Every part the contract declares, drawn as its own name. Everything else in these scenes is a product standing in these boxes; this is the shell on its own — four rows, three columns, one gutter, the card the content stands on, three clusters in the bar, and a pane with a head, a body and a foot.
|
|
27
27
|
|
|
28
28
|
Excerpt — not a complete module
|
|
29
29
|
|
|
@@ -58,14 +58,125 @@ Excerpt — not a complete module
|
|
|
58
58
|
|
|
59
59
|
Each region is the HTML element that already means what it is, so none of them writes a role: header is banner, nav is navigation, main is main, aside is complementary, footer is contentinfo. The root is a div precisely so that stays true — a main inside an article is not a landmark. Cadence has no pane and no footer, and the landmark list is then exactly three.
|
|
60
60
|
|
|
61
|
-
|
|
61
|
+
Example
|
|
62
62
|
|
|
63
63
|
```tsx
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
64
|
+
import {
|
|
65
|
+
AppShell,
|
|
66
|
+
AppShellActions,
|
|
67
|
+
AppShellBanner,
|
|
68
|
+
AppShellBrand,
|
|
69
|
+
AppShellCenter,
|
|
70
|
+
AppShellFooter,
|
|
71
|
+
AppShellMain,
|
|
72
|
+
AppShellNav,
|
|
73
|
+
AppShellNavBody,
|
|
74
|
+
AppShellNavFooter,
|
|
75
|
+
AppShellNavHeader,
|
|
76
|
+
AppShellNavPinned,
|
|
77
|
+
AppShellNavToggle,
|
|
78
|
+
} from '@slotted/react/app-shell';
|
|
79
|
+
import { Avatar } from '@slotted/react/avatar';
|
|
80
|
+
import { Button, IconButton } from '@slotted/react/button';
|
|
81
|
+
import { Glyph, Icon } from '@slotted/react/icon';
|
|
82
|
+
import {
|
|
83
|
+
SideNavigation,
|
|
84
|
+
SideNavigationIcon,
|
|
85
|
+
SideNavigationItem,
|
|
86
|
+
SideNavigationLabel,
|
|
87
|
+
SideNavigationLink,
|
|
88
|
+
SideNavigationList,
|
|
89
|
+
} from '@slotted/react/side-navigation';
|
|
90
|
+
import { Stack } from '@slotted/react/stack';
|
|
91
|
+
import { TextField } from '@slotted/react/text-field';
|
|
92
|
+
import { Heading, Text } from '@slotted/react/typography';
|
|
93
|
+
|
|
94
|
+
export default function AppShellRegionsExample() {
|
|
95
|
+
return (
|
|
96
|
+
<AppShell>
|
|
97
|
+
<AppShellBanner>
|
|
98
|
+
<AppShellBrand>
|
|
99
|
+
<AppShellNavToggle />
|
|
100
|
+
<span>Northwind</span>
|
|
101
|
+
</AppShellBrand>
|
|
102
|
+
<AppShellCenter>
|
|
103
|
+
<TextField
|
|
104
|
+
aria-label="Search orders"
|
|
105
|
+
placeholder="Search orders"
|
|
106
|
+
start={
|
|
107
|
+
<Icon>
|
|
108
|
+
<Glyph name="search" />
|
|
109
|
+
</Icon>
|
|
110
|
+
}
|
|
111
|
+
type="search"
|
|
112
|
+
/>
|
|
113
|
+
</AppShellCenter>
|
|
114
|
+
<AppShellActions>
|
|
115
|
+
<IconButton aria-label="Notifications" tone="secondary" variant="ghost">
|
|
116
|
+
<Glyph name="bell" />
|
|
117
|
+
</IconButton>
|
|
118
|
+
<Avatar name="Maria Chen" />
|
|
119
|
+
</AppShellActions>
|
|
120
|
+
</AppShellBanner>
|
|
121
|
+
<AppShellNav>
|
|
122
|
+
<AppShellNavHeader>Rotterdam warehouse</AppShellNavHeader>
|
|
123
|
+
<AppShellNavPinned>
|
|
124
|
+
<Button>New order</Button>
|
|
125
|
+
</AppShellNavPinned>
|
|
126
|
+
<AppShellNavBody>
|
|
127
|
+
<SideNavigation defaultValue="orders">
|
|
128
|
+
<SideNavigationList>
|
|
129
|
+
<SideNavigationItem value="orders">
|
|
130
|
+
<SideNavigationLink href="#orders">
|
|
131
|
+
<SideNavigationIcon>
|
|
132
|
+
<Icon>
|
|
133
|
+
<Glyph name="inbox" />
|
|
134
|
+
</Icon>
|
|
135
|
+
</SideNavigationIcon>
|
|
136
|
+
<SideNavigationLabel>Orders</SideNavigationLabel>
|
|
137
|
+
</SideNavigationLink>
|
|
138
|
+
</SideNavigationItem>
|
|
139
|
+
<SideNavigationItem value="shipments">
|
|
140
|
+
<SideNavigationLink href="#shipments">
|
|
141
|
+
<SideNavigationIcon>
|
|
142
|
+
<Icon>
|
|
143
|
+
<Glyph name="calendar" />
|
|
144
|
+
</Icon>
|
|
145
|
+
</SideNavigationIcon>
|
|
146
|
+
<SideNavigationLabel>Shipments</SideNavigationLabel>
|
|
147
|
+
</SideNavigationLink>
|
|
148
|
+
</SideNavigationItem>
|
|
149
|
+
<SideNavigationItem value="reports">
|
|
150
|
+
<SideNavigationLink href="#reports">
|
|
151
|
+
<SideNavigationIcon>
|
|
152
|
+
<Icon>
|
|
153
|
+
<Glyph name="trending-up" />
|
|
154
|
+
</Icon>
|
|
155
|
+
</SideNavigationIcon>
|
|
156
|
+
<SideNavigationLabel>Reports</SideNavigationLabel>
|
|
157
|
+
</SideNavigationLink>
|
|
158
|
+
</SideNavigationItem>
|
|
159
|
+
</SideNavigationList>
|
|
160
|
+
</SideNavigation>
|
|
161
|
+
</AppShellNavBody>
|
|
162
|
+
<AppShellNavFooter>
|
|
163
|
+
<Text size="sm" tone="muted">
|
|
164
|
+
Maria Chen, shift lead
|
|
165
|
+
</Text>
|
|
166
|
+
</AppShellNavFooter>
|
|
167
|
+
</AppShellNav>
|
|
168
|
+
<AppShellMain>
|
|
169
|
+
<Stack gap={2}>
|
|
170
|
+
<Heading level={1} size="md">
|
|
171
|
+
Orders
|
|
172
|
+
</Heading>
|
|
173
|
+
<Text tone="muted">128 open orders, 14 awaiting payment.</Text>
|
|
174
|
+
</Stack>
|
|
175
|
+
</AppShellMain>
|
|
176
|
+
<AppShellFooter>Northwind Traders, EU region</AppShellFooter>
|
|
177
|
+
</AppShell>
|
|
178
|
+
);
|
|
179
|
+
}
|
|
69
180
|
```
|
|
70
181
|
|
|
71
182
|
### Three clusters, and the one that grows
|
|
@@ -161,15 +272,103 @@ Excerpt — not a complete module
|
|
|
161
272
|
|
|
162
273
|
rail keeps a strip one mark column wide with a row’s inset on each side: every destination stays reachable by its mark, the region stays in the tab order, and the column’s own query container is what tells the rows to drop their labels. hidden takes the region out of the layout and the tab order entirely. Under primary="nav" the control stands in the column’s own foot, over the column it moves, and survives the rail.
|
|
163
274
|
|
|
164
|
-
|
|
275
|
+
Example
|
|
165
276
|
|
|
166
277
|
```tsx
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
278
|
+
import { useState } from 'react';
|
|
279
|
+
import {
|
|
280
|
+
AppShell,
|
|
281
|
+
AppShellBanner,
|
|
282
|
+
AppShellBrand,
|
|
283
|
+
type AppShellCollapsedTo,
|
|
284
|
+
AppShellMain,
|
|
285
|
+
AppShellNav,
|
|
286
|
+
AppShellNavBody,
|
|
287
|
+
AppShellNavToggle,
|
|
288
|
+
} from '@slotted/react/app-shell';
|
|
289
|
+
import { Glyph, Icon } from '@slotted/react/icon';
|
|
290
|
+
import { Segment, SegmentedControl } from '@slotted/react/segmented-control';
|
|
291
|
+
import {
|
|
292
|
+
SideNavigation,
|
|
293
|
+
SideNavigationIcon,
|
|
294
|
+
SideNavigationItem,
|
|
295
|
+
SideNavigationLabel,
|
|
296
|
+
SideNavigationLink,
|
|
297
|
+
SideNavigationList,
|
|
298
|
+
} from '@slotted/react/side-navigation';
|
|
299
|
+
import { Stack } from '@slotted/react/stack';
|
|
300
|
+
import { Heading, Text } from '@slotted/react/typography';
|
|
301
|
+
|
|
302
|
+
export default function AppShellRailExample() {
|
|
303
|
+
const [collapsedTo, setCollapsedTo] = useState<AppShellCollapsedTo>('rail');
|
|
304
|
+
|
|
305
|
+
return (
|
|
306
|
+
<Stack gap={3}>
|
|
307
|
+
<SegmentedControl
|
|
308
|
+
aria-label="Closed navigation"
|
|
309
|
+
onValueChange={(next) => setCollapsedTo(next as AppShellCollapsedTo)}
|
|
310
|
+
value={collapsedTo}
|
|
311
|
+
>
|
|
312
|
+
<Segment value="rail">Rail</Segment>
|
|
313
|
+
<Segment value="hidden">Hidden</Segment>
|
|
314
|
+
</SegmentedControl>
|
|
315
|
+
<AppShell collapsedTo={collapsedTo} defaultNavOpen={false}>
|
|
316
|
+
<AppShellBanner>
|
|
317
|
+
<AppShellBrand>
|
|
318
|
+
<AppShellNavToggle />
|
|
319
|
+
<span>Northwind</span>
|
|
320
|
+
</AppShellBrand>
|
|
321
|
+
</AppShellBanner>
|
|
322
|
+
<AppShellNav>
|
|
323
|
+
<AppShellNavBody>
|
|
324
|
+
<SideNavigation defaultValue="orders">
|
|
325
|
+
<SideNavigationList>
|
|
326
|
+
<SideNavigationItem value="orders">
|
|
327
|
+
<SideNavigationLink href="#orders">
|
|
328
|
+
<SideNavigationIcon>
|
|
329
|
+
<Icon>
|
|
330
|
+
<Glyph name="inbox" />
|
|
331
|
+
</Icon>
|
|
332
|
+
</SideNavigationIcon>
|
|
333
|
+
<SideNavigationLabel>Orders</SideNavigationLabel>
|
|
334
|
+
</SideNavigationLink>
|
|
335
|
+
</SideNavigationItem>
|
|
336
|
+
<SideNavigationItem value="shipments">
|
|
337
|
+
<SideNavigationLink href="#shipments">
|
|
338
|
+
<SideNavigationIcon>
|
|
339
|
+
<Icon>
|
|
340
|
+
<Glyph name="calendar" />
|
|
341
|
+
</Icon>
|
|
342
|
+
</SideNavigationIcon>
|
|
343
|
+
<SideNavigationLabel>Shipments</SideNavigationLabel>
|
|
344
|
+
</SideNavigationLink>
|
|
345
|
+
</SideNavigationItem>
|
|
346
|
+
<SideNavigationItem value="reports">
|
|
347
|
+
<SideNavigationLink href="#reports">
|
|
348
|
+
<SideNavigationIcon>
|
|
349
|
+
<Icon>
|
|
350
|
+
<Glyph name="trending-up" />
|
|
351
|
+
</Icon>
|
|
352
|
+
</SideNavigationIcon>
|
|
353
|
+
<SideNavigationLabel>Reports</SideNavigationLabel>
|
|
354
|
+
</SideNavigationLink>
|
|
355
|
+
</SideNavigationItem>
|
|
356
|
+
</SideNavigationList>
|
|
357
|
+
</SideNavigation>
|
|
358
|
+
</AppShellNavBody>
|
|
359
|
+
</AppShellNav>
|
|
360
|
+
<AppShellMain>
|
|
361
|
+
<Stack gap={2}>
|
|
362
|
+
<Heading level={1} size="md">
|
|
363
|
+
Reports
|
|
364
|
+
</Heading>
|
|
365
|
+
<Text tone="muted">Margin by warehouse, updated at 06:00.</Text>
|
|
366
|
+
</Stack>
|
|
367
|
+
</AppShellMain>
|
|
368
|
+
</AppShell>
|
|
369
|
+
</Stack>
|
|
370
|
+
);
|
|
371
|
+
}
|
|
173
372
|
```
|
|
174
373
|
|
|
175
374
|
### Two levels, one region
|
|
@@ -210,45 +409,218 @@ Excerpt — not a complete module
|
|
|
210
409
|
|
|
211
410
|
The pane holds the second open state, under the same shape as the navigation’s: asideOpen, defaultAsideOpen, onAsideOpenChange with a reason. Select a row and the product opens the pane; press the control in the pane’s head, or Escape when it is a layer, and it closes — the content takes the room, because a closed pane leaves no rail. The skip link to the pane exists only while it is open. Drag the pane’s inner edge, or focus it and press the arrows, Home and End: asideExtent is a fraction of the shell between minAsideExtent and maxAsideExtent, and onAsideExtentChange says which hand moved it.
|
|
212
411
|
|
|
213
|
-
|
|
412
|
+
Example
|
|
214
413
|
|
|
215
414
|
```tsx
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
415
|
+
import { useState } from 'react';
|
|
416
|
+
import {
|
|
417
|
+
AppShell,
|
|
418
|
+
AppShellAside,
|
|
419
|
+
AppShellAsideBody,
|
|
420
|
+
AppShellAsideFooter,
|
|
421
|
+
AppShellAsideHeader,
|
|
422
|
+
AppShellAsideToggle,
|
|
423
|
+
AppShellBanner,
|
|
424
|
+
AppShellBrand,
|
|
425
|
+
AppShellMain,
|
|
426
|
+
AppShellNav,
|
|
427
|
+
AppShellNavBody,
|
|
428
|
+
AppShellNavToggle,
|
|
429
|
+
} from '@slotted/react/app-shell';
|
|
430
|
+
import { Button } from '@slotted/react/button';
|
|
431
|
+
import { Glyph, Icon } from '@slotted/react/icon';
|
|
432
|
+
import { Inline } from '@slotted/react/inline';
|
|
433
|
+
import {
|
|
434
|
+
SideNavigation,
|
|
435
|
+
SideNavigationIcon,
|
|
436
|
+
SideNavigationItem,
|
|
437
|
+
SideNavigationLabel,
|
|
438
|
+
SideNavigationLink,
|
|
439
|
+
SideNavigationList,
|
|
440
|
+
} from '@slotted/react/side-navigation';
|
|
441
|
+
import { Stack } from '@slotted/react/stack';
|
|
442
|
+
import { Heading, Text } from '@slotted/react/typography';
|
|
443
|
+
|
|
444
|
+
export default function AppShellAsideExample() {
|
|
445
|
+
const [selected, setSelected] = useState<string | undefined>();
|
|
446
|
+
const details: Record<string, string> = {
|
|
447
|
+
'SH-3101': '12 pallets from Antwerp to Cologne, delivered.',
|
|
448
|
+
'SH-3102': '18 pallets from Rotterdam to Lyon, due Thursday.',
|
|
449
|
+
'SH-3103': '6 pallets from Hamburg to Prague, held at customs.',
|
|
450
|
+
};
|
|
451
|
+
|
|
452
|
+
return (
|
|
453
|
+
<AppShell
|
|
454
|
+
asideOpen={selected !== undefined}
|
|
455
|
+
onAsideOpenChange={(open) => {
|
|
456
|
+
if (!open) setSelected(undefined);
|
|
457
|
+
}}
|
|
458
|
+
>
|
|
459
|
+
<AppShellBanner>
|
|
460
|
+
<AppShellBrand>
|
|
461
|
+
<AppShellNavToggle />
|
|
462
|
+
<span>Northwind</span>
|
|
463
|
+
</AppShellBrand>
|
|
464
|
+
</AppShellBanner>
|
|
465
|
+
<AppShellNav>
|
|
466
|
+
<AppShellNavBody>
|
|
467
|
+
<SideNavigation defaultValue="orders">
|
|
468
|
+
<SideNavigationList>
|
|
469
|
+
<SideNavigationItem value="orders">
|
|
470
|
+
<SideNavigationLink href="#orders">
|
|
471
|
+
<SideNavigationIcon>
|
|
472
|
+
<Icon>
|
|
473
|
+
<Glyph name="inbox" />
|
|
474
|
+
</Icon>
|
|
475
|
+
</SideNavigationIcon>
|
|
476
|
+
<SideNavigationLabel>Orders</SideNavigationLabel>
|
|
477
|
+
</SideNavigationLink>
|
|
478
|
+
</SideNavigationItem>
|
|
479
|
+
<SideNavigationItem value="shipments">
|
|
480
|
+
<SideNavigationLink href="#shipments">
|
|
481
|
+
<SideNavigationIcon>
|
|
482
|
+
<Icon>
|
|
483
|
+
<Glyph name="calendar" />
|
|
484
|
+
</Icon>
|
|
485
|
+
</SideNavigationIcon>
|
|
486
|
+
<SideNavigationLabel>Shipments</SideNavigationLabel>
|
|
487
|
+
</SideNavigationLink>
|
|
488
|
+
</SideNavigationItem>
|
|
489
|
+
<SideNavigationItem value="reports">
|
|
490
|
+
<SideNavigationLink href="#reports">
|
|
491
|
+
<SideNavigationIcon>
|
|
492
|
+
<Icon>
|
|
493
|
+
<Glyph name="trending-up" />
|
|
494
|
+
</Icon>
|
|
495
|
+
</SideNavigationIcon>
|
|
496
|
+
<SideNavigationLabel>Reports</SideNavigationLabel>
|
|
497
|
+
</SideNavigationLink>
|
|
498
|
+
</SideNavigationItem>
|
|
499
|
+
</SideNavigationList>
|
|
500
|
+
</SideNavigation>
|
|
501
|
+
</AppShellNavBody>
|
|
502
|
+
</AppShellNav>
|
|
503
|
+
<AppShellMain>
|
|
504
|
+
<Stack gap={2}>
|
|
505
|
+
<Heading level={1} size="md">
|
|
506
|
+
Shipments
|
|
507
|
+
</Heading>
|
|
508
|
+
<Inline gap={2}>
|
|
509
|
+
<Button onClick={() => setSelected('SH-3101')} tone="secondary" variant="outline">
|
|
510
|
+
SH-3101
|
|
511
|
+
</Button>
|
|
512
|
+
<Button onClick={() => setSelected('SH-3102')} tone="secondary" variant="outline">
|
|
513
|
+
SH-3102
|
|
514
|
+
</Button>
|
|
515
|
+
<Button onClick={() => setSelected('SH-3103')} tone="secondary" variant="outline">
|
|
516
|
+
SH-3103
|
|
517
|
+
</Button>
|
|
518
|
+
</Inline>
|
|
519
|
+
</Stack>
|
|
520
|
+
</AppShellMain>
|
|
521
|
+
<AppShellAside>
|
|
522
|
+
<AppShellAsideHeader>
|
|
523
|
+
<span>{selected}</span>
|
|
524
|
+
<AppShellAsideToggle />
|
|
525
|
+
</AppShellAsideHeader>
|
|
526
|
+
<AppShellAsideBody>
|
|
527
|
+
<Text>{selected === undefined ? '' : details[selected]}</Text>
|
|
528
|
+
</AppShellAsideBody>
|
|
529
|
+
<AppShellAsideFooter>
|
|
530
|
+
<Button>Reschedule pickup</Button>
|
|
531
|
+
</AppShellAsideFooter>
|
|
532
|
+
</AppShellAside>
|
|
533
|
+
</AppShell>
|
|
534
|
+
);
|
|
535
|
+
}
|
|
237
536
|
```
|
|
238
537
|
|
|
239
538
|
### The layer, and what it does to the rest
|
|
240
539
|
|
|
241
540
|
Atrium overlays its navigation at every width. While the layer is modal, the rest of the shell is inert — the banner and its toggle included, exactly as a dialog’s trigger is — and the ways out are Escape, the veil, a destination, and whatever control the product put in the panel. The pane is a layer of its own under the same policies: escape="none" keeps it open on Escape, outsidePress="none" keeps it open on a press outside, modal={false} draws no veil and inerts nothing.
|
|
242
541
|
|
|
243
|
-
|
|
542
|
+
Example
|
|
244
543
|
|
|
245
544
|
```tsx
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
545
|
+
import {
|
|
546
|
+
AppShell,
|
|
547
|
+
AppShellBanner,
|
|
548
|
+
AppShellBrand,
|
|
549
|
+
AppShellMain,
|
|
550
|
+
AppShellNav,
|
|
551
|
+
AppShellNavBody,
|
|
552
|
+
AppShellNavToggle,
|
|
553
|
+
} from '@slotted/react/app-shell';
|
|
554
|
+
import { Glyph, Icon } from '@slotted/react/icon';
|
|
555
|
+
import {
|
|
556
|
+
SideNavigation,
|
|
557
|
+
SideNavigationIcon,
|
|
558
|
+
SideNavigationItem,
|
|
559
|
+
SideNavigationLabel,
|
|
560
|
+
SideNavigationLink,
|
|
561
|
+
SideNavigationList,
|
|
562
|
+
} from '@slotted/react/side-navigation';
|
|
563
|
+
import { Stack } from '@slotted/react/stack';
|
|
564
|
+
import { Heading, Text } from '@slotted/react/typography';
|
|
565
|
+
|
|
566
|
+
export default function AppShellOverlayExample() {
|
|
567
|
+
return (
|
|
568
|
+
<AppShell defaultNavOpen={false} navMode="overlay">
|
|
569
|
+
<AppShellBanner>
|
|
570
|
+
<AppShellBrand>
|
|
571
|
+
<AppShellNavToggle />
|
|
572
|
+
<span>Northwind</span>
|
|
573
|
+
</AppShellBrand>
|
|
574
|
+
</AppShellBanner>
|
|
575
|
+
<AppShellNav>
|
|
576
|
+
<AppShellNavBody>
|
|
577
|
+
<SideNavigation defaultValue="orders">
|
|
578
|
+
<SideNavigationList>
|
|
579
|
+
<SideNavigationItem value="orders">
|
|
580
|
+
<SideNavigationLink href="#orders">
|
|
581
|
+
<SideNavigationIcon>
|
|
582
|
+
<Icon>
|
|
583
|
+
<Glyph name="inbox" />
|
|
584
|
+
</Icon>
|
|
585
|
+
</SideNavigationIcon>
|
|
586
|
+
<SideNavigationLabel>Orders</SideNavigationLabel>
|
|
587
|
+
</SideNavigationLink>
|
|
588
|
+
</SideNavigationItem>
|
|
589
|
+
<SideNavigationItem value="shipments">
|
|
590
|
+
<SideNavigationLink href="#shipments">
|
|
591
|
+
<SideNavigationIcon>
|
|
592
|
+
<Icon>
|
|
593
|
+
<Glyph name="calendar" />
|
|
594
|
+
</Icon>
|
|
595
|
+
</SideNavigationIcon>
|
|
596
|
+
<SideNavigationLabel>Shipments</SideNavigationLabel>
|
|
597
|
+
</SideNavigationLink>
|
|
598
|
+
</SideNavigationItem>
|
|
599
|
+
<SideNavigationItem value="reports">
|
|
600
|
+
<SideNavigationLink href="#reports">
|
|
601
|
+
<SideNavigationIcon>
|
|
602
|
+
<Icon>
|
|
603
|
+
<Glyph name="trending-up" />
|
|
604
|
+
</Icon>
|
|
605
|
+
</SideNavigationIcon>
|
|
606
|
+
<SideNavigationLabel>Reports</SideNavigationLabel>
|
|
607
|
+
</SideNavigationLink>
|
|
608
|
+
</SideNavigationItem>
|
|
609
|
+
</SideNavigationList>
|
|
610
|
+
</SideNavigation>
|
|
611
|
+
</AppShellNavBody>
|
|
612
|
+
</AppShellNav>
|
|
613
|
+
<AppShellMain>
|
|
614
|
+
<Stack gap={2}>
|
|
615
|
+
<Heading level={1} size="md">
|
|
616
|
+
Orders
|
|
617
|
+
</Heading>
|
|
618
|
+
<Text tone="muted">128 open orders, 14 awaiting payment.</Text>
|
|
619
|
+
</Stack>
|
|
620
|
+
</AppShellMain>
|
|
621
|
+
</AppShell>
|
|
622
|
+
);
|
|
623
|
+
}
|
|
252
624
|
```
|
|
253
625
|
|
|
254
626
|
### Which region reaches the corner
|
|
@@ -265,14 +637,139 @@ Excerpt — not a complete module
|
|
|
265
637
|
|
|
266
638
|
### Sides, sizes and the mirror
|
|
267
639
|
|
|
268
|
-
Atrium puts the navigation at the end of the line and the pane at the start; the controls turn their marks with them. Switch the direction to right-to-left and the whole frame mirrors, because every distance is logical. navSize and asideSize are steps on the
|
|
640
|
+
Atrium puts the navigation at the end of the line and the pane at the start; the controls turn their marks with them. Switch the direction to right-to-left and the whole frame mirrors, because every distance is logical. navSize and asideSize are steps on the shell’s own scale — a theme retunes a step, and nothing retunes a pixel string.
|
|
269
641
|
|
|
270
|
-
|
|
642
|
+
Example
|
|
271
643
|
|
|
272
644
|
```tsx
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
645
|
+
import { useState } from 'react';
|
|
646
|
+
import {
|
|
647
|
+
AppShell,
|
|
648
|
+
AppShellAside,
|
|
649
|
+
AppShellAsideBody,
|
|
650
|
+
AppShellAsideHeader,
|
|
651
|
+
AppShellAsideToggle,
|
|
652
|
+
AppShellBanner,
|
|
653
|
+
AppShellBrand,
|
|
654
|
+
AppShellMain,
|
|
655
|
+
AppShellNav,
|
|
656
|
+
AppShellNavBody,
|
|
657
|
+
type AppShellNavSide,
|
|
658
|
+
AppShellNavToggle,
|
|
659
|
+
type AppShellSize,
|
|
660
|
+
} from '@slotted/react/app-shell';
|
|
661
|
+
import { Glyph, Icon } from '@slotted/react/icon';
|
|
662
|
+
import { Segment, SegmentedControl } from '@slotted/react/segmented-control';
|
|
663
|
+
import {
|
|
664
|
+
SideNavigation,
|
|
665
|
+
SideNavigationIcon,
|
|
666
|
+
SideNavigationItem,
|
|
667
|
+
SideNavigationLabel,
|
|
668
|
+
SideNavigationLink,
|
|
669
|
+
SideNavigationList,
|
|
670
|
+
} from '@slotted/react/side-navigation';
|
|
671
|
+
import { Stack } from '@slotted/react/stack';
|
|
672
|
+
import { Heading, Text } from '@slotted/react/typography';
|
|
673
|
+
|
|
674
|
+
export default function AppShellSidesExample() {
|
|
675
|
+
const [navSide, setNavSide] = useState<AppShellNavSide>('start');
|
|
676
|
+
const [navSize, setNavSize] = useState<AppShellSize>('md');
|
|
677
|
+
const [asideSize, setAsideSize] = useState<AppShellSize>('md');
|
|
678
|
+
|
|
679
|
+
return (
|
|
680
|
+
<Stack gap={3}>
|
|
681
|
+
<SegmentedControl
|
|
682
|
+
aria-label="Navigation side"
|
|
683
|
+
onValueChange={(next) => setNavSide(next as AppShellNavSide)}
|
|
684
|
+
value={navSide}
|
|
685
|
+
>
|
|
686
|
+
<Segment value="start">Start</Segment>
|
|
687
|
+
<Segment value="end">End</Segment>
|
|
688
|
+
</SegmentedControl>
|
|
689
|
+
<SegmentedControl
|
|
690
|
+
aria-label="Navigation size"
|
|
691
|
+
onValueChange={(next) => setNavSize(next as AppShellSize)}
|
|
692
|
+
value={navSize}
|
|
693
|
+
>
|
|
694
|
+
<Segment value="sm">SM</Segment>
|
|
695
|
+
<Segment value="md">MD</Segment>
|
|
696
|
+
<Segment value="lg">LG</Segment>
|
|
697
|
+
</SegmentedControl>
|
|
698
|
+
<SegmentedControl
|
|
699
|
+
aria-label="Pane size"
|
|
700
|
+
onValueChange={(next) => setAsideSize(next as AppShellSize)}
|
|
701
|
+
value={asideSize}
|
|
702
|
+
>
|
|
703
|
+
<Segment value="sm">SM</Segment>
|
|
704
|
+
<Segment value="md">MD</Segment>
|
|
705
|
+
<Segment value="lg">LG</Segment>
|
|
706
|
+
</SegmentedControl>
|
|
707
|
+
<AppShell asideSize={asideSize} navSide={navSide} navSize={navSize}>
|
|
708
|
+
<AppShellBanner>
|
|
709
|
+
<AppShellBrand>
|
|
710
|
+
<AppShellNavToggle />
|
|
711
|
+
<span>Northwind</span>
|
|
712
|
+
</AppShellBrand>
|
|
713
|
+
</AppShellBanner>
|
|
714
|
+
<AppShellNav>
|
|
715
|
+
<AppShellNavBody>
|
|
716
|
+
<SideNavigation defaultValue="orders">
|
|
717
|
+
<SideNavigationList>
|
|
718
|
+
<SideNavigationItem value="orders">
|
|
719
|
+
<SideNavigationLink href="#orders">
|
|
720
|
+
<SideNavigationIcon>
|
|
721
|
+
<Icon>
|
|
722
|
+
<Glyph name="inbox" />
|
|
723
|
+
</Icon>
|
|
724
|
+
</SideNavigationIcon>
|
|
725
|
+
<SideNavigationLabel>Orders</SideNavigationLabel>
|
|
726
|
+
</SideNavigationLink>
|
|
727
|
+
</SideNavigationItem>
|
|
728
|
+
<SideNavigationItem value="shipments">
|
|
729
|
+
<SideNavigationLink href="#shipments">
|
|
730
|
+
<SideNavigationIcon>
|
|
731
|
+
<Icon>
|
|
732
|
+
<Glyph name="calendar" />
|
|
733
|
+
</Icon>
|
|
734
|
+
</SideNavigationIcon>
|
|
735
|
+
<SideNavigationLabel>Shipments</SideNavigationLabel>
|
|
736
|
+
</SideNavigationLink>
|
|
737
|
+
</SideNavigationItem>
|
|
738
|
+
<SideNavigationItem value="reports">
|
|
739
|
+
<SideNavigationLink href="#reports">
|
|
740
|
+
<SideNavigationIcon>
|
|
741
|
+
<Icon>
|
|
742
|
+
<Glyph name="trending-up" />
|
|
743
|
+
</Icon>
|
|
744
|
+
</SideNavigationIcon>
|
|
745
|
+
<SideNavigationLabel>Reports</SideNavigationLabel>
|
|
746
|
+
</SideNavigationLink>
|
|
747
|
+
</SideNavigationItem>
|
|
748
|
+
</SideNavigationList>
|
|
749
|
+
</SideNavigation>
|
|
750
|
+
</AppShellNavBody>
|
|
751
|
+
</AppShellNav>
|
|
752
|
+
<AppShellMain>
|
|
753
|
+
<Stack gap={2}>
|
|
754
|
+
<Heading level={1} size="md">
|
|
755
|
+
Shipments
|
|
756
|
+
</Heading>
|
|
757
|
+
<Text tone="muted">23 in transit, 4 late.</Text>
|
|
758
|
+
</Stack>
|
|
759
|
+
</AppShellMain>
|
|
760
|
+
<AppShellAside>
|
|
761
|
+
<AppShellAsideHeader>
|
|
762
|
+
<span>Shipment SH-3102</span>
|
|
763
|
+
<AppShellAsideToggle />
|
|
764
|
+
</AppShellAsideHeader>
|
|
765
|
+
<AppShellAsideBody>
|
|
766
|
+
<Text>18 pallets from Rotterdam to Lyon, due Thursday.</Text>
|
|
767
|
+
</AppShellAsideBody>
|
|
768
|
+
</AppShellAside>
|
|
769
|
+
</AppShell>
|
|
770
|
+
</Stack>
|
|
771
|
+
);
|
|
772
|
+
}
|
|
276
773
|
```
|
|
277
774
|
|
|
278
775
|
### Who scrolls
|
|
@@ -288,18 +785,105 @@ Excerpt — not a complete module
|
|
|
288
785
|
|
|
289
786
|
### The wait for the next page
|
|
290
787
|
|
|
291
|
-
AppShellProgress draws an indeterminate bar on the line between the chrome and the content — wherever the canvas draws that line — after 200 ms, holds it for at least 400 ms, and marks main aria-busy for exactly as long as it is painted. A page header inside a busy content region draws no bar of its own. Pass loading from the router; nothing in the
|
|
788
|
+
AppShellProgress draws an indeterminate bar on the line between the chrome and the content — wherever the canvas draws that line — after 200 ms, holds it for at least 400 ms, and marks main aria-busy for exactly as long as it is painted. A page header inside a busy content region draws no bar of its own. Pass loading from the router; nothing in the shell knows one.
|
|
292
789
|
|
|
293
|
-
|
|
790
|
+
Example
|
|
294
791
|
|
|
295
792
|
```tsx
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
793
|
+
import { useState } from 'react';
|
|
794
|
+
import {
|
|
795
|
+
AppShell,
|
|
796
|
+
AppShellBanner,
|
|
797
|
+
AppShellBrand,
|
|
798
|
+
AppShellMain,
|
|
799
|
+
AppShellNav,
|
|
800
|
+
AppShellNavBody,
|
|
801
|
+
AppShellNavToggle,
|
|
802
|
+
AppShellProgress,
|
|
803
|
+
} from '@slotted/react/app-shell';
|
|
804
|
+
import { Button } from '@slotted/react/button';
|
|
805
|
+
import { Glyph, Icon } from '@slotted/react/icon';
|
|
806
|
+
import { Inline } from '@slotted/react/inline';
|
|
807
|
+
import {
|
|
808
|
+
SideNavigation,
|
|
809
|
+
SideNavigationIcon,
|
|
810
|
+
SideNavigationItem,
|
|
811
|
+
SideNavigationLabel,
|
|
812
|
+
SideNavigationLink,
|
|
813
|
+
SideNavigationList,
|
|
814
|
+
} from '@slotted/react/side-navigation';
|
|
815
|
+
import { Stack } from '@slotted/react/stack';
|
|
816
|
+
import { Heading, Text } from '@slotted/react/typography';
|
|
817
|
+
|
|
818
|
+
export default function AppShellProgressExample() {
|
|
819
|
+
const [loading, setLoading] = useState(false);
|
|
820
|
+
|
|
821
|
+
function handleRefresh() {
|
|
822
|
+
setLoading(true);
|
|
823
|
+
setTimeout(() => setLoading(false), 2500);
|
|
824
|
+
}
|
|
825
|
+
|
|
826
|
+
return (
|
|
827
|
+
<AppShell>
|
|
828
|
+
<AppShellBanner>
|
|
829
|
+
<AppShellBrand>
|
|
830
|
+
<AppShellNavToggle />
|
|
831
|
+
<span>Northwind</span>
|
|
832
|
+
</AppShellBrand>
|
|
833
|
+
</AppShellBanner>
|
|
834
|
+
<AppShellNav>
|
|
835
|
+
<AppShellNavBody>
|
|
836
|
+
<SideNavigation defaultValue="orders">
|
|
837
|
+
<SideNavigationList>
|
|
838
|
+
<SideNavigationItem value="orders">
|
|
839
|
+
<SideNavigationLink href="#orders">
|
|
840
|
+
<SideNavigationIcon>
|
|
841
|
+
<Icon>
|
|
842
|
+
<Glyph name="inbox" />
|
|
843
|
+
</Icon>
|
|
844
|
+
</SideNavigationIcon>
|
|
845
|
+
<SideNavigationLabel>Orders</SideNavigationLabel>
|
|
846
|
+
</SideNavigationLink>
|
|
847
|
+
</SideNavigationItem>
|
|
848
|
+
<SideNavigationItem value="shipments">
|
|
849
|
+
<SideNavigationLink href="#shipments">
|
|
850
|
+
<SideNavigationIcon>
|
|
851
|
+
<Icon>
|
|
852
|
+
<Glyph name="calendar" />
|
|
853
|
+
</Icon>
|
|
854
|
+
</SideNavigationIcon>
|
|
855
|
+
<SideNavigationLabel>Shipments</SideNavigationLabel>
|
|
856
|
+
</SideNavigationLink>
|
|
857
|
+
</SideNavigationItem>
|
|
858
|
+
<SideNavigationItem value="reports">
|
|
859
|
+
<SideNavigationLink href="#reports">
|
|
860
|
+
<SideNavigationIcon>
|
|
861
|
+
<Icon>
|
|
862
|
+
<Glyph name="trending-up" />
|
|
863
|
+
</Icon>
|
|
864
|
+
</SideNavigationIcon>
|
|
865
|
+
<SideNavigationLabel>Reports</SideNavigationLabel>
|
|
866
|
+
</SideNavigationLink>
|
|
867
|
+
</SideNavigationItem>
|
|
868
|
+
</SideNavigationList>
|
|
869
|
+
</SideNavigation>
|
|
870
|
+
</AppShellNavBody>
|
|
871
|
+
</AppShellNav>
|
|
872
|
+
<AppShellMain>
|
|
873
|
+
<Stack gap={2}>
|
|
874
|
+
<Heading level={1} size="md">
|
|
875
|
+
Orders
|
|
876
|
+
</Heading>
|
|
877
|
+
<Text tone="muted">128 open orders, 14 awaiting payment.</Text>
|
|
878
|
+
<Inline gap={2}>
|
|
879
|
+
<Button onClick={handleRefresh}>Open reports</Button>
|
|
880
|
+
</Inline>
|
|
881
|
+
</Stack>
|
|
882
|
+
</AppShellMain>
|
|
883
|
+
<AppShellProgress loading={loading} />
|
|
884
|
+
</AppShell>
|
|
885
|
+
);
|
|
886
|
+
}
|
|
303
887
|
```
|
|
304
888
|
|
|
305
889
|
### The first thing a keyboard meets
|
|
@@ -336,15 +920,91 @@ Excerpt — not a complete module
|
|
|
336
920
|
|
|
337
921
|
AppShellDefaultsProvider takes every axis and the strings, so an application decides once how its routes are framed and a shell that states any of them itself still wins. ref gives an AppShellHandle rather than a DOM node: openNav, closeNav, openAside, closeAside and focusMain are the actions a prop cannot express. render makes the root the consumer’s own element and keeps every attribute on it.
|
|
338
922
|
|
|
339
|
-
|
|
923
|
+
Example
|
|
340
924
|
|
|
341
925
|
```tsx
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
926
|
+
import {
|
|
927
|
+
AppShell,
|
|
928
|
+
AppShellBanner,
|
|
929
|
+
AppShellBrand,
|
|
930
|
+
AppShellDefaultsProvider,
|
|
931
|
+
AppShellMain,
|
|
932
|
+
AppShellNav,
|
|
933
|
+
AppShellNavBody,
|
|
934
|
+
AppShellNavToggle,
|
|
935
|
+
} from '@slotted/react/app-shell';
|
|
936
|
+
import { Glyph, Icon } from '@slotted/react/icon';
|
|
937
|
+
import {
|
|
938
|
+
SideNavigation,
|
|
939
|
+
SideNavigationIcon,
|
|
940
|
+
SideNavigationItem,
|
|
941
|
+
SideNavigationLabel,
|
|
942
|
+
SideNavigationLink,
|
|
943
|
+
SideNavigationList,
|
|
944
|
+
} from '@slotted/react/side-navigation';
|
|
945
|
+
import { Stack } from '@slotted/react/stack';
|
|
946
|
+
import { Heading, Text } from '@slotted/react/typography';
|
|
947
|
+
|
|
948
|
+
export default function AppShellDefaultsExample() {
|
|
949
|
+
return (
|
|
950
|
+
<AppShellDefaultsProvider canvas="panel" navSize="sm" primary="nav">
|
|
951
|
+
<AppShell messages={{ skipToMain: 'Skip to the order list' }}>
|
|
952
|
+
<AppShellBanner>
|
|
953
|
+
<AppShellBrand>
|
|
954
|
+
<AppShellNavToggle />
|
|
955
|
+
<span>Northwind</span>
|
|
956
|
+
</AppShellBrand>
|
|
957
|
+
</AppShellBanner>
|
|
958
|
+
<AppShellNav>
|
|
959
|
+
<AppShellNavBody>
|
|
960
|
+
<SideNavigation defaultValue="orders">
|
|
961
|
+
<SideNavigationList>
|
|
962
|
+
<SideNavigationItem value="orders">
|
|
963
|
+
<SideNavigationLink href="#orders">
|
|
964
|
+
<SideNavigationIcon>
|
|
965
|
+
<Icon>
|
|
966
|
+
<Glyph name="inbox" />
|
|
967
|
+
</Icon>
|
|
968
|
+
</SideNavigationIcon>
|
|
969
|
+
<SideNavigationLabel>Orders</SideNavigationLabel>
|
|
970
|
+
</SideNavigationLink>
|
|
971
|
+
</SideNavigationItem>
|
|
972
|
+
<SideNavigationItem value="shipments">
|
|
973
|
+
<SideNavigationLink href="#shipments">
|
|
974
|
+
<SideNavigationIcon>
|
|
975
|
+
<Icon>
|
|
976
|
+
<Glyph name="calendar" />
|
|
977
|
+
</Icon>
|
|
978
|
+
</SideNavigationIcon>
|
|
979
|
+
<SideNavigationLabel>Shipments</SideNavigationLabel>
|
|
980
|
+
</SideNavigationLink>
|
|
981
|
+
</SideNavigationItem>
|
|
982
|
+
<SideNavigationItem value="reports">
|
|
983
|
+
<SideNavigationLink href="#reports">
|
|
984
|
+
<SideNavigationIcon>
|
|
985
|
+
<Icon>
|
|
986
|
+
<Glyph name="trending-up" />
|
|
987
|
+
</Icon>
|
|
988
|
+
</SideNavigationIcon>
|
|
989
|
+
<SideNavigationLabel>Reports</SideNavigationLabel>
|
|
990
|
+
</SideNavigationLink>
|
|
991
|
+
</SideNavigationItem>
|
|
992
|
+
</SideNavigationList>
|
|
993
|
+
</SideNavigation>
|
|
994
|
+
</AppShellNavBody>
|
|
995
|
+
</AppShellNav>
|
|
996
|
+
<AppShellMain>
|
|
997
|
+
<Stack gap={2}>
|
|
998
|
+
<Heading level={1} size="md">
|
|
999
|
+
Orders
|
|
1000
|
+
</Heading>
|
|
1001
|
+
<Text tone="muted">128 open orders, 14 awaiting payment.</Text>
|
|
1002
|
+
</Stack>
|
|
1003
|
+
</AppShellMain>
|
|
1004
|
+
</AppShell>
|
|
1005
|
+
</AppShellDefaultsProvider>
|
|
1006
|
+
);
|
|
1007
|
+
}
|
|
348
1008
|
```
|
|
349
1009
|
|
|
350
1010
|
### The families that live inside it
|
|
@@ -372,3 +1032,500 @@ Excerpt — not a complete module
|
|
|
372
1032
|
<AppShellNav aria-label="Main navigation">…</AppShellNav>;
|
|
373
1033
|
<AppShellAside aria-label="Order details">…</AppShellAside>;
|
|
374
1034
|
```
|
|
1035
|
+
|
|
1036
|
+
### arrangement.tsx
|
|
1037
|
+
|
|
1038
|
+
Example
|
|
1039
|
+
|
|
1040
|
+
```tsx
|
|
1041
|
+
import { useState } from 'react';
|
|
1042
|
+
import {
|
|
1043
|
+
AppShell,
|
|
1044
|
+
AppShellBanner,
|
|
1045
|
+
AppShellBrand,
|
|
1046
|
+
type AppShellCanvas,
|
|
1047
|
+
AppShellMain,
|
|
1048
|
+
AppShellNav,
|
|
1049
|
+
AppShellNavBody,
|
|
1050
|
+
AppShellNavToggle,
|
|
1051
|
+
type AppShellPrimary,
|
|
1052
|
+
type AppShellSeparation,
|
|
1053
|
+
} from '@slotted/react/app-shell';
|
|
1054
|
+
import { Glyph, Icon } from '@slotted/react/icon';
|
|
1055
|
+
import { Segment, SegmentedControl } from '@slotted/react/segmented-control';
|
|
1056
|
+
import {
|
|
1057
|
+
SideNavigation,
|
|
1058
|
+
SideNavigationIcon,
|
|
1059
|
+
SideNavigationItem,
|
|
1060
|
+
SideNavigationLabel,
|
|
1061
|
+
SideNavigationLink,
|
|
1062
|
+
SideNavigationList,
|
|
1063
|
+
} from '@slotted/react/side-navigation';
|
|
1064
|
+
import { Stack } from '@slotted/react/stack';
|
|
1065
|
+
import { Heading, Text } from '@slotted/react/typography';
|
|
1066
|
+
|
|
1067
|
+
export default function AppShellArrangementExample() {
|
|
1068
|
+
const [primary, setPrimary] = useState<AppShellPrimary>('banner');
|
|
1069
|
+
const [canvas, setCanvas] = useState<AppShellCanvas>('flush');
|
|
1070
|
+
const [separation, setSeparation] = useState<AppShellSeparation>('rule');
|
|
1071
|
+
|
|
1072
|
+
return (
|
|
1073
|
+
<Stack gap={3}>
|
|
1074
|
+
<SegmentedControl
|
|
1075
|
+
aria-label="Primary region"
|
|
1076
|
+
onValueChange={(next) => setPrimary(next as AppShellPrimary)}
|
|
1077
|
+
value={primary}
|
|
1078
|
+
>
|
|
1079
|
+
<Segment value="banner">Banner</Segment>
|
|
1080
|
+
<Segment value="nav">Nav</Segment>
|
|
1081
|
+
<Segment value="main">Main</Segment>
|
|
1082
|
+
</SegmentedControl>
|
|
1083
|
+
<SegmentedControl
|
|
1084
|
+
aria-label="Canvas"
|
|
1085
|
+
onValueChange={(next) => setCanvas(next as AppShellCanvas)}
|
|
1086
|
+
value={canvas}
|
|
1087
|
+
>
|
|
1088
|
+
<Segment value="inset">Inset</Segment>
|
|
1089
|
+
<Segment value="flush">Flush</Segment>
|
|
1090
|
+
<Segment value="floating">Floating</Segment>
|
|
1091
|
+
<Segment value="panel">Panel</Segment>
|
|
1092
|
+
</SegmentedControl>
|
|
1093
|
+
<SegmentedControl
|
|
1094
|
+
aria-label="Separation"
|
|
1095
|
+
onValueChange={(next) => setSeparation(next as AppShellSeparation)}
|
|
1096
|
+
value={separation}
|
|
1097
|
+
>
|
|
1098
|
+
<Segment value="rule">Rule</Segment>
|
|
1099
|
+
<Segment value="tone">Tone</Segment>
|
|
1100
|
+
</SegmentedControl>
|
|
1101
|
+
<AppShell canvas={canvas} primary={primary} separation={separation}>
|
|
1102
|
+
<AppShellBanner>
|
|
1103
|
+
<AppShellBrand>
|
|
1104
|
+
<AppShellNavToggle />
|
|
1105
|
+
<span>Northwind</span>
|
|
1106
|
+
</AppShellBrand>
|
|
1107
|
+
</AppShellBanner>
|
|
1108
|
+
<AppShellNav>
|
|
1109
|
+
<AppShellNavBody>
|
|
1110
|
+
<SideNavigation defaultValue="orders">
|
|
1111
|
+
<SideNavigationList>
|
|
1112
|
+
<SideNavigationItem value="orders">
|
|
1113
|
+
<SideNavigationLink href="#orders">
|
|
1114
|
+
<SideNavigationIcon>
|
|
1115
|
+
<Icon>
|
|
1116
|
+
<Glyph name="inbox" />
|
|
1117
|
+
</Icon>
|
|
1118
|
+
</SideNavigationIcon>
|
|
1119
|
+
<SideNavigationLabel>Orders</SideNavigationLabel>
|
|
1120
|
+
</SideNavigationLink>
|
|
1121
|
+
</SideNavigationItem>
|
|
1122
|
+
<SideNavigationItem value="shipments">
|
|
1123
|
+
<SideNavigationLink href="#shipments">
|
|
1124
|
+
<SideNavigationIcon>
|
|
1125
|
+
<Icon>
|
|
1126
|
+
<Glyph name="calendar" />
|
|
1127
|
+
</Icon>
|
|
1128
|
+
</SideNavigationIcon>
|
|
1129
|
+
<SideNavigationLabel>Shipments</SideNavigationLabel>
|
|
1130
|
+
</SideNavigationLink>
|
|
1131
|
+
</SideNavigationItem>
|
|
1132
|
+
<SideNavigationItem value="reports">
|
|
1133
|
+
<SideNavigationLink href="#reports">
|
|
1134
|
+
<SideNavigationIcon>
|
|
1135
|
+
<Icon>
|
|
1136
|
+
<Glyph name="trending-up" />
|
|
1137
|
+
</Icon>
|
|
1138
|
+
</SideNavigationIcon>
|
|
1139
|
+
<SideNavigationLabel>Reports</SideNavigationLabel>
|
|
1140
|
+
</SideNavigationLink>
|
|
1141
|
+
</SideNavigationItem>
|
|
1142
|
+
</SideNavigationList>
|
|
1143
|
+
</SideNavigation>
|
|
1144
|
+
</AppShellNavBody>
|
|
1145
|
+
</AppShellNav>
|
|
1146
|
+
<AppShellMain>
|
|
1147
|
+
<Stack gap={2}>
|
|
1148
|
+
<Heading level={1} size="md">
|
|
1149
|
+
Orders
|
|
1150
|
+
</Heading>
|
|
1151
|
+
<Text tone="muted">128 open orders, 14 awaiting payment.</Text>
|
|
1152
|
+
</Stack>
|
|
1153
|
+
</AppShellMain>
|
|
1154
|
+
</AppShell>
|
|
1155
|
+
</Stack>
|
|
1156
|
+
);
|
|
1157
|
+
}
|
|
1158
|
+
```
|
|
1159
|
+
|
|
1160
|
+
### dismissal.tsx
|
|
1161
|
+
|
|
1162
|
+
Example
|
|
1163
|
+
|
|
1164
|
+
```tsx
|
|
1165
|
+
import { useState } from 'react';
|
|
1166
|
+
import {
|
|
1167
|
+
AppShell,
|
|
1168
|
+
AppShellBanner,
|
|
1169
|
+
AppShellBrand,
|
|
1170
|
+
AppShellMain,
|
|
1171
|
+
AppShellNav,
|
|
1172
|
+
AppShellNavBody,
|
|
1173
|
+
AppShellNavFooter,
|
|
1174
|
+
AppShellNavToggle,
|
|
1175
|
+
} from '@slotted/react/app-shell';
|
|
1176
|
+
import { Button } from '@slotted/react/button';
|
|
1177
|
+
import { Glyph, Icon } from '@slotted/react/icon';
|
|
1178
|
+
import {
|
|
1179
|
+
SideNavigation,
|
|
1180
|
+
SideNavigationIcon,
|
|
1181
|
+
SideNavigationItem,
|
|
1182
|
+
SideNavigationLabel,
|
|
1183
|
+
SideNavigationLink,
|
|
1184
|
+
SideNavigationList,
|
|
1185
|
+
} from '@slotted/react/side-navigation';
|
|
1186
|
+
import { Stack } from '@slotted/react/stack';
|
|
1187
|
+
import { Heading, Text } from '@slotted/react/typography';
|
|
1188
|
+
|
|
1189
|
+
export default function AppShellDismissalExample() {
|
|
1190
|
+
const [open, setOpen] = useState(false);
|
|
1191
|
+
|
|
1192
|
+
return (
|
|
1193
|
+
<AppShell
|
|
1194
|
+
back="none"
|
|
1195
|
+
closeOnNavigate={false}
|
|
1196
|
+
escape="none"
|
|
1197
|
+
modal={false}
|
|
1198
|
+
navMode="overlay"
|
|
1199
|
+
navOpen={open}
|
|
1200
|
+
onNavOpenChange={setOpen}
|
|
1201
|
+
outsidePress="none"
|
|
1202
|
+
>
|
|
1203
|
+
<AppShellBanner>
|
|
1204
|
+
<AppShellBrand>
|
|
1205
|
+
<AppShellNavToggle />
|
|
1206
|
+
<span>Northwind</span>
|
|
1207
|
+
</AppShellBrand>
|
|
1208
|
+
</AppShellBanner>
|
|
1209
|
+
<AppShellNav>
|
|
1210
|
+
<AppShellNavBody>
|
|
1211
|
+
<SideNavigation defaultValue="orders">
|
|
1212
|
+
<SideNavigationList>
|
|
1213
|
+
<SideNavigationItem value="orders">
|
|
1214
|
+
<SideNavigationLink href="#orders">
|
|
1215
|
+
<SideNavigationIcon>
|
|
1216
|
+
<Icon>
|
|
1217
|
+
<Glyph name="inbox" />
|
|
1218
|
+
</Icon>
|
|
1219
|
+
</SideNavigationIcon>
|
|
1220
|
+
<SideNavigationLabel>Orders</SideNavigationLabel>
|
|
1221
|
+
</SideNavigationLink>
|
|
1222
|
+
</SideNavigationItem>
|
|
1223
|
+
<SideNavigationItem value="shipments">
|
|
1224
|
+
<SideNavigationLink href="#shipments">
|
|
1225
|
+
<SideNavigationIcon>
|
|
1226
|
+
<Icon>
|
|
1227
|
+
<Glyph name="calendar" />
|
|
1228
|
+
</Icon>
|
|
1229
|
+
</SideNavigationIcon>
|
|
1230
|
+
<SideNavigationLabel>Shipments</SideNavigationLabel>
|
|
1231
|
+
</SideNavigationLink>
|
|
1232
|
+
</SideNavigationItem>
|
|
1233
|
+
<SideNavigationItem value="reports">
|
|
1234
|
+
<SideNavigationLink href="#reports">
|
|
1235
|
+
<SideNavigationIcon>
|
|
1236
|
+
<Icon>
|
|
1237
|
+
<Glyph name="trending-up" />
|
|
1238
|
+
</Icon>
|
|
1239
|
+
</SideNavigationIcon>
|
|
1240
|
+
<SideNavigationLabel>Reports</SideNavigationLabel>
|
|
1241
|
+
</SideNavigationLink>
|
|
1242
|
+
</SideNavigationItem>
|
|
1243
|
+
</SideNavigationList>
|
|
1244
|
+
</SideNavigation>
|
|
1245
|
+
</AppShellNavBody>
|
|
1246
|
+
<AppShellNavFooter>
|
|
1247
|
+
<Button onClick={() => setOpen(false)}>Close navigation</Button>
|
|
1248
|
+
</AppShellNavFooter>
|
|
1249
|
+
</AppShellNav>
|
|
1250
|
+
<AppShellMain>
|
|
1251
|
+
<Stack gap={2}>
|
|
1252
|
+
<Heading level={1} size="md">
|
|
1253
|
+
Orders
|
|
1254
|
+
</Heading>
|
|
1255
|
+
<Text tone="muted">128 open orders, 14 awaiting payment.</Text>
|
|
1256
|
+
</Stack>
|
|
1257
|
+
</AppShellMain>
|
|
1258
|
+
</AppShell>
|
|
1259
|
+
);
|
|
1260
|
+
}
|
|
1261
|
+
```
|
|
1262
|
+
|
|
1263
|
+
### nav-rail.tsx
|
|
1264
|
+
|
|
1265
|
+
Example
|
|
1266
|
+
|
|
1267
|
+
```tsx
|
|
1268
|
+
import { useState } from 'react';
|
|
1269
|
+
import {
|
|
1270
|
+
AppShell,
|
|
1271
|
+
AppShellBanner,
|
|
1272
|
+
AppShellBrand,
|
|
1273
|
+
AppShellMain,
|
|
1274
|
+
AppShellNav,
|
|
1275
|
+
AppShellNavBody,
|
|
1276
|
+
AppShellNavHeader,
|
|
1277
|
+
AppShellNavRail,
|
|
1278
|
+
AppShellNavToggle,
|
|
1279
|
+
} from '@slotted/react/app-shell';
|
|
1280
|
+
import { IconButton } from '@slotted/react/button';
|
|
1281
|
+
import { Glyph, Icon } from '@slotted/react/icon';
|
|
1282
|
+
import {
|
|
1283
|
+
SideNavigation,
|
|
1284
|
+
SideNavigationIcon,
|
|
1285
|
+
SideNavigationItem,
|
|
1286
|
+
SideNavigationLabel,
|
|
1287
|
+
SideNavigationLink,
|
|
1288
|
+
SideNavigationList,
|
|
1289
|
+
} from '@slotted/react/side-navigation';
|
|
1290
|
+
import { Stack } from '@slotted/react/stack';
|
|
1291
|
+
import { Heading, Text } from '@slotted/react/typography';
|
|
1292
|
+
|
|
1293
|
+
export default function AppShellNavRailExample() {
|
|
1294
|
+
const [active, setActive] = useState('sales');
|
|
1295
|
+
const titles: Record<string, string> = {
|
|
1296
|
+
sales: 'Sales',
|
|
1297
|
+
warehouse: 'Warehouse',
|
|
1298
|
+
finance: 'Finance',
|
|
1299
|
+
};
|
|
1300
|
+
|
|
1301
|
+
return (
|
|
1302
|
+
<AppShell primary="main">
|
|
1303
|
+
<AppShellBanner>
|
|
1304
|
+
<AppShellBrand>
|
|
1305
|
+
<AppShellNavToggle />
|
|
1306
|
+
<span>Northwind</span>
|
|
1307
|
+
</AppShellBrand>
|
|
1308
|
+
</AppShellBanner>
|
|
1309
|
+
<AppShellNav>
|
|
1310
|
+
<AppShellNavRail aria-label="Modules">
|
|
1311
|
+
<IconButton
|
|
1312
|
+
aria-current={active === 'sales' ? 'true' : undefined}
|
|
1313
|
+
aria-label="Sales"
|
|
1314
|
+
onClick={() => setActive('sales')}
|
|
1315
|
+
tone="secondary"
|
|
1316
|
+
variant={active === 'sales' ? 'solid' : 'ghost'}
|
|
1317
|
+
>
|
|
1318
|
+
<Glyph name="inbox" />
|
|
1319
|
+
</IconButton>
|
|
1320
|
+
<IconButton
|
|
1321
|
+
aria-current={active === 'warehouse' ? 'true' : undefined}
|
|
1322
|
+
aria-label="Warehouse"
|
|
1323
|
+
onClick={() => setActive('warehouse')}
|
|
1324
|
+
tone="secondary"
|
|
1325
|
+
variant={active === 'warehouse' ? 'solid' : 'ghost'}
|
|
1326
|
+
>
|
|
1327
|
+
<Glyph name="calendar" />
|
|
1328
|
+
</IconButton>
|
|
1329
|
+
<IconButton
|
|
1330
|
+
aria-current={active === 'finance' ? 'true' : undefined}
|
|
1331
|
+
aria-label="Finance"
|
|
1332
|
+
onClick={() => setActive('finance')}
|
|
1333
|
+
tone="secondary"
|
|
1334
|
+
variant={active === 'finance' ? 'solid' : 'ghost'}
|
|
1335
|
+
>
|
|
1336
|
+
<Glyph name="trending-up" />
|
|
1337
|
+
</IconButton>
|
|
1338
|
+
<AppShellNavToggle />
|
|
1339
|
+
</AppShellNavRail>
|
|
1340
|
+
<AppShellNavHeader>{titles[active]}</AppShellNavHeader>
|
|
1341
|
+
<AppShellNavBody>
|
|
1342
|
+
{active === 'sales' && (
|
|
1343
|
+
<SideNavigation defaultValue="orders">
|
|
1344
|
+
<SideNavigationList>
|
|
1345
|
+
<SideNavigationItem value="orders">
|
|
1346
|
+
<SideNavigationLink href="#orders">
|
|
1347
|
+
<SideNavigationIcon>
|
|
1348
|
+
<Icon>
|
|
1349
|
+
<Glyph name="inbox" />
|
|
1350
|
+
</Icon>
|
|
1351
|
+
</SideNavigationIcon>
|
|
1352
|
+
<SideNavigationLabel>Orders</SideNavigationLabel>
|
|
1353
|
+
</SideNavigationLink>
|
|
1354
|
+
</SideNavigationItem>
|
|
1355
|
+
<SideNavigationItem value="quotes">
|
|
1356
|
+
<SideNavigationLink href="#quotes">
|
|
1357
|
+
<SideNavigationIcon>
|
|
1358
|
+
<Icon>
|
|
1359
|
+
<Glyph name="file-text" />
|
|
1360
|
+
</Icon>
|
|
1361
|
+
</SideNavigationIcon>
|
|
1362
|
+
<SideNavigationLabel>Quotes</SideNavigationLabel>
|
|
1363
|
+
</SideNavigationLink>
|
|
1364
|
+
</SideNavigationItem>
|
|
1365
|
+
</SideNavigationList>
|
|
1366
|
+
</SideNavigation>
|
|
1367
|
+
)}
|
|
1368
|
+
{active === 'warehouse' && (
|
|
1369
|
+
<SideNavigation defaultValue="shipments">
|
|
1370
|
+
<SideNavigationList>
|
|
1371
|
+
<SideNavigationItem value="shipments">
|
|
1372
|
+
<SideNavigationLink href="#shipments">
|
|
1373
|
+
<SideNavigationIcon>
|
|
1374
|
+
<Icon>
|
|
1375
|
+
<Glyph name="calendar" />
|
|
1376
|
+
</Icon>
|
|
1377
|
+
</SideNavigationIcon>
|
|
1378
|
+
<SideNavigationLabel>Shipments</SideNavigationLabel>
|
|
1379
|
+
</SideNavigationLink>
|
|
1380
|
+
</SideNavigationItem>
|
|
1381
|
+
<SideNavigationItem value="counts">
|
|
1382
|
+
<SideNavigationLink href="#counts">
|
|
1383
|
+
<SideNavigationIcon>
|
|
1384
|
+
<Icon>
|
|
1385
|
+
<Glyph name="clock" />
|
|
1386
|
+
</Icon>
|
|
1387
|
+
</SideNavigationIcon>
|
|
1388
|
+
<SideNavigationLabel>Cycle counts</SideNavigationLabel>
|
|
1389
|
+
</SideNavigationLink>
|
|
1390
|
+
</SideNavigationItem>
|
|
1391
|
+
</SideNavigationList>
|
|
1392
|
+
</SideNavigation>
|
|
1393
|
+
)}
|
|
1394
|
+
{active === 'finance' && (
|
|
1395
|
+
<SideNavigation defaultValue="invoices">
|
|
1396
|
+
<SideNavigationList>
|
|
1397
|
+
<SideNavigationItem value="invoices">
|
|
1398
|
+
<SideNavigationLink href="#invoices">
|
|
1399
|
+
<SideNavigationIcon>
|
|
1400
|
+
<Icon>
|
|
1401
|
+
<Glyph name="file-spreadsheet" />
|
|
1402
|
+
</Icon>
|
|
1403
|
+
</SideNavigationIcon>
|
|
1404
|
+
<SideNavigationLabel>Invoices</SideNavigationLabel>
|
|
1405
|
+
</SideNavigationLink>
|
|
1406
|
+
</SideNavigationItem>
|
|
1407
|
+
<SideNavigationItem value="reports">
|
|
1408
|
+
<SideNavigationLink href="#reports">
|
|
1409
|
+
<SideNavigationIcon>
|
|
1410
|
+
<Icon>
|
|
1411
|
+
<Glyph name="trending-up" />
|
|
1412
|
+
</Icon>
|
|
1413
|
+
</SideNavigationIcon>
|
|
1414
|
+
<SideNavigationLabel>Reports</SideNavigationLabel>
|
|
1415
|
+
</SideNavigationLink>
|
|
1416
|
+
</SideNavigationItem>
|
|
1417
|
+
</SideNavigationList>
|
|
1418
|
+
</SideNavigation>
|
|
1419
|
+
)}
|
|
1420
|
+
</AppShellNavBody>
|
|
1421
|
+
</AppShellNav>
|
|
1422
|
+
<AppShellMain>
|
|
1423
|
+
<Stack gap={2}>
|
|
1424
|
+
<Heading level={1} size="md">
|
|
1425
|
+
Orders
|
|
1426
|
+
</Heading>
|
|
1427
|
+
<Text tone="muted">128 open orders, 14 awaiting payment.</Text>
|
|
1428
|
+
</Stack>
|
|
1429
|
+
</AppShellMain>
|
|
1430
|
+
</AppShell>
|
|
1431
|
+
);
|
|
1432
|
+
}
|
|
1433
|
+
```
|
|
1434
|
+
|
|
1435
|
+
### reasons.tsx
|
|
1436
|
+
|
|
1437
|
+
Example
|
|
1438
|
+
|
|
1439
|
+
```tsx
|
|
1440
|
+
import { useState } from 'react';
|
|
1441
|
+
import {
|
|
1442
|
+
AppShell,
|
|
1443
|
+
AppShellBanner,
|
|
1444
|
+
AppShellBrand,
|
|
1445
|
+
AppShellMain,
|
|
1446
|
+
AppShellNav,
|
|
1447
|
+
AppShellNavBody,
|
|
1448
|
+
AppShellNavToggle,
|
|
1449
|
+
} from '@slotted/react/app-shell';
|
|
1450
|
+
import { Glyph, Icon } from '@slotted/react/icon';
|
|
1451
|
+
import {
|
|
1452
|
+
SideNavigation,
|
|
1453
|
+
SideNavigationIcon,
|
|
1454
|
+
SideNavigationItem,
|
|
1455
|
+
SideNavigationLabel,
|
|
1456
|
+
SideNavigationLink,
|
|
1457
|
+
SideNavigationList,
|
|
1458
|
+
} from '@slotted/react/side-navigation';
|
|
1459
|
+
import { Stack } from '@slotted/react/stack';
|
|
1460
|
+
import { Heading, Text } from '@slotted/react/typography';
|
|
1461
|
+
|
|
1462
|
+
export default function AppShellReasonsExample() {
|
|
1463
|
+
const [open, setOpen] = useState(false);
|
|
1464
|
+
const [reason, setReason] = useState('none yet');
|
|
1465
|
+
|
|
1466
|
+
return (
|
|
1467
|
+
<AppShell
|
|
1468
|
+
navMode="overlay"
|
|
1469
|
+
navOpen={open}
|
|
1470
|
+
onNavOpenChange={(next, request) => {
|
|
1471
|
+
setOpen(next);
|
|
1472
|
+
setReason(request.reason);
|
|
1473
|
+
}}
|
|
1474
|
+
>
|
|
1475
|
+
<AppShellBanner>
|
|
1476
|
+
<AppShellBrand>
|
|
1477
|
+
<AppShellNavToggle />
|
|
1478
|
+
<span>Northwind</span>
|
|
1479
|
+
</AppShellBrand>
|
|
1480
|
+
</AppShellBanner>
|
|
1481
|
+
<AppShellNav>
|
|
1482
|
+
<AppShellNavBody>
|
|
1483
|
+
<SideNavigation defaultValue="orders">
|
|
1484
|
+
<SideNavigationList>
|
|
1485
|
+
<SideNavigationItem value="orders">
|
|
1486
|
+
<SideNavigationLink href="#orders">
|
|
1487
|
+
<SideNavigationIcon>
|
|
1488
|
+
<Icon>
|
|
1489
|
+
<Glyph name="inbox" />
|
|
1490
|
+
</Icon>
|
|
1491
|
+
</SideNavigationIcon>
|
|
1492
|
+
<SideNavigationLabel>Orders</SideNavigationLabel>
|
|
1493
|
+
</SideNavigationLink>
|
|
1494
|
+
</SideNavigationItem>
|
|
1495
|
+
<SideNavigationItem value="shipments">
|
|
1496
|
+
<SideNavigationLink href="#shipments">
|
|
1497
|
+
<SideNavigationIcon>
|
|
1498
|
+
<Icon>
|
|
1499
|
+
<Glyph name="calendar" />
|
|
1500
|
+
</Icon>
|
|
1501
|
+
</SideNavigationIcon>
|
|
1502
|
+
<SideNavigationLabel>Shipments</SideNavigationLabel>
|
|
1503
|
+
</SideNavigationLink>
|
|
1504
|
+
</SideNavigationItem>
|
|
1505
|
+
<SideNavigationItem value="reports">
|
|
1506
|
+
<SideNavigationLink href="#reports">
|
|
1507
|
+
<SideNavigationIcon>
|
|
1508
|
+
<Icon>
|
|
1509
|
+
<Glyph name="trending-up" />
|
|
1510
|
+
</Icon>
|
|
1511
|
+
</SideNavigationIcon>
|
|
1512
|
+
<SideNavigationLabel>Reports</SideNavigationLabel>
|
|
1513
|
+
</SideNavigationLink>
|
|
1514
|
+
</SideNavigationItem>
|
|
1515
|
+
</SideNavigationList>
|
|
1516
|
+
</SideNavigation>
|
|
1517
|
+
</AppShellNavBody>
|
|
1518
|
+
</AppShellNav>
|
|
1519
|
+
<AppShellMain>
|
|
1520
|
+
<Stack gap={2}>
|
|
1521
|
+
<Heading level={1} size="md">
|
|
1522
|
+
Orders
|
|
1523
|
+
</Heading>
|
|
1524
|
+
<Text tone="muted">128 open orders, 14 awaiting payment.</Text>
|
|
1525
|
+
<Text size="sm">Last request: {reason}</Text>
|
|
1526
|
+
</Stack>
|
|
1527
|
+
</AppShellMain>
|
|
1528
|
+
</AppShell>
|
|
1529
|
+
);
|
|
1530
|
+
}
|
|
1531
|
+
```
|