@underverse-ui/underverse 0.2.114 → 0.2.116

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
@@ -5066,7 +5066,6 @@ var Combobox = ({
5066
5066
  const itemDescription = getOptionDescription(item);
5067
5067
  const itemDisabled = getOptionDisabled(item);
5068
5068
  const isSelected = itemValue === value;
5069
- const isEven = index % 2 === 0;
5070
5069
  return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
5071
5070
  "li",
5072
5071
  {
@@ -5086,7 +5085,6 @@ var Combobox = ({
5086
5085
  "dropdown-item group flex cursor-pointer items-center gap-3 rounded-lg px-3 py-2.5 text-sm",
5087
5086
  "outline-none focus:outline-none focus-visible:outline-none",
5088
5087
  "transition-all duration-150",
5089
- isEven && "bg-muted/40",
5090
5088
  !itemDisabled && "hover:bg-accent/70 hover:shadow-sm",
5091
5089
  !itemDisabled && "focus:bg-accent/80 focus:text-accent-foreground",
5092
5090
  index === activeIndex && !itemDisabled && "bg-accent/60",
@@ -11043,7 +11041,6 @@ var MultiCombobox = ({
11043
11041
  const isDisabled = item.disabled || disabledOptions.includes(item.value);
11044
11042
  const optionIcon = item.icon;
11045
11043
  const optionDesc = item.description;
11046
- const isEven = index % 2 === 0;
11047
11044
  if (renderOption) {
11048
11045
  return /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(
11049
11046
  "li",
@@ -11058,7 +11055,7 @@ var MultiCombobox = ({
11058
11055
  inputRef.current?.focus();
11059
11056
  },
11060
11057
  style: { animationDelay: open ? `${Math.min(index * 20, 200)}ms` : "0ms" },
11061
- className: cn("dropdown-item", isEven && "bg-muted/25", isDisabled && "opacity-50 cursor-not-allowed pointer-events-none"),
11058
+ className: cn("dropdown-item", isDisabled && "opacity-50 cursor-not-allowed pointer-events-none"),
11062
11059
  children: renderOption(item, isSelected)
11063
11060
  },
11064
11061
  item.value
@@ -11080,7 +11077,6 @@ var MultiCombobox = ({
11080
11077
  className: cn(
11081
11078
  "dropdown-item flex cursor-pointer items-center gap-3 rounded-lg transition-all duration-200",
11082
11079
  sizeStyles8[size].item,
11083
- isEven && "bg-muted/25",
11084
11080
  "hover:bg-accent/70 hover:shadow-sm",
11085
11081
  index === activeIndex && "bg-accent/60",
11086
11082
  isSelected && "bg-primary/10 text-primary font-medium",
@@ -12539,8 +12535,9 @@ function CategoryTreeSelect(props) {
12539
12535
  /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
12540
12536
  "div",
12541
12537
  {
12538
+ onClick: () => !viewOnly && handleSelect(category.id, category),
12542
12539
  className: cn(
12543
- "relative flex items-center gap-2.5 px-3 py-2.5 transition-all duration-200 rounded-lg",
12540
+ "relative flex items-center gap-2.5 px-3 py-2.5 min-h-11 transition-all duration-200 rounded-lg",
12544
12541
  // Không phân biệt parent/child - đồng bộ màu
12545
12542
  !viewOnly && "cursor-pointer",
12546
12543
  !viewOnly && !isSelected && "hover:bg-accent/50",
@@ -12559,9 +12556,9 @@ function CategoryTreeSelect(props) {
12559
12556
  },
12560
12557
  className: cn(
12561
12558
  "p-1.5 rounded-lg transition-all duration-200",
12562
- "hover:bg-accent hover:scale-110 active:scale-95",
12559
+ "hover:scale-110 active:scale-95",
12563
12560
  "focus:outline-none focus-visible:ring-2 focus-visible:ring-primary/50",
12564
- isExpanded && "bg-accent/50 text-primary"
12561
+ isExpanded && "text-primary"
12565
12562
  ),
12566
12563
  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
12564
  }
@@ -12569,57 +12566,14 @@ function CategoryTreeSelect(props) {
12569
12566
  viewOnly ? (
12570
12567
  // View-only mode: just display the name with folder icon
12571
12568
  /* @__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" }),
12569
+ 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
12570
  /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("span", { className: "text-sm font-medium", children: category.name })
12574
12571
  ] })
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
12572
  ) : (
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
- ),
12573
+ // Single/Multi select mode: icon + text + badge
12574
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: "flex items-center gap-2.5 flex-1", children: [
12575
+ category.icon && /* @__PURE__ */ (0, import_jsx_runtime43.jsx)("div", { className: "w-4 h-4 flex items-center justify-center text-current", children: category.icon }),
12576
+ /* @__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
12577
  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
12578
  ] })
12625
12579
  )
@@ -12650,7 +12604,19 @@ function CategoryTreeSelect(props) {
12650
12604
  );
12651
12605
  }
12652
12606
  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;
12607
+ let displayText;
12608
+ if (singleSelect) {
12609
+ displayText = selectedCount > 0 ? categories.find((c) => c.id === valueArray[0])?.name || placeholder : placeholder;
12610
+ } else {
12611
+ if (selectedCount === 0) {
12612
+ displayText = placeholder;
12613
+ } else if (selectedCount <= 3) {
12614
+ const selectedNames = valueArray.map((id) => categories.find((c) => c.id === id)?.name).filter(Boolean).join(", ");
12615
+ displayText = selectedNames || placeholder;
12616
+ } else {
12617
+ displayText = mergedLabels.selectedText(selectedCount);
12618
+ }
12619
+ }
12654
12620
  return /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)("div", { className: cn("relative", className), children: [
12655
12621
  /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(
12656
12622
  "button",
@@ -12695,7 +12661,7 @@ function CategoryTreeSelect(props) {
12695
12661
  {
12696
12662
  className: cn(
12697
12663
  "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",
12664
+ "rounded-2xl md:rounded-3xl border border-border/40 bg-popover/95 text-popover-foreground",
12699
12665
  "shadow-2xl backdrop-blur-xl",
12700
12666
  "p-2",
12701
12667
  "animate-in fade-in-0 zoom-in-95 slide-in-from-top-2 duration-300"