@ztwoint/z-ui 0.1.64 → 0.1.65

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,26 +1,36 @@
1
1
  import { jsx as r } from "react/jsx-runtime";
2
2
  import "react";
3
- import { cn as n } from "../../lib/utils.js";
4
- import { ColumnItem as s } from "./components/column-item/column-item.js";
5
- import { useColumnReorder as a } from "./column-reorder.hook.js";
6
- const b = ({
3
+ import { cn as s } from "../../lib/utils.js";
4
+ import { ColumnItem as a } from "./components/column-item/column-item.js";
5
+ import { useColumnReorder as u } from "./column-reorder.hook.js";
6
+ const v = ({
7
7
  columns: e,
8
8
  onReorder: d,
9
9
  onRemove: i,
10
- className: m
10
+ renderAction: m,
11
+ className: t
11
12
  }) => {
12
- const { internalColumns: t } = a({ columns: e, onReorder: d });
13
+ const { internalColumns: l } = u({ columns: e, onReorder: d });
13
14
  return /* @__PURE__ */ r(
14
15
  "div",
15
16
  {
16
- className: n(
17
+ className: s(
17
18
  "rounded-2xl border-[0.5px] border-stroke-solid-light bg-background-neutral-default overflow-hidden box-shadow-medium-10",
18
- m
19
+ t
19
20
  ),
20
- children: /* @__PURE__ */ r("div", { className: "divide-y divide-stroke-solid-light", children: t.map((o, l) => /* @__PURE__ */ r(s, { column: o, index: l, onRemove: i }, o.id)) })
21
+ children: /* @__PURE__ */ r("div", { className: "divide-y divide-stroke-solid-light", children: l.map((o, n) => /* @__PURE__ */ r(
22
+ a,
23
+ {
24
+ column: o,
25
+ index: n,
26
+ onRemove: i,
27
+ renderAction: m
28
+ },
29
+ o.id
30
+ )) })
21
31
  }
22
32
  );
23
33
  };
24
34
  export {
25
- b as ColumnReOrder
35
+ v as ColumnReOrder
26
36
  };
@@ -8,5 +8,6 @@ export interface ColumnReOrderProps {
8
8
  columns: ColumnType[];
9
9
  onReorder?: (reorderedColumns: ColumnType[]) => void;
10
10
  onRemove?: (columnId: string) => void;
11
+ renderAction?: (column: ColumnType, onRemove: ((columnId: string) => void) | undefined) => React.ReactNode;
11
12
  className?: string;
12
13
  }
@@ -1,79 +1,84 @@
1
- import { jsxs as s, Fragment as u, jsx as e } from "react/jsx-runtime";
2
- import { createPortal as g } from "react-dom";
1
+ import { jsxs as i, Fragment as g, jsx as e } from "react/jsx-runtime";
2
+ import { createPortal as p } from "react-dom";
3
3
  import "react";
4
- import { cn as i } from "../../../../lib/utils.js";
5
- import { useColumnItemDragAndDrop as p } from "./column-item.hook.js";
6
- import { Button as f } from "../../../button/button.js";
7
- import { Minus as h } from "../../../assets/icons/minus.js";
8
- import { parseColumnLabel as l } from "./column-item.util.js";
9
- import c from "../../../assets/icons/drag-handle.js";
10
- const x = {
4
+ import { cn as l } from "../../../../lib/utils.js";
5
+ import { useColumnItemDragAndDrop as f } from "./column-item.hook.js";
6
+ import { Button as h } from "../../../button/button.js";
7
+ import { Minus as x } from "../../../assets/icons/minus.js";
8
+ import { parseColumnLabel as c } from "./column-item.util.js";
9
+ import d from "../../../assets/icons/drag-handle.js";
10
+ const b = {
11
11
  "is-dragging": "opacity-40",
12
12
  "is-dragging-over": "bg-background-neutral-medium"
13
- }, b = ({
13
+ }, N = ({
14
14
  edge: t,
15
15
  isFirstElement: r = !1
16
16
  }) => /* @__PURE__ */ e(
17
17
  "div",
18
18
  {
19
- className: i(
19
+ className: l(
20
20
  "absolute left-0 right-0 h-0.5 bg-blue-500",
21
21
  t === "top" ? r ? "top-0" : "top-[-3px]" : "bottom-0"
22
22
  )
23
23
  }
24
24
  );
25
- function N({ column: t }) {
26
- const { groupLabel: r, fieldLabel: n } = l(t);
27
- return /* @__PURE__ */ s("div", { className: "flex items-center gap-3 p-1 bg-background-neutral-default border border-stroke-solid-light rounded-xl ", children: [
28
- /* @__PURE__ */ e(c, {}),
25
+ function v({ column: t }) {
26
+ const { groupLabel: r, fieldLabel: a } = c(t);
27
+ return /* @__PURE__ */ i("div", { className: "flex items-center gap-3 p-1 bg-background-neutral-default border border-stroke-solid-light rounded-xl ", children: [
28
+ /* @__PURE__ */ e(d, {}),
29
29
  /* @__PURE__ */ e("div", { className: "shrink-0 flex items-center justify-center w-3.5 h-3.5 ", children: t.icon }),
30
- /* @__PURE__ */ s("div", { className: "flex items-center gap-0.5 min-w-0 leading-none-regular-sm", children: [
30
+ /* @__PURE__ */ i("div", { className: "flex items-center gap-0.5 min-w-0 leading-none-regular-sm", children: [
31
31
  /* @__PURE__ */ e("span", { className: "text-text-neutral-secondary truncate", children: r }),
32
32
  /* @__PURE__ */ e("span", { className: "text-text-neutral-muted", children: "/" }),
33
- /* @__PURE__ */ e("span", { className: "text-text-neutral-primary truncate", children: n })
33
+ /* @__PURE__ */ e("span", { className: "text-text-neutral-primary truncate", children: a })
34
34
  ] })
35
35
  ] });
36
36
  }
37
- const E = ({ column: t, index: r, onRemove: n }) => {
38
- const { ref: d, state: a } = p(t, r), { groupLabel: o, fieldLabel: m } = l(t);
39
- return /* @__PURE__ */ s(u, { children: [
40
- /* @__PURE__ */ s("div", { className: "relative border-b-0.5", children: [
41
- /* @__PURE__ */ s(
37
+ const F = ({
38
+ column: t,
39
+ index: r,
40
+ onRemove: a,
41
+ renderAction: n
42
+ }) => {
43
+ const { ref: o, state: s } = f(t, r), { groupLabel: m, fieldLabel: u } = c(t);
44
+ return /* @__PURE__ */ i(g, { children: [
45
+ /* @__PURE__ */ i("div", { className: "relative border-b-0.5", children: [
46
+ /* @__PURE__ */ i(
42
47
  "div",
43
48
  {
44
49
  "data-column-id": t.id,
45
- ref: d,
46
- className: i(
50
+ ref: o,
51
+ className: l(
47
52
  "flex items-center gap-2 p-1 pl-3 bg-background-neutral-default cursor-grab hover:bg-background-neutral-medium transition-colors",
48
- x[a.type] ?? ""
53
+ b[s.type] ?? ""
49
54
  ),
50
55
  children: [
51
- /* @__PURE__ */ e(c, {}),
56
+ /* @__PURE__ */ e(d, {}),
52
57
  /* @__PURE__ */ e("div", { className: "shrink-0 flex items-center justify-center w-3.5 h-3.5", children: t.icon }),
53
- /* @__PURE__ */ s("div", { className: "flex items-center gap-0.5 min-w-0 leading-none-regular-sm", children: [
54
- /* @__PURE__ */ e("span", { className: "text-text-neutral-secondary truncate", children: o }),
58
+ /* @__PURE__ */ i("div", { className: "flex items-center gap-0.5 min-w-0 leading-none-regular-sm", children: [
59
+ /* @__PURE__ */ e("span", { className: "text-text-neutral-secondary truncate", children: m }),
55
60
  /* @__PURE__ */ e("span", { className: "text-text-neutral-muted", children: "/" }),
56
- /* @__PURE__ */ e("span", { className: "text-text-neutral-primary truncate", children: m })
61
+ /* @__PURE__ */ e("span", { className: "text-text-neutral-primary truncate", children: u })
57
62
  ] }),
58
- /* @__PURE__ */ e("div", { className: "ml-auto flex items-center gap-3", children: /* @__PURE__ */ e(
59
- f,
63
+ /* @__PURE__ */ e("div", { className: "ml-auto flex items-center gap-3", children: n ? n(t, a) : /* @__PURE__ */ e(
64
+ h,
60
65
  {
61
- onClick: () => n == null ? void 0 : n(t.id),
66
+ onClick: () => a == null ? void 0 : a(t.id),
62
67
  variant: "ghost",
63
68
  shade: "neutral",
64
69
  size: "medium",
65
- leftIcon: /* @__PURE__ */ e(h, { className: "w-4 h-4" })
70
+ leftIcon: /* @__PURE__ */ e(x, { className: "w-4 h-4" })
66
71
  }
67
72
  ) })
68
73
  ]
69
74
  }
70
75
  ),
71
- a.type === "is-dragging-over" && a.closestEdge && /* @__PURE__ */ e(b, { edge: a.closestEdge, isFirstElement: r === 0 })
76
+ s.type === "is-dragging-over" && s.closestEdge && /* @__PURE__ */ e(N, { edge: s.closestEdge, isFirstElement: r === 0 })
72
77
  ] }),
73
- a.type === "preview" && g(/* @__PURE__ */ e(N, { column: t }), a.container)
78
+ s.type === "preview" && p(/* @__PURE__ */ e(v, { column: t }), s.container)
74
79
  ] });
75
80
  };
76
81
  export {
77
- E as ColumnItem,
78
- E as default
82
+ F as ColumnItem,
83
+ F as default
79
84
  };
@@ -15,4 +15,5 @@ export interface ColumnItemProps {
15
15
  column: ColumnType;
16
16
  index: number;
17
17
  onRemove?: (columnId: string) => void;
18
+ renderAction?: (column: ColumnType, onRemove?: (columnId: string) => void) => React.ReactNode;
18
19
  }
@@ -8,5 +8,6 @@ export interface ColumnReOrderProps {
8
8
  columns: ColumnType[];
9
9
  onReorder?: (reorderedColumns: ColumnType[]) => void;
10
10
  onRemove?: (columnId: string) => void;
11
+ renderAction?: (column: ColumnType, onRemove: ((columnId: string) => void) | undefined) => React.ReactNode;
11
12
  className?: string;
12
13
  }
@@ -15,4 +15,5 @@ export interface ColumnItemProps {
15
15
  column: ColumnType;
16
16
  index: number;
17
17
  onRemove?: (columnId: string) => void;
18
+ renderAction?: (column: ColumnType, onRemove?: (columnId: string) => void) => React.ReactNode;
18
19
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ztwoint/z-ui",
3
- "version": "0.1.64",
3
+ "version": "0.1.65",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",