@spark-web/spinner 1.0.2 → 1.0.3

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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  title: Spinner
3
- storybookPath: feedback-overlays-spinner-—default
3
+ storybookPath: feedback-overlays-spinner--default
4
4
  ---
5
5
 
6
6
  Spinner indicates users that their request is in progress
@@ -19,22 +19,22 @@ const tones = ['secondary', 'critical', 'positive', 'neutral'];
19
19
  return (
20
20
  <Stack align="left" gap="xxlarge">
21
21
  <Inline gap="xxlarge">
22
- {tones.map((tone, index) => (
23
- <Button tone={tone} prominence="low" key={`low-btn-${index}`}>
22
+ {tones.map(tone => (
23
+ <Button tone={tone} prominence="low" key={tone}>
24
24
  <Spinner />
25
25
  </Button>
26
26
  ))}
27
27
  </Inline>
28
28
  <Inline gap="xxlarge">
29
- {tones.map((tone, index) => (
30
- <Button tone={tone} key={`btn-${index}`}>
29
+ {tones.map(tone => (
30
+ <Button tone={tone} key={tone}>
31
31
  <Spinner />
32
32
  </Button>
33
33
  ))}
34
34
  </Inline>
35
35
  <Inline gap="xxlarge">
36
- {tones.map((tone, index) => (
37
- <Spinner tone={tone} key={`spinner-${index}`} />
36
+ {tones.map(tone => (
37
+ <Spinner tone={tone} key={tone} />
38
38
  ))}
39
39
  </Inline>
40
40
  </Stack>
@@ -3,6 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var css = require('@emotion/css');
6
+ var a11y = require('@spark-web/a11y');
6
7
  var box = require('@spark-web/box');
7
8
  var icon = require('@spark-web/icon');
8
9
  var utils = require('@spark-web/utils');
@@ -16,7 +17,7 @@ function Spinner(_ref) {
16
17
  var spinAnimationRef = utils.useSynchronizedAnimation(spinAnimation);
17
18
  var strokeAnimationRef = utils.useSynchronizedAnimation(strokeDashAnimation);
18
19
  var styles = useSpinnerStyles();
19
- return /*#__PURE__*/jsxRuntime.jsx(box.Box, {
20
+ return /*#__PURE__*/jsxRuntime.jsxs(box.Box, {
20
21
  as: "span",
21
22
  ref: spinAnimationRef,
22
23
  className: css.css(styles),
@@ -26,11 +27,14 @@ function Spinner(_ref) {
26
27
  alignItems: "center",
27
28
  justifyContent: "center",
28
29
  data: data,
29
- children: /*#__PURE__*/jsxRuntime.jsx(SpinnerIcon, {
30
+ children: [/*#__PURE__*/jsxRuntime.jsx(a11y.VisuallyHidden, {
31
+ children: "Image of a partial circle indicating \"loading\"."
32
+ }), /*#__PURE__*/jsxRuntime.jsx(SpinnerIcon, {
30
33
  size: size,
31
34
  tone: tone,
32
- ref: strokeAnimationRef
33
- })
35
+ ref: strokeAnimationRef,
36
+ "aria-hidden": "true"
37
+ })]
34
38
  });
35
39
  }
36
40
  Spinner.displayName = 'Spinner';
@@ -3,6 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var css = require('@emotion/css');
6
+ var a11y = require('@spark-web/a11y');
6
7
  var box = require('@spark-web/box');
7
8
  var icon = require('@spark-web/icon');
8
9
  var utils = require('@spark-web/utils');
@@ -16,7 +17,7 @@ function Spinner(_ref) {
16
17
  var spinAnimationRef = utils.useSynchronizedAnimation(spinAnimation);
17
18
  var strokeAnimationRef = utils.useSynchronizedAnimation(strokeDashAnimation);
18
19
  var styles = useSpinnerStyles();
19
- return /*#__PURE__*/jsxRuntime.jsx(box.Box, {
20
+ return /*#__PURE__*/jsxRuntime.jsxs(box.Box, {
20
21
  as: "span",
21
22
  ref: spinAnimationRef,
22
23
  className: css.css(styles),
@@ -26,11 +27,14 @@ function Spinner(_ref) {
26
27
  alignItems: "center",
27
28
  justifyContent: "center",
28
29
  data: data,
29
- children: /*#__PURE__*/jsxRuntime.jsx(SpinnerIcon, {
30
+ children: [/*#__PURE__*/jsxRuntime.jsx(a11y.VisuallyHidden, {
31
+ children: "Image of a partial circle indicating \"loading\"."
32
+ }), /*#__PURE__*/jsxRuntime.jsx(SpinnerIcon, {
30
33
  size: size,
31
34
  tone: tone,
32
- ref: strokeAnimationRef
33
- })
35
+ ref: strokeAnimationRef,
36
+ "aria-hidden": "true"
37
+ })]
34
38
  });
35
39
  }
36
40
  Spinner.displayName = 'Spinner';
@@ -1,8 +1,9 @@
1
1
  import { keyframes, css } from '@emotion/css';
2
+ import { VisuallyHidden } from '@spark-web/a11y';
2
3
  import { Box } from '@spark-web/box';
3
4
  import { createIcon } from '@spark-web/icon';
4
5
  import { useSynchronizedAnimation } from '@spark-web/utils';
5
- import { jsx } from 'react/jsx-runtime';
6
+ import { jsx, jsxs } from 'react/jsx-runtime';
6
7
 
7
8
  function Spinner(_ref) {
8
9
  var tone = _ref.tone,
@@ -12,7 +13,7 @@ function Spinner(_ref) {
12
13
  var spinAnimationRef = useSynchronizedAnimation(spinAnimation);
13
14
  var strokeAnimationRef = useSynchronizedAnimation(strokeDashAnimation);
14
15
  var styles = useSpinnerStyles();
15
- return /*#__PURE__*/jsx(Box, {
16
+ return /*#__PURE__*/jsxs(Box, {
16
17
  as: "span",
17
18
  ref: spinAnimationRef,
18
19
  className: css(styles),
@@ -22,11 +23,14 @@ function Spinner(_ref) {
22
23
  alignItems: "center",
23
24
  justifyContent: "center",
24
25
  data: data,
25
- children: /*#__PURE__*/jsx(SpinnerIcon, {
26
+ children: [/*#__PURE__*/jsx(VisuallyHidden, {
27
+ children: "Image of a partial circle indicating \"loading\"."
28
+ }), /*#__PURE__*/jsx(SpinnerIcon, {
26
29
  size: size,
27
30
  tone: tone,
28
- ref: strokeAnimationRef
29
- })
31
+ ref: strokeAnimationRef,
32
+ "aria-hidden": "true"
33
+ })]
30
34
  });
31
35
  }
32
36
  Spinner.displayName = 'Spinner';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spark-web/spinner",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "license": "MIT",
5
5
  "main": "dist/spark-web-spinner.cjs.js",
6
6
  "module": "dist/spark-web-spinner.esm.js",
@@ -10,6 +10,7 @@
10
10
  "dependencies": {
11
11
  "@babel/runtime": "^7.18.0",
12
12
  "@emotion/css": "^11.9.0",
13
+ "@spark-web/a11y": "^1.0.5",
13
14
  "@spark-web/box": "^1.0.5",
14
15
  "@spark-web/icon": "^1.1.3",
15
16
  "@spark-web/utils": "^1.1.3"