@instructure/ui-color-picker 10.26.1 → 11.0.1-snapshot-0
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 +30 -1
- package/es/ColorContrast/index.js +6 -6
- package/es/ColorContrast/props.js +1 -18
- package/es/ColorIndicator/index.js +7 -7
- package/es/ColorIndicator/props.js +1 -7
- package/es/ColorMixer/ColorPalette/index.js +2 -2
- package/es/ColorMixer/ColorPalette/props.js +1 -13
- package/es/ColorMixer/RGBAInput/index.js +2 -2
- package/es/ColorMixer/RGBAInput/props.js +1 -15
- package/es/ColorMixer/Slider/index.js +2 -2
- package/es/ColorMixer/Slider/props.js +1 -14
- package/es/ColorMixer/index.js +6 -6
- package/es/ColorMixer/props.js +1 -16
- package/es/ColorPicker/index.js +6 -6
- package/es/ColorPicker/props.js +1 -61
- package/es/ColorPreset/index.js +6 -6
- package/es/ColorPreset/props.js +1 -42
- package/lib/ColorContrast/index.js +5 -5
- package/lib/ColorContrast/props.js +1 -19
- package/lib/ColorIndicator/index.js +6 -6
- package/lib/ColorIndicator/props.js +1 -8
- package/lib/ColorMixer/ColorPalette/index.js +1 -1
- package/lib/ColorMixer/ColorPalette/props.js +1 -14
- package/lib/ColorMixer/RGBAInput/index.js +1 -1
- package/lib/ColorMixer/RGBAInput/props.js +1 -16
- package/lib/ColorMixer/Slider/index.js +1 -1
- package/lib/ColorMixer/Slider/props.js +1 -15
- package/lib/ColorMixer/index.js +5 -5
- package/lib/ColorMixer/props.js +1 -17
- package/lib/ColorPicker/index.js +5 -5
- package/lib/ColorPicker/props.js +1 -62
- package/lib/ColorPreset/index.js +5 -5
- package/lib/ColorPreset/props.js +1 -43
- package/package.json +25 -27
- package/src/ColorContrast/index.tsx +2 -4
- package/src/ColorContrast/props.ts +1 -22
- package/src/ColorIndicator/index.tsx +2 -4
- package/src/ColorIndicator/props.ts +1 -11
- package/src/ColorMixer/ColorPalette/index.tsx +1 -2
- package/src/ColorMixer/ColorPalette/props.ts +1 -16
- package/src/ColorMixer/RGBAInput/index.tsx +1 -2
- package/src/ColorMixer/RGBAInput/props.ts +1 -18
- package/src/ColorMixer/Slider/index.tsx +1 -2
- package/src/ColorMixer/Slider/props.ts +1 -18
- package/src/ColorMixer/index.tsx +2 -4
- package/src/ColorMixer/props.ts +2 -26
- package/src/ColorPicker/index.tsx +2 -4
- package/src/ColorPicker/props.ts +2 -69
- package/src/ColorPreset/index.tsx +2 -4
- package/src/ColorPreset/props.ts +1 -48
- package/tsconfig.build.json +0 -1
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/ColorContrast/index.d.ts +0 -23
- package/types/ColorContrast/index.d.ts.map +1 -1
- package/types/ColorContrast/props.d.ts +2 -3
- package/types/ColorContrast/props.d.ts.map +1 -1
- package/types/ColorIndicator/index.d.ts +0 -5
- package/types/ColorIndicator/index.d.ts.map +1 -1
- package/types/ColorIndicator/props.d.ts +2 -3
- package/types/ColorIndicator/props.d.ts.map +1 -1
- package/types/ColorMixer/ColorPalette/index.d.ts +0 -11
- package/types/ColorMixer/ColorPalette/index.d.ts.map +1 -1
- package/types/ColorMixer/ColorPalette/props.d.ts +2 -3
- package/types/ColorMixer/ColorPalette/props.d.ts.map +1 -1
- package/types/ColorMixer/RGBAInput/index.d.ts +0 -13
- package/types/ColorMixer/RGBAInput/index.d.ts.map +1 -1
- package/types/ColorMixer/RGBAInput/props.d.ts +2 -3
- package/types/ColorMixer/RGBAInput/props.d.ts.map +1 -1
- package/types/ColorMixer/Slider/index.d.ts +0 -12
- package/types/ColorMixer/Slider/index.d.ts.map +1 -1
- package/types/ColorMixer/Slider/props.d.ts +2 -3
- package/types/ColorMixer/Slider/props.d.ts.map +1 -1
- package/types/ColorMixer/index.d.ts +0 -14
- package/types/ColorMixer/index.d.ts.map +1 -1
- package/types/ColorMixer/props.d.ts +2 -3
- package/types/ColorMixer/props.d.ts.map +1 -1
- package/types/ColorPicker/index.d.ts +0 -66
- package/types/ColorPicker/index.d.ts.map +1 -1
- package/types/ColorPicker/props.d.ts +2 -3
- package/types/ColorPicker/props.d.ts.map +1 -1
- package/types/ColorPreset/index.d.ts +0 -40
- package/types/ColorPreset/index.d.ts.map +1 -1
- package/types/ColorPreset/props.d.ts +2 -3
- package/types/ColorPreset/props.d.ts.map +1 -1
|
@@ -22,12 +22,9 @@
|
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
-
import PropTypes from 'prop-types'
|
|
26
|
-
|
|
27
25
|
import type { WithStyleProps, ComponentStyle } from '@instructure/emotion'
|
|
28
26
|
import type {
|
|
29
27
|
OtherHTMLAttributes,
|
|
30
|
-
PropValidators,
|
|
31
28
|
ColorContrastTheme
|
|
32
29
|
} from '@instructure/shared-types'
|
|
33
30
|
|
|
@@ -149,24 +146,6 @@ type ColorContrastStyle = ComponentStyle<
|
|
|
149
146
|
| 'onContrastChange'
|
|
150
147
|
| 'validationLevel'
|
|
151
148
|
>
|
|
152
|
-
|
|
153
|
-
const propTypes: PropValidators<PropKeys> = {
|
|
154
|
-
elementRef: PropTypes.func,
|
|
155
|
-
failureLabel: PropTypes.string.isRequired,
|
|
156
|
-
firstColor: PropTypes.string.isRequired,
|
|
157
|
-
firstColorLabel: PropTypes.string,
|
|
158
|
-
graphicsTextLabel: PropTypes.string.isRequired,
|
|
159
|
-
withoutColorPreview: PropTypes.bool,
|
|
160
|
-
label: PropTypes.string.isRequired,
|
|
161
|
-
largeTextLabel: PropTypes.string.isRequired,
|
|
162
|
-
normalTextLabel: PropTypes.string.isRequired,
|
|
163
|
-
secondColor: PropTypes.string.isRequired,
|
|
164
|
-
secondColorLabel: PropTypes.string,
|
|
165
|
-
successLabel: PropTypes.string.isRequired,
|
|
166
|
-
onContrastChange: PropTypes.func,
|
|
167
|
-
validationLevel: PropTypes.oneOf(['AA', 'AAA'])
|
|
168
|
-
}
|
|
169
|
-
|
|
170
149
|
const allowedProps: AllowedPropKeys = [
|
|
171
150
|
'elementRef',
|
|
172
151
|
'failureLabel',
|
|
@@ -191,4 +170,4 @@ type ColorContrastState = {
|
|
|
191
170
|
isValidGraphicsText: boolean
|
|
192
171
|
}
|
|
193
172
|
export type { ColorContrastProps, ColorContrastStyle, ColorContrastState }
|
|
194
|
-
export {
|
|
173
|
+
export { allowedProps }
|
|
@@ -24,7 +24,6 @@
|
|
|
24
24
|
|
|
25
25
|
import { Component } from 'react'
|
|
26
26
|
|
|
27
|
-
import { testable } from '@instructure/ui-testable'
|
|
28
27
|
import { omitProps } from '@instructure/ui-react-utils'
|
|
29
28
|
import { withStyle } from '@instructure/emotion'
|
|
30
29
|
|
|
@@ -32,7 +31,7 @@ import generateStyle from './styles'
|
|
|
32
31
|
import generateComponentTheme from './theme'
|
|
33
32
|
|
|
34
33
|
import type { ColorIndicatorProps } from './props'
|
|
35
|
-
import {
|
|
34
|
+
import { allowedProps } from './props'
|
|
36
35
|
|
|
37
36
|
/**
|
|
38
37
|
---
|
|
@@ -40,9 +39,7 @@ category: components
|
|
|
40
39
|
---
|
|
41
40
|
**/
|
|
42
41
|
@withStyle(generateStyle, generateComponentTheme)
|
|
43
|
-
@testable()
|
|
44
42
|
class ColorIndicator extends Component<ColorIndicatorProps> {
|
|
45
|
-
static propTypes = propTypes
|
|
46
43
|
static allowedProps = allowedProps
|
|
47
44
|
static readonly componentId = 'ColorIndicator'
|
|
48
45
|
|
|
@@ -78,6 +75,7 @@ class ColorIndicator extends Component<ColorIndicatorProps> {
|
|
|
78
75
|
{...omitProps(this.props, ColorIndicator.allowedProps)}
|
|
79
76
|
ref={this.handleRef}
|
|
80
77
|
css={styles?.colorIndicator}
|
|
78
|
+
data-cid="ColorIndicator"
|
|
81
79
|
/>
|
|
82
80
|
)
|
|
83
81
|
}
|
|
@@ -22,12 +22,9 @@
|
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
-
import PropTypes from 'prop-types'
|
|
26
|
-
|
|
27
25
|
import type { WithStyleProps, ComponentStyle } from '@instructure/emotion'
|
|
28
26
|
import type {
|
|
29
27
|
OtherHTMLAttributes,
|
|
30
|
-
PropValidators,
|
|
31
28
|
ColorIndicatorTheme
|
|
32
29
|
} from '@instructure/shared-types'
|
|
33
30
|
|
|
@@ -55,14 +52,7 @@ type ColorIndicatorProps = ColorIndicatorOwnProps &
|
|
|
55
52
|
OtherHTMLAttributes<ColorIndicatorOwnProps>
|
|
56
53
|
|
|
57
54
|
type ColorIndicatorStyle = ComponentStyle<'colorIndicator'>
|
|
58
|
-
|
|
59
|
-
const propTypes: PropValidators<PropKeys> = {
|
|
60
|
-
color: PropTypes.string,
|
|
61
|
-
elementRef: PropTypes.func,
|
|
62
|
-
shape: PropTypes.oneOf(['circle', 'rectangle'])
|
|
63
|
-
}
|
|
64
|
-
|
|
65
55
|
const allowedProps: AllowedPropKeys = ['color', 'elementRef', 'shape']
|
|
66
56
|
|
|
67
57
|
export type { ColorIndicatorProps, ColorIndicatorStyle }
|
|
68
|
-
export {
|
|
58
|
+
export { allowedProps }
|
|
@@ -35,7 +35,7 @@ import { withDeterministicId } from '@instructure/ui-react-utils'
|
|
|
35
35
|
|
|
36
36
|
import shallowCompare from '../utils/shallowCompare'
|
|
37
37
|
|
|
38
|
-
import {
|
|
38
|
+
import { allowedProps } from './props'
|
|
39
39
|
import type { ColorPaletteProps, ColorPaletteState } from './props'
|
|
40
40
|
|
|
41
41
|
import generateStyle from './styles'
|
|
@@ -49,7 +49,6 @@ private: true
|
|
|
49
49
|
@withDeterministicId()
|
|
50
50
|
@withStyle(generateStyle, generateComponentTheme)
|
|
51
51
|
class ColorPalette extends Component<ColorPaletteProps, ColorPaletteState> {
|
|
52
|
-
static propTypes = propTypes
|
|
53
52
|
static allowedProps = allowedProps
|
|
54
53
|
static readonly componentId = 'ColorMixer.Palette'
|
|
55
54
|
|
|
@@ -22,12 +22,10 @@
|
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
-
import PropTypes from 'prop-types'
|
|
26
25
|
import type { WithStyleProps, ComponentStyle } from '@instructure/emotion'
|
|
27
26
|
|
|
28
27
|
import type {
|
|
29
28
|
OtherHTMLAttributes,
|
|
30
|
-
PropValidators,
|
|
31
29
|
ColorMixerPaletteTheme
|
|
32
30
|
} from '@instructure/shared-types'
|
|
33
31
|
import type { HSVType } from '@instructure/ui-color-utils'
|
|
@@ -61,19 +59,6 @@ type ColorPaletteProps = ColorPaletteOwnProps &
|
|
|
61
59
|
type ColorPaletteStyle = ComponentStyle<
|
|
62
60
|
'ColorPalette' | 'indicator' | 'palette' | 'disabledOverlay' | 'paletteOffset'
|
|
63
61
|
>
|
|
64
|
-
|
|
65
|
-
const propTypes: PropValidators<PropKeys> = {
|
|
66
|
-
disabled: PropTypes.bool,
|
|
67
|
-
hue: PropTypes.number.isRequired,
|
|
68
|
-
color: PropTypes.object.isRequired,
|
|
69
|
-
width: PropTypes.number.isRequired,
|
|
70
|
-
height: PropTypes.number.isRequired,
|
|
71
|
-
indicatorRadius: PropTypes.number.isRequired,
|
|
72
|
-
onChange: PropTypes.func.isRequired,
|
|
73
|
-
elementRef: PropTypes.func,
|
|
74
|
-
navigationExplanationScreenReaderLabel: PropTypes.string.isRequired
|
|
75
|
-
}
|
|
76
|
-
|
|
77
62
|
const allowedProps: AllowedPropKeys = [
|
|
78
63
|
'disabled',
|
|
79
64
|
'hue',
|
|
@@ -87,4 +72,4 @@ const allowedProps: AllowedPropKeys = [
|
|
|
87
72
|
]
|
|
88
73
|
|
|
89
74
|
export type { ColorPaletteProps, ColorPaletteState, ColorPaletteStyle }
|
|
90
|
-
export {
|
|
75
|
+
export { allowedProps }
|
|
@@ -30,7 +30,7 @@ import shallowCompare from '../utils/shallowCompare'
|
|
|
30
30
|
import { ScreenReaderContent } from '@instructure/ui-a11y-content'
|
|
31
31
|
import { TextInput } from '@instructure/ui-text-input'
|
|
32
32
|
|
|
33
|
-
import {
|
|
33
|
+
import { allowedProps } from './props'
|
|
34
34
|
import type { RGBAInputProps, RGBAInputState } from './props'
|
|
35
35
|
|
|
36
36
|
import generateStyle from './styles'
|
|
@@ -43,7 +43,6 @@ private: true
|
|
|
43
43
|
**/
|
|
44
44
|
@withStyle(generateStyle, generateComponentTheme)
|
|
45
45
|
class RGBAInput extends Component<RGBAInputProps, RGBAInputState> {
|
|
46
|
-
static propTypes = propTypes
|
|
47
46
|
static allowedProps = allowedProps
|
|
48
47
|
static readonly componentId = 'ColorMixer.RGBAInput'
|
|
49
48
|
|
|
@@ -22,12 +22,10 @@
|
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
-
import PropTypes from 'prop-types'
|
|
26
25
|
import type { WithStyleProps, ComponentStyle } from '@instructure/emotion'
|
|
27
26
|
|
|
28
27
|
import type {
|
|
29
28
|
OtherHTMLAttributes,
|
|
30
|
-
PropValidators,
|
|
31
29
|
ColorMixerRGBAInputTheme
|
|
32
30
|
} from '@instructure/shared-types'
|
|
33
31
|
import type { RGBAType } from '@instructure/ui-color-utils'
|
|
@@ -61,21 +59,6 @@ type RGBAInputProps = RGBAInputOwnProps &
|
|
|
61
59
|
type RGBAInputStyle = ComponentStyle<
|
|
62
60
|
'RGBAInput' | 'label' | 'inputContainer' | 'rgbInput' | 'aInput'
|
|
63
61
|
>
|
|
64
|
-
|
|
65
|
-
const propTypes: PropValidators<PropKeys> = {
|
|
66
|
-
disabled: PropTypes.bool,
|
|
67
|
-
label: PropTypes.string,
|
|
68
|
-
width: PropTypes.number.isRequired,
|
|
69
|
-
value: PropTypes.object.isRequired,
|
|
70
|
-
onChange: PropTypes.func.isRequired,
|
|
71
|
-
withAlpha: PropTypes.bool,
|
|
72
|
-
rgbRedInputScreenReaderLabel: PropTypes.string.isRequired,
|
|
73
|
-
rgbGreenInputScreenReaderLabel: PropTypes.string.isRequired,
|
|
74
|
-
rgbBlueInputScreenReaderLabel: PropTypes.string.isRequired,
|
|
75
|
-
rgbAlphaInputScreenReaderLabel: PropTypes.string.isRequired,
|
|
76
|
-
elementRef: PropTypes.func
|
|
77
|
-
}
|
|
78
|
-
|
|
79
62
|
const allowedProps: AllowedPropKeys = [
|
|
80
63
|
'disabled',
|
|
81
64
|
'label',
|
|
@@ -91,4 +74,4 @@ const allowedProps: AllowedPropKeys = [
|
|
|
91
74
|
]
|
|
92
75
|
|
|
93
76
|
export type { RGBAInputProps, RGBAInputState, RGBAInputStyle }
|
|
94
|
-
export {
|
|
77
|
+
export { allowedProps }
|
|
@@ -30,7 +30,7 @@ import { withStyle } from '@instructure/emotion'
|
|
|
30
30
|
import { View } from '@instructure/ui-view'
|
|
31
31
|
import type { ViewOwnProps } from '@instructure/ui-view'
|
|
32
32
|
|
|
33
|
-
import {
|
|
33
|
+
import { allowedProps } from './props'
|
|
34
34
|
import type { SliderProps, SliderStyleProps } from './props'
|
|
35
35
|
|
|
36
36
|
import generateStyle from './styles'
|
|
@@ -43,7 +43,6 @@ private: true
|
|
|
43
43
|
**/
|
|
44
44
|
@withStyle(generateStyle, generateComponentTheme)
|
|
45
45
|
class Slider extends Component<SliderProps> {
|
|
46
|
-
static propTypes = propTypes
|
|
47
46
|
static allowedProps = allowedProps
|
|
48
47
|
static readonly componentId = 'ColorMixer.Slider'
|
|
49
48
|
|
|
@@ -22,12 +22,9 @@
|
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
-
import PropTypes from 'prop-types'
|
|
26
|
-
|
|
27
25
|
import type { WithStyleProps, ComponentStyle } from '@instructure/emotion'
|
|
28
26
|
import type {
|
|
29
27
|
OtherHTMLAttributes,
|
|
30
|
-
PropValidators,
|
|
31
28
|
ColorMixerSliderTheme
|
|
32
29
|
} from '@instructure/shared-types'
|
|
33
30
|
|
|
@@ -63,20 +60,6 @@ type SliderStyle = ComponentStyle<
|
|
|
63
60
|
| 'sliderBackground'
|
|
64
61
|
| 'disabledOverlay'
|
|
65
62
|
>
|
|
66
|
-
|
|
67
|
-
const propTypes: PropValidators<PropKeys> = {
|
|
68
|
-
isColorSlider: PropTypes.bool,
|
|
69
|
-
onChange: PropTypes.func.isRequired,
|
|
70
|
-
width: PropTypes.number.isRequired,
|
|
71
|
-
value: PropTypes.number.isRequired,
|
|
72
|
-
minValue: PropTypes.number.isRequired,
|
|
73
|
-
maxValue: PropTypes.number.isRequired,
|
|
74
|
-
indicatorRadius: PropTypes.number.isRequired,
|
|
75
|
-
height: PropTypes.number.isRequired,
|
|
76
|
-
elementRef: PropTypes.func,
|
|
77
|
-
navigationExplanationScreenReaderLabel: PropTypes.string.isRequired
|
|
78
|
-
}
|
|
79
|
-
|
|
80
63
|
const allowedProps: AllowedPropKeys = [
|
|
81
64
|
'isColorSlider',
|
|
82
65
|
'onChange',
|
|
@@ -91,4 +74,4 @@ const allowedProps: AllowedPropKeys = [
|
|
|
91
74
|
]
|
|
92
75
|
|
|
93
76
|
export type { SliderProps, SliderStyle, SliderStyleProps }
|
|
94
|
-
export {
|
|
77
|
+
export { allowedProps }
|
package/src/ColorMixer/index.tsx
CHANGED
|
@@ -26,7 +26,6 @@ import { Component } from 'react'
|
|
|
26
26
|
|
|
27
27
|
import { withStyle } from '@instructure/emotion'
|
|
28
28
|
import { omitProps } from '@instructure/ui-react-utils'
|
|
29
|
-
import { testable } from '@instructure/ui-testable'
|
|
30
29
|
import { isValid } from '@instructure/ui-color-utils'
|
|
31
30
|
import conversions from '@instructure/ui-color-utils'
|
|
32
31
|
import { logWarn as warn } from '@instructure/console'
|
|
@@ -36,7 +35,7 @@ import Slider from './Slider'
|
|
|
36
35
|
import RGBAInput from './RGBAInput'
|
|
37
36
|
|
|
38
37
|
import type { ColorMixerProps, ColorMixerState } from './props'
|
|
39
|
-
import {
|
|
38
|
+
import { allowedProps } from './props'
|
|
40
39
|
import generateStyle from './styles'
|
|
41
40
|
|
|
42
41
|
/**
|
|
@@ -45,9 +44,7 @@ category: components
|
|
|
45
44
|
---
|
|
46
45
|
**/
|
|
47
46
|
@withStyle(generateStyle, null)
|
|
48
|
-
@testable()
|
|
49
47
|
class ColorMixer extends Component<ColorMixerProps, ColorMixerState> {
|
|
50
|
-
static propTypes = propTypes
|
|
51
48
|
static allowedProps = allowedProps
|
|
52
49
|
static readonly componentId = 'ColorMixer'
|
|
53
50
|
|
|
@@ -139,6 +136,7 @@ class ColorMixer extends Component<ColorMixerProps, ColorMixerState> {
|
|
|
139
136
|
aria-disabled={disabled}
|
|
140
137
|
ref={this.handleRef}
|
|
141
138
|
css={styles?.colorMixer}
|
|
139
|
+
data-cid="ColorMixer"
|
|
142
140
|
>
|
|
143
141
|
<span
|
|
144
142
|
css={styles?.sliderAndPaletteContainer}
|
package/src/ColorMixer/props.ts
CHANGED
|
@@ -22,13 +22,8 @@
|
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
-
import PropTypes from 'prop-types'
|
|
26
|
-
|
|
27
25
|
import type { WithStyleProps, ComponentStyle } from '@instructure/emotion'
|
|
28
|
-
import type {
|
|
29
|
-
OtherHTMLAttributes,
|
|
30
|
-
PropValidators
|
|
31
|
-
} from '@instructure/shared-types'
|
|
26
|
+
import type { OtherHTMLAttributes } from '@instructure/shared-types'
|
|
32
27
|
|
|
33
28
|
type ColorMixerOwnProps = {
|
|
34
29
|
/**
|
|
@@ -102,25 +97,6 @@ type ColorMixerProps = ColorMixerOwnProps &
|
|
|
102
97
|
type ColorMixerStyle = ComponentStyle<
|
|
103
98
|
'colorMixer' | 'sliderAndPaletteContainer'
|
|
104
99
|
>
|
|
105
|
-
|
|
106
|
-
const propTypes: PropValidators<PropKeys> = {
|
|
107
|
-
disabled: PropTypes.bool,
|
|
108
|
-
elementRef: PropTypes.func,
|
|
109
|
-
withAlpha: PropTypes.bool,
|
|
110
|
-
value: PropTypes.string,
|
|
111
|
-
onChange: PropTypes.func.isRequired,
|
|
112
|
-
rgbRedInputScreenReaderLabel: PropTypes.string.isRequired,
|
|
113
|
-
rgbGreenInputScreenReaderLabel: PropTypes.string.isRequired,
|
|
114
|
-
rgbBlueInputScreenReaderLabel: PropTypes.string.isRequired,
|
|
115
|
-
rgbAlphaInputScreenReaderLabel: PropTypes.string.isRequired,
|
|
116
|
-
colorSliderNavigationExplanationScreenReaderLabel:
|
|
117
|
-
PropTypes.string.isRequired,
|
|
118
|
-
alphaSliderNavigationExplanationScreenReaderLabel:
|
|
119
|
-
PropTypes.string.isRequired,
|
|
120
|
-
colorPaletteNavigationExplanationScreenReaderLabel:
|
|
121
|
-
PropTypes.string.isRequired
|
|
122
|
-
}
|
|
123
|
-
|
|
124
100
|
const allowedProps: AllowedPropKeys = [
|
|
125
101
|
'disabled',
|
|
126
102
|
'elementRef',
|
|
@@ -137,4 +113,4 @@ const allowedProps: AllowedPropKeys = [
|
|
|
137
113
|
]
|
|
138
114
|
|
|
139
115
|
export type { ColorMixerProps, ColorMixerStyle, ColorMixerState }
|
|
140
|
-
export {
|
|
116
|
+
export { allowedProps }
|
|
@@ -27,7 +27,6 @@ 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 { testable } from '@instructure/ui-testable'
|
|
31
30
|
import { isValid, contrast as getContrast } from '@instructure/ui-color-utils'
|
|
32
31
|
import conversions from '@instructure/ui-color-utils'
|
|
33
32
|
import { TextInput } from '@instructure/ui-text-input'
|
|
@@ -50,7 +49,7 @@ import ColorPreset from '../ColorPreset'
|
|
|
50
49
|
import generateStyle from './styles'
|
|
51
50
|
import generateComponentTheme from './theme'
|
|
52
51
|
|
|
53
|
-
import {
|
|
52
|
+
import { allowedProps } from './props'
|
|
54
53
|
import type {
|
|
55
54
|
ColorPickerProps,
|
|
56
55
|
ColorPickerState,
|
|
@@ -89,9 +88,7 @@ category: components
|
|
|
89
88
|
---
|
|
90
89
|
**/
|
|
91
90
|
@withStyle(generateStyle, generateComponentTheme)
|
|
92
|
-
@testable()
|
|
93
91
|
class ColorPicker extends Component<ColorPickerProps, ColorPickerState> {
|
|
94
|
-
static propTypes = propTypes
|
|
95
92
|
static allowedProps = allowedProps
|
|
96
93
|
static readonly componentId = 'ColorPicker'
|
|
97
94
|
|
|
@@ -616,6 +613,7 @@ class ColorPicker extends Component<ColorPickerProps, ColorPickerState> {
|
|
|
616
613
|
{...omitProps(this.props, ColorPicker.allowedProps)}
|
|
617
614
|
css={this.props.styles?.colorPicker}
|
|
618
615
|
ref={this.handleRef}
|
|
616
|
+
data-cid="ColorPicker"
|
|
619
617
|
>
|
|
620
618
|
<TextInput
|
|
621
619
|
id={id}
|
package/src/ColorPicker/props.ts
CHANGED
|
@@ -23,8 +23,6 @@
|
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
25
|
import React from 'react'
|
|
26
|
-
import PropTypes from 'prop-types'
|
|
27
|
-
|
|
28
26
|
import type { FormMessage } from '@instructure/ui-form-field'
|
|
29
27
|
import type {
|
|
30
28
|
WithStyleProps,
|
|
@@ -33,8 +31,7 @@ import type {
|
|
|
33
31
|
} from '@instructure/emotion'
|
|
34
32
|
import type {
|
|
35
33
|
ColorPickerTheme,
|
|
36
|
-
OtherHTMLAttributes
|
|
37
|
-
PropValidators
|
|
34
|
+
OtherHTMLAttributes
|
|
38
35
|
} from '@instructure/shared-types'
|
|
39
36
|
type ContrastStrength = 'min' | 'mid' | 'max'
|
|
40
37
|
|
|
@@ -271,70 +268,6 @@ type ColorPickerStyle = ComponentStyle<
|
|
|
271
268
|
| 'popoverContentContainer'
|
|
272
269
|
| 'colorMixerButtonWrapper'
|
|
273
270
|
>
|
|
274
|
-
|
|
275
|
-
const propTypes: PropValidators<PropKeys> = {
|
|
276
|
-
checkContrast: PropTypes.shape({
|
|
277
|
-
isStrict: PropTypes.bool,
|
|
278
|
-
contrastStrength: PropTypes.oneOf(['min', 'mid', 'max']),
|
|
279
|
-
contrastAgainst: PropTypes.string,
|
|
280
|
-
renderContrastSuccessMessage: PropTypes.func,
|
|
281
|
-
renderContrastErrorMessage: PropTypes.func
|
|
282
|
-
}),
|
|
283
|
-
colorMixerSettings: PropTypes.shape({
|
|
284
|
-
popoverAddButtonLabel: PropTypes.string.isRequired,
|
|
285
|
-
popoverCloseButtonLabel: PropTypes.string.isRequired,
|
|
286
|
-
colorMixer: PropTypes.shape({
|
|
287
|
-
withAlpha: PropTypes.bool,
|
|
288
|
-
rgbRedInputScreenReaderLabel: PropTypes.string.isRequired,
|
|
289
|
-
rgbGreenInputScreenReaderLabel: PropTypes.string.isRequired,
|
|
290
|
-
rgbBlueInputScreenReaderLabel: PropTypes.string.isRequired,
|
|
291
|
-
rgbAlphaInputScreenReaderLabel: PropTypes.string.isRequired,
|
|
292
|
-
colorSliderNavigationExplanationScreenReaderLabel:
|
|
293
|
-
PropTypes.string.isRequired,
|
|
294
|
-
alphaSliderNavigationExplanationScreenReaderLabel:
|
|
295
|
-
PropTypes.string.isRequired,
|
|
296
|
-
colorPaletteNavigationExplanationScreenReaderLabel:
|
|
297
|
-
PropTypes.string.isRequired
|
|
298
|
-
}),
|
|
299
|
-
colorPreset: PropTypes.shape({
|
|
300
|
-
colors: PropTypes.arrayOf(PropTypes.string).isRequired,
|
|
301
|
-
label: PropTypes.string.isRequired
|
|
302
|
-
}),
|
|
303
|
-
colorContrast: PropTypes.shape({
|
|
304
|
-
firstColor: PropTypes.string.isRequired,
|
|
305
|
-
label: PropTypes.string.isRequired,
|
|
306
|
-
successLabel: PropTypes.string.isRequired,
|
|
307
|
-
failureLabel: PropTypes.string.isRequired,
|
|
308
|
-
normalTextLabel: PropTypes.string.isRequired,
|
|
309
|
-
largeTextLabel: PropTypes.string.isRequired,
|
|
310
|
-
graphicsTextLabel: PropTypes.string.isRequired,
|
|
311
|
-
firstColorLabel: PropTypes.string.isRequired,
|
|
312
|
-
secondColorLabel: PropTypes.string.isRequired,
|
|
313
|
-
onContrastChange: PropTypes.func
|
|
314
|
-
})
|
|
315
|
-
}),
|
|
316
|
-
children: PropTypes.func,
|
|
317
|
-
disabled: PropTypes.bool,
|
|
318
|
-
elementRef: PropTypes.func,
|
|
319
|
-
isRequired: PropTypes.bool,
|
|
320
|
-
label: PropTypes.node.isRequired,
|
|
321
|
-
onChange: PropTypes.func,
|
|
322
|
-
placeholderText: PropTypes.string,
|
|
323
|
-
popoverScreenReaderLabel: PropTypes.string,
|
|
324
|
-
popoverButtonScreenReaderLabel: PropTypes.string,
|
|
325
|
-
popoverMaxHeight: PropTypes.string,
|
|
326
|
-
renderInvalidColorMessage: PropTypes.func,
|
|
327
|
-
renderIsRequiredMessage: PropTypes.func,
|
|
328
|
-
renderMessages: PropTypes.func,
|
|
329
|
-
tooltip: PropTypes.node,
|
|
330
|
-
id: PropTypes.string,
|
|
331
|
-
value: PropTypes.string,
|
|
332
|
-
width: PropTypes.string,
|
|
333
|
-
withAlpha: PropTypes.bool,
|
|
334
|
-
margin: PropTypes.string,
|
|
335
|
-
inputRef: PropTypes.func
|
|
336
|
-
}
|
|
337
|
-
|
|
338
271
|
const allowedProps: AllowedPropKeys = [
|
|
339
272
|
'id',
|
|
340
273
|
'checkContrast',
|
|
@@ -366,4 +299,4 @@ export type {
|
|
|
366
299
|
ColorPickerState,
|
|
367
300
|
ContrastStrength
|
|
368
301
|
}
|
|
369
|
-
export {
|
|
302
|
+
export { allowedProps }
|
|
@@ -26,7 +26,6 @@ import { Component } from 'react'
|
|
|
26
26
|
|
|
27
27
|
import { withStyle } from '@instructure/emotion'
|
|
28
28
|
import { omitProps } from '@instructure/ui-react-utils'
|
|
29
|
-
import { testable } from '@instructure/ui-testable'
|
|
30
29
|
import conversions from '@instructure/ui-color-utils'
|
|
31
30
|
|
|
32
31
|
import { IconButton, Button } from '@instructure/ui-buttons'
|
|
@@ -46,7 +45,7 @@ import generateStyle from './styles'
|
|
|
46
45
|
import generateComponentTheme from './theme'
|
|
47
46
|
|
|
48
47
|
import type { ColorPresetProps, ColorPresetState } from './props'
|
|
49
|
-
import {
|
|
48
|
+
import { allowedProps } from './props'
|
|
50
49
|
|
|
51
50
|
/**
|
|
52
51
|
---
|
|
@@ -54,9 +53,7 @@ category: components
|
|
|
54
53
|
---
|
|
55
54
|
**/
|
|
56
55
|
@withStyle(generateStyle, generateComponentTheme)
|
|
57
|
-
@testable()
|
|
58
56
|
class ColorPreset extends Component<ColorPresetProps, ColorPresetState> {
|
|
59
|
-
static propTypes = propTypes
|
|
60
57
|
static allowedProps = allowedProps
|
|
61
58
|
static readonly componentId = 'ColorPreset'
|
|
62
59
|
|
|
@@ -348,6 +345,7 @@ class ColorPreset extends Component<ColorPresetProps, ColorPresetState> {
|
|
|
348
345
|
{...omitProps(this.props, ColorPreset.allowedProps)}
|
|
349
346
|
ref={this.handleRef}
|
|
350
347
|
css={styles?.colorPreset}
|
|
348
|
+
data-cid="ColorPreset"
|
|
351
349
|
>
|
|
352
350
|
{label && (
|
|
353
351
|
<div css={styles?.label}>
|
package/src/ColorPreset/props.ts
CHANGED
|
@@ -22,12 +22,9 @@
|
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
-
import PropTypes from 'prop-types'
|
|
26
|
-
|
|
27
25
|
import type { WithStyleProps, ComponentStyle } from '@instructure/emotion'
|
|
28
26
|
import type {
|
|
29
27
|
OtherHTMLAttributes,
|
|
30
|
-
PropValidators,
|
|
31
28
|
ColorPresetTheme
|
|
32
29
|
} from '@instructure/shared-types'
|
|
33
30
|
import type { RGBAType } from '@instructure/ui-color-utils'
|
|
@@ -142,50 +139,6 @@ type ColorPresetStyle = ComponentStyle<
|
|
|
142
139
|
| 'popoverContrastBlock'
|
|
143
140
|
>
|
|
144
141
|
|
|
145
|
-
const propTypes: PropValidators<PropKeys> = {
|
|
146
|
-
colors: PropTypes.array.isRequired,
|
|
147
|
-
onSelect: PropTypes.func.isRequired,
|
|
148
|
-
selected: PropTypes.string,
|
|
149
|
-
disabled: PropTypes.bool,
|
|
150
|
-
elementRef: PropTypes.func,
|
|
151
|
-
label: PropTypes.string,
|
|
152
|
-
popoverScreenReaderLabel: PropTypes.string,
|
|
153
|
-
colorScreenReaderLabel: PropTypes.func,
|
|
154
|
-
colorMixerSettings: PropTypes.shape({
|
|
155
|
-
addNewPresetButtonScreenReaderLabel: PropTypes.string.isRequired,
|
|
156
|
-
selectColorLabel: PropTypes.string.isRequired,
|
|
157
|
-
removeColorLabel: PropTypes.string.isRequired,
|
|
158
|
-
onPresetChange: PropTypes.func,
|
|
159
|
-
popoverAddButtonLabel: PropTypes.string.isRequired,
|
|
160
|
-
popoverCloseButtonLabel: PropTypes.string.isRequired,
|
|
161
|
-
maxHeight: PropTypes.string,
|
|
162
|
-
colorMixer: PropTypes.shape({
|
|
163
|
-
withAlpha: PropTypes.bool,
|
|
164
|
-
rgbRedInputScreenReaderLabel: PropTypes.string.isRequired,
|
|
165
|
-
rgbGreenInputScreenReaderLabel: PropTypes.string.isRequired,
|
|
166
|
-
rgbBlueInputScreenReaderLabel: PropTypes.string.isRequired,
|
|
167
|
-
rgbAlphaInputScreenReaderLabel: PropTypes.string.isRequired,
|
|
168
|
-
colorSliderNavigationExplanationScreenReaderLabel:
|
|
169
|
-
PropTypes.string.isRequired,
|
|
170
|
-
alphaSliderNavigationExplanationScreenReaderLabel:
|
|
171
|
-
PropTypes.string.isRequired,
|
|
172
|
-
colorPaletteNavigationExplanationScreenReaderLabel:
|
|
173
|
-
PropTypes.string.isRequired
|
|
174
|
-
}).isRequired,
|
|
175
|
-
colorContrast: PropTypes.shape({
|
|
176
|
-
firstColor: PropTypes.string.isRequired,
|
|
177
|
-
label: PropTypes.string.isRequired,
|
|
178
|
-
successLabel: PropTypes.string.isRequired,
|
|
179
|
-
failureLabel: PropTypes.string.isRequired,
|
|
180
|
-
normalTextLabel: PropTypes.string.isRequired,
|
|
181
|
-
largeTextLabel: PropTypes.string.isRequired,
|
|
182
|
-
graphicsTextLabel: PropTypes.string.isRequired,
|
|
183
|
-
firstColorLabel: PropTypes.string.isRequired,
|
|
184
|
-
secondColorLabel: PropTypes.string.isRequired
|
|
185
|
-
})
|
|
186
|
-
})
|
|
187
|
-
}
|
|
188
|
-
|
|
189
142
|
const allowedProps: AllowedPropKeys = [
|
|
190
143
|
'colors',
|
|
191
144
|
'disabled',
|
|
@@ -204,4 +157,4 @@ export type {
|
|
|
204
157
|
ColorPresetState,
|
|
205
158
|
ContrastStrength
|
|
206
159
|
}
|
|
207
|
-
export {
|
|
160
|
+
export { allowedProps }
|
package/tsconfig.build.json
CHANGED
|
@@ -23,7 +23,6 @@
|
|
|
23
23
|
{ "path": "../ui-popover/tsconfig.build.json" },
|
|
24
24
|
{ "path": "../ui-react-utils/tsconfig.build.json" },
|
|
25
25
|
{ "path": "../ui-scripts/tsconfig.build.json" },
|
|
26
|
-
{ "path": "../ui-testable/tsconfig.build.json" },
|
|
27
26
|
{ "path": "../ui-text/tsconfig.build.json" },
|
|
28
27
|
{ "path": "../ui-text-input/tsconfig.build.json" },
|
|
29
28
|
{ "path": "../ui-tooltip/tsconfig.build.json" },
|