@1771technologies/lytenyte-pro 0.0.42 → 0.0.43
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/CompositeList-CGRaS6LQ.js +149 -0
- package/dist/DirectionContext-DIPP5cAe.js +15 -0
- package/dist/InternalBackdrop-C4RACVzs.js +324 -0
- package/dist/{anchor-context-B9sGQdR5.js → PopoverPortalContext-BdsDjihw.js} +4 -13
- package/dist/anchor-context-Cqr_oiJt.js +11 -0
- package/dist/column-manager.js +5 -3
- package/dist/{MenuRoot-9n64jNWP.js → column-menu-driver-cG-EZgLa.js} +49 -282
- package/dist/dialog.js +3 -3
- package/dist/{use-grid-DKvzGZWc.js → drag-store-CO3z13Ju.js} +34 -44
- package/dist/filter-manager.js +3 -2
- package/dist/index.js +97 -120
- package/dist/lytenyte-pro.css +9 -0
- package/dist/menu-CkfZmNR3.js +1879 -0
- package/dist/menu.js +2 -1637
- package/dist/{pill-C4Jhdf8E.js → pill-gga9iHqS.js} +44 -49
- package/dist/pill-manager.js +73 -10
- package/dist/popover.js +30 -5
- package/dist/{InternalBackdrop-Dm9czgoC.js → proptypes-BjYr2nFr.js} +25 -299
- package/dist/{select-C6xOZZLq.js → select-qluHi8ET.js} +7 -7
- package/dist/sort-manager.js +2 -2
- package/dist/types/menu/menu-impl.d.ts +1 -1
- package/dist/types/menu/menu.d.ts +1 -1
- package/dist/types/menu-frame/menu-frame-driver.d.ts +1 -0
- package/dist/types/pill-manager/pill-manager-impl.d.ts +1 -0
- package/dist/types/pill-manager/pill-manager-pill.d.ts +1 -0
- package/dist/{useAnchorPositioning-Cm44rb7y.js → useAnchorPositioning-52zK7jlD.js} +2 -13
- package/dist/{useButton-Cy7tjZ__.js → useButton-DWXzFgcr.js} +2 -1
- package/dist/{useScrollLock-D6h5lZYs.js → useScrollLock-D4UY33Sb.js} +15 -105
- package/package.json +15 -15
- package/dist/arrow-svg-evmXDI_J.js +0 -29
- package/dist/useBaseUiId-J66PFGv_.js +0 -48
- package/dist/useCompositeListItem-I14CpQPi.js +0 -51
- /package/dist/types/{popover → anchor-context}/anchor-context.d.ts +0 -0
package/dist/menu.js
CHANGED
|
@@ -1,1639 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import * as React from "react";
|
|
3
|
-
import { useMemo, forwardRef } from "react";
|
|
4
|
-
import { clsx } from "@1771technologies/js-utils";
|
|
5
|
-
import { A as ArrowSvg } from "./arrow-svg-evmXDI_J.js";
|
|
6
|
-
import { A as ArrowRightIcon, T as TickmarkIcon } from "./tickmark-icon-CoogRMoO.js";
|
|
7
|
-
import { k as useForkRef, v as useComponentRenderer, w as popupStateMapping, P as PropTypes, m as mergeProps, p as useFloatingTree, y as useOpenChangeComplete, u as useEnhancedEffect, M as FloatingFocusManager, j as useEventCallback, R as triggerOpenStateMapping } from "./InternalBackdrop-Dm9czgoC.js";
|
|
8
|
-
import { u as useMenuRootContext, c as useMenuPositionerContext, M as MenuRoot, a as MenuPortal, b as MenuPositioner } from "./MenuRoot-9n64jNWP.js";
|
|
9
|
-
import { t as transitionStatusMapping, u as useBaseUiId } from "./useBaseUiId-J66PFGv_.js";
|
|
10
|
-
import { u as useButton } from "./useButton-Cy7tjZ__.js";
|
|
11
|
-
import { u as useCompositeListItem } from "./useCompositeListItem-I14CpQPi.js";
|
|
12
|
-
import { a as useControlled, b as useTransitionStatus } from "./useScrollLock-D6h5lZYs.js";
|
|
13
|
-
const MenuArrow$1 = /* @__PURE__ */ React.forwardRef(function MenuArrow(props, forwardedRef) {
|
|
14
|
-
const {
|
|
15
|
-
className,
|
|
16
|
-
render,
|
|
17
|
-
...otherProps
|
|
18
|
-
} = props;
|
|
19
|
-
const {
|
|
20
|
-
open
|
|
21
|
-
} = useMenuRootContext();
|
|
22
|
-
const {
|
|
23
|
-
arrowRef,
|
|
24
|
-
side,
|
|
25
|
-
align,
|
|
26
|
-
arrowUncentered,
|
|
27
|
-
arrowStyles
|
|
28
|
-
} = useMenuPositionerContext();
|
|
29
|
-
const state2 = React.useMemo(() => ({
|
|
30
|
-
open,
|
|
31
|
-
side,
|
|
32
|
-
align,
|
|
33
|
-
uncentered: arrowUncentered
|
|
34
|
-
}), [open, side, align, arrowUncentered]);
|
|
35
|
-
const mergedRef = useForkRef(arrowRef, forwardedRef);
|
|
36
|
-
const {
|
|
37
|
-
renderElement
|
|
38
|
-
} = useComponentRenderer({
|
|
39
|
-
render: render ?? "div",
|
|
40
|
-
className,
|
|
41
|
-
state: state2,
|
|
42
|
-
ref: mergedRef,
|
|
43
|
-
extraProps: {
|
|
44
|
-
style: arrowStyles,
|
|
45
|
-
"aria-hidden": true,
|
|
46
|
-
...otherProps
|
|
47
|
-
},
|
|
48
|
-
customStyleHookMapping: popupStateMapping
|
|
49
|
-
});
|
|
50
|
-
return renderElement();
|
|
51
|
-
});
|
|
52
|
-
process.env.NODE_ENV !== "production" ? MenuArrow$1.propTypes = {
|
|
53
|
-
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
54
|
-
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
55
|
-
// │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
|
|
56
|
-
// └─────────────────────────────────────────────────────────────────────┘
|
|
57
|
-
/**
|
|
58
|
-
* @ignore
|
|
59
|
-
*/
|
|
60
|
-
children: PropTypes.node,
|
|
61
|
-
/**
|
|
62
|
-
* CSS class applied to the element, or a function that
|
|
63
|
-
* returns a class based on the component’s state.
|
|
64
|
-
*/
|
|
65
|
-
className: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
|
|
66
|
-
/**
|
|
67
|
-
* Allows you to replace the component’s HTML element
|
|
68
|
-
* with a different tag, or compose it with another component.
|
|
69
|
-
*
|
|
70
|
-
* Accepts a `ReactElement` or a function that returns the element to render.
|
|
71
|
-
*/
|
|
72
|
-
render: PropTypes.oneOfType([PropTypes.element, PropTypes.func])
|
|
73
|
-
} : void 0;
|
|
74
|
-
function useMenuItem(params) {
|
|
75
|
-
const {
|
|
76
|
-
closeOnClick,
|
|
77
|
-
disabled = false,
|
|
78
|
-
highlighted,
|
|
79
|
-
id,
|
|
80
|
-
menuEvents,
|
|
81
|
-
ref: externalRef,
|
|
82
|
-
allowMouseUpTriggerRef,
|
|
83
|
-
typingRef
|
|
84
|
-
} = params;
|
|
85
|
-
const itemRef = React.useRef(null);
|
|
86
|
-
const {
|
|
87
|
-
getButtonProps,
|
|
88
|
-
buttonRef: mergedRef
|
|
89
|
-
} = useButton({
|
|
90
|
-
disabled,
|
|
91
|
-
focusableWhenDisabled: true,
|
|
92
|
-
buttonRef: useForkRef(externalRef, itemRef)
|
|
93
|
-
});
|
|
94
|
-
const getItemProps = React.useCallback((externalProps) => {
|
|
95
|
-
return mergeProps({
|
|
96
|
-
id,
|
|
97
|
-
role: "menuitem",
|
|
98
|
-
tabIndex: highlighted ? 0 : -1,
|
|
99
|
-
onKeyUp: (event) => {
|
|
100
|
-
if (event.key === " " && typingRef.current) {
|
|
101
|
-
event.preventBaseUIHandler();
|
|
102
|
-
}
|
|
103
|
-
},
|
|
104
|
-
onClick: (event) => {
|
|
105
|
-
if (closeOnClick) {
|
|
106
|
-
menuEvents.emit("close", event);
|
|
107
|
-
}
|
|
108
|
-
},
|
|
109
|
-
onMouseUp: (event) => {
|
|
110
|
-
if (itemRef.current && allowMouseUpTriggerRef.current) {
|
|
111
|
-
itemRef.current.click();
|
|
112
|
-
menuEvents.emit("close", event);
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
}, externalProps, getButtonProps);
|
|
116
|
-
}, [getButtonProps, id, highlighted, typingRef, closeOnClick, menuEvents, allowMouseUpTriggerRef]);
|
|
117
|
-
return React.useMemo(() => ({
|
|
118
|
-
getItemProps,
|
|
119
|
-
rootRef: mergedRef
|
|
120
|
-
}), [getItemProps, mergedRef]);
|
|
121
|
-
}
|
|
122
|
-
function useMenuCheckboxItem(params) {
|
|
123
|
-
const {
|
|
124
|
-
checked: checkedProp,
|
|
125
|
-
defaultChecked,
|
|
126
|
-
onCheckedChange,
|
|
127
|
-
...other
|
|
128
|
-
} = params;
|
|
129
|
-
const [checked, setChecked] = useControlled({
|
|
130
|
-
controlled: checkedProp,
|
|
131
|
-
default: defaultChecked ?? false,
|
|
132
|
-
name: "MenuCheckboxItem",
|
|
133
|
-
state: "checked"
|
|
134
|
-
});
|
|
135
|
-
const {
|
|
136
|
-
getItemProps: getMenuItemProps,
|
|
137
|
-
...menuItem
|
|
138
|
-
} = useMenuItem(other);
|
|
139
|
-
const getItemProps = React.useCallback((externalProps) => {
|
|
140
|
-
return mergeProps({
|
|
141
|
-
role: "menuitemcheckbox",
|
|
142
|
-
"aria-checked": checked,
|
|
143
|
-
onClick: (event) => {
|
|
144
|
-
setChecked((currentlyChecked) => !currentlyChecked);
|
|
145
|
-
onCheckedChange?.(!checked, event.nativeEvent);
|
|
146
|
-
}
|
|
147
|
-
}, externalProps, getMenuItemProps);
|
|
148
|
-
}, [checked, getMenuItemProps, onCheckedChange, setChecked]);
|
|
149
|
-
return React.useMemo(() => ({
|
|
150
|
-
...menuItem,
|
|
151
|
-
getItemProps,
|
|
152
|
-
checked
|
|
153
|
-
}), [checked, getItemProps, menuItem]);
|
|
154
|
-
}
|
|
155
|
-
const MenuCheckboxItemContext = /* @__PURE__ */ React.createContext(void 0);
|
|
156
|
-
function useMenuCheckboxItemContext() {
|
|
157
|
-
const context = React.useContext(MenuCheckboxItemContext);
|
|
158
|
-
if (context === void 0) {
|
|
159
|
-
throw new Error("Base UI: MenuCheckboxItemContext is missing. MenuCheckboxItem parts must be placed within <Menu.CheckboxItem>.");
|
|
160
|
-
}
|
|
161
|
-
return context;
|
|
162
|
-
}
|
|
163
|
-
const itemMapping = {
|
|
164
|
-
checked(value) {
|
|
165
|
-
if (value) {
|
|
166
|
-
return {
|
|
167
|
-
"data-checked": ""
|
|
168
|
-
};
|
|
169
|
-
}
|
|
170
|
-
return {
|
|
171
|
-
"data-unchecked": ""
|
|
172
|
-
};
|
|
173
|
-
},
|
|
174
|
-
...transitionStatusMapping
|
|
175
|
-
};
|
|
176
|
-
const InnerMenuCheckboxItem = /* @__PURE__ */ React.forwardRef(function InnerMenuItem(props, forwardedRef) {
|
|
177
|
-
const {
|
|
178
|
-
checked: checkedProp,
|
|
179
|
-
defaultChecked,
|
|
180
|
-
onCheckedChange,
|
|
181
|
-
className,
|
|
182
|
-
closeOnClick,
|
|
183
|
-
disabled = false,
|
|
184
|
-
highlighted,
|
|
185
|
-
id,
|
|
186
|
-
menuEvents,
|
|
187
|
-
itemProps,
|
|
188
|
-
render,
|
|
189
|
-
allowMouseUpTriggerRef,
|
|
190
|
-
typingRef,
|
|
191
|
-
...other
|
|
192
|
-
} = props;
|
|
193
|
-
const {
|
|
194
|
-
getItemProps,
|
|
195
|
-
checked
|
|
196
|
-
} = useMenuCheckboxItem({
|
|
197
|
-
closeOnClick,
|
|
198
|
-
disabled,
|
|
199
|
-
highlighted,
|
|
200
|
-
id,
|
|
201
|
-
menuEvents,
|
|
202
|
-
ref: forwardedRef,
|
|
203
|
-
allowMouseUpTriggerRef,
|
|
204
|
-
checked: checkedProp,
|
|
205
|
-
defaultChecked,
|
|
206
|
-
onCheckedChange,
|
|
207
|
-
typingRef
|
|
208
|
-
});
|
|
209
|
-
const state2 = React.useMemo(() => ({
|
|
210
|
-
disabled,
|
|
211
|
-
highlighted,
|
|
212
|
-
checked
|
|
213
|
-
}), [disabled, highlighted, checked]);
|
|
214
|
-
const {
|
|
215
|
-
renderElement
|
|
216
|
-
} = useComponentRenderer({
|
|
217
|
-
render: render || "div",
|
|
218
|
-
className,
|
|
219
|
-
state: state2,
|
|
220
|
-
propGetter: (externalProps) => mergeProps(itemProps, externalProps, getItemProps),
|
|
221
|
-
customStyleHookMapping: itemMapping,
|
|
222
|
-
extraProps: other
|
|
223
|
-
});
|
|
224
|
-
return /* @__PURE__ */ jsx(MenuCheckboxItemContext.Provider, {
|
|
225
|
-
value: state2,
|
|
226
|
-
children: renderElement()
|
|
227
|
-
});
|
|
228
|
-
});
|
|
229
|
-
process.env.NODE_ENV !== "production" ? InnerMenuCheckboxItem.propTypes = {
|
|
230
|
-
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
231
|
-
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
232
|
-
// │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
|
|
233
|
-
// └─────────────────────────────────────────────────────────────────────┘
|
|
234
|
-
/**
|
|
235
|
-
* @ignore
|
|
236
|
-
*/
|
|
237
|
-
allowMouseUpTriggerRef: PropTypes.shape({
|
|
238
|
-
current: PropTypes.bool.isRequired
|
|
239
|
-
}).isRequired,
|
|
240
|
-
/**
|
|
241
|
-
* Whether the checkbox item is currently ticked.
|
|
242
|
-
*
|
|
243
|
-
* To render an uncontrolled checkbox item, use the `defaultChecked` prop instead.
|
|
244
|
-
*/
|
|
245
|
-
checked: PropTypes.bool,
|
|
246
|
-
/**
|
|
247
|
-
* @ignore
|
|
248
|
-
*/
|
|
249
|
-
children: PropTypes.node,
|
|
250
|
-
/**
|
|
251
|
-
* CSS class applied to the element, or a function that
|
|
252
|
-
* returns a class based on the component’s state.
|
|
253
|
-
*/
|
|
254
|
-
className: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
|
|
255
|
-
/**
|
|
256
|
-
* Whether to close the menu when the item is clicked.
|
|
257
|
-
*/
|
|
258
|
-
closeOnClick: PropTypes.bool.isRequired,
|
|
259
|
-
/**
|
|
260
|
-
* Whether the checkbox item is initially ticked.
|
|
261
|
-
*
|
|
262
|
-
* To render a controlled checkbox item, use the `checked` prop instead.
|
|
263
|
-
* @default false
|
|
264
|
-
*/
|
|
265
|
-
defaultChecked: PropTypes.bool,
|
|
266
|
-
/**
|
|
267
|
-
* Whether the component should ignore user interaction.
|
|
268
|
-
* @default false
|
|
269
|
-
*/
|
|
270
|
-
disabled: PropTypes.bool,
|
|
271
|
-
/**
|
|
272
|
-
* @ignore
|
|
273
|
-
*/
|
|
274
|
-
highlighted: PropTypes.bool.isRequired,
|
|
275
|
-
/**
|
|
276
|
-
* @ignore
|
|
277
|
-
*/
|
|
278
|
-
id: PropTypes.string,
|
|
279
|
-
/**
|
|
280
|
-
* @ignore
|
|
281
|
-
*/
|
|
282
|
-
itemProps: PropTypes.object.isRequired,
|
|
283
|
-
/**
|
|
284
|
-
* Overrides the text label to use when the item is matched during keyboard text navigation.
|
|
285
|
-
*/
|
|
286
|
-
label: PropTypes.string,
|
|
287
|
-
/**
|
|
288
|
-
* @ignore
|
|
289
|
-
*/
|
|
290
|
-
menuEvents: PropTypes.shape({
|
|
291
|
-
emit: PropTypes.func.isRequired,
|
|
292
|
-
off: PropTypes.func.isRequired,
|
|
293
|
-
on: PropTypes.func.isRequired
|
|
294
|
-
}).isRequired,
|
|
295
|
-
/**
|
|
296
|
-
* Event handler called when the checkbox item is ticked or unticked.
|
|
297
|
-
*/
|
|
298
|
-
onCheckedChange: PropTypes.func,
|
|
299
|
-
/**
|
|
300
|
-
* The click handler for the menu item.
|
|
301
|
-
*/
|
|
302
|
-
onClick: PropTypes.func,
|
|
303
|
-
/**
|
|
304
|
-
* Allows you to replace the component’s HTML element
|
|
305
|
-
* with a different tag, or compose it with another component.
|
|
306
|
-
*
|
|
307
|
-
* Accepts a `ReactElement` or a function that returns the element to render.
|
|
308
|
-
*/
|
|
309
|
-
render: PropTypes.oneOfType([PropTypes.element, PropTypes.func]),
|
|
310
|
-
/**
|
|
311
|
-
* @ignore
|
|
312
|
-
*/
|
|
313
|
-
typingRef: PropTypes.shape({
|
|
314
|
-
current: PropTypes.bool.isRequired
|
|
315
|
-
}).isRequired
|
|
316
|
-
} : void 0;
|
|
317
|
-
const MemoizedInnerMenuCheckboxItem = /* @__PURE__ */ React.memo(InnerMenuCheckboxItem);
|
|
318
|
-
const MenuCheckboxItem$1 = /* @__PURE__ */ React.forwardRef(function MenuCheckboxItem(props, forwardedRef) {
|
|
319
|
-
const {
|
|
320
|
-
id: idProp,
|
|
321
|
-
label,
|
|
322
|
-
closeOnClick = false,
|
|
323
|
-
...other
|
|
324
|
-
} = props;
|
|
325
|
-
const itemRef = React.useRef(null);
|
|
326
|
-
const listItem = useCompositeListItem({
|
|
327
|
-
label
|
|
328
|
-
});
|
|
329
|
-
const mergedRef = useForkRef(forwardedRef, listItem.ref, itemRef);
|
|
330
|
-
const {
|
|
331
|
-
itemProps,
|
|
332
|
-
activeIndex,
|
|
333
|
-
allowMouseUpTriggerRef,
|
|
334
|
-
typingRef
|
|
335
|
-
} = useMenuRootContext();
|
|
336
|
-
const id = useBaseUiId(idProp);
|
|
337
|
-
const highlighted = listItem.index === activeIndex;
|
|
338
|
-
const {
|
|
339
|
-
events: menuEvents
|
|
340
|
-
} = useFloatingTree();
|
|
341
|
-
return /* @__PURE__ */ jsx(MemoizedInnerMenuCheckboxItem, {
|
|
342
|
-
...other,
|
|
343
|
-
id,
|
|
344
|
-
ref: mergedRef,
|
|
345
|
-
highlighted,
|
|
346
|
-
menuEvents,
|
|
347
|
-
itemProps,
|
|
348
|
-
allowMouseUpTriggerRef,
|
|
349
|
-
typingRef,
|
|
350
|
-
closeOnClick
|
|
351
|
-
});
|
|
352
|
-
});
|
|
353
|
-
process.env.NODE_ENV !== "production" ? MenuCheckboxItem$1.propTypes = {
|
|
354
|
-
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
355
|
-
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
356
|
-
// │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
|
|
357
|
-
// └─────────────────────────────────────────────────────────────────────┘
|
|
358
|
-
/**
|
|
359
|
-
* Whether the checkbox item is currently ticked.
|
|
360
|
-
*
|
|
361
|
-
* To render an uncontrolled checkbox item, use the `defaultChecked` prop instead.
|
|
362
|
-
*/
|
|
363
|
-
checked: PropTypes.bool,
|
|
364
|
-
/**
|
|
365
|
-
* @ignore
|
|
366
|
-
*/
|
|
367
|
-
children: PropTypes.node,
|
|
368
|
-
/**
|
|
369
|
-
* CSS class applied to the element, or a function that
|
|
370
|
-
* returns a class based on the component’s state.
|
|
371
|
-
*/
|
|
372
|
-
className: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
|
|
373
|
-
/**
|
|
374
|
-
* Whether to close the menu when the item is clicked.
|
|
375
|
-
* @default false
|
|
376
|
-
*/
|
|
377
|
-
closeOnClick: PropTypes.bool,
|
|
378
|
-
/**
|
|
379
|
-
* Whether the checkbox item is initially ticked.
|
|
380
|
-
*
|
|
381
|
-
* To render a controlled checkbox item, use the `checked` prop instead.
|
|
382
|
-
* @default false
|
|
383
|
-
*/
|
|
384
|
-
defaultChecked: PropTypes.bool,
|
|
385
|
-
/**
|
|
386
|
-
* Whether the component should ignore user interaction.
|
|
387
|
-
* @default false
|
|
388
|
-
*/
|
|
389
|
-
disabled: PropTypes.bool,
|
|
390
|
-
/**
|
|
391
|
-
* @ignore
|
|
392
|
-
*/
|
|
393
|
-
id: PropTypes.string,
|
|
394
|
-
/**
|
|
395
|
-
* Overrides the text label to use when the item is matched during keyboard text navigation.
|
|
396
|
-
*/
|
|
397
|
-
label: PropTypes.string,
|
|
398
|
-
/**
|
|
399
|
-
* Event handler called when the checkbox item is ticked or unticked.
|
|
400
|
-
*/
|
|
401
|
-
onCheckedChange: PropTypes.func,
|
|
402
|
-
/**
|
|
403
|
-
* The click handler for the menu item.
|
|
404
|
-
*/
|
|
405
|
-
onClick: PropTypes.func,
|
|
406
|
-
/**
|
|
407
|
-
* Allows you to replace the component’s HTML element
|
|
408
|
-
* with a different tag, or compose it with another component.
|
|
409
|
-
*
|
|
410
|
-
* Accepts a `ReactElement` or a function that returns the element to render.
|
|
411
|
-
*/
|
|
412
|
-
render: PropTypes.oneOfType([PropTypes.element, PropTypes.func])
|
|
413
|
-
} : void 0;
|
|
414
|
-
const MenuCheckboxItemIndicator$1 = /* @__PURE__ */ React.forwardRef(function MenuCheckboxItemIndicator(props, forwardedRef) {
|
|
415
|
-
const {
|
|
416
|
-
render,
|
|
417
|
-
className,
|
|
418
|
-
keepMounted = false,
|
|
419
|
-
...other
|
|
420
|
-
} = props;
|
|
421
|
-
const item = useMenuCheckboxItemContext();
|
|
422
|
-
const indicatorRef = React.useRef(null);
|
|
423
|
-
const mergedRef = useForkRef(forwardedRef, indicatorRef);
|
|
424
|
-
const {
|
|
425
|
-
transitionStatus,
|
|
426
|
-
setMounted
|
|
427
|
-
} = useTransitionStatus(item.checked);
|
|
428
|
-
useOpenChangeComplete({
|
|
429
|
-
open: item.checked,
|
|
430
|
-
ref: indicatorRef,
|
|
431
|
-
onComplete() {
|
|
432
|
-
if (!item.checked) {
|
|
433
|
-
setMounted(false);
|
|
434
|
-
}
|
|
435
|
-
}
|
|
436
|
-
});
|
|
437
|
-
const state2 = React.useMemo(() => ({
|
|
438
|
-
checked: item.checked,
|
|
439
|
-
disabled: item.disabled,
|
|
440
|
-
highlighted: item.highlighted,
|
|
441
|
-
transitionStatus
|
|
442
|
-
}), [item.checked, item.disabled, item.highlighted, transitionStatus]);
|
|
443
|
-
const {
|
|
444
|
-
renderElement
|
|
445
|
-
} = useComponentRenderer({
|
|
446
|
-
render: render || "span",
|
|
447
|
-
className,
|
|
448
|
-
state: state2,
|
|
449
|
-
customStyleHookMapping: itemMapping,
|
|
450
|
-
extraProps: {
|
|
451
|
-
"aria-hidden": true,
|
|
452
|
-
...other
|
|
453
|
-
},
|
|
454
|
-
ref: mergedRef
|
|
455
|
-
});
|
|
456
|
-
const shouldRender = keepMounted || item.checked;
|
|
457
|
-
if (!shouldRender) {
|
|
458
|
-
return null;
|
|
459
|
-
}
|
|
460
|
-
return renderElement();
|
|
461
|
-
});
|
|
462
|
-
process.env.NODE_ENV !== "production" ? MenuCheckboxItemIndicator$1.propTypes = {
|
|
463
|
-
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
464
|
-
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
465
|
-
// │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
|
|
466
|
-
// └─────────────────────────────────────────────────────────────────────┘
|
|
467
|
-
/**
|
|
468
|
-
* @ignore
|
|
469
|
-
*/
|
|
470
|
-
children: PropTypes.node,
|
|
471
|
-
/**
|
|
472
|
-
* CSS class applied to the element, or a function that
|
|
473
|
-
* returns a class based on the component’s state.
|
|
474
|
-
*/
|
|
475
|
-
className: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
|
|
476
|
-
/**
|
|
477
|
-
* Whether to keep the HTML element in the DOM when the checkbox item is not checked.
|
|
478
|
-
* @default false
|
|
479
|
-
*/
|
|
480
|
-
keepMounted: PropTypes.bool,
|
|
481
|
-
/**
|
|
482
|
-
* Allows you to replace the component’s HTML element
|
|
483
|
-
* with a different tag, or compose it with another component.
|
|
484
|
-
*
|
|
485
|
-
* Accepts a `ReactElement` or a function that returns the element to render.
|
|
486
|
-
*/
|
|
487
|
-
render: PropTypes.oneOfType([PropTypes.element, PropTypes.func])
|
|
488
|
-
} : void 0;
|
|
489
|
-
const MenuGroupContext = /* @__PURE__ */ React.createContext(void 0);
|
|
490
|
-
if (process.env.NODE_ENV !== "production") {
|
|
491
|
-
MenuGroupContext.displayName = "MenuGroupContext";
|
|
492
|
-
}
|
|
493
|
-
function useMenuGroupRootContext() {
|
|
494
|
-
const context = React.useContext(MenuGroupContext);
|
|
495
|
-
if (context === void 0) {
|
|
496
|
-
throw new Error("Base UI: Missing MenuGroupRootContext provider");
|
|
497
|
-
}
|
|
498
|
-
return context;
|
|
499
|
-
}
|
|
500
|
-
const state$1 = {};
|
|
501
|
-
const MenuGroup$1 = /* @__PURE__ */ React.forwardRef(function MenuGroup(props, forwardedRef) {
|
|
502
|
-
const {
|
|
503
|
-
render,
|
|
504
|
-
className,
|
|
505
|
-
...other
|
|
506
|
-
} = props;
|
|
507
|
-
const [labelId, setLabelId] = React.useState(void 0);
|
|
508
|
-
const context = React.useMemo(() => ({
|
|
509
|
-
setLabelId
|
|
510
|
-
}), [setLabelId]);
|
|
511
|
-
const {
|
|
512
|
-
renderElement
|
|
513
|
-
} = useComponentRenderer({
|
|
514
|
-
render: render || "div",
|
|
515
|
-
className,
|
|
516
|
-
state: state$1,
|
|
517
|
-
extraProps: {
|
|
518
|
-
role: "group",
|
|
519
|
-
"aria-labelledby": labelId,
|
|
520
|
-
...other
|
|
521
|
-
},
|
|
522
|
-
ref: forwardedRef
|
|
523
|
-
});
|
|
524
|
-
return /* @__PURE__ */ jsx(MenuGroupContext.Provider, {
|
|
525
|
-
value: context,
|
|
526
|
-
children: renderElement()
|
|
527
|
-
});
|
|
528
|
-
});
|
|
529
|
-
process.env.NODE_ENV !== "production" ? MenuGroup$1.propTypes = {
|
|
530
|
-
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
531
|
-
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
532
|
-
// │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
|
|
533
|
-
// └─────────────────────────────────────────────────────────────────────┘
|
|
534
|
-
/**
|
|
535
|
-
* The content of the component.
|
|
536
|
-
*/
|
|
537
|
-
children: PropTypes.node,
|
|
538
|
-
/**
|
|
539
|
-
* CSS class applied to the element, or a function that
|
|
540
|
-
* returns a class based on the component’s state.
|
|
541
|
-
*/
|
|
542
|
-
className: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
|
|
543
|
-
/**
|
|
544
|
-
* Allows you to replace the component’s HTML element
|
|
545
|
-
* with a different tag, or compose it with another component.
|
|
546
|
-
*
|
|
547
|
-
* Accepts a `ReactElement` or a function that returns the element to render.
|
|
548
|
-
*/
|
|
549
|
-
render: PropTypes.oneOfType([PropTypes.element, PropTypes.func])
|
|
550
|
-
} : void 0;
|
|
551
|
-
const state = {};
|
|
552
|
-
const MenuGroupLabel$1 = /* @__PURE__ */ React.forwardRef(function MenuGroupLabelComponent(props, forwardedRef) {
|
|
553
|
-
const {
|
|
554
|
-
className,
|
|
555
|
-
render,
|
|
556
|
-
id: idProp,
|
|
557
|
-
...other
|
|
558
|
-
} = props;
|
|
559
|
-
const id = useBaseUiId(idProp);
|
|
560
|
-
const {
|
|
561
|
-
setLabelId
|
|
562
|
-
} = useMenuGroupRootContext();
|
|
563
|
-
useEnhancedEffect(() => {
|
|
564
|
-
setLabelId(id);
|
|
565
|
-
return () => {
|
|
566
|
-
setLabelId(void 0);
|
|
567
|
-
};
|
|
568
|
-
}, [setLabelId, id]);
|
|
569
|
-
const {
|
|
570
|
-
renderElement
|
|
571
|
-
} = useComponentRenderer({
|
|
572
|
-
render: render ?? "div",
|
|
573
|
-
className,
|
|
574
|
-
state,
|
|
575
|
-
extraProps: {
|
|
576
|
-
role: "presentation",
|
|
577
|
-
id,
|
|
578
|
-
...other
|
|
579
|
-
},
|
|
580
|
-
ref: forwardedRef
|
|
581
|
-
});
|
|
582
|
-
return renderElement();
|
|
583
|
-
});
|
|
584
|
-
process.env.NODE_ENV !== "production" ? MenuGroupLabel$1.propTypes = {
|
|
585
|
-
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
586
|
-
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
587
|
-
// │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
|
|
588
|
-
// └─────────────────────────────────────────────────────────────────────┘
|
|
589
|
-
/**
|
|
590
|
-
* @ignore
|
|
591
|
-
*/
|
|
592
|
-
children: PropTypes.node,
|
|
593
|
-
/**
|
|
594
|
-
* CSS class applied to the element, or a function that
|
|
595
|
-
* returns a class based on the component’s state.
|
|
596
|
-
*/
|
|
597
|
-
className: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
|
|
598
|
-
/**
|
|
599
|
-
* @ignore
|
|
600
|
-
*/
|
|
601
|
-
id: PropTypes.string,
|
|
602
|
-
/**
|
|
603
|
-
* Allows you to replace the component’s HTML element
|
|
604
|
-
* with a different tag, or compose it with another component.
|
|
605
|
-
*
|
|
606
|
-
* Accepts a `ReactElement` or a function that returns the element to render.
|
|
607
|
-
*/
|
|
608
|
-
render: PropTypes.oneOfType([PropTypes.element, PropTypes.func])
|
|
609
|
-
} : void 0;
|
|
610
|
-
const InnerMenuItem2 = /* @__PURE__ */ React.forwardRef(function InnerMenuItem3(props, forwardedRef) {
|
|
611
|
-
const {
|
|
612
|
-
className,
|
|
613
|
-
closeOnClick = true,
|
|
614
|
-
disabled = false,
|
|
615
|
-
highlighted,
|
|
616
|
-
id,
|
|
617
|
-
menuEvents,
|
|
618
|
-
itemProps,
|
|
619
|
-
render,
|
|
620
|
-
allowMouseUpTriggerRef,
|
|
621
|
-
typingRef,
|
|
622
|
-
...other
|
|
623
|
-
} = props;
|
|
624
|
-
const {
|
|
625
|
-
getItemProps
|
|
626
|
-
} = useMenuItem({
|
|
627
|
-
closeOnClick,
|
|
628
|
-
disabled,
|
|
629
|
-
highlighted,
|
|
630
|
-
id,
|
|
631
|
-
menuEvents,
|
|
632
|
-
ref: forwardedRef,
|
|
633
|
-
allowMouseUpTriggerRef,
|
|
634
|
-
typingRef
|
|
635
|
-
});
|
|
636
|
-
const state2 = React.useMemo(() => ({
|
|
637
|
-
disabled,
|
|
638
|
-
highlighted
|
|
639
|
-
}), [disabled, highlighted]);
|
|
640
|
-
const {
|
|
641
|
-
renderElement
|
|
642
|
-
} = useComponentRenderer({
|
|
643
|
-
render: render || "div",
|
|
644
|
-
className,
|
|
645
|
-
state: state2,
|
|
646
|
-
propGetter: (externalProps) => mergeProps(itemProps, externalProps, getItemProps),
|
|
647
|
-
extraProps: other
|
|
648
|
-
});
|
|
649
|
-
return renderElement();
|
|
650
|
-
});
|
|
651
|
-
const MemoizedInnerMenuItem = /* @__PURE__ */ React.memo(InnerMenuItem2);
|
|
652
|
-
process.env.NODE_ENV !== "production" ? InnerMenuItem2.propTypes = {
|
|
653
|
-
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
654
|
-
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
655
|
-
// │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
|
|
656
|
-
// └─────────────────────────────────────────────────────────────────────┘
|
|
657
|
-
/**
|
|
658
|
-
* @ignore
|
|
659
|
-
*/
|
|
660
|
-
allowMouseUpTriggerRef: PropTypes.shape({
|
|
661
|
-
current: PropTypes.bool.isRequired
|
|
662
|
-
}).isRequired,
|
|
663
|
-
/**
|
|
664
|
-
* @ignore
|
|
665
|
-
*/
|
|
666
|
-
children: PropTypes.node,
|
|
667
|
-
/**
|
|
668
|
-
* CSS class applied to the element, or a function that
|
|
669
|
-
* returns a class based on the component’s state.
|
|
670
|
-
*/
|
|
671
|
-
className: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
|
|
672
|
-
/**
|
|
673
|
-
* Whether to close the menu when the item is clicked.
|
|
674
|
-
*
|
|
675
|
-
* @default true
|
|
676
|
-
*/
|
|
677
|
-
closeOnClick: PropTypes.bool,
|
|
678
|
-
/**
|
|
679
|
-
* Whether the component should ignore user interaction.
|
|
680
|
-
* @default false
|
|
681
|
-
*/
|
|
682
|
-
disabled: PropTypes.bool,
|
|
683
|
-
/**
|
|
684
|
-
* @ignore
|
|
685
|
-
*/
|
|
686
|
-
highlighted: PropTypes.bool.isRequired,
|
|
687
|
-
/**
|
|
688
|
-
* @ignore
|
|
689
|
-
*/
|
|
690
|
-
id: PropTypes.string,
|
|
691
|
-
/**
|
|
692
|
-
* @ignore
|
|
693
|
-
*/
|
|
694
|
-
itemProps: PropTypes.object.isRequired,
|
|
695
|
-
/**
|
|
696
|
-
* Overrides the text label to use when the item is matched during keyboard text navigation.
|
|
697
|
-
*/
|
|
698
|
-
label: PropTypes.string,
|
|
699
|
-
/**
|
|
700
|
-
* @ignore
|
|
701
|
-
*/
|
|
702
|
-
menuEvents: PropTypes.shape({
|
|
703
|
-
emit: PropTypes.func.isRequired,
|
|
704
|
-
off: PropTypes.func.isRequired,
|
|
705
|
-
on: PropTypes.func.isRequired
|
|
706
|
-
}).isRequired,
|
|
707
|
-
/**
|
|
708
|
-
* The click handler for the menu item.
|
|
709
|
-
*/
|
|
710
|
-
onClick: PropTypes.func,
|
|
711
|
-
/**
|
|
712
|
-
* Allows you to replace the component’s HTML element
|
|
713
|
-
* with a different tag, or compose it with another component.
|
|
714
|
-
*
|
|
715
|
-
* Accepts a `ReactElement` or a function that returns the element to render.
|
|
716
|
-
*/
|
|
717
|
-
render: PropTypes.oneOfType([PropTypes.element, PropTypes.func]),
|
|
718
|
-
/**
|
|
719
|
-
* @ignore
|
|
720
|
-
*/
|
|
721
|
-
typingRef: PropTypes.shape({
|
|
722
|
-
current: PropTypes.bool.isRequired
|
|
723
|
-
}).isRequired
|
|
724
|
-
} : void 0;
|
|
725
|
-
const MenuItem$1 = /* @__PURE__ */ React.forwardRef(function MenuItem(props, forwardedRef) {
|
|
726
|
-
const {
|
|
727
|
-
id: idProp,
|
|
728
|
-
label,
|
|
729
|
-
...other
|
|
730
|
-
} = props;
|
|
731
|
-
const itemRef = React.useRef(null);
|
|
732
|
-
const listItem = useCompositeListItem({
|
|
733
|
-
label
|
|
734
|
-
});
|
|
735
|
-
const mergedRef = useForkRef(forwardedRef, listItem.ref, itemRef);
|
|
736
|
-
const {
|
|
737
|
-
itemProps,
|
|
738
|
-
activeIndex,
|
|
739
|
-
allowMouseUpTriggerRef,
|
|
740
|
-
typingRef
|
|
741
|
-
} = useMenuRootContext();
|
|
742
|
-
const id = useBaseUiId(idProp);
|
|
743
|
-
const highlighted = listItem.index === activeIndex;
|
|
744
|
-
const {
|
|
745
|
-
events: menuEvents
|
|
746
|
-
} = useFloatingTree();
|
|
747
|
-
return /* @__PURE__ */ jsx(MemoizedInnerMenuItem, {
|
|
748
|
-
...other,
|
|
749
|
-
id,
|
|
750
|
-
ref: mergedRef,
|
|
751
|
-
highlighted,
|
|
752
|
-
menuEvents,
|
|
753
|
-
itemProps,
|
|
754
|
-
allowMouseUpTriggerRef,
|
|
755
|
-
typingRef
|
|
756
|
-
});
|
|
757
|
-
});
|
|
758
|
-
process.env.NODE_ENV !== "production" ? MenuItem$1.propTypes = {
|
|
759
|
-
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
760
|
-
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
761
|
-
// │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
|
|
762
|
-
// └─────────────────────────────────────────────────────────────────────┘
|
|
763
|
-
/**
|
|
764
|
-
* @ignore
|
|
765
|
-
*/
|
|
766
|
-
children: PropTypes.node,
|
|
767
|
-
/**
|
|
768
|
-
* CSS class applied to the element, or a function that
|
|
769
|
-
* returns a class based on the component’s state.
|
|
770
|
-
*/
|
|
771
|
-
className: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
|
|
772
|
-
/**
|
|
773
|
-
* Whether to close the menu when the item is clicked.
|
|
774
|
-
*
|
|
775
|
-
* @default true
|
|
776
|
-
*/
|
|
777
|
-
closeOnClick: PropTypes.bool,
|
|
778
|
-
/**
|
|
779
|
-
* Whether the component should ignore user interaction.
|
|
780
|
-
* @default false
|
|
781
|
-
*/
|
|
782
|
-
disabled: PropTypes.bool,
|
|
783
|
-
/**
|
|
784
|
-
* @ignore
|
|
785
|
-
*/
|
|
786
|
-
id: PropTypes.string,
|
|
787
|
-
/**
|
|
788
|
-
* Overrides the text label to use when the item is matched during keyboard text navigation.
|
|
789
|
-
*/
|
|
790
|
-
label: PropTypes.string,
|
|
791
|
-
/**
|
|
792
|
-
* The click handler for the menu item.
|
|
793
|
-
*/
|
|
794
|
-
onClick: PropTypes.func,
|
|
795
|
-
/**
|
|
796
|
-
* Allows you to replace the component’s HTML element
|
|
797
|
-
* with a different tag, or compose it with another component.
|
|
798
|
-
*
|
|
799
|
-
* Accepts a `ReactElement` or a function that returns the element to render.
|
|
800
|
-
*/
|
|
801
|
-
render: PropTypes.oneOfType([PropTypes.element, PropTypes.func])
|
|
802
|
-
} : void 0;
|
|
803
|
-
function useMenuPopup(parameters) {
|
|
804
|
-
const {
|
|
805
|
-
menuEvents,
|
|
806
|
-
setOpen
|
|
807
|
-
} = parameters;
|
|
808
|
-
React.useEffect(() => {
|
|
809
|
-
function handleClose(event) {
|
|
810
|
-
setOpen(false, event);
|
|
811
|
-
}
|
|
812
|
-
menuEvents.on("close", handleClose);
|
|
813
|
-
return () => {
|
|
814
|
-
menuEvents.off("close", handleClose);
|
|
815
|
-
};
|
|
816
|
-
}, [menuEvents, setOpen]);
|
|
817
|
-
}
|
|
818
|
-
const customStyleHookMapping = {
|
|
819
|
-
...popupStateMapping,
|
|
820
|
-
...transitionStatusMapping
|
|
821
|
-
};
|
|
822
|
-
const DISABLED_TRANSITIONS_STYLE = {
|
|
823
|
-
style: {
|
|
824
|
-
transition: "none"
|
|
825
|
-
}
|
|
826
|
-
};
|
|
827
|
-
const EMPTY_OBJ = {};
|
|
828
|
-
const MenuPopup = /* @__PURE__ */ React.forwardRef(function MenuPopup2(props, forwardedRef) {
|
|
829
|
-
const {
|
|
830
|
-
render,
|
|
831
|
-
className,
|
|
832
|
-
...other
|
|
833
|
-
} = props;
|
|
834
|
-
const {
|
|
835
|
-
open,
|
|
836
|
-
setOpen,
|
|
837
|
-
popupRef,
|
|
838
|
-
transitionStatus,
|
|
839
|
-
nested,
|
|
840
|
-
popupProps,
|
|
841
|
-
modal,
|
|
842
|
-
mounted,
|
|
843
|
-
instantType,
|
|
844
|
-
onOpenChangeComplete
|
|
845
|
-
} = useMenuRootContext();
|
|
846
|
-
const {
|
|
847
|
-
side,
|
|
848
|
-
align,
|
|
849
|
-
floatingContext
|
|
850
|
-
} = useMenuPositionerContext();
|
|
851
|
-
useOpenChangeComplete({
|
|
852
|
-
open,
|
|
853
|
-
ref: popupRef,
|
|
854
|
-
onComplete() {
|
|
855
|
-
if (open) {
|
|
856
|
-
onOpenChangeComplete?.(true);
|
|
857
|
-
}
|
|
858
|
-
}
|
|
859
|
-
});
|
|
860
|
-
const {
|
|
861
|
-
events: menuEvents
|
|
862
|
-
} = useFloatingTree();
|
|
863
|
-
useMenuPopup({
|
|
864
|
-
setOpen,
|
|
865
|
-
menuEvents
|
|
866
|
-
});
|
|
867
|
-
const mergedRef = useForkRef(forwardedRef, popupRef);
|
|
868
|
-
const state2 = React.useMemo(() => ({
|
|
869
|
-
transitionStatus,
|
|
870
|
-
side,
|
|
871
|
-
align,
|
|
872
|
-
open,
|
|
873
|
-
nested,
|
|
874
|
-
instant: instantType
|
|
875
|
-
}), [transitionStatus, side, align, open, nested, instantType]);
|
|
876
|
-
const {
|
|
877
|
-
renderElement
|
|
878
|
-
} = useComponentRenderer({
|
|
879
|
-
render: render || "div",
|
|
880
|
-
className,
|
|
881
|
-
state: state2,
|
|
882
|
-
extraProps: mergeProps(transitionStatus === "starting" ? DISABLED_TRANSITIONS_STYLE : EMPTY_OBJ, popupProps, other),
|
|
883
|
-
customStyleHookMapping,
|
|
884
|
-
ref: mergedRef
|
|
885
|
-
});
|
|
886
|
-
return /* @__PURE__ */ jsx(FloatingFocusManager, {
|
|
887
|
-
context: floatingContext,
|
|
888
|
-
modal: false,
|
|
889
|
-
disabled: !mounted,
|
|
890
|
-
visuallyHiddenDismiss: modal ? "Dismiss popup" : void 0,
|
|
891
|
-
children: renderElement()
|
|
892
|
-
});
|
|
893
|
-
});
|
|
894
|
-
process.env.NODE_ENV !== "production" ? MenuPopup.propTypes = {
|
|
895
|
-
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
896
|
-
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
897
|
-
// │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
|
|
898
|
-
// └─────────────────────────────────────────────────────────────────────┘
|
|
899
|
-
/**
|
|
900
|
-
* @ignore
|
|
901
|
-
*/
|
|
902
|
-
children: PropTypes.node,
|
|
903
|
-
/**
|
|
904
|
-
* CSS class applied to the element, or a function that
|
|
905
|
-
* returns a class based on the component’s state.
|
|
906
|
-
*/
|
|
907
|
-
className: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
|
|
908
|
-
/**
|
|
909
|
-
* @ignore
|
|
910
|
-
*/
|
|
911
|
-
id: PropTypes.string,
|
|
912
|
-
/**
|
|
913
|
-
* Allows you to replace the component’s HTML element
|
|
914
|
-
* with a different tag, or compose it with another component.
|
|
915
|
-
*
|
|
916
|
-
* Accepts a `ReactElement` or a function that returns the element to render.
|
|
917
|
-
*/
|
|
918
|
-
render: PropTypes.oneOfType([PropTypes.element, PropTypes.func])
|
|
919
|
-
} : void 0;
|
|
920
|
-
const MenuRadioGroupContext = /* @__PURE__ */ React.createContext(void 0);
|
|
921
|
-
if (process.env.NODE_ENV !== "production") {
|
|
922
|
-
MenuRadioGroupContext.displayName = "MenuRadioGroupContext";
|
|
923
|
-
}
|
|
924
|
-
function useMenuRadioGroupContext() {
|
|
925
|
-
const context = React.useContext(MenuRadioGroupContext);
|
|
926
|
-
if (context === void 0) {
|
|
927
|
-
throw new Error("Base UI: MenuRadioGroupContext is missing. MenuRadioGroup parts must be placed within <Menu.RadioGroup>.");
|
|
928
|
-
}
|
|
929
|
-
return context;
|
|
930
|
-
}
|
|
931
|
-
const MenuRadioGroup$1 = /* @__PURE__ */ React.forwardRef(function MenuRadioGroup(props, forwardedRef) {
|
|
932
|
-
const {
|
|
933
|
-
render,
|
|
934
|
-
className,
|
|
935
|
-
value: valueProp,
|
|
936
|
-
defaultValue,
|
|
937
|
-
onValueChange: onValueChangeProp,
|
|
938
|
-
disabled = false,
|
|
939
|
-
...other
|
|
940
|
-
} = props;
|
|
941
|
-
const [value, setValueUnwrapped] = useControlled({
|
|
942
|
-
controlled: valueProp,
|
|
943
|
-
default: defaultValue,
|
|
944
|
-
name: "MenuRadioGroup"
|
|
945
|
-
});
|
|
946
|
-
const onValueChange = useEventCallback(onValueChangeProp);
|
|
947
|
-
const setValue = React.useCallback((newValue, event) => {
|
|
948
|
-
setValueUnwrapped(newValue);
|
|
949
|
-
onValueChange?.(newValue, event);
|
|
950
|
-
}, [onValueChange, setValueUnwrapped]);
|
|
951
|
-
const state2 = React.useMemo(() => ({
|
|
952
|
-
disabled
|
|
953
|
-
}), [disabled]);
|
|
954
|
-
const {
|
|
955
|
-
renderElement
|
|
956
|
-
} = useComponentRenderer({
|
|
957
|
-
render: render || "div",
|
|
958
|
-
className,
|
|
959
|
-
state: state2,
|
|
960
|
-
extraProps: {
|
|
961
|
-
role: "group",
|
|
962
|
-
"aria-disabled": disabled || void 0,
|
|
963
|
-
...other
|
|
964
|
-
},
|
|
965
|
-
ref: forwardedRef
|
|
966
|
-
});
|
|
967
|
-
const context = React.useMemo(() => ({
|
|
968
|
-
value,
|
|
969
|
-
setValue,
|
|
970
|
-
disabled
|
|
971
|
-
}), [value, setValue, disabled]);
|
|
972
|
-
return /* @__PURE__ */ jsx(MenuRadioGroupContext.Provider, {
|
|
973
|
-
value: context,
|
|
974
|
-
children: renderElement()
|
|
975
|
-
});
|
|
976
|
-
});
|
|
977
|
-
process.env.NODE_ENV !== "production" ? MenuRadioGroup$1.propTypes = {
|
|
978
|
-
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
979
|
-
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
980
|
-
// │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
|
|
981
|
-
// └─────────────────────────────────────────────────────────────────────┘
|
|
982
|
-
/**
|
|
983
|
-
* The content of the component.
|
|
984
|
-
*/
|
|
985
|
-
children: PropTypes.node,
|
|
986
|
-
/**
|
|
987
|
-
* CSS class applied to the element, or a function that
|
|
988
|
-
* returns a class based on the component’s state.
|
|
989
|
-
*/
|
|
990
|
-
className: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
|
|
991
|
-
/**
|
|
992
|
-
* The uncontrolled value of the radio item that should be initially selected.
|
|
993
|
-
*
|
|
994
|
-
* To render a controlled radio group, use the `value` prop instead.
|
|
995
|
-
*/
|
|
996
|
-
defaultValue: PropTypes.any,
|
|
997
|
-
/**
|
|
998
|
-
* Whether the component should ignore user interaction.
|
|
999
|
-
*
|
|
1000
|
-
* @default false
|
|
1001
|
-
*/
|
|
1002
|
-
disabled: PropTypes.bool,
|
|
1003
|
-
/**
|
|
1004
|
-
* Function called when the selected value changes.
|
|
1005
|
-
*
|
|
1006
|
-
* @default () => {}
|
|
1007
|
-
*/
|
|
1008
|
-
onValueChange: PropTypes.func,
|
|
1009
|
-
/**
|
|
1010
|
-
* Allows you to replace the component’s HTML element
|
|
1011
|
-
* with a different tag, or compose it with another component.
|
|
1012
|
-
*
|
|
1013
|
-
* Accepts a `ReactElement` or a function that returns the element to render.
|
|
1014
|
-
*/
|
|
1015
|
-
render: PropTypes.oneOfType([PropTypes.element, PropTypes.func]),
|
|
1016
|
-
/**
|
|
1017
|
-
* The controlled value of the radio item that should be currently selected.
|
|
1018
|
-
*
|
|
1019
|
-
* To render an uncontrolled radio group, use the `defaultValue` prop instead.
|
|
1020
|
-
*/
|
|
1021
|
-
value: PropTypes.any
|
|
1022
|
-
} : void 0;
|
|
1023
|
-
const MemoizedMenuRadioGroup = /* @__PURE__ */ React.memo(MenuRadioGroup$1);
|
|
1024
|
-
function useMenuRadioItem(params) {
|
|
1025
|
-
const {
|
|
1026
|
-
checked,
|
|
1027
|
-
setChecked,
|
|
1028
|
-
...other
|
|
1029
|
-
} = params;
|
|
1030
|
-
const {
|
|
1031
|
-
getItemProps: getMenuItemProps,
|
|
1032
|
-
...menuItem
|
|
1033
|
-
} = useMenuItem(other);
|
|
1034
|
-
const getItemProps = React.useCallback((externalProps) => {
|
|
1035
|
-
return mergeProps({
|
|
1036
|
-
role: "menuitemradio",
|
|
1037
|
-
"aria-checked": checked,
|
|
1038
|
-
onClick: (event) => {
|
|
1039
|
-
setChecked(event.nativeEvent);
|
|
1040
|
-
}
|
|
1041
|
-
}, externalProps, getMenuItemProps);
|
|
1042
|
-
}, [checked, getMenuItemProps, setChecked]);
|
|
1043
|
-
return {
|
|
1044
|
-
...menuItem,
|
|
1045
|
-
getItemProps,
|
|
1046
|
-
checked
|
|
1047
|
-
};
|
|
1048
|
-
}
|
|
1049
|
-
const MenuRadioItemContext = /* @__PURE__ */ React.createContext(void 0);
|
|
1050
|
-
if (process.env.NODE_ENV !== "production") {
|
|
1051
|
-
MenuRadioItemContext.displayName = "MenuRadioItemContext";
|
|
1052
|
-
}
|
|
1053
|
-
function useMenuRadioItemContext() {
|
|
1054
|
-
const context = React.useContext(MenuRadioItemContext);
|
|
1055
|
-
if (context === void 0) {
|
|
1056
|
-
throw new Error("Base UI: MenuRadioItemContext is missing. MenuRadioItem parts must be placed within <Menu.RadioItem>.");
|
|
1057
|
-
}
|
|
1058
|
-
return context;
|
|
1059
|
-
}
|
|
1060
|
-
const InnerMenuRadioItem = /* @__PURE__ */ React.forwardRef(function InnerMenuItem4(props, forwardedRef) {
|
|
1061
|
-
const {
|
|
1062
|
-
checked,
|
|
1063
|
-
setChecked,
|
|
1064
|
-
className,
|
|
1065
|
-
closeOnClick,
|
|
1066
|
-
disabled = false,
|
|
1067
|
-
highlighted,
|
|
1068
|
-
id,
|
|
1069
|
-
menuEvents,
|
|
1070
|
-
itemProps,
|
|
1071
|
-
render,
|
|
1072
|
-
allowMouseUpTriggerRef,
|
|
1073
|
-
typingRef,
|
|
1074
|
-
...other
|
|
1075
|
-
} = props;
|
|
1076
|
-
const {
|
|
1077
|
-
getItemProps
|
|
1078
|
-
} = useMenuRadioItem({
|
|
1079
|
-
checked,
|
|
1080
|
-
setChecked,
|
|
1081
|
-
closeOnClick,
|
|
1082
|
-
disabled,
|
|
1083
|
-
highlighted,
|
|
1084
|
-
id,
|
|
1085
|
-
menuEvents,
|
|
1086
|
-
ref: forwardedRef,
|
|
1087
|
-
allowMouseUpTriggerRef,
|
|
1088
|
-
typingRef
|
|
1089
|
-
});
|
|
1090
|
-
const state2 = {
|
|
1091
|
-
disabled,
|
|
1092
|
-
highlighted,
|
|
1093
|
-
checked
|
|
1094
|
-
};
|
|
1095
|
-
const {
|
|
1096
|
-
renderElement
|
|
1097
|
-
} = useComponentRenderer({
|
|
1098
|
-
render: render || "div",
|
|
1099
|
-
className,
|
|
1100
|
-
state: state2,
|
|
1101
|
-
propGetter: (externalProps) => mergeProps(itemProps, externalProps, getItemProps),
|
|
1102
|
-
customStyleHookMapping: itemMapping,
|
|
1103
|
-
extraProps: other
|
|
1104
|
-
});
|
|
1105
|
-
return renderElement();
|
|
1106
|
-
});
|
|
1107
|
-
process.env.NODE_ENV !== "production" ? InnerMenuRadioItem.propTypes = {
|
|
1108
|
-
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
1109
|
-
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
1110
|
-
// │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
|
|
1111
|
-
// └─────────────────────────────────────────────────────────────────────┘
|
|
1112
|
-
/**
|
|
1113
|
-
* @ignore
|
|
1114
|
-
*/
|
|
1115
|
-
allowMouseUpTriggerRef: PropTypes.shape({
|
|
1116
|
-
current: PropTypes.bool.isRequired
|
|
1117
|
-
}).isRequired,
|
|
1118
|
-
/**
|
|
1119
|
-
* @ignore
|
|
1120
|
-
*/
|
|
1121
|
-
checked: PropTypes.bool.isRequired,
|
|
1122
|
-
/**
|
|
1123
|
-
* @ignore
|
|
1124
|
-
*/
|
|
1125
|
-
children: PropTypes.node,
|
|
1126
|
-
/**
|
|
1127
|
-
* CSS class applied to the element, or a function that
|
|
1128
|
-
* returns a class based on the component’s state.
|
|
1129
|
-
*/
|
|
1130
|
-
className: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
|
|
1131
|
-
/**
|
|
1132
|
-
* Whether to close the menu when the item is clicked.
|
|
1133
|
-
*/
|
|
1134
|
-
closeOnClick: PropTypes.bool.isRequired,
|
|
1135
|
-
/**
|
|
1136
|
-
* Whether the component should ignore user interaction.
|
|
1137
|
-
* @default false
|
|
1138
|
-
*/
|
|
1139
|
-
disabled: PropTypes.bool,
|
|
1140
|
-
/**
|
|
1141
|
-
* @ignore
|
|
1142
|
-
*/
|
|
1143
|
-
highlighted: PropTypes.bool.isRequired,
|
|
1144
|
-
/**
|
|
1145
|
-
* @ignore
|
|
1146
|
-
*/
|
|
1147
|
-
id: PropTypes.string,
|
|
1148
|
-
/**
|
|
1149
|
-
* @ignore
|
|
1150
|
-
*/
|
|
1151
|
-
itemProps: PropTypes.object.isRequired,
|
|
1152
|
-
/**
|
|
1153
|
-
* Overrides the text label to use when the item is matched during keyboard text navigation.
|
|
1154
|
-
*/
|
|
1155
|
-
label: PropTypes.string,
|
|
1156
|
-
/**
|
|
1157
|
-
* @ignore
|
|
1158
|
-
*/
|
|
1159
|
-
menuEvents: PropTypes.shape({
|
|
1160
|
-
emit: PropTypes.func.isRequired,
|
|
1161
|
-
off: PropTypes.func.isRequired,
|
|
1162
|
-
on: PropTypes.func.isRequired
|
|
1163
|
-
}).isRequired,
|
|
1164
|
-
/**
|
|
1165
|
-
* The click handler for the menu item.
|
|
1166
|
-
*/
|
|
1167
|
-
onClick: PropTypes.func,
|
|
1168
|
-
/**
|
|
1169
|
-
* Allows you to replace the component’s HTML element
|
|
1170
|
-
* with a different tag, or compose it with another component.
|
|
1171
|
-
*
|
|
1172
|
-
* Accepts a `ReactElement` or a function that returns the element to render.
|
|
1173
|
-
*/
|
|
1174
|
-
render: PropTypes.oneOfType([PropTypes.element, PropTypes.func]),
|
|
1175
|
-
/**
|
|
1176
|
-
* @ignore
|
|
1177
|
-
*/
|
|
1178
|
-
setChecked: PropTypes.func.isRequired,
|
|
1179
|
-
/**
|
|
1180
|
-
* @ignore
|
|
1181
|
-
*/
|
|
1182
|
-
typingRef: PropTypes.shape({
|
|
1183
|
-
current: PropTypes.bool.isRequired
|
|
1184
|
-
}).isRequired
|
|
1185
|
-
} : void 0;
|
|
1186
|
-
const MemoizedInnerMenuRadioItem = /* @__PURE__ */ React.memo(InnerMenuRadioItem);
|
|
1187
|
-
const MenuRadioItem$1 = /* @__PURE__ */ React.forwardRef(function MenuRadioItem(props, forwardedRef) {
|
|
1188
|
-
const {
|
|
1189
|
-
id: idProp,
|
|
1190
|
-
value,
|
|
1191
|
-
label,
|
|
1192
|
-
disabled: disabledProp = false,
|
|
1193
|
-
closeOnClick = false,
|
|
1194
|
-
...other
|
|
1195
|
-
} = props;
|
|
1196
|
-
const itemRef = React.useRef(null);
|
|
1197
|
-
const listItem = useCompositeListItem({
|
|
1198
|
-
label
|
|
1199
|
-
});
|
|
1200
|
-
const mergedRef = useForkRef(forwardedRef, listItem.ref, itemRef);
|
|
1201
|
-
const {
|
|
1202
|
-
itemProps,
|
|
1203
|
-
activeIndex,
|
|
1204
|
-
allowMouseUpTriggerRef,
|
|
1205
|
-
typingRef
|
|
1206
|
-
} = useMenuRootContext();
|
|
1207
|
-
const id = useBaseUiId(idProp);
|
|
1208
|
-
const highlighted = listItem.index === activeIndex;
|
|
1209
|
-
const {
|
|
1210
|
-
events: menuEvents
|
|
1211
|
-
} = useFloatingTree();
|
|
1212
|
-
const {
|
|
1213
|
-
value: selectedValue,
|
|
1214
|
-
setValue: setSelectedValue,
|
|
1215
|
-
disabled: groupDisabled
|
|
1216
|
-
} = useMenuRadioGroupContext();
|
|
1217
|
-
const disabled = groupDisabled || disabledProp;
|
|
1218
|
-
const checked = selectedValue === value;
|
|
1219
|
-
const setChecked = React.useCallback((event) => {
|
|
1220
|
-
setSelectedValue(value, event);
|
|
1221
|
-
}, [setSelectedValue, value]);
|
|
1222
|
-
const contextValue = React.useMemo(() => ({
|
|
1223
|
-
checked,
|
|
1224
|
-
highlighted,
|
|
1225
|
-
disabled
|
|
1226
|
-
}), [checked, highlighted, disabled]);
|
|
1227
|
-
return /* @__PURE__ */ jsx(MenuRadioItemContext.Provider, {
|
|
1228
|
-
value: contextValue,
|
|
1229
|
-
children: /* @__PURE__ */ jsx(MemoizedInnerMenuRadioItem, {
|
|
1230
|
-
...other,
|
|
1231
|
-
id,
|
|
1232
|
-
ref: mergedRef,
|
|
1233
|
-
disabled,
|
|
1234
|
-
highlighted,
|
|
1235
|
-
menuEvents,
|
|
1236
|
-
itemProps,
|
|
1237
|
-
allowMouseUpTriggerRef,
|
|
1238
|
-
checked: selectedValue === value,
|
|
1239
|
-
setChecked,
|
|
1240
|
-
typingRef,
|
|
1241
|
-
closeOnClick
|
|
1242
|
-
})
|
|
1243
|
-
});
|
|
1244
|
-
});
|
|
1245
|
-
process.env.NODE_ENV !== "production" ? MenuRadioItem$1.propTypes = {
|
|
1246
|
-
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
1247
|
-
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
1248
|
-
// │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
|
|
1249
|
-
// └─────────────────────────────────────────────────────────────────────┘
|
|
1250
|
-
/**
|
|
1251
|
-
* @ignore
|
|
1252
|
-
*/
|
|
1253
|
-
children: PropTypes.node,
|
|
1254
|
-
/**
|
|
1255
|
-
* CSS class applied to the element, or a function that
|
|
1256
|
-
* returns a class based on the component’s state.
|
|
1257
|
-
*/
|
|
1258
|
-
className: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
|
|
1259
|
-
/**
|
|
1260
|
-
* Whether to close the menu when the item is clicked.
|
|
1261
|
-
* @default false
|
|
1262
|
-
*/
|
|
1263
|
-
closeOnClick: PropTypes.bool,
|
|
1264
|
-
/**
|
|
1265
|
-
* Whether the component should ignore user interaction.
|
|
1266
|
-
* @default false
|
|
1267
|
-
*/
|
|
1268
|
-
disabled: PropTypes.bool,
|
|
1269
|
-
/**
|
|
1270
|
-
* @ignore
|
|
1271
|
-
*/
|
|
1272
|
-
id: PropTypes.string,
|
|
1273
|
-
/**
|
|
1274
|
-
* Overrides the text label to use when the item is matched during keyboard text navigation.
|
|
1275
|
-
*/
|
|
1276
|
-
label: PropTypes.string,
|
|
1277
|
-
/**
|
|
1278
|
-
* The click handler for the menu item.
|
|
1279
|
-
*/
|
|
1280
|
-
onClick: PropTypes.func,
|
|
1281
|
-
/**
|
|
1282
|
-
* Allows you to replace the component’s HTML element
|
|
1283
|
-
* with a different tag, or compose it with another component.
|
|
1284
|
-
*
|
|
1285
|
-
* Accepts a `ReactElement` or a function that returns the element to render.
|
|
1286
|
-
*/
|
|
1287
|
-
render: PropTypes.oneOfType([PropTypes.element, PropTypes.func]),
|
|
1288
|
-
/**
|
|
1289
|
-
* Value of the radio item.
|
|
1290
|
-
* This is the value that will be set in the MenuRadioGroup when the item is selected.
|
|
1291
|
-
*/
|
|
1292
|
-
value: PropTypes.any.isRequired
|
|
1293
|
-
} : void 0;
|
|
1294
|
-
const MenuRadioItemIndicator$1 = /* @__PURE__ */ React.forwardRef(function MenuRadioItemIndicator(props, forwardedRef) {
|
|
1295
|
-
const {
|
|
1296
|
-
render,
|
|
1297
|
-
className,
|
|
1298
|
-
keepMounted = false,
|
|
1299
|
-
...other
|
|
1300
|
-
} = props;
|
|
1301
|
-
const item = useMenuRadioItemContext();
|
|
1302
|
-
const indicatorRef = React.useRef(null);
|
|
1303
|
-
const mergedRef = useForkRef(forwardedRef, indicatorRef);
|
|
1304
|
-
const {
|
|
1305
|
-
transitionStatus,
|
|
1306
|
-
setMounted
|
|
1307
|
-
} = useTransitionStatus(item.checked);
|
|
1308
|
-
useOpenChangeComplete({
|
|
1309
|
-
open: item.checked,
|
|
1310
|
-
ref: indicatorRef,
|
|
1311
|
-
onComplete() {
|
|
1312
|
-
if (!item.checked) {
|
|
1313
|
-
setMounted(false);
|
|
1314
|
-
}
|
|
1315
|
-
}
|
|
1316
|
-
});
|
|
1317
|
-
const state2 = React.useMemo(() => ({
|
|
1318
|
-
checked: item.checked,
|
|
1319
|
-
disabled: item.disabled,
|
|
1320
|
-
highlighted: item.highlighted,
|
|
1321
|
-
transitionStatus
|
|
1322
|
-
}), [item.checked, item.disabled, item.highlighted, transitionStatus]);
|
|
1323
|
-
const {
|
|
1324
|
-
renderElement
|
|
1325
|
-
} = useComponentRenderer({
|
|
1326
|
-
render: render || "span",
|
|
1327
|
-
className,
|
|
1328
|
-
state: state2,
|
|
1329
|
-
customStyleHookMapping: itemMapping,
|
|
1330
|
-
extraProps: {
|
|
1331
|
-
"aria-hidden": true,
|
|
1332
|
-
...other
|
|
1333
|
-
},
|
|
1334
|
-
ref: mergedRef
|
|
1335
|
-
});
|
|
1336
|
-
const shouldRender = keepMounted || item.checked;
|
|
1337
|
-
if (!shouldRender) {
|
|
1338
|
-
return null;
|
|
1339
|
-
}
|
|
1340
|
-
return renderElement();
|
|
1341
|
-
});
|
|
1342
|
-
process.env.NODE_ENV !== "production" ? MenuRadioItemIndicator$1.propTypes = {
|
|
1343
|
-
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
1344
|
-
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
1345
|
-
// │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
|
|
1346
|
-
// └─────────────────────────────────────────────────────────────────────┘
|
|
1347
|
-
/**
|
|
1348
|
-
* @ignore
|
|
1349
|
-
*/
|
|
1350
|
-
children: PropTypes.node,
|
|
1351
|
-
/**
|
|
1352
|
-
* CSS class applied to the element, or a function that
|
|
1353
|
-
* returns a class based on the component’s state.
|
|
1354
|
-
*/
|
|
1355
|
-
className: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
|
|
1356
|
-
/**
|
|
1357
|
-
* Whether to keep the HTML element in the DOM when the radio item is inactive.
|
|
1358
|
-
* @default false
|
|
1359
|
-
*/
|
|
1360
|
-
keepMounted: PropTypes.bool,
|
|
1361
|
-
/**
|
|
1362
|
-
* Allows you to replace the component’s HTML element
|
|
1363
|
-
* with a different tag, or compose it with another component.
|
|
1364
|
-
*
|
|
1365
|
-
* Accepts a `ReactElement` or a function that returns the element to render.
|
|
1366
|
-
*/
|
|
1367
|
-
render: PropTypes.oneOfType([PropTypes.element, PropTypes.func])
|
|
1368
|
-
} : void 0;
|
|
1369
|
-
const Separator = /* @__PURE__ */ React.forwardRef(function SeparatorComponent(props, forwardedRef) {
|
|
1370
|
-
const {
|
|
1371
|
-
className,
|
|
1372
|
-
render,
|
|
1373
|
-
orientation = "horizontal",
|
|
1374
|
-
...other
|
|
1375
|
-
} = props;
|
|
1376
|
-
const state2 = React.useMemo(() => ({
|
|
1377
|
-
orientation
|
|
1378
|
-
}), [orientation]);
|
|
1379
|
-
const getSeparatorProps = React.useCallback((externalProps = {}) => mergeProps({
|
|
1380
|
-
"aria-orientation": orientation
|
|
1381
|
-
}, externalProps), [orientation]);
|
|
1382
|
-
const {
|
|
1383
|
-
renderElement
|
|
1384
|
-
} = useComponentRenderer({
|
|
1385
|
-
propGetter: getSeparatorProps,
|
|
1386
|
-
render: render ?? "div",
|
|
1387
|
-
className,
|
|
1388
|
-
state: state2,
|
|
1389
|
-
extraProps: {
|
|
1390
|
-
role: "separator",
|
|
1391
|
-
...other
|
|
1392
|
-
},
|
|
1393
|
-
ref: forwardedRef
|
|
1394
|
-
});
|
|
1395
|
-
return renderElement();
|
|
1396
|
-
});
|
|
1397
|
-
process.env.NODE_ENV !== "production" ? Separator.propTypes = {
|
|
1398
|
-
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
1399
|
-
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
1400
|
-
// │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
|
|
1401
|
-
// └─────────────────────────────────────────────────────────────────────┘
|
|
1402
|
-
/**
|
|
1403
|
-
* @ignore
|
|
1404
|
-
*/
|
|
1405
|
-
children: PropTypes.node,
|
|
1406
|
-
/**
|
|
1407
|
-
* CSS class applied to the element, or a function that
|
|
1408
|
-
* returns a class based on the component’s state.
|
|
1409
|
-
*/
|
|
1410
|
-
className: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
|
|
1411
|
-
/**
|
|
1412
|
-
* The orientation of the separator.
|
|
1413
|
-
* @default 'horizontal'
|
|
1414
|
-
*/
|
|
1415
|
-
orientation: PropTypes.oneOf(["horizontal", "vertical"]),
|
|
1416
|
-
/**
|
|
1417
|
-
* Allows you to replace the component’s HTML element
|
|
1418
|
-
* with a different tag, or compose it with another component.
|
|
1419
|
-
*
|
|
1420
|
-
* Accepts a `ReactElement` or a function that returns the element to render.
|
|
1421
|
-
*/
|
|
1422
|
-
render: PropTypes.oneOfType([PropTypes.element, PropTypes.func])
|
|
1423
|
-
} : void 0;
|
|
1424
|
-
function useMenuSubmenuTrigger(parameters) {
|
|
1425
|
-
const {
|
|
1426
|
-
id,
|
|
1427
|
-
highlighted,
|
|
1428
|
-
disabled,
|
|
1429
|
-
ref: externalRef,
|
|
1430
|
-
menuEvents,
|
|
1431
|
-
setTriggerElement,
|
|
1432
|
-
allowMouseUpTriggerRef,
|
|
1433
|
-
typingRef
|
|
1434
|
-
} = parameters;
|
|
1435
|
-
const {
|
|
1436
|
-
getItemProps,
|
|
1437
|
-
rootRef: menuItemRef
|
|
1438
|
-
} = useMenuItem({
|
|
1439
|
-
closeOnClick: false,
|
|
1440
|
-
disabled,
|
|
1441
|
-
highlighted,
|
|
1442
|
-
id,
|
|
1443
|
-
menuEvents,
|
|
1444
|
-
ref: externalRef,
|
|
1445
|
-
allowMouseUpTriggerRef,
|
|
1446
|
-
typingRef
|
|
1447
|
-
});
|
|
1448
|
-
const menuTriggerRef = useForkRef(menuItemRef, setTriggerElement);
|
|
1449
|
-
const getTriggerProps = React.useCallback((externalProps) => {
|
|
1450
|
-
return {
|
|
1451
|
-
...getItemProps(externalProps),
|
|
1452
|
-
"aria-haspopup": "menu",
|
|
1453
|
-
ref: menuTriggerRef
|
|
1454
|
-
};
|
|
1455
|
-
}, [getItemProps, menuTriggerRef]);
|
|
1456
|
-
return React.useMemo(() => ({
|
|
1457
|
-
getTriggerProps,
|
|
1458
|
-
rootRef: menuTriggerRef
|
|
1459
|
-
}), [getTriggerProps, menuTriggerRef]);
|
|
1460
|
-
}
|
|
1461
|
-
const MenuSubmenuTrigger$1 = /* @__PURE__ */ React.forwardRef(function SubmenuTriggerComponent(props, forwardedRef) {
|
|
1462
|
-
const {
|
|
1463
|
-
render,
|
|
1464
|
-
className,
|
|
1465
|
-
label,
|
|
1466
|
-
id: idProp,
|
|
1467
|
-
...other
|
|
1468
|
-
} = props;
|
|
1469
|
-
const id = useBaseUiId(idProp);
|
|
1470
|
-
const {
|
|
1471
|
-
triggerProps: rootTriggerProps,
|
|
1472
|
-
parentContext,
|
|
1473
|
-
setTriggerElement,
|
|
1474
|
-
allowMouseUpTriggerRef,
|
|
1475
|
-
open,
|
|
1476
|
-
typingRef,
|
|
1477
|
-
disabled
|
|
1478
|
-
} = useMenuRootContext();
|
|
1479
|
-
if (parentContext === void 0) {
|
|
1480
|
-
throw new Error("Base UI: ItemTrigger must be placed in a nested Menu.");
|
|
1481
|
-
}
|
|
1482
|
-
const {
|
|
1483
|
-
activeIndex,
|
|
1484
|
-
itemProps
|
|
1485
|
-
} = parentContext;
|
|
1486
|
-
const item = useCompositeListItem();
|
|
1487
|
-
const highlighted = activeIndex === item.index;
|
|
1488
|
-
const mergedRef = useForkRef(forwardedRef, item.ref);
|
|
1489
|
-
const {
|
|
1490
|
-
events: menuEvents
|
|
1491
|
-
} = useFloatingTree();
|
|
1492
|
-
const {
|
|
1493
|
-
getTriggerProps
|
|
1494
|
-
} = useMenuSubmenuTrigger({
|
|
1495
|
-
id,
|
|
1496
|
-
highlighted,
|
|
1497
|
-
ref: mergedRef,
|
|
1498
|
-
disabled,
|
|
1499
|
-
menuEvents,
|
|
1500
|
-
setTriggerElement,
|
|
1501
|
-
allowMouseUpTriggerRef,
|
|
1502
|
-
typingRef
|
|
1503
|
-
});
|
|
1504
|
-
const state2 = React.useMemo(() => ({
|
|
1505
|
-
disabled,
|
|
1506
|
-
highlighted,
|
|
1507
|
-
open
|
|
1508
|
-
}), [disabled, highlighted, open]);
|
|
1509
|
-
const {
|
|
1510
|
-
renderElement
|
|
1511
|
-
} = useComponentRenderer({
|
|
1512
|
-
render: render || "div",
|
|
1513
|
-
className,
|
|
1514
|
-
state: state2,
|
|
1515
|
-
propGetter: (externalProps) => mergeProps(rootTriggerProps, itemProps, externalProps, getTriggerProps),
|
|
1516
|
-
customStyleHookMapping: triggerOpenStateMapping,
|
|
1517
|
-
extraProps: other
|
|
1518
|
-
});
|
|
1519
|
-
return renderElement();
|
|
1520
|
-
});
|
|
1521
|
-
process.env.NODE_ENV !== "production" ? MenuSubmenuTrigger$1.propTypes = {
|
|
1522
|
-
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
1523
|
-
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
1524
|
-
// │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
|
|
1525
|
-
// └─────────────────────────────────────────────────────────────────────┘
|
|
1526
|
-
/**
|
|
1527
|
-
* @ignore
|
|
1528
|
-
*/
|
|
1529
|
-
children: PropTypes.node,
|
|
1530
|
-
/**
|
|
1531
|
-
* CSS class applied to the element, or a function that
|
|
1532
|
-
* returns a class based on the component’s state.
|
|
1533
|
-
*/
|
|
1534
|
-
className: PropTypes.oneOfType([PropTypes.func, PropTypes.string]),
|
|
1535
|
-
/**
|
|
1536
|
-
* @ignore
|
|
1537
|
-
*/
|
|
1538
|
-
id: PropTypes.string,
|
|
1539
|
-
/**
|
|
1540
|
-
* Overrides the text label to use when the item is matched during keyboard text navigation.
|
|
1541
|
-
*/
|
|
1542
|
-
label: PropTypes.string,
|
|
1543
|
-
/**
|
|
1544
|
-
* @ignore
|
|
1545
|
-
*/
|
|
1546
|
-
onClick: PropTypes.func,
|
|
1547
|
-
/**
|
|
1548
|
-
* Allows you to replace the component’s HTML element
|
|
1549
|
-
* with a different tag, or compose it with another component.
|
|
1550
|
-
*
|
|
1551
|
-
* Accepts a `ReactElement` or a function that returns the element to render.
|
|
1552
|
-
*/
|
|
1553
|
-
render: PropTypes.oneOfType([PropTypes.element, PropTypes.func])
|
|
1554
|
-
} : void 0;
|
|
1555
|
-
function useMenuClassName(name, className) {
|
|
1556
|
-
return useMemo(() => {
|
|
1557
|
-
if (typeof className !== "function") return clsx(name, className);
|
|
1558
|
-
return (p) => clsx(name, className(p));
|
|
1559
|
-
}, [className, name]);
|
|
1560
|
-
}
|
|
1561
|
-
const MenuSubmenu = ({
|
|
1562
|
-
children,
|
|
1563
|
-
trigger,
|
|
1564
|
-
...props
|
|
1565
|
-
}) => {
|
|
1566
|
-
return /* @__PURE__ */ jsxs(MenuRoot, { ...props, children: [
|
|
1567
|
-
trigger,
|
|
1568
|
-
/* @__PURE__ */ jsx(MenuPortal, { children: /* @__PURE__ */ jsx(MenuPositioner, { children }) })
|
|
1569
|
-
] });
|
|
1570
|
-
};
|
|
1571
|
-
const MenuContainer = forwardRef(function MenuContainer2({ className, ...props }, ref) {
|
|
1572
|
-
const cl = useMenuClassName("lng1771-menu", className);
|
|
1573
|
-
return /* @__PURE__ */ jsx(MenuPopup, { ...props, className: cl, ref });
|
|
1574
|
-
});
|
|
1575
|
-
const MenuItem2 = forwardRef(function MenuItem22({ className, ...props }, ref) {
|
|
1576
|
-
const cl = useMenuClassName("lng1771-menu__item", className);
|
|
1577
|
-
return /* @__PURE__ */ jsx(MenuItem$1, { ...props, className: cl, ref });
|
|
1578
|
-
});
|
|
1579
|
-
const MenuSeparator = forwardRef(function MenuSeparator2({ className, ...props }, ref) {
|
|
1580
|
-
const cl = useMenuClassName("lng1771-menu__separator", className);
|
|
1581
|
-
return /* @__PURE__ */ jsx(Separator, { ...props, className: cl, ref });
|
|
1582
|
-
});
|
|
1583
|
-
const MenuArrow2 = forwardRef(function MenuArrow22({ className, ...props }, ref) {
|
|
1584
|
-
const cl = useMenuClassName("lng1771-menu__arrow", className);
|
|
1585
|
-
return /* @__PURE__ */ jsx(MenuArrow$1, { ...props, className: cl, ref, children: props.children ?? /* @__PURE__ */ jsx(ArrowSvg, {}) });
|
|
1586
|
-
});
|
|
1587
|
-
const MenuGroup2 = forwardRef(function MenuGroup22({ className, ...props }, ref) {
|
|
1588
|
-
const cl = useMenuClassName("lng1771-menu__group", className);
|
|
1589
|
-
return /* @__PURE__ */ jsx(MenuGroup$1, { ...props, ref, className: cl });
|
|
1590
|
-
});
|
|
1591
|
-
const MenuGroupLabel = forwardRef(function MenuGroupLabel2({ className, ...props }, ref) {
|
|
1592
|
-
const cl = useMenuClassName("lng1771-menu__group-label", className);
|
|
1593
|
-
return /* @__PURE__ */ jsx(MenuGroupLabel$1, { ...props, ref, className: cl });
|
|
1594
|
-
});
|
|
1595
|
-
const MenuSubmenuTrigger = forwardRef(function SubmenuTrigger({ className, children, ...props }, ref) {
|
|
1596
|
-
const cl = useMenuClassName("lng1771-menu__submenu-trigger", className);
|
|
1597
|
-
return /* @__PURE__ */ jsxs(MenuSubmenuTrigger$1, { ...props, className: cl, ref, children: [
|
|
1598
|
-
/* @__PURE__ */ jsx("div", { children }),
|
|
1599
|
-
/* @__PURE__ */ jsx(ArrowRightIcon, { width: 16, height: 16 })
|
|
1600
|
-
] });
|
|
1601
|
-
});
|
|
1602
|
-
const MenuRadioGroup2 = forwardRef(function RadioGroup({ className, ...props }, ref) {
|
|
1603
|
-
const cl = useMenuClassName("lng1771-menu__radio-group", className);
|
|
1604
|
-
return /* @__PURE__ */ jsx(MemoizedMenuRadioGroup, { ...props, className: cl, ref });
|
|
1605
|
-
});
|
|
1606
|
-
const MenuRadioItemIndicator2 = forwardRef(function RadioItemIndicator({ children, className, ...props }, ref) {
|
|
1607
|
-
const cl = useMenuClassName("lng1771-menu__radio-item-indicator", className);
|
|
1608
|
-
return /* @__PURE__ */ jsx(MenuRadioItemIndicator$1, { ...props, ref, className: cl, children: children ?? /* @__PURE__ */ jsx(TickmarkIcon, { width: 16, height: 16 }) });
|
|
1609
|
-
});
|
|
1610
|
-
const MenuRadioItem2 = forwardRef(function RadioItem({ className, ...props }, ref) {
|
|
1611
|
-
const cl = useMenuClassName("lng1771-menu__radio-item", className);
|
|
1612
|
-
return /* @__PURE__ */ jsx(MenuRadioItem$1, { ...props, ref, className: cl });
|
|
1613
|
-
});
|
|
1614
|
-
const MenuCheckboxItemIndicator2 = forwardRef(function CheckboxItemIndicator({ children, className, ...props }, ref) {
|
|
1615
|
-
const cl = useMenuClassName("lng1771-menu__checkbox-item-indicator", className);
|
|
1616
|
-
return /* @__PURE__ */ jsx(MenuCheckboxItemIndicator$1, { ...props, ref, className: cl, children: children ?? /* @__PURE__ */ jsx(TickmarkIcon, { width: 16, height: 16 }) });
|
|
1617
|
-
});
|
|
1618
|
-
const MenuCheckboxItem2 = forwardRef(function CheckboxItem({ className, ...props }, ref) {
|
|
1619
|
-
const cl = useMenuClassName("lng1771-menu__checkbox-item", className);
|
|
1620
|
-
return /* @__PURE__ */ jsx(MenuCheckboxItem$1, { ...props, ref, className: cl });
|
|
1621
|
-
});
|
|
1622
|
-
const Menu = {
|
|
1623
|
-
Container: MenuContainer,
|
|
1624
|
-
Submenu: MenuSubmenu,
|
|
1625
|
-
SubmenuTrigger: MenuSubmenuTrigger,
|
|
1626
|
-
Item: MenuItem2,
|
|
1627
|
-
Separator: MenuSeparator,
|
|
1628
|
-
Arrow: MenuArrow2,
|
|
1629
|
-
Group: MenuGroup2,
|
|
1630
|
-
GroupLabel: MenuGroupLabel,
|
|
1631
|
-
RadioGroup: MenuRadioGroup2,
|
|
1632
|
-
Radio: MenuRadioItem2,
|
|
1633
|
-
RadioIndicator: MenuRadioItemIndicator2,
|
|
1634
|
-
Checkbox: MenuCheckboxItem2,
|
|
1635
|
-
CheckboxIndicator: MenuCheckboxItemIndicator2
|
|
1636
|
-
};
|
|
1
|
+
import { a } from "./menu-CkfZmNR3.js";
|
|
1637
2
|
export {
|
|
1638
|
-
Menu
|
|
3
|
+
a as Menu
|
|
1639
4
|
};
|