@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.
package/dist/index.js CHANGED
@@ -16678,6 +16678,11 @@ var defaultLabels = {
16678
16678
  searchPlaceholder: "Search...",
16679
16679
  noResultsText: "No results found"
16680
16680
  };
16681
+ var TREE_NODE_BASE_PADDING_REM = 0.75;
16682
+ var TREE_NODE_INDENT_REM = 1;
16683
+ var TREE_BRANCH_OFFSET_CLASS = "ml-1.5 pl-1.5";
16684
+ var TREE_NODE_GAP_CLASS = "gap-1.5";
16685
+ var TREE_EXPANDER_PLACEHOLDER_CLASS = "w-5";
16681
16686
  function getInitialExpandedNodes(categories, defaultExpanded, viewOnly, inline) {
16682
16687
  if (!(viewOnly || inline) || !defaultExpanded) return /* @__PURE__ */ new Set();
16683
16688
  const parentIds = /* @__PURE__ */ new Set();
@@ -16866,13 +16871,14 @@ function CategoryTreeSelect(props) {
16866
16871
  {
16867
16872
  onClick: () => !viewOnly && handleSelect(category.id, category),
16868
16873
  className: cn(
16869
- "relative flex min-w-0 items-center gap-2.5 px-3 py-2.5 min-h-11 transition-all duration-200 rounded-3xl",
16874
+ "relative flex min-w-0 items-center px-3 py-2.5 min-h-11 transition-all duration-200 rounded-3xl",
16875
+ TREE_NODE_GAP_CLASS,
16870
16876
  !viewOnly && (isSelectable ? "cursor-pointer" : "cursor-default"),
16871
16877
  isSelectable && !isSelected && "hover:bg-accent/50",
16872
16878
  // Selected state - đồng bộ cho tất cả
16873
16879
  !viewOnly && isSelected && "bg-accent/40"
16874
16880
  ),
16875
- style: { paddingLeft: `${level * 1.25 + 0.75}rem` },
16881
+ style: { paddingLeft: `${level * TREE_NODE_INDENT_REM + TREE_NODE_BASE_PADDING_REM}rem` },
16876
16882
  children: [
16877
16883
  hasChildren ? /* @__PURE__ */ jsx49(
16878
16884
  "button",
@@ -16883,7 +16889,7 @@ function CategoryTreeSelect(props) {
16883
16889
  toggleExpand(category.id);
16884
16890
  },
16885
16891
  className: cn(
16886
- "p-1.5 rounded-lg transition-all duration-200",
16892
+ "p-0.5 rounded-lg transition-all duration-200",
16887
16893
  "hover:scale-110 active:scale-95",
16888
16894
  "focus:outline-none focus-visible:ring-2 focus-visible:ring-primary/50",
16889
16895
  isExpanded && "text-primary",
@@ -16892,16 +16898,16 @@ function CategoryTreeSelect(props) {
16892
16898
  disabled: isSearchMode,
16893
16899
  children: /* @__PURE__ */ jsx49("div", { className: cn("transition-transform duration-200", isExpanded && "rotate-90"), children: /* @__PURE__ */ jsx49(ChevronRight6, { className: "w-4 h-4" }) })
16894
16900
  }
16895
- ) : /* @__PURE__ */ jsx49("span", { className: "w-7" }),
16901
+ ) : /* @__PURE__ */ jsx49("span", { className: TREE_EXPANDER_PLACEHOLDER_CLASS }),
16896
16902
  viewOnly ? (
16897
16903
  // View-only mode: just display the name with folder icon
16898
- /* @__PURE__ */ jsxs39("div", { className: "flex min-w-0 items-center gap-2.5", children: [
16904
+ /* @__PURE__ */ jsxs39("div", { className: cn("flex min-w-0 items-center", TREE_NODE_GAP_CLASS), children: [
16899
16905
  category.icon ? /* @__PURE__ */ jsx49("div", { className: "h-4 w-4 shrink-0 flex items-center justify-center text-muted-foreground/60", children: category.icon }) : hasChildren ? /* @__PURE__ */ jsx49(FolderTree, { className: "h-4 w-4 shrink-0 text-muted-foreground/60" }) : /* @__PURE__ */ jsx49("div", { className: "h-1.5 w-1.5 shrink-0 rounded-full bg-muted-foreground/40" }),
16900
16906
  /* @__PURE__ */ jsx49("span", { className: "min-w-0 text-sm font-medium leading-snug break-words [overflow-wrap:anywhere]", children: category.name })
16901
16907
  ] })
16902
16908
  ) : (
16903
16909
  // Single/Multi select mode: icon + text + badge
16904
- /* @__PURE__ */ jsxs39("div", { className: "flex min-w-0 flex-1 items-center gap-2.5 overflow-hidden", children: [
16910
+ /* @__PURE__ */ jsxs39("div", { className: cn("flex min-w-0 flex-1 items-center overflow-hidden", TREE_NODE_GAP_CLASS), children: [
16905
16911
  category.icon && /* @__PURE__ */ jsx49("div", { className: "h-4 w-4 shrink-0 flex items-center justify-center text-current", children: category.icon }),
16906
16912
  /* @__PURE__ */ jsx49(
16907
16913
  "span",
@@ -16920,7 +16926,17 @@ function CategoryTreeSelect(props) {
16920
16926
  ]
16921
16927
  }
16922
16928
  ),
16923
- hasChildren && isExpanded && /* @__PURE__ */ jsx49("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)) })
16929
+ hasChildren && isExpanded && /* @__PURE__ */ jsx49(
16930
+ "div",
16931
+ {
16932
+ className: cn(
16933
+ TREE_BRANCH_OFFSET_CLASS,
16934
+ "border-l-2 border-dashed border-border/50",
16935
+ "animate-in slide-in-from-top-2 fade-in-50 duration-200"
16936
+ ),
16937
+ children: children.map((child) => renderCategory(child, level + 1))
16938
+ }
16939
+ )
16924
16940
  ]
16925
16941
  },
16926
16942
  category.id