@salt-ds/core 1.65.0 → 1.65.1
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 +8 -0
- package/css/salt-core.css +12 -3
- package/dist-cjs/spinner/Spinner.css.js +1 -1
- package/dist-cjs/spinner/Spinner.js +4 -5
- package/dist-cjs/spinner/Spinner.js.map +1 -1
- package/dist-cjs/spinner/svgSpinners/SpinnerSVG.js +32 -50
- package/dist-cjs/spinner/svgSpinners/SpinnerSVG.js.map +1 -1
- package/dist-es/spinner/Spinner.css.js +1 -1
- package/dist-es/spinner/Spinner.js +4 -5
- package/dist-es/spinner/Spinner.js.map +1 -1
- package/dist-es/spinner/svgSpinners/SpinnerSVG.js +32 -50
- package/dist-es/spinner/svgSpinners/SpinnerSVG.js.map +1 -1
- package/dist-types/spinner/svgSpinners/SpinnerSVG.d.ts +10 -10
- package/package.json +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @salt-ds/core
|
|
2
2
|
|
|
3
|
+
## 1.65.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- a41099d: Fixed `compute-scroll-into-view` not being listed as a dependency.
|
|
8
|
+
- 562f2e6: - Refactored `Spinner` so its size and stroke width are driven by CSS density tokens rather than computed in JavaScript. Density changes no longer cause `Spinner` to re-render.
|
|
9
|
+
- Fixed the small `Spinner` rendering at a smaller size than intended in high density.
|
|
10
|
+
|
|
3
11
|
## 1.65.0
|
|
4
12
|
|
|
5
13
|
### Minor Changes
|
package/css/salt-core.css
CHANGED
|
@@ -4090,15 +4090,24 @@ a:focus .saltCard-interactable.saltCard-disabled {
|
|
|
4090
4090
|
height: var(--salt-size-base);
|
|
4091
4091
|
width: var(--salt-size-base);
|
|
4092
4092
|
}
|
|
4093
|
+
.saltSpinner-medium .saltSpinner-arc {
|
|
4094
|
+
r: calc((var(--salt-size-base) - var(--spinner-strokeWidth)) / 2);
|
|
4095
|
+
}
|
|
4093
4096
|
.saltSpinner-large {
|
|
4094
4097
|
--spinner-strokeWidth: var(--salt-size-bar);
|
|
4095
4098
|
height: calc(var(--salt-size-base) * 2);
|
|
4096
4099
|
width: calc(var(--salt-size-base) * 2);
|
|
4097
4100
|
}
|
|
4101
|
+
.saltSpinner-large .saltSpinner-arc {
|
|
4102
|
+
r: calc((var(--salt-size-base) * 2 - var(--spinner-strokeWidth)) / 2);
|
|
4103
|
+
}
|
|
4098
4104
|
.saltSpinner-small {
|
|
4099
4105
|
--spinner-strokeWidth: var(--salt-size-fixed-200);
|
|
4100
|
-
height: var(--salt-size-icon);
|
|
4101
|
-
width: var(--salt-size-icon);
|
|
4106
|
+
height: max(var(--salt-size-icon), 12px);
|
|
4107
|
+
width: max(var(--salt-size-icon), 12px);
|
|
4108
|
+
}
|
|
4109
|
+
.saltSpinner-small .saltSpinner-arc {
|
|
4110
|
+
r: calc((max(var(--salt-size-icon), 12px) - var(--spinner-strokeWidth)) / 2);
|
|
4102
4111
|
}
|
|
4103
4112
|
.saltSpinner-spinner {
|
|
4104
4113
|
animation: spinner 0.9s linear infinite;
|
|
@@ -6732,4 +6741,4 @@ label.saltText small,
|
|
|
6732
6741
|
box-shadow: 0 calc(var(--salt-size-fixed-100) * -1) 0 0 var(--salt-selectable-borderColor-selected), 0 var(--salt-size-fixed-100) 0 0 var(--salt-selectable-borderColor-selected);
|
|
6733
6742
|
}
|
|
6734
6743
|
|
|
6735
|
-
/* src/
|
|
6744
|
+
/* src/e33ddadc-0f4f-47bc-8cf4-c2c50b07ad47.css */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var css_248z = "/* Styles applied to the root element */\n.saltSpinner {\n position: relative;\n}\n\n/* Styles applied to the SVG stop elements */\n.saltSpinner-gradientStop {\n stop-color: var(--saltSpinner-gradient-color, var(--salt-sentiment-accent-background));\n}\n\n/* Styles applied when `size=\"medium\"` */\n.saltSpinner-medium {\n --spinner-strokeWidth: var(--salt-size-bar);\n height: var(--salt-size-base);\n width: var(--salt-size-base);\n}\n\n/* Styles applied when `size=\"large\"` */\n.saltSpinner-large {\n --spinner-strokeWidth: var(--salt-size-bar);\n height: calc(var(--salt-size-base) * 2);\n width: calc(var(--salt-size-base) * 2);\n}\n\n/* Styles applied when `size=\"small\"` */\n.saltSpinner-small {\n --spinner-strokeWidth: var(--salt-size-fixed-200);\n height: var(--salt-size-icon);\n width: var(--salt-size-icon);\n}\n\n/* Styles applied to the SVG */\n.saltSpinner-spinner {\n animation: spinner 0.9s linear infinite;\n width: 100%;\n height: 100%;\n position: absolute;\n left: 0;\n top: 0;\n}\n\n@keyframes spinner {\n 0% {\n transform: rotate(0);\n }\n 100% {\n transform: rotate(360deg);\n }\n}\n";
|
|
3
|
+
var css_248z = "/* Styles applied to the root element */\n.saltSpinner {\n position: relative;\n}\n\n/* Styles applied to the SVG stop elements */\n.saltSpinner-gradientStop {\n stop-color: var(--saltSpinner-gradient-color, var(--salt-sentiment-accent-background));\n}\n\n/* Styles applied when `size=\"medium\"` */\n.saltSpinner-medium {\n --spinner-strokeWidth: var(--salt-size-bar);\n height: var(--salt-size-base);\n width: var(--salt-size-base);\n}\n.saltSpinner-medium .saltSpinner-arc {\n r: calc((var(--salt-size-base) - var(--spinner-strokeWidth)) / 2);\n}\n\n/* Styles applied when `size=\"large\"` */\n.saltSpinner-large {\n --spinner-strokeWidth: var(--salt-size-bar);\n height: calc(var(--salt-size-base) * 2);\n width: calc(var(--salt-size-base) * 2);\n}\n.saltSpinner-large .saltSpinner-arc {\n r: calc((var(--salt-size-base) * 2 - var(--spinner-strokeWidth)) / 2);\n}\n\n/* Styles applied when `size=\"small\"` */\n.saltSpinner-small {\n --spinner-strokeWidth: var(--salt-size-fixed-200);\n height: max(var(--salt-size-icon), 12px);\n width: max(var(--salt-size-icon), 12px);\n}\n.saltSpinner-small .saltSpinner-arc {\n r: calc((max(var(--salt-size-icon), 12px) - var(--spinner-strokeWidth)) / 2);\n}\n\n/* Styles applied to the SVG */\n.saltSpinner-spinner {\n animation: spinner 0.9s linear infinite;\n width: 100%;\n height: 100%;\n position: absolute;\n left: 0;\n top: 0;\n}\n\n@keyframes spinner {\n 0% {\n transform: rotate(0);\n }\n 100% {\n transform: rotate(360deg);\n }\n}\n";
|
|
4
4
|
|
|
5
5
|
module.exports = css_248z;
|
|
6
6
|
//# sourceMappingURL=Spinner.css.js.map
|
|
@@ -8,10 +8,10 @@ var React = require('react');
|
|
|
8
8
|
var useAriaAnnouncer = require('../aria-announcer/useAriaAnnouncer.js');
|
|
9
9
|
require('../aria-announcer/AriaAnnouncerContext.js');
|
|
10
10
|
require('../aria-announcer/AriaAnnouncerProvider.js');
|
|
11
|
-
var SaltProvider = require('../salt-provider/SaltProvider.js');
|
|
12
11
|
var makePrefixer = require('../utils/makePrefixer.js');
|
|
13
12
|
require('../utils/useFloatingUI/useFloatingUI.js');
|
|
14
13
|
var useId = require('../utils/useId.js');
|
|
14
|
+
require('../salt-provider/SaltProvider.js');
|
|
15
15
|
require('../viewport/ViewportProvider.js');
|
|
16
16
|
var Spinner$1 = require('./Spinner.css.js');
|
|
17
17
|
var SpinnerSVG = require('./svgSpinners/SpinnerSVG.js');
|
|
@@ -32,7 +32,7 @@ const Spinner = React.forwardRef(
|
|
|
32
32
|
completionAnnouncement = `finished ${ariaLabel}`,
|
|
33
33
|
disableAnnouncer,
|
|
34
34
|
className,
|
|
35
|
-
size = "medium",
|
|
35
|
+
size: sizeProp = "medium",
|
|
36
36
|
id: idProp,
|
|
37
37
|
...rest
|
|
38
38
|
}, ref) {
|
|
@@ -44,8 +44,7 @@ const Spinner = React.forwardRef(
|
|
|
44
44
|
window: targetWindow
|
|
45
45
|
});
|
|
46
46
|
const { announce } = useAriaAnnouncer.useAriaAnnouncer();
|
|
47
|
-
const
|
|
48
|
-
size = handleSize(size);
|
|
47
|
+
const size = handleSize(sizeProp);
|
|
49
48
|
React.useEffect(() => {
|
|
50
49
|
if (disableAnnouncer) return;
|
|
51
50
|
announce(ariaLabel);
|
|
@@ -83,7 +82,7 @@ const Spinner = React.forwardRef(
|
|
|
83
82
|
ref,
|
|
84
83
|
role: "img",
|
|
85
84
|
...rest,
|
|
86
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(SpinnerSVG.SpinnerSVG, {
|
|
85
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(SpinnerSVG.SpinnerSVG, { id })
|
|
87
86
|
}
|
|
88
87
|
);
|
|
89
88
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Spinner.js","sources":["../src/spinner/Spinner.tsx"],"sourcesContent":["import { useComponentCssInjection } from \"@salt-ds/styles\";\nimport { useWindow } from \"@salt-ds/window\";\nimport { clsx } from \"clsx\";\nimport { forwardRef, type HTMLAttributes, useEffect } from \"react\";\nimport { useAriaAnnouncer } from \"../aria-announcer\";\nimport {
|
|
1
|
+
{"version":3,"file":"Spinner.js","sources":["../src/spinner/Spinner.tsx"],"sourcesContent":["import { useComponentCssInjection } from \"@salt-ds/styles\";\nimport { useWindow } from \"@salt-ds/window\";\nimport { clsx } from \"clsx\";\nimport { forwardRef, type HTMLAttributes, useEffect } from \"react\";\nimport { useAriaAnnouncer } from \"../aria-announcer\";\nimport { makePrefixer, useId } from \"../utils\";\nimport spinnerCss from \"./Spinner.css\";\nimport { SpinnerSVG } from \"./svgSpinners/SpinnerSVG\";\n\n/**\n * Spinner component, provides an indeterminate loading indicator\n *\n * @example\n * <Spinner size=\"small\" | \"medium\" | \"large\" />\n */\n\nexport const SpinnerSizeValues = [\n \"default\",\n \"large\",\n \"small\",\n \"medium\",\n] as const;\n\ntype SpinnerSize = (typeof SpinnerSizeValues)[number];\n\nexport type SpinnerSVGSize = Exclude<SpinnerSize, \"default\">;\n\nconst handleSize = (size: SpinnerSize): SpinnerSVGSize =>\n size === \"default\" ? \"medium\" : size;\n\nconst withBaseName = makePrefixer(\"saltSpinner\");\n\nexport interface SpinnerProps extends HTMLAttributes<HTMLDivElement> {\n /**\n * Determines the interval on which the component will continue to announce the aria-label. Defaults to 5000ms (5s)\n */\n announcerInterval?: number;\n /**\n * * Determines the interval after which the component will stop announcing the aria-label. Defaults to 20000ms (20s)\n */\n announcerTimeout?: number;\n /**\n * The className(s) of the component\n */\n className?: string;\n /**\n * Determines the message to be announced by the component when it unmounts. Set to null if not needed.\n */\n completionAnnouncement?: string | null;\n /**\n * If true, built in aria announcer will be inactive\n */\n disableAnnouncer?: boolean;\n /**\n * The prop for the role attribute of the component\n */\n role?: string;\n /**\n * Determines the size of the spinner. Must be one of: 'default', 'large', 'small', 'medium'.\n */\n size?: SpinnerSize;\n /**\n * The ids of the SvgSpinner components\n */\n id?: string;\n}\n\nexport const Spinner = forwardRef<HTMLDivElement, SpinnerProps>(\n function Spinner(\n {\n \"aria-label\": ariaLabel = \"loading\",\n announcerInterval = 5000,\n announcerTimeout = 20000,\n completionAnnouncement = `finished ${ariaLabel}`,\n disableAnnouncer,\n className,\n size: sizeProp = \"medium\",\n id: idProp,\n ...rest\n },\n ref,\n ) {\n const id = useId(idProp);\n const targetWindow = useWindow();\n useComponentCssInjection({\n testId: \"salt-spinner\",\n css: spinnerCss,\n window: targetWindow,\n });\n\n const { announce } = useAriaAnnouncer();\n\n const size = handleSize(sizeProp);\n\n useEffect(() => {\n if (disableAnnouncer) return;\n\n announce(ariaLabel);\n\n const startTime = Date.now();\n\n const interval =\n announcerInterval > 0 &&\n setInterval(() => {\n if (Date.now() - startTime > announcerTimeout) {\n // The announcer will stop after `announcerTimeout` time\n announce(\n `${ariaLabel} is still in progress, but will no longer announce.`,\n );\n interval && clearInterval(interval);\n return;\n }\n announce(ariaLabel);\n }, announcerInterval);\n\n return () => {\n if (disableAnnouncer) return;\n\n interval && clearInterval(interval);\n if (completionAnnouncement) {\n announce(completionAnnouncement);\n }\n };\n }, [\n announce,\n announcerInterval,\n announcerTimeout,\n ariaLabel,\n completionAnnouncement,\n disableAnnouncer,\n ]);\n\n return (\n <div\n aria-label={ariaLabel}\n className={clsx(withBaseName(), withBaseName(size), className)}\n ref={ref}\n role=\"img\"\n {...rest}\n >\n <SpinnerSVG id={id} />\n </div>\n );\n },\n);\n"],"names":["makePrefixer","forwardRef","Spinner","useId","useWindow","useComponentCssInjection","spinnerCss","useAriaAnnouncer","useEffect","jsx","clsx","SpinnerSVG"],"mappings":";;;;;;;;;;;;;;;;;;AAgBO,MAAM,iBAAA,GAAoB;AAAA,EAC/B,SAAA;AAAA,EACA,OAAA;AAAA,EACA,OAAA;AAAA,EACA;AACF;AAMA,MAAM,UAAA,GAAa,CAAC,IAAA,KAClB,IAAA,KAAS,YAAY,QAAA,GAAW,IAAA;AAElC,MAAM,YAAA,GAAeA,0BAAa,aAAa,CAAA;AAqCxC,MAAM,OAAA,GAAUC,gBAAA;AAAA,EACrB,SAASC,QAAAA,CACP;AAAA,IACE,cAAc,SAAA,GAAY,SAAA;AAAA,IAC1B,iBAAA,GAAoB,GAAA;AAAA,IACpB,gBAAA,GAAmB,GAAA;AAAA,IACnB,sBAAA,GAAyB,YAAY,SAAS,CAAA,CAAA;AAAA,IAC9C,gBAAA;AAAA,IACA,SAAA;AAAA,IACA,MAAM,QAAA,GAAW,QAAA;AAAA,IACjB,EAAA,EAAI,MAAA;AAAA,IACJ,GAAG;AAAA,KAEL,GAAA,EACA;AACA,IAAA,MAAM,EAAA,GAAKC,YAAM,MAAM,CAAA;AACvB,IAAA,MAAM,eAAeC,gBAAA,EAAU;AAC/B,IAAAC,+BAAA,CAAyB;AAAA,MACvB,MAAA,EAAQ,cAAA;AAAA,MACR,GAAA,EAAKC,SAAA;AAAA,MACL,MAAA,EAAQ;AAAA,KACT,CAAA;AAED,IAAA,MAAM,EAAE,QAAA,EAAS,GAAIC,iCAAA,EAAiB;AAEtC,IAAA,MAAM,IAAA,GAAO,WAAW,QAAQ,CAAA;AAEhC,IAAAC,eAAA,CAAU,MAAM;AACd,MAAA,IAAI,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12
12
|
const withBaseName = makePrefixer.makePrefixer("saltSpinner");
|
|
13
|
-
const sizeAndStrokeWidthMapping = {
|
|
14
|
-
small: {
|
|
15
|
-
high: { width: 12, strokeWidth: 2 },
|
|
16
|
-
medium: { width: 12, strokeWidth: 2 },
|
|
17
|
-
low: { width: 14, strokeWidth: 2 },
|
|
18
|
-
touch: { width: 16, strokeWidth: 2 },
|
|
19
|
-
mobile: { width: 16, strokeWidth: 2 }
|
|
20
|
-
},
|
|
21
|
-
medium: {
|
|
22
|
-
high: { width: 20, strokeWidth: 2 },
|
|
23
|
-
medium: { width: 28, strokeWidth: 4 },
|
|
24
|
-
low: { width: 36, strokeWidth: 6 },
|
|
25
|
-
touch: { width: 44, strokeWidth: 8 },
|
|
26
|
-
mobile: { width: 44, strokeWidth: 8 }
|
|
27
|
-
},
|
|
28
|
-
large: {
|
|
29
|
-
high: { width: 40, strokeWidth: 2 },
|
|
30
|
-
medium: { width: 56, strokeWidth: 4 },
|
|
31
|
-
low: { width: 72, strokeWidth: 6 },
|
|
32
|
-
touch: { width: 88, strokeWidth: 8 },
|
|
33
|
-
mobile: { width: 88, strokeWidth: 8 }
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
13
|
const SpinnerSVG = ({
|
|
37
14
|
id = "svg-spinner",
|
|
38
|
-
rest
|
|
39
|
-
size,
|
|
40
|
-
density
|
|
15
|
+
...rest
|
|
41
16
|
}) => {
|
|
42
|
-
const
|
|
43
|
-
const radius = (width - strokeWidth) / 2;
|
|
17
|
+
const gradientId = `${id}-1`;
|
|
44
18
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
45
19
|
"svg",
|
|
46
20
|
{
|
|
47
21
|
className: withBaseName("spinner"),
|
|
48
|
-
|
|
22
|
+
preserveAspectRatio: "xMidYMid meet",
|
|
49
23
|
id,
|
|
50
24
|
...rest,
|
|
51
25
|
children: [
|
|
52
|
-
/* @__PURE__ */ jsxRuntime.jsx("defs", { children: /* @__PURE__ */ jsxRuntime.jsxs("linearGradient", { id:
|
|
26
|
+
/* @__PURE__ */ jsxRuntime.jsx("defs", { children: /* @__PURE__ */ jsxRuntime.jsxs("linearGradient", { id: gradientId, x1: "0", y1: "0", x2: "50%", y2: "0", children: [
|
|
53
27
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
54
28
|
"stop",
|
|
55
29
|
{
|
|
@@ -67,26 +41,34 @@ const SpinnerSVG = ({
|
|
|
67
41
|
}
|
|
68
42
|
)
|
|
69
43
|
] }) }),
|
|
70
|
-
/* @__PURE__ */ jsxRuntime.
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
"
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
44
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
45
|
+
"circle",
|
|
46
|
+
{
|
|
47
|
+
className: withBaseName("arc"),
|
|
48
|
+
cx: "50%",
|
|
49
|
+
cy: "50%",
|
|
50
|
+
fill: "none",
|
|
51
|
+
stroke: "var(--saltSpinner-gradient-color, var(--salt-sentiment-accent-background))",
|
|
52
|
+
strokeWidth: "var(--spinner-strokeWidth)",
|
|
53
|
+
pathLength: "100",
|
|
54
|
+
strokeDasharray: "50 50",
|
|
55
|
+
strokeDashoffset: "50"
|
|
56
|
+
}
|
|
57
|
+
),
|
|
58
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
59
|
+
"circle",
|
|
60
|
+
{
|
|
61
|
+
className: withBaseName("arc"),
|
|
62
|
+
cx: "50%",
|
|
63
|
+
cy: "50%",
|
|
64
|
+
fill: "none",
|
|
65
|
+
stroke: `url(#${gradientId})`,
|
|
66
|
+
strokeWidth: "var(--spinner-strokeWidth)",
|
|
67
|
+
pathLength: "100",
|
|
68
|
+
strokeDasharray: "50 50",
|
|
69
|
+
strokeDashoffset: "75"
|
|
70
|
+
}
|
|
71
|
+
)
|
|
90
72
|
]
|
|
91
73
|
}
|
|
92
74
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SpinnerSVG.js","sources":["../src/spinner/svgSpinners/SpinnerSVG.tsx"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"file":"SpinnerSVG.js","sources":["../src/spinner/svgSpinners/SpinnerSVG.tsx"],"sourcesContent":["import type { ComponentPropsWithoutRef } from \"react\";\nimport { makePrefixer } from \"../../utils\";\n\nconst withBaseName = makePrefixer(\"saltSpinner\");\n\ntype SpinnerSVGProps = ComponentPropsWithoutRef<\"svg\">;\n\n/**\n * Draws the spinner as two overlapping circles. Each circle is half-stroked\n * (`stroke-dasharray=\"50 50\"` against a normalised `pathLength` of 100) and\n * rotated via `stroke-dashoffset`: the first draws the top half, the second\n * draws the left half with a fading gradient. Radius and stroke width come\n * from CSS custom properties set by the parent `.saltSpinner-*` size class.\n */\nexport const SpinnerSVG = ({\n id = \"svg-spinner\",\n ...rest\n}: SpinnerSVGProps) => {\n const gradientId = `${id}-1`;\n\n return (\n <svg\n className={withBaseName(\"spinner\")}\n preserveAspectRatio=\"xMidYMid meet\"\n id={id}\n {...rest}\n >\n <defs>\n <linearGradient id={gradientId} x1=\"0\" y1=\"0\" x2=\"50%\" y2=\"0\">\n <stop\n className={withBaseName(\"gradientStop\")}\n offset=\"15%\"\n stopOpacity=\"1\"\n />\n <stop\n className={withBaseName(\"gradientStop\")}\n offset=\"100%\"\n stopOpacity=\"0\"\n />\n </linearGradient>\n </defs>\n <circle\n className={withBaseName(\"arc\")}\n cx=\"50%\"\n cy=\"50%\"\n fill=\"none\"\n stroke=\"var(--saltSpinner-gradient-color, var(--salt-sentiment-accent-background))\"\n strokeWidth=\"var(--spinner-strokeWidth)\"\n pathLength=\"100\"\n strokeDasharray=\"50 50\"\n strokeDashoffset=\"50\"\n />\n <circle\n className={withBaseName(\"arc\")}\n cx=\"50%\"\n cy=\"50%\"\n fill=\"none\"\n stroke={`url(#${gradientId})`}\n strokeWidth=\"var(--spinner-strokeWidth)\"\n pathLength=\"100\"\n strokeDasharray=\"50 50\"\n strokeDashoffset=\"75\"\n />\n </svg>\n );\n};\n"],"names":["makePrefixer","jsxs","jsx"],"mappings":";;;;;;;;;;;AAGA,MAAM,YAAA,GAAeA,0BAAa,aAAa,CAAA;AAWxC,MAAM,aAAa,CAAC;AAAA,EACzB,EAAA,GAAK,aAAA;AAAA,EACL,GAAG;AACL,CAAA,KAAuB;AACrB,EAAA,MAAM,UAAA,GAAa,GAAG,EAAE,CAAA,EAAA,CAAA;AAExB,EAAA,uBACEC,eAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,SAAA,EAAW,aAAa,SAAS,CAAA;AAAA,MACjC,mBAAA,EAAoB,eAAA;AAAA,MACpB,EAAA;AAAA,MACC,GAAG,IAAA;AAAA,MAEJ,QAAA,EAAA;AAAA,wBAAAC,cAAA,CAAC,MAAA,EAAA,EACC,QAAA,kBAAAD,eAAA,CAAC,gBAAA,EAAA,EAAe,EAAA,EAAI,UAAA,EAAY,EAAA,EAAG,GAAA,EAAI,EAAA,EAAG,GAAA,EAAI,EAAA,EAAG,KAAA,EAAM,EAAA,EAAG,GAAA,EACxD,QAAA,EAAA;AAAA,0BAAAC,cAAA;AAAA,YAAC,MAAA;AAAA,YAAA;AAAA,cACC,SAAA,EAAW,aAAa,cAAc,CAAA;AAAA,cACtC,MAAA,EAAO,KAAA;AAAA,cACP,WAAA,EAAY;AAAA;AAAA,WACd;AAAA,0BACAA,cAAA;AAAA,YAAC,MAAA;AAAA,YAAA;AAAA,cACC,SAAA,EAAW,aAAa,cAAc,CAAA;AAAA,cACtC,MAAA,EAAO,MAAA;AAAA,cACP,WAAA,EAAY;AAAA;AAAA;AACd,SAAA,EACF,CAAA,EACF,CAAA;AAAA,wBACAA,cAAA;AAAA,UAAC,QAAA;AAAA,UAAA;AAAA,YACC,SAAA,EAAW,aAAa,KAAK,CAAA;AAAA,YAC7B,EAAA,EAAG,KAAA;AAAA,YACH,EAAA,EAAG,KAAA;AAAA,YACH,IAAA,EAAK,MAAA;AAAA,YACL,MAAA,EAAO,4EAAA;AAAA,YACP,WAAA,EAAY,4BAAA;AAAA,YACZ,UAAA,EAAW,KAAA;AAAA,YACX,eAAA,EAAgB,OAAA;AAAA,YAChB,gBAAA,EAAiB;AAAA;AAAA,SACnB;AAAA,wBACAA,cAAA;AAAA,UAAC,QAAA;AAAA,UAAA;AAAA,YACC,SAAA,EAAW,aAAa,KAAK,CAAA;AAAA,YAC7B,EAAA,EAAG,KAAA;AAAA,YACH,EAAA,EAAG,KAAA;AAAA,YACH,IAAA,EAAK,MAAA;AAAA,YACL,MAAA,EAAQ,QAAQ,UAAU,CAAA,CAAA,CAAA;AAAA,YAC1B,WAAA,EAAY,4BAAA;AAAA,YACZ,UAAA,EAAW,KAAA;AAAA,YACX,eAAA,EAAgB,OAAA;AAAA,YAChB,gBAAA,EAAiB;AAAA;AAAA;AACnB;AAAA;AAAA,GACF;AAEJ;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var css_248z = "/* Styles applied to the root element */\n.saltSpinner {\n position: relative;\n}\n\n/* Styles applied to the SVG stop elements */\n.saltSpinner-gradientStop {\n stop-color: var(--saltSpinner-gradient-color, var(--salt-sentiment-accent-background));\n}\n\n/* Styles applied when `size=\"medium\"` */\n.saltSpinner-medium {\n --spinner-strokeWidth: var(--salt-size-bar);\n height: var(--salt-size-base);\n width: var(--salt-size-base);\n}\n\n/* Styles applied when `size=\"large\"` */\n.saltSpinner-large {\n --spinner-strokeWidth: var(--salt-size-bar);\n height: calc(var(--salt-size-base) * 2);\n width: calc(var(--salt-size-base) * 2);\n}\n\n/* Styles applied when `size=\"small\"` */\n.saltSpinner-small {\n --spinner-strokeWidth: var(--salt-size-fixed-200);\n height: var(--salt-size-icon);\n width: var(--salt-size-icon);\n}\n\n/* Styles applied to the SVG */\n.saltSpinner-spinner {\n animation: spinner 0.9s linear infinite;\n width: 100%;\n height: 100%;\n position: absolute;\n left: 0;\n top: 0;\n}\n\n@keyframes spinner {\n 0% {\n transform: rotate(0);\n }\n 100% {\n transform: rotate(360deg);\n }\n}\n";
|
|
1
|
+
var css_248z = "/* Styles applied to the root element */\n.saltSpinner {\n position: relative;\n}\n\n/* Styles applied to the SVG stop elements */\n.saltSpinner-gradientStop {\n stop-color: var(--saltSpinner-gradient-color, var(--salt-sentiment-accent-background));\n}\n\n/* Styles applied when `size=\"medium\"` */\n.saltSpinner-medium {\n --spinner-strokeWidth: var(--salt-size-bar);\n height: var(--salt-size-base);\n width: var(--salt-size-base);\n}\n.saltSpinner-medium .saltSpinner-arc {\n r: calc((var(--salt-size-base) - var(--spinner-strokeWidth)) / 2);\n}\n\n/* Styles applied when `size=\"large\"` */\n.saltSpinner-large {\n --spinner-strokeWidth: var(--salt-size-bar);\n height: calc(var(--salt-size-base) * 2);\n width: calc(var(--salt-size-base) * 2);\n}\n.saltSpinner-large .saltSpinner-arc {\n r: calc((var(--salt-size-base) * 2 - var(--spinner-strokeWidth)) / 2);\n}\n\n/* Styles applied when `size=\"small\"` */\n.saltSpinner-small {\n --spinner-strokeWidth: var(--salt-size-fixed-200);\n height: max(var(--salt-size-icon), 12px);\n width: max(var(--salt-size-icon), 12px);\n}\n.saltSpinner-small .saltSpinner-arc {\n r: calc((max(var(--salt-size-icon), 12px) - var(--spinner-strokeWidth)) / 2);\n}\n\n/* Styles applied to the SVG */\n.saltSpinner-spinner {\n animation: spinner 0.9s linear infinite;\n width: 100%;\n height: 100%;\n position: absolute;\n left: 0;\n top: 0;\n}\n\n@keyframes spinner {\n 0% {\n transform: rotate(0);\n }\n 100% {\n transform: rotate(360deg);\n }\n}\n";
|
|
2
2
|
|
|
3
3
|
export { css_248z as default };
|
|
4
4
|
//# sourceMappingURL=Spinner.css.js.map
|
|
@@ -6,10 +6,10 @@ import { forwardRef, useEffect } from 'react';
|
|
|
6
6
|
import { useAriaAnnouncer } from '../aria-announcer/useAriaAnnouncer.js';
|
|
7
7
|
import '../aria-announcer/AriaAnnouncerContext.js';
|
|
8
8
|
import '../aria-announcer/AriaAnnouncerProvider.js';
|
|
9
|
-
import { useDensity } from '../salt-provider/SaltProvider.js';
|
|
10
9
|
import { makePrefixer } from '../utils/makePrefixer.js';
|
|
11
10
|
import '../utils/useFloatingUI/useFloatingUI.js';
|
|
12
11
|
import { useId } from '../utils/useId.js';
|
|
12
|
+
import '../salt-provider/SaltProvider.js';
|
|
13
13
|
import '../viewport/ViewportProvider.js';
|
|
14
14
|
import css_248z from './Spinner.css.js';
|
|
15
15
|
import { SpinnerSVG } from './svgSpinners/SpinnerSVG.js';
|
|
@@ -30,7 +30,7 @@ const Spinner = forwardRef(
|
|
|
30
30
|
completionAnnouncement = `finished ${ariaLabel}`,
|
|
31
31
|
disableAnnouncer,
|
|
32
32
|
className,
|
|
33
|
-
size = "medium",
|
|
33
|
+
size: sizeProp = "medium",
|
|
34
34
|
id: idProp,
|
|
35
35
|
...rest
|
|
36
36
|
}, ref) {
|
|
@@ -42,8 +42,7 @@ const Spinner = forwardRef(
|
|
|
42
42
|
window: targetWindow
|
|
43
43
|
});
|
|
44
44
|
const { announce } = useAriaAnnouncer();
|
|
45
|
-
const
|
|
46
|
-
size = handleSize(size);
|
|
45
|
+
const size = handleSize(sizeProp);
|
|
47
46
|
useEffect(() => {
|
|
48
47
|
if (disableAnnouncer) return;
|
|
49
48
|
announce(ariaLabel);
|
|
@@ -81,7 +80,7 @@ const Spinner = forwardRef(
|
|
|
81
80
|
ref,
|
|
82
81
|
role: "img",
|
|
83
82
|
...rest,
|
|
84
|
-
children: /* @__PURE__ */ jsx(SpinnerSVG, {
|
|
83
|
+
children: /* @__PURE__ */ jsx(SpinnerSVG, { id })
|
|
85
84
|
}
|
|
86
85
|
);
|
|
87
86
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Spinner.js","sources":["../src/spinner/Spinner.tsx"],"sourcesContent":["import { useComponentCssInjection } from \"@salt-ds/styles\";\nimport { useWindow } from \"@salt-ds/window\";\nimport { clsx } from \"clsx\";\nimport { forwardRef, type HTMLAttributes, useEffect } from \"react\";\nimport { useAriaAnnouncer } from \"../aria-announcer\";\nimport {
|
|
1
|
+
{"version":3,"file":"Spinner.js","sources":["../src/spinner/Spinner.tsx"],"sourcesContent":["import { useComponentCssInjection } from \"@salt-ds/styles\";\nimport { useWindow } from \"@salt-ds/window\";\nimport { clsx } from \"clsx\";\nimport { forwardRef, type HTMLAttributes, useEffect } from \"react\";\nimport { useAriaAnnouncer } from \"../aria-announcer\";\nimport { makePrefixer, useId } from \"../utils\";\nimport spinnerCss from \"./Spinner.css\";\nimport { SpinnerSVG } from \"./svgSpinners/SpinnerSVG\";\n\n/**\n * Spinner component, provides an indeterminate loading indicator\n *\n * @example\n * <Spinner size=\"small\" | \"medium\" | \"large\" />\n */\n\nexport const SpinnerSizeValues = [\n \"default\",\n \"large\",\n \"small\",\n \"medium\",\n] as const;\n\ntype SpinnerSize = (typeof SpinnerSizeValues)[number];\n\nexport type SpinnerSVGSize = Exclude<SpinnerSize, \"default\">;\n\nconst handleSize = (size: SpinnerSize): SpinnerSVGSize =>\n size === \"default\" ? \"medium\" : size;\n\nconst withBaseName = makePrefixer(\"saltSpinner\");\n\nexport interface SpinnerProps extends HTMLAttributes<HTMLDivElement> {\n /**\n * Determines the interval on which the component will continue to announce the aria-label. Defaults to 5000ms (5s)\n */\n announcerInterval?: number;\n /**\n * * Determines the interval after which the component will stop announcing the aria-label. Defaults to 20000ms (20s)\n */\n announcerTimeout?: number;\n /**\n * The className(s) of the component\n */\n className?: string;\n /**\n * Determines the message to be announced by the component when it unmounts. Set to null if not needed.\n */\n completionAnnouncement?: string | null;\n /**\n * If true, built in aria announcer will be inactive\n */\n disableAnnouncer?: boolean;\n /**\n * The prop for the role attribute of the component\n */\n role?: string;\n /**\n * Determines the size of the spinner. Must be one of: 'default', 'large', 'small', 'medium'.\n */\n size?: SpinnerSize;\n /**\n * The ids of the SvgSpinner components\n */\n id?: string;\n}\n\nexport const Spinner = forwardRef<HTMLDivElement, SpinnerProps>(\n function Spinner(\n {\n \"aria-label\": ariaLabel = \"loading\",\n announcerInterval = 5000,\n announcerTimeout = 20000,\n completionAnnouncement = `finished ${ariaLabel}`,\n disableAnnouncer,\n className,\n size: sizeProp = \"medium\",\n id: idProp,\n ...rest\n },\n ref,\n ) {\n const id = useId(idProp);\n const targetWindow = useWindow();\n useComponentCssInjection({\n testId: \"salt-spinner\",\n css: spinnerCss,\n window: targetWindow,\n });\n\n const { announce } = useAriaAnnouncer();\n\n const size = handleSize(sizeProp);\n\n useEffect(() => {\n if (disableAnnouncer) return;\n\n announce(ariaLabel);\n\n const startTime = Date.now();\n\n const interval =\n announcerInterval > 0 &&\n setInterval(() => {\n if (Date.now() - startTime > announcerTimeout) {\n // The announcer will stop after `announcerTimeout` time\n announce(\n `${ariaLabel} is still in progress, but will no longer announce.`,\n );\n interval && clearInterval(interval);\n return;\n }\n announce(ariaLabel);\n }, announcerInterval);\n\n return () => {\n if (disableAnnouncer) return;\n\n interval && clearInterval(interval);\n if (completionAnnouncement) {\n announce(completionAnnouncement);\n }\n };\n }, [\n announce,\n announcerInterval,\n announcerTimeout,\n ariaLabel,\n completionAnnouncement,\n disableAnnouncer,\n ]);\n\n return (\n <div\n aria-label={ariaLabel}\n className={clsx(withBaseName(), withBaseName(size), className)}\n ref={ref}\n role=\"img\"\n {...rest}\n >\n <SpinnerSVG id={id} />\n </div>\n );\n },\n);\n"],"names":["Spinner","spinnerCss"],"mappings":";;;;;;;;;;;;;;;;AAgBO,MAAM,iBAAA,GAAoB;AAAA,EAC/B,SAAA;AAAA,EACA,OAAA;AAAA,EACA,OAAA;AAAA,EACA;AACF;AAMA,MAAM,UAAA,GAAa,CAAC,IAAA,KAClB,IAAA,KAAS,YAAY,QAAA,GAAW,IAAA;AAElC,MAAM,Y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QAAA,IAAI,gBAAA,EAAkB;AAEtB,QAAA,QAAA,IAAY,cAAc,QAAQ,CAAA;AAClC,QAAA,IAAI,sBAAA,EAAwB;AAC1B,UAAA,QAAA,CAAS,sBAAsB,CAAA;AAAA,QACjC;AAAA,MACF,CAAA;AAAA,IACF,CAAA,EAAG;AAAA,MACD,QAAA;AAAA,MACA,iBAAA;AAAA,MACA,gBAAA;AAAA,MACA,SAAA;AAAA,MACA,sBAAA;AAAA,MACA;AAAA,KACD,CAAA;AAED,IAAA,uBACE,GAAA;AAAA,MAAC,KAAA;AAAA,MAAA;AAAA,QACC,YAAA,EAAY,SAAA;AAAA,QACZ,WAAW,IAAA,CAAK,YAAA,IAAgB,YAAA,CAAa,IAAI,GAAG,SAAS,CAAA;AAAA,QAC7D,GAAA;AAAA,QACA,IAAA,EAAK,KAAA;AAAA,QACJ,GAAG,IAAA;AAAA,QAEJ,QAAA,kBAAA,GAAA,CAAC,cAAW,EAAA,EAAQ;AAAA;AAAA,KACtB;AAAA,EAEJ;AACF;;;;"}
|
|
@@ -8,46 +8,20 @@ import '../../salt-provider/SaltProvider.js';
|
|
|
8
8
|
import '../../viewport/ViewportProvider.js';
|
|
9
9
|
|
|
10
10
|
const withBaseName = makePrefixer("saltSpinner");
|
|
11
|
-
const sizeAndStrokeWidthMapping = {
|
|
12
|
-
small: {
|
|
13
|
-
high: { width: 12, strokeWidth: 2 },
|
|
14
|
-
medium: { width: 12, strokeWidth: 2 },
|
|
15
|
-
low: { width: 14, strokeWidth: 2 },
|
|
16
|
-
touch: { width: 16, strokeWidth: 2 },
|
|
17
|
-
mobile: { width: 16, strokeWidth: 2 }
|
|
18
|
-
},
|
|
19
|
-
medium: {
|
|
20
|
-
high: { width: 20, strokeWidth: 2 },
|
|
21
|
-
medium: { width: 28, strokeWidth: 4 },
|
|
22
|
-
low: { width: 36, strokeWidth: 6 },
|
|
23
|
-
touch: { width: 44, strokeWidth: 8 },
|
|
24
|
-
mobile: { width: 44, strokeWidth: 8 }
|
|
25
|
-
},
|
|
26
|
-
large: {
|
|
27
|
-
high: { width: 40, strokeWidth: 2 },
|
|
28
|
-
medium: { width: 56, strokeWidth: 4 },
|
|
29
|
-
low: { width: 72, strokeWidth: 6 },
|
|
30
|
-
touch: { width: 88, strokeWidth: 8 },
|
|
31
|
-
mobile: { width: 88, strokeWidth: 8 }
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
11
|
const SpinnerSVG = ({
|
|
35
12
|
id = "svg-spinner",
|
|
36
|
-
rest
|
|
37
|
-
size,
|
|
38
|
-
density
|
|
13
|
+
...rest
|
|
39
14
|
}) => {
|
|
40
|
-
const
|
|
41
|
-
const radius = (width - strokeWidth) / 2;
|
|
15
|
+
const gradientId = `${id}-1`;
|
|
42
16
|
return /* @__PURE__ */ jsxs(
|
|
43
17
|
"svg",
|
|
44
18
|
{
|
|
45
19
|
className: withBaseName("spinner"),
|
|
46
|
-
|
|
20
|
+
preserveAspectRatio: "xMidYMid meet",
|
|
47
21
|
id,
|
|
48
22
|
...rest,
|
|
49
23
|
children: [
|
|
50
|
-
/* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs("linearGradient", { id:
|
|
24
|
+
/* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsxs("linearGradient", { id: gradientId, x1: "0", y1: "0", x2: "50%", y2: "0", children: [
|
|
51
25
|
/* @__PURE__ */ jsx(
|
|
52
26
|
"stop",
|
|
53
27
|
{
|
|
@@ -65,26 +39,34 @@ const SpinnerSVG = ({
|
|
|
65
39
|
}
|
|
66
40
|
)
|
|
67
41
|
] }) }),
|
|
68
|
-
/* @__PURE__ */
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
"
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
42
|
+
/* @__PURE__ */ jsx(
|
|
43
|
+
"circle",
|
|
44
|
+
{
|
|
45
|
+
className: withBaseName("arc"),
|
|
46
|
+
cx: "50%",
|
|
47
|
+
cy: "50%",
|
|
48
|
+
fill: "none",
|
|
49
|
+
stroke: "var(--saltSpinner-gradient-color, var(--salt-sentiment-accent-background))",
|
|
50
|
+
strokeWidth: "var(--spinner-strokeWidth)",
|
|
51
|
+
pathLength: "100",
|
|
52
|
+
strokeDasharray: "50 50",
|
|
53
|
+
strokeDashoffset: "50"
|
|
54
|
+
}
|
|
55
|
+
),
|
|
56
|
+
/* @__PURE__ */ jsx(
|
|
57
|
+
"circle",
|
|
58
|
+
{
|
|
59
|
+
className: withBaseName("arc"),
|
|
60
|
+
cx: "50%",
|
|
61
|
+
cy: "50%",
|
|
62
|
+
fill: "none",
|
|
63
|
+
stroke: `url(#${gradientId})`,
|
|
64
|
+
strokeWidth: "var(--spinner-strokeWidth)",
|
|
65
|
+
pathLength: "100",
|
|
66
|
+
strokeDasharray: "50 50",
|
|
67
|
+
strokeDashoffset: "75"
|
|
68
|
+
}
|
|
69
|
+
)
|
|
88
70
|
]
|
|
89
71
|
}
|
|
90
72
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SpinnerSVG.js","sources":["../src/spinner/svgSpinners/SpinnerSVG.tsx"],"sourcesContent":["import type {
|
|
1
|
+
{"version":3,"file":"SpinnerSVG.js","sources":["../src/spinner/svgSpinners/SpinnerSVG.tsx"],"sourcesContent":["import type { ComponentPropsWithoutRef } from \"react\";\nimport { makePrefixer } from \"../../utils\";\n\nconst withBaseName = makePrefixer(\"saltSpinner\");\n\ntype SpinnerSVGProps = ComponentPropsWithoutRef<\"svg\">;\n\n/**\n * Draws the spinner as two overlapping circles. Each circle is half-stroked\n * (`stroke-dasharray=\"50 50\"` against a normalised `pathLength` of 100) and\n * rotated via `stroke-dashoffset`: the first draws the top half, the second\n * draws the left half with a fading gradient. Radius and stroke width come\n * from CSS custom properties set by the parent `.saltSpinner-*` size class.\n */\nexport const SpinnerSVG = ({\n id = \"svg-spinner\",\n ...rest\n}: SpinnerSVGProps) => {\n const gradientId = `${id}-1`;\n\n return (\n <svg\n className={withBaseName(\"spinner\")}\n preserveAspectRatio=\"xMidYMid meet\"\n id={id}\n {...rest}\n >\n <defs>\n <linearGradient id={gradientId} x1=\"0\" y1=\"0\" x2=\"50%\" y2=\"0\">\n <stop\n className={withBaseName(\"gradientStop\")}\n offset=\"15%\"\n stopOpacity=\"1\"\n />\n <stop\n className={withBaseName(\"gradientStop\")}\n offset=\"100%\"\n stopOpacity=\"0\"\n />\n </linearGradient>\n </defs>\n <circle\n className={withBaseName(\"arc\")}\n cx=\"50%\"\n cy=\"50%\"\n fill=\"none\"\n stroke=\"var(--saltSpinner-gradient-color, var(--salt-sentiment-accent-background))\"\n strokeWidth=\"var(--spinner-strokeWidth)\"\n pathLength=\"100\"\n strokeDasharray=\"50 50\"\n strokeDashoffset=\"50\"\n />\n <circle\n className={withBaseName(\"arc\")}\n cx=\"50%\"\n cy=\"50%\"\n fill=\"none\"\n stroke={`url(#${gradientId})`}\n strokeWidth=\"var(--spinner-strokeWidth)\"\n pathLength=\"100\"\n strokeDasharray=\"50 50\"\n strokeDashoffset=\"75\"\n />\n </svg>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;AAGA,MAAM,YAAA,GAAe,aAAa,aAAa,CAAA;AAWxC,MAAM,aAAa,CAAC;AAAA,EACzB,EAAA,GAAK,aAAA;AAAA,EACL,GAAG;AACL,CAAA,KAAuB;AACrB,EAAA,MAAM,UAAA,GAAa,GAAG,EAAE,CAAA,EAAA,CAAA;AAExB,EAAA,uBACE,IAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,SAAA,EAAW,aAAa,SAAS,CAAA;AAAA,MACjC,mBAAA,EAAoB,eAAA;AAAA,MACpB,EAAA;AAAA,MACC,GAAG,IAAA;AAAA,MAEJ,QAAA,E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,OAAA;AAAA,YAChB,gBAAA,EAAiB;AAAA;AAAA;AACnB;AAAA;AAAA,GACF;AAEJ;;;;"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
export declare const SpinnerSVG: ({ id, rest
|
|
1
|
+
import type { ComponentPropsWithoutRef } from "react";
|
|
2
|
+
type SpinnerSVGProps = ComponentPropsWithoutRef<"svg">;
|
|
3
|
+
/**
|
|
4
|
+
* Draws the spinner as two overlapping circles. Each circle is half-stroked
|
|
5
|
+
* (`stroke-dasharray="50 50"` against a normalised `pathLength` of 100) and
|
|
6
|
+
* rotated via `stroke-dashoffset`: the first draws the top half, the second
|
|
7
|
+
* draws the left half with a fading gradient. Radius and stroke width come
|
|
8
|
+
* from CSS custom properties set by the parent `.saltSpinner-*` size class.
|
|
9
|
+
*/
|
|
10
|
+
export declare const SpinnerSVG: ({ id, ...rest }: SpinnerSVGProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
11
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salt-ds/core",
|
|
3
|
-
"version": "1.65.
|
|
3
|
+
"version": "1.65.1",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
"@salt-ds/styles": "0.3.0",
|
|
23
23
|
"@salt-ds/window": "0.1.1",
|
|
24
24
|
"clsx": "^2.0.0",
|
|
25
|
+
"compute-scroll-into-view": "^3.0.0",
|
|
25
26
|
"dom-accessibility-api": "^0.7.1",
|
|
26
27
|
"tabbable": "^6.0.0",
|
|
27
28
|
"use-sync-external-store": "^1.5.0"
|