@iress-oss/ids-mcp-server 6.0.0-alpha.1-canary-20251204032753-fe18cab → 6.0.0-alpha.1-canary-20251204040305-3639454
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/generated/docs/components_components-alert-docs.md +1054 -0
- package/generated/docs/components_components-autocomplete-docs.md +3304 -0
- package/generated/docs/components_components-autocomplete-recipes-docs.md +98 -0
- package/generated/docs/components_components-badge-docs.md +312 -0
- package/generated/docs/components_components-button-docs.md +2339 -0
- package/generated/docs/components_components-buttongroup-docs.md +980 -0
- package/generated/docs/components_components-card-docs.md +1970 -0
- package/generated/docs/components_components-checkbox-docs.md +1083 -0
- package/generated/docs/components_components-checkboxgroup-docs.md +1597 -0
- package/generated/docs/components_components-checkboxgroup-recipes-docs.md +209 -0
- package/generated/docs/components_components-col-docs.md +755 -0
- package/generated/docs/components_components-container-docs.md +172 -0
- package/generated/docs/components_components-divider-docs.md +235 -0
- package/generated/docs/components_components-expander-docs.md +428 -0
- package/generated/docs/components_components-field-docs.md +3345 -0
- package/generated/docs/components_components-filter-docs.md +4091 -0
- package/generated/docs/components_components-hide-docs.md +450 -0
- package/generated/docs/components_components-icon-docs.md +1017 -0
- package/generated/docs/components_components-image-docs.md +168 -0
- package/generated/docs/components_components-inline-docs.md +1962 -0
- package/generated/docs/components_components-input-docs.md +1388 -0
- package/generated/docs/components_components-input-recipes-docs.md +349 -0
- package/generated/docs/components_components-inputcurrency-docs.md +636 -0
- package/generated/docs/components_components-inputcurrency-recipes-docs.md +208 -0
- package/generated/docs/components_components-introduction-docs.md +448 -0
- package/generated/docs/components_components-label-docs.md +229 -0
- package/generated/docs/components_components-link-docs.md +454 -0
- package/generated/docs/components_components-menu-docs.md +2219 -0
- package/generated/docs/components_components-menu-menuitem-docs.md +1455 -0
- package/generated/docs/components_components-modal-docs.md +2002 -0
- package/generated/docs/components_components-panel-docs.md +342 -0
- package/generated/docs/components_components-placeholder-docs.md +98 -0
- package/generated/docs/components_components-popover-docs.md +1631 -0
- package/generated/docs/components_components-popover-recipes-docs.md +537 -0
- package/generated/docs/components_components-progress-docs.md +128 -0
- package/generated/docs/components_components-provider-docs.md +123 -0
- package/generated/docs/components_components-radio-docs.md +499 -0
- package/generated/docs/components_components-radiogroup-docs.md +1573 -0
- package/generated/docs/components_components-readonly-docs.md +277 -0
- package/generated/docs/components_components-richselect-docs.md +6101 -0
- package/generated/docs/components_components-row-docs.md +2172 -0
- package/generated/docs/components_components-select-docs.md +1110 -0
- package/generated/docs/components_components-skeleton-docs.md +467 -0
- package/generated/docs/components_components-skeleton-recipes-docs.md +110 -0
- package/generated/docs/components_components-skiplink-docs.md +220 -0
- package/generated/docs/components_components-slideout-docs.md +1910 -0
- package/generated/docs/components_components-slider-docs.md +1284 -0
- package/generated/docs/components_components-spinner-docs.md +90 -0
- package/generated/docs/components_components-stack-docs.md +730 -0
- package/generated/docs/components_components-table-docs.md +4038 -0
- package/generated/docs/components_components-tabset-docs.md +955 -0
- package/generated/docs/components_components-tabset-tab-docs.md +342 -0
- package/generated/docs/components_components-tag-docs.md +410 -0
- package/generated/docs/components_components-text-docs.md +593 -0
- package/generated/docs/components_components-toaster-docs.md +451 -0
- package/generated/docs/components_components-toggle-docs.md +513 -0
- package/generated/docs/components_components-tooltip-docs.md +564 -0
- package/generated/docs/components_components-validationmessage-docs.md +608 -0
- package/generated/docs/components_contact-us-docs.md +9 -0
- package/generated/docs/components_foundations-accessibility-docs.md +33 -0
- package/generated/docs/components_foundations-consistency-docs.md +44 -0
- package/generated/docs/components_foundations-content-docs.md +18 -0
- package/generated/docs/components_foundations-introduction-docs.md +17 -0
- package/generated/docs/components_foundations-principles-docs.md +60 -0
- package/generated/docs/components_foundations-responsive-layout-docs.md +2692 -0
- package/generated/docs/components_foundations-user-experience-docs.md +53 -0
- package/generated/docs/components_foundations-visual-design-docs.md +39 -0
- package/generated/docs/components_foundations-z-index-stacking-docs.md +288 -0
- package/generated/docs/components_frequently-asked-questions-docs.md +44 -0
- package/generated/docs/components_get-started-develop-docs.md +47 -0
- package/generated/docs/components_get-started-using-storybook-docs.md +55 -0
- package/generated/docs/components_introduction-docs.md +85 -0
- package/generated/docs/components_patterns-form-docs.md +2469 -0
- package/generated/docs/components_patterns-form-recipes-docs.md +1597 -0
- package/generated/docs/components_patterns-introduction-docs.md +31 -0
- package/generated/docs/components_patterns-loading-docs.md +1908 -0
- package/generated/docs/components_patterns-shadow-docs.md +195 -0
- package/generated/docs/components_resources-code-katas-docs.md +25 -0
- package/generated/docs/components_resources-introduction-docs.md +28 -0
- package/generated/docs/components_resources-mcp-server-docs.md +23 -0
- package/generated/docs/components_resources-migration-guides-from-v4-to-v5-docs.md +142 -0
- package/generated/docs/components_styling-props-colour-docs.md +91 -0
- package/generated/docs/components_styling-props-elevation-docs.md +69 -0
- package/generated/docs/components_styling-props-radius-docs.md +63 -0
- package/generated/docs/components_styling-props-reference-docs.md +160 -0
- package/generated/docs/components_styling-props-screen-readers-docs.md +66 -0
- package/generated/docs/components_styling-props-sizing-docs.md +217 -0
- package/generated/docs/components_styling-props-spacing-docs.md +545 -0
- package/generated/docs/components_styling-props-typography-docs.md +66 -0
- package/generated/docs/components_versions-docs.md +14 -0
- package/generated/docs/guidelines.md +3083 -0
- package/generated/docs/introduction-docs.md +37 -0
- package/generated/docs/tokens_colour-docs.md +479 -0
- package/generated/docs/tokens_elevation-docs.md +39 -0
- package/generated/docs/tokens_introduction-docs.md +150 -0
- package/generated/docs/tokens_radius-docs.md +67 -0
- package/generated/docs/tokens_spacing-docs.md +87 -0
- package/generated/docs/tokens_typography-docs.md +305 -0
- package/package.json +2 -2
|
@@ -0,0 +1,1910 @@
|
|
|
1
|
+
Slideout
|
|
2
|
+
========
|
|
3
|
+
|
|
4
|
+
Overview
|
|
5
|
+
--------
|
|
6
|
+
|
|
7
|
+
Slideouts are used to show additional information or to allow users to perform secondary tasks without leaving their normal workflow.
|
|
8
|
+
|
|
9
|
+
* * *
|
|
10
|
+
|
|
11
|
+
Updated
|
|
12
|
+
|
|
13
|
+
**Recently updated**
|
|
14
|
+
|
|
15
|
+
This component has been recently updated with new props. The props have been marked as beta. Please tell us if there are any issues.
|
|
16
|
+
|
|
17
|
+
Read more
|
|
18
|
+
|
|
19
|
+
[](#use-a-slideout-when)Use a slideout when:
|
|
20
|
+
--------------------------------------------
|
|
21
|
+
|
|
22
|
+
* Providing supplemental tasks that require the underlying page to still be visible
|
|
23
|
+
* Providing non-essential information related to the underlying page
|
|
24
|
+
|
|
25
|
+
[](./iframe.html?id=components-slideout--default)
|
|
26
|
+
|
|
27
|
+
Toggle slideout
|
|
28
|
+
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
const Story \= () \=> {
|
|
32
|
+
const { showSlideout } \= useSlideout();
|
|
33
|
+
const SLIDEOUT\_ID \= 'storybook-slideout';
|
|
34
|
+
return (
|
|
35
|
+
const Story \= () \=> {
|
|
36
|
+
const { showSlideout } \= useSlideout();
|
|
37
|
+
const SLIDEOUT\_ID \= 'storybook-slideout';
|
|
38
|
+
return (
|
|
39
|
+
<\>
|
|
40
|
+
<IressButton onClick\={() \=> showSlideout(SLIDEOUT\_ID)}\>
|
|
41
|
+
Toggle slideout </IressButton\>
|
|
42
|
+
<IressSlideout
|
|
43
|
+
footer\="Footer slot"
|
|
44
|
+
id\="storybook-slideout"
|
|
45
|
+
\>
|
|
46
|
+
Slideout content </IressSlideout\>
|
|
47
|
+
</\>
|
|
48
|
+
);
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export const App \= () \=> (
|
|
52
|
+
<IressSlideoutProvider\>
|
|
53
|
+
<Story />
|
|
54
|
+
</IressSlideoutProvider\>
|
|
55
|
+
);
|
|
56
|
+
);
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export const App \= () \=> (
|
|
60
|
+
<IressSlideoutProvider\>
|
|
61
|
+
<Story />
|
|
62
|
+
</IressSlideoutProvider\>
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Props
|
|
68
|
+
-----
|
|
69
|
+
|
|
70
|
+
| Name | Description | Default | Control |
|
|
71
|
+
| --- | --- | --- | --- |
|
|
72
|
+
| children |
|
|
73
|
+
Content to be displayed within the slideout.
|
|
74
|
+
|
|
75
|
+
ReactNode
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
| \- |
|
|
80
|
+
|
|
81
|
+
"Slideout content"
|
|
82
|
+
|
|
83
|
+
|
|
|
84
|
+
| closeText |
|
|
85
|
+
|
|
86
|
+
Screenreader text for close button.
|
|
87
|
+
|
|
88
|
+
string
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
|
|
|
93
|
+
|
|
94
|
+
'Close'
|
|
95
|
+
|
|
96
|
+
| Set string |
|
|
97
|
+
| container |
|
|
98
|
+
|
|
99
|
+
The container element to render the slideout into. By default, the slideout will render at the end of the document body.
|
|
100
|
+
|
|
101
|
+
FloatingUIContainer
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
| \- | Set object |
|
|
106
|
+
| defaultShow |
|
|
107
|
+
|
|
108
|
+
When set to `true` the slideout will be visible. Use for uncontrolled slideouts.
|
|
109
|
+
|
|
110
|
+
boolean
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
|
|
|
115
|
+
|
|
116
|
+
false
|
|
117
|
+
|
|
118
|
+
| Set boolean |
|
|
119
|
+
| eleToPush |
|
|
120
|
+
|
|
121
|
+
The element that needs to be pushed relative to the slideout. This can be a string selector to match an existing element in the DOM, a html element, or a React reference. Will be ignored if `mode` is not set to `push` or if element does not exist.
|
|
122
|
+
|
|
123
|
+
union
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
| \- | Set object |
|
|
128
|
+
| footer |
|
|
129
|
+
|
|
130
|
+
Panel to place slideout controls.
|
|
131
|
+
|
|
132
|
+
ReactNode
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
| \- |
|
|
137
|
+
|
|
138
|
+
"Footer slot"
|
|
139
|
+
|
|
140
|
+
|
|
|
141
|
+
| heading |
|
|
142
|
+
|
|
143
|
+
Sets the heading for the slideout. If passed an element, it will render the element with an id, to ensure its connection to the slideout.
|
|
144
|
+
|
|
145
|
+
union
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
| \- | Set object |
|
|
150
|
+
| id |
|
|
151
|
+
|
|
152
|
+
Unique ID for the slideout. Use if you would like to open this slideout from anywhere in your app using the `useSlideout` hook.
|
|
153
|
+
|
|
154
|
+
string
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
| \- | storybook-slideout |
|
|
159
|
+
| mode |
|
|
160
|
+
|
|
161
|
+
Sets how the Slideout interacts with the content of the page. `overlay` overlays the page content, obscuring the content below. `push` will push the element (specified by `eleToPush`) across the page. `push` will revert back to `overlay` if `eleToPush` is not specified or if the screen size < 1200px.
|
|
162
|
+
|
|
163
|
+
union
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
|
|
|
168
|
+
|
|
169
|
+
'overlay'
|
|
170
|
+
|
|
171
|
+
|
|
|
172
|
+
|
|
173
|
+
overlaypush
|
|
174
|
+
|
|
175
|
+
|
|
|
176
|
+
| onEntered |
|
|
177
|
+
|
|
178
|
+
Emitted when the slideout has opened.
|
|
179
|
+
|
|
180
|
+
() => void
|
|
181
|
+
|
|
182
|
+
| \- | \- |
|
|
183
|
+
| onExited |
|
|
184
|
+
|
|
185
|
+
Emitted when the slideout has closed.
|
|
186
|
+
|
|
187
|
+
() => void
|
|
188
|
+
|
|
189
|
+
| \- | \- |
|
|
190
|
+
| onShowChange |
|
|
191
|
+
|
|
192
|
+
Emitted when the slideout has opened or closed internally. Use for controlled slideouts.
|
|
193
|
+
|
|
194
|
+
(show: boolean, reason?: OpenChangeReason) => void
|
|
195
|
+
|
|
196
|
+
| \- | \- |
|
|
197
|
+
| onStatus |
|
|
198
|
+
|
|
199
|
+
Emitted when the slideout has mounted, unmounted, opened or closed. Open and close occur before animation begins.
|
|
200
|
+
|
|
201
|
+
(status: 'unmounted' | 'initial' | 'open' | 'close') => void
|
|
202
|
+
|
|
203
|
+
| \- | \- |
|
|
204
|
+
| position |
|
|
205
|
+
|
|
206
|
+
Position of the slideout relative to the page. `left` or `right`.
|
|
207
|
+
|
|
208
|
+
union
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
|
|
|
213
|
+
|
|
214
|
+
'right'
|
|
215
|
+
|
|
216
|
+
|
|
|
217
|
+
|
|
218
|
+
rightleft
|
|
219
|
+
|
|
220
|
+
|
|
|
221
|
+
| show |
|
|
222
|
+
|
|
223
|
+
When set to `true` the slideout will be visible. Use for controlled slideouts.
|
|
224
|
+
|
|
225
|
+
boolean
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
| \- | \- |
|
|
230
|
+
| size |
|
|
231
|
+
|
|
232
|
+
Accepts a single `SlideoutSize`. Slideouts will display at 100% for mobile screens (<576px).
|
|
233
|
+
|
|
234
|
+
union
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
|
|
|
239
|
+
|
|
240
|
+
'sm'
|
|
241
|
+
|
|
242
|
+
|
|
|
243
|
+
|
|
244
|
+
smmd
|
|
245
|
+
|
|
246
|
+
|
|
|
247
|
+
|
|
248
|
+
Controlling the slideout
|
|
249
|
+
------------------------
|
|
250
|
+
|
|
251
|
+
### Using the `show` property
|
|
252
|
+
|
|
253
|
+
You can use state to control the slideout by setting the `show` property to `true` or `false`. To sync your state with the slideout, you can use the `onShowChange` prop, which is normally passed the set function from `useState`.
|
|
254
|
+
|
|
255
|
+
[](./iframe.html?id=components-slideout--show-with-state)
|
|
256
|
+
|
|
257
|
+
Show slideout using state
|
|
258
|
+
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
import { IressButton, IressSlideout, type IressSlideoutProps } from '@iress-oss/ids-components';
|
|
262
|
+
import { useState } from 'react';
|
|
263
|
+
export const SlideoutUsingState \= () \=> {
|
|
264
|
+
const \[show, setShow\] \= useState(false);
|
|
265
|
+
return (
|
|
266
|
+
<\>
|
|
267
|
+
<IressButton onClick\={() \=> setShow(true)}\>
|
|
268
|
+
Show slideout using state </IressButton\>
|
|
269
|
+
<IressSlideout
|
|
270
|
+
{...{
|
|
271
|
+
children: 'This slideout was opened via state',
|
|
272
|
+
}}
|
|
273
|
+
show\={show}
|
|
274
|
+
onShowChange\={setShow}
|
|
275
|
+
footer\={<IressButton onClick\={() \=> setShow(false)}\>Close</IressButton\>}
|
|
276
|
+
/>
|
|
277
|
+
</\>
|
|
278
|
+
);
|
|
279
|
+
};
|
|
280
|
+
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
#### Props
|
|
284
|
+
|
|
285
|
+
| Name | Description | Default | Control |
|
|
286
|
+
| --- | --- | --- | --- |
|
|
287
|
+
| children |
|
|
288
|
+
Content to be displayed within the slideout.
|
|
289
|
+
|
|
290
|
+
ReactNode
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
|
|
294
|
+
| \- |
|
|
295
|
+
|
|
296
|
+
"This slideout was opened via state"
|
|
297
|
+
|
|
298
|
+
|
|
|
299
|
+
| closeText |
|
|
300
|
+
|
|
301
|
+
Screenreader text for close button.
|
|
302
|
+
|
|
303
|
+
string
|
|
304
|
+
|
|
305
|
+
|
|
306
|
+
|
|
307
|
+
|
|
|
308
|
+
|
|
309
|
+
'Close'
|
|
310
|
+
|
|
311
|
+
| Set string |
|
|
312
|
+
| container |
|
|
313
|
+
|
|
314
|
+
The container element to render the slideout into. By default, the slideout will render at the end of the document body.
|
|
315
|
+
|
|
316
|
+
FloatingUIContainer
|
|
317
|
+
|
|
318
|
+
|
|
319
|
+
|
|
320
|
+
| \- | Set object |
|
|
321
|
+
| defaultShow |
|
|
322
|
+
|
|
323
|
+
When set to `true` the slideout will be visible. Use for uncontrolled slideouts.
|
|
324
|
+
|
|
325
|
+
boolean
|
|
326
|
+
|
|
327
|
+
|
|
328
|
+
|
|
329
|
+
|
|
|
330
|
+
|
|
331
|
+
false
|
|
332
|
+
|
|
333
|
+
| Set boolean |
|
|
334
|
+
| eleToPush |
|
|
335
|
+
|
|
336
|
+
The element that needs to be pushed relative to the slideout. This can be a string selector to match an existing element in the DOM, a html element, or a React reference. Will be ignored if `mode` is not set to `push` or if element does not exist.
|
|
337
|
+
|
|
338
|
+
union
|
|
339
|
+
|
|
340
|
+
|
|
341
|
+
|
|
342
|
+
| \- | Set object |
|
|
343
|
+
| footer |
|
|
344
|
+
|
|
345
|
+
Panel to place slideout controls.
|
|
346
|
+
|
|
347
|
+
ReactNode
|
|
348
|
+
|
|
349
|
+
|
|
350
|
+
|
|
351
|
+
| \- | \- |
|
|
352
|
+
| heading |
|
|
353
|
+
|
|
354
|
+
Sets the heading for the slideout. If passed an element, it will render the element with an id, to ensure its connection to the slideout.
|
|
355
|
+
|
|
356
|
+
union
|
|
357
|
+
|
|
358
|
+
|
|
359
|
+
|
|
360
|
+
| \- | Set object |
|
|
361
|
+
| id |
|
|
362
|
+
|
|
363
|
+
Unique ID for the slideout. Use if you would like to open this slideout from anywhere in your app using the `useSlideout` hook.
|
|
364
|
+
|
|
365
|
+
string
|
|
366
|
+
|
|
367
|
+
|
|
368
|
+
|
|
369
|
+
| \- | Set string |
|
|
370
|
+
| mode |
|
|
371
|
+
|
|
372
|
+
Sets how the Slideout interacts with the content of the page. `overlay` overlays the page content, obscuring the content below. `push` will push the element (specified by `eleToPush`) across the page. `push` will revert back to `overlay` if `eleToPush` is not specified or if the screen size < 1200px.
|
|
373
|
+
|
|
374
|
+
union
|
|
375
|
+
|
|
376
|
+
|
|
377
|
+
|
|
378
|
+
|
|
|
379
|
+
|
|
380
|
+
'overlay'
|
|
381
|
+
|
|
382
|
+
|
|
|
383
|
+
|
|
384
|
+
overlaypush
|
|
385
|
+
|
|
386
|
+
|
|
|
387
|
+
| onEntered |
|
|
388
|
+
|
|
389
|
+
Emitted when the slideout has opened.
|
|
390
|
+
|
|
391
|
+
() => void
|
|
392
|
+
|
|
393
|
+
| \- | \- |
|
|
394
|
+
| onExited |
|
|
395
|
+
|
|
396
|
+
Emitted when the slideout has closed.
|
|
397
|
+
|
|
398
|
+
() => void
|
|
399
|
+
|
|
400
|
+
| \- | \- |
|
|
401
|
+
| onShowChange |
|
|
402
|
+
|
|
403
|
+
Emitted when the slideout has opened or closed internally. Use for controlled slideouts.
|
|
404
|
+
|
|
405
|
+
(show: boolean, reason?: OpenChangeReason) => void
|
|
406
|
+
|
|
407
|
+
| \- | \- |
|
|
408
|
+
| onStatus |
|
|
409
|
+
|
|
410
|
+
Emitted when the slideout has mounted, unmounted, opened or closed. Open and close occur before animation begins.
|
|
411
|
+
|
|
412
|
+
(status: 'unmounted' | 'initial' | 'open' | 'close') => void
|
|
413
|
+
|
|
414
|
+
| \- | \- |
|
|
415
|
+
| position |
|
|
416
|
+
|
|
417
|
+
Position of the slideout relative to the page. `left` or `right`.
|
|
418
|
+
|
|
419
|
+
union
|
|
420
|
+
|
|
421
|
+
|
|
422
|
+
|
|
423
|
+
|
|
|
424
|
+
|
|
425
|
+
'right'
|
|
426
|
+
|
|
427
|
+
|
|
|
428
|
+
|
|
429
|
+
rightleft
|
|
430
|
+
|
|
431
|
+
|
|
|
432
|
+
| show |
|
|
433
|
+
|
|
434
|
+
When set to `true` the slideout will be visible. Use for controlled slideouts.
|
|
435
|
+
|
|
436
|
+
boolean
|
|
437
|
+
|
|
438
|
+
|
|
439
|
+
|
|
440
|
+
| \- | \- |
|
|
441
|
+
| size |
|
|
442
|
+
|
|
443
|
+
Accepts a single `SlideoutSize`. Slideouts will display at 100% for mobile screens (<576px).
|
|
444
|
+
|
|
445
|
+
union
|
|
446
|
+
|
|
447
|
+
|
|
448
|
+
|
|
449
|
+
|
|
|
450
|
+
|
|
451
|
+
'sm'
|
|
452
|
+
|
|
453
|
+
|
|
|
454
|
+
|
|
455
|
+
smmd
|
|
456
|
+
|
|
457
|
+
|
|
|
458
|
+
|
|
459
|
+
### Using the `IressSlideoutProvider`
|
|
460
|
+
|
|
461
|
+
You can use the `IressSlideoutProvider` to open and close slideout from anywhere in your application, as long as the slideout has a unique `id`. In this case you would use the `useSlideout` hook to open and close the slideout.
|
|
462
|
+
|
|
463
|
+
To use, wrap your `<App/>` or the component that you want to use the `useSlideout` hook with `<IressSlideoutProvider />`.
|
|
464
|
+
|
|
465
|
+
[](./iframe.html?id=components-slideout-provider--provider)
|
|
466
|
+
|
|
467
|
+
Show slideout using provider
|
|
468
|
+
|
|
469
|
+
```
|
|
470
|
+
|
|
471
|
+
const SLIDEOUT\_ID \= 'storybook-slideout';
|
|
472
|
+
export const App \= (slideoutProps: IressSlideoutProps) \=> (
|
|
473
|
+
<IressSlideoutProvider\>
|
|
474
|
+
<SlideoutWithTrigger {...slideoutProps} />
|
|
475
|
+
</IressSlideoutProvider\>
|
|
476
|
+
);
|
|
477
|
+
const SlideoutWithTrigger \= ({
|
|
478
|
+
id \= SLIDEOUT\_ID,
|
|
479
|
+
...slideoutProps
|
|
480
|
+
}: IressSlideoutProps) \=> {
|
|
481
|
+
const { showSlideout } \= useSlideout();
|
|
482
|
+
return (
|
|
483
|
+
<\>
|
|
484
|
+
<IressButton onClick\={() \=> showSlideout(id)}\>
|
|
485
|
+
Show slideout using provider </IressButton\>
|
|
486
|
+
<IressSlideout
|
|
487
|
+
{...slideoutProps}
|
|
488
|
+
id\={id}
|
|
489
|
+
footer\={
|
|
490
|
+
<IressButton onClick\={() \=> showSlideout(id, false)}\>
|
|
491
|
+
Close slideout </IressButton\>
|
|
492
|
+
}
|
|
493
|
+
\>
|
|
494
|
+
{slideoutProps.children ?? 'Slideout content'}
|
|
495
|
+
</IressSlideout\>
|
|
496
|
+
</\>
|
|
497
|
+
);
|
|
498
|
+
};
|
|
499
|
+
|
|
500
|
+
```
|
|
501
|
+
|
|
502
|
+
#### Props
|
|
503
|
+
|
|
504
|
+
These are some settings you can use to customise the provider, such as setting where the slideouts are rendered in the DOM.
|
|
505
|
+
|
|
506
|
+
| Name | Description | Default | Control |
|
|
507
|
+
| --- | --- | --- | --- |
|
|
508
|
+
| children |
|
|
509
|
+
\-
|
|
510
|
+
|
|
511
|
+
| \- | \- |
|
|
512
|
+
| container |
|
|
513
|
+
|
|
514
|
+
The container element to render the slideout into. By default, the slideout will render at the end of the document body.
|
|
515
|
+
|
|
516
|
+
FloatingUIContainer
|
|
517
|
+
|
|
518
|
+
|
|
519
|
+
|
|
520
|
+
| \- | \- |
|
|
521
|
+
| Show Storybook only itemsStorybook only | Show Storybook only items |
|
|
522
|
+
|
|
523
|
+
Examples
|
|
524
|
+
--------
|
|
525
|
+
|
|
526
|
+
### Modes
|
|
527
|
+
|
|
528
|
+
Slideouts can be used in two modes - `overlay` and `push`. In `overlay` mode the slideout sits on top of the content, useful if space is at a premium. In `push` mode the slideout will push the page container to make it smaller; this means you can see all of the page content when the page is available. Overlay is the default.
|
|
529
|
+
|
|
530
|
+
[](./iframe.html?id=components-slideout--modes)
|
|
531
|
+
|
|
532
|
+
Overlay slideoutPush slideout
|
|
533
|
+
|
|
534
|
+
```
|
|
535
|
+
|
|
536
|
+
const Story \= () \=> {
|
|
537
|
+
const { showSlideout } \= useSlideout();
|
|
538
|
+
const SLIDEOUT\_ID \= 'storybook-slideout';
|
|
539
|
+
return (
|
|
540
|
+
const Story \= () \=> {
|
|
541
|
+
const { showSlideout } \= useSlideout();
|
|
542
|
+
const SLIDEOUT\_ID \= 'storybook-slideout';
|
|
543
|
+
return (
|
|
544
|
+
<IressPanel bg\="alt"\>
|
|
545
|
+
<IressInline gap\="md"\>
|
|
546
|
+
<IressButton onClick\={() \=> showSlideout("overlay")}\>
|
|
547
|
+
Overlay slideout </IressButton\>
|
|
548
|
+
<IressSlideout
|
|
549
|
+
footer\=""
|
|
550
|
+
id\="overlay"
|
|
551
|
+
mode\="overlay"
|
|
552
|
+
\>
|
|
553
|
+
<h2\>
|
|
554
|
+
Overlay </h2\>
|
|
555
|
+
For most situations{' '}
|
|
556
|
+
<code\>
|
|
557
|
+
overlay </code\>
|
|
558
|
+
{' '}will be what you need, which is why this is the default behaviour. You do not need to specify the mode if you want your slideout to sit on top of the page.
|
|
559
|
+
</IressSlideout\>
|
|
560
|
+
<IressButton onClick\={() \=> showSlideout("push")}\>
|
|
561
|
+
Push slideout </IressButton\>
|
|
562
|
+
<IressSlideout
|
|
563
|
+
eleToPush\="#storybook-docs, html"
|
|
564
|
+
footer\=""
|
|
565
|
+
id\="push"
|
|
566
|
+
mode\="push"
|
|
567
|
+
\>
|
|
568
|
+
<IressText\>
|
|
569
|
+
<h2\>
|
|
570
|
+
Push </h2\>
|
|
571
|
+
<p\>
|
|
572
|
+
If you have a data-heavy screen where you need all of the data to be visible when the slideout is open, use{' '}
|
|
573
|
+
<code\>
|
|
574
|
+
push </code\>
|
|
575
|
+
. To allow push to work you will need to supply the ID of the element that needs to be pushed via the{' '}
|
|
576
|
+
<code\>
|
|
577
|
+
eleToPush </code\>
|
|
578
|
+
{' '}prop. If the ID is not supplied, or the element cannot be found, the slideout will revert to{' '}
|
|
579
|
+
<code\>
|
|
580
|
+
overlay </code\>
|
|
581
|
+
{' '}behaviour.
|
|
582
|
+
</p\>
|
|
583
|
+
<p\>
|
|
584
|
+
{\`Be aware though that push will only work on larger screens (>1200px); on smaller screens the slideout will overlay the content.\`}
|
|
585
|
+
</p\>
|
|
586
|
+
<IressPanel bg\="alt"\>
|
|
587
|
+
<kn />
|
|
588
|
+
</IressPanel\>
|
|
589
|
+
</IressText\>
|
|
590
|
+
</IressSlideout\>
|
|
591
|
+
</IressInline\>
|
|
592
|
+
</IressPanel\>
|
|
593
|
+
);
|
|
594
|
+
};
|
|
595
|
+
|
|
596
|
+
export const App \= () \=> (
|
|
597
|
+
<IressSlideoutProvider\>
|
|
598
|
+
<Story />
|
|
599
|
+
</IressSlideoutProvider\>
|
|
600
|
+
);
|
|
601
|
+
);
|
|
602
|
+
};
|
|
603
|
+
|
|
604
|
+
export const App \= () \=> (
|
|
605
|
+
<IressSlideoutProvider\>
|
|
606
|
+
<Story />
|
|
607
|
+
</IressSlideoutProvider\>
|
|
608
|
+
);
|
|
609
|
+
|
|
610
|
+
```
|
|
611
|
+
|
|
612
|
+
#### Props
|
|
613
|
+
|
|
614
|
+
| Name | Description | Default | Control |
|
|
615
|
+
| --- | --- | --- | --- |
|
|
616
|
+
| children |
|
|
617
|
+
Content to be displayed within the slideout.
|
|
618
|
+
|
|
619
|
+
ReactNode
|
|
620
|
+
|
|
621
|
+
|
|
622
|
+
|
|
623
|
+
| \- | \- |
|
|
624
|
+
| closeText |
|
|
625
|
+
|
|
626
|
+
Screenreader text for close button.
|
|
627
|
+
|
|
628
|
+
string
|
|
629
|
+
|
|
630
|
+
|
|
631
|
+
|
|
632
|
+
|
|
|
633
|
+
|
|
634
|
+
'Close'
|
|
635
|
+
|
|
636
|
+
| Set string |
|
|
637
|
+
| container |
|
|
638
|
+
|
|
639
|
+
The container element to render the slideout into. By default, the slideout will render at the end of the document body.
|
|
640
|
+
|
|
641
|
+
FloatingUIContainer
|
|
642
|
+
|
|
643
|
+
|
|
644
|
+
|
|
645
|
+
| \- | Set object |
|
|
646
|
+
| defaultShow |
|
|
647
|
+
|
|
648
|
+
When set to `true` the slideout will be visible. Use for uncontrolled slideouts.
|
|
649
|
+
|
|
650
|
+
boolean
|
|
651
|
+
|
|
652
|
+
|
|
653
|
+
|
|
654
|
+
|
|
|
655
|
+
|
|
656
|
+
false
|
|
657
|
+
|
|
658
|
+
| Set boolean |
|
|
659
|
+
| eleToPush |
|
|
660
|
+
|
|
661
|
+
The element that needs to be pushed relative to the slideout. This can be a string selector to match an existing element in the DOM, a html element, or a React reference. Will be ignored if `mode` is not set to `push` or if element does not exist.
|
|
662
|
+
|
|
663
|
+
union
|
|
664
|
+
|
|
665
|
+
|
|
666
|
+
|
|
667
|
+
| \- | Set object |
|
|
668
|
+
| footer |
|
|
669
|
+
|
|
670
|
+
Panel to place slideout controls.
|
|
671
|
+
|
|
672
|
+
ReactNode
|
|
673
|
+
|
|
674
|
+
|
|
675
|
+
|
|
676
|
+
| \- |
|
|
677
|
+
|
|
678
|
+
""
|
|
679
|
+
|
|
680
|
+
|
|
|
681
|
+
| heading |
|
|
682
|
+
|
|
683
|
+
Sets the heading for the slideout. If passed an element, it will render the element with an id, to ensure its connection to the slideout.
|
|
684
|
+
|
|
685
|
+
union
|
|
686
|
+
|
|
687
|
+
|
|
688
|
+
|
|
689
|
+
| \- | Set object |
|
|
690
|
+
| id |
|
|
691
|
+
|
|
692
|
+
Unique ID for the slideout. Use if you would like to open this slideout from anywhere in your app using the `useSlideout` hook.
|
|
693
|
+
|
|
694
|
+
string
|
|
695
|
+
|
|
696
|
+
|
|
697
|
+
|
|
698
|
+
| \- | \- |
|
|
699
|
+
| mode |
|
|
700
|
+
|
|
701
|
+
Sets how the Slideout interacts with the content of the page. `overlay` overlays the page content, obscuring the content below. `push` will push the element (specified by `eleToPush`) across the page. `push` will revert back to `overlay` if `eleToPush` is not specified or if the screen size < 1200px.
|
|
702
|
+
|
|
703
|
+
union
|
|
704
|
+
|
|
705
|
+
|
|
706
|
+
|
|
707
|
+
|
|
|
708
|
+
|
|
709
|
+
'overlay'
|
|
710
|
+
|
|
711
|
+
| \- |
|
|
712
|
+
| onEntered |
|
|
713
|
+
|
|
714
|
+
Emitted when the slideout has opened.
|
|
715
|
+
|
|
716
|
+
() => void
|
|
717
|
+
|
|
718
|
+
| \- | \- |
|
|
719
|
+
| onExited |
|
|
720
|
+
|
|
721
|
+
Emitted when the slideout has closed.
|
|
722
|
+
|
|
723
|
+
() => void
|
|
724
|
+
|
|
725
|
+
| \- | \- |
|
|
726
|
+
| onShowChange |
|
|
727
|
+
|
|
728
|
+
Emitted when the slideout has opened or closed internally. Use for controlled slideouts.
|
|
729
|
+
|
|
730
|
+
(show: boolean, reason?: OpenChangeReason) => void
|
|
731
|
+
|
|
732
|
+
| \- | \- |
|
|
733
|
+
| onStatus |
|
|
734
|
+
|
|
735
|
+
Emitted when the slideout has mounted, unmounted, opened or closed. Open and close occur before animation begins.
|
|
736
|
+
|
|
737
|
+
(status: 'unmounted' | 'initial' | 'open' | 'close') => void
|
|
738
|
+
|
|
739
|
+
| \- | \- |
|
|
740
|
+
| position |
|
|
741
|
+
|
|
742
|
+
Position of the slideout relative to the page. `left` or `right`.
|
|
743
|
+
|
|
744
|
+
union
|
|
745
|
+
|
|
746
|
+
|
|
747
|
+
|
|
748
|
+
|
|
|
749
|
+
|
|
750
|
+
'right'
|
|
751
|
+
|
|
752
|
+
|
|
|
753
|
+
|
|
754
|
+
rightleft
|
|
755
|
+
|
|
756
|
+
|
|
|
757
|
+
| show |
|
|
758
|
+
|
|
759
|
+
When set to `true` the slideout will be visible. Use for controlled slideouts.
|
|
760
|
+
|
|
761
|
+
boolean
|
|
762
|
+
|
|
763
|
+
|
|
764
|
+
|
|
765
|
+
| \- | \- |
|
|
766
|
+
| size |
|
|
767
|
+
|
|
768
|
+
Accepts a single `SlideoutSize`. Slideouts will display at 100% for mobile screens (<576px).
|
|
769
|
+
|
|
770
|
+
union
|
|
771
|
+
|
|
772
|
+
|
|
773
|
+
|
|
774
|
+
|
|
|
775
|
+
|
|
776
|
+
'sm'
|
|
777
|
+
|
|
778
|
+
|
|
|
779
|
+
|
|
780
|
+
smmd
|
|
781
|
+
|
|
782
|
+
|
|
|
783
|
+
|
|
784
|
+
### Position
|
|
785
|
+
|
|
786
|
+
Slideouts can appear from the left or the right of the screen. The default is right, but you can use the `position` prop to set it to slide in from the left.
|
|
787
|
+
|
|
788
|
+
[](./iframe.html?id=components-slideout--position)
|
|
789
|
+
|
|
790
|
+
rightleft
|
|
791
|
+
|
|
792
|
+
```
|
|
793
|
+
|
|
794
|
+
const Slideouts \= () \=> {
|
|
795
|
+
const { showSlideout } \= useSlideout();
|
|
796
|
+
return (
|
|
797
|
+
<IressInline gap\="md" horizontalAlign\="between"\>
|
|
798
|
+
<IressButton onClick\={() \=> showSlideout('right')}\>right</IressButton\>
|
|
799
|
+
<IressSlideout id\="right" position\="right"\>
|
|
800
|
+
Slideout opened on the right </IressSlideout\>
|
|
801
|
+
<IressButton onClick\={() \=> showSlideout('left')}\>left</IressButton\>
|
|
802
|
+
<IressSlideout id\="left" position\="left"\>
|
|
803
|
+
Slideout opened on the left </IressSlideout\>
|
|
804
|
+
</IressInline\>
|
|
805
|
+
);
|
|
806
|
+
};
|
|
807
|
+
export const SlideoutPositions \= () \=> (
|
|
808
|
+
<IressSlideoutProvider\>
|
|
809
|
+
<Slideouts />
|
|
810
|
+
</IressSlideoutProvider\>
|
|
811
|
+
);
|
|
812
|
+
|
|
813
|
+
```
|
|
814
|
+
|
|
815
|
+
#### Props
|
|
816
|
+
|
|
817
|
+
| Name | Description | Default | Control |
|
|
818
|
+
| --- | --- | --- | --- |
|
|
819
|
+
| children |
|
|
820
|
+
Content to be displayed within the slideout.
|
|
821
|
+
|
|
822
|
+
ReactNode
|
|
823
|
+
|
|
824
|
+
|
|
825
|
+
|
|
826
|
+
| \- | \- |
|
|
827
|
+
| closeText |
|
|
828
|
+
|
|
829
|
+
Screenreader text for close button.
|
|
830
|
+
|
|
831
|
+
string
|
|
832
|
+
|
|
833
|
+
|
|
834
|
+
|
|
835
|
+
|
|
|
836
|
+
|
|
837
|
+
'Close'
|
|
838
|
+
|
|
839
|
+
| Set string |
|
|
840
|
+
| container |
|
|
841
|
+
|
|
842
|
+
The container element to render the slideout into. By default, the slideout will render at the end of the document body.
|
|
843
|
+
|
|
844
|
+
FloatingUIContainer
|
|
845
|
+
|
|
846
|
+
|
|
847
|
+
|
|
848
|
+
| \- | Set object |
|
|
849
|
+
| defaultShow |
|
|
850
|
+
|
|
851
|
+
When set to `true` the slideout will be visible. Use for uncontrolled slideouts.
|
|
852
|
+
|
|
853
|
+
boolean
|
|
854
|
+
|
|
855
|
+
|
|
856
|
+
|
|
857
|
+
|
|
|
858
|
+
|
|
859
|
+
false
|
|
860
|
+
|
|
861
|
+
| Set boolean |
|
|
862
|
+
| eleToPush |
|
|
863
|
+
|
|
864
|
+
The element that needs to be pushed relative to the slideout. This can be a string selector to match an existing element in the DOM, a html element, or a React reference. Will be ignored if `mode` is not set to `push` or if element does not exist.
|
|
865
|
+
|
|
866
|
+
union
|
|
867
|
+
|
|
868
|
+
|
|
869
|
+
|
|
870
|
+
| \- | Set object |
|
|
871
|
+
| footer |
|
|
872
|
+
|
|
873
|
+
Panel to place slideout controls.
|
|
874
|
+
|
|
875
|
+
ReactNode
|
|
876
|
+
|
|
877
|
+
|
|
878
|
+
|
|
879
|
+
| \- |
|
|
880
|
+
|
|
881
|
+
"Footer slot"
|
|
882
|
+
|
|
883
|
+
|
|
|
884
|
+
| heading |
|
|
885
|
+
|
|
886
|
+
Sets the heading for the slideout. If passed an element, it will render the element with an id, to ensure its connection to the slideout.
|
|
887
|
+
|
|
888
|
+
union
|
|
889
|
+
|
|
890
|
+
|
|
891
|
+
|
|
892
|
+
| \- | Set object |
|
|
893
|
+
| id |
|
|
894
|
+
|
|
895
|
+
Unique ID for the slideout. Use if you would like to open this slideout from anywhere in your app using the `useSlideout` hook.
|
|
896
|
+
|
|
897
|
+
string
|
|
898
|
+
|
|
899
|
+
|
|
900
|
+
|
|
901
|
+
| \- | storybook-slideout |
|
|
902
|
+
| mode |
|
|
903
|
+
|
|
904
|
+
Sets how the Slideout interacts with the content of the page. `overlay` overlays the page content, obscuring the content below. `push` will push the element (specified by `eleToPush`) across the page. `push` will revert back to `overlay` if `eleToPush` is not specified or if the screen size < 1200px.
|
|
905
|
+
|
|
906
|
+
union
|
|
907
|
+
|
|
908
|
+
|
|
909
|
+
|
|
910
|
+
|
|
|
911
|
+
|
|
912
|
+
'overlay'
|
|
913
|
+
|
|
914
|
+
|
|
|
915
|
+
|
|
916
|
+
overlaypush
|
|
917
|
+
|
|
918
|
+
|
|
|
919
|
+
| onEntered |
|
|
920
|
+
|
|
921
|
+
Emitted when the slideout has opened.
|
|
922
|
+
|
|
923
|
+
() => void
|
|
924
|
+
|
|
925
|
+
| \- | \- |
|
|
926
|
+
| onExited |
|
|
927
|
+
|
|
928
|
+
Emitted when the slideout has closed.
|
|
929
|
+
|
|
930
|
+
() => void
|
|
931
|
+
|
|
932
|
+
| \- | \- |
|
|
933
|
+
| onShowChange |
|
|
934
|
+
|
|
935
|
+
Emitted when the slideout has opened or closed internally. Use for controlled slideouts.
|
|
936
|
+
|
|
937
|
+
(show: boolean, reason?: OpenChangeReason) => void
|
|
938
|
+
|
|
939
|
+
| \- | \- |
|
|
940
|
+
| onStatus |
|
|
941
|
+
|
|
942
|
+
Emitted when the slideout has mounted, unmounted, opened or closed. Open and close occur before animation begins.
|
|
943
|
+
|
|
944
|
+
(status: 'unmounted' | 'initial' | 'open' | 'close') => void
|
|
945
|
+
|
|
946
|
+
| \- | \- |
|
|
947
|
+
| position |
|
|
948
|
+
|
|
949
|
+
Position of the slideout relative to the page. `left` or `right`.
|
|
950
|
+
|
|
951
|
+
union
|
|
952
|
+
|
|
953
|
+
|
|
954
|
+
|
|
955
|
+
|
|
|
956
|
+
|
|
957
|
+
'right'
|
|
958
|
+
|
|
959
|
+
|
|
|
960
|
+
|
|
961
|
+
rightleft
|
|
962
|
+
|
|
963
|
+
|
|
|
964
|
+
| show |
|
|
965
|
+
|
|
966
|
+
When set to `true` the slideout will be visible. Use for controlled slideouts.
|
|
967
|
+
|
|
968
|
+
boolean
|
|
969
|
+
|
|
970
|
+
|
|
971
|
+
|
|
972
|
+
| \- | \- |
|
|
973
|
+
| size |
|
|
974
|
+
|
|
975
|
+
Accepts a single `SlideoutSize`. Slideouts will display at 100% for mobile screens (<576px).
|
|
976
|
+
|
|
977
|
+
union
|
|
978
|
+
|
|
979
|
+
|
|
980
|
+
|
|
981
|
+
|
|
|
982
|
+
|
|
983
|
+
'sm'
|
|
984
|
+
|
|
985
|
+
|
|
|
986
|
+
|
|
987
|
+
smmd
|
|
988
|
+
|
|
989
|
+
|
|
|
990
|
+
|
|
991
|
+
### Size
|
|
992
|
+
|
|
993
|
+
The width of your slideout can be set using the `size` prop. By default it is `sm`, but it can be made larger by setting `size` to `md`.
|
|
994
|
+
|
|
995
|
+
[](./iframe.html?id=components-slideout--size)
|
|
996
|
+
|
|
997
|
+
smmd
|
|
998
|
+
|
|
999
|
+
```
|
|
1000
|
+
|
|
1001
|
+
const Slideouts \= () \=> {
|
|
1002
|
+
const { showSlideout } \= useSlideout();
|
|
1003
|
+
return (
|
|
1004
|
+
<IressInline gap\="spacing.400"\>
|
|
1005
|
+
<IressButton onClick\={() \=> showSlideout('sm')}\>sm</IressButton\>
|
|
1006
|
+
<IressSlideout id\="sm" size\="sm"\>
|
|
1007
|
+
Small slideout </IressSlideout\>
|
|
1008
|
+
<IressButton onClick\={() \=> showSlideout('md')}\>md</IressButton\>
|
|
1009
|
+
<IressSlideout id\="md" size\="md"\>
|
|
1010
|
+
Medium slideout </IressSlideout\>
|
|
1011
|
+
</IressInline\>
|
|
1012
|
+
);
|
|
1013
|
+
};
|
|
1014
|
+
export const SlideoutSizes \= () \=> (
|
|
1015
|
+
<IressSlideoutProvider\>
|
|
1016
|
+
<Slideouts />
|
|
1017
|
+
</IressSlideoutProvider\>
|
|
1018
|
+
);
|
|
1019
|
+
|
|
1020
|
+
```
|
|
1021
|
+
|
|
1022
|
+
#### Props
|
|
1023
|
+
|
|
1024
|
+
| Name | Description | Default | Control |
|
|
1025
|
+
| --- | --- | --- | --- |
|
|
1026
|
+
| children |
|
|
1027
|
+
Content to be displayed within the slideout.
|
|
1028
|
+
|
|
1029
|
+
ReactNode
|
|
1030
|
+
|
|
1031
|
+
|
|
1032
|
+
|
|
1033
|
+
| \- | \- |
|
|
1034
|
+
| closeText |
|
|
1035
|
+
|
|
1036
|
+
Screenreader text for close button.
|
|
1037
|
+
|
|
1038
|
+
string
|
|
1039
|
+
|
|
1040
|
+
|
|
1041
|
+
|
|
1042
|
+
|
|
|
1043
|
+
|
|
1044
|
+
'Close'
|
|
1045
|
+
|
|
1046
|
+
| Set string |
|
|
1047
|
+
| container |
|
|
1048
|
+
|
|
1049
|
+
The container element to render the slideout into. By default, the slideout will render at the end of the document body.
|
|
1050
|
+
|
|
1051
|
+
FloatingUIContainer
|
|
1052
|
+
|
|
1053
|
+
|
|
1054
|
+
|
|
1055
|
+
| \- | Set object |
|
|
1056
|
+
| defaultShow |
|
|
1057
|
+
|
|
1058
|
+
When set to `true` the slideout will be visible. Use for uncontrolled slideouts.
|
|
1059
|
+
|
|
1060
|
+
boolean
|
|
1061
|
+
|
|
1062
|
+
|
|
1063
|
+
|
|
1064
|
+
|
|
|
1065
|
+
|
|
1066
|
+
false
|
|
1067
|
+
|
|
1068
|
+
| Set boolean |
|
|
1069
|
+
| eleToPush |
|
|
1070
|
+
|
|
1071
|
+
The element that needs to be pushed relative to the slideout. This can be a string selector to match an existing element in the DOM, a html element, or a React reference. Will be ignored if `mode` is not set to `push` or if element does not exist.
|
|
1072
|
+
|
|
1073
|
+
union
|
|
1074
|
+
|
|
1075
|
+
|
|
1076
|
+
|
|
1077
|
+
| \- | Set object |
|
|
1078
|
+
| footer |
|
|
1079
|
+
|
|
1080
|
+
Panel to place slideout controls.
|
|
1081
|
+
|
|
1082
|
+
ReactNode
|
|
1083
|
+
|
|
1084
|
+
|
|
1085
|
+
|
|
1086
|
+
| \- |
|
|
1087
|
+
|
|
1088
|
+
"Size slideout footer"
|
|
1089
|
+
|
|
1090
|
+
|
|
|
1091
|
+
| heading |
|
|
1092
|
+
|
|
1093
|
+
Sets the heading for the slideout. If passed an element, it will render the element with an id, to ensure its connection to the slideout.
|
|
1094
|
+
|
|
1095
|
+
union
|
|
1096
|
+
|
|
1097
|
+
|
|
1098
|
+
|
|
1099
|
+
| \- | Set object |
|
|
1100
|
+
| id |
|
|
1101
|
+
|
|
1102
|
+
Unique ID for the slideout. Use if you would like to open this slideout from anywhere in your app using the `useSlideout` hook.
|
|
1103
|
+
|
|
1104
|
+
string
|
|
1105
|
+
|
|
1106
|
+
|
|
1107
|
+
|
|
1108
|
+
| \- | \- |
|
|
1109
|
+
| mode |
|
|
1110
|
+
|
|
1111
|
+
Sets how the Slideout interacts with the content of the page. `overlay` overlays the page content, obscuring the content below. `push` will push the element (specified by `eleToPush`) across the page. `push` will revert back to `overlay` if `eleToPush` is not specified or if the screen size < 1200px.
|
|
1112
|
+
|
|
1113
|
+
union
|
|
1114
|
+
|
|
1115
|
+
|
|
1116
|
+
|
|
1117
|
+
|
|
|
1118
|
+
|
|
1119
|
+
'overlay'
|
|
1120
|
+
|
|
1121
|
+
|
|
|
1122
|
+
|
|
1123
|
+
overlaypush
|
|
1124
|
+
|
|
1125
|
+
|
|
|
1126
|
+
| onEntered |
|
|
1127
|
+
|
|
1128
|
+
Emitted when the slideout has opened.
|
|
1129
|
+
|
|
1130
|
+
() => void
|
|
1131
|
+
|
|
1132
|
+
| \- | \- |
|
|
1133
|
+
| onExited |
|
|
1134
|
+
|
|
1135
|
+
Emitted when the slideout has closed.
|
|
1136
|
+
|
|
1137
|
+
() => void
|
|
1138
|
+
|
|
1139
|
+
| \- | \- |
|
|
1140
|
+
| onShowChange |
|
|
1141
|
+
|
|
1142
|
+
Emitted when the slideout has opened or closed internally. Use for controlled slideouts.
|
|
1143
|
+
|
|
1144
|
+
(show: boolean, reason?: OpenChangeReason) => void
|
|
1145
|
+
|
|
1146
|
+
| \- | \- |
|
|
1147
|
+
| onStatus |
|
|
1148
|
+
|
|
1149
|
+
Emitted when the slideout has mounted, unmounted, opened or closed. Open and close occur before animation begins.
|
|
1150
|
+
|
|
1151
|
+
(status: 'unmounted' | 'initial' | 'open' | 'close') => void
|
|
1152
|
+
|
|
1153
|
+
| \- | \- |
|
|
1154
|
+
| position |
|
|
1155
|
+
|
|
1156
|
+
Position of the slideout relative to the page. `left` or `right`.
|
|
1157
|
+
|
|
1158
|
+
union
|
|
1159
|
+
|
|
1160
|
+
|
|
1161
|
+
|
|
1162
|
+
|
|
|
1163
|
+
|
|
1164
|
+
'right'
|
|
1165
|
+
|
|
1166
|
+
|
|
|
1167
|
+
|
|
1168
|
+
rightleft
|
|
1169
|
+
|
|
1170
|
+
|
|
|
1171
|
+
| show |
|
|
1172
|
+
|
|
1173
|
+
When set to `true` the slideout will be visible. Use for controlled slideouts.
|
|
1174
|
+
|
|
1175
|
+
boolean
|
|
1176
|
+
|
|
1177
|
+
|
|
1178
|
+
|
|
1179
|
+
| \- | \- |
|
|
1180
|
+
| size |
|
|
1181
|
+
|
|
1182
|
+
Accepts a single `SlideoutSize`. Slideouts will display at 100% for mobile screens (<576px).
|
|
1183
|
+
|
|
1184
|
+
union
|
|
1185
|
+
|
|
1186
|
+
|
|
1187
|
+
|
|
1188
|
+
|
|
|
1189
|
+
|
|
1190
|
+
'sm'
|
|
1191
|
+
|
|
1192
|
+
| \- |
|
|
1193
|
+
|
|
1194
|
+
### Padding
|
|
1195
|
+
|
|
1196
|
+
Slideout padding now is a global styling prop.
|
|
1197
|
+
|
|
1198
|
+
[](/?path=/docs/styling-props-spacing--docs#padding)
|
|
1199
|
+
|
|
1200
|
+
[Learn more](/?path=/docs/styling-props-spacing--docs#padding)
|
|
1201
|
+
|
|
1202
|
+
### Footer
|
|
1203
|
+
|
|
1204
|
+
The `footer` prop is used to set content that should appear underneath the main content. Usually used for extra controls like buttons etc.
|
|
1205
|
+
|
|
1206
|
+
[](./iframe.html?id=components-slideout--footer)
|
|
1207
|
+
|
|
1208
|
+
Show slideout with footer
|
|
1209
|
+
|
|
1210
|
+
```
|
|
1211
|
+
|
|
1212
|
+
const Story \= () \=> {
|
|
1213
|
+
const { showSlideout } \= useSlideout();
|
|
1214
|
+
const SLIDEOUT\_ID \= 'storybook-slideout';
|
|
1215
|
+
return (
|
|
1216
|
+
const Story \= () \=> {
|
|
1217
|
+
const { showSlideout } \= useSlideout();
|
|
1218
|
+
const SLIDEOUT\_ID \= 'storybook-slideout';
|
|
1219
|
+
return (
|
|
1220
|
+
<\>
|
|
1221
|
+
<IressButton onClick\={() \=> showSlideout(SLIDEOUT\_ID)}\>
|
|
1222
|
+
Show slideout with footer </IressButton\>
|
|
1223
|
+
<IressSlideout
|
|
1224
|
+
footer\={<IressButton\>Footer button</IressButton\>}
|
|
1225
|
+
id\="storybook-slideout"
|
|
1226
|
+
\>
|
|
1227
|
+
Slideout content </IressSlideout\>
|
|
1228
|
+
</\>
|
|
1229
|
+
);
|
|
1230
|
+
};
|
|
1231
|
+
|
|
1232
|
+
export const App \= () \=> (
|
|
1233
|
+
<IressSlideoutProvider\>
|
|
1234
|
+
<Story />
|
|
1235
|
+
</IressSlideoutProvider\>
|
|
1236
|
+
);
|
|
1237
|
+
);
|
|
1238
|
+
};
|
|
1239
|
+
|
|
1240
|
+
export const App \= () \=> (
|
|
1241
|
+
<IressSlideoutProvider\>
|
|
1242
|
+
<Story />
|
|
1243
|
+
</IressSlideoutProvider\>
|
|
1244
|
+
);
|
|
1245
|
+
|
|
1246
|
+
```
|
|
1247
|
+
|
|
1248
|
+
#### Props
|
|
1249
|
+
|
|
1250
|
+
| Name | Description | Default | Control |
|
|
1251
|
+
| --- | --- | --- | --- |
|
|
1252
|
+
| children |
|
|
1253
|
+
Content to be displayed within the slideout.
|
|
1254
|
+
|
|
1255
|
+
ReactNode
|
|
1256
|
+
|
|
1257
|
+
|
|
1258
|
+
|
|
1259
|
+
| \- |
|
|
1260
|
+
|
|
1261
|
+
"Slideout content"
|
|
1262
|
+
|
|
1263
|
+
|
|
|
1264
|
+
| closeText |
|
|
1265
|
+
|
|
1266
|
+
Screenreader text for close button.
|
|
1267
|
+
|
|
1268
|
+
string
|
|
1269
|
+
|
|
1270
|
+
|
|
1271
|
+
|
|
1272
|
+
|
|
|
1273
|
+
|
|
1274
|
+
'Close'
|
|
1275
|
+
|
|
1276
|
+
| Set string |
|
|
1277
|
+
| container |
|
|
1278
|
+
|
|
1279
|
+
The container element to render the slideout into. By default, the slideout will render at the end of the document body.
|
|
1280
|
+
|
|
1281
|
+
FloatingUIContainer
|
|
1282
|
+
|
|
1283
|
+
|
|
1284
|
+
|
|
1285
|
+
| \- | Set object |
|
|
1286
|
+
| defaultShow |
|
|
1287
|
+
|
|
1288
|
+
When set to `true` the slideout will be visible. Use for uncontrolled slideouts.
|
|
1289
|
+
|
|
1290
|
+
boolean
|
|
1291
|
+
|
|
1292
|
+
|
|
1293
|
+
|
|
1294
|
+
|
|
|
1295
|
+
|
|
1296
|
+
false
|
|
1297
|
+
|
|
1298
|
+
| Set boolean |
|
|
1299
|
+
| eleToPush |
|
|
1300
|
+
|
|
1301
|
+
The element that needs to be pushed relative to the slideout. This can be a string selector to match an existing element in the DOM, a html element, or a React reference. Will be ignored if `mode` is not set to `push` or if element does not exist.
|
|
1302
|
+
|
|
1303
|
+
union
|
|
1304
|
+
|
|
1305
|
+
|
|
1306
|
+
|
|
1307
|
+
| \- | Set object |
|
|
1308
|
+
| footer |
|
|
1309
|
+
|
|
1310
|
+
Panel to place slideout controls.
|
|
1311
|
+
|
|
1312
|
+
ReactNode
|
|
1313
|
+
|
|
1314
|
+
|
|
1315
|
+
|
|
1316
|
+
| \- | \- |
|
|
1317
|
+
| heading |
|
|
1318
|
+
|
|
1319
|
+
Sets the heading for the slideout. If passed an element, it will render the element with an id, to ensure its connection to the slideout.
|
|
1320
|
+
|
|
1321
|
+
union
|
|
1322
|
+
|
|
1323
|
+
|
|
1324
|
+
|
|
1325
|
+
| \- | Set object |
|
|
1326
|
+
| id |
|
|
1327
|
+
|
|
1328
|
+
Unique ID for the slideout. Use if you would like to open this slideout from anywhere in your app using the `useSlideout` hook.
|
|
1329
|
+
|
|
1330
|
+
string
|
|
1331
|
+
|
|
1332
|
+
|
|
1333
|
+
|
|
1334
|
+
| \- | storybook-slideout |
|
|
1335
|
+
| mode |
|
|
1336
|
+
|
|
1337
|
+
Sets how the Slideout interacts with the content of the page. `overlay` overlays the page content, obscuring the content below. `push` will push the element (specified by `eleToPush`) across the page. `push` will revert back to `overlay` if `eleToPush` is not specified or if the screen size < 1200px.
|
|
1338
|
+
|
|
1339
|
+
union
|
|
1340
|
+
|
|
1341
|
+
|
|
1342
|
+
|
|
1343
|
+
|
|
|
1344
|
+
|
|
1345
|
+
'overlay'
|
|
1346
|
+
|
|
1347
|
+
|
|
|
1348
|
+
|
|
1349
|
+
overlaypush
|
|
1350
|
+
|
|
1351
|
+
|
|
|
1352
|
+
| onEntered |
|
|
1353
|
+
|
|
1354
|
+
Emitted when the slideout has opened.
|
|
1355
|
+
|
|
1356
|
+
() => void
|
|
1357
|
+
|
|
1358
|
+
| \- | \- |
|
|
1359
|
+
| onExited |
|
|
1360
|
+
|
|
1361
|
+
Emitted when the slideout has closed.
|
|
1362
|
+
|
|
1363
|
+
() => void
|
|
1364
|
+
|
|
1365
|
+
| \- | \- |
|
|
1366
|
+
| onShowChange |
|
|
1367
|
+
|
|
1368
|
+
Emitted when the slideout has opened or closed internally. Use for controlled slideouts.
|
|
1369
|
+
|
|
1370
|
+
(show: boolean, reason?: OpenChangeReason) => void
|
|
1371
|
+
|
|
1372
|
+
| \- | \- |
|
|
1373
|
+
| onStatus |
|
|
1374
|
+
|
|
1375
|
+
Emitted when the slideout has mounted, unmounted, opened or closed. Open and close occur before animation begins.
|
|
1376
|
+
|
|
1377
|
+
(status: 'unmounted' | 'initial' | 'open' | 'close') => void
|
|
1378
|
+
|
|
1379
|
+
| \- | \- |
|
|
1380
|
+
| position |
|
|
1381
|
+
|
|
1382
|
+
Position of the slideout relative to the page. `left` or `right`.
|
|
1383
|
+
|
|
1384
|
+
union
|
|
1385
|
+
|
|
1386
|
+
|
|
1387
|
+
|
|
1388
|
+
|
|
|
1389
|
+
|
|
1390
|
+
'right'
|
|
1391
|
+
|
|
1392
|
+
|
|
|
1393
|
+
|
|
1394
|
+
rightleft
|
|
1395
|
+
|
|
1396
|
+
|
|
|
1397
|
+
| show |
|
|
1398
|
+
|
|
1399
|
+
When set to `true` the slideout will be visible. Use for controlled slideouts.
|
|
1400
|
+
|
|
1401
|
+
boolean
|
|
1402
|
+
|
|
1403
|
+
|
|
1404
|
+
|
|
1405
|
+
| \- | \- |
|
|
1406
|
+
| size |
|
|
1407
|
+
|
|
1408
|
+
Accepts a single `SlideoutSize`. Slideouts will display at 100% for mobile screens (<576px).
|
|
1409
|
+
|
|
1410
|
+
union
|
|
1411
|
+
|
|
1412
|
+
|
|
1413
|
+
|
|
1414
|
+
|
|
|
1415
|
+
|
|
1416
|
+
'sm'
|
|
1417
|
+
|
|
1418
|
+
|
|
|
1419
|
+
|
|
1420
|
+
smmd
|
|
1421
|
+
|
|
1422
|
+
|
|
|
1423
|
+
|
|
1424
|
+
### Absolute position slideouts
|
|
1425
|
+
|
|
1426
|
+
By default, slideout is set to `position: fixed` which means it will appear from the edge of the browser window. By setting the `position: 'absolute'` in custom inline style, the slideout can appear from the edge of its closest relative positioned container. You will also need to set the `container` prop to the a reference of the relatively positioned container, so it can appear in the correct place in the DOM.
|
|
1427
|
+
|
|
1428
|
+
If you're using an absolutely positioned slideout you may also want to change the vertical and horizontal positioning. By default this will be the top left or top right of the container, but you can use inline style `style={{top: '30px', height: 'calc(100% - 30px)'}}` to adjust that if you need to.
|
|
1429
|
+
|
|
1430
|
+
[](./iframe.html?id=components-slideout--absolute-position)
|
|
1431
|
+
|
|
1432
|
+
Show slideout
|
|
1433
|
+
|
|
1434
|
+
### Absolute slideout
|
|
1435
|
+
|
|
1436
|
+
Almost before was mighty present had him time. But scorching counsel if mine dote men have or, one yet from pangs and for and despair there. If below nor but the name these deemed oh..
|
|
1437
|
+
|
|
1438
|
+
```
|
|
1439
|
+
|
|
1440
|
+
import {
|
|
1441
|
+
IressStack,
|
|
1442
|
+
IressButton,
|
|
1443
|
+
IressText,
|
|
1444
|
+
IressSlideout,
|
|
1445
|
+
type IressSlideoutProps,
|
|
1446
|
+
} from '@iress-oss/ids-components';
|
|
1447
|
+
import { useRef, useState } from 'react';
|
|
1448
|
+
import { cssVars } from '@iress-oss/ids-tokens';
|
|
1449
|
+
export const AbsolutePositionSlideout \= () \=> {
|
|
1450
|
+
const \[show, setShow\] \= useState(false);
|
|
1451
|
+
const containerRef \= useRef<HTMLDivElement | null\>(null);
|
|
1452
|
+
return (
|
|
1453
|
+
<IressStack gap\="md"\>
|
|
1454
|
+
<IressButton onClick\={() \=> setShow(true)}\>Show slideout</IressButton\>
|
|
1455
|
+
<div
|
|
1456
|
+
ref\={containerRef}
|
|
1457
|
+
style\={{
|
|
1458
|
+
height: '300px',
|
|
1459
|
+
border: \`1px solid ${cssVars.colour.neutral\[30\]}\`,
|
|
1460
|
+
padding: '1rem',
|
|
1461
|
+
overflow: 'hidden',
|
|
1462
|
+
position: 'relative',
|
|
1463
|
+
}}
|
|
1464
|
+
\>
|
|
1465
|
+
<IressText id\="contents"\>
|
|
1466
|
+
<h3\>Absolute slideout</h3\>
|
|
1467
|
+
<p\>
|
|
1468
|
+
Almost before was mighty present had him time. But scorching counsel if mine dote men have or, one yet from pangs and for and despair there. If below nor but the name these deemed oh.. </p\>
|
|
1469
|
+
</IressText\>
|
|
1470
|
+
<IressSlideout
|
|
1471
|
+
{...{
|
|
1472
|
+
children: 'Slideout content',
|
|
1473
|
+
footer: 'Footer slot',
|
|
1474
|
+
id: 'storybook-slideout',
|
|
1475
|
+
eleToPush: '#contents',
|
|
1476
|
+
position: 'left',
|
|
1477
|
+
mode: 'push',
|
|
1478
|
+
}}
|
|
1479
|
+
container\={containerRef}
|
|
1480
|
+
show\={show}
|
|
1481
|
+
onShowChange\={setShow}
|
|
1482
|
+
style\={
|
|
1483
|
+
{
|
|
1484
|
+
position: 'absolute',
|
|
1485
|
+
} as never
|
|
1486
|
+
}
|
|
1487
|
+
/>
|
|
1488
|
+
</div\>
|
|
1489
|
+
</IressStack\>
|
|
1490
|
+
);
|
|
1491
|
+
};
|
|
1492
|
+
|
|
1493
|
+
```
|
|
1494
|
+
|
|
1495
|
+
#### Props
|
|
1496
|
+
|
|
1497
|
+
| Name | Description | Default | Control |
|
|
1498
|
+
| --- | --- | --- | --- |
|
|
1499
|
+
| children |
|
|
1500
|
+
Content to be displayed within the slideout.
|
|
1501
|
+
|
|
1502
|
+
ReactNode
|
|
1503
|
+
|
|
1504
|
+
|
|
1505
|
+
|
|
1506
|
+
| \- |
|
|
1507
|
+
|
|
1508
|
+
"Slideout content"
|
|
1509
|
+
|
|
1510
|
+
|
|
|
1511
|
+
| closeText |
|
|
1512
|
+
|
|
1513
|
+
Screenreader text for close button.
|
|
1514
|
+
|
|
1515
|
+
string
|
|
1516
|
+
|
|
1517
|
+
|
|
1518
|
+
|
|
1519
|
+
|
|
|
1520
|
+
|
|
1521
|
+
'Close'
|
|
1522
|
+
|
|
1523
|
+
| Set string |
|
|
1524
|
+
| container |
|
|
1525
|
+
|
|
1526
|
+
The container element to render the slideout into. By default, the slideout will render at the end of the document body.
|
|
1527
|
+
|
|
1528
|
+
FloatingUIContainer
|
|
1529
|
+
|
|
1530
|
+
|
|
1531
|
+
|
|
1532
|
+
| \- | Set object |
|
|
1533
|
+
| defaultShow |
|
|
1534
|
+
|
|
1535
|
+
When set to `true` the slideout will be visible. Use for uncontrolled slideouts.
|
|
1536
|
+
|
|
1537
|
+
boolean
|
|
1538
|
+
|
|
1539
|
+
|
|
1540
|
+
|
|
1541
|
+
|
|
|
1542
|
+
|
|
1543
|
+
false
|
|
1544
|
+
|
|
1545
|
+
| Set boolean |
|
|
1546
|
+
| eleToPush |
|
|
1547
|
+
|
|
1548
|
+
The element that needs to be pushed relative to the slideout. This can be a string selector to match an existing element in the DOM, a html element, or a React reference. Will be ignored if `mode` is not set to `push` or if element does not exist.
|
|
1549
|
+
|
|
1550
|
+
union
|
|
1551
|
+
|
|
1552
|
+
|
|
1553
|
+
|
|
1554
|
+
| \- |
|
|
1555
|
+
|
|
1556
|
+
"#contents"
|
|
1557
|
+
|
|
1558
|
+
|
|
|
1559
|
+
| footer |
|
|
1560
|
+
|
|
1561
|
+
Panel to place slideout controls.
|
|
1562
|
+
|
|
1563
|
+
ReactNode
|
|
1564
|
+
|
|
1565
|
+
|
|
1566
|
+
|
|
1567
|
+
| \- |
|
|
1568
|
+
|
|
1569
|
+
"Footer slot"
|
|
1570
|
+
|
|
1571
|
+
|
|
|
1572
|
+
| heading |
|
|
1573
|
+
|
|
1574
|
+
Sets the heading for the slideout. If passed an element, it will render the element with an id, to ensure its connection to the slideout.
|
|
1575
|
+
|
|
1576
|
+
union
|
|
1577
|
+
|
|
1578
|
+
|
|
1579
|
+
|
|
1580
|
+
| \- | Set object |
|
|
1581
|
+
| id |
|
|
1582
|
+
|
|
1583
|
+
Unique ID for the slideout. Use if you would like to open this slideout from anywhere in your app using the `useSlideout` hook.
|
|
1584
|
+
|
|
1585
|
+
string
|
|
1586
|
+
|
|
1587
|
+
|
|
1588
|
+
|
|
1589
|
+
| \- | storybook-slideout |
|
|
1590
|
+
| mode |
|
|
1591
|
+
|
|
1592
|
+
Sets how the Slideout interacts with the content of the page. `overlay` overlays the page content, obscuring the content below. `push` will push the element (specified by `eleToPush`) across the page. `push` will revert back to `overlay` if `eleToPush` is not specified or if the screen size < 1200px.
|
|
1593
|
+
|
|
1594
|
+
union
|
|
1595
|
+
|
|
1596
|
+
|
|
1597
|
+
|
|
1598
|
+
|
|
|
1599
|
+
|
|
1600
|
+
'overlay'
|
|
1601
|
+
|
|
1602
|
+
|
|
|
1603
|
+
|
|
1604
|
+
overlaypush
|
|
1605
|
+
|
|
1606
|
+
|
|
|
1607
|
+
| onEntered |
|
|
1608
|
+
|
|
1609
|
+
Emitted when the slideout has opened.
|
|
1610
|
+
|
|
1611
|
+
() => void
|
|
1612
|
+
|
|
1613
|
+
| \- | \- |
|
|
1614
|
+
| onExited |
|
|
1615
|
+
|
|
1616
|
+
Emitted when the slideout has closed.
|
|
1617
|
+
|
|
1618
|
+
() => void
|
|
1619
|
+
|
|
1620
|
+
| \- | \- |
|
|
1621
|
+
| onShowChange |
|
|
1622
|
+
|
|
1623
|
+
Emitted when the slideout has opened or closed internally. Use for controlled slideouts.
|
|
1624
|
+
|
|
1625
|
+
(show: boolean, reason?: OpenChangeReason) => void
|
|
1626
|
+
|
|
1627
|
+
| \- | \- |
|
|
1628
|
+
| onStatus |
|
|
1629
|
+
|
|
1630
|
+
Emitted when the slideout has mounted, unmounted, opened or closed. Open and close occur before animation begins.
|
|
1631
|
+
|
|
1632
|
+
(status: 'unmounted' | 'initial' | 'open' | 'close') => void
|
|
1633
|
+
|
|
1634
|
+
| \- | \- |
|
|
1635
|
+
| position |
|
|
1636
|
+
|
|
1637
|
+
Position of the slideout relative to the page. `left` or `right`.
|
|
1638
|
+
|
|
1639
|
+
union
|
|
1640
|
+
|
|
1641
|
+
|
|
1642
|
+
|
|
1643
|
+
|
|
|
1644
|
+
|
|
1645
|
+
'right'
|
|
1646
|
+
|
|
1647
|
+
|
|
|
1648
|
+
|
|
1649
|
+
rightleft
|
|
1650
|
+
|
|
1651
|
+
|
|
|
1652
|
+
| show |
|
|
1653
|
+
|
|
1654
|
+
When set to `true` the slideout will be visible. Use for controlled slideouts.
|
|
1655
|
+
|
|
1656
|
+
boolean
|
|
1657
|
+
|
|
1658
|
+
|
|
1659
|
+
|
|
1660
|
+
| \- | \- |
|
|
1661
|
+
| size |
|
|
1662
|
+
|
|
1663
|
+
Accepts a single `SlideoutSize`. Slideouts will display at 100% for mobile screens (<576px).
|
|
1664
|
+
|
|
1665
|
+
union
|
|
1666
|
+
|
|
1667
|
+
|
|
1668
|
+
|
|
1669
|
+
|
|
|
1670
|
+
|
|
1671
|
+
'sm'
|
|
1672
|
+
|
|
1673
|
+
|
|
|
1674
|
+
|
|
1675
|
+
smmd
|
|
1676
|
+
|
|
1677
|
+
|
|
|
1678
|
+
|
|
1679
|
+
Migrating to version 5
|
|
1680
|
+
----------------------
|
|
1681
|
+
|
|
1682
|
+
### Adding the provider
|
|
1683
|
+
|
|
1684
|
+
For your components to work as previously, you will need to set up the `IressSlideoutProvider` at the root of your application. This will allow you to use the `useSlideout` hook to open and close slideouts from anywhere in your application using the ID of the slideout.
|
|
1685
|
+
|
|
1686
|
+
const App \= () \=> (
|
|
1687
|
+
<IressSlideoutProvider\>Rest of app here</IressSlideoutProvider\>
|
|
1688
|
+
);
|
|
1689
|
+
|
|
1690
|
+
```
|
|
1691
|
+
|
|
1692
|
+
### Testing
|
|
1693
|
+
|
|
1694
|
+
In version 5, slideouts are rendered conditionally, meaning they will not be available in the DOM until they are shown. This means that you will need to update your tests to account for this, as you cannot interact with its contents until it is shown, unlike in version 4.
|
|
1695
|
+
|
|
1696
|
+
See below for an example in version 4 and version 5.
|
|
1697
|
+
|
|
1698
|
+
[](./iframe.html?id=components-slideout--v-5-test-diff)
|
|
1699
|
+
|
|
1700
|
+
Diff
|
|
1701
|
+
|
|
1702
|
+
Old
|
|
1703
|
+
|
|
1704
|
+
New
|
|
1705
|
+
|
|
1706
|
+
<table class="css-1n5o7vh-diff-container"><tbody><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-rq9a2a-diff-removed"><pre>-</pre></td><td class="css-vl0irh-content css-rq9a2a-diff-removed"><pre class="css-o1u8iu-content-text">import { render, waitFor, screen } from '@testing-library/react';</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text">import { render, screen, waitForElementToBeRemoved } from '@testing-library/react';</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-rq9a2a-diff-removed"><pre>-</pre></td><td class="css-vl0irh-content css-rq9a2a-diff-removed"><pre class="css-o1u8iu-content-text">import { idsFireEvent, componentLoad } from '@iress/ids-react-test-utils';</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text">import { userEvent } from '@testing-library/user-event';</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-rq9a2a-diff-removed"><pre>-</pre></td><td class="css-vl0irh-content css-rq9a2a-diff-removed"><pre class="css-o1u8iu-content-text"> </pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker"><pre></pre></td><td class="css-vl0irh-content"><pre class="css-o1u8iu-content-text">test('opening and closing a slideout', async () => {</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-rq9a2a-diff-removed"><pre>-</pre></td><td class="css-vl0irh-content css-rq9a2a-diff-removed"><pre class="css-o1u8iu-content-text"> await componentLoad([</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> const trigger = screen.getByRole('button', { name: /open slideout/i });</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-rq9a2a-diff-removed"><pre>-</pre></td><td class="css-vl0irh-content css-rq9a2a-diff-removed"><pre class="css-o1u8iu-content-text"> 'slideout-trigger',</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-rq9a2a-diff-removed"><pre>-</pre></td><td class="css-vl0irh-content css-rq9a2a-diff-removed"><pre class="css-o1u8iu-content-text"> 'slideout',</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> // activate slideout</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-rq9a2a-diff-removed"><pre>-</pre></td><td class="css-vl0irh-content css-rq9a2a-diff-removed"><pre class="css-o1u8iu-content-text"> ]);</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> await userEvent.click(trigger);</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> const slideout = await screen.findByRole('complementary'); // this assumes the slideout has the role="complementary"</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-rq9a2a-diff-removed"><pre>-</pre></td><td class="css-vl0irh-content css-rq9a2a-diff-removed"><pre class="css-o1u8iu-content-text"> const trigger = screen.getByTestId('slideout-trigger');</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-rq9a2a-diff-removed"><pre>-</pre></td><td class="css-vl0irh-content css-rq9a2a-diff-removed"><pre class="css-o1u8iu-content-text"> const slideout = screen.getByTestId('slideout');</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> // In version 5, you can only interact with the slideout once it has been loaded here.</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-10regm7-empty-line"><pre></pre></td><td class="css-vl0irh-content css-10regm7-empty-line"><pre class="css-o1u8iu-content-text"></pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-10regm7-empty-line"><pre></pre></td><td class="css-vl0irh-content css-10regm7-empty-line"><pre class="css-o1u8iu-content-text"></pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-rq9a2a-diff-removed"><pre>-</pre></td><td class="css-vl0irh-content css-rq9a2a-diff-removed"><pre class="css-o1u8iu-content-text"> // In version 4, you can already interact with the slideout here as its in the DOM at this stage.</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-rq9a2a-diff-removed"><pre>-</pre></td><td class="css-vl0irh-content css-rq9a2a-diff-removed"><pre class="css-o1u8iu-content-text"> </pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-rq9a2a-diff-removed"><pre>-</pre></td><td class="css-vl0irh-content css-rq9a2a-diff-removed"><pre class="css-o1u8iu-content-text"> // activate slideout</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-rq9a2a-diff-removed"><pre>-</pre></td><td class="css-vl0irh-content css-rq9a2a-diff-removed"><pre class="css-o1u8iu-content-text"> idsFireEvent.click(trigger);</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-rq9a2a-diff-removed"><pre>-</pre></td><td class="css-vl0irh-content css-rq9a2a-diff-removed"><pre class="css-o1u8iu-content-text"> await waitFor(() => expect(slideout).toBeVisible());</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-rq9a2a-diff-removed"><pre>-</pre></td><td class="css-vl0irh-content css-rq9a2a-diff-removed"><pre class="css-o1u8iu-content-text"> </pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker"><pre></pre></td><td class="css-vl0irh-content"><pre class="css-o1u8iu-content-text"> // close slideout</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-rq9a2a-diff-removed"><pre>-</pre></td><td class="css-vl0irh-content css-rq9a2a-diff-removed"><pre class="css-o1u8iu-content-text"> const closeButton = screen.getByTestId('slideout__close-button');</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> const closeButton = screen.getByRole('button', { name: /close/i });</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-rq9a2a-diff-removed"><pre>-</pre></td><td class="css-vl0irh-content css-rq9a2a-diff-removed"><pre class="css-o1u8iu-content-text"> idsFireEvent.click(closeButton);</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> await userEvent.click(closeButton);</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-rq9a2a-diff-removed"><pre>-</pre></td><td class="css-vl0irh-content css-rq9a2a-diff-removed"><pre class="css-o1u8iu-content-text"> await waitFor(() => expect(slideout).not.toBeVisible());</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker css-cnnxkz-diff-added"><pre>+</pre></td><td class="css-vl0irh-content css-cnnxkz-diff-added"><pre class="css-o1u8iu-content-text"> await waitForElementToBeRemoved(slideout);</pre></td></tr><tr class="css-1n7ec1i-line"><td class="css-17vezug-marker"><pre></pre></td><td class="css-vl0irh-content"><pre class="css-o1u8iu-content-text">});</pre></td></tr></tbody></table>
|
|
1707
|
+
|
|
1708
|
+
```
|
|
1709
|
+
|
|
1710
|
+
{
|
|
1711
|
+
render: () \=> <DiffViewer allowModeChange oldValue\={\`import { render, waitFor, screen } from '@testing-library/react';
|
|
1712
|
+
import { idsFireEvent, componentLoad } from '@iress/ids-react-test-utils';
|
|
1713
|
+
|
|
1714
|
+
test('opening and closing a slideout', async () => {
|
|
1715
|
+
await componentLoad(\[ 'slideout-trigger', 'slideout', \]);
|
|
1716
|
+
const trigger = screen.getByTestId('slideout-trigger'); const slideout = screen.getByTestId('slideout');
|
|
1717
|
+
// In version 4, you can already interact with the slideout here as its in the DOM at this stage.
|
|
1718
|
+
// activate slideout idsFireEvent.click(trigger); await waitFor(() => expect(slideout).toBeVisible());
|
|
1719
|
+
// close slideout const closeButton = screen.getByTestId('slideout\_\_close-button'); idsFireEvent.click(closeButton); await waitFor(() => expect(slideout).not.toBeVisible());
|
|
1720
|
+
});\`} newValue\={\`import { render, screen, waitForElementToBeRemoved } from '@testing-library/react';
|
|
1721
|
+
import { userEvent } from '@testing-library/user-event';
|
|
1722
|
+
test('opening and closing a slideout', async () => {
|
|
1723
|
+
const trigger = screen.getByRole('button', { name: /open slideout/i });
|
|
1724
|
+
// activate slideout await userEvent.click(trigger); const slideout = await screen.findByRole('complementary'); // this assumes the slideout has the role="complementary"
|
|
1725
|
+
// In version 5, you can only interact with the slideout once it has been loaded here.
|
|
1726
|
+
// close slideout const closeButton = screen.getByRole('button', { name: /close/i }); await userEvent.click(closeButton); await waitForElementToBeRemoved(slideout);
|
|
1727
|
+
});\`} />
|
|
1728
|
+
}
|
|
1729
|
+
|
|
1730
|
+
```
|
|
1731
|
+
|
|
1732
|
+
#### Props
|
|
1733
|
+
|
|
1734
|
+
| Name | Description | Default | Control |
|
|
1735
|
+
| --- | --- | --- | --- |
|
|
1736
|
+
| children |
|
|
1737
|
+
Content to be displayed within the slideout.
|
|
1738
|
+
|
|
1739
|
+
ReactNode
|
|
1740
|
+
|
|
1741
|
+
|
|
1742
|
+
|
|
1743
|
+
| \- | \- |
|
|
1744
|
+
| closeText |
|
|
1745
|
+
|
|
1746
|
+
Screenreader text for close button.
|
|
1747
|
+
|
|
1748
|
+
string
|
|
1749
|
+
|
|
1750
|
+
|
|
1751
|
+
|
|
1752
|
+
|
|
|
1753
|
+
|
|
1754
|
+
'Close'
|
|
1755
|
+
|
|
1756
|
+
| \- |
|
|
1757
|
+
| container |
|
|
1758
|
+
|
|
1759
|
+
The container element to render the slideout into. By default, the slideout will render at the end of the document body.
|
|
1760
|
+
|
|
1761
|
+
FloatingUIContainer
|
|
1762
|
+
|
|
1763
|
+
|
|
1764
|
+
|
|
1765
|
+
| \- | \- |
|
|
1766
|
+
| defaultShow |
|
|
1767
|
+
|
|
1768
|
+
When set to `true` the slideout will be visible. Use for uncontrolled slideouts.
|
|
1769
|
+
|
|
1770
|
+
boolean
|
|
1771
|
+
|
|
1772
|
+
|
|
1773
|
+
|
|
1774
|
+
|
|
|
1775
|
+
|
|
1776
|
+
false
|
|
1777
|
+
|
|
1778
|
+
| \- |
|
|
1779
|
+
| eleToPush |
|
|
1780
|
+
|
|
1781
|
+
The element that needs to be pushed relative to the slideout. This can be a string selector to match an existing element in the DOM, a html element, or a React reference. Will be ignored if `mode` is not set to `push` or if element does not exist.
|
|
1782
|
+
|
|
1783
|
+
union
|
|
1784
|
+
|
|
1785
|
+
|
|
1786
|
+
|
|
1787
|
+
| \- | \- |
|
|
1788
|
+
| footer |
|
|
1789
|
+
|
|
1790
|
+
Panel to place slideout controls.
|
|
1791
|
+
|
|
1792
|
+
ReactNode
|
|
1793
|
+
|
|
1794
|
+
|
|
1795
|
+
|
|
1796
|
+
| \- | \- |
|
|
1797
|
+
| heading |
|
|
1798
|
+
|
|
1799
|
+
Sets the heading for the slideout. If passed an element, it will render the element with an id, to ensure its connection to the slideout.
|
|
1800
|
+
|
|
1801
|
+
union
|
|
1802
|
+
|
|
1803
|
+
|
|
1804
|
+
|
|
1805
|
+
| \- | \- |
|
|
1806
|
+
| id |
|
|
1807
|
+
|
|
1808
|
+
Unique ID for the slideout. Use if you would like to open this slideout from anywhere in your app using the `useSlideout` hook.
|
|
1809
|
+
|
|
1810
|
+
string
|
|
1811
|
+
|
|
1812
|
+
|
|
1813
|
+
|
|
1814
|
+
| \- | \- |
|
|
1815
|
+
| mode |
|
|
1816
|
+
|
|
1817
|
+
Sets how the Slideout interacts with the content of the page. `overlay` overlays the page content, obscuring the content below. `push` will push the element (specified by `eleToPush`) across the page. `push` will revert back to `overlay` if `eleToPush` is not specified or if the screen size < 1200px.
|
|
1818
|
+
|
|
1819
|
+
union
|
|
1820
|
+
|
|
1821
|
+
|
|
1822
|
+
|
|
1823
|
+
|
|
|
1824
|
+
|
|
1825
|
+
'overlay'
|
|
1826
|
+
|
|
1827
|
+
| \- |
|
|
1828
|
+
| onEntered |
|
|
1829
|
+
|
|
1830
|
+
Emitted when the slideout has opened.
|
|
1831
|
+
|
|
1832
|
+
() => void
|
|
1833
|
+
|
|
1834
|
+
| \- | \- |
|
|
1835
|
+
| onExited |
|
|
1836
|
+
|
|
1837
|
+
Emitted when the slideout has closed.
|
|
1838
|
+
|
|
1839
|
+
() => void
|
|
1840
|
+
|
|
1841
|
+
| \- | \- |
|
|
1842
|
+
| onShowChange |
|
|
1843
|
+
|
|
1844
|
+
Emitted when the slideout has opened or closed internally. Use for controlled slideouts.
|
|
1845
|
+
|
|
1846
|
+
(show: boolean, reason?: OpenChangeReason) => void
|
|
1847
|
+
|
|
1848
|
+
| \- | \- |
|
|
1849
|
+
| onStatus |
|
|
1850
|
+
|
|
1851
|
+
Emitted when the slideout has mounted, unmounted, opened or closed. Open and close occur before animation begins.
|
|
1852
|
+
|
|
1853
|
+
(status: 'unmounted' | 'initial' | 'open' | 'close') => void
|
|
1854
|
+
|
|
1855
|
+
| \- | \- |
|
|
1856
|
+
| position |
|
|
1857
|
+
|
|
1858
|
+
Position of the slideout relative to the page. `left` or `right`.
|
|
1859
|
+
|
|
1860
|
+
union
|
|
1861
|
+
|
|
1862
|
+
|
|
1863
|
+
|
|
1864
|
+
|
|
|
1865
|
+
|
|
1866
|
+
'right'
|
|
1867
|
+
|
|
1868
|
+
| \- |
|
|
1869
|
+
| show |
|
|
1870
|
+
|
|
1871
|
+
When set to `true` the slideout will be visible. Use for controlled slideouts.
|
|
1872
|
+
|
|
1873
|
+
boolean
|
|
1874
|
+
|
|
1875
|
+
|
|
1876
|
+
|
|
1877
|
+
| \- | \- |
|
|
1878
|
+
| size |
|
|
1879
|
+
|
|
1880
|
+
Accepts a single `SlideoutSize`. Slideouts will display at 100% for mobile screens (<576px).
|
|
1881
|
+
|
|
1882
|
+
union
|
|
1883
|
+
|
|
1884
|
+
|
|
1885
|
+
|
|
1886
|
+
|
|
|
1887
|
+
|
|
1888
|
+
'sm'
|
|
1889
|
+
|
|
1890
|
+
| \- |
|
|
1891
|
+
|
|
1892
|
+
### Speed up tests
|
|
1893
|
+
|
|
1894
|
+
You can speed up tests by wrapping your tests in a provider that overrides the theme tokens for animations.
|
|
1895
|
+
|
|
1896
|
+
const themeOverrides: Record<string, string\> \= {
|
|
1897
|
+
'--iress-slideout-animation-duration': '0s',
|
|
1898
|
+
};
|
|
1899
|
+
export const TestAppProvider \= ({ children }: PropsWithChildren) \=> {
|
|
1900
|
+
const containerRef \= useRef<HTMLDivElement\>(null);
|
|
1901
|
+
return (
|
|
1902
|
+
<IressModalProvider container\={containerRef}\>
|
|
1903
|
+
<div style\={themeOverrides} ref\={containerRef}\>
|
|
1904
|
+
{children}
|
|
1905
|
+
</div\>
|
|
1906
|
+
</IressModalProvider\>
|
|
1907
|
+
);
|
|
1908
|
+
};
|
|
1909
|
+
|
|
1910
|
+
```
|