@instructure/ui-color-picker 9.5.1-snapshot-0 → 9.5.1-snapshot-2

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/CHANGELOG.md CHANGED
@@ -3,9 +3,12 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
- ## [9.5.1-snapshot-0](https://github.com/instructure/instructure-ui/compare/v9.5.0...v9.5.1-snapshot-0) (2024-07-26)
6
+ ## [9.5.1-snapshot-2](https://github.com/instructure/instructure-ui/compare/v9.5.0...v9.5.1-snapshot-2) (2024-07-30)
7
7
 
8
- **Note:** Version bump only for package @instructure/ui-color-picker
8
+
9
+ ### Bug Fixes
10
+
11
+ * **ui-color-picker,ui-color-utils:** fix corrupted CJS build ([e1016be](https://github.com/instructure/instructure-ui/commit/e1016be3bc32307f8b05fdf1d4176e4915cc8dd6))
9
12
 
10
13
 
11
14
 
@@ -29,7 +29,8 @@ import React, { Component } from 'react';
29
29
  import { omitProps } from '@instructure/ui-react-utils';
30
30
  import { testable } from '@instructure/ui-testable';
31
31
  import { error } from '@instructure/console';
32
- import { contrast as getContrast, colorToRGB, colorToHex8 } from '@instructure/ui-color-utils';
32
+ import { contrast as getContrast } from '@instructure/ui-color-utils';
33
+ import conversions from '@instructure/ui-color-utils';
33
34
  import { withStyle, jsx } from '@instructure/emotion';
34
35
  import { Text } from '@instructure/ui-text';
35
36
  import { Pill } from '@instructure/ui-pill';
@@ -124,8 +125,8 @@ let ColorContrast = (_dec = withStyle(generateStyle, generateComponentTheme), _d
124
125
  //We project the firstColor onto an opaque white background, then we project the secondColor onto
125
126
  //the projected first color. We calculate the contrast of these two, projected colors.
126
127
  get calcContrast() {
127
- const c1RGBA = colorToRGB(this.props.firstColor);
128
- const c2RGBA = colorToRGB(this.props.secondColor);
128
+ const c1RGBA = conversions.colorToRGB(this.props.firstColor);
129
+ const c2RGBA = conversions.colorToRGB(this.props.secondColor);
129
130
  const c1OnWhite = this.calcBlendedColor({
130
131
  r: 255,
131
132
  g: 255,
@@ -133,7 +134,7 @@ let ColorContrast = (_dec = withStyle(generateStyle, generateComponentTheme), _d
133
134
  a: 1
134
135
  }, c1RGBA);
135
136
  const c2OnC1OnWhite = this.calcBlendedColor(c1OnWhite, c2RGBA);
136
- return getContrast(colorToHex8(c1OnWhite), colorToHex8(c2OnC1OnWhite), 2);
137
+ return getContrast(conversions.colorToHex8(c1OnWhite), conversions.colorToHex8(c2OnC1OnWhite), 2);
137
138
  }
138
139
  render() {
139
140
  const _this$props5 = this.props,
@@ -22,8 +22,8 @@
22
22
  * SOFTWARE.
23
23
  */
24
24
 
25
+ import conversions from '@instructure/ui-color-utils';
25
26
  import { isValid } from '@instructure/ui-color-utils';
26
- import { colorToRGB } from '@instructure/ui-color-utils';
27
27
  const calcBlendedColor = (c1, c2) => {
28
28
  // 0.4 as decided by design
29
29
  const c2Alpha = c2.a * 0.4;
@@ -61,7 +61,7 @@ const generateStyle = (componentTheme, props) => {
61
61
  backgroundImage: componentTheme.backgroundImage,
62
62
  backgroundSize: componentTheme.backgroundSize,
63
63
  backgroundPosition: componentTheme.backgroundPosition,
64
- borderColor: calcBlendedColor(colorToRGB(componentTheme.colorIndicatorBorderColor), colorToRGB(isValid(color) ? color : '#fff'))
64
+ borderColor: calcBlendedColor(conversions.colorToRGB(componentTheme.colorIndicatorBorderColor), conversions.colorToRGB(isValid(color) ? color : '#fff'))
65
65
  }
66
66
  };
67
67
  };
@@ -33,7 +33,7 @@ import '@testing-library/jest-dom';
33
33
  import { generateA11yTests } from '@instructure/ui-scripts/lib/test/generateA11yTests';
34
34
  import { runAxeCheck } from '@instructure/ui-axe-check';
35
35
  import { deepEqual } from '@instructure/ui-utils';
36
- import { colorToHex8, colorToRGB } from '@instructure/ui-color-utils';
36
+ import conversions from '@instructure/ui-color-utils';
37
37
  import { ColorMixer } from '../';
38
38
  import ColorMixerExamples from '../__examples__/ColorMixer.examples';
39
39
  const testValue = {
@@ -144,7 +144,7 @@ describe('<ColorMixer />', () => {
144
144
  g = _inputs$map2[1],
145
145
  b = _inputs$map2[2],
146
146
  a = _inputs$map2[3];
147
- const colorHex = colorToHex8({
147
+ const colorHex = conversions.colorToHex8({
148
148
  r,
149
149
  g,
150
150
  b,
@@ -169,7 +169,7 @@ describe('<ColorMixer />', () => {
169
169
  g = _inputs$map4[1],
170
170
  b = _inputs$map4[2],
171
171
  a = _inputs$map4[3];
172
- const rgba = colorToRGB(colorInput);
172
+ const rgba = conversions.colorToRGB(colorInput);
173
173
  rgba.a = Math.round(rgba.a * 100);
174
174
  expect(deepEqual(rgba, {
175
175
  r,
@@ -193,7 +193,7 @@ describe('<ColorMixer />', () => {
193
193
  g = _inputs$map6[1],
194
194
  b = _inputs$map6[2],
195
195
  a = _inputs$map6[3];
196
- const colorHex = colorToHex8({
196
+ const colorHex = conversions.colorToHex8({
197
197
  r,
198
198
  g,
199
199
  b,
@@ -28,7 +28,8 @@ import { Component } from 'react';
28
28
  import { withStyle, jsx } from '@instructure/emotion';
29
29
  import { omitProps } from '@instructure/ui-react-utils';
30
30
  import { testable } from '@instructure/ui-testable';
31
- import { colorToHex8, colorToHsva, colorToRGB, isValid } from '@instructure/ui-color-utils';
31
+ import { isValid } from '@instructure/ui-color-utils';
32
+ import conversions from '@instructure/ui-color-utils';
32
33
  import { logWarn as warn } from '@instructure/console';
33
34
  import ColorPalette from './ColorPalette';
34
35
  import Slider from './Slider';
@@ -69,7 +70,7 @@ let ColorMixer = (_dec = withStyle(generateStyle, null), _dec2 = testable(), _de
69
70
  (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
70
71
  warn(isValid(this.props.value), `[ColorMixer] The passed color value is not valid.`);
71
72
  this.setState({
72
- ...colorToHsva(this.props.value)
73
+ ...conversions.colorToHsva(this.props.value)
73
74
  });
74
75
  }
75
76
  componentDidUpdate(prevProps, prevState) {
@@ -81,21 +82,21 @@ let ColorMixer = (_dec = withStyle(generateStyle, null), _dec2 = testable(), _de
81
82
  v = _this$state.v,
82
83
  a = _this$state.a;
83
84
  if (prevState.h !== h || prevState.s !== s || prevState.v !== v || prevState.a !== a) {
84
- this.props.onChange(colorToHex8({
85
+ this.props.onChange(conversions.colorToHex8({
85
86
  h,
86
87
  s,
87
88
  v,
88
89
  a
89
90
  }));
90
91
  }
91
- if (prevProps.value !== this.props.value && colorToHex8({
92
+ if (prevProps.value !== this.props.value && conversions.colorToHex8({
92
93
  h,
93
94
  s,
94
95
  v,
95
96
  a
96
97
  }) !== this.props.value) {
97
98
  this.setState({
98
- ...colorToHsva(this.props.value)
99
+ ...conversions.colorToHsva(this.props.value)
99
100
  });
100
101
  }
101
102
  }
@@ -122,7 +123,7 @@ let ColorMixer = (_dec = withStyle(generateStyle, null), _dec2 = testable(), _de
122
123
  css: styles === null || styles === void 0 ? void 0 : styles.colorMixer
123
124
  }), jsx("span", {
124
125
  css: styles === null || styles === void 0 ? void 0 : styles.sliderAndPaletteContainer,
125
- "aria-label": `${colorToHex8({
126
+ "aria-label": `${conversions.colorToHex8({
126
127
  h,
127
128
  s,
128
129
  v,
@@ -156,7 +157,7 @@ let ColorMixer = (_dec = withStyle(generateStyle, null), _dec2 = testable(), _de
156
157
  value: h,
157
158
  minValue: 0,
158
159
  maxValue: 359,
159
- color: colorToHex8({
160
+ color: conversions.colorToHex8({
160
161
  h,
161
162
  s,
162
163
  v,
@@ -173,7 +174,7 @@ let ColorMixer = (_dec = withStyle(generateStyle, null), _dec2 = testable(), _de
173
174
  width: this._width,
174
175
  height: this._sliderHeight,
175
176
  indicatorRadius: this._sliderIndicatorRadius,
176
- color: colorToHex8({
177
+ color: conversions.colorToHex8({
177
178
  h,
178
179
  s,
179
180
  v
@@ -189,14 +190,14 @@ let ColorMixer = (_dec = withStyle(generateStyle, null), _dec2 = testable(), _de
189
190
  disabled: disabled,
190
191
  label: withAlpha ? 'RGBA' : 'RGB',
191
192
  width: this._width,
192
- value: colorToRGB({
193
+ value: conversions.colorToRGB({
193
194
  h,
194
195
  s,
195
196
  v,
196
197
  a
197
198
  }),
198
199
  onChange: color => this.setState({
199
- ...colorToHsva(color)
200
+ ...conversions.colorToHsva(color)
200
201
  }),
201
202
  withAlpha: withAlpha,
202
203
  rgbRedInputScreenReaderLabel: rgbRedInputScreenReaderLabel,
@@ -32,7 +32,7 @@ import '@testing-library/jest-dom';
32
32
  // eslint-disable-next-line no-restricted-imports
33
33
  import { generateA11yTests } from '@instructure/ui-scripts/lib/test/generateA11yTests';
34
34
  import { runAxeCheck } from '@instructure/ui-axe-check';
35
- import { color2hex, colorToRGB } from '@instructure/ui-color-utils';
35
+ import conversions from '@instructure/ui-color-utils';
36
36
  import ColorPickerExamples from '../__examples__/ColorPicker.examples';
37
37
  import { ColorPicker } from '../';
38
38
  const SimpleExample = props => {
@@ -397,7 +397,7 @@ describe('<ColorPicker />', () => {
397
397
  const redInput = screen.getByLabelText('Red input');
398
398
  const blueInput = screen.getByLabelText('Blue input');
399
399
  const greenInput = screen.getByLabelText('Green input');
400
- const convertedColor = colorToRGB(`#${color}`);
400
+ const convertedColor = conversions.colorToRGB(`#${color}`);
401
401
  const actualColor = {
402
402
  r: parseInt(redInput.value),
403
403
  g: parseInt(greenInput.value),
@@ -457,7 +457,7 @@ describe('<ColorPicker />', () => {
457
457
  }
458
458
  });
459
459
  fireEvent.click(addBtn);
460
- expect(onChange).toHaveBeenCalledWith(color2hex(rgb));
460
+ expect(onChange).toHaveBeenCalledWith(conversions.color2hex(rgb));
461
461
  });
462
462
  });
463
463
  });
@@ -30,7 +30,8 @@ import { withStyle, jsx } from '@instructure/emotion';
30
30
  import { warn, error } from '@instructure/console';
31
31
  import { omitProps } from '@instructure/ui-react-utils';
32
32
  import { testable } from '@instructure/ui-testable';
33
- import { colorToHex8, isValid, contrast as getContrast } from '@instructure/ui-color-utils';
33
+ import { isValid, contrast as getContrast } from '@instructure/ui-color-utils';
34
+ import conversions from '@instructure/ui-color-utils';
34
35
  import { TextInput } from '@instructure/ui-text-input';
35
36
  import { Tooltip } from '@instructure/ui-tooltip';
36
37
  import { Button, IconButton } from '@instructure/ui-buttons';
@@ -119,7 +120,7 @@ let ColorPicker = (_dec = withStyle(generateStyle, generateComponentTheme), _dec
119
120
  onChange = _this$props.onChange;
120
121
  return jsx("div", null, typeof children === 'function' && children(`#${this.mixedColorWithStrippedAlpha}`, newColor => {
121
122
  this.setState({
122
- mixedColor: colorToHex8(newColor).slice(1)
123
+ mixedColor: conversions.colorToHex8(newColor).slice(1)
123
124
  });
124
125
  }, () => {
125
126
  this.setState({
@@ -139,7 +140,7 @@ let ColorPicker = (_dec = withStyle(generateStyle, generateComponentTheme), _dec
139
140
  }, ((_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) && jsx(ColorMixer, {
140
141
  value: `#${this.state.mixedColor}`,
141
142
  onChange: newColor => this.setState({
142
- mixedColor: colorToHex8(newColor).slice(1)
143
+ mixedColor: conversions.colorToHex8(newColor).slice(1)
143
144
  }),
144
145
  withAlpha: this.props.colorMixerSettings.colorMixer.withAlpha,
145
146
  rgbRedInputScreenReaderLabel: this.props.colorMixerSettings.colorMixer.rgbRedInputScreenReaderLabel,
@@ -28,7 +28,7 @@ import { Component } from 'react';
28
28
  import { withStyle, jsx } from '@instructure/emotion';
29
29
  import { omitProps } from '@instructure/ui-react-utils';
30
30
  import { testable } from '@instructure/ui-testable';
31
- import { colorToHex8, colorToRGB } from '@instructure/ui-color-utils';
31
+ import conversions from '@instructure/ui-color-utils';
32
32
  import { IconButton, Button } from '@instructure/ui-buttons';
33
33
  import { View } from '@instructure/ui-view';
34
34
  import { Tooltip } from '@instructure/ui-tooltip';
@@ -99,9 +99,9 @@ let ColorPreset = (_dec = withStyle(generateStyle, generateComponentTheme), _dec
99
99
  }, jsx("div", {
100
100
  css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.popoverContent
101
101
  }, jsx(ColorMixer, {
102
- value: colorToHex8(this.state.newColor),
102
+ value: conversions.colorToHex8(this.state.newColor),
103
103
  onChange: newColor => this.setState({
104
- newColor: colorToRGB(newColor)
104
+ newColor: conversions.colorToRGB(newColor)
105
105
  }),
106
106
  withAlpha: (_this$props3 = this.props) === null || _this$props3 === void 0 ? void 0 : (_this$props3$colorMix = _this$props3.colorMixerSettings) === null || _this$props3$colorMix === void 0 ? void 0 : (_this$props3$colorMix2 = _this$props3$colorMix.colorMixer) === null || _this$props3$colorMix2 === void 0 ? void 0 : _this$props3$colorMix2.withAlpha,
107
107
  rgbRedInputScreenReaderLabel: this.props.colorMixerSettings.colorMixer.rgbRedInputScreenReaderLabel,
@@ -115,7 +115,7 @@ let ColorPreset = (_dec = withStyle(generateStyle, generateComponentTheme), _dec
115
115
  css: (_this$props$styles2 = this.props.styles) === null || _this$props$styles2 === void 0 ? void 0 : _this$props$styles2.popoverContrastBlock
116
116
  }, jsx(ColorContrast, {
117
117
  firstColor: this.props.colorMixerSettings.colorContrast.firstColor,
118
- secondColor: colorToHex8(this.state.newColor),
118
+ secondColor: conversions.colorToHex8(this.state.newColor),
119
119
  label: this.props.colorMixerSettings.colorContrast.label,
120
120
  successLabel: this.props.colorMixerSettings.colorContrast.successLabel,
121
121
  failureLabel: this.props.colorMixerSettings.colorContrast.failureLabel,
@@ -129,7 +129,7 @@ let ColorPreset = (_dec = withStyle(generateStyle, generateComponentTheme), _dec
129
129
  }, jsx(Button, {
130
130
  onClick: () => {
131
131
  var _this$props5, _this$props5$colorMix;
132
- (_this$props5 = this.props) === null || _this$props5 === void 0 ? void 0 : (_this$props5$colorMix = _this$props5.colorMixerSettings) === null || _this$props5$colorMix === void 0 ? void 0 : _this$props5$colorMix.onPresetChange([colorToHex8(this.state.newColor), ...this.props.colors]);
132
+ (_this$props5 = this.props) === null || _this$props5 === void 0 ? void 0 : (_this$props5$colorMix = _this$props5.colorMixerSettings) === null || _this$props5$colorMix === void 0 ? void 0 : _this$props5$colorMix.onPresetChange([conversions.colorToHex8(this.state.newColor), ...this.props.colors]);
133
133
  this.setState({
134
134
  openAddNew: false
135
135
  });
@@ -226,7 +226,7 @@ let ColorPreset = (_dec = withStyle(generateStyle, generateComponentTheme), _dec
226
226
  }
227
227
  isSelectedColor(color) {
228
228
  const selected = this.props.selected;
229
- return !!selected && colorToHex8(selected) === colorToHex8(color);
229
+ return !!selected && conversions.colorToHex8(selected) === conversions.colorToHex8(color);
230
230
  }
231
231
  render() {
232
232
  const _this$props9 = this.props,
@@ -11,6 +11,7 @@ var _omitProps = require("@instructure/ui-react-utils/lib/omitProps.js");
11
11
  var _testable = require("@instructure/ui-testable/lib/testable.js");
12
12
  var _console = require("@instructure/console");
13
13
  var _contrast = require("@instructure/ui-color-utils/lib/contrast.js");
14
+ var _uiColorUtils = _interopRequireDefault(require("@instructure/ui-color-utils"));
14
15
  var _emotion = require("@instructure/emotion");
15
16
  var _Text = require("@instructure/ui-text/lib/Text");
16
17
  var _Pill = require("@instructure/ui-pill/lib/Pill");
@@ -130,8 +131,8 @@ let ColorContrast = exports.ColorContrast = (_dec = (0, _emotion.withStyle)(_sty
130
131
  //We project the firstColor onto an opaque white background, then we project the secondColor onto
131
132
  //the projected first color. We calculate the contrast of these two, projected colors.
132
133
  get calcContrast() {
133
- const c1RGBA = colorToRGB(this.props.firstColor);
134
- const c2RGBA = colorToRGB(this.props.secondColor);
134
+ const c1RGBA = _uiColorUtils.default.colorToRGB(this.props.firstColor);
135
+ const c2RGBA = _uiColorUtils.default.colorToRGB(this.props.secondColor);
135
136
  const c1OnWhite = this.calcBlendedColor({
136
137
  r: 255,
137
138
  g: 255,
@@ -139,7 +140,7 @@ let ColorContrast = exports.ColorContrast = (_dec = (0, _emotion.withStyle)(_sty
139
140
  a: 1
140
141
  }, c1RGBA);
141
142
  const c2OnC1OnWhite = this.calcBlendedColor(c1OnWhite, c2RGBA);
142
- return (0, _contrast.contrast)(colorToHex8(c1OnWhite), colorToHex8(c2OnC1OnWhite), 2);
143
+ return (0, _contrast.contrast)(_uiColorUtils.default.colorToHex8(c1OnWhite), _uiColorUtils.default.colorToHex8(c2OnC1OnWhite), 2);
143
144
  }
144
145
  render() {
145
146
  const _this$props5 = this.props,
@@ -1,11 +1,12 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
3
4
  Object.defineProperty(exports, "__esModule", {
4
5
  value: true
5
6
  });
6
7
  exports.default = void 0;
8
+ var _uiColorUtils = _interopRequireDefault(require("@instructure/ui-color-utils"));
7
9
  var _isValid = require("@instructure/ui-color-utils/lib/isValid.js");
8
- var _uiColorUtils = require("@instructure/ui-color-utils");
9
10
  /*
10
11
  * The MIT License (MIT)
11
12
  *
@@ -67,7 +68,7 @@ const generateStyle = (componentTheme, props) => {
67
68
  backgroundImage: componentTheme.backgroundImage,
68
69
  backgroundSize: componentTheme.backgroundSize,
69
70
  backgroundPosition: componentTheme.backgroundPosition,
70
- borderColor: calcBlendedColor((0, _uiColorUtils.colorToRGB)(componentTheme.colorIndicatorBorderColor), (0, _uiColorUtils.colorToRGB)((0, _isValid.isValid)(color) ? color : '#fff'))
71
+ borderColor: calcBlendedColor(_uiColorUtils.default.colorToRGB(componentTheme.colorIndicatorBorderColor), _uiColorUtils.default.colorToRGB((0, _isValid.isValid)(color) ? color : '#fff'))
71
72
  }
72
73
  };
73
74
  };
@@ -10,7 +10,7 @@ require("@testing-library/jest-dom");
10
10
  var _generateA11yTests = require("@instructure/ui-scripts/lib/test/generateA11yTests");
11
11
  var _runAxeCheck = require("@instructure/ui-axe-check/lib/runAxeCheck.js");
12
12
  var _deepEqual = require("@instructure/ui-utils/lib/deepEqual.js");
13
- var _uiColorUtils = require("@instructure/ui-color-utils");
13
+ var _uiColorUtils = _interopRequireDefault(require("@instructure/ui-color-utils"));
14
14
  var _ = require("../");
15
15
  var _ColorMixer = _interopRequireDefault(require("../__examples__/ColorMixer.examples"));
16
16
  /*
@@ -147,7 +147,7 @@ describe('<ColorMixer />', () => {
147
147
  g = _inputs$map2[1],
148
148
  b = _inputs$map2[2],
149
149
  a = _inputs$map2[3];
150
- const colorHex = (0, _uiColorUtils.colorToHex8)({
150
+ const colorHex = _uiColorUtils.default.colorToHex8({
151
151
  r,
152
152
  g,
153
153
  b,
@@ -172,7 +172,7 @@ describe('<ColorMixer />', () => {
172
172
  g = _inputs$map4[1],
173
173
  b = _inputs$map4[2],
174
174
  a = _inputs$map4[3];
175
- const rgba = (0, _uiColorUtils.colorToRGB)(colorInput);
175
+ const rgba = _uiColorUtils.default.colorToRGB(colorInput);
176
176
  rgba.a = Math.round(rgba.a * 100);
177
177
  expect((0, _deepEqual.deepEqual)(rgba, {
178
178
  r,
@@ -196,7 +196,7 @@ describe('<ColorMixer />', () => {
196
196
  g = _inputs$map6[1],
197
197
  b = _inputs$map6[2],
198
198
  a = _inputs$map6[3];
199
- const colorHex = (0, _uiColorUtils.colorToHex8)({
199
+ const colorHex = _uiColorUtils.default.colorToHex8({
200
200
  r,
201
201
  g,
202
202
  b,
@@ -10,6 +10,7 @@ var _emotion = require("@instructure/emotion");
10
10
  var _omitProps = require("@instructure/ui-react-utils/lib/omitProps.js");
11
11
  var _testable = require("@instructure/ui-testable/lib/testable.js");
12
12
  var _isValid = require("@instructure/ui-color-utils/lib/isValid.js");
13
+ var _uiColorUtils = _interopRequireDefault(require("@instructure/ui-color-utils"));
13
14
  var _console = require("@instructure/console");
14
15
  var _ColorPalette = _interopRequireDefault(require("./ColorPalette"));
15
16
  var _Slider = _interopRequireDefault(require("./Slider"));
@@ -74,7 +75,7 @@ let ColorMixer = exports.ColorMixer = (_dec = (0, _emotion.withStyle)(_styles.de
74
75
  (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
75
76
  (0, _console.logWarn)((0, _isValid.isValid)(this.props.value), `[ColorMixer] The passed color value is not valid.`);
76
77
  this.setState({
77
- ...colorToHsva(this.props.value)
78
+ ..._uiColorUtils.default.colorToHsva(this.props.value)
78
79
  });
79
80
  }
80
81
  componentDidUpdate(prevProps, prevState) {
@@ -86,21 +87,21 @@ let ColorMixer = exports.ColorMixer = (_dec = (0, _emotion.withStyle)(_styles.de
86
87
  v = _this$state.v,
87
88
  a = _this$state.a;
88
89
  if (prevState.h !== h || prevState.s !== s || prevState.v !== v || prevState.a !== a) {
89
- this.props.onChange(colorToHex8({
90
+ this.props.onChange(_uiColorUtils.default.colorToHex8({
90
91
  h,
91
92
  s,
92
93
  v,
93
94
  a
94
95
  }));
95
96
  }
96
- if (prevProps.value !== this.props.value && colorToHex8({
97
+ if (prevProps.value !== this.props.value && _uiColorUtils.default.colorToHex8({
97
98
  h,
98
99
  s,
99
100
  v,
100
101
  a
101
102
  }) !== this.props.value) {
102
103
  this.setState({
103
- ...colorToHsva(this.props.value)
104
+ ..._uiColorUtils.default.colorToHsva(this.props.value)
104
105
  });
105
106
  }
106
107
  }
@@ -127,7 +128,7 @@ let ColorMixer = exports.ColorMixer = (_dec = (0, _emotion.withStyle)(_styles.de
127
128
  css: styles === null || styles === void 0 ? void 0 : styles.colorMixer
128
129
  }), (0, _emotion.jsx)("span", {
129
130
  css: styles === null || styles === void 0 ? void 0 : styles.sliderAndPaletteContainer,
130
- "aria-label": `${colorToHex8({
131
+ "aria-label": `${_uiColorUtils.default.colorToHex8({
131
132
  h,
132
133
  s,
133
134
  v,
@@ -161,7 +162,7 @@ let ColorMixer = exports.ColorMixer = (_dec = (0, _emotion.withStyle)(_styles.de
161
162
  value: h,
162
163
  minValue: 0,
163
164
  maxValue: 359,
164
- color: colorToHex8({
165
+ color: _uiColorUtils.default.colorToHex8({
165
166
  h,
166
167
  s,
167
168
  v,
@@ -178,7 +179,7 @@ let ColorMixer = exports.ColorMixer = (_dec = (0, _emotion.withStyle)(_styles.de
178
179
  width: this._width,
179
180
  height: this._sliderHeight,
180
181
  indicatorRadius: this._sliderIndicatorRadius,
181
- color: colorToHex8({
182
+ color: _uiColorUtils.default.colorToHex8({
182
183
  h,
183
184
  s,
184
185
  v
@@ -194,14 +195,14 @@ let ColorMixer = exports.ColorMixer = (_dec = (0, _emotion.withStyle)(_styles.de
194
195
  disabled: disabled,
195
196
  label: withAlpha ? 'RGBA' : 'RGB',
196
197
  width: this._width,
197
- value: colorToRGB({
198
+ value: _uiColorUtils.default.colorToRGB({
198
199
  h,
199
200
  s,
200
201
  v,
201
202
  a
202
203
  }),
203
204
  onChange: color => this.setState({
204
- ...colorToHsva(color)
205
+ ..._uiColorUtils.default.colorToHsva(color)
205
206
  }),
206
207
  withAlpha: withAlpha,
207
208
  rgbRedInputScreenReaderLabel: rgbRedInputScreenReaderLabel,
@@ -8,7 +8,7 @@ var _vitest = require("vitest");
8
8
  require("@testing-library/jest-dom");
9
9
  var _generateA11yTests = require("@instructure/ui-scripts/lib/test/generateA11yTests");
10
10
  var _runAxeCheck = require("@instructure/ui-axe-check/lib/runAxeCheck.js");
11
- var _uiColorUtils = require("@instructure/ui-color-utils");
11
+ var _uiColorUtils = _interopRequireDefault(require("@instructure/ui-color-utils"));
12
12
  var _ColorPicker = _interopRequireDefault(require("../__examples__/ColorPicker.examples"));
13
13
  var _ = require("../");
14
14
  var _SimpleExample, _SimpleExample2, _SimpleExample3, _SimpleExample4, _SimpleExample5, _SimpleExample6, _div, _div2, _SimpleExample7;
@@ -398,7 +398,7 @@ describe('<ColorPicker />', () => {
398
398
  const redInput = _react2.screen.getByLabelText('Red input');
399
399
  const blueInput = _react2.screen.getByLabelText('Blue input');
400
400
  const greenInput = _react2.screen.getByLabelText('Green input');
401
- const convertedColor = (0, _uiColorUtils.colorToRGB)(`#${color}`);
401
+ const convertedColor = _uiColorUtils.default.colorToRGB(`#${color}`);
402
402
  const actualColor = {
403
403
  r: parseInt(redInput.value),
404
404
  g: parseInt(greenInput.value),
@@ -458,7 +458,7 @@ describe('<ColorPicker />', () => {
458
458
  }
459
459
  });
460
460
  _react2.fireEvent.click(addBtn);
461
- expect(onChange).toHaveBeenCalledWith((0, _uiColorUtils.color2hex)(rgb));
461
+ expect(onChange).toHaveBeenCalledWith(_uiColorUtils.default.color2hex(rgb));
462
462
  });
463
463
  });
464
464
  });
@@ -13,6 +13,7 @@ var _omitProps = require("@instructure/ui-react-utils/lib/omitProps.js");
13
13
  var _testable = require("@instructure/ui-testable/lib/testable.js");
14
14
  var _isValid = require("@instructure/ui-color-utils/lib/isValid.js");
15
15
  var _contrast = require("@instructure/ui-color-utils/lib/contrast.js");
16
+ var _uiColorUtils = _interopRequireDefault(require("@instructure/ui-color-utils"));
16
17
  var _TextInput = require("@instructure/ui-text-input/lib/TextInput");
17
18
  var _Tooltip = require("@instructure/ui-tooltip/lib/Tooltip");
18
19
  var _Button = require("@instructure/ui-buttons/lib/Button");
@@ -131,7 +132,7 @@ let ColorPicker = exports.ColorPicker = (_dec = (0, _emotion.withStyle)(_styles.
131
132
  onChange = _this$props.onChange;
132
133
  return (0, _emotion.jsx)("div", null, typeof children === 'function' && children(`#${this.mixedColorWithStrippedAlpha}`, newColor => {
133
134
  this.setState({
134
- mixedColor: colorToHex8(newColor).slice(1)
135
+ mixedColor: _uiColorUtils.default.colorToHex8(newColor).slice(1)
135
136
  });
136
137
  }, () => {
137
138
  this.setState({
@@ -151,7 +152,7 @@ let ColorPicker = exports.ColorPicker = (_dec = (0, _emotion.withStyle)(_styles.
151
152
  }, ((_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, {
152
153
  value: `#${this.state.mixedColor}`,
153
154
  onChange: newColor => this.setState({
154
- mixedColor: colorToHex8(newColor).slice(1)
155
+ mixedColor: _uiColorUtils.default.colorToHex8(newColor).slice(1)
155
156
  }),
156
157
  withAlpha: this.props.colorMixerSettings.colorMixer.withAlpha,
157
158
  rgbRedInputScreenReaderLabel: this.props.colorMixerSettings.colorMixer.rgbRedInputScreenReaderLabel,
@@ -9,7 +9,7 @@ var _react = require("react");
9
9
  var _emotion = require("@instructure/emotion");
10
10
  var _omitProps = require("@instructure/ui-react-utils/lib/omitProps.js");
11
11
  var _testable = require("@instructure/ui-testable/lib/testable.js");
12
- var _uiColorUtils = require("@instructure/ui-color-utils");
12
+ var _uiColorUtils = _interopRequireDefault(require("@instructure/ui-color-utils"));
13
13
  var _IconButton = require("@instructure/ui-buttons/lib/IconButton");
14
14
  var _Button = require("@instructure/ui-buttons/lib/Button");
15
15
  var _View = require("@instructure/ui-view/lib/View");
@@ -106,9 +106,9 @@ let ColorPreset = exports.ColorPreset = (_dec = (0, _emotion.withStyle)(_styles.
106
106
  }, (0, _emotion.jsx)("div", {
107
107
  css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.popoverContent
108
108
  }, (0, _emotion.jsx)(_ColorMixer.ColorMixer, {
109
- value: (0, _uiColorUtils.colorToHex8)(this.state.newColor),
109
+ value: _uiColorUtils.default.colorToHex8(this.state.newColor),
110
110
  onChange: newColor => this.setState({
111
- newColor: (0, _uiColorUtils.colorToRGB)(newColor)
111
+ newColor: _uiColorUtils.default.colorToRGB(newColor)
112
112
  }),
113
113
  withAlpha: (_this$props3 = this.props) === null || _this$props3 === void 0 ? void 0 : (_this$props3$colorMix = _this$props3.colorMixerSettings) === null || _this$props3$colorMix === void 0 ? void 0 : (_this$props3$colorMix2 = _this$props3$colorMix.colorMixer) === null || _this$props3$colorMix2 === void 0 ? void 0 : _this$props3$colorMix2.withAlpha,
114
114
  rgbRedInputScreenReaderLabel: this.props.colorMixerSettings.colorMixer.rgbRedInputScreenReaderLabel,
@@ -122,7 +122,7 @@ let ColorPreset = exports.ColorPreset = (_dec = (0, _emotion.withStyle)(_styles.
122
122
  css: (_this$props$styles2 = this.props.styles) === null || _this$props$styles2 === void 0 ? void 0 : _this$props$styles2.popoverContrastBlock
123
123
  }, (0, _emotion.jsx)(_ColorContrast.ColorContrast, {
124
124
  firstColor: this.props.colorMixerSettings.colorContrast.firstColor,
125
- secondColor: (0, _uiColorUtils.colorToHex8)(this.state.newColor),
125
+ secondColor: _uiColorUtils.default.colorToHex8(this.state.newColor),
126
126
  label: this.props.colorMixerSettings.colorContrast.label,
127
127
  successLabel: this.props.colorMixerSettings.colorContrast.successLabel,
128
128
  failureLabel: this.props.colorMixerSettings.colorContrast.failureLabel,
@@ -136,7 +136,7 @@ let ColorPreset = exports.ColorPreset = (_dec = (0, _emotion.withStyle)(_styles.
136
136
  }, (0, _emotion.jsx)(_Button.Button, {
137
137
  onClick: () => {
138
138
  var _this$props5, _this$props5$colorMix;
139
- (_this$props5 = this.props) === null || _this$props5 === void 0 ? void 0 : (_this$props5$colorMix = _this$props5.colorMixerSettings) === null || _this$props5$colorMix === void 0 ? void 0 : _this$props5$colorMix.onPresetChange([(0, _uiColorUtils.colorToHex8)(this.state.newColor), ...this.props.colors]);
139
+ (_this$props5 = this.props) === null || _this$props5 === void 0 ? void 0 : (_this$props5$colorMix = _this$props5.colorMixerSettings) === null || _this$props5$colorMix === void 0 ? void 0 : _this$props5$colorMix.onPresetChange([_uiColorUtils.default.colorToHex8(this.state.newColor), ...this.props.colors]);
140
140
  this.setState({
141
141
  openAddNew: false
142
142
  });
@@ -233,7 +233,7 @@ let ColorPreset = exports.ColorPreset = (_dec = (0, _emotion.withStyle)(_styles.
233
233
  }
234
234
  isSelectedColor(color) {
235
235
  const selected = this.props.selected;
236
- return !!selected && (0, _uiColorUtils.colorToHex8)(selected) === (0, _uiColorUtils.colorToHex8)(color);
236
+ return !!selected && _uiColorUtils.default.colorToHex8(selected) === _uiColorUtils.default.colorToHex8(color);
237
237
  }
238
238
  render() {
239
239
  const _this$props9 = this.props,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/ui-color-picker",
3
- "version": "9.5.1-snapshot-0",
3
+ "version": "9.5.1-snapshot-2",
4
4
  "description": "A UI component library made by Instructure Inc.",
5
5
  "author": "Instructure, Inc. Engineering and Product Design",
6
6
  "module": "./es/index.js",
@@ -24,33 +24,33 @@
24
24
  "license": "MIT",
25
25
  "dependencies": {
26
26
  "@babel/runtime": "^7.24.5",
27
- "@instructure/console": "9.5.1-snapshot-0",
28
- "@instructure/emotion": "9.5.1-snapshot-0",
29
- "@instructure/shared-types": "9.5.1-snapshot-0",
30
- "@instructure/ui-a11y-content": "9.5.1-snapshot-0",
31
- "@instructure/ui-buttons": "9.5.1-snapshot-0",
32
- "@instructure/ui-color-utils": "9.5.1-snapshot-0",
33
- "@instructure/ui-dom-utils": "9.5.1-snapshot-0",
34
- "@instructure/ui-drilldown": "9.5.1-snapshot-0",
35
- "@instructure/ui-form-field": "9.5.1-snapshot-0",
36
- "@instructure/ui-icons": "9.5.1-snapshot-0",
37
- "@instructure/ui-pill": "9.5.1-snapshot-0",
38
- "@instructure/ui-popover": "9.5.1-snapshot-0",
39
- "@instructure/ui-react-utils": "9.5.1-snapshot-0",
40
- "@instructure/ui-testable": "9.5.1-snapshot-0",
41
- "@instructure/ui-text": "9.5.1-snapshot-0",
42
- "@instructure/ui-text-input": "9.5.1-snapshot-0",
43
- "@instructure/ui-themes": "9.5.1-snapshot-0",
44
- "@instructure/ui-tooltip": "9.5.1-snapshot-0",
45
- "@instructure/ui-utils": "9.5.1-snapshot-0",
46
- "@instructure/ui-view": "9.5.1-snapshot-0",
27
+ "@instructure/console": "9.5.1-snapshot-2",
28
+ "@instructure/emotion": "9.5.1-snapshot-2",
29
+ "@instructure/shared-types": "9.5.1-snapshot-2",
30
+ "@instructure/ui-a11y-content": "9.5.1-snapshot-2",
31
+ "@instructure/ui-buttons": "9.5.1-snapshot-2",
32
+ "@instructure/ui-color-utils": "9.5.1-snapshot-2",
33
+ "@instructure/ui-dom-utils": "9.5.1-snapshot-2",
34
+ "@instructure/ui-drilldown": "9.5.1-snapshot-2",
35
+ "@instructure/ui-form-field": "9.5.1-snapshot-2",
36
+ "@instructure/ui-icons": "9.5.1-snapshot-2",
37
+ "@instructure/ui-pill": "9.5.1-snapshot-2",
38
+ "@instructure/ui-popover": "9.5.1-snapshot-2",
39
+ "@instructure/ui-react-utils": "9.5.1-snapshot-2",
40
+ "@instructure/ui-testable": "9.5.1-snapshot-2",
41
+ "@instructure/ui-text": "9.5.1-snapshot-2",
42
+ "@instructure/ui-text-input": "9.5.1-snapshot-2",
43
+ "@instructure/ui-themes": "9.5.1-snapshot-2",
44
+ "@instructure/ui-tooltip": "9.5.1-snapshot-2",
45
+ "@instructure/ui-utils": "9.5.1-snapshot-2",
46
+ "@instructure/ui-view": "9.5.1-snapshot-2",
47
47
  "prop-types": "^15.8.1"
48
48
  },
49
49
  "devDependencies": {
50
- "@instructure/ui-axe-check": "9.5.1-snapshot-0",
51
- "@instructure/ui-babel-preset": "9.5.1-snapshot-0",
52
- "@instructure/ui-scripts": "9.5.1-snapshot-0",
53
- "@instructure/ui-test-utils": "9.5.1-snapshot-0",
50
+ "@instructure/ui-axe-check": "9.5.1-snapshot-2",
51
+ "@instructure/ui-babel-preset": "9.5.1-snapshot-2",
52
+ "@instructure/ui-scripts": "9.5.1-snapshot-2",
53
+ "@instructure/ui-test-utils": "9.5.1-snapshot-2",
54
54
  "@testing-library/jest-dom": "^6.4.5",
55
55
  "@testing-library/react": "^15.0.7",
56
56
  "@testing-library/user-event": "^14.5.2",