@zendeskgarden/react-theming 9.0.0-next.8 → 9.0.0-next.9
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/dist/esm/elements/palette/index.js +183 -207
- package/dist/esm/elements/theme/index.js +15 -0
- package/dist/esm/index.js +2 -0
- package/dist/esm/utils/StyledBaseIcon.js +22 -0
- package/dist/esm/utils/getCheckeredBackground.js +40 -0
- package/dist/esm/utils/getColor.js +8 -3
- package/dist/index.cjs.js +267 -225
- package/dist/typings/elements/palette/index.d.ts +0 -24
- package/dist/typings/index.d.ts +3 -1
- package/dist/typings/types/index.d.ts +8 -0
- package/dist/typings/utils/StyledBaseIcon.d.ts +8 -0
- package/dist/typings/utils/getCheckeredBackground.d.ts +20 -0
- package/dist/typings/utils/getColor.d.ts +2 -2
- package/package.json +2 -2
|
@@ -9,274 +9,250 @@ const PALETTE = {
|
|
|
9
9
|
white: '#fff',
|
|
10
10
|
product: {
|
|
11
11
|
support: '#00a656',
|
|
12
|
-
message: '#37b8af',
|
|
13
12
|
explore: '#30aabc',
|
|
14
13
|
gather: '#f6c8be',
|
|
15
14
|
guide: '#eb4962',
|
|
16
|
-
connect: '#ff6224',
|
|
17
15
|
chat: '#f79a3e',
|
|
18
16
|
talk: '#efc93d',
|
|
19
17
|
sell: '#c38f00'
|
|
20
18
|
},
|
|
21
19
|
grey: {
|
|
22
|
-
100: '#
|
|
23
|
-
200: '#
|
|
24
|
-
300: '#
|
|
25
|
-
400: '#
|
|
26
|
-
500: '#
|
|
27
|
-
600: '#
|
|
28
|
-
700: '#
|
|
29
|
-
800: '#
|
|
30
|
-
900: '#
|
|
31
|
-
1000: '#
|
|
32
|
-
1100: '#
|
|
33
|
-
1200: '#
|
|
20
|
+
100: '#f8f9f9',
|
|
21
|
+
200: '#e8eaec',
|
|
22
|
+
300: '#d8dcde',
|
|
23
|
+
400: '#b0b8be',
|
|
24
|
+
500: '#919ca5',
|
|
25
|
+
600: '#848f99',
|
|
26
|
+
700: '#5c6970',
|
|
27
|
+
800: '#39434b',
|
|
28
|
+
900: '#293239',
|
|
29
|
+
1000: '#1c2227',
|
|
30
|
+
1100: '#151a1e',
|
|
31
|
+
1200: '#0a0d0e'
|
|
34
32
|
},
|
|
35
33
|
blue: {
|
|
36
34
|
100: '#edf7ff',
|
|
37
|
-
200: '#
|
|
38
|
-
300: '#
|
|
39
|
-
400: '#
|
|
40
|
-
500: '#
|
|
41
|
-
600: '#
|
|
35
|
+
200: '#ddecf8',
|
|
36
|
+
300: '#cce0f1',
|
|
37
|
+
400: '#93bcdc',
|
|
38
|
+
500: '#66a0cd',
|
|
39
|
+
600: '#2694d6',
|
|
42
40
|
700: '#1f73b7',
|
|
43
|
-
800: '#
|
|
44
|
-
900: '#
|
|
45
|
-
1000: '#
|
|
46
|
-
1100: '#
|
|
47
|
-
1200: '#
|
|
41
|
+
800: '#13456d',
|
|
42
|
+
900: '#0f3655',
|
|
43
|
+
1000: '#0a2338',
|
|
44
|
+
1100: '#061420',
|
|
45
|
+
1200: '#040d15'
|
|
48
46
|
},
|
|
49
47
|
red: {
|
|
50
48
|
100: '#fff2f3',
|
|
51
|
-
200: '#
|
|
52
|
-
300: '#
|
|
53
|
-
400: '#
|
|
54
|
-
500: '#
|
|
55
|
-
600: '#
|
|
49
|
+
200: '#fee3e5',
|
|
50
|
+
300: '#f5d5d8',
|
|
51
|
+
400: '#f2a1a8',
|
|
52
|
+
500: '#ea7881',
|
|
53
|
+
600: '#eb5c69',
|
|
56
54
|
700: '#cd3642',
|
|
57
|
-
800: '#
|
|
58
|
-
900: '#
|
|
59
|
-
1000: '#
|
|
60
|
-
1100: '#
|
|
61
|
-
1200: '#
|
|
55
|
+
800: '#7e1d25',
|
|
56
|
+
900: '#671219',
|
|
57
|
+
1000: '#3d1418',
|
|
58
|
+
1100: '#1d1011',
|
|
59
|
+
1200: '#100b0c'
|
|
62
60
|
},
|
|
63
61
|
yellow: {
|
|
64
62
|
100: '#fff3e4',
|
|
65
|
-
200: '#
|
|
66
|
-
300: '#
|
|
67
|
-
400: '#
|
|
68
|
-
500: '#
|
|
69
|
-
600: '#
|
|
63
|
+
200: '#ffe6cb',
|
|
64
|
+
300: '#fed6a9',
|
|
65
|
+
400: '#fca347',
|
|
66
|
+
500: '#e38215',
|
|
67
|
+
600: '#d67305',
|
|
70
68
|
700: '#ac5918',
|
|
71
|
-
800: '#
|
|
72
|
-
900: '#
|
|
73
|
-
1000: '#
|
|
74
|
-
1100: '#
|
|
75
|
-
1200: '#
|
|
69
|
+
800: '#673515',
|
|
70
|
+
900: '#4c2c17',
|
|
71
|
+
1000: '#2d1e15',
|
|
72
|
+
1100: '#18120f',
|
|
73
|
+
1200: '#0e0c0b'
|
|
76
74
|
},
|
|
77
75
|
green: {
|
|
78
76
|
100: '#eef8f4',
|
|
79
|
-
200: '#
|
|
80
|
-
300: '#
|
|
81
|
-
400: '#
|
|
82
|
-
500: '#
|
|
83
|
-
600: '#
|
|
77
|
+
200: '#daeee6',
|
|
78
|
+
300: '#cae3d9',
|
|
79
|
+
400: '#94c1b0',
|
|
80
|
+
500: '#4eab89',
|
|
81
|
+
600: '#26a178',
|
|
84
82
|
700: '#037f52',
|
|
85
|
-
800: '#
|
|
86
|
-
900: '#
|
|
87
|
-
1000: '#
|
|
88
|
-
1100: '#
|
|
89
|
-
1200: '#
|
|
83
|
+
800: '#104b35',
|
|
84
|
+
900: '#0b3b29',
|
|
85
|
+
1000: '#0c261c',
|
|
86
|
+
1100: '#0a1511',
|
|
87
|
+
1200: '#080d0c'
|
|
90
88
|
},
|
|
91
89
|
kale: {
|
|
92
90
|
100: '#ecf9f9',
|
|
93
|
-
200: '#
|
|
94
|
-
300: '#
|
|
95
|
-
400: '#
|
|
96
|
-
500: '#
|
|
97
|
-
600: '#
|
|
91
|
+
200: '#daeded',
|
|
92
|
+
300: '#cbe2e1',
|
|
93
|
+
400: '#97bfbf',
|
|
94
|
+
500: '#6ba4a5',
|
|
95
|
+
600: '#4a9999',
|
|
98
96
|
700: '#40787a',
|
|
99
|
-
800: '#
|
|
100
|
-
900: '#
|
|
101
|
-
1000: '#
|
|
102
|
-
1100: '#
|
|
103
|
-
1200: '#
|
|
97
|
+
800: '#16494f',
|
|
98
|
+
900: '#063940',
|
|
99
|
+
1000: '#03252a',
|
|
100
|
+
1100: '#061517',
|
|
101
|
+
1200: '#060e0e'
|
|
104
102
|
},
|
|
105
103
|
fuschia: {
|
|
106
104
|
100: '#fbf3f8',
|
|
107
|
-
200: '#
|
|
108
|
-
300: '#
|
|
109
|
-
400: '#
|
|
110
|
-
500: '#
|
|
111
|
-
600: '#
|
|
105
|
+
200: '#f7e6f1',
|
|
106
|
+
300: '#f2d5e7',
|
|
107
|
+
400: '#e3a4cc',
|
|
108
|
+
500: '#d77db7',
|
|
109
|
+
600: '#d16aac',
|
|
112
110
|
700: '#b34496',
|
|
113
|
-
800: '#
|
|
114
|
-
900: '#
|
|
115
|
-
1000: '#
|
|
116
|
-
1100: '#
|
|
117
|
-
1200: '#
|
|
118
|
-
M400: '#cf62a8',
|
|
119
|
-
M600: '#a8458c'
|
|
111
|
+
800: '#78116c',
|
|
112
|
+
900: '#5a0d51',
|
|
113
|
+
1000: '#3f0939',
|
|
114
|
+
1100: '#31072c',
|
|
115
|
+
1200: '#1b0418'
|
|
120
116
|
},
|
|
121
117
|
pink: {
|
|
122
|
-
100: '#
|
|
123
|
-
200: '#
|
|
124
|
-
300: '#
|
|
125
|
-
400: '#
|
|
126
|
-
500: '#
|
|
127
|
-
600: '#
|
|
118
|
+
100: '#fcf3f4',
|
|
119
|
+
200: '#f7e5e8',
|
|
120
|
+
300: '#f3d6dc',
|
|
121
|
+
400: '#e5a6b4',
|
|
122
|
+
500: '#d98193',
|
|
123
|
+
600: '#d96b81',
|
|
128
124
|
700: '#d62054',
|
|
129
|
-
800: '#
|
|
130
|
-
900: '#
|
|
131
|
-
1000: '#
|
|
132
|
-
1100: '#
|
|
133
|
-
1200: '#
|
|
134
|
-
M400: '#d57287',
|
|
135
|
-
M600: '#b23a5d'
|
|
125
|
+
800: '#75263d',
|
|
126
|
+
900: '#561d2e',
|
|
127
|
+
1000: '#3c141f',
|
|
128
|
+
1100: '#2e0f18',
|
|
129
|
+
1200: '#17080c'
|
|
136
130
|
},
|
|
137
131
|
crimson: {
|
|
138
|
-
100: '#
|
|
139
|
-
200: '#
|
|
140
|
-
300: '#
|
|
141
|
-
400: '#
|
|
142
|
-
500: '#
|
|
143
|
-
600: '#
|
|
132
|
+
100: '#fbf3f2',
|
|
133
|
+
200: '#f7e7e4',
|
|
134
|
+
300: '#f1d7d2',
|
|
135
|
+
400: '#e2aaa0',
|
|
136
|
+
500: '#d58678',
|
|
137
|
+
600: '#cf7464',
|
|
144
138
|
700: '#be4938',
|
|
145
|
-
800: '#
|
|
146
|
-
900: '#
|
|
147
|
-
1000: '#
|
|
148
|
-
1100: '#
|
|
149
|
-
1200: '#
|
|
150
|
-
M400: '#cc6c5b',
|
|
151
|
-
M600: '#b24a3c'
|
|
139
|
+
800: '#811b12',
|
|
140
|
+
900: '#61140d',
|
|
141
|
+
1000: '#440e09',
|
|
142
|
+
1100: '#340b07',
|
|
143
|
+
1200: '#1c0604'
|
|
152
144
|
},
|
|
153
145
|
orange: {
|
|
154
146
|
100: '#fdf3ed',
|
|
155
|
-
200: '#
|
|
156
|
-
300: '#
|
|
157
|
-
400: '#
|
|
158
|
-
500: '#
|
|
159
|
-
600: '#
|
|
147
|
+
200: '#fae7d8',
|
|
148
|
+
300: '#f7d7be',
|
|
149
|
+
400: '#eda875',
|
|
150
|
+
500: '#e58035',
|
|
151
|
+
600: '#d57428',
|
|
160
152
|
700: '#af5626',
|
|
161
|
-
800: '#
|
|
162
|
-
900: '#
|
|
163
|
-
1000: '#
|
|
164
|
-
1100: '#
|
|
165
|
-
1200: '#
|
|
166
|
-
M400: '#d4772c',
|
|
167
|
-
M600: '#b35827'
|
|
153
|
+
800: '#693317',
|
|
154
|
+
900: '#4d2711',
|
|
155
|
+
1000: '#361a0c',
|
|
156
|
+
1100: '#291409',
|
|
157
|
+
1200: '#150a04'
|
|
168
158
|
},
|
|
169
159
|
lemon: {
|
|
170
|
-
100: '#
|
|
171
|
-
200: '#
|
|
172
|
-
300: '#
|
|
173
|
-
400: '#
|
|
174
|
-
500: '#
|
|
175
|
-
600: '#
|
|
160
|
+
100: '#fff7d4',
|
|
161
|
+
200: '#ffea97',
|
|
162
|
+
300: '#ffdc4f',
|
|
163
|
+
400: '#efab00',
|
|
164
|
+
500: '#c79100',
|
|
165
|
+
600: '#b68500',
|
|
176
166
|
700: '#8f6900',
|
|
177
|
-
800: '#
|
|
178
|
-
900: '#
|
|
179
|
-
1000: '#
|
|
180
|
-
1100: '#
|
|
181
|
-
1200: '#
|
|
182
|
-
M400: '#e7a500',
|
|
183
|
-
M600: '#c38f00'
|
|
167
|
+
800: '#563e00',
|
|
168
|
+
900: '#3f2e00',
|
|
169
|
+
1000: '#2b2000',
|
|
170
|
+
1100: '#221800',
|
|
171
|
+
1200: '#110c00'
|
|
184
172
|
},
|
|
185
173
|
lime: {
|
|
186
|
-
100: '#
|
|
187
|
-
200: '#
|
|
188
|
-
300: '#
|
|
189
|
-
400: '#
|
|
190
|
-
500: '#
|
|
191
|
-
600: '#
|
|
174
|
+
100: '#ecfae7',
|
|
175
|
+
200: '#d1f3c7',
|
|
176
|
+
300: '#b3eda3',
|
|
177
|
+
400: '#4fd12b',
|
|
178
|
+
500: '#45b025',
|
|
179
|
+
600: '#509f2d',
|
|
192
180
|
700: '#3d7e19',
|
|
193
|
-
800: '#
|
|
194
|
-
900: '#
|
|
195
|
-
1000: '#
|
|
196
|
-
1100: '#
|
|
197
|
-
1200: '#
|
|
198
|
-
M400: '#519e2d',
|
|
199
|
-
M600: '#47782c'
|
|
181
|
+
800: '#2c491b',
|
|
182
|
+
900: '#203614',
|
|
183
|
+
1000: '#16250e',
|
|
184
|
+
1100: '#111d0a',
|
|
185
|
+
1200: '#090e05'
|
|
200
186
|
},
|
|
201
187
|
mint: {
|
|
202
188
|
100: '#d6ffeb',
|
|
203
|
-
200: '#
|
|
204
|
-
300: '#
|
|
205
|
-
400: '#
|
|
206
|
-
500: '#
|
|
207
|
-
600: '#
|
|
208
|
-
700: '#
|
|
209
|
-
800: '#
|
|
210
|
-
900: '#
|
|
211
|
-
1000: '#
|
|
212
|
-
1100: '#
|
|
213
|
-
1200: '#
|
|
214
|
-
M400: '#299c66',
|
|
215
|
-
M600: '#2e8057'
|
|
189
|
+
200: '#9affce',
|
|
190
|
+
300: '#0afe89',
|
|
191
|
+
400: '#00d26d',
|
|
192
|
+
500: '#01b15c',
|
|
193
|
+
600: '#16a260',
|
|
194
|
+
700: '#2d7e55',
|
|
195
|
+
800: '#1b4b33',
|
|
196
|
+
900: '#143726',
|
|
197
|
+
1000: '#0e261a',
|
|
198
|
+
1100: '#0b1d14',
|
|
199
|
+
1200: '#050e0a'
|
|
216
200
|
},
|
|
217
201
|
teal: {
|
|
218
|
-
100: '#
|
|
219
|
-
200: '#
|
|
220
|
-
300: '#
|
|
221
|
-
400: '#
|
|
222
|
-
500: '#
|
|
223
|
-
600: '#
|
|
202
|
+
100: '#d4fefa',
|
|
203
|
+
200: '#88fdf1',
|
|
204
|
+
300: '#0bf8e1',
|
|
205
|
+
400: '#03cdb8',
|
|
206
|
+
500: '#02ad9c',
|
|
207
|
+
600: '#2a9d8f',
|
|
224
208
|
700: '#367a74',
|
|
225
|
-
800: '#
|
|
226
|
-
900: '#
|
|
227
|
-
1000: '#
|
|
228
|
-
1100: '#
|
|
229
|
-
1200: '#
|
|
230
|
-
M400: '#2d9e8f',
|
|
231
|
-
M600: '#3c7873'
|
|
209
|
+
800: '#254846',
|
|
210
|
+
900: '#1b3534',
|
|
211
|
+
1000: '#122423',
|
|
212
|
+
1100: '#0e1c1a',
|
|
213
|
+
1200: '#070d0d'
|
|
232
214
|
},
|
|
233
215
|
azure: {
|
|
234
|
-
100: '#
|
|
235
|
-
200: '#
|
|
236
|
-
300: '#
|
|
237
|
-
400: '#
|
|
238
|
-
500: '#
|
|
239
|
-
600: '#
|
|
240
|
-
700: '#
|
|
241
|
-
800: '#
|
|
242
|
-
900: '#
|
|
243
|
-
1000: '#
|
|
244
|
-
1100: '#
|
|
245
|
-
1200: '#
|
|
246
|
-
M400: '#5f8dcf',
|
|
247
|
-
M600: '#3a70b2'
|
|
216
|
+
100: '#eff7fe',
|
|
217
|
+
200: '#d9ecfc',
|
|
218
|
+
300: '#c4e0fa',
|
|
219
|
+
400: '#82bcf4',
|
|
220
|
+
500: '#4b9fee',
|
|
221
|
+
600: '#3191ea',
|
|
222
|
+
700: '#2770c3',
|
|
223
|
+
800: '#23446b',
|
|
224
|
+
900: '#1a3250',
|
|
225
|
+
1000: '#122238',
|
|
226
|
+
1100: '#0e1a2a',
|
|
227
|
+
1200: '#070d14'
|
|
248
228
|
},
|
|
249
229
|
royal: {
|
|
250
|
-
100: '#
|
|
251
|
-
200: '#
|
|
252
|
-
300: '#
|
|
253
|
-
400: '#
|
|
254
|
-
500: '#
|
|
255
|
-
600: '#
|
|
256
|
-
700: '#
|
|
257
|
-
800: '#
|
|
258
|
-
900: '#
|
|
259
|
-
1000: '#
|
|
260
|
-
1100: '#
|
|
261
|
-
1200: '#
|
|
262
|
-
M400: '#7986d8',
|
|
263
|
-
M600: '#4b61c3'
|
|
230
|
+
100: '#f4f5fc',
|
|
231
|
+
200: '#e7e9f8',
|
|
232
|
+
300: '#d8dcf4',
|
|
233
|
+
400: '#acb4e7',
|
|
234
|
+
500: '#8a96dd',
|
|
235
|
+
600: '#7a88d9',
|
|
236
|
+
700: '#4c67d3',
|
|
237
|
+
800: '#1833ab',
|
|
238
|
+
900: '#122680',
|
|
239
|
+
1000: '#0d1a5a',
|
|
240
|
+
1100: '#0a1445',
|
|
241
|
+
1200: '#050a25'
|
|
264
242
|
},
|
|
265
243
|
purple: {
|
|
266
|
-
100: '#
|
|
267
|
-
200: '#
|
|
268
|
-
300: '#
|
|
269
|
-
400: '#
|
|
270
|
-
500: '#
|
|
271
|
-
600: '#
|
|
244
|
+
100: '#f9f3fb',
|
|
245
|
+
200: '#f2e7f6',
|
|
246
|
+
300: '#e9d8f1',
|
|
247
|
+
400: '#d0a9e0',
|
|
248
|
+
500: '#bb86d3',
|
|
249
|
+
600: '#b276cd',
|
|
272
250
|
700: '#9256b1',
|
|
273
|
-
800: '#
|
|
274
|
-
900: '#
|
|
275
|
-
1000: '#
|
|
276
|
-
1100: '#
|
|
277
|
-
1200: '#
|
|
278
|
-
M400: '#b072cc',
|
|
279
|
-
M600: '#9358b0'
|
|
251
|
+
800: '#58209a',
|
|
252
|
+
900: '#411973',
|
|
253
|
+
1000: '#2e1150',
|
|
254
|
+
1100: '#230d3f',
|
|
255
|
+
1200: '#120720'
|
|
280
256
|
}
|
|
281
257
|
};
|
|
282
258
|
|
|
@@ -158,6 +158,20 @@ const lineHeights = {
|
|
|
158
158
|
xxl: `${BASE * 8}px`,
|
|
159
159
|
xxxl: `${BASE * 11}px`
|
|
160
160
|
};
|
|
161
|
+
const opacity = {
|
|
162
|
+
100: 0.08,
|
|
163
|
+
200: 0.16,
|
|
164
|
+
300: 0.24,
|
|
165
|
+
400: 0.32,
|
|
166
|
+
500: 0.4,
|
|
167
|
+
600: 0.48,
|
|
168
|
+
700: 0.56,
|
|
169
|
+
800: 0.64,
|
|
170
|
+
900: 0.72,
|
|
171
|
+
1000: 0.8,
|
|
172
|
+
1100: 0.88,
|
|
173
|
+
1200: 0.96
|
|
174
|
+
};
|
|
161
175
|
const palette = {
|
|
162
176
|
...PALETTE
|
|
163
177
|
};
|
|
@@ -199,6 +213,7 @@ const DEFAULT_THEME = {
|
|
|
199
213
|
fontWeights,
|
|
200
214
|
iconSizes,
|
|
201
215
|
lineHeights,
|
|
216
|
+
opacity,
|
|
202
217
|
palette,
|
|
203
218
|
rtl: false,
|
|
204
219
|
shadowWidths,
|
package/dist/esm/index.js
CHANGED
|
@@ -10,6 +10,7 @@ export { default as PALETTE } from './elements/palette/index.js';
|
|
|
10
10
|
export { default as PALETTE_V8 } from './elements/palette/v8.js';
|
|
11
11
|
export { default as retrieveComponentStyles } from './utils/retrieveComponentStyles.js';
|
|
12
12
|
export { getArrowPosition } from './utils/getArrowPosition.js';
|
|
13
|
+
export { getCheckeredBackground } from './utils/getCheckeredBackground.js';
|
|
13
14
|
export { getColor } from './utils/getColor.js';
|
|
14
15
|
export { getColorV8 } from './utils/getColorV8.js';
|
|
15
16
|
export { getFloatingPlacements } from './utils/getFloatingPlacements.js';
|
|
@@ -23,4 +24,5 @@ export { useWindow } from './utils/useWindow.js';
|
|
|
23
24
|
export { useText } from './utils/useText.js';
|
|
24
25
|
export { default as menuStyles } from './utils/menuStyles.js';
|
|
25
26
|
export { SELECTOR_FOCUS_VISIBLE, focusStyles } from './utils/focusStyles.js';
|
|
27
|
+
export { StyledBaseIcon } from './utils/StyledBaseIcon.js';
|
|
26
28
|
export { ARROW_POSITION, MENU_POSITION, PLACEMENT } from './types/index.js';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
import styled from 'styled-components';
|
|
8
|
+
import React, { Children } from 'react';
|
|
9
|
+
|
|
10
|
+
const StyledBaseIcon = styled(_ref => {
|
|
11
|
+
let {
|
|
12
|
+
children,
|
|
13
|
+
theme,
|
|
14
|
+
...props
|
|
15
|
+
} = _ref;
|
|
16
|
+
return React.cloneElement(Children.only(children), props);
|
|
17
|
+
}).withConfig({
|
|
18
|
+
displayName: "StyledBaseIcon",
|
|
19
|
+
componentId: "sc-1moykgb-0"
|
|
20
|
+
})([""]);
|
|
21
|
+
|
|
22
|
+
export { StyledBaseIcon };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Zendesk, Inc.
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed under the Apache License, Version 2.0
|
|
5
|
+
* found at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
*/
|
|
7
|
+
import { getColor } from './getColor.js';
|
|
8
|
+
|
|
9
|
+
const getCheckeredBackground = _ref => {
|
|
10
|
+
let {
|
|
11
|
+
theme,
|
|
12
|
+
size,
|
|
13
|
+
overlay,
|
|
14
|
+
positionY = 0,
|
|
15
|
+
repeat = 'repeat'
|
|
16
|
+
} = _ref;
|
|
17
|
+
const color = getColor({
|
|
18
|
+
theme,
|
|
19
|
+
variable: 'border.default'
|
|
20
|
+
});
|
|
21
|
+
const dimensions = `${size}px ${size}px`;
|
|
22
|
+
const positionX1 = theme.rtl ? '100%' : '0';
|
|
23
|
+
const positionX2 = theme.rtl ? `calc(100% - ${size / 2}px)` : `${size / 2}px`;
|
|
24
|
+
const position1 = `${positionX1} ${positionY}px`;
|
|
25
|
+
const position2 = `${positionX2} ${size / 2 + positionY}px`;
|
|
26
|
+
const position3 = `${positionX2} ${positionY}px`;
|
|
27
|
+
const position4 = `${positionX1} ${size / -2 + positionY}px`;
|
|
28
|
+
let retVal = `
|
|
29
|
+
linear-gradient(45deg, ${color} 25%, transparent 25%) ${position1} / ${dimensions} ${repeat},
|
|
30
|
+
linear-gradient(45deg, transparent 75%, ${color} 75%) ${position2} / ${dimensions} ${repeat},
|
|
31
|
+
linear-gradient(135deg, ${color} 25%, transparent 25%) ${position3} / ${dimensions} ${repeat},
|
|
32
|
+
linear-gradient(135deg, transparent 75%, ${color} 75%) ${position4} / ${dimensions} ${repeat}
|
|
33
|
+
`;
|
|
34
|
+
if (overlay) {
|
|
35
|
+
retVal = overlay.startsWith('linear-gradient') ? `${overlay}, ${retVal}` : `linear-gradient(${overlay}, ${overlay}), ${retVal}`;
|
|
36
|
+
}
|
|
37
|
+
return retVal;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export { getCheckeredBackground };
|
|
@@ -42,7 +42,7 @@ const toHex = (hue, shade, offset, scheme) => {
|
|
|
42
42
|
}
|
|
43
43
|
return retVal;
|
|
44
44
|
};
|
|
45
|
-
const toColor = (colors, palette, scheme, hue, shade, offset, transparency) => {
|
|
45
|
+
const toColor = (colors, palette, opacity, scheme, hue, shade, offset, transparency) => {
|
|
46
46
|
let retVal;
|
|
47
47
|
let _hue = colors[hue] || hue;
|
|
48
48
|
if (Object.hasOwn(palette, _hue)) {
|
|
@@ -65,7 +65,11 @@ const toColor = (colors, palette, scheme, hue, shade, offset, transparency) => {
|
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
if (retVal && transparency) {
|
|
68
|
-
|
|
68
|
+
const alpha = transparency > 1 ? opacity[transparency] : transparency;
|
|
69
|
+
if (alpha === undefined) {
|
|
70
|
+
throw new Error('Error: invalid `transparency` parameter');
|
|
71
|
+
}
|
|
72
|
+
retVal = rgba(retVal, alpha);
|
|
69
73
|
}
|
|
70
74
|
return retVal;
|
|
71
75
|
};
|
|
@@ -115,7 +119,8 @@ const getColor = memoize(_ref => {
|
|
|
115
119
|
}
|
|
116
120
|
}
|
|
117
121
|
if (_hue) {
|
|
118
|
-
|
|
122
|
+
const opacity = theme.opacity && Object.keys(theme.opacity).length > 0 ? theme.opacity : DEFAULT_THEME.opacity;
|
|
123
|
+
retVal = toColor(colors, palette, opacity, scheme, _hue, _shade, _offset, _transparency);
|
|
119
124
|
}
|
|
120
125
|
if (retVal === undefined) {
|
|
121
126
|
throw new Error('Error: invalid `getColor` parameters');
|