@instructure/ui-color-picker 10.19.2-snapshot-0 → 10.19.2-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
- ## [10.19.2-snapshot-0](https://github.com/instructure/instructure-ui/compare/v10.19.1...v10.19.2-snapshot-0) (2025-06-06)
6
+ ## [10.19.2-snapshot-2](https://github.com/instructure/instructure-ui/compare/v10.19.1...v10.19.2-snapshot-2) (2025-06-11)
7
7
 
8
- **Note:** Version bump only for package @instructure/ui-color-picker
8
+
9
+ ### Features
10
+
11
+ * **many:** add missing inputRef prop to input components ([e1158fb](https://github.com/instructure/instructure-ui/commit/e1158fb7af5426e6ce13efe197c2148e1c5f15f0))
9
12
 
10
13
 
11
14
 
@@ -307,6 +307,14 @@ describe('<ColorPicker />', () => {
307
307
  expect(errorMessage).toBeInTheDocument();
308
308
  });
309
309
  });
310
+ it('should provide an inputRef prop', async () => {
311
+ const inputRef = vi.fn();
312
+ render(_jsx(SimpleExample, {
313
+ inputRef: inputRef
314
+ }));
315
+ const input = screen.getByRole('textbox');
316
+ expect(inputRef).toHaveBeenCalledWith(input);
317
+ });
310
318
  });
311
319
  describe('complex mode', () => {
312
320
  it('should display trigger button', async () => {
@@ -438,7 +438,8 @@ let ColorPicker = (_dec = withStyle(generateStyle, generateComponentTheme), _dec
438
438
  isRequired = _this$props10.isRequired,
439
439
  placeholderText = _this$props10.placeholderText,
440
440
  width = _this$props10.width,
441
- id = _this$props10.id;
441
+ id = _this$props10.id,
442
+ inputRef = _this$props10.inputRef;
442
443
  return _jsxs("div", {
443
444
  ...omitProps(this.props, ColorPicker.allowedProps),
444
445
  css: (_this$props$styles6 = this.props.styles) === null || _this$props$styles6 === void 0 ? void 0 : _this$props$styles6.colorPicker,
@@ -461,7 +462,8 @@ let ColorPicker = (_dec = withStyle(generateStyle, generateComponentTheme), _dec
461
462
  onChange: (event, value) => this.handleOnChange(event, value),
462
463
  onPaste: event => this.handleOnPaste(event),
463
464
  onBlur: () => this.handleOnBlur(),
464
- messages: this.renderMessages()
465
+ messages: this.renderMessages(),
466
+ inputRef: inputRef
465
467
  }), !this.isSimple && _jsx("div", {
466
468
  css: (_this$props$styles7 = this.props.styles) === null || _this$props$styles7 === void 0 ? void 0 : _this$props$styles7.colorMixerButtonContainer,
467
469
  style: {
@@ -79,7 +79,8 @@ const propTypes = {
79
79
  value: PropTypes.string,
80
80
  width: PropTypes.string,
81
81
  withAlpha: PropTypes.bool,
82
- margin: PropTypes.string
82
+ margin: PropTypes.string,
83
+ inputRef: PropTypes.func
83
84
  };
84
- const allowedProps = ['id', 'checkContrast', 'colorMixerSettings', 'children', 'disabled', 'elementRef', 'isRequired', 'label', 'onChange', 'placeholderText', 'popoverScreenReaderLabel', 'popoverButtonScreenReaderLabel', 'popoverMaxHeight', 'renderInvalidColorMessage', 'renderIsRequiredMessage', 'renderMessages', 'tooltip', 'value', 'width', 'withAlpha', 'margin'];
85
+ const allowedProps = ['id', 'checkContrast', 'colorMixerSettings', 'children', 'disabled', 'elementRef', 'isRequired', 'label', 'onChange', 'placeholderText', 'popoverScreenReaderLabel', 'popoverButtonScreenReaderLabel', 'popoverMaxHeight', 'renderInvalidColorMessage', 'renderIsRequiredMessage', 'renderMessages', 'tooltip', 'value', 'width', 'withAlpha', 'margin', 'inputRef'];
85
86
  export { propTypes, allowedProps };
@@ -308,6 +308,14 @@ describe('<ColorPicker />', () => {
308
308
  expect(errorMessage).toBeInTheDocument();
309
309
  });
310
310
  });
311
+ it('should provide an inputRef prop', async () => {
312
+ const inputRef = _vitest.vi.fn();
313
+ (0, _react.render)((0, _jsxRuntime.jsx)(SimpleExample, {
314
+ inputRef: inputRef
315
+ }));
316
+ const input = _react.screen.getByRole('textbox');
317
+ expect(inputRef).toHaveBeenCalledWith(input);
318
+ });
311
319
  });
312
320
  describe('complex mode', () => {
313
321
  it('should display trigger button', async () => {
@@ -449,7 +449,8 @@ let ColorPicker = exports.ColorPicker = (_dec = (0, _emotion.withStyle)(_styles.
449
449
  isRequired = _this$props10.isRequired,
450
450
  placeholderText = _this$props10.placeholderText,
451
451
  width = _this$props10.width,
452
- id = _this$props10.id;
452
+ id = _this$props10.id,
453
+ inputRef = _this$props10.inputRef;
453
454
  return (0, _jsxRuntime.jsxs)("div", {
454
455
  ...(0, _omitProps.omitProps)(this.props, ColorPicker.allowedProps),
455
456
  css: (_this$props$styles6 = this.props.styles) === null || _this$props$styles6 === void 0 ? void 0 : _this$props$styles6.colorPicker,
@@ -472,7 +473,8 @@ let ColorPicker = exports.ColorPicker = (_dec = (0, _emotion.withStyle)(_styles.
472
473
  onChange: (event, value) => this.handleOnChange(event, value),
473
474
  onPaste: event => this.handleOnPaste(event),
474
475
  onBlur: () => this.handleOnBlur(),
475
- messages: this.renderMessages()
476
+ messages: this.renderMessages(),
477
+ inputRef: inputRef
476
478
  }), !this.isSimple && (0, _jsxRuntime.jsx)("div", {
477
479
  css: (_this$props$styles7 = this.props.styles) === null || _this$props$styles7 === void 0 ? void 0 : _this$props$styles7.colorMixerButtonContainer,
478
480
  style: {
@@ -86,6 +86,7 @@ const propTypes = exports.propTypes = {
86
86
  value: _propTypes.default.string,
87
87
  width: _propTypes.default.string,
88
88
  withAlpha: _propTypes.default.bool,
89
- margin: _propTypes.default.string
89
+ margin: _propTypes.default.string,
90
+ inputRef: _propTypes.default.func
90
91
  };
91
- const allowedProps = exports.allowedProps = ['id', 'checkContrast', 'colorMixerSettings', 'children', 'disabled', 'elementRef', 'isRequired', 'label', 'onChange', 'placeholderText', 'popoverScreenReaderLabel', 'popoverButtonScreenReaderLabel', 'popoverMaxHeight', 'renderInvalidColorMessage', 'renderIsRequiredMessage', 'renderMessages', 'tooltip', 'value', 'width', 'withAlpha', 'margin'];
92
+ const allowedProps = exports.allowedProps = ['id', 'checkContrast', 'colorMixerSettings', 'children', 'disabled', 'elementRef', 'isRequired', 'label', 'onChange', 'placeholderText', 'popoverScreenReaderLabel', 'popoverButtonScreenReaderLabel', 'popoverMaxHeight', 'renderInvalidColorMessage', 'renderIsRequiredMessage', 'renderMessages', 'tooltip', 'value', 'width', 'withAlpha', 'margin', 'inputRef'];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/ui-color-picker",
3
- "version": "10.19.2-snapshot-0",
3
+ "version": "10.19.2-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.26.0",
27
- "@instructure/console": "10.19.2-snapshot-0",
28
- "@instructure/emotion": "10.19.2-snapshot-0",
29
- "@instructure/shared-types": "10.19.2-snapshot-0",
30
- "@instructure/ui-a11y-content": "10.19.2-snapshot-0",
31
- "@instructure/ui-buttons": "10.19.2-snapshot-0",
32
- "@instructure/ui-color-utils": "10.19.2-snapshot-0",
33
- "@instructure/ui-dom-utils": "10.19.2-snapshot-0",
34
- "@instructure/ui-drilldown": "10.19.2-snapshot-0",
35
- "@instructure/ui-form-field": "10.19.2-snapshot-0",
36
- "@instructure/ui-icons": "10.19.2-snapshot-0",
37
- "@instructure/ui-pill": "10.19.2-snapshot-0",
38
- "@instructure/ui-popover": "10.19.2-snapshot-0",
39
- "@instructure/ui-react-utils": "10.19.2-snapshot-0",
40
- "@instructure/ui-testable": "10.19.2-snapshot-0",
41
- "@instructure/ui-text": "10.19.2-snapshot-0",
42
- "@instructure/ui-text-input": "10.19.2-snapshot-0",
43
- "@instructure/ui-themes": "10.19.2-snapshot-0",
44
- "@instructure/ui-tooltip": "10.19.2-snapshot-0",
45
- "@instructure/ui-utils": "10.19.2-snapshot-0",
46
- "@instructure/ui-view": "10.19.2-snapshot-0",
27
+ "@instructure/console": "10.19.2-snapshot-2",
28
+ "@instructure/emotion": "10.19.2-snapshot-2",
29
+ "@instructure/shared-types": "10.19.2-snapshot-2",
30
+ "@instructure/ui-a11y-content": "10.19.2-snapshot-2",
31
+ "@instructure/ui-buttons": "10.19.2-snapshot-2",
32
+ "@instructure/ui-color-utils": "10.19.2-snapshot-2",
33
+ "@instructure/ui-dom-utils": "10.19.2-snapshot-2",
34
+ "@instructure/ui-drilldown": "10.19.2-snapshot-2",
35
+ "@instructure/ui-form-field": "10.19.2-snapshot-2",
36
+ "@instructure/ui-icons": "10.19.2-snapshot-2",
37
+ "@instructure/ui-pill": "10.19.2-snapshot-2",
38
+ "@instructure/ui-popover": "10.19.2-snapshot-2",
39
+ "@instructure/ui-react-utils": "10.19.2-snapshot-2",
40
+ "@instructure/ui-testable": "10.19.2-snapshot-2",
41
+ "@instructure/ui-text": "10.19.2-snapshot-2",
42
+ "@instructure/ui-text-input": "10.19.2-snapshot-2",
43
+ "@instructure/ui-themes": "10.19.2-snapshot-2",
44
+ "@instructure/ui-tooltip": "10.19.2-snapshot-2",
45
+ "@instructure/ui-utils": "10.19.2-snapshot-2",
46
+ "@instructure/ui-view": "10.19.2-snapshot-2",
47
47
  "prop-types": "^15.8.1"
48
48
  },
49
49
  "devDependencies": {
50
- "@instructure/ui-axe-check": "10.19.2-snapshot-0",
51
- "@instructure/ui-babel-preset": "10.19.2-snapshot-0",
52
- "@instructure/ui-scripts": "10.19.2-snapshot-0",
53
- "@instructure/ui-test-utils": "10.19.2-snapshot-0",
50
+ "@instructure/ui-axe-check": "10.19.2-snapshot-2",
51
+ "@instructure/ui-babel-preset": "10.19.2-snapshot-2",
52
+ "@instructure/ui-scripts": "10.19.2-snapshot-2",
53
+ "@instructure/ui-test-utils": "10.19.2-snapshot-2",
54
54
  "@testing-library/jest-dom": "^6.6.3",
55
55
  "@testing-library/react": "^16.0.1",
56
56
  "@testing-library/user-event": "^14.5.2",
@@ -389,6 +389,14 @@ describe('<ColorPicker />', () => {
389
389
  expect(errorMessage).toBeInTheDocument()
390
390
  })
391
391
  })
392
+
393
+ it('should provide an inputRef prop', async () => {
394
+ const inputRef = vi.fn()
395
+ render(<SimpleExample inputRef={inputRef} />)
396
+ const input = screen.getByRole('textbox')
397
+
398
+ expect(inputRef).toHaveBeenCalledWith(input)
399
+ })
392
400
  })
393
401
 
394
402
  describe('complex mode', () => {
@@ -608,7 +608,8 @@ class ColorPicker extends Component<ColorPickerProps, ColorPickerState> {
608
608
  )
609
609
 
610
610
  render() {
611
- const { disabled, isRequired, placeholderText, width, id } = this.props
611
+ const { disabled, isRequired, placeholderText, width, id, inputRef } =
612
+ this.props
612
613
 
613
614
  return (
614
615
  <div
@@ -633,6 +634,7 @@ class ColorPicker extends Component<ColorPickerProps, ColorPickerState> {
633
634
  onPaste={(event) => this.handleOnPaste(event)}
634
635
  onBlur={() => this.handleOnBlur()}
635
636
  messages={this.renderMessages()}
637
+ inputRef={inputRef}
636
638
  />
637
639
  {!this.isSimple && (
638
640
  <div
@@ -234,6 +234,11 @@ type ColorPickerOwnProps = {
234
234
  * Margin around the component. Accepts a `Spacing` token. See token values and example usage in [this guide](https://instructure.design/#layout-spacing).
235
235
  */
236
236
  margin?: Spacing
237
+
238
+ /**
239
+ * A function that provides a reference to the input element
240
+ */
241
+ inputRef?: (inputElement: HTMLInputElement | null) => void
237
242
  }
238
243
 
239
244
  type ColorPickerState = {
@@ -326,7 +331,8 @@ const propTypes: PropValidators<PropKeys> = {
326
331
  value: PropTypes.string,
327
332
  width: PropTypes.string,
328
333
  withAlpha: PropTypes.bool,
329
- margin: PropTypes.string
334
+ margin: PropTypes.string,
335
+ inputRef: PropTypes.func
330
336
  }
331
337
 
332
338
  const allowedProps: AllowedPropKeys = [
@@ -350,7 +356,8 @@ const allowedProps: AllowedPropKeys = [
350
356
  'value',
351
357
  'width',
352
358
  'withAlpha',
353
- 'margin'
359
+ 'margin',
360
+ 'inputRef'
354
361
  ]
355
362
 
356
363
  export type {