@underverse-ui/underverse 1.0.89 → 1.0.91
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 +43 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +43 -8
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -16236,6 +16236,25 @@ Slider.displayName = "Slider";
|
|
|
16236
16236
|
import { Dot as Dot2, Maximize2, Pause, Play, RotateCcw, RotateCw, Volume2, VolumeX } from "lucide-react";
|
|
16237
16237
|
import React42 from "react";
|
|
16238
16238
|
import { Fragment as Fragment15, jsx as jsx48, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
16239
|
+
function resolveKeyboardEventElement(target) {
|
|
16240
|
+
if (target instanceof Element) return target;
|
|
16241
|
+
if (target instanceof Node) return target.parentElement;
|
|
16242
|
+
return null;
|
|
16243
|
+
}
|
|
16244
|
+
function isEditableKeyboardTarget(target) {
|
|
16245
|
+
const element = resolveKeyboardEventElement(target);
|
|
16246
|
+
if (!element) return false;
|
|
16247
|
+
if (element instanceof HTMLInputElement || element instanceof HTMLTextAreaElement || element instanceof HTMLSelectElement) {
|
|
16248
|
+
return true;
|
|
16249
|
+
}
|
|
16250
|
+
if (element instanceof HTMLElement && element.isContentEditable) {
|
|
16251
|
+
return true;
|
|
16252
|
+
}
|
|
16253
|
+
if (element.closest?.('[contenteditable=""],[contenteditable="true"],[contenteditable="plaintext-only"]') || element.closest?.('[role="textbox"]')) {
|
|
16254
|
+
return true;
|
|
16255
|
+
}
|
|
16256
|
+
return false;
|
|
16257
|
+
}
|
|
16239
16258
|
function OverlayControls({
|
|
16240
16259
|
mode,
|
|
16241
16260
|
value,
|
|
@@ -16334,7 +16353,7 @@ function OverlayControls({
|
|
|
16334
16353
|
React42.useEffect(() => {
|
|
16335
16354
|
if (!enableKeyboardShortcuts) return;
|
|
16336
16355
|
const handleKeyDown2 = (e) => {
|
|
16337
|
-
if (e.target
|
|
16356
|
+
if (isEditableKeyboardTarget(e.target)) return;
|
|
16338
16357
|
switch (e.key) {
|
|
16339
16358
|
case " ":
|
|
16340
16359
|
case "k":
|
|
@@ -16678,6 +16697,11 @@ var defaultLabels = {
|
|
|
16678
16697
|
searchPlaceholder: "Search...",
|
|
16679
16698
|
noResultsText: "No results found"
|
|
16680
16699
|
};
|
|
16700
|
+
var TREE_NODE_BASE_PADDING_REM = 0.75;
|
|
16701
|
+
var TREE_NODE_INDENT_REM = 1;
|
|
16702
|
+
var TREE_BRANCH_OFFSET_CLASS = "ml-1.5 pl-1.5";
|
|
16703
|
+
var TREE_NODE_GAP_CLASS = "gap-1.5";
|
|
16704
|
+
var TREE_EXPANDER_PLACEHOLDER_CLASS = "w-5";
|
|
16681
16705
|
function getInitialExpandedNodes(categories, defaultExpanded, viewOnly, inline) {
|
|
16682
16706
|
if (!(viewOnly || inline) || !defaultExpanded) return /* @__PURE__ */ new Set();
|
|
16683
16707
|
const parentIds = /* @__PURE__ */ new Set();
|
|
@@ -16866,13 +16890,14 @@ function CategoryTreeSelect(props) {
|
|
|
16866
16890
|
{
|
|
16867
16891
|
onClick: () => !viewOnly && handleSelect(category.id, category),
|
|
16868
16892
|
className: cn(
|
|
16869
|
-
"relative flex min-w-0 items-center
|
|
16893
|
+
"relative flex min-w-0 items-center px-3 py-2.5 min-h-11 transition-all duration-200 rounded-3xl",
|
|
16894
|
+
TREE_NODE_GAP_CLASS,
|
|
16870
16895
|
!viewOnly && (isSelectable ? "cursor-pointer" : "cursor-default"),
|
|
16871
16896
|
isSelectable && !isSelected && "hover:bg-accent/50",
|
|
16872
16897
|
// Selected state - đồng bộ cho tất cả
|
|
16873
16898
|
!viewOnly && isSelected && "bg-accent/40"
|
|
16874
16899
|
),
|
|
16875
|
-
style: { paddingLeft: `${level *
|
|
16900
|
+
style: { paddingLeft: `${level * TREE_NODE_INDENT_REM + TREE_NODE_BASE_PADDING_REM}rem` },
|
|
16876
16901
|
children: [
|
|
16877
16902
|
hasChildren ? /* @__PURE__ */ jsx49(
|
|
16878
16903
|
"button",
|
|
@@ -16883,7 +16908,7 @@ function CategoryTreeSelect(props) {
|
|
|
16883
16908
|
toggleExpand(category.id);
|
|
16884
16909
|
},
|
|
16885
16910
|
className: cn(
|
|
16886
|
-
"p-
|
|
16911
|
+
"p-0.5 rounded-lg transition-all duration-200",
|
|
16887
16912
|
"hover:scale-110 active:scale-95",
|
|
16888
16913
|
"focus:outline-none focus-visible:ring-2 focus-visible:ring-primary/50",
|
|
16889
16914
|
isExpanded && "text-primary",
|
|
@@ -16892,16 +16917,16 @@ function CategoryTreeSelect(props) {
|
|
|
16892
16917
|
disabled: isSearchMode,
|
|
16893
16918
|
children: /* @__PURE__ */ jsx49("div", { className: cn("transition-transform duration-200", isExpanded && "rotate-90"), children: /* @__PURE__ */ jsx49(ChevronRight6, { className: "w-4 h-4" }) })
|
|
16894
16919
|
}
|
|
16895
|
-
) : /* @__PURE__ */ jsx49("span", { className:
|
|
16920
|
+
) : /* @__PURE__ */ jsx49("span", { className: TREE_EXPANDER_PLACEHOLDER_CLASS }),
|
|
16896
16921
|
viewOnly ? (
|
|
16897
16922
|
// View-only mode: just display the name with folder icon
|
|
16898
|
-
/* @__PURE__ */ jsxs39("div", { className: "flex min-w-0 items-center
|
|
16923
|
+
/* @__PURE__ */ jsxs39("div", { className: cn("flex min-w-0 items-center", TREE_NODE_GAP_CLASS), children: [
|
|
16899
16924
|
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
16925
|
/* @__PURE__ */ jsx49("span", { className: "min-w-0 text-sm font-medium leading-snug break-words [overflow-wrap:anywhere]", children: category.name })
|
|
16901
16926
|
] })
|
|
16902
16927
|
) : (
|
|
16903
16928
|
// Single/Multi select mode: icon + text + badge
|
|
16904
|
-
/* @__PURE__ */ jsxs39("div", { className: "flex min-w-0 flex-1 items-center
|
|
16929
|
+
/* @__PURE__ */ jsxs39("div", { className: cn("flex min-w-0 flex-1 items-center overflow-hidden", TREE_NODE_GAP_CLASS), children: [
|
|
16905
16930
|
category.icon && /* @__PURE__ */ jsx49("div", { className: "h-4 w-4 shrink-0 flex items-center justify-center text-current", children: category.icon }),
|
|
16906
16931
|
/* @__PURE__ */ jsx49(
|
|
16907
16932
|
"span",
|
|
@@ -16920,7 +16945,17 @@ function CategoryTreeSelect(props) {
|
|
|
16920
16945
|
]
|
|
16921
16946
|
}
|
|
16922
16947
|
),
|
|
16923
|
-
hasChildren && isExpanded && /* @__PURE__ */ jsx49(
|
|
16948
|
+
hasChildren && isExpanded && /* @__PURE__ */ jsx49(
|
|
16949
|
+
"div",
|
|
16950
|
+
{
|
|
16951
|
+
className: cn(
|
|
16952
|
+
TREE_BRANCH_OFFSET_CLASS,
|
|
16953
|
+
"border-l-2 border-dashed border-border/50",
|
|
16954
|
+
"animate-in slide-in-from-top-2 fade-in-50 duration-200"
|
|
16955
|
+
),
|
|
16956
|
+
children: children.map((child) => renderCategory(child, level + 1))
|
|
16957
|
+
}
|
|
16958
|
+
)
|
|
16924
16959
|
]
|
|
16925
16960
|
},
|
|
16926
16961
|
category.id
|