@ztwoint/z-ui 0.1.51 → 0.1.53

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.
@@ -32,7 +32,8 @@ import { Avatar as p } from "../../../avatar/avatar.js";
32
32
  import "../../table.context.js";
33
33
  import "../../../tooltip/tooltip.js";
34
34
  import "../../../badge/badge.js";
35
- const V = ({
35
+ import "../../../text-preset/text-preset.js";
36
+ const W = ({
36
37
  avatar: m,
37
38
  value: a,
38
39
  rightIcon: e,
@@ -70,5 +71,5 @@ const V = ({
70
71
  }
71
72
  );
72
73
  export {
73
- V as AvatarCell
74
+ W as AvatarCell
74
75
  };
@@ -9,7 +9,7 @@ const A = ({
9
9
  sort: a,
10
10
  cell: s,
11
11
  stickyHeader: l = !1
12
- }) => /* @__PURE__ */ r("thead", { className: i(t.header, l && "sticky top-0 z-1"), children: /* @__PURE__ */ r("tr", { children: o.map((e) => {
12
+ }) => /* @__PURE__ */ r("thead", { className: i(t.header, l && "sticky top-0"), children: /* @__PURE__ */ r("tr", { children: o.map((e) => {
13
13
  const d = p(e.key, a), c = C(e.key, a);
14
14
  return /* @__PURE__ */ r(
15
15
  "th",
@@ -1,5 +1,5 @@
1
- import { jsx as e } from "react/jsx-runtime";
2
- import * as p from "react";
1
+ import { jsx as p } from "react/jsx-runtime";
2
+ import * as e from "react";
3
3
  import { TableContext as a } from "./table.context.js";
4
4
  import { TableBody as n } from "./table.js";
5
5
  import { TableFilter as f } from "./components/table-filter/table-filter-provider.js";
@@ -38,6 +38,7 @@ import "@radix-ui/react-tabs";
38
38
  import "../tooltip/tooltip.js";
39
39
  import "../badge/badge.js";
40
40
  import "../avatar/avatar.js";
41
+ import "../text-preset/text-preset.js";
41
42
  import { TableHeaderWrapper as c } from "./components/table-header-wrapper.js";
42
43
  import { TableHeaderContent as d } from "./components/table-header-content.js";
43
44
  import { TableFooter as u } from "./components/table-footer.js";
@@ -50,13 +51,13 @@ const t = ({
50
51
  filterComponents: x,
51
52
  ...r
52
53
  }) => {
53
- const m = p.useMemo(
54
+ const m = e.useMemo(
54
55
  () => ({
55
56
  ...r
56
57
  }),
57
58
  [r]
58
59
  );
59
- return /* @__PURE__ */ e(a.Provider, { value: m, children: i });
60
+ return /* @__PURE__ */ p(a.Provider, { value: m, children: i });
60
61
  }, P = t, o = P;
61
62
  o.Body = n;
62
63
  o.Filter = f;
@@ -1,46 +1,51 @@
1
- import { jsx as e, jsxs as h } from "react/jsx-runtime";
2
- import * as T from "react";
3
- import { DEFAULT_EMPTY_MESSAGE as g, TABLE_CSS_CLASSES as m } from "./table.const.js";
4
- import { TableHeader as E } from "./components/table-header/table-header.js";
5
- import { TableRow as y } from "./components/table-row.js";
6
- import { TableEmptyState as x } from "./components/table-empty-state.js";
7
- import { TableLoadingState as B } from "./components/table-loading-state.js";
8
- import { TableContext as C } from "./table.context.js";
9
- import { cn as s } from "../../lib/utils.js";
10
- const R = ({ cell: o = { hasBorder: !0 }, sort: n, className: f, stickyHeader: d = !1, ...i }) => {
11
- const c = T.useContext(C), {
1
+ import { jsxs as l, jsx as e } from "react/jsx-runtime";
2
+ import * as y from "react";
3
+ import { DEFAULT_EMPTY_MESSAGE as S, TABLE_CSS_CLASSES as n } from "./table.const.js";
4
+ import { TableHeader as g } from "./components/table-header/table-header.js";
5
+ import { TableRow as T } from "./components/table-row.js";
6
+ import { TableEmptyState as w } from "./components/table-empty-state.js";
7
+ import { TableContext as E } from "./table.context.js";
8
+ import { cn as m } from "../../lib/utils.js";
9
+ const j = ({ cell: a = { hasBorder: !0 }, sort: d, className: i, stickyHeader: c = !1, ...f }) => {
10
+ const p = y.useContext(E), {
12
11
  dataSource: t = [],
13
- schema: r = [],
14
- loading: a = !1,
15
- emptyMessage: p = g,
16
- customCells: u
17
- } = c || i, S = () => a ? /* @__PURE__ */ e(B, { colSpan: r.length }) : !t || t.length === 0 ? /* @__PURE__ */ e(x, { colSpan: r.length, message: p }) : /* @__PURE__ */ e("tbody", { children: t.map((b, l) => /* @__PURE__ */ e(
18
- y,
12
+ schema: o = [],
13
+ loading: r = !1,
14
+ emptyMessage: u = S,
15
+ customCells: h
16
+ } = p || f, b = () => !t || t.length === 0 && !r ? /* @__PURE__ */ e(w, { colSpan: o.length, message: u }) : /* @__PURE__ */ e("tbody", { children: t.map((x, s) => /* @__PURE__ */ e(
17
+ T,
19
18
  {
20
- record: b,
21
- index: l,
22
- schema: r,
23
- customCells: u,
24
- cell: o
19
+ record: x,
20
+ index: s,
21
+ schema: o,
22
+ customCells: h,
23
+ cell: a
25
24
  },
26
- l
25
+ s
27
26
  )) });
28
- return /* @__PURE__ */ e(
27
+ return /* @__PURE__ */ l(
29
28
  "div",
30
29
  {
31
- className: s(
32
- "overflow-y-auto",
33
- m.bordered[o.hasBorder && !a && t.length > 0 ? "true" : "false"],
34
- f
30
+ className: m(
31
+ r ? "overflow-y-hidden" : "overflow-y-auto",
32
+ n.bordered[a.hasBorder && !r && t.length > 0 ? "true" : "false"],
33
+ i
35
34
  ),
36
- children: /* @__PURE__ */ h("table", { className: s(m.table, "w-full"), children: [
37
- /* @__PURE__ */ e(E, { schema: r, sort: n, cell: o, stickyHeader: d }),
38
- S()
39
- ] })
35
+ children: [
36
+ /* @__PURE__ */ l("table", { className: m(n.table, "w-full"), children: [
37
+ b(),
38
+ /* @__PURE__ */ e(g, { schema: o, sort: d, cell: a, stickyHeader: c })
39
+ ] }),
40
+ r && /* @__PURE__ */ e("div", { className: "sticky top-0 inset-0 w-full h-full bg-white/80 flex items-center justify-center", children: /* @__PURE__ */ l("div", { className: "flex flex-col items-center gap-3", children: [
41
+ /* @__PURE__ */ e("div", { className: "animate-spin rounded-full h-8 w-8 border-b-2 border-text-brand-secondary" }),
42
+ /* @__PURE__ */ e("p", { className: "text-text-neutral-primary font-medium", children: "Loading..." })
43
+ ] }) })
44
+ ]
40
45
  }
41
46
  );
42
47
  };
43
48
  export {
44
- R as TableBody,
45
- R as default
49
+ j as TableBody,
50
+ j as default
46
51
  };
@@ -31,10 +31,11 @@ import "@radix-ui/react-tabs";
31
31
  import "../tooltip/tooltip.js";
32
32
  import "../badge/badge.js";
33
33
  import "../avatar/avatar.js";
34
+ import "../text-preset/text-preset.js";
34
35
  import "../table/table.context.js";
35
- const dt = ({
36
+ const nt = ({
36
37
  dataSource: v,
37
- schema: i,
38
+ schema: u,
38
39
  loading: H,
39
40
  emptyMessage: w,
40
41
  className: T,
@@ -45,7 +46,7 @@ const dt = ({
45
46
  search: m,
46
47
  filter: e,
47
48
  headerLeftContent: P,
48
- headerActions: u,
49
+ headerActions: i,
49
50
  body: r = {
50
51
  cell: { hasBorder: !0 },
51
52
  className: "",
@@ -58,8 +59,8 @@ const dt = ({
58
59
  paginationQuickJumper: s
59
60
  }) => {
60
61
  var B;
61
- const F = s && s.totalPage && s.totalPage >= 2, p = l && l.totalPage && l.totalPage >= 2 || !!a || F, g = m || e || P || u, R = typeof (e == null ? void 0 : e.showFilterButton) > "u" ? !0 : e == null ? void 0 : e.showFilterButton;
62
- return /* @__PURE__ */ o("div", { className: n("flex flex-col overflow-hidden", T), children: /* @__PURE__ */ c(t, { dataSource: v, schema: i, loading: H, emptyMessage: w, children: [
62
+ const p = s && s.totalPage && s.totalPage >= 2, F = l && l.totalPage && l.totalPage >= 2 || !!a || p, g = m || e || P || i, R = typeof (e == null ? void 0 : e.showFilterButton) > "u" ? !0 : e == null ? void 0 : e.showFilterButton;
63
+ return /* @__PURE__ */ o("div", { className: n("flex flex-col overflow-hidden", T), children: /* @__PURE__ */ c(t, { dataSource: v, schema: u, loading: H, emptyMessage: w, children: [
63
64
  C && g && /* @__PURE__ */ c(
64
65
  t.Header,
65
66
  {
@@ -87,7 +88,7 @@ const dt = ({
87
88
  e && /* @__PURE__ */ c(
88
89
  t.Filter,
89
90
  {
90
- schema: i,
91
+ schema: u,
91
92
  filter: {
92
93
  value: e.value || [],
93
94
  onChange: e.onChange || (() => {
@@ -100,7 +101,7 @@ const dt = ({
100
101
  }
101
102
  )
102
103
  ] }),
103
- u && /* @__PURE__ */ o(t.HeaderContent, { children: u })
104
+ i && /* @__PURE__ */ o(t.HeaderContent, { children: i })
104
105
  ]
105
106
  }
106
107
  ),
@@ -113,7 +114,7 @@ const dt = ({
113
114
  "flex-1 min-h-0",
114
115
  h && "border-stroke-solid-light border-1",
115
116
  d && !(C && g) && "rounded-t-xl",
116
- d && !(x && p) && "rounded-b-xl",
117
+ d && !(x && F) && "rounded-b-xl",
117
118
  h && "[&_td:first-child]:border-l-0 [&_td:last-child]:border-r-0",
118
119
  h && "[&_th:first-child]:border-l-0 [&_th:last-child]:border-r-0",
119
120
  r == null ? void 0 : r.className
@@ -121,7 +122,7 @@ const dt = ({
121
122
  stickyHeader: r == null ? void 0 : r.stickyHeader
122
123
  }
123
124
  ),
124
- x && p && /* @__PURE__ */ c(
125
+ x && F && /* @__PURE__ */ c(
125
126
  t.Footer,
126
127
  {
127
128
  className: n(
@@ -141,7 +142,7 @@ const dt = ({
141
142
  }
142
143
  ) }) : s || l ? /* @__PURE__ */ o(t.FooterContent, { children: null }) : null,
143
144
  (s || l) && /* @__PURE__ */ c(t.FooterContent, { children: [
144
- F && /* @__PURE__ */ o(
145
+ p && /* @__PURE__ */ o(
145
146
  t.PaginationQuickJumper,
146
147
  {
147
148
  currentPage: s.currentPage,
@@ -168,5 +169,5 @@ const dt = ({
168
169
  ] }) });
169
170
  };
170
171
  export {
171
- dt as default
172
+ nt as default
172
173
  };
@@ -0,0 +1,13 @@
1
+ import { VariantProps } from 'class-variance-authority';
2
+ declare const textPresetVariants: (props?: ({
3
+ type?: "L" | "C" | "R" | null | undefined;
4
+ multiline?: boolean | null | undefined;
5
+ } & import('class-variance-authority/dist/types').ClassProp) | undefined) => string;
6
+ export interface Z2TextPresetProps extends VariantProps<typeof textPresetVariants> {
7
+ primaryFirst?: boolean;
8
+ primaryText: string;
9
+ supportText?: string;
10
+ className?: string;
11
+ }
12
+ export default function Z2TextPreset({ type, multiline, primaryFirst, primaryText, supportText, className, }: Z2TextPresetProps): import("react/jsx-runtime").JSX.Element;
13
+ export {};
@@ -0,0 +1,21 @@
1
+ import "react/jsx-runtime";
2
+ import { cva as t } from "class-variance-authority";
3
+ import "clsx";
4
+ import "tailwind-merge";
5
+ t("flex flex-col", {
6
+ variants: {
7
+ type: {
8
+ L: "text-left",
9
+ C: "text-center",
10
+ R: "text-right"
11
+ },
12
+ multiline: {
13
+ true: "gap-3",
14
+ false: "gap-2.5 *:data-[slot=support-text]:truncate"
15
+ }
16
+ },
17
+ defaultVariants: {
18
+ type: "L",
19
+ multiline: !1
20
+ }
21
+ });
@@ -1,44 +1,44 @@
1
1
  :root {
2
- --alert-surface-neutral: var(--color-neutral-50);
3
- --alert-surface-accent: var(--color-blue-50);
4
- --alert-surface-success: var(--color-green-50);
5
- --alert-surface-warning: var(--color-amber-50);
6
- --alert-surface-danger: var(--color-red-50);
2
+ --alert-surface-neutral: var(--color-neutral-50);
3
+ --alert-surface-accent: var(--color-blue-50);
4
+ --alert-surface-success: var(--color-green-50);
5
+ --alert-surface-warning: var(--color-amber-50);
6
+ --alert-surface-danger: var(--color-red-50);
7
7
 
8
- --alert-stroke-neutral: var(--color-neutral-100);
9
- --alert-stroke-accent: var(--color-blue-100);
10
- --alert-stroke-success: var(--color-green-100);
11
- --alert-stroke-warning: var(--color-amber-100);
12
- --alert-stroke-danger: var(--color-red-100);
8
+ --alert-stroke-neutral: var(--color-neutral-100);
9
+ --alert-stroke-accent: var(--color-blue-100);
10
+ --alert-stroke-success: var(--color-green-100);
11
+ --alert-stroke-warning: var(--color-amber-100);
12
+ --alert-stroke-danger: var(--color-red-100);
13
13
  }
14
14
 
15
15
  .dark {
16
- --alert-surface-neutral: var(--color-neutral-50);
17
- --alert-surface-accent: var(--color-blue-50);
18
- --alert-surface-success: var(--color-green-50);
19
- --alert-surface-warning: var(--color-amber-50);
20
- --alert-surface-danger: var(--color-red-50);
16
+ --alert-surface-neutral: var(--color-neutral-50);
17
+ --alert-surface-accent: var(--color-blue-50);
18
+ --alert-surface-success: var(--color-green-50);
19
+ --alert-surface-warning: var(--color-amber-50);
20
+ --alert-surface-danger: var(--color-red-50);
21
21
 
22
- --alert-stroke-neutral: var(--color-neutral-100);
23
- --alert-stroke-accent: var(--color-blue-100);
24
- --alert-stroke-success: var(--color-green-100);
25
- --alert-stroke-warning: var(--color-amber-100);
26
- --alert-stroke-danger: var(--color-red-100);
22
+ --alert-stroke-neutral: var(--color-neutral-100);
23
+ --alert-stroke-accent: var(--color-blue-100);
24
+ --alert-stroke-success: var(--color-green-100);
25
+ --alert-stroke-warning: var(--color-amber-100);
26
+ --alert-stroke-danger: var(--color-red-100);
27
27
  }
28
28
 
29
29
  /* Tailwind v4 Theme Integration */
30
30
  @theme inline {
31
- /* Alert - Surface */
32
- --color-alert-surface-neutral: var(--alert-surface-neutral);
33
- --color-alert-surface-accent: var(--alert-surface-accent);
34
- --color-alert-surface-success: var(--alert-surface-success);
35
- --color-alert-surface-warning: var(--alert-surface-warning);
36
- --color-alert-surface-danger: var(--alert-surface-danger);
31
+ /* Alert - Surface */
32
+ --color-alert-surface-neutral: var(--alert-surface-neutral);
33
+ --color-alert-surface-accent: var(--alert-surface-accent);
34
+ --color-alert-surface-success: var(--alert-surface-success);
35
+ --color-alert-surface-warning: var(--alert-surface-warning);
36
+ --color-alert-surface-danger: var(--alert-surface-danger);
37
37
 
38
- /* Alert - Stroke */
39
- --color-alert-stroke-neutral: var(--alert-stroke-neutral);
40
- --color-alert-stroke-accent: var(--alert-stroke-accent);
41
- --color-alert-stroke-success: var(--alert-stroke-success);
42
- --color-alert-stroke-warning: var(--alert-stroke-warning);
43
- --color-alert-stroke-danger: var(--alert-stroke-danger);
44
- }
38
+ /* Alert - Stroke */
39
+ --color-alert-stroke-neutral: var(--alert-stroke-neutral);
40
+ --color-alert-stroke-accent: var(--alert-stroke-accent);
41
+ --color-alert-stroke-success: var(--alert-stroke-success);
42
+ --color-alert-stroke-warning: var(--alert-stroke-warning);
43
+ --color-alert-stroke-danger: var(--alert-stroke-danger);
44
+ }
@@ -27,7 +27,7 @@
27
27
  --background-neutral-hover: var(--neutral-50);
28
28
  --background-neutral-focused: var(--neutral-25);
29
29
 
30
- --background-inverted-elevated: #1414141A;
30
+ --background-inverted-elevated: #1414141a;
31
31
 
32
32
  /* Overlay - Dark Mode */
33
33
  --overlay-default: var(--neutral-50);