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