@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,558 @@
|
|
|
1
|
+
<!-- index: ./index.md -->
|
|
2
|
+
# fullscreen
|
|
3
|
+
|
|
4
|
+
`data-ui="fullscreen"` · Enters and leaves fullscreen for an element.
|
|
5
|
+
|
|
6
|
+
## Examples
|
|
7
|
+
|
|
8
|
+
### Playground
|
|
9
|
+
|
|
10
|
+
A revenue panel with its control in the header. Press it: the panel takes the screen through the browser, the words become “Exit full screen” and the mark turns inward. Escape, or the control again, gives the page back with the scroll where it was.
|
|
11
|
+
|
|
12
|
+
Excerpt — not a complete module
|
|
13
|
+
|
|
14
|
+
```tsx
|
|
15
|
+
<Fullscreen>
|
|
16
|
+
<FullscreenContent>
|
|
17
|
+
<Chart actions={<FullscreenTrigger iconOnly />} title="Revenue by month" {...revenue} />
|
|
18
|
+
</FullscreenContent>
|
|
19
|
+
</Fullscreen>;
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
### Inside the page, where the browser will not
|
|
23
|
+
|
|
24
|
+
mode="layout" never asks the browser: the region is fixed over the page, the page behind stops scrolling, and Escape leaves. It is the picture an iframe without allow="fullscreen" or a phone browser gets under the default mode too.
|
|
25
|
+
|
|
26
|
+
Example
|
|
27
|
+
|
|
28
|
+
```tsx
|
|
29
|
+
import { Card, CardBody, CardHeader } from '@slotted/react/card';
|
|
30
|
+
import { Fullscreen, FullscreenTrigger } from '@slotted/react/fullscreen';
|
|
31
|
+
import { Inline } from '@slotted/react/inline';
|
|
32
|
+
import { Stack } from '@slotted/react/stack';
|
|
33
|
+
import { Heading, Text } from '@slotted/react/typography';
|
|
34
|
+
|
|
35
|
+
export default function FullscreenLayoutExample() {
|
|
36
|
+
return (
|
|
37
|
+
<Fullscreen mode="layout">
|
|
38
|
+
<Card>
|
|
39
|
+
<CardHeader>
|
|
40
|
+
<Inline align="center" justify="between">
|
|
41
|
+
<Heading level={2} size="md">
|
|
42
|
+
Supply agreement
|
|
43
|
+
</Heading>
|
|
44
|
+
<FullscreenTrigger />
|
|
45
|
+
</Inline>
|
|
46
|
+
</CardHeader>
|
|
47
|
+
<CardBody>
|
|
48
|
+
<Stack gap={3}>
|
|
49
|
+
<Text>
|
|
50
|
+
4.1 Delivery. Meridian Packaging delivers pallets to the Rotterdam warehouse every
|
|
51
|
+
Tuesday and Friday before 14:00.
|
|
52
|
+
</Text>
|
|
53
|
+
<Text>
|
|
54
|
+
4.2 Payment. Northwind settles each invoice 30 days after the delivery date.
|
|
55
|
+
</Text>
|
|
56
|
+
<Text>4.3 Returns. Damaged pallets are collected within 5 working days.</Text>
|
|
57
|
+
</Stack>
|
|
58
|
+
</CardBody>
|
|
59
|
+
</Card>
|
|
60
|
+
</Fullscreen>
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### The height of the screen, not only its width
|
|
66
|
+
|
|
67
|
+
The browser stretches the region and none of its children. FullscreenContent takes the height a bar and a caption leave, and the chart’s plot grows into it; a region with a single card gives the card the height instead.
|
|
68
|
+
|
|
69
|
+
Excerpt — not a complete module
|
|
70
|
+
|
|
71
|
+
```tsx
|
|
72
|
+
<Fullscreen>
|
|
73
|
+
<Toolbar>
|
|
74
|
+
<FullscreenTrigger />
|
|
75
|
+
</Toolbar>
|
|
76
|
+
<FullscreenContent>
|
|
77
|
+
<Chart title="Revenue by month" {...revenue} />
|
|
78
|
+
</FullscreenContent>
|
|
79
|
+
<Text>Source: accounting close.</Text>
|
|
80
|
+
</Fullscreen>;
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### The page holds the state
|
|
84
|
+
|
|
85
|
+
The page owns fullscreen and every change arrives as a request with its reason: pointer or keyboard from the control, escape when the reader left on their own. The log under the panel prints each one.
|
|
86
|
+
|
|
87
|
+
Example
|
|
88
|
+
|
|
89
|
+
```tsx
|
|
90
|
+
import { useState } from 'react';
|
|
91
|
+
|
|
92
|
+
import { Card, CardBody, CardHeader } from '@slotted/react/card';
|
|
93
|
+
import { Fullscreen, FullscreenTrigger } from '@slotted/react/fullscreen';
|
|
94
|
+
import type { FullscreenChangeRequest } from '@slotted/react/fullscreen';
|
|
95
|
+
import { Inline } from '@slotted/react/inline';
|
|
96
|
+
import { Stack } from '@slotted/react/stack';
|
|
97
|
+
import { Heading, Text } from '@slotted/react/typography';
|
|
98
|
+
|
|
99
|
+
export default function FullscreenControlledExample() {
|
|
100
|
+
const [presenting, setPresenting] = useState(false);
|
|
101
|
+
const [reason, setReason] = useState('none yet');
|
|
102
|
+
|
|
103
|
+
function handleChange(next: boolean, request: FullscreenChangeRequest) {
|
|
104
|
+
setReason(request.reason);
|
|
105
|
+
setPresenting(next);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
return (
|
|
109
|
+
<Fullscreen fullscreen={presenting} onFullscreenChange={handleChange}>
|
|
110
|
+
<Card>
|
|
111
|
+
<CardHeader>
|
|
112
|
+
<Inline align="center" justify="between">
|
|
113
|
+
<Heading level={2} size="md">
|
|
114
|
+
Cold storage
|
|
115
|
+
</Heading>
|
|
116
|
+
<FullscreenTrigger />
|
|
117
|
+
</Inline>
|
|
118
|
+
</CardHeader>
|
|
119
|
+
<CardBody>
|
|
120
|
+
<Stack gap={2}>
|
|
121
|
+
<Text>Full screen: {presenting ? 'on' : 'off'}</Text>
|
|
122
|
+
<Text>Last request: {reason}</Text>
|
|
123
|
+
</Stack>
|
|
124
|
+
</CardBody>
|
|
125
|
+
</Card>
|
|
126
|
+
</Fullscreen>
|
|
127
|
+
);
|
|
128
|
+
}
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### Refused, and still full screen
|
|
132
|
+
|
|
133
|
+
When the browser has no API or refuses, the region enters the layout and onFullscreenError says why — unsupported or refused. The panel prints the last error. A controlled page that prefers no layout fallback sets the state back to false from the same handler.
|
|
134
|
+
|
|
135
|
+
Example
|
|
136
|
+
|
|
137
|
+
```tsx
|
|
138
|
+
import { useState } from 'react';
|
|
139
|
+
|
|
140
|
+
import { Card, CardBody, CardHeader } from '@slotted/react/card';
|
|
141
|
+
import { Fullscreen, FullscreenTrigger } from '@slotted/react/fullscreen';
|
|
142
|
+
import type { FullscreenError } from '@slotted/react/fullscreen';
|
|
143
|
+
import { Inline } from '@slotted/react/inline';
|
|
144
|
+
import { Heading, Text } from '@slotted/react/typography';
|
|
145
|
+
|
|
146
|
+
export default function FullscreenErrorExample() {
|
|
147
|
+
const [failure, setFailure] = useState<FullscreenError | null>(null);
|
|
148
|
+
|
|
149
|
+
function handleError(error: FullscreenError) {
|
|
150
|
+
setFailure(error);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
return (
|
|
154
|
+
<Fullscreen onFullscreenError={handleError}>
|
|
155
|
+
<Card>
|
|
156
|
+
<CardHeader>
|
|
157
|
+
<Inline align="center" justify="between">
|
|
158
|
+
<Heading level={2} size="md">
|
|
159
|
+
Warehouse floor plan
|
|
160
|
+
</Heading>
|
|
161
|
+
<FullscreenTrigger />
|
|
162
|
+
</Inline>
|
|
163
|
+
</CardHeader>
|
|
164
|
+
<CardBody>
|
|
165
|
+
<Text>Last error: {failure?.kind ?? 'none'}</Text>
|
|
166
|
+
</CardBody>
|
|
167
|
+
</Card>
|
|
168
|
+
</Fullscreen>
|
|
169
|
+
);
|
|
170
|
+
}
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
### A menu opened from inside
|
|
174
|
+
|
|
175
|
+
The select in the panel opens its list inside the region while it is full screen: the portal root follows the element the browser shows. Escape in the layout closes the list first and the region on the second press.
|
|
176
|
+
|
|
177
|
+
Example
|
|
178
|
+
|
|
179
|
+
```tsx
|
|
180
|
+
import { Card, CardBody, CardHeader } from '@slotted/react/card';
|
|
181
|
+
import { Fullscreen, FullscreenTrigger } from '@slotted/react/fullscreen';
|
|
182
|
+
import { Inline } from '@slotted/react/inline';
|
|
183
|
+
import {
|
|
184
|
+
Select,
|
|
185
|
+
SelectContent,
|
|
186
|
+
SelectItem,
|
|
187
|
+
type SelectOption,
|
|
188
|
+
SelectTrigger,
|
|
189
|
+
SelectValue,
|
|
190
|
+
} from '@slotted/react/select';
|
|
191
|
+
import { Stack } from '@slotted/react/stack';
|
|
192
|
+
import { Heading, Text } from '@slotted/react/typography';
|
|
193
|
+
|
|
194
|
+
const PERIODS: SelectOption[] = [
|
|
195
|
+
{ value: '30d', label: 'Last 30 days' },
|
|
196
|
+
{ value: '90d', label: 'Last 90 days' },
|
|
197
|
+
{ value: 'ytd', label: 'Year to date' },
|
|
198
|
+
];
|
|
199
|
+
|
|
200
|
+
export default function FullscreenOverlaysExample() {
|
|
201
|
+
return (
|
|
202
|
+
<Fullscreen>
|
|
203
|
+
<Card>
|
|
204
|
+
<CardHeader>
|
|
205
|
+
<Inline align="center" justify="between">
|
|
206
|
+
<Heading level={2} size="md">
|
|
207
|
+
Open purchase orders
|
|
208
|
+
</Heading>
|
|
209
|
+
<FullscreenTrigger />
|
|
210
|
+
</Inline>
|
|
211
|
+
</CardHeader>
|
|
212
|
+
<CardBody>
|
|
213
|
+
<Stack gap={3}>
|
|
214
|
+
<Select defaultValue="90d" items={PERIODS}>
|
|
215
|
+
<SelectTrigger aria-label="Period">
|
|
216
|
+
<SelectValue />
|
|
217
|
+
</SelectTrigger>
|
|
218
|
+
<SelectContent>
|
|
219
|
+
{PERIODS.map((period) => (
|
|
220
|
+
<SelectItem key={period.value} value={period.value}>
|
|
221
|
+
{period.label}
|
|
222
|
+
</SelectItem>
|
|
223
|
+
))}
|
|
224
|
+
</SelectContent>
|
|
225
|
+
</Select>
|
|
226
|
+
<Text>38 orders waiting for a delivery date.</Text>
|
|
227
|
+
</Stack>
|
|
228
|
+
</CardBody>
|
|
229
|
+
</Card>
|
|
230
|
+
</Fullscreen>
|
|
231
|
+
);
|
|
232
|
+
}
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
### The whole document
|
|
236
|
+
|
|
237
|
+
useFullscreen takes any element — here document.documentElement — and hands its handle to a control that is not inside any region. Presentation mode for the whole application is this line and nothing else.
|
|
238
|
+
|
|
239
|
+
Excerpt — not a complete module
|
|
240
|
+
|
|
241
|
+
```tsx
|
|
242
|
+
const page = useFullscreen(document.documentElement);
|
|
243
|
+
|
|
244
|
+
<FullscreenTrigger target={page} variant="outline" />;
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
### The keyboard, key by key
|
|
248
|
+
|
|
249
|
+
Tab reaches the control, Space or Enter presses it and the reason says keyboard. While full screen, Tab wraps inside the region. Escape in native full screen belongs to the browser — Fullscreen writes no listener and reports the leave as escape.
|
|
250
|
+
|
|
251
|
+
Excerpt — not a complete module
|
|
252
|
+
|
|
253
|
+
```tsx
|
|
254
|
+
<Fullscreen onFullscreenChange={(next, request) => log(request.reason)}>
|
|
255
|
+
<FullscreenTrigger />
|
|
256
|
+
</Fullscreen>;
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
### The control: two variants, three steps, every state
|
|
260
|
+
|
|
261
|
+
ghost stands in a bar that is already framed, outline over content and carries its own ground. Each step reads the control scale, so the control lines up with a button of the same step. Disabled keeps the words legible and refuses the press.
|
|
262
|
+
|
|
263
|
+
Example
|
|
264
|
+
|
|
265
|
+
```tsx
|
|
266
|
+
import { Fullscreen, FullscreenTrigger } from '@slotted/react/fullscreen';
|
|
267
|
+
import { Inline } from '@slotted/react/inline';
|
|
268
|
+
import { Stack } from '@slotted/react/stack';
|
|
269
|
+
import { Text } from '@slotted/react/typography';
|
|
270
|
+
|
|
271
|
+
export default function FullscreenTriggerExample() {
|
|
272
|
+
return (
|
|
273
|
+
<Fullscreen>
|
|
274
|
+
<Stack gap={3}>
|
|
275
|
+
<Text size="sm" tone="muted">
|
|
276
|
+
Ghost, steps sm, md and lg
|
|
277
|
+
</Text>
|
|
278
|
+
<Inline align="center" gap={3}>
|
|
279
|
+
<FullscreenTrigger size="sm" />
|
|
280
|
+
<FullscreenTrigger size="md" />
|
|
281
|
+
<FullscreenTrigger size="lg" />
|
|
282
|
+
</Inline>
|
|
283
|
+
<Text size="sm" tone="muted">
|
|
284
|
+
Outline, steps sm, md and lg
|
|
285
|
+
</Text>
|
|
286
|
+
<Inline align="center" gap={3}>
|
|
287
|
+
<FullscreenTrigger size="sm" variant="outline" />
|
|
288
|
+
<FullscreenTrigger size="md" variant="outline" />
|
|
289
|
+
<FullscreenTrigger size="lg" variant="outline" />
|
|
290
|
+
</Inline>
|
|
291
|
+
<Text size="sm" tone="muted">
|
|
292
|
+
Disabled
|
|
293
|
+
</Text>
|
|
294
|
+
<Inline align="center" gap={3}>
|
|
295
|
+
<FullscreenTrigger disabled />
|
|
296
|
+
</Inline>
|
|
297
|
+
</Stack>
|
|
298
|
+
</Fullscreen>
|
|
299
|
+
);
|
|
300
|
+
}
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
### The mark alone
|
|
304
|
+
|
|
305
|
+
iconOnly draws the control square from its height and keeps the words, visually hidden, as its name — so it still says “Exit full screen” to a screen reader when the mark turns inward.
|
|
306
|
+
|
|
307
|
+
Excerpt — not a complete module
|
|
308
|
+
|
|
309
|
+
```tsx
|
|
310
|
+
<FullscreenTrigger iconOnly />;
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
### The control outside the region
|
|
314
|
+
|
|
315
|
+
A toolbar above a chart holds the control; the chart is the region. useFullscreen gives the handle, target hands it to the control, and the control changes with the chart’s state. Inside the region, a second control takes the reader back.
|
|
316
|
+
|
|
317
|
+
Excerpt — not a complete module
|
|
318
|
+
|
|
319
|
+
```tsx
|
|
320
|
+
const [chart, setChart] = useState<HTMLElement | null>(null);
|
|
321
|
+
const handle = useFullscreen(chart);
|
|
322
|
+
|
|
323
|
+
<>
|
|
324
|
+
<FullscreenTrigger target={handle} />
|
|
325
|
+
<section ref={setChart}>…</section>
|
|
326
|
+
</>;
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
### Defaults once, words and mark of the consumer
|
|
330
|
+
|
|
331
|
+
A provider sets the mode, the navigation interface, the control’s step and its variant for a subtree. children and icon take a function of the state, so a “Present” control keeps following it; render puts the wiring on the consumer’s own element.
|
|
332
|
+
|
|
333
|
+
Excerpt — not a complete module
|
|
334
|
+
|
|
335
|
+
```tsx
|
|
336
|
+
<FullscreenDefaultsProvider size="sm">
|
|
337
|
+
<Fullscreen>
|
|
338
|
+
<FullscreenTrigger
|
|
339
|
+
icon={(on) => (
|
|
340
|
+
<Icon>
|
|
341
|
+
<Glyph name={on ? 'x' : 'presentation'} />
|
|
342
|
+
</Icon>
|
|
343
|
+
)}
|
|
344
|
+
>
|
|
345
|
+
{(on) => (on ? 'End presentation' : 'Present')}
|
|
346
|
+
</FullscreenTrigger>
|
|
347
|
+
</Fullscreen>
|
|
348
|
+
</FullscreenDefaultsProvider>;
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
### content.tsx
|
|
352
|
+
|
|
353
|
+
Example
|
|
354
|
+
|
|
355
|
+
```tsx
|
|
356
|
+
import { Card, CardBody } from '@slotted/react/card';
|
|
357
|
+
import {
|
|
358
|
+
DescriptionList,
|
|
359
|
+
DescriptionListDescription,
|
|
360
|
+
DescriptionListItem,
|
|
361
|
+
DescriptionListTerm,
|
|
362
|
+
} from '@slotted/react/description-list';
|
|
363
|
+
import { Fullscreen, FullscreenContent, FullscreenTrigger } from '@slotted/react/fullscreen';
|
|
364
|
+
import { Inline } from '@slotted/react/inline';
|
|
365
|
+
import { Heading, Text } from '@slotted/react/typography';
|
|
366
|
+
|
|
367
|
+
const REGIONS = [
|
|
368
|
+
{ term: 'Northern Europe', value: '€2.41M' },
|
|
369
|
+
{ term: 'DACH', value: '€1.76M' },
|
|
370
|
+
{ term: 'Iberia', value: '€1.18M' },
|
|
371
|
+
{ term: 'Nordics', value: '€0.94M' },
|
|
372
|
+
];
|
|
373
|
+
|
|
374
|
+
export default function FullscreenContentExample() {
|
|
375
|
+
return (
|
|
376
|
+
<Fullscreen>
|
|
377
|
+
<Inline align="center" justify="between">
|
|
378
|
+
<Heading level={2} size="md">
|
|
379
|
+
Q3 revenue by region
|
|
380
|
+
</Heading>
|
|
381
|
+
<FullscreenTrigger />
|
|
382
|
+
</Inline>
|
|
383
|
+
|
|
384
|
+
<FullscreenContent>
|
|
385
|
+
<Card>
|
|
386
|
+
<CardBody>
|
|
387
|
+
<DescriptionList>
|
|
388
|
+
{REGIONS.map(({ term, value }) => (
|
|
389
|
+
<DescriptionListItem key={term}>
|
|
390
|
+
<DescriptionListTerm>{term}</DescriptionListTerm>
|
|
391
|
+
<DescriptionListDescription>{value}</DescriptionListDescription>
|
|
392
|
+
</DescriptionListItem>
|
|
393
|
+
))}
|
|
394
|
+
</DescriptionList>
|
|
395
|
+
</CardBody>
|
|
396
|
+
</Card>
|
|
397
|
+
</FullscreenContent>
|
|
398
|
+
|
|
399
|
+
<Text size="sm" tone="muted">
|
|
400
|
+
Source: accounting close.
|
|
401
|
+
</Text>
|
|
402
|
+
</Fullscreen>
|
|
403
|
+
);
|
|
404
|
+
}
|
|
405
|
+
```
|
|
406
|
+
|
|
407
|
+
### defaults.tsx
|
|
408
|
+
|
|
409
|
+
Example
|
|
410
|
+
|
|
411
|
+
```tsx
|
|
412
|
+
import { Card, CardBody } from '@slotted/react/card';
|
|
413
|
+
import {
|
|
414
|
+
Fullscreen,
|
|
415
|
+
FullscreenDefaultsProvider,
|
|
416
|
+
FullscreenTrigger,
|
|
417
|
+
} from '@slotted/react/fullscreen';
|
|
418
|
+
import { Inline } from '@slotted/react/inline';
|
|
419
|
+
import { Stack } from '@slotted/react/stack';
|
|
420
|
+
import { Text } from '@slotted/react/typography';
|
|
421
|
+
|
|
422
|
+
export default function FullscreenDefaultsExample() {
|
|
423
|
+
return (
|
|
424
|
+
<FullscreenDefaultsProvider mode="layout" size="sm" variant="outline">
|
|
425
|
+
<Stack gap={3}>
|
|
426
|
+
<Fullscreen>
|
|
427
|
+
<Card>
|
|
428
|
+
<CardBody>
|
|
429
|
+
<Inline align="center" justify="between">
|
|
430
|
+
<Text>Inbound dock</Text>
|
|
431
|
+
<FullscreenTrigger />
|
|
432
|
+
</Inline>
|
|
433
|
+
</CardBody>
|
|
434
|
+
</Card>
|
|
435
|
+
</Fullscreen>
|
|
436
|
+
|
|
437
|
+
<Fullscreen>
|
|
438
|
+
<Card>
|
|
439
|
+
<CardBody>
|
|
440
|
+
<Inline align="center" justify="between">
|
|
441
|
+
<Text>Outbound dock</Text>
|
|
442
|
+
<FullscreenTrigger />
|
|
443
|
+
</Inline>
|
|
444
|
+
</CardBody>
|
|
445
|
+
</Card>
|
|
446
|
+
</Fullscreen>
|
|
447
|
+
|
|
448
|
+
<Fullscreen>
|
|
449
|
+
<Card>
|
|
450
|
+
<CardBody>
|
|
451
|
+
<Inline align="center" justify="between">
|
|
452
|
+
<Text>Returns dock</Text>
|
|
453
|
+
<FullscreenTrigger size="lg" variant="ghost" />
|
|
454
|
+
</Inline>
|
|
455
|
+
</CardBody>
|
|
456
|
+
</Card>
|
|
457
|
+
</Fullscreen>
|
|
458
|
+
</Stack>
|
|
459
|
+
</FullscreenDefaultsProvider>
|
|
460
|
+
);
|
|
461
|
+
}
|
|
462
|
+
```
|
|
463
|
+
|
|
464
|
+
### icon-only.tsx
|
|
465
|
+
|
|
466
|
+
Example
|
|
467
|
+
|
|
468
|
+
```tsx
|
|
469
|
+
import { Card, CardBody, CardHeader } from '@slotted/react/card';
|
|
470
|
+
import {
|
|
471
|
+
DescriptionList,
|
|
472
|
+
DescriptionListDescription,
|
|
473
|
+
DescriptionListItem,
|
|
474
|
+
DescriptionListTerm,
|
|
475
|
+
} from '@slotted/react/description-list';
|
|
476
|
+
import { Fullscreen, FullscreenTrigger } from '@slotted/react/fullscreen';
|
|
477
|
+
import { Inline } from '@slotted/react/inline';
|
|
478
|
+
import { Heading } from '@slotted/react/typography';
|
|
479
|
+
|
|
480
|
+
const DOCKS = [
|
|
481
|
+
{ term: 'Dock 1', value: 'Inbound, 06:00' },
|
|
482
|
+
{ term: 'Dock 2', value: 'Outbound, 08:30' },
|
|
483
|
+
{ term: 'Dock 3', value: 'Returns, 11:15' },
|
|
484
|
+
];
|
|
485
|
+
|
|
486
|
+
export default function FullscreenIconOnlyExample() {
|
|
487
|
+
return (
|
|
488
|
+
<Fullscreen>
|
|
489
|
+
<Card>
|
|
490
|
+
<CardHeader>
|
|
491
|
+
<Inline align="center" justify="between">
|
|
492
|
+
<Heading level={2} size="md">
|
|
493
|
+
Dock schedule
|
|
494
|
+
</Heading>
|
|
495
|
+
<FullscreenTrigger iconOnly variant="outline" />
|
|
496
|
+
</Inline>
|
|
497
|
+
</CardHeader>
|
|
498
|
+
<CardBody>
|
|
499
|
+
<DescriptionList>
|
|
500
|
+
{DOCKS.map(({ term, value }) => (
|
|
501
|
+
<DescriptionListItem key={term}>
|
|
502
|
+
<DescriptionListTerm>{term}</DescriptionListTerm>
|
|
503
|
+
<DescriptionListDescription>{value}</DescriptionListDescription>
|
|
504
|
+
</DescriptionListItem>
|
|
505
|
+
))}
|
|
506
|
+
</DescriptionList>
|
|
507
|
+
</CardBody>
|
|
508
|
+
</Card>
|
|
509
|
+
</Fullscreen>
|
|
510
|
+
);
|
|
511
|
+
}
|
|
512
|
+
```
|
|
513
|
+
|
|
514
|
+
### words.tsx
|
|
515
|
+
|
|
516
|
+
Example
|
|
517
|
+
|
|
518
|
+
```tsx
|
|
519
|
+
import { Card, CardBody, CardHeader } from '@slotted/react/card';
|
|
520
|
+
import { Fullscreen, FullscreenTrigger } from '@slotted/react/fullscreen';
|
|
521
|
+
import { Glyph, Icon } from '@slotted/react/icon';
|
|
522
|
+
import { Inline } from '@slotted/react/inline';
|
|
523
|
+
import { Heading, Text } from '@slotted/react/typography';
|
|
524
|
+
|
|
525
|
+
const MESSAGES = {
|
|
526
|
+
enter: 'Present',
|
|
527
|
+
entered: 'Presenting. Press Escape to exit.',
|
|
528
|
+
exit: 'End presentation',
|
|
529
|
+
exited: 'Presentation ended.',
|
|
530
|
+
};
|
|
531
|
+
|
|
532
|
+
export default function FullscreenWordsExample() {
|
|
533
|
+
return (
|
|
534
|
+
<Fullscreen messages={MESSAGES}>
|
|
535
|
+
<Card>
|
|
536
|
+
<CardHeader>
|
|
537
|
+
<Inline align="center" justify="between">
|
|
538
|
+
<Heading level={2} size="md">
|
|
539
|
+
Quarterly inventory review
|
|
540
|
+
</Heading>
|
|
541
|
+
<FullscreenTrigger
|
|
542
|
+
icon={(on) => (
|
|
543
|
+
<Icon>
|
|
544
|
+
<Glyph name={on ? 'x' : 'presentation'} />
|
|
545
|
+
</Icon>
|
|
546
|
+
)}
|
|
547
|
+
variant="outline"
|
|
548
|
+
/>
|
|
549
|
+
</Inline>
|
|
550
|
+
</CardHeader>
|
|
551
|
+
<CardBody>
|
|
552
|
+
<Text>Stock value fell 3.2% against the second quarter.</Text>
|
|
553
|
+
</CardBody>
|
|
554
|
+
</Card>
|
|
555
|
+
</Fullscreen>
|
|
556
|
+
);
|
|
557
|
+
}
|
|
558
|
+
```
|