@wix/site-ui 1.30.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 (173) 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/Breadcrumbs/index.d.ts +960 -7
  106. package/dist/Breadcrumbs/index.js +5 -5
  107. package/dist/Button/index.d.ts +88 -6
  108. package/dist/Button/index.js +27 -3
  109. package/dist/Checkbox/index.d.ts +425 -5
  110. package/dist/Checkbox/index.js +45 -5
  111. package/dist/CheckboxGroup/index.d.ts +318 -3
  112. package/dist/CheckboxGroup/index.js +166 -3
  113. package/dist/Collapsible/index.d.ts +377 -7
  114. package/dist/Collapsible/index.js +160 -6
  115. package/dist/Combobox/index.d.ts +1984 -48
  116. package/dist/Combobox/index.js +352 -29
  117. package/dist/ContextMenu/index.d.ts +2340 -36
  118. package/dist/ContextMenu/index.js +197 -22
  119. package/dist/Dialog/index.d.ts +1355 -18
  120. package/dist/Dialog/index.js +16 -14
  121. package/dist/Drawer/index.d.ts +1653 -18
  122. package/dist/Drawer/index.js +2797 -20
  123. package/dist/Field/index.d.ts +655 -15
  124. package/dist/Field/index.js +677 -10
  125. package/dist/Fieldset/index.d.ts +94 -5
  126. package/dist/Fieldset/index.js +68 -5
  127. package/dist/Form/index.d.ts +331 -2
  128. package/dist/Form/index.js +106 -3
  129. package/dist/Input/index.d.ts +692 -3
  130. package/dist/Input/index.js +10 -3
  131. package/dist/Menu/index.d.ts +2301 -36
  132. package/dist/Menu/index.js +365 -26
  133. package/dist/Menubar/index.d.ts +2301 -3
  134. package/dist/Menubar/index.js +105 -3
  135. package/dist/Meter/index.d.ts +175 -11
  136. package/dist/Meter/index.js +129 -9
  137. package/dist/NavigationMenu/index.d.ts +978 -28
  138. package/dist/NavigationMenu/index.js +1034 -17
  139. package/dist/NumberField/index.d.ts +612 -15
  140. package/dist/NumberField/index.js +1409 -11
  141. package/dist/Popover/index.d.ts +1655 -20
  142. package/dist/Popover/index.js +792 -17
  143. package/dist/PreviewCard/index.d.ts +1523 -14
  144. package/dist/PreviewCard/index.js +679 -14
  145. package/dist/Progress/index.d.ts +183 -11
  146. package/dist/Progress/index.js +181 -9
  147. package/dist/Radio/index.d.ts +185 -6
  148. package/dist/Radio/index.js +253 -6
  149. package/dist/RadioGroup/index.d.ts +341 -2
  150. package/dist/RadioGroup/index.js +154 -3
  151. package/dist/ScrollArea/index.d.ts +265 -13
  152. package/dist/ScrollArea/index.js +892 -10
  153. package/dist/Select/index.d.ts +1493 -38
  154. package/dist/Select/index.js +1824 -23
  155. package/dist/Separator/index.d.ts +80 -6
  156. package/dist/Separator/index.js +3 -3
  157. package/dist/Slider/index.d.ts +678 -16
  158. package/dist/Slider/index.js +1199 -11
  159. package/dist/Switch/index.d.ts +393 -5
  160. package/dist/Switch/index.js +208 -6
  161. package/dist/Tabs/index.d.ts +523 -12
  162. package/dist/Tabs/index.js +685 -9
  163. package/dist/Toggle/index.d.ts +305 -2
  164. package/dist/Toggle/index.js +76 -3
  165. package/dist/ToggleGroup/index.d.ts +316 -2
  166. package/dist/ToggleGroup/index.js +102 -3
  167. package/dist/Toolbar/index.d.ts +282 -13
  168. package/dist/Toolbar/index.js +230 -9
  169. package/dist/Tooltip/index.d.ts +1572 -14
  170. package/dist/Tooltip/index.js +965 -14
  171. package/dist/index.d.ts +12749 -652
  172. package/dist/rslib-runtime.js +18 -0
  173. package/package.json +3 -3
@@ -1,7 +1,47 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
- import { Checkbox } from "@base-ui/react/checkbox";
3
2
  import clsx from "clsx";
3
+ import { CheckboxRoot_CheckboxRoot, useCheckboxRootContext, useStateAttributesMapping } from "../3248.js";
4
+ import { useOpenChangeComplete, transitionStatusMapping, useTransitionStatus } from "../880.js";
5
+ import { fieldValidityMapping } from "../1477.js";
6
+ import { useRenderElement } from "../8272.js";
4
7
  import * as __rspack_external_react from "react";
8
+ const CheckboxIndicator_CheckboxIndicator = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
9
+ const { render, className, style, keepMounted = false, ...elementProps } = componentProps;
10
+ const rootState = useCheckboxRootContext();
11
+ const rendered = rootState.checked || rootState.indeterminate;
12
+ const { mounted, transitionStatus, setMounted } = useTransitionStatus(rendered);
13
+ const indicatorRef = __rspack_external_react.useRef(null);
14
+ const state = {
15
+ ...rootState,
16
+ transitionStatus
17
+ };
18
+ useOpenChangeComplete({
19
+ open: rendered,
20
+ ref: indicatorRef,
21
+ onComplete () {
22
+ if (!rendered) setMounted(false);
23
+ }
24
+ });
25
+ const baseStateAttributesMapping = useStateAttributesMapping(rootState);
26
+ const stateAttributesMapping = {
27
+ ...baseStateAttributesMapping,
28
+ ...transitionStatusMapping,
29
+ ...fieldValidityMapping
30
+ };
31
+ const shouldRender = keepMounted || mounted;
32
+ const element = useRenderElement('span', componentProps, {
33
+ ref: [
34
+ forwardedRef,
35
+ indicatorRef
36
+ ],
37
+ state,
38
+ stateAttributesMapping,
39
+ props: elementProps
40
+ });
41
+ if (!shouldRender) return null;
42
+ return element;
43
+ });
44
+ if ("production" !== process.env.NODE_ENV) CheckboxIndicator_CheckboxIndicator.displayName = "CheckboxIndicator";
5
45
  const Checkbox_module = {
6
46
  root: "root-OrOWpu",
7
47
  indicator: "indicator-g_8JYy"
@@ -11,7 +51,7 @@ const CheckboxSize = {
11
51
  medium: 16,
12
52
  large: 20
13
53
  };
14
- const Root = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, size = CheckboxSize.medium, style, ...props }, ref)=>/*#__PURE__*/ jsx(Checkbox.Root, {
54
+ const Root = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, size = CheckboxSize.medium, style, ...props }, ref)=>/*#__PURE__*/ jsx(CheckboxRoot_CheckboxRoot, {
15
55
  ref: ref,
16
56
  className: clsx(Checkbox_module.root, className),
17
57
  style: {
@@ -20,13 +60,13 @@ const Root = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, size
20
60
  },
21
61
  ...props
22
62
  }));
23
- const Indicator = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(Checkbox.Indicator, {
63
+ const Indicator = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(CheckboxIndicator_CheckboxIndicator, {
24
64
  ref: ref,
25
65
  className: clsx(Checkbox_module.indicator, className),
26
66
  ...props
27
67
  }));
28
- const Checkbox_Checkbox = {
68
+ const Checkbox = {
29
69
  Root: Root,
30
70
  Indicator: Indicator
31
71
  };
32
- export { CheckboxSize, Checkbox_Checkbox as Checkbox };
72
+ export { Checkbox, CheckboxSize };
@@ -1,11 +1,326 @@
1
- import { CheckboxGroupProps } from '@base-ui/react/checkbox-group';
1
+ import { CheckboxGroupProps as CheckboxGroupProps_2 } from '@base-ui/react/checkbox-group';
2
2
  import * as React_2 from 'react';
3
3
 
4
- export declare const CheckboxGroup: React_2.ForwardRefExoticComponent<Omit<Omit<Omit<CheckboxGroupProps, "ref"> & React_2.RefAttributes<HTMLDivElement>, "ref">, "className"> & {
4
+ declare type BaseUIChangeEventDetail<Reason extends string, CustomProperties extends object> = {
5
+ /**
6
+ * The reason for the event.
7
+ */
8
+ reason: Reason;
9
+ /**
10
+ * The native event associated with the custom event.
11
+ */
12
+ event: ReasonToEvent<Reason>;
13
+ /**
14
+ * Cancels Base UI from handling the event.
15
+ */
16
+ cancel: () => void;
17
+ /**
18
+ * Allows the event to propagate in cases where Base UI will stop the propagation.
19
+ */
20
+ allowPropagation: () => void;
21
+ /**
22
+ * Indicates whether the event has been canceled.
23
+ */
24
+ isCanceled: boolean;
25
+ /**
26
+ * Indicates whether the event is allowed to propagate.
27
+ */
28
+ isPropagationAllowed: boolean;
29
+ /**
30
+ * The element that triggered the event, if applicable.
31
+ */
32
+ trigger: Element | undefined;
33
+ } & CustomProperties;
34
+
35
+ /**
36
+ * Details of custom change events emitted by Base UI components.
37
+ */
38
+ declare type BaseUIChangeEventDetails<Reason extends string, CustomProperties extends object = {}> = Reason extends string ? BaseUIChangeEventDetail<Reason, CustomProperties> & {} : never;
39
+
40
+ /**
41
+ * Props shared by all Base UI components.
42
+ * Contains `className` (string or callback taking the component's state as an argument) and `render` (function to customize rendering).
43
+ */
44
+ declare type BaseUIComponentProps<ElementType extends React_2.ElementType, State, RenderFunctionProps = HTMLProps> = Omit<WithBaseUIEvent<React_2.ComponentPropsWithRef<ElementType>>, 'className' | 'color' | 'defaultValue' | 'defaultChecked' | 'style'> & {
45
+ /**
46
+ * CSS class applied to the element, or a function that
47
+ * returns a class based on the component's state.
48
+ */
49
+ className?: string | ((state: State) => string | undefined) | undefined;
50
+ /**
51
+ * Allows you to replace the component's HTML element
52
+ * with a different tag, or compose it with another component.
53
+ *
54
+ * Accepts a `ReactElement` or a function that returns the element to render.
55
+ */
56
+ render?: React_2.ReactElement | ComponentRenderFn<RenderFunctionProps, State> | undefined;
57
+ /**
58
+ * Style applied to the element, or a function that
59
+ * returns a style object based on the component's state.
60
+ */
61
+ style?: React_2.CSSProperties | ((state: State) => React_2.CSSProperties | undefined) | undefined;
62
+ };
63
+
64
+ declare type BaseUIEvent<E extends React_2.SyntheticEvent<Element, Event>> = E & {
65
+ preventBaseUIHandler: () => void;
66
+ readonly baseUIHandlerPrevented?: boolean | undefined;
67
+ };
68
+
69
+ declare const cancelOpen: "cancel-open";
70
+
71
+ export declare const CheckboxGroup: React_2.ForwardRefExoticComponent<Omit<Omit<Omit<CheckboxGroupProps_2, "ref"> & React_2.RefAttributes<HTMLDivElement>, "ref">, "className"> & {
5
72
  className?: string | undefined;
6
73
  } & React_2.RefAttributes<HTMLDivElement>>;
7
74
 
75
+ /**
76
+ * Provides a shared state to a series of checkboxes.
77
+ *
78
+ * Documentation: [Base UI Checkbox Group](https://base-ui.com/react/components/checkbox-group)
79
+ */
80
+ declare const CheckboxGroup_2: React_2.ForwardRefExoticComponent<Omit<CheckboxGroupProps, "ref"> & React_2.RefAttributes<HTMLDivElement>>;
81
+
82
+ declare namespace CheckboxGroup_2 {
83
+ type State = CheckboxGroupState;
84
+ type Props = CheckboxGroupProps;
85
+ type ChangeEventReason = CheckboxGroupChangeEventReason;
86
+ type ChangeEventDetails = CheckboxGroupChangeEventDetails;
87
+ }
88
+
89
+ export declare type CheckboxGroupChangeEventDetails = BaseUIChangeEventDetails<CheckboxGroup_2.ChangeEventReason>;
90
+
91
+ export declare type CheckboxGroupChangeEventReason = typeof REASONS.none;
92
+
93
+ export declare interface CheckboxGroupProps extends BaseUIComponentProps<'div', CheckboxGroupState> {
94
+ /**
95
+ * Names of the checkboxes in the group that should be ticked.
96
+ *
97
+ * To render an uncontrolled checkbox group, use the `defaultValue` prop instead.
98
+ */
99
+ value?: string[] | undefined;
100
+ /**
101
+ * Names of the checkboxes in the group that should be initially ticked.
102
+ *
103
+ * To render a controlled checkbox group, use the `value` prop instead.
104
+ */
105
+ defaultValue?: string[] | undefined;
106
+ /**
107
+ * Event handler called when a checkbox in the group is ticked or unticked.
108
+ * Provides the new value as an argument.
109
+ */
110
+ onValueChange?: ((value: string[], eventDetails: CheckboxGroupChangeEventDetails) => void) | undefined;
111
+ /**
112
+ * Names of all checkboxes in the group. Use this when creating a parent checkbox.
113
+ */
114
+ allValues?: string[] | undefined;
115
+ /**
116
+ * Whether the component should ignore user interaction.
117
+ * @default false
118
+ */
119
+ disabled?: boolean | undefined;
120
+ }
121
+
122
+ export declare interface CheckboxGroupState extends FieldRootState {
123
+ /**
124
+ * Whether the component should ignore user interaction.
125
+ */
126
+ disabled: boolean;
127
+ }
128
+
129
+ declare const chipRemovePress: "chip-remove-press";
130
+
131
+ declare const clearPress: "clear-press";
132
+
133
+ declare const closePress: "close-press";
134
+
135
+ declare const closeWatcher: "close-watcher";
136
+
137
+ /**
138
+ * Shape of the render prop: a function that takes props to be spread on the element and component's state and returns a React element.
139
+ *
140
+ * @template Props Props to be spread on the rendered element.
141
+ * @template State Component's internal state.
142
+ */
143
+ declare type ComponentRenderFn<Props, State> = (props: Props, state: State) => React_2.ReactElement<unknown>;
144
+
145
+ declare const decrementPress: "decrement-press";
146
+
147
+ declare const disabled: "disabled";
148
+
149
+ declare const drag: "drag";
150
+
151
+ declare const escapeKey: "escape-key";
152
+
153
+ declare interface FieldRootState {
154
+ /**
155
+ * Whether the component should ignore user interaction.
156
+ */
157
+ disabled: boolean;
158
+ /**
159
+ * Whether the field has been touched.
160
+ */
161
+ touched: boolean;
162
+ /**
163
+ * Whether the field value has changed from its initial value.
164
+ */
165
+ dirty: boolean;
166
+ /**
167
+ * Whether the field is valid.
168
+ */
169
+ valid: boolean | null;
170
+ /**
171
+ * Whether the field has a value.
172
+ */
173
+ filled: boolean;
174
+ /**
175
+ * Whether the field is focused.
176
+ */
177
+ focused: boolean;
178
+ }
179
+
180
+ declare const focusOut: "focus-out";
181
+
182
+ declare type HTMLProps<T = any> = React_2.HTMLAttributes<T> & {
183
+ ref?: React_2.Ref<T> | undefined;
184
+ };
185
+
186
+ declare const imperativeAction: "imperative-action";
187
+
188
+ declare const incrementPress: "increment-press";
189
+
190
+ declare const initial: "initial";
191
+
192
+ declare const inputBlur: "input-blur";
193
+
194
+ declare const inputChange: "input-change";
195
+
196
+ declare const inputClear: "input-clear";
197
+
198
+ declare const inputPaste: "input-paste";
199
+
200
+ declare const inputPress: "input-press";
201
+
202
+ declare const itemPress: "item-press";
203
+
204
+ declare const keyboard: "keyboard";
205
+
206
+ declare const linkPress: "link-press";
207
+
208
+ declare const listNavigation: "list-navigation";
209
+
210
+ declare const missing: "missing";
211
+
212
+ declare const none: "none";
213
+
214
+ declare const outsidePress: "outside-press";
215
+
216
+ declare const pointer: "pointer";
217
+
218
+ declare namespace REASONS {
219
+ export {
220
+ none,
221
+ triggerPress,
222
+ triggerHover,
223
+ triggerFocus,
224
+ outsidePress,
225
+ itemPress,
226
+ closePress,
227
+ linkPress,
228
+ clearPress,
229
+ chipRemovePress,
230
+ trackPress,
231
+ incrementPress,
232
+ decrementPress,
233
+ inputChange,
234
+ inputClear,
235
+ inputBlur,
236
+ inputPaste,
237
+ inputPress,
238
+ focusOut,
239
+ escapeKey,
240
+ closeWatcher,
241
+ listNavigation,
242
+ keyboard,
243
+ pointer,
244
+ drag,
245
+ wheel,
246
+ scrub,
247
+ cancelOpen,
248
+ siblingOpen,
249
+ disabled,
250
+ missing,
251
+ initial,
252
+ imperativeAction,
253
+ swipe,
254
+ windowResize
255
+ }
256
+ }
257
+
258
+ /**
259
+ * Maps a change `reason` string to the corresponding native event type.
260
+ */
261
+ declare type ReasonToEvent<Reason extends string> = Reason extends keyof ReasonToEventMap ? ReasonToEventMap[Reason] : Event;
262
+
263
+ declare interface ReasonToEventMap {
264
+ [REASONS.none]: Event;
265
+ [REASONS.triggerPress]: MouseEvent | PointerEvent | TouchEvent | KeyboardEvent;
266
+ [REASONS.triggerHover]: MouseEvent;
267
+ [REASONS.triggerFocus]: FocusEvent;
268
+ [REASONS.outsidePress]: MouseEvent | PointerEvent | TouchEvent;
269
+ [REASONS.itemPress]: MouseEvent | KeyboardEvent | PointerEvent;
270
+ [REASONS.closePress]: MouseEvent | KeyboardEvent | PointerEvent;
271
+ [REASONS.linkPress]: MouseEvent | PointerEvent;
272
+ [REASONS.clearPress]: PointerEvent | MouseEvent | KeyboardEvent;
273
+ [REASONS.chipRemovePress]: PointerEvent | MouseEvent | KeyboardEvent;
274
+ [REASONS.trackPress]: PointerEvent | MouseEvent | TouchEvent;
275
+ [REASONS.incrementPress]: PointerEvent | MouseEvent | TouchEvent;
276
+ [REASONS.decrementPress]: PointerEvent | MouseEvent | TouchEvent;
277
+ [REASONS.inputChange]: InputEvent | Event;
278
+ [REASONS.inputClear]: InputEvent | FocusEvent | Event;
279
+ [REASONS.inputBlur]: FocusEvent;
280
+ [REASONS.inputPaste]: ClipboardEvent;
281
+ [REASONS.inputPress]: MouseEvent | PointerEvent | TouchEvent | KeyboardEvent;
282
+ [REASONS.focusOut]: FocusEvent | KeyboardEvent;
283
+ [REASONS.escapeKey]: KeyboardEvent;
284
+ [REASONS.closeWatcher]: Event;
285
+ [REASONS.listNavigation]: KeyboardEvent;
286
+ [REASONS.keyboard]: KeyboardEvent;
287
+ [REASONS.pointer]: PointerEvent;
288
+ [REASONS.drag]: PointerEvent | TouchEvent;
289
+ [REASONS.swipe]: PointerEvent | TouchEvent;
290
+ [REASONS.wheel]: WheelEvent;
291
+ [REASONS.scrub]: PointerEvent;
292
+ [REASONS.cancelOpen]: MouseEvent;
293
+ [REASONS.siblingOpen]: Event;
294
+ [REASONS.disabled]: Event;
295
+ [REASONS.missing]: Event;
296
+ [REASONS.initial]: Event;
297
+ [REASONS.imperativeAction]: Event;
298
+ [REASONS.windowResize]: UIEvent;
299
+ }
300
+
301
+ declare const scrub: "scrub";
302
+
303
+ declare const siblingOpen: "sibling-open";
304
+
305
+ declare const swipe: "swipe";
306
+
307
+ declare const trackPress: "track-press";
308
+
309
+ declare const triggerFocus: "trigger-focus";
310
+
311
+ declare const triggerHover: "trigger-hover";
312
+
313
+ declare const triggerPress: "trigger-press";
314
+
315
+ declare const wheel: "wheel";
316
+
317
+ declare const windowResize: "window-resize";
318
+
319
+ /**
320
+ * Adds a `preventBaseUIHandler` method to all event handlers.
321
+ */
322
+ declare type WithBaseUIEvent<T> = { [K in keyof T]: WithPreventBaseUIHandler<T[K]> };
8
323
 
9
- export * from "@base-ui/react/checkbox-group";
324
+ declare type WithPreventBaseUIHandler<T> = T extends ((event: infer E) => any) ? E extends React_2.SyntheticEvent<Element, Event> ? (event: BaseUIEvent<E>) => ReturnType<T> : T : T extends undefined ? undefined : T;
10
325
 
11
326
  export { }
@@ -1,13 +1,176 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
- import { CheckboxGroup } from "@base-ui/react/checkbox-group";
3
2
  import clsx from "clsx";
3
+ import { useBaseUiId } from "../6046.js";
4
+ import { useStableCallback } from "../7541.js";
5
+ import { useLabelableContext, useFieldRootContext, fieldValidityMapping } from "../1477.js";
6
+ import { useFormContext } from "../5085.js";
7
+ import { useControlled } from "../8527.js";
8
+ import { PARENT_CHECKBOX } from "../3248.js";
9
+ import { useRegisterFieldControl } from "../4281.js";
10
+ import { EMPTY_ARRAY, useRenderElement } from "../8272.js";
11
+ import { useValueChanged } from "../2801.js";
12
+ import { areArraysEqual } from "../5659.js";
13
+ import { CheckboxGroupContext } from "../8979.js";
4
14
  import * as __rspack_external_react from "react";
15
+ const EMPTY = [];
16
+ function useCheckboxGroupParent(params) {
17
+ const { allValues = EMPTY, value = EMPTY, onValueChange: onValueChangeProp } = params;
18
+ const uncontrolledStateRef = __rspack_external_react.useRef(value);
19
+ const disabledStatesRef = __rspack_external_react.useRef(new Map());
20
+ const [status, setStatus] = __rspack_external_react.useState('mixed');
21
+ const id = useBaseUiId();
22
+ const checked = value.length === allValues.length;
23
+ const indeterminate = value.length !== allValues.length && value.length > 0;
24
+ const onValueChange = useStableCallback(onValueChangeProp);
25
+ const getParentProps = __rspack_external_react.useCallback(()=>({
26
+ id,
27
+ indeterminate,
28
+ checked,
29
+ 'aria-controls': allValues.map((v)=>`${id}-${v}`).join(' '),
30
+ onCheckedChange (_, eventDetails) {
31
+ const uncontrolledState = uncontrolledStateRef.current;
32
+ const none = allValues.filter((v)=>disabledStatesRef.current.get(v) && uncontrolledState.includes(v));
33
+ const all = allValues.filter((v)=>!disabledStatesRef.current.get(v) || disabledStatesRef.current.get(v) && uncontrolledState.includes(v));
34
+ const allOnOrOff = uncontrolledState.length === all.length || 0 === uncontrolledState.length;
35
+ if (allOnOrOff) return void (value.length === all.length ? onValueChange(none, eventDetails) : onValueChange(all, eventDetails));
36
+ if ('mixed' === status) {
37
+ onValueChange(all, eventDetails);
38
+ setStatus('on');
39
+ } else if ('on' === status) {
40
+ onValueChange(none, eventDetails);
41
+ setStatus('off');
42
+ } else if ('off' === status) {
43
+ onValueChange(uncontrolledState, eventDetails);
44
+ setStatus('mixed');
45
+ }
46
+ }
47
+ }), [
48
+ allValues,
49
+ checked,
50
+ id,
51
+ indeterminate,
52
+ onValueChange,
53
+ status,
54
+ value.length
55
+ ]);
56
+ const getChildProps = __rspack_external_react.useCallback((childValue)=>({
57
+ checked: value.includes(childValue),
58
+ onCheckedChange (nextChecked, eventDetails) {
59
+ const newValue = value.slice();
60
+ if (nextChecked) newValue.push(childValue);
61
+ else newValue.splice(newValue.indexOf(childValue), 1);
62
+ uncontrolledStateRef.current = newValue;
63
+ onValueChange(newValue, eventDetails);
64
+ setStatus('mixed');
65
+ }
66
+ }), [
67
+ onValueChange,
68
+ value
69
+ ]);
70
+ return __rspack_external_react.useMemo(()=>({
71
+ id,
72
+ indeterminate,
73
+ getParentProps,
74
+ getChildProps,
75
+ disabledStatesRef
76
+ }), [
77
+ id,
78
+ indeterminate,
79
+ getParentProps,
80
+ getChildProps
81
+ ]);
82
+ }
83
+ const CheckboxGroup_CheckboxGroup = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
84
+ const { allValues, className, defaultValue: defaultValueProp, disabled: disabledProp = false, id: idProp, onValueChange, render, value: externalValue, style, ...elementProps } = componentProps;
85
+ const { disabled: fieldDisabled, name: fieldName, state: fieldState, validation, setFilled, setDirty, shouldValidateOnChange, validityData } = useFieldRootContext();
86
+ const { labelId, getDescriptionProps } = useLabelableContext();
87
+ const { clearErrors } = useFormContext();
88
+ const disabled = fieldDisabled || disabledProp;
89
+ const defaultValue = __rspack_external_react.useMemo(()=>{
90
+ if (void 0 === externalValue) return defaultValueProp ?? [];
91
+ }, [
92
+ externalValue,
93
+ defaultValueProp
94
+ ]);
95
+ const [value, setValueUnwrapped] = useControlled({
96
+ controlled: externalValue,
97
+ default: defaultValue,
98
+ name: 'CheckboxGroup',
99
+ state: 'value'
100
+ });
101
+ const setValue = useStableCallback((v, eventDetails)=>{
102
+ onValueChange?.(v, eventDetails);
103
+ if (eventDetails.isCanceled) return;
104
+ setValueUnwrapped(v);
105
+ });
106
+ const parent = useCheckboxGroupParent({
107
+ allValues,
108
+ value,
109
+ onValueChange: setValue
110
+ });
111
+ const id = useBaseUiId(idProp);
112
+ const controlRef = __rspack_external_react.useRef(null);
113
+ const registerControlRef = __rspack_external_react.useCallback((element)=>{
114
+ if (null == controlRef.current && null != element && !element.hasAttribute(PARENT_CHECKBOX)) controlRef.current = element;
115
+ }, []);
116
+ useRegisterFieldControl(controlRef, id, value, void 0, !!fieldName);
117
+ const resolvedValue = value ?? EMPTY_ARRAY;
118
+ useValueChanged(resolvedValue, ()=>{
119
+ if (fieldName) clearErrors(fieldName);
120
+ const initialValue = Array.isArray(validityData.initialValue) ? validityData.initialValue : EMPTY_ARRAY;
121
+ setFilled(resolvedValue.length > 0);
122
+ setDirty(!areArraysEqual(resolvedValue, initialValue));
123
+ if (shouldValidateOnChange()) validation.commit(resolvedValue);
124
+ else validation.commit(resolvedValue, true);
125
+ });
126
+ const state = {
127
+ ...fieldState,
128
+ disabled
129
+ };
130
+ const contextValue = __rspack_external_react.useMemo(()=>({
131
+ allValues,
132
+ value,
133
+ defaultValue,
134
+ setValue,
135
+ parent,
136
+ disabled,
137
+ validation,
138
+ registerControlRef
139
+ }), [
140
+ allValues,
141
+ value,
142
+ defaultValue,
143
+ setValue,
144
+ parent,
145
+ disabled,
146
+ validation,
147
+ registerControlRef
148
+ ]);
149
+ const element = useRenderElement('div', componentProps, {
150
+ state,
151
+ ref: forwardedRef,
152
+ props: [
153
+ {
154
+ role: 'group',
155
+ 'aria-labelledby': labelId
156
+ },
157
+ getDescriptionProps,
158
+ elementProps
159
+ ],
160
+ stateAttributesMapping: fieldValidityMapping
161
+ });
162
+ return /*#__PURE__*/ jsx(CheckboxGroupContext.Provider, {
163
+ value: contextValue,
164
+ children: element
165
+ });
166
+ });
167
+ if ("production" !== process.env.NODE_ENV) CheckboxGroup_CheckboxGroup.displayName = "CheckboxGroup";
5
168
  const CheckboxGroup_module = {
6
169
  root: "root-ZCRH6j"
7
170
  };
8
- const CheckboxGroup_CheckboxGroup = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(CheckboxGroup, {
171
+ const CheckboxGroup_CheckboxGroup_CheckboxGroup = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(CheckboxGroup_CheckboxGroup, {
9
172
  ref: ref,
10
173
  className: clsx(CheckboxGroup_module.root, className),
11
174
  ...props
12
175
  }));
13
- export { CheckboxGroup_CheckboxGroup as CheckboxGroup };
176
+ export { CheckboxGroup_CheckboxGroup_CheckboxGroup as CheckboxGroup };