@zendeskgarden/react-colorpickers 8.57.0 → 8.58.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs.js CHANGED
@@ -50,192 +50,55 @@ var throttle__default = /*#__PURE__*/_interopDefaultLegacy(throttle);
50
50
  var styled__default = /*#__PURE__*/_interopDefaultLegacy(styled);
51
51
  var isEqual__default = /*#__PURE__*/_interopDefaultLegacy(isEqual);
52
52
 
53
- function ownKeys(object, enumerableOnly) {
54
- var keys = Object.keys(object);
55
-
56
- if (Object.getOwnPropertySymbols) {
57
- var symbols = Object.getOwnPropertySymbols(object);
58
- enumerableOnly && (symbols = symbols.filter(function (sym) {
59
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
60
- })), keys.push.apply(keys, symbols);
61
- }
62
-
63
- return keys;
64
- }
65
-
66
- function _objectSpread2(target) {
67
- for (var i = 1; i < arguments.length; i++) {
68
- var source = null != arguments[i] ? arguments[i] : {};
69
- i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
70
- _defineProperty(target, key, source[key]);
71
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
72
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
73
- });
74
- }
75
-
76
- return target;
77
- }
78
-
79
- function _defineProperty(obj, key, value) {
80
- if (key in obj) {
81
- Object.defineProperty(obj, key, {
82
- value: value,
83
- enumerable: true,
84
- configurable: true,
85
- writable: true
86
- });
87
- } else {
88
- obj[key] = value;
89
- }
90
-
91
- return obj;
92
- }
93
-
94
53
  function _extends$2() {
95
54
  _extends$2 = Object.assign ? Object.assign.bind() : function (target) {
96
55
  for (var i = 1; i < arguments.length; i++) {
97
56
  var source = arguments[i];
98
-
99
57
  for (var key in source) {
100
58
  if (Object.prototype.hasOwnProperty.call(source, key)) {
101
59
  target[key] = source[key];
102
60
  }
103
61
  }
104
62
  }
105
-
106
63
  return target;
107
64
  };
108
65
  return _extends$2.apply(this, arguments);
109
66
  }
110
67
 
111
- function _objectWithoutPropertiesLoose(source, excluded) {
112
- if (source == null) return {};
113
- var target = {};
114
- var sourceKeys = Object.keys(source);
115
- var key, i;
116
-
117
- for (i = 0; i < sourceKeys.length; i++) {
118
- key = sourceKeys[i];
119
- if (excluded.indexOf(key) >= 0) continue;
120
- target[key] = source[key];
121
- }
122
-
123
- return target;
124
- }
125
-
126
- function _objectWithoutProperties(source, excluded) {
127
- if (source == null) return {};
128
-
129
- var target = _objectWithoutPropertiesLoose(source, excluded);
130
-
131
- var key, i;
132
-
133
- if (Object.getOwnPropertySymbols) {
134
- var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
135
-
136
- for (i = 0; i < sourceSymbolKeys.length; i++) {
137
- key = sourceSymbolKeys[i];
138
- if (excluded.indexOf(key) >= 0) continue;
139
- if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
140
- target[key] = source[key];
141
- }
142
- }
143
-
144
- return target;
145
- }
146
-
147
- function _slicedToArray(arr, i) {
148
- return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
149
- }
150
-
151
- function _arrayWithHoles(arr) {
152
- if (Array.isArray(arr)) return arr;
153
- }
154
-
155
- function _iterableToArrayLimit(arr, i) {
156
- var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
157
-
158
- if (_i == null) return;
159
- var _arr = [];
160
- var _n = true;
161
- var _d = false;
162
-
163
- var _s, _e;
164
-
165
- try {
166
- for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
167
- _arr.push(_s.value);
168
-
169
- if (i && _arr.length === i) break;
170
- }
171
- } catch (err) {
172
- _d = true;
173
- _e = err;
174
- } finally {
175
- try {
176
- if (!_n && _i["return"] != null) _i["return"]();
177
- } finally {
178
- if (_d) throw _e;
179
- }
180
- }
181
-
182
- return _arr;
183
- }
184
-
185
- function _unsupportedIterableToArray(o, minLen) {
186
- if (!o) return;
187
- if (typeof o === "string") return _arrayLikeToArray(o, minLen);
188
- var n = Object.prototype.toString.call(o).slice(8, -1);
189
- if (n === "Object" && o.constructor) n = o.constructor.name;
190
- if (n === "Map" || n === "Set") return Array.from(o);
191
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
192
- }
193
-
194
- function _arrayLikeToArray(arr, len) {
195
- if (len == null || len > arr.length) len = arr.length;
196
-
197
- for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
198
-
199
- return arr2;
200
- }
201
-
202
- function _nonIterableRest() {
203
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
204
- }
205
-
206
68
  function hslToHsv(h, s, l) {
207
- var saturation = s;
69
+ let saturation = s;
208
70
  saturation *= (l < 50 ? l : 100 - l) / 100;
209
- var v = l + saturation;
71
+ const v = l + saturation;
210
72
  return {
211
- h: h,
73
+ h,
212
74
  s: v === 0 ? 0 : 2 * saturation / v * 100,
213
- v: v
75
+ v
214
76
  };
215
77
  }
216
78
  function hsvToHsl(h, s, v) {
217
- var saturation = s;
218
- var value = v;
79
+ let saturation = s;
80
+ let value = v;
219
81
  saturation /= 100;
220
82
  value /= 100;
221
- var l = (2 - saturation) * value;
222
- var sl = saturation * value;
83
+ let l = (2 - saturation) * value;
84
+ let sl = saturation * value;
223
85
  sl /= l <= 1 ? l : 2 - l;
224
86
  sl = sl || 0;
225
87
  l /= 2;
226
88
  return {
227
- h: h,
89
+ h,
228
90
  s: sl * 100,
229
91
  l: l * 100
230
92
  };
231
93
  }
232
94
 
233
- var getSaturationLightness = function getSaturationLightness(element, x, y, rtl) {
234
- var _element$getBoundingC = element.getBoundingClientRect(),
235
- width = _element$getBoundingC.width,
236
- height = _element$getBoundingC.height;
237
- var left = x - (element.getBoundingClientRect().left + window.pageXOffset);
238
- var top = y - (element.getBoundingClientRect().top + window.pageYOffset);
95
+ const getSaturationLightness = (element, x, y, rtl) => {
96
+ const {
97
+ width,
98
+ height
99
+ } = element.getBoundingClientRect();
100
+ let left = x - (element.getBoundingClientRect().left + window.pageXOffset);
101
+ let top = y - (element.getBoundingClientRect().top + window.pageYOffset);
239
102
  if (left < 0) {
240
103
  left = 0;
241
104
  } else if (left > width) {
@@ -249,33 +112,35 @@ var getSaturationLightness = function getSaturationLightness(element, x, y, rtl)
249
112
  if (rtl) {
250
113
  left = width - left;
251
114
  }
252
- var saturation = left / width;
253
- var bright = 1 - top / height;
115
+ const saturation = left / width;
116
+ const bright = 1 - top / height;
254
117
  return {
255
- saturation: saturation,
256
- bright: bright
118
+ saturation,
119
+ bright
257
120
  };
258
121
  };
259
122
  function getNextHsv(e, hue, container, rtl) {
260
- var _getSaturationLightne = getSaturationLightness(container, e.pageX, e.pageY, rtl),
261
- saturation = _getSaturationLightne.saturation,
262
- bright = _getSaturationLightne.bright;
123
+ const {
124
+ saturation,
125
+ bright
126
+ } = getSaturationLightness(container, e.pageX, e.pageY, rtl);
263
127
  return {
264
128
  h: hue,
265
129
  s: saturation,
266
130
  v: bright
267
131
  };
268
132
  }
269
- var getThumbPosition = function getThumbPosition(x, y, rtl, container) {
133
+ const getThumbPosition = (x, y, rtl, container) => {
270
134
  if (container.current) {
271
- var _getSaturationLightne2 = getSaturationLightness(container.current, x, y, rtl),
272
- saturation = _getSaturationLightne2.saturation,
273
- bright = _getSaturationLightne2.bright;
274
- var topFromMouse = (1 - bright) * 100;
275
- var leftFromMouse = rtl ? 100 - saturation * 100 : saturation * 100;
135
+ const {
136
+ saturation,
137
+ bright
138
+ } = getSaturationLightness(container.current, x, y, rtl);
139
+ const topFromMouse = (1 - bright) * 100;
140
+ const leftFromMouse = rtl ? 100 - saturation * 100 : saturation * 100;
276
141
  return {
277
- topFromMouse: topFromMouse,
278
- leftFromMouse: leftFromMouse
142
+ topFromMouse,
143
+ leftFromMouse
279
144
  };
280
145
  }
281
146
  return {
@@ -284,137 +149,208 @@ var getThumbPosition = function getThumbPosition(x, y, rtl, container) {
284
149
  };
285
150
  };
286
151
 
287
- var COMPONENT_ID$l = 'colorpickers.colorpicker';
288
- var getColorPickerWidth = function getColorPickerWidth(props) {
152
+ const COMPONENT_ID$l = 'colorpickers.colorpicker';
153
+ const getColorPickerWidth = props => {
289
154
  return props.isOpaque ? 268 : 312;
290
155
  };
291
- var StyledColorPicker = styled__default["default"].div.attrs({
156
+ const StyledColorPicker = styled__default["default"].div.attrs({
292
157
  'data-garden-id': COMPONENT_ID$l,
293
- 'data-garden-version': '8.57.0'
158
+ 'data-garden-version': '8.58.0'
294
159
  }).withConfig({
295
160
  displayName: "StyledColorPicker",
296
161
  componentId: "sc-1donyl9-0"
297
- })(["width:", "px;min-width:", "px;", ";"], getColorPickerWidth, getColorPickerWidth, function (props) {
298
- return reactTheming.retrieveComponentStyles(COMPONENT_ID$l, props);
299
- });
162
+ })(["width:", "px;min-width:", "px;", ";"], getColorPickerWidth, getColorPickerWidth, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$l, props));
300
163
  StyledColorPicker.defaultProps = {
301
164
  theme: reactTheming.DEFAULT_THEME
302
165
  };
303
166
 
304
- var COMPONENT_ID$k = 'colorpickers.colorpicker_range';
305
- var thumbStyles = function thumbStyles(styles) {
306
- var modifier = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
307
- return "\n &".concat(modifier, "::-moz-range-thumb {\n ").concat(styles, "\n }\n\n &").concat(modifier, "::-ms-thumb {\n ").concat(styles, "\n }\n\n &").concat(modifier, "::-webkit-slider-thumb {\n ").concat(styles, "\n }\n ");
308
- };
309
- var trackStyles = function trackStyles(styles) {
310
- var modifier = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
311
- return "\n &".concat(modifier, "::-moz-range-track {\n ").concat(styles, "\n }\n\n &").concat(modifier, "::-ms-track {\n ").concat(styles, "\n }\n\n &").concat(modifier, "::-webkit-slider-runnable-track {\n ").concat(styles, "\n }\n ");
312
- };
313
- var trackLowerStyles = function trackLowerStyles(styles) {
314
- var modifier = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
315
- return "\n &".concat(modifier, "::-moz-range-progress {\n ").concat(styles, "\n }\n\n &").concat(modifier, "::-ms-fill-lower {\n ").concat(styles, "\n }\n ");
316
- };
317
- var colorStyles$1 = function colorStyles(props) {
318
- var thumbBackgroundColor = reactTheming.getColor('neutralHue', 100, props.theme);
319
- var thumbBorderColor = thumbBackgroundColor;
320
- var thumbActiveBackgroundColor = reactTheming.getColor('neutralHue', 200, props.theme);
321
- var thumbActiveBorderColor = reactTheming.getColor('primaryHue', 600, props.theme);
322
- var thumbHoverBackgroundColor = thumbActiveBackgroundColor;
323
- var thumbHoverBorderColor = thumbHoverBackgroundColor;
324
- return "\n border-color: ".concat(props.isOpaque && props.theme.colors.background, ";\n\n ").concat(trackStyles("\n background-color: transparent;\n "), "\n\n ").concat(thumbStyles("\n border-color: ".concat(thumbBorderColor, ";\n background-color: ").concat(thumbBackgroundColor, ";\n ")), "\n\n ").concat(trackLowerStyles("\n background-color: transparent;\n "), "\n\n ").concat(thumbStyles("\n border-color: ".concat(thumbHoverBorderColor, ";\n background-color: ").concat(thumbHoverBackgroundColor, ";\n "), ':hover'), "\n\n ").concat(thumbStyles("\n background-color: ".concat(thumbBackgroundColor, ";\n border-color: ").concat(thumbActiveBorderColor, ";\n "), '[data-garden-focus-visible="true"]'), "\n\n ").concat(thumbStyles("\n border-color: ".concat(thumbActiveBorderColor, ";\n background-color: ").concat(thumbActiveBackgroundColor, "\n "), ':active'), "\n ");
167
+ const COMPONENT_ID$k = 'colorpickers.colorpicker_range';
168
+ const thumbStyles = function (styles) {
169
+ let modifier = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
170
+ return `
171
+ &${modifier}::-moz-range-thumb {
172
+ ${styles}
173
+ }
174
+
175
+ &${modifier}::-ms-thumb {
176
+ ${styles}
177
+ }
178
+
179
+ &${modifier}::-webkit-slider-thumb {
180
+ ${styles}
181
+ }
182
+ `;
325
183
  };
326
- var getThumbSize = function getThumbSize(props) {
327
- return props.theme.space.base * (props.isOpaque ? 6 : 4);
184
+ const trackStyles = function (styles) {
185
+ let modifier = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
186
+ return `
187
+ &${modifier}::-moz-range-track {
188
+ ${styles}
189
+ }
190
+
191
+ &${modifier}::-ms-track {
192
+ ${styles}
193
+ }
194
+
195
+ &${modifier}::-webkit-slider-runnable-track {
196
+ ${styles}
197
+ }
198
+ `;
328
199
  };
329
- var getTrackHeight = function getTrackHeight(props) {
330
- return props.theme.space.base * (props.isOpaque ? 6 : 3);
200
+ const trackLowerStyles = function (styles) {
201
+ let modifier = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
202
+ return `
203
+ &${modifier}::-moz-range-progress {
204
+ ${styles}
205
+ }
206
+
207
+ &${modifier}::-ms-fill-lower {
208
+ ${styles}
209
+ }
210
+ `;
331
211
  };
332
- var getTrackMargin = function getTrackMargin(props) {
333
- return (getThumbSize(props) - getTrackHeight(props)) / 2 + polished.stripUnit(props.theme.shadowWidths.md);
212
+ const colorStyles$1 = props => {
213
+ const thumbBackgroundColor = reactTheming.getColor('neutralHue', 100, props.theme);
214
+ const thumbBorderColor = thumbBackgroundColor;
215
+ const thumbActiveBackgroundColor = reactTheming.getColor('neutralHue', 200, props.theme);
216
+ const thumbActiveBorderColor = reactTheming.getColor('primaryHue', 600, props.theme);
217
+ const thumbHoverBackgroundColor = thumbActiveBackgroundColor;
218
+ const thumbHoverBorderColor = thumbHoverBackgroundColor;
219
+ return `
220
+ border-color: ${props.isOpaque && props.theme.colors.background};
221
+
222
+ ${trackStyles(`
223
+ background-color: transparent;
224
+ `)}
225
+
226
+ ${thumbStyles(`
227
+ border-color: ${thumbBorderColor};
228
+ background-color: ${thumbBackgroundColor};
229
+ `)}
230
+
231
+ ${trackLowerStyles(`
232
+ background-color: transparent;
233
+ `)}
234
+
235
+ ${thumbStyles(`
236
+ border-color: ${thumbHoverBorderColor};
237
+ background-color: ${thumbHoverBackgroundColor};
238
+ `, ':hover')}
239
+
240
+ ${thumbStyles(`
241
+ background-color: ${thumbBackgroundColor};
242
+ border-color: ${thumbActiveBorderColor};
243
+ `, '[data-garden-focus-visible="true"]')}
244
+
245
+ ${thumbStyles(`
246
+ border-color: ${thumbActiveBorderColor};
247
+ background-color: ${thumbActiveBackgroundColor}
248
+ `, ':active')}
249
+ `;
334
250
  };
335
- var sizeStyles$2 = function sizeStyles(props) {
336
- var thumbSize = getThumbSize(props);
337
- var trackHeight = getTrackHeight(props);
338
- var trackMargin = getTrackMargin(props);
339
- var thumbMargin = (trackHeight - thumbSize) / 2;
340
- var trackOffset = props.theme.space.base * (props.isOpaque ? -2 : -1);
341
- var height = props.isOpaque ? trackHeight : trackMargin * 2 + trackHeight;
342
- var marginHorizontal;
343
- var border;
344
- var borderRadius;
251
+ const getThumbSize = props => props.theme.space.base * (props.isOpaque ? 6 : 4);
252
+ const getTrackHeight = props => props.theme.space.base * (props.isOpaque ? 6 : 3);
253
+ const getTrackMargin = props => (getThumbSize(props) - getTrackHeight(props)) / 2 + polished.stripUnit(props.theme.shadowWidths.md);
254
+ const sizeStyles$2 = props => {
255
+ const thumbSize = getThumbSize(props);
256
+ const trackHeight = getTrackHeight(props);
257
+ const trackMargin = getTrackMargin(props);
258
+ const thumbMargin = (trackHeight - thumbSize) / 2;
259
+ const trackOffset = props.theme.space.base * (props.isOpaque ? -2 : -1);
260
+ const height = props.isOpaque ? trackHeight : trackMargin * 2 + trackHeight;
261
+ let marginHorizontal;
262
+ let border;
263
+ let borderRadius;
345
264
  if (props.isOpaque) {
346
- marginHorizontal = "-".concat(trackMargin, "px");
347
- border = "".concat(trackMargin, "px ").concat(props.theme.borderStyles.solid);
348
- borderRadius = "".concat(trackMargin + polished.stripUnit(props.theme.shadowWidths.md), "px");
265
+ marginHorizontal = `-${trackMargin}px`;
266
+ border = `${trackMargin}px ${props.theme.borderStyles.solid}`;
267
+ borderRadius = `${trackMargin + polished.stripUnit(props.theme.shadowWidths.md)}px`;
349
268
  }
350
- return "\n /* stylelint-disable-next-line declaration-no-important */\n margin-top: 0 !important;\n margin-".concat(props.theme.rtl ? 'right' : 'left', ": ").concat(marginHorizontal, ";\n height: ").concat(height, "px; /* [1] */\n box-sizing: content-box; /* [2] */\n border: ").concat(border, ";\n border-radius: ").concat(borderRadius, ";\n\n ").concat(trackStyles("\n margin: ".concat(trackMargin, "px ").concat(trackOffset, "px;\n height: ").concat(trackHeight, "px;\n ")), "\n\n ").concat(thumbStyles("\n margin: ".concat(thumbMargin, "px 0;\n border-width: ").concat(polished.math("".concat(props.theme.borderWidths.sm, " * 2")), ";\n height: ").concat(thumbSize, "px;\n width: ").concat(thumbSize, "px;\n ")), ";\n ");
269
+ return `
270
+ /* stylelint-disable-next-line declaration-no-important */
271
+ margin-top: 0 !important;
272
+ margin-${props.theme.rtl ? 'right' : 'left'}: ${marginHorizontal};
273
+ height: ${height}px; /* [1] */
274
+ box-sizing: content-box; /* [2] */
275
+ border: ${border};
276
+ border-radius: ${borderRadius};
277
+
278
+ ${trackStyles(`
279
+ margin: ${trackMargin}px ${trackOffset}px;
280
+ height: ${trackHeight}px;
281
+ `)}
282
+
283
+ ${thumbStyles(`
284
+ margin: ${thumbMargin}px 0;
285
+ border-width: ${polished.math(`${props.theme.borderWidths.sm} * 2`)};
286
+ height: ${thumbSize}px;
287
+ width: ${thumbSize}px;
288
+ `)};
289
+ `;
351
290
  };
352
- var StyledRange = styled__default["default"](reactForms.Range).attrs({
291
+ const StyledRange = styled__default["default"](reactForms.Range).attrs({
353
292
  'data-garden-id': COMPONENT_ID$k,
354
- 'data-garden-version': '8.57.0',
293
+ 'data-garden-version': '8.58.0',
355
294
  hasLowerTrack: false
356
295
  }).withConfig({
357
296
  displayName: "StyledRange",
358
297
  componentId: "sc-ug3wi9-0"
359
- })(["", ";", " ", ";", ";"], sizeStyles$2, trackStyles("\n border-radius: 0;\n "), colorStyles$1, function (props) {
360
- return reactTheming.retrieveComponentStyles(COMPONENT_ID$k, props);
361
- });
298
+ })(["", ";", " ", ";", ";"], sizeStyles$2, trackStyles(`
299
+ border-radius: 0;
300
+ `), colorStyles$1, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$k, props));
362
301
  StyledRange.defaultProps = {
363
302
  theme: reactTheming.DEFAULT_THEME
364
303
  };
365
304
 
366
- var COMPONENT_ID$j = 'colorpickers.colorpicker_hue';
367
- var StyledHueRange = styled__default["default"](StyledRange).attrs({
305
+ const COMPONENT_ID$j = 'colorpickers.colorpicker_hue';
306
+ const StyledHueRange = styled__default["default"](StyledRange).attrs({
368
307
  'data-garden-id': COMPONENT_ID$j,
369
- 'data-garden-version': '8.57.0'
308
+ 'data-garden-version': '8.58.0'
370
309
  }).withConfig({
371
310
  displayName: "StyledHueRange",
372
311
  componentId: "sc-13ly7p-0"
373
- })(["background:linear-gradient( to ", ",#f00 0%,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,#f00 100% ) no-repeat;background-position:", ";background-size:100% ", "px;"], function (props) {
374
- return props.theme.rtl ? 'left' : 'right';
375
- }, function (props) {
376
- return !props.isOpaque && "0 ".concat(getTrackMargin(props), "px");
377
- }, function (props) {
378
- return getTrackHeight(props);
379
- });
312
+ })(["background:linear-gradient( to ", ",#f00 0%,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,#f00 100% ) no-repeat;background-position:", ";background-size:100% ", "px;"], props => props.theme.rtl ? 'left' : 'right', props => !props.isOpaque && `0 ${getTrackMargin(props)}px`, props => getTrackHeight(props));
380
313
  StyledHueRange.defaultProps = {
381
314
  theme: reactTheming.DEFAULT_THEME
382
315
  };
383
316
 
384
- var checkeredBackground = function checkeredBackground(theme, size) {
385
- var positionY = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
386
- var repeat = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'repeat';
387
- var color = reactTheming.getColor('neutralHue', 400, theme);
388
- var dimensions = "".concat(size, "px ").concat(size, "px");
389
- var positionX1 = theme.rtl ? '100%' : '0';
390
- var positionX2 = theme.rtl ? "calc(100% - ".concat(size / 2, "px)") : "".concat(size / 2, "px");
391
- var position1 = "".concat(positionX1, " ").concat(positionY, "px");
392
- var position2 = "".concat(positionX2, " ").concat(size / 2 + positionY, "px");
393
- var position3 = "".concat(positionX2, " ").concat(positionY, "px");
394
- var position4 = "".concat(positionX1, " ").concat(size / -2 + positionY, "px");
395
- return "\n linear-gradient(45deg, ".concat(color, " 25%, transparent 25%) ").concat(position1, " / ").concat(dimensions, " ").concat(repeat, ",\n linear-gradient(45deg, transparent 75%, ").concat(color, " 75%) ").concat(position2, " / ").concat(dimensions, " ").concat(repeat, ",\n linear-gradient(135deg, ").concat(color, " 25%, transparent 25%) ").concat(position3, " / ").concat(dimensions, " ").concat(repeat, ",\n linear-gradient(135deg, transparent 75%, ").concat(color, " 75%) ").concat(position4, " / ").concat(dimensions, " ").concat(repeat, "\n ");
317
+ const checkeredBackground = function (theme, size) {
318
+ let positionY = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
319
+ let repeat = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'repeat';
320
+ const color = reactTheming.getColor('neutralHue', 400, theme);
321
+ const dimensions = `${size}px ${size}px`;
322
+ const positionX1 = theme.rtl ? '100%' : '0';
323
+ const positionX2 = theme.rtl ? `calc(100% - ${size / 2}px)` : `${size / 2}px`;
324
+ const position1 = `${positionX1} ${positionY}px`;
325
+ const position2 = `${positionX2} ${size / 2 + positionY}px`;
326
+ const position3 = `${positionX2} ${positionY}px`;
327
+ const position4 = `${positionX1} ${size / -2 + positionY}px`;
328
+ return `
329
+ linear-gradient(45deg, ${color} 25%, transparent 25%) ${position1} / ${dimensions} ${repeat},
330
+ linear-gradient(45deg, transparent 75%, ${color} 75%) ${position2} / ${dimensions} ${repeat},
331
+ linear-gradient(135deg, ${color} 25%, transparent 25%) ${position3} / ${dimensions} ${repeat},
332
+ linear-gradient(135deg, transparent 75%, ${color} 75%) ${position4} / ${dimensions} ${repeat}
333
+ `;
396
334
  };
397
335
 
398
- var COMPONENT_ID$i = 'colorpickers.colorpicker_alpha';
399
- var background$3 = function background(props) {
400
- var direction = "to ".concat(props.theme.rtl ? 'left' : 'right');
401
- var fromColor = "rgba(".concat(props.red, ", ").concat(props.green, ", ").concat(props.blue, ", 0)");
402
- var toColor = "rgb(".concat(props.red, ", ").concat(props.green, ", ").concat(props.blue, ")");
403
- var positionY = getTrackMargin(props);
404
- var height = getTrackHeight(props);
405
- var gradientBackground = "linear-gradient(".concat(direction, ", ").concat(fromColor, ", ").concat(toColor, ") 0 ").concat(positionY, "px / 100% ").concat(height, "px no-repeat");
406
- return "".concat(gradientBackground, ", ").concat(checkeredBackground(props.theme, height, positionY, 'repeat-x'));
336
+ const COMPONENT_ID$i = 'colorpickers.colorpicker_alpha';
337
+ const background$3 = props => {
338
+ const direction = `to ${props.theme.rtl ? 'left' : 'right'}`;
339
+ const fromColor = `rgba(${props.red}, ${props.green}, ${props.blue}, 0)`;
340
+ const toColor = `rgb(${props.red}, ${props.green}, ${props.blue})`;
341
+ const positionY = getTrackMargin(props);
342
+ const height = getTrackHeight(props);
343
+ const gradientBackground = `linear-gradient(${direction}, ${fromColor}, ${toColor}) 0 ${positionY}px / 100% ${height}px no-repeat`;
344
+ return `${gradientBackground}, ${checkeredBackground(props.theme, height, positionY, 'repeat-x')}`;
407
345
  };
408
- var StyledAlphaRange = styled__default["default"](StyledRange).attrs(function (props) {
409
- return {
410
- style: {
411
- backgroundSize: 'auto',
412
- background: background$3(props)
413
- },
414
- 'data-garden-id': COMPONENT_ID$i,
415
- 'data-garden-version': '8.57.0'
416
- };
417
- }).withConfig({
346
+ const StyledAlphaRange = styled__default["default"](StyledRange).attrs(props => ({
347
+ style: {
348
+ backgroundSize: 'auto',
349
+ background: background$3(props)
350
+ },
351
+ 'data-garden-id': COMPONENT_ID$i,
352
+ 'data-garden-version': '8.58.0'
353
+ })).withConfig({
418
354
  displayName: "StyledAlphaRange",
419
355
  componentId: "sc-kuh2xc-0"
420
356
  })([""]);
@@ -422,476 +358,377 @@ StyledAlphaRange.defaultProps = {
422
358
  theme: reactTheming.DEFAULT_THEME
423
359
  };
424
360
 
425
- var COMPONENT_ID$h = 'colorpickers.colorpicker_preview_box';
426
- var background$2 = function background(props) {
427
- var alpha = props.alpha ? props.alpha / 100 : 0;
428
- var color = "rgba(".concat(props.red, ", ").concat(props.green, ", ").concat(props.blue, ", ").concat(alpha, ")");
429
- var retVal = "linear-gradient(".concat(color, ", ").concat(color, ")");
361
+ const COMPONENT_ID$h = 'colorpickers.colorpicker_preview_box';
362
+ const background$2 = props => {
363
+ const alpha = props.alpha ? props.alpha / 100 : 0;
364
+ const color = `rgba(${props.red}, ${props.green}, ${props.blue}, ${alpha})`;
365
+ let retVal = `linear-gradient(${color}, ${color})`;
430
366
  if (!props.isOpaque) {
431
- retVal = "".concat(retVal, ", ").concat(checkeredBackground(props.theme, 13));
367
+ retVal = `${retVal}, ${checkeredBackground(props.theme, 13)}`;
432
368
  }
433
369
  return retVal;
434
370
  };
435
- var StyledPreview = styled__default["default"].div.attrs(function (props) {
436
- return {
437
- style: {
438
- background: background$2(props)
439
- },
440
- 'data-garden-id': COMPONENT_ID$h,
441
- 'data-garden-version': '8.57.0',
442
- 'data-test-id': 'preview-box'
443
- };
444
- }).withConfig({
371
+ const StyledPreview = styled__default["default"].div.attrs(props => ({
372
+ style: {
373
+ background: background$2(props)
374
+ },
375
+ 'data-garden-id': COMPONENT_ID$h,
376
+ 'data-garden-version': '8.58.0',
377
+ 'data-test-id': 'preview-box'
378
+ })).withConfig({
445
379
  displayName: "StyledPreview",
446
380
  componentId: "sc-d70mj1-0"
447
- })(["flex-shrink:0;border-radius:", ";box-shadow:inset 0 0 0 ", " ", ";width:", "px;height:", "px;", ";"], function (props) {
448
- return props.theme.borderRadii.md;
449
- }, function (props) {
450
- return props.theme.borderWidths.sm;
451
- }, function (props) {
452
- return polished.rgba(props.theme.palette.black, 0.19);
453
- }, function (props) {
454
- return props.theme.space.base * (props.isOpaque ? 6 : 8);
455
- }, function (props) {
456
- return props.theme.space.base * (props.isOpaque ? 6 : 8);
457
- }, function (props) {
458
- return reactTheming.retrieveComponentStyles(COMPONENT_ID$h, props);
459
- });
381
+ })(["flex-shrink:0;border-radius:", ";box-shadow:inset 0 0 0 ", " ", ";width:", "px;height:", "px;", ";"], props => props.theme.borderRadii.md, props => props.theme.borderWidths.sm, props => polished.rgba(props.theme.palette.black, 0.19), props => props.theme.space.base * (props.isOpaque ? 6 : 8), props => props.theme.space.base * (props.isOpaque ? 6 : 8), props => reactTheming.retrieveComponentStyles(COMPONENT_ID$h, props));
460
382
  StyledPreview.defaultProps = {
461
383
  theme: reactTheming.DEFAULT_THEME
462
384
  };
463
385
 
464
- var COMPONENT_ID$g = 'colorpickers.colorpicker_colorwell';
465
- var background$1 = function background(props) {
466
- var blackAlpha = polished.rgba(props.theme.palette.black, 0.9);
467
- var black = "linear-gradient(0deg, ".concat(props.theme.palette.black, ", ").concat(blackAlpha, " 1%, transparent 99%)");
468
- var whiteAngle = "".concat(props.theme.rtl ? -90 : 90, "deg");
469
- var white = "linear-gradient(".concat(whiteAngle, ", ").concat(props.theme.palette.white, " 1%, transparent)");
470
- var colorValue = polished.hsl(props.hue, 1, 0.5);
471
- var color = "linear-gradient(".concat(colorValue, ", ").concat(colorValue, ")");
472
- return "".concat(black, ", ").concat(white, ", ").concat(color);
386
+ const COMPONENT_ID$g = 'colorpickers.colorpicker_colorwell';
387
+ const background$1 = props => {
388
+ const blackAlpha = polished.rgba(props.theme.palette.black, 0.9);
389
+ const black = `linear-gradient(0deg, ${props.theme.palette.black}, ${blackAlpha} 1%, transparent 99%)`;
390
+ const whiteAngle = `${props.theme.rtl ? -90 : 90}deg`;
391
+ const white = `linear-gradient(${whiteAngle}, ${props.theme.palette.white} 1%, transparent)`;
392
+ const colorValue = polished.hsl(props.hue, 1, 0.5);
393
+ const color = `linear-gradient(${colorValue}, ${colorValue})`;
394
+ return `${black}, ${white}, ${color}`;
473
395
  };
474
- var StyledColorWell = styled__default["default"].div.attrs(function (props) {
475
- return {
476
- 'data-garden-id': COMPONENT_ID$g,
477
- 'data-garden-version': '8.57.0',
478
- 'data-test-id': 'colorwell',
479
- style: {
480
- background: background$1(props)
481
- }
482
- };
483
- }).withConfig({
396
+ const StyledColorWell = styled__default["default"].div.attrs(props => ({
397
+ 'data-garden-id': COMPONENT_ID$g,
398
+ 'data-garden-version': '8.58.0',
399
+ 'data-test-id': 'colorwell',
400
+ style: {
401
+ background: background$1(props)
402
+ }
403
+ })).withConfig({
484
404
  displayName: "StyledColorWell",
485
405
  componentId: "sc-54ly7s-0"
486
- })(["position:relative;margin-bottom:", "px;cursor:pointer;height:208px;overflow:hidden;", ";"], function (props) {
487
- return props.theme.space.base * 2;
488
- }, function (props) {
489
- return reactTheming.retrieveComponentStyles(COMPONENT_ID$g, props);
490
- });
406
+ })(["position:relative;margin-bottom:", "px;cursor:pointer;height:208px;overflow:hidden;", ";"], props => props.theme.space.base * 2, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$g, props));
491
407
  StyledColorWell.defaultProps = {
492
408
  theme: reactTheming.DEFAULT_THEME
493
409
  };
494
410
 
495
- var COMPONENT_ID$f = 'colorpickers.colorpicker_colorwell_thumb';
496
- var sizeStyles$1 = function sizeStyles(theme) {
497
- var borderWidth = polished.stripUnit(theme.borderWidths.sm) * 2;
498
- var size = theme.space.base * 5;
499
- var translateValue = size / -2;
500
- return "\n transform: translate(".concat(translateValue, "px, ").concat(translateValue, "px);\n box-sizing: border-box;\n border-width: ").concat(borderWidth, "px;\n width: ").concat(size, "px;\n height: ").concat(size, "px;\n ");
411
+ const COMPONENT_ID$f = 'colorpickers.colorpicker_colorwell_thumb';
412
+ const sizeStyles$1 = theme => {
413
+ const borderWidth = polished.stripUnit(theme.borderWidths.sm) * 2;
414
+ const size = theme.space.base * 5;
415
+ const translateValue = size / -2;
416
+ return `
417
+ transform: translate(${translateValue}px, ${translateValue}px);
418
+ box-sizing: border-box;
419
+ border-width: ${borderWidth}px;
420
+ width: ${size}px;
421
+ height: ${size}px;
422
+ `;
501
423
  };
502
- var StyledColorWellThumb = styled__default["default"].div.attrs(function (props) {
503
- return {
504
- 'data-garden-id': COMPONENT_ID$f,
505
- 'data-garden-version': '8.57.0',
506
- 'data-test-id': 'colorwell-thumb',
507
- style: {
508
- top: "".concat(props.top, "%"),
509
- left: "".concat(props.left, "%")
510
- }
511
- };
512
- }).withConfig({
424
+ const StyledColorWellThumb = styled__default["default"].div.attrs(props => ({
425
+ 'data-garden-id': COMPONENT_ID$f,
426
+ 'data-garden-version': '8.58.0',
427
+ 'data-test-id': 'colorwell-thumb',
428
+ style: {
429
+ top: `${props.top}%`,
430
+ left: `${props.left}%`
431
+ }
432
+ })).withConfig({
513
433
  displayName: "StyledColorWellThumb",
514
434
  componentId: "sc-1pnz3jz-0"
515
- })(["position:absolute;border:solid ", ";border-radius:50%;box-shadow:", ";", ";", ";"], function (props) {
516
- return props.theme.palette.white;
517
- }, function (props) {
518
- return props.theme.shadows.lg("".concat(props.theme.space.base, "px"), "".concat(props.theme.space.base * 2, "px"), reactTheming.getColor('neutralHue', 800, props.theme, 0.24));
519
- }, function (props) {
520
- return sizeStyles$1(props.theme);
521
- }, function (props) {
522
- return reactTheming.retrieveComponentStyles(COMPONENT_ID$f, props);
523
- });
435
+ })(["position:absolute;border:solid ", ";border-radius:50%;box-shadow:", ";", ";", ";"], props => props.theme.palette.white, props => props.theme.shadows.lg(`${props.theme.space.base}px`, `${props.theme.space.base * 2}px`, reactTheming.getColor('neutralHue', 800, props.theme, 0.24)), props => sizeStyles$1(props.theme), props => reactTheming.retrieveComponentStyles(COMPONENT_ID$f, props));
524
436
  StyledColorWellThumb.defaultProps = {
525
437
  theme: reactTheming.DEFAULT_THEME
526
438
  };
527
439
 
528
- var COMPONENT_ID$e = 'colorpickers.colorpicker_slider_group';
529
- var StyledSliderGroup = styled__default["default"].div.attrs({
440
+ const COMPONENT_ID$e = 'colorpickers.colorpicker_slider_group';
441
+ const StyledSliderGroup = styled__default["default"].div.attrs({
530
442
  'data-garden-id': COMPONENT_ID$e,
531
- 'data-garden-version': '8.57.0'
443
+ 'data-garden-version': '8.58.0'
532
444
  }).withConfig({
533
445
  displayName: "StyledSliderGroup",
534
446
  componentId: "sc-rsq0ak-0"
535
- })(["display:flex;justify-content:space-between;margin-bottom:", "px;", ";"], function (props) {
536
- return props.theme.space.base * 2;
537
- }, function (props) {
538
- return reactTheming.retrieveComponentStyles(COMPONENT_ID$e, props);
539
- });
447
+ })(["display:flex;justify-content:space-between;margin-bottom:", "px;", ";"], props => props.theme.space.base * 2, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$e, props));
540
448
  StyledSliderGroup.defaultProps = {
541
449
  theme: reactTheming.DEFAULT_THEME
542
450
  };
543
451
 
544
- var COMPONENT_ID$d = 'colorpickers.colorpicker_hex_field';
545
- var StyledHexField = styled__default["default"](reactForms.Field).attrs({
452
+ const COMPONENT_ID$d = 'colorpickers.colorpicker_hex_field';
453
+ const StyledHexField = styled__default["default"](reactForms.Field).attrs({
546
454
  'data-garden-id': COMPONENT_ID$d,
547
- 'data-garden-version': '8.57.0',
455
+ 'data-garden-version': '8.58.0',
548
456
  spellcheck: false
549
457
  }).withConfig({
550
458
  displayName: "StyledHexField",
551
459
  componentId: "sc-1lk14t4-0"
552
- })(["display:flex;flex-basis:0;flex-direction:column;flex-grow:1;width:auto;text-align:center;input{direction:ltr;}", ";"], function (props) {
553
- return reactTheming.retrieveComponentStyles(COMPONENT_ID$d, props);
554
- });
460
+ })(["display:flex;flex-basis:0;flex-direction:column;flex-grow:1;width:auto;text-align:center;input{direction:ltr;}", ";"], props => reactTheming.retrieveComponentStyles(COMPONENT_ID$d, props));
555
461
  StyledHexField.defaultProps = {
556
462
  theme: reactTheming.DEFAULT_THEME
557
463
  };
558
464
 
559
- var COMPONENT_ID$c = 'colorpickers.colorpicker_label';
560
- var StyledLabel = styled__default["default"](reactForms.Label).attrs({
465
+ const COMPONENT_ID$c = 'colorpickers.colorpicker_label';
466
+ const StyledLabel = styled__default["default"](reactForms.Label).attrs({
561
467
  'data-garden-id': COMPONENT_ID$c,
562
- 'data-garden-version': '8.57.0'
468
+ 'data-garden-version': '8.58.0'
563
469
  }).withConfig({
564
470
  displayName: "StyledLabel",
565
471
  componentId: "sc-1klhp6m-0"
566
- })(["overflow:hidden;text-overflow:ellipsis;white-space:nowrap;", ";"], function (props) {
567
- return reactTheming.retrieveComponentStyles(COMPONENT_ID$c, props);
568
- });
472
+ })(["overflow:hidden;text-overflow:ellipsis;white-space:nowrap;", ";"], props => reactTheming.retrieveComponentStyles(COMPONENT_ID$c, props));
569
473
  StyledLabel.defaultProps = {
570
474
  theme: reactTheming.DEFAULT_THEME
571
475
  };
572
476
 
573
- var COMPONENT_ID$b = 'colorpickers.colorpicker_input';
574
- var StyledInput = styled__default["default"](reactForms.Input).attrs({
477
+ const COMPONENT_ID$b = 'colorpickers.colorpicker_input';
478
+ const StyledInput = styled__default["default"](reactForms.Input).attrs({
575
479
  'data-garden-id': COMPONENT_ID$b,
576
- 'data-garden-version': '8.57.0',
480
+ 'data-garden-version': '8.58.0',
577
481
  focusInset: false
578
482
  }).withConfig({
579
483
  displayName: "StyledInput",
580
484
  componentId: "sc-1iap93p-0"
581
- })(["text-align:center;", ";"], function (props) {
582
- return reactTheming.retrieveComponentStyles(COMPONENT_ID$b, props);
583
- });
485
+ })(["text-align:center;", ";"], props => reactTheming.retrieveComponentStyles(COMPONENT_ID$b, props));
584
486
  StyledInput.defaultProps = {
585
487
  theme: reactTheming.DEFAULT_THEME
586
488
  };
587
489
 
588
- var COMPONENT_ID$a = 'colorpickers.colorpicker_input_group';
589
- var StyledInputGroup = styled__default["default"].div.attrs({
490
+ const COMPONENT_ID$a = 'colorpickers.colorpicker_input_group';
491
+ const StyledInputGroup = styled__default["default"].div.attrs({
590
492
  'data-garden-id': COMPONENT_ID$a,
591
- 'data-garden-version': '8.57.0'
493
+ 'data-garden-version': '8.58.0'
592
494
  }).withConfig({
593
495
  displayName: "StyledInputGroup",
594
496
  componentId: "sc-mmy93w-0"
595
- })(["display:flex;justify-content:space-between;", ";"], function (props) {
596
- return reactTheming.retrieveComponentStyles(COMPONENT_ID$a, props);
597
- });
497
+ })(["display:flex;justify-content:space-between;", ";"], props => reactTheming.retrieveComponentStyles(COMPONENT_ID$a, props));
598
498
  StyledInputGroup.defaultProps = {
599
499
  theme: reactTheming.DEFAULT_THEME
600
500
  };
601
501
 
602
- var COMPONENT_ID$9 = 'colorpickers.colorpicker_rgb_field';
603
- var sizeStyles = function sizeStyles(theme) {
604
- var margin = "".concat(theme.space.base * 1.5, "px");
605
- var width = "".concat(theme.space.base * 12.75, "px");
606
- return "\n margin-".concat(theme.rtl ? 'right' : 'left', ": ").concat(margin, ";\n width: ").concat(width, ";\n min-width: ").concat(width, ";\n ");
502
+ const COMPONENT_ID$9 = 'colorpickers.colorpicker_rgb_field';
503
+ const sizeStyles = theme => {
504
+ const margin = `${theme.space.base * 1.5}px`;
505
+ const width = `${theme.space.base * 12.75}px`;
506
+ return `
507
+ margin-${theme.rtl ? 'right' : 'left'}: ${margin};
508
+ width: ${width};
509
+ min-width: ${width};
510
+ `;
607
511
  };
608
- var StyledRGBAField = styled__default["default"](reactForms.Field).attrs({
512
+ const StyledRGBAField = styled__default["default"](reactForms.Field).attrs({
609
513
  'data-garden-id': COMPONENT_ID$9,
610
- 'data-garden-version': '8.57.0'
514
+ 'data-garden-version': '8.58.0'
611
515
  }).withConfig({
612
516
  displayName: "StyledRGBAField",
613
517
  componentId: "sc-ibo1yw-0"
614
- })(["display:flex;flex-direction:column;text-align:center;", ";", ";"], function (props) {
615
- return sizeStyles(props.theme);
616
- }, function (props) {
617
- return reactTheming.retrieveComponentStyles(COMPONENT_ID$9, props);
618
- });
518
+ })(["display:flex;flex-direction:column;text-align:center;", ";", ";"], props => sizeStyles(props.theme), props => reactTheming.retrieveComponentStyles(COMPONENT_ID$9, props));
619
519
  StyledRGBAField.defaultProps = {
620
520
  theme: reactTheming.DEFAULT_THEME
621
521
  };
622
522
 
623
- var COMPONENT_ID$8 = 'colorpickers.colorpicker_sliders';
624
- var StyledSliders = styled__default["default"].div.attrs({
523
+ const COMPONENT_ID$8 = 'colorpickers.colorpicker_sliders';
524
+ const StyledSliders = styled__default["default"].div.attrs({
625
525
  'data-garden-id': COMPONENT_ID$8,
626
- 'data-garden-version': '8.57.0'
526
+ 'data-garden-version': '8.58.0'
627
527
  }).withConfig({
628
528
  displayName: "StyledSliders",
629
529
  componentId: "sc-aclca2-0"
630
- })(["position:relative;margin-", ":", "px;width:100%;& > *{position:absolute;width:100%;height:", "px;}& > :first-child{top:-", "px;}& > :last-child{bottom:-", "px;}", ";"], function (props) {
631
- return props.theme.rtl ? 'right' : 'left';
632
- }, function (props) {
633
- return props.theme.space.base * 2;
634
- }, function (props) {
635
- return getTrackMargin(props) * 2 + getTrackHeight(props);
636
- }, getTrackMargin, getTrackMargin, function (props) {
637
- return reactTheming.retrieveComponentStyles(COMPONENT_ID$8, props);
638
- });
530
+ })(["position:relative;margin-", ":", "px;width:100%;& > *{position:absolute;width:100%;height:", "px;}& > :first-child{top:-", "px;}& > :last-child{bottom:-", "px;}", ";"], props => props.theme.rtl ? 'right' : 'left', props => props.theme.space.base * 2, props => getTrackMargin(props) * 2 + getTrackHeight(props), getTrackMargin, getTrackMargin, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$8, props));
639
531
  StyledSliders.defaultProps = {
640
532
  theme: reactTheming.DEFAULT_THEME
641
533
  };
642
534
 
643
- var COMPONENT_ID$7 = 'colorpickers.colordialog_button';
644
- var StyledButton = styled__default["default"](reactButtons.Button).attrs({
535
+ const COMPONENT_ID$7 = 'colorpickers.colordialog_button';
536
+ const StyledButton = styled__default["default"](reactButtons.Button).attrs({
645
537
  isNeutral: true,
646
538
  'data-garden-id': COMPONENT_ID$7,
647
- 'data-garden-version': '8.57.0'
539
+ 'data-garden-version': '8.58.0'
648
540
  }).withConfig({
649
541
  displayName: "StyledButton",
650
542
  componentId: "sc-101xjve-0"
651
- })(["padding:0;width:", "px;max-width:", "px;&:last-of-type:not(:first-child){border-top-", "-radius:", " !important;border-bottom-", "-radius:", " !important;}", ";"], function (props) {
652
- return props.theme.space.base * 17;
653
- }, function (props) {
654
- return props.theme.space.base * 17;
655
- }, function (props) {
656
- return props.theme.rtl ? 'left' : 'right';
657
- }, function (props) {
658
- return props.theme.borderRadii.md;
659
- }, function (props) {
660
- return props.theme.rtl ? 'left' : 'right';
661
- }, function (props) {
662
- return props.theme.borderRadii.md;
663
- }, function (props) {
664
- return reactTheming.retrieveComponentStyles(COMPONENT_ID$7, props);
665
- });
543
+ })(["padding:0;width:", "px;max-width:", "px;&:last-of-type:not(:first-child){border-top-", "-radius:", " !important;border-bottom-", "-radius:", " !important;}", ";"], props => props.theme.space.base * 17, props => props.theme.space.base * 17, props => props.theme.rtl ? 'left' : 'right', props => props.theme.borderRadii.md, props => props.theme.rtl ? 'left' : 'right', props => props.theme.borderRadii.md, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$7, props));
666
544
  StyledButton.defaultProps = {
667
545
  theme: reactTheming.DEFAULT_THEME
668
546
  };
669
547
 
670
- var COMPONENT_ID$6 = 'colorpickers.colordialog_preview';
671
- var background = function background(props) {
672
- var backgroundColor = props.backgroundColor;
673
- var color;
548
+ const COMPONENT_ID$6 = 'colorpickers.colordialog_preview';
549
+ const background = props => {
550
+ const {
551
+ backgroundColor
552
+ } = props;
553
+ let color;
674
554
  if (typeof backgroundColor === 'string') {
675
555
  color = backgroundColor;
676
556
  } else if (backgroundColor === undefined) {
677
557
  color = props.theme.palette.white;
678
558
  } else {
679
- var red = backgroundColor.red,
680
- green = backgroundColor.green,
681
- blue = backgroundColor.blue,
682
- _backgroundColor$alph = backgroundColor.alpha,
683
- alpha = _backgroundColor$alph === void 0 ? 1 : _backgroundColor$alph;
684
- color = "rgba(".concat(red, ", ").concat(green, ", ").concat(blue, ", ").concat(alpha ? alpha / 100 : 0, ")");
559
+ const {
560
+ red,
561
+ green,
562
+ blue,
563
+ alpha = 1
564
+ } = backgroundColor;
565
+ color = `rgba(${red}, ${green}, ${blue}, ${alpha ? alpha / 100 : 0})`;
685
566
  }
686
- return "linear-gradient(".concat(color, ", ").concat(color, ")");
567
+ return `linear-gradient(${color}, ${color})`;
687
568
  };
688
- var StyledButtonPreview = styled__default["default"].span.attrs(function (props) {
689
- return {
690
- style: {
691
- background: "".concat(background(props), ", ").concat(checkeredBackground(props.theme, 8))
692
- },
693
- 'data-garden-id': COMPONENT_ID$6,
694
- 'data-garden-version': '8.57.0',
695
- 'data-test-id': 'dialog-preview'
696
- };
697
- }).withConfig({
569
+ const StyledButtonPreview = styled__default["default"].span.attrs(props => ({
570
+ style: {
571
+ background: `${background(props)}, ${checkeredBackground(props.theme, 8)}`
572
+ },
573
+ 'data-garden-id': COMPONENT_ID$6,
574
+ 'data-garden-version': '8.58.0',
575
+ 'data-test-id': 'dialog-preview'
576
+ })).withConfig({
698
577
  displayName: "StyledButtonPreview",
699
578
  componentId: "sc-1jzysg3-0"
700
- })(["display:inline-block;bottom:", "px;border-radius:", ";box-shadow:inset 0 0 0 ", " ", ";width:", "px;height:", "px;", ";"], function (props) {
701
- return props.theme.space.base;
702
- }, function (props) {
703
- return props.theme.borderRadii.sm;
704
- }, function (props) {
705
- return props.theme.borderWidths.sm;
706
- }, function (props) {
707
- return polished.rgba(props.theme.palette.black, 0.19);
708
- }, function (props) {
709
- return props.theme.space.base * 5;
710
- }, function (props) {
711
- return props.theme.space.base * 5;
712
- }, function (props) {
713
- return reactTheming.retrieveComponentStyles(COMPONENT_ID$6, props);
714
- });
579
+ })(["display:inline-block;bottom:", "px;border-radius:", ";box-shadow:inset 0 0 0 ", " ", ";width:", "px;height:", "px;", ";"], props => props.theme.space.base, props => props.theme.borderRadii.sm, props => props.theme.borderWidths.sm, props => polished.rgba(props.theme.palette.black, 0.19), props => props.theme.space.base * 5, props => props.theme.space.base * 5, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$6, props));
715
580
  StyledButtonPreview.defaultProps = {
716
581
  theme: reactTheming.DEFAULT_THEME
717
582
  };
718
583
 
719
- var COMPONENT_ID$5 = 'colorpickers.colordialog_tooltipmodal';
720
- var StyledTooltipModal = styled__default["default"](reactModals.TooltipModal).attrs({
584
+ const COMPONENT_ID$5 = 'colorpickers.colordialog_tooltipmodal';
585
+ const StyledTooltipModal = styled__default["default"](reactModals.TooltipModal).attrs({
721
586
  'data-garden-id': COMPONENT_ID$5,
722
- 'data-garden-version': '8.57.0'
587
+ 'data-garden-version': '8.58.0'
723
588
  }).withConfig({
724
589
  displayName: "StyledTooltipModal",
725
590
  componentId: "sc-o022s8-0"
726
- })(["width:auto !important;", ";"], function (props) {
727
- return reactTheming.retrieveComponentStyles(COMPONENT_ID$5, props);
728
- });
591
+ })(["width:auto !important;", ";"], props => reactTheming.retrieveComponentStyles(COMPONENT_ID$5, props));
729
592
  StyledTooltipModal.defaultProps = {
730
593
  theme: reactTheming.DEFAULT_THEME
731
594
  };
732
595
 
733
- var COMPONENT_ID$4 = 'colorpickers.colordialog_tooltipmodal_body';
734
- var StyledTooltipBody = styled__default["default"](reactModals.TooltipModal.Body).attrs({
596
+ const COMPONENT_ID$4 = 'colorpickers.colordialog_tooltipmodal_body';
597
+ const StyledTooltipBody = styled__default["default"](reactModals.TooltipModal.Body).attrs({
735
598
  'data-garden-id': COMPONENT_ID$4,
736
- 'data-garden-version': '8.57.0'
599
+ 'data-garden-version': '8.58.0'
737
600
  }).withConfig({
738
601
  displayName: "StyledTooltipBody",
739
602
  componentId: "sc-6gsgsy-0"
740
- })(["padding:0;", ";"], function (props) {
741
- return reactTheming.retrieveComponentStyles(COMPONENT_ID$4, props);
742
- });
603
+ })(["padding:0;", ";"], props => reactTheming.retrieveComponentStyles(COMPONENT_ID$4, props));
743
604
  StyledTooltipBody.defaultProps = {
744
605
  theme: reactTheming.DEFAULT_THEME
745
606
  };
746
607
 
747
- var COMPONENT_ID$3 = 'colorpickers.swatch_button';
748
- var StyledSwatchButton = styled__default["default"](StyledButtonPreview).attrs(function (props) {
749
- return {
750
- as: 'button',
751
- 'data-garden-id': COMPONENT_ID$3,
752
- 'data-test-id': props.backgroundColor,
753
- 'data-garden-version': '8.57.0'
754
- };
755
- }).withConfig({
608
+ const COMPONENT_ID$3 = 'colorpickers.swatch_button';
609
+ const StyledSwatchButton = styled__default["default"](StyledButtonPreview).attrs(props => ({
610
+ as: 'button',
611
+ 'data-garden-id': COMPONENT_ID$3,
612
+ 'data-test-id': props.backgroundColor,
613
+ 'data-garden-version': '8.58.0'
614
+ })).withConfig({
756
615
  displayName: "StyledSwatchButton",
757
616
  componentId: "sc-edpwpp-0"
758
- })(["outline:none;border:none;border-radius:", ";cursor:pointer;padding:0;&[data-garden-focus-visible]{box-shadow:", ";}", ";"], function (props) {
759
- return props.theme.borderRadii.md;
760
- }, function (props) {
761
- return props.theme.shadows.md(reactTheming.getColor('primaryHue', 600, props.theme, 0.35));
762
- }, function (props) {
763
- return reactTheming.retrieveComponentStyles(COMPONENT_ID$3, props);
764
- });
617
+ })(["outline:none;border:none;border-radius:", ";cursor:pointer;padding:0;&[data-garden-focus-visible]{box-shadow:", ";}", ";"], props => props.theme.borderRadii.md, props => props.theme.shadows.md(reactTheming.getColor('primaryHue', 600, props.theme, 0.35)), props => reactTheming.retrieveComponentStyles(COMPONENT_ID$3, props));
765
618
  StyledSwatchButton.defaultProps = {
766
619
  theme: reactTheming.DEFAULT_THEME
767
620
  };
768
621
 
769
- var COMPONENT_ID$2 = 'colorpickers.color_swatch';
770
- var StyledColorSwatch = styled__default["default"].table.attrs({
622
+ const COMPONENT_ID$2 = 'colorpickers.color_swatch';
623
+ const StyledColorSwatch = styled__default["default"].table.attrs({
771
624
  'data-garden-id': COMPONENT_ID$2,
772
- 'data-garden-version': '8.57.0',
625
+ 'data-garden-version': '8.58.0',
773
626
  role: 'grid'
774
627
  }).withConfig({
775
628
  displayName: "StyledColorSwatch",
776
629
  componentId: "sc-ajx440-0"
777
- })(["border-collapse:collapse;line-height:normal;", ";"], function (props) {
778
- return reactTheming.retrieveComponentStyles(COMPONENT_ID$2, props);
779
- });
630
+ })(["border-collapse:collapse;line-height:normal;", ";"], props => reactTheming.retrieveComponentStyles(COMPONENT_ID$2, props));
780
631
  StyledColorSwatch.defaultProps = {
781
632
  theme: reactTheming.DEFAULT_THEME
782
633
  };
783
634
 
784
- var _excluded$4 = ["children", "color", "theme"];
785
- var COMPONENT_ID$1 = 'colorpickers.colorswatch_check';
786
- var colorStyles = function colorStyles(props) {
787
- var theme = props.theme,
788
- color = props.color;
789
- var _parseToRgb = polished.parseToRgb(color),
790
- alpha = _parseToRgb.alpha;
791
- var checkColor = polished.readableColor(color, theme.colors.foreground, theme.colors.background);
635
+ const COMPONENT_ID$1 = 'colorpickers.colorswatch_check';
636
+ const colorStyles = props => {
637
+ const {
638
+ theme,
639
+ color
640
+ } = props;
641
+ const {
642
+ alpha
643
+ } = polished.parseToRgb(color);
644
+ let checkColor = polished.readableColor(color, theme.colors.foreground, theme.colors.background);
792
645
  if (alpha !== undefined && alpha < 0.4) {
793
646
  checkColor = theme.colors.foreground;
794
647
  }
795
- return "\n color: ".concat(checkColor, "\n ");
648
+ return `
649
+ color: ${checkColor}
650
+ `;
796
651
  };
797
- var StyledIcon = styled__default["default"](function (_ref) {
798
- var children = _ref.children;
799
- _ref.color;
800
- _ref.theme;
801
- var props = _objectWithoutProperties(_ref, _excluded$4);
652
+ const StyledIcon = styled__default["default"](_ref => {
653
+ let {
654
+ children,
655
+ color,
656
+ theme,
657
+ ...props
658
+ } = _ref;
802
659
  return React__default["default"].cloneElement(React.Children.only(children), props);
803
660
  }).attrs({
804
661
  'data-garden-id': COMPONENT_ID$1,
805
- 'data-garden-version': '8.57.0'
662
+ 'data-garden-version': '8.58.0'
806
663
  }).withConfig({
807
664
  displayName: "StyledIcon",
808
665
  componentId: "sc-8oigif-0"
809
- })(["transition:opacity 0.2s ease-in-out;opacity:", ";width:", "px;height:", "px;", " ", ";"], function (props) {
810
- return props.selected ? 1 : 0;
811
- }, function (props) {
812
- return props.theme.space.base * 5;
813
- }, function (props) {
814
- return props.theme.space.base * 5;
815
- }, colorStyles, function (props) {
816
- return reactTheming.retrieveComponentStyles(COMPONENT_ID$1, props);
817
- });
666
+ })(["transition:opacity 0.2s ease-in-out;opacity:", ";width:", "px;height:", "px;", " ", ";"], props => props.selected ? 1 : 0, props => props.theme.space.base * 5, props => props.theme.space.base * 5, colorStyles, props => reactTheming.retrieveComponentStyles(COMPONENT_ID$1, props));
818
667
  StyledIcon.defaultProps = {
819
668
  theme: reactTheming.DEFAULT_THEME
820
669
  };
821
670
 
822
- var COMPONENT_ID = 'colorpickers.swatch_cell';
823
- var StyledCell = styled__default["default"].td.attrs({
671
+ const COMPONENT_ID = 'colorpickers.swatch_cell';
672
+ const StyledCell = styled__default["default"].td.attrs({
824
673
  'data-garden-id': COMPONENT_ID,
825
- 'data-garden-version': '8.57.0'
674
+ 'data-garden-version': '8.58.0'
826
675
  }).withConfig({
827
676
  displayName: "StyledCell",
828
677
  componentId: "sc-qr3oit-0"
829
- })(["padding:", "px;font-size:0;", ";"], function (props) {
830
- return props.theme.space.base;
831
- }, function (props) {
832
- return reactTheming.retrieveComponentStyles(COMPONENT_ID, props);
833
- });
678
+ })(["padding:", "px;font-size:0;", ";"], props => props.theme.space.base, props => reactTheming.retrieveComponentStyles(COMPONENT_ID, props));
834
679
  StyledCell.defaultProps = {
835
680
  theme: reactTheming.DEFAULT_THEME
836
681
  };
837
682
 
838
- var ColorWell = React__default["default"].memo(function (_ref) {
839
- var hue = _ref.hue,
840
- saturation = _ref.saturation,
841
- lightness = _ref.lightness,
842
- onChange = _ref.onChange;
843
- var _useContext = React.useContext(styled.ThemeContext),
844
- rtl = _useContext.rtl;
845
- var containerRef = React.useRef(null);
846
- var hsv = hslToHsv(hue, saturation, lightness);
847
- var mouseActiveRef = React.useRef(false);
848
- var _useState = React.useState(0),
849
- _useState2 = _slicedToArray(_useState, 2),
850
- x = _useState2[0],
851
- setX = _useState2[1];
852
- var _useState3 = React.useState(0),
853
- _useState4 = _slicedToArray(_useState3, 2),
854
- y = _useState4[0],
855
- setY = _useState4[1];
856
- var _getThumbPosition = getThumbPosition(x, y, rtl, containerRef),
857
- topFromMouse = _getThumbPosition.topFromMouse,
858
- leftFromMouse = _getThumbPosition.leftFromMouse;
859
- var _useState5 = React.useState(0),
860
- _useState6 = _slicedToArray(_useState5, 2),
861
- topPosition = _useState6[0],
862
- setTopPosition = _useState6[1];
863
- var _useState7 = React.useState(0),
864
- _useState8 = _slicedToArray(_useState7, 2),
865
- leftPosition = _useState8[0],
866
- setLeftPosition = _useState8[1];
867
- React.useEffect(function () {
683
+ const ColorWell = React__default["default"].memo(_ref => {
684
+ let {
685
+ hue,
686
+ saturation,
687
+ lightness,
688
+ onChange
689
+ } = _ref;
690
+ const {
691
+ rtl
692
+ } = React.useContext(styled.ThemeContext);
693
+ const containerRef = React.useRef(null);
694
+ const hsv = hslToHsv(hue, saturation, lightness);
695
+ const mouseActiveRef = React.useRef(false);
696
+ const [x, setX] = React.useState(0);
697
+ const [y, setY] = React.useState(0);
698
+ const {
699
+ topFromMouse,
700
+ leftFromMouse
701
+ } = getThumbPosition(x, y, rtl, containerRef);
702
+ const [topPosition, setTopPosition] = React.useState(0);
703
+ const [leftPosition, setLeftPosition] = React.useState(0);
704
+ React.useEffect(() => {
868
705
  setTopPosition(100 - hsv.v);
869
706
  setLeftPosition(rtl ? 100 - hsv.s : hsv.s);
870
707
  }, [hsv.s, hsv.v, rtl]);
871
- var throttledChange = React.useMemo(function () {
872
- return throttle__default["default"](function (e) {
708
+ const throttledChange = React.useMemo(() => {
709
+ return throttle__default["default"](e => {
873
710
  if (containerRef.current) {
874
- var nextHsv = getNextHsv(e, hue, containerRef.current, rtl);
711
+ const nextHsv = getNextHsv(e, hue, containerRef.current, rtl);
875
712
  onChange && onChange(nextHsv, e);
876
713
  }
877
714
  }, 50);
878
715
  }, [hue, rtl, onChange]);
879
- var handleMouseMove = React.useCallback(function (e) {
716
+ const handleMouseMove = React.useCallback(e => {
880
717
  mouseActiveRef.current = true;
881
718
  setX(e.pageX);
882
719
  setY(e.pageY);
883
720
  throttledChange(e);
884
721
  }, [throttledChange]);
885
- var handleMouseUp = React.useCallback(function () {
722
+ const handleMouseUp = React.useCallback(() => {
886
723
  mouseActiveRef.current = true;
887
- setTimeout(function () {
724
+ setTimeout(() => {
888
725
  mouseActiveRef.current = false;
889
726
  });
890
727
  throttledChange.cancel();
891
728
  window.removeEventListener('mousemove', handleMouseMove);
892
729
  window.removeEventListener('mouseup', handleMouseUp);
893
730
  }, [throttledChange, handleMouseMove]);
894
- var handleMouseDown = React.useCallback(function (e) {
731
+ const handleMouseDown = React.useCallback(e => {
895
732
  mouseActiveRef.current = true;
896
733
  e.persist();
897
734
  handleMouseMove(e);
@@ -899,8 +736,8 @@ var ColorWell = React__default["default"].memo(function (_ref) {
899
736
  window.addEventListener('mousemove', handleMouseMove);
900
737
  window.addEventListener('mouseup', handleMouseUp);
901
738
  }, [throttledChange, handleMouseMove, handleMouseUp]);
902
- React.useEffect(function () {
903
- return function () {
739
+ React.useEffect(() => {
740
+ return () => {
904
741
  throttledChange.cancel();
905
742
  };
906
743
  }, [throttledChange]);
@@ -916,8 +753,8 @@ var ColorWell = React__default["default"].memo(function (_ref) {
916
753
  });
917
754
  ColorWell.displayName = 'ColorWell';
918
755
 
919
- var isValidHex = function isValidHex(hexString) {
920
- var regEx = /^#(?:(?:[0-9A-F]{6}(?:[0-9A-F]{2})?)|(?:[0-9A-F]{3})(?:[0-9A-F]?))$/i;
756
+ const isValidHex = hexString => {
757
+ const regEx = /^#(?:(?:[0-9A-F]{6}(?:[0-9A-F]{2})?)|(?:[0-9A-F]{3})(?:[0-9A-F]?))$/iu;
921
758
  return regEx.test(hexString);
922
759
  };
923
760
 
@@ -925,45 +762,47 @@ function convertStringToColor(colorString) {
925
762
  if (colorString.includes('#') && !isValidHex(colorString)) {
926
763
  return undefined;
927
764
  }
928
- var _parseToHsl = polished.parseToHsl(colorString),
929
- hue = _parseToHsl.hue,
930
- saturation = _parseToHsl.saturation,
931
- lightness = _parseToHsl.lightness;
932
- var _parseToRgb = polished.parseToRgb(colorString),
933
- red = _parseToRgb.red,
934
- green = _parseToRgb.green,
935
- blue = _parseToRgb.blue,
936
- alpha = _parseToRgb.alpha;
937
- var computedAlpha = alpha === undefined ? 100 : alpha * 100;
938
- var computedHex = polished.rgb({
939
- red: red,
940
- green: green,
941
- blue: blue
765
+ const {
766
+ hue,
767
+ saturation,
768
+ lightness
769
+ } = polished.parseToHsl(colorString);
770
+ const {
771
+ red,
772
+ green,
773
+ blue,
774
+ alpha
775
+ } = polished.parseToRgb(colorString);
776
+ const computedAlpha = alpha === undefined ? 100 : alpha * 100;
777
+ const computedHex = polished.rgb({
778
+ red,
779
+ green,
780
+ blue
942
781
  });
943
782
  return {
944
- hue: hue,
783
+ hue,
945
784
  saturation: saturation * 100,
946
785
  lightness: lightness * 100,
947
- red: red,
948
- green: green,
949
- blue: blue,
786
+ red,
787
+ green,
788
+ blue,
950
789
  alpha: computedAlpha,
951
790
  hex: computedHex
952
791
  };
953
792
  }
954
- var areColorsEqual = function areColorsEqual(a, b) {
793
+ const areColorsEqual = (a, b) => {
955
794
  if (a === undefined || b === undefined) {
956
795
  return false;
957
796
  }
958
- var colorA = typeof a === 'string' ? convertStringToColor(a) : a;
959
- var colorB = typeof b === 'string' ? convertStringToColor(b) : b;
797
+ const colorA = typeof a === 'string' ? convertStringToColor(a) : a;
798
+ const colorB = typeof b === 'string' ? convertStringToColor(b) : b;
960
799
  if (colorA === undefined || colorB === undefined) {
961
800
  return false;
962
801
  }
963
802
  return isEqual__default["default"](colorA, colorB);
964
803
  };
965
804
  function getInitialState(color) {
966
- var whiteColor = {
805
+ const whiteColor = {
967
806
  hue: 0,
968
807
  saturation: 0,
969
808
  lightness: 0,
@@ -977,11 +816,11 @@ function getInitialState(color) {
977
816
  return getInitialState(whiteColor);
978
817
  }
979
818
  if (typeof color === 'string') {
980
- var computedColor = convertStringToColor(color);
819
+ const computedColor = convertStringToColor(color);
981
820
  return getInitialState(computedColor || whiteColor);
982
821
  }
983
822
  return {
984
- color: color,
823
+ color,
985
824
  hexInput: color.hex,
986
825
  redInput: color.red.toString(),
987
826
  blueInput: color.blue.toString(),
@@ -989,80 +828,88 @@ function getInitialState(color) {
989
828
  alphaInput: color.alpha.toString()
990
829
  };
991
830
  }
992
- var reducer = function reducer(state, action) {
831
+ const reducer = (state, action) => {
993
832
  switch (action.type) {
994
833
  case 'SATURATION_CHANGE':
995
834
  {
996
- var hsl = hsvToHsl(action.payload.h, action.payload.s * 100, action.payload.v * 100);
997
- var hex = polished.hsl({
835
+ const hsl = hsvToHsl(action.payload.h, action.payload.s * 100, action.payload.v * 100);
836
+ const hex = polished.hsl({
998
837
  hue: action.payload.h,
999
838
  saturation: hsl.s / 100,
1000
839
  lightness: hsl.l / 100
1001
840
  });
1002
- var rgb = polished.parseToRgb(hex);
1003
- return _objectSpread2(_objectSpread2({}, state), {}, {
1004
- color: _objectSpread2(_objectSpread2({}, state.color), {}, {
841
+ const rgb = polished.parseToRgb(hex);
842
+ return {
843
+ ...state,
844
+ color: {
845
+ ...state.color,
1005
846
  saturation: hsl.s,
1006
847
  lightness: hsl.l,
1007
- hex: hex,
848
+ hex,
1008
849
  red: rgb.red,
1009
850
  green: rgb.green,
1010
851
  blue: rgb.blue
1011
- })
1012
- });
852
+ }
853
+ };
1013
854
  }
1014
855
  case 'HUE_CHANGE':
1015
856
  {
1016
- var hue = Number(action.payload);
1017
- var _hex = polished.hsl({
1018
- hue: hue,
857
+ const hue = Number(action.payload);
858
+ const hex = polished.hsl({
859
+ hue,
1019
860
  saturation: state.color.saturation / 100,
1020
861
  lightness: state.color.lightness / 100
1021
862
  });
1022
- var _rgb = polished.parseToRgb(_hex);
1023
- return _objectSpread2(_objectSpread2({}, state), {}, {
1024
- color: _objectSpread2(_objectSpread2({}, state.color), {}, {
1025
- hue: hue,
1026
- hex: _hex,
1027
- red: _rgb.red,
1028
- green: _rgb.green,
1029
- blue: _rgb.blue
1030
- })
1031
- });
863
+ const rgb = polished.parseToRgb(hex);
864
+ return {
865
+ ...state,
866
+ color: {
867
+ ...state.color,
868
+ hue,
869
+ hex,
870
+ red: rgb.red,
871
+ green: rgb.green,
872
+ blue: rgb.blue
873
+ }
874
+ };
1032
875
  }
1033
876
  case 'ALPHA_SLIDER_CHANGE':
1034
877
  {
1035
- return _objectSpread2(_objectSpread2({}, state), {}, {
1036
- color: _objectSpread2(_objectSpread2({}, state.color), {}, {
878
+ return {
879
+ ...state,
880
+ color: {
881
+ ...state.color,
1037
882
  alpha: Math.round(Number(action.payload) * 100)
1038
- })
1039
- });
883
+ }
884
+ };
1040
885
  }
1041
886
  case 'HEX_CHANGE':
1042
887
  {
1043
- var color = state.color;
888
+ let color = state.color;
1044
889
  if (isValidHex(action.payload)) {
1045
- var _rgb2 = polished.parseToRgb(action.payload);
1046
- var _hsl = polished.parseToHsl("rgb(".concat(_rgb2.red, ", ").concat(_rgb2.green, ", ").concat(_rgb2.blue, ")"));
1047
- color = _objectSpread2(_objectSpread2({}, color), {}, {
1048
- hue: _hsl.hue,
1049
- saturation: _hsl.saturation * 100,
1050
- lightness: _hsl.lightness * 100,
890
+ const rgb = polished.parseToRgb(action.payload);
891
+ const hsl = polished.parseToHsl(`rgb(${rgb.red}, ${rgb.green}, ${rgb.blue})`);
892
+ color = {
893
+ ...color,
894
+ hue: hsl.hue,
895
+ saturation: hsl.saturation * 100,
896
+ lightness: hsl.lightness * 100,
1051
897
  hex: action.payload,
1052
- red: _rgb2.red,
1053
- green: _rgb2.green,
1054
- blue: _rgb2.blue
1055
- });
898
+ red: rgb.red,
899
+ green: rgb.green,
900
+ blue: rgb.blue
901
+ };
1056
902
  }
1057
- return _objectSpread2(_objectSpread2({}, state), {}, {
903
+ return {
904
+ ...state,
1058
905
  hexInput: action.payload,
1059
- color: color
1060
- });
906
+ color
907
+ };
1061
908
  }
1062
909
  case 'RED_CHANGE':
1063
910
  {
1064
- var red = parseInt(action.payload, 10);
1065
- var _color = state.color;
911
+ let red = parseInt(action.payload, 10);
912
+ let color = state.color;
1066
913
  if (!isNaN(red)) {
1067
914
  if (red >= 255) {
1068
915
  red = 255;
@@ -1070,25 +917,27 @@ var reducer = function reducer(state, action) {
1070
917
  if (red < 0) {
1071
918
  red = 0;
1072
919
  }
1073
- var _hsl2 = polished.parseToHsl("rgb(".concat(red, ", ").concat(_color.green, ", ").concat(_color.blue, ")"));
1074
- var _hex2 = polished.rgb(red, _color.green, _color.blue);
1075
- _color = _objectSpread2(_objectSpread2({}, _color), {}, {
1076
- hex: _hex2,
1077
- red: action.payload === '' ? _color.red : red,
1078
- hue: _hsl2.hue,
1079
- saturation: _hsl2.saturation * 100,
1080
- lightness: _hsl2.lightness * 100
1081
- });
920
+ const hsl = polished.parseToHsl(`rgb(${red}, ${color.green}, ${color.blue})`);
921
+ const hex = polished.rgb(red, color.green, color.blue);
922
+ color = {
923
+ ...color,
924
+ hex,
925
+ red: action.payload === '' ? color.red : red,
926
+ hue: hsl.hue,
927
+ saturation: hsl.saturation * 100,
928
+ lightness: hsl.lightness * 100
929
+ };
1082
930
  }
1083
- return _objectSpread2(_objectSpread2({}, state), {}, {
931
+ return {
932
+ ...state,
1084
933
  redInput: action.payload,
1085
- color: _color
1086
- });
934
+ color
935
+ };
1087
936
  }
1088
937
  case 'GREEN_CHANGE':
1089
938
  {
1090
- var green = parseInt(action.payload, 10);
1091
- var _color2 = state.color;
939
+ let green = parseInt(action.payload, 10);
940
+ let color = state.color;
1092
941
  if (!isNaN(green)) {
1093
942
  if (green >= 255) {
1094
943
  green = 255;
@@ -1096,25 +945,27 @@ var reducer = function reducer(state, action) {
1096
945
  if (green < 0) {
1097
946
  green = 0;
1098
947
  }
1099
- var _hsl3 = polished.parseToHsl("rgb(".concat(_color2.red, ", ").concat(green, ", ").concat(_color2.blue, ")"));
1100
- var _hex3 = polished.rgb(_color2.red, green, _color2.blue);
1101
- _color2 = _objectSpread2(_objectSpread2({}, _color2), {}, {
1102
- hex: _hex3,
1103
- green: action.payload === '' ? _color2.green : green,
1104
- hue: _hsl3.hue,
1105
- saturation: _hsl3.saturation * 100,
1106
- lightness: _hsl3.lightness * 100
1107
- });
948
+ const hsl = polished.parseToHsl(`rgb(${color.red}, ${green}, ${color.blue})`);
949
+ const hex = polished.rgb(color.red, green, color.blue);
950
+ color = {
951
+ ...color,
952
+ hex,
953
+ green: action.payload === '' ? color.green : green,
954
+ hue: hsl.hue,
955
+ saturation: hsl.saturation * 100,
956
+ lightness: hsl.lightness * 100
957
+ };
1108
958
  }
1109
- return _objectSpread2(_objectSpread2({}, state), {}, {
959
+ return {
960
+ ...state,
1110
961
  greenInput: action.payload,
1111
- color: _color2
1112
- });
962
+ color
963
+ };
1113
964
  }
1114
965
  case 'BLUE_CHANGE':
1115
966
  {
1116
- var blue = parseInt(action.payload, 10);
1117
- var _color3 = state.color;
967
+ let blue = parseInt(action.payload, 10);
968
+ let color = state.color;
1118
969
  if (!isNaN(blue)) {
1119
970
  if (blue >= 255) {
1120
971
  blue = 255;
@@ -1122,25 +973,27 @@ var reducer = function reducer(state, action) {
1122
973
  if (blue < 0) {
1123
974
  blue = 0;
1124
975
  }
1125
- var _hsl4 = polished.parseToHsl("rgb(".concat(_color3.red, ", ").concat(_color3.green, ", ").concat(blue, ")"));
1126
- var _hex4 = polished.rgb(_color3.red, _color3.green, blue);
1127
- _color3 = _objectSpread2(_objectSpread2({}, _color3), {}, {
1128
- hex: _hex4,
1129
- blue: action.payload === '' ? _color3.blue : blue,
1130
- hue: _hsl4.hue,
1131
- saturation: _hsl4.saturation * 100,
1132
- lightness: _hsl4.lightness * 100
1133
- });
976
+ const hsl = polished.parseToHsl(`rgb(${color.red}, ${color.green}, ${blue})`);
977
+ const hex = polished.rgb(color.red, color.green, blue);
978
+ color = {
979
+ ...color,
980
+ hex,
981
+ blue: action.payload === '' ? color.blue : blue,
982
+ hue: hsl.hue,
983
+ saturation: hsl.saturation * 100,
984
+ lightness: hsl.lightness * 100
985
+ };
1134
986
  }
1135
- return _objectSpread2(_objectSpread2({}, state), {}, {
987
+ return {
988
+ ...state,
1136
989
  blueInput: action.payload,
1137
- color: _color3
1138
- });
990
+ color
991
+ };
1139
992
  }
1140
993
  case 'ALPHA_CHANGE':
1141
994
  {
1142
- var alpha = parseInt(action.payload, 10);
1143
- var _color4 = state.color;
995
+ let alpha = parseInt(action.payload, 10);
996
+ let color = state.color;
1144
997
  if (!isNaN(alpha)) {
1145
998
  if (alpha > 100) {
1146
999
  alpha = 100;
@@ -1148,14 +1001,16 @@ var reducer = function reducer(state, action) {
1148
1001
  if (alpha < 0) {
1149
1002
  alpha = 0;
1150
1003
  }
1151
- _color4 = _objectSpread2(_objectSpread2({}, _color4), {}, {
1152
- alpha: alpha
1153
- });
1004
+ color = {
1005
+ ...color,
1006
+ alpha
1007
+ };
1154
1008
  }
1155
- return _objectSpread2(_objectSpread2({}, state), {}, {
1009
+ return {
1010
+ ...state,
1156
1011
  alphaInput: action.payload,
1157
- color: _color4
1158
- });
1012
+ color
1013
+ };
1159
1014
  }
1160
1015
  case 'RESET_COLOR':
1161
1016
  {
@@ -1166,27 +1021,24 @@ var reducer = function reducer(state, action) {
1166
1021
  }
1167
1022
  };
1168
1023
 
1169
- var _excluded$3 = ["color", "defaultColor", "isOpaque", "labels", "autofocus", "onChange"];
1170
- var Colorpicker = React.forwardRef(function (_ref, ref) {
1171
- var color = _ref.color,
1172
- defaultColor = _ref.defaultColor,
1173
- isOpaque = _ref.isOpaque,
1174
- _ref$labels = _ref.labels,
1175
- labels = _ref$labels === void 0 ? {} : _ref$labels,
1176
- autofocus = _ref.autofocus,
1177
- onChange = _ref.onChange,
1178
- props = _objectWithoutProperties(_ref, _excluded$3);
1179
- var _useReducer = React.useReducer(reducer, getInitialState(color || defaultColor)),
1180
- _useReducer2 = _slicedToArray(_useReducer, 2),
1181
- state = _useReducer2[0],
1182
- dispatch = _useReducer2[1];
1183
- var previousComputedColorRef = React.useRef(state.color);
1184
- var previousStateColorRef = React.useRef(state.color);
1185
- var computedColor = React.useMemo(function () {
1186
- var retVal = state.color;
1024
+ const Colorpicker = React.forwardRef((_ref, ref) => {
1025
+ let {
1026
+ color,
1027
+ defaultColor,
1028
+ isOpaque,
1029
+ labels = {},
1030
+ autofocus,
1031
+ onChange,
1032
+ ...props
1033
+ } = _ref;
1034
+ const [state, dispatch] = React.useReducer(reducer, getInitialState(color || defaultColor));
1035
+ const previousComputedColorRef = React.useRef(state.color);
1036
+ const previousStateColorRef = React.useRef(state.color);
1037
+ const computedColor = React.useMemo(() => {
1038
+ let retVal = state.color;
1187
1039
  if (color) {
1188
1040
  if (typeof color === 'string') {
1189
- var convertedColor = convertStringToColor(color);
1041
+ const convertedColor = convertStringToColor(color);
1190
1042
  if (convertedColor) {
1191
1043
  retVal = convertedColor;
1192
1044
  }
@@ -1199,13 +1051,13 @@ var Colorpicker = React.forwardRef(function (_ref, ref) {
1199
1051
  }
1200
1052
  return retVal;
1201
1053
  }, [color, isOpaque, state.color]);
1202
- React.useEffect(function () {
1054
+ React.useEffect(() => {
1203
1055
  if (!areColorsEqual(previousStateColorRef.current, state.color) && !areColorsEqual(color, state.color)) {
1204
1056
  onChange && onChange(state.color);
1205
1057
  }
1206
1058
  previousStateColorRef.current = state.color;
1207
1059
  }, [color, onChange, state.color]);
1208
- React.useEffect(function () {
1060
+ React.useEffect(() => {
1209
1061
  if (!areColorsEqual(computedColor, previousComputedColorRef.current)) {
1210
1062
  dispatch({
1211
1063
  type: 'RESET_COLOR',
@@ -1214,55 +1066,55 @@ var Colorpicker = React.forwardRef(function (_ref, ref) {
1214
1066
  }
1215
1067
  previousComputedColorRef.current = computedColor;
1216
1068
  }, [computedColor]);
1217
- var handleColorWellChange = React.useCallback(function (hsv) {
1069
+ const handleColorWellChange = React.useCallback(hsv => {
1218
1070
  dispatch({
1219
1071
  type: 'SATURATION_CHANGE',
1220
1072
  payload: hsv
1221
1073
  });
1222
1074
  }, []);
1223
- var handleHueChange = React.useCallback(function (e) {
1075
+ const handleHueChange = React.useCallback(e => {
1224
1076
  dispatch({
1225
1077
  type: 'HUE_CHANGE',
1226
1078
  payload: e.target.value
1227
1079
  });
1228
1080
  }, []);
1229
- var handleAlphaSliderChange = React.useCallback(function (e) {
1081
+ const handleAlphaSliderChange = React.useCallback(e => {
1230
1082
  dispatch({
1231
1083
  type: 'ALPHA_SLIDER_CHANGE',
1232
1084
  payload: e.target.value
1233
1085
  });
1234
1086
  }, []);
1235
- var handleHexChange = React.useCallback(function (e) {
1087
+ const handleHexChange = React.useCallback(e => {
1236
1088
  dispatch({
1237
1089
  type: 'HEX_CHANGE',
1238
1090
  payload: e.target.value
1239
1091
  });
1240
1092
  }, []);
1241
- var handleRedChange = React.useCallback(function (e) {
1093
+ const handleRedChange = React.useCallback(e => {
1242
1094
  dispatch({
1243
1095
  type: 'RED_CHANGE',
1244
1096
  payload: e.target.value
1245
1097
  });
1246
1098
  }, []);
1247
- var handleGreenChange = React.useCallback(function (e) {
1099
+ const handleGreenChange = React.useCallback(e => {
1248
1100
  dispatch({
1249
1101
  type: 'GREEN_CHANGE',
1250
1102
  payload: e.target.value
1251
1103
  });
1252
1104
  }, []);
1253
- var handleBlueChange = React.useCallback(function (e) {
1105
+ const handleBlueChange = React.useCallback(e => {
1254
1106
  dispatch({
1255
1107
  type: 'BLUE_CHANGE',
1256
1108
  payload: e.target.value
1257
1109
  });
1258
1110
  }, []);
1259
- var handleAlphaChange = React.useCallback(function (e) {
1111
+ const handleAlphaChange = React.useCallback(e => {
1260
1112
  dispatch({
1261
1113
  type: 'ALPHA_CHANGE',
1262
1114
  payload: e.target.value
1263
1115
  });
1264
1116
  }, []);
1265
- var handleBlur = React.useCallback(function () {
1117
+ const handleBlur = React.useCallback(() => {
1266
1118
  dispatch({
1267
1119
  type: 'RESET_COLOR',
1268
1120
  payload: computedColor
@@ -1381,65 +1233,61 @@ var SvgChevronDownStroke = function SvgChevronDownStroke(props) {
1381
1233
  height: 16,
1382
1234
  focusable: "false",
1383
1235
  viewBox: "0 0 16 16",
1384
- "aria-hidden": "true"
1236
+ "aria-hidden": "true",
1237
+ role: "img"
1385
1238
  }, props), _path$1 || (_path$1 = /*#__PURE__*/React__namespace.createElement("path", {
1386
1239
  fill: "currentColor",
1387
1240
  d: "M12.688 5.61a.5.5 0 01.69.718l-.066.062-5 4a.5.5 0 01-.542.054l-.082-.054-5-4a.5.5 0 01.55-.83l.074.05L8 9.359l4.688-3.75z"
1388
1241
  })));
1389
1242
  };
1390
1243
 
1391
- var _excluded$2 = ["color", "defaultColor", "placement", "onChange", "onClose", "labels", "hasArrow", "isAnimated", "isOpaque", "isOpen", "popperModifiers", "zIndex", "focusInset", "disabled", "buttonProps", "onDialogChange", "children"];
1392
- var ColorpickerDialog = React.forwardRef(function (_ref, ref) {
1393
- var color = _ref.color,
1394
- defaultColor = _ref.defaultColor,
1395
- placement = _ref.placement,
1396
- onChange = _ref.onChange,
1397
- _onClose = _ref.onClose,
1398
- labels = _ref.labels,
1399
- hasArrow = _ref.hasArrow,
1400
- isAnimated = _ref.isAnimated,
1401
- isOpaque = _ref.isOpaque,
1402
- isOpen = _ref.isOpen,
1403
- popperModifiers = _ref.popperModifiers,
1404
- zIndex = _ref.zIndex,
1405
- focusInset = _ref.focusInset,
1406
- disabled = _ref.disabled,
1407
- buttonProps = _ref.buttonProps,
1408
- onDialogChange = _ref.onDialogChange,
1409
- children = _ref.children,
1410
- props = _objectWithoutProperties(_ref, _excluded$2);
1411
- var isControlled = color !== null && color !== undefined;
1412
- var isDialogControlled = isOpen !== undefined && isOpen !== null;
1413
- var buttonRef = React.useRef(null);
1414
- var colorPickerRef = React.useRef(null);
1415
- var _useState = React.useState(),
1416
- _useState2 = _slicedToArray(_useState, 2),
1417
- referenceElement = _useState2[0],
1418
- setReferenceElement = _useState2[1];
1419
- var _useState3 = React.useState(defaultColor),
1420
- _useState4 = _slicedToArray(_useState3, 2),
1421
- uncontrolledColor = _useState4[0],
1422
- setUncontrolledColor = _useState4[1];
1423
- var openDialog = function openDialog() {
1244
+ const ColorpickerDialog = React.forwardRef((_ref, ref) => {
1245
+ let {
1246
+ color,
1247
+ defaultColor,
1248
+ placement,
1249
+ onChange,
1250
+ onClose,
1251
+ labels,
1252
+ hasArrow,
1253
+ isAnimated,
1254
+ isOpaque,
1255
+ isOpen,
1256
+ popperModifiers,
1257
+ zIndex,
1258
+ focusInset,
1259
+ disabled,
1260
+ buttonProps,
1261
+ onDialogChange,
1262
+ children,
1263
+ ...props
1264
+ } = _ref;
1265
+ const isControlled = color !== null && color !== undefined;
1266
+ const isDialogControlled = isOpen !== undefined && isOpen !== null;
1267
+ const buttonRef = React.useRef(null);
1268
+ const colorPickerRef = React.useRef(null);
1269
+ const [referenceElement, setReferenceElement] = React.useState();
1270
+ const [uncontrolledColor, setUncontrolledColor] = React.useState(defaultColor);
1271
+ const openDialog = () => {
1424
1272
  setReferenceElement(buttonRef.current);
1425
1273
  onDialogChange && onDialogChange({
1426
1274
  isOpen: true
1427
1275
  });
1428
1276
  };
1429
- var closeDialog = function closeDialog() {
1277
+ const closeDialog = () => {
1430
1278
  setReferenceElement(null);
1431
1279
  onDialogChange && onDialogChange({
1432
1280
  isOpen: false
1433
1281
  });
1434
1282
  };
1435
- var onClick = containerUtilities.composeEventHandlers(props.onClick, function () {
1283
+ const onClick = containerUtilities.composeEventHandlers(props.onClick, () => {
1436
1284
  if (referenceElement) {
1437
1285
  closeDialog();
1438
1286
  } else {
1439
1287
  openDialog();
1440
1288
  }
1441
1289
  });
1442
- React.useEffect(function () {
1290
+ React.useEffect(() => {
1443
1291
  if (isDialogControlled) {
1444
1292
  if (isOpen) {
1445
1293
  setReferenceElement(buttonRef.current);
@@ -1449,7 +1297,7 @@ var ColorpickerDialog = React.forwardRef(function (_ref, ref) {
1449
1297
  }
1450
1298
  }, [isOpen, isDialogControlled]);
1451
1299
  return React__default["default"].createElement(React__default["default"].Fragment, null, children ? React.cloneElement(React.Children.only(children), {
1452
- onClick: onClick,
1300
+ onClick,
1453
1301
  ref: buttonRef
1454
1302
  }) : React__default["default"].createElement(StyledButton, _extends$2({
1455
1303
  disabled: disabled,
@@ -1470,9 +1318,9 @@ var ColorpickerDialog = React.forwardRef(function (_ref, ref) {
1470
1318
  focusOnMount: false,
1471
1319
  placement: placement,
1472
1320
  referenceElement: referenceElement,
1473
- onClose: function onClose() {
1321
+ onClose: () => {
1474
1322
  closeDialog();
1475
- _onClose && _onClose(isControlled ? color : uncontrolledColor);
1323
+ onClose && onClose(isControlled ? color : uncontrolledColor);
1476
1324
  }
1477
1325
  }, props), React__default["default"].createElement(StyledTooltipBody, null, React__default["default"].createElement(Colorpicker, {
1478
1326
  autofocus: true,
@@ -1484,7 +1332,8 @@ var ColorpickerDialog = React.forwardRef(function (_ref, ref) {
1484
1332
  onChange: isControlled ? onChange : setUncontrolledColor
1485
1333
  }))));
1486
1334
  });
1487
- ColorpickerDialog.propTypes = _objectSpread2(_objectSpread2({}, Colorpicker.propTypes), {}, {
1335
+ ColorpickerDialog.propTypes = {
1336
+ ...Colorpicker.propTypes,
1488
1337
  placement: PropTypes__default["default"].oneOf(reactModals.PLACEMENT),
1489
1338
  onClose: PropTypes__default["default"].func,
1490
1339
  onDialogChange: PropTypes__default["default"].func,
@@ -1497,7 +1346,7 @@ ColorpickerDialog.propTypes = _objectSpread2(_objectSpread2({}, Colorpicker.prop
1497
1346
  isAnimated: PropTypes__default["default"].bool,
1498
1347
  isOpen: PropTypes__default["default"].bool,
1499
1348
  focusInset: PropTypes__default["default"].bool
1500
- });
1349
+ };
1501
1350
  ColorpickerDialog.defaultProps = {
1502
1351
  placement: 'bottom-start',
1503
1352
  isAnimated: true,
@@ -1517,7 +1366,8 @@ var SvgCheckSmFill = function SvgCheckSmFill(props) {
1517
1366
  height: 12,
1518
1367
  focusable: "false",
1519
1368
  viewBox: "0 0 12 12",
1520
- "aria-hidden": "true"
1369
+ "aria-hidden": "true",
1370
+ role: "img"
1521
1371
  }, props), _path || (_path = /*#__PURE__*/React__namespace.createElement("path", {
1522
1372
  fill: "none",
1523
1373
  stroke: "currentColor",
@@ -1528,52 +1378,56 @@ var SvgCheckSmFill = function SvgCheckSmFill(props) {
1528
1378
  })));
1529
1379
  };
1530
1380
 
1531
- var _excluded$1 = ["colors"],
1532
- _excluded2 = ["aria-selected"];
1533
- var ColorSwatch = React.forwardRef(function (_ref, ref) {
1534
- var colors = _ref.colors,
1535
- props = _objectWithoutProperties(_ref, _excluded$1);
1536
- var _useContext = React.useContext(styled.ThemeContext),
1537
- rtl = _useContext.rtl;
1538
- var _useGrid = containerGrid.useGrid(_objectSpread2({
1539
- rtl: rtl,
1381
+ const ColorSwatch = React.forwardRef((_ref, ref) => {
1382
+ let {
1383
+ colors,
1384
+ ...props
1385
+ } = _ref;
1386
+ const {
1387
+ rtl
1388
+ } = React.useContext(styled.ThemeContext);
1389
+ const {
1390
+ getGridCellProps
1391
+ } = containerGrid.useGrid({
1392
+ rtl,
1540
1393
  matrix: colors,
1541
1394
  selection: true,
1542
1395
  wrap: true,
1543
- idPrefix: containerUtilities.useId()
1544
- }, props)),
1545
- getGridCellProps = _useGrid.getGridCellProps;
1396
+ idPrefix: containerUtilities.useId(),
1397
+ ...props
1398
+ });
1546
1399
  return React__default["default"].createElement(StyledColorSwatch, {
1547
1400
  ref: ref
1548
- }, React__default["default"].createElement("tbody", null, colors.map(function (row, rowIdx) {
1549
- return React__default["default"].createElement("tr", {
1550
- key: row[0].value
1551
- }, row.map(function (color, colIdx) {
1552
- var label = color.label,
1553
- value = color.value;
1554
- var _getGridCellProps = getGridCellProps({
1555
- colIdx: colIdx,
1556
- rowIdx: rowIdx,
1557
- type: 'button',
1558
- role: undefined
1559
- }),
1560
- ariaSelected = _getGridCellProps['aria-selected'],
1561
- other = _objectWithoutProperties(_getGridCellProps, _excluded2);
1562
- return React__default["default"].createElement(StyledCell, {
1563
- key: value,
1564
- "aria-selected": ariaSelected
1565
- }, React__default["default"].createElement(reactTooltips.Tooltip, {
1566
- content: label
1567
- }, React__default["default"].createElement(StyledSwatchButton, _extends$2({
1568
- backgroundColor: value,
1569
- "aria-pressed": ariaSelected,
1570
- "aria-label": label
1571
- }, other), React__default["default"].createElement(StyledIcon, {
1572
- color: value,
1573
- selected: ariaSelected
1574
- }, React__default["default"].createElement(SvgCheckSmFill, null)))));
1575
- }));
1576
- })));
1401
+ }, React__default["default"].createElement("tbody", null, colors.map((row, rowIdx) => React__default["default"].createElement("tr", {
1402
+ key: row[0].value
1403
+ }, row.map((color, colIdx) => {
1404
+ const {
1405
+ label,
1406
+ value
1407
+ } = color;
1408
+ const {
1409
+ 'aria-selected': ariaSelected,
1410
+ ...other
1411
+ } = getGridCellProps({
1412
+ colIdx,
1413
+ rowIdx,
1414
+ type: 'button',
1415
+ role: undefined
1416
+ });
1417
+ return React__default["default"].createElement(StyledCell, {
1418
+ key: value,
1419
+ "aria-selected": ariaSelected
1420
+ }, React__default["default"].createElement(reactTooltips.Tooltip, {
1421
+ content: label
1422
+ }, React__default["default"].createElement(StyledSwatchButton, _extends$2({
1423
+ backgroundColor: value,
1424
+ "aria-pressed": ariaSelected,
1425
+ "aria-label": label
1426
+ }, other), React__default["default"].createElement(StyledIcon, {
1427
+ color: value,
1428
+ selected: ariaSelected
1429
+ }, React__default["default"].createElement(SvgCheckSmFill, null)))));
1430
+ })))));
1577
1431
  });
1578
1432
  ColorSwatch.displayName = 'ColorSwatch';
1579
1433
  ColorSwatch.propTypes = {
@@ -1590,59 +1444,45 @@ ColorSwatch.propTypes = {
1590
1444
  onSelect: PropTypes__default["default"].func
1591
1445
  };
1592
1446
 
1593
- var _excluded = ["colors", "rowIndex", "colIndex", "selectedRowIndex", "selectedColIndex", "defaultRowIndex", "defaultColIndex", "defaultSelectedRowIndex", "defaultSelectedColIndex", "placement", "onChange", "onSelect", "hasArrow", "isAnimated", "popperModifiers", "zIndex", "isOpen", "focusInset", "disabled", "buttonProps", "onDialogChange", "children"];
1594
- var ColorSwatchDialog = React.forwardRef(function (_ref, ref) {
1447
+ const ColorSwatchDialog = React.forwardRef((_ref, ref) => {
1595
1448
  var _controlledSelectedCo, _uncontrolledSelected;
1596
- var colors = _ref.colors,
1597
- rowIndex = _ref.rowIndex,
1598
- colIndex = _ref.colIndex,
1599
- selectedRowIndex = _ref.selectedRowIndex,
1600
- selectedColIndex = _ref.selectedColIndex,
1601
- defaultRowIndex = _ref.defaultRowIndex,
1602
- defaultColIndex = _ref.defaultColIndex,
1603
- defaultSelectedRowIndex = _ref.defaultSelectedRowIndex,
1604
- defaultSelectedColIndex = _ref.defaultSelectedColIndex,
1605
- placement = _ref.placement,
1606
- _onChange = _ref.onChange,
1607
- _onSelect = _ref.onSelect,
1608
- hasArrow = _ref.hasArrow,
1609
- isAnimated = _ref.isAnimated,
1610
- popperModifiers = _ref.popperModifiers,
1611
- zIndex = _ref.zIndex,
1612
- isOpen = _ref.isOpen,
1613
- focusInset = _ref.focusInset,
1614
- disabled = _ref.disabled,
1615
- buttonProps = _ref.buttonProps,
1616
- onDialogChange = _ref.onDialogChange,
1617
- children = _ref.children,
1618
- props = _objectWithoutProperties(_ref, _excluded);
1619
- var controlledFocus = rowIndex !== null && colIndex !== null && rowIndex !== undefined && colIndex !== undefined;
1620
- var controlledSelect = selectedRowIndex !== null && selectedColIndex !== null && selectedRowIndex !== undefined && selectedColIndex !== undefined;
1621
- var isControlled = controlledFocus || controlledSelect;
1622
- var isDialogControlled = isOpen !== undefined && isOpen !== null;
1623
- var buttonRef = React.useRef(null);
1624
- var colorSwatchRef = React.useRef(null);
1625
- var _useState = React.useState(),
1626
- _useState2 = _slicedToArray(_useState, 2),
1627
- referenceElement = _useState2[0],
1628
- setReferenceElement = _useState2[1];
1629
- var _useState3 = React.useState(defaultSelectedRowIndex || 0),
1630
- _useState4 = _slicedToArray(_useState3, 2),
1631
- uncontrolledSelectedRowIndex = _useState4[0],
1632
- setUncontrolledSelectedRowIndex = _useState4[1];
1633
- var _useState5 = React.useState(defaultSelectedColIndex || 0),
1634
- _useState6 = _slicedToArray(_useState5, 2),
1635
- uncontrolledSelectedColIndex = _useState6[0],
1636
- setUncontrolledSelectedColIndex = _useState6[1];
1637
- var _useState7 = React.useState(defaultRowIndex || 0),
1638
- _useState8 = _slicedToArray(_useState7, 2),
1639
- uncontrolledRowIndex = _useState8[0],
1640
- setUncontrolledRowIndex = _useState8[1];
1641
- var _useState9 = React.useState(defaultColIndex || 0),
1642
- _useState10 = _slicedToArray(_useState9, 2),
1643
- uncontrolledColIndex = _useState10[0],
1644
- setUncontrolledColIndex = _useState10[1];
1645
- React.useEffect(function () {
1449
+ let {
1450
+ colors,
1451
+ rowIndex,
1452
+ colIndex,
1453
+ selectedRowIndex,
1454
+ selectedColIndex,
1455
+ defaultRowIndex,
1456
+ defaultColIndex,
1457
+ defaultSelectedRowIndex,
1458
+ defaultSelectedColIndex,
1459
+ placement,
1460
+ onChange,
1461
+ onSelect,
1462
+ hasArrow,
1463
+ isAnimated,
1464
+ popperModifiers,
1465
+ zIndex,
1466
+ isOpen,
1467
+ focusInset,
1468
+ disabled,
1469
+ buttonProps,
1470
+ onDialogChange,
1471
+ children,
1472
+ ...props
1473
+ } = _ref;
1474
+ const controlledFocus = rowIndex !== null && colIndex !== null && rowIndex !== undefined && colIndex !== undefined;
1475
+ const controlledSelect = selectedRowIndex !== null && selectedColIndex !== null && selectedRowIndex !== undefined && selectedColIndex !== undefined;
1476
+ const isControlled = controlledFocus || controlledSelect;
1477
+ const isDialogControlled = isOpen !== undefined && isOpen !== null;
1478
+ const buttonRef = React.useRef(null);
1479
+ const colorSwatchRef = React.useRef(null);
1480
+ const [referenceElement, setReferenceElement] = React.useState();
1481
+ const [uncontrolledSelectedRowIndex, setUncontrolledSelectedRowIndex] = React.useState(defaultSelectedRowIndex || 0);
1482
+ const [uncontrolledSelectedColIndex, setUncontrolledSelectedColIndex] = React.useState(defaultSelectedColIndex || 0);
1483
+ const [uncontrolledRowIndex, setUncontrolledRowIndex] = React.useState(defaultRowIndex || 0);
1484
+ const [uncontrolledColIndex, setUncontrolledColIndex] = React.useState(defaultColIndex || 0);
1485
+ React.useEffect(() => {
1646
1486
  if (isDialogControlled) {
1647
1487
  if (isOpen) {
1648
1488
  setReferenceElement(buttonRef.current);
@@ -1651,21 +1491,21 @@ var ColorSwatchDialog = React.forwardRef(function (_ref, ref) {
1651
1491
  }
1652
1492
  }
1653
1493
  }, [isOpen, isDialogControlled]);
1654
- var uncontrolledSelectedColor;
1655
- var controlledSelectedColor;
1494
+ let uncontrolledSelectedColor;
1495
+ let controlledSelectedColor;
1656
1496
  if (uncontrolledSelectedRowIndex > -1 && uncontrolledSelectedColIndex > -1) {
1657
1497
  uncontrolledSelectedColor = colors[uncontrolledSelectedRowIndex][uncontrolledSelectedColIndex];
1658
1498
  }
1659
1499
  if (selectedRowIndex !== undefined && selectedColIndex !== undefined && selectedRowIndex > -1 && selectedColIndex > -1) {
1660
1500
  controlledSelectedColor = colors[selectedRowIndex][selectedColIndex];
1661
1501
  }
1662
- var openDialog = function openDialog() {
1502
+ const openDialog = () => {
1663
1503
  setReferenceElement(buttonRef.current);
1664
1504
  onDialogChange && onDialogChange({
1665
1505
  isOpen: true
1666
1506
  });
1667
1507
  };
1668
- var closeDialog = function closeDialog() {
1508
+ const closeDialog = () => {
1669
1509
  setUncontrolledRowIndex(uncontrolledSelectedRowIndex);
1670
1510
  setUncontrolledColIndex(uncontrolledSelectedColIndex);
1671
1511
  setReferenceElement(null);
@@ -1673,17 +1513,17 @@ var ColorSwatchDialog = React.forwardRef(function (_ref, ref) {
1673
1513
  isOpen: false
1674
1514
  });
1675
1515
  };
1676
- var onClick = containerUtilities.composeEventHandlers(props.onClick, function () {
1516
+ const onClick = containerUtilities.composeEventHandlers(props.onClick, () => {
1677
1517
  if (referenceElement) {
1678
1518
  closeDialog();
1679
1519
  } else {
1680
1520
  openDialog();
1681
1521
  }
1682
1522
  });
1683
- React.useEffect(function () {
1523
+ React.useEffect(() => {
1684
1524
  if (referenceElement && colorSwatchRef.current) {
1685
- var focusableButton = colorSwatchRef.current.querySelector('[tabindex="0"]');
1686
- var selectedCell = colorSwatchRef.current.querySelector('[aria-selected="true"]');
1525
+ const focusableButton = colorSwatchRef.current.querySelector('[tabindex="0"]');
1526
+ const selectedCell = colorSwatchRef.current.querySelector('[aria-selected="true"]');
1687
1527
  if (selectedCell) {
1688
1528
  selectedCell.children[0].focus();
1689
1529
  } else {
@@ -1692,7 +1532,7 @@ var ColorSwatchDialog = React.forwardRef(function (_ref, ref) {
1692
1532
  }
1693
1533
  }, [referenceElement]);
1694
1534
  return React__default["default"].createElement(React__default["default"].Fragment, null, children ? React.cloneElement(React.Children.only(children), {
1695
- onClick: onClick,
1535
+ onClick,
1696
1536
  ref: buttonRef
1697
1537
  }) : React__default["default"].createElement(StyledButton, _extends$2({
1698
1538
  disabled: disabled,
@@ -1724,23 +1564,24 @@ var ColorSwatchDialog = React.forwardRef(function (_ref, ref) {
1724
1564
  defaultColIndex: uncontrolledColIndex,
1725
1565
  defaultSelectedRowIndex: uncontrolledSelectedRowIndex,
1726
1566
  defaultSelectedColIndex: uncontrolledSelectedColIndex,
1727
- onChange: function onChange(rowIdx, colIdx) {
1567
+ onChange: (rowIdx, colIdx) => {
1728
1568
  if (isControlled === false) {
1729
1569
  setUncontrolledRowIndex(rowIdx);
1730
1570
  setUncontrolledColIndex(colIdx);
1731
1571
  }
1732
- _onChange && _onChange(rowIdx, colIdx);
1572
+ onChange && onChange(rowIdx, colIdx);
1733
1573
  },
1734
- onSelect: function onSelect(rowIdx, colIdx) {
1574
+ onSelect: (rowIdx, colIdx) => {
1735
1575
  if (isControlled === false) {
1736
1576
  setUncontrolledSelectedRowIndex(rowIdx);
1737
1577
  setUncontrolledSelectedColIndex(colIdx);
1738
1578
  }
1739
- _onSelect && _onSelect(rowIdx, colIdx);
1579
+ onSelect && onSelect(rowIdx, colIdx);
1740
1580
  }
1741
1581
  }))));
1742
1582
  });
1743
- ColorSwatchDialog.propTypes = _objectSpread2(_objectSpread2({}, ColorSwatch.propTypes), {}, {
1583
+ ColorSwatchDialog.propTypes = {
1584
+ ...ColorSwatch.propTypes,
1744
1585
  placement: PropTypes__default["default"].oneOf(reactModals.PLACEMENT),
1745
1586
  onDialogChange: PropTypes__default["default"].func,
1746
1587
  disabled: PropTypes__default["default"].bool,
@@ -1751,7 +1592,7 @@ ColorSwatchDialog.propTypes = _objectSpread2(_objectSpread2({}, ColorSwatch.prop
1751
1592
  isAnimated: PropTypes__default["default"].bool,
1752
1593
  focusInset: PropTypes__default["default"].bool,
1753
1594
  isOpen: PropTypes__default["default"].bool
1754
- });
1595
+ };
1755
1596
  ColorSwatchDialog.defaultProps = {
1756
1597
  placement: 'bottom-start',
1757
1598
  isAnimated: true,