@iress-oss/ids-mcp-server 5.15.0 → 5.20.2
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 +496 -0
- package/generated/docs/components_components-autocomplete-docs.md +3429 -0
- package/generated/docs/{components-autocomplete-recipes-docs.md → components_components-autocomplete-recipes-docs.md} +39 -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 +2290 -0
- package/generated/docs/{components-card-recipes-docs.md → components_components-card-recipes-docs.md} +132 -15
- package/generated/docs/components_components-checkbox-docs.md +1040 -0
- package/generated/docs/{components-checkboxgroup-docs.md → components_components-checkboxgroup-docs.md} +1001 -82
- package/generated/docs/{components-checkboxgroup-recipes-docs.md → components_components-checkboxgroup-recipes-docs.md} +102 -12
- package/generated/docs/{components-col-docs.md → components_components-col-docs.md} +331 -58
- package/generated/docs/components_components-combobox-docs.md +3735 -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} +266 -33
- package/generated/docs/components_components-field-docs.md +1369 -0
- package/generated/docs/components_components-filter-docs.md +4080 -0
- package/generated/docs/{components-form-docs.md → components_components-form-docs.md} +1556 -360
- package/generated/docs/{components-form-recipes-docs.md → components_components-form-recipes-docs.md} +277 -60
- package/generated/docs/{components-hide-docs.md → components_components-hide-docs.md} +195 -124
- 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} +113 -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} +1640 -231
- package/generated/docs/components_components-navbar-docs.md +1847 -0
- package/generated/docs/{components-navbar-recipes-docs.md → components_components-navbar-recipes-docs.md} +721 -40
- 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 +1643 -0
- package/generated/docs/components_components-popover-recipes-docs.md +491 -0
- package/generated/docs/components_components-progress-docs.md +115 -0
- package/generated/docs/{components-provider-docs.md → components_components-provider-docs.md} +42 -33
- package/generated/docs/components_components-radio-docs.md +491 -0
- package/generated/docs/{components-radiogroup-docs.md → components_components-radiogroup-docs.md} +927 -75
- package/generated/docs/components_components-readonly-docs.md +263 -0
- package/generated/docs/components_components-richselect-docs.md +6521 -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} +51 -11
- package/generated/docs/{components-skiplink-docs.md → components_components-skiplink-docs.md} +53 -14
- package/generated/docs/components_components-slideout-docs.md +2293 -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 +3658 -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 +257 -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} +187 -85
- 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} +798 -153
- 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/components_sandbox-docs.md +4 -0
- 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-field-docs.md +0 -675
- package/generated/docs/components-filter-docs.md +0 -1109
- 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-popover-recipes-docs.md +0 -245
- 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 -1074
- 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 -209
- 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
|
+
Hide codedrawOpen in CodeSandbox
|
|
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
|
+
Hide codedrawOpen in CodeSandbox
|
|
66
257
|
|
|
67
|
-
import { IressButton, IressModal, IressModalProps } from '
|
|
258
|
+
import { IressButton, IressModal, type IressModalProps } from '@/main';
|
|
68
259
|
import { useState } from 'react';
|
|
69
260
|
export const ModalUsingState \= () \=> {
|
|
70
261
|
const \[show, setShow\] \= useState(false);
|
|
@@ -84,27 +275,201 @@ 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
|
+
Hide codedrawOpen in CodeSandbox
|
|
100
465
|
|
|
101
466
|
import {
|
|
102
467
|
IressButton,
|
|
103
468
|
IressModal,
|
|
104
|
-
IressModalProps,
|
|
469
|
+
type IressModalProps,
|
|
105
470
|
IressModalProvider,
|
|
106
471
|
useModal,
|
|
107
|
-
} from '
|
|
472
|
+
} from '@/main';
|
|
108
473
|
const MODAL\_ID \= 'storybook-modal';
|
|
109
474
|
export const App \= (modalProps: IressModalProps) \=> (
|
|
110
475
|
<IressModalProvider\>
|
|
@@ -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
|
+
Hide codedrawOpen in CodeSandbox
|
|
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
|
+
Hide codedrawOpen in CodeSandbox
|
|
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,19 +823,205 @@ 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.
|
|
910
|
+
|
|
911
|
+
union
|
|
912
|
+
|
|
250
913
|
|
|
251
|
-
Copy
|
|
252
914
|
|
|
253
|
-
|
|
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
|
+
Hide codedrawOpen in CodeSandbox
|
|
262
1016
|
|
|
1017
|
+
import {
|
|
1018
|
+
IressButton,
|
|
1019
|
+
IressInline,
|
|
1020
|
+
IressModal,
|
|
1021
|
+
IressModalProvider,
|
|
1022
|
+
MODAL\_SIZES,
|
|
1023
|
+
useModal,
|
|
1024
|
+
} from '@/main';
|
|
263
1025
|
const ModalWithTrigger \= () \=> {
|
|
264
1026
|
const { showModal } \= useModal();
|
|
265
1027
|
return (
|
|
@@ -280,127 +1042,464 @@ export const ModalSizes \= () \=> (
|
|
|
280
1042
|
</IressModalProvider\>
|
|
281
1043
|
);
|
|
282
1044
|
|
|
283
|
-
|
|
1045
|
+
```
|
|
1046
|
+
|
|
1047
|
+
#### Props
|
|
1048
|
+
|
|
1049
|
+
| Name | Description | Default | Control |
|
|
1050
|
+
| --- | --- | --- | --- |
|
|
1051
|
+
| children |
|
|
1052
|
+
Text to be displayed inside the modal.
|
|
1053
|
+
|
|
1054
|
+
ReactNode
|
|
1055
|
+
|
|
284
1056
|
|
|
285
|
-
|
|
1057
|
+
|
|
1058
|
+
| \- | \- |
|
|
1059
|
+
| closeText |
|
|
1060
|
+
|
|
1061
|
+
Screenreader text for close button.
|
|
1062
|
+
|
|
1063
|
+
string
|
|
1064
|
+
|
|
1065
|
+
|
|
1066
|
+
|
|
1067
|
+
| \- | Set string |
|
|
1068
|
+
| container |
|
|
1069
|
+
|
|
1070
|
+
The container element to render the modal into. By default, the modal will render at the end of the document body.
|
|
1071
|
+
|
|
1072
|
+
FloatingUIContainer
|
|
1073
|
+
|
|
1074
|
+
|
|
1075
|
+
|
|
1076
|
+
| \- | Set object |
|
|
1077
|
+
| defaultShow |
|
|
1078
|
+
|
|
1079
|
+
When set to `true` the modal will be visible by default. Use for uncontrolled modals.
|
|
1080
|
+
|
|
1081
|
+
boolean
|
|
1082
|
+
|
|
1083
|
+
|
|
1084
|
+
|
|
1085
|
+
|
|
|
1086
|
+
|
|
1087
|
+
false
|
|
1088
|
+
|
|
1089
|
+
| Set boolean |
|
|
1090
|
+
| disableBackdropClick |
|
|
1091
|
+
|
|
1092
|
+
When set to `true`, users cannot exit the modal by clicking the backdrop or using the escape key.
|
|
1093
|
+
|
|
1094
|
+
boolean
|
|
1095
|
+
|
|
1096
|
+
|
|
1097
|
+
|
|
1098
|
+
| \- | Set boolean |
|
|
1099
|
+
| fixedFooter |
|
|
1100
|
+
|
|
1101
|
+
When set to `true` the modal's footer will always be visible and fixed to the bottom of the modal.
|
|
1102
|
+
|
|
1103
|
+
boolean
|
|
1104
|
+
|
|
1105
|
+
|
|
1106
|
+
|
|
1107
|
+
| \- | Set boolean |
|
|
1108
|
+
| footer |
|
|
1109
|
+
|
|
1110
|
+
Panel to place modal controls.
|
|
1111
|
+
|
|
1112
|
+
ReactNode
|
|
1113
|
+
|
|
1114
|
+
|
|
1115
|
+
|
|
1116
|
+
| \- |
|
|
1117
|
+
|
|
1118
|
+
"Size modal footer"
|
|
1119
|
+
|
|
1120
|
+
|
|
|
1121
|
+
| heading |
|
|
1122
|
+
|
|
1123
|
+
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.
|
|
1124
|
+
|
|
1125
|
+
union
|
|
1126
|
+
|
|
1127
|
+
|
|
1128
|
+
|
|
1129
|
+
| \- | Set object |
|
|
1130
|
+
| id |
|
|
1131
|
+
|
|
1132
|
+
Unique ID for the modal. Use if you would like to open this modal from anywhere in your app using the `useModal` hook.
|
|
1133
|
+
|
|
1134
|
+
string
|
|
1135
|
+
|
|
1136
|
+
|
|
1137
|
+
|
|
1138
|
+
| \- | \- |
|
|
1139
|
+
| noCloseButton |
|
|
1140
|
+
|
|
1141
|
+
When set to `true`, no close button will be rendered. You must add your own closing mechanism to ensure accessibility.
|
|
1142
|
+
|
|
1143
|
+
boolean
|
|
1144
|
+
|
|
1145
|
+
|
|
1146
|
+
|
|
1147
|
+
| \- | Set boolean |
|
|
1148
|
+
| onEntered |
|
|
1149
|
+
|
|
1150
|
+
Emitted when the modal has opened.
|
|
1151
|
+
|
|
1152
|
+
() => void
|
|
1153
|
+
|
|
1154
|
+
| \- | \- |
|
|
1155
|
+
| onExited |
|
|
1156
|
+
|
|
1157
|
+
Emitted when the modal has closed.
|
|
1158
|
+
|
|
1159
|
+
() => void
|
|
1160
|
+
|
|
1161
|
+
| \- | \- |
|
|
1162
|
+
| onShowChange |
|
|
1163
|
+
|
|
1164
|
+
Emitted when the modal has opened or closed internally. Use for controlled modals.
|
|
1165
|
+
|
|
1166
|
+
(show: boolean) => void
|
|
1167
|
+
|
|
1168
|
+
| \- | \- |
|
|
1169
|
+
| onStatus |
|
|
1170
|
+
|
|
1171
|
+
Emitted when the modal has mounted, unmounted, opened or closed. Open and close occur before animation begins.
|
|
1172
|
+
|
|
1173
|
+
(status: 'unmounted' | 'initial' | 'open' | 'close') => void
|
|
1174
|
+
|
|
1175
|
+
| \- | \- |
|
|
1176
|
+
| padding |
|
|
1177
|
+
|
|
1178
|
+
Sets the padding of the wrapping panel component
|
|
1179
|
+
|
|
1180
|
+
union
|
|
1181
|
+
|
|
1182
|
+
|
|
1183
|
+
|
|
1184
|
+
|
|
|
1185
|
+
|
|
1186
|
+
'md'
|
|
1187
|
+
|
|
1188
|
+
| Set object |
|
|
1189
|
+
| show |
|
|
1190
|
+
|
|
1191
|
+
When set to `true` the modal will be visible. Use for controlled modals.
|
|
1192
|
+
|
|
1193
|
+
boolean
|
|
1194
|
+
|
|
1195
|
+
|
|
1196
|
+
|
|
1197
|
+
| \- | \- |
|
|
1198
|
+
| size |
|
|
1199
|
+
|
|
1200
|
+
Accepts a `string` or `{ xs: sm }` (for responsive sizing) of `ModalSizes` options.
|
|
1201
|
+
|
|
1202
|
+
union
|
|
1203
|
+
|
|
1204
|
+
|
|
1205
|
+
|
|
1206
|
+
|
|
|
1207
|
+
|
|
1208
|
+
'md'
|
|
1209
|
+
|
|
1210
|
+
| \- |
|
|
1211
|
+
| static |
|
|
1212
|
+
|
|
1213
|
+
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.
|
|
1214
|
+
|
|
1215
|
+
boolean
|
|
1216
|
+
|
|
1217
|
+
|
|
1218
|
+
|
|
1219
|
+
| \- | Set boolean |
|
|
1220
|
+
|
|
1221
|
+
### Responsive size
|
|
286
1222
|
|
|
287
1223
|
The `size` prop can take an object that takes five key/value pairs that correlate with the IDS breakpoints.
|
|
288
1224
|
|
|
289
1225
|
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:
|
|
290
1226
|
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
1227
|
+
<IressModal size\={{ md: IressModal.Size.Lg }}\>
|
|
1228
|
+
|
|
1229
|
+
```
|
|
1230
|
+
|
|
1231
|
+
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:
|
|
1232
|
+
|
|
1233
|
+
<IressModal size\={{ xs: IressModal.Size.Fullpage, md: IressModal.Size.Lg }}\>
|
|
1234
|
+
|
|
1235
|
+
```
|
|
1236
|
+
|
|
1237
|
+
You can override this behaviour by specifying a value for `xs` in your size object:
|
|
1238
|
+
|
|
1239
|
+
<IressModal size\={{ xs: IressModal.Size.Sm, md: IressModal.Size.Lg }}\>
|
|
1240
|
+
|
|
1241
|
+
```
|
|
1242
|
+
|
|
1243
|
+
[](./iframe.html?id=components-modal--responsive-size)
|
|
1244
|
+
|
|
1245
|
+
Responsive modal
|
|
1246
|
+
|
|
1247
|
+
Hide codedrawOpen in CodeSandbox
|
|
1248
|
+
|
|
1249
|
+
const Story \= () \=> {
|
|
1250
|
+
const { showModal } \= useModal();
|
|
1251
|
+
const MODAL\_ID \= 'storybook-modal';
|
|
1252
|
+
return (
|
|
1253
|
+
const Story \= () \=> {
|
|
1254
|
+
const { showModal } \= useModal();
|
|
1255
|
+
const MODAL\_ID \= 'storybook-modal';
|
|
1256
|
+
return (
|
|
1257
|
+
<\>
|
|
1258
|
+
<IressButton onClick\={() \=> showModal(MODAL\_ID)}\>
|
|
1259
|
+
Responsive modal </IressButton\>
|
|
1260
|
+
<IressModal
|
|
1261
|
+
footer\=""
|
|
1262
|
+
id\="storybook-modal"
|
|
1263
|
+
size\={{
|
|
1264
|
+
lg: 'md',
|
|
1265
|
+
md: 'sm',
|
|
1266
|
+
xl: 'lg'
|
|
1267
|
+
}}
|
|
1268
|
+
\>
|
|
1269
|
+
<Ln />
|
|
1270
|
+
</IressModal\>
|
|
1271
|
+
</\>
|
|
1272
|
+
);
|
|
1273
|
+
};
|
|
1274
|
+
|
|
1275
|
+
export const App \= () \=> (
|
|
1276
|
+
<IressModalProvider\>
|
|
1277
|
+
<Story />
|
|
1278
|
+
</IressModalProvider\>
|
|
1279
|
+
);
|
|
1280
|
+
);
|
|
1281
|
+
};
|
|
1282
|
+
|
|
1283
|
+
export const App \= () \=> (
|
|
1284
|
+
<IressModalProvider\>
|
|
1285
|
+
<Story />
|
|
1286
|
+
</IressModalProvider\>
|
|
1287
|
+
);
|
|
1288
|
+
|
|
1289
|
+
```
|
|
1290
|
+
|
|
1291
|
+
#### Props
|
|
1292
|
+
|
|
1293
|
+
| Name | Description | Default | Control |
|
|
1294
|
+
| --- | --- | --- | --- |
|
|
1295
|
+
| children |
|
|
1296
|
+
Text to be displayed inside the modal.
|
|
1297
|
+
|
|
1298
|
+
ReactNode
|
|
1299
|
+
|
|
1300
|
+
|
|
1301
|
+
|
|
1302
|
+
| \- | \- |
|
|
1303
|
+
| closeText |
|
|
1304
|
+
|
|
1305
|
+
Screenreader text for close button.
|
|
1306
|
+
|
|
1307
|
+
string
|
|
1308
|
+
|
|
1309
|
+
|
|
1310
|
+
|
|
1311
|
+
| \- | Set string |
|
|
1312
|
+
| container |
|
|
1313
|
+
|
|
1314
|
+
The container element to render the modal into. By default, the modal will render at the end of the document body.
|
|
1315
|
+
|
|
1316
|
+
FloatingUIContainer
|
|
1317
|
+
|
|
1318
|
+
|
|
1319
|
+
|
|
1320
|
+
| \- | Set object |
|
|
1321
|
+
| defaultShow |
|
|
1322
|
+
|
|
1323
|
+
When set to `true` the modal will be visible by default. Use for uncontrolled modals.
|
|
1324
|
+
|
|
1325
|
+
boolean
|
|
1326
|
+
|
|
1327
|
+
|
|
1328
|
+
|
|
1329
|
+
|
|
|
1330
|
+
|
|
1331
|
+
false
|
|
1332
|
+
|
|
1333
|
+
| Set boolean |
|
|
1334
|
+
| disableBackdropClick |
|
|
1335
|
+
|
|
1336
|
+
When set to `true`, users cannot exit the modal by clicking the backdrop or using the escape key.
|
|
1337
|
+
|
|
1338
|
+
boolean
|
|
1339
|
+
|
|
1340
|
+
|
|
1341
|
+
|
|
1342
|
+
| \- | Set boolean |
|
|
1343
|
+
| fixedFooter |
|
|
1344
|
+
|
|
1345
|
+
When set to `true` the modal's footer will always be visible and fixed to the bottom of the modal.
|
|
1346
|
+
|
|
1347
|
+
boolean
|
|
1348
|
+
|
|
1349
|
+
|
|
1350
|
+
|
|
1351
|
+
| \- | Set boolean |
|
|
1352
|
+
| footer |
|
|
1353
|
+
|
|
1354
|
+
Panel to place modal controls.
|
|
1355
|
+
|
|
1356
|
+
ReactNode
|
|
1357
|
+
|
|
1358
|
+
|
|
1359
|
+
|
|
1360
|
+
| \- |
|
|
1361
|
+
|
|
1362
|
+
""
|
|
1363
|
+
|
|
1364
|
+
|
|
|
1365
|
+
| heading |
|
|
1366
|
+
|
|
1367
|
+
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.
|
|
1368
|
+
|
|
1369
|
+
union
|
|
1370
|
+
|
|
1371
|
+
|
|
1372
|
+
|
|
1373
|
+
| \- | Set object |
|
|
1374
|
+
| id |
|
|
1375
|
+
|
|
1376
|
+
Unique ID for the modal. Use if you would like to open this modal from anywhere in your app using the `useModal` hook.
|
|
1377
|
+
|
|
1378
|
+
string
|
|
1379
|
+
|
|
1380
|
+
|
|
1381
|
+
|
|
1382
|
+
| \- | storybook-modal |
|
|
1383
|
+
| noCloseButton |
|
|
1384
|
+
|
|
1385
|
+
When set to `true`, no close button will be rendered. You must add your own closing mechanism to ensure accessibility.
|
|
1386
|
+
|
|
1387
|
+
boolean
|
|
1388
|
+
|
|
1389
|
+
|
|
1390
|
+
|
|
1391
|
+
| \- | Set boolean |
|
|
1392
|
+
| onEntered |
|
|
1393
|
+
|
|
1394
|
+
Emitted when the modal has opened.
|
|
1395
|
+
|
|
1396
|
+
() => void
|
|
1397
|
+
|
|
1398
|
+
| \- | \- |
|
|
1399
|
+
| onExited |
|
|
1400
|
+
|
|
1401
|
+
Emitted when the modal has closed.
|
|
1402
|
+
|
|
1403
|
+
() => void
|
|
1404
|
+
|
|
1405
|
+
| \- | \- |
|
|
1406
|
+
| onShowChange |
|
|
1407
|
+
|
|
1408
|
+
Emitted when the modal has opened or closed internally. Use for controlled modals.
|
|
1409
|
+
|
|
1410
|
+
(show: boolean) => void
|
|
1411
|
+
|
|
1412
|
+
| \- | \- |
|
|
1413
|
+
| onStatus |
|
|
1414
|
+
|
|
1415
|
+
Emitted when the modal has mounted, unmounted, opened or closed. Open and close occur before animation begins.
|
|
1416
|
+
|
|
1417
|
+
(status: 'unmounted' | 'initial' | 'open' | 'close') => void
|
|
1418
|
+
|
|
1419
|
+
| \- | \- |
|
|
1420
|
+
| padding |
|
|
1421
|
+
|
|
1422
|
+
Sets the padding of the wrapping panel component
|
|
1423
|
+
|
|
1424
|
+
union
|
|
1425
|
+
|
|
1426
|
+
|
|
1427
|
+
|
|
1428
|
+
|
|
|
1429
|
+
|
|
1430
|
+
'md'
|
|
1431
|
+
|
|
1432
|
+
| Set object |
|
|
1433
|
+
| show |
|
|
1434
|
+
|
|
1435
|
+
When set to `true` the modal will be visible. Use for controlled modals.
|
|
1436
|
+
|
|
1437
|
+
boolean
|
|
1438
|
+
|
|
1439
|
+
|
|
1440
|
+
|
|
1441
|
+
| \- | \- |
|
|
1442
|
+
| size |
|
|
1443
|
+
|
|
1444
|
+
Accepts a `string` or `{ xs: sm }` (for responsive sizing) of `ModalSizes` options.
|
|
1445
|
+
|
|
1446
|
+
union
|
|
1447
|
+
|
|
1448
|
+
|
|
1449
|
+
|
|
1450
|
+
|
|
|
1451
|
+
|
|
1452
|
+
'md'
|
|
1453
|
+
|
|
1454
|
+
|
|
|
307
1455
|
|
|
308
|
-
|
|
1456
|
+
Edit JSON
|
|
309
1457
|
|
|
310
|
-
|
|
1458
|
+
size :
|
|
311
1459
|
|
|
312
|
-
|
|
1460
|
+
{
|
|
1461
|
+
|
|
1462
|
+
* md : "sm"
|
|
1463
|
+
* lg : "md"
|
|
1464
|
+
* xl : "lg"
|
|
313
1465
|
|
|
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
1466
|
}
|
|
330
1467
|
|
|
331
|
-
<IressModal size\={{ xs: IressModal.Size.Fullpage, md: IressModal.Size.Lg }}\>
|
|
332
1468
|
|
|
333
|
-
Copy
|
|
334
1469
|
|
|
335
|
-
You can override this behaviour by specifying a value for `xs` in your size object:
|
|
336
1470
|
|
|
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
1471
|
|
|
354
|
-
<IressModal size\={{ xs: IressModal.Size.Sm, md: IressModal.Size.Lg }}\>
|
|
355
1472
|
|
|
356
|
-
Copy
|
|
357
1473
|
|
|
358
|
-
|
|
1474
|
+
|
|
|
1475
|
+
| static |
|
|
359
1476
|
|
|
360
|
-
|
|
1477
|
+
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.
|
|
361
1478
|
|
|
362
|
-
|
|
1479
|
+
boolean
|
|
363
1480
|
|
|
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
1481
|
|
|
392
|
-
Copy
|
|
393
1482
|
|
|
394
|
-
|
|
1483
|
+
| \- | Set boolean |
|
|
1484
|
+
|
|
1485
|
+
### Padding
|
|
395
1486
|
|
|
396
1487
|
The `padding` prop can be set to either `none`, `sm`, `md` or `lg`. It defaults to `md`.
|
|
397
1488
|
|
|
398
|
-
|
|
1489
|
+
[](./iframe.html?id=components-modal--padding)
|
|
399
1490
|
|
|
400
|
-
|
|
1491
|
+
none paddingsm paddingmd paddinglg padding
|
|
401
1492
|
|
|
402
|
-
|
|
1493
|
+
Hide codedrawOpen in CodeSandbox
|
|
403
1494
|
|
|
1495
|
+
import {
|
|
1496
|
+
IressButton,
|
|
1497
|
+
IressInline,
|
|
1498
|
+
IressModal,
|
|
1499
|
+
IressModalProvider,
|
|
1500
|
+
PADDING\_SIZES,
|
|
1501
|
+
useModal,
|
|
1502
|
+
} from '@/main';
|
|
404
1503
|
const ModalWithTrigger \= () \=> {
|
|
405
1504
|
const { showModal } \= useModal();
|
|
406
1505
|
return (
|
|
@@ -422,23 +1521,201 @@ export const ModalPaddings \= () \=> (
|
|
|
422
1521
|
</IressModalProvider\>
|
|
423
1522
|
);
|
|
424
1523
|
|
|
425
|
-
|
|
1524
|
+
```
|
|
1525
|
+
|
|
1526
|
+
#### Props
|
|
1527
|
+
|
|
1528
|
+
| Name | Description | Default | Control |
|
|
1529
|
+
| --- | --- | --- | --- |
|
|
1530
|
+
| children |
|
|
1531
|
+
Text to be displayed inside the modal.
|
|
1532
|
+
|
|
1533
|
+
ReactNode
|
|
1534
|
+
|
|
1535
|
+
|
|
1536
|
+
|
|
1537
|
+
| \- | \- |
|
|
1538
|
+
| closeText |
|
|
1539
|
+
|
|
1540
|
+
Screenreader text for close button.
|
|
1541
|
+
|
|
1542
|
+
string
|
|
1543
|
+
|
|
1544
|
+
|
|
1545
|
+
|
|
1546
|
+
| \- | Set string |
|
|
1547
|
+
| container |
|
|
1548
|
+
|
|
1549
|
+
The container element to render the modal into. By default, the modal will render at the end of the document body.
|
|
1550
|
+
|
|
1551
|
+
FloatingUIContainer
|
|
1552
|
+
|
|
1553
|
+
|
|
1554
|
+
|
|
1555
|
+
| \- | Set object |
|
|
1556
|
+
| defaultShow |
|
|
1557
|
+
|
|
1558
|
+
When set to `true` the modal will be visible by default. Use for uncontrolled modals.
|
|
1559
|
+
|
|
1560
|
+
boolean
|
|
1561
|
+
|
|
1562
|
+
|
|
1563
|
+
|
|
1564
|
+
|
|
|
1565
|
+
|
|
1566
|
+
false
|
|
1567
|
+
|
|
1568
|
+
| Set boolean |
|
|
1569
|
+
| disableBackdropClick |
|
|
1570
|
+
|
|
1571
|
+
When set to `true`, users cannot exit the modal by clicking the backdrop or using the escape key.
|
|
1572
|
+
|
|
1573
|
+
boolean
|
|
1574
|
+
|
|
1575
|
+
|
|
1576
|
+
|
|
1577
|
+
| \- | Set boolean |
|
|
1578
|
+
| fixedFooter |
|
|
1579
|
+
|
|
1580
|
+
When set to `true` the modal's footer will always be visible and fixed to the bottom of the modal.
|
|
1581
|
+
|
|
1582
|
+
boolean
|
|
1583
|
+
|
|
1584
|
+
|
|
1585
|
+
|
|
1586
|
+
| \- | Set boolean |
|
|
1587
|
+
| footer |
|
|
1588
|
+
|
|
1589
|
+
Panel to place modal controls.
|
|
1590
|
+
|
|
1591
|
+
ReactNode
|
|
1592
|
+
|
|
1593
|
+
|
|
1594
|
+
|
|
1595
|
+
| \- |
|
|
1596
|
+
|
|
1597
|
+
""
|
|
1598
|
+
|
|
1599
|
+
|
|
|
1600
|
+
| heading |
|
|
1601
|
+
|
|
1602
|
+
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.
|
|
1603
|
+
|
|
1604
|
+
union
|
|
1605
|
+
|
|
1606
|
+
|
|
1607
|
+
|
|
1608
|
+
| \- | Set object |
|
|
1609
|
+
| id |
|
|
1610
|
+
|
|
1611
|
+
Unique ID for the modal. Use if you would like to open this modal from anywhere in your app using the `useModal` hook.
|
|
1612
|
+
|
|
1613
|
+
string
|
|
1614
|
+
|
|
1615
|
+
|
|
1616
|
+
|
|
1617
|
+
| \- | \- |
|
|
1618
|
+
| noCloseButton |
|
|
1619
|
+
|
|
1620
|
+
When set to `true`, no close button will be rendered. You must add your own closing mechanism to ensure accessibility.
|
|
1621
|
+
|
|
1622
|
+
boolean
|
|
1623
|
+
|
|
1624
|
+
|
|
1625
|
+
|
|
1626
|
+
| \- | Set boolean |
|
|
1627
|
+
| onEntered |
|
|
1628
|
+
|
|
1629
|
+
Emitted when the modal has opened.
|
|
1630
|
+
|
|
1631
|
+
() => void
|
|
1632
|
+
|
|
1633
|
+
| \- | \- |
|
|
1634
|
+
| onExited |
|
|
1635
|
+
|
|
1636
|
+
Emitted when the modal has closed.
|
|
1637
|
+
|
|
1638
|
+
() => void
|
|
1639
|
+
|
|
1640
|
+
| \- | \- |
|
|
1641
|
+
| onShowChange |
|
|
1642
|
+
|
|
1643
|
+
Emitted when the modal has opened or closed internally. Use for controlled modals.
|
|
1644
|
+
|
|
1645
|
+
(show: boolean) => void
|
|
1646
|
+
|
|
1647
|
+
| \- | \- |
|
|
1648
|
+
| onStatus |
|
|
1649
|
+
|
|
1650
|
+
Emitted when the modal has mounted, unmounted, opened or closed. Open and close occur before animation begins.
|
|
1651
|
+
|
|
1652
|
+
(status: 'unmounted' | 'initial' | 'open' | 'close') => void
|
|
1653
|
+
|
|
1654
|
+
| \- | \- |
|
|
1655
|
+
| padding |
|
|
1656
|
+
|
|
1657
|
+
Sets the padding of the wrapping panel component
|
|
1658
|
+
|
|
1659
|
+
union
|
|
1660
|
+
|
|
1661
|
+
|
|
1662
|
+
|
|
1663
|
+
|
|
|
1664
|
+
|
|
1665
|
+
'md'
|
|
1666
|
+
|
|
1667
|
+
| \- |
|
|
1668
|
+
| show |
|
|
1669
|
+
|
|
1670
|
+
When set to `true` the modal will be visible. Use for controlled modals.
|
|
1671
|
+
|
|
1672
|
+
boolean
|
|
1673
|
+
|
|
1674
|
+
|
|
1675
|
+
|
|
1676
|
+
| \- | \- |
|
|
1677
|
+
| size |
|
|
1678
|
+
|
|
1679
|
+
Accepts a `string` or `{ xs: sm }` (for responsive sizing) of `ModalSizes` options.
|
|
426
1680
|
|
|
427
|
-
|
|
1681
|
+
union
|
|
1682
|
+
|
|
1683
|
+
|
|
1684
|
+
|
|
1685
|
+
|
|
|
1686
|
+
|
|
1687
|
+
'md'
|
|
1688
|
+
|
|
1689
|
+
| Set object |
|
|
1690
|
+
| static |
|
|
1691
|
+
|
|
1692
|
+
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.
|
|
1693
|
+
|
|
1694
|
+
boolean
|
|
1695
|
+
|
|
1696
|
+
|
|
1697
|
+
|
|
1698
|
+
| \- | Set boolean |
|
|
1699
|
+
|
|
1700
|
+
### Disable closing
|
|
428
1701
|
|
|
429
1702
|
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
1703
|
|
|
431
1704
|
**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
1705
|
|
|
433
|
-
|
|
1706
|
+
[](./iframe.html?id=components-modal--disable-closing)
|
|
434
1707
|
|
|
435
|
-
|
|
1708
|
+
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
1709
|
|
|
437
|
-
|
|
1710
|
+
Hide codedrawOpen in CodeSandbox
|
|
438
1711
|
|
|
439
1712
|
const Story \= () \=> {
|
|
440
1713
|
const { showModal } \= useModal();
|
|
441
1714
|
const MODAL\_ID \= 'storybook-modal';
|
|
1715
|
+
return (
|
|
1716
|
+
const Story \= () \=> {
|
|
1717
|
+
const { showModal } \= useModal();
|
|
1718
|
+
const MODAL\_ID \= 'storybook-modal';
|
|
442
1719
|
return (
|
|
443
1720
|
<IressStack gutter\="md"\>
|
|
444
1721
|
<IressButton
|
|
@@ -479,75 +1756,229 @@ return (
|
|
|
479
1756
|
);
|
|
480
1757
|
};
|
|
481
1758
|
|
|
1759
|
+
export const App \= () \=> (
|
|
1760
|
+
<IressModalProvider\>
|
|
1761
|
+
<Story />
|
|
1762
|
+
</IressModalProvider\>
|
|
1763
|
+
);
|
|
1764
|
+
);
|
|
1765
|
+
};
|
|
1766
|
+
|
|
482
1767
|
export const App \= () \=> (
|
|
483
1768
|
<IressModalProvider\>
|
|
484
1769
|
<Story />
|
|
485
1770
|
</IressModalProvider\>
|
|
486
1771
|
);
|
|
487
1772
|
|
|
488
|
-
|
|
1773
|
+
```
|
|
489
1774
|
|
|
490
|
-
|
|
491
|
-
-------------------------------------------------
|
|
1775
|
+
#### Props
|
|
492
1776
|
|
|
493
|
-
|
|
1777
|
+
| Name | Description | Default | Control |
|
|
1778
|
+
| --- | --- | --- | --- |
|
|
1779
|
+
| children |
|
|
1780
|
+
Text to be displayed inside the modal.
|
|
1781
|
+
|
|
1782
|
+
ReactNode
|
|
1783
|
+
|
|
1784
|
+
|
|
1785
|
+
|
|
1786
|
+
| \- |
|
|
1787
|
+
|
|
1788
|
+
"Modal content"
|
|
1789
|
+
|
|
1790
|
+
|
|
|
1791
|
+
| closeText |
|
|
1792
|
+
|
|
1793
|
+
Screenreader text for close button.
|
|
1794
|
+
|
|
1795
|
+
string
|
|
1796
|
+
|
|
1797
|
+
|
|
1798
|
+
|
|
1799
|
+
| \- | Set string |
|
|
1800
|
+
| container |
|
|
1801
|
+
|
|
1802
|
+
The container element to render the modal into. By default, the modal will render at the end of the document body.
|
|
1803
|
+
|
|
1804
|
+
FloatingUIContainer
|
|
1805
|
+
|
|
1806
|
+
|
|
1807
|
+
|
|
1808
|
+
| \- | Set object |
|
|
1809
|
+
| defaultShow |
|
|
1810
|
+
|
|
1811
|
+
When set to `true` the modal will be visible by default. Use for uncontrolled modals.
|
|
1812
|
+
|
|
1813
|
+
boolean
|
|
1814
|
+
|
|
1815
|
+
|
|
1816
|
+
|
|
1817
|
+
|
|
|
1818
|
+
|
|
1819
|
+
false
|
|
1820
|
+
|
|
1821
|
+
| Set boolean |
|
|
1822
|
+
| disableBackdropClick |
|
|
1823
|
+
|
|
1824
|
+
When set to `true`, users cannot exit the modal by clicking the backdrop or using the escape key.
|
|
1825
|
+
|
|
1826
|
+
boolean
|
|
1827
|
+
|
|
1828
|
+
|
|
1829
|
+
|
|
1830
|
+
| \- | \- |
|
|
1831
|
+
| fixedFooter |
|
|
1832
|
+
|
|
1833
|
+
When set to `true` the modal's footer will always be visible and fixed to the bottom of the modal.
|
|
1834
|
+
|
|
1835
|
+
boolean
|
|
1836
|
+
|
|
1837
|
+
|
|
1838
|
+
|
|
1839
|
+
| \- | Set boolean |
|
|
1840
|
+
| footer |
|
|
1841
|
+
|
|
1842
|
+
Panel to place modal controls.
|
|
1843
|
+
|
|
1844
|
+
ReactNode
|
|
494
1845
|
|
|
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
1846
|
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
1847
|
+
|
|
1848
|
+
| \- |
|
|
1849
|
+
|
|
1850
|
+
"Footer slot"
|
|
1851
|
+
|
|
1852
|
+
|
|
|
1853
|
+
| heading |
|
|
1854
|
+
|
|
1855
|
+
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.
|
|
1856
|
+
|
|
1857
|
+
union
|
|
1858
|
+
|
|
1859
|
+
|
|
1860
|
+
|
|
1861
|
+
| \- | Set object |
|
|
1862
|
+
| id |
|
|
1863
|
+
|
|
1864
|
+
Unique ID for the modal. Use if you would like to open this modal from anywhere in your app using the `useModal` hook.
|
|
1865
|
+
|
|
1866
|
+
string
|
|
1867
|
+
|
|
1868
|
+
|
|
1869
|
+
|
|
1870
|
+
| \- | \- |
|
|
1871
|
+
| noCloseButton |
|
|
1872
|
+
|
|
1873
|
+
When set to `true`, no close button will be rendered. You must add your own closing mechanism to ensure accessibility.
|
|
1874
|
+
|
|
1875
|
+
boolean
|
|
1876
|
+
|
|
1877
|
+
|
|
1878
|
+
|
|
1879
|
+
| \- | \- |
|
|
1880
|
+
| onEntered |
|
|
1881
|
+
|
|
1882
|
+
Emitted when the modal has opened.
|
|
1883
|
+
|
|
1884
|
+
() => void
|
|
1885
|
+
|
|
1886
|
+
| \- | \- |
|
|
1887
|
+
| onExited |
|
|
1888
|
+
|
|
1889
|
+
Emitted when the modal has closed.
|
|
1890
|
+
|
|
1891
|
+
() => void
|
|
1892
|
+
|
|
1893
|
+
| \- | \- |
|
|
1894
|
+
| onShowChange |
|
|
1895
|
+
|
|
1896
|
+
Emitted when the modal has opened or closed internally. Use for controlled modals.
|
|
1897
|
+
|
|
1898
|
+
(show: boolean) => void
|
|
1899
|
+
|
|
1900
|
+
| \- | \- |
|
|
1901
|
+
| onStatus |
|
|
1902
|
+
|
|
1903
|
+
Emitted when the modal has mounted, unmounted, opened or closed. Open and close occur before animation begins.
|
|
1904
|
+
|
|
1905
|
+
(status: 'unmounted' | 'initial' | 'open' | 'close') => void
|
|
1906
|
+
|
|
1907
|
+
| \- | \- |
|
|
1908
|
+
| padding |
|
|
1909
|
+
|
|
1910
|
+
Sets the padding of the wrapping panel component
|
|
1911
|
+
|
|
1912
|
+
union
|
|
1913
|
+
|
|
1914
|
+
|
|
1915
|
+
|
|
1916
|
+
|
|
|
1917
|
+
|
|
1918
|
+
'md'
|
|
1919
|
+
|
|
1920
|
+
| Set object |
|
|
1921
|
+
| show |
|
|
1922
|
+
|
|
1923
|
+
When set to `true` the modal will be visible. Use for controlled modals.
|
|
1924
|
+
|
|
1925
|
+
boolean
|
|
1926
|
+
|
|
1927
|
+
|
|
1928
|
+
|
|
1929
|
+
| \- | \- |
|
|
1930
|
+
| size |
|
|
1931
|
+
|
|
1932
|
+
Accepts a `string` or `{ xs: sm }` (for responsive sizing) of `ModalSizes` options.
|
|
1933
|
+
|
|
1934
|
+
union
|
|
1935
|
+
|
|
1936
|
+
|
|
1937
|
+
|
|
1938
|
+
|
|
|
1939
|
+
|
|
1940
|
+
'md'
|
|
1941
|
+
|
|
1942
|
+
| Set object |
|
|
1943
|
+
| static |
|
|
1944
|
+
|
|
1945
|
+
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.
|
|
1946
|
+
|
|
1947
|
+
boolean
|
|
1948
|
+
|
|
1949
|
+
|
|
1950
|
+
|
|
1951
|
+
| \- | Set boolean |
|
|
1952
|
+
|
|
1953
|
+
Migrating to version 5
|
|
1954
|
+
----------------------
|
|
1955
|
+
|
|
1956
|
+
### Adding the provider
|
|
1957
|
+
|
|
1958
|
+
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
1959
|
|
|
514
1960
|
const App \= () \=> <IressModalProvider\>Rest of app here</IressModalProvider\>;
|
|
515
1961
|
|
|
516
|
-
|
|
1962
|
+
```
|
|
517
1963
|
|
|
518
|
-
###
|
|
1964
|
+
### Testing
|
|
519
1965
|
|
|
520
1966
|
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
1967
|
|
|
522
1968
|
See below for an example in version 4 and version 5.
|
|
523
1969
|
|
|
524
|
-
|
|
1970
|
+
Diff
|
|
525
1971
|
|
|
526
|
-
|
|
1972
|
+
Old
|
|
1973
|
+
|
|
1974
|
+
New
|
|
527
1975
|
|
|
528
1976
|
<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
1977
|
|
|
530
|
-
###
|
|
1978
|
+
### Speed up tests
|
|
531
1979
|
|
|
532
1980
|
You can speed up tests by wrapping your tests in a provider that overrides the theme tokens for animations.
|
|
533
1981
|
|
|
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
1982
|
const themeOverrides: Record<string, string\> \= {
|
|
552
1983
|
'--iress-backdrop-transition-duration': '0s',
|
|
553
1984
|
};
|
|
@@ -562,26 +1993,4 @@ export const TestAppProvider \= ({ children }: PropsWithChildren) \=> {
|
|
|
562
1993
|
);
|
|
563
1994
|
};
|
|
564
1995
|
|
|
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)
|
|
1996
|
+
```
|