@splunk/react-ui 4.21.0 → 4.22.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 +425 -325
- package/Anchor.js +147 -117
- package/Animation.js +142 -94
- package/AnimationToggle.js +197 -193
- package/Box.js +145 -118
- package/Breadcrumbs.js +288 -206
- package/Button.js +488 -465
- package/ButtonGroup.js +160 -128
- package/ButtonSimple.js +543 -462
- package/CHANGELOG.md +24 -3
- package/Calendar.js +1111 -1001
- package/Card.js +771 -598
- package/CardLayout.js +205 -147
- package/Chip.js +509 -488
- package/Clickable.js +414 -352
- package/CloseButton.js +165 -142
- package/Code.js +1807 -2084
- package/CollapsiblePanel.js +586 -519
- package/Color.js +1068 -1068
- package/ColumnLayout.js +402 -363
- package/ComboBox.js +903 -794
- package/Concertina.js +997 -802
- package/ControlGroup.js +687 -594
- package/Date.js +567 -547
- package/DefinitionList.js +308 -234
- package/Divider.js +149 -118
- package/Dropdown.js +459 -416
- package/DualListbox.js +1479 -1541
- package/EventListener.js +94 -97
- package/File.js +1051 -969
- package/FormRows.js +883 -696
- package/Heading.js +216 -193
- package/Image.js +446 -402
- package/JSONTree.js +690 -551
- package/Layer.js +437 -410
- package/Link.js +336 -255
- package/List.js +213 -161
- package/Markdown.js +509 -487
- package/Menu.js +1104 -1056
- package/Message.js +475 -441
- package/MessageBar.js +387 -373
- package/Modal.js +810 -634
- package/ModalLayer.js +326 -243
- package/Monogram.js +308 -276
- package/Multiselect.js +3564 -3364
- package/Number.js +729 -687
- package/Paginator.js +510 -449
- package/Paragraph.js +145 -112
- package/Popover.js +1459 -1432
- package/Progress.js +301 -246
- package/RadioBar.js +634 -527
- package/RadioList.js +483 -444
- package/Resize.js +530 -489
- package/ResultsMenu.js +479 -455
- package/ScreenReaderContent.js +142 -111
- package/Scroll.js +595 -456
- package/ScrollContainerContext.js +197 -206
- package/Search.js +756 -650
- package/Select.js +2446 -2345
- package/SidePanel.js +390 -284
- package/Slider.js +680 -676
- package/SlidingPanels.js +639 -503
- package/SplitButton.js +464 -367
- package/StaticContent.js +161 -133
- package/StepBar.js +386 -358
- package/Switch.js +710 -640
- package/TabBar.js +741 -680
- package/TabLayout.js +406 -322
- package/Table.js +4974 -4616
- package/Text.js +1170 -1138
- package/TextArea.js +1102 -1090
- package/Tooltip.js +624 -581
- package/TransitionOpen.js +489 -422
- package/Typography.js +176 -153
- package/WaitSpinner.js +230 -206
- package/package.json +7 -7
- package/types/src/Color/Color.d.ts +0 -1
- package/types/src/JSONTree/JSONTreeContext.d.ts +7 -0
- package/types/src/JSONTree/TreeNode.d.ts +5 -0
- package/types/src/RadioBar/RadioBar.d.ts +1 -0
- package/types/src/ResultsMenu/ResultsMenu.d.ts +0 -2
- package/types/src/Select/docs/examples/Icons.d.ts +1 -9
- package/types/src/Slider/Slider.d.ts +1 -0
- package/types/src/TabBar/Tab.d.ts +10 -1
- package/types/src/TabBar/TabBar.d.ts +4 -2
- package/types/src/Table/Head.d.ts +7 -3
- package/types/src/Table/Table.d.ts +3 -2
- package/types/src/Table/TableContext.d.ts +2 -0
- package/useForceUpdate.js +112 -82
- package/useKeyPress.js +74 -71
- package/usePrevious.js +65 -65
- package/useRovingFocus.js +122 -138
package/RadioBar.js
CHANGED
|
@@ -1,538 +1,645 @@
|
|
|
1
|
-
/******/ (() => {
|
|
2
|
-
|
|
3
|
-
/******/
|
|
4
|
-
/******/
|
|
5
|
-
/******/
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
/******/
|
|
9
|
-
/******/
|
|
10
|
-
/******/
|
|
11
|
-
/******/
|
|
12
|
-
/******/
|
|
13
|
-
/******/
|
|
14
|
-
/******/
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
/******/
|
|
20
|
-
/******/
|
|
21
|
-
/******/
|
|
22
|
-
/******/
|
|
23
|
-
/******/
|
|
24
|
-
/******/
|
|
25
|
-
/******/
|
|
26
|
-
/******/
|
|
27
|
-
/******/
|
|
28
|
-
/******/
|
|
29
|
-
/******/
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
/******/
|
|
34
|
-
/******/
|
|
35
|
-
/******/
|
|
36
|
-
/******/
|
|
37
|
-
/******/
|
|
38
|
-
/******/
|
|
39
|
-
/******/
|
|
40
|
-
/******/
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
/******/
|
|
44
|
-
/******/
|
|
45
|
-
/******/
|
|
46
|
-
/******/
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
const
|
|
69
|
-
var
|
|
70
|
-
|
|
71
|
-
const
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
},
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
label: (external_prop_types_default()).string,
|
|
148
|
-
|
|
149
|
-
/** @private Set by `RadioBar`. */
|
|
150
|
-
selected: (external_prop_types_default()).bool,
|
|
151
|
-
|
|
152
|
-
/** The value of the `Option`. */
|
|
153
|
-
value: (external_prop_types_default()).any.isRequired
|
|
154
|
-
};
|
|
155
|
-
|
|
156
|
-
function Option(_ref) {
|
|
157
|
-
var disabled = _ref.disabled,
|
|
158
|
-
icon = _ref.icon,
|
|
159
|
-
label = _ref.label,
|
|
160
|
-
selected = _ref.selected,
|
|
161
|
-
startAdornment = _ref.startAdornment,
|
|
162
|
-
endAdornment = _ref.endAdornment,
|
|
163
|
-
value = _ref.value,
|
|
164
|
-
otherProps = _objectWithoutProperties(_ref, ["disabled", "icon", "label", "selected", "startAdornment", "endAdornment", "value"]);
|
|
165
|
-
|
|
166
|
-
// @docs-props-type OptionPropsBase
|
|
167
|
-
var _useContext = (0,external_react_namespaceObject.useContext)(RadioBar_RadioBarContext),
|
|
168
|
-
onClickContext = _useContext.onClick,
|
|
169
|
-
appearanceContext = _useContext.appearance,
|
|
170
|
-
errorContext = _useContext.error,
|
|
171
|
-
onKeyDownContext = _useContext.onKeyDown,
|
|
172
|
-
firstValueContext = _useContext.firstValue,
|
|
173
|
-
selectedValueContext = _useContext.selectedValue;
|
|
174
|
-
|
|
175
|
-
if (false) {}
|
|
176
|
-
|
|
177
|
-
var tabIndex = -1;
|
|
178
|
-
|
|
179
|
-
if (selectedValueContext) {
|
|
180
|
-
if (value === selectedValueContext) {
|
|
181
|
-
tabIndex = 0;
|
|
1
|
+
/******/ (() => {
|
|
2
|
+
// webpackBootstrap
|
|
3
|
+
/******/ "use strict";
|
|
4
|
+
/******/ // The require scope
|
|
5
|
+
/******/ var e = {};
|
|
6
|
+
/******/
|
|
7
|
+
/************************************************************************/
|
|
8
|
+
/******/ /* webpack/runtime/compat get default export */
|
|
9
|
+
/******/ (() => {
|
|
10
|
+
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
|
11
|
+
/******/ e.n = r => {
|
|
12
|
+
/******/ var t = r && r.__esModule ?
|
|
13
|
+
/******/ () => r["default"]
|
|
14
|
+
/******/ : () => r
|
|
15
|
+
/******/;
|
|
16
|
+
e.d(t, {
|
|
17
|
+
a: t
|
|
18
|
+
});
|
|
19
|
+
/******/ return t;
|
|
20
|
+
/******/ };
|
|
21
|
+
/******/ })();
|
|
22
|
+
/******/
|
|
23
|
+
/******/ /* webpack/runtime/define property getters */
|
|
24
|
+
/******/ (() => {
|
|
25
|
+
/******/ // define getter functions for harmony exports
|
|
26
|
+
/******/ e.d = (r, t) => {
|
|
27
|
+
/******/ for (var n in t) {
|
|
28
|
+
/******/ if (e.o(t, n) && !e.o(r, n)) {
|
|
29
|
+
/******/ Object.defineProperty(r, n, {
|
|
30
|
+
enumerable: true,
|
|
31
|
+
get: t[n]
|
|
32
|
+
});
|
|
33
|
+
/******/ }
|
|
34
|
+
/******/ }
|
|
35
|
+
/******/ };
|
|
36
|
+
/******/ })();
|
|
37
|
+
/******/
|
|
38
|
+
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
|
39
|
+
/******/ (() => {
|
|
40
|
+
/******/ e.o = (e, r) => Object.prototype.hasOwnProperty.call(e, r)
|
|
41
|
+
/******/;
|
|
42
|
+
})();
|
|
43
|
+
/******/
|
|
44
|
+
/******/ /* webpack/runtime/make namespace object */
|
|
45
|
+
/******/ (() => {
|
|
46
|
+
/******/ // define __esModule on exports
|
|
47
|
+
/******/ e.r = e => {
|
|
48
|
+
/******/ if (typeof Symbol !== "undefined" && Symbol.toStringTag) {
|
|
49
|
+
/******/ Object.defineProperty(e, Symbol.toStringTag, {
|
|
50
|
+
value: "Module"
|
|
51
|
+
});
|
|
52
|
+
/******/ }
|
|
53
|
+
/******/ Object.defineProperty(e, "__esModule", {
|
|
54
|
+
value: true
|
|
55
|
+
});
|
|
56
|
+
/******/ };
|
|
57
|
+
/******/ })();
|
|
58
|
+
/******/
|
|
59
|
+
/************************************************************************/ var r = {};
|
|
60
|
+
// ESM COMPAT FLAG
|
|
61
|
+
e.r(r);
|
|
62
|
+
// EXPORTS
|
|
63
|
+
e.d(r, {
|
|
64
|
+
Option: () => /* reexport */ _,
|
|
65
|
+
default: () => /* reexport */ re
|
|
66
|
+
});
|
|
67
|
+
// CONCATENATED MODULE: external "react"
|
|
68
|
+
const t = require("react");
|
|
69
|
+
var n = e.n(t);
|
|
70
|
+
// CONCATENATED MODULE: external "prop-types"
|
|
71
|
+
const a = require("prop-types");
|
|
72
|
+
var l = e.n(a);
|
|
73
|
+
// CONCATENATED MODULE: external "lodash/has"
|
|
74
|
+
const o = require("lodash/has");
|
|
75
|
+
var i = e.n(o);
|
|
76
|
+
// CONCATENATED MODULE: external "lodash/omit"
|
|
77
|
+
const u = require("lodash/omit");
|
|
78
|
+
var c = e.n(u);
|
|
79
|
+
// CONCATENATED MODULE: external "@splunk/ui-utils/keyboard"
|
|
80
|
+
const s = require("@splunk/ui-utils/keyboard");
|
|
81
|
+
// CONCATENATED MODULE: external "@splunk/themes"
|
|
82
|
+
const f = require("@splunk/themes");
|
|
83
|
+
// CONCATENATED MODULE: external "@splunk/react-ui/Button"
|
|
84
|
+
const d = require("@splunk/react-ui/Button");
|
|
85
|
+
var p = e.n(d);
|
|
86
|
+
// CONCATENATED MODULE: external "styled-components"
|
|
87
|
+
const v = require("styled-components");
|
|
88
|
+
var b = e.n(v);
|
|
89
|
+
// CONCATENATED MODULE: external "@splunk/react-ui/Clickable"
|
|
90
|
+
const y = require("@splunk/react-ui/Clickable");
|
|
91
|
+
var h = e.n(y);
|
|
92
|
+
// CONCATENATED MODULE: ./src/RadioBar/OptionStyles.ts
|
|
93
|
+
var g = b()(h()).withConfig({
|
|
94
|
+
displayName: "OptionStyles__StyledClickable",
|
|
95
|
+
componentId: "fyq77p-0"
|
|
96
|
+
})([ "border-radius:3px;flex:1 1 auto;display:flex;justify-content:center;align-items:center;color:", ";padding:2px 12px;height:calc(", " - 6px);position:relative;gap:", ";& + &{margin-left:2px;}", " ", " &:focus{color:", ";box-shadow:", ";z-index:2;&:active{background-color:", ";}}", " ", "" ], f.variables.contentColorDefault, f.variables.inputHeight, f.variables.spacingXSmall, (function(e) {
|
|
97
|
+
var r = e.$selected;
|
|
98
|
+
return r && (0, v.css)([ "color:", ";background-color:", ";box-shadow:", ";" ], f.variables.contentColorActive, (0,
|
|
99
|
+
f.pick)({
|
|
100
|
+
dark: f.variables.interactiveColorOverlaySelected,
|
|
101
|
+
light: f.variables.white
|
|
102
|
+
}), f.variables.embossShadow);
|
|
103
|
+
}), (function(e) {
|
|
104
|
+
var r = e.$selected, t = e.disabled;
|
|
105
|
+
return r && t && (0, v.css)([ "background-color:", ";" ], f.variables.backgroundColorPage);
|
|
106
|
+
}), f.variables.contentColorActive, f.variables.focusShadow, f.variables.interactiveColorOverlayActive, (function(e) {
|
|
107
|
+
var r = e.$selected, t = e.disabled;
|
|
108
|
+
return !r && !t && (0, v.css)([ "&:hover{color:", ";background-color:", ";}&:active{background-color:", ";}" ], f.variables.contentColorActive, f.variables.interactiveColorOverlayHover, f.variables.interactiveColorOverlayActive);
|
|
109
|
+
}), (function(e) {
|
|
110
|
+
var r = e.disabled;
|
|
111
|
+
return r && (0, v.css)([ "color:", ";" ], f.variables.contentColorDisabled);
|
|
112
|
+
}));
|
|
113
|
+
var m = b().div.withConfig({
|
|
114
|
+
displayName: "OptionStyles__StyledIcon",
|
|
115
|
+
componentId: "fyq77p-1"
|
|
116
|
+
})([ "flex:0 0 auto;margin-top:-2px;font-size:15px;" ]);
|
|
117
|
+
var O = b().div.withConfig({
|
|
118
|
+
displayName: "OptionStyles__StyledLabel",
|
|
119
|
+
componentId: "fyq77p-2"
|
|
120
|
+
})([ "", " flex:0 1 auto;", "" ], f.mixins.ellipsis, (0, f.pick)({
|
|
121
|
+
enterprise: (0, v.css)([ "&:not(:first-child){margin-left:", ";}" ], f.variables.spacingXSmall)
|
|
122
|
+
}));
|
|
123
|
+
var x = b().div.withConfig({
|
|
124
|
+
displayName: "OptionStyles__StyledAdornment",
|
|
125
|
+
componentId: "fyq77p-3"
|
|
126
|
+
})([ "flex:0 0 auto;", "" ], (0, f.pick)({
|
|
127
|
+
enterprise: (0, v.css)([ "&:not(:first-child){margin-left:", ";}" ], f.variables.spacingXSmall)
|
|
128
|
+
}));
|
|
129
|
+
// CONCATENATED MODULE: ./src/RadioBar/RadioBarContext.tsx
|
|
130
|
+
var k = (0, t.createContext)({});
|
|
131
|
+
k.displayName = "RadioBar";
|
|
132
|
+
/* harmony default export */ const w = k;
|
|
133
|
+
// CONCATENATED MODULE: ./src/RadioBar/Option.tsx
|
|
134
|
+
function C() {
|
|
135
|
+
C = Object.assign || function(e) {
|
|
136
|
+
for (var r = 1; r < arguments.length; r++) {
|
|
137
|
+
var t = arguments[r];
|
|
138
|
+
for (var n in t) {
|
|
139
|
+
if (Object.prototype.hasOwnProperty.call(t, n)) {
|
|
140
|
+
e[n] = t[n];
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
return e;
|
|
145
|
+
};
|
|
146
|
+
return C.apply(this, arguments);
|
|
182
147
|
}
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
label: label
|
|
198
|
-
});
|
|
199
|
-
},
|
|
200
|
-
role: "radio",
|
|
201
|
-
"aria-checked": selected,
|
|
202
|
-
$selected: selected,
|
|
203
|
-
tabIndex: focusedTabIndex,
|
|
204
|
-
disabled: disabled,
|
|
205
|
-
onKeyDown: function onKeyDown(e) {
|
|
206
|
-
return onKeyDownContext === null || onKeyDownContext === void 0 ? void 0 : onKeyDownContext(e, {
|
|
207
|
-
value: value,
|
|
208
|
-
label: label
|
|
209
|
-
});
|
|
210
|
-
}
|
|
211
|
-
}), icon && /*#__PURE__*/external_react_default().createElement(StyledIcon, null, icon), startAdornment && /*#__PURE__*/external_react_default().createElement(StyledAdornment, null, startAdornment), label && /*#__PURE__*/external_react_default().createElement(StyledLabel, null, label), endAdornment && /*#__PURE__*/external_react_default().createElement(StyledAdornment, null, endAdornment));
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
return /*#__PURE__*/external_react_default().createElement((Button_default()), _extends({
|
|
215
|
-
"data-test": "option",
|
|
216
|
-
"data-test-value": value,
|
|
217
|
-
appearance: appearanceContext,
|
|
218
|
-
disabled: disabled,
|
|
219
|
-
icon: icon,
|
|
220
|
-
selected: selected,
|
|
221
|
-
value: value,
|
|
222
|
-
error: errorContext
|
|
223
|
-
}, otherProps, {
|
|
224
|
-
onClick: selected ? undefined : function (e) {
|
|
225
|
-
return onClickContext === null || onClickContext === void 0 ? void 0 : onClickContext(e, {
|
|
226
|
-
value: value,
|
|
227
|
-
label: label
|
|
228
|
-
});
|
|
229
|
-
},
|
|
230
|
-
role: "radio",
|
|
231
|
-
"aria-checked": selected,
|
|
232
|
-
tabIndex: focusedTabIndex,
|
|
233
|
-
onKeyDown: function onKeyDown(e) {
|
|
234
|
-
return onKeyDownContext === null || onKeyDownContext === void 0 ? void 0 : onKeyDownContext(e, {
|
|
235
|
-
value: value,
|
|
236
|
-
label: label
|
|
237
|
-
});
|
|
148
|
+
function S(e, r) {
|
|
149
|
+
if (e == null) return {};
|
|
150
|
+
var t = j(e, r);
|
|
151
|
+
var n, a;
|
|
152
|
+
if (Object.getOwnPropertySymbols) {
|
|
153
|
+
var l = Object.getOwnPropertySymbols(e);
|
|
154
|
+
for (a = 0; a < l.length; a++) {
|
|
155
|
+
n = l[a];
|
|
156
|
+
if (r.indexOf(n) >= 0) continue;
|
|
157
|
+
if (!Object.prototype.propertyIsEnumerable.call(e, n)) continue;
|
|
158
|
+
t[n] = e[n];
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
return t;
|
|
238
162
|
}
|
|
239
|
-
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
var StyledRadioBar = external_styled_components_default()((Box_default())).withConfig({
|
|
252
|
-
displayName: "RadioBarStyles__StyledRadioBar",
|
|
253
|
-
componentId: "gg1b79-0"
|
|
254
|
-
})(["height:", ";", " [data-inline] + &{margin-left:", ";}"], themes_namespaceObject.variables.inputHeight, (0,themes_namespaceObject.pick)({
|
|
255
|
-
prisma: (0,external_styled_components_namespaceObject.css)(["padding:2px;border-radius:", ";border:1px solid ", ";background:", ";"], themes_namespaceObject.variables.borderRadius, function (_ref) {
|
|
256
|
-
var $error = _ref.$error;
|
|
257
|
-
return $error ? themes_namespaceObject.variables.accentColorNegative : 'transparent';
|
|
258
|
-
}, function (_ref2) {
|
|
259
|
-
var $disabled = _ref2.$disabled;
|
|
260
|
-
return $disabled ? themes_namespaceObject.variables.interactiveColorBackgroundDisabled : themes_namespaceObject.variables.interactiveColorBackground;
|
|
261
|
-
})
|
|
262
|
-
}), (0,themes_namespaceObject.pick)({
|
|
263
|
-
enterprise: themes_namespaceObject.variables.spacingHalf,
|
|
264
|
-
prisma: themes_namespaceObject.variables.spacingSmall
|
|
265
|
-
}));
|
|
266
|
-
|
|
267
|
-
;// CONCATENATED MODULE: ./src/RadioBar/RadioBar.tsx
|
|
268
|
-
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
269
|
-
|
|
270
|
-
function RadioBar_extends() { RadioBar_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 RadioBar_extends.apply(this, arguments); }
|
|
271
|
-
|
|
272
|
-
function RadioBar_objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = RadioBar_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; }
|
|
273
|
-
|
|
274
|
-
function RadioBar_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; }
|
|
275
|
-
|
|
276
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
|
277
|
-
|
|
278
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
279
|
-
|
|
280
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
281
|
-
|
|
282
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
283
|
-
|
|
284
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
285
|
-
|
|
286
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
287
|
-
|
|
288
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
289
|
-
|
|
290
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
291
|
-
|
|
292
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
293
|
-
|
|
294
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
295
|
-
|
|
296
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
|
|
297
|
-
|
|
298
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
299
|
-
|
|
300
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
/** @public */
|
|
312
|
-
|
|
313
|
-
var RadioBar_propTypes = {
|
|
314
|
-
appearance: external_prop_types_default().oneOf(['default', 'pill']),
|
|
315
|
-
children: (external_prop_types_default()).node,
|
|
316
|
-
defaultValue: (external_prop_types_default()).any,
|
|
317
|
-
describedBy: (external_prop_types_default()).string,
|
|
318
|
-
elementRef: external_prop_types_default().oneOfType([(external_prop_types_default()).func, (external_prop_types_default()).object]),
|
|
319
|
-
error: (external_prop_types_default()).bool,
|
|
320
|
-
inline: (external_prop_types_default()).bool,
|
|
321
|
-
labelledBy: (external_prop_types_default()).string,
|
|
322
|
-
name: (external_prop_types_default()).string,
|
|
323
|
-
onChange: (external_prop_types_default()).func,
|
|
324
|
-
|
|
325
|
-
/** @private. */
|
|
326
|
-
required: (external_prop_types_default()).bool,
|
|
327
|
-
|
|
328
|
-
/** @private */
|
|
329
|
-
splunkTheme: (external_prop_types_default()).object,
|
|
330
|
-
value: (external_prop_types_default()).any
|
|
331
|
-
};
|
|
332
|
-
var defaultProps = {
|
|
333
|
-
appearance: 'default',
|
|
334
|
-
error: false,
|
|
335
|
-
inline: false
|
|
336
|
-
};
|
|
337
|
-
|
|
338
|
-
/**
|
|
339
|
-
* RadioBar is a form control that provides the ability to select one option out of a group.
|
|
340
|
-
*/
|
|
341
|
-
var RadioBar = /*#__PURE__*/function (_Component) {
|
|
342
|
-
_inherits(RadioBar, _Component);
|
|
343
|
-
|
|
344
|
-
var _super = _createSuper(RadioBar);
|
|
345
|
-
|
|
346
|
-
// @docs-props-type RadioBarPropsBase
|
|
347
|
-
// eslint-disable-line @typescript-eslint/no-explicit-any
|
|
348
|
-
function RadioBar(props) {
|
|
349
|
-
var _this;
|
|
350
|
-
|
|
351
|
-
_classCallCheck(this, RadioBar);
|
|
352
|
-
|
|
353
|
-
_this = _super.call(this, props);
|
|
354
|
-
|
|
355
|
-
_defineProperty(_assertThisInitialized(_this), "controlledExternally", void 0);
|
|
356
|
-
|
|
357
|
-
_defineProperty(_assertThisInitialized(_this), "filteredValues", []);
|
|
358
|
-
|
|
359
|
-
_defineProperty(_assertThisInitialized(_this), "handleClick", function (e, data) {
|
|
360
|
-
_this.handleOnChange(e, data);
|
|
361
|
-
});
|
|
362
|
-
|
|
363
|
-
_defineProperty(_assertThisInitialized(_this), "handleOnKeyDown", function (e, _ref) {
|
|
364
|
-
var value = _ref.value,
|
|
365
|
-
label = _ref.label;
|
|
366
|
-
var eventKeyCode = (0,keyboard_namespaceObject.keycode)(e.nativeEvent);
|
|
367
|
-
var myTarget = e.currentTarget;
|
|
368
|
-
var nextTarget = null;
|
|
369
|
-
var nextIndex = 0;
|
|
370
|
-
|
|
371
|
-
var currentIndex = _this.filteredValues.indexOf(value);
|
|
372
|
-
|
|
373
|
-
if (eventKeyCode === 'down' || eventKeyCode === 'right') {
|
|
374
|
-
var _myTarget$parentEleme;
|
|
375
|
-
|
|
376
|
-
e.preventDefault();
|
|
377
|
-
nextIndex = currentIndex + 1;
|
|
378
|
-
|
|
379
|
-
if (nextIndex > _this.filteredValues.length - 1) {
|
|
380
|
-
nextIndex = 0;
|
|
163
|
+
function j(e, r) {
|
|
164
|
+
if (e == null) return {};
|
|
165
|
+
var t = {};
|
|
166
|
+
var n = Object.keys(e);
|
|
167
|
+
var a, l;
|
|
168
|
+
for (l = 0; l < n.length; l++) {
|
|
169
|
+
a = n[l];
|
|
170
|
+
if (r.indexOf(a) >= 0) continue;
|
|
171
|
+
t[a] = e[a];
|
|
381
172
|
}
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
173
|
+
return t;
|
|
174
|
+
}
|
|
175
|
+
var P = {
|
|
176
|
+
disabled: l().bool,
|
|
177
|
+
startAdornment: l().node,
|
|
178
|
+
endAdornment: l().node,
|
|
179
|
+
icon: l().node,
|
|
180
|
+
label: l().string,
|
|
181
|
+
/** @private Set by `RadioBar`. */
|
|
182
|
+
selected: l().bool,
|
|
183
|
+
/** The value of the `Option`. */
|
|
184
|
+
value: l().any.isRequired
|
|
185
|
+
};
|
|
186
|
+
function E(e) {
|
|
187
|
+
var r = e.disabled, a = e.icon, l = e.label, o = e.selected, i = e.startAdornment, u = e.endAdornment, c = e.value, s = S(e, [ "disabled", "icon", "label", "selected", "startAdornment", "endAdornment", "value" ]);
|
|
188
|
+
// @docs-props-type OptionPropsBase
|
|
189
|
+
var f = (0, t.useContext)(w), d = f.onClick, v = f.appearance, b = f.error, y = f.onKeyDown, h = f.firstValue, k = f.selectedValue;
|
|
190
|
+
if (false) {}
|
|
191
|
+
var j = -1;
|
|
192
|
+
if (k) {
|
|
193
|
+
if (c === k) {
|
|
194
|
+
j = 0;
|
|
195
|
+
}
|
|
196
|
+
} else if (c === h) {
|
|
197
|
+
j = 0;
|
|
392
198
|
}
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
if (!_this.isControlled()) {
|
|
419
|
-
_this.setState({
|
|
420
|
-
value: data.value
|
|
421
|
-
});
|
|
199
|
+
var P = j;
|
|
200
|
+
if (v === "prisma") {
|
|
201
|
+
|
|
202
|
+
return n().createElement(g, C({
|
|
203
|
+
"data-test": "option",
|
|
204
|
+
"data-test-value": c
|
|
205
|
+
}, s, {
|
|
206
|
+
onClick: o ? undefined : function(e) {
|
|
207
|
+
return d === null || d === void 0 ? void 0 : d(e, {
|
|
208
|
+
value: c,
|
|
209
|
+
label: l
|
|
210
|
+
});
|
|
211
|
+
},
|
|
212
|
+
role: "radio",
|
|
213
|
+
"aria-checked": o,
|
|
214
|
+
$selected: o,
|
|
215
|
+
tabIndex: P,
|
|
216
|
+
disabled: r,
|
|
217
|
+
onKeyDown: function e(r) {
|
|
218
|
+
return y === null || y === void 0 ? void 0 : y(r, {
|
|
219
|
+
value: c,
|
|
220
|
+
label: l
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
}), a && n().createElement(m, null, a), i && n().createElement(x, null, i), l && n().createElement(O, null, l), u && n().createElement(x, null, u));
|
|
422
224
|
}
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
225
|
+
|
|
226
|
+
return n().createElement(p(), C({
|
|
227
|
+
"data-test": "option",
|
|
228
|
+
"data-test-value": c,
|
|
229
|
+
appearance: v,
|
|
230
|
+
disabled: r,
|
|
231
|
+
icon: a,
|
|
232
|
+
selected: o,
|
|
233
|
+
value: c,
|
|
234
|
+
error: b
|
|
235
|
+
}, s, {
|
|
236
|
+
onClick: o ? undefined : function(e) {
|
|
237
|
+
return d === null || d === void 0 ? void 0 : d(e, {
|
|
238
|
+
value: c,
|
|
239
|
+
label: l
|
|
240
|
+
});
|
|
241
|
+
},
|
|
242
|
+
role: "radio",
|
|
243
|
+
"aria-checked": o,
|
|
244
|
+
tabIndex: P,
|
|
245
|
+
onKeyDown: function e(r) {
|
|
246
|
+
return y === null || y === void 0 ? void 0 : y(r, {
|
|
247
|
+
value: c,
|
|
248
|
+
label: l
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
}), i && n().createElement(x, null, i), l && n().createElement(O, null, l), u && n().createElement(x, null, u));
|
|
432
252
|
}
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
253
|
+
E.propTypes = P;
|
|
254
|
+
/* harmony default export */ const _ = E;
|
|
255
|
+
// CONCATENATED MODULE: external "@splunk/react-ui/Box"
|
|
256
|
+
const T = require("@splunk/react-ui/Box");
|
|
257
|
+
var q = e.n(T);
|
|
258
|
+
// CONCATENATED MODULE: ./src/RadioBar/RadioBarStyles.ts
|
|
259
|
+
var D = b()(q()).withConfig({
|
|
260
|
+
displayName: "RadioBarStyles__StyledRadioBar",
|
|
261
|
+
componentId: "gg1b79-0"
|
|
262
|
+
})([ "height:", ";", " [data-inline] + &{margin-left:", ";}" ], f.variables.inputHeight, (0,
|
|
263
|
+
f.pick)({
|
|
264
|
+
prisma: (0, v.css)([ "padding:2px;border-radius:", ";border:1px solid ", ";background:", ";" ], f.variables.borderRadius, (function(e) {
|
|
265
|
+
var r = e.$error;
|
|
266
|
+
return r ? f.variables.accentColorNegative : "transparent";
|
|
267
|
+
}), (function(e) {
|
|
268
|
+
var r = e.$disabled;
|
|
269
|
+
return r ? f.variables.interactiveColorBackgroundDisabled : f.variables.interactiveColorBackground;
|
|
270
|
+
}))
|
|
271
|
+
}), (0, f.pick)({
|
|
272
|
+
enterprise: f.variables.spacingHalf,
|
|
273
|
+
prisma: f.variables.spacingSmall
|
|
274
|
+
}));
|
|
275
|
+
// CONCATENATED MODULE: ./src/RadioBar/RadioBar.tsx
|
|
276
|
+
function R(e) {
|
|
277
|
+
"@babel/helpers - typeof";
|
|
278
|
+
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
|
|
279
|
+
R = function e(r) {
|
|
280
|
+
return typeof r;
|
|
281
|
+
};
|
|
282
|
+
} else {
|
|
283
|
+
R = function e(r) {
|
|
284
|
+
return r && typeof Symbol === "function" && r.constructor === Symbol && r !== Symbol.prototype ? "symbol" : typeof r;
|
|
285
|
+
};
|
|
286
|
+
}
|
|
287
|
+
return R(e);
|
|
288
|
+
}
|
|
289
|
+
function V() {
|
|
290
|
+
V = Object.assign || function(e) {
|
|
291
|
+
for (var r = 1; r < arguments.length; r++) {
|
|
292
|
+
var t = arguments[r];
|
|
293
|
+
for (var n in t) {
|
|
294
|
+
if (Object.prototype.hasOwnProperty.call(t, n)) {
|
|
295
|
+
e[n] = t[n];
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
return e;
|
|
300
|
+
};
|
|
301
|
+
return V.apply(this, arguments);
|
|
445
302
|
}
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
303
|
+
function A(e, r) {
|
|
304
|
+
if (e == null) return {};
|
|
305
|
+
var t = B(e, r);
|
|
306
|
+
var n, a;
|
|
307
|
+
if (Object.getOwnPropertySymbols) {
|
|
308
|
+
var l = Object.getOwnPropertySymbols(e);
|
|
309
|
+
for (a = 0; a < l.length; a++) {
|
|
310
|
+
n = l[a];
|
|
311
|
+
if (r.indexOf(n) >= 0) continue;
|
|
312
|
+
if (!Object.prototype.propertyIsEnumerable.call(e, n)) continue;
|
|
313
|
+
t[n] = e[n];
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
return t;
|
|
317
|
+
}
|
|
318
|
+
function B(e, r) {
|
|
319
|
+
if (e == null) return {};
|
|
320
|
+
var t = {};
|
|
321
|
+
var n = Object.keys(e);
|
|
322
|
+
var a, l;
|
|
323
|
+
for (l = 0; l < n.length; l++) {
|
|
324
|
+
a = n[l];
|
|
325
|
+
if (r.indexOf(a) >= 0) continue;
|
|
326
|
+
t[a] = e[a];
|
|
327
|
+
}
|
|
328
|
+
return t;
|
|
329
|
+
}
|
|
330
|
+
function I(e, r) {
|
|
331
|
+
var t = Object.keys(e);
|
|
332
|
+
if (Object.getOwnPropertySymbols) {
|
|
333
|
+
var n = Object.getOwnPropertySymbols(e);
|
|
334
|
+
if (r) n = n.filter((function(r) {
|
|
335
|
+
return Object.getOwnPropertyDescriptor(e, r).enumerable;
|
|
336
|
+
}));
|
|
337
|
+
t.push.apply(t, n);
|
|
338
|
+
}
|
|
339
|
+
return t;
|
|
340
|
+
}
|
|
341
|
+
function N(e) {
|
|
342
|
+
for (var r = 1; r < arguments.length; r++) {
|
|
343
|
+
var t = arguments[r] != null ? arguments[r] : {};
|
|
344
|
+
if (r % 2) {
|
|
345
|
+
I(Object(t), true).forEach((function(r) {
|
|
346
|
+
J(e, r, t[r]);
|
|
347
|
+
}));
|
|
348
|
+
} else if (Object.getOwnPropertyDescriptors) {
|
|
349
|
+
Object.defineProperties(e, Object.getOwnPropertyDescriptors(t));
|
|
350
|
+
} else {
|
|
351
|
+
I(Object(t)).forEach((function(r) {
|
|
352
|
+
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
|
|
353
|
+
}));
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
return e;
|
|
450
357
|
}
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
var _this2 = this;
|
|
455
|
-
|
|
456
|
-
var _this$props2 = this.props,
|
|
457
|
-
appearance = _this$props2.appearance,
|
|
458
|
-
children = _this$props2.children,
|
|
459
|
-
describedBy = _this$props2.describedBy,
|
|
460
|
-
error = _this$props2.error,
|
|
461
|
-
labelledBy = _this$props2.labelledBy,
|
|
462
|
-
splunkTheme = _this$props2.splunkTheme,
|
|
463
|
-
value = _this$props2.value,
|
|
464
|
-
required = _this$props2.required,
|
|
465
|
-
otherProps = RadioBar_objectWithoutProperties(_this$props2, ["appearance", "children", "describedBy", "error", "labelledBy", "splunkTheme", "value", "required"]);
|
|
466
|
-
|
|
467
|
-
if (false) {}
|
|
468
|
-
|
|
469
|
-
var selectedValue = this.isControlled() ? value : this.state.value;
|
|
470
|
-
var isPrisma = splunkTheme.isPrisma;
|
|
471
|
-
var disabled = true;
|
|
472
|
-
this.filteredValues = [];
|
|
473
|
-
var childrenFormatted = external_react_namespaceObject.Children.toArray(children).filter(external_react_namespaceObject.isValidElement).map(function (item, i, _ref2) {
|
|
474
|
-
var length = _ref2.length;
|
|
475
|
-
|
|
476
|
-
_this2.filteredValues.push(item.props.value);
|
|
477
|
-
|
|
478
|
-
if (item.props && !item.props.disabled) {
|
|
479
|
-
disabled = false;
|
|
358
|
+
function $(e, r) {
|
|
359
|
+
if (!(e instanceof r)) {
|
|
360
|
+
throw new TypeError("Cannot call a class as a function");
|
|
480
361
|
}
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
362
|
+
}
|
|
363
|
+
function K(e, r) {
|
|
364
|
+
for (var t = 0; t < r.length; t++) {
|
|
365
|
+
var n = r[t];
|
|
366
|
+
n.enumerable = n.enumerable || false;
|
|
367
|
+
n.configurable = true;
|
|
368
|
+
if ("value" in n) n.writable = true;
|
|
369
|
+
Object.defineProperty(e, n.key, n);
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
function H(e, r, t) {
|
|
373
|
+
if (r) K(e.prototype, r);
|
|
374
|
+
if (t) K(e, t);
|
|
375
|
+
return e;
|
|
376
|
+
}
|
|
377
|
+
function M(e, r) {
|
|
378
|
+
if (typeof r !== "function" && r !== null) {
|
|
379
|
+
throw new TypeError("Super expression must either be null or a function");
|
|
380
|
+
}
|
|
381
|
+
e.prototype = Object.create(r && r.prototype, {
|
|
382
|
+
constructor: {
|
|
383
|
+
value: e,
|
|
384
|
+
writable: true,
|
|
385
|
+
configurable: true
|
|
386
|
+
}
|
|
487
387
|
});
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
"
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
388
|
+
if (r) X(e, r);
|
|
389
|
+
}
|
|
390
|
+
function X(e, r) {
|
|
391
|
+
X = Object.setPrototypeOf || function e(r, t) {
|
|
392
|
+
r.__proto__ = t;
|
|
393
|
+
return r;
|
|
394
|
+
};
|
|
395
|
+
return X(e, r);
|
|
396
|
+
}
|
|
397
|
+
function z(e) {
|
|
398
|
+
var r = F();
|
|
399
|
+
return function t() {
|
|
400
|
+
var n = G(e), a;
|
|
401
|
+
if (r) {
|
|
402
|
+
var l = G(this).constructor;
|
|
403
|
+
a = Reflect.construct(n, arguments, l);
|
|
404
|
+
} else {
|
|
405
|
+
a = n.apply(this, arguments);
|
|
406
|
+
}
|
|
407
|
+
return L(this, a);
|
|
408
|
+
};
|
|
409
|
+
}
|
|
410
|
+
function L(e, r) {
|
|
411
|
+
if (r && (R(r) === "object" || typeof r === "function")) {
|
|
412
|
+
return r;
|
|
413
|
+
}
|
|
414
|
+
return U(e);
|
|
515
415
|
}
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
}
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
416
|
+
function U(e) {
|
|
417
|
+
if (e === void 0) {
|
|
418
|
+
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
419
|
+
}
|
|
420
|
+
return e;
|
|
421
|
+
}
|
|
422
|
+
function F() {
|
|
423
|
+
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
424
|
+
if (Reflect.construct.sham) return false;
|
|
425
|
+
if (typeof Proxy === "function") return true;
|
|
426
|
+
try {
|
|
427
|
+
Date.prototype.toString.call(Reflect.construct(Date, [], (function() {})));
|
|
428
|
+
return true;
|
|
429
|
+
} catch (e) {
|
|
430
|
+
return false;
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
function G(e) {
|
|
434
|
+
G = Object.setPrototypeOf ? Object.getPrototypeOf : function e(r) {
|
|
435
|
+
return r.__proto__ || Object.getPrototypeOf(r);
|
|
436
|
+
};
|
|
437
|
+
return G(e);
|
|
438
|
+
}
|
|
439
|
+
function J(e, r, t) {
|
|
440
|
+
if (r in e) {
|
|
441
|
+
Object.defineProperty(e, r, {
|
|
442
|
+
value: t,
|
|
443
|
+
enumerable: true,
|
|
444
|
+
configurable: true,
|
|
445
|
+
writable: true
|
|
446
|
+
});
|
|
447
|
+
} else {
|
|
448
|
+
e[r] = t;
|
|
449
|
+
}
|
|
450
|
+
return e;
|
|
451
|
+
}
|
|
452
|
+
/** @public */ var Q = {
|
|
453
|
+
appearance: l().oneOf([ "default", "pill" ]),
|
|
454
|
+
children: l().node,
|
|
455
|
+
defaultValue: l().any,
|
|
456
|
+
describedBy: l().string,
|
|
457
|
+
elementRef: l().oneOfType([ l().func, l().object ]),
|
|
458
|
+
error: l().bool,
|
|
459
|
+
inline: l().bool,
|
|
460
|
+
labelledBy: l().string,
|
|
461
|
+
name: l().string,
|
|
462
|
+
onChange: l().func,
|
|
463
|
+
/** @private. */
|
|
464
|
+
required: l().bool,
|
|
465
|
+
/** @private */
|
|
466
|
+
splunkTheme: l().object,
|
|
467
|
+
value: l().any
|
|
468
|
+
};
|
|
469
|
+
var W = {
|
|
470
|
+
appearance: "default",
|
|
471
|
+
error: false,
|
|
472
|
+
inline: false
|
|
473
|
+
};
|
|
474
|
+
/**
|
|
475
|
+
* RadioBar is a form control that provides the ability to select one option out of a group.
|
|
476
|
+
*/ var Y = function(e) {
|
|
477
|
+
M(a, e);
|
|
478
|
+
var r = z(a);
|
|
479
|
+
// @docs-props-type RadioBarPropsBase
|
|
480
|
+
// eslint-disable-line @typescript-eslint/no-explicit-any
|
|
481
|
+
function a(e) {
|
|
482
|
+
var t;
|
|
483
|
+
$(this, a);
|
|
484
|
+
t = r.call(this, e);
|
|
485
|
+
J(U(t), "controlledExternally", void 0);
|
|
486
|
+
J(U(t), "filteredValues", []);
|
|
487
|
+
J(U(t), "handleClick", (function(e, r) {
|
|
488
|
+
t.handleOnChange(e, r);
|
|
489
|
+
}));
|
|
490
|
+
J(U(t), "handleOnKeyDown", (function(e, r) {
|
|
491
|
+
var n = r.value, a = r.label;
|
|
492
|
+
var l = (0, s.keycode)(e.nativeEvent);
|
|
493
|
+
var o = e.currentTarget;
|
|
494
|
+
var i = null;
|
|
495
|
+
var u = 0;
|
|
496
|
+
var c = t.filteredValues.indexOf(n);
|
|
497
|
+
if (l === "down" || l === "right") {
|
|
498
|
+
e.preventDefault();
|
|
499
|
+
var f = t.getNextTarget("forward", o, c), d = f.nextTargetRes, p = f.nextIndexRes;
|
|
500
|
+
i = d;
|
|
501
|
+
u = p;
|
|
502
|
+
} else if (l === "up" || l === "left") {
|
|
503
|
+
e.preventDefault();
|
|
504
|
+
var v = t.getNextTarget("backward", o, c), b = v.nextTargetRes, y = v.nextIndexRes;
|
|
505
|
+
i = b;
|
|
506
|
+
u = y;
|
|
507
|
+
}
|
|
508
|
+
if (i) {
|
|
509
|
+
var h;
|
|
510
|
+
(h = i) === null || h === void 0 ? void 0 : h.focus();
|
|
511
|
+
var g = t.filteredValues[u];
|
|
512
|
+
t.handleOnChange(e, {
|
|
513
|
+
value: g,
|
|
514
|
+
label: a
|
|
515
|
+
});
|
|
516
|
+
}
|
|
517
|
+
}));
|
|
518
|
+
J(U(t), "handleOnChange", (function(e, r) {
|
|
519
|
+
if (t.props.value !== r.value) {
|
|
520
|
+
var n, a;
|
|
521
|
+
(n = (a = t.props).onChange) === null || n === void 0 ? void 0 : n.call(a, e, N({
|
|
522
|
+
name: t.props.name
|
|
523
|
+
}, r));
|
|
524
|
+
if (!t.isControlled()) {
|
|
525
|
+
t.setState({
|
|
526
|
+
value: r.value
|
|
527
|
+
});
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
}));
|
|
531
|
+
t.controlledExternally = i()(e, "value");
|
|
532
|
+
if (!t.isControlled()) {
|
|
533
|
+
t.state = {
|
|
534
|
+
value: e.defaultValue
|
|
535
|
+
};
|
|
536
|
+
}
|
|
537
|
+
if (false) {}
|
|
538
|
+
return t;
|
|
539
|
+
}
|
|
540
|
+
H(a, [ {
|
|
541
|
+
key: "componentDidUpdate",
|
|
542
|
+
value: function e(r) {
|
|
543
|
+
if (false) {}
|
|
544
|
+
if (false) {}
|
|
545
|
+
}
|
|
546
|
+
}, {
|
|
547
|
+
key: "isControlled",
|
|
548
|
+
value: function e() {
|
|
549
|
+
return this.controlledExternally;
|
|
550
|
+
}
|
|
551
|
+
// TODO: Once converted to a functional component, this function can be removed and RadioBar should use useRovingFocus hook
|
|
552
|
+
}, {
|
|
553
|
+
key: "getNextTarget",
|
|
554
|
+
value: function e(r, t, n) {
|
|
555
|
+
var a = r === "forward" ? 1 : -1;
|
|
556
|
+
var l = r === "forward" ? "nextSibling" : "previousSibling";
|
|
557
|
+
var o = r === "forward" ? "firstElementChild" : "lastElementChild";
|
|
558
|
+
var i = r === "forward" ? 0 : this.filteredValues.length - 1;
|
|
559
|
+
var u = t[l];
|
|
560
|
+
var c = null;
|
|
561
|
+
var s = n + a;
|
|
562
|
+
while (u !== t && c === null) {
|
|
563
|
+
if (u === null) {
|
|
564
|
+
var f;
|
|
565
|
+
u = (f = t.parentElement) === null || f === void 0 ? void 0 : f[o];
|
|
566
|
+
s = i;
|
|
567
|
+
}
|
|
568
|
+
if (u.disabled) {
|
|
569
|
+
var d = u[l];
|
|
570
|
+
u = d;
|
|
571
|
+
s += a;
|
|
572
|
+
} else {
|
|
573
|
+
c = u;
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
return {
|
|
577
|
+
nextTargetRes: c,
|
|
578
|
+
nextIndexRes: s
|
|
579
|
+
};
|
|
580
|
+
}
|
|
581
|
+
}, {
|
|
582
|
+
key: "render",
|
|
583
|
+
value: function e() {
|
|
584
|
+
var r = this;
|
|
585
|
+
var a = this.props, l = a.appearance, o = a.children, i = a.describedBy, u = a.error, s = a.labelledBy, f = a.splunkTheme, d = a.value, p = a.required, v = A(a, [ "appearance", "children", "describedBy", "error", "labelledBy", "splunkTheme", "value", "required" ]);
|
|
586
|
+
if (false) {}
|
|
587
|
+
var b = this.isControlled() ? d : this.state.value;
|
|
588
|
+
var y = f.isPrisma;
|
|
589
|
+
var h = true;
|
|
590
|
+
this.filteredValues = [];
|
|
591
|
+
var g = t.Children.toArray(o).filter(t.isValidElement).map((function(e, n, a) {
|
|
592
|
+
var l = a.length;
|
|
593
|
+
r.filteredValues.push(e.props.value);
|
|
594
|
+
if (e.props && !e.props.disabled) {
|
|
595
|
+
h = false;
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
return (0, t.cloneElement)(e, {
|
|
599
|
+
selected: e.props.value === b,
|
|
600
|
+
key: e.key || n,
|
|
601
|
+
append: n < l - 1,
|
|
602
|
+
prepend: n > 0
|
|
603
|
+
});
|
|
604
|
+
}));
|
|
605
|
+
var m = this.filteredValues[0];
|
|
606
|
+
var O = d == null || this.filteredValues.includes(b);
|
|
607
|
+
if (false) {}
|
|
608
|
+
var x = {
|
|
609
|
+
appearance: y ? "prisma" : l,
|
|
610
|
+
onClick: this.handleClick,
|
|
611
|
+
error: y ? false : u,
|
|
612
|
+
onKeyDown: this.handleOnKeyDown,
|
|
613
|
+
firstValue: m,
|
|
614
|
+
selectedValue: O ? b : undefined
|
|
615
|
+
};
|
|
616
|
+
|
|
617
|
+
return n().createElement(D, V({
|
|
618
|
+
flex: true,
|
|
619
|
+
$disabled: h,
|
|
620
|
+
$error: u,
|
|
621
|
+
"data-test": "radio-bar",
|
|
622
|
+
"data-test-value": b,
|
|
623
|
+
role: "radiogroup",
|
|
624
|
+
"aria-labelledby": s,
|
|
625
|
+
"aria-describedby": i,
|
|
626
|
+
"aria-required": p
|
|
627
|
+
}, c()(v, "onChange")), n().createElement(w.Provider, {
|
|
628
|
+
value: x
|
|
629
|
+
}, g));
|
|
630
|
+
}
|
|
631
|
+
} ]);
|
|
632
|
+
return a;
|
|
633
|
+
}(t.Component);
|
|
634
|
+
J(Y, "propTypes", Q);
|
|
635
|
+
J(Y, "defaultProps", W);
|
|
636
|
+
J(Y, "Option", _);
|
|
637
|
+
var Z = (0, f.withSplunkTheme)(Y);
|
|
638
|
+
var ee = Z;
|
|
639
|
+
ee.propTypes = Y.propTypes;
|
|
640
|
+
ee.Option = _;
|
|
641
|
+
/* harmony default export */ const re = ee;
|
|
642
|
+
// only for styled components using RadioBar
|
|
643
|
+
// CONCATENATED MODULE: ./src/RadioBar/index.ts
|
|
644
|
+
module.exports = r;
|
|
645
|
+
/******/})();
|