@splunk/react-ui 4.41.0 → 4.42.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/ButtonGroup.js +1 -3
- package/CHANGELOG.md +22 -0
- package/Dropdown.js +33 -32
- package/Layer.js +115 -97
- package/Link.js +19 -21
- package/Menu.js +9 -8
- package/MessageBar.js +54 -56
- package/Multiselect.js +1051 -1035
- package/Number.js +51 -48
- package/Popover.js +481 -479
- package/Resize.js +61 -61
- package/ResultsMenu.js +4 -4
- package/Scroll.js +482 -475
- package/Select.js +532 -513
- package/Table.js +1515 -1433
- package/Text.js +29 -17
- package/TextArea.js +37 -37
- package/Tooltip.js +300 -207
- package/package.json +4 -4
- package/types/src/ButtonGroup/ButtonGroup.d.ts +0 -4
- package/types/src/Dropdown/Dropdown.d.ts +2 -1
- package/types/src/Layer/Layer.d.ts +2 -1
- package/types/src/Link/Link.d.ts +0 -2
- package/types/src/Number/Number.d.ts +10 -2
- package/types/src/Popover/Popover.d.ts +1 -4
- package/types/src/Resize/Resize.d.ts +0 -11
- package/types/src/Scroll/Inner.d.ts +17 -19
- package/types/src/Select/SelectBase.d.ts +6 -4
- package/types/src/Table/ExpandButton.d.ts +8 -0
- package/types/src/Table/HeadDropdownCell.d.ts +2 -0
- package/types/src/Table/HeadInner.d.ts +5 -1
- package/types/src/Table/Row.d.ts +8 -2
- package/types/src/Tooltip/Tooltip.d.ts +38 -5
- package/types/src/Tooltip/docs/examples/CustomProps.d.ts +2 -0
- package/types/src/Tooltip/docs/examples/Toggletip.d.ts +2 -0
- package/types/src/useControlled/useControlled.d.ts +5 -4
- package/useControlled.js +37 -15
- package/usePrevious.js +62 -30
- package/useRovingFocus.js +5 -4
- package/types/src/Table/icons/ExpansionRow.d.ts +0 -6
- package/types/src/Tooltip/docs/examples/CustomContent.d.ts +0 -2
package/ButtonGroup.js
CHANGED
|
@@ -118,9 +118,7 @@
|
|
|
118
118
|
}
|
|
119
119
|
var v = {
|
|
120
120
|
children: l().node,
|
|
121
|
-
elementRef: l().oneOfType([ l().func, l().object ])
|
|
122
|
-
/** @private */
|
|
123
|
-
flex: l().bool
|
|
121
|
+
elementRef: l().oneOfType([ l().func, l().object ])
|
|
124
122
|
};
|
|
125
123
|
function m(e) {
|
|
126
124
|
var r = e.children, o = d(e, [ "children" ]);
|
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,28 @@
|
|
|
1
1
|
Change Log
|
|
2
2
|
============
|
|
3
3
|
|
|
4
|
+
4.42.0 - February 5, 2025
|
|
5
|
+
----------
|
|
6
|
+
New Features:
|
|
7
|
+
* `SelectBase`'s `aria-label` attribute is omitted when the `labelledBy` prop is provided, since `aria-labelledby` takes precedence over `aria-label` in screen reader announcements (A11Y-3350).
|
|
8
|
+
* `Tooltip` has a new `renderAnchor` prop for rendering a `Tooltip` without a wrapper element (A11Y-3260).
|
|
9
|
+
|
|
10
|
+
Bug Fixes:
|
|
11
|
+
* `Text` and `TextArea`'s border has been updated to improve contrast in Enterprise dark themes (SUI-6984).
|
|
12
|
+
* `Table`'s dropdown cells in header are now accessible with keyboard (A11Y-3007).
|
|
13
|
+
* `Table`'s expandable row controls are now accessible with VoiceOver (SUI-6188).
|
|
14
|
+
* `Multiselect` with `compact` no longer shows an extra divider when used with `Multiselect.Heading` (SUI-7031).
|
|
15
|
+
* `Menu.Item` will now display a correct cursor ('not-allowed') when hovering over checkbox in disabled option in `Multiselect` with `compact` (A11Y-3397).
|
|
16
|
+
* `Popover` is now correctly positioned when the anchor is inside a container with `transform: scale()` (SUI-3423).
|
|
17
|
+
* `Layer` will now render its child components when the browser is in fullscreen mode (SUI-2741).
|
|
18
|
+
* This also fixes the issue for components that use `Layer`: eg.`Dropdown`, `Popover`, etc.
|
|
19
|
+
* `Table`'s cells content are now vertically centered when there's an action column in Enterprise themes (SUI-7093).
|
|
20
|
+
* `Dropdown`, `Select`, and `SelectBase` with filter will now set an additional id in `aria-labelledby` on popover, providing an additional screen reader announcement with the text `Type to filter` to indicate the presence of a filtering option (A11Y-3336).
|
|
21
|
+
|
|
22
|
+
Typescript:
|
|
23
|
+
* `Dropdown` does not show a TS error when passed native HTML attributes as props (A11Y-3336).
|
|
24
|
+
* `Link` will no longer fail to build in TypeScript projects due to an invalid `LinkStyles` export (SUI-7195).
|
|
25
|
+
|
|
4
26
|
4.41.0 - January 7, 2025
|
|
5
27
|
----------
|
|
6
28
|
New Features:
|
package/Dropdown.js
CHANGED
|
@@ -72,10 +72,10 @@
|
|
|
72
72
|
var i = e.n(r);
|
|
73
73
|
// CONCATENATED MODULE: external "lodash/has"
|
|
74
74
|
const l = require("lodash/has");
|
|
75
|
-
var
|
|
75
|
+
var a = e.n(l);
|
|
76
76
|
// CONCATENATED MODULE: external "lodash/includes"
|
|
77
|
-
const
|
|
78
|
-
var c = e.n(
|
|
77
|
+
const s = require("lodash/includes");
|
|
78
|
+
var c = e.n(s);
|
|
79
79
|
// CONCATENATED MODULE: external "lodash/isEmpty"
|
|
80
80
|
const p = require("lodash/isEmpty");
|
|
81
81
|
// CONCATENATED MODULE: external "lodash/isFunction"
|
|
@@ -83,10 +83,10 @@
|
|
|
83
83
|
var f = e.n(u);
|
|
84
84
|
// CONCATENATED MODULE: external "lodash/keys"
|
|
85
85
|
const d = require("lodash/keys");
|
|
86
|
-
var
|
|
86
|
+
var v = e.n(d);
|
|
87
87
|
// CONCATENATED MODULE: external "lodash/omit"
|
|
88
|
-
const
|
|
89
|
-
var y = e.n(
|
|
88
|
+
const g = require("lodash/omit");
|
|
89
|
+
var y = e.n(g);
|
|
90
90
|
// CONCATENATED MODULE: external "@splunk/ui-utils/id"
|
|
91
91
|
const h = require("@splunk/ui-utils/id");
|
|
92
92
|
// CONCATENATED MODULE: external "@splunk/ui-utils/keyboard"
|
|
@@ -339,16 +339,16 @@
|
|
|
339
339
|
}));
|
|
340
340
|
_(I(t), "handleRequestClose", (function(e) {
|
|
341
341
|
var o = e.event, n = e.reason;
|
|
342
|
-
var r = t.props, i = r.closeReasons, l = r.focusToggleReasons,
|
|
342
|
+
var r = t.props, i = r.closeReasons, l = r.focusToggleReasons, a = r.onRequestClose;
|
|
343
343
|
if (o && n === "clickAway") {
|
|
344
|
-
var
|
|
344
|
+
var s = o.target;
|
|
345
345
|
var p = t.props.inputId || t.props.toggle.props.id || t.toggleId;
|
|
346
|
-
while (
|
|
346
|
+
while (s) {
|
|
347
347
|
// Ignore clicks on toggle.
|
|
348
|
-
if (
|
|
348
|
+
if (s.id === p) {
|
|
349
349
|
return;
|
|
350
350
|
}
|
|
351
|
-
|
|
351
|
+
s = s.parentNode;
|
|
352
352
|
}
|
|
353
353
|
}
|
|
354
354
|
if (t.isOpen() && c()(i, n)) {
|
|
@@ -360,7 +360,7 @@
|
|
|
360
360
|
open: false
|
|
361
361
|
});
|
|
362
362
|
}
|
|
363
|
-
|
|
363
|
+
a === null || a === void 0 ? void 0 : a(e);
|
|
364
364
|
}
|
|
365
365
|
}));
|
|
366
366
|
_(I(t), "handleContentClick", (function(e) {
|
|
@@ -373,7 +373,7 @@
|
|
|
373
373
|
anchor: null,
|
|
374
374
|
open: false
|
|
375
375
|
};
|
|
376
|
-
t.controlledExternally =
|
|
376
|
+
t.controlledExternally = a()(e, "open");
|
|
377
377
|
t.popoverId = (0, h.createDOMID)("popover");
|
|
378
378
|
t.toggleId = (0, h.createDOMID)("toggle");
|
|
379
379
|
return t;
|
|
@@ -382,7 +382,7 @@
|
|
|
382
382
|
key: "componentDidUpdate",
|
|
383
383
|
value: function e() {
|
|
384
384
|
if (false) {}
|
|
385
|
-
var o = R({}, y()(this.props,
|
|
385
|
+
var o = R({}, y()(this.props, v()(r.propTypes), "value", "id"));
|
|
386
386
|
if (false) {}
|
|
387
387
|
}
|
|
388
388
|
}, {
|
|
@@ -420,38 +420,39 @@
|
|
|
420
420
|
}, {
|
|
421
421
|
key: "render",
|
|
422
422
|
value: function e() {
|
|
423
|
-
var o
|
|
423
|
+
var o;
|
|
424
|
+
var t = this.props, r = t.align, i = t.canCoverAnchor, l = t.children, a = t.closeReasons, s = t.defaultPlacement, p = t.elementRef, u = t.repositionMode, d = t.retainFocus, v = t.takeFocus;
|
|
424
425
|
var g = this.state.anchor;
|
|
425
|
-
var
|
|
426
|
-
var
|
|
426
|
+
var y = this.handleRequestClose, h = this.handleContentClick;
|
|
427
|
+
var b = this.renderToggle();
|
|
427
428
|
|
|
428
|
-
return n().createElement(n().Fragment, null,
|
|
429
|
-
align:
|
|
429
|
+
return n().createElement(n().Fragment, null, b, n().createElement(m(), {
|
|
430
|
+
align: r,
|
|
430
431
|
open: !!g && this.isOpen(),
|
|
431
|
-
autoCloseWhenOffScreen: c()(
|
|
432
|
+
autoCloseWhenOffScreen: c()(a, "offScreen"),
|
|
432
433
|
anchor: g,
|
|
433
|
-
canCoverAnchor:
|
|
434
|
-
elementRef:
|
|
435
|
-
retainFocus:
|
|
434
|
+
canCoverAnchor: i,
|
|
435
|
+
elementRef: p,
|
|
436
|
+
retainFocus: d,
|
|
436
437
|
defaultPlacement: s,
|
|
437
|
-
onRequestClose:
|
|
438
|
-
repositionMode:
|
|
438
|
+
onRequestClose: y,
|
|
439
|
+
repositionMode: u,
|
|
439
440
|
id: this.popoverId,
|
|
440
|
-
"aria-labelledby": this.props.inputId || this.props.toggle.props.id || this.toggleId,
|
|
441
|
-
takeFocus:
|
|
442
|
-
}, f()(
|
|
441
|
+
"aria-labelledby": "".concat((o = this.props["aria-labelledby"]) !== null && o !== void 0 ? o : "", " ").concat(this.props.inputId || this.props.toggle.props.id || this.toggleId).trim(),
|
|
442
|
+
takeFocus: v
|
|
443
|
+
}, f()(l) ?
|
|
443
444
|
// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
|
|
444
445
|
function() {
|
|
445
446
|
|
|
446
447
|
return n().createElement("div", {
|
|
447
|
-
onClick:
|
|
448
|
-
},
|
|
448
|
+
onClick: h
|
|
449
|
+
}, l.apply(void 0, arguments));
|
|
449
450
|
} :
|
|
450
451
|
|
|
451
452
|
// eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
|
|
452
453
|
n().createElement("div", {
|
|
453
|
-
onClick:
|
|
454
|
-
},
|
|
454
|
+
onClick: h
|
|
455
|
+
}, l)));
|
|
455
456
|
}
|
|
456
457
|
} ]);
|
|
457
458
|
return r;
|
package/Layer.js
CHANGED
|
@@ -73,10 +73,10 @@
|
|
|
73
73
|
e.r(t);
|
|
74
74
|
// EXPORTS
|
|
75
75
|
e.d(t, {
|
|
76
|
-
LayerContext: () => /* reexport */
|
|
77
|
-
LayerStackContext: () => /* reexport */
|
|
78
|
-
LayerStackGlobalProvider: () => /* reexport */
|
|
79
|
-
default: () => /* reexport */
|
|
76
|
+
LayerContext: () => /* reexport */ h,
|
|
77
|
+
LayerStackContext: () => /* reexport */ v,
|
|
78
|
+
LayerStackGlobalProvider: () => /* reexport */ b,
|
|
79
|
+
default: () => /* reexport */ I
|
|
80
80
|
});
|
|
81
81
|
// CONCATENATED MODULE: external "react"
|
|
82
82
|
const n = require("react");
|
|
@@ -87,27 +87,25 @@
|
|
|
87
87
|
const i = require("prop-types");
|
|
88
88
|
var a = e.n(i);
|
|
89
89
|
// CONCATENATED MODULE: external "lodash/includes"
|
|
90
|
-
const
|
|
91
|
-
var
|
|
90
|
+
const l = require("lodash/includes");
|
|
91
|
+
var c = e.n(l);
|
|
92
92
|
// CONCATENATED MODULE: external "lodash/last"
|
|
93
|
-
const
|
|
94
|
-
var s = e.n(
|
|
93
|
+
const u = require("lodash/last");
|
|
94
|
+
var s = e.n(u);
|
|
95
95
|
// CONCATENATED MODULE: external "lodash/pull"
|
|
96
96
|
const p = require("lodash/pull");
|
|
97
97
|
var f = e.n(p);
|
|
98
|
-
// CONCATENATED MODULE: external "@splunk/ui-utils/keyboard"
|
|
99
|
-
const y = require("@splunk/ui-utils/keyboard");
|
|
100
98
|
// CONCATENATED MODULE: external "@splunk/react-ui/EventListener"
|
|
101
|
-
const
|
|
102
|
-
var
|
|
99
|
+
const y = require("@splunk/react-ui/EventListener");
|
|
100
|
+
var d = e.n(y);
|
|
103
101
|
// CONCATENATED MODULE: ./src/Layer/LayerStack.tsx
|
|
104
102
|
/**
|
|
105
103
|
* `LayerStackContext` is used to manage the array that `Layer` (and components that
|
|
106
104
|
* depend on it, such as `Modal`) uses to determine the order of open layers.
|
|
107
105
|
* @public
|
|
108
106
|
*/
|
|
109
|
-
var
|
|
110
|
-
var
|
|
107
|
+
var v = r().createContext([]);
|
|
108
|
+
var h = r().createContext({});
|
|
111
109
|
var m = {
|
|
112
110
|
children: a().node,
|
|
113
111
|
name: a().string,
|
|
@@ -119,10 +117,10 @@
|
|
|
119
117
|
* A `LayerStackContext` provider that stores a shared layer stack using a global variable.
|
|
120
118
|
* Applications should only use this provider if there's a known need to support multiple
|
|
121
119
|
* instances of this library on the same page.
|
|
122
|
-
*/ function
|
|
123
|
-
var o = t.children, i = t.name, a = i === void 0 ? "__splunkui_layer_instances__" : i,
|
|
124
|
-
if (!
|
|
125
|
-
|
|
120
|
+
*/ function b(t) {
|
|
121
|
+
var o = t.children, i = t.name, a = i === void 0 ? "__splunkui_layer_instances__" : i, l = t.scope, c = l === void 0 ? typeof window !== "undefined" ? window : e.g : l, u = t.separateStackingContexts, s = u === void 0 ? false : u;
|
|
122
|
+
if (!c[a]) {
|
|
123
|
+
c[a] = [];
|
|
126
124
|
// eslint-disable-line no-param-reassign
|
|
127
125
|
}
|
|
128
126
|
var p = (0, n.useMemo)((function() {
|
|
@@ -131,29 +129,29 @@
|
|
|
131
129
|
};
|
|
132
130
|
}), [ s ]);
|
|
133
131
|
|
|
134
|
-
return r().createElement(
|
|
135
|
-
value:
|
|
136
|
-
}, r().createElement(
|
|
132
|
+
return r().createElement(v.Provider, {
|
|
133
|
+
value: c[a]
|
|
134
|
+
}, r().createElement(h.Provider, {
|
|
137
135
|
value: p
|
|
138
136
|
}, o));
|
|
139
137
|
}
|
|
140
|
-
|
|
138
|
+
b.propTypes = m;
|
|
141
139
|
// CONCATENATED MODULE: external "styled-components"
|
|
142
|
-
const
|
|
143
|
-
var g = e.n(
|
|
140
|
+
const w = require("styled-components");
|
|
141
|
+
var g = e.n(w);
|
|
144
142
|
// CONCATENATED MODULE: external "@splunk/themes"
|
|
145
143
|
const C = require("@splunk/themes");
|
|
146
144
|
// CONCATENATED MODULE: ./src/Layer/LayerStyles.ts
|
|
147
|
-
var
|
|
145
|
+
var k = g().div.withConfig({
|
|
148
146
|
displayName: "LayerStyles__StyledLayer",
|
|
149
147
|
componentId: "ii6psl-0"
|
|
150
148
|
})([ "", "" ], (function(e) {
|
|
151
149
|
var t = e.$separateStackingContexts;
|
|
152
|
-
return t && (0,
|
|
150
|
+
return t && (0, w.css)([ "isolation:isolate;z-index:", ";" ], C.variables.zindexLayer);
|
|
153
151
|
}));
|
|
154
152
|
// CONCATENATED MODULE: ./src/utils/ssrDocument.ts
|
|
155
153
|
/* eslint-disable @typescript-eslint/no-empty-function */
|
|
156
|
-
var
|
|
154
|
+
var S = {
|
|
157
155
|
body: {
|
|
158
156
|
appendChild: function e() {
|
|
159
157
|
return [];
|
|
@@ -208,34 +206,34 @@
|
|
|
208
206
|
}
|
|
209
207
|
};
|
|
210
208
|
function E() {
|
|
211
|
-
var e = typeof document !== "undefined" ? document :
|
|
209
|
+
var e = typeof document !== "undefined" ? document : S;
|
|
212
210
|
return e;
|
|
213
211
|
}
|
|
214
212
|
// CONCATENATED MODULE: ./src/Layer/Layer.tsx
|
|
215
|
-
function
|
|
213
|
+
function O(e) {
|
|
216
214
|
"@babel/helpers - typeof";
|
|
217
|
-
return
|
|
215
|
+
return O = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) {
|
|
218
216
|
return typeof e;
|
|
219
217
|
} : function(e) {
|
|
220
218
|
return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
|
|
221
|
-
},
|
|
219
|
+
}, O(e);
|
|
222
220
|
}
|
|
223
|
-
function
|
|
221
|
+
function j(e, t) {
|
|
224
222
|
if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function");
|
|
225
223
|
}
|
|
226
|
-
function
|
|
224
|
+
function L(e, t) {
|
|
227
225
|
for (var n = 0; n < t.length; n++) {
|
|
228
226
|
var r = t[n];
|
|
229
227
|
r.enumerable = r.enumerable || !1, r.configurable = !0, "value" in r && (r.writable = !0),
|
|
230
|
-
Object.defineProperty(e,
|
|
228
|
+
Object.defineProperty(e, A(r.key), r);
|
|
231
229
|
}
|
|
232
230
|
}
|
|
233
|
-
function
|
|
234
|
-
return t &&
|
|
231
|
+
function P(e, t, n) {
|
|
232
|
+
return t && L(e.prototype, t), n && L(e, n), Object.defineProperty(e, "prototype", {
|
|
235
233
|
writable: !1
|
|
236
234
|
}), e;
|
|
237
235
|
}
|
|
238
|
-
function
|
|
236
|
+
function _(e, t) {
|
|
239
237
|
if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function");
|
|
240
238
|
e.prototype = Object.create(t && t.prototype, {
|
|
241
239
|
constructor: {
|
|
@@ -245,103 +243,101 @@
|
|
|
245
243
|
}
|
|
246
244
|
}), Object.defineProperty(e, "prototype", {
|
|
247
245
|
writable: !1
|
|
248
|
-
}), t &&
|
|
246
|
+
}), t && T(e, t);
|
|
249
247
|
}
|
|
250
|
-
function
|
|
251
|
-
return
|
|
248
|
+
function T(e, t) {
|
|
249
|
+
return T = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(e, t) {
|
|
252
250
|
return e.__proto__ = t, e;
|
|
253
|
-
},
|
|
251
|
+
}, T(e, t);
|
|
254
252
|
}
|
|
255
|
-
function
|
|
256
|
-
var t =
|
|
253
|
+
function x(e) {
|
|
254
|
+
var t = D();
|
|
257
255
|
return function() {
|
|
258
|
-
var n, r =
|
|
256
|
+
var n, r = M(e);
|
|
259
257
|
if (t) {
|
|
260
|
-
var o =
|
|
258
|
+
var o = M(this).constructor;
|
|
261
259
|
n = Reflect.construct(r, arguments, o);
|
|
262
260
|
} else n = r.apply(this, arguments);
|
|
263
|
-
return
|
|
261
|
+
return q(this, n);
|
|
264
262
|
};
|
|
265
263
|
}
|
|
266
|
-
function
|
|
267
|
-
if (t && ("object" ==
|
|
264
|
+
function q(e, t) {
|
|
265
|
+
if (t && ("object" == O(t) || "function" == typeof t)) return t;
|
|
268
266
|
if (void 0 !== t) throw new TypeError("Derived constructors may only return object or undefined");
|
|
269
|
-
return
|
|
267
|
+
return R(e);
|
|
270
268
|
}
|
|
271
|
-
function
|
|
269
|
+
function R(e) {
|
|
272
270
|
if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
273
271
|
return e;
|
|
274
272
|
}
|
|
275
|
-
function
|
|
273
|
+
function D() {
|
|
276
274
|
try {
|
|
277
275
|
var e = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], (function() {})));
|
|
278
276
|
} catch (e) {}
|
|
279
|
-
return (
|
|
277
|
+
return (D = function t() {
|
|
280
278
|
return !!e;
|
|
281
279
|
})();
|
|
282
280
|
}
|
|
283
|
-
function
|
|
284
|
-
return
|
|
281
|
+
function M(e) {
|
|
282
|
+
return M = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(e) {
|
|
285
283
|
return e.__proto__ || Object.getPrototypeOf(e);
|
|
286
|
-
},
|
|
284
|
+
}, M(e);
|
|
287
285
|
}
|
|
288
|
-
function
|
|
289
|
-
return (t =
|
|
286
|
+
function N(e, t, n) {
|
|
287
|
+
return (t = A(t)) in e ? Object.defineProperty(e, t, {
|
|
290
288
|
value: n,
|
|
291
289
|
enumerable: !0,
|
|
292
290
|
configurable: !0,
|
|
293
291
|
writable: !0
|
|
294
292
|
}) : e[t] = n, e;
|
|
295
293
|
}
|
|
296
|
-
function
|
|
297
|
-
var t =
|
|
298
|
-
return "symbol" ==
|
|
294
|
+
function A(e) {
|
|
295
|
+
var t = K(e, "string");
|
|
296
|
+
return "symbol" == O(t) ? t : t + "";
|
|
299
297
|
}
|
|
300
|
-
function
|
|
301
|
-
if ("object" !=
|
|
298
|
+
function K(e, t) {
|
|
299
|
+
if ("object" != O(e) || !e) return e;
|
|
302
300
|
var n = e[Symbol.toPrimitive];
|
|
303
301
|
if (void 0 !== n) {
|
|
304
302
|
var r = n.call(e, t || "default");
|
|
305
|
-
if ("object" !=
|
|
303
|
+
if ("object" != O(r)) return r;
|
|
306
304
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
307
305
|
}
|
|
308
306
|
return ("string" === t ? String : Number)(e);
|
|
309
307
|
}
|
|
310
308
|
/** @public */
|
|
311
|
-
/** @public */ var
|
|
312
|
-
var
|
|
309
|
+
/** @public */ var W = [ "clickAway", "escapeKey" ];
|
|
310
|
+
var F = {
|
|
313
311
|
children: a().node,
|
|
314
|
-
closeReasons: a().arrayOf(a().oneOf(
|
|
312
|
+
closeReasons: a().arrayOf(a().oneOf(W)),
|
|
315
313
|
onRequestClose: a().func,
|
|
316
314
|
open: a().bool
|
|
317
315
|
};
|
|
318
|
-
var
|
|
319
|
-
closeReasons:
|
|
316
|
+
var B = {
|
|
317
|
+
closeReasons: W,
|
|
320
318
|
open: false
|
|
321
319
|
};
|
|
322
|
-
var
|
|
323
|
-
|
|
324
|
-
var t =
|
|
320
|
+
var z = function(e) {
|
|
321
|
+
_(n, e);
|
|
322
|
+
var t = x(n);
|
|
325
323
|
// @docs-props-type LayerPropsBase
|
|
326
324
|
// eslint-disable-next-line react/sort-comp
|
|
327
325
|
// LayerStackContext (an array) keeps track of the current instances of Layer. This is
|
|
328
326
|
// used by Layer#handleKeyDown to determine if the escapeKey event should be handled by
|
|
329
327
|
// the current instance. Only the topmost Layer instance should honor the escapeKey.
|
|
330
|
-
// TODO: enable once this is sorted out within the babel/ts ecosystem
|
|
331
|
-
// declare context: React.ContextType<typeof LayerStackContext>;
|
|
332
328
|
function n(e) {
|
|
333
329
|
var r;
|
|
334
|
-
|
|
330
|
+
j(this, n);
|
|
335
331
|
r = t.call(this, e);
|
|
336
|
-
|
|
337
|
-
|
|
332
|
+
N(R(r), "layerClickEvent", null);
|
|
333
|
+
N(R(r), "handleClickOnLayer", (function(e) {
|
|
338
334
|
var t = e.nativeEvent;
|
|
339
335
|
r.layerClickEvent = t;
|
|
340
336
|
}));
|
|
341
|
-
|
|
337
|
+
N(R(r), "handleClickOnWindow", (function(e) {
|
|
342
338
|
var t, n;
|
|
343
339
|
// clicks inside the layer should not be considered clickAways
|
|
344
|
-
if (!r.props.open || !
|
|
340
|
+
if (!r.props.open || !c()(r.props.closeReasons, "clickAway") || r.layerClickEvent === e) {
|
|
345
341
|
return;
|
|
346
342
|
}
|
|
347
343
|
(t = (n = r.props).onRequestClose) === null || t === void 0 ? void 0 : t.call(n, {
|
|
@@ -349,8 +345,8 @@
|
|
|
349
345
|
reason: "clickAway"
|
|
350
346
|
});
|
|
351
347
|
}));
|
|
352
|
-
|
|
353
|
-
if (r.props.open &&
|
|
348
|
+
N(R(r), "handleKeyDownOnWindow", (function(e) {
|
|
349
|
+
if (r.props.open && e.key === "Escape" && s()(r.getLayerStack()) === R(r) && c()(r.props.closeReasons, "escapeKey")) {
|
|
354
350
|
var t, n;
|
|
355
351
|
(t = (n = r.props).onRequestClose) === null || t === void 0 ? void 0 : t.call(n, {
|
|
356
352
|
event: e,
|
|
@@ -366,7 +362,7 @@
|
|
|
366
362
|
}
|
|
367
363
|
return r;
|
|
368
364
|
}
|
|
369
|
-
|
|
365
|
+
P(n, [ {
|
|
370
366
|
key: "componentDidMount",
|
|
371
367
|
value: function e() {
|
|
372
368
|
if (this.props.open) {
|
|
@@ -392,16 +388,25 @@
|
|
|
392
388
|
value: function e() {
|
|
393
389
|
return this.context;
|
|
394
390
|
}
|
|
395
|
-
|
|
391
|
+
// the fullscreen API does not render elements outside the fullscreen element
|
|
392
|
+
// Layer renders in document.body, which means that anything using Layer will not render in fullscreen
|
|
393
|
+
// this code moves the layer container into the fullscreen element, ensuring that it will render
|
|
394
|
+
}, {
|
|
396
395
|
key: "render",
|
|
397
396
|
value: function e() {
|
|
398
397
|
var t = this;
|
|
399
|
-
var i = this.props, a = i.children,
|
|
400
|
-
|
|
401
|
-
|
|
398
|
+
var i = this.props, a = i.children, l = i.open;
|
|
399
|
+
var c = r().createElement(d(), {
|
|
400
|
+
target: window,
|
|
401
|
+
eventType: "fullscreenchange",
|
|
402
|
+
listener: n.handleFullScreenChange,
|
|
403
|
+
key: "fullScreenChange"
|
|
404
|
+
});
|
|
405
|
+
if (l) {
|
|
406
|
+
var u = (0, o.createPortal)( r().createElement(h.Consumer, null, (function(e) {
|
|
402
407
|
var n = e.separateStackingContexts, o = n === void 0 ? false : n;
|
|
403
408
|
|
|
404
|
-
return r().createElement(
|
|
409
|
+
return r().createElement(k, {
|
|
405
410
|
$separateStackingContexts: o,
|
|
406
411
|
"data-test": "layer",
|
|
407
412
|
onMouseDown: t.handleClickOnLayer,
|
|
@@ -409,17 +414,17 @@
|
|
|
409
414
|
}, a);
|
|
410
415
|
})), n.layerContainer);
|
|
411
416
|
|
|
412
|
-
return r().createElement(r().Fragment, null, r().createElement(
|
|
417
|
+
return r().createElement(r().Fragment, null, r().createElement(d(), {
|
|
413
418
|
target: window,
|
|
414
419
|
eventType: "keydown",
|
|
415
420
|
listener: this.handleKeyDownOnWindow,
|
|
416
421
|
key: "eventListenerKeydown"
|
|
417
|
-
}), r().createElement(
|
|
422
|
+
}), r().createElement(d(), {
|
|
418
423
|
target: window,
|
|
419
424
|
eventType: "mousedown",
|
|
420
425
|
listener: this.handleClickOnWindow,
|
|
421
426
|
key: "eventListenerMouseDown"
|
|
422
|
-
}), r().createElement(
|
|
427
|
+
}), r().createElement(d(), {
|
|
423
428
|
target: window,
|
|
424
429
|
eventType: "touchstart",
|
|
425
430
|
listener: this.handleClickOnWindow,
|
|
@@ -427,19 +432,32 @@
|
|
|
427
432
|
options: {
|
|
428
433
|
passive: true
|
|
429
434
|
}
|
|
430
|
-
}), u);
|
|
435
|
+
}), c, u);
|
|
431
436
|
}
|
|
432
|
-
|
|
437
|
+
// the fragment has to be present to avoid type issues with React 18
|
|
438
|
+
// eslint-disable-next-line react/jsx-no-useless-fragment
|
|
439
|
+
|
|
440
|
+
return r().createElement(r().Fragment, null, c);
|
|
433
441
|
}
|
|
434
442
|
} ]);
|
|
435
443
|
return n;
|
|
436
444
|
}(n.Component);
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
445
|
+
N(z, "layerContainer", null);
|
|
446
|
+
N(z, "possibleCloseReasons", W);
|
|
447
|
+
N(z, "propTypes", F);
|
|
448
|
+
N(z, "defaultProps", B);
|
|
449
|
+
N(z, "contextType", v);
|
|
450
|
+
N(z, "handleFullScreenChange", (function() {
|
|
451
|
+
if (z.layerContainer) {
|
|
452
|
+
var e = E();
|
|
453
|
+
if (e.fullscreenElement != null) {
|
|
454
|
+
e.fullscreenElement.appendChild(z.layerContainer);
|
|
455
|
+
} else {
|
|
456
|
+
e.body.appendChild(z.layerContainer);
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
}));
|
|
460
|
+
/* harmony default export */ const I = z;
|
|
443
461
|
// CONCATENATED MODULE: ./src/Layer/index.ts
|
|
444
462
|
module.exports = t;
|
|
445
463
|
/******/})();
|