@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.
@@ -1,12 +1,12 @@
1
- import { jsx as l, jsxs as p } from "react/jsx-runtime";
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__ */ l("div", { className: "w-3 h-[1.5px] border-solid border-1 stroke-solid-high" });
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 [o, d] = h(() => f.map((t, a) => ({
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
- d((n) => {
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
- d((n) => {
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
- d(
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
- d((n) => {
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__ */ 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, {})
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,6 +3,7 @@ export type StepperItemType = {
3
3
  id: string;
4
4
  label: string;
5
5
  state?: StepperState;
6
+ onClick?: () => void;
6
7
  };
7
8
  export type StepperHandle = {
8
9
  handleNext: (activeId?: string, label?: string) => void;
@@ -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<HTMLDivElement>, VariantProps<typeof z2StepperItemVariants> {
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<HTMLDivElement>>;
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 n from "../assets/icons/media-record.js";
7
- const h = p("w-fit flex items-center select-none gap-2", {
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
- }), u = "rounded-full transition-colors w-4 h-4 border-none", v = 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: "var(--blue-500)", width: 16, height: 16 }), r = "text-neutral-primary leading-none-medium-sm") : e === "active" ? (t = /* @__PURE__ */ i(n, { fill: "var(--blue-500)", width: 16, height: 16 }), r = "text-neutral-primary leading-none-medium-sm") : (t = /* @__PURE__ */ i(n, { fill: "var(--neutral-500)", width: 16, height: 16 }), r = "text-neutral-secondary leading-none-medium-sm"), /* @__PURE__ */ m(
22
- "div",
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(h({ state: e }), o),
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: u, children: t }),
32
- /* @__PURE__ */ i("span", { className: l(r), children: a })
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
- v.displayName = "Z2StepperItem";
39
+ b.displayName = "Z2StepperItem";
39
40
  export {
40
- v as Z2StepperItem
41
+ b as Z2StepperItem
41
42
  };
@@ -3,6 +3,7 @@ export type StepperItemType = {
3
3
  id: string;
4
4
  label: string;
5
5
  state?: StepperState;
6
+ onClick?: () => void;
6
7
  };
7
8
  export type StepperHandle = {
8
9
  handleNext: (activeId?: string, label?: string) => void;
@@ -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<HTMLDivElement>, VariantProps<typeof z2StepperItemVariants> {
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<HTMLDivElement>>;
9
+ export declare const Z2StepperItem: React.ForwardRefExoticComponent<Z2StepperItemProps & React.RefAttributes<HTMLButtonElement>>;
10
10
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ztwoint/z-ui",
3
- "version": "0.1.76",
3
+ "version": "0.1.77",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",