@zendeskgarden/react-theming 9.1.2 → 9.3.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.
@@ -5,15 +5,16 @@
5
5
  * found at http://www.apache.org/licenses/LICENSE-2.0.
6
6
  */
7
7
  import styled from 'styled-components';
8
- import React, { Children } from 'react';
8
+ import { cloneElement, Children } from 'react';
9
9
 
10
- const StyledBaseIcon = styled(_ref => {
10
+ const StyledBaseIcon = styled(
11
+ _ref => {
11
12
  let {
12
13
  children,
13
14
  theme,
14
15
  ...props
15
16
  } = _ref;
16
- return React.cloneElement(Children.only(children), props);
17
+ return cloneElement(Children.only(children), props);
17
18
  }).withConfig({
18
19
  displayName: "StyledBaseIcon",
19
20
  componentId: "sc-1moykgb-0"
@@ -17,10 +17,11 @@ const adjust = (color, expected, actual) => {
17
17
  }
18
18
  return color;
19
19
  };
20
- const toShade = (shade, offset, scheme) => {
20
+ const toShade = (shade, offset, transparency, scheme) => {
21
21
  let _shade;
22
22
  if (shade === undefined) {
23
- _shade = scheme === 'dark' ? 500 : 700;
23
+ const darkShade = transparency === undefined ? 600 : 500;
24
+ _shade = scheme === 'dark' ? darkShade : 700;
24
25
  } else {
25
26
  _shade = parseInt(shade.toString(), 10);
26
27
  if (isNaN(_shade)) {
@@ -29,8 +30,8 @@ const toShade = (shade, offset, scheme) => {
29
30
  }
30
31
  return _shade + (offset || 0);
31
32
  };
32
- const toHex = (hue, shade, offset, scheme) => {
33
- const _shade = toShade(shade, offset, scheme);
33
+ const toHex = (hue, shade, offset, transparency, scheme) => {
34
+ const _shade = toShade(shade, offset, transparency, scheme);
34
35
  let retVal = hue[_shade];
35
36
  if (!retVal) {
36
37
  const closestShade = Object.keys(hue).map(hueShade => parseInt(hueShade, 10)).reduce((previous, current) => {
@@ -119,13 +120,13 @@ const toColor = (colors, palette, opacity, scheme, hue, shade, offset, transpare
119
120
  _hue = palette[_hue];
120
121
  }
121
122
  if (typeof _hue === 'object') {
122
- retVal = toHex(_hue, shade, offset, scheme);
123
+ retVal = toHex(_hue, shade, offset, transparency, scheme);
123
124
  } else if (isValidColor(_hue)) {
124
125
  if (shade === undefined) {
125
126
  retVal = _hue;
126
127
  } else {
127
128
  _hue = generateColorScale(_hue);
128
- retVal = toHex(_hue, shade, offset, scheme);
129
+ retVal = toHex(_hue, shade, offset, transparency, scheme);
129
130
  }
130
131
  }
131
132
  if (retVal && transparency) {
package/dist/index.cjs.js CHANGED
@@ -558,10 +558,11 @@ const adjust$1 = (color, expected, actual) => {
558
558
  }
559
559
  return color;
560
560
  };
561
- const toShade = (shade, offset, scheme) => {
561
+ const toShade = (shade, offset, transparency, scheme) => {
562
562
  let _shade;
563
563
  if (shade === undefined) {
564
- _shade = scheme === 'dark' ? 500 : 700;
564
+ const darkShade = transparency === undefined ? 600 : 500;
565
+ _shade = scheme === 'dark' ? darkShade : 700;
565
566
  } else {
566
567
  _shade = parseInt(shade.toString(), 10);
567
568
  if (isNaN(_shade)) {
@@ -570,8 +571,8 @@ const toShade = (shade, offset, scheme) => {
570
571
  }
571
572
  return _shade + (offset || 0);
572
573
  };
573
- const toHex = (hue, shade, offset, scheme) => {
574
- const _shade = toShade(shade, offset, scheme);
574
+ const toHex = (hue, shade, offset, transparency, scheme) => {
575
+ const _shade = toShade(shade, offset, transparency, scheme);
575
576
  let retVal = hue[_shade];
576
577
  if (!retVal) {
577
578
  const closestShade = Object.keys(hue).map(hueShade => parseInt(hueShade, 10)).reduce((previous, current) => {
@@ -660,13 +661,13 @@ const toColor = (colors, palette, opacity, scheme, hue, shade, offset, transpare
660
661
  _hue = palette[_hue];
661
662
  }
662
663
  if (typeof _hue === 'object') {
663
- retVal = toHex(_hue, shade, offset, scheme);
664
+ retVal = toHex(_hue, shade, offset, transparency, scheme);
664
665
  } else if (isValidColor(_hue)) {
665
666
  if (shade === undefined) {
666
667
  retVal = _hue;
667
668
  } else {
668
669
  _hue = generateColorScale(_hue);
669
- retVal = toHex(_hue, shade, offset, scheme);
670
+ retVal = toHex(_hue, shade, offset, transparency, scheme);
670
671
  }
671
672
  }
672
673
  if (retVal && transparency) {
@@ -1453,13 +1454,14 @@ const focusStyles = _ref => {
1453
1454
  return styled.css(["&:focus{outline:none;}", "{outline:", ";outline-offset:", ";box-shadow:", ";", "}"], selector, outline, outlineOffset, _boxShadow, styles);
1454
1455
  };
1455
1456
 
1456
- const StyledBaseIcon = styled__default.default(_ref => {
1457
+ const StyledBaseIcon = styled__default.default(
1458
+ _ref => {
1457
1459
  let {
1458
1460
  children,
1459
1461
  theme,
1460
1462
  ...props
1461
1463
  } = _ref;
1462
- return React__default.default.cloneElement(React.Children.only(children), props);
1464
+ return React.cloneElement(React.Children.only(children), props);
1463
1465
  }).withConfig({
1464
1466
  displayName: "StyledBaseIcon",
1465
1467
  componentId: "sc-1moykgb-0"
@@ -24,4 +24,4 @@ export { useText } from './utils/useText';
24
24
  export { default as menuStyles } from './utils/menuStyles';
25
25
  export { focusStyles, SELECTOR_FOCUS_VISIBLE } from './utils/focusStyles';
26
26
  export { StyledBaseIcon } from './utils/StyledBaseIcon';
27
- export { ARROW_POSITION, MENU_POSITION, PLACEMENT, type IGardenTheme, type IThemeProviderProps, type ArrowPosition, type CheckeredBackgroundParameters, type ColorParameters, type FocusBoxShadowParameters, type FocusStylesParameters, type MenuPosition, type Placement } from './types';
27
+ export { ARROW_POSITION, MENU_POSITION, PLACEMENT, type IGardenTheme, type IStyledBaseIconProps, type IThemeProviderProps, type ArrowPosition, type CheckeredBackgroundParameters, type ColorParameters, type FocusBoxShadowParameters, type FocusStylesParameters, type MenuPosition, type Placement } from './types';
@@ -4,7 +4,8 @@
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 { CSSObject, ThemeProviderProps } from 'styled-components';
7
+ import { PropsWithChildren, SVGAttributes } from 'react';
8
+ import { CSSObject, DefaultTheme, ThemeProviderProps } 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];
10
11
  export declare const MENU_POSITION: readonly ["top", "right", "bottom", "left"];
@@ -172,3 +173,6 @@ export interface IThemeProviderProps extends Partial<ThemeProviderProps<IGardenT
172
173
  */
173
174
  theme?: IGardenTheme | ((theme: IGardenTheme) => IGardenTheme);
174
175
  }
176
+ export interface IStyledBaseIconProps extends PropsWithChildren<SVGAttributes<SVGElement>> {
177
+ theme?: DefaultTheme;
178
+ }
@@ -4,5 +4,6 @@
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 React from 'react';
8
- export declare const StyledBaseIcon: import("styled-components").StyledComponent<({ children, theme, ...props }: any) => React.DetailedReactHTMLElement<any, HTMLElement>, import("styled-components").DefaultTheme, {}, never>;
7
+ import { ReactElement } from 'react';
8
+ import { IStyledBaseIconProps } from '../types';
9
+ export declare const StyledBaseIcon: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components").FastOmit<IStyledBaseIconProps, never>> & string & Omit<({ children, theme, ...props }: IStyledBaseIconProps) => ReactElement<any, string | import("react").JSXElementConstructor<any>>, keyof import("react").Component<any, {}, any>>;
@@ -45,5 +45,5 @@ type ArrowOptions = {
45
45
  *
46
46
  * @component
47
47
  */
48
- export default function arrowStyles(position: ArrowPosition, options?: ArrowOptions): import("styled-components").FlattenSimpleInterpolation;
48
+ export default function arrowStyles(position: ArrowPosition, options?: ArrowOptions): import("styled-components").RuleSet<object>;
49
49
  export {};
@@ -36,4 +36,4 @@ export declare const SELECTOR_FOCUS_VISIBLE = "&:focus-visible";
36
36
  * }
37
37
  * ```
38
38
  */
39
- export declare const focusStyles: ({ condition, selector, shadowWidth, spacerWidth, styles: { boxShadow, ...styles }, theme, ...options }: FocusStylesParameters) => import("styled-components").FlattenSimpleInterpolation;
39
+ export declare const focusStyles: ({ condition, selector, shadowWidth, spacerWidth, styles: { boxShadow, ...styles }, theme, ...options }: FocusStylesParameters) => import("styled-components").RuleSet<object>;
@@ -33,5 +33,5 @@ type MenuOptions = {
33
33
  * @param {string} [options.animationModifier] A CSS class or attribute selector
34
34
  * which, when applied, animates the menu's appearance.
35
35
  */
36
- export default function menuStyles(position: MenuPosition, options?: MenuOptions): import("styled-components").FlattenInterpolation<import("styled-components").ThemeProps<DefaultTheme>>;
36
+ export default function menuStyles(position: MenuPosition, options?: MenuOptions): import("styled-components").RuleSet<object>;
37
37
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zendeskgarden/react-theming",
3
- "version": "9.1.2",
3
+ "version": "9.3.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>",
@@ -31,7 +31,7 @@
31
31
  "peerDependencies": {
32
32
  "react": "^16.8.0 || ^17.0.0 || ^18.0.0",
33
33
  "react-dom": "^16.8.0 || ^17.0.0 || ^18.0.0",
34
- "styled-components": "^4.2.0 || ^5.3.1"
34
+ "styled-components": "^4.2.0 || ^5.3.1 || ^6.0.0"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@types/lodash.get": "4.4.9",
@@ -47,5 +47,5 @@
47
47
  "access": "public"
48
48
  },
49
49
  "zendeskgarden:src": "src/index.ts",
50
- "gitHead": "dd7b2e7fb6747ef39a028b4e7b9924c2098deea0"
50
+ "gitHead": "fa6461e0d9fae27956980056006e8013daedc6b9"
51
51
  }