@splunk/react-ui 4.25.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/CHANGELOG.md +21 -3
- package/MIGRATION.mdx +48 -0
- package/Modal.js +38 -27
- package/Table.js +2330 -2543
- package/TextArea.js +298 -302
- package/package.json +2 -2
- 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/Modal/Header.d.ts +6 -5
- package/types/src/Modal/Modal.d.ts +9 -2
- 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/Breadcrumbs.js
CHANGED
|
@@ -61,7 +61,8 @@
|
|
|
61
61
|
e.r(r);
|
|
62
62
|
// EXPORTS
|
|
63
63
|
e.d(r, {
|
|
64
|
-
|
|
64
|
+
BreadcrumbsContext: () => /* reexport */ E,
|
|
65
|
+
Item: () => /* reexport */ O,
|
|
65
66
|
default: () => /* reexport */ q
|
|
66
67
|
});
|
|
67
68
|
// CONCATENATED MODULE: external "react"
|
|
@@ -74,14 +75,14 @@
|
|
|
74
75
|
const l = require("@splunk/ui-utils/i18n");
|
|
75
76
|
// CONCATENATED MODULE: external "styled-components"
|
|
76
77
|
const i = require("styled-components");
|
|
77
|
-
var
|
|
78
|
+
var c = e.n(i);
|
|
78
79
|
// CONCATENATED MODULE: external "@splunk/themes"
|
|
79
80
|
const u = require("@splunk/themes");
|
|
80
81
|
// CONCATENATED MODULE: external "@splunk/react-ui/Link"
|
|
81
|
-
const
|
|
82
|
-
var f = e.n(
|
|
82
|
+
const s = require("@splunk/react-ui/Link");
|
|
83
|
+
var f = e.n(s);
|
|
83
84
|
// CONCATENATED MODULE: ./src/Breadcrumbs/ItemStyles.ts
|
|
84
|
-
var d =
|
|
85
|
+
var d = c()(f()).withConfig({
|
|
85
86
|
displayName: "ItemStyles__StyledLink",
|
|
86
87
|
componentId: "sc-1ywtawf-0"
|
|
87
88
|
})([ "display:flex;align-items:center;gap:", ";white-space:nowrap;color:", ";&:where(:hover,:focus):not([disabled],[aria-disabled='true']){color:", ";}" ], u.variables.spacingXSmall, u.variables.contentColorDefault, u.variables.contentColorActive);
|
|
@@ -102,7 +103,7 @@
|
|
|
102
103
|
}
|
|
103
104
|
function b(e, r) {
|
|
104
105
|
if (e == null) return {};
|
|
105
|
-
var t =
|
|
106
|
+
var t = v(e, r);
|
|
106
107
|
var n, a;
|
|
107
108
|
if (Object.getOwnPropertySymbols) {
|
|
108
109
|
var o = Object.getOwnPropertySymbols(e);
|
|
@@ -115,7 +116,7 @@
|
|
|
115
116
|
}
|
|
116
117
|
return t;
|
|
117
118
|
}
|
|
118
|
-
function
|
|
119
|
+
function v(e, r) {
|
|
119
120
|
if (e == null) return {};
|
|
120
121
|
var t = {};
|
|
121
122
|
var n = Object.keys(e);
|
|
@@ -127,7 +128,7 @@
|
|
|
127
128
|
}
|
|
128
129
|
return t;
|
|
129
130
|
}
|
|
130
|
-
var
|
|
131
|
+
var m = Object.freeze({
|
|
131
132
|
allowDisabledLink: true,
|
|
132
133
|
disabled: true,
|
|
133
134
|
to: ""
|
|
@@ -138,6 +139,7 @@
|
|
|
138
139
|
endAdornment: o().node,
|
|
139
140
|
isCurrent: o().bool,
|
|
140
141
|
label: o().string.isRequired,
|
|
142
|
+
onClick: o().func,
|
|
141
143
|
startAdornment: o().node,
|
|
142
144
|
to: o().string.isRequired
|
|
143
145
|
};
|
|
@@ -145,42 +147,56 @@
|
|
|
145
147
|
enableCurrentPage: false,
|
|
146
148
|
isCurrent: false
|
|
147
149
|
};
|
|
148
|
-
function
|
|
149
|
-
var r = e.enableCurrentPage,
|
|
150
|
+
function C(e) {
|
|
151
|
+
var r = e.enableCurrentPage, a = e.endAdornment, o = e.isCurrent, l = e.label, i = e.onClick, c = e.startAdornment, u = e.to, s = b(e, [ "enableCurrentPage", "endAdornment", "isCurrent", "label", "onClick", "startAdornment", "to" ]);
|
|
150
152
|
// @docs-props-type ItemPropsBase
|
|
151
|
-
var
|
|
152
|
-
|
|
153
|
+
var f = (0, t.useContext)(E), v = f.onClick;
|
|
154
|
+
var y = {
|
|
155
|
+
to: u
|
|
153
156
|
};
|
|
154
|
-
|
|
155
|
-
|
|
157
|
+
var g = (0, t.useCallback)((function(e) {
|
|
158
|
+
i === null || i === void 0 ? void 0 : i(e, {
|
|
159
|
+
label: l,
|
|
160
|
+
to: u
|
|
161
|
+
});
|
|
162
|
+
v === null || v === void 0 ? void 0 : v(e, {
|
|
163
|
+
label: l,
|
|
164
|
+
to: u
|
|
165
|
+
});
|
|
166
|
+
}), [ i, v, l, u ]);
|
|
167
|
+
if (o) {
|
|
168
|
+
y["aria-current"] = "page";
|
|
156
169
|
if (!r) {
|
|
157
|
-
Object.assign(
|
|
170
|
+
Object.assign(y, m);
|
|
158
171
|
}
|
|
159
172
|
}
|
|
173
|
+
var C = i || v ? {
|
|
174
|
+
onClick: g
|
|
175
|
+
} : {};
|
|
160
176
|
|
|
161
177
|
return n().createElement(d, p({
|
|
162
178
|
"data-test": "item"
|
|
163
|
-
},
|
|
179
|
+
}, C, y, s), c && c, l, a && a);
|
|
164
180
|
}
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
/* harmony default export */ const
|
|
181
|
+
C.propTypes = y;
|
|
182
|
+
C.defaultProps = g;
|
|
183
|
+
/* harmony default export */ const O = C;
|
|
168
184
|
// CONCATENATED MODULE: ./src/Breadcrumbs/BreadcrumbsStyles.ts
|
|
169
|
-
var
|
|
185
|
+
var h = c().ol.withConfig({
|
|
170
186
|
displayName: "BreadcrumbsStyles__StyledList",
|
|
171
187
|
componentId: "sc-1maeyfk-0"
|
|
172
188
|
})([ "", " flex-wrap:wrap;" ], u.mixins.reset("flex"));
|
|
173
|
-
var
|
|
189
|
+
var k = c().li.withConfig({
|
|
174
190
|
displayName: "BreadcrumbsStyles__StyledListItem",
|
|
175
191
|
componentId: "sc-1maeyfk-1"
|
|
176
192
|
})([ "display:flex;min-width:max-content;a[aria-current]{font-weight:", ";color:", ";cursor:default;}" ], u.variables.fontWeightSemiBold, u.variables.contentColorActive);
|
|
177
|
-
var P =
|
|
193
|
+
var P = c().span.withConfig({
|
|
178
194
|
displayName: "BreadcrumbsStyles__StyledSeparator",
|
|
179
195
|
componentId: "sc-1maeyfk-2"
|
|
180
196
|
})([ "cursor:default;padding:0 ", ";color:", ";" ], u.variables.spacingSmall, u.variables.contentColorDefault);
|
|
181
197
|
// CONCATENATED MODULE: ./src/Breadcrumbs/Breadcrumbs.tsx
|
|
182
|
-
function
|
|
183
|
-
|
|
198
|
+
function w() {
|
|
199
|
+
w = Object.assign || function(e) {
|
|
184
200
|
for (var r = 1; r < arguments.length; r++) {
|
|
185
201
|
var t = arguments[r];
|
|
186
202
|
for (var n in t) {
|
|
@@ -191,11 +207,11 @@
|
|
|
191
207
|
}
|
|
192
208
|
return e;
|
|
193
209
|
};
|
|
194
|
-
return
|
|
210
|
+
return w.apply(this, arguments);
|
|
195
211
|
}
|
|
196
|
-
function
|
|
212
|
+
function S(e, r) {
|
|
197
213
|
if (e == null) return {};
|
|
198
|
-
var t =
|
|
214
|
+
var t = j(e, r);
|
|
199
215
|
var n, a;
|
|
200
216
|
if (Object.getOwnPropertySymbols) {
|
|
201
217
|
var o = Object.getOwnPropertySymbols(e);
|
|
@@ -208,7 +224,7 @@
|
|
|
208
224
|
}
|
|
209
225
|
return t;
|
|
210
226
|
}
|
|
211
|
-
function
|
|
227
|
+
function j(e, r) {
|
|
212
228
|
if (e == null) return {};
|
|
213
229
|
var t = {};
|
|
214
230
|
var n = Object.keys(e);
|
|
@@ -220,44 +236,51 @@
|
|
|
220
236
|
}
|
|
221
237
|
return t;
|
|
222
238
|
}
|
|
223
|
-
var
|
|
239
|
+
var x = {
|
|
224
240
|
children: o().node.isRequired,
|
|
225
241
|
elementRef: o().oneOfType([ o().func, o().object ]),
|
|
226
|
-
enableCurrentPage: o().bool
|
|
242
|
+
enableCurrentPage: o().bool,
|
|
243
|
+
onClick: o().func
|
|
227
244
|
};
|
|
228
|
-
var
|
|
245
|
+
var _ = {
|
|
229
246
|
enableCurrentPage: false
|
|
230
247
|
};
|
|
248
|
+
var E = n().createContext({});
|
|
231
249
|
function I(e) {
|
|
232
|
-
var r = e.children, a = e.elementRef, o = e.enableCurrentPage, i =
|
|
250
|
+
var r = e.children, a = e.elementRef, o = e.enableCurrentPage, i = e.onClick, c = S(e, [ "children", "elementRef", "enableCurrentPage", "onClick" ]);
|
|
233
251
|
// @docs-props-type BreadcrumbsPropsBase
|
|
234
|
-
var
|
|
235
|
-
var
|
|
252
|
+
var u;
|
|
253
|
+
var s = t.Children.toArray(r).filter(t.isValidElement).map((function(e, a) {
|
|
236
254
|
if (false) {}
|
|
237
255
|
if (false) {}
|
|
238
|
-
// Set the last child as the current
|
|
256
|
+
// Set the last child as the current Breadcrumbs.Item
|
|
239
257
|
var l = a === t.Children.count(r) - 1;
|
|
240
258
|
var i = (0, t.cloneElement)(e, {
|
|
241
259
|
isCurrent: l,
|
|
242
260
|
enableCurrentPage: o
|
|
243
261
|
});
|
|
244
262
|
|
|
245
|
-
return n().createElement(
|
|
263
|
+
return n().createElement(k, {
|
|
246
264
|
key: e.props.to
|
|
247
265
|
}, i, !l && n().createElement(P, {
|
|
248
266
|
"aria-hidden": "true"
|
|
249
267
|
}, "/"));
|
|
250
268
|
}));
|
|
269
|
+
var f = {
|
|
270
|
+
onClick: i
|
|
271
|
+
};
|
|
251
272
|
|
|
252
|
-
return n().createElement(
|
|
273
|
+
return n().createElement(E.Provider, {
|
|
274
|
+
value: f
|
|
275
|
+
}, n().createElement("nav", w({
|
|
253
276
|
"data-test": "breadcrumbs",
|
|
254
|
-
"aria-label": (0, l._)("
|
|
277
|
+
"aria-label": (0, l._)("Breadcrumbs"),
|
|
255
278
|
ref: a
|
|
256
|
-
},
|
|
279
|
+
}, c), n().createElement(h, null, s)));
|
|
257
280
|
}
|
|
258
|
-
I.propTypes =
|
|
259
|
-
I.defaultProps =
|
|
260
|
-
I.Item =
|
|
281
|
+
I.propTypes = x;
|
|
282
|
+
I.defaultProps = _;
|
|
283
|
+
I.Item = O;
|
|
261
284
|
/* harmony default export */ const q = I;
|
|
262
285
|
// CONCATENATED MODULE: ./src/Breadcrumbs/index.ts
|
|
263
286
|
module.exports = r;
|
package/CHANGELOG.md
CHANGED
|
@@ -1,14 +1,31 @@
|
|
|
1
1
|
Change Log
|
|
2
2
|
============
|
|
3
3
|
|
|
4
|
+
4.26.0 - Feb 21, 2024
|
|
5
|
+
----------
|
|
6
|
+
New Features:
|
|
7
|
+
* `Modal` automatically returns focus to the invoking element after close when a ref is provided to the new prop `returnFocus` (SUI-2834).
|
|
8
|
+
* `Breadcrumbs` and `Breadcrumbs.Item` now support `onClick` prop (SUI-5911).
|
|
9
|
+
|
|
10
|
+
Bug Fixes:
|
|
11
|
+
* `TextArea`'s test selector is now `data-test="text-area"` rather than `data-test="text"` (SUI-5964).
|
|
12
|
+
* The icon in `Modal.Header` is now aligned with the top of the title (SUI-5930).
|
|
13
|
+
* `TextArea` renders at the correct size when `minRows={1}` (SUI-6010).
|
|
14
|
+
* `TextArea` has consistent height when rendering rows regardless if value is present.
|
|
15
|
+
* Fixed spurious deprecation warnings for `canClear` and `placeholder` props in `TextArea`.
|
|
16
|
+
* Fixed regression in `TextArea` where placeholder text could be cut off.
|
|
17
|
+
|
|
18
|
+
API Changes:
|
|
19
|
+
* Corrected the type of `Modal`'s `initialFocus` prop to include `React.Component & { focus: () => void }` instead of `React.Component & { focus: () => {} }`.
|
|
20
|
+
|
|
4
21
|
4.25.0 - Feb 6, 2024
|
|
5
22
|
----------
|
|
6
23
|
New Features:
|
|
7
|
-
* Modal supports `subtitle` and `icon` props in Enterprise themes (SUI-5924).
|
|
24
|
+
* `Modal` supports `subtitle` and `icon` props in Enterprise themes (SUI-5924).
|
|
8
25
|
* `Button` now supports a new `"dimmed"` value for the `disabled` prop (SUI-5819).
|
|
9
26
|
|
|
10
27
|
Bug Fixes:
|
|
11
|
-
* Modal `subtitle` is used as the accessible description for the dialog (SUI-5264).
|
|
28
|
+
* `Modal`'s `subtitle` is used as the accessible description for the dialog (SUI-5264).
|
|
12
29
|
* `Color`'s `required` attribute is correctly applied when inside a `ControlGroup` in Prisma themes (SUI-5386).
|
|
13
30
|
* `RadioList`'s `required` attribute is correctly applied when inside a `ControlGroup` (SUI-5386).
|
|
14
31
|
|
|
@@ -30,6 +47,7 @@ New Features:
|
|
|
30
47
|
Bug Fixes:
|
|
31
48
|
* The system color picker for `Color` no longer closes unexpectedly during color selection in Safari (SUI-5831).
|
|
32
49
|
* `ComboBox`'s options are no longer clickable while closing (SUI-5825).
|
|
50
|
+
* Improved the row drag and drop experience and performance by adopting `@dnd-kit` in `Table` component (SUI-5134).
|
|
33
51
|
|
|
34
52
|
Deprecations:
|
|
35
53
|
* `JSONTree`'s `expandChildren="withShiftModifier"` value has been deprecated and will be removed in a future major version. Use the `expandChildrenOnShiftKey` prop instead (SUI-5771).
|
|
@@ -87,7 +105,7 @@ Docs:
|
|
|
87
105
|
4.20.0 - September 5, 2023
|
|
88
106
|
----------
|
|
89
107
|
New Features:
|
|
90
|
-
* New `
|
|
108
|
+
* New `Breadcrumbs` component (SUI-1819).
|
|
91
109
|
* `Code` now supports `language="splunk-spl"` (SUI-5737).
|
|
92
110
|
|
|
93
111
|
Bug Fixes:
|
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
|
@@ -208,12 +208,12 @@
|
|
|
208
208
|
}
|
|
209
209
|
return r;
|
|
210
210
|
}
|
|
211
|
-
var
|
|
211
|
+
var F = {
|
|
212
212
|
children: i().node
|
|
213
213
|
};
|
|
214
214
|
/**
|
|
215
215
|
* A styled container for `Modal` body content.
|
|
216
|
-
*/ function
|
|
216
|
+
*/ function D(e) {
|
|
217
217
|
var t = e.children, o = T(e, [ "children" ]);
|
|
218
218
|
// @docs-props-type BodyPropsBase
|
|
219
219
|
var i = (0, r.useState)(), a = I(i, 2), l = a[0], c = a[1];
|
|
@@ -229,8 +229,8 @@
|
|
|
229
229
|
value: l
|
|
230
230
|
}, t));
|
|
231
231
|
}
|
|
232
|
-
|
|
233
|
-
/* harmony default export */ const R =
|
|
232
|
+
D.propTypes = F;
|
|
233
|
+
/* harmony default export */ const R = D;
|
|
234
234
|
// CONCATENATED MODULE: external "@splunk/react-ui/Divider"
|
|
235
235
|
const A = require("@splunk/react-ui/Divider");
|
|
236
236
|
var B = e.n(A);
|
|
@@ -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,7 +349,7 @@
|
|
|
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"
|
|
@@ -681,20 +681,21 @@
|
|
|
681
681
|
}
|
|
682
682
|
return e;
|
|
683
683
|
}
|
|
684
|
-
|
|
684
|
+
var qe = {
|
|
685
685
|
children: i().node,
|
|
686
686
|
divider: i().oneOf([ "header", "footer", "both", "none" ]),
|
|
687
687
|
elementRef: i().oneOfType([ i().func, i().object ]),
|
|
688
688
|
initialFocus: i().oneOfType([ i().object, i().oneOf([ "first", "container" ]) ]),
|
|
689
689
|
onRequestClose: i().func,
|
|
690
|
-
open: i().bool
|
|
690
|
+
open: i().bool,
|
|
691
|
+
returnFocus: i().oneOfType([ i().func, i().object ])
|
|
691
692
|
};
|
|
692
|
-
var
|
|
693
|
+
var Fe = {
|
|
693
694
|
divider: "both",
|
|
694
695
|
initialFocus: "first",
|
|
695
696
|
open: false
|
|
696
697
|
};
|
|
697
|
-
var
|
|
698
|
+
var De = function(e) {
|
|
698
699
|
ke(o, e);
|
|
699
700
|
var t = Ce(o);
|
|
700
701
|
// @docs-props-type ModalPropsBase
|
|
@@ -723,36 +724,46 @@
|
|
|
723
724
|
top: 0
|
|
724
725
|
};
|
|
725
726
|
}));
|
|
726
|
-
Te(_e(i), "
|
|
727
|
-
var
|
|
728
|
-
if (
|
|
727
|
+
Te(_e(i), "handleFocus", (function(e) {
|
|
728
|
+
var t = i.props, r = t.initialFocus, n = t.open;
|
|
729
|
+
if (n) {
|
|
729
730
|
i.initialFocusTimeoutId = l()((function() {
|
|
730
731
|
var e;
|
|
731
732
|
// not using the takeFocus() util here because it
|
|
732
733
|
// doesn't work for all values of "initialFocus"
|
|
733
734
|
// and it has a nested defer() call, which we want to avoid
|
|
734
|
-
if (i.initialFocus !==
|
|
735
|
-
if (
|
|
735
|
+
if (i.initialFocus !== r) {
|
|
736
|
+
if (r === "first") {
|
|
736
737
|
if (i.el) {
|
|
737
738
|
/* eslint-disable prefer-destructuring */
|
|
738
739
|
/* prefer-desturucting leads to harder-to-read syntax in this case */
|
|
739
740
|
e = (0, m.getSortedTabbableElements)(i.el)[0];
|
|
740
741
|
/* eslint-enable prefer-destructuring */ }
|
|
741
|
-
} else if (
|
|
742
|
+
} else if (r === "container") {
|
|
742
743
|
e = i.el;
|
|
743
|
-
} else if (Oe(
|
|
744
|
-
e =
|
|
744
|
+
} else if (Oe(r) === "object") {
|
|
745
|
+
e = r;
|
|
745
746
|
}
|
|
746
747
|
// Typescript isn't happy with optional chaining here
|
|
747
748
|
if (e != null && "focus" in e) {
|
|
748
749
|
e.focus();
|
|
749
750
|
}
|
|
750
|
-
i.initialFocus =
|
|
751
|
+
i.initialFocus = r;
|
|
751
752
|
}
|
|
752
753
|
}));
|
|
753
754
|
} else {
|
|
754
755
|
i.initialFocus = null;
|
|
755
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
|
+
}
|
|
756
767
|
}
|
|
757
768
|
}));
|
|
758
769
|
Te(_e(i), "handleModalMount", (function(e) {
|
|
@@ -817,7 +828,7 @@
|
|
|
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,7 +839,7 @@
|
|
|
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",
|
|
@@ -845,12 +856,12 @@
|
|
|
845
856
|
} ]);
|
|
846
857
|
return o;
|
|
847
858
|
}(r.Component);
|
|
848
|
-
Te(
|
|
849
|
-
Te(
|
|
850
|
-
Te(
|
|
851
|
-
Te(
|
|
852
|
-
Te(
|
|
853
|
-
/* harmony default export */ const Re =
|
|
859
|
+
Te(De, "propTypes", qe);
|
|
860
|
+
Te(De, "defaultProps", Fe);
|
|
861
|
+
Te(De, "Header", ce);
|
|
862
|
+
Te(De, "Body", R);
|
|
863
|
+
Te(De, "Footer", V);
|
|
864
|
+
/* harmony default export */ const Re = De;
|
|
854
865
|
// CONCATENATED MODULE: ./src/Modal/index.ts
|
|
855
866
|
module.exports = t;
|
|
856
867
|
/******/})();
|