@react-ui-org/react-ui 0.50.2 → 0.51.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib.development.js +30 -30
- package/dist/lib.js +1 -1
- package/package.json +1 -1
- package/src/lib/components/Alert/Alert.jsx +1 -3
- package/src/lib/components/Alert/Alert.scss +1 -9
- package/src/lib/components/Alert/README.mdx +0 -20
- package/src/lib/components/Alert/_settings.scss +1 -1
- package/src/lib/components/Alert/_theme.scss +0 -10
- package/src/lib/components/Badge/Badge.jsx +1 -3
- package/src/lib/components/Badge/Badge.scss +25 -44
- package/src/lib/components/Badge/README.mdx +6 -14
- package/src/lib/components/Button/Button.jsx +3 -1
- package/src/lib/components/Button/README.mdx +8 -3
- package/src/lib/components/Button/_priorities.scss +12 -0
- package/src/lib/components/Button/_settings.scss +1 -1
- package/src/lib/components/ButtonGroup/README.mdx +74 -58
- package/src/lib/components/Card/Card.jsx +1 -3
- package/src/lib/components/Card/Card.scss +0 -9
- package/src/lib/components/Card/README.mdx +0 -16
- package/src/lib/components/Card/_theme.scss +0 -10
- package/src/lib/components/FormLayout/README.mdx +17 -8
- package/src/lib/components/Grid/_helpers/generateResponsiveCustomProperties.js +1 -1
- package/src/lib/components/Modal/ModalCloseButton.scss +2 -2
- package/src/lib/components/Modal/README.mdx +106 -115
- package/src/lib/components/Modal/_settings.scss +1 -1
- package/src/lib/components/Popover/README.mdx +7 -4
- package/src/lib/components/ScrollView/README.mdx +2 -2
- package/src/lib/components/Table/_components/TableCell.scss +6 -5
- package/src/lib/components/Table/_components/TableHeaderCell/TableHeaderCell.jsx +8 -5
- package/src/lib/components/Table/_settings.scss +5 -6
- package/src/lib/components/Text/README.mdx +14 -8
- package/src/lib/components/TextLink/README.mdx +8 -6
- package/src/lib/components/TextLink/TextLink.scss +5 -0
- package/src/lib/components/TextLink/_theme.scss +2 -0
- package/src/lib/components/Toolbar/README.mdx +19 -11
- package/src/lib/components/_helpers/getRootColorClassName.js +4 -0
- package/src/lib/styles/elements/_code.scss +1 -3
- package/src/lib/styles/elements/_page.scss +1 -0
- package/src/lib/styles/elements/_rulers.scss +1 -3
- package/src/lib/styles/elements/_small.scss +1 -1
- package/src/lib/styles/settings/_form-fields.scss +1 -1
- package/src/lib/styles/settings/_utilities.scss +46 -14
- package/src/lib/styles/theme/_accessibility.scss +4 -4
- package/src/lib/styles/theme/_borders.scss +2 -2
- package/src/lib/styles/theme/_code.scss +2 -2
- package/src/lib/styles/theme/_links.scss +6 -4
- package/src/lib/styles/theme/_lists.scss +1 -1
- package/src/lib/styles/theme/_page.scss +2 -2
- package/src/lib/styles/theme/_spacing.scss +11 -11
- package/src/lib/styles/theme/_typography.scss +19 -18
- package/src/lib/styles/theme-constants/_colors.scss +23 -23
- package/src/lib/styles/tools/_spacing.scss +1 -1
- package/src/lib/theme.scss +635 -564
- package/src/lib/styles/theme/_colors.scss +0 -65
@@ -164,22 +164,6 @@ Card supports all
|
|
164
164
|
of your app.
|
165
165
|
|
166
166
|
<Playground>
|
167
|
-
<Card color="primary">
|
168
|
-
<CardBody>
|
169
|
-
Hello! I'm primary variant of card.
|
170
|
-
</CardBody>
|
171
|
-
<CardFooter>
|
172
|
-
<Button label="Read more" priority="outline" />
|
173
|
-
</CardFooter>
|
174
|
-
</Card>
|
175
|
-
<Card color="secondary">
|
176
|
-
<CardBody>
|
177
|
-
Hello! I'm secondary variant of card.
|
178
|
-
</CardBody>
|
179
|
-
<CardFooter>
|
180
|
-
<Button label="Read more" priority="outline" color="secondary" />
|
181
|
-
</CardFooter>
|
182
|
-
</Card>
|
183
167
|
<Card color="success">
|
184
168
|
<CardBody>
|
185
169
|
Hello! I'm success variant of card.
|
@@ -9,16 +9,6 @@ $disabled-background-color: var(--rui-Card--disabled__background-color);
|
|
9
9
|
$disabled-opacity: var(--rui-Card--disabled__opacity);
|
10
10
|
|
11
11
|
$colors: (
|
12
|
-
primary: (
|
13
|
-
color: var(--rui-Card--primary__color),
|
14
|
-
border-color: var(--rui-Card--primary__border-color),
|
15
|
-
background-color: var(--rui-Card--primary__background-color),
|
16
|
-
),
|
17
|
-
secondary: (
|
18
|
-
color: var(--rui-Card--secondary__color),
|
19
|
-
border-color: var(--rui-Card--secondary__border-color),
|
20
|
-
background-color: var(--rui-Card--secondary__background-color),
|
21
|
-
),
|
22
12
|
success: (
|
23
13
|
color: var(--rui-Card--success__color),
|
24
14
|
border-color: var(--rui-Card--success__border-color),
|
@@ -144,24 +144,31 @@ with CSS custom properties.
|
|
144
144
|
<span id="label-width-options-label">Label width:</span>
|
145
145
|
</ToolbarItem>
|
146
146
|
<ToolbarItem>
|
147
|
-
<ButtonGroup
|
147
|
+
<ButtonGroup
|
148
|
+
aria-labelledby="label-width-options-label"
|
149
|
+
priority="outline"
|
150
|
+
>
|
148
151
|
<Button
|
149
|
-
|
152
|
+
aria-pressed={labelWidth === 'default'}
|
153
|
+
color={labelWidth === 'default' ? 'selected' : 'secondary'}
|
150
154
|
label="default"
|
151
155
|
onClick={() => setLabelWidth('default')}
|
152
156
|
/>
|
153
157
|
<Button
|
154
|
-
|
158
|
+
aria-pressed={labelWidth === 'auto'}
|
159
|
+
color={labelWidth === 'auto' ? 'selected' : 'secondary'}
|
155
160
|
label="auto"
|
156
161
|
onClick={() => setLabelWidth('auto')}
|
157
162
|
/>
|
158
163
|
<Button
|
159
|
-
|
164
|
+
aria-pressed={labelWidth === 'limited'}
|
165
|
+
color={labelWidth === 'limited' ? 'selected' : 'secondary'}
|
160
166
|
label="limited"
|
161
167
|
onClick={() => setLabelWidth('limited')}
|
162
168
|
/>
|
163
169
|
<Button
|
164
|
-
|
170
|
+
aria-pressed={labelWidth === 'custom'}
|
171
|
+
color={labelWidth === 'custom' ? 'selected' : 'secondary'}
|
165
172
|
label="custom"
|
166
173
|
onClick={() => setLabelWidth('custom')}
|
167
174
|
/>
|
@@ -351,14 +358,16 @@ This is a demo of all components supported by FormLayout.
|
|
351
358
|
<div>
|
352
359
|
<Toolbar>
|
353
360
|
<ToolbarItem>
|
354
|
-
<ButtonGroup>
|
361
|
+
<ButtonGroup priority="outline">
|
355
362
|
<Button
|
356
|
-
|
363
|
+
aria-pressed={fieldLayout === 'vertical'}
|
364
|
+
color={fieldLayout === 'vertical' ? 'selected' : 'secondary'}
|
357
365
|
label="Vertical layout"
|
358
366
|
onClick={() => setFieldLayout('vertical')}
|
359
367
|
/>
|
360
368
|
<Button
|
361
|
-
|
369
|
+
aria-pressed={fieldLayout === 'horizontal'}
|
370
|
+
color={fieldLayout === 'horizontal' ? 'selected' : 'secondary'}
|
362
371
|
label="Horizontal layout"
|
363
372
|
onClick={() => setFieldLayout('horizontal')}
|
364
373
|
/>
|
@@ -8,11 +8,11 @@
|
|
8
8
|
@include reset.button();
|
9
9
|
@include accessibility.min-tap-target();
|
10
10
|
|
11
|
-
font-size: map.get(typography.$size-values,
|
11
|
+
font-size: map.get(typography.$font-size-values, 4);
|
12
12
|
line-height: 1;
|
13
13
|
color: inherit;
|
14
14
|
|
15
15
|
&:disabled {
|
16
|
-
cursor: var(--rui-
|
16
|
+
cursor: var(--rui-cursor-not-allowed);
|
17
17
|
}
|
18
18
|
}
|
@@ -14,6 +14,7 @@ import {
|
|
14
14
|
} from 'docz'
|
15
15
|
import {
|
16
16
|
Button,
|
17
|
+
CheckboxField,
|
17
18
|
FormLayout,
|
18
19
|
Modal,
|
19
20
|
ModalBody,
|
@@ -22,6 +23,7 @@ import {
|
|
22
23
|
ModalFooter,
|
23
24
|
ModalHeader,
|
24
25
|
ModalTitle,
|
26
|
+
Radio,
|
25
27
|
ScrollView,
|
26
28
|
TextField,
|
27
29
|
Toolbar,
|
@@ -55,11 +57,7 @@ And use it:
|
|
55
57
|
const modalCloseButtonRef = React.useRef();
|
56
58
|
return (
|
57
59
|
<>
|
58
|
-
<Button
|
59
|
-
label="Launch modal"
|
60
|
-
onClick={() => setModalOpen(true)}
|
61
|
-
priority="outline"
|
62
|
-
/>
|
60
|
+
<Button label="Launch modal" onClick={() => setModalOpen(true)} />
|
63
61
|
<div>
|
64
62
|
{modalOpen && (
|
65
63
|
<Modal
|
@@ -86,6 +84,7 @@ And use it:
|
|
86
84
|
ref={modalPrimaryButtonRef}
|
87
85
|
/>
|
88
86
|
<Button
|
87
|
+
color="secondary"
|
89
88
|
label="Close"
|
90
89
|
onClick={() => setModalOpen(false)}
|
91
90
|
priority="outline"
|
@@ -152,7 +151,6 @@ e.g. dialog modal, blocking modal, scrollable modal, etc.
|
|
152
151
|
setModalOpen(1);
|
153
152
|
setTimeout(() => setModalOpen(null), 2500);
|
154
153
|
}}
|
155
|
-
priority="outline"
|
156
154
|
/>
|
157
155
|
<Button
|
158
156
|
label="Launch blocking modal with title"
|
@@ -160,17 +158,14 @@ e.g. dialog modal, blocking modal, scrollable modal, etc.
|
|
160
158
|
setModalOpen(2);
|
161
159
|
setTimeout(() => setModalOpen(null), 3500);
|
162
160
|
}}
|
163
|
-
priority="outline"
|
164
161
|
/>
|
165
162
|
<Button
|
166
163
|
label="Launch modal as dialog"
|
167
164
|
onClick={() => setModalOpen(3)}
|
168
|
-
priority="outline"
|
169
165
|
/>
|
170
166
|
<Button
|
171
167
|
label="Launch modal as form"
|
172
168
|
onClick={() => setModalOpen(4)}
|
173
|
-
priority="outline"
|
174
169
|
/>
|
175
170
|
<div>
|
176
171
|
{modalOpen === 1 && (
|
@@ -227,6 +222,7 @@ e.g. dialog modal, blocking modal, scrollable modal, etc.
|
|
227
222
|
ref={modalPrimaryButtonRef}
|
228
223
|
/>
|
229
224
|
<Button
|
225
|
+
color="secondary"
|
230
226
|
label="Close"
|
231
227
|
onClick={() => setModalOpen(false)}
|
232
228
|
priority="outline"
|
@@ -259,6 +255,7 @@ e.g. dialog modal, blocking modal, scrollable modal, etc.
|
|
259
255
|
ref={modalPrimaryButtonRef}
|
260
256
|
/>
|
261
257
|
<Button
|
258
|
+
color="secondary"
|
262
259
|
label="Close"
|
263
260
|
onClick={() => setModalOpen(false)}
|
264
261
|
priority="outline"
|
@@ -305,7 +302,6 @@ There are two ways how to position elements within the ModalHeader:
|
|
305
302
|
setModalOpen(true);
|
306
303
|
setVariant(1);
|
307
304
|
}}
|
308
|
-
priority="outline"
|
309
305
|
/>
|
310
306
|
<Button
|
311
307
|
label="Launch without close button"
|
@@ -313,7 +309,6 @@ There are two ways how to position elements within the ModalHeader:
|
|
313
309
|
setModalOpen(true);
|
314
310
|
setVariant(2);
|
315
311
|
}}
|
316
|
-
priority="outline"
|
317
312
|
/>
|
318
313
|
<Button
|
319
314
|
label="Launch without close button and with centered title"
|
@@ -321,7 +316,6 @@ There are two ways how to position elements within the ModalHeader:
|
|
321
316
|
setModalOpen(true);
|
322
317
|
setVariant(3);
|
323
318
|
}}
|
324
|
-
priority="outline"
|
325
319
|
/>
|
326
320
|
<Button
|
327
321
|
label="Launch with custom layout"
|
@@ -329,7 +323,6 @@ There are two ways how to position elements within the ModalHeader:
|
|
329
323
|
setModalOpen(true);
|
330
324
|
setVariant(4);
|
331
325
|
}}
|
332
|
-
priority="outline"
|
333
326
|
/>
|
334
327
|
<div>
|
335
328
|
{modalOpen && (
|
@@ -384,6 +377,7 @@ There are two ways how to position elements within the ModalHeader:
|
|
384
377
|
ref={modalPrimaryButtonRef}
|
385
378
|
/>
|
386
379
|
<Button
|
380
|
+
color="secondary"
|
387
381
|
label="Close"
|
388
382
|
onClick={() => setModalOpen(false)}
|
389
383
|
priority="outline"
|
@@ -432,44 +426,8 @@ There are two ways to position buttons within the ModalFooter:
|
|
432
426
|
return (
|
433
427
|
<>
|
434
428
|
<Button
|
435
|
-
label="Launch with footer
|
436
|
-
onClick={() =>
|
437
|
-
setModalOpen(true);
|
438
|
-
setModalJustify('start');
|
439
|
-
}}
|
440
|
-
priority="outline"
|
441
|
-
/>
|
442
|
-
<Button
|
443
|
-
label="Launch with footer justified to center"
|
444
|
-
onClick={() => {
|
445
|
-
setModalOpen(true);
|
446
|
-
setModalJustify('center');
|
447
|
-
}}
|
448
|
-
priority="outline"
|
449
|
-
/>
|
450
|
-
<Button
|
451
|
-
label="Launch with footer justified to end"
|
452
|
-
onClick={() => {
|
453
|
-
setModalOpen(true);
|
454
|
-
setModalJustify('end');
|
455
|
-
}}
|
456
|
-
priority="outline"
|
457
|
-
/>
|
458
|
-
<Button
|
459
|
-
label="Launch with footer justified with space between"
|
460
|
-
onClick={() => {
|
461
|
-
setModalOpen(true);
|
462
|
-
setModalJustify('space-between');
|
463
|
-
}}
|
464
|
-
priority="outline"
|
465
|
-
/>
|
466
|
-
<Button
|
467
|
-
label="Launch with footer with custom layout"
|
468
|
-
onClick={() => {
|
469
|
-
setModalOpen(true);
|
470
|
-
setModalJustify('stretch');
|
471
|
-
}}
|
472
|
-
priority="outline"
|
429
|
+
label="Launch modal with footer variants"
|
430
|
+
onClick={() => setModalOpen(true)}
|
473
431
|
/>
|
474
432
|
<div>
|
475
433
|
{modalOpen && (
|
@@ -478,15 +436,38 @@ There are two ways to position buttons within the ModalFooter:
|
|
478
436
|
primaryButtonRef={modalPrimaryButtonRef}
|
479
437
|
>
|
480
438
|
<ModalHeader>
|
481
|
-
<ModalTitle>
|
439
|
+
<ModalTitle>Footer justification</ModalTitle>
|
482
440
|
<ModalCloseButton onClick={() => setModalOpen(false)} />
|
483
441
|
</ModalHeader>
|
484
442
|
<ModalBody>
|
485
443
|
<ModalContent>
|
486
|
-
<
|
487
|
-
|
488
|
-
|
489
|
-
|
444
|
+
<Radio
|
445
|
+
label="Footer justification"
|
446
|
+
onChange={(e) => setModalJustify(e.target.value)}
|
447
|
+
options={[
|
448
|
+
{
|
449
|
+
label: 'start',
|
450
|
+
value: 'start',
|
451
|
+
},
|
452
|
+
{
|
453
|
+
label: 'center',
|
454
|
+
value: 'center',
|
455
|
+
},
|
456
|
+
{
|
457
|
+
label: 'end',
|
458
|
+
value: 'end',
|
459
|
+
},
|
460
|
+
{
|
461
|
+
label: 'space-between',
|
462
|
+
value: 'space-between',
|
463
|
+
},
|
464
|
+
{
|
465
|
+
label: 'stretch (with a custom layout)',
|
466
|
+
value: 'stretch',
|
467
|
+
},
|
468
|
+
]}
|
469
|
+
value={modalJustify}
|
470
|
+
/>
|
490
471
|
</ModalContent>
|
491
472
|
</ModalBody>
|
492
473
|
<ModalFooter justify={modalJustify}>
|
@@ -514,6 +495,7 @@ There are two ways to position buttons within the ModalFooter:
|
|
514
495
|
</ToolbarGroup>
|
515
496
|
<ToolbarItem>
|
516
497
|
<Button
|
498
|
+
color="secondary"
|
517
499
|
label="Close"
|
518
500
|
onClick={() => setModalOpen(false)}
|
519
501
|
priority="outline"
|
@@ -524,12 +506,12 @@ There are two ways to position buttons within the ModalFooter:
|
|
524
506
|
) : (
|
525
507
|
<>
|
526
508
|
<Button
|
527
|
-
|
528
|
-
label="Delete"
|
509
|
+
label="OK"
|
529
510
|
onClick={() => setModalOpen(false)}
|
530
511
|
ref={modalPrimaryButtonRef}
|
531
512
|
/>
|
532
513
|
<Button
|
514
|
+
color="secondary"
|
533
515
|
label="Close"
|
534
516
|
onClick={() => setModalOpen(false)}
|
535
517
|
priority="outline"
|
@@ -566,7 +548,6 @@ Modals of any size automatically shrink when they cannot fit the screen width.
|
|
566
548
|
setModalSize('small');
|
567
549
|
setModalOpen(true);
|
568
550
|
}}
|
569
|
-
priority="outline"
|
570
551
|
/>
|
571
552
|
<Button
|
572
553
|
label="Launch medium modal"
|
@@ -574,7 +555,6 @@ Modals of any size automatically shrink when they cannot fit the screen width.
|
|
574
555
|
setModalSize('medium');
|
575
556
|
setModalOpen(true);
|
576
557
|
}}
|
577
|
-
priority="outline"
|
578
558
|
/>
|
579
559
|
<Button
|
580
560
|
label="Launch large modal"
|
@@ -582,7 +562,6 @@ Modals of any size automatically shrink when they cannot fit the screen width.
|
|
582
562
|
setModalSize('large');
|
583
563
|
setModalOpen(true);
|
584
564
|
}}
|
585
|
-
priority="outline"
|
586
565
|
/>
|
587
566
|
<Button
|
588
567
|
label="Launch fullscreen modal"
|
@@ -590,7 +569,6 @@ Modals of any size automatically shrink when they cannot fit the screen width.
|
|
590
569
|
setModalSize('fullscreen');
|
591
570
|
setModalOpen(true);
|
592
571
|
}}
|
593
|
-
priority="outline"
|
594
572
|
/>
|
595
573
|
<div>
|
596
574
|
{modalOpen && (
|
@@ -619,6 +597,7 @@ Modals of any size automatically shrink when they cannot fit the screen width.
|
|
619
597
|
ref={modalPrimaryButtonRef}
|
620
598
|
/>
|
621
599
|
<Button
|
600
|
+
color="secondary"
|
622
601
|
label="Close"
|
623
602
|
onClick={() => setModalOpen(false)}
|
624
603
|
priority="outline"
|
@@ -645,7 +624,6 @@ On top of that, the modal can adjust to the width of its content.
|
|
645
624
|
<Button
|
646
625
|
label="Launch auto-width modal"
|
647
626
|
onClick={() => setModalOpen(true)}
|
648
|
-
priority="outline"
|
649
627
|
/>
|
650
628
|
<div>
|
651
629
|
{modalOpen && (
|
@@ -674,6 +652,7 @@ On top of that, the modal can adjust to the width of its content.
|
|
674
652
|
ref={modalPrimaryButtonRef}
|
675
653
|
/>
|
676
654
|
<Button
|
655
|
+
color="secondary"
|
677
656
|
label="Close"
|
678
657
|
onClick={() => setModalOpen(false)}
|
679
658
|
priority="outline"
|
@@ -688,57 +667,61 @@ On top of that, the modal can adjust to the width of its content.
|
|
688
667
|
}}
|
689
668
|
</Playground>
|
690
669
|
|
691
|
-
|
692
|
-
other auto-layout mechanisms, e.g. the auto-width
|
693
|
-
[FormLayout](/components/form-layout#label-width). It's just too much
|
694
|
-
magic that doesn't work together (yet?) 🎩.
|
670
|
+
## Position
|
695
671
|
|
696
|
-
|
697
|
-
overflow handling comes to the rescue in this kind of scenario, you will be
|
698
|
-
better off with the combination of auto-sized modal and horizontal FormLayout
|
699
|
-
with a fixed label width (i.e. any other than `auto`, see the previous note).
|
672
|
+
Modal can be aligned either to the top or center of the screen.
|
700
673
|
|
701
674
|
<Playground>
|
702
675
|
{() => {
|
703
676
|
const [modalOpen, setModalOpen] = React.useState(false);
|
677
|
+
const [modalPosition, setModalPosition] = React.useState('center');
|
704
678
|
const modalPrimaryButtonRef = React.useRef();
|
705
679
|
const modalCloseButtonRef = React.useRef();
|
706
680
|
return (
|
707
681
|
<>
|
708
682
|
<Button
|
709
|
-
label="Launch
|
710
|
-
onClick={() =>
|
711
|
-
|
683
|
+
label="Launch modal at center"
|
684
|
+
onClick={() => {
|
685
|
+
setModalPosition('center');
|
686
|
+
setModalOpen(true);
|
687
|
+
}}
|
688
|
+
/>
|
689
|
+
<Button
|
690
|
+
label="Launch modal at top"
|
691
|
+
onClick={() => {
|
692
|
+
setModalPosition('top');
|
693
|
+
setModalOpen(true);
|
694
|
+
}}
|
712
695
|
/>
|
713
696
|
<div>
|
714
697
|
{modalOpen && (
|
715
698
|
<Modal
|
716
699
|
closeButtonRef={modalCloseButtonRef}
|
700
|
+
position={modalPosition}
|
717
701
|
primaryButtonRef={modalPrimaryButtonRef}
|
718
|
-
size="auto"
|
719
702
|
>
|
720
703
|
<ModalHeader>
|
721
|
-
<ModalTitle>
|
704
|
+
<ModalTitle>Delete the user?</ModalTitle>
|
722
705
|
<ModalCloseButton onClick={() => setModalOpen(false)} />
|
723
706
|
</ModalHeader>
|
724
707
|
<ModalBody>
|
725
708
|
<ModalContent>
|
726
|
-
<
|
727
|
-
|
728
|
-
|
729
|
-
|
730
|
-
</FormLayout>
|
709
|
+
<p>
|
710
|
+
Do you really want to delete the user <code>admin</code>?
|
711
|
+
This cannot be undone.
|
712
|
+
</p>
|
731
713
|
</ModalContent>
|
732
714
|
</ModalBody>
|
733
715
|
<ModalFooter>
|
734
716
|
<Button
|
735
|
-
color="
|
736
|
-
label="
|
717
|
+
color="danger"
|
718
|
+
label="Delete"
|
737
719
|
onClick={() => setModalOpen(false)}
|
738
720
|
ref={modalPrimaryButtonRef}
|
739
721
|
/>
|
740
722
|
<Button
|
741
|
-
|
723
|
+
color="secondary"
|
724
|
+
label="Close"
|
742
725
|
onClick={() => setModalOpen(false)}
|
743
726
|
priority="outline"
|
744
727
|
ref={modalCloseButtonRef}
|
@@ -752,62 +735,64 @@ with a fixed label width (i.e. any other than `auto`, see the previous note).
|
|
752
735
|
}}
|
753
736
|
</Playground>
|
754
737
|
|
755
|
-
##
|
738
|
+
## Forms in Modals
|
756
739
|
|
757
|
-
|
740
|
+
You can safely place a FormLayout into a Modal of any size, including the
|
741
|
+
auto-width Modal.
|
758
742
|
|
759
743
|
<Playground>
|
760
744
|
{() => {
|
761
745
|
const [modalOpen, setModalOpen] = React.useState(false);
|
762
|
-
const [
|
746
|
+
const [agree, setAgree] = React.useState(true);
|
763
747
|
const modalPrimaryButtonRef = React.useRef();
|
764
748
|
const modalCloseButtonRef = React.useRef();
|
765
749
|
return (
|
766
750
|
<>
|
767
751
|
<Button
|
768
|
-
label="Launch modal
|
769
|
-
onClick={() =>
|
770
|
-
setModalPosition('center');
|
771
|
-
setModalOpen(true);
|
772
|
-
}}
|
773
|
-
priority="outline"
|
774
|
-
/>
|
775
|
-
<Button
|
776
|
-
label="Launch modal at top"
|
777
|
-
onClick={() => {
|
778
|
-
setModalPosition('top');
|
779
|
-
setModalOpen(true);
|
780
|
-
}}
|
781
|
-
priority="outline"
|
752
|
+
label="Launch auto-width modal with auto-width form"
|
753
|
+
onClick={() => setModalOpen(true)}
|
782
754
|
/>
|
783
755
|
<div>
|
784
756
|
{modalOpen && (
|
785
757
|
<Modal
|
786
758
|
closeButtonRef={modalCloseButtonRef}
|
787
|
-
position={modalPosition}
|
788
759
|
primaryButtonRef={modalPrimaryButtonRef}
|
760
|
+
size="auto"
|
789
761
|
>
|
790
762
|
<ModalHeader>
|
791
|
-
<ModalTitle>
|
763
|
+
<ModalTitle>Auto-width form inside auto-width modal</ModalTitle>
|
792
764
|
<ModalCloseButton onClick={() => setModalOpen(false)} />
|
793
765
|
</ModalHeader>
|
794
766
|
<ModalBody>
|
795
767
|
<ModalContent>
|
796
|
-
<
|
797
|
-
|
798
|
-
|
799
|
-
|
768
|
+
<FormLayout autoWidth fieldLayout="horizontal">
|
769
|
+
<TextField
|
770
|
+
label="A form element"
|
771
|
+
validationState="warning"
|
772
|
+
validationText={`Account with this name already exists,
|
773
|
+
pick a different one.`
|
774
|
+
}
|
775
|
+
/>
|
776
|
+
<TextField label="Another form element" />
|
777
|
+
<TextField label="Yet another one" />
|
778
|
+
<CheckboxField
|
779
|
+
checked={agree}
|
780
|
+
label="I agree"
|
781
|
+
onChange={() => setAgree(!agree)}
|
782
|
+
/>
|
783
|
+
</FormLayout>
|
800
784
|
</ModalContent>
|
801
785
|
</ModalBody>
|
802
786
|
<ModalFooter>
|
803
787
|
<Button
|
804
|
-
color="
|
805
|
-
label="
|
788
|
+
color="primary"
|
789
|
+
label="Save"
|
806
790
|
onClick={() => setModalOpen(false)}
|
807
791
|
ref={modalPrimaryButtonRef}
|
808
792
|
/>
|
809
793
|
<Button
|
810
|
-
|
794
|
+
color="secondary"
|
795
|
+
label="Cancel"
|
811
796
|
onClick={() => setModalOpen(false)}
|
812
797
|
priority="outline"
|
813
798
|
ref={modalCloseButtonRef}
|
@@ -821,6 +806,14 @@ Modal can be aligned either to the top or center of the screen.
|
|
821
806
|
}}
|
822
807
|
</Playground>
|
823
808
|
|
809
|
+
👉 Inside Modal, we recommend using the `autoWidth` option of FormLayout. This
|
810
|
+
prevents the Modal from unwanted horizontal expansion when a long validation
|
811
|
+
text pops up during user's interaction with the form.
|
812
|
+
|
813
|
+
👉 Beware of horizontal FormLayout inside `small` modals. While automatic
|
814
|
+
overflow handling comes to the rescue in this kind of scenario, you will be
|
815
|
+
better off with the combination of auto-sized modal and horizontal FormLayout.
|
816
|
+
|
824
817
|
## Keyboard Control
|
825
818
|
|
826
819
|
Modal can be controlled either by mouse or keyboard. To enhance user
|
@@ -832,8 +825,8 @@ To enable it, you just need to pass a reference to the buttons using
|
|
832
825
|
a reference to the button is that if the button is disabled, the key press will
|
833
826
|
not fire the event.
|
834
827
|
|
835
|
-
👉 We strongly recommend using this feature together with
|
836
|
-
user experience.
|
828
|
+
👉 We strongly recommend using this feature together with
|
829
|
+
[Autofocus](#autofocus) for a better user experience.
|
837
830
|
|
838
831
|
## Autofocus
|
839
832
|
|
@@ -948,7 +941,6 @@ independent of the page itself. This can be done in three ways using the
|
|
948
941
|
setModalScrolling('auto');
|
949
942
|
setModalOpen(true);
|
950
943
|
}}
|
951
|
-
priority="outline"
|
952
944
|
/>
|
953
945
|
<Button
|
954
946
|
label="Launch modal with ScrollView"
|
@@ -956,7 +948,6 @@ independent of the page itself. This can be done in three ways using the
|
|
956
948
|
setModalScrolling('custom');
|
957
949
|
setModalOpen(true);
|
958
950
|
}}
|
959
|
-
priority="outline"
|
960
951
|
/>
|
961
952
|
<Button
|
962
953
|
label="Launch modal with non-scrolling body"
|
@@ -964,7 +955,6 @@ independent of the page itself. This can be done in three ways using the
|
|
964
955
|
setModalScrolling('none');
|
965
956
|
setModalOpen(true);
|
966
957
|
}}
|
967
|
-
priority="outline"
|
968
958
|
/>
|
969
959
|
<div>
|
970
960
|
{modalOpen && (
|
@@ -996,6 +986,7 @@ independent of the page itself. This can be done in three ways using the
|
|
996
986
|
ref={modalPrimaryButtonRef}
|
997
987
|
/>
|
998
988
|
<Button
|
989
|
+
color="secondary"
|
999
990
|
label="Close"
|
1000
991
|
onClick={() => setModalOpen(false)}
|
1001
992
|
priority="outline"
|
@@ -88,19 +88,22 @@ complete list of accepted values.
|
|
88
88
|
<span id="alignment-options-label">Alignment:</span>
|
89
89
|
</ToolbarItem>
|
90
90
|
<ToolbarItem>
|
91
|
-
<ButtonGroup aria-labelledby="alignment-options-label">
|
91
|
+
<ButtonGroup aria-labelledby="alignment-options-label" priority="outline">
|
92
92
|
<Button
|
93
|
-
|
93
|
+
aria-pressed={align === '-start'}
|
94
|
+
color={align === '-start' ? 'selected' : 'secondary'}
|
94
95
|
label="start"
|
95
96
|
onClick={() => setAlign('-start')}
|
96
97
|
/>
|
97
98
|
<Button
|
98
|
-
|
99
|
+
aria-pressed={align === ''}
|
100
|
+
color={align === '' ? 'selected' : 'secondary'}
|
99
101
|
label="center"
|
100
102
|
onClick={() => setAlign('')}
|
101
103
|
/>
|
102
104
|
<Button
|
103
|
-
|
105
|
+
aria-pressed={align === '-end'}
|
106
|
+
color={align === '-end' ? 'selected' : 'secondary'}
|
104
107
|
label="end"
|
105
108
|
onClick={() => setAlign('-end')}
|
106
109
|
/>
|
@@ -297,8 +297,8 @@ by smaller or bigger portions.
|
|
297
297
|
arrows
|
298
298
|
arrowsScrollStep={300}
|
299
299
|
direction="horizontal"
|
300
|
-
nextArrowElement={(<span class="
|
301
|
-
prevArrowElement={(<span class="
|
300
|
+
nextArrowElement={(<span class="font-size-3">➡️</span>)}
|
301
|
+
prevArrowElement={(<span class="font-size-3">⬅️</span>)}
|
302
302
|
scrollbar={false}
|
303
303
|
>
|
304
304
|
<Placeholder>
|