@constructive-io/ui 0.3.1 → 0.6.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/LICENSE +21 -0
- package/README.md +17 -22
- package/dist/components/alert-dialog.cjs +333 -0
- package/dist/components/alert-dialog.cjs.map +1 -0
- package/dist/components/alert-dialog.d.cts +32 -0
- package/dist/components/alert-dialog.d.ts +16 -15
- package/dist/components/alert-dialog.js +89 -102
- package/dist/components/alert-dialog.js.map +1 -1
- package/dist/components/alert.cjs +119 -0
- package/dist/components/alert.cjs.map +1 -0
- package/dist/components/alert.d.cts +19 -0
- package/dist/components/alert.d.ts +10 -5
- package/dist/components/alert.js +62 -6
- package/dist/components/alert.js.map +1 -1
- package/dist/components/app-bar.cjs +367 -0
- package/dist/components/app-bar.cjs.map +1 -0
- package/dist/components/app-bar.d.cts +26 -0
- package/dist/components/app-bar.d.ts +26 -0
- package/dist/components/app-bar.js +344 -0
- package/dist/components/app-bar.js.map +1 -0
- package/dist/components/app-shell.cjs +1792 -0
- package/dist/components/app-shell.cjs.map +1 -0
- package/dist/components/app-shell.d.cts +106 -0
- package/dist/components/app-shell.d.ts +106 -0
- package/dist/components/app-shell.js +1771 -0
- package/dist/components/app-shell.js.map +1 -0
- package/dist/components/autocomplete.cjs +418 -0
- package/dist/components/autocomplete.cjs.map +1 -0
- package/dist/components/autocomplete.d.cts +28 -0
- package/dist/components/autocomplete.d.ts +15 -15
- package/dist/components/autocomplete.js +9 -30
- package/dist/components/autocomplete.js.map +1 -1
- package/dist/components/avatar.cjs +51 -0
- package/dist/components/avatar.cjs.map +1 -0
- package/dist/components/avatar.d.cts +12 -0
- package/dist/components/avatar.d.ts +3 -4
- package/dist/components/avatar.js +11 -1
- package/dist/components/avatar.js.map +1 -1
- package/dist/components/badge.cjs +66 -0
- package/dist/components/badge.cjs.map +1 -0
- package/dist/components/badge.d.cts +15 -0
- package/dist/components/badge.js +1 -1
- package/dist/components/badge.js.map +1 -1
- package/dist/components/breadcrumb.cjs +118 -0
- package/dist/components/breadcrumb.cjs.map +1 -0
- package/dist/components/breadcrumb.d.cts +14 -0
- package/dist/components/breadcrumb.d.ts +9 -9
- package/dist/components/breadcrumb.js +19 -83
- package/dist/components/breadcrumb.js.map +1 -1
- package/dist/components/button.cjs +169 -0
- package/dist/components/button.cjs.map +1 -0
- package/dist/components/button.d.cts +20 -0
- package/dist/components/button.d.ts +3 -0
- package/dist/components/button.js +105 -21
- package/dist/components/button.js.map +1 -1
- package/dist/components/calendar-rac.cjs +85 -0
- package/dist/components/calendar-rac.cjs.map +1 -0
- package/dist/components/calendar-rac.d.cts +13 -0
- package/dist/components/calendar-rac.d.ts +3 -3
- package/dist/components/card.cjs +99 -0
- package/dist/components/card.cjs.map +1 -0
- package/dist/components/card.d.cts +18 -0
- package/dist/components/card.d.ts +7 -8
- package/dist/components/card.js +23 -8
- package/dist/components/card.js.map +1 -1
- package/dist/components/checkbox-group.cjs +18 -0
- package/dist/components/checkbox-group.cjs.map +1 -0
- package/dist/components/checkbox-group.d.cts +7 -0
- package/dist/components/checkbox-group.d.ts +2 -2
- package/dist/components/checkbox.cjs +121 -0
- package/dist/components/checkbox.cjs.map +1 -0
- package/dist/components/checkbox.d.cts +8 -0
- package/dist/components/checkbox.d.ts +3 -3
- package/dist/components/checkbox.js +73 -41
- package/dist/components/checkbox.js.map +1 -1
- package/dist/components/collapsible.cjs +127 -0
- package/dist/components/collapsible.cjs.map +1 -0
- package/dist/components/collapsible.d.cts +44 -0
- package/dist/components/collapsible.d.ts +8 -18
- package/dist/components/collapsible.js +7 -27
- package/dist/components/collapsible.js.map +1 -1
- package/dist/components/combobox.cjs +551 -0
- package/dist/components/combobox.cjs.map +1 -0
- package/dist/components/combobox.d.cts +43 -0
- package/dist/components/combobox.d.ts +17 -18
- package/dist/components/combobox.js +37 -48
- package/dist/components/combobox.js.map +1 -1
- package/dist/components/command.cjs +236 -0
- package/dist/components/command.cjs.map +1 -0
- package/dist/components/command.d.cts +23 -0
- package/dist/components/command.d.ts +14 -15
- package/dist/components/command.js +5 -38
- package/dist/components/command.js.map +1 -1
- package/dist/components/dialog.cjs +431 -0
- package/dist/components/dialog.cjs.map +1 -0
- package/dist/components/dialog.d.cts +30 -0
- package/dist/components/dialog.d.ts +13 -18
- package/dist/components/dialog.js +75 -119
- package/dist/components/dialog.js.map +1 -1
- package/dist/components/dock.cjs +121 -0
- package/dist/components/dock.cjs.map +1 -0
- package/dist/components/dock.d.cts +30 -0
- package/dist/components/dock.d.ts +1 -2
- package/dist/components/dock.js +7 -5
- package/dist/components/dock.js.map +1 -1
- package/dist/components/drawer.cjs +149 -0
- package/dist/components/drawer.cjs.map +1 -0
- package/dist/components/drawer.d.cts +15 -0
- package/dist/components/drawer.d.ts +10 -11
- package/dist/components/drawer.js +11 -40
- package/dist/components/drawer.js.map +1 -1
- package/dist/components/dropdown-menu.cjs +292 -0
- package/dist/components/dropdown-menu.cjs.map +1 -0
- package/dist/components/dropdown-menu.d.cts +52 -0
- package/dist/components/dropdown-menu.d.ts +23 -21
- package/dist/components/dropdown-menu.js +67 -191
- package/dist/components/dropdown-menu.js.map +1 -1
- package/dist/components/empty.cjs +106 -0
- package/dist/components/empty.cjs.map +1 -0
- package/dist/components/empty.d.cts +15 -0
- package/dist/components/empty.d.ts +15 -0
- package/dist/components/empty.js +99 -0
- package/dist/components/empty.js.map +1 -0
- package/dist/components/field.cjs +295 -0
- package/dist/components/field.cjs.map +1 -0
- package/dist/components/field.d.cts +46 -0
- package/dist/components/field.d.ts +34 -39
- package/dist/components/field.js +220 -72
- package/dist/components/field.js.map +1 -1
- package/dist/components/flickering-grid.cjs +176 -0
- package/dist/components/flickering-grid.cjs.map +1 -0
- package/dist/components/flickering-grid.d.cts +15 -0
- package/dist/components/flickering-grid.js +25 -2
- package/dist/components/flickering-grid.js.map +1 -1
- package/dist/components/flow-zoom-panel.cjs +194 -0
- package/dist/components/flow-zoom-panel.cjs.map +1 -0
- package/dist/components/flow-zoom-panel.d.cts +12 -0
- package/dist/components/flow-zoom-panel.d.ts +12 -0
- package/dist/components/flow-zoom-panel.js +173 -0
- package/dist/components/flow-zoom-panel.js.map +1 -0
- package/dist/components/form-control.cjs +193 -0
- package/dist/components/form-control.cjs.map +1 -0
- package/dist/components/form-control.d.cts +14 -0
- package/dist/components/form-control.d.ts +1 -2
- package/dist/components/form-control.js +2 -4
- package/dist/components/form-control.js.map +1 -1
- package/dist/components/form.cjs +208 -0
- package/dist/components/form.cjs.map +1 -0
- package/dist/components/form.d.cts +36 -0
- package/dist/components/form.d.ts +7 -8
- package/dist/components/input-group.cjs +184 -0
- package/dist/components/input-group.cjs.map +1 -0
- package/dist/components/input-group.d.cts +17 -0
- package/dist/components/input-group.d.ts +6 -7
- package/dist/components/input-group.js +3 -2
- package/dist/components/input-group.js.map +1 -1
- package/dist/components/input.cjs +62 -0
- package/dist/components/input.cjs.map +1 -0
- package/dist/components/input.d.cts +10 -0
- package/dist/components/input.d.ts +1 -2
- package/dist/components/input.js +1 -1
- package/dist/components/input.js.map +1 -1
- package/dist/components/json-input.cjs +351 -0
- package/dist/components/json-input.cjs.map +1 -0
- package/dist/components/json-input.d.cts +25 -0
- package/dist/components/json-input.d.ts +3 -3
- package/dist/components/json-input.js +89 -112
- package/dist/components/json-input.js.map +1 -1
- package/dist/components/label.cjs +29 -0
- package/dist/components/label.cjs.map +1 -0
- package/dist/components/label.d.cts +10 -0
- package/dist/components/label.d.ts +1 -2
- package/dist/components/motion-grid.cjs +108 -0
- package/dist/components/motion-grid.cjs.map +1 -0
- package/dist/components/motion-grid.d.cts +19 -0
- package/dist/components/motion-grid.d.ts +1 -2
- package/dist/components/motion-grid.js +9 -4
- package/dist/components/motion-grid.js.map +1 -1
- package/dist/components/multi-select.cjs +796 -0
- package/dist/components/multi-select.cjs.map +1 -0
- package/dist/components/multi-select.d.cts +198 -0
- package/dist/components/multi-select.js +54 -162
- package/dist/components/multi-select.js.map +1 -1
- package/dist/components/page-header.cjs +19 -0
- package/dist/components/page-header.cjs.map +1 -0
- package/dist/components/page-header.d.cts +17 -0
- package/dist/components/page-header.d.ts +2 -2
- package/dist/components/pagination.cjs +295 -0
- package/dist/components/pagination.cjs.map +1 -0
- package/dist/components/pagination.d.cts +18 -0
- package/dist/components/pagination.d.ts +7 -8
- package/dist/components/pagination.js +152 -29
- package/dist/components/pagination.js.map +1 -1
- package/dist/components/popover.cjs +140 -0
- package/dist/components/popover.cjs.map +1 -0
- package/dist/components/popover.d.cts +39 -0
- package/dist/components/popover.d.ts +13 -9
- package/dist/components/popover.js +56 -132
- package/dist/components/popover.js.map +1 -1
- package/dist/components/portal.cjs +109 -0
- package/dist/components/portal.cjs.map +1 -0
- package/dist/components/portal.d.cts +117 -0
- package/dist/components/portal.d.ts +16 -7
- package/dist/components/portal.js +13 -8
- package/dist/components/portal.js.map +1 -1
- package/dist/components/progress.cjs +31 -0
- package/dist/components/progress.cjs.map +1 -0
- package/dist/components/progress.d.cts +9 -0
- package/dist/components/progress.d.ts +1 -2
- package/dist/components/progress.js +1 -2
- package/dist/components/progress.js.map +1 -1
- package/dist/components/progressive-blur-scroll-container.cjs +144 -0
- package/dist/components/progressive-blur-scroll-container.cjs.map +1 -0
- package/dist/components/progressive-blur-scroll-container.d.cts +25 -0
- package/dist/components/progressive-blur-scroll-container.d.ts +2 -2
- package/dist/components/progressive-blur.cjs +70 -0
- package/dist/components/progressive-blur.cjs.map +1 -0
- package/dist/components/progressive-blur.d.cts +16 -0
- package/dist/components/progressive-blur.d.ts +2 -2
- package/dist/components/radio-group.cjs +52 -0
- package/dist/components/radio-group.cjs.map +1 -0
- package/dist/components/radio-group.d.cts +10 -0
- package/dist/components/radio-group.d.ts +3 -3
- package/dist/components/radio-group.js +21 -10
- package/dist/components/radio-group.js.map +1 -1
- package/dist/components/record-picker.cjs +420 -0
- package/dist/components/record-picker.cjs.map +1 -0
- package/dist/components/record-picker.d.cts +16 -0
- package/dist/components/record-picker.d.ts +2 -2
- package/dist/components/record-picker.js +76 -43
- package/dist/components/record-picker.js.map +1 -1
- package/dist/components/resizable.cjs +76 -0
- package/dist/components/resizable.cjs.map +1 -0
- package/dist/components/resizable.d.cts +10 -0
- package/dist/components/resizable.d.ts +3 -4
- package/dist/components/responsive-diagram.cjs +67 -0
- package/dist/components/responsive-diagram.cjs.map +1 -0
- package/dist/components/responsive-diagram.d.cts +10 -0
- package/dist/components/responsive-diagram.d.ts +2 -2
- package/dist/components/scroll-area.cjs +92 -0
- package/dist/components/scroll-area.cjs.map +1 -0
- package/dist/components/scroll-area.d.cts +11 -0
- package/dist/components/scroll-area.d.ts +5 -6
- package/dist/components/select.cjs +329 -0
- package/dist/components/select.cjs.map +1 -0
- package/dist/components/select.d.cts +46 -0
- package/dist/components/select.d.ts +13 -14
- package/dist/components/select.js +76 -67
- package/dist/components/select.js.map +1 -1
- package/dist/components/separator.cjs +26 -0
- package/dist/components/separator.cjs.map +1 -0
- package/dist/components/separator.d.cts +10 -0
- package/dist/components/separator.d.ts +1 -2
- package/dist/components/sheet.cjs +489 -0
- package/dist/components/sheet.cjs.map +1 -0
- package/dist/components/sheet.d.cts +107 -0
- package/dist/components/sheet.d.ts +14 -19
- package/dist/components/sheet.js +119 -264
- package/dist/components/sheet.js.map +1 -1
- package/dist/components/sidebar.cjs +1300 -0
- package/dist/components/sidebar.cjs.map +1 -0
- package/dist/components/sidebar.d.cts +70 -0
- package/dist/components/sidebar.d.ts +32 -39
- package/dist/components/sidebar.js +401 -362
- package/dist/components/sidebar.js.map +1 -1
- package/dist/components/skeleton.cjs +36 -0
- package/dist/components/skeleton.cjs.map +1 -0
- package/dist/components/skeleton.d.cts +10 -0
- package/dist/components/skeleton.d.ts +5 -2
- package/dist/components/skeleton.js +19 -1
- package/dist/components/skeleton.js.map +1 -1
- package/dist/components/sonner.cjs +25 -0
- package/dist/components/sonner.cjs.map +1 -0
- package/dist/components/sonner.d.cts +10 -0
- package/dist/components/sonner.d.ts +2 -2
- package/dist/components/stack/index.cjs +1516 -0
- package/dist/components/stack/index.cjs.map +1 -0
- package/dist/components/stack/index.d.cts +672 -0
- package/dist/components/stack/index.d.ts +36 -38
- package/dist/components/stack/index.js +42 -31
- package/dist/components/stack/index.js.map +1 -1
- package/dist/components/stepper.cjs +314 -0
- package/dist/components/stepper.cjs.map +1 -0
- package/dist/components/stepper.d.cts +31 -0
- package/dist/components/stepper.d.ts +9 -8
- package/dist/components/stepper.js +22 -15
- package/dist/components/stepper.js.map +1 -1
- package/dist/components/switch.cjs +46 -0
- package/dist/components/switch.cjs.map +1 -0
- package/dist/components/switch.d.cts +7 -0
- package/dist/components/switch.d.ts +1 -2
- package/dist/components/switch.js +9 -5
- package/dist/components/switch.js.map +1 -1
- package/dist/components/table.cjs +133 -0
- package/dist/components/table.cjs.map +1 -0
- package/dist/components/table.d.cts +22 -0
- package/dist/components/table.d.ts +19 -12
- package/dist/components/table.js +72 -13
- package/dist/components/table.js.map +1 -1
- package/dist/components/tabs.cjs +53 -0
- package/dist/components/tabs.cjs.map +1 -0
- package/dist/components/tabs.d.cts +9 -0
- package/dist/components/tabs.d.ts +4 -5
- package/dist/components/tabs.js +2 -2
- package/dist/components/tabs.js.map +1 -1
- package/dist/components/tags.cjs +451 -0
- package/dist/components/tags.cjs.map +1 -0
- package/dist/components/tags.d.cts +40 -0
- package/dist/components/tags.d.ts +10 -10
- package/dist/components/tags.js +129 -154
- package/dist/components/tags.js.map +1 -1
- package/dist/components/textarea.cjs +56 -0
- package/dist/components/textarea.cjs.map +1 -0
- package/dist/components/textarea.d.cts +9 -0
- package/dist/components/textarea.d.ts +1 -2
- package/dist/components/toast/index.cjs +612 -0
- package/dist/components/toast/index.cjs.map +1 -0
- package/dist/components/toast/index.d.cts +52 -0
- package/dist/components/toast/index.js +90 -127
- package/dist/components/toast/index.js.map +1 -1
- package/dist/components/tooltip.cjs +92 -0
- package/dist/components/tooltip.cjs.map +1 -0
- package/dist/components/tooltip.d.cts +28 -0
- package/dist/components/tooltip.d.ts +5 -6
- package/dist/components/tooltip.js +23 -130
- package/dist/components/tooltip.js.map +1 -1
- package/dist/components/unlink-button.cjs +197 -0
- package/dist/components/unlink-button.cjs.map +1 -0
- package/dist/components/unlink-button.d.cts +14 -0
- package/dist/components/unlink-button.d.ts +2 -2
- package/dist/components/unlink-button.js +105 -21
- package/dist/components/unlink-button.js.map +1 -1
- package/dist/index.cjs +2040 -1577
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +492 -509
- package/dist/index.d.ts +492 -509
- package/dist/index.js +1862 -1443
- package/dist/index.js.map +1 -1
- package/package.json +286 -45
- package/src/styles/globals.css +155 -203
- package/dist/components/org-chart/index.d.ts +0 -54
- package/dist/components/org-chart/index.js +0 -861
- package/dist/components/org-chart/index.js.map +0 -1
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
var React = require('react');
|
|
5
|
+
var lucideReact = require('lucide-react');
|
|
6
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
7
|
+
var clsx = require('clsx');
|
|
8
|
+
var tailwindMerge = require('tailwind-merge');
|
|
9
|
+
|
|
10
|
+
function _interopNamespace(e) {
|
|
11
|
+
if (e && e.__esModule) return e;
|
|
12
|
+
var n = Object.create(null);
|
|
13
|
+
if (e) {
|
|
14
|
+
Object.keys(e).forEach(function (k) {
|
|
15
|
+
if (k !== 'default') {
|
|
16
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
17
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function () { return e[k]; }
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
n.default = e;
|
|
25
|
+
return Object.freeze(n);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
29
|
+
|
|
30
|
+
function composeRefs(...refs) {
|
|
31
|
+
return (node) => {
|
|
32
|
+
refs.forEach((ref) => {
|
|
33
|
+
if (typeof ref === "function") {
|
|
34
|
+
ref(node);
|
|
35
|
+
} else if (ref != null) {
|
|
36
|
+
ref.current = node;
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
function mergeProps(slotProps, childProps) {
|
|
42
|
+
const overrideProps = { ...childProps };
|
|
43
|
+
for (const propName in childProps) {
|
|
44
|
+
if (propName === "ref") continue;
|
|
45
|
+
const slotPropValue = slotProps[propName];
|
|
46
|
+
const childPropValue = childProps[propName];
|
|
47
|
+
if (/^on[A-Z]/.test(propName) && typeof slotPropValue === "function" && typeof childPropValue === "function") {
|
|
48
|
+
overrideProps[propName] = (...args) => {
|
|
49
|
+
childPropValue(...args);
|
|
50
|
+
slotPropValue(...args);
|
|
51
|
+
};
|
|
52
|
+
} else if (propName === "className" && typeof slotPropValue === "string" && typeof childPropValue === "string") {
|
|
53
|
+
overrideProps[propName] = `${slotPropValue} ${childPropValue}`.trim();
|
|
54
|
+
} else if (propName === "style" && typeof slotPropValue === "object" && typeof childPropValue === "object") {
|
|
55
|
+
overrideProps[propName] = { ...slotPropValue, ...childPropValue };
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return { ...slotProps, ...overrideProps };
|
|
59
|
+
}
|
|
60
|
+
function isSlottable(child) {
|
|
61
|
+
return React__namespace.isValidElement(child);
|
|
62
|
+
}
|
|
63
|
+
var Slot = React__namespace.forwardRef((props, forwardedRef) => {
|
|
64
|
+
const { children, ...slotProps } = props;
|
|
65
|
+
if (isSlottable(children)) {
|
|
66
|
+
const childProps = children.props;
|
|
67
|
+
const childRef = childProps.ref;
|
|
68
|
+
return React__namespace.cloneElement(children, {
|
|
69
|
+
...mergeProps(slotProps, childProps),
|
|
70
|
+
ref: forwardedRef ? composeRefs(forwardedRef, childRef) : childRef
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
if (React__namespace.Children.count(children) > 1) {
|
|
74
|
+
const childrenArray = React__namespace.Children.toArray(children);
|
|
75
|
+
const slottableChild = childrenArray.find(
|
|
76
|
+
(child) => React__namespace.isValidElement(child) && child.type === Slottable
|
|
77
|
+
);
|
|
78
|
+
if (slottableChild) {
|
|
79
|
+
const newElement = slottableChild.props.children;
|
|
80
|
+
if (isSlottable(newElement)) {
|
|
81
|
+
const newElementProps = newElement.props;
|
|
82
|
+
const newChildren = childrenArray.map((child) => {
|
|
83
|
+
if (child === slottableChild) {
|
|
84
|
+
return React__namespace.Children.count(newElementProps.children) > 1 ? React__namespace.Children.only(null) : newElementProps.children;
|
|
85
|
+
}
|
|
86
|
+
return child;
|
|
87
|
+
});
|
|
88
|
+
const childRef = newElementProps.ref;
|
|
89
|
+
return React__namespace.cloneElement(newElement, {
|
|
90
|
+
...mergeProps(slotProps, newElementProps),
|
|
91
|
+
ref: forwardedRef ? composeRefs(forwardedRef, childRef) : childRef,
|
|
92
|
+
children: newChildren
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
|
|
98
|
+
});
|
|
99
|
+
Slot.displayName = "Slot";
|
|
100
|
+
function Slottable({ children }) {
|
|
101
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
|
|
102
|
+
}
|
|
103
|
+
function cn(...inputs) {
|
|
104
|
+
return tailwindMerge.twMerge(clsx.clsx(inputs));
|
|
105
|
+
}
|
|
106
|
+
var StepperContext = React.createContext(void 0);
|
|
107
|
+
var StepItemContext = React.createContext(void 0);
|
|
108
|
+
var iconSwapClass = "transition-[opacity,scale,filter] duration-300 ease-[cubic-bezier(0.2,0,0,1)] motion-reduce:transition-none";
|
|
109
|
+
var iconSwapVisible = "scale-100 opacity-100 blur-0";
|
|
110
|
+
var iconSwapHidden = "scale-[0.25] opacity-0 blur-[4px]";
|
|
111
|
+
var useStepper = () => {
|
|
112
|
+
const context = React.useContext(StepperContext);
|
|
113
|
+
if (!context) {
|
|
114
|
+
throw new Error("useStepper must be used within a Stepper");
|
|
115
|
+
}
|
|
116
|
+
return context;
|
|
117
|
+
};
|
|
118
|
+
var useStepItem = () => {
|
|
119
|
+
const context = React.useContext(StepItemContext);
|
|
120
|
+
if (!context) {
|
|
121
|
+
throw new Error("useStepItem must be used within a StepperItem");
|
|
122
|
+
}
|
|
123
|
+
return context;
|
|
124
|
+
};
|
|
125
|
+
function Stepper({
|
|
126
|
+
defaultValue = 0,
|
|
127
|
+
value,
|
|
128
|
+
onValueChange,
|
|
129
|
+
orientation = "horizontal",
|
|
130
|
+
className,
|
|
131
|
+
...props
|
|
132
|
+
}) {
|
|
133
|
+
const [activeStep, setInternalStep] = React__namespace.useState(defaultValue);
|
|
134
|
+
const setActiveStep = React__namespace.useCallback(
|
|
135
|
+
(step) => {
|
|
136
|
+
if (value === void 0) {
|
|
137
|
+
setInternalStep(step);
|
|
138
|
+
}
|
|
139
|
+
onValueChange?.(step);
|
|
140
|
+
},
|
|
141
|
+
[value, onValueChange]
|
|
142
|
+
);
|
|
143
|
+
const currentStep = value ?? activeStep;
|
|
144
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
145
|
+
StepperContext.Provider,
|
|
146
|
+
{
|
|
147
|
+
value: {
|
|
148
|
+
activeStep: currentStep,
|
|
149
|
+
setActiveStep,
|
|
150
|
+
orientation
|
|
151
|
+
},
|
|
152
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
153
|
+
"div",
|
|
154
|
+
{
|
|
155
|
+
"data-slot": "stepper",
|
|
156
|
+
className: cn(
|
|
157
|
+
`group/stepper inline-flex data-[orientation=horizontal]:w-full data-[orientation=horizontal]:flex-row
|
|
158
|
+
data-[orientation=vertical]:flex-col`,
|
|
159
|
+
className
|
|
160
|
+
),
|
|
161
|
+
"data-orientation": orientation,
|
|
162
|
+
...props
|
|
163
|
+
}
|
|
164
|
+
)
|
|
165
|
+
}
|
|
166
|
+
);
|
|
167
|
+
}
|
|
168
|
+
function StepperItem({
|
|
169
|
+
step,
|
|
170
|
+
completed = false,
|
|
171
|
+
disabled = false,
|
|
172
|
+
loading = false,
|
|
173
|
+
className,
|
|
174
|
+
children,
|
|
175
|
+
...props
|
|
176
|
+
}) {
|
|
177
|
+
const { activeStep } = useStepper();
|
|
178
|
+
const state = completed || step < activeStep ? "completed" : activeStep === step ? "active" : "inactive";
|
|
179
|
+
const isLoading = loading && step === activeStep;
|
|
180
|
+
return /* @__PURE__ */ jsxRuntime.jsx(StepItemContext.Provider, { value: { step, state, isDisabled: disabled, isLoading }, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
181
|
+
"div",
|
|
182
|
+
{
|
|
183
|
+
"data-slot": "stepper-item",
|
|
184
|
+
className: cn(
|
|
185
|
+
`group/step flex items-center group-data-[orientation=horizontal]/stepper:flex-row
|
|
186
|
+
group-data-[orientation=vertical]/stepper:flex-col`,
|
|
187
|
+
className
|
|
188
|
+
),
|
|
189
|
+
"data-state": state,
|
|
190
|
+
...isLoading ? { "data-loading": true } : {},
|
|
191
|
+
...props,
|
|
192
|
+
children
|
|
193
|
+
}
|
|
194
|
+
) });
|
|
195
|
+
}
|
|
196
|
+
function StepperTrigger({ asChild = false, static: isStatic, className, children, ...props }) {
|
|
197
|
+
const { setActiveStep } = useStepper();
|
|
198
|
+
const { step, isDisabled } = useStepItem();
|
|
199
|
+
const triggerClassName = cn(
|
|
200
|
+
`focus-visible:border-ring focus-visible:ring-ring/50 inline-flex items-center gap-3 rounded-full transition-transform
|
|
201
|
+
duration-150 ease-out outline-none focus-visible:z-10 focus-visible:ring-[3px]
|
|
202
|
+
disabled:pointer-events-none disabled:opacity-50`,
|
|
203
|
+
!isStatic && "motion-safe:hover:scale-105 motion-safe:active:not-disabled:scale-[0.96]",
|
|
204
|
+
className
|
|
205
|
+
);
|
|
206
|
+
if (asChild) {
|
|
207
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
208
|
+
Slot,
|
|
209
|
+
{
|
|
210
|
+
"data-slot": "stepper-trigger",
|
|
211
|
+
className: triggerClassName,
|
|
212
|
+
onClick: () => setActiveStep(step),
|
|
213
|
+
disabled: isDisabled,
|
|
214
|
+
...props,
|
|
215
|
+
children
|
|
216
|
+
}
|
|
217
|
+
);
|
|
218
|
+
}
|
|
219
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
220
|
+
"button",
|
|
221
|
+
{
|
|
222
|
+
"data-slot": "stepper-trigger",
|
|
223
|
+
className: triggerClassName,
|
|
224
|
+
onClick: () => setActiveStep(step),
|
|
225
|
+
disabled: isDisabled,
|
|
226
|
+
...props,
|
|
227
|
+
children
|
|
228
|
+
}
|
|
229
|
+
);
|
|
230
|
+
}
|
|
231
|
+
function StepperIndicator({ asChild = false, className, children, ...props }) {
|
|
232
|
+
const { state, step, isLoading } = useStepItem();
|
|
233
|
+
const showNumber = !isLoading && state !== "completed";
|
|
234
|
+
const showCheck = !isLoading && state === "completed";
|
|
235
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
236
|
+
"span",
|
|
237
|
+
{
|
|
238
|
+
"data-slot": "stepper-indicator",
|
|
239
|
+
className: cn(
|
|
240
|
+
`bg-muted text-muted-foreground data-[state=active]:bg-primary data-[state=completed]:bg-primary
|
|
241
|
+
data-[state=active]:text-primary-foreground data-[state=completed]:text-primary-foreground relative flex size-6
|
|
242
|
+
shrink-0 items-center justify-center rounded-full text-xs font-medium transition-[color,background-color] duration-200 ease-out`,
|
|
243
|
+
className
|
|
244
|
+
),
|
|
245
|
+
"data-state": state,
|
|
246
|
+
...props,
|
|
247
|
+
children: asChild ? children : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
248
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: cn("absolute", iconSwapClass, showNumber ? iconSwapVisible : iconSwapHidden), children: step }),
|
|
249
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
250
|
+
lucideReact.CheckIcon,
|
|
251
|
+
{
|
|
252
|
+
className: cn("absolute", iconSwapClass, showCheck ? iconSwapVisible : iconSwapHidden),
|
|
253
|
+
size: 16,
|
|
254
|
+
"aria-hidden": "true"
|
|
255
|
+
}
|
|
256
|
+
),
|
|
257
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: cn("absolute", iconSwapClass, isLoading ? iconSwapVisible : iconSwapHidden), children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
258
|
+
lucideReact.LoaderCircleIcon,
|
|
259
|
+
{
|
|
260
|
+
className: cn(isLoading && "motion-safe:animate-spin"),
|
|
261
|
+
size: 14,
|
|
262
|
+
"aria-hidden": "true"
|
|
263
|
+
}
|
|
264
|
+
) })
|
|
265
|
+
] })
|
|
266
|
+
}
|
|
267
|
+
);
|
|
268
|
+
}
|
|
269
|
+
function StepperTitle({ className, ...props }) {
|
|
270
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
271
|
+
"h3",
|
|
272
|
+
{
|
|
273
|
+
"data-slot": "stepper-title",
|
|
274
|
+
className: cn("text-sm font-medium transition-colors duration-200 ease-out", className),
|
|
275
|
+
...props
|
|
276
|
+
}
|
|
277
|
+
);
|
|
278
|
+
}
|
|
279
|
+
function StepperDescription({ className, ...props }) {
|
|
280
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
281
|
+
"p",
|
|
282
|
+
{
|
|
283
|
+
"data-slot": "stepper-description",
|
|
284
|
+
className: cn("text-muted-foreground text-sm transition-colors duration-200 ease-out", className),
|
|
285
|
+
...props
|
|
286
|
+
}
|
|
287
|
+
);
|
|
288
|
+
}
|
|
289
|
+
function StepperSeparator({ className, ...props }) {
|
|
290
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
291
|
+
"div",
|
|
292
|
+
{
|
|
293
|
+
"data-slot": "stepper-separator",
|
|
294
|
+
className: cn(
|
|
295
|
+
`bg-muted group-data-[state=completed]/step:bg-primary m-0.5 transition-colors duration-200 ease-out
|
|
296
|
+
group-data-[orientation=horizontal]/stepper:h-0.5 group-data-[orientation=horizontal]/stepper:w-full
|
|
297
|
+
group-data-[orientation=horizontal]/stepper:flex-1 group-data-[orientation=vertical]/stepper:h-12
|
|
298
|
+
group-data-[orientation=vertical]/stepper:w-0.5`,
|
|
299
|
+
className
|
|
300
|
+
),
|
|
301
|
+
...props
|
|
302
|
+
}
|
|
303
|
+
);
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
exports.Stepper = Stepper;
|
|
307
|
+
exports.StepperDescription = StepperDescription;
|
|
308
|
+
exports.StepperIndicator = StepperIndicator;
|
|
309
|
+
exports.StepperItem = StepperItem;
|
|
310
|
+
exports.StepperSeparator = StepperSeparator;
|
|
311
|
+
exports.StepperTitle = StepperTitle;
|
|
312
|
+
exports.StepperTrigger = StepperTrigger;
|
|
313
|
+
//# sourceMappingURL=stepper.cjs.map
|
|
314
|
+
//# sourceMappingURL=stepper.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/lib/slot.tsx","../../src/lib/utils.ts","../../src/components/stepper.tsx"],"names":["React","twMerge","clsx","createContext","useContext","React2","jsx","jsxs","Fragment","CheckIcon","LoaderCircleIcon"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA,SAAS,eAAkB,IAAA,EAA0D;AACpF,EAAA,OAAO,CAAC,IAAA,KAAS;AAChB,IAAA,IAAA,CAAK,OAAA,CAAQ,CAAC,GAAA,KAAQ;AACrB,MAAA,IAAI,OAAO,QAAQ,UAAA,EAAY;AAC9B,QAAA,GAAA,CAAI,IAAI,CAAA;AAAA,MACT,CAAA,MAAA,IAAW,OAAO,IAAA,EAAM;AACvB,QAAC,IAAyC,OAAA,GAAU,IAAA;AAAA,MACrD;AAAA,IACD,CAAC,CAAA;AAAA,EACF,CAAA;AACD;AAMA,SAAS,UAAA,CACR,WACA,UAAA,EAC0B;AAC1B,EAAA,MAAM,aAAA,GAA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,CAAC,MAAA,EAAA,EAAK,SAAA,EAAW,EAAA,CAAG,UAAA,EAAY,aAAA,EAAe,SAAA,GAAY,eAAA,GAAkB,cAAc,CAAA,EAC1F,QAAA,kBAAAA,cAAAA;AAAA,UAACI,4BAAA;AAAA,UAAA;AAAA,YACA,SAAA,EAAW,EAAA,CAAG,SAAA,IAAa,0BAA0B,CAAA;AAAA,YACrD,IAAA,EAAM,EAAA;AAAA,YACN,aAAA,EAAY;AAAA;AAAA,SACb,EACD;AAAA,OAAA,EACD;AAAA;AAAA,GAEF;AAEF;AAGA,SAAS,YAAA,CAAa,EAAE,SAAA,EAAW,GAAG,OAAM,EAA6C;AACxF,EAAA,uBACCJ,cAAAA;AAAA,IAAC,IAAA;AAAA,IAAA;AAAA,MACA,WAAA,EAAU,eAAA;AAAA,MACV,SAAA,EAAW,EAAA,CAAG,6DAAA,EAA+D,SAAS,CAAA;AAAA,MACrF,GAAG;AAAA;AAAA,GACL;AAEF;AAGA,SAAS,kBAAA,CAAmB,EAAE,SAAA,EAAW,GAAG,OAAM,EAA+C;AAChG,EAAA,uBACCA,cAAAA;AAAA,IAAC,GAAA;AAAA,IAAA;AAAA,MACA,WAAA,EAAU,qBAAA;AAAA,MACV,SAAA,EAAW,EAAA,CAAG,uEAAA,EAAyE,SAAS,CAAA;AAAA,MAC/F,GAAG;AAAA;AAAA,GACL;AAEF;AAGA,SAAS,gBAAA,CAAiB,EAAE,SAAA,EAAW,GAAG,OAAM,EAAyC;AACxF,EAAA,uBACCA,cAAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACA,WAAA,EAAU,mBAAA;AAAA,MACV,SAAA,EAAW,EAAA;AAAA,QACV,CAAA;AAAA;AAAA;AAAA,mDAAA,CAAA;AAAA,QAIA;AAAA,OACD;AAAA,MACC,GAAG;AAAA;AAAA,GACL;AAEF","file":"stepper.cjs","sourcesContent":["'use client';\n\nimport * as React from 'react';\n\n/**\n * Merges refs into a single callback ref.\n * React 19 compatible - handles refs as regular props.\n */\nfunction composeRefs<T>(...refs: (React.Ref<T> | undefined)[]): React.RefCallback<T> {\n\treturn (node) => {\n\t\trefs.forEach((ref) => {\n\t\t\tif (typeof ref === 'function') {\n\t\t\t\tref(node);\n\t\t\t} else if (ref != null) {\n\t\t\t\t(ref as React.MutableRefObject<T | null>).current = node;\n\t\t\t}\n\t\t});\n\t};\n}\n\n/**\n * Merges props, handling special cases for className, style, and event handlers.\n * Excludes 'ref' from merging as it's handled separately.\n */\nfunction mergeProps(\n\tslotProps: Record<string, unknown>,\n\tchildProps: Record<string, unknown>,\n): Record<string, unknown> {\n\tconst overrideProps: Record<string, unknown> = { ...childProps };\n\n\tfor (const propName in childProps) {\n\t\t// Skip ref - handled separately for composition\n\t\tif (propName === 'ref') continue;\n\n\t\tconst slotPropValue = slotProps[propName];\n\t\tconst childPropValue = childProps[propName];\n\n\t\t// Compose event handlers\n\t\tif (/^on[A-Z]/.test(propName) && typeof slotPropValue === 'function' && typeof childPropValue === 'function') {\n\t\t\toverrideProps[propName] = (...args: unknown[]) => {\n\t\t\t\tchildPropValue(...args);\n\t\t\t\tslotPropValue(...args);\n\t\t\t};\n\t\t}\n\t\t// Merge className\n\t\telse if (propName === 'className' && typeof slotPropValue === 'string' && typeof childPropValue === 'string') {\n\t\t\toverrideProps[propName] = `${slotPropValue} ${childPropValue}`.trim();\n\t\t}\n\t\t// Merge style\n\t\telse if (propName === 'style' && typeof slotPropValue === 'object' && typeof childPropValue === 'object') {\n\t\t\toverrideProps[propName] = { ...slotPropValue, ...childPropValue };\n\t\t}\n\t}\n\n\treturn { ...slotProps, ...overrideProps };\n}\n\n/**\n * Merges props from a parent component with a child element's props,\n * including proper ref composition. Use this in render prop patterns\n * where the parent needs to merge its props with the child's.\n *\n * @param parentProps - Props from the parent component (e.g., triggerProps from Base UI)\n * @param childElement - The child React element whose props will be merged\n * @returns Merged props object ready to pass to React.cloneElement\n */\nfunction mergePropsWithRef<T = HTMLElement>(\n\tparentProps: Record<string, unknown>,\n\tchildElement: React.ReactElement,\n): Record<string, unknown> {\n\tconst childProps = childElement.props as Record<string, unknown>;\n\tconst parentRef = parentProps.ref as React.Ref<T> | undefined;\n\tconst childRef = childProps.ref as React.Ref<T> | undefined;\n\n\tconst mergedProps = mergeProps(parentProps, childProps);\n\n\t// Compose refs if either exists\n\tif (parentRef || childRef) {\n\t\tmergedProps.ref = composeRefs(parentRef, childRef);\n\t}\n\n\treturn mergedProps;\n}\n\n/**\n * Check if a value is a valid slottable child (single React element).\n */\nfunction isSlottable(child: React.ReactNode): child is React.ReactElement {\n\treturn React.isValidElement(child);\n}\n\nexport interface SlotProps extends React.HTMLAttributes<HTMLElement> {\n\tchildren?: React.ReactNode;\n}\n\n/**\n * Slot component - renders its child element with merged props.\n * Used for the `asChild` pattern where parent props are passed to child.\n * React 19 compatible - accesses ref from props instead of element.ref.\n */\nconst Slot = React.forwardRef<HTMLElement, SlotProps>((props, forwardedRef) => {\n\tconst { children, ...slotProps } = props;\n\n\t// Handle single child\n\tif (isSlottable(children)) {\n\t\tconst childProps = children.props as Record<string, unknown>;\n\t\t// React 19: ref is now a regular prop, not element.ref\n\t\tconst childRef = childProps.ref as React.Ref<HTMLElement> | undefined;\n\n\t\treturn React.cloneElement(children, {\n\t\t\t...mergeProps(slotProps, childProps),\n\t\t\tref: forwardedRef ? composeRefs(forwardedRef, childRef) : childRef,\n\t\t} as React.Attributes);\n\t}\n\n\t// Handle multiple children - wrap Slottable content\n\tif (React.Children.count(children) > 1) {\n\t\tconst childrenArray = React.Children.toArray(children);\n\t\tconst slottableChild = childrenArray.find(\n\t\t\t(child) => React.isValidElement(child) && child.type === Slottable,\n\t\t) as React.ReactElement<{ children: React.ReactNode }> | undefined;\n\n\t\tif (slottableChild) {\n\t\t\tconst newElement = slottableChild.props.children;\n\t\t\tif (isSlottable(newElement)) {\n\t\t\t\tconst newElementProps = newElement.props as Record<string, unknown> & { children?: React.ReactNode };\n\t\t\t\tconst newChildren = childrenArray.map((child) => {\n\t\t\t\t\tif (child === slottableChild) {\n\t\t\t\t\t\treturn React.Children.count(newElementProps.children) > 1\n\t\t\t\t\t\t\t? React.Children.only(null)\n\t\t\t\t\t\t\t: newElementProps.children;\n\t\t\t\t\t}\n\t\t\t\t\treturn child;\n\t\t\t\t});\n\n\t\t\t\t// React 19: ref is now a regular prop\n\t\t\t\tconst childRef = newElementProps.ref as React.Ref<HTMLElement> | undefined;\n\n\t\t\t\treturn React.cloneElement(newElement, {\n\t\t\t\t\t...mergeProps(slotProps, newElementProps),\n\t\t\t\t\tref: forwardedRef ? composeRefs(forwardedRef, childRef) : childRef,\n\t\t\t\t\tchildren: newChildren,\n\t\t\t\t} as React.Attributes);\n\t\t\t}\n\t\t}\n\t}\n\n\t// Fallback: render children as-is (shouldn't normally happen with proper usage)\n\treturn <>{children}</>;\n});\n\nSlot.displayName = 'Slot';\n\n/**\n * Slottable component - marks content that should receive slot props.\n * Used when Slot has multiple children and you want to specify which one receives props.\n */\nfunction Slottable({ children }: { children: React.ReactNode }) {\n\treturn <>{children}</>;\n}\n\nexport { Slot, Slottable, composeRefs, mergeProps, mergePropsWithRef };\n","import { clsx, type ClassValue } from 'clsx';\nimport { twMerge } from 'tailwind-merge';\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n","'use client';\n\nimport * as React from 'react';\nimport { createContext, useContext } from 'react';\nimport { CheckIcon, LoaderCircleIcon } from 'lucide-react';\nimport { Slot } from '../lib/slot';\n\nimport { cn } from '../lib/utils';\n\n// Types\ntype StepperContextValue = {\n\tactiveStep: number;\n\tsetActiveStep: (step: number) => void;\n\torientation: 'horizontal' | 'vertical';\n};\n\ntype StepItemContextValue = {\n\tstep: number;\n\tstate: StepState;\n\tisDisabled: boolean;\n\tisLoading: boolean;\n};\n\ntype StepState = 'active' | 'completed' | 'inactive' | 'loading';\n\n// Contexts\nconst StepperContext = createContext<StepperContextValue | undefined>(undefined);\nconst StepItemContext = createContext<StepItemContextValue | undefined>(undefined);\n\nconst iconSwapClass =\n\t'transition-[opacity,scale,filter] duration-300 ease-[cubic-bezier(0.2,0,0,1)] motion-reduce:transition-none';\nconst iconSwapVisible = 'scale-100 opacity-100 blur-0';\nconst iconSwapHidden = 'scale-[0.25] opacity-0 blur-[4px]';\n\nconst useStepper = () => {\n\tconst context = useContext(StepperContext);\n\tif (!context) {\n\t\tthrow new Error('useStepper must be used within a Stepper');\n\t}\n\treturn context;\n};\n\nconst useStepItem = () => {\n\tconst context = useContext(StepItemContext);\n\tif (!context) {\n\t\tthrow new Error('useStepItem must be used within a StepperItem');\n\t}\n\treturn context;\n};\n\n// Components\ninterface StepperProps extends React.HTMLAttributes<HTMLDivElement> {\n\tdefaultValue?: number;\n\tvalue?: number;\n\tonValueChange?: (value: number) => void;\n\torientation?: 'horizontal' | 'vertical';\n}\n\nfunction Stepper({\n\tdefaultValue = 0,\n\tvalue,\n\tonValueChange,\n\torientation = 'horizontal',\n\tclassName,\n\t...props\n}: StepperProps) {\n\tconst [activeStep, setInternalStep] = React.useState(defaultValue);\n\n\tconst setActiveStep = React.useCallback(\n\t\t(step: number) => {\n\t\t\tif (value === undefined) {\n\t\t\t\tsetInternalStep(step);\n\t\t\t}\n\t\t\tonValueChange?.(step);\n\t\t},\n\t\t[value, onValueChange],\n\t);\n\n\tconst currentStep = value ?? activeStep;\n\n\treturn (\n\t\t<StepperContext.Provider\n\t\t\tvalue={{\n\t\t\t\tactiveStep: currentStep,\n\t\t\t\tsetActiveStep,\n\t\t\t\torientation,\n\t\t\t}}\n\t\t>\n\t\t\t<div\n\t\t\t\tdata-slot=\"stepper\"\n\t\t\t\tclassName={cn(\n\t\t\t\t\t`group/stepper inline-flex data-[orientation=horizontal]:w-full data-[orientation=horizontal]:flex-row\n\t\t\t\t\tdata-[orientation=vertical]:flex-col`,\n\t\t\t\t\tclassName,\n\t\t\t\t)}\n\t\t\t\tdata-orientation={orientation}\n\t\t\t\t{...props}\n\t\t\t/>\n\t\t</StepperContext.Provider>\n\t);\n}\n\n// StepperItem\ninterface StepperItemProps extends React.HTMLAttributes<HTMLDivElement> {\n\tstep: number;\n\tcompleted?: boolean;\n\tdisabled?: boolean;\n\tloading?: boolean;\n}\n\nfunction StepperItem({\n\tstep,\n\tcompleted = false,\n\tdisabled = false,\n\tloading = false,\n\tclassName,\n\tchildren,\n\t...props\n}: StepperItemProps) {\n\tconst { activeStep } = useStepper();\n\n\tconst state: StepState = completed || step < activeStep ? 'completed' : activeStep === step ? 'active' : 'inactive';\n\n\tconst isLoading = loading && step === activeStep;\n\n\treturn (\n\t\t<StepItemContext.Provider value={{ step, state, isDisabled: disabled, isLoading }}>\n\t\t\t<div\n\t\t\t\tdata-slot=\"stepper-item\"\n\t\t\t\tclassName={cn(\n\t\t\t\t\t`group/step flex items-center group-data-[orientation=horizontal]/stepper:flex-row\n\t\t\t\t\tgroup-data-[orientation=vertical]/stepper:flex-col`,\n\t\t\t\t\tclassName,\n\t\t\t\t)}\n\t\t\t\tdata-state={state}\n\t\t\t\t{...(isLoading ? { 'data-loading': true } : {})}\n\t\t\t\t{...props}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</div>\n\t\t</StepItemContext.Provider>\n\t);\n}\n\n// StepperTrigger\ninterface StepperTriggerProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n\tasChild?: boolean;\n\t/** Disables hover and press scaling when motion would distract. */\n\tstatic?: boolean;\n}\n\nfunction StepperTrigger({ asChild = false, static: isStatic, className, children, ...props }: StepperTriggerProps) {\n\tconst { setActiveStep } = useStepper();\n\tconst { step, isDisabled } = useStepItem();\n\n\tconst triggerClassName = cn(\n\t\t`focus-visible:border-ring focus-visible:ring-ring/50 inline-flex items-center gap-3 rounded-full transition-transform\n\t\tduration-150 ease-out outline-none focus-visible:z-10 focus-visible:ring-[3px]\n\t\tdisabled:pointer-events-none disabled:opacity-50`,\n\t\t!isStatic && 'motion-safe:hover:scale-105 motion-safe:active:not-disabled:scale-[0.96]',\n\t\tclassName,\n\t);\n\n\tif (asChild) {\n\t\treturn (\n\t\t\t<Slot\n\t\t\t\tdata-slot=\"stepper-trigger\"\n\t\t\t\tclassName={triggerClassName}\n\t\t\t\tonClick={() => setActiveStep(step)}\n\t\t\t\tdisabled={isDisabled}\n\t\t\t\t{...props}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</Slot>\n\t\t);\n\t}\n\n\treturn (\n\t\t<button\n\t\t\tdata-slot=\"stepper-trigger\"\n\t\t\tclassName={triggerClassName}\n\t\t\tonClick={() => setActiveStep(step)}\n\t\t\tdisabled={isDisabled}\n\t\t\t{...props}\n\t\t>\n\t\t\t{children}\n\t\t</button>\n\t);\n}\n\n// StepperIndicator\ninterface StepperIndicatorProps extends React.HTMLAttributes<HTMLDivElement> {\n\tasChild?: boolean;\n}\n\nfunction StepperIndicator({ asChild = false, className, children, ...props }: StepperIndicatorProps) {\n\tconst { state, step, isLoading } = useStepItem();\n\tconst showNumber = !isLoading && state !== 'completed';\n\tconst showCheck = !isLoading && state === 'completed';\n\n\treturn (\n\t\t<span\n\t\t\tdata-slot=\"stepper-indicator\"\n\t\t\tclassName={cn(\n\t\t\t\t`bg-muted text-muted-foreground data-[state=active]:bg-primary data-[state=completed]:bg-primary\n\t\t\t\t\tdata-[state=active]:text-primary-foreground data-[state=completed]:text-primary-foreground relative flex size-6\n\t\t\t\t\tshrink-0 items-center justify-center rounded-full text-xs font-medium transition-[color,background-color] duration-200 ease-out`,\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\tdata-state={state}\n\t\t\t{...props}\n\t\t>\n\t\t\t{asChild ? (\n\t\t\t\tchildren\n\t\t\t) : (\n\t\t\t\t<>\n\t\t\t\t\t<span className={cn('absolute', iconSwapClass, showNumber ? iconSwapVisible : iconSwapHidden)}>\n\t\t\t\t\t\t{step}\n\t\t\t\t\t</span>\n\t\t\t\t\t<CheckIcon\n\t\t\t\t\t\tclassName={cn('absolute', iconSwapClass, showCheck ? iconSwapVisible : iconSwapHidden)}\n\t\t\t\t\t\tsize={16}\n\t\t\t\t\t\taria-hidden='true'\n\t\t\t\t\t/>\n\t\t\t\t\t<span className={cn('absolute', iconSwapClass, isLoading ? iconSwapVisible : iconSwapHidden)}>\n\t\t\t\t\t\t<LoaderCircleIcon\n\t\t\t\t\t\t\tclassName={cn(isLoading && 'motion-safe:animate-spin')}\n\t\t\t\t\t\t\tsize={14}\n\t\t\t\t\t\t\taria-hidden='true'\n\t\t\t\t\t\t/>\n\t\t\t\t\t</span>\n\t\t\t\t</>\n\t\t\t)}\n\t\t</span>\n\t);\n}\n\n// StepperTitle\nfunction StepperTitle({ className, ...props }: React.HTMLAttributes<HTMLHeadingElement>) {\n\treturn (\n\t\t<h3\n\t\t\tdata-slot=\"stepper-title\"\n\t\t\tclassName={cn('text-sm font-medium transition-colors duration-200 ease-out', className)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\n// StepperDescription\nfunction StepperDescription({ className, ...props }: React.HTMLAttributes<HTMLParagraphElement>) {\n\treturn (\n\t\t<p\n\t\t\tdata-slot=\"stepper-description\"\n\t\t\tclassName={cn('text-muted-foreground text-sm transition-colors duration-200 ease-out', className)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\n// StepperSeparator\nfunction StepperSeparator({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) {\n\treturn (\n\t\t<div\n\t\t\tdata-slot=\"stepper-separator\"\n\t\t\tclassName={cn(\n\t\t\t\t`bg-muted group-data-[state=completed]/step:bg-primary m-0.5 transition-colors duration-200 ease-out\n\t\t\t\tgroup-data-[orientation=horizontal]/stepper:h-0.5 group-data-[orientation=horizontal]/stepper:w-full\n\t\t\t\tgroup-data-[orientation=horizontal]/stepper:flex-1 group-data-[orientation=vertical]/stepper:h-12\n\t\t\t\tgroup-data-[orientation=vertical]/stepper:w-0.5`,\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nexport { Stepper, StepperDescription, StepperIndicator, StepperItem, StepperSeparator, StepperTitle, StepperTrigger };\n"]}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
interface StepperProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
4
|
+
defaultValue?: number;
|
|
5
|
+
value?: number;
|
|
6
|
+
onValueChange?: (value: number) => void;
|
|
7
|
+
orientation?: 'horizontal' | 'vertical';
|
|
8
|
+
}
|
|
9
|
+
declare function Stepper({ defaultValue, value, onValueChange, orientation, className, ...props }: StepperProps): React.JSX.Element;
|
|
10
|
+
interface StepperItemProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
11
|
+
step: number;
|
|
12
|
+
completed?: boolean;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
loading?: boolean;
|
|
15
|
+
}
|
|
16
|
+
declare function StepperItem({ step, completed, disabled, loading, className, children, ...props }: StepperItemProps): React.JSX.Element;
|
|
17
|
+
interface StepperTriggerProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
18
|
+
asChild?: boolean;
|
|
19
|
+
/** Disables hover and press scaling when motion would distract. */
|
|
20
|
+
static?: boolean;
|
|
21
|
+
}
|
|
22
|
+
declare function StepperTrigger({ asChild, static: isStatic, className, children, ...props }: StepperTriggerProps): React.JSX.Element;
|
|
23
|
+
interface StepperIndicatorProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
24
|
+
asChild?: boolean;
|
|
25
|
+
}
|
|
26
|
+
declare function StepperIndicator({ asChild, className, children, ...props }: StepperIndicatorProps): React.JSX.Element;
|
|
27
|
+
declare function StepperTitle({ className, ...props }: React.HTMLAttributes<HTMLHeadingElement>): React.JSX.Element;
|
|
28
|
+
declare function StepperDescription({ className, ...props }: React.HTMLAttributes<HTMLParagraphElement>): React.JSX.Element;
|
|
29
|
+
declare function StepperSeparator({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): React.JSX.Element;
|
|
30
|
+
|
|
31
|
+
export { Stepper, StepperDescription, StepperIndicator, StepperItem, StepperSeparator, StepperTitle, StepperTrigger };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
1
|
import * as React from 'react';
|
|
3
2
|
|
|
4
3
|
interface StepperProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
@@ -7,24 +6,26 @@ interface StepperProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
7
6
|
onValueChange?: (value: number) => void;
|
|
8
7
|
orientation?: 'horizontal' | 'vertical';
|
|
9
8
|
}
|
|
10
|
-
declare function Stepper({ defaultValue, value, onValueChange, orientation, className, ...props }: StepperProps):
|
|
9
|
+
declare function Stepper({ defaultValue, value, onValueChange, orientation, className, ...props }: StepperProps): React.JSX.Element;
|
|
11
10
|
interface StepperItemProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
12
11
|
step: number;
|
|
13
12
|
completed?: boolean;
|
|
14
13
|
disabled?: boolean;
|
|
15
14
|
loading?: boolean;
|
|
16
15
|
}
|
|
17
|
-
declare function StepperItem({ step, completed, disabled, loading, className, children, ...props }: StepperItemProps):
|
|
16
|
+
declare function StepperItem({ step, completed, disabled, loading, className, children, ...props }: StepperItemProps): React.JSX.Element;
|
|
18
17
|
interface StepperTriggerProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {
|
|
19
18
|
asChild?: boolean;
|
|
19
|
+
/** Disables hover and press scaling when motion would distract. */
|
|
20
|
+
static?: boolean;
|
|
20
21
|
}
|
|
21
|
-
declare function StepperTrigger({ asChild, className, children, ...props }: StepperTriggerProps):
|
|
22
|
+
declare function StepperTrigger({ asChild, static: isStatic, className, children, ...props }: StepperTriggerProps): React.JSX.Element;
|
|
22
23
|
interface StepperIndicatorProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
23
24
|
asChild?: boolean;
|
|
24
25
|
}
|
|
25
|
-
declare function StepperIndicator({ asChild, className, children, ...props }: StepperIndicatorProps):
|
|
26
|
-
declare function StepperTitle({ className, ...props }: React.HTMLAttributes<HTMLHeadingElement>):
|
|
27
|
-
declare function StepperDescription({ className, ...props }: React.HTMLAttributes<HTMLParagraphElement>):
|
|
28
|
-
declare function StepperSeparator({ className, ...props }: React.HTMLAttributes<HTMLDivElement>):
|
|
26
|
+
declare function StepperIndicator({ asChild, className, children, ...props }: StepperIndicatorProps): React.JSX.Element;
|
|
27
|
+
declare function StepperTitle({ className, ...props }: React.HTMLAttributes<HTMLHeadingElement>): React.JSX.Element;
|
|
28
|
+
declare function StepperDescription({ className, ...props }: React.HTMLAttributes<HTMLParagraphElement>): React.JSX.Element;
|
|
29
|
+
declare function StepperSeparator({ className, ...props }: React.HTMLAttributes<HTMLDivElement>): React.JSX.Element;
|
|
29
30
|
|
|
30
31
|
export { Stepper, StepperDescription, StepperIndicator, StepperItem, StepperSeparator, StepperTitle, StepperTrigger };
|
|
@@ -84,6 +84,9 @@ function cn(...inputs) {
|
|
|
84
84
|
}
|
|
85
85
|
var StepperContext = createContext(void 0);
|
|
86
86
|
var StepItemContext = createContext(void 0);
|
|
87
|
+
var iconSwapClass = "transition-[opacity,scale,filter] duration-300 ease-[cubic-bezier(0.2,0,0,1)] motion-reduce:transition-none";
|
|
88
|
+
var iconSwapVisible = "scale-100 opacity-100 blur-0";
|
|
89
|
+
var iconSwapHidden = "scale-[0.25] opacity-0 blur-[4px]";
|
|
87
90
|
var useStepper = () => {
|
|
88
91
|
const context = useContext(StepperContext);
|
|
89
92
|
if (!context) {
|
|
@@ -169,13 +172,14 @@ function StepperItem({
|
|
|
169
172
|
}
|
|
170
173
|
) });
|
|
171
174
|
}
|
|
172
|
-
function StepperTrigger({ asChild = false, className, children, ...props }) {
|
|
175
|
+
function StepperTrigger({ asChild = false, static: isStatic, className, children, ...props }) {
|
|
173
176
|
const { setActiveStep } = useStepper();
|
|
174
177
|
const { step, isDisabled } = useStepItem();
|
|
175
178
|
const triggerClassName = cn(
|
|
176
|
-
`focus-visible:border-ring focus-visible:ring-ring/50 inline-flex items-center gap-3 rounded-full transition-
|
|
177
|
-
duration-
|
|
179
|
+
`focus-visible:border-ring focus-visible:ring-ring/50 inline-flex items-center gap-3 rounded-full transition-transform
|
|
180
|
+
duration-150 ease-out outline-none focus-visible:z-10 focus-visible:ring-[3px]
|
|
178
181
|
disabled:pointer-events-none disabled:opacity-50`,
|
|
182
|
+
!isStatic && "motion-safe:hover:scale-105 motion-safe:active:not-disabled:scale-[0.96]",
|
|
179
183
|
className
|
|
180
184
|
);
|
|
181
185
|
if (asChild) {
|
|
@@ -205,35 +209,38 @@ function StepperTrigger({ asChild = false, className, children, ...props }) {
|
|
|
205
209
|
}
|
|
206
210
|
function StepperIndicator({ asChild = false, className, children, ...props }) {
|
|
207
211
|
const { state, step, isLoading } = useStepItem();
|
|
212
|
+
const showNumber = !isLoading && state !== "completed";
|
|
213
|
+
const showCheck = !isLoading && state === "completed";
|
|
208
214
|
return /* @__PURE__ */ jsx(
|
|
209
215
|
"span",
|
|
210
216
|
{
|
|
211
217
|
"data-slot": "stepper-indicator",
|
|
212
218
|
className: cn(
|
|
213
219
|
`bg-muted text-muted-foreground data-[state=active]:bg-primary data-[state=completed]:bg-primary
|
|
214
|
-
|
|
215
|
-
|
|
220
|
+
data-[state=active]:text-primary-foreground data-[state=completed]:text-primary-foreground relative flex size-6
|
|
221
|
+
shrink-0 items-center justify-center rounded-full text-xs font-medium transition-[color,background-color] duration-200 ease-out`,
|
|
216
222
|
className
|
|
217
223
|
),
|
|
218
224
|
"data-state": state,
|
|
219
225
|
...props,
|
|
220
226
|
children: asChild ? children : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
221
|
-
/* @__PURE__ */ jsx(
|
|
222
|
-
"span",
|
|
223
|
-
{
|
|
224
|
-
className: "transition-all duration-200 ease-out group-data-loading/step:scale-75\n group-data-loading/step:opacity-0 group-data-loading/step:transition-none\n group-data-[state=completed]/step:scale-75 group-data-[state=completed]/step:opacity-0",
|
|
225
|
-
children: step
|
|
226
|
-
}
|
|
227
|
-
),
|
|
227
|
+
/* @__PURE__ */ jsx("span", { className: cn("absolute", iconSwapClass, showNumber ? iconSwapVisible : iconSwapHidden), children: step }),
|
|
228
228
|
/* @__PURE__ */ jsx(
|
|
229
229
|
CheckIcon,
|
|
230
230
|
{
|
|
231
|
-
className: "absolute
|
|
231
|
+
className: cn("absolute", iconSwapClass, showCheck ? iconSwapVisible : iconSwapHidden),
|
|
232
232
|
size: 16,
|
|
233
233
|
"aria-hidden": "true"
|
|
234
234
|
}
|
|
235
235
|
),
|
|
236
|
-
|
|
236
|
+
/* @__PURE__ */ jsx("span", { className: cn("absolute", iconSwapClass, isLoading ? iconSwapVisible : iconSwapHidden), children: /* @__PURE__ */ jsx(
|
|
237
|
+
LoaderCircleIcon,
|
|
238
|
+
{
|
|
239
|
+
className: cn(isLoading && "motion-safe:animate-spin"),
|
|
240
|
+
size: 14,
|
|
241
|
+
"aria-hidden": "true"
|
|
242
|
+
}
|
|
243
|
+
) })
|
|
237
244
|
] })
|
|
238
245
|
}
|
|
239
246
|
);
|
|
@@ -264,7 +271,7 @@ function StepperSeparator({ className, ...props }) {
|
|
|
264
271
|
{
|
|
265
272
|
"data-slot": "stepper-separator",
|
|
266
273
|
className: cn(
|
|
267
|
-
`bg-muted group-data-[state=completed]/step:bg-primary m-0.5 transition-
|
|
274
|
+
`bg-muted group-data-[state=completed]/step:bg-primary m-0.5 transition-colors duration-200 ease-out
|
|
268
275
|
group-data-[orientation=horizontal]/stepper:h-0.5 group-data-[orientation=horizontal]/stepper:w-full
|
|
269
276
|
group-data-[orientation=horizontal]/stepper:flex-1 group-data-[orientation=vertical]/stepper:h-12
|
|
270
277
|
group-data-[orientation=vertical]/stepper:w-0.5`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/lib/slot.tsx","../../src/lib/utils.ts","../../src/components/stepper.tsx"],"names":["React2","jsx","Fragment"],"mappings":";;;;;;;AAQA,SAAS,eAAkB,IAAA,EAA0D;AACpF,EAAA,OAAO,CAAC,IAAA,KAAS;A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C,gBAAA,EAAA,EAAiB,WAAU,cAAA,EAAe,IAAA,EAAM,EAAA,EAAI,aAAA,EAAY,QAAO,CAAA,EACzE;AAAA,OAAA,EAEF;AAAA;AAAA,GAEF;AAEF;AAGA,SAAS,YAAA,CAAa,EAAE,SAAA,EAAW,GAAG,OAAM,EAA6C;AACxF,EAAA,uBACCA,GAAAA;AAAA,IAAC,IAAA;AAAA,IAAA;AAAA,MACA,WAAA,EAAU,eAAA;AAAA,MACV,SAAA,EAAW,EAAA,CAAG,6DAAA,EAA+D,SAAS,CAAA;AAAA,MACrF,GAAG;AAAA;AAAA,GACL;AAEF;AAGA,SAAS,kBAAA,CAAmB,EAAE,SAAA,EAAW,GAAG,OAAM,EAA+C;AAChG,EAAA,uBACCA,GAAAA;AAAA,IAAC,GAAA;AAAA,IAAA;AAAA,MACA,WAAA,EAAU,qBAAA;AAAA,MACV,SAAA,EAAW,EAAA,CAAG,uEAAA,EAAyE,SAAS,CAAA;AAAA,MAC/F,GAAG;AAAA;AAAA,GACL;AAEF;AAGA,SAAS,gBAAA,CAAiB,EAAE,SAAA,EAAW,GAAG,OAAM,EAAyC;AACxF,EAAA,uBACCA,GAAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACA,WAAA,EAAU,mBAAA;AAAA,MACV,SAAA,EAAW,EAAA;AAAA,QACV,CAAA;AAAA;AAAA;AAAA,mDAAA,CAAA;AAAA,QAIA;AAAA,OACD;AAAA,MACC,GAAG;AAAA;AAAA,GACL;AAEF","file":"stepper.js","sourcesContent":["'use client';\n\nimport * as React from 'react';\n\n/**\n * Merges refs into a single callback ref.\n * React 19 compatible - handles refs as regular props.\n */\nfunction composeRefs<T>(...refs: (React.Ref<T> | undefined)[]): React.RefCallback<T> {\n\treturn (node) => {\n\t\trefs.forEach((ref) => {\n\t\t\tif (typeof ref === 'function') {\n\t\t\t\tref(node);\n\t\t\t} else if (ref != null) {\n\t\t\t\t(ref as React.MutableRefObject<T | null>).current = node;\n\t\t\t}\n\t\t});\n\t};\n}\n\n/**\n * Merges props, handling special cases for className, style, and event handlers.\n * Excludes 'ref' from merging as it's handled separately.\n */\nfunction mergeProps(\n\tslotProps: Record<string, unknown>,\n\tchildProps: Record<string, unknown>,\n): Record<string, unknown> {\n\tconst overrideProps: Record<string, unknown> = { ...childProps };\n\n\tfor (const propName in childProps) {\n\t\t// Skip ref - handled separately for composition\n\t\tif (propName === 'ref') continue;\n\n\t\tconst slotPropValue = slotProps[propName];\n\t\tconst childPropValue = childProps[propName];\n\n\t\t// Compose event handlers\n\t\tif (/^on[A-Z]/.test(propName) && typeof slotPropValue === 'function' && typeof childPropValue === 'function') {\n\t\t\toverrideProps[propName] = (...args: unknown[]) => {\n\t\t\t\tchildPropValue(...args);\n\t\t\t\tslotPropValue(...args);\n\t\t\t};\n\t\t}\n\t\t// Merge className\n\t\telse if (propName === 'className' && typeof slotPropValue === 'string' && typeof childPropValue === 'string') {\n\t\t\toverrideProps[propName] = `${slotPropValue} ${childPropValue}`.trim();\n\t\t}\n\t\t// Merge style\n\t\telse if (propName === 'style' && typeof slotPropValue === 'object' && typeof childPropValue === 'object') {\n\t\t\toverrideProps[propName] = { ...slotPropValue, ...childPropValue };\n\t\t}\n\t}\n\n\treturn { ...slotProps, ...overrideProps };\n}\n\n/**\n * Merges props from a parent component with a child element's props,\n * including proper ref composition. Use this in render prop patterns\n * where the parent needs to merge its props with the child's.\n *\n * @param parentProps - Props from the parent component (e.g., triggerProps from Base UI)\n * @param childElement - The child React element whose props will be merged\n * @returns Merged props object ready to pass to React.cloneElement\n */\nfunction mergePropsWithRef<T = HTMLElement>(\n\tparentProps: Record<string, unknown>,\n\tchildElement: React.ReactElement,\n): Record<string, unknown> {\n\tconst childProps = childElement.props as Record<string, unknown>;\n\tconst parentRef = parentProps.ref as React.Ref<T> | undefined;\n\tconst childRef = childProps.ref as React.Ref<T> | undefined;\n\n\tconst mergedProps = mergeProps(parentProps, childProps);\n\n\t// Compose refs if either exists\n\tif (parentRef || childRef) {\n\t\tmergedProps.ref = composeRefs(parentRef, childRef);\n\t}\n\n\treturn mergedProps;\n}\n\n/**\n * Check if a value is a valid slottable child (single React element).\n */\nfunction isSlottable(child: React.ReactNode): child is React.ReactElement {\n\treturn React.isValidElement(child);\n}\n\nexport interface SlotProps extends React.HTMLAttributes<HTMLElement> {\n\tchildren?: React.ReactNode;\n}\n\n/**\n * Slot component - renders its child element with merged props.\n * Used for the `asChild` pattern where parent props are passed to child.\n * React 19 compatible - accesses ref from props instead of element.ref.\n */\nconst Slot = React.forwardRef<HTMLElement, SlotProps>((props, forwardedRef) => {\n\tconst { children, ...slotProps } = props;\n\n\t// Handle single child\n\tif (isSlottable(children)) {\n\t\tconst childProps = children.props as Record<string, unknown>;\n\t\t// React 19: ref is now a regular prop, not element.ref\n\t\tconst childRef = childProps.ref as React.Ref<HTMLElement> | undefined;\n\n\t\treturn React.cloneElement(children, {\n\t\t\t...mergeProps(slotProps, childProps),\n\t\t\tref: forwardedRef ? composeRefs(forwardedRef, childRef) : childRef,\n\t\t} as React.Attributes);\n\t}\n\n\t// Handle multiple children - wrap Slottable content\n\tif (React.Children.count(children) > 1) {\n\t\tconst childrenArray = React.Children.toArray(children);\n\t\tconst slottableChild = childrenArray.find(\n\t\t\t(child) => React.isValidElement(child) && child.type === Slottable,\n\t\t) as React.ReactElement<{ children: React.ReactNode }> | undefined;\n\n\t\tif (slottableChild) {\n\t\t\tconst newElement = slottableChild.props.children;\n\t\t\tif (isSlottable(newElement)) {\n\t\t\t\tconst newElementProps = newElement.props as Record<string, unknown> & { children?: React.ReactNode };\n\t\t\t\tconst newChildren = childrenArray.map((child) => {\n\t\t\t\t\tif (child === slottableChild) {\n\t\t\t\t\t\treturn React.Children.count(newElementProps.children) > 1\n\t\t\t\t\t\t\t? React.Children.only(null)\n\t\t\t\t\t\t\t: newElementProps.children;\n\t\t\t\t\t}\n\t\t\t\t\treturn child;\n\t\t\t\t});\n\n\t\t\t\t// React 19: ref is now a regular prop\n\t\t\t\tconst childRef = newElementProps.ref as React.Ref<HTMLElement> | undefined;\n\n\t\t\t\treturn React.cloneElement(newElement, {\n\t\t\t\t\t...mergeProps(slotProps, newElementProps),\n\t\t\t\t\tref: forwardedRef ? composeRefs(forwardedRef, childRef) : childRef,\n\t\t\t\t\tchildren: newChildren,\n\t\t\t\t} as React.Attributes);\n\t\t\t}\n\t\t}\n\t}\n\n\t// Fallback: render children as-is (shouldn't normally happen with proper usage)\n\treturn <>{children}</>;\n});\n\nSlot.displayName = 'Slot';\n\n/**\n * Slottable component - marks content that should receive slot props.\n * Used when Slot has multiple children and you want to specify which one receives props.\n */\nfunction Slottable({ children }: { children: React.ReactNode }) {\n\treturn <>{children}</>;\n}\n\nexport { Slot, Slottable, composeRefs, mergeProps, mergePropsWithRef };\n","import { clsx, type ClassValue } from 'clsx';\nimport { twMerge } from 'tailwind-merge';\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n","'use client';\n\nimport * as React from 'react';\nimport { createContext, useContext } from 'react';\nimport { CheckIcon, LoaderCircleIcon } from 'lucide-react';\nimport { Slot } from '../lib/slot';\n\nimport { cn } from '../lib/utils';\n\n// Types\ntype StepperContextValue = {\n\tactiveStep: number;\n\tsetActiveStep: (step: number) => void;\n\torientation: 'horizontal' | 'vertical';\n};\n\ntype StepItemContextValue = {\n\tstep: number;\n\tstate: StepState;\n\tisDisabled: boolean;\n\tisLoading: boolean;\n};\n\ntype StepState = 'active' | 'completed' | 'inactive' | 'loading';\n\n// Contexts\nconst StepperContext = createContext<StepperContextValue | undefined>(undefined);\nconst StepItemContext = createContext<StepItemContextValue | undefined>(undefined);\n\nconst useStepper = () => {\n\tconst context = useContext(StepperContext);\n\tif (!context) {\n\t\tthrow new Error('useStepper must be used within a Stepper');\n\t}\n\treturn context;\n};\n\nconst useStepItem = () => {\n\tconst context = useContext(StepItemContext);\n\tif (!context) {\n\t\tthrow new Error('useStepItem must be used within a StepperItem');\n\t}\n\treturn context;\n};\n\n// Components\ninterface StepperProps extends React.HTMLAttributes<HTMLDivElement> {\n\tdefaultValue?: number;\n\tvalue?: number;\n\tonValueChange?: (value: number) => void;\n\torientation?: 'horizontal' | 'vertical';\n}\n\nfunction Stepper({\n\tdefaultValue = 0,\n\tvalue,\n\tonValueChange,\n\torientation = 'horizontal',\n\tclassName,\n\t...props\n}: StepperProps) {\n\tconst [activeStep, setInternalStep] = React.useState(defaultValue);\n\n\tconst setActiveStep = React.useCallback(\n\t\t(step: number) => {\n\t\t\tif (value === undefined) {\n\t\t\t\tsetInternalStep(step);\n\t\t\t}\n\t\t\tonValueChange?.(step);\n\t\t},\n\t\t[value, onValueChange],\n\t);\n\n\tconst currentStep = value ?? activeStep;\n\n\treturn (\n\t\t<StepperContext.Provider\n\t\t\tvalue={{\n\t\t\t\tactiveStep: currentStep,\n\t\t\t\tsetActiveStep,\n\t\t\t\torientation,\n\t\t\t}}\n\t\t>\n\t\t\t<div\n\t\t\t\tdata-slot=\"stepper\"\n\t\t\t\tclassName={cn(\n\t\t\t\t\t`group/stepper inline-flex data-[orientation=horizontal]:w-full data-[orientation=horizontal]:flex-row\n\t\t\t\t\tdata-[orientation=vertical]:flex-col`,\n\t\t\t\t\tclassName,\n\t\t\t\t)}\n\t\t\t\tdata-orientation={orientation}\n\t\t\t\t{...props}\n\t\t\t/>\n\t\t</StepperContext.Provider>\n\t);\n}\n\n// StepperItem\ninterface StepperItemProps extends React.HTMLAttributes<HTMLDivElement> {\n\tstep: number;\n\tcompleted?: boolean;\n\tdisabled?: boolean;\n\tloading?: boolean;\n}\n\nfunction StepperItem({\n\tstep,\n\tcompleted = false,\n\tdisabled = false,\n\tloading = false,\n\tclassName,\n\tchildren,\n\t...props\n}: StepperItemProps) {\n\tconst { activeStep } = useStepper();\n\n\tconst state: StepState = completed || step < activeStep ? 'completed' : activeStep === step ? 'active' : 'inactive';\n\n\tconst isLoading = loading && step === activeStep;\n\n\treturn (\n\t\t<StepItemContext.Provider value={{ step, state, isDisabled: disabled, isLoading }}>\n\t\t\t<div\n\t\t\t\tdata-slot=\"stepper-item\"\n\t\t\t\tclassName={cn(\n\t\t\t\t\t`group/step flex items-center group-data-[orientation=horizontal]/stepper:flex-row\n\t\t\t\t\tgroup-data-[orientation=vertical]/stepper:flex-col`,\n\t\t\t\t\tclassName,\n\t\t\t\t)}\n\t\t\t\tdata-state={state}\n\t\t\t\t{...(isLoading ? { 'data-loading': true } : {})}\n\t\t\t\t{...props}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</div>\n\t\t</StepItemContext.Provider>\n\t);\n}\n\n// StepperTrigger\ninterface StepperTriggerProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n\tasChild?: boolean;\n}\n\nfunction StepperTrigger({ asChild = false, className, children, ...props }: StepperTriggerProps) {\n\tconst { setActiveStep } = useStepper();\n\tconst { step, isDisabled } = useStepItem();\n\n\tconst triggerClassName = cn(\n\t\t`focus-visible:border-ring focus-visible:ring-ring/50 inline-flex items-center gap-3 rounded-full transition-all\n\t\tduration-200 ease-out outline-none hover:scale-105 focus-visible:z-10 focus-visible:ring-[3px] active:scale-95\n\t\tdisabled:pointer-events-none disabled:opacity-50`,\n\t\tclassName,\n\t);\n\n\tif (asChild) {\n\t\treturn (\n\t\t\t<Slot\n\t\t\t\tdata-slot=\"stepper-trigger\"\n\t\t\t\tclassName={triggerClassName}\n\t\t\t\tonClick={() => setActiveStep(step)}\n\t\t\t\tdisabled={isDisabled}\n\t\t\t\t{...props}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</Slot>\n\t\t);\n\t}\n\n\treturn (\n\t\t<button\n\t\t\tdata-slot=\"stepper-trigger\"\n\t\t\tclassName={triggerClassName}\n\t\t\tonClick={() => setActiveStep(step)}\n\t\t\tdisabled={isDisabled}\n\t\t\t{...props}\n\t\t>\n\t\t\t{children}\n\t\t</button>\n\t);\n}\n\n// StepperIndicator\ninterface StepperIndicatorProps extends React.HTMLAttributes<HTMLDivElement> {\n\tasChild?: boolean;\n}\n\nfunction StepperIndicator({ asChild = false, className, children, ...props }: StepperIndicatorProps) {\n\tconst { state, step, isLoading } = useStepItem();\n\n\treturn (\n\t\t<span\n\t\t\tdata-slot=\"stepper-indicator\"\n\t\t\tclassName={cn(\n\t\t\t\t`bg-muted text-muted-foreground data-[state=active]:bg-primary data-[state=completed]:bg-primary\n\t\t\t\tdata-[state=active]:text-primary-foreground data-[state=completed]:text-primary-foreground relative flex size-6\n\t\t\t\tshrink-0 items-center justify-center rounded-full text-xs font-medium transition-all duration-300 ease-out`,\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\tdata-state={state}\n\t\t\t{...props}\n\t\t>\n\t\t\t{asChild ? (\n\t\t\t\tchildren\n\t\t\t) : (\n\t\t\t\t<>\n\t\t\t\t\t<span\n\t\t\t\t\t\tclassName='transition-all duration-200 ease-out group-data-loading/step:scale-75\n\t\t\t\t\t\t\tgroup-data-loading/step:opacity-0 group-data-loading/step:transition-none\n\t\t\t\t\t\t\tgroup-data-[state=completed]/step:scale-75 group-data-[state=completed]/step:opacity-0'\n\t\t\t\t\t>\n\t\t\t\t\t\t{step}\n\t\t\t\t\t</span>\n\t\t\t\t\t<CheckIcon\n\t\t\t\t\t\tclassName='absolute scale-75 opacity-0 transition-all duration-200 ease-out\n\t\t\t\t\t\t\tgroup-data-[state=completed]/step:scale-100 group-data-[state=completed]/step:opacity-100'\n\t\t\t\t\t\tsize={16}\n\t\t\t\t\t\taria-hidden='true'\n\t\t\t\t\t/>\n\t\t\t\t\t{isLoading && (\n\t\t\t\t\t\t<span className='absolute transition-all duration-200 ease-out'>\n\t\t\t\t\t\t\t<LoaderCircleIcon className='animate-spin' size={14} aria-hidden='true' />\n\t\t\t\t\t\t</span>\n\t\t\t\t\t)}\n\t\t\t\t</>\n\t\t\t)}\n\t\t</span>\n\t);\n}\n\n// StepperTitle\nfunction StepperTitle({ className, ...props }: React.HTMLAttributes<HTMLHeadingElement>) {\n\treturn (\n\t\t<h3\n\t\t\tdata-slot=\"stepper-title\"\n\t\t\tclassName={cn('text-sm font-medium transition-colors duration-200 ease-out', className)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\n// StepperDescription\nfunction StepperDescription({ className, ...props }: React.HTMLAttributes<HTMLParagraphElement>) {\n\treturn (\n\t\t<p\n\t\t\tdata-slot=\"stepper-description\"\n\t\t\tclassName={cn('text-muted-foreground text-sm transition-colors duration-200 ease-out', className)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\n// StepperSeparator\nfunction StepperSeparator({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) {\n\treturn (\n\t\t<div\n\t\t\tdata-slot=\"stepper-separator\"\n\t\t\tclassName={cn(\n\t\t\t\t`bg-muted group-data-[state=completed]/step:bg-primary m-0.5 transition-all duration-500 ease-out\n\t\t\t\tgroup-data-[orientation=horizontal]/stepper:h-0.5 group-data-[orientation=horizontal]/stepper:w-full\n\t\t\t\tgroup-data-[orientation=horizontal]/stepper:flex-1 group-data-[orientation=vertical]/stepper:h-12\n\t\t\t\tgroup-data-[orientation=vertical]/stepper:w-0.5`,\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nexport { Stepper, StepperDescription, StepperIndicator, StepperItem, StepperSeparator, StepperTitle, StepperTrigger };\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/lib/slot.tsx","../../src/lib/utils.ts","../../src/components/stepper.tsx"],"names":["React2","jsx","Fragment"],"mappings":";;;;;;;AAQA,SAAS,eAAkB,IAAA,EAA0D;AACpF,EAAA,OAAO,CAAC,IAAA,KAAS;AAChB,IAAA,IAAA,CAAK,OAAA,CAAQ,CAAC,GAAA,KAAQ;AACrB,MAAA,IAAI,OAAO,QAAQ,UAAA,EAAY;AAC9B,QAAA,GAAA,CAAI,IAAI,CAAA;AAAA,MACT,CAAA,MAAA,IAAW,OAAO,IAAA,EAAM;AACvB,QAAC,IAAyC,OAAA,GAAU,IAAA;AAAA,MACrD;AAAA,IAC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use client';\n\nimport * as React from 'react';\n\n/**\n * Merges refs into a single callback ref.\n * React 19 compatible - handles refs as regular props.\n */\nfunction composeRefs<T>(...refs: (React.Ref<T> | undefined)[]): React.RefCallback<T> {\n\treturn (node) => {\n\t\trefs.forEach((ref) => {\n\t\t\tif (typeof ref === 'function') {\n\t\t\t\tref(node);\n\t\t\t} else if (ref != null) {\n\t\t\t\t(ref as React.MutableRefObject<T | null>).current = node;\n\t\t\t}\n\t\t});\n\t};\n}\n\n/**\n * Merges props, handling special cases for className, style, and event handlers.\n * Excludes 'ref' from merging as it's handled separately.\n */\nfunction mergeProps(\n\tslotProps: Record<string, unknown>,\n\tchildProps: Record<string, unknown>,\n): Record<string, unknown> {\n\tconst overrideProps: Record<string, unknown> = { ...childProps };\n\n\tfor (const propName in childProps) {\n\t\t// Skip ref - handled separately for composition\n\t\tif (propName === 'ref') continue;\n\n\t\tconst slotPropValue = slotProps[propName];\n\t\tconst childPropValue = childProps[propName];\n\n\t\t// Compose event handlers\n\t\tif (/^on[A-Z]/.test(propName) && typeof slotPropValue === 'function' && typeof childPropValue === 'function') {\n\t\t\toverrideProps[propName] = (...args: unknown[]) => {\n\t\t\t\tchildPropValue(...args);\n\t\t\t\tslotPropValue(...args);\n\t\t\t};\n\t\t}\n\t\t// Merge className\n\t\telse if (propName === 'className' && typeof slotPropValue === 'string' && typeof childPropValue === 'string') {\n\t\t\toverrideProps[propName] = `${slotPropValue} ${childPropValue}`.trim();\n\t\t}\n\t\t// Merge style\n\t\telse if (propName === 'style' && typeof slotPropValue === 'object' && typeof childPropValue === 'object') {\n\t\t\toverrideProps[propName] = { ...slotPropValue, ...childPropValue };\n\t\t}\n\t}\n\n\treturn { ...slotProps, ...overrideProps };\n}\n\n/**\n * Merges props from a parent component with a child element's props,\n * including proper ref composition. Use this in render prop patterns\n * where the parent needs to merge its props with the child's.\n *\n * @param parentProps - Props from the parent component (e.g., triggerProps from Base UI)\n * @param childElement - The child React element whose props will be merged\n * @returns Merged props object ready to pass to React.cloneElement\n */\nfunction mergePropsWithRef<T = HTMLElement>(\n\tparentProps: Record<string, unknown>,\n\tchildElement: React.ReactElement,\n): Record<string, unknown> {\n\tconst childProps = childElement.props as Record<string, unknown>;\n\tconst parentRef = parentProps.ref as React.Ref<T> | undefined;\n\tconst childRef = childProps.ref as React.Ref<T> | undefined;\n\n\tconst mergedProps = mergeProps(parentProps, childProps);\n\n\t// Compose refs if either exists\n\tif (parentRef || childRef) {\n\t\tmergedProps.ref = composeRefs(parentRef, childRef);\n\t}\n\n\treturn mergedProps;\n}\n\n/**\n * Check if a value is a valid slottable child (single React element).\n */\nfunction isSlottable(child: React.ReactNode): child is React.ReactElement {\n\treturn React.isValidElement(child);\n}\n\nexport interface SlotProps extends React.HTMLAttributes<HTMLElement> {\n\tchildren?: React.ReactNode;\n}\n\n/**\n * Slot component - renders its child element with merged props.\n * Used for the `asChild` pattern where parent props are passed to child.\n * React 19 compatible - accesses ref from props instead of element.ref.\n */\nconst Slot = React.forwardRef<HTMLElement, SlotProps>((props, forwardedRef) => {\n\tconst { children, ...slotProps } = props;\n\n\t// Handle single child\n\tif (isSlottable(children)) {\n\t\tconst childProps = children.props as Record<string, unknown>;\n\t\t// React 19: ref is now a regular prop, not element.ref\n\t\tconst childRef = childProps.ref as React.Ref<HTMLElement> | undefined;\n\n\t\treturn React.cloneElement(children, {\n\t\t\t...mergeProps(slotProps, childProps),\n\t\t\tref: forwardedRef ? composeRefs(forwardedRef, childRef) : childRef,\n\t\t} as React.Attributes);\n\t}\n\n\t// Handle multiple children - wrap Slottable content\n\tif (React.Children.count(children) > 1) {\n\t\tconst childrenArray = React.Children.toArray(children);\n\t\tconst slottableChild = childrenArray.find(\n\t\t\t(child) => React.isValidElement(child) && child.type === Slottable,\n\t\t) as React.ReactElement<{ children: React.ReactNode }> | undefined;\n\n\t\tif (slottableChild) {\n\t\t\tconst newElement = slottableChild.props.children;\n\t\t\tif (isSlottable(newElement)) {\n\t\t\t\tconst newElementProps = newElement.props as Record<string, unknown> & { children?: React.ReactNode };\n\t\t\t\tconst newChildren = childrenArray.map((child) => {\n\t\t\t\t\tif (child === slottableChild) {\n\t\t\t\t\t\treturn React.Children.count(newElementProps.children) > 1\n\t\t\t\t\t\t\t? React.Children.only(null)\n\t\t\t\t\t\t\t: newElementProps.children;\n\t\t\t\t\t}\n\t\t\t\t\treturn child;\n\t\t\t\t});\n\n\t\t\t\t// React 19: ref is now a regular prop\n\t\t\t\tconst childRef = newElementProps.ref as React.Ref<HTMLElement> | undefined;\n\n\t\t\t\treturn React.cloneElement(newElement, {\n\t\t\t\t\t...mergeProps(slotProps, newElementProps),\n\t\t\t\t\tref: forwardedRef ? composeRefs(forwardedRef, childRef) : childRef,\n\t\t\t\t\tchildren: newChildren,\n\t\t\t\t} as React.Attributes);\n\t\t\t}\n\t\t}\n\t}\n\n\t// Fallback: render children as-is (shouldn't normally happen with proper usage)\n\treturn <>{children}</>;\n});\n\nSlot.displayName = 'Slot';\n\n/**\n * Slottable component - marks content that should receive slot props.\n * Used when Slot has multiple children and you want to specify which one receives props.\n */\nfunction Slottable({ children }: { children: React.ReactNode }) {\n\treturn <>{children}</>;\n}\n\nexport { Slot, Slottable, composeRefs, mergeProps, mergePropsWithRef };\n","import { clsx, type ClassValue } from 'clsx';\nimport { twMerge } from 'tailwind-merge';\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs));\n}\n","'use client';\n\nimport * as React from 'react';\nimport { createContext, useContext } from 'react';\nimport { CheckIcon, LoaderCircleIcon } from 'lucide-react';\nimport { Slot } from '../lib/slot';\n\nimport { cn } from '../lib/utils';\n\n// Types\ntype StepperContextValue = {\n\tactiveStep: number;\n\tsetActiveStep: (step: number) => void;\n\torientation: 'horizontal' | 'vertical';\n};\n\ntype StepItemContextValue = {\n\tstep: number;\n\tstate: StepState;\n\tisDisabled: boolean;\n\tisLoading: boolean;\n};\n\ntype StepState = 'active' | 'completed' | 'inactive' | 'loading';\n\n// Contexts\nconst StepperContext = createContext<StepperContextValue | undefined>(undefined);\nconst StepItemContext = createContext<StepItemContextValue | undefined>(undefined);\n\nconst iconSwapClass =\n\t'transition-[opacity,scale,filter] duration-300 ease-[cubic-bezier(0.2,0,0,1)] motion-reduce:transition-none';\nconst iconSwapVisible = 'scale-100 opacity-100 blur-0';\nconst iconSwapHidden = 'scale-[0.25] opacity-0 blur-[4px]';\n\nconst useStepper = () => {\n\tconst context = useContext(StepperContext);\n\tif (!context) {\n\t\tthrow new Error('useStepper must be used within a Stepper');\n\t}\n\treturn context;\n};\n\nconst useStepItem = () => {\n\tconst context = useContext(StepItemContext);\n\tif (!context) {\n\t\tthrow new Error('useStepItem must be used within a StepperItem');\n\t}\n\treturn context;\n};\n\n// Components\ninterface StepperProps extends React.HTMLAttributes<HTMLDivElement> {\n\tdefaultValue?: number;\n\tvalue?: number;\n\tonValueChange?: (value: number) => void;\n\torientation?: 'horizontal' | 'vertical';\n}\n\nfunction Stepper({\n\tdefaultValue = 0,\n\tvalue,\n\tonValueChange,\n\torientation = 'horizontal',\n\tclassName,\n\t...props\n}: StepperProps) {\n\tconst [activeStep, setInternalStep] = React.useState(defaultValue);\n\n\tconst setActiveStep = React.useCallback(\n\t\t(step: number) => {\n\t\t\tif (value === undefined) {\n\t\t\t\tsetInternalStep(step);\n\t\t\t}\n\t\t\tonValueChange?.(step);\n\t\t},\n\t\t[value, onValueChange],\n\t);\n\n\tconst currentStep = value ?? activeStep;\n\n\treturn (\n\t\t<StepperContext.Provider\n\t\t\tvalue={{\n\t\t\t\tactiveStep: currentStep,\n\t\t\t\tsetActiveStep,\n\t\t\t\torientation,\n\t\t\t}}\n\t\t>\n\t\t\t<div\n\t\t\t\tdata-slot=\"stepper\"\n\t\t\t\tclassName={cn(\n\t\t\t\t\t`group/stepper inline-flex data-[orientation=horizontal]:w-full data-[orientation=horizontal]:flex-row\n\t\t\t\t\tdata-[orientation=vertical]:flex-col`,\n\t\t\t\t\tclassName,\n\t\t\t\t)}\n\t\t\t\tdata-orientation={orientation}\n\t\t\t\t{...props}\n\t\t\t/>\n\t\t</StepperContext.Provider>\n\t);\n}\n\n// StepperItem\ninterface StepperItemProps extends React.HTMLAttributes<HTMLDivElement> {\n\tstep: number;\n\tcompleted?: boolean;\n\tdisabled?: boolean;\n\tloading?: boolean;\n}\n\nfunction StepperItem({\n\tstep,\n\tcompleted = false,\n\tdisabled = false,\n\tloading = false,\n\tclassName,\n\tchildren,\n\t...props\n}: StepperItemProps) {\n\tconst { activeStep } = useStepper();\n\n\tconst state: StepState = completed || step < activeStep ? 'completed' : activeStep === step ? 'active' : 'inactive';\n\n\tconst isLoading = loading && step === activeStep;\n\n\treturn (\n\t\t<StepItemContext.Provider value={{ step, state, isDisabled: disabled, isLoading }}>\n\t\t\t<div\n\t\t\t\tdata-slot=\"stepper-item\"\n\t\t\t\tclassName={cn(\n\t\t\t\t\t`group/step flex items-center group-data-[orientation=horizontal]/stepper:flex-row\n\t\t\t\t\tgroup-data-[orientation=vertical]/stepper:flex-col`,\n\t\t\t\t\tclassName,\n\t\t\t\t)}\n\t\t\t\tdata-state={state}\n\t\t\t\t{...(isLoading ? { 'data-loading': true } : {})}\n\t\t\t\t{...props}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</div>\n\t\t</StepItemContext.Provider>\n\t);\n}\n\n// StepperTrigger\ninterface StepperTriggerProps extends React.ButtonHTMLAttributes<HTMLButtonElement> {\n\tasChild?: boolean;\n\t/** Disables hover and press scaling when motion would distract. */\n\tstatic?: boolean;\n}\n\nfunction StepperTrigger({ asChild = false, static: isStatic, className, children, ...props }: StepperTriggerProps) {\n\tconst { setActiveStep } = useStepper();\n\tconst { step, isDisabled } = useStepItem();\n\n\tconst triggerClassName = cn(\n\t\t`focus-visible:border-ring focus-visible:ring-ring/50 inline-flex items-center gap-3 rounded-full transition-transform\n\t\tduration-150 ease-out outline-none focus-visible:z-10 focus-visible:ring-[3px]\n\t\tdisabled:pointer-events-none disabled:opacity-50`,\n\t\t!isStatic && 'motion-safe:hover:scale-105 motion-safe:active:not-disabled:scale-[0.96]',\n\t\tclassName,\n\t);\n\n\tif (asChild) {\n\t\treturn (\n\t\t\t<Slot\n\t\t\t\tdata-slot=\"stepper-trigger\"\n\t\t\t\tclassName={triggerClassName}\n\t\t\t\tonClick={() => setActiveStep(step)}\n\t\t\t\tdisabled={isDisabled}\n\t\t\t\t{...props}\n\t\t\t>\n\t\t\t\t{children}\n\t\t\t</Slot>\n\t\t);\n\t}\n\n\treturn (\n\t\t<button\n\t\t\tdata-slot=\"stepper-trigger\"\n\t\t\tclassName={triggerClassName}\n\t\t\tonClick={() => setActiveStep(step)}\n\t\t\tdisabled={isDisabled}\n\t\t\t{...props}\n\t\t>\n\t\t\t{children}\n\t\t</button>\n\t);\n}\n\n// StepperIndicator\ninterface StepperIndicatorProps extends React.HTMLAttributes<HTMLDivElement> {\n\tasChild?: boolean;\n}\n\nfunction StepperIndicator({ asChild = false, className, children, ...props }: StepperIndicatorProps) {\n\tconst { state, step, isLoading } = useStepItem();\n\tconst showNumber = !isLoading && state !== 'completed';\n\tconst showCheck = !isLoading && state === 'completed';\n\n\treturn (\n\t\t<span\n\t\t\tdata-slot=\"stepper-indicator\"\n\t\t\tclassName={cn(\n\t\t\t\t`bg-muted text-muted-foreground data-[state=active]:bg-primary data-[state=completed]:bg-primary\n\t\t\t\t\tdata-[state=active]:text-primary-foreground data-[state=completed]:text-primary-foreground relative flex size-6\n\t\t\t\t\tshrink-0 items-center justify-center rounded-full text-xs font-medium transition-[color,background-color] duration-200 ease-out`,\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\tdata-state={state}\n\t\t\t{...props}\n\t\t>\n\t\t\t{asChild ? (\n\t\t\t\tchildren\n\t\t\t) : (\n\t\t\t\t<>\n\t\t\t\t\t<span className={cn('absolute', iconSwapClass, showNumber ? iconSwapVisible : iconSwapHidden)}>\n\t\t\t\t\t\t{step}\n\t\t\t\t\t</span>\n\t\t\t\t\t<CheckIcon\n\t\t\t\t\t\tclassName={cn('absolute', iconSwapClass, showCheck ? iconSwapVisible : iconSwapHidden)}\n\t\t\t\t\t\tsize={16}\n\t\t\t\t\t\taria-hidden='true'\n\t\t\t\t\t/>\n\t\t\t\t\t<span className={cn('absolute', iconSwapClass, isLoading ? iconSwapVisible : iconSwapHidden)}>\n\t\t\t\t\t\t<LoaderCircleIcon\n\t\t\t\t\t\t\tclassName={cn(isLoading && 'motion-safe:animate-spin')}\n\t\t\t\t\t\t\tsize={14}\n\t\t\t\t\t\t\taria-hidden='true'\n\t\t\t\t\t\t/>\n\t\t\t\t\t</span>\n\t\t\t\t</>\n\t\t\t)}\n\t\t</span>\n\t);\n}\n\n// StepperTitle\nfunction StepperTitle({ className, ...props }: React.HTMLAttributes<HTMLHeadingElement>) {\n\treturn (\n\t\t<h3\n\t\t\tdata-slot=\"stepper-title\"\n\t\t\tclassName={cn('text-sm font-medium transition-colors duration-200 ease-out', className)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\n// StepperDescription\nfunction StepperDescription({ className, ...props }: React.HTMLAttributes<HTMLParagraphElement>) {\n\treturn (\n\t\t<p\n\t\t\tdata-slot=\"stepper-description\"\n\t\t\tclassName={cn('text-muted-foreground text-sm transition-colors duration-200 ease-out', className)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\n// StepperSeparator\nfunction StepperSeparator({ className, ...props }: React.HTMLAttributes<HTMLDivElement>) {\n\treturn (\n\t\t<div\n\t\t\tdata-slot=\"stepper-separator\"\n\t\t\tclassName={cn(\n\t\t\t\t`bg-muted group-data-[state=completed]/step:bg-primary m-0.5 transition-colors duration-200 ease-out\n\t\t\t\tgroup-data-[orientation=horizontal]/stepper:h-0.5 group-data-[orientation=horizontal]/stepper:w-full\n\t\t\t\tgroup-data-[orientation=horizontal]/stepper:flex-1 group-data-[orientation=vertical]/stepper:h-12\n\t\t\t\tgroup-data-[orientation=vertical]/stepper:w-0.5`,\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n}\n\nexport { Stepper, StepperDescription, StepperIndicator, StepperItem, StepperSeparator, StepperTitle, StepperTrigger };\n"]}
|