@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.
- package/CHANGELOG.md +11 -0
- package/es/ColorContrast/index.js +5 -4
- package/es/ColorIndicator/styles.js +2 -2
- package/es/ColorMixer/index.js +11 -10
- package/es/ColorPicker/index.js +4 -3
- package/es/ColorPreset/index.js +6 -6
- package/lib/ColorContrast/index.js +4 -3
- package/lib/ColorIndicator/styles.js +3 -2
- package/lib/ColorMixer/index.js +10 -9
- package/lib/ColorPicker/index.js +3 -2
- package/lib/ColorPreset/index.js +6 -6
- package/package.json +25 -25
- package/src/ColorContrast/index.tsx +9 -8
- package/src/ColorIndicator/styles.ts +3 -3
- package/src/ColorMixer/index.tsx +13 -15
- package/src/ColorPicker/index.tsx +8 -8
- package/src/ColorPreset/index.tsx +9 -6
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/ColorContrast/index.d.ts.map +1 -1
- package/types/ColorMixer/index.d.ts.map +1 -1
- package/types/ColorPicker/index.d.ts.map +1 -1
- package/types/ColorPreset/index.d.ts.map +1 -1
|
@@ -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
|
-
|
|
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({
|
|
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({
|
|
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
|
|
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
|
|
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 })
|