@ztwoint/z-ui 0.1.58 → 0.1.60

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.
Files changed (39) hide show
  1. package/dist/components/assets/icons/drag-handle.d.ts +2 -0
  2. package/dist/components/assets/icons/minus.d.ts +8 -0
  3. package/dist/components/assets/icons/octagon-warning-Copy.js +30 -0
  4. package/dist/components/column-reorder/column-item.d.ts +0 -0
  5. package/dist/components/column-reorder/column-reorder.d.ts +3 -0
  6. package/dist/components/column-reorder/column-reorder.hook.d.ts +4 -0
  7. package/dist/components/column-reorder/column-reorder.type.d.ts +12 -0
  8. package/dist/components/column-reorder/components/column-item/column-item.d.ts +4 -0
  9. package/dist/components/column-reorder/components/column-item/column-item.hook.d.ts +7 -0
  10. package/dist/components/column-reorder/components/column-item/column-item.type.d.ts +18 -0
  11. package/dist/components/column-reorder/components/column-item/column-item.util.d.ts +10 -0
  12. package/dist/components/column-reorder/components/column-item/index.d.ts +3 -0
  13. package/dist/components/column-reorder/components/index.d.ts +1 -0
  14. package/dist/components/column-reorder/index.d.ts +2 -0
  15. package/dist/components/table/components/cell/link-cell.d.ts +1 -0
  16. package/dist/components/table/components/cell/link-cell.js +5 -4
  17. package/dist/components/table-card/table-card.js +72 -61
  18. package/dist/components/table-card/table-card.type.d.ts +1 -0
  19. package/dist/css/styles/tailwind.css +1 -1
  20. package/dist/routes/column-reorder.d.ts +3 -0
  21. package/dist/routes/index.d.ts +1 -0
  22. package/dist/types/components/assets/icons/drag-handle.d.ts +2 -0
  23. package/dist/types/components/assets/icons/minus.d.ts +8 -0
  24. package/dist/types/components/column-reorder/column-item.d.ts +0 -0
  25. package/dist/types/components/column-reorder/column-reorder.d.ts +3 -0
  26. package/dist/types/components/column-reorder/column-reorder.hook.d.ts +4 -0
  27. package/dist/types/components/column-reorder/column-reorder.type.d.ts +12 -0
  28. package/dist/types/components/column-reorder/components/column-item/column-item.d.ts +4 -0
  29. package/dist/types/components/column-reorder/components/column-item/column-item.hook.d.ts +7 -0
  30. package/dist/types/components/column-reorder/components/column-item/column-item.type.d.ts +18 -0
  31. package/dist/types/components/column-reorder/components/column-item/column-item.util.d.ts +10 -0
  32. package/dist/types/components/column-reorder/components/column-item/index.d.ts +3 -0
  33. package/dist/types/components/column-reorder/components/index.d.ts +1 -0
  34. package/dist/types/components/column-reorder/index.d.ts +2 -0
  35. package/dist/types/components/table/components/cell/link-cell.d.ts +1 -0
  36. package/dist/types/components/table-card/table-card.type.d.ts +1 -0
  37. package/dist/types/routes/column-reorder.d.ts +3 -0
  38. package/dist/types/routes/index.d.ts +1 -0
  39. package/package.json +5 -1
@@ -0,0 +1,2 @@
1
+ declare const DragHandleIcon: () => import("react/jsx-runtime").JSX.Element;
2
+ export default DragHandleIcon;
@@ -0,0 +1,8 @@
1
+ import { SVGProps } from 'react';
2
+ type IconProps = SVGProps<SVGSVGElement> & {
3
+ secondaryfill?: string;
4
+ strokewidth?: number;
5
+ title?: string;
6
+ };
7
+ export declare function Minus({ title, ...props }: IconProps): import("react/jsx-runtime").JSX.Element;
8
+ export default Minus;
@@ -0,0 +1,30 @@
1
+ import { jsx as r } from "react/jsx-runtime";
2
+ function m({
3
+ fill: t = "currentColor",
4
+ strokewidth: o = 1,
5
+ width: e = "1em",
6
+ height: n = "1em",
7
+ ...h
8
+ }) {
9
+ return /* @__PURE__ */ r(
10
+ "svg",
11
+ {
12
+ height: n,
13
+ width: e,
14
+ ...h,
15
+ viewBox: "0 0 14 14",
16
+ xmlns: "http://www.w3.org/2000/svg",
17
+ children: /* @__PURE__ */ r("g", { fill: t, children: /* @__PURE__ */ r(
18
+ "path",
19
+ {
20
+ d: "M9.6 0.58h-5.28l-3.74 3.74v5.28l3.74 3.74h5.28l3.74-3.74v-5.28l-3.74-3.74z m-3.22 2.9h1.16v4.64h-1.16v-4.64z m0.58 6.96c-0.4 0-0.72-0.33-0.72-0.73s0.33-0.72 0.72-0.72 0.72 0.33 0.72 0.72-0.33 0.72-0.72 0.73z",
21
+ fill: t,
22
+ strokeWidth: o
23
+ }
24
+ ) })
25
+ }
26
+ );
27
+ }
28
+ export {
29
+ m as default
30
+ };
@@ -0,0 +1,3 @@
1
+ import { FC } from 'react';
2
+ import { ColumnReOrderProps } from './column-reorder.type';
3
+ export declare const ColumnReOrder: FC<ColumnReOrderProps>;
@@ -0,0 +1,4 @@
1
+ import { ColumnReOrderProps, ColumnType } from './column-reorder.type';
2
+ export declare const useColumnReorder: ({ columns, onReorder }: ColumnReOrderProps) => {
3
+ internalColumns: ColumnType[];
4
+ };
@@ -0,0 +1,12 @@
1
+ import { default as React } from 'react';
2
+ export type ColumnType = {
3
+ id: string;
4
+ label: [string, string];
5
+ icon: React.ReactNode;
6
+ };
7
+ export interface ColumnReOrderProps {
8
+ columns: ColumnType[];
9
+ onReorder?: (reorderedColumns: ColumnType[]) => void;
10
+ onRemove?: (columnId: string) => void;
11
+ className?: string;
12
+ }
@@ -0,0 +1,4 @@
1
+ import { default as React } from 'react';
2
+ import { ColumnItemProps } from './column-item.type';
3
+ export declare const ColumnItem: React.FC<ColumnItemProps>;
4
+ export default ColumnItem;
@@ -0,0 +1,7 @@
1
+ import { ColumnType } from '../../column-reorder.type';
2
+ import { ColumnItemState } from './column-item.type';
3
+ export declare const idle: ColumnItemState;
4
+ export declare const useColumnItemDragAndDrop: (column: ColumnType, index: number) => {
5
+ ref: import('react').RefObject<HTMLDivElement | null>;
6
+ state: ColumnItemState;
7
+ };
@@ -0,0 +1,18 @@
1
+ import { Edge } from '@atlaskit/pragmatic-drag-and-drop-hitbox/closest-edge';
2
+ import { ColumnType } from '../../column-reorder.type';
3
+ export type ColumnItemState = {
4
+ type: 'idle';
5
+ } | {
6
+ type: 'preview';
7
+ container: HTMLElement;
8
+ } | {
9
+ type: 'is-dragging';
10
+ } | {
11
+ type: 'is-dragging-over';
12
+ closestEdge: Edge | null;
13
+ };
14
+ export interface ColumnItemProps {
15
+ column: ColumnType;
16
+ index: number;
17
+ onRemove?: (columnId: string) => void;
18
+ }
@@ -0,0 +1,10 @@
1
+ import { ColumnType } from '../../column-reorder.type';
2
+ export declare const getColumnData: (column: ColumnType, index: number) => {
3
+ columnId: string;
4
+ index: number;
5
+ };
6
+ export declare const isColumnData: (data: Record<string | symbol, unknown>) => boolean;
7
+ export declare const parseColumnLabel: (column: ColumnType) => {
8
+ groupLabel: string;
9
+ fieldLabel: string;
10
+ };
@@ -0,0 +1,3 @@
1
+ export { default as ColumnItem } from './column-item';
2
+ export type { ColumnItemProps, ColumnItemState } from './column-item.type';
3
+ export { isColumnData } from './column-item.util';
@@ -0,0 +1 @@
1
+ export * from './column-item';
@@ -0,0 +1,2 @@
1
+ export * from './column-reorder';
2
+ export * from './column-reorder.type';
@@ -6,5 +6,6 @@ export interface LinkCellProps {
6
6
  rightIcon?: React.ReactNode;
7
7
  leftIcon?: React.ReactNode;
8
8
  className?: string;
9
+ LinkComponent?: React.ElementType;
9
10
  }
10
11
  export declare const LinkCell: React.FC<LinkCellProps>;
@@ -1,17 +1,18 @@
1
1
  import { jsxs as s, jsx as a } from "react/jsx-runtime";
2
2
  import "react";
3
3
  import { cn as e } from "../../../../lib/utils.js";
4
- const p = ({
4
+ const x = ({
5
5
  value: i,
6
6
  href: m,
7
7
  target: t = "_self",
8
8
  leftIcon: n,
9
9
  rightIcon: r,
10
- className: o
10
+ className: o,
11
+ LinkComponent: c = "a"
11
12
  }) => {
12
13
  const l = "min-h-max min-w-max";
13
14
  return /* @__PURE__ */ s(
14
- "a",
15
+ c,
15
16
  {
16
17
  href: m,
17
18
  target: t,
@@ -31,5 +32,5 @@ const p = ({
31
32
  );
32
33
  };
33
34
  export {
34
- p as LinkCell
35
+ x as LinkCell
35
36
  };
@@ -1,7 +1,7 @@
1
- import { jsx as o, jsxs as c } from "react/jsx-runtime";
1
+ import { jsx as e, jsxs as a } from "react/jsx-runtime";
2
2
  import { Table as t } from "../table/table-provider.js";
3
3
  import "react";
4
- import { cn as n } from "../../lib/utils.js";
4
+ import { cn as i } from "../../lib/utils.js";
5
5
  /* empty css */
6
6
  import "../alert/alert.const.js";
7
7
  import "../button/button.js";
@@ -30,51 +30,62 @@ import "../stepper/stepper.js";
30
30
  import "../stepper-item/stepper-item.js";
31
31
  import "@radix-ui/react-tabs";
32
32
  import "../tooltip/tooltip.js";
33
+ import f from "../assets/icons/octagon-warning-Copy.js";
33
34
  import "../badge/badge.js";
34
35
  import "../avatar/avatar.js";
35
36
  import "../text-preset/text-preset.js";
36
37
  import "../table/table.context.js";
37
- const Pt = ({
38
- dataSource: v,
39
- schema: u,
38
+ const Pe = ({
39
+ dataSource: w,
40
+ schema: P,
40
41
  loading: H,
41
- emptyMessage: w,
42
+ emptyMessage: k,
42
43
  className: T,
43
44
  rounded: d = !0,
44
- bordered: h = !0,
45
- showHeader: C = !0,
45
+ bordered: n = !0,
46
+ showHeader: g = !0,
46
47
  headerClassName: _,
47
48
  search: m,
48
- filter: e,
49
- headerLeftContent: P,
50
- headerActions: i,
51
- body: r = {
49
+ filter: r,
50
+ headerLeftContent: h,
51
+ headerActions: u,
52
+ body: l = {
52
53
  cell: { hasBorder: !0 },
53
54
  className: "",
54
55
  stickyHeader: !0
55
56
  },
56
57
  showFooter: p = !0,
57
- footerClassName: k,
58
- pagination: l,
59
- paginationInfo: a,
60
- paginationQuickJumper: s
58
+ footerClassName: j,
59
+ pagination: o,
60
+ paginationInfo: c,
61
+ paginationQuickJumper: s,
62
+ error: x = !1
61
63
  }) => {
62
- var B;
63
- const x = s && s.totalPage && s.totalPage >= 2, F = l && l.totalPage && l.totalPage >= 2 || !!a || x, g = m || e || P || i, R = typeof (e == null ? void 0 : e.showFilterButton) > "u" ? !0 : e == null ? void 0 : e.showFilterButton;
64
- 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: [
65
- C && g && /* @__PURE__ */ c(
64
+ var v;
65
+ if (x)
66
+ return /* @__PURE__ */ e("div", { className: "flex flex-col items-center justify-center h-64 bg-background-error-subtle rounded-lg text-text-warning-secondary", children: /* @__PURE__ */ a("div", { className: "flex gap-2", children: [
67
+ /* @__PURE__ */ e(f, { className: "mt-1.5" }),
68
+ /* @__PURE__ */ a("div", { className: "flex flex-col gap-2", children: [
69
+ /* @__PURE__ */ e("div", { className: "text-text-error-primary text-lg font-medium", children: "Error loading data" }),
70
+ /* @__PURE__ */ e("div", { className: "text-sm", children: "Please try again later" }),
71
+ typeof x == "string" && /* @__PURE__ */ e("div", { className: "text-text-warning-secondary text-sm", children: x })
72
+ ] })
73
+ ] }) });
74
+ const C = s && s.totalPage && s.totalPage >= 2, N = o && o.totalPage && o.totalPage >= 2 || !!c || C, F = m || r || h || u, R = typeof (r == null ? void 0 : r.showFilterButton) > "u" ? !0 : r == null ? void 0 : r.showFilterButton;
75
+ return /* @__PURE__ */ e("div", { className: i("flex flex-col overflow-hidden", T), children: /* @__PURE__ */ a(t, { dataSource: w, schema: P, loading: H, emptyMessage: k, children: [
76
+ g && F && /* @__PURE__ */ a(
66
77
  t.Header,
67
78
  {
68
- className: n(
79
+ className: i(
69
80
  "flex-shrink-0",
70
- h && "border-stroke-solid-medium border-1 border-b-0",
81
+ n && "border-stroke-solid-medium border-1 border-b-0",
71
82
  d && "rounded-t-xl",
72
83
  _
73
84
  ),
74
85
  children: [
75
- /* @__PURE__ */ c(t.HeaderContent, { children: [
76
- P && P,
77
- m && /* @__PURE__ */ o(
86
+ /* @__PURE__ */ a(t.HeaderContent, { children: [
87
+ h && h,
88
+ m && /* @__PURE__ */ e(
78
89
  t.Search,
79
90
  {
80
91
  search: {
@@ -86,64 +97,64 @@ const Pt = ({
86
97
  className: m.className
87
98
  }
88
99
  ),
89
- e && /* @__PURE__ */ c(
100
+ r && /* @__PURE__ */ a(
90
101
  t.Filter,
91
102
  {
92
- schema: u,
103
+ schema: P,
93
104
  filter: {
94
- value: e.value || [],
95
- onChange: e.onChange || (() => {
105
+ value: r.value || [],
106
+ onChange: r.onChange || (() => {
96
107
  })
97
108
  },
98
109
  children: [
99
- R && /* @__PURE__ */ o(t.Filter.FilterButton, {}),
100
- (B = e == null ? void 0 : e.quickFilters) == null ? void 0 : B.map((N) => /* @__PURE__ */ o(t.Filter.FilterColumnButton, { filterName: N }, N))
110
+ R && /* @__PURE__ */ e(t.Filter.FilterButton, {}),
111
+ (v = r == null ? void 0 : r.quickFilters) == null ? void 0 : v.map((B) => /* @__PURE__ */ e(t.Filter.FilterColumnButton, { filterName: B }, B))
101
112
  ]
102
113
  }
103
114
  )
104
115
  ] }),
105
- i && /* @__PURE__ */ o(t.HeaderContent, { children: i })
116
+ u && /* @__PURE__ */ e(t.HeaderContent, { children: u })
106
117
  ]
107
118
  }
108
119
  ),
109
- /* @__PURE__ */ o(
120
+ /* @__PURE__ */ e(
110
121
  t.Body,
111
122
  {
112
- cell: r == null ? void 0 : r.cell,
113
- sort: r == null ? void 0 : r.sort,
114
- className: n(
123
+ cell: l == null ? void 0 : l.cell,
124
+ sort: l == null ? void 0 : l.sort,
125
+ className: i(
115
126
  "flex-1 min-h-0",
116
- h && "border-stroke-solid-light border-1",
117
- d && !(C && g) && "rounded-t-xl",
118
- d && !(p && F) && "rounded-b-xl",
119
- h && "[&_td:first-child]:border-l-0 [&_td:last-child]:border-r-0",
120
- h && "[&_th:first-child]:border-l-0 [&_th:last-child]:border-r-0",
121
- r == null ? void 0 : r.className
127
+ n && "border-stroke-solid-light border-1",
128
+ d && !(g && F) && "rounded-t-xl",
129
+ d && !(p && N) && "rounded-b-xl",
130
+ n && "[&_td:first-child]:border-l-0 [&_td:last-child]:border-r-0",
131
+ n && "[&_th:first-child]:border-l-0 [&_th:last-child]:border-r-0",
132
+ l == null ? void 0 : l.className
122
133
  ),
123
- stickyHeader: r == null ? void 0 : r.stickyHeader
134
+ stickyHeader: l == null ? void 0 : l.stickyHeader
124
135
  }
125
136
  ),
126
- p && F && /* @__PURE__ */ c(
137
+ p && N && /* @__PURE__ */ a(
127
138
  t.Footer,
128
139
  {
129
- className: n(
140
+ className: i(
130
141
  "flex-shrink-0 border-stroke-solid-light border-t-[0.5px] mt-[-2px]",
131
- h && "border",
142
+ n && "border",
132
143
  d && "rounded-b-xl",
133
- k
144
+ j
134
145
  ),
135
146
  children: [
136
- a ? /* @__PURE__ */ o(t.FooterContent, { children: /* @__PURE__ */ o(
147
+ c ? /* @__PURE__ */ e(t.FooterContent, { children: /* @__PURE__ */ e(
137
148
  t.PaginationInfo,
138
149
  {
139
- showTotal: a.showTotal,
140
- totalItems: a.totalItems,
141
- currentPage: a.currentPage,
142
- itemsPerPage: a.itemsPerPage
150
+ showTotal: c.showTotal,
151
+ totalItems: c.totalItems,
152
+ currentPage: c.currentPage,
153
+ itemsPerPage: c.itemsPerPage
143
154
  }
144
- ) }) : s || l ? /* @__PURE__ */ o(t.FooterContent, { children: null }) : null,
145
- (s || l) && /* @__PURE__ */ c(t.FooterContent, { children: [
146
- x && /* @__PURE__ */ o(
155
+ ) }) : s || o ? /* @__PURE__ */ e(t.FooterContent, { children: null }) : null,
156
+ (s || o) && /* @__PURE__ */ a(t.FooterContent, { children: [
157
+ C && /* @__PURE__ */ e(
147
158
  t.PaginationQuickJumper,
148
159
  {
149
160
  currentPage: s.currentPage,
@@ -153,14 +164,14 @@ const Pt = ({
153
164
  disabled: s.disabled
154
165
  }
155
166
  ),
156
- l && /* @__PURE__ */ o(
167
+ o && /* @__PURE__ */ e(
157
168
  t.Pagination,
158
169
  {
159
- currentPage: l.currentPage,
160
- totalPage: l.totalPage,
161
- onChange: l.onChange || (() => {
170
+ currentPage: o.currentPage,
171
+ totalPage: o.totalPage,
172
+ onChange: o.onChange || (() => {
162
173
  }),
163
- totalItems: l.totalItems
174
+ totalItems: o.totalItems
164
175
  }
165
176
  )
166
177
  ] })
@@ -170,5 +181,5 @@ const Pt = ({
170
181
  ] }) });
171
182
  };
172
183
  export {
173
- Pt as default
184
+ Pe as default
174
185
  };
@@ -31,4 +31,5 @@ export interface TableCardProps {
31
31
  paginationQuickJumper?: PaginationQuickJumperProps;
32
32
  loading?: boolean;
33
33
  emptyMessage?: string;
34
+ error?: boolean | string;
34
35
  }