@splunk/react-ui 5.7.0 → 5.8.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/Accordion.js +6 -6
- package/Box.js +83 -34
- package/CHANGELOG.md +34 -0
- package/CollapsiblePanel.js +11 -11
- package/ComboBox.js +31 -27
- package/ControlGroup.js +92 -91
- package/DefinitionList.js +9 -9
- package/Drawer.d.ts +2 -0
- package/Drawer.js +679 -0
- package/DualListbox.js +1 -1
- package/JSONTree.js +73 -72
- package/Link.js +2 -2
- package/MIGRATION.md +10 -0
- package/Menu.js +338 -240
- package/Modal.js +127 -109
- package/Multiselect.js +437 -351
- package/Paginator.js +14 -12
- package/Popover.js +4 -1
- package/README.md +11 -0
- package/RadioBar.js +1 -1
- package/Search.js +103 -88
- package/Select.js +42 -40
- package/SelectBase.js +374 -328
- package/SidePanel.js +346 -167
- package/SlidingPanels.js +11 -11
- package/StepBar.js +7 -7
- package/Switch.js +5 -5
- package/Text.js +24 -24
- package/TextArea.js +7 -7
- package/TransitionOpen.js +204 -185
- package/docs-llm/Accordion.md +267 -0
- package/docs-llm/Anchor Menu.md +115 -0
- package/docs-llm/Anchor.md +54 -0
- package/docs-llm/AnimationToggle.md +254 -0
- package/docs-llm/Avatar.md +298 -0
- package/docs-llm/Badge.md +212 -0
- package/docs-llm/Breadcrumbs.md +306 -0
- package/docs-llm/Button Group.md +53 -0
- package/docs-llm/Button.md +361 -0
- package/docs-llm/Card Layout.md +286 -0
- package/docs-llm/Card.md +619 -0
- package/docs-llm/Checkbox.md +218 -0
- package/docs-llm/Chip.md +291 -0
- package/docs-llm/Clickable.md +160 -0
- package/docs-llm/Code.md +292 -0
- package/docs-llm/Collapsible Panel.md +744 -0
- package/docs-llm/Color.md +253 -0
- package/docs-llm/Column Layout.md +391 -0
- package/docs-llm/Combo Box.md +540 -0
- package/docs-llm/Control Group.md +594 -0
- package/docs-llm/Date.md +270 -0
- package/docs-llm/Definition List.md +278 -0
- package/docs-llm/Divider.md +216 -0
- package/docs-llm/Drawer.md +414 -0
- package/docs-llm/Dropdown.md +472 -0
- package/docs-llm/Dual Listbox.md +325 -0
- package/docs-llm/File.md +653 -0
- package/docs-llm/Form Rows.md +374 -0
- package/docs-llm/Heading.md +179 -0
- package/docs-llm/Image.md +109 -0
- package/docs-llm/JSON Tree.md +260 -0
- package/docs-llm/Layer.md +74 -0
- package/docs-llm/Layout.md +50 -0
- package/docs-llm/Link.md +318 -0
- package/docs-llm/List.md +189 -0
- package/docs-llm/Markdown.md +179 -0
- package/docs-llm/Menu.md +735 -0
- package/docs-llm/Message Bar.md +236 -0
- package/docs-llm/Message.md +248 -0
- package/docs-llm/Modal.md +443 -0
- package/docs-llm/Monogram.md +159 -0
- package/docs-llm/Multiselect.md +937 -0
- package/docs-llm/Number.md +298 -0
- package/docs-llm/Paginator.md +395 -0
- package/docs-llm/Paragraph.md +148 -0
- package/docs-llm/Phone Number.md +254 -0
- package/docs-llm/Popover.md +166 -0
- package/docs-llm/Progress.md +141 -0
- package/docs-llm/Radio Bar.md +303 -0
- package/docs-llm/Radio List.md +350 -0
- package/docs-llm/Resize.md +362 -0
- package/docs-llm/Screen Reader Content.md +73 -0
- package/docs-llm/Scroll Container Context.md +155 -0
- package/docs-llm/Scroll.md +152 -0
- package/docs-llm/Search.md +381 -0
- package/docs-llm/Select.md +985 -0
- package/docs-llm/Side Panel.md +777 -0
- package/docs-llm/Slider.md +339 -0
- package/docs-llm/Sliding Panels.md +340 -0
- package/docs-llm/Split Button.md +295 -0
- package/docs-llm/Static Content.md +90 -0
- package/docs-llm/Step Bar.md +292 -0
- package/docs-llm/Switch.md +268 -0
- package/docs-llm/Tab Bar.md +439 -0
- package/docs-llm/Tab Layout.md +398 -0
- package/docs-llm/Table.md +2642 -0
- package/docs-llm/Text Area.md +253 -0
- package/docs-llm/Text.md +339 -0
- package/docs-llm/Tooltip.md +325 -0
- package/docs-llm/Transition Open.md +406 -0
- package/docs-llm/Tree.md +586 -0
- package/docs-llm/Typography.md +125 -0
- package/docs-llm/Wait Spinner.md +121 -0
- package/docs-llm/llms.txt +97 -0
- package/package.json +6 -5
- package/types/src/Box/Box.d.ts +2 -10
- package/types/src/Drawer/Body.d.ts +17 -0
- package/types/src/Drawer/Drawer.d.ts +114 -0
- package/types/src/Drawer/DrawerContext.d.ts +11 -0
- package/types/src/Drawer/Footer.d.ts +25 -0
- package/types/src/Drawer/Header.d.ts +41 -0
- package/types/src/Drawer/docs/examples/Basic.d.ts +6 -0
- package/types/src/Drawer/docs/examples/ContainerPosition.d.ts +7 -0
- package/types/src/Drawer/docs/examples/InitialFocus.d.ts +9 -0
- package/types/src/Drawer/docs/examples/InlinePosition.d.ts +7 -0
- package/types/src/Drawer/docs/examples/PagePosition.d.ts +7 -0
- package/types/src/Drawer/index.d.ts +2 -0
- package/types/src/JSONTree/JSONTree.d.ts +12 -5
- package/types/src/JSONTree/renderTreeItems.d.ts +2 -1
- package/types/src/Menu/Item.d.ts +2 -1
- package/types/src/Menu/docs/examples/SelectableCheckbox.d.ts +7 -0
- package/types/src/Modal/Modal.d.ts +1 -2
- package/types/src/Select/Option.d.ts +6 -3
- package/types/src/Select/Select.d.ts +8 -5
- package/types/src/Select/docs/examples/Dimmed.d.ts +7 -0
- package/types/src/SelectBase/OptionBase.d.ts +6 -3
- package/types/src/SelectBase/SelectBase.d.ts +8 -3
- package/types/src/SidePanel/SidePanel.d.ts +43 -2
- package/types/src/SidePanel/docs/examples/DockLayout.d.ts +17 -0
- package/types/src/SidePanel/docs/examples/InitialFocus.d.ts +9 -0
- package/types/src/TransitionOpen/TransitionOpen.d.ts +29 -4
- package/types/src/useKeyPress/index.d.ts +9 -2
- package/types/src/useOnClickOutside/index.d.ts +2 -0
- package/types/src/useOnClickOutside/useOnClickOutside.d.ts +4 -0
- package/useKeyPress.js +23 -18
- package/useOnClickOutside.d.ts +2 -0
- package/useOnClickOutside.js +79 -0
- package/types/src/RadioList/docs/examples/Row.d.ts +0 -6
package/SidePanel.js
CHANGED
|
@@ -9,26 +9,26 @@
|
|
|
9
9
|
/******/ (() => {
|
|
10
10
|
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
|
11
11
|
/******/ e.n = t => {
|
|
12
|
-
/******/ var
|
|
12
|
+
/******/ var n = t && t.__esModule ?
|
|
13
13
|
/******/ () => t["default"]
|
|
14
14
|
/******/ : () => t
|
|
15
15
|
/******/;
|
|
16
|
-
e.d(
|
|
17
|
-
a:
|
|
16
|
+
e.d(n, {
|
|
17
|
+
a: n
|
|
18
18
|
});
|
|
19
|
-
/******/ return
|
|
19
|
+
/******/ return n;
|
|
20
20
|
/******/ };
|
|
21
21
|
/******/ })();
|
|
22
22
|
/******/
|
|
23
23
|
/******/ /* webpack/runtime/define property getters */
|
|
24
24
|
/******/ (() => {
|
|
25
25
|
/******/ // define getter functions for harmony exports
|
|
26
|
-
/******/ e.d = (t,
|
|
27
|
-
/******/ for (var
|
|
28
|
-
/******/ if (e.o(
|
|
29
|
-
/******/ Object.defineProperty(t,
|
|
26
|
+
/******/ e.d = (t, n) => {
|
|
27
|
+
/******/ for (var r in n) {
|
|
28
|
+
/******/ if (e.o(n, r) && !e.o(t, r)) {
|
|
29
|
+
/******/ Object.defineProperty(t, r, {
|
|
30
30
|
enumerable: true,
|
|
31
|
-
get: r
|
|
31
|
+
get: n[r]
|
|
32
32
|
});
|
|
33
33
|
/******/ }
|
|
34
34
|
/******/ }
|
|
@@ -61,220 +61,380 @@
|
|
|
61
61
|
e.r(t);
|
|
62
62
|
// EXPORTS
|
|
63
63
|
e.d(t, {
|
|
64
|
-
default: () => /* reexport */
|
|
64
|
+
default: () => /* reexport */ Q
|
|
65
65
|
});
|
|
66
66
|
// CONCATENATED MODULE: external "react"
|
|
67
|
-
const
|
|
68
|
-
var
|
|
69
|
-
// CONCATENATED MODULE: external "
|
|
70
|
-
const o = require("
|
|
67
|
+
const n = require("react");
|
|
68
|
+
var r = e.n(n);
|
|
69
|
+
// CONCATENATED MODULE: external "lodash/defer"
|
|
70
|
+
const o = require("lodash/defer");
|
|
71
71
|
var i = e.n(o);
|
|
72
|
+
// CONCATENATED MODULE: external "prop-types"
|
|
73
|
+
const u = require("prop-types");
|
|
74
|
+
var a = e.n(u);
|
|
72
75
|
// CONCATENATED MODULE: external "@splunk/react-ui/ModalLayer"
|
|
73
|
-
const
|
|
74
|
-
var
|
|
76
|
+
const l = require("@splunk/react-ui/ModalLayer");
|
|
77
|
+
var c = e.n(l);
|
|
75
78
|
// CONCATENATED MODULE: external "@splunk/react-ui/usePrevious"
|
|
76
|
-
const
|
|
77
|
-
var s = e.n(
|
|
79
|
+
const f = require("@splunk/react-ui/usePrevious");
|
|
80
|
+
var s = e.n(f);
|
|
78
81
|
// CONCATENATED MODULE: external "styled-components"
|
|
79
|
-
const
|
|
80
|
-
var f = e.n(c);
|
|
81
|
-
// CONCATENATED MODULE: external "@splunk/react-ui/TransitionOpen"
|
|
82
|
-
const y = require("@splunk/react-ui/TransitionOpen");
|
|
82
|
+
const y = require("styled-components");
|
|
83
83
|
var d = e.n(y);
|
|
84
|
+
// CONCATENATED MODULE: external "@splunk/react-ui/TransitionOpen"
|
|
85
|
+
const v = require("@splunk/react-ui/TransitionOpen");
|
|
86
|
+
var p = e.n(v);
|
|
84
87
|
// CONCATENATED MODULE: external "@splunk/themes"
|
|
85
|
-
const
|
|
88
|
+
const b = require("@splunk/themes");
|
|
86
89
|
// CONCATENATED MODULE: ./src/SidePanel/SidePanelStyles.ts
|
|
87
|
-
var m =
|
|
88
|
-
|
|
90
|
+
var m = {
|
|
91
|
+
inline: "auto",
|
|
92
|
+
container: "100%",
|
|
93
|
+
page: "100vw"
|
|
94
|
+
};
|
|
95
|
+
var g = {
|
|
96
|
+
inline: "auto",
|
|
97
|
+
container: "100%",
|
|
98
|
+
page: "100vh"
|
|
99
|
+
};
|
|
100
|
+
var S = {
|
|
101
|
+
inline: "static",
|
|
102
|
+
container: "absolute",
|
|
103
|
+
page: "fixed"
|
|
104
|
+
};
|
|
105
|
+
var h = {
|
|
106
|
+
inline: "auto",
|
|
107
|
+
container: b.variables.zindexLayer,
|
|
108
|
+
page: b.variables.zindexModal
|
|
109
|
+
};
|
|
110
|
+
var O = (0, y.css)([ "", " position:", ";flex-direction:column;", " background-color:", ";z-index:", ";" ], b.mixins.reset("flex"), (function(e) {
|
|
111
|
+
var t = e.$dockLayout;
|
|
112
|
+
return S[t];
|
|
113
|
+
}), (function(e) {
|
|
114
|
+
var t = e.$dockLayout;
|
|
115
|
+
return t !== "inline" && (0, y.css)([ "box-shadow:", ";" ], b.variables.overlayShadow);
|
|
116
|
+
}), b.variables.backgroundColorSidebar, (function(e) {
|
|
117
|
+
var t = e.$dockLayout;
|
|
118
|
+
return h[t];
|
|
119
|
+
}));
|
|
120
|
+
var P = d()(p()).withConfig({
|
|
89
121
|
displayName: "SidePanelStyles__StyledLeftPanelTransitionOpen",
|
|
90
122
|
componentId: "mtbcuz-0"
|
|
91
|
-
})([ "", ";top:0;left:0;height:
|
|
92
|
-
|
|
123
|
+
})([ "", ";top:0;left:0;height:", ";" ], O, (function(e) {
|
|
124
|
+
var t = e.$dockLayout;
|
|
125
|
+
return g[t];
|
|
126
|
+
}));
|
|
127
|
+
var j = d()(p()).withConfig({
|
|
93
128
|
displayName: "SidePanelStyles__StyledRightPanelTransitionOpen",
|
|
94
129
|
componentId: "mtbcuz-1"
|
|
95
|
-
})([ "", ";right:0;top:0;height:
|
|
96
|
-
|
|
130
|
+
})([ "", ";right:0;top:0;height:", ";" ], O, (function(e) {
|
|
131
|
+
var t = e.$dockLayout;
|
|
132
|
+
return g[t];
|
|
133
|
+
}));
|
|
134
|
+
var k = d()(p()).withConfig({
|
|
97
135
|
displayName: "SidePanelStyles__StyledTopPanelTransitionOpen",
|
|
98
136
|
componentId: "mtbcuz-2"
|
|
99
|
-
})([ "", ";top:0;left:0;width:
|
|
100
|
-
|
|
137
|
+
})([ "", ";top:0;left:0;width:", ";" ], O, (function(e) {
|
|
138
|
+
var t = e.$dockLayout;
|
|
139
|
+
return m[t];
|
|
140
|
+
}));
|
|
141
|
+
var w = d()(p()).withConfig({
|
|
101
142
|
displayName: "SidePanelStyles__StyledBottomPanelTransitionOpen",
|
|
102
143
|
componentId: "mtbcuz-3"
|
|
103
|
-
})([ "", ";left:0;bottom:0;width:
|
|
144
|
+
})([ "", ";left:0;bottom:0;width:", ";" ], O, (function(e) {
|
|
145
|
+
var t = e.$dockLayout;
|
|
146
|
+
return m[t];
|
|
147
|
+
}));
|
|
148
|
+
// CONCATENATED MODULE: external "@splunk/ui-utils/focus"
|
|
149
|
+
const C = require("@splunk/ui-utils/focus");
|
|
150
|
+
// CONCATENATED MODULE: ./src/utils/resolveInitialFocusTarget.ts
|
|
151
|
+
function T(e) {
|
|
152
|
+
"@babel/helpers - typeof";
|
|
153
|
+
return T = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) {
|
|
154
|
+
return typeof e;
|
|
155
|
+
} : function(e) {
|
|
156
|
+
return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
|
|
157
|
+
}, T(e)
|
|
158
|
+
/**
|
|
159
|
+
* Resolves the initial focus target based on the initialFocus prop value.
|
|
160
|
+
*
|
|
161
|
+
* @param initialFocus - The initialFocus prop value ('first', 'container', HTMLElement, or React.Component with focus method)
|
|
162
|
+
* @param containerEl - The container element to use for 'first' and 'container' options
|
|
163
|
+
* @returns The element or component to focus, or null if none found
|
|
164
|
+
*/;
|
|
165
|
+
}
|
|
166
|
+
function L(e, t) {
|
|
167
|
+
if (e === "first" && t) {
|
|
168
|
+
var n;
|
|
169
|
+
return (n = (0, C.getSortedTabbableElements)(t)[0]) !== null && n !== void 0 ? n : null;
|
|
170
|
+
}
|
|
171
|
+
if (e === "container") {
|
|
172
|
+
return t;
|
|
173
|
+
}
|
|
174
|
+
if (T(e) === "object") {
|
|
175
|
+
return e;
|
|
176
|
+
}
|
|
177
|
+
return null;
|
|
178
|
+
}
|
|
179
|
+
// CONCATENATED MODULE: ./src/utils/updateReactRef.ts
|
|
180
|
+
/**
|
|
181
|
+
* Updates a React ref. Callback refs and object refs (from `createRef` and `useRef`) are supported.
|
|
182
|
+
*
|
|
183
|
+
* @param ref - The React callback or object ref. Can be `null` or `undefined`.
|
|
184
|
+
* @param current - The new value of the ref.
|
|
185
|
+
*/
|
|
186
|
+
function E(e, t) {
|
|
187
|
+
if (e) {
|
|
188
|
+
if (typeof e === "function") {
|
|
189
|
+
e(t);
|
|
190
|
+
} else {
|
|
191
|
+
// the public signature of this util uses React.Ref<T> to mirror the way React types refs.
|
|
192
|
+
// the intention here is to signal "we will take care of setting 'current', not you".
|
|
193
|
+
e.current = t;
|
|
194
|
+
// eslint-disable-line no-param-reassign
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
}
|
|
104
198
|
// CONCATENATED MODULE: ./src/SidePanel/SidePanel.tsx
|
|
105
|
-
function
|
|
199
|
+
function A(e) {
|
|
106
200
|
"@babel/helpers - typeof";
|
|
107
|
-
return
|
|
201
|
+
return A = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) {
|
|
108
202
|
return typeof e;
|
|
109
203
|
} : function(e) {
|
|
110
204
|
return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
|
|
111
|
-
},
|
|
205
|
+
}, A(e);
|
|
112
206
|
}
|
|
113
|
-
function
|
|
114
|
-
return
|
|
207
|
+
function F() {
|
|
208
|
+
return F = Object.assign ? Object.assign.bind() : function(e) {
|
|
115
209
|
for (var t = 1; t < arguments.length; t++) {
|
|
116
|
-
var
|
|
117
|
-
for (var
|
|
118
|
-
({}).hasOwnProperty.call(
|
|
210
|
+
var n = arguments[t];
|
|
211
|
+
for (var r in n) {
|
|
212
|
+
({}).hasOwnProperty.call(n, r) && (e[r] = n[r]);
|
|
119
213
|
}
|
|
120
214
|
}
|
|
121
215
|
return e;
|
|
122
|
-
},
|
|
216
|
+
}, F.apply(null, arguments);
|
|
123
217
|
}
|
|
124
|
-
function
|
|
125
|
-
var
|
|
218
|
+
function _(e, t) {
|
|
219
|
+
var n = Object.keys(e);
|
|
126
220
|
if (Object.getOwnPropertySymbols) {
|
|
127
|
-
var
|
|
128
|
-
t && (
|
|
221
|
+
var r = Object.getOwnPropertySymbols(e);
|
|
222
|
+
t && (r = r.filter((function(t) {
|
|
129
223
|
return Object.getOwnPropertyDescriptor(e, t).enumerable;
|
|
130
|
-
}))),
|
|
224
|
+
}))), n.push.apply(n, r);
|
|
131
225
|
}
|
|
132
|
-
return
|
|
226
|
+
return n;
|
|
133
227
|
}
|
|
134
|
-
function
|
|
228
|
+
function M(e) {
|
|
135
229
|
for (var t = 1; t < arguments.length; t++) {
|
|
136
|
-
var
|
|
137
|
-
t % 2 ?
|
|
138
|
-
|
|
139
|
-
})) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(
|
|
140
|
-
Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(
|
|
230
|
+
var n = null != arguments[t] ? arguments[t] : {};
|
|
231
|
+
t % 2 ? _(Object(n), !0).forEach((function(t) {
|
|
232
|
+
N(e, t, n[t]);
|
|
233
|
+
})) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(n)) : _(Object(n)).forEach((function(t) {
|
|
234
|
+
Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(n, t));
|
|
141
235
|
}));
|
|
142
236
|
}
|
|
143
237
|
return e;
|
|
144
238
|
}
|
|
145
|
-
function
|
|
146
|
-
return (t =
|
|
147
|
-
value:
|
|
239
|
+
function N(e, t, n) {
|
|
240
|
+
return (t = R(t)) in e ? Object.defineProperty(e, t, {
|
|
241
|
+
value: n,
|
|
148
242
|
enumerable: !0,
|
|
149
243
|
configurable: !0,
|
|
150
244
|
writable: !0
|
|
151
|
-
}) : e[t] =
|
|
245
|
+
}) : e[t] = n, e;
|
|
152
246
|
}
|
|
153
|
-
function
|
|
154
|
-
var t =
|
|
155
|
-
return "symbol" ==
|
|
247
|
+
function R(e) {
|
|
248
|
+
var t = q(e, "string");
|
|
249
|
+
return "symbol" == A(t) ? t : t + "";
|
|
156
250
|
}
|
|
157
|
-
function
|
|
158
|
-
if ("object" !=
|
|
159
|
-
var
|
|
160
|
-
if (void 0 !==
|
|
161
|
-
var
|
|
162
|
-
if ("object" !=
|
|
251
|
+
function q(e, t) {
|
|
252
|
+
if ("object" != A(e) || !e) return e;
|
|
253
|
+
var n = e[Symbol.toPrimitive];
|
|
254
|
+
if (void 0 !== n) {
|
|
255
|
+
var r = n.call(e, t || "default");
|
|
256
|
+
if ("object" != A(r)) return r;
|
|
163
257
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
164
258
|
}
|
|
165
259
|
return ("string" === t ? String : Number)(e);
|
|
166
260
|
}
|
|
167
|
-
function
|
|
168
|
-
return
|
|
261
|
+
function x(e, t) {
|
|
262
|
+
return B(e) || D(e, t) || $(e, t) || I();
|
|
169
263
|
}
|
|
170
|
-
function
|
|
264
|
+
function I() {
|
|
171
265
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
172
266
|
}
|
|
173
|
-
function
|
|
267
|
+
function $(e, t) {
|
|
174
268
|
if (e) {
|
|
175
|
-
if ("string" == typeof e) return
|
|
176
|
-
var
|
|
177
|
-
return "Object" ===
|
|
269
|
+
if ("string" == typeof e) return z(e, t);
|
|
270
|
+
var n = {}.toString.call(e).slice(8, -1);
|
|
271
|
+
return "Object" === n && e.constructor && (n = e.constructor.name), "Map" === n || "Set" === n ? Array.from(e) : "Arguments" === n || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n) ? z(e, t) : void 0;
|
|
178
272
|
}
|
|
179
273
|
}
|
|
180
|
-
function
|
|
274
|
+
function z(e, t) {
|
|
181
275
|
(null == t || t > e.length) && (t = e.length);
|
|
182
|
-
for (var
|
|
183
|
-
n
|
|
276
|
+
for (var n = 0, r = Array(t); n < t; n++) {
|
|
277
|
+
r[n] = e[n];
|
|
184
278
|
}
|
|
185
|
-
return
|
|
279
|
+
return r;
|
|
186
280
|
}
|
|
187
|
-
function
|
|
188
|
-
var
|
|
189
|
-
if (null !=
|
|
190
|
-
var
|
|
281
|
+
function D(e, t) {
|
|
282
|
+
var n = null == e ? null : "undefined" != typeof Symbol && e[Symbol.iterator] || e["@@iterator"];
|
|
283
|
+
if (null != n) {
|
|
284
|
+
var r, o, i, u, a = [], l = !0, c = !1;
|
|
191
285
|
try {
|
|
192
|
-
if (i = (
|
|
193
|
-
if (Object(
|
|
194
|
-
|
|
195
|
-
} else for (;!(
|
|
286
|
+
if (i = (n = n.call(e)).next, 0 === t) {
|
|
287
|
+
if (Object(n) !== n) return;
|
|
288
|
+
l = !1;
|
|
289
|
+
} else for (;!(l = (r = i.call(n)).done) && (a.push(r.value), a.length !== t); l = !0) {
|
|
196
290
|
}
|
|
197
291
|
} catch (e) {
|
|
198
|
-
|
|
292
|
+
c = !0, o = e;
|
|
199
293
|
} finally {
|
|
200
294
|
try {
|
|
201
|
-
if (!
|
|
295
|
+
if (!l && null != n["return"] && (u = n["return"](), Object(u) !== u)) return;
|
|
202
296
|
} finally {
|
|
203
|
-
if (
|
|
297
|
+
if (c) throw o;
|
|
204
298
|
}
|
|
205
299
|
}
|
|
206
|
-
return
|
|
300
|
+
return a;
|
|
207
301
|
}
|
|
208
302
|
}
|
|
209
|
-
function
|
|
303
|
+
function B(e) {
|
|
210
304
|
if (Array.isArray(e)) return e;
|
|
211
305
|
}
|
|
212
|
-
function
|
|
306
|
+
function U(e, t) {
|
|
213
307
|
if (null == e) return {};
|
|
214
|
-
var
|
|
308
|
+
var n, r, o = Y(e, t);
|
|
215
309
|
if (Object.getOwnPropertySymbols) {
|
|
216
310
|
var i = Object.getOwnPropertySymbols(e);
|
|
217
|
-
for (
|
|
218
|
-
|
|
311
|
+
for (r = 0; r < i.length; r++) {
|
|
312
|
+
n = i[r], -1 === t.indexOf(n) && {}.propertyIsEnumerable.call(e, n) && (o[n] = e[n]);
|
|
219
313
|
}
|
|
220
314
|
}
|
|
221
315
|
return o;
|
|
222
316
|
}
|
|
223
|
-
function
|
|
317
|
+
function Y(e, t) {
|
|
224
318
|
if (null == e) return {};
|
|
225
|
-
var
|
|
226
|
-
for (var
|
|
227
|
-
if ({}.hasOwnProperty.call(e,
|
|
228
|
-
if (-1 !== t.indexOf(
|
|
229
|
-
r
|
|
319
|
+
var n = {};
|
|
320
|
+
for (var r in e) {
|
|
321
|
+
if ({}.hasOwnProperty.call(e, r)) {
|
|
322
|
+
if (-1 !== t.indexOf(r)) continue;
|
|
323
|
+
n[r] = e[r];
|
|
230
324
|
}
|
|
231
325
|
}
|
|
232
|
-
return
|
|
326
|
+
return n;
|
|
233
327
|
}
|
|
234
|
-
/** @public */ var
|
|
235
|
-
children:
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
328
|
+
/** @public */ var G = {
|
|
329
|
+
children: a().node,
|
|
330
|
+
dockLayout: a().oneOf([ "page", "container", "inline" ]),
|
|
331
|
+
dockPosition: a().oneOf([ "top", "bottom", "left", "right" ]),
|
|
332
|
+
elementRef: a().oneOfType([ a().func, a().object ]),
|
|
333
|
+
initialFocus: a().oneOfType([ a().object, a().oneOf([ "first", "container" ]) ]),
|
|
334
|
+
innerClassName: a().string,
|
|
335
|
+
innerStyle: a().object,
|
|
336
|
+
onAnimationEnd: a().func,
|
|
337
|
+
onRequestClose: a().func,
|
|
338
|
+
open: a().bool,
|
|
339
|
+
outerClassName: a().string,
|
|
340
|
+
outerStyle: a().object,
|
|
341
|
+
returnFocus: a().oneOfType([ a().func, a().object ]),
|
|
342
|
+
useLayerForClickAway: a().bool
|
|
246
343
|
};
|
|
247
|
-
var
|
|
344
|
+
var H = {
|
|
248
345
|
left: "slideFromLeft",
|
|
249
346
|
right: "slideFromRight",
|
|
250
347
|
top: "slideFromTop",
|
|
251
348
|
bottom: "slideFromBottom"
|
|
252
349
|
};
|
|
253
|
-
var
|
|
254
|
-
left:
|
|
255
|
-
right:
|
|
256
|
-
top:
|
|
257
|
-
bottom:
|
|
350
|
+
var J = {
|
|
351
|
+
left: P,
|
|
352
|
+
right: j,
|
|
353
|
+
top: k,
|
|
354
|
+
bottom: w
|
|
258
355
|
};
|
|
259
|
-
function
|
|
260
|
-
var t = e.children, o = e.
|
|
356
|
+
function K(e) {
|
|
357
|
+
var t = e.children, o = e.dockLayout, u = o === void 0 ? "page" : o, a = e.dockPosition, l = a === void 0 ? "right" : a, f = e.elementRef, y = e.initialFocus, d = e.innerClassName, v = e.innerStyle, p = e.onAnimationEnd, b = e.onRequestClose, m = e.open, g = e.outerClassName, S = e.outerStyle, h = e.returnFocus, O = e.useLayerForClickAway, P = O === void 0 ? true : O, j = U(e, [ "children", "dockLayout", "dockPosition", "elementRef", "initialFocus", "innerClassName", "innerStyle", "onAnimationEnd", "onRequestClose", "open", "outerClassName", "outerStyle", "returnFocus", "useLayerForClickAway" ]);
|
|
261
358
|
// @docs-props-type SidePanelPropsBase
|
|
262
|
-
var
|
|
263
|
-
var
|
|
264
|
-
|
|
359
|
+
var k = (0, n.useRef)(null);
|
|
360
|
+
var w = (0, n.useRef)(undefined);
|
|
361
|
+
// Use symbol to distinguish "never applied" from "applied with undefined/null"
|
|
362
|
+
var C = (0, n.useRef)(Symbol("FOCUS_NOT_YET_APPLIED")).current;
|
|
363
|
+
var T = (0, n.useRef)(C);
|
|
364
|
+
var A = (0, n.useState)(false), _ = x(A, 2), N = _[0], R = _[1];
|
|
365
|
+
var q = s()(m);
|
|
366
|
+
(0, n.useEffect)((function() {
|
|
265
367
|
// prevOpen starts undefined, and we don't want to make the comparison in that situation
|
|
266
|
-
if (
|
|
267
|
-
|
|
368
|
+
if (q != null && m !== q) {
|
|
369
|
+
R(true);
|
|
370
|
+
}
|
|
371
|
+
}), [ m, q ]);
|
|
372
|
+
// Focus handling strategy: consistent across all dockLayouts
|
|
373
|
+
// - If initialFocus is passed, use it
|
|
374
|
+
// - Else use 'first' (first focusable element)
|
|
375
|
+
// - Else use container (fallback when no focusable elements)
|
|
376
|
+
var I = (0, n.useCallback)((function() {
|
|
377
|
+
// Clear pending focus if initialFocus target changed
|
|
378
|
+
var e = y !== null && y !== void 0 ? y : null;
|
|
379
|
+
if (T.current !== e) {
|
|
380
|
+
clearTimeout(w.current);
|
|
381
|
+
}
|
|
382
|
+
// PANEL OPENING: Apply initial focus if needed
|
|
383
|
+
if (m) {
|
|
384
|
+
w.current = i()((function() {
|
|
385
|
+
var e = y !== null && y !== void 0 ? y : "first";
|
|
386
|
+
// Only apply focus if the target changed from last time
|
|
387
|
+
if (T.current !== (e !== null && e !== void 0 ? e : null)) {
|
|
388
|
+
var t, n;
|
|
389
|
+
var r = L(e, k.current);
|
|
390
|
+
// Fall back to container if target has no focus method
|
|
391
|
+
if (!((t = r) === null || t === void 0 ? void 0 : t.focus)) {
|
|
392
|
+
r = k.current;
|
|
393
|
+
}
|
|
394
|
+
// TODO: bug fix https://splunk.atlassian.net/browse/SUI-8621
|
|
395
|
+
(n = r) === null || n === void 0 ? void 0 : n.focus({
|
|
396
|
+
preventScroll: true
|
|
397
|
+
});
|
|
398
|
+
T.current = e !== null && e !== void 0 ? e : null;
|
|
399
|
+
}
|
|
400
|
+
}));
|
|
268
401
|
}
|
|
269
|
-
}), [
|
|
270
|
-
var
|
|
271
|
-
|
|
402
|
+
}), [ m, y ]);
|
|
403
|
+
var $ = (0, n.useCallback)((function() {
|
|
404
|
+
// PANEL CLOSING: Reset state and handle return focus
|
|
405
|
+
if (!m) {
|
|
406
|
+
// Reset focus tracking state
|
|
407
|
+
T.current = C;
|
|
408
|
+
clearTimeout(w.current);
|
|
409
|
+
// Return focus to invoking element if panel was previously open
|
|
410
|
+
if (q && h) {
|
|
411
|
+
if (typeof h === "function") {
|
|
412
|
+
h();
|
|
413
|
+
} else {
|
|
414
|
+
i()((function() {
|
|
415
|
+
var e, t;
|
|
416
|
+
(e = h.current) === null || e === void 0 ? void 0 : (t = e.focus) === null || t === void 0 ? void 0 : t.call(e);
|
|
417
|
+
}));
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
}), [ m, q, h, C ]);
|
|
422
|
+
// Handle return focus when panel closes, runs on change of handleReturnFocus deps
|
|
423
|
+
(0, n.useEffect)((function() {
|
|
424
|
+
$();
|
|
425
|
+
}), [ $ ]);
|
|
426
|
+
// Handle initial focus when panel opens - runs on change of handleInitialFocus deps
|
|
427
|
+
(0, n.useEffect)((function() {
|
|
428
|
+
I();
|
|
429
|
+
}), [ I ]);
|
|
430
|
+
var z = (0, n.useMemo)((function() {
|
|
431
|
+
if (P) {
|
|
272
432
|
return "interactive";
|
|
273
433
|
}
|
|
274
434
|
return "hidden";
|
|
275
|
-
}), [
|
|
276
|
-
var
|
|
277
|
-
if (
|
|
435
|
+
}), [ P ]);
|
|
436
|
+
var D = (0, n.useMemo)((function() {
|
|
437
|
+
if (l === "left" || l === "right") {
|
|
278
438
|
return {
|
|
279
439
|
height: "100%"
|
|
280
440
|
};
|
|
@@ -282,47 +442,66 @@
|
|
|
282
442
|
return {
|
|
283
443
|
width: "100%"
|
|
284
444
|
};
|
|
285
|
-
}), [
|
|
286
|
-
var
|
|
287
|
-
return
|
|
288
|
-
}), [
|
|
289
|
-
var
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
}), [
|
|
293
|
-
var
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
445
|
+
}), [ l ]);
|
|
446
|
+
var B = (0, n.useMemo)((function() {
|
|
447
|
+
return M(M({}, D), v);
|
|
448
|
+
}), [ D, v ]);
|
|
449
|
+
var Y = (0, n.useCallback)((function() {
|
|
450
|
+
R(false);
|
|
451
|
+
p === null || p === void 0 ? void 0 : p();
|
|
452
|
+
}), [ p ]);
|
|
453
|
+
var G = (0, n.useCallback)((function(e) {
|
|
454
|
+
E(k, e);
|
|
455
|
+
E(f, e);
|
|
456
|
+
}), [ k, f ]);
|
|
457
|
+
var K = (0, n.useCallback)((function(e) {
|
|
458
|
+
T.current = null;
|
|
459
|
+
b === null || b === void 0 ? void 0 : b(e);
|
|
460
|
+
}), [ b ]);
|
|
461
|
+
var Q = (0, n.useMemo)((function() {
|
|
462
|
+
return J[l];
|
|
463
|
+
}), [ l ]);
|
|
464
|
+
var V = (0, n.useMemo)((function() {
|
|
465
|
+
return {
|
|
466
|
+
retainFocus: true,
|
|
467
|
+
role: "dialog",
|
|
468
|
+
tabIndex: -1
|
|
469
|
+
};
|
|
470
|
+
}), []);
|
|
471
|
+
var W = (0, n.useMemo)((function() {
|
|
297
472
|
|
|
298
|
-
return
|
|
473
|
+
return r().createElement(Q, F({
|
|
474
|
+
$dockLayout: u,
|
|
299
475
|
animateOnMount: true,
|
|
300
|
-
animation:
|
|
476
|
+
animation: H[l],
|
|
301
477
|
"data-test": "side-panel",
|
|
302
|
-
elementRef:
|
|
303
|
-
innerClassName:
|
|
304
|
-
innerStyle:
|
|
305
|
-
onAnimationEnd:
|
|
306
|
-
open:
|
|
307
|
-
outerClassName:
|
|
308
|
-
outerStyle:
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
478
|
+
elementRef: G,
|
|
479
|
+
innerClassName: d,
|
|
480
|
+
innerStyle: B,
|
|
481
|
+
onAnimationEnd: Y,
|
|
482
|
+
open: m,
|
|
483
|
+
outerClassName: g,
|
|
484
|
+
outerStyle: S
|
|
485
|
+
}, u === "page" && V, j), t);
|
|
486
|
+
}), [ t, u, l, B, Y, G, d, m, g, S, V, Q, j ]);
|
|
487
|
+
var X = (0, n.useCallback)((function() {
|
|
488
|
+
return W;
|
|
489
|
+
}), [ W ]);
|
|
490
|
+
// If dockLayout is container or inline we want to return without the ModalLayer below.
|
|
491
|
+
if (u !== "page") {
|
|
492
|
+
return W;
|
|
493
|
+
}
|
|
315
494
|
|
|
316
|
-
return
|
|
317
|
-
childrenInAnimation:
|
|
318
|
-
onRequestClose:
|
|
319
|
-
open:
|
|
320
|
-
renderModal:
|
|
321
|
-
scrim:
|
|
495
|
+
return r().createElement(c(), {
|
|
496
|
+
childrenInAnimation: N,
|
|
497
|
+
onRequestClose: K,
|
|
498
|
+
open: m,
|
|
499
|
+
renderModal: X,
|
|
500
|
+
scrim: z
|
|
322
501
|
});
|
|
323
502
|
}
|
|
324
|
-
|
|
325
|
-
/* harmony default export */ const
|
|
503
|
+
K.propTypes = G;
|
|
504
|
+
/* harmony default export */ const Q = K;
|
|
326
505
|
// CONCATENATED MODULE: ./src/SidePanel/index.ts
|
|
327
506
|
module.exports = t;
|
|
328
507
|
/******/})();
|