@underverse-ui/underverse 2.0.29 → 2.0.31
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/{EmojiPicker-NV3GQYWI.js → EmojiPicker-ISJ6RXYG.js} +4 -4
- package/dist/{chunk-LK6YWBI6.js → chunk-2P7TSXEE.js} +82 -25
- package/dist/chunk-2P7TSXEE.js.map +1 -0
- package/dist/{chunk-5QWYO527.js → chunk-37MHVJMV.js} +846 -90
- package/dist/chunk-37MHVJMV.js.map +1 -0
- package/dist/{chunk-XTZTUDRE.js → chunk-57BKIC6J.js} +711 -800
- package/dist/chunk-57BKIC6J.js.map +1 -0
- package/dist/{chunk-LRIRY4DG.js → chunk-5W63IHIN.js} +11 -3
- package/dist/chunk-5W63IHIN.js.map +1 -0
- package/dist/{chunk-F7MX3XXK.js → chunk-S4UHFRL3.js} +3 -3
- package/dist/{chunk-A4GUPKHM.js → chunk-ZP7F4ZD7.js} +63 -43
- package/dist/chunk-ZP7F4ZD7.js.map +1 -0
- package/dist/index.cjs +2296 -1342
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +61 -2
- package/dist/index.d.ts +61 -2
- package/dist/index.js +94 -41
- package/dist/index.js.map +1 -1
- package/dist/{menu-bar-AHG64PEB.js → menu-bar-DPCNNUX5.js} +193 -47
- package/dist/menu-bar-DPCNNUX5.js.map +1 -0
- package/dist/ueditor.cjs +9407 -8506
- package/dist/ueditor.cjs.map +1 -1
- package/dist/ueditor.d.cts +10 -0
- package/dist/ueditor.d.ts +10 -0
- package/dist/ueditor.js +4 -4
- package/package.json +2 -1
- package/dist/chunk-5QWYO527.js.map +0 -1
- package/dist/chunk-A4GUPKHM.js.map +0 -1
- package/dist/chunk-LK6YWBI6.js.map +0 -1
- package/dist/chunk-LRIRY4DG.js.map +0 -1
- package/dist/chunk-XTZTUDRE.js.map +0 -1
- package/dist/menu-bar-AHG64PEB.js.map +0 -1
- /package/dist/{EmojiPicker-NV3GQYWI.js.map → EmojiPicker-ISJ6RXYG.js.map} +0 -0
- /package/dist/{chunk-F7MX3XXK.js.map → chunk-S4UHFRL3.js.map} +0 -0
package/dist/index.js
CHANGED
|
@@ -4,19 +4,19 @@ import {
|
|
|
4
4
|
extractImageSrcsFromHtml,
|
|
5
5
|
normalizeImageUrl,
|
|
6
6
|
prepareUEditorContentForSave
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-57BKIC6J.js";
|
|
8
8
|
import {
|
|
9
9
|
EmojiPicker_default
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-S4UHFRL3.js";
|
|
11
11
|
import {
|
|
12
12
|
getEmojiImageUrl,
|
|
13
13
|
getEmojiUnifiedCode,
|
|
14
14
|
setEmojiBaseUrl
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-5W63IHIN.js";
|
|
16
16
|
import "./chunk-4TYW5K4J.js";
|
|
17
17
|
import {
|
|
18
18
|
Modal_default
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-2P7TSXEE.js";
|
|
20
20
|
import {
|
|
21
21
|
DropdownMenuItem,
|
|
22
22
|
DropdownMenuSeparator,
|
|
@@ -31,7 +31,7 @@ import {
|
|
|
31
31
|
shadcnAnimationStyles,
|
|
32
32
|
useShadCNAnimations,
|
|
33
33
|
useUnderverseUIConfig
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-37MHVJMV.js";
|
|
35
35
|
import {
|
|
36
36
|
ForceInternalTranslationsProvider,
|
|
37
37
|
NextIntlAdapter,
|
|
@@ -58,7 +58,7 @@ import {
|
|
|
58
58
|
useUnderverseLocale,
|
|
59
59
|
useUnderverseTranslations,
|
|
60
60
|
vi_default
|
|
61
|
-
} from "./chunk-
|
|
61
|
+
} from "./chunk-ZP7F4ZD7.js";
|
|
62
62
|
import {
|
|
63
63
|
__export,
|
|
64
64
|
__require
|
|
@@ -4433,6 +4433,10 @@ var Tabs = ({
|
|
|
4433
4433
|
tabs,
|
|
4434
4434
|
defaultValue,
|
|
4435
4435
|
className,
|
|
4436
|
+
tabClassName,
|
|
4437
|
+
activeTabClassName,
|
|
4438
|
+
inactiveTabClassName,
|
|
4439
|
+
indicatorClassName,
|
|
4436
4440
|
contentClassName,
|
|
4437
4441
|
variant = "default",
|
|
4438
4442
|
size = "md",
|
|
@@ -4535,6 +4539,7 @@ var Tabs = ({
|
|
|
4535
4539
|
stretch && orientation === "horizontal" && "flex-1 justify-center",
|
|
4536
4540
|
tab.href && tab.disabled && "pointer-events-none cursor-not-allowed opacity-50"
|
|
4537
4541
|
);
|
|
4542
|
+
const consumerClassName = cn(tabClassName, isActive ? activeTabClassName : inactiveTabClassName);
|
|
4538
4543
|
const sharedStyle = {
|
|
4539
4544
|
outline: "none"
|
|
4540
4545
|
};
|
|
@@ -4547,7 +4552,6 @@ var Tabs = ({
|
|
|
4547
4552
|
"aria-selected": isActive,
|
|
4548
4553
|
"aria-controls": panelId2,
|
|
4549
4554
|
tabIndex: isActive ? 0 : -1,
|
|
4550
|
-
className: sharedClassName,
|
|
4551
4555
|
style: sharedStyle,
|
|
4552
4556
|
onKeyDown: handleTabKeyDown
|
|
4553
4557
|
};
|
|
@@ -4565,7 +4569,7 @@ var Tabs = ({
|
|
|
4565
4569
|
handleTabChange(tab.value);
|
|
4566
4570
|
}
|
|
4567
4571
|
},
|
|
4568
|
-
className: cn(sharedClassName, "no-underline"),
|
|
4572
|
+
className: cn(sharedClassName, "no-underline", consumerClassName),
|
|
4569
4573
|
children: [
|
|
4570
4574
|
Icon && /* @__PURE__ */ jsx21(Icon, { className: "h-4 w-4" }),
|
|
4571
4575
|
tab.label
|
|
@@ -4580,7 +4584,7 @@ var Tabs = ({
|
|
|
4580
4584
|
...sharedProps,
|
|
4581
4585
|
onClick: () => !tab.disabled && handleTabChange(tab.value),
|
|
4582
4586
|
disabled: tab.disabled,
|
|
4583
|
-
className: cn(sharedClassName, "border-0 bg-transparent outline-none"),
|
|
4587
|
+
className: cn(sharedClassName, "border-0 bg-transparent outline-none", consumerClassName),
|
|
4584
4588
|
children: [
|
|
4585
4589
|
Icon && /* @__PURE__ */ jsx21(Icon, { className: "h-4 w-4" }),
|
|
4586
4590
|
tab.label
|
|
@@ -4589,7 +4593,16 @@ var Tabs = ({
|
|
|
4589
4593
|
tab.value
|
|
4590
4594
|
);
|
|
4591
4595
|
}),
|
|
4592
|
-
variant === "underline" && orientation === "horizontal" && /* @__PURE__ */ jsx21(
|
|
4596
|
+
variant === "underline" && orientation === "horizontal" && /* @__PURE__ */ jsx21(
|
|
4597
|
+
"div",
|
|
4598
|
+
{
|
|
4599
|
+
className: cn(
|
|
4600
|
+
"absolute bottom-0 h-0.5 bg-primary transition-all duration-300 ease-out",
|
|
4601
|
+
indicatorClassName
|
|
4602
|
+
),
|
|
4603
|
+
style: underlineStyle
|
|
4604
|
+
}
|
|
4605
|
+
)
|
|
4593
4606
|
] }),
|
|
4594
4607
|
/* @__PURE__ */ jsx21(
|
|
4595
4608
|
"div",
|
|
@@ -4689,6 +4702,7 @@ var Combobox = ({
|
|
|
4689
4702
|
virtualized = false,
|
|
4690
4703
|
estimatedItemHeight = 44,
|
|
4691
4704
|
overscan = 8,
|
|
4705
|
+
enableSearch: enableSearchProp,
|
|
4692
4706
|
searchMode = "auto",
|
|
4693
4707
|
onSearchChange,
|
|
4694
4708
|
searchDebounceMs = 0,
|
|
@@ -4717,28 +4731,28 @@ var Combobox = ({
|
|
|
4717
4731
|
const autoId = useId4();
|
|
4718
4732
|
const resolvedId = id ? String(id) : `combobox-${autoId}`;
|
|
4719
4733
|
const labelId = label ? `${resolvedId}-label` : void 0;
|
|
4720
|
-
const
|
|
4734
|
+
const isSearchEnabled = enableSearchProp ?? (options.length > 10 || searchMode === "manual" || minSearchLength > 0 || !!onSearchChange);
|
|
4721
4735
|
const trimmedQuery = query.trim();
|
|
4722
4736
|
const queryMeetsMinimum = trimmedQuery.length >= minSearchLength;
|
|
4723
|
-
const shouldPromptForSearch = minSearchLength > 0 && !queryMeetsMinimum && (searchMode === "manual" || showSearchPromptWhenEmptyQuery);
|
|
4737
|
+
const shouldPromptForSearch = isSearchEnabled && minSearchLength > 0 && !queryMeetsMinimum && (searchMode === "manual" || showSearchPromptWhenEmptyQuery);
|
|
4724
4738
|
const filteredOptions = React19.useMemo(
|
|
4725
4739
|
() => {
|
|
4726
4740
|
if (shouldPromptForSearch) return [];
|
|
4727
|
-
if (!
|
|
4741
|
+
if (!isSearchEnabled || searchMode === "manual") return options;
|
|
4728
4742
|
const normalizedQuery = trimmedQuery.toLowerCase();
|
|
4729
4743
|
if (!normalizedQuery) return options;
|
|
4730
4744
|
return options.filter((o) => getOptionLabel(o).toLowerCase().includes(normalizedQuery));
|
|
4731
4745
|
},
|
|
4732
|
-
[
|
|
4746
|
+
[isSearchEnabled, options, searchMode, shouldPromptForSearch, trimmedQuery]
|
|
4733
4747
|
);
|
|
4734
4748
|
const renderLimitedOptions = React19.useMemo(
|
|
4735
4749
|
() => {
|
|
4736
|
-
if (trimmedQuery || maxInitialOptions === void 0 || maxInitialOptions < 1) {
|
|
4750
|
+
if (!isSearchEnabled || trimmedQuery || maxInitialOptions === void 0 || maxInitialOptions < 1) {
|
|
4737
4751
|
return filteredOptions;
|
|
4738
4752
|
}
|
|
4739
4753
|
return filteredOptions.slice(0, maxInitialOptions);
|
|
4740
4754
|
},
|
|
4741
|
-
[filteredOptions, maxInitialOptions, trimmedQuery]
|
|
4755
|
+
[filteredOptions, isSearchEnabled, maxInitialOptions, trimmedQuery]
|
|
4742
4756
|
);
|
|
4743
4757
|
const canVirtualize = virtualized && !groupBy;
|
|
4744
4758
|
const optionVirtualizer = useVirtualizer({
|
|
@@ -4799,7 +4813,7 @@ var Combobox = ({
|
|
|
4799
4813
|
setQuery("");
|
|
4800
4814
|
setActiveIndex(null);
|
|
4801
4815
|
scrollVirtualListToStart();
|
|
4802
|
-
} else if (
|
|
4816
|
+
} else if (isSearchEnabled) {
|
|
4803
4817
|
const triggerWindow = triggerRef.current?.ownerDocument.defaultView;
|
|
4804
4818
|
if (!triggerWindow) return void 0;
|
|
4805
4819
|
const timeoutId = triggerWindow.setTimeout(() => {
|
|
@@ -4808,14 +4822,14 @@ var Combobox = ({
|
|
|
4808
4822
|
return () => triggerWindow.clearTimeout(timeoutId);
|
|
4809
4823
|
}
|
|
4810
4824
|
return void 0;
|
|
4811
|
-
}, [
|
|
4825
|
+
}, [isSearchEnabled, open, scrollVirtualListToStart]);
|
|
4812
4826
|
React19.useEffect(() => {
|
|
4813
|
-
if (!onSearchChange) return void 0;
|
|
4827
|
+
if (!isSearchEnabled || !onSearchChange) return void 0;
|
|
4814
4828
|
const triggerWindow = triggerRef.current?.ownerDocument.defaultView;
|
|
4815
4829
|
if (!triggerWindow) return void 0;
|
|
4816
4830
|
const timeoutId = triggerWindow.setTimeout(() => onSearchChange(query), searchDebounceMs);
|
|
4817
4831
|
return () => triggerWindow.clearTimeout(timeoutId);
|
|
4818
|
-
}, [onSearchChange, query, searchDebounceMs]);
|
|
4832
|
+
}, [isSearchEnabled, onSearchChange, query, searchDebounceMs]);
|
|
4819
4833
|
React19.useEffect(() => {
|
|
4820
4834
|
if (process.env.NODE_ENV !== "production" && options.length > 300 && !virtualized && searchMode !== "manual" && maxInitialOptions === void 0) {
|
|
4821
4835
|
console.warn(
|
|
@@ -4951,7 +4965,7 @@ var Combobox = ({
|
|
|
4951
4965
|
style: usePortal ? { maxHeight: "var(--underverse-popover-available-height)" } : void 0,
|
|
4952
4966
|
className: cn("w-full overflow-hidden", usePortal && "flex min-h-0 flex-col", getPanelBorderRadiusClass(resolvedBorderMode)),
|
|
4953
4967
|
children: [
|
|
4954
|
-
|
|
4968
|
+
isSearchEnabled && /* @__PURE__ */ jsx22("div", { className: cn("relative shrink-0 border-b border-border/30", size === "xs" ? "p-1.5" : size === "sm" ? "p-2" : size === "lg" ? "p-3" : size === "xl" ? "p-3.5" : "p-2.5"), children: /* @__PURE__ */ jsxs18("div", { className: "relative", children: [
|
|
4955
4969
|
/* @__PURE__ */ jsx22(
|
|
4956
4970
|
Search4,
|
|
4957
4971
|
{
|
|
@@ -5107,11 +5121,24 @@ var Combobox = ({
|
|
|
5107
5121
|
"aria-invalid": !!effectiveError,
|
|
5108
5122
|
id: resolvedId,
|
|
5109
5123
|
"aria-labelledby": labelId,
|
|
5124
|
+
"aria-activedescendant": activeIndex !== null ? `${resolvedId}-item-${activeIndex}` : void 0,
|
|
5110
5125
|
onKeyDown: (e) => {
|
|
5111
5126
|
if (disabled) return;
|
|
5112
|
-
if (e.key === "ArrowDown" || e.key === "Enter" || e.key === " ") {
|
|
5127
|
+
if (!open && (e.key === "ArrowDown" || e.key === "Enter" || e.key === " ")) {
|
|
5113
5128
|
e.preventDefault();
|
|
5114
5129
|
setOpen(true);
|
|
5130
|
+
if (!isSearchEnabled && e.key === "ArrowDown") moveActiveIndex(1);
|
|
5131
|
+
} else if (open && !isSearchEnabled && e.key === "ArrowDown") {
|
|
5132
|
+
e.preventDefault();
|
|
5133
|
+
moveActiveIndex(1);
|
|
5134
|
+
} else if (open && !isSearchEnabled && e.key === "ArrowUp") {
|
|
5135
|
+
e.preventDefault();
|
|
5136
|
+
moveActiveIndex(-1);
|
|
5137
|
+
} else if (open && !isSearchEnabled && e.key === "Enter") {
|
|
5138
|
+
e.preventDefault();
|
|
5139
|
+
if (activeIndex !== null && renderLimitedOptions[activeIndex] && !getOptionDisabled(renderLimitedOptions[activeIndex])) {
|
|
5140
|
+
handleSelect(renderLimitedOptions[activeIndex]);
|
|
5141
|
+
}
|
|
5115
5142
|
} else if (e.key === "Escape") {
|
|
5116
5143
|
e.preventDefault();
|
|
5117
5144
|
setOpen(false);
|
|
@@ -15041,6 +15068,7 @@ var MultiCombobox = ({
|
|
|
15041
15068
|
virtualized = false,
|
|
15042
15069
|
estimatedItemHeight = 44,
|
|
15043
15070
|
overscan = 8,
|
|
15071
|
+
enableSearch: enableSearchProp,
|
|
15044
15072
|
searchMode = "auto",
|
|
15045
15073
|
onSearchChange,
|
|
15046
15074
|
searchDebounceMs = 0,
|
|
@@ -15073,25 +15101,25 @@ var MultiCombobox = ({
|
|
|
15073
15101
|
),
|
|
15074
15102
|
[options]
|
|
15075
15103
|
);
|
|
15076
|
-
const
|
|
15104
|
+
const isSearchEnabled = enableSearchProp ?? (normalizedOptions.length > 10 || searchMode === "manual" || minSearchLength > 0 || !!onSearchChange);
|
|
15077
15105
|
const trimmedQuery = query.trim();
|
|
15078
15106
|
const queryMeetsMinimum = trimmedQuery.length >= minSearchLength;
|
|
15079
|
-
const shouldPromptForSearch = minSearchLength > 0 && !queryMeetsMinimum && (searchMode === "manual" || showSearchPromptWhenEmptyQuery);
|
|
15107
|
+
const shouldPromptForSearch = isSearchEnabled && minSearchLength > 0 && !queryMeetsMinimum && (searchMode === "manual" || showSearchPromptWhenEmptyQuery);
|
|
15080
15108
|
const filtered = React35.useMemo(() => {
|
|
15081
15109
|
if (shouldPromptForSearch) return [];
|
|
15082
|
-
if (!
|
|
15110
|
+
if (!isSearchEnabled || searchMode === "manual") return normalizedOptions;
|
|
15083
15111
|
const normalizedQuery = trimmedQuery.toLowerCase();
|
|
15084
15112
|
if (!normalizedQuery) return normalizedOptions;
|
|
15085
15113
|
return normalizedOptions.filter(
|
|
15086
15114
|
(opt) => opt.label.toLowerCase().includes(normalizedQuery) || opt.description?.toLowerCase().includes(normalizedQuery)
|
|
15087
15115
|
);
|
|
15088
|
-
}, [
|
|
15116
|
+
}, [isSearchEnabled, normalizedOptions, searchMode, shouldPromptForSearch, trimmedQuery]);
|
|
15089
15117
|
const renderLimitedOptions = React35.useMemo(() => {
|
|
15090
|
-
if (trimmedQuery || maxInitialOptions === void 0 || maxInitialOptions < 1) {
|
|
15118
|
+
if (!isSearchEnabled || trimmedQuery || maxInitialOptions === void 0 || maxInitialOptions < 1) {
|
|
15091
15119
|
return filtered;
|
|
15092
15120
|
}
|
|
15093
15121
|
return filtered.slice(0, maxInitialOptions);
|
|
15094
|
-
}, [filtered, maxInitialOptions, trimmedQuery]);
|
|
15122
|
+
}, [filtered, isSearchEnabled, maxInitialOptions, trimmedQuery]);
|
|
15095
15123
|
const canVirtualize = virtualized && !groupBy;
|
|
15096
15124
|
const optionVirtualizer = useVirtualizer2({
|
|
15097
15125
|
count: canVirtualize ? renderLimitedOptions.length : 0,
|
|
@@ -15135,24 +15163,32 @@ var MultiCombobox = ({
|
|
|
15135
15163
|
onChange(value.filter((v) => v !== val));
|
|
15136
15164
|
};
|
|
15137
15165
|
const handleKeyDown = (e) => {
|
|
15138
|
-
if (!open) setOpen(true);
|
|
15139
15166
|
if (e.key === "ArrowDown") {
|
|
15140
15167
|
e.preventDefault();
|
|
15168
|
+
if (!open) setOpen(true);
|
|
15141
15169
|
if (renderLimitedOptions.length === 0) return;
|
|
15142
15170
|
const next = activeIndex === null ? 0 : (activeIndex + 1) % renderLimitedOptions.length;
|
|
15143
15171
|
setActiveIndex(next);
|
|
15144
15172
|
scrollVirtualListToIndex(next);
|
|
15145
15173
|
} else if (e.key === "ArrowUp") {
|
|
15146
15174
|
e.preventDefault();
|
|
15175
|
+
if (!open) setOpen(true);
|
|
15147
15176
|
if (renderLimitedOptions.length === 0) return;
|
|
15148
15177
|
const next = activeIndex === null ? renderLimitedOptions.length - 1 : (activeIndex - 1 + renderLimitedOptions.length) % renderLimitedOptions.length;
|
|
15149
15178
|
setActiveIndex(next);
|
|
15150
15179
|
scrollVirtualListToIndex(next);
|
|
15151
15180
|
} else if (e.key === "Enter") {
|
|
15152
15181
|
e.preventDefault();
|
|
15182
|
+
if (!open) {
|
|
15183
|
+
setOpen(true);
|
|
15184
|
+
return;
|
|
15185
|
+
}
|
|
15153
15186
|
if (activeIndex !== null && renderLimitedOptions[activeIndex]) {
|
|
15154
15187
|
toggleSelect(renderLimitedOptions[activeIndex].value);
|
|
15155
15188
|
}
|
|
15189
|
+
} else if (e.key === " " && !open) {
|
|
15190
|
+
e.preventDefault();
|
|
15191
|
+
setOpen(true);
|
|
15156
15192
|
} else if (e.key === "Escape") {
|
|
15157
15193
|
e.preventDefault();
|
|
15158
15194
|
setOpen(false);
|
|
@@ -15168,7 +15204,7 @@ var MultiCombobox = ({
|
|
|
15168
15204
|
}
|
|
15169
15205
|
}, [disabled, required, value.length]);
|
|
15170
15206
|
React35.useEffect(() => {
|
|
15171
|
-
if (open &&
|
|
15207
|
+
if (open && isSearchEnabled) {
|
|
15172
15208
|
setTimeout(() => {
|
|
15173
15209
|
inputRef.current?.focus();
|
|
15174
15210
|
}, 100);
|
|
@@ -15177,12 +15213,12 @@ var MultiCombobox = ({
|
|
|
15177
15213
|
setActiveIndex(null);
|
|
15178
15214
|
scrollVirtualListToStart();
|
|
15179
15215
|
}
|
|
15180
|
-
}, [
|
|
15216
|
+
}, [isSearchEnabled, open, scrollVirtualListToStart]);
|
|
15181
15217
|
React35.useEffect(() => {
|
|
15182
|
-
if (!onSearchChange) return void 0;
|
|
15218
|
+
if (!isSearchEnabled || !onSearchChange) return void 0;
|
|
15183
15219
|
const timeoutId = window.setTimeout(() => onSearchChange(query), searchDebounceMs);
|
|
15184
15220
|
return () => window.clearTimeout(timeoutId);
|
|
15185
|
-
}, [onSearchChange, query, searchDebounceMs]);
|
|
15221
|
+
}, [isSearchEnabled, onSearchChange, query, searchDebounceMs]);
|
|
15186
15222
|
React35.useEffect(() => {
|
|
15187
15223
|
if (process.env.NODE_ENV !== "production" && normalizedOptions.length > 300 && !virtualized && searchMode !== "manual" && maxInitialOptions === void 0) {
|
|
15188
15224
|
console.warn(
|
|
@@ -15257,6 +15293,10 @@ var MultiCombobox = ({
|
|
|
15257
15293
|
return /* @__PURE__ */ jsx39(
|
|
15258
15294
|
"li",
|
|
15259
15295
|
{
|
|
15296
|
+
id: `${resolvedId}-option-${index}`,
|
|
15297
|
+
role: "option",
|
|
15298
|
+
"aria-selected": isSelected,
|
|
15299
|
+
"aria-disabled": isDisabled,
|
|
15260
15300
|
ref: (node) => {
|
|
15261
15301
|
measureRef?.(node);
|
|
15262
15302
|
listRef.current[index] = node;
|
|
@@ -15268,7 +15308,7 @@ var MultiCombobox = ({
|
|
|
15268
15308
|
e.preventDefault();
|
|
15269
15309
|
e.stopPropagation();
|
|
15270
15310
|
if (!isDisabled) toggleSelect(item.value);
|
|
15271
|
-
inputRef.current?.focus();
|
|
15311
|
+
(isSearchEnabled ? inputRef.current : triggerRef.current)?.focus();
|
|
15272
15312
|
},
|
|
15273
15313
|
children: /* @__PURE__ */ jsx39("div", { className: cn("dropdown-item", isDisabled && "opacity-50 cursor-not-allowed pointer-events-none"), children: renderOption(item, isSelected) })
|
|
15274
15314
|
},
|
|
@@ -15278,6 +15318,10 @@ var MultiCombobox = ({
|
|
|
15278
15318
|
return /* @__PURE__ */ jsx39(
|
|
15279
15319
|
"li",
|
|
15280
15320
|
{
|
|
15321
|
+
id: `${resolvedId}-option-${index}`,
|
|
15322
|
+
role: "option",
|
|
15323
|
+
"aria-selected": isSelected,
|
|
15324
|
+
"aria-disabled": isDisabled,
|
|
15281
15325
|
ref: (node) => {
|
|
15282
15326
|
measureRef?.(node);
|
|
15283
15327
|
listRef.current[index] = node;
|
|
@@ -15289,7 +15333,7 @@ var MultiCombobox = ({
|
|
|
15289
15333
|
e.preventDefault();
|
|
15290
15334
|
e.stopPropagation();
|
|
15291
15335
|
if (!isDisabled) toggleSelect(item.value);
|
|
15292
|
-
inputRef.current?.focus();
|
|
15336
|
+
(isSearchEnabled ? inputRef.current : triggerRef.current)?.focus();
|
|
15293
15337
|
},
|
|
15294
15338
|
children: /* @__PURE__ */ jsxs32(
|
|
15295
15339
|
"div",
|
|
@@ -15345,7 +15389,7 @@ var MultiCombobox = ({
|
|
|
15345
15389
|
}
|
|
15346
15390
|
)
|
|
15347
15391
|
] }),
|
|
15348
|
-
|
|
15392
|
+
isSearchEnabled && /* @__PURE__ */ jsxs32("div", { className: "relative border-b border-border/40", children: [
|
|
15349
15393
|
/* @__PURE__ */ jsx39(Search5, { className: cn("absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground", sizeStyles7[size].icon) }),
|
|
15350
15394
|
/* @__PURE__ */ jsx39(
|
|
15351
15395
|
"input",
|
|
@@ -15457,6 +15501,8 @@ var MultiCombobox = ({
|
|
|
15457
15501
|
"aria-controls": listboxId,
|
|
15458
15502
|
"aria-required": required,
|
|
15459
15503
|
"aria-invalid": !!effectiveError,
|
|
15504
|
+
"aria-activedescendant": activeIndex !== null ? `${resolvedId}-option-${activeIndex}` : void 0,
|
|
15505
|
+
onKeyDown: !isSearchEnabled ? handleKeyDown : void 0,
|
|
15460
15506
|
className: cn(
|
|
15461
15507
|
"group flex w-full items-center gap-2 transition-all duration-200",
|
|
15462
15508
|
formControlFixedClass,
|
|
@@ -15526,7 +15572,13 @@ var MultiCombobox = ({
|
|
|
15526
15572
|
e.stopPropagation();
|
|
15527
15573
|
handleClearAll();
|
|
15528
15574
|
},
|
|
15529
|
-
onKeyDown: (e) =>
|
|
15575
|
+
onKeyDown: (e) => {
|
|
15576
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
15577
|
+
e.preventDefault();
|
|
15578
|
+
e.stopPropagation();
|
|
15579
|
+
handleClearAll();
|
|
15580
|
+
}
|
|
15581
|
+
},
|
|
15530
15582
|
className: "opacity-0 group-hover:opacity-100 transition-all duration-200 p-1 rounded-lg hover:bg-destructive/10 text-muted-foreground hover:text-destructive",
|
|
15531
15583
|
children: /* @__PURE__ */ jsx39(X12, { className: "h-3.5 w-3.5" })
|
|
15532
15584
|
}
|
|
@@ -17157,7 +17209,7 @@ function CategoryTreeSelect(props) {
|
|
|
17157
17209
|
const trimmedQuery = useMemo18(() => query.trim(), [query]);
|
|
17158
17210
|
const normalizedQuery = useMemo18(() => trimmedQuery.toLowerCase(), [trimmedQuery]);
|
|
17159
17211
|
const queryMeetsMinimum = trimmedQuery.length >= minSearchLength;
|
|
17160
|
-
const shouldPromptForSearch = minSearchLength > 0 && !queryMeetsMinimum && (searchMode === "manual" || showSearchPromptWhenEmptyQuery);
|
|
17212
|
+
const shouldPromptForSearch = isSearchEnabled && minSearchLength > 0 && !queryMeetsMinimum && (searchMode === "manual" || showSearchPromptWhenEmptyQuery);
|
|
17161
17213
|
const isSearchMode = isSearchEnabled && normalizedQuery.length > 0;
|
|
17162
17214
|
const shouldAutoExpandSearchResults = searchMode === "auto" && isSearchMode;
|
|
17163
17215
|
const effectiveExpandedNodes = useMemo18(() => getExpandedNodesState(expandedIds, expandedNodes), [expandedIds, expandedNodes]);
|
|
@@ -17201,12 +17253,12 @@ function CategoryTreeSelect(props) {
|
|
|
17201
17253
|
return visible;
|
|
17202
17254
|
}, [byId, categories, childrenMap, isSearchMode, normalizedQuery, searchMode, shouldPromptForSearch]);
|
|
17203
17255
|
useEffect20(() => {
|
|
17204
|
-
if (!onSearchChange) return;
|
|
17256
|
+
if (!isSearchEnabled || !onSearchChange) return;
|
|
17205
17257
|
const timeoutId = window.setTimeout(() => {
|
|
17206
17258
|
onSearchChange(trimmedQuery);
|
|
17207
17259
|
}, Math.max(0, searchDebounceMs));
|
|
17208
17260
|
return () => window.clearTimeout(timeoutId);
|
|
17209
|
-
}, [onSearchChange, searchDebounceMs, trimmedQuery]);
|
|
17261
|
+
}, [isSearchEnabled, onSearchChange, searchDebounceMs, trimmedQuery]);
|
|
17210
17262
|
useEffect20(() => {
|
|
17211
17263
|
if (!isOpen) return;
|
|
17212
17264
|
if (!isSearchEnabled) return;
|
|
@@ -17289,7 +17341,7 @@ function CategoryTreeSelect(props) {
|
|
|
17289
17341
|
const flattenedRows = useMemo18(() => {
|
|
17290
17342
|
if (shouldPromptForSearch) return [];
|
|
17291
17343
|
const rows = flattenVisibleCategories(effectiveParentCategories, effectiveChildrenMap, effectiveExpandedNodes, shouldAutoExpandSearchResults);
|
|
17292
|
-
if (trimmedQuery || maxInitialOptions === void 0 || maxInitialOptions < 1) {
|
|
17344
|
+
if (!isSearchEnabled || trimmedQuery || maxInitialOptions === void 0 || maxInitialOptions < 1) {
|
|
17293
17345
|
return rows;
|
|
17294
17346
|
}
|
|
17295
17347
|
const limitedRows = rows.slice(0, maxInitialOptions);
|
|
@@ -17317,6 +17369,7 @@ function CategoryTreeSelect(props) {
|
|
|
17317
17369
|
effectiveExpandedNodes,
|
|
17318
17370
|
effectiveParentCategories,
|
|
17319
17371
|
expandToId,
|
|
17372
|
+
isSearchEnabled,
|
|
17320
17373
|
maxInitialOptions,
|
|
17321
17374
|
selectedIds,
|
|
17322
17375
|
shouldAutoExpandSearchResults,
|