@splunk/react-ui 4.21.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.
Files changed (83) 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 +7 -2
  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 +1808 -2084
  18. package/Code.js.LICENSE.txt +8 -0
  19. package/CollapsiblePanel.js +586 -519
  20. package/Color.js +1066 -1069
  21. package/ColumnLayout.js +402 -363
  22. package/ComboBox.js +891 -794
  23. package/Concertina.js +997 -802
  24. package/ControlGroup.js +687 -594
  25. package/Date.js +567 -547
  26. package/DefinitionList.js +308 -234
  27. package/Divider.js +149 -118
  28. package/Dropdown.js +459 -416
  29. package/DualListbox.js +1479 -1541
  30. package/EventListener.js +94 -97
  31. package/File.js +1051 -969
  32. package/FormRows.js +883 -696
  33. package/Heading.js +216 -193
  34. package/Image.js +446 -402
  35. package/JSONTree.js +690 -551
  36. package/Layer.js +437 -410
  37. package/Link.js +336 -255
  38. package/List.js +213 -161
  39. package/Markdown.js +509 -487
  40. package/Menu.js +1105 -1056
  41. package/Message.js +475 -441
  42. package/MessageBar.js +387 -373
  43. package/Modal.js +810 -634
  44. package/ModalLayer.js +326 -243
  45. package/Monogram.js +308 -276
  46. package/Multiselect.js +3550 -3364
  47. package/Number.js +729 -687
  48. package/Paginator.js +510 -449
  49. package/Paragraph.js +145 -112
  50. package/Popover.js +1459 -1432
  51. package/Progress.js +301 -246
  52. package/RadioBar.js +610 -527
  53. package/RadioList.js +483 -444
  54. package/Resize.js +530 -489
  55. package/ResultsMenu.js +494 -455
  56. package/ScreenReaderContent.js +142 -111
  57. package/Scroll.js +595 -456
  58. package/ScrollContainerContext.js +197 -206
  59. package/Search.js +744 -650
  60. package/Select.js +2442 -2345
  61. package/SidePanel.js +390 -284
  62. package/Slider.js +669 -676
  63. package/SlidingPanels.js +639 -503
  64. package/SplitButton.js +464 -367
  65. package/StaticContent.js +161 -133
  66. package/StepBar.js +386 -358
  67. package/Switch.js +710 -640
  68. package/TabBar.js +726 -680
  69. package/TabLayout.js +406 -322
  70. package/Table.js +4842 -4616
  71. package/Text.js +1170 -1138
  72. package/TextArea.js +1102 -1090
  73. package/Tooltip.js +624 -581
  74. package/TransitionOpen.js +489 -422
  75. package/Typography.js +176 -153
  76. package/WaitSpinner.js +230 -206
  77. package/package.json +5 -5
  78. package/types/src/JSONTree/JSONTreeContext.d.ts +7 -0
  79. package/types/src/JSONTree/TreeNode.d.ts +5 -0
  80. package/useForceUpdate.js +112 -82
  81. package/useKeyPress.js +74 -71
  82. package/usePrevious.js +65 -65
  83. package/useRovingFocus.js +122 -138
package/Color.js CHANGED
@@ -1,1088 +1,1085 @@
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 */ Color_Color),
55
- defaultPalette: () => (/* reexport */ defaultPalette),
56
- isValidHEX: () => (/* reexport */ isValidHEX)
57
- });
58
-
59
- ;// CONCATENATED MODULE: external "react"
60
- const external_react_namespaceObject = require("react");
61
- var external_react_default = /*#__PURE__*/__webpack_require__.n(external_react_namespaceObject);
62
- ;// CONCATENATED MODULE: external "prop-types"
63
- const external_prop_types_namespaceObject = require("prop-types");
64
- var external_prop_types_default = /*#__PURE__*/__webpack_require__.n(external_prop_types_namespaceObject);
65
- ;// CONCATENATED MODULE: external "lodash/debounce"
66
- const debounce_namespaceObject = require("lodash/debounce");
67
- var debounce_default = /*#__PURE__*/__webpack_require__.n(debounce_namespaceObject);
68
- ;// CONCATENATED MODULE: external "lodash/has"
69
- const has_namespaceObject = require("lodash/has");
70
- var has_default = /*#__PURE__*/__webpack_require__.n(has_namespaceObject);
71
- ;// CONCATENATED MODULE: external "lodash/includes"
72
- const includes_namespaceObject = require("lodash/includes");
73
- var includes_default = /*#__PURE__*/__webpack_require__.n(includes_namespaceObject);
74
- ;// CONCATENATED MODULE: external "lodash/keys"
75
- const keys_namespaceObject = require("lodash/keys");
76
- var keys_default = /*#__PURE__*/__webpack_require__.n(keys_namespaceObject);
77
- ;// CONCATENATED MODULE: external "lodash/omit"
78
- const omit_namespaceObject = require("lodash/omit");
79
- var omit_default = /*#__PURE__*/__webpack_require__.n(omit_namespaceObject);
80
- ;// CONCATENATED MODULE: external "lodash/slice"
81
- const slice_namespaceObject = require("lodash/slice");
82
- var slice_default = /*#__PURE__*/__webpack_require__.n(slice_namespaceObject);
83
- ;// CONCATENATED MODULE: external "lodash/startsWith"
84
- const startsWith_namespaceObject = require("lodash/startsWith");
85
- var startsWith_default = /*#__PURE__*/__webpack_require__.n(startsWith_namespaceObject);
86
- ;// CONCATENATED MODULE: external "lodash/toLower"
87
- const toLower_namespaceObject = require("lodash/toLower");
88
- var toLower_default = /*#__PURE__*/__webpack_require__.n(toLower_namespaceObject);
89
- ;// CONCATENATED MODULE: external "lodash/memoize"
90
- const memoize_namespaceObject = require("lodash/memoize");
91
- var memoize_default = /*#__PURE__*/__webpack_require__.n(memoize_namespaceObject);
92
- ;// CONCATENATED MODULE: external "tinycolor2"
93
- const external_tinycolor2_namespaceObject = require("tinycolor2");
94
- var external_tinycolor2_default = /*#__PURE__*/__webpack_require__.n(external_tinycolor2_namespaceObject);
95
- ;// CONCATENATED MODULE: external "@splunk/react-ui/Dropdown"
96
- const Dropdown_namespaceObject = require("@splunk/react-ui/Dropdown");
97
- var Dropdown_default = /*#__PURE__*/__webpack_require__.n(Dropdown_namespaceObject);
98
- ;// CONCATENATED MODULE: external "@splunk/themes"
99
- const themes_namespaceObject = require("@splunk/themes");
100
- ;// CONCATENATED MODULE: external "@splunk/ui-utils/color"
101
- const color_namespaceObject = require("@splunk/ui-utils/color");
102
- ;// CONCATENATED MODULE: external "@splunk/ui-utils/i18n"
103
- const i18n_namespaceObject = require("@splunk/ui-utils/i18n");
104
- ;// CONCATENATED MODULE: external "@splunk/ui-utils/keyboard"
105
- const keyboard_namespaceObject = require("@splunk/ui-utils/keyboard");
106
- ;// CONCATENATED MODULE: external "styled-components"
107
- const external_styled_components_namespaceObject = require("styled-components");
108
- var external_styled_components_default = /*#__PURE__*/__webpack_require__.n(external_styled_components_namespaceObject);
109
- ;// CONCATENATED MODULE: external "@splunk/react-ui/Text"
110
- const Text_namespaceObject = require("@splunk/react-ui/Text");
111
- var Text_default = /*#__PURE__*/__webpack_require__.n(Text_namespaceObject);
112
- ;// CONCATENATED MODULE: external "@splunk/react-ui/ScreenReaderContent"
113
- const ScreenReaderContent_namespaceObject = require("@splunk/react-ui/ScreenReaderContent");
114
- var ScreenReaderContent_default = /*#__PURE__*/__webpack_require__.n(ScreenReaderContent_namespaceObject);
115
- ;// CONCATENATED MODULE: external "@splunk/react-icons/Checkmark"
116
- const Checkmark_namespaceObject = require("@splunk/react-icons/Checkmark");
117
- var Checkmark_default = /*#__PURE__*/__webpack_require__.n(Checkmark_namespaceObject);
118
- ;// CONCATENATED MODULE: external "@splunk/react-ui/Clickable"
119
- const Clickable_namespaceObject = require("@splunk/react-ui/Clickable");
120
- var Clickable_default = /*#__PURE__*/__webpack_require__.n(Clickable_namespaceObject);
121
- ;// CONCATENATED MODULE: ./src/Color/SwatchStyles.ts
122
-
123
-
124
-
125
-
126
- var backgroundBlockColor = (0,themes_namespaceObject.pick)({
127
- enterprise: themes_namespaceObject.variables.gray80,
128
- prisma: 'rgba(0, 0, 0, 0.2)'
129
- });
130
- var transparentSwatch = (0,external_styled_components_namespaceObject.css)(["background-image:linear-gradient( 45deg,", " 25%,transparent 25%,transparent 75%,", " 75%,", " ),linear-gradient( 45deg,", " 25%,transparent 25%,transparent 75%,", " 75%,", " );background-size:10px 10px;background-position:0 0,5px 5px;background-color:", ";"], backgroundBlockColor, backgroundBlockColor, backgroundBlockColor, backgroundBlockColor, backgroundBlockColor, backgroundBlockColor, (0,themes_namespaceObject.pick)({
131
- enterprise: 'transparent',
132
- prisma: themes_namespaceObject.variables.white
133
- }));
134
- var StyledCheck = external_styled_components_default()((Checkmark_default())).withConfig({
135
- displayName: "SwatchStyles__StyledCheck",
136
- componentId: "sc-1wxunhq-0"
137
- })(["box-sizing:border-box;color:#d3d3d3;height:100%;width:100%;"]);
138
- var StyledClickable = external_styled_components_default()((Clickable_default())).withConfig({
139
- displayName: "SwatchStyles__StyledClickable",
140
- componentId: "sc-1wxunhq-1"
141
- })(["display:block;flex:0 0 auto;border:", ";", ";", ";", ";", " &:focus{border-color:", ";box-shadow:", ";}", " ", " ", " &[disabled]{background-image:linear-gradient(rgba(255,255,255,0.8),rgba(255,255,255,0.8));}", " ", ""], (0,themes_namespaceObject.pick)({
142
- enterprise: {
143
- light: (0,external_styled_components_namespaceObject.css)(["1px solid ", ""], themes_namespaceObject.variables.gray60),
144
- dark: themes_namespaceObject.variables.border
145
- },
146
- prisma: (0,external_styled_components_namespaceObject.css)(["1px solid ", ""], themes_namespaceObject.variables.interactiveColorBorder)
147
- }), (0,themes_namespaceObject.pick)({
148
- prisma: (0,external_styled_components_namespaceObject.css)(["border-radius:2px;"])
149
- }), function (_ref) {
150
- var $value = _ref.$value;
151
- return $value === null && (0,external_styled_components_namespaceObject.css)(["background-image:linear-gradient( to bottom right,transparent 48%,", ",transparent 52% );", ";"], (0,themes_namespaceObject.pick)({
152
- enterprise: '#ed1e24',
153
- prisma: themes_namespaceObject.variables.accentColorNegative
154
- }), (0,themes_namespaceObject.pick)({
155
- prisma: (0,external_styled_components_namespaceObject.css)(["background-color:", ";"], themes_namespaceObject.variables.white)
156
- }));
157
- }, function (_ref2) {
158
- var $value = _ref2.$value;
159
- return $value && ($value === 'transparent' ? transparentSwatch : "background-color: ".concat($value));
160
- }, function (_ref3) {
161
- var $noBorder = _ref3.$noBorder;
162
- return $noBorder && (0,external_styled_components_namespaceObject.css)(["border:none;"]);
163
- }, themes_namespaceObject.variables.focusColor, themes_namespaceObject.variables.focusShadow, (0,themes_namespaceObject.pick)({
164
- enterprise: {
165
- comfortable: (0,external_styled_components_namespaceObject.css)(["width:32px;height:32px;"]),
166
- compact: (0,external_styled_components_namespaceObject.css)(["width:28px;height:28px;"])
167
- },
168
- prisma: (0,external_styled_components_namespaceObject.css)(["width:24px;height:24px;"])
169
- }), function (_ref4) {
170
- var $prepend = _ref4.$prepend;
171
- return $prepend && (0,external_styled_components_namespaceObject.css)(["border-top-left-radius:0;border-bottom-left-radius:0;"]);
172
- }, function (_ref5) {
173
- var $append = _ref5.$append;
174
- return $append && (0,external_styled_components_namespaceObject.css)(["margin-right:-1px;border-top-right-radius:0;border-bottom-right-radius:0;border-right:none;"]);
175
- }, function (_ref6) {
176
- var $hasError = _ref6.$hasError;
177
- return $hasError && (0,external_styled_components_namespaceObject.css)(["box-shadow:inset 0 0 0 2px white;border-color:", ";"], (0,themes_namespaceObject.pick)({
178
- enterprise: themes_namespaceObject.variables.errorColor,
179
- prisma: themes_namespaceObject.variables.accentColorNegative
180
- }));
181
- }, function (_ref7) {
182
- var $showSelected = _ref7.$showSelected;
183
- return $showSelected && (0,external_styled_components_namespaceObject.css)(["display:flex;align-items:center;justify-content:center;"]);
184
- });
185
-
186
- ;// CONCATENATED MODULE: ./src/Color/Swatch.tsx
187
- 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); }
188
-
189
- 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; }
190
-
191
- 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; }
192
-
193
-
194
-
195
-
196
-
197
-
198
-
199
- var propTypes = {
200
- append: (external_prop_types_default()).bool,
201
- elementRef: external_prop_types_default().oneOfType([(external_prop_types_default()).func, (external_prop_types_default()).object]),
202
-
203
- /** @private */
204
- error: (external_prop_types_default()).bool,
205
-
206
- /** @private */
207
- noBorder: (external_prop_types_default()).bool,
208
-
209
- /** @private. Call back function when activated. */
210
- onClick: (external_prop_types_default()).func,
211
- prepend: (external_prop_types_default()).bool,
212
- value: (external_prop_types_default()).string,
213
-
214
- /** @private */
215
- showSelected: (external_prop_types_default()).bool
216
- };
217
- var Swatch = /*#__PURE__*/external_react_default().forwardRef(function (_ref, ref) {
218
- var append = _ref.append,
219
- _ref$error = _ref.error,
220
- error = _ref$error === void 0 ? false : _ref$error,
221
- _onClick = _ref.onClick,
222
- prepend = _ref.prepend,
223
- value = _ref.value,
224
- noBorder = _ref.noBorder,
225
- showSelected = _ref.showSelected,
226
- otherProps = _objectWithoutProperties(_ref, ["append", "error", "onClick", "prepend", "value", "noBorder", "showSelected"]);
227
-
228
- var screenReaderValue = value === null || value === undefined ? (0,i18n_namespaceObject._)('No color') : value; // Only valid hexadecimal strings, 'transparent' and `null` are allowed for background colors
229
- // Invalid values are converted to `undefined`
230
-
231
- var $value = value;
232
-
233
- if (!(typeof $value === 'string' && ((0,color_namespaceObject.isValidHexColor)($value) || $value === 'transparent')) && $value !== null && $value !== undefined) {
234
- $value = undefined;
235
- }
236
-
237
- return /*#__PURE__*/external_react_default().createElement(StyledClickable, _extends({
238
- onClick: function onClick(e) {
239
- return _onClick === null || _onClick === void 0 ? void 0 : _onClick(e, {
240
- value: value
241
- });
242
- },
243
- ref: ref,
244
- $value: $value,
245
- $append: append,
246
- $prepend: prepend,
247
- $hasError: error,
248
- $noBorder: noBorder,
249
- $showSelected: showSelected,
250
- "data-test": "swatch",
251
- "data-test-value": value
252
- }, otherProps), showSelected && /*#__PURE__*/external_react_default().createElement(StyledCheck, {
253
- "aria-label": (0,i18n_namespaceObject._)('Selected'),
254
- role: "presentation"
255
- }), /*#__PURE__*/external_react_default().createElement((ScreenReaderContent_default()), null, screenReaderValue));
256
- });
257
- Swatch.propTypes = propTypes;
258
- /* harmony default export */ const Color_Swatch = (Swatch);
259
- ;// CONCATENATED MODULE: ./src/Color/ColorStyles.ts
260
-
261
-
262
-
263
-
264
- var StyledColor = external_styled_components_default().div.withConfig({
265
- displayName: "ColorStyles__StyledColor",
266
- componentId: "jxrost-0"
267
- })(["", ";flex-direction:row;"], themes_namespaceObject.mixins.reset('flex'));
268
- var StyledInput = external_styled_components_default().div.withConfig({
269
- displayName: "ColorStyles__StyledInput",
270
- componentId: "jxrost-1"
271
- })(["", ";"], (0,themes_namespaceObject.pick)({
272
- enterprise: (0,external_styled_components_namespaceObject.css)(["display:flex;width:100%;"]),
273
- prisma: (0,external_styled_components_namespaceObject.css)(["position:relative;", ""], function (_ref) {
274
- var $inDropdown = _ref.$inDropdown;
275
- return $inDropdown ? (0,external_styled_components_namespaceObject.css)(["width:80px;"]) : (0,external_styled_components_namespaceObject.css)(["flex:0 1 auto;min-width:0;"]);
276
- })
277
- }));
278
- var StyledInputText = external_styled_components_default()((Text_default())).withConfig({
279
- displayName: "ColorStyles__StyledInputText",
280
- componentId: "jxrost-2"
281
- })(["", ""], function (_ref2) {
282
- var $inDropdown = _ref2.$inDropdown;
283
- return $inDropdown && (0,external_styled_components_namespaceObject.css)(["font-size:12px;"]);
284
- });
285
- var StyledToggleSwatch = external_styled_components_default()(Color_Swatch).withConfig({
286
- displayName: "ColorStyles__StyledToggleSwatch",
287
- componentId: "jxrost-3"
288
- })(["", ""], (0,themes_namespaceObject.pick)({
289
- prisma: {
290
- comfortable: (0,external_styled_components_namespaceObject.css)(["width:40px;height:40px;"]),
291
- compact: (0,external_styled_components_namespaceObject.css)(["width:32px;height:32px;"])
292
- },
293
- enterprise: {
294
- comfortable: (0,external_styled_components_namespaceObject.css)(["width:32px;height:32px;"]),
295
- compact: (0,external_styled_components_namespaceObject.css)(["width:28px;height:28px;"])
296
- }
297
- }));
298
-
299
- ;// CONCATENATED MODULE: external "@splunk/react-icons/ChevronDown"
300
- const ChevronDown_namespaceObject = require("@splunk/react-icons/ChevronDown");
301
- var ChevronDown_default = /*#__PURE__*/__webpack_require__.n(ChevronDown_namespaceObject);
302
- ;// CONCATENATED MODULE: ./src/Color/PaletteStyles.ts
303
-
304
-
305
-
306
-
307
- var StyledPalette = external_styled_components_default().div.withConfig({
308
- displayName: "PaletteStyles__StyledPalette",
309
- componentId: "qgv9v9-0"
310
- })(["width:", ";padding:", ";", ""], (0,themes_namespaceObject.pick)({
311
- enterprise: '180px',
312
- prisma: '224px'
313
- }), (0,themes_namespaceObject.pick)({
314
- enterprise: themes_namespaceObject.variables.spacingHalf,
315
- prisma: '8px'
316
- }), (0,themes_namespaceObject.pick)({
317
- prisma: (0,external_styled_components_namespaceObject.css)(["display:flex;flex-direction:column;border-radius:2px;"])
318
- }));
319
- var StyledSwatches = external_styled_components_default().ul.withConfig({
320
- displayName: "PaletteStyles__StyledSwatches",
321
- componentId: "qgv9v9-1"
322
- })(["", ";margin-bottom:", ";margin-right:", ";", ""], themes_namespaceObject.mixins.reset('block'), (0,themes_namespaceObject.pick)({
323
- enterprise: '6px'
324
- }), (0,themes_namespaceObject.pick)({
325
- enterprise: '-6px'
326
- }), (0,themes_namespaceObject.pick)({
327
- prisma: (0,external_styled_components_namespaceObject.css)(["position:relative;"])
328
- }));
329
- var StyledSwatch = external_styled_components_default().li.withConfig({
330
- displayName: "PaletteStyles__StyledSwatch",
331
- componentId: "qgv9v9-2"
332
- })(["", ";margin-right:", ";margin-bottom:", ";", ""], themes_namespaceObject.mixins.reset('inline-block'), (0,themes_namespaceObject.pick)({
333
- enterprise: themes_namespaceObject.variables.spacingQuarter,
334
- prisma: '4px'
335
- }), (0,themes_namespaceObject.pick)({
336
- enterprise: themes_namespaceObject.variables.spacingQuarter,
337
- prisma: '4px'
338
- }), (0,themes_namespaceObject.pick)({
339
- prisma: (0,external_styled_components_namespaceObject.css)(["vertical-align:top;&:nth-child(8n){margin-right:0;}"])
340
- }));
341
- var StyledToolBarPrisma = external_styled_components_default().div.withConfig({
342
- displayName: "PaletteStyles__StyledToolBarPrisma",
343
- componentId: "qgv9v9-3"
344
- })(["position:relative;display:flex;align-items:center;padding:0;margin-top:12px;gap:4px;"]);
345
- var StyledExpandButton = external_styled_components_default()((Clickable_default())).withConfig({
346
- displayName: "PaletteStyles__StyledExpandButton",
347
- componentId: "qgv9v9-4"
348
- })(["position:absolute;bottom:4px;right:4px;padding:2px 4px;border-radius:2px;&:focus{box-shadow:", ";}", ""], themes_namespaceObject.variables.focusShadow, function (_ref) {
349
- var $expanded = _ref.$expanded;
350
- return $expanded && (0,external_styled_components_namespaceObject.css)(["transform:rotate(180deg);"]);
351
- });
352
- var StyledSystemColorPickerWrapper = external_styled_components_default().div.withConfig({
353
- displayName: "PaletteStyles__StyledSystemColorPickerWrapper",
354
- componentId: "qgv9v9-5"
355
- })(["position:relative;"]);
356
- var StyledSystemColorPicker = external_styled_components_default().input.withConfig({
357
- displayName: "PaletteStyles__StyledSystemColorPicker",
358
- componentId: "qgv9v9-6"
359
- })(["box-sizing:border-box;height:24px;width:24px;border:none;border-radius:2px;outline:none;appearance:none;padding:12px;margin:0;background:conic-gradient( #ef3434,#ef9a34,#deef34,#78ef34,#34ef56,#34efbc,#34bcef,#3456ef,#7834ef,#de34ef,#ef349a,#ef3434 );background-repeat:no-repeat;background-position:-6px -6px;background-size:36px 36px;cursor:pointer;&::-webkit-color-swatch{border:none;border-radius:2px;}&::-moz-color-swatch{opacity:0;}&:focus{box-shadow:", ";}"], themes_namespaceObject.variables.focusShadow);
360
- var PaletteStyles_StyledCheck = external_styled_components_default()((Checkmark_default())).withConfig({
361
- displayName: "PaletteStyles__StyledCheck",
362
- componentId: "qgv9v9-7"
363
- })(["box-sizing:border-box;color:#d3d3d3;height:100%;width:100%;position:absolute;top:0;left:0;pointer-events:none;"]);
364
-
365
- ;// CONCATENATED MODULE: ./src/Color/Palette.tsx
366
-
367
-
368
-
369
-
370
-
371
-
372
-
373
-
374
-
375
-
376
- function Palette(_ref) {
377
- var expanded = _ref.expanded,
378
- palette = _ref.palette,
379
- value = _ref.value,
380
- swatchToFocusRef = _ref.swatchToFocusRef,
381
- onSwatchClick = _ref.onSwatchClick,
382
- expandButtonRef = _ref.expandButtonRef,
383
- onPaletteExpand = _ref.onPaletteExpand,
384
- onSystemColorPickerChange = _ref.onSystemColorPickerChange,
385
- renderInput = _ref.renderInput;
386
-
387
- var _useSplunkTheme = (0,themes_namespaceObject.useSplunkTheme)(),
388
- isPrisma = _useSplunkTheme.isPrisma,
389
- isLight = _useSplunkTheme.isLight;
390
-
391
- var isValueInPalette = includes_default()(palette.map(function (c) {
392
- return c && toLower_default()(c);
393
- }), value);
394
- var swatches = palette.map(function (swatchValue, index) {
395
- var formattedValue = swatchValue === null ? null : toLower_default()(swatchValue);
396
- var selected = formattedValue === value;
397
- var shouldFocus = !isValueInPalette && index === 0 || isValueInPalette && selected;
398
- return /*#__PURE__*/external_react_default().createElement(StyledSwatch, {
399
- key: formattedValue || 'null'
400
- }, /*#__PURE__*/external_react_default().createElement(Color_Swatch, {
401
- value: formattedValue,
402
- ref: shouldFocus ? swatchToFocusRef : null,
403
- onClick: onSwatchClick,
404
- noBorder: isPrisma,
405
- showSelected: isPrisma && selected
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 = t => {
12
+ /******/ var r = t && t.__esModule ?
13
+ /******/ () => t["default"]
14
+ /******/ : () => t
15
+ /******/;
16
+ e.d(r, {
17
+ a: r
18
+ });
19
+ /******/ return r;
20
+ /******/ };
21
+ /******/ })();
22
+ /******/
23
+ /******/ /* webpack/runtime/define property getters */
24
+ /******/ (() => {
25
+ /******/ // define getter functions for harmony exports
26
+ /******/ e.d = (t, r) => {
27
+ /******/ for (var n in r) {
28
+ /******/ if (e.o(r, n) && !e.o(t, n)) {
29
+ /******/ Object.defineProperty(t, n, {
30
+ enumerable: true,
31
+ get: r[n]
32
+ });
33
+ /******/ }
34
+ /******/ }
35
+ /******/ };
36
+ /******/ })();
37
+ /******/
38
+ /******/ /* webpack/runtime/hasOwnProperty shorthand */
39
+ /******/ (() => {
40
+ /******/ e.o = (e, t) => Object.prototype.hasOwnProperty.call(e, t)
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 t = {};
60
+ // ESM COMPAT FLAG
61
+ e.r(t);
62
+ // EXPORTS
63
+ e.d(t, {
64
+ default: () => /* reexport */ Le,
65
+ defaultPalette: () => /* reexport */ Ve,
66
+ isValidHEX: () => /* reexport */ He
67
+ });
68
+ // CONCATENATED MODULE: external "react"
69
+ const r = require("react");
70
+ var n = e.n(r);
71
+ // CONCATENATED MODULE: external "prop-types"
72
+ const a = require("prop-types");
73
+ var o = e.n(a);
74
+ // CONCATENATED MODULE: external "lodash/debounce"
75
+ const l = require("lodash/debounce");
76
+ var i = e.n(l);
77
+ // CONCATENATED MODULE: external "lodash/has"
78
+ const s = require("lodash/has");
79
+ var u = e.n(s);
80
+ // CONCATENATED MODULE: external "lodash/includes"
81
+ const p = require("lodash/includes");
82
+ var c = e.n(p);
83
+ // CONCATENATED MODULE: external "lodash/keys"
84
+ const d = require("lodash/keys");
85
+ var f = e.n(d);
86
+ // CONCATENATED MODULE: external "lodash/omit"
87
+ const v = require("lodash/omit");
88
+ var h = e.n(v);
89
+ // CONCATENATED MODULE: external "lodash/slice"
90
+ const y = require("lodash/slice");
91
+ var m = e.n(y);
92
+ // CONCATENATED MODULE: external "lodash/startsWith"
93
+ const b = require("lodash/startsWith");
94
+ var g = e.n(b);
95
+ // CONCATENATED MODULE: external "lodash/toLower"
96
+ const x = require("lodash/toLower");
97
+ var w = e.n(x);
98
+ // CONCATENATED MODULE: external "lodash/memoize"
99
+ const S = require("lodash/memoize");
100
+ var k = e.n(S);
101
+ // CONCATENATED MODULE: external "tinycolor2"
102
+ const C = require("tinycolor2");
103
+ var P = e.n(C);
104
+ // CONCATENATED MODULE: external "@splunk/react-ui/Dropdown"
105
+ const E = require("@splunk/react-ui/Dropdown");
106
+ var O = e.n(E);
107
+ // CONCATENATED MODULE: external "@splunk/themes"
108
+ const _ = require("@splunk/themes");
109
+ // CONCATENATED MODULE: external "@splunk/ui-utils/color"
110
+ const q = require("@splunk/ui-utils/color");
111
+ // CONCATENATED MODULE: external "@splunk/ui-utils/i18n"
112
+ const j = require("@splunk/ui-utils/i18n");
113
+ // CONCATENATED MODULE: external "@splunk/ui-utils/keyboard"
114
+ const I = require("@splunk/ui-utils/keyboard");
115
+ // CONCATENATED MODULE: external "styled-components"
116
+ const T = require("styled-components");
117
+ var R = e.n(T);
118
+ // CONCATENATED MODULE: external "@splunk/react-ui/Text"
119
+ const B = require("@splunk/react-ui/Text");
120
+ var V = e.n(B);
121
+ // CONCATENATED MODULE: external "@splunk/react-ui/ScreenReaderContent"
122
+ const N = require("@splunk/react-ui/ScreenReaderContent");
123
+ var A = e.n(N);
124
+ // CONCATENATED MODULE: external "@splunk/react-icons/Checkmark"
125
+ const D = require("@splunk/react-icons/Checkmark");
126
+ var $ = e.n(D);
127
+ // CONCATENATED MODULE: external "@splunk/react-ui/Clickable"
128
+ const H = require("@splunk/react-ui/Clickable");
129
+ var z = e.n(H);
130
+ // CONCATENATED MODULE: ./src/Color/SwatchStyles.ts
131
+ var K = (0, _.pick)({
132
+ enterprise: _.variables.gray80,
133
+ prisma: "rgba(0, 0, 0, 0.2)"
134
+ });
135
+ var F = (0, T.css)([ "background-image:linear-gradient( 45deg,", " 25%,transparent 25%,transparent 75%,", " 75%,", " ),linear-gradient( 45deg,", " 25%,transparent 25%,transparent 75%,", " 75%,", " );background-size:10px 10px;background-position:0 0,5px 5px;background-color:", ";" ], K, K, K, K, K, K, (0,
136
+ _.pick)({
137
+ enterprise: "transparent",
138
+ prisma: _.variables.white
139
+ }));
140
+ var M = R()($()).withConfig({
141
+ displayName: "SwatchStyles__StyledCheck",
142
+ componentId: "sc-1wxunhq-0"
143
+ })([ "box-sizing:border-box;color:#d3d3d3;height:100%;width:100%;" ]);
144
+ var L = R()(z()).withConfig({
145
+ displayName: "SwatchStyles__StyledClickable",
146
+ componentId: "sc-1wxunhq-1"
147
+ })([ "display:block;flex:0 0 auto;border:", ";", ";", ";", ";", " &:focus{border-color:", ";box-shadow:", ";}", " ", " ", " &[disabled]{background-image:linear-gradient(rgba(255,255,255,0.8),rgba(255,255,255,0.8));}", " ", "" ], (0,
148
+ _.pick)({
149
+ enterprise: {
150
+ light: (0, T.css)([ "1px solid ", "" ], _.variables.gray60),
151
+ dark: _.variables.border
152
+ },
153
+ prisma: (0, T.css)([ "1px solid ", "" ], _.variables.interactiveColorBorder)
154
+ }), (0, _.pick)({
155
+ prisma: (0, T.css)([ "border-radius:2px;" ])
156
+ }), (function(e) {
157
+ var t = e.$value;
158
+ return t === null && (0, T.css)([ "background-image:linear-gradient( to bottom right,transparent 48%,", ",transparent 52% );", ";" ], (0,
159
+ _.pick)({
160
+ enterprise: "#ed1e24",
161
+ prisma: _.variables.accentColorNegative
162
+ }), (0, _.pick)({
163
+ prisma: (0, T.css)([ "background-color:", ";" ], _.variables.white)
164
+ }));
165
+ }), (function(e) {
166
+ var t = e.$value;
167
+ return t && (t === "transparent" ? F : "background-color: ".concat(t));
168
+ }), (function(e) {
169
+ var t = e.$noBorder;
170
+ return t && (0, T.css)([ "border:none;" ]);
171
+ }), _.variables.focusColor, _.variables.focusShadow, (0, _.pick)({
172
+ enterprise: {
173
+ comfortable: (0, T.css)([ "width:32px;height:32px;" ]),
174
+ compact: (0, T.css)([ "width:28px;height:28px;" ])
175
+ },
176
+ prisma: (0, T.css)([ "width:24px;height:24px;" ])
177
+ }), (function(e) {
178
+ var t = e.$prepend;
179
+ return t && (0, T.css)([ "border-top-left-radius:0;border-bottom-left-radius:0;" ]);
180
+ }), (function(e) {
181
+ var t = e.$append;
182
+ return t && (0, T.css)([ "margin-right:-1px;border-top-right-radius:0;border-bottom-right-radius:0;border-right:none;" ]);
183
+ }), (function(e) {
184
+ var t = e.$hasError;
185
+ return t && (0, T.css)([ "box-shadow:inset 0 0 0 2px white;border-color:", ";" ], (0,
186
+ _.pick)({
187
+ enterprise: _.variables.errorColor,
188
+ prisma: _.variables.accentColorNegative
189
+ }));
190
+ }), (function(e) {
191
+ var t = e.$showSelected;
192
+ return t && (0, T.css)([ "display:flex;align-items:center;justify-content:center;" ]);
406
193
  }));
407
- });
408
-
409
- if (isPrisma) {
410
- var isCustomColor = !isValueInPalette && value !== '#ffffff' && value !== '#000000' && value !== null && value !== '';
411
- var swatchEnd = swatches.length === 8 ? 7 : 15;
412
- var swatchesDefaultDisplay = slice_default()(swatches, 0, swatchEnd);
413
- var swatchesExpandDisplay = slice_default()(swatches, swatchEnd);
414
- return /*#__PURE__*/external_react_default().createElement(StyledPalette, null, /*#__PURE__*/external_react_default().createElement("div", {
415
- style: {
416
- position: 'relative'
417
- }
418
- }, /*#__PURE__*/external_react_default().createElement(StyledSwatches, null, swatchesDefaultDisplay, expanded && swatchesExpandDisplay), expanded && /*#__PURE__*/external_react_default().createElement(StyledToolBarPrisma, {
419
- "data-test": "tool-bar"
420
- }, /*#__PURE__*/external_react_default().createElement(themes_namespaceObject.SplunkThemeProvider, {
421
- density: "compact"
422
- }, renderInput && renderInput()), /*#__PURE__*/external_react_default().createElement(Color_Swatch, {
423
- value: null,
424
- ref: value === null ? swatchToFocusRef : null,
425
- onClick: onSwatchClick,
426
- noBorder: !isLight,
427
- showSelected: value === null
428
- }), /*#__PURE__*/external_react_default().createElement(Color_Swatch, {
429
- value: "#ffffff",
430
- ref: value === '#ffffff' ? swatchToFocusRef : null,
431
- onClick: onSwatchClick,
432
- noBorder: !isLight,
433
- showSelected: value === '#ffffff'
434
- }), /*#__PURE__*/external_react_default().createElement(Color_Swatch, {
435
- value: "#000000",
436
- ref: value === '#000000' ? swatchToFocusRef : null,
437
- onClick: onSwatchClick,
438
- noBorder: true,
439
- showSelected: value === '#000000'
440
- }), /*#__PURE__*/external_react_default().createElement(StyledSystemColorPickerWrapper, null, /*#__PURE__*/external_react_default().createElement(StyledSystemColorPicker, {
441
- type: "color" // TODO: SUI-2806 Remove the warning with Prisma null example
442
- // Warning only exists in Chrome: https://chromium.googlesource.com/chromium/src/+/011c27ced479c76cffd5093ce107082e4da657f3/third_party/blink/renderer/core/html/forms/color_input_type.cc#190
443
- ,
444
- value: value === null ? '' : value,
445
- onChange: onSystemColorPickerChange,
446
- ref: isCustomColor ? swatchToFocusRef : null
447
- }), isCustomColor && /*#__PURE__*/external_react_default().createElement(PaletteStyles_StyledCheck, {
448
- "aria-label": (0,i18n_namespaceObject._)('Selected'),
449
- role: "presentation"
450
- }))), /*#__PURE__*/external_react_default().createElement(StyledExpandButton, {
451
- ref: expandButtonRef,
452
- $expanded: expanded,
453
- onClick: onPaletteExpand,
454
- "data-test": "expand-button"
455
- }, /*#__PURE__*/external_react_default().createElement((ChevronDown_default()), null))));
456
- }
457
-
458
- return /*#__PURE__*/external_react_default().createElement(StyledPalette, null, /*#__PURE__*/external_react_default().createElement(StyledSwatches, null, swatches), renderInput && renderInput());
459
- }
460
-
461
- /* harmony default export */ const Color_Palette = (Palette);
462
- ;// CONCATENATED MODULE: ./src/Color/Color.tsx
463
- 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); }
464
-
465
- function Color_extends() { Color_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 Color_extends.apply(this, arguments); }
466
-
467
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
468
-
469
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
470
-
471
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
472
-
473
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
474
-
475
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
476
-
477
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
478
-
479
- function Color_objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = Color_objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
480
-
481
- function Color_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; }
482
-
483
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
484
-
485
- 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); } }
486
-
487
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
488
-
489
- 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); }
490
-
491
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
492
-
493
- 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); }; }
494
-
495
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
496
-
497
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
498
-
499
- 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; } }
500
-
501
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
502
-
503
- 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; }
504
-
505
-
506
-
507
-
508
-
509
-
510
-
511
-
512
-
513
-
514
-
515
-
516
-
517
-
518
-
519
-
520
-
521
-
522
-
523
-
524
-
525
- // The default palette in Prisma theme.
526
- var defaultPalette = ['#912344', '#D44C20', '#C0891E', '#26AA92', '#2F8AA7', '#2E49AA', '#602CA1', '#BA4ABD'];
527
- var generatePalette = memoize_default()(function (initialPalette) {
528
- var palette = [];
529
-
530
- for (var i = 1; i <= initialPalette.length * 4; i += 1) {
531
- var baseColor = initialPalette[(i - 1) % initialPalette.length];
532
-
533
- if (i > initialPalette.length * 3) {
534
- palette.push(baseColor);
535
- } else {
536
- var lightenBy = 40 - 10 * (i / initialPalette.length);
537
- palette.push(external_tinycolor2_default()(baseColor).lighten(lightenBy).toString());
194
+ // CONCATENATED MODULE: ./src/Color/Swatch.tsx
195
+ function Q() {
196
+ Q = Object.assign || function(e) {
197
+ for (var t = 1; t < arguments.length; t++) {
198
+ var r = arguments[t];
199
+ for (var n in r) {
200
+ if (Object.prototype.hasOwnProperty.call(r, n)) {
201
+ e[n] = r[n];
202
+ }
203
+ }
204
+ }
205
+ return e;
206
+ };
207
+ return Q.apply(this, arguments);
538
208
  }
539
- }
540
-
541
- return palette;
542
- }); // The tool palette in Prisma theme.
543
-
544
- var toolPalette = ['#ffffff', '#000000', null];
545
- var Color_propTypes = {
546
- append: (external_prop_types_default()).bool,
547
- defaultValue: (external_prop_types_default()).string,
548
- describedBy: (external_prop_types_default()).string,
549
- disabled: (external_prop_types_default()).bool,
550
- elementRef: external_prop_types_default().oneOfType([(external_prop_types_default()).func, (external_prop_types_default()).object]),
551
- error: (external_prop_types_default()).bool,
552
- hideInput: (external_prop_types_default()).bool,
553
- labelledBy: (external_prop_types_default()).string,
554
- name: (external_prop_types_default()).string,
555
- onChange: (external_prop_types_default()).func,
556
- palette: (external_prop_types_default()).array,
557
- prepend: (external_prop_types_default()).bool,
558
-
559
- /** @private */
560
- splunkTheme: (external_prop_types_default()).object,
561
- value: (external_prop_types_default()).string
562
- };
563
- var defaultProps = {
564
- append: false,
565
- disabled: false,
566
- error: false,
567
- hideInput: false,
568
- palette: generatePalette(defaultPalette),
569
- prepend: false
570
- };
571
-
572
- // TODO: SUI-2551 Deprecate this in favor of ui-utils implementation
573
- var isValidHEX = function isValidHEX(value) {
574
- return (0,color_namespaceObject.isValidHexColor)(value);
575
- };
576
-
577
- var NAUppercase = 'N/A';
578
- var NALowercase = 'n/a';
579
- /*
580
- * When the dropdown opens:
581
- * 1. If palette contains the color and the color is selected, the dropdown focus the color.
582
- * 2. If palette doesn't contain the color:
583
- * 1. If the current theme `family` is `prisma` the input receives focus.
584
- * 2. Otherwise the first color swatch receives focus.
585
- */
586
-
587
- var Color = /*#__PURE__*/function (_Component) {
588
- _inherits(Color, _Component);
589
-
590
- var _super = _createSuper(Color);
591
-
592
- _createClass(Color, null, [{
593
- key: "hasNull",
594
- // @docs-props-type ColorPropsBase
595
- value: function hasNull(palette) {
596
- return palette.some(function (color) {
597
- return color === null;
598
- });
209
+ function U(e, t) {
210
+ if (e == null) return {};
211
+ var r = W(e, t);
212
+ var n, a;
213
+ if (Object.getOwnPropertySymbols) {
214
+ var o = Object.getOwnPropertySymbols(e);
215
+ for (a = 0; a < o.length; a++) {
216
+ n = o[a];
217
+ if (t.indexOf(n) >= 0) continue;
218
+ if (!Object.prototype.propertyIsEnumerable.call(e, n)) continue;
219
+ r[n] = e[n];
220
+ }
221
+ }
222
+ return r;
599
223
  }
600
- }, {
601
- key: "hasTransparent",
602
- value: function hasTransparent(palette) {
603
- return palette.some(function (color) {
604
- return color !== null && toLower_default()(color) === 'transparent';
605
- });
224
+ function W(e, t) {
225
+ if (e == null) return {};
226
+ var r = {};
227
+ var n = Object.keys(e);
228
+ var a, o;
229
+ for (o = 0; o < n.length; o++) {
230
+ a = n[o];
231
+ if (t.indexOf(a) >= 0) continue;
232
+ r[a] = e[a];
233
+ }
234
+ return r;
606
235
  }
607
- }]);
608
-
609
- function Color(props) {
610
- var _this;
611
-
612
- _classCallCheck(this, Color);
613
-
614
- _this = _super.call(this, props);
615
-
616
- _defineProperty(_assertThisInitialized(_this), "focusSwatch", void 0);
617
-
618
- _defineProperty(_assertThisInitialized(_this), "focusExpandButton", void 0);
619
-
620
- _defineProperty(_assertThisInitialized(_this), "controlledExternally", void 0);
621
-
622
- _defineProperty(_assertThisInitialized(_this), "dropdown", null);
623
-
624
- _defineProperty(_assertThisInitialized(_this), "handleSwatchClick", function (e, _ref) {
625
- var value = _ref.value;
626
- e.preventDefault();
627
- var _this$props = _this.props,
628
- name = _this$props.name,
629
- onChange = _this$props.onChange;
630
-
631
- var prevValue = _this.getValue();
632
-
633
- var hasColorChanged = value !== prevValue;
634
- var displayValue = value === null ? NAUppercase : value;
635
-
636
- if (!_this.isControlled()) {
637
- _this.setState({
638
- value: value
639
- });
640
- }
641
-
642
- _this.setState({
643
- displayValue: displayValue,
644
- open: false
645
- });
646
-
647
- if (hasColorChanged) {
648
- onChange === null || onChange === void 0 ? void 0 : onChange({
649
- value: value,
650
- name: name
651
- });
652
- }
653
-
654
- _this.focus();
655
- });
656
-
657
- _defineProperty(_assertThisInitialized(_this), "handlePaletteExpand", function () {
658
- _this.setState(function (state) {
659
- return {
660
- expanded: !state.expanded
661
- };
662
- });
663
- });
664
-
665
- _defineProperty(_assertThisInitialized(_this), "handleTextChange", function (e, _ref2) {
666
- var value = _ref2.value;
667
-
668
- _this.setState({
669
- displayValue: value
670
- });
671
- });
672
-
673
- _defineProperty(_assertThisInitialized(_this), "handleTextKeyDown", function (e) {
674
- if ((0,keyboard_namespaceObject.keycode)(e.nativeEvent) === 'enter') {
675
- e.preventDefault();
676
-
677
- _this.handleRequestClose({
678
- reason: 'enterKey'
679
- });
680
-
681
- _this.focus();
682
- }
683
- });
684
-
685
- _defineProperty(_assertThisInitialized(_this), "handleButtonClick", function (e) {
686
- e.preventDefault();
687
-
688
- _this.handleRequestClose({
689
- reason: 'buttonClick'
690
- });
691
-
692
- _this.focus();
693
- });
694
-
695
- _defineProperty(_assertThisInitialized(_this), "handleRequestClose", function (_ref3) {
696
- var reason = _ref3.reason;
697
- var displayValue = _this.state.displayValue;
698
- var value = _this.state.value;
699
-
700
- if (toLower_default()(displayValue) === NALowercase) {
701
- displayValue = NAUppercase;
702
-
703
- _this.setState({
704
- displayValue: displayValue
705
- });
706
- } else if (toLower_default()(displayValue) === 'transparent') {
707
- displayValue = 'transparent';
708
-
709
- _this.setState({
710
- displayValue: displayValue
711
- });
712
- } // If the user types in the hexadecimal number without # in front,
713
- // we add # automatically.
714
-
715
-
716
- if (displayValue !== NAUppercase && toLower_default()(displayValue) !== 'transparent' && !startsWith_default()(displayValue, '#')) {
717
- displayValue = "#".concat(displayValue);
718
-
719
- if (reason === 'escapeKey') {
720
- if (value == null) {
721
- _this.setState({
722
- displayValue: NAUppercase
723
- });
724
- } else {
725
- _this.setState({
726
- displayValue: value
727
- });
728
- }
236
+ var X = {
237
+ append: o().bool,
238
+ elementRef: o().oneOfType([ o().func, o().object ]),
239
+ /** @private */
240
+ error: o().bool,
241
+ /** @private */
242
+ noBorder: o().bool,
243
+ /** @private. Call back function when activated. */
244
+ onClick: o().func,
245
+ prepend: o().bool,
246
+ value: o().string,
247
+ /** @private */
248
+ showSelected: o().bool
249
+ };
250
+ var G = n().forwardRef((function(e, t) {
251
+ var r = e.append, a = e.error, o = a === void 0 ? false : a, l = e.onClick, i = e.prepend, s = e.value, u = e.noBorder, p = e.showSelected, c = U(e, [ "append", "error", "onClick", "prepend", "value", "noBorder", "showSelected" ]);
252
+ var d = s === null || s === undefined ? (0, j._)("No color") : s;
253
+ // Only valid hexadecimal strings, 'transparent' and `null` are allowed for background colors
254
+ // Invalid values are converted to `undefined`
255
+ var f = s;
256
+ if (!(typeof f === "string" && ((0, q.isValidHexColor)(f) || f === "transparent")) && f !== null && f !== undefined) {
257
+ f = undefined;
258
+ }
259
+
260
+ return n().createElement(L, Q({
261
+ onClick: function e(t) {
262
+ return l === null || l === void 0 ? void 0 : l(t, {
263
+ value: s
264
+ });
265
+ },
266
+ ref: t,
267
+ $value: f,
268
+ $append: r,
269
+ $prepend: i,
270
+ $hasError: o,
271
+ $noBorder: u,
272
+ $showSelected: p,
273
+ "data-test": "swatch",
274
+ "data-test-value": s
275
+ }, c), p && n().createElement(M, {
276
+ "aria-label": (0, j._)("Selected"),
277
+ role: "presentation"
278
+ }), n().createElement(A(), null, d));
279
+ }));
280
+ G.propTypes = X;
281
+ /* harmony default export */ const J = G;
282
+ // CONCATENATED MODULE: ./src/Color/ColorStyles.ts
283
+ var Y = R().div.withConfig({
284
+ displayName: "ColorStyles__StyledColor",
285
+ componentId: "jxrost-0"
286
+ })([ "", ";flex-direction:row;" ], _.mixins.reset("flex"));
287
+ var Z = R().div.withConfig({
288
+ displayName: "ColorStyles__StyledInput",
289
+ componentId: "jxrost-1"
290
+ })([ "", ";" ], (0, _.pick)({
291
+ enterprise: (0, T.css)([ "display:flex;width:100%;" ]),
292
+ prisma: (0, T.css)([ "position:relative;", "" ], (function(e) {
293
+ var t = e.$inDropdown;
294
+ return t ? (0, T.css)([ "width:80px;" ]) : (0, T.css)([ "flex:0 1 auto;min-width:0;" ]);
295
+ }))
296
+ }));
297
+ var ee = R()(V()).withConfig({
298
+ displayName: "ColorStyles__StyledInputText",
299
+ componentId: "jxrost-2"
300
+ })([ "", "" ], (function(e) {
301
+ var t = e.$inDropdown;
302
+ return t && (0, T.css)([ "font-size:12px;" ]);
303
+ }));
304
+ var te = R()(J).withConfig({
305
+ displayName: "ColorStyles__StyledToggleSwatch",
306
+ componentId: "jxrost-3"
307
+ })([ "", "" ], (0, _.pick)({
308
+ prisma: {
309
+ comfortable: (0, T.css)([ "width:40px;height:40px;" ]),
310
+ compact: (0, T.css)([ "width:32px;height:32px;" ])
311
+ },
312
+ enterprise: {
313
+ comfortable: (0, T.css)([ "width:32px;height:32px;" ]),
314
+ compact: (0, T.css)([ "width:28px;height:28px;" ])
315
+ }
316
+ }));
317
+ // CONCATENATED MODULE: external "@splunk/react-icons/ChevronDown"
318
+ const re = require("@splunk/react-icons/ChevronDown");
319
+ var ne = e.n(re);
320
+ // CONCATENATED MODULE: ./src/Color/PaletteStyles.ts
321
+ var ae = R().div.withConfig({
322
+ displayName: "PaletteStyles__StyledPalette",
323
+ componentId: "qgv9v9-0"
324
+ })([ "width:", ";padding:", ";", "" ], (0, _.pick)({
325
+ enterprise: "180px",
326
+ prisma: "224px"
327
+ }), (0, _.pick)({
328
+ enterprise: _.variables.spacingHalf,
329
+ prisma: "8px"
330
+ }), (0, _.pick)({
331
+ prisma: (0, T.css)([ "display:flex;flex-direction:column;border-radius:2px;" ])
332
+ }));
333
+ var oe = R().ul.withConfig({
334
+ displayName: "PaletteStyles__StyledSwatches",
335
+ componentId: "qgv9v9-1"
336
+ })([ "", ";margin-bottom:", ";margin-right:", ";", "" ], _.mixins.reset("block"), (0,
337
+ _.pick)({
338
+ enterprise: "6px"
339
+ }), (0, _.pick)({
340
+ enterprise: "-6px"
341
+ }), (0, _.pick)({
342
+ prisma: (0, T.css)([ "position:relative;" ])
343
+ }));
344
+ var le = R().li.withConfig({
345
+ displayName: "PaletteStyles__StyledSwatch",
346
+ componentId: "qgv9v9-2"
347
+ })([ "", ";margin-right:", ";margin-bottom:", ";", "" ], _.mixins.reset("inline-block"), (0,
348
+ _.pick)({
349
+ enterprise: _.variables.spacingQuarter,
350
+ prisma: "4px"
351
+ }), (0, _.pick)({
352
+ enterprise: _.variables.spacingQuarter,
353
+ prisma: "4px"
354
+ }), (0, _.pick)({
355
+ prisma: (0, T.css)([ "vertical-align:top;&:nth-child(8n){margin-right:0;}" ])
356
+ }));
357
+ var ie = R().div.withConfig({
358
+ displayName: "PaletteStyles__StyledToolBarPrisma",
359
+ componentId: "qgv9v9-3"
360
+ })([ "position:relative;display:flex;align-items:center;padding:0;margin-top:12px;gap:4px;" ]);
361
+ var se = R()(z()).withConfig({
362
+ displayName: "PaletteStyles__StyledExpandButton",
363
+ componentId: "qgv9v9-4"
364
+ })([ "position:absolute;bottom:4px;right:4px;padding:2px 4px;border-radius:2px;&:focus{box-shadow:", ";}", "" ], _.variables.focusShadow, (function(e) {
365
+ var t = e.$expanded;
366
+ return t && (0, T.css)([ "transform:rotate(180deg);" ]);
367
+ }));
368
+ var ue = R().div.withConfig({
369
+ displayName: "PaletteStyles__StyledSystemColorPickerWrapper",
370
+ componentId: "qgv9v9-5"
371
+ })([ "position:relative;" ]);
372
+ var pe = R().input.withConfig({
373
+ displayName: "PaletteStyles__StyledSystemColorPicker",
374
+ componentId: "qgv9v9-6"
375
+ })([ "box-sizing:border-box;height:24px;width:24px;border:none;border-radius:2px;outline:none;appearance:none;padding:12px;margin:0;background:conic-gradient( #ef3434,#ef9a34,#deef34,#78ef34,#34ef56,#34efbc,#34bcef,#3456ef,#7834ef,#de34ef,#ef349a,#ef3434 );background-repeat:no-repeat;background-position:-6px -6px;background-size:36px 36px;cursor:pointer;&::-webkit-color-swatch{border:none;border-radius:2px;}&::-moz-color-swatch{opacity:0;}&:focus{box-shadow:", ";}" ], _.variables.focusShadow);
376
+ var ce = R()($()).withConfig({
377
+ displayName: "PaletteStyles__StyledCheck",
378
+ componentId: "qgv9v9-7"
379
+ })([ "box-sizing:border-box;color:#d3d3d3;height:100%;width:100%;position:absolute;top:0;left:0;pointer-events:none;" ]);
380
+ // CONCATENATED MODULE: ./src/Color/Palette.tsx
381
+ function de(e) {
382
+ var t = e.expanded, r = e.palette, a = e.value, o = e.swatchToFocusRef, l = e.onSwatchClick, i = e.expandButtonRef, s = e.onPaletteExpand, u = e.onSystemColorPickerChange, p = e.renderInput;
383
+ var d = (0, _.useSplunkTheme)(), f = d.isPrisma, v = d.isLight;
384
+ var h = c()(r.map((function(e) {
385
+ return e && w()(e);
386
+ })), a);
387
+ var y = r.map((function(e, t) {
388
+ var r = e === null ? null : w()(e);
389
+ var i = r === a;
390
+ var s = !h && t === 0 || h && i;
391
+
392
+ return n().createElement(le, {
393
+ key: r || "null"
394
+ }, n().createElement(J, {
395
+ value: r,
396
+ ref: s ? o : null,
397
+ onClick: l,
398
+ noBorder: f,
399
+ showSelected: f && i
400
+ }));
401
+ }));
402
+ if (f) {
403
+ var b = !h && a !== "#ffffff" && a !== "#000000" && a !== null && a !== "";
404
+ var g = y.length === 8 ? 7 : 15;
405
+ var x = m()(y, 0, g);
406
+ var S = m()(y, g);
407
+
408
+ return n().createElement(ae, null, n().createElement("div", {
409
+ style: {
410
+ position: "relative"
411
+ }
412
+ }, n().createElement(oe, null, x, t && S), t && n().createElement(ie, {
413
+ "data-test": "tool-bar"
414
+ }, n().createElement(_.SplunkThemeProvider, {
415
+ density: "compact"
416
+ }, p && p()), n().createElement(J, {
417
+ value: null,
418
+ ref: a === null ? o : null,
419
+ onClick: l,
420
+ noBorder: !v,
421
+ showSelected: a === null
422
+ }), n().createElement(J, {
423
+ value: "#ffffff",
424
+ ref: a === "#ffffff" ? o : null,
425
+ onClick: l,
426
+ noBorder: !v,
427
+ showSelected: a === "#ffffff"
428
+ }), n().createElement(J, {
429
+ value: "#000000",
430
+ ref: a === "#000000" ? o : null,
431
+ onClick: l,
432
+ noBorder: true,
433
+ showSelected: a === "#000000"
434
+ }), n().createElement(ue, null, n().createElement(pe, {
435
+ type: "color",
436
+ value: a === null ? "" : a,
437
+ onChange: u,
438
+ ref: b ? o : null
439
+ }), b && n().createElement(ce, {
440
+ "aria-label": (0, j._)("Selected"),
441
+ role: "presentation"
442
+ }))), n().createElement(se, {
443
+ ref: i,
444
+ $expanded: t,
445
+ onClick: s,
446
+ "data-test": "expand-button"
447
+ }, n().createElement(ne(), null))));
448
+ }
449
+
450
+ return n().createElement(ae, null, n().createElement(oe, null, y), p && p());
451
+ }
452
+ /* harmony default export */ const fe = de;
453
+ // CONCATENATED MODULE: ./src/Color/Color.tsx
454
+ function ve(e) {
455
+ "@babel/helpers - typeof";
456
+ if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
457
+ ve = function e(t) {
458
+ return typeof t;
459
+ };
729
460
  } else {
730
- _this.setState({
731
- displayValue: displayValue
732
- });
461
+ ve = function e(t) {
462
+ return t && typeof Symbol === "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
463
+ };
733
464
  }
734
- }
735
-
736
- if (reason !== 'contentClick') {
737
- _this.setState({
738
- open: false
739
- });
740
- }
741
-
742
- if (reason !== 'escapeKey') {
743
- _this.submitValue(displayValue);
744
- }
745
- });
746
-
747
- _defineProperty(_assertThisInitialized(_this), "handleRequestOpen", function () {
748
- var _this$props2 = _this.props,
749
- splunkTheme = _this$props2.splunkTheme,
750
- palette = _this$props2.palette;
751
- var isPrisma = splunkTheme.isPrisma;
752
-
753
- var value = _this.getValue();
754
-
755
- var displayValue = value === null ? NAUppercase : value;
756
-
757
- _this.setState({
758
- displayValue: displayValue,
759
- open: true
760
- }, function () {
761
- if (_this.focusSwatch.current && _this.focusSwatch.current.focus) {
762
- _this.focusSwatch.current.focus();
465
+ return ve(e);
466
+ }
467
+ function he() {
468
+ he = Object.assign || function(e) {
469
+ for (var t = 1; t < arguments.length; t++) {
470
+ var r = arguments[t];
471
+ for (var n in r) {
472
+ if (Object.prototype.hasOwnProperty.call(r, n)) {
473
+ e[n] = r[n];
474
+ }
475
+ }
476
+ }
477
+ return e;
478
+ };
479
+ return he.apply(this, arguments);
480
+ }
481
+ function ye(e) {
482
+ return xe(e) || ge(e) || be(e) || me();
483
+ }
484
+ function me() {
485
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
486
+ }
487
+ function be(e, t) {
488
+ if (!e) return;
489
+ if (typeof e === "string") return we(e, t);
490
+ var r = Object.prototype.toString.call(e).slice(8, -1);
491
+ if (r === "Object" && e.constructor) r = e.constructor.name;
492
+ if (r === "Map" || r === "Set") return Array.from(e);
493
+ if (r === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)) return we(e, t);
494
+ }
495
+ function ge(e) {
496
+ if (typeof Symbol !== "undefined" && Symbol.iterator in Object(e)) return Array.from(e);
497
+ }
498
+ function xe(e) {
499
+ if (Array.isArray(e)) return we(e);
500
+ }
501
+ function we(e, t) {
502
+ if (t == null || t > e.length) t = e.length;
503
+ for (var r = 0, n = new Array(t); r < t; r++) {
504
+ n[r] = e[r];
763
505
  }
764
- });
765
-
766
- var hidePalette = isPrisma ? slice_default()(palette, 15) : palette;
767
- var isCustomColor = isPrisma && !includes_default()(palette.map(function (c) {
768
- return c && toLower_default()(c);
769
- }), value);
770
- var colorInHiddenPalette = isCustomColor || includes_default()(hidePalette.map(function (c) {
771
- return c && toLower_default()(c);
772
- }), value) || includes_default()(toolPalette, value);
773
-
774
- if (colorInHiddenPalette && !_this.state.expanded) {
775
- _this.setState({
776
- expanded: true
777
- });
778
- }
779
- });
780
-
781
- _defineProperty(_assertThisInitialized(_this), "handleSystemColorPickerChange", debounce_default()(function (value) {
782
- var prevValue = _this.getValue();
783
-
784
- var hasColorChanged = value !== prevValue;
785
- var name = _this.props.name;
786
- var displayValue = value === null ? NAUppercase : value;
787
-
788
- if (!_this.isControlled()) {
789
- _this.setState({
790
- value: value
791
- });
792
- }
793
-
794
- _this.setState({
795
- displayValue: displayValue
796
- });
797
-
798
- if (hasColorChanged) {
799
- var _this$props$onChange, _this$props3;
800
-
801
- (_this$props$onChange = (_this$props3 = _this.props).onChange) === null || _this$props$onChange === void 0 ? void 0 : _this$props$onChange.call(_this$props3, {
802
- value: value,
803
- name: name
804
- });
805
- }
806
-
807
- _this.focus();
808
- }, 200));
809
-
810
- _this.focusSwatch = /*#__PURE__*/external_react_default().createRef();
811
- _this.focusExpandButton = /*#__PURE__*/external_react_default().createRef();
812
- _this.controlledExternally = has_default()(props, 'value'); // value can be hexadecimal color, 'transparent' or null
813
-
814
- var _value = _this.controlledExternally ? (0,color_namespaceObject.expandShortHandHex)(props.value) : (0,color_namespaceObject.expandShortHandHex)(props.defaultValue);
815
-
816
- if (_value !== null) {
817
- _value = toLower_default()(_value);
818
- } // displayValue can be hexadecimal color or 'transparent' to represent 'transparent' or 'N/A' to represent null
819
-
820
-
821
- var _displayValue = _value === null ? NAUppercase : _value;
822
-
823
- _this.state = {
824
- displayValue: _displayValue,
825
- open: false,
826
- value: _value,
827
- expanded: false
828
- };
829
-
830
- if (false) {}
831
-
832
- if (false) { var isDefaultValidHEX; }
833
-
834
- return _this;
835
- }
836
-
837
- _createClass(Color, [{
838
- key: "componentDidUpdate",
839
- value: function componentDidUpdate(prevProps) {
840
- if (false) {}
841
-
842
- if (false) {}
506
+ return n;
843
507
  }
844
- }, {
845
- key: "showNull",
846
- value: function showNull() {
847
- var isPrisma = this.props.splunkTheme.isPrisma;
848
- return Color.hasNull(this.props.palette) || isPrisma;
508
+ function Se(e, t) {
509
+ if (e == null) return {};
510
+ var r = ke(e, t);
511
+ var n, a;
512
+ if (Object.getOwnPropertySymbols) {
513
+ var o = Object.getOwnPropertySymbols(e);
514
+ for (a = 0; a < o.length; a++) {
515
+ n = o[a];
516
+ if (t.indexOf(n) >= 0) continue;
517
+ if (!Object.prototype.propertyIsEnumerable.call(e, n)) continue;
518
+ r[n] = e[n];
519
+ }
520
+ }
521
+ return r;
849
522
  }
850
- /**
851
- * Standardizes the current value of the Color:
852
- * returns based on the input being controlled or uncontrolled
853
- * returns controlled component's value as formatted.
854
- */
855
-
856
- }, {
857
- key: "getValue",
858
- value: function getValue() {
859
- var formatValueForProp = function formatValueForProp(value) {
860
- return value === null ? null : toLower_default()(value);
861
- };
862
-
863
- var sixDigitHex = (0,color_namespaceObject.expandShortHandHex)(this.props.value);
864
-
865
- if (this.props.value === null && !this.showNull()) {
866
- return undefined;
867
- }
868
-
869
- if (this.isControlled()) {
870
- return formatValueForProp(sixDigitHex);
871
- }
872
-
873
- return this.state.value;
523
+ function ke(e, t) {
524
+ if (e == null) return {};
525
+ var r = {};
526
+ var n = Object.keys(e);
527
+ var a, o;
528
+ for (o = 0; o < n.length; o++) {
529
+ a = n[o];
530
+ if (t.indexOf(a) >= 0) continue;
531
+ r[a] = e[a];
532
+ }
533
+ return r;
874
534
  }
875
- }, {
876
- key: "submitValue",
877
- value: function submitValue(displayValue) {
878
- var splunkTheme = this.props.splunkTheme;
879
- var isPrisma = splunkTheme.isPrisma;
880
-
881
- if (displayValue) {
882
- var isValidHEXValue = isValidHEX(displayValue);
883
-
884
- if (!isValidHEXValue && displayValue !== 'transparent' && displayValue !== NAUppercase) {
885
- // eslint-disable-next-line no-console
886
- console.warn("\"".concat(displayValue, "\" is not a valid hex color."));
535
+ function Ce(e, t) {
536
+ if (!(e instanceof t)) {
537
+ throw new TypeError("Cannot call a class as a function");
887
538
  }
888
-
889
- if (isValidHEXValue || Color.hasTransparent(this.props.palette) && displayValue === 'transparent' || (Color.hasNull(this.props.palette) || isPrisma) && displayValue === NAUppercase) {
890
- var formattedDisplayValue = (0,color_namespaceObject.expandShortHandHex)(displayValue);
891
- this.setState({
892
- displayValue: formattedDisplayValue
893
- });
894
- var hasColorChanged = displayValue !== (this.props.value && toLower_default()(this.props.value));
895
- var name = this.props.name;
896
- var value = displayValue === NAUppercase ? null : displayValue;
897
- var formattedValue = (0,color_namespaceObject.expandShortHandHex)(value);
898
-
899
- if (displayValue && !this.isControlled()) {
900
- this.setState({
901
- value: formattedValue
902
- });
903
- }
904
-
905
- if (hasColorChanged) {
906
- var _this$props$onChange2, _this$props4;
907
-
908
- (_this$props$onChange2 = (_this$props4 = this.props).onChange) === null || _this$props$onChange2 === void 0 ? void 0 : _this$props$onChange2.call(_this$props4, {
909
- value: formattedValue,
910
- name: name
911
- });
912
- }
539
+ }
540
+ function Pe(e, t) {
541
+ for (var r = 0; r < t.length; r++) {
542
+ var n = t[r];
543
+ n.enumerable = n.enumerable || false;
544
+ n.configurable = true;
545
+ if ("value" in n) n.writable = true;
546
+ Object.defineProperty(e, n.key, n);
913
547
  }
914
- }
915
548
  }
916
- /**
917
- * Place focus on the input.
918
- */
919
-
920
- }, {
921
- key: "focus",
922
- value: function focus() {
923
- var _this$dropdown;
924
-
925
- (_this$dropdown = this.dropdown) === null || _this$dropdown === void 0 ? void 0 : _this$dropdown.focus();
549
+ function Ee(e, t, r) {
550
+ if (t) Pe(e.prototype, t);
551
+ if (r) Pe(e, r);
552
+ return e;
553
+ }
554
+ function Oe(e, t) {
555
+ if (typeof t !== "function" && t !== null) {
556
+ throw new TypeError("Super expression must either be null or a function");
557
+ }
558
+ e.prototype = Object.create(t && t.prototype, {
559
+ constructor: {
560
+ value: e,
561
+ writable: true,
562
+ configurable: true
563
+ }
564
+ });
565
+ if (t) _e(e, t);
926
566
  }
927
- }, {
928
- key: "isControlled",
929
- value: function isControlled() {
930
- return this.controlledExternally;
567
+ function _e(e, t) {
568
+ _e = Object.setPrototypeOf || function e(t, r) {
569
+ t.__proto__ = r;
570
+ return t;
571
+ };
572
+ return _e(e, t);
931
573
  }
932
- }, {
933
- key: "renderInput",
934
- value: function renderInput(_ref4) {
935
- var textAppend = _ref4.textAppend,
936
- textPrepend = _ref4.textPrepend,
937
- textInline = _ref4.textInline,
938
- inDropdown = _ref4.inDropdown;
939
- var splunkTheme = this.props.splunkTheme;
940
- var displayValue = this.state.displayValue;
941
- var isPrisma = splunkTheme.isPrisma;
942
- var showTransparent = Color.hasTransparent(this.props.palette) && toLower_default()(displayValue) === 'transparent';
943
- var showNullSwatch = this.showNull() && toLower_default()(displayValue) === NALowercase;
944
- var inputSwatchValue = displayValue;
945
-
946
- if (!startsWith_default()(displayValue, '#')) {
947
- inputSwatchValue = "#".concat(displayValue);
948
- }
949
-
950
- inputSwatchValue = showTransparent ? 'transparent' : inputSwatchValue;
951
- inputSwatchValue = showNullSwatch ? null : inputSwatchValue;
952
- return /*#__PURE__*/external_react_default().createElement(StyledInput, {
953
- $inDropdown: inDropdown
954
- }, /*#__PURE__*/external_react_default().createElement(StyledInputText, {
955
- $inDropdown: inDropdown,
956
- append: textAppend,
957
- autoCapitalize: "off",
958
- autoComplete: "off",
959
- autoCorrect: "off",
960
- spellCheck: false,
961
- "aria-label": (0,i18n_namespaceObject._)('Hexadecimal color value'),
962
- prepend: textPrepend,
963
- inline: textInline,
964
- onKeyDown: this.handleTextKeyDown,
965
- onChange: this.handleTextChange,
966
- value: displayValue
967
- }), !isPrisma && /*#__PURE__*/external_react_default().createElement(Color_Swatch, {
968
- "data-test": "textbox-swatch",
969
- onClick: this.handleButtonClick,
970
- value: inputSwatchValue,
971
- tabIndex: -1,
972
- style: {
973
- marginLeft: '1px'
974
- } // Used to cancel out the `margin-right: -1px` of Text append style
975
-
976
- }));
574
+ function qe(e) {
575
+ var t = Te();
576
+ return function r() {
577
+ var n = Re(e), a;
578
+ if (t) {
579
+ var o = Re(this).constructor;
580
+ a = Reflect.construct(n, arguments, o);
581
+ } else {
582
+ a = n.apply(this, arguments);
583
+ }
584
+ return je(this, a);
585
+ };
977
586
  }
978
- }, {
979
- key: "renderPalette",
980
- value: function renderPalette() {
981
- var _this2 = this;
982
-
983
- var _this$props5 = this.props,
984
- splunkTheme = _this$props5.splunkTheme,
985
- palette = _this$props5.palette;
986
- var expanded = this.state.expanded;
987
- var isPrisma = splunkTheme.isPrisma;
988
- return /*#__PURE__*/external_react_default().createElement(Color_Palette, {
989
- palette: palette,
990
- value: this.getValue(),
991
- swatchToFocusRef: this.focusSwatch,
992
- renderInput: function renderInput() {
993
- return isPrisma ? _this2.renderInput({
994
- textAppend: false,
995
- textPrepend: false,
996
- textInline: true,
997
- inDropdown: true
998
- }) : _this2.renderInput({
999
- textAppend: true,
1000
- textPrepend: true,
1001
- textInline: true,
1002
- inDropdown: false
1003
- });
1004
- },
1005
- expandButtonRef: this.focusExpandButton,
1006
- onSwatchClick: this.handleSwatchClick,
1007
- expanded: expanded,
1008
- onPaletteExpand: this.handlePaletteExpand,
1009
- onSystemColorPickerChange: function onSystemColorPickerChange(e) {
1010
- return _this2.handleSystemColorPickerChange(e.target.value);
587
+ function je(e, t) {
588
+ if (t && (ve(t) === "object" || typeof t === "function")) {
589
+ return t;
1011
590
  }
1012
- });
591
+ return Ie(e);
1013
592
  }
1014
- }, {
1015
- key: "render",
1016
- value: function render() {
1017
- var _this3 = this;
1018
-
1019
- var _this$props6 = this.props,
1020
- append = _this$props6.append,
1021
- disabled = _this$props6.disabled,
1022
- describedBy = _this$props6.describedBy,
1023
- elementRef = _this$props6.elementRef,
1024
- error = _this$props6.error,
1025
- hideInput = _this$props6.hideInput,
1026
- labelledBy = _this$props6.labelledBy,
1027
- name = _this$props6.name,
1028
- prepend = _this$props6.prepend,
1029
- splunkTheme = _this$props6.splunkTheme,
1030
- otherProps = Color_objectWithoutProperties(_this$props6, ["append", "disabled", "describedBy", "elementRef", "error", "hideInput", "labelledBy", "name", "prepend", "splunkTheme"]);
1031
-
1032
- var isPrisma = splunkTheme.isPrisma;
1033
- var value = this.getValue();
1034
- var displayValue = this.state.displayValue;
1035
- var toggle = /*#__PURE__*/external_react_default().createElement(StyledToggleSwatch, Color_extends({
1036
- append: isPrisma && !hideInput ? true : append,
1037
- "data-test": "color",
1038
- "data-test-value": displayValue,
1039
- "aria-describedby": describedBy,
1040
- "aria-labelledby": labelledBy,
1041
- "aria-invalid": error || undefined,
1042
- disabled: disabled,
1043
- error: error,
1044
- elementRef: elementRef,
1045
- name: name,
1046
- prepend: prepend,
1047
- value: value
1048
- }, omit_default()(otherProps, [].concat(_toConsumableArray(keys_default()(Color.propTypes)), [// TS: trick omit
1049
- 'onChange']))));
1050
- return /*#__PURE__*/external_react_default().createElement(StyledColor, null, /*#__PURE__*/external_react_default().createElement((Dropdown_default()), {
1051
- closeReasons: ['clickAway', 'escapeKey', 'offScreen', 'toggleClick'],
1052
- onRequestClose: this.handleRequestClose,
1053
- onRequestOpen: this.handleRequestOpen,
1054
- open: this.state.open,
1055
- ref: function ref(c) {
1056
- _this3.dropdown = c;
1057
- },
1058
- retainFocus: true,
1059
- takeFocus: false // Disable the default focus behavior in Dropdown.
1060
- ,
1061
- toggle: toggle
1062
- }, this.renderPalette()), isPrisma && !hideInput && this.renderInput({
1063
- textAppend: false,
1064
- textPrepend: true,
1065
- textInline: true,
1066
- inDropdown: false
1067
- }));
593
+ function Ie(e) {
594
+ if (e === void 0) {
595
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
596
+ }
597
+ return e;
598
+ }
599
+ function Te() {
600
+ if (typeof Reflect === "undefined" || !Reflect.construct) return false;
601
+ if (Reflect.construct.sham) return false;
602
+ if (typeof Proxy === "function") return true;
603
+ try {
604
+ Date.prototype.toString.call(Reflect.construct(Date, [], (function() {})));
605
+ return true;
606
+ } catch (e) {
607
+ return false;
608
+ }
609
+ }
610
+ function Re(e) {
611
+ Re = Object.setPrototypeOf ? Object.getPrototypeOf : function e(t) {
612
+ return t.__proto__ || Object.getPrototypeOf(t);
613
+ };
614
+ return Re(e);
615
+ }
616
+ function Be(e, t, r) {
617
+ if (t in e) {
618
+ Object.defineProperty(e, t, {
619
+ value: r,
620
+ enumerable: true,
621
+ configurable: true,
622
+ writable: true
623
+ });
624
+ } else {
625
+ e[t] = r;
626
+ }
627
+ return e;
1068
628
  }
1069
- }]);
1070
-
1071
- return Color;
1072
- }(external_react_namespaceObject.Component);
1073
-
1074
- _defineProperty(Color, "propTypes", Color_propTypes);
1075
-
1076
- _defineProperty(Color, "defaultProps", defaultProps);
1077
-
1078
- var ColorWithTheme = (0,themes_namespaceObject.withSplunkTheme)(Color);
1079
- ColorWithTheme.propTypes = Color.propTypes;
1080
- // TODO: SUI-2551 Deprecate this in favor of ui-utils implementation
1081
-
1082
- /* harmony default export */ const Color_Color = (ColorWithTheme);
1083
- ;// CONCATENATED MODULE: ./src/Color/index.ts
1084
-
1085
-
1086
- module.exports = __webpack_exports__;
1087
- /******/ })()
1088
- ;
629
+ // The default palette in Prisma theme.
630
+ var Ve = [ "#912344", "#D44C20", "#C0891E", "#26AA92", "#2F8AA7", "#2E49AA", "#602CA1", "#BA4ABD" ];
631
+ var Ne = k()((function(e) {
632
+ var t = [];
633
+ for (var r = 1; r <= e.length * 4; r += 1) {
634
+ var n = e[(r - 1) % e.length];
635
+ if (r > e.length * 3) {
636
+ t.push(n);
637
+ } else {
638
+ var a = 40 - 10 * (r / e.length);
639
+ t.push(P()(n).lighten(a).toString());
640
+ }
641
+ }
642
+ return t;
643
+ }));
644
+ // The tool palette in Prisma theme.
645
+ var Ae = [ "#ffffff", "#000000", null ];
646
+ var De = {
647
+ append: o().bool,
648
+ defaultValue: o().string,
649
+ describedBy: o().string,
650
+ disabled: o().bool,
651
+ elementRef: o().oneOfType([ o().func, o().object ]),
652
+ error: o().bool,
653
+ hideInput: o().bool,
654
+ labelledBy: o().string,
655
+ name: o().string,
656
+ onChange: o().func,
657
+ palette: o().array,
658
+ prepend: o().bool,
659
+ /** @private */
660
+ splunkTheme: o().object,
661
+ value: o().string
662
+ };
663
+ var $e = {
664
+ append: false,
665
+ disabled: false,
666
+ error: false,
667
+ hideInput: false,
668
+ palette: Ne(Ve),
669
+ prepend: false
670
+ };
671
+ // TODO: SUI-2551 Deprecate this in favor of ui-utils implementation
672
+ var He = function e(t) {
673
+ return (0, q.isValidHexColor)(t);
674
+ };
675
+ var ze = "N/A";
676
+ var Ke = "n/a";
677
+ /*
678
+ * When the dropdown opens:
679
+ * 1. If palette contains the color and the color is selected, the dropdown focus the color.
680
+ * 2. If palette doesn't contain the color:
681
+ * 1. If the current theme `family` is `prisma` the input receives focus.
682
+ * 2. Otherwise the first color swatch receives focus.
683
+ */ var Fe = function(e) {
684
+ Oe(r, e);
685
+ var t = qe(r);
686
+ Ee(r, null, [ {
687
+ key: "hasNull",
688
+ // @docs-props-type ColorPropsBase
689
+ value: function e(t) {
690
+ return t.some((function(e) {
691
+ return e === null;
692
+ }));
693
+ }
694
+ }, {
695
+ key: "hasTransparent",
696
+ value: function e(t) {
697
+ return t.some((function(e) {
698
+ return e !== null && w()(e) === "transparent";
699
+ }));
700
+ }
701
+ } ]);
702
+ function r(e) {
703
+ var a;
704
+ Ce(this, r);
705
+ a = t.call(this, e);
706
+ Be(Ie(a), "focusSwatch", void 0);
707
+ Be(Ie(a), "focusExpandButton", void 0);
708
+ Be(Ie(a), "controlledExternally", void 0);
709
+ Be(Ie(a), "dropdown", null);
710
+ Be(Ie(a), "handleSwatchClick", (function(e, t) {
711
+ var r = t.value;
712
+ e.preventDefault();
713
+ var n = a.props, o = n.name, l = n.onChange;
714
+ var i = a.getValue();
715
+ var s = r !== i;
716
+ var u = r === null ? ze : r;
717
+ if (!a.isControlled()) {
718
+ a.setState({
719
+ value: r
720
+ });
721
+ }
722
+ a.setState({
723
+ displayValue: u,
724
+ open: false
725
+ });
726
+ if (s) {
727
+ l === null || l === void 0 ? void 0 : l({
728
+ value: r,
729
+ name: o
730
+ });
731
+ }
732
+ a.focus();
733
+ }));
734
+ Be(Ie(a), "handlePaletteExpand", (function() {
735
+ a.setState((function(e) {
736
+ return {
737
+ expanded: !e.expanded
738
+ };
739
+ }));
740
+ }));
741
+ Be(Ie(a), "handleTextChange", (function(e, t) {
742
+ var r = t.value;
743
+ a.setState({
744
+ displayValue: r
745
+ });
746
+ }));
747
+ Be(Ie(a), "handleTextKeyDown", (function(e) {
748
+ if ((0, I.keycode)(e.nativeEvent) === "enter") {
749
+ e.preventDefault();
750
+ a.handleRequestClose({
751
+ reason: "enterKey"
752
+ });
753
+ a.focus();
754
+ }
755
+ }));
756
+ Be(Ie(a), "handleButtonClick", (function(e) {
757
+ e.preventDefault();
758
+ a.handleRequestClose({
759
+ reason: "buttonClick"
760
+ });
761
+ a.focus();
762
+ }));
763
+ Be(Ie(a), "handleRequestClose", (function(e) {
764
+ var t = e.reason;
765
+ var r = a.state.displayValue;
766
+ var n = a.state.value;
767
+ if (w()(r) === Ke) {
768
+ r = ze;
769
+ a.setState({
770
+ displayValue: r
771
+ });
772
+ } else if (w()(r) === "transparent") {
773
+ r = "transparent";
774
+ a.setState({
775
+ displayValue: r
776
+ });
777
+ }
778
+ // If the user types in the hexadecimal number without # in front,
779
+ // we add # automatically.
780
+ if (r !== ze && w()(r) !== "transparent" && !g()(r, "#")) {
781
+ r = "#".concat(r);
782
+ if (t === "escapeKey") {
783
+ if (n == null) {
784
+ a.setState({
785
+ displayValue: ze
786
+ });
787
+ } else {
788
+ a.setState({
789
+ displayValue: n
790
+ });
791
+ }
792
+ } else {
793
+ a.setState({
794
+ displayValue: r
795
+ });
796
+ }
797
+ }
798
+ if (t !== "contentClick") {
799
+ a.setState({
800
+ open: false
801
+ });
802
+ }
803
+ if (t !== "escapeKey") {
804
+ a.submitValue(r);
805
+ }
806
+ }));
807
+ Be(Ie(a), "handleRequestOpen", (function() {
808
+ var e = a.props, t = e.splunkTheme, r = e.palette;
809
+ var n = t.isPrisma;
810
+ var o = a.getValue();
811
+ var l = o === null ? ze : o;
812
+ a.setState({
813
+ displayValue: l,
814
+ open: true
815
+ }, (function() {
816
+ if (a.focusSwatch.current && a.focusSwatch.current.focus) {
817
+ a.focusSwatch.current.focus();
818
+ }
819
+ }));
820
+ var i = n ? m()(r, 15) : r;
821
+ var s = n && !c()(r.map((function(e) {
822
+ return e && w()(e);
823
+ })), o);
824
+ var u = s || c()(i.map((function(e) {
825
+ return e && w()(e);
826
+ })), o) || c()(Ae, o);
827
+ if (u && !a.state.expanded) {
828
+ a.setState({
829
+ expanded: true
830
+ });
831
+ }
832
+ }));
833
+ Be(Ie(a), "handleSystemColorPickerChange", i()((function(e) {
834
+ var t = a.getValue();
835
+ var r = e !== t;
836
+ var n = a.props.name;
837
+ var o = e === null ? ze : e;
838
+ if (!a.isControlled()) {
839
+ a.setState({
840
+ value: e
841
+ });
842
+ }
843
+ a.setState({
844
+ displayValue: o
845
+ });
846
+ if (r) {
847
+ var l, i;
848
+ (l = (i = a.props).onChange) === null || l === void 0 ? void 0 : l.call(i, {
849
+ value: e,
850
+ name: n
851
+ });
852
+ }
853
+ a.focus();
854
+ }), 200));
855
+ a.focusSwatch = n().createRef();
856
+ a.focusExpandButton = n().createRef();
857
+ a.controlledExternally = u()(e, "value");
858
+ // value can be hexadecimal color, 'transparent' or null
859
+ var o = a.controlledExternally ? (0, q.expandShortHandHex)(e.value) : (0,
860
+ q.expandShortHandHex)(e.defaultValue);
861
+ if (o !== null) {
862
+ o = w()(o);
863
+ }
864
+ // displayValue can be hexadecimal color or 'transparent' to represent 'transparent' or 'N/A' to represent null
865
+ var l = o === null ? ze : o;
866
+ a.state = {
867
+ displayValue: l,
868
+ open: false,
869
+ value: o,
870
+ expanded: false
871
+ };
872
+ if (false) {}
873
+ if (false) {
874
+ var s;
875
+ }
876
+ return a;
877
+ }
878
+ Ee(r, [ {
879
+ key: "componentDidUpdate",
880
+ value: function e(t) {
881
+ if (false) {}
882
+ if (false) {}
883
+ }
884
+ }, {
885
+ key: "showNull",
886
+ value: function e() {
887
+ var t = this.props.splunkTheme.isPrisma;
888
+ return r.hasNull(this.props.palette) || t;
889
+ }
890
+ /**
891
+ * Standardizes the current value of the Color:
892
+ * returns based on the input being controlled or uncontrolled
893
+ * returns controlled component's value as formatted.
894
+ */ }, {
895
+ key: "getValue",
896
+ value: function e() {
897
+ var t = function e(t) {
898
+ return t === null ? null : w()(t);
899
+ };
900
+ var r = (0, q.expandShortHandHex)(this.props.value);
901
+ if (this.props.value === null && !this.showNull()) {
902
+ return undefined;
903
+ }
904
+ if (this.isControlled()) {
905
+ return t(r);
906
+ }
907
+ return this.state.value;
908
+ }
909
+ }, {
910
+ key: "submitValue",
911
+ value: function e(t) {
912
+ var n = this.props.splunkTheme;
913
+ var a = n.isPrisma;
914
+ if (t) {
915
+ var o = He(t);
916
+ if (!o && t !== "transparent" && t !== ze) {
917
+ // eslint-disable-next-line no-console
918
+ console.warn('"'.concat(t, '" is not a valid hex color.'));
919
+ }
920
+ if (o || r.hasTransparent(this.props.palette) && t === "transparent" || (r.hasNull(this.props.palette) || a) && t === ze) {
921
+ var l = (0, q.expandShortHandHex)(t);
922
+ this.setState({
923
+ displayValue: l
924
+ });
925
+ var i = t !== (this.props.value && w()(this.props.value));
926
+ var s = this.props.name;
927
+ var u = t === ze ? null : t;
928
+ var p = (0, q.expandShortHandHex)(u);
929
+ if (t && !this.isControlled()) {
930
+ this.setState({
931
+ value: p
932
+ });
933
+ }
934
+ if (i) {
935
+ var c, d;
936
+ (c = (d = this.props).onChange) === null || c === void 0 ? void 0 : c.call(d, {
937
+ value: p,
938
+ name: s
939
+ });
940
+ }
941
+ }
942
+ }
943
+ }
944
+ /**
945
+ * Place focus on the input.
946
+ */ }, {
947
+ key: "focus",
948
+ value: function e() {
949
+ var t;
950
+ (t = this.dropdown) === null || t === void 0 ? void 0 : t.focus();
951
+ }
952
+ }, {
953
+ key: "isControlled",
954
+ value: function e() {
955
+ return this.controlledExternally;
956
+ }
957
+ }, {
958
+ key: "renderInput",
959
+ value: function e(t) {
960
+ var a = t.textAppend, o = t.textPrepend, l = t.textInline, i = t.inDropdown;
961
+ var s = this.props.splunkTheme;
962
+ var u = this.state.displayValue;
963
+ var p = s.isPrisma;
964
+ var c = r.hasTransparent(this.props.palette) && w()(u) === "transparent";
965
+ var d = this.showNull() && w()(u) === Ke;
966
+ var f = u;
967
+ if (!g()(u, "#")) {
968
+ f = "#".concat(u);
969
+ }
970
+ f = c ? "transparent" : f;
971
+ f = d ? null : f;
972
+
973
+ return n().createElement(Z, {
974
+ $inDropdown: i
975
+ }, n().createElement(ee, {
976
+ $inDropdown: i,
977
+ append: a,
978
+ autoCapitalize: "off",
979
+ autoComplete: "off",
980
+ autoCorrect: "off",
981
+ spellCheck: false,
982
+ "aria-label": (0, j._)("Hexadecimal color value"),
983
+ prepend: o,
984
+ inline: l,
985
+ onKeyDown: this.handleTextKeyDown,
986
+ onChange: this.handleTextChange,
987
+ value: u
988
+ }), !p && n().createElement(J, {
989
+ "data-test": "textbox-swatch",
990
+ onClick: this.handleButtonClick,
991
+ value: f,
992
+ tabIndex: -1,
993
+ style: {
994
+ marginLeft: "1px"
995
+ }
996
+ }));
997
+ }
998
+ }, {
999
+ key: "renderPalette",
1000
+ value: function e() {
1001
+ var t = this;
1002
+ var r = this.props, a = r.splunkTheme, o = r.palette;
1003
+ var l = this.state.expanded;
1004
+ var i = a.isPrisma;
1005
+
1006
+ return n().createElement(fe, {
1007
+ palette: o,
1008
+ value: this.getValue(),
1009
+ swatchToFocusRef: this.focusSwatch,
1010
+ renderInput: function e() {
1011
+ return i ? t.renderInput({
1012
+ textAppend: false,
1013
+ textPrepend: false,
1014
+ textInline: true,
1015
+ inDropdown: true
1016
+ }) : t.renderInput({
1017
+ textAppend: true,
1018
+ textPrepend: true,
1019
+ textInline: true,
1020
+ inDropdown: false
1021
+ });
1022
+ },
1023
+ expandButtonRef: this.focusExpandButton,
1024
+ onSwatchClick: this.handleSwatchClick,
1025
+ expanded: l,
1026
+ onPaletteExpand: this.handlePaletteExpand,
1027
+ onSystemColorPickerChange: function e(r) {
1028
+ return t.handleSystemColorPickerChange(r.target.value);
1029
+ }
1030
+ });
1031
+ }
1032
+ }, {
1033
+ key: "render",
1034
+ value: function e() {
1035
+ var t = this;
1036
+ var a = this.props, o = a.append, l = a.disabled, i = a.describedBy, s = a.elementRef, u = a.error, p = a.hideInput, c = a.labelledBy, d = a.name, v = a.prepend, y = a.splunkTheme, m = Se(a, [ "append", "disabled", "describedBy", "elementRef", "error", "hideInput", "labelledBy", "name", "prepend", "splunkTheme" ]);
1037
+ var b = y.isPrisma;
1038
+ var g = this.getValue();
1039
+ var x = this.state.displayValue;
1040
+ var w = n().createElement(te, he({
1041
+ append: b && !p ? true : o,
1042
+ "data-test": "color",
1043
+ "data-test-value": x,
1044
+ "aria-describedby": i,
1045
+ "aria-labelledby": c,
1046
+ "aria-invalid": u || undefined,
1047
+ disabled: l,
1048
+ error: u,
1049
+ elementRef: s,
1050
+ name: d,
1051
+ prepend: v,
1052
+ value: g
1053
+ }, h()(m, [].concat(ye(f()(r.propTypes)), [ // TS: trick omit
1054
+ "onChange" ]))));
1055
+
1056
+ return n().createElement(Y, null, n().createElement(O(), {
1057
+ closeReasons: [ "clickAway", "escapeKey", "offScreen", "toggleClick" ],
1058
+ onRequestClose: this.handleRequestClose,
1059
+ onRequestOpen: this.handleRequestOpen,
1060
+ open: this.state.open,
1061
+ ref: function e(r) {
1062
+ t.dropdown = r;
1063
+ },
1064
+ retainFocus: true,
1065
+ takeFocus: false,
1066
+ toggle: w
1067
+ }, this.renderPalette()), b && !p && this.renderInput({
1068
+ textAppend: false,
1069
+ textPrepend: true,
1070
+ textInline: true,
1071
+ inDropdown: false
1072
+ }));
1073
+ }
1074
+ } ]);
1075
+ return r;
1076
+ }(r.Component);
1077
+ Be(Fe, "propTypes", De);
1078
+ Be(Fe, "defaultProps", $e);
1079
+ var Me = (0, _.withSplunkTheme)(Fe);
1080
+ Me.propTypes = Fe.propTypes;
1081
+ // TODO: SUI-2551 Deprecate this in favor of ui-utils implementation
1082
+ /* harmony default export */ const Le = Me;
1083
+ // CONCATENATED MODULE: ./src/Color/index.ts
1084
+ module.exports = t;
1085
+ /******/})();