@instructure/ui-color-picker 11.7.8 → 11.7.9-snapshot-1
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 +8 -0
- package/es/ColorIndicator/v1/styles.js +2 -3
- package/es/ColorIndicator/v2/styles.js +2 -3
- package/es/ColorMixer/v1/index.js +10 -11
- package/es/ColorMixer/v2/index.js +10 -11
- package/es/ColorPicker/v1/index.js +3 -4
- package/es/ColorPicker/v2/index.js +3 -4
- package/es/ColorPreset/v1/index.js +6 -6
- package/es/ColorPreset/v2/index.js +6 -6
- package/lib/ColorContrast/v1/index.js +5 -6
- package/lib/ColorContrast/v2/index.js +5 -6
- package/lib/ColorIndicator/v1/index.js +2 -2
- package/lib/ColorIndicator/v1/styles.js +2 -4
- package/lib/ColorIndicator/v2/index.js +2 -2
- package/lib/ColorIndicator/v2/styles.js +2 -4
- package/lib/ColorMixer/v1/ColorPalette/index.js +7 -7
- package/lib/ColorMixer/v1/ColorPalette/styles.js +3 -3
- package/lib/ColorMixer/v1/RGBAInput/index.js +5 -5
- package/lib/ColorMixer/v1/Slider/index.js +3 -3
- package/lib/ColorMixer/v1/index.js +13 -14
- package/lib/ColorMixer/v2/ColorPalette/index.js +7 -7
- package/lib/ColorMixer/v2/ColorPalette/styles.js +3 -3
- package/lib/ColorMixer/v2/RGBAInput/index.js +5 -5
- package/lib/ColorMixer/v2/Slider/index.js +3 -3
- package/lib/ColorMixer/v2/index.js +13 -14
- package/lib/ColorPicker/v1/index.js +14 -19
- package/lib/ColorPicker/v2/index.js +10 -12
- package/lib/ColorPreset/v1/index.js +11 -12
- package/lib/ColorPreset/v2/index.js +8 -8
- package/package.json +24 -24
- package/src/ColorIndicator/v1/styles.ts +3 -4
- package/src/ColorIndicator/v2/styles.ts +3 -4
- package/src/ColorMixer/v1/index.tsx +15 -13
- package/src/ColorMixer/v2/index.tsx +15 -13
- package/src/ColorPicker/v1/index.tsx +7 -4
- package/src/ColorPicker/v2/index.tsx +7 -4
- package/src/ColorPreset/v1/index.tsx +6 -9
- package/src/ColorPreset/v2/index.tsx +6 -9
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/ColorIndicator/v1/styles.d.ts.map +1 -1
- package/types/ColorIndicator/v2/styles.d.ts.map +1 -1
- package/types/ColorMixer/v1/index.d.ts.map +1 -1
- package/types/ColorMixer/v2/index.d.ts.map +1 -1
- package/types/ColorPicker/v1/index.d.ts.map +1 -1
- package/types/ColorPicker/v2/index.d.ts.map +1 -1
- package/types/ColorPreset/v1/index.d.ts.map +1 -1
- package/types/ColorPreset/v2/index.d.ts.map +1 -1
|
@@ -7,8 +7,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.default = exports.ColorPreset = void 0;
|
|
8
8
|
var _react = require("react");
|
|
9
9
|
var _emotion = require("@instructure/emotion");
|
|
10
|
-
var
|
|
11
|
-
var _uiColorUtils =
|
|
10
|
+
var _uiReactUtils = require("@instructure/ui-react-utils");
|
|
11
|
+
var _uiColorUtils = require("@instructure/ui-color-utils");
|
|
12
12
|
var _latest = require("@instructure/ui-buttons/latest");
|
|
13
13
|
var _latest2 = require("@instructure/ui-view/latest");
|
|
14
14
|
var _latest3 = require("@instructure/ui-tooltip/latest");
|
|
@@ -94,7 +94,7 @@ let ColorPreset = exports.ColorPreset = (_dec = (0, _emotion.withStyleNew)(_styl
|
|
|
94
94
|
const {
|
|
95
95
|
selected
|
|
96
96
|
} = this.props;
|
|
97
|
-
return !!selected && _uiColorUtils.
|
|
97
|
+
return !!selected && (0, _uiColorUtils.colorToHex8)(selected) === (0, _uiColorUtils.colorToHex8)(color);
|
|
98
98
|
}
|
|
99
99
|
onMenuItemSelected = color => (_e, args) => {
|
|
100
100
|
if (args.value === 'select') {
|
|
@@ -135,9 +135,9 @@ let ColorPreset = exports.ColorPreset = (_dec = (0, _emotion.withStyleNew)(_styl
|
|
|
135
135
|
children: [(0, _jsxRuntime.jsxs)("div", {
|
|
136
136
|
css: this.props.styles?.popoverContent,
|
|
137
137
|
children: [(0, _jsxRuntime.jsx)(_index2.ColorMixer, {
|
|
138
|
-
value: _uiColorUtils.
|
|
138
|
+
value: (0, _uiColorUtils.colorToHex8)(this.state.newColor),
|
|
139
139
|
onChange: newColor => this.setState({
|
|
140
|
-
newColor: _uiColorUtils.
|
|
140
|
+
newColor: (0, _uiColorUtils.colorToRGB)(newColor)
|
|
141
141
|
}),
|
|
142
142
|
withAlpha: this.props?.colorMixerSettings?.colorMixer?.withAlpha,
|
|
143
143
|
rgbRedInputScreenReaderLabel: this.props.colorMixerSettings.colorMixer.rgbRedInputScreenReaderLabel,
|
|
@@ -151,7 +151,7 @@ let ColorPreset = exports.ColorPreset = (_dec = (0, _emotion.withStyleNew)(_styl
|
|
|
151
151
|
css: this.props.styles?.popoverContrastBlock,
|
|
152
152
|
children: (0, _jsxRuntime.jsx)(_index3.ColorContrast, {
|
|
153
153
|
firstColor: this.props.colorMixerSettings.colorContrast.firstColor,
|
|
154
|
-
secondColor: _uiColorUtils.
|
|
154
|
+
secondColor: (0, _uiColorUtils.colorToHex8)(this.state.newColor),
|
|
155
155
|
label: this.props.colorMixerSettings.colorContrast.label,
|
|
156
156
|
successLabel: this.props.colorMixerSettings.colorContrast.successLabel,
|
|
157
157
|
failureLabel: this.props.colorMixerSettings.colorContrast.failureLabel,
|
|
@@ -166,7 +166,7 @@ let ColorPreset = exports.ColorPreset = (_dec = (0, _emotion.withStyleNew)(_styl
|
|
|
166
166
|
css: this.props.styles?.popoverFooter,
|
|
167
167
|
children: [(0, _jsxRuntime.jsx)(_latest.Button, {
|
|
168
168
|
onClick: () => {
|
|
169
|
-
this.props?.colorMixerSettings?.onPresetChange([_uiColorUtils.
|
|
169
|
+
this.props?.colorMixerSettings?.onPresetChange([(0, _uiColorUtils.colorToHex8)(this.state.newColor), ...this.props.colors]);
|
|
170
170
|
this.setState({
|
|
171
171
|
openAddNew: false
|
|
172
172
|
});
|
|
@@ -273,7 +273,7 @@ let ColorPreset = exports.ColorPreset = (_dec = (0, _emotion.withStyleNew)(_styl
|
|
|
273
273
|
return null;
|
|
274
274
|
}
|
|
275
275
|
return (0, _jsxRuntime.jsxs)("div", {
|
|
276
|
-
...(0,
|
|
276
|
+
...(0, _uiReactUtils.omitProps)(this.props, ColorPreset.allowedProps),
|
|
277
277
|
ref: this.handleRef,
|
|
278
278
|
css: styles?.colorPreset,
|
|
279
279
|
"data-cid": "ColorPreset",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-color-picker",
|
|
3
|
-
"version": "11.7.
|
|
3
|
+
"version": "11.7.9-snapshot-1",
|
|
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",
|
|
@@ -15,32 +15,32 @@
|
|
|
15
15
|
"license": "MIT",
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@babel/runtime": "^7.29.7",
|
|
18
|
-
"@instructure/
|
|
19
|
-
"@instructure/
|
|
20
|
-
"@instructure/
|
|
21
|
-
"@instructure/ui-
|
|
22
|
-
"@instructure/
|
|
23
|
-
"@instructure/ui-color-utils": "11.7.
|
|
24
|
-
"@instructure/ui-
|
|
25
|
-
"@instructure/ui-
|
|
26
|
-
"@instructure/ui-
|
|
27
|
-
"@instructure/ui-
|
|
28
|
-
"@instructure/ui-icons": "11.7.
|
|
29
|
-
"@instructure/ui-
|
|
30
|
-
"@instructure/ui-
|
|
31
|
-
"@instructure/ui-
|
|
32
|
-
"@instructure/ui-
|
|
33
|
-
"@instructure/ui-text
|
|
34
|
-
"@instructure/ui-tooltip": "11.7.
|
|
35
|
-
"@instructure/ui-themes": "11.7.
|
|
36
|
-
"@instructure/ui-
|
|
37
|
-
"@instructure/ui-
|
|
18
|
+
"@instructure/emotion": "11.7.9-snapshot-1",
|
|
19
|
+
"@instructure/console": "11.7.9-snapshot-1",
|
|
20
|
+
"@instructure/shared-types": "11.7.9-snapshot-1",
|
|
21
|
+
"@instructure/ui-a11y-content": "11.7.9-snapshot-1",
|
|
22
|
+
"@instructure/ui-buttons": "11.7.9-snapshot-1",
|
|
23
|
+
"@instructure/ui-color-utils": "11.7.9-snapshot-1",
|
|
24
|
+
"@instructure/ui-dom-utils": "11.7.9-snapshot-1",
|
|
25
|
+
"@instructure/ui-drilldown": "11.7.9-snapshot-1",
|
|
26
|
+
"@instructure/ui-heading": "11.7.9-snapshot-1",
|
|
27
|
+
"@instructure/ui-form-field": "11.7.9-snapshot-1",
|
|
28
|
+
"@instructure/ui-icons": "11.7.9-snapshot-1",
|
|
29
|
+
"@instructure/ui-react-utils": "11.7.9-snapshot-1",
|
|
30
|
+
"@instructure/ui-pill": "11.7.9-snapshot-1",
|
|
31
|
+
"@instructure/ui-text-input": "11.7.9-snapshot-1",
|
|
32
|
+
"@instructure/ui-popover": "11.7.9-snapshot-1",
|
|
33
|
+
"@instructure/ui-text": "11.7.9-snapshot-1",
|
|
34
|
+
"@instructure/ui-tooltip": "11.7.9-snapshot-1",
|
|
35
|
+
"@instructure/ui-themes": "11.7.9-snapshot-1",
|
|
36
|
+
"@instructure/ui-utils": "11.7.9-snapshot-1",
|
|
37
|
+
"@instructure/ui-view": "11.7.9-snapshot-1"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"vitest": "^5.0.0",
|
|
41
|
-
"@instructure/ui-axe-check": "11.7.
|
|
42
|
-
"@instructure/ui-
|
|
43
|
-
"@instructure/ui-
|
|
41
|
+
"@instructure/ui-axe-check": "11.7.9-snapshot-1",
|
|
42
|
+
"@instructure/ui-babel-preset": "11.7.9-snapshot-1",
|
|
43
|
+
"@instructure/ui-scripts": "11.7.9-snapshot-1"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
46
46
|
"react": ">=18 <=19"
|
|
@@ -25,8 +25,7 @@
|
|
|
25
25
|
import type { ColorIndicatorProps, ColorIndicatorStyle } from './props'
|
|
26
26
|
import type { ColorIndicatorTheme } from '@instructure/shared-types'
|
|
27
27
|
import type { RGBAType } from '@instructure/ui-color-utils'
|
|
28
|
-
import
|
|
29
|
-
import { isValid } from '@instructure/ui-color-utils'
|
|
28
|
+
import { colorToRGB, isValid } from '@instructure/ui-color-utils'
|
|
30
29
|
|
|
31
30
|
const calcBlendedColor = (c1: RGBAType, c2: RGBAType) => {
|
|
32
31
|
// 0.4 as decided by design
|
|
@@ -79,8 +78,8 @@ const generateStyle = (
|
|
|
79
78
|
backgroundSize: componentTheme.backgroundSize,
|
|
80
79
|
backgroundPosition: componentTheme.backgroundPosition,
|
|
81
80
|
borderColor: calcBlendedColor(
|
|
82
|
-
|
|
83
|
-
|
|
81
|
+
colorToRGB(componentTheme.colorIndicatorBorderColor),
|
|
82
|
+
colorToRGB(isValid(color!) ? color! : '#fff')
|
|
84
83
|
)
|
|
85
84
|
}
|
|
86
85
|
}
|
|
@@ -25,8 +25,7 @@
|
|
|
25
25
|
import type { ColorIndicatorProps, ColorIndicatorStyle } from './props'
|
|
26
26
|
import type { NewComponentTypes } from '@instructure/ui-themes'
|
|
27
27
|
import type { RGBAType } from '@instructure/ui-color-utils'
|
|
28
|
-
import
|
|
29
|
-
import { isValid } from '@instructure/ui-color-utils'
|
|
28
|
+
import { colorToRGB, isValid } from '@instructure/ui-color-utils'
|
|
30
29
|
|
|
31
30
|
const calcBlendedColor = (c1: RGBAType, c2: RGBAType) => {
|
|
32
31
|
// 0.4 as decided by design
|
|
@@ -79,8 +78,8 @@ const generateStyle = (
|
|
|
79
78
|
backgroundSize: componentTheme.backgroundSize,
|
|
80
79
|
backgroundPosition: componentTheme.backgroundPosition,
|
|
81
80
|
borderColor: calcBlendedColor(
|
|
82
|
-
|
|
83
|
-
|
|
81
|
+
colorToRGB(componentTheme.colorIndicatorBorderColor),
|
|
82
|
+
colorToRGB(isValid(color!) ? color! : '#fff')
|
|
84
83
|
)
|
|
85
84
|
}
|
|
86
85
|
}
|
|
@@ -26,8 +26,12 @@ import { Component } from 'react'
|
|
|
26
26
|
|
|
27
27
|
import { withStyle } from '@instructure/emotion'
|
|
28
28
|
import { omitProps } from '@instructure/ui-react-utils'
|
|
29
|
-
import {
|
|
30
|
-
|
|
29
|
+
import {
|
|
30
|
+
isValid,
|
|
31
|
+
colorToHsva,
|
|
32
|
+
colorToHex8,
|
|
33
|
+
colorToRGB
|
|
34
|
+
} from '@instructure/ui-color-utils'
|
|
31
35
|
import { logWarn as warn } from '@instructure/console'
|
|
32
36
|
import type { HSVType } from '@instructure/ui-color-utils'
|
|
33
37
|
import ColorPalette from './ColorPalette/index.js'
|
|
@@ -90,7 +94,7 @@ class ColorMixer extends Component<ColorMixerProps, ColorMixerState> {
|
|
|
90
94
|
`[ColorMixer] The passed color value is not valid.`
|
|
91
95
|
)
|
|
92
96
|
this.setState({
|
|
93
|
-
...
|
|
97
|
+
...colorToHsva(this.props.value!)
|
|
94
98
|
})
|
|
95
99
|
}
|
|
96
100
|
|
|
@@ -103,14 +107,14 @@ class ColorMixer extends Component<ColorMixerProps, ColorMixerState> {
|
|
|
103
107
|
prevState.v !== v ||
|
|
104
108
|
prevState.a !== a
|
|
105
109
|
) {
|
|
106
|
-
this.props.onChange(
|
|
110
|
+
this.props.onChange(colorToHex8({ h, s, v, a }))
|
|
107
111
|
}
|
|
108
112
|
if (
|
|
109
113
|
prevProps.value !== this.props.value &&
|
|
110
|
-
|
|
114
|
+
colorToHex8({ h, s, v, a }) !== this.props.value
|
|
111
115
|
) {
|
|
112
116
|
this.setState({
|
|
113
|
-
...
|
|
117
|
+
...colorToHsva(this.props.value!)
|
|
114
118
|
})
|
|
115
119
|
}
|
|
116
120
|
}
|
|
@@ -141,7 +145,7 @@ class ColorMixer extends Component<ColorMixerProps, ColorMixerState> {
|
|
|
141
145
|
>
|
|
142
146
|
<span
|
|
143
147
|
css={styles?.sliderAndPaletteContainer}
|
|
144
|
-
aria-label={`${
|
|
148
|
+
aria-label={`${colorToHex8({ h, s, v, a })}`}
|
|
145
149
|
aria-live="polite"
|
|
146
150
|
>
|
|
147
151
|
<ColorPalette
|
|
@@ -171,7 +175,7 @@ class ColorMixer extends Component<ColorMixerProps, ColorMixerState> {
|
|
|
171
175
|
value={h}
|
|
172
176
|
minValue={0}
|
|
173
177
|
maxValue={359}
|
|
174
|
-
color={
|
|
178
|
+
color={colorToHex8({ h, s, v, a })}
|
|
175
179
|
onChange={(hue: number) => {
|
|
176
180
|
this.setState({ h: hue })
|
|
177
181
|
}}
|
|
@@ -185,7 +189,7 @@ class ColorMixer extends Component<ColorMixerProps, ColorMixerState> {
|
|
|
185
189
|
width={this._width}
|
|
186
190
|
height={this._sliderHeight}
|
|
187
191
|
indicatorRadius={this._sliderIndicatorRadius}
|
|
188
|
-
color={
|
|
192
|
+
color={colorToHex8({ h, s, v })}
|
|
189
193
|
value={a}
|
|
190
194
|
minValue={0}
|
|
191
195
|
maxValue={1}
|
|
@@ -200,10 +204,8 @@ class ColorMixer extends Component<ColorMixerProps, ColorMixerState> {
|
|
|
200
204
|
disabled={disabled}
|
|
201
205
|
label={withAlpha ? 'RGBA' : 'RGB'}
|
|
202
206
|
width={this._width}
|
|
203
|
-
value={
|
|
204
|
-
onChange={(color) =>
|
|
205
|
-
this.setState({ ...conversions.colorToHsva(color) })
|
|
206
|
-
}
|
|
207
|
+
value={colorToRGB({ h, s, v, a })}
|
|
208
|
+
onChange={(color) => this.setState({ ...colorToHsva(color) })}
|
|
207
209
|
withAlpha={withAlpha}
|
|
208
210
|
rgbRedInputScreenReaderLabel={rgbRedInputScreenReaderLabel}
|
|
209
211
|
rgbGreenInputScreenReaderLabel={rgbGreenInputScreenReaderLabel}
|
|
@@ -26,8 +26,12 @@ import { Component } from 'react'
|
|
|
26
26
|
|
|
27
27
|
import { withStyleNew } from '@instructure/emotion'
|
|
28
28
|
import { omitProps } from '@instructure/ui-react-utils'
|
|
29
|
-
import {
|
|
30
|
-
|
|
29
|
+
import {
|
|
30
|
+
isValid,
|
|
31
|
+
colorToHsva,
|
|
32
|
+
colorToHex8,
|
|
33
|
+
colorToRGB
|
|
34
|
+
} from '@instructure/ui-color-utils'
|
|
31
35
|
import { logWarn as warn } from '@instructure/console'
|
|
32
36
|
import type { HSVType } from '@instructure/ui-color-utils'
|
|
33
37
|
import ColorPalette from './ColorPalette/index.js'
|
|
@@ -90,7 +94,7 @@ class ColorMixer extends Component<ColorMixerProps, ColorMixerState> {
|
|
|
90
94
|
`[ColorMixer] The passed color value is not valid.`
|
|
91
95
|
)
|
|
92
96
|
this.setState({
|
|
93
|
-
...
|
|
97
|
+
...colorToHsva(this.props.value!)
|
|
94
98
|
})
|
|
95
99
|
}
|
|
96
100
|
|
|
@@ -103,14 +107,14 @@ class ColorMixer extends Component<ColorMixerProps, ColorMixerState> {
|
|
|
103
107
|
prevState.v !== v ||
|
|
104
108
|
prevState.a !== a
|
|
105
109
|
) {
|
|
106
|
-
this.props.onChange(
|
|
110
|
+
this.props.onChange(colorToHex8({ h, s, v, a }))
|
|
107
111
|
}
|
|
108
112
|
if (
|
|
109
113
|
prevProps.value !== this.props.value &&
|
|
110
|
-
|
|
114
|
+
colorToHex8({ h, s, v, a }) !== this.props.value
|
|
111
115
|
) {
|
|
112
116
|
this.setState({
|
|
113
|
-
...
|
|
117
|
+
...colorToHsva(this.props.value!)
|
|
114
118
|
})
|
|
115
119
|
}
|
|
116
120
|
}
|
|
@@ -141,7 +145,7 @@ class ColorMixer extends Component<ColorMixerProps, ColorMixerState> {
|
|
|
141
145
|
>
|
|
142
146
|
<span
|
|
143
147
|
css={styles?.sliderAndPaletteContainer}
|
|
144
|
-
aria-label={`${
|
|
148
|
+
aria-label={`${colorToHex8({ h, s, v, a })}`}
|
|
145
149
|
aria-live="polite"
|
|
146
150
|
>
|
|
147
151
|
<ColorPalette
|
|
@@ -171,7 +175,7 @@ class ColorMixer extends Component<ColorMixerProps, ColorMixerState> {
|
|
|
171
175
|
value={h}
|
|
172
176
|
minValue={0}
|
|
173
177
|
maxValue={359}
|
|
174
|
-
color={
|
|
178
|
+
color={colorToHex8({ h, s, v, a })}
|
|
175
179
|
onChange={(hue: number) => {
|
|
176
180
|
this.setState({ h: hue })
|
|
177
181
|
}}
|
|
@@ -185,7 +189,7 @@ class ColorMixer extends Component<ColorMixerProps, ColorMixerState> {
|
|
|
185
189
|
width={this._width}
|
|
186
190
|
height={this._sliderHeight}
|
|
187
191
|
indicatorRadius={this._sliderIndicatorRadius}
|
|
188
|
-
color={
|
|
192
|
+
color={colorToHex8({ h, s, v })}
|
|
189
193
|
value={a}
|
|
190
194
|
minValue={0}
|
|
191
195
|
maxValue={1}
|
|
@@ -200,10 +204,8 @@ class ColorMixer extends Component<ColorMixerProps, ColorMixerState> {
|
|
|
200
204
|
disabled={disabled}
|
|
201
205
|
label={withAlpha ? 'RGBA' : 'RGB'}
|
|
202
206
|
width={this._width}
|
|
203
|
-
value={
|
|
204
|
-
onChange={(color) =>
|
|
205
|
-
this.setState({ ...conversions.colorToHsva(color) })
|
|
206
|
-
}
|
|
207
|
+
value={colorToRGB({ h, s, v, a })}
|
|
208
|
+
onChange={(color) => this.setState({ ...colorToHsva(color) })}
|
|
207
209
|
withAlpha={withAlpha}
|
|
208
210
|
rgbRedInputScreenReaderLabel={rgbRedInputScreenReaderLabel}
|
|
209
211
|
rgbGreenInputScreenReaderLabel={rgbGreenInputScreenReaderLabel}
|
|
@@ -27,8 +27,11 @@ import { Component } from 'react'
|
|
|
27
27
|
import { withStyle, InstUISettingsProvider } from '@instructure/emotion'
|
|
28
28
|
import { warn, error } from '@instructure/console'
|
|
29
29
|
import { omitProps } from '@instructure/ui-react-utils'
|
|
30
|
-
import {
|
|
31
|
-
|
|
30
|
+
import {
|
|
31
|
+
isValid,
|
|
32
|
+
contrast as getContrast,
|
|
33
|
+
colorToHex8
|
|
34
|
+
} from '@instructure/ui-color-utils'
|
|
32
35
|
import { TextInput } from '@instructure/ui-text-input/v11_6'
|
|
33
36
|
import { Tooltip } from '@instructure/ui-tooltip/v11_6'
|
|
34
37
|
import { Button, IconButton } from '@instructure/ui-buttons/v11_6'
|
|
@@ -542,7 +545,7 @@ class ColorPicker extends Component<ColorPickerProps, ColorPickerState> {
|
|
|
542
545
|
`#${this.mixedColorWithStrippedAlpha}`,
|
|
543
546
|
(newColor: string) => {
|
|
544
547
|
this.setState({
|
|
545
|
-
mixedColor:
|
|
548
|
+
mixedColor: colorToHex8(newColor).slice(1)
|
|
546
549
|
})
|
|
547
550
|
},
|
|
548
551
|
() => {
|
|
@@ -572,7 +575,7 @@ class ColorPicker extends Component<ColorPickerProps, ColorPickerState> {
|
|
|
572
575
|
value={`#${this.state.mixedColor}`}
|
|
573
576
|
onChange={(newColor: string) =>
|
|
574
577
|
this.setState({
|
|
575
|
-
mixedColor:
|
|
578
|
+
mixedColor: colorToHex8(newColor).slice(1)
|
|
576
579
|
})
|
|
577
580
|
}
|
|
578
581
|
withAlpha={this.props.colorMixerSettings.colorMixer.withAlpha}
|
|
@@ -27,8 +27,11 @@ import { Component } from 'react'
|
|
|
27
27
|
import { withStyleNew, InstUISettingsProvider } from '@instructure/emotion'
|
|
28
28
|
import { warn, error } from '@instructure/console'
|
|
29
29
|
import { omitProps } from '@instructure/ui-react-utils'
|
|
30
|
-
import {
|
|
31
|
-
|
|
30
|
+
import {
|
|
31
|
+
isValid,
|
|
32
|
+
contrast as getContrast,
|
|
33
|
+
colorToHex8
|
|
34
|
+
} from '@instructure/ui-color-utils'
|
|
32
35
|
import { TextInput } from '@instructure/ui-text-input/latest'
|
|
33
36
|
import { Tooltip } from '@instructure/ui-tooltip/latest'
|
|
34
37
|
import { Button, IconButton } from '@instructure/ui-buttons/latest'
|
|
@@ -546,7 +549,7 @@ class ColorPicker extends Component<ColorPickerProps, ColorPickerState> {
|
|
|
546
549
|
`#${this.mixedColorWithStrippedAlpha}`,
|
|
547
550
|
(newColor: string) => {
|
|
548
551
|
this.setState({
|
|
549
|
-
mixedColor:
|
|
552
|
+
mixedColor: colorToHex8(newColor).slice(1)
|
|
550
553
|
})
|
|
551
554
|
},
|
|
552
555
|
() => {
|
|
@@ -576,7 +579,7 @@ class ColorPicker extends Component<ColorPickerProps, ColorPickerState> {
|
|
|
576
579
|
value={`#${this.state.mixedColor}`}
|
|
577
580
|
onChange={(newColor: string) =>
|
|
578
581
|
this.setState({
|
|
579
|
-
mixedColor:
|
|
582
|
+
mixedColor: colorToHex8(newColor).slice(1)
|
|
580
583
|
})
|
|
581
584
|
}
|
|
582
585
|
withAlpha={this.props.colorMixerSettings.colorMixer.withAlpha}
|
|
@@ -26,7 +26,7 @@ import { Component } from 'react'
|
|
|
26
26
|
|
|
27
27
|
import { withStyle } from '@instructure/emotion'
|
|
28
28
|
import { omitProps } from '@instructure/ui-react-utils'
|
|
29
|
-
import
|
|
29
|
+
import { colorToHex8, colorToRGB } from '@instructure/ui-color-utils'
|
|
30
30
|
|
|
31
31
|
import { IconButton, Button } from '@instructure/ui-buttons/v11_6'
|
|
32
32
|
import { View } from '@instructure/ui-view/v11_6'
|
|
@@ -98,10 +98,7 @@ class ColorPreset extends Component<ColorPresetProps, ColorPresetState> {
|
|
|
98
98
|
|
|
99
99
|
isSelectedColor(color: string) {
|
|
100
100
|
const { selected } = this.props
|
|
101
|
-
return (
|
|
102
|
-
!!selected &&
|
|
103
|
-
conversions.colorToHex8(selected) === conversions.colorToHex8(color)
|
|
104
|
-
)
|
|
101
|
+
return !!selected && colorToHex8(selected) === colorToHex8(color)
|
|
105
102
|
}
|
|
106
103
|
|
|
107
104
|
onMenuItemSelected =
|
|
@@ -149,9 +146,9 @@ class ColorPreset extends Component<ColorPresetProps, ColorPresetState> {
|
|
|
149
146
|
>
|
|
150
147
|
<div css={this.props.styles?.popoverContent}>
|
|
151
148
|
<ColorMixer
|
|
152
|
-
value={
|
|
149
|
+
value={colorToHex8(this.state.newColor)}
|
|
153
150
|
onChange={(newColor: string) =>
|
|
154
|
-
this.setState({ newColor:
|
|
151
|
+
this.setState({ newColor: colorToRGB(newColor) })
|
|
155
152
|
}
|
|
156
153
|
withAlpha={this.props?.colorMixerSettings?.colorMixer?.withAlpha}
|
|
157
154
|
rgbRedInputScreenReaderLabel={
|
|
@@ -189,7 +186,7 @@ class ColorPreset extends Component<ColorPresetProps, ColorPresetState> {
|
|
|
189
186
|
firstColor={
|
|
190
187
|
this.props.colorMixerSettings.colorContrast.firstColor
|
|
191
188
|
}
|
|
192
|
-
secondColor={
|
|
189
|
+
secondColor={colorToHex8(this.state.newColor)}
|
|
193
190
|
label={this.props.colorMixerSettings.colorContrast.label}
|
|
194
191
|
successLabel={
|
|
195
192
|
this.props.colorMixerSettings.colorContrast.successLabel
|
|
@@ -220,7 +217,7 @@ class ColorPreset extends Component<ColorPresetProps, ColorPresetState> {
|
|
|
220
217
|
<Button
|
|
221
218
|
onClick={() => {
|
|
222
219
|
this.props?.colorMixerSettings?.onPresetChange([
|
|
223
|
-
|
|
220
|
+
colorToHex8(this.state.newColor),
|
|
224
221
|
...this.props.colors
|
|
225
222
|
])
|
|
226
223
|
this.setState({ openAddNew: false })
|
|
@@ -26,7 +26,7 @@ import { Component } from 'react'
|
|
|
26
26
|
|
|
27
27
|
import { withStyleNew } from '@instructure/emotion'
|
|
28
28
|
import { omitProps } from '@instructure/ui-react-utils'
|
|
29
|
-
import
|
|
29
|
+
import { colorToHex8, colorToRGB } from '@instructure/ui-color-utils'
|
|
30
30
|
|
|
31
31
|
import { IconButton, Button } from '@instructure/ui-buttons/latest'
|
|
32
32
|
import { View } from '@instructure/ui-view/latest'
|
|
@@ -97,10 +97,7 @@ class ColorPreset extends Component<ColorPresetProps, ColorPresetState> {
|
|
|
97
97
|
|
|
98
98
|
isSelectedColor(color: string) {
|
|
99
99
|
const { selected } = this.props
|
|
100
|
-
return (
|
|
101
|
-
!!selected &&
|
|
102
|
-
conversions.colorToHex8(selected) === conversions.colorToHex8(color)
|
|
103
|
-
)
|
|
100
|
+
return !!selected && colorToHex8(selected) === colorToHex8(color)
|
|
104
101
|
}
|
|
105
102
|
|
|
106
103
|
onMenuItemSelected =
|
|
@@ -148,9 +145,9 @@ class ColorPreset extends Component<ColorPresetProps, ColorPresetState> {
|
|
|
148
145
|
>
|
|
149
146
|
<div css={this.props.styles?.popoverContent}>
|
|
150
147
|
<ColorMixer
|
|
151
|
-
value={
|
|
148
|
+
value={colorToHex8(this.state.newColor)}
|
|
152
149
|
onChange={(newColor: string) =>
|
|
153
|
-
this.setState({ newColor:
|
|
150
|
+
this.setState({ newColor: colorToRGB(newColor) })
|
|
154
151
|
}
|
|
155
152
|
withAlpha={this.props?.colorMixerSettings?.colorMixer?.withAlpha}
|
|
156
153
|
rgbRedInputScreenReaderLabel={
|
|
@@ -188,7 +185,7 @@ class ColorPreset extends Component<ColorPresetProps, ColorPresetState> {
|
|
|
188
185
|
firstColor={
|
|
189
186
|
this.props.colorMixerSettings.colorContrast.firstColor
|
|
190
187
|
}
|
|
191
|
-
secondColor={
|
|
188
|
+
secondColor={colorToHex8(this.state.newColor)}
|
|
192
189
|
label={this.props.colorMixerSettings.colorContrast.label}
|
|
193
190
|
successLabel={
|
|
194
191
|
this.props.colorMixerSettings.colorContrast.successLabel
|
|
@@ -219,7 +216,7 @@ class ColorPreset extends Component<ColorPresetProps, ColorPresetState> {
|
|
|
219
216
|
<Button
|
|
220
217
|
onClick={() => {
|
|
221
218
|
this.props?.colorMixerSettings?.onPresetChange([
|
|
222
|
-
|
|
219
|
+
colorToHex8(this.state.newColor),
|
|
223
220
|
...this.props.colors
|
|
224
221
|
])
|
|
225
222
|
this.setState({ openAddNew: false })
|