@instructure/ui-color-picker 8.56.1 → 8.56.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.
@@ -30,12 +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 {
34
- colorToHex8,
35
- isValid,
36
- contrast as getContrast
37
- } from '@instructure/ui-color-utils'
38
-
33
+ import { isValid, contrast as getContrast } from '@instructure/ui-color-utils'
34
+ import conversions from '@instructure/ui-color-utils'
39
35
  import { TextInput } from '@instructure/ui-text-input'
40
36
  import { Tooltip } from '@instructure/ui-tooltip'
41
37
  import { Button, IconButton } from '@instructure/ui-buttons'
@@ -444,7 +440,9 @@ class ColorPicker extends Component<ColorPickerProps, ColorPickerState> {
444
440
  children(
445
441
  `#${this.mixedColorWithStrippedAlpha}`,
446
442
  (newColor: string) => {
447
- this.setState({ mixedColor: colorToHex8(newColor).slice(1) })
443
+ this.setState({
444
+ mixedColor: conversions.colorToHex8(newColor).slice(1)
445
+ })
448
446
  },
449
447
  () => {
450
448
  this.setState({
@@ -470,7 +468,9 @@ class ColorPicker extends Component<ColorPickerProps, ColorPickerState> {
470
468
  <ColorMixer
471
469
  value={`#${this.state.mixedColor}`}
472
470
  onChange={(newColor: string) =>
473
- this.setState({ mixedColor: colorToHex8(newColor).slice(1) })
471
+ this.setState({
472
+ mixedColor: conversions.colorToHex8(newColor).slice(1)
473
+ })
474
474
  }
475
475
  withAlpha={this.props.colorMixerSettings.colorMixer.withAlpha}
476
476
  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
 
33
33
  import { IconButton, Button } from '@instructure/ui-buttons'
34
34
  import { View } from '@instructure/ui-view'
@@ -101,7 +101,10 @@ class ColorPreset extends Component<ColorPresetProps, ColorPresetState> {
101
101
 
102
102
  isSelectedColor(color: string) {
103
103
  const { selected } = this.props
104
- return !!selected && colorToHex8(selected) === colorToHex8(color)
104
+ return (
105
+ !!selected &&
106
+ conversions.colorToHex8(selected) === conversions.colorToHex8(color)
107
+ )
105
108
  }
106
109
 
107
110
  onMenuItemSelected =
@@ -149,9 +152,9 @@ class ColorPreset extends Component<ColorPresetProps, ColorPresetState> {
149
152
  >
150
153
  <div css={this.props.styles?.popoverContent}>
151
154
  <ColorMixer
152
- value={colorToHex8(this.state.newColor)}
155
+ value={conversions.colorToHex8(this.state.newColor)}
153
156
  onChange={(newColor: string) =>
154
- this.setState({ newColor: colorToRGB(newColor) })
157
+ this.setState({ newColor: conversions.colorToRGB(newColor) })
155
158
  }
156
159
  withAlpha={this.props?.colorMixerSettings?.colorMixer?.withAlpha}
157
160
  rgbRedInputScreenReaderLabel={
@@ -189,7 +192,7 @@ class ColorPreset extends Component<ColorPresetProps, ColorPresetState> {
189
192
  firstColor={
190
193
  this.props.colorMixerSettings.colorContrast.firstColor
191
194
  }
192
- secondColor={colorToHex8(this.state.newColor)}
195
+ secondColor={conversions.colorToHex8(this.state.newColor)}
193
196
  label={this.props.colorMixerSettings.colorContrast.label}
194
197
  successLabel={
195
198
  this.props.colorMixerSettings.colorContrast.successLabel
@@ -220,7 +223,7 @@ class ColorPreset extends Component<ColorPresetProps, ColorPresetState> {
220
223
  <Button
221
224
  onClick={() => {
222
225
  this.props?.colorMixerSettings?.onPresetChange([
223
- colorToHex8(this.state.newColor),
226
+ conversions.colorToHex8(this.state.newColor),
224
227
  ...this.props.colors
225
228
  ])
226
229
  this.setState({ openAddNew: false })