@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
package/dist/index.js CHANGED
@@ -110,7 +110,7 @@ __export(index_exports, {
110
110
  CheckBox: () => checkbox_default,
111
111
  Chip: () => chip_default,
112
112
  DateTimePicker: () => dateTimePicker_default,
113
- FormTable: () => form_table_default,
113
+ DefinitionTable: () => definition_table_default,
114
114
  Icon: () => Icon_default,
115
115
  IconButton: () => icon_button_default,
116
116
  Input: () => input_default,
@@ -5773,7 +5773,7 @@ var buttonGroup = tv({
5773
5773
 
5774
5774
  // src/components/breadcrumb/breadcrumb.tsx
5775
5775
  var import_jsx_runtime10 = require("react/jsx-runtime");
5776
- var BreadcrumbMenu = (0, import_react8.forwardRef)(({ label, onClick, isCurrent, size }) => {
5776
+ var BreadcrumbMenu = ({ label, onClick, isCurrent, size }) => {
5777
5777
  return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
5778
5778
  text_button_default,
5779
5779
  {
@@ -5786,7 +5786,7 @@ var BreadcrumbMenu = (0, import_react8.forwardRef)(({ label, onClick, isCurrent,
5786
5786
  children: label
5787
5787
  }
5788
5788
  );
5789
- });
5789
+ };
5790
5790
  var Breadcrumb = (0, import_react8.forwardRef)(({ startIconName, size, menus, classNames }, ref) => {
5791
5791
  const slots = (0, import_react8.useMemo)(() => breadcrumbStyle({ size }), [size]);
5792
5792
  const renderMenus = (menus2) => {
@@ -5860,7 +5860,7 @@ var import_react9 = __toESM(require("react"));
5860
5860
  var import_jsx_runtime11 = require("react/jsx-runtime");
5861
5861
  var Input = (0, import_react9.forwardRef)((originalProps, ref) => {
5862
5862
  const [props, variantProps] = mapPropsVariants(originalProps, inputStyle.variantKeys);
5863
- const { classNames, label, helperText, errorText, startContent, endContent, ...inputProps } = props;
5863
+ const { classNames, label, helperMessage, errorMessage, startContent, endContent, ...inputProps } = props;
5864
5864
  const inputRef = (0, import_react9.useRef)(null);
5865
5865
  const slots = (0, import_react9.useMemo)(() => inputStyle({ ...variantProps }), [variantProps]);
5866
5866
  const getContentProps = (0, import_react9.useCallback)(
@@ -5903,7 +5903,7 @@ var Input = (0, import_react9.forwardRef)((originalProps, ref) => {
5903
5903
  className: `${getContentProps().className || ""} ${existingProps.className || ""}`.trim()
5904
5904
  };
5905
5905
  return import_react9.default.cloneElement(endContent, mergedProps);
5906
- } else if (errorText) {
5906
+ } else if (errorMessage) {
5907
5907
  const iconProps = { ...getContentProps(), className: getContentProps().className };
5908
5908
  return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { ...iconProps, children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(Icon_default, { name: "exclamation-circle", fill: true, size: originalProps.size }) });
5909
5909
  } else {
@@ -5957,8 +5957,8 @@ var Input = (0, import_react9.forwardRef)((originalProps, ref) => {
5957
5957
  ]
5958
5958
  }
5959
5959
  ),
5960
- helperText && !errorText && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: slots.helperText({ class: classNames == null ? void 0 : classNames.helperText }), children: helperText }),
5961
- errorText && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: clsx("error", slots.errorText({ class: classNames == null ? void 0 : classNames.errorText })), children: errorText })
5960
+ helperMessage && !errorMessage && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: slots.helperMessage({ class: classNames == null ? void 0 : classNames.helperMessage }), children: helperMessage }),
5961
+ errorMessage && /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { className: clsx("error", slots.errorMessage({ class: classNames == null ? void 0 : classNames.errorMessage })), children: errorMessage })
5962
5962
  ] })
5963
5963
  ]
5964
5964
  }
@@ -5998,8 +5998,8 @@ var inputStyle = tv(
5998
5998
  "group-has-[:hover]/input:text-neutral-dark",
5999
5999
  "group-has-[p.error]/input:text-danger-main"
6000
6000
  ],
6001
- helperText: ["text-neutral-main", "group-has-[:hover]/input:text-neutral-dark"],
6002
- errorText: ["text-danger-main"],
6001
+ helperMessage: ["text-neutral-main", "group-has-[:hover]/input:text-neutral-dark"],
6002
+ errorMessage: ["text-danger-main"],
6003
6003
  readonly: ["pointer-events-none", "!text-body-foreground"]
6004
6004
  },
6005
6005
  variants: {
@@ -6034,7 +6034,7 @@ var inputStyle = tv(
6034
6034
  "group-has-[:focus]/input:text-primary-main",
6035
6035
  "!group-has-[p.error]:not(input:focus):hover/input:text-primary-main"
6036
6036
  ],
6037
- helperText: [
6037
+ helperMessage: [
6038
6038
  "group-has-[:focus]/input:text-primary-main",
6039
6039
  "group-has-[:focus:hover]/input:text-primary-main",
6040
6040
  "group-has-[:focus]/input:hover:text-primary-main"
@@ -6045,7 +6045,7 @@ var inputStyle = tv(
6045
6045
  "group-has-[:focus]/input:text-secondary-main",
6046
6046
  "!group-has-[p.error]:not(input:focus):hover/input:text-secondary-main"
6047
6047
  ],
6048
- helperText: [
6048
+ helperMessage: [
6049
6049
  "group-has-[:focus]/input:text-secondary-main",
6050
6050
  "group-has-[:focus:hover]/input:text-secondary-main",
6051
6051
  "group-has-[:focus]/input:hover:text-secondary-main"
@@ -6058,32 +6058,32 @@ var inputStyle = tv(
6058
6058
  label: ["text-sm"],
6059
6059
  innerWrapper: ["gap-[4px]"],
6060
6060
  inputWrapper: ["w-[240px]", "h-[24px]", "rounded-sm", "px-[4px]", "gap-[4px]"],
6061
- helperText: ["text-sm"],
6062
- errorText: ["text-sm"]
6061
+ helperMessage: ["text-sm"],
6062
+ errorMessage: ["text-sm"]
6063
6063
  },
6064
6064
  md: {
6065
6065
  base: ["text-md", "gap-[6px]"],
6066
6066
  label: ["text-md"],
6067
6067
  innerWrapper: ["gap-[6px]"],
6068
6068
  inputWrapper: ["w-[240px]", "h-[32px]", "rounded-md", "px-[6px]", "gap-[6px]"],
6069
- helperText: ["text-sm"],
6070
- errorText: ["text-sm"]
6069
+ helperMessage: ["text-sm"],
6070
+ errorMessage: ["text-sm"]
6071
6071
  },
6072
6072
  lg: {
6073
6073
  base: ["text-lg", "gap-[8px]"],
6074
6074
  label: ["text-lg"],
6075
6075
  innerWrapper: ["gap-[8px]"],
6076
6076
  inputWrapper: ["w-[240px]", "h-[40px]", "rounded-lg", "px-[8px]", "gap-[8px]"],
6077
- helperText: ["text-md"],
6078
- errorText: ["text-md"]
6077
+ helperMessage: ["text-md"],
6078
+ errorMessage: ["text-md"]
6079
6079
  },
6080
6080
  xl: {
6081
6081
  base: ["text-xl", "gap-[10px]"],
6082
6082
  label: ["text-xl"],
6083
6083
  innerWrapper: ["gap-[10px]"],
6084
6084
  inputWrapper: ["w-[240px]", "h-[50px]", "rounded-lg", "px-[10px]", "gap-[10px]"],
6085
- helperText: ["text-md"],
6086
- errorText: ["text-md"]
6085
+ helperMessage: ["text-md"],
6086
+ errorMessage: ["text-md"]
6087
6087
  }
6088
6088
  },
6089
6089
  direction: {
@@ -6107,8 +6107,8 @@ var inputStyle = tv(
6107
6107
  "group-has-[p.error]/input:placeholder:text-danger-light"
6108
6108
  ],
6109
6109
  content: ["text-neutral-light", "group-has-[p.error]/input:text-danger-light"],
6110
- helperText: ["!text-neutral-light"],
6111
- errorText: ["!text-danger-light"]
6110
+ helperMessage: ["!text-neutral-light"],
6111
+ errorMessage: ["!text-danger-light"]
6112
6112
  }
6113
6113
  }
6114
6114
  },
@@ -6832,7 +6832,14 @@ var TableHead = ({ columns, slots, size, rowCheckbox, isCheckedAll, classNames,
6832
6832
  },
6833
6833
  `${column.field}${index}thead`
6834
6834
  ));
6835
- const renderSelectAllCheckbox = () => rowCheckbox && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("th", { className: slots.th({ class: classNames == null ? void 0 : classNames.th }), onClick: handleClickCheckAll, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(checkbox_default, { size, checked: isCheckedAll }) }) });
6835
+ const renderSelectAllCheckbox = () => rowCheckbox && /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("th", { className: slots.th({ class: classNames == null ? void 0 : classNames.th }), onClick: handleClickCheckAll, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
6836
+ checkbox_default,
6837
+ {
6838
+ size,
6839
+ checked: isCheckedAll,
6840
+ onChange: (e) => onCheckAll(e.target.checked)
6841
+ }
6842
+ ) }) });
6836
6843
  return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("thead", { className: slots.thead({ class: classNames == null ? void 0 : classNames.thead }), children: /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("tr", { className: slots.tr({ class: classNames == null ? void 0 : classNames.tr }), children: [
6837
6844
  renderColumnHeaders(),
6838
6845
  renderSelectAllCheckbox()
@@ -7550,41 +7557,27 @@ var tableStyle = (0, import_tailwind_variants15.tv)({
7550
7557
  }
7551
7558
  });
7552
7559
 
7553
- // src/components/table/form-table.tsx
7560
+ // src/components/table/definition-table.tsx
7554
7561
  var import_react18 = require("react");
7555
7562
  var import_jsx_runtime20 = require("react/jsx-runtime");
7556
7563
  var DEFAULT_COLUMN_CLASSES = [
7557
7564
  "w-[120px] px-[10px] py-[9.5px] font-bold text-md text-body-foreground border-r border-neutral-light",
7558
7565
  "px-[10px] py-[9.5px]"
7559
7566
  ];
7560
- var FormTableRow = ({ columns, columnClasses = [] }) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("tr", { className: "border-neutral-light min-h-[50px] border-b", children: columns.map((col, index) => {
7567
+ var DefinitionTableRow = ({ columns, columnClasses = [] }) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("tr", { className: "border-neutral-light min-h-[50px] border-b", children: columns.map((col, index) => {
7561
7568
  var _a;
7562
7569
  return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("td", { className: (_a = columnClasses[index]) != null ? _a : DEFAULT_COLUMN_CLASSES[index], children: col }, index);
7563
7570
  }) });
7564
- var FormTable = (0, import_react18.forwardRef)(
7565
- ({ rows, onSubmit, footer, classNames }, ref) => {
7566
- const slots = (0, import_react18.useMemo)(() => formTableStyle(), []);
7567
- const content = /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
7568
- /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("table", { className: slots.table({ class: classNames == null ? void 0 : classNames.table }), children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("tbody", { children: rows.map((row, i) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(FormTableRow, { ...row }, i)) }) }),
7569
- footer && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { children: footer })
7570
- ] });
7571
- if (onSubmit) {
7572
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
7573
- "form",
7574
- {
7575
- ref,
7576
- onSubmit,
7577
- className: slots.base({ class: classNames == null ? void 0 : classNames.base }),
7578
- children: content
7579
- }
7580
- );
7581
- }
7582
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { ref, className: slots.base({ class: classNames == null ? void 0 : classNames.base }), children: content });
7583
- }
7584
- );
7585
- FormTable.displayName = "FormTable";
7586
- var form_table_default = FormTable;
7587
- var formTableStyle = tv({
7571
+ var DefinitionTable = (0, import_react18.forwardRef)(({ rows, footer, classNames }, ref) => {
7572
+ const slots = (0, import_react18.useMemo)(() => DefinitionTableStyle(), []);
7573
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { ref, className: slots.base({ class: classNames == null ? void 0 : classNames.base }), children: [
7574
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("table", { className: slots.table({ class: classNames == null ? void 0 : classNames.table }), children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("tbody", { children: rows.map((row, i) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(DefinitionTableRow, { ...row }, i)) }) }),
7575
+ footer && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { children: footer })
7576
+ ] });
7577
+ });
7578
+ DefinitionTable.displayName = "DefinitionTable";
7579
+ var definition_table_default = DefinitionTable;
7580
+ var DefinitionTableStyle = tv({
7588
7581
  slots: {
7589
7582
  base: ["flex", "flex-col", "gap-[30px]"],
7590
7583
  table: ["w-full", "table-fixed", "border", "border-neutral-light"]
@@ -7601,8 +7594,8 @@ var Select = (0, import_react19.forwardRef)((originalProps, ref) => {
7601
7594
  const {
7602
7595
  label,
7603
7596
  options,
7604
- helperText,
7605
- errorText,
7597
+ helperMessage,
7598
+ errorMessage,
7606
7599
  classNames,
7607
7600
  defaultSelectedOptions = [],
7608
7601
  onChange,
@@ -7730,8 +7723,8 @@ var Select = (0, import_react19.forwardRef)((originalProps, ref) => {
7730
7723
  ]
7731
7724
  }
7732
7725
  ),
7733
- helperText && !errorText && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: slots.helperText({ class: classNames == null ? void 0 : classNames.helperText }), children: helperText }),
7734
- errorText && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: clsx("error", slots.errorText({ class: classNames == null ? void 0 : classNames.errorText })), children: errorText })
7726
+ helperMessage && !errorMessage && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: slots.helperMessage({ class: classNames == null ? void 0 : classNames.helperMessage }), children: helperMessage }),
7727
+ errorMessage && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("p", { className: clsx("error", slots.errorMessage({ class: classNames == null ? void 0 : classNames.errorMessage })), children: errorMessage })
7735
7728
  ] })
7736
7729
  ]
7737
7730
  }
@@ -7803,8 +7796,8 @@ var select = tv({
7803
7796
  ],
7804
7797
  optionsWrapper: ["border", "rounded", "bg-white", "shadow", "overflow-auto"],
7805
7798
  option: ["flex", "justify-between", "items-center", "cursor-pointer"],
7806
- helperText: ["text-neutral-main"],
7807
- errorText: ["text-danger-main"],
7799
+ helperMessage: ["text-neutral-main"],
7800
+ errorMessage: ["text-danger-main"],
7808
7801
  readonly: ["pointer-events-none", "!bg-trans-soft"]
7809
7802
  },
7810
7803
  variants: {
@@ -7827,8 +7820,8 @@ var select = tv({
7827
7820
  selectWrapper: ["w-[240px]", "h-[24px]", "rounded-sm", "px-[4px]"],
7828
7821
  select: ["text-sm"],
7829
7822
  option: ["px-[4px]", "py-[3px]", "text-sm"],
7830
- helperText: ["text-sm"],
7831
- errorText: ["text-sm"]
7823
+ helperMessage: ["text-sm"],
7824
+ errorMessage: ["text-sm"]
7832
7825
  },
7833
7826
  md: {
7834
7827
  base: ["text-md", "gap-[6px]", "rounded-md"],
@@ -7837,8 +7830,8 @@ var select = tv({
7837
7830
  selectWrapper: ["w-[240px]", "h-[32px]", "rounded-md", "px-[6px]"],
7838
7831
  select: ["text-md"],
7839
7832
  option: ["px-[6px]", "py-[5.5px]", "text-md"],
7840
- helperText: ["text-sm"],
7841
- errorText: ["text-sm"]
7833
+ helperMessage: ["text-sm"],
7834
+ errorMessage: ["text-sm"]
7842
7835
  },
7843
7836
  lg: {
7844
7837
  base: ["text-lg", "gap-[8px]"],
@@ -7847,8 +7840,8 @@ var select = tv({
7847
7840
  selectWrapper: ["w-[240px]", "h-[40px]", "rounded-lg", "px-[8px]"],
7848
7841
  select: ["text-lg"],
7849
7842
  option: ["px-[8px]", "py-[8px]", "text-lg"],
7850
- helperText: ["text-md"],
7851
- errorText: ["text-md"]
7843
+ helperMessage: ["text-md"],
7844
+ errorMessage: ["text-md"]
7852
7845
  },
7853
7846
  xl: {
7854
7847
  base: ["text-xl", "gap-[10px]"],
@@ -7857,8 +7850,8 @@ var select = tv({
7857
7850
  selectWrapper: ["w-[240px]", "h-[50px]", "rounded-lg", "px-[10px]"],
7858
7851
  select: ["text-xl"],
7859
7852
  option: ["px-[10px]", "py-[11.5px]"],
7860
- helperText: ["text-md"],
7861
- errorText: ["text-md"]
7853
+ helperMessage: ["text-md"],
7854
+ errorMessage: ["text-md"]
7862
7855
  }
7863
7856
  },
7864
7857
  direction: {
@@ -7888,8 +7881,8 @@ var select = tv({
7888
7881
  "group-has-[p.error]/select:text-danger-light",
7889
7882
  "group-has-[p.error]/select:placeholder:text-danger-light"
7890
7883
  ],
7891
- helperText: ["!text-neutral-light"],
7892
- errorText: ["!text-danger-light"]
7884
+ helperMessage: ["!text-neutral-light"],
7885
+ errorMessage: ["!text-danger-light"]
7893
7886
  }
7894
7887
  },
7895
7888
  isSelected: {
@@ -10001,74 +9994,152 @@ var dateTimePickerStyle = tv({
10001
9994
  // src/components/tree/tree.tsx
10002
9995
  var import_react34 = require("react");
10003
9996
  var import_jsx_runtime34 = require("react/jsx-runtime");
10004
- var TreeNodeItem = (0, import_react34.forwardRef)(({ node, depth, fileIcon, isLoading, classNames }) => {
10005
- var _a;
10006
- const [isOpen, setIsOpen] = (0, import_react34.useState)(false);
10007
- const slots = (0, import_react34.useMemo)(() => treeStyle(), []);
10008
- const toggleOpen = (0, import_react34.useCallback)(() => {
10009
- setIsOpen((prev) => !prev);
10010
- }, []);
10011
- return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
10012
- "div",
10013
- {
10014
- className: clsx(
10015
- depth > 1 ? "ml-[30px]" : "",
10016
- "transition-all duration-150 ease-out",
10017
- isLoading ? "-translate-y-2 opacity-0" : "translate-y-0 opacity-100"
10018
- ),
10019
- children: [
10020
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: slots.wrapper({ class: classNames == null ? void 0 : classNames.wrapper }), onClick: toggleOpen, children: [
10021
- node.children && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
10022
- Icon_default,
9997
+ var TreeNodeItem = (0, import_react34.forwardRef)(
9998
+ ({ node, depth, fileIcon, isLoading, classNames, onExpand }, ref) => {
9999
+ const [isOpen, setIsOpen] = (0, import_react34.useState)(false);
10000
+ const [children, setChildren] = (0, import_react34.useState)(node.children);
10001
+ const [isLoadingChildren, setIsLoadingChildren] = (0, import_react34.useState)(false);
10002
+ const slots = (0, import_react34.useMemo)(() => treeStyle(), []);
10003
+ const hasMore = (0, import_react34.useMemo)(() => {
10004
+ if (node.isLeaf) return false;
10005
+ if (Array.isArray(children)) return children.length > 0;
10006
+ return typeof onExpand === "function";
10007
+ }, [node.isLeaf, children, onExpand]);
10008
+ const toggleOpen = (0, import_react34.useCallback)(async () => {
10009
+ if (!isOpen && !children && onExpand && !node.isLeaf) {
10010
+ setIsLoadingChildren(true);
10011
+ try {
10012
+ const result = await onExpand(node);
10013
+ setChildren(result);
10014
+ } catch (e) {
10015
+ console.error("Failed to load child nodes ", e);
10016
+ } finally {
10017
+ setIsLoadingChildren(false);
10018
+ }
10019
+ }
10020
+ setIsOpen((prev) => !prev);
10021
+ }, [isOpen, children, onExpand, node]);
10022
+ const handleClick = () => {
10023
+ var _a;
10024
+ toggleOpen();
10025
+ (_a = node.onClick) == null ? void 0 : _a.call(node);
10026
+ };
10027
+ const handleRightClick = (e) => {
10028
+ var _a;
10029
+ e.preventDefault();
10030
+ (_a = node.onRightClick) == null ? void 0 : _a.call(node, e);
10031
+ };
10032
+ const marginClass = depth > 1 ? hasMore ? "ml-[30px]" : "ml-[55px]" : hasMore ? "" : "ml-[25px]";
10033
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
10034
+ "div",
10035
+ {
10036
+ ref,
10037
+ className: clsx(
10038
+ marginClass,
10039
+ "transition-all duration-150 ease-out",
10040
+ isLoading ? "-translate-y-2 opacity-0" : "translate-y-0 opacity-100"
10041
+ ),
10042
+ children: [
10043
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
10044
+ "div",
10023
10045
  {
10024
- name: "right-chevron",
10025
- className: `text-neutral-main cursor-pointer transition-transform duration-150 ${isOpen ? "rotate-90" : "rotate-0"}`
10046
+ className: slots.group({ class: classNames == null ? void 0 : classNames.group }),
10047
+ onClick: handleClick,
10048
+ onContextMenu: handleRightClick,
10049
+ children: [
10050
+ hasMore && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
10051
+ Icon_default,
10052
+ {
10053
+ name: "right-chevron",
10054
+ className: clsx(
10055
+ "text-neutral-main cursor-pointer transition-transform duration-150",
10056
+ isOpen ? "rotate-90" : "rotate-0"
10057
+ )
10058
+ }
10059
+ ),
10060
+ fileIcon,
10061
+ node.label
10062
+ ]
10026
10063
  }
10027
10064
  ),
10028
- fileIcon,
10029
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: slots.label({ class: classNames == null ? void 0 : classNames.label }), onClick: () => {
10030
- var _a2;
10031
- return (_a2 = node.onClick) == null ? void 0 : _a2.call(node);
10032
- }, children: node.label })
10033
- ] }),
10034
- isOpen && ((_a = node.children) == null ? void 0 : _a.map((child) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(TreeNodeItem, { node: child, depth: depth + 1, classNames, fileIcon }, child.id)))
10035
- ]
10036
- }
10037
- );
10038
- });
10039
- var Tree = (0, import_react34.forwardRef)(
10040
- ({ headerContent, group, groupIcon, fileIcon, isLoading, classNames }) => {
10041
- const { label, data, onClick } = group;
10042
- const slots = (0, import_react34.useMemo)(() => treeStyle(), []);
10043
- return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: slots.base({ class: classNames == null ? void 0 : classNames.base }), children: [
10044
- headerContent && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { children: headerContent }),
10045
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { children: [
10046
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: slots.wrapper({ class: classNames == null ? void 0 : classNames.wrapper }), children: [
10047
- groupIcon,
10048
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: slots.label({ class: classNames == null ? void 0 : classNames.label }), onClick, children: label })
10049
- ] }),
10050
- data.map((node) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
10051
- TreeNodeItem,
10052
- {
10053
- node,
10054
- depth: 1,
10055
- classNames,
10056
- fileIcon,
10057
- isLoading
10058
- },
10059
- node.id
10060
- ))
10061
- ] })
10062
- ] });
10065
+ isOpen && /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { children: [
10066
+ isLoadingChildren && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { className: "text-neutral py-1 text-sm", children: "loading..." }),
10067
+ children == null ? void 0 : children.map((child) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
10068
+ TreeNodeItem,
10069
+ {
10070
+ node: child,
10071
+ depth: depth + 1,
10072
+ classNames,
10073
+ fileIcon,
10074
+ onExpand
10075
+ },
10076
+ child.id
10077
+ ))
10078
+ ] })
10079
+ ]
10080
+ }
10081
+ );
10063
10082
  }
10064
10083
  );
10065
10084
  TreeNodeItem.displayName = "TreeNodeItem";
10085
+ var Tree = ({
10086
+ headerContent,
10087
+ group,
10088
+ groupIcon,
10089
+ fileIcon,
10090
+ isLoading = false,
10091
+ classNames,
10092
+ onExpand
10093
+ }) => {
10094
+ const slots = (0, import_react34.useMemo)(() => treeStyle(), []);
10095
+ const [isOpen, setIsOpen] = (0, import_react34.useState)(true);
10096
+ const handleToggle = () => {
10097
+ var _a;
10098
+ setIsOpen((prev) => !prev);
10099
+ (_a = group.onClick) == null ? void 0 : _a.call(group);
10100
+ };
10101
+ const handleRightClick = (e) => {
10102
+ var _a;
10103
+ e.preventDefault();
10104
+ (_a = group.onRightClick) == null ? void 0 : _a.call(group, e);
10105
+ };
10106
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: slots.base({ class: classNames == null ? void 0 : classNames.base }), children: [
10107
+ headerContent && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { children: headerContent }),
10108
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: slots.wrapper({ class: classNames == null ? void 0 : classNames.wrapper }), children: [
10109
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
10110
+ "div",
10111
+ {
10112
+ className: slots.group({ class: classNames == null ? void 0 : classNames.group }),
10113
+ onClick: handleToggle,
10114
+ onContextMenu: handleRightClick,
10115
+ children: [
10116
+ groupIcon,
10117
+ group.label
10118
+ ]
10119
+ }
10120
+ ),
10121
+ isOpen && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { children: group.data.map((node) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
10122
+ TreeNodeItem,
10123
+ {
10124
+ node,
10125
+ depth: 1,
10126
+ classNames,
10127
+ fileIcon,
10128
+ isLoading,
10129
+ onExpand
10130
+ },
10131
+ node.id
10132
+ )) })
10133
+ ] })
10134
+ ] });
10135
+ };
10066
10136
  Tree.displayName = "Tree";
10067
10137
  var tree_default = Tree;
10068
10138
  var treeStyle = tv({
10069
10139
  slots: {
10070
10140
  base: ["border", "border-neutral-light", "rounded-xl", "p-[20px]", "flex", "flex-col", "gap-[20px]", "select-none"],
10071
- wrapper: [
10141
+ wrapper: ["flex", "flex-col", "gap-[5px]"],
10142
+ group: [
10072
10143
  "flex",
10073
10144
  "items-center",
10074
10145
  "gap-[5px]",
@@ -10077,9 +10148,9 @@ var treeStyle = tv({
10077
10148
  "text-body-foreground",
10078
10149
  "hover:bg-neutral-soft",
10079
10150
  "p-[5px]",
10080
- "rounded-[5px]"
10081
- ],
10082
- label: ["cursor-pointer"]
10151
+ "rounded-[5px]",
10152
+ "cursor-pointer"
10153
+ ]
10083
10154
  }
10084
10155
  });
10085
10156
  // Annotate the CommonJS export names for ESM import in node:
@@ -10092,7 +10163,7 @@ var treeStyle = tv({
10092
10163
  CheckBox,
10093
10164
  Chip,
10094
10165
  DateTimePicker,
10095
- FormTable,
10166
+ DefinitionTable,
10096
10167
  Icon,
10097
10168
  IconButton,
10098
10169
  Input,
package/dist/index.mjs CHANGED
@@ -1,18 +1,29 @@
1
1
  "use client";
2
- import "./chunk-QCEKPS7U.mjs";
2
+ import "./chunk-MBLZYQCN.mjs";
3
3
  import {
4
- select_default
5
- } from "./chunk-MSAULFDB.mjs";
4
+ tree_default
5
+ } from "./chunk-PX4PFLJ3.mjs";
6
+ import "./chunk-LUWGOKLG.mjs";
7
+ import {
8
+ ToastProvider,
9
+ useToast
10
+ } from "./chunk-YBDA3WQP.mjs";
11
+ import "./chunk-ZOTHPHXA.mjs";
12
+ import {
13
+ toast_default
14
+ } from "./chunk-OUAKGMDW.mjs";
6
15
  import "./chunk-HIE2YRGA.mjs";
7
16
  import {
8
17
  tooltip_default
9
18
  } from "./chunk-Z2537DF6.mjs";
10
19
  import "./chunk-ZMOAFSYE.mjs";
11
20
  import "./chunk-WSIADHVC.mjs";
12
- import "./chunk-MBLZYQCN.mjs";
21
+ import "./chunk-DX3KXNP6.mjs";
13
22
  import {
14
- tree_default
15
- } from "./chunk-K4QY2F5J.mjs";
23
+ table_default
24
+ } from "./chunk-XA6PVFTW.mjs";
25
+ import "./chunk-XRC5OUYQ.mjs";
26
+ import "./chunk-UNH3BCGN.mjs";
16
27
  import "./chunk-3MY6LO7N.mjs";
17
28
  import {
18
29
  tabs_default
@@ -21,36 +32,25 @@ import "./chunk-RRAZM5D3.mjs";
21
32
  import {
22
33
  textarea_default
23
34
  } from "./chunk-BKE6QF6W.mjs";
35
+ import "./chunk-DQRAFUDA.mjs";
36
+ import {
37
+ scrollArea_default
38
+ } from "./chunk-M37VBNB3.mjs";
39
+ import "./chunk-QCEKPS7U.mjs";
40
+ import {
41
+ select_default
42
+ } from "./chunk-E4UUZOR4.mjs";
24
43
  import "./chunk-LVFI2NOH.mjs";
25
44
  import {
26
45
  switch_default
27
46
  } from "./chunk-Z74QNVPG.mjs";
28
- import "./chunk-LUWGOKLG.mjs";
29
- import {
30
- ToastProvider,
31
- useToast
32
- } from "./chunk-UAHTRCKG.mjs";
33
- import {
34
- toast_default
35
- } from "./chunk-OUAKGMDW.mjs";
36
- import "./chunk-ZOTHPHXA.mjs";
37
- import "./chunk-DX3KXNP6.mjs";
38
- import {
39
- form_table_default
40
- } from "./chunk-ICZTNO4V.mjs";
41
- import {
42
- table_default
43
- } from "./chunk-6EU5GUL5.mjs";
44
- import "./chunk-DQRAFUDA.mjs";
45
47
  import {
46
- scrollArea_default
47
- } from "./chunk-M37VBNB3.mjs";
48
- import "./chunk-XRC5OUYQ.mjs";
49
- import "./chunk-EAK5DVWA.mjs";
48
+ definition_table_default
49
+ } from "./chunk-6TIIBU7J.mjs";
50
50
  import "./chunk-7B7LRG5J.mjs";
51
51
  import {
52
52
  pagination_default
53
- } from "./chunk-IVK24VIL.mjs";
53
+ } from "./chunk-C7OF5HJF.mjs";
54
54
  import "./chunk-F3HENRVM.mjs";
55
55
  import "./chunk-TPFN22HR.mjs";
56
56
  import {
@@ -59,7 +59,7 @@ import {
59
59
  import "./chunk-2GCSFWHD.mjs";
60
60
  import {
61
61
  input_default
62
- } from "./chunk-P5PJTJLY.mjs";
62
+ } from "./chunk-GRA2LU42.mjs";
63
63
  import "./chunk-DJOG6Z35.mjs";
64
64
  import {
65
65
  modal_default
@@ -98,7 +98,7 @@ import {
98
98
  import "./chunk-KYIODWXL.mjs";
99
99
  import {
100
100
  breadcrumb_default
101
- } from "./chunk-Y27H2AMV.mjs";
101
+ } from "./chunk-IRAHS4WS.mjs";
102
102
  import "./chunk-MY5U63QO.mjs";
103
103
  import {
104
104
  button_group_default
@@ -137,7 +137,7 @@ export {
137
137
  checkbox_default as CheckBox,
138
138
  chip_default as Chip,
139
139
  dateTimePicker_default as DateTimePicker,
140
- form_table_default as FormTable,
140
+ definition_table_default as DefinitionTable,
141
141
  Icon_default as Icon,
142
142
  icon_button_default as IconButton,
143
143
  input_default as Input,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deepnoid/ui",
3
- "version": "0.1.25",
3
+ "version": "0.1.27",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "exports": {