@mzc-fe/design-system 0.0.10-rc.0 → 0.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/stepper/index.d.ts +4 -0
- package/dist/components/stepper/stepper-description.d.ts +5 -0
- package/dist/components/stepper/stepper-description.js +27 -0
- package/dist/components/stepper/stepper-dot.d.ts +3 -0
- package/dist/components/stepper/stepper-dot.js +34 -0
- package/dist/components/stepper/stepper-icon.d.ts +9 -0
- package/dist/components/stepper/stepper-icon.js +44 -0
- package/dist/components/stepper/stepper-item.d.ts +21 -0
- package/dist/components/stepper/stepper-item.js +117 -0
- package/dist/components/stepper/stepper-separator.d.ts +8 -0
- package/dist/components/stepper/stepper-separator.js +41 -0
- package/dist/components/stepper/stepper-title.d.ts +5 -0
- package/dist/components/stepper/stepper-title.js +23 -0
- package/dist/components/stepper/stepper.d.ts +4 -30
- package/dist/components/stepper/stepper.js +30 -183
- package/dist/components/stepper/use-stepper-item.d.ts +8 -0
- package/dist/components/stepper/use-stepper-item.js +12 -0
- package/dist/components/stepper/use-stepper.d.ts +11 -0
- package/dist/components/stepper/use-stepper.js +12 -0
- package/dist/design-system.css +1 -1
- package/dist/index.js +38 -34
- package/package.json +1 -1
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsx as m } from "react/jsx-runtime";
|
|
2
|
+
import { cn as a } from "../../lib/utils.js";
|
|
3
|
+
import { useStepper as n } from "./use-stepper.js";
|
|
4
|
+
import { useStepperItem as c } from "./use-stepper-item.js";
|
|
5
|
+
import { Slot as l } from "@radix-ui/react-slot";
|
|
6
|
+
function h({ className: e, asChild: p, ...s }) {
|
|
7
|
+
const { orientation: t, size: i, variant: r } = n(), { status: o } = c();
|
|
8
|
+
return /* @__PURE__ */ m(
|
|
9
|
+
p ? l : "p",
|
|
10
|
+
{
|
|
11
|
+
"data-slot": "stepper-description",
|
|
12
|
+
className: a(
|
|
13
|
+
"text-sm",
|
|
14
|
+
t === "horizontal" && r === "basic" && (i === "sm" ? "pl-8" : "pl-10"),
|
|
15
|
+
t === "horizontal" && r === "dot" && "max-w-[140px]",
|
|
16
|
+
t === "vertical" && r === "basic" && "col-start-2",
|
|
17
|
+
o === "error" ? "text-error" : o === "process" ? "text-foreground" : "text-muted-foreground",
|
|
18
|
+
"group-hover/stepper-item:text-primary",
|
|
19
|
+
e
|
|
20
|
+
),
|
|
21
|
+
...s
|
|
22
|
+
}
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
export {
|
|
26
|
+
h as StepperDescription
|
|
27
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { cva as a } from "class-variance-authority";
|
|
3
|
+
import { cn as o } from "../../lib/utils.js";
|
|
4
|
+
import { useStepper as i } from "./use-stepper.js";
|
|
5
|
+
import { useStepperItem as m } from "./use-stepper-item.js";
|
|
6
|
+
const p = a("relative z-10 shrink-0 rounded-full transition-colors", {
|
|
7
|
+
variants: {
|
|
8
|
+
status: {
|
|
9
|
+
finish: "bg-primary",
|
|
10
|
+
process: "bg-primary",
|
|
11
|
+
wait: "bg-muted-foreground/40",
|
|
12
|
+
error: "bg-error"
|
|
13
|
+
},
|
|
14
|
+
size: {
|
|
15
|
+
sm: "size-1.5",
|
|
16
|
+
md: "size-2"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
compoundVariants: [
|
|
20
|
+
{ status: "process", size: "sm", className: "size-2" },
|
|
21
|
+
{ status: "process", size: "md", className: "size-2.5" }
|
|
22
|
+
],
|
|
23
|
+
defaultVariants: {
|
|
24
|
+
status: "wait",
|
|
25
|
+
size: "md"
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
function z({ className: t }) {
|
|
29
|
+
const { size: r } = i(), { status: s } = m();
|
|
30
|
+
return /* @__PURE__ */ e("div", { "data-slot": "stepper-dot", "data-status": s, className: o(p({ status: s, size: r }), t) });
|
|
31
|
+
}
|
|
32
|
+
export {
|
|
33
|
+
z as StepperDot
|
|
34
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type StepperIconProps = React.ComponentProps<"div"> & {
|
|
2
|
+
asChild?: boolean;
|
|
3
|
+
};
|
|
4
|
+
/**
|
|
5
|
+
* 단계의 아이콘을 표시합니다. 완료된 단계는 체크 아이콘, 나머지는 숫자를 표시합니다.
|
|
6
|
+
*
|
|
7
|
+
* @param props.asChild - true면 자식 요소를 아이콘으로 렌더링
|
|
8
|
+
*/
|
|
9
|
+
export declare function StepperIcon({ asChild, className, children, ...props }: StepperIconProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { cva as u } from "class-variance-authority";
|
|
3
|
+
import { Check as d, X as l } from "lucide-react";
|
|
4
|
+
import { useStepper as x } from "./use-stepper.js";
|
|
5
|
+
import { useStepperItem as z } from "./use-stepper-item.js";
|
|
6
|
+
import { Slot as g } from "@radix-ui/react-slot";
|
|
7
|
+
import { cn as i } from "../../lib/utils.js";
|
|
8
|
+
const y = u(
|
|
9
|
+
"relative z-10 flex shrink-0 items-center justify-center rounded-full font-medium transition-colors",
|
|
10
|
+
{
|
|
11
|
+
variants: {
|
|
12
|
+
status: {
|
|
13
|
+
finish: "bg-primary/5 text-primary dark:bg-primary/10",
|
|
14
|
+
process: "bg-primary text-primary-foreground",
|
|
15
|
+
wait: "bg-muted text-muted-foreground",
|
|
16
|
+
error: "bg-error text-error-foreground"
|
|
17
|
+
},
|
|
18
|
+
size: {
|
|
19
|
+
sm: "size-6 text-xs",
|
|
20
|
+
md: "size-8 text-sm"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
defaultVariants: {
|
|
24
|
+
status: "wait",
|
|
25
|
+
size: "md"
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
);
|
|
29
|
+
function j({ asChild: e = !1, className: a, children: m, ...n }) {
|
|
30
|
+
const { size: s } = x(), { step: p, status: t } = z(), c = e ? g : "div", o = i(s === "sm" ? "size-3" : "size-4"), f = t === "finish" ? /* @__PURE__ */ r(d, { className: o }) : t === "error" ? /* @__PURE__ */ r(l, { className: o }) : /* @__PURE__ */ r("span", { children: p + 1 });
|
|
31
|
+
return /* @__PURE__ */ r(
|
|
32
|
+
c,
|
|
33
|
+
{
|
|
34
|
+
"data-slot": "stepper-icon",
|
|
35
|
+
"data-status": t,
|
|
36
|
+
className: i(y({ status: t, size: s }), a),
|
|
37
|
+
...n,
|
|
38
|
+
children: e ? m : f
|
|
39
|
+
}
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
export {
|
|
43
|
+
j as StepperIcon
|
|
44
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { StepStatus } from './stepper';
|
|
2
|
+
export type StepperItemProps = Omit<React.ComponentProps<"div">, "title" | "children"> & {
|
|
3
|
+
/** 단계 번호 (0-based) */
|
|
4
|
+
step?: number;
|
|
5
|
+
/** @deprecated `step`을 사용하세요 */
|
|
6
|
+
index?: number;
|
|
7
|
+
status?: StepStatus;
|
|
8
|
+
/** 단계 아이콘 */
|
|
9
|
+
icon?: React.ReactNode;
|
|
10
|
+
/** 단계 제목 */
|
|
11
|
+
title?: React.ReactNode;
|
|
12
|
+
/** 단계 설명 */
|
|
13
|
+
description?: React.ReactNode;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* 스테퍼의 개별 단계를 나타내는 아이템 컴포넌트입니다.
|
|
17
|
+
*
|
|
18
|
+
* @param props.step - 이 단계의 번호 (0-based, 필수)
|
|
19
|
+
* @param props.status - 수동으로 상태를 지정할 때 사용 (Context 오버라이드)
|
|
20
|
+
*/
|
|
21
|
+
export declare function StepperItem({ step, index, status: statusOverride, icon, title, description, className, onClick, ...props }: StepperItemProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { jsx as a, jsxs as e, Fragment as m } from "react/jsx-runtime";
|
|
2
|
+
import { cva as V } from "class-variance-authority";
|
|
3
|
+
import { useStepper as j } from "./use-stepper.js";
|
|
4
|
+
import { useMemo as w } from "react";
|
|
5
|
+
import { StepperItemProvider as y } from "./use-stepper-item.js";
|
|
6
|
+
import { cn as A } from "../../lib/utils.js";
|
|
7
|
+
import { StepperSeparator as o } from "./stepper-separator.js";
|
|
8
|
+
import { StepperIcon as v } from "./stepper-icon.js";
|
|
9
|
+
import { StepperDot as h } from "./stepper-dot.js";
|
|
10
|
+
const D = V("group/stepper-item flex", {
|
|
11
|
+
variants: {
|
|
12
|
+
orientation: {
|
|
13
|
+
horizontal: "flex-1",
|
|
14
|
+
vertical: "gap-x-4 pb-3 last:pb-0"
|
|
15
|
+
},
|
|
16
|
+
variant: {
|
|
17
|
+
basic: "",
|
|
18
|
+
dot: ""
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
compoundVariants: [
|
|
22
|
+
{ orientation: "horizontal", variant: "basic", className: "flex-col last:flex-initial" },
|
|
23
|
+
{ orientation: "horizontal", variant: "dot", className: "flex-col items-center gap-2" },
|
|
24
|
+
{ orientation: "vertical", variant: "basic", className: "gap-y-2" }
|
|
25
|
+
],
|
|
26
|
+
defaultVariants: {
|
|
27
|
+
variant: "basic"
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
function J({
|
|
31
|
+
step: u,
|
|
32
|
+
index: g,
|
|
33
|
+
status: b,
|
|
34
|
+
icon: d,
|
|
35
|
+
title: l,
|
|
36
|
+
description: n,
|
|
37
|
+
className: N,
|
|
38
|
+
onClick: f,
|
|
39
|
+
...S
|
|
40
|
+
}) {
|
|
41
|
+
const i = u ?? g, { orientation: t, current: x, size: s, variant: r, getStepStatus: z } = j(), c = b ?? z(i), p = i < x, I = w(() => ({ step: i, status: c }), [i, c]);
|
|
42
|
+
return /* @__PURE__ */ a(y, { value: I, children: /* @__PURE__ */ e(
|
|
43
|
+
"div",
|
|
44
|
+
{
|
|
45
|
+
"data-slot": "stepper-item",
|
|
46
|
+
"data-status": c,
|
|
47
|
+
"data-orientation": t,
|
|
48
|
+
role: "listitem",
|
|
49
|
+
"aria-current": c === "process" ? "step" : void 0,
|
|
50
|
+
className: A(D({ orientation: t, variant: r }), N, !!f && "cursor-pointer"),
|
|
51
|
+
onClick: f,
|
|
52
|
+
...S,
|
|
53
|
+
children: [
|
|
54
|
+
r === "basic" && t === "horizontal" && /* @__PURE__ */ e(m, { children: [
|
|
55
|
+
/* @__PURE__ */ e("div", { className: "flex items-center gap-x-2", children: [
|
|
56
|
+
d ?? /* @__PURE__ */ a(v, {}),
|
|
57
|
+
l,
|
|
58
|
+
/* @__PURE__ */ a(o, { isActive: p, orientation: t, size: s })
|
|
59
|
+
] }),
|
|
60
|
+
n
|
|
61
|
+
] }),
|
|
62
|
+
r === "basic" && t === "vertical" && /* @__PURE__ */ e(m, { children: [
|
|
63
|
+
/* @__PURE__ */ e("div", { className: "flex flex-col items-center gap-[6px] pb-[6px]", children: [
|
|
64
|
+
d ?? /* @__PURE__ */ a(v, {}),
|
|
65
|
+
/* @__PURE__ */ a(o, { isActive: p, orientation: t, size: s })
|
|
66
|
+
] }),
|
|
67
|
+
/* @__PURE__ */ e("div", { className: "flex flex-col flex-wrap gap-[8px] pt-1 pb-3", children: [
|
|
68
|
+
l,
|
|
69
|
+
n
|
|
70
|
+
] })
|
|
71
|
+
] }),
|
|
72
|
+
r === "dot" && t === "horizontal" && /* @__PURE__ */ e(m, { children: [
|
|
73
|
+
/* @__PURE__ */ e("div", { className: "flex min-h-2.5 w-full items-center", children: [
|
|
74
|
+
/* @__PURE__ */ a(
|
|
75
|
+
o,
|
|
76
|
+
{
|
|
77
|
+
isActive: i <= x && i > 0,
|
|
78
|
+
orientation: t,
|
|
79
|
+
size: s,
|
|
80
|
+
variant: r,
|
|
81
|
+
"data-position": "left"
|
|
82
|
+
}
|
|
83
|
+
),
|
|
84
|
+
/* @__PURE__ */ a(h, {}),
|
|
85
|
+
/* @__PURE__ */ a(
|
|
86
|
+
o,
|
|
87
|
+
{
|
|
88
|
+
isActive: p,
|
|
89
|
+
orientation: t,
|
|
90
|
+
size: s,
|
|
91
|
+
variant: r,
|
|
92
|
+
"data-position": "right"
|
|
93
|
+
}
|
|
94
|
+
)
|
|
95
|
+
] }),
|
|
96
|
+
/* @__PURE__ */ e("div", { className: "flex flex-col items-center gap-0.5 text-center", children: [
|
|
97
|
+
l,
|
|
98
|
+
n
|
|
99
|
+
] })
|
|
100
|
+
] }),
|
|
101
|
+
r === "dot" && t === "vertical" && /* @__PURE__ */ e(m, { children: [
|
|
102
|
+
/* @__PURE__ */ e("div", { className: "flex flex-col items-center gap-[6px] pb-[6px] pt-[7px]", children: [
|
|
103
|
+
/* @__PURE__ */ a("div", { className: "flex size-2.5 items-center justify-center", children: /* @__PURE__ */ a(h, {}) }),
|
|
104
|
+
/* @__PURE__ */ a(o, { isActive: p, orientation: t, size: s, variant: r })
|
|
105
|
+
] }),
|
|
106
|
+
/* @__PURE__ */ e("div", { className: "flex flex-col flex-wrap gap-1 pt-0.5 pb-3", children: [
|
|
107
|
+
l,
|
|
108
|
+
n
|
|
109
|
+
] })
|
|
110
|
+
] })
|
|
111
|
+
]
|
|
112
|
+
}
|
|
113
|
+
) });
|
|
114
|
+
}
|
|
115
|
+
export {
|
|
116
|
+
J as StepperItem
|
|
117
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type StepperSeparatorProps = {
|
|
2
|
+
isActive: boolean;
|
|
3
|
+
orientation: "horizontal" | "vertical";
|
|
4
|
+
size: "sm" | "md";
|
|
5
|
+
variant?: "basic" | "dot";
|
|
6
|
+
"data-position"?: "left" | "right";
|
|
7
|
+
};
|
|
8
|
+
export declare const StepperSeparator: ({ isActive, orientation, variant, "data-position": position, }: StepperSeparatorProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { cn as e } from "../../lib/utils.js";
|
|
3
|
+
import { cva as s } from "class-variance-authority";
|
|
4
|
+
const n = s("shrink-0 transition-colors", {
|
|
5
|
+
variants: {
|
|
6
|
+
active: {
|
|
7
|
+
true: "bg-primary",
|
|
8
|
+
false: "bg-border"
|
|
9
|
+
},
|
|
10
|
+
orientation: {
|
|
11
|
+
horizontal: "h-px flex-1",
|
|
12
|
+
vertical: "w-px flex-1"
|
|
13
|
+
},
|
|
14
|
+
variant: {
|
|
15
|
+
basic: "",
|
|
16
|
+
dot: ""
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
compoundVariants: [{ orientation: "horizontal", variant: "basic", className: "ml-2" }],
|
|
20
|
+
defaultVariants: {
|
|
21
|
+
active: !1,
|
|
22
|
+
variant: "basic"
|
|
23
|
+
}
|
|
24
|
+
}), m = ({
|
|
25
|
+
isActive: a,
|
|
26
|
+
orientation: t,
|
|
27
|
+
variant: r = "basic",
|
|
28
|
+
"data-position": i
|
|
29
|
+
}) => /* @__PURE__ */ o(
|
|
30
|
+
"div",
|
|
31
|
+
{
|
|
32
|
+
"data-slot": "stepper-separator",
|
|
33
|
+
"data-position": i,
|
|
34
|
+
role: "presentation",
|
|
35
|
+
"aria-hidden": "true",
|
|
36
|
+
className: e(n({ active: a, orientation: t, variant: r }))
|
|
37
|
+
}
|
|
38
|
+
);
|
|
39
|
+
export {
|
|
40
|
+
m as StepperSeparator
|
|
41
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { jsx as p } from "react/jsx-runtime";
|
|
2
|
+
import { cn as m } from "../../lib/utils.js";
|
|
3
|
+
import { useStepperItem as s } from "./use-stepper-item.js";
|
|
4
|
+
import { Slot as i } from "@radix-ui/react-slot";
|
|
5
|
+
function l({ className: r, asChild: e, ...o }) {
|
|
6
|
+
const { status: t } = s();
|
|
7
|
+
return /* @__PURE__ */ p(
|
|
8
|
+
e ? i : "p",
|
|
9
|
+
{
|
|
10
|
+
"data-slot": "stepper-title",
|
|
11
|
+
className: m(
|
|
12
|
+
"text-base font-normal",
|
|
13
|
+
t === "error" ? "text-error" : t === "wait" ? "text-muted-foreground" : "text-foreground",
|
|
14
|
+
"group-hover/stepper-item:text-primary",
|
|
15
|
+
r
|
|
16
|
+
),
|
|
17
|
+
...o
|
|
18
|
+
}
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
export {
|
|
22
|
+
l as StepperTitle
|
|
23
|
+
};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
type StepStatus = "finish" | "process" | "wait";
|
|
2
|
+
export type StepStatus = "finish" | "process" | "wait" | "error";
|
|
3
3
|
export type StepperProps = React.ComponentProps<"div"> & {
|
|
4
4
|
current: number;
|
|
5
5
|
orientation?: "horizontal" | "vertical";
|
|
6
6
|
size?: "sm" | "md";
|
|
7
|
+
variant?: "basic" | "dot";
|
|
7
8
|
};
|
|
8
9
|
/**
|
|
9
10
|
* 다단계 프로세스의 진행 상태를 시각적으로 표시하는 스테퍼 컴포넌트입니다.
|
|
@@ -11,7 +12,7 @@ export type StepperProps = React.ComponentProps<"div"> & {
|
|
|
11
12
|
* @example
|
|
12
13
|
* ```tsx
|
|
13
14
|
* <Stepper current={1}>
|
|
14
|
-
* <StepperItem
|
|
15
|
+
* <StepperItem step={0}>
|
|
15
16
|
* <StepperIcon />
|
|
16
17
|
* <StepperTitle>계정 생성</StepperTitle>
|
|
17
18
|
* <StepperDescription>기본 정보 입력</StepperDescription>
|
|
@@ -23,31 +24,4 @@ export type StepperProps = React.ComponentProps<"div"> & {
|
|
|
23
24
|
* @param props.orientation - 레이아웃 방향 ('horizontal' | 'vertical')
|
|
24
25
|
* @param props.size - 아이콘 크기 ('sm' | 'md')
|
|
25
26
|
*/
|
|
26
|
-
declare function Stepper({ current, orientation, size, className, ...props }: StepperProps): import("react/jsx-runtime").JSX.Element;
|
|
27
|
-
export type StepperItemProps = React.ComponentProps<"div"> & {
|
|
28
|
-
index: number;
|
|
29
|
-
status?: StepStatus;
|
|
30
|
-
};
|
|
31
|
-
/**
|
|
32
|
-
* 스테퍼의 개별 단계를 나타내는 아이템 컴포넌트입니다.
|
|
33
|
-
*
|
|
34
|
-
* @param props.index - 이 단계의 인덱스 (0-based, 필수)
|
|
35
|
-
* @param props.status - 수동으로 상태를 지정할 때 사용 (Context 오버라이드)
|
|
36
|
-
*/
|
|
37
|
-
declare function StepperItem({ index, status: statusOverride, className, children, ...props }: StepperItemProps): import("react/jsx-runtime").JSX.Element;
|
|
38
|
-
export type StepperIconProps = React.ComponentProps<"div"> & {
|
|
39
|
-
asChild?: boolean;
|
|
40
|
-
};
|
|
41
|
-
/**
|
|
42
|
-
* 단계의 아이콘을 표시합니다. 완료된 단계는 체크 아이콘, 나머지는 숫자를 표시합니다.
|
|
43
|
-
*
|
|
44
|
-
* @param props.asChild - true면 자식 요소를 아이콘으로 렌더링
|
|
45
|
-
*/
|
|
46
|
-
declare function StepperIcon({ asChild, className, children, ...props }: StepperIconProps): import("react/jsx-runtime").JSX.Element;
|
|
47
|
-
export type StepperTitleProps = React.ComponentProps<"p">;
|
|
48
|
-
/** 단계의 제목을 표시합니다. */
|
|
49
|
-
declare function StepperTitle({ className, ...props }: StepperTitleProps): import("react/jsx-runtime").JSX.Element;
|
|
50
|
-
export type StepperDescriptionProps = React.ComponentProps<"p">;
|
|
51
|
-
/** 단계의 설명 텍스트를 표시합니다. */
|
|
52
|
-
declare function StepperDescription({ className, ...props }: StepperDescriptionProps): import("react/jsx-runtime").JSX.Element;
|
|
53
|
-
export { Stepper, StepperItem, StepperIcon, StepperTitle, StepperDescription, };
|
|
27
|
+
export declare function Stepper({ current, orientation, size, variant, className, ...props }: StepperProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,205 +1,52 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
2
2
|
import * as l from "react";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
const g = l.createContext(null);
|
|
8
|
-
function d() {
|
|
9
|
-
const t = l.useContext(g);
|
|
10
|
-
if (!t)
|
|
11
|
-
throw new Error("useStepper must be used within a Stepper component");
|
|
12
|
-
return t;
|
|
13
|
-
}
|
|
14
|
-
const C = m(
|
|
15
|
-
"flex [&>:last-child_[data-slot=stepper-separator]]:hidden",
|
|
16
|
-
{
|
|
17
|
-
variants: {
|
|
18
|
-
orientation: {
|
|
19
|
-
horizontal: "flex-row items-start gap-4",
|
|
20
|
-
vertical: "flex-col"
|
|
21
|
-
}
|
|
22
|
-
},
|
|
23
|
-
defaultVariants: {
|
|
24
|
-
orientation: "horizontal"
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
), V = m("relative group/stepper-item", {
|
|
3
|
+
import { cva as d } from "class-variance-authority";
|
|
4
|
+
import { cn as m } from "../../lib/utils.js";
|
|
5
|
+
import { StepperProvider as f } from "./use-stepper.js";
|
|
6
|
+
const h = d("flex", {
|
|
28
7
|
variants: {
|
|
29
8
|
orientation: {
|
|
30
|
-
horizontal: "flex
|
|
31
|
-
vertical: "
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}), y = m(
|
|
35
|
-
"relative z-10 flex shrink-0 items-center justify-center rounded-full font-medium transition-colors",
|
|
36
|
-
{
|
|
37
|
-
variants: {
|
|
38
|
-
status: {
|
|
39
|
-
finish: "bg-primary/5 text-primary dark:bg-primary/10",
|
|
40
|
-
process: "bg-primary text-primary-foreground",
|
|
41
|
-
wait: "bg-muted text-muted-foreground"
|
|
42
|
-
},
|
|
43
|
-
size: {
|
|
44
|
-
sm: "size-6 text-xs",
|
|
45
|
-
md: "size-8 text-sm"
|
|
46
|
-
}
|
|
9
|
+
horizontal: "flex-row items-start",
|
|
10
|
+
vertical: "flex-col"
|
|
47
11
|
},
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
), I = m("shrink-0 transition-colors", {
|
|
54
|
-
variants: {
|
|
55
|
-
active: {
|
|
56
|
-
true: "bg-primary",
|
|
57
|
-
false: "bg-border"
|
|
12
|
+
variant: {
|
|
13
|
+
basic: "[&>:last-child_[data-slot=stepper-separator]]:hidden",
|
|
14
|
+
dot: "[&>:first-child_[data-position=left]]:opacity-0 [&>:last-child_[data-position=right]]:opacity-0"
|
|
58
15
|
}
|
|
59
16
|
},
|
|
17
|
+
compoundVariants: [{ orientation: "horizontal", variant: "basic", className: "gap-4" }],
|
|
60
18
|
defaultVariants: {
|
|
61
|
-
|
|
19
|
+
orientation: "horizontal",
|
|
20
|
+
variant: "basic"
|
|
62
21
|
}
|
|
63
|
-
})
|
|
64
|
-
|
|
65
|
-
);
|
|
66
|
-
function x() {
|
|
67
|
-
const t = l.useContext(v);
|
|
68
|
-
if (!t)
|
|
69
|
-
throw new Error("useStepperItem must be used within a StepperItem component");
|
|
70
|
-
return t;
|
|
71
|
-
}
|
|
72
|
-
function P({
|
|
22
|
+
});
|
|
23
|
+
function x({
|
|
73
24
|
current: t,
|
|
74
|
-
orientation:
|
|
75
|
-
size:
|
|
76
|
-
|
|
77
|
-
|
|
25
|
+
orientation: a = "horizontal",
|
|
26
|
+
size: i = "md",
|
|
27
|
+
variant: o = "basic",
|
|
28
|
+
className: p,
|
|
29
|
+
...n
|
|
78
30
|
}) {
|
|
79
|
-
const
|
|
80
|
-
(
|
|
31
|
+
const r = l.useCallback(
|
|
32
|
+
(s) => s < t ? "finish" : s === t ? "process" : "wait",
|
|
81
33
|
[t]
|
|
82
|
-
),
|
|
83
|
-
() => ({ current: t, orientation:
|
|
84
|
-
[t,
|
|
34
|
+
), c = l.useMemo(
|
|
35
|
+
() => ({ current: t, orientation: a, size: i, variant: o, getStepStatus: r }),
|
|
36
|
+
[t, a, i, o, r]
|
|
85
37
|
);
|
|
86
|
-
return /* @__PURE__ */
|
|
38
|
+
return /* @__PURE__ */ e(f, { value: c, children: /* @__PURE__ */ e(
|
|
87
39
|
"div",
|
|
88
40
|
{
|
|
89
41
|
"data-slot": "stepper",
|
|
90
|
-
"data-orientation":
|
|
42
|
+
"data-orientation": a,
|
|
91
43
|
role: "group",
|
|
92
44
|
"aria-label": "progress",
|
|
93
|
-
className:
|
|
94
|
-
...
|
|
95
|
-
}
|
|
96
|
-
) });
|
|
97
|
-
}
|
|
98
|
-
function _({
|
|
99
|
-
index: t,
|
|
100
|
-
status: e,
|
|
101
|
-
className: r,
|
|
102
|
-
children: s,
|
|
103
|
-
...i
|
|
104
|
-
}) {
|
|
105
|
-
const { orientation: a, current: p, size: c, getStepStatus: f } = d(), u = e ?? f(t), h = t < p, S = l.useMemo(
|
|
106
|
-
() => ({ index: t, status: u }),
|
|
107
|
-
[t, u]
|
|
108
|
-
);
|
|
109
|
-
return /* @__PURE__ */ o(v.Provider, { value: S, children: /* @__PURE__ */ b(
|
|
110
|
-
"div",
|
|
111
|
-
{
|
|
112
|
-
"data-slot": "stepper-item",
|
|
113
|
-
"data-status": u,
|
|
114
|
-
"data-orientation": a,
|
|
115
|
-
role: "listitem",
|
|
116
|
-
"aria-current": u === "process" ? "step" : void 0,
|
|
117
|
-
className: n(V({ orientation: a }), r),
|
|
118
|
-
...i,
|
|
119
|
-
children: [
|
|
120
|
-
s,
|
|
121
|
-
/* @__PURE__ */ o(
|
|
122
|
-
"div",
|
|
123
|
-
{
|
|
124
|
-
"data-slot": "stepper-separator",
|
|
125
|
-
role: "presentation",
|
|
126
|
-
"aria-hidden": "true",
|
|
127
|
-
className: n(
|
|
128
|
-
I({ active: h }),
|
|
129
|
-
"order-3",
|
|
130
|
-
a === "horizontal" && "h-px flex-1 ml-2",
|
|
131
|
-
a === "vertical" && n(
|
|
132
|
-
"absolute w-px bottom-1.5",
|
|
133
|
-
c === "sm" ? "left-3 top-[30px]" : "left-4 top-[38px]"
|
|
134
|
-
)
|
|
135
|
-
)
|
|
136
|
-
}
|
|
137
|
-
)
|
|
138
|
-
]
|
|
45
|
+
className: m(h({ orientation: a, variant: o }), p),
|
|
46
|
+
...n
|
|
139
47
|
}
|
|
140
48
|
) });
|
|
141
49
|
}
|
|
142
|
-
function A({
|
|
143
|
-
asChild: t = !1,
|
|
144
|
-
className: e,
|
|
145
|
-
children: r,
|
|
146
|
-
...s
|
|
147
|
-
}) {
|
|
148
|
-
const { size: i } = d(), { index: a, status: p } = x(), c = t ? z : "div", f = p === "finish" ? /* @__PURE__ */ o(w, { className: n(i === "sm" ? "size-4" : "size-5") }) : /* @__PURE__ */ o("span", { children: a + 1 });
|
|
149
|
-
return /* @__PURE__ */ o(
|
|
150
|
-
c,
|
|
151
|
-
{
|
|
152
|
-
"data-slot": "stepper-icon",
|
|
153
|
-
"data-status": p,
|
|
154
|
-
className: n(y({ status: p, size: i }), "order-1", e),
|
|
155
|
-
...s,
|
|
156
|
-
children: t ? r : f
|
|
157
|
-
}
|
|
158
|
-
);
|
|
159
|
-
}
|
|
160
|
-
function D({
|
|
161
|
-
className: t,
|
|
162
|
-
...e
|
|
163
|
-
}) {
|
|
164
|
-
const { orientation: r } = d(), { status: s } = x();
|
|
165
|
-
return /* @__PURE__ */ o(
|
|
166
|
-
"p",
|
|
167
|
-
{
|
|
168
|
-
"data-slot": "stepper-title",
|
|
169
|
-
className: n(
|
|
170
|
-
"order-2 text-base font-normal leading-normal",
|
|
171
|
-
r === "vertical" && "pt-1",
|
|
172
|
-
s === "wait" ? "text-muted-foreground" : "text-foreground",
|
|
173
|
-
t
|
|
174
|
-
),
|
|
175
|
-
...e
|
|
176
|
-
}
|
|
177
|
-
);
|
|
178
|
-
}
|
|
179
|
-
function R({
|
|
180
|
-
className: t,
|
|
181
|
-
...e
|
|
182
|
-
}) {
|
|
183
|
-
const { orientation: r, size: s } = d(), { status: i } = x();
|
|
184
|
-
return /* @__PURE__ */ o(
|
|
185
|
-
"p",
|
|
186
|
-
{
|
|
187
|
-
"data-slot": "stepper-description",
|
|
188
|
-
className: n(
|
|
189
|
-
"order-last text-sm leading-normal",
|
|
190
|
-
r === "horizontal" && n("basis-full", s === "sm" ? "pl-8" : "pl-10"),
|
|
191
|
-
r === "vertical" && "col-start-2",
|
|
192
|
-
i === "process" ? "text-foreground" : "text-muted-foreground",
|
|
193
|
-
t
|
|
194
|
-
),
|
|
195
|
-
...e
|
|
196
|
-
}
|
|
197
|
-
);
|
|
198
|
-
}
|
|
199
50
|
export {
|
|
200
|
-
|
|
201
|
-
R as StepperDescription,
|
|
202
|
-
A as StepperIcon,
|
|
203
|
-
_ as StepperItem,
|
|
204
|
-
D as StepperTitle
|
|
51
|
+
x as Stepper
|
|
205
52
|
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { StepStatus } from './stepper';
|
|
2
|
+
interface StepperItemContextValue {
|
|
3
|
+
step: number;
|
|
4
|
+
status: StepStatus;
|
|
5
|
+
}
|
|
6
|
+
export declare const StepperItemProvider: import('react').Provider<StepperItemContextValue | null>;
|
|
7
|
+
export declare function useStepperItem(): StepperItemContextValue;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { createContext as r, useContext as o } from "react";
|
|
2
|
+
const t = r(null), p = t.Provider;
|
|
3
|
+
function m() {
|
|
4
|
+
const e = o(t);
|
|
5
|
+
if (!e)
|
|
6
|
+
throw new Error("useStepperItem must be used within a StepperItem component");
|
|
7
|
+
return e;
|
|
8
|
+
}
|
|
9
|
+
export {
|
|
10
|
+
p as StepperItemProvider,
|
|
11
|
+
m as useStepperItem
|
|
12
|
+
};
|