@marianmeres/stuic 3.45.1 → 3.45.3
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.
|
@@ -190,6 +190,9 @@
|
|
|
190
190
|
onClose?: () => void;
|
|
191
191
|
/** Called when any action item is selected (fallback if item has no onSelect) */
|
|
192
192
|
onSelect?: (item: DropdownMenuActionItem) => void | boolean | Promise<void | boolean>;
|
|
193
|
+
/** Reserve scrollbar space to prevent layout shift on open (useful for long lists).
|
|
194
|
+
* When undefined, auto-enables if items count >= 7. */
|
|
195
|
+
scrollbarGutter?: boolean;
|
|
193
196
|
/** Reference to trigger element */
|
|
194
197
|
triggerEl?: HTMLButtonElement;
|
|
195
198
|
/** Reference to dropdown element */
|
|
@@ -291,6 +294,7 @@
|
|
|
291
294
|
onSelect,
|
|
292
295
|
triggerEl = $bindable(),
|
|
293
296
|
dropdownEl = $bindable(),
|
|
297
|
+
scrollbarGutter,
|
|
294
298
|
noScrollLock,
|
|
295
299
|
...rest
|
|
296
300
|
}: Props = $props();
|
|
@@ -683,6 +687,8 @@
|
|
|
683
687
|
|
|
684
688
|
// Position styles for CSS Anchor Positioning
|
|
685
689
|
let dropdownStyle = $derived.by(() => {
|
|
690
|
+
const useGutter = scrollbarGutter ?? items.length >= 7;
|
|
691
|
+
const gutterStyle = useGutter ? "scrollbar-gutter: stable;" : "";
|
|
686
692
|
if (isSupported) {
|
|
687
693
|
// Use fixed height when search is enabled AND position is a "top" variant
|
|
688
694
|
// to prevent jarring resize during filtering (dropdown grows upward)
|
|
@@ -697,6 +703,7 @@
|
|
|
697
703
|
position-area: ${POSITION_MAP[position] || "bottom"};
|
|
698
704
|
margin: ${offset};
|
|
699
705
|
${heightStyle}
|
|
706
|
+
${gutterStyle}
|
|
700
707
|
`;
|
|
701
708
|
} else {
|
|
702
709
|
// Fallback: centered modal overlay
|
|
@@ -711,6 +718,7 @@
|
|
|
711
718
|
transform: translate(-50%, -50%);
|
|
712
719
|
max-width: 90vw;
|
|
713
720
|
${heightStyle}
|
|
721
|
+
${gutterStyle}
|
|
714
722
|
z-index: 50;
|
|
715
723
|
`;
|
|
716
724
|
}
|
|
@@ -159,6 +159,9 @@ export interface Props extends Omit<HTMLButtonAttributes, "children"> {
|
|
|
159
159
|
onClose?: () => void;
|
|
160
160
|
/** Called when any action item is selected (fallback if item has no onSelect) */
|
|
161
161
|
onSelect?: (item: DropdownMenuActionItem) => void | boolean | Promise<void | boolean>;
|
|
162
|
+
/** Reserve scrollbar space to prevent layout shift on open (useful for long lists).
|
|
163
|
+
* When undefined, auto-enables if items count >= 7. */
|
|
164
|
+
scrollbarGutter?: boolean;
|
|
162
165
|
/** Reference to trigger element */
|
|
163
166
|
triggerEl?: HTMLButtonElement;
|
|
164
167
|
/** Reference to dropdown element */
|