@zendeskgarden/react-theming 9.0.0-next.5 → 9.0.0-next.7

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