@salt-ds/core 1.9.0 → 1.10.0
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/dist-cjs/flex-layout/FlexLayout.css.js +1 -1
- package/dist-cjs/spinner/Spinner.css.js +1 -1
- package/dist-cjs/spinner/Spinner.js +5 -2
- package/dist-cjs/spinner/Spinner.js.map +1 -1
- package/dist-cjs/spinner/svgSpinners/SpinnerSVG.js +57 -47
- package/dist-cjs/spinner/svgSpinners/SpinnerSVG.js.map +1 -1
- package/dist-cjs/split-layout/SplitLayout.css.js +6 -0
- package/dist-cjs/split-layout/SplitLayout.css.js.map +1 -0
- package/dist-cjs/split-layout/SplitLayout.js +18 -1
- package/dist-cjs/split-layout/SplitLayout.js.map +1 -1
- package/dist-cjs/stack-layout/StackLayout.css.js +1 -1
- package/dist-cjs/utils/useId.js +1 -1
- package/dist-cjs/utils/useId.js.map +1 -1
- package/dist-es/flex-layout/FlexLayout.css.js +1 -1
- package/dist-es/spinner/Spinner.css.js +1 -1
- package/dist-es/spinner/Spinner.js +5 -2
- package/dist-es/spinner/Spinner.js.map +1 -1
- package/dist-es/spinner/svgSpinners/SpinnerSVG.js +57 -47
- package/dist-es/spinner/svgSpinners/SpinnerSVG.js.map +1 -1
- package/dist-es/split-layout/SplitLayout.css.js +4 -0
- package/dist-es/split-layout/SplitLayout.css.js.map +1 -0
- package/dist-es/split-layout/SplitLayout.js +18 -1
- package/dist-es/split-layout/SplitLayout.js.map +1 -1
- package/dist-es/stack-layout/StackLayout.css.js +1 -1
- package/dist-es/utils/useId.js +1 -1
- package/dist-es/utils/useId.js.map +1 -1
- package/dist-types/spinner/Spinner.d.ts +3 -3
- package/dist-types/spinner/svgSpinners/SpinnerSVG.d.ts +8 -2
- package/package.json +2 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var css_248z = "
|
|
3
|
+
var css_248z = "/* Default variables applied to the root element */\n.saltFlexLayout {\n --flexLayout-gap-multiplier: var(--flexLayout-gap-density-multiplier, 3);\n --flexLayout-layout-display: flex;\n --flexLayout-direction: row;\n --flexLayout-wrap: nowrap;\n --flexLayout-justify: flex-start;\n --flexLayout-align: stretch;\n --flexLayout-separator: var(--salt-size-border);\n --flexLayout-gap: calc(var(--salt-size-unit) * var(--flexLayout-gap-multiplier));\n}\n\n/* Style applied to the root element */\n.saltFlexLayout {\n gap: var(--flexLayout-gap);\n display: var(--flexLayout-layout-display);\n flex-direction: var(--flexLayout-direction);\n flex-wrap: var(--flexLayout-wrap);\n justify-content: var(--flexLayout-justify);\n align-items: var(--flexLayout-align);\n}\n\n.saltFlexLayout-separator {\n gap: calc(var(--flexLayout-gap) * 2);\n}\n\n.saltFlexLayout-separator > * {\n position: relative;\n}\n.saltFlexLayout-separator > *:not(:last-child)::after {\n position: absolute;\n display: block;\n content: \"\";\n background-color: var(--salt-separable-secondary-borderColor);\n}\n\n/* Row separator */\n\n.saltFlexLayout-separator-row > *:not(:last-child)::after {\n height: 100%;\n}\n\n.saltFlexLayout-separator-row > *:not(:last-child)::after {\n width: var(--flexLayout-separator);\n top: 0;\n}\n.saltFlexLayout-separator-row-start > *:not(:last-child)::after {\n right: 0;\n}\n.saltFlexLayout-separator-row-center > *:not(:last-child)::after {\n right: calc(var(--flexLayout-gap) * -1);\n}\n.saltFlexLayout-separator-row-end > *:not(:last-child)::after {\n right: calc(var(--flexLayout-gap) * -2);\n}\n\n/* Column separator */\n.saltFlexLayout-separator-column > *:not(:last-child)::after {\n width: 100%;\n}\n\n.saltFlexLayout-separator-column > *:not(:last-child)::after {\n height: var(--flexLayout-separator);\n left: 0;\n width: 100%;\n}\n.saltFlexLayout-separator-column-start > *:not(:last-child)::after {\n bottom: 0;\n}\n.saltFlexLayout-separator-column-center > *:not(:last-child)::after {\n bottom: calc(var(--flexLayout-gap) * -1);\n}\n.saltFlexLayout-separator-column-end > *:not(:last-child)::after {\n bottom: calc(var(--flexLayout-gap) * -2);\n}\n";
|
|
4
4
|
|
|
5
5
|
module.exports = css_248z;
|
|
6
6
|
//# sourceMappingURL=FlexLayout.css.js.map
|
|
@@ -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-accent-background));\n}\n\n/* Styles applied when `size=\"default\"` */\n.saltSpinner-default {\n height: var(--salt-size-base);\n width: var(--salt-size-base);\n}\n\n/* Styles applied when `size=\"large\"` */\n.saltSpinner-large {\n height: calc(var(--salt-size-base) * 2);\n width: calc(var(--salt-size-base) * 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";
|
|
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-accent-background));\n}\n\n/* Styles applied when `size=\"default\"` */\n.saltSpinner-default {\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-bar-small);\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";
|
|
4
4
|
|
|
5
5
|
module.exports = css_248z;
|
|
6
6
|
//# sourceMappingURL=Spinner.css.js.map
|
|
@@ -10,14 +10,14 @@ var useAriaAnnouncer = require('../aria-announcer/useAriaAnnouncer.js');
|
|
|
10
10
|
var makePrefixer = require('../utils/makePrefixer.js');
|
|
11
11
|
require('../utils/useFloatingUI/useFloatingUI.js');
|
|
12
12
|
var useId = require('../utils/useId.js');
|
|
13
|
-
require('../salt-provider/SaltProvider.js');
|
|
13
|
+
var SaltProvider = require('../salt-provider/SaltProvider.js');
|
|
14
14
|
require('../viewport/ViewportProvider.js');
|
|
15
15
|
var SpinnerSVG = require('./svgSpinners/SpinnerSVG.js');
|
|
16
16
|
var Spinner$1 = require('./Spinner.css.js');
|
|
17
17
|
var window = require('@salt-ds/window');
|
|
18
18
|
var styles = require('@salt-ds/styles');
|
|
19
19
|
|
|
20
|
-
const SpinnerSizeValues = ["default", "large"];
|
|
20
|
+
const SpinnerSizeValues = ["default", "large", "small"];
|
|
21
21
|
const withBaseName = makePrefixer.makePrefixer("saltSpinner");
|
|
22
22
|
const Spinner = React.forwardRef(
|
|
23
23
|
function Spinner2({
|
|
@@ -40,6 +40,7 @@ const Spinner = React.forwardRef(
|
|
|
40
40
|
window: targetWindow
|
|
41
41
|
});
|
|
42
42
|
const { announce } = useAriaAnnouncer.useAriaAnnouncer();
|
|
43
|
+
const density = SaltProvider.useDensity();
|
|
43
44
|
React.useEffect(() => {
|
|
44
45
|
if (disableAnnouncer)
|
|
45
46
|
return;
|
|
@@ -78,6 +79,8 @@ const Spinner = React.forwardRef(
|
|
|
78
79
|
role,
|
|
79
80
|
...rest,
|
|
80
81
|
children: /* @__PURE__ */ jsxRuntime.jsx(SpinnerSVG.SpinnerSVG, {
|
|
82
|
+
size,
|
|
83
|
+
density,
|
|
81
84
|
id
|
|
82
85
|
})
|
|
83
86
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Spinner.js","sources":["../src/spinner/Spinner.tsx"],"sourcesContent":["import { clsx } from \"clsx\";\nimport { forwardRef, HTMLAttributes, useEffect } from \"react\";\nimport { useAriaAnnouncer } from \"../aria-announcer\";\nimport { makePrefixer, useId } from \"../utils\";\nimport { SpinnerSVG } from \"./svgSpinners/SpinnerSVG\";\n\nimport spinnerCss from \"./Spinner.css\";\nimport { useWindow } from \"@salt-ds/window\";\nimport { useComponentCssInjection } from \"@salt-ds/styles\";\n\n/**\n * Spinner component, provides an indeterminate loading indicator\n *\n * @example\n * <Spinner size=\"default | large\" />\n */\n\nexport const SpinnerSizeValues = [\"default\", \"large\"] as const;\nexport type SpinnerSize = (typeof SpinnerSizeValues)[number];\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'.\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 role = \"img\",\n className,\n size = \"default\",\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 useEffect(() => {\n if (disableAnnouncer) return;\n\n announce(ariaLabel);\n\n const startTime = new Date().getTime();\n\n const interval =\n announcerInterval > 0 &&\n setInterval(() => {\n if (new Date().getTime() - 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={role}\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":";;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"Spinner.js","sources":["../src/spinner/Spinner.tsx"],"sourcesContent":["import { clsx } from \"clsx\";\nimport { forwardRef, HTMLAttributes, useEffect } from \"react\";\nimport { useAriaAnnouncer } from \"../aria-announcer\";\nimport { makePrefixer, useId } from \"../utils\";\nimport { SpinnerSVG } from \"./svgSpinners/SpinnerSVG\";\n\nimport spinnerCss from \"./Spinner.css\";\nimport { useWindow } from \"@salt-ds/window\";\nimport { useComponentCssInjection } from \"@salt-ds/styles\";\nimport { useDensity } from \"../salt-provider\";\n\n/**\n * Spinner component, provides an indeterminate loading indicator\n *\n * @example\n * <Spinner size=\"default | \"large\" | \"small\" />\n */\n\nexport const SpinnerSizeValues = [\"default\", \"large\", \"small\"] as const;\nexport type SpinnerSize = (typeof SpinnerSizeValues)[number];\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'.\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 role = \"img\",\n className,\n size = \"default\",\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 density = useDensity();\n\n useEffect(() => {\n if (disableAnnouncer) return;\n\n announce(ariaLabel);\n\n const startTime = new Date().getTime();\n\n const interval =\n announcerInterval > 0 &&\n setInterval(() => {\n if (new Date().getTime() - 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={role}\n {...rest}\n >\n <SpinnerSVG size={size} density={density} id={id} />\n </div>\n );\n }\n);\n"],"names":["makePrefixer","forwardRef","Spinner","useId","useWindow","useComponentCssInjection","spinnerCss","useAriaAnnouncer","useDensity","useEffect","jsx","clsx","SpinnerSVG"],"mappings":";;;;;;;;;;;;;;;;;;;AAkBO,MAAM,iBAAoB,GAAA,CAAC,SAAW,EAAA,OAAA,EAAS,OAAO,EAAA;AAE7D,MAAM,YAAA,GAAeA,0BAAa,aAAa,CAAA,CAAA;AAqCxC,MAAM,OAAU,GAAAC,gBAAA;AAAA,EACrB,SAASC,QACP,CAAA;AAAA,IACE,cAAc,SAAY,GAAA,SAAA;AAAA,IAC1B,iBAAoB,GAAA,GAAA;AAAA,IACpB,gBAAmB,GAAA,GAAA;AAAA,IACnB,yBAAyB,CAAY,SAAA,EAAA,SAAA,CAAA,CAAA;AAAA,IACrC,gBAAA;AAAA,IACA,IAAO,GAAA,KAAA;AAAA,IACP,SAAA;AAAA,IACA,IAAO,GAAA,SAAA;AAAA,IACP,EAAI,EAAA,MAAA;AAAA,IACD,GAAA,IAAA;AAAA,KAEL,GACA,EAAA;AACA,IAAM,MAAA,EAAA,GAAKC,YAAM,MAAM,CAAA,CAAA;AACvB,IAAA,MAAM,eAAeC,gBAAU,EAAA,CAAA;AAC/B,IAAyBC,+BAAA,CAAA;AAAA,MACvB,MAAQ,EAAA,cAAA;AAAA,MACR,GAAK,EAAAC,SAAA;AAAA,MACL,MAAQ,EAAA,YAAA;AAAA,KACT,CAAA,CAAA;AAED,IAAM,MAAA,EAAE,QAAS,EAAA,GAAIC,iCAAiB,EAAA,CAAA;AAEtC,IAAA,MAAM,UAAUC,uBAA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A;AAAA,QAAW,IAAA;AAAA,QAAY,OAAA;AAAA,QAAkB,EAAA;AAAA,OAAQ,CAAA;AAAA,KACpD,CAAA,CAAA;AAAA,GAEJ;AACF;;;;;"}
|
|
@@ -12,65 +12,75 @@ require('../../viewport/ViewportProvider.js');
|
|
|
12
12
|
require('clsx');
|
|
13
13
|
|
|
14
14
|
const withBaseName = makePrefixer.makePrefixer("saltSpinner");
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
const sizeAndStrokeWidthMapping = {
|
|
16
|
+
default: {
|
|
17
|
+
high: { width: 20, strokeWidth: 2 },
|
|
18
|
+
medium: { width: 28, strokeWidth: 4 },
|
|
19
|
+
low: { width: 36, strokeWidth: 6 },
|
|
20
|
+
touch: { width: 44, strokeWidth: 8 }
|
|
21
|
+
},
|
|
22
|
+
large: {
|
|
23
|
+
high: { width: 40, strokeWidth: 2 },
|
|
24
|
+
medium: { width: 56, strokeWidth: 4 },
|
|
25
|
+
low: { width: 72, strokeWidth: 6 },
|
|
26
|
+
touch: { width: 88, strokeWidth: 8 }
|
|
27
|
+
},
|
|
28
|
+
small: {
|
|
29
|
+
high: { width: 12, strokeWidth: 2 },
|
|
30
|
+
medium: { width: 12, strokeWidth: 2 },
|
|
31
|
+
low: { width: 14, strokeWidth: 2 },
|
|
32
|
+
touch: { width: 16, strokeWidth: 2 }
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
const SpinnerSVG = ({
|
|
36
|
+
id = "svg-spinner",
|
|
37
|
+
rest,
|
|
38
|
+
size,
|
|
39
|
+
density
|
|
40
|
+
}) => {
|
|
41
|
+
const { width, strokeWidth } = sizeAndStrokeWidthMapping[size][density];
|
|
42
|
+
const radius = (width - strokeWidth) / 2;
|
|
18
43
|
return /* @__PURE__ */ jsxRuntime.jsxs("svg", {
|
|
19
44
|
className: withBaseName("spinner"),
|
|
20
|
-
viewBox:
|
|
45
|
+
viewBox: `0 0 ${width} ${width}`,
|
|
21
46
|
id,
|
|
22
47
|
...rest,
|
|
23
48
|
children: [
|
|
24
|
-
/* @__PURE__ */ jsxRuntime.
|
|
25
|
-
children:
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
id: `${id}-2`,
|
|
45
|
-
x1: "13%",
|
|
46
|
-
x2: "100%",
|
|
47
|
-
y1: "0%",
|
|
48
|
-
y2: "87%",
|
|
49
|
-
children: [
|
|
50
|
-
/* @__PURE__ */ jsxRuntime.jsx("stop", {
|
|
51
|
-
className: withBaseName("gradientStop"),
|
|
52
|
-
offset: "0%"
|
|
53
|
-
}),
|
|
54
|
-
/* @__PURE__ */ jsxRuntime.jsx("stop", {
|
|
55
|
-
className: withBaseName("gradientStop"),
|
|
56
|
-
offset: "100%",
|
|
57
|
-
stopOpacity: "0"
|
|
58
|
-
})
|
|
59
|
-
]
|
|
60
|
-
})
|
|
61
|
-
]
|
|
49
|
+
/* @__PURE__ */ jsxRuntime.jsx("defs", {
|
|
50
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs("linearGradient", {
|
|
51
|
+
id: `${id}-1`,
|
|
52
|
+
x1: "0",
|
|
53
|
+
y1: "0",
|
|
54
|
+
x2: "100%",
|
|
55
|
+
y2: "0",
|
|
56
|
+
children: [
|
|
57
|
+
/* @__PURE__ */ jsxRuntime.jsx("stop", {
|
|
58
|
+
className: withBaseName("gradientStop"),
|
|
59
|
+
offset: "15%",
|
|
60
|
+
stopOpacity: "1"
|
|
61
|
+
}),
|
|
62
|
+
/* @__PURE__ */ jsxRuntime.jsx("stop", {
|
|
63
|
+
className: withBaseName("gradientStop"),
|
|
64
|
+
offset: "100%",
|
|
65
|
+
stopOpacity: "0"
|
|
66
|
+
})
|
|
67
|
+
]
|
|
68
|
+
})
|
|
62
69
|
}),
|
|
63
70
|
/* @__PURE__ */ jsxRuntime.jsxs("g", {
|
|
64
71
|
fill: "none",
|
|
65
|
-
fillRule: "evenodd",
|
|
66
72
|
children: [
|
|
67
73
|
/* @__PURE__ */ jsxRuntime.jsx("path", {
|
|
68
|
-
d:
|
|
69
|
-
|
|
74
|
+
d: `M${width - strokeWidth / 2},${width / 2} a${radius},${radius} 0 1,0 -${width - strokeWidth},0`,
|
|
75
|
+
stroke: "var(--saltSpinner-gradient-color, var(--salt-accent-background)",
|
|
76
|
+
strokeWidth: "var(--spinner-strokeWidth)",
|
|
77
|
+
fill: "none"
|
|
70
78
|
}),
|
|
71
79
|
/* @__PURE__ */ jsxRuntime.jsx("path", {
|
|
72
|
-
d:
|
|
73
|
-
|
|
80
|
+
d: `M${width / 2},${strokeWidth / 2} a${radius},${radius} 0 1,0 0,${width - strokeWidth}`,
|
|
81
|
+
stroke: `url(#${id}-1)`,
|
|
82
|
+
strokeWidth: "var(--spinner-strokeWidth)",
|
|
83
|
+
fill: "none"
|
|
74
84
|
})
|
|
75
85
|
]
|
|
76
86
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SpinnerSVG.js","sources":["../src/spinner/svgSpinners/SpinnerSVG.tsx"],"sourcesContent":["import { SVGAttributes } from \"react\";\nimport { makePrefixer } from \"../../utils\";\n\nconst withBaseName = makePrefixer(\"saltSpinner\");\n\
|
|
1
|
+
{"version":3,"file":"SpinnerSVG.js","sources":["../src/spinner/svgSpinners/SpinnerSVG.tsx"],"sourcesContent":["import { SVGAttributes } from \"react\";\nimport { makePrefixer } from \"../../utils\";\nimport { SpinnerSize } from \"../Spinner\";\nimport { Density } from \"../../theme\";\n\nconst withBaseName = makePrefixer(\"saltSpinner\");\n\ninterface SpinnerProps {\n id?: string;\n rest?: Omit<SVGAttributes<SVGSVGElement>, \"id\">;\n size: SpinnerSize;\n density: Density;\n}\n\nconst sizeAndStrokeWidthMapping = {\n default: {\n high: { width: 20, strokeWidth: 2 },\n medium: { width: 28, strokeWidth: 4 },\n low: { width: 36, strokeWidth: 6 },\n touch: { width: 44, strokeWidth: 8 },\n },\n large: {\n high: { width: 40, strokeWidth: 2 },\n medium: { width: 56, strokeWidth: 4 },\n low: { width: 72, strokeWidth: 6 },\n touch: { width: 88, strokeWidth: 8 },\n },\n small: {\n high: { width: 12, strokeWidth: 2 },\n medium: { width: 12, strokeWidth: 2 },\n low: { width: 14, strokeWidth: 2 },\n touch: { width: 16, strokeWidth: 2 },\n },\n};\n\nexport const SpinnerSVG = ({\n id = \"svg-spinner\",\n rest,\n size,\n density,\n}: SpinnerProps) => {\n const { width, strokeWidth } = sizeAndStrokeWidthMapping[size][density];\n const radius = (width - strokeWidth) / 2;\n\n return (\n <svg\n className={withBaseName(\"spinner\")}\n viewBox={`0 0 ${width} ${width}`}\n id={id}\n {...rest}\n >\n <defs>\n <linearGradient id={`${id}-1`} x1=\"0\" y1=\"0\" x2=\"100%\" 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 <g fill=\"none\">\n {/* \n This first path draws the top half of the circle without a gradient. \n It starts from the right end, moves in a circular arc, and ends at the left end.\n */}\n <path\n d={`M${width - strokeWidth / 2},${\n width / 2\n } a${radius},${radius} 0 1,0 -${width - strokeWidth},0`}\n stroke=\"var(--saltSpinner-gradient-color, var(--salt-accent-background)\"\n strokeWidth=\"var(--spinner-strokeWidth)\"\n fill=\"none\"\n />\n {/* \n This second path draws the left half of the circle with a gradient that transitions \n from opaque on the left to transparent on the right.\n It starts from the top-center, moves in a circular arc, and ends at the bottom-center.\n */}\n <path\n d={`M${width / 2},${strokeWidth / 2} a${radius},${radius} 0 1,0 0,${\n width - strokeWidth\n }`}\n stroke={`url(#${id}-1)`}\n stroke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;AAAA,YACC,CAAA,EAAG,IAAI,KAAQ,GAAA,WAAA,GAAc,KAC3B,KAAQ,GAAA,CAAA,CAAA,EAAA,EACL,MAAU,CAAA,CAAA,EAAA,MAAA,CAAA,QAAA,EAAiB,KAAQ,GAAA,WAAA,CAAA,EAAA,CAAA;AAAA,YACxC,MAAO,EAAA,iEAAA;AAAA,YACP,WAAY,EAAA,4BAAA;AAAA,YACZ,IAAK,EAAA,MAAA;AAAA,WACP,CAAA;AAAA,0BAMCA,cAAA,CAAA,MAAA,EAAA;AAAA,YACC,CAAA,EAAG,IAAI,KAAQ,GAAA,CAAA,CAAA,CAAA,EAAK,cAAc,CAAM,CAAA,EAAA,EAAA,MAAA,CAAA,CAAA,EAAU,kBAChD,KAAQ,GAAA,WAAA,CAAA,CAAA;AAAA,YAEV,QAAQ,CAAQ,KAAA,EAAA,EAAA,CAAA,GAAA,CAAA;AAAA,YAChB,WAAY,EAAA,4BAAA;AAAA,YACZ,IAAK,EAAA,MAAA;AAAA,WACP,CAAA;AAAA,SAAA;AAAA,OACF,CAAA;AAAA,KAAA;AAAA,GACF,CAAA,CAAA;AAEJ;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SplitLayout.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
|
|
@@ -5,11 +5,28 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var jsxRuntime = require('react/jsx-runtime');
|
|
6
6
|
var React = require('react');
|
|
7
7
|
var FlexLayout = require('../flex-layout/FlexLayout.js');
|
|
8
|
+
var makePrefixer = require('../utils/makePrefixer.js');
|
|
9
|
+
require('../utils/useFloatingUI/useFloatingUI.js');
|
|
10
|
+
require('../utils/useId.js');
|
|
11
|
+
require('../salt-provider/SaltProvider.js');
|
|
12
|
+
require('../viewport/ViewportProvider.js');
|
|
13
|
+
var clsx = require('clsx');
|
|
14
|
+
var SplitLayout$1 = require('./SplitLayout.css.js');
|
|
15
|
+
var window = require('@salt-ds/window');
|
|
16
|
+
var styles = require('@salt-ds/styles');
|
|
8
17
|
|
|
18
|
+
const withBaseName = makePrefixer.makePrefixer("saltSplitLayout");
|
|
9
19
|
const SplitLayout = React.forwardRef(
|
|
10
|
-
({ endItem, startItem, ...rest }, ref) => {
|
|
20
|
+
({ endItem, startItem, className, ...rest }, ref) => {
|
|
21
|
+
const targetWindow = window.useWindow();
|
|
22
|
+
styles.useComponentCssInjection({
|
|
23
|
+
testId: "salt-split-layout",
|
|
24
|
+
css: SplitLayout$1,
|
|
25
|
+
window: targetWindow
|
|
26
|
+
});
|
|
11
27
|
const justify = endItem && !startItem ? "end" : "space-between";
|
|
12
28
|
return /* @__PURE__ */ jsxRuntime.jsxs(FlexLayout.FlexLayout, {
|
|
29
|
+
className: clsx.clsx(withBaseName(), className),
|
|
13
30
|
ref,
|
|
14
31
|
justify,
|
|
15
32
|
...rest,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SplitLayout.js","sources":["../src/split-layout/SplitLayout.tsx"],"sourcesContent":["import { ElementType, forwardRef, ReactElement, ReactNode } from \"react\";\nimport { FlexLayout, FlexLayoutProps } from \"../flex-layout\";\nimport {
|
|
1
|
+
{"version":3,"file":"SplitLayout.js","sources":["../src/split-layout/SplitLayout.tsx"],"sourcesContent":["import { ElementType, forwardRef, ReactElement, ReactNode } from \"react\";\nimport { FlexLayout, FlexLayoutProps } from \"../flex-layout\";\nimport {\n makePrefixer,\n PolymorphicComponentPropWithRef,\n PolymorphicRef,\n} from \"../utils\";\nimport splitLayoutCss from \"./SplitLayout.css\";\nimport { useWindow } from \"@salt-ds/window\";\nimport { useComponentCssInjection } from \"@salt-ds/styles\";\nimport { clsx } from \"clsx\";\n\nconst withBaseName = makePrefixer(\"saltSplitLayout\");\n\nexport type SplitLayoutProps<T extends ElementType> =\n PolymorphicComponentPropWithRef<\n T,\n {\n /**\n * Defines the default behavior for how flex items are laid out along the cross axis on the current line.\n */\n align?: FlexLayoutProps<ElementType>[\"align\"];\n /**\n * Establishes the main-axis, defining the direction children are placed. Default is \"row\".\n */\n direction?: FlexLayoutProps<ElementType>[\"direction\"];\n /**\n * End component to be rendered.\n */\n endItem?: ReactNode;\n /**\n * Controls the space between left and right items.\n */\n gap?: FlexLayoutProps<ElementType>[\"gap\"];\n /**\n * Start component to be rendered.\n */\n startItem?: ReactNode;\n }\n >;\n\ntype SplitLayoutComponent = <T extends ElementType = \"div\">(\n props: SplitLayoutProps<T>\n) => ReactElement | null;\n\nexport const SplitLayout: SplitLayoutComponent = forwardRef(\n <T extends ElementType = \"div\">(\n { endItem, startItem, className, ...rest }: SplitLayoutProps<T>,\n ref?: PolymorphicRef<T>\n ) => {\n const targetWindow = useWindow();\n useComponentCssInjection({\n testId: \"salt-split-layout\",\n css: splitLayoutCss,\n window: targetWindow,\n });\n\n const justify = endItem && !startItem ? \"end\" : \"space-between\";\n return (\n <FlexLayout\n className={clsx(withBaseName(), className)}\n ref={ref}\n justify={justify}\n {...rest}\n >\n {startItem}\n {endItem}\n </FlexLayout>\n );\n }\n);\n"],"names":["makePrefixer","forwardRef","useWindow","useComponentCssInjection","splitLayoutCss","jsxs","FlexLayout","clsx"],"mappings":";;;;;;;;;;;;;;;;;AAYA,MAAM,YAAA,GAAeA,0BAAa,iBAAiB,CAAA,CAAA;AAiC5C,MAAM,WAAoC,GAAAC,gBAAA;AAAA,EAC/C,CACE,EAAE,OAAA,EAAS,WAAW,SAAc,EAAA,GAAA,IAAA,IACpC,GACG,KAAA;AACH,IAAA,MAAM,eAAeC,gBAAU,EAAA,CAAA;AAC/B,IAAyBC,+BAAA,CAAA;AAAA,MACvB,MAAQ,EAAA,mBAAA;AAAA,MACR,GAAK,EAAAC,aAAA;AAAA,MACL,MAAQ,EAAA,YAAA;AAAA,KACT,CAAA,CAAA;AAED,IAAA,MAAM,OAAU,GAAA,OAAA,IAAW,CAAC,SAAA,GAAY,KAAQ,GAAA,eAAA,CAAA;AAChD,IAAA,uBACGC,eAAA,CAAAC,qBAAA,EAAA;AAAA,MACC,SAAW,EAAAC,SAAA,CAAK,YAAa,EAAA,EAAG,SAAS,CAAA;AAAA,MACzC,GAAA;AAAA,MACA,OAAA;AAAA,MACC,GAAG,IAAA;AAAA,MAEH,QAAA,EAAA;AAAA,QAAA,SAAA;AAAA,QACA,OAAA;AAAA,OAAA;AAAA,KACH,CAAA,CAAA;AAAA,GAEJ;AACF;;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var css_248z = "/* Default variables applied to the root element */\n.saltStackLayout {\n --stackLayout-gap-multiplier: var(--stackLayout-gap-density-multiplier, 3);\n --stackLayout-separator-weight: var(--salt-size-border, 1);\n --stackLayout-gap: calc(var(--salt-size-unit) * var(--stackLayout-gap-multiplier));\n}\n\n.saltStackLayout-separator > * {\n position: relative;\n}\n.saltStackLayout-separator > *:not(:last-child)::after {\n position: absolute;\n display: block;\n content: \"\";\n background-color: var(--salt-separable-secondary-borderColor);\n}\n\n
|
|
3
|
+
var css_248z = "/* Default variables applied to the root element */\n.saltStackLayout {\n --stackLayout-gap-multiplier: var(--stackLayout-gap-density-multiplier, 3);\n --stackLayout-separator-weight: var(--salt-size-border, 1);\n --stackLayout-gap: calc(var(--salt-size-unit) * var(--stackLayout-gap-multiplier));\n}\n\n.saltStackLayout-separator > * {\n position: relative;\n}\n.saltStackLayout-separator > *:not(:last-child)::after {\n position: absolute;\n display: block;\n content: \"\";\n background-color: var(--salt-separable-secondary-borderColor);\n}\n\n/*\n * Seperator offset based on seperator alignment\n * var(--stackLayout-separator-weight) is used to take into account the thickness of the seperator,so even at higher weights it will be at the start/center/end\n*/\n.saltStackLayout-separator-start {\n --stackLayout-seperator-offset: calc(var(--stackLayout-separator-weight) * -1);\n}\n.saltStackLayout-separator-center {\n --stackLayout-seperator-offset: calc((var(--stackLayout-gap) * -0.5) + (var(--stackLayout-separator-weight) * -0.5));\n}\n.saltStackLayout-separator-end {\n --stackLayout-seperator-offset: calc(var(--stackLayout-gap) * -1);\n}\n\n/* When alignment is 'row' and we have seperators (last child doesn't need a seperator) */\n.saltStackLayout-row.saltStackLayout-separator > *:not(:last-child)::after {\n height: 100%;\n width: var(--stackLayout-separator-weight);\n right: var(--stackLayout-seperator-offset);\n top: 0;\n}\n\n/* When alignment is 'column' and we have seperators (last child doesn't need a seperator) */\n.saltStackLayout-column.saltStackLayout-separator > *:not(:last-child)::after {\n width: 100%;\n height: var(--stackLayout-separator-weight);\n bottom: var(--stackLayout-seperator-offset);\n left: 0;\n}\n";
|
|
4
4
|
|
|
5
5
|
module.exports = css_248z;
|
|
6
6
|
//# sourceMappingURL=StackLayout.css.js.map
|
package/dist-cjs/utils/useId.js
CHANGED
|
@@ -24,7 +24,7 @@ function _interopNamespace(e) {
|
|
|
24
24
|
|
|
25
25
|
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
26
26
|
|
|
27
|
-
const maybeReactUseId = React__namespace[
|
|
27
|
+
const maybeReactUseId = React__namespace["useId".toString()];
|
|
28
28
|
let globalId = BigInt(0);
|
|
29
29
|
function useIdLegacy(idOverride) {
|
|
30
30
|
const [defaultId, setDefaultId] = React__namespace.useState(idOverride);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useId.js","sources":["../src/utils/useId.ts"],"sourcesContent":["import * as React from \"react\";\n\n//
|
|
1
|
+
{"version":3,"file":"useId.js","sources":["../src/utils/useId.ts"],"sourcesContent":["import * as React from \"react\";\n\n// Workaround for https://github.com/webpack/webpack/issues/14814#issuecomment-1536757985\n// Without `toString()`, downstream library using webpack to re-bundle will error\n// eslint-disable-next-line\nconst maybeReactUseId: undefined | (() => string) = (React as any)[\n \"useId\".toString()\n];\n\nlet globalId = BigInt(0);\nfunction useIdLegacy(idOverride?: string): string | undefined {\n const [defaultId, setDefaultId] = React.useState(idOverride);\n const id = idOverride || defaultId;\n React.useEffect(() => {\n if (defaultId == null) {\n setDefaultId(`salt-${++globalId}`);\n }\n }, [defaultId]);\n return id;\n}\n\nexport function useId(idOverride?: string): string | undefined {\n if (maybeReactUseId !== undefined) {\n const reactId = maybeReactUseId();\n return idOverride ?? reactId;\n }\n // eslint-disable-next-line react-hooks/rules-of-hooks -- `React.useId` is invariant at runtime.\n return useIdLegacy(idOverride);\n}\n\n// Note: Some usages require that an id is returned on first call, not only post-first-render\n// (as with the useEffect solution). This can go away once we totally move to React 18\nexport function useIdMemo(idOverride?: string): string {\n const id = React.useMemo(() => {\n return idOverride ?? `salt-${++globalId}`;\n }, [idOverride]);\n return id;\n}\n"],"names":["React"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,MAAM,eAAA,GAA+CA,gBACnD,CAAA,OAAA,CAAQ,QAAS,EAAA,CAAA,CAAA;AAGnB,IAAI,QAAA,GAAW,OAAO,CAAC,CAAA,CAAA;AACvB,SAAS,YAAY,UAAyC,EAAA;AAC5D,EAAA,MAAM,CAAC,SAAW,EAAA,YAAY,CAAI,GAAAA,gBAAA,CAAM,SAAS,UAAU,CAAA,CAAA;AAC3D,EAAA,MAAM,KAAK,UAAc,IAAA,SAAA,CAAA;AACzB,EAAAA,gBAAA,CAAM,UAAU,MAAM;AACpB,IAAA,IAAI,aAAa,IAAM,EAAA;AACrB,MAAa,YAAA,CAAA,CAAA,KAAA,EAAQ,EAAE,QAAU,CAAA,CAAA,CAAA,CAAA;AAAA,KACnC;AAAA,GACF,EAAG,CAAC,SAAS,CAAC,CAAA,CAAA;AACd,EAAO,OAAA,EAAA,CAAA;AACT,CAAA;AAEO,SAAS,MAAM,UAAyC,EAAA;AAC7D,EAAA,IAAI,oBAAoB,KAAW,CAAA,EAAA;AACjC,IAAA,MAAM,UAAU,eAAgB,EAAA,CAAA;AAChC,IAAA,OAAO,UAAc,IAAA,IAAA,GAAA,UAAA,GAAA,OAAA,CAAA;AAAA,GACvB;AAEA,EAAA,OAAO,YAAY,UAAU,CAAA,CAAA;AAC/B,CAAA;AAIO,SAAS,UAAU,UAA6B,EAAA;AACrD,EAAM,MAAA,EAAA,GAAKA,gBAAM,CAAA,OAAA,CAAQ,MAAM;AAC7B,IAAO,OAAA,UAAA,IAAA,IAAA,GAAA,UAAA,GAAc,QAAQ,EAAE,QAAA,CAAA,CAAA,CAAA;AAAA,GACjC,EAAG,CAAC,UAAU,CAAC,CAAA,CAAA;AACf,EAAO,OAAA,EAAA,CAAA;AACT;;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var css_248z = "
|
|
1
|
+
var css_248z = "/* Default variables applied to the root element */\n.saltFlexLayout {\n --flexLayout-gap-multiplier: var(--flexLayout-gap-density-multiplier, 3);\n --flexLayout-layout-display: flex;\n --flexLayout-direction: row;\n --flexLayout-wrap: nowrap;\n --flexLayout-justify: flex-start;\n --flexLayout-align: stretch;\n --flexLayout-separator: var(--salt-size-border);\n --flexLayout-gap: calc(var(--salt-size-unit) * var(--flexLayout-gap-multiplier));\n}\n\n/* Style applied to the root element */\n.saltFlexLayout {\n gap: var(--flexLayout-gap);\n display: var(--flexLayout-layout-display);\n flex-direction: var(--flexLayout-direction);\n flex-wrap: var(--flexLayout-wrap);\n justify-content: var(--flexLayout-justify);\n align-items: var(--flexLayout-align);\n}\n\n.saltFlexLayout-separator {\n gap: calc(var(--flexLayout-gap) * 2);\n}\n\n.saltFlexLayout-separator > * {\n position: relative;\n}\n.saltFlexLayout-separator > *:not(:last-child)::after {\n position: absolute;\n display: block;\n content: \"\";\n background-color: var(--salt-separable-secondary-borderColor);\n}\n\n/* Row separator */\n\n.saltFlexLayout-separator-row > *:not(:last-child)::after {\n height: 100%;\n}\n\n.saltFlexLayout-separator-row > *:not(:last-child)::after {\n width: var(--flexLayout-separator);\n top: 0;\n}\n.saltFlexLayout-separator-row-start > *:not(:last-child)::after {\n right: 0;\n}\n.saltFlexLayout-separator-row-center > *:not(:last-child)::after {\n right: calc(var(--flexLayout-gap) * -1);\n}\n.saltFlexLayout-separator-row-end > *:not(:last-child)::after {\n right: calc(var(--flexLayout-gap) * -2);\n}\n\n/* Column separator */\n.saltFlexLayout-separator-column > *:not(:last-child)::after {\n width: 100%;\n}\n\n.saltFlexLayout-separator-column > *:not(:last-child)::after {\n height: var(--flexLayout-separator);\n left: 0;\n width: 100%;\n}\n.saltFlexLayout-separator-column-start > *:not(:last-child)::after {\n bottom: 0;\n}\n.saltFlexLayout-separator-column-center > *:not(:last-child)::after {\n bottom: calc(var(--flexLayout-gap) * -1);\n}\n.saltFlexLayout-separator-column-end > *:not(:last-child)::after {\n bottom: calc(var(--flexLayout-gap) * -2);\n}\n";
|
|
2
2
|
|
|
3
3
|
export { css_248z as default };
|
|
4
4
|
//# sourceMappingURL=FlexLayout.css.js.map
|
|
@@ -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-accent-background));\n}\n\n/* Styles applied when `size=\"default\"` */\n.saltSpinner-default {\n height: var(--salt-size-base);\n width: var(--salt-size-base);\n}\n\n/* Styles applied when `size=\"large\"` */\n.saltSpinner-large {\n height: calc(var(--salt-size-base) * 2);\n width: calc(var(--salt-size-base) * 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";
|
|
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-accent-background));\n}\n\n/* Styles applied when `size=\"default\"` */\n.saltSpinner-default {\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-bar-small);\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";
|
|
2
2
|
|
|
3
3
|
export { css_248z as default };
|
|
4
4
|
//# sourceMappingURL=Spinner.css.js.map
|
|
@@ -6,14 +6,14 @@ import { useAriaAnnouncer } from '../aria-announcer/useAriaAnnouncer.js';
|
|
|
6
6
|
import { makePrefixer } from '../utils/makePrefixer.js';
|
|
7
7
|
import '../utils/useFloatingUI/useFloatingUI.js';
|
|
8
8
|
import { useId } from '../utils/useId.js';
|
|
9
|
-
import '../salt-provider/SaltProvider.js';
|
|
9
|
+
import { useDensity } from '../salt-provider/SaltProvider.js';
|
|
10
10
|
import '../viewport/ViewportProvider.js';
|
|
11
11
|
import { SpinnerSVG } from './svgSpinners/SpinnerSVG.js';
|
|
12
12
|
import css_248z from './Spinner.css.js';
|
|
13
13
|
import { useWindow } from '@salt-ds/window';
|
|
14
14
|
import { useComponentCssInjection } from '@salt-ds/styles';
|
|
15
15
|
|
|
16
|
-
const SpinnerSizeValues = ["default", "large"];
|
|
16
|
+
const SpinnerSizeValues = ["default", "large", "small"];
|
|
17
17
|
const withBaseName = makePrefixer("saltSpinner");
|
|
18
18
|
const Spinner = forwardRef(
|
|
19
19
|
function Spinner2({
|
|
@@ -36,6 +36,7 @@ const Spinner = forwardRef(
|
|
|
36
36
|
window: targetWindow
|
|
37
37
|
});
|
|
38
38
|
const { announce } = useAriaAnnouncer();
|
|
39
|
+
const density = useDensity();
|
|
39
40
|
useEffect(() => {
|
|
40
41
|
if (disableAnnouncer)
|
|
41
42
|
return;
|
|
@@ -74,6 +75,8 @@ const Spinner = forwardRef(
|
|
|
74
75
|
role,
|
|
75
76
|
...rest,
|
|
76
77
|
children: /* @__PURE__ */ jsx(SpinnerSVG, {
|
|
78
|
+
size,
|
|
79
|
+
density,
|
|
77
80
|
id
|
|
78
81
|
})
|
|
79
82
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Spinner.js","sources":["../src/spinner/Spinner.tsx"],"sourcesContent":["import { clsx } from \"clsx\";\nimport { forwardRef, HTMLAttributes, useEffect } from \"react\";\nimport { useAriaAnnouncer } from \"../aria-announcer\";\nimport { makePrefixer, useId } from \"../utils\";\nimport { SpinnerSVG } from \"./svgSpinners/SpinnerSVG\";\n\nimport spinnerCss from \"./Spinner.css\";\nimport { useWindow } from \"@salt-ds/window\";\nimport { useComponentCssInjection } from \"@salt-ds/styles\";\n\n/**\n * Spinner component, provides an indeterminate loading indicator\n *\n * @example\n * <Spinner size=\"default | large\" />\n */\n\nexport const SpinnerSizeValues = [\"default\", \"large\"] as const;\nexport type SpinnerSize = (typeof SpinnerSizeValues)[number];\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'.\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 role = \"img\",\n className,\n size = \"default\",\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 useEffect(() => {\n if (disableAnnouncer) return;\n\n announce(ariaLabel);\n\n const startTime = new Date().getTime();\n\n const interval =\n announcerInterval > 0 &&\n setInterval(() => {\n if (new Date().getTime() - 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={role}\n {...rest}\n >\n <SpinnerSVG id={id} />\n </div>\n );\n }\n);\n"],"names":["Spinner","spinnerCss"],"mappings":";;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"Spinner.js","sources":["../src/spinner/Spinner.tsx"],"sourcesContent":["import { clsx } from \"clsx\";\nimport { forwardRef, HTMLAttributes, useEffect } from \"react\";\nimport { useAriaAnnouncer } from \"../aria-announcer\";\nimport { makePrefixer, useId } from \"../utils\";\nimport { SpinnerSVG } from \"./svgSpinners/SpinnerSVG\";\n\nimport spinnerCss from \"./Spinner.css\";\nimport { useWindow } from \"@salt-ds/window\";\nimport { useComponentCssInjection } from \"@salt-ds/styles\";\nimport { useDensity } from \"../salt-provider\";\n\n/**\n * Spinner component, provides an indeterminate loading indicator\n *\n * @example\n * <Spinner size=\"default | \"large\" | \"small\" />\n */\n\nexport const SpinnerSizeValues = [\"default\", \"large\", \"small\"] as const;\nexport type SpinnerSize = (typeof SpinnerSizeValues)[number];\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'.\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 role = \"img\",\n className,\n size = \"default\",\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 density = useDensity();\n\n useEffect(() => {\n if (disableAnnouncer) return;\n\n announce(ariaLabel);\n\n const startTime = new Date().getTime();\n\n const interval =\n announcerInterval > 0 &&\n setInterval(() => {\n if (new Date().getTime() - 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={role}\n {...rest}\n >\n <SpinnerSVG size={size} density={density} id={id} />\n </div>\n );\n }\n);\n"],"names":["Spinner","spinnerCss"],"mappings":";;;;;;;;;;;;;;;AAkBO,MAAM,iBAAoB,GAAA,CAAC,SAAW,EAAA,OAAA,EAAS,OAAO,EAAA;AAE7D,MAAM,YAAA,GAAe,aAAa,aAAa,CAAA,CAAA;AAqCxC,MAAM,OAAU,GAAA,UAAA;AAAA,EACrB,SAASA,QACP,CAAA;AAAA,IACE,cAAc,SAAY,GAAA,SAAA;AAAA,IAC1B,iBAAoB,GAAA,GAAA;AAAA,IACpB,gBAAmB,GAAA,GAAA;AAAA,IACnB,yBAAyB,CAAY,SAAA,EAAA,SAAA,CAAA,CAAA;AAAA,IACrC,gBAAA;AAAA,IACA,IAAO,GAAA,KAAA;AAAA,IACP,SAAA;AAAA,IACA,IAAO,GAAA,SAAA;AAAA,IACP,EAAI,EAAA,MAAA;AAAA,IACD,GAAA,IAAA;AAAA,KAEL,GACA,EAAA;AACA,IAAM,MAAA,EAAA,GAAK,MAAM,MAAM,CAAA,CAAA;AACvB,IAAA,MAAM,eAAe,SAAU,EAAA,CAAA;AAC/B,IAAyB,wBAAA,CAAA;AAAA,MACvB,MAAQ,EAAA,cAAA;AAAA,MACR,GAAK,EAAAC,QAAA;AAAA,MACL,MAAQ,EAAA,YAAA;AAAA,KACT,CAAA,CAAA;AAED,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,IAAA;AAAA,MACC,GAAG,IAAA;AAAA,MAEJ,QAAC,kBAAA,GAAA,CAAA,UAAA,EAAA;AAAA,QAAW,IAAA;AAAA,QAAY,OAAA;AAAA,QAAkB,EAAA;AAAA,OAAQ,CAAA;AAAA,KACpD,CAAA,CAAA;AAAA,GAEJ;AACF;;;;"}
|
|
@@ -8,65 +8,75 @@ import '../../viewport/ViewportProvider.js';
|
|
|
8
8
|
import 'clsx';
|
|
9
9
|
|
|
10
10
|
const withBaseName = makePrefixer("saltSpinner");
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
const sizeAndStrokeWidthMapping = {
|
|
12
|
+
default: {
|
|
13
|
+
high: { width: 20, strokeWidth: 2 },
|
|
14
|
+
medium: { width: 28, strokeWidth: 4 },
|
|
15
|
+
low: { width: 36, strokeWidth: 6 },
|
|
16
|
+
touch: { width: 44, strokeWidth: 8 }
|
|
17
|
+
},
|
|
18
|
+
large: {
|
|
19
|
+
high: { width: 40, strokeWidth: 2 },
|
|
20
|
+
medium: { width: 56, strokeWidth: 4 },
|
|
21
|
+
low: { width: 72, strokeWidth: 6 },
|
|
22
|
+
touch: { width: 88, strokeWidth: 8 }
|
|
23
|
+
},
|
|
24
|
+
small: {
|
|
25
|
+
high: { width: 12, strokeWidth: 2 },
|
|
26
|
+
medium: { width: 12, strokeWidth: 2 },
|
|
27
|
+
low: { width: 14, strokeWidth: 2 },
|
|
28
|
+
touch: { width: 16, strokeWidth: 2 }
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
const SpinnerSVG = ({
|
|
32
|
+
id = "svg-spinner",
|
|
33
|
+
rest,
|
|
34
|
+
size,
|
|
35
|
+
density
|
|
36
|
+
}) => {
|
|
37
|
+
const { width, strokeWidth } = sizeAndStrokeWidthMapping[size][density];
|
|
38
|
+
const radius = (width - strokeWidth) / 2;
|
|
14
39
|
return /* @__PURE__ */ jsxs("svg", {
|
|
15
40
|
className: withBaseName("spinner"),
|
|
16
|
-
viewBox:
|
|
41
|
+
viewBox: `0 0 ${width} ${width}`,
|
|
17
42
|
id,
|
|
18
43
|
...rest,
|
|
19
44
|
children: [
|
|
20
|
-
/* @__PURE__ */
|
|
21
|
-
children:
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
id: `${id}-2`,
|
|
41
|
-
x1: "13%",
|
|
42
|
-
x2: "100%",
|
|
43
|
-
y1: "0%",
|
|
44
|
-
y2: "87%",
|
|
45
|
-
children: [
|
|
46
|
-
/* @__PURE__ */ jsx("stop", {
|
|
47
|
-
className: withBaseName("gradientStop"),
|
|
48
|
-
offset: "0%"
|
|
49
|
-
}),
|
|
50
|
-
/* @__PURE__ */ jsx("stop", {
|
|
51
|
-
className: withBaseName("gradientStop"),
|
|
52
|
-
offset: "100%",
|
|
53
|
-
stopOpacity: "0"
|
|
54
|
-
})
|
|
55
|
-
]
|
|
56
|
-
})
|
|
57
|
-
]
|
|
45
|
+
/* @__PURE__ */ jsx("defs", {
|
|
46
|
+
children: /* @__PURE__ */ jsxs("linearGradient", {
|
|
47
|
+
id: `${id}-1`,
|
|
48
|
+
x1: "0",
|
|
49
|
+
y1: "0",
|
|
50
|
+
x2: "100%",
|
|
51
|
+
y2: "0",
|
|
52
|
+
children: [
|
|
53
|
+
/* @__PURE__ */ jsx("stop", {
|
|
54
|
+
className: withBaseName("gradientStop"),
|
|
55
|
+
offset: "15%",
|
|
56
|
+
stopOpacity: "1"
|
|
57
|
+
}),
|
|
58
|
+
/* @__PURE__ */ jsx("stop", {
|
|
59
|
+
className: withBaseName("gradientStop"),
|
|
60
|
+
offset: "100%",
|
|
61
|
+
stopOpacity: "0"
|
|
62
|
+
})
|
|
63
|
+
]
|
|
64
|
+
})
|
|
58
65
|
}),
|
|
59
66
|
/* @__PURE__ */ jsxs("g", {
|
|
60
67
|
fill: "none",
|
|
61
|
-
fillRule: "evenodd",
|
|
62
68
|
children: [
|
|
63
69
|
/* @__PURE__ */ jsx("path", {
|
|
64
|
-
d:
|
|
65
|
-
|
|
70
|
+
d: `M${width - strokeWidth / 2},${width / 2} a${radius},${radius} 0 1,0 -${width - strokeWidth},0`,
|
|
71
|
+
stroke: "var(--saltSpinner-gradient-color, var(--salt-accent-background)",
|
|
72
|
+
strokeWidth: "var(--spinner-strokeWidth)",
|
|
73
|
+
fill: "none"
|
|
66
74
|
}),
|
|
67
75
|
/* @__PURE__ */ jsx("path", {
|
|
68
|
-
d:
|
|
69
|
-
|
|
76
|
+
d: `M${width / 2},${strokeWidth / 2} a${radius},${radius} 0 1,0 0,${width - strokeWidth}`,
|
|
77
|
+
stroke: `url(#${id}-1)`,
|
|
78
|
+
strokeWidth: "var(--spinner-strokeWidth)",
|
|
79
|
+
fill: "none"
|
|
70
80
|
})
|
|
71
81
|
]
|
|
72
82
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SpinnerSVG.js","sources":["../src/spinner/svgSpinners/SpinnerSVG.tsx"],"sourcesContent":["import { SVGAttributes } from \"react\";\nimport { makePrefixer } from \"../../utils\";\n\nconst withBaseName = makePrefixer(\"saltSpinner\");\n\
|
|
1
|
+
{"version":3,"file":"SpinnerSVG.js","sources":["../src/spinner/svgSpinners/SpinnerSVG.tsx"],"sourcesContent":["import { SVGAttributes } from \"react\";\nimport { makePrefixer } from \"../../utils\";\nimport { SpinnerSize } from \"../Spinner\";\nimport { Density } from \"../../theme\";\n\nconst withBaseName = makePrefixer(\"saltSpinner\");\n\ninterface SpinnerProps {\n id?: string;\n rest?: Omit<SVGAttributes<SVGSVGElement>, \"id\">;\n size: SpinnerSize;\n density: Density;\n}\n\nconst sizeAndStrokeWidthMapping = {\n default: {\n high: { width: 20, strokeWidth: 2 },\n medium: { width: 28, strokeWidth: 4 },\n low: { width: 36, strokeWidth: 6 },\n touch: { width: 44, strokeWidth: 8 },\n },\n large: {\n high: { width: 40, strokeWidth: 2 },\n medium: { width: 56, strokeWidth: 4 },\n low: { width: 72, strokeWidth: 6 },\n touch: { width: 88, strokeWidth: 8 },\n },\n small: {\n high: { width: 12, strokeWidth: 2 },\n medium: { width: 12, strokeWidth: 2 },\n low: { width: 14, strokeWidth: 2 },\n touch: { width: 16, strokeWidth: 2 },\n },\n};\n\nexport const SpinnerSVG = ({\n id = \"svg-spinner\",\n rest,\n size,\n density,\n}: SpinnerProps) => {\n const { width, strokeWidth } = sizeAndStrokeWidthMapping[size][density];\n const radius = (width - strokeWidth) / 2;\n\n return (\n <svg\n className={withBaseName(\"spinner\")}\n viewBox={`0 0 ${width} ${width}`}\n id={id}\n {...rest}\n >\n <defs>\n <linearGradient id={`${id}-1`} x1=\"0\" y1=\"0\" x2=\"100%\" 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 <g fill=\"none\">\n {/* \n This first path draws the top half of the circle without a gradient. \n It starts from the right end, moves in a circular arc, and ends at the left end.\n */}\n <path\n d={`M${width - strokeWidth / 2},${\n width / 2\n } a${radius},${radius} 0 1,0 -${width - strokeWidth},0`}\n stroke=\"var(--saltSpinner-gradient-color, var(--salt-accent-background)\"\n strokeWidth=\"var(--spinner-strokeWidth)\"\n fill=\"none\"\n />\n {/* \n This second path draws the left half of the circle with a gradient that transitions \n from opaque on the left to transparent on the right.\n It starts from the top-center, moves in a circular arc, and ends at the bottom-center.\n */}\n <path\n d={`M${width / 2},${strokeWidth / 2} a${radius},${radius} 0 1,0 0,${\n width - strokeWidth\n }`}\n stroke={`url(#${id}-1)`}\n strokeWidth=\"var(--spinner-strokeWidth)\"\n fill=\"none\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,GAAA,CAAA,CAAA,EAAA,EACL,MAAU,CAAA,CAAA,EAAA,MAAA,CAAA,QAAA,EAAiB,KAAQ,GAAA,WAAA,CAAA,EAAA,CAAA;AAAA,YACxC,MAAO,EAAA,iEAAA;AAAA,YACP,WAAY,EAAA,4BAAA;AAAA,YACZ,IAAK,EAAA,MAAA;AAAA,WACP,CAAA;AAAA,0BAMC,GAAA,CAAA,MAAA,EAAA;AAAA,YACC,CAAA,EAAG,IAAI,KAAQ,GAAA,CAAA,CAAA,CAAA,EAAK,cAAc,CAAM,CAAA,EAAA,EAAA,MAAA,CAAA,CAAA,EAAU,kBAChD,KAAQ,GAAA,WAAA,CAAA,CAAA;AAAA,YAEV,QAAQ,CAAQ,KAAA,EAAA,EAAA,CAAA,GAAA,CAAA;AAAA,YAChB,WAAY,EAAA,4BAAA;AAAA,YACZ,IAAK,EAAA,MAAA;AAAA,WACP,CAAA;AAAA,SAAA;AAAA,OACF,CAAA;AAAA,KAAA;AAAA,GACF,CAAA,CAAA;AAEJ;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SplitLayout.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|
|
@@ -1,11 +1,28 @@
|
|
|
1
1
|
import { jsxs } from 'react/jsx-runtime';
|
|
2
2
|
import { forwardRef } from 'react';
|
|
3
3
|
import { FlexLayout } from '../flex-layout/FlexLayout.js';
|
|
4
|
+
import { makePrefixer } from '../utils/makePrefixer.js';
|
|
5
|
+
import '../utils/useFloatingUI/useFloatingUI.js';
|
|
6
|
+
import '../utils/useId.js';
|
|
7
|
+
import '../salt-provider/SaltProvider.js';
|
|
8
|
+
import '../viewport/ViewportProvider.js';
|
|
9
|
+
import { clsx } from 'clsx';
|
|
10
|
+
import css_248z from './SplitLayout.css.js';
|
|
11
|
+
import { useWindow } from '@salt-ds/window';
|
|
12
|
+
import { useComponentCssInjection } from '@salt-ds/styles';
|
|
4
13
|
|
|
14
|
+
const withBaseName = makePrefixer("saltSplitLayout");
|
|
5
15
|
const SplitLayout = forwardRef(
|
|
6
|
-
({ endItem, startItem, ...rest }, ref) => {
|
|
16
|
+
({ endItem, startItem, className, ...rest }, ref) => {
|
|
17
|
+
const targetWindow = useWindow();
|
|
18
|
+
useComponentCssInjection({
|
|
19
|
+
testId: "salt-split-layout",
|
|
20
|
+
css: css_248z,
|
|
21
|
+
window: targetWindow
|
|
22
|
+
});
|
|
7
23
|
const justify = endItem && !startItem ? "end" : "space-between";
|
|
8
24
|
return /* @__PURE__ */ jsxs(FlexLayout, {
|
|
25
|
+
className: clsx(withBaseName(), className),
|
|
9
26
|
ref,
|
|
10
27
|
justify,
|
|
11
28
|
...rest,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SplitLayout.js","sources":["../src/split-layout/SplitLayout.tsx"],"sourcesContent":["import { ElementType, forwardRef, ReactElement, ReactNode } from \"react\";\nimport { FlexLayout, FlexLayoutProps } from \"../flex-layout\";\nimport {
|
|
1
|
+
{"version":3,"file":"SplitLayout.js","sources":["../src/split-layout/SplitLayout.tsx"],"sourcesContent":["import { ElementType, forwardRef, ReactElement, ReactNode } from \"react\";\nimport { FlexLayout, FlexLayoutProps } from \"../flex-layout\";\nimport {\n makePrefixer,\n PolymorphicComponentPropWithRef,\n PolymorphicRef,\n} from \"../utils\";\nimport splitLayoutCss from \"./SplitLayout.css\";\nimport { useWindow } from \"@salt-ds/window\";\nimport { useComponentCssInjection } from \"@salt-ds/styles\";\nimport { clsx } from \"clsx\";\n\nconst withBaseName = makePrefixer(\"saltSplitLayout\");\n\nexport type SplitLayoutProps<T extends ElementType> =\n PolymorphicComponentPropWithRef<\n T,\n {\n /**\n * Defines the default behavior for how flex items are laid out along the cross axis on the current line.\n */\n align?: FlexLayoutProps<ElementType>[\"align\"];\n /**\n * Establishes the main-axis, defining the direction children are placed. Default is \"row\".\n */\n direction?: FlexLayoutProps<ElementType>[\"direction\"];\n /**\n * End component to be rendered.\n */\n endItem?: ReactNode;\n /**\n * Controls the space between left and right items.\n */\n gap?: FlexLayoutProps<ElementType>[\"gap\"];\n /**\n * Start component to be rendered.\n */\n startItem?: ReactNode;\n }\n >;\n\ntype SplitLayoutComponent = <T extends ElementType = \"div\">(\n props: SplitLayoutProps<T>\n) => ReactElement | null;\n\nexport const SplitLayout: SplitLayoutComponent = forwardRef(\n <T extends ElementType = \"div\">(\n { endItem, startItem, className, ...rest }: SplitLayoutProps<T>,\n ref?: PolymorphicRef<T>\n ) => {\n const targetWindow = useWindow();\n useComponentCssInjection({\n testId: \"salt-split-layout\",\n css: splitLayoutCss,\n window: targetWindow,\n });\n\n const justify = endItem && !startItem ? \"end\" : \"space-between\";\n return (\n <FlexLayout\n className={clsx(withBaseName(), className)}\n ref={ref}\n justify={justify}\n {...rest}\n >\n {startItem}\n {endItem}\n </FlexLayout>\n );\n }\n);\n"],"names":["splitLayoutCss"],"mappings":";;;;;;;;;;;;;AAYA,MAAM,YAAA,GAAe,aAAa,iBAAiB,CAAA,CAAA;AAiC5C,MAAM,WAAoC,GAAA,UAAA;AAAA,EAC/C,CACE,EAAE,OAAA,EAAS,WAAW,SAAc,EAAA,GAAA,IAAA,IACpC,GACG,KAAA;AACH,IAAA,MAAM,eAAe,SAAU,EAAA,CAAA;AAC/B,IAAyB,wBAAA,CAAA;AAAA,MACvB,MAAQ,EAAA,mBAAA;AAAA,MACR,GAAK,EAAAA,QAAA;AAAA,MACL,MAAQ,EAAA,YAAA;AAAA,KACT,CAAA,CAAA;AAED,IAAA,MAAM,OAAU,GAAA,OAAA,IAAW,CAAC,SAAA,GAAY,KAAQ,GAAA,eAAA,CAAA;AAChD,IAAA,uBACG,IAAA,CAAA,UAAA,EAAA;AAAA,MACC,SAAW,EAAA,IAAA,CAAK,YAAa,EAAA,EAAG,SAAS,CAAA;AAAA,MACzC,GAAA;AAAA,MACA,OAAA;AAAA,MACC,GAAG,IAAA;AAAA,MAEH,QAAA,EAAA;AAAA,QAAA,SAAA;AAAA,QACA,OAAA;AAAA,OAAA;AAAA,KACH,CAAA,CAAA;AAAA,GAEJ;AACF;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var css_248z = "/* Default variables applied to the root element */\n.saltStackLayout {\n --stackLayout-gap-multiplier: var(--stackLayout-gap-density-multiplier, 3);\n --stackLayout-separator-weight: var(--salt-size-border, 1);\n --stackLayout-gap: calc(var(--salt-size-unit) * var(--stackLayout-gap-multiplier));\n}\n\n.saltStackLayout-separator > * {\n position: relative;\n}\n.saltStackLayout-separator > *:not(:last-child)::after {\n position: absolute;\n display: block;\n content: \"\";\n background-color: var(--salt-separable-secondary-borderColor);\n}\n\n
|
|
1
|
+
var css_248z = "/* Default variables applied to the root element */\n.saltStackLayout {\n --stackLayout-gap-multiplier: var(--stackLayout-gap-density-multiplier, 3);\n --stackLayout-separator-weight: var(--salt-size-border, 1);\n --stackLayout-gap: calc(var(--salt-size-unit) * var(--stackLayout-gap-multiplier));\n}\n\n.saltStackLayout-separator > * {\n position: relative;\n}\n.saltStackLayout-separator > *:not(:last-child)::after {\n position: absolute;\n display: block;\n content: \"\";\n background-color: var(--salt-separable-secondary-borderColor);\n}\n\n/*\n * Seperator offset based on seperator alignment\n * var(--stackLayout-separator-weight) is used to take into account the thickness of the seperator,so even at higher weights it will be at the start/center/end\n*/\n.saltStackLayout-separator-start {\n --stackLayout-seperator-offset: calc(var(--stackLayout-separator-weight) * -1);\n}\n.saltStackLayout-separator-center {\n --stackLayout-seperator-offset: calc((var(--stackLayout-gap) * -0.5) + (var(--stackLayout-separator-weight) * -0.5));\n}\n.saltStackLayout-separator-end {\n --stackLayout-seperator-offset: calc(var(--stackLayout-gap) * -1);\n}\n\n/* When alignment is 'row' and we have seperators (last child doesn't need a seperator) */\n.saltStackLayout-row.saltStackLayout-separator > *:not(:last-child)::after {\n height: 100%;\n width: var(--stackLayout-separator-weight);\n right: var(--stackLayout-seperator-offset);\n top: 0;\n}\n\n/* When alignment is 'column' and we have seperators (last child doesn't need a seperator) */\n.saltStackLayout-column.saltStackLayout-separator > *:not(:last-child)::after {\n width: 100%;\n height: var(--stackLayout-separator-weight);\n bottom: var(--stackLayout-seperator-offset);\n left: 0;\n}\n";
|
|
2
2
|
|
|
3
3
|
export { css_248z as default };
|
|
4
4
|
//# sourceMappingURL=StackLayout.css.js.map
|
package/dist-es/utils/useId.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useId.js","sources":["../src/utils/useId.ts"],"sourcesContent":["import * as React from \"react\";\n\n//
|
|
1
|
+
{"version":3,"file":"useId.js","sources":["../src/utils/useId.ts"],"sourcesContent":["import * as React from \"react\";\n\n// Workaround for https://github.com/webpack/webpack/issues/14814#issuecomment-1536757985\n// Without `toString()`, downstream library using webpack to re-bundle will error\n// eslint-disable-next-line\nconst maybeReactUseId: undefined | (() => string) = (React as any)[\n \"useId\".toString()\n];\n\nlet globalId = BigInt(0);\nfunction useIdLegacy(idOverride?: string): string | undefined {\n const [defaultId, setDefaultId] = React.useState(idOverride);\n const id = idOverride || defaultId;\n React.useEffect(() => {\n if (defaultId == null) {\n setDefaultId(`salt-${++globalId}`);\n }\n }, [defaultId]);\n return id;\n}\n\nexport function useId(idOverride?: string): string | undefined {\n if (maybeReactUseId !== undefined) {\n const reactId = maybeReactUseId();\n return idOverride ?? reactId;\n }\n // eslint-disable-next-line react-hooks/rules-of-hooks -- `React.useId` is invariant at runtime.\n return useIdLegacy(idOverride);\n}\n\n// Note: Some usages require that an id is returned on first call, not only post-first-render\n// (as with the useEffect solution). This can go away once we totally move to React 18\nexport function useIdMemo(idOverride?: string): string {\n const id = React.useMemo(() => {\n return idOverride ?? `salt-${++globalId}`;\n }, [idOverride]);\n return id;\n}\n"],"names":[],"mappings":";;AAKA,MAAM,eAAA,GAA+C,KACnD,CAAA,OAAA,CAAQ,QAAS,EAAA,CAAA,CAAA;AAGnB,IAAI,QAAA,GAAW,OAAO,CAAC,CAAA,CAAA;AACvB,SAAS,YAAY,UAAyC,EAAA;AAC5D,EAAA,MAAM,CAAC,SAAW,EAAA,YAAY,CAAI,GAAA,KAAA,CAAM,SAAS,UAAU,CAAA,CAAA;AAC3D,EAAA,MAAM,KAAK,UAAc,IAAA,SAAA,CAAA;AACzB,EAAA,KAAA,CAAM,UAAU,MAAM;AACpB,IAAA,IAAI,aAAa,IAAM,EAAA;AACrB,MAAa,YAAA,CAAA,CAAA,KAAA,EAAQ,EAAE,QAAU,CAAA,CAAA,CAAA,CAAA;AAAA,KACnC;AAAA,GACF,EAAG,CAAC,SAAS,CAAC,CAAA,CAAA;AACd,EAAO,OAAA,EAAA,CAAA;AACT,CAAA;AAEO,SAAS,MAAM,UAAyC,EAAA;AAC7D,EAAA,IAAI,oBAAoB,KAAW,CAAA,EAAA;AACjC,IAAA,MAAM,UAAU,eAAgB,EAAA,CAAA;AAChC,IAAA,OAAO,UAAc,IAAA,IAAA,GAAA,UAAA,GAAA,OAAA,CAAA;AAAA,GACvB;AAEA,EAAA,OAAO,YAAY,UAAU,CAAA,CAAA;AAC/B,CAAA;AAIO,SAAS,UAAU,UAA6B,EAAA;AACrD,EAAM,MAAA,EAAA,GAAK,KAAM,CAAA,OAAA,CAAQ,MAAM;AAC7B,IAAO,OAAA,UAAA,IAAA,IAAA,GAAA,UAAA,GAAc,QAAQ,EAAE,QAAA,CAAA,CAAA,CAAA;AAAA,GACjC,EAAG,CAAC,UAAU,CAAC,CAAA,CAAA;AACf,EAAO,OAAA,EAAA,CAAA;AACT;;;;"}
|
|
@@ -3,9 +3,9 @@ import { HTMLAttributes } from "react";
|
|
|
3
3
|
* Spinner component, provides an indeterminate loading indicator
|
|
4
4
|
*
|
|
5
5
|
* @example
|
|
6
|
-
* <Spinner size="default | large" />
|
|
6
|
+
* <Spinner size="default | "large" | "small" />
|
|
7
7
|
*/
|
|
8
|
-
export declare const SpinnerSizeValues: readonly ["default", "large"];
|
|
8
|
+
export declare const SpinnerSizeValues: readonly ["default", "large", "small"];
|
|
9
9
|
export declare type SpinnerSize = (typeof SpinnerSizeValues)[number];
|
|
10
10
|
export interface SpinnerProps extends HTMLAttributes<HTMLDivElement> {
|
|
11
11
|
/**
|
|
@@ -33,7 +33,7 @@ export interface SpinnerProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
33
33
|
*/
|
|
34
34
|
role?: string;
|
|
35
35
|
/**
|
|
36
|
-
* Determines the size of the spinner. Must be one of: 'default', 'large'.
|
|
36
|
+
* Determines the size of the spinner. Must be one of: 'default', 'large', 'small'.
|
|
37
37
|
*/
|
|
38
38
|
size?: SpinnerSize;
|
|
39
39
|
/**
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { SVGAttributes } from "react";
|
|
2
|
-
|
|
2
|
+
import { SpinnerSize } from "../Spinner";
|
|
3
|
+
import { Density } from "../../theme";
|
|
4
|
+
interface SpinnerProps {
|
|
3
5
|
id?: string;
|
|
4
6
|
rest?: Omit<SVGAttributes<SVGSVGElement>, "id">;
|
|
5
|
-
|
|
7
|
+
size: SpinnerSize;
|
|
8
|
+
density: Density;
|
|
9
|
+
}
|
|
10
|
+
export declare const SpinnerSVG: ({ id, rest, size, density, }: SpinnerProps) => JSX.Element;
|
|
11
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salt-ds/core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.10.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"@floating-ui/react": "^0.23.0",
|
|
15
15
|
"clsx": "^2.0.0",
|
|
16
16
|
"@salt-ds/window": "^0.1.1",
|
|
17
|
-
"@salt-ds/styles": "^0.1.
|
|
17
|
+
"@salt-ds/styles": "^0.1.2",
|
|
18
18
|
"@salt-ds/icons": "^1.7.0"
|
|
19
19
|
},
|
|
20
20
|
"peerDependencies": {
|