@zendeskgarden/react-theming 9.0.0-next.7 → 9.0.0-next.9

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.
Files changed (34) hide show
  1. package/dist/esm/elements/ThemeProvider.js +24 -0
  2. package/dist/esm/elements/palette/index.js +259 -0
  3. package/dist/esm/elements/palette/v8.js +149 -0
  4. package/dist/esm/elements/theme/index.js +224 -0
  5. package/dist/esm/index.js +28 -0
  6. package/dist/esm/types/index.js +11 -0
  7. package/dist/esm/utils/StyledBaseIcon.js +22 -0
  8. package/dist/esm/utils/arrowStyles.js +64 -0
  9. package/dist/esm/utils/focusStyles.js +43 -0
  10. package/dist/esm/utils/getArrowPosition.js +35 -0
  11. package/dist/esm/utils/getCheckeredBackground.js +40 -0
  12. package/dist/esm/utils/getColor.js +153 -0
  13. package/dist/esm/utils/getColorV8.js +72 -0
  14. package/dist/esm/utils/getFloatingPlacements.js +58 -0
  15. package/dist/esm/utils/getFocusBoxShadow.js +45 -0
  16. package/dist/esm/utils/getLineHeight.js +22 -0
  17. package/dist/esm/utils/getMenuPosition.js +11 -0
  18. package/dist/esm/utils/mediaQuery.js +56 -0
  19. package/dist/esm/utils/menuStyles.js +63 -0
  20. package/dist/esm/utils/retrieveComponentStyles.js +19 -0
  21. package/dist/esm/utils/useDocument.js +21 -0
  22. package/dist/esm/utils/useText.js +29 -0
  23. package/dist/esm/utils/useWindow.js +21 -0
  24. package/dist/index.cjs.js +372 -262
  25. package/dist/typings/elements/palette/index.d.ts +0 -24
  26. package/dist/typings/index.d.ts +3 -1
  27. package/dist/typings/types/index.d.ts +43 -1
  28. package/dist/typings/utils/StyledBaseIcon.d.ts +8 -0
  29. package/dist/typings/utils/focusStyles.d.ts +1 -8
  30. package/dist/typings/utils/getCheckeredBackground.d.ts +20 -0
  31. package/dist/typings/utils/getColor.d.ts +3 -24
  32. package/dist/typings/utils/getFocusBoxShadow.d.ts +6 -20
  33. package/package.json +3 -3
  34. package/dist/index.esm.js +0 -1145
@@ -9,11 +9,9 @@ declare const PALETTE: {
9
9
  white: string;
10
10
  product: {
11
11
  support: string;
12
- message: string;
13
12
  explore: string;
14
13
  gather: string;
15
14
  guide: string;
16
- connect: string;
17
15
  chat: string;
18
16
  talk: string;
19
17
  sell: string;
@@ -115,8 +113,6 @@ declare const PALETTE: {
115
113
  1000: string;
116
114
  1100: string;
117
115
  1200: string;
118
- M400: string;
119
- M600: string;
120
116
  };
121
117
  pink: {
122
118
  100: string;
@@ -131,8 +127,6 @@ declare const PALETTE: {
131
127
  1000: string;
132
128
  1100: string;
133
129
  1200: string;
134
- M400: string;
135
- M600: string;
136
130
  };
137
131
  crimson: {
138
132
  100: string;
@@ -147,8 +141,6 @@ declare const PALETTE: {
147
141
  1000: string;
148
142
  1100: string;
149
143
  1200: string;
150
- M400: string;
151
- M600: string;
152
144
  };
153
145
  orange: {
154
146
  100: string;
@@ -163,8 +155,6 @@ declare const PALETTE: {
163
155
  1000: string;
164
156
  1100: string;
165
157
  1200: string;
166
- M400: string;
167
- M600: string;
168
158
  };
169
159
  lemon: {
170
160
  100: string;
@@ -179,8 +169,6 @@ declare const PALETTE: {
179
169
  1000: string;
180
170
  1100: string;
181
171
  1200: string;
182
- M400: string;
183
- M600: string;
184
172
  };
185
173
  lime: {
186
174
  100: string;
@@ -195,8 +183,6 @@ declare const PALETTE: {
195
183
  1000: string;
196
184
  1100: string;
197
185
  1200: string;
198
- M400: string;
199
- M600: string;
200
186
  };
201
187
  mint: {
202
188
  100: string;
@@ -211,8 +197,6 @@ declare const PALETTE: {
211
197
  1000: string;
212
198
  1100: string;
213
199
  1200: string;
214
- M400: string;
215
- M600: string;
216
200
  };
217
201
  teal: {
218
202
  100: string;
@@ -227,8 +211,6 @@ declare const PALETTE: {
227
211
  1000: string;
228
212
  1100: string;
229
213
  1200: string;
230
- M400: string;
231
- M600: string;
232
214
  };
233
215
  azure: {
234
216
  100: string;
@@ -243,8 +225,6 @@ declare const PALETTE: {
243
225
  1000: string;
244
226
  1100: string;
245
227
  1200: string;
246
- M400: string;
247
- M600: string;
248
228
  };
249
229
  royal: {
250
230
  100: string;
@@ -259,8 +239,6 @@ declare const PALETTE: {
259
239
  1000: string;
260
240
  1100: string;
261
241
  1200: string;
262
- M400: string;
263
- M600: string;
264
242
  };
265
243
  purple: {
266
244
  100: string;
@@ -275,8 +253,6 @@ declare const PALETTE: {
275
253
  1000: string;
276
254
  1100: string;
277
255
  1200: string;
278
- M400: string;
279
- M600: string;
280
256
  };
281
257
  };
282
258
  export default PALETTE;
@@ -10,6 +10,7 @@ export { default as PALETTE } from './elements/palette';
10
10
  export { default as PALETTE_V8 } from './elements/palette/v8';
11
11
  export { default as retrieveComponentStyles } from './utils/retrieveComponentStyles';
12
12
  export { getArrowPosition } from './utils/getArrowPosition';
13
+ export { getCheckeredBackground } from './utils/getCheckeredBackground';
13
14
  export { getColor } from './utils/getColor';
14
15
  export { getColorV8 } from './utils/getColorV8';
15
16
  export { getFloatingPlacements } from './utils/getFloatingPlacements';
@@ -23,4 +24,5 @@ export { useWindow } from './utils/useWindow';
23
24
  export { useText } from './utils/useText';
24
25
  export { default as menuStyles } from './utils/menuStyles';
25
26
  export { focusStyles, SELECTOR_FOCUS_VISIBLE } from './utils/focusStyles';
26
- export { ARROW_POSITION, MENU_POSITION, PLACEMENT, type IGardenTheme, type IThemeProviderProps, type ArrowPosition, type MenuPosition, type Placement } from './types';
27
+ export { StyledBaseIcon } from './utils/StyledBaseIcon';
28
+ 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';
@@ -4,13 +4,54 @@
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 { ThemeProviderProps } from 'styled-components';
7
+ import { CSSObject, ThemeProviderProps } from 'styled-components';
8
8
  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
9
  export type ArrowPosition = (typeof ARROW_POSITION)[number];
10
10
  export declare const MENU_POSITION: readonly ["top", "right", "bottom", "left"];
11
11
  export type MenuPosition = (typeof MENU_POSITION)[number];
12
12
  export declare const PLACEMENT: readonly ["top", "top-start", "top-end", "bottom", "bottom-start", "bottom-end", "end", "end-top", "end-bottom", "start", "start-top", "start-bottom"];
13
13
  export type Placement = (typeof PLACEMENT)[number];
14
+ export type CheckeredBackgroundParameters = {
15
+ overlay?: string;
16
+ positionY?: number;
17
+ repeat?: 'repeat' | 'repeat-x';
18
+ size: number;
19
+ theme: IGardenTheme;
20
+ };
21
+ export type ColorParameters = {
22
+ dark?: {
23
+ hue?: string;
24
+ offset?: number;
25
+ shade?: number;
26
+ transparency?: number;
27
+ };
28
+ hue?: string;
29
+ light?: {
30
+ hue?: string;
31
+ offset?: number;
32
+ shade?: number;
33
+ transparency?: number;
34
+ };
35
+ offset?: number;
36
+ shade?: number;
37
+ theme: IGardenTheme;
38
+ transparency?: number;
39
+ variable?: string;
40
+ };
41
+ export type FocusStylesParameters = FocusBoxShadowParameters & {
42
+ condition?: boolean;
43
+ selector?: string;
44
+ styles?: CSSObject;
45
+ };
46
+ export type FocusBoxShadowParameters = {
47
+ boxShadow?: string;
48
+ inset?: boolean;
49
+ color?: Omit<ColorParameters, 'theme'>;
50
+ shadowWidth?: 'sm' | 'md';
51
+ spacerColor?: Omit<ColorParameters, 'theme'>;
52
+ spacerWidth?: null | 'xs' | 'sm';
53
+ theme: IGardenTheme;
54
+ };
14
55
  export type Hue = Record<number | string, string> | string;
15
56
  export interface IGardenTheme {
16
57
  rtl: boolean;
@@ -97,6 +138,7 @@ export interface IGardenTheme {
97
138
  xxl: string;
98
139
  xxxl: string;
99
140
  };
141
+ opacity: Record<number, number>;
100
142
  palette: Record<string, Hue>;
101
143
  shadowWidths: {
102
144
  xs: string;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Copyright Zendesk, Inc.
3
+ *
4
+ * Use of this source code is governed under the Apache License, Version 2.0
5
+ * found at http://www.apache.org/licenses/LICENSE-2.0.
6
+ */
7
+ import React from 'react';
8
+ export declare const StyledBaseIcon: import("styled-components").StyledComponent<({ children, theme, ...props }: any) => React.DetailedReactHTMLElement<any, HTMLElement>, any, {}, never>;
@@ -4,14 +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 } from 'styled-components';
8
- import { FocusBoxShadowParameters } from './getFocusBoxShadow';
7
+ import { FocusStylesParameters } from '../types';
9
8
  export declare const SELECTOR_FOCUS_VISIBLE = "&:focus-visible";
10
- type FocusStylesParameters = FocusBoxShadowParameters & {
11
- condition?: boolean;
12
- selector?: string;
13
- styles?: CSSObject;
14
- };
15
9
  /**
16
10
  * Garden standard `box-shadow` focus styling.
17
11
  *
@@ -43,4 +37,3 @@ type FocusStylesParameters = FocusBoxShadowParameters & {
43
37
  * ```
44
38
  */
45
39
  export declare const focusStyles: ({ condition, selector, shadowWidth, spacerWidth, styles: { boxShadow, ...styles }, theme, ...options }: FocusStylesParameters) => import("styled-components").FlattenSimpleInterpolation;
46
- export {};
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Copyright Zendesk, Inc.
3
+ *
4
+ * Use of this source code is governed under the Apache License, Version 2.0
5
+ * found at http://www.apache.org/licenses/LICENSE-2.0.
6
+ */
7
+ import { CheckeredBackgroundParameters } from '../types';
8
+ /**
9
+ * Get a checkered background image.
10
+ *
11
+ * @param {Object} options.theme Provides information for pattern color and LTR/RTL layout
12
+ * @param {number} options.size The pixel size of the checkered pattern
13
+ * @param {string} [options.overlay] Optional
14
+ * [color](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value) with transparency or
15
+ * [`linear-gradient()`](https://developer.mozilla.org/en-US/docs/Web/CSS/gradient/linear-gradient)
16
+ * overlay to apply on top of the checkered pattern
17
+ * @param {number} [options.positionY=0] Optional vertical position for starting the pattern (default `0`)
18
+ * @param {string} [options.repeat='repeat'] Optional repeat value for the pattern; either `'repeat'` or `'repeat-x'` (default `'repeat'`)
19
+ */
20
+ export declare const getCheckeredBackground: ({ theme, size, overlay, positionY, repeat }: CheckeredBackgroundParameters) => string;
@@ -5,34 +5,14 @@
5
5
  * found at http://www.apache.org/licenses/LICENSE-2.0.
6
6
  */
7
7
  /// <reference types="lodash" />
8
- import { IGardenTheme } from '../types';
9
- type ColorParameters = {
10
- dark?: {
11
- hue?: string;
12
- offset?: number;
13
- shade?: number;
14
- transparency?: number;
15
- };
16
- hue?: string;
17
- light?: {
18
- hue?: string;
19
- offset?: number;
20
- shade?: number;
21
- transparency?: number;
22
- };
23
- offset?: number;
24
- shade?: number;
25
- theme: IGardenTheme;
26
- transparency?: number;
27
- variable?: string;
28
- };
8
+ import { ColorParameters } from '../types';
29
9
  /**
30
10
  * Get a color value from the theme. Variable lookup takes precedence, followed
31
11
  * by `dark` and `light` object values. If none of these are provided, `hue`,
32
12
  * `shade`, `offset`, and `transparency` are used as fallbacks to determine the
33
13
  * color.
34
14
  *
35
- * @param {Object} [options.theme] Provides values used to resolve the desired color
15
+ * @param {Object} options.theme Provides values used to resolve the desired color
36
16
  * @param {string} [options.variable] A variable key (i.e. `'background.default'`) used to resolve a color value for the theme color base
37
17
  * @param {Object} [options.dark] An object with `hue`, `shade`, `offset`, and `transparency` values to be used in dark mode
38
18
  * @param {Object} [options.light] An object with `hue`, `shade`, `offset`, and `transparency` values to be used in light mode
@@ -45,7 +25,6 @@ type ColorParameters = {
45
25
  * - `'chromeHue'` = `theme.colors.chromeHue`
46
26
  * @param {number} [options.shade] A hue shade
47
27
  * @param {number} [options.offset] A positive or negative value to adjust the shade
48
- * @param {number} [options.transparency] An alpha-channel value between 0 and 1
28
+ * @param {number} [options.transparency] A `theme.opacity` key or an alpha-channel value between 0 and 1
49
29
  */
50
30
  export declare const getColor: (({ dark, hue, light, offset, shade, theme, transparency, variable }: ColorParameters) => string) & import("lodash").MemoizedFunction;
51
- export {};
@@ -4,33 +4,19 @@
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 { Hue, IGardenTheme } from '../types';
8
- export type FocusBoxShadowParameters = {
9
- boxShadow?: string;
10
- inset?: boolean;
11
- hue?: Hue;
12
- shade?: number;
13
- shadowWidth?: 'sm' | 'md';
14
- spacerHue?: Hue;
15
- spacerShade?: number;
16
- spacerWidth?: null | 'xs' | 'sm';
17
- theme: IGardenTheme;
18
- };
7
+ import { FocusBoxShadowParameters } from '../types';
19
8
  /**
20
- * Get a CSS `box-shadow` property value for focus state styling. The `hue` and
21
- * `shade` are used to determine the color of the focus ring.
9
+ * Get a CSS `box-shadow` property value for focus state styling.
22
10
  *
23
11
  * @param {string} [options.boxShadow] Provides an existing `box-shadow` (a drop shadow, for example) to be retained along with the focus ring
24
12
  * @param {boolean} [options.inset=false] Determines whether the `box-shadow` is inset
25
- * @param {string|Object} [options.hue='primaryHue'] Provides a theme object `palette` hue or `color` key, or any valid CSS color notation
26
- * @param {number} [options.shade=600] Selects a shade for the given `hue`
13
+ * @param {Object} [options.color={ variable: 'border.primaryEmphasis' }] Provides an object with `getColor` parameters used to determine the focus ring color
27
14
  * @param {string} [options.shadowWidth='md'] Provides a theme object `shadowWidth` key for the cumulative width of the `box-shadow`
28
- * @param {string|Object} [options.spacerHue='background'] Provides a theme object `palette` hue or `color` key, or any valid CSS color notation
29
- * @param {number} [options.spacerShade=600] Selects a shade for the given `spacerHue`
15
+ * @param {Object} [options.spacerColor={ variable: 'background.default' }] Provides an object with `getColor` parameters used to determine the spacer color
30
16
  * @param {string} [options.spacerWidth='xs'] Provides a theme object `shadowWidth` for the white spacer, or `null` to remove
31
17
  * @param {Object} options.theme Provides values used to resolve the desired color
32
18
  *
33
19
  * @returns A `box-shadow` property value for the given options. Default is a
34
- * 3px `blue[600]` ring with a 1px white spacer overlay.
20
+ * 3px blue ring with a 1px spacer overlay that matches the background.
35
21
  */
36
- export declare const getFocusBoxShadow: ({ boxShadow, inset, hue, shade, shadowWidth, spacerHue, spacerShade, spacerWidth, theme }: FocusBoxShadowParameters) => string;
22
+ export declare const getFocusBoxShadow: ({ boxShadow, inset, color, shadowWidth, spacerColor, spacerWidth, theme, ...args }: FocusBoxShadowParameters) => string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zendeskgarden/react-theming",
3
- "version": "9.0.0-next.7",
3
+ "version": "9.0.0-next.9",
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>",
@@ -10,7 +10,7 @@
10
10
  "url": "https://github.com/zendeskgarden/react-components/issues"
11
11
  },
12
12
  "main": "dist/index.cjs.js",
13
- "module": "dist/index.esm.js",
13
+ "module": "dist/esm/index.js",
14
14
  "files": [
15
15
  "dist"
16
16
  ],
@@ -48,5 +48,5 @@
48
48
  "access": "public"
49
49
  },
50
50
  "zendeskgarden:src": "src/index.ts",
51
- "gitHead": "50a2b45b2e237a490a6d460818d33498b92479ec"
51
+ "gitHead": "771281b562d376a6aee04b0cd71dd888b3ae4a1d"
52
52
  }