@szum-tech/design-system 3.8.1 → 3.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/chunk-2WQJ36RD.cjs +78 -0
- package/dist/{chunk-O3DHBQA5.cjs → chunk-3GNVQFCK.cjs} +1 -1
- package/dist/{chunk-SYKUS2RV.js → chunk-3MH6P44N.js} +2 -2
- package/dist/{chunk-3BLXG7ET.js → chunk-3RK5PCIC.js} +1 -1
- package/dist/{chunk-2Q2BIWBE.js → chunk-5MV54MWS.js} +1 -1
- package/dist/{chunk-YWG7TML6.cjs → chunk-6X26XC6P.cjs} +1 -1
- package/dist/chunk-A7SBXO2Y.cjs +40 -0
- package/dist/{chunk-ACJ3ES2B.js → chunk-BTSHACKG.js} +1 -1
- package/dist/{chunk-3DUJHGXE.cjs → chunk-CFJ44JVK.cjs} +1 -1
- package/dist/chunk-D4QID7AI.cjs +607 -0
- package/dist/chunk-DGWBE2Y3.cjs +205 -0
- package/dist/{chunk-Q5ONG5HB.cjs → chunk-DTYX7CYN.cjs} +2 -2
- package/dist/{chunk-3Z3GVXXN.cjs → chunk-EG374TED.cjs} +57 -89
- 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-SZ3LC2VO.js → chunk-JLKQ6WKK.js} +53 -85
- package/dist/chunk-K5AURCK5.js +183 -0
- package/dist/{chunk-XV3AQ6NS.js → chunk-KGGCA634.js} +1 -1
- package/dist/chunk-OCOCENE6.js +42 -0
- package/dist/chunk-R65CJGEQ.js +48 -0
- package/dist/chunk-TKZOB6C3.cjs +70 -0
- package/dist/{chunk-FKCWRNWB.js → chunk-U3QKV7I4.js} +1 -1
- package/dist/chunk-U7XZJQ4O.js +36 -0
- package/dist/{chunk-X55H6LRX.cjs → chunk-ULEEQ723.cjs} +1 -1
- package/dist/{chunk-BAWVLSRF.cjs → chunk-VK5EX3OG.cjs} +1 -1
- package/dist/{chunk-UW6GOD7J.js → chunk-VT5GDGZJ.js} +1 -1
- package/dist/chunk-WMGJCB7O.js +157 -0
- package/dist/chunk-YEFLGE3L.cjs +47 -0
- package/dist/chunk-YQ6J6VOI.js +48 -0
- package/dist/chunk-YSYZKK24.js +575 -0
- package/dist/chunk-YUMKV5TH.js +56 -0
- package/dist/{chunk-Z6CZAPVG.cjs → chunk-ZVF7J4EI.cjs} +1 -1
- 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/alert/index.cjs +4 -4
- package/dist/components/alert/index.js +1 -1
- package/dist/components/badge/index.cjs +4 -4
- package/dist/components/badge/index.js +1 -1
- package/dist/components/button/index.cjs +23 -16
- package/dist/components/button/index.js +22 -15
- package/dist/components/color-swatch/index.cjs +2 -2
- package/dist/components/color-swatch/index.js +1 -1
- package/dist/components/counting-number/index.cjs +11 -0
- package/dist/components/counting-number/index.d.cts +18 -0
- package/dist/components/counting-number/index.d.ts +18 -0
- package/dist/components/counting-number/index.js +2 -0
- package/dist/components/dialog/index.cjs +9 -9
- package/dist/components/dialog/index.js +1 -1
- package/dist/components/field/index.cjs +11 -11
- package/dist/components/field/index.js +1 -1
- package/dist/components/header/index.cjs +2 -2
- package/dist/components/header/index.js +1 -1
- package/dist/components/index.cjs +251 -144
- package/dist/components/index.d.cts +12 -3
- package/dist/components/index.d.ts +12 -3
- package/dist/components/index.js +22 -15
- package/dist/components/item/index.cjs +11 -11
- package/dist/components/item/index.js +1 -1
- 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 +41 -34
- package/dist/components/stepper/index.d.cts +5 -4
- package/dist/components/stepper/index.d.ts +5 -4
- package/dist/components/stepper/index.js +22 -15
- 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 +24 -17
- package/dist/components/toaster/index.js +22 -15
- package/dist/components/tooltip/index.cjs +9 -4
- package/dist/components/tooltip/index.d.cts +8 -12
- package/dist/components/tooltip/index.d.ts +8 -12
- package/dist/components/tooltip/index.js +2 -1
- 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 +37 -49
- package/tailwind/animation.css +23 -1
- package/tailwind/global.css +5 -0
- package/tailwind/palette.css +2 -2
- package/dist/chunk-EW6TE3N5.cjs +0 -38
- package/dist/chunk-GR37JJQK.cjs +0 -43
- package/dist/chunk-H5O5L6XT.js +0 -14
- package/dist/chunk-HJJPEVIH.js +0 -40
- 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,205 @@
|
|
|
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
|
+
function WordRotate({
|
|
29
|
+
words,
|
|
30
|
+
duration = 1500,
|
|
31
|
+
animationStyle = "fade",
|
|
32
|
+
loop = true,
|
|
33
|
+
className,
|
|
34
|
+
containerClassName,
|
|
35
|
+
pauseDuration = 300,
|
|
36
|
+
startOnView = true,
|
|
37
|
+
once = false,
|
|
38
|
+
inViewMargin,
|
|
39
|
+
...props
|
|
40
|
+
}) {
|
|
41
|
+
const ref = React__namespace.useRef(null);
|
|
42
|
+
const isInView = react.useInView(ref, { once, margin: inViewMargin });
|
|
43
|
+
const [hasAnimated, setHasAnimated] = React__namespace.useState(false);
|
|
44
|
+
const [currentWord, setCurrentWord] = React__namespace.useState(0);
|
|
45
|
+
const [show, setShow] = React__namespace.useState(true);
|
|
46
|
+
const variants = {
|
|
47
|
+
fade: {
|
|
48
|
+
initial: { opacity: 0 },
|
|
49
|
+
animate: {
|
|
50
|
+
opacity: 1,
|
|
51
|
+
transition: {
|
|
52
|
+
duration: 0.4,
|
|
53
|
+
ease: [0.4, 0, 0.2, 1]
|
|
54
|
+
// Custom cubic-bezier for smooth fade
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
exit: {
|
|
58
|
+
opacity: 0,
|
|
59
|
+
transition: {
|
|
60
|
+
duration: 0.3,
|
|
61
|
+
ease: [0.4, 0, 1, 1]
|
|
62
|
+
// Faster exit
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
"slide-up": {
|
|
67
|
+
initial: { opacity: 0, y: 24 },
|
|
68
|
+
animate: {
|
|
69
|
+
opacity: 1,
|
|
70
|
+
y: 0,
|
|
71
|
+
transition: {
|
|
72
|
+
type: "spring",
|
|
73
|
+
stiffness: 300,
|
|
74
|
+
damping: 25,
|
|
75
|
+
mass: 0.8
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
exit: {
|
|
79
|
+
opacity: 0,
|
|
80
|
+
y: -24,
|
|
81
|
+
transition: {
|
|
82
|
+
duration: 0.25,
|
|
83
|
+
ease: [0.4, 0, 1, 1]
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
"slide-down": {
|
|
88
|
+
initial: { opacity: 0, y: -24 },
|
|
89
|
+
animate: {
|
|
90
|
+
opacity: 1,
|
|
91
|
+
y: 0,
|
|
92
|
+
transition: {
|
|
93
|
+
type: "spring",
|
|
94
|
+
stiffness: 300,
|
|
95
|
+
damping: 25,
|
|
96
|
+
mass: 0.8
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
exit: {
|
|
100
|
+
opacity: 0,
|
|
101
|
+
y: 24,
|
|
102
|
+
transition: {
|
|
103
|
+
duration: 0.25,
|
|
104
|
+
ease: [0.4, 0, 1, 1]
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
scale: {
|
|
109
|
+
initial: { opacity: 0, scale: 0.8 },
|
|
110
|
+
animate: {
|
|
111
|
+
opacity: 1,
|
|
112
|
+
scale: 1,
|
|
113
|
+
transition: {
|
|
114
|
+
type: "spring",
|
|
115
|
+
stiffness: 400,
|
|
116
|
+
damping: 30,
|
|
117
|
+
mass: 0.6
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
exit: {
|
|
121
|
+
opacity: 0,
|
|
122
|
+
scale: 0.9,
|
|
123
|
+
transition: {
|
|
124
|
+
duration: 0.2,
|
|
125
|
+
ease: [0.4, 0, 1, 1]
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
flip: {
|
|
130
|
+
initial: { opacity: 0, rotateX: 90 },
|
|
131
|
+
animate: {
|
|
132
|
+
opacity: 1,
|
|
133
|
+
rotateX: 0,
|
|
134
|
+
transition: {
|
|
135
|
+
type: "spring",
|
|
136
|
+
stiffness: 200,
|
|
137
|
+
damping: 20,
|
|
138
|
+
mass: 1
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
exit: {
|
|
142
|
+
opacity: 0,
|
|
143
|
+
rotateX: -90,
|
|
144
|
+
transition: {
|
|
145
|
+
duration: 0.3,
|
|
146
|
+
ease: [0.4, 0, 1, 1]
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
const shouldStart = !startOnView || isInView && (!once || !hasAnimated);
|
|
152
|
+
React__namespace.useEffect(() => {
|
|
153
|
+
if (!shouldStart) return;
|
|
154
|
+
if (words.length === 0) return;
|
|
155
|
+
let intervalId;
|
|
156
|
+
let timeoutId;
|
|
157
|
+
intervalId = setInterval(() => {
|
|
158
|
+
setShow(false);
|
|
159
|
+
timeoutId = setTimeout(() => {
|
|
160
|
+
setCurrentWord((prev) => {
|
|
161
|
+
const nextIndex = prev + 1;
|
|
162
|
+
if (!loop && nextIndex >= words.length) {
|
|
163
|
+
clearInterval(intervalId);
|
|
164
|
+
clearTimeout(timeoutId);
|
|
165
|
+
return prev;
|
|
166
|
+
}
|
|
167
|
+
return loop ? nextIndex % words.length : nextIndex;
|
|
168
|
+
});
|
|
169
|
+
setShow(true);
|
|
170
|
+
setHasAnimated(true);
|
|
171
|
+
}, pauseDuration);
|
|
172
|
+
}, duration + pauseDuration);
|
|
173
|
+
return () => {
|
|
174
|
+
clearInterval(intervalId);
|
|
175
|
+
clearTimeout(timeoutId);
|
|
176
|
+
};
|
|
177
|
+
}, [shouldStart, duration, pauseDuration, words.length, loop, once, hasAnimated]);
|
|
178
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
179
|
+
react.motion.span,
|
|
180
|
+
{
|
|
181
|
+
ref,
|
|
182
|
+
"data-slot": "word-rotate",
|
|
183
|
+
className: chunkH2BWO3SI_cjs.cn("inline-block overflow-hidden align-bottom leading-none", containerClassName),
|
|
184
|
+
...props,
|
|
185
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
186
|
+
react.motion.span,
|
|
187
|
+
{
|
|
188
|
+
initial: "initial",
|
|
189
|
+
animate: show ? "animate" : "exit",
|
|
190
|
+
exit: "exit",
|
|
191
|
+
variants: variants[animationStyle],
|
|
192
|
+
transition: { duration: 0.5 },
|
|
193
|
+
style: {
|
|
194
|
+
perspective: animationStyle === "flip" ? 1e3 : void 0
|
|
195
|
+
},
|
|
196
|
+
className: chunkH2BWO3SI_cjs.cn("inline-block", className),
|
|
197
|
+
children: words[currentWord]
|
|
198
|
+
},
|
|
199
|
+
currentWord
|
|
200
|
+
)
|
|
201
|
+
}
|
|
202
|
+
);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
exports.WordRotate = WordRotate;
|
|
@@ -34,10 +34,10 @@ var fieldVariants = classVarianceAuthority.cva("group/field data-[invalid=true]:
|
|
|
34
34
|
horizontal: [
|
|
35
35
|
"flex-row items-center",
|
|
36
36
|
"[&>[data-slot=field-label]]:flex-auto",
|
|
37
|
-
"has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px
|
|
37
|
+
"has-[>[data-slot=field-content]]:items-start has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px"
|
|
38
38
|
],
|
|
39
39
|
responsive: [
|
|
40
|
-
"@md/field-group:flex-row @md/field-group:items-center @md/field-group:[&>*]:w-auto
|
|
40
|
+
"flex-col @md/field-group:flex-row @md/field-group:items-center [&>*]:w-full @md/field-group:[&>*]:w-auto [&>.sr-only]:w-auto",
|
|
41
41
|
"@md/field-group:[&>[data-slot=field-label]]:flex-auto",
|
|
42
42
|
"@md/field-group:has-[>[data-slot=field-content]]:items-start @md/field-group:has-[>[data-slot=field-content]]:[&>[role=checkbox],[role=radio]]:mt-px"
|
|
43
43
|
]
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var chunkD4QID7AI_cjs = require('./chunk-D4QID7AI.cjs');
|
|
3
4
|
var chunk3WSQRFUY_cjs = require('./chunk-3WSQRFUY.cjs');
|
|
4
|
-
var chunkEW6TE3N5_cjs = require('./chunk-EW6TE3N5.cjs');
|
|
5
5
|
var chunk7EYMOUWG_cjs = require('./chunk-7EYMOUWG.cjs');
|
|
6
6
|
var chunkH2BWO3SI_cjs = require('./chunk-H2BWO3SI.cjs');
|
|
7
|
-
var
|
|
7
|
+
var React5 = require('react');
|
|
8
8
|
var reactSlot = require('@radix-ui/react-slot');
|
|
9
9
|
var jsxRuntime = require('react/jsx-runtime');
|
|
10
10
|
var lucideReact = require('lucide-react');
|
|
@@ -29,7 +29,7 @@ function _interopNamespace(e) {
|
|
|
29
29
|
return Object.freeze(n);
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
var
|
|
32
|
+
var React5__namespace = /*#__PURE__*/_interopNamespace(React5);
|
|
33
33
|
|
|
34
34
|
// src/components/stepper/stepper.constants.ts
|
|
35
35
|
var STEPPER_ROOT_NAME = "Stepper";
|
|
@@ -57,9 +57,9 @@ var STEPPER_MAP_KEY_TO_FOCUS_INTENT = {
|
|
|
57
57
|
};
|
|
58
58
|
|
|
59
59
|
// src/components/stepper/stepper.context.tsx
|
|
60
|
-
var StepperContext =
|
|
60
|
+
var StepperContext = React5__namespace.createContext(null);
|
|
61
61
|
function useStepperContext(consumerName) {
|
|
62
|
-
const context =
|
|
62
|
+
const context = React5__namespace.useContext(StepperContext);
|
|
63
63
|
if (!context) {
|
|
64
64
|
throw new Error(`\`${consumerName}\` must be used within \`${STEPPER_ROOT_NAME}\``);
|
|
65
65
|
}
|
|
@@ -149,9 +149,9 @@ function createStepperStore(listenersRef, stateRef, onValueChange, onValueComple
|
|
|
149
149
|
};
|
|
150
150
|
return store;
|
|
151
151
|
}
|
|
152
|
-
var StepperStoreContext =
|
|
152
|
+
var StepperStoreContext = React5__namespace.createContext(null);
|
|
153
153
|
function useStepperStoreContext(consumerName) {
|
|
154
|
-
const context =
|
|
154
|
+
const context = React5__namespace.useContext(StepperStoreContext);
|
|
155
155
|
if (!context) {
|
|
156
156
|
throw new Error(`\`${consumerName}\` must be used within \`${STEPPER_ROOT_NAME}\``);
|
|
157
157
|
}
|
|
@@ -159,8 +159,8 @@ function useStepperStoreContext(consumerName) {
|
|
|
159
159
|
}
|
|
160
160
|
function useStepperStore(selector) {
|
|
161
161
|
const store = useStepperStoreContext("useStore");
|
|
162
|
-
const getSnapshot =
|
|
163
|
-
return
|
|
162
|
+
const getSnapshot = React5__namespace.useCallback(() => selector(store.getState()), [selector, store]);
|
|
163
|
+
return React5__namespace.useSyncExternalStore(store.subscribe, getSnapshot, getSnapshot);
|
|
164
164
|
}
|
|
165
165
|
function Stepper({
|
|
166
166
|
value,
|
|
@@ -182,14 +182,14 @@ function Stepper({
|
|
|
182
182
|
indicators = {},
|
|
183
183
|
...rootProps
|
|
184
184
|
}) {
|
|
185
|
-
const id =
|
|
185
|
+
const id = React5__namespace.useId();
|
|
186
186
|
const rootId = idProp ?? id;
|
|
187
187
|
const listenersRef = chunk7EYMOUWG_cjs.useLazyRef(() => /* @__PURE__ */ new Set());
|
|
188
188
|
const stateRef = chunk7EYMOUWG_cjs.useLazyRef(() => ({
|
|
189
189
|
steps: /* @__PURE__ */ new Map(),
|
|
190
190
|
value: value ?? defaultValue
|
|
191
191
|
}));
|
|
192
|
-
const store =
|
|
192
|
+
const store = React5__namespace.useMemo(
|
|
193
193
|
() => createStepperStore(listenersRef, stateRef, onValueChange, onValueComplete, onValueAdd, onValueRemove, onValidate),
|
|
194
194
|
[listenersRef, stateRef, onValueChange, onValueComplete, onValueAdd, onValueRemove, onValidate]
|
|
195
195
|
);
|
|
@@ -198,8 +198,8 @@ function Stepper({
|
|
|
198
198
|
store.setState("value", value);
|
|
199
199
|
}
|
|
200
200
|
}, [value]);
|
|
201
|
-
const dir =
|
|
202
|
-
const contextValue =
|
|
201
|
+
const dir = chunkD4QID7AI_cjs.useDirection(dirProp);
|
|
202
|
+
const contextValue = React5__namespace.useMemo(
|
|
203
203
|
() => ({
|
|
204
204
|
id: rootId,
|
|
205
205
|
dir,
|
|
@@ -251,48 +251,14 @@ var StepperDataState = {
|
|
|
251
251
|
ACTIVE: "active",
|
|
252
252
|
COMPLETED: "completed"
|
|
253
253
|
};
|
|
254
|
-
var StepperFocusContext =
|
|
254
|
+
var StepperFocusContext = React5__namespace.createContext(null);
|
|
255
255
|
function useStepperFocusContext(consumerName) {
|
|
256
|
-
const context =
|
|
256
|
+
const context = React5__namespace.useContext(StepperFocusContext);
|
|
257
257
|
if (!context) {
|
|
258
258
|
throw new Error(`\`${consumerName}\` must be used within \`FocusProvider\``);
|
|
259
259
|
}
|
|
260
260
|
return context;
|
|
261
261
|
}
|
|
262
|
-
function setRef(ref, value) {
|
|
263
|
-
if (typeof ref === "function") {
|
|
264
|
-
return ref(value);
|
|
265
|
-
} else if (ref !== null && ref !== void 0) {
|
|
266
|
-
ref.current = value;
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
function composeRefs(...refs) {
|
|
270
|
-
return (node) => {
|
|
271
|
-
let hasCleanup = false;
|
|
272
|
-
const cleanups = refs.map((ref) => {
|
|
273
|
-
const cleanup = setRef(ref, node);
|
|
274
|
-
if (!hasCleanup && typeof cleanup == "function") {
|
|
275
|
-
hasCleanup = true;
|
|
276
|
-
}
|
|
277
|
-
return cleanup;
|
|
278
|
-
});
|
|
279
|
-
if (hasCleanup) {
|
|
280
|
-
return () => {
|
|
281
|
-
for (let i = 0; i < cleanups.length; i++) {
|
|
282
|
-
const cleanup = cleanups[i];
|
|
283
|
-
if (typeof cleanup == "function") {
|
|
284
|
-
cleanup();
|
|
285
|
-
} else {
|
|
286
|
-
setRef(refs[i], null);
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
};
|
|
290
|
-
}
|
|
291
|
-
};
|
|
292
|
-
}
|
|
293
|
-
function useComposedRefs(...refs) {
|
|
294
|
-
return React6__namespace.useCallback(composeRefs(...refs), refs);
|
|
295
|
-
}
|
|
296
262
|
|
|
297
263
|
// src/components/stepper/stepper.utils.tsx
|
|
298
264
|
function focusFirst(candidates, preventScroll = false) {
|
|
@@ -329,7 +295,7 @@ function wrapArray(array, startIndex) {
|
|
|
329
295
|
return array.map((_, index) => array[(startIndex + index) % array.length]);
|
|
330
296
|
}
|
|
331
297
|
function getDirectionAwareKey(key, dir) {
|
|
332
|
-
if (dir !==
|
|
298
|
+
if (dir !== "rtl") return key;
|
|
333
299
|
return key === "ArrowLeft" ? "ArrowRight" : key === "ArrowRight" ? "ArrowLeft" : key;
|
|
334
300
|
}
|
|
335
301
|
function getFocusIntent(event, dir, orientation) {
|
|
@@ -342,32 +308,32 @@ function StepperNav({ className, children, asChild, ref, ...listProps }) {
|
|
|
342
308
|
const context = useStepperContext(STEPPER_NAV_NAME);
|
|
343
309
|
const orientation = context.orientation;
|
|
344
310
|
const currentValue = useStepperStore((state) => state.value);
|
|
345
|
-
const [tabStopId, setTabStopId] =
|
|
346
|
-
const [isTabbingBackOut, setIsTabbingBackOut] =
|
|
347
|
-
const [focusableItemCount, setFocusableItemCount] =
|
|
348
|
-
const isClickFocusRef =
|
|
349
|
-
const itemsRef =
|
|
350
|
-
const listRef =
|
|
351
|
-
const composedRef = useComposedRefs(ref, listRef);
|
|
352
|
-
const onItemFocus =
|
|
311
|
+
const [tabStopId, setTabStopId] = React5__namespace.useState(null);
|
|
312
|
+
const [isTabbingBackOut, setIsTabbingBackOut] = React5__namespace.useState(false);
|
|
313
|
+
const [focusableItemCount, setFocusableItemCount] = React5__namespace.useState(0);
|
|
314
|
+
const isClickFocusRef = React5__namespace.useRef(false);
|
|
315
|
+
const itemsRef = React5__namespace.useRef(/* @__PURE__ */ new Map());
|
|
316
|
+
const listRef = React5__namespace.useRef(null);
|
|
317
|
+
const composedRef = chunkD4QID7AI_cjs.useComposedRefs(ref, listRef);
|
|
318
|
+
const onItemFocus = React5__namespace.useCallback((tabStopId2) => {
|
|
353
319
|
setTabStopId(tabStopId2);
|
|
354
320
|
}, []);
|
|
355
|
-
const onItemShiftTab =
|
|
321
|
+
const onItemShiftTab = React5__namespace.useCallback(() => {
|
|
356
322
|
setIsTabbingBackOut(true);
|
|
357
323
|
}, []);
|
|
358
|
-
const onFocusableItemAdd =
|
|
324
|
+
const onFocusableItemAdd = React5__namespace.useCallback(() => {
|
|
359
325
|
setFocusableItemCount((prevCount) => prevCount + 1);
|
|
360
326
|
}, []);
|
|
361
|
-
const onFocusableItemRemove =
|
|
327
|
+
const onFocusableItemRemove = React5__namespace.useCallback(() => {
|
|
362
328
|
setFocusableItemCount((prevCount) => prevCount - 1);
|
|
363
329
|
}, []);
|
|
364
|
-
const onItemRegister =
|
|
330
|
+
const onItemRegister = React5__namespace.useCallback((item) => {
|
|
365
331
|
itemsRef.current.set(item.id, item);
|
|
366
332
|
}, []);
|
|
367
|
-
const onItemUnregister =
|
|
333
|
+
const onItemUnregister = React5__namespace.useCallback((id) => {
|
|
368
334
|
itemsRef.current.delete(id);
|
|
369
335
|
}, []);
|
|
370
|
-
const getItems =
|
|
336
|
+
const getItems = React5__namespace.useCallback(() => {
|
|
371
337
|
return Array.from(itemsRef.current.values()).filter((item) => item.ref.current).sort((a, b) => {
|
|
372
338
|
const elementA = a.ref.current;
|
|
373
339
|
const elementB = b.ref.current;
|
|
@@ -382,15 +348,16 @@ function StepperNav({ className, children, asChild, ref, ...listProps }) {
|
|
|
382
348
|
return 0;
|
|
383
349
|
});
|
|
384
350
|
}, []);
|
|
385
|
-
const onBlur =
|
|
351
|
+
const onBlur = React5__namespace.useCallback(
|
|
386
352
|
(event) => {
|
|
387
353
|
listProps.onBlur?.(event);
|
|
388
354
|
if (event.defaultPrevented) return;
|
|
389
355
|
setIsTabbingBackOut(false);
|
|
390
356
|
},
|
|
357
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
391
358
|
[listProps.onBlur]
|
|
392
359
|
);
|
|
393
|
-
const onFocus =
|
|
360
|
+
const onFocus = React5__namespace.useCallback(
|
|
394
361
|
(event) => {
|
|
395
362
|
listProps.onFocus?.(event);
|
|
396
363
|
if (event.defaultPrevented) return;
|
|
@@ -415,7 +382,7 @@ function StepperNav({ className, children, asChild, ref, ...listProps }) {
|
|
|
415
382
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
416
383
|
[listProps.onFocus, isTabbingBackOut, currentValue, tabStopId]
|
|
417
384
|
);
|
|
418
|
-
const onMouseDown =
|
|
385
|
+
const onMouseDown = React5__namespace.useCallback(
|
|
419
386
|
(event) => {
|
|
420
387
|
listProps.onMouseDown?.(event);
|
|
421
388
|
if (event.defaultPrevented) return;
|
|
@@ -424,7 +391,7 @@ function StepperNav({ className, children, asChild, ref, ...listProps }) {
|
|
|
424
391
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
425
392
|
[listProps.onMouseDown]
|
|
426
393
|
);
|
|
427
|
-
const focusContextValue =
|
|
394
|
+
const focusContextValue = React5__namespace.useMemo(
|
|
428
395
|
() => ({
|
|
429
396
|
tabStopId,
|
|
430
397
|
onItemFocus,
|
|
@@ -470,9 +437,9 @@ function StepperNav({ className, children, asChild, ref, ...listProps }) {
|
|
|
470
437
|
}
|
|
471
438
|
) });
|
|
472
439
|
}
|
|
473
|
-
var StepperItemContext =
|
|
440
|
+
var StepperItemContext = React5__namespace.createContext(null);
|
|
474
441
|
function useStepperItemContext(consumerName) {
|
|
475
|
-
const context =
|
|
442
|
+
const context = React5__namespace.useContext(StepperItemContext);
|
|
476
443
|
if (!context) {
|
|
477
444
|
throw new Error(`\`${consumerName}\` must be used within \`${STEPPER_ITEM_NAME}\``);
|
|
478
445
|
}
|
|
@@ -503,7 +470,7 @@ function StepperItem({
|
|
|
503
470
|
const stepState = useStepperStore((state) => state.steps.get(itemValue));
|
|
504
471
|
const steps = useStepperStore((state) => state.steps);
|
|
505
472
|
const dataState = getDataState(value, itemValue, stepState, steps);
|
|
506
|
-
const itemContextValue =
|
|
473
|
+
const itemContextValue = React5__namespace.useMemo(
|
|
507
474
|
() => ({
|
|
508
475
|
value: itemValue,
|
|
509
476
|
stepState
|
|
@@ -565,11 +532,11 @@ function StepperTrigger({ asChild, disabled, className, ref, ...triggerProps })
|
|
|
565
532
|
const isActive = value === itemValue;
|
|
566
533
|
const isTabStop = focusContext.tabStopId === triggerId;
|
|
567
534
|
const dataState = getDataState(value, itemValue, stepState, steps);
|
|
568
|
-
const triggerRef =
|
|
569
|
-
const composedRef = useComposedRefs(ref, triggerRef);
|
|
570
|
-
const isArrowKeyPressedRef =
|
|
571
|
-
const isMouseClickRef =
|
|
572
|
-
|
|
535
|
+
const triggerRef = React5__namespace.useRef(null);
|
|
536
|
+
const composedRef = chunkD4QID7AI_cjs.useComposedRefs(ref, triggerRef);
|
|
537
|
+
const isArrowKeyPressedRef = React5__namespace.useRef(false);
|
|
538
|
+
const isMouseClickRef = React5__namespace.useRef(false);
|
|
539
|
+
React5__namespace.useEffect(() => {
|
|
573
540
|
function onKeyDown2(event) {
|
|
574
541
|
if (STEPPER_ARROW_KEYS.includes(event.key)) {
|
|
575
542
|
isArrowKeyPressedRef.current = true;
|
|
@@ -603,7 +570,7 @@ function StepperTrigger({ asChild, disabled, className, ref, ...triggerProps })
|
|
|
603
570
|
}
|
|
604
571
|
};
|
|
605
572
|
}, [focusContext, triggerId, itemValue, isTabStop, isDisabled]);
|
|
606
|
-
const onClick =
|
|
573
|
+
const onClick = React5__namespace.useCallback(
|
|
607
574
|
async (event) => {
|
|
608
575
|
triggerProps.onClick?.(event);
|
|
609
576
|
if (event.defaultPrevented) return;
|
|
@@ -617,7 +584,7 @@ function StepperTrigger({ asChild, disabled, className, ref, ...triggerProps })
|
|
|
617
584
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
618
585
|
[isDisabled, context.nonInteractive, store, itemValue, value, steps, triggerProps.onClick]
|
|
619
586
|
);
|
|
620
|
-
const onFocus =
|
|
587
|
+
const onFocus = React5__namespace.useCallback(
|
|
621
588
|
async (event) => {
|
|
622
589
|
triggerProps.onFocus?.(event);
|
|
623
590
|
if (event.defaultPrevented) return;
|
|
@@ -645,7 +612,7 @@ function StepperTrigger({ asChild, disabled, className, ref, ...triggerProps })
|
|
|
645
612
|
store
|
|
646
613
|
]
|
|
647
614
|
);
|
|
648
|
-
const onKeyDown =
|
|
615
|
+
const onKeyDown = React5__namespace.useCallback(
|
|
649
616
|
async (event) => {
|
|
650
617
|
triggerProps.onKeyDown?.(event);
|
|
651
618
|
if (event.defaultPrevented) return;
|
|
@@ -699,6 +666,7 @@ function StepperTrigger({ asChild, disabled, className, ref, ...triggerProps })
|
|
|
699
666
|
queueMicrotask(() => focusFirst(candidateRefs));
|
|
700
667
|
}
|
|
701
668
|
},
|
|
669
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
702
670
|
[
|
|
703
671
|
focusContext,
|
|
704
672
|
context.nonInteractive,
|
|
@@ -714,7 +682,7 @@ function StepperTrigger({ asChild, disabled, className, ref, ...triggerProps })
|
|
|
714
682
|
steps
|
|
715
683
|
]
|
|
716
684
|
);
|
|
717
|
-
const onMouseDown =
|
|
685
|
+
const onMouseDown = React5__namespace.useCallback(
|
|
718
686
|
(event) => {
|
|
719
687
|
triggerProps.onMouseDown?.(event);
|
|
720
688
|
if (event.defaultPrevented) {
|
|
@@ -875,7 +843,7 @@ function StepperNextTrigger({ asChild = false, onClick, disabled, ...props }) {
|
|
|
875
843
|
const stepKeys = Array.from(steps.keys());
|
|
876
844
|
const currentIndex = value ? stepKeys.indexOf(value) : -1;
|
|
877
845
|
const isDisabled = disabled || currentIndex >= stepKeys.length - 1;
|
|
878
|
-
const handleClick =
|
|
846
|
+
const handleClick = React5__namespace.useCallback(
|
|
879
847
|
async (event) => {
|
|
880
848
|
onClick?.(event);
|
|
881
849
|
if (event.defaultPrevented || isDisabled) {
|
|
@@ -908,7 +876,7 @@ function StepperPrevTrigger({ asChild = false, disabled, onClick, ...props }) {
|
|
|
908
876
|
const stepKeys = Array.from(steps.keys());
|
|
909
877
|
const currentIndex = value ? stepKeys.indexOf(value) : -1;
|
|
910
878
|
const isDisabled = disabled || currentIndex <= 0;
|
|
911
|
-
const handleClick =
|
|
879
|
+
const handleClick = React5__namespace.useCallback(
|
|
912
880
|
async (event) => {
|
|
913
881
|
onClick?.(event);
|
|
914
882
|
if (event.defaultPrevented || isDisabled) {
|
|
@@ -959,9 +927,9 @@ var Toaster = ({ theme = "system", ...props }) => {
|
|
|
959
927
|
};
|
|
960
928
|
var buttonVariants = classVarianceAuthority.cva(
|
|
961
929
|
[
|
|
962
|
-
"inline-flex shrink-0 items-center justify-center gap-2
|
|
930
|
+
"inline-flex shrink-0 items-center justify-center gap-2 rounded text-sm font-medium whitespace-nowrap transition-all outline-none",
|
|
963
931
|
"disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50",
|
|
964
|
-
"[&_svg:not([class*='size-'])]:size-4
|
|
932
|
+
"[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
965
933
|
"focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring",
|
|
966
934
|
"aria-invalid:ring-error/20 dark:aria-invalid:ring-error/40 aria-invalid:border-error"
|
|
967
935
|
],
|
|
@@ -970,7 +938,7 @@ var buttonVariants = classVarianceAuthority.cva(
|
|
|
970
938
|
variant: {
|
|
971
939
|
default: "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
972
940
|
error: "bg-error hover:bg-error/90 focus-visible:ring-error/20 dark:focus-visible:ring-error/40 dark:bg-error/60 text-white",
|
|
973
|
-
outline: "bg-background
|
|
941
|
+
outline: "bg-background hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50 border shadow-xs",
|
|
974
942
|
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
975
943
|
ghost: "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
|
|
976
944
|
link: "text-primary underline-offset-4 hover:underline"
|
|
@@ -1055,15 +1023,15 @@ function ButtonContent({
|
|
|
1055
1023
|
const isEndLoading = loading && loadingPosition === "end";
|
|
1056
1024
|
const EndIcon = isEndLoading ? /* @__PURE__ */ jsxRuntime.jsx(chunk3WSQRFUY_cjs.Spinner, { "aria-label": "Loading" }) : endIcon || null;
|
|
1057
1025
|
const isCenterLoading = loading && loadingPosition === "center";
|
|
1058
|
-
return asChild &&
|
|
1026
|
+
return asChild && React5__namespace.isValidElement(children) ? React5__namespace.cloneElement(
|
|
1059
1027
|
children,
|
|
1060
1028
|
props,
|
|
1061
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1029
|
+
/* @__PURE__ */ jsxRuntime.jsxs(React5__namespace.Fragment, { children: [
|
|
1062
1030
|
StartIcon,
|
|
1063
|
-
isCenterLoading ? /* @__PURE__ */ jsxRuntime.jsx(chunk3WSQRFUY_cjs.Spinner, { "aria-label": "Loading" }) :
|
|
1031
|
+
isCenterLoading ? /* @__PURE__ */ jsxRuntime.jsx(chunk3WSQRFUY_cjs.Spinner, { "aria-label": "Loading" }) : React5__namespace.isValidElement(children) ? children.props?.children : null,
|
|
1064
1032
|
EndIcon
|
|
1065
1033
|
] })
|
|
1066
|
-
) : /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1034
|
+
) : /* @__PURE__ */ jsxRuntime.jsxs(React5__namespace.Fragment, { children: [
|
|
1067
1035
|
StartIcon,
|
|
1068
1036
|
isCenterLoading ? /* @__PURE__ */ jsxRuntime.jsx(chunk3WSQRFUY_cjs.Spinner, { "aria-label": "Loading" }) : children,
|
|
1069
1037
|
EndIcon
|