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