@ztwoint/z-ui 0.1.125 → 0.1.126

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,18 +1,18 @@
1
1
  import { jsx as t, jsxs as l, Fragment as f } from "react/jsx-runtime";
2
- import { useZ2Table as z } from "./z2-table-context.js";
2
+ import { useZ2Table as k } from "./z2-table-context.js";
3
3
  import { Z2Skeleton as N } from "../skeleton/skeleton.js";
4
4
  import { Button as s } from "../button/button.js";
5
5
  import "react";
6
- import { cn as I } from "../../lib/utils.js";
7
- import { Z2Select as L, Z2SelectTrigger as y, Z2SelectValue as T, Z2SelectContent as Z, Z2SelectItem as G } from "../select/z2-select.js";
6
+ import { cn as z } from "../../lib/utils.js";
7
+ import { Z2Select as I, Z2SelectTrigger as L, Z2SelectValue as T, Z2SelectContent as Z, Z2SelectItem as G } from "../select/z2-select.js";
8
8
  import $ from "../assets/icons/double-chevron-left.js";
9
9
  import j from "../assets/icons/double-chevron-right.js";
10
10
  import B from "../assets/icons/chevron-left.js";
11
11
  import M from "../assets/icons/chevron-right.js";
12
12
  import { Input as D } from "../input/input.js";
13
13
  function X(P) {
14
- var b;
15
- const { table: a, recordCount: g, isLoading: h } = z(), e = { ...{
14
+ var v;
15
+ const { table: a, recordCount: g, isLoading: h } = k(), e = { ...{
16
16
  showSizeToggle: !1,
17
17
  sizes: [25, 50, 100],
18
18
  sizesLabel: "Show",
@@ -27,7 +27,7 @@ function X(P) {
27
27
  nextPageLabel: "Go to next page",
28
28
  ellipsisText: "...",
29
29
  showGoToPage: !1
30
- }, ...P }, r = " rtl:transform rtl:rotate-180", i = a.getState().pagination.pageIndex, c = a.getState().pagination.pageSize, x = i * c + 1, v = Math.min((i + 1) * c, g), d = a.getPageCount(), w = e != null && e.info ? e.info.replace("{from}", x.toString()).replace("{to}", v.toString()).replace("{count}", g.toString()) : `${x} - ${v} of ${g}`, p = (e == null ? void 0 : e.moreLimit) || 5, m = Math.floor(i / p) * p, u = Math.min(m + p, d), S = () => {
30
+ }, ...P }, r = " rtl:transform rtl:rotate-180", i = a.getState().pagination.pageIndex, c = a.getState().pagination.pageSize, x = i * c + 1, b = Math.min((i + 1) * c, g), p = a.getPageCount(), w = e != null && e.info ? e.info.replace("{from}", x.toString()).replace("{to}", b.toString()).replace("{count}", g.toString()) : `${x} - ${b} of ${g}`, d = (e == null ? void 0 : e.moreLimit) || 5, m = Math.floor(i / d) * d, u = Math.min(m + d, p), S = () => {
31
31
  const o = [];
32
32
  for (let n = m; n < u; n++)
33
33
  o.push(
@@ -36,6 +36,7 @@ function X(P) {
36
36
  {
37
37
  size: "small",
38
38
  variant: "stroke",
39
+ type: "button",
39
40
  disabled: i === n,
40
41
  onClick: () => {
41
42
  i !== n && a.setPageIndex(n);
@@ -51,14 +52,16 @@ function X(P) {
51
52
  {
52
53
  size: "small",
53
54
  variant: "stroke",
55
+ type: "button",
54
56
  onClick: () => a.setPageIndex(m - 1),
55
57
  label: e.ellipsisText
56
58
  }
57
- ) : null, k = () => u < d ? /* @__PURE__ */ t(
59
+ ) : null, y = () => u < p ? /* @__PURE__ */ t(
58
60
  s,
59
61
  {
60
62
  variant: "stroke",
61
63
  size: "small",
64
+ type: "button",
62
65
  onClick: () => a.setPageIndex(u),
63
66
  label: e.ellipsisText
64
67
  }
@@ -67,17 +70,17 @@ function X(P) {
67
70
  "div",
68
71
  {
69
72
  "data-slot": "data-grid-pagination",
70
- className: I(
73
+ className: z(
71
74
  "flex flex-wrap flex-col sm:flex-row justify-between items-center gap-2.5 py-2.5 sm:py-0 grow",
72
75
  e == null ? void 0 : e.className
73
76
  ),
74
77
  children: [
75
- /* @__PURE__ */ t("div", { className: "flex flex-wrap items-center space-x-2.5 pb-2.5 sm:pb-0 order-2 sm:order-1", children: h ? e == null ? void 0 : e.infoSkeleton : /* @__PURE__ */ t(f, { children: /* @__PURE__ */ t("div", { className: "leading-none-medium-sm text-neutral-secondary text-nowrap", children: w }) }) }),
76
- /* @__PURE__ */ t("div", { className: "flex flex-col sm:flex-row justify-center sm:justify-end items-center gap-2.5 pt-2.5 sm:pt-0 order-1 sm:order-2", children: h ? e == null ? void 0 : e.sizesSkeleton : /* @__PURE__ */ l(f, { children: [
78
+ /* @__PURE__ */ t("div", { className: "flex flex-wrap items-center space-x-2.5 order-2 sm:order-1", children: h ? e == null ? void 0 : e.infoSkeleton : /* @__PURE__ */ t(f, { children: /* @__PURE__ */ t("div", { className: "leading-none-medium-sm text-neutral-secondary text-nowrap", children: w }) }) }),
79
+ /* @__PURE__ */ t("div", { className: "flex flex-col sm:flex-row justify-center sm:justify-end items-center gap-2.5 order-1 sm:order-2", children: h ? e == null ? void 0 : e.sizesSkeleton : /* @__PURE__ */ l(f, { children: [
77
80
  e.showSizeToggle && /* @__PURE__ */ l(f, { children: [
78
81
  /* @__PURE__ */ t("div", { className: "leading-none-medium-sm text-neutral-secondary", children: e.rowsPerPageLabel }),
79
82
  /* @__PURE__ */ l(
80
- L,
83
+ I,
81
84
  {
82
85
  value: `${c}`,
83
86
  onValueChange: (o) => {
@@ -85,8 +88,8 @@ function X(P) {
85
88
  a.setPageSize(n);
86
89
  },
87
90
  children: [
88
- /* @__PURE__ */ t(y, { className: "w-fit", size: "sm", children: /* @__PURE__ */ t(T, { placeholder: `${c}` }) }),
89
- /* @__PURE__ */ t(Z, { side: "top", className: "min-w-[50px]", children: (b = e == null ? void 0 : e.sizes) == null ? void 0 : b.map((o) => /* @__PURE__ */ t(G, { value: `${o}`, children: o }, o)) })
91
+ /* @__PURE__ */ t(L, { className: "w-fit", size: "sm", children: /* @__PURE__ */ t(T, { placeholder: `${c}` }) }),
92
+ /* @__PURE__ */ t(Z, { side: "top", className: "min-w-[50px]", children: (v = e == null ? void 0 : e.sizes) == null ? void 0 : v.map((o) => /* @__PURE__ */ t(G, { value: `${o}`, children: o }, o)) })
90
93
  ]
91
94
  }
92
95
  )
@@ -110,12 +113,13 @@ function X(P) {
110
113
  }
111
114
  )
112
115
  ] }),
113
- d > 1 && /* @__PURE__ */ l("div", { className: "flex items-center space-x-1 order-1 sm:order-2", children: [
116
+ p > 1 && /* @__PURE__ */ l("div", { className: "flex items-center space-x-1 order-1 sm:order-2", children: [
114
117
  /* @__PURE__ */ t(
115
118
  s,
116
119
  {
117
120
  size: "small",
118
121
  variant: "stroke",
122
+ type: "button",
119
123
  className: r,
120
124
  onClick: () => a.firstPage(),
121
125
  disabled: !a.getCanPreviousPage(),
@@ -128,6 +132,7 @@ function X(P) {
128
132
  {
129
133
  size: "small",
130
134
  variant: "stroke",
135
+ type: "button",
131
136
  className: r,
132
137
  onClick: () => a.previousPage(),
133
138
  disabled: !a.getCanPreviousPage(),
@@ -137,12 +142,13 @@ function X(P) {
137
142
  ),
138
143
  C(),
139
144
  S(),
140
- k(),
145
+ y(),
141
146
  /* @__PURE__ */ t(
142
147
  s,
143
148
  {
144
149
  size: "small",
145
150
  variant: "stroke",
151
+ type: "button",
146
152
  className: r,
147
153
  onClick: () => a.nextPage(),
148
154
  disabled: !a.getCanNextPage(),
@@ -155,6 +161,7 @@ function X(P) {
155
161
  {
156
162
  size: "small",
157
163
  variant: "stroke",
164
+ type: "button",
158
165
  className: r,
159
166
  onClick: () => a.lastPage(),
160
167
  disabled: !a.getCanNextPage(),