@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,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;
|
|
@@ -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,7 +348,7 @@ 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;
|
|
@@ -391,7 +357,7 @@ function StepperNav({ className, children, asChild, ref, ...listProps }) {
|
|
|
391
357
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
392
358
|
[listProps.onBlur]
|
|
393
359
|
);
|
|
394
|
-
const onFocus =
|
|
360
|
+
const onFocus = React5__namespace.useCallback(
|
|
395
361
|
(event) => {
|
|
396
362
|
listProps.onFocus?.(event);
|
|
397
363
|
if (event.defaultPrevented) return;
|
|
@@ -416,7 +382,7 @@ function StepperNav({ className, children, asChild, ref, ...listProps }) {
|
|
|
416
382
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
417
383
|
[listProps.onFocus, isTabbingBackOut, currentValue, tabStopId]
|
|
418
384
|
);
|
|
419
|
-
const onMouseDown =
|
|
385
|
+
const onMouseDown = React5__namespace.useCallback(
|
|
420
386
|
(event) => {
|
|
421
387
|
listProps.onMouseDown?.(event);
|
|
422
388
|
if (event.defaultPrevented) return;
|
|
@@ -425,7 +391,7 @@ function StepperNav({ className, children, asChild, ref, ...listProps }) {
|
|
|
425
391
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
426
392
|
[listProps.onMouseDown]
|
|
427
393
|
);
|
|
428
|
-
const focusContextValue =
|
|
394
|
+
const focusContextValue = React5__namespace.useMemo(
|
|
429
395
|
() => ({
|
|
430
396
|
tabStopId,
|
|
431
397
|
onItemFocus,
|
|
@@ -471,9 +437,9 @@ function StepperNav({ className, children, asChild, ref, ...listProps }) {
|
|
|
471
437
|
}
|
|
472
438
|
) });
|
|
473
439
|
}
|
|
474
|
-
var StepperItemContext =
|
|
440
|
+
var StepperItemContext = React5__namespace.createContext(null);
|
|
475
441
|
function useStepperItemContext(consumerName) {
|
|
476
|
-
const context =
|
|
442
|
+
const context = React5__namespace.useContext(StepperItemContext);
|
|
477
443
|
if (!context) {
|
|
478
444
|
throw new Error(`\`${consumerName}\` must be used within \`${STEPPER_ITEM_NAME}\``);
|
|
479
445
|
}
|
|
@@ -504,7 +470,7 @@ function StepperItem({
|
|
|
504
470
|
const stepState = useStepperStore((state) => state.steps.get(itemValue));
|
|
505
471
|
const steps = useStepperStore((state) => state.steps);
|
|
506
472
|
const dataState = getDataState(value, itemValue, stepState, steps);
|
|
507
|
-
const itemContextValue =
|
|
473
|
+
const itemContextValue = React5__namespace.useMemo(
|
|
508
474
|
() => ({
|
|
509
475
|
value: itemValue,
|
|
510
476
|
stepState
|
|
@@ -566,11 +532,11 @@ function StepperTrigger({ asChild, disabled, className, ref, ...triggerProps })
|
|
|
566
532
|
const isActive = value === itemValue;
|
|
567
533
|
const isTabStop = focusContext.tabStopId === triggerId;
|
|
568
534
|
const dataState = getDataState(value, itemValue, stepState, steps);
|
|
569
|
-
const triggerRef =
|
|
570
|
-
const composedRef = useComposedRefs(ref, triggerRef);
|
|
571
|
-
const isArrowKeyPressedRef =
|
|
572
|
-
const isMouseClickRef =
|
|
573
|
-
|
|
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(() => {
|
|
574
540
|
function onKeyDown2(event) {
|
|
575
541
|
if (STEPPER_ARROW_KEYS.includes(event.key)) {
|
|
576
542
|
isArrowKeyPressedRef.current = true;
|
|
@@ -604,7 +570,7 @@ function StepperTrigger({ asChild, disabled, className, ref, ...triggerProps })
|
|
|
604
570
|
}
|
|
605
571
|
};
|
|
606
572
|
}, [focusContext, triggerId, itemValue, isTabStop, isDisabled]);
|
|
607
|
-
const onClick =
|
|
573
|
+
const onClick = React5__namespace.useCallback(
|
|
608
574
|
async (event) => {
|
|
609
575
|
triggerProps.onClick?.(event);
|
|
610
576
|
if (event.defaultPrevented) return;
|
|
@@ -618,7 +584,7 @@ function StepperTrigger({ asChild, disabled, className, ref, ...triggerProps })
|
|
|
618
584
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
619
585
|
[isDisabled, context.nonInteractive, store, itemValue, value, steps, triggerProps.onClick]
|
|
620
586
|
);
|
|
621
|
-
const onFocus =
|
|
587
|
+
const onFocus = React5__namespace.useCallback(
|
|
622
588
|
async (event) => {
|
|
623
589
|
triggerProps.onFocus?.(event);
|
|
624
590
|
if (event.defaultPrevented) return;
|
|
@@ -646,7 +612,7 @@ function StepperTrigger({ asChild, disabled, className, ref, ...triggerProps })
|
|
|
646
612
|
store
|
|
647
613
|
]
|
|
648
614
|
);
|
|
649
|
-
const onKeyDown =
|
|
615
|
+
const onKeyDown = React5__namespace.useCallback(
|
|
650
616
|
async (event) => {
|
|
651
617
|
triggerProps.onKeyDown?.(event);
|
|
652
618
|
if (event.defaultPrevented) return;
|
|
@@ -716,7 +682,7 @@ function StepperTrigger({ asChild, disabled, className, ref, ...triggerProps })
|
|
|
716
682
|
steps
|
|
717
683
|
]
|
|
718
684
|
);
|
|
719
|
-
const onMouseDown =
|
|
685
|
+
const onMouseDown = React5__namespace.useCallback(
|
|
720
686
|
(event) => {
|
|
721
687
|
triggerProps.onMouseDown?.(event);
|
|
722
688
|
if (event.defaultPrevented) {
|
|
@@ -877,7 +843,7 @@ function StepperNextTrigger({ asChild = false, onClick, disabled, ...props }) {
|
|
|
877
843
|
const stepKeys = Array.from(steps.keys());
|
|
878
844
|
const currentIndex = value ? stepKeys.indexOf(value) : -1;
|
|
879
845
|
const isDisabled = disabled || currentIndex >= stepKeys.length - 1;
|
|
880
|
-
const handleClick =
|
|
846
|
+
const handleClick = React5__namespace.useCallback(
|
|
881
847
|
async (event) => {
|
|
882
848
|
onClick?.(event);
|
|
883
849
|
if (event.defaultPrevented || isDisabled) {
|
|
@@ -910,7 +876,7 @@ function StepperPrevTrigger({ asChild = false, disabled, onClick, ...props }) {
|
|
|
910
876
|
const stepKeys = Array.from(steps.keys());
|
|
911
877
|
const currentIndex = value ? stepKeys.indexOf(value) : -1;
|
|
912
878
|
const isDisabled = disabled || currentIndex <= 0;
|
|
913
|
-
const handleClick =
|
|
879
|
+
const handleClick = React5__namespace.useCallback(
|
|
914
880
|
async (event) => {
|
|
915
881
|
onClick?.(event);
|
|
916
882
|
if (event.defaultPrevented || isDisabled) {
|
|
@@ -1057,15 +1023,15 @@ function ButtonContent({
|
|
|
1057
1023
|
const isEndLoading = loading && loadingPosition === "end";
|
|
1058
1024
|
const EndIcon = isEndLoading ? /* @__PURE__ */ jsxRuntime.jsx(chunk3WSQRFUY_cjs.Spinner, { "aria-label": "Loading" }) : endIcon || null;
|
|
1059
1025
|
const isCenterLoading = loading && loadingPosition === "center";
|
|
1060
|
-
return asChild &&
|
|
1026
|
+
return asChild && React5__namespace.isValidElement(children) ? React5__namespace.cloneElement(
|
|
1061
1027
|
children,
|
|
1062
1028
|
props,
|
|
1063
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1029
|
+
/* @__PURE__ */ jsxRuntime.jsxs(React5__namespace.Fragment, { children: [
|
|
1064
1030
|
StartIcon,
|
|
1065
|
-
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,
|
|
1066
1032
|
EndIcon
|
|
1067
1033
|
] })
|
|
1068
|
-
) : /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1034
|
+
) : /* @__PURE__ */ jsxRuntime.jsxs(React5__namespace.Fragment, { children: [
|
|
1069
1035
|
StartIcon,
|
|
1070
1036
|
isCenterLoading ? /* @__PURE__ */ jsxRuntime.jsx(chunk3WSQRFUY_cjs.Spinner, { "aria-label": "Loading" }) : children,
|
|
1071
1037
|
EndIcon
|