@deepnoid/ui 0.1.26 → 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 (54) hide show
  1. package/.turbo/turbo-build.log +128 -124
  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-PX4PFLJ3.mjs +178 -0
  7. package/dist/{chunk-EAK5DVWA.mjs → chunk-UNH3BCGN.mjs} +8 -1
  8. package/dist/{chunk-6OMHIMIA.mjs → chunk-XA6PVFTW.mjs} +2 -2
  9. package/dist/components/input/index.js +18 -18
  10. package/dist/components/input/index.mjs +1 -1
  11. package/dist/components/input/input.d.mts +44 -44
  12. package/dist/components/input/input.d.ts +44 -44
  13. package/dist/components/input/input.js +18 -18
  14. package/dist/components/input/input.mjs +1 -1
  15. package/dist/components/pagination/index.js +18 -18
  16. package/dist/components/pagination/index.mjs +2 -2
  17. package/dist/components/pagination/pagination.js +18 -18
  18. package/dist/components/pagination/pagination.mjs +2 -2
  19. package/dist/components/select/index.js +16 -16
  20. package/dist/components/select/index.mjs +1 -1
  21. package/dist/components/select/select.d.mts +38 -38
  22. package/dist/components/select/select.d.ts +38 -38
  23. package/dist/components/select/select.js +16 -16
  24. package/dist/components/select/select.mjs +1 -1
  25. package/dist/components/table/definition-table.d.mts +51 -0
  26. package/dist/components/table/definition-table.d.ts +51 -0
  27. package/dist/components/table/definition-table.js +351 -0
  28. package/dist/components/table/definition-table.mjs +9 -0
  29. package/dist/components/table/form-table.d.mts +1 -1
  30. package/dist/components/table/form-table.d.ts +1 -1
  31. package/dist/components/table/form-table.mjs +43 -3
  32. package/dist/components/table/index.d.mts +1 -1
  33. package/dist/components/table/index.d.ts +1 -1
  34. package/dist/components/table/index.js +40 -47
  35. package/dist/components/table/index.mjs +7 -7
  36. package/dist/components/table/table-head.js +8 -1
  37. package/dist/components/table/table-head.mjs +1 -1
  38. package/dist/components/table/table.js +26 -19
  39. package/dist/components/table/table.mjs +4 -4
  40. package/dist/components/tree/index.d.mts +1 -0
  41. package/dist/components/tree/index.d.ts +1 -0
  42. package/dist/components/tree/index.js +124 -49
  43. package/dist/components/tree/index.mjs +1 -1
  44. package/dist/components/tree/tree.d.mts +17 -10
  45. package/dist/components/tree/tree.d.ts +17 -10
  46. package/dist/components/tree/tree.js +129 -49
  47. package/dist/components/tree/tree.mjs +3 -1
  48. package/dist/index.d.mts +1 -1
  49. package/dist/index.d.ts +1 -1
  50. package/dist/index.js +180 -112
  51. package/dist/index.mjs +9 -9
  52. package/package.json +1 -1
  53. package/dist/chunk-ICZTNO4V.mjs +0 -49
  54. package/dist/chunk-TEQ723QO.mjs +0 -102
@@ -2,19 +2,19 @@
2
2
  import "../../chunk-DX3KXNP6.mjs";
3
3
  import {
4
4
  table_default
5
- } from "../../chunk-6OMHIMIA.mjs";
5
+ } from "../../chunk-XA6PVFTW.mjs";
6
6
  import "../../chunk-XRC5OUYQ.mjs";
7
- import "../../chunk-EAK5DVWA.mjs";
7
+ import "../../chunk-UNH3BCGN.mjs";
8
8
  import "../../chunk-DQRAFUDA.mjs";
9
9
  import "../../chunk-M37VBNB3.mjs";
10
10
  import {
11
- form_table_default
12
- } from "../../chunk-ICZTNO4V.mjs";
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-6OMHIMIA.mjs";
4
+ } from "../../chunk-XA6PVFTW.mjs";
5
5
  import "../../chunk-XRC5OUYQ.mjs";
6
- import "../../chunk-EAK5DVWA.mjs";
6
+ import "../../chunk-UNH3BCGN.mjs";
7
7
  import "../../chunk-DQRAFUDA.mjs";
8
8
  import "../../chunk-M37VBNB3.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";
@@ -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';
@@ -4339,76 +4339,151 @@ function toVal(mix) {
4339
4339
  // src/components/tree/tree.tsx
4340
4340
  var import_jsx_runtime3 = require("react/jsx-runtime");
4341
4341
  var TreeNodeItem = (0, import_react.forwardRef)(
4342
- ({ node, depth, fileIcon, isLoading, classNames }, ref) => {
4343
- var _a;
4342
+ ({ node, depth, fileIcon, isLoading, classNames, onExpand }, ref) => {
4344
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);
4345
4346
  const slots = (0, import_react.useMemo)(() => treeStyle(), []);
4346
- const toggleOpen = (0, import_react.useCallback)(() => {
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
+ }
4347
4364
  setIsOpen((prev) => !prev);
4348
- }, []);
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]";
4349
4377
  return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
4350
4378
  "div",
4351
4379
  {
4352
4380
  ref,
4353
4381
  className: clsx(
4354
- depth > 1 ? "ml-[30px]" : "",
4382
+ marginClass,
4355
4383
  "transition-all duration-150 ease-out",
4356
4384
  isLoading ? "-translate-y-2 opacity-0" : "translate-y-0 opacity-100"
4357
4385
  ),
4358
4386
  children: [
4359
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: slots.wrapper({ class: classNames == null ? void 0 : classNames.wrapper }), onClick: toggleOpen, children: [
4360
- node.children && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
4361
- Icon_default,
4387
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
4388
+ "div",
4389
+ {
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
+ ]
4407
+ }
4408
+ ),
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,
4362
4413
  {
4363
- name: "right-chevron",
4364
- className: `text-neutral-main cursor-pointer transition-transform duration-150 ${isOpen ? "rotate-90" : "rotate-0"}`
4365
- }
4366
- ),
4367
- fileIcon,
4368
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: slots.label({ class: classNames == null ? void 0 : classNames.label }), onClick: () => {
4369
- var _a2;
4370
- return (_a2 = node.onClick) == null ? void 0 : _a2.call(node);
4371
- }, children: node.label })
4372
- ] }),
4373
- 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)))
4414
+ node: child,
4415
+ depth: depth + 1,
4416
+ classNames,
4417
+ fileIcon,
4418
+ onExpand
4419
+ },
4420
+ child.id
4421
+ ))
4422
+ ] })
4374
4423
  ]
4375
4424
  }
4376
4425
  );
4377
4426
  }
4378
4427
  );
4379
- var Tree = (0, import_react.forwardRef)(
4380
- ({ headerContent, group, groupIcon, fileIcon, isLoading, classNames }, ref) => {
4381
- const { label, data, onClick } = group;
4382
- const slots = (0, import_react.useMemo)(() => treeStyle(), []);
4383
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { ref, className: slots.base({ class: classNames == null ? void 0 : classNames.base }), children: [
4384
- headerContent && /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { children: headerContent }),
4385
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { children: [
4386
- /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: slots.wrapper({ class: classNames == null ? void 0 : classNames.wrapper }), children: [
4387
- groupIcon,
4388
- /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { className: slots.label({ class: classNames == null ? void 0 : classNames.label }), onClick, children: label })
4389
- ] }),
4390
- data.map((node) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
4391
- TreeNodeItem,
4392
- {
4393
- node,
4394
- depth: 1,
4395
- classNames,
4396
- fileIcon,
4397
- isLoading
4398
- },
4399
- node.id
4400
- ))
4401
- ] })
4402
- ] });
4403
- }
4404
- );
4405
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
+ };
4406
4480
  Tree.displayName = "Tree";
4407
4481
  var tree_default = Tree;
4408
4482
  var treeStyle = tv({
4409
4483
  slots: {
4410
4484
  base: ["border", "border-neutral-light", "rounded-xl", "p-[20px]", "flex", "flex-col", "gap-[20px]", "select-none"],
4411
- wrapper: [
4485
+ wrapper: ["flex", "flex-col", "gap-[5px]"],
4486
+ group: [
4412
4487
  "flex",
4413
4488
  "items-center",
4414
4489
  "gap-[5px]",
@@ -4417,9 +4492,9 @@ var treeStyle = tv({
4417
4492
  "text-body-foreground",
4418
4493
  "hover:bg-neutral-soft",
4419
4494
  "p-[5px]",
4420
- "rounded-[5px]"
4421
- ],
4422
- label: ["cursor-pointer"]
4495
+ "rounded-[5px]",
4496
+ "cursor-pointer"
4497
+ ]
4423
4498
  }
4424
4499
  });
4425
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-TEQ723QO.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 };