@szum-tech/design-system 3.9.0 → 3.10.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/dist/chunk-2WQJ36RD.cjs +78 -0
- package/dist/chunk-D4QID7AI.cjs +607 -0
- package/dist/chunk-DGWBE2Y3.cjs +205 -0
- package/dist/{chunk-XTNS5QH5.cjs → chunk-EG374TED.cjs} +52 -86
- package/dist/chunk-EUH466AL.cjs +179 -0
- package/dist/chunk-F7N6WQV6.cjs +53 -0
- package/dist/chunk-GYXQUTWZ.cjs +59 -0
- package/dist/chunk-IWF52DDE.js +55 -0
- package/dist/{chunk-PHPJ54IC.js → chunk-JLKQ6WKK.js} +48 -82
- package/dist/chunk-K5AURCK5.js +183 -0
- package/dist/chunk-OCOCENE6.js +42 -0
- package/dist/chunk-P4JIMFSL.js +51 -0
- package/dist/chunk-R65CJGEQ.js +48 -0
- package/dist/chunk-USIW3VT5.cjs +73 -0
- package/dist/chunk-WMGJCB7O.js +157 -0
- package/dist/chunk-YEFLGE3L.cjs +47 -0
- package/dist/chunk-YSYZKK24.js +575 -0
- package/dist/chunk-YUMKV5TH.js +56 -0
- package/dist/components/accordion/index.cjs +23 -0
- package/dist/components/accordion/index.d.cts +17 -0
- package/dist/components/accordion/index.d.ts +17 -0
- package/dist/components/accordion/index.js +2 -0
- package/dist/components/button/index.cjs +14 -7
- package/dist/components/button/index.js +13 -6
- package/dist/components/counting-number/index.cjs +11 -0
- package/dist/components/counting-number/index.d.cts +57 -0
- package/dist/components/counting-number/index.d.ts +57 -0
- package/dist/components/counting-number/index.js +2 -0
- package/dist/components/index.cjs +209 -106
- package/dist/components/index.d.cts +11 -2
- package/dist/components/index.d.ts +11 -2
- package/dist/components/index.js +13 -6
- package/dist/components/marquee/index.cjs +11 -0
- package/dist/components/marquee/index.d.cts +48 -0
- package/dist/components/marquee/index.d.ts +48 -0
- package/dist/components/marquee/index.js +2 -0
- package/dist/components/status/index.cjs +19 -0
- package/dist/components/status/index.d.cts +25 -0
- package/dist/components/status/index.d.ts +25 -0
- package/dist/components/status/index.js +2 -0
- package/dist/components/stepper/index.cjs +32 -25
- package/dist/components/stepper/index.d.cts +5 -4
- package/dist/components/stepper/index.d.ts +5 -4
- package/dist/components/stepper/index.js +13 -6
- package/dist/components/tabs/index.cjs +23 -0
- package/dist/components/tabs/index.d.cts +17 -0
- package/dist/components/tabs/index.d.ts +17 -0
- package/dist/components/tabs/index.js +2 -0
- package/dist/components/timeline/index.cjs +44 -0
- package/dist/components/timeline/index.d.cts +62 -0
- package/dist/components/timeline/index.d.ts +62 -0
- package/dist/components/timeline/index.js +3 -0
- package/dist/components/toaster/index.cjs +15 -8
- package/dist/components/toaster/index.js +13 -6
- package/dist/components/typing-text/index.cjs +11 -0
- package/dist/components/typing-text/index.d.cts +40 -0
- package/dist/components/typing-text/index.d.ts +40 -0
- package/dist/components/typing-text/index.js +2 -0
- package/dist/components/word-rotate/index.cjs +11 -0
- package/dist/components/word-rotate/index.d.cts +29 -0
- package/dist/components/word-rotate/index.d.ts +29 -0
- package/dist/components/word-rotate/index.js +2 -0
- package/dist/direction-CUOPDLCj.d.cts +7 -0
- package/dist/direction-CUOPDLCj.d.ts +7 -0
- package/package.json +35 -44
- package/tailwind/animation.css +23 -1
- package/tailwind/palette.css +2 -2
- package/dist/chunk-EW6TE3N5.cjs +0 -38
- package/dist/chunk-H5O5L6XT.js +0 -14
- package/dist/contexts/index.cjs +0 -18
- package/dist/contexts/index.d.cts +0 -11
- package/dist/contexts/index.d.ts +0 -11
- package/dist/contexts/index.js +0 -1
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkH2BWO3SI_cjs = require('./chunk-H2BWO3SI.cjs');
|
|
4
|
+
var React = require('react');
|
|
5
|
+
var react = require('motion/react');
|
|
6
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
7
|
+
|
|
8
|
+
function _interopNamespace(e) {
|
|
9
|
+
if (e && e.__esModule) return e;
|
|
10
|
+
var n = Object.create(null);
|
|
11
|
+
if (e) {
|
|
12
|
+
Object.keys(e).forEach(function (k) {
|
|
13
|
+
if (k !== 'default') {
|
|
14
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
15
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
get: function () { return e[k]; }
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
n.default = e;
|
|
23
|
+
return Object.freeze(n);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
27
|
+
|
|
28
|
+
var cursorVariants = {
|
|
29
|
+
blinking: {
|
|
30
|
+
opacity: [0, 0, 1, 1],
|
|
31
|
+
transition: {
|
|
32
|
+
duration: 1,
|
|
33
|
+
repeat: Infinity,
|
|
34
|
+
repeatDelay: 0,
|
|
35
|
+
ease: "linear",
|
|
36
|
+
times: [0, 0.5, 0.5, 1]
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
var animationVariants = {
|
|
41
|
+
fadeIn: {
|
|
42
|
+
hidden: { opacity: 0, y: 10 },
|
|
43
|
+
show: { opacity: 1, y: 0 },
|
|
44
|
+
exit: { opacity: 0 }
|
|
45
|
+
},
|
|
46
|
+
blurIn: {
|
|
47
|
+
hidden: { opacity: 0, filter: "blur(4px)" },
|
|
48
|
+
show: { opacity: 1, filter: "blur(0px)" },
|
|
49
|
+
exit: { opacity: 0, filter: "blur(4px)" }
|
|
50
|
+
},
|
|
51
|
+
blurInUp: {
|
|
52
|
+
hidden: { opacity: 0, y: 20, filter: "blur(4px)" },
|
|
53
|
+
show: { opacity: 1, y: 0, filter: "blur(0px)" },
|
|
54
|
+
exit: { opacity: 0, y: -20, filter: "blur(4px)" }
|
|
55
|
+
},
|
|
56
|
+
blurInDown: {
|
|
57
|
+
hidden: { opacity: 0, y: -20, filter: "blur(4px)" },
|
|
58
|
+
show: { opacity: 1, y: 0, filter: "blur(0px)" },
|
|
59
|
+
exit: { opacity: 0, y: 20, filter: "blur(4px)" }
|
|
60
|
+
},
|
|
61
|
+
slideUp: {
|
|
62
|
+
hidden: { opacity: 0, y: 20 },
|
|
63
|
+
show: { opacity: 1, y: 0 },
|
|
64
|
+
exit: { opacity: 0, y: -20 }
|
|
65
|
+
},
|
|
66
|
+
slideDown: {
|
|
67
|
+
hidden: { opacity: 0, y: -20 },
|
|
68
|
+
show: { opacity: 1, y: 0 },
|
|
69
|
+
exit: { opacity: 0, y: 20 }
|
|
70
|
+
},
|
|
71
|
+
slideLeft: {
|
|
72
|
+
hidden: { opacity: 0, x: 20 },
|
|
73
|
+
show: { opacity: 1, x: 0 },
|
|
74
|
+
exit: { opacity: 0, x: -20 }
|
|
75
|
+
},
|
|
76
|
+
slideRight: {
|
|
77
|
+
hidden: { opacity: 0, x: -20 },
|
|
78
|
+
show: { opacity: 1, x: 0 },
|
|
79
|
+
exit: { opacity: 0, x: 20 }
|
|
80
|
+
},
|
|
81
|
+
scaleUp: {
|
|
82
|
+
hidden: { opacity: 0, scale: 0.8 },
|
|
83
|
+
show: { opacity: 1, scale: 1 },
|
|
84
|
+
exit: { opacity: 0, scale: 1.2 }
|
|
85
|
+
},
|
|
86
|
+
scaleDown: {
|
|
87
|
+
hidden: { opacity: 0, scale: 1.2 },
|
|
88
|
+
show: { opacity: 1, scale: 1 },
|
|
89
|
+
exit: { opacity: 0, scale: 0.8 }
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
function TypingText({
|
|
93
|
+
text,
|
|
94
|
+
texts,
|
|
95
|
+
speed = 100,
|
|
96
|
+
delay = 0,
|
|
97
|
+
showCursor = true,
|
|
98
|
+
cursorClassName = "",
|
|
99
|
+
cursor = "|",
|
|
100
|
+
loop = false,
|
|
101
|
+
pauseDuration = 2e3,
|
|
102
|
+
className,
|
|
103
|
+
onComplete,
|
|
104
|
+
startOnView = true,
|
|
105
|
+
once = false,
|
|
106
|
+
animation = "fadeIn",
|
|
107
|
+
inViewMargin,
|
|
108
|
+
...props
|
|
109
|
+
}) {
|
|
110
|
+
const ref = React__namespace.useRef(null);
|
|
111
|
+
const isInView = react.useInView(ref, { once, margin: inViewMargin });
|
|
112
|
+
const [hasAnimated, setHasAnimated] = React__namespace.useState(false);
|
|
113
|
+
const [displayText, setDisplayText] = React__namespace.useState("");
|
|
114
|
+
const [currentIndex, setCurrentIndex] = React__namespace.useState(0);
|
|
115
|
+
const [isTyping, setIsTyping] = React__namespace.useState(false);
|
|
116
|
+
const [currentTextIndex, setCurrentTextIndex] = React__namespace.useState(0);
|
|
117
|
+
const shouldStart = !startOnView || isInView && (!once || !hasAnimated);
|
|
118
|
+
const textArray = texts && texts.length > 0 ? texts : [text];
|
|
119
|
+
const currentText = textArray[currentTextIndex] ?? "";
|
|
120
|
+
React__namespace.useEffect(() => {
|
|
121
|
+
if (!shouldStart) return;
|
|
122
|
+
const timeout = setTimeout(() => {
|
|
123
|
+
setIsTyping(true);
|
|
124
|
+
setHasAnimated(true);
|
|
125
|
+
}, delay);
|
|
126
|
+
return () => clearTimeout(timeout);
|
|
127
|
+
}, [delay, shouldStart]);
|
|
128
|
+
React__namespace.useEffect(() => {
|
|
129
|
+
if (!isTyping) return;
|
|
130
|
+
if (currentIndex < currentText.length) {
|
|
131
|
+
const timeout = setTimeout(() => {
|
|
132
|
+
setDisplayText(currentText.slice(0, currentIndex + 1));
|
|
133
|
+
setCurrentIndex(currentIndex + 1);
|
|
134
|
+
}, speed);
|
|
135
|
+
return () => clearTimeout(timeout);
|
|
136
|
+
} else {
|
|
137
|
+
onComplete?.();
|
|
138
|
+
if (loop && texts && texts.length > 1) {
|
|
139
|
+
const timeout = setTimeout(() => {
|
|
140
|
+
setDisplayText("");
|
|
141
|
+
setCurrentIndex(0);
|
|
142
|
+
setCurrentTextIndex((prev) => (prev + 1) % texts.length);
|
|
143
|
+
}, pauseDuration);
|
|
144
|
+
return () => clearTimeout(timeout);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}, [currentIndex, currentText, isTyping, speed, loop, texts, pauseDuration, onComplete]);
|
|
148
|
+
const selectedVariants = animationVariants[animation];
|
|
149
|
+
const MotionComponent = react.motion.span;
|
|
150
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
151
|
+
MotionComponent,
|
|
152
|
+
{
|
|
153
|
+
ref,
|
|
154
|
+
variants: selectedVariants,
|
|
155
|
+
initial: "hidden",
|
|
156
|
+
whileInView: startOnView ? "show" : void 0,
|
|
157
|
+
animate: startOnView ? void 0 : "show",
|
|
158
|
+
exit: "exit",
|
|
159
|
+
className: chunkH2BWO3SI_cjs.cn("whitespace-pre-wrap", className),
|
|
160
|
+
viewport: { once },
|
|
161
|
+
"data-slot": "typing-text",
|
|
162
|
+
...props,
|
|
163
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs("span", { style: { display: "inline-flex", alignItems: "center" }, children: [
|
|
164
|
+
displayText,
|
|
165
|
+
showCursor && /* @__PURE__ */ jsxRuntime.jsx(
|
|
166
|
+
react.motion.span,
|
|
167
|
+
{
|
|
168
|
+
variants: cursorVariants,
|
|
169
|
+
animate: "blinking",
|
|
170
|
+
className: chunkH2BWO3SI_cjs.cn("text-foreground ms-1 inline-block w-px font-normal select-none", cursorClassName),
|
|
171
|
+
children: cursor
|
|
172
|
+
}
|
|
173
|
+
)
|
|
174
|
+
] })
|
|
175
|
+
}
|
|
176
|
+
);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
exports.TypingText = TypingText;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkH2BWO3SI_cjs = require('./chunk-H2BWO3SI.cjs');
|
|
4
|
+
var radixUi = require('radix-ui');
|
|
5
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
+
var lucideReact = require('lucide-react');
|
|
7
|
+
|
|
8
|
+
function Accordion({ ...props }) {
|
|
9
|
+
return /* @__PURE__ */ jsxRuntime.jsx(radixUi.Accordion.Root, { "data-slot": "accordion", ...props });
|
|
10
|
+
}
|
|
11
|
+
function AccordionContent({ className, children, ...props }) {
|
|
12
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
13
|
+
radixUi.Accordion.Content,
|
|
14
|
+
{
|
|
15
|
+
"data-slot": "accordion-content",
|
|
16
|
+
className: "data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down overflow-hidden text-sm",
|
|
17
|
+
...props,
|
|
18
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: chunkH2BWO3SI_cjs.cn("pt-0 pb-4", className), children })
|
|
19
|
+
}
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
function AccordionTrigger({ className, children, ...props }) {
|
|
23
|
+
return /* @__PURE__ */ jsxRuntime.jsx(radixUi.Accordion.Header, { className: "flex", children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
24
|
+
radixUi.Accordion.Trigger,
|
|
25
|
+
{
|
|
26
|
+
"data-slot": "accordion-trigger",
|
|
27
|
+
className: chunkH2BWO3SI_cjs.cn(
|
|
28
|
+
"focus-visible:border-ring focus-visible:ring-ring/50 flex flex-1 items-start justify-between gap-4 rounded-md py-4 text-left text-sm font-medium transition-all outline-none hover:underline focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 [&[data-state=open]>svg]:rotate-180",
|
|
29
|
+
className
|
|
30
|
+
),
|
|
31
|
+
...props,
|
|
32
|
+
children: [
|
|
33
|
+
children,
|
|
34
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDownIcon, { className: "text-muted-foreground pointer-events-none size-4 shrink-0 translate-y-0.5 transition-transform duration-200" })
|
|
35
|
+
]
|
|
36
|
+
}
|
|
37
|
+
) });
|
|
38
|
+
}
|
|
39
|
+
function AccordionItem({ className, ...props }) {
|
|
40
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
41
|
+
radixUi.Accordion.Item,
|
|
42
|
+
{
|
|
43
|
+
"data-slot": "accordion-item",
|
|
44
|
+
className: chunkH2BWO3SI_cjs.cn("border-b last:border-b-0", className),
|
|
45
|
+
...props
|
|
46
|
+
}
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
exports.Accordion = Accordion;
|
|
51
|
+
exports.AccordionContent = AccordionContent;
|
|
52
|
+
exports.AccordionItem = AccordionItem;
|
|
53
|
+
exports.AccordionTrigger = AccordionTrigger;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkH2BWO3SI_cjs = require('./chunk-H2BWO3SI.cjs');
|
|
4
|
+
var reactSlot = require('@radix-ui/react-slot');
|
|
5
|
+
var classVarianceAuthority = require('class-variance-authority');
|
|
6
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
7
|
+
|
|
8
|
+
var statusVariants = classVarianceAuthority.cva(
|
|
9
|
+
"inline-flex w-fit shrink-0 items-center gap-1.5 overflow-hidden whitespace-nowrap rounded-full border px-2.5 py-1 font-medium text-xs transition-colors",
|
|
10
|
+
{
|
|
11
|
+
variants: {
|
|
12
|
+
variant: {
|
|
13
|
+
default: "border-transparent bg-muted text-muted-foreground **:data-[slot=status-indicator]:bg-muted-foreground",
|
|
14
|
+
success: "border-success/20 bg-success/10 text-success **:data-[slot=status-indicator]:bg-success",
|
|
15
|
+
error: "border-error/20 bg-error/10 text-error **:data-[slot=status-indicator]:bg-error",
|
|
16
|
+
warning: "border-warning/20 bg-warning/10 text-warning **:data-[slot=status-indicator]:bg-warning",
|
|
17
|
+
primary: "border-primary/20 bg-primary/10 text-primary **:data-[slot=status-indicator]:bg-primary "
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
defaultVariants: {
|
|
21
|
+
variant: "default"
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
);
|
|
25
|
+
function Status({ className, variant = "default", asChild, ...rootProps }) {
|
|
26
|
+
const RootPrimitive = asChild ? reactSlot.Slot : "div";
|
|
27
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
28
|
+
RootPrimitive,
|
|
29
|
+
{
|
|
30
|
+
"data-slot": "status",
|
|
31
|
+
"data-variant": variant,
|
|
32
|
+
...rootProps,
|
|
33
|
+
className: chunkH2BWO3SI_cjs.cn(statusVariants({ variant }), className)
|
|
34
|
+
}
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
function StatusIndicator(props) {
|
|
38
|
+
const { className, ...indicatorProps } = props;
|
|
39
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
40
|
+
"div",
|
|
41
|
+
{
|
|
42
|
+
"data-slot": "status-indicator",
|
|
43
|
+
...indicatorProps,
|
|
44
|
+
className: chunkH2BWO3SI_cjs.cn(
|
|
45
|
+
"relative flex size-2 shrink-0 rounded-full",
|
|
46
|
+
"before:absolute before:inset-0 before:animate-ping before:rounded-full before:bg-inherit",
|
|
47
|
+
"after:absolute after:inset-0.5 after:rounded-full after:bg-inherit",
|
|
48
|
+
className
|
|
49
|
+
)
|
|
50
|
+
}
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
function StatusLabel({ className, ...labelProps }) {
|
|
54
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { "data-slot": "status-label", ...labelProps, className: chunkH2BWO3SI_cjs.cn("leading-none", className) });
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
exports.Status = Status;
|
|
58
|
+
exports.StatusIndicator = StatusIndicator;
|
|
59
|
+
exports.StatusLabel = StatusLabel;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { cn } from './chunk-ZD2QRAOX.js';
|
|
2
|
+
import { Slot } from '@radix-ui/react-slot';
|
|
3
|
+
import { cva } from 'class-variance-authority';
|
|
4
|
+
import { jsx } from 'react/jsx-runtime';
|
|
5
|
+
|
|
6
|
+
var statusVariants = cva(
|
|
7
|
+
"inline-flex w-fit shrink-0 items-center gap-1.5 overflow-hidden whitespace-nowrap rounded-full border px-2.5 py-1 font-medium text-xs transition-colors",
|
|
8
|
+
{
|
|
9
|
+
variants: {
|
|
10
|
+
variant: {
|
|
11
|
+
default: "border-transparent bg-muted text-muted-foreground **:data-[slot=status-indicator]:bg-muted-foreground",
|
|
12
|
+
success: "border-success/20 bg-success/10 text-success **:data-[slot=status-indicator]:bg-success",
|
|
13
|
+
error: "border-error/20 bg-error/10 text-error **:data-[slot=status-indicator]:bg-error",
|
|
14
|
+
warning: "border-warning/20 bg-warning/10 text-warning **:data-[slot=status-indicator]:bg-warning",
|
|
15
|
+
primary: "border-primary/20 bg-primary/10 text-primary **:data-[slot=status-indicator]:bg-primary "
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
defaultVariants: {
|
|
19
|
+
variant: "default"
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
);
|
|
23
|
+
function Status({ className, variant = "default", asChild, ...rootProps }) {
|
|
24
|
+
const RootPrimitive = asChild ? Slot : "div";
|
|
25
|
+
return /* @__PURE__ */ jsx(
|
|
26
|
+
RootPrimitive,
|
|
27
|
+
{
|
|
28
|
+
"data-slot": "status",
|
|
29
|
+
"data-variant": variant,
|
|
30
|
+
...rootProps,
|
|
31
|
+
className: cn(statusVariants({ variant }), className)
|
|
32
|
+
}
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
function StatusIndicator(props) {
|
|
36
|
+
const { className, ...indicatorProps } = props;
|
|
37
|
+
return /* @__PURE__ */ jsx(
|
|
38
|
+
"div",
|
|
39
|
+
{
|
|
40
|
+
"data-slot": "status-indicator",
|
|
41
|
+
...indicatorProps,
|
|
42
|
+
className: cn(
|
|
43
|
+
"relative flex size-2 shrink-0 rounded-full",
|
|
44
|
+
"before:absolute before:inset-0 before:animate-ping before:rounded-full before:bg-inherit",
|
|
45
|
+
"after:absolute after:inset-0.5 after:rounded-full after:bg-inherit",
|
|
46
|
+
className
|
|
47
|
+
)
|
|
48
|
+
}
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
function StatusLabel({ className, ...labelProps }) {
|
|
52
|
+
return /* @__PURE__ */ jsx("div", { "data-slot": "status-label", ...labelProps, className: cn("leading-none", className) });
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export { Status, StatusIndicator, StatusLabel };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { useDirection, useComposedRefs } from './chunk-YSYZKK24.js';
|
|
1
2
|
import { Spinner } from './chunk-P5IUC7HJ.js';
|
|
2
|
-
import { useDirection, Direction } from './chunk-H5O5L6XT.js';
|
|
3
3
|
import { useLazyRef, useIsomorphicLayoutEffect } from './chunk-DFD2WUOU.js';
|
|
4
4
|
import { cn } from './chunk-ZD2QRAOX.js';
|
|
5
|
-
import * as
|
|
5
|
+
import * as React5 from 'react';
|
|
6
6
|
import { Slot } from '@radix-ui/react-slot';
|
|
7
7
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
8
8
|
import { OctagonXIcon, TriangleAlertIcon, InfoIcon, CircleCheckIcon } from 'lucide-react';
|
|
@@ -36,9 +36,9 @@ var STEPPER_MAP_KEY_TO_FOCUS_INTENT = {
|
|
|
36
36
|
};
|
|
37
37
|
|
|
38
38
|
// src/components/stepper/stepper.context.tsx
|
|
39
|
-
var StepperContext =
|
|
39
|
+
var StepperContext = React5.createContext(null);
|
|
40
40
|
function useStepperContext(consumerName) {
|
|
41
|
-
const context =
|
|
41
|
+
const context = React5.useContext(StepperContext);
|
|
42
42
|
if (!context) {
|
|
43
43
|
throw new Error(`\`${consumerName}\` must be used within \`${STEPPER_ROOT_NAME}\``);
|
|
44
44
|
}
|
|
@@ -128,9 +128,9 @@ function createStepperStore(listenersRef, stateRef, onValueChange, onValueComple
|
|
|
128
128
|
};
|
|
129
129
|
return store;
|
|
130
130
|
}
|
|
131
|
-
var StepperStoreContext =
|
|
131
|
+
var StepperStoreContext = React5.createContext(null);
|
|
132
132
|
function useStepperStoreContext(consumerName) {
|
|
133
|
-
const context =
|
|
133
|
+
const context = React5.useContext(StepperStoreContext);
|
|
134
134
|
if (!context) {
|
|
135
135
|
throw new Error(`\`${consumerName}\` must be used within \`${STEPPER_ROOT_NAME}\``);
|
|
136
136
|
}
|
|
@@ -138,8 +138,8 @@ function useStepperStoreContext(consumerName) {
|
|
|
138
138
|
}
|
|
139
139
|
function useStepperStore(selector) {
|
|
140
140
|
const store = useStepperStoreContext("useStore");
|
|
141
|
-
const getSnapshot =
|
|
142
|
-
return
|
|
141
|
+
const getSnapshot = React5.useCallback(() => selector(store.getState()), [selector, store]);
|
|
142
|
+
return React5.useSyncExternalStore(store.subscribe, getSnapshot, getSnapshot);
|
|
143
143
|
}
|
|
144
144
|
function Stepper({
|
|
145
145
|
value,
|
|
@@ -161,14 +161,14 @@ function Stepper({
|
|
|
161
161
|
indicators = {},
|
|
162
162
|
...rootProps
|
|
163
163
|
}) {
|
|
164
|
-
const id =
|
|
164
|
+
const id = React5.useId();
|
|
165
165
|
const rootId = idProp ?? id;
|
|
166
166
|
const listenersRef = useLazyRef(() => /* @__PURE__ */ new Set());
|
|
167
167
|
const stateRef = useLazyRef(() => ({
|
|
168
168
|
steps: /* @__PURE__ */ new Map(),
|
|
169
169
|
value: value ?? defaultValue
|
|
170
170
|
}));
|
|
171
|
-
const store =
|
|
171
|
+
const store = React5.useMemo(
|
|
172
172
|
() => createStepperStore(listenersRef, stateRef, onValueChange, onValueComplete, onValueAdd, onValueRemove, onValidate),
|
|
173
173
|
[listenersRef, stateRef, onValueChange, onValueComplete, onValueAdd, onValueRemove, onValidate]
|
|
174
174
|
);
|
|
@@ -178,7 +178,7 @@ function Stepper({
|
|
|
178
178
|
}
|
|
179
179
|
}, [value]);
|
|
180
180
|
const dir = useDirection(dirProp);
|
|
181
|
-
const contextValue =
|
|
181
|
+
const contextValue = React5.useMemo(
|
|
182
182
|
() => ({
|
|
183
183
|
id: rootId,
|
|
184
184
|
dir,
|
|
@@ -230,48 +230,14 @@ var StepperDataState = {
|
|
|
230
230
|
ACTIVE: "active",
|
|
231
231
|
COMPLETED: "completed"
|
|
232
232
|
};
|
|
233
|
-
var StepperFocusContext =
|
|
233
|
+
var StepperFocusContext = React5.createContext(null);
|
|
234
234
|
function useStepperFocusContext(consumerName) {
|
|
235
|
-
const context =
|
|
235
|
+
const context = React5.useContext(StepperFocusContext);
|
|
236
236
|
if (!context) {
|
|
237
237
|
throw new Error(`\`${consumerName}\` must be used within \`FocusProvider\``);
|
|
238
238
|
}
|
|
239
239
|
return context;
|
|
240
240
|
}
|
|
241
|
-
function setRef(ref, value) {
|
|
242
|
-
if (typeof ref === "function") {
|
|
243
|
-
return ref(value);
|
|
244
|
-
} else if (ref !== null && ref !== void 0) {
|
|
245
|
-
ref.current = value;
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
function composeRefs(...refs) {
|
|
249
|
-
return (node) => {
|
|
250
|
-
let hasCleanup = false;
|
|
251
|
-
const cleanups = refs.map((ref) => {
|
|
252
|
-
const cleanup = setRef(ref, node);
|
|
253
|
-
if (!hasCleanup && typeof cleanup == "function") {
|
|
254
|
-
hasCleanup = true;
|
|
255
|
-
}
|
|
256
|
-
return cleanup;
|
|
257
|
-
});
|
|
258
|
-
if (hasCleanup) {
|
|
259
|
-
return () => {
|
|
260
|
-
for (let i = 0; i < cleanups.length; i++) {
|
|
261
|
-
const cleanup = cleanups[i];
|
|
262
|
-
if (typeof cleanup == "function") {
|
|
263
|
-
cleanup();
|
|
264
|
-
} else {
|
|
265
|
-
setRef(refs[i], null);
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
};
|
|
269
|
-
}
|
|
270
|
-
};
|
|
271
|
-
}
|
|
272
|
-
function useComposedRefs(...refs) {
|
|
273
|
-
return React6.useCallback(composeRefs(...refs), refs);
|
|
274
|
-
}
|
|
275
241
|
|
|
276
242
|
// src/components/stepper/stepper.utils.tsx
|
|
277
243
|
function focusFirst(candidates, preventScroll = false) {
|
|
@@ -308,7 +274,7 @@ function wrapArray(array, startIndex) {
|
|
|
308
274
|
return array.map((_, index) => array[(startIndex + index) % array.length]);
|
|
309
275
|
}
|
|
310
276
|
function getDirectionAwareKey(key, dir) {
|
|
311
|
-
if (dir !==
|
|
277
|
+
if (dir !== "rtl") return key;
|
|
312
278
|
return key === "ArrowLeft" ? "ArrowRight" : key === "ArrowRight" ? "ArrowLeft" : key;
|
|
313
279
|
}
|
|
314
280
|
function getFocusIntent(event, dir, orientation) {
|
|
@@ -321,32 +287,32 @@ function StepperNav({ className, children, asChild, ref, ...listProps }) {
|
|
|
321
287
|
const context = useStepperContext(STEPPER_NAV_NAME);
|
|
322
288
|
const orientation = context.orientation;
|
|
323
289
|
const currentValue = useStepperStore((state) => state.value);
|
|
324
|
-
const [tabStopId, setTabStopId] =
|
|
325
|
-
const [isTabbingBackOut, setIsTabbingBackOut] =
|
|
326
|
-
const [focusableItemCount, setFocusableItemCount] =
|
|
327
|
-
const isClickFocusRef =
|
|
328
|
-
const itemsRef =
|
|
329
|
-
const listRef =
|
|
290
|
+
const [tabStopId, setTabStopId] = React5.useState(null);
|
|
291
|
+
const [isTabbingBackOut, setIsTabbingBackOut] = React5.useState(false);
|
|
292
|
+
const [focusableItemCount, setFocusableItemCount] = React5.useState(0);
|
|
293
|
+
const isClickFocusRef = React5.useRef(false);
|
|
294
|
+
const itemsRef = React5.useRef(/* @__PURE__ */ new Map());
|
|
295
|
+
const listRef = React5.useRef(null);
|
|
330
296
|
const composedRef = useComposedRefs(ref, listRef);
|
|
331
|
-
const onItemFocus =
|
|
297
|
+
const onItemFocus = React5.useCallback((tabStopId2) => {
|
|
332
298
|
setTabStopId(tabStopId2);
|
|
333
299
|
}, []);
|
|
334
|
-
const onItemShiftTab =
|
|
300
|
+
const onItemShiftTab = React5.useCallback(() => {
|
|
335
301
|
setIsTabbingBackOut(true);
|
|
336
302
|
}, []);
|
|
337
|
-
const onFocusableItemAdd =
|
|
303
|
+
const onFocusableItemAdd = React5.useCallback(() => {
|
|
338
304
|
setFocusableItemCount((prevCount) => prevCount + 1);
|
|
339
305
|
}, []);
|
|
340
|
-
const onFocusableItemRemove =
|
|
306
|
+
const onFocusableItemRemove = React5.useCallback(() => {
|
|
341
307
|
setFocusableItemCount((prevCount) => prevCount - 1);
|
|
342
308
|
}, []);
|
|
343
|
-
const onItemRegister =
|
|
309
|
+
const onItemRegister = React5.useCallback((item) => {
|
|
344
310
|
itemsRef.current.set(item.id, item);
|
|
345
311
|
}, []);
|
|
346
|
-
const onItemUnregister =
|
|
312
|
+
const onItemUnregister = React5.useCallback((id) => {
|
|
347
313
|
itemsRef.current.delete(id);
|
|
348
314
|
}, []);
|
|
349
|
-
const getItems =
|
|
315
|
+
const getItems = React5.useCallback(() => {
|
|
350
316
|
return Array.from(itemsRef.current.values()).filter((item) => item.ref.current).sort((a, b) => {
|
|
351
317
|
const elementA = a.ref.current;
|
|
352
318
|
const elementB = b.ref.current;
|
|
@@ -361,7 +327,7 @@ function StepperNav({ className, children, asChild, ref, ...listProps }) {
|
|
|
361
327
|
return 0;
|
|
362
328
|
});
|
|
363
329
|
}, []);
|
|
364
|
-
const onBlur =
|
|
330
|
+
const onBlur = React5.useCallback(
|
|
365
331
|
(event) => {
|
|
366
332
|
listProps.onBlur?.(event);
|
|
367
333
|
if (event.defaultPrevented) return;
|
|
@@ -370,7 +336,7 @@ function StepperNav({ className, children, asChild, ref, ...listProps }) {
|
|
|
370
336
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
371
337
|
[listProps.onBlur]
|
|
372
338
|
);
|
|
373
|
-
const onFocus =
|
|
339
|
+
const onFocus = React5.useCallback(
|
|
374
340
|
(event) => {
|
|
375
341
|
listProps.onFocus?.(event);
|
|
376
342
|
if (event.defaultPrevented) return;
|
|
@@ -395,7 +361,7 @@ function StepperNav({ className, children, asChild, ref, ...listProps }) {
|
|
|
395
361
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
396
362
|
[listProps.onFocus, isTabbingBackOut, currentValue, tabStopId]
|
|
397
363
|
);
|
|
398
|
-
const onMouseDown =
|
|
364
|
+
const onMouseDown = React5.useCallback(
|
|
399
365
|
(event) => {
|
|
400
366
|
listProps.onMouseDown?.(event);
|
|
401
367
|
if (event.defaultPrevented) return;
|
|
@@ -404,7 +370,7 @@ function StepperNav({ className, children, asChild, ref, ...listProps }) {
|
|
|
404
370
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
405
371
|
[listProps.onMouseDown]
|
|
406
372
|
);
|
|
407
|
-
const focusContextValue =
|
|
373
|
+
const focusContextValue = React5.useMemo(
|
|
408
374
|
() => ({
|
|
409
375
|
tabStopId,
|
|
410
376
|
onItemFocus,
|
|
@@ -450,9 +416,9 @@ function StepperNav({ className, children, asChild, ref, ...listProps }) {
|
|
|
450
416
|
}
|
|
451
417
|
) });
|
|
452
418
|
}
|
|
453
|
-
var StepperItemContext =
|
|
419
|
+
var StepperItemContext = React5.createContext(null);
|
|
454
420
|
function useStepperItemContext(consumerName) {
|
|
455
|
-
const context =
|
|
421
|
+
const context = React5.useContext(StepperItemContext);
|
|
456
422
|
if (!context) {
|
|
457
423
|
throw new Error(`\`${consumerName}\` must be used within \`${STEPPER_ITEM_NAME}\``);
|
|
458
424
|
}
|
|
@@ -483,7 +449,7 @@ function StepperItem({
|
|
|
483
449
|
const stepState = useStepperStore((state) => state.steps.get(itemValue));
|
|
484
450
|
const steps = useStepperStore((state) => state.steps);
|
|
485
451
|
const dataState = getDataState(value, itemValue, stepState, steps);
|
|
486
|
-
const itemContextValue =
|
|
452
|
+
const itemContextValue = React5.useMemo(
|
|
487
453
|
() => ({
|
|
488
454
|
value: itemValue,
|
|
489
455
|
stepState
|
|
@@ -545,11 +511,11 @@ function StepperTrigger({ asChild, disabled, className, ref, ...triggerProps })
|
|
|
545
511
|
const isActive = value === itemValue;
|
|
546
512
|
const isTabStop = focusContext.tabStopId === triggerId;
|
|
547
513
|
const dataState = getDataState(value, itemValue, stepState, steps);
|
|
548
|
-
const triggerRef =
|
|
514
|
+
const triggerRef = React5.useRef(null);
|
|
549
515
|
const composedRef = useComposedRefs(ref, triggerRef);
|
|
550
|
-
const isArrowKeyPressedRef =
|
|
551
|
-
const isMouseClickRef =
|
|
552
|
-
|
|
516
|
+
const isArrowKeyPressedRef = React5.useRef(false);
|
|
517
|
+
const isMouseClickRef = React5.useRef(false);
|
|
518
|
+
React5.useEffect(() => {
|
|
553
519
|
function onKeyDown2(event) {
|
|
554
520
|
if (STEPPER_ARROW_KEYS.includes(event.key)) {
|
|
555
521
|
isArrowKeyPressedRef.current = true;
|
|
@@ -583,7 +549,7 @@ function StepperTrigger({ asChild, disabled, className, ref, ...triggerProps })
|
|
|
583
549
|
}
|
|
584
550
|
};
|
|
585
551
|
}, [focusContext, triggerId, itemValue, isTabStop, isDisabled]);
|
|
586
|
-
const onClick =
|
|
552
|
+
const onClick = React5.useCallback(
|
|
587
553
|
async (event) => {
|
|
588
554
|
triggerProps.onClick?.(event);
|
|
589
555
|
if (event.defaultPrevented) return;
|
|
@@ -597,7 +563,7 @@ function StepperTrigger({ asChild, disabled, className, ref, ...triggerProps })
|
|
|
597
563
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
598
564
|
[isDisabled, context.nonInteractive, store, itemValue, value, steps, triggerProps.onClick]
|
|
599
565
|
);
|
|
600
|
-
const onFocus =
|
|
566
|
+
const onFocus = React5.useCallback(
|
|
601
567
|
async (event) => {
|
|
602
568
|
triggerProps.onFocus?.(event);
|
|
603
569
|
if (event.defaultPrevented) return;
|
|
@@ -625,7 +591,7 @@ function StepperTrigger({ asChild, disabled, className, ref, ...triggerProps })
|
|
|
625
591
|
store
|
|
626
592
|
]
|
|
627
593
|
);
|
|
628
|
-
const onKeyDown =
|
|
594
|
+
const onKeyDown = React5.useCallback(
|
|
629
595
|
async (event) => {
|
|
630
596
|
triggerProps.onKeyDown?.(event);
|
|
631
597
|
if (event.defaultPrevented) return;
|
|
@@ -695,7 +661,7 @@ function StepperTrigger({ asChild, disabled, className, ref, ...triggerProps })
|
|
|
695
661
|
steps
|
|
696
662
|
]
|
|
697
663
|
);
|
|
698
|
-
const onMouseDown =
|
|
664
|
+
const onMouseDown = React5.useCallback(
|
|
699
665
|
(event) => {
|
|
700
666
|
triggerProps.onMouseDown?.(event);
|
|
701
667
|
if (event.defaultPrevented) {
|
|
@@ -856,7 +822,7 @@ function StepperNextTrigger({ asChild = false, onClick, disabled, ...props }) {
|
|
|
856
822
|
const stepKeys = Array.from(steps.keys());
|
|
857
823
|
const currentIndex = value ? stepKeys.indexOf(value) : -1;
|
|
858
824
|
const isDisabled = disabled || currentIndex >= stepKeys.length - 1;
|
|
859
|
-
const handleClick =
|
|
825
|
+
const handleClick = React5.useCallback(
|
|
860
826
|
async (event) => {
|
|
861
827
|
onClick?.(event);
|
|
862
828
|
if (event.defaultPrevented || isDisabled) {
|
|
@@ -889,7 +855,7 @@ function StepperPrevTrigger({ asChild = false, disabled, onClick, ...props }) {
|
|
|
889
855
|
const stepKeys = Array.from(steps.keys());
|
|
890
856
|
const currentIndex = value ? stepKeys.indexOf(value) : -1;
|
|
891
857
|
const isDisabled = disabled || currentIndex <= 0;
|
|
892
|
-
const handleClick =
|
|
858
|
+
const handleClick = React5.useCallback(
|
|
893
859
|
async (event) => {
|
|
894
860
|
onClick?.(event);
|
|
895
861
|
if (event.defaultPrevented || isDisabled) {
|
|
@@ -1036,15 +1002,15 @@ function ButtonContent({
|
|
|
1036
1002
|
const isEndLoading = loading && loadingPosition === "end";
|
|
1037
1003
|
const EndIcon = isEndLoading ? /* @__PURE__ */ jsx(Spinner, { "aria-label": "Loading" }) : endIcon || null;
|
|
1038
1004
|
const isCenterLoading = loading && loadingPosition === "center";
|
|
1039
|
-
return asChild &&
|
|
1005
|
+
return asChild && React5.isValidElement(children) ? React5.cloneElement(
|
|
1040
1006
|
children,
|
|
1041
1007
|
props,
|
|
1042
|
-
/* @__PURE__ */ jsxs(
|
|
1008
|
+
/* @__PURE__ */ jsxs(React5.Fragment, { children: [
|
|
1043
1009
|
StartIcon,
|
|
1044
|
-
isCenterLoading ? /* @__PURE__ */ jsx(Spinner, { "aria-label": "Loading" }) :
|
|
1010
|
+
isCenterLoading ? /* @__PURE__ */ jsx(Spinner, { "aria-label": "Loading" }) : React5.isValidElement(children) ? children.props?.children : null,
|
|
1045
1011
|
EndIcon
|
|
1046
1012
|
] })
|
|
1047
|
-
) : /* @__PURE__ */ jsxs(
|
|
1013
|
+
) : /* @__PURE__ */ jsxs(React5.Fragment, { children: [
|
|
1048
1014
|
StartIcon,
|
|
1049
1015
|
isCenterLoading ? /* @__PURE__ */ jsx(Spinner, { "aria-label": "Loading" }) : children,
|
|
1050
1016
|
EndIcon
|