@wix/site-ui 1.29.0 → 1.31.0

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 (177) hide show
  1. package/dist/1268.js +99 -0
  2. package/dist/1279.js +7 -0
  3. package/dist/1457.js +10 -0
  4. package/dist/1477.js +106 -0
  5. package/dist/1500.js +111 -0
  6. package/dist/167.js +6 -0
  7. package/dist/2274.js +34 -0
  8. package/dist/2287.js +17 -0
  9. package/dist/2418.js +31 -0
  10. package/dist/2801.js +20 -0
  11. package/dist/285.js +86 -0
  12. package/dist/2861.js +6 -0
  13. package/dist/3020.js +7 -0
  14. package/dist/3021.js +72 -0
  15. package/dist/3056.js +229 -0
  16. package/dist/3140.js +4 -0
  17. package/dist/3248.js +307 -0
  18. package/dist/3296.js +4 -0
  19. package/dist/3319.js +400 -0
  20. package/dist/3395.js +4 -0
  21. package/dist/3485.js +854 -0
  22. package/dist/353.js +14 -0
  23. package/dist/3670.js +418 -0
  24. package/dist/3829.js +113 -0
  25. package/dist/4026.js +12 -0
  26. package/dist/4143.js +46 -0
  27. package/dist/42.js +32 -0
  28. package/dist/4281.js +30 -0
  29. package/dist/4346.js +2 -0
  30. package/dist/4388.js +418 -0
  31. package/dist/4490.js +32 -0
  32. package/dist/4495.js +9 -0
  33. package/dist/4549.js +24 -0
  34. package/dist/4586.js +41 -0
  35. package/dist/4586.js.LICENSE.txt +19 -0
  36. package/dist/4707.js +19 -0
  37. package/dist/4723.js +7 -0
  38. package/dist/4745.js +7 -0
  39. package/dist/4768.js +35 -0
  40. package/dist/4922.js +15 -0
  41. package/dist/5036.js +17 -0
  42. package/dist/5085.js +20 -0
  43. package/dist/5299.js +597 -0
  44. package/dist/5659.js +4 -0
  45. package/dist/5778.js +10 -0
  46. package/dist/5864.js +86 -0
  47. package/dist/5992.js +913 -0
  48. package/dist/5992.js.LICENSE.txt +19 -0
  49. package/dist/6003.js +10 -0
  50. package/dist/6046.js +29 -0
  51. package/dist/6089.js +2355 -0
  52. package/dist/6107.js +10 -0
  53. package/dist/6247.js +20 -0
  54. package/dist/6270.js +487 -0
  55. package/dist/6329.js +32 -0
  56. package/dist/6330.js +30 -0
  57. package/dist/6499.js +7 -0
  58. package/dist/6535.js +71 -0
  59. package/dist/6588.js +382 -0
  60. package/dist/6706.js +16 -0
  61. package/dist/6825.js +7 -0
  62. package/dist/6882.js +1562 -0
  63. package/dist/6914.js +30 -0
  64. package/dist/7021.js +13 -0
  65. package/dist/7366.js +83 -0
  66. package/dist/7373.js +25 -0
  67. package/dist/7541.js +25 -0
  68. package/dist/7564.js +10 -0
  69. package/dist/7642.js +20 -0
  70. package/dist/7725.js +10 -0
  71. package/dist/7871.js +38 -0
  72. package/dist/8052.js +352 -0
  73. package/dist/8106.js +238 -0
  74. package/dist/8171.js +346 -0
  75. package/dist/8225.js +21 -0
  76. package/dist/8272.js +333 -0
  77. package/dist/8527.js +58 -0
  78. package/dist/8724.js +10 -0
  79. package/dist/8750.js +1920 -0
  80. package/dist/8758.js +43 -0
  81. package/dist/880.js +149 -0
  82. package/dist/8935.js +8 -0
  83. package/dist/8960.js +22 -0
  84. package/dist/8971.js +40 -0
  85. package/dist/8979.js +10 -0
  86. package/dist/8996.js +71 -0
  87. package/dist/904.js +121 -0
  88. package/dist/9048.js +52 -0
  89. package/dist/9087.js +256 -0
  90. package/dist/9189.js +158 -0
  91. package/dist/9255.js +136 -0
  92. package/dist/9352.js +148 -0
  93. package/dist/951.js +22 -0
  94. package/dist/9635.js +22 -0
  95. package/dist/9829.js +4 -0
  96. package/dist/9863.js +8 -0
  97. package/dist/Accordion/index.d.ts +569 -12
  98. package/dist/Accordion/index.js +423 -8
  99. package/dist/AlertDialog/index.d.ts +1417 -18
  100. package/dist/AlertDialog/index.js +34 -14
  101. package/dist/Autocomplete/index.d.ts +1861 -38
  102. package/dist/Autocomplete/index.js +98 -24
  103. package/dist/Avatar/index.d.ts +129 -7
  104. package/dist/Avatar/index.js +149 -6
  105. package/dist/Badge/index.css +44 -0
  106. package/dist/Badge/index.d.ts +22 -0
  107. package/dist/Badge/index.js +23 -0
  108. package/dist/Breadcrumbs/index.d.ts +960 -7
  109. package/dist/Breadcrumbs/index.js +5 -5
  110. package/dist/Button/index.d.ts +88 -6
  111. package/dist/Button/index.js +27 -3
  112. package/dist/Checkbox/index.d.ts +425 -5
  113. package/dist/Checkbox/index.js +45 -5
  114. package/dist/CheckboxGroup/index.d.ts +318 -3
  115. package/dist/CheckboxGroup/index.js +166 -3
  116. package/dist/Collapsible/index.d.ts +377 -7
  117. package/dist/Collapsible/index.js +160 -6
  118. package/dist/Combobox/index.d.ts +1984 -48
  119. package/dist/Combobox/index.js +352 -29
  120. package/dist/ContextMenu/index.d.ts +2340 -36
  121. package/dist/ContextMenu/index.js +197 -22
  122. package/dist/Dialog/index.d.ts +1355 -18
  123. package/dist/Dialog/index.js +16 -14
  124. package/dist/Drawer/index.d.ts +1653 -18
  125. package/dist/Drawer/index.js +2797 -20
  126. package/dist/Field/index.d.ts +655 -15
  127. package/dist/Field/index.js +677 -10
  128. package/dist/Fieldset/index.d.ts +94 -5
  129. package/dist/Fieldset/index.js +68 -5
  130. package/dist/Form/index.d.ts +331 -2
  131. package/dist/Form/index.js +106 -3
  132. package/dist/Input/index.d.ts +692 -3
  133. package/dist/Input/index.js +10 -3
  134. package/dist/Menu/index.d.ts +2301 -36
  135. package/dist/Menu/index.js +365 -26
  136. package/dist/Menubar/index.d.ts +2301 -3
  137. package/dist/Menubar/index.js +105 -3
  138. package/dist/Meter/index.d.ts +175 -11
  139. package/dist/Meter/index.js +129 -9
  140. package/dist/NavigationMenu/index.d.ts +978 -28
  141. package/dist/NavigationMenu/index.js +1034 -17
  142. package/dist/NumberField/index.d.ts +612 -15
  143. package/dist/NumberField/index.js +1409 -11
  144. package/dist/Popover/index.d.ts +1655 -20
  145. package/dist/Popover/index.js +792 -17
  146. package/dist/PreviewCard/index.d.ts +1523 -14
  147. package/dist/PreviewCard/index.js +679 -14
  148. package/dist/Progress/index.d.ts +183 -11
  149. package/dist/Progress/index.js +181 -9
  150. package/dist/Radio/index.d.ts +185 -6
  151. package/dist/Radio/index.js +253 -6
  152. package/dist/RadioGroup/index.d.ts +341 -2
  153. package/dist/RadioGroup/index.js +154 -3
  154. package/dist/ScrollArea/index.d.ts +265 -13
  155. package/dist/ScrollArea/index.js +892 -10
  156. package/dist/Select/index.d.ts +1493 -38
  157. package/dist/Select/index.js +1824 -23
  158. package/dist/Separator/index.d.ts +80 -6
  159. package/dist/Separator/index.js +3 -3
  160. package/dist/Slider/index.d.ts +678 -16
  161. package/dist/Slider/index.js +1199 -11
  162. package/dist/Switch/index.d.ts +393 -5
  163. package/dist/Switch/index.js +208 -6
  164. package/dist/Tabs/index.d.ts +523 -12
  165. package/dist/Tabs/index.js +685 -9
  166. package/dist/Toggle/index.d.ts +305 -2
  167. package/dist/Toggle/index.js +76 -3
  168. package/dist/ToggleGroup/index.d.ts +316 -2
  169. package/dist/ToggleGroup/index.js +102 -3
  170. package/dist/Toolbar/index.d.ts +282 -13
  171. package/dist/Toolbar/index.js +230 -9
  172. package/dist/Tooltip/index.d.ts +1572 -14
  173. package/dist/Tooltip/index.js +965 -14
  174. package/dist/index.d.ts +12758 -646
  175. package/dist/index.js +1 -0
  176. package/dist/rslib-runtime.js +18 -0
  177. package/package.json +3 -3
@@ -1,7 +1,1024 @@
1
- import { jsx } from "react/jsx-runtime";
2
- import { NavigationMenu } from "@base-ui/react/navigation-menu";
1
+ import { jsx, jsxs } from "react/jsx-runtime";
3
2
  import clsx from "clsx";
3
+ import { FocusGuard_FocusGuard, disableFocusInside, ownerVisuallyHidden, triggerOpenStateMapping, DROPDOWN_COLLISION_AVOIDANCE, POPUP_COLLISION_AVOIDANCE, getTabbableAfterElement, enableFocusInside, FloatingPortal_FloatingPortal, getPreviousTabbable, isOutsideEvent, getNextTabbable, pressableTriggerOpenStateMapping, popupStateMapping } from "../4388.js";
4
+ import { useAnimationsFinished, stateAttributesMapping_TransitionStatusDataAttributes, useTransitionStatus, transitionStatusMapping, useOpenChangeComplete } from "../880.js";
5
+ import { useNavigationMenuDismissContext, useNavigationMenuRootContext, NavigationMenuPopupCssVars_NavigationMenuPopupCssVars, useNavigationMenuTreeContext, NavigationMenuPositionerCssVars_NavigationMenuPositionerCssVars, NavigationMenuItem_NavigationMenuItem, NavigationMenuList_NavigationMenuList, isOutsideMenuEvent, NavigationMenuLink_NavigationMenuLink, NavigationMenuRoot_NavigationMenuRoot, useNavigationMenuItemContext, NAVIGATION_MENU_TRIGGER_IDENTIFIER } from "../6588.js";
6
+ import { useIsoLayoutEffect } from "../6499.js";
7
+ import { useStableCallback } from "../7541.js";
8
+ import { getTarget, contains } from "../4549.js";
9
+ import { inertValue } from "../167.js";
10
+ import { CompositeRoot } from "../9087.js";
11
+ import { useFloatingTree, FloatingNode } from "../285.js";
12
+ import { EMPTY_OBJECT, mergeProps, EMPTY_ARRAY, useRenderElement, esm_formatErrorMessage } from "../8272.js";
13
+ import { useDirection } from "../9863.js";
14
+ import { useTimeout } from "../42.js";
15
+ import { useAnimationFrame } from "../8996.js";
16
+ import { useValueAsRef } from "../4707.js";
17
+ import { getCssDimensions } from "../7642.js";
18
+ import { getWindow, isHTMLElement } from "../3829.js";
19
+ import { addEventListener } from "../4723.js";
20
+ import { focusOut, listNavigation, triggerHover, triggerPress } from "../2418.js";
21
+ import { usePositioner, adaptiveOriginMiddleware_adaptiveOrigin, useFloatingRootContext, useAnchorPositioning } from "../8750.js";
22
+ import { applySafePolygonPointerEventsMutation, useHoverInteractionSharedState, clearSafePolygonPointerEventsMutation } from "../3056.js";
23
+ import { safePolygon, useHoverReferenceInteraction } from "../3670.js";
24
+ import { useClick } from "../5864.js";
25
+ import { createChangeEventDetails } from "../4768.js";
26
+ import { stopEvent } from "../6330.js";
27
+ import { useButton } from "../9189.js";
28
+ import { CompositeItem } from "../951.js";
29
+ import { getEmptyRootContext } from "../4922.js";
30
+ import { mergeCleanups } from "../4495.js";
31
+ import { useBaseUiId, useId } from "../6046.js";
4
32
  import * as __rspack_external_react from "react";
33
+ import * as __rspack_external_react_dom_7136dc57 from "react-dom";
34
+ const stateAttributesMapping = {
35
+ ...popupStateMapping,
36
+ ...transitionStatusMapping,
37
+ activationDirection (value) {
38
+ if (!value) return null;
39
+ return {
40
+ 'data-activation-direction': value
41
+ };
42
+ }
43
+ };
44
+ const NavigationMenuContent_NavigationMenuContent = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
45
+ const { render, className, style, keepMounted = false, ...elementProps } = componentProps;
46
+ const { mounted: popupMounted, viewportElement, value, activationDirection, currentContentRef, viewportTargetElement } = useNavigationMenuRootContext();
47
+ const { value: itemValue } = useNavigationMenuItemContext();
48
+ const nodeId = useNavigationMenuTreeContext();
49
+ const open = popupMounted && value === itemValue;
50
+ const ref = __rspack_external_react.useRef(null);
51
+ const [hasMountedInPortal, setHasMountedInPortal] = __rspack_external_react.useState(false);
52
+ const [focusInside, setFocusInside] = __rspack_external_react.useState(false);
53
+ const { mounted, setMounted, transitionStatus } = useTransitionStatus(open);
54
+ if (mounted && !popupMounted) setMounted(false);
55
+ useOpenChangeComplete({
56
+ ref,
57
+ open,
58
+ onComplete () {
59
+ if (!open) setMounted(false);
60
+ }
61
+ });
62
+ useIsoLayoutEffect(()=>{
63
+ if (open && ref.current) currentContentRef.current = ref.current;
64
+ }, [
65
+ open,
66
+ currentContentRef
67
+ ]);
68
+ const state = {
69
+ open,
70
+ transitionStatus,
71
+ activationDirection
72
+ };
73
+ const handleCurrentContentRef = useStableCallback((node)=>{
74
+ if (node && open) currentContentRef.current = node;
75
+ });
76
+ const commonProps = {
77
+ onFocus (event) {
78
+ const target = getTarget(event.nativeEvent);
79
+ if (target?.hasAttribute('data-base-ui-focus-guard')) return;
80
+ setFocusInside(true);
81
+ },
82
+ onBlur (event) {
83
+ if (!contains(event.currentTarget, event.relatedTarget)) setFocusInside(false);
84
+ }
85
+ };
86
+ const defaultProps = !open && mounted ? {
87
+ style: {
88
+ position: 'absolute',
89
+ top: 0,
90
+ left: 0
91
+ },
92
+ inert: inertValue(!focusInside),
93
+ ...commonProps
94
+ } : commonProps;
95
+ const portalContainer = viewportTargetElement || viewportElement;
96
+ const hidden = keepMounted && !mounted;
97
+ const shouldRenderInline = keepMounted && !portalContainer && !hasMountedInPortal;
98
+ if (keepMounted && portalContainer && !hasMountedInPortal) setHasMountedInPortal(true);
99
+ if (shouldRenderInline) return /*#__PURE__*/ jsx(CompositeRoot, {
100
+ render: render,
101
+ className: className,
102
+ style: style,
103
+ state: state,
104
+ refs: [
105
+ forwardedRef
106
+ ],
107
+ props: [
108
+ defaultProps,
109
+ {
110
+ hidden: true
111
+ },
112
+ elementProps
113
+ ],
114
+ stateAttributesMapping: stateAttributesMapping
115
+ });
116
+ if (!portalContainer || !mounted && !keepMounted) return null;
117
+ return /*#__PURE__*/ __rspack_external_react_dom_7136dc57.createPortal(/*#__PURE__*/ jsx(FloatingNode, {
118
+ id: nodeId,
119
+ children: /*#__PURE__*/ jsx(CompositeRoot, {
120
+ render: render,
121
+ className: className,
122
+ style: style,
123
+ state: state,
124
+ refs: [
125
+ forwardedRef,
126
+ ref,
127
+ handleCurrentContentRef
128
+ ],
129
+ props: [
130
+ defaultProps,
131
+ hidden ? {
132
+ hidden: true
133
+ } : EMPTY_OBJECT,
134
+ elementProps
135
+ ],
136
+ stateAttributesMapping: stateAttributesMapping
137
+ })
138
+ }), portalContainer);
139
+ });
140
+ if ("production" !== process.env.NODE_ENV) NavigationMenuContent_NavigationMenuContent.displayName = "NavigationMenuContent";
141
+ const DEFAULT_SIZE = {
142
+ width: 0,
143
+ height: 0
144
+ };
145
+ const NavigationMenuTrigger_NavigationMenuTrigger = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
146
+ const { render, className, style, nativeButton = true, disabled, ...elementProps } = componentProps;
147
+ const { value, setValue, mounted, open, positionerElement, setActivationDirection, setFloatingRootContext, popupElement, viewportElement, transitionStatus, rootRef, beforeOutsideRef, afterOutsideRef, afterInsideRef, beforeInsideRef, prevTriggerElementRef, popupAutoSizeResetRef, currentContentRef, delay, closeDelay, orientation, setViewportInert, nested } = useNavigationMenuRootContext();
148
+ const { value: itemValue } = useNavigationMenuItemContext();
149
+ const nodeId = useNavigationMenuTreeContext();
150
+ const tree = useFloatingTree();
151
+ const dismissProps = useNavigationMenuDismissContext();
152
+ const direction = useDirection();
153
+ const stickIfOpenTimeout = useTimeout();
154
+ const focusFrame = useAnimationFrame();
155
+ const mutationFrame = useAnimationFrame();
156
+ const resizeFrame = useAnimationFrame();
157
+ const sizeFrame = useAnimationFrame();
158
+ const [triggerElement, setTriggerElement] = __rspack_external_react.useState(null);
159
+ const [stickIfOpen, setStickIfOpen] = __rspack_external_react.useState(true);
160
+ const [pointerType, setPointerType] = __rspack_external_react.useState('');
161
+ const triggerElementRef = __rspack_external_react.useRef(null);
162
+ const allowFocusRef = __rspack_external_react.useRef(false);
163
+ const prevSizeRef = __rspack_external_react.useRef(DEFAULT_SIZE);
164
+ const skipAutoSizeSyncRef = __rspack_external_react.useRef(false);
165
+ const isActiveItem = open && value === itemValue;
166
+ const isActiveItemRef = useValueAsRef(isActiveItem);
167
+ const interactionsEnabled = positionerElement ? true : !value;
168
+ const hoverFloatingElement = positionerElement || viewportElement;
169
+ const hoverInteractionsEnabled = hoverFloatingElement ? true : !value;
170
+ const runOnceAnimationsFinish = useAnimationsFinished(popupElement, false, false);
171
+ const handleTriggerElement = __rspack_external_react.useCallback((element)=>{
172
+ triggerElementRef.current = element;
173
+ setTriggerElement(element);
174
+ }, []);
175
+ const cancelAutoSizeReset = useStableCallback((force = false)=>{
176
+ if (!force && popupAutoSizeResetRef.current.owner !== itemValue) return;
177
+ popupAutoSizeResetRef.current.abortController?.abort();
178
+ popupAutoSizeResetRef.current.abortController = null;
179
+ popupAutoSizeResetRef.current.owner = null;
180
+ });
181
+ useIsoLayoutEffect(()=>{
182
+ if (isActiveItem) return;
183
+ mutationFrame.cancel();
184
+ sizeFrame.cancel();
185
+ cancelAutoSizeReset();
186
+ }, [
187
+ isActiveItem,
188
+ mutationFrame,
189
+ sizeFrame,
190
+ cancelAutoSizeReset
191
+ ]);
192
+ function setAutoSizes() {
193
+ if (!popupElement) return;
194
+ popupElement.style.setProperty(NavigationMenuPopupCssVars_NavigationMenuPopupCssVars.popupWidth, 'auto');
195
+ popupElement.style.setProperty(NavigationMenuPopupCssVars_NavigationMenuPopupCssVars.popupHeight, 'auto');
196
+ }
197
+ function clearFixedSizes() {
198
+ if (!popupElement || !positionerElement) return;
199
+ popupElement.style.removeProperty(NavigationMenuPopupCssVars_NavigationMenuPopupCssVars.popupWidth);
200
+ popupElement.style.removeProperty(NavigationMenuPopupCssVars_NavigationMenuPopupCssVars.popupHeight);
201
+ positionerElement.style.removeProperty(NavigationMenuPositionerCssVars_NavigationMenuPositionerCssVars.positionerWidth);
202
+ positionerElement.style.removeProperty(NavigationMenuPositionerCssVars_NavigationMenuPositionerCssVars.positionerHeight);
203
+ }
204
+ function setSharedFixedSizes(width, height) {
205
+ if (!popupElement || !positionerElement) return;
206
+ popupElement.style.setProperty(NavigationMenuPopupCssVars_NavigationMenuPopupCssVars.popupWidth, `${width}px`);
207
+ popupElement.style.setProperty(NavigationMenuPopupCssVars_NavigationMenuPopupCssVars.popupHeight, `${height}px`);
208
+ positionerElement.style.setProperty(NavigationMenuPositionerCssVars_NavigationMenuPositionerCssVars.positionerWidth, `${width}px`);
209
+ positionerElement.style.setProperty(NavigationMenuPositionerCssVars_NavigationMenuPositionerCssVars.positionerHeight, `${height}px`);
210
+ }
211
+ function scheduleAutoSizeReset() {
212
+ cancelAutoSizeReset(true);
213
+ const abortController = new AbortController();
214
+ popupAutoSizeResetRef.current.abortController = abortController;
215
+ popupAutoSizeResetRef.current.owner = itemValue;
216
+ runOnceAnimationsFinish(()=>{
217
+ if (popupAutoSizeResetRef.current.abortController !== abortController || popupAutoSizeResetRef.current.owner !== itemValue) return;
218
+ popupAutoSizeResetRef.current.abortController = null;
219
+ popupAutoSizeResetRef.current.owner = null;
220
+ setAutoSizes();
221
+ }, abortController.signal);
222
+ }
223
+ const handleValueChange = useStableCallback((currentWidth, currentHeight, options = {})=>{
224
+ if (!popupElement || !positionerElement) return;
225
+ cancelAutoSizeReset(true);
226
+ const { syncPositioner = false } = options;
227
+ clearFixedSizes();
228
+ const { width, height } = getCssDimensions(popupElement);
229
+ const measuredWidth = width || prevSizeRef.current.width;
230
+ const measuredHeight = height || prevSizeRef.current.height;
231
+ if (0 === currentHeight || 0 === currentWidth) {
232
+ currentWidth = measuredWidth;
233
+ currentHeight = measuredHeight;
234
+ }
235
+ popupElement.style.setProperty(NavigationMenuPopupCssVars_NavigationMenuPopupCssVars.popupWidth, `${currentWidth}px`);
236
+ popupElement.style.setProperty(NavigationMenuPopupCssVars_NavigationMenuPopupCssVars.popupHeight, `${currentHeight}px`);
237
+ positionerElement.style.setProperty(NavigationMenuPositionerCssVars_NavigationMenuPositionerCssVars.positionerWidth, `${syncPositioner ? currentWidth : measuredWidth}px`);
238
+ positionerElement.style.setProperty(NavigationMenuPositionerCssVars_NavigationMenuPositionerCssVars.positionerHeight, `${syncPositioner ? currentHeight : measuredHeight}px`);
239
+ sizeFrame.request(()=>{
240
+ if (!isActiveItemRef.current) return;
241
+ popupElement.style.setProperty(NavigationMenuPopupCssVars_NavigationMenuPopupCssVars.popupWidth, `${measuredWidth}px`);
242
+ popupElement.style.setProperty(NavigationMenuPopupCssVars_NavigationMenuPopupCssVars.popupHeight, `${measuredHeight}px`);
243
+ if (syncPositioner) {
244
+ positionerElement.style.setProperty(NavigationMenuPositionerCssVars_NavigationMenuPositionerCssVars.positionerWidth, `${measuredWidth}px`);
245
+ positionerElement.style.setProperty(NavigationMenuPositionerCssVars_NavigationMenuPositionerCssVars.positionerHeight, `${measuredHeight}px`);
246
+ }
247
+ scheduleAutoSizeReset();
248
+ });
249
+ });
250
+ const handleInterruptedMutationResize = useStableCallback((currentWidth, currentHeight)=>{
251
+ if (!popupElement || !positionerElement) return;
252
+ sizeFrame.cancel();
253
+ mutationFrame.cancel();
254
+ cancelAutoSizeReset(true);
255
+ if (0 === currentWidth || 0 === currentHeight) return;
256
+ setSharedFixedSizes(currentWidth, currentHeight);
257
+ mutationFrame.request(()=>{
258
+ mutationFrame.request(()=>{
259
+ clearFixedSizes();
260
+ const { width, height } = getCssDimensions(popupElement);
261
+ const measuredWidth = width || currentWidth || prevSizeRef.current.width;
262
+ const measuredHeight = height || currentHeight || prevSizeRef.current.height;
263
+ setSharedFixedSizes(currentWidth, currentHeight);
264
+ sizeFrame.request(()=>{
265
+ if (!isActiveItemRef.current) return;
266
+ setSharedFixedSizes(measuredWidth, measuredHeight);
267
+ scheduleAutoSizeReset();
268
+ });
269
+ });
270
+ });
271
+ });
272
+ const syncCurrentSize = useStableCallback(()=>{
273
+ if (!popupElement || !positionerElement) return;
274
+ sizeFrame.cancel();
275
+ cancelAutoSizeReset(true);
276
+ clearFixedSizes();
277
+ const { width, height } = getCssDimensions(popupElement);
278
+ if (0 === width || 0 === height) return;
279
+ prevSizeRef.current = {
280
+ width,
281
+ height
282
+ };
283
+ setAutoSizes();
284
+ positionerElement.style.setProperty(NavigationMenuPositionerCssVars_NavigationMenuPositionerCssVars.positionerWidth, `${width}px`);
285
+ positionerElement.style.setProperty(NavigationMenuPositionerCssVars_NavigationMenuPositionerCssVars.positionerHeight, `${height}px`);
286
+ });
287
+ const getMutationBaseline = useStableCallback(()=>{
288
+ if (!popupElement) return {
289
+ size: prevSizeRef.current,
290
+ syncPositioner: false
291
+ };
292
+ const popupWidth = popupElement.style.getPropertyValue(NavigationMenuPopupCssVars_NavigationMenuPopupCssVars.popupWidth);
293
+ const popupHeight = popupElement.style.getPropertyValue(NavigationMenuPopupCssVars_NavigationMenuPopupCssVars.popupHeight);
294
+ const isResizing = '' !== popupWidth && 'auto' !== popupWidth && '' !== popupHeight && 'auto' !== popupHeight;
295
+ if (!isResizing) return {
296
+ size: prevSizeRef.current,
297
+ syncPositioner: false
298
+ };
299
+ return {
300
+ size: {
301
+ width: popupElement.offsetWidth || prevSizeRef.current.width,
302
+ height: popupElement.offsetHeight || prevSizeRef.current.height
303
+ },
304
+ syncPositioner: true
305
+ };
306
+ });
307
+ __rspack_external_react.useEffect(()=>{
308
+ if (!open) {
309
+ stickIfOpenTimeout.clear();
310
+ mutationFrame.cancel();
311
+ resizeFrame.cancel();
312
+ sizeFrame.cancel();
313
+ cancelAutoSizeReset(true);
314
+ skipAutoSizeSyncRef.current = false;
315
+ setPointerType('');
316
+ }
317
+ }, [
318
+ stickIfOpenTimeout,
319
+ open,
320
+ mutationFrame,
321
+ resizeFrame,
322
+ sizeFrame,
323
+ cancelAutoSizeReset
324
+ ]);
325
+ __rspack_external_react.useEffect(()=>{
326
+ if (!mounted) prevSizeRef.current = DEFAULT_SIZE;
327
+ }, [
328
+ mounted
329
+ ]);
330
+ __rspack_external_react.useEffect(()=>{
331
+ if (!popupElement || 'function' != typeof ResizeObserver) return;
332
+ const resizeObserver = new ResizeObserver(()=>{
333
+ prevSizeRef.current = {
334
+ width: popupElement.offsetWidth,
335
+ height: popupElement.offsetHeight
336
+ };
337
+ });
338
+ resizeObserver.observe(popupElement);
339
+ return ()=>{
340
+ resizeObserver.disconnect();
341
+ };
342
+ }, [
343
+ popupElement
344
+ ]);
345
+ __rspack_external_react.useEffect(()=>{
346
+ if (!open || !isActiveItem || !popupElement || !positionerElement) return;
347
+ const win = getWindow(positionerElement);
348
+ function handleResize() {
349
+ resizeFrame.cancel();
350
+ resizeFrame.request(syncCurrentSize);
351
+ }
352
+ const unsubscribe = addEventListener(win, 'resize', handleResize);
353
+ return ()=>{
354
+ resizeFrame.cancel();
355
+ unsubscribe();
356
+ };
357
+ }, [
358
+ open,
359
+ isActiveItem,
360
+ popupElement,
361
+ positionerElement,
362
+ resizeFrame,
363
+ syncCurrentSize
364
+ ]);
365
+ __rspack_external_react.useEffect(()=>{
366
+ const observedElement = currentContentRef.current;
367
+ if (!observedElement || !popupElement || !isActiveItem || 'function' != typeof MutationObserver) return;
368
+ const mutationObserver = new MutationObserver(()=>{
369
+ if ('starting' === transitionStatus || popupElement.hasAttribute(stateAttributesMapping_TransitionStatusDataAttributes.startingStyle)) return void syncCurrentSize();
370
+ const { size, syncPositioner } = getMutationBaseline();
371
+ if (syncPositioner) return void handleInterruptedMutationResize(size.width, size.height);
372
+ handleValueChange(size.width, size.height);
373
+ });
374
+ mutationObserver.observe(observedElement, {
375
+ childList: true,
376
+ subtree: true,
377
+ characterData: true,
378
+ attributes: true,
379
+ attributeFilter: [
380
+ 'hidden'
381
+ ]
382
+ });
383
+ return ()=>{
384
+ mutationObserver.disconnect();
385
+ };
386
+ }, [
387
+ currentContentRef,
388
+ popupElement,
389
+ isActiveItem,
390
+ transitionStatus,
391
+ getMutationBaseline,
392
+ handleInterruptedMutationResize,
393
+ handleValueChange,
394
+ syncCurrentSize
395
+ ]);
396
+ __rspack_external_react.useEffect(()=>{
397
+ if (isActiveItem && open && popupElement && allowFocusRef.current) {
398
+ allowFocusRef.current = false;
399
+ focusFrame.request(()=>{
400
+ beforeOutsideRef.current?.focus();
401
+ });
402
+ }
403
+ return ()=>{
404
+ focusFrame.cancel();
405
+ };
406
+ }, [
407
+ beforeOutsideRef,
408
+ focusFrame,
409
+ isActiveItem,
410
+ open,
411
+ popupElement
412
+ ]);
413
+ useIsoLayoutEffect(()=>{
414
+ if (isActiveItemRef.current && open && popupElement) {
415
+ const hasNestedMenu = currentContentRef.current?.querySelector('[data-nested]') != null;
416
+ if ('starting' === transitionStatus && hasNestedMenu) {
417
+ sizeFrame.request(syncCurrentSize);
418
+ return ()=>{
419
+ sizeFrame.cancel();
420
+ };
421
+ }
422
+ if (skipAutoSizeSyncRef.current) {
423
+ skipAutoSizeSyncRef.current = false;
424
+ return;
425
+ }
426
+ const { width, height } = getCssDimensions(popupElement);
427
+ handleValueChange(width, height);
428
+ }
429
+ }, [
430
+ currentContentRef,
431
+ handleValueChange,
432
+ isActiveItemRef,
433
+ open,
434
+ popupElement,
435
+ sizeFrame,
436
+ syncCurrentSize,
437
+ transitionStatus
438
+ ]);
439
+ function handleOpenChange(nextOpen, eventDetails) {
440
+ const isHover = eventDetails.reason === triggerHover;
441
+ if (!interactionsEnabled) return;
442
+ if ('touch' === pointerType && isHover) return;
443
+ if (!nextOpen && value !== itemValue) return;
444
+ function changeState() {
445
+ if (isHover) {
446
+ setStickIfOpen(true);
447
+ stickIfOpenTimeout.clear();
448
+ stickIfOpenTimeout.start(500, ()=>{
449
+ setStickIfOpen(false);
450
+ });
451
+ }
452
+ if (nextOpen) setValue(itemValue, eventDetails);
453
+ else {
454
+ setValue(null, eventDetails);
455
+ setPointerType('');
456
+ }
457
+ }
458
+ if (isHover) __rspack_external_react_dom_7136dc57.flushSync(changeState);
459
+ else changeState();
460
+ }
461
+ const context = useFloatingRootContext({
462
+ open,
463
+ onOpenChange: handleOpenChange,
464
+ elements: {
465
+ reference: triggerElement,
466
+ floating: hoverFloatingElement
467
+ }
468
+ });
469
+ const hoverInteractionState = useHoverInteractionSharedState(context);
470
+ const shouldBlockSafePolygonPointerEvents = 'touch' !== pointerType;
471
+ __rspack_external_react.useEffect(()=>{
472
+ if (!open) {
473
+ context.context.dataRef.current.openEvent = void 0;
474
+ hoverInteractionState.pointerType = void 0;
475
+ hoverInteractionState.interactedInside = false;
476
+ hoverInteractionState.restTimeoutPending = false;
477
+ hoverInteractionState.openChangeTimeout.clear();
478
+ hoverInteractionState.restTimeout.clear();
479
+ clearSafePolygonPointerEventsMutation(hoverInteractionState);
480
+ }
481
+ }, [
482
+ context,
483
+ hoverInteractionState,
484
+ open
485
+ ]);
486
+ const getInlineHandleCloseContext = useStableCallback(()=>{
487
+ if (!nested || positionerElement || !triggerElementRef.current || !hoverFloatingElement) return null;
488
+ return getHandleCloseContext(triggerElementRef.current, hoverFloatingElement, nodeId);
489
+ });
490
+ function getScope() {
491
+ if (!nested || !positionerElement) return triggerElementRef.current?.closest('ul') ?? null;
492
+ return null;
493
+ }
494
+ const hoverProps = useHoverReferenceInteraction(context, {
495
+ enabled: hoverInteractionsEnabled,
496
+ move: false,
497
+ handleClose: safePolygon({
498
+ blockPointerEvents: shouldBlockSafePolygonPointerEvents,
499
+ getScope
500
+ }),
501
+ restMs: mounted && positionerElement ? 0 : delay,
502
+ delay: {
503
+ close: closeDelay
504
+ },
505
+ triggerElementRef,
506
+ getHandleCloseContext: getInlineHandleCloseContext
507
+ });
508
+ const hover = __rspack_external_react.useMemo(()=>hoverProps ? {
509
+ reference: hoverProps
510
+ } : void 0, [
511
+ hoverProps
512
+ ]);
513
+ const click = useClick(context, {
514
+ enabled: interactionsEnabled,
515
+ stickIfOpen,
516
+ toggle: isActiveItem
517
+ });
518
+ const referenceProps = __rspack_external_react.useMemo(()=>mergeProps(click.reference, hover?.reference), [
519
+ click.reference,
520
+ hover
521
+ ]);
522
+ useIsoLayoutEffect(()=>{
523
+ if (isActiveItem) {
524
+ setFloatingRootContext(context);
525
+ prevTriggerElementRef.current = triggerElement;
526
+ }
527
+ }, [
528
+ isActiveItem,
529
+ context,
530
+ setFloatingRootContext,
531
+ prevTriggerElementRef,
532
+ triggerElement
533
+ ]);
534
+ function handleActivation(event) {
535
+ __rspack_external_react_dom_7136dc57.flushSync(()=>{
536
+ const currentTarget = isHTMLElement(event.currentTarget) ? event.currentTarget : null;
537
+ const prevTriggerRect = prevTriggerElementRef.current?.getBoundingClientRect();
538
+ if (mounted && prevTriggerRect && triggerElement) {
539
+ const nextTriggerRect = triggerElement.getBoundingClientRect();
540
+ const isMovingRight = nextTriggerRect.left > prevTriggerRect.left;
541
+ const isMovingDown = nextTriggerRect.top > prevTriggerRect.top;
542
+ if ('horizontal' === orientation && nextTriggerRect.left !== prevTriggerRect.left) setActivationDirection(isMovingRight ? 'right' : 'left');
543
+ else if ('vertical' === orientation && nextTriggerRect.top !== prevTriggerRect.top) setActivationDirection(isMovingDown ? 'down' : 'up');
544
+ }
545
+ if ('click' !== event.type && null != value) context.context.dataRef.current.openEvent = void 0;
546
+ if ('touch' === pointerType && 'click' !== event.type) return;
547
+ if (null != value) setValue(itemValue, createChangeEventDetails('mouseenter' === event.type ? triggerHover : triggerPress, event.nativeEvent));
548
+ if ('mouseenter' === event.type && shouldBlockSafePolygonPointerEvents && (!nested || !positionerElement) && hoverFloatingElement && currentTarget) {
549
+ const applyPointerEventsMutation = ()=>{
550
+ const scopeElement = getScope() ?? currentTarget.ownerDocument.body;
551
+ applySafePolygonPointerEventsMutation(hoverInteractionState, {
552
+ scopeElement,
553
+ referenceElement: currentTarget,
554
+ floatingElement: hoverFloatingElement
555
+ });
556
+ };
557
+ if (null != value && value !== itemValue) queueMicrotask(applyPointerEventsMutation);
558
+ else applyPointerEventsMutation();
559
+ }
560
+ });
561
+ }
562
+ const handleOpenEvent = useStableCallback((event)=>{
563
+ if (!popupElement || !positionerElement) return void handleActivation(event);
564
+ const { width, height } = getCssDimensions(popupElement);
565
+ const shouldSkipAutoSizeSync = null != value && value !== itemValue && ('click' === event.type || 'touch' !== pointerType);
566
+ handleActivation(event);
567
+ if (shouldSkipAutoSizeSync) skipAutoSizeSyncRef.current = true;
568
+ handleValueChange(width, height);
569
+ });
570
+ const state = {
571
+ open: isActiveItem
572
+ };
573
+ function handleSetPointerType(event) {
574
+ setPointerType(event.pointerType);
575
+ }
576
+ function handleTriggerPointerDown(event) {
577
+ handleSetPointerType(event);
578
+ clearSafePolygonPointerEventsMutation(hoverInteractionState);
579
+ }
580
+ const defaultProps = {
581
+ tabIndex: 0,
582
+ onMouseEnter: handleOpenEvent,
583
+ onClick: handleOpenEvent,
584
+ onPointerEnter: handleSetPointerType,
585
+ onPointerDown: handleTriggerPointerDown,
586
+ 'aria-expanded': isActiveItem,
587
+ 'aria-controls': isActiveItem ? popupElement?.id : void 0,
588
+ [NAVIGATION_MENU_TRIGGER_IDENTIFIER]: '',
589
+ onFocus () {
590
+ if (!isActiveItem) return;
591
+ setViewportInert(false);
592
+ },
593
+ onMouseMove () {
594
+ allowFocusRef.current = false;
595
+ },
596
+ onKeyDown (event) {
597
+ allowFocusRef.current = true;
598
+ if (nested) return;
599
+ const verticalOpenKey = 'rtl' === direction ? 'ArrowLeft' : 'ArrowRight';
600
+ const openHorizontal = 'horizontal' === orientation && 'ArrowDown' === event.key;
601
+ const openVertical = 'vertical' === orientation && event.key === verticalOpenKey;
602
+ if (openHorizontal || openVertical) {
603
+ setValue(itemValue, createChangeEventDetails(listNavigation, event.nativeEvent));
604
+ handleOpenEvent(event);
605
+ stopEvent(event);
606
+ }
607
+ },
608
+ onBlur (event) {
609
+ if (positionerElement && popupElement && isOutsideMenuEvent({
610
+ currentTarget: event.currentTarget,
611
+ relatedTarget: event.relatedTarget
612
+ }, {
613
+ popupElement,
614
+ rootRef,
615
+ tree,
616
+ nodeId
617
+ })) setValue(null, createChangeEventDetails(focusOut, event.nativeEvent));
618
+ }
619
+ };
620
+ const { getButtonProps, buttonRef } = useButton({
621
+ disabled,
622
+ focusableWhenDisabled: true,
623
+ native: nativeButton
624
+ });
625
+ const referenceElement = hoverFloatingElement;
626
+ return /*#__PURE__*/ jsxs(__rspack_external_react.Fragment, {
627
+ children: [
628
+ /*#__PURE__*/ jsx(CompositeItem, {
629
+ tag: "button",
630
+ render: render,
631
+ className: className,
632
+ style: style,
633
+ state: state,
634
+ stateAttributesMapping: pressableTriggerOpenStateMapping,
635
+ refs: [
636
+ forwardedRef,
637
+ handleTriggerElement,
638
+ buttonRef
639
+ ],
640
+ props: [
641
+ referenceProps,
642
+ dismissProps?.reference || EMPTY_ARRAY,
643
+ defaultProps,
644
+ elementProps,
645
+ getButtonProps
646
+ ]
647
+ }),
648
+ isActiveItem && /*#__PURE__*/ jsxs(__rspack_external_react.Fragment, {
649
+ children: [
650
+ /*#__PURE__*/ jsx(FocusGuard_FocusGuard, {
651
+ ref: beforeOutsideRef,
652
+ onFocus: (event)=>{
653
+ if (referenceElement && isOutsideEvent(event, referenceElement)) beforeInsideRef.current?.focus();
654
+ else {
655
+ const prevTabbable = getPreviousTabbable(triggerElement);
656
+ prevTabbable?.focus();
657
+ }
658
+ }
659
+ }),
660
+ /*#__PURE__*/ jsx("span", {
661
+ "aria-owns": viewportElement?.id,
662
+ style: ownerVisuallyHidden
663
+ }),
664
+ /*#__PURE__*/ jsx(FocusGuard_FocusGuard, {
665
+ ref: afterOutsideRef,
666
+ onFocus: (event)=>{
667
+ if (referenceElement && isOutsideEvent(event, referenceElement)) {
668
+ __rspack_external_react_dom_7136dc57.flushSync(()=>{
669
+ setViewportInert(false);
670
+ });
671
+ const elementToFocus = afterInsideRef.current || triggerElement;
672
+ elementToFocus?.focus();
673
+ } else {
674
+ let nextTabbable = getNextTabbable(triggerElement);
675
+ if (nested && !positionerElement && referenceElement && nextTabbable && contains(referenceElement, nextTabbable)) nextTabbable = getTabbableAfterElement(afterInsideRef.current);
676
+ nextTabbable?.focus();
677
+ if ((!nested || positionerElement) && !contains(rootRef.current, nextTabbable)) setValue(null, createChangeEventDetails(focusOut, event.nativeEvent));
678
+ }
679
+ }
680
+ })
681
+ ]
682
+ })
683
+ ]
684
+ });
685
+ });
686
+ if ("production" !== process.env.NODE_ENV) NavigationMenuTrigger_NavigationMenuTrigger.displayName = "NavigationMenuTrigger";
687
+ function getPlacementFromElements(domReferenceElement, floatingElement) {
688
+ const referenceRect = domReferenceElement.getBoundingClientRect();
689
+ const floatingRect = floatingElement.getBoundingClientRect();
690
+ const referenceCenterX = referenceRect.left + referenceRect.width / 2;
691
+ const referenceCenterY = referenceRect.top + referenceRect.height / 2;
692
+ const floatingCenterX = floatingRect.left + floatingRect.width / 2;
693
+ const floatingCenterY = floatingRect.top + floatingRect.height / 2;
694
+ const deltaX = floatingCenterX - referenceCenterX;
695
+ const deltaY = floatingCenterY - referenceCenterY;
696
+ if (Math.abs(deltaX) >= Math.abs(deltaY)) return deltaX >= 0 ? 'right' : 'left';
697
+ return deltaY >= 0 ? 'bottom' : 'top';
698
+ }
699
+ function getHandleCloseContext(domReferenceElement, floatingElement, nodeId) {
700
+ return {
701
+ placement: getPlacementFromElements(domReferenceElement, floatingElement),
702
+ elements: {
703
+ domReference: domReferenceElement,
704
+ floating: floatingElement
705
+ },
706
+ nodeId
707
+ };
708
+ }
709
+ const NavigationMenuPortalContext = /*#__PURE__*/ __rspack_external_react.createContext(void 0);
710
+ if ("production" !== process.env.NODE_ENV) NavigationMenuPortalContext.displayName = "NavigationMenuPortalContext";
711
+ function useNavigationMenuPortalContext() {
712
+ const value = __rspack_external_react.useContext(NavigationMenuPortalContext);
713
+ if (void 0 === value) throw new Error("production" !== process.env.NODE_ENV ? 'Base UI: <NavigationMenu.Portal> is missing.' : esm_formatErrorMessage(40));
714
+ return value;
715
+ }
716
+ const NavigationMenuPositionerContext = /*#__PURE__*/ __rspack_external_react.createContext(void 0);
717
+ if ("production" !== process.env.NODE_ENV) NavigationMenuPositionerContext.displayName = "NavigationMenuPositionerContext";
718
+ function useNavigationMenuPositionerContext(optional = false) {
719
+ const context = __rspack_external_react.useContext(NavigationMenuPositionerContext);
720
+ if (!context && !optional) throw new Error("production" !== process.env.NODE_ENV ? 'Base UI: NavigationMenuPositionerContext is missing. NavigationMenuPositioner parts must be placed within <NavigationMenu.Positioner>.' : esm_formatErrorMessage(42));
721
+ return context;
722
+ }
723
+ const EMPTY_ROOT_CONTEXT = getEmptyRootContext();
724
+ const NavigationMenuPositioner_NavigationMenuPositioner = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
725
+ const { open, mounted, positionerElement, setPositionerElement, floatingRootContext, nested, transitionStatus } = useNavigationMenuRootContext();
726
+ const { className, render, anchor, positionMethod = 'absolute', side = 'bottom', align = 'center', sideOffset = 0, alignOffset = 0, collisionBoundary = 'clipping-ancestors', collisionPadding = 5, collisionAvoidance = nested ? POPUP_COLLISION_AVOIDANCE : DROPDOWN_COLLISION_AVOIDANCE, arrowPadding = 5, sticky = false, disableAnchorTracking = false, style, ...elementProps } = componentProps;
727
+ const keepMounted = useNavigationMenuPortalContext();
728
+ const nodeId = useNavigationMenuTreeContext();
729
+ const resizeTimeout = useTimeout();
730
+ const [instant, setInstant] = __rspack_external_react.useState(false);
731
+ const positionerRef = __rspack_external_react.useRef(null);
732
+ const prevTriggerElementRef = __rspack_external_react.useRef(null);
733
+ __rspack_external_react.useEffect(()=>{
734
+ if (!positionerElement) return;
735
+ function onFocus(event) {
736
+ if (positionerElement && isOutsideEvent(event)) {
737
+ const focusing = 'focusin' === event.type;
738
+ const manageFocus = focusing ? enableFocusInside : disableFocusInside;
739
+ manageFocus(positionerElement);
740
+ }
741
+ }
742
+ return mergeCleanups(addEventListener(positionerElement, 'focusin', onFocus, true), addEventListener(positionerElement, 'focusout', onFocus, true));
743
+ }, [
744
+ positionerElement
745
+ ]);
746
+ const domReference = (floatingRootContext || EMPTY_ROOT_CONTEXT).useState('domReferenceElement');
747
+ const positioning = useAnchorPositioning({
748
+ anchor: anchor ?? domReference ?? prevTriggerElementRef,
749
+ positionMethod,
750
+ mounted,
751
+ side,
752
+ sideOffset,
753
+ align,
754
+ alignOffset,
755
+ arrowPadding,
756
+ collisionBoundary,
757
+ collisionPadding,
758
+ sticky,
759
+ disableAnchorTracking,
760
+ keepMounted,
761
+ floatingRootContext,
762
+ collisionAvoidance,
763
+ nodeId,
764
+ adaptiveOrigin: adaptiveOriginMiddleware_adaptiveOrigin
765
+ });
766
+ const state = {
767
+ open,
768
+ side: positioning.side,
769
+ align: positioning.align,
770
+ anchorHidden: positioning.anchorHidden,
771
+ instant
772
+ };
773
+ __rspack_external_react.useEffect(()=>{
774
+ if (!open) return;
775
+ function handleResize() {
776
+ __rspack_external_react_dom_7136dc57.flushSync(()=>{
777
+ setInstant(true);
778
+ });
779
+ resizeTimeout.start(100, ()=>{
780
+ setInstant(false);
781
+ });
782
+ }
783
+ const win = getWindow(positionerElement);
784
+ return addEventListener(win, 'resize', handleResize);
785
+ }, [
786
+ open,
787
+ resizeTimeout,
788
+ positionerElement
789
+ ]);
790
+ const element = usePositioner(componentProps, state, {
791
+ styles: positioning.positionerStyles,
792
+ transitionStatus,
793
+ props: elementProps,
794
+ refs: [
795
+ forwardedRef,
796
+ setPositionerElement,
797
+ positionerRef
798
+ ],
799
+ hidden: !mounted,
800
+ inert: !open
801
+ });
802
+ return /*#__PURE__*/ jsx(NavigationMenuPositionerContext.Provider, {
803
+ value: positioning,
804
+ children: element
805
+ });
806
+ });
807
+ if ("production" !== process.env.NODE_ENV) NavigationMenuPositioner_NavigationMenuPositioner.displayName = "NavigationMenuPositioner";
808
+ const NavigationMenuViewport_EMPTY_ROOT_CONTEXT = getEmptyRootContext();
809
+ function Guards({ children }) {
810
+ const { beforeInsideRef, beforeOutsideRef, afterInsideRef, afterOutsideRef, positionerElement, viewportElement, floatingRootContext } = useNavigationMenuRootContext();
811
+ const hasPositioner = Boolean(useNavigationMenuPositionerContext(true));
812
+ const referenceElement = positionerElement || viewportElement;
813
+ if (!floatingRootContext && !hasPositioner) return children;
814
+ return /*#__PURE__*/ jsxs(__rspack_external_react.Fragment, {
815
+ children: [
816
+ /*#__PURE__*/ jsx(FocusGuard_FocusGuard, {
817
+ ref: beforeInsideRef,
818
+ onFocus: (event)=>{
819
+ if (referenceElement && isOutsideEvent(event, referenceElement)) getNextTabbable(referenceElement)?.focus();
820
+ else beforeOutsideRef.current?.focus();
821
+ }
822
+ }),
823
+ children,
824
+ /*#__PURE__*/ jsx(FocusGuard_FocusGuard, {
825
+ ref: afterInsideRef,
826
+ onFocus: (event)=>{
827
+ if (referenceElement && isOutsideEvent(event, referenceElement)) getPreviousTabbable(referenceElement)?.focus();
828
+ else afterOutsideRef.current?.focus();
829
+ }
830
+ })
831
+ ]
832
+ });
833
+ }
834
+ const NavigationMenuViewport_NavigationMenuViewport = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
835
+ const { render, className, style, children, id: idProp, ...elementProps } = componentProps;
836
+ const id = useId(idProp);
837
+ const { setViewportElement, setViewportTargetElement, floatingRootContext, prevTriggerElementRef, viewportInert, setViewportInert } = useNavigationMenuRootContext();
838
+ const positioning = useNavigationMenuPositionerContext(true);
839
+ const hasPositioner = Boolean(positioning);
840
+ const domReference = (floatingRootContext || NavigationMenuViewport_EMPTY_ROOT_CONTEXT).useState('domReferenceElement');
841
+ useIsoLayoutEffect(()=>{
842
+ if (domReference) prevTriggerElementRef.current = domReference;
843
+ }, [
844
+ domReference,
845
+ prevTriggerElementRef
846
+ ]);
847
+ const element = useRenderElement('div', componentProps, {
848
+ ref: [
849
+ forwardedRef,
850
+ setViewportElement
851
+ ],
852
+ props: [
853
+ {
854
+ id,
855
+ onBlur (event) {
856
+ const relatedTarget = event.relatedTarget;
857
+ const currentTarget = event.currentTarget;
858
+ if (relatedTarget && !contains(currentTarget, relatedTarget) && relatedTarget !== domReference) setViewportInert(true);
859
+ },
860
+ ...!hasPositioner && viewportInert && {
861
+ inert: inertValue(true)
862
+ },
863
+ children: hasPositioner ? children : /*#__PURE__*/ jsx(Guards, {
864
+ children: /*#__PURE__*/ jsx("div", {
865
+ ref: setViewportTargetElement,
866
+ children: children
867
+ })
868
+ })
869
+ },
870
+ elementProps
871
+ ]
872
+ });
873
+ return hasPositioner ? /*#__PURE__*/ jsx(Guards, {
874
+ children: element
875
+ }) : element;
876
+ });
877
+ if ("production" !== process.env.NODE_ENV) NavigationMenuViewport_NavigationMenuViewport.displayName = "NavigationMenuViewport";
878
+ const NavigationMenuBackdrop_stateAttributesMapping = {
879
+ ...popupStateMapping,
880
+ ...transitionStatusMapping
881
+ };
882
+ const NavigationMenuBackdrop_NavigationMenuBackdrop = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
883
+ const { render, className, style, ...elementProps } = componentProps;
884
+ const { open, mounted, transitionStatus } = useNavigationMenuRootContext();
885
+ const state = {
886
+ open,
887
+ transitionStatus
888
+ };
889
+ const element = useRenderElement('div', componentProps, {
890
+ state,
891
+ ref: forwardedRef,
892
+ props: [
893
+ {
894
+ role: 'presentation',
895
+ hidden: !mounted,
896
+ style: {
897
+ userSelect: 'none',
898
+ WebkitUserSelect: 'none'
899
+ }
900
+ },
901
+ elementProps
902
+ ],
903
+ stateAttributesMapping: NavigationMenuBackdrop_stateAttributesMapping
904
+ });
905
+ return element;
906
+ });
907
+ if ("production" !== process.env.NODE_ENV) NavigationMenuBackdrop_NavigationMenuBackdrop.displayName = "NavigationMenuBackdrop";
908
+ const NavigationMenuPopup_stateAttributesMapping = {
909
+ ...popupStateMapping,
910
+ ...transitionStatusMapping
911
+ };
912
+ const NavigationMenuPopup_NavigationMenuPopup = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
913
+ const { render, className, style, id: idProp, ...elementProps } = componentProps;
914
+ const { open, transitionStatus, setPopupElement } = useNavigationMenuRootContext();
915
+ const positioning = useNavigationMenuPositionerContext();
916
+ const direction = useDirection();
917
+ const id = useBaseUiId(idProp);
918
+ const state = {
919
+ open,
920
+ transitionStatus,
921
+ side: positioning.side,
922
+ align: positioning.align,
923
+ anchorHidden: positioning.anchorHidden
924
+ };
925
+ let isOriginSide = 'top' === positioning.side;
926
+ let isPhysicalLeft = 'left' === positioning.side;
927
+ if ('rtl' === direction) {
928
+ isOriginSide = isOriginSide || 'inline-end' === positioning.side;
929
+ isPhysicalLeft = isPhysicalLeft || 'inline-end' === positioning.side;
930
+ } else {
931
+ isOriginSide = isOriginSide || 'inline-start' === positioning.side;
932
+ isPhysicalLeft = isPhysicalLeft || 'inline-start' === positioning.side;
933
+ }
934
+ const element = useRenderElement('nav', componentProps, {
935
+ state,
936
+ ref: [
937
+ forwardedRef,
938
+ setPopupElement
939
+ ],
940
+ props: [
941
+ {
942
+ id,
943
+ tabIndex: -1,
944
+ style: isOriginSide ? {
945
+ position: 'absolute',
946
+ ['top' === positioning.side ? 'bottom' : 'top']: '0',
947
+ [isPhysicalLeft ? 'right' : 'left']: '0'
948
+ } : {}
949
+ },
950
+ elementProps
951
+ ],
952
+ stateAttributesMapping: NavigationMenuPopup_stateAttributesMapping
953
+ });
954
+ return element;
955
+ });
956
+ if ("production" !== process.env.NODE_ENV) NavigationMenuPopup_NavigationMenuPopup.displayName = "NavigationMenuPopup";
957
+ const NavigationMenuArrow_NavigationMenuArrow = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
958
+ const { render, className, style, ...elementProps } = componentProps;
959
+ const { open } = useNavigationMenuRootContext();
960
+ const { arrowRef, side, align, arrowUncentered, arrowStyles } = useNavigationMenuPositionerContext();
961
+ const state = {
962
+ open,
963
+ side,
964
+ align,
965
+ uncentered: arrowUncentered
966
+ };
967
+ const element = useRenderElement('div', componentProps, {
968
+ state,
969
+ ref: [
970
+ forwardedRef,
971
+ arrowRef
972
+ ],
973
+ props: [
974
+ {
975
+ style: arrowStyles,
976
+ 'aria-hidden': true
977
+ },
978
+ elementProps
979
+ ],
980
+ stateAttributesMapping: popupStateMapping
981
+ });
982
+ return element;
983
+ });
984
+ if ("production" !== process.env.NODE_ENV) NavigationMenuArrow_NavigationMenuArrow.displayName = "NavigationMenuArrow";
985
+ const NavigationMenuIcon_NavigationMenuIcon = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
986
+ const { render, className, style, ...elementProps } = componentProps;
987
+ const { value: itemValue } = useNavigationMenuItemContext();
988
+ const { open, value } = useNavigationMenuRootContext();
989
+ const isActiveItem = open && value === itemValue;
990
+ const state = {
991
+ open: isActiveItem
992
+ };
993
+ const element = useRenderElement('span', componentProps, {
994
+ state,
995
+ ref: forwardedRef,
996
+ props: [
997
+ {
998
+ 'aria-hidden': true,
999
+ children: '▼'
1000
+ },
1001
+ elementProps
1002
+ ],
1003
+ stateAttributesMapping: triggerOpenStateMapping
1004
+ });
1005
+ return element;
1006
+ });
1007
+ if ("production" !== process.env.NODE_ENV) NavigationMenuIcon_NavigationMenuIcon.displayName = "NavigationMenuIcon";
1008
+ const NavigationMenuPortal_NavigationMenuPortal = /*#__PURE__*/ __rspack_external_react.forwardRef(function(props, forwardedRef) {
1009
+ const { keepMounted = false, ...portalProps } = props;
1010
+ const { mounted } = useNavigationMenuRootContext();
1011
+ const shouldRender = mounted || keepMounted;
1012
+ if (!shouldRender) return null;
1013
+ return /*#__PURE__*/ jsx(NavigationMenuPortalContext.Provider, {
1014
+ value: keepMounted,
1015
+ children: /*#__PURE__*/ jsx(FloatingPortal_FloatingPortal, {
1016
+ ref: forwardedRef,
1017
+ ...portalProps
1018
+ })
1019
+ });
1020
+ });
1021
+ if ("production" !== process.env.NODE_ENV) NavigationMenuPortal_NavigationMenuPortal.displayName = "NavigationMenuPortal";
5
1022
  const NavigationMenu_module = {
6
1023
  root: "root-Gth795",
7
1024
  list: "list-kus7O6",
@@ -9,68 +1026,68 @@ const NavigationMenu_module = {
9
1026
  popup: "popup-jElt_o",
10
1027
  link: "link-jrEqu4"
11
1028
  };
12
- const List = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(NavigationMenu.List, {
1029
+ const List = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(NavigationMenuList_NavigationMenuList, {
13
1030
  ref: ref,
14
1031
  className: clsx(NavigationMenu_module.list, className),
15
1032
  ...props
16
1033
  }));
17
- const Item = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(NavigationMenu.Item, {
1034
+ const Item = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(NavigationMenuItem_NavigationMenuItem, {
18
1035
  ref: ref,
19
1036
  className: clsx(NavigationMenu_module.item, className),
20
1037
  ...props
21
1038
  }));
22
- const Content = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(NavigationMenu.Content, {
1039
+ const Content = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(NavigationMenuContent_NavigationMenuContent, {
23
1040
  ref: ref,
24
1041
  className: clsx(NavigationMenu_module.content, className),
25
1042
  ...props
26
1043
  }));
27
- const Trigger = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(NavigationMenu.Trigger, {
1044
+ const Trigger = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(NavigationMenuTrigger_NavigationMenuTrigger, {
28
1045
  ref: ref,
29
1046
  className: clsx(NavigationMenu_module.trigger, className),
30
1047
  ...props
31
1048
  }));
32
- const Positioner = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(NavigationMenu.Positioner, {
1049
+ const Positioner = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(NavigationMenuPositioner_NavigationMenuPositioner, {
33
1050
  ref: ref,
34
1051
  className: clsx(NavigationMenu_module.positioner, className),
35
1052
  ...props
36
1053
  }));
37
- const Viewport = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(NavigationMenu.Viewport, {
1054
+ const Viewport = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(NavigationMenuViewport_NavigationMenuViewport, {
38
1055
  ref: ref,
39
1056
  className: clsx(NavigationMenu_module.viewport, className),
40
1057
  ...props
41
1058
  }));
42
- const Backdrop = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(NavigationMenu.Backdrop, {
1059
+ const Backdrop = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(NavigationMenuBackdrop_NavigationMenuBackdrop, {
43
1060
  ref: ref,
44
1061
  className: clsx(NavigationMenu_module.backdrop, className),
45
1062
  ...props
46
1063
  }));
47
- const Popup = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(NavigationMenu.Popup, {
1064
+ const Popup = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(NavigationMenuPopup_NavigationMenuPopup, {
48
1065
  ref: ref,
49
1066
  className: clsx(NavigationMenu_module.popup, className),
50
1067
  ...props
51
1068
  }));
52
- const Arrow = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(NavigationMenu.Arrow, {
1069
+ const Arrow = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(NavigationMenuArrow_NavigationMenuArrow, {
53
1070
  ref: ref,
54
1071
  className: clsx(NavigationMenu_module.arrow, className),
55
1072
  ...props
56
1073
  }));
57
- const Link = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(NavigationMenu.Link, {
1074
+ const Link = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(NavigationMenuLink_NavigationMenuLink, {
58
1075
  ref: ref,
59
1076
  className: clsx(NavigationMenu_module.link, className),
60
1077
  ...props
61
1078
  }));
62
- const Icon = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(NavigationMenu.Icon, {
1079
+ const Icon = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(NavigationMenuIcon_NavigationMenuIcon, {
63
1080
  ref: ref,
64
1081
  className: clsx(NavigationMenu_module.icon, className),
65
1082
  ...props
66
1083
  }));
67
1084
  function Root({ className, ...props }) {
68
- return /*#__PURE__*/ jsx(NavigationMenu.Root, {
1085
+ return /*#__PURE__*/ jsx(NavigationMenuRoot_NavigationMenuRoot, {
69
1086
  ...props,
70
1087
  className: clsx(NavigationMenu_module.root, className)
71
1088
  });
72
1089
  }
73
- const NavigationMenu_NavigationMenu = {
1090
+ const NavigationMenu = {
74
1091
  List: List,
75
1092
  Item: Item,
76
1093
  Content: Content,
@@ -83,6 +1100,6 @@ const NavigationMenu_NavigationMenu = {
83
1100
  Link: Link,
84
1101
  Icon: Icon,
85
1102
  Root: Root,
86
- Portal: NavigationMenu.Portal
1103
+ Portal: NavigationMenuPortal_NavigationMenuPortal
87
1104
  };
88
- export { NavigationMenu_NavigationMenu as NavigationMenu };
1105
+ export { NavigationMenu };