@deepnoid/ui 0.1.25 → 0.1.27

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 (62) hide show
  1. package/.turbo/turbo-build.log +149 -145
  2. package/dist/chunk-6TIIBU7J.mjs +35 -0
  3. package/dist/{chunk-IVK24VIL.mjs → chunk-C7OF5HJF.mjs} +1 -1
  4. package/dist/{chunk-MSAULFDB.mjs → chunk-E4UUZOR4.mjs} +16 -16
  5. package/dist/{chunk-P5PJTJLY.mjs → chunk-GRA2LU42.mjs} +18 -18
  6. package/dist/{chunk-Y27H2AMV.mjs → chunk-IRAHS4WS.mjs} +2 -2
  7. package/dist/chunk-PX4PFLJ3.mjs +178 -0
  8. package/dist/{chunk-EAK5DVWA.mjs → chunk-UNH3BCGN.mjs} +8 -1
  9. package/dist/{chunk-6EU5GUL5.mjs → chunk-XA6PVFTW.mjs} +5 -5
  10. package/dist/components/breadcrumb/breadcrumb.js +2 -2
  11. package/dist/components/breadcrumb/breadcrumb.mjs +1 -1
  12. package/dist/components/breadcrumb/index.js +2 -2
  13. package/dist/components/breadcrumb/index.mjs +1 -1
  14. package/dist/components/input/index.js +18 -18
  15. package/dist/components/input/index.mjs +1 -1
  16. package/dist/components/input/input.d.mts +44 -44
  17. package/dist/components/input/input.d.ts +44 -44
  18. package/dist/components/input/input.js +18 -18
  19. package/dist/components/input/input.mjs +1 -1
  20. package/dist/components/pagination/index.js +18 -18
  21. package/dist/components/pagination/index.mjs +2 -2
  22. package/dist/components/pagination/pagination.js +18 -18
  23. package/dist/components/pagination/pagination.mjs +2 -2
  24. package/dist/components/select/index.js +16 -16
  25. package/dist/components/select/index.mjs +1 -1
  26. package/dist/components/select/select.d.mts +38 -38
  27. package/dist/components/select/select.d.ts +38 -38
  28. package/dist/components/select/select.js +16 -16
  29. package/dist/components/select/select.mjs +1 -1
  30. package/dist/components/table/definition-table.d.mts +51 -0
  31. package/dist/components/table/definition-table.d.ts +51 -0
  32. package/dist/components/table/definition-table.js +351 -0
  33. package/dist/components/table/definition-table.mjs +9 -0
  34. package/dist/components/table/form-table.d.mts +1 -1
  35. package/dist/components/table/form-table.d.ts +1 -1
  36. package/dist/components/table/form-table.mjs +43 -3
  37. package/dist/components/table/index.d.mts +1 -1
  38. package/dist/components/table/index.d.ts +1 -1
  39. package/dist/components/table/index.js +40 -47
  40. package/dist/components/table/index.mjs +9 -9
  41. package/dist/components/table/table-head.js +8 -1
  42. package/dist/components/table/table-head.mjs +1 -1
  43. package/dist/components/table/table.js +26 -19
  44. package/dist/components/table/table.mjs +5 -5
  45. package/dist/components/toast/index.mjs +2 -2
  46. package/dist/components/toast/use-toast.mjs +2 -2
  47. package/dist/components/tree/index.d.mts +1 -0
  48. package/dist/components/tree/index.d.ts +1 -0
  49. package/dist/components/tree/index.js +138 -60
  50. package/dist/components/tree/index.mjs +1 -1
  51. package/dist/components/tree/tree.d.mts +17 -10
  52. package/dist/components/tree/tree.d.ts +17 -10
  53. package/dist/components/tree/tree.js +143 -60
  54. package/dist/components/tree/tree.mjs +3 -1
  55. package/dist/index.d.mts +1 -1
  56. package/dist/index.d.ts +1 -1
  57. package/dist/index.js +196 -125
  58. package/dist/index.mjs +31 -31
  59. package/package.json +1 -1
  60. package/dist/chunk-ICZTNO4V.mjs +0 -49
  61. package/dist/chunk-K4QY2F5J.mjs +0 -99
  62. package/dist/{chunk-UAHTRCKG.mjs → chunk-YBDA3WQP.mjs} +3 -3
@@ -1,20 +1,20 @@
1
1
  "use client";
2
2
  import "../../chunk-DX3KXNP6.mjs";
3
- import {
4
- form_table_default
5
- } from "../../chunk-ICZTNO4V.mjs";
6
3
  import {
7
4
  table_default
8
- } from "../../chunk-6EU5GUL5.mjs";
5
+ } from "../../chunk-XA6PVFTW.mjs";
6
+ import "../../chunk-XRC5OUYQ.mjs";
7
+ import "../../chunk-UNH3BCGN.mjs";
9
8
  import "../../chunk-DQRAFUDA.mjs";
10
9
  import "../../chunk-M37VBNB3.mjs";
11
- import "../../chunk-XRC5OUYQ.mjs";
12
- import "../../chunk-EAK5DVWA.mjs";
10
+ import {
11
+ definition_table_default
12
+ } from "../../chunk-6TIIBU7J.mjs";
13
13
  import "../../chunk-7B7LRG5J.mjs";
14
- import "../../chunk-IVK24VIL.mjs";
14
+ import "../../chunk-C7OF5HJF.mjs";
15
15
  import "../../chunk-F3HENRVM.mjs";
16
16
  import "../../chunk-2GCSFWHD.mjs";
17
- import "../../chunk-P5PJTJLY.mjs";
17
+ import "../../chunk-GRA2LU42.mjs";
18
18
  import "../../chunk-QZ3LVYJW.mjs";
19
19
  import "../../chunk-D6QI3DJG.mjs";
20
20
  import "../../chunk-ZYIIXWVY.mjs";
@@ -25,6 +25,6 @@ import "../../chunk-27Y6K5NK.mjs";
25
25
  import "../../chunk-E3G5QXSH.mjs";
26
26
  import "../../chunk-AC6TWLRT.mjs";
27
27
  export {
28
- form_table_default as FormTable,
28
+ definition_table_default as DefinitionTable,
29
29
  table_default as Table
30
30
  };
@@ -613,7 +613,14 @@ var TableHead = ({ columns, slots, size, rowCheckbox, isCheckedAll, classNames,
613
613
  },
614
614
  `${column.field}${index}thead`
615
615
  ));
616
- const renderSelectAllCheckbox = () => rowCheckbox && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("th", { className: slots.th({ class: classNames == null ? void 0 : classNames.th }), onClick: handleClickCheckAll, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(checkbox_default, { size, checked: isCheckedAll }) }) });
616
+ const renderSelectAllCheckbox = () => rowCheckbox && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("th", { className: slots.th({ class: classNames == null ? void 0 : classNames.th }), onClick: handleClickCheckAll, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
617
+ checkbox_default,
618
+ {
619
+ size,
620
+ checked: isCheckedAll,
621
+ onChange: (e) => onCheckAll(e.target.checked)
622
+ }
623
+ ) }) });
617
624
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("thead", { className: slots.thead({ class: classNames == null ? void 0 : classNames.thead }), children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("tr", { className: slots.tr({ class: classNames == null ? void 0 : classNames.tr }), children: [
618
625
  renderColumnHeaders(),
619
626
  renderSelectAllCheckbox()
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import {
3
3
  table_head_default
4
- } from "../../chunk-EAK5DVWA.mjs";
4
+ } from "../../chunk-UNH3BCGN.mjs";
5
5
  import "../../chunk-QZ3LVYJW.mjs";
6
6
  import "../../chunk-D6QI3DJG.mjs";
7
7
  import "../../chunk-4ZJFD3L3.mjs";
@@ -615,7 +615,14 @@ var TableHead = ({ columns, slots, size, rowCheckbox, isCheckedAll, classNames,
615
615
  },
616
616
  `${column.field}${index}thead`
617
617
  ));
618
- const renderSelectAllCheckbox = () => rowCheckbox && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("th", { className: slots.th({ class: classNames == null ? void 0 : classNames.th }), onClick: handleClickCheckAll, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(checkbox_default, { size, checked: isCheckedAll }) }) });
618
+ const renderSelectAllCheckbox = () => rowCheckbox && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("th", { className: slots.th({ class: classNames == null ? void 0 : classNames.th }), onClick: handleClickCheckAll, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
619
+ checkbox_default,
620
+ {
621
+ size,
622
+ checked: isCheckedAll,
623
+ onChange: (e) => onCheckAll(e.target.checked)
624
+ }
625
+ ) }) });
619
626
  return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("thead", { className: slots.thead({ class: classNames == null ? void 0 : classNames.thead }), children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("tr", { className: slots.tr({ class: classNames == null ? void 0 : classNames.tr }), children: [
620
627
  renderColumnHeaders(),
621
628
  renderSelectAllCheckbox()
@@ -4711,7 +4718,7 @@ var Icon_default = Icon;
4711
4718
  var import_jsx_runtime6 = require("react/jsx-runtime");
4712
4719
  var Input = (0, import_react5.forwardRef)((originalProps, ref) => {
4713
4720
  const [props, variantProps] = mapPropsVariants(originalProps, inputStyle.variantKeys);
4714
- const { classNames, label, helperText, errorText, startContent, endContent, ...inputProps } = props;
4721
+ const { classNames, label, helperMessage, errorMessage, startContent, endContent, ...inputProps } = props;
4715
4722
  const inputRef = (0, import_react5.useRef)(null);
4716
4723
  const slots = (0, import_react5.useMemo)(() => inputStyle({ ...variantProps }), [variantProps]);
4717
4724
  const getContentProps = (0, import_react5.useCallback)(
@@ -4754,7 +4761,7 @@ var Input = (0, import_react5.forwardRef)((originalProps, ref) => {
4754
4761
  className: `${getContentProps().className || ""} ${existingProps.className || ""}`.trim()
4755
4762
  };
4756
4763
  return import_react5.default.cloneElement(endContent, mergedProps);
4757
- } else if (errorText) {
4764
+ } else if (errorMessage) {
4758
4765
  const iconProps = { ...getContentProps(), className: getContentProps().className };
4759
4766
  return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { ...iconProps, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Icon_default, { name: "exclamation-circle", fill: true, size: originalProps.size }) });
4760
4767
  } else {
@@ -4808,8 +4815,8 @@ var Input = (0, import_react5.forwardRef)((originalProps, ref) => {
4808
4815
  ]
4809
4816
  }
4810
4817
  ),
4811
- helperText && !errorText && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: slots.helperText({ class: classNames == null ? void 0 : classNames.helperText }), children: helperText }),
4812
- errorText && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: clsx("error", slots.errorText({ class: classNames == null ? void 0 : classNames.errorText })), children: errorText })
4818
+ helperMessage && !errorMessage && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: slots.helperMessage({ class: classNames == null ? void 0 : classNames.helperMessage }), children: helperMessage }),
4819
+ errorMessage && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: clsx("error", slots.errorMessage({ class: classNames == null ? void 0 : classNames.errorMessage })), children: errorMessage })
4813
4820
  ] })
4814
4821
  ]
4815
4822
  }
@@ -4849,8 +4856,8 @@ var inputStyle = tv(
4849
4856
  "group-has-[:hover]/input:text-neutral-dark",
4850
4857
  "group-has-[p.error]/input:text-danger-main"
4851
4858
  ],
4852
- helperText: ["text-neutral-main", "group-has-[:hover]/input:text-neutral-dark"],
4853
- errorText: ["text-danger-main"],
4859
+ helperMessage: ["text-neutral-main", "group-has-[:hover]/input:text-neutral-dark"],
4860
+ errorMessage: ["text-danger-main"],
4854
4861
  readonly: ["pointer-events-none", "!text-body-foreground"]
4855
4862
  },
4856
4863
  variants: {
@@ -4885,7 +4892,7 @@ var inputStyle = tv(
4885
4892
  "group-has-[:focus]/input:text-primary-main",
4886
4893
  "!group-has-[p.error]:not(input:focus):hover/input:text-primary-main"
4887
4894
  ],
4888
- helperText: [
4895
+ helperMessage: [
4889
4896
  "group-has-[:focus]/input:text-primary-main",
4890
4897
  "group-has-[:focus:hover]/input:text-primary-main",
4891
4898
  "group-has-[:focus]/input:hover:text-primary-main"
@@ -4896,7 +4903,7 @@ var inputStyle = tv(
4896
4903
  "group-has-[:focus]/input:text-secondary-main",
4897
4904
  "!group-has-[p.error]:not(input:focus):hover/input:text-secondary-main"
4898
4905
  ],
4899
- helperText: [
4906
+ helperMessage: [
4900
4907
  "group-has-[:focus]/input:text-secondary-main",
4901
4908
  "group-has-[:focus:hover]/input:text-secondary-main",
4902
4909
  "group-has-[:focus]/input:hover:text-secondary-main"
@@ -4909,32 +4916,32 @@ var inputStyle = tv(
4909
4916
  label: ["text-sm"],
4910
4917
  innerWrapper: ["gap-[4px]"],
4911
4918
  inputWrapper: ["w-[240px]", "h-[24px]", "rounded-sm", "px-[4px]", "gap-[4px]"],
4912
- helperText: ["text-sm"],
4913
- errorText: ["text-sm"]
4919
+ helperMessage: ["text-sm"],
4920
+ errorMessage: ["text-sm"]
4914
4921
  },
4915
4922
  md: {
4916
4923
  base: ["text-md", "gap-[6px]"],
4917
4924
  label: ["text-md"],
4918
4925
  innerWrapper: ["gap-[6px]"],
4919
4926
  inputWrapper: ["w-[240px]", "h-[32px]", "rounded-md", "px-[6px]", "gap-[6px]"],
4920
- helperText: ["text-sm"],
4921
- errorText: ["text-sm"]
4927
+ helperMessage: ["text-sm"],
4928
+ errorMessage: ["text-sm"]
4922
4929
  },
4923
4930
  lg: {
4924
4931
  base: ["text-lg", "gap-[8px]"],
4925
4932
  label: ["text-lg"],
4926
4933
  innerWrapper: ["gap-[8px]"],
4927
4934
  inputWrapper: ["w-[240px]", "h-[40px]", "rounded-lg", "px-[8px]", "gap-[8px]"],
4928
- helperText: ["text-md"],
4929
- errorText: ["text-md"]
4935
+ helperMessage: ["text-md"],
4936
+ errorMessage: ["text-md"]
4930
4937
  },
4931
4938
  xl: {
4932
4939
  base: ["text-xl", "gap-[10px]"],
4933
4940
  label: ["text-xl"],
4934
4941
  innerWrapper: ["gap-[10px]"],
4935
4942
  inputWrapper: ["w-[240px]", "h-[50px]", "rounded-lg", "px-[10px]", "gap-[10px]"],
4936
- helperText: ["text-md"],
4937
- errorText: ["text-md"]
4943
+ helperMessage: ["text-md"],
4944
+ errorMessage: ["text-md"]
4938
4945
  }
4939
4946
  },
4940
4947
  direction: {
@@ -4958,8 +4965,8 @@ var inputStyle = tv(
4958
4965
  "group-has-[p.error]/input:placeholder:text-danger-light"
4959
4966
  ],
4960
4967
  content: ["text-neutral-light", "group-has-[p.error]/input:text-danger-light"],
4961
- helperText: ["!text-neutral-light"],
4962
- errorText: ["!text-danger-light"]
4968
+ helperMessage: ["!text-neutral-light"],
4969
+ errorMessage: ["!text-danger-light"]
4963
4970
  }
4964
4971
  }
4965
4972
  },
@@ -1,16 +1,16 @@
1
1
  "use client";
2
2
  import {
3
3
  table_default
4
- } from "../../chunk-6EU5GUL5.mjs";
4
+ } from "../../chunk-XA6PVFTW.mjs";
5
+ import "../../chunk-XRC5OUYQ.mjs";
6
+ import "../../chunk-UNH3BCGN.mjs";
5
7
  import "../../chunk-DQRAFUDA.mjs";
6
8
  import "../../chunk-M37VBNB3.mjs";
7
- import "../../chunk-XRC5OUYQ.mjs";
8
- import "../../chunk-EAK5DVWA.mjs";
9
9
  import "../../chunk-7B7LRG5J.mjs";
10
- import "../../chunk-IVK24VIL.mjs";
10
+ import "../../chunk-C7OF5HJF.mjs";
11
11
  import "../../chunk-F3HENRVM.mjs";
12
12
  import "../../chunk-2GCSFWHD.mjs";
13
- import "../../chunk-P5PJTJLY.mjs";
13
+ import "../../chunk-GRA2LU42.mjs";
14
14
  import "../../chunk-QZ3LVYJW.mjs";
15
15
  import "../../chunk-D6QI3DJG.mjs";
16
16
  import "../../chunk-ZYIIXWVY.mjs";
@@ -3,11 +3,11 @@ import "../../chunk-LUWGOKLG.mjs";
3
3
  import {
4
4
  ToastProvider,
5
5
  useToast
6
- } from "../../chunk-UAHTRCKG.mjs";
6
+ } from "../../chunk-YBDA3WQP.mjs";
7
+ import "../../chunk-ZOTHPHXA.mjs";
7
8
  import {
8
9
  toast_default
9
10
  } from "../../chunk-OUAKGMDW.mjs";
10
- import "../../chunk-ZOTHPHXA.mjs";
11
11
  import "../../chunk-ZYIIXWVY.mjs";
12
12
  import "../../chunk-HWL7TPUN.mjs";
13
13
  import "../../chunk-3IU2RPSM.mjs";
@@ -2,9 +2,9 @@
2
2
  import {
3
3
  ToastProvider,
4
4
  useToast
5
- } from "../../chunk-UAHTRCKG.mjs";
6
- import "../../chunk-OUAKGMDW.mjs";
5
+ } from "../../chunk-YBDA3WQP.mjs";
7
6
  import "../../chunk-ZOTHPHXA.mjs";
7
+ import "../../chunk-OUAKGMDW.mjs";
8
8
  import "../../chunk-ZYIIXWVY.mjs";
9
9
  import "../../chunk-HWL7TPUN.mjs";
10
10
  import "../../chunk-3IU2RPSM.mjs";
@@ -1,5 +1,6 @@
1
1
  export { default as Tree, TreeNode } from './tree.mjs';
2
2
  import 'tailwind-variants';
3
3
  import 'tailwind-merge';
4
+ import 'react/jsx-runtime';
4
5
  import 'react';
5
6
  import '../../utils/types.mjs';
@@ -1,5 +1,6 @@
1
1
  export { default as Tree, TreeNode } from './tree.js';
2
2
  import 'tailwind-variants';
3
3
  import 'tailwind-merge';
4
+ import 'react/jsx-runtime';
4
5
  import 'react';
5
6
  import '../../utils/types.js';
@@ -4338,74 +4338,152 @@ function toVal(mix) {
4338
4338
 
4339
4339
  // src/components/tree/tree.tsx
4340
4340
  var import_jsx_runtime3 = require("react/jsx-runtime");
4341
- var TreeNodeItem = (0, import_react.forwardRef)(({ node, depth, fileIcon, isLoading, classNames }) => {
4342
- var _a;
4343
- const [isOpen, setIsOpen] = (0, import_react.useState)(false);
4344
- const slots = (0, import_react.useMemo)(() => treeStyle(), []);
4345
- const toggleOpen = (0, import_react.useCallback)(() => {
4346
- setIsOpen((prev) => !prev);
4347
- }, []);
4348
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
4349
- "div",
4350
- {
4351
- className: clsx(
4352
- depth > 1 ? "ml-[30px]" : "",
4353
- "transition-all duration-150 ease-out",
4354
- isLoading ? "-translate-y-2 opacity-0" : "translate-y-0 opacity-100"
4355
- ),
4356
- children: [
4357
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: slots.wrapper({ class: classNames == null ? void 0 : classNames.wrapper }), onClick: toggleOpen, children: [
4358
- node.children && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
4359
- Icon_default,
4341
+ var TreeNodeItem = (0, import_react.forwardRef)(
4342
+ ({ node, depth, fileIcon, isLoading, classNames, onExpand }, ref) => {
4343
+ const [isOpen, setIsOpen] = (0, import_react.useState)(false);
4344
+ const [children, setChildren] = (0, import_react.useState)(node.children);
4345
+ const [isLoadingChildren, setIsLoadingChildren] = (0, import_react.useState)(false);
4346
+ const slots = (0, import_react.useMemo)(() => treeStyle(), []);
4347
+ const hasMore = (0, import_react.useMemo)(() => {
4348
+ if (node.isLeaf) return false;
4349
+ if (Array.isArray(children)) return children.length > 0;
4350
+ return typeof onExpand === "function";
4351
+ }, [node.isLeaf, children, onExpand]);
4352
+ const toggleOpen = (0, import_react.useCallback)(async () => {
4353
+ if (!isOpen && !children && onExpand && !node.isLeaf) {
4354
+ setIsLoadingChildren(true);
4355
+ try {
4356
+ const result = await onExpand(node);
4357
+ setChildren(result);
4358
+ } catch (e) {
4359
+ console.error("Failed to load child nodes ", e);
4360
+ } finally {
4361
+ setIsLoadingChildren(false);
4362
+ }
4363
+ }
4364
+ setIsOpen((prev) => !prev);
4365
+ }, [isOpen, children, onExpand, node]);
4366
+ const handleClick = () => {
4367
+ var _a;
4368
+ toggleOpen();
4369
+ (_a = node.onClick) == null ? void 0 : _a.call(node);
4370
+ };
4371
+ const handleRightClick = (e) => {
4372
+ var _a;
4373
+ e.preventDefault();
4374
+ (_a = node.onRightClick) == null ? void 0 : _a.call(node, e);
4375
+ };
4376
+ const marginClass = depth > 1 ? hasMore ? "ml-[30px]" : "ml-[55px]" : hasMore ? "" : "ml-[25px]";
4377
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
4378
+ "div",
4379
+ {
4380
+ ref,
4381
+ className: clsx(
4382
+ marginClass,
4383
+ "transition-all duration-150 ease-out",
4384
+ isLoading ? "-translate-y-2 opacity-0" : "translate-y-0 opacity-100"
4385
+ ),
4386
+ children: [
4387
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
4388
+ "div",
4360
4389
  {
4361
- name: "right-chevron",
4362
- className: `text-neutral-main cursor-pointer transition-transform duration-150 ${isOpen ? "rotate-90" : "rotate-0"}`
4390
+ className: slots.group({ class: classNames == null ? void 0 : classNames.group }),
4391
+ onClick: handleClick,
4392
+ onContextMenu: handleRightClick,
4393
+ children: [
4394
+ hasMore && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
4395
+ Icon_default,
4396
+ {
4397
+ name: "right-chevron",
4398
+ className: clsx(
4399
+ "text-neutral-main cursor-pointer transition-transform duration-150",
4400
+ isOpen ? "rotate-90" : "rotate-0"
4401
+ )
4402
+ }
4403
+ ),
4404
+ fileIcon,
4405
+ node.label
4406
+ ]
4363
4407
  }
4364
4408
  ),
4365
- fileIcon,
4366
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: slots.label({ class: classNames == null ? void 0 : classNames.label }), onClick: () => {
4367
- var _a2;
4368
- return (_a2 = node.onClick) == null ? void 0 : _a2.call(node);
4369
- }, children: node.label })
4370
- ] }),
4371
- isOpen && ((_a = node.children) == null ? void 0 : _a.map((child) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(TreeNodeItem, { node: child, depth: depth + 1, classNames, fileIcon }, child.id)))
4372
- ]
4373
- }
4374
- );
4375
- });
4376
- var Tree = (0, import_react.forwardRef)(
4377
- ({ headerContent, group, groupIcon, fileIcon, isLoading, classNames }) => {
4378
- const { label, data, onClick } = group;
4379
- const slots = (0, import_react.useMemo)(() => treeStyle(), []);
4380
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: slots.base({ class: classNames == null ? void 0 : classNames.base }), children: [
4381
- headerContent && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { children: headerContent }),
4382
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { children: [
4383
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: slots.wrapper({ class: classNames == null ? void 0 : classNames.wrapper }), children: [
4384
- groupIcon,
4385
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: slots.label({ class: classNames == null ? void 0 : classNames.label }), onClick, children: label })
4386
- ] }),
4387
- data.map((node) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
4388
- TreeNodeItem,
4389
- {
4390
- node,
4391
- depth: 1,
4392
- classNames,
4393
- fileIcon,
4394
- isLoading
4395
- },
4396
- node.id
4397
- ))
4398
- ] })
4399
- ] });
4409
+ isOpen && /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { children: [
4410
+ isLoadingChildren && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "text-neutral py-1 text-sm", children: "loading..." }),
4411
+ children == null ? void 0 : children.map((child) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
4412
+ TreeNodeItem,
4413
+ {
4414
+ node: child,
4415
+ depth: depth + 1,
4416
+ classNames,
4417
+ fileIcon,
4418
+ onExpand
4419
+ },
4420
+ child.id
4421
+ ))
4422
+ ] })
4423
+ ]
4424
+ }
4425
+ );
4400
4426
  }
4401
4427
  );
4402
4428
  TreeNodeItem.displayName = "TreeNodeItem";
4429
+ var Tree = ({
4430
+ headerContent,
4431
+ group,
4432
+ groupIcon,
4433
+ fileIcon,
4434
+ isLoading = false,
4435
+ classNames,
4436
+ onExpand
4437
+ }) => {
4438
+ const slots = (0, import_react.useMemo)(() => treeStyle(), []);
4439
+ const [isOpen, setIsOpen] = (0, import_react.useState)(true);
4440
+ const handleToggle = () => {
4441
+ var _a;
4442
+ setIsOpen((prev) => !prev);
4443
+ (_a = group.onClick) == null ? void 0 : _a.call(group);
4444
+ };
4445
+ const handleRightClick = (e) => {
4446
+ var _a;
4447
+ e.preventDefault();
4448
+ (_a = group.onRightClick) == null ? void 0 : _a.call(group, e);
4449
+ };
4450
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: slots.base({ class: classNames == null ? void 0 : classNames.base }), children: [
4451
+ headerContent && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { children: headerContent }),
4452
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: slots.wrapper({ class: classNames == null ? void 0 : classNames.wrapper }), children: [
4453
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
4454
+ "div",
4455
+ {
4456
+ className: slots.group({ class: classNames == null ? void 0 : classNames.group }),
4457
+ onClick: handleToggle,
4458
+ onContextMenu: handleRightClick,
4459
+ children: [
4460
+ groupIcon,
4461
+ group.label
4462
+ ]
4463
+ }
4464
+ ),
4465
+ isOpen && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { children: group.data.map((node) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
4466
+ TreeNodeItem,
4467
+ {
4468
+ node,
4469
+ depth: 1,
4470
+ classNames,
4471
+ fileIcon,
4472
+ isLoading,
4473
+ onExpand
4474
+ },
4475
+ node.id
4476
+ )) })
4477
+ ] })
4478
+ ] });
4479
+ };
4403
4480
  Tree.displayName = "Tree";
4404
4481
  var tree_default = Tree;
4405
4482
  var treeStyle = tv({
4406
4483
  slots: {
4407
4484
  base: ["border", "border-neutral-light", "rounded-xl", "p-[20px]", "flex", "flex-col", "gap-[20px]", "select-none"],
4408
- wrapper: [
4485
+ wrapper: ["flex", "flex-col", "gap-[5px]"],
4486
+ group: [
4409
4487
  "flex",
4410
4488
  "items-center",
4411
4489
  "gap-[5px]",
@@ -4414,9 +4492,9 @@ var treeStyle = tv({
4414
4492
  "text-body-foreground",
4415
4493
  "hover:bg-neutral-soft",
4416
4494
  "p-[5px]",
4417
- "rounded-[5px]"
4418
- ],
4419
- label: ["cursor-pointer"]
4495
+ "rounded-[5px]",
4496
+ "cursor-pointer"
4497
+ ]
4420
4498
  }
4421
4499
  });
4422
4500
  // Annotate the CommonJS export names for ESM import in node:
@@ -2,7 +2,7 @@
2
2
  import "../../chunk-MBLZYQCN.mjs";
3
3
  import {
4
4
  tree_default
5
- } from "../../chunk-K4QY2F5J.mjs";
5
+ } from "../../chunk-PX4PFLJ3.mjs";
6
6
  import "../../chunk-ZYIIXWVY.mjs";
7
7
  import "../../chunk-HWL7TPUN.mjs";
8
8
  import "../../chunk-3IU2RPSM.mjs";
@@ -1,14 +1,16 @@
1
1
  import * as tailwind_variants from 'tailwind-variants';
2
2
  import * as tailwind_merge from 'tailwind-merge';
3
- import * as react from 'react';
4
- import { ReactNode } from 'react';
3
+ import * as react_jsx_runtime from 'react/jsx-runtime';
4
+ import { ReactNode, MouseEvent } from 'react';
5
5
  import { SlotsToClasses } from '../../utils/types.mjs';
6
6
 
7
7
  type TreeNode = {
8
8
  id: number;
9
9
  label: string;
10
+ isLeaf?: boolean;
10
11
  children?: TreeNode[];
11
12
  onClick?: () => void;
13
+ onRightClick?: (event: MouseEvent<HTMLSpanElement>) => void;
12
14
  };
13
15
  interface TreeProps {
14
16
  headerContent?: ReactNode;
@@ -16,19 +18,24 @@ interface TreeProps {
16
18
  label: string;
17
19
  data: TreeNode[];
18
20
  onClick?: () => void;
21
+ onRightClick?: (event: MouseEvent<HTMLSpanElement>) => void;
19
22
  };
20
23
  groupIcon?: ReactNode;
21
24
  fileIcon?: ReactNode;
22
25
  isLoading?: boolean;
23
26
  classNames?: SlotsToClasses<TreeSlots>;
27
+ onExpand?: (node: TreeNode) => Promise<TreeNode[]>;
24
28
  }
25
- declare const Tree: react.ForwardRefExoticComponent<TreeProps & react.RefAttributes<HTMLDivElement>>;
29
+ declare const Tree: {
30
+ ({ headerContent, group, groupIcon, fileIcon, isLoading, classNames, onExpand, }: TreeProps): react_jsx_runtime.JSX.Element;
31
+ displayName: string;
32
+ };
26
33
 
27
34
  declare const treeStyle: tailwind_variants.TVReturnType<{
28
35
  [key: string]: {
29
36
  [key: string]: tailwind_merge.ClassNameValue | {
30
37
  base?: tailwind_merge.ClassNameValue;
31
- label?: tailwind_merge.ClassNameValue;
38
+ group?: tailwind_merge.ClassNameValue;
32
39
  wrapper?: tailwind_merge.ClassNameValue;
33
40
  };
34
41
  };
@@ -36,31 +43,31 @@ declare const treeStyle: tailwind_variants.TVReturnType<{
36
43
  [x: string]: {
37
44
  [x: string]: tailwind_merge.ClassNameValue | {
38
45
  base?: tailwind_merge.ClassNameValue;
39
- label?: tailwind_merge.ClassNameValue;
46
+ group?: tailwind_merge.ClassNameValue;
40
47
  wrapper?: tailwind_merge.ClassNameValue;
41
48
  };
42
49
  };
43
50
  } | {}, {
44
51
  base: string[];
45
52
  wrapper: string[];
46
- label: string[];
53
+ group: string[];
47
54
  }, undefined, {
48
55
  [key: string]: {
49
56
  [key: string]: tailwind_merge.ClassNameValue | {
50
57
  base?: tailwind_merge.ClassNameValue;
51
- label?: tailwind_merge.ClassNameValue;
58
+ group?: tailwind_merge.ClassNameValue;
52
59
  wrapper?: tailwind_merge.ClassNameValue;
53
60
  };
54
61
  };
55
62
  } | {}, {
56
63
  base: string[];
57
64
  wrapper: string[];
58
- label: string[];
65
+ group: string[];
59
66
  }, tailwind_variants.TVReturnType<unknown, {
60
67
  base: string[];
61
68
  wrapper: string[];
62
- label: string[];
69
+ group: string[];
63
70
  }, undefined, unknown, unknown, undefined>>;
64
71
  type TreeSlots = keyof ReturnType<typeof treeStyle>;
65
72
 
66
- export { type TreeNode, Tree as default };
73
+ export { Tree, type TreeNode, type TreeProps, Tree as default };
@@ -1,14 +1,16 @@
1
1
  import * as tailwind_variants from 'tailwind-variants';
2
2
  import * as tailwind_merge from 'tailwind-merge';
3
- import * as react from 'react';
4
- import { ReactNode } from 'react';
3
+ import * as react_jsx_runtime from 'react/jsx-runtime';
4
+ import { ReactNode, MouseEvent } from 'react';
5
5
  import { SlotsToClasses } from '../../utils/types.js';
6
6
 
7
7
  type TreeNode = {
8
8
  id: number;
9
9
  label: string;
10
+ isLeaf?: boolean;
10
11
  children?: TreeNode[];
11
12
  onClick?: () => void;
13
+ onRightClick?: (event: MouseEvent<HTMLSpanElement>) => void;
12
14
  };
13
15
  interface TreeProps {
14
16
  headerContent?: ReactNode;
@@ -16,19 +18,24 @@ interface TreeProps {
16
18
  label: string;
17
19
  data: TreeNode[];
18
20
  onClick?: () => void;
21
+ onRightClick?: (event: MouseEvent<HTMLSpanElement>) => void;
19
22
  };
20
23
  groupIcon?: ReactNode;
21
24
  fileIcon?: ReactNode;
22
25
  isLoading?: boolean;
23
26
  classNames?: SlotsToClasses<TreeSlots>;
27
+ onExpand?: (node: TreeNode) => Promise<TreeNode[]>;
24
28
  }
25
- declare const Tree: react.ForwardRefExoticComponent<TreeProps & react.RefAttributes<HTMLDivElement>>;
29
+ declare const Tree: {
30
+ ({ headerContent, group, groupIcon, fileIcon, isLoading, classNames, onExpand, }: TreeProps): react_jsx_runtime.JSX.Element;
31
+ displayName: string;
32
+ };
26
33
 
27
34
  declare const treeStyle: tailwind_variants.TVReturnType<{
28
35
  [key: string]: {
29
36
  [key: string]: tailwind_merge.ClassNameValue | {
30
37
  base?: tailwind_merge.ClassNameValue;
31
- label?: tailwind_merge.ClassNameValue;
38
+ group?: tailwind_merge.ClassNameValue;
32
39
  wrapper?: tailwind_merge.ClassNameValue;
33
40
  };
34
41
  };
@@ -36,31 +43,31 @@ declare const treeStyle: tailwind_variants.TVReturnType<{
36
43
  [x: string]: {
37
44
  [x: string]: tailwind_merge.ClassNameValue | {
38
45
  base?: tailwind_merge.ClassNameValue;
39
- label?: tailwind_merge.ClassNameValue;
46
+ group?: tailwind_merge.ClassNameValue;
40
47
  wrapper?: tailwind_merge.ClassNameValue;
41
48
  };
42
49
  };
43
50
  } | {}, {
44
51
  base: string[];
45
52
  wrapper: string[];
46
- label: string[];
53
+ group: string[];
47
54
  }, undefined, {
48
55
  [key: string]: {
49
56
  [key: string]: tailwind_merge.ClassNameValue | {
50
57
  base?: tailwind_merge.ClassNameValue;
51
- label?: tailwind_merge.ClassNameValue;
58
+ group?: tailwind_merge.ClassNameValue;
52
59
  wrapper?: tailwind_merge.ClassNameValue;
53
60
  };
54
61
  };
55
62
  } | {}, {
56
63
  base: string[];
57
64
  wrapper: string[];
58
- label: string[];
65
+ group: string[];
59
66
  }, tailwind_variants.TVReturnType<unknown, {
60
67
  base: string[];
61
68
  wrapper: string[];
62
- label: string[];
69
+ group: string[];
63
70
  }, undefined, unknown, unknown, undefined>>;
64
71
  type TreeSlots = keyof ReturnType<typeof treeStyle>;
65
72
 
66
- export { type TreeNode, Tree as default };
73
+ export { Tree, type TreeNode, type TreeProps, Tree as default };