@underverse-ui/underverse 1.0.78 → 1.0.80

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.78",
3
+ "version": "1.0.80",
4
4
  "sourceEntry": "src/index.ts",
5
5
  "totalExports": 225,
6
6
  "exports": [
package/dist/index.cjs CHANGED
@@ -4051,7 +4051,7 @@ var EmojiPicker = ({
4051
4051
  className
4052
4052
  ),
4053
4053
  children: [
4054
- showSearch && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: cn("shrink-0 border-b p-3", isEmbedded ? "bg-transparent" : "bg-muted/30"), children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "relative", children: [
4054
+ showSearch && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "shrink-0 border-b p-3 bg-transparent", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "relative", children: [
4055
4055
  /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_lucide_react4.Search, { className: "absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" }),
4056
4056
  /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
4057
4057
  "input",
@@ -4061,7 +4061,7 @@ var EmojiPicker = ({
4061
4061
  value: search,
4062
4062
  onChange: (e) => setSearch(e.target.value),
4063
4063
  className: cn(
4064
- "w-full rounded-full border border-border bg-background py-2 pl-9 pr-9 text-sm",
4064
+ "w-full rounded-full border border-border bg-background/90 py-2 pl-9 pr-9 text-sm shadow-sm",
4065
4065
  "placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-primary/20"
4066
4066
  )
4067
4067
  }
@@ -16375,6 +16375,7 @@ function CategoryTreeSelect(props) {
16375
16375
  onNodeClick,
16376
16376
  className,
16377
16377
  useOverlayScrollbar = false,
16378
+ leafOnlySelect = false,
16378
16379
  singleSelect = false
16379
16380
  } = props;
16380
16381
  const [isOpen, setIsOpen] = (0, import_react22.useState)(false);
@@ -16470,7 +16471,12 @@ function CategoryTreeSelect(props) {
16470
16471
  };
16471
16472
  const handleSelect = (categoryId, category) => {
16472
16473
  if (viewOnly) return;
16474
+ const hasChildren = (childrenMap.get(categoryId) ?? []).length > 0;
16473
16475
  onNodeClick?.(category);
16476
+ if (leafOnlySelect && hasChildren) {
16477
+ toggleExpand(categoryId);
16478
+ return;
16479
+ }
16474
16480
  if (!props.onChange) return;
16475
16481
  if (singleSelect) {
16476
16482
  const onChange = props.onChange;
@@ -16504,6 +16510,7 @@ function CategoryTreeSelect(props) {
16504
16510
  const hasChildren = children.length > 0;
16505
16511
  const isExpanded = hasChildren && (isSearchMode || expandedNodes.has(category.id));
16506
16512
  const isSelected = selectedIds.has(category.id);
16513
+ const isSelectable = !viewOnly && (!leafOnlySelect || !hasChildren);
16507
16514
  return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(
16508
16515
  "div",
16509
16516
  {
@@ -16516,9 +16523,8 @@ function CategoryTreeSelect(props) {
16516
16523
  onClick: () => !viewOnly && handleSelect(category.id, category),
16517
16524
  className: cn(
16518
16525
  "relative flex min-w-0 items-center gap-2.5 px-3 py-2.5 min-h-11 transition-all duration-200 rounded-3xl",
16519
- // Không phân biệt parent/child - đồng bộ màu
16520
- !viewOnly && "cursor-pointer",
16521
- !viewOnly && !isSelected && "hover:bg-accent/50",
16526
+ !viewOnly && (isSelectable ? "cursor-pointer" : "cursor-default"),
16527
+ isSelectable && !isSelected && "hover:bg-accent/50",
16522
16528
  // Selected state - đồng bộ cho tất cả
16523
16529
  !viewOnly && isSelected && "bg-accent/40"
16524
16530
  ),
@@ -16558,7 +16564,8 @@ function CategoryTreeSelect(props) {
16558
16564
  {
16559
16565
  className: cn(
16560
16566
  "min-w-0 flex-1 text-sm leading-snug break-words [overflow-wrap:anywhere] transition-all duration-200",
16561
- isSelected ? "font-semibold text-primary" : "text-foreground/80"
16567
+ isSelected ? "font-semibold text-primary" : "text-foreground/80",
16568
+ !isSelectable && "text-foreground"
16562
16569
  ),
16563
16570
  children: category.name
16564
16571
  }
@@ -16577,7 +16584,7 @@ function CategoryTreeSelect(props) {
16577
16584
  };
16578
16585
  const renderSearch = ({ sticky = true, className: className2 } = {}) => {
16579
16586
  if (!isSearchEnabled) return null;
16580
- return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: cn(sticky && "sticky top-0 z-10 bg-popover/85 pb-2 backdrop-blur-xl", className2), children: /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "relative", children: [
16587
+ return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)("div", { className: cn(sticky && "sticky top-0 z-10 pb-2", className2), children: /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)("div", { className: "relative", children: [
16581
16588
  /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_lucide_react26.Search, { className: "absolute left-3.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground/60 transition-colors peer-focus:text-primary" }),
16582
16589
  /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
16583
16590
  "input",
@@ -16587,7 +16594,7 @@ function CategoryTreeSelect(props) {
16587
16594
  onChange: (e) => setQuery(e.target.value),
16588
16595
  placeholder: mergedLabels.searchPlaceholder,
16589
16596
  className: cn(
16590
- "peer w-full rounded-full bg-muted/40 py-2.5 pl-10 pr-10 text-sm",
16597
+ "peer w-full rounded-full bg-background/90 py-2.5 pl-10 pr-10 text-sm shadow-sm",
16591
16598
  "border border-border/30",
16592
16599
  "focus:outline-none focus:bg-background focus:border-primary/30 focus:ring-2 focus:ring-primary/10",
16593
16600
  "transition-all duration-200",