@ztwoint/z-ui 0.1.15 → 0.1.16
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.d.ts +1 -12
- package/dist/components/stepper/stepper.js +45 -35
- package/dist/components/stepper/stepper.types.d.ts +12 -0
- package/dist/components/stepper-item/stepper-item.js +41 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.js +17 -19
- package/dist/types/components/stepper/stepper.d.ts +1 -12
- package/dist/types/components/stepper/stepper.types.d.ts +12 -0
- package/dist/types/index.d.ts +3 -1
- package/package.json +1 -1
- package/dist/components/stepper/index.d.ts +0 -2
- package/dist/components/stepper/stepper-item/stepper-item.js +0 -49
- package/dist/types/components/stepper/index.d.ts +0 -2
- /package/dist/components/{stepper/stepper-item → stepper-item}/stepper-item.d.ts +0 -0
- /package/dist/types/components/{stepper/stepper-item → stepper-item}/stepper-item.d.ts +0 -0
|
@@ -1,16 +1,5 @@
|
|
|
1
1
|
import { default as React } from 'react';
|
|
2
|
-
|
|
3
|
-
export type StepperItemType = {
|
|
4
|
-
id: string;
|
|
5
|
-
label: string;
|
|
6
|
-
state?: StepperState;
|
|
7
|
-
};
|
|
8
|
-
export type StepperHandle = {
|
|
9
|
-
handleNext: (label?: string) => void;
|
|
10
|
-
handlePrev: (label?: string) => void;
|
|
11
|
-
reset: () => void;
|
|
12
|
-
setStepState: (index: number, state: StepperState) => void;
|
|
13
|
-
};
|
|
2
|
+
import { StepperHandle, StepperItemType } from './stepper.types';
|
|
14
3
|
declare const Z2Stepper: React.ForwardRefExoticComponent<{
|
|
15
4
|
items: StepperItemType[];
|
|
16
5
|
} & React.RefAttributes<StepperHandle>>;
|
|
@@ -1,50 +1,60 @@
|
|
|
1
|
-
import { jsx as l, jsxs as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import { Z2StepperItem as
|
|
4
|
-
function
|
|
1
|
+
import { jsx as l, jsxs as p } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as c, useState as h, useImperativeHandle as x } from "react";
|
|
3
|
+
import { Z2StepperItem as w } from "../stepper-item/stepper-item.js";
|
|
4
|
+
function b() {
|
|
5
5
|
return /* @__PURE__ */ l("div", { className: "w-3 h-[1.5px] border-solid border-1 stroke-solid-high" });
|
|
6
6
|
}
|
|
7
|
-
const
|
|
8
|
-
({ items:
|
|
9
|
-
const [
|
|
10
|
-
...
|
|
11
|
-
state:
|
|
12
|
-
})))
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
7
|
+
const S = c(
|
|
8
|
+
({ items: f }, u) => {
|
|
9
|
+
const [o, d] = h(() => f.map((t, a) => ({
|
|
10
|
+
...t,
|
|
11
|
+
state: t.state ?? (a === 0 ? "active" : "disabled")
|
|
12
|
+
}))), i = (t, a, n = "handleNext") => {
|
|
13
|
+
let r;
|
|
14
|
+
if (a) {
|
|
15
|
+
if (r = t.findIndex((e) => e.id === a), r === -1)
|
|
16
|
+
throw new Error(`${n}: step with id '${a}' not found`);
|
|
17
|
+
} else if (r = t.findIndex((e) => e.state === "active"), r === -1) throw new Error(`${n}: no active step found`);
|
|
18
|
+
return r;
|
|
19
|
+
};
|
|
20
|
+
return x(u, () => ({
|
|
21
|
+
handleNext: (t, a) => {
|
|
22
|
+
d((n) => {
|
|
23
|
+
const r = i(n, t, "handleNext");
|
|
24
|
+
return r === n.length - 1 ? n.map(
|
|
25
|
+
(e, s) => s === r ? { ...e, state: "completed" } : e
|
|
26
|
+
) : n.map((e, s) => s === r ? { ...e, state: "completed" } : s === r + 1 ? { ...e, state: "active", label: a ?? e.label } : e);
|
|
20
27
|
});
|
|
21
28
|
},
|
|
22
|
-
handlePrev: (a) => {
|
|
23
|
-
|
|
24
|
-
const r =
|
|
25
|
-
return r <= 0 ?
|
|
29
|
+
handlePrev: (t, a) => {
|
|
30
|
+
d((n) => {
|
|
31
|
+
const r = i(n, t, "handlePrev");
|
|
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);
|
|
26
33
|
});
|
|
27
34
|
},
|
|
28
35
|
reset: () => {
|
|
29
|
-
|
|
30
|
-
(
|
|
31
|
-
...
|
|
32
|
-
state:
|
|
36
|
+
d(
|
|
37
|
+
(t) => t.map((a, n) => ({
|
|
38
|
+
...a,
|
|
39
|
+
state: n === 0 ? "active" : "disabled"
|
|
33
40
|
}))
|
|
34
41
|
);
|
|
35
42
|
},
|
|
36
|
-
setStepState: (
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
43
|
+
setStepState: (t, a) => {
|
|
44
|
+
if (!t) throw new Error("setStepState: id is required");
|
|
45
|
+
d((n) => {
|
|
46
|
+
const r = n.findIndex((e) => e.id === t);
|
|
47
|
+
if (r === -1) throw new Error(`setStepState: step with id '${t}' not found`);
|
|
48
|
+
return n.map((e, s) => s === r ? { ...e, state: a } : e);
|
|
49
|
+
});
|
|
40
50
|
}
|
|
41
|
-
})), /* @__PURE__ */ l("div", { className: "w-fit flex flex-row items-center gap-6", children:
|
|
42
|
-
/* @__PURE__ */ l(
|
|
43
|
-
|
|
44
|
-
] },
|
|
51
|
+
})), /* @__PURE__ */ l("div", { className: "w-fit flex flex-row items-center gap-6", children: o.map((t, a) => /* @__PURE__ */ p("div", { className: "flex flex-row items-center gap-6", children: [
|
|
52
|
+
/* @__PURE__ */ l(w, { label: t.label, state: t.state }),
|
|
53
|
+
a < o.length - 1 && /* @__PURE__ */ l(b, {})
|
|
54
|
+
] }, t.id)) });
|
|
45
55
|
}
|
|
46
56
|
);
|
|
47
|
-
|
|
57
|
+
S.displayName = "Z2Stepper";
|
|
48
58
|
export {
|
|
49
|
-
|
|
59
|
+
S as default
|
|
50
60
|
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type StepperState = 'active' | 'completed' | 'disabled';
|
|
2
|
+
export type StepperItemType = {
|
|
3
|
+
id: string;
|
|
4
|
+
label: string;
|
|
5
|
+
state?: StepperState;
|
|
6
|
+
};
|
|
7
|
+
export type StepperHandle = {
|
|
8
|
+
handleNext: (activeId?: string, label?: string) => void;
|
|
9
|
+
handlePrev: (activeId?: string, label?: string) => void;
|
|
10
|
+
reset: () => void;
|
|
11
|
+
setStepState: (activeId: string, state: StepperState) => void;
|
|
12
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { jsxs as m, jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import * as c from "react";
|
|
3
|
+
import { cva as p } from "class-variance-authority";
|
|
4
|
+
import { cn as l } from "../../lib/utils.js";
|
|
5
|
+
import f from "../assets/icons/circle-check-filled.js";
|
|
6
|
+
import n from "../assets/icons/media-record.js";
|
|
7
|
+
const h = p("w-fit flex items-center select-none gap-2", {
|
|
8
|
+
variants: {
|
|
9
|
+
state: {
|
|
10
|
+
active: "",
|
|
11
|
+
completed: "opacity-100",
|
|
12
|
+
disabled: "cursor-not-allowed"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
defaultVariants: {
|
|
16
|
+
state: "active"
|
|
17
|
+
}
|
|
18
|
+
}), u = "rounded-full transition-colors w-4 h-4 border-none", g = c.forwardRef(
|
|
19
|
+
({ label: a, state: e = "active", className: o, ...s }, d) => {
|
|
20
|
+
let t, r;
|
|
21
|
+
return e === "completed" ? (t = /* @__PURE__ */ i(f, { fill: "blue", width: 16, height: 16 }), r = "text-neutral-primary leading-none-medium-sm") : e === "active" ? (t = /* @__PURE__ */ i(n, { fill: "blue", width: 16, height: 16 }), r = "text-neutral-primary leading-none-medium-sm") : (t = /* @__PURE__ */ i(n, { fill: "gray", width: 16, height: 16 }), r = "text-neutral-secondary leading-none-medium-sm"), /* @__PURE__ */ m(
|
|
22
|
+
"div",
|
|
23
|
+
{
|
|
24
|
+
ref: d,
|
|
25
|
+
className: l(h({ state: e }), o),
|
|
26
|
+
"aria-disabled": e === "disabled",
|
|
27
|
+
title: e || "disabled",
|
|
28
|
+
"aria-label": a,
|
|
29
|
+
...s,
|
|
30
|
+
children: [
|
|
31
|
+
/* @__PURE__ */ i("span", { className: u, children: t }),
|
|
32
|
+
/* @__PURE__ */ i("span", { className: l(r), children: a })
|
|
33
|
+
]
|
|
34
|
+
}
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
);
|
|
38
|
+
g.displayName = "Z2StepperItem";
|
|
39
|
+
export {
|
|
40
|
+
g as Z2StepperItem
|
|
41
|
+
};
|
package/dist/index.d.ts
CHANGED
|
@@ -8,4 +8,6 @@ export * from './components/tab/tab';
|
|
|
8
8
|
export * from './components/tooltip/tooltip';
|
|
9
9
|
export * from './components/dialog/dialog';
|
|
10
10
|
export * from './components/file-upload-area/file-upload-area';
|
|
11
|
-
export * from './components/
|
|
11
|
+
export * from './components/dialog/dialog';
|
|
12
|
+
export * from './components/file-upload-area/file-upload-area';
|
|
13
|
+
export * from './components/stepper/stepper';
|
package/dist/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/* empty css */
|
|
2
2
|
import { Alert as a, AlertDescription as p, AlertTitle as i } from "./components/alert/alert.js";
|
|
3
3
|
import { AlertCirclesIcon as m } from "./components/alert/icons/circles-icon.js";
|
|
4
|
-
import { Button as
|
|
4
|
+
import { Button as x, buttonVariants as Z } from "./components/button/button.js";
|
|
5
5
|
import { NavHeader as n } from "./components/nav-header/nav-header.js";
|
|
6
6
|
import { NavItem as v } from "./components/nav-header/nav-item/nav-item.js";
|
|
7
|
-
import { Input as
|
|
7
|
+
import { Input as g } from "./components/input/input.js";
|
|
8
8
|
import { CountryFlags as C } from "./components/country-flags/country-flags.js";
|
|
9
9
|
import { Z2SideNavBarProvider as B } from "./components/collapsible-side-nav-bar/side-nav-bar-provider.js";
|
|
10
|
-
import { Z2SideNavBar as
|
|
10
|
+
import { Z2SideNavBar as T, Z2SidebarVariants as I } from "./components/collapsible-side-nav-bar/side-nav-bar.js";
|
|
11
11
|
import { Z2SideNavBarHeader as c } from "./components/collapsible-side-nav-bar/side-nav-bar-header.js";
|
|
12
12
|
import { Z2SideNavBarContent as P } from "./components/collapsible-side-nav-bar/side-nav-bar-content.js";
|
|
13
13
|
import { Z2SideNavBarFooter as H } from "./components/collapsible-side-nav-bar/side-nav-bar-footer.js";
|
|
@@ -25,24 +25,23 @@ import { default as Y } from "./components/assets/icons/sidebar-left-show-copy.j
|
|
|
25
25
|
import { SIDEBAR_WIDTH as oo, SIDEBAR_WIDTH_COLLAPSED as ro } from "./components/collapsible-side-nav-bar/constants.js";
|
|
26
26
|
import { Z2Tabs as to, Z2TabsContent as ao, Z2TabsList as po, Z2TabsTrigger as io } from "./components/tab/tab.js";
|
|
27
27
|
import { Z2Tooltip as mo } from "./components/tooltip/tooltip.js";
|
|
28
|
-
import { Z2Dialog as
|
|
29
|
-
import { FileUploadArea as
|
|
28
|
+
import { Z2Dialog as xo, Z2DialogClose as Zo, Z2DialogContent as no, Z2DialogDescription as so, Z2DialogFooter as vo, Z2DialogHeader as Do, Z2DialogOverlay as go, Z2DialogPortal as So, Z2DialogTitle as Co, Z2DialogTrigger as uo } from "./components/dialog/dialog.js";
|
|
29
|
+
import { FileUploadArea as No } from "./components/file-upload-area/file-upload-area.js";
|
|
30
30
|
import "./components/stepper/stepper.js";
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
33
|
-
import { Z2PopoverContent as Po } from "./components/collapsible-side-nav-bar/popover/popover-content.js";
|
|
31
|
+
import { Z2PopoverTrigger as Io } from "./components/collapsible-side-nav-bar/popover/popover-trigger.js";
|
|
32
|
+
import { Z2PopoverContent as co } from "./components/collapsible-side-nav-bar/popover/popover-content.js";
|
|
34
33
|
export {
|
|
35
34
|
a as Alert,
|
|
36
35
|
m as AlertCirclesIcon,
|
|
37
36
|
p as AlertDescription,
|
|
38
37
|
i as AlertTitle,
|
|
39
|
-
|
|
38
|
+
x as Button,
|
|
40
39
|
G as ChevronUpIcon,
|
|
41
40
|
z as CirclesIcon,
|
|
42
41
|
C as CountryFlags,
|
|
43
42
|
K as DatabaseCopy,
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
No as FileUploadArea,
|
|
44
|
+
g as Input,
|
|
46
45
|
n as NavHeader,
|
|
47
46
|
v as NavItem,
|
|
48
47
|
oo as SIDEBAR_WIDTH,
|
|
@@ -50,20 +49,20 @@ export {
|
|
|
50
49
|
Y as SidebarLeftShowCopy,
|
|
51
50
|
k as SubNavIndicator,
|
|
52
51
|
Q as WindowLeftCopy,
|
|
53
|
-
|
|
52
|
+
xo as Z2Dialog,
|
|
54
53
|
Zo as Z2DialogClose,
|
|
55
54
|
no as Z2DialogContent,
|
|
56
55
|
so as Z2DialogDescription,
|
|
57
56
|
vo as Z2DialogFooter,
|
|
58
57
|
Do as Z2DialogHeader,
|
|
59
|
-
|
|
60
|
-
|
|
58
|
+
go as Z2DialogOverlay,
|
|
59
|
+
So as Z2DialogPortal,
|
|
61
60
|
Co as Z2DialogTitle,
|
|
62
61
|
uo as Z2DialogTrigger,
|
|
63
62
|
U as Z2Popover,
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
63
|
+
co as Z2PopoverContent,
|
|
64
|
+
Io as Z2PopoverTrigger,
|
|
65
|
+
T as Z2SideNavBar,
|
|
67
66
|
P as Z2SideNavBarContent,
|
|
68
67
|
H as Z2SideNavBarFooter,
|
|
69
68
|
F as Z2SideNavBarGroup,
|
|
@@ -71,8 +70,7 @@ export {
|
|
|
71
70
|
W as Z2SideNavBarItem,
|
|
72
71
|
B as Z2SideNavBarProvider,
|
|
73
72
|
h as Z2SideNavBarSeparator,
|
|
74
|
-
|
|
75
|
-
To as Z2StepperItem,
|
|
73
|
+
I as Z2SidebarVariants,
|
|
76
74
|
to as Z2Tabs,
|
|
77
75
|
ao as Z2TabsContent,
|
|
78
76
|
po as Z2TabsList,
|
|
@@ -1,16 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
3
|
-
export type StepperItemType = {
|
|
4
|
-
id: string;
|
|
5
|
-
label: string;
|
|
6
|
-
state?: StepperState;
|
|
7
|
-
};
|
|
8
|
-
export type StepperHandle = {
|
|
9
|
-
handleNext: (label?: string) => void;
|
|
10
|
-
handlePrev: (label?: string) => void;
|
|
11
|
-
reset: () => void;
|
|
12
|
-
setStepState: (index: number, state: StepperState) => void;
|
|
13
|
-
};
|
|
2
|
+
import { StepperHandle, StepperItemType } from './stepper.types';
|
|
14
3
|
declare const Z2Stepper: React.ForwardRefExoticComponent<{
|
|
15
4
|
items: StepperItemType[];
|
|
16
5
|
} & React.RefAttributes<StepperHandle>>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export type StepperState = 'active' | 'completed' | 'disabled';
|
|
2
|
+
export type StepperItemType = {
|
|
3
|
+
id: string;
|
|
4
|
+
label: string;
|
|
5
|
+
state?: StepperState;
|
|
6
|
+
};
|
|
7
|
+
export type StepperHandle = {
|
|
8
|
+
handleNext: (activeId?: string, label?: string) => void;
|
|
9
|
+
handlePrev: (activeId?: string, label?: string) => void;
|
|
10
|
+
reset: () => void;
|
|
11
|
+
setStepState: (activeId: string, state: StepperState) => void;
|
|
12
|
+
};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -9,4 +9,6 @@ export * from './components/tab/tab';
|
|
|
9
9
|
export * from './components/tooltip/tooltip';
|
|
10
10
|
export * from './components/dialog/dialog';
|
|
11
11
|
export * from './components/file-upload-area/file-upload-area';
|
|
12
|
-
export * from './components/
|
|
12
|
+
export * from './components/dialog/dialog';
|
|
13
|
+
export * from './components/file-upload-area/file-upload-area';
|
|
14
|
+
export * from './components/stepper/stepper';
|
package/package.json
CHANGED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { jsxs as a, jsx as i } from "react/jsx-runtime";
|
|
2
|
-
import * as n from "react";
|
|
3
|
-
import { cva as c } from "class-variance-authority";
|
|
4
|
-
import { cn as l } from "../../../lib/utils.js";
|
|
5
|
-
import m from "../../assets/icons/circle-check-filled.js";
|
|
6
|
-
import s from "../../assets/icons/media-record.js";
|
|
7
|
-
const p = c("w-fit flex items-center select-none gap-2", {
|
|
8
|
-
variants: {
|
|
9
|
-
state: {
|
|
10
|
-
active: "",
|
|
11
|
-
completed: "opacity-100",
|
|
12
|
-
disabled: "cursor-not-allowed"
|
|
13
|
-
}
|
|
14
|
-
},
|
|
15
|
-
defaultVariants: {
|
|
16
|
-
state: "active"
|
|
17
|
-
}
|
|
18
|
-
}), f = "rounded-full transition-colors w-4 h-4 border-none", h = n.forwardRef(
|
|
19
|
-
({ label: r, state: e = "active", className: t, ...d }, o) => /* @__PURE__ */ a(
|
|
20
|
-
"div",
|
|
21
|
-
{
|
|
22
|
-
ref: o,
|
|
23
|
-
className: l(p({ state: e }), t),
|
|
24
|
-
"aria-disabled": e === "disabled",
|
|
25
|
-
title: e || "disabled",
|
|
26
|
-
"aria-label": r,
|
|
27
|
-
...d,
|
|
28
|
-
children: [
|
|
29
|
-
/* @__PURE__ */ a("span", { className: f, children: [
|
|
30
|
-
e === "completed" && /* @__PURE__ */ i(m, { fill: "blue", width: 16, height: 16 }),
|
|
31
|
-
(e === "active" || e === "disabled") && /* @__PURE__ */ i(s, { fill: e === "active" ? "blue" : "gray", width: 16, height: 16 })
|
|
32
|
-
] }),
|
|
33
|
-
/* @__PURE__ */ i(
|
|
34
|
-
"span",
|
|
35
|
-
{
|
|
36
|
-
className: l(
|
|
37
|
-
e === "disabled" ? "text-neutral-secondary leading-none-medium-sm" : "text-neutral-primary leading-none-medium-sm"
|
|
38
|
-
),
|
|
39
|
-
children: r
|
|
40
|
-
}
|
|
41
|
-
)
|
|
42
|
-
]
|
|
43
|
-
}
|
|
44
|
-
)
|
|
45
|
-
);
|
|
46
|
-
h.displayName = "Z2StepperItem";
|
|
47
|
-
export {
|
|
48
|
-
h as Z2StepperItem
|
|
49
|
-
};
|
|
File without changes
|
|
File without changes
|