@underverse-ui/underverse 1.0.197 → 1.0.198
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 +32 -2
- 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 +32 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/api-reference.json
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -9223,7 +9223,8 @@ var Combobox = ({
|
|
|
9223
9223
|
searchDebounceMs = 0,
|
|
9224
9224
|
minSearchLength = 0,
|
|
9225
9225
|
maxInitialOptions,
|
|
9226
|
-
showSearchPromptWhenEmptyQuery = false
|
|
9226
|
+
showSearchPromptWhenEmptyQuery = false,
|
|
9227
|
+
matchTriggerBackground = false
|
|
9227
9228
|
}) => {
|
|
9228
9229
|
const globalConfig = useUnderverseUIConfig();
|
|
9229
9230
|
const resolvedBorderMode = borderMode ?? globalConfig.borderMode ?? "full";
|
|
@@ -9238,6 +9239,7 @@ var Combobox = ({
|
|
|
9238
9239
|
const [query, setQuery] = React30.useState("");
|
|
9239
9240
|
const [activeIndex, setActiveIndex] = React30.useState(null);
|
|
9240
9241
|
const [localRequiredError, setLocalRequiredError] = React30.useState();
|
|
9242
|
+
const [triggerBackgroundColor, setTriggerBackgroundColor] = React30.useState();
|
|
9241
9243
|
useShadCNAnimations();
|
|
9242
9244
|
const inputRef = React30.useRef(null);
|
|
9243
9245
|
const optionsViewportRef = React30.useRef(null);
|
|
@@ -9279,6 +9281,12 @@ var Combobox = ({
|
|
|
9279
9281
|
});
|
|
9280
9282
|
const virtualItems = canVirtualize ? optionVirtualizer.getVirtualItems() : [];
|
|
9281
9283
|
const triggerRef = React30.useRef(null);
|
|
9284
|
+
const updateTriggerBackgroundColor = React30.useCallback(() => {
|
|
9285
|
+
const trigger = triggerRef.current;
|
|
9286
|
+
if (!trigger) return;
|
|
9287
|
+
const backgroundColor = window.getComputedStyle(trigger).backgroundColor;
|
|
9288
|
+
setTriggerBackgroundColor((current) => current === backgroundColor ? current : backgroundColor);
|
|
9289
|
+
}, []);
|
|
9282
9290
|
const scrollVirtualListToIndex = React30.useCallback((index) => {
|
|
9283
9291
|
if (!canVirtualize || renderLimitedOptions.length === 0) return;
|
|
9284
9292
|
optionVirtualizer.scrollToIndex(index, { align: "auto" });
|
|
@@ -9333,6 +9341,19 @@ var Combobox = ({
|
|
|
9333
9341
|
);
|
|
9334
9342
|
}
|
|
9335
9343
|
}, [maxInitialOptions, options.length, searchMode, virtualized]);
|
|
9344
|
+
React30.useLayoutEffect(() => {
|
|
9345
|
+
if (!open || !matchTriggerBackground) {
|
|
9346
|
+
setTriggerBackgroundColor(void 0);
|
|
9347
|
+
return void 0;
|
|
9348
|
+
}
|
|
9349
|
+
let raf = 0;
|
|
9350
|
+
const tick = () => {
|
|
9351
|
+
updateTriggerBackgroundColor();
|
|
9352
|
+
raf = window.requestAnimationFrame(tick);
|
|
9353
|
+
};
|
|
9354
|
+
tick();
|
|
9355
|
+
return () => window.cancelAnimationFrame(raf);
|
|
9356
|
+
}, [matchTriggerBackground, open, updateTriggerBackgroundColor]);
|
|
9336
9357
|
const selectedOption = findOptionByValue(options, value) ?? (selectedOptionProp && getOptionValue(selectedOptionProp) === value ? selectedOptionProp : void 0);
|
|
9337
9358
|
const displayValue = selectedOption ? getOptionLabel(selectedOption) : "";
|
|
9338
9359
|
const selectedIcon = selectedOption ? getOptionIcon(selectedOption) : void 0;
|
|
@@ -9580,6 +9601,7 @@ var Combobox = ({
|
|
|
9580
9601
|
};
|
|
9581
9602
|
const labelSize = size === "sm" ? "text-xs" : size === "lg" ? "text-base" : "text-sm";
|
|
9582
9603
|
const verticalGap = size === "sm" ? "space-y-1.5" : "space-y-2";
|
|
9604
|
+
const dropdownBackgroundStyle = matchTriggerBackground && triggerBackgroundColor ? { backgroundColor: triggerBackgroundColor } : void 0;
|
|
9583
9605
|
const triggerButtonBaseProps = {
|
|
9584
9606
|
ref: triggerRef,
|
|
9585
9607
|
type: "button",
|
|
@@ -9712,11 +9734,19 @@ var Combobox = ({
|
|
|
9712
9734
|
className: "z-50",
|
|
9713
9735
|
borderMode: resolvedBorderMode,
|
|
9714
9736
|
contentClassName: "p-0 overflow-hidden",
|
|
9737
|
+
contentProps: { style: dropdownBackgroundStyle },
|
|
9715
9738
|
children: dropdownBody
|
|
9716
9739
|
}
|
|
9717
9740
|
) : /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "relative", children: [
|
|
9718
9741
|
triggerButtonInline,
|
|
9719
|
-
open && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "absolute left-0 top-full mt-1 z-50 w-full", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
9742
|
+
open && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "absolute left-0 top-full mt-1 z-50 w-full", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
|
|
9743
|
+
"div",
|
|
9744
|
+
{
|
|
9745
|
+
style: dropdownBackgroundStyle,
|
|
9746
|
+
className: cn("overflow-hidden border text-popover-foreground shadow-md backdrop-blur-sm bg-popover/95 border-border/60", getPanelBorderRadiusClass(resolvedBorderMode)),
|
|
9747
|
+
children: dropdownBody
|
|
9748
|
+
}
|
|
9749
|
+
) })
|
|
9720
9750
|
] }),
|
|
9721
9751
|
(helperText || effectiveError) && /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
|
|
9722
9752
|
"p",
|