@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/Color.js CHANGED
@@ -1,1088 +1,1088 @@
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 */ Qe,
65
+ defaultPalette: () => /* reexport */ Ne,
66
+ isValidHEX: () => /* reexport */ Fe
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 c = require("lodash/includes");
82
+ var p = e.n(c);
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 m = require("lodash/slice");
91
+ var y = e.n(m);
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 E = e.n(C);
104
+ // CONCATENATED MODULE: external "@splunk/react-ui/Dropdown"
105
+ const P = require("@splunk/react-ui/Dropdown");
106
+ var O = e.n(P);
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 I = require("@splunk/ui-utils/i18n");
113
+ // CONCATENATED MODULE: external "@splunk/ui-utils/keyboard"
114
+ const j = 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 A = require("@splunk/react-ui/ScreenReaderContent");
123
+ var D = e.n(A);
124
+ // CONCATENATED MODULE: external "@splunk/react-icons/Checkmark"
125
+ const N = require("@splunk/react-icons/Checkmark");
126
+ var $ = e.n(N);
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:24px;height:24px;" ])
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 U() {
196
+ U = 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 U.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 W(e, t) {
210
+ if (e == null) return {};
211
+ var r = Q(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 Q(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
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, c = e.showSelected, p = W(e, [ "append", "error", "onClick", "prepend", "value", "noBorder", "showSelected" ]);
252
+ var d = s === null || s === undefined ? (0, I._)("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, U({
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: c,
273
+ "data-test": "swatch",
274
+ "data-test-value": s
275
+ }, p), c && n().createElement(M, {
276
+ "aria-label": (0, I._)("Selected"),
277
+ role: "presentation"
278
+ }), n().createElement(D(), 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()(J).withConfig({
288
+ displayName: "ColorStyles__StyledInputSwatch",
289
+ componentId: "jxrost-1"
290
+ })([ "", "" ], (0, _.pick)({
291
+ compact: (0, T.css)([ "width:28px;height:28px;" ])
292
+ }));
293
+ var ee = R().div.withConfig({
294
+ displayName: "ColorStyles__StyledInput",
295
+ componentId: "jxrost-2"
296
+ })([ "", ";" ], (0, _.pick)({
297
+ enterprise: (0, T.css)([ "display:flex;width:100%;" ]),
298
+ prisma: (0, T.css)([ "position:relative;", "" ], (function(e) {
299
+ var t = e.$inDropdown;
300
+ return t ? (0, T.css)([ "width:80px;" ]) : (0, T.css)([ "flex:0 1 auto;min-width:0;" ]);
301
+ }))
302
+ }));
303
+ var te = R()(V()).withConfig({
304
+ displayName: "ColorStyles__StyledInputText",
305
+ componentId: "jxrost-3"
306
+ })([ "", "" ], (function(e) {
307
+ var t = e.$inDropdown;
308
+ return t && (0, T.css)([ "font-size:12px;" ]);
309
+ }));
310
+ var re = R()(J).withConfig({
311
+ displayName: "ColorStyles__StyledToggleSwatch",
312
+ componentId: "jxrost-4"
313
+ })([ "", "" ], (0, _.pick)({
314
+ prisma: {
315
+ comfortable: (0, T.css)([ "width:40px;height:40px;" ]),
316
+ compact: (0, T.css)([ "width:32px;height:32px;" ])
317
+ },
318
+ enterprise: {
319
+ comfortable: (0, T.css)([ "width:32px;height:32px;" ]),
320
+ compact: (0, T.css)([ "width:28px;height:28px;" ])
321
+ }
322
+ }));
323
+ // CONCATENATED MODULE: external "@splunk/react-icons/ChevronDown"
324
+ const ne = require("@splunk/react-icons/ChevronDown");
325
+ var ae = e.n(ne);
326
+ // CONCATENATED MODULE: external "@splunk/react-ui/Divider"
327
+ const oe = require("@splunk/react-ui/Divider");
328
+ var le = e.n(oe);
329
+ // CONCATENATED MODULE: ./src/Color/PaletteStyles.ts
330
+ var ie = R().div.withConfig({
331
+ displayName: "PaletteStyles__StyledPalette",
332
+ componentId: "qgv9v9-0"
333
+ })([ "width:220px;padding:", ";" ], _.variables.spacingSmall);
334
+ var se = R().ul.withConfig({
335
+ displayName: "PaletteStyles__StyledSwatches",
336
+ componentId: "qgv9v9-1"
337
+ })([ "", ";margin-bottom:", ";" ], _.mixins.reset("block"), _.variables.spacingQuarter);
338
+ var ue = R().li.withConfig({
339
+ displayName: "PaletteStyles__StyledSwatch",
340
+ componentId: "qgv9v9-2"
341
+ })([ "", ";margin-right:4px;margin-bottom:4px;vertical-align:top;", "" ], _.mixins.reset("inline-block"), (0,
342
+ _.pick)({
343
+ enterprise: {
344
+ compact: (0, T.css)([ "&:nth-child(8n){margin-right:0;}" ])
345
+ },
346
+ prisma: (0, T.css)([ "&:nth-child(8n){margin-right:0;}" ])
347
+ }));
348
+ var ce = R().div.withConfig({
349
+ displayName: "PaletteStyles__StyledToolBar",
350
+ componentId: "qgv9v9-3"
351
+ })([ "position:relative;display:flex;align-items:center;padding:0;margin-top:", ";margin-bottom:", ";gap:4px;" ], _.variables.spacingSmall, _.variables.spacingHalf);
352
+ var pe = R()(z()).withConfig({
353
+ displayName: "PaletteStyles__StyledExpandButton",
354
+ componentId: "qgv9v9-4"
355
+ })([ "position:absolute;bottom:4px;right:4px;padding:2px 4px;border-radius:2px;&:focus{box-shadow:", ";}", "" ], _.variables.focusShadow, (function(e) {
356
+ var t = e.$expanded;
357
+ return t && (0, T.css)([ "transform:rotate(180deg);" ]);
358
+ }));
359
+ var de = R().div.withConfig({
360
+ displayName: "PaletteStyles__StyledSystemColorPickerWrapper",
361
+ componentId: "qgv9v9-5"
362
+ })([ "position:relative;" ]);
363
+ var fe = R().input.withConfig({
364
+ displayName: "PaletteStyles__StyledSystemColorPicker",
365
+ componentId: "qgv9v9-6"
366
+ })([ "box-sizing:border-box;", " border:", ";", ";outline:none;appearance:none;padding:1px 10px;", " margin:0;background:conic-gradient( #ef3434,#ef9a34,#deef34,#78ef34,#34ef56,#34efbc,#34bcef,#3456ef,#7834ef,#de34ef,#ef349a,#ef3434 );background-repeat:no-repeat;cursor:pointer;&::-webkit-color-swatch{border:none;border-radius:2px;}&::-moz-color-swatch{opacity:0;}&:focus{box-shadow:", ";}" ], (0,
367
+ _.pick)({
368
+ enterprise: {
369
+ comfortable: (0, T.css)([ "width:32px;height:32px;" ]),
370
+ compact: (0, T.css)([ "width:24px;height:24px;" ])
371
+ },
372
+ prisma: (0, T.css)([ "width:24px;height:24px;" ])
373
+ }), (0, _.pick)({
374
+ enterprise: {
375
+ light: (0, T.css)([ "1px solid ", "" ], _.variables.gray60),
376
+ dark: _.variables.border
377
+ },
378
+ prisma: "none"
379
+ }), (0, _.pick)({
380
+ prisma: (0, T.css)([ "border-radius:2px;" ])
381
+ }), (0, _.pick)({
382
+ enterprise: {
383
+ comfortable: (0, T.css)([ "padding:1px 14px;" ])
384
+ }
385
+ }), _.variables.focusShadow);
386
+ var ve = R()($()).withConfig({
387
+ displayName: "PaletteStyles__StyledCheck",
388
+ componentId: "qgv9v9-7"
389
+ })([ "box-sizing:border-box;color:#d3d3d3;height:100%;width:100%;position:absolute;top:0;left:0;pointer-events:none;" ]);
390
+ // CONCATENATED MODULE: ./src/Color/Palette.tsx
391
+ function he(e) {
392
+ 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, c = e.renderInput;
393
+ var d = (0, _.useSplunkTheme)(), f = d.isPrisma, v = d.isLight;
394
+ var h = p()(r.map((function(e) {
395
+ return e && w()(e);
396
+ })), a);
397
+ var m = r.map((function(e, t) {
398
+ var r = e === null ? null : w()(e);
399
+ var i = r === a;
400
+ var s = !h && t === 0 || h && i;
401
+
402
+ return n().createElement(ue, {
403
+ key: r || "null"
404
+ }, n().createElement(J, {
405
+ value: r,
406
+ ref: s ? o : null,
407
+ onClick: l,
408
+ noBorder: f,
409
+ showSelected: i
410
+ }));
411
+ }));
412
+ var b = function e() {
413
+ var t = !h && a !== "#ffffff" && a !== "#000000" && a !== null && a !== "";
414
+
415
+ return n().createElement(ce, {
416
+ "data-test": "tool-bar"
417
+ }, f && n().createElement(_.SplunkThemeProvider, {
418
+ density: "compact"
419
+ }, c && c()), n().createElement(J, {
420
+ value: null,
421
+ ref: a === null ? o : null,
422
+ onClick: l,
423
+ noBorder: f && !v,
424
+ showSelected: a === null
425
+ }), n().createElement(J, {
426
+ value: "#ffffff",
427
+ ref: a === "#ffffff" ? o : null,
428
+ onClick: l,
429
+ noBorder: f && !v,
430
+ showSelected: a === "#ffffff"
431
+ }), n().createElement(J, {
432
+ value: "#000000",
433
+ ref: a === "#000000" ? o : null,
434
+ onClick: l,
435
+ noBorder: f,
436
+ showSelected: a === "#000000"
437
+ }), n().createElement(de, null, n().createElement(fe, {
438
+ type: "color",
439
+ value: a === null ? "" : a,
440
+ onChange: u,
441
+ ref: t ? o : null
442
+ }), t && n().createElement(ve, {
443
+ "aria-label": (0, I._)("Selected"),
444
+ role: "presentation"
445
+ })));
661
446
  };
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
- }
447
+ var g = m.length === 8 ? 7 : 15;
448
+ var x = y()(m, 0, g);
449
+ var S = y()(m, g);
450
+ if (f) {
451
+
452
+ return n().createElement(ie, null, n().createElement("div", {
453
+ style: {
454
+ position: "relative"
455
+ }
456
+ }, n().createElement(se, null, x, t && S), t && b(), n().createElement(pe, {
457
+ ref: i,
458
+ $expanded: t,
459
+ onClick: s,
460
+ "data-test": "expand-button"
461
+ }, n().createElement(ae(), null))));
462
+ }
463
+
464
+ return n().createElement(ie, null, n().createElement(se, null, m), n().createElement(le(), null), b(), c && c());
465
+ }
466
+ /* harmony default export */ const me = he;
467
+ // CONCATENATED MODULE: ./src/Color/Color.tsx
468
+ function ye(e) {
469
+ "@babel/helpers - typeof";
470
+ if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
471
+ ye = function e(t) {
472
+ return typeof t;
473
+ };
729
474
  } else {
730
- _this.setState({
731
- displayValue: displayValue
732
- });
475
+ ye = function e(t) {
476
+ return t && typeof Symbol === "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
477
+ };
733
478
  }
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();
479
+ return ye(e);
480
+ }
481
+ function be() {
482
+ be = Object.assign || function(e) {
483
+ for (var t = 1; t < arguments.length; t++) {
484
+ var r = arguments[t];
485
+ for (var n in r) {
486
+ if (Object.prototype.hasOwnProperty.call(r, n)) {
487
+ e[n] = r[n];
488
+ }
489
+ }
490
+ }
491
+ return e;
492
+ };
493
+ return be.apply(this, arguments);
494
+ }
495
+ function ge(e) {
496
+ return ke(e) || Se(e) || we(e) || xe();
497
+ }
498
+ function xe() {
499
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
500
+ }
501
+ function we(e, t) {
502
+ if (!e) return;
503
+ if (typeof e === "string") return Ce(e, t);
504
+ var r = Object.prototype.toString.call(e).slice(8, -1);
505
+ if (r === "Object" && e.constructor) r = e.constructor.name;
506
+ if (r === "Map" || r === "Set") return Array.from(e);
507
+ if (r === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)) return Ce(e, t);
508
+ }
509
+ function Se(e) {
510
+ if (typeof Symbol !== "undefined" && Symbol.iterator in Object(e)) return Array.from(e);
511
+ }
512
+ function ke(e) {
513
+ if (Array.isArray(e)) return Ce(e);
514
+ }
515
+ function Ce(e, t) {
516
+ if (t == null || t > e.length) t = e.length;
517
+ for (var r = 0, n = new Array(t); r < t; r++) {
518
+ n[r] = e[r];
763
519
  }
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) {}
520
+ return n;
843
521
  }
844
- }, {
845
- key: "showNull",
846
- value: function showNull() {
847
- var isPrisma = this.props.splunkTheme.isPrisma;
848
- return Color.hasNull(this.props.palette) || isPrisma;
522
+ function Ee(e, t) {
523
+ if (e == null) return {};
524
+ var r = Pe(e, t);
525
+ var n, a;
526
+ if (Object.getOwnPropertySymbols) {
527
+ var o = Object.getOwnPropertySymbols(e);
528
+ for (a = 0; a < o.length; a++) {
529
+ n = o[a];
530
+ if (t.indexOf(n) >= 0) continue;
531
+ if (!Object.prototype.propertyIsEnumerable.call(e, n)) continue;
532
+ r[n] = e[n];
533
+ }
534
+ }
535
+ return r;
849
536
  }
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;
537
+ function Pe(e, t) {
538
+ if (e == null) return {};
539
+ var r = {};
540
+ var n = Object.keys(e);
541
+ var a, o;
542
+ for (o = 0; o < n.length; o++) {
543
+ a = n[o];
544
+ if (t.indexOf(a) >= 0) continue;
545
+ r[a] = e[a];
546
+ }
547
+ return r;
874
548
  }
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."));
549
+ function Oe(e, t) {
550
+ if (!(e instanceof t)) {
551
+ throw new TypeError("Cannot call a class as a function");
887
552
  }
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
- }
553
+ }
554
+ function _e(e, t) {
555
+ for (var r = 0; r < t.length; r++) {
556
+ var n = t[r];
557
+ n.enumerable = n.enumerable || false;
558
+ n.configurable = true;
559
+ if ("value" in n) n.writable = true;
560
+ Object.defineProperty(e, n.key, n);
913
561
  }
914
- }
915
562
  }
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();
563
+ function qe(e, t, r) {
564
+ if (t) _e(e.prototype, t);
565
+ if (r) _e(e, r);
566
+ return e;
567
+ }
568
+ function Ie(e, t) {
569
+ if (typeof t !== "function" && t !== null) {
570
+ throw new TypeError("Super expression must either be null or a function");
571
+ }
572
+ e.prototype = Object.create(t && t.prototype, {
573
+ constructor: {
574
+ value: e,
575
+ writable: true,
576
+ configurable: true
577
+ }
578
+ });
579
+ if (t) je(e, t);
926
580
  }
927
- }, {
928
- key: "isControlled",
929
- value: function isControlled() {
930
- return this.controlledExternally;
581
+ function je(e, t) {
582
+ je = Object.setPrototypeOf || function e(t, r) {
583
+ t.__proto__ = r;
584
+ return t;
585
+ };
586
+ return je(e, t);
931
587
  }
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
- }));
588
+ function Te(e) {
589
+ var t = Ve();
590
+ return function r() {
591
+ var n = Ae(e), a;
592
+ if (t) {
593
+ var o = Ae(this).constructor;
594
+ a = Reflect.construct(n, arguments, o);
595
+ } else {
596
+ a = n.apply(this, arguments);
597
+ }
598
+ return Re(this, a);
599
+ };
977
600
  }
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);
601
+ function Re(e, t) {
602
+ if (t && (ye(t) === "object" || typeof t === "function")) {
603
+ return t;
1011
604
  }
1012
- });
605
+ return Be(e);
1013
606
  }
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
- }));
607
+ function Be(e) {
608
+ if (e === void 0) {
609
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
610
+ }
611
+ return e;
612
+ }
613
+ function Ve() {
614
+ if (typeof Reflect === "undefined" || !Reflect.construct) return false;
615
+ if (Reflect.construct.sham) return false;
616
+ if (typeof Proxy === "function") return true;
617
+ try {
618
+ Date.prototype.toString.call(Reflect.construct(Date, [], (function() {})));
619
+ return true;
620
+ } catch (e) {
621
+ return false;
622
+ }
623
+ }
624
+ function Ae(e) {
625
+ Ae = Object.setPrototypeOf ? Object.getPrototypeOf : function e(t) {
626
+ return t.__proto__ || Object.getPrototypeOf(t);
627
+ };
628
+ return Ae(e);
629
+ }
630
+ function De(e, t, r) {
631
+ if (t in e) {
632
+ Object.defineProperty(e, t, {
633
+ value: r,
634
+ enumerable: true,
635
+ configurable: true,
636
+ writable: true
637
+ });
638
+ } else {
639
+ e[t] = r;
640
+ }
641
+ return e;
1068
642
  }
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
- ;
643
+ // The default palette in Prisma theme.
644
+ var Ne = [ "#912344", "#D44C20", "#C0891E", "#26AA92", "#2F8AA7", "#2E49AA", "#602CA1", "#BA4ABD" ];
645
+ var $e = k()((function(e) {
646
+ var t = [];
647
+ for (var r = 1; r <= e.length * 4; r += 1) {
648
+ var n = e[(r - 1) % e.length];
649
+ if (r > e.length * 3) {
650
+ t.push(n);
651
+ } else {
652
+ var a = 40 - 10 * (r / e.length);
653
+ t.push(E()(n).lighten(a).toString());
654
+ }
655
+ }
656
+ return t;
657
+ }));
658
+ // The tool palette in Prisma theme.
659
+ var He = [ "#ffffff", "#000000", null ];
660
+ var ze = {
661
+ append: o().bool,
662
+ defaultValue: o().string,
663
+ describedBy: o().string,
664
+ disabled: o().bool,
665
+ elementRef: o().oneOfType([ o().func, o().object ]),
666
+ error: o().bool,
667
+ hideInput: o().bool,
668
+ labelledBy: o().string,
669
+ name: o().string,
670
+ onChange: o().func,
671
+ palette: o().array,
672
+ prepend: o().bool,
673
+ /** @private */
674
+ splunkTheme: o().object,
675
+ value: o().string
676
+ };
677
+ var Ke = {
678
+ append: false,
679
+ disabled: false,
680
+ error: false,
681
+ hideInput: false,
682
+ palette: $e(Ne),
683
+ prepend: false
684
+ };
685
+ // TODO: SUI-2551 Deprecate this in favor of ui-utils implementation
686
+ var Fe = function e(t) {
687
+ return (0, q.isValidHexColor)(t);
688
+ };
689
+ var Me = "N/A";
690
+ var Le = "n/a";
691
+ /*
692
+ * When the dropdown opens:
693
+ * 1. If palette contains the color and the color is selected, the dropdown focus the color.
694
+ * 2. If palette doesn't contain the color:
695
+ * 1. If the current theme `family` is `prisma` the input receives focus.
696
+ * 2. Otherwise the first color swatch receives focus.
697
+ */ var Ue = function(e) {
698
+ Ie(r, e);
699
+ var t = Te(r);
700
+ qe(r, null, [ {
701
+ key: "hasNull",
702
+ // @docs-props-type ColorPropsBase
703
+ value: function e(t) {
704
+ return t.some((function(e) {
705
+ return e === null;
706
+ }));
707
+ }
708
+ }, {
709
+ key: "hasTransparent",
710
+ value: function e(t) {
711
+ return t.some((function(e) {
712
+ return e !== null && w()(e) === "transparent";
713
+ }));
714
+ }
715
+ } ]);
716
+ function r(e) {
717
+ var a;
718
+ Oe(this, r);
719
+ a = t.call(this, e);
720
+ De(Be(a), "focusSwatch", void 0);
721
+ De(Be(a), "focusExpandButton", void 0);
722
+ De(Be(a), "controlledExternally", void 0);
723
+ De(Be(a), "dropdown", null);
724
+ De(Be(a), "handleSwatchClick", (function(e, t) {
725
+ var r = t.value;
726
+ e.preventDefault();
727
+ var n = a.props, o = n.name, l = n.onChange;
728
+ var i = a.getValue();
729
+ var s = r !== i;
730
+ var u = r === null ? Me : r;
731
+ if (!a.isControlled()) {
732
+ a.setState({
733
+ value: r
734
+ });
735
+ }
736
+ a.setState({
737
+ displayValue: u,
738
+ open: false
739
+ });
740
+ if (s) {
741
+ l === null || l === void 0 ? void 0 : l({
742
+ value: r,
743
+ name: o
744
+ });
745
+ }
746
+ a.focus();
747
+ }));
748
+ De(Be(a), "handlePaletteExpand", (function() {
749
+ a.setState((function(e) {
750
+ return {
751
+ expanded: !e.expanded
752
+ };
753
+ }));
754
+ }));
755
+ De(Be(a), "handleTextChange", (function(e, t) {
756
+ var r = t.value;
757
+ a.setState({
758
+ displayValue: r
759
+ });
760
+ }));
761
+ De(Be(a), "handleTextKeyDown", (function(e) {
762
+ if ((0, j.keycode)(e.nativeEvent) === "enter") {
763
+ e.preventDefault();
764
+ a.handleRequestClose({
765
+ reason: "enterKey"
766
+ });
767
+ a.focus();
768
+ }
769
+ }));
770
+ De(Be(a), "handleButtonClick", (function(e) {
771
+ e.preventDefault();
772
+ a.handleRequestClose({
773
+ reason: "buttonClick"
774
+ });
775
+ a.focus();
776
+ }));
777
+ De(Be(a), "handleRequestClose", (function(e) {
778
+ var t = e.reason;
779
+ var r = a.state.displayValue;
780
+ var n = a.state.value;
781
+ if (w()(r) === Le) {
782
+ r = Me;
783
+ a.setState({
784
+ displayValue: r
785
+ });
786
+ } else if (w()(r) === "transparent") {
787
+ r = "transparent";
788
+ a.setState({
789
+ displayValue: r
790
+ });
791
+ }
792
+ // If the user types in the hexadecimal number without # in front,
793
+ // we add # automatically.
794
+ if (r !== Me && w()(r) !== "transparent" && !g()(r, "#")) {
795
+ r = "#".concat(r);
796
+ if (t === "escapeKey") {
797
+ if (n == null) {
798
+ a.setState({
799
+ displayValue: Me
800
+ });
801
+ } else {
802
+ a.setState({
803
+ displayValue: n
804
+ });
805
+ }
806
+ } else {
807
+ a.setState({
808
+ displayValue: r
809
+ });
810
+ }
811
+ }
812
+ if (t !== "contentClick") {
813
+ a.setState({
814
+ open: false
815
+ });
816
+ }
817
+ if (t !== "escapeKey") {
818
+ a.submitValue(r);
819
+ }
820
+ }));
821
+ De(Be(a), "handleRequestOpen", (function() {
822
+ var e = a.props, t = e.splunkTheme, r = e.palette;
823
+ var n = t.isPrisma;
824
+ var o = a.getValue();
825
+ var l = o === null ? Me : o;
826
+ a.setState({
827
+ displayValue: l,
828
+ open: true
829
+ }, (function() {
830
+ if (a.focusSwatch.current && a.focusSwatch.current.focus) {
831
+ a.focusSwatch.current.focus();
832
+ }
833
+ }));
834
+ var i = n ? y()(r, 15) : r;
835
+ var s = !p()(r.map((function(e) {
836
+ return e && w()(e);
837
+ })), o);
838
+ var u = s || p()(i.map((function(e) {
839
+ return e && w()(e);
840
+ })), o) || p()(He, o);
841
+ if (u && !a.state.expanded) {
842
+ a.setState({
843
+ expanded: true
844
+ });
845
+ }
846
+ }));
847
+ De(Be(a), "handleSystemColorPickerChange", i()((function(e) {
848
+ var t = a.getValue();
849
+ var r = e !== t;
850
+ var n = a.props.name;
851
+ var o = e === null ? Me : e;
852
+ if (!a.isControlled()) {
853
+ a.setState({
854
+ value: e
855
+ });
856
+ }
857
+ a.setState({
858
+ displayValue: o
859
+ });
860
+ if (r) {
861
+ var l, i;
862
+ (l = (i = a.props).onChange) === null || l === void 0 ? void 0 : l.call(i, {
863
+ value: e,
864
+ name: n
865
+ });
866
+ }
867
+ a.focus();
868
+ }), 200));
869
+ a.focusSwatch = n().createRef();
870
+ a.focusExpandButton = n().createRef();
871
+ a.controlledExternally = u()(e, "value");
872
+ // value can be hexadecimal color, 'transparent' or null
873
+ var o = a.controlledExternally ? (0, q.expandShortHandHex)(e.value) : (0,
874
+ q.expandShortHandHex)(e.defaultValue);
875
+ if (o !== null) {
876
+ o = w()(o);
877
+ }
878
+ // displayValue can be hexadecimal color or 'transparent' to represent 'transparent' or 'N/A' to represent null
879
+ var l = o === null ? Me : o;
880
+ a.state = {
881
+ displayValue: l,
882
+ open: false,
883
+ value: o,
884
+ expanded: false
885
+ };
886
+ if (false) {}
887
+ if (false) {
888
+ var s;
889
+ }
890
+ return a;
891
+ }
892
+ qe(r, [ {
893
+ key: "componentDidUpdate",
894
+ value: function e(t) {
895
+ if (false) {}
896
+ if (false) {}
897
+ }
898
+ /**
899
+ * Standardizes the current value of the Color:
900
+ * returns based on the input being controlled or uncontrolled
901
+ * returns controlled component's value as formatted.
902
+ */ }, {
903
+ key: "getValue",
904
+ value: function e() {
905
+ var t = function e(t) {
906
+ return t === null ? null : w()(t);
907
+ };
908
+ var r = (0, q.expandShortHandHex)(this.props.value);
909
+ if (this.isControlled()) {
910
+ return t(r);
911
+ }
912
+ return this.state.value;
913
+ }
914
+ }, {
915
+ key: "submitValue",
916
+ value: function e(t) {
917
+ if (t) {
918
+ var n = Fe(t);
919
+ if (!n && t !== "transparent" && t !== Me) {
920
+ // eslint-disable-next-line no-console
921
+ console.warn('"'.concat(t, '" is not a valid hex color.'));
922
+ }
923
+ if (n || r.hasTransparent(this.props.palette) && t === "transparent" || t === Me) {
924
+ var a = (0, q.expandShortHandHex)(t);
925
+ this.setState({
926
+ displayValue: a
927
+ });
928
+ var o = t !== (this.props.value && w()(this.props.value));
929
+ var l = this.props.name;
930
+ var i = t === Me ? null : t;
931
+ var s = (0, q.expandShortHandHex)(i);
932
+ if (t && !this.isControlled()) {
933
+ this.setState({
934
+ value: s
935
+ });
936
+ }
937
+ if (o) {
938
+ var u, c;
939
+ (u = (c = this.props).onChange) === null || u === void 0 ? void 0 : u.call(c, {
940
+ value: s,
941
+ name: l
942
+ });
943
+ }
944
+ }
945
+ }
946
+ }
947
+ /**
948
+ * Place focus on the input.
949
+ */ }, {
950
+ key: "focus",
951
+ value: function e() {
952
+ var t;
953
+ (t = this.dropdown) === null || t === void 0 ? void 0 : t.focus();
954
+ }
955
+ }, {
956
+ key: "isControlled",
957
+ value: function e() {
958
+ return this.controlledExternally;
959
+ }
960
+ }, {
961
+ key: "renderInput",
962
+ value: function e(t) {
963
+ var a = t.textAppend, o = t.textPrepend, l = t.textInline, i = t.inDropdown;
964
+ var s = this.props.splunkTheme;
965
+ var u = this.state.displayValue;
966
+ var c = s.isPrisma;
967
+ var p = r.hasTransparent(this.props.palette) && w()(u) === "transparent";
968
+ var d = w()(u) === Le;
969
+ var f = u;
970
+ if (!g()(u, "#")) {
971
+ f = "#".concat(u);
972
+ }
973
+ f = p ? "transparent" : f;
974
+ f = d ? null : f;
975
+
976
+ return n().createElement(ee, {
977
+ $inDropdown: i
978
+ }, n().createElement(te, {
979
+ $inDropdown: i,
980
+ append: a,
981
+ autoCapitalize: "off",
982
+ autoComplete: "off",
983
+ autoCorrect: "off",
984
+ spellCheck: false,
985
+ "aria-label": (0, I._)("Hexadecimal color value"),
986
+ prepend: o,
987
+ inline: l,
988
+ onKeyDown: this.handleTextKeyDown,
989
+ onChange: this.handleTextChange,
990
+ value: u
991
+ }), !c && n().createElement(Z, {
992
+ "data-test": "textbox-swatch",
993
+ onClick: this.handleButtonClick,
994
+ value: f,
995
+ tabIndex: -1,
996
+ style: {
997
+ marginLeft: "1px"
998
+ }
999
+ }));
1000
+ }
1001
+ }, {
1002
+ key: "renderPalette",
1003
+ value: function e() {
1004
+ var t = this;
1005
+ var r = this.props, a = r.splunkTheme, o = r.palette;
1006
+ var l = this.state.expanded;
1007
+ var i = a.isPrisma;
1008
+
1009
+ return n().createElement(me, {
1010
+ palette: o,
1011
+ value: this.getValue(),
1012
+ swatchToFocusRef: this.focusSwatch,
1013
+ renderInput: function e() {
1014
+ return i ? t.renderInput({
1015
+ textAppend: false,
1016
+ textPrepend: false,
1017
+ textInline: true,
1018
+ inDropdown: true
1019
+ }) : t.renderInput({
1020
+ textAppend: true,
1021
+ textPrepend: true,
1022
+ textInline: true,
1023
+ inDropdown: false
1024
+ });
1025
+ },
1026
+ expandButtonRef: this.focusExpandButton,
1027
+ onSwatchClick: this.handleSwatchClick,
1028
+ expanded: l,
1029
+ onPaletteExpand: this.handlePaletteExpand,
1030
+ onSystemColorPickerChange: function e(r) {
1031
+ return t.handleSystemColorPickerChange(r.target.value);
1032
+ }
1033
+ });
1034
+ }
1035
+ }, {
1036
+ key: "render",
1037
+ value: function e() {
1038
+ var t = this;
1039
+ var a = this.props, o = a.append, l = a.disabled, i = a.describedBy, s = a.elementRef, u = a.error, c = a.hideInput, p = a.labelledBy, d = a.name, v = a.prepend, m = a.splunkTheme, y = Ee(a, [ "append", "disabled", "describedBy", "elementRef", "error", "hideInput", "labelledBy", "name", "prepend", "splunkTheme" ]);
1040
+ var b = m.isPrisma;
1041
+ var g = this.getValue();
1042
+ var x = this.state.displayValue;
1043
+ var w = n().createElement(re, be({
1044
+ append: b && !c ? true : o,
1045
+ "data-test": "color",
1046
+ "data-test-value": x,
1047
+ "aria-describedby": i,
1048
+ "aria-labelledby": p,
1049
+ "aria-invalid": u || undefined,
1050
+ disabled: l,
1051
+ error: u,
1052
+ elementRef: s,
1053
+ name: d,
1054
+ prepend: v,
1055
+ value: g
1056
+ }, h()(y, [].concat(ge(f()(r.propTypes)), [ // TS: trick omit
1057
+ "onChange" ]))));
1058
+
1059
+ return n().createElement(Y, null, n().createElement(O(), {
1060
+ closeReasons: [ "clickAway", "escapeKey", "offScreen", "toggleClick" ],
1061
+ onRequestClose: this.handleRequestClose,
1062
+ onRequestOpen: this.handleRequestOpen,
1063
+ open: this.state.open,
1064
+ ref: function e(r) {
1065
+ t.dropdown = r;
1066
+ },
1067
+ retainFocus: true,
1068
+ takeFocus: false,
1069
+ toggle: w
1070
+ }, this.renderPalette()), b && !c && this.renderInput({
1071
+ textAppend: false,
1072
+ textPrepend: true,
1073
+ textInline: true,
1074
+ inDropdown: false
1075
+ }));
1076
+ }
1077
+ } ]);
1078
+ return r;
1079
+ }(r.Component);
1080
+ De(Ue, "propTypes", ze);
1081
+ De(Ue, "defaultProps", Ke);
1082
+ var We = (0, _.withSplunkTheme)(Ue);
1083
+ We.propTypes = Ue.propTypes;
1084
+ // TODO: SUI-2551 Deprecate this in favor of ui-utils implementation
1085
+ /* harmony default export */ const Qe = We;
1086
+ // CONCATENATED MODULE: ./src/Color/index.ts
1087
+ module.exports = t;
1088
+ /******/})();