@wix/site-ui 1.347.0 → 1.348.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 (226) hide show
  1. package/dist/{6706.js → 1093.js} +3 -3
  2. package/dist/{8724.js → 1219.js} +2 -2
  3. package/dist/{7373.js → 1288.js} +8 -2
  4. package/dist/{5299.js → 1381.js} +98 -127
  5. package/dist/{3056.js → 1607.js} +32 -34
  6. package/dist/1629.js +2 -0
  7. package/dist/1669.js +75 -0
  8. package/dist/1718.js +26 -0
  9. package/dist/{1477.js → 201.js} +17 -26
  10. package/dist/2221.js +9 -0
  11. package/dist/{2445.js → 226.js} +12 -48
  12. package/dist/2387.js +7 -0
  13. package/dist/2580.js +6 -0
  14. package/dist/{1500.js → 2859.js} +10 -34
  15. package/dist/3014.js +178 -0
  16. package/dist/{6247.js → 3054.js} +3 -3
  17. package/dist/{7642.js → 3093.js} +1 -1
  18. package/dist/3189.js +5 -0
  19. package/dist/{7564.js → 331.js} +2 -2
  20. package/dist/3357.js +7 -0
  21. package/dist/{487.js → 3398.js} +38 -39
  22. package/dist/3502.js +224 -0
  23. package/dist/3695.js +50 -0
  24. package/dist/3829.js +1 -1
  25. package/dist/{6588.js → 3859.js} +115 -92
  26. package/dist/{3670.js → 3910.js} +28 -21
  27. package/dist/392.js +7 -0
  28. package/dist/{4549.js → 4155.js} +11 -3
  29. package/dist/4226.js +7 -0
  30. package/dist/{6329.js → 4229.js} +1 -1
  31. package/dist/4293.js +3 -0
  32. package/dist/4346.js +853 -2
  33. package/dist/{285.js → 4472.js} +3 -3
  34. package/dist/4605.js +207 -0
  35. package/dist/{7366.js → 488.js} +60 -7
  36. package/dist/{8750.js → 497.js} +190 -375
  37. package/dist/4989.js +35 -0
  38. package/dist/{6270.js → 510.js} +157 -196
  39. package/dist/5258.js +26 -0
  40. package/dist/{5036.js → 5275.js} +0 -3
  41. package/dist/{8171.js → 5298.js} +90 -102
  42. package/dist/5473.js +11 -0
  43. package/dist/{4745.js → 5490.js} +3 -1
  44. package/dist/{6089.js → 5561.js} +869 -786
  45. package/dist/{8996.js → 5595.js} +4 -3
  46. package/dist/5890.js +25 -0
  47. package/dist/{6046.js → 5969.js} +1 -1
  48. package/dist/5984.js +38 -0
  49. package/dist/{8527.js → 6006.js} +3 -3
  50. package/dist/6040.js +97 -0
  51. package/dist/{8758.js → 6137.js} +10 -8
  52. package/dist/{4281.js → 6140.js} +18 -10
  53. package/dist/{8960.js → 6191.js} +2 -2
  54. package/dist/6240.js +121 -0
  55. package/dist/{4490.js → 6373.js} +7 -5
  56. package/dist/{904.js → 6487.js} +19 -17
  57. package/dist/{9635.js → 6498.js} +1 -1
  58. package/dist/6499.js +4 -7
  59. package/dist/6508.js +7 -0
  60. package/dist/{8225.js → 6540.js} +1 -0
  61. package/dist/6551.js +46 -0
  62. package/dist/{9369.js → 6620.js} +35 -34
  63. package/dist/{4143.js → 6838.js} +19 -10
  64. package/dist/6902.js +48 -0
  65. package/dist/6904.js +51 -0
  66. package/dist/70.js +24 -0
  67. package/dist/7024.js +39 -0
  68. package/dist/{6882.js → 721.js} +737 -362
  69. package/dist/{951.js → 7270.js} +4 -4
  70. package/dist/{3485.js → 7323.js} +143 -111
  71. package/dist/{7541.js → 7488.js} +2 -2
  72. package/dist/{4863.js → 7542.js} +7 -6
  73. package/dist/7551.js +28 -0
  74. package/dist/{7021.js → 7640.js} +1 -1
  75. package/dist/{353.js → 7692.js} +3 -7
  76. package/dist/{4707.js → 7930.js} +2 -2
  77. package/dist/{8052.js → 8.js} +80 -64
  78. package/dist/{6914.js → 8129.js} +3 -15
  79. package/dist/{3319.js → 8358.js} +62 -63
  80. package/dist/{5864.js → 8407.js} +13 -13
  81. package/dist/8488.js +15 -0
  82. package/dist/{4768.js → 8495.js} +1 -1
  83. package/dist/8734.js +171 -0
  84. package/dist/{1763.js → 9018.js} +205 -331
  85. package/dist/9053.js +29 -0
  86. package/dist/9067.js +41 -0
  87. package/dist/{2861.js → 9120.js} +2 -2
  88. package/dist/{42.js → 9197.js} +2 -2
  89. package/dist/{9189.js → 9248.js} +36 -17
  90. package/dist/{2801.js → 9252.js} +4 -9
  91. package/dist/9295.js +7 -0
  92. package/dist/9303.js +8 -0
  93. package/dist/{167.js → 9374.js} +1 -1
  94. package/dist/{9352.js → 9540.js} +17 -47
  95. package/dist/9576.js +51 -0
  96. package/dist/{8272.js → 9591.js} +36 -46
  97. package/dist/{6107.js → 9770.js} +2 -2
  98. package/dist/{5085.js → 9880.js} +6 -3
  99. package/dist/Accordion/index.d.ts +207 -41
  100. package/dist/Accordion/index.js +75 -177
  101. package/dist/AlertDialog/index.d.ts +440 -140
  102. package/dist/AlertDialog/index.js +3 -13
  103. package/dist/Autocomplete/index.d.ts +722 -150
  104. package/dist/Autocomplete/index.js +16 -29
  105. package/dist/Avatar/index.d.ts +38 -3
  106. package/dist/Avatar/index.js +82 -28
  107. package/dist/Breadcrumbs/index.d.ts +63 -91
  108. package/dist/Breadcrumbs/index.js +1 -1
  109. package/dist/Button/index.d.ts +11 -0
  110. package/dist/Button/index.js +2 -2
  111. package/dist/Checkbox/index.d.ts +206 -36
  112. package/dist/Checkbox/index.js +293 -8
  113. package/dist/CheckboxField/index.css +1 -1
  114. package/dist/CheckboxField/index.d.ts +40 -36
  115. package/dist/CheckboxGroup/index.d.ts +50 -36
  116. package/dist/CheckboxGroup/index.js +87 -58
  117. package/dist/CheckboxGroupField/index.css +1 -1
  118. package/dist/Collapsible/index.d.ts +128 -36
  119. package/dist/Collapsible/index.js +21 -25
  120. package/dist/Combobox/index.d.ts +801 -158
  121. package/dist/Combobox/index.js +70 -114
  122. package/dist/ContextMenu/index.d.ts +1162 -195
  123. package/dist/ContextMenu/index.js +46 -36
  124. package/dist/Dialog/index.d.ts +425 -133
  125. package/dist/Dialog/index.js +8 -4
  126. package/dist/Drawer/index.d.ts +589 -144
  127. package/dist/Drawer/index.js +482 -562
  128. package/dist/Field/index.css +1 -1
  129. package/dist/Field/index.d.ts +341 -42
  130. package/dist/Field/index.js +123 -273
  131. package/dist/Fieldset/index.d.ts +11 -0
  132. package/dist/Fieldset/index.js +10 -17
  133. package/dist/Form/index.d.ts +43 -39
  134. package/dist/Form/index.js +58 -50
  135. package/dist/Input/index.css +1 -1
  136. package/dist/Input/index.d.ts +94 -42
  137. package/dist/Input/index.js +1 -1
  138. package/dist/Menu/index.d.ts +1140 -175
  139. package/dist/Menu/index.js +51 -67
  140. package/dist/Menubar/index.d.ts +651 -173
  141. package/dist/Menubar/index.js +12 -16
  142. package/dist/Meter/index.js +21 -18
  143. package/dist/NavigationMenu/index.d.ts +370 -86
  144. package/dist/NavigationMenu/index.js +144 -178
  145. package/dist/NumberField/index.css +1 -1
  146. package/dist/NumberField/index.d.ts +507 -47
  147. package/dist/NumberField/index.js +434 -718
  148. package/dist/Popover/index.d.ts +561 -142
  149. package/dist/Popover/index.js +181 -252
  150. package/dist/PreviewCard/index.d.ts +507 -143
  151. package/dist/PreviewCard/index.js +97 -151
  152. package/dist/Progress/index.d.ts +117 -3
  153. package/dist/Progress/index.js +37 -36
  154. package/dist/Radio/index.d.ts +177 -7
  155. package/dist/Radio/index.js +54 -70
  156. package/dist/RadioField/index.css +1 -1
  157. package/dist/RadioField/index.d.ts +23 -7
  158. package/dist/RadioGroup/index.d.ts +51 -37
  159. package/dist/RadioGroup/index.js +60 -51
  160. package/dist/RadioGroupField/index.css +1 -1
  161. package/dist/RadioGroupField/index.d.ts +40 -37
  162. package/dist/ScrollArea/index.d.ts +295 -1
  163. package/dist/ScrollArea/index.js +256 -324
  164. package/dist/Select/index.d.ts +516 -123
  165. package/dist/Select/index.js +513 -635
  166. package/dist/SelectField/index.css +1 -1
  167. package/dist/SelectField/index.d.ts +109 -134
  168. package/dist/SelectField/index.js +5 -1
  169. package/dist/Separator/index.d.ts +12 -0
  170. package/dist/Separator/index.js +1 -1
  171. package/dist/Slider/index.d.ts +383 -64
  172. package/dist/Slider/index.js +298 -374
  173. package/dist/Switch/index.d.ts +184 -37
  174. package/dist/Switch/index.js +44 -58
  175. package/dist/Tabs/index.d.ts +220 -35
  176. package/dist/Tabs/index.js +199 -193
  177. package/dist/Toast/index.d.ts +280 -64
  178. package/dist/Toast/index.js +299 -374
  179. package/dist/Toggle/index.d.ts +55 -35
  180. package/dist/Toggle/index.js +19 -13
  181. package/dist/ToggleGroup/index.d.ts +62 -35
  182. package/dist/ToggleGroup/index.js +13 -31
  183. package/dist/Toolbar/index.d.ts +117 -2
  184. package/dist/Toolbar/index.js +31 -43
  185. package/dist/Tooltip/index.d.ts +507 -150
  186. package/dist/Tooltip/index.js +163 -213
  187. package/dist/index.d.ts +12912 -5382
  188. package/package.json +3 -3
  189. package/dist/2205.js +0 -26
  190. package/dist/2274.js +0 -34
  191. package/dist/2287.js +0 -17
  192. package/dist/3020.js +0 -7
  193. package/dist/3021.js +0 -72
  194. package/dist/3140.js +0 -4
  195. package/dist/3248.js +0 -307
  196. package/dist/4026.js +0 -12
  197. package/dist/4922.js +0 -15
  198. package/dist/5659.js +0 -4
  199. package/dist/5992.js +0 -447
  200. package/dist/6330.js +0 -30
  201. package/dist/6535.js +0 -72
  202. package/dist/6917.js +0 -55
  203. package/dist/7725.js +0 -10
  204. package/dist/7871.js +0 -38
  205. package/dist/8106.js +0 -239
  206. package/dist/8685.js +0 -102
  207. package/dist/8935.js +0 -8
  208. package/dist/8971.js +0 -40
  209. package/dist/8979.js +0 -10
  210. package/dist/9048.js +0 -52
  211. package/dist/9087.js +0 -256
  212. package/dist/9255.js +0 -136
  213. /package/dist/{1457.js → 1068.js} +0 -0
  214. /package/dist/{6003.js → 1234.js} +0 -0
  215. /package/dist/{4723.js → 1282.js} +0 -0
  216. /package/dist/{6825.js → 1876.js} +0 -0
  217. /package/dist/{5778.js → 1885.js} +0 -0
  218. /package/dist/{2445.js.LICENSE.txt → 226.js.LICENSE.txt} +0 -0
  219. /package/dist/{1279.js → 3278.js} +0 -0
  220. /package/dist/{3296.js → 5568.js} +0 -0
  221. /package/dist/{8685.css → 6240.css} +0 -0
  222. /package/dist/{9829.js → 6488.js} +0 -0
  223. /package/dist/{9863.js → 6534.js} +0 -0
  224. /package/dist/{4495.js → 7718.js} +0 -0
  225. /package/dist/{3395.js → 8866.js} +0 -0
  226. /package/dist/{2418.js → 9837.js} +0 -0
package/dist/9053.js ADDED
@@ -0,0 +1,29 @@
1
+ import { useCompositeRootContext } from "./1219.js";
2
+ import { useCompositeListItem } from "./9576.js";
3
+ import { useMergedRefs } from "./9591.js";
4
+ import * as __rspack_external_react from "react";
5
+ function useCompositeItem(params = {}) {
6
+ const { highlightItemOnHover, highlightedIndex, onHighlightedIndexChange } = useCompositeRootContext();
7
+ const { ref, index } = useCompositeListItem(params);
8
+ const isHighlighted = highlightedIndex === index;
9
+ const itemRef = __rspack_external_react.useRef(null);
10
+ const mergedRef = useMergedRefs(ref, itemRef);
11
+ const compositeProps = {
12
+ tabIndex: isHighlighted ? 0 : -1,
13
+ onFocus () {
14
+ onHighlightedIndexChange(index);
15
+ },
16
+ onMouseMove () {
17
+ const item = itemRef.current;
18
+ if (!highlightItemOnHover || !item) return;
19
+ const disabled = item.hasAttribute('disabled') || 'true' === item.ariaDisabled;
20
+ if (!isHighlighted && !disabled) item.focus();
21
+ }
22
+ };
23
+ return {
24
+ compositeProps,
25
+ compositeRef: mergedRef,
26
+ index
27
+ };
28
+ }
29
+ export { useCompositeItem };
package/dist/9067.js ADDED
@@ -0,0 +1,41 @@
1
+ import { useTransitionStatus } from "./7542.js";
2
+ import { useRenderElement } from "./9591.js";
3
+ import { transitionStatusMapping } from "./8488.js";
4
+ import { useOpenChangeComplete } from "./6620.js";
5
+ import * as __rspack_external_react from "react";
6
+ const ItemIndicator_ItemIndicator = /*#__PURE__*/ __rspack_external_react.memo(/*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
7
+ const { render, className, style, keepMounted, selected, ...elementProps } = componentProps;
8
+ const indicatorRef = __rspack_external_react.useRef(null);
9
+ const { transitionStatus, setMounted } = useTransitionStatus(selected);
10
+ const state = {
11
+ selected,
12
+ transitionStatus
13
+ };
14
+ const element = useRenderElement('span', componentProps, {
15
+ ref: [
16
+ forwardedRef,
17
+ indicatorRef
18
+ ],
19
+ state,
20
+ props: [
21
+ {
22
+ 'aria-hidden': true,
23
+ children: '✔️'
24
+ },
25
+ elementProps
26
+ ],
27
+ stateAttributesMapping: transitionStatusMapping
28
+ });
29
+ useOpenChangeComplete({
30
+ batch: true,
31
+ enabled: !selected,
32
+ open: selected,
33
+ ref: indicatorRef,
34
+ onComplete () {
35
+ if (!selected) setMounted(false);
36
+ }
37
+ });
38
+ return element;
39
+ }));
40
+ if ("production" !== process.env.NODE_ENV) ItemIndicator_ItemIndicator.displayName = "ItemIndicator";
41
+ export { ItemIndicator_ItemIndicator };
@@ -1,6 +1,6 @@
1
+ import { EMPTY_ARRAY } from "./9591.js";
1
2
  import * as __rspack_external_react from "react";
2
- const EMPTY = [];
3
3
  function useOnMount(fn) {
4
- __rspack_external_react.useEffect(fn, EMPTY);
4
+ __rspack_external_react.useEffect(fn, EMPTY_ARRAY);
5
5
  }
6
6
  export { useOnMount };
@@ -1,5 +1,5 @@
1
- import { useRefWithInit } from "./8272.js";
2
- import { useOnMount } from "./2861.js";
1
+ import { useRefWithInit } from "./9591.js";
2
+ import { useOnMount } from "./9120.js";
3
3
  const EMPTY = 0;
4
4
  class Timeout {
5
5
  static create() {
@@ -1,9 +1,9 @@
1
- import { useCompositeRootContext } from "./8724.js";
2
- import { useIsoLayoutEffect, SafeReact } from "./6499.js";
3
- import { error } from "./4026.js";
4
- import { mergeProps, makeEventPreventable } from "./8272.js";
5
- import { useStableCallback } from "./7541.js";
6
- import { isHTMLElement } from "./3829.js";
1
+ import { getWindow, isHTMLElement } from "./3829.js";
2
+ import { useCompositeRootContext } from "./1219.js";
3
+ import { useIsoLayoutEffect, SafeReact } from "./3357.js";
4
+ import { error } from "./4293.js";
5
+ import { mergeProps, makeEventPreventable } from "./9591.js";
6
+ import { useStableCallback } from "./7488.js";
7
7
  import * as __rspack_external_react from "react";
8
8
  function useFocusableWhenDisabled(parameters) {
9
9
  const { focusableWhenDisabled, disabled, composite = false, tabIndex: tabIndexProp = 0, isNativeButton } = parameters;
@@ -35,6 +35,19 @@ function useFocusableWhenDisabled(parameters) {
35
35
  props
36
36
  };
37
37
  }
38
+ function dispatchClickWithModifiers(target, sourceEvent, { detail = 0, pointerType = '' } = {}) {
39
+ target.dispatchEvent(new (getWindow(target)).PointerEvent('click', {
40
+ bubbles: true,
41
+ cancelable: true,
42
+ composed: true,
43
+ detail,
44
+ pointerType,
45
+ shiftKey: sourceEvent.shiftKey,
46
+ ctrlKey: sourceEvent.ctrlKey,
47
+ altKey: sourceEvent.altKey,
48
+ metaKey: sourceEvent.metaKey
49
+ }));
50
+ }
38
51
  function useButton(parameters = {}) {
39
52
  const { disabled = false, focusableWhenDisabled, tabIndex = 0, native: isNativeButton = true, composite: compositeProp } = parameters;
40
53
  const elementRef = __rspack_external_react.useRef(null);
@@ -103,18 +116,21 @@ function useButton(parameters = {}) {
103
116
  if (isCurrentTarget && isCompositeItem && isSpaceKey) {
104
117
  if (event.defaultPrevented && isTextNavigationRole) return;
105
118
  event.preventDefault();
106
- if (isLink || isNativeButton && isButton) {
107
- currentTarget.click();
108
- event.preventBaseUIHandler();
109
- } else if (shouldClick) {
110
- externalOnClick?.(event);
119
+ if (!isNativeButton || isButton) {
111
120
  event.preventBaseUIHandler();
121
+ dispatchClickWithModifiers(currentTarget, event);
112
122
  }
113
123
  return;
114
124
  }
115
- if (shouldClick) {
116
- if (!isNativeButton && (isSpaceKey || isEnterKey)) event.preventDefault();
117
- if (!isNativeButton && isEnterKey) externalOnClick?.(event);
125
+ if (!shouldClick || isNativeButton || !isSpaceKey && !isEnterKey) {
126
+ if (isCurrentTarget && isLink && isSpaceKey) event.preventDefault();
127
+ return;
128
+ }
129
+ if (event.defaultPrevented) return;
130
+ event.preventDefault();
131
+ if (isEnterKey) {
132
+ event.preventBaseUIHandler();
133
+ dispatchClickWithModifiers(currentTarget, event);
118
134
  }
119
135
  },
120
136
  onKeyUp (event) {
@@ -123,7 +139,10 @@ function useButton(parameters = {}) {
123
139
  externalOnKeyUp?.(event);
124
140
  if (event.target === event.currentTarget && isNativeButton && isCompositeItem && isButtonElement(event.currentTarget) && ' ' === event.key) return void event.preventDefault();
125
141
  if (event.baseUIHandlerPrevented) return;
126
- if (event.target === event.currentTarget && !isNativeButton && !isCompositeItem && ' ' === event.key) externalOnClick?.(event);
142
+ if (event.target === event.currentTarget && !isNativeButton && !isCompositeItem && !event.defaultPrevented && ' ' === event.key) {
143
+ event.preventBaseUIHandler();
144
+ dispatchClickWithModifiers(event.currentTarget, event);
145
+ }
127
146
  },
128
147
  onPointerDown (event) {
129
148
  if (disabled) return void event.preventDefault();
@@ -153,6 +172,6 @@ function isButtonElement(elem) {
153
172
  return isHTMLElement(elem) && 'BUTTON' === elem.tagName;
154
173
  }
155
174
  function isValidLinkElement(elem) {
156
- return Boolean(elem?.tagName === 'A' && elem?.href);
175
+ return isHTMLElement(elem) && 'A' === elem.tagName && Boolean(elem.href);
157
176
  }
158
- export { useButton, useFocusableWhenDisabled };
177
+ export { dispatchClickWithModifiers, useButton, useFocusableWhenDisabled };
@@ -1,20 +1,15 @@
1
- import { useStableCallback } from "./7541.js";
2
- import { useIsoLayoutEffect } from "./6499.js";
1
+ import { useStableCallback } from "./7488.js";
2
+ import { useIsoLayoutEffect } from "./3357.js";
3
3
  import * as __rspack_external_react from "react";
4
4
  function useValueChanged(value, onChange) {
5
5
  const valueRef = __rspack_external_react.useRef(value);
6
6
  const onChangeCallback = useStableCallback(onChange);
7
7
  useIsoLayoutEffect(()=>{
8
- if (valueRef.current === value) return;
9
- onChangeCallback(valueRef.current);
8
+ if (valueRef.current !== value) onChangeCallback(valueRef.current);
9
+ valueRef.current = value;
10
10
  }, [
11
11
  value,
12
12
  onChangeCallback
13
13
  ]);
14
- useIsoLayoutEffect(()=>{
15
- valueRef.current = value;
16
- }, [
17
- value
18
- ]);
19
14
  }
20
15
  export { useValueChanged };
package/dist/9295.js ADDED
@@ -0,0 +1,7 @@
1
+ function getFiniteAnimations(element, options) {
2
+ return element.getAnimations(options).filter((animation)=>{
3
+ const timing = animation.effect?.getTiming();
4
+ return timing?.duration !== 1 / 0 && timing?.iterations !== 1 / 0;
5
+ });
6
+ }
7
+ export { getFiniteAnimations };
package/dist/9303.js ADDED
@@ -0,0 +1,8 @@
1
+ import { keyboard, pointer } from "./9837.js";
2
+ function getHighlightReason(event) {
3
+ if (null == event) return "none";
4
+ if (event.type.startsWith('key')) return keyboard;
5
+ if (event.type.startsWith('mouse') || event.type.startsWith('pointer')) return pointer;
6
+ return "none";
7
+ }
8
+ export { getHighlightReason };
@@ -1,4 +1,4 @@
1
- import { isReactVersionAtLeast } from "./8272.js";
1
+ import { isReactVersionAtLeast } from "./9591.js";
2
2
  function inertValue(value) {
3
3
  if (isReactVersionAtLeast(19)) return value;
4
4
  return value ? 'true' : void 0;
@@ -1,19 +1,15 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
- import { popupStateMapping, popupStateMapping_CommonPopupDataAttributes } from "./6917.js";
3
- import { transitionStatusMapping, useOpenChangeComplete } from "./9369.js";
4
- import { useDialogPortalContext, useDialogRootContext } from "./6270.js";
5
- import { useRenderElement } from "./8272.js";
6
- import { FOCUSABLE_POPUP_PROPS } from "./8106.js";
7
- import { COMPOSITE_KEYS } from "./1500.js";
8
- import { FloatingFocusManager } from "./3485.js";
2
+ import { useDialogPortalContext, useDialogRootContext, dialogStateAttributesMapping } from "./510.js";
3
+ import { useRenderElement } from "./9591.js";
4
+ import { popupTransitionStateMapping } from "./6904.js";
5
+ import { useOpenChangeComplete } from "./6620.js";
6
+ import { createDefaultInitialFocus, FOCUSABLE_POPUP_PROPS } from "./4346.js";
7
+ import { COMPOSITE_KEYS } from "./2859.js";
8
+ import { FloatingFocusManager } from "./7323.js";
9
9
  import * as __rspack_external_react from "react";
10
- const stateAttributesMapping = {
11
- ...popupStateMapping,
12
- ...transitionStatusMapping
13
- };
14
10
  const DialogBackdrop_DialogBackdrop = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
15
11
  const { render, className, style, forceRender = false, ...elementProps } = componentProps;
16
- const { store } = useDialogRootContext();
12
+ const store = useDialogRootContext();
17
13
  const open = store.useState('open');
18
14
  const nested = store.useState('nested');
19
15
  const mounted = store.useState('mounted');
@@ -28,7 +24,7 @@ const DialogBackdrop_DialogBackdrop = /*#__PURE__*/ __rspack_external_react.forw
28
24
  store.context.backdropRef,
29
25
  forwardedRef
30
26
  ],
31
- stateAttributesMapping: stateAttributesMapping,
27
+ stateAttributesMapping: popupTransitionStateMapping,
32
28
  props: [
33
29
  {
34
30
  role: 'presentation',
@@ -44,31 +40,10 @@ const DialogBackdrop_DialogBackdrop = /*#__PURE__*/ __rspack_external_react.forw
44
40
  });
45
41
  });
46
42
  if ("production" !== process.env.NODE_ENV) DialogBackdrop_DialogBackdrop.displayName = "DialogBackdrop";
47
- let DialogPopupCssVars_DialogPopupCssVars = /*#__PURE__*/ function(DialogPopupCssVars) {
48
- DialogPopupCssVars["nestedDialogs"] = "--nested-dialogs";
49
- return DialogPopupCssVars;
50
- }({});
51
- let DialogPopupDataAttributes_DialogPopupDataAttributes = function(DialogPopupDataAttributes) {
52
- DialogPopupDataAttributes[DialogPopupDataAttributes["open"] = popupStateMapping_CommonPopupDataAttributes.open] = "open";
53
- DialogPopupDataAttributes[DialogPopupDataAttributes["closed"] = popupStateMapping_CommonPopupDataAttributes.closed] = "closed";
54
- DialogPopupDataAttributes[DialogPopupDataAttributes["startingStyle"] = popupStateMapping_CommonPopupDataAttributes.startingStyle] = "startingStyle";
55
- DialogPopupDataAttributes[DialogPopupDataAttributes["endingStyle"] = popupStateMapping_CommonPopupDataAttributes.endingStyle] = "endingStyle";
56
- DialogPopupDataAttributes["nested"] = "data-nested";
57
- DialogPopupDataAttributes["nestedDialogOpen"] = "data-nested-dialog-open";
58
- return DialogPopupDataAttributes;
59
- }({});
60
- const DialogPopup_stateAttributesMapping = {
61
- ...popupStateMapping,
62
- ...transitionStatusMapping,
63
- nestedDialogOpen (value) {
64
- return value ? {
65
- [DialogPopupDataAttributes_DialogPopupDataAttributes.nestedDialogOpen]: ''
66
- } : null;
67
- }
68
- };
43
+ const nestedDialogs = '--nested-dialogs';
69
44
  const DialogPopup_DialogPopup = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
70
45
  const { render, className, style, finalFocus, initialFocus, ...elementProps } = componentProps;
71
- const { store } = useDialogRootContext();
46
+ const store = useDialogRootContext();
72
47
  const descriptionElementId = store.useState("descriptionElementId");
73
48
  const disablePointerDismissal = store.useState('disablePointerDismissal');
74
49
  const floatingRootContext = store.useState('floatingRootContext');
@@ -83,7 +58,6 @@ const DialogPopup_DialogPopup = /*#__PURE__*/ __rspack_external_react.forwardRef
83
58
  const transitionStatus = store.useState('transitionStatus');
84
59
  const role = store.useState('role');
85
60
  const floatingId = floatingRootContext.useState('floatingId');
86
- const popupId = elementProps.id ?? floatingId;
87
61
  useDialogPortalContext();
88
62
  useOpenChangeComplete({
89
63
  open,
@@ -92,11 +66,7 @@ const DialogPopup_DialogPopup = /*#__PURE__*/ __rspack_external_react.forwardRef
92
66
  if (open) store.context.onOpenChangeComplete?.(true);
93
67
  }
94
68
  });
95
- function defaultInitialFocus(interactionType) {
96
- if ('touch' === interactionType) return store.context.popupRef.current;
97
- return true;
98
- }
99
- const resolvedInitialFocus = void 0 === initialFocus ? defaultInitialFocus : initialFocus;
69
+ const resolvedInitialFocus = void 0 === initialFocus ? createDefaultInitialFocus(store.context.popupRef) : initialFocus;
100
70
  const nestedDialogOpen = nestedOpenDialogCount > 0;
101
71
  const setPopupElement = store.useStateSetter('popupElement');
102
72
  const state = {
@@ -110,9 +80,9 @@ const DialogPopup_DialogPopup = /*#__PURE__*/ __rspack_external_react.forwardRef
110
80
  props: [
111
81
  rootPopupProps,
112
82
  {
113
- id: popupId,
114
- 'aria-labelledby': titleElementId ?? void 0,
115
- 'aria-describedby': descriptionElementId ?? void 0,
83
+ id: floatingId,
84
+ 'aria-labelledby': titleElementId,
85
+ 'aria-describedby': descriptionElementId,
116
86
  role,
117
87
  ...FOCUSABLE_POPUP_PROPS,
118
88
  hidden: !mounted,
@@ -120,7 +90,7 @@ const DialogPopup_DialogPopup = /*#__PURE__*/ __rspack_external_react.forwardRef
120
90
  if (COMPOSITE_KEYS.has(event.key)) event.stopPropagation();
121
91
  },
122
92
  style: {
123
- [DialogPopupCssVars_DialogPopupCssVars.nestedDialogs]: nestedOpenDialogCount
93
+ [nestedDialogs]: nestedOpenDialogCount
124
94
  }
125
95
  },
126
96
  elementProps
@@ -130,7 +100,7 @@ const DialogPopup_DialogPopup = /*#__PURE__*/ __rspack_external_react.forwardRef
130
100
  store.context.popupRef,
131
101
  setPopupElement
132
102
  ],
133
- stateAttributesMapping: DialogPopup_stateAttributesMapping
103
+ stateAttributesMapping: dialogStateAttributesMapping
134
104
  });
135
105
  return /*#__PURE__*/ jsx(FloatingFocusManager, {
136
106
  context: floatingRootContext,
package/dist/9576.js ADDED
@@ -0,0 +1,51 @@
1
+ import { useCompositeListContext } from "./5275.js";
2
+ import { useIsoLayoutEffect } from "./3357.js";
3
+ import * as __rspack_external_react from "react";
4
+ function useCompositeListItem(params = {}) {
5
+ const { guess, label, metadata, textRef, index: externalIndex } = params;
6
+ const { register, unregister, subscribeMapChange, nextIndexRef } = useCompositeListContext();
7
+ const indexRef = __rspack_external_react.useRef(-1);
8
+ const [internalIndex, setInternalIndex] = __rspack_external_react.useState(null == externalIndex && guess ? ()=>{
9
+ if (-1 === indexRef.current) {
10
+ const newIndex = nextIndexRef.current;
11
+ nextIndexRef.current += 1;
12
+ indexRef.current = newIndex;
13
+ }
14
+ return indexRef.current;
15
+ } : -1);
16
+ const index = externalIndex ?? internalIndex;
17
+ const componentRef = __rspack_external_react.useRef(null);
18
+ const ref = __rspack_external_react.useCallback((node)=>{
19
+ const previousNode = componentRef.current;
20
+ if (previousNode) unregister(previousNode);
21
+ componentRef.current = node;
22
+ if (node) register(node, {
23
+ metadata: metadata ?? null,
24
+ index: externalIndex ?? null,
25
+ label,
26
+ textRef
27
+ });
28
+ }, [
29
+ externalIndex,
30
+ register,
31
+ unregister,
32
+ metadata,
33
+ label,
34
+ textRef
35
+ ]);
36
+ useIsoLayoutEffect(()=>{
37
+ if (null != externalIndex) return;
38
+ return subscribeMapChange((map)=>{
39
+ const i = componentRef.current ? map.get(componentRef.current)?.index : null;
40
+ if (null != i) setInternalIndex(i);
41
+ });
42
+ }, [
43
+ externalIndex,
44
+ subscribeMapChange
45
+ ]);
46
+ return {
47
+ ref,
48
+ index
49
+ };
50
+ }
51
+ export { useCompositeListItem };
@@ -5,6 +5,25 @@ function useRefWithInit(init, initArg) {
5
5
  if (ref.current === UNINITIALIZED) ref.current = init(initArg);
6
6
  return ref;
7
7
  }
8
+ let loggedMessages;
9
+ if ('production' !== process.env.NODE_ENV) loggedMessages = new Set();
10
+ function createLogOnce(severity, prefix) {
11
+ return function(...messages) {
12
+ if ('production' !== process.env.NODE_ENV) {
13
+ const message = messages.join(' ');
14
+ const output = prefix ? `${prefix}: ${message}` : message;
15
+ const key = `${severity}:${output}`;
16
+ if (!loggedMessages.has(key)) {
17
+ loggedMessages.add(key);
18
+ if ('warn' === severity) console.warn(output);
19
+ else console.error(output);
20
+ }
21
+ }
22
+ };
23
+ }
24
+ function NOOP() {}
25
+ const EMPTY_ARRAY = Object.freeze([]);
26
+ const EMPTY_OBJECT = Object.freeze({});
8
27
  function useMergedRefs(a, b, c, d) {
9
28
  const forkRef = useRefWithInit(createForkRef).current;
10
29
  if (didChange(forkRef, a, b, c, d)) update(forkRef, [
@@ -82,19 +101,6 @@ function update(forkRef, refs) {
82
101
  }
83
102
  };
84
103
  }
85
- function NOOP() {}
86
- const EMPTY_ARRAY = Object.freeze([]);
87
- const EMPTY_OBJECT = Object.freeze({});
88
- function createFormatErrorMessage(baseUrl, prefix) {
89
- return function(code, ...args) {
90
- const url = new URL(baseUrl);
91
- url.searchParams.set('code', code.toString());
92
- args.forEach((arg)=>url.searchParams.append('args[]', arg));
93
- return `${prefix} error #${code}; visit ${url} for the full message.`;
94
- };
95
- }
96
- const formatErrorMessage_formatErrorMessage = createFormatErrorMessage('https://base-ui.com/production-error', 'Base UI');
97
- const esm_formatErrorMessage = formatErrorMessage_formatErrorMessage;
98
104
  const majorVersion = parseInt(__rspack_external_react.version, 10);
99
105
  function isReactVersionAtLeast(reactVersionToCheck) {
100
106
  return majorVersion >= reactVersionToCheck;
@@ -113,17 +119,7 @@ function mergeObjects(a, b) {
113
119
  ...b
114
120
  };
115
121
  }
116
- let set;
117
- if ('production' !== process.env.NODE_ENV) set = new Set();
118
- function warn(...messages) {
119
- if ('production' !== process.env.NODE_ENV) {
120
- const messageKey = messages.join(' ');
121
- if (!set.has(messageKey)) {
122
- set.add(messageKey);
123
- console.warn(`Base UI: ${messageKey}`);
124
- }
125
- }
126
- }
122
+ const warn = createLogOnce('warn', 'Base UI');
127
123
  function getStateAttributesProps(state, customMapping) {
128
124
  const props = {};
129
125
  for(const key in state){
@@ -163,12 +159,12 @@ function mergePropsN(props) {
163
159
  }
164
160
  function createInitialMergedProps(inputProps) {
165
161
  if (isPropsGetter(inputProps)) return {
166
- ...resolvePropsGetter(inputProps, EMPTY_PROPS)
162
+ ...inputProps(EMPTY_PROPS)
167
163
  };
168
164
  return copyInitialProps(inputProps);
169
165
  }
170
166
  function mergeInto(merged, inputProps) {
171
- if (isPropsGetter(inputProps)) return resolvePropsGetter(inputProps, merged);
167
+ if (isPropsGetter(inputProps)) return inputProps(merged);
172
168
  return mutablyMergeInto(merged, inputProps);
173
169
  }
174
170
  function copyInitialProps(inputProps) {
@@ -208,10 +204,6 @@ function isEventHandler(key, value) {
208
204
  function isPropsGetter(inputProps) {
209
205
  return 'function' == typeof inputProps;
210
206
  }
211
- function resolvePropsGetter(inputProps, previousProps) {
212
- if (isPropsGetter(inputProps)) return inputProps(previousProps);
213
- return inputProps ?? EMPTY_PROPS;
214
- }
215
207
  function mergeEventHandlers(ourHandler, theirHandler) {
216
208
  if (!theirHandler) return ourHandler;
217
209
  if (!ourHandler) return wrapEventHandler(theirHandler);
@@ -254,14 +246,15 @@ function isSyntheticEvent(event) {
254
246
  return null != event && 'object' == typeof event && 'nativeEvent' in event;
255
247
  }
256
248
  function useRenderElement(element, componentProps, params = {}) {
257
- const renderProp = componentProps.render;
258
- const outProps = useRenderElementProps(componentProps, params);
249
+ let renderProp = componentProps.render;
250
+ if (false !== params.enabled) renderProp = unwrapLazyRenderProp(renderProp);
251
+ const outProps = useRenderElementProps(componentProps, params, renderProp);
259
252
  if (false === params.enabled) return null;
260
253
  const state = params.state ?? EMPTY_OBJECT;
261
254
  return evaluateRenderProp(element, renderProp, outProps, state);
262
255
  }
263
- function useRenderElementProps(componentProps, params = {}) {
264
- const { className: classNameProp, style: styleProp, render: renderProp } = componentProps;
256
+ function useRenderElementProps(componentProps, params, renderProp) {
257
+ const { className: classNameProp, style: styleProp } = componentProps;
265
258
  const { state = EMPTY_OBJECT, ref, props, stateAttributesMapping, enabled = true } = params;
266
259
  const className = enabled ? resolveClassName(classNameProp, state) : void 0;
267
260
  const style = enabled ? resolveStyle(styleProp, state) : void 0;
@@ -287,6 +280,11 @@ function resolveRenderFunctionProps(props) {
287
280
  const REACT_LAZY_TYPE = Symbol.for('react.lazy');
288
281
  const COMPONENT_IDENTIFIER_PATTERN = /^[A-Z][A-Za-z0-9$]*$/;
289
282
  const LOWERCASE_CHARACTER_PATTERN = /[a-z]/;
283
+ function unwrapLazyRenderProp(render) {
284
+ if (render?.$$typeof !== REACT_LAZY_TYPE) return render;
285
+ const unwrapped = __rspack_external_react.Children.toArray(render)[0];
286
+ return /*#__PURE__*/ __rspack_external_react.isValidElement(unwrapped) ? unwrapped : render;
287
+ }
290
288
  function evaluateRenderProp(element, render, props, state) {
291
289
  if (render) {
292
290
  if ('function' == typeof render) {
@@ -295,20 +293,12 @@ function evaluateRenderProp(element, render, props, state) {
295
293
  }
296
294
  const mergedProps = mergeProps(props, render.props);
297
295
  mergedProps.ref = props.ref;
298
- let newElement = render;
299
- if (newElement?.$$typeof === REACT_LAZY_TYPE) {
300
- const children = __rspack_external_react.Children.toArray(render);
301
- newElement = children[0];
302
- }
303
296
  if ('production' !== process.env.NODE_ENV) {
304
- if (!/*#__PURE__*/ __rspack_external_react.isValidElement(newElement)) throw new Error("Base UI: The `render` prop was provided an invalid React element as `React.isValidElement(render)` is `false`.\nA valid React element must be provided to the `render` prop because it is cloned with props to replace the default element.\nhttps://base-ui.com/r/invalid-render-prop");
297
+ if (!/*#__PURE__*/ __rspack_external_react.isValidElement(render)) throw new Error("Base UI: The `render` prop was provided an invalid React element as `React.isValidElement(render)` is `false`.\nA valid React element must be provided to the `render` prop because it is cloned with props to replace the default element.\nhttps://base-ui.com/r/invalid-render-prop");
305
298
  }
306
- return /*#__PURE__*/ __rspack_external_react.cloneElement(newElement, mergedProps);
307
- }
308
- if (element) {
309
- if ('string' == typeof element) return renderTag(element, props);
299
+ return /*#__PURE__*/ __rspack_external_react.cloneElement(render, mergedProps);
310
300
  }
311
- throw new Error("production" !== process.env.NODE_ENV ? 'Base UI: Render element or function are not defined.' : esm_formatErrorMessage(8));
301
+ return renderTag(element, props);
312
302
  }
313
303
  function warnIfRenderPropLooksLikeComponent(renderFn) {
314
304
  const functionName = renderFn.name;
@@ -330,4 +320,4 @@ function renderTag(Tag, props) {
330
320
  });
331
321
  return /*#__PURE__*/ __rspack_external_react.createElement(Tag, props);
332
322
  }
333
- export { EMPTY_ARRAY, EMPTY_OBJECT, NOOP, esm_formatErrorMessage, isReactVersionAtLeast, makeEventPreventable, mergeProps, resolveStyle, useMergedRefs, useRefWithInit, useRenderElement, warn };
323
+ export { EMPTY_ARRAY, EMPTY_OBJECT, NOOP, createLogOnce, isReactVersionAtLeast, makeEventPreventable, mergeProps, resolveStyle, unwrapLazyRenderProp, useMergedRefs, useRefWithInit, useRenderElement, warn };
@@ -1,10 +1,10 @@
1
- import { esm_formatErrorMessage } from "./8272.js";
1
+ import { utils_formatErrorMessage } from "./5473.js";
2
2
  import * as __rspack_external_react from "react";
3
3
  const ToolbarRootContext = /*#__PURE__*/ __rspack_external_react.createContext(void 0);
4
4
  if ("production" !== process.env.NODE_ENV) ToolbarRootContext.displayName = "ToolbarRootContext";
5
5
  function useToolbarRootContext(optional) {
6
6
  const context = __rspack_external_react.useContext(ToolbarRootContext);
7
- if (void 0 === context && !optional) throw new Error("production" !== process.env.NODE_ENV ? 'Base UI: ToolbarRootContext is missing. Toolbar parts must be placed within <Toolbar.Root>.' : esm_formatErrorMessage(69));
7
+ if (void 0 === context && !optional) throw new Error("production" !== process.env.NODE_ENV ? 'Base UI: ToolbarRootContext is missing. Toolbar parts must be placed within <Toolbar.Root>.' : utils_formatErrorMessage(69));
8
8
  return context;
9
9
  }
10
10
  export { ToolbarRootContext, useToolbarRootContext };
@@ -1,6 +1,9 @@
1
- import { NOOP } from "./8272.js";
1
+ import { NOOP } from "./9591.js";
2
2
  import * as __rspack_external_react from "react";
3
3
  const FormContext = /*#__PURE__*/ __rspack_external_react.createContext({
4
+ elementRef: {
5
+ current: null
6
+ },
4
7
  formRef: {
5
8
  current: {
6
9
  fields: new Map()
@@ -9,8 +12,8 @@ const FormContext = /*#__PURE__*/ __rspack_external_react.createContext({
9
12
  errors: {},
10
13
  clearErrors: NOOP,
11
14
  validationMode: 'onSubmit',
12
- submitAttemptedRef: {
13
- current: false
15
+ submitCountRef: {
16
+ current: 0
14
17
  }
15
18
  });
16
19
  if ("production" !== process.env.NODE_ENV) FormContext.displayName = "FormContext";