@szum-tech/design-system 2.7.0 → 3.1.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-2Y2ZCPNV.cjs +61 -0
- package/dist/chunk-3376ZTRC.cjs +2 -0
- package/dist/{chunk-S5BN23O7.cjs → chunk-3KMXFN6M.cjs} +14 -20
- package/dist/chunk-5AA4IE2T.cjs +27 -0
- package/dist/chunk-5F2Y65JH.js +32 -0
- package/dist/chunk-6BSR3O2J.js +53 -0
- package/dist/chunk-BYXBJQAS.js +1 -0
- package/dist/{chunk-XIPREW2R.js → chunk-DP7UEOTA.js} +173 -176
- package/dist/chunk-HCHVDUI6.cjs +34 -0
- package/dist/chunk-HD7ZDQWW.js +173 -0
- package/dist/chunk-I3RSTJP6.js +20 -0
- package/dist/chunk-I7AV5IQO.cjs +33 -0
- package/dist/chunk-N4O2GO6V.cjs +204 -0
- package/dist/chunk-NGVFYKAT.js +29 -0
- package/dist/chunk-NU5UQPBX.cjs +25 -0
- package/dist/chunk-OQCNPNPS.js +23 -0
- package/dist/chunk-S3ANEJJ7.cjs +22 -0
- package/dist/chunk-U4AWAABZ.js +4901 -0
- package/dist/chunk-UGSNASZM.js +25 -0
- package/dist/{chunk-EIXSMEDP.cjs → chunk-UIOBJSKZ.cjs} +1 -3
- package/dist/{chunk-I5P2HH5Z.js → chunk-WJSS32MY.js} +13 -19
- package/dist/{chunk-GEACYHTU.js → chunk-XJIUGEPN.js} +1 -3
- package/dist/chunk-Y6EVJSAH.cjs +4928 -0
- package/dist/{chunk-D3MOZUNH.cjs → chunk-ZV4467OW.cjs} +176 -185
- package/dist/components/alert-dialog/index.cjs +1 -0
- package/dist/components/alert-dialog/index.js +1 -0
- package/dist/components/avatar/index.cjs +5 -4
- package/dist/components/avatar/index.d.cts +5 -19
- package/dist/components/avatar/index.d.ts +5 -19
- package/dist/components/avatar/index.js +2 -1
- package/dist/components/badge/index.cjs +1 -0
- package/dist/components/badge/index.js +1 -0
- package/dist/components/button/index.cjs +23 -3
- package/dist/components/button/index.d.cts +8 -15
- package/dist/components/button/index.d.ts +8 -15
- package/dist/components/button/index.js +22 -2
- package/dist/components/card/index.cjs +12 -7
- package/dist/components/card/index.d.cts +8 -5
- package/dist/components/card/index.d.ts +8 -5
- package/dist/components/card/index.js +2 -1
- package/dist/components/checkbox/index.cjs +12 -0
- package/dist/components/checkbox/index.d.cts +8 -0
- package/dist/components/checkbox/index.d.ts +8 -0
- package/dist/components/checkbox/index.js +3 -0
- package/dist/components/dialog/index.cjs +1 -0
- package/dist/components/dialog/index.d.cts +1 -1
- package/dist/components/dialog/index.d.ts +1 -1
- package/dist/components/dialog/index.js +1 -0
- package/dist/components/field/index.cjs +50 -0
- package/dist/components/field/index.d.cts +50 -0
- package/dist/components/field/index.d.ts +50 -0
- package/dist/components/field/index.js +5 -0
- package/dist/components/header/index.cjs +1 -0
- package/dist/components/header/index.js +1 -0
- package/dist/components/index.cjs +157 -125
- package/dist/components/index.d.cts +7 -8
- package/dist/components/index.d.ts +7 -8
- package/dist/components/index.js +14 -14
- package/dist/components/input/index.cjs +3 -2
- package/dist/components/input/index.d.cts +2 -4
- package/dist/components/input/index.d.ts +2 -4
- package/dist/components/input/index.js +2 -1
- package/dist/components/item/index.cjs +13 -12
- package/dist/components/item/index.d.cts +7 -7
- package/dist/components/item/index.d.ts +7 -7
- package/dist/components/item/index.js +3 -2
- package/dist/components/label/index.cjs +3 -2
- package/dist/components/label/index.js +2 -1
- package/dist/components/select/index.cjs +20 -3
- package/dist/components/select/index.d.cts +20 -6
- package/dist/components/select/index.d.ts +20 -6
- package/dist/components/select/index.js +2 -1
- package/dist/components/separator/index.cjs +3 -2
- package/dist/components/separator/index.js +2 -1
- package/dist/components/sheet/index.cjs +1 -0
- package/dist/components/sheet/index.d.cts +1 -1
- package/dist/components/sheet/index.d.ts +1 -1
- package/dist/components/sheet/index.js +1 -0
- package/dist/components/spinner/index.cjs +1 -0
- package/dist/components/spinner/index.js +1 -0
- package/dist/components/stepper/index.cjs +33 -33
- package/dist/components/stepper/index.js +14 -14
- package/dist/components/textarea/index.cjs +4 -2
- package/dist/components/textarea/index.d.cts +2 -2
- package/dist/components/textarea/index.d.ts +2 -2
- package/dist/components/textarea/index.js +3 -1
- package/dist/components/tooltip/index.cjs +1 -0
- package/dist/components/tooltip/index.js +1 -0
- package/dist/contexts/index.cjs +1 -0
- package/dist/contexts/index.js +1 -0
- package/dist/hooks/index.cjs +1 -0
- package/dist/hooks/index.js +1 -0
- package/dist/icons/index.cjs +89 -18
- package/dist/icons/index.js +88 -1
- package/dist/utils/index.cjs +1 -0
- package/dist/utils/index.js +1 -0
- package/package.json +8 -9
- package/tailwind/global.css +12 -8
- package/tailwind/palette.css +149 -204
- package/tailwind/typography.css +33 -57
- package/dist/chunk-36YD6ICC.js +0 -70
- package/dist/chunk-4NO6IM75.cjs +0 -40
- package/dist/chunk-5BTQ6BQA.js +0 -24
- package/dist/chunk-5PBHBOXI.js +0 -30
- package/dist/chunk-EU7G37IS.js +0 -36
- package/dist/chunk-FPFRA5Q6.cjs +0 -31
- package/dist/chunk-FVSO3RHT.cjs +0 -17
- package/dist/chunk-G6VXQ7DJ.cjs +0 -63
- package/dist/chunk-IAI7BIAG.js +0 -31
- package/dist/chunk-K4TRAPRN.cjs +0 -341
- package/dist/chunk-MI3CQBHC.js +0 -60
- package/dist/chunk-OIWEXHFE.cjs +0 -33
- package/dist/chunk-P4J2TTH7.cjs +0 -32
- package/dist/chunk-UKWZ5BHD.cjs +0 -93
- package/dist/chunk-VZKTT6CG.js +0 -15
- package/dist/chunk-XTO7CMIM.js +0 -88
- package/dist/chunk-YJFJLF7Y.js +0 -319
- package/dist/chunk-ZZ3EBGSD.cjs +0 -72
- package/dist/components/form/index.cjs +0 -55
- package/dist/components/form/index.d.cts +0 -32
- package/dist/components/form/index.d.ts +0 -32
- package/dist/components/form/index.js +0 -22
- package/dist/components/helper-text/index.cjs +0 -10
- package/dist/components/helper-text/index.d.cts +0 -18
- package/dist/components/helper-text/index.d.ts +0 -18
- package/dist/components/helper-text/index.js +0 -1
|
@@ -1,78 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { useComposedRefs } from './chunk-U4AWAABZ.js';
|
|
2
|
+
import { Spinner } from './chunk-P5IUC7HJ.js';
|
|
3
3
|
import { useDirection, Direction } from './chunk-H5O5L6XT.js';
|
|
4
4
|
import { useLazyRef, useIsomorphicLayoutEffect } from './chunk-DFD2WUOU.js';
|
|
5
5
|
import { cn } from './chunk-ZD2QRAOX.js';
|
|
6
|
-
import
|
|
7
|
-
import * as React12 from 'react';
|
|
8
|
-
import { twMerge } from 'tailwind-merge';
|
|
9
|
-
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
6
|
+
import * as React5 from 'react';
|
|
10
7
|
import { Slot } from '@radix-ui/react-slot';
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
var FormItemContext = React12.createContext({});
|
|
14
|
-
var FormItem = React12.forwardRef(function({ className, ...props }, ref) {
|
|
15
|
-
const id = React12.useId();
|
|
16
|
-
return /* @__PURE__ */ jsx(FormItemContext.Provider, { value: { id }, children: /* @__PURE__ */ jsx("div", { ref, className: twMerge("space-y-2", className), ...props }) });
|
|
17
|
-
});
|
|
18
|
-
FormItem.displayName = "FormItem";
|
|
19
|
-
var FormFieldContext = React12.createContext({});
|
|
20
|
-
var FormField = ({
|
|
21
|
-
...props
|
|
22
|
-
}) => {
|
|
23
|
-
return /* @__PURE__ */ jsx(FormFieldContext.Provider, { value: { name: props.name }, children: /* @__PURE__ */ jsx(Controller, { ...props }) });
|
|
24
|
-
};
|
|
25
|
-
var useFormField = () => {
|
|
26
|
-
const fieldContext = React12.useContext(FormFieldContext);
|
|
27
|
-
const itemContext = React12.useContext(FormItemContext);
|
|
28
|
-
const { getFieldState, formState } = useFormContext();
|
|
29
|
-
const fieldState = getFieldState(fieldContext.name, formState);
|
|
30
|
-
if (!fieldContext) {
|
|
31
|
-
throw new Error("useFormField should be used within <FormField>");
|
|
32
|
-
}
|
|
33
|
-
const { id } = itemContext;
|
|
34
|
-
return {
|
|
35
|
-
id,
|
|
36
|
-
name: fieldContext.name,
|
|
37
|
-
formItemId: `${id}-form-item`,
|
|
38
|
-
formDescriptionId: `${id}-form-item-description`,
|
|
39
|
-
formMessageId: `${id}-form-item-message`,
|
|
40
|
-
...fieldState
|
|
41
|
-
};
|
|
42
|
-
};
|
|
43
|
-
var FormLabel = React12.forwardRef(
|
|
44
|
-
({ className, caption, ...props }, ref) => {
|
|
45
|
-
const { error, formItemId } = useFormField();
|
|
46
|
-
return /* @__PURE__ */ jsxs("div", { className: "flex flex-row items-end justify-between", children: [
|
|
47
|
-
/* @__PURE__ */ jsx(
|
|
48
|
-
Label,
|
|
49
|
-
{
|
|
50
|
-
ref,
|
|
51
|
-
className: twMerge(error ? "text-error-500" : null, className),
|
|
52
|
-
htmlFor: formItemId,
|
|
53
|
-
...props
|
|
54
|
-
}
|
|
55
|
-
),
|
|
56
|
-
caption ? /* @__PURE__ */ jsx("div", { className: "typography-caption text-gray-200", children: caption }) : null
|
|
57
|
-
] });
|
|
58
|
-
}
|
|
59
|
-
);
|
|
60
|
-
FormLabel.displayName = "FormLabel";
|
|
61
|
-
var FormControl = React12.forwardRef(function(props, ref) {
|
|
62
|
-
const { error, formItemId, formDescriptionId, formMessageId } = useFormField();
|
|
63
|
-
const newProps = { ...props, invalid: !!error };
|
|
64
|
-
return /* @__PURE__ */ jsx(
|
|
65
|
-
Slot,
|
|
66
|
-
{
|
|
67
|
-
ref,
|
|
68
|
-
id: formItemId,
|
|
69
|
-
"aria-describedby": !error ? `${formDescriptionId}` : `${formDescriptionId} ${formMessageId}`,
|
|
70
|
-
"aria-invalid": !!error,
|
|
71
|
-
...newProps
|
|
72
|
-
}
|
|
73
|
-
);
|
|
74
|
-
});
|
|
75
|
-
FormControl.displayName = "FormControl";
|
|
8
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
9
|
+
import { cva } from 'class-variance-authority';
|
|
76
10
|
|
|
77
11
|
// src/components/stepper/stepper.constants.ts
|
|
78
12
|
var STEPPER_ROOT_NAME = "Stepper";
|
|
@@ -100,9 +34,9 @@ var STEPPER_MAP_KEY_TO_FOCUS_INTENT = {
|
|
|
100
34
|
};
|
|
101
35
|
|
|
102
36
|
// src/components/stepper/stepper.context.tsx
|
|
103
|
-
var StepperContext =
|
|
37
|
+
var StepperContext = React5.createContext(null);
|
|
104
38
|
function useStepperContext(consumerName) {
|
|
105
|
-
const context =
|
|
39
|
+
const context = React5.useContext(StepperContext);
|
|
106
40
|
if (!context) {
|
|
107
41
|
throw new Error(`\`${consumerName}\` must be used within \`${STEPPER_ROOT_NAME}\``);
|
|
108
42
|
}
|
|
@@ -192,9 +126,9 @@ function createStepperStore(listenersRef, stateRef, onValueChange, onValueComple
|
|
|
192
126
|
};
|
|
193
127
|
return store;
|
|
194
128
|
}
|
|
195
|
-
var StepperStoreContext =
|
|
129
|
+
var StepperStoreContext = React5.createContext(null);
|
|
196
130
|
function useStepperStoreContext(consumerName) {
|
|
197
|
-
const context =
|
|
131
|
+
const context = React5.useContext(StepperStoreContext);
|
|
198
132
|
if (!context) {
|
|
199
133
|
throw new Error(`\`${consumerName}\` must be used within \`${STEPPER_ROOT_NAME}\``);
|
|
200
134
|
}
|
|
@@ -202,8 +136,8 @@ function useStepperStoreContext(consumerName) {
|
|
|
202
136
|
}
|
|
203
137
|
function useStepperStore(selector) {
|
|
204
138
|
const store = useStepperStoreContext("useStore");
|
|
205
|
-
const getSnapshot =
|
|
206
|
-
return
|
|
139
|
+
const getSnapshot = React5.useCallback(() => selector(store.getState()), [selector, store]);
|
|
140
|
+
return React5.useSyncExternalStore(store.subscribe, getSnapshot, getSnapshot);
|
|
207
141
|
}
|
|
208
142
|
function Stepper({
|
|
209
143
|
value,
|
|
@@ -225,14 +159,14 @@ function Stepper({
|
|
|
225
159
|
indicators = {},
|
|
226
160
|
...rootProps
|
|
227
161
|
}) {
|
|
228
|
-
const id =
|
|
162
|
+
const id = React5.useId();
|
|
229
163
|
const rootId = idProp ?? id;
|
|
230
164
|
const listenersRef = useLazyRef(() => /* @__PURE__ */ new Set());
|
|
231
165
|
const stateRef = useLazyRef(() => ({
|
|
232
166
|
steps: /* @__PURE__ */ new Map(),
|
|
233
167
|
value: value ?? defaultValue
|
|
234
168
|
}));
|
|
235
|
-
const store =
|
|
169
|
+
const store = React5.useMemo(
|
|
236
170
|
() => createStepperStore(listenersRef, stateRef, onValueChange, onValueComplete, onValueAdd, onValueRemove, onValidate),
|
|
237
171
|
[listenersRef, stateRef, onValueChange, onValueComplete, onValueAdd, onValueRemove, onValidate]
|
|
238
172
|
);
|
|
@@ -242,7 +176,7 @@ function Stepper({
|
|
|
242
176
|
}
|
|
243
177
|
}, [value]);
|
|
244
178
|
const dir = useDirection(dirProp);
|
|
245
|
-
const contextValue =
|
|
179
|
+
const contextValue = React5.useMemo(
|
|
246
180
|
() => ({
|
|
247
181
|
id: rootId,
|
|
248
182
|
dir,
|
|
@@ -294,48 +228,14 @@ var StepperDataState = {
|
|
|
294
228
|
ACTIVE: "active",
|
|
295
229
|
COMPLETED: "completed"
|
|
296
230
|
};
|
|
297
|
-
var StepperFocusContext =
|
|
231
|
+
var StepperFocusContext = React5.createContext(null);
|
|
298
232
|
function useStepperFocusContext(consumerName) {
|
|
299
|
-
const context =
|
|
233
|
+
const context = React5.useContext(StepperFocusContext);
|
|
300
234
|
if (!context) {
|
|
301
235
|
throw new Error(`\`${consumerName}\` must be used within \`FocusProvider\``);
|
|
302
236
|
}
|
|
303
237
|
return context;
|
|
304
238
|
}
|
|
305
|
-
function setRef(ref, value) {
|
|
306
|
-
if (typeof ref === "function") {
|
|
307
|
-
return ref(value);
|
|
308
|
-
} else if (ref !== null && ref !== void 0) {
|
|
309
|
-
ref.current = value;
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
function composeRefs(...refs) {
|
|
313
|
-
return (node) => {
|
|
314
|
-
let hasCleanup = false;
|
|
315
|
-
const cleanups = refs.map((ref) => {
|
|
316
|
-
const cleanup = setRef(ref, node);
|
|
317
|
-
if (!hasCleanup && typeof cleanup == "function") {
|
|
318
|
-
hasCleanup = true;
|
|
319
|
-
}
|
|
320
|
-
return cleanup;
|
|
321
|
-
});
|
|
322
|
-
if (hasCleanup) {
|
|
323
|
-
return () => {
|
|
324
|
-
for (let i = 0; i < cleanups.length; i++) {
|
|
325
|
-
const cleanup = cleanups[i];
|
|
326
|
-
if (typeof cleanup == "function") {
|
|
327
|
-
cleanup();
|
|
328
|
-
} else {
|
|
329
|
-
setRef(refs[i], null);
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
};
|
|
333
|
-
}
|
|
334
|
-
};
|
|
335
|
-
}
|
|
336
|
-
function useComposedRefs(...refs) {
|
|
337
|
-
return React12.useCallback(composeRefs(...refs), refs);
|
|
338
|
-
}
|
|
339
239
|
|
|
340
240
|
// src/components/stepper/stepper.utils.tsx
|
|
341
241
|
function focusFirst(candidates, preventScroll = false) {
|
|
@@ -385,32 +285,32 @@ function StepperNav({ className, children, asChild, ref, ...listProps }) {
|
|
|
385
285
|
const context = useStepperContext(STEPPER_NAV_NAME);
|
|
386
286
|
const orientation = context.orientation;
|
|
387
287
|
const currentValue = useStepperStore((state) => state.value);
|
|
388
|
-
const [tabStopId, setTabStopId] =
|
|
389
|
-
const [isTabbingBackOut, setIsTabbingBackOut] =
|
|
390
|
-
const [focusableItemCount, setFocusableItemCount] =
|
|
391
|
-
const isClickFocusRef =
|
|
392
|
-
const itemsRef =
|
|
393
|
-
const listRef =
|
|
288
|
+
const [tabStopId, setTabStopId] = React5.useState(null);
|
|
289
|
+
const [isTabbingBackOut, setIsTabbingBackOut] = React5.useState(false);
|
|
290
|
+
const [focusableItemCount, setFocusableItemCount] = React5.useState(0);
|
|
291
|
+
const isClickFocusRef = React5.useRef(false);
|
|
292
|
+
const itemsRef = React5.useRef(/* @__PURE__ */ new Map());
|
|
293
|
+
const listRef = React5.useRef(null);
|
|
394
294
|
const composedRef = useComposedRefs(ref, listRef);
|
|
395
|
-
const onItemFocus =
|
|
295
|
+
const onItemFocus = React5.useCallback((tabStopId2) => {
|
|
396
296
|
setTabStopId(tabStopId2);
|
|
397
297
|
}, []);
|
|
398
|
-
const onItemShiftTab =
|
|
298
|
+
const onItemShiftTab = React5.useCallback(() => {
|
|
399
299
|
setIsTabbingBackOut(true);
|
|
400
300
|
}, []);
|
|
401
|
-
const onFocusableItemAdd =
|
|
301
|
+
const onFocusableItemAdd = React5.useCallback(() => {
|
|
402
302
|
setFocusableItemCount((prevCount) => prevCount + 1);
|
|
403
303
|
}, []);
|
|
404
|
-
const onFocusableItemRemove =
|
|
304
|
+
const onFocusableItemRemove = React5.useCallback(() => {
|
|
405
305
|
setFocusableItemCount((prevCount) => prevCount - 1);
|
|
406
306
|
}, []);
|
|
407
|
-
const onItemRegister =
|
|
307
|
+
const onItemRegister = React5.useCallback((item) => {
|
|
408
308
|
itemsRef.current.set(item.id, item);
|
|
409
309
|
}, []);
|
|
410
|
-
const onItemUnregister =
|
|
310
|
+
const onItemUnregister = React5.useCallback((id) => {
|
|
411
311
|
itemsRef.current.delete(id);
|
|
412
312
|
}, []);
|
|
413
|
-
const getItems =
|
|
313
|
+
const getItems = React5.useCallback(() => {
|
|
414
314
|
return Array.from(itemsRef.current.values()).filter((item) => item.ref.current).sort((a, b) => {
|
|
415
315
|
const elementA = a.ref.current;
|
|
416
316
|
const elementB = b.ref.current;
|
|
@@ -425,7 +325,7 @@ function StepperNav({ className, children, asChild, ref, ...listProps }) {
|
|
|
425
325
|
return 0;
|
|
426
326
|
});
|
|
427
327
|
}, []);
|
|
428
|
-
const onBlur =
|
|
328
|
+
const onBlur = React5.useCallback(
|
|
429
329
|
(event) => {
|
|
430
330
|
listProps.onBlur?.(event);
|
|
431
331
|
if (event.defaultPrevented) return;
|
|
@@ -433,7 +333,7 @@ function StepperNav({ className, children, asChild, ref, ...listProps }) {
|
|
|
433
333
|
},
|
|
434
334
|
[listProps.onBlur]
|
|
435
335
|
);
|
|
436
|
-
const onFocus =
|
|
336
|
+
const onFocus = React5.useCallback(
|
|
437
337
|
(event) => {
|
|
438
338
|
listProps.onFocus?.(event);
|
|
439
339
|
if (event.defaultPrevented) return;
|
|
@@ -458,7 +358,7 @@ function StepperNav({ className, children, asChild, ref, ...listProps }) {
|
|
|
458
358
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
459
359
|
[listProps.onFocus, isTabbingBackOut, currentValue, tabStopId]
|
|
460
360
|
);
|
|
461
|
-
const onMouseDown =
|
|
361
|
+
const onMouseDown = React5.useCallback(
|
|
462
362
|
(event) => {
|
|
463
363
|
listProps.onMouseDown?.(event);
|
|
464
364
|
if (event.defaultPrevented) return;
|
|
@@ -467,7 +367,7 @@ function StepperNav({ className, children, asChild, ref, ...listProps }) {
|
|
|
467
367
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
468
368
|
[listProps.onMouseDown]
|
|
469
369
|
);
|
|
470
|
-
const focusContextValue =
|
|
370
|
+
const focusContextValue = React5.useMemo(
|
|
471
371
|
() => ({
|
|
472
372
|
tabStopId,
|
|
473
373
|
onItemFocus,
|
|
@@ -513,9 +413,9 @@ function StepperNav({ className, children, asChild, ref, ...listProps }) {
|
|
|
513
413
|
}
|
|
514
414
|
) });
|
|
515
415
|
}
|
|
516
|
-
var StepperItemContext =
|
|
416
|
+
var StepperItemContext = React5.createContext(null);
|
|
517
417
|
function useStepperItemContext(consumerName) {
|
|
518
|
-
const context =
|
|
418
|
+
const context = React5.useContext(StepperItemContext);
|
|
519
419
|
if (!context) {
|
|
520
420
|
throw new Error(`\`${consumerName}\` must be used within \`${STEPPER_ITEM_NAME}\``);
|
|
521
421
|
}
|
|
@@ -546,7 +446,7 @@ function StepperItem({
|
|
|
546
446
|
const stepState = useStepperStore((state) => state.steps.get(itemValue));
|
|
547
447
|
const steps = useStepperStore((state) => state.steps);
|
|
548
448
|
const dataState = getDataState(value, itemValue, stepState, steps);
|
|
549
|
-
const itemContextValue =
|
|
449
|
+
const itemContextValue = React5.useMemo(
|
|
550
450
|
() => ({
|
|
551
451
|
value: itemValue,
|
|
552
452
|
stepState
|
|
@@ -563,7 +463,7 @@ function StepperItem({
|
|
|
563
463
|
"data-slot": "stepper-item",
|
|
564
464
|
dir,
|
|
565
465
|
className: cn(
|
|
566
|
-
"group/step flex flex-1 flex-col justify-end",
|
|
466
|
+
"group/step flex flex-1 flex-col justify-end data-[disabled]:opacity-50",
|
|
567
467
|
"",
|
|
568
468
|
// "group-data-[orientation=horizontal]/stepper-nav:flex-row group-data-[orientation=vertical]/stepper-nav:flex-col",
|
|
569
469
|
className
|
|
@@ -576,8 +476,8 @@ function StepperItem({
|
|
|
576
476
|
{
|
|
577
477
|
"data-state": dataState,
|
|
578
478
|
className: cn(
|
|
579
|
-
"h-1 w-full
|
|
580
|
-
"data-[state=active]:bg-primary
|
|
479
|
+
"bg-border h-1 w-full transition-colors duration-500",
|
|
480
|
+
"data-[state=active]:bg-primary data-[state=completed]:bg-success"
|
|
581
481
|
)
|
|
582
482
|
}
|
|
583
483
|
)
|
|
@@ -608,11 +508,11 @@ function StepperTrigger({ asChild, disabled, className, ref, ...triggerProps })
|
|
|
608
508
|
const isActive = value === itemValue;
|
|
609
509
|
const isTabStop = focusContext.tabStopId === triggerId;
|
|
610
510
|
const dataState = getDataState(value, itemValue, stepState, steps);
|
|
611
|
-
const triggerRef =
|
|
511
|
+
const triggerRef = React5.useRef(null);
|
|
612
512
|
const composedRef = useComposedRefs(ref, triggerRef);
|
|
613
|
-
const isArrowKeyPressedRef =
|
|
614
|
-
const isMouseClickRef =
|
|
615
|
-
|
|
513
|
+
const isArrowKeyPressedRef = React5.useRef(false);
|
|
514
|
+
const isMouseClickRef = React5.useRef(false);
|
|
515
|
+
React5.useEffect(() => {
|
|
616
516
|
function onKeyDown2(event) {
|
|
617
517
|
if (STEPPER_ARROW_KEYS.includes(event.key)) {
|
|
618
518
|
isArrowKeyPressedRef.current = true;
|
|
@@ -646,7 +546,7 @@ function StepperTrigger({ asChild, disabled, className, ref, ...triggerProps })
|
|
|
646
546
|
}
|
|
647
547
|
};
|
|
648
548
|
}, [focusContext, triggerId, itemValue, isTabStop, isDisabled]);
|
|
649
|
-
const onClick =
|
|
549
|
+
const onClick = React5.useCallback(
|
|
650
550
|
async (event) => {
|
|
651
551
|
triggerProps.onClick?.(event);
|
|
652
552
|
if (event.defaultPrevented) return;
|
|
@@ -660,7 +560,7 @@ function StepperTrigger({ asChild, disabled, className, ref, ...triggerProps })
|
|
|
660
560
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
661
561
|
[isDisabled, context.nonInteractive, store, itemValue, value, steps, triggerProps.onClick]
|
|
662
562
|
);
|
|
663
|
-
const onFocus =
|
|
563
|
+
const onFocus = React5.useCallback(
|
|
664
564
|
async (event) => {
|
|
665
565
|
triggerProps.onFocus?.(event);
|
|
666
566
|
if (event.defaultPrevented) return;
|
|
@@ -675,20 +575,20 @@ function StepperTrigger({ asChild, disabled, className, ref, ...triggerProps })
|
|
|
675
575
|
isMouseClickRef.current = false;
|
|
676
576
|
},
|
|
677
577
|
[
|
|
578
|
+
triggerProps,
|
|
678
579
|
focusContext,
|
|
679
580
|
triggerId,
|
|
680
|
-
activationMode,
|
|
681
581
|
isActive,
|
|
682
582
|
isDisabled,
|
|
583
|
+
activationMode,
|
|
683
584
|
context.nonInteractive,
|
|
684
|
-
store,
|
|
685
|
-
itemValue,
|
|
686
|
-
value,
|
|
687
585
|
steps,
|
|
688
|
-
|
|
586
|
+
value,
|
|
587
|
+
itemValue,
|
|
588
|
+
store
|
|
689
589
|
]
|
|
690
590
|
);
|
|
691
|
-
const onKeyDown =
|
|
591
|
+
const onKeyDown = React5.useCallback(
|
|
692
592
|
async (event) => {
|
|
693
593
|
triggerProps.onKeyDown?.(event);
|
|
694
594
|
if (event.defaultPrevented) return;
|
|
@@ -757,7 +657,7 @@ function StepperTrigger({ asChild, disabled, className, ref, ...triggerProps })
|
|
|
757
657
|
steps
|
|
758
658
|
]
|
|
759
659
|
);
|
|
760
|
-
const onMouseDown =
|
|
660
|
+
const onMouseDown = React5.useCallback(
|
|
761
661
|
(event) => {
|
|
762
662
|
triggerProps.onMouseDown?.(event);
|
|
763
663
|
if (event.defaultPrevented) {
|
|
@@ -793,10 +693,9 @@ function StepperTrigger({ asChild, disabled, className, ref, ...triggerProps })
|
|
|
793
693
|
"aria-selected": isActive,
|
|
794
694
|
"aria-setsize": stepCount,
|
|
795
695
|
className: cn(
|
|
796
|
-
"inline-flex w-full cursor-pointer items-center gap-3 rounded text-left transition-colors duration-
|
|
797
|
-
"
|
|
798
|
-
"
|
|
799
|
-
"focus-visible:ring-primary-500/50 focus-visible:z-10 focus-visible:ring-[3px]",
|
|
696
|
+
"inline-flex w-full cursor-pointer items-center gap-3 rounded text-left transition-colors duration-500 outline-none",
|
|
697
|
+
"disabled:pointer-events-none",
|
|
698
|
+
"focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
|
|
800
699
|
className
|
|
801
700
|
),
|
|
802
701
|
onClick,
|
|
@@ -825,9 +724,9 @@ function StepperIndicator({ className, children, asChild, ref, ...props }) {
|
|
|
825
724
|
dir,
|
|
826
725
|
ref,
|
|
827
726
|
className: cn(
|
|
828
|
-
"bg-
|
|
829
|
-
"data-[state=completed]:bg-success
|
|
830
|
-
"data-[state=active]:bg-primary
|
|
727
|
+
"bg-muted border-border text-muted-foreground relative flex size-6 shrink-0 items-center justify-center self-end overflow-hidden rounded-t border-x border-t text-xs transition-colors duration-500",
|
|
728
|
+
"data-[state=completed]:bg-success/50 data-[state=completed]:border-success data-[state=completed]:text-success-foreground",
|
|
729
|
+
"data-[state=active]:bg-primary/50 data-[state=active]:border-primary data-[state=active]:text-primary-foreground",
|
|
831
730
|
className
|
|
832
731
|
),
|
|
833
732
|
...props,
|
|
@@ -862,7 +761,7 @@ function StepperDescription({ className, asChild, ...props }) {
|
|
|
862
761
|
id: descriptionId,
|
|
863
762
|
"data-slot": "stepper-description",
|
|
864
763
|
dir: context.dir,
|
|
865
|
-
className: cn("text-
|
|
764
|
+
className: cn("text-muted-foreground text-sm", className),
|
|
866
765
|
...props
|
|
867
766
|
}
|
|
868
767
|
);
|
|
@@ -919,7 +818,7 @@ function StepperNextTrigger({ asChild = false, onClick, disabled, ...props }) {
|
|
|
919
818
|
const stepKeys = Array.from(steps.keys());
|
|
920
819
|
const currentIndex = value ? stepKeys.indexOf(value) : -1;
|
|
921
820
|
const isDisabled = disabled || currentIndex >= stepKeys.length - 1;
|
|
922
|
-
const handleClick =
|
|
821
|
+
const handleClick = React5.useCallback(
|
|
923
822
|
async (event) => {
|
|
924
823
|
onClick?.(event);
|
|
925
824
|
if (event.defaultPrevented || isDisabled) {
|
|
@@ -952,7 +851,7 @@ function StepperPrevTrigger({ asChild = false, disabled, onClick, ...props }) {
|
|
|
952
851
|
const stepKeys = Array.from(steps.keys());
|
|
953
852
|
const currentIndex = value ? stepKeys.indexOf(value) : -1;
|
|
954
853
|
const isDisabled = disabled || currentIndex <= 0;
|
|
955
|
-
const handleClick =
|
|
854
|
+
const handleClick = React5.useCallback(
|
|
956
855
|
async (event) => {
|
|
957
856
|
onClick?.(event);
|
|
958
857
|
if (event.defaultPrevented || isDisabled) {
|
|
@@ -978,19 +877,117 @@ function StepperPrevTrigger({ asChild = false, disabled, onClick, ...props }) {
|
|
|
978
877
|
}
|
|
979
878
|
);
|
|
980
879
|
}
|
|
981
|
-
var
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
880
|
+
var buttonVariants = cva(
|
|
881
|
+
[
|
|
882
|
+
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded text-sm font-medium transition-all shrink-0 outline-none",
|
|
883
|
+
"disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50",
|
|
884
|
+
"[&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0",
|
|
885
|
+
"focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
|
|
886
|
+
"aria-invalid:ring-error/20 dark:aria-invalid:ring-error/40 aria-invalid:border-error"
|
|
887
|
+
],
|
|
888
|
+
{
|
|
889
|
+
variants: {
|
|
890
|
+
variant: {
|
|
891
|
+
default: "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
892
|
+
error: "bg-error text-white hover:bg-error/90 focus-visible:ring-error/20 dark:focus-visible:ring-error/40 dark:bg-error/60",
|
|
893
|
+
outline: "border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",
|
|
894
|
+
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
895
|
+
ghost: "hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
|
|
896
|
+
link: "text-primary underline-offset-4 hover:underline"
|
|
897
|
+
},
|
|
898
|
+
size: {
|
|
899
|
+
default: "h-9 px-4 py-2 has-[>svg]:px-3",
|
|
900
|
+
sm: "h-8 rounded gap-1.5 px-3 has-[>svg]:px-2.5",
|
|
901
|
+
lg: "h-10 rounded px-6 has-[>svg]:px-4",
|
|
902
|
+
icon: "size-9",
|
|
903
|
+
"icon-sm": "size-8",
|
|
904
|
+
"icon-lg": "size-10"
|
|
905
|
+
},
|
|
906
|
+
fullWidth: {
|
|
907
|
+
true: "w-full"
|
|
908
|
+
}
|
|
909
|
+
},
|
|
910
|
+
defaultVariants: {
|
|
911
|
+
variant: "default",
|
|
912
|
+
size: "default",
|
|
913
|
+
fullWidth: false
|
|
914
|
+
}
|
|
986
915
|
}
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
916
|
+
);
|
|
917
|
+
function Button({
|
|
918
|
+
asChild = false,
|
|
919
|
+
variant = "default",
|
|
920
|
+
disabled = false,
|
|
921
|
+
fullWidth = false,
|
|
922
|
+
loadingPosition: loadingPositionProp = "start",
|
|
923
|
+
children,
|
|
924
|
+
type = "button",
|
|
925
|
+
loading = false,
|
|
926
|
+
size = "default",
|
|
927
|
+
endIcon,
|
|
928
|
+
startIcon,
|
|
929
|
+
className,
|
|
930
|
+
...props
|
|
931
|
+
}) {
|
|
932
|
+
const Comp = asChild ? Slot : "button";
|
|
933
|
+
const isDisabled = disabled || loading;
|
|
934
|
+
const loadingPosition = size?.startsWith("icon") ? "center" : loadingPositionProp;
|
|
935
|
+
return /* @__PURE__ */ jsx(
|
|
936
|
+
Comp,
|
|
937
|
+
{
|
|
938
|
+
"data-slot": "button",
|
|
939
|
+
"aria-disabled": isDisabled || void 0,
|
|
940
|
+
className: cn(buttonVariants({ fullWidth, size, variant }), className),
|
|
941
|
+
"data-state": loading ? "loading" : void 0,
|
|
942
|
+
disabled: isDisabled,
|
|
943
|
+
role: Comp !== "button" ? "button" : void 0,
|
|
944
|
+
tabIndex: isDisabled ? -1 : 0,
|
|
945
|
+
type: Comp === "button" ? type : void 0,
|
|
946
|
+
"data-size": size,
|
|
947
|
+
"data-variant": variant,
|
|
948
|
+
...props,
|
|
949
|
+
children: /* @__PURE__ */ jsx(
|
|
950
|
+
ButtonContent,
|
|
951
|
+
{
|
|
952
|
+
loading,
|
|
953
|
+
size,
|
|
954
|
+
loadingPosition,
|
|
955
|
+
startIcon,
|
|
956
|
+
endIcon,
|
|
957
|
+
asChild,
|
|
958
|
+
children
|
|
959
|
+
}
|
|
960
|
+
)
|
|
961
|
+
}
|
|
962
|
+
);
|
|
963
|
+
}
|
|
964
|
+
function ButtonContent({
|
|
965
|
+
children,
|
|
966
|
+
loading = false,
|
|
967
|
+
loadingPosition = "start",
|
|
968
|
+
startIcon,
|
|
969
|
+
asChild,
|
|
970
|
+
endIcon,
|
|
971
|
+
...props
|
|
972
|
+
}) {
|
|
973
|
+
const isStartLoading = loading && loadingPosition === "start";
|
|
974
|
+
const StartIcon = isStartLoading ? /* @__PURE__ */ jsx(Spinner, { "aria-label": "Loading" }) : startIcon || null;
|
|
975
|
+
const isEndLoading = loading && loadingPosition === "end";
|
|
976
|
+
const EndIcon = isEndLoading ? /* @__PURE__ */ jsx(Spinner, { "aria-label": "Loading" }) : endIcon || null;
|
|
977
|
+
const isCenterLoading = loading && loadingPosition === "center";
|
|
978
|
+
return asChild && React5.isValidElement(children) ? React5.cloneElement(
|
|
979
|
+
children,
|
|
980
|
+
props,
|
|
981
|
+
/* @__PURE__ */ jsxs(React5.Fragment, { children: [
|
|
982
|
+
StartIcon,
|
|
983
|
+
isCenterLoading ? /* @__PURE__ */ jsx(Spinner, { "aria-label": "Loading" }) : React5.isValidElement(children) ? children.props?.children : null,
|
|
984
|
+
EndIcon
|
|
985
|
+
] })
|
|
986
|
+
) : /* @__PURE__ */ jsxs(React5.Fragment, { children: [
|
|
987
|
+
StartIcon,
|
|
988
|
+
isCenterLoading ? /* @__PURE__ */ jsx(Spinner, { "aria-label": "Loading" }) : children,
|
|
989
|
+
EndIcon
|
|
990
|
+
] });
|
|
991
|
+
}
|
|
995
992
|
|
|
996
|
-
export {
|
|
993
|
+
export { Button, Stepper, StepperActivationMode, StepperContent, StepperDataState, StepperDescription, StepperFocusIntent, StepperIndicator, StepperItem, StepperNav, StepperNavigationDirection, StepperNextTrigger, StepperOrientation, StepperPanel, StepperPrevTrigger, StepperTitle, StepperTrigger, useStepperContext, useStepperFocusContext, useStepperItemContext };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkH2BWO3SI_cjs = require('./chunk-H2BWO3SI.cjs');
|
|
4
|
+
var lucideReact = require('lucide-react');
|
|
5
|
+
var radixUi = require('radix-ui');
|
|
6
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
7
|
+
|
|
8
|
+
function Checkbox({ className, ...props }) {
|
|
9
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
10
|
+
radixUi.Checkbox.Root,
|
|
11
|
+
{
|
|
12
|
+
"data-slot": "checkbox",
|
|
13
|
+
className: chunkH2BWO3SI_cjs.cn(
|
|
14
|
+
"peer border-input dark:bg-input/30 size-4 shrink-0 rounded border shadow-xs transition-shadow outline-none",
|
|
15
|
+
"data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground data-[state=checked]:border-primary",
|
|
16
|
+
"aria-invalid:ring-error/20 dark:aria-invalid:ring-error/40 aria-invalid:border-error",
|
|
17
|
+
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
18
|
+
"focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]",
|
|
19
|
+
className
|
|
20
|
+
),
|
|
21
|
+
...props,
|
|
22
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
23
|
+
radixUi.Checkbox.Indicator,
|
|
24
|
+
{
|
|
25
|
+
"data-slot": "checkbox-indicator",
|
|
26
|
+
className: "grid place-content-center text-current transition-none",
|
|
27
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.CheckIcon, { className: "size-3.5" })
|
|
28
|
+
}
|
|
29
|
+
)
|
|
30
|
+
}
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
exports.Checkbox = Checkbox;
|