@deepnoid/ui 0.1.28 → 0.1.30

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 (79) hide show
  1. package/.turbo/turbo-build.log +181 -161
  2. package/dist/chunk-6PN3DGOE.mjs +77 -0
  3. package/dist/chunk-CEZQCD6Z.mjs +79 -0
  4. package/dist/{chunk-JV7VLO2L.mjs → chunk-GLMM253Q.mjs} +37 -27
  5. package/dist/{chunk-K7VUN5BS.mjs → chunk-IC25OKBJ.mjs} +1 -1
  6. package/dist/{chunk-NHVIKP4H.mjs → chunk-K7V4VE7R.mjs} +4 -4
  7. package/dist/chunk-MZ76AA76.mjs +1 -0
  8. package/dist/{chunk-4OSN2OE2.mjs → chunk-NFQMXW4Z.mjs} +25 -18
  9. package/dist/chunk-NKH3OF6I.mjs +132 -0
  10. package/dist/chunk-P7YYNA6L.mjs +67 -0
  11. package/dist/{chunk-SO7BGWM7.mjs → chunk-QM4ZSQYX.mjs} +1 -1
  12. package/dist/chunk-RLXOHILK.mjs +1 -0
  13. package/dist/{chunk-BEQ3KZGS.mjs → chunk-VCVQMPC7.mjs} +2 -1
  14. package/dist/components/breadcrumb/breadcrumb.mjs +3 -3
  15. package/dist/components/breadcrumb/index.mjs +3 -3
  16. package/dist/components/button/button.mjs +2 -2
  17. package/dist/components/button/icon-button.mjs +2 -2
  18. package/dist/components/button/index.mjs +3 -3
  19. package/dist/components/dateTimePicker/dateTimePicker.mjs +5 -5
  20. package/dist/components/dateTimePicker/index.mjs +5 -5
  21. package/dist/components/dateTimePicker/timePicker.mjs +2 -2
  22. package/dist/components/fileUpload/fileUpload.d.mts +92 -0
  23. package/dist/components/fileUpload/fileUpload.d.ts +92 -0
  24. package/dist/components/fileUpload/fileUpload.js +5648 -0
  25. package/dist/components/fileUpload/fileUpload.mjs +28 -0
  26. package/dist/components/fileUpload/index.d.mts +5 -0
  27. package/dist/components/fileUpload/index.d.ts +5 -0
  28. package/dist/components/fileUpload/index.js +5647 -0
  29. package/dist/components/fileUpload/index.mjs +25 -0
  30. package/dist/components/input/index.js +2 -1
  31. package/dist/components/input/index.mjs +1 -1
  32. package/dist/components/input/input.js +2 -1
  33. package/dist/components/input/input.mjs +1 -1
  34. package/dist/components/list/index.mjs +3 -3
  35. package/dist/components/modal/index.mjs +4 -4
  36. package/dist/components/modal/modal.mjs +4 -4
  37. package/dist/components/pagination/index.js +2 -1
  38. package/dist/components/pagination/index.mjs +2 -2
  39. package/dist/components/pagination/pagination.js +2 -1
  40. package/dist/components/pagination/pagination.mjs +2 -2
  41. package/dist/components/ripple/index.mjs +3 -3
  42. package/dist/components/skeleton/index.d.mts +2 -0
  43. package/dist/components/skeleton/index.d.ts +2 -0
  44. package/dist/components/skeleton/index.js +141 -0
  45. package/dist/components/skeleton/index.mjs +10 -0
  46. package/dist/components/skeleton/skeleton.d.mts +14 -0
  47. package/dist/components/skeleton/skeleton.d.ts +14 -0
  48. package/dist/components/skeleton/skeleton.js +135 -0
  49. package/dist/components/skeleton/skeleton.mjs +9 -0
  50. package/dist/components/table/index.js +694 -615
  51. package/dist/components/table/index.mjs +9 -7
  52. package/dist/components/table/table-body.d.mts +6 -4
  53. package/dist/components/table/table-body.d.ts +6 -4
  54. package/dist/components/table/table-body.js +115 -64
  55. package/dist/components/table/table-body.mjs +3 -1
  56. package/dist/components/table/table-head.d.mts +3 -1
  57. package/dist/components/table/table-head.d.ts +3 -1
  58. package/dist/components/table/table-head.js +107 -21
  59. package/dist/components/table/table-head.mjs +3 -1
  60. package/dist/components/table/table.d.mts +1 -0
  61. package/dist/components/table/table.d.ts +1 -0
  62. package/dist/components/table/table.js +685 -606
  63. package/dist/components/table/table.mjs +7 -5
  64. package/dist/components/tree/index.js +25 -18
  65. package/dist/components/tree/index.mjs +1 -1
  66. package/dist/components/tree/tree.d.mts +20 -13
  67. package/dist/components/tree/tree.d.ts +20 -13
  68. package/dist/components/tree/tree.js +25 -18
  69. package/dist/components/tree/tree.mjs +1 -1
  70. package/dist/index.d.mts +2 -0
  71. package/dist/index.d.ts +2 -0
  72. package/dist/index.js +607 -401
  73. package/dist/index.mjs +50 -40
  74. package/package.json +1 -1
  75. package/dist/chunk-UNH3BCGN.mjs +0 -47
  76. package/dist/chunk-XRC5OUYQ.mjs +0 -94
  77. package/dist/{chunk-QIEKOGY7.mjs → chunk-7TAGGLNY.mjs} +3 -3
  78. package/dist/{chunk-KYJTZPXY.mjs → chunk-BFOK4HVC.mjs} +3 -3
  79. package/dist/{chunk-JTZUXVOU.mjs → chunk-UB4YBFOT.mjs} +3 -3
@@ -0,0 +1,77 @@
1
+ "use client";
2
+ import {
3
+ clsx
4
+ } from "./chunk-27Y6K5NK.mjs";
5
+
6
+ // src/components/skeleton/skeleton.tsx
7
+ import { tv } from "tailwind-variants";
8
+ import { jsx } from "react/jsx-runtime";
9
+ var Skeleton = ({ color = "primary", className, speed = "normal", rounded = "md" }) => {
10
+ const speedMap = {
11
+ fast: "0.7s",
12
+ normal: "1.2s",
13
+ slow: "2s"
14
+ };
15
+ const slots = skeletonStyle();
16
+ return /* @__PURE__ */ jsx(
17
+ "div",
18
+ {
19
+ className: clsx(slots.base({ color, rounded }), className),
20
+ style: {
21
+ "--shimmer-duration": speedMap[speed]
22
+ },
23
+ children: /* @__PURE__ */ jsx("style", { children: `@keyframes shimmer {
24
+ 100% {
25
+ transform: translateX(100%);
26
+ }
27
+ }
28
+ .skeleton-shimmer::before {
29
+ animation: shimmer var(--shimmer-duration) infinite linear;
30
+ }
31
+ ` })
32
+ }
33
+ );
34
+ };
35
+ Skeleton.displayName = "Skeleton";
36
+ var skeleton_default = Skeleton;
37
+ var skeletonStyle = tv({
38
+ slots: {
39
+ base: [
40
+ "relative",
41
+ "overflow-hidden",
42
+ "w-full",
43
+ "h-[18px]",
44
+ "skeleton-shimmer",
45
+ "before:absolute",
46
+ "before:inset-0",
47
+ "before:-translate-x-full",
48
+ "before:bg-gradient-to-r",
49
+ "before:from-transparent",
50
+ "before:via-white/40",
51
+ "before:to-transparent",
52
+ "before:content-['']"
53
+ ]
54
+ },
55
+ variants: {
56
+ color: {
57
+ primary: { base: "bg-primary-soft" },
58
+ secondary: { base: "bg-secondary-soft" },
59
+ neutral: { base: "bg-neutral-soft" }
60
+ },
61
+ rounded: {
62
+ sm: { base: "rounded-sm" },
63
+ md: { base: "rounded-md" },
64
+ lg: { base: "rounded-lg" },
65
+ xl: { base: "rounded-xl" },
66
+ full: { base: "rounded-full" }
67
+ }
68
+ },
69
+ defaultVariants: {
70
+ color: "primary",
71
+ rounded: "md"
72
+ }
73
+ });
74
+
75
+ export {
76
+ skeleton_default
77
+ };
@@ -0,0 +1,79 @@
1
+ "use client";
2
+ import {
3
+ skeleton_default
4
+ } from "./chunk-6PN3DGOE.mjs";
5
+ import {
6
+ checkbox_default
7
+ } from "./chunk-D6QI3DJG.mjs";
8
+ import {
9
+ clsx
10
+ } from "./chunk-27Y6K5NK.mjs";
11
+
12
+ // src/components/table/table-body.tsx
13
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
14
+ var TableBody = ({
15
+ slots,
16
+ rows,
17
+ columns,
18
+ size,
19
+ color,
20
+ rowCheckbox = false,
21
+ checkedRows,
22
+ onCheckRow,
23
+ onRowClick,
24
+ isLoading = false,
25
+ emptyContent,
26
+ skeletonRow,
27
+ classNames,
28
+ className
29
+ }) => {
30
+ const getCellStyle = (col) => ({
31
+ width: col.width ? `${col.width}px` : void 0,
32
+ minWidth: col.minWidth ? `${col.minWidth}px` : void 0,
33
+ maxWidth: col.maxWidth ? `${col.maxWidth}px` : void 0,
34
+ height: col.height ? `${col.height}px` : void 0
35
+ });
36
+ const renderTdSkeleton = (key) => /* @__PURE__ */ jsx("td", { className: slots.td({ class: classNames == null ? void 0 : classNames.td }), children: /* @__PURE__ */ jsx(skeleton_default, { color, className: "h-full w-full", rounded: "lg", speed: "fast" }) }, key);
37
+ const renderCheckboxCell = (rowIndex) => /* @__PURE__ */ jsx("td", { className: clsx(slots.td({ class: classNames == null ? void 0 : classNames.td }), "text-center"), children: /* @__PURE__ */ jsx(
38
+ checkbox_default,
39
+ {
40
+ size,
41
+ checked: checkedRows.has(rowIndex),
42
+ onChange: (e) => onCheckRow(rowIndex, e.target.checked)
43
+ }
44
+ ) });
45
+ const renderSkeletonRow = (rowIndex) => /* @__PURE__ */ jsxs("tr", { className: slots.tr({ class: classNames == null ? void 0 : classNames.tr }), children: [
46
+ columns.map((_, colIdx) => renderTdSkeleton(`skeleton-${rowIndex}-${colIdx}`)),
47
+ rowCheckbox && renderTdSkeleton(`skeleton-checkbox-${rowIndex}`)
48
+ ] }, `skeleton-${rowIndex}`);
49
+ const renderEmptyRow = () => /* @__PURE__ */ jsx("tr", { className: slots.tr({ class: classNames == null ? void 0 : classNames.tr }), children: /* @__PURE__ */ jsx("td", { colSpan: columns.length + (rowCheckbox ? 1 : 0), className: slots.empty({ class: classNames == null ? void 0 : classNames.empty }), children: emptyContent }) });
50
+ const renderDataRow = (row, rowIndex) => /* @__PURE__ */ jsxs("tr", { className: slots.tr({ class: classNames == null ? void 0 : classNames.tr }), onClick: () => onRowClick == null ? void 0 : onRowClick(row), children: [
51
+ columns.map((col, colIdx) => {
52
+ var _a;
53
+ const value = row[col.field];
54
+ const formattedValue = ((_a = col.valueFormatter) == null ? void 0 : _a.call(col, { value, field: col.field })) || value;
55
+ const content = col.renderCell ? col.renderCell({ id: row.id, field: col.field, value, formattedValue, row }) : formattedValue;
56
+ return /* @__PURE__ */ jsx(
57
+ "td",
58
+ {
59
+ className: clsx(slots.td({ class: classNames == null ? void 0 : classNames.td }), col.className),
60
+ style: getCellStyle(col),
61
+ children: content
62
+ },
63
+ `${rowIndex}-${colIdx}`
64
+ );
65
+ }),
66
+ rowCheckbox && renderCheckboxCell(rowIndex)
67
+ ] }, rowIndex);
68
+ const renderRows = () => {
69
+ if (isLoading) return skeletonRow ? Array.from({ length: skeletonRow }, (_, idx) => renderSkeletonRow(idx)) : /* @__PURE__ */ jsx(Fragment, {});
70
+ if (!rows.length && emptyContent) return renderEmptyRow();
71
+ return rows.map((row, index) => renderDataRow(row, index));
72
+ };
73
+ return /* @__PURE__ */ jsx("tbody", { className: `${slots.tbody({ class: classNames == null ? void 0 : classNames.tbody })} ${className || ""}`, children: renderRows() });
74
+ };
75
+ var table_body_default = TableBody;
76
+
77
+ export {
78
+ table_body_default
79
+ };
@@ -1,16 +1,16 @@
1
1
  "use client";
2
2
  import {
3
3
  table_body_default
4
- } from "./chunk-XRC5OUYQ.mjs";
4
+ } from "./chunk-CEZQCD6Z.mjs";
5
5
  import {
6
6
  table_head_default
7
- } from "./chunk-UNH3BCGN.mjs";
7
+ } from "./chunk-P7YYNA6L.mjs";
8
8
  import {
9
9
  scrollArea_default
10
10
  } from "./chunk-M37VBNB3.mjs";
11
11
  import {
12
12
  pagination_default
13
- } from "./chunk-SO7BGWM7.mjs";
13
+ } from "./chunk-QM4ZSQYX.mjs";
14
14
  import {
15
15
  clsx
16
16
  } from "./chunk-27Y6K5NK.mjs";
@@ -32,39 +32,45 @@ import { jsx, jsxs } from "react/jsx-runtime";
32
32
  var Table = forwardRef((originalProps, ref) => {
33
33
  const [props, variantProps] = mapPropsVariants(originalProps, tableStyle.variantKeys);
34
34
  const {
35
- classNames,
36
35
  rows,
37
36
  columns,
38
- size,
39
- rowCheckbox,
37
+ rowCheckbox = false,
40
38
  onRowClick,
41
39
  totalData,
42
40
  pagination,
43
41
  onPageChange,
44
42
  emptyContent,
45
- isLoading,
46
- className,
47
- color
43
+ isLoading = false,
44
+ classNames,
45
+ color,
46
+ size,
47
+ skeletonRow
48
48
  } = { ...props, ...variantProps };
49
+ const { page = 1, perPage = 10 } = pagination || {};
50
+ const showPagination = pagination && typeof totalData === "number" && !isLoading;
49
51
  const [checkedRows, setCheckedRows] = useState(/* @__PURE__ */ new Set());
50
52
  const divRef = useRef(null);
51
- const { page, perPage } = pagination || { page: 1, perPage: 10 };
52
- const showPagination = pagination && typeof totalData === "number" && !isLoading;
53
- useImperativeHandle(ref, () => ({
54
- checkedRows,
55
- setCheckedRows
56
- }));
53
+ useImperativeHandle(
54
+ ref,
55
+ () => ({
56
+ checkedRows,
57
+ setCheckedRows
58
+ }),
59
+ [checkedRows]
60
+ );
57
61
  useEffect(() => {
58
62
  setCheckedRows(/* @__PURE__ */ new Set());
59
63
  }, [rows]);
60
- const handleCheckAll = (isChecked) => {
61
- const newCheckedRows = isChecked ? new Set(rows.map((_, index) => index)) : /* @__PURE__ */ new Set();
62
- setCheckedRows(newCheckedRows);
64
+ const handleAllRowCheck = (checked) => {
65
+ const updated = checked ? new Set(rows.map((_, i) => i)) : /* @__PURE__ */ new Set();
66
+ setCheckedRows(updated);
63
67
  };
64
- const handleCheck = (rowIndex, isChecked) => {
65
- const newChecked = new Set(checkedRows);
66
- isChecked ? newChecked.add(rowIndex) : newChecked.delete(rowIndex);
67
- setCheckedRows(newChecked);
68
+ const handleRowCheck = (index, checked) => {
69
+ setCheckedRows((prev) => {
70
+ const updated = new Set(prev);
71
+ checked ? updated.add(index) : updated.delete(index);
72
+ return updated;
73
+ });
68
74
  };
69
75
  const slots = useMemo(() => tableStyle(variantProps), [variantProps]);
70
76
  return /* @__PURE__ */ jsxs("div", { ref: divRef, "data-table": "base", className: slots.base({ class: classNames == null ? void 0 : classNames.base }), children: [
@@ -74,9 +80,11 @@ var Table = forwardRef((originalProps, ref) => {
74
80
  {
75
81
  columns,
76
82
  size,
83
+ color,
77
84
  rowCheckbox,
78
85
  isCheckedAll: checkedRows.size === rows.length && rows.length > 0,
79
- onCheckAll: handleCheckAll,
86
+ onCheckAll: handleAllRowCheck,
87
+ isLoading,
80
88
  classNames,
81
89
  slots
82
90
  }
@@ -88,16 +96,18 @@ var Table = forwardRef((originalProps, ref) => {
88
96
  rows,
89
97
  columns,
90
98
  size,
99
+ color,
91
100
  rowCheckbox,
92
101
  checkedRows,
93
102
  onRowClick,
94
- onCheckRow: handleCheck,
103
+ onCheckRow: handleRowCheck,
95
104
  emptyContent,
96
105
  isLoading,
97
- classNames,
106
+ skeletonRow,
98
107
  className: clsx(
99
108
  "transition-all duration-150 ease-out",
100
- isLoading ? "-translate-y-2 opacity-0" : "translate-y-0 opacity-100"
109
+ isLoading ? "-translate-y-2 opacity-0" : "translate-y-0 opacity-100",
110
+ classNames
101
111
  )
102
112
  }
103
113
  )
@@ -109,7 +119,7 @@ var Table = forwardRef((originalProps, ref) => {
109
119
  currentPage: page,
110
120
  totalPage: Math.ceil(totalData / perPage),
111
121
  groupSize: 10,
112
- handleChangePage: (currentPage) => onPageChange && onPageChange({ page: currentPage, perPage })
122
+ handleChangePage: (newPage) => onPageChange == null ? void 0 : onPageChange({ page: newPage, perPage })
113
123
  }
114
124
  ) })
115
125
  ] });
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-LL6F3WDX.mjs";
5
5
  import {
6
6
  button_default
7
- } from "./chunk-JTZUXVOU.mjs";
7
+ } from "./chunk-UB4YBFOT.mjs";
8
8
  import {
9
9
  Icon_default
10
10
  } from "./chunk-2TKEWFGH.mjs";
@@ -1,13 +1,13 @@
1
1
  "use client";
2
- import {
3
- useDatePicker
4
- } from "./chunk-FWJ2ZKH6.mjs";
5
2
  import {
6
3
  calendar_default
7
4
  } from "./chunk-A7RU3FU5.mjs";
8
5
  import {
9
6
  timePicker_default
10
- } from "./chunk-KYJTZPXY.mjs";
7
+ } from "./chunk-BFOK4HVC.mjs";
8
+ import {
9
+ useDatePicker
10
+ } from "./chunk-FWJ2ZKH6.mjs";
11
11
  import {
12
12
  Icon_default
13
13
  } from "./chunk-2TKEWFGH.mjs";
@@ -0,0 +1 @@
1
+ "use client";
@@ -13,7 +13,7 @@ import {
13
13
  import { forwardRef, useMemo, useState, useCallback } from "react";
14
14
  import { jsx, jsxs } from "react/jsx-runtime";
15
15
  var TreeNodeItem = forwardRef(
16
- ({ node, depth, fileIcon, isLoading, classNames, onExpand }, ref) => {
16
+ ({ node, depth, fileIcon, selectedId, isLoading, classNames, onExpand }, ref) => {
17
17
  const [isOpen, setIsOpen] = useState(false);
18
18
  const [children, setChildren] = useState(node.children);
19
19
  const [isLoadingChildren, setIsLoadingChildren] = useState(false);
@@ -37,10 +37,10 @@ var TreeNodeItem = forwardRef(
37
37
  }
38
38
  setIsOpen((prev) => !prev);
39
39
  }, [isOpen, children, onExpand, node]);
40
- const handleClick = () => {
40
+ const handleClick = (e) => {
41
41
  var _a;
42
42
  toggleOpen();
43
- (_a = node.onClick) == null ? void 0 : _a.call(node);
43
+ (_a = node.onClick) == null ? void 0 : _a.call(node, e);
44
44
  };
45
45
  const handleRightClick = (e) => {
46
46
  var _a;
@@ -61,7 +61,11 @@ var TreeNodeItem = forwardRef(
61
61
  /* @__PURE__ */ jsxs(
62
62
  "div",
63
63
  {
64
- className: slots.group({ class: classNames == null ? void 0 : classNames.group }),
64
+ className: clsx(
65
+ slots.node({ class: classNames == null ? void 0 : classNames.node }),
66
+ slots.clickable({ class: classNames == null ? void 0 : classNames.clickable }),
67
+ selectedId == node.id ? "bg-neutral-soft" : ""
68
+ ),
65
69
  onClick: handleClick,
66
70
  onContextMenu: handleRightClick,
67
71
  children: [
@@ -76,7 +80,7 @@ var TreeNodeItem = forwardRef(
76
80
  }
77
81
  ),
78
82
  fileIcon,
79
- node.label
83
+ node.content
80
84
  ]
81
85
  }
82
86
  ),
@@ -87,6 +91,7 @@ var TreeNodeItem = forwardRef(
87
91
  {
88
92
  node: child,
89
93
  depth: depth + 1,
94
+ selectedId,
90
95
  classNames,
91
96
  fileIcon,
92
97
  onExpand
@@ -105,16 +110,15 @@ var Tree = ({
105
110
  group,
106
111
  groupIcon,
107
112
  fileIcon,
113
+ selectedId,
108
114
  isLoading = false,
109
115
  classNames,
110
116
  onExpand
111
117
  }) => {
112
118
  const slots = useMemo(() => treeStyle(), []);
113
- const [isOpen, setIsOpen] = useState(true);
114
- const handleToggle = () => {
119
+ const handleClick = (e) => {
115
120
  var _a;
116
- setIsOpen((prev) => !prev);
117
- (_a = group.onClick) == null ? void 0 : _a.call(group);
121
+ (_a = group.onClick) == null ? void 0 : _a.call(group, e);
118
122
  };
119
123
  const handleRightClick = (e) => {
120
124
  var _a;
@@ -127,22 +131,26 @@ var Tree = ({
127
131
  /* @__PURE__ */ jsxs(
128
132
  "div",
129
133
  {
130
- className: slots.group({ class: classNames == null ? void 0 : classNames.group }),
131
- onClick: handleToggle,
134
+ className: clsx(
135
+ slots.node({ class: classNames == null ? void 0 : classNames.node }),
136
+ group.onClick || group.onRightClick ? slots.clickable({ class: classNames == null ? void 0 : classNames.clickable }) : ""
137
+ ),
138
+ onClick: handleClick,
132
139
  onContextMenu: handleRightClick,
133
140
  children: [
134
141
  groupIcon,
135
- group.label
142
+ group.content
136
143
  ]
137
144
  }
138
145
  ),
139
- isOpen && /* @__PURE__ */ jsx("div", { children: group.data.map((node) => /* @__PURE__ */ jsx(
146
+ /* @__PURE__ */ jsx("div", { children: group.data.map((node) => /* @__PURE__ */ jsx(
140
147
  TreeNodeItem,
141
148
  {
142
149
  node,
143
150
  depth: 1,
144
151
  classNames,
145
152
  fileIcon,
153
+ selectedId,
146
154
  isLoading,
147
155
  onExpand
148
156
  },
@@ -157,18 +165,17 @@ var treeStyle = tv({
157
165
  slots: {
158
166
  base: ["border", "border-neutral-light", "rounded-xl", "p-[20px]", "flex", "flex-col", "gap-[20px]", "select-none"],
159
167
  wrapper: ["flex", "flex-col", "gap-[5px]"],
160
- group: [
168
+ node: [
161
169
  "flex",
162
170
  "items-center",
163
171
  "gap-[5px]",
164
172
  "text-md",
165
173
  "font-bold",
166
174
  "text-body-foreground",
167
- "hover:bg-neutral-soft",
168
- "p-[5px]",
169
175
  "rounded-[5px]",
170
- "cursor-pointer"
171
- ]
176
+ "p-[5px]"
177
+ ],
178
+ clickable: ["hover:bg-neutral-soft", "cursor-pointer"]
172
179
  }
173
180
  });
174
181
 
@@ -0,0 +1,132 @@
1
+ "use client";
2
+ import {
3
+ input_default
4
+ } from "./chunk-VCVQMPC7.mjs";
5
+ import {
6
+ button_default
7
+ } from "./chunk-UB4YBFOT.mjs";
8
+ import {
9
+ icon_button_default
10
+ } from "./chunk-7TAGGLNY.mjs";
11
+
12
+ // src/components/fileUpload/fileUpload.tsx
13
+ import { useRef, useState, useEffect } from "react";
14
+ import { tv } from "tailwind-variants";
15
+ import { jsx, jsxs } from "react/jsx-runtime";
16
+ function FileUpload({
17
+ buttonText,
18
+ maxSizeMB = 10,
19
+ placeholder,
20
+ accept = [],
21
+ acceptErrorMessage = "The file type is not allowed.",
22
+ sizeErrorMessage = `File is too large.`,
23
+ onFileUpload,
24
+ helperMessage,
25
+ showProgress,
26
+ classNames
27
+ }) {
28
+ const fileInputRef = useRef(null);
29
+ const uploadIntervalRef = useRef(null);
30
+ const [file, setFile] = useState(null);
31
+ const [uploadProgress, setUploadProgress] = useState(0);
32
+ const [errorMessage, setErrorMessage] = useState("");
33
+ const slots = fileUploadStyle();
34
+ const handleButtonClick = () => {
35
+ var _a;
36
+ (_a = fileInputRef.current) == null ? void 0 : _a.click();
37
+ };
38
+ const validateFile = (file2) => {
39
+ if (accept.length && !accept.includes(file2.type)) {
40
+ return acceptErrorMessage;
41
+ }
42
+ const sizeMB = file2.size / 1024 / 1024;
43
+ if (sizeMB > maxSizeMB) {
44
+ return `${sizeErrorMessage} (${maxSizeMB}MB)`;
45
+ }
46
+ return null;
47
+ };
48
+ const startUploadSimulation = (file2) => {
49
+ let progress = 0;
50
+ setUploadProgress(0);
51
+ uploadIntervalRef.current = window.setInterval(() => {
52
+ progress += 10;
53
+ setUploadProgress(progress);
54
+ if (progress >= 100) {
55
+ clearInterval(uploadIntervalRef.current);
56
+ onFileUpload == null ? void 0 : onFileUpload(file2);
57
+ }
58
+ }, 100);
59
+ };
60
+ const handleFileChange = (e) => {
61
+ var _a;
62
+ const selectedFile = (_a = e.target.files) == null ? void 0 : _a[0];
63
+ if (!selectedFile) return;
64
+ const error = validateFile(selectedFile);
65
+ if (error) {
66
+ setErrorMessage(error);
67
+ setFile(null);
68
+ return;
69
+ }
70
+ setFile(selectedFile);
71
+ setErrorMessage("");
72
+ startUploadSimulation(selectedFile);
73
+ };
74
+ const handleCancelUpload = () => {
75
+ if (uploadIntervalRef.current) {
76
+ clearInterval(uploadIntervalRef.current);
77
+ }
78
+ setFile(null);
79
+ setUploadProgress(0);
80
+ setErrorMessage("");
81
+ };
82
+ useEffect(() => {
83
+ return () => {
84
+ if (uploadIntervalRef.current) {
85
+ clearInterval(uploadIntervalRef.current);
86
+ }
87
+ };
88
+ }, []);
89
+ return /* @__PURE__ */ jsxs("div", { className: slots.base({ class: classNames == null ? void 0 : classNames.base }), children: [
90
+ /* @__PURE__ */ jsxs("div", { className: slots.container({ class: classNames == null ? void 0 : classNames.container }), children: [
91
+ /* @__PURE__ */ jsxs("div", { className: slots.inputWrapper(), children: [
92
+ /* @__PURE__ */ jsx(input_default, { name: "file", readOnly: true, variant: "outline", full: true, placeholder, defaultValue: file == null ? void 0 : file.name }),
93
+ file && /* @__PURE__ */ jsx(
94
+ icon_button_default,
95
+ {
96
+ name: "close",
97
+ variant: "ghost",
98
+ color: "neutral",
99
+ onClick: handleCancelUpload,
100
+ classNames: { base: slots.cancelButton() },
101
+ "aria-label": "cancel"
102
+ }
103
+ )
104
+ ] }),
105
+ /* @__PURE__ */ jsx(button_default, { type: "button", variant: "outline", onClick: handleButtonClick, children: buttonText }),
106
+ /* @__PURE__ */ jsx("input", { ref: fileInputRef, type: "file", hidden: true, accept: accept.join(","), onChange: handleFileChange })
107
+ ] }),
108
+ showProgress && file && uploadProgress < 100 && /* @__PURE__ */ jsx("div", { className: slots.progressBarContainer(), children: /* @__PURE__ */ jsx("div", { className: slots.progressBar(), style: { width: `${uploadProgress}%` } }) }),
109
+ !errorMessage && helperMessage && /* @__PURE__ */ jsx("p", { className: slots.helperMessage(), children: helperMessage }),
110
+ errorMessage && /* @__PURE__ */ jsx("p", { className: slots.errorMessage(), children: errorMessage })
111
+ ] });
112
+ }
113
+ FileUpload.displayName = "FileUpload";
114
+ var fileUpload_default = FileUpload;
115
+ var fileUploadStyle = tv({
116
+ slots: {
117
+ base: ["flex", "flex-col", "gap-[5px]"],
118
+ container: ["flex", "items-center", "gap-[10px]"],
119
+ inputWrapper: ["relative", "flex-1"],
120
+ cancelButton: ["absolute", "top-1/2", "right-0", "-translate-y-1/2"],
121
+ progressBarContainer: ["w-full", "h-[5px]", "bg-neutral-light", "rounded-full", "overflow-hidden"],
122
+ progressBar: ["h-full", "bg-primary-main", "transition-all"],
123
+ errorMessage: ["text-danger-main", "text-sm"],
124
+ helperMessage: ["text-neutral-main", "text-sm"]
125
+ }
126
+ });
127
+
128
+ export {
129
+ FileUpload,
130
+ fileUpload_default,
131
+ fileUploadStyle
132
+ };
@@ -0,0 +1,67 @@
1
+ "use client";
2
+ import {
3
+ skeleton_default
4
+ } from "./chunk-6PN3DGOE.mjs";
5
+ import {
6
+ checkbox_default
7
+ } from "./chunk-D6QI3DJG.mjs";
8
+ import {
9
+ clsx
10
+ } from "./chunk-27Y6K5NK.mjs";
11
+
12
+ // src/components/table/table-head.tsx
13
+ import { jsx, jsxs } from "react/jsx-runtime";
14
+ var TableHead = ({
15
+ slots,
16
+ columns,
17
+ color,
18
+ size,
19
+ rowCheckbox = false,
20
+ isCheckedAll,
21
+ isLoading = false,
22
+ classNames,
23
+ onCheckAll
24
+ }) => {
25
+ const handleClickCheckAll = (e) => {
26
+ e.preventDefault();
27
+ onCheckAll(!isCheckedAll);
28
+ };
29
+ const renderTh = (content, key, column) => /* @__PURE__ */ jsx(
30
+ "th",
31
+ {
32
+ className: clsx(slots.th({ class: classNames == null ? void 0 : classNames.th }), column),
33
+ style: {
34
+ width: (column == null ? void 0 : column.width) ? `${column.width}px` : void 0,
35
+ minWidth: (column == null ? void 0 : column.minWidth) ? `${column.minWidth}px` : void 0,
36
+ maxWidth: (column == null ? void 0 : column.maxWidth) ? `${column.maxWidth}px` : void 0,
37
+ height: (column == null ? void 0 : column.height) ? `${column.height}px` : void 0
38
+ },
39
+ children: content
40
+ },
41
+ key
42
+ );
43
+ const renderSkeletonRow = () => /* @__PURE__ */ jsx("thead", { className: slots.thead({ class: classNames == null ? void 0 : classNames.thead }), children: /* @__PURE__ */ jsxs("tr", { className: clsx(slots.tr({ class: classNames == null ? void 0 : classNames.tr }), "[&>th]:border-0"), children: [
44
+ columns.map((_, idx) => renderTh(/* @__PURE__ */ jsx(skeleton_default, { color, rounded: "lg", speed: "fast" }), `skeleton-${idx}`)),
45
+ rowCheckbox && renderTh(/* @__PURE__ */ jsx(skeleton_default, { color, rounded: "lg", speed: "fast" }), "checkbox-skeleton")
46
+ ] }) });
47
+ const renderContentRow = () => /* @__PURE__ */ jsx("thead", { className: slots.thead({ class: classNames == null ? void 0 : classNames.thead }), children: /* @__PURE__ */ jsxs("tr", { className: slots.tr({ class: classNames == null ? void 0 : classNames.tr }), children: [
48
+ columns.map((column, idx) => renderTh(column.headerName, `${column.field}-${idx}`, column)),
49
+ rowCheckbox && renderTh(
50
+ /* @__PURE__ */ jsx("div", { className: "flex items-center justify-center", onClick: handleClickCheckAll, children: /* @__PURE__ */ jsx(
51
+ checkbox_default,
52
+ {
53
+ size,
54
+ checked: isCheckedAll,
55
+ onChange: (e) => onCheckAll(e.target.checked)
56
+ }
57
+ ) }),
58
+ "checkbox"
59
+ )
60
+ ] }) });
61
+ return isLoading ? renderSkeletonRow() : renderContentRow();
62
+ };
63
+ var table_head_default = TableHead;
64
+
65
+ export {
66
+ table_head_default
67
+ };
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-F3HENRVM.mjs";
5
5
  import {
6
6
  input_default
7
- } from "./chunk-BEQ3KZGS.mjs";
7
+ } from "./chunk-VCVQMPC7.mjs";
8
8
  import {
9
9
  Icon_default
10
10
  } from "./chunk-2TKEWFGH.mjs";
@@ -0,0 +1 @@
1
+ "use client";
@@ -103,9 +103,10 @@ var Input = forwardRef((originalProps, ref) => {
103
103
  {
104
104
  ...inputProps,
105
105
  ref: ref || inputRef,
106
+ readOnly: props.readOnly,
106
107
  className: clsx(
107
108
  slots.input({ class: classNames == null ? void 0 : classNames.input }),
108
- inputProps.readOnly ? "!text-body-foreground placeholder:text-body-foreground" : ""
109
+ inputProps.readOnly ? "!text-body-foreground placeholder:!text-body-foreground" : ""
109
110
  ),
110
111
  size: 0
111
112
  }
@@ -4,11 +4,11 @@ import {
4
4
  } from "../../chunk-G67WUZO3.mjs";
5
5
  import "../../chunk-MY5U63QO.mjs";
6
6
  import "../../chunk-LPZOH3RP.mjs";
7
- import "../../chunk-JTZUXVOU.mjs";
8
- import "../../chunk-QIEKOGY7.mjs";
7
+ import "../../chunk-UB4YBFOT.mjs";
8
+ import "../../chunk-7TAGGLNY.mjs";
9
9
  import "../../chunk-6WSACUIB.mjs";
10
- import "../../chunk-6PNKRBUT.mjs";
11
10
  import "../../chunk-LXHUO6VM.mjs";
11
+ import "../../chunk-6PNKRBUT.mjs";
12
12
  import "../../chunk-WFMFC7R6.mjs";
13
13
  import "../../chunk-ZYIIXWVY.mjs";
14
14
  import "../../chunk-2TKEWFGH.mjs";