@zendeskgarden/react-theming 8.57.0 → 8.58.0

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
@@ -11,170 +11,22 @@ import { useFocusVisible } from '@zendeskgarden/container-focusvisible';
11
11
  import { getControlledValue } from '@zendeskgarden/container-utilities';
12
12
  import { rgba, darken, lighten, getValueAndUnit, math } from 'polished';
13
13
 
14
- function ownKeys(object, enumerableOnly) {
15
- var keys = Object.keys(object);
16
-
17
- if (Object.getOwnPropertySymbols) {
18
- var symbols = Object.getOwnPropertySymbols(object);
19
- enumerableOnly && (symbols = symbols.filter(function (sym) {
20
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
21
- })), keys.push.apply(keys, symbols);
22
- }
23
-
24
- return keys;
25
- }
26
-
27
- function _objectSpread2(target) {
28
- for (var i = 1; i < arguments.length; i++) {
29
- var source = null != arguments[i] ? arguments[i] : {};
30
- i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
31
- _defineProperty(target, key, source[key]);
32
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
33
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
34
- });
35
- }
36
-
37
- return target;
38
- }
39
-
40
- function _typeof(obj) {
41
- "@babel/helpers - typeof";
42
-
43
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) {
44
- return typeof obj;
45
- } : function (obj) {
46
- return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
47
- }, _typeof(obj);
48
- }
49
-
50
- function _defineProperty(obj, key, value) {
51
- if (key in obj) {
52
- Object.defineProperty(obj, key, {
53
- value: value,
54
- enumerable: true,
55
- configurable: true,
56
- writable: true
57
- });
58
- } else {
59
- obj[key] = value;
60
- }
61
-
62
- return obj;
63
- }
64
-
65
14
  function _extends() {
66
15
  _extends = Object.assign ? Object.assign.bind() : function (target) {
67
16
  for (var i = 1; i < arguments.length; i++) {
68
17
  var source = arguments[i];
69
-
70
18
  for (var key in source) {
71
19
  if (Object.prototype.hasOwnProperty.call(source, key)) {
72
20
  target[key] = source[key];
73
21
  }
74
22
  }
75
23
  }
76
-
77
24
  return target;
78
25
  };
79
26
  return _extends.apply(this, arguments);
80
27
  }
81
28
 
82
- function _objectWithoutPropertiesLoose(source, excluded) {
83
- if (source == null) return {};
84
- var target = {};
85
- var sourceKeys = Object.keys(source);
86
- var key, i;
87
-
88
- for (i = 0; i < sourceKeys.length; i++) {
89
- key = sourceKeys[i];
90
- if (excluded.indexOf(key) >= 0) continue;
91
- target[key] = source[key];
92
- }
93
-
94
- return target;
95
- }
96
-
97
- function _objectWithoutProperties(source, excluded) {
98
- if (source == null) return {};
99
-
100
- var target = _objectWithoutPropertiesLoose(source, excluded);
101
-
102
- var key, i;
103
-
104
- if (Object.getOwnPropertySymbols) {
105
- var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
106
-
107
- for (i = 0; i < sourceSymbolKeys.length; i++) {
108
- key = sourceSymbolKeys[i];
109
- if (excluded.indexOf(key) >= 0) continue;
110
- if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
111
- target[key] = source[key];
112
- }
113
- }
114
-
115
- return target;
116
- }
117
-
118
- function _slicedToArray(arr, i) {
119
- return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
120
- }
121
-
122
- function _arrayWithHoles(arr) {
123
- if (Array.isArray(arr)) return arr;
124
- }
125
-
126
- function _iterableToArrayLimit(arr, i) {
127
- var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
128
-
129
- if (_i == null) return;
130
- var _arr = [];
131
- var _n = true;
132
- var _d = false;
133
-
134
- var _s, _e;
135
-
136
- try {
137
- for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
138
- _arr.push(_s.value);
139
-
140
- if (i && _arr.length === i) break;
141
- }
142
- } catch (err) {
143
- _d = true;
144
- _e = err;
145
- } finally {
146
- try {
147
- if (!_n && _i["return"] != null) _i["return"]();
148
- } finally {
149
- if (_d) throw _e;
150
- }
151
- }
152
-
153
- return _arr;
154
- }
155
-
156
- function _unsupportedIterableToArray(o, minLen) {
157
- if (!o) return;
158
- if (typeof o === "string") return _arrayLikeToArray(o, minLen);
159
- var n = Object.prototype.toString.call(o).slice(8, -1);
160
- if (n === "Object" && o.constructor) n = o.constructor.name;
161
- if (n === "Map" || n === "Set") return Array.from(o);
162
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
163
- }
164
-
165
- function _arrayLikeToArray(arr, len) {
166
- if (len == null || len > arr.length) len = arr.length;
167
-
168
- for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
169
-
170
- return arr2;
171
- }
172
-
173
- function _nonIterableRest() {
174
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
175
- }
176
-
177
- var PALETTE = {
29
+ const PALETTE = {
178
30
  black: '#000',
179
31
  white: '#fff',
180
32
  product: {
@@ -316,30 +168,30 @@ var PALETTE = {
316
168
  }
317
169
  };
318
170
 
319
- var BASE = 4;
320
- var borderRadii = {
321
- sm: "".concat(BASE / 2, "px"),
322
- md: "".concat(BASE, "px")
171
+ const BASE = 4;
172
+ const borderRadii = {
173
+ sm: `${BASE / 2}px`,
174
+ md: `${BASE}px`
323
175
  };
324
- var borderStyles = {
176
+ const borderStyles = {
325
177
  solid: 'solid'
326
178
  };
327
- var borderWidths = {
179
+ const borderWidths = {
328
180
  sm: '1px',
329
181
  md: '3px'
330
182
  };
331
- var borders = {
332
- sm: "".concat(borderWidths.sm, " ").concat(borderStyles.solid),
333
- md: "".concat(borderWidths.md, " ").concat(borderStyles.solid)
183
+ const borders = {
184
+ sm: `${borderWidths.sm} ${borderStyles.solid}`,
185
+ md: `${borderWidths.md} ${borderStyles.solid}`
334
186
  };
335
- var breakpoints = {
187
+ const breakpoints = {
336
188
  xs: '0px',
337
- sm: "".concat(BASE * 144, "px"),
338
- md: "".concat(BASE * 192, "px"),
339
- lg: "".concat(BASE * 248, "px"),
340
- xl: "".concat(BASE * 300, "px")
189
+ sm: `${BASE * 144}px`,
190
+ md: `${BASE * 192}px`,
191
+ lg: `${BASE * 248}px`,
192
+ xl: `${BASE * 300}px`
341
193
  };
342
- var colors = {
194
+ const colors = {
343
195
  background: PALETTE.white,
344
196
  foreground: PALETTE.grey[800],
345
197
  primaryHue: 'blue',
@@ -349,22 +201,11 @@ var colors = {
349
201
  neutralHue: 'grey',
350
202
  chromeHue: 'kale'
351
203
  };
352
- var fonts = {
353
- mono: ['SFMono-Regular'
354
- , 'Consolas'
355
- , '"Liberation Mono"'
356
- , 'Menlo', 'Courier', 'monospace'].join(','),
357
- system: ['system-ui'
358
- , '-apple-system'
359
- , 'BlinkMacSystemFont'
360
- , '"Segoe UI"'
361
- , 'Roboto'
362
- , 'Oxygen-Sans'
363
- , 'Ubuntu'
364
- , 'Cantarell'
365
- , '"Helvetica Neue"', 'Arial', 'sans-serif'].join(',')
204
+ const fonts = {
205
+ mono: ['SFMono-Regular' , 'Consolas' , '"Liberation Mono"' , 'Menlo', 'Courier', 'monospace'].join(','),
206
+ system: ['system-ui' , '-apple-system' , 'BlinkMacSystemFont' , '"Segoe UI"' , 'Roboto' , 'Oxygen-Sans' , 'Ubuntu' , 'Cantarell' , '"Helvetica Neue"', 'Arial', 'sans-serif'].join(',')
366
207
  };
367
- var fontSizes = {
208
+ const fontSizes = {
368
209
  xs: '10px',
369
210
  sm: '12px',
370
211
  md: '14px',
@@ -373,7 +214,7 @@ var fontSizes = {
373
214
  xxl: '26px',
374
215
  xxxl: '36px'
375
216
  };
376
- var fontWeights = {
217
+ const fontWeights = {
377
218
  thin: 100,
378
219
  extralight: 200,
379
220
  light: 300,
@@ -384,74 +225,68 @@ var fontWeights = {
384
225
  extrabold: 800,
385
226
  black: 900
386
227
  };
387
- var iconSizes = {
228
+ const iconSizes = {
388
229
  sm: '12px',
389
230
  md: '16px',
390
231
  lg: '26px'
391
232
  };
392
- var lineHeights = {
393
- sm: "".concat(BASE * 4, "px"),
394
- md: "".concat(BASE * 5, "px"),
395
- lg: "".concat(BASE * 6, "px"),
396
- xl: "".concat(BASE * 7, "px"),
397
- xxl: "".concat(BASE * 8, "px"),
398
- xxxl: "".concat(BASE * 11, "px")
233
+ const lineHeights = {
234
+ sm: `${BASE * 4}px`,
235
+ md: `${BASE * 5}px`,
236
+ lg: `${BASE * 6}px`,
237
+ xl: `${BASE * 7}px`,
238
+ xxl: `${BASE * 8}px`,
239
+ xxxl: `${BASE * 11}px`
240
+ };
241
+ const palette = {
242
+ ...PALETTE
399
243
  };
400
- var palette = _objectSpread2({}, PALETTE);
401
244
  delete palette.product;
402
- var shadowWidths = {
245
+ const shadowWidths = {
403
246
  sm: '2px',
404
247
  md: '3px'
405
248
  };
406
- var shadows = {
407
- sm: function sm(color) {
408
- return "0 0 0 ".concat(shadowWidths.sm, " ").concat(color);
409
- },
410
- md: function md(color) {
411
- return "0 0 0 ".concat(shadowWidths.md, " ").concat(color);
412
- },
413
- lg: function lg(offsetY, blurRadius, color) {
414
- return "0 ".concat(offsetY, " ").concat(blurRadius, " 0 ").concat(color);
415
- }
249
+ const shadows = {
250
+ sm: color => `0 0 0 ${shadowWidths.sm} ${color}`,
251
+ md: color => `0 0 0 ${shadowWidths.md} ${color}`,
252
+ lg: (offsetY, blurRadius, color) => `0 ${offsetY} ${blurRadius} 0 ${color}`
416
253
  };
417
- var space = {
254
+ const space = {
418
255
  base: BASE,
419
- xxs: "".concat(BASE, "px"),
420
- xs: "".concat(BASE * 2, "px"),
421
- sm: "".concat(BASE * 3, "px"),
422
- md: "".concat(BASE * 5, "px"),
423
- lg: "".concat(BASE * 8, "px"),
424
- xl: "".concat(BASE * 10, "px"),
425
- xxl: "".concat(BASE * 12, "px")
256
+ xxs: `${BASE}px`,
257
+ xs: `${BASE * 2}px`,
258
+ sm: `${BASE * 3}px`,
259
+ md: `${BASE * 5}px`,
260
+ lg: `${BASE * 8}px`,
261
+ xl: `${BASE * 10}px`,
262
+ xxl: `${BASE * 12}px`
426
263
  };
427
- var DEFAULT_THEME = {
428
- borders: borders,
429
- borderRadii: borderRadii,
430
- borderStyles: borderStyles,
431
- borderWidths: borderWidths,
432
- breakpoints: breakpoints,
433
- colors: _objectSpread2({
434
- base: 'light'
435
- }, colors),
264
+ const DEFAULT_THEME = {
265
+ borders,
266
+ borderRadii,
267
+ borderStyles,
268
+ borderWidths,
269
+ breakpoints,
270
+ colors: {
271
+ base: 'light',
272
+ ...colors
273
+ },
436
274
  components: {},
437
- fonts: fonts,
438
- fontSizes: fontSizes,
439
- fontWeights: fontWeights,
440
- iconSizes: iconSizes,
441
- lineHeights: lineHeights,
442
- palette: palette,
275
+ fonts,
276
+ fontSizes,
277
+ fontWeights,
278
+ iconSizes,
279
+ lineHeights,
280
+ palette,
443
281
  rtl: false,
444
- shadowWidths: shadowWidths,
445
- shadows: shadows,
446
- space: space
282
+ shadowWidths,
283
+ shadows,
284
+ space
447
285
  };
448
286
 
449
- var useDocument = function useDocument(theme) {
450
- var _useState = useState(),
451
- _useState2 = _slicedToArray(_useState, 2),
452
- controlledDocument = _useState2[0],
453
- setControlledDocument = _useState2[1];
454
- useEffect(function () {
287
+ const useDocument = theme => {
288
+ const [controlledDocument, setControlledDocument] = useState();
289
+ useEffect(() => {
455
290
  if (theme && theme.document) {
456
291
  setControlledDocument(theme.document);
457
292
  } else {
@@ -461,18 +296,19 @@ var useDocument = function useDocument(theme) {
461
296
  return controlledDocument;
462
297
  };
463
298
 
464
- var _excluded = ["theme", "focusVisibleRef", "children"];
465
- var ThemeProvider = function ThemeProvider(_ref) {
466
- var theme = _ref.theme,
467
- focusVisibleRef = _ref.focusVisibleRef,
468
- children = _ref.children,
469
- other = _objectWithoutProperties(_ref, _excluded);
470
- var scopeRef = useRef(null);
471
- var relativeDocument = useDocument(theme);
472
- var controlledScopeRef = focusVisibleRef === null ? React.createRef() : getControlledValue(focusVisibleRef, scopeRef);
299
+ const ThemeProvider = _ref => {
300
+ let {
301
+ theme,
302
+ focusVisibleRef,
303
+ children,
304
+ ...other
305
+ } = _ref;
306
+ const scopeRef = useRef(null);
307
+ const relativeDocument = useDocument(theme);
308
+ const controlledScopeRef = focusVisibleRef === null ? React.createRef() : getControlledValue(focusVisibleRef, scopeRef);
473
309
  useFocusVisible({
474
310
  scope: controlledScopeRef,
475
- relativeDocument: relativeDocument
311
+ relativeDocument
476
312
  });
477
313
  return React.createElement(ThemeProvider$1, _extends({
478
314
  theme: theme
@@ -485,17 +321,18 @@ ThemeProvider.defaultProps = {
485
321
  };
486
322
 
487
323
  function isRtl() {
488
- var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
489
- theme = _ref.theme;
324
+ let {
325
+ theme
326
+ } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
490
327
  return Boolean(theme && theme.rtl);
491
328
  }
492
329
 
493
330
  function retrieveComponentStyles(componentId, props) {
494
- var components = props.theme && props.theme.components;
331
+ const components = props.theme && props.theme.components;
495
332
  if (!components) {
496
333
  return undefined;
497
334
  }
498
- var componentStyles = components[componentId];
335
+ const componentStyles = components[componentId];
499
336
  if (typeof componentStyles === 'function') {
500
337
  return componentStyles(props);
501
338
  }
@@ -507,30 +344,31 @@ function withTheme(WrappedComponent) {
507
344
  }
508
345
 
509
346
  function getDocument() {
510
- var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
511
- theme = _ref.theme;
347
+ let {
348
+ theme
349
+ } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
512
350
  return theme && theme.document || document;
513
351
  }
514
352
 
515
- var DEFAULT_SHADE = 600;
516
- var adjust = function adjust(color, expected, actual) {
353
+ const DEFAULT_SHADE = 600;
354
+ const adjust = (color, expected, actual) => {
517
355
  if (expected !== actual) {
518
- var amount = Math.abs(expected - actual) / 100 * 0.05;
356
+ const amount = Math.abs(expected - actual) / 100 * 0.05;
519
357
  return expected > actual ? darken(amount, color) : lighten(amount, color);
520
358
  }
521
359
  return color;
522
360
  };
523
361
  function getColor(hue) {
524
- var shade = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_SHADE;
525
- var theme = arguments.length > 2 ? arguments[2] : undefined;
526
- var transparency = arguments.length > 3 ? arguments[3] : undefined;
527
- var retVal;
362
+ let shade = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_SHADE;
363
+ let theme = arguments.length > 2 ? arguments[2] : undefined;
364
+ let transparency = arguments.length > 3 ? arguments[3] : undefined;
365
+ let retVal;
528
366
  if (isNaN(shade)) {
529
367
  return undefined;
530
368
  }
531
- var palette = theme && theme.palette ? theme.palette : DEFAULT_THEME.palette;
532
- var colors = theme && theme.colors ? theme.colors : DEFAULT_THEME.colors;
533
- var _hue;
369
+ const palette = theme && theme.palette ? theme.palette : DEFAULT_THEME.palette;
370
+ const colors = theme && theme.colors ? theme.colors : DEFAULT_THEME.colors;
371
+ let _hue;
534
372
  if (typeof hue === 'string') {
535
373
  _hue = colors[hue] || hue;
536
374
  } else {
@@ -539,12 +377,10 @@ function getColor(hue) {
539
377
  if (Object.prototype.hasOwnProperty.call(palette, _hue)) {
540
378
  _hue = palette[_hue];
541
379
  }
542
- if (_typeof(_hue) === 'object') {
380
+ if (typeof _hue === 'object') {
543
381
  retVal = _hue[shade];
544
382
  if (!retVal) {
545
- var _shade = Object.keys(_hue).map(function (hueKey) {
546
- return parseInt(hueKey, 10);
547
- }).reduce(function (previous, current) {
383
+ const _shade = Object.keys(_hue).map(hueKey => parseInt(hueKey, 10)).reduce((previous, current) => {
548
384
  return Math.abs(current - shade) < Math.abs(previous - shade) ? current : previous;
549
385
  });
550
386
  retVal = adjust(_hue[_shade], shade, _shade);
@@ -559,40 +395,34 @@ function getColor(hue) {
559
395
  }
560
396
 
561
397
  function getLineHeight(height, fontSize) {
562
- var _getValueAndUnit = getValueAndUnit(height.toString()),
563
- _getValueAndUnit2 = _slicedToArray(_getValueAndUnit, 2),
564
- heightValue = _getValueAndUnit2[0],
565
- heightUnit = _getValueAndUnit2[1];
566
- var _getValueAndUnit3 = getValueAndUnit(fontSize.toString()),
567
- _getValueAndUnit4 = _slicedToArray(_getValueAndUnit3, 2),
568
- fontSizeValue = _getValueAndUnit4[0],
569
- fontSizeUnit = _getValueAndUnit4[1];
570
- var PIXELS = 'px';
398
+ const [heightValue, heightUnit] = getValueAndUnit(height.toString());
399
+ const [fontSizeValue, fontSizeUnit] = getValueAndUnit(fontSize.toString());
400
+ const PIXELS = 'px';
571
401
  if (heightUnit && heightUnit !== PIXELS) {
572
- throw new Error("Unexpected `height` with '".concat(heightUnit, "' units."));
402
+ throw new Error(`Unexpected \`height\` with '${heightUnit}' units.`);
573
403
  }
574
404
  if (fontSizeUnit && fontSizeUnit !== PIXELS) {
575
- throw new Error("Unexpected `fontSize` with '".concat(fontSizeUnit, "' units."));
405
+ throw new Error(`Unexpected \`fontSize\` with '${fontSizeUnit}' units.`);
576
406
  }
577
407
  return heightValue / fontSizeValue;
578
408
  }
579
409
 
580
- var maxWidth = function maxWidth(breakpoints, breakpoint) {
581
- var keys = Object.keys(breakpoints);
582
- var index = keys.indexOf(breakpoint) + 1;
410
+ const maxWidth = (breakpoints, breakpoint) => {
411
+ const keys = Object.keys(breakpoints);
412
+ const index = keys.indexOf(breakpoint) + 1;
583
413
  if (keys[index]) {
584
- var dimension = getValueAndUnit(breakpoints[keys[index]]);
585
- var value = dimension[0] - 0.02;
586
- var unit = dimension[1];
587
- return "".concat(value).concat(unit);
414
+ const dimension = getValueAndUnit(breakpoints[keys[index]]);
415
+ const value = dimension[0] - 0.02;
416
+ const unit = dimension[1];
417
+ return `${value}${unit}`;
588
418
  }
589
419
  return undefined;
590
420
  };
591
421
  function mediaQuery(query, breakpoint, theme) {
592
- var retVal;
593
- var min;
594
- var max;
595
- var breakpoints = theme && theme.breakpoints ? theme.breakpoints : DEFAULT_THEME.breakpoints;
422
+ let retVal;
423
+ let min;
424
+ let max;
425
+ const breakpoints = theme && theme.breakpoints ? theme.breakpoints : DEFAULT_THEME.breakpoints;
596
426
  if (typeof breakpoint === 'string') {
597
427
  if (query === 'up') {
598
428
  min = breakpoints[breakpoint];
@@ -611,26 +441,24 @@ function mediaQuery(query, breakpoint, theme) {
611
441
  max = maxWidth(breakpoints, breakpoint[1]);
612
442
  }
613
443
  if (min) {
614
- retVal = "@media (min-width: ".concat(min, ")");
444
+ retVal = `@media (min-width: ${min})`;
615
445
  if (max) {
616
- retVal = "".concat(retVal, " and (max-width: ").concat(max, ")");
446
+ retVal = `${retVal} and (max-width: ${max})`;
617
447
  }
618
448
  } else if (max) {
619
- retVal = "@media (max-width: ".concat(max, ")");
449
+ retVal = `@media (max-width: ${max})`;
620
450
  } else {
621
- throw new Error("Unexpected query and breakpoint combination: '".concat(query, "', '").concat(breakpoint, "'."));
451
+ throw new Error(`Unexpected query and breakpoint combination: '${query}', '${breakpoint}'.`);
622
452
  }
623
453
  return retVal;
624
454
  }
625
455
 
626
- var exponentialSymbols = {
456
+ const exponentialSymbols = {
627
457
  symbols: {
628
458
  sqrt: {
629
459
  func: {
630
460
  symbol: 'sqrt',
631
- f: function f(a) {
632
- return Math.sqrt(a);
633
- },
461
+ f: a => Math.sqrt(a),
634
462
  notation: 'func',
635
463
  precedence: 0,
636
464
  rightToLeft: 0,
@@ -641,17 +469,17 @@ var exponentialSymbols = {
641
469
  }
642
470
  }
643
471
  };
644
- var animationStyles$1 = function animationStyles(position, modifier) {
645
- var property = position.split('-')[0];
646
- var animationName = keyframes(["0%,66%{", ":2px;border:transparent;}"], property);
472
+ const animationStyles$1 = (position, modifier) => {
473
+ const property = position.split('-')[0];
474
+ const animationName = keyframes(["0%,66%{", ":2px;border:transparent;}"], property);
647
475
  return css(["&", "::before,&", "::after{animation:0.3s ease-in-out ", ";}"], modifier, modifier, animationName);
648
476
  };
649
- var positionStyles = function positionStyles(position, size, inset) {
650
- var margin = math("".concat(size, " / -2"));
651
- var placement = math("".concat(margin, " + ").concat(inset));
652
- var clipPath;
653
- var positionCss;
654
- var propertyRadius;
477
+ const positionStyles = (position, size, inset) => {
478
+ const margin = math(`${size} / -2`);
479
+ const placement = math(`${margin} + ${inset}`);
480
+ let clipPath;
481
+ let positionCss;
482
+ let propertyRadius;
655
483
  if (position.startsWith('top')) {
656
484
  propertyRadius = 'border-bottom-right-radius';
657
485
  clipPath = 'polygon(100% 0, 100% 1px, 1px 100%, 0 100%, 0 0)';
@@ -672,23 +500,23 @@ var positionStyles = function positionStyles(position, size, inset) {
672
500
  return css(["&::before{", ":100%;clip-path:", ";}&::before,&::after{", "}"], propertyRadius, clipPath, positionCss);
673
501
  };
674
502
  function arrowStyles(position) {
675
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
676
- var size = options.size || '6px';
677
- var inset = options.inset || '0';
678
- var squareSize = math("".concat(size, " * 2 / sqrt(2)"), exponentialSymbols);
503
+ let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
504
+ const size = options.size || '6px';
505
+ const inset = options.inset || '0';
506
+ const squareSize = math(`${size} * 2 / sqrt(2)`, exponentialSymbols);
679
507
  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));
680
508
  }
681
509
 
682
- var useText = function useText(component, props, name, text) {
683
- var value = props[name];
684
- return useMemo(function () {
510
+ const useText = (component, props, name, text) => {
511
+ const value = props[name];
512
+ return useMemo(() => {
685
513
  if (name === 'children') {
686
514
  throw new Error('Error: `children` is not a valid `getText` prop.');
687
515
  } else if (value === null || value === '') {
688
- throw new Error(component.displayName ? "Error: you must provide a valid `".concat(name, "` text value for <").concat(component.displayName, ">.") : "Error: you must provide a valid `".concat(name, "` text value."));
516
+ throw new Error(component.displayName ? `Error: you must provide a valid \`${name}\` text value for <${component.displayName}>.` : `Error: you must provide a valid \`${name}\` text value.`);
689
517
  } else if (value === undefined) {
690
518
  if (process.env.NODE_ENV === 'development') {
691
- console.warn(component.displayName ? "Warning: you did not provide a customized/translated `".concat(name, "` text value for <").concat(component.displayName, ">. Zendesk Garden is rendering <").concat(component.displayName, " ").concat(name, "=\"").concat(text, "\"> by default.") : "Warning: you did not provide a customized/translated `".concat(name, "` text value. Zendesk Garden is rendering ").concat(name, "=\"").concat(text, "\" by default."));
519
+ console.warn(component.displayName ? `Warning: you did not provide a customized/translated \`${name}\` text value for <${component.displayName}>. Zendesk Garden is rendering <${component.displayName} ${name}="${text}"> by default.` : `Warning: you did not provide a customized/translated \`${name}\` text value. Zendesk Garden is rendering ${name}="${text}" by default.`);
692
520
  }
693
521
  return text;
694
522
  }
@@ -696,32 +524,32 @@ var useText = function useText(component, props, name, text) {
696
524
  }, [component.displayName, value, name, text]);
697
525
  };
698
526
 
699
- var animationStyles = function animationStyles(position, options) {
700
- var theme = options.theme || DEFAULT_THEME;
701
- var translateValue = "".concat(theme.space.base * 5, "px");
702
- var transformFunction;
527
+ const animationStyles = (position, options) => {
528
+ const theme = options.theme || DEFAULT_THEME;
529
+ let translateValue = `${theme.space.base * 5}px`;
530
+ let transformFunction;
703
531
  if (position === 'top') {
704
532
  transformFunction = 'translateY';
705
533
  } else if (position === 'right') {
706
534
  transformFunction = 'translateX';
707
- translateValue = "-".concat(translateValue);
535
+ translateValue = `-${translateValue}`;
708
536
  } else if (position === 'bottom') {
709
537
  transformFunction = 'translateY';
710
- translateValue = "-".concat(translateValue);
538
+ translateValue = `-${translateValue}`;
711
539
  } else {
712
540
  transformFunction = 'translateX';
713
541
  }
714
- var animationName = keyframes(["0%{transform:", "(", ");}"], transformFunction, translateValue);
542
+ const animationName = keyframes(["0%{transform:", "(", ");}"], transformFunction, translateValue);
715
543
  return css(["&", " ", "{animation:0.2s cubic-bezier(0.15,0.85,0.35,1.2) ", ";}"], options.animationModifier, options.childSelector || '> *', animationName);
716
544
  };
717
- var hiddenStyles = function hiddenStyles(options) {
718
- var transition = 'opacity 0.2s ease-in-out, 0.2s visibility 0s linear';
545
+ const hiddenStyles = options => {
546
+ const transition = 'opacity 0.2s ease-in-out, 0.2s visibility 0s linear';
719
547
  return css(["transition:", ";visibility:hidden;opacity:0;"], options.animationModifier && transition);
720
548
  };
721
549
  function menuStyles(position) {
722
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
723
- var theme = options.theme || DEFAULT_THEME;
724
- var marginProperty;
550
+ let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
551
+ const theme = options.theme || DEFAULT_THEME;
552
+ let marginProperty;
725
553
  if (position === 'top') {
726
554
  marginProperty = 'margin-bottom';
727
555
  } else if (position === 'right') {
@@ -731,10 +559,10 @@ function menuStyles(position) {
731
559
  } else {
732
560
  marginProperty = 'margin-right';
733
561
  }
734
- 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("".concat(theme.space.base * 5, "px"), "".concat(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));
562
+ 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));
735
563
  }
736
564
 
737
- var ARROW_POSITION = ['top', 'top-left', 'top-right', 'right', 'right-top', 'right-bottom', 'bottom', 'bottom-left', 'bottom-right', 'left', 'left-top', 'left-bottom'];
738
- var MENU_POSITION = ['top', 'right', 'bottom', 'left'];
565
+ const ARROW_POSITION = ['top', 'top-left', 'top-right', 'right', 'right-top', 'right-bottom', 'bottom', 'bottom-left', 'bottom-right', 'left', 'left-top', 'left-bottom'];
566
+ const MENU_POSITION = ['top', 'right', 'bottom', 'left'];
739
567
 
740
568
  export { ARROW_POSITION as ARRAY_ARROW_POSITION, MENU_POSITION as ARRAY_MENU_POSITION, DEFAULT_THEME, PALETTE, ThemeProvider, arrowStyles, getColor, getDocument, getLineHeight, isRtl, mediaQuery, menuStyles, retrieveComponentStyles, retrieveComponentStyles as retrieveTheme, useDocument, useText, withTheme };