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