@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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/site-ui",
3
- "version": "1.347.0",
3
+ "version": "1.348.0",
4
4
  "description": "Pure UI components for the Wix site builder",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -47,7 +47,7 @@
47
47
  "react-dom": "^18.2.0"
48
48
  },
49
49
  "devDependencies": {
50
- "@base-ui/react": "^1.5.0",
50
+ "@base-ui/react": "^1.9.0",
51
51
  "@codemirror/lang-javascript": "^6.2.4",
52
52
  "@rsbuild/plugin-react": "^2.0.0",
53
53
  "@rslib/core": "^0.21.5",
@@ -95,5 +95,5 @@
95
95
  "registry": "https://registry.npmjs.org/",
96
96
  "access": "public"
97
97
  },
98
- "falconPackageHash": "897e7589cc1211e7c27a38dab7d7123acc891838bf54a7872b808b1d"
98
+ "falconPackageHash": "f15a7ac772436725c2571b48b0217465c66e0adb1932229bbe7e1568"
99
99
  }
package/dist/2205.js DELETED
@@ -1,26 +0,0 @@
1
- import { SafeReact } from "./6499.js";
2
- import * as __rspack_external_react from "react";
3
- let globalId = 0;
4
- function useGlobalId(idOverride, prefix = 'mui') {
5
- const [defaultId, setDefaultId] = __rspack_external_react.useState(idOverride);
6
- const id = idOverride || defaultId;
7
- __rspack_external_react.useEffect(()=>{
8
- if (null == defaultId) {
9
- globalId += 1;
10
- setDefaultId(`${prefix}-${globalId}`);
11
- }
12
- }, [
13
- defaultId,
14
- prefix
15
- ]);
16
- return id;
17
- }
18
- const maybeReactUseId = SafeReact.useId;
19
- function useId(idOverride, prefix) {
20
- if (void 0 !== maybeReactUseId) {
21
- const reactId = maybeReactUseId();
22
- return idOverride ?? (prefix ? `${prefix}-${reactId}` : reactId);
23
- }
24
- return useGlobalId(idOverride, prefix);
25
- }
26
- export { useId };
package/dist/2274.js DELETED
@@ -1,34 +0,0 @@
1
- import { useCompositeRootContext } from "./8724.js";
2
- import { useCompositeListItem } from "./3021.js";
3
- import { useMergedRefs } from "./8272.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 = __rspack_external_react.useMemo(()=>({
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
- isHighlighted,
24
- onHighlightedIndexChange,
25
- index,
26
- highlightItemOnHover
27
- ]);
28
- return {
29
- compositeProps,
30
- compositeRef: mergedRef,
31
- index
32
- };
33
- }
34
- export { useCompositeItem };
package/dist/2287.js DELETED
@@ -1,17 +0,0 @@
1
- import { __webpack_require__ } from "./rslib-runtime.js";
2
- import "./4586.js";
3
- import { NOOP } from "./8272.js";
4
- const use_sync_external_store = __webpack_require__("../../node_modules/use-sync-external-store/index.js");
5
- function subscribe() {
6
- return NOOP;
7
- }
8
- function getSnapshot() {
9
- return false;
10
- }
11
- function getServerSnapshot() {
12
- return true;
13
- }
14
- function useIsHydrating() {
15
- return (0, use_sync_external_store.useSyncExternalStore)(subscribe, getSnapshot, getServerSnapshot);
16
- }
17
- export { useIsHydrating };
package/dist/3020.js DELETED
@@ -1,7 +0,0 @@
1
- import { useRenderDialogRoot, IsDrawerContext } from "./6270.js";
2
- import * as __rspack_external_react from "react";
3
- function DialogRoot(props) {
4
- const mode = __rspack_external_react.useContext(IsDrawerContext) ? 'drawer' : 'dialog';
5
- return useRenderDialogRoot(props, mode);
6
- }
7
- export { DialogRoot };
package/dist/3021.js DELETED
@@ -1,72 +0,0 @@
1
- import { useCompositeListContext } from "./5036.js";
2
- import { useIsoLayoutEffect } from "./6499.js";
3
- import * as __rspack_external_react from "react";
4
- let useCompositeListItem_IndexGuessBehavior = /*#__PURE__*/ function(IndexGuessBehavior) {
5
- IndexGuessBehavior[IndexGuessBehavior["None"] = 0] = "None";
6
- IndexGuessBehavior[IndexGuessBehavior["GuessFromOrder"] = 1] = "GuessFromOrder";
7
- return IndexGuessBehavior;
8
- }({});
9
- function useCompositeListItem(params = {}) {
10
- const { label, metadata, textRef, indexGuessBehavior, index: externalIndex } = params;
11
- const { register, unregister, subscribeMapChange, elementsRef, labelsRef, nextIndexRef } = useCompositeListContext();
12
- const indexRef = __rspack_external_react.useRef(-1);
13
- const [index, setIndex] = __rspack_external_react.useState(externalIndex ?? (indexGuessBehavior === useCompositeListItem_IndexGuessBehavior.GuessFromOrder ? ()=>{
14
- if (-1 === indexRef.current) {
15
- const newIndex = nextIndexRef.current;
16
- nextIndexRef.current += 1;
17
- indexRef.current = newIndex;
18
- }
19
- return indexRef.current;
20
- } : -1));
21
- const componentRef = __rspack_external_react.useRef(null);
22
- const ref = __rspack_external_react.useCallback((node)=>{
23
- componentRef.current = node;
24
- if (-1 !== index && null !== node) {
25
- elementsRef.current[index] = node;
26
- if (labelsRef) {
27
- const isLabelDefined = void 0 !== label;
28
- labelsRef.current[index] = isLabelDefined ? label : textRef?.current?.textContent ?? node.textContent;
29
- }
30
- }
31
- }, [
32
- index,
33
- elementsRef,
34
- labelsRef,
35
- label,
36
- textRef
37
- ]);
38
- useIsoLayoutEffect(()=>{
39
- if (null != externalIndex) return;
40
- const node = componentRef.current;
41
- if (node) {
42
- register(node, metadata);
43
- return ()=>{
44
- unregister(node);
45
- };
46
- }
47
- }, [
48
- externalIndex,
49
- register,
50
- unregister,
51
- metadata
52
- ]);
53
- useIsoLayoutEffect(()=>{
54
- if (null != externalIndex) return;
55
- return subscribeMapChange((map)=>{
56
- const i = componentRef.current ? map.get(componentRef.current)?.index : null;
57
- if (null != i) setIndex(i);
58
- });
59
- }, [
60
- externalIndex,
61
- subscribeMapChange,
62
- setIndex
63
- ]);
64
- return __rspack_external_react.useMemo(()=>({
65
- ref,
66
- index
67
- }), [
68
- index,
69
- ref
70
- ]);
71
- }
72
- export { useCompositeListItem, useCompositeListItem_IndexGuessBehavior };
package/dist/3140.js DELETED
@@ -1,4 +0,0 @@
1
- function isElementDisabled(element) {
2
- return null == element || element.hasAttribute('disabled') || 'true' === element.getAttribute('aria-disabled');
3
- }
4
- export { isElementDisabled };
package/dist/3248.js DELETED
@@ -1,307 +0,0 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
2
- import { useLabelableContext, fieldValidityMapping, useFieldRootContext } from "./1477.js";
3
- import { NOOP, useRefWithInit, EMPTY_OBJECT, mergeProps, useMergedRefs, useRenderElement, esm_formatErrorMessage } from "./8272.js";
4
- import { useFormContext } from "./5085.js";
5
- import { useFieldItemContext } from "./1457.js";
6
- import { useCheckboxGroupContext } from "./8979.js";
7
- import { useBaseUiId } from "./6046.js";
8
- import { useButton } from "./9189.js";
9
- import { useControlled } from "./8527.js";
10
- import { useIsoLayoutEffect } from "./6499.js";
11
- import { useRegisterFieldControl } from "./4281.js";
12
- import { useAriaLabelledBy } from "./4490.js";
13
- import { useValueChanged } from "./2801.js";
14
- import { visuallyHiddenInput, visuallyHidden } from "./8225.js";
15
- import { createChangeEventDetails } from "./4768.js";
16
- import { getWindow } from "./3829.js";
17
- import * as __rspack_external_react from "react";
18
- function getDefaultFormSubmitter(form) {
19
- if (!form) return null;
20
- for (const candidate of form.elements){
21
- const tagName = candidate.tagName;
22
- if ('BUTTON' === tagName || 'INPUT' === tagName) {
23
- const button = candidate;
24
- if ('submit' === button.type) return button;
25
- }
26
- }
27
- return null;
28
- }
29
- let CheckboxRootDataAttributes_CheckboxRootDataAttributes = /*#__PURE__*/ function(CheckboxRootDataAttributes) {
30
- CheckboxRootDataAttributes["checked"] = "data-checked";
31
- CheckboxRootDataAttributes["unchecked"] = "data-unchecked";
32
- CheckboxRootDataAttributes["indeterminate"] = "data-indeterminate";
33
- CheckboxRootDataAttributes["disabled"] = "data-disabled";
34
- CheckboxRootDataAttributes["readonly"] = "data-readonly";
35
- CheckboxRootDataAttributes["required"] = "data-required";
36
- CheckboxRootDataAttributes["valid"] = "data-valid";
37
- CheckboxRootDataAttributes["invalid"] = "data-invalid";
38
- CheckboxRootDataAttributes["touched"] = "data-touched";
39
- CheckboxRootDataAttributes["dirty"] = "data-dirty";
40
- CheckboxRootDataAttributes["filled"] = "data-filled";
41
- CheckboxRootDataAttributes["focused"] = "data-focused";
42
- return CheckboxRootDataAttributes;
43
- }({});
44
- function useStateAttributesMapping(state) {
45
- return __rspack_external_react.useMemo(()=>({
46
- checked (value) {
47
- if (state.indeterminate) return {};
48
- if (value) return {
49
- [CheckboxRootDataAttributes_CheckboxRootDataAttributes.checked]: ''
50
- };
51
- return {
52
- [CheckboxRootDataAttributes_CheckboxRootDataAttributes.unchecked]: ''
53
- };
54
- },
55
- ...fieldValidityMapping
56
- }), [
57
- state.indeterminate
58
- ]);
59
- }
60
- const CheckboxRootContext = /*#__PURE__*/ __rspack_external_react.createContext(void 0);
61
- if ("production" !== process.env.NODE_ENV) CheckboxRootContext.displayName = "CheckboxRootContext";
62
- function useCheckboxRootContext() {
63
- const context = __rspack_external_react.useContext(CheckboxRootContext);
64
- if (void 0 === context) throw new Error("production" !== process.env.NODE_ENV ? 'Base UI: CheckboxRootContext is missing. Checkbox parts must be placed within <Checkbox.Root>.' : esm_formatErrorMessage(14));
65
- return context;
66
- }
67
- const PARENT_CHECKBOX = 'data-parent';
68
- const CheckboxRoot_CheckboxRoot = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
69
- const { checked: checkedProp, className, defaultChecked = false, 'aria-labelledby': ariaLabelledByProp, disabled: disabledProp = false, form, id: idProp, indeterminate = false, inputRef: inputRefProp, name: nameProp, onCheckedChange, parent = false, readOnly = false, render, required = false, uncheckedValue, value: valueProp, nativeButton = false, style, ...elementProps } = componentProps;
70
- const { clearErrors } = useFormContext();
71
- const { disabled: rootDisabled, name: fieldName, setDirty, setFilled, setFocused, setTouched, state: fieldState, validationMode, validityData, shouldValidateOnChange, validation: localValidation } = useFieldRootContext();
72
- const fieldItemContext = useFieldItemContext();
73
- const { labelId, controlId, registerControlId, getDescriptionProps } = useLabelableContext();
74
- const groupContext = useCheckboxGroupContext();
75
- const parentContext = groupContext?.parent;
76
- const isGroupedWithParent = parentContext && groupContext.allValues;
77
- const disabled = rootDisabled || fieldItemContext.disabled || groupContext?.disabled || disabledProp;
78
- const name = fieldName ?? nameProp;
79
- const value = valueProp ?? name;
80
- const id = useBaseUiId();
81
- const parentId = useBaseUiId();
82
- let inputId = controlId;
83
- if (isGroupedWithParent) inputId = parent ? parentId : `${parentContext.id}-${value}`;
84
- else if (idProp) inputId = idProp;
85
- let groupProps = {};
86
- if (isGroupedWithParent) {
87
- if (parent) groupProps = groupContext.parent.getParentProps();
88
- else if (value) groupProps = groupContext.parent.getChildProps(value);
89
- }
90
- const { checked: groupChecked = checkedProp, indeterminate: groupIndeterminate = indeterminate, onCheckedChange: groupOnChange, ...otherGroupProps } = groupProps;
91
- const groupValue = groupContext?.value;
92
- const setGroupValue = groupContext?.setValue;
93
- const defaultGroupValue = groupContext?.defaultValue;
94
- const controlRef = __rspack_external_react.useRef(null);
95
- const controlSourceRef = useRefWithInit(()=>Symbol('checkbox-control'));
96
- const hasRegisteredRef = __rspack_external_react.useRef(false);
97
- const { getButtonProps, buttonRef } = useButton({
98
- disabled,
99
- native: nativeButton
100
- });
101
- const validation = groupContext?.validation ?? localValidation;
102
- const [checked, setCheckedState] = useControlled({
103
- controlled: value && groupValue && !parent ? groupValue.includes(value) : groupChecked,
104
- default: value && defaultGroupValue && !parent ? defaultGroupValue.includes(value) : defaultChecked,
105
- name: 'Checkbox',
106
- state: 'checked'
107
- });
108
- useIsoLayoutEffect(()=>{
109
- if (registerControlId === NOOP) return;
110
- hasRegisteredRef.current = true;
111
- registerControlId(controlSourceRef.current, inputId);
112
- }, [
113
- inputId,
114
- registerControlId,
115
- controlSourceRef
116
- ]);
117
- __rspack_external_react.useEffect(()=>{
118
- const controlSource = controlSourceRef.current;
119
- return ()=>{
120
- if (!hasRegisteredRef.current || registerControlId === NOOP) return;
121
- hasRegisteredRef.current = false;
122
- registerControlId(controlSource, void 0);
123
- };
124
- }, [
125
- registerControlId,
126
- controlSourceRef
127
- ]);
128
- useRegisterFieldControl(controlRef, id, checked, void 0, !groupContext);
129
- const inputRef = __rspack_external_react.useRef(null);
130
- const mergedInputRef = useMergedRefs(inputRefProp, inputRef, validation.inputRef);
131
- const ariaLabelledBy = useAriaLabelledBy(ariaLabelledByProp, labelId, inputRef, !nativeButton, inputId ?? void 0);
132
- useIsoLayoutEffect(()=>{
133
- if (inputRef.current) {
134
- inputRef.current.indeterminate = groupIndeterminate;
135
- if (checked) setFilled(true);
136
- }
137
- }, [
138
- checked,
139
- groupIndeterminate,
140
- setFilled
141
- ]);
142
- useValueChanged(checked, ()=>{
143
- if (groupContext && !parent) return;
144
- clearErrors(name);
145
- setFilled(checked);
146
- setDirty(checked !== validityData.initialValue);
147
- if (shouldValidateOnChange()) validation.commit(checked);
148
- else validation.commit(checked, true);
149
- });
150
- const inputProps = mergeProps({
151
- checked,
152
- disabled,
153
- form,
154
- name: parent ? void 0 : name,
155
- id: nativeButton ? void 0 : inputId ?? void 0,
156
- required,
157
- ref: mergedInputRef,
158
- style: name ? visuallyHiddenInput : visuallyHidden,
159
- tabIndex: -1,
160
- type: 'checkbox',
161
- 'aria-hidden': true,
162
- onChange (event) {
163
- if (event.nativeEvent.defaultPrevented) return;
164
- if (readOnly) return void event.preventDefault();
165
- const nextChecked = event.currentTarget.checked;
166
- const details = createChangeEventDetails("none", event.nativeEvent);
167
- groupOnChange?.(nextChecked, details);
168
- onCheckedChange?.(nextChecked, details);
169
- if (details.isCanceled) return;
170
- setCheckedState(nextChecked);
171
- if (value && groupValue && setGroupValue && !parent && !isGroupedWithParent) {
172
- const nextGroupValue = nextChecked ? [
173
- ...groupValue,
174
- value
175
- ] : groupValue.filter((item)=>item !== value);
176
- setGroupValue(nextGroupValue, details);
177
- }
178
- },
179
- onFocus () {
180
- controlRef.current?.focus();
181
- }
182
- }, void 0 !== valueProp ? {
183
- value: (groupContext ? checked && valueProp : valueProp) || ''
184
- } : EMPTY_OBJECT, getDescriptionProps, groupContext ? validation.getValidationProps : validation.getInputValidationProps);
185
- const computedChecked = isGroupedWithParent ? Boolean(groupChecked) : checked;
186
- const computedIndeterminate = isGroupedWithParent ? groupIndeterminate || indeterminate : indeterminate;
187
- __rspack_external_react.useEffect(()=>{
188
- if (!parentContext || !value) return;
189
- const disabledStates = parentContext.disabledStatesRef.current;
190
- disabledStates.set(value, disabled);
191
- return ()=>{
192
- disabledStates.delete(value);
193
- };
194
- }, [
195
- parentContext,
196
- disabled,
197
- value
198
- ]);
199
- const state = __rspack_external_react.useMemo(()=>({
200
- ...fieldState,
201
- checked: computedChecked,
202
- disabled,
203
- readOnly,
204
- required,
205
- indeterminate: computedIndeterminate
206
- }), [
207
- fieldState,
208
- computedChecked,
209
- disabled,
210
- readOnly,
211
- required,
212
- computedIndeterminate
213
- ]);
214
- const stateAttributesMapping = useStateAttributesMapping(state);
215
- const element = useRenderElement('span', componentProps, {
216
- state,
217
- ref: [
218
- buttonRef,
219
- controlRef,
220
- forwardedRef,
221
- groupContext?.registerControlRef
222
- ],
223
- props: [
224
- {
225
- id: nativeButton ? inputId ?? void 0 : id,
226
- role: 'checkbox',
227
- 'aria-checked': groupIndeterminate ? 'mixed' : checked,
228
- 'aria-readonly': readOnly || void 0,
229
- 'aria-required': required || void 0,
230
- 'aria-labelledby': ariaLabelledBy,
231
- [PARENT_CHECKBOX]: parent ? '' : void 0,
232
- onFocus () {
233
- setFocused(true);
234
- },
235
- onBlur () {
236
- const inputEl = inputRef.current;
237
- if (!inputEl) return;
238
- setTouched(true);
239
- setFocused(false);
240
- if ('onBlur' === validationMode) validation.commit(groupContext ? groupValue : inputEl.checked);
241
- },
242
- onKeyDown (event) {
243
- if ('Enter' !== event.key) return;
244
- event.preventBaseUIHandler();
245
- if (event.defaultPrevented) return;
246
- const formToSubmit = inputRef.current?.form ?? null;
247
- const currentTarget = event.currentTarget;
248
- const nativeEvent = event.nativeEvent;
249
- const originalPreventDefault = event.preventDefault;
250
- const originalNativePreventDefault = nativeEvent.preventDefault;
251
- let preventDefaultCalledAfterPropagation = false;
252
- event.preventDefault = ()=>{
253
- preventDefaultCalledAfterPropagation = true;
254
- originalPreventDefault.call(event);
255
- };
256
- nativeEvent.preventDefault = ()=>{
257
- preventDefaultCalledAfterPropagation = true;
258
- originalNativePreventDefault.call(nativeEvent);
259
- };
260
- originalNativePreventDefault.call(nativeEvent);
261
- getWindow(currentTarget).queueMicrotask(()=>{
262
- event.preventDefault = originalPreventDefault;
263
- nativeEvent.preventDefault = originalNativePreventDefault;
264
- if (!preventDefaultCalledAfterPropagation) getDefaultFormSubmitter(formToSubmit)?.click();
265
- });
266
- },
267
- onClick (event) {
268
- if (readOnly || disabled) return;
269
- event.preventDefault();
270
- const input = inputRef.current;
271
- if (!input) return;
272
- input.dispatchEvent(new (getWindow(input)).PointerEvent('click', {
273
- bubbles: true,
274
- shiftKey: event.shiftKey,
275
- ctrlKey: event.ctrlKey,
276
- altKey: event.altKey,
277
- metaKey: event.metaKey
278
- }));
279
- }
280
- },
281
- getDescriptionProps,
282
- validation.getValidationProps,
283
- elementProps,
284
- otherGroupProps,
285
- getButtonProps
286
- ],
287
- stateAttributesMapping
288
- });
289
- return /*#__PURE__*/ jsxs(CheckboxRootContext.Provider, {
290
- value: state,
291
- children: [
292
- element,
293
- !checked && !groupContext && name && !parent && void 0 !== uncheckedValue && /*#__PURE__*/ jsx("input", {
294
- type: "hidden",
295
- form: form,
296
- name: name,
297
- value: uncheckedValue
298
- }),
299
- /*#__PURE__*/ jsx("input", {
300
- ...inputProps,
301
- suppressHydrationWarning: true
302
- })
303
- ]
304
- });
305
- });
306
- if ("production" !== process.env.NODE_ENV) CheckboxRoot_CheckboxRoot.displayName = "CheckboxRoot";
307
- export { CheckboxRoot_CheckboxRoot, PARENT_CHECKBOX, useCheckboxRootContext, useStateAttributesMapping };
package/dist/4026.js DELETED
@@ -1,12 +0,0 @@
1
- let set;
2
- if ('production' !== process.env.NODE_ENV) set = new Set();
3
- function error(...messages) {
4
- if ('production' !== process.env.NODE_ENV) {
5
- const messageKey = messages.join(' ');
6
- if (!set.has(messageKey)) {
7
- set.add(messageKey);
8
- console.error(`Base UI: ${messageKey}`);
9
- }
10
- }
11
- }
12
- export { error };
package/dist/4922.js DELETED
@@ -1,15 +0,0 @@
1
- import { PopupTriggerMap, FloatingRootStore } from "./5992.js";
2
- function getEmptyRootContext() {
3
- return new FloatingRootStore({
4
- open: false,
5
- transitionStatus: void 0,
6
- floatingElement: null,
7
- referenceElement: null,
8
- triggerElements: new PopupTriggerMap(),
9
- floatingId: void 0,
10
- syncOnly: false,
11
- nested: false,
12
- onOpenChange: void 0
13
- });
14
- }
15
- export { getEmptyRootContext };
package/dist/5659.js DELETED
@@ -1,4 +0,0 @@
1
- function areArraysEqual(array1, array2, itemComparer = (a, b)=>a === b) {
2
- return array1.length === array2.length && array1.every((value, index)=>itemComparer(value, array2[index]));
3
- }
4
- export { areArraysEqual };