@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.
Files changed (92) hide show
  1. package/Accordion.js +425 -325
  2. package/Anchor.js +147 -117
  3. package/Animation.js +142 -94
  4. package/AnimationToggle.js +197 -193
  5. package/Box.js +145 -118
  6. package/Breadcrumbs.js +288 -206
  7. package/Button.js +488 -465
  8. package/ButtonGroup.js +160 -128
  9. package/ButtonSimple.js +543 -462
  10. package/CHANGELOG.md +24 -3
  11. package/Calendar.js +1111 -1001
  12. package/Card.js +771 -598
  13. package/CardLayout.js +205 -147
  14. package/Chip.js +509 -488
  15. package/Clickable.js +414 -352
  16. package/CloseButton.js +165 -142
  17. package/Code.js +1807 -2084
  18. package/CollapsiblePanel.js +586 -519
  19. package/Color.js +1068 -1068
  20. package/ColumnLayout.js +402 -363
  21. package/ComboBox.js +903 -794
  22. package/Concertina.js +997 -802
  23. package/ControlGroup.js +687 -594
  24. package/Date.js +567 -547
  25. package/DefinitionList.js +308 -234
  26. package/Divider.js +149 -118
  27. package/Dropdown.js +459 -416
  28. package/DualListbox.js +1479 -1541
  29. package/EventListener.js +94 -97
  30. package/File.js +1051 -969
  31. package/FormRows.js +883 -696
  32. package/Heading.js +216 -193
  33. package/Image.js +446 -402
  34. package/JSONTree.js +690 -551
  35. package/Layer.js +437 -410
  36. package/Link.js +336 -255
  37. package/List.js +213 -161
  38. package/Markdown.js +509 -487
  39. package/Menu.js +1104 -1056
  40. package/Message.js +475 -441
  41. package/MessageBar.js +387 -373
  42. package/Modal.js +810 -634
  43. package/ModalLayer.js +326 -243
  44. package/Monogram.js +308 -276
  45. package/Multiselect.js +3564 -3364
  46. package/Number.js +729 -687
  47. package/Paginator.js +510 -449
  48. package/Paragraph.js +145 -112
  49. package/Popover.js +1459 -1432
  50. package/Progress.js +301 -246
  51. package/RadioBar.js +634 -527
  52. package/RadioList.js +483 -444
  53. package/Resize.js +530 -489
  54. package/ResultsMenu.js +479 -455
  55. package/ScreenReaderContent.js +142 -111
  56. package/Scroll.js +595 -456
  57. package/ScrollContainerContext.js +197 -206
  58. package/Search.js +756 -650
  59. package/Select.js +2446 -2345
  60. package/SidePanel.js +390 -284
  61. package/Slider.js +680 -676
  62. package/SlidingPanels.js +639 -503
  63. package/SplitButton.js +464 -367
  64. package/StaticContent.js +161 -133
  65. package/StepBar.js +386 -358
  66. package/Switch.js +710 -640
  67. package/TabBar.js +741 -680
  68. package/TabLayout.js +406 -322
  69. package/Table.js +4974 -4616
  70. package/Text.js +1170 -1138
  71. package/TextArea.js +1102 -1090
  72. package/Tooltip.js +624 -581
  73. package/TransitionOpen.js +489 -422
  74. package/Typography.js +176 -153
  75. package/WaitSpinner.js +230 -206
  76. package/package.json +7 -7
  77. package/types/src/Color/Color.d.ts +0 -1
  78. package/types/src/JSONTree/JSONTreeContext.d.ts +7 -0
  79. package/types/src/JSONTree/TreeNode.d.ts +5 -0
  80. package/types/src/RadioBar/RadioBar.d.ts +1 -0
  81. package/types/src/ResultsMenu/ResultsMenu.d.ts +0 -2
  82. package/types/src/Select/docs/examples/Icons.d.ts +1 -9
  83. package/types/src/Slider/Slider.d.ts +1 -0
  84. package/types/src/TabBar/Tab.d.ts +10 -1
  85. package/types/src/TabBar/TabBar.d.ts +4 -2
  86. package/types/src/Table/Head.d.ts +7 -3
  87. package/types/src/Table/Table.d.ts +3 -2
  88. package/types/src/Table/TableContext.d.ts +2 -0
  89. package/useForceUpdate.js +112 -82
  90. package/useKeyPress.js +74 -71
  91. package/usePrevious.js +65 -65
  92. package/useRovingFocus.js +122 -138
package/Switch.js CHANGED
@@ -1,645 +1,715 @@
1
- /******/ (() => { // webpackBootstrap
2
- /******/ "use strict";
3
- /******/ // The require scope
4
- /******/ var __webpack_require__ = {};
5
- /******/
6
- /************************************************************************/
7
- /******/ /* webpack/runtime/compat get default export */
8
- /******/ (() => {
9
- /******/ // getDefaultExport function for compatibility with non-harmony modules
10
- /******/ __webpack_require__.n = (module) => {
11
- /******/ var getter = module && module.__esModule ?
12
- /******/ () => (module['default']) :
13
- /******/ () => (module);
14
- /******/ __webpack_require__.d(getter, { a: getter });
15
- /******/ return getter;
16
- /******/ };
17
- /******/ })();
18
- /******/
19
- /******/ /* webpack/runtime/define property getters */
20
- /******/ (() => {
21
- /******/ // define getter functions for harmony exports
22
- /******/ __webpack_require__.d = (exports, definition) => {
23
- /******/ for(var key in definition) {
24
- /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
25
- /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
26
- /******/ }
27
- /******/ }
28
- /******/ };
29
- /******/ })();
30
- /******/
31
- /******/ /* webpack/runtime/hasOwnProperty shorthand */
32
- /******/ (() => {
33
- /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
34
- /******/ })();
35
- /******/
36
- /******/ /* webpack/runtime/make namespace object */
37
- /******/ (() => {
38
- /******/ // define __esModule on exports
39
- /******/ __webpack_require__.r = (exports) => {
40
- /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
41
- /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
42
- /******/ }
43
- /******/ Object.defineProperty(exports, '__esModule', { value: true });
44
- /******/ };
45
- /******/ })();
46
- /******/
47
- /************************************************************************/
48
- var __webpack_exports__ = {};
49
- // ESM COMPAT FLAG
50
- __webpack_require__.r(__webpack_exports__);
51
-
52
- // EXPORTS
53
- __webpack_require__.d(__webpack_exports__, {
54
- "default": () => (/* reexport */ Switch_Switch)
55
- });
56
-
57
- ;// CONCATENATED MODULE: external "react"
58
- const external_react_namespaceObject = require("react");
59
- var external_react_default = /*#__PURE__*/__webpack_require__.n(external_react_namespaceObject);
60
- ;// CONCATENATED MODULE: external "prop-types"
61
- const external_prop_types_namespaceObject = require("prop-types");
62
- var external_prop_types_default = /*#__PURE__*/__webpack_require__.n(external_prop_types_namespaceObject);
63
- ;// CONCATENATED MODULE: external "@splunk/react-ui/AnimationToggle"
64
- const AnimationToggle_namespaceObject = require("@splunk/react-ui/AnimationToggle");
65
- var AnimationToggle_default = /*#__PURE__*/__webpack_require__.n(AnimationToggle_namespaceObject);
66
- ;// CONCATENATED MODULE: external "@splunk/react-ui/ScreenReaderContent"
67
- const ScreenReaderContent_namespaceObject = require("@splunk/react-ui/ScreenReaderContent");
68
- var ScreenReaderContent_default = /*#__PURE__*/__webpack_require__.n(ScreenReaderContent_namespaceObject);
69
- ;// CONCATENATED MODULE: external "@splunk/ui-utils/id"
70
- const id_namespaceObject = require("@splunk/ui-utils/id");
71
- ;// CONCATENATED MODULE: external "@splunk/react-icons/enterprise/Check"
72
- const Check_namespaceObject = require("@splunk/react-icons/enterprise/Check");
73
- var Check_default = /*#__PURE__*/__webpack_require__.n(Check_namespaceObject);
74
- ;// CONCATENATED MODULE: external "@splunk/themes"
75
- const themes_namespaceObject = require("@splunk/themes");
76
- ;// CONCATENATED MODULE: ./src/Switch/CheckIcon.tsx
77
-
78
-
79
-
80
- function CheckIcon() {
81
- var _useSplunkTheme = (0,themes_namespaceObject.useSplunkTheme)(),
82
- family = _useSplunkTheme.family;
83
-
84
- if (family === 'enterprise') {
85
- return /*#__PURE__*/external_react_default().createElement((Check_default()), {
86
- inline: false,
87
- size: "12px",
88
- screenReaderText: null,
89
- hideDefaultTooltip: true,
90
- style: {
91
- marginTop: '1px'
92
- }
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
93
65
  });
94
- }
95
-
96
- return /*#__PURE__*/external_react_default().createElement("svg", {
97
- width: "12",
98
- height: "12",
99
- viewBox: "-1 -2 11 10",
100
- style: {
101
- display: 'block'
102
- },
103
- xmlns: "http://www.w3.org/2000/svg"
104
- }, /*#__PURE__*/external_react_default().createElement("path", {
105
- 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",
106
- fill: "currentColor"
107
- }));
108
- }
109
- ;// CONCATENATED MODULE: external "styled-components"
110
- const external_styled_components_namespaceObject = require("styled-components");
111
- var external_styled_components_default = /*#__PURE__*/__webpack_require__.n(external_styled_components_namespaceObject);
112
- ;// CONCATENATED MODULE: external "@splunk/react-ui/Box"
113
- const Box_namespaceObject = require("@splunk/react-ui/Box");
114
- var Box_default = /*#__PURE__*/__webpack_require__.n(Box_namespaceObject);
115
- ;// CONCATENATED MODULE: external "@splunk/react-ui/Clickable"
116
- const Clickable_namespaceObject = require("@splunk/react-ui/Clickable");
117
- var Clickable_default = /*#__PURE__*/__webpack_require__.n(Clickable_namespaceObject);
118
- ;// CONCATENATED MODULE: ./src/Switch/SwitchStyles.ts
119
-
120
-
121
-
122
-
123
- var diameter = '18px';
124
- var toggleDiameter = '20px';
125
- var StyledBox = external_styled_components_default()((Box_default())).withConfig({
126
- displayName: "SwitchStyles__StyledBox",
127
- componentId: "sc-844ieu-0"
128
- })(["display:inline;position:relative;color:", ";flex-shrink:0;padding:", ";[data-inline] + &{margin-left:", ";}"], (0,themes_namespaceObject.pickVariant)('$switchState', {
129
- error: {
130
- enterprise: themes_namespaceObject.variables.errorColor,
131
- prisma: themes_namespaceObject.variables.accentColorNegative
132
- },
133
- disabled: {
134
- enterprise: themes_namespaceObject.variables.textDisabledColor,
135
- prisma: themes_namespaceObject.variables.contentColorDisabled
136
- }
137
- }), (0,themes_namespaceObject.pick)({
138
- enterprise: (0,external_styled_components_namespaceObject.css)(["calc((", " - ", ") / 2) 0"], themes_namespaceObject.variables.inputHeight, diameter),
139
- prisma: {
140
- compact: '6px 0',
141
- comfortable: '10px 0'
142
- }
143
- }), (0,themes_namespaceObject.pick)({
144
- enterprise: themes_namespaceObject.variables.spacingHalf,
145
- prisma: themes_namespaceObject.variables.spacingSmall
146
- }));
147
- var StyledCheckboxClickable = external_styled_components_default()((Clickable_default())).withConfig({
148
- displayName: "SwitchStyles__StyledCheckboxClickable",
149
- componentId: "sc-844ieu-1"
150
- })(["", " 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_namespaceObject.mixins.reset('inline'), diameter, diameter, diameter, (0,themes_namespaceObject.pick)({
151
- enterprise: (0,themes_namespaceObject.pick)({
152
- light: (0,external_styled_components_namespaceObject.css)(["1px solid ", ""], themes_namespaceObject.variables.gray45),
153
- dark: (0,external_styled_components_namespaceObject.css)(["1px solid ", ""], themes_namespaceObject.variables.gray80)
154
- }),
155
- prisma: (0,external_styled_components_namespaceObject.css)(["2px solid ", ""], themes_namespaceObject.variables.contentColorMuted)
156
- }), (0,themes_namespaceObject.pick)({
157
- enterprise: (0,themes_namespaceObject.pick)({
158
- light: themes_namespaceObject.variables.gray45,
159
- dark: themes_namespaceObject.variables.gray80
160
- }),
161
- prisma: themes_namespaceObject.variables.white
162
- }), (0,themes_namespaceObject.pick)({
163
- prisma: (0,external_styled_components_namespaceObject.css)(["top:1px;padding:1px;border-radius:3px;", " ", ""], function (_ref) {
164
- var $interactive = _ref.$interactive;
165
- return $interactive && (0,external_styled_components_namespaceObject.css)(["&:not([disabled]):not(:focus):hover{box-shadow:0 0 0 2px ", ",0 0 0 5px ", ";}"], themes_namespaceObject.variables.backgroundColorPage, themes_namespaceObject.variables.interactiveColorOverlayHover);
166
- }, function (_ref2) {
167
- var $selected = _ref2.$selected;
168
- return !$selected && (0,external_styled_components_namespaceObject.css)(["&:not([disabled]):not(:focus):hover{border-color:", ";}"], themes_namespaceObject.variables.contentColorDefault);
169
- })
170
- }), themes_namespaceObject.variables.focusShadow, function (_ref3) {
171
- var $selected = _ref3.$selected;
172
- return $selected && (0,external_styled_components_namespaceObject.css)(["&:not([disabled]){border-color:", ";background-color:", ";}"], (0,themes_namespaceObject.pick)({
173
- enterprise: {
174
- light: themes_namespaceObject.variables.gray45,
175
- dark: themes_namespaceObject.variables.gray80
176
- },
177
- prisma: themes_namespaceObject.variables.interactiveColorPrimary
178
- }), (0,themes_namespaceObject.pick)({
179
- enterprise: '#none',
180
- prisma: (0,external_styled_components_namespaceObject.css)(["", ";"], themes_namespaceObject.variables.interactiveColorPrimary)
181
- }));
182
- }, function (_ref4) {
183
- var $error = _ref4.$error;
184
- return $error && (0,themes_namespaceObject.pick)({
185
- enterprise: (0,themes_namespaceObject.pick)({
186
- light: (0,external_styled_components_namespaceObject.css)(["&:not([disabled]){border-color:", ";color:", ";", "}"], themes_namespaceObject.variables.errorColorL30, themes_namespaceObject.variables.errorColor, function (_ref5) {
187
- var $selected = _ref5.$selected;
188
- return $selected && (0,external_styled_components_namespaceObject.css)(["border-color:", ";"], themes_namespaceObject.variables.errorColor);
189
- }),
190
- dark: (0,external_styled_components_namespaceObject.css)(["border-color:", ";}"], themes_namespaceObject.variables.errorColor)
191
- }),
192
- prisma: (0,external_styled_components_namespaceObject.css)(["&:not([disabled]){border-color:", ";", "}"], themes_namespaceObject.variables.accentColorNegative, function (_ref6) {
193
- var $selected = _ref6.$selected;
194
- return $selected && (0,external_styled_components_namespaceObject.css)(["background-color:", ";"], themes_namespaceObject.variables.accentColorNegative);
195
- })
196
- });
197
- }, (0,themes_namespaceObject.pick)({
198
- enterprise: {
199
- light: themes_namespaceObject.variables.borderColor,
200
- dark: themes_namespaceObject.variables.gray45
201
- },
202
- prisma: themes_namespaceObject.variables.contentColorDisabled
203
- }), function (_ref7) {
204
- var $selected = _ref7.$selected;
205
- return $selected && (0,themes_namespaceObject.pick)({
206
- prisma: (0,external_styled_components_namespaceObject.css)(["border-color:transparent;background-color:", ";"], themes_namespaceObject.variables.interactiveColorBackgroundDisabled)
207
- });
208
- });
209
- var StyledCheckboxSpan = StyledCheckboxClickable.withComponent('span');
210
- var StyledSome = external_styled_components_default().div.withConfig({
211
- displayName: "SwitchStyles__StyledSome",
212
- componentId: "sc-844ieu-2"
213
- })(["display:block;margin:", ";height:", ";width:", ";background:currentColor;border-radius:1px;"], (0,themes_namespaceObject.pick)({
214
- enterprise: '2px',
215
- prisma: '5px 2px'
216
- }), (0,themes_namespaceObject.pick)({
217
- enterprise: (0,external_styled_components_namespaceObject.css)(["calc(", " - 10px);"], diameter),
218
- prisma: '2px'
219
- }), (0,themes_namespaceObject.pick)({
220
- enterprise: (0,external_styled_components_namespaceObject.css)(["calc(", " - 10px);"], diameter),
221
- prisma: '8px'
222
- }));
223
- var StyledIndicator = external_styled_components_default().div.withConfig({
224
- displayName: "SwitchStyles__StyledIndicator",
225
- componentId: "sc-844ieu-3"
226
- })(["background-color:", ";border-color:", ";box-sizing:border-box;border-radius:50%;border-width:1px;position:absolute;left:-1px;top:-1px;", ";", " ", " ", ""], (0,themes_namespaceObject.pick)({
227
- enterprise: {
228
- light: themes_namespaceObject.variables.gray98,
229
- dark: themes_namespaceObject.variables.gray80
230
- },
231
- prisma: themes_namespaceObject.variables.white
232
- }), (0,themes_namespaceObject.pick)({
233
- enterprise: {
234
- light: themes_namespaceObject.variables.gray60,
235
- dark: themes_namespaceObject.variables.borderColor
236
- },
237
- prisma: themes_namespaceObject.variables.transparent
238
- }), function (_ref8) {
239
- var $delay = _ref8.$delay;
240
- return $delay && (0,external_styled_components_namespaceObject.css)(["transition:left ", ";"], $delay);
241
- }, (0,themes_namespaceObject.pick)({
242
- enterprise: (0,external_styled_components_namespaceObject.css)(["width:", ";height:", ";border-style:solid;"], diameter, diameter),
243
- prisma: (0,external_styled_components_namespaceObject.css)(["height:16px;width:16px;margin:2px;border-style:none;box-shadow:", ";"], themes_namespaceObject.variables.embossShadow)
244
- }), function (_ref9) {
245
- var $disabled = _ref9.$disabled;
246
- return $disabled && (0,external_styled_components_namespaceObject.css)(["border-color:", ";border-style:solid;background-color:", ";"], (0,themes_namespaceObject.pick)({
247
- enterprise: {
248
- light: themes_namespaceObject.mixins.colorWithAlpha(themes_namespaceObject.variables.borderLightColor, 0.8),
249
- dark: themes_namespaceObject.variables.gray22
250
- },
251
- prisma: themes_namespaceObject.variables.transparent
252
- }), (0,themes_namespaceObject.pick)({
253
- enterprise: {
254
- dark: themes_namespaceObject.variables.gray45
255
- },
256
- prisma: themes_namespaceObject.mixins.colorWithAlpha(themes_namespaceObject.variables.white, 0.3)
257
- }));
258
- }, function (_ref10) {
259
- var $selected = _ref10.$selected;
260
- return $selected && (0,external_styled_components_namespaceObject.css)(["left:", ";"], (0,themes_namespaceObject.pick)({
261
- enterprise: (0,external_styled_components_namespaceObject.css)(["calc(100% - ", " + 1px)"], diameter),
262
- prisma: (0,external_styled_components_namespaceObject.css)(["calc(100% - ", " + 1px)"], toggleDiameter)
263
- }));
264
- });
265
- var StyledToggleOutline = external_styled_components_default().div.withConfig({
266
- displayName: "SwitchStyles__StyledToggleOutline",
267
- componentId: "sc-844ieu-4"
268
- })(["position:absolute;border:1px solid transparent;", ";border-radius:", ";top:-1px;right:-1px;bottom:-1px;left:-1px;z-index:1;", " ", ""], function (_ref11) {
269
- var $delay = _ref11.$delay;
270
- return $delay && (0,external_styled_components_namespaceObject.css)(["transition:border-color ", ";"], $delay);
271
- }, (0,themes_namespaceObject.pick)({
272
- enterprise: (0,external_styled_components_namespaceObject.css)(["calc(", " * 0.5)"], diameter),
273
- prisma: '15px'
274
- }), (0,themes_namespaceObject.pick)({
275
- prisma: (0,external_styled_components_namespaceObject.css)(["margin:-6px;"])
276
- }), function (_ref12) {
277
- var $error = _ref12.$error;
278
- return $error && (0,external_styled_components_namespaceObject.css)(["border-color:", ";"], (0,themes_namespaceObject.pick)({
279
- enterprise: themes_namespaceObject.variables.errorColor,
280
- prisma: themes_namespaceObject.variables.transparent
281
- }));
282
- });
283
- var StyledToggleClickable = external_styled_components_default()((Clickable_default())).withConfig({
284
- displayName: "SwitchStyles__StyledToggleClickable",
285
- componentId: "sc-844ieu-5"
286
- })(["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,themes_namespaceObject.pick)({
287
- enterprise: (0,themes_namespaceObject.pick)({
288
- light: (0,external_styled_components_namespaceObject.css)(["width:calc(", " * 2);background-color:", ";height:", ";"], diameter, themes_namespaceObject.variables.gray98, diameter),
289
- dark: (0,external_styled_components_namespaceObject.css)(["width:calc(", " * 2);background-color:", ";height:", ";"], diameter, themes_namespaceObject.variables.gray45, diameter)
290
- }),
291
- prisma: (0,external_styled_components_namespaceObject.css)(["width:32px;background-color:", ";height:", ";top:1px;"], themes_namespaceObject.variables.contentColorMuted, toggleDiameter)
292
- }), diameter, function (props) {
293
- return props.$delay;
294
- }, (0,themes_namespaceObject.pick)({
295
- enterprise: {
296
- light: themes_namespaceObject.variables.gray60,
297
- dark: themes_namespaceObject.variables.borderColor
298
- },
299
- prisma: themes_namespaceObject.variables.transparent
300
- }), (0,themes_namespaceObject.pick)({
301
- enterprise: (0,external_styled_components_namespaceObject.css)(["box-shadow:inset 0 2px 0 rgba(0,0,0,0.1);"])
302
- }), (0,themes_namespaceObject.pick)({
303
- enterprise: (0,external_styled_components_namespaceObject.css)(["", ",inset 0 2px 0 rgba(0,0,0,0.1);"], themes_namespaceObject.variables.focusShadow),
304
- prisma: themes_namespaceObject.variables.focusShadow
305
- }), (0,themes_namespaceObject.pick)({
306
- enterprise: (0,external_styled_components_namespaceObject.css)(["> ", "{border-color:", ";}"],
307
- /* sc-sel */
308
- StyledToggleOutline, themes_namespaceObject.mixins.colorWithAlpha(themes_namespaceObject.variables.focusColor, 0.8))
309
- }),
310
- /* sc-sel */
311
- StyledIndicator, (0,themes_namespaceObject.pick)({
312
- enterprise: (0,themes_namespaceObject.pick)({
313
- light: themes_namespaceObject.variables.gray96,
314
- dark: '#b1bcc7'
315
- }),
316
- prisma: themes_namespaceObject.variables.white
317
- }),
318
- /* sc-sel */
319
- StyledToggleOutline, (0,themes_namespaceObject.pick)({
320
- prisma: themes_namespaceObject.variables.interactiveColorOverlayHover
321
- }), (0,themes_namespaceObject.pick)({
322
- enterprise: {
323
- light: themes_namespaceObject.variables.borderLightColor,
324
- dark: themes_namespaceObject.variables.borderColor
325
- },
326
- prisma: themes_namespaceObject.variables.transparent
327
- }), (0,themes_namespaceObject.pick)({
328
- enterprise: {
329
- light: themes_namespaceObject.variables.gray96,
330
- dark: themes_namespaceObject.variables.gray30
331
- },
332
- prisma: themes_namespaceObject.variables.interactiveColorBackgroundDisabled
333
- }), (0,themes_namespaceObject.pick)({
334
- enterprise: (0,external_styled_components_namespaceObject.css)(["box-shadow:inset 0 2px 0 rgba(0,0,0,0.06);"])
335
- }), function (_ref13) {
336
- var $selected = _ref13.$selected;
337
- return $selected && (0,external_styled_components_namespaceObject.css)(["border-color:transparent;background-color:", ";"], (0,themes_namespaceObject.pick)({
338
- enterprise: (0,themes_namespaceObject.pick)({
339
- light: themes_namespaceObject.variables.accentColorL40,
340
- dark: themes_namespaceObject.variables.accentColorD20
341
- }),
342
- prisma: themes_namespaceObject.mixins.colorWithAlpha(themes_namespaceObject.variables.interactiveColorPrimary, 0.7)
343
- }));
344
- }, function (_ref14) {
345
- var $selected = _ref14.$selected;
346
- return $selected && (0,external_styled_components_namespaceObject.css)(["border-color:", ";background-color:", ";", ""], (0,themes_namespaceObject.pick)({
347
- enterprise: themes_namespaceObject.variables.accentColorL10,
348
- prisma: themes_namespaceObject.variables.transparent
349
- }), (0,themes_namespaceObject.pick)({
350
- enterprise: themes_namespaceObject.variables.accentColorL10,
351
- prisma: themes_namespaceObject.variables.interactiveColorPrimary
352
- }), (0,themes_namespaceObject.pick)({
353
- prisma: (0,external_styled_components_namespaceObject.css)(["box-shadow:", ";"], themes_namespaceObject.variables.embossShadow)
354
- }));
355
- }, function (_ref15) {
356
- var $error = _ref15.$error;
357
- return $error && (0,external_styled_components_namespaceObject.css)(["border-color:", ";", ";"], (0,themes_namespaceObject.pick)({
358
- enterprise: themes_namespaceObject.variables.errorColor,
359
- prisma: themes_namespaceObject.variables.transparent
360
- }), (0,themes_namespaceObject.pick)({
361
- prisma: (0,external_styled_components_namespaceObject.css)(["background-color:", ";"], themes_namespaceObject.variables.accentColorNegative)
362
- }));
363
- });
364
- var StyledToggleSpan = StyledToggleClickable.withComponent('span');
365
- var StyledLabel = external_styled_components_default().label.withConfig({
366
- displayName: "SwitchStyles__StyledLabel",
367
- componentId: "sc-844ieu-6"
368
- })(["", " flex:1 1 auto;padding-left:", ";color:inherit;", ";"], themes_namespaceObject.mixins.reset('inline-block'), (0,themes_namespaceObject.pick)({
369
- enterprise: (0,external_styled_components_namespaceObject.css)(["", ";"], themes_namespaceObject.variables.spacingQuarter),
370
- prisma: '8px'
371
- }), function (_ref16) {
372
- var $disabled = _ref16.$disabled;
373
- return !$disabled && (0,external_styled_components_namespaceObject.css)(["cursor:pointer;"]);
374
- });
375
-
376
- ;// CONCATENATED MODULE: ./src/Switch/Switch.tsx
377
- 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); }
378
-
379
- 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); }
380
-
381
- 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; }
382
-
383
- 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; }
384
-
385
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
386
-
387
- 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); } }
388
-
389
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
390
-
391
- 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); }
392
-
393
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
394
-
395
- 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); }; }
396
-
397
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
398
-
399
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
400
-
401
- 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; } }
402
-
403
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
404
-
405
- 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; }
406
-
407
-
408
-
409
-
410
-
411
-
412
-
413
-
414
- var propTypes = {
415
- appearance: external_prop_types_default().oneOf(['checkbox', 'toggle']),
416
- children: (external_prop_types_default()).node,
417
- disabled: (external_prop_types_default()).bool,
418
- elementRef: external_prop_types_default().oneOfType([(external_prop_types_default()).func, (external_prop_types_default()).object]),
419
- error: (external_prop_types_default()).bool,
420
- id: (external_prop_types_default()).string,
421
- inline: (external_prop_types_default()).bool,
422
-
423
- /** @private */
424
- interactive: (external_prop_types_default()).bool,
425
- labelledBy: (external_prop_types_default()).string,
426
- onClick: (external_prop_types_default()).func,
427
-
428
- /** @private. */
429
- required: (external_prop_types_default()).bool,
430
- selected: external_prop_types_default().oneOf([true, false, 'some']),
431
- selectedLabel: (external_prop_types_default()).string,
432
- someSelectedLabel: (external_prop_types_default()).string,
433
- unselectedLabel: (external_prop_types_default()).string,
434
- value: (external_prop_types_default()).any
435
- };
436
- var defaultProps = {
437
- appearance: 'checkbox',
438
- disabled: false,
439
- error: false,
440
- inline: false,
441
- interactive: true,
442
- selected: false
443
- };
444
- // unclear why the manual ref is needed here (only for styled-components)
445
- var StyledClickables = {
446
- checkbox: StyledCheckboxClickable,
447
- toggle: StyledToggleClickable
448
- };
449
- var StyledSpans = {
450
- checkbox: StyledCheckboxSpan,
451
- toggle: StyledToggleSpan
452
- };
453
- /**
454
- * `Switch` is a basic form control with an on/off state.
455
- */
456
-
457
- var Switch = /*#__PURE__*/function (_Component) {
458
- _inherits(Switch, _Component);
459
-
460
- var _super = _createSuper(Switch);
461
-
462
- _createClass(Switch, null, [{
463
- key: "validateProps",
464
- // @docs-props-type SwitchPropsBase
465
- value: function validateProps(_ref) {
466
- var selected = _ref.selected,
467
- appearance = _ref.appearance;
468
-
469
- 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
+ }));
470
113
  }
471
- }]);
472
-
473
- function Switch(props) {
474
- var _this;
475
-
476
- _classCallCheck(this, Switch);
477
-
478
- _this = _super.call(this, props);
479
-
480
- _defineProperty(_assertThisInitialized(_this), "clickableId", void 0);
481
-
482
- _defineProperty(_assertThisInitialized(_this), "labelId", void 0);
483
-
484
- _defineProperty(_assertThisInitialized(_this), "toggle", null);
485
-
486
- _defineProperty(_assertThisInitialized(_this), "componentDidUpdate", Switch.validateProps);
487
-
488
- _defineProperty(_assertThisInitialized(_this), "handleContainerClick", function (e) {
489
- var _this$props$onClick, _this$props2;
490
-
491
- var _this$props = _this.props,
492
- value = _this$props.value,
493
- selected = _this$props.selected;
494
- (_this$props$onClick = (_this$props2 = _this.props).onClick) === null || _this$props$onClick === void 0 ? void 0 : _this$props$onClick.call(_this$props2, e, {
495
- value: value,
496
- // @ts-expect-error - safe due to individual prop interfaces
497
- selected: selected
498
- });
499
- });
500
-
501
- _this.labelId = (0,id_namespaceObject.createDOMID)('label');
502
- _this.clickableId = (0,id_namespaceObject.createDOMID)('clickable');
503
- Switch.validateProps(props);
504
- return _this;
505
- }
506
-
507
- _createClass(Switch, [{
508
- key: "focus",
509
-
510
- /**
511
- * Place focus on the toggle.
512
- */
513
- value: function focus() {
514
- var _this$toggle;
515
-
516
- (_this$toggle = this.toggle) === null || _this$toggle === void 0 ? void 0 : _this$toggle.focus();
517
- }
518
- }, {
519
- key: "render",
520
- value: function render() {
521
- var _this2 = this;
522
-
523
- var _this$props3 = this.props,
524
- appearance = _this$props3.appearance,
525
- children = _this$props3.children,
526
- disabled = _this$props3.disabled,
527
- error = _this$props3.error,
528
- id = _this$props3.id,
529
- inline = _this$props3.inline,
530
- interactive = _this$props3.interactive,
531
- labelledBy = _this$props3.labelledBy,
532
- onClick = _this$props3.onClick,
533
- required = _this$props3.required,
534
- selected = _this$props3.selected,
535
- selectedLabel = _this$props3.selectedLabel,
536
- someSelectedLabel = _this$props3.someSelectedLabel,
537
- unselectedLabel = _this$props3.unselectedLabel,
538
- value = _this$props3.value,
539
- otherProps = _objectWithoutProperties(_this$props3, ["appearance", "children", "disabled", "error", "id", "inline", "interactive", "labelledBy", "onClick", "required", "selected", "selectedLabel", "someSelectedLabel", "unselectedLabel", "value"]);
540
-
541
- var labelId = labelledBy; // consumer defined external label
542
-
543
- var clickableId = id; // consumer defined id
544
- // if has internal label defined with children....
545
-
546
- if (children) {
547
- labelId = this.labelId; // must use generated labelId
548
-
549
- clickableId = id || this.clickableId; // must have an id
550
- }
551
-
552
- var ariaChecked = selected === 'some' ? 'mixed' : selected;
553
- var stateLabels = {
554
- "true": selectedLabel,
555
- "false": unselectedLabel,
556
- some: someSelectedLabel
557
- };
558
- var switchProps = {
559
- disabled: disabled,
560
- $interactive: interactive,
561
- $error: error,
562
- $selected: selected === 'some' || selected,
563
- 'aria-labelledby': interactive ? labelId : undefined,
564
- 'aria-checked': interactive ? ariaChecked : undefined,
565
- 'aria-invalid': error ? true : undefined,
566
- 'aria-required': required,
567
- id: clickableId,
568
- ref: function ref(c) {
569
- _this2.toggle = c;
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
570
242
  },
571
- onClick: disabled || !interactive ? undefined : this.handleContainerClick,
572
- 'data-test': 'button',
573
- 'data-selected': selected
574
- };
575
- var StyledClickable = StyledClickables[appearance];
576
- var StyledSpan = StyledSpans[appearance];
577
-
578
- var renderToggle = function renderToggle(delay) {
579
- return function () {
580
- var toggleChildren = /*#__PURE__*/external_react_default().createElement((external_react_default()).Fragment, null, /*#__PURE__*/external_react_default().createElement(StyledIndicator, {
581
- $delay: delay,
582
- $disabled: disabled,
583
- $error: !disabled && error,
584
- $selected: selected
585
- }), /*#__PURE__*/external_react_default().createElement(StyledToggleOutline, {
586
- $delay: delay,
587
- $error: !disabled && error
588
- }));
589
- return interactive ? /*#__PURE__*/external_react_default().createElement(StyledClickable, _extends({
590
- role: "switch"
591
- }, switchProps, {
592
- $delay: delay
593
- }), toggleChildren) : /*#__PURE__*/external_react_default().createElement(StyledSpan, _extends({}, switchProps, {
594
- $delay: delay
595
- }), toggleChildren);
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;
596
410
  };
597
- };
598
-
599
- var renderNonToggle = function renderNonToggle() {
600
- var nonToggleChildren = /*#__PURE__*/external_react_default().createElement((external_react_default()).Fragment, null, selected === true && appearance === 'checkbox' && /*#__PURE__*/external_react_default().createElement(CheckIcon, null), selected === 'some' && appearance === 'checkbox' && /*#__PURE__*/external_react_default().createElement(StyledSome, null));
601
- return interactive ? /*#__PURE__*/external_react_default().createElement(StyledClickable, _extends({
602
- "data-clickable": true,
603
- role: appearance
604
- }, switchProps), nonToggleChildren) : /*#__PURE__*/external_react_default().createElement(StyledSpan, switchProps, nonToggleChildren);
605
- };
606
-
607
- var switchState = disabled && 'disabled' || error && 'error' || null;
608
- var hasCustomizedScreenReaderContent = !!selectedLabel || !!someSelectedLabel || !!unselectedLabel;
609
- return /*#__PURE__*/external_react_default().createElement(StyledBox, _extends({
610
- flex: true,
611
- inline: inline,
612
- "data-test": "switch",
613
- "data-test-selected": selected,
614
- "data-test-value": value,
615
- "data-test-error": error ? true : undefined,
616
- "data-error": error ? true : undefined,
617
- "data-disabled": disabled ? true : undefined,
618
- $switchState: switchState
619
- }, otherProps), appearance === 'toggle' && /*#__PURE__*/external_react_default().createElement((AnimationToggle_default()), {
620
- on: renderToggle('200ms'),
621
- off: renderToggle()
622
- }), appearance !== 'toggle' && renderNonToggle(), interactive && hasCustomizedScreenReaderContent && /*#__PURE__*/external_react_default().createElement((ScreenReaderContent_default()), null, stateLabels["".concat(selected)]), children && /*#__PURE__*/external_react_default().createElement(StyledLabel, {
623
- $disabled: disabled,
624
- "data-test": "label",
625
- id: labelId,
626
- htmlFor: clickableId,
627
- "data-disabled": disabled || null
628
- }, children));
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
+ }
629
453
  }
630
- }]);
631
-
632
- return Switch;
633
- }(external_react_namespaceObject.Component);
634
-
635
- _defineProperty(Switch, "propTypes", propTypes);
636
-
637
- _defineProperty(Switch, "defaultProps", defaultProps);
638
-
639
- /* harmony default export */ const Switch_Switch = (Switch);
640
- ;// CONCATENATED MODULE: ./src/Switch/index.ts
641
-
642
-
643
- module.exports = __webpack_exports__;
644
- /******/ })()
645
- ;
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
+ /******/})();