@zendeskgarden/react-theming 9.0.0-next.5 → 9.0.0-next.6
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/index.cjs.js +525 -78
- package/dist/index.esm.js +522 -78
- package/dist/typings/elements/palette/index.d.ts +134 -2
- package/dist/typings/elements/palette/v8.d.ts +149 -0
- package/dist/typings/elements/theme/index.d.ts +0 -1
- package/dist/typings/index.d.ts +3 -1
- package/dist/typings/types/index.d.ts +14 -5
- package/dist/typings/utils/getColor.d.ts +51 -0
- package/dist/typings/utils/{_getColor.d.ts → getColorV8.d.ts} +4 -2
- package/dist/typings/utils/getFocusBoxShadow.d.ts +1 -2
- package/package.json +6 -2
package/dist/index.esm.js
CHANGED
|
@@ -9,7 +9,9 @@ import React, { useState, useEffect, useRef, useMemo } from 'react';
|
|
|
9
9
|
import { ThemeProvider as ThemeProvider$1, css, keyframes } from 'styled-components';
|
|
10
10
|
import { useFocusVisible } from '@zendeskgarden/container-focusvisible';
|
|
11
11
|
import { getControlledValue } from '@zendeskgarden/container-utilities';
|
|
12
|
+
import { valid, scale } from 'chroma-js';
|
|
12
13
|
import { rgba, darken, lighten, getValueAndUnit, math } from 'polished';
|
|
14
|
+
import get from 'lodash.get';
|
|
13
15
|
import memoize from 'lodash.memoize';
|
|
14
16
|
|
|
15
17
|
function _extends() {
|
|
@@ -42,128 +44,262 @@ const PALETTE = {
|
|
|
42
44
|
sell: '#c38f00'
|
|
43
45
|
},
|
|
44
46
|
grey: {
|
|
45
|
-
100: '#
|
|
46
|
-
200: '#
|
|
47
|
-
300: '#
|
|
48
|
-
400: '#
|
|
49
|
-
500: '#
|
|
50
|
-
600: '#
|
|
51
|
-
700: '#
|
|
52
|
-
800: '#
|
|
47
|
+
100: '#f4f6f6',
|
|
48
|
+
200: '#e4e7e9',
|
|
49
|
+
300: '#c7cdd0',
|
|
50
|
+
400: '#afb7bd',
|
|
51
|
+
500: '#88929d',
|
|
52
|
+
600: '#7f8a95',
|
|
53
|
+
700: '#65707a',
|
|
54
|
+
800: '#4b565f',
|
|
55
|
+
900: '#2e373f',
|
|
56
|
+
1000: '#1e252a',
|
|
57
|
+
1100: '#171b1f',
|
|
58
|
+
1200: '#101316'
|
|
53
59
|
},
|
|
54
60
|
blue: {
|
|
55
61
|
100: '#edf7ff',
|
|
56
|
-
200: '#
|
|
57
|
-
300: '#
|
|
58
|
-
400: '#
|
|
59
|
-
500: '#
|
|
60
|
-
600: '#
|
|
61
|
-
700: '#
|
|
62
|
-
800: '#
|
|
62
|
+
200: '#d9eaf7',
|
|
63
|
+
300: '#b3d0e7',
|
|
64
|
+
400: '#92bbdb',
|
|
65
|
+
500: '#5896c9',
|
|
66
|
+
600: '#4b8ec5',
|
|
67
|
+
700: '#1f73b7',
|
|
68
|
+
800: '#18578b',
|
|
69
|
+
900: '#103859',
|
|
70
|
+
1000: '#0b253b',
|
|
71
|
+
1100: '#081c2d',
|
|
72
|
+
1200: '#061420'
|
|
63
73
|
},
|
|
64
74
|
red: {
|
|
65
|
-
100: '#
|
|
66
|
-
200: '#
|
|
67
|
-
300: '#
|
|
68
|
-
400: '#
|
|
69
|
-
500: '#
|
|
70
|
-
600: '#
|
|
71
|
-
700: '#
|
|
72
|
-
800: '#
|
|
75
|
+
100: '#fff2f3',
|
|
76
|
+
200: '#fde1e3',
|
|
77
|
+
300: '#f5bfc4',
|
|
78
|
+
400: '#f2a0a6',
|
|
79
|
+
500: '#e76973',
|
|
80
|
+
600: '#e35c67',
|
|
81
|
+
700: '#cd3642',
|
|
82
|
+
800: '#9d2933',
|
|
83
|
+
900: '#6c1219',
|
|
84
|
+
1000: '#431418',
|
|
85
|
+
1100: '#2d1315',
|
|
86
|
+
1200: '#1b1011'
|
|
73
87
|
},
|
|
74
88
|
yellow: {
|
|
75
|
-
100: '#
|
|
76
|
-
200: '#
|
|
77
|
-
300: '#
|
|
78
|
-
400: '#
|
|
79
|
-
500: '#
|
|
80
|
-
600: '#
|
|
81
|
-
700: '#
|
|
82
|
-
800: '#
|
|
89
|
+
100: '#fff3e4',
|
|
90
|
+
200: '#ffe2c2',
|
|
91
|
+
300: '#ffc079',
|
|
92
|
+
400: '#fba246',
|
|
93
|
+
500: '#d87916',
|
|
94
|
+
600: '#ce7117',
|
|
95
|
+
700: '#ac5918',
|
|
96
|
+
800: '#874114',
|
|
97
|
+
900: '#512d17',
|
|
98
|
+
1000: '#312016',
|
|
99
|
+
1100: '#221913',
|
|
100
|
+
1200: '#17120f'
|
|
83
101
|
},
|
|
84
102
|
green: {
|
|
85
|
-
100: '#
|
|
86
|
-
200: '#
|
|
87
|
-
300: '#
|
|
88
|
-
400: '#
|
|
89
|
-
500: '#
|
|
90
|
-
600: '#
|
|
91
|
-
700: '#
|
|
92
|
-
800: '#
|
|
103
|
+
100: '#eef8f4',
|
|
104
|
+
200: '#d7ede4',
|
|
105
|
+
300: '#b4d3c6',
|
|
106
|
+
400: '#91bfae',
|
|
107
|
+
500: '#3fa17e',
|
|
108
|
+
600: '#329974',
|
|
109
|
+
700: '#037f52',
|
|
110
|
+
800: '#186045',
|
|
111
|
+
900: '#0b3e2b',
|
|
112
|
+
1000: '#0c291e',
|
|
113
|
+
1100: '#0b1e17',
|
|
114
|
+
1200: '#0a1511'
|
|
93
115
|
},
|
|
94
116
|
kale: {
|
|
95
|
-
100: '#
|
|
96
|
-
200: '#
|
|
97
|
-
300: '#
|
|
98
|
-
400: '#
|
|
99
|
-
500: '#
|
|
100
|
-
600: '#
|
|
101
|
-
700: '#
|
|
102
|
-
800: '#
|
|
117
|
+
100: '#ecf9f9',
|
|
118
|
+
200: '#d8ebeb',
|
|
119
|
+
300: '#b3d2d0',
|
|
120
|
+
400: '#94bebd',
|
|
121
|
+
500: '#5e9b9c',
|
|
122
|
+
600: '#579394',
|
|
123
|
+
700: '#40787a',
|
|
124
|
+
800: '#275c5f',
|
|
125
|
+
900: '#0a3c42',
|
|
126
|
+
1000: '#02282d',
|
|
127
|
+
1100: '#041e22',
|
|
128
|
+
1200: '#061517'
|
|
103
129
|
},
|
|
104
130
|
fuschia: {
|
|
105
|
-
|
|
106
|
-
|
|
131
|
+
100: '#fbf3f8',
|
|
132
|
+
200: '#f6e2ef',
|
|
133
|
+
300: '#ecc0dc',
|
|
134
|
+
400: '#e3a2cc',
|
|
135
|
+
500: '#d36faf',
|
|
136
|
+
600: '#cf63a8',
|
|
137
|
+
700: '#b34496',
|
|
138
|
+
800: '#971688',
|
|
139
|
+
900: '#640e59',
|
|
140
|
+
1000: '#430a3d',
|
|
141
|
+
1100: '#34072f',
|
|
142
|
+
1200: '#260523',
|
|
107
143
|
M400: '#cf62a8',
|
|
108
144
|
M600: '#a8458c'
|
|
109
145
|
},
|
|
110
146
|
pink: {
|
|
111
|
-
|
|
112
|
-
|
|
147
|
+
100: '#fcf4f5',
|
|
148
|
+
200: '#f7e3e8',
|
|
149
|
+
300: '#edc1ca',
|
|
150
|
+
400: '#e4a5b3',
|
|
151
|
+
500: '#d57388',
|
|
152
|
+
600: '#e35b72',
|
|
153
|
+
700: '#d62054',
|
|
154
|
+
800: '#94304e',
|
|
155
|
+
900: '#611f32',
|
|
156
|
+
1000: '#401522',
|
|
157
|
+
1100: '#31101a',
|
|
158
|
+
1200: '#230b12',
|
|
113
159
|
M400: '#d57287',
|
|
114
160
|
M600: '#b23a5d'
|
|
115
161
|
},
|
|
116
162
|
crimson: {
|
|
117
|
-
|
|
118
|
-
|
|
163
|
+
100: '#fbf4f3',
|
|
164
|
+
200: '#f6e4e1',
|
|
165
|
+
300: '#eac3bc',
|
|
166
|
+
400: '#e1a89e',
|
|
167
|
+
500: '#d1796a',
|
|
168
|
+
600: '#cd6e5d',
|
|
169
|
+
700: '#be4938',
|
|
170
|
+
800: '#a32217',
|
|
171
|
+
900: '#6b160f',
|
|
172
|
+
1000: '#480f0a',
|
|
173
|
+
1100: '#370c08',
|
|
174
|
+
1200: '#280806',
|
|
119
175
|
M400: '#cc6c5b',
|
|
120
176
|
M600: '#b24a3c'
|
|
121
177
|
},
|
|
122
178
|
orange: {
|
|
123
|
-
|
|
124
|
-
|
|
179
|
+
100: '#fdf3ed',
|
|
180
|
+
200: '#f9e3d3',
|
|
181
|
+
300: '#f2c39f',
|
|
182
|
+
400: '#eda671',
|
|
183
|
+
500: '#e2721e',
|
|
184
|
+
600: '#d26e20',
|
|
185
|
+
700: '#af5626',
|
|
186
|
+
800: '#85421d',
|
|
187
|
+
900: '#562b13',
|
|
188
|
+
1000: '#3a1c0d',
|
|
189
|
+
1100: '#2c150a',
|
|
190
|
+
1200: '#1f0f07',
|
|
125
191
|
M400: '#d4772c',
|
|
126
192
|
M600: '#b35827'
|
|
127
193
|
},
|
|
128
194
|
lemon: {
|
|
129
|
-
|
|
130
|
-
|
|
195
|
+
100: '#fff6cf',
|
|
196
|
+
200: '#ffe682',
|
|
197
|
+
300: '#ffc417',
|
|
198
|
+
400: '#eda900',
|
|
199
|
+
500: '#ba8900',
|
|
200
|
+
600: '#b08100',
|
|
201
|
+
700: '#8f6900',
|
|
202
|
+
800: '#6d5000',
|
|
203
|
+
900: '#463300',
|
|
204
|
+
1000: '#2f2200',
|
|
205
|
+
1100: '#231a00',
|
|
206
|
+
1200: '#191200',
|
|
131
207
|
M400: '#e7a500',
|
|
132
208
|
M600: '#c38f00'
|
|
133
209
|
},
|
|
134
210
|
lime: {
|
|
135
|
-
|
|
136
|
-
|
|
211
|
+
100: '#ebfae6',
|
|
212
|
+
200: '#c9f2bd',
|
|
213
|
+
300: '#88e270',
|
|
214
|
+
400: '#4ecf2a',
|
|
215
|
+
500: '#4da42a',
|
|
216
|
+
600: '#489b20',
|
|
217
|
+
700: '#3d7e19',
|
|
218
|
+
800: '#385f23',
|
|
219
|
+
900: '#243c16',
|
|
220
|
+
1000: '#18280f',
|
|
221
|
+
1100: '#121e0b',
|
|
222
|
+
1200: '#0d1508',
|
|
137
223
|
M400: '#519e2d',
|
|
138
224
|
M600: '#47782c'
|
|
139
225
|
},
|
|
140
226
|
mint: {
|
|
141
|
-
|
|
142
|
-
|
|
227
|
+
100: '#d6ffeb',
|
|
228
|
+
200: '#83ffc3',
|
|
229
|
+
300: '#00ea79',
|
|
230
|
+
400: '#00d16d',
|
|
231
|
+
500: '#00a756',
|
|
232
|
+
600: '#279b65',
|
|
233
|
+
700: '#2d7d55',
|
|
234
|
+
800: '#225f41',
|
|
235
|
+
900: '#163d2a',
|
|
236
|
+
1000: '#0f291c',
|
|
237
|
+
1100: '#0b1e15',
|
|
238
|
+
1200: '#08150f',
|
|
143
239
|
M400: '#299c66',
|
|
144
240
|
M600: '#2e8057'
|
|
145
241
|
},
|
|
146
242
|
teal: {
|
|
147
|
-
|
|
148
|
-
|
|
243
|
+
100: '#d6fefa',
|
|
244
|
+
200: '#70fdef',
|
|
245
|
+
300: '#03e5ce',
|
|
246
|
+
400: '#03ccb8',
|
|
247
|
+
500: '#02a392',
|
|
248
|
+
600: '#1f998b',
|
|
249
|
+
700: '#367a74',
|
|
250
|
+
800: '#2e5c59',
|
|
251
|
+
900: '#1e3b39',
|
|
252
|
+
1000: '#142726',
|
|
253
|
+
1100: '#0f1d1c',
|
|
254
|
+
1200: '#0a1514',
|
|
149
255
|
M400: '#2d9e8f',
|
|
150
256
|
M600: '#3c7873'
|
|
151
257
|
},
|
|
152
258
|
azure: {
|
|
153
|
-
|
|
154
|
-
|
|
259
|
+
100: '#f0f7fe',
|
|
260
|
+
200: '#d7eafb',
|
|
261
|
+
300: '#a8d1f7',
|
|
262
|
+
400: '#7fbbf3',
|
|
263
|
+
500: '#3795ed',
|
|
264
|
+
600: '#598ad0',
|
|
265
|
+
700: '#2770c4',
|
|
266
|
+
800: '#2c5689',
|
|
267
|
+
900: '#1d3758',
|
|
268
|
+
1000: '#13253a',
|
|
269
|
+
1100: '#0e1b2c',
|
|
270
|
+
1200: '#0a131f',
|
|
155
271
|
M400: '#5f8dcf',
|
|
156
272
|
M600: '#3a70b2'
|
|
157
273
|
},
|
|
158
274
|
royal: {
|
|
159
|
-
|
|
160
|
-
|
|
275
|
+
100: '#f5f6fc',
|
|
276
|
+
200: '#e3e6f7',
|
|
277
|
+
300: '#c5cbee',
|
|
278
|
+
400: '#abb3e7',
|
|
279
|
+
500: '#7f8cda',
|
|
280
|
+
600: '#7182e1',
|
|
281
|
+
700: '#4d67d3',
|
|
282
|
+
800: '#1f40d8',
|
|
283
|
+
900: '#142a8d',
|
|
284
|
+
1000: '#0e1c5f',
|
|
285
|
+
1100: '#0a1548',
|
|
286
|
+
1200: '#070f34',
|
|
161
287
|
M400: '#7986d8',
|
|
162
288
|
M600: '#4b61c3'
|
|
163
289
|
},
|
|
164
290
|
purple: {
|
|
165
|
-
|
|
166
|
-
|
|
291
|
+
100: '#f9f4fb',
|
|
292
|
+
200: '#efe3f5',
|
|
293
|
+
300: '#ddc3e9',
|
|
294
|
+
400: '#cea8e0',
|
|
295
|
+
500: '#b57acf',
|
|
296
|
+
600: '#b16ecf',
|
|
297
|
+
700: '#9256b1',
|
|
298
|
+
800: '#722eb8',
|
|
299
|
+
900: '#491b7f',
|
|
300
|
+
1000: '#311256',
|
|
301
|
+
1100: '#250e41',
|
|
302
|
+
1200: '#1b0a2e',
|
|
167
303
|
M400: '#b072cc',
|
|
168
304
|
M600: '#9358b0'
|
|
169
305
|
}
|
|
@@ -193,14 +329,36 @@ const breakpoints = {
|
|
|
193
329
|
xl: `${BASE * 300}px`
|
|
194
330
|
};
|
|
195
331
|
const colors = {
|
|
196
|
-
background: PALETTE.white,
|
|
197
|
-
foreground: PALETTE.grey[800],
|
|
198
332
|
primaryHue: 'blue',
|
|
199
333
|
dangerHue: 'red',
|
|
200
334
|
warningHue: 'yellow',
|
|
201
335
|
successHue: 'green',
|
|
202
336
|
neutralHue: 'grey',
|
|
203
|
-
chromeHue: 'kale'
|
|
337
|
+
chromeHue: 'kale',
|
|
338
|
+
variables: {
|
|
339
|
+
dark: {
|
|
340
|
+
background: {
|
|
341
|
+
default: 'neutralHue.1100'
|
|
342
|
+
},
|
|
343
|
+
border: {
|
|
344
|
+
default: 'neutralHue.700'
|
|
345
|
+
},
|
|
346
|
+
foreground: {
|
|
347
|
+
default: 'neutralHue.300'
|
|
348
|
+
}
|
|
349
|
+
},
|
|
350
|
+
light: {
|
|
351
|
+
background: {
|
|
352
|
+
default: 'palette.white'
|
|
353
|
+
},
|
|
354
|
+
border: {
|
|
355
|
+
default: 'neutralHue.400'
|
|
356
|
+
},
|
|
357
|
+
foreground: {
|
|
358
|
+
default: 'neutralHue.900'
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
}
|
|
204
362
|
};
|
|
205
363
|
const fonts = {
|
|
206
364
|
mono: ['SFMono-Regular' , 'Consolas' , '"Liberation Mono"' , 'Menlo', 'Courier', 'monospace'].join(','),
|
|
@@ -323,6 +481,148 @@ ThemeProvider.defaultProps = {
|
|
|
323
481
|
theme: DEFAULT_THEME
|
|
324
482
|
};
|
|
325
483
|
|
|
484
|
+
const PALETTE_V8 = {
|
|
485
|
+
black: '#000',
|
|
486
|
+
white: '#fff',
|
|
487
|
+
product: {
|
|
488
|
+
support: '#00a656',
|
|
489
|
+
message: '#37b8af',
|
|
490
|
+
explore: '#30aabc',
|
|
491
|
+
gather: '#f6c8be',
|
|
492
|
+
guide: '#eb4962',
|
|
493
|
+
connect: '#ff6224',
|
|
494
|
+
chat: '#f79a3e',
|
|
495
|
+
talk: '#efc93d',
|
|
496
|
+
sell: '#c38f00'
|
|
497
|
+
},
|
|
498
|
+
grey: {
|
|
499
|
+
100: '#f8f9f9',
|
|
500
|
+
200: '#e9ebed',
|
|
501
|
+
300: '#d8dcde',
|
|
502
|
+
400: '#c2c8cc',
|
|
503
|
+
500: '#87929d',
|
|
504
|
+
600: '#68737d',
|
|
505
|
+
700: '#49545c',
|
|
506
|
+
800: '#2f3941'
|
|
507
|
+
},
|
|
508
|
+
blue: {
|
|
509
|
+
100: '#edf7ff',
|
|
510
|
+
200: '#cee2f2',
|
|
511
|
+
300: '#adcce4',
|
|
512
|
+
400: '#5293c7',
|
|
513
|
+
500: '#337fbd',
|
|
514
|
+
600: '#1f73b7',
|
|
515
|
+
700: '#144a75',
|
|
516
|
+
800: '#0f3554'
|
|
517
|
+
},
|
|
518
|
+
red: {
|
|
519
|
+
100: '#fff0f1',
|
|
520
|
+
200: '#f5d5d8',
|
|
521
|
+
300: '#f5b5ba',
|
|
522
|
+
400: '#e35b66',
|
|
523
|
+
500: '#d93f4c',
|
|
524
|
+
600: '#cc3340',
|
|
525
|
+
700: '#8c232c',
|
|
526
|
+
800: '#681219'
|
|
527
|
+
},
|
|
528
|
+
yellow: {
|
|
529
|
+
100: '#fff7ed',
|
|
530
|
+
200: '#ffeedb',
|
|
531
|
+
300: '#fed6a8',
|
|
532
|
+
400: '#ffb057',
|
|
533
|
+
500: '#f79a3e',
|
|
534
|
+
600: '#ed8f1c',
|
|
535
|
+
700: '#ad5918',
|
|
536
|
+
800: '#703815'
|
|
537
|
+
},
|
|
538
|
+
green: {
|
|
539
|
+
100: '#edf8f4',
|
|
540
|
+
200: '#d1e8df',
|
|
541
|
+
300: '#aecfc2',
|
|
542
|
+
400: '#5eae91',
|
|
543
|
+
500: '#228f67',
|
|
544
|
+
600: '#038153',
|
|
545
|
+
700: '#186146',
|
|
546
|
+
800: '#0b3b29'
|
|
547
|
+
},
|
|
548
|
+
kale: {
|
|
549
|
+
100: '#f5fcfc',
|
|
550
|
+
200: '#daeded',
|
|
551
|
+
300: '#bdd9d7',
|
|
552
|
+
400: '#90bbbb',
|
|
553
|
+
500: '#498283',
|
|
554
|
+
600: '#17494d',
|
|
555
|
+
700: '#03363d',
|
|
556
|
+
800: '#012b30'
|
|
557
|
+
},
|
|
558
|
+
fuschia: {
|
|
559
|
+
400: '#d653c2',
|
|
560
|
+
600: '#a81897',
|
|
561
|
+
M400: '#cf62a8',
|
|
562
|
+
M600: '#a8458c'
|
|
563
|
+
},
|
|
564
|
+
pink: {
|
|
565
|
+
400: '#ec4d63',
|
|
566
|
+
600: '#d42054',
|
|
567
|
+
M400: '#d57287',
|
|
568
|
+
M600: '#b23a5d'
|
|
569
|
+
},
|
|
570
|
+
crimson: {
|
|
571
|
+
400: '#e34f32',
|
|
572
|
+
600: '#c72a1c',
|
|
573
|
+
M400: '#cc6c5b',
|
|
574
|
+
M600: '#b24a3c'
|
|
575
|
+
},
|
|
576
|
+
orange: {
|
|
577
|
+
400: '#de701d',
|
|
578
|
+
600: '#bf5000',
|
|
579
|
+
M400: '#d4772c',
|
|
580
|
+
M600: '#b35827'
|
|
581
|
+
},
|
|
582
|
+
lemon: {
|
|
583
|
+
400: '#ffd424',
|
|
584
|
+
600: '#ffbb10',
|
|
585
|
+
M400: '#e7a500',
|
|
586
|
+
M600: '#c38f00'
|
|
587
|
+
},
|
|
588
|
+
lime: {
|
|
589
|
+
400: '#43b324',
|
|
590
|
+
600: '#2e8200',
|
|
591
|
+
M400: '#519e2d',
|
|
592
|
+
M600: '#47782c'
|
|
593
|
+
},
|
|
594
|
+
mint: {
|
|
595
|
+
400: '#00a656',
|
|
596
|
+
600: '#058541',
|
|
597
|
+
M400: '#299c66',
|
|
598
|
+
M600: '#2e8057'
|
|
599
|
+
},
|
|
600
|
+
teal: {
|
|
601
|
+
400: '#02a191',
|
|
602
|
+
600: '#028079',
|
|
603
|
+
M400: '#2d9e8f',
|
|
604
|
+
M600: '#3c7873'
|
|
605
|
+
},
|
|
606
|
+
azure: {
|
|
607
|
+
400: '#3091ec',
|
|
608
|
+
600: '#1371d6',
|
|
609
|
+
M400: '#5f8dcf',
|
|
610
|
+
M600: '#3a70b2'
|
|
611
|
+
},
|
|
612
|
+
royal: {
|
|
613
|
+
400: '#5d7df5',
|
|
614
|
+
600: '#3353e2',
|
|
615
|
+
M400: '#7986d8',
|
|
616
|
+
M600: '#4b61c3'
|
|
617
|
+
},
|
|
618
|
+
purple: {
|
|
619
|
+
400: '#b552e2',
|
|
620
|
+
600: '#6a27b8',
|
|
621
|
+
M400: '#b072cc',
|
|
622
|
+
M600: '#9358b0'
|
|
623
|
+
}
|
|
624
|
+
};
|
|
625
|
+
|
|
326
626
|
function retrieveComponentStyles(componentId, props) {
|
|
327
627
|
const components = props.theme && props.theme.components;
|
|
328
628
|
if (!components) {
|
|
@@ -363,6 +663,140 @@ const getArrowPosition = (theme, placement) => {
|
|
|
363
663
|
return retVal;
|
|
364
664
|
};
|
|
365
665
|
|
|
666
|
+
const PALETTE_SIZE = Object.keys(PALETTE.blue).length;
|
|
667
|
+
const adjust$1 = (color, expected, actual) => {
|
|
668
|
+
if (expected !== actual) {
|
|
669
|
+
const amount = Math.abs(expected - actual) / 100 * 0.05;
|
|
670
|
+
return expected > actual ? darken(amount, color) : lighten(amount, color);
|
|
671
|
+
}
|
|
672
|
+
return color;
|
|
673
|
+
};
|
|
674
|
+
const toShade = (shade, offset, scheme) => {
|
|
675
|
+
let _shade;
|
|
676
|
+
if (shade === undefined) {
|
|
677
|
+
_shade = scheme === 'dark' ? 500 : 700;
|
|
678
|
+
} else {
|
|
679
|
+
_shade = parseInt(shade.toString(), 10);
|
|
680
|
+
if (isNaN(_shade)) {
|
|
681
|
+
throw new TypeError(`Error: unexpected '${typeof shade}' type for color shade "${shade}"`);
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
return _shade + (offset || 0);
|
|
685
|
+
};
|
|
686
|
+
const toHex = (hue, shade, offset, scheme) => {
|
|
687
|
+
const _shade = toShade(shade, offset, scheme);
|
|
688
|
+
let retVal = hue[_shade];
|
|
689
|
+
if (!retVal) {
|
|
690
|
+
const closestShade = Object.keys(hue).map(hueShade => parseInt(hueShade, 10)).reduce((previous, current) => {
|
|
691
|
+
return Math.abs(current - _shade) < Math.abs(previous - _shade) ? current : previous;
|
|
692
|
+
});
|
|
693
|
+
retVal = adjust$1(hue[closestShade], _shade, closestShade);
|
|
694
|
+
}
|
|
695
|
+
return retVal;
|
|
696
|
+
};
|
|
697
|
+
const toColor = (colors, palette, scheme, hue, shade, offset, transparency) => {
|
|
698
|
+
let retVal;
|
|
699
|
+
let _hue = colors[hue] || hue;
|
|
700
|
+
if (Object.hasOwn(palette, _hue)) {
|
|
701
|
+
_hue = palette[_hue];
|
|
702
|
+
}
|
|
703
|
+
if (typeof _hue === 'object') {
|
|
704
|
+
retVal = toHex(_hue, shade, offset, scheme);
|
|
705
|
+
} else if (valid(_hue)) {
|
|
706
|
+
if (shade === undefined) {
|
|
707
|
+
retVal = _hue;
|
|
708
|
+
} else {
|
|
709
|
+
const _colors = scale([PALETTE.white, _hue, PALETTE.black]).correctLightness().colors(PALETTE_SIZE + 2);
|
|
710
|
+
_hue = _colors.reduce((_retVal, color, index) => {
|
|
711
|
+
if (index > 0 && index <= PALETTE_SIZE) {
|
|
712
|
+
_retVal[index * 100] = color;
|
|
713
|
+
}
|
|
714
|
+
return _retVal;
|
|
715
|
+
}, {});
|
|
716
|
+
retVal = toHex(_hue, shade, offset, scheme);
|
|
717
|
+
}
|
|
718
|
+
}
|
|
719
|
+
if (retVal && transparency) {
|
|
720
|
+
retVal = rgba(retVal, transparency);
|
|
721
|
+
}
|
|
722
|
+
return retVal;
|
|
723
|
+
};
|
|
724
|
+
const toProperty = (object, path) => {
|
|
725
|
+
const retVal = get(object, path);
|
|
726
|
+
if (typeof retVal === 'string') {
|
|
727
|
+
return retVal;
|
|
728
|
+
} else if (retVal === undefined) {
|
|
729
|
+
throw new ReferenceError(`Error: color variable '${path}' is not defined`);
|
|
730
|
+
} else {
|
|
731
|
+
throw new TypeError(`Error: unexpected '${typeof retVal}' type for color variable "${path}"`);
|
|
732
|
+
}
|
|
733
|
+
};
|
|
734
|
+
const getColor = memoize(_ref => {
|
|
735
|
+
let {
|
|
736
|
+
dark,
|
|
737
|
+
hue,
|
|
738
|
+
light,
|
|
739
|
+
offset,
|
|
740
|
+
shade,
|
|
741
|
+
theme,
|
|
742
|
+
transparency,
|
|
743
|
+
variable
|
|
744
|
+
} = _ref;
|
|
745
|
+
let retVal;
|
|
746
|
+
const palette = theme.palette && Object.keys(theme.palette).length > 0 ? theme.palette : DEFAULT_THEME.palette;
|
|
747
|
+
const {
|
|
748
|
+
base,
|
|
749
|
+
variables,
|
|
750
|
+
...colors
|
|
751
|
+
} = theme.colors && Object.keys(theme.colors).length > 0 ? theme.colors : DEFAULT_THEME.colors;
|
|
752
|
+
const scheme = base === 'dark' ? 'dark' : 'light';
|
|
753
|
+
const mode = scheme === 'dark' ? dark : light;
|
|
754
|
+
let _hue = mode?.hue || hue;
|
|
755
|
+
let _shade = mode?.shade === undefined ? shade : mode.shade;
|
|
756
|
+
const _offset = mode?.offset === undefined ? offset : mode.offset;
|
|
757
|
+
const _transparency = mode?.transparency === undefined ? transparency : mode.transparency;
|
|
758
|
+
if (variable) {
|
|
759
|
+
const _variables = variables?.[scheme] ? variables[scheme] : DEFAULT_THEME.colors.variables[scheme];
|
|
760
|
+
const property = toProperty(_variables, variable);
|
|
761
|
+
const [key, value] = property.split(/\.(?<value>.*)/u);
|
|
762
|
+
if (key === 'palette') {
|
|
763
|
+
_hue = toProperty(palette, value);
|
|
764
|
+
} else {
|
|
765
|
+
_hue = key;
|
|
766
|
+
_shade = parseInt(value, 10);
|
|
767
|
+
}
|
|
768
|
+
}
|
|
769
|
+
if (_hue) {
|
|
770
|
+
retVal = toColor(colors, palette, scheme, _hue, _shade, _offset, _transparency);
|
|
771
|
+
}
|
|
772
|
+
if (retVal === undefined) {
|
|
773
|
+
throw new Error('Error: invalid `getColor` parameters');
|
|
774
|
+
}
|
|
775
|
+
return retVal;
|
|
776
|
+
}, _ref2 => {
|
|
777
|
+
let {
|
|
778
|
+
dark,
|
|
779
|
+
hue,
|
|
780
|
+
light,
|
|
781
|
+
offset,
|
|
782
|
+
shade,
|
|
783
|
+
theme,
|
|
784
|
+
transparency,
|
|
785
|
+
variable
|
|
786
|
+
} = _ref2;
|
|
787
|
+
return JSON.stringify({
|
|
788
|
+
dark,
|
|
789
|
+
hue,
|
|
790
|
+
light,
|
|
791
|
+
offset,
|
|
792
|
+
shade,
|
|
793
|
+
colors: theme.colors,
|
|
794
|
+
palette: theme.palette,
|
|
795
|
+
transparency,
|
|
796
|
+
variable
|
|
797
|
+
});
|
|
798
|
+
});
|
|
799
|
+
|
|
366
800
|
const DEFAULT_SHADE = 600;
|
|
367
801
|
const adjust = (color, expected, actual) => {
|
|
368
802
|
if (expected !== actual) {
|
|
@@ -371,7 +805,7 @@ const adjust = (color, expected, actual) => {
|
|
|
371
805
|
}
|
|
372
806
|
return color;
|
|
373
807
|
};
|
|
374
|
-
const
|
|
808
|
+
const getColorV8 = memoize(function (hue) {
|
|
375
809
|
let shade = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_SHADE;
|
|
376
810
|
let theme = arguments.length > 2 ? arguments[2] : undefined;
|
|
377
811
|
let transparency = arguments.length > 3 ? arguments[3] : undefined;
|
|
@@ -379,7 +813,17 @@ const getColor = memoize(function (hue) {
|
|
|
379
813
|
if (isNaN(shade)) {
|
|
380
814
|
return undefined;
|
|
381
815
|
}
|
|
382
|
-
const palette =
|
|
816
|
+
const palette = {
|
|
817
|
+
background: PALETTE_V8.white,
|
|
818
|
+
foreground: PALETTE_V8.grey[800],
|
|
819
|
+
...(theme && theme.palette ? {
|
|
820
|
+
...theme.palette,
|
|
821
|
+
...PALETTE_V8
|
|
822
|
+
} : {
|
|
823
|
+
...DEFAULT_THEME.palette,
|
|
824
|
+
...PALETTE_V8
|
|
825
|
+
})
|
|
826
|
+
};
|
|
383
827
|
const colors = theme && theme.colors ? theme.colors : DEFAULT_THEME.colors;
|
|
384
828
|
let _hue;
|
|
385
829
|
if (typeof hue === 'string') {
|
|
@@ -476,12 +920,12 @@ const getFocusBoxShadow = _ref => {
|
|
|
476
920
|
spacerWidth = 'xs',
|
|
477
921
|
theme = DEFAULT_THEME
|
|
478
922
|
} = _ref;
|
|
479
|
-
const color =
|
|
923
|
+
const color = getColorV8(hue, shade, theme);
|
|
480
924
|
const shadow = theme.shadows[shadowWidth](color);
|
|
481
925
|
if (spacerWidth === null) {
|
|
482
926
|
return `${inset ? 'inset' : ''} ${shadow}`;
|
|
483
927
|
}
|
|
484
|
-
const spacerColor =
|
|
928
|
+
const spacerColor = getColorV8(spacerHue, spacerShade, theme);
|
|
485
929
|
const retVal = `
|
|
486
930
|
${inset ? 'inset' : ''} ${theme.shadows[spacerWidth](spacerColor)},
|
|
487
931
|
${inset ? 'inset' : ''} ${shadow}`;
|
|
@@ -672,7 +1116,7 @@ function menuStyles(position) {
|
|
|
672
1116
|
} else {
|
|
673
1117
|
marginProperty = 'margin-right';
|
|
674
1118
|
}
|
|
675
|
-
return css(["position:absolute;z-index:", ";", ":", ";line-height:0;font-size:0.01px;& ", "{display:inline-block;position:relative;margin:0;box-sizing:border-box;border:", " ", ";border-radius:", ";box-shadow:", ";background-color:", ";cursor:default;padding:0;text-align:", ";white-space:normal;font-size:", ";font-weight:", ";direction:", ";:focus{outline:none;}}", ";", ";"], options.zIndex || 0, marginProperty, options.margin, options.childSelector || '> *', theme.borders.sm,
|
|
1119
|
+
return css(["position:absolute;z-index:", ";", ":", ";line-height:0;font-size:0.01px;& ", "{display:inline-block;position:relative;margin:0;box-sizing:border-box;border:", " ", ";border-radius:", ";box-shadow:", ";background-color:", ";cursor:default;padding:0;text-align:", ";white-space:normal;font-size:", ";font-weight:", ";direction:", ";:focus{outline:none;}}", ";", ";"], options.zIndex || 0, marginProperty, options.margin, options.childSelector || '> *', theme.borders.sm, getColorV8('neutralHue', 300, theme), theme.borderRadii.md, theme.shadows.lg(`${theme.space.base * 5}px`, `${theme.space.base * 7.5}px`, getColorV8('chromeHue', 600, theme, 0.15)), getColorV8('background', 600 , theme), theme.rtl ? 'right' : 'left', theme.fontSizes.md, theme.fontWeights.regular, theme.rtl && 'rtl', options.animationModifier && animationStyles(position, options), options.hidden && hiddenStyles(options));
|
|
676
1120
|
}
|
|
677
1121
|
|
|
678
1122
|
const SELECTOR_FOCUS_VISIBLE = '&:focus-visible, &[data-garden-focus-visible="true"]';
|
|
@@ -711,4 +1155,4 @@ const ARROW_POSITION = ['top', 'top-left', 'top-right', 'right', 'right-top', 'r
|
|
|
711
1155
|
const MENU_POSITION = ['top', 'right', 'bottom', 'left'];
|
|
712
1156
|
const PLACEMENT = ['top', 'top-start', 'top-end', 'bottom', 'bottom-start', 'bottom-end', 'end', 'end-top', 'end-bottom', 'start', 'start-top', 'start-bottom'];
|
|
713
1157
|
|
|
714
|
-
export { ARROW_POSITION, DEFAULT_THEME, MENU_POSITION, PALETTE, PLACEMENT, SELECTOR_FOCUS_VISIBLE, ThemeProvider, arrowStyles, focusStyles, getArrowPosition, getColor
|
|
1158
|
+
export { ARROW_POSITION, DEFAULT_THEME, MENU_POSITION, PALETTE, PALETTE_V8, PLACEMENT, SELECTOR_FOCUS_VISIBLE, ThemeProvider, arrowStyles, focusStyles, getArrowPosition, getColor, getColorV8, getFloatingPlacements, getFocusBoxShadow, getLineHeight, getMenuPosition, mediaQuery, menuStyles, retrieveComponentStyles, useDocument, useText, useWindow };
|