@underverse-ui/underverse 0.2.114 → 0.2.115

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.cjs CHANGED
@@ -12539,8 +12539,9 @@ function CategoryTreeSelect(props) {
12539
12539
  /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
12540
12540
  "div",
12541
12541
  {
12542
+ onClick: () => !viewOnly && handleSelect(category.id, category),
12542
12543
  className: cn(
12543
- "relative flex items-center gap-2.5 px-3 py-2.5 transition-all duration-200 rounded-lg",
12544
+ "relative flex items-center gap-2.5 px-3 py-2.5 min-h-11 transition-all duration-200 rounded-lg",
12544
12545
  // Không phân biệt parent/child - đồng bộ màu
12545
12546
  !viewOnly && "cursor-pointer",
12546
12547
  !viewOnly && !isSelected && "hover:bg-accent/50",
@@ -12559,9 +12560,9 @@ function CategoryTreeSelect(props) {
12559
12560
  },
12560
12561
  className: cn(
12561
12562
  "p-1.5 rounded-lg transition-all duration-200",
12562
- "hover:bg-accent hover:scale-110 active:scale-95",
12563
+ "hover:scale-110 active:scale-95",
12563
12564
  "focus:outline-none focus-visible:ring-2 focus-visible:ring-primary/50",
12564
- isExpanded && "bg-accent/50 text-primary"
12565
+ isExpanded && "text-primary"
12565
12566
  ),
12566
12567
  children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: cn("transition-transform duration-200", isExpanded && "rotate-90"), children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_lucide_react24.ChevronRight, { className: "w-4 h-4" }) })
12567
12568
  }
@@ -12569,57 +12570,14 @@ function CategoryTreeSelect(props) {
12569
12570
  viewOnly ? (
12570
12571
  // View-only mode: just display the name with folder icon
12571
12572
  /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex items-center gap-2.5", children: [
12572
- hasChildren ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_lucide_react24.FolderTree, { className: "w-4 h-4 text-muted-foreground/60" }) : /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "w-1.5 h-1.5 rounded-full bg-muted-foreground/40" }),
12573
+ category.icon ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "w-4 h-4 flex items-center justify-center text-muted-foreground/60", children: category.icon }) : hasChildren ? /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_lucide_react24.FolderTree, { className: "w-4 h-4 text-muted-foreground/60" }) : /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "w-1.5 h-1.5 rounded-full bg-muted-foreground/40" }),
12573
12574
  /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "text-sm font-medium", children: category.name })
12574
12575
  ] })
12575
- ) : singleSelect ? (
12576
- // Single select mode: radio-style indicator
12577
- /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { onClick: () => handleSelect(category.id, category), className: "flex items-center gap-2.5 flex-1", children: [
12578
- /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
12579
- "div",
12580
- {
12581
- className: cn(
12582
- "w-5 h-5 border-2 rounded-full flex items-center justify-center transition-all duration-200",
12583
- isSelected ? "border-primary bg-primary/10 shadow-sm shadow-primary/20" : "border-muted-foreground/30 hover:border-primary/50"
12584
- ),
12585
- children: isSelected && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "w-2.5 h-2.5 rounded-full bg-linear-to-br from-primary to-primary/80 shadow-sm" })
12586
- }
12587
- ),
12588
- /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
12589
- "span",
12590
- {
12591
- className: cn(
12592
- "text-sm transition-all duration-200",
12593
- isSelected ? "font-semibold text-primary" : "text-foreground/80 hover:text-foreground"
12594
- ),
12595
- children: category.name
12596
- }
12597
- ),
12598
- hasChildren && !isSelected && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "ml-auto text-[10px] font-medium text-muted-foreground/50 bg-muted/50 px-1.5 py-0.5 rounded-md", children: children.length })
12599
- ] })
12600
12576
  ) : (
12601
- // Multi select mode: checkbox-style indicator
12602
- /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { onClick: () => handleSelect(category.id, category), className: "flex items-center gap-2.5 flex-1", children: [
12603
- /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
12604
- "div",
12605
- {
12606
- className: cn(
12607
- "w-5 h-5 border-2 rounded-lg flex items-center justify-center transition-all duration-200",
12608
- isSelected ? "bg-linear-to-br from-primary to-primary/80 border-primary shadow-sm shadow-primary/25" : "border-muted-foreground/30 hover:border-primary/50 hover:bg-primary/5"
12609
- ),
12610
- children: isSelected && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_lucide_react24.Check, { className: "w-3 h-3 text-primary-foreground", strokeWidth: 3 })
12611
- }
12612
- ),
12613
- /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(
12614
- "span",
12615
- {
12616
- className: cn(
12617
- "text-sm transition-all duration-200",
12618
- isSelected ? "font-semibold text-primary" : "text-foreground/80 hover:text-foreground"
12619
- ),
12620
- children: category.name
12621
- }
12622
- ),
12577
+ // Single/Multi select mode: icon + text + badge
12578
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex items-center gap-2.5 flex-1", children: [
12579
+ category.icon && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "w-4 h-4 flex items-center justify-center text-current", children: category.icon }),
12580
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: cn("text-sm transition-all duration-200", isSelected ? "font-semibold text-primary" : "text-foreground/80"), children: category.name }),
12623
12581
  hasChildren && !isSelected && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "ml-auto text-[10px] font-medium text-muted-foreground/50 bg-muted/50 px-1.5 py-0.5 rounded-md", children: children.length })
12624
12582
  ] })
12625
12583
  )
@@ -12650,7 +12608,19 @@ function CategoryTreeSelect(props) {
12650
12608
  );
12651
12609
  }
12652
12610
  const selectedCount = valueArray.length;
12653
- const displayText = singleSelect ? selectedCount > 0 ? categories.find((c) => c.id === valueArray[0])?.name || placeholder : placeholder : selectedCount > 0 ? mergedLabels.selectedText(selectedCount) : placeholder;
12611
+ let displayText;
12612
+ if (singleSelect) {
12613
+ displayText = selectedCount > 0 ? categories.find((c) => c.id === valueArray[0])?.name || placeholder : placeholder;
12614
+ } else {
12615
+ if (selectedCount === 0) {
12616
+ displayText = placeholder;
12617
+ } else if (selectedCount <= 3) {
12618
+ const selectedNames = valueArray.map((id) => categories.find((c) => c.id === id)?.name).filter(Boolean).join(", ");
12619
+ displayText = selectedNames || placeholder;
12620
+ } else {
12621
+ displayText = mergedLabels.selectedText(selectedCount);
12622
+ }
12623
+ }
12654
12624
  return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: cn("relative", className), children: [
12655
12625
  /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
12656
12626
  "button",
@@ -12695,7 +12665,7 @@ function CategoryTreeSelect(props) {
12695
12665
  {
12696
12666
  className: cn(
12697
12667
  "absolute z-20 mt-2 w-full max-h-80 overflow-auto",
12698
- "rounded-2xl md:rounded-3xl overflow-hidden border border-border/40 bg-popover/95 text-popover-foreground",
12668
+ "rounded-2xl md:rounded-3xl border border-border/40 bg-popover/95 text-popover-foreground",
12699
12669
  "shadow-2xl backdrop-blur-xl",
12700
12670
  "p-2",
12701
12671
  "animate-in fade-in-0 zoom-in-95 slide-in-from-top-2 duration-300"