@splunk/react-ui 4.20.0 → 4.21.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Accordion.js +425 -441
- package/Anchor.js +147 -193
- package/Animation.js +142 -166
- package/AnimationToggle.js +197 -253
- package/Box.js +145 -194
- package/Breadcrumbs.js +288 -298
- package/Button.js +488 -613
- package/ButtonGroup.js +160 -212
- package/ButtonSimple.js +543 -562
- package/CHANGELOG.md +26 -0
- package/Calendar.js +1107 -1195
- package/Card.js +771 -746
- package/CardLayout.js +205 -223
- package/Chip.js +509 -612
- package/Clickable.js +416 -472
- package/CloseButton.js +165 -250
- package/Code.js +1808 -2172
- package/Code.js.LICENSE.txt +8 -0
- package/CollapsiblePanel.js +586 -675
- package/Color.js +1066 -1297
- package/ColumnLayout.js +402 -465
- package/ComboBox.js +892 -969
- package/Concertina.js +998 -963
- package/ControlGroup.js +687 -718
- package/Date.js +567 -697
- package/DefinitionList.js +308 -310
- package/Divider.js +149 -194
- package/Dropdown.js +459 -558
- package/DualListbox.js +1480 -1735
- package/EventListener.js +94 -165
- package/File.js +1051 -1173
- package/FormRows.js +885 -880
- package/Heading.js +216 -263
- package/Image.js +446 -558
- package/JSONTree.js +690 -699
- package/Layer.js +442 -582
- package/Link.js +336 -361
- package/List.js +213 -237
- package/Markdown.js +510 -612
- package/Menu.js +1109 -1331
- package/Message.js +474 -629
- package/MessageBar.js +387 -561
- package/Modal.js +810 -798
- package/ModalLayer.js +326 -343
- package/Monogram.js +308 -368
- package/Multiselect.js +3558 -3998
- package/Number.js +729 -843
- package/Paginator.js +510 -615
- package/Paragraph.js +145 -188
- package/Popover.js +1470 -1693
- package/Progress.js +301 -362
- package/RadioBar.js +610 -651
- package/RadioList.js +483 -544
- package/Resize.js +530 -623
- package/ResultsMenu.js +494 -597
- package/ScreenReaderContent.js +142 -187
- package/Scroll.js +595 -598
- package/ScrollContainerContext.js +197 -278
- package/Search.js +745 -817
- package/Select.js +2441 -2746
- package/SidePanel.js +390 -392
- package/Slider.js +668 -825
- package/SlidingPanels.js +639 -645
- package/SplitButton.js +464 -499
- package/StaticContent.js +161 -217
- package/StepBar.js +386 -466
- package/Switch.js +710 -764
- package/TabBar.js +724 -815
- package/TabLayout.js +406 -438
- package/Table.js +4842 -5121
- package/Text.js +1169 -1351
- package/TextArea.js +1097 -1307
- package/Tooltip.js +624 -721
- package/TransitionOpen.js +489 -546
- package/Typography.js +176 -229
- package/WaitSpinner.js +230 -298
- package/package.json +14 -15
- package/stubs-splunkui.d.ts +4 -1
- package/types/src/ComboBox/Option.d.ts +1 -1
- package/types/src/Concertina/Concertina.d.ts +4 -0
- package/types/src/JSONTree/JSONTreeContext.d.ts +7 -0
- package/types/src/JSONTree/TreeNode.d.ts +5 -0
- package/types/src/Link/Link.d.ts +7 -3
- package/types/src/Link/docs/examples/NewWindow.d.ts +2 -0
- package/types/src/Markdown/Markdown.d.ts +1 -1
- package/types/src/Markdown/renderers/MarkdownHeading.d.ts +1 -1
- package/types/src/Menu/Item.d.ts +1 -1
- package/types/src/Menu/Menu.d.ts +1 -0
- package/types/src/MessageBar/docs/examples/WithActions.d.ts +2 -0
- package/types/src/Multiselect/Option.d.ts +1 -1
- package/types/src/Search/Option.d.ts +1 -1
- package/types/src/Select/Option.d.ts +1 -1
- package/types/src/Select/OptionBase.d.ts +1 -1
- package/types/src/fixtures/FetchOptions.d.ts +2 -8
- package/useForceUpdate.js +112 -146
- package/useKeyPress.js +74 -128
- package/usePrevious.js +65 -129
- package/useRovingFocus.js +122 -218
- package/types/src/Link/docs/examples/NewTab.d.ts +0 -2
- /package/types/src/Table/docs/examples/{DockedHeader.d.ts → DockedHeaderScrollbar.d.ts} +0 -0
- /package/types/src/Table/docs/examples/prisma/{DockedHeader.d.ts → DockedHeaderScrollbar.d.ts} +0 -0
package/Color.js
CHANGED
|
@@ -1,1316 +1,1085 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
/******/
|
|
4
|
-
/******/
|
|
5
|
-
/******/
|
|
6
|
-
/******/
|
|
7
|
-
|
|
8
|
-
/******/
|
|
9
|
-
/******/
|
|
10
|
-
/******/
|
|
11
|
-
/******/
|
|
12
|
-
/******/
|
|
13
|
-
/******/
|
|
14
|
-
/******/
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
/******/
|
|
20
|
-
/******/
|
|
21
|
-
/******/
|
|
22
|
-
/******/
|
|
23
|
-
/******/
|
|
24
|
-
/******/
|
|
25
|
-
/******/
|
|
26
|
-
/******/
|
|
27
|
-
/******/
|
|
28
|
-
/******/
|
|
29
|
-
/******/
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
/******/
|
|
34
|
-
/******/
|
|
35
|
-
/******/
|
|
36
|
-
/******/
|
|
37
|
-
/******/
|
|
38
|
-
/******/
|
|
39
|
-
/******/
|
|
40
|
-
/******/
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
/******/
|
|
44
|
-
/******/
|
|
45
|
-
/******/
|
|
46
|
-
/******/
|
|
47
|
-
/******/
|
|
48
|
-
/******/
|
|
49
|
-
/******/
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
/******/
|
|
53
|
-
/******/
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
/******/
|
|
57
|
-
/******/
|
|
58
|
-
/******/
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
var
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
var
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
var
|
|
192
|
-
|
|
193
|
-
// EXTERNAL MODULE: external "lodash/slice"
|
|
194
|
-
var slice_ = __webpack_require__(108);
|
|
195
|
-
var slice_default = /*#__PURE__*/__webpack_require__.n(slice_);
|
|
196
|
-
|
|
197
|
-
// EXTERNAL MODULE: external "lodash/startsWith"
|
|
198
|
-
var startsWith_ = __webpack_require__(119);
|
|
199
|
-
var startsWith_default = /*#__PURE__*/__webpack_require__.n(startsWith_);
|
|
200
|
-
|
|
201
|
-
// EXTERNAL MODULE: external "lodash/toLower"
|
|
202
|
-
var toLower_ = __webpack_require__(36);
|
|
203
|
-
var toLower_default = /*#__PURE__*/__webpack_require__.n(toLower_);
|
|
204
|
-
|
|
205
|
-
// EXTERNAL MODULE: external "lodash/memoize"
|
|
206
|
-
var memoize_ = __webpack_require__(40);
|
|
207
|
-
var memoize_default = /*#__PURE__*/__webpack_require__.n(memoize_);
|
|
208
|
-
|
|
209
|
-
// EXTERNAL MODULE: external "tinycolor2"
|
|
210
|
-
var external_tinycolor2_ = __webpack_require__(69);
|
|
211
|
-
var external_tinycolor2_default = /*#__PURE__*/__webpack_require__.n(external_tinycolor2_);
|
|
212
|
-
|
|
213
|
-
// EXTERNAL MODULE: external "@splunk/react-ui/Dropdown"
|
|
214
|
-
var Dropdown_ = __webpack_require__(22);
|
|
215
|
-
var Dropdown_default = /*#__PURE__*/__webpack_require__.n(Dropdown_);
|
|
216
|
-
|
|
217
|
-
// EXTERNAL MODULE: external "@splunk/themes"
|
|
218
|
-
var themes_ = __webpack_require__(0);
|
|
219
|
-
|
|
220
|
-
// EXTERNAL MODULE: external "@splunk/ui-utils/color"
|
|
221
|
-
var color_ = __webpack_require__(50);
|
|
222
|
-
|
|
223
|
-
// EXTERNAL MODULE: external "@splunk/ui-utils/i18n"
|
|
224
|
-
var i18n_ = __webpack_require__(4);
|
|
225
|
-
|
|
226
|
-
// EXTERNAL MODULE: external "@splunk/ui-utils/keyboard"
|
|
227
|
-
var keyboard_ = __webpack_require__(7);
|
|
228
|
-
|
|
229
|
-
// EXTERNAL MODULE: external "styled-components"
|
|
230
|
-
var external_styled_components_ = __webpack_require__(3);
|
|
231
|
-
var external_styled_components_default = /*#__PURE__*/__webpack_require__.n(external_styled_components_);
|
|
232
|
-
|
|
233
|
-
// EXTERNAL MODULE: external "@splunk/react-ui/Text"
|
|
234
|
-
var Text_ = __webpack_require__(32);
|
|
235
|
-
var Text_default = /*#__PURE__*/__webpack_require__.n(Text_);
|
|
236
|
-
|
|
237
|
-
// EXTERNAL MODULE: external "@splunk/react-ui/ScreenReaderContent"
|
|
238
|
-
var ScreenReaderContent_ = __webpack_require__(14);
|
|
239
|
-
var ScreenReaderContent_default = /*#__PURE__*/__webpack_require__.n(ScreenReaderContent_);
|
|
240
|
-
|
|
241
|
-
// EXTERNAL MODULE: external "@splunk/react-icons/Checkmark"
|
|
242
|
-
var Checkmark_ = __webpack_require__(78);
|
|
243
|
-
var Checkmark_default = /*#__PURE__*/__webpack_require__.n(Checkmark_);
|
|
244
|
-
|
|
245
|
-
// EXTERNAL MODULE: external "@splunk/react-ui/Clickable"
|
|
246
|
-
var Clickable_ = __webpack_require__(12);
|
|
247
|
-
var Clickable_default = /*#__PURE__*/__webpack_require__.n(Clickable_);
|
|
248
|
-
|
|
249
|
-
// CONCATENATED MODULE: ./src/Color/SwatchStyles.ts
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
var backgroundBlockColor = Object(themes_["pick"])({
|
|
255
|
-
enterprise: themes_["variables"].gray80,
|
|
256
|
-
prisma: 'rgba(0, 0, 0, 0.2)'
|
|
257
|
-
});
|
|
258
|
-
var transparentSwatch = Object(external_styled_components_["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, Object(themes_["pick"])({
|
|
259
|
-
enterprise: 'transparent',
|
|
260
|
-
prisma: themes_["variables"].white
|
|
261
|
-
}));
|
|
262
|
-
var StyledCheck = external_styled_components_default()(Checkmark_default.a).withConfig({
|
|
263
|
-
displayName: "SwatchStyles__StyledCheck",
|
|
264
|
-
componentId: "sc-1wxunhq-0"
|
|
265
|
-
})(["box-sizing:border-box;color:#d3d3d3;height:100%;width:100%;"]);
|
|
266
|
-
var StyledClickable = external_styled_components_default()(Clickable_default.a).withConfig({
|
|
267
|
-
displayName: "SwatchStyles__StyledClickable",
|
|
268
|
-
componentId: "sc-1wxunhq-1"
|
|
269
|
-
})(["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));}", " ", ""], Object(themes_["pick"])({
|
|
270
|
-
enterprise: {
|
|
271
|
-
light: Object(external_styled_components_["css"])(["1px solid ", ""], themes_["variables"].gray60),
|
|
272
|
-
dark: themes_["variables"].border
|
|
273
|
-
},
|
|
274
|
-
prisma: Object(external_styled_components_["css"])(["1px solid ", ""], themes_["variables"].interactiveColorBorder)
|
|
275
|
-
}), Object(themes_["pick"])({
|
|
276
|
-
prisma: Object(external_styled_components_["css"])(["border-radius:2px;"])
|
|
277
|
-
}), function (_ref) {
|
|
278
|
-
var $value = _ref.$value;
|
|
279
|
-
return $value === null && Object(external_styled_components_["css"])(["background-image:linear-gradient( to bottom right,transparent 48%,", ",transparent 52% );", ";"], Object(themes_["pick"])({
|
|
280
|
-
enterprise: '#ed1e24',
|
|
281
|
-
prisma: themes_["variables"].accentColorNegative
|
|
282
|
-
}), Object(themes_["pick"])({
|
|
283
|
-
prisma: Object(external_styled_components_["css"])(["background-color:", ";"], themes_["variables"].white)
|
|
284
|
-
}));
|
|
285
|
-
}, function (_ref2) {
|
|
286
|
-
var $value = _ref2.$value;
|
|
287
|
-
return $value && ($value === 'transparent' ? transparentSwatch : "background-color: ".concat($value));
|
|
288
|
-
}, function (_ref3) {
|
|
289
|
-
var $noBorder = _ref3.$noBorder;
|
|
290
|
-
return $noBorder && Object(external_styled_components_["css"])(["border:none;"]);
|
|
291
|
-
}, themes_["variables"].focusColor, themes_["variables"].focusShadow, Object(themes_["pick"])({
|
|
292
|
-
enterprise: {
|
|
293
|
-
comfortable: Object(external_styled_components_["css"])(["width:32px;height:32px;"]),
|
|
294
|
-
compact: Object(external_styled_components_["css"])(["width:28px;height:28px;"])
|
|
295
|
-
},
|
|
296
|
-
prisma: Object(external_styled_components_["css"])(["width:24px;height:24px;"])
|
|
297
|
-
}), function (_ref4) {
|
|
298
|
-
var $prepend = _ref4.$prepend;
|
|
299
|
-
return $prepend && Object(external_styled_components_["css"])(["border-top-left-radius:0;border-bottom-left-radius:0;"]);
|
|
300
|
-
}, function (_ref5) {
|
|
301
|
-
var $append = _ref5.$append;
|
|
302
|
-
return $append && Object(external_styled_components_["css"])(["margin-right:-1px;border-top-right-radius:0;border-bottom-right-radius:0;border-right:none;"]);
|
|
303
|
-
}, function (_ref6) {
|
|
304
|
-
var $hasError = _ref6.$hasError;
|
|
305
|
-
return $hasError && Object(external_styled_components_["css"])(["box-shadow:inset 0 0 0 2px white;border-color:", ";"], Object(themes_["pick"])({
|
|
306
|
-
enterprise: themes_["variables"].errorColor,
|
|
307
|
-
prisma: themes_["variables"].accentColorNegative
|
|
308
|
-
}));
|
|
309
|
-
}, function (_ref7) {
|
|
310
|
-
var $showSelected = _ref7.$showSelected;
|
|
311
|
-
return $showSelected && Object(external_styled_components_["css"])(["display:flex;align-items:center;justify-content:center;"]);
|
|
312
|
-
});
|
|
313
|
-
|
|
314
|
-
// CONCATENATED MODULE: ./src/Color/Swatch.tsx
|
|
315
|
-
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); }
|
|
316
|
-
|
|
317
|
-
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; }
|
|
318
|
-
|
|
319
|
-
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; }
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
var propTypes = {
|
|
328
|
-
append: external_prop_types_default.a.bool,
|
|
329
|
-
elementRef: external_prop_types_default.a.oneOfType([external_prop_types_default.a.func, external_prop_types_default.a.object]),
|
|
330
|
-
|
|
331
|
-
/** @private */
|
|
332
|
-
error: external_prop_types_default.a.bool,
|
|
333
|
-
|
|
334
|
-
/** @private */
|
|
335
|
-
noBorder: external_prop_types_default.a.bool,
|
|
336
|
-
|
|
337
|
-
/** @private. Call back function when activated. */
|
|
338
|
-
onClick: external_prop_types_default.a.func,
|
|
339
|
-
prepend: external_prop_types_default.a.bool,
|
|
340
|
-
value: external_prop_types_default.a.string,
|
|
341
|
-
|
|
342
|
-
/** @private */
|
|
343
|
-
showSelected: external_prop_types_default.a.bool
|
|
344
|
-
};
|
|
345
|
-
var Swatch = /*#__PURE__*/external_react_default.a.forwardRef(function (_ref, ref) {
|
|
346
|
-
var append = _ref.append,
|
|
347
|
-
_ref$error = _ref.error,
|
|
348
|
-
error = _ref$error === void 0 ? false : _ref$error,
|
|
349
|
-
_onClick = _ref.onClick,
|
|
350
|
-
prepend = _ref.prepend,
|
|
351
|
-
value = _ref.value,
|
|
352
|
-
noBorder = _ref.noBorder,
|
|
353
|
-
showSelected = _ref.showSelected,
|
|
354
|
-
otherProps = _objectWithoutProperties(_ref, ["append", "error", "onClick", "prepend", "value", "noBorder", "showSelected"]);
|
|
355
|
-
|
|
356
|
-
var screenReaderValue = value === null || value === undefined ? Object(i18n_["_"])('No color') : value; // Only valid hexadecimal strings, 'transparent' and `null` are allowed for background colors
|
|
357
|
-
// Invalid values are converted to `undefined`
|
|
358
|
-
|
|
359
|
-
var $value = value;
|
|
360
|
-
|
|
361
|
-
if (!(typeof $value === 'string' && (Object(color_["isValidHexColor"])($value) || $value === 'transparent')) && $value !== null && $value !== undefined) {
|
|
362
|
-
$value = undefined;
|
|
363
|
-
}
|
|
364
|
-
|
|
365
|
-
return /*#__PURE__*/external_react_default.a.createElement(StyledClickable, _extends({
|
|
366
|
-
onClick: function onClick(e) {
|
|
367
|
-
return _onClick === null || _onClick === void 0 ? void 0 : _onClick(e, {
|
|
368
|
-
value: value
|
|
369
|
-
});
|
|
370
|
-
},
|
|
371
|
-
ref: ref,
|
|
372
|
-
$value: $value,
|
|
373
|
-
$append: append,
|
|
374
|
-
$prepend: prepend,
|
|
375
|
-
$hasError: error,
|
|
376
|
-
$noBorder: noBorder,
|
|
377
|
-
$showSelected: showSelected,
|
|
378
|
-
"data-test": "swatch",
|
|
379
|
-
"data-test-value": value
|
|
380
|
-
}, otherProps), showSelected && /*#__PURE__*/external_react_default.a.createElement(StyledCheck, {
|
|
381
|
-
"aria-label": Object(i18n_["_"])('Selected'),
|
|
382
|
-
role: "presentation"
|
|
383
|
-
}), /*#__PURE__*/external_react_default.a.createElement(ScreenReaderContent_default.a, null, screenReaderValue));
|
|
384
|
-
});
|
|
385
|
-
Swatch.propTypes = propTypes;
|
|
386
|
-
/* harmony default export */ var Color_Swatch = (Swatch);
|
|
387
|
-
// CONCATENATED MODULE: ./src/Color/ColorStyles.ts
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
var StyledColor = external_styled_components_default.a.div.withConfig({
|
|
393
|
-
displayName: "ColorStyles__StyledColor",
|
|
394
|
-
componentId: "jxrost-0"
|
|
395
|
-
})(["", ";flex-direction:row;"], themes_["mixins"].reset('flex'));
|
|
396
|
-
var StyledInput = external_styled_components_default.a.div.withConfig({
|
|
397
|
-
displayName: "ColorStyles__StyledInput",
|
|
398
|
-
componentId: "jxrost-1"
|
|
399
|
-
})(["", ";"], Object(themes_["pick"])({
|
|
400
|
-
enterprise: Object(external_styled_components_["css"])(["display:flex;width:100%;"]),
|
|
401
|
-
prisma: Object(external_styled_components_["css"])(["position:relative;", ""], function (_ref) {
|
|
402
|
-
var $inDropdown = _ref.$inDropdown;
|
|
403
|
-
return $inDropdown ? Object(external_styled_components_["css"])(["width:80px;"]) : Object(external_styled_components_["css"])(["flex:0 1 auto;min-width:0;"]);
|
|
404
|
-
})
|
|
405
|
-
}));
|
|
406
|
-
var StyledInputText = external_styled_components_default()(Text_default.a).withConfig({
|
|
407
|
-
displayName: "ColorStyles__StyledInputText",
|
|
408
|
-
componentId: "jxrost-2"
|
|
409
|
-
})(["", ""], function (_ref2) {
|
|
410
|
-
var $inDropdown = _ref2.$inDropdown;
|
|
411
|
-
return $inDropdown && Object(external_styled_components_["css"])(["font-size:12px;"]);
|
|
412
|
-
});
|
|
413
|
-
var StyledToggleSwatch = external_styled_components_default()(Color_Swatch).withConfig({
|
|
414
|
-
displayName: "ColorStyles__StyledToggleSwatch",
|
|
415
|
-
componentId: "jxrost-3"
|
|
416
|
-
})(["", ""], Object(themes_["pick"])({
|
|
417
|
-
prisma: {
|
|
418
|
-
comfortable: Object(external_styled_components_["css"])(["width:40px;height:40px;"]),
|
|
419
|
-
compact: Object(external_styled_components_["css"])(["width:32px;height:32px;"])
|
|
420
|
-
},
|
|
421
|
-
enterprise: {
|
|
422
|
-
comfortable: Object(external_styled_components_["css"])(["width:32px;height:32px;"]),
|
|
423
|
-
compact: Object(external_styled_components_["css"])(["width:28px;height:28px;"])
|
|
424
|
-
}
|
|
425
|
-
}));
|
|
426
|
-
|
|
427
|
-
// EXTERNAL MODULE: external "@splunk/react-icons/ChevronDown"
|
|
428
|
-
var ChevronDown_ = __webpack_require__(129);
|
|
429
|
-
var ChevronDown_default = /*#__PURE__*/__webpack_require__.n(ChevronDown_);
|
|
430
|
-
|
|
431
|
-
// CONCATENATED MODULE: ./src/Color/PaletteStyles.ts
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
var StyledPalette = external_styled_components_default.a.div.withConfig({
|
|
437
|
-
displayName: "PaletteStyles__StyledPalette",
|
|
438
|
-
componentId: "qgv9v9-0"
|
|
439
|
-
})(["width:", ";padding:", ";", ""], Object(themes_["pick"])({
|
|
440
|
-
enterprise: '180px',
|
|
441
|
-
prisma: '224px'
|
|
442
|
-
}), Object(themes_["pick"])({
|
|
443
|
-
enterprise: themes_["variables"].spacingHalf,
|
|
444
|
-
prisma: '8px'
|
|
445
|
-
}), Object(themes_["pick"])({
|
|
446
|
-
prisma: Object(external_styled_components_["css"])(["display:flex;flex-direction:column;border-radius:2px;"])
|
|
447
|
-
}));
|
|
448
|
-
var StyledSwatches = external_styled_components_default.a.ul.withConfig({
|
|
449
|
-
displayName: "PaletteStyles__StyledSwatches",
|
|
450
|
-
componentId: "qgv9v9-1"
|
|
451
|
-
})(["", ";margin-bottom:", ";margin-right:", ";", ""], themes_["mixins"].reset('block'), Object(themes_["pick"])({
|
|
452
|
-
enterprise: '6px'
|
|
453
|
-
}), Object(themes_["pick"])({
|
|
454
|
-
enterprise: '-6px'
|
|
455
|
-
}), Object(themes_["pick"])({
|
|
456
|
-
prisma: Object(external_styled_components_["css"])(["position:relative;"])
|
|
457
|
-
}));
|
|
458
|
-
var StyledSwatch = external_styled_components_default.a.li.withConfig({
|
|
459
|
-
displayName: "PaletteStyles__StyledSwatch",
|
|
460
|
-
componentId: "qgv9v9-2"
|
|
461
|
-
})(["", ";margin-right:", ";margin-bottom:", ";", ""], themes_["mixins"].reset('inline-block'), Object(themes_["pick"])({
|
|
462
|
-
enterprise: themes_["variables"].spacingQuarter,
|
|
463
|
-
prisma: '4px'
|
|
464
|
-
}), Object(themes_["pick"])({
|
|
465
|
-
enterprise: themes_["variables"].spacingQuarter,
|
|
466
|
-
prisma: '4px'
|
|
467
|
-
}), Object(themes_["pick"])({
|
|
468
|
-
prisma: Object(external_styled_components_["css"])(["vertical-align:top;&:nth-child(8n){margin-right:0;}"])
|
|
469
|
-
}));
|
|
470
|
-
var StyledToolBarPrisma = external_styled_components_default.a.div.withConfig({
|
|
471
|
-
displayName: "PaletteStyles__StyledToolBarPrisma",
|
|
472
|
-
componentId: "qgv9v9-3"
|
|
473
|
-
})(["position:relative;display:flex;align-items:center;padding:0;margin-top:12px;gap:4px;"]);
|
|
474
|
-
var StyledExpandButton = external_styled_components_default()(Clickable_default.a).withConfig({
|
|
475
|
-
displayName: "PaletteStyles__StyledExpandButton",
|
|
476
|
-
componentId: "qgv9v9-4"
|
|
477
|
-
})(["position:absolute;bottom:4px;right:4px;padding:2px 4px;border-radius:2px;&:focus{box-shadow:", ";}", ""], themes_["variables"].focusShadow, function (_ref) {
|
|
478
|
-
var $expanded = _ref.$expanded;
|
|
479
|
-
return $expanded && Object(external_styled_components_["css"])(["transform:rotate(180deg);"]);
|
|
480
|
-
});
|
|
481
|
-
var StyledSystemColorPickerWrapper = external_styled_components_default.a.div.withConfig({
|
|
482
|
-
displayName: "PaletteStyles__StyledSystemColorPickerWrapper",
|
|
483
|
-
componentId: "qgv9v9-5"
|
|
484
|
-
})(["position:relative;"]);
|
|
485
|
-
var StyledSystemColorPicker = external_styled_components_default.a.input.withConfig({
|
|
486
|
-
displayName: "PaletteStyles__StyledSystemColorPicker",
|
|
487
|
-
componentId: "qgv9v9-6"
|
|
488
|
-
})(["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_["variables"].focusShadow);
|
|
489
|
-
var PaletteStyles_StyledCheck = external_styled_components_default()(Checkmark_default.a).withConfig({
|
|
490
|
-
displayName: "PaletteStyles__StyledCheck",
|
|
491
|
-
componentId: "qgv9v9-7"
|
|
492
|
-
})(["box-sizing:border-box;color:#d3d3d3;height:100%;width:100%;position:absolute;top:0;left:0;pointer-events:none;"]);
|
|
493
|
-
|
|
494
|
-
// CONCATENATED MODULE: ./src/Color/Palette.tsx
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
function Palette(_ref) {
|
|
506
|
-
var expanded = _ref.expanded,
|
|
507
|
-
palette = _ref.palette,
|
|
508
|
-
value = _ref.value,
|
|
509
|
-
swatchToFocusRef = _ref.swatchToFocusRef,
|
|
510
|
-
onSwatchClick = _ref.onSwatchClick,
|
|
511
|
-
expandButtonRef = _ref.expandButtonRef,
|
|
512
|
-
onPaletteExpand = _ref.onPaletteExpand,
|
|
513
|
-
onSystemColorPickerChange = _ref.onSystemColorPickerChange,
|
|
514
|
-
renderInput = _ref.renderInput;
|
|
515
|
-
|
|
516
|
-
var _useSplunkTheme = Object(themes_["useSplunkTheme"])(),
|
|
517
|
-
isPrisma = _useSplunkTheme.isPrisma,
|
|
518
|
-
isLight = _useSplunkTheme.isLight;
|
|
519
|
-
|
|
520
|
-
var isValueInPalette = includes_default()(palette.map(function (c) {
|
|
521
|
-
return c && toLower_default()(c);
|
|
522
|
-
}), value);
|
|
523
|
-
var swatches = palette.map(function (swatchValue, index) {
|
|
524
|
-
var formattedValue = swatchValue === null ? null : toLower_default()(swatchValue);
|
|
525
|
-
var selected = formattedValue === value;
|
|
526
|
-
var shouldFocus = !isValueInPalette && index === 0 || isValueInPalette && selected;
|
|
527
|
-
return /*#__PURE__*/external_react_default.a.createElement(StyledSwatch, {
|
|
528
|
-
key: formattedValue || 'null'
|
|
529
|
-
}, /*#__PURE__*/external_react_default.a.createElement(Color_Swatch, {
|
|
530
|
-
value: formattedValue,
|
|
531
|
-
ref: shouldFocus ? swatchToFocusRef : null,
|
|
532
|
-
onClick: onSwatchClick,
|
|
533
|
-
noBorder: isPrisma,
|
|
534
|
-
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;" ]);
|
|
535
193
|
}));
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
density: "compact"
|
|
551
|
-
}, renderInput && renderInput()), /*#__PURE__*/external_react_default.a.createElement(Color_Swatch, {
|
|
552
|
-
value: null,
|
|
553
|
-
ref: value === null ? swatchToFocusRef : null,
|
|
554
|
-
onClick: onSwatchClick,
|
|
555
|
-
noBorder: !isLight,
|
|
556
|
-
showSelected: value === null
|
|
557
|
-
}), /*#__PURE__*/external_react_default.a.createElement(Color_Swatch, {
|
|
558
|
-
value: "#ffffff",
|
|
559
|
-
ref: value === '#ffffff' ? swatchToFocusRef : null,
|
|
560
|
-
onClick: onSwatchClick,
|
|
561
|
-
noBorder: !isLight,
|
|
562
|
-
showSelected: value === '#ffffff'
|
|
563
|
-
}), /*#__PURE__*/external_react_default.a.createElement(Color_Swatch, {
|
|
564
|
-
value: "#000000",
|
|
565
|
-
ref: value === '#000000' ? swatchToFocusRef : null,
|
|
566
|
-
onClick: onSwatchClick,
|
|
567
|
-
noBorder: true,
|
|
568
|
-
showSelected: value === '#000000'
|
|
569
|
-
}), /*#__PURE__*/external_react_default.a.createElement(StyledSystemColorPickerWrapper, null, /*#__PURE__*/external_react_default.a.createElement(StyledSystemColorPicker, {
|
|
570
|
-
type: "color" // TODO: SUI-2806 Remove the warning with Prisma null example
|
|
571
|
-
// Warning only exists in Chrome: https://chromium.googlesource.com/chromium/src/+/011c27ced479c76cffd5093ce107082e4da657f3/third_party/blink/renderer/core/html/forms/color_input_type.cc#190
|
|
572
|
-
,
|
|
573
|
-
value: value === null ? '' : value,
|
|
574
|
-
onChange: onSystemColorPickerChange,
|
|
575
|
-
ref: isCustomColor ? swatchToFocusRef : null
|
|
576
|
-
}), isCustomColor && /*#__PURE__*/external_react_default.a.createElement(PaletteStyles_StyledCheck, {
|
|
577
|
-
"aria-label": Object(i18n_["_"])('Selected'),
|
|
578
|
-
role: "presentation"
|
|
579
|
-
}))), /*#__PURE__*/external_react_default.a.createElement(StyledExpandButton, {
|
|
580
|
-
ref: expandButtonRef,
|
|
581
|
-
$expanded: expanded,
|
|
582
|
-
onClick: onPaletteExpand,
|
|
583
|
-
"data-test": "expand-button"
|
|
584
|
-
}, /*#__PURE__*/external_react_default.a.createElement(ChevronDown_default.a, null))));
|
|
585
|
-
}
|
|
586
|
-
|
|
587
|
-
return /*#__PURE__*/external_react_default.a.createElement(StyledPalette, null, /*#__PURE__*/external_react_default.a.createElement(StyledSwatches, null, swatches), renderInput && renderInput());
|
|
588
|
-
}
|
|
589
|
-
|
|
590
|
-
/* harmony default export */ var Color_Palette = (Palette);
|
|
591
|
-
// CONCATENATED MODULE: ./src/Color/Color.tsx
|
|
592
|
-
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); }
|
|
593
|
-
|
|
594
|
-
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); }
|
|
595
|
-
|
|
596
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
597
|
-
|
|
598
|
-
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."); }
|
|
599
|
-
|
|
600
|
-
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); }
|
|
601
|
-
|
|
602
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
|
|
603
|
-
|
|
604
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
605
|
-
|
|
606
|
-
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; }
|
|
607
|
-
|
|
608
|
-
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; }
|
|
609
|
-
|
|
610
|
-
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; }
|
|
611
|
-
|
|
612
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
613
|
-
|
|
614
|
-
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); } }
|
|
615
|
-
|
|
616
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
617
|
-
|
|
618
|
-
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); }
|
|
619
|
-
|
|
620
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
621
|
-
|
|
622
|
-
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); }; }
|
|
623
|
-
|
|
624
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
625
|
-
|
|
626
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
627
|
-
|
|
628
|
-
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; } }
|
|
629
|
-
|
|
630
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
631
|
-
|
|
632
|
-
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; }
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
// The default palette in Prisma theme.
|
|
655
|
-
var defaultPalette = ['#912344', '#D44C20', '#C0891E', '#26AA92', '#2F8AA7', '#2E49AA', '#602CA1', '#BA4ABD'];
|
|
656
|
-
var generatePalette = memoize_default()(function (initialPalette) {
|
|
657
|
-
var palette = [];
|
|
658
|
-
|
|
659
|
-
for (var i = 1; i <= initialPalette.length * 4; i += 1) {
|
|
660
|
-
var baseColor = initialPalette[(i - 1) % initialPalette.length];
|
|
661
|
-
|
|
662
|
-
if (i > initialPalette.length * 3) {
|
|
663
|
-
palette.push(baseColor);
|
|
664
|
-
} else {
|
|
665
|
-
var lightenBy = 40 - 10 * (i / initialPalette.length);
|
|
666
|
-
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);
|
|
667
208
|
}
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
var
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
labelledBy: external_prop_types_default.a.string,
|
|
683
|
-
name: external_prop_types_default.a.string,
|
|
684
|
-
onChange: external_prop_types_default.a.func,
|
|
685
|
-
palette: external_prop_types_default.a.array,
|
|
686
|
-
prepend: external_prop_types_default.a.bool,
|
|
687
|
-
|
|
688
|
-
/** @private */
|
|
689
|
-
splunkTheme: external_prop_types_default.a.object,
|
|
690
|
-
value: external_prop_types_default.a.string
|
|
691
|
-
};
|
|
692
|
-
var defaultProps = {
|
|
693
|
-
append: false,
|
|
694
|
-
disabled: false,
|
|
695
|
-
error: false,
|
|
696
|
-
hideInput: false,
|
|
697
|
-
palette: generatePalette(defaultPalette),
|
|
698
|
-
prepend: false
|
|
699
|
-
};
|
|
700
|
-
|
|
701
|
-
// TODO: SUI-2551 Deprecate this in favor of ui-utils implementation
|
|
702
|
-
var Color_isValidHEX = function isValidHEX(value) {
|
|
703
|
-
return Object(color_["isValidHexColor"])(value);
|
|
704
|
-
};
|
|
705
|
-
|
|
706
|
-
var NAUppercase = 'N/A';
|
|
707
|
-
var NALowercase = 'n/a';
|
|
708
|
-
/*
|
|
709
|
-
* When the dropdown opens:
|
|
710
|
-
* 1. If palette contains the color and the color is selected, the dropdown focus the color.
|
|
711
|
-
* 2. If palette doesn't contain the color:
|
|
712
|
-
* 1. If the current theme `family` is `prisma` the input receives focus.
|
|
713
|
-
* 2. Otherwise the first color swatch receives focus.
|
|
714
|
-
*/
|
|
715
|
-
|
|
716
|
-
var Color_Color = /*#__PURE__*/function (_Component) {
|
|
717
|
-
_inherits(Color, _Component);
|
|
718
|
-
|
|
719
|
-
var _super = _createSuper(Color);
|
|
720
|
-
|
|
721
|
-
_createClass(Color, null, [{
|
|
722
|
-
key: "hasNull",
|
|
723
|
-
// @docs-props-type ColorPropsBase
|
|
724
|
-
value: function hasNull(palette) {
|
|
725
|
-
return palette.some(function (color) {
|
|
726
|
-
return color === null;
|
|
727
|
-
});
|
|
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;
|
|
728
223
|
}
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
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;
|
|
735
235
|
}
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
})
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
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
|
+
};
|
|
858
460
|
} else {
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
461
|
+
ve = function e(t) {
|
|
462
|
+
return t && typeof Symbol === "function" && t.constructor === Symbol && t !== Symbol.prototype ? "symbol" : typeof t;
|
|
463
|
+
};
|
|
862
464
|
}
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
if (
|
|
891
|
-
|
|
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];
|
|
892
505
|
}
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
var hidePalette = isPrisma ? slice_default()(palette, 15) : palette;
|
|
896
|
-
var isCustomColor = isPrisma && !includes_default()(palette.map(function (c) {
|
|
897
|
-
return c && toLower_default()(c);
|
|
898
|
-
}), value);
|
|
899
|
-
var colorInHiddenPalette = isCustomColor || includes_default()(hidePalette.map(function (c) {
|
|
900
|
-
return c && toLower_default()(c);
|
|
901
|
-
}), value) || includes_default()(toolPalette, value);
|
|
902
|
-
|
|
903
|
-
if (colorInHiddenPalette && !_this.state.expanded) {
|
|
904
|
-
_this.setState({
|
|
905
|
-
expanded: true
|
|
906
|
-
});
|
|
907
|
-
}
|
|
908
|
-
});
|
|
909
|
-
|
|
910
|
-
_defineProperty(_assertThisInitialized(_this), "handleSystemColorPickerChange", debounce_default()(function (value) {
|
|
911
|
-
var prevValue = _this.getValue();
|
|
912
|
-
|
|
913
|
-
var hasColorChanged = value !== prevValue;
|
|
914
|
-
var name = _this.props.name;
|
|
915
|
-
var displayValue = value === null ? NAUppercase : value;
|
|
916
|
-
|
|
917
|
-
if (!_this.isControlled()) {
|
|
918
|
-
_this.setState({
|
|
919
|
-
value: value
|
|
920
|
-
});
|
|
921
|
-
}
|
|
922
|
-
|
|
923
|
-
_this.setState({
|
|
924
|
-
displayValue: displayValue
|
|
925
|
-
});
|
|
926
|
-
|
|
927
|
-
if (hasColorChanged) {
|
|
928
|
-
var _this$props$onChange, _this$props3;
|
|
929
|
-
|
|
930
|
-
(_this$props$onChange = (_this$props3 = _this.props).onChange) === null || _this$props$onChange === void 0 ? void 0 : _this$props$onChange.call(_this$props3, {
|
|
931
|
-
value: value,
|
|
932
|
-
name: name
|
|
933
|
-
});
|
|
934
|
-
}
|
|
935
|
-
|
|
936
|
-
_this.focus();
|
|
937
|
-
}, 200));
|
|
938
|
-
|
|
939
|
-
_this.focusSwatch = /*#__PURE__*/external_react_default.a.createRef();
|
|
940
|
-
_this.focusExpandButton = /*#__PURE__*/external_react_default.a.createRef();
|
|
941
|
-
_this.controlledExternally = has_default()(props, 'value'); // value can be hexadecimal color, 'transparent' or null
|
|
942
|
-
|
|
943
|
-
var _value = _this.controlledExternally ? Object(color_["expandShortHandHex"])(props.value) : Object(color_["expandShortHandHex"])(props.defaultValue);
|
|
944
|
-
|
|
945
|
-
if (_value !== null) {
|
|
946
|
-
_value = toLower_default()(_value);
|
|
947
|
-
} // displayValue can be hexadecimal color or 'transparent' to represent 'transparent' or 'N/A' to represent null
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
var _displayValue = _value === null ? NAUppercase : _value;
|
|
951
|
-
|
|
952
|
-
_this.state = {
|
|
953
|
-
displayValue: _displayValue,
|
|
954
|
-
open: false,
|
|
955
|
-
value: _value,
|
|
956
|
-
expanded: false
|
|
957
|
-
};
|
|
958
|
-
|
|
959
|
-
if (false) {}
|
|
960
|
-
|
|
961
|
-
if (false) { var isDefaultValidHEX; }
|
|
962
|
-
|
|
963
|
-
return _this;
|
|
964
|
-
}
|
|
965
|
-
|
|
966
|
-
_createClass(Color, [{
|
|
967
|
-
key: "componentDidUpdate",
|
|
968
|
-
value: function componentDidUpdate(prevProps) {
|
|
969
|
-
if (false) {}
|
|
970
|
-
|
|
971
|
-
if (false) {}
|
|
506
|
+
return n;
|
|
972
507
|
}
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
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;
|
|
978
522
|
}
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
return
|
|
990
|
-
};
|
|
991
|
-
|
|
992
|
-
var sixDigitHex = Object(color_["expandShortHandHex"])(this.props.value);
|
|
993
|
-
|
|
994
|
-
if (this.props.value === null && !this.showNull()) {
|
|
995
|
-
return undefined;
|
|
996
|
-
}
|
|
997
|
-
|
|
998
|
-
if (this.isControlled()) {
|
|
999
|
-
return formatValueForProp(sixDigitHex);
|
|
1000
|
-
}
|
|
1001
|
-
|
|
1002
|
-
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;
|
|
1003
534
|
}
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
var splunkTheme = this.props.splunkTheme;
|
|
1008
|
-
var isPrisma = splunkTheme.isPrisma;
|
|
1009
|
-
|
|
1010
|
-
if (displayValue) {
|
|
1011
|
-
var isValidHEXValue = Color_isValidHEX(displayValue);
|
|
1012
|
-
|
|
1013
|
-
if (!isValidHEXValue && displayValue !== 'transparent' && displayValue !== NAUppercase) {
|
|
1014
|
-
// eslint-disable-next-line no-console
|
|
1015
|
-
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");
|
|
1016
538
|
}
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
var value = displayValue === NAUppercase ? null : displayValue;
|
|
1026
|
-
var formattedValue = Object(color_["expandShortHandHex"])(value);
|
|
1027
|
-
|
|
1028
|
-
if (displayValue && !this.isControlled()) {
|
|
1029
|
-
this.setState({
|
|
1030
|
-
value: formattedValue
|
|
1031
|
-
});
|
|
1032
|
-
}
|
|
1033
|
-
|
|
1034
|
-
if (hasColorChanged) {
|
|
1035
|
-
var _this$props$onChange2, _this$props4;
|
|
1036
|
-
|
|
1037
|
-
(_this$props$onChange2 = (_this$props4 = this.props).onChange) === null || _this$props$onChange2 === void 0 ? void 0 : _this$props$onChange2.call(_this$props4, {
|
|
1038
|
-
value: formattedValue,
|
|
1039
|
-
name: name
|
|
1040
|
-
});
|
|
1041
|
-
}
|
|
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);
|
|
1042
547
|
}
|
|
1043
|
-
}
|
|
1044
548
|
}
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
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);
|
|
1055
566
|
}
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
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);
|
|
1060
573
|
}
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
var inputSwatchValue = displayValue;
|
|
1074
|
-
|
|
1075
|
-
if (!startsWith_default()(displayValue, '#')) {
|
|
1076
|
-
inputSwatchValue = "#".concat(displayValue);
|
|
1077
|
-
}
|
|
1078
|
-
|
|
1079
|
-
inputSwatchValue = showTransparent ? 'transparent' : inputSwatchValue;
|
|
1080
|
-
inputSwatchValue = showNullSwatch ? null : inputSwatchValue;
|
|
1081
|
-
return /*#__PURE__*/external_react_default.a.createElement(StyledInput, {
|
|
1082
|
-
$inDropdown: inDropdown
|
|
1083
|
-
}, /*#__PURE__*/external_react_default.a.createElement(StyledInputText, {
|
|
1084
|
-
$inDropdown: inDropdown,
|
|
1085
|
-
append: textAppend,
|
|
1086
|
-
autoCapitalize: "off",
|
|
1087
|
-
autoComplete: "off",
|
|
1088
|
-
autoCorrect: "off",
|
|
1089
|
-
spellCheck: false,
|
|
1090
|
-
"aria-label": Object(i18n_["_"])('Hexadecimal color value'),
|
|
1091
|
-
prepend: textPrepend,
|
|
1092
|
-
inline: textInline,
|
|
1093
|
-
onKeyDown: this.handleTextKeyDown,
|
|
1094
|
-
onChange: this.handleTextChange,
|
|
1095
|
-
value: displayValue
|
|
1096
|
-
}), !isPrisma && /*#__PURE__*/external_react_default.a.createElement(Color_Swatch, {
|
|
1097
|
-
"data-test": "textbox-swatch",
|
|
1098
|
-
onClick: this.handleButtonClick,
|
|
1099
|
-
value: inputSwatchValue,
|
|
1100
|
-
tabIndex: -1,
|
|
1101
|
-
style: {
|
|
1102
|
-
marginLeft: '1px'
|
|
1103
|
-
} // Used to cancel out the `margin-right: -1px` of Text append style
|
|
1104
|
-
|
|
1105
|
-
}));
|
|
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
|
+
};
|
|
1106
586
|
}
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
var _this2 = this;
|
|
1111
|
-
|
|
1112
|
-
var _this$props5 = this.props,
|
|
1113
|
-
splunkTheme = _this$props5.splunkTheme,
|
|
1114
|
-
palette = _this$props5.palette;
|
|
1115
|
-
var expanded = this.state.expanded;
|
|
1116
|
-
var isPrisma = splunkTheme.isPrisma;
|
|
1117
|
-
return /*#__PURE__*/external_react_default.a.createElement(Color_Palette, {
|
|
1118
|
-
palette: palette,
|
|
1119
|
-
value: this.getValue(),
|
|
1120
|
-
swatchToFocusRef: this.focusSwatch,
|
|
1121
|
-
renderInput: function renderInput() {
|
|
1122
|
-
return isPrisma ? _this2.renderInput({
|
|
1123
|
-
textAppend: false,
|
|
1124
|
-
textPrepend: false,
|
|
1125
|
-
textInline: true,
|
|
1126
|
-
inDropdown: true
|
|
1127
|
-
}) : _this2.renderInput({
|
|
1128
|
-
textAppend: true,
|
|
1129
|
-
textPrepend: true,
|
|
1130
|
-
textInline: true,
|
|
1131
|
-
inDropdown: false
|
|
1132
|
-
});
|
|
1133
|
-
},
|
|
1134
|
-
expandButtonRef: this.focusExpandButton,
|
|
1135
|
-
onSwatchClick: this.handleSwatchClick,
|
|
1136
|
-
expanded: expanded,
|
|
1137
|
-
onPaletteExpand: this.handlePaletteExpand,
|
|
1138
|
-
onSystemColorPickerChange: function onSystemColorPickerChange(e) {
|
|
1139
|
-
return _this2.handleSystemColorPickerChange(e.target.value);
|
|
587
|
+
function je(e, t) {
|
|
588
|
+
if (t && (ve(t) === "object" || typeof t === "function")) {
|
|
589
|
+
return t;
|
|
1140
590
|
}
|
|
1141
|
-
|
|
591
|
+
return Ie(e);
|
|
1142
592
|
}
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
'onChange']))));
|
|
1179
|
-
return /*#__PURE__*/external_react_default.a.createElement(StyledColor, null, /*#__PURE__*/external_react_default.a.createElement(Dropdown_default.a, {
|
|
1180
|
-
closeReasons: ['clickAway', 'escapeKey', 'offScreen', 'toggleClick'],
|
|
1181
|
-
onRequestClose: this.handleRequestClose,
|
|
1182
|
-
onRequestOpen: this.handleRequestOpen,
|
|
1183
|
-
open: this.state.open,
|
|
1184
|
-
ref: function ref(c) {
|
|
1185
|
-
_this3.dropdown = c;
|
|
1186
|
-
},
|
|
1187
|
-
retainFocus: true,
|
|
1188
|
-
takeFocus: false // Disable the default focus behavior in Dropdown.
|
|
1189
|
-
,
|
|
1190
|
-
toggle: toggle
|
|
1191
|
-
}, this.renderPalette()), isPrisma && !hideInput && this.renderInput({
|
|
1192
|
-
textAppend: false,
|
|
1193
|
-
textPrepend: true,
|
|
1194
|
-
textInline: true,
|
|
1195
|
-
inDropdown: false
|
|
1196
|
-
}));
|
|
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;
|
|
1197
628
|
}
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
var
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
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
|
+
/******/})();
|