erp-pro-ui 0.1.2 → 0.1.3
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/calendar.cjs +1 -1
- package/dist/calendar.mjs +1 -1
- package/dist/card.cjs +1 -1
- package/dist/card.mjs +1 -1
- package/dist/carousel.cjs +1 -1
- package/dist/carousel.mjs +1 -1
- package/dist/catalog.cjs +6 -0
- package/dist/catalog.cjs.map +1 -1
- package/dist/catalog.d.ts +11 -1
- package/dist/catalog.d.ts.map +1 -1
- package/dist/catalog.mjs +6 -0
- package/dist/catalog.mjs.map +1 -1
- package/dist/charts.cjs +2 -1
- package/dist/charts.mjs +2 -2
- package/dist/checkbox.cjs +1 -1
- package/dist/checkbox.mjs +1 -1
- package/dist/chip.cjs +1 -1
- package/dist/chip.mjs +1 -1
- package/dist/chroma-grid.cjs +1 -1
- package/dist/chroma-grid.mjs +1 -1
- package/dist/chunks/{calendar-xrGmvukr.cjs → calendar-Cpp_Rc7T.cjs} +58 -17
- package/dist/chunks/calendar-Cpp_Rc7T.cjs.map +1 -0
- package/dist/chunks/{calendar-BarcG6x_.mjs → calendar-DrCgT_pj.mjs} +58 -17
- package/dist/chunks/calendar-DrCgT_pj.mjs.map +1 -0
- package/dist/chunks/{card-gt-HZh0h.cjs → card-C5_tFK6Q.cjs} +1 -1
- package/dist/chunks/{card-gt-HZh0h.cjs.map → card-C5_tFK6Q.cjs.map} +1 -1
- package/dist/chunks/{card-CcIF6z2H.mjs → card-Dh8wNv8N.mjs} +1 -1
- package/dist/chunks/{card-CcIF6z2H.mjs.map → card-Dh8wNv8N.mjs.map} +1 -1
- package/dist/chunks/{carousel-DJdqBVRK.mjs → carousel-BYwqI4cA.mjs} +1 -1
- package/dist/chunks/{carousel-DJdqBVRK.mjs.map → carousel-BYwqI4cA.mjs.map} +1 -1
- package/dist/chunks/{carousel-Cq5uwqQt.cjs → carousel-C1338X8h.cjs} +1 -1
- package/dist/chunks/{carousel-Cq5uwqQt.cjs.map → carousel-C1338X8h.cjs.map} +1 -1
- package/dist/chunks/{charts-DugYWvEf.mjs → charts-BYvM4TMG.mjs} +371 -117
- package/dist/chunks/charts-BYvM4TMG.mjs.map +1 -0
- package/dist/chunks/{charts-BpElnsoR.cjs → charts-DbxyHtlX.cjs} +375 -115
- package/dist/chunks/charts-DbxyHtlX.cjs.map +1 -0
- package/dist/chunks/{checkbox-yHuSw-hV.cjs → checkbox-CxOcjoGP.cjs} +1 -1
- package/dist/chunks/{checkbox-yHuSw-hV.cjs.map → checkbox-CxOcjoGP.cjs.map} +1 -1
- package/dist/chunks/{checkbox-DvwlGwWe.mjs → checkbox-Pr49U9F1.mjs} +1 -1
- package/dist/chunks/{checkbox-DvwlGwWe.mjs.map → checkbox-Pr49U9F1.mjs.map} +1 -1
- package/dist/chunks/{chip-DcBji__g.cjs → chip-B4ol1yPk.cjs} +1 -1
- package/dist/chunks/{chip-DcBji__g.cjs.map → chip-B4ol1yPk.cjs.map} +1 -1
- package/dist/chunks/{chip-BGSUmnlO.mjs → chip-DdnBLdpl.mjs} +1 -1
- package/dist/chunks/{chip-BGSUmnlO.mjs.map → chip-DdnBLdpl.mjs.map} +1 -1
- package/dist/chunks/{chroma-grid-Cdeql_2C.mjs → chroma-grid-BAo6V5A7.mjs} +1 -1
- package/dist/chunks/{chroma-grid-Cdeql_2C.mjs.map → chroma-grid-BAo6V5A7.mjs.map} +1 -1
- package/dist/chunks/{chroma-grid-9E9j1s9I.cjs → chroma-grid-CIk0dsNS.cjs} +1 -1
- package/dist/chunks/{chroma-grid-9E9j1s9I.cjs.map → chroma-grid-CIk0dsNS.cjs.map} +1 -1
- package/dist/chunks/{color-palette-BLvDnCOD.cjs → color-palette-2TuEMkAn.cjs} +1 -1
- package/dist/chunks/{color-palette-BLvDnCOD.cjs.map → color-palette-2TuEMkAn.cjs.map} +1 -1
- package/dist/chunks/{color-palette-CXlCDiZz.mjs → color-palette-euKQMWlV.mjs} +1 -1
- package/dist/chunks/{color-palette-CXlCDiZz.mjs.map → color-palette-euKQMWlV.mjs.map} +1 -1
- package/dist/chunks/{combobox-BXu3s0dt.cjs → combobox-CwGubKTt.cjs} +2 -2
- package/dist/chunks/combobox-CwGubKTt.cjs.map +1 -0
- package/dist/chunks/{combobox-CjK-qG4k.mjs → combobox-DrFmkI0F.mjs} +2 -2
- package/dist/chunks/combobox-DrFmkI0F.mjs.map +1 -0
- package/dist/chunks/{data-table-DyEQn9Yj.mjs → data-table-Bo80m7qV.mjs} +8 -8
- package/dist/chunks/{data-table-DyEQn9Yj.mjs.map → data-table-Bo80m7qV.mjs.map} +1 -1
- package/dist/chunks/{data-table-9HELVsYR.cjs → data-table-W1sK5tkL.cjs} +8 -8
- package/dist/chunks/{data-table-9HELVsYR.cjs.map → data-table-W1sK5tkL.cjs.map} +1 -1
- package/dist/chunks/{date-picker-D8gaaMlJ.mjs → date-picker-CNPORxhv.mjs} +87 -17
- package/dist/chunks/date-picker-CNPORxhv.mjs.map +1 -0
- package/dist/chunks/{date-picker-W9om1j7A.cjs → date-picker-CZo68Fkl.cjs} +87 -17
- package/dist/chunks/date-picker-CZo68Fkl.cjs.map +1 -0
- package/dist/chunks/input-BWM6G7jq.cjs +117 -0
- package/dist/chunks/input-BWM6G7jq.cjs.map +1 -0
- package/dist/chunks/input-Bt_r_B_c.mjs +105 -0
- package/dist/chunks/input-Bt_r_B_c.mjs.map +1 -0
- package/dist/chunks/{multi-select-combobox-ELSH_Xr4.mjs → multi-select-combobox-D46M-AN9.mjs} +2 -2
- package/dist/chunks/multi-select-combobox-D46M-AN9.mjs.map +1 -0
- package/dist/chunks/{multi-select-combobox-UW0X15W7.cjs → multi-select-combobox-dS6bJE_e.cjs} +2 -2
- package/dist/chunks/multi-select-combobox-dS6bJE_e.cjs.map +1 -0
- package/dist/chunks/{otp-input-B6zzOEqw.cjs → otp-input-DSW9Ca_D.cjs} +2 -2
- package/dist/chunks/otp-input-DSW9Ca_D.cjs.map +1 -0
- package/dist/chunks/{otp-input-Bg4nQG6x.mjs → otp-input-DeAi4nJ_.mjs} +2 -2
- package/dist/chunks/otp-input-DeAi4nJ_.mjs.map +1 -0
- package/dist/chunks/{progress-bar-C9FZDrju.mjs → progress-bar-B9sy7WBT.mjs} +1 -1
- package/dist/chunks/{progress-bar-C9FZDrju.mjs.map → progress-bar-B9sy7WBT.mjs.map} +1 -1
- package/dist/chunks/{progress-bar-C1OvQ-NI.cjs → progress-bar-BdvQtpm3.cjs} +1 -1
- package/dist/chunks/{progress-bar-C1OvQ-NI.cjs.map → progress-bar-BdvQtpm3.cjs.map} +1 -1
- package/dist/chunks/select-B8UQ6Uq5.mjs +170 -0
- package/dist/chunks/select-B8UQ6Uq5.mjs.map +1 -0
- package/dist/chunks/select-CCUSMvfS.cjs +176 -0
- package/dist/chunks/select-CCUSMvfS.cjs.map +1 -0
- package/dist/chunks/stepper-D6qQbZdg.cjs +642 -0
- package/dist/chunks/stepper-D6qQbZdg.cjs.map +1 -0
- package/dist/chunks/stepper-DUknuW2E.mjs +618 -0
- package/dist/chunks/stepper-DUknuW2E.mjs.map +1 -0
- package/dist/chunks/{textarea-CU5C-Zw9.mjs → textarea-Blky_fLK.mjs} +2 -2
- package/dist/chunks/{textarea-CU5C-Zw9.mjs.map → textarea-Blky_fLK.mjs.map} +1 -1
- package/dist/chunks/{textarea-CAUsyu4-.cjs → textarea-ok_NlE2p.cjs} +2 -2
- package/dist/chunks/textarea-ok_NlE2p.cjs.map +1 -0
- package/dist/color-palette.cjs +1 -1
- package/dist/color-palette.mjs +1 -1
- package/dist/colors.css +3 -0
- package/dist/combobox.cjs +1 -1
- package/dist/combobox.mjs +1 -1
- package/dist/components/data-display/charts/AreaChart.d.ts.map +1 -1
- package/dist/components/data-display/charts/BarChart.d.ts +1 -0
- package/dist/components/data-display/charts/BarChart.d.ts.map +1 -1
- package/dist/components/data-display/charts/NeonLineChart.d.ts.map +1 -1
- package/dist/components/data-display/charts/PieChart.d.ts +18 -2
- package/dist/components/data-display/charts/PieChart.d.ts.map +1 -1
- package/dist/components/data-display/charts/PositiveNegativeBarChart.d.ts +21 -0
- package/dist/components/data-display/charts/PositiveNegativeBarChart.d.ts.map +1 -0
- package/dist/components/data-display/charts/StackedBarChart.d.ts.map +1 -1
- package/dist/components/data-display/charts/ThinBreakdownBar.d.ts +3 -0
- package/dist/components/data-display/charts/ThinBreakdownBar.d.ts.map +1 -1
- package/dist/components/data-display/charts/chartStyles.d.ts +24 -0
- package/dist/components/data-display/charts/chartStyles.d.ts.map +1 -0
- package/dist/components/data-display/charts/index.d.ts +2 -0
- package/dist/components/data-display/charts/index.d.ts.map +1 -1
- package/dist/components/forms/calendar/Calendar.d.ts.map +1 -1
- package/dist/components/forms/date-picker/DatePicker.d.ts.map +1 -1
- package/dist/components/forms/input/Input.d.ts.map +1 -1
- package/dist/components/forms/input/types.d.ts +5 -0
- package/dist/components/forms/input/types.d.ts.map +1 -1
- package/dist/components/forms/select/Select.d.ts.map +1 -1
- package/dist/components/forms/select/types.d.ts +7 -1
- package/dist/components/forms/select/types.d.ts.map +1 -1
- package/dist/components/navigation/stepper/Stepper1.d.ts +4 -0
- package/dist/components/navigation/stepper/Stepper1.d.ts.map +1 -0
- package/dist/components/navigation/stepper/Stepper2.d.ts +5 -0
- package/dist/components/navigation/stepper/Stepper2.d.ts.map +1 -0
- package/dist/components/navigation/stepper/index.d.ts +4 -1
- package/dist/components/navigation/stepper/index.d.ts.map +1 -1
- package/dist/components/navigation/stepper/types.d.ts +85 -0
- package/dist/components/navigation/stepper/types.d.ts.map +1 -1
- package/dist/data-table.cjs +1 -1
- package/dist/data-table.mjs +1 -1
- package/dist/date-picker.cjs +1 -1
- package/dist/date-picker.mjs +1 -1
- package/dist/docs.cjs +10 -0
- package/dist/docs.cjs.map +1 -1
- package/dist/docs.d.ts.map +1 -1
- package/dist/docs.mjs +10 -0
- package/dist/docs.mjs.map +1 -1
- package/dist/foundation.css +7 -0
- package/dist/index.cjs +23 -18
- package/dist/index.d.ts +5 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +19 -19
- package/dist/input.cjs +1 -1
- package/dist/input.mjs +1 -1
- package/dist/multi-select-combobox.cjs +1 -1
- package/dist/multi-select-combobox.mjs +1 -1
- package/dist/otp-input.cjs +1 -1
- package/dist/otp-input.mjs +1 -1
- package/dist/progress-bar.cjs +1 -1
- package/dist/progress-bar.mjs +1 -1
- package/dist/select.cjs +1 -1
- package/dist/select.mjs +1 -1
- package/dist/stepper.cjs +5 -1
- package/dist/stepper.mjs +2 -2
- package/dist/textarea.cjs +1 -1
- package/dist/textarea.mjs +1 -1
- package/dist/tokens.css +11 -2
- package/package.json +4 -4
- package/dist/chunks/calendar-BarcG6x_.mjs.map +0 -1
- package/dist/chunks/calendar-xrGmvukr.cjs.map +0 -1
- package/dist/chunks/charts-BpElnsoR.cjs.map +0 -1
- package/dist/chunks/charts-DugYWvEf.mjs.map +0 -1
- package/dist/chunks/combobox-BXu3s0dt.cjs.map +0 -1
- package/dist/chunks/combobox-CjK-qG4k.mjs.map +0 -1
- package/dist/chunks/date-picker-D8gaaMlJ.mjs.map +0 -1
- package/dist/chunks/date-picker-W9om1j7A.cjs.map +0 -1
- package/dist/chunks/input-D9qZNqXV.cjs +0 -99
- package/dist/chunks/input-D9qZNqXV.cjs.map +0 -1
- package/dist/chunks/input-wNqevfQ4.mjs +0 -87
- package/dist/chunks/input-wNqevfQ4.mjs.map +0 -1
- package/dist/chunks/multi-select-combobox-ELSH_Xr4.mjs.map +0 -1
- package/dist/chunks/multi-select-combobox-UW0X15W7.cjs.map +0 -1
- package/dist/chunks/otp-input-B6zzOEqw.cjs.map +0 -1
- package/dist/chunks/otp-input-Bg4nQG6x.mjs.map +0 -1
- package/dist/chunks/select-D71tk6-I.mjs +0 -152
- package/dist/chunks/select-D71tk6-I.mjs.map +0 -1
- package/dist/chunks/select-WC_kPqUP.cjs +0 -158
- package/dist/chunks/select-WC_kPqUP.cjs.map +0 -1
- package/dist/chunks/stepper-D4yQsQB0.mjs +0 -261
- package/dist/chunks/stepper-D4yQsQB0.mjs.map +0 -1
- package/dist/chunks/stepper-fY-Sx72k.cjs +0 -267
- package/dist/chunks/stepper-fY-Sx72k.cjs.map +0 -1
- package/dist/chunks/textarea-CAUsyu4-.cjs.map +0 -1
|
@@ -0,0 +1,642 @@
|
|
|
1
|
+
require("./chunk-B_GkZjkl.cjs");
|
|
2
|
+
const require_utils = require("./utils-B4SmmY4J.cjs");
|
|
3
|
+
const require_icons = require("./icons-BxIzP2jd.cjs");
|
|
4
|
+
const require_button = require("./button-CZL6kFzT.cjs");
|
|
5
|
+
let react = require("react");
|
|
6
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
7
|
+
let framer_motion = require("framer-motion");
|
|
8
|
+
//#region src/components/navigation/stepper/Stepper.tsx
|
|
9
|
+
var sizeConfig = {
|
|
10
|
+
sm: {
|
|
11
|
+
indicator: "w-8 h-8",
|
|
12
|
+
icon: "w-4 h-4",
|
|
13
|
+
text: "text-xs",
|
|
14
|
+
connectorThickness: "2px"
|
|
15
|
+
},
|
|
16
|
+
md: {
|
|
17
|
+
indicator: "w-10 h-10",
|
|
18
|
+
icon: "w-5 h-5",
|
|
19
|
+
text: "text-sm",
|
|
20
|
+
connectorThickness: "2px"
|
|
21
|
+
},
|
|
22
|
+
lg: {
|
|
23
|
+
indicator: "w-12 h-12",
|
|
24
|
+
icon: "w-6 h-6",
|
|
25
|
+
text: "text-base",
|
|
26
|
+
connectorThickness: "4px"
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
var getVariantStyles = (variant, status) => {
|
|
30
|
+
return {
|
|
31
|
+
default: {
|
|
32
|
+
completed: "bg-accent text-on-accent shadow-md shadow-accent/25",
|
|
33
|
+
current: "bg-accent text-on-accent ring-4 ring-focus/40 shadow-lg shadow-accent/30",
|
|
34
|
+
upcoming: "bg-neutral-200 text-neutral-500 dark:bg-neutral-700 dark:text-neutral-400",
|
|
35
|
+
error: "bg-red-500 text-white ring-4 ring-red-500/30"
|
|
36
|
+
},
|
|
37
|
+
glass: {
|
|
38
|
+
completed: "bg-accent/85 text-on-accent backdrop-blur-xl border border-accent/30 shadow-lg shadow-accent/20",
|
|
39
|
+
current: "bg-accent/90 text-on-accent backdrop-blur-xl border-2 border-accent ring-4 ring-focus/30 shadow-xl shadow-accent/30",
|
|
40
|
+
upcoming: "bg-white/60 text-neutral-500 backdrop-blur-xl border border-white/40 dark:bg-neutral-800/60 dark:text-neutral-400 dark:border-white/10",
|
|
41
|
+
error: "bg-red-500/80 text-white backdrop-blur-xl border border-red-400/30 ring-4 ring-red-500/20"
|
|
42
|
+
},
|
|
43
|
+
minimal: {
|
|
44
|
+
completed: "bg-accent-subtle text-accent",
|
|
45
|
+
current: "bg-accent text-on-accent shadow-sm",
|
|
46
|
+
upcoming: "bg-transparent text-neutral-400 border-2 border-neutral-300 dark:border-neutral-600",
|
|
47
|
+
error: "bg-red-100 text-red-500 dark:bg-red-900/30"
|
|
48
|
+
},
|
|
49
|
+
outlined: {
|
|
50
|
+
completed: "bg-transparent text-accent border-2 border-accent",
|
|
51
|
+
current: "bg-accent text-on-accent border-2 border-accent shadow-lg",
|
|
52
|
+
upcoming: "bg-transparent text-neutral-400 border-2 border-neutral-300 dark:border-neutral-600",
|
|
53
|
+
error: "bg-transparent text-red-500 border-2 border-red-500"
|
|
54
|
+
}
|
|
55
|
+
}[variant][status];
|
|
56
|
+
};
|
|
57
|
+
var StepIndicator = ({ step, index, status, size, variant, showNumbers, animated, colors }) => {
|
|
58
|
+
const config = sizeConfig[size];
|
|
59
|
+
const variantStyles = getVariantStyles(variant, status);
|
|
60
|
+
const customColorStyle = colors?.[status] ? {
|
|
61
|
+
backgroundColor: colors[status],
|
|
62
|
+
borderColor: colors[status]
|
|
63
|
+
} : void 0;
|
|
64
|
+
const renderContent = () => {
|
|
65
|
+
if (step.icon) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
66
|
+
className: config.icon,
|
|
67
|
+
children: step.icon
|
|
68
|
+
});
|
|
69
|
+
if (status === "completed") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_icons.CheckIcon, {
|
|
70
|
+
className: config.icon,
|
|
71
|
+
"aria-hidden": "true"
|
|
72
|
+
});
|
|
73
|
+
if (status === "error") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_icons.CloseIcon, {
|
|
74
|
+
className: config.icon,
|
|
75
|
+
"aria-hidden": "true"
|
|
76
|
+
});
|
|
77
|
+
if (showNumbers) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
78
|
+
className: "font-semibold",
|
|
79
|
+
children: index + 1
|
|
80
|
+
});
|
|
81
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: require_utils.mergeClassNames("rounded-full bg-current", size === "sm" ? "w-2 h-2" : "w-3 h-3") });
|
|
82
|
+
};
|
|
83
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(framer_motion.motion.div, {
|
|
84
|
+
className: require_utils.mergeClassNames("rounded-full flex items-center justify-center transition-all duration-300", config.indicator, variantStyles),
|
|
85
|
+
style: customColorStyle,
|
|
86
|
+
initial: animated ? {
|
|
87
|
+
scale: .8,
|
|
88
|
+
opacity: 0
|
|
89
|
+
} : void 0,
|
|
90
|
+
animate: animated ? {
|
|
91
|
+
scale: 1,
|
|
92
|
+
opacity: 1
|
|
93
|
+
} : void 0,
|
|
94
|
+
whileHover: { scale: 1.05 },
|
|
95
|
+
whileTap: { scale: .95 },
|
|
96
|
+
transition: {
|
|
97
|
+
type: "spring",
|
|
98
|
+
stiffness: 400,
|
|
99
|
+
damping: 17
|
|
100
|
+
},
|
|
101
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(framer_motion.AnimatePresence, {
|
|
102
|
+
mode: "wait",
|
|
103
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(framer_motion.motion.span, {
|
|
104
|
+
initial: animated ? {
|
|
105
|
+
scale: 0,
|
|
106
|
+
rotate: -180
|
|
107
|
+
} : void 0,
|
|
108
|
+
animate: animated ? {
|
|
109
|
+
scale: 1,
|
|
110
|
+
rotate: 0
|
|
111
|
+
} : void 0,
|
|
112
|
+
exit: animated ? {
|
|
113
|
+
scale: 0,
|
|
114
|
+
rotate: 180
|
|
115
|
+
} : void 0,
|
|
116
|
+
transition: { duration: .2 },
|
|
117
|
+
children: renderContent()
|
|
118
|
+
}, status)
|
|
119
|
+
})
|
|
120
|
+
});
|
|
121
|
+
};
|
|
122
|
+
var Stepper = ({ steps, currentStep, onStepClick, orientation = "horizontal", size = "md", variant = "glass", showNumbers = true, clickable = true, showConnector = true, className, connectorClassName, stepClassName, showErrors = false, errorSteps = [], completedSteps, animated = true, colors }) => {
|
|
123
|
+
const isVertical = orientation === "vertical";
|
|
124
|
+
const config = sizeConfig[size];
|
|
125
|
+
const getStepStatus = (index) => {
|
|
126
|
+
if (showErrors && errorSteps.includes(index)) return "error";
|
|
127
|
+
if (completedSteps) {
|
|
128
|
+
if (completedSteps.includes(index)) return "completed";
|
|
129
|
+
if (index === currentStep) return "current";
|
|
130
|
+
return "upcoming";
|
|
131
|
+
}
|
|
132
|
+
if (index < currentStep) return "completed";
|
|
133
|
+
if (index === currentStep) return "current";
|
|
134
|
+
return "upcoming";
|
|
135
|
+
};
|
|
136
|
+
const handleStepClick = (index) => {
|
|
137
|
+
if (!clickable || !onStepClick) return;
|
|
138
|
+
if (steps[index].disabled) return;
|
|
139
|
+
const status = getStepStatus(index);
|
|
140
|
+
if (status === "completed" || status === "current") onStepClick(index);
|
|
141
|
+
};
|
|
142
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
143
|
+
className: require_utils.mergeClassNames("w-full relative", isVertical ? "flex flex-col" : "flex items-start justify-between", className),
|
|
144
|
+
children: [showConnector && (() => {
|
|
145
|
+
const paddingValue = variant === "glass" || variant === "outlined" || variant === "minimal" ? 4 : 2;
|
|
146
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
147
|
+
className: require_utils.mergeClassNames("absolute rounded-full", variant === "glass" ? "bg-white/30 dark:bg-white/10 backdrop-blur-sm" : "bg-neutral-200 dark:bg-neutral-700", connectorClassName),
|
|
148
|
+
style: { ...isVertical ? {
|
|
149
|
+
top: "0",
|
|
150
|
+
bottom: "0",
|
|
151
|
+
left: `calc(${paddingValue}px + 1px + ${config.indicator.split(" ")[0].replace("w-", "")} * 0.125rem - ${config.connectorThickness} / 2)`,
|
|
152
|
+
width: config.connectorThickness
|
|
153
|
+
} : {
|
|
154
|
+
left: "0",
|
|
155
|
+
right: "0",
|
|
156
|
+
top: `calc(${paddingValue}px + 1px + ${config.indicator.split(" ")[1].replace("h-", "")} * 0.125rem - ${config.connectorThickness} / 2)`,
|
|
157
|
+
height: config.connectorThickness
|
|
158
|
+
} },
|
|
159
|
+
children: animated ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(framer_motion.motion.div, {
|
|
160
|
+
className: "absolute top-0 left-0 bg-accent rounded-full",
|
|
161
|
+
initial: { [isVertical ? "height" : "width"]: 0 },
|
|
162
|
+
animate: { [isVertical ? "height" : "width"]: `${steps.length > 1 ? Math.min(currentStep, steps.length - 1) / (steps.length - 1) * 100 : 0}%` },
|
|
163
|
+
transition: {
|
|
164
|
+
duration: .4,
|
|
165
|
+
ease: "easeOut"
|
|
166
|
+
},
|
|
167
|
+
style: {
|
|
168
|
+
...isVertical ? { width: "100%" } : { height: "100%" },
|
|
169
|
+
backgroundColor: colors?.connector || colors?.completed
|
|
170
|
+
}
|
|
171
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
172
|
+
className: "absolute top-0 left-0 bg-accent rounded-full",
|
|
173
|
+
style: {
|
|
174
|
+
...isVertical ? {
|
|
175
|
+
width: "100%",
|
|
176
|
+
height: `${steps.length > 1 ? Math.min(currentStep, steps.length - 1) / (steps.length - 1) * 100 : 0}%`
|
|
177
|
+
} : {
|
|
178
|
+
height: "100%",
|
|
179
|
+
width: `${steps.length > 1 ? Math.min(currentStep, steps.length - 1) / (steps.length - 1) * 100 : 0}%`
|
|
180
|
+
},
|
|
181
|
+
backgroundColor: colors?.connector || colors?.completed
|
|
182
|
+
}
|
|
183
|
+
})
|
|
184
|
+
});
|
|
185
|
+
})(), steps.map((step, index) => {
|
|
186
|
+
const status = getStepStatus(index);
|
|
187
|
+
const isLast = index === steps.length - 1;
|
|
188
|
+
const isClickable = clickable && !step.disabled;
|
|
189
|
+
const paddingValue = variant === "glass" || variant === "outlined" || variant === "minimal" ? 4 : 2;
|
|
190
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
191
|
+
className: require_utils.mergeClassNames("relative z-10", isVertical ? "flex gap-4 pb-8" : "flex flex-1 flex-col items-center", !isLast && isVertical && "mb-2", isVertical && isLast && "pb-0", stepClassName),
|
|
192
|
+
style: { ...!isVertical ? {
|
|
193
|
+
flexBasis: 0,
|
|
194
|
+
flexGrow: 1,
|
|
195
|
+
alignItems: index === 0 ? "flex-start" : isLast ? "flex-end" : "center"
|
|
196
|
+
} : {} },
|
|
197
|
+
children: [
|
|
198
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
199
|
+
type: "button",
|
|
200
|
+
onClick: () => handleStepClick(index),
|
|
201
|
+
disabled: !isClickable,
|
|
202
|
+
className: require_utils.mergeClassNames("relative z-10 shrink-0 flex items-center justify-center bg-white dark:bg-neutral-900 rounded-full", isClickable ? "cursor-pointer" : "cursor-default", !isVertical && index === 0 && "mx-0", !isVertical && isLast && "mx-0"),
|
|
203
|
+
style: { padding: `${paddingValue}px` },
|
|
204
|
+
"aria-current": status === "current" ? "step" : void 0,
|
|
205
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(StepIndicator, {
|
|
206
|
+
step,
|
|
207
|
+
index,
|
|
208
|
+
status,
|
|
209
|
+
size,
|
|
210
|
+
variant,
|
|
211
|
+
showNumbers,
|
|
212
|
+
animated,
|
|
213
|
+
colors
|
|
214
|
+
})
|
|
215
|
+
}),
|
|
216
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(framer_motion.motion.div, {
|
|
217
|
+
className: require_utils.mergeClassNames("mt-2", isVertical ? "flex-1 pb-6" : "text-center px-2", !isVertical && index === 0 && "text-left px-0", !isVertical && isLast && "text-right px-0", isVertical && isLast && "pb-0"),
|
|
218
|
+
style: isVertical ? { marginTop: "-4px" } : void 0,
|
|
219
|
+
initial: animated ? {
|
|
220
|
+
opacity: 0,
|
|
221
|
+
y: 10
|
|
222
|
+
} : void 0,
|
|
223
|
+
animate: animated ? {
|
|
224
|
+
opacity: 1,
|
|
225
|
+
y: 0
|
|
226
|
+
} : void 0,
|
|
227
|
+
transition: { delay: index * .1 },
|
|
228
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("p", {
|
|
229
|
+
className: require_utils.mergeClassNames("font-medium transition-colors duration-200", config.text, status === "current" ? "text-accent" : status === "completed" ? "text-neutral-700 dark:text-neutral-200" : status === "error" ? "text-red-500" : "text-neutral-500 dark:text-neutral-400"),
|
|
230
|
+
children: [step.title, step.optional && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
231
|
+
className: "ml-1 text-neutral-400 dark:text-neutral-500 font-normal",
|
|
232
|
+
children: "(Optional)"
|
|
233
|
+
})]
|
|
234
|
+
}), step.description && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
235
|
+
className: require_utils.mergeClassNames("mt-0.5 text-neutral-500 dark:text-neutral-400", size === "sm" ? "text-xs" : "text-xs"),
|
|
236
|
+
children: step.description
|
|
237
|
+
})]
|
|
238
|
+
}),
|
|
239
|
+
isVertical && step.content && status === "current" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(framer_motion.motion.div, {
|
|
240
|
+
initial: {
|
|
241
|
+
opacity: 0,
|
|
242
|
+
height: 0
|
|
243
|
+
},
|
|
244
|
+
animate: {
|
|
245
|
+
opacity: 1,
|
|
246
|
+
height: "auto"
|
|
247
|
+
},
|
|
248
|
+
exit: {
|
|
249
|
+
opacity: 0,
|
|
250
|
+
height: 0
|
|
251
|
+
},
|
|
252
|
+
className: "pl-14 pb-4 w-full",
|
|
253
|
+
children: step.content
|
|
254
|
+
})
|
|
255
|
+
]
|
|
256
|
+
}, step.id);
|
|
257
|
+
})]
|
|
258
|
+
});
|
|
259
|
+
};
|
|
260
|
+
Stepper.displayName = "Stepper";
|
|
261
|
+
//#endregion
|
|
262
|
+
//#region src/components/navigation/stepper/Stepper1.tsx
|
|
263
|
+
var DEFAULT_BREAKPOINT = 1080;
|
|
264
|
+
function subscribeToMediaQuery(query, onStoreChange) {
|
|
265
|
+
if (typeof window === "undefined") return () => void 0;
|
|
266
|
+
const mediaQuery = window.matchMedia(query);
|
|
267
|
+
mediaQuery.addEventListener("change", onStoreChange);
|
|
268
|
+
return () => mediaQuery.removeEventListener("change", onStoreChange);
|
|
269
|
+
}
|
|
270
|
+
function getMediaQuerySnapshot(query) {
|
|
271
|
+
if (typeof window === "undefined") return false;
|
|
272
|
+
return window.matchMedia(query).matches;
|
|
273
|
+
}
|
|
274
|
+
function getStepColors(state, isActive) {
|
|
275
|
+
if (isActive) return {
|
|
276
|
+
buttonClassName: "border-accent bg-accent/12 text-accent shadow-sm shadow-accent/10",
|
|
277
|
+
connectorClassName: "bg-accent",
|
|
278
|
+
badgeClassName: "border-accent bg-accent text-on-accent"
|
|
279
|
+
};
|
|
280
|
+
if (state === "valid") return {
|
|
281
|
+
buttonClassName: "border-success bg-success/10 text-success shadow-sm shadow-success/10",
|
|
282
|
+
connectorClassName: "bg-success",
|
|
283
|
+
badgeClassName: "border-success bg-success text-on-accent"
|
|
284
|
+
};
|
|
285
|
+
if (state === "invalid") return {
|
|
286
|
+
buttonClassName: "border-red-500 bg-red-500/10 text-red-600 dark:text-red-300",
|
|
287
|
+
connectorClassName: "bg-red-500",
|
|
288
|
+
badgeClassName: "border-red-500 bg-red-500 text-white"
|
|
289
|
+
};
|
|
290
|
+
return {
|
|
291
|
+
buttonClassName: "border-border bg-surface text-muted-foreground hover:border-border-strong hover:bg-canvas",
|
|
292
|
+
connectorClassName: "bg-border-strong/70",
|
|
293
|
+
badgeClassName: "border-border bg-background text-muted-foreground"
|
|
294
|
+
};
|
|
295
|
+
}
|
|
296
|
+
function renderStepContent(label, icon, state, stepNumber, badgeClassName) {
|
|
297
|
+
if (state === "valid") return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
298
|
+
className: "flex items-center gap-2",
|
|
299
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_icons.CheckIcon, {
|
|
300
|
+
className: "h-5 w-5",
|
|
301
|
+
"aria-hidden": "true"
|
|
302
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
303
|
+
className: "truncate",
|
|
304
|
+
children: label
|
|
305
|
+
})]
|
|
306
|
+
});
|
|
307
|
+
if (state === "invalid") return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
308
|
+
className: "flex items-center gap-2",
|
|
309
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_icons.AlertTriangleIcon, {
|
|
310
|
+
className: "h-5 w-5",
|
|
311
|
+
"aria-hidden": "true"
|
|
312
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
313
|
+
className: "truncate",
|
|
314
|
+
children: label
|
|
315
|
+
})]
|
|
316
|
+
});
|
|
317
|
+
if (icon) return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
318
|
+
className: "flex items-center gap-2",
|
|
319
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
320
|
+
className: "shrink-0",
|
|
321
|
+
children: icon
|
|
322
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
323
|
+
className: "truncate",
|
|
324
|
+
children: label
|
|
325
|
+
})]
|
|
326
|
+
});
|
|
327
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
328
|
+
className: "flex items-center gap-2",
|
|
329
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
330
|
+
className: require_utils.mergeClassNames("flex h-6 w-6 shrink-0 items-center justify-center rounded-full border text-xs font-semibold", badgeClassName),
|
|
331
|
+
"aria-hidden": "true",
|
|
332
|
+
children: stepNumber
|
|
333
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
334
|
+
className: "truncate",
|
|
335
|
+
children: label
|
|
336
|
+
})]
|
|
337
|
+
});
|
|
338
|
+
}
|
|
339
|
+
function StepperSteps({ steps, currentStep, onStepClick, stepStates = [], orientation = "responsive", responsiveBreakpoint = DEFAULT_BREAKPOINT, className, stepClassName, connectorClassName }) {
|
|
340
|
+
const responsiveQuery = `(max-width: ${responsiveBreakpoint}px)`;
|
|
341
|
+
const isCompact = (0, react.useSyncExternalStore)((onStoreChange) => {
|
|
342
|
+
if (orientation !== "responsive") return () => void 0;
|
|
343
|
+
return subscribeToMediaQuery(responsiveQuery, onStoreChange);
|
|
344
|
+
}, () => orientation === "responsive" ? getMediaQuerySnapshot(responsiveQuery) : false, () => false);
|
|
345
|
+
const isVertical = orientation === "vertical" || orientation === "responsive" && isCompact;
|
|
346
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
347
|
+
className: require_utils.mergeClassNames(isVertical ? "flex w-full flex-col items-start" : "flex w-full items-center", className),
|
|
348
|
+
children: steps.map((step, index) => {
|
|
349
|
+
const stepNumber = index + 1;
|
|
350
|
+
const state = stepStates[index] ?? "untouched";
|
|
351
|
+
const isActive = index === currentStep;
|
|
352
|
+
const isClickable = typeof onStepClick === "function" && !isActive;
|
|
353
|
+
const colors = getStepColors(state, isActive);
|
|
354
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
355
|
+
className: require_utils.mergeClassNames(isVertical ? "w-full" : "flex min-w-0 flex-1 items-center"),
|
|
356
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_button.Button, {
|
|
357
|
+
disabled: !isClickable,
|
|
358
|
+
onClick: () => onStepClick?.(index),
|
|
359
|
+
className: require_utils.mergeClassNames("relative z-10 flex min-h-11 items-center justify-center rounded-md border px-4 py-3 text-sm font-medium transition-colors duration-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus/70 focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-default disabled:opacity-100", isVertical ? "w-full" : "w-full min-w-0", colors.buttonClassName, stepClassName),
|
|
360
|
+
"aria-current": isActive ? "step" : void 0,
|
|
361
|
+
"aria-invalid": state === "invalid" ? true : void 0,
|
|
362
|
+
children: renderStepContent(step.label, step.icon, state, stepNumber, colors.badgeClassName)
|
|
363
|
+
}), index < steps.length - 1 ? isVertical ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
364
|
+
className: require_utils.mergeClassNames("mx-auto my-2 h-8 w-px rounded-full", colors.connectorClassName, connectorClassName),
|
|
365
|
+
"aria-hidden": "true"
|
|
366
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
367
|
+
className: require_utils.mergeClassNames("mx-3 h-px min-w-6 flex-1 rounded-full", colors.connectorClassName, connectorClassName),
|
|
368
|
+
"aria-hidden": "true"
|
|
369
|
+
}) : null]
|
|
370
|
+
}, `${step.label}-${stepNumber}`);
|
|
371
|
+
})
|
|
372
|
+
});
|
|
373
|
+
}
|
|
374
|
+
//#endregion
|
|
375
|
+
//#region src/components/navigation/stepper/Stepper2.tsx
|
|
376
|
+
var useIsomorphicLayoutEffect = typeof window === "undefined" ? react.useEffect : react.useLayoutEffect;
|
|
377
|
+
function clampStep(step, totalSteps) {
|
|
378
|
+
return Math.min(Math.max(step, 0), totalSteps);
|
|
379
|
+
}
|
|
380
|
+
function getIndicatorStatus(stepIndex, currentStep) {
|
|
381
|
+
if (stepIndex === currentStep) return "active";
|
|
382
|
+
if (stepIndex < currentStep) return "complete";
|
|
383
|
+
return "inactive";
|
|
384
|
+
}
|
|
385
|
+
function StepperWizard({ children, initialStep = 0, currentStep: controlledStep, onStepChange, onFinalStepCompleted, stepCircleContainerClassName, stepContainerClassName, contentClassName, footerClassName, backButtonProps, nextButtonProps, backButtonText = "Back", nextButtonText = "Continue", completeButtonText = "Complete", disableStepIndicators = false, renderStepIndicator, className }) {
|
|
386
|
+
const stepsArray = react.Children.toArray(children);
|
|
387
|
+
const totalSteps = stepsArray.length;
|
|
388
|
+
const [internalStep, setInternalStep] = (0, react.useState)(() => clampStep(initialStep, totalSteps));
|
|
389
|
+
const [direction, setDirection] = (0, react.useState)(0);
|
|
390
|
+
const currentStep = clampStep(controlledStep ?? internalStep, totalSteps);
|
|
391
|
+
const isCompleted = currentStep >= totalSteps;
|
|
392
|
+
const isLastStep = totalSteps > 0 && currentStep === totalSteps - 1;
|
|
393
|
+
const commitStep = (0, react.useCallback)((nextStep) => {
|
|
394
|
+
const clampedStep = clampStep(nextStep, totalSteps);
|
|
395
|
+
if (controlledStep === void 0) setInternalStep(clampedStep);
|
|
396
|
+
if (clampedStep >= totalSteps) {
|
|
397
|
+
onFinalStepCompleted?.();
|
|
398
|
+
return;
|
|
399
|
+
}
|
|
400
|
+
onStepChange?.(clampedStep);
|
|
401
|
+
}, [
|
|
402
|
+
controlledStep,
|
|
403
|
+
onFinalStepCompleted,
|
|
404
|
+
onStepChange,
|
|
405
|
+
totalSteps
|
|
406
|
+
]);
|
|
407
|
+
if (totalSteps === 0) return null;
|
|
408
|
+
const handleBack = () => {
|
|
409
|
+
if (currentStep > 0) {
|
|
410
|
+
setDirection(-1);
|
|
411
|
+
commitStep(currentStep - 1);
|
|
412
|
+
}
|
|
413
|
+
};
|
|
414
|
+
const handleNext = () => {
|
|
415
|
+
if (!isLastStep) {
|
|
416
|
+
setDirection(1);
|
|
417
|
+
commitStep(currentStep + 1);
|
|
418
|
+
}
|
|
419
|
+
};
|
|
420
|
+
const handleComplete = () => {
|
|
421
|
+
setDirection(1);
|
|
422
|
+
commitStep(totalSteps);
|
|
423
|
+
};
|
|
424
|
+
const navigateToStep = (stepIndex) => {
|
|
425
|
+
if (stepIndex === currentStep || disableStepIndicators) return;
|
|
426
|
+
setDirection(stepIndex > currentStep ? 1 : -1);
|
|
427
|
+
commitStep(stepIndex);
|
|
428
|
+
};
|
|
429
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
430
|
+
className: require_utils.mergeClassNames("flex min-h-full w-full flex-1 items-center justify-center p-4", className),
|
|
431
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
432
|
+
className: require_utils.mergeClassNames("mx-auto w-full max-w-3xl rounded-3xl border border-border bg-background shadow-2", stepCircleContainerClassName),
|
|
433
|
+
children: [
|
|
434
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
435
|
+
className: require_utils.mergeClassNames("flex w-full items-center gap-3 border-b border-border px-6 py-6 sm:px-8", stepContainerClassName),
|
|
436
|
+
children: stepsArray.map((_, index) => {
|
|
437
|
+
const status = getIndicatorStatus(index, currentStep);
|
|
438
|
+
const isClickable = !disableStepIndicators && index !== currentStep;
|
|
439
|
+
const indicatorProps = {
|
|
440
|
+
stepIndex: index,
|
|
441
|
+
stepNumber: index + 1,
|
|
442
|
+
currentStep,
|
|
443
|
+
status,
|
|
444
|
+
isClickable,
|
|
445
|
+
onStepClick: navigateToStep
|
|
446
|
+
};
|
|
447
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
448
|
+
className: "flex flex-1 items-center",
|
|
449
|
+
children: [renderStepIndicator ? renderStepIndicator(indicatorProps) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(WizardStepIndicator, { ...indicatorProps }), index < totalSteps - 1 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(WizardStepConnector, { isComplete: currentStep > index }) : null]
|
|
450
|
+
}, `wizard-step-${index + 1}`);
|
|
451
|
+
})
|
|
452
|
+
}),
|
|
453
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(WizardStepContentWrapper, {
|
|
454
|
+
isCompleted,
|
|
455
|
+
currentStep,
|
|
456
|
+
direction,
|
|
457
|
+
className: require_utils.mergeClassNames("px-6 py-6 sm:px-8", contentClassName),
|
|
458
|
+
children: stepsArray[currentStep]
|
|
459
|
+
}),
|
|
460
|
+
!isCompleted ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
461
|
+
className: require_utils.mergeClassNames("px-6 pb-6 sm:px-8 sm:pb-8", footerClassName),
|
|
462
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
463
|
+
className: require_utils.mergeClassNames("mt-6 flex gap-3", currentStep > 0 ? "justify-between" : "justify-end"),
|
|
464
|
+
children: [currentStep > 0 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_button.Button, {
|
|
465
|
+
onClick: handleBack,
|
|
466
|
+
className: "rounded-md border-transparent bg-transparent px-3 py-2 text-sm font-medium text-muted-foreground shadow-none hover:bg-surface hover:text-foreground",
|
|
467
|
+
...backButtonProps,
|
|
468
|
+
children: backButtonText
|
|
469
|
+
}) : null, /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_button.Button, {
|
|
470
|
+
onClick: isLastStep ? handleComplete : handleNext,
|
|
471
|
+
primary: true,
|
|
472
|
+
className: "rounded-full px-4 py-2 text-sm font-semibold shadow-2",
|
|
473
|
+
...nextButtonProps,
|
|
474
|
+
children: isLastStep ? completeButtonText : nextButtonText
|
|
475
|
+
})]
|
|
476
|
+
})
|
|
477
|
+
}) : null
|
|
478
|
+
]
|
|
479
|
+
})
|
|
480
|
+
});
|
|
481
|
+
}
|
|
482
|
+
function WizardStepContentWrapper({ isCompleted, currentStep, direction, children, className }) {
|
|
483
|
+
const [parentHeight, setParentHeight] = (0, react.useState)(0);
|
|
484
|
+
const handleHeightReady = (0, react.useCallback)((height) => {
|
|
485
|
+
setParentHeight(height);
|
|
486
|
+
}, []);
|
|
487
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(framer_motion.motion.div, {
|
|
488
|
+
style: {
|
|
489
|
+
position: "relative",
|
|
490
|
+
overflow: "hidden"
|
|
491
|
+
},
|
|
492
|
+
animate: { height: isCompleted ? 0 : parentHeight },
|
|
493
|
+
transition: {
|
|
494
|
+
type: "spring",
|
|
495
|
+
duration: .4
|
|
496
|
+
},
|
|
497
|
+
className,
|
|
498
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(framer_motion.AnimatePresence, {
|
|
499
|
+
initial: false,
|
|
500
|
+
mode: "wait",
|
|
501
|
+
custom: direction,
|
|
502
|
+
children: !isCompleted ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(WizardSlideTransition, {
|
|
503
|
+
direction,
|
|
504
|
+
onHeightReady: handleHeightReady,
|
|
505
|
+
children
|
|
506
|
+
}, currentStep) : null
|
|
507
|
+
})
|
|
508
|
+
});
|
|
509
|
+
}
|
|
510
|
+
function WizardSlideTransition({ children, direction, onHeightReady }) {
|
|
511
|
+
const containerRef = (0, react.useRef)(null);
|
|
512
|
+
useIsomorphicLayoutEffect(() => {
|
|
513
|
+
if (containerRef.current) onHeightReady(containerRef.current.offsetHeight);
|
|
514
|
+
}, [children, onHeightReady]);
|
|
515
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(framer_motion.motion.div, {
|
|
516
|
+
ref: containerRef,
|
|
517
|
+
custom: direction,
|
|
518
|
+
variants: wizardStepVariants,
|
|
519
|
+
initial: "enter",
|
|
520
|
+
animate: "center",
|
|
521
|
+
exit: "exit",
|
|
522
|
+
transition: {
|
|
523
|
+
duration: .35,
|
|
524
|
+
ease: "easeOut"
|
|
525
|
+
},
|
|
526
|
+
style: {
|
|
527
|
+
position: "absolute",
|
|
528
|
+
inset: 0
|
|
529
|
+
},
|
|
530
|
+
children
|
|
531
|
+
});
|
|
532
|
+
}
|
|
533
|
+
var wizardStepVariants = {
|
|
534
|
+
enter: (direction) => ({
|
|
535
|
+
x: direction >= 0 ? "-100%" : "100%",
|
|
536
|
+
opacity: 0
|
|
537
|
+
}),
|
|
538
|
+
center: {
|
|
539
|
+
x: "0%",
|
|
540
|
+
opacity: 1
|
|
541
|
+
},
|
|
542
|
+
exit: (direction) => ({
|
|
543
|
+
x: direction >= 0 ? "40%" : "-40%",
|
|
544
|
+
opacity: 0
|
|
545
|
+
})
|
|
546
|
+
};
|
|
547
|
+
function StepperWizardStep({ children, className }) {
|
|
548
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
549
|
+
className: require_utils.mergeClassNames("space-y-4", className),
|
|
550
|
+
children
|
|
551
|
+
});
|
|
552
|
+
}
|
|
553
|
+
function WizardStepIndicator({ stepIndex, stepNumber, status, isClickable, onStepClick }) {
|
|
554
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(framer_motion.motion.button, {
|
|
555
|
+
type: "button",
|
|
556
|
+
onClick: () => onStepClick(stepIndex),
|
|
557
|
+
className: require_utils.mergeClassNames("relative z-10 flex h-10 w-10 shrink-0 items-center justify-center rounded-full border text-sm font-semibold transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus/70 focus-visible:ring-offset-2 focus-visible:ring-offset-background", isClickable ? "cursor-pointer" : "cursor-default"),
|
|
558
|
+
animate: status,
|
|
559
|
+
initial: false,
|
|
560
|
+
disabled: !isClickable,
|
|
561
|
+
"aria-current": status === "active" ? "step" : void 0,
|
|
562
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(framer_motion.motion.span, {
|
|
563
|
+
variants: {
|
|
564
|
+
inactive: {
|
|
565
|
+
scale: 1,
|
|
566
|
+
backgroundColor: "var(--ds-color-bg-surface)",
|
|
567
|
+
borderColor: "var(--ds-color-border)",
|
|
568
|
+
color: "var(--ds-color-fg-muted)"
|
|
569
|
+
},
|
|
570
|
+
active: {
|
|
571
|
+
scale: 1,
|
|
572
|
+
backgroundColor: "var(--ds-color-accent)",
|
|
573
|
+
borderColor: "var(--ds-color-accent)",
|
|
574
|
+
color: "var(--ds-color-fg-on-accent)"
|
|
575
|
+
},
|
|
576
|
+
complete: {
|
|
577
|
+
scale: 1,
|
|
578
|
+
backgroundColor: "var(--ds-color-accent)",
|
|
579
|
+
borderColor: "var(--ds-color-accent)",
|
|
580
|
+
color: "var(--ds-color-fg-on-accent)"
|
|
581
|
+
}
|
|
582
|
+
},
|
|
583
|
+
transition: { duration: .25 },
|
|
584
|
+
className: "flex h-full w-full items-center justify-center rounded-full",
|
|
585
|
+
children: status === "complete" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AnimatedWizardCheckIcon, { className: "h-4 w-4" }) : status === "active" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: "h-2.5 w-2.5 rounded-full bg-current" }) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: stepNumber })
|
|
586
|
+
})
|
|
587
|
+
});
|
|
588
|
+
}
|
|
589
|
+
function WizardStepConnector({ isComplete }) {
|
|
590
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
591
|
+
className: "relative mx-2 h-0.5 flex-1 overflow-hidden rounded-full bg-border",
|
|
592
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(framer_motion.motion.div, {
|
|
593
|
+
className: "absolute inset-y-0 left-0 rounded-full bg-accent",
|
|
594
|
+
initial: false,
|
|
595
|
+
animate: isComplete ? "complete" : "incomplete",
|
|
596
|
+
variants: {
|
|
597
|
+
incomplete: { width: 0 },
|
|
598
|
+
complete: { width: "100%" }
|
|
599
|
+
},
|
|
600
|
+
transition: {
|
|
601
|
+
duration: .35,
|
|
602
|
+
ease: "easeOut"
|
|
603
|
+
}
|
|
604
|
+
})
|
|
605
|
+
});
|
|
606
|
+
}
|
|
607
|
+
function AnimatedWizardCheckIcon({ className }) {
|
|
608
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
609
|
+
className: require_utils.mergeClassNames("flex items-center justify-center", className),
|
|
610
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_icons.CheckIcon, {
|
|
611
|
+
className: "h-full w-full",
|
|
612
|
+
"aria-hidden": "true"
|
|
613
|
+
})
|
|
614
|
+
});
|
|
615
|
+
}
|
|
616
|
+
//#endregion
|
|
617
|
+
Object.defineProperty(exports, "Stepper", {
|
|
618
|
+
enumerable: true,
|
|
619
|
+
get: function() {
|
|
620
|
+
return Stepper;
|
|
621
|
+
}
|
|
622
|
+
});
|
|
623
|
+
Object.defineProperty(exports, "StepperSteps", {
|
|
624
|
+
enumerable: true,
|
|
625
|
+
get: function() {
|
|
626
|
+
return StepperSteps;
|
|
627
|
+
}
|
|
628
|
+
});
|
|
629
|
+
Object.defineProperty(exports, "StepperWizard", {
|
|
630
|
+
enumerable: true,
|
|
631
|
+
get: function() {
|
|
632
|
+
return StepperWizard;
|
|
633
|
+
}
|
|
634
|
+
});
|
|
635
|
+
Object.defineProperty(exports, "StepperWizardStep", {
|
|
636
|
+
enumerable: true,
|
|
637
|
+
get: function() {
|
|
638
|
+
return StepperWizardStep;
|
|
639
|
+
}
|
|
640
|
+
});
|
|
641
|
+
|
|
642
|
+
//# sourceMappingURL=stepper-D6qQbZdg.cjs.map
|