@instructure/ui-color-picker 11.2.1-snapshot-9 → 11.3.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 +12 -1
- package/es/ColorContrast/index.js +7 -1
- package/es/ColorContrast/props.js +1 -1
- package/es/ColorContrast/styles.js +5 -2
- package/lib/ColorContrast/index.js +7 -1
- package/lib/ColorContrast/props.js +1 -1
- package/lib/ColorContrast/styles.js +5 -2
- package/package.json +24 -23
- package/src/ColorContrast/index.tsx +11 -3
- package/src/ColorContrast/props.ts +8 -0
- package/src/ColorContrast/styles.ts +7 -2
- package/src/ColorPicker/README.md +6 -6
- package/tsconfig.build.json +1 -0
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/ColorContrast/index.d.ts +1 -0
- package/types/ColorContrast/index.d.ts.map +1 -1
- package/types/ColorContrast/props.d.ts +6 -0
- package/types/ColorContrast/props.d.ts.map +1 -1
- package/types/ColorContrast/styles.d.ts +3 -1
- package/types/ColorContrast/styles.d.ts.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,7 +3,18 @@
|
|
|
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.
|
|
6
|
+
## [11.3.1-snapshot-0](https://github.com/instructure/instructure-ui/compare/v11.3.0...v11.3.1-snapshot-0) (2026-01-15)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* **ui-color-picker:** add new labelLevel prop to set heading level in ColorContrast ([06c9e79](https://github.com/instructure/instructure-ui/commit/06c9e79fc87c31da4ca8eff61e93094aa09c8be5))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# [11.3.0](https://github.com/instructure/instructure-ui/compare/v11.2.0...v11.3.0) (2026-01-12)
|
|
7
18
|
|
|
8
19
|
|
|
9
20
|
### Bug Fixes
|
|
@@ -29,6 +29,7 @@ import { error } from '@instructure/console';
|
|
|
29
29
|
import { contrastWithAlpha, validateContrast } from '@instructure/ui-color-utils';
|
|
30
30
|
import { withStyle } from '@instructure/emotion';
|
|
31
31
|
import { Text } from '@instructure/ui-text';
|
|
32
|
+
import { Heading } from '@instructure/ui-heading';
|
|
32
33
|
import { Pill } from '@instructure/ui-pill';
|
|
33
34
|
import ColorIndicator from '../ColorIndicator';
|
|
34
35
|
import { allowedProps } from './props';
|
|
@@ -158,6 +159,7 @@ let ColorContrast = (_dec = withStyle(generateStyle, generateComponentTheme), _d
|
|
|
158
159
|
const _this$props9 = this.props,
|
|
159
160
|
styles = _this$props9.styles,
|
|
160
161
|
label = _this$props9.label,
|
|
162
|
+
labelLevel = _this$props9.labelLevel,
|
|
161
163
|
normalTextLabel = _this$props9.normalTextLabel,
|
|
162
164
|
largeTextLabel = _this$props9.largeTextLabel,
|
|
163
165
|
graphicsTextLabel = _this$props9.graphicsTextLabel;
|
|
@@ -173,7 +175,11 @@ let ColorContrast = (_dec = withStyle(generateStyle, generateComponentTheme), _d
|
|
|
173
175
|
"data-cid": "ColorContrast",
|
|
174
176
|
children: [_jsx("div", {
|
|
175
177
|
css: styles === null || styles === void 0 ? void 0 : styles.label,
|
|
176
|
-
children: _jsx(
|
|
178
|
+
children: labelLevel ? _jsx(Heading, {
|
|
179
|
+
as: labelLevel,
|
|
180
|
+
level: "reset",
|
|
181
|
+
children: label
|
|
182
|
+
}) : _jsx(Text, {
|
|
177
183
|
weight: "bold",
|
|
178
184
|
as: "div",
|
|
179
185
|
children: label
|
|
@@ -22,5 +22,5 @@
|
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
-
const allowedProps = ['elementRef', 'failureLabel', 'firstColor', 'firstColorLabel', 'graphicsTextLabel', 'withoutColorPreview', 'label', 'largeTextLabel', 'normalTextLabel', 'secondColor', 'secondColorLabel', 'successLabel', 'onContrastChange', 'validationLevel'];
|
|
25
|
+
const allowedProps = ['elementRef', 'failureLabel', 'firstColor', 'firstColorLabel', 'graphicsTextLabel', 'withoutColorPreview', 'label', 'labelLevel', 'largeTextLabel', 'normalTextLabel', 'secondColor', 'secondColorLabel', 'successLabel', 'onContrastChange', 'validationLevel'];
|
|
26
26
|
export { allowedProps };
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
* @param {Object} state the state of the component, the style is applied to
|
|
33
33
|
* @return {Object} The final style object, which will be used in the component
|
|
34
34
|
*/
|
|
35
|
-
const generateStyle = componentTheme => {
|
|
35
|
+
const generateStyle = (componentTheme, props) => {
|
|
36
36
|
const statusDescriptionStyle = pass => ({
|
|
37
37
|
label: pass ? 'colorContrast__successDescription' : 'colorContrast__failureDescription',
|
|
38
38
|
flex: 1,
|
|
@@ -90,7 +90,10 @@ const generateStyle = componentTheme => {
|
|
|
90
90
|
},
|
|
91
91
|
label: {
|
|
92
92
|
label: 'colorContrast__label',
|
|
93
|
-
marginBottom: componentTheme.labelBottomMargin
|
|
93
|
+
marginBottom: componentTheme.labelBottomMargin,
|
|
94
|
+
...(props.labelLevel && {
|
|
95
|
+
fontWeight: 'bold'
|
|
96
|
+
})
|
|
94
97
|
}
|
|
95
98
|
};
|
|
96
99
|
};
|
|
@@ -12,6 +12,7 @@ var _contrastWithAlpha = require("@instructure/ui-color-utils/lib/contrastWithAl
|
|
|
12
12
|
var _validateContrast = require("@instructure/ui-color-utils/lib/validateContrast.js");
|
|
13
13
|
var _emotion = require("@instructure/emotion");
|
|
14
14
|
var _Text = require("@instructure/ui-text/lib/Text");
|
|
15
|
+
var _Heading = require("@instructure/ui-heading/lib/Heading");
|
|
15
16
|
var _Pill = require("@instructure/ui-pill/lib/Pill");
|
|
16
17
|
var _ColorIndicator = _interopRequireDefault(require("../ColorIndicator"));
|
|
17
18
|
var _props = require("./props");
|
|
@@ -164,6 +165,7 @@ let ColorContrast = exports.ColorContrast = (_dec = (0, _emotion.withStyle)(_sty
|
|
|
164
165
|
const _this$props9 = this.props,
|
|
165
166
|
styles = _this$props9.styles,
|
|
166
167
|
label = _this$props9.label,
|
|
168
|
+
labelLevel = _this$props9.labelLevel,
|
|
167
169
|
normalTextLabel = _this$props9.normalTextLabel,
|
|
168
170
|
largeTextLabel = _this$props9.largeTextLabel,
|
|
169
171
|
graphicsTextLabel = _this$props9.graphicsTextLabel;
|
|
@@ -179,7 +181,11 @@ let ColorContrast = exports.ColorContrast = (_dec = (0, _emotion.withStyle)(_sty
|
|
|
179
181
|
"data-cid": "ColorContrast",
|
|
180
182
|
children: [(0, _jsxRuntime.jsx)("div", {
|
|
181
183
|
css: styles === null || styles === void 0 ? void 0 : styles.label,
|
|
182
|
-
children: (0, _jsxRuntime.jsx)(
|
|
184
|
+
children: labelLevel ? (0, _jsxRuntime.jsx)(_Heading.Heading, {
|
|
185
|
+
as: labelLevel,
|
|
186
|
+
level: "reset",
|
|
187
|
+
children: label
|
|
188
|
+
}) : (0, _jsxRuntime.jsx)(_Text.Text, {
|
|
183
189
|
weight: "bold",
|
|
184
190
|
as: "div",
|
|
185
191
|
children: label
|
|
@@ -28,4 +28,4 @@ exports.allowedProps = void 0;
|
|
|
28
28
|
* SOFTWARE.
|
|
29
29
|
*/
|
|
30
30
|
|
|
31
|
-
const allowedProps = exports.allowedProps = ['elementRef', 'failureLabel', 'firstColor', 'firstColorLabel', 'graphicsTextLabel', 'withoutColorPreview', 'label', 'largeTextLabel', 'normalTextLabel', 'secondColor', 'secondColorLabel', 'successLabel', 'onContrastChange', 'validationLevel'];
|
|
31
|
+
const allowedProps = exports.allowedProps = ['elementRef', 'failureLabel', 'firstColor', 'firstColorLabel', 'graphicsTextLabel', 'withoutColorPreview', 'label', 'labelLevel', 'largeTextLabel', 'normalTextLabel', 'secondColor', 'secondColorLabel', 'successLabel', 'onContrastChange', 'validationLevel'];
|
|
@@ -38,7 +38,7 @@ exports.default = void 0;
|
|
|
38
38
|
* @param {Object} state the state of the component, the style is applied to
|
|
39
39
|
* @return {Object} The final style object, which will be used in the component
|
|
40
40
|
*/
|
|
41
|
-
const generateStyle = componentTheme => {
|
|
41
|
+
const generateStyle = (componentTheme, props) => {
|
|
42
42
|
const statusDescriptionStyle = pass => ({
|
|
43
43
|
label: pass ? 'colorContrast__successDescription' : 'colorContrast__failureDescription',
|
|
44
44
|
flex: 1,
|
|
@@ -96,7 +96,10 @@ const generateStyle = componentTheme => {
|
|
|
96
96
|
},
|
|
97
97
|
label: {
|
|
98
98
|
label: 'colorContrast__label',
|
|
99
|
-
marginBottom: componentTheme.labelBottomMargin
|
|
99
|
+
marginBottom: componentTheme.labelBottomMargin,
|
|
100
|
+
...(props.labelLevel && {
|
|
101
|
+
fontWeight: 'bold'
|
|
102
|
+
})
|
|
100
103
|
}
|
|
101
104
|
};
|
|
102
105
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-color-picker",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.3.1-snapshot-0",
|
|
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,34 +15,35 @@
|
|
|
15
15
|
"license": "MIT",
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@babel/runtime": "^7.27.6",
|
|
18
|
-
"@instructure/console": "11.
|
|
19
|
-
"@instructure/
|
|
20
|
-
"@instructure/shared-types": "11.
|
|
21
|
-
"@instructure/ui-buttons": "11.
|
|
22
|
-
"@instructure/
|
|
23
|
-
"@instructure/ui-color-utils": "11.
|
|
24
|
-
"@instructure/ui-
|
|
25
|
-
"@instructure/ui-
|
|
26
|
-
"@instructure/ui-form-field": "11.
|
|
27
|
-
"@instructure/ui-
|
|
28
|
-
"@instructure/ui-
|
|
29
|
-
"@instructure/ui-
|
|
30
|
-
"@instructure/ui-
|
|
31
|
-
"@instructure/ui-
|
|
32
|
-
"@instructure/ui-text": "11.
|
|
33
|
-
"@instructure/ui-
|
|
34
|
-
"@instructure/ui-themes": "11.
|
|
35
|
-
"@instructure/ui-tooltip": "11.
|
|
36
|
-
"@instructure/ui-
|
|
18
|
+
"@instructure/console": "11.3.1-snapshot-0",
|
|
19
|
+
"@instructure/emotion": "11.3.1-snapshot-0",
|
|
20
|
+
"@instructure/shared-types": "11.3.1-snapshot-0",
|
|
21
|
+
"@instructure/ui-buttons": "11.3.1-snapshot-0",
|
|
22
|
+
"@instructure/ui-a11y-content": "11.3.1-snapshot-0",
|
|
23
|
+
"@instructure/ui-color-utils": "11.3.1-snapshot-0",
|
|
24
|
+
"@instructure/ui-drilldown": "11.3.1-snapshot-0",
|
|
25
|
+
"@instructure/ui-dom-utils": "11.3.1-snapshot-0",
|
|
26
|
+
"@instructure/ui-form-field": "11.3.1-snapshot-0",
|
|
27
|
+
"@instructure/ui-heading": "11.3.1-snapshot-0",
|
|
28
|
+
"@instructure/ui-pill": "11.3.1-snapshot-0",
|
|
29
|
+
"@instructure/ui-popover": "11.3.1-snapshot-0",
|
|
30
|
+
"@instructure/ui-icons": "11.3.1-snapshot-0",
|
|
31
|
+
"@instructure/ui-react-utils": "11.3.1-snapshot-0",
|
|
32
|
+
"@instructure/ui-text": "11.3.1-snapshot-0",
|
|
33
|
+
"@instructure/ui-text-input": "11.3.1-snapshot-0",
|
|
34
|
+
"@instructure/ui-themes": "11.3.1-snapshot-0",
|
|
35
|
+
"@instructure/ui-tooltip": "11.3.1-snapshot-0",
|
|
36
|
+
"@instructure/ui-utils": "11.3.1-snapshot-0",
|
|
37
|
+
"@instructure/ui-view": "11.3.1-snapshot-0"
|
|
37
38
|
},
|
|
38
39
|
"devDependencies": {
|
|
39
40
|
"@testing-library/jest-dom": "^6.6.3",
|
|
40
41
|
"@testing-library/react": "15.0.7",
|
|
41
42
|
"@testing-library/user-event": "^14.6.1",
|
|
42
43
|
"vitest": "^3.2.2",
|
|
43
|
-
"@instructure/ui-
|
|
44
|
-
"@instructure/ui-
|
|
45
|
-
"@instructure/ui-
|
|
44
|
+
"@instructure/ui-babel-preset": "11.3.1-snapshot-0",
|
|
45
|
+
"@instructure/ui-scripts": "11.3.1-snapshot-0",
|
|
46
|
+
"@instructure/ui-axe-check": "11.3.1-snapshot-0"
|
|
46
47
|
},
|
|
47
48
|
"peerDependencies": {
|
|
48
49
|
"react": ">=18 <=19"
|
|
@@ -33,6 +33,7 @@ import {
|
|
|
33
33
|
import { withStyle } from '@instructure/emotion'
|
|
34
34
|
|
|
35
35
|
import { Text } from '@instructure/ui-text'
|
|
36
|
+
import { Heading } from '@instructure/ui-heading'
|
|
36
37
|
import { Pill } from '@instructure/ui-pill'
|
|
37
38
|
|
|
38
39
|
import ColorIndicator from '../ColorIndicator'
|
|
@@ -191,6 +192,7 @@ class ColorContrast extends Component<ColorContrastProps, ColorContrastState> {
|
|
|
191
192
|
const {
|
|
192
193
|
styles,
|
|
193
194
|
label,
|
|
195
|
+
labelLevel,
|
|
194
196
|
normalTextLabel,
|
|
195
197
|
largeTextLabel,
|
|
196
198
|
graphicsTextLabel
|
|
@@ -211,9 +213,15 @@ class ColorContrast extends Component<ColorContrastProps, ColorContrastState> {
|
|
|
211
213
|
data-cid="ColorContrast"
|
|
212
214
|
>
|
|
213
215
|
<div css={styles?.label}>
|
|
214
|
-
|
|
215
|
-
{
|
|
216
|
-
|
|
216
|
+
{labelLevel ? (
|
|
217
|
+
<Heading as={labelLevel} level="reset">
|
|
218
|
+
{label}
|
|
219
|
+
</Heading>
|
|
220
|
+
) : (
|
|
221
|
+
<Text weight="bold" as="div">
|
|
222
|
+
{label}
|
|
223
|
+
</Text>
|
|
224
|
+
)}
|
|
217
225
|
</div>
|
|
218
226
|
<Text size="x-large">{contrast}:1</Text>
|
|
219
227
|
{this.renderPreview()}
|
|
@@ -22,12 +22,15 @@
|
|
|
22
22
|
* SOFTWARE.
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
|
+
import React from 'react'
|
|
25
26
|
import type { WithStyleProps, ComponentStyle } from '@instructure/emotion'
|
|
26
27
|
import type {
|
|
27
28
|
OtherHTMLAttributes,
|
|
28
29
|
ColorContrastTheme
|
|
29
30
|
} from '@instructure/shared-types'
|
|
30
31
|
|
|
32
|
+
type HeadingLevel<U extends keyof React.JSX.IntrinsicElements> = U
|
|
33
|
+
|
|
31
34
|
type ColorContrastOwnProps = {
|
|
32
35
|
/**
|
|
33
36
|
* Provides a reference to the component's underlying html element.
|
|
@@ -53,6 +56,10 @@ type ColorContrastOwnProps = {
|
|
|
53
56
|
* Label of the component
|
|
54
57
|
*/
|
|
55
58
|
label: string
|
|
59
|
+
/**
|
|
60
|
+
* The heading level for the label. If provided, the label will be rendered as a `<Heading />` instead of `<Text />`.
|
|
61
|
+
*/
|
|
62
|
+
labelLevel?: HeadingLevel<'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6'>
|
|
56
63
|
/**
|
|
57
64
|
* Text of the second check (Suggested english text: Large text)
|
|
58
65
|
*/
|
|
@@ -154,6 +161,7 @@ const allowedProps: AllowedPropKeys = [
|
|
|
154
161
|
'graphicsTextLabel',
|
|
155
162
|
'withoutColorPreview',
|
|
156
163
|
'label',
|
|
164
|
+
'labelLevel',
|
|
157
165
|
'largeTextLabel',
|
|
158
166
|
'normalTextLabel',
|
|
159
167
|
'secondColor',
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
25
|
import type { ColorContrastTheme } from '@instructure/shared-types'
|
|
26
|
+
import type { ColorContrastProps } from './props'
|
|
26
27
|
/**
|
|
27
28
|
* ---
|
|
28
29
|
* private: true
|
|
@@ -33,7 +34,10 @@ import type { ColorContrastTheme } from '@instructure/shared-types'
|
|
|
33
34
|
* @param {Object} state the state of the component, the style is applied to
|
|
34
35
|
* @return {Object} The final style object, which will be used in the component
|
|
35
36
|
*/
|
|
36
|
-
const generateStyle = (
|
|
37
|
+
const generateStyle = (
|
|
38
|
+
componentTheme: ColorContrastTheme,
|
|
39
|
+
props: ColorContrastProps
|
|
40
|
+
) => {
|
|
37
41
|
const statusDescriptionStyle = (pass: boolean) => ({
|
|
38
42
|
label: pass
|
|
39
43
|
? 'colorContrast__successDescription'
|
|
@@ -94,7 +98,8 @@ const generateStyle = (componentTheme: ColorContrastTheme) => {
|
|
|
94
98
|
},
|
|
95
99
|
label: {
|
|
96
100
|
label: 'colorContrast__label',
|
|
97
|
-
marginBottom: componentTheme.labelBottomMargin
|
|
101
|
+
marginBottom: componentTheme.labelBottomMargin,
|
|
102
|
+
...(props.labelLevel && { fontWeight: 'bold' })
|
|
98
103
|
}
|
|
99
104
|
}
|
|
100
105
|
}
|
|
@@ -218,7 +218,7 @@ type: example
|
|
|
218
218
|
contrastAgainst,
|
|
219
219
|
renderContrastErrorMessage: (contrast, minContrast) => [
|
|
220
220
|
{
|
|
221
|
-
type: '
|
|
221
|
+
type: 'newError',
|
|
222
222
|
text: `Not high enough contrast. Minimum required is ${minContrast}:1, current is ${contrast}:1`
|
|
223
223
|
}
|
|
224
224
|
]
|
|
@@ -226,13 +226,13 @@ type: example
|
|
|
226
226
|
}
|
|
227
227
|
renderInvalidColorMessage={(hexCode) => [
|
|
228
228
|
{
|
|
229
|
-
type: '
|
|
229
|
+
type: 'newError',
|
|
230
230
|
text: `Not valid hex color. It should be either 3, 6 or 8 character long.`
|
|
231
231
|
}
|
|
232
232
|
]}
|
|
233
233
|
renderIsRequiredMessage={() => [
|
|
234
234
|
{
|
|
235
|
-
type: '
|
|
235
|
+
type: 'newError',
|
|
236
236
|
text: `This field is required, please enter a valid hex code`
|
|
237
237
|
}
|
|
238
238
|
]}
|
|
@@ -334,17 +334,17 @@ type: example
|
|
|
334
334
|
{ type: "success", text: "I am a contrast success message" },
|
|
335
335
|
],
|
|
336
336
|
renderContrastErrorMessage: () => [
|
|
337
|
-
{ type: "
|
|
337
|
+
{ type: "newError", text: "I am a contrast warning message" },
|
|
338
338
|
],
|
|
339
339
|
}}
|
|
340
340
|
renderMessages={() => [
|
|
341
341
|
{ type: "hint", text: "I can display anything, at any time" },
|
|
342
342
|
]}
|
|
343
343
|
renderInvalidColorMessage={() => [
|
|
344
|
-
{ type: "
|
|
344
|
+
{ type: "newError", text: "I am an invalid color message" },
|
|
345
345
|
]}
|
|
346
346
|
renderIsRequiredMessage={() => [
|
|
347
|
-
{ type: "
|
|
347
|
+
{ type: "newError", text: "I am a required message" },
|
|
348
348
|
]}
|
|
349
349
|
placeholderText="Enter HEX"
|
|
350
350
|
/>
|
package/tsconfig.build.json
CHANGED
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
{ "path": "../ui-buttons/tsconfig.build.json" },
|
|
19
19
|
{ "path": "../ui-color-utils/tsconfig.build.json" },
|
|
20
20
|
{ "path": "../ui-form-field/tsconfig.build.json" },
|
|
21
|
+
{ "path": "../ui-heading/tsconfig.build.json" },
|
|
21
22
|
{ "path": "../ui-icons/tsconfig.build.json" },
|
|
22
23
|
{ "path": "../ui-pill/tsconfig.build.json" },
|
|
23
24
|
{ "path": "../ui-popover/tsconfig.build.json" },
|