@splunk/react-ui 4.20.0 → 4.21.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Accordion.js +425 -441
- package/Anchor.js +147 -193
- package/Animation.js +142 -166
- package/AnimationToggle.js +197 -253
- package/Box.js +145 -194
- package/Breadcrumbs.js +288 -298
- package/Button.js +488 -613
- package/ButtonGroup.js +160 -212
- package/ButtonSimple.js +543 -562
- package/CHANGELOG.md +26 -0
- package/Calendar.js +1107 -1195
- package/Card.js +771 -746
- package/CardLayout.js +205 -223
- package/Chip.js +509 -612
- package/Clickable.js +416 -472
- package/CloseButton.js +165 -250
- package/Code.js +1808 -2172
- package/Code.js.LICENSE.txt +8 -0
- package/CollapsiblePanel.js +586 -675
- package/Color.js +1066 -1297
- package/ColumnLayout.js +402 -465
- package/ComboBox.js +892 -969
- package/Concertina.js +998 -963
- package/ControlGroup.js +687 -718
- package/Date.js +567 -697
- package/DefinitionList.js +308 -310
- package/Divider.js +149 -194
- package/Dropdown.js +459 -558
- package/DualListbox.js +1480 -1735
- package/EventListener.js +94 -165
- package/File.js +1051 -1173
- package/FormRows.js +885 -880
- package/Heading.js +216 -263
- package/Image.js +446 -558
- package/JSONTree.js +690 -699
- package/Layer.js +442 -582
- package/Link.js +336 -361
- package/List.js +213 -237
- package/Markdown.js +510 -612
- package/Menu.js +1109 -1331
- package/Message.js +474 -629
- package/MessageBar.js +387 -561
- package/Modal.js +810 -798
- package/ModalLayer.js +326 -343
- package/Monogram.js +308 -368
- package/Multiselect.js +3558 -3998
- package/Number.js +729 -843
- package/Paginator.js +510 -615
- package/Paragraph.js +145 -188
- package/Popover.js +1470 -1693
- package/Progress.js +301 -362
- package/RadioBar.js +610 -651
- package/RadioList.js +483 -544
- package/Resize.js +530 -623
- package/ResultsMenu.js +494 -597
- package/ScreenReaderContent.js +142 -187
- package/Scroll.js +595 -598
- package/ScrollContainerContext.js +197 -278
- package/Search.js +745 -817
- package/Select.js +2441 -2746
- package/SidePanel.js +390 -392
- package/Slider.js +668 -825
- package/SlidingPanels.js +639 -645
- package/SplitButton.js +464 -499
- package/StaticContent.js +161 -217
- package/StepBar.js +386 -466
- package/Switch.js +710 -764
- package/TabBar.js +724 -815
- package/TabLayout.js +406 -438
- package/Table.js +4842 -5121
- package/Text.js +1169 -1351
- package/TextArea.js +1097 -1307
- package/Tooltip.js +624 -721
- package/TransitionOpen.js +489 -546
- package/Typography.js +176 -229
- package/WaitSpinner.js +230 -298
- package/package.json +14 -15
- package/stubs-splunkui.d.ts +4 -1
- package/types/src/ComboBox/Option.d.ts +1 -1
- package/types/src/Concertina/Concertina.d.ts +4 -0
- package/types/src/JSONTree/JSONTreeContext.d.ts +7 -0
- package/types/src/JSONTree/TreeNode.d.ts +5 -0
- package/types/src/Link/Link.d.ts +7 -3
- package/types/src/Link/docs/examples/NewWindow.d.ts +2 -0
- package/types/src/Markdown/Markdown.d.ts +1 -1
- package/types/src/Markdown/renderers/MarkdownHeading.d.ts +1 -1
- package/types/src/Menu/Item.d.ts +1 -1
- package/types/src/Menu/Menu.d.ts +1 -0
- package/types/src/MessageBar/docs/examples/WithActions.d.ts +2 -0
- package/types/src/Multiselect/Option.d.ts +1 -1
- package/types/src/Search/Option.d.ts +1 -1
- package/types/src/Select/Option.d.ts +1 -1
- package/types/src/Select/OptionBase.d.ts +1 -1
- package/types/src/fixtures/FetchOptions.d.ts +2 -8
- package/useForceUpdate.js +112 -146
- package/useKeyPress.js +74 -128
- package/usePrevious.js +65 -129
- package/useRovingFocus.js +122 -218
- package/types/src/Link/docs/examples/NewTab.d.ts +0 -2
- /package/types/src/Table/docs/examples/{DockedHeader.d.ts → DockedHeaderScrollbar.d.ts} +0 -0
- /package/types/src/Table/docs/examples/prisma/{DockedHeader.d.ts → DockedHeaderScrollbar.d.ts} +0 -0
package/Switch.js
CHANGED
|
@@ -1,769 +1,715 @@
|
|
|
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
|
-
/******/ 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 = 209);
|
|
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
|
-
/***/ 2:
|
|
119
|
-
/***/ (function(module, exports) {
|
|
120
|
-
|
|
121
|
-
module.exports = require("react");
|
|
122
|
-
|
|
123
|
-
/***/ }),
|
|
124
|
-
|
|
125
|
-
/***/ 209:
|
|
126
|
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
127
|
-
|
|
128
|
-
"use strict";
|
|
129
|
-
// ESM COMPAT FLAG
|
|
130
|
-
__webpack_require__.r(__webpack_exports__);
|
|
131
|
-
|
|
132
|
-
// EXPORTS
|
|
133
|
-
__webpack_require__.d(__webpack_exports__, "default", function() { return /* reexport */ src_Switch_Switch; });
|
|
134
|
-
|
|
135
|
-
// EXTERNAL MODULE: external "react"
|
|
136
|
-
var external_react_ = __webpack_require__(2);
|
|
137
|
-
var external_react_default = /*#__PURE__*/__webpack_require__.n(external_react_);
|
|
138
|
-
|
|
139
|
-
// EXTERNAL MODULE: external "prop-types"
|
|
140
|
-
var external_prop_types_ = __webpack_require__(1);
|
|
141
|
-
var external_prop_types_default = /*#__PURE__*/__webpack_require__.n(external_prop_types_);
|
|
142
|
-
|
|
143
|
-
// EXTERNAL MODULE: external "@splunk/react-ui/AnimationToggle"
|
|
144
|
-
var AnimationToggle_ = __webpack_require__(51);
|
|
145
|
-
var AnimationToggle_default = /*#__PURE__*/__webpack_require__.n(AnimationToggle_);
|
|
146
|
-
|
|
147
|
-
// EXTERNAL MODULE: external "@splunk/react-ui/ScreenReaderContent"
|
|
148
|
-
var ScreenReaderContent_ = __webpack_require__(14);
|
|
149
|
-
var ScreenReaderContent_default = /*#__PURE__*/__webpack_require__.n(ScreenReaderContent_);
|
|
150
|
-
|
|
151
|
-
// EXTERNAL MODULE: external "@splunk/ui-utils/id"
|
|
152
|
-
var id_ = __webpack_require__(8);
|
|
153
|
-
|
|
154
|
-
// EXTERNAL MODULE: external "@splunk/react-icons/enterprise/Check"
|
|
155
|
-
var Check_ = __webpack_require__(97);
|
|
156
|
-
var Check_default = /*#__PURE__*/__webpack_require__.n(Check_);
|
|
157
|
-
|
|
158
|
-
// EXTERNAL MODULE: external "@splunk/themes"
|
|
159
|
-
var themes_ = __webpack_require__(0);
|
|
160
|
-
|
|
161
|
-
// CONCATENATED MODULE: ./src/Switch/CheckIcon.tsx
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
function CheckIcon() {
|
|
166
|
-
var _useSplunkTheme = Object(themes_["useSplunkTheme"])(),
|
|
167
|
-
family = _useSplunkTheme.family;
|
|
168
|
-
|
|
169
|
-
if (family === 'enterprise') {
|
|
170
|
-
return /*#__PURE__*/external_react_default.a.createElement(Check_default.a, {
|
|
171
|
-
inline: false,
|
|
172
|
-
size: "12px",
|
|
173
|
-
screenReaderText: null,
|
|
174
|
-
hideDefaultTooltip: true,
|
|
175
|
-
style: {
|
|
176
|
-
marginTop: '1px'
|
|
177
|
-
}
|
|
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 a = r && r.__esModule ?
|
|
13
|
+
/******/ () => r["default"]
|
|
14
|
+
/******/ : () => r
|
|
15
|
+
/******/;
|
|
16
|
+
e.d(a, {
|
|
17
|
+
a
|
|
18
|
+
});
|
|
19
|
+
/******/ return a;
|
|
20
|
+
/******/ };
|
|
21
|
+
/******/ })();
|
|
22
|
+
/******/
|
|
23
|
+
/******/ /* webpack/runtime/define property getters */
|
|
24
|
+
/******/ (() => {
|
|
25
|
+
/******/ // define getter functions for harmony exports
|
|
26
|
+
/******/ e.d = (r, a) => {
|
|
27
|
+
/******/ for (var t in a) {
|
|
28
|
+
/******/ if (e.o(a, t) && !e.o(r, t)) {
|
|
29
|
+
/******/ Object.defineProperty(r, t, {
|
|
30
|
+
enumerable: true,
|
|
31
|
+
get: a[t]
|
|
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
|
+
default: () => /* reexport */ X
|
|
178
65
|
});
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
var
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
//
|
|
199
|
-
|
|
200
|
-
var
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
})
|
|
226
|
-
enterprise: Object(external_styled_components_["css"])(["calc((", " - ", ") / 2) 0"], themes_["variables"].inputHeight, diameter),
|
|
227
|
-
prisma: {
|
|
228
|
-
compact: '6px 0',
|
|
229
|
-
comfortable: '10px 0'
|
|
230
|
-
}
|
|
231
|
-
}), Object(themes_["pick"])({
|
|
232
|
-
enterprise: themes_["variables"].spacingHalf,
|
|
233
|
-
prisma: themes_["variables"].spacingSmall
|
|
234
|
-
}));
|
|
235
|
-
var StyledCheckboxClickable = external_styled_components_default()(Clickable_default.a).withConfig({
|
|
236
|
-
displayName: "SwitchStyles__StyledCheckboxClickable",
|
|
237
|
-
componentId: "sc-844ieu-1"
|
|
238
|
-
})(["", " position:relative;width:", ";height:", ";line-height:", ";padding:2px;border-radius:2px;cursor:pointer;flex:0 0 auto;border:", ";color:", ";", " &:focus{box-shadow:", ";}", " ", " &[disabled]{cursor:not-allowed;border-color:", ";", "}"], themes_["mixins"].reset('inline'), diameter, diameter, diameter, Object(themes_["pick"])({
|
|
239
|
-
enterprise: Object(themes_["pick"])({
|
|
240
|
-
light: Object(external_styled_components_["css"])(["1px solid ", ""], themes_["variables"].gray45),
|
|
241
|
-
dark: Object(external_styled_components_["css"])(["1px solid ", ""], themes_["variables"].gray80)
|
|
242
|
-
}),
|
|
243
|
-
prisma: Object(external_styled_components_["css"])(["2px solid ", ""], themes_["variables"].contentColorMuted)
|
|
244
|
-
}), Object(themes_["pick"])({
|
|
245
|
-
enterprise: Object(themes_["pick"])({
|
|
246
|
-
light: themes_["variables"].gray45,
|
|
247
|
-
dark: themes_["variables"].gray80
|
|
248
|
-
}),
|
|
249
|
-
prisma: themes_["variables"].white
|
|
250
|
-
}), Object(themes_["pick"])({
|
|
251
|
-
prisma: Object(external_styled_components_["css"])(["top:1px;padding:1px;border-radius:3px;", " ", ""], function (_ref) {
|
|
252
|
-
var $interactive = _ref.$interactive;
|
|
253
|
-
return $interactive && Object(external_styled_components_["css"])(["&:not([disabled]):not(:focus):hover{box-shadow:0 0 0 2px ", ",0 0 0 5px ", ";}"], themes_["variables"].backgroundColorPage, themes_["variables"].interactiveColorOverlayHover);
|
|
254
|
-
}, function (_ref2) {
|
|
255
|
-
var $selected = _ref2.$selected;
|
|
256
|
-
return !$selected && Object(external_styled_components_["css"])(["&:not([disabled]):not(:focus):hover{border-color:", ";}"], themes_["variables"].contentColorDefault);
|
|
257
|
-
})
|
|
258
|
-
}), themes_["variables"].focusShadow, function (_ref3) {
|
|
259
|
-
var $selected = _ref3.$selected;
|
|
260
|
-
return $selected && Object(external_styled_components_["css"])(["&:not([disabled]){border-color:", ";background-color:", ";}"], Object(themes_["pick"])({
|
|
261
|
-
enterprise: {
|
|
262
|
-
light: themes_["variables"].gray45,
|
|
263
|
-
dark: themes_["variables"].gray80
|
|
264
|
-
},
|
|
265
|
-
prisma: themes_["variables"].interactiveColorPrimary
|
|
266
|
-
}), Object(themes_["pick"])({
|
|
267
|
-
enterprise: '#none',
|
|
268
|
-
prisma: Object(external_styled_components_["css"])(["", ";"], themes_["variables"].interactiveColorPrimary)
|
|
269
|
-
}));
|
|
270
|
-
}, function (_ref4) {
|
|
271
|
-
var $error = _ref4.$error;
|
|
272
|
-
return $error && Object(themes_["pick"])({
|
|
273
|
-
enterprise: Object(themes_["pick"])({
|
|
274
|
-
light: Object(external_styled_components_["css"])(["&:not([disabled]){border-color:", ";color:", ";", "}"], themes_["variables"].errorColorL30, themes_["variables"].errorColor, function (_ref5) {
|
|
275
|
-
var $selected = _ref5.$selected;
|
|
276
|
-
return $selected && Object(external_styled_components_["css"])(["border-color:", ";"], themes_["variables"].errorColor);
|
|
277
|
-
}),
|
|
278
|
-
dark: Object(external_styled_components_["css"])(["border-color:", ";}"], themes_["variables"].errorColor)
|
|
279
|
-
}),
|
|
280
|
-
prisma: Object(external_styled_components_["css"])(["&:not([disabled]){border-color:", ";", "}"], themes_["variables"].accentColorNegative, function (_ref6) {
|
|
281
|
-
var $selected = _ref6.$selected;
|
|
282
|
-
return $selected && Object(external_styled_components_["css"])(["background-color:", ";"], themes_["variables"].accentColorNegative);
|
|
283
|
-
})
|
|
284
|
-
});
|
|
285
|
-
}, Object(themes_["pick"])({
|
|
286
|
-
enterprise: {
|
|
287
|
-
light: themes_["variables"].borderColor,
|
|
288
|
-
dark: themes_["variables"].gray45
|
|
289
|
-
},
|
|
290
|
-
prisma: themes_["variables"].contentColorDisabled
|
|
291
|
-
}), function (_ref7) {
|
|
292
|
-
var $selected = _ref7.$selected;
|
|
293
|
-
return $selected && Object(themes_["pick"])({
|
|
294
|
-
prisma: Object(external_styled_components_["css"])(["border-color:transparent;background-color:", ";"], themes_["variables"].interactiveColorBackgroundDisabled)
|
|
295
|
-
});
|
|
296
|
-
});
|
|
297
|
-
var StyledCheckboxSpan = StyledCheckboxClickable.withComponent('span');
|
|
298
|
-
var StyledSome = external_styled_components_default.a.div.withConfig({
|
|
299
|
-
displayName: "SwitchStyles__StyledSome",
|
|
300
|
-
componentId: "sc-844ieu-2"
|
|
301
|
-
})(["display:block;margin:", ";height:", ";width:", ";background:currentColor;border-radius:1px;"], Object(themes_["pick"])({
|
|
302
|
-
enterprise: '2px',
|
|
303
|
-
prisma: '5px 2px'
|
|
304
|
-
}), Object(themes_["pick"])({
|
|
305
|
-
enterprise: Object(external_styled_components_["css"])(["calc(", " - 10px);"], diameter),
|
|
306
|
-
prisma: '2px'
|
|
307
|
-
}), Object(themes_["pick"])({
|
|
308
|
-
enterprise: Object(external_styled_components_["css"])(["calc(", " - 10px);"], diameter),
|
|
309
|
-
prisma: '8px'
|
|
310
|
-
}));
|
|
311
|
-
var StyledIndicator = external_styled_components_default.a.div.withConfig({
|
|
312
|
-
displayName: "SwitchStyles__StyledIndicator",
|
|
313
|
-
componentId: "sc-844ieu-3"
|
|
314
|
-
})(["background-color:", ";border-color:", ";box-sizing:border-box;border-radius:50%;border-width:1px;position:absolute;left:-1px;top:-1px;", ";", " ", " ", ""], Object(themes_["pick"])({
|
|
315
|
-
enterprise: {
|
|
316
|
-
light: themes_["variables"].gray98,
|
|
317
|
-
dark: themes_["variables"].gray80
|
|
318
|
-
},
|
|
319
|
-
prisma: themes_["variables"].white
|
|
320
|
-
}), Object(themes_["pick"])({
|
|
321
|
-
enterprise: {
|
|
322
|
-
light: themes_["variables"].gray60,
|
|
323
|
-
dark: themes_["variables"].borderColor
|
|
324
|
-
},
|
|
325
|
-
prisma: themes_["variables"].transparent
|
|
326
|
-
}), function (_ref8) {
|
|
327
|
-
var $delay = _ref8.$delay;
|
|
328
|
-
return $delay && Object(external_styled_components_["css"])(["transition:left ", ";"], $delay);
|
|
329
|
-
}, Object(themes_["pick"])({
|
|
330
|
-
enterprise: Object(external_styled_components_["css"])(["width:", ";height:", ";border-style:solid;"], diameter, diameter),
|
|
331
|
-
prisma: Object(external_styled_components_["css"])(["height:16px;width:16px;margin:2px;border-style:none;box-shadow:", ";"], themes_["variables"].embossShadow)
|
|
332
|
-
}), function (_ref9) {
|
|
333
|
-
var $disabled = _ref9.$disabled;
|
|
334
|
-
return $disabled && Object(external_styled_components_["css"])(["border-color:", ";border-style:solid;background-color:", ";"], Object(themes_["pick"])({
|
|
335
|
-
enterprise: {
|
|
336
|
-
light: themes_["mixins"].colorWithAlpha(themes_["variables"].borderLightColor, 0.8),
|
|
337
|
-
dark: themes_["variables"].gray22
|
|
338
|
-
},
|
|
339
|
-
prisma: themes_["variables"].transparent
|
|
340
|
-
}), Object(themes_["pick"])({
|
|
341
|
-
enterprise: {
|
|
342
|
-
dark: themes_["variables"].gray45
|
|
343
|
-
},
|
|
344
|
-
prisma: themes_["mixins"].colorWithAlpha(themes_["variables"].white, 0.3)
|
|
345
|
-
}));
|
|
346
|
-
}, function (_ref10) {
|
|
347
|
-
var $selected = _ref10.$selected;
|
|
348
|
-
return $selected && Object(external_styled_components_["css"])(["left:", ";"], Object(themes_["pick"])({
|
|
349
|
-
enterprise: Object(external_styled_components_["css"])(["calc(100% - ", " + 1px)"], diameter),
|
|
350
|
-
prisma: Object(external_styled_components_["css"])(["calc(100% - ", " + 1px)"], toggleDiameter)
|
|
351
|
-
}));
|
|
352
|
-
});
|
|
353
|
-
var StyledToggleOutline = external_styled_components_default.a.div.withConfig({
|
|
354
|
-
displayName: "SwitchStyles__StyledToggleOutline",
|
|
355
|
-
componentId: "sc-844ieu-4"
|
|
356
|
-
})(["position:absolute;border:1px solid transparent;", ";border-radius:", ";top:-1px;right:-1px;bottom:-1px;left:-1px;z-index:1;", " ", ""], function (_ref11) {
|
|
357
|
-
var $delay = _ref11.$delay;
|
|
358
|
-
return $delay && Object(external_styled_components_["css"])(["transition:border-color ", ";"], $delay);
|
|
359
|
-
}, Object(themes_["pick"])({
|
|
360
|
-
enterprise: Object(external_styled_components_["css"])(["calc(", " * 0.5)"], diameter),
|
|
361
|
-
prisma: '15px'
|
|
362
|
-
}), Object(themes_["pick"])({
|
|
363
|
-
prisma: Object(external_styled_components_["css"])(["margin:-6px;"])
|
|
364
|
-
}), function (_ref12) {
|
|
365
|
-
var $error = _ref12.$error;
|
|
366
|
-
return $error && Object(external_styled_components_["css"])(["border-color:", ";"], Object(themes_["pick"])({
|
|
367
|
-
enterprise: themes_["variables"].errorColor,
|
|
368
|
-
prisma: themes_["variables"].transparent
|
|
369
|
-
}));
|
|
370
|
-
});
|
|
371
|
-
var StyledToggleClickable = external_styled_components_default()(Clickable_default.a).withConfig({
|
|
372
|
-
displayName: "SwitchStyles__StyledToggleClickable",
|
|
373
|
-
componentId: "sc-844ieu-5"
|
|
374
|
-
})(["position:relative;", " border-radius:", ";transition:background-color ", ";flex:0 0 auto;border:1px solid ", ";", " &:not([disabled]){&:focus{outline:0;box-shadow:", ";", "}&:hover ", "{background-color:", ";}&:hover ", "{background-color:", ";}};&[disabled]{border:1px solid ", ";background-color:", ";", " ", "}", ";", ""], Object(themes_["pick"])({
|
|
375
|
-
enterprise: Object(themes_["pick"])({
|
|
376
|
-
light: Object(external_styled_components_["css"])(["width:calc(", " * 2);background-color:", ";height:", ";"], diameter, themes_["variables"].gray98, diameter),
|
|
377
|
-
dark: Object(external_styled_components_["css"])(["width:calc(", " * 2);background-color:", ";height:", ";"], diameter, themes_["variables"].gray45, diameter)
|
|
378
|
-
}),
|
|
379
|
-
prisma: Object(external_styled_components_["css"])(["width:32px;background-color:", ";height:", ";top:1px;"], themes_["variables"].contentColorMuted, toggleDiameter)
|
|
380
|
-
}), diameter, function (props) {
|
|
381
|
-
return props.$delay;
|
|
382
|
-
}, Object(themes_["pick"])({
|
|
383
|
-
enterprise: {
|
|
384
|
-
light: themes_["variables"].gray60,
|
|
385
|
-
dark: themes_["variables"].borderColor
|
|
386
|
-
},
|
|
387
|
-
prisma: themes_["variables"].transparent
|
|
388
|
-
}), Object(themes_["pick"])({
|
|
389
|
-
enterprise: Object(external_styled_components_["css"])(["box-shadow:inset 0 2px 0 rgba(0,0,0,0.1);"])
|
|
390
|
-
}), Object(themes_["pick"])({
|
|
391
|
-
enterprise: Object(external_styled_components_["css"])(["", ",inset 0 2px 0 rgba(0,0,0,0.1);"], themes_["variables"].focusShadow),
|
|
392
|
-
prisma: themes_["variables"].focusShadow
|
|
393
|
-
}), Object(themes_["pick"])({
|
|
394
|
-
enterprise: Object(external_styled_components_["css"])(["> ", "{border-color:", ";}"],
|
|
395
|
-
/* sc-sel */
|
|
396
|
-
StyledToggleOutline, themes_["mixins"].colorWithAlpha(themes_["variables"].focusColor, 0.8))
|
|
397
|
-
}),
|
|
398
|
-
/* sc-sel */
|
|
399
|
-
StyledIndicator, Object(themes_["pick"])({
|
|
400
|
-
enterprise: Object(themes_["pick"])({
|
|
401
|
-
light: themes_["variables"].gray96,
|
|
402
|
-
dark: '#b1bcc7'
|
|
403
|
-
}),
|
|
404
|
-
prisma: themes_["variables"].white
|
|
405
|
-
}),
|
|
406
|
-
/* sc-sel */
|
|
407
|
-
StyledToggleOutline, Object(themes_["pick"])({
|
|
408
|
-
prisma: themes_["variables"].interactiveColorOverlayHover
|
|
409
|
-
}), Object(themes_["pick"])({
|
|
410
|
-
enterprise: {
|
|
411
|
-
light: themes_["variables"].borderLightColor,
|
|
412
|
-
dark: themes_["variables"].borderColor
|
|
413
|
-
},
|
|
414
|
-
prisma: themes_["variables"].transparent
|
|
415
|
-
}), Object(themes_["pick"])({
|
|
416
|
-
enterprise: {
|
|
417
|
-
light: themes_["variables"].gray96,
|
|
418
|
-
dark: themes_["variables"].gray30
|
|
419
|
-
},
|
|
420
|
-
prisma: themes_["variables"].interactiveColorBackgroundDisabled
|
|
421
|
-
}), Object(themes_["pick"])({
|
|
422
|
-
enterprise: Object(external_styled_components_["css"])(["box-shadow:inset 0 2px 0 rgba(0,0,0,0.06);"])
|
|
423
|
-
}), function (_ref13) {
|
|
424
|
-
var $selected = _ref13.$selected;
|
|
425
|
-
return $selected && Object(external_styled_components_["css"])(["border-color:transparent;background-color:", ";"], Object(themes_["pick"])({
|
|
426
|
-
enterprise: Object(themes_["pick"])({
|
|
427
|
-
light: themes_["variables"].accentColorL40,
|
|
428
|
-
dark: themes_["variables"].accentColorD20
|
|
429
|
-
}),
|
|
430
|
-
prisma: themes_["mixins"].colorWithAlpha(themes_["variables"].interactiveColorPrimary, 0.7)
|
|
431
|
-
}));
|
|
432
|
-
}, function (_ref14) {
|
|
433
|
-
var $selected = _ref14.$selected;
|
|
434
|
-
return $selected && Object(external_styled_components_["css"])(["border-color:", ";background-color:", ";", ""], Object(themes_["pick"])({
|
|
435
|
-
enterprise: themes_["variables"].accentColorL10,
|
|
436
|
-
prisma: themes_["variables"].transparent
|
|
437
|
-
}), Object(themes_["pick"])({
|
|
438
|
-
enterprise: themes_["variables"].accentColorL10,
|
|
439
|
-
prisma: themes_["variables"].interactiveColorPrimary
|
|
440
|
-
}), Object(themes_["pick"])({
|
|
441
|
-
prisma: Object(external_styled_components_["css"])(["box-shadow:", ";"], themes_["variables"].embossShadow)
|
|
442
|
-
}));
|
|
443
|
-
}, function (_ref15) {
|
|
444
|
-
var $error = _ref15.$error;
|
|
445
|
-
return $error && Object(external_styled_components_["css"])(["border-color:", ";", ";"], Object(themes_["pick"])({
|
|
446
|
-
enterprise: themes_["variables"].errorColor,
|
|
447
|
-
prisma: themes_["variables"].transparent
|
|
448
|
-
}), Object(themes_["pick"])({
|
|
449
|
-
prisma: Object(external_styled_components_["css"])(["background-color:", ";"], themes_["variables"].accentColorNegative)
|
|
450
|
-
}));
|
|
451
|
-
});
|
|
452
|
-
var StyledToggleSpan = StyledToggleClickable.withComponent('span');
|
|
453
|
-
var StyledLabel = external_styled_components_default.a.label.withConfig({
|
|
454
|
-
displayName: "SwitchStyles__StyledLabel",
|
|
455
|
-
componentId: "sc-844ieu-6"
|
|
456
|
-
})(["", " flex:1 1 auto;padding-left:", ";color:inherit;", ";"], themes_["mixins"].reset('inline-block'), Object(themes_["pick"])({
|
|
457
|
-
enterprise: Object(external_styled_components_["css"])(["", ";"], themes_["variables"].spacingQuarter),
|
|
458
|
-
prisma: '8px'
|
|
459
|
-
}), function (_ref16) {
|
|
460
|
-
var $disabled = _ref16.$disabled;
|
|
461
|
-
return !$disabled && Object(external_styled_components_["css"])(["cursor:pointer;"]);
|
|
462
|
-
});
|
|
463
|
-
|
|
464
|
-
// CONCATENATED MODULE: ./src/Switch/Switch.tsx
|
|
465
|
-
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); }
|
|
466
|
-
|
|
467
|
-
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); }
|
|
468
|
-
|
|
469
|
-
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; }
|
|
470
|
-
|
|
471
|
-
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; }
|
|
472
|
-
|
|
473
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
474
|
-
|
|
475
|
-
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); } }
|
|
476
|
-
|
|
477
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
478
|
-
|
|
479
|
-
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); }
|
|
480
|
-
|
|
481
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
482
|
-
|
|
483
|
-
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); }; }
|
|
484
|
-
|
|
485
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
486
|
-
|
|
487
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
488
|
-
|
|
489
|
-
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; } }
|
|
490
|
-
|
|
491
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
492
|
-
|
|
493
|
-
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; }
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
var propTypes = {
|
|
503
|
-
appearance: external_prop_types_default.a.oneOf(['checkbox', 'toggle']),
|
|
504
|
-
children: external_prop_types_default.a.node,
|
|
505
|
-
disabled: external_prop_types_default.a.bool,
|
|
506
|
-
elementRef: external_prop_types_default.a.oneOfType([external_prop_types_default.a.func, external_prop_types_default.a.object]),
|
|
507
|
-
error: external_prop_types_default.a.bool,
|
|
508
|
-
id: external_prop_types_default.a.string,
|
|
509
|
-
inline: external_prop_types_default.a.bool,
|
|
510
|
-
|
|
511
|
-
/** @private */
|
|
512
|
-
interactive: external_prop_types_default.a.bool,
|
|
513
|
-
labelledBy: external_prop_types_default.a.string,
|
|
514
|
-
onClick: external_prop_types_default.a.func,
|
|
515
|
-
|
|
516
|
-
/** @private. */
|
|
517
|
-
required: external_prop_types_default.a.bool,
|
|
518
|
-
selected: external_prop_types_default.a.oneOf([true, false, 'some']),
|
|
519
|
-
selectedLabel: external_prop_types_default.a.string,
|
|
520
|
-
someSelectedLabel: external_prop_types_default.a.string,
|
|
521
|
-
unselectedLabel: external_prop_types_default.a.string,
|
|
522
|
-
value: external_prop_types_default.a.any
|
|
523
|
-
};
|
|
524
|
-
var defaultProps = {
|
|
525
|
-
appearance: 'checkbox',
|
|
526
|
-
disabled: false,
|
|
527
|
-
error: false,
|
|
528
|
-
inline: false,
|
|
529
|
-
interactive: true,
|
|
530
|
-
selected: false
|
|
531
|
-
};
|
|
532
|
-
// unclear why the manual ref is needed here (only for styled-components)
|
|
533
|
-
var StyledClickables = {
|
|
534
|
-
checkbox: StyledCheckboxClickable,
|
|
535
|
-
toggle: StyledToggleClickable
|
|
536
|
-
};
|
|
537
|
-
var StyledSpans = {
|
|
538
|
-
checkbox: StyledCheckboxSpan,
|
|
539
|
-
toggle: StyledToggleSpan
|
|
540
|
-
};
|
|
541
|
-
/**
|
|
542
|
-
* `Switch` is a basic form control with an on/off state.
|
|
543
|
-
*/
|
|
544
|
-
|
|
545
|
-
var Switch_Switch = /*#__PURE__*/function (_Component) {
|
|
546
|
-
_inherits(Switch, _Component);
|
|
547
|
-
|
|
548
|
-
var _super = _createSuper(Switch);
|
|
549
|
-
|
|
550
|
-
_createClass(Switch, null, [{
|
|
551
|
-
key: "validateProps",
|
|
552
|
-
// @docs-props-type SwitchPropsBase
|
|
553
|
-
value: function validateProps(_ref) {
|
|
554
|
-
var selected = _ref.selected,
|
|
555
|
-
appearance = _ref.appearance;
|
|
556
|
-
|
|
557
|
-
if (false) {}
|
|
66
|
+
// CONCATENATED MODULE: external "react"
|
|
67
|
+
const a = require("react");
|
|
68
|
+
var t = e.n(a);
|
|
69
|
+
// CONCATENATED MODULE: external "prop-types"
|
|
70
|
+
const i = require("prop-types");
|
|
71
|
+
var o = e.n(i);
|
|
72
|
+
// CONCATENATED MODULE: external "@splunk/react-ui/AnimationToggle"
|
|
73
|
+
const n = require("@splunk/react-ui/AnimationToggle");
|
|
74
|
+
var l = e.n(n);
|
|
75
|
+
// CONCATENATED MODULE: external "@splunk/react-ui/ScreenReaderContent"
|
|
76
|
+
const s = require("@splunk/react-ui/ScreenReaderContent");
|
|
77
|
+
var c = e.n(s);
|
|
78
|
+
// CONCATENATED MODULE: external "@splunk/ui-utils/id"
|
|
79
|
+
const d = require("@splunk/ui-utils/id");
|
|
80
|
+
// CONCATENATED MODULE: external "@splunk/react-icons/enterprise/Check"
|
|
81
|
+
const p = require("@splunk/react-icons/enterprise/Check");
|
|
82
|
+
var u = e.n(p);
|
|
83
|
+
// CONCATENATED MODULE: external "@splunk/themes"
|
|
84
|
+
const b = require("@splunk/themes");
|
|
85
|
+
// CONCATENATED MODULE: ./src/Switch/CheckIcon.tsx
|
|
86
|
+
function v() {
|
|
87
|
+
var e = (0, b.useSplunkTheme)(), r = e.family;
|
|
88
|
+
if (r === "enterprise") {
|
|
89
|
+
|
|
90
|
+
return t().createElement(u(), {
|
|
91
|
+
inline: false,
|
|
92
|
+
size: "12px",
|
|
93
|
+
screenReaderText: null,
|
|
94
|
+
hideDefaultTooltip: true,
|
|
95
|
+
style: {
|
|
96
|
+
marginTop: "1px"
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
return t().createElement("svg", {
|
|
102
|
+
width: "12",
|
|
103
|
+
height: "12",
|
|
104
|
+
viewBox: "-1 -2 11 10",
|
|
105
|
+
style: {
|
|
106
|
+
display: "block"
|
|
107
|
+
},
|
|
108
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
109
|
+
}, t().createElement("path", {
|
|
110
|
+
d: "M8.70711 0.292893C9.09763 0.683417 9.09763 1.31658 8.70711 1.70711L4.32132 6.0929C3.73559 6.67862 2.78596 6.67869 2.20015 6.09305L0.292997 4.18646C-0.0975845 3.79599 -0.0976776 3.16282 0.292789 2.77224C0.683256 2.38166 1.31642 2.38157 1.707 2.77203L3.26061 4.32518L7.29289 0.292893C7.68342 -0.0976311 8.31658 -0.0976311 8.70711 0.292893Z",
|
|
111
|
+
fill: "currentColor"
|
|
112
|
+
}));
|
|
558
113
|
}
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
114
|
+
// CONCATENATED MODULE: external "styled-components"
|
|
115
|
+
const f = require("styled-components");
|
|
116
|
+
var h = e.n(f);
|
|
117
|
+
// CONCATENATED MODULE: external "@splunk/react-ui/Box"
|
|
118
|
+
const g = require("@splunk/react-ui/Box");
|
|
119
|
+
var m = e.n(g);
|
|
120
|
+
// CONCATENATED MODULE: external "@splunk/react-ui/Clickable"
|
|
121
|
+
const y = require("@splunk/react-ui/Clickable");
|
|
122
|
+
var k = e.n(y);
|
|
123
|
+
// CONCATENATED MODULE: ./src/Switch/SwitchStyles.ts
|
|
124
|
+
var x = "18px";
|
|
125
|
+
var C = "20px";
|
|
126
|
+
var w = h()(m()).withConfig({
|
|
127
|
+
displayName: "SwitchStyles__StyledBox",
|
|
128
|
+
componentId: "sc-844ieu-0"
|
|
129
|
+
})([ "display:inline;position:relative;color:", ";flex-shrink:0;padding:", ";[data-inline] + &{margin-left:", ";}" ], (0,
|
|
130
|
+
b.pickVariant)("$switchState", {
|
|
131
|
+
error: {
|
|
132
|
+
enterprise: b.variables.errorColor,
|
|
133
|
+
prisma: b.variables.accentColorNegative
|
|
134
|
+
},
|
|
135
|
+
disabled: {
|
|
136
|
+
enterprise: b.variables.textDisabledColor,
|
|
137
|
+
prisma: b.variables.contentColorDisabled
|
|
138
|
+
}
|
|
139
|
+
}), (0, b.pick)({
|
|
140
|
+
enterprise: (0, f.css)([ "calc((", " - ", ") / 2) 0" ], b.variables.inputHeight, x),
|
|
141
|
+
prisma: {
|
|
142
|
+
compact: "6px 0",
|
|
143
|
+
comfortable: "10px 0"
|
|
144
|
+
}
|
|
145
|
+
}), (0, b.pick)({
|
|
146
|
+
enterprise: b.variables.spacingHalf,
|
|
147
|
+
prisma: b.variables.spacingSmall
|
|
148
|
+
}));
|
|
149
|
+
var S = h()(k()).withConfig({
|
|
150
|
+
displayName: "SwitchStyles__StyledCheckboxClickable",
|
|
151
|
+
componentId: "sc-844ieu-1"
|
|
152
|
+
})([ "", " position:relative;width:", ";height:", ";line-height:", ";padding:2px;border-radius:2px;cursor:pointer;flex:0 0 auto;border:", ";color:", ";", " &:focus{box-shadow:", ";}", " ", " &[disabled]{cursor:not-allowed;border-color:", ";", "}" ], b.mixins.reset("inline"), x, x, x, (0,
|
|
153
|
+
b.pick)({
|
|
154
|
+
enterprise: (0, b.pick)({
|
|
155
|
+
light: (0, f.css)([ "1px solid ", "" ], b.variables.gray45),
|
|
156
|
+
dark: (0, f.css)([ "1px solid ", "" ], b.variables.gray80)
|
|
157
|
+
}),
|
|
158
|
+
prisma: (0, f.css)([ "2px solid ", "" ], b.variables.contentColorMuted)
|
|
159
|
+
}), (0, b.pick)({
|
|
160
|
+
enterprise: (0, b.pick)({
|
|
161
|
+
light: b.variables.gray45,
|
|
162
|
+
dark: b.variables.gray80
|
|
163
|
+
}),
|
|
164
|
+
prisma: b.variables.white
|
|
165
|
+
}), (0, b.pick)({
|
|
166
|
+
prisma: (0, f.css)([ "top:1px;padding:1px;border-radius:3px;", " ", "" ], (function(e) {
|
|
167
|
+
var r = e.$interactive;
|
|
168
|
+
return r && (0, f.css)([ "&:not([disabled]):not(:focus):hover{box-shadow:0 0 0 2px ", ",0 0 0 5px ", ";}" ], b.variables.backgroundColorPage, b.variables.interactiveColorOverlayHover);
|
|
169
|
+
}), (function(e) {
|
|
170
|
+
var r = e.$selected;
|
|
171
|
+
return !r && (0, f.css)([ "&:not([disabled]):not(:focus):hover{border-color:", ";}" ], b.variables.contentColorDefault);
|
|
172
|
+
}))
|
|
173
|
+
}), b.variables.focusShadow, (function(e) {
|
|
174
|
+
var r = e.$selected;
|
|
175
|
+
return r && (0, f.css)([ "&:not([disabled]){border-color:", ";background-color:", ";}" ], (0,
|
|
176
|
+
b.pick)({
|
|
177
|
+
enterprise: {
|
|
178
|
+
light: b.variables.gray45,
|
|
179
|
+
dark: b.variables.gray80
|
|
180
|
+
},
|
|
181
|
+
prisma: b.variables.interactiveColorPrimary
|
|
182
|
+
}), (0, b.pick)({
|
|
183
|
+
enterprise: "#none",
|
|
184
|
+
prisma: (0, f.css)([ "", ";" ], b.variables.interactiveColorPrimary)
|
|
185
|
+
}));
|
|
186
|
+
}), (function(e) {
|
|
187
|
+
var r = e.$error;
|
|
188
|
+
return r && (0, b.pick)({
|
|
189
|
+
enterprise: (0, b.pick)({
|
|
190
|
+
light: (0, f.css)([ "&:not([disabled]){border-color:", ";color:", ";", "}" ], b.variables.errorColorL30, b.variables.errorColor, (function(e) {
|
|
191
|
+
var r = e.$selected;
|
|
192
|
+
return r && (0, f.css)([ "border-color:", ";" ], b.variables.errorColor);
|
|
193
|
+
})),
|
|
194
|
+
dark: (0, f.css)([ "border-color:", ";}" ], b.variables.errorColor)
|
|
195
|
+
}),
|
|
196
|
+
prisma: (0, f.css)([ "&:not([disabled]){border-color:", ";", "}" ], b.variables.accentColorNegative, (function(e) {
|
|
197
|
+
var r = e.$selected;
|
|
198
|
+
return r && (0, f.css)([ "background-color:", ";" ], b.variables.accentColorNegative);
|
|
199
|
+
}))
|
|
200
|
+
});
|
|
201
|
+
}), (0, b.pick)({
|
|
202
|
+
enterprise: {
|
|
203
|
+
light: b.variables.borderColor,
|
|
204
|
+
dark: b.variables.gray45
|
|
205
|
+
},
|
|
206
|
+
prisma: b.variables.contentColorDisabled
|
|
207
|
+
}), (function(e) {
|
|
208
|
+
var r = e.$selected;
|
|
209
|
+
return r && (0, b.pick)({
|
|
210
|
+
prisma: (0, f.css)([ "border-color:transparent;background-color:", ";" ], b.variables.interactiveColorBackgroundDisabled)
|
|
211
|
+
});
|
|
212
|
+
}));
|
|
213
|
+
var O = S.withComponent("span");
|
|
214
|
+
var $ = h().div.withConfig({
|
|
215
|
+
displayName: "SwitchStyles__StyledSome",
|
|
216
|
+
componentId: "sc-844ieu-2"
|
|
217
|
+
})([ "display:block;margin:", ";height:", ";width:", ";background:currentColor;border-radius:1px;" ], (0,
|
|
218
|
+
b.pick)({
|
|
219
|
+
enterprise: "2px",
|
|
220
|
+
prisma: "5px 2px"
|
|
221
|
+
}), (0, b.pick)({
|
|
222
|
+
enterprise: (0, f.css)([ "calc(", " - 10px);" ], x),
|
|
223
|
+
prisma: "2px"
|
|
224
|
+
}), (0, b.pick)({
|
|
225
|
+
enterprise: (0, f.css)([ "calc(", " - 10px);" ], x),
|
|
226
|
+
prisma: "8px"
|
|
227
|
+
}));
|
|
228
|
+
var _ = h().div.withConfig({
|
|
229
|
+
displayName: "SwitchStyles__StyledIndicator",
|
|
230
|
+
componentId: "sc-844ieu-3"
|
|
231
|
+
})([ "background-color:", ";border-color:", ";box-sizing:border-box;border-radius:50%;border-width:1px;position:absolute;left:-1px;top:-1px;", ";", " ", " ", "" ], (0,
|
|
232
|
+
b.pick)({
|
|
233
|
+
enterprise: {
|
|
234
|
+
light: b.variables.gray98,
|
|
235
|
+
dark: b.variables.gray80
|
|
236
|
+
},
|
|
237
|
+
prisma: b.variables.white
|
|
238
|
+
}), (0, b.pick)({
|
|
239
|
+
enterprise: {
|
|
240
|
+
light: b.variables.gray60,
|
|
241
|
+
dark: b.variables.borderColor
|
|
658
242
|
},
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
243
|
+
prisma: b.variables.transparent
|
|
244
|
+
}), (function(e) {
|
|
245
|
+
var r = e.$delay;
|
|
246
|
+
return r && (0, f.css)([ "transition:left ", ";" ], r);
|
|
247
|
+
}), (0, b.pick)({
|
|
248
|
+
enterprise: (0, f.css)([ "width:", ";height:", ";border-style:solid;" ], x, x),
|
|
249
|
+
prisma: (0, f.css)([ "height:16px;width:16px;margin:2px;border-style:none;box-shadow:", ";" ], b.variables.embossShadow)
|
|
250
|
+
}), (function(e) {
|
|
251
|
+
var r = e.$disabled;
|
|
252
|
+
return r && (0, f.css)([ "border-color:", ";border-style:solid;background-color:", ";" ], (0,
|
|
253
|
+
b.pick)({
|
|
254
|
+
enterprise: {
|
|
255
|
+
light: b.mixins.colorWithAlpha(b.variables.borderLightColor, .8),
|
|
256
|
+
dark: b.variables.gray22
|
|
257
|
+
},
|
|
258
|
+
prisma: b.variables.transparent
|
|
259
|
+
}), (0, b.pick)({
|
|
260
|
+
enterprise: {
|
|
261
|
+
dark: b.variables.gray45
|
|
262
|
+
},
|
|
263
|
+
prisma: b.mixins.colorWithAlpha(b.variables.white, .3)
|
|
264
|
+
}));
|
|
265
|
+
}), (function(e) {
|
|
266
|
+
var r = e.$selected;
|
|
267
|
+
return r && (0, f.css)([ "left:", ";" ], (0, b.pick)({
|
|
268
|
+
enterprise: (0, f.css)([ "calc(100% - ", " + 1px)" ], x),
|
|
269
|
+
prisma: (0, f.css)([ "calc(100% - ", " + 1px)" ], C)
|
|
270
|
+
}));
|
|
271
|
+
}));
|
|
272
|
+
var P = h().div.withConfig({
|
|
273
|
+
displayName: "SwitchStyles__StyledToggleOutline",
|
|
274
|
+
componentId: "sc-844ieu-4"
|
|
275
|
+
})([ "position:absolute;border:1px solid transparent;", ";border-radius:", ";top:-1px;right:-1px;bottom:-1px;left:-1px;z-index:1;", " ", "" ], (function(e) {
|
|
276
|
+
var r = e.$delay;
|
|
277
|
+
return r && (0, f.css)([ "transition:border-color ", ";" ], r);
|
|
278
|
+
}), (0, b.pick)({
|
|
279
|
+
enterprise: (0, f.css)([ "calc(", " * 0.5)" ], x),
|
|
280
|
+
prisma: "15px"
|
|
281
|
+
}), (0, b.pick)({
|
|
282
|
+
prisma: (0, f.css)([ "margin:-6px;" ])
|
|
283
|
+
}), (function(e) {
|
|
284
|
+
var r = e.$error;
|
|
285
|
+
return r && (0, f.css)([ "border-color:", ";" ], (0, b.pick)({
|
|
286
|
+
enterprise: b.variables.errorColor,
|
|
287
|
+
prisma: b.variables.transparent
|
|
288
|
+
}));
|
|
289
|
+
}));
|
|
290
|
+
var E = h()(k()).withConfig({
|
|
291
|
+
displayName: "SwitchStyles__StyledToggleClickable",
|
|
292
|
+
componentId: "sc-844ieu-5"
|
|
293
|
+
})([ "position:relative;", " border-radius:", ";transition:background-color ", ";flex:0 0 auto;border:1px solid ", ";", " &:not([disabled]){&:focus{outline:0;box-shadow:", ";", "}&:hover ", "{background-color:", ";}&:hover ", "{background-color:", ";}};&[disabled]{border:1px solid ", ";background-color:", ";", " ", "}", ";", "" ], (0,
|
|
294
|
+
b.pick)({
|
|
295
|
+
enterprise: (0, b.pick)({
|
|
296
|
+
light: (0, f.css)([ "width:calc(", " * 2);background-color:", ";height:", ";" ], x, b.variables.gray98, x),
|
|
297
|
+
dark: (0, f.css)([ "width:calc(", " * 2);background-color:", ";height:", ";" ], x, b.variables.gray45, x)
|
|
298
|
+
}),
|
|
299
|
+
prisma: (0, f.css)([ "width:32px;background-color:", ";height:", ";top:1px;" ], b.variables.contentColorMuted, C)
|
|
300
|
+
}), x, (function(e) {
|
|
301
|
+
return e.$delay;
|
|
302
|
+
}), (0, b.pick)({
|
|
303
|
+
enterprise: {
|
|
304
|
+
light: b.variables.gray60,
|
|
305
|
+
dark: b.variables.borderColor
|
|
306
|
+
},
|
|
307
|
+
prisma: b.variables.transparent
|
|
308
|
+
}), (0, b.pick)({
|
|
309
|
+
enterprise: (0, f.css)([ "box-shadow:inset 0 2px 0 rgba(0,0,0,0.1);" ])
|
|
310
|
+
}), (0, b.pick)({
|
|
311
|
+
enterprise: (0, f.css)([ "", ",inset 0 2px 0 rgba(0,0,0,0.1);" ], b.variables.focusShadow),
|
|
312
|
+
prisma: b.variables.focusShadow
|
|
313
|
+
}), (0, b.pick)({
|
|
314
|
+
enterprise: (0, f.css)([ "> ", "{border-color:", ";}" ],
|
|
315
|
+
/* sc-sel */
|
|
316
|
+
P, b.mixins.colorWithAlpha(b.variables.focusColor, .8))
|
|
317
|
+
}),
|
|
318
|
+
/* sc-sel */
|
|
319
|
+
_, (0, b.pick)({
|
|
320
|
+
enterprise: (0, b.pick)({
|
|
321
|
+
light: b.variables.gray96,
|
|
322
|
+
dark: "#b1bcc7"
|
|
323
|
+
}),
|
|
324
|
+
prisma: b.variables.white
|
|
325
|
+
}),
|
|
326
|
+
/* sc-sel */
|
|
327
|
+
P, (0, b.pick)({
|
|
328
|
+
prisma: b.variables.interactiveColorOverlayHover
|
|
329
|
+
}), (0, b.pick)({
|
|
330
|
+
enterprise: {
|
|
331
|
+
light: b.variables.borderLightColor,
|
|
332
|
+
dark: b.variables.borderColor
|
|
333
|
+
},
|
|
334
|
+
prisma: b.variables.transparent
|
|
335
|
+
}), (0, b.pick)({
|
|
336
|
+
enterprise: {
|
|
337
|
+
light: b.variables.gray96,
|
|
338
|
+
dark: b.variables.gray30
|
|
339
|
+
},
|
|
340
|
+
prisma: b.variables.interactiveColorBackgroundDisabled
|
|
341
|
+
}), (0, b.pick)({
|
|
342
|
+
enterprise: (0, f.css)([ "box-shadow:inset 0 2px 0 rgba(0,0,0,0.06);" ])
|
|
343
|
+
}), (function(e) {
|
|
344
|
+
var r = e.$selected;
|
|
345
|
+
return r && (0, f.css)([ "border-color:transparent;background-color:", ";" ], (0,
|
|
346
|
+
b.pick)({
|
|
347
|
+
enterprise: (0, b.pick)({
|
|
348
|
+
light: b.variables.accentColorL40,
|
|
349
|
+
dark: b.variables.accentColorD20
|
|
350
|
+
}),
|
|
351
|
+
prisma: b.mixins.colorWithAlpha(b.variables.interactiveColorPrimary, .7)
|
|
352
|
+
}));
|
|
353
|
+
}), (function(e) {
|
|
354
|
+
var r = e.$selected;
|
|
355
|
+
return r && (0, f.css)([ "border-color:", ";background-color:", ";", "" ], (0, b.pick)({
|
|
356
|
+
enterprise: b.variables.accentColorL10,
|
|
357
|
+
prisma: b.variables.transparent
|
|
358
|
+
}), (0, b.pick)({
|
|
359
|
+
enterprise: b.variables.accentColorL10,
|
|
360
|
+
prisma: b.variables.interactiveColorPrimary
|
|
361
|
+
}), (0, b.pick)({
|
|
362
|
+
prisma: (0, f.css)([ "box-shadow:", ";" ], b.variables.embossShadow)
|
|
363
|
+
}));
|
|
364
|
+
}), (function(e) {
|
|
365
|
+
var r = e.$error;
|
|
366
|
+
return r && (0, f.css)([ "border-color:", ";", ";" ], (0, b.pick)({
|
|
367
|
+
enterprise: b.variables.errorColor,
|
|
368
|
+
prisma: b.variables.transparent
|
|
369
|
+
}), (0, b.pick)({
|
|
370
|
+
prisma: (0, f.css)([ "background-color:", ";" ], b.variables.accentColorNegative)
|
|
371
|
+
}));
|
|
372
|
+
}));
|
|
373
|
+
var L = E.withComponent("span");
|
|
374
|
+
var j = h().label.withConfig({
|
|
375
|
+
displayName: "SwitchStyles__StyledLabel",
|
|
376
|
+
componentId: "sc-844ieu-6"
|
|
377
|
+
})([ "", " flex:1 1 auto;padding-left:", ";color:inherit;", ";" ], b.mixins.reset("inline-block"), (0,
|
|
378
|
+
b.pick)({
|
|
379
|
+
enterprise: (0, f.css)([ "", ";" ], b.variables.spacingQuarter),
|
|
380
|
+
prisma: "8px"
|
|
381
|
+
}), (function(e) {
|
|
382
|
+
var r = e.$disabled;
|
|
383
|
+
return !r && (0, f.css)([ "cursor:pointer;" ]);
|
|
384
|
+
}));
|
|
385
|
+
// CONCATENATED MODULE: ./src/Switch/Switch.tsx
|
|
386
|
+
function I(e) {
|
|
387
|
+
"@babel/helpers - typeof";
|
|
388
|
+
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
|
|
389
|
+
I = function e(r) {
|
|
390
|
+
return typeof r;
|
|
391
|
+
};
|
|
392
|
+
} else {
|
|
393
|
+
I = function e(r) {
|
|
394
|
+
return r && typeof Symbol === "function" && r.constructor === Symbol && r !== Symbol.prototype ? "symbol" : typeof r;
|
|
395
|
+
};
|
|
396
|
+
}
|
|
397
|
+
return I(e);
|
|
398
|
+
}
|
|
399
|
+
function D() {
|
|
400
|
+
D = Object.assign || function(e) {
|
|
401
|
+
for (var r = 1; r < arguments.length; r++) {
|
|
402
|
+
var a = arguments[r];
|
|
403
|
+
for (var t in a) {
|
|
404
|
+
if (Object.prototype.hasOwnProperty.call(a, t)) {
|
|
405
|
+
e[t] = a[t];
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
return e;
|
|
684
410
|
};
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
411
|
+
return D.apply(this, arguments);
|
|
412
|
+
}
|
|
413
|
+
function q(e, r) {
|
|
414
|
+
if (e == null) return {};
|
|
415
|
+
var a = T(e, r);
|
|
416
|
+
var t, i;
|
|
417
|
+
if (Object.getOwnPropertySymbols) {
|
|
418
|
+
var o = Object.getOwnPropertySymbols(e);
|
|
419
|
+
for (i = 0; i < o.length; i++) {
|
|
420
|
+
t = o[i];
|
|
421
|
+
if (r.indexOf(t) >= 0) continue;
|
|
422
|
+
if (!Object.prototype.propertyIsEnumerable.call(e, t)) continue;
|
|
423
|
+
a[t] = e[t];
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
return a;
|
|
427
|
+
}
|
|
428
|
+
function T(e, r) {
|
|
429
|
+
if (e == null) return {};
|
|
430
|
+
var a = {};
|
|
431
|
+
var t = Object.keys(e);
|
|
432
|
+
var i, o;
|
|
433
|
+
for (o = 0; o < t.length; o++) {
|
|
434
|
+
i = t[o];
|
|
435
|
+
if (r.indexOf(i) >= 0) continue;
|
|
436
|
+
a[i] = e[i];
|
|
437
|
+
}
|
|
438
|
+
return a;
|
|
439
|
+
}
|
|
440
|
+
function N(e, r) {
|
|
441
|
+
if (!(e instanceof r)) {
|
|
442
|
+
throw new TypeError("Cannot call a class as a function");
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
function R(e, r) {
|
|
446
|
+
for (var a = 0; a < r.length; a++) {
|
|
447
|
+
var t = r[a];
|
|
448
|
+
t.enumerable = t.enumerable || false;
|
|
449
|
+
t.configurable = true;
|
|
450
|
+
if ("value" in t) t.writable = true;
|
|
451
|
+
Object.defineProperty(e, t.key, t);
|
|
452
|
+
}
|
|
717
453
|
}
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
454
|
+
function B(e, r, a) {
|
|
455
|
+
if (r) R(e.prototype, r);
|
|
456
|
+
if (a) R(e, a);
|
|
457
|
+
return e;
|
|
458
|
+
}
|
|
459
|
+
function M(e, r) {
|
|
460
|
+
if (typeof r !== "function" && r !== null) {
|
|
461
|
+
throw new TypeError("Super expression must either be null or a function");
|
|
462
|
+
}
|
|
463
|
+
e.prototype = Object.create(r && r.prototype, {
|
|
464
|
+
constructor: {
|
|
465
|
+
value: e,
|
|
466
|
+
writable: true,
|
|
467
|
+
configurable: true
|
|
468
|
+
}
|
|
469
|
+
});
|
|
470
|
+
if (r) A(e, r);
|
|
471
|
+
}
|
|
472
|
+
function A(e, r) {
|
|
473
|
+
A = Object.setPrototypeOf || function e(r, a) {
|
|
474
|
+
r.__proto__ = a;
|
|
475
|
+
return r;
|
|
476
|
+
};
|
|
477
|
+
return A(e, r);
|
|
478
|
+
}
|
|
479
|
+
function H(e) {
|
|
480
|
+
var r = F();
|
|
481
|
+
return function a() {
|
|
482
|
+
var t = Q(e), i;
|
|
483
|
+
if (r) {
|
|
484
|
+
var o = Q(this).constructor;
|
|
485
|
+
i = Reflect.construct(t, arguments, o);
|
|
486
|
+
} else {
|
|
487
|
+
i = t.apply(this, arguments);
|
|
488
|
+
}
|
|
489
|
+
return W(this, i);
|
|
490
|
+
};
|
|
491
|
+
}
|
|
492
|
+
function W(e, r) {
|
|
493
|
+
if (r && (I(r) === "object" || typeof r === "function")) {
|
|
494
|
+
return r;
|
|
495
|
+
}
|
|
496
|
+
return z(e);
|
|
497
|
+
}
|
|
498
|
+
function z(e) {
|
|
499
|
+
if (e === void 0) {
|
|
500
|
+
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
501
|
+
}
|
|
502
|
+
return e;
|
|
503
|
+
}
|
|
504
|
+
function F() {
|
|
505
|
+
if (typeof Reflect === "undefined" || !Reflect.construct) return false;
|
|
506
|
+
if (Reflect.construct.sham) return false;
|
|
507
|
+
if (typeof Proxy === "function") return true;
|
|
508
|
+
try {
|
|
509
|
+
Date.prototype.toString.call(Reflect.construct(Date, [], (function() {})));
|
|
510
|
+
return true;
|
|
511
|
+
} catch (e) {
|
|
512
|
+
return false;
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
function Q(e) {
|
|
516
|
+
Q = Object.setPrototypeOf ? Object.getPrototypeOf : function e(r) {
|
|
517
|
+
return r.__proto__ || Object.getPrototypeOf(r);
|
|
518
|
+
};
|
|
519
|
+
return Q(e);
|
|
520
|
+
}
|
|
521
|
+
function U(e, r, a) {
|
|
522
|
+
if (r in e) {
|
|
523
|
+
Object.defineProperty(e, r, {
|
|
524
|
+
value: a,
|
|
525
|
+
enumerable: true,
|
|
526
|
+
configurable: true,
|
|
527
|
+
writable: true
|
|
528
|
+
});
|
|
529
|
+
} else {
|
|
530
|
+
e[r] = a;
|
|
531
|
+
}
|
|
532
|
+
return e;
|
|
533
|
+
}
|
|
534
|
+
var V = {
|
|
535
|
+
appearance: o().oneOf([ "checkbox", "toggle" ]),
|
|
536
|
+
children: o().node,
|
|
537
|
+
disabled: o().bool,
|
|
538
|
+
elementRef: o().oneOfType([ o().func, o().object ]),
|
|
539
|
+
error: o().bool,
|
|
540
|
+
id: o().string,
|
|
541
|
+
inline: o().bool,
|
|
542
|
+
/** @private */
|
|
543
|
+
interactive: o().bool,
|
|
544
|
+
labelledBy: o().string,
|
|
545
|
+
onClick: o().func,
|
|
546
|
+
/** @private. */
|
|
547
|
+
required: o().bool,
|
|
548
|
+
selected: o().oneOf([ true, false, "some" ]),
|
|
549
|
+
selectedLabel: o().string,
|
|
550
|
+
someSelectedLabel: o().string,
|
|
551
|
+
unselectedLabel: o().string,
|
|
552
|
+
value: o().any
|
|
553
|
+
};
|
|
554
|
+
var Z = {
|
|
555
|
+
appearance: "checkbox",
|
|
556
|
+
disabled: false,
|
|
557
|
+
error: false,
|
|
558
|
+
inline: false,
|
|
559
|
+
interactive: true,
|
|
560
|
+
selected: false
|
|
561
|
+
};
|
|
562
|
+
// unclear why the manual ref is needed here (only for styled-components)
|
|
563
|
+
var G = {
|
|
564
|
+
checkbox: S,
|
|
565
|
+
toggle: E
|
|
566
|
+
};
|
|
567
|
+
var J = {
|
|
568
|
+
checkbox: O,
|
|
569
|
+
toggle: L
|
|
570
|
+
};
|
|
571
|
+
/**
|
|
572
|
+
* `Switch` is a basic form control with an on/off state.
|
|
573
|
+
*/ var K = function(e) {
|
|
574
|
+
M(a, e);
|
|
575
|
+
var r = H(a);
|
|
576
|
+
B(a, null, [ {
|
|
577
|
+
key: "validateProps",
|
|
578
|
+
// @docs-props-type SwitchPropsBase
|
|
579
|
+
value: function e(r) {
|
|
580
|
+
var a = r.selected, t = r.appearance;
|
|
581
|
+
if (false) {}
|
|
582
|
+
}
|
|
583
|
+
} ]);
|
|
584
|
+
function a(e) {
|
|
585
|
+
var t;
|
|
586
|
+
N(this, a);
|
|
587
|
+
t = r.call(this, e);
|
|
588
|
+
U(z(t), "clickableId", void 0);
|
|
589
|
+
U(z(t), "labelId", void 0);
|
|
590
|
+
U(z(t), "toggle", null);
|
|
591
|
+
U(z(t), "componentDidUpdate", a.validateProps);
|
|
592
|
+
U(z(t), "handleContainerClick", (function(e) {
|
|
593
|
+
var r, a;
|
|
594
|
+
var i = t.props, o = i.value, n = i.selected;
|
|
595
|
+
(r = (a = t.props).onClick) === null || r === void 0 ? void 0 : r.call(a, e, {
|
|
596
|
+
value: o,
|
|
597
|
+
// @ts-expect-error - safe due to individual prop interfaces
|
|
598
|
+
selected: n
|
|
599
|
+
});
|
|
600
|
+
}));
|
|
601
|
+
t.labelId = (0, d.createDOMID)("label");
|
|
602
|
+
t.clickableId = (0, d.createDOMID)("clickable");
|
|
603
|
+
a.validateProps(e);
|
|
604
|
+
return t;
|
|
605
|
+
}
|
|
606
|
+
B(a, [ {
|
|
607
|
+
key: "focus",
|
|
608
|
+
/**
|
|
609
|
+
* Place focus on the toggle.
|
|
610
|
+
*/
|
|
611
|
+
value: function e() {
|
|
612
|
+
var r;
|
|
613
|
+
(r = this.toggle) === null || r === void 0 ? void 0 : r.focus();
|
|
614
|
+
}
|
|
615
|
+
}, {
|
|
616
|
+
key: "render",
|
|
617
|
+
value: function e() {
|
|
618
|
+
var r = this;
|
|
619
|
+
var a = this.props, i = a.appearance, o = a.children, n = a.disabled, s = a.error, d = a.id, p = a.inline, u = a.interactive, b = a.labelledBy, f = a.onClick, h = a.required, g = a.selected, m = a.selectedLabel, y = a.someSelectedLabel, k = a.unselectedLabel, x = a.value, C = q(a, [ "appearance", "children", "disabled", "error", "id", "inline", "interactive", "labelledBy", "onClick", "required", "selected", "selectedLabel", "someSelectedLabel", "unselectedLabel", "value" ]);
|
|
620
|
+
var S = b;
|
|
621
|
+
// consumer defined external label
|
|
622
|
+
var O = d;
|
|
623
|
+
// consumer defined id
|
|
624
|
+
// if has internal label defined with children....
|
|
625
|
+
if (o) {
|
|
626
|
+
S = this.labelId;
|
|
627
|
+
// must use generated labelId
|
|
628
|
+
O = d || this.clickableId;
|
|
629
|
+
// must have an id
|
|
630
|
+
}
|
|
631
|
+
var E = g === "some" ? "mixed" : g;
|
|
632
|
+
var L = {
|
|
633
|
+
true: m,
|
|
634
|
+
false: k,
|
|
635
|
+
some: y
|
|
636
|
+
};
|
|
637
|
+
var I = {
|
|
638
|
+
disabled: n,
|
|
639
|
+
$interactive: u,
|
|
640
|
+
$error: s,
|
|
641
|
+
$selected: g === "some" || g,
|
|
642
|
+
"aria-labelledby": u ? S : undefined,
|
|
643
|
+
"aria-checked": u ? E : undefined,
|
|
644
|
+
"aria-invalid": s ? true : undefined,
|
|
645
|
+
"aria-required": h,
|
|
646
|
+
id: O,
|
|
647
|
+
ref: function e(a) {
|
|
648
|
+
r.toggle = a;
|
|
649
|
+
},
|
|
650
|
+
onClick: n || !u ? undefined : this.handleContainerClick,
|
|
651
|
+
"data-test": "button",
|
|
652
|
+
"data-selected": g
|
|
653
|
+
};
|
|
654
|
+
var T = G[i];
|
|
655
|
+
var N = J[i];
|
|
656
|
+
var R = function e(r) {
|
|
657
|
+
return function() {
|
|
658
|
+
var e = t().createElement(t().Fragment, null, t().createElement(_, {
|
|
659
|
+
$delay: r,
|
|
660
|
+
$disabled: n,
|
|
661
|
+
$error: !n && s,
|
|
662
|
+
$selected: g
|
|
663
|
+
}), t().createElement(P, {
|
|
664
|
+
$delay: r,
|
|
665
|
+
$error: !n && s
|
|
666
|
+
}));
|
|
667
|
+
return u ? t().createElement(T, D({
|
|
668
|
+
role: "switch"
|
|
669
|
+
}, I, {
|
|
670
|
+
$delay: r
|
|
671
|
+
}), e) : t().createElement(N, D({}, I, {
|
|
672
|
+
$delay: r
|
|
673
|
+
}), e);
|
|
674
|
+
};
|
|
675
|
+
};
|
|
676
|
+
var B = function e() {
|
|
677
|
+
var r = t().createElement(t().Fragment, null, g === true && i === "checkbox" && t().createElement(v, null), g === "some" && i === "checkbox" && t().createElement($, null));
|
|
678
|
+
return u ? t().createElement(T, D({
|
|
679
|
+
"data-clickable": true,
|
|
680
|
+
role: i
|
|
681
|
+
}, I), r) : t().createElement(N, I, r);
|
|
682
|
+
};
|
|
683
|
+
var M = n && "disabled" || s && "error" || null;
|
|
684
|
+
var A = !!m || !!y || !!k;
|
|
685
|
+
|
|
686
|
+
return t().createElement(w, D({
|
|
687
|
+
flex: true,
|
|
688
|
+
inline: p,
|
|
689
|
+
"data-test": "switch",
|
|
690
|
+
"data-test-selected": g,
|
|
691
|
+
"data-test-value": x,
|
|
692
|
+
"data-test-error": s ? true : undefined,
|
|
693
|
+
"data-error": s ? true : undefined,
|
|
694
|
+
"data-disabled": n ? true : undefined,
|
|
695
|
+
$switchState: M
|
|
696
|
+
}, C), i === "toggle" && t().createElement(l(), {
|
|
697
|
+
on: R("200ms"),
|
|
698
|
+
off: R()
|
|
699
|
+
}), i !== "toggle" && B(), u && A && t().createElement(c(), null, L["".concat(g)]), o && t().createElement(j, {
|
|
700
|
+
$disabled: n,
|
|
701
|
+
"data-test": "label",
|
|
702
|
+
id: S,
|
|
703
|
+
htmlFor: O,
|
|
704
|
+
"data-disabled": n || null
|
|
705
|
+
}, o));
|
|
706
|
+
}
|
|
707
|
+
} ]);
|
|
708
|
+
return a;
|
|
709
|
+
}(a.Component);
|
|
710
|
+
U(K, "propTypes", V);
|
|
711
|
+
U(K, "defaultProps", Z);
|
|
712
|
+
/* harmony default export */ const X = K;
|
|
713
|
+
// CONCATENATED MODULE: ./src/Switch/index.ts
|
|
714
|
+
module.exports = r;
|
|
715
|
+
/******/})();
|