@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,8 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
Recipes
|
|
2
|
+
=======
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
With readonly data
|
|
5
|
+
------------------
|
|
6
6
|
|
|
7
7
|
You can use `IressForm` with readonly data by setting the `readonly` prop to `true` on controlled elements. This will disable those form controls, but will include the values in the form submission.
|
|
8
8
|
|
|
@@ -10,6 +10,8 @@ Please take note of the following when displaying read only data.
|
|
|
10
10
|
|
|
11
11
|
* It is best to keep readonly data in a separate section of the form, to further avoid confusion with editable fields.
|
|
12
12
|
|
|
13
|
+
[](./iframe.html?id=components-form-recipes--with-readonly-data)
|
|
14
|
+
|
|
13
15
|
User Details
|
|
14
16
|
------------
|
|
15
17
|
|
|
@@ -27,9 +29,7 @@ Email
|
|
|
27
29
|
|
|
28
30
|
Submit
|
|
29
31
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
\[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; }
|
|
32
|
+
```
|
|
33
33
|
|
|
34
34
|
export const WithReadonlyDataForm \= () \=> {
|
|
35
35
|
const \[values, setValues\] \= useState<FieldValues\>({
|
|
@@ -100,10 +100,28 @@ export const WithReadonlyDataForm \= () \=> {
|
|
|
100
100
|
);
|
|
101
101
|
};
|
|
102
102
|
|
|
103
|
-
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
#### Props
|
|
106
|
+
|
|
107
|
+
| Name | Description | Default | Control |
|
|
108
|
+
| --- | --- | --- | --- |
|
|
109
|
+
| form |
|
|
110
|
+
React hook form instance from `useForm`, use if you need more control over the internal state.
|
|
111
|
+
|
|
112
|
+
const form = useForm();
|
|
113
|
+
return <IressForm form={form} />;
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
UseFormReturn
|
|
117
|
+
|
|
118
|
+
|
|
104
119
|
|
|
105
|
-
|
|
106
|
-
|
|
120
|
+
| \- | Set object |
|
|
121
|
+
| Show React Hook Forms itemsReact Hook Forms | Show React Hook Forms items |
|
|
122
|
+
|
|
123
|
+
Switching between readonly and edit modes
|
|
124
|
+
-----------------------------------------
|
|
107
125
|
|
|
108
126
|
It is recommended to use a button to toggle between read-only and editable input modes.
|
|
109
127
|
|
|
@@ -112,6 +130,8 @@ Please take note of the following when switching between modes:
|
|
|
112
130
|
* Switching is done on a per-section basis, not on a per-field basis.
|
|
113
131
|
* When the user saves the data, it should switch back to read-only mode to avoid any confusion about whether the changes have been saved.
|
|
114
132
|
|
|
133
|
+
[](./iframe.html?id=components-form-recipes--switch-edit-readonly)
|
|
134
|
+
|
|
115
135
|
User Details
|
|
116
136
|
------------
|
|
117
137
|
|
|
@@ -133,9 +153,7 @@ dependents
|
|
|
133
153
|
|
|
134
154
|
Edit
|
|
135
155
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
\[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; }
|
|
156
|
+
```
|
|
139
157
|
|
|
140
158
|
export const SwitchEditReadonlyForm \= () \=> {
|
|
141
159
|
const dependentOptions \= \[
|
|
@@ -215,7 +233,7 @@ export const SwitchEditReadonlyForm \= () \=> {
|
|
|
215
233
|
{...controlledProps}
|
|
216
234
|
readonly\={!editable}
|
|
217
235
|
onChange\={(
|
|
218
|
-
|
|
236
|
+
\_e: React.ChangeEvent<HTMLSelectElement\>,
|
|
219
237
|
value?: FormControlValue,
|
|
220
238
|
) \=> controlledProps.onChange(value)}
|
|
221
239
|
\>
|
|
@@ -259,26 +277,44 @@ export const SwitchEditReadonlyForm \= () \=> {
|
|
|
259
277
|
);
|
|
260
278
|
};
|
|
261
279
|
|
|
262
|
-
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
#### Props
|
|
283
|
+
|
|
284
|
+
| Name | Description | Default | Control |
|
|
285
|
+
| --- | --- | --- | --- |
|
|
286
|
+
| form |
|
|
287
|
+
React hook form instance from `useForm`, use if you need more control over the internal state.
|
|
288
|
+
|
|
289
|
+
const form = useForm();
|
|
290
|
+
return <IressForm form={form} />;
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
UseFormReturn
|
|
294
|
+
|
|
263
295
|
|
|
264
|
-
[](#alternative-form-validation)Alternative form validation
|
|
265
|
-
-----------------------------------------------------------
|
|
266
296
|
|
|
267
|
-
|
|
297
|
+
| \- | Set object |
|
|
298
|
+
| Show React Hook Forms itemsReact Hook Forms | Show React Hook Forms items |
|
|
299
|
+
|
|
300
|
+
Alternative form validation
|
|
301
|
+
---------------------------
|
|
302
|
+
|
|
303
|
+
`IressForm` is always recommended for all validation, as it is the cleanest way (least code) to provide the best form user experience for your users. Please visit the [`IressForm` documentation](/docs/components-form--docs) for different validation examples.
|
|
268
304
|
|
|
269
305
|
However, if you have more complex requirements and you find `IressForm` too opinionated for your needs, you can always bring your own form validation using a native `form` element and the other IDS components such as `IressField`.
|
|
270
306
|
|
|
271
307
|
Here is an example showcasing a form using the native form constraints API to achieve validation using IDS components. There are other libraries such as: [Yup](https://github.com/jquense/yup), [Joi](https://github.com/hapijs/joi) or [Zod](https://zod.dev/)) which can improve scalability, with the downside being you will have to maintain all validation yourself.
|
|
272
308
|
|
|
309
|
+
[](./iframe.html?id=components-form-recipes--native-validation)
|
|
310
|
+
|
|
273
311
|
**\*Required Name**
|
|
274
312
|
|
|
275
313
|
**\*Required Email address**
|
|
276
314
|
|
|
277
315
|
Sign up
|
|
278
316
|
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
\[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; }
|
|
317
|
+
```
|
|
282
318
|
|
|
283
319
|
export const NativeValidationForm \= () \=> {
|
|
284
320
|
const \[formData, setFormData\] \= useState({
|
|
@@ -355,10 +391,28 @@ export const NativeValidationForm \= () \=> {
|
|
|
355
391
|
);
|
|
356
392
|
};
|
|
357
393
|
|
|
358
|
-
|
|
394
|
+
```
|
|
395
|
+
|
|
396
|
+
#### Props
|
|
397
|
+
|
|
398
|
+
| Name | Description | Default | Control |
|
|
399
|
+
| --- | --- | --- | --- |
|
|
400
|
+
| form |
|
|
401
|
+
React hook form instance from `useForm`, use if you need more control over the internal state.
|
|
402
|
+
|
|
403
|
+
const form = useForm();
|
|
404
|
+
return <IressForm form={form} />;
|
|
405
|
+
|
|
406
|
+
|
|
407
|
+
UseFormReturn
|
|
359
408
|
|
|
360
|
-
|
|
361
|
-
|
|
409
|
+
|
|
410
|
+
|
|
411
|
+
| \- | Set object |
|
|
412
|
+
| Show React Hook Forms itemsReact Hook Forms | Show React Hook Forms items |
|
|
413
|
+
|
|
414
|
+
Nested forms
|
|
415
|
+
------------
|
|
362
416
|
|
|
363
417
|
Unfortunately, it is [forbidden to nest form elements as per the HTML specifications](https://developer.mozilla.org/en-US/docs/Learn/Forms/How_to_structure_a_web_form).
|
|
364
418
|
|
|
@@ -370,6 +424,8 @@ To achieve a similar effect, you can use multiple `IressForm` components, and tr
|
|
|
370
424
|
|
|
371
425
|
The example here showcases triggering validation using the `form` attribute of `IressButton` and the `requestSubmit` method on the form element.
|
|
372
426
|
|
|
427
|
+
[](./iframe.html?id=components-form-recipes--nested-forms)
|
|
428
|
+
|
|
373
429
|
\*Required Name
|
|
374
430
|
|
|
375
431
|
Add new dependant
|
|
@@ -382,9 +438,7 @@ Save
|
|
|
382
438
|
|
|
383
439
|
Submit main formSubmit all forms
|
|
384
440
|
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
\[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; }
|
|
441
|
+
```
|
|
388
442
|
|
|
389
443
|
interface FormData {
|
|
390
444
|
name: string;
|
|
@@ -468,13 +522,33 @@ export const NestedFormsExample \= () \=> {
|
|
|
468
522
|
);
|
|
469
523
|
};
|
|
470
524
|
|
|
471
|
-
|
|
525
|
+
```
|
|
472
526
|
|
|
473
|
-
|
|
474
|
-
|
|
527
|
+
#### Props
|
|
528
|
+
|
|
529
|
+
| Name | Description | Default | Control |
|
|
530
|
+
| --- | --- | --- | --- |
|
|
531
|
+
| form |
|
|
532
|
+
React hook form instance from `useForm`, use if you need more control over the internal state.
|
|
533
|
+
|
|
534
|
+
const form = useForm();
|
|
535
|
+
return <IressForm form={form} />;
|
|
536
|
+
|
|
537
|
+
|
|
538
|
+
UseFormReturn
|
|
539
|
+
|
|
540
|
+
|
|
541
|
+
|
|
542
|
+
| \- | Set object |
|
|
543
|
+
| Show React Hook Forms itemsReact Hook Forms | Show React Hook Forms items |
|
|
544
|
+
|
|
545
|
+
Form Groups
|
|
546
|
+
-----------
|
|
475
547
|
|
|
476
548
|
Powered by [React Hook Form](https://react-hook-form.com/docs/usefieldarray)'s `useFieldArray`, this example allows you add/edit/delete multiple children sections within ONE form (not nested form).
|
|
477
549
|
|
|
550
|
+
[](./iframe.html?id=components-form-recipes--form-groups)
|
|
551
|
+
|
|
478
552
|
Form groups
|
|
479
553
|
===========
|
|
480
554
|
|
|
@@ -506,11 +580,7 @@ Add Dependant
|
|
|
506
580
|
|
|
507
581
|
Submit All
|
|
508
582
|
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
\[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; }
|
|
512
|
-
|
|
513
|
-
/\* eslint-disable @typescript-eslint/no-misused-promises \*/
|
|
583
|
+
```
|
|
514
584
|
|
|
515
585
|
interface Client {
|
|
516
586
|
name: string | undefined;
|
|
@@ -638,7 +708,7 @@ export const FormGroups \= () \=> {
|
|
|
638
708
|
defaultValues: defaultValues,
|
|
639
709
|
mode: 'onBlur',
|
|
640
710
|
});
|
|
641
|
-
const { control,
|
|
711
|
+
const { control, getValues } \= form;
|
|
642
712
|
const { fields, append, update, remove } \= useFieldArray({
|
|
643
713
|
name: 'dependants',
|
|
644
714
|
control,
|
|
@@ -649,7 +719,8 @@ export const FormGroups \= () \=> {
|
|
|
649
719
|
<IressText element\="h1"\>Form groups</IressText\>
|
|
650
720
|
<IressText element\="p"\>
|
|
651
721
|
This is one form with child sections (not nested forms). Play around to add/edit/delete child form sections: </IressText\>
|
|
652
|
-
<IressHookForm<FormValues>
|
|
722
|
+
<IressHookForm<FormValues> gutter="md" form={form}
|
|
723
|
+
onSubmit={onSubmit}
|
|
653
724
|
errorSummaryHeading="Please correct the following errors found for the form:" > <IressStack gutter\="md"\>
|
|
654
725
|
<ClientSection control\={control} />
|
|
655
726
|
{fields.map((field, index) \=> (
|
|
@@ -672,22 +743,35 @@ export const FormGroups \= () \=> {
|
|
|
672
743
|
Add Dependant </IressButton\>
|
|
673
744
|
</IressStack\>
|
|
674
745
|
<IressDivider />
|
|
675
|
-
<IressButton
|
|
676
|
-
type\="submit"
|
|
677
|
-
mode\="primary"
|
|
678
|
-
form\="mainForm"
|
|
679
|
-
onClick\={handleSubmit(onSubmit)}
|
|
680
|
-
\>
|
|
746
|
+
<IressButton type\="submit" mode\="primary"\>
|
|
681
747
|
Submit All </IressButton\>
|
|
682
748
|
</IressHookForm\>
|
|
683
749
|
</IressStack\>
|
|
684
750
|
);
|
|
685
751
|
};
|
|
686
752
|
|
|
687
|
-
|
|
753
|
+
```
|
|
754
|
+
|
|
755
|
+
#### Props
|
|
756
|
+
|
|
757
|
+
| Name | Description | Default | Control |
|
|
758
|
+
| --- | --- | --- | --- |
|
|
759
|
+
| form |
|
|
760
|
+
React hook form instance from `useForm`, use if you need more control over the internal state.
|
|
761
|
+
|
|
762
|
+
const form = useForm();
|
|
763
|
+
return <IressForm form={form} />;
|
|
764
|
+
|
|
765
|
+
|
|
766
|
+
UseFormReturn
|
|
767
|
+
|
|
768
|
+
|
|
769
|
+
|
|
770
|
+
| \- | Set object |
|
|
771
|
+
| Show React Hook Forms itemsReact Hook Forms | Show React Hook Forms items |
|
|
688
772
|
|
|
689
|
-
|
|
690
|
-
|
|
773
|
+
Hidden inputs
|
|
774
|
+
-------------
|
|
691
775
|
|
|
692
776
|
You can use hidden inputs to store data that you do not want to display to the user, but still need to include in the form submission. This is useful for storing metadata or other information that is not editable by the user.
|
|
693
777
|
|
|
@@ -696,13 +780,13 @@ Warning
|
|
|
696
780
|
|
|
697
781
|
This is not a recommended practice, as it can lead to security issues if sensitive data is stored in hidden inputs. It is better to use a variable to store your data, and include it in the form submission using the `onSubmit` handler.
|
|
698
782
|
|
|
783
|
+
[](./iframe.html?id=components-form-recipes--hidden-inputs)
|
|
784
|
+
|
|
699
785
|
Visible Input
|
|
700
786
|
|
|
701
787
|
Submit
|
|
702
788
|
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
\[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; }
|
|
789
|
+
```
|
|
706
790
|
|
|
707
791
|
export const HiddenInputsForm \= () \=> {
|
|
708
792
|
const form \= IressForm.useForm();
|
|
@@ -738,15 +822,35 @@ export const HiddenInputsForm \= () \=> {
|
|
|
738
822
|
);
|
|
739
823
|
};
|
|
740
824
|
|
|
741
|
-
|
|
825
|
+
```
|
|
826
|
+
|
|
827
|
+
#### Props
|
|
828
|
+
|
|
829
|
+
| Name | Description | Default | Control |
|
|
830
|
+
| --- | --- | --- | --- |
|
|
831
|
+
| form |
|
|
832
|
+
React hook form instance from `useForm`, use if you need more control over the internal state.
|
|
833
|
+
|
|
834
|
+
const form = useForm();
|
|
835
|
+
return <IressForm form={form} />;
|
|
836
|
+
|
|
742
837
|
|
|
743
|
-
|
|
744
|
-
|
|
838
|
+
UseFormReturn
|
|
839
|
+
|
|
840
|
+
|
|
841
|
+
|
|
842
|
+
| \- | Set object |
|
|
843
|
+
| Show React Hook Forms itemsReact Hook Forms | Show React Hook Forms items |
|
|
844
|
+
|
|
845
|
+
Validation depend on other fields
|
|
846
|
+
---------------------------------
|
|
745
847
|
|
|
746
848
|
This example shows how to validate one field based on another field's value.
|
|
747
849
|
|
|
748
850
|
The budget amount input validates against the selected budget range using the custom `validateBudgetInput` rules.
|
|
749
851
|
|
|
852
|
+
[](./iframe.html?id=components-form-recipes--validation-depend-on-other-fields)
|
|
853
|
+
|
|
750
854
|
Validation depend on other fields
|
|
751
855
|
=================================
|
|
752
856
|
|
|
@@ -764,9 +868,7 @@ Submit
|
|
|
764
868
|
|
|
765
869
|
* * *
|
|
766
870
|
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
\[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; }
|
|
871
|
+
```
|
|
770
872
|
|
|
771
873
|
interface FormData {
|
|
772
874
|
primaryField: string;
|
|
@@ -879,14 +981,22 @@ export const ValidationDependOnOtherFields \= () \=> {
|
|
|
879
981
|
);
|
|
880
982
|
};
|
|
881
983
|
|
|
882
|
-
|
|
984
|
+
```
|
|
985
|
+
|
|
986
|
+
#### Props
|
|
987
|
+
|
|
988
|
+
| Name | Description | Default | Control |
|
|
989
|
+
| --- | --- | --- | --- |
|
|
990
|
+
| form |
|
|
991
|
+
React hook form instance from `useForm`, use if you need more control over the internal state.
|
|
992
|
+
|
|
993
|
+
const form = useForm();
|
|
994
|
+
return <IressForm form={form} />;
|
|
995
|
+
|
|
996
|
+
|
|
997
|
+
UseFormReturn
|
|
998
|
+
|
|
883
999
|
|
|
884
|
-
On this page
|
|
885
1000
|
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
* [Alternative form validation](#alternative-form-validation)
|
|
889
|
-
* [Nested forms](#nested-forms)
|
|
890
|
-
* [Form Groups](#form-groups)
|
|
891
|
-
* [Hidden inputs](#hidden-inputs)
|
|
892
|
-
* [Validation depend on other fields](#validation-depend-on-other-fields)
|
|
1001
|
+
| \- | Set object |
|
|
1002
|
+
| Show React Hook Forms itemsReact Hook Forms | Show React Hook Forms items |
|
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
Hide
|
|
2
|
+
====
|
|
3
|
+
|
|
4
|
+
Overview
|
|
5
|
+
--------
|
|
6
|
+
|
|
7
|
+
`IressHide` makes it easier for designers and developers to create adaptive designs that work for all screen sizes.
|
|
8
|
+
|
|
9
|
+
[](./iframe.html?id=components-hide--default)
|
|
10
|
+
|
|
11
|
+
Content to hide
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
{
|
|
16
|
+
args: {
|
|
17
|
+
children: 'Content to hide',
|
|
18
|
+
hiddenOn: {
|
|
19
|
+
xs: true,
|
|
20
|
+
lg: false
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Props
|
|
28
|
+
-----
|
|
29
|
+
|
|
30
|
+
| Name | Description | Default | Control |
|
|
31
|
+
| --- | --- | --- | --- |
|
|
32
|
+
| children\* |
|
|
33
|
+
Content to hide.
|
|
34
|
+
|
|
35
|
+
ReactNode
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
| \- |
|
|
40
|
+
|
|
41
|
+
"Content to hide"
|
|
42
|
+
|
|
43
|
+
|
|
|
44
|
+
| hiddenOn\* |
|
|
45
|
+
|
|
46
|
+
Content will be hidden on any screen sizes that are set to true.
|
|
47
|
+
|
|
48
|
+
ResponsiveSizing
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
| \- |
|
|
53
|
+
|
|
54
|
+
RAW
|
|
55
|
+
|
|
56
|
+
hiddenOn :
|
|
57
|
+
|
|
58
|
+
{
|
|
59
|
+
|
|
60
|
+
* xs : true
|
|
61
|
+
* lg : false
|
|
62
|
+
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
|
72
|
+
| visuallyHidden |
|
|
73
|
+
|
|
74
|
+
If true, the content will not be visible, but will be available to screen readers
|
|
75
|
+
|
|
76
|
+
boolean
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
| \- | Set boolean |
|
|
81
|
+
|
|
82
|
+
Usage
|
|
83
|
+
-----
|
|
84
|
+
|
|
85
|
+
### `hiddenOn`
|
|
86
|
+
|
|
87
|
+
The `hiddenOn` prop accepts a `ResponsiveSizing<boolean>` object, which is an object that uses a breakpoint as a key, and a boolean as a value.
|
|
88
|
+
|
|
89
|
+
It determines which screen sizes the component's children will be hidden on. It's set up as an object containing the following IDS breakpoints:
|
|
90
|
+
|
|
91
|
+
Hide breakpoints
|
|
92
|
+
| Breakpoint | Screen Widths |
|
|
93
|
+
| --- | --- |
|
|
94
|
+
| `xs` | Above 0px (inclusive) |
|
|
95
|
+
| `sm` | Above 576px (inclusive) |
|
|
96
|
+
| `md` | Above 768px (inclusive) |
|
|
97
|
+
| `lg` | Above 1024px (inclusive) |
|
|
98
|
+
| `xl` | Above 1200px (inclusive) |
|
|
99
|
+
| `xxl` | Above 1500px (inclusive) |
|
|
100
|
+
|
|
101
|
+
Behaviour
|
|
102
|
+
---------
|
|
103
|
+
|
|
104
|
+
If the breakpoint in the `hiddenOn` prop is set to true, the content will be hidden for both sighted users and screen reader users. If the value is false, or the breakpoint is omitted, the content will be visible.
|
|
105
|
+
|
|
106
|
+
You don't need to include every breakpoint, just the ones where you want content to become hidden. If you want to hide content on medium screens and above, you can set `hiddenOn` like this:
|
|
107
|
+
|
|
108
|
+
<IressHide hiddenOn\={{ md: true }} />
|
|
109
|
+
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
If you want to hide content only on certain screen sizes, you'll need to specify which screen size the content should become visible again on. To set content to be hidden on medium screens, and visible on extra large screens and above, you can do the following:
|
|
113
|
+
|
|
114
|
+
<IressHide hiddenOn\={{ md: true, xl: false }} />
|
|
115
|
+
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
Examples
|
|
119
|
+
--------
|
|
120
|
+
|
|
121
|
+
### Hidden on
|
|
122
|
+
|
|
123
|
+
Here are a few variations of the `hiddenOn` prop in action.
|
|
124
|
+
|
|
125
|
+
[](./iframe.html?id=components-hide--hidden-on)
|
|
126
|
+
|
|
127
|
+
This text is totally hidden on xs screens and above.
|
|
128
|
+
|
|
129
|
+
This text is totally hidden on md screens and above.
|
|
130
|
+
|
|
131
|
+
This text is totally hidden on md screens and below.
|
|
132
|
+
|
|
133
|
+
This text is totally hidden on xs screens only.
|
|
134
|
+
|
|
135
|
+
This text is totally hidden on xl screens only.
|
|
136
|
+
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
{
|
|
140
|
+
...Default,
|
|
141
|
+
argTypes: {
|
|
142
|
+
...disableArgTypes(\['children', 'hiddenOn'\])
|
|
143
|
+
},
|
|
144
|
+
render: args \=> {
|
|
145
|
+
const description \= args.visuallyHidden ? 'visually ' : 'totally ';
|
|
146
|
+
return <IressStack\>
|
|
147
|
+
<IressHide {...args} hiddenOn\={{
|
|
148
|
+
xs: true
|
|
149
|
+
}}\>
|
|
150
|
+
<IressText\>
|
|
151
|
+
This text is {description} hidden on xs screens and above. </IressText\>
|
|
152
|
+
</IressHide\>
|
|
153
|
+
<IressHide {...args} hiddenOn\={{
|
|
154
|
+
md: true
|
|
155
|
+
}}\>
|
|
156
|
+
<IressText mode\="success"\>
|
|
157
|
+
This text is {description} hidden on md screens and above. </IressText\>
|
|
158
|
+
</IressHide\>
|
|
159
|
+
<IressHide {...args} hiddenOn\={{
|
|
160
|
+
xs: true,
|
|
161
|
+
lg: false
|
|
162
|
+
}}\>
|
|
163
|
+
<IressText mode\="danger"\>
|
|
164
|
+
This text is {description} hidden on md screens and below. </IressText\>
|
|
165
|
+
</IressHide\>
|
|
166
|
+
<IressHide {...args} hiddenOn\={{
|
|
167
|
+
xs: true,
|
|
168
|
+
sm: false
|
|
169
|
+
}}\>
|
|
170
|
+
<IressText mode\="info"\>
|
|
171
|
+
This text is {description} hidden on xs screens only. </IressText\>
|
|
172
|
+
</IressHide\>
|
|
173
|
+
<IressHide {...args} hiddenOn\={{
|
|
174
|
+
xl: true,
|
|
175
|
+
xxl: false
|
|
176
|
+
}}\>
|
|
177
|
+
<IressText mode\="muted"\>
|
|
178
|
+
This text is {description} hidden on xl screens only. </IressText\>
|
|
179
|
+
</IressHide\>
|
|
180
|
+
</IressStack\>;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
#### Props
|
|
187
|
+
|
|
188
|
+
| Name | Description | Default | Control |
|
|
189
|
+
| --- | --- | --- | --- |
|
|
190
|
+
| children\* |
|
|
191
|
+
Content to hide.
|
|
192
|
+
|
|
193
|
+
ReactNode
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
| \- | \- |
|
|
198
|
+
| hiddenOn\* |
|
|
199
|
+
|
|
200
|
+
Content will be hidden on any screen sizes that are set to true.
|
|
201
|
+
|
|
202
|
+
ResponsiveSizing
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
| \- | \- |
|
|
207
|
+
| visuallyHidden |
|
|
208
|
+
|
|
209
|
+
If true, the content will not be visible, but will be available to screen readers
|
|
210
|
+
|
|
211
|
+
boolean
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
| \- | Set boolean |
|
|
216
|
+
|
|
217
|
+
### Visually hidden
|
|
218
|
+
|
|
219
|
+
This `visuallyHidden` prop is used if you don't want content to be visible on screen, but you do want it to be available to screen reader users.
|
|
220
|
+
|
|
221
|
+
[](./iframe.html?id=components-hide--visually-hidden)
|
|
222
|
+
|
|
223
|
+
This text is visually hidden on xs screens and above.
|
|
224
|
+
|
|
225
|
+
This text is visually hidden on md screens and above.
|
|
226
|
+
|
|
227
|
+
This text is visually hidden on md screens and below.
|
|
228
|
+
|
|
229
|
+
This text is visually hidden on xs screens only.
|
|
230
|
+
|
|
231
|
+
This text is visually hidden on xl screens only.
|
|
232
|
+
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
{
|
|
236
|
+
...HiddenOn,
|
|
237
|
+
args: {
|
|
238
|
+
...HiddenOn.args,
|
|
239
|
+
visuallyHidden: true
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
#### Props
|
|
246
|
+
|
|
247
|
+
| Name | Description | Default | Control |
|
|
248
|
+
| --- | --- | --- | --- |
|
|
249
|
+
| children\* |
|
|
250
|
+
Content to hide.
|
|
251
|
+
|
|
252
|
+
ReactNode
|
|
253
|
+
|
|
254
|
+
|
|
255
|
+
|
|
256
|
+
| \- | \- |
|
|
257
|
+
| hiddenOn\* |
|
|
258
|
+
|
|
259
|
+
Content will be hidden on any screen sizes that are set to true.
|
|
260
|
+
|
|
261
|
+
ResponsiveSizing
|
|
262
|
+
|
|
263
|
+
|
|
264
|
+
|
|
265
|
+
| \- | \- |
|
|
266
|
+
| visuallyHidden |
|
|
267
|
+
|
|
268
|
+
If true, the content will not be visible, but will be available to screen readers
|
|
269
|
+
|
|
270
|
+
boolean
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
|
|
274
|
+
| \- | FalseTrue |
|
|
275
|
+
|
|
276
|
+
Utility classes
|
|
277
|
+
---------------
|
|
278
|
+
|
|
279
|
+
To make it easier for developers to hide content, we've exposed the classes we use for the hide component as part of our global styles.
|
|
280
|
+
|
|
281
|
+
This means you can use them without having to use the Hide component. Unlike the Hide component, the utility classes only apply to a single breakpoint:
|
|
282
|
+
|
|
283
|
+
Hide breakpoints
|
|
284
|
+
| Totally Hidden | Visually Hidden | Screen Widths |
|
|
285
|
+
| --- | --- | --- |
|
|
286
|
+
| `iress-hidden--xs` | `iress-sr-only--xs` | 0 - 575px |
|
|
287
|
+
| `iress-hidden--sm` | `iress-sr-only--sm` | 576px - 767px |
|
|
288
|
+
| `iress-hidden--md` | `iress-sr-only--md` | 768px - 1023px |
|
|
289
|
+
| `iress-hidden--lg` | `iress-sr-only--lg` | 1024px - 1199px |
|
|
290
|
+
| `iress-hidden--xl` | `iress-sr-only--xl` | 1200px - 1499px |
|
|
291
|
+
| `iress-hidden--xxl` | `iress-sr-only--xxl` | 1500px and above |
|
|
292
|
+
|
|
293
|
+
If you use `iress-hidden` or `iress-sr-only` without the breakpoint suffix, it will apply to all screen sizes.
|