@underverse-ui/underverse 1.0.196 → 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 +35 -5
- 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 +35 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1784,6 +1784,8 @@ interface ComboboxProps {
|
|
|
1784
1784
|
maxInitialOptions?: number;
|
|
1785
1785
|
/** Show a prompt instead of options while the query is shorter than minSearchLength. Default: false */
|
|
1786
1786
|
showSearchPromptWhenEmptyQuery?: boolean;
|
|
1787
|
+
/** Match dropdown background to the computed background of the combobox trigger. Default: false */
|
|
1788
|
+
matchTriggerBackground?: boolean;
|
|
1787
1789
|
}
|
|
1788
1790
|
declare const Combobox: React$1.FC<ComboboxProps>;
|
|
1789
1791
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1784,6 +1784,8 @@ interface ComboboxProps {
|
|
|
1784
1784
|
maxInitialOptions?: number;
|
|
1785
1785
|
/** Show a prompt instead of options while the query is shorter than minSearchLength. Default: false */
|
|
1786
1786
|
showSearchPromptWhenEmptyQuery?: boolean;
|
|
1787
|
+
/** Match dropdown background to the computed background of the combobox trigger. Default: false */
|
|
1788
|
+
matchTriggerBackground?: boolean;
|
|
1787
1789
|
}
|
|
1788
1790
|
declare const Combobox: React$1.FC<ComboboxProps>;
|
|
1789
1791
|
|
package/dist/index.js
CHANGED
|
@@ -507,7 +507,7 @@ var Card = React4.forwardRef(
|
|
|
507
507
|
{
|
|
508
508
|
ref,
|
|
509
509
|
className: cn(
|
|
510
|
-
"group bg-card text-card-foreground transition-[transform,box-shadow,border-color,background-color] duration-300 ease-soft",
|
|
510
|
+
"group/card bg-card text-card-foreground transition-[transform,box-shadow,border-color,background-color] duration-300 ease-soft",
|
|
511
511
|
resolvedBorderMode ? getPanelBorderRadiusClass(resolvedBorderMode) : "rounded-2xl md:rounded-3xl max-md:rounded-xl",
|
|
512
512
|
"border border-border/50 shadow-sm backdrop-blur-sm",
|
|
513
513
|
hoverable && "md:hover:-translate-y-0.5 md:hover:border-primary/15 md:hover:shadow-md",
|
|
@@ -532,7 +532,7 @@ var Card = React4.forwardRef(
|
|
|
532
532
|
{
|
|
533
533
|
className: cn(
|
|
534
534
|
"pointer-events-none absolute inset-0 bg-linear-to-br from-primary/5 to-transparent opacity-0 transition-opacity duration-300",
|
|
535
|
-
"group-hover:opacity-100"
|
|
535
|
+
"group-hover/card:opacity-100"
|
|
536
536
|
)
|
|
537
537
|
}
|
|
538
538
|
),
|
|
@@ -542,7 +542,7 @@ var Card = React4.forwardRef(
|
|
|
542
542
|
{
|
|
543
543
|
className: cn(
|
|
544
544
|
"min-w-0 text-base md:text-lg font-semibold leading-tight tracking-tight wrap-anywhere transition-colors duration-200 max-md:text-sm",
|
|
545
|
-
hoverable && "group-hover:text-primary"
|
|
545
|
+
hoverable && "group-hover/card:text-primary"
|
|
546
546
|
),
|
|
547
547
|
children: title
|
|
548
548
|
}
|
|
@@ -9026,7 +9026,8 @@ var Combobox = ({
|
|
|
9026
9026
|
searchDebounceMs = 0,
|
|
9027
9027
|
minSearchLength = 0,
|
|
9028
9028
|
maxInitialOptions,
|
|
9029
|
-
showSearchPromptWhenEmptyQuery = false
|
|
9029
|
+
showSearchPromptWhenEmptyQuery = false,
|
|
9030
|
+
matchTriggerBackground = false
|
|
9030
9031
|
}) => {
|
|
9031
9032
|
const globalConfig = useUnderverseUIConfig();
|
|
9032
9033
|
const resolvedBorderMode = borderMode ?? globalConfig.borderMode ?? "full";
|
|
@@ -9041,6 +9042,7 @@ var Combobox = ({
|
|
|
9041
9042
|
const [query, setQuery] = React30.useState("");
|
|
9042
9043
|
const [activeIndex, setActiveIndex] = React30.useState(null);
|
|
9043
9044
|
const [localRequiredError, setLocalRequiredError] = React30.useState();
|
|
9045
|
+
const [triggerBackgroundColor, setTriggerBackgroundColor] = React30.useState();
|
|
9044
9046
|
useShadCNAnimations();
|
|
9045
9047
|
const inputRef = React30.useRef(null);
|
|
9046
9048
|
const optionsViewportRef = React30.useRef(null);
|
|
@@ -9082,6 +9084,12 @@ var Combobox = ({
|
|
|
9082
9084
|
});
|
|
9083
9085
|
const virtualItems = canVirtualize ? optionVirtualizer.getVirtualItems() : [];
|
|
9084
9086
|
const triggerRef = React30.useRef(null);
|
|
9087
|
+
const updateTriggerBackgroundColor = React30.useCallback(() => {
|
|
9088
|
+
const trigger = triggerRef.current;
|
|
9089
|
+
if (!trigger) return;
|
|
9090
|
+
const backgroundColor = window.getComputedStyle(trigger).backgroundColor;
|
|
9091
|
+
setTriggerBackgroundColor((current) => current === backgroundColor ? current : backgroundColor);
|
|
9092
|
+
}, []);
|
|
9085
9093
|
const scrollVirtualListToIndex = React30.useCallback((index) => {
|
|
9086
9094
|
if (!canVirtualize || renderLimitedOptions.length === 0) return;
|
|
9087
9095
|
optionVirtualizer.scrollToIndex(index, { align: "auto" });
|
|
@@ -9136,6 +9144,19 @@ var Combobox = ({
|
|
|
9136
9144
|
);
|
|
9137
9145
|
}
|
|
9138
9146
|
}, [maxInitialOptions, options.length, searchMode, virtualized]);
|
|
9147
|
+
React30.useLayoutEffect(() => {
|
|
9148
|
+
if (!open || !matchTriggerBackground) {
|
|
9149
|
+
setTriggerBackgroundColor(void 0);
|
|
9150
|
+
return void 0;
|
|
9151
|
+
}
|
|
9152
|
+
let raf = 0;
|
|
9153
|
+
const tick = () => {
|
|
9154
|
+
updateTriggerBackgroundColor();
|
|
9155
|
+
raf = window.requestAnimationFrame(tick);
|
|
9156
|
+
};
|
|
9157
|
+
tick();
|
|
9158
|
+
return () => window.cancelAnimationFrame(raf);
|
|
9159
|
+
}, [matchTriggerBackground, open, updateTriggerBackgroundColor]);
|
|
9139
9160
|
const selectedOption = findOptionByValue(options, value) ?? (selectedOptionProp && getOptionValue(selectedOptionProp) === value ? selectedOptionProp : void 0);
|
|
9140
9161
|
const displayValue = selectedOption ? getOptionLabel(selectedOption) : "";
|
|
9141
9162
|
const selectedIcon = selectedOption ? getOptionIcon(selectedOption) : void 0;
|
|
@@ -9383,6 +9404,7 @@ var Combobox = ({
|
|
|
9383
9404
|
};
|
|
9384
9405
|
const labelSize = size === "sm" ? "text-xs" : size === "lg" ? "text-base" : "text-sm";
|
|
9385
9406
|
const verticalGap = size === "sm" ? "space-y-1.5" : "space-y-2";
|
|
9407
|
+
const dropdownBackgroundStyle = matchTriggerBackground && triggerBackgroundColor ? { backgroundColor: triggerBackgroundColor } : void 0;
|
|
9386
9408
|
const triggerButtonBaseProps = {
|
|
9387
9409
|
ref: triggerRef,
|
|
9388
9410
|
type: "button",
|
|
@@ -9515,11 +9537,19 @@ var Combobox = ({
|
|
|
9515
9537
|
className: "z-50",
|
|
9516
9538
|
borderMode: resolvedBorderMode,
|
|
9517
9539
|
contentClassName: "p-0 overflow-hidden",
|
|
9540
|
+
contentProps: { style: dropdownBackgroundStyle },
|
|
9518
9541
|
children: dropdownBody
|
|
9519
9542
|
}
|
|
9520
9543
|
) : /* @__PURE__ */ jsxs23("div", { className: "relative", children: [
|
|
9521
9544
|
triggerButtonInline,
|
|
9522
|
-
open && /* @__PURE__ */ jsx33("div", { className: "absolute left-0 top-full mt-1 z-50 w-full", children: /* @__PURE__ */ jsx33(
|
|
9545
|
+
open && /* @__PURE__ */ jsx33("div", { className: "absolute left-0 top-full mt-1 z-50 w-full", children: /* @__PURE__ */ jsx33(
|
|
9546
|
+
"div",
|
|
9547
|
+
{
|
|
9548
|
+
style: dropdownBackgroundStyle,
|
|
9549
|
+
className: cn("overflow-hidden border text-popover-foreground shadow-md backdrop-blur-sm bg-popover/95 border-border/60", getPanelBorderRadiusClass(resolvedBorderMode)),
|
|
9550
|
+
children: dropdownBody
|
|
9551
|
+
}
|
|
9552
|
+
) })
|
|
9523
9553
|
] }),
|
|
9524
9554
|
(helperText || effectiveError) && /* @__PURE__ */ jsxs23(
|
|
9525
9555
|
"p",
|