@deepnoid/ui 0.1.28 → 0.1.29

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 (94) hide show
  1. package/.turbo/turbo-build.log +174 -164
  2. package/dist/{chunk-UNH3BCGN.mjs → chunk-26MNALVL.mjs} +1 -1
  3. package/dist/chunk-3KVZDFMV.mjs +132 -0
  4. package/dist/{chunk-XRC5OUYQ.mjs → chunk-A5KQHWS3.mjs} +1 -1
  5. package/dist/{chunk-IBI3OVQI.mjs → chunk-BB7MFKNQ.mjs} +1 -1
  6. package/dist/{chunk-NHVIKP4H.mjs → chunk-ECMBAKSJ.mjs} +8 -8
  7. package/dist/{chunk-BEQ3KZGS.mjs → chunk-EHRFXDSN.mjs} +5 -4
  8. package/dist/{chunk-G67WUZO3.mjs → chunk-III2QUWF.mjs} +1 -1
  9. package/dist/{chunk-SO7BGWM7.mjs → chunk-KXA73VTJ.mjs} +4 -4
  10. package/dist/{chunk-K7VUN5BS.mjs → chunk-LR3SWRB4.mjs} +5 -5
  11. package/dist/{chunk-KYJTZPXY.mjs → chunk-QJJKJYNR.mjs} +4 -4
  12. package/dist/{chunk-JV7VLO2L.mjs → chunk-RCJOJPRS.mjs} +6 -6
  13. package/dist/chunk-RLXOHILK.mjs +1 -0
  14. package/dist/{chunk-4OSN2OE2.mjs → chunk-X4F7JYBA.mjs} +17 -32
  15. package/dist/components/backdrop/backdrop.mjs +2 -2
  16. package/dist/components/backdrop/index.mjs +2 -2
  17. package/dist/components/breadcrumb/breadcrumb.mjs +6 -6
  18. package/dist/components/breadcrumb/index.mjs +6 -6
  19. package/dist/components/button/button.mjs +3 -3
  20. package/dist/components/button/icon-button.mjs +3 -3
  21. package/dist/components/button/index.mjs +5 -5
  22. package/dist/components/button/text-button.mjs +2 -2
  23. package/dist/components/checkbox/checkbox.mjs +2 -2
  24. package/dist/components/checkbox/index.mjs +2 -2
  25. package/dist/components/chip/chip.mjs +2 -2
  26. package/dist/components/chip/index.mjs +2 -2
  27. package/dist/components/dateTimePicker/calendar.mjs +2 -2
  28. package/dist/components/dateTimePicker/dateTimePicker.mjs +7 -7
  29. package/dist/components/dateTimePicker/index.mjs +7 -7
  30. package/dist/components/dateTimePicker/timePicker.mjs +4 -4
  31. package/dist/components/fileUpload/fileUpload.d.mts +92 -0
  32. package/dist/components/fileUpload/fileUpload.d.ts +92 -0
  33. package/dist/components/fileUpload/fileUpload.js +5648 -0
  34. package/dist/components/fileUpload/fileUpload.mjs +28 -0
  35. package/dist/components/fileUpload/index.d.mts +5 -0
  36. package/dist/components/fileUpload/index.d.ts +5 -0
  37. package/dist/components/fileUpload/index.js +5647 -0
  38. package/dist/components/fileUpload/index.mjs +25 -0
  39. package/dist/components/input/index.js +2 -1
  40. package/dist/components/input/index.mjs +2 -2
  41. package/dist/components/input/input.js +2 -1
  42. package/dist/components/input/input.mjs +2 -2
  43. package/dist/components/list/index.mjs +5 -5
  44. package/dist/components/list/list.mjs +2 -2
  45. package/dist/components/list/listItem.mjs +2 -2
  46. package/dist/components/modal/index.mjs +7 -7
  47. package/dist/components/modal/modal.mjs +7 -7
  48. package/dist/components/pagination/index.js +2 -1
  49. package/dist/components/pagination/index.mjs +3 -3
  50. package/dist/components/pagination/pagination.js +2 -1
  51. package/dist/components/pagination/pagination.mjs +3 -3
  52. package/dist/components/radio/index.mjs +2 -2
  53. package/dist/components/radio/radio.mjs +2 -2
  54. package/dist/components/ripple/index.mjs +3 -3
  55. package/dist/components/select/index.mjs +2 -2
  56. package/dist/components/select/select.mjs +2 -2
  57. package/dist/components/table/index.js +2 -1
  58. package/dist/components/table/index.mjs +10 -10
  59. package/dist/components/table/table-body.mjs +3 -3
  60. package/dist/components/table/table-head.mjs +3 -3
  61. package/dist/components/table/table.js +2 -1
  62. package/dist/components/table/table.mjs +7 -7
  63. package/dist/components/tabs/index.mjs +2 -2
  64. package/dist/components/tabs/tabs.mjs +2 -2
  65. package/dist/components/toast/index.mjs +3 -3
  66. package/dist/components/toast/toast.mjs +2 -2
  67. package/dist/components/toast/use-toast.mjs +3 -3
  68. package/dist/components/tooltip/index.mjs +2 -2
  69. package/dist/components/tooltip/tooltip.mjs +2 -2
  70. package/dist/components/tree/index.js +14 -29
  71. package/dist/components/tree/index.mjs +2 -2
  72. package/dist/components/tree/tree.d.mts +10 -5
  73. package/dist/components/tree/tree.d.ts +10 -5
  74. package/dist/components/tree/tree.js +14 -29
  75. package/dist/components/tree/tree.mjs +2 -2
  76. package/dist/index.d.mts +1 -0
  77. package/dist/index.d.ts +1 -0
  78. package/dist/index.js +134 -30
  79. package/dist/index.mjs +47 -42
  80. package/package.json +1 -1
  81. package/dist/{chunk-WFMFC7R6.mjs → chunk-2PKM7SLZ.mjs} +3 -3
  82. package/dist/{chunk-QIRL6HY6.mjs → chunk-33LANVZV.mjs} +3 -3
  83. package/dist/{chunk-QIEKOGY7.mjs → chunk-6K3E5BVO.mjs} +6 -6
  84. package/dist/{chunk-JTZUXVOU.mjs → chunk-7J3KVOTS.mjs} +6 -6
  85. package/dist/{chunk-MEY4IL7D.mjs → chunk-7W2ZI2DD.mjs} +3 -3
  86. package/dist/{chunk-Z2537DF6.mjs → chunk-IL5ENWCR.mjs} +3 -3
  87. package/dist/{chunk-272FMLIL.mjs → chunk-KLUC2BV6.mjs} +3 -3
  88. package/dist/{chunk-LL6F3WDX.mjs → chunk-P5QCU457.mjs} +3 -3
  89. package/dist/{chunk-2YMAKIZ6.mjs → chunk-SSMMWMQC.mjs} +3 -3
  90. package/dist/{chunk-HIVPDIEP.mjs → chunk-UFVQPPPW.mjs} +3 -3
  91. package/dist/{chunk-RT3S3VVJ.mjs → chunk-W45H2ZMW.mjs} +3 -3
  92. package/dist/{chunk-A7RU3FU5.mjs → chunk-X6D7C7QZ.mjs} +3 -3
  93. package/dist/{chunk-WLNLVX7Q.mjs → chunk-Y6XQTWB5.mjs} +3 -3
  94. package/dist/{chunk-D6QI3DJG.mjs → chunk-YLRYHUTW.mjs} +3 -3
@@ -4350,7 +4350,7 @@ function toVal(mix) {
4350
4350
  // src/components/tree/tree.tsx
4351
4351
  var import_jsx_runtime3 = require("react/jsx-runtime");
4352
4352
  var TreeNodeItem = (0, import_react.forwardRef)(
4353
- ({ node, depth, fileIcon, isLoading, classNames, onExpand }, ref) => {
4353
+ ({ node, depth, fileIcon, selectedId, isLoading, classNames, onExpand }, ref) => {
4354
4354
  const [isOpen, setIsOpen] = (0, import_react.useState)(false);
4355
4355
  const [children, setChildren] = (0, import_react.useState)(node.children);
4356
4356
  const [isLoadingChildren, setIsLoadingChildren] = (0, import_react.useState)(false);
@@ -4374,10 +4374,10 @@ var TreeNodeItem = (0, import_react.forwardRef)(
4374
4374
  }
4375
4375
  setIsOpen((prev) => !prev);
4376
4376
  }, [isOpen, children, onExpand, node]);
4377
- const handleClick = () => {
4377
+ const handleClick = (e) => {
4378
4378
  var _a;
4379
4379
  toggleOpen();
4380
- (_a = node.onClick) == null ? void 0 : _a.call(node);
4380
+ (_a = node.onClick) == null ? void 0 : _a.call(node, e);
4381
4381
  };
4382
4382
  const handleRightClick = (e) => {
4383
4383
  var _a;
@@ -4398,7 +4398,7 @@ var TreeNodeItem = (0, import_react.forwardRef)(
4398
4398
  /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
4399
4399
  "div",
4400
4400
  {
4401
- className: slots.group({ class: classNames == null ? void 0 : classNames.group }),
4401
+ className: clsx(slots.node({ class: classNames == null ? void 0 : classNames.node }), selectedId == node.id ? "bg-neutral-soft" : ""),
4402
4402
  onClick: handleClick,
4403
4403
  onContextMenu: handleRightClick,
4404
4404
  children: [
@@ -4424,6 +4424,7 @@ var TreeNodeItem = (0, import_react.forwardRef)(
4424
4424
  {
4425
4425
  node: child,
4426
4426
  depth: depth + 1,
4427
+ selectedId,
4427
4428
  classNames,
4428
4429
  fileIcon,
4429
4430
  onExpand
@@ -4442,44 +4443,27 @@ var Tree = ({
4442
4443
  group,
4443
4444
  groupIcon,
4444
4445
  fileIcon,
4446
+ selectedId,
4445
4447
  isLoading = false,
4446
4448
  classNames,
4447
4449
  onExpand
4448
4450
  }) => {
4449
4451
  const slots = (0, import_react.useMemo)(() => treeStyle(), []);
4450
- const [isOpen, setIsOpen] = (0, import_react.useState)(true);
4451
- const handleToggle = () => {
4452
- var _a;
4453
- setIsOpen((prev) => !prev);
4454
- (_a = group.onClick) == null ? void 0 : _a.call(group);
4455
- };
4456
- const handleRightClick = (e) => {
4457
- var _a;
4458
- e.preventDefault();
4459
- (_a = group.onRightClick) == null ? void 0 : _a.call(group, e);
4460
- };
4461
4452
  return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: slots.base({ class: classNames == null ? void 0 : classNames.base }), children: [
4462
4453
  headerContent && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { children: headerContent }),
4463
4454
  /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: slots.wrapper({ class: classNames == null ? void 0 : classNames.wrapper }), children: [
4464
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
4465
- "div",
4466
- {
4467
- className: slots.group({ class: classNames == null ? void 0 : classNames.group }),
4468
- onClick: handleToggle,
4469
- onContextMenu: handleRightClick,
4470
- children: [
4471
- groupIcon,
4472
- group.label
4473
- ]
4474
- }
4475
- ),
4476
- isOpen && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { children: group.data.map((node) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
4455
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: slots.group({ class: classNames == null ? void 0 : classNames.group }), children: [
4456
+ groupIcon,
4457
+ group.label
4458
+ ] }),
4459
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { children: group.data.map((node) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
4477
4460
  TreeNodeItem,
4478
4461
  {
4479
4462
  node,
4480
4463
  depth: 1,
4481
4464
  classNames,
4482
4465
  fileIcon,
4466
+ selectedId,
4483
4467
  isLoading,
4484
4468
  onExpand
4485
4469
  },
@@ -4494,7 +4478,8 @@ var treeStyle = tv({
4494
4478
  slots: {
4495
4479
  base: ["border", "border-neutral-light", "rounded-xl", "p-[20px]", "flex", "flex-col", "gap-[20px]", "select-none"],
4496
4480
  wrapper: ["flex", "flex-col", "gap-[5px]"],
4497
- group: [
4481
+ group: ["flex", "items-center", "gap-[5px]", "text-md", "font-bold", "text-body-foreground", "p-[5px]"],
4482
+ node: [
4498
4483
  "flex",
4499
4484
  "items-center",
4500
4485
  "gap-[5px]",
@@ -2,12 +2,12 @@
2
2
  import "../../chunk-MBLZYQCN.mjs";
3
3
  import {
4
4
  tree_default
5
- } from "../../chunk-4OSN2OE2.mjs";
5
+ } from "../../chunk-X4F7JYBA.mjs";
6
6
  import "../../chunk-ZYIIXWVY.mjs";
7
7
  import "../../chunk-2TKEWFGH.mjs";
8
8
  import "../../chunk-2SDYFOZL.mjs";
9
- import "../../chunk-4ZJFD3L3.mjs";
10
9
  import "../../chunk-27Y6K5NK.mjs";
10
+ import "../../chunk-4ZJFD3L3.mjs";
11
11
  import "../../chunk-AC6TWLRT.mjs";
12
12
  export {
13
13
  tree_default as Tree
@@ -9,25 +9,24 @@ type TreeNode = {
9
9
  label: string;
10
10
  isLeaf?: boolean;
11
11
  children?: TreeNode[];
12
- onClick?: () => void;
13
- onRightClick?: (event: MouseEvent<HTMLSpanElement>) => void;
12
+ onClick?: (event: MouseEvent<HTMLDivElement>) => void;
13
+ onRightClick?: (event: MouseEvent<HTMLDivElement>) => void;
14
14
  };
15
15
  interface TreeProps {
16
16
  headerContent?: ReactNode;
17
17
  group: {
18
18
  label: string;
19
19
  data: TreeNode[];
20
- onClick?: () => void;
21
- onRightClick?: (event: MouseEvent<HTMLSpanElement>) => void;
22
20
  };
23
21
  groupIcon?: ReactNode;
24
22
  fileIcon?: ReactNode;
23
+ selectedId?: number | string;
25
24
  isLoading?: boolean;
26
25
  classNames?: SlotsToClasses<TreeSlots>;
27
26
  onExpand?: (node: TreeNode) => Promise<TreeNode[]>;
28
27
  }
29
28
  declare const Tree: {
30
- ({ headerContent, group, groupIcon, fileIcon, isLoading, classNames, onExpand, }: TreeProps): react_jsx_runtime.JSX.Element;
29
+ ({ headerContent, group, groupIcon, fileIcon, selectedId, isLoading, classNames, onExpand, }: TreeProps): react_jsx_runtime.JSX.Element;
31
30
  displayName: string;
32
31
  };
33
32
 
@@ -37,6 +36,7 @@ declare const treeStyle: tailwind_variants.TVReturnType<{
37
36
  base?: tailwind_merge.ClassNameValue;
38
37
  group?: tailwind_merge.ClassNameValue;
39
38
  wrapper?: tailwind_merge.ClassNameValue;
39
+ node?: tailwind_merge.ClassNameValue;
40
40
  };
41
41
  };
42
42
  } | {
@@ -45,28 +45,33 @@ declare const treeStyle: tailwind_variants.TVReturnType<{
45
45
  base?: tailwind_merge.ClassNameValue;
46
46
  group?: tailwind_merge.ClassNameValue;
47
47
  wrapper?: tailwind_merge.ClassNameValue;
48
+ node?: tailwind_merge.ClassNameValue;
48
49
  };
49
50
  };
50
51
  } | {}, {
51
52
  base: string[];
52
53
  wrapper: string[];
53
54
  group: string[];
55
+ node: string[];
54
56
  }, undefined, {
55
57
  [key: string]: {
56
58
  [key: string]: tailwind_merge.ClassNameValue | {
57
59
  base?: tailwind_merge.ClassNameValue;
58
60
  group?: tailwind_merge.ClassNameValue;
59
61
  wrapper?: tailwind_merge.ClassNameValue;
62
+ node?: tailwind_merge.ClassNameValue;
60
63
  };
61
64
  };
62
65
  } | {}, {
63
66
  base: string[];
64
67
  wrapper: string[];
65
68
  group: string[];
69
+ node: string[];
66
70
  }, tailwind_variants.TVReturnType<unknown, {
67
71
  base: string[];
68
72
  wrapper: string[];
69
73
  group: string[];
74
+ node: string[];
70
75
  }, undefined, unknown, unknown, undefined>>;
71
76
  type TreeSlots = keyof ReturnType<typeof treeStyle>;
72
77
 
@@ -9,25 +9,24 @@ type TreeNode = {
9
9
  label: string;
10
10
  isLeaf?: boolean;
11
11
  children?: TreeNode[];
12
- onClick?: () => void;
13
- onRightClick?: (event: MouseEvent<HTMLSpanElement>) => void;
12
+ onClick?: (event: MouseEvent<HTMLDivElement>) => void;
13
+ onRightClick?: (event: MouseEvent<HTMLDivElement>) => void;
14
14
  };
15
15
  interface TreeProps {
16
16
  headerContent?: ReactNode;
17
17
  group: {
18
18
  label: string;
19
19
  data: TreeNode[];
20
- onClick?: () => void;
21
- onRightClick?: (event: MouseEvent<HTMLSpanElement>) => void;
22
20
  };
23
21
  groupIcon?: ReactNode;
24
22
  fileIcon?: ReactNode;
23
+ selectedId?: number | string;
25
24
  isLoading?: boolean;
26
25
  classNames?: SlotsToClasses<TreeSlots>;
27
26
  onExpand?: (node: TreeNode) => Promise<TreeNode[]>;
28
27
  }
29
28
  declare const Tree: {
30
- ({ headerContent, group, groupIcon, fileIcon, isLoading, classNames, onExpand, }: TreeProps): react_jsx_runtime.JSX.Element;
29
+ ({ headerContent, group, groupIcon, fileIcon, selectedId, isLoading, classNames, onExpand, }: TreeProps): react_jsx_runtime.JSX.Element;
31
30
  displayName: string;
32
31
  };
33
32
 
@@ -37,6 +36,7 @@ declare const treeStyle: tailwind_variants.TVReturnType<{
37
36
  base?: tailwind_merge.ClassNameValue;
38
37
  group?: tailwind_merge.ClassNameValue;
39
38
  wrapper?: tailwind_merge.ClassNameValue;
39
+ node?: tailwind_merge.ClassNameValue;
40
40
  };
41
41
  };
42
42
  } | {
@@ -45,28 +45,33 @@ declare const treeStyle: tailwind_variants.TVReturnType<{
45
45
  base?: tailwind_merge.ClassNameValue;
46
46
  group?: tailwind_merge.ClassNameValue;
47
47
  wrapper?: tailwind_merge.ClassNameValue;
48
+ node?: tailwind_merge.ClassNameValue;
48
49
  };
49
50
  };
50
51
  } | {}, {
51
52
  base: string[];
52
53
  wrapper: string[];
53
54
  group: string[];
55
+ node: string[];
54
56
  }, undefined, {
55
57
  [key: string]: {
56
58
  [key: string]: tailwind_merge.ClassNameValue | {
57
59
  base?: tailwind_merge.ClassNameValue;
58
60
  group?: tailwind_merge.ClassNameValue;
59
61
  wrapper?: tailwind_merge.ClassNameValue;
62
+ node?: tailwind_merge.ClassNameValue;
60
63
  };
61
64
  };
62
65
  } | {}, {
63
66
  base: string[];
64
67
  wrapper: string[];
65
68
  group: string[];
69
+ node: string[];
66
70
  }, tailwind_variants.TVReturnType<unknown, {
67
71
  base: string[];
68
72
  wrapper: string[];
69
73
  group: string[];
74
+ node: string[];
70
75
  }, undefined, unknown, unknown, undefined>>;
71
76
  type TreeSlots = keyof ReturnType<typeof treeStyle>;
72
77
 
@@ -4349,7 +4349,7 @@ function toVal(mix) {
4349
4349
  // src/components/tree/tree.tsx
4350
4350
  var import_jsx_runtime3 = require("react/jsx-runtime");
4351
4351
  var TreeNodeItem = (0, import_react.forwardRef)(
4352
- ({ node, depth, fileIcon, isLoading, classNames, onExpand }, ref) => {
4352
+ ({ node, depth, fileIcon, selectedId, isLoading, classNames, onExpand }, ref) => {
4353
4353
  const [isOpen, setIsOpen] = (0, import_react.useState)(false);
4354
4354
  const [children, setChildren] = (0, import_react.useState)(node.children);
4355
4355
  const [isLoadingChildren, setIsLoadingChildren] = (0, import_react.useState)(false);
@@ -4373,10 +4373,10 @@ var TreeNodeItem = (0, import_react.forwardRef)(
4373
4373
  }
4374
4374
  setIsOpen((prev) => !prev);
4375
4375
  }, [isOpen, children, onExpand, node]);
4376
- const handleClick = () => {
4376
+ const handleClick = (e) => {
4377
4377
  var _a;
4378
4378
  toggleOpen();
4379
- (_a = node.onClick) == null ? void 0 : _a.call(node);
4379
+ (_a = node.onClick) == null ? void 0 : _a.call(node, e);
4380
4380
  };
4381
4381
  const handleRightClick = (e) => {
4382
4382
  var _a;
@@ -4397,7 +4397,7 @@ var TreeNodeItem = (0, import_react.forwardRef)(
4397
4397
  /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
4398
4398
  "div",
4399
4399
  {
4400
- className: slots.group({ class: classNames == null ? void 0 : classNames.group }),
4400
+ className: clsx(slots.node({ class: classNames == null ? void 0 : classNames.node }), selectedId == node.id ? "bg-neutral-soft" : ""),
4401
4401
  onClick: handleClick,
4402
4402
  onContextMenu: handleRightClick,
4403
4403
  children: [
@@ -4423,6 +4423,7 @@ var TreeNodeItem = (0, import_react.forwardRef)(
4423
4423
  {
4424
4424
  node: child,
4425
4425
  depth: depth + 1,
4426
+ selectedId,
4426
4427
  classNames,
4427
4428
  fileIcon,
4428
4429
  onExpand
@@ -4441,44 +4442,27 @@ var Tree = ({
4441
4442
  group,
4442
4443
  groupIcon,
4443
4444
  fileIcon,
4445
+ selectedId,
4444
4446
  isLoading = false,
4445
4447
  classNames,
4446
4448
  onExpand
4447
4449
  }) => {
4448
4450
  const slots = (0, import_react.useMemo)(() => treeStyle(), []);
4449
- const [isOpen, setIsOpen] = (0, import_react.useState)(true);
4450
- const handleToggle = () => {
4451
- var _a;
4452
- setIsOpen((prev) => !prev);
4453
- (_a = group.onClick) == null ? void 0 : _a.call(group);
4454
- };
4455
- const handleRightClick = (e) => {
4456
- var _a;
4457
- e.preventDefault();
4458
- (_a = group.onRightClick) == null ? void 0 : _a.call(group, e);
4459
- };
4460
4451
  return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: slots.base({ class: classNames == null ? void 0 : classNames.base }), children: [
4461
4452
  headerContent && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { children: headerContent }),
4462
4453
  /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: slots.wrapper({ class: classNames == null ? void 0 : classNames.wrapper }), children: [
4463
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
4464
- "div",
4465
- {
4466
- className: slots.group({ class: classNames == null ? void 0 : classNames.group }),
4467
- onClick: handleToggle,
4468
- onContextMenu: handleRightClick,
4469
- children: [
4470
- groupIcon,
4471
- group.label
4472
- ]
4473
- }
4474
- ),
4475
- isOpen && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { children: group.data.map((node) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
4454
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: slots.group({ class: classNames == null ? void 0 : classNames.group }), children: [
4455
+ groupIcon,
4456
+ group.label
4457
+ ] }),
4458
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { children: group.data.map((node) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
4476
4459
  TreeNodeItem,
4477
4460
  {
4478
4461
  node,
4479
4462
  depth: 1,
4480
4463
  classNames,
4481
4464
  fileIcon,
4465
+ selectedId,
4482
4466
  isLoading,
4483
4467
  onExpand
4484
4468
  },
@@ -4493,7 +4477,8 @@ var treeStyle = tv({
4493
4477
  slots: {
4494
4478
  base: ["border", "border-neutral-light", "rounded-xl", "p-[20px]", "flex", "flex-col", "gap-[20px]", "select-none"],
4495
4479
  wrapper: ["flex", "flex-col", "gap-[5px]"],
4496
- group: [
4480
+ group: ["flex", "items-center", "gap-[5px]", "text-md", "font-bold", "text-body-foreground", "p-[5px]"],
4481
+ node: [
4497
4482
  "flex",
4498
4483
  "items-center",
4499
4484
  "gap-[5px]",
@@ -2,12 +2,12 @@
2
2
  import {
3
3
  Tree,
4
4
  tree_default
5
- } from "../../chunk-4OSN2OE2.mjs";
5
+ } from "../../chunk-X4F7JYBA.mjs";
6
6
  import "../../chunk-ZYIIXWVY.mjs";
7
7
  import "../../chunk-2TKEWFGH.mjs";
8
8
  import "../../chunk-2SDYFOZL.mjs";
9
- import "../../chunk-4ZJFD3L3.mjs";
10
9
  import "../../chunk-27Y6K5NK.mjs";
10
+ import "../../chunk-4ZJFD3L3.mjs";
11
11
  import "../../chunk-AC6TWLRT.mjs";
12
12
  export {
13
13
  Tree,
package/dist/index.d.mts CHANGED
@@ -26,6 +26,7 @@ export { ToastProvider, useToast } from './components/toast/use-toast.mjs';
26
26
  export { default as DateTimePicker } from './components/dateTimePicker/dateTimePicker.mjs';
27
27
  export { default as ScrollArea } from './components/scroll/scrollArea.mjs';
28
28
  export { default as Tree, TreeNode } from './components/tree/tree.mjs';
29
+ export { default as FileUpload } from './components/fileUpload/fileUpload.mjs';
29
30
  export { tv } from './utils/tailwind-variants.mjs';
30
31
  export { deepnoidUi } from '@deepnoid/tailwind-config';
31
32
  export { VariantProps } from 'tailwind-variants';
package/dist/index.d.ts CHANGED
@@ -26,6 +26,7 @@ export { ToastProvider, useToast } from './components/toast/use-toast.js';
26
26
  export { default as DateTimePicker } from './components/dateTimePicker/dateTimePicker.js';
27
27
  export { default as ScrollArea } from './components/scroll/scrollArea.js';
28
28
  export { default as Tree, TreeNode } from './components/tree/tree.js';
29
+ export { default as FileUpload } from './components/fileUpload/fileUpload.js';
29
30
  export { tv } from './utils/tailwind-variants.js';
30
31
  export { deepnoidUi } from '@deepnoid/tailwind-config';
31
32
  export { VariantProps } from 'tailwind-variants';
package/dist/index.js CHANGED
@@ -111,6 +111,7 @@ __export(index_exports, {
111
111
  Chip: () => chip_default,
112
112
  DateTimePicker: () => dateTimePicker_default,
113
113
  DefinitionTable: () => definition_table_default,
114
+ FileUpload: () => fileUpload_default,
114
115
  Icon: () => Icon_default,
115
116
  IconButton: () => icon_button_default,
116
117
  Input: () => input_default,
@@ -5957,9 +5958,10 @@ var Input = (0, import_react9.forwardRef)((originalProps, ref) => {
5957
5958
  {
5958
5959
  ...inputProps,
5959
5960
  ref: ref || inputRef,
5961
+ readOnly: props.readOnly,
5960
5962
  className: clsx(
5961
5963
  slots.input({ class: classNames == null ? void 0 : classNames.input }),
5962
- inputProps.readOnly ? "!text-body-foreground placeholder:text-body-foreground" : ""
5964
+ inputProps.readOnly ? "!text-body-foreground placeholder:!text-body-foreground" : ""
5963
5965
  ),
5964
5966
  size: 0
5965
5967
  }
@@ -10006,7 +10008,7 @@ var dateTimePickerStyle = tv({
10006
10008
  var import_react34 = require("react");
10007
10009
  var import_jsx_runtime34 = require("react/jsx-runtime");
10008
10010
  var TreeNodeItem = (0, import_react34.forwardRef)(
10009
- ({ node, depth, fileIcon, isLoading, classNames, onExpand }, ref) => {
10011
+ ({ node, depth, fileIcon, selectedId, isLoading, classNames, onExpand }, ref) => {
10010
10012
  const [isOpen, setIsOpen] = (0, import_react34.useState)(false);
10011
10013
  const [children, setChildren] = (0, import_react34.useState)(node.children);
10012
10014
  const [isLoadingChildren, setIsLoadingChildren] = (0, import_react34.useState)(false);
@@ -10030,10 +10032,10 @@ var TreeNodeItem = (0, import_react34.forwardRef)(
10030
10032
  }
10031
10033
  setIsOpen((prev) => !prev);
10032
10034
  }, [isOpen, children, onExpand, node]);
10033
- const handleClick = () => {
10035
+ const handleClick = (e) => {
10034
10036
  var _a;
10035
10037
  toggleOpen();
10036
- (_a = node.onClick) == null ? void 0 : _a.call(node);
10038
+ (_a = node.onClick) == null ? void 0 : _a.call(node, e);
10037
10039
  };
10038
10040
  const handleRightClick = (e) => {
10039
10041
  var _a;
@@ -10054,7 +10056,7 @@ var TreeNodeItem = (0, import_react34.forwardRef)(
10054
10056
  /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
10055
10057
  "div",
10056
10058
  {
10057
- className: slots.group({ class: classNames == null ? void 0 : classNames.group }),
10059
+ className: clsx(slots.node({ class: classNames == null ? void 0 : classNames.node }), selectedId == node.id ? "bg-neutral-soft" : ""),
10058
10060
  onClick: handleClick,
10059
10061
  onContextMenu: handleRightClick,
10060
10062
  children: [
@@ -10080,6 +10082,7 @@ var TreeNodeItem = (0, import_react34.forwardRef)(
10080
10082
  {
10081
10083
  node: child,
10082
10084
  depth: depth + 1,
10085
+ selectedId,
10083
10086
  classNames,
10084
10087
  fileIcon,
10085
10088
  onExpand
@@ -10098,44 +10101,27 @@ var Tree = ({
10098
10101
  group,
10099
10102
  groupIcon,
10100
10103
  fileIcon,
10104
+ selectedId,
10101
10105
  isLoading = false,
10102
10106
  classNames,
10103
10107
  onExpand
10104
10108
  }) => {
10105
10109
  const slots = (0, import_react34.useMemo)(() => treeStyle(), []);
10106
- const [isOpen, setIsOpen] = (0, import_react34.useState)(true);
10107
- const handleToggle = () => {
10108
- var _a;
10109
- setIsOpen((prev) => !prev);
10110
- (_a = group.onClick) == null ? void 0 : _a.call(group);
10111
- };
10112
- const handleRightClick = (e) => {
10113
- var _a;
10114
- e.preventDefault();
10115
- (_a = group.onRightClick) == null ? void 0 : _a.call(group, e);
10116
- };
10117
10110
  return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: slots.base({ class: classNames == null ? void 0 : classNames.base }), children: [
10118
10111
  headerContent && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { children: headerContent }),
10119
10112
  /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: slots.wrapper({ class: classNames == null ? void 0 : classNames.wrapper }), children: [
10120
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
10121
- "div",
10122
- {
10123
- className: slots.group({ class: classNames == null ? void 0 : classNames.group }),
10124
- onClick: handleToggle,
10125
- onContextMenu: handleRightClick,
10126
- children: [
10127
- groupIcon,
10128
- group.label
10129
- ]
10130
- }
10131
- ),
10132
- isOpen && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { children: group.data.map((node) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
10113
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: slots.group({ class: classNames == null ? void 0 : classNames.group }), children: [
10114
+ groupIcon,
10115
+ group.label
10116
+ ] }),
10117
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { children: group.data.map((node) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
10133
10118
  TreeNodeItem,
10134
10119
  {
10135
10120
  node,
10136
10121
  depth: 1,
10137
10122
  classNames,
10138
10123
  fileIcon,
10124
+ selectedId,
10139
10125
  isLoading,
10140
10126
  onExpand
10141
10127
  },
@@ -10150,7 +10136,8 @@ var treeStyle = tv({
10150
10136
  slots: {
10151
10137
  base: ["border", "border-neutral-light", "rounded-xl", "p-[20px]", "flex", "flex-col", "gap-[20px]", "select-none"],
10152
10138
  wrapper: ["flex", "flex-col", "gap-[5px]"],
10153
- group: [
10139
+ group: ["flex", "items-center", "gap-[5px]", "text-md", "font-bold", "text-body-foreground", "p-[5px]"],
10140
+ node: [
10154
10141
  "flex",
10155
10142
  "items-center",
10156
10143
  "gap-[5px]",
@@ -10164,6 +10151,122 @@ var treeStyle = tv({
10164
10151
  ]
10165
10152
  }
10166
10153
  });
10154
+
10155
+ // src/components/fileUpload/fileUpload.tsx
10156
+ var import_react35 = require("react");
10157
+ var import_tailwind_variants29 = require("tailwind-variants");
10158
+ var import_jsx_runtime35 = require("react/jsx-runtime");
10159
+ function FileUpload({
10160
+ buttonText,
10161
+ maxSizeMB = 10,
10162
+ placeholder,
10163
+ accept = [],
10164
+ acceptErrorMessage = "The file type is not allowed.",
10165
+ sizeErrorMessage = `File is too large.`,
10166
+ onFileUpload,
10167
+ helperMessage,
10168
+ showProgress,
10169
+ classNames
10170
+ }) {
10171
+ const fileInputRef = (0, import_react35.useRef)(null);
10172
+ const uploadIntervalRef = (0, import_react35.useRef)(null);
10173
+ const [file, setFile] = (0, import_react35.useState)(null);
10174
+ const [uploadProgress, setUploadProgress] = (0, import_react35.useState)(0);
10175
+ const [errorMessage, setErrorMessage] = (0, import_react35.useState)("");
10176
+ const slots = fileUploadStyle();
10177
+ const handleButtonClick = () => {
10178
+ var _a;
10179
+ (_a = fileInputRef.current) == null ? void 0 : _a.click();
10180
+ };
10181
+ const validateFile = (file2) => {
10182
+ if (accept.length && !accept.includes(file2.type)) {
10183
+ return acceptErrorMessage;
10184
+ }
10185
+ const sizeMB = file2.size / 1024 / 1024;
10186
+ if (sizeMB > maxSizeMB) {
10187
+ return `${sizeErrorMessage} (${maxSizeMB}MB)`;
10188
+ }
10189
+ return null;
10190
+ };
10191
+ const startUploadSimulation = (file2) => {
10192
+ let progress = 0;
10193
+ setUploadProgress(0);
10194
+ uploadIntervalRef.current = window.setInterval(() => {
10195
+ progress += 10;
10196
+ setUploadProgress(progress);
10197
+ if (progress >= 100) {
10198
+ clearInterval(uploadIntervalRef.current);
10199
+ onFileUpload == null ? void 0 : onFileUpload(file2);
10200
+ }
10201
+ }, 100);
10202
+ };
10203
+ const handleFileChange = (e) => {
10204
+ var _a;
10205
+ const selectedFile = (_a = e.target.files) == null ? void 0 : _a[0];
10206
+ if (!selectedFile) return;
10207
+ const error = validateFile(selectedFile);
10208
+ if (error) {
10209
+ setErrorMessage(error);
10210
+ setFile(null);
10211
+ return;
10212
+ }
10213
+ setFile(selectedFile);
10214
+ setErrorMessage("");
10215
+ startUploadSimulation(selectedFile);
10216
+ };
10217
+ const handleCancelUpload = () => {
10218
+ if (uploadIntervalRef.current) {
10219
+ clearInterval(uploadIntervalRef.current);
10220
+ }
10221
+ setFile(null);
10222
+ setUploadProgress(0);
10223
+ setErrorMessage("");
10224
+ };
10225
+ (0, import_react35.useEffect)(() => {
10226
+ return () => {
10227
+ if (uploadIntervalRef.current) {
10228
+ clearInterval(uploadIntervalRef.current);
10229
+ }
10230
+ };
10231
+ }, []);
10232
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: slots.base({ class: classNames == null ? void 0 : classNames.base }), children: [
10233
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: slots.container({ class: classNames == null ? void 0 : classNames.container }), children: [
10234
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: slots.inputWrapper(), children: [
10235
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(input_default, { name: "file", readOnly: true, variant: "outline", full: true, placeholder, defaultValue: file == null ? void 0 : file.name }),
10236
+ file && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
10237
+ icon_button_default,
10238
+ {
10239
+ name: "close",
10240
+ variant: "ghost",
10241
+ color: "neutral",
10242
+ onClick: handleCancelUpload,
10243
+ classNames: { base: slots.cancelButton() },
10244
+ "aria-label": "cancel"
10245
+ }
10246
+ )
10247
+ ] }),
10248
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(button_default, { type: "button", variant: "outline", onClick: handleButtonClick, children: buttonText }),
10249
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("input", { ref: fileInputRef, type: "file", hidden: true, accept: accept.join(","), onChange: handleFileChange })
10250
+ ] }),
10251
+ showProgress && file && uploadProgress < 100 && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: slots.progressBarContainer(), children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: slots.progressBar(), style: { width: `${uploadProgress}%` } }) }),
10252
+ !errorMessage && helperMessage && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("p", { className: slots.helperMessage(), children: helperMessage }),
10253
+ errorMessage && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("p", { className: slots.errorMessage(), children: errorMessage })
10254
+ ] });
10255
+ }
10256
+ FileUpload.displayName = "FileUpload";
10257
+ var fileUpload_default = FileUpload;
10258
+ var fileUploadStyle = (0, import_tailwind_variants29.tv)({
10259
+ slots: {
10260
+ base: ["flex", "flex-col", "gap-[5px]"],
10261
+ container: ["flex", "items-center", "gap-[10px]"],
10262
+ inputWrapper: ["relative", "flex-1"],
10263
+ cancelButton: ["absolute", "top-1/2", "right-0", "-translate-y-1/2"],
10264
+ progressBarContainer: ["w-full", "h-[5px]", "bg-neutral-light", "rounded-full", "overflow-hidden"],
10265
+ progressBar: ["h-full", "bg-primary-main", "transition-all"],
10266
+ errorMessage: ["text-danger-main", "text-sm"],
10267
+ helperMessage: ["text-neutral-main", "text-sm"]
10268
+ }
10269
+ });
10167
10270
  // Annotate the CommonJS export names for ESM import in node:
10168
10271
  0 && (module.exports = {
10169
10272
  Avatar,
@@ -10175,6 +10278,7 @@ var treeStyle = tv({
10175
10278
  Chip,
10176
10279
  DateTimePicker,
10177
10280
  DefinitionTable,
10281
+ FileUpload,
10178
10282
  Icon,
10179
10283
  IconButton,
10180
10284
  Input,