@instructure/ui-color-picker 8.33.2 → 8.33.3-snapshot-3

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,6 +3,18 @@
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
+ ## [8.33.3-snapshot-3](https://github.com/instructure/instructure-ui/compare/v8.33.2...v8.33.3-snapshot-3) (2023-02-10)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **ui-color-picker:** axe-check tests failing ([d32f395](https://github.com/instructure/instructure-ui/commit/d32f395d68bae878d7f720bdbb30c4c15300f1d0))
12
+ * **ui-color-picker:** revert changes ([71d2ff6](https://github.com/instructure/instructure-ui/commit/71d2ff6760d2cacbf3b751cc33cec860843ce338))
13
+
14
+
15
+
16
+
17
+
6
18
  ## [8.33.2](https://github.com/instructure/instructure-ui/compare/v8.33.1...v8.33.2) (2023-01-25)
7
19
 
8
20
  **Note:** Version bump only for package @instructure/ui-color-picker
@@ -35,7 +35,7 @@ const customMethos = {
35
35
  for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
36
36
  args[_key2] = arguments[_key2];
37
37
  }
38
- return find('[aria-label*="color palette"]', ...args);
38
+ return find('[id^=ColorMixer__Palette]', ...args);
39
39
  },
40
40
  findColorSlider: function () {
41
41
  for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
@@ -1,4 +1,4 @@
1
- var _dec, _class, _class2;
1
+ var _dec, _dec2, _class, _class2;
2
2
  /*
3
3
  * The MIT License (MIT)
4
4
  *
@@ -28,11 +28,12 @@ import React, { Component } from 'react';
28
28
  import { withStyle, jsx } from '@instructure/emotion';
29
29
  import { addEventListener } from '@instructure/ui-dom-utils';
30
30
  import { View } from '@instructure/ui-view';
31
+ import { px } from '@instructure/ui-utils';
32
+ import { withDeterministicId } from '@instructure/ui-react-utils';
31
33
  import shallowCompare from '../utils/shallowCompare';
32
34
  import { propTypes, allowedProps } from './props';
33
35
  import generateStyle from './styles';
34
36
  import generateComponentTheme from './theme';
35
- import { px } from '@instructure/ui-utils';
36
37
 
37
38
  /**
38
39
  ---
@@ -40,10 +41,11 @@ private: true
40
41
  ---
41
42
  @tsProps
42
43
  **/
43
- let ColorPalette = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = (_class2 = class ColorPalette extends Component {
44
+ let ColorPalette = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle, generateComponentTheme), _dec(_class = _dec2(_class = (_class2 = class ColorPalette extends Component {
44
45
  constructor(props) {
45
46
  var _this$props$styles;
46
47
  super(props);
48
+ this._id = void 0;
47
49
  this.ref = null;
48
50
  this._paletteRef = null;
49
51
  this._mouseMoveListener = void 0;
@@ -86,6 +88,7 @@ let ColorPalette = (_dec = withStyle(generateStyle, generateComponentTheme), _de
86
88
  y: 0
87
89
  }
88
90
  };
91
+ this._id = props.deterministicId('ColorMixer__Palette');
89
92
  }
90
93
  componentDidMount() {
91
94
  var _this$props$makeStyle, _this$props;
@@ -207,7 +210,8 @@ let ColorPalette = (_dec = withStyle(generateStyle, generateComponentTheme), _de
207
210
  tabIndex: this.props.disabled ? void 0 : 0,
208
211
  onKeyDown: e => this.handleKeyDown(e),
209
212
  onMouseDown: e => this.handlePaletteMouseDown(e),
210
- "aria-label": this.props.navigationExplanationScreenReaderLabel
213
+ "aria-label": this.props.navigationExplanationScreenReaderLabel,
214
+ id: this._id
211
215
  }, jsx("div", {
212
216
  css: (_this$props$styles2 = this.props.styles) === null || _this$props$styles2 === void 0 ? void 0 : _this$props$styles2.indicator
213
217
  }), this.props.disabled && jsx("div", {
@@ -219,5 +223,5 @@ let ColorPalette = (_dec = withStyle(generateStyle, generateComponentTheme), _de
219
223
  }
220
224
  }));
221
225
  }
222
- }, _class2.displayName = "ColorPalette", _class2.propTypes = propTypes, _class2.allowedProps = allowedProps, _class2.componentId = 'ColorMixer.Palette', _class2)) || _class);
226
+ }, _class2.displayName = "ColorPalette", _class2.propTypes = propTypes, _class2.allowedProps = allowedProps, _class2.componentId = 'ColorMixer.Palette', _class2)) || _class) || _class);
223
227
  export default ColorPalette;
@@ -163,12 +163,11 @@ let Slider = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_cla
163
163
  onKeyDown: e => this.handleKeyDown(e),
164
164
  onMouseDown: e => this.handleMouseDown(e),
165
165
  tabIndex: this.props.disabled ? void 0 : 0,
166
- "aria-label": this.props.navigationExplanationScreenReaderLabel
167
- // TODO: check RangeInput and ProgressBar to see how the slider role can be handled well
168
- // role="slider"
169
- // aria-valuemin={this.props.minValue}
170
- // aria-valuemax={this.props.maxValue}
171
- // aria-valuenow={this.roundedValue}
166
+ "aria-label": this.props.navigationExplanationScreenReaderLabel,
167
+ role: "slider",
168
+ "aria-valuemin": this.props.minValue,
169
+ "aria-valuemax": this.props.maxValue,
170
+ "aria-valuenow": this.roundedValue
172
171
  }, jsx("div", {
173
172
  css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.indicator
174
173
  }), this.props.disabled && jsx("div", {
@@ -165,11 +165,10 @@ let ColorPreset = (_dec = withStyle(generateStyle, generateComponentTheme), _dec
165
165
  onClick: () => this.props.onSelect(color)
166
166
  } : {}, this.isSelectedColor(color) ? {
167
167
  'aria-label': 'selected'
168
- } : {}, {
169
- role: "presentation"
170
- }), jsx("div", null, jsx(ColorIndicator, {
168
+ } : {}), jsx("div", null, jsx(ColorIndicator, {
171
169
  color: color,
172
- shape: "rectangle"
170
+ shape: "rectangle",
171
+ role: "presentation"
173
172
  }), this.isSelectedColor(color) && jsx("div", {
174
173
  css: (_this$props6 = this.props) === null || _this$props6 === void 0 ? void 0 : (_this$props6$styles = _this$props6.styles) === null || _this$props6$styles === void 0 ? void 0 : _this$props6$styles.selectedIndicator
175
174
  }, jsx(IconCheckDarkSolid, {
@@ -42,7 +42,7 @@ const customMethos = {
42
42
  for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
43
43
  args[_key2] = arguments[_key2];
44
44
  }
45
- return (0, _uiTestUtils.find)('[aria-label*="color palette"]', ...args);
45
+ return (0, _uiTestUtils.find)('[id^=ColorMixer__Palette]', ...args);
46
46
  },
47
47
  findColorSlider: function () {
48
48
  for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
@@ -10,22 +10,24 @@ var _react = _interopRequireWildcard(require("react"));
10
10
  var _emotion = require("@instructure/emotion");
11
11
  var _addEventListener = require("@instructure/ui-dom-utils/lib/addEventListener.js");
12
12
  var _View = require("@instructure/ui-view/lib/View");
13
+ var _px = require("@instructure/ui-utils/lib/px.js");
14
+ var _withDeterministicId = require("@instructure/ui-react-utils/lib/DeterministicIdContext/withDeterministicId.js");
13
15
  var _shallowCompare = _interopRequireDefault(require("../utils/shallowCompare"));
14
16
  var _props = require("./props");
15
17
  var _styles = _interopRequireDefault(require("./styles"));
16
18
  var _theme = _interopRequireDefault(require("./theme"));
17
- var _px = require("@instructure/ui-utils/lib/px.js");
18
- var _dec, _class, _class2;
19
+ var _dec, _dec2, _class, _class2;
19
20
  /**
20
21
  ---
21
22
  private: true
22
23
  ---
23
24
  @tsProps
24
25
  **/
25
- let ColorPalette = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec(_class = (_class2 = class ColorPalette extends _react.Component {
26
+ let ColorPalette = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec(_class = _dec2(_class = (_class2 = class ColorPalette extends _react.Component {
26
27
  constructor(props) {
27
28
  var _this$props$styles;
28
29
  super(props);
30
+ this._id = void 0;
29
31
  this.ref = null;
30
32
  this._paletteRef = null;
31
33
  this._mouseMoveListener = void 0;
@@ -68,6 +70,7 @@ let ColorPalette = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.defau
68
70
  y: 0
69
71
  }
70
72
  };
73
+ this._id = props.deterministicId('ColorMixer__Palette');
71
74
  }
72
75
  componentDidMount() {
73
76
  var _this$props$makeStyle, _this$props;
@@ -189,7 +192,8 @@ let ColorPalette = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.defau
189
192
  tabIndex: this.props.disabled ? void 0 : 0,
190
193
  onKeyDown: e => this.handleKeyDown(e),
191
194
  onMouseDown: e => this.handlePaletteMouseDown(e),
192
- "aria-label": this.props.navigationExplanationScreenReaderLabel
195
+ "aria-label": this.props.navigationExplanationScreenReaderLabel,
196
+ id: this._id
193
197
  }, (0, _emotion.jsx)("div", {
194
198
  css: (_this$props$styles2 = this.props.styles) === null || _this$props$styles2 === void 0 ? void 0 : _this$props$styles2.indicator
195
199
  }), this.props.disabled && (0, _emotion.jsx)("div", {
@@ -201,6 +205,6 @@ let ColorPalette = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.defau
201
205
  }
202
206
  }));
203
207
  }
204
- }, _class2.displayName = "ColorPalette", _class2.propTypes = _props.propTypes, _class2.allowedProps = _props.allowedProps, _class2.componentId = 'ColorMixer.Palette', _class2)) || _class);
208
+ }, _class2.displayName = "ColorPalette", _class2.propTypes = _props.propTypes, _class2.allowedProps = _props.allowedProps, _class2.componentId = 'ColorMixer.Palette', _class2)) || _class) || _class);
205
209
  var _default = ColorPalette;
206
210
  exports.default = _default;
@@ -145,12 +145,11 @@ let Slider = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _
145
145
  onKeyDown: e => this.handleKeyDown(e),
146
146
  onMouseDown: e => this.handleMouseDown(e),
147
147
  tabIndex: this.props.disabled ? void 0 : 0,
148
- "aria-label": this.props.navigationExplanationScreenReaderLabel
149
- // TODO: check RangeInput and ProgressBar to see how the slider role can be handled well
150
- // role="slider"
151
- // aria-valuemin={this.props.minValue}
152
- // aria-valuemax={this.props.maxValue}
153
- // aria-valuenow={this.roundedValue}
148
+ "aria-label": this.props.navigationExplanationScreenReaderLabel,
149
+ role: "slider",
150
+ "aria-valuemin": this.props.minValue,
151
+ "aria-valuemax": this.props.maxValue,
152
+ "aria-valuenow": this.roundedValue
154
153
  }, (0, _emotion.jsx)("div", {
155
154
  css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.indicator
156
155
  }), this.props.disabled && (0, _emotion.jsx)("div", {
@@ -148,11 +148,10 @@ let ColorPreset = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.defaul
148
148
  onClick: () => this.props.onSelect(color)
149
149
  } : {}, this.isSelectedColor(color) ? {
150
150
  'aria-label': 'selected'
151
- } : {}, {
152
- role: "presentation"
153
- }), (0, _emotion.jsx)("div", null, (0, _emotion.jsx)(_ColorIndicator.ColorIndicator, {
151
+ } : {}), (0, _emotion.jsx)("div", null, (0, _emotion.jsx)(_ColorIndicator.ColorIndicator, {
154
152
  color: color,
155
- shape: "rectangle"
153
+ shape: "rectangle",
154
+ role: "presentation"
156
155
  }), this.isSelectedColor(color) && (0, _emotion.jsx)("div", {
157
156
  css: (_this$props6 = this.props) === null || _this$props6 === void 0 ? void 0 : (_this$props6$styles = _this$props6.styles) === null || _this$props6$styles === void 0 ? void 0 : _this$props6$styles.selectedIndicator
158
157
  }, (0, _emotion.jsx)(_IconCheckDarkSolid.IconCheckDarkSolid, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/ui-color-picker",
3
- "version": "8.33.2",
3
+ "version": "8.33.3-snapshot-3",
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.13.10",
27
- "@instructure/console": "8.33.2",
28
- "@instructure/emotion": "8.33.2",
29
- "@instructure/shared-types": "8.33.2",
30
- "@instructure/ui-a11y-content": "8.33.2",
31
- "@instructure/ui-buttons": "8.33.2",
32
- "@instructure/ui-color-utils": "8.33.2",
33
- "@instructure/ui-dom-utils": "8.33.2",
34
- "@instructure/ui-drilldown": "8.33.2",
35
- "@instructure/ui-form-field": "8.33.2",
36
- "@instructure/ui-icons": "8.33.2",
37
- "@instructure/ui-pill": "8.33.2",
38
- "@instructure/ui-popover": "8.33.2",
39
- "@instructure/ui-react-utils": "8.33.2",
40
- "@instructure/ui-testable": "8.33.2",
41
- "@instructure/ui-text": "8.33.2",
42
- "@instructure/ui-text-input": "8.33.2",
43
- "@instructure/ui-themes": "8.33.2",
44
- "@instructure/ui-tooltip": "8.33.2",
45
- "@instructure/ui-utils": "8.33.2",
46
- "@instructure/ui-view": "8.33.2",
27
+ "@instructure/console": "8.33.3-snapshot-3",
28
+ "@instructure/emotion": "8.33.3-snapshot-3",
29
+ "@instructure/shared-types": "8.33.3-snapshot-3",
30
+ "@instructure/ui-a11y-content": "8.33.3-snapshot-3",
31
+ "@instructure/ui-buttons": "8.33.3-snapshot-3",
32
+ "@instructure/ui-color-utils": "8.33.3-snapshot-3",
33
+ "@instructure/ui-dom-utils": "8.33.3-snapshot-3",
34
+ "@instructure/ui-drilldown": "8.33.3-snapshot-3",
35
+ "@instructure/ui-form-field": "8.33.3-snapshot-3",
36
+ "@instructure/ui-icons": "8.33.3-snapshot-3",
37
+ "@instructure/ui-pill": "8.33.3-snapshot-3",
38
+ "@instructure/ui-popover": "8.33.3-snapshot-3",
39
+ "@instructure/ui-react-utils": "8.33.3-snapshot-3",
40
+ "@instructure/ui-testable": "8.33.3-snapshot-3",
41
+ "@instructure/ui-text": "8.33.3-snapshot-3",
42
+ "@instructure/ui-text-input": "8.33.3-snapshot-3",
43
+ "@instructure/ui-themes": "8.33.3-snapshot-3",
44
+ "@instructure/ui-tooltip": "8.33.3-snapshot-3",
45
+ "@instructure/ui-utils": "8.33.3-snapshot-3",
46
+ "@instructure/ui-view": "8.33.3-snapshot-3",
47
47
  "prop-types": "^15"
48
48
  },
49
49
  "devDependencies": {
50
- "@instructure/ui-babel-preset": "8.33.2",
51
- "@instructure/ui-test-locator": "8.33.2",
52
- "@instructure/ui-test-queries": "8.33.2",
53
- "@instructure/ui-test-utils": "8.33.2"
50
+ "@instructure/ui-babel-preset": "8.33.3-snapshot-3",
51
+ "@instructure/ui-test-locator": "8.33.3-snapshot-3",
52
+ "@instructure/ui-test-queries": "8.33.3-snapshot-3",
53
+ "@instructure/ui-test-utils": "8.33.3-snapshot-3"
54
54
  },
55
55
  "peerDependencies": {
56
56
  "react": ">=16.8 <=18"
@@ -31,7 +31,7 @@ const customMethos = {
31
31
  return find('[id^=TextInput_]', ...args)
32
32
  },
33
33
  findColorPalette: (...args: any[]) => {
34
- return find('[aria-label*="color palette"]', ...args)
34
+ return find('[id^=ColorMixer__Palette]', ...args)
35
35
  },
36
36
  findColorSlider: (...args: any[]) => {
37
37
  return find('[aria-label*="color slider"]', ...args)
@@ -31,6 +31,8 @@ import type { HSVType } from '@instructure/ui-color-utils'
31
31
 
32
32
  import { View } from '@instructure/ui-view'
33
33
  import type { ViewOwnProps } from '@instructure/ui-view'
34
+ import { px } from '@instructure/ui-utils'
35
+ import { withDeterministicId } from '@instructure/ui-react-utils'
34
36
 
35
37
  import shallowCompare from '../utils/shallowCompare'
36
38
 
@@ -39,7 +41,6 @@ import type { ColorPaletteProps, ColorPaletteState } from './props'
39
41
 
40
42
  import generateStyle from './styles'
41
43
  import generateComponentTheme from './theme'
42
- import { px } from '@instructure/ui-utils'
43
44
 
44
45
  /**
45
46
  ---
@@ -47,6 +48,7 @@ private: true
47
48
  ---
48
49
  @tsProps
49
50
  **/
51
+ @withDeterministicId()
50
52
  @withStyle(generateStyle, generateComponentTheme)
51
53
  class ColorPalette extends Component<ColorPaletteProps, ColorPaletteState> {
52
54
  static propTypes = propTypes
@@ -58,8 +60,9 @@ class ColorPalette extends Component<ColorPaletteProps, ColorPaletteState> {
58
60
  this.state = {
59
61
  colorPosition: { x: 0, y: 0 }
60
62
  }
63
+ this._id = props.deterministicId!('ColorMixer__Palette')
61
64
  }
62
-
65
+ private readonly _id: string
63
66
  ref: Element | null = null
64
67
  private _paletteRef: HTMLDivElement | null = null
65
68
  private _mouseMoveListener?: { remove(): void }
@@ -235,6 +238,7 @@ class ColorPalette extends Component<ColorPaletteProps, ColorPaletteState> {
235
238
  onKeyDown={(e) => this.handleKeyDown(e)}
236
239
  onMouseDown={(e) => this.handlePaletteMouseDown(e)}
237
240
  aria-label={this.props.navigationExplanationScreenReaderLabel}
241
+ id={this._id}
238
242
  >
239
243
  <div css={this.props.styles?.indicator} />
240
244
  {this.props.disabled && (
@@ -31,6 +31,7 @@ import type {
31
31
  ColorMixerPaletteTheme
32
32
  } from '@instructure/shared-types'
33
33
  import type { HSVType } from '@instructure/ui-color-utils'
34
+ import type { WithDeterministicIdProps } from '@instructure/ui-react-utils'
34
35
 
35
36
  type ColorPaletteOwnProps = {
36
37
  disabled?: boolean
@@ -54,7 +55,8 @@ type AllowedPropKeys = Readonly<Array<PropKeys>>
54
55
 
55
56
  type ColorPaletteProps = ColorPaletteOwnProps &
56
57
  WithStyleProps<ColorMixerPaletteTheme, ColorPaletteStyle> &
57
- OtherHTMLAttributes<ColorPaletteOwnProps>
58
+ OtherHTMLAttributes<ColorPaletteOwnProps> &
59
+ WithDeterministicIdProps
58
60
 
59
61
  type ColorPaletteStyle = ComponentStyle<
60
62
  'ColorPalette' | 'indicator' | 'palette' | 'disabledOverlay' | 'paletteOffset'
@@ -216,11 +216,10 @@ class Slider extends Component<SliderProps> {
216
216
  onMouseDown={(e) => this.handleMouseDown(e)}
217
217
  tabIndex={this.props.disabled ? undefined : 0}
218
218
  aria-label={this.props.navigationExplanationScreenReaderLabel}
219
- // TODO: check RangeInput and ProgressBar to see how the slider role can be handled well
220
- // role="slider"
221
- // aria-valuemin={this.props.minValue}
222
- // aria-valuemax={this.props.maxValue}
223
- // aria-valuenow={this.roundedValue}
219
+ role="slider"
220
+ aria-valuemin={this.props.minValue}
221
+ aria-valuemax={this.props.maxValue}
222
+ aria-valuenow={this.roundedValue}
224
223
  >
225
224
  <div css={this.props.styles?.indicator} />
226
225
  {this.props.disabled && (
@@ -260,10 +260,9 @@ class ColorPreset extends Component<ColorPresetProps, ColorPresetState> {
260
260
  ? { onClick: () => this.props.onSelect(color) }
261
261
  : {})}
262
262
  {...(this.isSelectedColor(color) ? { 'aria-label': 'selected' } : {})}
263
- role="presentation"
264
263
  >
265
264
  <div>
266
- <ColorIndicator color={color} shape="rectangle" />
265
+ <ColorIndicator color={color} shape="rectangle" role="presentation" />
267
266
  {this.isSelectedColor(color) && (
268
267
  <div css={this.props?.styles?.selectedIndicator}>
269
268
  <IconCheckDarkSolid