@datum-cloud/datum-ui 0.2.0-alpha.2 → 0.2.0-alpha.4
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/README.md +336 -0
- package/dist/alert/index.mjs +3 -0
- package/dist/alert-BC2Mccfo.mjs +95 -0
- package/dist/autocomplete/index.mjs +7 -0
- package/dist/autocomplete-DZtI97HP.mjs +295 -0
- package/dist/avatar-stack/index.mjs +5 -0
- package/dist/avatar-stack-JCfBlPB9.mjs +80 -0
- package/dist/badge/index.mjs +3 -0
- package/dist/badge-bFgeYceE.mjs +185 -0
- package/dist/breadcrumb/index.mjs +4 -0
- package/dist/breadcrumb-BGYJgom_.mjs +71 -0
- package/dist/button/index.mjs +4 -0
- package/dist/button-AzpnV-WB.mjs +49 -0
- package/dist/button-C1wRfGtT.mjs +230 -0
- package/dist/button-group/index.mjs +5 -0
- package/dist/button-group-C1IB2K5s.mjs +40 -0
- package/dist/calendar/index.mjs +5 -0
- package/dist/calendar-DlIHeWb0.mjs +113 -0
- package/dist/card/index.mjs +4 -0
- package/dist/card-3Kd0VdNf.mjs +63 -0
- package/dist/chart/index.mjs +4 -0
- package/dist/chart-BZqUKpkh.mjs +143 -0
- package/dist/checkbox/index.mjs +4 -0
- package/dist/checkbox-LG1OKTpG.mjs +34 -0
- package/dist/col-lrLMZaTJ.mjs +184 -0
- package/dist/collapsible/index.mjs +3 -0
- package/dist/collapsible-Bt9UYfv3.mjs +9 -0
- package/dist/command/index.mjs +5 -0
- package/dist/command-s0Yv3abE.mjs +86 -0
- package/dist/components/features/date-picker/index.d.ts +3 -0
- package/dist/components/features/date-picker/index.d.ts.map +1 -0
- package/dist/components/features/dropzone/index.d.ts +1 -0
- package/dist/components/features/dropzone/index.d.ts.map +1 -1
- package/dist/date-picker/index.mjs +9 -0
- package/dist/{datum.provider-D6VMjSV0.mjs → datum.provider-B77goJgl.mjs} +1 -1
- package/dist/dialog/index.mjs +5 -0
- package/dist/dialog-DXBaT9gA.mjs +86 -0
- package/dist/dialog-bnMMf9GD.mjs +73 -0
- package/dist/dropdown/index.mjs +3 -0
- package/dist/dropdown-DtSa_lqc.mjs +112 -0
- package/dist/dropzone/index.mjs +5 -0
- package/dist/dropzone-BkOnwrS4.mjs +221 -0
- package/dist/empty-content/index.mjs +3 -0
- package/dist/empty-content-BM9rzI13.mjs +196 -0
- package/dist/exports/map.d.ts +3 -0
- package/dist/exports/map.d.ts.map +1 -0
- package/dist/form/index.mjs +146 -0
- package/dist/grid/index.mjs +3 -0
- package/dist/hooks/index.mjs +2 -3
- package/dist/hover-card/index.mjs +4 -0
- package/dist/hover-card-CUPfFUqE.mjs +33 -0
- package/dist/icon-wrapper-9ticVbRL.mjs +14 -0
- package/dist/icons/index.mjs +3 -3
- package/dist/index.mjs +66 -8
- package/dist/input/index.mjs +5 -0
- package/dist/input-DuyjEKEW.mjs +17 -0
- package/dist/input-fzXBheCN.mjs +17 -0
- package/dist/input-group/index.mjs +7 -0
- package/dist/input-group-CPaFSTEV.mjs +80 -0
- package/dist/input-number/index.mjs +6 -0
- package/dist/input-number-9o62JHRl.mjs +106 -0
- package/dist/input-with-addons/index.mjs +3 -0
- package/dist/input-with-addons-BQn7KCTU.mjs +30 -0
- package/dist/label/index.mjs +4 -0
- package/dist/label-_ste_Re3.mjs +44 -0
- package/dist/link-button-TIF2Zdrk.mjs +36 -0
- package/dist/loader-overlay/index.mjs +3 -0
- package/dist/loader-overlay-DUaQSZQP.mjs +17 -0
- package/dist/map/index.mjs +13 -0
- package/dist/map-Df8QMcX0.mjs +1094 -0
- package/dist/more-actions/index.mjs +5 -0
- package/dist/more-actions-Ch1f6Mh3.mjs +54 -0
- package/dist/nprogress/index.mjs +32 -0
- package/dist/page-title/index.mjs +3 -0
- package/dist/page-title-BJuo81rT.mjs +26 -0
- package/dist/popover/index.mjs +4 -0
- package/dist/popover-SQlKSz6L.mjs +36 -0
- package/dist/provider/index.mjs +4 -0
- package/dist/radio-group/index.mjs +4 -0
- package/dist/radio-group-Oshv0b-U.mjs +49 -0
- package/dist/select/index.mjs +4 -0
- package/dist/select-DVlEzD2W.mjs +166 -0
- package/dist/separator/index.mjs +4 -0
- package/dist/separator-T2ppyD-8.mjs +18 -0
- package/dist/sheet/index.mjs +5 -0
- package/dist/sheet-BKiCwtNO.mjs +45 -0
- package/dist/sheet-CtnP6gTD.mjs +77 -0
- package/dist/sidebar/index.mjs +11 -0
- package/dist/sidebar-DfqezV8t.mjs +945 -0
- package/dist/skeleton/index.mjs +4 -0
- package/dist/skeleton-vzbxA-DQ.mjs +13 -0
- package/dist/spinner/index.mjs +4 -0
- package/dist/spinner-BE7k2bAD.mjs +16 -0
- package/dist/{icon-wrapper-BgPkifId.mjs → spinner.icon-Bg8zgGh0.mjs} +1 -12
- package/dist/stepper/index.mjs +5 -0
- package/dist/stepper-SWB-u_nM.mjs +323 -0
- package/dist/style.css +3 -0
- package/dist/switch/index.mjs +4 -0
- package/dist/switch-Calk7Gyw.mjs +32 -0
- package/dist/table/index.mjs +4 -0
- package/dist/table-CsXBcQLI.mjs +68 -0
- package/dist/tabs/index.mjs +3 -0
- package/dist/tabs-D8n-dqnw.mjs +52 -0
- package/dist/tag-input/index.mjs +5 -0
- package/dist/tag-input-Di7SDNbK.mjs +284 -0
- package/dist/task-queue/index.mjs +7 -0
- package/dist/task-queue-dropdown-DW72ikDH.mjs +1356 -0
- package/dist/textarea/index.mjs +5 -0
- package/dist/textarea-CxE3YbC7.mjs +17 -0
- package/dist/textarea-QYRcDEpK.mjs +15 -0
- package/dist/theme/index.mjs +4 -0
- package/dist/theme-script-XBouzsNR.mjs +66 -0
- package/dist/to-api-format-C2xjQUcI.mjs +1506 -0
- package/dist/toast/index.mjs +3 -0
- package/dist/tooltip/index.mjs +4 -0
- package/dist/tooltip-Dd3ActSS.mjs +74 -0
- package/dist/typography/index.mjs +3 -0
- package/dist/typography-UA7ZZvgJ.mjs +200 -0
- package/dist/use-copy-to-clipboard-ki-WoTml.mjs +31 -0
- package/dist/use-stepper-BaToCYMs.mjs +2017 -0
- package/dist/{use-copy-to-clipboard-BfrpD6G8.mjs → use-toast-mdn_CqRY.mjs} +34 -27
- package/dist/utils/index.mjs +0 -1
- package/dist/utils-Bfgoe-Gm.mjs +20 -0
- package/dist/visually-hidden/index.mjs +3 -0
- package/dist/visuallyhidden-aaTUk4Yo.mjs +7 -0
- package/package.json +208 -8
- package/dist/components/index.mjs +0 -8
- package/dist/providers/index.mjs +0 -4
- package/dist/theme-script-DHyLk25i.mjs +0 -11128
- /package/dist/{close.icon-chkXPAUC.mjs → close.icon-CMNMoXM_.mjs} +0 -0
- /package/dist/{map-leaflet-imports-OKaoesjZ.mjs → map-leaflet-imports-CdzvEnzY.mjs} +0 -0
- /package/dist/{theme.provider-DpFLwtHe.mjs → theme.provider-DgGshapa.mjs} +0 -0
- /package/dist/{use-debounce-BYB-jPeX.mjs → use-debounce-DQ1tmxOL.mjs} +0 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { t as cn } from "./utils-Bfgoe-Gm.mjs";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
|
|
4
|
+
//#region ../shadcn/ui/skeleton.tsx
|
|
5
|
+
function Skeleton({ className, ...props }) {
|
|
6
|
+
return /* @__PURE__ */ jsx("div", {
|
|
7
|
+
className: cn("bg-muted animate-pulse rounded-md", className),
|
|
8
|
+
...props
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
//#endregion
|
|
13
|
+
export { Skeleton as t };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { t as cn } from "./utils-Bfgoe-Gm.mjs";
|
|
2
|
+
import { Loader2Icon } from "lucide-react";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
|
|
5
|
+
//#region ../shadcn/ui/spinner.tsx
|
|
6
|
+
function Spinner({ className, ...props }) {
|
|
7
|
+
return /* @__PURE__ */ jsx(Loader2Icon, {
|
|
8
|
+
role: "status",
|
|
9
|
+
"aria-label": "Loading",
|
|
10
|
+
className: cn("size-4 animate-spin", className),
|
|
11
|
+
...props
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
//#endregion
|
|
16
|
+
export { Spinner as t };
|
|
@@ -47,15 +47,4 @@ function SpinnerIcon({ size, className, trackClassName = "text-border", indicato
|
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
//#endregion
|
|
50
|
-
|
|
51
|
-
function Icon({ icon: IconComponent, strokeWidth = 1, absoluteStrokeWidth = true, size = 16, ...props }) {
|
|
52
|
-
return /* @__PURE__ */ jsx(IconComponent, {
|
|
53
|
-
...props,
|
|
54
|
-
strokeWidth,
|
|
55
|
-
absoluteStrokeWidth,
|
|
56
|
-
size
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
//#endregion
|
|
61
|
-
export { SpinnerIcon as n, Icon as t };
|
|
50
|
+
export { SpinnerIcon as t };
|
|
@@ -0,0 +1,323 @@
|
|
|
1
|
+
import { t as cn } from "./cn-DWCc1QRE.mjs";
|
|
2
|
+
import { t as Button } from "./button-AzpnV-WB.mjs";
|
|
3
|
+
import { cva } from "class-variance-authority";
|
|
4
|
+
import * as React$1 from "react";
|
|
5
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
7
|
+
import * as Stepperize from "@stepperize/react";
|
|
8
|
+
|
|
9
|
+
//#region src/components/features/stepper/stepper.tsx
|
|
10
|
+
const StepperContext = React$1.createContext(null);
|
|
11
|
+
function useStepperProvider() {
|
|
12
|
+
const context = React$1.use(StepperContext);
|
|
13
|
+
if (!context) throw new Error("useStepper must be used within a StepperProvider.");
|
|
14
|
+
return context;
|
|
15
|
+
}
|
|
16
|
+
const classForNavigationList = cva("flex gap-2", { variants: { variant: {
|
|
17
|
+
horizontal: "flex-row items-center justify-between",
|
|
18
|
+
vertical: "flex-col",
|
|
19
|
+
circle: "flex-row items-center justify-between"
|
|
20
|
+
} } });
|
|
21
|
+
const classForSeparator = cva([
|
|
22
|
+
"bg-muted",
|
|
23
|
+
"data-[state=completed]:bg-primary data-[disabled]:opacity-50",
|
|
24
|
+
"transition-all duration-300 ease-in-out"
|
|
25
|
+
], { variants: {
|
|
26
|
+
orientation: {
|
|
27
|
+
horizontal: "h-0.5 flex-1",
|
|
28
|
+
vertical: "h-full w-0.5"
|
|
29
|
+
},
|
|
30
|
+
labelOrientation: { vertical: "absolute left-[calc(50%+30px)] right-[calc(-50%+20px)] top-5 block shrink-0" }
|
|
31
|
+
} });
|
|
32
|
+
function defineStepper(...steps) {
|
|
33
|
+
const { Scoped, useStepper, steps: stepList, Stepper: StepperizePrimitives } = Stepperize.defineStepper(...steps);
|
|
34
|
+
const StepperContainer = ({ children, className, ...props }) => {
|
|
35
|
+
const methods = useStepper();
|
|
36
|
+
return /* @__PURE__ */ jsx("div", {
|
|
37
|
+
"date-component": "stepper",
|
|
38
|
+
className: cn("w-full", className),
|
|
39
|
+
...props,
|
|
40
|
+
children: typeof children === "function" ? children({ methods }) : children
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
return {
|
|
44
|
+
steps: stepList,
|
|
45
|
+
useStepper,
|
|
46
|
+
Stepper: {
|
|
47
|
+
...StepperizePrimitives,
|
|
48
|
+
Provider: ({ variant = "horizontal", labelOrientation = "horizontal", tracking = false, children, className, ...props }) => {
|
|
49
|
+
return /* @__PURE__ */ jsx(StepperContext, {
|
|
50
|
+
value: {
|
|
51
|
+
variant,
|
|
52
|
+
labelOrientation,
|
|
53
|
+
tracking
|
|
54
|
+
},
|
|
55
|
+
children: /* @__PURE__ */ jsx(Scoped, {
|
|
56
|
+
initialStep: props.initialStep,
|
|
57
|
+
initialMetadata: props.initialMetadata,
|
|
58
|
+
children: /* @__PURE__ */ jsx(StepperContainer, {
|
|
59
|
+
className,
|
|
60
|
+
...props,
|
|
61
|
+
children
|
|
62
|
+
})
|
|
63
|
+
})
|
|
64
|
+
});
|
|
65
|
+
},
|
|
66
|
+
Navigation: ({ children, "aria-label": ariaLabel = "Stepper Navigation", ...props }) => {
|
|
67
|
+
const { variant } = useStepperProvider();
|
|
68
|
+
return /* @__PURE__ */ jsx("nav", {
|
|
69
|
+
"date-component": "stepper-navigation",
|
|
70
|
+
"aria-label": ariaLabel,
|
|
71
|
+
role: "tablist",
|
|
72
|
+
...props,
|
|
73
|
+
children: /* @__PURE__ */ jsx("ol", {
|
|
74
|
+
"date-component": "stepper-navigation-list",
|
|
75
|
+
className: classForNavigationList({ variant }),
|
|
76
|
+
children
|
|
77
|
+
})
|
|
78
|
+
});
|
|
79
|
+
},
|
|
80
|
+
Step: ({ children, className, icon, ...props }) => {
|
|
81
|
+
const { variant, labelOrientation } = useStepperProvider();
|
|
82
|
+
const stepper = useStepper();
|
|
83
|
+
const steps = stepList;
|
|
84
|
+
const stepIndex = stepper.lookup.getIndex(props.of);
|
|
85
|
+
const step = steps[stepIndex];
|
|
86
|
+
const currentIndex = stepper.lookup.getIndex(stepper.state.current.data.id);
|
|
87
|
+
const isLast = stepper.lookup.getLast().id === props.of;
|
|
88
|
+
const isActive = stepper.state.current.data.id === props.of;
|
|
89
|
+
const dataState = getStepState(currentIndex, stepIndex);
|
|
90
|
+
const childMap = useStepChildren(children);
|
|
91
|
+
const title = childMap.get("title");
|
|
92
|
+
const description = childMap.get("description");
|
|
93
|
+
const panel = childMap.get("panel");
|
|
94
|
+
if (variant === "circle") return /* @__PURE__ */ jsxs("li", {
|
|
95
|
+
"date-component": "stepper-step",
|
|
96
|
+
className: cn("flex shrink-0 items-center gap-4 rounded-md transition-colors", className),
|
|
97
|
+
children: [/* @__PURE__ */ jsx(CircleStepIndicator, {
|
|
98
|
+
currentStep: stepIndex + 1,
|
|
99
|
+
totalSteps: steps.length
|
|
100
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
101
|
+
"date-component": "stepper-step-content",
|
|
102
|
+
className: "flex flex-col items-start gap-1",
|
|
103
|
+
children: [title, description]
|
|
104
|
+
})]
|
|
105
|
+
});
|
|
106
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
107
|
+
/* @__PURE__ */ jsxs("li", {
|
|
108
|
+
"date-component": "stepper-step",
|
|
109
|
+
className: cn([
|
|
110
|
+
"group peer relative flex items-center gap-2",
|
|
111
|
+
"data-[variant=vertical]:flex-row",
|
|
112
|
+
"data-[label-orientation=vertical]:w-full",
|
|
113
|
+
"data-[label-orientation=vertical]:flex-col",
|
|
114
|
+
"data-[label-orientation=vertical]:justify-center"
|
|
115
|
+
]),
|
|
116
|
+
"data-variant": variant,
|
|
117
|
+
"data-label-orientation": labelOrientation,
|
|
118
|
+
"data-state": dataState,
|
|
119
|
+
"data-disabled": props.disabled,
|
|
120
|
+
children: [
|
|
121
|
+
/* @__PURE__ */ jsx(Button, {
|
|
122
|
+
id: `step-${step.id}`,
|
|
123
|
+
"date-component": "stepper-step-indicator",
|
|
124
|
+
type: "button",
|
|
125
|
+
role: "tab",
|
|
126
|
+
tabIndex: dataState !== "inactive" ? 0 : -1,
|
|
127
|
+
className: cn("rounded-full", className),
|
|
128
|
+
variant: dataState !== "inactive" ? "default" : "secondary",
|
|
129
|
+
size: "icon",
|
|
130
|
+
"aria-controls": `step-panel-${props.of}`,
|
|
131
|
+
"aria-current": isActive ? "step" : void 0,
|
|
132
|
+
"aria-posinset": stepIndex + 1,
|
|
133
|
+
"aria-setsize": steps.length,
|
|
134
|
+
"aria-selected": isActive,
|
|
135
|
+
onKeyDown: (e) => onStepKeyDown(e, stepper.lookup.getNext(props.of), stepper.lookup.getPrev(props.of)),
|
|
136
|
+
...props,
|
|
137
|
+
children: icon ?? stepIndex + 1
|
|
138
|
+
}),
|
|
139
|
+
variant === "horizontal" && labelOrientation === "vertical" && /* @__PURE__ */ jsx(StepperSeparator, {
|
|
140
|
+
orientation: "horizontal",
|
|
141
|
+
labelOrientation,
|
|
142
|
+
isLast,
|
|
143
|
+
state: dataState,
|
|
144
|
+
disabled: props.disabled
|
|
145
|
+
}),
|
|
146
|
+
/* @__PURE__ */ jsxs("div", {
|
|
147
|
+
"date-component": "stepper-step-content",
|
|
148
|
+
className: "flex flex-col items-start",
|
|
149
|
+
children: [title, description]
|
|
150
|
+
})
|
|
151
|
+
]
|
|
152
|
+
}),
|
|
153
|
+
variant === "horizontal" && labelOrientation === "horizontal" && /* @__PURE__ */ jsx(StepperSeparator, {
|
|
154
|
+
orientation: "horizontal",
|
|
155
|
+
isLast,
|
|
156
|
+
state: dataState,
|
|
157
|
+
disabled: props.disabled
|
|
158
|
+
}),
|
|
159
|
+
variant === "vertical" && /* @__PURE__ */ jsxs("div", {
|
|
160
|
+
className: "flex gap-4",
|
|
161
|
+
children: [!isLast && /* @__PURE__ */ jsx("div", {
|
|
162
|
+
className: "flex justify-center ps-[calc(var(--spacing)_*_4.5_-_1px)]",
|
|
163
|
+
children: /* @__PURE__ */ jsx(StepperSeparator, {
|
|
164
|
+
orientation: "vertical",
|
|
165
|
+
isLast,
|
|
166
|
+
state: dataState,
|
|
167
|
+
disabled: props.disabled
|
|
168
|
+
})
|
|
169
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
170
|
+
className: "my-3 flex-1 ps-4",
|
|
171
|
+
children: panel
|
|
172
|
+
})]
|
|
173
|
+
})
|
|
174
|
+
] });
|
|
175
|
+
},
|
|
176
|
+
Title,
|
|
177
|
+
Description,
|
|
178
|
+
Panel: ({ children, asChild, ...props }) => {
|
|
179
|
+
const Comp = asChild ? Slot : "div";
|
|
180
|
+
const { tracking } = useStepperProvider();
|
|
181
|
+
return /* @__PURE__ */ jsx(Comp, {
|
|
182
|
+
"date-component": "stepper-step-panel",
|
|
183
|
+
ref: (node) => scrollIntoStepperPanel(node, tracking),
|
|
184
|
+
...props,
|
|
185
|
+
children
|
|
186
|
+
});
|
|
187
|
+
},
|
|
188
|
+
Controls: ({ children, className, asChild, ...props }) => {
|
|
189
|
+
return /* @__PURE__ */ jsx(asChild ? Slot : "div", {
|
|
190
|
+
"date-component": "stepper-controls",
|
|
191
|
+
className: cn("flex justify-end gap-4", className),
|
|
192
|
+
...props,
|
|
193
|
+
children
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
function Title({ children, className, asChild, ...props }) {
|
|
200
|
+
return /* @__PURE__ */ jsx(asChild ? Slot : "h4", {
|
|
201
|
+
"date-component": "stepper-step-title",
|
|
202
|
+
className: cn("text-base font-medium", className),
|
|
203
|
+
...props,
|
|
204
|
+
children
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
function Description({ children, className, asChild, ...props }) {
|
|
208
|
+
return /* @__PURE__ */ jsx(asChild ? Slot : "p", {
|
|
209
|
+
"date-component": "stepper-step-description",
|
|
210
|
+
className: cn("text-muted-foreground text-sm", className),
|
|
211
|
+
...props,
|
|
212
|
+
children
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
function StepperSeparator({ orientation, isLast, labelOrientation, state, disabled }) {
|
|
216
|
+
if (isLast) return null;
|
|
217
|
+
return /* @__PURE__ */ jsx("div", {
|
|
218
|
+
"date-component": "stepper-separator",
|
|
219
|
+
"data-orientation": orientation,
|
|
220
|
+
"data-state": state,
|
|
221
|
+
"data-disabled": disabled,
|
|
222
|
+
role: "separator",
|
|
223
|
+
tabIndex: -1,
|
|
224
|
+
className: classForSeparator({
|
|
225
|
+
orientation,
|
|
226
|
+
labelOrientation
|
|
227
|
+
})
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
function CircleStepIndicator({ currentStep, totalSteps, size = 80, strokeWidth = 6 }) {
|
|
231
|
+
const radius = (size - strokeWidth) / 2;
|
|
232
|
+
const circumference = radius * 2 * Math.PI;
|
|
233
|
+
const dashOffset = circumference - circumference * (currentStep / totalSteps * 100) / 100;
|
|
234
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
235
|
+
"date-component": "stepper-step-indicator",
|
|
236
|
+
role: "progressbar",
|
|
237
|
+
"aria-valuenow": currentStep,
|
|
238
|
+
"aria-valuemin": 1,
|
|
239
|
+
"aria-valuemax": totalSteps,
|
|
240
|
+
tabIndex: -1,
|
|
241
|
+
className: "relative inline-flex items-center justify-center",
|
|
242
|
+
children: [/* @__PURE__ */ jsxs("svg", {
|
|
243
|
+
width: size,
|
|
244
|
+
height: size,
|
|
245
|
+
children: [
|
|
246
|
+
/* @__PURE__ */ jsx("title", { children: "Step Indicator" }),
|
|
247
|
+
/* @__PURE__ */ jsx("circle", {
|
|
248
|
+
cx: size / 2,
|
|
249
|
+
cy: size / 2,
|
|
250
|
+
r: radius,
|
|
251
|
+
fill: "none",
|
|
252
|
+
stroke: "currentColor",
|
|
253
|
+
strokeWidth,
|
|
254
|
+
className: "text-muted-foreground"
|
|
255
|
+
}),
|
|
256
|
+
/* @__PURE__ */ jsx("circle", {
|
|
257
|
+
cx: size / 2,
|
|
258
|
+
cy: size / 2,
|
|
259
|
+
r: radius,
|
|
260
|
+
fill: "none",
|
|
261
|
+
stroke: "currentColor",
|
|
262
|
+
strokeWidth,
|
|
263
|
+
strokeDasharray: circumference,
|
|
264
|
+
strokeDashoffset: dashOffset,
|
|
265
|
+
className: "text-primary transition-all duration-300 ease-in-out",
|
|
266
|
+
transform: `rotate(-90 ${size / 2} ${size / 2})`
|
|
267
|
+
})
|
|
268
|
+
]
|
|
269
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
270
|
+
className: "absolute inset-0 flex items-center justify-center",
|
|
271
|
+
children: /* @__PURE__ */ jsxs("span", {
|
|
272
|
+
className: "text-sm font-medium",
|
|
273
|
+
"aria-live": "polite",
|
|
274
|
+
children: [
|
|
275
|
+
currentStep,
|
|
276
|
+
" ",
|
|
277
|
+
"of",
|
|
278
|
+
totalSteps
|
|
279
|
+
]
|
|
280
|
+
})
|
|
281
|
+
})]
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
function scrollIntoStepperPanel(node, tracking) {
|
|
285
|
+
if (tracking) node?.scrollIntoView({
|
|
286
|
+
behavior: "smooth",
|
|
287
|
+
block: "center"
|
|
288
|
+
});
|
|
289
|
+
}
|
|
290
|
+
function useStepChildren(children) {
|
|
291
|
+
return React$1.useMemo(() => extractChildren(children), [children]);
|
|
292
|
+
}
|
|
293
|
+
function extractChildren(children) {
|
|
294
|
+
const childrenArray = React$1.Children.toArray(children);
|
|
295
|
+
const map = /* @__PURE__ */ new Map();
|
|
296
|
+
for (const child of childrenArray) if (React$1.isValidElement(child)) if (child.type === Title) map.set("title", child);
|
|
297
|
+
else if (child.type === Description) map.set("description", child);
|
|
298
|
+
else map.set("panel", child);
|
|
299
|
+
return map;
|
|
300
|
+
}
|
|
301
|
+
function onStepKeyDown(e, nextStep, prevStep) {
|
|
302
|
+
const { key } = e;
|
|
303
|
+
const directions = {
|
|
304
|
+
next: ["ArrowRight", "ArrowDown"],
|
|
305
|
+
prev: ["ArrowLeft", "ArrowUp"]
|
|
306
|
+
};
|
|
307
|
+
if (directions.next.includes(key) || directions.prev.includes(key)) {
|
|
308
|
+
const direction = directions.next.includes(key) ? "next" : "prev";
|
|
309
|
+
const step = direction === "next" ? nextStep : prevStep;
|
|
310
|
+
if (!step) return;
|
|
311
|
+
const stepElement = document.getElementById(`step-${step.id}`);
|
|
312
|
+
if (!stepElement) return;
|
|
313
|
+
if (stepElement.parentElement?.getAttribute("data-state") !== "inactive" || direction === "prev") stepElement.focus();
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
function getStepState(currentIndex, stepIndex) {
|
|
317
|
+
if (currentIndex === stepIndex) return "active";
|
|
318
|
+
if (currentIndex > stepIndex) return "completed";
|
|
319
|
+
return "inactive";
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
//#endregion
|
|
323
|
+
export { defineStepper as t };
|
package/dist/style.css
CHANGED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { t as cn } from "./cn-DWCc1QRE.mjs";
|
|
2
|
+
import { t as cn$1 } from "./utils-Bfgoe-Gm.mjs";
|
|
3
|
+
import "react";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
import * as SwitchPrimitive from "@radix-ui/react-switch";
|
|
6
|
+
|
|
7
|
+
//#region ../shadcn/ui/switch.tsx
|
|
8
|
+
function Switch$1({ className, ...props }) {
|
|
9
|
+
return /* @__PURE__ */ jsx(SwitchPrimitive.Root, {
|
|
10
|
+
"data-slot": "switch",
|
|
11
|
+
className: cn$1("peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50", className),
|
|
12
|
+
...props,
|
|
13
|
+
children: /* @__PURE__ */ jsx(SwitchPrimitive.Thumb, {
|
|
14
|
+
"data-slot": "switch-thumb",
|
|
15
|
+
className: cn$1("bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0")
|
|
16
|
+
})
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
//#endregion
|
|
21
|
+
//#region src/components/base/switch/switch.tsx
|
|
22
|
+
function Switch({ ref, className, ...props }) {
|
|
23
|
+
return /* @__PURE__ */ jsx(Switch$1, {
|
|
24
|
+
ref,
|
|
25
|
+
className: cn(className),
|
|
26
|
+
...props
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
Switch.displayName = "Switch";
|
|
30
|
+
|
|
31
|
+
//#endregion
|
|
32
|
+
export { Switch as t };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import "../utils-Bfgoe-Gm.mjs";
|
|
2
|
+
import { a as TableFooter, c as TableRow, i as TableCell, n as TableBody, o as TableHead, r as TableCaption, s as TableHeader, t as Table } from "../table-CsXBcQLI.mjs";
|
|
3
|
+
|
|
4
|
+
export { Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow };
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { t as cn } from "./utils-Bfgoe-Gm.mjs";
|
|
2
|
+
import "react";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
|
|
5
|
+
//#region ../shadcn/ui/table.tsx
|
|
6
|
+
const Table = ({ className, ...props }) => {
|
|
7
|
+
return /* @__PURE__ */ jsx("div", {
|
|
8
|
+
"data-slot": "table-container",
|
|
9
|
+
className: "relative w-full overflow-x-auto",
|
|
10
|
+
children: /* @__PURE__ */ jsx("table", {
|
|
11
|
+
"data-slot": "table",
|
|
12
|
+
className: cn("w-full caption-bottom text-sm", className),
|
|
13
|
+
...props
|
|
14
|
+
})
|
|
15
|
+
});
|
|
16
|
+
};
|
|
17
|
+
const TableHeader = ({ className, ...props }) => {
|
|
18
|
+
return /* @__PURE__ */ jsx("thead", {
|
|
19
|
+
"data-slot": "table-header",
|
|
20
|
+
className: cn("[&_tr]:border-b", className),
|
|
21
|
+
...props
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
const TableBody = ({ className, ...props }) => {
|
|
25
|
+
return /* @__PURE__ */ jsx("tbody", {
|
|
26
|
+
"data-slot": "table-body",
|
|
27
|
+
className: cn("[&_tr:last-child]:border-0", className),
|
|
28
|
+
...props
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
const TableFooter = ({ className, ...props }) => {
|
|
32
|
+
return /* @__PURE__ */ jsx("tfoot", {
|
|
33
|
+
"data-slot": "table-footer",
|
|
34
|
+
className: cn("bg-muted/50 border-t font-medium [&>tr]:last:border-b-0", className),
|
|
35
|
+
...props
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
const TableRow = ({ className, ...props }) => {
|
|
39
|
+
return /* @__PURE__ */ jsx("tr", {
|
|
40
|
+
"data-slot": "table-row",
|
|
41
|
+
className: cn("hover:bg-muted/50 data-[state=selected]:bg-muted border-b transition-colors", className),
|
|
42
|
+
...props
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
const TableHead = ({ className, ...props }) => {
|
|
46
|
+
return /* @__PURE__ */ jsx("th", {
|
|
47
|
+
"data-slot": "table-head",
|
|
48
|
+
className: cn("text-muted-foreground h-10 px-2 text-left align-middle font-medium whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]", className),
|
|
49
|
+
...props
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
const TableCell = ({ className, ...props }) => {
|
|
53
|
+
return /* @__PURE__ */ jsx("td", {
|
|
54
|
+
"data-slot": "table-cell",
|
|
55
|
+
className: cn("p-2 align-middle whitespace-nowrap [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]", className),
|
|
56
|
+
...props
|
|
57
|
+
});
|
|
58
|
+
};
|
|
59
|
+
const TableCaption = ({ className, ...props }) => {
|
|
60
|
+
return /* @__PURE__ */ jsx("caption", {
|
|
61
|
+
"data-slot": "table-caption",
|
|
62
|
+
className: cn("text-muted-foreground mt-4 text-sm", className),
|
|
63
|
+
...props
|
|
64
|
+
});
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
//#endregion
|
|
68
|
+
export { TableFooter as a, TableRow as c, TableCell as i, TableBody as n, TableHead as o, TableCaption as r, TableHeader as s, Table as t };
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { t as cn } from "./cn-DWCc1QRE.mjs";
|
|
2
|
+
import "react";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
import * as TabsPrimitive from "@radix-ui/react-tabs";
|
|
5
|
+
|
|
6
|
+
//#region src/components/base/tabs/tabs.tsx
|
|
7
|
+
/**
|
|
8
|
+
* Datum Tabs Component
|
|
9
|
+
* Extends shadcn Tabs with:
|
|
10
|
+
* - TabsLinkTrigger for router-agnostic link integration
|
|
11
|
+
* - Dark mode customizations
|
|
12
|
+
*/
|
|
13
|
+
function Tabs({ className, ...props }) {
|
|
14
|
+
return /* @__PURE__ */ jsx(TabsPrimitive.Root, {
|
|
15
|
+
className: cn("flex flex-col gap-2", className),
|
|
16
|
+
...props
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
function TabsList({ className, ...props }) {
|
|
20
|
+
return /* @__PURE__ */ jsx(TabsPrimitive.List, {
|
|
21
|
+
className: cn("bg-muted text-muted-foreground inline-flex h-9 w-fit items-center justify-center rounded-lg p-1", className),
|
|
22
|
+
...props
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
function TabsTrigger({ className, ...props }) {
|
|
26
|
+
return /* @__PURE__ */ jsx(TabsPrimitive.Trigger, {
|
|
27
|
+
className: cn("data-[state=active]:bg-background dark:data-[state=active]:text-foreground data-[state=active]:text-foreground dark:hover:text-foreground focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:outline-ring inline-flex flex-1 items-center justify-center gap-1.5 rounded-md px-2 py-1 text-sm font-medium whitespace-nowrap transition-[color,box-shadow] focus-visible:ring-[3px] focus-visible:outline-1 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:shadow-sm [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className),
|
|
28
|
+
...props
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
function TabsContent({ className, ...props }) {
|
|
32
|
+
return /* @__PURE__ */ jsx(TabsPrimitive.Content, {
|
|
33
|
+
className: cn("flex-1 outline-none", className),
|
|
34
|
+
...props
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
function TabsLinkTrigger({ value, href, linkComponent: LinkComp = "a", children, className, ...props }) {
|
|
38
|
+
const linkProps = LinkComp === "a" ? { href } : { to: href };
|
|
39
|
+
return /* @__PURE__ */ jsx(TabsTrigger, {
|
|
40
|
+
value,
|
|
41
|
+
asChild: true,
|
|
42
|
+
className,
|
|
43
|
+
...props,
|
|
44
|
+
children: /* @__PURE__ */ jsx(LinkComp, {
|
|
45
|
+
...linkProps,
|
|
46
|
+
children
|
|
47
|
+
})
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
//#endregion
|
|
52
|
+
export { TabsTrigger as a, TabsList as i, TabsContent as n, TabsLinkTrigger as r, Tabs as t };
|