@instructure/ui-color-picker 8.33.1 → 8.33.2-snapshot-5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/es/ColorContrast/ColorContrastLocator.js +3 -3
  3. package/es/ColorContrast/index.js +15 -34
  4. package/es/ColorContrast/props.js +1 -0
  5. package/es/ColorContrast/styles.js +0 -2
  6. package/es/ColorContrast/theme.js +5 -5
  7. package/es/ColorIndicator/ColorIndicatorLocator.js +3 -4
  8. package/es/ColorIndicator/index.js +1 -10
  9. package/es/ColorIndicator/props.js +1 -0
  10. package/es/ColorIndicator/styles.js +2 -5
  11. package/es/ColorIndicator/theme.js +6 -5
  12. package/es/ColorMixer/ColorMixerLocator.js +2 -7
  13. package/es/ColorMixer/ColorPalette/index.js +9 -50
  14. package/es/ColorMixer/ColorPalette/props.js +1 -0
  15. package/es/ColorMixer/ColorPalette/styles.js +2 -3
  16. package/es/ColorMixer/ColorPalette/theme.js +6 -5
  17. package/es/ColorMixer/RGBAInput/index.js +7 -19
  18. package/es/ColorMixer/RGBAInput/props.js +1 -0
  19. package/es/ColorMixer/RGBAInput/styles.js +0 -1
  20. package/es/ColorMixer/RGBAInput/theme.js +3 -3
  21. package/es/ColorMixer/Slider/index.js +7 -37
  22. package/es/ColorMixer/Slider/props.js +1 -0
  23. package/es/ColorMixer/Slider/styles.js +0 -2
  24. package/es/ColorMixer/Slider/theme.js +6 -5
  25. package/es/ColorMixer/index.js +25 -34
  26. package/es/ColorMixer/props.js +1 -0
  27. package/es/ColorMixer/styles.js +0 -1
  28. package/es/ColorMixer/utils/shallowCompare.js +1 -2
  29. package/es/ColorPicker/ColorPickerLocator.js +10 -23
  30. package/es/ColorPicker/index.js +24 -77
  31. package/es/ColorPicker/props.js +1 -0
  32. package/es/ColorPicker/styles.js +4 -5
  33. package/es/ColorPicker/theme.js +7 -6
  34. package/es/ColorPreset/ColorPresetLocator.js +7 -10
  35. package/es/ColorPreset/index.js +4 -28
  36. package/es/ColorPreset/props.js +1 -0
  37. package/es/ColorPreset/styles.js +0 -1
  38. package/es/ColorPreset/theme.js +4 -4
  39. package/lib/ColorContrast/ColorContrastLocator.js +1 -6
  40. package/lib/ColorContrast/index.js +14 -47
  41. package/lib/ColorContrast/props.js +1 -3
  42. package/lib/ColorContrast/styles.js +0 -3
  43. package/lib/ColorContrast/theme.js +5 -6
  44. package/lib/ColorIndicator/ColorIndicatorLocator.js +2 -7
  45. package/lib/ColorIndicator/index.js +0 -18
  46. package/lib/ColorIndicator/props.js +1 -3
  47. package/lib/ColorIndicator/styles.js +2 -6
  48. package/lib/ColorIndicator/theme.js +6 -7
  49. package/lib/ColorMixer/ColorMixerLocator.js +3 -11
  50. package/lib/ColorMixer/ColorPalette/index.js +8 -61
  51. package/lib/ColorMixer/ColorPalette/props.js +1 -3
  52. package/lib/ColorMixer/ColorPalette/styles.js +0 -4
  53. package/lib/ColorMixer/ColorPalette/theme.js +4 -6
  54. package/lib/ColorMixer/RGBAInput/index.js +6 -29
  55. package/lib/ColorMixer/RGBAInput/props.js +1 -3
  56. package/lib/ColorMixer/RGBAInput/styles.js +0 -2
  57. package/lib/ColorMixer/RGBAInput/theme.js +3 -4
  58. package/lib/ColorMixer/Slider/index.js +6 -46
  59. package/lib/ColorMixer/Slider/props.js +1 -3
  60. package/lib/ColorMixer/Slider/styles.js +0 -3
  61. package/lib/ColorMixer/Slider/theme.js +4 -6
  62. package/lib/ColorMixer/index.js +24 -46
  63. package/lib/ColorMixer/props.js +1 -3
  64. package/lib/ColorMixer/styles.js +0 -2
  65. package/lib/ColorMixer/utils/shallowCompare.js +1 -3
  66. package/lib/ColorPicker/ColorPickerLocator.js +10 -29
  67. package/lib/ColorPicker/index.js +24 -102
  68. package/lib/ColorPicker/props.js +1 -3
  69. package/lib/ColorPicker/styles.js +4 -6
  70. package/lib/ColorPicker/theme.js +5 -7
  71. package/lib/ColorPreset/ColorPresetLocator.js +3 -12
  72. package/lib/ColorPreset/index.js +3 -49
  73. package/lib/ColorPreset/props.js +1 -3
  74. package/lib/ColorPreset/styles.js +0 -2
  75. package/lib/ColorPreset/theme.js +4 -5
  76. package/lib/index.js +0 -5
  77. package/package.json +25 -25
  78. package/tsconfig.build.tsbuildinfo +1 -1
@@ -1,97 +1,64 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
4
-
5
4
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
6
-
7
5
  Object.defineProperty(exports, "__esModule", {
8
6
  value: true
9
7
  });
10
8
  exports.default = exports.ColorPicker = void 0;
11
-
12
9
  var _react = _interopRequireWildcard(require("react"));
13
-
14
10
  var _emotion = require("@instructure/emotion");
15
-
16
11
  var _console = require("@instructure/console");
17
-
18
12
  var _omitProps = require("@instructure/ui-react-utils/lib/omitProps.js");
19
-
20
13
  var _testable = require("@instructure/ui-testable/lib/testable.js");
21
-
22
14
  var _isValid = require("@instructure/ui-color-utils/lib/isValid.js");
23
-
24
15
  var _contrast = require("@instructure/ui-color-utils/lib/contrast.js");
25
-
26
16
  var _TextInput = require("@instructure/ui-text-input/lib/TextInput");
27
-
28
17
  var _Tooltip = require("@instructure/ui-tooltip/lib/Tooltip");
29
-
30
18
  var _Button = require("@instructure/ui-buttons/lib/Button");
31
-
32
19
  var _IconButton = require("@instructure/ui-buttons/lib/IconButton");
33
-
34
20
  var _Popover = require("@instructure/ui-popover/lib/Popover");
35
-
36
21
  var _IconCheckDarkLine2 = require("@instructure/ui-icons/lib/IconCheckDarkLine.js");
37
-
38
22
  var _IconWarningLine2 = require("@instructure/ui-icons/lib/IconWarningLine.js");
39
-
40
23
  var _IconTroubleLine2 = require("@instructure/ui-icons/lib/IconTroubleLine.js");
41
-
42
24
  var _IconInfoLine2 = require("@instructure/ui-icons/lib/IconInfoLine.js");
43
-
44
25
  var _ColorIndicator = _interopRequireDefault(require("../ColorIndicator"));
45
-
46
26
  var _ColorMixer = _interopRequireDefault(require("../ColorMixer"));
47
-
48
27
  var _ColorContrast = _interopRequireDefault(require("../ColorContrast"));
49
-
50
28
  var _ColorPreset = _interopRequireDefault(require("../ColorPreset"));
51
-
52
29
  var _styles = _interopRequireDefault(require("./styles"));
53
-
54
30
  var _theme = _interopRequireDefault(require("./theme"));
55
-
56
31
  var _props = require("./props");
57
-
58
32
  var _dec, _dec2, _class, _class2, _IconTroubleLine, _IconWarningLine, _IconCheckDarkLine, _IconInfoLine;
59
-
60
33
  const acceptedCharactersForHEX = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'A', 'b', 'B', 'c', 'C', 'd', 'D', 'e', 'E', 'f', 'F', null];
34
+
61
35
  /**
62
36
  ---
63
37
  category: components
64
38
  ---
65
39
  @tsProps
66
40
  **/
67
-
68
41
  let ColorPicker = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec2 = (0, _testable.testable)(), _dec(_class = _dec2(_class = (_class2 = class ColorPicker extends _react.Component {
69
42
  constructor(props) {
70
43
  super(props);
71
44
  this.ref = null;
72
-
73
45
  this.handleRef = el => {
74
46
  const elementRef = this.props.elementRef;
75
47
  this.ref = el;
76
-
77
48
  if (typeof elementRef === 'function') {
78
49
  elementRef(el);
79
50
  }
80
51
  };
81
-
82
52
  this.checkSettings = () => {
83
53
  if (this.props.children && this.props.colorMixerSettings) {
84
54
  (0, _console.warn)(false, 'You should either use children, colorMixerSettings or neither, not both. In this case, the colorMixerSettings will be ignored.', '');
85
55
  }
86
-
87
56
  if (this.props.value && typeof this.props.onChange !== 'function') {
88
57
  (0, _console.error)(false, 'You provided a `value` prop on ColorPicker, which will render a controlled component. Please provide an `onChange` handler.');
89
58
  }
90
59
  };
91
-
92
60
  this.renderPopover = () => {
93
61
  var _this$props$styles;
94
-
95
62
  return (0, _emotion.jsx)(_Popover.Popover, {
96
63
  renderTrigger: (0, _emotion.jsx)(_IconButton.IconButton, {
97
64
  disabled: this.props.disabled,
@@ -121,11 +88,10 @@ let ColorPicker = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.defaul
121
88
  css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.popoverContentContainer
122
89
  }, this.isDefaultPopover ? this.renderDefaultPopoverContent() : this.renderCustomPopoverContent()));
123
90
  };
124
-
125
91
  this.renderCustomPopoverContent = () => {
126
92
  const _this$props = this.props,
127
- children = _this$props.children,
128
- onChange = _this$props.onChange;
93
+ children = _this$props.children,
94
+ onChange = _this$props.onChange;
129
95
  return (0, _emotion.jsx)("div", null, typeof children === 'function' && children(`#${this.mixedColorWithStrippedAlpha}`, newColor => {
130
96
  this.setState({
131
97
  mixedColor: colorToHex8(newColor).slice(1)
@@ -141,10 +107,8 @@ let ColorPicker = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.defaul
141
107
  mixedColor: this.state.hexCode
142
108
  })));
143
109
  };
144
-
145
110
  this.renderDefaultPopoverContent = () => {
146
111
  var _this$props$styles2, _this$props2, _this$props2$colorMix, _this$props3, _this$props3$colorMix, _this$props$styles3, _this$props4, _this$props4$colorMix, _this$props$styles4, _this$props$styles5, _this$props$colorMixe, _this$props$colorMixe2;
147
-
148
112
  return (0, _emotion.jsx)(_react.default.Fragment, null, (0, _emotion.jsx)("div", {
149
113
  css: (_this$props$styles2 = this.props.styles) === null || _this$props$styles2 === void 0 ? void 0 : _this$props$styles2.popoverContent
150
114
  }, ((_this$props2 = this.props) === null || _this$props2 === void 0 ? void 0 : (_this$props2$colorMix = _this$props2.colorMixerSettings) === null || _this$props2$colorMix === void 0 ? void 0 : _this$props2$colorMix.colorMixer) && (0, _emotion.jsx)(_ColorMixer.default, {
@@ -209,7 +173,6 @@ let ColorPicker = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.defaul
209
173
  margin: "xx-small"
210
174
  }, (_this$props$colorMixe2 = this.props.colorMixerSettings) === null || _this$props$colorMixe2 === void 0 ? void 0 : _this$props$colorMixe2.popoverAddButtonLabel)));
211
175
  };
212
-
213
176
  this.state = {
214
177
  hexCode: '',
215
178
  showHelperErrorMessages: false,
@@ -217,11 +180,10 @@ let ColorPicker = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.defaul
217
180
  mixedColor: ''
218
181
  };
219
182
  }
220
-
221
183
  componentDidMount() {
222
184
  var _this$props$makeStyle, _this$props5, _this$props$value;
223
-
224
- (_this$props$makeStyle = (_this$props5 = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props5, { ...this.state,
185
+ (_this$props$makeStyle = (_this$props5 = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props5, {
186
+ ...this.state,
225
187
  isSimple: this.isSimple
226
188
  });
227
189
  this.checkSettings();
@@ -229,55 +191,43 @@ let ColorPicker = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.defaul
229
191
  hexCode: (_this$props$value = this.props.value) === null || _this$props$value === void 0 ? void 0 : _this$props$value.slice(1)
230
192
  });
231
193
  }
232
-
233
194
  componentDidUpdate(prevProps) {
234
195
  var _this$props$makeStyle2, _this$props6;
235
-
236
- (_this$props$makeStyle2 = (_this$props6 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props6, { ...this.state,
196
+ (_this$props$makeStyle2 = (_this$props6 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props6, {
197
+ ...this.state,
237
198
  isSimple: this.isSimple
238
199
  });
239
-
240
200
  if (prevProps.value !== this.props.value) {
241
201
  var _this$props$value2;
242
-
243
202
  this.setState({
244
203
  showHelperErrorMessages: false,
245
204
  hexCode: ((_this$props$value2 = this.props.value) === null || _this$props$value2 === void 0 ? void 0 : _this$props$value2.slice(1)) || ''
246
205
  });
247
206
  }
248
-
249
207
  this.checkSettings();
250
208
  }
251
-
252
209
  get renderMode() {
253
210
  if (this.props.children) {
254
211
  return 'customPopover';
255
212
  }
256
-
257
213
  if (this.props.colorMixerSettings) {
258
214
  return 'defaultPopover';
259
215
  }
260
-
261
216
  return 'simple';
262
217
  }
263
-
264
218
  get isSimple() {
265
219
  return this.renderMode === 'simple';
266
220
  }
267
-
268
221
  get isDefaultPopover() {
269
222
  return this.renderMode === 'defaultPopover';
270
223
  }
271
-
272
224
  get isCustomPopover() {
273
225
  return this.renderMode === 'customPopover';
274
226
  }
275
-
276
227
  get mixedColorWithStrippedAlpha() {
277
228
  const mixedColor = this.state.mixedColor;
278
229
  return mixedColor.length === 8 && mixedColor.slice(-2) === 'FF' ? mixedColor.slice(0, -2) : mixedColor;
279
230
  }
280
-
281
231
  getMinContrast(strength) {
282
232
  return {
283
233
  min: 3,
@@ -285,20 +235,18 @@ let ColorPicker = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.defaul
285
235
  max: 7
286
236
  }[strength];
287
237
  }
288
-
289
238
  renderMessages() {
290
239
  var _this$props$checkCont;
291
-
292
240
  const _this$state = this.state,
293
- hexCode = _this$state.hexCode,
294
- showHelperErrorMessages = _this$state.showHelperErrorMessages;
241
+ hexCode = _this$state.hexCode,
242
+ showHelperErrorMessages = _this$state.showHelperErrorMessages;
295
243
  const isValidHex = (0, _isValid.isValid)(hexCode);
296
244
  const _this$props7 = this.props,
297
- checkContrast = _this$props7.checkContrast,
298
- renderMessages = _this$props7.renderMessages,
299
- renderInvalidColorMessage = _this$props7.renderInvalidColorMessage,
300
- renderIsRequiredMessage = _this$props7.renderIsRequiredMessage,
301
- isRequired = _this$props7.isRequired;
245
+ checkContrast = _this$props7.checkContrast,
246
+ renderMessages = _this$props7.renderMessages,
247
+ renderInvalidColorMessage = _this$props7.renderInvalidColorMessage,
248
+ renderIsRequiredMessage = _this$props7.renderIsRequiredMessage,
249
+ isRequired = _this$props7.isRequired;
302
250
  const contrast = isValidHex ? (0, _contrast.contrast)(((_this$props$checkCont = this.props.checkContrast) === null || _this$props$checkCont === void 0 ? void 0 : _this$props$checkCont.contrastAgainst) || '#fff', hexCode, 2) : void 0;
303
251
  const contrastStrength = checkContrast !== null && checkContrast !== void 0 && checkContrast.contrastStrength ? checkContrast.contrastStrength : 'mid';
304
252
  const minContrast = this.getMinContrast(contrastStrength);
@@ -306,11 +254,9 @@ let ColorPicker = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.defaul
306
254
  let isRequiredMessages = [];
307
255
  let generalMessages = [];
308
256
  let contrastMessages = [];
309
-
310
257
  if (checkContrast && contrast) {
311
258
  const renderContrastSuccessMessage = checkContrast.renderContrastSuccessMessage,
312
- renderContrastErrorMessage = checkContrast.renderContrastErrorMessage;
313
-
259
+ renderContrastErrorMessage = checkContrast.renderContrastErrorMessage;
314
260
  if (contrast < minContrast) {
315
261
  contrastMessages = typeof renderContrastErrorMessage === 'function' ? renderContrastErrorMessage(contrast, minContrast) : checkContrast.isStrict ? [{
316
262
  type: 'error',
@@ -320,25 +266,20 @@ let ColorPicker = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.defaul
320
266
  contrastMessages = renderContrastSuccessMessage(contrast, minContrast);
321
267
  }
322
268
  }
323
-
324
269
  if (showHelperErrorMessages && hexCode !== '' && !isValidHex && typeof renderInvalidColorMessage === 'function') {
325
270
  invalidColorMessages = renderInvalidColorMessage(hexCode);
326
271
  }
327
-
328
272
  if (isRequired && showHelperErrorMessages && hexCode === '') {
329
273
  isRequiredMessages = typeof renderIsRequiredMessage === 'function' ? renderIsRequiredMessage() : [{
330
274
  type: 'error',
331
275
  text: '*'
332
276
  }];
333
277
  }
334
-
335
278
  if (typeof renderMessages === 'function') {
336
279
  generalMessages = renderMessages(hexCode, isValidHex, minContrast, contrast);
337
280
  }
338
-
339
281
  return [...invalidColorMessages, ...isRequiredMessages, ...generalMessages, ...contrastMessages];
340
282
  }
341
-
342
283
  renderBeforeInput() {
343
284
  const styles = this.props.styles;
344
285
  return (0, _emotion.jsx)("div", {
@@ -349,38 +290,30 @@ let ColorPicker = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.defaul
349
290
  css: styles === null || styles === void 0 ? void 0 : styles.hashMarkContainer
350
291
  }, "#"));
351
292
  }
352
-
353
293
  renderAfterInput() {
354
294
  const _this$props8 = this.props,
355
- checkContrast = _this$props8.checkContrast,
356
- styles = _this$props8.styles;
295
+ checkContrast = _this$props8.checkContrast,
296
+ styles = _this$props8.styles;
357
297
  const hexCode = this.state.hexCode;
358
-
359
298
  if (checkContrast && (0, _isValid.isValid)(hexCode)) {
360
299
  const contrast = (0, _contrast.contrast)(checkContrast.contrastAgainst || '#fff', hexCode, 2);
361
300
  const minContrast = this.getMinContrast(checkContrast.contrastStrength ? checkContrast.contrastStrength : 'mid');
362
-
363
301
  if (minContrast >= contrast) {
364
302
  return (0, _emotion.jsx)("div", {
365
303
  css: styles === null || styles === void 0 ? void 0 : styles.errorIcons
366
304
  }, checkContrast.isStrict ? _IconTroubleLine || (_IconTroubleLine = (0, _emotion.jsx)(_IconTroubleLine2.IconTroubleLine, null)) : _IconWarningLine || (_IconWarningLine = (0, _emotion.jsx)(_IconWarningLine2.IconWarningLine, null)));
367
305
  }
368
-
369
306
  return (0, _emotion.jsx)("div", {
370
307
  css: styles === null || styles === void 0 ? void 0 : styles.successIcon
371
308
  }, _IconCheckDarkLine || (_IconCheckDarkLine = (0, _emotion.jsx)(_IconCheckDarkLine2.IconCheckDarkLine, null)));
372
309
  }
373
-
374
310
  return null;
375
311
  }
376
-
377
312
  handleOnChange(_event, value) {
378
313
  const onChange = this.props.onChange;
379
-
380
314
  if (value.length > (this.props.withAlpha ? 8 : 6) || value.split('').find(char => !acceptedCharactersForHEX.includes(char)) !== void 0) {
381
315
  return;
382
316
  }
383
-
384
317
  if (typeof onChange === 'function') {
385
318
  onChange(`#${value}`);
386
319
  } else {
@@ -390,21 +323,16 @@ let ColorPicker = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.defaul
390
323
  });
391
324
  }
392
325
  }
393
-
394
326
  handleOnPaste(event) {
395
327
  const pasted = event.clipboardData.getData('Text');
396
328
  let toPaste = pasted;
397
-
398
329
  if (pasted[0] && pasted[0] === '#') {
399
330
  toPaste = pasted.slice(1);
400
331
  }
401
-
402
332
  if (this.props.withAlpha && toPaste.length > 8 || !this.props.withAlpha && toPaste.length > 6) {
403
333
  return event.preventDefault();
404
334
  }
405
-
406
335
  const newHex = `${this.state.hexCode}${toPaste}`;
407
-
408
336
  if ((0, _isValid.isValid)(newHex)) {
409
337
  if (typeof this.props.onChange === 'function') {
410
338
  this.props.onChange(`#${newHex}`);
@@ -415,21 +343,18 @@ let ColorPicker = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.defaul
415
343
  });
416
344
  }
417
345
  }
418
-
419
346
  event.preventDefault();
420
347
  }
421
-
422
348
  handleOnBlur() {
423
349
  this.setState({
424
350
  showHelperErrorMessages: true
425
351
  });
426
352
  }
427
-
428
353
  renderLabel() {
429
354
  const _this$props9 = this.props,
430
- label = _this$props9.label,
431
- tooltip = _this$props9.tooltip,
432
- styles = _this$props9.styles;
355
+ label = _this$props9.label,
356
+ tooltip = _this$props9.tooltip,
357
+ styles = _this$props9.styles;
433
358
  return tooltip ? (0, _emotion.jsx)("div", null, (0, _emotion.jsx)("span", {
434
359
  css: styles === null || styles === void 0 ? void 0 : styles.label
435
360
  }, label), (0, _emotion.jsx)("span", null, (0, _emotion.jsx)(_Tooltip.Tooltip, {
@@ -438,15 +363,13 @@ let ColorPicker = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.defaul
438
363
  tabIndex: -1
439
364
  }))))) : label;
440
365
  }
441
-
442
366
  render() {
443
367
  var _this$props$styles6, _this$props$styles7, _this$props$styles8;
444
-
445
368
  const _this$props10 = this.props,
446
- disabled = _this$props10.disabled,
447
- isRequired = _this$props10.isRequired,
448
- placeholderText = _this$props10.placeholderText,
449
- width = _this$props10.width;
369
+ disabled = _this$props10.disabled,
370
+ isRequired = _this$props10.isRequired,
371
+ placeholderText = _this$props10.placeholderText,
372
+ width = _this$props10.width;
450
373
  return (0, _emotion.jsx)("div", Object.assign({}, (0, _omitProps.omitProps)(this.props, ColorPicker.allowedProps), {
451
374
  css: (_this$props$styles6 = this.props.styles) === null || _this$props$styles6 === void 0 ? void 0 : _this$props$styles6.colorPicker,
452
375
  ref: this.handleRef
@@ -473,7 +396,6 @@ let ColorPicker = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.defaul
473
396
  css: (_this$props$styles8 = this.props.styles) === null || _this$props$styles8 === void 0 ? void 0 : _this$props$styles8.colorMixerButtonWrapper
474
397
  }, this.renderPopover())));
475
398
  }
476
-
477
399
  }, _class2.displayName = "ColorPicker", _class2.propTypes = _props.propTypes, _class2.allowedProps = _props.allowedProps, _class2.componentId = 'ColorPicker', _class2.defaultProps = {
478
400
  disabled: false,
479
401
  withAlpha: false,
@@ -1,14 +1,11 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.propTypes = exports.allowedProps = void 0;
9
-
10
8
  var _propTypes = _interopRequireDefault(require("prop-types"));
11
-
12
9
  /*
13
10
  * The MIT License (MIT)
14
11
  *
@@ -32,6 +29,7 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
32
29
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
33
30
  * SOFTWARE.
34
31
  */
32
+
35
33
  const propTypes = {
36
34
  checkContrast: _propTypes.default.shape({
37
35
  isStrict: _propTypes.default.bool,
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  /*
9
8
  * The MIT License (MIT)
10
9
  *
@@ -41,11 +40,11 @@ exports.default = void 0;
41
40
  */
42
41
  const generateStyle = (componentTheme, props, state) => {
43
42
  const hashMarkColor = componentTheme.hashMarkColor,
44
- errorIconColor = componentTheme.errorIconColor,
45
- warningIconColor = componentTheme.warningIconColor,
46
- successIconColor = componentTheme.successIconColor;
43
+ errorIconColor = componentTheme.errorIconColor,
44
+ warningIconColor = componentTheme.warningIconColor,
45
+ successIconColor = componentTheme.successIconColor;
47
46
  const checkContrast = props.checkContrast,
48
- popoverMaxHeight = props.popoverMaxHeight;
47
+ popoverMaxHeight = props.popoverMaxHeight;
49
48
  const isSimple = state.isSimple;
50
49
  return {
51
50
  colorPicker: {
@@ -123,6 +122,5 @@ const generateStyle = (componentTheme, props, state) => {
123
122
  }
124
123
  };
125
124
  };
126
-
127
125
  var _default = generateStyle;
128
126
  exports.default = _default;
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  var _theme = require("../ColorIndicator/theme");
9
-
10
8
  /*
11
9
  * The MIT License (MIT)
12
10
  *
@@ -38,9 +36,9 @@ var _theme = require("../ColorIndicator/theme");
38
36
  */
39
37
  const generateComponentTheme = theme => {
40
38
  const colors = theme.colors,
41
- borders = theme.borders,
42
- spacing = theme.spacing,
43
- typography = theme.typography;
39
+ borders = theme.borders,
40
+ spacing = theme.spacing,
41
+ typography = theme.typography;
44
42
  const componentVariables = {
45
43
  hashMarkColor: colors === null || colors === void 0 ? void 0 : colors.ash,
46
44
  warningIconColor: colors === null || colors === void 0 ? void 0 : colors.textWarning,
@@ -78,9 +76,9 @@ const generateComponentTheme = theme => {
78
76
  popoverFooterTopBorderWidth: borders === null || borders === void 0 ? void 0 : borders.widthSmall,
79
77
  colorMixerButtonContainerLeftMargin: spacing === null || spacing === void 0 ? void 0 : spacing.xSmall
80
78
  };
81
- return { ...componentVariables
79
+ return {
80
+ ...componentVariables
82
81
  };
83
82
  };
84
-
85
83
  var _default = generateComponentTheme;
86
84
  exports.default = _default;
@@ -4,21 +4,13 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.ColorPresetLocator = void 0;
7
-
8
7
  var _locator = require("@instructure/ui-test-locator/lib/utils/locator.js");
9
-
10
8
  var _uiTestQueries = require("@instructure/ui-test-queries");
11
-
12
9
  var _DrilldownLocator = require("@instructure/ui-drilldown/lib/Drilldown/DrilldownLocator");
13
-
14
10
  var _TooltipLocator = require("@instructure/ui-tooltip/lib/Tooltip/TooltipLocator");
15
-
16
11
  var _PopoverLocator = require("@instructure/ui-popover/lib/Popover/PopoverLocator");
17
-
18
12
  var _ColorIndicatorLocator = require("../ColorIndicator/ColorIndicatorLocator");
19
-
20
13
  var _index = require("./index");
21
-
22
14
  /*
23
15
  * The MIT License (MIT)
24
16
  *
@@ -45,10 +37,13 @@ var _index = require("./index");
45
37
 
46
38
  /* eslint-disable no-restricted-imports */
47
39
  // @ts-expect-error bypass no type definition found error
40
+
48
41
  // @ts-expect-error bypass no type definition found error
42
+
49
43
  // @ts-expect-error bypass no type definition found error
50
44
 
51
45
  /* eslint-enable no-restricted-imports */
46
+
52
47
  // @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message
53
48
  const ColorPresetLocator = (0, _locator.locator)(_index.ColorPreset.selector, {
54
49
  findAllColorIndicators: function () {
@@ -64,20 +59,16 @@ const ColorPresetLocator = (0, _locator.locator)(_index.ColorPreset.selector, {
64
59
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
65
60
  args[_key] = arguments[_key];
66
61
  }
67
-
68
62
  const selected = await (0, _uiTestQueries.find)('[aria-label="selected"]', ...args);
69
-
70
63
  if (!selected) {
71
64
  return selected;
72
65
  }
73
-
74
66
  return await _ColorIndicatorLocator.ColorIndicatorLocator.find(selected.getDOMNode());
75
67
  },
76
68
  findSelectedIcon: function () {
77
69
  for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
78
70
  args[_key2] = arguments[_key2];
79
71
  }
80
-
81
72
  return (0, _uiTestQueries.find)('[class$=-colorPreset__selectedIndicator]', ...args);
82
73
  },
83
74
  findAddColorPopoverContent: function () {