@splunk/react-ui 4.19.0 → 4.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Accordion.js +114 -230
- package/Anchor.js +74 -150
- package/Animation.js +52 -124
- package/AnimationToggle.js +86 -146
- package/Box.js +77 -153
- package/Breadcrumbs.d.ts +2 -0
- package/Breadcrumbs.js +207 -0
- package/Button.js +168 -316
- package/ButtonGroup.js +84 -168
- package/ButtonSimple.js +224 -324
- package/CHANGELOG.md +35 -0
- package/Calendar.js +264 -462
- package/Card.js +223 -371
- package/CardLayout.js +87 -163
- package/Chip.js +199 -323
- package/Clickable.js +132 -248
- package/CloseButton.js +92 -200
- package/Code.js +188 -251
- package/CollapsiblePanel.js +214 -370
- package/Color.js +267 -495
- package/ColumnLayout.js +152 -254
- package/ComboBox.js +197 -371
- package/Concertina.js +214 -374
- package/ControlGroup.js +164 -288
- package/Date.js +154 -304
- package/DefinitionList.js +104 -180
- package/Divider.js +80 -156
- package/Dropdown.js +121 -263
- package/DualListbox.js +408 -601
- package/EventListener.js +70 -138
- package/File.js +343 -547
- package/FormRows.js +232 -414
- package/Heading.js +94 -164
- package/Image.js +167 -323
- package/JSONTree.js +166 -314
- package/Layer.js +221 -388
- package/Link.js +133 -239
- package/List.js +85 -161
- package/Markdown.js +230 -355
- package/Menu.js +396 -647
- package/Message.js +248 -437
- package/MessageBar.js +220 -408
- package/Modal.js +201 -365
- package/ModalLayer.js +96 -196
- package/Monogram.js +112 -204
- package/Multiselect.js +2675 -2807
- package/Number.js +178 -334
- package/Paginator.js +170 -336
- package/Paragraph.js +77 -153
- package/Popover.js +436 -623
- package/Progress.js +139 -255
- package/RadioBar.js +156 -280
- package/RadioList.js +182 -282
- package/Resize.js +173 -307
- package/ResultsMenu.js +183 -304
- package/ScreenReaderContent.js +75 -151
- package/Scroll.js +125 -267
- package/ScrollContainerContext.js +129 -201
- package/Search.js +188 -354
- package/Select.js +1243 -1248
- package/SidePanel.js +106 -214
- package/Slider.js +198 -348
- package/SlidingPanels.js +138 -280
- package/SplitButton.js +141 -273
- package/StaticContent.js +84 -168
- package/StepBar.js +138 -246
- package/Switch.js +261 -385
- package/TabBar.js +261 -398
- package/TabLayout.js +122 -238
- package/Table.js +975 -1447
- package/Text.js +335 -549
- package/TextArea.js +315 -537
- package/Tooltip.js +152 -292
- package/TransitionOpen.js +118 -242
- package/Typography.js +81 -157
- package/WaitSpinner.js +117 -209
- package/package.json +20 -21
- package/stubs-splunkui.d.ts +4 -1
- package/types/src/Breadcrumbs/Breadcrumbs.d.ts +25 -0
- package/types/src/Breadcrumbs/Item.d.ts +42 -0
- package/types/src/Breadcrumbs/docs/examples/Adornments.d.ts +2 -0
- package/types/src/Breadcrumbs/docs/examples/Basic.d.ts +2 -0
- package/types/src/Breadcrumbs/index.d.ts +2 -0
- package/types/src/Code/Code.d.ts +1 -1
- package/types/src/ComboBox/Option.d.ts +1 -1
- package/types/src/Concertina/Concertina.d.ts +4 -0
- package/types/src/Link/Link.d.ts +12 -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/Compact.d.ts +4 -0
- package/types/src/Multiselect/Multiselect.d.ts +5 -0
- package/types/src/Multiselect/Option.d.ts +1 -1
- package/types/src/Multiselect/docs/examples/CompactSelectAll.d.ts +2 -0
- 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/Select/SelectAllOption.d.ts +14 -0
- package/types/src/Select/SelectBase.d.ts +11 -3
- package/types/src/Table/Table.d.ts +4 -0
- package/types/src/Text/Text.d.ts +3 -3
- package/types/src/TextArea/TextArea.d.ts +3 -3
- package/types/src/fixtures/FetchOptions.d.ts +2 -8
- package/useForceUpdate.js +46 -110
- package/useKeyPress.js +50 -107
- package/usePrevious.js +47 -111
- package/useRovingFocus.js +53 -133
- package/types/src/Link/docs/examples/NewTab.d.ts +0 -2
- package/types/src/Typography/docs/examples/Variants.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,165 +1,85 @@
|
|
|
1
|
-
|
|
2
|
-
/******/
|
|
3
|
-
/******/ // The
|
|
4
|
-
/******/ var
|
|
5
|
-
/******/
|
|
6
|
-
|
|
7
|
-
/******/
|
|
8
|
-
/******/
|
|
9
|
-
/******/ //
|
|
10
|
-
/******/
|
|
11
|
-
/******/
|
|
12
|
-
/******/
|
|
13
|
-
/******/
|
|
14
|
-
/******/
|
|
15
|
-
/******/
|
|
16
|
-
/******/
|
|
17
|
-
/******/
|
|
1
|
+
/******/ (() => { // webpackBootstrap
|
|
2
|
+
/******/ "use strict";
|
|
3
|
+
/******/ // The require scope
|
|
4
|
+
/******/ var __webpack_require__ = {};
|
|
5
|
+
/******/
|
|
6
|
+
/************************************************************************/
|
|
7
|
+
/******/ /* webpack/runtime/compat get default export */
|
|
8
|
+
/******/ (() => {
|
|
9
|
+
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
|
10
|
+
/******/ __webpack_require__.n = (module) => {
|
|
11
|
+
/******/ var getter = module && module.__esModule ?
|
|
12
|
+
/******/ () => (module['default']) :
|
|
13
|
+
/******/ () => (module);
|
|
14
|
+
/******/ __webpack_require__.d(getter, { a: getter });
|
|
15
|
+
/******/ return getter;
|
|
16
|
+
/******/ };
|
|
17
|
+
/******/ })();
|
|
18
|
+
/******/
|
|
19
|
+
/******/ /* webpack/runtime/define property getters */
|
|
20
|
+
/******/ (() => {
|
|
21
|
+
/******/ // define getter functions for harmony exports
|
|
22
|
+
/******/ __webpack_require__.d = (exports, definition) => {
|
|
23
|
+
/******/ for(var key in definition) {
|
|
24
|
+
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
|
|
25
|
+
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
|
|
26
|
+
/******/ }
|
|
27
|
+
/******/ }
|
|
18
28
|
/******/ };
|
|
19
|
-
/******/
|
|
20
|
-
/******/
|
|
21
|
-
/******/
|
|
22
|
-
/******/
|
|
23
|
-
/******/
|
|
24
|
-
/******/
|
|
25
|
-
/******/
|
|
26
|
-
/******/
|
|
27
|
-
/******/
|
|
28
|
-
/******/
|
|
29
|
-
/******/
|
|
30
|
-
/******/
|
|
31
|
-
/******/
|
|
32
|
-
/******/
|
|
33
|
-
/******/
|
|
34
|
-
/******/
|
|
35
|
-
/******/
|
|
36
|
-
/******/
|
|
37
|
-
/******/ // define getter function for harmony exports
|
|
38
|
-
/******/ __webpack_require__.d = function(exports, name, getter) {
|
|
39
|
-
/******/ if(!__webpack_require__.o(exports, name)) {
|
|
40
|
-
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
|
|
41
|
-
/******/ }
|
|
42
|
-
/******/ };
|
|
43
|
-
/******/
|
|
44
|
-
/******/ // define __esModule on exports
|
|
45
|
-
/******/ __webpack_require__.r = function(exports) {
|
|
46
|
-
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
47
|
-
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
48
|
-
/******/ }
|
|
49
|
-
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
|
50
|
-
/******/ };
|
|
51
|
-
/******/
|
|
52
|
-
/******/ // create a fake namespace object
|
|
53
|
-
/******/ // mode & 1: value is a module id, require it
|
|
54
|
-
/******/ // mode & 2: merge all properties of value into the ns
|
|
55
|
-
/******/ // mode & 4: return value when already ns object
|
|
56
|
-
/******/ // mode & 8|1: behave like require
|
|
57
|
-
/******/ __webpack_require__.t = function(value, mode) {
|
|
58
|
-
/******/ if(mode & 1) value = __webpack_require__(value);
|
|
59
|
-
/******/ if(mode & 8) return value;
|
|
60
|
-
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
|
|
61
|
-
/******/ var ns = Object.create(null);
|
|
62
|
-
/******/ __webpack_require__.r(ns);
|
|
63
|
-
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
|
|
64
|
-
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
|
|
65
|
-
/******/ return ns;
|
|
66
|
-
/******/ };
|
|
67
|
-
/******/
|
|
68
|
-
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
|
69
|
-
/******/ __webpack_require__.n = function(module) {
|
|
70
|
-
/******/ var getter = module && module.__esModule ?
|
|
71
|
-
/******/ function getDefault() { return module['default']; } :
|
|
72
|
-
/******/ function getModuleExports() { return module; };
|
|
73
|
-
/******/ __webpack_require__.d(getter, 'a', getter);
|
|
74
|
-
/******/ return getter;
|
|
75
|
-
/******/ };
|
|
76
|
-
/******/
|
|
77
|
-
/******/ // Object.prototype.hasOwnProperty.call
|
|
78
|
-
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
|
79
|
-
/******/
|
|
80
|
-
/******/ // __webpack_public_path__
|
|
81
|
-
/******/ __webpack_require__.p = "";
|
|
82
|
-
/******/
|
|
83
|
-
/******/
|
|
84
|
-
/******/ // Load entry module and return exports
|
|
85
|
-
/******/ return __webpack_require__(__webpack_require__.s = 170);
|
|
86
|
-
/******/ })
|
|
29
|
+
/******/ })();
|
|
30
|
+
/******/
|
|
31
|
+
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
|
32
|
+
/******/ (() => {
|
|
33
|
+
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
|
|
34
|
+
/******/ })();
|
|
35
|
+
/******/
|
|
36
|
+
/******/ /* webpack/runtime/make namespace object */
|
|
37
|
+
/******/ (() => {
|
|
38
|
+
/******/ // define __esModule on exports
|
|
39
|
+
/******/ __webpack_require__.r = (exports) => {
|
|
40
|
+
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
41
|
+
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
42
|
+
/******/ }
|
|
43
|
+
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
|
44
|
+
/******/ };
|
|
45
|
+
/******/ })();
|
|
46
|
+
/******/
|
|
87
47
|
/************************************************************************/
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
/***/ 0:
|
|
91
|
-
/***/ (function(module, exports) {
|
|
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
|
-
/***/ 170:
|
|
119
|
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
120
|
-
|
|
121
|
-
"use strict";
|
|
48
|
+
var __webpack_exports__ = {};
|
|
122
49
|
// ESM COMPAT FLAG
|
|
123
50
|
__webpack_require__.r(__webpack_exports__);
|
|
124
51
|
|
|
125
52
|
// EXPORTS
|
|
126
|
-
__webpack_require__.d(__webpack_exports__,
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
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__(64);
|
|
145
|
-
var ChevronLeft_default = /*#__PURE__*/__webpack_require__.n(ChevronLeft_);
|
|
146
|
-
|
|
147
|
-
// EXTERNAL MODULE: external "@splunk/react-icons/enterprise/ChevronRight"
|
|
148
|
-
var ChevronRight_ = __webpack_require__(35);
|
|
149
|
-
var ChevronRight_default = /*#__PURE__*/__webpack_require__.n(ChevronRight_);
|
|
150
|
-
|
|
151
|
-
// EXTERNAL MODULE: external "@splunk/ui-utils/format"
|
|
152
|
-
var format_ = __webpack_require__(28);
|
|
153
|
-
|
|
154
|
-
// EXTERNAL MODULE: external "@splunk/react-ui/useForceUpdate"
|
|
155
|
-
var useForceUpdate_ = __webpack_require__(45);
|
|
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_);
|
|
53
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
54
|
+
Option: () => (/* reexport */ DualListbox_Option),
|
|
55
|
+
"default": () => (/* reexport */ DualListbox_DualListbox)
|
|
56
|
+
});
|
|
161
57
|
|
|
162
|
-
|
|
58
|
+
;// CONCATENATED MODULE: external "react"
|
|
59
|
+
const external_react_namespaceObject = require("react");
|
|
60
|
+
var external_react_default = /*#__PURE__*/__webpack_require__.n(external_react_namespaceObject);
|
|
61
|
+
;// CONCATENATED MODULE: external "prop-types"
|
|
62
|
+
const external_prop_types_namespaceObject = require("prop-types");
|
|
63
|
+
var external_prop_types_default = /*#__PURE__*/__webpack_require__.n(external_prop_types_namespaceObject);
|
|
64
|
+
;// CONCATENATED MODULE: external "@splunk/ui-utils/i18n"
|
|
65
|
+
const i18n_namespaceObject = require("@splunk/ui-utils/i18n");
|
|
66
|
+
;// CONCATENATED MODULE: external "@splunk/ui-utils/keyboard"
|
|
67
|
+
const keyboard_namespaceObject = require("@splunk/ui-utils/keyboard");
|
|
68
|
+
;// CONCATENATED MODULE: external "@splunk/react-icons/enterprise/ChevronLeft"
|
|
69
|
+
const ChevronLeft_namespaceObject = require("@splunk/react-icons/enterprise/ChevronLeft");
|
|
70
|
+
var ChevronLeft_default = /*#__PURE__*/__webpack_require__.n(ChevronLeft_namespaceObject);
|
|
71
|
+
;// CONCATENATED MODULE: external "@splunk/react-icons/enterprise/ChevronRight"
|
|
72
|
+
const ChevronRight_namespaceObject = require("@splunk/react-icons/enterprise/ChevronRight");
|
|
73
|
+
var ChevronRight_default = /*#__PURE__*/__webpack_require__.n(ChevronRight_namespaceObject);
|
|
74
|
+
;// CONCATENATED MODULE: external "@splunk/ui-utils/format"
|
|
75
|
+
const format_namespaceObject = require("@splunk/ui-utils/format");
|
|
76
|
+
;// CONCATENATED MODULE: external "@splunk/react-ui/useForceUpdate"
|
|
77
|
+
const useForceUpdate_namespaceObject = require("@splunk/react-ui/useForceUpdate");
|
|
78
|
+
var useForceUpdate_default = /*#__PURE__*/__webpack_require__.n(useForceUpdate_namespaceObject);
|
|
79
|
+
;// CONCATENATED MODULE: external "@splunk/react-ui/ScreenReaderContent"
|
|
80
|
+
const ScreenReaderContent_namespaceObject = require("@splunk/react-ui/ScreenReaderContent");
|
|
81
|
+
var ScreenReaderContent_default = /*#__PURE__*/__webpack_require__.n(ScreenReaderContent_namespaceObject);
|
|
82
|
+
;// CONCATENATED MODULE: ./src/DualListbox/DualListboxContext.tsx
|
|
163
83
|
|
|
164
84
|
|
|
165
85
|
/**
|
|
@@ -168,9 +88,9 @@ var ScreenReaderContent_default = /*#__PURE__*/__webpack_require__.n(ScreenReade
|
|
|
168
88
|
* Defaults to `'{}'`.
|
|
169
89
|
* @public
|
|
170
90
|
*/
|
|
171
|
-
var DualListboxContext = /*#__PURE__*/external_react_default.
|
|
172
|
-
/* harmony default export */
|
|
173
|
-
|
|
91
|
+
var DualListboxContext = /*#__PURE__*/external_react_default().createContext({});
|
|
92
|
+
/* harmony default export */ const DualListbox_DualListboxContext = (DualListboxContext);
|
|
93
|
+
;// CONCATENATED MODULE: ./src/DualListbox/ScreenReaderWrapper.tsx
|
|
174
94
|
function _extends() { _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 _extends.apply(this, arguments); }
|
|
175
95
|
|
|
176
96
|
|
|
@@ -182,10 +102,10 @@ function ScreenReaderWrapper(_ref) {
|
|
|
182
102
|
var otherProps = _extends({}, _ref);
|
|
183
103
|
|
|
184
104
|
var forceUpdate = useForceUpdate_default()();
|
|
185
|
-
var contextValue =
|
|
105
|
+
var contextValue = (0,external_react_namespaceObject.useContext)(DualListbox_DualListboxContext);
|
|
186
106
|
var getScreenReaderMessage = contextValue.getScreenReaderMessage,
|
|
187
107
|
updateScreenReaderRefreshHook = contextValue.updateScreenReaderRefreshHook;
|
|
188
|
-
|
|
108
|
+
(0,external_react_namespaceObject.useEffect)(function () {
|
|
189
109
|
updateScreenReaderRefreshHook === null || updateScreenReaderRefreshHook === void 0 ? void 0 : updateScreenReaderRefreshHook(forceUpdate);
|
|
190
110
|
return function () {
|
|
191
111
|
return updateScreenReaderRefreshHook === null || updateScreenReaderRefreshHook === void 0 ? void 0 : updateScreenReaderRefreshHook();
|
|
@@ -196,13 +116,13 @@ function ScreenReaderWrapper(_ref) {
|
|
|
196
116
|
return null;
|
|
197
117
|
}
|
|
198
118
|
|
|
199
|
-
return /*#__PURE__*/external_react_default.
|
|
119
|
+
return /*#__PURE__*/external_react_default().createElement((ScreenReaderContent_default()), _extends({
|
|
200
120
|
"aria-live": "assertive"
|
|
201
121
|
}, otherProps), getScreenReaderMessage() || '');
|
|
202
122
|
}
|
|
203
123
|
|
|
204
|
-
/* harmony default export */
|
|
205
|
-
|
|
124
|
+
/* harmony default export */ const DualListbox_ScreenReaderWrapper = (ScreenReaderWrapper);
|
|
125
|
+
;// CONCATENATED MODULE: ./src/DualListbox/listboxUtils.ts
|
|
206
126
|
var arrayWithToggledValue = function arrayWithToggledValue(valueArr, toggleValue) {
|
|
207
127
|
var newArray = valueArr.filter(function (value) {
|
|
208
128
|
return value !== toggleValue;
|
|
@@ -254,90 +174,147 @@ var findNextValue = function findNextValue(index, originalValues, removedValues)
|
|
|
254
174
|
};
|
|
255
175
|
|
|
256
176
|
|
|
257
|
-
|
|
258
|
-
|
|
177
|
+
;// CONCATENATED MODULE: ./src/utils/scrollIntoViewIfNeeded.ts
|
|
178
|
+
// A utility that attempts to move an element into view by scrolling it's derived parent.
|
|
179
|
+
var scrollIntoViewIfNeeded = function scrollIntoViewIfNeeded(el) {
|
|
180
|
+
if (!el) {
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
259
183
|
|
|
260
|
-
|
|
261
|
-
var fuzzyMatch = __webpack_require__(56);
|
|
184
|
+
var parentEl = el.offsetParent;
|
|
262
185
|
|
|
263
|
-
|
|
186
|
+
if (!parentEl) {
|
|
187
|
+
return;
|
|
188
|
+
} // Below the bottom of the container.
|
|
264
189
|
|
|
265
190
|
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
var
|
|
191
|
+
if (parentEl.scrollTop + parentEl.clientHeight < el.offsetTop + el.clientHeight) {
|
|
192
|
+
parentEl.scrollTop = el.offsetTop + el.clientHeight - parentEl.clientHeight; // Above the top of the container.
|
|
193
|
+
} else if (parentEl.scrollTop > el.offsetTop) {
|
|
194
|
+
parentEl.scrollTop = el.offsetTop;
|
|
195
|
+
}
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
;// CONCATENATED MODULE: ./src/utils/fuzzyMatch.ts
|
|
200
|
+
// A utility for matching keyboard characters to list values
|
|
201
|
+
var charFromMatchOption = function charFromMatchOption(option, charIndex) {
|
|
202
|
+
return option ? option.label.charAt(charIndex).toLowerCase() : '';
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
var fuzzyMatch = function fuzzyMatch(options, matchChar) {
|
|
206
|
+
if (!options.length) {
|
|
207
|
+
return options;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
var defaultMatch = null;
|
|
211
|
+
var hasMatch = false;
|
|
212
|
+
var matches = options.filter(function (option) {
|
|
213
|
+
var characterValue = charFromMatchOption(option, matchChar.index);
|
|
214
|
+
|
|
215
|
+
if (characterValue === matchChar.value) {
|
|
216
|
+
hasMatch = true;
|
|
217
|
+
return true;
|
|
218
|
+
} // If we haven't found a match yet, keep track of the next closest match.
|
|
219
|
+
// Secondary matching looks for the closest character of a higher value, and failing that, closest of a lower value.
|
|
277
220
|
|
|
278
|
-
// EXTERNAL MODULE: external "styled-components"
|
|
279
|
-
var external_styled_components_ = __webpack_require__(3);
|
|
280
|
-
var external_styled_components_default = /*#__PURE__*/__webpack_require__.n(external_styled_components_);
|
|
281
221
|
|
|
282
|
-
|
|
283
|
-
var
|
|
222
|
+
if (!hasMatch) {
|
|
223
|
+
var defaultValue = charFromMatchOption(defaultMatch, matchChar.index);
|
|
224
|
+
|
|
225
|
+
if (!defaultValue) {
|
|
226
|
+
defaultMatch = option;
|
|
227
|
+
} else if (characterValue > matchChar.value) {
|
|
228
|
+
if (defaultValue < matchChar.value) {
|
|
229
|
+
defaultMatch = option;
|
|
230
|
+
} else if (defaultValue > characterValue) {
|
|
231
|
+
defaultMatch = option;
|
|
232
|
+
}
|
|
233
|
+
} else if (characterValue > defaultValue) {
|
|
234
|
+
defaultMatch = option;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
284
237
|
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
238
|
+
return false;
|
|
239
|
+
});
|
|
240
|
+
return matches.length === 0 && defaultMatch ? [defaultMatch] : matches;
|
|
241
|
+
};
|
|
288
242
|
|
|
289
|
-
// CONCATENATED MODULE: ./src/DualListbox/ToolbarButtonStyles.ts
|
|
290
243
|
|
|
244
|
+
;// CONCATENATED MODULE: ./src/DualListbox/ToolbarContext.tsx
|
|
291
245
|
|
|
292
246
|
|
|
293
|
-
|
|
247
|
+
/**
|
|
248
|
+
* A React context used to inform subcomponets of Toolbar of parent component values.
|
|
249
|
+
* The context interface is `ToolbarContextValue`.
|
|
250
|
+
* Defaults to `'{}'`.
|
|
251
|
+
* @public
|
|
252
|
+
*/
|
|
253
|
+
var ToolbarContext = /*#__PURE__*/external_react_default().createContext({});
|
|
254
|
+
/* harmony default export */ const DualListbox_ToolbarContext = (ToolbarContext);
|
|
255
|
+
;// CONCATENATED MODULE: external "@splunk/react-ui/Tooltip"
|
|
256
|
+
const Tooltip_namespaceObject = require("@splunk/react-ui/Tooltip");
|
|
257
|
+
var Tooltip_default = /*#__PURE__*/__webpack_require__.n(Tooltip_namespaceObject);
|
|
258
|
+
;// CONCATENATED MODULE: external "styled-components"
|
|
259
|
+
const external_styled_components_namespaceObject = require("styled-components");
|
|
260
|
+
var external_styled_components_default = /*#__PURE__*/__webpack_require__.n(external_styled_components_namespaceObject);
|
|
261
|
+
;// CONCATENATED MODULE: external "@splunk/themes"
|
|
262
|
+
const themes_namespaceObject = require("@splunk/themes");
|
|
263
|
+
;// CONCATENATED MODULE: external "@splunk/react-ui/Clickable"
|
|
264
|
+
const Clickable_namespaceObject = require("@splunk/react-ui/Clickable");
|
|
265
|
+
var Clickable_default = /*#__PURE__*/__webpack_require__.n(Clickable_namespaceObject);
|
|
266
|
+
;// CONCATENATED MODULE: ./src/DualListbox/ToolbarButtonStyles.ts
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
var StyledClickable = external_styled_components_default()((Clickable_default())).withConfig({
|
|
294
271
|
displayName: "ToolbarButtonStyles__StyledClickable",
|
|
295
272
|
componentId: "k7zksz-0"
|
|
296
|
-
})(["", " 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;}", ";"],
|
|
273
|
+
})(["", " 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;}", ";"], themes_namespaceObject.mixins.reset('block'), (0,themes_namespaceObject.pick)({
|
|
297
274
|
enterprise: '1px solid transparent'
|
|
298
|
-
}),
|
|
299
|
-
enterprise:
|
|
300
|
-
prisma:
|
|
301
|
-
}),
|
|
275
|
+
}), themes_namespaceObject.variables.borderRadius, (0,themes_namespaceObject.pick)({
|
|
276
|
+
enterprise: themes_namespaceObject.variables.fontWeightSemiBold,
|
|
277
|
+
prisma: themes_namespaceObject.variables.fontWeightSemiBold
|
|
278
|
+
}), themes_namespaceObject.variables.lineHeight, themes_namespaceObject.variables.inputHeight, themes_namespaceObject.variables.inputHeight, (0,themes_namespaceObject.pick)({
|
|
302
279
|
enterprise: {
|
|
303
280
|
comfortable: '0 5px',
|
|
304
281
|
compact: '0 2px'
|
|
305
282
|
},
|
|
306
283
|
prisma: {
|
|
307
|
-
comfortable:
|
|
308
|
-
compact:
|
|
284
|
+
comfortable: (0,external_styled_components_namespaceObject.css)(["0px calc(", " / 2 - 1px)"], themes_namespaceObject.variables.inputHeight),
|
|
285
|
+
compact: (0,external_styled_components_namespaceObject.css)(["0px calc(", " / 2 - 1px)"], themes_namespaceObject.variables.inputHeight)
|
|
309
286
|
}
|
|
310
|
-
}),
|
|
311
|
-
"false":
|
|
312
|
-
enterprise:
|
|
313
|
-
light:
|
|
314
|
-
dark:
|
|
315
|
-
}),
|
|
316
|
-
light:
|
|
317
|
-
dark:
|
|
318
|
-
}),
|
|
319
|
-
light:
|
|
320
|
-
dark:
|
|
321
|
-
}),
|
|
322
|
-
light:
|
|
323
|
-
dark:
|
|
324
|
-
}),
|
|
325
|
-
light:
|
|
326
|
-
dark:
|
|
287
|
+
}), themes_namespaceObject.variables.inputHeight, themes_namespaceObject.variables.focusShadow, (0,themes_namespaceObject.pickVariant)('$disabled', {
|
|
288
|
+
"false": (0,themes_namespaceObject.pick)({
|
|
289
|
+
enterprise: (0,external_styled_components_namespaceObject.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,themes_namespaceObject.pick)({
|
|
290
|
+
light: themes_namespaceObject.variables.gray45,
|
|
291
|
+
dark: themes_namespaceObject.variables.white
|
|
292
|
+
}), themes_namespaceObject.variables.backgroundColorHover, (0,themes_namespaceObject.pick)({
|
|
293
|
+
light: themes_namespaceObject.variables.gray60,
|
|
294
|
+
dark: themes_namespaceObject.variables.borderColor
|
|
295
|
+
}), (0,themes_namespaceObject.pick)({
|
|
296
|
+
light: themes_namespaceObject.variables.linkColor,
|
|
297
|
+
dark: themes_namespaceObject.variables.white
|
|
298
|
+
}), (0,themes_namespaceObject.pick)({
|
|
299
|
+
light: themes_namespaceObject.variables.gray92,
|
|
300
|
+
dark: themes_namespaceObject.variables.gray22
|
|
301
|
+
}), (0,themes_namespaceObject.pick)({
|
|
302
|
+
light: themes_namespaceObject.variables.linkColor,
|
|
303
|
+
dark: themes_namespaceObject.variables.white
|
|
327
304
|
})),
|
|
328
|
-
prisma:
|
|
305
|
+
prisma: (0,external_styled_components_namespaceObject.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:", ";}}"], themes_namespaceObject.variables.contentColorActive, themes_namespaceObject.variables.interactiveColorOverlayHover, themes_namespaceObject.variables.interactiveColorBorderHover, themes_namespaceObject.variables.hoverShadow, themes_namespaceObject.variables.interactiveColorOverlayActive, themes_namespaceObject.variables.interactiveColorOverlayActive)
|
|
329
306
|
}),
|
|
330
|
-
"true":
|
|
331
|
-
prisma:
|
|
332
|
-
}),
|
|
333
|
-
enterprise:
|
|
334
|
-
prisma:
|
|
307
|
+
"true": (0,external_styled_components_namespaceObject.css)(["border-color:", ";color:", ";cursor:not-allowed;"], (0,themes_namespaceObject.pick)({
|
|
308
|
+
prisma: themes_namespaceObject.variables.interactiveColorBorderDisabled
|
|
309
|
+
}), (0,themes_namespaceObject.pick)({
|
|
310
|
+
enterprise: themes_namespaceObject.variables.textDisabledColor,
|
|
311
|
+
prisma: themes_namespaceObject.variables.contentColorDisabled
|
|
335
312
|
}))
|
|
336
313
|
}));
|
|
337
|
-
var StyledIcon = external_styled_components_default.
|
|
314
|
+
var StyledIcon = external_styled_components_default().span.withConfig({
|
|
338
315
|
displayName: "ToolbarButtonStyles__StyledIcon",
|
|
339
316
|
componentId: "k7zksz-1"
|
|
340
|
-
})(["align-items:center;display:flex;flex-direction:row;flex-shrink:0;font-size:", ";justify-content:center;max-width:100%;"],
|
|
317
|
+
})(["align-items:center;display:flex;flex-direction:row;flex-shrink:0;font-size:", ";justify-content:center;max-width:100%;"], (0,themes_namespaceObject.pick)({
|
|
341
318
|
enterprise: 'inherit',
|
|
342
319
|
prisma: {
|
|
343
320
|
comfortable: '21px',
|
|
@@ -345,7 +322,7 @@ var StyledIcon = external_styled_components_default.a.span.withConfig({
|
|
|
345
322
|
}
|
|
346
323
|
}));
|
|
347
324
|
|
|
348
|
-
|
|
325
|
+
;// CONCATENATED MODULE: ./src/DualListbox/ToolbarButton.tsx
|
|
349
326
|
function ToolbarButton_extends() { ToolbarButton_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 ToolbarButton_extends.apply(this, arguments); }
|
|
350
327
|
|
|
351
328
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _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; }
|
|
@@ -359,10 +336,10 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
359
336
|
|
|
360
337
|
|
|
361
338
|
var propTypes = {
|
|
362
|
-
icon: external_prop_types_default.
|
|
363
|
-
name: external_prop_types_default.
|
|
364
|
-
tooltipLabel: external_prop_types_default.
|
|
365
|
-
tooltipPlacement: external_prop_types_default.
|
|
339
|
+
icon: (external_prop_types_default()).node.isRequired,
|
|
340
|
+
name: (external_prop_types_default()).string.isRequired,
|
|
341
|
+
tooltipLabel: (external_prop_types_default()).string.isRequired,
|
|
342
|
+
tooltipPlacement: external_prop_types_default().oneOf(['above', 'below', 'left', 'right'])
|
|
366
343
|
};
|
|
367
344
|
|
|
368
345
|
function ToolbarButton(_ref) {
|
|
@@ -374,18 +351,18 @@ function ToolbarButton(_ref) {
|
|
|
374
351
|
tooltipPlacement = _ref.tooltipPlacement,
|
|
375
352
|
otherProps = _objectWithoutProperties(_ref, ["ariaLabel", "ariaKeyShortcuts", "icon", "name", "tooltipLabel", "tooltipPlacement"]);
|
|
376
353
|
|
|
377
|
-
var contextValue =
|
|
354
|
+
var contextValue = (0,external_react_namespaceObject.useContext)(DualListbox_ToolbarContext);
|
|
378
355
|
var forceUpdate = useForceUpdate_default()();
|
|
379
356
|
var getButtonState = contextValue.getButtonState,
|
|
380
357
|
onButtonClick = contextValue.onButtonClick,
|
|
381
358
|
updateButtonRefreshHookByName = contextValue.updateButtonRefreshHookByName;
|
|
382
|
-
|
|
359
|
+
(0,external_react_namespaceObject.useEffect)(function () {
|
|
383
360
|
updateButtonRefreshHookByName === null || updateButtonRefreshHookByName === void 0 ? void 0 : updateButtonRefreshHookByName(name, forceUpdate);
|
|
384
361
|
return function () {
|
|
385
362
|
return updateButtonRefreshHookByName === null || updateButtonRefreshHookByName === void 0 ? void 0 : updateButtonRefreshHookByName(name);
|
|
386
363
|
};
|
|
387
364
|
}, [name, updateButtonRefreshHookByName, forceUpdate]);
|
|
388
|
-
var handleClick =
|
|
365
|
+
var handleClick = (0,external_react_namespaceObject.useCallback)(function (event) {
|
|
389
366
|
onButtonClick === null || onButtonClick === void 0 ? void 0 : onButtonClick(event, {
|
|
390
367
|
name: name
|
|
391
368
|
});
|
|
@@ -398,65 +375,64 @@ function ToolbarButton(_ref) {
|
|
|
398
375
|
var _getButtonState = getButtonState(name),
|
|
399
376
|
disabled = _getButtonState.disabled;
|
|
400
377
|
|
|
401
|
-
return /*#__PURE__*/external_react_default.
|
|
378
|
+
return /*#__PURE__*/external_react_default().createElement((Tooltip_default()), {
|
|
402
379
|
defaultPlacement: tooltipPlacement,
|
|
403
|
-
content: /*#__PURE__*/external_react_default.
|
|
380
|
+
content: /*#__PURE__*/external_react_default().createElement("span", {
|
|
404
381
|
"aria-hidden": true
|
|
405
382
|
}, tooltipLabel)
|
|
406
|
-
}, /*#__PURE__*/external_react_default.
|
|
383
|
+
}, /*#__PURE__*/external_react_default().createElement(StyledClickable, ToolbarButton_extends({
|
|
407
384
|
"aria-label": ariaLabel,
|
|
408
385
|
"aria-keyshortcuts": ariaKeyShortcuts,
|
|
409
386
|
"aria-disabled": disabled || undefined,
|
|
410
387
|
"data-test": "toolbar-button",
|
|
411
388
|
$disabled: disabled,
|
|
412
389
|
onClick: !disabled ? handleClick : undefined
|
|
413
|
-
}, otherProps), /*#__PURE__*/external_react_default.
|
|
390
|
+
}, otherProps), /*#__PURE__*/external_react_default().createElement(StyledIcon, null, icon)));
|
|
414
391
|
}
|
|
415
392
|
|
|
416
393
|
ToolbarButton.propsTypes = propTypes;
|
|
417
|
-
/* harmony default export */
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
var Switch_default = /*#__PURE__*/__webpack_require__.n(
|
|
394
|
+
/* harmony default export */ const DualListbox_ToolbarButton = (ToolbarButton);
|
|
395
|
+
;// CONCATENATED MODULE: external "@splunk/react-ui/Switch"
|
|
396
|
+
const Switch_namespaceObject = require("@splunk/react-ui/Switch");
|
|
397
|
+
var Switch_default = /*#__PURE__*/__webpack_require__.n(Switch_namespaceObject);
|
|
398
|
+
;// CONCATENATED MODULE: ./src/DualListbox/OptionStyles.ts
|
|
421
399
|
|
|
422
|
-
// CONCATENATED MODULE: ./src/DualListbox/OptionStyles.ts
|
|
423
400
|
|
|
424
401
|
|
|
425
|
-
|
|
426
|
-
var StyledListItem = external_styled_components_default.a.li.withConfig({
|
|
402
|
+
var StyledListItem = external_styled_components_default().li.withConfig({
|
|
427
403
|
displayName: "OptionStyles__StyledListItem",
|
|
428
404
|
componentId: "q275d9-0"
|
|
429
|
-
})(["align-items:center;color:", ";cursor:pointer;display:flex;overflow:hidden;width:100%;word-wrap:break-word;", " ", ""],
|
|
430
|
-
"true":
|
|
431
|
-
prisma:
|
|
405
|
+
})(["align-items:center;color:", ";cursor:pointer;display:flex;overflow:hidden;width:100%;word-wrap:break-word;", " ", ""], themes_namespaceObject.variables.contentColorActive, (0,themes_namespaceObject.pickVariant)('$active', {
|
|
406
|
+
"true": (0,external_styled_components_namespaceObject.css)(["", ""], (0,themes_namespaceObject.pick)({
|
|
407
|
+
prisma: (0,external_styled_components_namespaceObject.css)(["background:", ";"], themes_namespaceObject.variables.interactiveColorOverlaySelected),
|
|
432
408
|
enterprise: {
|
|
433
|
-
light:
|
|
434
|
-
dark:
|
|
409
|
+
light: (0,external_styled_components_namespaceObject.css)(["background:", ";"], themes_namespaceObject.variables.accentColorL50),
|
|
410
|
+
dark: (0,external_styled_components_namespaceObject.css)(["background:", ";"], themes_namespaceObject.variables.accentColorD50)
|
|
435
411
|
}
|
|
436
412
|
}))
|
|
437
|
-
}),
|
|
438
|
-
prisma:
|
|
439
|
-
"true":
|
|
440
|
-
"false":
|
|
413
|
+
}), (0,themes_namespaceObject.pick)({
|
|
414
|
+
prisma: (0,themes_namespaceObject.pickVariant)('$selected', {
|
|
415
|
+
"true": (0,external_styled_components_namespaceObject.css)(["&:hover{background:", ";}"], themes_namespaceObject.mixins.overlayColors(themes_namespaceObject.variables.interactiveColorOverlaySelected, themes_namespaceObject.variables.interactiveColorOverlayHover)),
|
|
416
|
+
"false": (0,external_styled_components_namespaceObject.css)(["&:hover{background:", ";}"], themes_namespaceObject.variables.interactiveColorOverlayHover)
|
|
441
417
|
}),
|
|
442
|
-
enterprise:
|
|
418
|
+
enterprise: (0,external_styled_components_namespaceObject.css)(["&:hover{background:", ";}"], themes_namespaceObject.variables.backgroundColorHover)
|
|
443
419
|
}));
|
|
444
|
-
var StyledSwtich = external_styled_components_default()(Switch_default
|
|
420
|
+
var StyledSwtich = external_styled_components_default()((Switch_default())).withConfig({
|
|
445
421
|
displayName: "OptionStyles__StyledSwtich",
|
|
446
422
|
componentId: "q275d9-1"
|
|
447
|
-
})(["padding-left:", ";"],
|
|
448
|
-
var StyledDiv = external_styled_components_default.
|
|
423
|
+
})(["padding-left:", ";"], themes_namespaceObject.variables.spacingSmall);
|
|
424
|
+
var StyledDiv = external_styled_components_default().div.withConfig({
|
|
449
425
|
displayName: "OptionStyles__StyledDiv",
|
|
450
426
|
componentId: "q275d9-2"
|
|
451
|
-
})(["padding:", ";word-break:break-word;word-wrap:break-word;"],
|
|
427
|
+
})(["padding:", ";word-break:break-word;word-wrap:break-word;"], (0,themes_namespaceObject.pick)({
|
|
452
428
|
prisma: {
|
|
453
|
-
compact:
|
|
454
|
-
comfortable:
|
|
429
|
+
compact: (0,external_styled_components_namespaceObject.css)(["6px ", ""], themes_namespaceObject.variables.spacingSmall),
|
|
430
|
+
comfortable: (0,external_styled_components_namespaceObject.css)(["10px ", ""], themes_namespaceObject.variables.spacingSmall)
|
|
455
431
|
},
|
|
456
|
-
enterprise:
|
|
432
|
+
enterprise: (0,external_styled_components_namespaceObject.css)(["6px ", ""], themes_namespaceObject.variables.spacingSmall)
|
|
457
433
|
}));
|
|
458
434
|
|
|
459
|
-
|
|
435
|
+
;// CONCATENATED MODULE: ./src/DualListbox/ListboxContext.tsx
|
|
460
436
|
|
|
461
437
|
|
|
462
438
|
/**
|
|
@@ -465,9 +441,9 @@ var StyledDiv = external_styled_components_default.a.div.withConfig({
|
|
|
465
441
|
* Defaults to `'{}'`.
|
|
466
442
|
* @public
|
|
467
443
|
*/
|
|
468
|
-
var ListboxContext = /*#__PURE__*/external_react_default.
|
|
469
|
-
/* harmony default export */
|
|
470
|
-
|
|
444
|
+
var ListboxContext = /*#__PURE__*/external_react_default().createContext({});
|
|
445
|
+
/* harmony default export */ const DualListbox_ListboxContext = (ListboxContext);
|
|
446
|
+
;// CONCATENATED MODULE: ./src/DualListbox/Option.tsx
|
|
471
447
|
function Option_extends() { Option_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 Option_extends.apply(this, arguments); }
|
|
472
448
|
|
|
473
449
|
function Option_objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = Option_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; }
|
|
@@ -480,11 +456,11 @@ function Option_objectWithoutPropertiesLoose(source, excluded) { if (source == n
|
|
|
480
456
|
|
|
481
457
|
|
|
482
458
|
var Option_propTypes = {
|
|
483
|
-
id: external_prop_types_default.
|
|
484
|
-
label: external_prop_types_default.
|
|
485
|
-
listName: external_prop_types_default.
|
|
486
|
-
selected: external_prop_types_default.
|
|
487
|
-
value: external_prop_types_default.
|
|
459
|
+
id: (external_prop_types_default()).string.isRequired,
|
|
460
|
+
label: (external_prop_types_default()).string.isRequired,
|
|
461
|
+
listName: (external_prop_types_default()).string,
|
|
462
|
+
selected: (external_prop_types_default()).bool,
|
|
463
|
+
value: (external_prop_types_default()).string.isRequired
|
|
488
464
|
};
|
|
489
465
|
|
|
490
466
|
function Option(_ref) {
|
|
@@ -494,19 +470,19 @@ function Option(_ref) {
|
|
|
494
470
|
value = _ref.value,
|
|
495
471
|
otherProps = Option_objectWithoutProperties(_ref, ["id", "label", "selected", "value"]);
|
|
496
472
|
|
|
497
|
-
var contextValue =
|
|
473
|
+
var contextValue = (0,external_react_namespaceObject.useContext)(DualListbox_ListboxContext);
|
|
498
474
|
var forceUpdate = useForceUpdate_default()();
|
|
499
475
|
var onOptionClick = contextValue.onOptionClick,
|
|
500
476
|
getOptionStateForValue = contextValue.getOptionStateForValue,
|
|
501
477
|
updateOptionRefreshHookByValue = contextValue.updateOptionRefreshHookByValue,
|
|
502
478
|
controlled = contextValue.controlled;
|
|
503
|
-
|
|
479
|
+
(0,external_react_namespaceObject.useEffect)(function () {
|
|
504
480
|
updateOptionRefreshHookByValue === null || updateOptionRefreshHookByValue === void 0 ? void 0 : updateOptionRefreshHookByValue(value, forceUpdate);
|
|
505
481
|
return function () {
|
|
506
482
|
return updateOptionRefreshHookByValue === null || updateOptionRefreshHookByValue === void 0 ? void 0 : updateOptionRefreshHookByValue(value);
|
|
507
483
|
};
|
|
508
484
|
}, [value, updateOptionRefreshHookByValue, forceUpdate]);
|
|
509
|
-
var handleClick =
|
|
485
|
+
var handleClick = (0,external_react_namespaceObject.useCallback)(function (event) {
|
|
510
486
|
onOptionClick === null || onOptionClick === void 0 ? void 0 : onOptionClick(event, {
|
|
511
487
|
value: value
|
|
512
488
|
});
|
|
@@ -521,7 +497,7 @@ function Option(_ref) {
|
|
|
521
497
|
selectedContext = _getOptionStateForVal.selected;
|
|
522
498
|
|
|
523
499
|
var selected = !!(controlled ? selectedProp : selectedContext);
|
|
524
|
-
return /*#__PURE__*/external_react_default.
|
|
500
|
+
return /*#__PURE__*/external_react_default().createElement(StyledListItem, Option_extends({
|
|
525
501
|
"aria-selected": selected,
|
|
526
502
|
"data-test": "option",
|
|
527
503
|
"data-test-value": value,
|
|
@@ -531,38 +507,37 @@ function Option(_ref) {
|
|
|
531
507
|
role: "option",
|
|
532
508
|
$active: active,
|
|
533
509
|
$selected: selected
|
|
534
|
-
}, otherProps), /*#__PURE__*/external_react_default.
|
|
510
|
+
}, otherProps), /*#__PURE__*/external_react_default().createElement(StyledSwtich, {
|
|
535
511
|
interactive: false,
|
|
536
512
|
selected: selected,
|
|
537
513
|
appearance: "checkbox"
|
|
538
|
-
}), /*#__PURE__*/external_react_default.
|
|
514
|
+
}), /*#__PURE__*/external_react_default().createElement(StyledDiv, null, label));
|
|
539
515
|
}
|
|
540
516
|
|
|
541
517
|
Option.propTypes = Option_propTypes;
|
|
542
|
-
/* harmony default export */
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
// CONCATENATED MODULE: ./src/DualListbox/LabelStyles.ts
|
|
518
|
+
/* harmony default export */ const DualListbox_Option = (Option);
|
|
519
|
+
;// CONCATENATED MODULE: external "@splunk/ui-utils/id"
|
|
520
|
+
const id_namespaceObject = require("@splunk/ui-utils/id");
|
|
521
|
+
;// CONCATENATED MODULE: ./src/DualListbox/LabelStyles.ts
|
|
547
522
|
|
|
548
523
|
|
|
549
|
-
var StyledLabel = external_styled_components_default.
|
|
524
|
+
var StyledLabel = external_styled_components_default().label.withConfig({
|
|
550
525
|
displayName: "LabelStyles__StyledLabel",
|
|
551
526
|
componentId: "unwplx-0"
|
|
552
|
-
})(["color:", ";flex:0 0 auto;"],
|
|
553
|
-
var StyledLabelContainer = external_styled_components_default.
|
|
527
|
+
})(["color:", ";flex:0 0 auto;"], themes_namespaceObject.variables.contentColorActive);
|
|
528
|
+
var StyledLabelContainer = external_styled_components_default().div.withConfig({
|
|
554
529
|
displayName: "LabelStyles__StyledLabelContainer",
|
|
555
530
|
componentId: "unwplx-1"
|
|
556
531
|
})(["display:flex;flex-direction:column;"]);
|
|
557
|
-
var StyledSwitchContainer = external_styled_components_default.
|
|
532
|
+
var StyledSwitchContainer = external_styled_components_default().div.withConfig({
|
|
558
533
|
displayName: "LabelStyles__StyledSwitchContainer",
|
|
559
534
|
componentId: "unwplx-2"
|
|
560
|
-
})(["align-items:center;border:1px solid transparent;display:flex;gap:", ";grid-row:headers;padding:0 ", ";", ""],
|
|
535
|
+
})(["align-items:center;border:1px solid transparent;display:flex;gap:", ";grid-row:headers;padding:0 ", ";", ""], themes_namespaceObject.variables.spacingSmall, themes_namespaceObject.variables.spacingSmall, function (_ref) {
|
|
561
536
|
var $columnNumber = _ref.$columnNumber;
|
|
562
|
-
return
|
|
537
|
+
return (0,external_styled_components_namespaceObject.css)(["grid-column:", ";"], "list".concat($columnNumber));
|
|
563
538
|
});
|
|
564
539
|
|
|
565
|
-
|
|
540
|
+
;// CONCATENATED MODULE: ./src/DualListbox/Label.tsx
|
|
566
541
|
|
|
567
542
|
|
|
568
543
|
|
|
@@ -574,12 +549,12 @@ var StyledSwitchContainer = external_styled_components_default.a.div.withConfig(
|
|
|
574
549
|
|
|
575
550
|
|
|
576
551
|
var Label_propTypes = {
|
|
577
|
-
id: external_prop_types_default.
|
|
578
|
-
index: external_prop_types_default.
|
|
579
|
-
listId: external_prop_types_default.
|
|
580
|
-
name: external_prop_types_default.
|
|
581
|
-
onSwitchClick: external_prop_types_default.
|
|
582
|
-
value: external_prop_types_default.
|
|
552
|
+
id: (external_prop_types_default()).string.isRequired,
|
|
553
|
+
index: (external_prop_types_default()).number.isRequired,
|
|
554
|
+
listId: (external_prop_types_default()).string.isRequired,
|
|
555
|
+
name: (external_prop_types_default()).string.isRequired,
|
|
556
|
+
onSwitchClick: (external_prop_types_default()).func,
|
|
557
|
+
value: (external_prop_types_default()).string.isRequired
|
|
583
558
|
};
|
|
584
559
|
|
|
585
560
|
function ListboxLabel(_ref) {
|
|
@@ -589,12 +564,12 @@ function ListboxLabel(_ref) {
|
|
|
589
564
|
name = _ref.name,
|
|
590
565
|
onSwitchClick = _ref.onSwitchClick,
|
|
591
566
|
value = _ref.value;
|
|
592
|
-
var contextValue =
|
|
567
|
+
var contextValue = (0,external_react_namespaceObject.useContext)(DualListbox_ListboxContext);
|
|
593
568
|
var forceUpdate = useForceUpdate_default()();
|
|
594
|
-
var switchIdRef =
|
|
569
|
+
var switchIdRef = (0,external_react_namespaceObject.useRef)((0,id_namespaceObject.createDOMID)('switch'));
|
|
595
570
|
var updateLabelRefreshHookByName = contextValue.updateLabelRefreshHookByName,
|
|
596
571
|
getLabelState = contextValue.getLabelState;
|
|
597
|
-
|
|
572
|
+
(0,external_react_namespaceObject.useEffect)(function () {
|
|
598
573
|
updateLabelRefreshHookByName === null || updateLabelRefreshHookByName === void 0 ? void 0 : updateLabelRefreshHookByName(name, forceUpdate);
|
|
599
574
|
return function () {
|
|
600
575
|
return updateLabelRefreshHookByName === null || updateLabelRefreshHookByName === void 0 ? void 0 : updateLabelRefreshHookByName(name);
|
|
@@ -611,14 +586,14 @@ function ListboxLabel(_ref) {
|
|
|
611
586
|
selectedValueCount = _getLabelState.selectedValueCount,
|
|
612
587
|
valueCount = _getLabelState.valueCount;
|
|
613
588
|
|
|
614
|
-
return /*#__PURE__*/external_react_default.
|
|
589
|
+
return /*#__PURE__*/external_react_default().createElement(StyledSwitchContainer, {
|
|
615
590
|
$columnNumber: index
|
|
616
|
-
}, /*#__PURE__*/external_react_default.
|
|
591
|
+
}, /*#__PURE__*/external_react_default().createElement((ScreenReaderContent_default()), {
|
|
617
592
|
"aria-hidden": true,
|
|
618
593
|
id: switchIdRef.current
|
|
619
|
-
},
|
|
594
|
+
}, (0,format_namespaceObject.sprintf)((0,i18n_namespaceObject._)('Select All %(listName)s Options'), {
|
|
620
595
|
listName: value
|
|
621
|
-
})), /*#__PURE__*/external_react_default.
|
|
596
|
+
})), /*#__PURE__*/external_react_default().createElement((Switch_default()), {
|
|
622
597
|
appearance: "checkbox",
|
|
623
598
|
"data-test": "select-all",
|
|
624
599
|
disabled: disabled,
|
|
@@ -626,31 +601,31 @@ function ListboxLabel(_ref) {
|
|
|
626
601
|
onClick: onSwitchClick,
|
|
627
602
|
selected: selected,
|
|
628
603
|
value: value
|
|
629
|
-
}), /*#__PURE__*/external_react_default.
|
|
604
|
+
}), /*#__PURE__*/external_react_default().createElement(StyledLabelContainer, null, /*#__PURE__*/external_react_default().createElement(StyledLabel, {
|
|
630
605
|
id: id,
|
|
631
606
|
htmlFor: listId
|
|
632
|
-
}, value), /*#__PURE__*/external_react_default.
|
|
607
|
+
}, value), /*#__PURE__*/external_react_default().createElement("span", {
|
|
633
608
|
"aria-hidden": true
|
|
634
609
|
}, "".concat(selectedValueCount, "/").concat(valueCount, " Selected"))));
|
|
635
610
|
}
|
|
636
611
|
|
|
637
612
|
ListboxLabel.propTypes = Label_propTypes;
|
|
638
|
-
/* harmony default export */
|
|
639
|
-
|
|
613
|
+
/* harmony default export */ const Label = (ListboxLabel);
|
|
614
|
+
;// CONCATENATED MODULE: ./src/DualListbox/ListboxStyles.ts
|
|
640
615
|
|
|
641
616
|
|
|
642
|
-
var StyledListbox = external_styled_components_default.
|
|
617
|
+
var StyledListbox = external_styled_components_default().ul.withConfig({
|
|
643
618
|
displayName: "ListboxStyles__StyledListbox",
|
|
644
619
|
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;}", ""],
|
|
646
|
-
enterprise:
|
|
647
|
-
prisma:
|
|
648
|
-
}),
|
|
620
|
+
})(["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_namespaceObject.variables.transparent, (0,themes_namespaceObject.pick)({
|
|
621
|
+
enterprise: themes_namespaceObject.variables.gray60,
|
|
622
|
+
prisma: themes_namespaceObject.variables.interactiveColorBorder
|
|
623
|
+
}), themes_namespaceObject.variables.borderRadius, themes_namespaceObject.variables.focusShadow, function (_ref) {
|
|
649
624
|
var $columnNumber = _ref.$columnNumber;
|
|
650
|
-
return
|
|
625
|
+
return (0,external_styled_components_namespaceObject.css)(["grid-column:", ";"], "list".concat($columnNumber));
|
|
651
626
|
});
|
|
652
627
|
|
|
653
|
-
|
|
628
|
+
;// CONCATENATED MODULE: ./src/DualListbox/Listbox.tsx
|
|
654
629
|
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
630
|
|
|
656
631
|
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; }
|
|
@@ -665,14 +640,14 @@ function Listbox_objectWithoutPropertiesLoose(source, excluded) { if (source ==
|
|
|
665
640
|
|
|
666
641
|
|
|
667
642
|
var Listbox_propTypes = {
|
|
668
|
-
children: external_prop_types_default.
|
|
669
|
-
index: external_prop_types_default.
|
|
670
|
-
label: external_prop_types_default.
|
|
671
|
-
multiSelect: external_prop_types_default.
|
|
672
|
-
name: external_prop_types_default.
|
|
673
|
-
onClick: external_prop_types_default.
|
|
674
|
-
onKeyDown: external_prop_types_default.
|
|
675
|
-
onSelectAllClick: external_prop_types_default.
|
|
643
|
+
children: (external_prop_types_default()).node,
|
|
644
|
+
index: (external_prop_types_default()).number.isRequired,
|
|
645
|
+
label: (external_prop_types_default()).string.isRequired,
|
|
646
|
+
multiSelect: (external_prop_types_default()).bool,
|
|
647
|
+
name: (external_prop_types_default()).string.isRequired,
|
|
648
|
+
onClick: (external_prop_types_default()).func,
|
|
649
|
+
onKeyDown: (external_prop_types_default()).func,
|
|
650
|
+
onSelectAllClick: (external_prop_types_default()).func
|
|
676
651
|
};
|
|
677
652
|
|
|
678
653
|
function Listbox(_ref) {
|
|
@@ -686,10 +661,10 @@ function Listbox(_ref) {
|
|
|
686
661
|
onSelectAllClick = _ref.onSelectAllClick,
|
|
687
662
|
otherProps = Listbox_objectWithoutProperties(_ref, ["children", "elementRef", "index", "label", "name", "onClick", "onKeyDown", "onSelectAllClick"]);
|
|
688
663
|
|
|
689
|
-
var labelIdRef =
|
|
690
|
-
var idRef =
|
|
664
|
+
var labelIdRef = (0,external_react_namespaceObject.useRef)((0,id_namespaceObject.createDOMID)('label'));
|
|
665
|
+
var idRef = (0,external_react_namespaceObject.useRef)((0,id_namespaceObject.createDOMID)('listbox'));
|
|
691
666
|
|
|
692
|
-
var _useContext =
|
|
667
|
+
var _useContext = (0,external_react_namespaceObject.useContext)(DualListbox_DualListboxContext),
|
|
693
668
|
controlled = _useContext.controlled,
|
|
694
669
|
getSelectedStateForValue = _useContext.getSelectedStateForValue,
|
|
695
670
|
getActiveValue = _useContext.getActiveValue,
|
|
@@ -698,20 +673,20 @@ function Listbox(_ref) {
|
|
|
698
673
|
updateLabelRefreshHookByName = _useContext.updateLabelRefreshHookByName,
|
|
699
674
|
updateOptionRefreshHookByValue = _useContext.updateOptionRefreshHookByValue;
|
|
700
675
|
|
|
701
|
-
var handleClick =
|
|
676
|
+
var handleClick = (0,external_react_namespaceObject.useCallback)(function (event, _ref2) {
|
|
702
677
|
var value = _ref2.value;
|
|
703
678
|
onClick === null || onClick === void 0 ? void 0 : onClick(event, {
|
|
704
679
|
name: name,
|
|
705
680
|
value: value
|
|
706
681
|
});
|
|
707
682
|
}, [name, onClick]);
|
|
708
|
-
var getOptionStateForValue =
|
|
683
|
+
var getOptionStateForValue = (0,external_react_namespaceObject.useCallback)(function (value) {
|
|
709
684
|
return {
|
|
710
685
|
active: (getActiveValue === null || getActiveValue === void 0 ? void 0 : getActiveValue(name)) === value,
|
|
711
686
|
selected: !!(getSelectedStateForValue === null || getSelectedStateForValue === void 0 ? void 0 : getSelectedStateForValue(value))
|
|
712
687
|
};
|
|
713
688
|
}, [name, getActiveValue, getSelectedStateForValue]);
|
|
714
|
-
var getLabelState =
|
|
689
|
+
var getLabelState = (0,external_react_namespaceObject.useCallback)(function () {
|
|
715
690
|
var valueCount = (getValueCount === null || getValueCount === void 0 ? void 0 : getValueCount(name)) || 0;
|
|
716
691
|
var selectedValueCount = (getSelectedValueCount === null || getSelectedValueCount === void 0 ? void 0 : getSelectedValueCount(name)) || 0;
|
|
717
692
|
var switchSelected = false;
|
|
@@ -749,7 +724,7 @@ function Listbox(_ref) {
|
|
|
749
724
|
}
|
|
750
725
|
};
|
|
751
726
|
|
|
752
|
-
var contextValue =
|
|
727
|
+
var contextValue = (0,external_react_namespaceObject.useMemo)(function () {
|
|
753
728
|
return {
|
|
754
729
|
onOptionClick: handleClick,
|
|
755
730
|
updateLabelRefreshHookByName: updateLabelRefreshHookByName,
|
|
@@ -759,16 +734,16 @@ function Listbox(_ref) {
|
|
|
759
734
|
controlled: controlled
|
|
760
735
|
};
|
|
761
736
|
}, [handleClick, updateLabelRefreshHookByName, updateOptionRefreshHookByValue, getOptionStateForValue, getLabelState, controlled]);
|
|
762
|
-
return /*#__PURE__*/external_react_default.
|
|
737
|
+
return /*#__PURE__*/external_react_default().createElement(DualListbox_ListboxContext.Provider, {
|
|
763
738
|
value: contextValue
|
|
764
|
-
}, /*#__PURE__*/external_react_default.
|
|
739
|
+
}, /*#__PURE__*/external_react_default().createElement(Label, {
|
|
765
740
|
id: labelIdRef.current,
|
|
766
741
|
index: index,
|
|
767
742
|
listId: idRef.current,
|
|
768
743
|
name: name,
|
|
769
744
|
onSwitchClick: handleSwitchClick,
|
|
770
745
|
value: label
|
|
771
|
-
}), /*#__PURE__*/external_react_default.
|
|
746
|
+
}), /*#__PURE__*/external_react_default().createElement(StyledListbox, Listbox_extends({
|
|
772
747
|
"aria-activedescendant": "" // Important this value stays static, only updated via DOM maniupulation
|
|
773
748
|
,
|
|
774
749
|
"aria-labelledby": labelIdRef.current,
|
|
@@ -785,31 +760,30 @@ function Listbox(_ref) {
|
|
|
785
760
|
}
|
|
786
761
|
|
|
787
762
|
Listbox.propTypes = Listbox_propTypes;
|
|
788
|
-
/* harmony default export */
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
var Box_default = /*#__PURE__*/__webpack_require__.n(
|
|
792
|
-
|
|
793
|
-
// CONCATENATED MODULE: ./src/DualListbox/DualListboxStyles.ts
|
|
763
|
+
/* harmony default export */ const DualListbox_Listbox = (Listbox);
|
|
764
|
+
;// CONCATENATED MODULE: external "@splunk/react-ui/Box"
|
|
765
|
+
const Box_namespaceObject = require("@splunk/react-ui/Box");
|
|
766
|
+
var Box_default = /*#__PURE__*/__webpack_require__.n(Box_namespaceObject);
|
|
767
|
+
;// CONCATENATED MODULE: ./src/DualListbox/DualListboxStyles.ts
|
|
794
768
|
|
|
795
769
|
|
|
796
770
|
|
|
797
|
-
var StyledBox = external_styled_components_default()(Box_default
|
|
771
|
+
var StyledBox = external_styled_components_default()((Box_default())).withConfig({
|
|
798
772
|
displayName: "DualListboxStyles__StyledBox",
|
|
799
773
|
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:", " ", ";", " ", ""],
|
|
774
|
+
})(["display:grid;grid-template-columns:[list0] 180px [actions] min-content [list1] 180px;grid-template-rows:[headers] min-content [lists] 160px;gap:", " ", ";", " ", ""], themes_namespaceObject.variables.spacingXSmall, themes_namespaceObject.variables.spacingSmall, function (_ref) {
|
|
801
775
|
var $inline = _ref.$inline;
|
|
802
|
-
return $inline &&
|
|
776
|
+
return $inline && (0,external_styled_components_namespaceObject.css)(["display:inline-grid;"]);
|
|
803
777
|
}, function (_ref2) {
|
|
804
778
|
var $fill = _ref2.$fill;
|
|
805
|
-
return $fill &&
|
|
779
|
+
return $fill && (0,external_styled_components_namespaceObject.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
780
|
});
|
|
807
|
-
var StyledFlexColumn = external_styled_components_default.
|
|
781
|
+
var StyledFlexColumn = external_styled_components_default().div.withConfig({
|
|
808
782
|
displayName: "DualListboxStyles__StyledFlexColumn",
|
|
809
783
|
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;"],
|
|
784
|
+
})(["&::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_namespaceObject.variables.spacingSmall);
|
|
811
785
|
|
|
812
|
-
|
|
786
|
+
;// CONCATENATED MODULE: ./src/DualListbox/DualListbox.tsx
|
|
813
787
|
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
788
|
|
|
815
789
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
@@ -849,15 +823,15 @@ function DualListbox_objectWithoutPropertiesLoose(source, excluded) { if (source
|
|
|
849
823
|
/** @public */
|
|
850
824
|
|
|
851
825
|
var DualListbox_propTypes = {
|
|
852
|
-
children: external_prop_types_default.
|
|
853
|
-
controlled: external_prop_types_default.
|
|
854
|
-
fill: external_prop_types_default.
|
|
855
|
-
inline: external_prop_types_default.
|
|
856
|
-
onChange: external_prop_types_default.
|
|
857
|
-
onSelect: external_prop_types_default.
|
|
858
|
-
lists: external_prop_types_default.
|
|
859
|
-
name: external_prop_types_default.
|
|
860
|
-
label: external_prop_types_default.
|
|
826
|
+
children: (external_prop_types_default()).node,
|
|
827
|
+
controlled: (external_prop_types_default()).bool,
|
|
828
|
+
fill: (external_prop_types_default()).bool,
|
|
829
|
+
inline: (external_prop_types_default()).bool,
|
|
830
|
+
onChange: (external_prop_types_default()).func,
|
|
831
|
+
onSelect: (external_prop_types_default()).func,
|
|
832
|
+
lists: external_prop_types_default().arrayOf(external_prop_types_default().shape({
|
|
833
|
+
name: (external_prop_types_default()).string.isRequired,
|
|
834
|
+
label: (external_prop_types_default()).string.isRequired
|
|
861
835
|
})).isRequired
|
|
862
836
|
};
|
|
863
837
|
|
|
@@ -878,39 +852,39 @@ function DualListbox(_ref) {
|
|
|
878
852
|
|
|
879
853
|
// @docs-props-type DualListboxPropsBase
|
|
880
854
|
var forceUpdate = useForceUpdate_default()();
|
|
881
|
-
var mountedRef =
|
|
882
|
-
|
|
855
|
+
var mountedRef = (0,external_react_namespaceObject.useRef)(false);
|
|
856
|
+
(0,external_react_namespaceObject.useEffect)(function () {
|
|
883
857
|
mountedRef.current = true;
|
|
884
858
|
}, []); // TODO: Implement shared isControlled hook (SUI-5283).
|
|
885
859
|
|
|
886
|
-
var isControlledRef =
|
|
860
|
+
var isControlledRef = (0,external_react_namespaceObject.useRef)(controlled); // List One "Available" Refs
|
|
887
861
|
|
|
888
|
-
var listOneValues =
|
|
889
|
-
var listOneSelectedValues =
|
|
890
|
-
var listOneActiveValue =
|
|
891
|
-
var listOneNodeRef =
|
|
892
|
-
var listOneMatchOptions =
|
|
862
|
+
var listOneValues = (0,external_react_namespaceObject.useRef)([]);
|
|
863
|
+
var listOneSelectedValues = (0,external_react_namespaceObject.useRef)([]);
|
|
864
|
+
var listOneActiveValue = (0,external_react_namespaceObject.useRef)();
|
|
865
|
+
var listOneNodeRef = (0,external_react_namespaceObject.useRef)(null);
|
|
866
|
+
var listOneMatchOptions = (0,external_react_namespaceObject.useRef)([]); // List Two "Selected" Refs
|
|
893
867
|
|
|
894
|
-
var listTwoValues =
|
|
895
|
-
var listTwoSelectedValues =
|
|
896
|
-
var listTwoActiveValue =
|
|
897
|
-
var listTwoNodeRef =
|
|
898
|
-
var listTwoMatchOptions =
|
|
868
|
+
var listTwoValues = (0,external_react_namespaceObject.useRef)([]);
|
|
869
|
+
var listTwoSelectedValues = (0,external_react_namespaceObject.useRef)([]);
|
|
870
|
+
var listTwoActiveValue = (0,external_react_namespaceObject.useRef)();
|
|
871
|
+
var listTwoNodeRef = (0,external_react_namespaceObject.useRef)(null);
|
|
872
|
+
var listTwoMatchOptions = (0,external_react_namespaceObject.useRef)([]); // Refresh Hook Stores, used to render indivual elements when uncontrolled
|
|
899
873
|
|
|
900
|
-
var buttonRefreshHookByName =
|
|
901
|
-
var labelRefreshHookByName =
|
|
902
|
-
var optionRefreshHookByValue =
|
|
903
|
-
var screenReaderRefreshHook =
|
|
874
|
+
var buttonRefreshHookByName = (0,external_react_namespaceObject.useRef)({});
|
|
875
|
+
var labelRefreshHookByName = (0,external_react_namespaceObject.useRef)({});
|
|
876
|
+
var optionRefreshHookByValue = (0,external_react_namespaceObject.useRef)({});
|
|
877
|
+
var screenReaderRefreshHook = (0,external_react_namespaceObject.useRef)(); // Activity Values Refs
|
|
904
878
|
|
|
905
|
-
var screenReaderValueRef =
|
|
906
|
-
var selectedByValue =
|
|
907
|
-
var idByValue =
|
|
908
|
-
var indexByValue =
|
|
909
|
-
var initialRangeIndex =
|
|
879
|
+
var screenReaderValueRef = (0,external_react_namespaceObject.useRef)();
|
|
880
|
+
var selectedByValue = (0,external_react_namespaceObject.useRef)({});
|
|
881
|
+
var idByValue = (0,external_react_namespaceObject.useRef)({});
|
|
882
|
+
var indexByValue = (0,external_react_namespaceObject.useRef)({});
|
|
883
|
+
var initialRangeIndex = (0,external_react_namespaceObject.useRef)(0); // Key Match Refs
|
|
910
884
|
|
|
911
|
-
var matchCharacter =
|
|
912
|
-
var matchTimeout =
|
|
913
|
-
var matchOptions =
|
|
885
|
+
var matchCharacter = (0,external_react_namespaceObject.useRef)();
|
|
886
|
+
var matchTimeout = (0,external_react_namespaceObject.useRef)();
|
|
887
|
+
var matchOptions = (0,external_react_namespaceObject.useRef)([]);
|
|
914
888
|
|
|
915
889
|
if (false) {}
|
|
916
890
|
|
|
@@ -956,7 +930,7 @@ function DualListbox(_ref) {
|
|
|
956
930
|
}];
|
|
957
931
|
|
|
958
932
|
if (!mountedRef.current || isControlledRef.current) {
|
|
959
|
-
|
|
933
|
+
external_react_namespaceObject.Children.toArray(children).filter(external_react_namespaceObject.isValidElement).forEach(function (child) {
|
|
960
934
|
var _child$props = child.props,
|
|
961
935
|
value = _child$props.value,
|
|
962
936
|
label = _child$props.label;
|
|
@@ -984,7 +958,7 @@ function DualListbox(_ref) {
|
|
|
984
958
|
idByValue.current[value] = child.props.id;
|
|
985
959
|
});
|
|
986
960
|
} else {
|
|
987
|
-
|
|
961
|
+
external_react_namespaceObject.Children.toArray(children).filter(external_react_namespaceObject.isValidElement).forEach(function (child) {
|
|
988
962
|
var _child$props2 = child.props,
|
|
989
963
|
value = _child$props2.value,
|
|
990
964
|
label = _child$props2.label;
|
|
@@ -1000,63 +974,63 @@ function DualListbox(_ref) {
|
|
|
1000
974
|
});
|
|
1001
975
|
}
|
|
1002
976
|
|
|
1003
|
-
var setActiveValue =
|
|
977
|
+
var setActiveValue = (0,external_react_namespaceObject.useCallback)(function (name, value) {
|
|
1004
978
|
if (name === listOneName) {
|
|
1005
979
|
listOneActiveValue.current = value;
|
|
1006
980
|
} else {
|
|
1007
981
|
listTwoActiveValue.current = value;
|
|
1008
982
|
}
|
|
1009
983
|
}, [listOneName]);
|
|
1010
|
-
var getActiveValue =
|
|
984
|
+
var getActiveValue = (0,external_react_namespaceObject.useCallback)(function (name) {
|
|
1011
985
|
return name === listOneName ? listOneActiveValue.current : listTwoActiveValue.current;
|
|
1012
986
|
}, [listOneName]);
|
|
1013
|
-
var setSelectedValues =
|
|
987
|
+
var setSelectedValues = (0,external_react_namespaceObject.useCallback)(function (name, values) {
|
|
1014
988
|
if (name === listOneName) {
|
|
1015
989
|
listOneSelectedValues.current = values;
|
|
1016
990
|
} else {
|
|
1017
991
|
listTwoSelectedValues.current = values;
|
|
1018
992
|
}
|
|
1019
993
|
}, [listOneName]);
|
|
1020
|
-
var getSelectedValues =
|
|
994
|
+
var getSelectedValues = (0,external_react_namespaceObject.useCallback)(function (name) {
|
|
1021
995
|
return name === listOneName ? listOneSelectedValues.current : listTwoSelectedValues.current;
|
|
1022
996
|
}, [listOneName]);
|
|
1023
|
-
var getSelectedValueCount =
|
|
997
|
+
var getSelectedValueCount = (0,external_react_namespaceObject.useCallback)(function (name) {
|
|
1024
998
|
return getSelectedValues(name).length;
|
|
1025
999
|
}, [getSelectedValues]);
|
|
1026
|
-
var getScreenReaderMessage =
|
|
1000
|
+
var getScreenReaderMessage = (0,external_react_namespaceObject.useCallback)(function () {
|
|
1027
1001
|
return screenReaderValueRef.current;
|
|
1028
1002
|
}, []);
|
|
1029
|
-
var getSelectedStateForValue =
|
|
1003
|
+
var getSelectedStateForValue = (0,external_react_namespaceObject.useCallback)(function (value) {
|
|
1030
1004
|
return selectedByValue.current[value];
|
|
1031
1005
|
}, []);
|
|
1032
|
-
var setValues =
|
|
1006
|
+
var setValues = (0,external_react_namespaceObject.useCallback)(function (name, values) {
|
|
1033
1007
|
if (name === listOneName) {
|
|
1034
1008
|
listOneValues.current = values;
|
|
1035
1009
|
} else {
|
|
1036
1010
|
listTwoValues.current = values;
|
|
1037
1011
|
}
|
|
1038
1012
|
}, [listOneName]);
|
|
1039
|
-
var getValues =
|
|
1013
|
+
var getValues = (0,external_react_namespaceObject.useCallback)(function (name) {
|
|
1040
1014
|
return name === listOneName ? listOneValues.current : listTwoValues.current;
|
|
1041
1015
|
}, [listOneName]);
|
|
1042
|
-
var getValueCount =
|
|
1016
|
+
var getValueCount = (0,external_react_namespaceObject.useCallback)(function (name) {
|
|
1043
1017
|
return getValues(name).length;
|
|
1044
1018
|
}, [getValues]);
|
|
1045
|
-
var getIsAllSelected =
|
|
1019
|
+
var getIsAllSelected = (0,external_react_namespaceObject.useCallback)(function (name) {
|
|
1046
1020
|
var valueCount = getValueCount(name);
|
|
1047
1021
|
return valueCount > 0 && valueCount === getSelectedValueCount(name);
|
|
1048
1022
|
}, [getValueCount, getSelectedValueCount]);
|
|
1049
|
-
var getAvailableMatchOptions =
|
|
1023
|
+
var getAvailableMatchOptions = (0,external_react_namespaceObject.useCallback)(function (name) {
|
|
1050
1024
|
return name === listOneName ? listOneMatchOptions.current : listTwoMatchOptions.current;
|
|
1051
1025
|
}, [listOneName]);
|
|
1052
|
-
var getButtonState =
|
|
1026
|
+
var getButtonState = (0,external_react_namespaceObject.useCallback)(function (name) {
|
|
1053
1027
|
var valueCount = getValueCount(name);
|
|
1054
1028
|
var selectedValueCount = getSelectedValueCount(name);
|
|
1055
1029
|
return {
|
|
1056
1030
|
disabled: valueCount < 1 || selectedValueCount < 1
|
|
1057
1031
|
};
|
|
1058
1032
|
}, [getValueCount, getSelectedValueCount]);
|
|
1059
|
-
var clearScreenReaderText =
|
|
1033
|
+
var clearScreenReaderText = (0,external_react_namespaceObject.useCallback)(function () {
|
|
1060
1034
|
if (screenReaderValueRef.current && screenReaderValueRef.current.length > 0) {
|
|
1061
1035
|
var _screenReaderRefreshH;
|
|
1062
1036
|
|
|
@@ -1064,7 +1038,7 @@ function DualListbox(_ref) {
|
|
|
1064
1038
|
(_screenReaderRefreshH = screenReaderRefreshHook.current) === null || _screenReaderRefreshH === void 0 ? void 0 : _screenReaderRefreshH.call(screenReaderRefreshHook);
|
|
1065
1039
|
}
|
|
1066
1040
|
}, []);
|
|
1067
|
-
var resetMatches =
|
|
1041
|
+
var resetMatches = (0,external_react_namespaceObject.useCallback)(function () {
|
|
1068
1042
|
matchCharacter.current = undefined;
|
|
1069
1043
|
matchOptions.current = [];
|
|
1070
1044
|
|
|
@@ -1072,58 +1046,58 @@ function DualListbox(_ref) {
|
|
|
1072
1046
|
clearTimeout(matchTimeout.current);
|
|
1073
1047
|
}
|
|
1074
1048
|
}, []);
|
|
1075
|
-
var updateScreenReaderRefreshHook =
|
|
1049
|
+
var updateScreenReaderRefreshHook = (0,external_react_namespaceObject.useCallback)(function (callback) {
|
|
1076
1050
|
screenReaderRefreshHook.current = callback;
|
|
1077
1051
|
}, []);
|
|
1078
|
-
var updateOptionRefreshHookByValue =
|
|
1052
|
+
var updateOptionRefreshHookByValue = (0,external_react_namespaceObject.useCallback)(function (value, callback) {
|
|
1079
1053
|
if (callback) {
|
|
1080
1054
|
optionRefreshHookByValue.current[value] = callback;
|
|
1081
1055
|
} else {
|
|
1082
1056
|
delete optionRefreshHookByValue.current[value];
|
|
1083
1057
|
}
|
|
1084
1058
|
}, []);
|
|
1085
|
-
var updateLabelRefreshHookByName =
|
|
1059
|
+
var updateLabelRefreshHookByName = (0,external_react_namespaceObject.useCallback)(function (name, callback) {
|
|
1086
1060
|
if (callback) {
|
|
1087
1061
|
labelRefreshHookByName.current[name] = callback;
|
|
1088
1062
|
} else {
|
|
1089
1063
|
delete labelRefreshHookByName.current[name];
|
|
1090
1064
|
}
|
|
1091
1065
|
}, []);
|
|
1092
|
-
var updateButtonRefreshHookByName =
|
|
1066
|
+
var updateButtonRefreshHookByName = (0,external_react_namespaceObject.useCallback)(function (name, callback) {
|
|
1093
1067
|
if (callback) {
|
|
1094
1068
|
buttonRefreshHookByName.current[name] = callback;
|
|
1095
1069
|
} else {
|
|
1096
1070
|
delete buttonRefreshHookByName.current[name];
|
|
1097
1071
|
}
|
|
1098
1072
|
}, []);
|
|
1099
|
-
var updateOption =
|
|
1073
|
+
var updateOption = (0,external_react_namespaceObject.useCallback)(function (value) {
|
|
1100
1074
|
if (value) {
|
|
1101
1075
|
var _optionRefreshHookByV, _optionRefreshHookByV2;
|
|
1102
1076
|
|
|
1103
1077
|
(_optionRefreshHookByV = (_optionRefreshHookByV2 = optionRefreshHookByValue.current)[value]) === null || _optionRefreshHookByV === void 0 ? void 0 : _optionRefreshHookByV.call(_optionRefreshHookByV2);
|
|
1104
1078
|
}
|
|
1105
1079
|
}, []);
|
|
1106
|
-
var updateLabel =
|
|
1080
|
+
var updateLabel = (0,external_react_namespaceObject.useCallback)(function (name) {
|
|
1107
1081
|
if (name) {
|
|
1108
1082
|
var _labelRefreshHookByNa, _labelRefreshHookByNa2;
|
|
1109
1083
|
|
|
1110
1084
|
(_labelRefreshHookByNa = (_labelRefreshHookByNa2 = labelRefreshHookByName.current)[name]) === null || _labelRefreshHookByNa === void 0 ? void 0 : _labelRefreshHookByNa.call(_labelRefreshHookByNa2);
|
|
1111
1085
|
}
|
|
1112
1086
|
}, []);
|
|
1113
|
-
var updateButton =
|
|
1087
|
+
var updateButton = (0,external_react_namespaceObject.useCallback)(function (name) {
|
|
1114
1088
|
if (name) {
|
|
1115
1089
|
var _buttonRefreshHookByN, _buttonRefreshHookByN2;
|
|
1116
1090
|
|
|
1117
1091
|
(_buttonRefreshHookByN = (_buttonRefreshHookByN2 = buttonRefreshHookByName.current)[name]) === null || _buttonRefreshHookByN === void 0 ? void 0 : _buttonRefreshHookByN.call(_buttonRefreshHookByN2);
|
|
1118
1092
|
}
|
|
1119
1093
|
}, []);
|
|
1120
|
-
var updateInternalDisplay =
|
|
1094
|
+
var updateInternalDisplay = (0,external_react_namespaceObject.useCallback)(function (name) {
|
|
1121
1095
|
clearScreenReaderText();
|
|
1122
1096
|
updateLabel(name);
|
|
1123
1097
|
updateButton(listOneName);
|
|
1124
1098
|
updateButton(listTwoName);
|
|
1125
1099
|
}, [clearScreenReaderText, updateButton, updateLabel, listOneName, listTwoName]);
|
|
1126
|
-
var updateActiveOption =
|
|
1100
|
+
var updateActiveOption = (0,external_react_namespaceObject.useCallback)(function (name, value) {
|
|
1127
1101
|
var skipRender = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
1128
1102
|
var listbox = name === listOneName ? listOneNodeRef.current : listTwoNodeRef.current;
|
|
1129
1103
|
|
|
@@ -1151,11 +1125,11 @@ function DualListbox(_ref) {
|
|
|
1151
1125
|
|
|
1152
1126
|
if (!skipRender && id.length > 0) {
|
|
1153
1127
|
var element = listbox.querySelector("#".concat(id));
|
|
1154
|
-
|
|
1128
|
+
scrollIntoViewIfNeeded(element);
|
|
1155
1129
|
}
|
|
1156
1130
|
}
|
|
1157
1131
|
}, [getActiveValue, setActiveValue, updateOption, listOneName]);
|
|
1158
|
-
var handleSingleSelection =
|
|
1132
|
+
var handleSingleSelection = (0,external_react_namespaceObject.useCallback)(function (event, _ref2) {
|
|
1159
1133
|
var value = _ref2.value,
|
|
1160
1134
|
name = _ref2.name;
|
|
1161
1135
|
var sourceValues = getIsAllSelected(name) ? getValues(name) : getSelectedValues(name);
|
|
@@ -1174,7 +1148,7 @@ function DualListbox(_ref) {
|
|
|
1174
1148
|
listName: name
|
|
1175
1149
|
});
|
|
1176
1150
|
}, [getIsAllSelected, getSelectedValues, getValues, setSelectedValues, updateActiveOption, updateInternalDisplay, onSelect]);
|
|
1177
|
-
var handleRangeSelection =
|
|
1151
|
+
var handleRangeSelection = (0,external_react_namespaceObject.useCallback)(function (event, _ref3) {
|
|
1178
1152
|
var initialIndex = _ref3.initialIndex,
|
|
1179
1153
|
name = _ref3.name,
|
|
1180
1154
|
targetIndex = _ref3.targetIndex;
|
|
@@ -1213,7 +1187,7 @@ function DualListbox(_ref) {
|
|
|
1213
1187
|
listName: name
|
|
1214
1188
|
});
|
|
1215
1189
|
}, [getValues, onSelect, setSelectedValues, updateActiveOption, updateInternalDisplay, updateOption]);
|
|
1216
|
-
var handleSelectAll =
|
|
1190
|
+
var handleSelectAll = (0,external_react_namespaceObject.useCallback)(function (event, _ref4) {
|
|
1217
1191
|
var name = _ref4.name,
|
|
1218
1192
|
selected = _ref4.selected;
|
|
1219
1193
|
var listValues = getValues(name);
|
|
@@ -1238,7 +1212,7 @@ function DualListbox(_ref) {
|
|
|
1238
1212
|
});
|
|
1239
1213
|
}, [getValues, onSelect, setSelectedValues, updateInternalDisplay, updateOption]); // handleMoveValues does not update the active value of the source, keyboard and mouse differ, only the target active value is updated
|
|
1240
1214
|
|
|
1241
|
-
var handleMoveValues =
|
|
1215
|
+
var handleMoveValues = (0,external_react_namespaceObject.useCallback)(function (event, sourceName, targetName) {
|
|
1242
1216
|
var sourceValues = getValues(sourceName);
|
|
1243
1217
|
var sourceSelectedValues = getSelectedValues(sourceName);
|
|
1244
1218
|
var sourceIsAllSelected = getIsAllSelected(sourceName);
|
|
@@ -1255,7 +1229,7 @@ function DualListbox(_ref) {
|
|
|
1255
1229
|
updateActiveOption(targetName, sourceSelectedValues[0], true);
|
|
1256
1230
|
}
|
|
1257
1231
|
|
|
1258
|
-
var message =
|
|
1232
|
+
var message = (0,format_namespaceObject.sprintf)((0,i18n_namespaceObject._)('Moved %(count)d items to %(listLabel)s list'), {
|
|
1259
1233
|
count: sourceSelectedValues.length,
|
|
1260
1234
|
listLabel: targetName === listOneName ? listOneLabel : listTwoLabel
|
|
1261
1235
|
}); // These new values do not perserve sort position, may need to be refactored with sort logic (SUI-5270).
|
|
@@ -1287,7 +1261,7 @@ function DualListbox(_ref) {
|
|
|
1287
1261
|
event.preventDefault();
|
|
1288
1262
|
onChange === null || onChange === void 0 ? void 0 : onChange(event, data);
|
|
1289
1263
|
}, [forceUpdate, getActiveValue, getIsAllSelected, getSelectedValues, getValues, onChange, setSelectedValues, setValues, updateActiveOption, listOneName, listOneLabel, listTwoLabel]);
|
|
1290
|
-
var handleToolbarButtonClick =
|
|
1264
|
+
var handleToolbarButtonClick = (0,external_react_namespaceObject.useCallback)(function (event, _ref5) {
|
|
1291
1265
|
var name = _ref5.name;
|
|
1292
1266
|
var isAllSelected = getIsAllSelected(name);
|
|
1293
1267
|
var activeValue = getActiveValue(name);
|
|
@@ -1300,7 +1274,7 @@ function DualListbox(_ref) {
|
|
|
1300
1274
|
|
|
1301
1275
|
handleMoveValues(event, name, targetName);
|
|
1302
1276
|
}, [getActiveValue, getIsAllSelected, handleMoveValues, updateActiveOption, listOneName, listTwoName]);
|
|
1303
|
-
var handleOptionClick =
|
|
1277
|
+
var handleOptionClick = (0,external_react_namespaceObject.useCallback)(function (event, _ref6) {
|
|
1304
1278
|
var name = _ref6.name,
|
|
1305
1279
|
value = _ref6.value;
|
|
1306
1280
|
|
|
@@ -1317,10 +1291,10 @@ function DualListbox(_ref) {
|
|
|
1317
1291
|
});
|
|
1318
1292
|
}
|
|
1319
1293
|
}, [handleRangeSelection, handleSingleSelection]);
|
|
1320
|
-
var handleSelectAllClick =
|
|
1294
|
+
var handleSelectAllClick = (0,external_react_namespaceObject.useCallback)(function (event, data) {
|
|
1321
1295
|
handleSelectAll(event, data);
|
|
1322
1296
|
}, [handleSelectAll]);
|
|
1323
|
-
var handleKeyMatch =
|
|
1297
|
+
var handleKeyMatch = (0,external_react_namespaceObject.useCallback)(function (e, name) {
|
|
1324
1298
|
var currentKey = e.nativeEvent.key;
|
|
1325
1299
|
var availableOptions = getAvailableMatchOptions(name); // Checking for a single character to avoid complications from double-byte languages and emojis.
|
|
1326
1300
|
|
|
@@ -1337,10 +1311,10 @@ function DualListbox(_ref) {
|
|
|
1337
1311
|
return;
|
|
1338
1312
|
}
|
|
1339
1313
|
|
|
1340
|
-
matches =
|
|
1314
|
+
matches = fuzzyMatch(availableOptions, character);
|
|
1341
1315
|
} else if (matchOptions.current.length > 1) {
|
|
1342
1316
|
character.index = matchCharacter.current.index + 1;
|
|
1343
|
-
matches =
|
|
1317
|
+
matches = fuzzyMatch(matchOptions.current, character);
|
|
1344
1318
|
}
|
|
1345
1319
|
|
|
1346
1320
|
if (matches.length) {
|
|
@@ -1375,9 +1349,9 @@ function DualListbox(_ref) {
|
|
|
1375
1349
|
e.stopPropagation();
|
|
1376
1350
|
}
|
|
1377
1351
|
}, [getActiveValue, getAvailableMatchOptions, resetMatches, updateActiveOption]);
|
|
1378
|
-
var handleListboxKeyDown =
|
|
1352
|
+
var handleListboxKeyDown = (0,external_react_namespaceObject.useCallback)(function (event, _ref7) {
|
|
1379
1353
|
var name = _ref7.name;
|
|
1380
|
-
var eventKeyCode =
|
|
1354
|
+
var eventKeyCode = (0,keyboard_namespaceObject.keycode)(event.nativeEvent);
|
|
1381
1355
|
var listboxValues = getValues(name);
|
|
1382
1356
|
var listboxSelectedValues = getSelectedValues(name);
|
|
1383
1357
|
var isAllSelected = getIsAllSelected(name);
|
|
@@ -1514,14 +1488,14 @@ function DualListbox(_ref) {
|
|
|
1514
1488
|
updateActiveOption(name, nextActiveValue);
|
|
1515
1489
|
}
|
|
1516
1490
|
}, [clearScreenReaderText, getActiveValue, getIsAllSelected, getSelectedValues, getValues, handleKeyMatch, handleMoveValues, handleRangeSelection, handleSingleSelection, handleSelectAll, updateActiveOption, listOneName, listTwoName]);
|
|
1517
|
-
var toolbarContextValue =
|
|
1491
|
+
var toolbarContextValue = (0,external_react_namespaceObject.useMemo)(function () {
|
|
1518
1492
|
return {
|
|
1519
1493
|
onButtonClick: handleToolbarButtonClick,
|
|
1520
1494
|
updateButtonRefreshHookByName: updateButtonRefreshHookByName,
|
|
1521
1495
|
getButtonState: getButtonState
|
|
1522
1496
|
};
|
|
1523
1497
|
}, [handleToolbarButtonClick, updateButtonRefreshHookByName, getButtonState]);
|
|
1524
|
-
var dualContextValue =
|
|
1498
|
+
var dualContextValue = (0,external_react_namespaceObject.useMemo)(function () {
|
|
1525
1499
|
return {
|
|
1526
1500
|
controlled: isControlledRef.current,
|
|
1527
1501
|
getActiveValue: getActiveValue,
|
|
@@ -1547,13 +1521,13 @@ function DualListbox(_ref) {
|
|
|
1547
1521
|
updateActiveOption(listTwoName, undefined, true);
|
|
1548
1522
|
}
|
|
1549
1523
|
|
|
1550
|
-
return /*#__PURE__*/external_react_default.
|
|
1524
|
+
return /*#__PURE__*/external_react_default().createElement(StyledBox, DualListbox_extends({
|
|
1551
1525
|
"data-test": "dual-listbox",
|
|
1552
1526
|
$inline: fill ? false : inline,
|
|
1553
1527
|
$fill: fill
|
|
1554
|
-
}, otherProps), /*#__PURE__*/external_react_default.
|
|
1528
|
+
}, otherProps), /*#__PURE__*/external_react_default().createElement(DualListbox_DualListboxContext.Provider, {
|
|
1555
1529
|
value: dualContextValue
|
|
1556
|
-
}, /*#__PURE__*/external_react_default.
|
|
1530
|
+
}, /*#__PURE__*/external_react_default().createElement(DualListbox_Listbox, {
|
|
1557
1531
|
index: 0,
|
|
1558
1532
|
elementRef: listOneNodeRef,
|
|
1559
1533
|
label: listOneLabel,
|
|
@@ -1561,39 +1535,39 @@ function DualListbox(_ref) {
|
|
|
1561
1535
|
onClick: handleOptionClick,
|
|
1562
1536
|
onKeyDown: handleListboxKeyDown,
|
|
1563
1537
|
onSelectAllClick: handleSelectAllClick
|
|
1564
|
-
}, listData[0].options), /*#__PURE__*/external_react_default.
|
|
1538
|
+
}, listData[0].options), /*#__PURE__*/external_react_default().createElement(StyledFlexColumn, null, /*#__PURE__*/external_react_default().createElement(DualListbox_ToolbarContext.Provider, {
|
|
1565
1539
|
value: toolbarContextValue
|
|
1566
|
-
}, /*#__PURE__*/external_react_default.
|
|
1567
|
-
ariaLabel:
|
|
1540
|
+
}, /*#__PURE__*/external_react_default().createElement(DualListbox_ToolbarButton, {
|
|
1541
|
+
ariaLabel: (0,format_namespaceObject.sprintf)((0,i18n_namespaceObject._)('Move selected options to %(listLabel)s list'), {
|
|
1568
1542
|
listLabel: listTwoLabel
|
|
1569
1543
|
}),
|
|
1570
1544
|
ariaKeyShortcuts: "Enter",
|
|
1571
1545
|
"data-test": "move-to-secondary",
|
|
1572
|
-
icon: /*#__PURE__*/external_react_default.
|
|
1546
|
+
icon: /*#__PURE__*/external_react_default().createElement((ChevronRight_default()), {
|
|
1573
1547
|
hideDefaultTooltip: true,
|
|
1574
1548
|
screenReaderText: null
|
|
1575
1549
|
}),
|
|
1576
1550
|
name: listOneName,
|
|
1577
|
-
tooltipLabel:
|
|
1551
|
+
tooltipLabel: (0,format_namespaceObject.sprintf)((0,i18n_namespaceObject._)('Move to %(listLabel)s'), {
|
|
1578
1552
|
listLabel: listTwoLabel
|
|
1579
1553
|
}),
|
|
1580
1554
|
tooltipPlacement: "left"
|
|
1581
|
-
}), /*#__PURE__*/external_react_default.
|
|
1582
|
-
ariaLabel:
|
|
1555
|
+
}), /*#__PURE__*/external_react_default().createElement(DualListbox_ToolbarButton, {
|
|
1556
|
+
ariaLabel: (0,format_namespaceObject.sprintf)((0,i18n_namespaceObject._)('Move selected options to %(listLabel)s list'), {
|
|
1583
1557
|
listLabel: listOneLabel
|
|
1584
1558
|
}),
|
|
1585
1559
|
ariaKeyShortcuts: "Delete",
|
|
1586
1560
|
"data-test": "move-to-primary",
|
|
1587
|
-
icon: /*#__PURE__*/external_react_default.
|
|
1561
|
+
icon: /*#__PURE__*/external_react_default().createElement((ChevronLeft_default()), {
|
|
1588
1562
|
hideDefaultTooltip: true,
|
|
1589
1563
|
screenReaderText: null
|
|
1590
1564
|
}),
|
|
1591
1565
|
name: listTwoName,
|
|
1592
|
-
tooltipLabel:
|
|
1566
|
+
tooltipLabel: (0,format_namespaceObject.sprintf)((0,i18n_namespaceObject._)('Move to %(listLabel)s'), {
|
|
1593
1567
|
listLabel: listOneLabel
|
|
1594
1568
|
}),
|
|
1595
1569
|
tooltipPlacement: "right"
|
|
1596
|
-
}))), /*#__PURE__*/external_react_default.
|
|
1570
|
+
}))), /*#__PURE__*/external_react_default().createElement(DualListbox_Listbox, {
|
|
1597
1571
|
index: 1,
|
|
1598
1572
|
elementRef: listTwoNodeRef,
|
|
1599
1573
|
label: listTwoLabel,
|
|
@@ -1601,183 +1575,16 @@ function DualListbox(_ref) {
|
|
|
1601
1575
|
onClick: handleOptionClick,
|
|
1602
1576
|
onKeyDown: handleListboxKeyDown,
|
|
1603
1577
|
onSelectAllClick: handleSelectAllClick
|
|
1604
|
-
}, listData[1].options), /*#__PURE__*/external_react_default.
|
|
1578
|
+
}, listData[1].options), /*#__PURE__*/external_react_default().createElement(DualListbox_ScreenReaderWrapper, null)));
|
|
1605
1579
|
}
|
|
1606
1580
|
|
|
1607
1581
|
DualListbox.propTypes = DualListbox_propTypes;
|
|
1608
1582
|
DualListbox.Option = DualListbox_Option;
|
|
1609
|
-
/* harmony default export */
|
|
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
|
-
/***/ 28:
|
|
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
|
-
/***/ 35:
|
|
1639
|
-
/***/ (function(module, exports) {
|
|
1640
|
-
|
|
1641
|
-
module.exports = require("@splunk/react-icons/enterprise/ChevronRight");
|
|
1642
|
-
|
|
1643
|
-
/***/ }),
|
|
1644
|
-
|
|
1645
|
-
/***/ 4:
|
|
1646
|
-
/***/ (function(module, exports) {
|
|
1647
|
-
|
|
1648
|
-
module.exports = require("@splunk/ui-utils/i18n");
|
|
1649
|
-
|
|
1650
|
-
/***/ }),
|
|
1651
|
-
|
|
1652
|
-
/***/ 42:
|
|
1653
|
-
/***/ (function(module, exports) {
|
|
1654
|
-
|
|
1655
|
-
module.exports = require("@splunk/react-ui/Tooltip");
|
|
1656
|
-
|
|
1657
|
-
/***/ }),
|
|
1658
|
-
|
|
1659
|
-
/***/ 45:
|
|
1660
|
-
/***/ (function(module, exports) {
|
|
1661
|
-
|
|
1662
|
-
module.exports = require("@splunk/react-ui/useForceUpdate");
|
|
1663
|
-
|
|
1664
|
-
/***/ }),
|
|
1665
|
-
|
|
1666
|
-
/***/ 56:
|
|
1667
|
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
1668
|
-
|
|
1669
|
-
"use strict";
|
|
1670
|
-
/* unused harmony export charFromMatchOption */
|
|
1671
|
-
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return fuzzyMatch; });
|
|
1672
|
-
// A utility for matching keyboard characters to list values
|
|
1673
|
-
var charFromMatchOption = function charFromMatchOption(option, charIndex) {
|
|
1674
|
-
return option ? option.label.charAt(charIndex).toLowerCase() : '';
|
|
1675
|
-
};
|
|
1676
|
-
|
|
1677
|
-
var fuzzyMatch = function fuzzyMatch(options, matchChar) {
|
|
1678
|
-
if (!options.length) {
|
|
1679
|
-
return options;
|
|
1680
|
-
}
|
|
1681
|
-
|
|
1682
|
-
var defaultMatch = null;
|
|
1683
|
-
var hasMatch = false;
|
|
1684
|
-
var matches = options.filter(function (option) {
|
|
1685
|
-
var characterValue = charFromMatchOption(option, matchChar.index);
|
|
1686
|
-
|
|
1687
|
-
if (characterValue === matchChar.value) {
|
|
1688
|
-
hasMatch = true;
|
|
1689
|
-
return true;
|
|
1690
|
-
} // If we haven't found a match yet, keep track of the next closest match.
|
|
1691
|
-
// Secondary matching looks for the closest character of a higher value, and failing that, closest of a lower value.
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
if (!hasMatch) {
|
|
1695
|
-
var defaultValue = charFromMatchOption(defaultMatch, matchChar.index);
|
|
1696
|
-
|
|
1697
|
-
if (!defaultValue) {
|
|
1698
|
-
defaultMatch = option;
|
|
1699
|
-
} else if (characterValue > matchChar.value) {
|
|
1700
|
-
if (defaultValue < matchChar.value) {
|
|
1701
|
-
defaultMatch = option;
|
|
1702
|
-
} else if (defaultValue > characterValue) {
|
|
1703
|
-
defaultMatch = option;
|
|
1704
|
-
}
|
|
1705
|
-
} else if (characterValue > defaultValue) {
|
|
1706
|
-
defaultMatch = option;
|
|
1707
|
-
}
|
|
1708
|
-
}
|
|
1709
|
-
|
|
1710
|
-
return false;
|
|
1711
|
-
});
|
|
1712
|
-
return matches.length === 0 && defaultMatch ? [defaultMatch] : matches;
|
|
1713
|
-
};
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
/***/ }),
|
|
1718
|
-
|
|
1719
|
-
/***/ 58:
|
|
1720
|
-
/***/ (function(module, exports) {
|
|
1721
|
-
|
|
1722
|
-
module.exports = require("@splunk/react-ui/Switch");
|
|
1723
|
-
|
|
1724
|
-
/***/ }),
|
|
1725
|
-
|
|
1726
|
-
/***/ 6:
|
|
1727
|
-
/***/ (function(module, exports) {
|
|
1728
|
-
|
|
1729
|
-
module.exports = require("@splunk/react-ui/Box");
|
|
1730
|
-
|
|
1731
|
-
/***/ }),
|
|
1732
|
-
|
|
1733
|
-
/***/ 64:
|
|
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
|
-
/***/ 89:
|
|
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
|
-
|
|
1583
|
+
/* harmony default export */ const DualListbox_DualListbox = (DualListbox);
|
|
1779
1584
|
|
|
1585
|
+
;// CONCATENATED MODULE: ./src/DualListbox/index.ts
|
|
1780
1586
|
|
|
1781
|
-
/***/ })
|
|
1782
1587
|
|
|
1783
|
-
|
|
1588
|
+
module.exports = __webpack_exports__;
|
|
1589
|
+
/******/ })()
|
|
1590
|
+
;
|