@spark-web/spinner 2.0.0-rc.0 → 2.0.0-rc.2

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/CHANGELOG.md CHANGED
@@ -1,5 +1,33 @@
1
1
  # @spark-web/spinner
2
2
 
3
+ ## 2.0.0-rc.2
4
+
5
+ ### Major Changes
6
+
7
+ - add parser
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies []:
12
+ - @spark-web/utils@2.0.0-rc.2
13
+ - @spark-web/a11y@2.0.0-rc.2
14
+ - @spark-web/icon@2.0.0-rc.2
15
+ - @spark-web/box@2.0.0-rc.2
16
+
17
+ ## 2.0.0-rc.1
18
+
19
+ ### Major Changes
20
+
21
+ - rc
22
+
23
+ ### Patch Changes
24
+
25
+ - Updated dependencies []:
26
+ - @spark-web/utils@2.0.0-rc.1
27
+ - @spark-web/a11y@2.0.0-rc.1
28
+ - @spark-web/icon@2.0.0-rc.1
29
+ - @spark-web/box@2.0.0-rc.1
30
+
3
31
  ## 2.0.0-rc.0
4
32
 
5
33
  ### Major Changes
@@ -0,0 +1,2 @@
1
+ export { Spinner } from "./spinner.js";
2
+ export type { SpinnerProps } from "./spinner.js";
@@ -0,0 +1,14 @@
1
+ import type { IconProps } from '@spark-web/icon';
2
+ import type { DataAttributeMap } from '@spark-web/utils/internal';
3
+ export declare type SpinnerProps = {
4
+ /** Provide a tone to influence elements of the field, and its input. */
5
+ tone?: IconProps['tone'];
6
+ /** The size of the nested radios. */
7
+ size?: 'xxsmall' | 'xsmall';
8
+ /** Sets data attributes for the element. */
9
+ data?: DataAttributeMap;
10
+ };
11
+ export declare function Spinner({ tone, size, data }: SpinnerProps): import("@emotion/react/jsx-runtime").JSX.Element;
12
+ export declare namespace Spinner {
13
+ var displayName: string;
14
+ }
@@ -1,2 +1,2 @@
1
- export * from "../src/index";
2
- //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3Bhcmstd2ViLXNwaW5uZXIuY2pzLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvaW5kZXgudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEifQ==
1
+ export * from "./declarations/src/index";
2
+ //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic3Bhcmstd2ViLXNwaW5uZXIuY2pzLmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuL2RlY2xhcmF0aW9ucy9zcmMvaW5kZXguZC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSJ9
@@ -0,0 +1,73 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var react = require('@emotion/react');
6
+ var a11y = require('@spark-web/a11y');
7
+ var box = require('@spark-web/box');
8
+ var icon = require('@spark-web/icon');
9
+ var utils = require('@spark-web/utils');
10
+ var jsxRuntime = require('@emotion/react/jsx-runtime');
11
+
12
+ function Spinner(_ref) {
13
+ var tone = _ref.tone,
14
+ _ref$size = _ref.size,
15
+ size = _ref$size === void 0 ? 'xxsmall' : _ref$size,
16
+ data = _ref.data;
17
+ var spinAnimationRef = utils.useSynchronizedAnimation(spinAnimation);
18
+ var strokeAnimationRef = utils.useSynchronizedAnimation(strokeDashAnimation);
19
+ var styles = useSpinnerStyles();
20
+ return jsxRuntime.jsxs(box.Box, {
21
+ as: "span",
22
+ ref: spinAnimationRef,
23
+ css: react.css(styles),
24
+ height: size,
25
+ width: size,
26
+ display: "inline-flex",
27
+ alignItems: "center",
28
+ justifyContent: "center",
29
+ data: data,
30
+ children: [jsxRuntime.jsx(a11y.VisuallyHidden, {
31
+ children: "Image of a partial circle indicating \"loading\"."
32
+ }), jsxRuntime.jsx(SpinnerIcon, {
33
+ size: size,
34
+ tone: tone,
35
+ ref: strokeAnimationRef,
36
+ "aria-hidden": "true"
37
+ })]
38
+ });
39
+ }
40
+ Spinner.displayName = 'Spinner';
41
+ var SpinnerIcon = icon.createIcon(jsxRuntime.jsx("circle", {
42
+ cx: 12,
43
+ cy: 12,
44
+ r: 9
45
+ }), 'SpinnerIcon');
46
+ var spinAnimation = react.keyframes({
47
+ from: {
48
+ transform: 'rotate(0deg)'
49
+ },
50
+ to: {
51
+ transform: 'rotate(360deg)'
52
+ }
53
+ });
54
+ var strokeDashAnimation = react.keyframes({
55
+ '0%': {
56
+ strokeDasharray: '1px, 200px',
57
+ strokeDashoffset: 0
58
+ },
59
+ '100%': {
60
+ strokeDasharray: '200px, 200px',
61
+ strokeDashoffset: '-55px'
62
+ }
63
+ });
64
+ function useSpinnerStyles() {
65
+ return {
66
+ animation: "".concat(spinAnimation, " 1.4s linear infinite"),
67
+ '& circle': {
68
+ animation: "".concat(strokeDashAnimation, " 1.6s cubic-bezier(0.47, 0, 0.75, 0.72) infinite")
69
+ }
70
+ };
71
+ }
72
+
73
+ exports.Spinner = Spinner;
@@ -1,16 +1,7 @@
1
- "use strict";
2
- // this file might look strange and you might be wondering what it's for
3
- // it's lets you import your source files by importing this entrypoint
4
- // as you would import it if it was built with preconstruct build
5
- // this file is slightly different to some others though
6
- // it has a require hook which compiles your code with Babel
7
- // this means that you don't have to set up @babel/register or anything like that
8
- // but you can still require this module and it'll be compiled
1
+ 'use strict';
9
2
 
10
- // this bit of code imports the require hook and registers it
11
- let unregister = require("../../../node_modules/@preconstruct/hook").___internalHook(typeof __dirname === 'undefined' ? undefined : __dirname, "../../..", "..");
12
-
13
- // this re-exports the source file
14
- module.exports = require("../src/index.ts");
15
-
16
- unregister();
3
+ if (process.env.NODE_ENV === "production") {
4
+ module.exports = require("./spark-web-spinner.cjs.prod.js");
5
+ } else {
6
+ module.exports = require("./spark-web-spinner.cjs.dev.js");
7
+ }
@@ -0,0 +1,73 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var react = require('@emotion/react');
6
+ var a11y = require('@spark-web/a11y');
7
+ var box = require('@spark-web/box');
8
+ var icon = require('@spark-web/icon');
9
+ var utils = require('@spark-web/utils');
10
+ var jsxRuntime = require('@emotion/react/jsx-runtime');
11
+
12
+ function Spinner(_ref) {
13
+ var tone = _ref.tone,
14
+ _ref$size = _ref.size,
15
+ size = _ref$size === void 0 ? 'xxsmall' : _ref$size,
16
+ data = _ref.data;
17
+ var spinAnimationRef = utils.useSynchronizedAnimation(spinAnimation);
18
+ var strokeAnimationRef = utils.useSynchronizedAnimation(strokeDashAnimation);
19
+ var styles = useSpinnerStyles();
20
+ return jsxRuntime.jsxs(box.Box, {
21
+ as: "span",
22
+ ref: spinAnimationRef,
23
+ css: react.css(styles),
24
+ height: size,
25
+ width: size,
26
+ display: "inline-flex",
27
+ alignItems: "center",
28
+ justifyContent: "center",
29
+ data: data,
30
+ children: [jsxRuntime.jsx(a11y.VisuallyHidden, {
31
+ children: "Image of a partial circle indicating \"loading\"."
32
+ }), jsxRuntime.jsx(SpinnerIcon, {
33
+ size: size,
34
+ tone: tone,
35
+ ref: strokeAnimationRef,
36
+ "aria-hidden": "true"
37
+ })]
38
+ });
39
+ }
40
+ Spinner.displayName = 'Spinner';
41
+ var SpinnerIcon = icon.createIcon(jsxRuntime.jsx("circle", {
42
+ cx: 12,
43
+ cy: 12,
44
+ r: 9
45
+ }), 'SpinnerIcon');
46
+ var spinAnimation = react.keyframes({
47
+ from: {
48
+ transform: 'rotate(0deg)'
49
+ },
50
+ to: {
51
+ transform: 'rotate(360deg)'
52
+ }
53
+ });
54
+ var strokeDashAnimation = react.keyframes({
55
+ '0%': {
56
+ strokeDasharray: '1px, 200px',
57
+ strokeDashoffset: 0
58
+ },
59
+ '100%': {
60
+ strokeDasharray: '200px, 200px',
61
+ strokeDashoffset: '-55px'
62
+ }
63
+ });
64
+ function useSpinnerStyles() {
65
+ return {
66
+ animation: "".concat(spinAnimation, " 1.4s linear infinite"),
67
+ '& circle': {
68
+ animation: "".concat(strokeDashAnimation, " 1.6s cubic-bezier(0.47, 0, 0.75, 0.72) infinite")
69
+ }
70
+ };
71
+ }
72
+
73
+ exports.Spinner = Spinner;
@@ -0,0 +1,69 @@
1
+ import { keyframes, css } from '@emotion/react';
2
+ import { VisuallyHidden } from '@spark-web/a11y';
3
+ import { Box } from '@spark-web/box';
4
+ import { createIcon } from '@spark-web/icon';
5
+ import { useSynchronizedAnimation } from '@spark-web/utils';
6
+ import { jsx, jsxs } from '@emotion/react/jsx-runtime';
7
+
8
+ function Spinner(_ref) {
9
+ var tone = _ref.tone,
10
+ _ref$size = _ref.size,
11
+ size = _ref$size === void 0 ? 'xxsmall' : _ref$size,
12
+ data = _ref.data;
13
+ var spinAnimationRef = useSynchronizedAnimation(spinAnimation);
14
+ var strokeAnimationRef = useSynchronizedAnimation(strokeDashAnimation);
15
+ var styles = useSpinnerStyles();
16
+ return jsxs(Box, {
17
+ as: "span",
18
+ ref: spinAnimationRef,
19
+ css: css(styles),
20
+ height: size,
21
+ width: size,
22
+ display: "inline-flex",
23
+ alignItems: "center",
24
+ justifyContent: "center",
25
+ data: data,
26
+ children: [jsx(VisuallyHidden, {
27
+ children: "Image of a partial circle indicating \"loading\"."
28
+ }), jsx(SpinnerIcon, {
29
+ size: size,
30
+ tone: tone,
31
+ ref: strokeAnimationRef,
32
+ "aria-hidden": "true"
33
+ })]
34
+ });
35
+ }
36
+ Spinner.displayName = 'Spinner';
37
+ var SpinnerIcon = createIcon(jsx("circle", {
38
+ cx: 12,
39
+ cy: 12,
40
+ r: 9
41
+ }), 'SpinnerIcon');
42
+ var spinAnimation = keyframes({
43
+ from: {
44
+ transform: 'rotate(0deg)'
45
+ },
46
+ to: {
47
+ transform: 'rotate(360deg)'
48
+ }
49
+ });
50
+ var strokeDashAnimation = keyframes({
51
+ '0%': {
52
+ strokeDasharray: '1px, 200px',
53
+ strokeDashoffset: 0
54
+ },
55
+ '100%': {
56
+ strokeDasharray: '200px, 200px',
57
+ strokeDashoffset: '-55px'
58
+ }
59
+ });
60
+ function useSpinnerStyles() {
61
+ return {
62
+ animation: "".concat(spinAnimation, " 1.4s linear infinite"),
63
+ '& circle': {
64
+ animation: "".concat(strokeDashAnimation, " 1.6s cubic-bezier(0.47, 0, 0.75, 0.72) infinite")
65
+ }
66
+ };
67
+ }
68
+
69
+ export { Spinner };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spark-web/spinner",
3
- "version": "2.0.0-rc.0",
3
+ "version": "2.0.0-rc.2",
4
4
  "homepage": "https://github.com/brighte-labs/spark-web#readme",
5
5
  "repository": {
6
6
  "type": "git",
@@ -17,10 +17,10 @@
17
17
  "dependencies": {
18
18
  "@babel/runtime": "^7.25.0",
19
19
  "@emotion/react": "^11.13.5",
20
- "@spark-web/a11y": "^2.0.0-rc.0",
21
- "@spark-web/box": "^2.0.0-rc.0",
22
- "@spark-web/icon": "^2.0.0-rc.0",
23
- "@spark-web/utils": "^2.0.0-rc.0"
20
+ "@spark-web/a11y": "^2.0.0-rc.2",
21
+ "@spark-web/box": "^2.0.0-rc.2",
22
+ "@spark-web/icon": "^2.0.0-rc.2",
23
+ "@spark-web/utils": "^2.0.0-rc.2"
24
24
  },
25
25
  "devDependencies": {
26
26
  "@types/react": "^18.2.0",