@iress-oss/ids-mcp-server 5.14.2 → 5.20.1
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 +492 -0
- package/generated/docs/components_components-autocomplete-docs.md +3485 -0
- package/generated/docs/{components-autocomplete-recipes-docs.md → components_components-autocomplete-recipes-docs.md} +32 -14
- package/generated/docs/{components-badge-docs.md → components_components-badge-docs.md} +222 -30
- package/generated/docs/components_components-button-docs.md +2078 -0
- package/generated/docs/components_components-button-recipes-docs.md +37 -0
- package/generated/docs/components_components-buttongroup-docs.md +1045 -0
- package/generated/docs/components_components-card-docs.md +2276 -0
- package/generated/docs/{components-card-recipes-docs.md → components_components-card-recipes-docs.md} +131 -14
- package/generated/docs/components_components-checkbox-docs.md +1054 -0
- package/generated/docs/{components-checkboxgroup-docs.md → components_components-checkboxgroup-docs.md} +1000 -81
- package/generated/docs/{components-checkboxgroup-recipes-docs.md → components_components-checkboxgroup-recipes-docs.md} +101 -11
- package/generated/docs/{components-col-docs.md → components_components-col-docs.md} +331 -58
- package/generated/docs/components_components-combobox-docs.md +3767 -0
- package/generated/docs/{components-container-docs.md → components_components-container-docs.md} +61 -24
- package/generated/docs/{components-divider-docs.md → components_components-divider-docs.md} +83 -24
- package/generated/docs/{components-expander-docs.md → components_components-expander-docs.md} +264 -33
- package/generated/docs/{components-field-docs.md → components_components-field-docs.md} +814 -120
- package/generated/docs/components_components-filter-docs.md +4080 -0
- package/generated/docs/{components-form-docs.md → components_components-form-docs.md} +1488 -358
- package/generated/docs/{components-form-recipes-docs.md → components_components-form-recipes-docs.md} +174 -64
- package/generated/docs/components_components-hide-docs.md +293 -0
- package/generated/docs/components_components-icon-docs.md +1337 -0
- package/generated/docs/{components-inline-docs.md → components_components-inline-docs.md} +462 -42
- package/generated/docs/components_components-input-docs.md +1468 -0
- package/generated/docs/components_components-input-recipes-docs.md +367 -0
- package/generated/docs/components_components-inputcurrency-docs.md +432 -0
- package/generated/docs/{components-inputcurrency-recipes-docs.md → components_components-inputcurrency-recipes-docs.md} +110 -17
- package/generated/docs/components_components-label-docs.md +323 -0
- package/generated/docs/components_components-menu-docs.md +2345 -0
- package/generated/docs/components_components-menu-menuitem-docs.md +633 -0
- package/generated/docs/{components-modal-docs.md → components_components-modal-docs.md} +1625 -232
- package/generated/docs/components_components-navbar-docs.md +1847 -0
- package/generated/docs/{components-navbar-recipes-docs.md → components_components-navbar-recipes-docs.md} +697 -39
- package/generated/docs/{components-panel-docs.md → components_components-panel-docs.md} +754 -57
- package/generated/docs/components_components-placeholder-docs.md +92 -0
- package/generated/docs/components_components-popover-docs.md +1641 -0
- package/generated/docs/{components-popover-recipes-docs.md → components_components-popover-recipes-docs.md} +347 -17
- package/generated/docs/components_components-progress-docs.md +115 -0
- package/generated/docs/components_components-provider-docs.md +114 -0
- package/generated/docs/components_components-radio-docs.md +491 -0
- package/generated/docs/{components-radiogroup-docs.md → components_components-radiogroup-docs.md} +943 -75
- package/generated/docs/components_components-readonly-docs.md +263 -0
- package/generated/docs/components_components-richselect-docs.md +6497 -0
- package/generated/docs/{components-row-docs.md → components_components-row-docs.md} +353 -43
- package/generated/docs/{components-select-docs.md → components_components-select-docs.md} +719 -61
- package/generated/docs/components_components-skeleton-docs.md +480 -0
- package/generated/docs/{components-skeleton-recipes-docs.md → components_components-skeleton-recipes-docs.md} +50 -10
- package/generated/docs/{components-skiplink-docs.md → components_components-skiplink-docs.md} +53 -14
- package/generated/docs/components_components-slideout-docs.md +2262 -0
- package/generated/docs/components_components-slider-docs.md +1276 -0
- package/generated/docs/components_components-spinner-docs.md +82 -0
- package/generated/docs/{components-stack-docs.md → components_components-stack-docs.md} +223 -40
- package/generated/docs/components_components-table-docs.md +3651 -0
- package/generated/docs/components_components-tabset-docs.md +772 -0
- package/generated/docs/components_components-tabset-tab-docs.md +262 -0
- package/generated/docs/components_components-tag-docs.md +259 -0
- package/generated/docs/{components-text-docs.md → components_components-text-docs.md} +491 -51
- package/generated/docs/{components-toaster-docs.md → components_components-toaster-docs.md} +224 -71
- package/generated/docs/components_components-toaster-toast-docs.md +634 -0
- package/generated/docs/components_components-toggle-docs.md +461 -0
- package/generated/docs/{components-tooltip-docs.md → components_components-tooltip-docs.md} +286 -41
- package/generated/docs/{components-validationmessage-docs.md → components_components-validationmessage-docs.md} +230 -61
- package/generated/docs/components_contact-us-docs.md +12 -0
- package/generated/docs/{foundations-accessibility-docs.md → components_foundations-accessibility-docs.md} +11 -21
- package/generated/docs/{foundations-colours-docs.md → components_foundations-colour-030-colours.md} +8 -15
- package/generated/docs/{foundations-consistency-docs.md → components_foundations-consistency-docs.md} +12 -20
- package/generated/docs/{foundations-content-docs.md → components_foundations-content-docs.md} +6 -11
- package/generated/docs/components_foundations-introduction-docs.md +15 -0
- package/generated/docs/{foundations-principles-docs.md → components_foundations-principles-docs.md} +14 -24
- package/generated/docs/components_foundations-typography-docs.md +608 -0
- package/generated/docs/{foundations-user-experience-docs.md → components_foundations-user-experience-docs.md} +16 -26
- package/generated/docs/{foundations-visual-design-docs.md → components_foundations-visual-design-docs.md} +10 -17
- package/generated/docs/{frequently-asked-questions-docs.md → components_frequently-asked-questions-docs.md} +14 -23
- package/generated/docs/components_get-started-develop-docs.md +84 -0
- package/generated/docs/components_get-started-using-storybook-docs.md +55 -0
- package/generated/docs/components_introduction-docs.md +15 -0
- package/generated/docs/{patterns-loading-docs.md → components_patterns-loading-docs.md} +711 -143
- package/generated/docs/components_resources-changelog-docs.md +4 -0
- package/generated/docs/{resources-code-katas-docs.md → components_resources-code-katas-docs.md} +5 -9
- package/generated/docs/{resources-migration-guides-from-v4-to-v5-docs.md → components_resources-migration-guides-from-v4-to-v5-docs.md} +54 -239
- package/generated/docs/{versions-docs.md → components_versions-docs.md} +5 -8
- package/generated/docs/guidelines.md +484 -200
- package/generated/docs/introduction-docs.md +19 -30
- package/package.json +41 -45
- package/generated/docs/components-alert-docs.md +0 -130
- package/generated/docs/components-autocomplete-docs.md +0 -754
- package/generated/docs/components-button-docs.md +0 -362
- package/generated/docs/components-button-recipes-docs.md +0 -76
- package/generated/docs/components-buttongroup-docs.md +0 -310
- package/generated/docs/components-card-docs.md +0 -494
- package/generated/docs/components-checkbox-docs.md +0 -193
- package/generated/docs/components-combobox-docs.md +0 -1016
- package/generated/docs/components-filter-docs.md +0 -1109
- package/generated/docs/components-hide-docs.md +0 -265
- package/generated/docs/components-icon-docs.md +0 -553
- package/generated/docs/components-input-docs.md +0 -335
- package/generated/docs/components-input-recipes-docs.md +0 -140
- package/generated/docs/components-inputcurrency-docs.md +0 -157
- package/generated/docs/components-label-docs.md +0 -135
- package/generated/docs/components-menu-docs.md +0 -704
- package/generated/docs/components-menu-menuitem-docs.md +0 -193
- package/generated/docs/components-navbar-docs.md +0 -291
- package/generated/docs/components-placeholder-docs.md +0 -27
- package/generated/docs/components-popover-docs.md +0 -464
- package/generated/docs/components-progress-docs.md +0 -104
- package/generated/docs/components-radio-docs.md +0 -107
- package/generated/docs/components-readonly-docs.md +0 -89
- package/generated/docs/components-richselect-docs.md +0 -2433
- package/generated/docs/components-skeleton-docs.md +0 -214
- package/generated/docs/components-slideout-docs.md +0 -538
- package/generated/docs/components-slider-docs.md +0 -346
- package/generated/docs/components-spinner-docs.md +0 -59
- package/generated/docs/components-table-ag-grid-docs.md +0 -2666
- package/generated/docs/components-table-docs.md +0 -1305
- package/generated/docs/components-tabset-docs.md +0 -341
- package/generated/docs/components-tabset-tab-docs.md +0 -86
- package/generated/docs/components-tag-docs.md +0 -115
- package/generated/docs/components-toaster-toast-docs.md +0 -157
- package/generated/docs/components-toggle-docs.md +0 -158
- package/generated/docs/contact-us-docs.md +0 -27
- package/generated/docs/extensions-editor-docs.md +0 -288
- package/generated/docs/extensions-editor-recipes-docs.md +0 -39
- package/generated/docs/foundations-introduction-docs.md +0 -17
- package/generated/docs/foundations-typography-docs.md +0 -191
- package/generated/docs/get-started-develop-docs.md +0 -48
- package/generated/docs/get-started-using-storybook-docs.md +0 -68
- package/generated/docs/resources-changelog-docs.md +0 -6
- package/generated/docs/themes-available-themes-docs.md +0 -66
- package/generated/docs/themes-introduction-docs.md +0 -121
- package/generated/docs/themes-tokens-docs.md +0 -1200
- /package/{LICENSE.txt → LICENSE} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
Modal
|
|
2
|
+
=====
|
|
3
3
|
|
|
4
4
|
Overview
|
|
5
5
|
--------
|
|
@@ -21,15 +21,19 @@ Read more
|
|
|
21
21
|
* Conveying brief messages about background processes or status changes. Instead use IressAlert or IressToast.
|
|
22
22
|
* The modal content can be incorporated into the page without complicating the page's intent
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
[](./iframe.html?id=components-modal--default)
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
Show modal
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
```
|
|
29
29
|
|
|
30
30
|
const Story \= () \=> {
|
|
31
31
|
const { showModal } \= useModal();
|
|
32
32
|
const MODAL\_ID \= 'storybook-modal';
|
|
33
|
+
return (
|
|
34
|
+
const Story \= () \=> {
|
|
35
|
+
const { showModal } \= useModal();
|
|
36
|
+
const MODAL\_ID \= 'storybook-modal';
|
|
33
37
|
return (
|
|
34
38
|
<\>
|
|
35
39
|
<IressButton onClick\={() \=> showModal(MODAL\_ID)}\>
|
|
@@ -48,23 +52,210 @@ export const App \= () \=> (
|
|
|
48
52
|
<Story />
|
|
49
53
|
</IressModalProvider\>
|
|
50
54
|
);
|
|
55
|
+
);
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export const App \= () \=> (
|
|
59
|
+
<IressModalProvider\>
|
|
60
|
+
<Story />
|
|
61
|
+
</IressModalProvider\>
|
|
62
|
+
);
|
|
63
|
+
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Props
|
|
67
|
+
-----
|
|
68
|
+
|
|
69
|
+
| Name | Description | Default | Control |
|
|
70
|
+
| --- | --- | --- | --- |
|
|
71
|
+
| children |
|
|
72
|
+
Text to be displayed inside the modal.
|
|
73
|
+
|
|
74
|
+
ReactNode
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
| \- |
|
|
79
|
+
|
|
80
|
+
"Modal content"
|
|
81
|
+
|
|
82
|
+
|
|
|
83
|
+
| closeText |
|
|
84
|
+
|
|
85
|
+
Screenreader text for close button.
|
|
86
|
+
|
|
87
|
+
string
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
| \- | Set string |
|
|
92
|
+
| container |
|
|
93
|
+
|
|
94
|
+
The container element to render the modal into. By default, the modal will render at the end of the document body.
|
|
95
|
+
|
|
96
|
+
FloatingUIContainer
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
| \- | Set object |
|
|
101
|
+
| defaultShow |
|
|
102
|
+
|
|
103
|
+
When set to `true` the modal will be visible by default. Use for uncontrolled modals.
|
|
104
|
+
|
|
105
|
+
boolean
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
|
|
|
110
|
+
|
|
111
|
+
false
|
|
112
|
+
|
|
113
|
+
| Set boolean |
|
|
114
|
+
| disableBackdropClick |
|
|
115
|
+
|
|
116
|
+
When set to `true`, users cannot exit the modal by clicking the backdrop or using the escape key.
|
|
117
|
+
|
|
118
|
+
boolean
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
| \- | Set boolean |
|
|
123
|
+
| fixedFooter |
|
|
124
|
+
|
|
125
|
+
When set to `true` the modal's footer will always be visible and fixed to the bottom of the modal.
|
|
126
|
+
|
|
127
|
+
boolean
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
| \- | Set boolean |
|
|
132
|
+
| footer |
|
|
133
|
+
|
|
134
|
+
Panel to place modal controls.
|
|
135
|
+
|
|
136
|
+
ReactNode
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
| \- |
|
|
141
|
+
|
|
142
|
+
"Footer slot"
|
|
143
|
+
|
|
144
|
+
|
|
|
145
|
+
| heading |
|
|
146
|
+
|
|
147
|
+
Sets the heading for the modal. If passed an element, it will render the element with an id, to ensure its connection to the modal.
|
|
148
|
+
|
|
149
|
+
union
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
| \- | Set object |
|
|
154
|
+
| id |
|
|
155
|
+
|
|
156
|
+
Unique ID for the modal. Use if you would like to open this modal from anywhere in your app using the `useModal` hook.
|
|
157
|
+
|
|
158
|
+
string
|
|
159
|
+
|
|
51
160
|
|
|
52
|
-
Copy
|
|
53
161
|
|
|
54
|
-
|
|
55
|
-
|
|
162
|
+
| \- | storybook-modal |
|
|
163
|
+
| noCloseButton |
|
|
56
164
|
|
|
57
|
-
|
|
165
|
+
When set to `true`, no close button will be rendered. You must add your own closing mechanism to ensure accessibility.
|
|
166
|
+
|
|
167
|
+
boolean
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
| \- | Set boolean |
|
|
172
|
+
| onEntered |
|
|
173
|
+
|
|
174
|
+
Emitted when the modal has opened.
|
|
175
|
+
|
|
176
|
+
() => void
|
|
177
|
+
|
|
178
|
+
| \- | \- |
|
|
179
|
+
| onExited |
|
|
180
|
+
|
|
181
|
+
Emitted when the modal has closed.
|
|
182
|
+
|
|
183
|
+
() => void
|
|
184
|
+
|
|
185
|
+
| \- | \- |
|
|
186
|
+
| onShowChange |
|
|
187
|
+
|
|
188
|
+
Emitted when the modal has opened or closed internally. Use for controlled modals.
|
|
189
|
+
|
|
190
|
+
(show: boolean) => void
|
|
191
|
+
|
|
192
|
+
| \- | \- |
|
|
193
|
+
| onStatus |
|
|
194
|
+
|
|
195
|
+
Emitted when the modal has mounted, unmounted, opened or closed. Open and close occur before animation begins.
|
|
196
|
+
|
|
197
|
+
(status: 'unmounted' | 'initial' | 'open' | 'close') => void
|
|
198
|
+
|
|
199
|
+
| \- | \- |
|
|
200
|
+
| padding |
|
|
201
|
+
|
|
202
|
+
Sets the padding of the wrapping panel component
|
|
203
|
+
|
|
204
|
+
union
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
|
|
|
209
|
+
|
|
210
|
+
'md'
|
|
211
|
+
|
|
212
|
+
| Set object |
|
|
213
|
+
| show |
|
|
214
|
+
|
|
215
|
+
When set to `true` the modal will be visible. Use for controlled modals.
|
|
216
|
+
|
|
217
|
+
boolean
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
| \- | \- |
|
|
222
|
+
| size |
|
|
223
|
+
|
|
224
|
+
Accepts a `string` or `{ xs: sm }` (for responsive sizing) of `ModalSizes` options.
|
|
225
|
+
|
|
226
|
+
union
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
|
|
|
231
|
+
|
|
232
|
+
'md'
|
|
233
|
+
|
|
234
|
+
| Set object |
|
|
235
|
+
| static |
|
|
236
|
+
|
|
237
|
+
When set to `true`, the modal will act like a static element when open. This means it will not lock scroll or focus within the modal. Note: This is used internally to display modals in Styler. It is not recommended to use this prop in your own applications.
|
|
238
|
+
|
|
239
|
+
boolean
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
| \- | Set boolean |
|
|
244
|
+
|
|
245
|
+
Controlling the modal
|
|
246
|
+
---------------------
|
|
247
|
+
|
|
248
|
+
### Using the `show` property
|
|
58
249
|
|
|
59
250
|
You can use state to control the modal by setting the `show` property to `true` or `false`. To sync your state with the modal, you can use the `onShowChange` prop, which is normally passed the set function from `useState`.
|
|
60
251
|
|
|
61
|
-
|
|
252
|
+
[](./iframe.html?id=components-modal--show-with-state)
|
|
62
253
|
|
|
63
|
-
|
|
254
|
+
Show modal using state
|
|
64
255
|
|
|
65
|
-
|
|
256
|
+
```
|
|
66
257
|
|
|
67
|
-
import { IressButton, IressModal, IressModalProps } from '@iress-oss/ids-components';
|
|
258
|
+
import { IressButton, IressModal, type IressModalProps } from '@iress-oss/ids-components';
|
|
68
259
|
import { useState } from 'react';
|
|
69
260
|
export const ModalUsingState \= () \=> {
|
|
70
261
|
const \[show, setShow\] \= useState(false);
|
|
@@ -84,24 +275,198 @@ export const ModalUsingState \= () \=> {
|
|
|
84
275
|
);
|
|
85
276
|
};
|
|
86
277
|
|
|
87
|
-
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
#### Props
|
|
281
|
+
|
|
282
|
+
| Name | Description | Default | Control |
|
|
283
|
+
| --- | --- | --- | --- |
|
|
284
|
+
| children |
|
|
285
|
+
Text to be displayed inside the modal.
|
|
286
|
+
|
|
287
|
+
ReactNode
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+
|
|
291
|
+
| \- |
|
|
292
|
+
|
|
293
|
+
"This modal was opened via state"
|
|
294
|
+
|
|
295
|
+
|
|
|
296
|
+
| closeText |
|
|
297
|
+
|
|
298
|
+
Screenreader text for close button.
|
|
299
|
+
|
|
300
|
+
string
|
|
301
|
+
|
|
302
|
+
|
|
303
|
+
|
|
304
|
+
| \- | Set string |
|
|
305
|
+
| container |
|
|
306
|
+
|
|
307
|
+
The container element to render the modal into. By default, the modal will render at the end of the document body.
|
|
308
|
+
|
|
309
|
+
FloatingUIContainer
|
|
310
|
+
|
|
311
|
+
|
|
312
|
+
|
|
313
|
+
| \- | Set object |
|
|
314
|
+
| defaultShow |
|
|
315
|
+
|
|
316
|
+
When set to `true` the modal will be visible by default. Use for uncontrolled modals.
|
|
88
317
|
|
|
89
|
-
|
|
318
|
+
boolean
|
|
319
|
+
|
|
320
|
+
|
|
321
|
+
|
|
322
|
+
|
|
|
323
|
+
|
|
324
|
+
false
|
|
325
|
+
|
|
326
|
+
| Set boolean |
|
|
327
|
+
| disableBackdropClick |
|
|
328
|
+
|
|
329
|
+
When set to `true`, users cannot exit the modal by clicking the backdrop or using the escape key.
|
|
330
|
+
|
|
331
|
+
boolean
|
|
332
|
+
|
|
333
|
+
|
|
334
|
+
|
|
335
|
+
| \- | Set boolean |
|
|
336
|
+
| fixedFooter |
|
|
337
|
+
|
|
338
|
+
When set to `true` the modal's footer will always be visible and fixed to the bottom of the modal.
|
|
339
|
+
|
|
340
|
+
boolean
|
|
341
|
+
|
|
342
|
+
|
|
343
|
+
|
|
344
|
+
| \- | Set boolean |
|
|
345
|
+
| footer |
|
|
346
|
+
|
|
347
|
+
Panel to place modal controls.
|
|
348
|
+
|
|
349
|
+
ReactNode
|
|
350
|
+
|
|
351
|
+
|
|
352
|
+
|
|
353
|
+
| \- | \- |
|
|
354
|
+
| heading |
|
|
355
|
+
|
|
356
|
+
Sets the heading for the modal. If passed an element, it will render the element with an id, to ensure its connection to the modal.
|
|
357
|
+
|
|
358
|
+
union
|
|
359
|
+
|
|
360
|
+
|
|
361
|
+
|
|
362
|
+
| \- | Set object |
|
|
363
|
+
| id |
|
|
364
|
+
|
|
365
|
+
Unique ID for the modal. Use if you would like to open this modal from anywhere in your app using the `useModal` hook.
|
|
366
|
+
|
|
367
|
+
string
|
|
368
|
+
|
|
369
|
+
|
|
370
|
+
|
|
371
|
+
| \- | Set string |
|
|
372
|
+
| noCloseButton |
|
|
373
|
+
|
|
374
|
+
When set to `true`, no close button will be rendered. You must add your own closing mechanism to ensure accessibility.
|
|
375
|
+
|
|
376
|
+
boolean
|
|
377
|
+
|
|
378
|
+
|
|
379
|
+
|
|
380
|
+
| \- | Set boolean |
|
|
381
|
+
| onEntered |
|
|
382
|
+
|
|
383
|
+
Emitted when the modal has opened.
|
|
384
|
+
|
|
385
|
+
() => void
|
|
386
|
+
|
|
387
|
+
| \- | \- |
|
|
388
|
+
| onExited |
|
|
389
|
+
|
|
390
|
+
Emitted when the modal has closed.
|
|
391
|
+
|
|
392
|
+
() => void
|
|
393
|
+
|
|
394
|
+
| \- | \- |
|
|
395
|
+
| onShowChange |
|
|
396
|
+
|
|
397
|
+
Emitted when the modal has opened or closed internally. Use for controlled modals.
|
|
398
|
+
|
|
399
|
+
(show: boolean) => void
|
|
400
|
+
|
|
401
|
+
| \- | \- |
|
|
402
|
+
| onStatus |
|
|
403
|
+
|
|
404
|
+
Emitted when the modal has mounted, unmounted, opened or closed. Open and close occur before animation begins.
|
|
405
|
+
|
|
406
|
+
(status: 'unmounted' | 'initial' | 'open' | 'close') => void
|
|
407
|
+
|
|
408
|
+
| \- | \- |
|
|
409
|
+
| padding |
|
|
410
|
+
|
|
411
|
+
Sets the padding of the wrapping panel component
|
|
412
|
+
|
|
413
|
+
union
|
|
414
|
+
|
|
415
|
+
|
|
416
|
+
|
|
417
|
+
|
|
|
418
|
+
|
|
419
|
+
'md'
|
|
420
|
+
|
|
421
|
+
| Set object |
|
|
422
|
+
| show |
|
|
423
|
+
|
|
424
|
+
When set to `true` the modal will be visible. Use for controlled modals.
|
|
425
|
+
|
|
426
|
+
boolean
|
|
427
|
+
|
|
428
|
+
|
|
429
|
+
|
|
430
|
+
| \- | \- |
|
|
431
|
+
| size |
|
|
432
|
+
|
|
433
|
+
Accepts a `string` or `{ xs: sm }` (for responsive sizing) of `ModalSizes` options.
|
|
434
|
+
|
|
435
|
+
union
|
|
436
|
+
|
|
437
|
+
|
|
438
|
+
|
|
439
|
+
|
|
|
440
|
+
|
|
441
|
+
'md'
|
|
442
|
+
|
|
443
|
+
| Set object |
|
|
444
|
+
| static |
|
|
445
|
+
|
|
446
|
+
When set to `true`, the modal will act like a static element when open. This means it will not lock scroll or focus within the modal. Note: This is used internally to display modals in Styler. It is not recommended to use this prop in your own applications.
|
|
447
|
+
|
|
448
|
+
boolean
|
|
449
|
+
|
|
450
|
+
|
|
451
|
+
|
|
452
|
+
| \- | Set boolean |
|
|
453
|
+
|
|
454
|
+
### Using the `IressModalProvider`
|
|
90
455
|
|
|
91
456
|
You can use the `IressModalProvider` to open and close modals from anywhere in your application, as long as the modal has a unique `id`. In this case you would use the `useModal` hook to open and close the modal.
|
|
92
457
|
|
|
93
458
|
To use, wrap your `<App/>` or the component that you want to use the `useModal` hook with `<IressModalProvider />`.
|
|
94
459
|
|
|
95
|
-
|
|
460
|
+
[](./iframe.html?id=components-modal-provider--provider)
|
|
96
461
|
|
|
97
|
-
|
|
462
|
+
Show modal using provider
|
|
98
463
|
|
|
99
|
-
|
|
464
|
+
```
|
|
100
465
|
|
|
101
466
|
import {
|
|
102
467
|
IressButton,
|
|
103
468
|
IressModal,
|
|
104
|
-
IressModalProps,
|
|
469
|
+
type IressModalProps,
|
|
105
470
|
IressModalProvider,
|
|
106
471
|
useModal,
|
|
107
472
|
} from '@iress-oss/ids-components';
|
|
@@ -133,32 +498,57 @@ const ModalWithTrigger \= ({
|
|
|
133
498
|
);
|
|
134
499
|
};
|
|
135
500
|
|
|
136
|
-
|
|
501
|
+
```
|
|
502
|
+
|
|
503
|
+
#### Props
|
|
504
|
+
|
|
505
|
+
These are some settings you can use to customise the provider, such as setting where the modals are rendered in the DOM.
|
|
506
|
+
|
|
507
|
+
| Name | Description | Default | Control |
|
|
508
|
+
| --- | --- | --- | --- |
|
|
509
|
+
| children |
|
|
510
|
+
\-
|
|
511
|
+
|
|
512
|
+
| \- | \- |
|
|
513
|
+
| container |
|
|
514
|
+
|
|
515
|
+
The container element to render the modal into. By default, the modal will render at the end of the document body.
|
|
516
|
+
|
|
517
|
+
FloatingUIContainer
|
|
137
518
|
|
|
138
|
-
|
|
139
|
-
|
|
519
|
+
|
|
520
|
+
|
|
521
|
+
| \- | \- |
|
|
522
|
+
| Show Storybook only itemsStorybook only | Show Storybook only items |
|
|
523
|
+
|
|
524
|
+
Behaviour
|
|
525
|
+
---------
|
|
140
526
|
|
|
141
527
|
* No other interaction on the main page can be accessed while a modal is active. A backdrop covers the content beneath so that the content beneath cannot be interacted with.
|
|
142
528
|
* Clicking on the the backdrop closes the modal and returns the focus to the triggering element.
|
|
143
529
|
* When the modal is active the body is set to overflow: hidden to stop any scrolling of the underlying page. Scrolling should then only be possible on the modal wrapper.
|
|
144
530
|
* By default there are 3 ways to dismiss the modal; click X in the header; press ESC on a keyboard; click anywhere on the backdrop. It is also recommended that consumers add a Cancel or Close button to the modal's footer slot if required.
|
|
145
531
|
|
|
146
|
-
|
|
147
|
-
|
|
532
|
+
Examples
|
|
533
|
+
--------
|
|
148
534
|
|
|
149
|
-
###
|
|
535
|
+
### Footer slot
|
|
150
536
|
|
|
151
537
|
Content to appear underneath the main content. Usually used for extra controls like buttons etc.
|
|
152
538
|
|
|
153
|
-
|
|
539
|
+
[](./iframe.html?id=components-modal--footer-slot)
|
|
154
540
|
|
|
155
|
-
|
|
541
|
+
Footer slot modal
|
|
156
542
|
|
|
157
|
-
|
|
543
|
+
```
|
|
158
544
|
|
|
159
545
|
const Story \= () \=> {
|
|
160
546
|
const { showModal } \= useModal();
|
|
161
547
|
const MODAL\_ID \= 'storybook-modal';
|
|
548
|
+
return (
|
|
549
|
+
const Story \= () \=> {
|
|
550
|
+
const { showModal } \= useModal();
|
|
551
|
+
const MODAL\_ID \= 'storybook-modal';
|
|
162
552
|
return (
|
|
163
553
|
<\>
|
|
164
554
|
<IressButton onClick\={() \=> showModal(MODAL\_ID)}\>
|
|
@@ -172,55 +562,241 @@ return (
|
|
|
172
562
|
);
|
|
173
563
|
};
|
|
174
564
|
|
|
565
|
+
export const App \= () \=> (
|
|
566
|
+
<IressModalProvider\>
|
|
567
|
+
<Story />
|
|
568
|
+
</IressModalProvider\>
|
|
569
|
+
);
|
|
570
|
+
);
|
|
571
|
+
};
|
|
572
|
+
|
|
175
573
|
export const App \= () \=> (
|
|
176
574
|
<IressModalProvider\>
|
|
177
575
|
<Story />
|
|
178
576
|
</IressModalProvider\>
|
|
179
577
|
);
|
|
180
578
|
|
|
181
|
-
|
|
579
|
+
```
|
|
182
580
|
|
|
183
|
-
|
|
581
|
+
#### Props
|
|
184
582
|
|
|
185
|
-
|
|
583
|
+
| Name | Description | Default | Control |
|
|
584
|
+
| --- | --- | --- | --- |
|
|
585
|
+
| children |
|
|
586
|
+
Text to be displayed inside the modal.
|
|
186
587
|
|
|
187
|
-
|
|
588
|
+
ReactNode
|
|
188
589
|
|
|
189
|
-
Using with popovers and tooltips
|
|
190
|
-
--------------------------------
|
|
191
590
|
|
|
192
|
-
The fixed footer variant of IressModal prevents content from overflowing the modal. This can cause layout issues when using with components that use popovers (for example IressCombobox), especially when these components sit at the end of the modal's content. If you encounter these issues, try using a modal without a fixed footer. Normal modals allow content to overflow, which should fix the issue.
|
|
193
591
|
|
|
194
|
-
|
|
592
|
+
| \- |
|
|
195
593
|
|
|
196
|
-
|
|
594
|
+
"Normal modal content"
|
|
197
595
|
|
|
198
|
-
|
|
596
|
+
|
|
|
597
|
+
| closeText |
|
|
199
598
|
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
599
|
+
Screenreader text for close button.
|
|
600
|
+
|
|
601
|
+
string
|
|
602
|
+
|
|
603
|
+
|
|
604
|
+
|
|
605
|
+
| \- | Set string |
|
|
606
|
+
| container |
|
|
607
|
+
|
|
608
|
+
The container element to render the modal into. By default, the modal will render at the end of the document body.
|
|
609
|
+
|
|
610
|
+
FloatingUIContainer
|
|
611
|
+
|
|
612
|
+
|
|
613
|
+
|
|
614
|
+
| \- | Set object |
|
|
615
|
+
| defaultShow |
|
|
616
|
+
|
|
617
|
+
When set to `true` the modal will be visible by default. Use for uncontrolled modals.
|
|
618
|
+
|
|
619
|
+
boolean
|
|
620
|
+
|
|
621
|
+
|
|
622
|
+
|
|
623
|
+
|
|
|
624
|
+
|
|
625
|
+
false
|
|
626
|
+
|
|
627
|
+
| Set boolean |
|
|
628
|
+
| disableBackdropClick |
|
|
629
|
+
|
|
630
|
+
When set to `true`, users cannot exit the modal by clicking the backdrop or using the escape key.
|
|
631
|
+
|
|
632
|
+
boolean
|
|
633
|
+
|
|
634
|
+
|
|
635
|
+
|
|
636
|
+
| \- | Set boolean |
|
|
637
|
+
| fixedFooter |
|
|
638
|
+
|
|
639
|
+
When set to `true` the modal's footer will always be visible and fixed to the bottom of the modal.
|
|
640
|
+
|
|
641
|
+
boolean
|
|
642
|
+
|
|
643
|
+
|
|
644
|
+
|
|
645
|
+
| \- | Set boolean |
|
|
646
|
+
| footer |
|
|
647
|
+
|
|
648
|
+
Panel to place modal controls.
|
|
649
|
+
|
|
650
|
+
ReactNode
|
|
651
|
+
|
|
652
|
+
|
|
653
|
+
|
|
654
|
+
| \- | \- |
|
|
655
|
+
| heading |
|
|
656
|
+
|
|
657
|
+
Sets the heading for the modal. If passed an element, it will render the element with an id, to ensure its connection to the modal.
|
|
658
|
+
|
|
659
|
+
union
|
|
660
|
+
|
|
661
|
+
|
|
662
|
+
|
|
663
|
+
| \- | Set object |
|
|
664
|
+
| id |
|
|
665
|
+
|
|
666
|
+
Unique ID for the modal. Use if you would like to open this modal from anywhere in your app using the `useModal` hook.
|
|
667
|
+
|
|
668
|
+
string
|
|
669
|
+
|
|
670
|
+
|
|
671
|
+
|
|
672
|
+
| \- | storybook-modal |
|
|
673
|
+
| noCloseButton |
|
|
674
|
+
|
|
675
|
+
When set to `true`, no close button will be rendered. You must add your own closing mechanism to ensure accessibility.
|
|
676
|
+
|
|
677
|
+
boolean
|
|
678
|
+
|
|
679
|
+
|
|
680
|
+
|
|
681
|
+
| \- | Set boolean |
|
|
682
|
+
| onEntered |
|
|
683
|
+
|
|
684
|
+
Emitted when the modal has opened.
|
|
685
|
+
|
|
686
|
+
() => void
|
|
687
|
+
|
|
688
|
+
| \- | \- |
|
|
689
|
+
| onExited |
|
|
690
|
+
|
|
691
|
+
Emitted when the modal has closed.
|
|
692
|
+
|
|
693
|
+
() => void
|
|
694
|
+
|
|
695
|
+
| \- | \- |
|
|
696
|
+
| onShowChange |
|
|
697
|
+
|
|
698
|
+
Emitted when the modal has opened or closed internally. Use for controlled modals.
|
|
699
|
+
|
|
700
|
+
(show: boolean) => void
|
|
701
|
+
|
|
702
|
+
| \- | \- |
|
|
703
|
+
| onStatus |
|
|
704
|
+
|
|
705
|
+
Emitted when the modal has mounted, unmounted, opened or closed. Open and close occur before animation begins.
|
|
706
|
+
|
|
707
|
+
(status: 'unmounted' | 'initial' | 'open' | 'close') => void
|
|
708
|
+
|
|
709
|
+
| \- | \- |
|
|
710
|
+
| padding |
|
|
711
|
+
|
|
712
|
+
Sets the padding of the wrapping panel component
|
|
713
|
+
|
|
714
|
+
union
|
|
715
|
+
|
|
716
|
+
|
|
717
|
+
|
|
718
|
+
|
|
|
719
|
+
|
|
720
|
+
'md'
|
|
721
|
+
|
|
722
|
+
| Set object |
|
|
723
|
+
| show |
|
|
724
|
+
|
|
725
|
+
When set to `true` the modal will be visible. Use for controlled modals.
|
|
726
|
+
|
|
727
|
+
boolean
|
|
728
|
+
|
|
729
|
+
|
|
730
|
+
|
|
731
|
+
| \- | \- |
|
|
732
|
+
| size |
|
|
733
|
+
|
|
734
|
+
Accepts a `string` or `{ xs: sm }` (for responsive sizing) of `ModalSizes` options.
|
|
735
|
+
|
|
736
|
+
union
|
|
737
|
+
|
|
738
|
+
|
|
739
|
+
|
|
740
|
+
|
|
|
741
|
+
|
|
742
|
+
'md'
|
|
743
|
+
|
|
744
|
+
| Set object |
|
|
745
|
+
| static |
|
|
746
|
+
|
|
747
|
+
When set to `true`, the modal will act like a static element when open. This means it will not lock scroll or focus within the modal. Note: This is used internally to display modals in Styler. It is not recommended to use this prop in your own applications.
|
|
748
|
+
|
|
749
|
+
boolean
|
|
750
|
+
|
|
751
|
+
|
|
752
|
+
|
|
753
|
+
| \- | Set boolean |
|
|
754
|
+
|
|
755
|
+
### Fixed footer
|
|
756
|
+
|
|
757
|
+
The `fixedFooter` prop can be used to set the footer to be fixed to the bottom of the modal. This is often useful when there is a lot of content in the main area that you would like to scroll underneath the footer content.
|
|
758
|
+
|
|
759
|
+
**Note:** Also works without footer content.
|
|
760
|
+
|
|
761
|
+
Using with popovers and tooltips
|
|
762
|
+
--------------------------------
|
|
763
|
+
|
|
764
|
+
The fixed footer variant of IressModal prevents content from overflowing the modal. This can cause layout issues when using with components that use popovers (for example IressCombobox), especially when these components sit at the end of the modal's content. If you encounter these issues, try using a modal without a fixed footer. Normal modals allow content to overflow, which should fix the issue.
|
|
765
|
+
|
|
766
|
+
[](./iframe.html?id=components-modal--fixed-footer)
|
|
767
|
+
|
|
768
|
+
Fixed footer modal
|
|
769
|
+
|
|
770
|
+
```
|
|
771
|
+
|
|
772
|
+
const Story \= () \=> {
|
|
773
|
+
const { showModal } \= useModal();
|
|
774
|
+
const MODAL\_ID \= 'storybook-modal';
|
|
775
|
+
return (
|
|
776
|
+
const Story \= () \=> {
|
|
777
|
+
const { showModal } \= useModal();
|
|
778
|
+
const MODAL\_ID \= 'storybook-modal';
|
|
779
|
+
return (
|
|
780
|
+
<\>
|
|
781
|
+
<IressButton onClick\={() \=> showModal(MODAL\_ID)}\>
|
|
782
|
+
Fixed footer modal </IressButton\>
|
|
783
|
+
<IressModal
|
|
784
|
+
fixedFooter
|
|
785
|
+
footer\={<IressButton\>Button in footer</IressButton\>}
|
|
786
|
+
id\="storybook-modal"
|
|
787
|
+
\>
|
|
788
|
+
<React.Fragment key\=".0"\>
|
|
789
|
+
<IressText element\="h2"\>
|
|
790
|
+
Next Saturday night, we're sending you back to the future </IressText\>
|
|
791
|
+
<IressText\>
|
|
792
|
+
<p\>
|
|
793
|
+
I still don't understand, how am I supposed to go to the dance with her, if she's already going to the dance with you. Alright, okay Jennifer. What if I send in the tape and they don't like it. I mean, what if they say I'm no good. What if they say, 'Get out of here, kid, you got no future.' I mean, I just don't think I can take that kind of rejection. Jesus, I'm beginning to sound like my old man. Ahh. Alright, take it up, go. Doc. This is it. This is the answer. It says here that a bolt of lightning is gonna strike the clock tower precisely at 10:04 p.m. next Saturday night. If we could somehow harness this bolt of lightning, channel it into the flux capacitor, it just might work. Next Saturday night, we're sending you back to the future. </p\>
|
|
794
|
+
<p\>
|
|
795
|
+
Go. Yeah, it's in the back. The future, it's where you're going? Mother, with Marty's parents out of town, don't you think he oughta spend the night, after all, Dad almost killed him with the car. What's going on? Where have you been all week? </p\>
|
|
796
|
+
<p\>
|
|
797
|
+
But I can't go to the dance, I'll miss my favorite television program, Science Fiction Theater. Well uh, good, fine. Ahh. Ahh. Right, okay, so right around 9:00 she's gonna get very angry with me. That's right. </p\>
|
|
798
|
+
<h3\>
|
|
799
|
+
I just don't think I can take that kind of rejection </h3\>
|
|
224
800
|
<p\>
|
|
225
801
|
I still don't understand, how am I supposed to go to the dance with her, if she's already going to the dance with you. Alright, okay Jennifer. What if I send in the tape and they don't like it. I mean, what if they say I'm no good. What if they say, 'Get out of here, kid, you got no future.' I mean, I just don't think I can take that kind of rejection. Jesus, I'm beginning to sound like my old man. Ahh. Alright, take it up, go. Doc. This is it. This is the answer. It says here that a bolt of lightning is gonna strike the clock tower precisely at 10:04 p.m. next Saturday night. If we could somehow harness this bolt of lightning, channel it into the flux capacitor, it just might work. Next Saturday night, we're sending you back to the future. </p\>
|
|
226
802
|
<p\>
|
|
@@ -247,18 +823,196 @@ export const App \= () \=> (
|
|
|
247
823
|
<Story />
|
|
248
824
|
</IressModalProvider\>
|
|
249
825
|
);
|
|
826
|
+
);
|
|
827
|
+
};
|
|
828
|
+
|
|
829
|
+
export const App \= () \=> (
|
|
830
|
+
<IressModalProvider\>
|
|
831
|
+
<Story />
|
|
832
|
+
</IressModalProvider\>
|
|
833
|
+
);
|
|
834
|
+
|
|
835
|
+
```
|
|
836
|
+
|
|
837
|
+
#### Props
|
|
838
|
+
|
|
839
|
+
| Name | Description | Default | Control |
|
|
840
|
+
| --- | --- | --- | --- |
|
|
841
|
+
| children |
|
|
842
|
+
Text to be displayed inside the modal.
|
|
843
|
+
|
|
844
|
+
ReactNode
|
|
845
|
+
|
|
846
|
+
|
|
847
|
+
|
|
848
|
+
| \- | \- |
|
|
849
|
+
| closeText |
|
|
850
|
+
|
|
851
|
+
Screenreader text for close button.
|
|
852
|
+
|
|
853
|
+
string
|
|
854
|
+
|
|
855
|
+
|
|
856
|
+
|
|
857
|
+
| \- | Set string |
|
|
858
|
+
| container |
|
|
859
|
+
|
|
860
|
+
The container element to render the modal into. By default, the modal will render at the end of the document body.
|
|
861
|
+
|
|
862
|
+
FloatingUIContainer
|
|
863
|
+
|
|
864
|
+
|
|
865
|
+
|
|
866
|
+
| \- | Set object |
|
|
867
|
+
| defaultShow |
|
|
868
|
+
|
|
869
|
+
When set to `true` the modal will be visible by default. Use for uncontrolled modals.
|
|
870
|
+
|
|
871
|
+
boolean
|
|
872
|
+
|
|
873
|
+
|
|
874
|
+
|
|
875
|
+
|
|
|
876
|
+
|
|
877
|
+
false
|
|
878
|
+
|
|
879
|
+
| Set boolean |
|
|
880
|
+
| disableBackdropClick |
|
|
881
|
+
|
|
882
|
+
When set to `true`, users cannot exit the modal by clicking the backdrop or using the escape key.
|
|
883
|
+
|
|
884
|
+
boolean
|
|
885
|
+
|
|
886
|
+
|
|
887
|
+
|
|
888
|
+
| \- | Set boolean |
|
|
889
|
+
| fixedFooter |
|
|
890
|
+
|
|
891
|
+
When set to `true` the modal's footer will always be visible and fixed to the bottom of the modal.
|
|
892
|
+
|
|
893
|
+
boolean
|
|
894
|
+
|
|
895
|
+
|
|
896
|
+
|
|
897
|
+
| \- | FalseTrue |
|
|
898
|
+
| footer |
|
|
899
|
+
|
|
900
|
+
Panel to place modal controls.
|
|
901
|
+
|
|
902
|
+
ReactNode
|
|
903
|
+
|
|
904
|
+
|
|
905
|
+
|
|
906
|
+
| \- | \- |
|
|
907
|
+
| heading |
|
|
908
|
+
|
|
909
|
+
Sets the heading for the modal. If passed an element, it will render the element with an id, to ensure its connection to the modal.
|
|
250
910
|
|
|
251
|
-
|
|
911
|
+
union
|
|
252
912
|
|
|
253
|
-
|
|
913
|
+
|
|
914
|
+
|
|
915
|
+
| \- | Set object |
|
|
916
|
+
| id |
|
|
917
|
+
|
|
918
|
+
Unique ID for the modal. Use if you would like to open this modal from anywhere in your app using the `useModal` hook.
|
|
919
|
+
|
|
920
|
+
string
|
|
921
|
+
|
|
922
|
+
|
|
923
|
+
|
|
924
|
+
| \- | storybook-modal |
|
|
925
|
+
| noCloseButton |
|
|
926
|
+
|
|
927
|
+
When set to `true`, no close button will be rendered. You must add your own closing mechanism to ensure accessibility.
|
|
928
|
+
|
|
929
|
+
boolean
|
|
930
|
+
|
|
931
|
+
|
|
932
|
+
|
|
933
|
+
| \- | Set boolean |
|
|
934
|
+
| onEntered |
|
|
935
|
+
|
|
936
|
+
Emitted when the modal has opened.
|
|
937
|
+
|
|
938
|
+
() => void
|
|
939
|
+
|
|
940
|
+
| \- | \- |
|
|
941
|
+
| onExited |
|
|
942
|
+
|
|
943
|
+
Emitted when the modal has closed.
|
|
944
|
+
|
|
945
|
+
() => void
|
|
946
|
+
|
|
947
|
+
| \- | \- |
|
|
948
|
+
| onShowChange |
|
|
949
|
+
|
|
950
|
+
Emitted when the modal has opened or closed internally. Use for controlled modals.
|
|
951
|
+
|
|
952
|
+
(show: boolean) => void
|
|
953
|
+
|
|
954
|
+
| \- | \- |
|
|
955
|
+
| onStatus |
|
|
956
|
+
|
|
957
|
+
Emitted when the modal has mounted, unmounted, opened or closed. Open and close occur before animation begins.
|
|
958
|
+
|
|
959
|
+
(status: 'unmounted' | 'initial' | 'open' | 'close') => void
|
|
960
|
+
|
|
961
|
+
| \- | \- |
|
|
962
|
+
| padding |
|
|
963
|
+
|
|
964
|
+
Sets the padding of the wrapping panel component
|
|
965
|
+
|
|
966
|
+
union
|
|
967
|
+
|
|
968
|
+
|
|
969
|
+
|
|
970
|
+
|
|
|
971
|
+
|
|
972
|
+
'md'
|
|
973
|
+
|
|
974
|
+
| Set object |
|
|
975
|
+
| show |
|
|
976
|
+
|
|
977
|
+
When set to `true` the modal will be visible. Use for controlled modals.
|
|
978
|
+
|
|
979
|
+
boolean
|
|
980
|
+
|
|
981
|
+
|
|
982
|
+
|
|
983
|
+
| \- | \- |
|
|
984
|
+
| size |
|
|
985
|
+
|
|
986
|
+
Accepts a `string` or `{ xs: sm }` (for responsive sizing) of `ModalSizes` options.
|
|
987
|
+
|
|
988
|
+
union
|
|
989
|
+
|
|
990
|
+
|
|
991
|
+
|
|
992
|
+
|
|
|
993
|
+
|
|
994
|
+
'md'
|
|
995
|
+
|
|
996
|
+
| Set object |
|
|
997
|
+
| static |
|
|
998
|
+
|
|
999
|
+
When set to `true`, the modal will act like a static element when open. This means it will not lock scroll or focus within the modal. Note: This is used internally to display modals in Styler. It is not recommended to use this prop in your own applications.
|
|
1000
|
+
|
|
1001
|
+
boolean
|
|
1002
|
+
|
|
1003
|
+
|
|
1004
|
+
|
|
1005
|
+
| \- | Set boolean |
|
|
1006
|
+
|
|
1007
|
+
### Size
|
|
254
1008
|
|
|
255
1009
|
The `size` prop can be set to `sm`, `md`, `lg` or `fullpage`. It defaults to `md`.
|
|
256
1010
|
|
|
257
|
-
|
|
1011
|
+
[](./iframe.html?id=components-modal--size)
|
|
258
1012
|
|
|
259
|
-
|
|
1013
|
+
smmdlgfullpage
|
|
260
1014
|
|
|
261
|
-
|
|
1015
|
+
```
|
|
262
1016
|
|
|
263
1017
|
const ModalWithTrigger \= () \=> {
|
|
264
1018
|
const { showModal } \= useModal();
|
|
@@ -280,126 +1034,455 @@ export const ModalSizes \= () \=> (
|
|
|
280
1034
|
</IressModalProvider\>
|
|
281
1035
|
);
|
|
282
1036
|
|
|
283
|
-
|
|
1037
|
+
```
|
|
1038
|
+
|
|
1039
|
+
#### Props
|
|
1040
|
+
|
|
1041
|
+
| Name | Description | Default | Control |
|
|
1042
|
+
| --- | --- | --- | --- |
|
|
1043
|
+
| children |
|
|
1044
|
+
Text to be displayed inside the modal.
|
|
1045
|
+
|
|
1046
|
+
ReactNode
|
|
1047
|
+
|
|
1048
|
+
|
|
1049
|
+
|
|
1050
|
+
| \- | \- |
|
|
1051
|
+
| closeText |
|
|
1052
|
+
|
|
1053
|
+
Screenreader text for close button.
|
|
1054
|
+
|
|
1055
|
+
string
|
|
1056
|
+
|
|
1057
|
+
|
|
1058
|
+
|
|
1059
|
+
| \- | Set string |
|
|
1060
|
+
| container |
|
|
1061
|
+
|
|
1062
|
+
The container element to render the modal into. By default, the modal will render at the end of the document body.
|
|
1063
|
+
|
|
1064
|
+
FloatingUIContainer
|
|
1065
|
+
|
|
1066
|
+
|
|
1067
|
+
|
|
1068
|
+
| \- | Set object |
|
|
1069
|
+
| defaultShow |
|
|
1070
|
+
|
|
1071
|
+
When set to `true` the modal will be visible by default. Use for uncontrolled modals.
|
|
1072
|
+
|
|
1073
|
+
boolean
|
|
1074
|
+
|
|
1075
|
+
|
|
1076
|
+
|
|
1077
|
+
|
|
|
1078
|
+
|
|
1079
|
+
false
|
|
1080
|
+
|
|
1081
|
+
| Set boolean |
|
|
1082
|
+
| disableBackdropClick |
|
|
1083
|
+
|
|
1084
|
+
When set to `true`, users cannot exit the modal by clicking the backdrop or using the escape key.
|
|
1085
|
+
|
|
1086
|
+
boolean
|
|
1087
|
+
|
|
1088
|
+
|
|
1089
|
+
|
|
1090
|
+
| \- | Set boolean |
|
|
1091
|
+
| fixedFooter |
|
|
1092
|
+
|
|
1093
|
+
When set to `true` the modal's footer will always be visible and fixed to the bottom of the modal.
|
|
1094
|
+
|
|
1095
|
+
boolean
|
|
1096
|
+
|
|
1097
|
+
|
|
1098
|
+
|
|
1099
|
+
| \- | Set boolean |
|
|
1100
|
+
| footer |
|
|
1101
|
+
|
|
1102
|
+
Panel to place modal controls.
|
|
1103
|
+
|
|
1104
|
+
ReactNode
|
|
1105
|
+
|
|
1106
|
+
|
|
1107
|
+
|
|
1108
|
+
| \- |
|
|
1109
|
+
|
|
1110
|
+
"Size modal footer"
|
|
1111
|
+
|
|
1112
|
+
|
|
|
1113
|
+
| heading |
|
|
1114
|
+
|
|
1115
|
+
Sets the heading for the modal. If passed an element, it will render the element with an id, to ensure its connection to the modal.
|
|
1116
|
+
|
|
1117
|
+
union
|
|
1118
|
+
|
|
1119
|
+
|
|
1120
|
+
|
|
1121
|
+
| \- | Set object |
|
|
1122
|
+
| id |
|
|
1123
|
+
|
|
1124
|
+
Unique ID for the modal. Use if you would like to open this modal from anywhere in your app using the `useModal` hook.
|
|
1125
|
+
|
|
1126
|
+
string
|
|
1127
|
+
|
|
1128
|
+
|
|
1129
|
+
|
|
1130
|
+
| \- | \- |
|
|
1131
|
+
| noCloseButton |
|
|
1132
|
+
|
|
1133
|
+
When set to `true`, no close button will be rendered. You must add your own closing mechanism to ensure accessibility.
|
|
1134
|
+
|
|
1135
|
+
boolean
|
|
1136
|
+
|
|
1137
|
+
|
|
1138
|
+
|
|
1139
|
+
| \- | Set boolean |
|
|
1140
|
+
| onEntered |
|
|
1141
|
+
|
|
1142
|
+
Emitted when the modal has opened.
|
|
1143
|
+
|
|
1144
|
+
() => void
|
|
1145
|
+
|
|
1146
|
+
| \- | \- |
|
|
1147
|
+
| onExited |
|
|
1148
|
+
|
|
1149
|
+
Emitted when the modal has closed.
|
|
1150
|
+
|
|
1151
|
+
() => void
|
|
1152
|
+
|
|
1153
|
+
| \- | \- |
|
|
1154
|
+
| onShowChange |
|
|
1155
|
+
|
|
1156
|
+
Emitted when the modal has opened or closed internally. Use for controlled modals.
|
|
1157
|
+
|
|
1158
|
+
(show: boolean) => void
|
|
1159
|
+
|
|
1160
|
+
| \- | \- |
|
|
1161
|
+
| onStatus |
|
|
1162
|
+
|
|
1163
|
+
Emitted when the modal has mounted, unmounted, opened or closed. Open and close occur before animation begins.
|
|
1164
|
+
|
|
1165
|
+
(status: 'unmounted' | 'initial' | 'open' | 'close') => void
|
|
1166
|
+
|
|
1167
|
+
| \- | \- |
|
|
1168
|
+
| padding |
|
|
1169
|
+
|
|
1170
|
+
Sets the padding of the wrapping panel component
|
|
1171
|
+
|
|
1172
|
+
union
|
|
1173
|
+
|
|
1174
|
+
|
|
1175
|
+
|
|
1176
|
+
|
|
|
1177
|
+
|
|
1178
|
+
'md'
|
|
1179
|
+
|
|
1180
|
+
| Set object |
|
|
1181
|
+
| show |
|
|
1182
|
+
|
|
1183
|
+
When set to `true` the modal will be visible. Use for controlled modals.
|
|
1184
|
+
|
|
1185
|
+
boolean
|
|
1186
|
+
|
|
1187
|
+
|
|
1188
|
+
|
|
1189
|
+
| \- | \- |
|
|
1190
|
+
| size |
|
|
1191
|
+
|
|
1192
|
+
Accepts a `string` or `{ xs: sm }` (for responsive sizing) of `ModalSizes` options.
|
|
1193
|
+
|
|
1194
|
+
union
|
|
1195
|
+
|
|
1196
|
+
|
|
1197
|
+
|
|
1198
|
+
|
|
|
1199
|
+
|
|
1200
|
+
'md'
|
|
1201
|
+
|
|
1202
|
+
| \- |
|
|
1203
|
+
| static |
|
|
1204
|
+
|
|
1205
|
+
When set to `true`, the modal will act like a static element when open. This means it will not lock scroll or focus within the modal. Note: This is used internally to display modals in Styler. It is not recommended to use this prop in your own applications.
|
|
1206
|
+
|
|
1207
|
+
boolean
|
|
1208
|
+
|
|
1209
|
+
|
|
1210
|
+
|
|
1211
|
+
| \- | Set boolean |
|
|
1212
|
+
|
|
1213
|
+
### Responsive size
|
|
1214
|
+
|
|
1215
|
+
The `size` prop can take an object that takes five key/value pairs that correlate with the IDS breakpoints.
|
|
1216
|
+
|
|
1217
|
+
If you set a responsive `size`, the modal becomes full width on screens smaller than the value you specified. For example, if you want to create a large modal on medium screens and above:
|
|
1218
|
+
|
|
1219
|
+
<IressModal size\={{ md: IressModal.Size.Lg }}\>
|
|
1220
|
+
|
|
1221
|
+
```
|
|
1222
|
+
|
|
1223
|
+
The modal will be full width on extra-small and small screens, and large width on medium, large and extra-large screens. This is the same as setting:
|
|
1224
|
+
|
|
1225
|
+
<IressModal size\={{ xs: IressModal.Size.Fullpage, md: IressModal.Size.Lg }}\>
|
|
1226
|
+
|
|
1227
|
+
```
|
|
1228
|
+
|
|
1229
|
+
You can override this behaviour by specifying a value for `xs` in your size object:
|
|
1230
|
+
|
|
1231
|
+
<IressModal size\={{ xs: IressModal.Size.Sm, md: IressModal.Size.Lg }}\>
|
|
1232
|
+
|
|
1233
|
+
```
|
|
1234
|
+
|
|
1235
|
+
[](./iframe.html?id=components-modal--responsive-size)
|
|
1236
|
+
|
|
1237
|
+
Responsive modal
|
|
1238
|
+
|
|
1239
|
+
```
|
|
1240
|
+
|
|
1241
|
+
const Story \= () \=> {
|
|
1242
|
+
const { showModal } \= useModal();
|
|
1243
|
+
const MODAL\_ID \= 'storybook-modal';
|
|
1244
|
+
return (
|
|
1245
|
+
const Story \= () \=> {
|
|
1246
|
+
const { showModal } \= useModal();
|
|
1247
|
+
const MODAL\_ID \= 'storybook-modal';
|
|
1248
|
+
return (
|
|
1249
|
+
<\>
|
|
1250
|
+
<IressButton onClick\={() \=> showModal(MODAL\_ID)}\>
|
|
1251
|
+
Responsive modal </IressButton\>
|
|
1252
|
+
<IressModal
|
|
1253
|
+
footer\=""
|
|
1254
|
+
id\="storybook-modal"
|
|
1255
|
+
size\={{
|
|
1256
|
+
lg: 'md',
|
|
1257
|
+
md: 'sm',
|
|
1258
|
+
xl: 'lg'
|
|
1259
|
+
}}
|
|
1260
|
+
\>
|
|
1261
|
+
<kn />
|
|
1262
|
+
</IressModal\>
|
|
1263
|
+
</\>
|
|
1264
|
+
);
|
|
1265
|
+
};
|
|
1266
|
+
|
|
1267
|
+
export const App \= () \=> (
|
|
1268
|
+
<IressModalProvider\>
|
|
1269
|
+
<Story />
|
|
1270
|
+
</IressModalProvider\>
|
|
1271
|
+
);
|
|
1272
|
+
);
|
|
1273
|
+
};
|
|
1274
|
+
|
|
1275
|
+
export const App \= () \=> (
|
|
1276
|
+
<IressModalProvider\>
|
|
1277
|
+
<Story />
|
|
1278
|
+
</IressModalProvider\>
|
|
1279
|
+
);
|
|
1280
|
+
|
|
1281
|
+
```
|
|
1282
|
+
|
|
1283
|
+
#### Props
|
|
1284
|
+
|
|
1285
|
+
| Name | Description | Default | Control |
|
|
1286
|
+
| --- | --- | --- | --- |
|
|
1287
|
+
| children |
|
|
1288
|
+
Text to be displayed inside the modal.
|
|
1289
|
+
|
|
1290
|
+
ReactNode
|
|
1291
|
+
|
|
1292
|
+
|
|
1293
|
+
|
|
1294
|
+
| \- | \- |
|
|
1295
|
+
| closeText |
|
|
1296
|
+
|
|
1297
|
+
Screenreader text for close button.
|
|
1298
|
+
|
|
1299
|
+
string
|
|
1300
|
+
|
|
1301
|
+
|
|
1302
|
+
|
|
1303
|
+
| \- | Set string |
|
|
1304
|
+
| container |
|
|
1305
|
+
|
|
1306
|
+
The container element to render the modal into. By default, the modal will render at the end of the document body.
|
|
1307
|
+
|
|
1308
|
+
FloatingUIContainer
|
|
1309
|
+
|
|
1310
|
+
|
|
1311
|
+
|
|
1312
|
+
| \- | Set object |
|
|
1313
|
+
| defaultShow |
|
|
1314
|
+
|
|
1315
|
+
When set to `true` the modal will be visible by default. Use for uncontrolled modals.
|
|
1316
|
+
|
|
1317
|
+
boolean
|
|
1318
|
+
|
|
1319
|
+
|
|
1320
|
+
|
|
1321
|
+
|
|
|
1322
|
+
|
|
1323
|
+
false
|
|
1324
|
+
|
|
1325
|
+
| Set boolean |
|
|
1326
|
+
| disableBackdropClick |
|
|
1327
|
+
|
|
1328
|
+
When set to `true`, users cannot exit the modal by clicking the backdrop or using the escape key.
|
|
1329
|
+
|
|
1330
|
+
boolean
|
|
1331
|
+
|
|
1332
|
+
|
|
1333
|
+
|
|
1334
|
+
| \- | Set boolean |
|
|
1335
|
+
| fixedFooter |
|
|
1336
|
+
|
|
1337
|
+
When set to `true` the modal's footer will always be visible and fixed to the bottom of the modal.
|
|
1338
|
+
|
|
1339
|
+
boolean
|
|
1340
|
+
|
|
1341
|
+
|
|
1342
|
+
|
|
1343
|
+
| \- | Set boolean |
|
|
1344
|
+
| footer |
|
|
1345
|
+
|
|
1346
|
+
Panel to place modal controls.
|
|
1347
|
+
|
|
1348
|
+
ReactNode
|
|
1349
|
+
|
|
1350
|
+
|
|
1351
|
+
|
|
1352
|
+
| \- |
|
|
1353
|
+
|
|
1354
|
+
""
|
|
1355
|
+
|
|
1356
|
+
|
|
|
1357
|
+
| heading |
|
|
1358
|
+
|
|
1359
|
+
Sets the heading for the modal. If passed an element, it will render the element with an id, to ensure its connection to the modal.
|
|
1360
|
+
|
|
1361
|
+
union
|
|
1362
|
+
|
|
1363
|
+
|
|
1364
|
+
|
|
1365
|
+
| \- | Set object |
|
|
1366
|
+
| id |
|
|
1367
|
+
|
|
1368
|
+
Unique ID for the modal. Use if you would like to open this modal from anywhere in your app using the `useModal` hook.
|
|
1369
|
+
|
|
1370
|
+
string
|
|
1371
|
+
|
|
1372
|
+
|
|
1373
|
+
|
|
1374
|
+
| \- | storybook-modal |
|
|
1375
|
+
| noCloseButton |
|
|
1376
|
+
|
|
1377
|
+
When set to `true`, no close button will be rendered. You must add your own closing mechanism to ensure accessibility.
|
|
1378
|
+
|
|
1379
|
+
boolean
|
|
1380
|
+
|
|
1381
|
+
|
|
1382
|
+
|
|
1383
|
+
| \- | Set boolean |
|
|
1384
|
+
| onEntered |
|
|
1385
|
+
|
|
1386
|
+
Emitted when the modal has opened.
|
|
1387
|
+
|
|
1388
|
+
() => void
|
|
1389
|
+
|
|
1390
|
+
| \- | \- |
|
|
1391
|
+
| onExited |
|
|
1392
|
+
|
|
1393
|
+
Emitted when the modal has closed.
|
|
1394
|
+
|
|
1395
|
+
() => void
|
|
1396
|
+
|
|
1397
|
+
| \- | \- |
|
|
1398
|
+
| onShowChange |
|
|
1399
|
+
|
|
1400
|
+
Emitted when the modal has opened or closed internally. Use for controlled modals.
|
|
1401
|
+
|
|
1402
|
+
(show: boolean) => void
|
|
1403
|
+
|
|
1404
|
+
| \- | \- |
|
|
1405
|
+
| onStatus |
|
|
1406
|
+
|
|
1407
|
+
Emitted when the modal has mounted, unmounted, opened or closed. Open and close occur before animation begins.
|
|
1408
|
+
|
|
1409
|
+
(status: 'unmounted' | 'initial' | 'open' | 'close') => void
|
|
1410
|
+
|
|
1411
|
+
| \- | \- |
|
|
1412
|
+
| padding |
|
|
1413
|
+
|
|
1414
|
+
Sets the padding of the wrapping panel component
|
|
1415
|
+
|
|
1416
|
+
union
|
|
1417
|
+
|
|
1418
|
+
|
|
1419
|
+
|
|
1420
|
+
|
|
|
1421
|
+
|
|
1422
|
+
'md'
|
|
1423
|
+
|
|
1424
|
+
| Set object |
|
|
1425
|
+
| show |
|
|
1426
|
+
|
|
1427
|
+
When set to `true` the modal will be visible. Use for controlled modals.
|
|
1428
|
+
|
|
1429
|
+
boolean
|
|
1430
|
+
|
|
1431
|
+
|
|
1432
|
+
|
|
1433
|
+
| \- | \- |
|
|
1434
|
+
| size |
|
|
1435
|
+
|
|
1436
|
+
Accepts a `string` or `{ xs: sm }` (for responsive sizing) of `ModalSizes` options.
|
|
1437
|
+
|
|
1438
|
+
union
|
|
1439
|
+
|
|
1440
|
+
|
|
284
1441
|
|
|
285
|
-
|
|
1442
|
+
|
|
|
286
1443
|
|
|
287
|
-
|
|
1444
|
+
'md'
|
|
288
1445
|
|
|
289
|
-
|
|
1446
|
+
|
|
|
290
1447
|
|
|
291
|
-
|
|
292
|
-
scrollbar-width: none;
|
|
293
|
-
-ms-overflow-style: none;
|
|
294
|
-
-webkit-overflow-scrolling: touch;
|
|
295
|
-
}
|
|
296
|
-
\[data-radix-scroll-area-viewport\]::-webkit-scrollbar {
|
|
297
|
-
display: none;
|
|
298
|
-
}
|
|
299
|
-
:where(\[data-radix-scroll-area-viewport\]) {
|
|
300
|
-
display: flex;
|
|
301
|
-
flex-direction: column;
|
|
302
|
-
align-items: stretch;
|
|
303
|
-
}
|
|
304
|
-
:where(\[data-radix-scroll-area-content\]) {
|
|
305
|
-
flex-grow: 1;
|
|
306
|
-
}
|
|
1448
|
+
RAW
|
|
307
1449
|
|
|
308
|
-
|
|
1450
|
+
size :
|
|
309
1451
|
|
|
310
|
-
|
|
1452
|
+
{
|
|
311
1453
|
|
|
312
|
-
|
|
1454
|
+
* md : "sm"
|
|
1455
|
+
* lg : "md"
|
|
1456
|
+
* xl : "lg"
|
|
313
1457
|
|
|
314
|
-
\[data-radix-scroll-area-viewport\] {
|
|
315
|
-
scrollbar-width: none;
|
|
316
|
-
-ms-overflow-style: none;
|
|
317
|
-
-webkit-overflow-scrolling: touch;
|
|
318
|
-
}
|
|
319
|
-
\[data-radix-scroll-area-viewport\]::-webkit-scrollbar {
|
|
320
|
-
display: none;
|
|
321
|
-
}
|
|
322
|
-
:where(\[data-radix-scroll-area-viewport\]) {
|
|
323
|
-
display: flex;
|
|
324
|
-
flex-direction: column;
|
|
325
|
-
align-items: stretch;
|
|
326
|
-
}
|
|
327
|
-
:where(\[data-radix-scroll-area-content\]) {
|
|
328
|
-
flex-grow: 1;
|
|
329
1458
|
}
|
|
330
1459
|
|
|
331
|
-
<IressModal size\={{ xs: IressModal.Size.Fullpage, md: IressModal.Size.Lg }}\>
|
|
332
1460
|
|
|
333
|
-
Copy
|
|
334
1461
|
|
|
335
|
-
You can override this behaviour by specifying a value for `xs` in your size object:
|
|
336
1462
|
|
|
337
|
-
\[data-radix-scroll-area-viewport\] {
|
|
338
|
-
scrollbar-width: none;
|
|
339
|
-
-ms-overflow-style: none;
|
|
340
|
-
-webkit-overflow-scrolling: touch;
|
|
341
|
-
}
|
|
342
|
-
\[data-radix-scroll-area-viewport\]::-webkit-scrollbar {
|
|
343
|
-
display: none;
|
|
344
|
-
}
|
|
345
|
-
:where(\[data-radix-scroll-area-viewport\]) {
|
|
346
|
-
display: flex;
|
|
347
|
-
flex-direction: column;
|
|
348
|
-
align-items: stretch;
|
|
349
|
-
}
|
|
350
|
-
:where(\[data-radix-scroll-area-content\]) {
|
|
351
|
-
flex-grow: 1;
|
|
352
|
-
}
|
|
353
1463
|
|
|
354
|
-
<IressModal size\={{ xs: IressModal.Size.Sm, md: IressModal.Size.Lg }}\>
|
|
355
1464
|
|
|
356
|
-
Copy
|
|
357
1465
|
|
|
358
|
-
|
|
1466
|
+
|
|
|
1467
|
+
| static |
|
|
359
1468
|
|
|
360
|
-
|
|
1469
|
+
When set to `true`, the modal will act like a static element when open. This means it will not lock scroll or focus within the modal. Note: This is used internally to display modals in Styler. It is not recommended to use this prop in your own applications.
|
|
1470
|
+
|
|
1471
|
+
boolean
|
|
361
1472
|
|
|
362
|
-
\[data-radix-scroll-area-viewport\] { scrollbar-width: none; -ms-overflow-style: none; -webkit-overflow-scrolling: touch; } \[data-radix-scroll-area-viewport\]::-webkit-scrollbar { display: none; } :where(\[data-radix-scroll-area-viewport\]) { display: flex; flex-direction: column; align-items: stretch; } :where(\[data-radix-scroll-area-content\]) { flex-grow: 1; }
|
|
363
1473
|
|
|
364
|
-
const Story \= () \=> {
|
|
365
|
-
const { showModal } \= useModal();
|
|
366
|
-
const MODAL\_ID \= 'storybook-modal';
|
|
367
|
-
return (
|
|
368
|
-
<\>
|
|
369
|
-
<IressButton onClick\={() \=> showModal(MODAL\_ID)}\>
|
|
370
|
-
Responsive modal </IressButton\>
|
|
371
|
-
<IressModal
|
|
372
|
-
footer\=""
|
|
373
|
-
id\="storybook-modal"
|
|
374
|
-
size\={{
|
|
375
|
-
lg: 'md',
|
|
376
|
-
md: 'sm',
|
|
377
|
-
xl: 'lg'
|
|
378
|
-
}}
|
|
379
|
-
\>
|
|
380
|
-
<CurrentBreakpoint />
|
|
381
|
-
</IressModal\>
|
|
382
|
-
</\>
|
|
383
|
-
);
|
|
384
|
-
};
|
|
385
|
-
|
|
386
|
-
export const App \= () \=> (
|
|
387
|
-
<IressModalProvider\>
|
|
388
|
-
<Story />
|
|
389
|
-
</IressModalProvider\>
|
|
390
|
-
);
|
|
391
1474
|
|
|
392
|
-
|
|
1475
|
+
| \- | Set boolean |
|
|
393
1476
|
|
|
394
|
-
###
|
|
1477
|
+
### Padding
|
|
395
1478
|
|
|
396
1479
|
The `padding` prop can be set to either `none`, `sm`, `md` or `lg`. It defaults to `md`.
|
|
397
1480
|
|
|
398
|
-
|
|
1481
|
+
[](./iframe.html?id=components-modal--padding)
|
|
399
1482
|
|
|
400
|
-
|
|
1483
|
+
none paddingsm paddingmd paddinglg padding
|
|
401
1484
|
|
|
402
|
-
|
|
1485
|
+
```
|
|
403
1486
|
|
|
404
1487
|
const ModalWithTrigger \= () \=> {
|
|
405
1488
|
const { showModal } \= useModal();
|
|
@@ -422,23 +1505,201 @@ export const ModalPaddings \= () \=> (
|
|
|
422
1505
|
</IressModalProvider\>
|
|
423
1506
|
);
|
|
424
1507
|
|
|
425
|
-
|
|
1508
|
+
```
|
|
1509
|
+
|
|
1510
|
+
#### Props
|
|
1511
|
+
|
|
1512
|
+
| Name | Description | Default | Control |
|
|
1513
|
+
| --- | --- | --- | --- |
|
|
1514
|
+
| children |
|
|
1515
|
+
Text to be displayed inside the modal.
|
|
1516
|
+
|
|
1517
|
+
ReactNode
|
|
1518
|
+
|
|
1519
|
+
|
|
1520
|
+
|
|
1521
|
+
| \- | \- |
|
|
1522
|
+
| closeText |
|
|
1523
|
+
|
|
1524
|
+
Screenreader text for close button.
|
|
1525
|
+
|
|
1526
|
+
string
|
|
1527
|
+
|
|
1528
|
+
|
|
1529
|
+
|
|
1530
|
+
| \- | Set string |
|
|
1531
|
+
| container |
|
|
1532
|
+
|
|
1533
|
+
The container element to render the modal into. By default, the modal will render at the end of the document body.
|
|
1534
|
+
|
|
1535
|
+
FloatingUIContainer
|
|
1536
|
+
|
|
1537
|
+
|
|
1538
|
+
|
|
1539
|
+
| \- | Set object |
|
|
1540
|
+
| defaultShow |
|
|
1541
|
+
|
|
1542
|
+
When set to `true` the modal will be visible by default. Use for uncontrolled modals.
|
|
1543
|
+
|
|
1544
|
+
boolean
|
|
1545
|
+
|
|
1546
|
+
|
|
1547
|
+
|
|
1548
|
+
|
|
|
1549
|
+
|
|
1550
|
+
false
|
|
1551
|
+
|
|
1552
|
+
| Set boolean |
|
|
1553
|
+
| disableBackdropClick |
|
|
1554
|
+
|
|
1555
|
+
When set to `true`, users cannot exit the modal by clicking the backdrop or using the escape key.
|
|
1556
|
+
|
|
1557
|
+
boolean
|
|
1558
|
+
|
|
1559
|
+
|
|
1560
|
+
|
|
1561
|
+
| \- | Set boolean |
|
|
1562
|
+
| fixedFooter |
|
|
1563
|
+
|
|
1564
|
+
When set to `true` the modal's footer will always be visible and fixed to the bottom of the modal.
|
|
1565
|
+
|
|
1566
|
+
boolean
|
|
1567
|
+
|
|
1568
|
+
|
|
1569
|
+
|
|
1570
|
+
| \- | Set boolean |
|
|
1571
|
+
| footer |
|
|
1572
|
+
|
|
1573
|
+
Panel to place modal controls.
|
|
1574
|
+
|
|
1575
|
+
ReactNode
|
|
1576
|
+
|
|
1577
|
+
|
|
1578
|
+
|
|
1579
|
+
| \- |
|
|
1580
|
+
|
|
1581
|
+
""
|
|
1582
|
+
|
|
1583
|
+
|
|
|
1584
|
+
| heading |
|
|
1585
|
+
|
|
1586
|
+
Sets the heading for the modal. If passed an element, it will render the element with an id, to ensure its connection to the modal.
|
|
1587
|
+
|
|
1588
|
+
union
|
|
1589
|
+
|
|
1590
|
+
|
|
1591
|
+
|
|
1592
|
+
| \- | Set object |
|
|
1593
|
+
| id |
|
|
1594
|
+
|
|
1595
|
+
Unique ID for the modal. Use if you would like to open this modal from anywhere in your app using the `useModal` hook.
|
|
1596
|
+
|
|
1597
|
+
string
|
|
1598
|
+
|
|
1599
|
+
|
|
1600
|
+
|
|
1601
|
+
| \- | \- |
|
|
1602
|
+
| noCloseButton |
|
|
1603
|
+
|
|
1604
|
+
When set to `true`, no close button will be rendered. You must add your own closing mechanism to ensure accessibility.
|
|
1605
|
+
|
|
1606
|
+
boolean
|
|
1607
|
+
|
|
1608
|
+
|
|
1609
|
+
|
|
1610
|
+
| \- | Set boolean |
|
|
1611
|
+
| onEntered |
|
|
1612
|
+
|
|
1613
|
+
Emitted when the modal has opened.
|
|
1614
|
+
|
|
1615
|
+
() => void
|
|
1616
|
+
|
|
1617
|
+
| \- | \- |
|
|
1618
|
+
| onExited |
|
|
1619
|
+
|
|
1620
|
+
Emitted when the modal has closed.
|
|
1621
|
+
|
|
1622
|
+
() => void
|
|
1623
|
+
|
|
1624
|
+
| \- | \- |
|
|
1625
|
+
| onShowChange |
|
|
1626
|
+
|
|
1627
|
+
Emitted when the modal has opened or closed internally. Use for controlled modals.
|
|
1628
|
+
|
|
1629
|
+
(show: boolean) => void
|
|
1630
|
+
|
|
1631
|
+
| \- | \- |
|
|
1632
|
+
| onStatus |
|
|
1633
|
+
|
|
1634
|
+
Emitted when the modal has mounted, unmounted, opened or closed. Open and close occur before animation begins.
|
|
1635
|
+
|
|
1636
|
+
(status: 'unmounted' | 'initial' | 'open' | 'close') => void
|
|
1637
|
+
|
|
1638
|
+
| \- | \- |
|
|
1639
|
+
| padding |
|
|
1640
|
+
|
|
1641
|
+
Sets the padding of the wrapping panel component
|
|
1642
|
+
|
|
1643
|
+
union
|
|
1644
|
+
|
|
1645
|
+
|
|
1646
|
+
|
|
1647
|
+
|
|
|
1648
|
+
|
|
1649
|
+
'md'
|
|
1650
|
+
|
|
1651
|
+
| \- |
|
|
1652
|
+
| show |
|
|
1653
|
+
|
|
1654
|
+
When set to `true` the modal will be visible. Use for controlled modals.
|
|
1655
|
+
|
|
1656
|
+
boolean
|
|
1657
|
+
|
|
1658
|
+
|
|
1659
|
+
|
|
1660
|
+
| \- | \- |
|
|
1661
|
+
| size |
|
|
1662
|
+
|
|
1663
|
+
Accepts a `string` or `{ xs: sm }` (for responsive sizing) of `ModalSizes` options.
|
|
426
1664
|
|
|
427
|
-
|
|
1665
|
+
union
|
|
1666
|
+
|
|
1667
|
+
|
|
1668
|
+
|
|
1669
|
+
|
|
|
1670
|
+
|
|
1671
|
+
'md'
|
|
1672
|
+
|
|
1673
|
+
| Set object |
|
|
1674
|
+
| static |
|
|
1675
|
+
|
|
1676
|
+
When set to `true`, the modal will act like a static element when open. This means it will not lock scroll or focus within the modal. Note: This is used internally to display modals in Styler. It is not recommended to use this prop in your own applications.
|
|
1677
|
+
|
|
1678
|
+
boolean
|
|
1679
|
+
|
|
1680
|
+
|
|
1681
|
+
|
|
1682
|
+
| \- | Set boolean |
|
|
1683
|
+
|
|
1684
|
+
### Disable closing
|
|
428
1685
|
|
|
429
1686
|
For instances where you require the user's full attention and you want to ensure they continue the current task before closing the modal, you can disable the backdrop and escape key using `disableBackdropClick` and/or hide the close button using `noCloseButton`.
|
|
430
1687
|
|
|
431
1688
|
**Note:** As these options remove the default handling of the closing the modal, please ensure you provide a clear way for the user to close the modal.
|
|
432
1689
|
|
|
433
|
-
|
|
1690
|
+
[](./iframe.html?id=components-modal--disable-closing)
|
|
434
1691
|
|
|
435
|
-
|
|
1692
|
+
Disable backdrop clickNo close button (please provide one, if you decide to hide the close button)Both (If you hide the close button, ensure you provide another way to close the modal)
|
|
436
1693
|
|
|
437
|
-
|
|
1694
|
+
```
|
|
438
1695
|
|
|
439
1696
|
const Story \= () \=> {
|
|
440
1697
|
const { showModal } \= useModal();
|
|
441
1698
|
const MODAL\_ID \= 'storybook-modal';
|
|
1699
|
+
return (
|
|
1700
|
+
const Story \= () \=> {
|
|
1701
|
+
const { showModal } \= useModal();
|
|
1702
|
+
const MODAL\_ID \= 'storybook-modal';
|
|
442
1703
|
return (
|
|
443
1704
|
<IressStack gutter\="md"\>
|
|
444
1705
|
<IressButton
|
|
@@ -479,75 +1740,229 @@ return (
|
|
|
479
1740
|
);
|
|
480
1741
|
};
|
|
481
1742
|
|
|
1743
|
+
export const App \= () \=> (
|
|
1744
|
+
<IressModalProvider\>
|
|
1745
|
+
<Story />
|
|
1746
|
+
</IressModalProvider\>
|
|
1747
|
+
);
|
|
1748
|
+
);
|
|
1749
|
+
};
|
|
1750
|
+
|
|
482
1751
|
export const App \= () \=> (
|
|
483
1752
|
<IressModalProvider\>
|
|
484
1753
|
<Story />
|
|
485
1754
|
</IressModalProvider\>
|
|
486
1755
|
);
|
|
487
1756
|
|
|
488
|
-
|
|
1757
|
+
```
|
|
489
1758
|
|
|
490
|
-
|
|
491
|
-
-------------------------------------------------
|
|
1759
|
+
#### Props
|
|
492
1760
|
|
|
493
|
-
|
|
1761
|
+
| Name | Description | Default | Control |
|
|
1762
|
+
| --- | --- | --- | --- |
|
|
1763
|
+
| children |
|
|
1764
|
+
Text to be displayed inside the modal.
|
|
1765
|
+
|
|
1766
|
+
ReactNode
|
|
1767
|
+
|
|
1768
|
+
|
|
1769
|
+
|
|
1770
|
+
| \- |
|
|
1771
|
+
|
|
1772
|
+
"Modal content"
|
|
1773
|
+
|
|
1774
|
+
|
|
|
1775
|
+
| closeText |
|
|
1776
|
+
|
|
1777
|
+
Screenreader text for close button.
|
|
1778
|
+
|
|
1779
|
+
string
|
|
1780
|
+
|
|
1781
|
+
|
|
1782
|
+
|
|
1783
|
+
| \- | Set string |
|
|
1784
|
+
| container |
|
|
1785
|
+
|
|
1786
|
+
The container element to render the modal into. By default, the modal will render at the end of the document body.
|
|
1787
|
+
|
|
1788
|
+
FloatingUIContainer
|
|
1789
|
+
|
|
1790
|
+
|
|
1791
|
+
|
|
1792
|
+
| \- | Set object |
|
|
1793
|
+
| defaultShow |
|
|
1794
|
+
|
|
1795
|
+
When set to `true` the modal will be visible by default. Use for uncontrolled modals.
|
|
1796
|
+
|
|
1797
|
+
boolean
|
|
1798
|
+
|
|
1799
|
+
|
|
1800
|
+
|
|
1801
|
+
|
|
|
1802
|
+
|
|
1803
|
+
false
|
|
1804
|
+
|
|
1805
|
+
| Set boolean |
|
|
1806
|
+
| disableBackdropClick |
|
|
1807
|
+
|
|
1808
|
+
When set to `true`, users cannot exit the modal by clicking the backdrop or using the escape key.
|
|
1809
|
+
|
|
1810
|
+
boolean
|
|
1811
|
+
|
|
1812
|
+
|
|
1813
|
+
|
|
1814
|
+
| \- | \- |
|
|
1815
|
+
| fixedFooter |
|
|
1816
|
+
|
|
1817
|
+
When set to `true` the modal's footer will always be visible and fixed to the bottom of the modal.
|
|
1818
|
+
|
|
1819
|
+
boolean
|
|
1820
|
+
|
|
1821
|
+
|
|
1822
|
+
|
|
1823
|
+
| \- | Set boolean |
|
|
1824
|
+
| footer |
|
|
1825
|
+
|
|
1826
|
+
Panel to place modal controls.
|
|
1827
|
+
|
|
1828
|
+
ReactNode
|
|
494
1829
|
|
|
495
|
-
For your components to work as previously, you will need to set up the `IressModalProvider` at the root of your application. This will allow you to use the `useModal` hook to open and close modals from anywhere in your application using the ID of the modal.
|
|
496
1830
|
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
1831
|
+
|
|
1832
|
+
| \- |
|
|
1833
|
+
|
|
1834
|
+
"Footer slot"
|
|
1835
|
+
|
|
1836
|
+
|
|
|
1837
|
+
| heading |
|
|
1838
|
+
|
|
1839
|
+
Sets the heading for the modal. If passed an element, it will render the element with an id, to ensure its connection to the modal.
|
|
1840
|
+
|
|
1841
|
+
union
|
|
1842
|
+
|
|
1843
|
+
|
|
1844
|
+
|
|
1845
|
+
| \- | Set object |
|
|
1846
|
+
| id |
|
|
1847
|
+
|
|
1848
|
+
Unique ID for the modal. Use if you would like to open this modal from anywhere in your app using the `useModal` hook.
|
|
1849
|
+
|
|
1850
|
+
string
|
|
1851
|
+
|
|
1852
|
+
|
|
1853
|
+
|
|
1854
|
+
| \- | \- |
|
|
1855
|
+
| noCloseButton |
|
|
1856
|
+
|
|
1857
|
+
When set to `true`, no close button will be rendered. You must add your own closing mechanism to ensure accessibility.
|
|
1858
|
+
|
|
1859
|
+
boolean
|
|
1860
|
+
|
|
1861
|
+
|
|
1862
|
+
|
|
1863
|
+
| \- | \- |
|
|
1864
|
+
| onEntered |
|
|
1865
|
+
|
|
1866
|
+
Emitted when the modal has opened.
|
|
1867
|
+
|
|
1868
|
+
() => void
|
|
1869
|
+
|
|
1870
|
+
| \- | \- |
|
|
1871
|
+
| onExited |
|
|
1872
|
+
|
|
1873
|
+
Emitted when the modal has closed.
|
|
1874
|
+
|
|
1875
|
+
() => void
|
|
1876
|
+
|
|
1877
|
+
| \- | \- |
|
|
1878
|
+
| onShowChange |
|
|
1879
|
+
|
|
1880
|
+
Emitted when the modal has opened or closed internally. Use for controlled modals.
|
|
1881
|
+
|
|
1882
|
+
(show: boolean) => void
|
|
1883
|
+
|
|
1884
|
+
| \- | \- |
|
|
1885
|
+
| onStatus |
|
|
1886
|
+
|
|
1887
|
+
Emitted when the modal has mounted, unmounted, opened or closed. Open and close occur before animation begins.
|
|
1888
|
+
|
|
1889
|
+
(status: 'unmounted' | 'initial' | 'open' | 'close') => void
|
|
1890
|
+
|
|
1891
|
+
| \- | \- |
|
|
1892
|
+
| padding |
|
|
1893
|
+
|
|
1894
|
+
Sets the padding of the wrapping panel component
|
|
1895
|
+
|
|
1896
|
+
union
|
|
1897
|
+
|
|
1898
|
+
|
|
1899
|
+
|
|
1900
|
+
|
|
|
1901
|
+
|
|
1902
|
+
'md'
|
|
1903
|
+
|
|
1904
|
+
| Set object |
|
|
1905
|
+
| show |
|
|
1906
|
+
|
|
1907
|
+
When set to `true` the modal will be visible. Use for controlled modals.
|
|
1908
|
+
|
|
1909
|
+
boolean
|
|
1910
|
+
|
|
1911
|
+
|
|
1912
|
+
|
|
1913
|
+
| \- | \- |
|
|
1914
|
+
| size |
|
|
1915
|
+
|
|
1916
|
+
Accepts a `string` or `{ xs: sm }` (for responsive sizing) of `ModalSizes` options.
|
|
1917
|
+
|
|
1918
|
+
union
|
|
1919
|
+
|
|
1920
|
+
|
|
1921
|
+
|
|
1922
|
+
|
|
|
1923
|
+
|
|
1924
|
+
'md'
|
|
1925
|
+
|
|
1926
|
+
| Set object |
|
|
1927
|
+
| static |
|
|
1928
|
+
|
|
1929
|
+
When set to `true`, the modal will act like a static element when open. This means it will not lock scroll or focus within the modal. Note: This is used internally to display modals in Styler. It is not recommended to use this prop in your own applications.
|
|
1930
|
+
|
|
1931
|
+
boolean
|
|
1932
|
+
|
|
1933
|
+
|
|
1934
|
+
|
|
1935
|
+
| \- | Set boolean |
|
|
1936
|
+
|
|
1937
|
+
Migrating to version 5
|
|
1938
|
+
----------------------
|
|
1939
|
+
|
|
1940
|
+
### Adding the provider
|
|
1941
|
+
|
|
1942
|
+
For your components to work as previously, you will need to set up the `IressModalProvider` at the root of your application. This will allow you to use the `useModal` hook to open and close modals from anywhere in your application using the ID of the modal.
|
|
513
1943
|
|
|
514
1944
|
const App \= () \=> <IressModalProvider\>Rest of app here</IressModalProvider\>;
|
|
515
1945
|
|
|
516
|
-
|
|
1946
|
+
```
|
|
517
1947
|
|
|
518
|
-
###
|
|
1948
|
+
### Testing
|
|
519
1949
|
|
|
520
1950
|
In version 5, modals 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.
|
|
521
1951
|
|
|
522
1952
|
See below for an example in version 4 and version 5.
|
|
523
1953
|
|
|
524
|
-
|
|
1954
|
+
Diff
|
|
525
1955
|
|
|
526
|
-
|
|
1956
|
+
Old
|
|
1957
|
+
|
|
1958
|
+
New
|
|
527
1959
|
|
|
528
1960
|
<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 modal', 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 modal/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"> 'modal-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"> 'modal',</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 modal</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 modal = await screen.findByRole('dialog');</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('modal-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 modal = screen.getByTestId('modal');</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 modal 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 modal 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 modal</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(modal).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 modal</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('modal__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(modal).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(modal);</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>
|
|
529
1961
|
|
|
530
|
-
###
|
|
1962
|
+
### Speed up tests
|
|
531
1963
|
|
|
532
1964
|
You can speed up tests by wrapping your tests in a provider that overrides the theme tokens for animations.
|
|
533
1965
|
|
|
534
|
-
\[data-radix-scroll-area-viewport\] {
|
|
535
|
-
scrollbar-width: none;
|
|
536
|
-
-ms-overflow-style: none;
|
|
537
|
-
-webkit-overflow-scrolling: touch;
|
|
538
|
-
}
|
|
539
|
-
\[data-radix-scroll-area-viewport\]::-webkit-scrollbar {
|
|
540
|
-
display: none;
|
|
541
|
-
}
|
|
542
|
-
:where(\[data-radix-scroll-area-viewport\]) {
|
|
543
|
-
display: flex;
|
|
544
|
-
flex-direction: column;
|
|
545
|
-
align-items: stretch;
|
|
546
|
-
}
|
|
547
|
-
:where(\[data-radix-scroll-area-content\]) {
|
|
548
|
-
flex-grow: 1;
|
|
549
|
-
}
|
|
550
|
-
|
|
551
1966
|
const themeOverrides: Record<string, string\> \= {
|
|
552
1967
|
'--iress-backdrop-transition-duration': '0s',
|
|
553
1968
|
};
|
|
@@ -562,26 +1977,4 @@ export const TestAppProvider \= ({ children }: PropsWithChildren) \=> {
|
|
|
562
1977
|
);
|
|
563
1978
|
};
|
|
564
1979
|
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
On this page
|
|
568
|
-
|
|
569
|
-
* [Overview](#overview)
|
|
570
|
-
* [Use a modal when](#use-a-modal-when)
|
|
571
|
-
* [Avoid using a modal when](#avoid-using-a-modal-when)
|
|
572
|
-
* [Props](#props)
|
|
573
|
-
* [Controlling the modal](#controlling-the-modal)
|
|
574
|
-
* [Using the show property](#using-the-show-property)
|
|
575
|
-
* [Using the IressModalProvider](#using-the-iressmodalprovider)
|
|
576
|
-
* [Behaviour](#behaviour)
|
|
577
|
-
* [Examples](#examples)
|
|
578
|
-
* [Footer slot](#footer-slot)
|
|
579
|
-
* [Fixed footer](#fixed-footer)
|
|
580
|
-
* [Size](#size)
|
|
581
|
-
* [Responsive size](#responsive-size)
|
|
582
|
-
* [Padding](#padding)
|
|
583
|
-
* [Disable closing](#disable-closing)
|
|
584
|
-
* [Migrating to version 5](#migrating-to-version-5)
|
|
585
|
-
* [Adding the provider](#adding-the-provider)
|
|
586
|
-
* [Testing](#testing)
|
|
587
|
-
* [Speed up tests](#speed-up-tests)
|
|
1980
|
+
```
|