bits-ui 1.0.0-next.90 → 1.0.0-next.92

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.
Files changed (50) hide show
  1. package/dist/bits/alert-dialog/components/alert-dialog-content.svelte +8 -5
  2. package/dist/bits/command/command.svelte.d.ts +0 -1
  3. package/dist/bits/command/command.svelte.js +50 -61
  4. package/dist/bits/command/components/command.svelte +3 -2
  5. package/dist/bits/command/compute-command-score.d.ts +26 -0
  6. package/dist/bits/command/{command-score.js → compute-command-score.js} +47 -15
  7. package/dist/bits/command/index.d.ts +1 -0
  8. package/dist/bits/command/index.js +1 -0
  9. package/dist/bits/command/types.d.ts +2 -1
  10. package/dist/bits/dialog/components/dialog-content.svelte +8 -5
  11. package/dist/bits/index.d.ts +1 -1
  12. package/dist/bits/index.js +1 -1
  13. package/dist/bits/menubar/components/menubar-content-static.svelte +9 -0
  14. package/dist/bits/menubar/components/menubar-content.svelte +9 -0
  15. package/dist/bits/menubar/menubar.svelte.d.ts +7 -3
  16. package/dist/bits/menubar/menubar.svelte.js +10 -2
  17. package/dist/bits/navigation-menu/components/navigation-menu-content-impl.svelte +90 -0
  18. package/dist/bits/navigation-menu/components/navigation-menu-content-impl.svelte.d.ts +13 -0
  19. package/dist/bits/navigation-menu/components/navigation-menu-content.svelte +18 -57
  20. package/dist/bits/navigation-menu/components/navigation-menu-content.svelte.d.ts +1 -1
  21. package/dist/bits/navigation-menu/components/navigation-menu-indicator-impl.svelte +32 -0
  22. package/dist/bits/navigation-menu/components/navigation-menu-indicator-impl.svelte.d.ts +4 -0
  23. package/dist/bits/navigation-menu/components/navigation-menu-indicator.svelte +7 -19
  24. package/dist/bits/navigation-menu/components/navigation-menu-list.svelte +10 -8
  25. package/dist/bits/navigation-menu/components/navigation-menu-sub.svelte +44 -0
  26. package/dist/bits/navigation-menu/components/navigation-menu-sub.svelte.d.ts +4 -0
  27. package/dist/bits/navigation-menu/components/navigation-menu-trigger.svelte +3 -3
  28. package/dist/bits/navigation-menu/components/navigation-menu-viewport.svelte +3 -3
  29. package/dist/bits/navigation-menu/exports.d.ts +2 -1
  30. package/dist/bits/navigation-menu/exports.js +1 -0
  31. package/dist/bits/navigation-menu/navigation-menu.svelte.d.ts +209 -201
  32. package/dist/bits/navigation-menu/navigation-menu.svelte.js +572 -621
  33. package/dist/bits/navigation-menu/types.d.ts +18 -2
  34. package/dist/bits/select/select.svelte.d.ts +2 -2
  35. package/dist/bits/select/select.svelte.js +27 -8
  36. package/dist/bits/utilities/dismissible-layer/use-dismissable-layer.svelte.js +1 -1
  37. package/dist/bits/utilities/focus-scope/use-focus-scope.svelte.js +2 -2
  38. package/dist/bits/utilities/popper-layer/popper-layer.svelte +2 -2
  39. package/dist/index.d.ts +1 -1
  40. package/dist/index.js +1 -1
  41. package/dist/internal/events.d.ts +1 -1
  42. package/dist/internal/events.js +2 -2
  43. package/dist/internal/previous-with-init.svelte.d.ts +11 -0
  44. package/dist/internal/previous-with-init.svelte.js +21 -0
  45. package/dist/internal/tabbable.d.ts +1 -0
  46. package/dist/internal/tabbable.js +1 -1
  47. package/dist/internal/use-arrow-navigation.d.ts +0 -1
  48. package/dist/internal/use-arrow-navigation.js +2 -2
  49. package/package.json +1 -1
  50. package/dist/bits/command/command-score.d.ts +0 -1
@@ -1,135 +1,98 @@
1
- import { Previous } from "runed";
2
- import type { ReadableBoxedValues, WritableBoxedValues } from "../../internal/box.svelte.js";
3
- import type { Direction, Orientation } from "../../shared/index.js";
4
- import type { BitsKeyboardEvent, BitsMouseEvent, BitsPointerEvent, ElementRef, WithRefProps } from "../../internal/types.js";
5
- import { noop } from "../../internal/noop.js";
1
+ /**
2
+ * Based on Radix UI's Navigation Menu
3
+ * https://www.radix-ui.com/docs/primitives/components/navigation-menu
4
+ */
5
+ import { type AnyFn, type ReadableBox, type ReadableBoxedValues, type WithRefProps, type WritableBox, type WritableBoxedValues } from "svelte-toolbelt";
6
+ import { Context } from "runed";
7
+ import { type Snippet } from "svelte";
8
+ import { SvelteMap } from "svelte/reactivity";
9
+ import { type Direction, type Orientation } from "../../shared/index.js";
10
+ import type { BitsFocusEvent, BitsKeyboardEvent, BitsMouseEvent, BitsPointerEvent } from "../../internal/types.js";
6
11
  import { useRovingFocus } from "../../internal/use-roving-focus.svelte.js";
7
- type NavigationMenuRootStateProps = WithRefProps & ReadableBoxedValues<{
8
- delayDuration: number;
9
- skipDelayDuration: number;
10
- orientation: Orientation;
11
- dir: Direction;
12
- }> & WritableBoxedValues<{
13
- value: string;
14
- }>;
15
- declare class NavigationMenuRootState {
16
- #private;
17
- id: NavigationMenuRootStateProps["id"];
18
- rootRef: NavigationMenuRootStateProps["ref"];
19
- delayDuration: NavigationMenuRootStateProps["delayDuration"];
20
- skipDelayDuration: NavigationMenuRootStateProps["skipDelayDuration"];
21
- orientation: NavigationMenuRootStateProps["orientation"];
22
- dir: NavigationMenuRootStateProps["dir"];
23
- value: NavigationMenuRootStateProps["value"];
24
- previousValue: Previous<string>;
25
- openTimer: number;
26
- closeTimer: number;
27
- skipDelayTimer: number;
28
- isOpenDelayed: boolean;
29
- constructor(props: NavigationMenuRootStateProps);
30
- handleClose(): void;
31
- onTriggerEnter(itemValue: string): void;
32
- onTriggerLeave(): void;
33
- onContentEnter(): void;
34
- onContentLeave(): void;
35
- onItemSelect(itemValue: string): void;
36
- onItemDismiss(): void;
37
- props: {
38
- readonly id: string;
39
- readonly "aria-label": "Main";
40
- readonly "data-orientation": "horizontal" | "vertical";
41
- readonly dir: Direction;
42
- readonly "data-navigation-menu-root": "";
43
- };
44
- }
45
- type NavigationMenuMenuStateProps = ReadableBoxedValues<{
46
- rootNavigationId: string;
12
+ type NavigationMenuProviderStateProps = ReadableBoxedValues<{
47
13
  dir: Direction;
48
14
  orientation: Orientation;
49
15
  }> & WritableBoxedValues<{
16
+ rootNavigationMenuRef: HTMLElement | null;
50
17
  value: string;
18
+ previousValue: string;
51
19
  }> & {
52
- isRoot: boolean;
20
+ isRootMenu: boolean;
53
21
  onTriggerEnter: (itemValue: string) => void;
54
22
  onTriggerLeave?: () => void;
55
23
  onContentEnter?: () => void;
56
24
  onContentLeave?: () => void;
57
25
  onItemSelect: (itemValue: string) => void;
58
26
  onItemDismiss: () => void;
59
- previousValue: Previous<string>;
60
27
  };
61
- declare class NavigationMenuMenuState {
62
- isRoot: NavigationMenuMenuStateProps["isRoot"];
63
- rootNavigationId: NavigationMenuMenuStateProps["rootNavigationId"];
64
- dir: NavigationMenuMenuStateProps["dir"];
65
- orientation: NavigationMenuMenuStateProps["orientation"];
66
- value: NavigationMenuMenuStateProps["value"];
67
- previousValue: NavigationMenuMenuStateProps["previousValue"];
68
- onTriggerEnter: NavigationMenuMenuStateProps["onTriggerEnter"];
69
- onTriggerLeave: NavigationMenuMenuStateProps["onTriggerLeave"];
70
- onContentEnter: NavigationMenuMenuStateProps["onContentEnter"];
71
- onContentLeave: NavigationMenuMenuStateProps["onContentLeave"];
72
- onItemSelect: NavigationMenuMenuStateProps["onItemSelect"];
73
- onItemDismiss: NavigationMenuMenuStateProps["onItemDismiss"];
74
- viewportNode: HTMLElement | null;
75
- indicatorTrackNode: HTMLElement | null;
76
- viewportContentId: import("svelte-toolbelt").ReadableBox<string | undefined>;
77
- root: NavigationMenuRootState;
78
- triggerRefs: Set<ElementRef>;
79
- constructor(props: NavigationMenuMenuStateProps, root: NavigationMenuRootState);
80
- registerTrigger(ref: ElementRef): void;
81
- deRegisterTrigger(ref: ElementRef): void;
82
- getTriggerNodes(): HTMLElement[];
28
+ declare class NavigationMenuProviderState {
29
+ readonly opts: NavigationMenuProviderStateProps;
30
+ indicatorTrackRef: WritableBox<HTMLElement | null>;
31
+ viewportRef: WritableBox<HTMLElement | null>;
32
+ viewportContent: SvelteMap<string, NavigationMenuItemState>;
33
+ onTriggerEnter: NavigationMenuProviderStateProps["onTriggerEnter"];
34
+ onTriggerLeave: () => void;
35
+ onContentEnter: () => void;
36
+ onContentLeave: () => void;
37
+ onItemSelect: NavigationMenuProviderStateProps["onItemSelect"];
38
+ onItemDismiss: NavigationMenuProviderStateProps["onItemDismiss"];
39
+ constructor(opts: NavigationMenuProviderStateProps);
83
40
  }
84
- type NavigationMenuSubStateProps = WithRefProps & ReadableBoxedValues<{
41
+ type NavigationMenuRootStateProps = WithRefProps<WritableBoxedValues<{
42
+ value: string;
43
+ }> & ReadableBoxedValues<{
44
+ dir: Direction;
85
45
  orientation: Orientation;
86
- }> & WritableBoxedValues<{
46
+ delayDuration: number;
47
+ skipDelayDuration: number;
48
+ }>>;
49
+ declare class NavigationMenuRootState {
50
+ #private;
51
+ readonly opts: NavigationMenuRootStateProps;
52
+ provider: NavigationMenuProviderState;
53
+ previousValue: WritableBox<string>;
54
+ isDelaySkipped: WritableBox<boolean>;
55
+ constructor(opts: NavigationMenuRootStateProps);
56
+ setValue: (newValue: string) => void;
57
+ props: {
58
+ readonly id: string;
59
+ readonly "data-orientation": "horizontal" | "vertical";
60
+ readonly dir: Direction;
61
+ readonly "data-navigation-menu-root": "";
62
+ readonly "data-navigation-menu": "";
63
+ };
64
+ }
65
+ type NavigationMenuSubStateProps = WithRefProps<WritableBoxedValues<{
87
66
  value: string;
88
- }>;
67
+ }> & ReadableBoxedValues<{
68
+ orientation: Orientation;
69
+ }>>;
89
70
  declare class NavigationMenuSubState {
90
- id: NavigationMenuSubStateProps["id"];
91
- isRoot: boolean;
92
- rootNavigationId: NavigationMenuMenuStateProps["rootNavigationId"];
93
- dir: NavigationMenuMenuStateProps["dir"];
94
- orientation: NavigationMenuMenuStateProps["orientation"];
95
- value: NavigationMenuMenuStateProps["value"];
96
- previousValue: Previous<string>;
97
- onTriggerLeave: NavigationMenuMenuStateProps["onTriggerLeave"];
98
- onContentEnter: NavigationMenuMenuStateProps["onContentEnter"];
99
- onContentLeave: NavigationMenuMenuStateProps["onContentLeave"];
100
- viewportNode: HTMLElement | null;
101
- indicatorTrackNode: HTMLElement | null;
102
- viewportContentId: import("svelte-toolbelt").ReadableBox<string | undefined>;
103
- root: NavigationMenuRootState;
104
- triggerRefs: Set<ElementRef>;
105
- ref: NavigationMenuSubStateProps["ref"];
106
- constructor(props: NavigationMenuSubStateProps, root: NavigationMenuRootState);
107
- onTriggerEnter(itemValue: string): void;
108
- onItemSelect(itemValue: string): void;
109
- registerTrigger(ref: ElementRef): void;
110
- deRegisterTrigger(ref: ElementRef): void;
111
- getTriggerNodes(): HTMLElement[];
71
+ readonly opts: NavigationMenuSubStateProps;
72
+ readonly context: NavigationMenuProviderState;
73
+ previousValue: WritableBox<string>;
74
+ constructor(opts: NavigationMenuSubStateProps, context: NavigationMenuProviderState);
75
+ setValue: (newValue: string) => void;
112
76
  props: {
113
77
  readonly id: string;
114
78
  readonly "data-orientation": "horizontal" | "vertical";
115
79
  readonly "data-navigation-menu-sub": "";
80
+ readonly "data-navigation-menu": "";
116
81
  };
117
82
  }
118
- type NavigationMenuListStateProps = WithRefProps & WritableBoxedValues<{
119
- indicatorTrackRef: HTMLElement | null;
120
- }>;
83
+ type NavigationMenuListStateProps = WithRefProps;
121
84
  declare class NavigationMenuListState {
122
- #private;
123
- readonly menu: NavigationMenuMenuState | NavigationMenuSubState;
124
- indicatorTrackRef: NavigationMenuListStateProps["indicatorTrackRef"];
125
- indicatorTrackId: import("svelte-toolbelt").WritableBox<string>;
85
+ readonly opts: NavigationMenuListStateProps;
86
+ readonly context: NavigationMenuProviderState;
87
+ wrapperId: WritableBox<string>;
88
+ wrapperRef: WritableBox<HTMLElement | null>;
89
+ listTriggers: HTMLElement[];
126
90
  rovingFocusGroup: ReturnType<typeof useRovingFocus>;
127
- constructor(props: NavigationMenuListStateProps, menu: NavigationMenuMenuState | NavigationMenuSubState);
128
- indicatorTrackProps: {
91
+ wrapperMounted: boolean;
92
+ constructor(opts: NavigationMenuListStateProps, context: NavigationMenuProviderState);
93
+ registerTrigger(trigger: HTMLElement | null): () => void;
94
+ wrapperProps: {
129
95
  readonly id: string;
130
- readonly style: {
131
- readonly position: "relative";
132
- };
133
96
  };
134
97
  props: {
135
98
  readonly id: string;
@@ -140,69 +103,79 @@ declare class NavigationMenuListState {
140
103
  type NavigationMenuItemStateProps = WithRefProps<ReadableBoxedValues<{
141
104
  value: string;
142
105
  }>>;
143
- declare class NavigationMenuItemState {
106
+ export declare class NavigationMenuItemState {
144
107
  #private;
145
- id: NavigationMenuItemStateProps["id"];
146
- value: NavigationMenuItemStateProps["value"];
108
+ readonly opts: NavigationMenuItemStateProps;
109
+ readonly listContext: NavigationMenuListState;
147
110
  contentNode: HTMLElement | null;
148
111
  triggerNode: HTMLElement | null;
149
- focusProxyRef: import("svelte-toolbelt").WritableBox<HTMLElement | null>;
150
112
  focusProxyNode: HTMLElement | null;
151
- focusProxyId: import("svelte-toolbelt").WritableBox<string>;
152
- restoreContentTabOrder: typeof noop;
113
+ restoreContentTabOrder: AnyFn;
153
114
  wasEscapeClose: boolean;
154
- menu: NavigationMenuMenuState | NavigationMenuSubState;
155
- list: NavigationMenuListState;
156
- constructor(props: NavigationMenuItemStateProps, list: NavigationMenuListState, menu: NavigationMenuMenuState | NavigationMenuSubState);
157
- handleContentEntry(side?: "start" | "end"): void;
158
- handleContentExit(): void;
115
+ contentId: string | undefined;
116
+ triggerId: string | undefined;
117
+ contentChildren: ReadableBox<Snippet | undefined>;
118
+ contentChild: ReadableBox<Snippet<[{
119
+ props: Record<string, unknown>;
120
+ }]> | undefined>;
121
+ contentProps: ReadableBox<Record<string, unknown>>;
122
+ constructor(opts: NavigationMenuItemStateProps, listContext: NavigationMenuListState);
159
123
  onEntryKeydown: (side?: "start" | "end") => void;
160
124
  onFocusProxyEnter: (side?: "start" | "end") => void;
161
- onContentFocusOutside: () => void;
162
125
  onRootContentClose: () => void;
126
+ onContentFocusOutside: () => void;
163
127
  props: {
164
128
  readonly id: string;
165
129
  readonly "data-navigation-menu-item": "";
166
130
  };
167
131
  }
168
132
  type NavigationMenuTriggerStateProps = WithRefProps & ReadableBoxedValues<{
169
- disabled: boolean;
133
+ disabled: boolean | null | undefined;
170
134
  }>;
171
135
  declare class NavigationMenuTriggerState {
172
- #private;
173
- focusProxyMounted: boolean;
174
- menu: NavigationMenuMenuState | NavigationMenuSubState;
175
- item: NavigationMenuItemState;
176
- disabled: NavigationMenuTriggerStateProps["disabled"];
177
- hasPointerMoveOpened: import("svelte-toolbelt").WritableBox<boolean>;
136
+ readonly opts: NavigationMenuTriggerStateProps;
137
+ focusProxyId: WritableBox<string>;
138
+ focusProxyRef: WritableBox<HTMLElement | null>;
139
+ context: NavigationMenuProviderState;
140
+ itemContext: NavigationMenuItemState;
141
+ listContext: NavigationMenuListState;
142
+ hasPointerMoveOpened: WritableBox<boolean>;
178
143
  wasClickClose: boolean;
179
144
  open: boolean;
180
- constructor(props: NavigationMenuTriggerStateProps, item: NavigationMenuItemState);
181
- onpointerenter(_: BitsPointerEvent): void;
182
- onpointermove(e: BitsPointerEvent): void;
183
- onpointerleave(e: BitsPointerEvent): void;
184
- onclick(_: BitsPointerEvent): void;
185
- onkeydown(e: BitsKeyboardEvent): void;
145
+ focusProxyMounted: boolean;
146
+ constructor(opts: NavigationMenuTriggerStateProps, context: {
147
+ provider: NavigationMenuProviderState;
148
+ item: NavigationMenuItemState;
149
+ list: NavigationMenuListState;
150
+ });
151
+ onpointerenter: (_: BitsPointerEvent<HTMLButtonElement>) => void;
152
+ onpointermove: BitsPointerEventHandler<HTMLElement>;
153
+ onpointerleave: BitsPointerEventHandler<HTMLElement>;
154
+ onclick: (_: BitsMouseEvent<HTMLButtonElement>) => void;
155
+ onkeydown: (e: BitsKeyboardEvent<HTMLButtonElement>) => void;
156
+ focusProxyOnFocus: (e: BitsFocusEvent) => void;
186
157
  props: {
187
158
  readonly id: string;
188
- readonly disabled: true | undefined;
159
+ readonly disabled: boolean | null | undefined;
189
160
  readonly "data-disabled": "" | undefined;
190
161
  readonly "data-state": "open" | "closed";
162
+ readonly "data-value": string;
191
163
  readonly "aria-expanded": "true" | "false";
192
164
  readonly "aria-controls": string | undefined;
193
- readonly "data-value": string;
194
- readonly onpointerenter: (_: BitsPointerEvent) => void;
195
- readonly onpointermove: (e: BitsPointerEvent) => void;
196
- readonly onpointerleave: (e: BitsPointerEvent) => void;
197
- readonly onclick: (_: BitsPointerEvent) => void;
198
- readonly onkeydown: (e: BitsKeyboardEvent) => void;
199
165
  readonly "data-navigation-menu-trigger": "";
166
+ readonly onpointermove: BitsPointerEventHandler<HTMLElement>;
167
+ readonly onpointerleave: BitsPointerEventHandler<HTMLElement>;
168
+ readonly onpointerenter: (_: BitsPointerEvent<HTMLButtonElement>) => void;
169
+ readonly onclick: (_: BitsMouseEvent<HTMLButtonElement>) => void;
170
+ readonly onkeydown: (e: BitsKeyboardEvent<HTMLButtonElement>) => void;
200
171
  };
201
- visuallyHiddenProps: {
172
+ focusProxyProps: {
202
173
  readonly id: string;
203
- readonly "aria-hidden": "true";
204
- readonly tabIndex: 0;
205
- readonly onfocus: (e: FocusEvent) => void;
174
+ readonly tabindex: 0;
175
+ readonly onfocus: (e: BitsFocusEvent) => void;
176
+ };
177
+ restructureSpanProps: {
178
+ readonly "aria-owns": string | undefined;
206
179
  };
207
180
  }
208
181
  type NavigationMenuLinkStateProps = WithRefProps & ReadableBoxedValues<{
@@ -210,105 +183,133 @@ type NavigationMenuLinkStateProps = WithRefProps & ReadableBoxedValues<{
210
183
  onSelect: (e: Event) => void;
211
184
  }>;
212
185
  declare class NavigationMenuLinkState {
213
- #private;
214
- active: NavigationMenuLinkStateProps["active"];
215
- onSelect: NavigationMenuLinkStateProps["onSelect"];
216
- content?: NavigationMenuContentState;
217
- item: NavigationMenuItemState;
218
- constructor(props: NavigationMenuLinkStateProps, item: NavigationMenuItemState, content?: NavigationMenuContentState);
219
- onclick(e: BitsMouseEvent): void;
220
- onkeydown(e: BitsKeyboardEvent): void;
186
+ readonly opts: NavigationMenuLinkStateProps;
187
+ readonly context: {
188
+ provider: NavigationMenuProviderState;
189
+ item: NavigationMenuItemState;
190
+ };
191
+ isFocused: boolean;
192
+ constructor(opts: NavigationMenuLinkStateProps, context: {
193
+ provider: NavigationMenuProviderState;
194
+ item: NavigationMenuItemState;
195
+ });
196
+ onclick: (e: BitsMouseEvent<HTMLAnchorElement>) => void;
197
+ onkeydown: (e: BitsKeyboardEvent) => void;
198
+ onfocus: (_: BitsFocusEvent) => void;
199
+ onblur: (_: BitsFocusEvent) => void;
221
200
  props: {
222
201
  readonly id: string;
223
202
  readonly "data-active": "" | undefined;
224
203
  readonly "aria-current": "page" | undefined;
225
- readonly "data-list-link": "" | undefined;
226
- readonly onclick: (e: BitsMouseEvent) => void;
227
- readonly onfocus: (_: FocusEvent) => void;
228
- readonly onkeydown: ((e: BitsKeyboardEvent) => void) | undefined;
204
+ readonly "data-focused": "" | undefined;
205
+ readonly onclick: (e: BitsMouseEvent<HTMLAnchorElement>) => void;
206
+ readonly onkeydown: (e: BitsKeyboardEvent) => void;
207
+ readonly onfocus: (_: BitsFocusEvent) => void;
208
+ readonly onblur: (_: BitsFocusEvent) => void;
209
+ readonly "data-navigation-menu-link": "";
229
210
  };
230
211
  }
231
212
  type NavigationMenuIndicatorStateProps = WithRefProps;
232
213
  declare class NavigationMenuIndicatorState {
233
- id: NavigationMenuIndicatorStateProps["id"];
234
- menu: NavigationMenuMenuState | NavigationMenuSubState;
235
- activeTrigger: HTMLElement | null;
214
+ context: NavigationMenuProviderState;
215
+ isVisible: boolean;
216
+ constructor(context: NavigationMenuProviderState);
217
+ }
218
+ declare class NavigationMenuIndicatorImplState {
219
+ readonly opts: NavigationMenuIndicatorStateProps;
220
+ context: NavigationMenuProviderState;
221
+ listContext: NavigationMenuListState;
236
222
  position: {
237
223
  size: number;
238
224
  offset: number;
239
225
  } | null;
240
226
  isHorizontal: boolean;
241
227
  isVisible: boolean;
242
- indicatorRef: NavigationMenuIndicatorStateProps["ref"];
243
- constructor(props: NavigationMenuIndicatorStateProps, menu: NavigationMenuMenuState | NavigationMenuSubState);
228
+ activeTrigger: HTMLElement | null;
229
+ shouldRender: boolean;
230
+ constructor(opts: NavigationMenuIndicatorStateProps, context: {
231
+ provider: NavigationMenuProviderState;
232
+ list: NavigationMenuListState;
233
+ });
244
234
  handlePositionChange: () => void;
245
235
  props: {
246
- readonly "aria-hidden": "true" | undefined;
236
+ readonly id: string;
247
237
  readonly "data-state": "hidden" | "visible";
248
238
  readonly "data-orientation": "horizontal" | "vertical";
249
239
  readonly style: {
250
240
  readonly left: number;
251
- readonly width: string | undefined;
252
- readonly transform: string | undefined;
241
+ readonly width: string;
242
+ readonly transform: string;
253
243
  readonly position: "absolute";
254
244
  } | {
255
245
  readonly top: number;
256
- readonly height: string | undefined;
257
- readonly transform: string | undefined;
246
+ readonly height: string;
247
+ readonly transform: string;
258
248
  readonly position: "absolute";
259
249
  };
260
250
  readonly "data-navigation-menu-indicator": "";
261
251
  };
262
252
  }
263
- type NavigationMenuContentStateProps = WithRefProps & ReadableBoxedValues<{
264
- forceMount: boolean;
265
- isMounted: boolean;
266
- }>;
267
- type MotionAttribute = "to-start" | "to-end" | "from-start" | "from-end";
253
+ type NavigationMenuContentStateProps = WithRefProps;
268
254
  declare class NavigationMenuContentState {
269
- id: NavigationMenuContentStateProps["id"];
270
- forceMount: NavigationMenuContentStateProps["forceMount"];
271
- isMounted: NavigationMenuContentStateProps["isMounted"];
272
- contentRef: NavigationMenuContentStateProps["ref"];
273
- menu: NavigationMenuMenuState | NavigationMenuSubState;
274
- item: NavigationMenuItemState;
255
+ readonly opts: NavigationMenuContentStateProps;
256
+ context: NavigationMenuProviderState;
257
+ itemContext: NavigationMenuItemState;
258
+ listContext: NavigationMenuListState;
259
+ open: boolean;
260
+ mounted: boolean;
261
+ value: string;
262
+ isLastActiveValue: boolean;
263
+ constructor(opts: NavigationMenuContentStateProps, context: {
264
+ provider: NavigationMenuProviderState;
265
+ item: NavigationMenuItemState;
266
+ list: NavigationMenuListState;
267
+ });
268
+ onpointerenter: (_: BitsPointerEvent) => void;
269
+ onpointerleave: BitsPointerEventHandler<HTMLElement>;
270
+ props: {
271
+ readonly id: string;
272
+ readonly onpointerenter: (_: BitsPointerEvent) => void;
273
+ readonly onpointerleave: BitsPointerEventHandler<HTMLElement>;
274
+ };
275
+ }
276
+ type MotionAttribute = "to-start" | "to-end" | "from-start" | "from-end";
277
+ type NavigationMenuContentImplStateProps = WithRefProps;
278
+ declare class NavigationMenuContentImplState {
279
+ readonly opts: NavigationMenuContentImplStateProps;
280
+ readonly itemContext: NavigationMenuItemState;
281
+ context: NavigationMenuProviderState;
282
+ listContext: NavigationMenuListState;
275
283
  prevMotionAttribute: MotionAttribute | null;
276
284
  motionAttribute: MotionAttribute | null;
277
- open: boolean;
278
- isPresent: boolean;
279
- constructor(props: NavigationMenuContentStateProps, item: NavigationMenuItemState);
280
- onFocusOutside(e: Event): void;
281
- onInteractOutside(e: Event): void;
282
- onEscapeKeydown: (e: KeyboardEvent) => void;
283
- onkeydown(e: BitsKeyboardEvent): void;
285
+ constructor(opts: NavigationMenuContentImplStateProps, itemContext: NavigationMenuItemState);
286
+ onFocusOutside: (e: Event) => void;
287
+ onInteractOutside: (e: PointerEvent) => void;
288
+ onkeydown: (e: BitsKeyboardEvent) => void;
289
+ onEscapeKeydown: (_: KeyboardEvent) => void;
284
290
  props: {
285
291
  readonly id: string;
286
292
  readonly "aria-labelledby": string | undefined;
287
- readonly "data-motion": MotionAttribute | null;
288
- readonly "data-state": "open" | "closed";
293
+ readonly "data-motion": MotionAttribute | undefined;
289
294
  readonly "data-orientation": "horizontal" | "vertical";
290
- readonly "data-navigation-menu-content": "";
291
- readonly style: {
292
- readonly pointerEvents: "none" | undefined;
293
- };
295
+ readonly "data-state": "open" | "closed";
294
296
  readonly onkeydown: (e: BitsKeyboardEvent) => void;
297
+ readonly "data-navigation-menu-content": "";
295
298
  };
296
299
  }
297
- type NavigationMenuViewportStateProps = WithRefProps;
298
300
  declare class NavigationMenuViewportState {
299
- id: NavigationMenuViewportStateProps["id"];
300
- menu: NavigationMenuMenuState | NavigationMenuSubState;
301
+ readonly opts: NavigationMenuViewportImplStateProps;
302
+ readonly context: NavigationMenuProviderState;
303
+ open: boolean;
301
304
  size: {
302
305
  width: number;
303
306
  height: number;
304
307
  } | null;
305
- open: boolean;
308
+ contentNode: HTMLElement | null;
309
+ viewportWidth: string | undefined;
310
+ viewportHeight: string | undefined;
306
311
  activeContentValue: string;
307
- viewportRef: NavigationMenuViewportStateProps["ref"];
308
- contentNode: HTMLElement | null | undefined;
309
- constructor(props: NavigationMenuViewportStateProps, menu: NavigationMenuMenuState | NavigationMenuSubState);
310
- onpointerenter(_: BitsPointerEvent): void;
311
- onpointerleave(e: BitsPointerEvent): void;
312
+ constructor(opts: NavigationMenuViewportImplStateProps, context: NavigationMenuProviderState);
312
313
  props: {
313
314
  readonly id: string;
314
315
  readonly "data-state": "open" | "closed";
@@ -318,16 +319,23 @@ declare class NavigationMenuViewportState {
318
319
  readonly "--bits-navigation-menu-viewport-width": string | undefined;
319
320
  readonly "--bits-navigation-menu-viewport-height": string | undefined;
320
321
  };
321
- readonly onpointerenter: (_: BitsPointerEvent) => void;
322
- readonly onpointerleave: (e: BitsPointerEvent) => void;
322
+ readonly onpointerenter: () => void;
323
+ readonly onpointerleave: () => void;
323
324
  };
324
325
  }
326
+ type NavigationMenuViewportImplStateProps = WithRefProps;
327
+ export declare const NavigationMenuItemContext: Context<NavigationMenuItemState>;
325
328
  export declare function useNavigationMenuRoot(props: NavigationMenuRootStateProps): NavigationMenuRootState;
329
+ export declare function useNavigationMenuProvider(props: NavigationMenuProviderStateProps): NavigationMenuProviderState;
330
+ export declare function useNavigationMenuSub(props: NavigationMenuSubStateProps): NavigationMenuSubState;
326
331
  export declare function useNavigationMenuList(props: NavigationMenuListStateProps): NavigationMenuListState;
327
332
  export declare function useNavigationMenuItem(props: NavigationMenuItemStateProps): NavigationMenuItemState;
333
+ export declare function useNavigationMenuIndicatorImpl(props: NavigationMenuIndicatorStateProps): NavigationMenuIndicatorImplState;
328
334
  export declare function useNavigationMenuTrigger(props: NavigationMenuTriggerStateProps): NavigationMenuTriggerState;
329
335
  export declare function useNavigationMenuContent(props: NavigationMenuContentStateProps): NavigationMenuContentState;
330
- export declare function useNavigationMenuViewport(props: NavigationMenuViewportStateProps): NavigationMenuViewportState;
331
- export declare function useNavigationMenuIndicator(props: NavigationMenuIndicatorStateProps): NavigationMenuIndicatorState;
332
336
  export declare function useNavigationMenuLink(props: NavigationMenuLinkStateProps): NavigationMenuLinkState;
337
+ export declare function useNavigationMenuContentImpl(props: NavigationMenuContentImplStateProps, itemState?: NavigationMenuItemState): NavigationMenuContentImplState;
338
+ export declare function useNavigationMenuViewport(props: NavigationMenuViewportImplStateProps): NavigationMenuViewportState;
339
+ export declare function useNavigationMenuIndicator(): NavigationMenuIndicatorState;
340
+ type BitsPointerEventHandler<T extends HTMLElement = HTMLElement> = (e: BitsPointerEvent<T>) => void;
333
341
  export {};