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