bits-ui 1.3.7 → 1.3.8
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/dist/bits/avatar/avatar.svelte.d.ts +1 -1
- package/dist/bits/avatar/avatar.svelte.js +2 -0
- package/dist/bits/avatar/types.d.ts +6 -0
- package/dist/bits/menu/menu.svelte.js +6 -3
- package/dist/bits/menubar/components/menubar-trigger.svelte +1 -8
- package/dist/bits/menubar/menubar.svelte.d.ts +0 -1
- package/dist/bits/menubar/menubar.svelte.js +0 -4
- package/package.json +1 -1
|
@@ -16,7 +16,7 @@ type AvatarImageSrc = string | null | undefined;
|
|
|
16
16
|
declare class AvatarRootState {
|
|
17
17
|
readonly opts: AvatarRootStateProps;
|
|
18
18
|
constructor(opts: AvatarRootStateProps);
|
|
19
|
-
loadImage(src: string, crossorigin?: CrossOrigin, referrerPolicy?: ReferrerPolicy): () => void;
|
|
19
|
+
loadImage(src: string, crossorigin?: CrossOrigin, referrerPolicy?: ReferrerPolicy): (() => void) | undefined;
|
|
20
20
|
props: {
|
|
21
21
|
readonly id: string;
|
|
22
22
|
readonly "data-avatar-root": "";
|
|
@@ -12,6 +12,12 @@ export type AvatarRootPropsWithoutHTML = WithChild<{
|
|
|
12
12
|
delayMs?: number;
|
|
13
13
|
/**
|
|
14
14
|
* The loading status of the image.
|
|
15
|
+
*
|
|
16
|
+
* If you are confident that the image exists and will load successfully, you can
|
|
17
|
+
* set this to `"loaded"` to skip the loading process (which shows the fallback)
|
|
18
|
+
* and immediately show the image.
|
|
19
|
+
*
|
|
20
|
+
* @default "loading"
|
|
15
21
|
*/
|
|
16
22
|
loadingStatus?: AvatarImageLoadingStatus;
|
|
17
23
|
/**
|
|
@@ -157,8 +157,9 @@ class MenuContentState {
|
|
|
157
157
|
rootMenu = rootMenu.parentMenu;
|
|
158
158
|
}
|
|
159
159
|
// if for some unforeseen reason the root menu has no trigger, we bail
|
|
160
|
-
if (!rootMenu.triggerNode)
|
|
160
|
+
if (!rootMenu.triggerNode) {
|
|
161
161
|
return;
|
|
162
|
+
}
|
|
162
163
|
// cancel default tab behavior
|
|
163
164
|
e.preventDefault();
|
|
164
165
|
// find the next/previous tabbable
|
|
@@ -172,9 +173,11 @@ class MenuContentState {
|
|
|
172
173
|
*/
|
|
173
174
|
this.parentMenu.root.ignoreCloseAutoFocus = true;
|
|
174
175
|
rootMenu.onClose();
|
|
175
|
-
nodeToFocus.focus();
|
|
176
176
|
afterTick(() => {
|
|
177
|
-
|
|
177
|
+
nodeToFocus.focus();
|
|
178
|
+
afterTick(() => {
|
|
179
|
+
this.parentMenu.root.ignoreCloseAutoFocus = false;
|
|
180
|
+
});
|
|
178
181
|
});
|
|
179
182
|
}
|
|
180
183
|
else {
|
|
@@ -24,14 +24,7 @@
|
|
|
24
24
|
),
|
|
25
25
|
});
|
|
26
26
|
|
|
27
|
-
useMenuDropdownTrigger(
|
|
28
|
-
id: box.with(() => id),
|
|
29
|
-
disabled: box.with(() => disabled ?? false),
|
|
30
|
-
ref: box.with(
|
|
31
|
-
() => ref,
|
|
32
|
-
(v) => (ref = v)
|
|
33
|
-
),
|
|
34
|
-
});
|
|
27
|
+
useMenuDropdownTrigger(triggerState.opts);
|
|
35
28
|
|
|
36
29
|
const mergedProps = $derived(mergeProps(restProps, triggerState.props));
|
|
37
30
|
</script>
|
|
@@ -100,7 +100,6 @@ declare class MenubarContentState {
|
|
|
100
100
|
readonly opts: MenubarContentStateProps;
|
|
101
101
|
readonly menu: MenubarMenuState;
|
|
102
102
|
root: MenubarRootState;
|
|
103
|
-
hasInteractedOutside: boolean;
|
|
104
103
|
focusScopeContext: FocusScopeContextValue;
|
|
105
104
|
constructor(opts: MenubarContentStateProps, menu: MenubarMenuState);
|
|
106
105
|
onCloseAutoFocus: (e: Event) => void;
|
|
@@ -195,7 +195,6 @@ class MenubarContentState {
|
|
|
195
195
|
opts;
|
|
196
196
|
menu;
|
|
197
197
|
root;
|
|
198
|
-
hasInteractedOutside = $state(false);
|
|
199
198
|
focusScopeContext;
|
|
200
199
|
constructor(opts, menu) {
|
|
201
200
|
this.opts = opts;
|
|
@@ -215,8 +214,6 @@ class MenubarContentState {
|
|
|
215
214
|
this.opts.onCloseAutoFocus.current(e);
|
|
216
215
|
if (e.defaultPrevented)
|
|
217
216
|
return;
|
|
218
|
-
this.hasInteractedOutside = false;
|
|
219
|
-
e.preventDefault();
|
|
220
217
|
};
|
|
221
218
|
onFocusOutside = (e) => {
|
|
222
219
|
const target = e.target;
|
|
@@ -228,7 +225,6 @@ class MenubarContentState {
|
|
|
228
225
|
this.opts.onFocusOutside.current(e);
|
|
229
226
|
};
|
|
230
227
|
onInteractOutside = (e) => {
|
|
231
|
-
this.hasInteractedOutside = true;
|
|
232
228
|
this.opts.onInteractOutside.current(e);
|
|
233
229
|
};
|
|
234
230
|
onOpenAutoFocus = (e) => {
|