@zendeskgarden/react-loaders 9.0.0-next.26 → 9.0.0-next.27

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.
@@ -31,7 +31,7 @@ const Progress = React.forwardRef((_ref, ref) => {
31
31
  return (
32
32
  React.createElement(StyledProgressBackground, Object.assign({
33
33
  "data-garden-id": COMPONENT_ID,
34
- "data-garden-version": '9.0.0-next.26',
34
+ "data-garden-version": '9.0.0-next.27',
35
35
  "aria-valuemax": 100,
36
36
  "aria-valuemin": 0,
37
37
  "aria-valuenow": percentage,
@@ -4,14 +4,28 @@
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 styled, { keyframes } from 'styled-components';
8
- import { retrieveComponentStyles } from '@zendeskgarden/react-theming';
7
+ import styled, { css, keyframes } from 'styled-components';
8
+ import { retrieveComponentStyles, getColor } from '@zendeskgarden/react-theming';
9
9
 
10
10
  const COMPONENT_ID = 'loaders.inline';
11
- const retrieveAnimation = _ref => {
11
+ const colorStyles = _ref => {
12
12
  let {
13
- theme
13
+ theme,
14
+ color
14
15
  } = _ref;
16
+ const options = color.includes('.') ? {
17
+ variable: color,
18
+ theme
19
+ } : {
20
+ hue: color,
21
+ theme
22
+ };
23
+ return css(["color:", ";"], getColor(options));
24
+ };
25
+ const retrieveAnimation = _ref2 => {
26
+ let {
27
+ theme
28
+ } = _ref2;
15
29
  return keyframes(["0%,100%{opacity:", ";}50%{opacity:", ";}"], theme.opacity[200], theme.opacity[600]);
16
30
  };
17
31
  const StyledCircle = styled.circle.attrs({
@@ -24,13 +38,13 @@ const StyledCircle = styled.circle.attrs({
24
38
  })([""]);
25
39
  const StyledInline = styled.svg.attrs(props => ({
26
40
  'data-garden-id': COMPONENT_ID,
27
- 'data-garden-version': '9.0.0-next.26',
41
+ 'data-garden-version': '9.0.0-next.27',
28
42
  viewBox: '0 0 16 4',
29
43
  width: props.size,
30
44
  height: props.size * 0.25
31
45
  })).withConfig({
32
46
  displayName: "StyledInline",
33
47
  componentId: "sc-fxsb9l-1"
34
- })(["color:", ";", "{opacity:0.2;&:nth-child(1){animation:", " 1s infinite;animation-delay:", ";}&:nth-child(2){animation:", " 1s infinite;animation-delay:0.2s;}&:nth-child(3){animation:", " 1s infinite;animation-delay:", ";}}", ""], props => props.color, StyledCircle, retrieveAnimation, props => props.theme.rtl ? 'unset' : '0.4s', retrieveAnimation, retrieveAnimation, props => props.theme.rtl ? '0.4s' : 'unset', props => retrieveComponentStyles(COMPONENT_ID, props));
48
+ })(["", ";", "{opacity:0.2;&:nth-child(1){animation:", " 1s infinite;animation-delay:", ";}&:nth-child(2){animation:", " 1s infinite;animation-delay:0.2s;}&:nth-child(3){animation:", " 1s infinite;animation-delay:", ";}}", ""], colorStyles, StyledCircle, retrieveAnimation, props => props.theme.rtl ? 'unset' : '0.4s', retrieveAnimation, retrieveAnimation, props => props.theme.rtl ? '0.4s' : 'unset', props => retrieveComponentStyles(COMPONENT_ID, props));
35
49
 
36
50
  export { StyledCircle, StyledInline };
@@ -10,7 +10,7 @@ import { retrieveComponentStyles } from '@zendeskgarden/react-theming';
10
10
  const COMPONENT_ID = 'loaders.loading_placeholder';
11
11
  const StyledLoadingPlaceholder = styled.div.attrs({
12
12
  'data-garden-id': COMPONENT_ID,
13
- 'data-garden-version': '9.0.0-next.26',
13
+ 'data-garden-version': '9.0.0-next.27',
14
14
  role: 'progressbar'
15
15
  }).withConfig({
16
16
  displayName: "StyledLoadingPlaceholder",
@@ -35,15 +35,27 @@ const colorStyles = _ref => {
35
35
  shade: 500
36
36
  }
37
37
  });
38
- const foregroundColor = color || getColor({
39
- theme,
40
- variable: 'border.successEmphasis'
41
- });
38
+ let options;
39
+ if (color) {
40
+ options = color.includes('.') ? {
41
+ variable: color,
42
+ theme
43
+ } : {
44
+ hue: color,
45
+ theme
46
+ };
47
+ } else {
48
+ options = {
49
+ variable: 'border.successEmphasis',
50
+ theme
51
+ };
52
+ }
53
+ const foregroundColor = getColor(options);
42
54
  return css(["background-color:", ";color:", ";"], backgroundColor, foregroundColor);
43
55
  };
44
56
  const StyledProgressBackground = styled.div.attrs(props => ({
45
57
  'data-garden-id': PROGRESS_BACKGROUND_COMPONENT_ID,
46
- 'data-garden-version': '9.0.0-next.26',
58
+ 'data-garden-version': '9.0.0-next.27',
47
59
  borderRadius: props.borderRadius || sizeToBorderRadius(props.size, props.theme)
48
60
  })).withConfig({
49
61
  displayName: "StyledProgress__StyledProgressBackground",
@@ -52,7 +64,7 @@ const StyledProgressBackground = styled.div.attrs(props => ({
52
64
  const PROGESS_INDICATOR_COMPONENT_ID = 'loaders.progress_indicator';
53
65
  const StyledProgressIndicator = styled.div.attrs(props => ({
54
66
  'data-garden-id': PROGESS_INDICATOR_COMPONENT_ID,
55
- 'data-garden-version': '9.0.0-next.26',
67
+ 'data-garden-version': '9.0.0-next.27',
56
68
  height: props.height || sizeToHeight(props.size, props.theme),
57
69
  borderRadius: props.borderRadius || sizeToBorderRadius(props.size, props.theme)
58
70
  })).withConfig({
@@ -4,11 +4,25 @@
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 styled from 'styled-components';
8
- import { retrieveComponentStyles } from '@zendeskgarden/react-theming';
7
+ import styled, { css } from 'styled-components';
8
+ import { retrieveComponentStyles, getColor } from '@zendeskgarden/react-theming';
9
9
 
10
+ const colorStyles = _ref => {
11
+ let {
12
+ theme,
13
+ color = 'inherit'
14
+ } = _ref;
15
+ const options = color.includes('.') ? {
16
+ variable: color,
17
+ theme
18
+ } : {
19
+ hue: color,
20
+ theme
21
+ };
22
+ return css(["color:", ";"], getColor(options));
23
+ };
10
24
  const StyledSVG = styled.svg.attrs(props => ({
11
- 'data-garden-version': '9.0.0-next.26',
25
+ 'data-garden-version': '9.0.0-next.27',
12
26
  xmlns: 'http://www.w3.org/2000/svg',
13
27
  width: props.width,
14
28
  height: props.height,
@@ -18,6 +32,6 @@ const StyledSVG = styled.svg.attrs(props => ({
18
32
  })).withConfig({
19
33
  displayName: "StyledSVG",
20
34
  componentId: "sc-1xtc3kx-0"
21
- })(["width:", ";height:", ";color:", ";font-size:", ";", ";"], props => props.containerWidth || '1em', props => props.containerHeight || '0.9em', props => props.color || 'inherit', props => props.fontSize || 'inherit', props => retrieveComponentStyles(props.dataGardenId, props));
35
+ })(["width:", ";height:", ";font-size:", ";", ";", ";"], props => props.containerWidth || '1em', props => props.containerHeight || '0.9em', props => props.fontSize || 'inherit', colorStyles, props => retrieveComponentStyles(props.dataGardenId, props));
22
36
 
23
37
  export { StyledSVG };
@@ -52,7 +52,7 @@ const gradientStyles = props => {
52
52
  };
53
53
  const StyledSkeleton = styled.div.attrs({
54
54
  'data-garden-id': COMPONENT_ID,
55
- 'data-garden-version': '9.0.0-next.26'
55
+ 'data-garden-version': '9.0.0-next.27'
56
56
  }).withConfig({
57
57
  displayName: "StyledSkeleton",
58
58
  componentId: "sc-1raozze-0"
package/dist/index.cjs.js CHANGED
@@ -54,7 +54,7 @@ const StyledDotsCircleThree = styled__default.default(StyledDotsCircle).attrs(()
54
54
  const COMPONENT_ID$5 = 'loaders.loading_placeholder';
55
55
  const StyledLoadingPlaceholder = styled__default.default.div.attrs({
56
56
  'data-garden-id': COMPONENT_ID$5,
57
- 'data-garden-version': '9.0.0-next.26',
57
+ 'data-garden-version': '9.0.0-next.27',
58
58
  role: 'progressbar'
59
59
  }).withConfig({
60
60
  displayName: "StyledLoadingPlaceholder",
@@ -73,7 +73,7 @@ const sizeToHeight = (size, theme) => {
73
73
  };
74
74
  const sizeToBorderRadius = (size, theme) => sizeToHeight(size, theme) / 2;
75
75
  const PROGRESS_BACKGROUND_COMPONENT_ID = 'loaders.progress_background';
76
- const colorStyles = _ref => {
76
+ const colorStyles$2 = _ref => {
77
77
  let {
78
78
  theme,
79
79
  color
@@ -89,24 +89,36 @@ const colorStyles = _ref => {
89
89
  shade: 500
90
90
  }
91
91
  });
92
- const foregroundColor = color || reactTheming.getColor({
93
- theme,
94
- variable: 'border.successEmphasis'
95
- });
92
+ let options;
93
+ if (color) {
94
+ options = color.includes('.') ? {
95
+ variable: color,
96
+ theme
97
+ } : {
98
+ hue: color,
99
+ theme
100
+ };
101
+ } else {
102
+ options = {
103
+ variable: 'border.successEmphasis',
104
+ theme
105
+ };
106
+ }
107
+ const foregroundColor = reactTheming.getColor(options);
96
108
  return styled.css(["background-color:", ";color:", ";"], backgroundColor, foregroundColor);
97
109
  };
98
110
  const StyledProgressBackground = styled__default.default.div.attrs(props => ({
99
111
  'data-garden-id': PROGRESS_BACKGROUND_COMPONENT_ID,
100
- 'data-garden-version': '9.0.0-next.26',
112
+ 'data-garden-version': '9.0.0-next.27',
101
113
  borderRadius: props.borderRadius || sizeToBorderRadius(props.size, props.theme)
102
114
  })).withConfig({
103
115
  displayName: "StyledProgress__StyledProgressBackground",
104
116
  componentId: "sc-2g8w4s-0"
105
- })(["margin:", "px 0;border-radius:", "px;", ";", ""], props => props.theme.space.base * 2, props => props.borderRadius, colorStyles, props => reactTheming.retrieveComponentStyles(PROGRESS_BACKGROUND_COMPONENT_ID, props));
117
+ })(["margin:", "px 0;border-radius:", "px;", ";", ""], props => props.theme.space.base * 2, props => props.borderRadius, colorStyles$2, props => reactTheming.retrieveComponentStyles(PROGRESS_BACKGROUND_COMPONENT_ID, props));
106
118
  const PROGESS_INDICATOR_COMPONENT_ID = 'loaders.progress_indicator';
107
119
  const StyledProgressIndicator = styled__default.default.div.attrs(props => ({
108
120
  'data-garden-id': PROGESS_INDICATOR_COMPONENT_ID,
109
- 'data-garden-version': '9.0.0-next.26',
121
+ 'data-garden-version': '9.0.0-next.27',
110
122
  height: props.height || sizeToHeight(props.size, props.theme),
111
123
  borderRadius: props.borderRadius || sizeToBorderRadius(props.size, props.theme)
112
124
  })).withConfig({
@@ -159,7 +171,7 @@ const gradientStyles = props => {
159
171
  };
160
172
  const StyledSkeleton = styled__default.default.div.attrs({
161
173
  'data-garden-id': COMPONENT_ID$4,
162
- 'data-garden-version': '9.0.0-next.26'
174
+ 'data-garden-version': '9.0.0-next.27'
163
175
  }).withConfig({
164
176
  displayName: "StyledSkeleton",
165
177
  componentId: "sc-1raozze-0"
@@ -180,8 +192,22 @@ const StyledSpinnerCircle = styled__default.default.circle.attrs(props => ({
180
192
  componentId: "sc-o4kd70-0"
181
193
  })([""]);
182
194
 
195
+ const colorStyles$1 = _ref => {
196
+ let {
197
+ theme,
198
+ color = 'inherit'
199
+ } = _ref;
200
+ const options = color.includes('.') ? {
201
+ variable: color,
202
+ theme
203
+ } : {
204
+ hue: color,
205
+ theme
206
+ };
207
+ return styled.css(["color:", ";"], reactTheming.getColor(options));
208
+ };
183
209
  const StyledSVG = styled__default.default.svg.attrs(props => ({
184
- 'data-garden-version': '9.0.0-next.26',
210
+ 'data-garden-version': '9.0.0-next.27',
185
211
  xmlns: 'http://www.w3.org/2000/svg',
186
212
  width: props.width,
187
213
  height: props.height,
@@ -191,13 +217,27 @@ const StyledSVG = styled__default.default.svg.attrs(props => ({
191
217
  })).withConfig({
192
218
  displayName: "StyledSVG",
193
219
  componentId: "sc-1xtc3kx-0"
194
- })(["width:", ";height:", ";color:", ";font-size:", ";", ";"], props => props.containerWidth || '1em', props => props.containerHeight || '0.9em', props => props.color || 'inherit', props => props.fontSize || 'inherit', props => reactTheming.retrieveComponentStyles(props.dataGardenId, props));
220
+ })(["width:", ";height:", ";font-size:", ";", ";", ";"], props => props.containerWidth || '1em', props => props.containerHeight || '0.9em', props => props.fontSize || 'inherit', colorStyles$1, props => reactTheming.retrieveComponentStyles(props.dataGardenId, props));
195
221
 
196
222
  const COMPONENT_ID$3 = 'loaders.inline';
197
- const retrieveAnimation = _ref => {
223
+ const colorStyles = _ref => {
198
224
  let {
199
- theme
225
+ theme,
226
+ color
200
227
  } = _ref;
228
+ const options = color.includes('.') ? {
229
+ variable: color,
230
+ theme
231
+ } : {
232
+ hue: color,
233
+ theme
234
+ };
235
+ return styled.css(["color:", ";"], reactTheming.getColor(options));
236
+ };
237
+ const retrieveAnimation = _ref2 => {
238
+ let {
239
+ theme
240
+ } = _ref2;
201
241
  return styled.keyframes(["0%,100%{opacity:", ";}50%{opacity:", ";}"], theme.opacity[200], theme.opacity[600]);
202
242
  };
203
243
  const StyledCircle = styled__default.default.circle.attrs({
@@ -210,14 +250,14 @@ const StyledCircle = styled__default.default.circle.attrs({
210
250
  })([""]);
211
251
  const StyledInline = styled__default.default.svg.attrs(props => ({
212
252
  'data-garden-id': COMPONENT_ID$3,
213
- 'data-garden-version': '9.0.0-next.26',
253
+ 'data-garden-version': '9.0.0-next.27',
214
254
  viewBox: '0 0 16 4',
215
255
  width: props.size,
216
256
  height: props.size * 0.25
217
257
  })).withConfig({
218
258
  displayName: "StyledInline",
219
259
  componentId: "sc-fxsb9l-1"
220
- })(["color:", ";", "{opacity:0.2;&:nth-child(1){animation:", " 1s infinite;animation-delay:", ";}&:nth-child(2){animation:", " 1s infinite;animation-delay:0.2s;}&:nth-child(3){animation:", " 1s infinite;animation-delay:", ";}}", ""], props => props.color, StyledCircle, retrieveAnimation, props => props.theme.rtl ? 'unset' : '0.4s', retrieveAnimation, retrieveAnimation, props => props.theme.rtl ? '0.4s' : 'unset', props => reactTheming.retrieveComponentStyles(COMPONENT_ID$3, props));
260
+ })(["", ";", "{opacity:0.2;&:nth-child(1){animation:", " 1s infinite;animation-delay:", ";}&:nth-child(2){animation:", " 1s infinite;animation-delay:0.2s;}&:nth-child(3){animation:", " 1s infinite;animation-delay:", ";}}", ""], colorStyles, StyledCircle, retrieveAnimation, props => props.theme.rtl ? 'unset' : '0.4s', retrieveAnimation, retrieveAnimation, props => props.theme.rtl ? '0.4s' : 'unset', props => reactTheming.retrieveComponentStyles(COMPONENT_ID$3, props));
221
261
 
222
262
  const COMPONENT_ID$2 = 'loaders.dots';
223
263
  const Dots = React.forwardRef((_ref, ref) => {
@@ -309,7 +349,7 @@ const Progress = React__default.default.forwardRef((_ref, ref) => {
309
349
  return (
310
350
  React__default.default.createElement(StyledProgressBackground, Object.assign({
311
351
  "data-garden-id": COMPONENT_ID$1,
312
- "data-garden-version": '9.0.0-next.26',
352
+ "data-garden-version": '9.0.0-next.27',
313
353
  "aria-valuemax": 100,
314
354
  "aria-valuemin": 0,
315
355
  "aria-valuenow": percentage,
@@ -5,14 +5,14 @@
5
5
  * found at http://www.apache.org/licenses/LICENSE-2.0.
6
6
  */
7
7
  import { DefaultTheme } from 'styled-components';
8
+ interface IStyledInlineProps {
9
+ size: number;
10
+ color: string;
11
+ }
8
12
  export declare const StyledCircle: import("styled-components").StyledComponent<"circle", DefaultTheme, {
9
13
  fill: "currentColor";
10
14
  cy: 2;
11
15
  r: 2;
12
16
  }, "cy" | "fill" | "r">;
13
- interface IStyledInlineProps {
14
- size: number;
15
- color: string;
16
- }
17
17
  export declare const StyledInline: import("styled-components").StyledComponent<"svg", DefaultTheme, IStyledInlineProps, never>;
18
18
  export {};
@@ -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
+ import { DefaultTheme } from 'styled-components';
7
8
  interface IStyledSVGProps {
8
9
  dataGardenId: string;
9
10
  color?: string;
@@ -13,5 +14,5 @@ interface IStyledSVGProps {
13
14
  containerWidth?: string;
14
15
  containerHeight?: string;
15
16
  }
16
- export declare const StyledSVG: import("styled-components").StyledComponent<"svg", import("styled-components").DefaultTheme, IStyledSVGProps, never>;
17
+ export declare const StyledSVG: import("styled-components").StyledComponent<"svg", DefaultTheme, IStyledSVGProps, never>;
17
18
  export {};
@@ -10,7 +10,12 @@ export type Size = (typeof SIZE)[number];
10
10
  export interface IDotsProps extends SVGAttributes<SVGSVGElement> {
11
11
  /** Sets the height and width in pixels. Inherits the parent's font size by default. */
12
12
  size?: string | number;
13
- /** Sets the fill color. Inherits the parent's `color` by default. */
13
+ /**
14
+ * Sets the fill color. Accepts a [color
15
+ * variable](/components/theme-object#colors) key (i.e. `foreground.primary`)
16
+ * to render based on light/dark mode, or any hex value. Inherits the parent's
17
+ * `color` by default.
18
+ */
14
19
  color?: string;
15
20
  /** Sets the length of the animation cycle in milliseconds **/
16
21
  duration?: number;
@@ -20,15 +25,23 @@ export interface IDotsProps extends SVGAttributes<SVGSVGElement> {
20
25
  export interface IInlineProps extends SVGAttributes<SVGSVGElement> {
21
26
  /** Sets the width in pixels and scales the loader proportionally */
22
27
  size?: number;
23
- /** Sets the fill color. Inherits the parent's `color` by default. */
28
+ /**
29
+ * Sets the fill color. Accepts a [color
30
+ * variable](/components/theme-object#colors) key (i.e. `foreground.primary`)
31
+ * to render based on light/dark mode, or any hex value. Inherits the parent's
32
+ * `color` by default.
33
+ */
24
34
  color?: string;
25
35
  }
26
36
  export interface IProgressProps extends HTMLAttributes<HTMLDivElement> {
27
37
  /** Sets the progress as a value between 0 and 100 */
28
38
  value?: number;
29
39
  /**
30
- * Sets the foreground bar's fill color.
31
- * Defaults to the `successHue` [theme](/components/theme-object#colors) value.
40
+ * Sets the foreground bar's fill color. Accepts a [color
41
+ * variable](/components/theme-object#colors) key (i.e.
42
+ * `border.primaryEmphasis`) to render based on light/dark mode, or any hex
43
+ * value. Defaults to the `border.successEmphasis`
44
+ * [theme](/components/theme-object#variables) value.
32
45
  */
33
46
  color?: string;
34
47
  /** Adjusts the height */
@@ -52,8 +65,11 @@ export interface ISpinnerProps extends SVGAttributes<SVGSVGElement> {
52
65
  **/
53
66
  duration?: number;
54
67
  /**
55
- * Sets the fill color. Inherits the parent's `color` by default.
56
- **/
68
+ * Sets the fill color. Accepts a [color
69
+ * variable](/components/theme-object#colors) key (i.e. `foreground.primary`)
70
+ * to render based on light/dark mode, or any hex value. Inherits the parent's
71
+ * `color` by default.
72
+ */
57
73
  color?: string;
58
74
  /**
59
75
  * Delays displaying the loader to prevent a render flash during normal loading times
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zendeskgarden/react-loaders",
3
- "version": "9.0.0-next.26",
3
+ "version": "9.0.0-next.27",
4
4
  "description": "Components relating to loaders in the Garden Design System",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Zendesk Garden <garden@zendesk.com>",
@@ -32,7 +32,7 @@
32
32
  "styled-components": "^5.3.1"
33
33
  },
34
34
  "devDependencies": {
35
- "@zendeskgarden/react-theming": "^9.0.0-next.26"
35
+ "@zendeskgarden/react-theming": "^9.0.0-next.27"
36
36
  },
37
37
  "keywords": [
38
38
  "components",
@@ -44,5 +44,5 @@
44
44
  "access": "public"
45
45
  },
46
46
  "zendeskgarden:src": "src/index.ts",
47
- "gitHead": "049dd7bd143029147de333f78bd879dc7d7251f2"
47
+ "gitHead": "1e33779f9a7a284af3eda1405fa624c00e739a6a"
48
48
  }