@wix/site-ui 1.29.0 → 1.31.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/1268.js +99 -0
- package/dist/1279.js +7 -0
- package/dist/1457.js +10 -0
- package/dist/1477.js +106 -0
- package/dist/1500.js +111 -0
- package/dist/167.js +6 -0
- package/dist/2274.js +34 -0
- package/dist/2287.js +17 -0
- package/dist/2418.js +31 -0
- package/dist/2801.js +20 -0
- package/dist/285.js +86 -0
- package/dist/2861.js +6 -0
- package/dist/3020.js +7 -0
- package/dist/3021.js +72 -0
- package/dist/3056.js +229 -0
- package/dist/3140.js +4 -0
- package/dist/3248.js +307 -0
- package/dist/3296.js +4 -0
- package/dist/3319.js +400 -0
- package/dist/3395.js +4 -0
- package/dist/3485.js +854 -0
- package/dist/353.js +14 -0
- package/dist/3670.js +418 -0
- package/dist/3829.js +113 -0
- package/dist/4026.js +12 -0
- package/dist/4143.js +46 -0
- package/dist/42.js +32 -0
- package/dist/4281.js +30 -0
- package/dist/4346.js +2 -0
- package/dist/4388.js +418 -0
- package/dist/4490.js +32 -0
- package/dist/4495.js +9 -0
- package/dist/4549.js +24 -0
- package/dist/4586.js +41 -0
- package/dist/4586.js.LICENSE.txt +19 -0
- package/dist/4707.js +19 -0
- package/dist/4723.js +7 -0
- package/dist/4745.js +7 -0
- package/dist/4768.js +35 -0
- package/dist/4922.js +15 -0
- package/dist/5036.js +17 -0
- package/dist/5085.js +20 -0
- package/dist/5299.js +597 -0
- package/dist/5659.js +4 -0
- package/dist/5778.js +10 -0
- package/dist/5864.js +86 -0
- package/dist/5992.js +913 -0
- package/dist/5992.js.LICENSE.txt +19 -0
- package/dist/6003.js +10 -0
- package/dist/6046.js +29 -0
- package/dist/6089.js +2355 -0
- package/dist/6107.js +10 -0
- package/dist/6247.js +20 -0
- package/dist/6270.js +487 -0
- package/dist/6329.js +32 -0
- package/dist/6330.js +30 -0
- package/dist/6499.js +7 -0
- package/dist/6535.js +71 -0
- package/dist/6588.js +382 -0
- package/dist/6706.js +16 -0
- package/dist/6825.js +7 -0
- package/dist/6882.js +1562 -0
- package/dist/6914.js +30 -0
- package/dist/7021.js +13 -0
- package/dist/7366.js +83 -0
- package/dist/7373.js +25 -0
- package/dist/7541.js +25 -0
- package/dist/7564.js +10 -0
- package/dist/7642.js +20 -0
- package/dist/7725.js +10 -0
- package/dist/7871.js +38 -0
- package/dist/8052.js +352 -0
- package/dist/8106.js +238 -0
- package/dist/8171.js +346 -0
- package/dist/8225.js +21 -0
- package/dist/8272.js +333 -0
- package/dist/8527.js +58 -0
- package/dist/8724.js +10 -0
- package/dist/8750.js +1920 -0
- package/dist/8758.js +43 -0
- package/dist/880.js +149 -0
- package/dist/8935.js +8 -0
- package/dist/8960.js +22 -0
- package/dist/8971.js +40 -0
- package/dist/8979.js +10 -0
- package/dist/8996.js +71 -0
- package/dist/904.js +121 -0
- package/dist/9048.js +52 -0
- package/dist/9087.js +256 -0
- package/dist/9189.js +158 -0
- package/dist/9255.js +136 -0
- package/dist/9352.js +148 -0
- package/dist/951.js +22 -0
- package/dist/9635.js +22 -0
- package/dist/9829.js +4 -0
- package/dist/9863.js +8 -0
- package/dist/Accordion/index.d.ts +569 -12
- package/dist/Accordion/index.js +423 -8
- package/dist/AlertDialog/index.d.ts +1417 -18
- package/dist/AlertDialog/index.js +34 -14
- package/dist/Autocomplete/index.d.ts +1861 -38
- package/dist/Autocomplete/index.js +98 -24
- package/dist/Avatar/index.d.ts +129 -7
- package/dist/Avatar/index.js +149 -6
- package/dist/Badge/index.css +44 -0
- package/dist/Badge/index.d.ts +22 -0
- package/dist/Badge/index.js +23 -0
- package/dist/Breadcrumbs/index.d.ts +960 -7
- package/dist/Breadcrumbs/index.js +5 -5
- package/dist/Button/index.d.ts +88 -6
- package/dist/Button/index.js +27 -3
- package/dist/Checkbox/index.d.ts +425 -5
- package/dist/Checkbox/index.js +45 -5
- package/dist/CheckboxGroup/index.d.ts +318 -3
- package/dist/CheckboxGroup/index.js +166 -3
- package/dist/Collapsible/index.d.ts +377 -7
- package/dist/Collapsible/index.js +160 -6
- package/dist/Combobox/index.d.ts +1984 -48
- package/dist/Combobox/index.js +352 -29
- package/dist/ContextMenu/index.d.ts +2340 -36
- package/dist/ContextMenu/index.js +197 -22
- package/dist/Dialog/index.d.ts +1355 -18
- package/dist/Dialog/index.js +16 -14
- package/dist/Drawer/index.d.ts +1653 -18
- package/dist/Drawer/index.js +2797 -20
- package/dist/Field/index.d.ts +655 -15
- package/dist/Field/index.js +677 -10
- package/dist/Fieldset/index.d.ts +94 -5
- package/dist/Fieldset/index.js +68 -5
- package/dist/Form/index.d.ts +331 -2
- package/dist/Form/index.js +106 -3
- package/dist/Input/index.d.ts +692 -3
- package/dist/Input/index.js +10 -3
- package/dist/Menu/index.d.ts +2301 -36
- package/dist/Menu/index.js +365 -26
- package/dist/Menubar/index.d.ts +2301 -3
- package/dist/Menubar/index.js +105 -3
- package/dist/Meter/index.d.ts +175 -11
- package/dist/Meter/index.js +129 -9
- package/dist/NavigationMenu/index.d.ts +978 -28
- package/dist/NavigationMenu/index.js +1034 -17
- package/dist/NumberField/index.d.ts +612 -15
- package/dist/NumberField/index.js +1409 -11
- package/dist/Popover/index.d.ts +1655 -20
- package/dist/Popover/index.js +792 -17
- package/dist/PreviewCard/index.d.ts +1523 -14
- package/dist/PreviewCard/index.js +679 -14
- package/dist/Progress/index.d.ts +183 -11
- package/dist/Progress/index.js +181 -9
- package/dist/Radio/index.d.ts +185 -6
- package/dist/Radio/index.js +253 -6
- package/dist/RadioGroup/index.d.ts +341 -2
- package/dist/RadioGroup/index.js +154 -3
- package/dist/ScrollArea/index.d.ts +265 -13
- package/dist/ScrollArea/index.js +892 -10
- package/dist/Select/index.d.ts +1493 -38
- package/dist/Select/index.js +1824 -23
- package/dist/Separator/index.d.ts +80 -6
- package/dist/Separator/index.js +3 -3
- package/dist/Slider/index.d.ts +678 -16
- package/dist/Slider/index.js +1199 -11
- package/dist/Switch/index.d.ts +393 -5
- package/dist/Switch/index.js +208 -6
- package/dist/Tabs/index.d.ts +523 -12
- package/dist/Tabs/index.js +685 -9
- package/dist/Toggle/index.d.ts +305 -2
- package/dist/Toggle/index.js +76 -3
- package/dist/ToggleGroup/index.d.ts +316 -2
- package/dist/ToggleGroup/index.js +102 -3
- package/dist/Toolbar/index.d.ts +282 -13
- package/dist/Toolbar/index.js +230 -9
- package/dist/Tooltip/index.d.ts +1572 -14
- package/dist/Tooltip/index.js +965 -14
- package/dist/index.d.ts +12758 -646
- package/dist/index.js +1 -0
- package/dist/rslib-runtime.js +18 -0
- package/package.json +3 -3
|
@@ -1,11 +1,325 @@
|
|
|
1
1
|
import * as React_2 from 'react';
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
declare type BaseUIChangeEventDetail<Reason extends string, CustomProperties extends object> = {
|
|
4
|
+
/**
|
|
5
|
+
* The reason for the event.
|
|
6
|
+
*/
|
|
7
|
+
reason: Reason;
|
|
8
|
+
/**
|
|
9
|
+
* The native event associated with the custom event.
|
|
10
|
+
*/
|
|
11
|
+
event: ReasonToEvent<Reason>;
|
|
12
|
+
/**
|
|
13
|
+
* Cancels Base UI from handling the event.
|
|
14
|
+
*/
|
|
15
|
+
cancel: () => void;
|
|
16
|
+
/**
|
|
17
|
+
* Allows the event to propagate in cases where Base UI will stop the propagation.
|
|
18
|
+
*/
|
|
19
|
+
allowPropagation: () => void;
|
|
20
|
+
/**
|
|
21
|
+
* Indicates whether the event has been canceled.
|
|
22
|
+
*/
|
|
23
|
+
isCanceled: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Indicates whether the event is allowed to propagate.
|
|
26
|
+
*/
|
|
27
|
+
isPropagationAllowed: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* The element that triggered the event, if applicable.
|
|
30
|
+
*/
|
|
31
|
+
trigger: Element | undefined;
|
|
32
|
+
} & CustomProperties;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Details of custom change events emitted by Base UI components.
|
|
36
|
+
*/
|
|
37
|
+
declare type BaseUIChangeEventDetails<Reason extends string, CustomProperties extends object = {}> = Reason extends string ? BaseUIChangeEventDetail<Reason, CustomProperties> & {} : never;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Props shared by all Base UI components.
|
|
41
|
+
* Contains `className` (string or callback taking the component's state as an argument) and `render` (function to customize rendering).
|
|
42
|
+
*/
|
|
43
|
+
declare type BaseUIComponentProps<ElementType extends React_2.ElementType, State, RenderFunctionProps = HTMLProps> = Omit<WithBaseUIEvent<React_2.ComponentPropsWithRef<ElementType>>, 'className' | 'color' | 'defaultValue' | 'defaultChecked' | 'style'> & {
|
|
44
|
+
/**
|
|
45
|
+
* CSS class applied to the element, or a function that
|
|
46
|
+
* returns a class based on the component's state.
|
|
47
|
+
*/
|
|
48
|
+
className?: string | ((state: State) => string | undefined) | undefined;
|
|
49
|
+
/**
|
|
50
|
+
* Allows you to replace the component's HTML element
|
|
51
|
+
* with a different tag, or compose it with another component.
|
|
52
|
+
*
|
|
53
|
+
* Accepts a `ReactElement` or a function that returns the element to render.
|
|
54
|
+
*/
|
|
55
|
+
render?: React_2.ReactElement | ComponentRenderFn<RenderFunctionProps, State> | undefined;
|
|
56
|
+
/**
|
|
57
|
+
* Style applied to the element, or a function that
|
|
58
|
+
* returns a style object based on the component's state.
|
|
59
|
+
*/
|
|
60
|
+
style?: React_2.CSSProperties | ((state: State) => React_2.CSSProperties | undefined) | undefined;
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
declare type BaseUIEvent<E extends React_2.SyntheticEvent<Element, Event>> = E & {
|
|
64
|
+
preventBaseUIHandler: () => void;
|
|
65
|
+
readonly baseUIHandlerPrevented?: boolean | undefined;
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
declare const cancelOpen: "cancel-open";
|
|
69
|
+
|
|
70
|
+
declare const chipRemovePress: "chip-remove-press";
|
|
71
|
+
|
|
72
|
+
declare const clearPress: "clear-press";
|
|
73
|
+
|
|
74
|
+
declare const closePress: "close-press";
|
|
75
|
+
|
|
76
|
+
declare const closeWatcher: "close-watcher";
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* 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.
|
|
80
|
+
*
|
|
81
|
+
* @template Props Props to be spread on the rendered element.
|
|
82
|
+
* @template State Component's internal state.
|
|
83
|
+
*/
|
|
84
|
+
declare type ComponentRenderFn<Props, State> = (props: Props, state: State) => React_2.ReactElement<unknown>;
|
|
85
|
+
|
|
86
|
+
declare const decrementPress: "decrement-press";
|
|
87
|
+
|
|
88
|
+
declare const disabled: "disabled";
|
|
89
|
+
|
|
90
|
+
declare const drag: "drag";
|
|
91
|
+
|
|
92
|
+
declare const escapeKey: "escape-key";
|
|
93
|
+
|
|
94
|
+
declare const focusOut: "focus-out";
|
|
95
|
+
|
|
96
|
+
declare type HTMLProps<T = any> = React_2.HTMLAttributes<T> & {
|
|
97
|
+
ref?: React_2.Ref<T> | undefined;
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
declare const imperativeAction: "imperative-action";
|
|
101
|
+
|
|
102
|
+
declare const incrementPress: "increment-press";
|
|
103
|
+
|
|
104
|
+
declare const initial: "initial";
|
|
105
|
+
|
|
106
|
+
declare const inputBlur: "input-blur";
|
|
107
|
+
|
|
108
|
+
declare const inputChange: "input-change";
|
|
109
|
+
|
|
110
|
+
declare const inputClear: "input-clear";
|
|
111
|
+
|
|
112
|
+
declare const inputPaste: "input-paste";
|
|
113
|
+
|
|
114
|
+
declare const inputPress: "input-press";
|
|
115
|
+
|
|
116
|
+
declare const itemPress: "item-press";
|
|
117
|
+
|
|
118
|
+
declare const keyboard: "keyboard";
|
|
119
|
+
|
|
120
|
+
declare const linkPress: "link-press";
|
|
121
|
+
|
|
122
|
+
declare const listNavigation: "list-navigation";
|
|
123
|
+
|
|
124
|
+
declare const missing: "missing";
|
|
125
|
+
|
|
126
|
+
declare const none: "none";
|
|
127
|
+
|
|
128
|
+
declare type Orientation = 'horizontal' | 'vertical';
|
|
129
|
+
|
|
130
|
+
declare const outsidePress: "outside-press";
|
|
131
|
+
|
|
132
|
+
declare const pointer: "pointer";
|
|
133
|
+
|
|
134
|
+
declare namespace REASONS {
|
|
135
|
+
export {
|
|
136
|
+
none,
|
|
137
|
+
triggerPress,
|
|
138
|
+
triggerHover,
|
|
139
|
+
triggerFocus,
|
|
140
|
+
outsidePress,
|
|
141
|
+
itemPress,
|
|
142
|
+
closePress,
|
|
143
|
+
linkPress,
|
|
144
|
+
clearPress,
|
|
145
|
+
chipRemovePress,
|
|
146
|
+
trackPress,
|
|
147
|
+
incrementPress,
|
|
148
|
+
decrementPress,
|
|
149
|
+
inputChange,
|
|
150
|
+
inputClear,
|
|
151
|
+
inputBlur,
|
|
152
|
+
inputPaste,
|
|
153
|
+
inputPress,
|
|
154
|
+
focusOut,
|
|
155
|
+
escapeKey,
|
|
156
|
+
closeWatcher,
|
|
157
|
+
listNavigation,
|
|
158
|
+
keyboard,
|
|
159
|
+
pointer,
|
|
160
|
+
drag,
|
|
161
|
+
wheel,
|
|
162
|
+
scrub,
|
|
163
|
+
cancelOpen,
|
|
164
|
+
siblingOpen,
|
|
165
|
+
disabled,
|
|
166
|
+
missing,
|
|
167
|
+
initial,
|
|
168
|
+
imperativeAction,
|
|
169
|
+
swipe,
|
|
170
|
+
windowResize
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* Maps a change `reason` string to the corresponding native event type.
|
|
176
|
+
*/
|
|
177
|
+
declare type ReasonToEvent<Reason extends string> = Reason extends keyof ReasonToEventMap ? ReasonToEventMap[Reason] : Event;
|
|
178
|
+
|
|
179
|
+
declare interface ReasonToEventMap {
|
|
180
|
+
[REASONS.none]: Event;
|
|
181
|
+
[REASONS.triggerPress]: MouseEvent | PointerEvent | TouchEvent | KeyboardEvent;
|
|
182
|
+
[REASONS.triggerHover]: MouseEvent;
|
|
183
|
+
[REASONS.triggerFocus]: FocusEvent;
|
|
184
|
+
[REASONS.outsidePress]: MouseEvent | PointerEvent | TouchEvent;
|
|
185
|
+
[REASONS.itemPress]: MouseEvent | KeyboardEvent | PointerEvent;
|
|
186
|
+
[REASONS.closePress]: MouseEvent | KeyboardEvent | PointerEvent;
|
|
187
|
+
[REASONS.linkPress]: MouseEvent | PointerEvent;
|
|
188
|
+
[REASONS.clearPress]: PointerEvent | MouseEvent | KeyboardEvent;
|
|
189
|
+
[REASONS.chipRemovePress]: PointerEvent | MouseEvent | KeyboardEvent;
|
|
190
|
+
[REASONS.trackPress]: PointerEvent | MouseEvent | TouchEvent;
|
|
191
|
+
[REASONS.incrementPress]: PointerEvent | MouseEvent | TouchEvent;
|
|
192
|
+
[REASONS.decrementPress]: PointerEvent | MouseEvent | TouchEvent;
|
|
193
|
+
[REASONS.inputChange]: InputEvent | Event;
|
|
194
|
+
[REASONS.inputClear]: InputEvent | FocusEvent | Event;
|
|
195
|
+
[REASONS.inputBlur]: FocusEvent;
|
|
196
|
+
[REASONS.inputPaste]: ClipboardEvent;
|
|
197
|
+
[REASONS.inputPress]: MouseEvent | PointerEvent | TouchEvent | KeyboardEvent;
|
|
198
|
+
[REASONS.focusOut]: FocusEvent | KeyboardEvent;
|
|
199
|
+
[REASONS.escapeKey]: KeyboardEvent;
|
|
200
|
+
[REASONS.closeWatcher]: Event;
|
|
201
|
+
[REASONS.listNavigation]: KeyboardEvent;
|
|
202
|
+
[REASONS.keyboard]: KeyboardEvent;
|
|
203
|
+
[REASONS.pointer]: PointerEvent;
|
|
204
|
+
[REASONS.drag]: PointerEvent | TouchEvent;
|
|
205
|
+
[REASONS.swipe]: PointerEvent | TouchEvent;
|
|
206
|
+
[REASONS.wheel]: WheelEvent;
|
|
207
|
+
[REASONS.scrub]: PointerEvent;
|
|
208
|
+
[REASONS.cancelOpen]: MouseEvent;
|
|
209
|
+
[REASONS.siblingOpen]: Event;
|
|
210
|
+
[REASONS.disabled]: Event;
|
|
211
|
+
[REASONS.missing]: Event;
|
|
212
|
+
[REASONS.initial]: Event;
|
|
213
|
+
[REASONS.imperativeAction]: Event;
|
|
214
|
+
[REASONS.windowResize]: UIEvent;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
declare const scrub: "scrub";
|
|
218
|
+
|
|
219
|
+
declare const siblingOpen: "sibling-open";
|
|
220
|
+
|
|
221
|
+
declare const swipe: "swipe";
|
|
3
222
|
|
|
4
223
|
export declare const ToggleGroup: React_2.ForwardRefExoticComponent<Omit<Omit<ToggleGroup_2.Props<string> & React_2.RefAttributes<HTMLDivElement>, "ref">, "className"> & {
|
|
5
224
|
className?: string | undefined;
|
|
6
225
|
} & React_2.RefAttributes<HTMLDivElement>>;
|
|
7
226
|
|
|
227
|
+
/**
|
|
228
|
+
* Provides a shared state to a series of toggle buttons.
|
|
229
|
+
*
|
|
230
|
+
* Documentation: [Base UI Toggle Group](https://base-ui.com/react/components/toggle-group)
|
|
231
|
+
*/
|
|
232
|
+
declare const ToggleGroup_2: {
|
|
233
|
+
<Value extends string>(props: ToggleGroup_2.Props<Value> & React_2.RefAttributes<HTMLDivElement>): React_2.JSX.Element;
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
declare namespace ToggleGroup_2 {
|
|
237
|
+
type State = ToggleGroupState;
|
|
238
|
+
type Props<Value extends string = string> = ToggleGroupProps<Value>;
|
|
239
|
+
type ChangeEventReason = ToggleGroupChangeEventReason;
|
|
240
|
+
type ChangeEventDetails = ToggleGroupChangeEventDetails;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
export declare type ToggleGroupChangeEventDetails = BaseUIChangeEventDetails<ToggleGroup_2.ChangeEventReason>;
|
|
244
|
+
|
|
245
|
+
export declare type ToggleGroupChangeEventReason = typeof REASONS.none;
|
|
246
|
+
|
|
247
|
+
export declare interface ToggleGroupProps<Value extends string> extends BaseUIComponentProps<'div', ToggleGroupState> {
|
|
248
|
+
/**
|
|
249
|
+
* The pressed state of the toggle group represented by an array of
|
|
250
|
+
* the values of all pressed toggle buttons.
|
|
251
|
+
* This is the controlled counterpart of `defaultValue`.
|
|
252
|
+
*/
|
|
253
|
+
value?: readonly Value[] | undefined;
|
|
254
|
+
/**
|
|
255
|
+
* The pressed state of the toggle group represented by an array of
|
|
256
|
+
* the values of all pressed toggle buttons.
|
|
257
|
+
* This is the uncontrolled counterpart of `value`.
|
|
258
|
+
*/
|
|
259
|
+
defaultValue?: readonly Value[] | undefined;
|
|
260
|
+
/**
|
|
261
|
+
* Callback fired when the pressed states of the toggle group changes.
|
|
262
|
+
*/
|
|
263
|
+
onValueChange?: ((groupValue: Value[], eventDetails: ToggleGroup_2.ChangeEventDetails) => void) | undefined;
|
|
264
|
+
/**
|
|
265
|
+
* Whether the toggle group should ignore user interaction.
|
|
266
|
+
* @default false
|
|
267
|
+
*/
|
|
268
|
+
disabled?: boolean | undefined;
|
|
269
|
+
/**
|
|
270
|
+
* @default 'horizontal'
|
|
271
|
+
*/
|
|
272
|
+
orientation?: Orientation | undefined;
|
|
273
|
+
/**
|
|
274
|
+
* Whether to loop keyboard focus back to the first item
|
|
275
|
+
* when the end of the list is reached while using the arrow keys.
|
|
276
|
+
* @default true
|
|
277
|
+
*/
|
|
278
|
+
loopFocus?: boolean | undefined;
|
|
279
|
+
/**
|
|
280
|
+
* When `false` only one item in the group can be pressed. If any item in
|
|
281
|
+
* the group becomes pressed, the others will become unpressed.
|
|
282
|
+
* When `true` multiple items can be pressed.
|
|
283
|
+
* @default false
|
|
284
|
+
*/
|
|
285
|
+
multiple?: boolean | undefined;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
export declare interface ToggleGroupState {
|
|
289
|
+
/**
|
|
290
|
+
* Whether the component should ignore user interaction.
|
|
291
|
+
*/
|
|
292
|
+
disabled: boolean;
|
|
293
|
+
/**
|
|
294
|
+
* When `false` only one item in the group can be pressed. If any item in
|
|
295
|
+
* the group becomes pressed, the others will become unpressed.
|
|
296
|
+
* When `true` multiple items can be pressed.
|
|
297
|
+
* @default false
|
|
298
|
+
*/
|
|
299
|
+
multiple: boolean;
|
|
300
|
+
/**
|
|
301
|
+
* The orientation of the toggle group.
|
|
302
|
+
*/
|
|
303
|
+
orientation: Orientation;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
declare const trackPress: "track-press";
|
|
307
|
+
|
|
308
|
+
declare const triggerFocus: "trigger-focus";
|
|
309
|
+
|
|
310
|
+
declare const triggerHover: "trigger-hover";
|
|
311
|
+
|
|
312
|
+
declare const triggerPress: "trigger-press";
|
|
313
|
+
|
|
314
|
+
declare const wheel: "wheel";
|
|
315
|
+
|
|
316
|
+
declare const windowResize: "window-resize";
|
|
317
|
+
|
|
318
|
+
/**
|
|
319
|
+
* Adds a `preventBaseUIHandler` method to all event handlers.
|
|
320
|
+
*/
|
|
321
|
+
declare type WithBaseUIEvent<T> = { [K in keyof T]: WithPreventBaseUIHandler<T[K]> };
|
|
8
322
|
|
|
9
|
-
|
|
323
|
+
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
324
|
|
|
11
325
|
export { }
|
|
@@ -1,13 +1,112 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { ToggleGroup } from "@base-ui/react/toggle-group";
|
|
3
2
|
import clsx from "clsx";
|
|
3
|
+
import { useToolbarRootContext } from "../6107.js";
|
|
4
|
+
import { useControlled } from "../8527.js";
|
|
5
|
+
import { EMPTY_ARRAY, useRenderElement } from "../8272.js";
|
|
6
|
+
import { useStableCallback } from "../7541.js";
|
|
7
|
+
import { ToggleGroupContext } from "../7725.js";
|
|
8
|
+
import { CompositeRoot } from "../9087.js";
|
|
4
9
|
import * as __rspack_external_react from "react";
|
|
10
|
+
let ToggleGroupDataAttributes_ToggleGroupDataAttributes = /*#__PURE__*/ function(ToggleGroupDataAttributes) {
|
|
11
|
+
ToggleGroupDataAttributes["disabled"] = "data-disabled";
|
|
12
|
+
ToggleGroupDataAttributes["orientation"] = "data-orientation";
|
|
13
|
+
ToggleGroupDataAttributes["multiple"] = "data-multiple";
|
|
14
|
+
return ToggleGroupDataAttributes;
|
|
15
|
+
}({});
|
|
16
|
+
const stateAttributesMapping = {
|
|
17
|
+
multiple (value) {
|
|
18
|
+
if (value) return {
|
|
19
|
+
[ToggleGroupDataAttributes_ToggleGroupDataAttributes.multiple]: ''
|
|
20
|
+
};
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
const ToggleGroup_ToggleGroup = /*#__PURE__*/ __rspack_external_react.forwardRef(function(componentProps, forwardedRef) {
|
|
25
|
+
const { defaultValue: defaultValueProp, disabled: disabledProp = false, loopFocus = true, onValueChange, orientation = 'horizontal', multiple = false, value: valueProp, className, render, style, ...elementProps } = componentProps;
|
|
26
|
+
const toolbarContext = useToolbarRootContext(true);
|
|
27
|
+
const isValueInitialized = __rspack_external_react.useMemo(()=>void 0 !== valueProp || void 0 !== defaultValueProp, [
|
|
28
|
+
valueProp,
|
|
29
|
+
defaultValueProp
|
|
30
|
+
]);
|
|
31
|
+
const disabled = (toolbarContext?.disabled ?? false) || disabledProp;
|
|
32
|
+
const [groupValue, setValueState] = useControlled({
|
|
33
|
+
controlled: valueProp,
|
|
34
|
+
default: void 0 === valueProp ? defaultValueProp ?? EMPTY_ARRAY : void 0,
|
|
35
|
+
name: 'ToggleGroup',
|
|
36
|
+
state: 'value'
|
|
37
|
+
});
|
|
38
|
+
const setGroupValue = useStableCallback((newValue, nextPressed, eventDetails)=>{
|
|
39
|
+
let newGroupValue;
|
|
40
|
+
if (multiple) {
|
|
41
|
+
newGroupValue = groupValue.slice();
|
|
42
|
+
if (nextPressed) newGroupValue.push(newValue);
|
|
43
|
+
else newGroupValue.splice(groupValue.indexOf(newValue), 1);
|
|
44
|
+
} else newGroupValue = nextPressed ? [
|
|
45
|
+
newValue
|
|
46
|
+
] : [];
|
|
47
|
+
onValueChange?.(newGroupValue, eventDetails);
|
|
48
|
+
if (eventDetails.isCanceled) return;
|
|
49
|
+
setValueState(newGroupValue);
|
|
50
|
+
});
|
|
51
|
+
const state = {
|
|
52
|
+
disabled,
|
|
53
|
+
multiple,
|
|
54
|
+
orientation
|
|
55
|
+
};
|
|
56
|
+
const contextValue = __rspack_external_react.useMemo(()=>({
|
|
57
|
+
disabled,
|
|
58
|
+
orientation,
|
|
59
|
+
setGroupValue,
|
|
60
|
+
value: groupValue,
|
|
61
|
+
isValueInitialized
|
|
62
|
+
}), [
|
|
63
|
+
disabled,
|
|
64
|
+
orientation,
|
|
65
|
+
setGroupValue,
|
|
66
|
+
groupValue,
|
|
67
|
+
isValueInitialized
|
|
68
|
+
]);
|
|
69
|
+
const defaultProps = {
|
|
70
|
+
role: 'group'
|
|
71
|
+
};
|
|
72
|
+
const element = useRenderElement('div', componentProps, {
|
|
73
|
+
enabled: Boolean(toolbarContext),
|
|
74
|
+
state,
|
|
75
|
+
ref: forwardedRef,
|
|
76
|
+
props: [
|
|
77
|
+
defaultProps,
|
|
78
|
+
elementProps
|
|
79
|
+
],
|
|
80
|
+
stateAttributesMapping: stateAttributesMapping
|
|
81
|
+
});
|
|
82
|
+
return /*#__PURE__*/ jsx(ToggleGroupContext.Provider, {
|
|
83
|
+
value: contextValue,
|
|
84
|
+
children: toolbarContext ? element : /*#__PURE__*/ jsx(CompositeRoot, {
|
|
85
|
+
render: render,
|
|
86
|
+
className: className,
|
|
87
|
+
style: style,
|
|
88
|
+
state: state,
|
|
89
|
+
refs: [
|
|
90
|
+
forwardedRef
|
|
91
|
+
],
|
|
92
|
+
props: [
|
|
93
|
+
defaultProps,
|
|
94
|
+
elementProps
|
|
95
|
+
],
|
|
96
|
+
stateAttributesMapping: stateAttributesMapping,
|
|
97
|
+
loopFocus: loopFocus,
|
|
98
|
+
enableHomeAndEndKeys: true,
|
|
99
|
+
orientation: orientation
|
|
100
|
+
})
|
|
101
|
+
});
|
|
102
|
+
});
|
|
103
|
+
if ("production" !== process.env.NODE_ENV) ToggleGroup_ToggleGroup.displayName = "ToggleGroup";
|
|
5
104
|
const ToggleGroup_module = {
|
|
6
105
|
root: "root-JZaWem"
|
|
7
106
|
};
|
|
8
|
-
const
|
|
107
|
+
const ToggleGroup_ToggleGroup_ToggleGroup = /*#__PURE__*/ __rspack_external_react.forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ jsx(ToggleGroup_ToggleGroup, {
|
|
9
108
|
ref: ref,
|
|
10
109
|
className: clsx(ToggleGroup_module.root, className),
|
|
11
110
|
...props
|
|
12
111
|
}));
|
|
13
|
-
export {
|
|
112
|
+
export { ToggleGroup_ToggleGroup_ToggleGroup as ToggleGroup };
|