@ztwoint/z-ui 0.1.119 → 0.1.121

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,8 +1,8 @@
1
- import { jsxs as m, jsx as o, Fragment as z } from "react/jsx-runtime";
1
+ import { jsxs as R, jsx as o, Fragment as z } from "react/jsx-runtime";
2
2
  import { Fragment as P } from "react";
3
- import { Z2Checkbox as w } from "../checkbox/checkbox.js";
3
+ import { Z2Checkbox as k } from "../checkbox/checkbox.js";
4
4
  import { useZ2Table as g } from "./z2-table-context.js";
5
- import { flexRender as k } from "@tanstack/react-table";
5
+ import { flexRender as w } from "@tanstack/react-table";
6
6
  import { cva as v } from "class-variance-authority";
7
7
  import { cn as p } from "../../lib/utils.js";
8
8
  import { Z2Skeleton as Z } from "../skeleton/skeleton.js";
@@ -97,7 +97,7 @@ function D({
97
97
  dndRef: t,
98
98
  dndStyle: r
99
99
  }) {
100
- var c, b, h, f, C, y, x, R;
100
+ var c, b, m, h, f, C, y, x;
101
101
  const { props: a } = g(), { column: n } = e, d = n.getIsPinned(), s = d === "left" && n.getIsLastColumn("left"), i = d === "right" && n.getIsFirstColumn("right"), u = B({
102
102
  size: (c = a.tableLayout) != null && c.dense ? "dense" : "default"
103
103
  });
@@ -105,11 +105,12 @@ function D({
105
105
  "th",
106
106
  {
107
107
  ref: t,
108
+ colSpan: e.colSpan,
108
109
  style: {
109
110
  ...((b = a.tableLayout) == null ? void 0 : b.width) === "fixed" && {
110
111
  width: `${e.getSize()}px`
111
112
  },
112
- ...((h = a.tableLayout) == null ? void 0 : h.columnsPinnable) && n.getCanPin() && N(n),
113
+ ...((m = a.tableLayout) == null ? void 0 : m.columnsPinnable) && n.getCanPin() && N(n),
113
114
  ...r || null
114
115
  },
115
116
  "data-pinned": d || void 0,
@@ -117,11 +118,11 @@ function D({
117
118
  className: p(
118
119
  "relative h-10 text-left rtl:text-right align-middle [&:has([role=checkbox])]:pe-0 border-stroke-solid-light leading-none-medium-sm dark:text-inverted-secondary",
119
120
  u,
120
- ((f = a.tableLayout) == null ? void 0 : f.cellBorder) && "border-e",
121
- ((C = a.tableLayout) == null ? void 0 : C.columnsResizable) && n.getCanResize() && "truncate",
122
- ((y = a.tableLayout) == null ? void 0 : y.columnsPinnable) && n.getCanPin() && "[&:not([data-pinned]):has(+[data-pinned])_div.cursor-col-resize:last-child]:opacity-0 [&[data-last-col=left]_div.cursor-col-resize:last-child]:opacity-0 [&[data-pinned=left][data-last-col=left]]:border-e! [&[data-pinned=right]:last-child_div.cursor-col-resize:last-child]:opacity-0 [&[data-pinned=right][data-last-col=right]]:border-s! [&[data-pinned][data-last-col]]:border-border data-pinned:bg-muted/90 data-pinned:backdrop-blur-xs",
123
- (x = e.column.columnDef.meta) == null ? void 0 : x.headerClassName,
124
- n.getIndex() === 0 || n.getIndex() === e.headerGroup.headers.length - 1 ? (R = a.tableClassNames) == null ? void 0 : R.edgeCell : ""
121
+ ((h = a.tableLayout) == null ? void 0 : h.cellBorder) && "border-e",
122
+ ((f = a.tableLayout) == null ? void 0 : f.columnsResizable) && n.getCanResize() && "truncate",
123
+ ((C = a.tableLayout) == null ? void 0 : C.columnsPinnable) && n.getCanPin() && "[&:not([data-pinned]):has(+[data-pinned])_div.cursor-col-resize:last-child]:opacity-0 [&[data-last-col=left]_div.cursor-col-resize:last-child]:opacity-0 [&[data-pinned=left][data-last-col=left]]:border-e! [&[data-pinned=right]:last-child_div.cursor-col-resize:last-child]:opacity-0 [&[data-pinned=right][data-last-col=right]]:border-s! [&[data-pinned][data-last-col]]:border-border data-pinned:bg-muted/90 data-pinned:backdrop-blur-xs",
124
+ (y = e.column.columnDef.meta) == null ? void 0 : y.headerClassName,
125
+ n.getIndex() === 0 || n.getIndex() === e.headerGroup.headers.length - 1 ? (x = a.tableClassNames) == null ? void 0 : x.edgeCell : ""
125
126
  ),
126
127
  children: l
127
128
  },
@@ -259,7 +260,7 @@ function $({
259
260
  dndRef: t,
260
261
  dndStyle: r
261
262
  }) {
262
- var b, h, f, C, y, x, R, L;
263
+ var b, m, h, f, C, y, x, L;
263
264
  const { props: a } = g(), { column: n, row: d } = e, s = n.getIsPinned(), i = s === "left" && n.getIsLastColumn("left"), u = s === "right" && n.getIsFirstColumn("right"), c = S({
264
265
  size: (b = a.tableLayout) != null && b.dense ? "dense" : "default"
265
266
  });
@@ -267,9 +268,9 @@ function $({
267
268
  "td",
268
269
  {
269
270
  ref: t,
270
- ...(h = a.tableLayout) != null && h.columnsDraggable && !s ? { cell: e } : {},
271
+ ...(m = a.tableLayout) != null && m.columnsDraggable && !s ? { cell: e } : {},
271
272
  style: {
272
- ...((f = a.tableLayout) == null ? void 0 : f.columnsPinnable) && n.getCanPin() && N(n),
273
+ ...((h = a.tableLayout) == null ? void 0 : h.columnsPinnable) && n.getCanPin() && N(n),
273
274
  ...r || null
274
275
  },
275
276
  "data-pinned": s || void 0,
@@ -277,10 +278,10 @@ function $({
277
278
  className: p(
278
279
  "align-middle",
279
280
  c,
280
- ((C = a.tableLayout) == null ? void 0 : C.cellBorder) && "border-e border-stroke-solid-light",
281
- ((y = a.tableLayout) == null ? void 0 : y.columnsResizable) && n.getCanResize() && "truncate",
282
- (x = e.column.columnDef.meta) == null ? void 0 : x.cellClassName,
283
- ((R = a.tableLayout) == null ? void 0 : R.columnsPinnable) && n.getCanPin() && '[&[data-pinned=left][data-last-col=left]]:border-e! [&[data-pinned=right][data-last-col=right]]:border-s! [&[data-pinned][data-last-col]]:border-border data-pinned:bg-background/90 data-pinned:backdrop-blur-xs"',
281
+ ((f = a.tableLayout) == null ? void 0 : f.cellBorder) && "border-e border-stroke-solid-light",
282
+ ((C = a.tableLayout) == null ? void 0 : C.columnsResizable) && n.getCanResize() && "truncate",
283
+ (y = e.column.columnDef.meta) == null ? void 0 : y.cellClassName,
284
+ ((x = a.tableLayout) == null ? void 0 : x.columnsPinnable) && n.getCanPin() && '[&[data-pinned=left][data-last-col=left]]:border-e! [&[data-pinned=right][data-last-col=right]]:border-s! [&[data-pinned][data-last-col]]:border-border data-pinned:bg-background/90 data-pinned:backdrop-blur-xs"',
284
285
  n.getIndex() === 0 || n.getIndex() === d.getVisibleCells().length - 1 ? (L = a.tableClassNames) == null ? void 0 : L.edgeCell : ""
285
286
  ),
286
287
  children: l
@@ -294,8 +295,8 @@ function G() {
294
295
  }
295
296
  function O() {
296
297
  const { table: l, props: e } = g(), t = l.getAllColumns().length;
297
- return /* @__PURE__ */ o("tr", { style: { height: l.getState().pagination.pageSize * 43 }, children: /* @__PURE__ */ o("td", { colSpan: t, className: "text-center text-muted-foreground py-6", children: /* @__PURE__ */ m("div", { className: "text-neutral-muted flex items-center gap-2 px-4 py-2 leading-none-medium-sm justify-center", children: [
298
- /* @__PURE__ */ m(
298
+ return /* @__PURE__ */ o("tr", { style: { height: l.getState().pagination.pageSize * 43 }, children: /* @__PURE__ */ o("td", { colSpan: t, className: "text-center text-muted-foreground py-6", children: /* @__PURE__ */ R("div", { className: "text-neutral-muted flex items-center gap-2 px-4 py-2 leading-none-medium-sm justify-center", children: [
299
+ /* @__PURE__ */ R(
299
300
  "svg",
300
301
  {
301
302
  xmlns: "http://www.w3.org/2000/svg",
@@ -356,31 +357,20 @@ function ee({
356
357
  row: l
357
358
  // size,
358
359
  }) {
359
- return /* @__PURE__ */ m(z, { children: [
360
- /* @__PURE__ */ o(
361
- "div",
362
- {
363
- className: p(
364
- "hidden absolute top-0 bottom-0 start-0 w-[2px] bg-primary",
365
- l.getIsSelected() && "block"
366
- )
367
- }
368
- ),
369
- /* @__PURE__ */ o(
370
- w,
371
- {
372
- checked: l.getIsSelected(),
373
- onCheckedChange: (e) => l.toggleSelected(!!e),
374
- "aria-label": "Select row",
375
- className: "align-[inherit]"
376
- }
377
- )
378
- ] });
360
+ return /* @__PURE__ */ o(z, { children: /* @__PURE__ */ o(
361
+ k,
362
+ {
363
+ checked: l.getIsSelected(),
364
+ onCheckedChange: (e) => l.toggleSelected(!!e),
365
+ "aria-label": "Select row",
366
+ className: "align-[inherit]"
367
+ }
368
+ ) });
379
369
  }
380
370
  function te(l) {
381
371
  const { table: e, recordCount: t, isLoading: r } = g();
382
372
  return /* @__PURE__ */ o(
383
- w,
373
+ k,
384
374
  {
385
375
  checked: e.getIsAllPageRowsSelected() || e.getIsSomePageRowsSelected() && "indeterminate",
386
376
  disabled: r || t === 0,
@@ -393,20 +383,20 @@ function te(l) {
393
383
  function ae() {
394
384
  var a, n;
395
385
  const { table: l, isLoading: e, props: t } = g(), r = l.getState().pagination;
396
- return /* @__PURE__ */ m(_, { children: [
386
+ return /* @__PURE__ */ R(_, { children: [
397
387
  (((a = t.tableLayout) == null ? void 0 : a.stripped) || !((n = t.tableLayout) != null && n.rowBorder)) && /* @__PURE__ */ o(M, {}),
398
388
  /* @__PURE__ */ o(V, { children: e && (r != null && r.pageSize) ? t.loadingMode === "skeleton" ? Array.from({ length: r.pageSize }).map((d, s) => /* @__PURE__ */ o(F, { children: l.getVisibleFlatColumns().map((i, u) => {
399
389
  var c;
400
390
  return /* @__PURE__ */ o(H, { column: i, children: ((c = i.columnDef.meta) == null ? void 0 : c.skeleton) || /* @__PURE__ */ o(Z, { className: "h-4 w-full" }) }, u);
401
- }) }, s)) : /* @__PURE__ */ o(O, {}) : l.getRowModel().rows.length ? l.getRowModel().rows.map((d, s) => /* @__PURE__ */ m(P, { children: [
402
- /* @__PURE__ */ o(E, { row: d, children: d.getVisibleCells().map((i, u) => /* @__PURE__ */ o($, { cell: i, children: k(i.column.columnDef.cell, i.getContext()) }, u)) }, s),
391
+ }) }, s)) : /* @__PURE__ */ o(O, {}) : l.getRowModel().rows.length ? l.getRowModel().rows.map((d, s) => /* @__PURE__ */ R(P, { children: [
392
+ /* @__PURE__ */ o(E, { row: d, children: d.getVisibleCells().map((i, u) => /* @__PURE__ */ o($, { cell: i, children: w(i.column.columnDef.cell, i.getContext()) }, u)) }, s),
403
393
  d.getIsExpanded() && /* @__PURE__ */ o(j, { row: d })
404
394
  ] }, d.id)) : /* @__PURE__ */ o(G, {}) }),
405
395
  /* @__PURE__ */ o(I, { children: l.getHeaderGroups().map((d, s) => /* @__PURE__ */ o(T, { headerGroup: d, children: d.headers.map((i, u) => {
406
396
  var b;
407
397
  const { column: c } = i;
408
- return /* @__PURE__ */ m(D, { header: i, children: [
409
- i.isPlaceholder ? null : k(i.column.columnDef.header, i.getContext()),
398
+ return /* @__PURE__ */ R(D, { header: i, children: [
399
+ i.isPlaceholder ? null : w(i.column.columnDef.header, i.getContext()),
410
400
  ((b = t.tableLayout) == null ? void 0 : b.columnsResizable) && c.getCanResize() && /* @__PURE__ */ o(A, { header: i })
411
401
  ] }, u);
412
402
  }) }, s)) })
@@ -4,5 +4,6 @@ export interface NavItemProps extends React.ButtonHTMLAttributes<HTMLButtonEleme
4
4
  leftIcon?: React.ReactNode;
5
5
  rightIcon?: React.ReactNode;
6
6
  label?: string;
7
+ asTag?: React.ElementType;
7
8
  }
8
9
  export declare const NavItem: React.ForwardRefExoticComponent<NavItemProps & React.RefAttributes<HTMLButtonElement>>;
@@ -1,32 +1,32 @@
1
- import { jsxs as m, jsx as e } from "react/jsx-runtime";
2
- import u from "react";
1
+ import { jsxs as u, jsx as e } from "react/jsx-runtime";
2
+ import p from "react";
3
3
  import { cn as f } from "../../../lib/utils.js";
4
- const p = u.forwardRef(
5
- ({ leftIcon: n, label: o, rightIcon: r, className: t, isActive: a, children: l, ...c }, d) => {
6
- const i = o ?? l, s = "w-3.5 h-3.5 min-w-max";
7
- return /* @__PURE__ */ m(
8
- "button",
4
+ const v = p.forwardRef(
5
+ ({ leftIcon: n, label: t, rightIcon: o, className: i, isActive: a, children: c, asTag: l = "button", ...d }, m) => {
6
+ const r = t ?? c, s = "w-3.5 h-3.5 min-w-max";
7
+ return /* @__PURE__ */ u(
8
+ l,
9
9
  {
10
- ref: d,
10
+ ref: m,
11
11
  className: f(
12
12
  "h-7.5 inline-flex items-center justify-center p-2 gap-1 rounded-lg",
13
13
  "hover:bg-background-inverted-elevated text-inverted-primary",
14
14
  "leading-none-medium-sm",
15
15
  "select-none hover:cursor-pointer disabled:cursor-not-allowed focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-focus-ring-default",
16
16
  a && "bg-background-inverted-elevated",
17
- t
17
+ i
18
18
  ),
19
- ...c,
19
+ ...d,
20
20
  children: [
21
21
  n && /* @__PURE__ */ e("span", { className: s, children: n }),
22
- i && /* @__PURE__ */ e("span", { children: i }),
23
- r && /* @__PURE__ */ e("span", { className: s, children: r })
22
+ r && /* @__PURE__ */ e("span", { children: r }),
23
+ o && /* @__PURE__ */ e("span", { className: s, children: o })
24
24
  ]
25
25
  }
26
26
  );
27
27
  }
28
28
  );
29
- p.displayName = "NavItem";
29
+ v.displayName = "NavItem";
30
30
  export {
31
- p as NavItem
31
+ v as NavItem
32
32
  };