@splunk/react-ui 4.24.0 → 4.26.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/Breadcrumbs.js +65 -42
- package/Button.js +8 -7
- package/ButtonSimple.js +40 -39
- package/CHANGELOG.md +30 -1
- package/Code.js +193 -100
- package/Color.js +18 -15
- package/JSONTree.js +1 -1
- package/MIGRATION.mdx +48 -0
- package/Modal.js +69 -58
- package/RadioList.js +12 -11
- package/Table.js +2330 -2543
- package/TextArea.js +298 -302
- package/cypress/README.md +11 -0
- package/cypress/support/commands.ts +1 -0
- package/cypress/support/component.ts +0 -1
- package/cypress/tsconfig.cypress.json +14 -0
- package/package.json +13 -13
- package/types/src/Breadcrumbs/Breadcrumbs.d.ts +18 -2
- package/types/src/Breadcrumbs/Item.d.ts +7 -1
- package/types/src/Breadcrumbs/docs/examples/CustomizedClick.d.ts +2 -0
- package/types/src/Button/Button.d.ts +4 -2
- package/types/src/Button/docs/examples/Block.d.ts +2 -2
- package/types/src/Button/docs/examples/Dimmed.d.ts +2 -0
- package/types/src/Button/docs/examples/Disabled.d.ts +2 -2
- package/types/src/Button/docs/examples/Icons.d.ts +2 -2
- package/types/src/Button/docs/examples/Menus.d.ts +2 -2
- package/types/src/Button/docs/examples/To.d.ts +2 -2
- package/types/src/Button/docs/examples/Truncated.d.ts +2 -2
- package/types/src/Button/docs/examples/prisma/Basic.d.ts +2 -2
- package/types/src/Button/docs/examples/prisma/Block.d.ts +2 -2
- package/types/src/Button/docs/examples/prisma/Dimmed.d.ts +2 -0
- package/types/src/Button/docs/examples/prisma/Disabled.d.ts +2 -2
- package/types/src/Button/docs/examples/prisma/Menus.d.ts +2 -2
- package/types/src/Button/docs/examples/prisma/To.d.ts +2 -2
- package/types/src/Button/docs/examples/prisma/Truncated.d.ts +2 -2
- package/types/src/ButtonSimple/ButtonSimple.d.ts +4 -2
- package/types/src/Color/Color.d.ts +5 -3
- package/types/src/JSONTree/JSONTree.d.ts +1 -1
- package/types/src/Modal/Header.d.ts +6 -7
- package/types/src/Modal/Modal.d.ts +10 -2
- package/types/src/Modal/ModalContext.d.ts +1 -0
- package/types/src/RadioList/RadioList.d.ts +27 -27
- package/types/src/RadioList/RadioListContext.d.ts +5 -4
- package/types/src/Table/Body.d.ts +26 -22
- package/types/src/Table/Row.d.ts +47 -16
- package/types/src/Table/RowDragCell.d.ts +23 -42
- package/types/src/Table/Table.d.ts +28 -78
- package/types/src/TextArea/TextArea.d.ts +1 -0
- package/types/unit-test-setup-testing-library.d.ts +1 -0
- package/types/src/Modal/docs/examples/prisma/TypicalUsage.d.ts +0 -2
package/Color.js
CHANGED
|
@@ -668,6 +668,8 @@
|
|
|
668
668
|
palette: o().array,
|
|
669
669
|
prepend: o().bool,
|
|
670
670
|
/** @private */
|
|
671
|
+
required: o().bool,
|
|
672
|
+
/** @private */
|
|
671
673
|
splunkTheme: o().object,
|
|
672
674
|
value: o().string
|
|
673
675
|
};
|
|
@@ -957,17 +959,17 @@
|
|
|
957
959
|
key: "renderInput",
|
|
958
960
|
value: function e(t) {
|
|
959
961
|
var a = t.textAppend, o = t.textPrepend, l = t.textInline, i = t.inDropdown;
|
|
960
|
-
var s = this.props.splunkTheme;
|
|
961
|
-
var
|
|
962
|
-
var
|
|
963
|
-
var
|
|
964
|
-
var
|
|
965
|
-
var
|
|
966
|
-
if (!y()(
|
|
967
|
-
|
|
962
|
+
var s = this.props, u = s.splunkTheme, c = s.required;
|
|
963
|
+
var p = this.state.displayValue;
|
|
964
|
+
var d = u.isPrisma;
|
|
965
|
+
var f = r.hasTransparent(this.props.palette) && g()(p) === "transparent";
|
|
966
|
+
var v = g()(p) === Fe;
|
|
967
|
+
var h = p;
|
|
968
|
+
if (!y()(p, "#")) {
|
|
969
|
+
h = "#".concat(p);
|
|
968
970
|
}
|
|
969
|
-
|
|
970
|
-
|
|
971
|
+
h = f ? "transparent" : h;
|
|
972
|
+
h = v ? null : h;
|
|
971
973
|
|
|
972
974
|
return n().createElement(Y, {
|
|
973
975
|
$inDropdown: i
|
|
@@ -977,17 +979,18 @@
|
|
|
977
979
|
autoCapitalize: "off",
|
|
978
980
|
autoComplete: "off",
|
|
979
981
|
autoCorrect: "off",
|
|
980
|
-
spellCheck: false,
|
|
981
982
|
"aria-label": (0, _._)("Hexadecimal color value"),
|
|
982
|
-
prepend: o,
|
|
983
983
|
inline: l,
|
|
984
|
+
prepend: o,
|
|
984
985
|
onKeyDown: this.handleTextKeyDown,
|
|
985
986
|
onChange: this.handleTextChange,
|
|
986
|
-
|
|
987
|
-
|
|
987
|
+
required: c,
|
|
988
|
+
spellCheck: false,
|
|
989
|
+
value: p
|
|
990
|
+
}), !d && n().createElement(J, {
|
|
988
991
|
"data-test": "textbox-swatch",
|
|
989
992
|
onClick: this.handleButtonClick,
|
|
990
|
-
value:
|
|
993
|
+
value: h,
|
|
991
994
|
tabIndex: -1,
|
|
992
995
|
style: {
|
|
993
996
|
marginLeft: "1px"
|
package/JSONTree.js
CHANGED
|
@@ -419,7 +419,7 @@
|
|
|
419
419
|
var t = this;
|
|
420
420
|
var o = r.withTooltip;
|
|
421
421
|
var a = this.state.open ? "[-]" : "[+]";
|
|
422
|
-
var i = this.state.open ? (0, K._)("
|
|
422
|
+
var i = this.state.open ? (0, K._)("Collapse all") : (0, K._)("Shift click to expand all");
|
|
423
423
|
var l = n().createElement(D, {
|
|
424
424
|
onClick: function e(r) {
|
|
425
425
|
t.handleExpandClick(r);
|
package/MIGRATION.mdx
CHANGED
|
@@ -5,6 +5,54 @@ import Table from '@splunk/react-ui/Table';
|
|
|
5
5
|
|
|
6
6
|
This document lists migration guidance for new features and breaking changes.
|
|
7
7
|
|
|
8
|
+
## 4.26.0
|
|
9
|
+
|
|
10
|
+
### New `returnFocus` prop for `Modal`
|
|
11
|
+
|
|
12
|
+
#### Change
|
|
13
|
+
A new prop, `returnFocus`, has been added to `Modal`. `returnFocus` is optional for backwards compatibility but will be required in the next major version.
|
|
14
|
+
|
|
15
|
+
#### Context
|
|
16
|
+
Failing to return focus back to the invoking element (or another logical place) is a WCAG violation. Currently,
|
|
17
|
+
developers must remember to manually return focus. The `returnFocus` prop will be required in the next major version
|
|
18
|
+
and ensure focus is returned back to the invoking element.
|
|
19
|
+
|
|
20
|
+
#### Migration steps
|
|
21
|
+
Previously it was required to add code to manually return focus in `onRequestClose` for the `Modal` and `Modal.Header`.
|
|
22
|
+
This code can now be removed and replaced by passing the invoking element's ref to the new `returnFocus` prop on `Modal`.
|
|
23
|
+
|
|
24
|
+
For example, this code snippet:
|
|
25
|
+
```jsx
|
|
26
|
+
const handleRequestClose = () => {
|
|
27
|
+
setOpen(false);
|
|
28
|
+
modalToggle?.current?.focus();
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<>
|
|
33
|
+
<Button onClick={handleRequestOpen} ref={modalToggle} label="Open modal" />
|
|
34
|
+
<Modal onRequestClose={handleRequestClose} open={open}>
|
|
35
|
+
<Modal.Body>Just a basic Modal.</Modal.Body>
|
|
36
|
+
</Modal>
|
|
37
|
+
</>
|
|
38
|
+
);
|
|
39
|
+
```
|
|
40
|
+
can be converted to this code:
|
|
41
|
+
```jsx
|
|
42
|
+
const handleRequestClose = () => {
|
|
43
|
+
setOpen(false);
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
return (
|
|
47
|
+
<>
|
|
48
|
+
<Button onClick={handleRequestOpen} ref={modalToggle} label="Open modal" />
|
|
49
|
+
<Modal returnFocus={modalToggle} onRequestClose={handleRequestClose} open={open}>
|
|
50
|
+
<Modal.Body>Just a basic Modal.</Modal.Body>
|
|
51
|
+
</Modal>
|
|
52
|
+
</>
|
|
53
|
+
);
|
|
54
|
+
```
|
|
55
|
+
|
|
8
56
|
## 4.23.0
|
|
9
57
|
|
|
10
58
|
### Deprecated `JSONTree`'s `expandChildren="withShiftModifier"` value
|
package/Modal.js
CHANGED
|
@@ -86,9 +86,9 @@
|
|
|
86
86
|
var d = e.n(f);
|
|
87
87
|
// CONCATENATED MODULE: external "@splunk/react-ui/ModalLayer"
|
|
88
88
|
const y = require("@splunk/react-ui/ModalLayer");
|
|
89
|
-
var
|
|
89
|
+
var b = e.n(y);
|
|
90
90
|
// CONCATENATED MODULE: external "@splunk/ui-utils/focus"
|
|
91
|
-
const
|
|
91
|
+
const m = require("@splunk/ui-utils/focus");
|
|
92
92
|
// CONCATENATED MODULE: external "@splunk/ui-utils/id"
|
|
93
93
|
const v = require("@splunk/ui-utils/id");
|
|
94
94
|
// CONCATENATED MODULE: external "@splunk/react-ui/ScrollContainerContext"
|
|
@@ -102,7 +102,7 @@
|
|
|
102
102
|
// CONCATENATED MODULE: external "@splunk/themes"
|
|
103
103
|
const w = require("@splunk/themes");
|
|
104
104
|
// CONCATENATED MODULE: ./src/Modal/BodyStyles.ts
|
|
105
|
-
var
|
|
105
|
+
var j = x()(S()).withConfig({
|
|
106
106
|
displayName: "BodyStyles__StyledBox",
|
|
107
107
|
componentId: "lv54z7-0"
|
|
108
108
|
})([ "background-color:", ";", " flex:0 1 auto;overflow:auto;@media all and (-ms-high-contrast:none){*::-ms-backdrop,&{max-height:calc(100vh - 180px);}}" ], (0,
|
|
@@ -120,8 +120,8 @@
|
|
|
120
120
|
}
|
|
121
121
|
}));
|
|
122
122
|
// CONCATENATED MODULE: ./src/Modal/Body.tsx
|
|
123
|
-
function
|
|
124
|
-
|
|
123
|
+
function k() {
|
|
124
|
+
k = Object.assign || function(e) {
|
|
125
125
|
for (var t = 1; t < arguments.length; t++) {
|
|
126
126
|
var r = arguments[t];
|
|
127
127
|
for (var n in r) {
|
|
@@ -132,12 +132,12 @@
|
|
|
132
132
|
}
|
|
133
133
|
return e;
|
|
134
134
|
};
|
|
135
|
-
return
|
|
135
|
+
return k.apply(this, arguments);
|
|
136
136
|
}
|
|
137
|
-
function
|
|
138
|
-
return M(e) || E(e, t) || P(e, t) ||
|
|
137
|
+
function I(e, t) {
|
|
138
|
+
return M(e) || E(e, t) || P(e, t) || C();
|
|
139
139
|
}
|
|
140
|
-
function
|
|
140
|
+
function C() {
|
|
141
141
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
142
142
|
}
|
|
143
143
|
function P(e, t) {
|
|
@@ -216,12 +216,12 @@
|
|
|
216
216
|
*/ function D(e) {
|
|
217
217
|
var t = e.children, o = T(e, [ "children" ]);
|
|
218
218
|
// @docs-props-type BodyPropsBase
|
|
219
|
-
var i = (0, r.useState)(), a =
|
|
219
|
+
var i = (0, r.useState)(), a = I(i, 2), l = a[0], c = a[1];
|
|
220
220
|
var s = (0, r.useCallback)((function(e) {
|
|
221
221
|
c(e);
|
|
222
222
|
}), []);
|
|
223
223
|
|
|
224
|
-
return n().createElement(
|
|
224
|
+
return n().createElement(j, k({
|
|
225
225
|
"data-test": "body"
|
|
226
226
|
}, o, {
|
|
227
227
|
elementRef: s
|
|
@@ -320,7 +320,7 @@
|
|
|
320
320
|
var J = x()(S()).withConfig({
|
|
321
321
|
displayName: "HeaderStyles__StyledBox",
|
|
322
322
|
componentId: "sc-1y722ut-0"
|
|
323
|
-
})([ "", ";flex:0 0 auto;position:relative;min-height:", ";background-color:", ";padding:", ";align-items:
|
|
323
|
+
})([ "", ";flex:0 0 auto;position:relative;min-height:", ";background-color:", ";padding:", ";align-items:flex-start;padding-right:", ";" ], w.mixins.reset("flex"), (0,
|
|
324
324
|
w.pick)({
|
|
325
325
|
enterprise: "30px",
|
|
326
326
|
prisma: {
|
|
@@ -349,14 +349,12 @@
|
|
|
349
349
|
var Q = x().div.withConfig({
|
|
350
350
|
displayName: "HeaderStyles__StyledTitleWrapper",
|
|
351
351
|
componentId: "sc-1y722ut-1"
|
|
352
|
-
})([ "", ";flex-direction:column;" ], w.mixins.reset("flex"));
|
|
352
|
+
})([ "", ";flex-direction:column;align-self:center;" ], w.mixins.reset("flex"));
|
|
353
353
|
var Y = x().div.withConfig({
|
|
354
354
|
displayName: "HeaderStyles__StyledIcon",
|
|
355
355
|
componentId: "sc-1y722ut-2"
|
|
356
|
-
})([ "", ";align-items:center;justify-content:center;margin-right:", ";", "
|
|
356
|
+
})([ "", ";align-items:center;justify-content:center;margin-right:", ";background-color:", ";width:", ";height:", ";flex-shrink:0;" ], w.mixins.reset("inline-flex"), w.variables.spacingLarge, w.variables.transparent, (0,
|
|
357
357
|
w.pick)({
|
|
358
|
-
prisma: (0, g.css)([ "background-color:", ";" ], w.variables.transparent)
|
|
359
|
-
}), (0, w.pick)({
|
|
360
358
|
comfortable: "40px",
|
|
361
359
|
compact: "32px"
|
|
362
360
|
}), (0, w.pick)({
|
|
@@ -366,19 +364,15 @@
|
|
|
366
364
|
var Z = x().div.withConfig({
|
|
367
365
|
displayName: "HeaderStyles__StyledTitle",
|
|
368
366
|
componentId: "sc-1y722ut-3"
|
|
369
|
-
})([ "", ";font-size:20px;margin:0;overflow-wrap:break-word;font-weight:", ";", "" ], w.mixins.reset("block"), w.variables.fontWeightSemiBold, (0,
|
|
367
|
+
})([ "", ";font-size:20px;margin:0;overflow-wrap:break-word;font-weight:", ";color:", ";", "" ], w.mixins.reset("block"), w.variables.fontWeightSemiBold, w.variables.contentColorActive, (0,
|
|
370
368
|
w.pick)({
|
|
371
369
|
enterprise: (0, g.css)([ "line-height:22px;" ]),
|
|
372
|
-
prisma: (0, g.css)([ "
|
|
370
|
+
prisma: (0, g.css)([ "line-height:24px;" ])
|
|
373
371
|
}));
|
|
374
372
|
var ee = x().div.withConfig({
|
|
375
373
|
displayName: "HeaderStyles__StyledSubtitle",
|
|
376
374
|
componentId: "sc-1y722ut-4"
|
|
377
|
-
})([ "", ";font-size:14px;overflow-wrap:break-word;line-height:", ";" ], w.mixins.reset("block"),
|
|
378
|
-
w.pick)({
|
|
379
|
-
enterprise: w.variables.lineHeight,
|
|
380
|
-
prisma: "20px"
|
|
381
|
-
}));
|
|
375
|
+
})([ "", ";font-size:14px;overflow-wrap:break-word;line-height:", ";" ], w.mixins.reset("block"), w.variables.lineHeight);
|
|
382
376
|
var te = x().div.withConfig({
|
|
383
377
|
displayName: "HeaderStyles__StyledButtonsWrapper",
|
|
384
378
|
componentId: "sc-1y722ut-5"
|
|
@@ -459,8 +453,8 @@
|
|
|
459
453
|
*/ function le(e) {
|
|
460
454
|
var t = e.children, o = e.icon, i = e.onRequestClose, a = e.subtitle, l = e.title, c = oe(e, [ "children", "icon", "onRequestClose", "subtitle", "title" ]);
|
|
461
455
|
// @docs-props-type StepPropsBase
|
|
462
|
-
var s = (0, r.useContext)(z), u = s.titleId, p = s.divider;
|
|
463
|
-
var
|
|
456
|
+
var s = (0, r.useContext)(z), u = s.titleId, p = s.subtitleId, f = s.divider;
|
|
457
|
+
var d = f === "both" || f === "header";
|
|
464
458
|
|
|
465
459
|
return n().createElement(n().Fragment, null, n().createElement(J, ne({
|
|
466
460
|
$close: !!i,
|
|
@@ -469,11 +463,12 @@
|
|
|
469
463
|
id: u,
|
|
470
464
|
"data-test": "title"
|
|
471
465
|
}, l), a && n().createElement(ee, {
|
|
466
|
+
id: p,
|
|
472
467
|
"data-test": "subtitle"
|
|
473
468
|
}, a)) : t, i && n().createElement(te, null, i && n().createElement(re, null, n().createElement(G(), {
|
|
474
469
|
onClick: i,
|
|
475
470
|
"data-test": "close"
|
|
476
|
-
})))),
|
|
471
|
+
})))), d && n().createElement(B(), {
|
|
477
472
|
"aria-hidden": true
|
|
478
473
|
}));
|
|
479
474
|
}
|
|
@@ -525,12 +520,12 @@
|
|
|
525
520
|
return fe.apply(this, arguments);
|
|
526
521
|
}
|
|
527
522
|
function de(e) {
|
|
528
|
-
return ve(e) ||
|
|
523
|
+
return ve(e) || me(e) || be(e) || ye();
|
|
529
524
|
}
|
|
530
525
|
function ye() {
|
|
531
526
|
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
532
527
|
}
|
|
533
|
-
function
|
|
528
|
+
function be(e, t) {
|
|
534
529
|
if (!e) return;
|
|
535
530
|
if (typeof e === "string") return he(e, t);
|
|
536
531
|
var r = Object.prototype.toString.call(e).slice(8, -1);
|
|
@@ -538,7 +533,7 @@
|
|
|
538
533
|
if (r === "Map" || r === "Set") return Array.from(e);
|
|
539
534
|
if (r === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)) return he(e, t);
|
|
540
535
|
}
|
|
541
|
-
function
|
|
536
|
+
function me(e) {
|
|
542
537
|
if (typeof Symbol !== "undefined" && Symbol.iterator in Object(e)) return Array.from(e);
|
|
543
538
|
}
|
|
544
539
|
function ve(e) {
|
|
@@ -606,12 +601,12 @@
|
|
|
606
601
|
Object.defineProperty(e, n.key, n);
|
|
607
602
|
}
|
|
608
603
|
}
|
|
609
|
-
function
|
|
604
|
+
function je(e, t, r) {
|
|
610
605
|
if (t) we(e.prototype, t);
|
|
611
606
|
if (r) we(e, r);
|
|
612
607
|
return e;
|
|
613
608
|
}
|
|
614
|
-
function
|
|
609
|
+
function ke(e, t) {
|
|
615
610
|
if (typeof t !== "function" && t !== null) {
|
|
616
611
|
throw new TypeError("Super expression must either be null or a function");
|
|
617
612
|
}
|
|
@@ -622,16 +617,16 @@
|
|
|
622
617
|
configurable: true
|
|
623
618
|
}
|
|
624
619
|
});
|
|
625
|
-
if (t)
|
|
620
|
+
if (t) Ie(e, t);
|
|
626
621
|
}
|
|
627
|
-
function
|
|
628
|
-
|
|
622
|
+
function Ie(e, t) {
|
|
623
|
+
Ie = Object.setPrototypeOf || function e(t, r) {
|
|
629
624
|
t.__proto__ = r;
|
|
630
625
|
return t;
|
|
631
626
|
};
|
|
632
|
-
return
|
|
627
|
+
return Ie(e, t);
|
|
633
628
|
}
|
|
634
|
-
function
|
|
629
|
+
function Ce(e) {
|
|
635
630
|
var t = Ee();
|
|
636
631
|
return function r() {
|
|
637
632
|
var n = Me(e), o;
|
|
@@ -686,13 +681,14 @@
|
|
|
686
681
|
}
|
|
687
682
|
return e;
|
|
688
683
|
}
|
|
689
|
-
|
|
684
|
+
var qe = {
|
|
690
685
|
children: i().node,
|
|
691
686
|
divider: i().oneOf([ "header", "footer", "both", "none" ]),
|
|
692
687
|
elementRef: i().oneOfType([ i().func, i().object ]),
|
|
693
688
|
initialFocus: i().oneOfType([ i().object, i().oneOf([ "first", "container" ]) ]),
|
|
694
689
|
onRequestClose: i().func,
|
|
695
|
-
open: i().bool
|
|
690
|
+
open: i().bool,
|
|
691
|
+
returnFocus: i().oneOfType([ i().func, i().object ])
|
|
696
692
|
};
|
|
697
693
|
var Fe = {
|
|
698
694
|
divider: "both",
|
|
@@ -700,8 +696,8 @@
|
|
|
700
696
|
open: false
|
|
701
697
|
};
|
|
702
698
|
var De = function(e) {
|
|
703
|
-
|
|
704
|
-
var t =
|
|
699
|
+
ke(o, e);
|
|
700
|
+
var t = Ce(o);
|
|
705
701
|
// @docs-props-type ModalPropsBase
|
|
706
702
|
// this timeout ensures that the Modal is finished rendering before setting the focus
|
|
707
703
|
function o(e) {
|
|
@@ -712,6 +708,7 @@
|
|
|
712
708
|
Te(_e(i), "initialFocusTimeoutId", undefined);
|
|
713
709
|
Te(_e(i), "initialFocus", null);
|
|
714
710
|
Te(_e(i), "headerTitleId", void 0);
|
|
711
|
+
Te(_e(i), "headerSubtitleId", void 0);
|
|
715
712
|
Te(_e(i), "getDefaultMotionStyle", (function() {
|
|
716
713
|
return {
|
|
717
714
|
top: 0
|
|
@@ -727,36 +724,46 @@
|
|
|
727
724
|
top: 0
|
|
728
725
|
};
|
|
729
726
|
}));
|
|
730
|
-
Te(_e(i), "
|
|
731
|
-
var
|
|
732
|
-
if (
|
|
727
|
+
Te(_e(i), "handleFocus", (function(e) {
|
|
728
|
+
var t = i.props, r = t.initialFocus, n = t.open;
|
|
729
|
+
if (n) {
|
|
733
730
|
i.initialFocusTimeoutId = l()((function() {
|
|
734
731
|
var e;
|
|
735
732
|
// not using the takeFocus() util here because it
|
|
736
733
|
// doesn't work for all values of "initialFocus"
|
|
737
734
|
// and it has a nested defer() call, which we want to avoid
|
|
738
|
-
if (i.initialFocus !==
|
|
739
|
-
if (
|
|
735
|
+
if (i.initialFocus !== r) {
|
|
736
|
+
if (r === "first") {
|
|
740
737
|
if (i.el) {
|
|
741
738
|
/* eslint-disable prefer-destructuring */
|
|
742
739
|
/* prefer-desturucting leads to harder-to-read syntax in this case */
|
|
743
|
-
e = (0,
|
|
740
|
+
e = (0, m.getSortedTabbableElements)(i.el)[0];
|
|
744
741
|
/* eslint-enable prefer-destructuring */ }
|
|
745
|
-
} else if (
|
|
742
|
+
} else if (r === "container") {
|
|
746
743
|
e = i.el;
|
|
747
|
-
} else if (Oe(
|
|
748
|
-
e =
|
|
744
|
+
} else if (Oe(r) === "object") {
|
|
745
|
+
e = r;
|
|
749
746
|
}
|
|
750
747
|
// Typescript isn't happy with optional chaining here
|
|
751
748
|
if (e != null && "focus" in e) {
|
|
752
749
|
e.focus();
|
|
753
750
|
}
|
|
754
|
-
i.initialFocus =
|
|
751
|
+
i.initialFocus = r;
|
|
755
752
|
}
|
|
756
753
|
}));
|
|
757
754
|
} else {
|
|
758
755
|
i.initialFocus = null;
|
|
759
756
|
clearTimeout(i.initialFocusTimeoutId);
|
|
757
|
+
if (e) {
|
|
758
|
+
/**
|
|
759
|
+
* We return focus to the invoking element here instead of in `handleRequestClose` because users can
|
|
760
|
+
* close the modal by updating the value of the `open` prop without calling `onRequestClose`
|
|
761
|
+
*/
|
|
762
|
+
l()((function() {
|
|
763
|
+
var e, t, r;
|
|
764
|
+
(e = i.props.returnFocus) === null || e === void 0 ? void 0 : (t = e.current) === null || t === void 0 ? void 0 : (r = t.focus) === null || r === void 0 ? void 0 : r.call(t);
|
|
765
|
+
}));
|
|
766
|
+
}
|
|
760
767
|
}
|
|
761
768
|
}));
|
|
762
769
|
Te(_e(i), "handleModalMount", (function(e) {
|
|
@@ -765,7 +772,7 @@
|
|
|
765
772
|
}));
|
|
766
773
|
Te(_e(i), "handleModalKeyDown", (function(e) {
|
|
767
774
|
if (i.el !== null) {
|
|
768
|
-
(0,
|
|
775
|
+
(0, m.handleTab)(i.el, e.nativeEvent);
|
|
769
776
|
}
|
|
770
777
|
}));
|
|
771
778
|
Te(_e(i), "handleRequestClose", (function(e) {
|
|
@@ -774,10 +781,11 @@
|
|
|
774
781
|
(t = (r = i.props).onRequestClose) === null || t === void 0 ? void 0 : t.call(r, e);
|
|
775
782
|
}));
|
|
776
783
|
Te(_e(i), "getProviderValue", p()((function(e) {
|
|
777
|
-
var t = e.titleId, r = e.divider;
|
|
784
|
+
var t = e.titleId, r = e.subtitleId, n = e.divider;
|
|
778
785
|
return {
|
|
779
786
|
titleId: t,
|
|
780
|
-
|
|
787
|
+
subtitleId: r,
|
|
788
|
+
divider: n
|
|
781
789
|
};
|
|
782
790
|
})));
|
|
783
791
|
Te(_e(i), "getModalStyles", p()((function(e) {
|
|
@@ -803,21 +811,24 @@
|
|
|
803
811
|
tabIndex: -1,
|
|
804
812
|
onKeyDown: i.handleModalKeyDown,
|
|
805
813
|
role: "dialog",
|
|
806
|
-
"aria-labelledby": i.headerTitleId
|
|
814
|
+
"aria-labelledby": i.headerTitleId,
|
|
815
|
+
"aria-describedby": i.headerSubtitleId
|
|
807
816
|
}, d()(i.props, [].concat(de(s()(o.propTypes)), [ "style" ]))), n().createElement(z.Provider, {
|
|
808
817
|
value: i.getProviderValue({
|
|
809
818
|
titleId: i.headerTitleId,
|
|
819
|
+
subtitleId: i.headerSubtitleId,
|
|
810
820
|
divider: l
|
|
811
821
|
})
|
|
812
822
|
}, f));
|
|
813
823
|
}));
|
|
814
824
|
i.headerTitleId = (0, v.createDOMID)("titleId");
|
|
825
|
+
i.headerSubtitleId = (0, v.createDOMID)("subtitleId");
|
|
815
826
|
return i;
|
|
816
827
|
}
|
|
817
|
-
|
|
828
|
+
je(o, [ {
|
|
818
829
|
key: "componentDidMount",
|
|
819
830
|
value: function e() {
|
|
820
|
-
this.
|
|
831
|
+
this.handleFocus();
|
|
821
832
|
}
|
|
822
833
|
}, {
|
|
823
834
|
key: "componentDidUpdate",
|
|
@@ -828,13 +839,13 @@
|
|
|
828
839
|
// so that focus won't jump around if "initialFocus" changes
|
|
829
840
|
clearTimeout(this.initialFocusTimeoutId);
|
|
830
841
|
}
|
|
831
|
-
this.
|
|
842
|
+
this.handleFocus(t.open);
|
|
832
843
|
}
|
|
833
844
|
}, {
|
|
834
845
|
key: "render",
|
|
835
846
|
value: function e() {
|
|
836
847
|
|
|
837
|
-
return n().createElement(
|
|
848
|
+
return n().createElement(b(), {
|
|
838
849
|
open: this.props.open,
|
|
839
850
|
getDefaultMotionStyle: this.getDefaultMotionStyle,
|
|
840
851
|
renderModal: this.renderModal,
|
package/RadioList.js
CHANGED
|
@@ -303,7 +303,8 @@
|
|
|
303
303
|
value: b.toString(),
|
|
304
304
|
checked: O,
|
|
305
305
|
onChange: C,
|
|
306
|
-
"data-test": "input"
|
|
306
|
+
"data-test": "input",
|
|
307
|
+
required: x.required
|
|
307
308
|
}), o().createElement(f, {
|
|
308
309
|
htmlFor: k,
|
|
309
310
|
"data-test": "label"
|
|
@@ -413,19 +414,19 @@
|
|
|
413
414
|
return a;
|
|
414
415
|
}
|
|
415
416
|
var N = {
|
|
416
|
-
direction: t().oneOf([ "row", "column" ]),
|
|
417
417
|
children: t().node,
|
|
418
418
|
defaultValue: t().any,
|
|
419
|
+
describedBy: t().string,
|
|
420
|
+
direction: t().oneOf([ "row", "column" ]),
|
|
419
421
|
disabled: t().bool,
|
|
420
422
|
elementRef: t().oneOfType([ t().func, t().object ]),
|
|
421
423
|
error: t().bool,
|
|
424
|
+
labelledBy: t().string,
|
|
422
425
|
name: t().string,
|
|
423
426
|
onChange: t().func,
|
|
424
427
|
/** @private. */
|
|
425
428
|
required: t().bool,
|
|
426
|
-
value: t().any
|
|
427
|
-
labelledBy: t().string,
|
|
428
|
-
describedBy: t().string
|
|
429
|
+
value: t().any
|
|
429
430
|
};
|
|
430
431
|
function R(e) {
|
|
431
432
|
var r = e.children, i = e.defaultValue, t = e.describedBy, n = e.direction, c = n === void 0 ? "column" : n, u = e.disabled, b = u === void 0 ? false : u, p = e.error, v = p === void 0 ? false : p, f = e.labelledBy, y = e.name, g = e.onChange, m = e.required, h = e.value, k = B(e, [ "children", "defaultValue", "describedBy", "direction", "disabled", "error", "labelledBy", "name", "onChange", "required", "value" ]);
|
|
@@ -459,11 +460,12 @@
|
|
|
459
460
|
|
|
460
461
|
return o().createElement(d.Provider, {
|
|
461
462
|
value: {
|
|
462
|
-
|
|
463
|
-
name: E,
|
|
464
|
-
onChange: D,
|
|
463
|
+
disabled: b,
|
|
465
464
|
error: v,
|
|
466
|
-
|
|
465
|
+
onChange: D,
|
|
466
|
+
name: E,
|
|
467
|
+
required: m,
|
|
468
|
+
value: _
|
|
467
469
|
}
|
|
468
470
|
}, o().createElement(S, j({
|
|
469
471
|
flex: true,
|
|
@@ -473,8 +475,7 @@
|
|
|
473
475
|
"data-test-value": _
|
|
474
476
|
}, l()(k, [ "aria-labelledby", "aria-describedby" ]), {
|
|
475
477
|
"aria-labelledby": M ? "".concat(M, " ").concat(f) : f,
|
|
476
|
-
"aria-describedby": T ? "".concat(T, " ").concat(t) : t
|
|
477
|
-
"aria-required": m
|
|
478
|
+
"aria-describedby": T ? "".concat(T, " ").concat(t) : t
|
|
478
479
|
}), r));
|
|
479
480
|
}
|
|
480
481
|
R.propTypes = N;
|