@zendeskgarden/react-theming 8.66.0 → 8.68.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.cjs.js CHANGED
@@ -412,10 +412,13 @@ const getColor = memoize__default.default(function (hue) {
412
412
 
413
413
  const getFocusBoxShadow = _ref => {
414
414
  let {
415
+ boxShadow,
415
416
  inset = false,
416
417
  hue = 'primaryHue',
417
418
  shade = DEFAULT_SHADE,
418
419
  shadowWidth = 'md',
420
+ spacerHue = 'background',
421
+ spacerShade = DEFAULT_SHADE,
419
422
  spacerWidth = 'xs',
420
423
  theme = DEFAULT_THEME
421
424
  } = _ref;
@@ -424,9 +427,11 @@ const getFocusBoxShadow = _ref => {
424
427
  if (spacerWidth === null) {
425
428
  return `${inset ? 'inset' : ''} ${shadow}`;
426
429
  }
427
- return `
428
- ${inset ? 'inset' : ''} ${theme.shadows[spacerWidth](theme.colors.background)},
430
+ const spacerColor = getColor(spacerHue, spacerShade, theme);
431
+ const retVal = `
432
+ ${inset ? 'inset' : ''} ${theme.shadows[spacerWidth](spacerColor)},
429
433
  ${inset ? 'inset' : ''} ${shadow}`;
434
+ return boxShadow ? `${retVal}, ${boxShadow}` : retVal;
430
435
  };
431
436
 
432
437
  function getLineHeight(height, fontSize) {
@@ -619,16 +624,20 @@ const focusStyles = _ref => {
619
624
  selector = SELECTOR_FOCUS_VISIBLE,
620
625
  shadowWidth = 'md',
621
626
  spacerWidth = 'xs',
622
- styles,
627
+ styles: {
628
+ boxShadow,
629
+ ...styles
630
+ } = {},
623
631
  theme,
624
632
  ...options
625
633
  } = _ref;
626
- const boxShadow = condition ? getFocusBoxShadow({
634
+ const _boxShadow = condition ? getFocusBoxShadow({
635
+ boxShadow,
627
636
  shadowWidth,
628
637
  spacerWidth,
629
638
  theme,
630
639
  ...options
631
- }) : undefined;
640
+ }) : boxShadow;
632
641
  let outline;
633
642
  let outlineOffset;
634
643
  if (spacerWidth === null) {
@@ -637,7 +646,7 @@ const focusStyles = _ref => {
637
646
  outline = `${polished.math(`${theme.shadowWidths[shadowWidth]} - ${theme.shadowWidths[spacerWidth]}`)} solid transparent`;
638
647
  outlineOffset = theme.shadowWidths[spacerWidth];
639
648
  }
640
- return styledComponents.css(["&:focus{outline:none;}", "{outline:", ";outline-offset:", ";box-shadow:", ";", "}"], selector, outline, outlineOffset, boxShadow, styles);
649
+ return styledComponents.css(["&:focus{outline:none;}", "{outline:", ";outline-offset:", ";box-shadow:", ";", "}"], selector, outline, outlineOffset, _boxShadow, styles);
641
650
  };
642
651
 
643
652
  const ARROW_POSITION = ['top', 'top-left', 'top-right', 'right', 'right-top', 'right-bottom', 'bottom', 'bottom-left', 'bottom-right', 'left', 'left-top', 'left-bottom'];
package/dist/index.esm.js CHANGED
@@ -405,10 +405,13 @@ const getColor = memoize(function (hue) {
405
405
 
406
406
  const getFocusBoxShadow = _ref => {
407
407
  let {
408
+ boxShadow,
408
409
  inset = false,
409
410
  hue = 'primaryHue',
410
411
  shade = DEFAULT_SHADE,
411
412
  shadowWidth = 'md',
413
+ spacerHue = 'background',
414
+ spacerShade = DEFAULT_SHADE,
412
415
  spacerWidth = 'xs',
413
416
  theme = DEFAULT_THEME
414
417
  } = _ref;
@@ -417,9 +420,11 @@ const getFocusBoxShadow = _ref => {
417
420
  if (spacerWidth === null) {
418
421
  return `${inset ? 'inset' : ''} ${shadow}`;
419
422
  }
420
- return `
421
- ${inset ? 'inset' : ''} ${theme.shadows[spacerWidth](theme.colors.background)},
423
+ const spacerColor = getColor(spacerHue, spacerShade, theme);
424
+ const retVal = `
425
+ ${inset ? 'inset' : ''} ${theme.shadows[spacerWidth](spacerColor)},
422
426
  ${inset ? 'inset' : ''} ${shadow}`;
427
+ return boxShadow ? `${retVal}, ${boxShadow}` : retVal;
423
428
  };
424
429
 
425
430
  function getLineHeight(height, fontSize) {
@@ -612,16 +617,20 @@ const focusStyles = _ref => {
612
617
  selector = SELECTOR_FOCUS_VISIBLE,
613
618
  shadowWidth = 'md',
614
619
  spacerWidth = 'xs',
615
- styles,
620
+ styles: {
621
+ boxShadow,
622
+ ...styles
623
+ } = {},
616
624
  theme,
617
625
  ...options
618
626
  } = _ref;
619
- const boxShadow = condition ? getFocusBoxShadow({
627
+ const _boxShadow = condition ? getFocusBoxShadow({
628
+ boxShadow,
620
629
  shadowWidth,
621
630
  spacerWidth,
622
631
  theme,
623
632
  ...options
624
- }) : undefined;
633
+ }) : boxShadow;
625
634
  let outline;
626
635
  let outlineOffset;
627
636
  if (spacerWidth === null) {
@@ -630,7 +639,7 @@ const focusStyles = _ref => {
630
639
  outline = `${math(`${theme.shadowWidths[shadowWidth]} - ${theme.shadowWidths[spacerWidth]}`)} solid transparent`;
631
640
  outlineOffset = theme.shadowWidths[spacerWidth];
632
641
  }
633
- return css(["&:focus{outline:none;}", "{outline:", ";outline-offset:", ";box-shadow:", ";", "}"], selector, outline, outlineOffset, boxShadow, styles);
642
+ return css(["&:focus{outline:none;}", "{outline:", ";outline-offset:", ";box-shadow:", ";", "}"], selector, outline, outlineOffset, _boxShadow, styles);
634
643
  };
635
644
 
636
645
  const ARROW_POSITION = ['top', 'top-left', 'top-right', 'right', 'right-top', 'right-bottom', 'bottom', 'bottom-left', 'bottom-right', 'left', 'left-top', 'left-bottom'];
@@ -4,10 +4,10 @@
4
4
  * Use of this source code is governed under the Apache License, Version 2.0
5
5
  * found at http://www.apache.org/licenses/LICENSE-2.0.
6
6
  */
7
- import { PropsWithChildren } from 'react';
7
+ import React, { PropsWithChildren } from 'react';
8
8
  import { IThemeProviderProps } from '../types';
9
9
  export declare const ThemeProvider: {
10
- ({ theme, focusVisibleRef, children, ...other }: PropsWithChildren<IThemeProviderProps>): JSX.Element;
10
+ ({ theme, focusVisibleRef, children, ...other }: PropsWithChildren<IThemeProviderProps>): React.JSX.Element;
11
11
  defaultProps: {
12
12
  theme: import("../types").IGardenTheme;
13
13
  };
@@ -4,6 +4,7 @@
4
4
  * Use of this source code is governed under the Apache License, Version 2.0
5
5
  * found at http://www.apache.org/licenses/LICENSE-2.0.
6
6
  */
7
+ /// <reference types="react" />
7
8
  import { ThemeProps } from 'styled-components';
8
9
  export declare const ARROW_POSITION: readonly ["top", "top-left", "top-right", "right", "right-top", "right-bottom", "bottom", "bottom-left", "bottom-right", "left", "left-top", "left-bottom"];
9
10
  export type ArrowPosition = (typeof ARROW_POSITION)[number];
@@ -18,9 +18,11 @@ type FocusStylesParameters = FocusBoxShadowParameters & {
18
18
  * @param {boolean} [options.condition=true] Supplies an optional condition that can be used to prevent the focus `box-shadow`
19
19
  * @param {boolean} [options.inset=false] Determines whether the `box-shadow` is inset
20
20
  * @param {string|Object} [options.hue='primaryHue'] Provides a theme object `palette` hue or `color` key, or any valid CSS color notation
21
- * @param {string} [options.selector=SELECTOR_FOCUS_VISIBLE] Provides a subsitute `:focus-visible` pseudo-class CSS selector.
21
+ * @param {string} [options.selector=SELECTOR_FOCUS_VISIBLE] Provides a substitute `:focus-visible` pseudo-class CSS selector.
22
22
  * @param {number} [options.shade=600] Selects a shade for the given hue
23
23
  * @param {string} [options.shadowWidth='md'] Provides a theme object `shadowWidth` key for the cumulative width of the `box-shadow`
24
+ * @param {string|Object} [options.spacerHue='background'] Provides a theme object `palette` hue or `color` key, or any valid CSS color notation
25
+ * @param {number} [options.spacerShade=600] Selects a shade for the given `spacerHue`
24
26
  * @param {string} [options.spacerWidth='xs'] Provides a theme object `shadowWidth` for the white spacer, or `null` to remove
25
27
  * @param {Object} [options.styles] Adds CSS property values to be rendered with `:focus-visible`
26
28
  * @param {Object} options.theme Provides values used to resolve the desired color
@@ -41,5 +43,5 @@ type FocusStylesParameters = FocusBoxShadowParameters & {
41
43
  * }
42
44
  * ```
43
45
  */
44
- export declare const focusStyles: ({ condition, selector, shadowWidth, spacerWidth, styles, theme, ...options }: FocusStylesParameters) => import("styled-components").FlattenSimpleInterpolation;
46
+ export declare const focusStyles: ({ condition, selector, shadowWidth, spacerWidth, styles: { boxShadow, ...styles }, theme, ...options }: FocusStylesParameters) => import("styled-components").FlattenSimpleInterpolation;
45
47
  export {};
@@ -7,10 +7,13 @@
7
7
  import { IGardenTheme } from '../types';
8
8
  import { Hue } from './getColor';
9
9
  export type FocusBoxShadowParameters = {
10
+ boxShadow?: string;
10
11
  inset?: boolean;
11
12
  hue?: Hue;
12
13
  shade?: number;
13
14
  shadowWidth?: 'sm' | 'md';
15
+ spacerHue?: Hue;
16
+ spacerShade?: number;
14
17
  spacerWidth?: null | 'xs' | 'sm';
15
18
  theme: IGardenTheme;
16
19
  };
@@ -18,14 +21,17 @@ export type FocusBoxShadowParameters = {
18
21
  * Get a CSS `box-shadow` property value for focus state styling. The `hue` and
19
22
  * `shade` are used to determine the color of the focus ring.
20
23
  *
24
+ * @param {string} [options.boxShadow] Provides an existing `box-shadow` (a drop shadow, for example) to be retained along with the focus ring
21
25
  * @param {boolean} [options.inset=false] Determines whether the `box-shadow` is inset
22
26
  * @param {string|Object} [options.hue='primaryHue'] Provides a theme object `palette` hue or `color` key, or any valid CSS color notation
23
- * @param {number} [options.shade=600] Selects a shade for the given hue
27
+ * @param {number} [options.shade=600] Selects a shade for the given `hue`
24
28
  * @param {string} [options.shadowWidth='md'] Provides a theme object `shadowWidth` key for the cumulative width of the `box-shadow`
29
+ * @param {string|Object} [options.spacerHue='background'] Provides a theme object `palette` hue or `color` key, or any valid CSS color notation
30
+ * @param {number} [options.spacerShade=600] Selects a shade for the given `spacerHue`
25
31
  * @param {string} [options.spacerWidth='xs'] Provides a theme object `shadowWidth` for the white spacer, or `null` to remove
26
32
  * @param {Object} options.theme Provides values used to resolve the desired color
27
33
  *
28
34
  * @returns A `box-shadow` property value for the given options. Default is a
29
35
  * 3px `blue[600]` ring with a 1px white spacer overlay.
30
36
  */
31
- export declare const getFocusBoxShadow: ({ inset, hue, shade, shadowWidth, spacerWidth, theme }: FocusBoxShadowParameters) => string;
37
+ export declare const getFocusBoxShadow: ({ boxShadow, inset, hue, shade, shadowWidth, spacerHue, spacerShade, spacerWidth, theme }: FocusBoxShadowParameters) => string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zendeskgarden/react-theming",
3
- "version": "8.66.0",
3
+ "version": "8.68.0",
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>",
@@ -45,5 +45,5 @@
45
45
  "access": "public"
46
46
  },
47
47
  "zendeskgarden:src": "src/index.ts",
48
- "gitHead": "40df9b49f68b69878186a66e9c14efb00eca051f"
48
+ "gitHead": "e05a28d586f47d95e0570fe2d529915aa4285845"
49
49
  }