@splunk/react-ui 4.20.0 → 4.21.1
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 +425 -441
- package/Anchor.js +147 -193
- package/Animation.js +142 -166
- package/AnimationToggle.js +197 -253
- package/Box.js +145 -194
- package/Breadcrumbs.js +288 -298
- package/Button.js +488 -613
- package/ButtonGroup.js +160 -212
- package/ButtonSimple.js +543 -562
- package/CHANGELOG.md +26 -0
- package/Calendar.js +1107 -1195
- package/Card.js +771 -746
- package/CardLayout.js +205 -223
- package/Chip.js +509 -612
- package/Clickable.js +416 -472
- package/CloseButton.js +165 -250
- package/Code.js +1808 -2172
- package/Code.js.LICENSE.txt +8 -0
- package/CollapsiblePanel.js +586 -675
- package/Color.js +1066 -1297
- package/ColumnLayout.js +402 -465
- package/ComboBox.js +892 -969
- package/Concertina.js +998 -963
- package/ControlGroup.js +687 -718
- package/Date.js +567 -697
- package/DefinitionList.js +308 -310
- package/Divider.js +149 -194
- package/Dropdown.js +459 -558
- package/DualListbox.js +1480 -1735
- package/EventListener.js +94 -165
- package/File.js +1051 -1173
- package/FormRows.js +885 -880
- package/Heading.js +216 -263
- package/Image.js +446 -558
- package/JSONTree.js +690 -699
- package/Layer.js +442 -582
- package/Link.js +336 -361
- package/List.js +213 -237
- package/Markdown.js +510 -612
- package/Menu.js +1109 -1331
- package/Message.js +474 -629
- package/MessageBar.js +387 -561
- package/Modal.js +810 -798
- package/ModalLayer.js +326 -343
- package/Monogram.js +308 -368
- package/Multiselect.js +3558 -3998
- package/Number.js +729 -843
- package/Paginator.js +510 -615
- package/Paragraph.js +145 -188
- package/Popover.js +1470 -1693
- package/Progress.js +301 -362
- package/RadioBar.js +610 -651
- package/RadioList.js +483 -544
- package/Resize.js +530 -623
- package/ResultsMenu.js +494 -597
- package/ScreenReaderContent.js +142 -187
- package/Scroll.js +595 -598
- package/ScrollContainerContext.js +197 -278
- package/Search.js +745 -817
- package/Select.js +2441 -2746
- package/SidePanel.js +390 -392
- package/Slider.js +668 -825
- package/SlidingPanels.js +639 -645
- package/SplitButton.js +464 -499
- package/StaticContent.js +161 -217
- package/StepBar.js +386 -466
- package/Switch.js +710 -764
- package/TabBar.js +724 -815
- package/TabLayout.js +406 -438
- package/Table.js +4842 -5121
- package/Text.js +1169 -1351
- package/TextArea.js +1097 -1307
- package/Tooltip.js +624 -721
- package/TransitionOpen.js +489 -546
- package/Typography.js +176 -229
- package/WaitSpinner.js +230 -298
- package/package.json +14 -15
- package/stubs-splunkui.d.ts +4 -1
- package/types/src/ComboBox/Option.d.ts +1 -1
- package/types/src/Concertina/Concertina.d.ts +4 -0
- package/types/src/JSONTree/JSONTreeContext.d.ts +7 -0
- package/types/src/JSONTree/TreeNode.d.ts +5 -0
- package/types/src/Link/Link.d.ts +7 -3
- package/types/src/Link/docs/examples/NewWindow.d.ts +2 -0
- package/types/src/Markdown/Markdown.d.ts +1 -1
- package/types/src/Markdown/renderers/MarkdownHeading.d.ts +1 -1
- package/types/src/Menu/Item.d.ts +1 -1
- package/types/src/Menu/Menu.d.ts +1 -0
- package/types/src/MessageBar/docs/examples/WithActions.d.ts +2 -0
- package/types/src/Multiselect/Option.d.ts +1 -1
- package/types/src/Search/Option.d.ts +1 -1
- package/types/src/Select/Option.d.ts +1 -1
- package/types/src/Select/OptionBase.d.ts +1 -1
- package/types/src/fixtures/FetchOptions.d.ts +2 -8
- package/useForceUpdate.js +112 -146
- package/useKeyPress.js +74 -128
- package/usePrevious.js +65 -129
- package/useRovingFocus.js +122 -218
- package/types/src/Link/docs/examples/NewTab.d.ts +0 -2
- /package/types/src/Table/docs/examples/{DockedHeader.d.ts → DockedHeaderScrollbar.d.ts} +0 -0
- /package/types/src/Table/docs/examples/prisma/{DockedHeader.d.ts → DockedHeaderScrollbar.d.ts} +0 -0
package/DualListbox.js
CHANGED
|
@@ -1,1783 +1,1528 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
/******/
|
|
4
|
-
/******/
|
|
5
|
-
/******/
|
|
6
|
-
/******/
|
|
7
|
-
|
|
8
|
-
/******/
|
|
9
|
-
/******/
|
|
10
|
-
/******/
|
|
11
|
-
/******/
|
|
12
|
-
/******/
|
|
13
|
-
/******/
|
|
14
|
-
/******/
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
/******/
|
|
20
|
-
/******/
|
|
21
|
-
/******/
|
|
22
|
-
/******/
|
|
23
|
-
/******/
|
|
24
|
-
/******/
|
|
25
|
-
/******/
|
|
26
|
-
/******/
|
|
27
|
-
/******/
|
|
28
|
-
/******/
|
|
29
|
-
/******/
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
/******/
|
|
34
|
-
/******/
|
|
35
|
-
/******/
|
|
36
|
-
/******/
|
|
37
|
-
/******/
|
|
38
|
-
/******/
|
|
39
|
-
/******/
|
|
40
|
-
/******/
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
/******/
|
|
44
|
-
/******/
|
|
45
|
-
/******/
|
|
46
|
-
/******/
|
|
47
|
-
/******/
|
|
48
|
-
/******/
|
|
49
|
-
/******/
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
/******/
|
|
53
|
-
/******/
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
/******/
|
|
57
|
-
/******/
|
|
58
|
-
/******/
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
module.exports = require("@splunk/themes");
|
|
94
|
-
|
|
95
|
-
/***/ }),
|
|
96
|
-
|
|
97
|
-
/***/ 1:
|
|
98
|
-
/***/ (function(module, exports) {
|
|
99
|
-
|
|
100
|
-
module.exports = require("prop-types");
|
|
101
|
-
|
|
102
|
-
/***/ }),
|
|
103
|
-
|
|
104
|
-
/***/ 12:
|
|
105
|
-
/***/ (function(module, exports) {
|
|
106
|
-
|
|
107
|
-
module.exports = require("@splunk/react-ui/Clickable");
|
|
108
|
-
|
|
109
|
-
/***/ }),
|
|
110
|
-
|
|
111
|
-
/***/ 14:
|
|
112
|
-
/***/ (function(module, exports) {
|
|
113
|
-
|
|
114
|
-
module.exports = require("@splunk/react-ui/ScreenReaderContent");
|
|
115
|
-
|
|
116
|
-
/***/ }),
|
|
117
|
-
|
|
118
|
-
/***/ 171:
|
|
119
|
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
120
|
-
|
|
121
|
-
"use strict";
|
|
122
|
-
// ESM COMPAT FLAG
|
|
123
|
-
__webpack_require__.r(__webpack_exports__);
|
|
124
|
-
|
|
125
|
-
// EXPORTS
|
|
126
|
-
__webpack_require__.d(__webpack_exports__, "default", function() { return /* reexport */ DualListbox_DualListbox; });
|
|
127
|
-
__webpack_require__.d(__webpack_exports__, "Option", function() { return /* reexport */ DualListbox_Option; });
|
|
128
|
-
|
|
129
|
-
// EXTERNAL MODULE: external "react"
|
|
130
|
-
var external_react_ = __webpack_require__(2);
|
|
131
|
-
var external_react_default = /*#__PURE__*/__webpack_require__.n(external_react_);
|
|
132
|
-
|
|
133
|
-
// EXTERNAL MODULE: external "prop-types"
|
|
134
|
-
var external_prop_types_ = __webpack_require__(1);
|
|
135
|
-
var external_prop_types_default = /*#__PURE__*/__webpack_require__.n(external_prop_types_);
|
|
136
|
-
|
|
137
|
-
// EXTERNAL MODULE: external "@splunk/ui-utils/i18n"
|
|
138
|
-
var i18n_ = __webpack_require__(4);
|
|
139
|
-
|
|
140
|
-
// EXTERNAL MODULE: external "@splunk/ui-utils/keyboard"
|
|
141
|
-
var keyboard_ = __webpack_require__(7);
|
|
142
|
-
|
|
143
|
-
// EXTERNAL MODULE: external "@splunk/react-icons/enterprise/ChevronLeft"
|
|
144
|
-
var ChevronLeft_ = __webpack_require__(66);
|
|
145
|
-
var ChevronLeft_default = /*#__PURE__*/__webpack_require__.n(ChevronLeft_);
|
|
146
|
-
|
|
147
|
-
// EXTERNAL MODULE: external "@splunk/react-icons/enterprise/ChevronRight"
|
|
148
|
-
var ChevronRight_ = __webpack_require__(38);
|
|
149
|
-
var ChevronRight_default = /*#__PURE__*/__webpack_require__.n(ChevronRight_);
|
|
150
|
-
|
|
151
|
-
// EXTERNAL MODULE: external "@splunk/ui-utils/format"
|
|
152
|
-
var format_ = __webpack_require__(29);
|
|
153
|
-
|
|
154
|
-
// EXTERNAL MODULE: external "@splunk/react-ui/useForceUpdate"
|
|
155
|
-
var useForceUpdate_ = __webpack_require__(48);
|
|
156
|
-
var useForceUpdate_default = /*#__PURE__*/__webpack_require__.n(useForceUpdate_);
|
|
157
|
-
|
|
158
|
-
// EXTERNAL MODULE: external "@splunk/react-ui/ScreenReaderContent"
|
|
159
|
-
var ScreenReaderContent_ = __webpack_require__(14);
|
|
160
|
-
var ScreenReaderContent_default = /*#__PURE__*/__webpack_require__.n(ScreenReaderContent_);
|
|
161
|
-
|
|
162
|
-
// CONCATENATED MODULE: ./src/DualListbox/DualListboxContext.tsx
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
/**
|
|
1
|
+
/******/ (() => {
|
|
2
|
+
// webpackBootstrap
|
|
3
|
+
/******/ "use strict";
|
|
4
|
+
/******/ // The require scope
|
|
5
|
+
/******/ var e = {};
|
|
6
|
+
/******/
|
|
7
|
+
/************************************************************************/
|
|
8
|
+
/******/ /* webpack/runtime/compat get default export */
|
|
9
|
+
/******/ (() => {
|
|
10
|
+
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
|
11
|
+
/******/ e.n = r => {
|
|
12
|
+
/******/ var t = r && r.__esModule ?
|
|
13
|
+
/******/ () => r["default"]
|
|
14
|
+
/******/ : () => r
|
|
15
|
+
/******/;
|
|
16
|
+
e.d(t, {
|
|
17
|
+
a: t
|
|
18
|
+
});
|
|
19
|
+
/******/ return t;
|
|
20
|
+
/******/ };
|
|
21
|
+
/******/ })();
|
|
22
|
+
/******/
|
|
23
|
+
/******/ /* webpack/runtime/define property getters */
|
|
24
|
+
/******/ (() => {
|
|
25
|
+
/******/ // define getter functions for harmony exports
|
|
26
|
+
/******/ e.d = (r, t) => {
|
|
27
|
+
/******/ for (var n in t) {
|
|
28
|
+
/******/ if (e.o(t, n) && !e.o(r, n)) {
|
|
29
|
+
/******/ Object.defineProperty(r, n, {
|
|
30
|
+
enumerable: true,
|
|
31
|
+
get: t[n]
|
|
32
|
+
});
|
|
33
|
+
/******/ }
|
|
34
|
+
/******/ }
|
|
35
|
+
/******/ };
|
|
36
|
+
/******/ })();
|
|
37
|
+
/******/
|
|
38
|
+
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
|
39
|
+
/******/ (() => {
|
|
40
|
+
/******/ e.o = (e, r) => Object.prototype.hasOwnProperty.call(e, r)
|
|
41
|
+
/******/;
|
|
42
|
+
})();
|
|
43
|
+
/******/
|
|
44
|
+
/******/ /* webpack/runtime/make namespace object */
|
|
45
|
+
/******/ (() => {
|
|
46
|
+
/******/ // define __esModule on exports
|
|
47
|
+
/******/ e.r = e => {
|
|
48
|
+
/******/ if (typeof Symbol !== "undefined" && Symbol.toStringTag) {
|
|
49
|
+
/******/ Object.defineProperty(e, Symbol.toStringTag, {
|
|
50
|
+
value: "Module"
|
|
51
|
+
});
|
|
52
|
+
/******/ }
|
|
53
|
+
/******/ Object.defineProperty(e, "__esModule", {
|
|
54
|
+
value: true
|
|
55
|
+
});
|
|
56
|
+
/******/ };
|
|
57
|
+
/******/ })();
|
|
58
|
+
/******/
|
|
59
|
+
/************************************************************************/ var r = {};
|
|
60
|
+
// ESM COMPAT FLAG
|
|
61
|
+
e.r(r);
|
|
62
|
+
// EXPORTS
|
|
63
|
+
e.d(r, {
|
|
64
|
+
Option: () => /* reexport */ ne,
|
|
65
|
+
default: () => /* reexport */ De
|
|
66
|
+
});
|
|
67
|
+
// CONCATENATED MODULE: external "react"
|
|
68
|
+
const t = require("react");
|
|
69
|
+
var n = e.n(t);
|
|
70
|
+
// CONCATENATED MODULE: external "prop-types"
|
|
71
|
+
const a = require("prop-types");
|
|
72
|
+
var i = e.n(a);
|
|
73
|
+
// CONCATENATED MODULE: external "@splunk/ui-utils/i18n"
|
|
74
|
+
const l = require("@splunk/ui-utils/i18n");
|
|
75
|
+
// CONCATENATED MODULE: external "@splunk/ui-utils/keyboard"
|
|
76
|
+
const o = require("@splunk/ui-utils/keyboard");
|
|
77
|
+
// CONCATENATED MODULE: external "@splunk/react-icons/enterprise/ChevronLeft"
|
|
78
|
+
const u = require("@splunk/react-icons/enterprise/ChevronLeft");
|
|
79
|
+
var c = e.n(u);
|
|
80
|
+
// CONCATENATED MODULE: external "@splunk/react-icons/enterprise/ChevronRight"
|
|
81
|
+
const s = require("@splunk/react-icons/enterprise/ChevronRight");
|
|
82
|
+
var v = e.n(s);
|
|
83
|
+
// CONCATENATED MODULE: external "@splunk/ui-utils/format"
|
|
84
|
+
const d = require("@splunk/ui-utils/format");
|
|
85
|
+
// CONCATENATED MODULE: external "@splunk/react-ui/useForceUpdate"
|
|
86
|
+
const f = require("@splunk/react-ui/useForceUpdate");
|
|
87
|
+
var p = e.n(f);
|
|
88
|
+
// CONCATENATED MODULE: external "@splunk/react-ui/ScreenReaderContent"
|
|
89
|
+
const b = require("@splunk/react-ui/ScreenReaderContent");
|
|
90
|
+
var m = e.n(b);
|
|
91
|
+
// CONCATENATED MODULE: ./src/DualListbox/DualListboxContext.tsx
|
|
92
|
+
/**
|
|
166
93
|
* A React context used to inform subcomponets of DualListbox of parent component values.
|
|
167
94
|
* The context interface is `DualListboxContextValue`.
|
|
168
95
|
* Defaults to `'{}'`.
|
|
169
96
|
* @public
|
|
170
97
|
*/
|
|
171
|
-
var
|
|
172
|
-
/* harmony default export */
|
|
173
|
-
// CONCATENATED MODULE: ./src/DualListbox/ScreenReaderWrapper.tsx
|
|
174
|
-
function
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
updateScreenReaderRefreshHook = contextValue.updateScreenReaderRefreshHook;
|
|
188
|
-
Object(external_react_["useEffect"])(function () {
|
|
189
|
-
updateScreenReaderRefreshHook === null || updateScreenReaderRefreshHook === void 0 ? void 0 : updateScreenReaderRefreshHook(forceUpdate);
|
|
190
|
-
return function () {
|
|
191
|
-
return updateScreenReaderRefreshHook === null || updateScreenReaderRefreshHook === void 0 ? void 0 : updateScreenReaderRefreshHook();
|
|
192
|
-
};
|
|
193
|
-
}, [updateScreenReaderRefreshHook, forceUpdate]);
|
|
194
|
-
|
|
195
|
-
if (!getScreenReaderMessage) {
|
|
196
|
-
return null;
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
return /*#__PURE__*/external_react_default.a.createElement(ScreenReaderContent_default.a, _extends({
|
|
200
|
-
"aria-live": "assertive"
|
|
201
|
-
}, otherProps), getScreenReaderMessage() || '');
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
/* harmony default export */ var DualListbox_ScreenReaderWrapper = (ScreenReaderWrapper);
|
|
205
|
-
// CONCATENATED MODULE: ./src/DualListbox/listboxUtils.ts
|
|
206
|
-
var arrayWithToggledValue = function arrayWithToggledValue(valueArr, toggleValue) {
|
|
207
|
-
var newArray = valueArr.filter(function (value) {
|
|
208
|
-
return value !== toggleValue;
|
|
209
|
-
});
|
|
210
|
-
|
|
211
|
-
if (valueArr.length === newArray.length) {
|
|
212
|
-
newArray.push(toggleValue);
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
return newArray;
|
|
216
|
-
};
|
|
217
|
-
|
|
218
|
-
var arrayWithRemovedValues = function arrayWithRemovedValues(valueArr, removedValues) {
|
|
219
|
-
var removedSet = new Set(removedValues);
|
|
220
|
-
return valueArr.filter(function (value) {
|
|
221
|
-
return !removedSet.has(value);
|
|
222
|
-
});
|
|
223
|
-
};
|
|
224
|
-
|
|
225
|
-
var findNextValue = function findNextValue(index, originalValues, removedValues) {
|
|
226
|
-
if (index < 0) {
|
|
227
|
-
return undefined;
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
var currentValue = originalValues[index];
|
|
231
|
-
var removedSet = new Set(removedValues);
|
|
232
|
-
|
|
233
|
-
if (!removedSet.has(currentValue)) {
|
|
234
|
-
return currentValue;
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
for (var i = index + 1; i < originalValues.length; i += 1) {
|
|
238
|
-
var tempValue = originalValues[i];
|
|
239
|
-
|
|
240
|
-
if (!removedSet.has(tempValue)) {
|
|
241
|
-
return tempValue;
|
|
98
|
+
var h = n().createContext({});
|
|
99
|
+
/* harmony default export */ const g = h;
|
|
100
|
+
// CONCATENATED MODULE: ./src/DualListbox/ScreenReaderWrapper.tsx
|
|
101
|
+
function y() {
|
|
102
|
+
y = Object.assign || function(e) {
|
|
103
|
+
for (var r = 1; r < arguments.length; r++) {
|
|
104
|
+
var t = arguments[r];
|
|
105
|
+
for (var n in t) {
|
|
106
|
+
if (Object.prototype.hasOwnProperty.call(t, n)) {
|
|
107
|
+
e[n] = t[n];
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
return e;
|
|
112
|
+
};
|
|
113
|
+
return y.apply(this, arguments);
|
|
242
114
|
}
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
115
|
+
function k(e) {
|
|
116
|
+
var r = y({}, e);
|
|
117
|
+
var a = p()();
|
|
118
|
+
var i = (0, t.useContext)(g);
|
|
119
|
+
var l = i.getScreenReaderMessage, o = i.updateScreenReaderRefreshHook;
|
|
120
|
+
(0, t.useEffect)((function() {
|
|
121
|
+
o === null || o === void 0 ? void 0 : o(a);
|
|
122
|
+
return function() {
|
|
123
|
+
return o === null || o === void 0 ? void 0 : o();
|
|
124
|
+
};
|
|
125
|
+
}), [ o, a ]);
|
|
126
|
+
if (!l) {
|
|
127
|
+
return null;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
return n().createElement(m(), y({
|
|
131
|
+
"aria-live": "assertive"
|
|
132
|
+
}, r), l() || "");
|
|
250
133
|
}
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
134
|
+
/* harmony default export */ const C = k;
|
|
135
|
+
// CONCATENATED MODULE: ./src/DualListbox/listboxUtils.ts
|
|
136
|
+
var x = function e(r, t) {
|
|
137
|
+
var n = r.filter((function(e) {
|
|
138
|
+
return e !== t;
|
|
139
|
+
}));
|
|
140
|
+
if (r.length === n.length) {
|
|
141
|
+
n.push(t);
|
|
142
|
+
}
|
|
143
|
+
return n;
|
|
144
|
+
};
|
|
145
|
+
var S = function e(r, t) {
|
|
146
|
+
var n = new Set(t);
|
|
147
|
+
return r.filter((function(e) {
|
|
148
|
+
return !n.has(e);
|
|
149
|
+
}));
|
|
150
|
+
};
|
|
151
|
+
var w = function e(r, t, n) {
|
|
152
|
+
if (r < 0) {
|
|
153
|
+
return undefined;
|
|
154
|
+
}
|
|
155
|
+
var a = t[r];
|
|
156
|
+
var i = new Set(n);
|
|
157
|
+
if (!i.has(a)) {
|
|
158
|
+
return a;
|
|
159
|
+
}
|
|
160
|
+
for (var l = r + 1; l < t.length; l += 1) {
|
|
161
|
+
var o = t[l];
|
|
162
|
+
if (!i.has(o)) {
|
|
163
|
+
return o;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
for (var u = r - 1; u > 0; u -= 1) {
|
|
167
|
+
var c = t[u];
|
|
168
|
+
if (!i.has(c)) {
|
|
169
|
+
return c;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
return undefined;
|
|
173
|
+
};
|
|
174
|
+
// CONCATENATED MODULE: ./src/utils/scrollIntoViewIfNeeded.ts
|
|
175
|
+
// A utility that attempts to move an element into view by scrolling it's derived parent.
|
|
176
|
+
var O = function e(r) {
|
|
177
|
+
if (!r) {
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
var t = r.offsetParent;
|
|
181
|
+
if (!t) {
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
// Below the bottom of the container.
|
|
185
|
+
if (t.scrollTop + t.clientHeight < r.offsetTop + r.clientHeight) {
|
|
186
|
+
t.scrollTop = r.offsetTop + r.clientHeight - t.clientHeight;
|
|
187
|
+
// Above the top of the container.
|
|
188
|
+
} else if (t.scrollTop > r.offsetTop) {
|
|
189
|
+
t.scrollTop = r.offsetTop;
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
// CONCATENATED MODULE: ./src/utils/fuzzyMatch.ts
|
|
193
|
+
// A utility for matching keyboard characters to list values
|
|
194
|
+
var R = function e(r, t) {
|
|
195
|
+
return r ? r.label.charAt(t).toLowerCase() : "";
|
|
196
|
+
};
|
|
197
|
+
var E = function e(r, t) {
|
|
198
|
+
if (!r.length) {
|
|
199
|
+
return r;
|
|
200
|
+
}
|
|
201
|
+
var n = null;
|
|
202
|
+
var a = false;
|
|
203
|
+
var i = r.filter((function(e) {
|
|
204
|
+
var r = R(e, t.index);
|
|
205
|
+
if (r === t.value) {
|
|
206
|
+
a = true;
|
|
207
|
+
return true;
|
|
208
|
+
}
|
|
209
|
+
// If we haven't found a match yet, keep track of the next closest match.
|
|
210
|
+
// Secondary matching looks for the closest character of a higher value, and failing that, closest of a lower value.
|
|
211
|
+
if (!a) {
|
|
212
|
+
var i = R(n, t.index);
|
|
213
|
+
if (!i) {
|
|
214
|
+
n = e;
|
|
215
|
+
} else if (r > t.value) {
|
|
216
|
+
if (i < t.value) {
|
|
217
|
+
n = e;
|
|
218
|
+
} else if (i > r) {
|
|
219
|
+
n = e;
|
|
220
|
+
}
|
|
221
|
+
} else if (r > i) {
|
|
222
|
+
n = e;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
return false;
|
|
226
|
+
}));
|
|
227
|
+
return i.length === 0 && n ? [ n ] : i;
|
|
228
|
+
};
|
|
229
|
+
// CONCATENATED MODULE: ./src/DualListbox/ToolbarContext.tsx
|
|
230
|
+
/**
|
|
267
231
|
* A React context used to inform subcomponets of Toolbar of parent component values.
|
|
268
232
|
* The context interface is `ToolbarContextValue`.
|
|
269
233
|
* Defaults to `'{}'`.
|
|
270
234
|
* @public
|
|
271
235
|
*/
|
|
272
|
-
var
|
|
273
|
-
/* harmony default export */
|
|
274
|
-
//
|
|
275
|
-
|
|
276
|
-
var
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
var
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
//
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
//
|
|
286
|
-
var
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
})
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
var
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
236
|
+
var I = n().createContext({});
|
|
237
|
+
/* harmony default export */ const L = I;
|
|
238
|
+
// CONCATENATED MODULE: external "@splunk/react-ui/Tooltip"
|
|
239
|
+
const q = require("@splunk/react-ui/Tooltip");
|
|
240
|
+
var j = e.n(q);
|
|
241
|
+
// CONCATENATED MODULE: external "styled-components"
|
|
242
|
+
const _ = require("styled-components");
|
|
243
|
+
var D = e.n(_);
|
|
244
|
+
// CONCATENATED MODULE: external "@splunk/themes"
|
|
245
|
+
const N = require("@splunk/themes");
|
|
246
|
+
// CONCATENATED MODULE: external "@splunk/react-ui/Clickable"
|
|
247
|
+
const V = require("@splunk/react-ui/Clickable");
|
|
248
|
+
var P = e.n(V);
|
|
249
|
+
// CONCATENATED MODULE: ./src/DualListbox/ToolbarButtonStyles.ts
|
|
250
|
+
var H = D()(P()).withConfig({
|
|
251
|
+
displayName: "ToolbarButtonStyles__StyledClickable",
|
|
252
|
+
componentId: "k7zksz-0"
|
|
253
|
+
})([ "", " border:", ";border-radius:", ";box-sizing:border-box;cursor:pointer;flex-grow:1;font-weight:", ";line-height:", ";min-height:", ";min-width:", ";max-width:100%;padding:", ";position:relative;text-align:center;text-decoration:none;vertical-align:middle;white-space:nowrap;width:", ";&:active{transition:none;}&:focus{box-shadow:", ";}&:focus,&:hover{z-index:3;}", ";" ], N.mixins.reset("block"), (0,
|
|
254
|
+
N.pick)({
|
|
255
|
+
enterprise: "1px solid transparent"
|
|
256
|
+
}), N.variables.borderRadius, (0, N.pick)({
|
|
257
|
+
enterprise: N.variables.fontWeightSemiBold,
|
|
258
|
+
prisma: N.variables.fontWeightSemiBold
|
|
259
|
+
}), N.variables.lineHeight, N.variables.inputHeight, N.variables.inputHeight, (0,
|
|
260
|
+
N.pick)({
|
|
261
|
+
enterprise: {
|
|
262
|
+
comfortable: "0 5px",
|
|
263
|
+
compact: "0 2px"
|
|
264
|
+
},
|
|
265
|
+
prisma: {
|
|
266
|
+
comfortable: (0, _.css)([ "0px calc(", " / 2 - 1px)" ], N.variables.inputHeight),
|
|
267
|
+
compact: (0, _.css)([ "0px calc(", " / 2 - 1px)" ], N.variables.inputHeight)
|
|
268
|
+
}
|
|
269
|
+
}), N.variables.inputHeight, N.variables.focusShadow, (0, N.pickVariant)("$disabled", {
|
|
270
|
+
false: (0, N.pick)({
|
|
271
|
+
enterprise: (0, _.css)([ "color:", ";transition:background-color 0.2s,border 0.2s,box-shadow 0.2s,text-decoration 0.2s;&:hover{background-color:", ";border-color:", ";color:", ";}&:active{background-color:", ";transition:none;}&:focus{color:", ";}" ], (0,
|
|
272
|
+
N.pick)({
|
|
273
|
+
light: N.variables.gray45,
|
|
274
|
+
dark: N.variables.white
|
|
275
|
+
}), N.variables.backgroundColorHover, (0, N.pick)({
|
|
276
|
+
light: N.variables.gray60,
|
|
277
|
+
dark: N.variables.borderColor
|
|
278
|
+
}), (0, N.pick)({
|
|
279
|
+
light: N.variables.linkColor,
|
|
280
|
+
dark: N.variables.white
|
|
281
|
+
}), (0, N.pick)({
|
|
282
|
+
light: N.variables.gray92,
|
|
283
|
+
dark: N.variables.gray22
|
|
284
|
+
}), (0, N.pick)({
|
|
285
|
+
light: N.variables.linkColor,
|
|
286
|
+
dark: N.variables.white
|
|
287
|
+
})),
|
|
288
|
+
prisma: (0, _.css)([ "color:", ";transition:background-image 0.2s,border 0.2s,box-shadow 0.2s,text-decoration 0.2s;&:hover{background-color:", ";border-color:", ";box-shadow:", ";}&:active{background-color:", ";transition:none;}&:focus{&:active{background-color:", ";}}" ], N.variables.contentColorActive, N.variables.interactiveColorOverlayHover, N.variables.interactiveColorBorderHover, N.variables.hoverShadow, N.variables.interactiveColorOverlayActive, N.variables.interactiveColorOverlayActive)
|
|
289
|
+
}),
|
|
290
|
+
true: (0, _.css)([ "border-color:", ";color:", ";cursor:not-allowed;" ], (0, N.pick)({
|
|
291
|
+
prisma: N.variables.interactiveColorBorderDisabled
|
|
292
|
+
}), (0, N.pick)({
|
|
293
|
+
enterprise: N.variables.textDisabledColor,
|
|
294
|
+
prisma: N.variables.contentColorDisabled
|
|
295
|
+
}))
|
|
296
|
+
}));
|
|
297
|
+
var T = D().span.withConfig({
|
|
298
|
+
displayName: "ToolbarButtonStyles__StyledIcon",
|
|
299
|
+
componentId: "k7zksz-1"
|
|
300
|
+
})([ "align-items:center;display:flex;flex-direction:row;flex-shrink:0;font-size:", ";justify-content:center;max-width:100%;" ], (0,
|
|
301
|
+
N.pick)({
|
|
302
|
+
enterprise: "inherit",
|
|
303
|
+
prisma: {
|
|
304
|
+
comfortable: "21px",
|
|
305
|
+
compact: "16px"
|
|
306
|
+
}
|
|
307
|
+
}));
|
|
308
|
+
// CONCATENATED MODULE: ./src/DualListbox/ToolbarButton.tsx
|
|
309
|
+
function B() {
|
|
310
|
+
B = Object.assign || function(e) {
|
|
311
|
+
for (var r = 1; r < arguments.length; r++) {
|
|
312
|
+
var t = arguments[r];
|
|
313
|
+
for (var n in t) {
|
|
314
|
+
if (Object.prototype.hasOwnProperty.call(t, n)) {
|
|
315
|
+
e[n] = t[n];
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
return e;
|
|
320
|
+
};
|
|
321
|
+
return B.apply(this, arguments);
|
|
322
|
+
}
|
|
323
|
+
function M(e, r) {
|
|
324
|
+
if (e == null) return {};
|
|
325
|
+
var t = A(e, r);
|
|
326
|
+
var n, a;
|
|
327
|
+
if (Object.getOwnPropertySymbols) {
|
|
328
|
+
var i = Object.getOwnPropertySymbols(e);
|
|
329
|
+
for (a = 0; a < i.length; a++) {
|
|
330
|
+
n = i[a];
|
|
331
|
+
if (r.indexOf(n) >= 0) continue;
|
|
332
|
+
if (!Object.prototype.propertyIsEnumerable.call(e, n)) continue;
|
|
333
|
+
t[n] = e[n];
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
return t;
|
|
337
|
+
}
|
|
338
|
+
function A(e, r) {
|
|
339
|
+
if (e == null) return {};
|
|
340
|
+
var t = {};
|
|
341
|
+
var n = Object.keys(e);
|
|
342
|
+
var a, i;
|
|
343
|
+
for (i = 0; i < n.length; i++) {
|
|
344
|
+
a = n[i];
|
|
345
|
+
if (r.indexOf(a) >= 0) continue;
|
|
346
|
+
t[a] = e[a];
|
|
347
|
+
}
|
|
348
|
+
return t;
|
|
349
|
+
}
|
|
350
|
+
var K = {
|
|
351
|
+
icon: i().node.isRequired,
|
|
352
|
+
name: i().string.isRequired,
|
|
353
|
+
tooltipLabel: i().string.isRequired,
|
|
354
|
+
tooltipPlacement: i().oneOf([ "above", "below", "left", "right" ])
|
|
386
355
|
};
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
// CONCATENATED MODULE: ./src/DualListbox/OptionStyles.ts
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
var StyledListItem = external_styled_components_default.a.li.withConfig({
|
|
427
|
-
displayName: "OptionStyles__StyledListItem",
|
|
428
|
-
componentId: "q275d9-0"
|
|
429
|
-
})(["align-items:center;color:", ";cursor:pointer;display:flex;overflow:hidden;width:100%;word-wrap:break-word;", " ", ""], themes_["variables"].contentColorActive, Object(themes_["pickVariant"])('$active', {
|
|
430
|
-
"true": Object(external_styled_components_["css"])(["", ""], Object(themes_["pick"])({
|
|
431
|
-
prisma: Object(external_styled_components_["css"])(["background:", ";"], themes_["variables"].interactiveColorOverlaySelected),
|
|
432
|
-
enterprise: {
|
|
433
|
-
light: Object(external_styled_components_["css"])(["background:", ";"], themes_["variables"].accentColorL50),
|
|
434
|
-
dark: Object(external_styled_components_["css"])(["background:", ";"], themes_["variables"].accentColorD50)
|
|
356
|
+
function $(e) {
|
|
357
|
+
var r = e.ariaLabel, a = e.ariaKeyShortcuts, i = e.icon, l = e.name, o = e.tooltipLabel, u = e.tooltipPlacement, c = M(e, [ "ariaLabel", "ariaKeyShortcuts", "icon", "name", "tooltipLabel", "tooltipPlacement" ]);
|
|
358
|
+
var s = (0, t.useContext)(L);
|
|
359
|
+
var v = p()();
|
|
360
|
+
var d = s.getButtonState, f = s.onButtonClick, b = s.updateButtonRefreshHookByName;
|
|
361
|
+
(0, t.useEffect)((function() {
|
|
362
|
+
b === null || b === void 0 ? void 0 : b(l, v);
|
|
363
|
+
return function() {
|
|
364
|
+
return b === null || b === void 0 ? void 0 : b(l);
|
|
365
|
+
};
|
|
366
|
+
}), [ l, b, v ]);
|
|
367
|
+
var m = (0, t.useCallback)((function(e) {
|
|
368
|
+
f === null || f === void 0 ? void 0 : f(e, {
|
|
369
|
+
name: l
|
|
370
|
+
});
|
|
371
|
+
}), [ f, l ]);
|
|
372
|
+
if (!d) {
|
|
373
|
+
return null;
|
|
374
|
+
}
|
|
375
|
+
var h = d(l), g = h.disabled;
|
|
376
|
+
|
|
377
|
+
return n().createElement(j(), {
|
|
378
|
+
defaultPlacement: u,
|
|
379
|
+
content: n().createElement("span", {
|
|
380
|
+
"aria-hidden": true
|
|
381
|
+
}, o)
|
|
382
|
+
}, n().createElement(H, B({
|
|
383
|
+
"aria-label": r,
|
|
384
|
+
"aria-keyshortcuts": a,
|
|
385
|
+
"aria-disabled": g || undefined,
|
|
386
|
+
"data-test": "toolbar-button",
|
|
387
|
+
$disabled: g,
|
|
388
|
+
onClick: !g ? m : undefined
|
|
389
|
+
}, c), n().createElement(T, null, i)));
|
|
435
390
|
}
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
})
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
391
|
+
$.propsTypes = K;
|
|
392
|
+
/* harmony default export */ const F = $;
|
|
393
|
+
// CONCATENATED MODULE: external "@splunk/react-ui/Switch"
|
|
394
|
+
const z = require("@splunk/react-ui/Switch");
|
|
395
|
+
var U = e.n(z);
|
|
396
|
+
// CONCATENATED MODULE: ./src/DualListbox/OptionStyles.ts
|
|
397
|
+
var W = D().li.withConfig({
|
|
398
|
+
displayName: "OptionStyles__StyledListItem",
|
|
399
|
+
componentId: "q275d9-0"
|
|
400
|
+
})([ "align-items:center;color:", ";cursor:pointer;display:flex;overflow:hidden;width:100%;word-wrap:break-word;", " ", "" ], N.variables.contentColorActive, (0,
|
|
401
|
+
N.pickVariant)("$active", {
|
|
402
|
+
true: (0, _.css)([ "", "" ], (0, N.pick)({
|
|
403
|
+
prisma: (0, _.css)([ "background:", ";" ], N.variables.interactiveColorOverlaySelected),
|
|
404
|
+
enterprise: {
|
|
405
|
+
light: (0, _.css)([ "background:", ";" ], N.variables.accentColorL50),
|
|
406
|
+
dark: (0, _.css)([ "background:", ";" ], N.variables.accentColorD50)
|
|
407
|
+
}
|
|
408
|
+
}))
|
|
409
|
+
}), (0, N.pick)({
|
|
410
|
+
prisma: (0, N.pickVariant)("$selected", {
|
|
411
|
+
true: (0, _.css)([ "&:hover{background:", ";}" ], N.mixins.overlayColors(N.variables.interactiveColorOverlaySelected, N.variables.interactiveColorOverlayHover)),
|
|
412
|
+
false: (0, _.css)([ "&:hover{background:", ";}" ], N.variables.interactiveColorOverlayHover)
|
|
413
|
+
}),
|
|
414
|
+
enterprise: (0, _.css)([ "&:hover{background:", ";}" ], N.variables.backgroundColorHover)
|
|
415
|
+
}));
|
|
416
|
+
var X = D()(U()).withConfig({
|
|
417
|
+
displayName: "OptionStyles__StyledSwtich",
|
|
418
|
+
componentId: "q275d9-1"
|
|
419
|
+
})([ "padding-left:", ";" ], N.variables.spacingSmall);
|
|
420
|
+
var G = D().div.withConfig({
|
|
421
|
+
displayName: "OptionStyles__StyledDiv",
|
|
422
|
+
componentId: "q275d9-2"
|
|
423
|
+
})([ "padding:", ";word-break:break-word;word-wrap:break-word;" ], (0, N.pick)({
|
|
424
|
+
prisma: {
|
|
425
|
+
compact: (0, _.css)([ "6px ", "" ], N.variables.spacingSmall),
|
|
426
|
+
comfortable: (0, _.css)([ "10px ", "" ], N.variables.spacingSmall)
|
|
427
|
+
},
|
|
428
|
+
enterprise: (0, _.css)([ "6px ", "" ], N.variables.spacingSmall)
|
|
429
|
+
}));
|
|
430
|
+
// CONCATENATED MODULE: ./src/DualListbox/ListboxContext.tsx
|
|
431
|
+
/**
|
|
463
432
|
* A React context used to inform subcomponets of Listbox of parent component values.
|
|
464
433
|
* The context interface is `ListboxContextValue`.
|
|
465
434
|
* Defaults to `'{}'`.
|
|
466
435
|
* @public
|
|
467
436
|
*/
|
|
468
|
-
var
|
|
469
|
-
/* harmony default export */
|
|
470
|
-
// CONCATENATED MODULE: ./src/DualListbox/Option.tsx
|
|
471
|
-
function
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
label: external_prop_types_default.a.string.isRequired,
|
|
485
|
-
listName: external_prop_types_default.a.string,
|
|
486
|
-
selected: external_prop_types_default.a.bool,
|
|
487
|
-
value: external_prop_types_default.a.string.isRequired
|
|
488
|
-
};
|
|
489
|
-
|
|
490
|
-
function Option(_ref) {
|
|
491
|
-
var id = _ref.id,
|
|
492
|
-
label = _ref.label,
|
|
493
|
-
selectedProp = _ref.selected,
|
|
494
|
-
value = _ref.value,
|
|
495
|
-
otherProps = Option_objectWithoutProperties(_ref, ["id", "label", "selected", "value"]);
|
|
496
|
-
|
|
497
|
-
var contextValue = Object(external_react_["useContext"])(DualListbox_ListboxContext);
|
|
498
|
-
var forceUpdate = useForceUpdate_default()();
|
|
499
|
-
var onOptionClick = contextValue.onOptionClick,
|
|
500
|
-
getOptionStateForValue = contextValue.getOptionStateForValue,
|
|
501
|
-
updateOptionRefreshHookByValue = contextValue.updateOptionRefreshHookByValue,
|
|
502
|
-
controlled = contextValue.controlled;
|
|
503
|
-
Object(external_react_["useEffect"])(function () {
|
|
504
|
-
updateOptionRefreshHookByValue === null || updateOptionRefreshHookByValue === void 0 ? void 0 : updateOptionRefreshHookByValue(value, forceUpdate);
|
|
505
|
-
return function () {
|
|
506
|
-
return updateOptionRefreshHookByValue === null || updateOptionRefreshHookByValue === void 0 ? void 0 : updateOptionRefreshHookByValue(value);
|
|
507
|
-
};
|
|
508
|
-
}, [value, updateOptionRefreshHookByValue, forceUpdate]);
|
|
509
|
-
var handleClick = Object(external_react_["useCallback"])(function (event) {
|
|
510
|
-
onOptionClick === null || onOptionClick === void 0 ? void 0 : onOptionClick(event, {
|
|
511
|
-
value: value
|
|
512
|
-
});
|
|
513
|
-
}, [onOptionClick, value]);
|
|
514
|
-
|
|
515
|
-
if (!getOptionStateForValue) {
|
|
516
|
-
return null;
|
|
517
|
-
}
|
|
518
|
-
|
|
519
|
-
var _getOptionStateForVal = getOptionStateForValue(value),
|
|
520
|
-
active = _getOptionStateForVal.active,
|
|
521
|
-
selectedContext = _getOptionStateForVal.selected;
|
|
522
|
-
|
|
523
|
-
var selected = !!(controlled ? selectedProp : selectedContext);
|
|
524
|
-
return /*#__PURE__*/external_react_default.a.createElement(StyledListItem, Option_extends({
|
|
525
|
-
"aria-selected": selected,
|
|
526
|
-
"data-test": "option",
|
|
527
|
-
"data-test-value": value,
|
|
528
|
-
"data-test-active": active,
|
|
529
|
-
id: id,
|
|
530
|
-
onClick: handleClick,
|
|
531
|
-
role: "option",
|
|
532
|
-
$active: active,
|
|
533
|
-
$selected: selected
|
|
534
|
-
}, otherProps), /*#__PURE__*/external_react_default.a.createElement(StyledSwtich, {
|
|
535
|
-
interactive: false,
|
|
536
|
-
selected: selected,
|
|
537
|
-
appearance: "checkbox"
|
|
538
|
-
}), /*#__PURE__*/external_react_default.a.createElement(StyledDiv, null, label));
|
|
539
|
-
}
|
|
540
|
-
|
|
541
|
-
Option.propTypes = Option_propTypes;
|
|
542
|
-
/* harmony default export */ var DualListbox_Option = (Option);
|
|
543
|
-
// EXTERNAL MODULE: external "@splunk/ui-utils/id"
|
|
544
|
-
var id_ = __webpack_require__(8);
|
|
545
|
-
|
|
546
|
-
// CONCATENATED MODULE: ./src/DualListbox/LabelStyles.ts
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
var StyledLabel = external_styled_components_default.a.label.withConfig({
|
|
550
|
-
displayName: "LabelStyles__StyledLabel",
|
|
551
|
-
componentId: "unwplx-0"
|
|
552
|
-
})(["color:", ";flex:0 0 auto;"], themes_["variables"].contentColorActive);
|
|
553
|
-
var StyledLabelContainer = external_styled_components_default.a.div.withConfig({
|
|
554
|
-
displayName: "LabelStyles__StyledLabelContainer",
|
|
555
|
-
componentId: "unwplx-1"
|
|
556
|
-
})(["display:flex;flex-direction:column;"]);
|
|
557
|
-
var StyledSwitchContainer = external_styled_components_default.a.div.withConfig({
|
|
558
|
-
displayName: "LabelStyles__StyledSwitchContainer",
|
|
559
|
-
componentId: "unwplx-2"
|
|
560
|
-
})(["align-items:center;border:1px solid transparent;display:flex;gap:", ";grid-row:headers;padding:0 ", ";", ""], themes_["variables"].spacingSmall, themes_["variables"].spacingSmall, function (_ref) {
|
|
561
|
-
var $columnNumber = _ref.$columnNumber;
|
|
562
|
-
return Object(external_styled_components_["css"])(["grid-column:", ";"], "list".concat($columnNumber));
|
|
563
|
-
});
|
|
564
|
-
|
|
565
|
-
// CONCATENATED MODULE: ./src/DualListbox/Label.tsx
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
var Label_propTypes = {
|
|
577
|
-
id: external_prop_types_default.a.string.isRequired,
|
|
578
|
-
index: external_prop_types_default.a.number.isRequired,
|
|
579
|
-
listId: external_prop_types_default.a.string.isRequired,
|
|
580
|
-
name: external_prop_types_default.a.string.isRequired,
|
|
581
|
-
onSwitchClick: external_prop_types_default.a.func,
|
|
582
|
-
value: external_prop_types_default.a.string.isRequired
|
|
583
|
-
};
|
|
584
|
-
|
|
585
|
-
function ListboxLabel(_ref) {
|
|
586
|
-
var id = _ref.id,
|
|
587
|
-
index = _ref.index,
|
|
588
|
-
listId = _ref.listId,
|
|
589
|
-
name = _ref.name,
|
|
590
|
-
onSwitchClick = _ref.onSwitchClick,
|
|
591
|
-
value = _ref.value;
|
|
592
|
-
var contextValue = Object(external_react_["useContext"])(DualListbox_ListboxContext);
|
|
593
|
-
var forceUpdate = useForceUpdate_default()();
|
|
594
|
-
var switchIdRef = Object(external_react_["useRef"])(Object(id_["createDOMID"])('switch'));
|
|
595
|
-
var updateLabelRefreshHookByName = contextValue.updateLabelRefreshHookByName,
|
|
596
|
-
getLabelState = contextValue.getLabelState;
|
|
597
|
-
Object(external_react_["useEffect"])(function () {
|
|
598
|
-
updateLabelRefreshHookByName === null || updateLabelRefreshHookByName === void 0 ? void 0 : updateLabelRefreshHookByName(name, forceUpdate);
|
|
599
|
-
return function () {
|
|
600
|
-
return updateLabelRefreshHookByName === null || updateLabelRefreshHookByName === void 0 ? void 0 : updateLabelRefreshHookByName(name);
|
|
601
|
-
};
|
|
602
|
-
}, [name, updateLabelRefreshHookByName, forceUpdate]);
|
|
603
|
-
|
|
604
|
-
if (!getLabelState) {
|
|
605
|
-
return null;
|
|
606
|
-
}
|
|
607
|
-
|
|
608
|
-
var _getLabelState = getLabelState(),
|
|
609
|
-
disabled = _getLabelState.disabled,
|
|
610
|
-
selected = _getLabelState.selected,
|
|
611
|
-
selectedValueCount = _getLabelState.selectedValueCount,
|
|
612
|
-
valueCount = _getLabelState.valueCount;
|
|
613
|
-
|
|
614
|
-
return /*#__PURE__*/external_react_default.a.createElement(StyledSwitchContainer, {
|
|
615
|
-
$columnNumber: index
|
|
616
|
-
}, /*#__PURE__*/external_react_default.a.createElement(ScreenReaderContent_default.a, {
|
|
617
|
-
"aria-hidden": true,
|
|
618
|
-
id: switchIdRef.current
|
|
619
|
-
}, Object(format_["sprintf"])(Object(i18n_["_"])('Select All %(listName)s Options'), {
|
|
620
|
-
listName: value
|
|
621
|
-
})), /*#__PURE__*/external_react_default.a.createElement(Switch_default.a, {
|
|
622
|
-
appearance: "checkbox",
|
|
623
|
-
"data-test": "select-all",
|
|
624
|
-
disabled: disabled,
|
|
625
|
-
labelledBy: switchIdRef.current,
|
|
626
|
-
onClick: onSwitchClick,
|
|
627
|
-
selected: selected,
|
|
628
|
-
value: value
|
|
629
|
-
}), /*#__PURE__*/external_react_default.a.createElement(StyledLabelContainer, null, /*#__PURE__*/external_react_default.a.createElement(StyledLabel, {
|
|
630
|
-
id: id,
|
|
631
|
-
htmlFor: listId
|
|
632
|
-
}, value), /*#__PURE__*/external_react_default.a.createElement("span", {
|
|
633
|
-
"aria-hidden": true
|
|
634
|
-
}, "".concat(selectedValueCount, "/").concat(valueCount, " Selected"))));
|
|
635
|
-
}
|
|
636
|
-
|
|
637
|
-
ListboxLabel.propTypes = Label_propTypes;
|
|
638
|
-
/* harmony default export */ var Label = (ListboxLabel);
|
|
639
|
-
// CONCATENATED MODULE: ./src/DualListbox/ListboxStyles.ts
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
var StyledListbox = external_styled_components_default.a.ul.withConfig({
|
|
643
|
-
displayName: "ListboxStyles__StyledListbox",
|
|
644
|
-
componentId: "sc-11oqtd-0"
|
|
645
|
-
})(["background-color:", ";border:1px solid ", ";border-radius:", ";grid-row:lists;list-style:none;margin:0;min-height:0;min-width:0;overflow:auto;padding:0;position:relative;&:focus{box-shadow:", ";outline:none;}", ""], themes_["variables"].transparent, Object(themes_["pick"])({
|
|
646
|
-
enterprise: themes_["variables"].gray60,
|
|
647
|
-
prisma: themes_["variables"].interactiveColorBorder
|
|
648
|
-
}), themes_["variables"].borderRadius, themes_["variables"].focusShadow, function (_ref) {
|
|
649
|
-
var $columnNumber = _ref.$columnNumber;
|
|
650
|
-
return Object(external_styled_components_["css"])(["grid-column:", ";"], "list".concat($columnNumber));
|
|
651
|
-
});
|
|
652
|
-
|
|
653
|
-
// CONCATENATED MODULE: ./src/DualListbox/Listbox.tsx
|
|
654
|
-
function Listbox_extends() { Listbox_extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return Listbox_extends.apply(this, arguments); }
|
|
655
|
-
|
|
656
|
-
function Listbox_objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = Listbox_objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
657
|
-
|
|
658
|
-
function Listbox_objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
var Listbox_propTypes = {
|
|
668
|
-
children: external_prop_types_default.a.node,
|
|
669
|
-
index: external_prop_types_default.a.number.isRequired,
|
|
670
|
-
label: external_prop_types_default.a.string.isRequired,
|
|
671
|
-
multiSelect: external_prop_types_default.a.bool,
|
|
672
|
-
name: external_prop_types_default.a.string.isRequired,
|
|
673
|
-
onClick: external_prop_types_default.a.func,
|
|
674
|
-
onKeyDown: external_prop_types_default.a.func,
|
|
675
|
-
onSelectAllClick: external_prop_types_default.a.func
|
|
676
|
-
};
|
|
677
|
-
|
|
678
|
-
function Listbox(_ref) {
|
|
679
|
-
var children = _ref.children,
|
|
680
|
-
elementRef = _ref.elementRef,
|
|
681
|
-
index = _ref.index,
|
|
682
|
-
label = _ref.label,
|
|
683
|
-
name = _ref.name,
|
|
684
|
-
onClick = _ref.onClick,
|
|
685
|
-
onKeyDown = _ref.onKeyDown,
|
|
686
|
-
onSelectAllClick = _ref.onSelectAllClick,
|
|
687
|
-
otherProps = Listbox_objectWithoutProperties(_ref, ["children", "elementRef", "index", "label", "name", "onClick", "onKeyDown", "onSelectAllClick"]);
|
|
688
|
-
|
|
689
|
-
var labelIdRef = Object(external_react_["useRef"])(Object(id_["createDOMID"])('label'));
|
|
690
|
-
var idRef = Object(external_react_["useRef"])(Object(id_["createDOMID"])('listbox'));
|
|
691
|
-
|
|
692
|
-
var _useContext = Object(external_react_["useContext"])(DualListbox_DualListboxContext),
|
|
693
|
-
controlled = _useContext.controlled,
|
|
694
|
-
getSelectedStateForValue = _useContext.getSelectedStateForValue,
|
|
695
|
-
getActiveValue = _useContext.getActiveValue,
|
|
696
|
-
getSelectedValueCount = _useContext.getSelectedValueCount,
|
|
697
|
-
getValueCount = _useContext.getValueCount,
|
|
698
|
-
updateLabelRefreshHookByName = _useContext.updateLabelRefreshHookByName,
|
|
699
|
-
updateOptionRefreshHookByValue = _useContext.updateOptionRefreshHookByValue;
|
|
700
|
-
|
|
701
|
-
var handleClick = Object(external_react_["useCallback"])(function (event, _ref2) {
|
|
702
|
-
var value = _ref2.value;
|
|
703
|
-
onClick === null || onClick === void 0 ? void 0 : onClick(event, {
|
|
704
|
-
name: name,
|
|
705
|
-
value: value
|
|
706
|
-
});
|
|
707
|
-
}, [name, onClick]);
|
|
708
|
-
var getOptionStateForValue = Object(external_react_["useCallback"])(function (value) {
|
|
709
|
-
return {
|
|
710
|
-
active: (getActiveValue === null || getActiveValue === void 0 ? void 0 : getActiveValue(name)) === value,
|
|
711
|
-
selected: !!(getSelectedStateForValue === null || getSelectedStateForValue === void 0 ? void 0 : getSelectedStateForValue(value))
|
|
712
|
-
};
|
|
713
|
-
}, [name, getActiveValue, getSelectedStateForValue]);
|
|
714
|
-
var getLabelState = Object(external_react_["useCallback"])(function () {
|
|
715
|
-
var valueCount = (getValueCount === null || getValueCount === void 0 ? void 0 : getValueCount(name)) || 0;
|
|
716
|
-
var selectedValueCount = (getSelectedValueCount === null || getSelectedValueCount === void 0 ? void 0 : getSelectedValueCount(name)) || 0;
|
|
717
|
-
var switchSelected = false;
|
|
718
|
-
|
|
719
|
-
if (selectedValueCount > 0) {
|
|
720
|
-
switchSelected = selectedValueCount === valueCount ? true : 'some';
|
|
721
|
-
}
|
|
722
|
-
|
|
723
|
-
return {
|
|
724
|
-
disabled: valueCount < 1,
|
|
725
|
-
selected: switchSelected,
|
|
726
|
-
selectedValueCount: selectedValueCount,
|
|
727
|
-
valueCount: valueCount
|
|
728
|
-
};
|
|
729
|
-
}, [name, getSelectedValueCount, getValueCount]);
|
|
730
|
-
|
|
731
|
-
var handleKeyDown = function handleKeyDown(event) {
|
|
732
|
-
onKeyDown === null || onKeyDown === void 0 ? void 0 : onKeyDown(event, {
|
|
733
|
-
name: name
|
|
734
|
-
});
|
|
735
|
-
};
|
|
736
|
-
|
|
737
|
-
var handleSwitchClick = function handleSwitchClick(event, _ref3) {
|
|
738
|
-
var selected = _ref3.selected;
|
|
739
|
-
onSelectAllClick === null || onSelectAllClick === void 0 ? void 0 : onSelectAllClick(event, {
|
|
740
|
-
name: name,
|
|
741
|
-
selected: selected
|
|
742
|
-
});
|
|
743
|
-
};
|
|
744
|
-
|
|
745
|
-
var handleMouseDown = function handleMouseDown(event) {
|
|
746
|
-
// this prevents default text selection when using shift + click
|
|
747
|
-
if (event.shiftKey && event.target !== event.currentTarget) {
|
|
748
|
-
event.preventDefault();
|
|
749
|
-
}
|
|
750
|
-
};
|
|
751
|
-
|
|
752
|
-
var contextValue = Object(external_react_["useMemo"])(function () {
|
|
753
|
-
return {
|
|
754
|
-
onOptionClick: handleClick,
|
|
755
|
-
updateLabelRefreshHookByName: updateLabelRefreshHookByName,
|
|
756
|
-
updateOptionRefreshHookByValue: updateOptionRefreshHookByValue,
|
|
757
|
-
getOptionStateForValue: getOptionStateForValue,
|
|
758
|
-
getLabelState: getLabelState,
|
|
759
|
-
controlled: controlled
|
|
760
|
-
};
|
|
761
|
-
}, [handleClick, updateLabelRefreshHookByName, updateOptionRefreshHookByValue, getOptionStateForValue, getLabelState, controlled]);
|
|
762
|
-
return /*#__PURE__*/external_react_default.a.createElement(DualListbox_ListboxContext.Provider, {
|
|
763
|
-
value: contextValue
|
|
764
|
-
}, /*#__PURE__*/external_react_default.a.createElement(Label, {
|
|
765
|
-
id: labelIdRef.current,
|
|
766
|
-
index: index,
|
|
767
|
-
listId: idRef.current,
|
|
768
|
-
name: name,
|
|
769
|
-
onSwitchClick: handleSwitchClick,
|
|
770
|
-
value: label
|
|
771
|
-
}), /*#__PURE__*/external_react_default.a.createElement(StyledListbox, Listbox_extends({
|
|
772
|
-
"aria-activedescendant": "" // Important this value stays static, only updated via DOM maniupulation
|
|
773
|
-
,
|
|
774
|
-
"aria-labelledby": labelIdRef.current,
|
|
775
|
-
"aria-multiselectable": true,
|
|
776
|
-
"data-test": "listbox",
|
|
777
|
-
id: idRef.current,
|
|
778
|
-
onKeyDown: handleKeyDown,
|
|
779
|
-
onMouseDown: handleMouseDown,
|
|
780
|
-
ref: elementRef,
|
|
781
|
-
role: "listbox",
|
|
782
|
-
tabIndex: 0,
|
|
783
|
-
$columnNumber: index
|
|
784
|
-
}, otherProps), children));
|
|
785
|
-
}
|
|
786
|
-
|
|
787
|
-
Listbox.propTypes = Listbox_propTypes;
|
|
788
|
-
/* harmony default export */ var DualListbox_Listbox = (Listbox);
|
|
789
|
-
// EXTERNAL MODULE: external "@splunk/react-ui/Box"
|
|
790
|
-
var Box_ = __webpack_require__(6);
|
|
791
|
-
var Box_default = /*#__PURE__*/__webpack_require__.n(Box_);
|
|
792
|
-
|
|
793
|
-
// CONCATENATED MODULE: ./src/DualListbox/DualListboxStyles.ts
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
var StyledBox = external_styled_components_default()(Box_default.a).withConfig({
|
|
798
|
-
displayName: "DualListboxStyles__StyledBox",
|
|
799
|
-
componentId: "sc-1te6bz0-0"
|
|
800
|
-
})(["display:grid;grid-template-columns:[list0] 180px [actions] min-content [list1] 180px;grid-template-rows:[headers] min-content [lists] 160px;gap:", " ", ";", " ", ""], themes_["variables"].spacingXSmall, themes_["variables"].spacingSmall, function (_ref) {
|
|
801
|
-
var $inline = _ref.$inline;
|
|
802
|
-
return $inline && Object(external_styled_components_["css"])(["display:inline-grid;"]);
|
|
803
|
-
}, function (_ref2) {
|
|
804
|
-
var $fill = _ref2.$fill;
|
|
805
|
-
return $fill && Object(external_styled_components_["css"])(["height:100%;grid-template-columns:[list0] 1fr [actions] min-content [list1] 1fr;grid-template-rows:[headers] min-content [lists] 1fr;position:relative;width:100%;"]);
|
|
806
|
-
});
|
|
807
|
-
var StyledFlexColumn = external_styled_components_default.a.div.withConfig({
|
|
808
|
-
displayName: "DualListboxStyles__StyledFlexColumn",
|
|
809
|
-
componentId: "sc-1te6bz0-1"
|
|
810
|
-
})(["&::before{content:'';grid-column:headers;grid-row:lists;}align-items:center;display:flex;flex-direction:column;gap:", ";grid-column:actions;grid-row:lists;justify-content:center;"], themes_["variables"].spacingSmall);
|
|
811
|
-
|
|
812
|
-
// CONCATENATED MODULE: ./src/DualListbox/DualListbox.tsx
|
|
813
|
-
function DualListbox_extends() { DualListbox_extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return DualListbox_extends.apply(this, arguments); }
|
|
814
|
-
|
|
815
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
816
|
-
|
|
817
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
818
|
-
|
|
819
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
820
|
-
|
|
821
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
822
|
-
|
|
823
|
-
function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
824
|
-
|
|
825
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
826
|
-
|
|
827
|
-
function DualListbox_objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = DualListbox_objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
828
|
-
|
|
829
|
-
function DualListbox_objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
/** @public */
|
|
850
|
-
|
|
851
|
-
var DualListbox_propTypes = {
|
|
852
|
-
children: external_prop_types_default.a.node,
|
|
853
|
-
controlled: external_prop_types_default.a.bool,
|
|
854
|
-
fill: external_prop_types_default.a.bool,
|
|
855
|
-
inline: external_prop_types_default.a.bool,
|
|
856
|
-
onChange: external_prop_types_default.a.func,
|
|
857
|
-
onSelect: external_prop_types_default.a.func,
|
|
858
|
-
lists: external_prop_types_default.a.arrayOf(external_prop_types_default.a.shape({
|
|
859
|
-
name: external_prop_types_default.a.string.isRequired,
|
|
860
|
-
label: external_prop_types_default.a.string.isRequired
|
|
861
|
-
})).isRequired
|
|
862
|
-
};
|
|
863
|
-
|
|
864
|
-
function DualListbox(_ref) {
|
|
865
|
-
var _lists$, _lists$2, _lists$3, _lists$4;
|
|
866
|
-
|
|
867
|
-
var children = _ref.children,
|
|
868
|
-
_ref$controlled = _ref.controlled,
|
|
869
|
-
controlled = _ref$controlled === void 0 ? false : _ref$controlled,
|
|
870
|
-
_ref$fill = _ref.fill,
|
|
871
|
-
fill = _ref$fill === void 0 ? false : _ref$fill,
|
|
872
|
-
_ref$inline = _ref.inline,
|
|
873
|
-
inline = _ref$inline === void 0 ? false : _ref$inline,
|
|
874
|
-
onChange = _ref.onChange,
|
|
875
|
-
onSelect = _ref.onSelect,
|
|
876
|
-
lists = _ref.lists,
|
|
877
|
-
otherProps = DualListbox_objectWithoutProperties(_ref, ["children", "controlled", "fill", "inline", "onChange", "onSelect", "lists"]);
|
|
878
|
-
|
|
879
|
-
// @docs-props-type DualListboxPropsBase
|
|
880
|
-
var forceUpdate = useForceUpdate_default()();
|
|
881
|
-
var mountedRef = Object(external_react_["useRef"])(false);
|
|
882
|
-
Object(external_react_["useEffect"])(function () {
|
|
883
|
-
mountedRef.current = true;
|
|
884
|
-
}, []); // TODO: Implement shared isControlled hook (SUI-5283).
|
|
885
|
-
|
|
886
|
-
var isControlledRef = Object(external_react_["useRef"])(controlled); // List One "Available" Refs
|
|
887
|
-
|
|
888
|
-
var listOneValues = Object(external_react_["useRef"])([]);
|
|
889
|
-
var listOneSelectedValues = Object(external_react_["useRef"])([]);
|
|
890
|
-
var listOneActiveValue = Object(external_react_["useRef"])();
|
|
891
|
-
var listOneNodeRef = Object(external_react_["useRef"])(null);
|
|
892
|
-
var listOneMatchOptions = Object(external_react_["useRef"])([]); // List Two "Selected" Refs
|
|
893
|
-
|
|
894
|
-
var listTwoValues = Object(external_react_["useRef"])([]);
|
|
895
|
-
var listTwoSelectedValues = Object(external_react_["useRef"])([]);
|
|
896
|
-
var listTwoActiveValue = Object(external_react_["useRef"])();
|
|
897
|
-
var listTwoNodeRef = Object(external_react_["useRef"])(null);
|
|
898
|
-
var listTwoMatchOptions = Object(external_react_["useRef"])([]); // Refresh Hook Stores, used to render indivual elements when uncontrolled
|
|
899
|
-
|
|
900
|
-
var buttonRefreshHookByName = Object(external_react_["useRef"])({});
|
|
901
|
-
var labelRefreshHookByName = Object(external_react_["useRef"])({});
|
|
902
|
-
var optionRefreshHookByValue = Object(external_react_["useRef"])({});
|
|
903
|
-
var screenReaderRefreshHook = Object(external_react_["useRef"])(); // Activity Values Refs
|
|
904
|
-
|
|
905
|
-
var screenReaderValueRef = Object(external_react_["useRef"])();
|
|
906
|
-
var selectedByValue = Object(external_react_["useRef"])({});
|
|
907
|
-
var idByValue = Object(external_react_["useRef"])({});
|
|
908
|
-
var indexByValue = Object(external_react_["useRef"])({});
|
|
909
|
-
var initialRangeIndex = Object(external_react_["useRef"])(0); // Key Match Refs
|
|
910
|
-
|
|
911
|
-
var matchCharacter = Object(external_react_["useRef"])();
|
|
912
|
-
var matchTimeout = Object(external_react_["useRef"])();
|
|
913
|
-
var matchOptions = Object(external_react_["useRef"])([]);
|
|
914
|
-
|
|
915
|
-
if (false) {}
|
|
916
|
-
|
|
917
|
-
if (false) {}
|
|
918
|
-
|
|
919
|
-
if (false) {} // Unpack names and labels instead of relying on `lists` being a consistent reference
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
var listOneName = (_lists$ = lists[0]) === null || _lists$ === void 0 ? void 0 : _lists$.name;
|
|
923
|
-
var listTwoName = (_lists$2 = lists[1]) === null || _lists$2 === void 0 ? void 0 : _lists$2.name;
|
|
924
|
-
var listOneLabel = (_lists$3 = lists[0]) === null || _lists$3 === void 0 ? void 0 : _lists$3.label;
|
|
925
|
-
var listTwoLabel = (_lists$4 = lists[1]) === null || _lists$4 === void 0 ? void 0 : _lists$4.label; // Copy previous state for uncontrolled render so it's not voided by following value reset
|
|
926
|
-
|
|
927
|
-
var internalValueSet = new Set(listTwoValues.current); // This ensures we recapture the indexes after batch moves, but will be refactored when sorting is implemented (SUI-5270).
|
|
928
|
-
|
|
929
|
-
listOneValues.current = [];
|
|
930
|
-
listTwoValues.current = [];
|
|
931
|
-
listOneMatchOptions.current = [];
|
|
932
|
-
listTwoMatchOptions.current = []; // Clean the data stores before we copy the references into listData
|
|
933
|
-
|
|
934
|
-
if (!mountedRef.current || isControlledRef.current) {
|
|
935
|
-
listOneSelectedValues.current = [];
|
|
936
|
-
listTwoSelectedValues.current = [];
|
|
937
|
-
selectedByValue.current = {};
|
|
938
|
-
indexByValue.current = {};
|
|
939
|
-
idByValue.current = {};
|
|
940
|
-
}
|
|
941
|
-
|
|
942
|
-
var listData = [{
|
|
943
|
-
options: [],
|
|
944
|
-
matchOptions: listOneMatchOptions.current,
|
|
945
|
-
values: listOneValues.current,
|
|
946
|
-
selectedValues: listOneSelectedValues.current,
|
|
947
|
-
activeValue: listOneActiveValue.current,
|
|
948
|
-
activeFound: !listOneActiveValue.current
|
|
949
|
-
}, {
|
|
950
|
-
options: [],
|
|
951
|
-
matchOptions: listTwoMatchOptions.current,
|
|
952
|
-
values: listTwoValues.current,
|
|
953
|
-
selectedValues: listTwoSelectedValues.current,
|
|
954
|
-
activeValue: listTwoActiveValue.current,
|
|
955
|
-
activeFound: !listTwoActiveValue.current
|
|
956
|
-
}];
|
|
957
|
-
|
|
958
|
-
if (!mountedRef.current || isControlledRef.current) {
|
|
959
|
-
external_react_["Children"].toArray(children).filter(external_react_["isValidElement"]).forEach(function (child) {
|
|
960
|
-
var _child$props = child.props,
|
|
961
|
-
value = _child$props.value,
|
|
962
|
-
label = _child$props.label;
|
|
963
|
-
var isListTwo = child.props.listName === listTwoName;
|
|
964
|
-
var data = listData[isListTwo ? 1 : 0]; // Ensure the active value is found on controlled renders
|
|
965
|
-
|
|
966
|
-
if (!data.activeFound && data.activeValue === value) {
|
|
967
|
-
data.activeFound = true;
|
|
968
|
-
}
|
|
969
|
-
|
|
970
|
-
data.values.push(value);
|
|
971
|
-
data.options.push(child);
|
|
972
|
-
data.matchOptions.push({
|
|
973
|
-
value: value,
|
|
974
|
-
label: label
|
|
975
|
-
});
|
|
976
|
-
var isSelected = !!child.props.selected;
|
|
977
|
-
|
|
978
|
-
if (isSelected) {
|
|
979
|
-
data.selectedValues.push(value);
|
|
980
|
-
}
|
|
981
|
-
|
|
982
|
-
selectedByValue.current[value] = isSelected;
|
|
983
|
-
indexByValue.current[value] = data.values.length - 1;
|
|
984
|
-
idByValue.current[value] = child.props.id;
|
|
985
|
-
});
|
|
986
|
-
} else {
|
|
987
|
-
external_react_["Children"].toArray(children).filter(external_react_["isValidElement"]).forEach(function (child) {
|
|
988
|
-
var _child$props2 = child.props,
|
|
989
|
-
value = _child$props2.value,
|
|
990
|
-
label = _child$props2.label;
|
|
991
|
-
var isListTwo = internalValueSet.has(value);
|
|
992
|
-
var data = listData[isListTwo ? 1 : 0];
|
|
993
|
-
data.values.push(value);
|
|
994
|
-
data.options.push(child);
|
|
995
|
-
data.matchOptions.push({
|
|
996
|
-
value: value,
|
|
997
|
-
label: label
|
|
998
|
-
});
|
|
999
|
-
indexByValue.current[value] = data.values.length - 1;
|
|
1000
|
-
});
|
|
1001
|
-
}
|
|
1002
|
-
|
|
1003
|
-
var setActiveValue = Object(external_react_["useCallback"])(function (name, value) {
|
|
1004
|
-
if (name === listOneName) {
|
|
1005
|
-
listOneActiveValue.current = value;
|
|
1006
|
-
} else {
|
|
1007
|
-
listTwoActiveValue.current = value;
|
|
437
|
+
var J = n().createContext({});
|
|
438
|
+
/* harmony default export */ const Q = J;
|
|
439
|
+
// CONCATENATED MODULE: ./src/DualListbox/Option.tsx
|
|
440
|
+
function Y() {
|
|
441
|
+
Y = Object.assign || function(e) {
|
|
442
|
+
for (var r = 1; r < arguments.length; r++) {
|
|
443
|
+
var t = arguments[r];
|
|
444
|
+
for (var n in t) {
|
|
445
|
+
if (Object.prototype.hasOwnProperty.call(t, n)) {
|
|
446
|
+
e[n] = t[n];
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
return e;
|
|
451
|
+
};
|
|
452
|
+
return Y.apply(this, arguments);
|
|
1008
453
|
}
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
454
|
+
function Z(e, r) {
|
|
455
|
+
if (e == null) return {};
|
|
456
|
+
var t = ee(e, r);
|
|
457
|
+
var n, a;
|
|
458
|
+
if (Object.getOwnPropertySymbols) {
|
|
459
|
+
var i = Object.getOwnPropertySymbols(e);
|
|
460
|
+
for (a = 0; a < i.length; a++) {
|
|
461
|
+
n = i[a];
|
|
462
|
+
if (r.indexOf(n) >= 0) continue;
|
|
463
|
+
if (!Object.prototype.propertyIsEnumerable.call(e, n)) continue;
|
|
464
|
+
t[n] = e[n];
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
return t;
|
|
1018
468
|
}
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
return selectedByValue.current[value];
|
|
1031
|
-
}, []);
|
|
1032
|
-
var setValues = Object(external_react_["useCallback"])(function (name, values) {
|
|
1033
|
-
if (name === listOneName) {
|
|
1034
|
-
listOneValues.current = values;
|
|
1035
|
-
} else {
|
|
1036
|
-
listTwoValues.current = values;
|
|
469
|
+
function ee(e, r) {
|
|
470
|
+
if (e == null) return {};
|
|
471
|
+
var t = {};
|
|
472
|
+
var n = Object.keys(e);
|
|
473
|
+
var a, i;
|
|
474
|
+
for (i = 0; i < n.length; i++) {
|
|
475
|
+
a = n[i];
|
|
476
|
+
if (r.indexOf(a) >= 0) continue;
|
|
477
|
+
t[a] = e[a];
|
|
478
|
+
}
|
|
479
|
+
return t;
|
|
1037
480
|
}
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
}, [getValues]);
|
|
1045
|
-
var getIsAllSelected = Object(external_react_["useCallback"])(function (name) {
|
|
1046
|
-
var valueCount = getValueCount(name);
|
|
1047
|
-
return valueCount > 0 && valueCount === getSelectedValueCount(name);
|
|
1048
|
-
}, [getValueCount, getSelectedValueCount]);
|
|
1049
|
-
var getAvailableMatchOptions = Object(external_react_["useCallback"])(function (name) {
|
|
1050
|
-
return name === listOneName ? listOneMatchOptions.current : listTwoMatchOptions.current;
|
|
1051
|
-
}, [listOneName]);
|
|
1052
|
-
var getButtonState = Object(external_react_["useCallback"])(function (name) {
|
|
1053
|
-
var valueCount = getValueCount(name);
|
|
1054
|
-
var selectedValueCount = getSelectedValueCount(name);
|
|
1055
|
-
return {
|
|
1056
|
-
disabled: valueCount < 1 || selectedValueCount < 1
|
|
481
|
+
var re = {
|
|
482
|
+
id: i().string.isRequired,
|
|
483
|
+
label: i().string.isRequired,
|
|
484
|
+
listName: i().string,
|
|
485
|
+
selected: i().bool,
|
|
486
|
+
value: i().string.isRequired
|
|
1057
487
|
};
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
} else {
|
|
1096
|
-
delete buttonRefreshHookByName.current[name];
|
|
1097
|
-
}
|
|
1098
|
-
}, []);
|
|
1099
|
-
var updateOption = Object(external_react_["useCallback"])(function (value) {
|
|
1100
|
-
if (value) {
|
|
1101
|
-
var _optionRefreshHookByV, _optionRefreshHookByV2;
|
|
1102
|
-
|
|
1103
|
-
(_optionRefreshHookByV = (_optionRefreshHookByV2 = optionRefreshHookByValue.current)[value]) === null || _optionRefreshHookByV === void 0 ? void 0 : _optionRefreshHookByV.call(_optionRefreshHookByV2);
|
|
1104
|
-
}
|
|
1105
|
-
}, []);
|
|
1106
|
-
var updateLabel = Object(external_react_["useCallback"])(function (name) {
|
|
1107
|
-
if (name) {
|
|
1108
|
-
var _labelRefreshHookByNa, _labelRefreshHookByNa2;
|
|
1109
|
-
|
|
1110
|
-
(_labelRefreshHookByNa = (_labelRefreshHookByNa2 = labelRefreshHookByName.current)[name]) === null || _labelRefreshHookByNa === void 0 ? void 0 : _labelRefreshHookByNa.call(_labelRefreshHookByNa2);
|
|
1111
|
-
}
|
|
1112
|
-
}, []);
|
|
1113
|
-
var updateButton = Object(external_react_["useCallback"])(function (name) {
|
|
1114
|
-
if (name) {
|
|
1115
|
-
var _buttonRefreshHookByN, _buttonRefreshHookByN2;
|
|
1116
|
-
|
|
1117
|
-
(_buttonRefreshHookByN = (_buttonRefreshHookByN2 = buttonRefreshHookByName.current)[name]) === null || _buttonRefreshHookByN === void 0 ? void 0 : _buttonRefreshHookByN.call(_buttonRefreshHookByN2);
|
|
1118
|
-
}
|
|
1119
|
-
}, []);
|
|
1120
|
-
var updateInternalDisplay = Object(external_react_["useCallback"])(function (name) {
|
|
1121
|
-
clearScreenReaderText();
|
|
1122
|
-
updateLabel(name);
|
|
1123
|
-
updateButton(listOneName);
|
|
1124
|
-
updateButton(listTwoName);
|
|
1125
|
-
}, [clearScreenReaderText, updateButton, updateLabel, listOneName, listTwoName]);
|
|
1126
|
-
var updateActiveOption = Object(external_react_["useCallback"])(function (name, value) {
|
|
1127
|
-
var skipRender = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
1128
|
-
var listbox = name === listOneName ? listOneNodeRef.current : listTwoNodeRef.current;
|
|
1129
|
-
|
|
1130
|
-
if (!listbox) {
|
|
1131
|
-
return;
|
|
1132
|
-
}
|
|
1133
|
-
|
|
1134
|
-
var previousValue = getActiveValue(name);
|
|
1135
|
-
setActiveValue(name, value);
|
|
1136
|
-
|
|
1137
|
-
if (!skipRender) {
|
|
1138
|
-
// render new
|
|
1139
|
-
updateOption(value);
|
|
488
|
+
function te(e) {
|
|
489
|
+
var r = e.id, a = e.label, i = e.selected, l = e.value, o = Z(e, [ "id", "label", "selected", "value" ]);
|
|
490
|
+
var u = (0, t.useContext)(Q);
|
|
491
|
+
var c = p()();
|
|
492
|
+
var s = u.onOptionClick, v = u.getOptionStateForValue, d = u.updateOptionRefreshHookByValue, f = u.controlled;
|
|
493
|
+
(0, t.useEffect)((function() {
|
|
494
|
+
d === null || d === void 0 ? void 0 : d(l, c);
|
|
495
|
+
return function() {
|
|
496
|
+
return d === null || d === void 0 ? void 0 : d(l);
|
|
497
|
+
};
|
|
498
|
+
}), [ l, d, c ]);
|
|
499
|
+
var b = (0, t.useCallback)((function(e) {
|
|
500
|
+
s === null || s === void 0 ? void 0 : s(e, {
|
|
501
|
+
value: l
|
|
502
|
+
});
|
|
503
|
+
}), [ s, l ]);
|
|
504
|
+
if (!v) {
|
|
505
|
+
return null;
|
|
506
|
+
}
|
|
507
|
+
var m = v(l), h = m.active, g = m.selected;
|
|
508
|
+
var y = !!(f ? i : g);
|
|
509
|
+
|
|
510
|
+
return n().createElement(W, Y({
|
|
511
|
+
"aria-selected": y,
|
|
512
|
+
"data-test": "option",
|
|
513
|
+
"data-test-value": l,
|
|
514
|
+
"data-test-active": h,
|
|
515
|
+
id: r,
|
|
516
|
+
onClick: b,
|
|
517
|
+
role: "option",
|
|
518
|
+
$active: h,
|
|
519
|
+
$selected: y
|
|
520
|
+
}, o), n().createElement(X, {
|
|
521
|
+
interactive: false,
|
|
522
|
+
selected: y,
|
|
523
|
+
appearance: "checkbox"
|
|
524
|
+
}), n().createElement(G, null, a));
|
|
1140
525
|
}
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
526
|
+
te.propTypes = re;
|
|
527
|
+
/* harmony default export */ const ne = te;
|
|
528
|
+
// CONCATENATED MODULE: external "@splunk/ui-utils/id"
|
|
529
|
+
const ae = require("@splunk/ui-utils/id");
|
|
530
|
+
// CONCATENATED MODULE: ./src/DualListbox/LabelStyles.ts
|
|
531
|
+
var ie = D().label.withConfig({
|
|
532
|
+
displayName: "LabelStyles__StyledLabel",
|
|
533
|
+
componentId: "unwplx-0"
|
|
534
|
+
})([ "color:", ";flex:0 0 auto;" ], N.variables.contentColorActive);
|
|
535
|
+
var le = D().div.withConfig({
|
|
536
|
+
displayName: "LabelStyles__StyledLabelContainer",
|
|
537
|
+
componentId: "unwplx-1"
|
|
538
|
+
})([ "display:flex;flex-direction:column;" ]);
|
|
539
|
+
var oe = D().div.withConfig({
|
|
540
|
+
displayName: "LabelStyles__StyledSwitchContainer",
|
|
541
|
+
componentId: "unwplx-2"
|
|
542
|
+
})([ "align-items:center;border:1px solid transparent;display:flex;gap:", ";grid-row:headers;padding:0 ", ";", "" ], N.variables.spacingSmall, N.variables.spacingSmall, (function(e) {
|
|
543
|
+
var r = e.$columnNumber;
|
|
544
|
+
return (0, _.css)([ "grid-column:", ";" ], "list".concat(r));
|
|
545
|
+
}));
|
|
546
|
+
// CONCATENATED MODULE: ./src/DualListbox/Label.tsx
|
|
547
|
+
var ue = {
|
|
548
|
+
id: i().string.isRequired,
|
|
549
|
+
index: i().number.isRequired,
|
|
550
|
+
listId: i().string.isRequired,
|
|
551
|
+
name: i().string.isRequired,
|
|
552
|
+
onSwitchClick: i().func,
|
|
553
|
+
value: i().string.isRequired
|
|
554
|
+
};
|
|
555
|
+
function ce(e) {
|
|
556
|
+
var r = e.id, a = e.index, i = e.listId, o = e.name, u = e.onSwitchClick, c = e.value;
|
|
557
|
+
var s = (0, t.useContext)(Q);
|
|
558
|
+
var v = p()();
|
|
559
|
+
var f = (0, t.useRef)((0, ae.createDOMID)("switch"));
|
|
560
|
+
var b = s.updateLabelRefreshHookByName, h = s.getLabelState;
|
|
561
|
+
(0, t.useEffect)((function() {
|
|
562
|
+
b === null || b === void 0 ? void 0 : b(o, v);
|
|
563
|
+
return function() {
|
|
564
|
+
return b === null || b === void 0 ? void 0 : b(o);
|
|
565
|
+
};
|
|
566
|
+
}), [ o, b, v ]);
|
|
567
|
+
if (!h) {
|
|
568
|
+
return null;
|
|
569
|
+
}
|
|
570
|
+
var g = h(), y = g.disabled, k = g.selected, C = g.selectedValueCount, x = g.valueCount;
|
|
571
|
+
|
|
572
|
+
return n().createElement(oe, {
|
|
573
|
+
$columnNumber: a
|
|
574
|
+
}, n().createElement(m(), {
|
|
575
|
+
"aria-hidden": true,
|
|
576
|
+
id: f.current
|
|
577
|
+
}, (0, d.sprintf)((0, l._)("Select All %(listName)s Options"), {
|
|
578
|
+
listName: c
|
|
579
|
+
})), n().createElement(U(), {
|
|
580
|
+
appearance: "checkbox",
|
|
581
|
+
"data-test": "select-all",
|
|
582
|
+
disabled: y,
|
|
583
|
+
labelledBy: f.current,
|
|
584
|
+
onClick: u,
|
|
585
|
+
selected: k,
|
|
586
|
+
value: c
|
|
587
|
+
}), n().createElement(le, null, n().createElement(ie, {
|
|
588
|
+
id: r,
|
|
589
|
+
htmlFor: i
|
|
590
|
+
}, c), n().createElement("span", {
|
|
591
|
+
"aria-hidden": true
|
|
592
|
+
}, "".concat(C, "/").concat(x, " Selected"))));
|
|
1156
593
|
}
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
594
|
+
ce.propTypes = ue;
|
|
595
|
+
/* harmony default export */ const se = ce;
|
|
596
|
+
// CONCATENATED MODULE: ./src/DualListbox/ListboxStyles.ts
|
|
597
|
+
var ve = D().ul.withConfig({
|
|
598
|
+
displayName: "ListboxStyles__StyledListbox",
|
|
599
|
+
componentId: "sc-11oqtd-0"
|
|
600
|
+
})([ "background-color:", ";border:1px solid ", ";border-radius:", ";grid-row:lists;list-style:none;margin:0;min-height:0;min-width:0;overflow:auto;padding:0;position:relative;&:focus{box-shadow:", ";outline:none;}", "" ], N.variables.transparent, (0,
|
|
601
|
+
N.pick)({
|
|
602
|
+
enterprise: N.variables.gray60,
|
|
603
|
+
prisma: N.variables.interactiveColorBorder
|
|
604
|
+
}), N.variables.borderRadius, N.variables.focusShadow, (function(e) {
|
|
605
|
+
var r = e.$columnNumber;
|
|
606
|
+
return (0, _.css)([ "grid-column:", ";" ], "list".concat(r));
|
|
607
|
+
}));
|
|
608
|
+
// CONCATENATED MODULE: ./src/DualListbox/Listbox.tsx
|
|
609
|
+
function de() {
|
|
610
|
+
de = Object.assign || function(e) {
|
|
611
|
+
for (var r = 1; r < arguments.length; r++) {
|
|
612
|
+
var t = arguments[r];
|
|
613
|
+
for (var n in t) {
|
|
614
|
+
if (Object.prototype.hasOwnProperty.call(t, n)) {
|
|
615
|
+
e[n] = t[n];
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
return e;
|
|
620
|
+
};
|
|
621
|
+
return de.apply(this, arguments);
|
|
1168
622
|
}
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
var valuesArr = getValues(name);
|
|
1182
|
-
var startIndex = Math.min(initialIndex, targetIndex);
|
|
1183
|
-
var endIndex = Math.max(initialIndex, targetIndex);
|
|
1184
|
-
var newValues = [];
|
|
1185
|
-
|
|
1186
|
-
if (isControlledRef.current) {
|
|
1187
|
-
newValues = valuesArr.slice(startIndex, endIndex + 1);
|
|
1188
|
-
} else {
|
|
1189
|
-
valuesArr.forEach(function (value, index) {
|
|
1190
|
-
var newSelectedState = false;
|
|
1191
|
-
|
|
1192
|
-
if (index >= startIndex && index <= endIndex) {
|
|
1193
|
-
newSelectedState = true;
|
|
1194
|
-
newValues.push(value);
|
|
1195
|
-
} else {
|
|
1196
|
-
newSelectedState = false;
|
|
1197
|
-
}
|
|
1198
|
-
|
|
1199
|
-
if (selectedByValue.current[value] !== newSelectedState) {
|
|
1200
|
-
selectedByValue.current[value] = newSelectedState;
|
|
1201
|
-
updateOption(value);
|
|
623
|
+
function fe(e, r) {
|
|
624
|
+
if (e == null) return {};
|
|
625
|
+
var t = pe(e, r);
|
|
626
|
+
var n, a;
|
|
627
|
+
if (Object.getOwnPropertySymbols) {
|
|
628
|
+
var i = Object.getOwnPropertySymbols(e);
|
|
629
|
+
for (a = 0; a < i.length; a++) {
|
|
630
|
+
n = i[a];
|
|
631
|
+
if (r.indexOf(n) >= 0) continue;
|
|
632
|
+
if (!Object.prototype.propertyIsEnumerable.call(e, n)) continue;
|
|
633
|
+
t[n] = e[n];
|
|
634
|
+
}
|
|
1202
635
|
}
|
|
1203
|
-
|
|
1204
|
-
setSelectedValues(name, newValues);
|
|
1205
|
-
updateInternalDisplay(name);
|
|
636
|
+
return t;
|
|
1206
637
|
}
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
var handleSelectAll = Object(external_react_["useCallback"])(function (event, _ref4) {
|
|
1217
|
-
var name = _ref4.name,
|
|
1218
|
-
selected = _ref4.selected;
|
|
1219
|
-
var listValues = getValues(name);
|
|
1220
|
-
var newValues = selected === true ? [] : listValues;
|
|
1221
|
-
var newState = selected !== true;
|
|
1222
|
-
|
|
1223
|
-
if (!isControlledRef.current) {
|
|
1224
|
-
listValues === null || listValues === void 0 ? void 0 : listValues.forEach(function (value) {
|
|
1225
|
-
if (selectedByValue.current[value] !== newState) {
|
|
1226
|
-
selectedByValue.current[value] = newState;
|
|
1227
|
-
updateOption(value);
|
|
638
|
+
function pe(e, r) {
|
|
639
|
+
if (e == null) return {};
|
|
640
|
+
var t = {};
|
|
641
|
+
var n = Object.keys(e);
|
|
642
|
+
var a, i;
|
|
643
|
+
for (i = 0; i < n.length; i++) {
|
|
644
|
+
a = n[i];
|
|
645
|
+
if (r.indexOf(a) >= 0) continue;
|
|
646
|
+
t[a] = e[a];
|
|
1228
647
|
}
|
|
1229
|
-
|
|
1230
|
-
setSelectedValues(name, newValues);
|
|
1231
|
-
updateInternalDisplay(name);
|
|
648
|
+
return t;
|
|
1232
649
|
}
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
650
|
+
var be = {
|
|
651
|
+
children: i().node,
|
|
652
|
+
index: i().number.isRequired,
|
|
653
|
+
label: i().string.isRequired,
|
|
654
|
+
multiSelect: i().bool,
|
|
655
|
+
name: i().string.isRequired,
|
|
656
|
+
onClick: i().func,
|
|
657
|
+
onKeyDown: i().func,
|
|
658
|
+
onSelectAllClick: i().func
|
|
659
|
+
};
|
|
660
|
+
function me(e) {
|
|
661
|
+
var r = e.children, a = e.elementRef, i = e.index, l = e.label, o = e.name, u = e.onClick, c = e.onKeyDown, s = e.onSelectAllClick, v = fe(e, [ "children", "elementRef", "index", "label", "name", "onClick", "onKeyDown", "onSelectAllClick" ]);
|
|
662
|
+
var d = (0, t.useRef)((0, ae.createDOMID)("label"));
|
|
663
|
+
var f = (0, t.useRef)((0, ae.createDOMID)("listbox"));
|
|
664
|
+
var p = (0, t.useContext)(g), b = p.controlled, m = p.getSelectedStateForValue, h = p.getActiveValue, y = p.getSelectedValueCount, k = p.getValueCount, C = p.updateLabelRefreshHookByName, x = p.updateOptionRefreshHookByValue;
|
|
665
|
+
var S = (0, t.useCallback)((function(e, r) {
|
|
666
|
+
var t = r.value;
|
|
667
|
+
u === null || u === void 0 ? void 0 : u(e, {
|
|
668
|
+
name: o,
|
|
669
|
+
value: t
|
|
670
|
+
});
|
|
671
|
+
}), [ o, u ]);
|
|
672
|
+
var w = (0, t.useCallback)((function(e) {
|
|
673
|
+
return {
|
|
674
|
+
active: (h === null || h === void 0 ? void 0 : h(o)) === e,
|
|
675
|
+
selected: !!(m === null || m === void 0 ? void 0 : m(e))
|
|
676
|
+
};
|
|
677
|
+
}), [ o, h, m ]);
|
|
678
|
+
var O = (0, t.useCallback)((function() {
|
|
679
|
+
var e = (k === null || k === void 0 ? void 0 : k(o)) || 0;
|
|
680
|
+
var r = (y === null || y === void 0 ? void 0 : y(o)) || 0;
|
|
681
|
+
var t = false;
|
|
682
|
+
if (r > 0) {
|
|
683
|
+
t = r === e ? true : "some";
|
|
684
|
+
}
|
|
685
|
+
return {
|
|
686
|
+
disabled: e < 1,
|
|
687
|
+
selected: t,
|
|
688
|
+
selectedValueCount: r,
|
|
689
|
+
valueCount: e
|
|
690
|
+
};
|
|
691
|
+
}), [ o, y, k ]);
|
|
692
|
+
var R = function e(r) {
|
|
693
|
+
c === null || c === void 0 ? void 0 : c(r, {
|
|
694
|
+
name: o
|
|
695
|
+
});
|
|
696
|
+
};
|
|
697
|
+
var E = function e(r, t) {
|
|
698
|
+
var n = t.selected;
|
|
699
|
+
s === null || s === void 0 ? void 0 : s(r, {
|
|
700
|
+
name: o,
|
|
701
|
+
selected: n
|
|
702
|
+
});
|
|
703
|
+
};
|
|
704
|
+
var I = function e(r) {
|
|
705
|
+
// this prevents default text selection when using shift + click
|
|
706
|
+
if (r.shiftKey && r.target !== r.currentTarget) {
|
|
707
|
+
r.preventDefault();
|
|
708
|
+
}
|
|
709
|
+
};
|
|
710
|
+
var L = (0, t.useMemo)((function() {
|
|
711
|
+
return {
|
|
712
|
+
onOptionClick: S,
|
|
713
|
+
updateLabelRefreshHookByName: C,
|
|
714
|
+
updateOptionRefreshHookByValue: x,
|
|
715
|
+
getOptionStateForValue: w,
|
|
716
|
+
getLabelState: O,
|
|
717
|
+
controlled: b
|
|
718
|
+
};
|
|
719
|
+
}), [ S, C, x, w, O, b ]);
|
|
720
|
+
|
|
721
|
+
return n().createElement(Q.Provider, {
|
|
722
|
+
value: L
|
|
723
|
+
}, n().createElement(se, {
|
|
724
|
+
id: d.current,
|
|
725
|
+
index: i,
|
|
726
|
+
listId: f.current,
|
|
727
|
+
name: o,
|
|
728
|
+
onSwitchClick: E,
|
|
729
|
+
value: l
|
|
730
|
+
}), n().createElement(ve, de({
|
|
731
|
+
"aria-activedescendant": "",
|
|
732
|
+
"aria-labelledby": d.current,
|
|
733
|
+
"aria-multiselectable": true,
|
|
734
|
+
"data-test": "listbox",
|
|
735
|
+
id: f.current,
|
|
736
|
+
onKeyDown: R,
|
|
737
|
+
onMouseDown: I,
|
|
738
|
+
ref: a,
|
|
739
|
+
role: "listbox",
|
|
740
|
+
tabIndex: 0,
|
|
741
|
+
$columnNumber: i
|
|
742
|
+
}, v), r));
|
|
1250
743
|
}
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
744
|
+
me.propTypes = be;
|
|
745
|
+
/* harmony default export */ const he = me;
|
|
746
|
+
// CONCATENATED MODULE: external "@splunk/react-ui/Box"
|
|
747
|
+
const ge = require("@splunk/react-ui/Box");
|
|
748
|
+
var ye = e.n(ge);
|
|
749
|
+
// CONCATENATED MODULE: ./src/DualListbox/DualListboxStyles.ts
|
|
750
|
+
var ke = D()(ye()).withConfig({
|
|
751
|
+
displayName: "DualListboxStyles__StyledBox",
|
|
752
|
+
componentId: "sc-1te6bz0-0"
|
|
753
|
+
})([ "display:grid;grid-template-columns:[list0] 180px [actions] min-content [list1] 180px;grid-template-rows:[headers] min-content [lists] 160px;gap:", " ", ";", " ", "" ], N.variables.spacingXSmall, N.variables.spacingSmall, (function(e) {
|
|
754
|
+
var r = e.$inline;
|
|
755
|
+
return r && (0, _.css)([ "display:inline-grid;" ]);
|
|
756
|
+
}), (function(e) {
|
|
757
|
+
var r = e.$fill;
|
|
758
|
+
return r && (0, _.css)([ "height:100%;grid-template-columns:[list0] 1fr [actions] min-content [list1] 1fr;grid-template-rows:[headers] min-content [lists] 1fr;position:relative;width:100%;" ]);
|
|
759
|
+
}));
|
|
760
|
+
var Ce = D().div.withConfig({
|
|
761
|
+
displayName: "DualListboxStyles__StyledFlexColumn",
|
|
762
|
+
componentId: "sc-1te6bz0-1"
|
|
763
|
+
})([ "&::before{content:'';grid-column:headers;grid-row:lists;}align-items:center;display:flex;flex-direction:column;gap:", ";grid-column:actions;grid-row:lists;justify-content:center;" ], N.variables.spacingSmall);
|
|
764
|
+
// CONCATENATED MODULE: ./src/DualListbox/DualListbox.tsx
|
|
765
|
+
function xe() {
|
|
766
|
+
xe = Object.assign || function(e) {
|
|
767
|
+
for (var r = 1; r < arguments.length; r++) {
|
|
768
|
+
var t = arguments[r];
|
|
769
|
+
for (var n in t) {
|
|
770
|
+
if (Object.prototype.hasOwnProperty.call(t, n)) {
|
|
771
|
+
e[n] = t[n];
|
|
772
|
+
}
|
|
773
|
+
}
|
|
774
|
+
}
|
|
775
|
+
return e;
|
|
776
|
+
};
|
|
777
|
+
return xe.apply(this, arguments);
|
|
1256
778
|
}
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
count: sourceSelectedValues.length,
|
|
1260
|
-
listLabel: targetName === listOneName ? listOneLabel : listTwoLabel
|
|
1261
|
-
}); // These new values do not perserve sort position, may need to be refactored with sort logic (SUI-5270).
|
|
1262
|
-
|
|
1263
|
-
var newSourceValues = sourceIsAllSelected ? [] : arrayWithRemovedValues(sourceValues, sourceSelectedValues);
|
|
1264
|
-
var newTargetValues = targetValues.concat(sourceSelectedValues);
|
|
1265
|
-
|
|
1266
|
-
if (!isControlledRef.current) {
|
|
1267
|
-
sourceSelectedValues.forEach(function (value) {
|
|
1268
|
-
selectedByValue.current[value] = false;
|
|
1269
|
-
});
|
|
1270
|
-
setValues(targetName, newTargetValues);
|
|
1271
|
-
setValues(sourceName, newSourceValues);
|
|
1272
|
-
setSelectedValues(sourceName, []);
|
|
1273
|
-
screenReaderValueRef.current = message; // move is a batch update, force a full render, no internal update needed
|
|
1274
|
-
|
|
1275
|
-
forceUpdate();
|
|
779
|
+
function Se(e, r) {
|
|
780
|
+
return Ie(e) || Ee(e, r) || Oe(e, r) || we();
|
|
1276
781
|
}
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
affectedValues: sourceSelectedValues,
|
|
1280
|
-
sourceListName: sourceName || '',
|
|
1281
|
-
sourceValues: newSourceValues,
|
|
1282
|
-
targetListName: targetName || '',
|
|
1283
|
-
targetValues: newTargetValues,
|
|
1284
|
-
screenReaderMessage: message || '',
|
|
1285
|
-
values: sourceSelectedValues.slice()
|
|
1286
|
-
};
|
|
1287
|
-
event.preventDefault();
|
|
1288
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(event, data);
|
|
1289
|
-
}, [forceUpdate, getActiveValue, getIsAllSelected, getSelectedValues, getValues, onChange, setSelectedValues, setValues, updateActiveOption, listOneName, listOneLabel, listTwoLabel]);
|
|
1290
|
-
var handleToolbarButtonClick = Object(external_react_["useCallback"])(function (event, _ref5) {
|
|
1291
|
-
var name = _ref5.name;
|
|
1292
|
-
var isAllSelected = getIsAllSelected(name);
|
|
1293
|
-
var activeValue = getActiveValue(name);
|
|
1294
|
-
var targetName = name === listOneName ? listTwoName : listOneName;
|
|
1295
|
-
|
|
1296
|
-
if (activeValue && (isAllSelected || !!selectedByValue.current[activeValue])) {
|
|
1297
|
-
// active option was present in items to be removed, clear the active option
|
|
1298
|
-
updateActiveOption(name);
|
|
782
|
+
function we() {
|
|
783
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
1299
784
|
}
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
if (event.nativeEvent.shiftKey) {
|
|
1308
|
-
handleRangeSelection(event, {
|
|
1309
|
-
targetIndex: indexByValue.current[value],
|
|
1310
|
-
initialIndex: initialRangeIndex.current,
|
|
1311
|
-
name: name
|
|
1312
|
-
});
|
|
1313
|
-
} else {
|
|
1314
|
-
handleSingleSelection(event, {
|
|
1315
|
-
name: name,
|
|
1316
|
-
value: value
|
|
1317
|
-
});
|
|
785
|
+
function Oe(e, r) {
|
|
786
|
+
if (!e) return;
|
|
787
|
+
if (typeof e === "string") return Re(e, r);
|
|
788
|
+
var t = Object.prototype.toString.call(e).slice(8, -1);
|
|
789
|
+
if (t === "Object" && e.constructor) t = e.constructor.name;
|
|
790
|
+
if (t === "Map" || t === "Set") return Array.from(e);
|
|
791
|
+
if (t === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)) return Re(e, r);
|
|
1318
792
|
}
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
var handleKeyMatch = Object(external_react_["useCallback"])(function (e, name) {
|
|
1324
|
-
var currentKey = e.nativeEvent.key;
|
|
1325
|
-
var availableOptions = getAvailableMatchOptions(name); // Checking for a single character to avoid complications from double-byte languages and emojis.
|
|
1326
|
-
|
|
1327
|
-
if (currentKey.length === 1) {
|
|
1328
|
-
var matches = [];
|
|
1329
|
-
var character = {
|
|
1330
|
-
index: 0,
|
|
1331
|
-
value: currentKey
|
|
1332
|
-
};
|
|
1333
|
-
|
|
1334
|
-
if (!matchCharacter.current) {
|
|
1335
|
-
if (currentKey === ' ') {
|
|
1336
|
-
resetMatches();
|
|
1337
|
-
return;
|
|
793
|
+
function Re(e, r) {
|
|
794
|
+
if (r == null || r > e.length) r = e.length;
|
|
795
|
+
for (var t = 0, n = new Array(r); t < r; t++) {
|
|
796
|
+
n[t] = e[t];
|
|
1338
797
|
}
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
798
|
+
return n;
|
|
799
|
+
}
|
|
800
|
+
function Ee(e, r) {
|
|
801
|
+
if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(e))) return;
|
|
802
|
+
var t = [];
|
|
803
|
+
var n = true;
|
|
804
|
+
var a = false;
|
|
805
|
+
var i = undefined;
|
|
806
|
+
try {
|
|
807
|
+
for (var l = e[Symbol.iterator](), o; !(n = (o = l.next()).done); n = true) {
|
|
808
|
+
t.push(o.value);
|
|
809
|
+
if (r && t.length === r) break;
|
|
810
|
+
}
|
|
811
|
+
} catch (e) {
|
|
812
|
+
a = true;
|
|
813
|
+
i = e;
|
|
814
|
+
} finally {
|
|
815
|
+
try {
|
|
816
|
+
if (!n && l["return"] != null) l["return"]();
|
|
817
|
+
} finally {
|
|
818
|
+
if (a) throw i;
|
|
1359
819
|
}
|
|
1360
|
-
}
|
|
1361
820
|
}
|
|
1362
|
-
|
|
1363
|
-
updateActiveOption(name, matches[matchIndex].value);
|
|
1364
|
-
}
|
|
1365
|
-
|
|
1366
|
-
matchOptions.current = matches;
|
|
1367
|
-
matchCharacter.current = character;
|
|
1368
|
-
|
|
1369
|
-
if (matchTimeout.current) {
|
|
1370
|
-
clearTimeout(matchTimeout.current);
|
|
1371
|
-
}
|
|
1372
|
-
|
|
1373
|
-
matchTimeout.current = setTimeout(resetMatches, 500);
|
|
1374
|
-
e.preventDefault();
|
|
1375
|
-
e.stopPropagation();
|
|
821
|
+
return t;
|
|
1376
822
|
}
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
var name = _ref7.name;
|
|
1380
|
-
var eventKeyCode = Object(keyboard_["keycode"])(event.nativeEvent);
|
|
1381
|
-
var listboxValues = getValues(name);
|
|
1382
|
-
var listboxSelectedValues = getSelectedValues(name);
|
|
1383
|
-
var isAllSelected = getIsAllSelected(name);
|
|
1384
|
-
var activeValue = getActiveValue(name);
|
|
1385
|
-
var activeIndex = activeValue ? indexByValue.current[activeValue] : -1;
|
|
1386
|
-
var initialIndex = initialRangeIndex.current >= 0 ? initialRangeIndex.current : 0;
|
|
1387
|
-
|
|
1388
|
-
if (screenReaderValueRef.current && screenReaderValueRef.current.length > 0) {
|
|
1389
|
-
clearScreenReaderText();
|
|
823
|
+
function Ie(e) {
|
|
824
|
+
if (Array.isArray(e)) return e;
|
|
1390
825
|
}
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
targetIndex: 0,
|
|
1404
|
-
initialIndex: initialIndex,
|
|
1405
|
-
name: name
|
|
1406
|
-
});
|
|
1407
|
-
} else {
|
|
1408
|
-
var _listboxValues = _slicedToArray(listboxValues, 1);
|
|
1409
|
-
|
|
1410
|
-
nextActiveValue = _listboxValues[0];
|
|
826
|
+
function Le(e, r) {
|
|
827
|
+
if (e == null) return {};
|
|
828
|
+
var t = qe(e, r);
|
|
829
|
+
var n, a;
|
|
830
|
+
if (Object.getOwnPropertySymbols) {
|
|
831
|
+
var i = Object.getOwnPropertySymbols(e);
|
|
832
|
+
for (a = 0; a < i.length; a++) {
|
|
833
|
+
n = i[a];
|
|
834
|
+
if (r.indexOf(n) >= 0) continue;
|
|
835
|
+
if (!Object.prototype.propertyIsEnumerable.call(e, n)) continue;
|
|
836
|
+
t[n] = e[n];
|
|
837
|
+
}
|
|
1411
838
|
}
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
} else {
|
|
1424
|
-
nextActiveValue = listboxValues[listboxValues.length - 1];
|
|
839
|
+
return t;
|
|
840
|
+
}
|
|
841
|
+
function qe(e, r) {
|
|
842
|
+
if (e == null) return {};
|
|
843
|
+
var t = {};
|
|
844
|
+
var n = Object.keys(e);
|
|
845
|
+
var a, i;
|
|
846
|
+
for (i = 0; i < n.length; i++) {
|
|
847
|
+
a = n[i];
|
|
848
|
+
if (r.indexOf(a) >= 0) continue;
|
|
849
|
+
t[a] = e[a];
|
|
1425
850
|
}
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
851
|
+
return t;
|
|
852
|
+
}
|
|
853
|
+
/** @public */ var je = {
|
|
854
|
+
children: i().node,
|
|
855
|
+
controlled: i().bool,
|
|
856
|
+
fill: i().bool,
|
|
857
|
+
inline: i().bool,
|
|
858
|
+
onChange: i().func,
|
|
859
|
+
onSelect: i().func,
|
|
860
|
+
lists: i().arrayOf(i().shape({
|
|
861
|
+
name: i().string.isRequired,
|
|
862
|
+
label: i().string.isRequired
|
|
863
|
+
})).isRequired
|
|
864
|
+
};
|
|
865
|
+
function _e(e) {
|
|
866
|
+
var r, a, i, u;
|
|
867
|
+
var s = e.children, f = e.controlled, b = f === void 0 ? false : f, m = e.fill, h = m === void 0 ? false : m, y = e.inline, k = y === void 0 ? false : y, R = e.onChange, I = e.onSelect, q = e.lists, j = Le(e, [ "children", "controlled", "fill", "inline", "onChange", "onSelect", "lists" ]);
|
|
868
|
+
// @docs-props-type DualListboxPropsBase
|
|
869
|
+
var _ = p()();
|
|
870
|
+
var D = (0, t.useRef)(false);
|
|
871
|
+
(0, t.useEffect)((function() {
|
|
872
|
+
D.current = true;
|
|
873
|
+
}), []);
|
|
874
|
+
// TODO: Implement shared isControlled hook (SUI-5283).
|
|
875
|
+
var N = (0, t.useRef)(b);
|
|
876
|
+
// List One "Available" Refs
|
|
877
|
+
var V = (0, t.useRef)([]);
|
|
878
|
+
var P = (0, t.useRef)([]);
|
|
879
|
+
var H = (0, t.useRef)();
|
|
880
|
+
var T = (0, t.useRef)(null);
|
|
881
|
+
var B = (0, t.useRef)([]);
|
|
882
|
+
// List Two "Selected" Refs
|
|
883
|
+
var M = (0, t.useRef)([]);
|
|
884
|
+
var A = (0, t.useRef)([]);
|
|
885
|
+
var K = (0, t.useRef)();
|
|
886
|
+
var $ = (0, t.useRef)(null);
|
|
887
|
+
var z = (0, t.useRef)([]);
|
|
888
|
+
// Refresh Hook Stores, used to render indivual elements when uncontrolled
|
|
889
|
+
var U = (0, t.useRef)({});
|
|
890
|
+
var W = (0, t.useRef)({});
|
|
891
|
+
var X = (0, t.useRef)({});
|
|
892
|
+
var G = (0, t.useRef)();
|
|
893
|
+
// Activity Values Refs
|
|
894
|
+
var J = (0, t.useRef)();
|
|
895
|
+
var Q = (0, t.useRef)({});
|
|
896
|
+
var Y = (0, t.useRef)({});
|
|
897
|
+
var Z = (0, t.useRef)({});
|
|
898
|
+
var ee = (0, t.useRef)(0);
|
|
899
|
+
// Key Match Refs
|
|
900
|
+
var re = (0, t.useRef)();
|
|
901
|
+
var te = (0, t.useRef)();
|
|
902
|
+
var ne = (0, t.useRef)([]);
|
|
903
|
+
if (false) {}
|
|
904
|
+
if (false) {}
|
|
905
|
+
if (false) {}
|
|
906
|
+
// Unpack names and labels instead of relying on `lists` being a consistent reference
|
|
907
|
+
var ae = (r = q[0]) === null || r === void 0 ? void 0 : r.name;
|
|
908
|
+
var ie = (a = q[1]) === null || a === void 0 ? void 0 : a.name;
|
|
909
|
+
var le = (i = q[0]) === null || i === void 0 ? void 0 : i.label;
|
|
910
|
+
var oe = (u = q[1]) === null || u === void 0 ? void 0 : u.label;
|
|
911
|
+
// Copy previous state for uncontrolled render so it's not voided by following value reset
|
|
912
|
+
var ue = new Set(M.current);
|
|
913
|
+
// This ensures we recapture the indexes after batch moves, but will be refactored when sorting is implemented (SUI-5270).
|
|
914
|
+
V.current = [];
|
|
915
|
+
M.current = [];
|
|
916
|
+
B.current = [];
|
|
917
|
+
z.current = [];
|
|
918
|
+
// Clean the data stores before we copy the references into listData
|
|
919
|
+
if (!D.current || N.current) {
|
|
920
|
+
P.current = [];
|
|
921
|
+
A.current = [];
|
|
922
|
+
Q.current = {};
|
|
923
|
+
Z.current = {};
|
|
924
|
+
Y.current = {};
|
|
1439
925
|
}
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
926
|
+
var ce = [ {
|
|
927
|
+
options: [],
|
|
928
|
+
matchOptions: B.current,
|
|
929
|
+
values: V.current,
|
|
930
|
+
selectedValues: P.current,
|
|
931
|
+
activeValue: H.current,
|
|
932
|
+
activeFound: !H.current
|
|
933
|
+
}, {
|
|
934
|
+
options: [],
|
|
935
|
+
matchOptions: z.current,
|
|
936
|
+
values: M.current,
|
|
937
|
+
selectedValues: A.current,
|
|
938
|
+
activeValue: K.current,
|
|
939
|
+
activeFound: !K.current
|
|
940
|
+
} ];
|
|
941
|
+
if (!D.current || N.current) {
|
|
942
|
+
t.Children.toArray(s).filter(t.isValidElement).forEach((function(e) {
|
|
943
|
+
var r = e.props, t = r.value, n = r.label;
|
|
944
|
+
var a = e.props.listName === ie;
|
|
945
|
+
var i = ce[a ? 1 : 0];
|
|
946
|
+
// Ensure the active value is found on controlled renders
|
|
947
|
+
if (!i.activeFound && i.activeValue === t) {
|
|
948
|
+
i.activeFound = true;
|
|
949
|
+
}
|
|
950
|
+
i.values.push(t);
|
|
951
|
+
i.options.push(e);
|
|
952
|
+
i.matchOptions.push({
|
|
953
|
+
value: t,
|
|
954
|
+
label: n
|
|
955
|
+
});
|
|
956
|
+
var l = !!e.props.selected;
|
|
957
|
+
if (l) {
|
|
958
|
+
i.selectedValues.push(t);
|
|
959
|
+
}
|
|
960
|
+
Q.current[t] = l;
|
|
961
|
+
Z.current[t] = i.values.length - 1;
|
|
962
|
+
Y.current[t] = e.props.id;
|
|
963
|
+
}));
|
|
1451
964
|
} else {
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
break;
|
|
1466
|
-
|
|
1467
|
-
case 'enter':
|
|
1468
|
-
if (name === listOneName) {
|
|
1469
|
-
if (isAllSelected) {
|
|
1470
|
-
// all values moved, no longer an active value
|
|
1471
|
-
nextActiveValue = undefined;
|
|
1472
|
-
} else if (listboxSelectedValues.length > 0) {
|
|
1473
|
-
// somes values moved, determine next active value
|
|
1474
|
-
nextActiveValue = findNextValue(activeIndex, listboxValues, listboxSelectedValues);
|
|
1475
|
-
}
|
|
1476
|
-
|
|
1477
|
-
handleMoveValues(event, listOneName, listTwoName);
|
|
965
|
+
t.Children.toArray(s).filter(t.isValidElement).forEach((function(e) {
|
|
966
|
+
var r = e.props, t = r.value, n = r.label;
|
|
967
|
+
var a = ue.has(t);
|
|
968
|
+
var i = ce[a ? 1 : 0];
|
|
969
|
+
i.values.push(t);
|
|
970
|
+
i.options.push(e);
|
|
971
|
+
i.matchOptions.push({
|
|
972
|
+
value: t,
|
|
973
|
+
label: n
|
|
974
|
+
});
|
|
975
|
+
Z.current[t] = i.values.length - 1;
|
|
976
|
+
}));
|
|
1478
977
|
}
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
978
|
+
var se = (0, t.useCallback)((function(e, r) {
|
|
979
|
+
if (e === ae) {
|
|
980
|
+
H.current = r;
|
|
981
|
+
} else {
|
|
982
|
+
K.current = r;
|
|
983
|
+
}
|
|
984
|
+
}), [ ae ]);
|
|
985
|
+
var ve = (0, t.useCallback)((function(e) {
|
|
986
|
+
return e === ae ? H.current : K.current;
|
|
987
|
+
}), [ ae ]);
|
|
988
|
+
var de = (0, t.useCallback)((function(e, r) {
|
|
989
|
+
if (e === ae) {
|
|
990
|
+
P.current = r;
|
|
991
|
+
} else {
|
|
992
|
+
A.current = r;
|
|
993
|
+
}
|
|
994
|
+
}), [ ae ]);
|
|
995
|
+
var fe = (0, t.useCallback)((function(e) {
|
|
996
|
+
return e === ae ? P.current : A.current;
|
|
997
|
+
}), [ ae ]);
|
|
998
|
+
var pe = (0, t.useCallback)((function(e) {
|
|
999
|
+
return fe(e).length;
|
|
1000
|
+
}), [ fe ]);
|
|
1001
|
+
var be = (0, t.useCallback)((function() {
|
|
1002
|
+
return J.current;
|
|
1003
|
+
}), []);
|
|
1004
|
+
var me = (0, t.useCallback)((function(e) {
|
|
1005
|
+
return Q.current[e];
|
|
1006
|
+
}), []);
|
|
1007
|
+
var ge = (0, t.useCallback)((function(e, r) {
|
|
1008
|
+
if (e === ae) {
|
|
1009
|
+
V.current = r;
|
|
1010
|
+
} else {
|
|
1011
|
+
M.current = r;
|
|
1012
|
+
}
|
|
1013
|
+
}), [ ae ]);
|
|
1014
|
+
var ye = (0, t.useCallback)((function(e) {
|
|
1015
|
+
return e === ae ? V.current : M.current;
|
|
1016
|
+
}), [ ae ]);
|
|
1017
|
+
var we = (0, t.useCallback)((function(e) {
|
|
1018
|
+
return ye(e).length;
|
|
1019
|
+
}), [ ye ]);
|
|
1020
|
+
var Oe = (0, t.useCallback)((function(e) {
|
|
1021
|
+
var r = we(e);
|
|
1022
|
+
return r > 0 && r === pe(e);
|
|
1023
|
+
}), [ we, pe ]);
|
|
1024
|
+
var Re = (0, t.useCallback)((function(e) {
|
|
1025
|
+
return e === ae ? B.current : z.current;
|
|
1026
|
+
}), [ ae ]);
|
|
1027
|
+
var Ee = (0, t.useCallback)((function(e) {
|
|
1028
|
+
var r = we(e);
|
|
1029
|
+
var t = pe(e);
|
|
1030
|
+
return {
|
|
1031
|
+
disabled: r < 1 || t < 1
|
|
1032
|
+
};
|
|
1033
|
+
}), [ we, pe ]);
|
|
1034
|
+
var Ie = (0, t.useCallback)((function() {
|
|
1035
|
+
if (J.current && J.current.length > 0) {
|
|
1036
|
+
var e;
|
|
1037
|
+
J.current = "";
|
|
1038
|
+
(e = G.current) === null || e === void 0 ? void 0 : e.call(G);
|
|
1039
|
+
}
|
|
1040
|
+
}), []);
|
|
1041
|
+
var qe = (0, t.useCallback)((function() {
|
|
1042
|
+
re.current = undefined;
|
|
1043
|
+
ne.current = [];
|
|
1044
|
+
if (te.current) {
|
|
1045
|
+
clearTimeout(te.current);
|
|
1046
|
+
}
|
|
1047
|
+
}), []);
|
|
1048
|
+
var je = (0, t.useCallback)((function(e) {
|
|
1049
|
+
G.current = e;
|
|
1050
|
+
}), []);
|
|
1051
|
+
var _e = (0, t.useCallback)((function(e, r) {
|
|
1052
|
+
if (r) {
|
|
1053
|
+
X.current[e] = r;
|
|
1054
|
+
} else {
|
|
1055
|
+
delete X.current[e];
|
|
1056
|
+
}
|
|
1057
|
+
}), []);
|
|
1058
|
+
var De = (0, t.useCallback)((function(e, r) {
|
|
1059
|
+
if (r) {
|
|
1060
|
+
W.current[e] = r;
|
|
1061
|
+
} else {
|
|
1062
|
+
delete W.current[e];
|
|
1063
|
+
}
|
|
1064
|
+
}), []);
|
|
1065
|
+
var Ne = (0, t.useCallback)((function(e, r) {
|
|
1066
|
+
if (r) {
|
|
1067
|
+
U.current[e] = r;
|
|
1068
|
+
} else {
|
|
1069
|
+
delete U.current[e];
|
|
1070
|
+
}
|
|
1071
|
+
}), []);
|
|
1072
|
+
var Ve = (0, t.useCallback)((function(e) {
|
|
1073
|
+
if (e) {
|
|
1074
|
+
var r, t;
|
|
1075
|
+
(r = (t = X.current)[e]) === null || r === void 0 ? void 0 : r.call(t);
|
|
1076
|
+
}
|
|
1077
|
+
}), []);
|
|
1078
|
+
var Pe = (0, t.useCallback)((function(e) {
|
|
1079
|
+
if (e) {
|
|
1080
|
+
var r, t;
|
|
1081
|
+
(r = (t = W.current)[e]) === null || r === void 0 ? void 0 : r.call(t);
|
|
1082
|
+
}
|
|
1083
|
+
}), []);
|
|
1084
|
+
var He = (0, t.useCallback)((function(e) {
|
|
1085
|
+
if (e) {
|
|
1086
|
+
var r, t;
|
|
1087
|
+
(r = (t = U.current)[e]) === null || r === void 0 ? void 0 : r.call(t);
|
|
1088
|
+
}
|
|
1089
|
+
}), []);
|
|
1090
|
+
var Te = (0, t.useCallback)((function(e) {
|
|
1091
|
+
Ie();
|
|
1092
|
+
Pe(e);
|
|
1093
|
+
He(ae);
|
|
1094
|
+
He(ie);
|
|
1095
|
+
}), [ Ie, He, Pe, ae, ie ]);
|
|
1096
|
+
var Be = (0, t.useCallback)((function(e, r) {
|
|
1097
|
+
var t = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
1098
|
+
var n = e === ae ? T.current : $.current;
|
|
1099
|
+
if (!n) {
|
|
1100
|
+
return;
|
|
1101
|
+
}
|
|
1102
|
+
var a = ve(e);
|
|
1103
|
+
se(e, r);
|
|
1104
|
+
if (!t) {
|
|
1105
|
+
// render new
|
|
1106
|
+
Ve(r);
|
|
1107
|
+
}
|
|
1108
|
+
if (r !== a) {
|
|
1109
|
+
if (!t) {
|
|
1110
|
+
// render previous
|
|
1111
|
+
Ve(a);
|
|
1112
|
+
}
|
|
1113
|
+
var i = r ? Y.current[r] : "";
|
|
1114
|
+
// update listbox via dom to avoid render + child render
|
|
1115
|
+
n.setAttribute("aria-activedescendant", i);
|
|
1116
|
+
if (!t && i.length > 0) {
|
|
1117
|
+
var l = n.querySelector("#".concat(i));
|
|
1118
|
+
O(l);
|
|
1119
|
+
}
|
|
1120
|
+
}
|
|
1121
|
+
}), [ ve, se, Ve, ae ]);
|
|
1122
|
+
var Me = (0, t.useCallback)((function(e, r) {
|
|
1123
|
+
var t = r.value, n = r.name;
|
|
1124
|
+
var a = Oe(n) ? ye(n) : fe(n);
|
|
1125
|
+
var i = x(a, t);
|
|
1126
|
+
if (!N.current) {
|
|
1127
|
+
Q.current[t] = !Q.current[t];
|
|
1128
|
+
de(n, i);
|
|
1129
|
+
Te(n);
|
|
1130
|
+
}
|
|
1131
|
+
Be(n, t);
|
|
1132
|
+
e.preventDefault();
|
|
1133
|
+
I === null || I === void 0 ? void 0 : I(e, {
|
|
1134
|
+
values: i,
|
|
1135
|
+
listName: n
|
|
1136
|
+
});
|
|
1137
|
+
}), [ Oe, fe, ye, de, Be, Te, I ]);
|
|
1138
|
+
var Ae = (0, t.useCallback)((function(e, r) {
|
|
1139
|
+
var t = r.initialIndex, n = r.name, a = r.targetIndex;
|
|
1140
|
+
var i = ye(n);
|
|
1141
|
+
var l = Math.min(t, a);
|
|
1142
|
+
var o = Math.max(t, a);
|
|
1143
|
+
var u = [];
|
|
1144
|
+
if (N.current) {
|
|
1145
|
+
u = i.slice(l, o + 1);
|
|
1146
|
+
} else {
|
|
1147
|
+
i.forEach((function(e, r) {
|
|
1148
|
+
var t = false;
|
|
1149
|
+
if (r >= l && r <= o) {
|
|
1150
|
+
t = true;
|
|
1151
|
+
u.push(e);
|
|
1152
|
+
} else {
|
|
1153
|
+
t = false;
|
|
1154
|
+
}
|
|
1155
|
+
if (Q.current[e] !== t) {
|
|
1156
|
+
Q.current[e] = t;
|
|
1157
|
+
Ve(e);
|
|
1158
|
+
}
|
|
1159
|
+
}));
|
|
1160
|
+
de(n, u);
|
|
1161
|
+
Te(n);
|
|
1162
|
+
}
|
|
1163
|
+
Be(n, i[a]);
|
|
1164
|
+
e.preventDefault();
|
|
1165
|
+
e.stopPropagation();
|
|
1166
|
+
I === null || I === void 0 ? void 0 : I(e, {
|
|
1167
|
+
values: u,
|
|
1168
|
+
listName: n
|
|
1169
|
+
});
|
|
1170
|
+
}), [ ye, I, de, Be, Te, Ve ]);
|
|
1171
|
+
var Ke = (0, t.useCallback)((function(e, r) {
|
|
1172
|
+
var t = r.name, n = r.selected;
|
|
1173
|
+
var a = ye(t);
|
|
1174
|
+
var i = n === true ? [] : a;
|
|
1175
|
+
var l = n !== true;
|
|
1176
|
+
if (!N.current) {
|
|
1177
|
+
a === null || a === void 0 ? void 0 : a.forEach((function(e) {
|
|
1178
|
+
if (Q.current[e] !== l) {
|
|
1179
|
+
Q.current[e] = l;
|
|
1180
|
+
Ve(e);
|
|
1181
|
+
}
|
|
1182
|
+
}));
|
|
1183
|
+
de(t, i);
|
|
1184
|
+
Te(t);
|
|
1185
|
+
}
|
|
1186
|
+
e.preventDefault();
|
|
1187
|
+
I === null || I === void 0 ? void 0 : I(e, {
|
|
1188
|
+
values: i,
|
|
1189
|
+
listName: t
|
|
1190
|
+
});
|
|
1191
|
+
}), [ ye, I, de, Te, Ve ]);
|
|
1192
|
+
// handleMoveValues does not update the active value of the source, keyboard and mouse differ, only the target active value is updated
|
|
1193
|
+
var $e = (0, t.useCallback)((function(e, r, t) {
|
|
1194
|
+
var n = ye(r);
|
|
1195
|
+
var a = fe(r);
|
|
1196
|
+
var i = Oe(r);
|
|
1197
|
+
var o = ye(t);
|
|
1198
|
+
var u = ve(t);
|
|
1199
|
+
if (n.length === 0 || !i && a.length === 0) {
|
|
1200
|
+
return;
|
|
1201
|
+
}
|
|
1202
|
+
if (!u && a.length > 0) {
|
|
1203
|
+
// target lacks an active value, default to the first
|
|
1204
|
+
// skip the render it will be catch in batch
|
|
1205
|
+
Be(t, a[0], true);
|
|
1206
|
+
}
|
|
1207
|
+
var c = (0, d.sprintf)((0, l._)("Moved %(count)d items to %(listLabel)s list"), {
|
|
1208
|
+
count: a.length,
|
|
1209
|
+
listLabel: t === ae ? le : oe
|
|
1210
|
+
});
|
|
1211
|
+
// These new values do not perserve sort position, may need to be refactored with sort logic (SUI-5270).
|
|
1212
|
+
var s = i ? [] : S(n, a);
|
|
1213
|
+
var v = o.concat(a);
|
|
1214
|
+
if (!N.current) {
|
|
1215
|
+
a.forEach((function(e) {
|
|
1216
|
+
Q.current[e] = false;
|
|
1217
|
+
}));
|
|
1218
|
+
ge(t, v);
|
|
1219
|
+
ge(r, s);
|
|
1220
|
+
de(r, []);
|
|
1221
|
+
J.current = c;
|
|
1222
|
+
// move is a batch update, force a full render, no internal update needed
|
|
1223
|
+
_();
|
|
1224
|
+
}
|
|
1225
|
+
var f = {
|
|
1226
|
+
affectedValues: a,
|
|
1227
|
+
sourceListName: r || "",
|
|
1228
|
+
sourceValues: s,
|
|
1229
|
+
targetListName: t || "",
|
|
1230
|
+
targetValues: v,
|
|
1231
|
+
screenReaderMessage: c || "",
|
|
1232
|
+
values: a.slice()
|
|
1233
|
+
};
|
|
1234
|
+
e.preventDefault();
|
|
1235
|
+
R === null || R === void 0 ? void 0 : R(e, f);
|
|
1236
|
+
}), [ _, ve, Oe, fe, ye, R, de, ge, Be, ae, le, oe ]);
|
|
1237
|
+
var Fe = (0, t.useCallback)((function(e, r) {
|
|
1238
|
+
var t = r.name;
|
|
1239
|
+
var n = Oe(t);
|
|
1240
|
+
var a = ve(t);
|
|
1241
|
+
var i = t === ae ? ie : ae;
|
|
1242
|
+
if (a && (n || !!Q.current[a])) {
|
|
1243
|
+
// active option was present in items to be removed, clear the active option
|
|
1244
|
+
Be(t);
|
|
1245
|
+
}
|
|
1246
|
+
$e(e, t, i);
|
|
1247
|
+
}), [ ve, Oe, $e, Be, ae, ie ]);
|
|
1248
|
+
var ze = (0, t.useCallback)((function(e, r) {
|
|
1249
|
+
var t = r.name, n = r.value;
|
|
1250
|
+
if (e.nativeEvent.shiftKey) {
|
|
1251
|
+
Ae(e, {
|
|
1252
|
+
targetIndex: Z.current[n],
|
|
1253
|
+
initialIndex: ee.current,
|
|
1254
|
+
name: t
|
|
1255
|
+
});
|
|
1256
|
+
} else {
|
|
1257
|
+
Me(e, {
|
|
1258
|
+
name: t,
|
|
1259
|
+
value: n
|
|
1260
|
+
});
|
|
1261
|
+
}
|
|
1262
|
+
}), [ Ae, Me ]);
|
|
1263
|
+
var Ue = (0, t.useCallback)((function(e, r) {
|
|
1264
|
+
Ke(e, r);
|
|
1265
|
+
}), [ Ke ]);
|
|
1266
|
+
var We = (0, t.useCallback)((function(e, r) {
|
|
1267
|
+
var t = e.nativeEvent.key;
|
|
1268
|
+
var n = Re(r);
|
|
1269
|
+
// Checking for a single character to avoid complications from double-byte languages and emojis.
|
|
1270
|
+
if (t.length === 1) {
|
|
1271
|
+
var a = [];
|
|
1272
|
+
var i = {
|
|
1273
|
+
index: 0,
|
|
1274
|
+
value: t
|
|
1275
|
+
};
|
|
1276
|
+
if (!re.current) {
|
|
1277
|
+
if (t === " ") {
|
|
1278
|
+
qe();
|
|
1279
|
+
return;
|
|
1280
|
+
}
|
|
1281
|
+
a = E(n, i);
|
|
1282
|
+
} else if (ne.current.length > 1) {
|
|
1283
|
+
i.index = re.current.index + 1;
|
|
1284
|
+
a = E(ne.current, i);
|
|
1285
|
+
}
|
|
1286
|
+
if (a.length) {
|
|
1287
|
+
var l = 0;
|
|
1288
|
+
// If the active option is a first character match, cycle to the next matching option.
|
|
1289
|
+
if (i.index === 0 && a.length > 1) {
|
|
1290
|
+
var o = ve(r);
|
|
1291
|
+
if (o) {
|
|
1292
|
+
var u = a.findIndex((function(e) {
|
|
1293
|
+
return e.value === o;
|
|
1294
|
+
}));
|
|
1295
|
+
if (u >= 0) {
|
|
1296
|
+
l = u === a.length - 1 ? 0 : u + 1;
|
|
1297
|
+
}
|
|
1298
|
+
}
|
|
1299
|
+
}
|
|
1300
|
+
Be(r, a[l].value);
|
|
1301
|
+
}
|
|
1302
|
+
ne.current = a;
|
|
1303
|
+
re.current = i;
|
|
1304
|
+
if (te.current) {
|
|
1305
|
+
clearTimeout(te.current);
|
|
1306
|
+
}
|
|
1307
|
+
te.current = setTimeout(qe, 500);
|
|
1308
|
+
e.preventDefault();
|
|
1309
|
+
e.stopPropagation();
|
|
1310
|
+
}
|
|
1311
|
+
}), [ ve, Re, qe, Be ]);
|
|
1312
|
+
var Xe = (0, t.useCallback)((function(e, r) {
|
|
1313
|
+
var t = r.name;
|
|
1314
|
+
var n = (0, o.keycode)(e.nativeEvent);
|
|
1315
|
+
var a = ye(t);
|
|
1316
|
+
var i = fe(t);
|
|
1317
|
+
var l = Oe(t);
|
|
1318
|
+
var u = ve(t);
|
|
1319
|
+
var c = u ? Z.current[u] : -1;
|
|
1320
|
+
var s = ee.current >= 0 ? ee.current : 0;
|
|
1321
|
+
if (J.current && J.current.length > 0) {
|
|
1322
|
+
Ie();
|
|
1323
|
+
}
|
|
1324
|
+
var v = u;
|
|
1325
|
+
switch (n) {
|
|
1326
|
+
case "shift":
|
|
1327
|
+
ee.current = c;
|
|
1328
|
+
break;
|
|
1329
|
+
|
|
1330
|
+
case "home":
|
|
1331
|
+
if (e.nativeEvent.ctrlKey && e.nativeEvent.shiftKey) {
|
|
1332
|
+
// handle select until start
|
|
1333
|
+
Ae(e, {
|
|
1334
|
+
targetIndex: 0,
|
|
1335
|
+
initialIndex: s,
|
|
1336
|
+
name: t
|
|
1337
|
+
});
|
|
1338
|
+
} else {
|
|
1339
|
+
var d = Se(a, 1);
|
|
1340
|
+
v = d[0];
|
|
1341
|
+
}
|
|
1342
|
+
break;
|
|
1343
|
+
|
|
1344
|
+
case "end":
|
|
1345
|
+
if (e.nativeEvent.ctrlKey && e.nativeEvent.shiftKey) {
|
|
1346
|
+
// handle select until end
|
|
1347
|
+
Ae(e, {
|
|
1348
|
+
targetIndex: a.length - 1,
|
|
1349
|
+
initialIndex: s,
|
|
1350
|
+
name: t
|
|
1351
|
+
});
|
|
1352
|
+
} else {
|
|
1353
|
+
v = a[a.length - 1];
|
|
1354
|
+
}
|
|
1355
|
+
break;
|
|
1356
|
+
|
|
1357
|
+
case "up":
|
|
1358
|
+
if (e.nativeEvent.shiftKey) {
|
|
1359
|
+
// handle select until previous
|
|
1360
|
+
Ae(e, {
|
|
1361
|
+
targetIndex: Math.max(c - 1, 0),
|
|
1362
|
+
initialIndex: s,
|
|
1363
|
+
name: t
|
|
1364
|
+
});
|
|
1365
|
+
} else {
|
|
1366
|
+
v = a[Math.max(c - 1, 0)];
|
|
1367
|
+
}
|
|
1368
|
+
break;
|
|
1369
|
+
|
|
1370
|
+
case "down":
|
|
1371
|
+
if (e.nativeEvent.shiftKey) {
|
|
1372
|
+
// handle select until next
|
|
1373
|
+
Ae(e, {
|
|
1374
|
+
targetIndex: Math.min(c + 1, a.length - 1),
|
|
1375
|
+
initialIndex: s,
|
|
1376
|
+
name: t
|
|
1377
|
+
});
|
|
1378
|
+
} else {
|
|
1379
|
+
v = a[Math.min(c + 1, a.length - 1)];
|
|
1380
|
+
}
|
|
1381
|
+
break;
|
|
1382
|
+
|
|
1383
|
+
case "space":
|
|
1384
|
+
if (u != null) {
|
|
1385
|
+
Me(e, {
|
|
1386
|
+
name: t,
|
|
1387
|
+
value: u
|
|
1388
|
+
});
|
|
1389
|
+
}
|
|
1390
|
+
break;
|
|
1391
|
+
|
|
1392
|
+
case "enter":
|
|
1393
|
+
if (t === ae) {
|
|
1394
|
+
if (l) {
|
|
1395
|
+
// all values moved, no longer an active value
|
|
1396
|
+
v = undefined;
|
|
1397
|
+
} else if (i.length > 0) {
|
|
1398
|
+
// somes values moved, determine next active value
|
|
1399
|
+
v = w(c, a, i);
|
|
1400
|
+
}
|
|
1401
|
+
$e(e, ae, ie);
|
|
1402
|
+
}
|
|
1403
|
+
break;
|
|
1404
|
+
|
|
1405
|
+
case "delete":
|
|
1406
|
+
if (t === ie) {
|
|
1407
|
+
if (l) {
|
|
1408
|
+
// all values moved, no longer an active value
|
|
1409
|
+
v = undefined;
|
|
1410
|
+
} else if (i.length > 0) {
|
|
1411
|
+
// somes values moved, determine next active value
|
|
1412
|
+
v = w(c, a, i);
|
|
1413
|
+
}
|
|
1414
|
+
$e(e, ie, ae);
|
|
1415
|
+
}
|
|
1416
|
+
break;
|
|
1417
|
+
|
|
1418
|
+
default:
|
|
1419
|
+
if (n === "a" && (e.nativeEvent.ctrlKey || e.nativeEvent.metaKey)) {
|
|
1420
|
+
// handle control + A, otherwise let 'a' passthrough
|
|
1421
|
+
Ke(e, {
|
|
1422
|
+
name: t,
|
|
1423
|
+
selected: l
|
|
1424
|
+
});
|
|
1425
|
+
} else {
|
|
1426
|
+
// do fuzzy match
|
|
1427
|
+
We(e, t);
|
|
1428
|
+
}
|
|
1429
|
+
break;
|
|
1430
|
+
}
|
|
1431
|
+
if (v !== u) {
|
|
1432
|
+
e.preventDefault();
|
|
1433
|
+
Be(t, v);
|
|
1434
|
+
}
|
|
1435
|
+
}), [ Ie, ve, Oe, fe, ye, We, $e, Ae, Me, Ke, Be, ae, ie ]);
|
|
1436
|
+
var Ge = (0, t.useMemo)((function() {
|
|
1437
|
+
return {
|
|
1438
|
+
onButtonClick: Fe,
|
|
1439
|
+
updateButtonRefreshHookByName: Ne,
|
|
1440
|
+
getButtonState: Ee
|
|
1441
|
+
};
|
|
1442
|
+
}), [ Fe, Ne, Ee ]);
|
|
1443
|
+
var Je = (0, t.useMemo)((function() {
|
|
1444
|
+
return {
|
|
1445
|
+
controlled: N.current,
|
|
1446
|
+
getActiveValue: ve,
|
|
1447
|
+
getScreenReaderMessage: be,
|
|
1448
|
+
getSelectedStateForValue: me,
|
|
1449
|
+
getSelectedValueCount: pe,
|
|
1450
|
+
getValueCount: we,
|
|
1451
|
+
updateLabelRefreshHookByName: De,
|
|
1452
|
+
updateOptionRefreshHookByValue: _e,
|
|
1453
|
+
updateScreenReaderRefreshHook: je
|
|
1454
|
+
};
|
|
1455
|
+
}), [ ve, be, me, pe, we, De, _e, je ]);
|
|
1456
|
+
if (N.current && !ce[0].activeFound) {
|
|
1457
|
+
// listOne active value wasn't found, likely the result of a controlled state reset
|
|
1458
|
+
// update interal values, skip the render it will be caught in batch
|
|
1459
|
+
Be(ae, undefined, true);
|
|
1493
1460
|
}
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
if (eventKeyCode === 'a' && (event.nativeEvent.ctrlKey || event.nativeEvent.metaKey)) {
|
|
1499
|
-
// handle control + A, otherwise let 'a' passthrough
|
|
1500
|
-
handleSelectAll(event, {
|
|
1501
|
-
name: name,
|
|
1502
|
-
selected: isAllSelected
|
|
1503
|
-
});
|
|
1504
|
-
} else {
|
|
1505
|
-
// do fuzzy match
|
|
1506
|
-
handleKeyMatch(event, name);
|
|
1461
|
+
if (N.current && !ce[1].activeFound) {
|
|
1462
|
+
// listTwo active value wasn't found, likely the result of a controlled state reset
|
|
1463
|
+
// update interal values, skip the render it will be caught in batch
|
|
1464
|
+
Be(ie, undefined, true);
|
|
1507
1465
|
}
|
|
1508
|
-
|
|
1509
|
-
|
|
1466
|
+
|
|
1467
|
+
return n().createElement(ke, xe({
|
|
1468
|
+
"data-test": "dual-listbox",
|
|
1469
|
+
$inline: h ? false : k,
|
|
1470
|
+
$fill: h
|
|
1471
|
+
}, j), n().createElement(g.Provider, {
|
|
1472
|
+
value: Je
|
|
1473
|
+
}, n().createElement(he, {
|
|
1474
|
+
index: 0,
|
|
1475
|
+
elementRef: T,
|
|
1476
|
+
label: le,
|
|
1477
|
+
name: ae,
|
|
1478
|
+
onClick: ze,
|
|
1479
|
+
onKeyDown: Xe,
|
|
1480
|
+
onSelectAllClick: Ue
|
|
1481
|
+
}, ce[0].options), n().createElement(Ce, null, n().createElement(L.Provider, {
|
|
1482
|
+
value: Ge
|
|
1483
|
+
}, n().createElement(F, {
|
|
1484
|
+
ariaLabel: (0, d.sprintf)((0, l._)("Move selected options to %(listLabel)s list"), {
|
|
1485
|
+
listLabel: oe
|
|
1486
|
+
}),
|
|
1487
|
+
ariaKeyShortcuts: "Enter",
|
|
1488
|
+
"data-test": "move-to-secondary",
|
|
1489
|
+
icon: n().createElement(v(), {
|
|
1490
|
+
hideDefaultTooltip: true,
|
|
1491
|
+
screenReaderText: null
|
|
1492
|
+
}),
|
|
1493
|
+
name: ae,
|
|
1494
|
+
tooltipLabel: (0, d.sprintf)((0, l._)("Move to %(listLabel)s"), {
|
|
1495
|
+
listLabel: oe
|
|
1496
|
+
}),
|
|
1497
|
+
tooltipPlacement: "left"
|
|
1498
|
+
}), n().createElement(F, {
|
|
1499
|
+
ariaLabel: (0, d.sprintf)((0, l._)("Move selected options to %(listLabel)s list"), {
|
|
1500
|
+
listLabel: le
|
|
1501
|
+
}),
|
|
1502
|
+
ariaKeyShortcuts: "Delete",
|
|
1503
|
+
"data-test": "move-to-primary",
|
|
1504
|
+
icon: n().createElement(c(), {
|
|
1505
|
+
hideDefaultTooltip: true,
|
|
1506
|
+
screenReaderText: null
|
|
1507
|
+
}),
|
|
1508
|
+
name: ie,
|
|
1509
|
+
tooltipLabel: (0, d.sprintf)((0, l._)("Move to %(listLabel)s"), {
|
|
1510
|
+
listLabel: le
|
|
1511
|
+
}),
|
|
1512
|
+
tooltipPlacement: "right"
|
|
1513
|
+
}))), n().createElement(he, {
|
|
1514
|
+
index: 1,
|
|
1515
|
+
elementRef: $,
|
|
1516
|
+
label: oe,
|
|
1517
|
+
name: ie,
|
|
1518
|
+
onClick: ze,
|
|
1519
|
+
onKeyDown: Xe,
|
|
1520
|
+
onSelectAllClick: Ue
|
|
1521
|
+
}, ce[1].options), n().createElement(C, null)));
|
|
1510
1522
|
}
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
var toolbarContextValue = Object(external_react_["useMemo"])(function () {
|
|
1518
|
-
return {
|
|
1519
|
-
onButtonClick: handleToolbarButtonClick,
|
|
1520
|
-
updateButtonRefreshHookByName: updateButtonRefreshHookByName,
|
|
1521
|
-
getButtonState: getButtonState
|
|
1522
|
-
};
|
|
1523
|
-
}, [handleToolbarButtonClick, updateButtonRefreshHookByName, getButtonState]);
|
|
1524
|
-
var dualContextValue = Object(external_react_["useMemo"])(function () {
|
|
1525
|
-
return {
|
|
1526
|
-
controlled: isControlledRef.current,
|
|
1527
|
-
getActiveValue: getActiveValue,
|
|
1528
|
-
getScreenReaderMessage: getScreenReaderMessage,
|
|
1529
|
-
getSelectedStateForValue: getSelectedStateForValue,
|
|
1530
|
-
getSelectedValueCount: getSelectedValueCount,
|
|
1531
|
-
getValueCount: getValueCount,
|
|
1532
|
-
updateLabelRefreshHookByName: updateLabelRefreshHookByName,
|
|
1533
|
-
updateOptionRefreshHookByValue: updateOptionRefreshHookByValue,
|
|
1534
|
-
updateScreenReaderRefreshHook: updateScreenReaderRefreshHook
|
|
1535
|
-
};
|
|
1536
|
-
}, [getActiveValue, getScreenReaderMessage, getSelectedStateForValue, getSelectedValueCount, getValueCount, updateLabelRefreshHookByName, updateOptionRefreshHookByValue, updateScreenReaderRefreshHook]);
|
|
1537
|
-
|
|
1538
|
-
if (isControlledRef.current && !listData[0].activeFound) {
|
|
1539
|
-
// listOne active value wasn't found, likely the result of a controlled state reset
|
|
1540
|
-
// update interal values, skip the render it will be caught in batch
|
|
1541
|
-
updateActiveOption(listOneName, undefined, true);
|
|
1542
|
-
}
|
|
1543
|
-
|
|
1544
|
-
if (isControlledRef.current && !listData[1].activeFound) {
|
|
1545
|
-
// listTwo active value wasn't found, likely the result of a controlled state reset
|
|
1546
|
-
// update interal values, skip the render it will be caught in batch
|
|
1547
|
-
updateActiveOption(listTwoName, undefined, true);
|
|
1548
|
-
}
|
|
1549
|
-
|
|
1550
|
-
return /*#__PURE__*/external_react_default.a.createElement(StyledBox, DualListbox_extends({
|
|
1551
|
-
"data-test": "dual-listbox",
|
|
1552
|
-
$inline: fill ? false : inline,
|
|
1553
|
-
$fill: fill
|
|
1554
|
-
}, otherProps), /*#__PURE__*/external_react_default.a.createElement(DualListbox_DualListboxContext.Provider, {
|
|
1555
|
-
value: dualContextValue
|
|
1556
|
-
}, /*#__PURE__*/external_react_default.a.createElement(DualListbox_Listbox, {
|
|
1557
|
-
index: 0,
|
|
1558
|
-
elementRef: listOneNodeRef,
|
|
1559
|
-
label: listOneLabel,
|
|
1560
|
-
name: listOneName,
|
|
1561
|
-
onClick: handleOptionClick,
|
|
1562
|
-
onKeyDown: handleListboxKeyDown,
|
|
1563
|
-
onSelectAllClick: handleSelectAllClick
|
|
1564
|
-
}, listData[0].options), /*#__PURE__*/external_react_default.a.createElement(StyledFlexColumn, null, /*#__PURE__*/external_react_default.a.createElement(DualListbox_ToolbarContext.Provider, {
|
|
1565
|
-
value: toolbarContextValue
|
|
1566
|
-
}, /*#__PURE__*/external_react_default.a.createElement(DualListbox_ToolbarButton, {
|
|
1567
|
-
ariaLabel: Object(format_["sprintf"])(Object(i18n_["_"])('Move selected options to %(listLabel)s list'), {
|
|
1568
|
-
listLabel: listTwoLabel
|
|
1569
|
-
}),
|
|
1570
|
-
ariaKeyShortcuts: "Enter",
|
|
1571
|
-
"data-test": "move-to-secondary",
|
|
1572
|
-
icon: /*#__PURE__*/external_react_default.a.createElement(ChevronRight_default.a, {
|
|
1573
|
-
hideDefaultTooltip: true,
|
|
1574
|
-
screenReaderText: null
|
|
1575
|
-
}),
|
|
1576
|
-
name: listOneName,
|
|
1577
|
-
tooltipLabel: Object(format_["sprintf"])(Object(i18n_["_"])('Move to %(listLabel)s'), {
|
|
1578
|
-
listLabel: listTwoLabel
|
|
1579
|
-
}),
|
|
1580
|
-
tooltipPlacement: "left"
|
|
1581
|
-
}), /*#__PURE__*/external_react_default.a.createElement(DualListbox_ToolbarButton, {
|
|
1582
|
-
ariaLabel: Object(format_["sprintf"])(Object(i18n_["_"])('Move selected options to %(listLabel)s list'), {
|
|
1583
|
-
listLabel: listOneLabel
|
|
1584
|
-
}),
|
|
1585
|
-
ariaKeyShortcuts: "Delete",
|
|
1586
|
-
"data-test": "move-to-primary",
|
|
1587
|
-
icon: /*#__PURE__*/external_react_default.a.createElement(ChevronLeft_default.a, {
|
|
1588
|
-
hideDefaultTooltip: true,
|
|
1589
|
-
screenReaderText: null
|
|
1590
|
-
}),
|
|
1591
|
-
name: listTwoName,
|
|
1592
|
-
tooltipLabel: Object(format_["sprintf"])(Object(i18n_["_"])('Move to %(listLabel)s'), {
|
|
1593
|
-
listLabel: listOneLabel
|
|
1594
|
-
}),
|
|
1595
|
-
tooltipPlacement: "right"
|
|
1596
|
-
}))), /*#__PURE__*/external_react_default.a.createElement(DualListbox_Listbox, {
|
|
1597
|
-
index: 1,
|
|
1598
|
-
elementRef: listTwoNodeRef,
|
|
1599
|
-
label: listTwoLabel,
|
|
1600
|
-
name: listTwoName,
|
|
1601
|
-
onClick: handleOptionClick,
|
|
1602
|
-
onKeyDown: handleListboxKeyDown,
|
|
1603
|
-
onSelectAllClick: handleSelectAllClick
|
|
1604
|
-
}, listData[1].options), /*#__PURE__*/external_react_default.a.createElement(DualListbox_ScreenReaderWrapper, null)));
|
|
1605
|
-
}
|
|
1606
|
-
|
|
1607
|
-
DualListbox.propTypes = DualListbox_propTypes;
|
|
1608
|
-
DualListbox.Option = DualListbox_Option;
|
|
1609
|
-
/* harmony default export */ var DualListbox_DualListbox = (DualListbox);
|
|
1610
|
-
|
|
1611
|
-
// CONCATENATED MODULE: ./src/DualListbox/index.ts
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
/***/ }),
|
|
1616
|
-
|
|
1617
|
-
/***/ 2:
|
|
1618
|
-
/***/ (function(module, exports) {
|
|
1619
|
-
|
|
1620
|
-
module.exports = require("react");
|
|
1621
|
-
|
|
1622
|
-
/***/ }),
|
|
1623
|
-
|
|
1624
|
-
/***/ 29:
|
|
1625
|
-
/***/ (function(module, exports) {
|
|
1626
|
-
|
|
1627
|
-
module.exports = require("@splunk/ui-utils/format");
|
|
1628
|
-
|
|
1629
|
-
/***/ }),
|
|
1630
|
-
|
|
1631
|
-
/***/ 3:
|
|
1632
|
-
/***/ (function(module, exports) {
|
|
1633
|
-
|
|
1634
|
-
module.exports = require("styled-components");
|
|
1635
|
-
|
|
1636
|
-
/***/ }),
|
|
1637
|
-
|
|
1638
|
-
/***/ 38:
|
|
1639
|
-
/***/ (function(module, exports) {
|
|
1640
|
-
|
|
1641
|
-
module.exports = require("@splunk/react-icons/enterprise/ChevronRight");
|
|
1642
|
-
|
|
1643
|
-
/***/ }),
|
|
1644
|
-
|
|
1645
|
-
/***/ 39:
|
|
1646
|
-
/***/ (function(module, exports) {
|
|
1647
|
-
|
|
1648
|
-
module.exports = require("@splunk/react-ui/Switch");
|
|
1649
|
-
|
|
1650
|
-
/***/ }),
|
|
1651
|
-
|
|
1652
|
-
/***/ 4:
|
|
1653
|
-
/***/ (function(module, exports) {
|
|
1654
|
-
|
|
1655
|
-
module.exports = require("@splunk/ui-utils/i18n");
|
|
1656
|
-
|
|
1657
|
-
/***/ }),
|
|
1658
|
-
|
|
1659
|
-
/***/ 45:
|
|
1660
|
-
/***/ (function(module, exports) {
|
|
1661
|
-
|
|
1662
|
-
module.exports = require("@splunk/react-ui/Tooltip");
|
|
1663
|
-
|
|
1664
|
-
/***/ }),
|
|
1665
|
-
|
|
1666
|
-
/***/ 48:
|
|
1667
|
-
/***/ (function(module, exports) {
|
|
1668
|
-
|
|
1669
|
-
module.exports = require("@splunk/react-ui/useForceUpdate");
|
|
1670
|
-
|
|
1671
|
-
/***/ }),
|
|
1672
|
-
|
|
1673
|
-
/***/ 59:
|
|
1674
|
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
1675
|
-
|
|
1676
|
-
"use strict";
|
|
1677
|
-
/* unused harmony export charFromMatchOption */
|
|
1678
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return fuzzyMatch; });
|
|
1679
|
-
// A utility for matching keyboard characters to list values
|
|
1680
|
-
var charFromMatchOption = function charFromMatchOption(option, charIndex) {
|
|
1681
|
-
return option ? option.label.charAt(charIndex).toLowerCase() : '';
|
|
1682
|
-
};
|
|
1683
|
-
|
|
1684
|
-
var fuzzyMatch = function fuzzyMatch(options, matchChar) {
|
|
1685
|
-
if (!options.length) {
|
|
1686
|
-
return options;
|
|
1687
|
-
}
|
|
1688
|
-
|
|
1689
|
-
var defaultMatch = null;
|
|
1690
|
-
var hasMatch = false;
|
|
1691
|
-
var matches = options.filter(function (option) {
|
|
1692
|
-
var characterValue = charFromMatchOption(option, matchChar.index);
|
|
1693
|
-
|
|
1694
|
-
if (characterValue === matchChar.value) {
|
|
1695
|
-
hasMatch = true;
|
|
1696
|
-
return true;
|
|
1697
|
-
} // If we haven't found a match yet, keep track of the next closest match.
|
|
1698
|
-
// Secondary matching looks for the closest character of a higher value, and failing that, closest of a lower value.
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
if (!hasMatch) {
|
|
1702
|
-
var defaultValue = charFromMatchOption(defaultMatch, matchChar.index);
|
|
1703
|
-
|
|
1704
|
-
if (!defaultValue) {
|
|
1705
|
-
defaultMatch = option;
|
|
1706
|
-
} else if (characterValue > matchChar.value) {
|
|
1707
|
-
if (defaultValue < matchChar.value) {
|
|
1708
|
-
defaultMatch = option;
|
|
1709
|
-
} else if (defaultValue > characterValue) {
|
|
1710
|
-
defaultMatch = option;
|
|
1711
|
-
}
|
|
1712
|
-
} else if (characterValue > defaultValue) {
|
|
1713
|
-
defaultMatch = option;
|
|
1714
|
-
}
|
|
1715
|
-
}
|
|
1716
|
-
|
|
1717
|
-
return false;
|
|
1718
|
-
});
|
|
1719
|
-
return matches.length === 0 && defaultMatch ? [defaultMatch] : matches;
|
|
1720
|
-
};
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
/***/ }),
|
|
1725
|
-
|
|
1726
|
-
/***/ 6:
|
|
1727
|
-
/***/ (function(module, exports) {
|
|
1728
|
-
|
|
1729
|
-
module.exports = require("@splunk/react-ui/Box");
|
|
1730
|
-
|
|
1731
|
-
/***/ }),
|
|
1732
|
-
|
|
1733
|
-
/***/ 66:
|
|
1734
|
-
/***/ (function(module, exports) {
|
|
1735
|
-
|
|
1736
|
-
module.exports = require("@splunk/react-icons/enterprise/ChevronLeft");
|
|
1737
|
-
|
|
1738
|
-
/***/ }),
|
|
1739
|
-
|
|
1740
|
-
/***/ 7:
|
|
1741
|
-
/***/ (function(module, exports) {
|
|
1742
|
-
|
|
1743
|
-
module.exports = require("@splunk/ui-utils/keyboard");
|
|
1744
|
-
|
|
1745
|
-
/***/ }),
|
|
1746
|
-
|
|
1747
|
-
/***/ 8:
|
|
1748
|
-
/***/ (function(module, exports) {
|
|
1749
|
-
|
|
1750
|
-
module.exports = require("@splunk/ui-utils/id");
|
|
1751
|
-
|
|
1752
|
-
/***/ }),
|
|
1753
|
-
|
|
1754
|
-
/***/ 91:
|
|
1755
|
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
1756
|
-
|
|
1757
|
-
"use strict";
|
|
1758
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return scrollIntoViewIfNeeded; });
|
|
1759
|
-
// A utility that attempts to move an element into view by scrolling it's derived parent.
|
|
1760
|
-
var scrollIntoViewIfNeeded = function scrollIntoViewIfNeeded(el) {
|
|
1761
|
-
if (!el) {
|
|
1762
|
-
return;
|
|
1763
|
-
}
|
|
1764
|
-
|
|
1765
|
-
var parentEl = el.offsetParent;
|
|
1766
|
-
|
|
1767
|
-
if (!parentEl) {
|
|
1768
|
-
return;
|
|
1769
|
-
} // Below the bottom of the container.
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
if (parentEl.scrollTop + parentEl.clientHeight < el.offsetTop + el.clientHeight) {
|
|
1773
|
-
parentEl.scrollTop = el.offsetTop + el.clientHeight - parentEl.clientHeight; // Above the top of the container.
|
|
1774
|
-
} else if (parentEl.scrollTop > el.offsetTop) {
|
|
1775
|
-
parentEl.scrollTop = el.offsetTop;
|
|
1776
|
-
}
|
|
1777
|
-
};
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
/***/ })
|
|
1782
|
-
|
|
1783
|
-
/******/ });
|
|
1523
|
+
_e.propTypes = je;
|
|
1524
|
+
_e.Option = ne;
|
|
1525
|
+
/* harmony default export */ const De = _e;
|
|
1526
|
+
// CONCATENATED MODULE: ./src/DualListbox/index.ts
|
|
1527
|
+
module.exports = r;
|
|
1528
|
+
/******/})();
|