@workday/canvas-kit-preview-react 14.0.0-alpha.1144-next.0 → 14.0.0-alpha.1147-next.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/color-picker/lib/ColorPicker.tsx +105 -99
- package/color-picker/lib/parts/ColorReset.tsx +43 -40
- package/color-picker/lib/parts/SwatchBook.tsx +49 -50
- package/dist/commonjs/color-picker/lib/ColorPicker.d.ts +69 -1
- package/dist/commonjs/color-picker/lib/ColorPicker.d.ts.map +1 -1
- package/dist/commonjs/color-picker/lib/ColorPicker.js +72 -87
- package/dist/commonjs/color-picker/lib/parts/ColorReset.d.ts +5 -0
- package/dist/commonjs/color-picker/lib/parts/ColorReset.d.ts.map +1 -1
- package/dist/commonjs/color-picker/lib/parts/ColorReset.js +11 -36
- package/dist/commonjs/color-picker/lib/parts/SwatchBook.d.ts.map +1 -1
- package/dist/commonjs/color-picker/lib/parts/SwatchBook.js +13 -43
- package/dist/commonjs/divider/lib/Divider.js +1 -1
- package/dist/commonjs/information-highlight/lib/InformationHighlight.d.ts +1 -1
- package/dist/commonjs/information-highlight/lib/InformationHighlight.js +7 -7
- package/dist/commonjs/information-highlight/lib/parts/Body.js +1 -1
- package/dist/commonjs/information-highlight/lib/parts/Heading.js +1 -1
- package/dist/commonjs/information-highlight/lib/parts/Link.js +1 -1
- package/dist/commonjs/loading-sparkles/lib/LoadingSparkles.js +2 -2
- package/dist/commonjs/multi-select/lib/MultiSelectInput.js +3 -3
- package/dist/commonjs/pill/lib/Pill.js +3 -3
- package/dist/commonjs/pill/lib/PillAvatar.js +1 -1
- package/dist/commonjs/pill/lib/PillCount.js +1 -1
- package/dist/commonjs/pill/lib/PillIcon.js +1 -1
- package/dist/commonjs/pill/lib/PillIconButton.js +1 -1
- package/dist/commonjs/pill/lib/PillLabel.js +1 -1
- package/dist/commonjs/radio/lib/RadioGroup.js +3 -3
- package/dist/commonjs/radio/lib/RadioLabel.js +1 -1
- package/dist/commonjs/radio/lib/RadioText.js +4 -4
- package/dist/commonjs/radio/lib/StyledRadioButton.js +5 -5
- package/dist/commonjs/segmented-control/lib/SegmentedControlItem.js +16 -16
- package/dist/commonjs/segmented-control/lib/SegmentedControlList.js +4 -4
- package/dist/commonjs/side-panel/lib/SidePanel.js +7 -7
- package/dist/commonjs/side-panel/lib/SidePanelToggleButton.js +11 -11
- package/dist/commonjs/status-indicator/lib/StatusIndicator.js +13 -13
- package/dist/commonjs/status-indicator/lib/StatusIndicatorLabel.js +1 -1
- package/dist/es6/color-picker/lib/ColorPicker.d.ts +69 -1
- package/dist/es6/color-picker/lib/ColorPicker.d.ts.map +1 -1
- package/dist/es6/color-picker/lib/ColorPicker.js +71 -83
- package/dist/es6/color-picker/lib/parts/ColorReset.d.ts +5 -0
- package/dist/es6/color-picker/lib/parts/ColorReset.d.ts.map +1 -1
- package/dist/es6/color-picker/lib/parts/ColorReset.js +10 -32
- package/dist/es6/color-picker/lib/parts/SwatchBook.d.ts.map +1 -1
- package/dist/es6/color-picker/lib/parts/SwatchBook.js +14 -41
- package/dist/es6/divider/lib/Divider.js +1 -1
- package/dist/es6/information-highlight/lib/InformationHighlight.d.ts +1 -1
- package/dist/es6/information-highlight/lib/InformationHighlight.js +7 -7
- package/dist/es6/information-highlight/lib/parts/Body.js +1 -1
- package/dist/es6/information-highlight/lib/parts/Heading.js +1 -1
- package/dist/es6/information-highlight/lib/parts/Link.js +1 -1
- package/dist/es6/loading-sparkles/lib/LoadingSparkles.js +2 -2
- package/dist/es6/multi-select/lib/MultiSelectInput.js +3 -3
- package/dist/es6/pill/lib/Pill.js +3 -3
- package/dist/es6/pill/lib/PillAvatar.js +1 -1
- package/dist/es6/pill/lib/PillCount.js +1 -1
- package/dist/es6/pill/lib/PillIcon.js +1 -1
- package/dist/es6/pill/lib/PillIconButton.js +1 -1
- package/dist/es6/pill/lib/PillLabel.js +1 -1
- package/dist/es6/radio/lib/RadioGroup.js +3 -3
- package/dist/es6/radio/lib/RadioLabel.js +1 -1
- package/dist/es6/radio/lib/RadioText.js +4 -4
- package/dist/es6/radio/lib/StyledRadioButton.js +5 -5
- package/dist/es6/segmented-control/lib/SegmentedControlItem.js +16 -16
- package/dist/es6/segmented-control/lib/SegmentedControlList.js +4 -4
- package/dist/es6/side-panel/lib/SidePanel.js +7 -7
- package/dist/es6/side-panel/lib/SidePanelToggleButton.js +11 -11
- package/dist/es6/status-indicator/lib/StatusIndicator.js +13 -13
- package/dist/es6/status-indicator/lib/StatusIndicatorLabel.js +1 -1
- package/information-highlight/lib/InformationHighlight.tsx +1 -1
- package/package.json +5 -5
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {colors, space} from '@workday/canvas-kit-react/tokens';
|
|
2
1
|
import {checkIcon} from '@workday/canvas-system-icons-web';
|
|
3
2
|
import {ColorInput} from '@workday/canvas-kit-react/color-picker';
|
|
4
3
|
import {SecondaryButton} from '@workday/canvas-kit-react/button';
|
|
5
4
|
import * as React from 'react';
|
|
6
5
|
import {FormField} from '@workday/canvas-kit-react/form-field';
|
|
7
|
-
import styled from '@emotion/styled';
|
|
8
6
|
|
|
9
7
|
import {ResetButton} from './parts/ColorReset';
|
|
10
8
|
import {SwatchBook, SwatchBookColorObject} from './parts/SwatchBook';
|
|
9
|
+
import {createStencil, handleCsProp, px2rem} from '@workday/canvas-kit-styling';
|
|
10
|
+
import {system} from '@workday/canvas-tokens-web';
|
|
11
11
|
|
|
12
12
|
export interface ColorPickerProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
13
13
|
/**
|
|
@@ -58,95 +58,99 @@ export interface ColorPickerProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
58
58
|
resetLabel?: string;
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
const defaultColorSet =
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
const ColorPickerContainer = styled('div')({
|
|
127
|
-
width: 216,
|
|
128
|
-
});
|
|
129
|
-
|
|
130
|
-
const ColorInputWrapper = styled('form')({
|
|
131
|
-
width: '100%',
|
|
132
|
-
marginTop: space.s,
|
|
133
|
-
display: 'flex',
|
|
134
|
-
flexDirection: 'row',
|
|
135
|
-
justifyContent: 'space-between',
|
|
136
|
-
});
|
|
137
|
-
|
|
138
|
-
const ColorInputAndLabel = styled(FormField)({
|
|
139
|
-
display: 'flex',
|
|
140
|
-
flexDirection: 'column',
|
|
141
|
-
margin: 0,
|
|
142
|
-
});
|
|
143
|
-
|
|
144
|
-
const CheckButton = styled(SecondaryButton)({
|
|
145
|
-
alignSelf: 'flex-end',
|
|
146
|
-
});
|
|
61
|
+
const defaultColorSet = {
|
|
62
|
+
blueberry600: '#004387',
|
|
63
|
+
grapeSoda600: '#7c3882',
|
|
64
|
+
pomegranate600: '#99003a',
|
|
65
|
+
cinnamon600: '#a31b12',
|
|
66
|
+
cantaloupe600: '#c06c00',
|
|
67
|
+
sourLemon600: '#bd9100',
|
|
68
|
+
greenApple600: '#217a37',
|
|
69
|
+
jewel600: '#156973',
|
|
70
|
+
|
|
71
|
+
blueberry500: '#005cb9',
|
|
72
|
+
grapeSoda500: '#97499e',
|
|
73
|
+
pomegranate500: '#c70550',
|
|
74
|
+
cinnamon500: '#de2e21',
|
|
75
|
+
cantaloupe500: '#f38b00',
|
|
76
|
+
sourLemon500: '#ebb400',
|
|
77
|
+
greenApple500: '#319c4c',
|
|
78
|
+
jewel500: '#1a818c',
|
|
79
|
+
|
|
80
|
+
blueberry400: '#0875e1',
|
|
81
|
+
grapeSoda400: '#c860d1',
|
|
82
|
+
pomegranate400: '#f31167',
|
|
83
|
+
cinnamon400: '#ff5347',
|
|
84
|
+
cantaloupe400: '#ffa126',
|
|
85
|
+
sourLemon400: '#ffc629',
|
|
86
|
+
greenApple400: '#43c463',
|
|
87
|
+
jewel400: '#1ea4b3',
|
|
88
|
+
|
|
89
|
+
blueberry300: '#40a0ff',
|
|
90
|
+
grapeSoda300: '#de8ae6',
|
|
91
|
+
pomegranate300: '#ff5c9a',
|
|
92
|
+
cinnamon300: '#ff867d',
|
|
93
|
+
cantaloupe300: '#ffbc63',
|
|
94
|
+
sourLemon300: '#ffda61',
|
|
95
|
+
greenApple300: '#5fe380',
|
|
96
|
+
jewel300: '#44c8d7',
|
|
97
|
+
|
|
98
|
+
blueberry200: '#a6d2ff',
|
|
99
|
+
grapeSoda200: '#fac0ff',
|
|
100
|
+
pomegranate200: '#ffbdd6',
|
|
101
|
+
cinnamon200: '#fcc9c5',
|
|
102
|
+
cantaloupe200: '#fcd49f',
|
|
103
|
+
sourLemon200: '#ffecab',
|
|
104
|
+
greenApple200: '#acf5be',
|
|
105
|
+
jewel200: '#acecf3',
|
|
106
|
+
|
|
107
|
+
blueberry100: '#d7eafc',
|
|
108
|
+
grapeSoda100: '#feebff',
|
|
109
|
+
pomegranate100: '#ffebf3',
|
|
110
|
+
cinnamon100: '#ffefee',
|
|
111
|
+
cantaloupe100: '#ffeed9',
|
|
112
|
+
sourLemon100: '#fff9e6',
|
|
113
|
+
greenApple100: '#ebfff0',
|
|
114
|
+
jewel100: '#ebfdff',
|
|
115
|
+
|
|
116
|
+
blackPepper600: '#000000',
|
|
117
|
+
blackPepper400: '#333333',
|
|
118
|
+
blackPepper300: '#494949',
|
|
119
|
+
blackPepper100: '#787878',
|
|
120
|
+
frenchVanilla500: '#a6a6a6',
|
|
121
|
+
frenchVanilla400: '#bdbdbd',
|
|
122
|
+
frenchVanilla200: '#ebebeb',
|
|
123
|
+
frenchVanilla100: '#ffffff',
|
|
124
|
+
};
|
|
147
125
|
|
|
148
|
-
const
|
|
149
|
-
|
|
126
|
+
export const colorPickerStencil = createStencil({
|
|
127
|
+
parts: {
|
|
128
|
+
button: 'color-picker-button',
|
|
129
|
+
form: 'color-picker-form',
|
|
130
|
+
hexInput: 'color-picker-hex-input',
|
|
131
|
+
inputWrapper: 'color-picker-input-wrapper',
|
|
132
|
+
},
|
|
133
|
+
base: ({buttonPart, formPart, hexInputPart, inputWrapperPart}) => ({
|
|
134
|
+
width: px2rem(216),
|
|
135
|
+
[formPart]: {
|
|
136
|
+
width: '100%',
|
|
137
|
+
display: 'flex',
|
|
138
|
+
flexDirection: 'row',
|
|
139
|
+
justifyContent: 'space-between',
|
|
140
|
+
marginBlockStart: system.space.x4,
|
|
141
|
+
},
|
|
142
|
+
[inputWrapperPart]: {
|
|
143
|
+
display: 'flex',
|
|
144
|
+
flexDirection: 'column',
|
|
145
|
+
margin: system.space.zero,
|
|
146
|
+
},
|
|
147
|
+
[buttonPart]: {
|
|
148
|
+
alignSelf: 'flex-end',
|
|
149
|
+
},
|
|
150
|
+
[hexInputPart]: {
|
|
151
|
+
width: px2rem(168),
|
|
152
|
+
},
|
|
153
|
+
}),
|
|
150
154
|
});
|
|
151
155
|
|
|
152
156
|
const isCustomColor = (colors: (string | SwatchBookColorObject)[], hexCode?: string) => {
|
|
@@ -165,7 +169,7 @@ const isCustomColor = (colors: (string | SwatchBookColorObject)[], hexCode?: str
|
|
|
165
169
|
};
|
|
166
170
|
|
|
167
171
|
export const ColorPicker = ({
|
|
168
|
-
colorSet = defaultColorSet,
|
|
172
|
+
colorSet = Object.values(defaultColorSet),
|
|
169
173
|
customHexInputLabel = 'Custom Hex Color',
|
|
170
174
|
submitLabel = 'Submit',
|
|
171
175
|
onColorChange,
|
|
@@ -203,32 +207,34 @@ export const ColorPicker = ({
|
|
|
203
207
|
};
|
|
204
208
|
|
|
205
209
|
return (
|
|
206
|
-
<
|
|
210
|
+
<div {...handleCsProp(elemProps, colorPickerStencil())}>
|
|
207
211
|
{onColorReset && resetColor && (
|
|
208
212
|
<ResetButton onClick={onColorReset} resetColor={resetColor} label={resetLabel} />
|
|
209
213
|
)}
|
|
210
214
|
<SwatchBook colors={colorSet} onSelect={onColorChange} value={value} />
|
|
211
215
|
{showCustomHexInput && (
|
|
212
|
-
<
|
|
213
|
-
<
|
|
216
|
+
<form onSubmit={onSubmit} {...colorPickerStencil.parts.form}>
|
|
217
|
+
<FormField {...colorPickerStencil.parts.inputWrapper}>
|
|
214
218
|
<FormField.Label>{customHexInputLabel}</FormField.Label>
|
|
215
219
|
<FormField.Input
|
|
216
|
-
as={
|
|
220
|
+
as={ColorInput}
|
|
217
221
|
onChange={onCustomHexChange}
|
|
218
222
|
onValidColorChange={onValidCustomHexChange}
|
|
219
223
|
value={customHexValue}
|
|
220
224
|
showCheck={value === validHexValue || value === customHexValue}
|
|
225
|
+
{...colorPickerStencil.parts.hexInput}
|
|
221
226
|
/>
|
|
222
|
-
</
|
|
223
|
-
<
|
|
227
|
+
</FormField>
|
|
228
|
+
<SecondaryButton
|
|
224
229
|
aria-label={submitLabel}
|
|
225
230
|
icon={checkIcon}
|
|
226
231
|
type="submit"
|
|
227
232
|
disabled={disabled}
|
|
233
|
+
{...colorPickerStencil.parts.button}
|
|
228
234
|
/>
|
|
229
|
-
</
|
|
235
|
+
</form>
|
|
230
236
|
)}
|
|
231
|
-
</
|
|
237
|
+
</div>
|
|
232
238
|
);
|
|
233
239
|
};
|
|
234
240
|
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
import {colors, space, type} from '@workday/canvas-kit-react/tokens';
|
|
4
|
-
import {focusRing, hideMouseFocus} from '@workday/canvas-kit-react/common';
|
|
5
|
-
|
|
1
|
+
import {calc, createStencil, handleCsProp} from '@workday/canvas-kit-styling';
|
|
6
2
|
import {ColorSwatch} from '@workday/canvas-kit-react/color-picker';
|
|
3
|
+
import {focusRing} from '@workday/canvas-kit-react/common';
|
|
4
|
+
import {system} from '@workday/canvas-tokens-web';
|
|
5
|
+
import {Subtext} from '@workday/canvas-kit-react/text';
|
|
7
6
|
|
|
8
7
|
export interface ResetButtonProps {
|
|
9
8
|
label: string;
|
|
@@ -11,47 +10,51 @@ export interface ResetButtonProps {
|
|
|
11
10
|
onClick: (color: string) => void;
|
|
12
11
|
}
|
|
13
12
|
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
const Container = styled('button')({
|
|
19
|
-
display: 'flex',
|
|
20
|
-
alignItems: 'center',
|
|
21
|
-
justifyContent: 'flex-start',
|
|
22
|
-
width: `calc(100% + ${space.l})`,
|
|
23
|
-
height: space.l,
|
|
24
|
-
margin: `-${space.xxs} -${space.s} ${space.xxs}`,
|
|
25
|
-
padding: `0px ${space.s}`,
|
|
26
|
-
...type.levels.subtext.medium,
|
|
27
|
-
whiteSpace: 'nowrap',
|
|
28
|
-
border: 'none',
|
|
29
|
-
outline: 'none',
|
|
30
|
-
background: 'none',
|
|
31
|
-
cursor: 'pointer',
|
|
32
|
-
transition: 'color 120ms ease, background-color 120ms ease',
|
|
33
|
-
|
|
34
|
-
'&:hover': {
|
|
35
|
-
backgroundColor: colors.soap300,
|
|
36
|
-
},
|
|
37
|
-
|
|
38
|
-
'&:active': {
|
|
39
|
-
backgroundColor: colors.soap400,
|
|
40
|
-
},
|
|
41
|
-
|
|
42
|
-
'&:focus': {
|
|
43
|
-
...focusRing(),
|
|
13
|
+
export const resetButtonStencil = createStencil({
|
|
14
|
+
parts: {
|
|
15
|
+
label: 'reset-button-label',
|
|
44
16
|
},
|
|
45
|
-
|
|
17
|
+
base: ({labelPart}) => ({
|
|
18
|
+
display: 'flex',
|
|
19
|
+
alignItems: 'center',
|
|
20
|
+
justifyContent: 'flex-start',
|
|
21
|
+
width: calc.add('100%', system.space.x8),
|
|
22
|
+
height: system.space.x8,
|
|
23
|
+
margin: `${calc.negate(system.space.x2)} ${calc.negate(system.space.x4)} ${system.space.x2}`,
|
|
24
|
+
padding: `0 ${system.space.x4}`,
|
|
25
|
+
whiteSpace: 'nowrap',
|
|
26
|
+
border: 'none',
|
|
27
|
+
outline: 'none',
|
|
28
|
+
background: 'none',
|
|
29
|
+
cursor: 'pointer',
|
|
30
|
+
transition: 'color 120ms ease, background-color 120ms ease',
|
|
31
|
+
|
|
32
|
+
'&:hover, &.hover': {
|
|
33
|
+
backgroundColor: system.color.bg.alt.default,
|
|
34
|
+
},
|
|
35
|
+
|
|
36
|
+
'&:active, &.active': {
|
|
37
|
+
backgroundColor: system.color.bg.alt.strong,
|
|
38
|
+
},
|
|
39
|
+
|
|
40
|
+
'&:focus-visible, &.focus': {
|
|
41
|
+
...focusRing(),
|
|
42
|
+
},
|
|
43
|
+
[labelPart]: {
|
|
44
|
+
marginLeft: system.space.x2,
|
|
45
|
+
},
|
|
46
|
+
}),
|
|
46
47
|
});
|
|
47
48
|
|
|
48
49
|
export const ResetButton = ({onClick, resetColor, label}: ResetButtonProps) => {
|
|
49
50
|
const handleResetColor = () => onClick(resetColor);
|
|
50
51
|
|
|
51
52
|
return (
|
|
52
|
-
<
|
|
53
|
-
<ColorSwatch color={resetColor} />
|
|
54
|
-
<
|
|
55
|
-
|
|
53
|
+
<button onClick={handleResetColor} {...handleCsProp({}, resetButtonStencil())}>
|
|
54
|
+
<ColorSwatch color={resetColor} data-color="" />
|
|
55
|
+
<Subtext size="medium" as="div" {...resetButtonStencil.parts.label}>
|
|
56
|
+
{label}
|
|
57
|
+
</Subtext>
|
|
58
|
+
</button>
|
|
56
59
|
);
|
|
57
60
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import
|
|
3
|
-
import {borderRadius, colors, space} from '@workday/canvas-kit-react/tokens';
|
|
4
|
-
import {focusRing, mouseFocusBehavior} from '@workday/canvas-kit-react/common';
|
|
2
|
+
import {focusRing} from '@workday/canvas-kit-react/common';
|
|
5
3
|
import {ColorSwatch} from '@workday/canvas-kit-react/color-picker';
|
|
4
|
+
import {calc, createStencil, px2rem} from '@workday/canvas-kit-styling';
|
|
5
|
+
import {system} from '@workday/canvas-tokens-web';
|
|
6
6
|
|
|
7
7
|
export interface SwatchBookColorObject {
|
|
8
8
|
value: string;
|
|
@@ -15,60 +15,59 @@ export interface SwatchBookProps {
|
|
|
15
15
|
onSelect: (color: string) => void;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
18
|
+
const colorPickerSwatchBookStencil = createStencil({
|
|
19
|
+
vars: {
|
|
20
|
+
shadow: `${system.color.border.inverse} 0 0 0 ${px2rem(2)}, ${
|
|
21
|
+
system.color.border.input.default
|
|
22
|
+
} 0 0 0 ${px2rem(3)}`,
|
|
23
|
+
},
|
|
24
|
+
parts: {
|
|
25
|
+
tile: 'color-picker-swatch-book-tile',
|
|
26
|
+
},
|
|
27
|
+
base: ({tilePart, shadow}) => ({
|
|
26
28
|
display: 'flex',
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
29
|
+
flexWrap: 'wrap',
|
|
30
|
+
margin: `0 ${calc.negate(system.space.x2)} ${calc.negate(system.space.x2)} 0`,
|
|
31
|
+
[tilePart]: {
|
|
32
|
+
display: 'flex',
|
|
33
|
+
width: px2rem(20),
|
|
34
|
+
height: px2rem(20),
|
|
35
|
+
cursor: 'pointer',
|
|
36
|
+
borderRadius: system.shape.half,
|
|
37
|
+
transition: 'box-shadow 120ms ease',
|
|
38
|
+
margin: `0px ${system.space.x2} ${system.space.x2} 0px`,
|
|
37
39
|
|
|
38
|
-
'&:focus': {
|
|
39
|
-
outline: 'none',
|
|
40
|
-
...focusRing({separation: 2}),
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
({isSelected}) => ({
|
|
44
|
-
boxShadow: isSelected ? accessibilityBorder : undefined,
|
|
45
|
-
...mouseFocusBehavior({
|
|
46
|
-
'&:focus': {
|
|
47
|
-
animation: 'none',
|
|
48
|
-
boxShadow: 'none',
|
|
49
|
-
},
|
|
50
40
|
'&:hover': {
|
|
51
|
-
boxShadow:
|
|
41
|
+
boxShadow: shadow,
|
|
52
42
|
},
|
|
53
|
-
|
|
54
|
-
|
|
43
|
+
|
|
44
|
+
'&:focus-visible': {
|
|
45
|
+
outline: 'none',
|
|
46
|
+
...focusRing({separation: 2}),
|
|
55
47
|
},
|
|
56
|
-
}),
|
|
57
|
-
})
|
|
58
|
-
);
|
|
59
48
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
49
|
+
'&[aria-selected="true"]': {
|
|
50
|
+
boxShadow: shadow,
|
|
51
|
+
|
|
52
|
+
'&:focus-visible': {
|
|
53
|
+
animation: 'none',
|
|
54
|
+
boxShadow: 'none',
|
|
55
|
+
},
|
|
56
|
+
|
|
57
|
+
'&:hover': {
|
|
58
|
+
boxShadow: shadow,
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
}),
|
|
64
63
|
});
|
|
65
64
|
|
|
66
65
|
export const SwatchBook = ({colors, value, onSelect}: SwatchBookProps) => {
|
|
67
66
|
return (
|
|
68
|
-
<
|
|
67
|
+
<div {...colorPickerSwatchBookStencil()}>
|
|
69
68
|
{colors.map((color: string | SwatchBookColorObject, index: number) => {
|
|
70
|
-
const hexCode = typeof color === 'object' ? color.value : color;
|
|
71
|
-
const label = typeof color === 'object' ? color.label : color;
|
|
69
|
+
const hexCode = typeof color === 'object' ? color.value : color.toLowerCase();
|
|
70
|
+
const label = typeof color === 'object' ? color.label : color.toLowerCase();
|
|
72
71
|
const isSelected = value ? hexCode.toLowerCase() === value.toLowerCase() : false;
|
|
73
72
|
|
|
74
73
|
const handleClick = () => onSelect(hexCode);
|
|
@@ -76,20 +75,20 @@ export const SwatchBook = ({colors, value, onSelect}: SwatchBookProps) => {
|
|
|
76
75
|
(event.key === 'Enter' || event.key === ' ') && onSelect(hexCode);
|
|
77
76
|
|
|
78
77
|
return (
|
|
79
|
-
<
|
|
78
|
+
<div
|
|
80
79
|
key={index + '-' + color}
|
|
81
80
|
onClick={handleClick}
|
|
82
81
|
onKeyDown={handleKeyDown}
|
|
83
82
|
tabIndex={0}
|
|
84
|
-
isSelected={isSelected}
|
|
85
83
|
role="button"
|
|
86
84
|
aria-label={label}
|
|
87
85
|
aria-selected={isSelected}
|
|
86
|
+
{...colorPickerSwatchBookStencil.parts.tile}
|
|
88
87
|
>
|
|
89
88
|
<ColorSwatch color={hexCode} showCheck={isSelected} />
|
|
90
|
-
</
|
|
89
|
+
</div>
|
|
91
90
|
);
|
|
92
91
|
})}
|
|
93
|
-
</
|
|
92
|
+
</div>
|
|
94
93
|
);
|
|
95
94
|
};
|
|
@@ -48,8 +48,76 @@ export interface ColorPickerProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
48
48
|
*/
|
|
49
49
|
resetLabel?: string;
|
|
50
50
|
}
|
|
51
|
+
export declare const colorPickerStencil: import("@workday/canvas-kit-styling").Stencil<import("@workday/canvas-kit-styling").StencilModifierConfig<{
|
|
52
|
+
readonly button: "color-picker-button";
|
|
53
|
+
readonly form: "color-picker-form";
|
|
54
|
+
readonly hexInput: "color-picker-hex-input";
|
|
55
|
+
readonly inputWrapper: "color-picker-input-wrapper";
|
|
56
|
+
}, {}, never>, {
|
|
57
|
+
readonly button: "color-picker-button";
|
|
58
|
+
readonly form: "color-picker-form";
|
|
59
|
+
readonly hexInput: "color-picker-hex-input";
|
|
60
|
+
readonly inputWrapper: "color-picker-input-wrapper";
|
|
61
|
+
}, {}, never, never>;
|
|
51
62
|
export declare const ColorPicker: {
|
|
52
63
|
({ colorSet, customHexInputLabel, submitLabel, onColorChange, onColorReset, onSubmitClick, resetLabel, resetColor, value, showCustomHexInput, ...elemProps }: ColorPickerProps): import("react/jsx-runtime").JSX.Element;
|
|
53
|
-
defaultColorSet:
|
|
64
|
+
defaultColorSet: {
|
|
65
|
+
blueberry600: string;
|
|
66
|
+
grapeSoda600: string;
|
|
67
|
+
pomegranate600: string;
|
|
68
|
+
cinnamon600: string;
|
|
69
|
+
cantaloupe600: string;
|
|
70
|
+
sourLemon600: string;
|
|
71
|
+
greenApple600: string;
|
|
72
|
+
jewel600: string;
|
|
73
|
+
blueberry500: string;
|
|
74
|
+
grapeSoda500: string;
|
|
75
|
+
pomegranate500: string;
|
|
76
|
+
cinnamon500: string;
|
|
77
|
+
cantaloupe500: string;
|
|
78
|
+
sourLemon500: string;
|
|
79
|
+
greenApple500: string;
|
|
80
|
+
jewel500: string;
|
|
81
|
+
blueberry400: string;
|
|
82
|
+
grapeSoda400: string;
|
|
83
|
+
pomegranate400: string;
|
|
84
|
+
cinnamon400: string;
|
|
85
|
+
cantaloupe400: string;
|
|
86
|
+
sourLemon400: string;
|
|
87
|
+
greenApple400: string;
|
|
88
|
+
jewel400: string;
|
|
89
|
+
blueberry300: string;
|
|
90
|
+
grapeSoda300: string;
|
|
91
|
+
pomegranate300: string;
|
|
92
|
+
cinnamon300: string;
|
|
93
|
+
cantaloupe300: string;
|
|
94
|
+
sourLemon300: string;
|
|
95
|
+
greenApple300: string;
|
|
96
|
+
jewel300: string;
|
|
97
|
+
blueberry200: string;
|
|
98
|
+
grapeSoda200: string;
|
|
99
|
+
pomegranate200: string;
|
|
100
|
+
cinnamon200: string;
|
|
101
|
+
cantaloupe200: string;
|
|
102
|
+
sourLemon200: string;
|
|
103
|
+
greenApple200: string;
|
|
104
|
+
jewel200: string;
|
|
105
|
+
blueberry100: string;
|
|
106
|
+
grapeSoda100: string;
|
|
107
|
+
pomegranate100: string;
|
|
108
|
+
cinnamon100: string;
|
|
109
|
+
cantaloupe100: string;
|
|
110
|
+
sourLemon100: string;
|
|
111
|
+
greenApple100: string;
|
|
112
|
+
jewel100: string;
|
|
113
|
+
blackPepper600: string;
|
|
114
|
+
blackPepper400: string;
|
|
115
|
+
blackPepper300: string;
|
|
116
|
+
blackPepper100: string;
|
|
117
|
+
frenchVanilla500: string;
|
|
118
|
+
frenchVanilla400: string;
|
|
119
|
+
frenchVanilla200: string;
|
|
120
|
+
frenchVanilla100: string;
|
|
121
|
+
};
|
|
54
122
|
};
|
|
55
123
|
//# sourceMappingURL=ColorPicker.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ColorPicker.d.ts","sourceRoot":"","sources":["../../../../color-picker/lib/ColorPicker.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ColorPicker.d.ts","sourceRoot":"","sources":["../../../../color-picker/lib/ColorPicker.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,EAAa,qBAAqB,EAAC,MAAM,oBAAoB,CAAC;AAIrE,MAAM,WAAW,gBAAiB,SAAQ,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;IAC5E;;OAEG;IACH,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,EAAE,GAAG,qBAAqB,EAAE,CAAC;IAC9C;;;OAGG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B;;;OAGG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,SAAS,KAAK,IAAI,CAAC;IACjD;;;OAGG;IACH,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAmED,eAAO,MAAM,kBAAkB;;;;;;;;;;oBA4B7B,CAAC;AAiBH,eAAO,MAAM,WAAW;kKAYrB,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwDlB,CAAC"}
|