@ztwoint/z-ui 0.1.76 → 0.1.77
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/stepper.js +10 -10
- package/dist/components/stepper/stepper.types.d.ts +1 -0
- package/dist/components/stepper-item/stepper-item.d.ts +2 -2
- package/dist/components/stepper-item/stepper-item.js +15 -14
- package/dist/types/components/stepper/stepper.types.d.ts +1 -0
- package/dist/types/components/stepper-item/stepper-item.d.ts +2 -2
- package/package.json +1 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as o, jsxs as p } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef as c, useState as h, useImperativeHandle as x } from "react";
|
|
3
3
|
import { Z2StepperItem as w } from "../stepper-item/stepper-item.js";
|
|
4
4
|
function b() {
|
|
5
|
-
return /* @__PURE__ */
|
|
5
|
+
return /* @__PURE__ */ o("div", { className: "w-3 h-[1.5px] border-solid border-1 stroke-solid-high" });
|
|
6
6
|
}
|
|
7
7
|
const S = c(
|
|
8
8
|
({ items: f }, u) => {
|
|
9
|
-
const [
|
|
9
|
+
const [d, l] = h(() => f.map((t, a) => ({
|
|
10
10
|
...t,
|
|
11
11
|
state: t.state ?? (a === 0 ? "active" : "disabled")
|
|
12
12
|
}))), i = (t, a, n = "handleNext") => {
|
|
@@ -19,7 +19,7 @@ const S = c(
|
|
|
19
19
|
};
|
|
20
20
|
return x(u, () => ({
|
|
21
21
|
handleNext: (t, a) => {
|
|
22
|
-
|
|
22
|
+
l((n) => {
|
|
23
23
|
const r = i(n, t, "handleNext");
|
|
24
24
|
return r === n.length - 1 ? n.map(
|
|
25
25
|
(e, s) => s === r ? { ...e, state: "completed" } : e
|
|
@@ -27,13 +27,13 @@ const S = c(
|
|
|
27
27
|
});
|
|
28
28
|
},
|
|
29
29
|
handlePrev: (t, a) => {
|
|
30
|
-
|
|
30
|
+
l((n) => {
|
|
31
31
|
const r = i(n, t, "handlePrev");
|
|
32
32
|
return r <= 0 ? n : n.map((e, s) => s === r ? { ...e, state: "disabled" } : s === r - 1 ? { ...e, state: "active", label: a ?? e.label } : e);
|
|
33
33
|
});
|
|
34
34
|
},
|
|
35
35
|
reset: () => {
|
|
36
|
-
|
|
36
|
+
l(
|
|
37
37
|
(t) => t.map((a, n) => ({
|
|
38
38
|
...a,
|
|
39
39
|
state: n === 0 ? "active" : "disabled"
|
|
@@ -42,15 +42,15 @@ const S = c(
|
|
|
42
42
|
},
|
|
43
43
|
setStepState: (t, a) => {
|
|
44
44
|
if (!t) throw new Error("setStepState: id is required");
|
|
45
|
-
|
|
45
|
+
l((n) => {
|
|
46
46
|
const r = n.findIndex((e) => e.id === t);
|
|
47
47
|
if (r === -1) throw new Error(`setStepState: step with id '${t}' not found`);
|
|
48
48
|
return n.map((e, s) => s === r ? { ...e, state: a } : e);
|
|
49
49
|
});
|
|
50
50
|
}
|
|
51
|
-
})), /* @__PURE__ */
|
|
52
|
-
/* @__PURE__ */
|
|
53
|
-
a <
|
|
51
|
+
})), /* @__PURE__ */ o("div", { className: "w-fit flex flex-row items-center gap-6", children: d.map((t, a) => /* @__PURE__ */ p("div", { className: "flex flex-row items-center gap-6", children: [
|
|
52
|
+
/* @__PURE__ */ o(w, { label: t.label, state: t.state, onClick: t.onClick }),
|
|
53
|
+
a < d.length - 1 && /* @__PURE__ */ o(b, {})
|
|
54
54
|
] }, t.id)) });
|
|
55
55
|
}
|
|
56
56
|
);
|
|
@@ -3,8 +3,8 @@ import * as React from 'react';
|
|
|
3
3
|
declare const z2StepperItemVariants: (props?: ({
|
|
4
4
|
state?: "disabled" | "active" | "completed" | null | undefined;
|
|
5
5
|
} & import('class-variance-authority/dist/types').ClassProp) | undefined) => string;
|
|
6
|
-
export interface Z2StepperItemProps extends React.HTMLAttributes<
|
|
6
|
+
export interface Z2StepperItemProps extends React.HTMLAttributes<HTMLButtonElement>, VariantProps<typeof z2StepperItemVariants> {
|
|
7
7
|
label: string;
|
|
8
8
|
}
|
|
9
|
-
export declare const Z2StepperItem: React.ForwardRefExoticComponent<Z2StepperItemProps & React.RefAttributes<
|
|
9
|
+
export declare const Z2StepperItem: React.ForwardRefExoticComponent<Z2StepperItemProps & React.RefAttributes<HTMLButtonElement>>;
|
|
10
10
|
export {};
|
|
@@ -3,39 +3,40 @@ import * as c from "react";
|
|
|
3
3
|
import { cva as p } from "class-variance-authority";
|
|
4
4
|
import { cn as l } from "../../lib/utils.js";
|
|
5
5
|
import f from "../assets/icons/circle-check-filled.js";
|
|
6
|
-
import
|
|
7
|
-
const
|
|
6
|
+
import o from "../assets/icons/media-record.js";
|
|
7
|
+
const u = p("w-fit flex items-center select-none gap-2", {
|
|
8
8
|
variants: {
|
|
9
9
|
state: {
|
|
10
|
-
active: "",
|
|
11
|
-
completed: "opacity-100",
|
|
10
|
+
active: "cursor-pointer",
|
|
11
|
+
completed: "opacity-100 cursor-pointer",
|
|
12
12
|
disabled: "cursor-not-allowed"
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
15
|
defaultVariants: {
|
|
16
16
|
state: "active"
|
|
17
17
|
}
|
|
18
|
-
}),
|
|
19
|
-
({ label: a, state: e = "active", className:
|
|
20
|
-
let
|
|
21
|
-
return e === "completed" ? (
|
|
22
|
-
"
|
|
18
|
+
}), h = "rounded-full transition-colors w-4 h-4 border-none", b = c.forwardRef(
|
|
19
|
+
({ label: a, state: e = "active", className: n, ...s }, d) => {
|
|
20
|
+
let r, t;
|
|
21
|
+
return e === "completed" ? (r = /* @__PURE__ */ i(f, { fill: "var(--blue-500)", width: 16, height: 16 }), t = "text-neutral-primary leading-none-medium-sm") : e === "active" ? (r = /* @__PURE__ */ i(o, { fill: "var(--blue-500)", width: 16, height: 16 }), t = "text-neutral-primary leading-none-medium-sm") : (r = /* @__PURE__ */ i(o, { fill: "var(--neutral-500)", width: 16, height: 16 }), t = "text-neutral-secondary leading-none-medium-sm"), /* @__PURE__ */ m(
|
|
22
|
+
"button",
|
|
23
23
|
{
|
|
24
24
|
ref: d,
|
|
25
|
-
className: l(
|
|
25
|
+
className: l(u({ state: e }), n),
|
|
26
26
|
"aria-disabled": e === "disabled",
|
|
27
27
|
title: e || "disabled",
|
|
28
|
+
disabled: e === "disabled",
|
|
28
29
|
"aria-label": a,
|
|
29
30
|
...s,
|
|
30
31
|
children: [
|
|
31
|
-
/* @__PURE__ */ i("span", { className:
|
|
32
|
-
/* @__PURE__ */ i("span", { className: l(
|
|
32
|
+
/* @__PURE__ */ i("span", { className: h, children: r }),
|
|
33
|
+
/* @__PURE__ */ i("span", { className: l(t), children: a })
|
|
33
34
|
]
|
|
34
35
|
}
|
|
35
36
|
);
|
|
36
37
|
}
|
|
37
38
|
);
|
|
38
|
-
|
|
39
|
+
b.displayName = "Z2StepperItem";
|
|
39
40
|
export {
|
|
40
|
-
|
|
41
|
+
b as Z2StepperItem
|
|
41
42
|
};
|
|
@@ -3,8 +3,8 @@ import { type VariantProps } from 'class-variance-authority';
|
|
|
3
3
|
declare const z2StepperItemVariants: (props?: ({
|
|
4
4
|
state?: "disabled" | "active" | "completed" | null | undefined;
|
|
5
5
|
} & import("class-variance-authority/dist/types").ClassProp) | undefined) => string;
|
|
6
|
-
export interface Z2StepperItemProps extends React.HTMLAttributes<
|
|
6
|
+
export interface Z2StepperItemProps extends React.HTMLAttributes<HTMLButtonElement>, VariantProps<typeof z2StepperItemVariants> {
|
|
7
7
|
label: string;
|
|
8
8
|
}
|
|
9
|
-
export declare const Z2StepperItem: React.ForwardRefExoticComponent<Z2StepperItemProps & React.RefAttributes<
|
|
9
|
+
export declare const Z2StepperItem: React.ForwardRefExoticComponent<Z2StepperItemProps & React.RefAttributes<HTMLButtonElement>>;
|
|
10
10
|
export {};
|