@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
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,
@@ -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: {
@@ -10002,76 +9995,151 @@ var dateTimePickerStyle = tv({
10002
9995
  var import_react34 = require("react");
10003
9996
  var import_jsx_runtime34 = require("react/jsx-runtime");
10004
9997
  var TreeNodeItem = (0, import_react34.forwardRef)(
10005
- ({ node, depth, fileIcon, isLoading, classNames }, ref) => {
10006
- var _a;
9998
+ ({ node, depth, fileIcon, isLoading, classNames, onExpand }, ref) => {
10007
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);
10008
10002
  const slots = (0, import_react34.useMemo)(() => treeStyle(), []);
10009
- const toggleOpen = (0, import_react34.useCallback)(() => {
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
+ }
10010
10020
  setIsOpen((prev) => !prev);
10011
- }, []);
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]";
10012
10033
  return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
10013
10034
  "div",
10014
10035
  {
10015
10036
  ref,
10016
10037
  className: clsx(
10017
- depth > 1 ? "ml-[30px]" : "",
10038
+ marginClass,
10018
10039
  "transition-all duration-150 ease-out",
10019
10040
  isLoading ? "-translate-y-2 opacity-0" : "translate-y-0 opacity-100"
10020
10041
  ),
10021
10042
  children: [
10022
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: slots.wrapper({ class: classNames == null ? void 0 : classNames.wrapper }), onClick: toggleOpen, children: [
10023
- node.children && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
10024
- Icon_default,
10043
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
10044
+ "div",
10045
+ {
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
+ ]
10063
+ }
10064
+ ),
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,
10025
10069
  {
10026
- name: "right-chevron",
10027
- className: `text-neutral-main cursor-pointer transition-transform duration-150 ${isOpen ? "rotate-90" : "rotate-0"}`
10028
- }
10029
- ),
10030
- fileIcon,
10031
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: slots.label({ class: classNames == null ? void 0 : classNames.label }), onClick: () => {
10032
- var _a2;
10033
- return (_a2 = node.onClick) == null ? void 0 : _a2.call(node);
10034
- }, children: node.label })
10035
- ] }),
10036
- 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)))
10070
+ node: child,
10071
+ depth: depth + 1,
10072
+ classNames,
10073
+ fileIcon,
10074
+ onExpand
10075
+ },
10076
+ child.id
10077
+ ))
10078
+ ] })
10037
10079
  ]
10038
10080
  }
10039
10081
  );
10040
10082
  }
10041
10083
  );
10042
- var Tree = (0, import_react34.forwardRef)(
10043
- ({ headerContent, group, groupIcon, fileIcon, isLoading, classNames }, ref) => {
10044
- const { label, data, onClick } = group;
10045
- const slots = (0, import_react34.useMemo)(() => treeStyle(), []);
10046
- return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { ref, className: slots.base({ class: classNames == null ? void 0 : classNames.base }), children: [
10047
- headerContent && /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { children: headerContent }),
10048
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { children: [
10049
- /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)("div", { className: slots.wrapper({ class: classNames == null ? void 0 : classNames.wrapper }), children: [
10050
- groupIcon,
10051
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: slots.label({ class: classNames == null ? void 0 : classNames.label }), onClick, children: label })
10052
- ] }),
10053
- data.map((node) => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
10054
- TreeNodeItem,
10055
- {
10056
- node,
10057
- depth: 1,
10058
- classNames,
10059
- fileIcon,
10060
- isLoading
10061
- },
10062
- node.id
10063
- ))
10064
- ] })
10065
- ] });
10066
- }
10067
- );
10068
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
+ };
10069
10136
  Tree.displayName = "Tree";
10070
10137
  var tree_default = Tree;
10071
10138
  var treeStyle = tv({
10072
10139
  slots: {
10073
10140
  base: ["border", "border-neutral-light", "rounded-xl", "p-[20px]", "flex", "flex-col", "gap-[20px]", "select-none"],
10074
- wrapper: [
10141
+ wrapper: ["flex", "flex-col", "gap-[5px]"],
10142
+ group: [
10075
10143
  "flex",
10076
10144
  "items-center",
10077
10145
  "gap-[5px]",
@@ -10080,9 +10148,9 @@ var treeStyle = tv({
10080
10148
  "text-body-foreground",
10081
10149
  "hover:bg-neutral-soft",
10082
10150
  "p-[5px]",
10083
- "rounded-[5px]"
10084
- ],
10085
- label: ["cursor-pointer"]
10151
+ "rounded-[5px]",
10152
+ "cursor-pointer"
10153
+ ]
10086
10154
  }
10087
10155
  });
10088
10156
  // Annotate the CommonJS export names for ESM import in node:
@@ -10095,7 +10163,7 @@ var treeStyle = tv({
10095
10163
  CheckBox,
10096
10164
  Chip,
10097
10165
  DateTimePicker,
10098
- FormTable,
10166
+ DefinitionTable,
10099
10167
  Icon,
10100
10168
  IconButton,
10101
10169
  Input,
package/dist/index.mjs CHANGED
@@ -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-LUWGOKLG.mjs";
7
7
  import {
8
8
  ToastProvider,
@@ -21,9 +21,9 @@ import "./chunk-WSIADHVC.mjs";
21
21
  import "./chunk-DX3KXNP6.mjs";
22
22
  import {
23
23
  table_default
24
- } from "./chunk-6OMHIMIA.mjs";
24
+ } from "./chunk-XA6PVFTW.mjs";
25
25
  import "./chunk-XRC5OUYQ.mjs";
26
- import "./chunk-EAK5DVWA.mjs";
26
+ import "./chunk-UNH3BCGN.mjs";
27
27
  import "./chunk-3MY6LO7N.mjs";
28
28
  import {
29
29
  tabs_default
@@ -39,18 +39,18 @@ import {
39
39
  import "./chunk-QCEKPS7U.mjs";
40
40
  import {
41
41
  select_default
42
- } from "./chunk-MSAULFDB.mjs";
42
+ } from "./chunk-E4UUZOR4.mjs";
43
43
  import "./chunk-LVFI2NOH.mjs";
44
44
  import {
45
45
  switch_default
46
46
  } from "./chunk-Z74QNVPG.mjs";
47
47
  import {
48
- form_table_default
49
- } from "./chunk-ICZTNO4V.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
@@ -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.26",
3
+ "version": "0.1.27",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "exports": {
@@ -1,49 +0,0 @@
1
- "use client";
2
- import {
3
- tv
4
- } from "./chunk-4ZJFD3L3.mjs";
5
-
6
- // src/components/table/form-table.tsx
7
- import { forwardRef, useMemo } from "react";
8
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
9
- var DEFAULT_COLUMN_CLASSES = [
10
- "w-[120px] px-[10px] py-[9.5px] font-bold text-md text-body-foreground border-r border-neutral-light",
11
- "px-[10px] py-[9.5px]"
12
- ];
13
- var FormTableRow = ({ columns, columnClasses = [] }) => /* @__PURE__ */ jsx("tr", { className: "border-neutral-light min-h-[50px] border-b", children: columns.map((col, index) => {
14
- var _a;
15
- return /* @__PURE__ */ jsx("td", { className: (_a = columnClasses[index]) != null ? _a : DEFAULT_COLUMN_CLASSES[index], children: col }, index);
16
- }) });
17
- var FormTable = forwardRef(
18
- ({ rows, onSubmit, footer, classNames }, ref) => {
19
- const slots = useMemo(() => formTableStyle(), []);
20
- const content = /* @__PURE__ */ jsxs(Fragment, { children: [
21
- /* @__PURE__ */ jsx("table", { className: slots.table({ class: classNames == null ? void 0 : classNames.table }), children: /* @__PURE__ */ jsx("tbody", { children: rows.map((row, i) => /* @__PURE__ */ jsx(FormTableRow, { ...row }, i)) }) }),
22
- footer && /* @__PURE__ */ jsx("div", { children: footer })
23
- ] });
24
- if (onSubmit) {
25
- return /* @__PURE__ */ jsx(
26
- "form",
27
- {
28
- ref,
29
- onSubmit,
30
- className: slots.base({ class: classNames == null ? void 0 : classNames.base }),
31
- children: content
32
- }
33
- );
34
- }
35
- return /* @__PURE__ */ jsx("div", { ref, className: slots.base({ class: classNames == null ? void 0 : classNames.base }), children: content });
36
- }
37
- );
38
- FormTable.displayName = "FormTable";
39
- var form_table_default = FormTable;
40
- var formTableStyle = tv({
41
- slots: {
42
- base: ["flex", "flex-col", "gap-[30px]"],
43
- table: ["w-full", "table-fixed", "border", "border-neutral-light"]
44
- }
45
- });
46
-
47
- export {
48
- form_table_default
49
- };