@zendeskgarden/react-theming 9.12.2 → 9.12.4

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.
@@ -7,15 +7,15 @@
7
7
  import React, { createContext, useMemo, useEffect, useCallback, useState } from 'react';
8
8
  import PropTypes from 'prop-types';
9
9
 
10
- const mediaQuery = typeof window === 'undefined' ? undefined : window.matchMedia('(prefers-color-scheme: dark)');
11
- const useColorScheme = (initialState, colorSchemeKey) => {
10
+ const mediaQuery$1 = typeof window === 'undefined' ? undefined : window.matchMedia('(prefers-color-scheme: dark)');
11
+ const useColorScheme$1 = (initialState, colorSchemeKey) => {
12
12
  const localStorage =
13
13
  typeof window === 'undefined' || colorSchemeKey === null ? undefined : window.localStorage;
14
14
  const getState = useCallback(_state => {
15
15
  const isSystem = _state === 'system' || _state === undefined || _state === null;
16
16
  let colorScheme;
17
17
  if (isSystem) {
18
- colorScheme = mediaQuery?.matches ? 'dark' : 'light';
18
+ colorScheme = mediaQuery$1?.matches ? 'dark' : 'light';
19
19
  } else {
20
20
  colorScheme = _state;
21
21
  }
@@ -35,17 +35,16 @@ const useColorScheme = (initialState, colorSchemeKey) => {
35
35
  };
36
36
  };
37
37
  const ColorSchemeContext = createContext(undefined);
38
- const ColorSchemeProvider = _ref => {
39
- let {
40
- children,
41
- colorSchemeKey = 'color-scheme',
42
- initialColorScheme = 'system'
43
- } = _ref;
38
+ const ColorSchemeProvider = ({
39
+ children,
40
+ colorSchemeKey = 'color-scheme',
41
+ initialColorScheme = 'system'
42
+ }) => {
44
43
  const {
45
44
  isSystem,
46
45
  colorScheme,
47
46
  setColorScheme
48
- } = useColorScheme(initialColorScheme, colorSchemeKey);
47
+ } = useColorScheme$1(initialColorScheme, colorSchemeKey);
49
48
  const contextValue = useMemo(() => ({
50
49
  colorScheme,
51
50
  isSystem,
@@ -56,12 +55,12 @@ const ColorSchemeProvider = _ref => {
56
55
  setColorScheme('system');
57
56
  };
58
57
  if (isSystem) {
59
- mediaQuery?.addEventListener('change', eventListener);
58
+ mediaQuery$1?.addEventListener('change', eventListener);
60
59
  } else {
61
- mediaQuery?.removeEventListener('change', eventListener);
60
+ mediaQuery$1?.removeEventListener('change', eventListener);
62
61
  }
63
62
  return () => {
64
- mediaQuery?.removeEventListener('change', eventListener);
63
+ mediaQuery$1?.removeEventListener('change', eventListener);
65
64
  };
66
65
  }, [isSystem, setColorScheme]);
67
66
  return React.createElement(ColorSchemeContext.Provider, {
@@ -8,14 +8,11 @@ import React from 'react';
8
8
  import { ThemeProvider as ThemeProvider$1 } from 'styled-components';
9
9
  import DEFAULT_THEME from './theme/index.js';
10
10
 
11
- const ThemeProvider = _ref => {
12
- let {
13
- theme = DEFAULT_THEME,
14
- ...other
15
- } = _ref;
16
- return React.createElement(ThemeProvider$1, Object.assign({
17
- theme: theme
18
- }, other));
19
- };
11
+ const ThemeProvider = ({
12
+ theme = DEFAULT_THEME,
13
+ ...other
14
+ }) => React.createElement(ThemeProvider$1, Object.assign({
15
+ theme: theme
16
+ }, other));
20
17
 
21
18
  export { ThemeProvider };
@@ -8,14 +8,11 @@ import styled from 'styled-components';
8
8
  import { cloneElement, Children } from 'react';
9
9
 
10
10
  const StyledBaseIcon = styled(
11
- _ref => {
12
- let {
13
- children,
14
- theme,
15
- ...props
16
- } = _ref;
17
- return cloneElement(Children.only(children), props);
18
- }).withConfig({
11
+ ({
12
+ children,
13
+ theme,
14
+ ...props
15
+ }) => cloneElement(Children.only(children), props)).withConfig({
19
16
  displayName: "StyledBaseIcon",
20
17
  componentId: "sc-1moykgb-0"
21
18
  })([""]);
@@ -7,7 +7,7 @@
7
7
  import { css, keyframes } from 'styled-components';
8
8
  import { stripUnit } from 'polished';
9
9
 
10
- const animationStyles = (position, modifier) => {
10
+ const animationStyles$1 = (position, modifier) => {
11
11
  const property = position.split('-')[0];
12
12
  const animationName = keyframes(["0%,66%{", ":2px;border:transparent;}"], property);
13
13
  return css(["&", "::before,&", "::after{animation:0.3s ease-in-out ", ";}"], modifier, modifier, animationName);
@@ -36,8 +36,7 @@ const positionStyles = (position, size, inset, shift) => {
36
36
  }
37
37
  return css(["&::before,&::after{transform:", ";", ";}"], transform, positionCss);
38
38
  };
39
- function arrowStyles(position) {
40
- let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
39
+ function arrowStyles(position, options = {}) {
41
40
  const inset = stripUnit(options.inset || '0');
42
41
  const size = stripUnit(options.size || '6');
43
42
  const shift = stripUnit(options.shift || '0');
@@ -47,7 +46,7 @@ function arrowStyles(position) {
47
46
  const squareSizePx = `${squareSizeRounded}px`;
48
47
  const afterOffset = 0;
49
48
  const beforeOffset = afterOffset + 2;
50
- return css(["position:relative;&::before,&::after{position:absolute;border-width:inherit;border-style:inherit;background-color:inherit;width:", ";height:", ";content:'';box-sizing:inherit;}&::before{border-color:inherit;clip-path:polygon(100% ", "px,", "px 100%,100% 100%);}&::after{border-color:transparent;background-clip:content-box;clip-path:polygon(100% ", "px,", "px 100%,100% 100%);}", ";", ";"], squareSizePx, squareSizePx, beforeOffset, beforeOffset, afterOffset, afterOffset, positionStyles(position, squareSizeRounded, inset, shift), options.animationModifier && animationStyles(position, options.animationModifier));
49
+ return css(["position:relative;&::before,&::after{position:absolute;border-width:inherit;border-style:inherit;background-color:inherit;width:", ";height:", ";content:'';box-sizing:inherit;}&::before{border-color:inherit;clip-path:polygon(100% ", "px,", "px 100%,100% 100%);}&::after{border-color:transparent;background-clip:content-box;clip-path:polygon(100% ", "px,", "px 100%,100% 100%);}", ";", ";"], squareSizePx, squareSizePx, beforeOffset, beforeOffset, afterOffset, afterOffset, positionStyles(position, squareSizeRounded, inset, shift), options.animationModifier && animationStyles$1(position, options.animationModifier));
51
50
  }
52
51
 
53
52
  export { arrowStyles as default };
@@ -9,19 +9,18 @@ import { math } from 'polished';
9
9
  import { getFocusBoxShadow } from './getFocusBoxShadow.js';
10
10
 
11
11
  const SELECTOR_FOCUS_VISIBLE = '&:focus-visible';
12
- const focusStyles = _ref => {
13
- let {
14
- condition = true,
15
- selector = SELECTOR_FOCUS_VISIBLE,
16
- shadowWidth = 'md',
17
- spacerWidth = 'xs',
18
- styles: {
19
- boxShadow,
20
- ...styles
21
- } = {},
22
- theme,
23
- ...options
24
- } = _ref;
12
+ const focusStyles = ({
13
+ condition = true,
14
+ selector = SELECTOR_FOCUS_VISIBLE,
15
+ shadowWidth = 'md',
16
+ spacerWidth = 'xs',
17
+ styles: {
18
+ boxShadow,
19
+ ...styles
20
+ } = {},
21
+ theme,
22
+ ...options
23
+ }) => {
25
24
  const _boxShadow = condition ? getFocusBoxShadow({
26
25
  boxShadow,
27
26
  shadowWidth,
@@ -6,14 +6,13 @@
6
6
  */
7
7
  import { getColor } from './getColor.js';
8
8
 
9
- const getCheckeredBackground = _ref => {
10
- let {
11
- theme,
12
- size,
13
- overlay,
14
- positionY = 0,
15
- repeat = 'repeat'
16
- } = _ref;
9
+ const getCheckeredBackground = ({
10
+ theme,
11
+ size,
12
+ overlay,
13
+ positionY = 0,
14
+ repeat = 'repeat'
15
+ }) => {
17
16
  const color = getColor({
18
17
  theme,
19
18
  variable: 'border.default'
@@ -10,7 +10,7 @@ import get from 'lodash.get';
10
10
  import memoize from 'lodash.memoize';
11
11
  import DEFAULT_THEME from '../elements/theme/index.js';
12
12
 
13
- const adjust = (color, expected, actual) => {
13
+ const adjust$1 = (color, expected, actual) => {
14
14
  if (expected !== actual) {
15
15
  const amount = Math.abs(expected - actual) / 100 * 0.05;
16
16
  return expected > actual ? darken(amount, color) : lighten(amount, color);
@@ -37,7 +37,7 @@ const toHex = (hue, shade, offset, transparency, scheme) => {
37
37
  const closestShade = Object.keys(hue).map(hueShade => parseInt(hueShade, 10)).reduce((previous, current) => {
38
38
  return Math.abs(current - _shade) < Math.abs(previous - _shade) ? current : previous;
39
39
  });
40
- retVal = adjust(hue[closestShade], _shade, closestShade);
40
+ retVal = adjust$1(hue[closestShade], _shade, closestShade);
41
41
  }
42
42
  return retVal;
43
43
  };
@@ -52,8 +52,7 @@ const isValidColor = maybeColor => {
52
52
  }
53
53
  return retVal;
54
54
  };
55
- function findNearestIndex(target, arr) {
56
- let startIndex = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
55
+ function findNearestIndex(target, arr, startIndex = 0) {
57
56
  if (typeof target !== 'number' || isNaN(target)) {
58
57
  throw new Error('Target must be a number.');
59
58
  }
@@ -183,48 +182,47 @@ const fromVariable = (variable, variables, palette) => {
183
182
  }
184
183
  return retVal;
185
184
  };
186
- const CACHE = new WeakMap();
187
- const KEYS = {
185
+ const CACHE$1 = new WeakMap();
186
+ const KEYS$1 = {
188
187
  colors: 0,
189
188
  palette: 0,
190
189
  opacity: 0
191
190
  };
192
- CACHE.set(DEFAULT_THEME.colors, KEYS.colors);
193
- CACHE.set(DEFAULT_THEME.palette, KEYS.palette);
194
- CACHE.set(DEFAULT_THEME.opacity, KEYS.opacity);
195
- const toKey = _ref => {
196
- let {
197
- dark,
198
- hue,
199
- light,
200
- offset,
201
- shade,
202
- theme,
203
- transparency,
204
- variable
205
- } = _ref;
191
+ CACHE$1.set(DEFAULT_THEME.colors, KEYS$1.colors);
192
+ CACHE$1.set(DEFAULT_THEME.palette, KEYS$1.palette);
193
+ CACHE$1.set(DEFAULT_THEME.opacity, KEYS$1.opacity);
194
+ const toKey$1 = ({
195
+ dark,
196
+ hue,
197
+ light,
198
+ offset,
199
+ shade,
200
+ theme,
201
+ transparency,
202
+ variable
203
+ }) => {
206
204
  let themeColorsKey;
207
205
  if (theme.colors) {
208
- themeColorsKey = CACHE.get(theme.colors);
206
+ themeColorsKey = CACHE$1.get(theme.colors);
209
207
  if (themeColorsKey === undefined) {
210
- themeColorsKey = ++KEYS.colors;
211
- CACHE.set(theme.colors, themeColorsKey);
208
+ themeColorsKey = ++KEYS$1.colors;
209
+ CACHE$1.set(theme.colors, themeColorsKey);
212
210
  }
213
211
  }
214
212
  let themeOpacityKey;
215
213
  if (theme.opacity) {
216
- themeOpacityKey = CACHE.get(theme.opacity);
214
+ themeOpacityKey = CACHE$1.get(theme.opacity);
217
215
  if (themeOpacityKey === undefined) {
218
- themeOpacityKey = ++KEYS.opacity;
219
- CACHE.set(theme.opacity, themeOpacityKey);
216
+ themeOpacityKey = ++KEYS$1.opacity;
217
+ CACHE$1.set(theme.opacity, themeOpacityKey);
220
218
  }
221
219
  }
222
220
  let themePaletteKey;
223
221
  if (theme.palette) {
224
- themePaletteKey = CACHE.get(theme.palette);
222
+ themePaletteKey = CACHE$1.get(theme.palette);
225
223
  if (themePaletteKey === undefined) {
226
- themePaletteKey = ++KEYS.palette;
227
- CACHE.set(theme.palette, themePaletteKey);
224
+ themePaletteKey = ++KEYS$1.palette;
225
+ CACHE$1.set(theme.palette, themePaletteKey);
228
226
  }
229
227
  }
230
228
  let retVal = `{${themeColorsKey},${themePaletteKey},${themeOpacityKey}}`;
@@ -251,17 +249,16 @@ const toKey = _ref => {
251
249
  }
252
250
  return retVal;
253
251
  };
254
- const getColor = memoize(_ref2 => {
255
- let {
256
- dark,
257
- hue,
258
- light,
259
- offset,
260
- shade,
261
- theme,
262
- transparency,
263
- variable
264
- } = _ref2;
252
+ const getColor = memoize(({
253
+ dark,
254
+ hue,
255
+ light,
256
+ offset,
257
+ shade,
258
+ theme,
259
+ transparency,
260
+ variable
261
+ }) => {
265
262
  let retVal;
266
263
  const palette = theme.palette && Object.keys(theme.palette).length > 0 ? theme.palette : DEFAULT_THEME.palette;
267
264
  const {
@@ -290,27 +287,24 @@ const getColor = memoize(_ref2 => {
290
287
  throw new Error('Error: invalid `getColor` parameters');
291
288
  }
292
289
  return retVal;
293
- }, _ref3 => {
294
- let {
295
- dark,
296
- hue,
297
- light,
298
- offset,
299
- shade,
300
- theme,
301
- transparency,
302
- variable
303
- } = _ref3;
304
- return toKey({
305
- dark,
306
- hue,
307
- light,
308
- offset,
309
- shade,
310
- theme,
311
- transparency,
312
- variable
313
- });
314
- });
290
+ }, ({
291
+ dark,
292
+ hue,
293
+ light,
294
+ offset,
295
+ shade,
296
+ theme,
297
+ transparency,
298
+ variable
299
+ }) => toKey$1({
300
+ dark,
301
+ hue,
302
+ light,
303
+ offset,
304
+ shade,
305
+ theme,
306
+ transparency,
307
+ variable
308
+ }));
315
309
 
316
310
  export { getColor };
@@ -24,13 +24,12 @@ const KEYS = {
24
24
  };
25
25
  CACHE.set(DEFAULT_THEME.colors, KEYS.colors);
26
26
  CACHE.set(DEFAULT_THEME.palette, KEYS.palette);
27
- const toKey = _ref => {
28
- let {
29
- hue,
30
- shade,
31
- theme,
32
- transparency
33
- } = _ref;
27
+ const toKey = ({
28
+ hue,
29
+ shade,
30
+ theme,
31
+ transparency
32
+ }) => {
34
33
  let retVal = `${typeof hue === 'object' ? JSON.stringify(hue) : hue}`;
35
34
  if (shade !== undefined) {
36
35
  retVal += `,${shade}`;
@@ -59,10 +58,7 @@ const toKey = _ref => {
59
58
  }
60
59
  return retVal;
61
60
  };
62
- const getColorV8 = memoize(function (hue) {
63
- let shade = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_SHADE;
64
- let theme = arguments.length > 2 ? arguments[2] : undefined;
65
- let transparency = arguments.length > 3 ? arguments[3] : undefined;
61
+ const getColorV8 = memoize((hue, shade = DEFAULT_SHADE, theme, transparency) => {
66
62
  let retVal;
67
63
  if (isNaN(shade)) {
68
64
  return undefined;
@@ -8,21 +8,20 @@ import DEFAULT_THEME from '../elements/theme/index.js';
8
8
  import { getColorV8 } from './getColorV8.js';
9
9
  import { getColor } from './getColor.js';
10
10
 
11
- const getFocusBoxShadow = _ref => {
12
- let {
13
- boxShadow,
14
- inset = false,
15
- color = {
16
- variable: 'border.primaryEmphasis'
17
- },
18
- shadowWidth = 'md',
19
- spacerColor = {
20
- variable: 'background.default'
21
- },
22
- spacerWidth = 'xs',
23
- theme = DEFAULT_THEME,
24
- ...args
25
- } = _ref;
11
+ const getFocusBoxShadow = ({
12
+ boxShadow,
13
+ inset = false,
14
+ color = {
15
+ variable: 'border.primaryEmphasis'
16
+ },
17
+ shadowWidth = 'md',
18
+ spacerColor = {
19
+ variable: 'background.default'
20
+ },
21
+ spacerWidth = 'xs',
22
+ theme = DEFAULT_THEME,
23
+ ...args
24
+ }) => {
26
25
  const _args = args;
27
26
  const _color = _args.hue ? getColorV8(_args.hue, _args.shade, theme) : getColor({
28
27
  ...color,
@@ -51,8 +51,7 @@ const hiddenStyles = options => {
51
51
  const transition = 'opacity 0.2s ease-in-out, 0.2s visibility 0s linear';
52
52
  return css(["transition:", ";visibility:hidden;opacity:0;"], options.animationModifier && transition);
53
53
  };
54
- function menuStyles(position) {
55
- let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
54
+ function menuStyles(position, options = {}) {
56
55
  const theme = options.theme || DEFAULT_THEME;
57
56
  let marginProperty;
58
57
  if (position === 'top') {
@@ -6,8 +6,7 @@
6
6
  */
7
7
  import { useMemo } from 'react';
8
8
 
9
- const useText = function (component, props, name, text) {
10
- let condition = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
9
+ const useText = (component, props, name, text, condition = true) => {
11
10
  const value = condition ? props[name] : undefined;
12
11
  return useMemo(() => {
13
12
  if (condition) {
package/dist/index.cjs.js CHANGED
@@ -50,12 +50,11 @@ const useColorScheme$1 = (initialState, colorSchemeKey) => {
50
50
  };
51
51
  };
52
52
  const ColorSchemeContext = React.createContext(undefined);
53
- const ColorSchemeProvider = _ref => {
54
- let {
55
- children,
56
- colorSchemeKey = 'color-scheme',
57
- initialColorScheme = 'system'
58
- } = _ref;
53
+ const ColorSchemeProvider = ({
54
+ children,
55
+ colorSchemeKey = 'color-scheme',
56
+ initialColorScheme = 'system'
57
+ }) => {
59
58
  const {
60
59
  isSystem,
61
60
  colorScheme,
@@ -570,15 +569,12 @@ const DEFAULT_THEME = {
570
569
  space
571
570
  };
572
571
 
573
- const ThemeProvider = _ref => {
574
- let {
575
- theme = DEFAULT_THEME,
576
- ...other
577
- } = _ref;
578
- return React__default.default.createElement(styled.ThemeProvider, Object.assign({
579
- theme: theme
580
- }, other));
581
- };
572
+ const ThemeProvider = ({
573
+ theme = DEFAULT_THEME,
574
+ ...other
575
+ }) => React__default.default.createElement(styled.ThemeProvider, Object.assign({
576
+ theme: theme
577
+ }, other));
582
578
 
583
579
  function retrieveComponentStyles(componentId, props) {
584
580
  const components = props.theme?.components;
@@ -676,8 +672,7 @@ const isValidColor = maybeColor => {
676
672
  }
677
673
  return retVal;
678
674
  };
679
- function findNearestIndex(target, arr) {
680
- let startIndex = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
675
+ function findNearestIndex(target, arr, startIndex = 0) {
681
676
  if (typeof target !== 'number' || isNaN(target)) {
682
677
  throw new Error('Target must be a number.');
683
678
  }
@@ -816,17 +811,16 @@ const KEYS$1 = {
816
811
  CACHE$1.set(DEFAULT_THEME.colors, KEYS$1.colors);
817
812
  CACHE$1.set(DEFAULT_THEME.palette, KEYS$1.palette);
818
813
  CACHE$1.set(DEFAULT_THEME.opacity, KEYS$1.opacity);
819
- const toKey$1 = _ref => {
820
- let {
821
- dark,
822
- hue,
823
- light,
824
- offset,
825
- shade,
826
- theme,
827
- transparency,
828
- variable
829
- } = _ref;
814
+ const toKey$1 = ({
815
+ dark,
816
+ hue,
817
+ light,
818
+ offset,
819
+ shade,
820
+ theme,
821
+ transparency,
822
+ variable
823
+ }) => {
830
824
  let themeColorsKey;
831
825
  if (theme.colors) {
832
826
  themeColorsKey = CACHE$1.get(theme.colors);
@@ -875,17 +869,16 @@ const toKey$1 = _ref => {
875
869
  }
876
870
  return retVal;
877
871
  };
878
- const getColor = memoize__default.default(_ref2 => {
879
- let {
880
- dark,
881
- hue,
882
- light,
883
- offset,
884
- shade,
885
- theme,
886
- transparency,
887
- variable
888
- } = _ref2;
872
+ const getColor = memoize__default.default(({
873
+ dark,
874
+ hue,
875
+ light,
876
+ offset,
877
+ shade,
878
+ theme,
879
+ transparency,
880
+ variable
881
+ }) => {
889
882
  let retVal;
890
883
  const palette = theme.palette && Object.keys(theme.palette).length > 0 ? theme.palette : DEFAULT_THEME.palette;
891
884
  const {
@@ -914,37 +907,33 @@ const getColor = memoize__default.default(_ref2 => {
914
907
  throw new Error('Error: invalid `getColor` parameters');
915
908
  }
916
909
  return retVal;
917
- }, _ref3 => {
918
- let {
919
- dark,
920
- hue,
921
- light,
922
- offset,
923
- shade,
924
- theme,
925
- transparency,
926
- variable
927
- } = _ref3;
928
- return toKey$1({
929
- dark,
930
- hue,
931
- light,
932
- offset,
933
- shade,
934
- theme,
935
- transparency,
936
- variable
937
- });
938
- });
910
+ }, ({
911
+ dark,
912
+ hue,
913
+ light,
914
+ offset,
915
+ shade,
916
+ theme,
917
+ transparency,
918
+ variable
919
+ }) => toKey$1({
920
+ dark,
921
+ hue,
922
+ light,
923
+ offset,
924
+ shade,
925
+ theme,
926
+ transparency,
927
+ variable
928
+ }));
939
929
 
940
- const getCheckeredBackground = _ref => {
941
- let {
942
- theme,
943
- size,
944
- overlay,
945
- positionY = 0,
946
- repeat = 'repeat'
947
- } = _ref;
930
+ const getCheckeredBackground = ({
931
+ theme,
932
+ size,
933
+ overlay,
934
+ positionY = 0,
935
+ repeat = 'repeat'
936
+ }) => {
948
937
  const color = getColor({
949
938
  theme,
950
939
  variable: 'border.default'
@@ -1125,13 +1114,12 @@ const KEYS = {
1125
1114
  };
1126
1115
  CACHE.set(DEFAULT_THEME.colors, KEYS.colors);
1127
1116
  CACHE.set(DEFAULT_THEME.palette, KEYS.palette);
1128
- const toKey = _ref => {
1129
- let {
1130
- hue,
1131
- shade,
1132
- theme,
1133
- transparency
1134
- } = _ref;
1117
+ const toKey = ({
1118
+ hue,
1119
+ shade,
1120
+ theme,
1121
+ transparency
1122
+ }) => {
1135
1123
  let retVal = `${typeof hue === 'object' ? JSON.stringify(hue) : hue}`;
1136
1124
  if (shade !== undefined) {
1137
1125
  retVal += `,${shade}`;
@@ -1160,10 +1148,7 @@ const toKey = _ref => {
1160
1148
  }
1161
1149
  return retVal;
1162
1150
  };
1163
- const getColorV8 = memoize__default.default(function (hue) {
1164
- let shade = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DEFAULT_SHADE;
1165
- let theme = arguments.length > 2 ? arguments[2] : undefined;
1166
- let transparency = arguments.length > 3 ? arguments[3] : undefined;
1151
+ const getColorV8 = memoize__default.default((hue, shade = DEFAULT_SHADE, theme, transparency) => {
1167
1152
  let retVal;
1168
1153
  if (isNaN(shade)) {
1169
1154
  return undefined;
@@ -1262,21 +1247,20 @@ const getFloatingPlacements = (theme, placement, fallbackPlacements) => {
1262
1247
  return [floatingPlacement, floatingFallbackPlacements];
1263
1248
  };
1264
1249
 
1265
- const getFocusBoxShadow = _ref => {
1266
- let {
1267
- boxShadow,
1268
- inset = false,
1269
- color = {
1270
- variable: 'border.primaryEmphasis'
1271
- },
1272
- shadowWidth = 'md',
1273
- spacerColor = {
1274
- variable: 'background.default'
1275
- },
1276
- spacerWidth = 'xs',
1277
- theme = DEFAULT_THEME,
1278
- ...args
1279
- } = _ref;
1250
+ const getFocusBoxShadow = ({
1251
+ boxShadow,
1252
+ inset = false,
1253
+ color = {
1254
+ variable: 'border.primaryEmphasis'
1255
+ },
1256
+ shadowWidth = 'md',
1257
+ spacerColor = {
1258
+ variable: 'background.default'
1259
+ },
1260
+ spacerWidth = 'xs',
1261
+ theme = DEFAULT_THEME,
1262
+ ...args
1263
+ }) => {
1280
1264
  const _args = args;
1281
1265
  const _color = _args.hue ? getColorV8(_args.hue, _args.shade, theme) : getColor({
1282
1266
  ...color,
@@ -1388,8 +1372,7 @@ const positionStyles = (position, size, inset, shift) => {
1388
1372
  }
1389
1373
  return styled.css(["&::before,&::after{transform:", ";", ";}"], transform, positionCss);
1390
1374
  };
1391
- function arrowStyles(position) {
1392
- let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1375
+ function arrowStyles(position, options = {}) {
1393
1376
  const inset = polished.stripUnit(options.inset || '0');
1394
1377
  const size = polished.stripUnit(options.size || '6');
1395
1378
  const shift = polished.stripUnit(options.shift || '0');
@@ -1434,8 +1417,7 @@ const useWindow = theme => {
1434
1417
  return controlledWindow;
1435
1418
  };
1436
1419
 
1437
- const useText = function (component, props, name, text) {
1438
- let condition = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : true;
1420
+ const useText = (component, props, name, text, condition = true) => {
1439
1421
  const value = condition ? props[name] : undefined;
1440
1422
  return React.useMemo(() => {
1441
1423
  if (condition) {
@@ -1497,8 +1479,7 @@ const hiddenStyles = options => {
1497
1479
  const transition = 'opacity 0.2s ease-in-out, 0.2s visibility 0s linear';
1498
1480
  return styled.css(["transition:", ";visibility:hidden;opacity:0;"], options.animationModifier && transition);
1499
1481
  };
1500
- function menuStyles(position) {
1501
- let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1482
+ function menuStyles(position, options = {}) {
1502
1483
  const theme = options.theme || DEFAULT_THEME;
1503
1484
  let marginProperty;
1504
1485
  if (position === 'top') {
@@ -1514,19 +1495,18 @@ function menuStyles(position) {
1514
1495
  }
1515
1496
 
1516
1497
  const SELECTOR_FOCUS_VISIBLE = '&:focus-visible';
1517
- const focusStyles = _ref => {
1518
- let {
1519
- condition = true,
1520
- selector = SELECTOR_FOCUS_VISIBLE,
1521
- shadowWidth = 'md',
1522
- spacerWidth = 'xs',
1523
- styles: {
1524
- boxShadow,
1525
- ...styles
1526
- } = {},
1527
- theme,
1528
- ...options
1529
- } = _ref;
1498
+ const focusStyles = ({
1499
+ condition = true,
1500
+ selector = SELECTOR_FOCUS_VISIBLE,
1501
+ shadowWidth = 'md',
1502
+ spacerWidth = 'xs',
1503
+ styles: {
1504
+ boxShadow,
1505
+ ...styles
1506
+ } = {},
1507
+ theme,
1508
+ ...options
1509
+ }) => {
1530
1510
  const _boxShadow = condition ? getFocusBoxShadow({
1531
1511
  boxShadow,
1532
1512
  shadowWidth,
@@ -1546,14 +1526,11 @@ const focusStyles = _ref => {
1546
1526
  };
1547
1527
 
1548
1528
  const StyledBaseIcon = styled__default.default(
1549
- _ref => {
1550
- let {
1551
- children,
1552
- theme,
1553
- ...props
1554
- } = _ref;
1555
- return React.cloneElement(React.Children.only(children), props);
1556
- }).withConfig({
1529
+ ({
1530
+ children,
1531
+ theme,
1532
+ ...props
1533
+ }) => React.cloneElement(React.Children.only(children), props)).withConfig({
1557
1534
  displayName: "StyledBaseIcon",
1558
1535
  componentId: "sc-1moykgb-0"
1559
1536
  })([""]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zendeskgarden/react-theming",
3
- "version": "9.12.2",
3
+ "version": "9.12.4",
4
4
  "description": "Theming utilities and components within the Garden Design System",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Zendesk Garden <garden@zendesk.com>",
@@ -47,5 +47,5 @@
47
47
  "access": "public"
48
48
  },
49
49
  "zendeskgarden:src": "src/index.ts",
50
- "gitHead": "9b6f34bf0eda4bee3b47f97a437aa9b7f3008af4"
50
+ "gitHead": "e79e9687e6bcbd097c059add2938cdae59a5173b"
51
51
  }