@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
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,14 @@
|
|
|
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
|
+
## [11.7.9-snapshot-1](https://github.com/instructure/instructure-ui/compare/v11.7.8...v11.7.9-snapshot-1) (2026-10-06)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @instructure/ui-color-picker
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
6
14
|
## [11.7.8](https://github.com/instructure/instructure-ui/compare/v11.7.7...v11.7.8) (2026-10-02)
|
|
7
15
|
|
|
8
16
|
**Note:** Version bump only for package @instructure/ui-color-picker
|
|
@@ -22,8 +22,7 @@
|
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
-
import
|
|
26
|
-
import { isValid } from '@instructure/ui-color-utils';
|
|
25
|
+
import { colorToRGB, isValid } from '@instructure/ui-color-utils';
|
|
27
26
|
const calcBlendedColor = (c1, c2) => {
|
|
28
27
|
// 0.4 as decided by design
|
|
29
28
|
const c2Alpha = c2.a * 0.4;
|
|
@@ -63,7 +62,7 @@ const generateStyle = (componentTheme, props) => {
|
|
|
63
62
|
backgroundImage: componentTheme.backgroundImage,
|
|
64
63
|
backgroundSize: componentTheme.backgroundSize,
|
|
65
64
|
backgroundPosition: componentTheme.backgroundPosition,
|
|
66
|
-
borderColor: calcBlendedColor(
|
|
65
|
+
borderColor: calcBlendedColor(colorToRGB(componentTheme.colorIndicatorBorderColor), colorToRGB(isValid(color) ? color : '#fff'))
|
|
67
66
|
}
|
|
68
67
|
};
|
|
69
68
|
};
|
|
@@ -22,8 +22,7 @@
|
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
-
import
|
|
26
|
-
import { isValid } from '@instructure/ui-color-utils';
|
|
25
|
+
import { colorToRGB, isValid } from '@instructure/ui-color-utils';
|
|
27
26
|
const calcBlendedColor = (c1, c2) => {
|
|
28
27
|
// 0.4 as decided by design
|
|
29
28
|
const c2Alpha = c2.a * 0.4;
|
|
@@ -63,7 +62,7 @@ const generateStyle = (componentTheme, props) => {
|
|
|
63
62
|
backgroundImage: componentTheme.backgroundImage,
|
|
64
63
|
backgroundSize: componentTheme.backgroundSize,
|
|
65
64
|
backgroundPosition: componentTheme.backgroundPosition,
|
|
66
|
-
borderColor: calcBlendedColor(
|
|
65
|
+
borderColor: calcBlendedColor(colorToRGB(componentTheme.colorIndicatorBorderColor), colorToRGB(isValid(color) ? color : '#fff'))
|
|
67
66
|
}
|
|
68
67
|
};
|
|
69
68
|
};
|
|
@@ -26,8 +26,7 @@ var _dec, _class;
|
|
|
26
26
|
import { Component } from 'react';
|
|
27
27
|
import { withStyle } from '@instructure/emotion';
|
|
28
28
|
import { omitProps } from '@instructure/ui-react-utils';
|
|
29
|
-
import { isValid } from '@instructure/ui-color-utils';
|
|
30
|
-
import conversions from '@instructure/ui-color-utils';
|
|
29
|
+
import { isValid, colorToHsva, colorToHex8, colorToRGB } from '@instructure/ui-color-utils';
|
|
31
30
|
import { logWarn as warn } from '@instructure/console';
|
|
32
31
|
import ColorPalette from './ColorPalette/index.js';
|
|
33
32
|
import Slider from './Slider/index.js';
|
|
@@ -78,7 +77,7 @@ let ColorMixer = (_dec = withStyle(generateStyle, null), _dec(_class = class Col
|
|
|
78
77
|
this.props.makeStyles?.();
|
|
79
78
|
warn(isValid(this.props.value), `[ColorMixer] The passed color value is not valid.`);
|
|
80
79
|
this.setState({
|
|
81
|
-
...
|
|
80
|
+
...colorToHsva(this.props.value)
|
|
82
81
|
});
|
|
83
82
|
}
|
|
84
83
|
componentDidUpdate(prevProps, prevState) {
|
|
@@ -90,21 +89,21 @@ let ColorMixer = (_dec = withStyle(generateStyle, null), _dec(_class = class Col
|
|
|
90
89
|
a
|
|
91
90
|
} = this.state;
|
|
92
91
|
if (prevState.h !== h || prevState.s !== s || prevState.v !== v || prevState.a !== a) {
|
|
93
|
-
this.props.onChange(
|
|
92
|
+
this.props.onChange(colorToHex8({
|
|
94
93
|
h,
|
|
95
94
|
s,
|
|
96
95
|
v,
|
|
97
96
|
a
|
|
98
97
|
}));
|
|
99
98
|
}
|
|
100
|
-
if (prevProps.value !== this.props.value &&
|
|
99
|
+
if (prevProps.value !== this.props.value && colorToHex8({
|
|
101
100
|
h,
|
|
102
101
|
s,
|
|
103
102
|
v,
|
|
104
103
|
a
|
|
105
104
|
}) !== this.props.value) {
|
|
106
105
|
this.setState({
|
|
107
|
-
...
|
|
106
|
+
...colorToHsva(this.props.value)
|
|
108
107
|
});
|
|
109
108
|
}
|
|
110
109
|
}
|
|
@@ -135,7 +134,7 @@ let ColorMixer = (_dec = withStyle(generateStyle, null), _dec(_class = class Col
|
|
|
135
134
|
"data-cid": "ColorMixer",
|
|
136
135
|
children: [_jsxs("span", {
|
|
137
136
|
css: styles?.sliderAndPaletteContainer,
|
|
138
|
-
"aria-label": `${
|
|
137
|
+
"aria-label": `${colorToHex8({
|
|
139
138
|
h,
|
|
140
139
|
s,
|
|
141
140
|
v,
|
|
@@ -169,7 +168,7 @@ let ColorMixer = (_dec = withStyle(generateStyle, null), _dec(_class = class Col
|
|
|
169
168
|
value: h,
|
|
170
169
|
minValue: 0,
|
|
171
170
|
maxValue: 359,
|
|
172
|
-
color:
|
|
171
|
+
color: colorToHex8({
|
|
173
172
|
h,
|
|
174
173
|
s,
|
|
175
174
|
v,
|
|
@@ -186,7 +185,7 @@ let ColorMixer = (_dec = withStyle(generateStyle, null), _dec(_class = class Col
|
|
|
186
185
|
width: this._width,
|
|
187
186
|
height: this._sliderHeight,
|
|
188
187
|
indicatorRadius: this._sliderIndicatorRadius,
|
|
189
|
-
color:
|
|
188
|
+
color: colorToHex8({
|
|
190
189
|
h,
|
|
191
190
|
s,
|
|
192
191
|
v
|
|
@@ -203,14 +202,14 @@ let ColorMixer = (_dec = withStyle(generateStyle, null), _dec(_class = class Col
|
|
|
203
202
|
disabled: disabled,
|
|
204
203
|
label: withAlpha ? 'RGBA' : 'RGB',
|
|
205
204
|
width: this._width,
|
|
206
|
-
value:
|
|
205
|
+
value: colorToRGB({
|
|
207
206
|
h,
|
|
208
207
|
s,
|
|
209
208
|
v,
|
|
210
209
|
a
|
|
211
210
|
}),
|
|
212
211
|
onChange: color => this.setState({
|
|
213
|
-
...
|
|
212
|
+
...colorToHsva(color)
|
|
214
213
|
}),
|
|
215
214
|
withAlpha: withAlpha,
|
|
216
215
|
rgbRedInputScreenReaderLabel: rgbRedInputScreenReaderLabel,
|
|
@@ -26,8 +26,7 @@ var _dec, _class;
|
|
|
26
26
|
import { Component } from 'react';
|
|
27
27
|
import { withStyleNew } from '@instructure/emotion';
|
|
28
28
|
import { omitProps } from '@instructure/ui-react-utils';
|
|
29
|
-
import { isValid } from '@instructure/ui-color-utils';
|
|
30
|
-
import conversions from '@instructure/ui-color-utils';
|
|
29
|
+
import { isValid, colorToHsva, colorToHex8, colorToRGB } from '@instructure/ui-color-utils';
|
|
31
30
|
import { logWarn as warn } from '@instructure/console';
|
|
32
31
|
import ColorPalette from './ColorPalette/index.js';
|
|
33
32
|
import Slider from './Slider/index.js';
|
|
@@ -78,7 +77,7 @@ let ColorMixer = (_dec = withStyleNew(generateStyle), _dec(_class = class ColorM
|
|
|
78
77
|
this.props.makeStyles?.();
|
|
79
78
|
warn(isValid(this.props.value), `[ColorMixer] The passed color value is not valid.`);
|
|
80
79
|
this.setState({
|
|
81
|
-
...
|
|
80
|
+
...colorToHsva(this.props.value)
|
|
82
81
|
});
|
|
83
82
|
}
|
|
84
83
|
componentDidUpdate(prevProps, prevState) {
|
|
@@ -90,21 +89,21 @@ let ColorMixer = (_dec = withStyleNew(generateStyle), _dec(_class = class ColorM
|
|
|
90
89
|
a
|
|
91
90
|
} = this.state;
|
|
92
91
|
if (prevState.h !== h || prevState.s !== s || prevState.v !== v || prevState.a !== a) {
|
|
93
|
-
this.props.onChange(
|
|
92
|
+
this.props.onChange(colorToHex8({
|
|
94
93
|
h,
|
|
95
94
|
s,
|
|
96
95
|
v,
|
|
97
96
|
a
|
|
98
97
|
}));
|
|
99
98
|
}
|
|
100
|
-
if (prevProps.value !== this.props.value &&
|
|
99
|
+
if (prevProps.value !== this.props.value && colorToHex8({
|
|
101
100
|
h,
|
|
102
101
|
s,
|
|
103
102
|
v,
|
|
104
103
|
a
|
|
105
104
|
}) !== this.props.value) {
|
|
106
105
|
this.setState({
|
|
107
|
-
...
|
|
106
|
+
...colorToHsva(this.props.value)
|
|
108
107
|
});
|
|
109
108
|
}
|
|
110
109
|
}
|
|
@@ -135,7 +134,7 @@ let ColorMixer = (_dec = withStyleNew(generateStyle), _dec(_class = class ColorM
|
|
|
135
134
|
"data-cid": "ColorMixer",
|
|
136
135
|
children: [_jsxs("span", {
|
|
137
136
|
css: styles?.sliderAndPaletteContainer,
|
|
138
|
-
"aria-label": `${
|
|
137
|
+
"aria-label": `${colorToHex8({
|
|
139
138
|
h,
|
|
140
139
|
s,
|
|
141
140
|
v,
|
|
@@ -169,7 +168,7 @@ let ColorMixer = (_dec = withStyleNew(generateStyle), _dec(_class = class ColorM
|
|
|
169
168
|
value: h,
|
|
170
169
|
minValue: 0,
|
|
171
170
|
maxValue: 359,
|
|
172
|
-
color:
|
|
171
|
+
color: colorToHex8({
|
|
173
172
|
h,
|
|
174
173
|
s,
|
|
175
174
|
v,
|
|
@@ -186,7 +185,7 @@ let ColorMixer = (_dec = withStyleNew(generateStyle), _dec(_class = class ColorM
|
|
|
186
185
|
width: this._width,
|
|
187
186
|
height: this._sliderHeight,
|
|
188
187
|
indicatorRadius: this._sliderIndicatorRadius,
|
|
189
|
-
color:
|
|
188
|
+
color: colorToHex8({
|
|
190
189
|
h,
|
|
191
190
|
s,
|
|
192
191
|
v
|
|
@@ -203,14 +202,14 @@ let ColorMixer = (_dec = withStyleNew(generateStyle), _dec(_class = class ColorM
|
|
|
203
202
|
disabled: disabled,
|
|
204
203
|
label: withAlpha ? 'RGBA' : 'RGB',
|
|
205
204
|
width: this._width,
|
|
206
|
-
value:
|
|
205
|
+
value: colorToRGB({
|
|
207
206
|
h,
|
|
208
207
|
s,
|
|
209
208
|
v,
|
|
210
209
|
a
|
|
211
210
|
}),
|
|
212
211
|
onChange: color => this.setState({
|
|
213
|
-
...
|
|
212
|
+
...colorToHsva(color)
|
|
214
213
|
}),
|
|
215
214
|
withAlpha: withAlpha,
|
|
216
215
|
rgbRedInputScreenReaderLabel: rgbRedInputScreenReaderLabel,
|
|
@@ -27,8 +27,7 @@ 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 { isValid, contrast as getContrast } from '@instructure/ui-color-utils';
|
|
31
|
-
import conversions from '@instructure/ui-color-utils';
|
|
30
|
+
import { isValid, contrast as getContrast, colorToHex8 } from '@instructure/ui-color-utils';
|
|
32
31
|
import { TextInput } from '@instructure/ui-text-input/v11_6';
|
|
33
32
|
import { Tooltip } from '@instructure/ui-tooltip/v11_6';
|
|
34
33
|
import { Button, IconButton } from '@instructure/ui-buttons/v11_6';
|
|
@@ -430,7 +429,7 @@ let ColorPicker = (_dec = withStyle(generateStyle, generateComponentTheme), _dec
|
|
|
430
429
|
return _jsx("div", {
|
|
431
430
|
children: typeof children === 'function' && children(`#${this.mixedColorWithStrippedAlpha}`, newColor => {
|
|
432
431
|
this.setState({
|
|
433
|
-
mixedColor:
|
|
432
|
+
mixedColor: colorToHex8(newColor).slice(1)
|
|
434
433
|
});
|
|
435
434
|
}, () => {
|
|
436
435
|
this.setState({
|
|
@@ -452,7 +451,7 @@ let ColorPicker = (_dec = withStyle(generateStyle, generateComponentTheme), _dec
|
|
|
452
451
|
children: [this.props?.colorMixerSettings?.colorMixer && _jsx(ColorMixer, {
|
|
453
452
|
value: `#${this.state.mixedColor}`,
|
|
454
453
|
onChange: newColor => this.setState({
|
|
455
|
-
mixedColor:
|
|
454
|
+
mixedColor: colorToHex8(newColor).slice(1)
|
|
456
455
|
}),
|
|
457
456
|
withAlpha: this.props.colorMixerSettings.colorMixer.withAlpha,
|
|
458
457
|
rgbRedInputScreenReaderLabel: this.props.colorMixerSettings.colorMixer.rgbRedInputScreenReaderLabel,
|
|
@@ -27,8 +27,7 @@ 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 { isValid, contrast as getContrast } from '@instructure/ui-color-utils';
|
|
31
|
-
import conversions from '@instructure/ui-color-utils';
|
|
30
|
+
import { isValid, contrast as getContrast, colorToHex8 } from '@instructure/ui-color-utils';
|
|
32
31
|
import { TextInput } from '@instructure/ui-text-input/latest';
|
|
33
32
|
import { Tooltip } from '@instructure/ui-tooltip/latest';
|
|
34
33
|
import { Button, IconButton } from '@instructure/ui-buttons/latest';
|
|
@@ -437,7 +436,7 @@ let ColorPicker = (_dec = withStyleNew(generateStyle), _dec(_class = class Color
|
|
|
437
436
|
return _jsx("div", {
|
|
438
437
|
children: typeof children === 'function' && children(`#${this.mixedColorWithStrippedAlpha}`, newColor => {
|
|
439
438
|
this.setState({
|
|
440
|
-
mixedColor:
|
|
439
|
+
mixedColor: colorToHex8(newColor).slice(1)
|
|
441
440
|
});
|
|
442
441
|
}, () => {
|
|
443
442
|
this.setState({
|
|
@@ -459,7 +458,7 @@ let ColorPicker = (_dec = withStyleNew(generateStyle), _dec(_class = class Color
|
|
|
459
458
|
children: [this.props?.colorMixerSettings?.colorMixer && _jsx(ColorMixer, {
|
|
460
459
|
value: `#${this.state.mixedColor}`,
|
|
461
460
|
onChange: newColor => this.setState({
|
|
462
|
-
mixedColor:
|
|
461
|
+
mixedColor: colorToHex8(newColor).slice(1)
|
|
463
462
|
}),
|
|
464
463
|
withAlpha: this.props.colorMixerSettings.colorMixer.withAlpha,
|
|
465
464
|
rgbRedInputScreenReaderLabel: this.props.colorMixerSettings.colorMixer.rgbRedInputScreenReaderLabel,
|
|
@@ -26,7 +26,7 @@ var _dec, _class;
|
|
|
26
26
|
import { Component } from 'react';
|
|
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
|
import { IconButton, Button } from '@instructure/ui-buttons/v11_6';
|
|
31
31
|
import { View } from '@instructure/ui-view/v11_6';
|
|
32
32
|
import { Tooltip } from '@instructure/ui-tooltip/v11_6';
|
|
@@ -90,7 +90,7 @@ let ColorPreset = (_dec = withStyle(generateStyle, generateComponentTheme), _dec
|
|
|
90
90
|
const {
|
|
91
91
|
selected
|
|
92
92
|
} = this.props;
|
|
93
|
-
return !!selected &&
|
|
93
|
+
return !!selected && colorToHex8(selected) === colorToHex8(color);
|
|
94
94
|
}
|
|
95
95
|
onMenuItemSelected = color => (_e, args) => {
|
|
96
96
|
if (args.value === 'select') {
|
|
@@ -131,9 +131,9 @@ let ColorPreset = (_dec = withStyle(generateStyle, generateComponentTheme), _dec
|
|
|
131
131
|
children: [_jsxs("div", {
|
|
132
132
|
css: this.props.styles?.popoverContent,
|
|
133
133
|
children: [_jsx(ColorMixer, {
|
|
134
|
-
value:
|
|
134
|
+
value: colorToHex8(this.state.newColor),
|
|
135
135
|
onChange: newColor => this.setState({
|
|
136
|
-
newColor:
|
|
136
|
+
newColor: colorToRGB(newColor)
|
|
137
137
|
}),
|
|
138
138
|
withAlpha: this.props?.colorMixerSettings?.colorMixer?.withAlpha,
|
|
139
139
|
rgbRedInputScreenReaderLabel: this.props.colorMixerSettings.colorMixer.rgbRedInputScreenReaderLabel,
|
|
@@ -147,7 +147,7 @@ let ColorPreset = (_dec = withStyle(generateStyle, generateComponentTheme), _dec
|
|
|
147
147
|
css: this.props.styles?.popoverContrastBlock,
|
|
148
148
|
children: _jsx(ColorContrast, {
|
|
149
149
|
firstColor: this.props.colorMixerSettings.colorContrast.firstColor,
|
|
150
|
-
secondColor:
|
|
150
|
+
secondColor: colorToHex8(this.state.newColor),
|
|
151
151
|
label: this.props.colorMixerSettings.colorContrast.label,
|
|
152
152
|
successLabel: this.props.colorMixerSettings.colorContrast.successLabel,
|
|
153
153
|
failureLabel: this.props.colorMixerSettings.colorContrast.failureLabel,
|
|
@@ -162,7 +162,7 @@ let ColorPreset = (_dec = withStyle(generateStyle, generateComponentTheme), _dec
|
|
|
162
162
|
css: this.props.styles?.popoverFooter,
|
|
163
163
|
children: [_jsx(Button, {
|
|
164
164
|
onClick: () => {
|
|
165
|
-
this.props?.colorMixerSettings?.onPresetChange([
|
|
165
|
+
this.props?.colorMixerSettings?.onPresetChange([colorToHex8(this.state.newColor), ...this.props.colors]);
|
|
166
166
|
this.setState({
|
|
167
167
|
openAddNew: false
|
|
168
168
|
});
|
|
@@ -26,7 +26,7 @@ var _dec, _class;
|
|
|
26
26
|
import { Component } from 'react';
|
|
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
|
import { IconButton, Button } from '@instructure/ui-buttons/latest';
|
|
31
31
|
import { View } from '@instructure/ui-view/latest';
|
|
32
32
|
import { Tooltip } from '@instructure/ui-tooltip/latest';
|
|
@@ -89,7 +89,7 @@ let ColorPreset = (_dec = withStyleNew(generateStyle), _dec(_class = class Color
|
|
|
89
89
|
const {
|
|
90
90
|
selected
|
|
91
91
|
} = this.props;
|
|
92
|
-
return !!selected &&
|
|
92
|
+
return !!selected && colorToHex8(selected) === colorToHex8(color);
|
|
93
93
|
}
|
|
94
94
|
onMenuItemSelected = color => (_e, args) => {
|
|
95
95
|
if (args.value === 'select') {
|
|
@@ -130,9 +130,9 @@ let ColorPreset = (_dec = withStyleNew(generateStyle), _dec(_class = class Color
|
|
|
130
130
|
children: [_jsxs("div", {
|
|
131
131
|
css: this.props.styles?.popoverContent,
|
|
132
132
|
children: [_jsx(ColorMixer, {
|
|
133
|
-
value:
|
|
133
|
+
value: colorToHex8(this.state.newColor),
|
|
134
134
|
onChange: newColor => this.setState({
|
|
135
|
-
newColor:
|
|
135
|
+
newColor: colorToRGB(newColor)
|
|
136
136
|
}),
|
|
137
137
|
withAlpha: this.props?.colorMixerSettings?.colorMixer?.withAlpha,
|
|
138
138
|
rgbRedInputScreenReaderLabel: this.props.colorMixerSettings.colorMixer.rgbRedInputScreenReaderLabel,
|
|
@@ -146,7 +146,7 @@ let ColorPreset = (_dec = withStyleNew(generateStyle), _dec(_class = class Color
|
|
|
146
146
|
css: this.props.styles?.popoverContrastBlock,
|
|
147
147
|
children: _jsx(ColorContrast, {
|
|
148
148
|
firstColor: this.props.colorMixerSettings.colorContrast.firstColor,
|
|
149
|
-
secondColor:
|
|
149
|
+
secondColor: colorToHex8(this.state.newColor),
|
|
150
150
|
label: this.props.colorMixerSettings.colorContrast.label,
|
|
151
151
|
successLabel: this.props.colorMixerSettings.colorContrast.successLabel,
|
|
152
152
|
failureLabel: this.props.colorMixerSettings.colorContrast.failureLabel,
|
|
@@ -161,7 +161,7 @@ let ColorPreset = (_dec = withStyleNew(generateStyle), _dec(_class = class Color
|
|
|
161
161
|
css: this.props.styles?.popoverFooter,
|
|
162
162
|
children: [_jsx(Button, {
|
|
163
163
|
onClick: () => {
|
|
164
|
-
this.props?.colorMixerSettings?.onPresetChange([
|
|
164
|
+
this.props?.colorMixerSettings?.onPresetChange([colorToHex8(this.state.newColor), ...this.props.colors]);
|
|
165
165
|
this.setState({
|
|
166
166
|
openAddNew: false
|
|
167
167
|
});
|
|
@@ -6,10 +6,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.default = exports.ColorContrast = void 0;
|
|
8
8
|
var _react = require("react");
|
|
9
|
-
var
|
|
9
|
+
var _uiReactUtils = require("@instructure/ui-react-utils");
|
|
10
10
|
var _console = require("@instructure/console");
|
|
11
|
-
var
|
|
12
|
-
var _validateContrast = require("@instructure/ui-color-utils/lib/validateContrast.js");
|
|
11
|
+
var _uiColorUtils = require("@instructure/ui-color-utils");
|
|
13
12
|
var _emotion = require("@instructure/emotion");
|
|
14
13
|
var _v11_ = require("@instructure/ui-text/v11_6");
|
|
15
14
|
var _v11_2 = require("@instructure/ui-heading/v11_6");
|
|
@@ -158,10 +157,10 @@ let ColorContrast = exports.ColorContrast = (_dec = (0, _emotion.withStyle)(_sty
|
|
|
158
157
|
});
|
|
159
158
|
}
|
|
160
159
|
calcState() {
|
|
161
|
-
const contrast = (0,
|
|
160
|
+
const contrast = (0, _uiColorUtils.contrastWithAlpha)(this.props.firstColor, this.props.secondColor);
|
|
162
161
|
const newState = {
|
|
163
162
|
contrast,
|
|
164
|
-
...(0,
|
|
163
|
+
...(0, _uiColorUtils.validateContrast)(contrast, this.props.validationLevel)
|
|
165
164
|
};
|
|
166
165
|
this.setState(newState);
|
|
167
166
|
return newState;
|
|
@@ -182,7 +181,7 @@ let ColorContrast = exports.ColorContrast = (_dec = (0, _emotion.withStyle)(_sty
|
|
|
182
181
|
isValidGraphicsText
|
|
183
182
|
} = this.state;
|
|
184
183
|
return (0, _jsxRuntime.jsxs)("div", {
|
|
185
|
-
...(0,
|
|
184
|
+
...(0, _uiReactUtils.omitProps)(this.props, ColorContrast.allowedProps),
|
|
186
185
|
ref: this.handleRef,
|
|
187
186
|
css: styles?.colorContrast,
|
|
188
187
|
"data-cid": "ColorContrast",
|
|
@@ -6,10 +6,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.default = exports.ColorContrast = void 0;
|
|
8
8
|
var _react = require("react");
|
|
9
|
-
var
|
|
9
|
+
var _uiReactUtils = require("@instructure/ui-react-utils");
|
|
10
10
|
var _console = require("@instructure/console");
|
|
11
|
-
var
|
|
12
|
-
var _validateContrast = require("@instructure/ui-color-utils/lib/validateContrast.js");
|
|
11
|
+
var _uiColorUtils = require("@instructure/ui-color-utils");
|
|
13
12
|
var _emotion = require("@instructure/emotion");
|
|
14
13
|
var _latest = require("@instructure/ui-text/latest");
|
|
15
14
|
var _latest2 = require("@instructure/ui-heading/latest");
|
|
@@ -157,10 +156,10 @@ let ColorContrast = exports.ColorContrast = (_dec = (0, _emotion.withStyleNew)(_
|
|
|
157
156
|
});
|
|
158
157
|
}
|
|
159
158
|
calcState() {
|
|
160
|
-
const contrast = (0,
|
|
159
|
+
const contrast = (0, _uiColorUtils.contrastWithAlpha)(this.props.firstColor, this.props.secondColor);
|
|
161
160
|
const newState = {
|
|
162
161
|
contrast,
|
|
163
|
-
...(0,
|
|
162
|
+
...(0, _uiColorUtils.validateContrast)(contrast, this.props.validationLevel)
|
|
164
163
|
};
|
|
165
164
|
this.setState(newState);
|
|
166
165
|
return newState;
|
|
@@ -181,7 +180,7 @@ let ColorContrast = exports.ColorContrast = (_dec = (0, _emotion.withStyleNew)(_
|
|
|
181
180
|
isValidGraphicsText
|
|
182
181
|
} = this.state;
|
|
183
182
|
return (0, _jsxRuntime.jsxs)("div", {
|
|
184
|
-
...(0,
|
|
183
|
+
...(0, _uiReactUtils.omitProps)(this.props, ColorContrast.allowedProps),
|
|
185
184
|
ref: this.handleRef,
|
|
186
185
|
css: styles?.colorContrast,
|
|
187
186
|
"data-cid": "ColorContrast",
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.default = exports.ColorIndicator = void 0;
|
|
8
8
|
var _react = require("react");
|
|
9
|
-
var
|
|
9
|
+
var _uiReactUtils = require("@instructure/ui-react-utils");
|
|
10
10
|
var _emotion = require("@instructure/emotion");
|
|
11
11
|
var _styles = _interopRequireDefault(require("./styles.js"));
|
|
12
12
|
var _theme = _interopRequireDefault(require("./theme.js"));
|
|
@@ -69,7 +69,7 @@ let ColorIndicator = exports.ColorIndicator = (_dec = (0, _emotion.withStyle)(_s
|
|
|
69
69
|
styles
|
|
70
70
|
} = this.props;
|
|
71
71
|
return (0, _jsxRuntime.jsx)("div", {
|
|
72
|
-
...(0,
|
|
72
|
+
...(0, _uiReactUtils.omitProps)(this.props, ColorIndicator.allowedProps),
|
|
73
73
|
ref: this.handleRef,
|
|
74
74
|
css: styles?.colorIndicator,
|
|
75
75
|
"data-cid": "ColorIndicator"
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
6
|
exports.default = void 0;
|
|
8
|
-
var _uiColorUtils =
|
|
9
|
-
var _isValid = require("@instructure/ui-color-utils/lib/isValid.js");
|
|
7
|
+
var _uiColorUtils = require("@instructure/ui-color-utils");
|
|
10
8
|
/*
|
|
11
9
|
* The MIT License (MIT)
|
|
12
10
|
*
|
|
@@ -70,7 +68,7 @@ const generateStyle = (componentTheme, props) => {
|
|
|
70
68
|
backgroundImage: componentTheme.backgroundImage,
|
|
71
69
|
backgroundSize: componentTheme.backgroundSize,
|
|
72
70
|
backgroundPosition: componentTheme.backgroundPosition,
|
|
73
|
-
borderColor: calcBlendedColor(_uiColorUtils.
|
|
71
|
+
borderColor: calcBlendedColor((0, _uiColorUtils.colorToRGB)(componentTheme.colorIndicatorBorderColor), (0, _uiColorUtils.colorToRGB)((0, _uiColorUtils.isValid)(color) ? color : '#fff'))
|
|
74
72
|
}
|
|
75
73
|
};
|
|
76
74
|
};
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.default = exports.ColorIndicator = void 0;
|
|
8
8
|
var _react = require("react");
|
|
9
|
-
var
|
|
9
|
+
var _uiReactUtils = require("@instructure/ui-react-utils");
|
|
10
10
|
var _emotion = require("@instructure/emotion");
|
|
11
11
|
var _styles = _interopRequireDefault(require("./styles.js"));
|
|
12
12
|
var _props = require("./props.js");
|
|
@@ -68,7 +68,7 @@ let ColorIndicator = exports.ColorIndicator = (_dec = (0, _emotion.withStyleNew)
|
|
|
68
68
|
styles
|
|
69
69
|
} = this.props;
|
|
70
70
|
return (0, _jsxRuntime.jsx)("div", {
|
|
71
|
-
...(0,
|
|
71
|
+
...(0, _uiReactUtils.omitProps)(this.props, ColorIndicator.allowedProps),
|
|
72
72
|
ref: this.handleRef,
|
|
73
73
|
css: styles?.colorIndicator,
|
|
74
74
|
"data-cid": "ColorIndicator"
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
6
|
exports.default = void 0;
|
|
8
|
-
var _uiColorUtils =
|
|
9
|
-
var _isValid = require("@instructure/ui-color-utils/lib/isValid.js");
|
|
7
|
+
var _uiColorUtils = require("@instructure/ui-color-utils");
|
|
10
8
|
/*
|
|
11
9
|
* The MIT License (MIT)
|
|
12
10
|
*
|
|
@@ -70,7 +68,7 @@ const generateStyle = (componentTheme, props) => {
|
|
|
70
68
|
backgroundImage: componentTheme.backgroundImage,
|
|
71
69
|
backgroundSize: componentTheme.backgroundSize,
|
|
72
70
|
backgroundPosition: componentTheme.backgroundPosition,
|
|
73
|
-
borderColor: calcBlendedColor(_uiColorUtils.
|
|
71
|
+
borderColor: calcBlendedColor((0, _uiColorUtils.colorToRGB)(componentTheme.colorIndicatorBorderColor), (0, _uiColorUtils.colorToRGB)((0, _uiColorUtils.isValid)(color) ? color : '#fff'))
|
|
74
72
|
}
|
|
75
73
|
};
|
|
76
74
|
};
|
|
@@ -7,10 +7,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _react = require("react");
|
|
9
9
|
var _emotion = require("@instructure/emotion");
|
|
10
|
-
var
|
|
10
|
+
var _uiDomUtils = require("@instructure/ui-dom-utils");
|
|
11
11
|
var _v11_ = require("@instructure/ui-view/v11_6");
|
|
12
|
-
var
|
|
13
|
-
var
|
|
12
|
+
var _uiUtils = require("@instructure/ui-utils");
|
|
13
|
+
var _uiReactUtils = require("@instructure/ui-react-utils");
|
|
14
14
|
var _shallowCompare = _interopRequireDefault(require("../utils/shallowCompare.js"));
|
|
15
15
|
var _props = require("./props.js");
|
|
16
16
|
var _styles = _interopRequireDefault(require("./styles.js"));
|
|
@@ -45,7 +45,7 @@ var _dec, _dec2, _class;
|
|
|
45
45
|
private: true
|
|
46
46
|
---
|
|
47
47
|
**/
|
|
48
|
-
let ColorPalette = (_dec = (0,
|
|
48
|
+
let ColorPalette = (_dec = (0, _uiReactUtils.withDeterministicId)(), _dec2 = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec(_class = _dec2(_class = class ColorPalette extends _react.Component {
|
|
49
49
|
static displayName = 'ColorPalette';
|
|
50
50
|
static allowedProps = _props.allowedProps;
|
|
51
51
|
static componentId = 'ColorMixer.Palette';
|
|
@@ -64,7 +64,7 @@ let ColorPalette = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec
|
|
|
64
64
|
_paletteRef = null;
|
|
65
65
|
_mouseMoveListener;
|
|
66
66
|
_mouseUpListener;
|
|
67
|
-
_paletteOffset = (0,
|
|
67
|
+
_paletteOffset = (0, _uiUtils.px)(this.props.styles?.paletteOffset);
|
|
68
68
|
handleRef = el => {
|
|
69
69
|
const {
|
|
70
70
|
elementRef
|
|
@@ -120,8 +120,8 @@ let ColorPalette = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec
|
|
|
120
120
|
e.currentTarget.focus();
|
|
121
121
|
}
|
|
122
122
|
this.handleChange(e);
|
|
123
|
-
this._mouseMoveListener = (0,
|
|
124
|
-
this._mouseUpListener = (0,
|
|
123
|
+
this._mouseMoveListener = (0, _uiDomUtils.addEventListener)(window, 'mousemove', this.handleChange);
|
|
124
|
+
this._mouseUpListener = (0, _uiDomUtils.addEventListener)(window, 'mouseup', this.handleMouseUp);
|
|
125
125
|
}
|
|
126
126
|
handleMouseUp = () => {
|
|
127
127
|
this.removeEventListeners();
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var
|
|
7
|
+
var _uiUtils = require("@instructure/ui-utils");
|
|
8
8
|
/*
|
|
9
9
|
* The MIT License (MIT)
|
|
10
10
|
*
|
|
@@ -54,8 +54,8 @@ const generateStyle = (componentTheme, props, state) => {
|
|
|
54
54
|
borderStyle: 'solid',
|
|
55
55
|
borderWidth: componentTheme.indicatorBorderWidth,
|
|
56
56
|
borderColor: componentTheme.indicatorBorderColor,
|
|
57
|
-
top: `${state?.colorPosition?.y - (0,
|
|
58
|
-
left: `${state?.colorPosition?.x - (0,
|
|
57
|
+
top: `${state?.colorPosition?.y - (0, _uiUtils.px)(`${props.indicatorRadius / 16}rem`)}px`,
|
|
58
|
+
left: `${state?.colorPosition?.x - (0, _uiUtils.px)(`${props.indicatorRadius / 16}rem`)}px`
|
|
59
59
|
},
|
|
60
60
|
palette: {
|
|
61
61
|
label: 'ColorPalette__palette',
|
|
@@ -8,7 +8,7 @@ exports.default = void 0;
|
|
|
8
8
|
var _react = require("react");
|
|
9
9
|
var _emotion = require("@instructure/emotion");
|
|
10
10
|
var _shallowCompare = _interopRequireDefault(require("../utils/shallowCompare.js"));
|
|
11
|
-
var
|
|
11
|
+
var _uiA11yContent = require("@instructure/ui-a11y-content");
|
|
12
12
|
var _v11_ = require("@instructure/ui-text-input/v11_6");
|
|
13
13
|
var _props = require("./props.js");
|
|
14
14
|
var _styles = _interopRequireDefault(require("./styles.js"));
|
|
@@ -113,7 +113,7 @@ let RGBAInput = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default)
|
|
|
113
113
|
disabled: disabled,
|
|
114
114
|
value: `${this.state.value.r}`,
|
|
115
115
|
onChange: e => this.handleChange('r', e),
|
|
116
|
-
renderLabel: (0, _jsxRuntime.jsx)(
|
|
116
|
+
renderLabel: (0, _jsxRuntime.jsx)(_uiA11yContent.ScreenReaderContent, {
|
|
117
117
|
children: this.props.rgbRedInputScreenReaderLabel
|
|
118
118
|
})
|
|
119
119
|
})
|
|
@@ -123,7 +123,7 @@ let RGBAInput = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default)
|
|
|
123
123
|
disabled: disabled,
|
|
124
124
|
value: `${this.state.value.g}`,
|
|
125
125
|
onChange: e => this.handleChange('g', e),
|
|
126
|
-
renderLabel: (0, _jsxRuntime.jsx)(
|
|
126
|
+
renderLabel: (0, _jsxRuntime.jsx)(_uiA11yContent.ScreenReaderContent, {
|
|
127
127
|
children: this.props.rgbGreenInputScreenReaderLabel
|
|
128
128
|
})
|
|
129
129
|
})
|
|
@@ -133,7 +133,7 @@ let RGBAInput = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default)
|
|
|
133
133
|
disabled: disabled,
|
|
134
134
|
value: `${this.state.value.b}`,
|
|
135
135
|
onChange: e => this.handleChange('b', e),
|
|
136
|
-
renderLabel: (0, _jsxRuntime.jsx)(
|
|
136
|
+
renderLabel: (0, _jsxRuntime.jsx)(_uiA11yContent.ScreenReaderContent, {
|
|
137
137
|
children: this.props.rgbBlueInputScreenReaderLabel
|
|
138
138
|
})
|
|
139
139
|
})
|
|
@@ -149,7 +149,7 @@ let RGBAInput = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default)
|
|
|
149
149
|
role: "presentation",
|
|
150
150
|
children: "%"
|
|
151
151
|
}),
|
|
152
|
-
renderLabel: (0, _jsxRuntime.jsx)(
|
|
152
|
+
renderLabel: (0, _jsxRuntime.jsx)(_uiA11yContent.ScreenReaderContent, {
|
|
153
153
|
children: this.props.rgbAlphaInputScreenReaderLabel
|
|
154
154
|
})
|
|
155
155
|
})
|