@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.
- package/api-reference.json +1 -1
- package/dist/index.cjs +15 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +15 -8
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1691,6 +1691,8 @@ interface CategoryTreeSelectBaseProps {
|
|
|
1691
1691
|
className?: string;
|
|
1692
1692
|
/** Enable OverlayScrollbars for dropdown tree viewport. Default: false */
|
|
1693
1693
|
useOverlayScrollbar?: boolean;
|
|
1694
|
+
/** When true, only leaf nodes can be selected; parent nodes only expand/collapse */
|
|
1695
|
+
leafOnlySelect?: boolean;
|
|
1694
1696
|
}
|
|
1695
1697
|
interface CategoryTreeSelectMultiProps extends CategoryTreeSelectBaseProps {
|
|
1696
1698
|
singleSelect?: false;
|
package/dist/index.d.ts
CHANGED
|
@@ -1691,6 +1691,8 @@ interface CategoryTreeSelectBaseProps {
|
|
|
1691
1691
|
className?: string;
|
|
1692
1692
|
/** Enable OverlayScrollbars for dropdown tree viewport. Default: false */
|
|
1693
1693
|
useOverlayScrollbar?: boolean;
|
|
1694
|
+
/** When true, only leaf nodes can be selected; parent nodes only expand/collapse */
|
|
1695
|
+
leafOnlySelect?: boolean;
|
|
1694
1696
|
}
|
|
1695
1697
|
interface CategoryTreeSelectMultiProps extends CategoryTreeSelectBaseProps {
|
|
1696
1698
|
singleSelect?: false;
|
package/dist/index.js
CHANGED
|
@@ -3866,7 +3866,7 @@ var EmojiPicker = ({
|
|
|
3866
3866
|
className
|
|
3867
3867
|
),
|
|
3868
3868
|
children: [
|
|
3869
|
-
showSearch && /* @__PURE__ */ jsx12("div", { className:
|
|
3869
|
+
showSearch && /* @__PURE__ */ jsx12("div", { className: "shrink-0 border-b p-3 bg-transparent", children: /* @__PURE__ */ jsxs7("div", { className: "relative", children: [
|
|
3870
3870
|
/* @__PURE__ */ jsx12(Search2, { className: "absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" }),
|
|
3871
3871
|
/* @__PURE__ */ jsx12(
|
|
3872
3872
|
"input",
|
|
@@ -3876,7 +3876,7 @@ var EmojiPicker = ({
|
|
|
3876
3876
|
value: search,
|
|
3877
3877
|
onChange: (e) => setSearch(e.target.value),
|
|
3878
3878
|
className: cn(
|
|
3879
|
-
"w-full rounded-full border border-border bg-background py-2 pl-9 pr-9 text-sm",
|
|
3879
|
+
"w-full rounded-full border border-border bg-background/90 py-2 pl-9 pr-9 text-sm shadow-sm",
|
|
3880
3880
|
"placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-primary/20"
|
|
3881
3881
|
)
|
|
3882
3882
|
}
|
|
@@ -16190,6 +16190,7 @@ function CategoryTreeSelect(props) {
|
|
|
16190
16190
|
onNodeClick,
|
|
16191
16191
|
className,
|
|
16192
16192
|
useOverlayScrollbar = false,
|
|
16193
|
+
leafOnlySelect = false,
|
|
16193
16194
|
singleSelect = false
|
|
16194
16195
|
} = props;
|
|
16195
16196
|
const [isOpen, setIsOpen] = useState30(false);
|
|
@@ -16285,7 +16286,12 @@ function CategoryTreeSelect(props) {
|
|
|
16285
16286
|
};
|
|
16286
16287
|
const handleSelect = (categoryId, category) => {
|
|
16287
16288
|
if (viewOnly) return;
|
|
16289
|
+
const hasChildren = (childrenMap.get(categoryId) ?? []).length > 0;
|
|
16288
16290
|
onNodeClick?.(category);
|
|
16291
|
+
if (leafOnlySelect && hasChildren) {
|
|
16292
|
+
toggleExpand(categoryId);
|
|
16293
|
+
return;
|
|
16294
|
+
}
|
|
16289
16295
|
if (!props.onChange) return;
|
|
16290
16296
|
if (singleSelect) {
|
|
16291
16297
|
const onChange = props.onChange;
|
|
@@ -16319,6 +16325,7 @@ function CategoryTreeSelect(props) {
|
|
|
16319
16325
|
const hasChildren = children.length > 0;
|
|
16320
16326
|
const isExpanded = hasChildren && (isSearchMode || expandedNodes.has(category.id));
|
|
16321
16327
|
const isSelected = selectedIds.has(category.id);
|
|
16328
|
+
const isSelectable = !viewOnly && (!leafOnlySelect || !hasChildren);
|
|
16322
16329
|
return /* @__PURE__ */ jsxs39(
|
|
16323
16330
|
"div",
|
|
16324
16331
|
{
|
|
@@ -16331,9 +16338,8 @@ function CategoryTreeSelect(props) {
|
|
|
16331
16338
|
onClick: () => !viewOnly && handleSelect(category.id, category),
|
|
16332
16339
|
className: cn(
|
|
16333
16340
|
"relative flex min-w-0 items-center gap-2.5 px-3 py-2.5 min-h-11 transition-all duration-200 rounded-3xl",
|
|
16334
|
-
|
|
16335
|
-
!
|
|
16336
|
-
!viewOnly && !isSelected && "hover:bg-accent/50",
|
|
16341
|
+
!viewOnly && (isSelectable ? "cursor-pointer" : "cursor-default"),
|
|
16342
|
+
isSelectable && !isSelected && "hover:bg-accent/50",
|
|
16337
16343
|
// Selected state - đồng bộ cho tất cả
|
|
16338
16344
|
!viewOnly && isSelected && "bg-accent/40"
|
|
16339
16345
|
),
|
|
@@ -16373,7 +16379,8 @@ function CategoryTreeSelect(props) {
|
|
|
16373
16379
|
{
|
|
16374
16380
|
className: cn(
|
|
16375
16381
|
"min-w-0 flex-1 text-sm leading-snug break-words [overflow-wrap:anywhere] transition-all duration-200",
|
|
16376
|
-
isSelected ? "font-semibold text-primary" : "text-foreground/80"
|
|
16382
|
+
isSelected ? "font-semibold text-primary" : "text-foreground/80",
|
|
16383
|
+
!isSelectable && "text-foreground"
|
|
16377
16384
|
),
|
|
16378
16385
|
children: category.name
|
|
16379
16386
|
}
|
|
@@ -16392,7 +16399,7 @@ function CategoryTreeSelect(props) {
|
|
|
16392
16399
|
};
|
|
16393
16400
|
const renderSearch = ({ sticky = true, className: className2 } = {}) => {
|
|
16394
16401
|
if (!isSearchEnabled) return null;
|
|
16395
|
-
return /* @__PURE__ */ jsx49("div", { className: cn(sticky && "sticky top-0 z-10
|
|
16402
|
+
return /* @__PURE__ */ jsx49("div", { className: cn(sticky && "sticky top-0 z-10 pb-2", className2), children: /* @__PURE__ */ jsxs39("div", { className: "relative", children: [
|
|
16396
16403
|
/* @__PURE__ */ jsx49(Search6, { 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" }),
|
|
16397
16404
|
/* @__PURE__ */ jsx49(
|
|
16398
16405
|
"input",
|
|
@@ -16402,7 +16409,7 @@ function CategoryTreeSelect(props) {
|
|
|
16402
16409
|
onChange: (e) => setQuery(e.target.value),
|
|
16403
16410
|
placeholder: mergedLabels.searchPlaceholder,
|
|
16404
16411
|
className: cn(
|
|
16405
|
-
"peer w-full rounded-full bg-
|
|
16412
|
+
"peer w-full rounded-full bg-background/90 py-2.5 pl-10 pr-10 text-sm shadow-sm",
|
|
16406
16413
|
"border border-border/30",
|
|
16407
16414
|
"focus:outline-none focus:bg-background focus:border-primary/30 focus:ring-2 focus:ring-primary/10",
|
|
16408
16415
|
"transition-all duration-200",
|