@underverse-ui/underverse 1.0.89 → 1.0.90

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "package": "@underverse-ui/underverse",
3
- "version": "1.0.89",
3
+ "version": "1.0.90",
4
4
  "sourceEntry": "src/index.ts",
5
5
  "totalExports": 225,
6
6
  "exports": [
package/dist/index.cjs CHANGED
@@ -16863,6 +16863,11 @@ var defaultLabels = {
16863
16863
  searchPlaceholder: "Search...",
16864
16864
  noResultsText: "No results found"
16865
16865
  };
16866
+ var TREE_NODE_BASE_PADDING_REM = 0.75;
16867
+ var TREE_NODE_INDENT_REM = 1;
16868
+ var TREE_BRANCH_OFFSET_CLASS = "ml-1.5 pl-1.5";
16869
+ var TREE_NODE_GAP_CLASS = "gap-1.5";
16870
+ var TREE_EXPANDER_PLACEHOLDER_CLASS = "w-5";
16866
16871
  function getInitialExpandedNodes(categories, defaultExpanded, viewOnly, inline) {
16867
16872
  if (!(viewOnly || inline) || !defaultExpanded) return /* @__PURE__ */ new Set();
16868
16873
  const parentIds = /* @__PURE__ */ new Set();
@@ -17051,13 +17056,14 @@ function CategoryTreeSelect(props) {
17051
17056
  {
17052
17057
  onClick: () => !viewOnly && handleSelect(category.id, category),
17053
17058
  className: cn(
17054
- "relative flex min-w-0 items-center gap-2.5 px-3 py-2.5 min-h-11 transition-all duration-200 rounded-3xl",
17059
+ "relative flex min-w-0 items-center px-3 py-2.5 min-h-11 transition-all duration-200 rounded-3xl",
17060
+ TREE_NODE_GAP_CLASS,
17055
17061
  !viewOnly && (isSelectable ? "cursor-pointer" : "cursor-default"),
17056
17062
  isSelectable && !isSelected && "hover:bg-accent/50",
17057
17063
  // Selected state - đồng bộ cho tất cả
17058
17064
  !viewOnly && isSelected && "bg-accent/40"
17059
17065
  ),
17060
- style: { paddingLeft: `${level * 1.25 + 0.75}rem` },
17066
+ style: { paddingLeft: `${level * TREE_NODE_INDENT_REM + TREE_NODE_BASE_PADDING_REM}rem` },
17061
17067
  children: [
17062
17068
  hasChildren ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
17063
17069
  "button",
@@ -17068,7 +17074,7 @@ function CategoryTreeSelect(props) {
17068
17074
  toggleExpand(category.id);
17069
17075
  },
17070
17076
  className: cn(
17071
- "p-1.5 rounded-lg transition-all duration-200",
17077
+ "p-0.5 rounded-lg transition-all duration-200",
17072
17078
  "hover:scale-110 active:scale-95",
17073
17079
  "focus:outline-none focus-visible:ring-2 focus-visible:ring-primary/50",
17074
17080
  isExpanded && "text-primary",
@@ -17077,16 +17083,16 @@ function CategoryTreeSelect(props) {
17077
17083
  disabled: isSearchMode,
17078
17084
  children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: cn("transition-transform duration-200", isExpanded && "rotate-90"), children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_lucide_react26.ChevronRight, { className: "w-4 h-4" }) })
17079
17085
  }
17080
- ) : /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { className: "w-7" }),
17086
+ ) : /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { className: TREE_EXPANDER_PLACEHOLDER_CLASS }),
17081
17087
  viewOnly ? (
17082
17088
  // View-only mode: just display the name with folder icon
17083
- /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex min-w-0 items-center gap-2.5", children: [
17089
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: cn("flex min-w-0 items-center", TREE_NODE_GAP_CLASS), children: [
17084
17090
  category.icon ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: "h-4 w-4 shrink-0 flex items-center justify-center text-muted-foreground/60", children: category.icon }) : hasChildren ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_lucide_react26.FolderTree, { className: "h-4 w-4 shrink-0 text-muted-foreground/60" }) : /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: "h-1.5 w-1.5 shrink-0 rounded-full bg-muted-foreground/40" }),
17085
17091
  /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("span", { className: "min-w-0 text-sm font-medium leading-snug break-words [overflow-wrap:anywhere]", children: category.name })
17086
17092
  ] })
17087
17093
  ) : (
17088
17094
  // Single/Multi select mode: icon + text + badge
17089
- /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "flex min-w-0 flex-1 items-center gap-2.5 overflow-hidden", children: [
17095
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: cn("flex min-w-0 flex-1 items-center overflow-hidden", TREE_NODE_GAP_CLASS), children: [
17090
17096
  category.icon && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: "h-4 w-4 shrink-0 flex items-center justify-center text-current", children: category.icon }),
17091
17097
  /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
17092
17098
  "span",
@@ -17105,7 +17111,17 @@ function CategoryTreeSelect(props) {
17105
17111
  ]
17106
17112
  }
17107
17113
  ),
17108
- hasChildren && isExpanded && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: cn("ml-2 pl-2 border-l-2 border-dashed border-border/50", "animate-in slide-in-from-top-2 fade-in-50 duration-200"), children: children.map((child) => renderCategory(child, level + 1)) })
17114
+ hasChildren && isExpanded && /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
17115
+ "div",
17116
+ {
17117
+ className: cn(
17118
+ TREE_BRANCH_OFFSET_CLASS,
17119
+ "border-l-2 border-dashed border-border/50",
17120
+ "animate-in slide-in-from-top-2 fade-in-50 duration-200"
17121
+ ),
17122
+ children: children.map((child) => renderCategory(child, level + 1))
17123
+ }
17124
+ )
17109
17125
  ]
17110
17126
  },
17111
17127
  category.id