@astryxdesign/core 0.5.2-canary.c9c8564 → 0.5.2-canary.e4f8e4e
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/BottomSheet/BottomSheet.d.ts +3 -1
- package/dist/BottomSheet/BottomSheet.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheet.js +4 -3
- package/dist/BottomSheet/BottomSheetEdgeTint.d.ts +2 -2
- package/dist/BottomSheet/BottomSheetEdgeTint.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheetEdgeTint.js +7 -10
- package/dist/BottomSheet/BottomSheetSwitcher.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheetSwitcher.js +1 -1
- package/dist/Button/Button.d.ts +2 -1
- package/dist/Button/Button.d.ts.map +1 -1
- package/dist/Button/Button.js +11 -4
- package/dist/Carousel/Carousel.d.ts.map +1 -1
- package/dist/Carousel/Carousel.js +2 -2
- package/dist/Chat/ChatToolCalls.d.ts.map +1 -1
- package/dist/Chat/ChatToolCalls.js +34 -17
- package/dist/ContextMenu/ContextMenu.d.ts +14 -3
- package/dist/ContextMenu/ContextMenu.d.ts.map +1 -1
- package/dist/ContextMenu/ContextMenu.js +149 -26
- package/dist/ContextMenu/index.d.ts +1 -0
- package/dist/ContextMenu/index.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenu.d.ts +24 -5
- package/dist/DropdownMenu/DropdownMenu.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenu.js +340 -26
- package/dist/DropdownMenu/DropdownMenuContext.d.ts +1 -1
- package/dist/DropdownMenu/DropdownMenuContext.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenuItem.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenuItem.js +1 -1
- package/dist/DropdownMenu/DropdownMenuSubMenu.d.ts +6 -2
- package/dist/DropdownMenu/DropdownMenuSubMenu.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenuSubMenu.js +43 -14
- package/dist/DropdownMenu/MenuBottomSheet.d.ts +20 -0
- package/dist/DropdownMenu/MenuBottomSheet.d.ts.map +1 -0
- package/dist/DropdownMenu/MenuBottomSheet.js +36 -0
- package/dist/DropdownMenu/MenuBottomSheetActionList.d.ts +10 -0
- package/dist/DropdownMenu/MenuBottomSheetActionList.d.ts.map +1 -0
- package/dist/DropdownMenu/MenuBottomSheetActionList.js +111 -0
- package/dist/DropdownMenu/index.d.ts +2 -1
- package/dist/DropdownMenu/index.d.ts.map +1 -1
- package/dist/DropdownMenu/menuWidth.d.ts +14 -0
- package/dist/DropdownMenu/menuWidth.d.ts.map +1 -0
- package/dist/DropdownMenu/menuWidth.js +35 -0
- package/dist/DropdownMenu/useMenuOverflow.d.ts +10 -0
- package/dist/DropdownMenu/useMenuOverflow.d.ts.map +1 -0
- package/dist/DropdownMenu/useMenuOverflow.js +60 -0
- package/dist/MoreMenu/MoreMenu.d.ts +8 -2
- package/dist/MoreMenu/MoreMenu.d.ts.map +1 -1
- package/dist/MoreMenu/MoreMenu.js +2 -0
- package/dist/MultiSelector/MultiSelector.d.ts +11 -1
- package/dist/MultiSelector/MultiSelector.d.ts.map +1 -1
- package/dist/MultiSelector/MultiSelector.js +97 -68
- package/dist/MultiSelector/index.d.ts +1 -1
- package/dist/MultiSelector/index.d.ts.map +1 -1
- package/dist/Popover/Popover.d.ts +10 -6
- package/dist/Popover/Popover.d.ts.map +1 -1
- package/dist/Popover/Popover.js +141 -16
- package/dist/Popover/usePopover.d.ts +4 -0
- package/dist/Popover/usePopover.d.ts.map +1 -1
- package/dist/Popover/usePopover.js +52 -5
- package/dist/Selector/Selector.d.ts +10 -0
- package/dist/Selector/Selector.d.ts.map +1 -1
- package/dist/Selector/Selector.js +106 -80
- package/dist/Selector/SelectorBottomSheet.d.ts +21 -0
- package/dist/Selector/SelectorBottomSheet.d.ts.map +1 -0
- package/dist/Selector/SelectorBottomSheet.js +83 -0
- package/dist/Selector/index.d.ts +1 -1
- package/dist/Selector/index.d.ts.map +1 -1
- package/dist/Selector/selectorPresentation.stylex.d.ts +16 -0
- package/dist/Selector/selectorPresentation.stylex.d.ts.map +1 -0
- package/dist/Selector/selectorPresentation.stylex.js +21 -0
- package/dist/Selector/useSelectorPresentation.d.ts +32 -0
- package/dist/Selector/useSelectorPresentation.d.ts.map +1 -0
- package/dist/Selector/useSelectorPresentation.js +90 -0
- package/dist/Toast/useToastGesture.d.ts.map +1 -1
- package/dist/Toast/useToastGesture.js +46 -9
- package/dist/astryx.css +19 -1
- package/dist/hooks/useAdaptivePresentation.d.ts +5 -0
- package/dist/hooks/useAdaptivePresentation.d.ts.map +1 -0
- package/dist/hooks/useAdaptivePresentation.js +19 -0
- package/dist/hooks/useFocusReturnVisibility.d.ts +7 -0
- package/dist/hooks/useFocusReturnVisibility.d.ts.map +1 -0
- package/dist/hooks/useFocusReturnVisibility.js +35 -0
- package/dist/hooks/useFocusTrap.d.ts.map +1 -1
- package/dist/hooks/useFocusTrap.js +12 -0
- package/locales/en.json +20 -0
- package/locales/pseudo.json +15 -0
- package/package.json +2 -2
- package/src/BottomSheet/BottomSheet.doc.mjs +6 -0
- package/src/BottomSheet/BottomSheet.test.tsx +29 -0
- package/src/BottomSheet/BottomSheet.tsx +7 -4
- package/src/BottomSheet/BottomSheetEdgeTint.test.tsx +4 -6
- package/src/BottomSheet/BottomSheetEdgeTint.tsx +7 -10
- package/src/BottomSheet/BottomSheetSwitcher.tsx +1 -2
- package/src/Button/Button.doc.mjs +56 -0
- package/src/Button/Button.test.tsx +10 -0
- package/src/Button/Button.tsx +13 -5
- package/src/ButtonGroup/ButtonGroup.doc.mjs +47 -0
- package/src/Carousel/Carousel.test.tsx +83 -0
- package/src/Carousel/Carousel.tsx +8 -2
- package/src/Chat/ChatToolCalls.test.tsx +44 -0
- package/src/Chat/ChatToolCalls.tsx +36 -15
- package/src/ContextMenu/ContextMenu.doc.mjs +13 -1
- package/src/ContextMenu/ContextMenu.test.tsx +131 -1
- package/src/ContextMenu/ContextMenu.tsx +199 -32
- package/src/ContextMenu/index.ts +1 -0
- package/src/DropdownMenu/DropdownMenu.doc.mjs +201 -40
- package/src/DropdownMenu/DropdownMenu.test.tsx +518 -7
- package/src/DropdownMenu/DropdownMenu.tsx +459 -28
- package/src/DropdownMenu/DropdownMenuContext.tsx +1 -1
- package/src/DropdownMenu/DropdownMenuItem.tsx +2 -0
- package/src/DropdownMenu/DropdownMenuSubMenu.doc.mjs +4 -2
- package/src/DropdownMenu/DropdownMenuSubMenu.test.tsx +124 -0
- package/src/DropdownMenu/DropdownMenuSubMenu.tsx +72 -17
- package/src/DropdownMenu/MenuBottomSheet.tsx +46 -0
- package/src/DropdownMenu/MenuBottomSheetActionList.tsx +141 -0
- package/src/DropdownMenu/index.ts +2 -0
- package/src/DropdownMenu/menuWidth.ts +51 -0
- package/src/DropdownMenu/useMenuOverflow.ts +77 -0
- package/src/IconButton/IconButton.doc.mjs +38 -0
- package/src/MoreMenu/MoreMenu.doc.mjs +17 -0
- package/src/MoreMenu/MoreMenu.test.tsx +47 -0
- package/src/MoreMenu/MoreMenu.tsx +13 -1
- package/src/MultiSelector/MultiSelector.doc.mjs +16 -0
- package/src/MultiSelector/MultiSelector.test.tsx +127 -0
- package/src/MultiSelector/MultiSelector.tsx +121 -73
- package/src/MultiSelector/index.ts +1 -0
- package/src/Popover/Popover.doc.mjs +11 -11
- package/src/Popover/Popover.test.tsx +397 -2
- package/src/Popover/Popover.tsx +228 -21
- package/src/Popover/usePopover.tsx +92 -15
- package/src/ProgressBar/ProgressBar.spec.md +208 -0
- package/src/SegmentedControl/SegmentedControl.doc.mjs +56 -0
- package/src/Selector/Selector.doc.mjs +12 -0
- package/src/Selector/Selector.test.tsx +135 -0
- package/src/Selector/Selector.tsx +141 -82
- package/src/Selector/SelectorBottomSheet.tsx +97 -0
- package/src/Selector/index.ts +1 -0
- package/src/Selector/selectorPresentation.stylex.ts +20 -0
- package/src/Selector/useSelectorPresentation.ts +147 -0
- package/src/Toast/ToastViewport.test.tsx +118 -4
- package/src/Toast/useToastGesture.ts +61 -8
- package/src/ToggleButton/ToggleButton.doc.mjs +56 -0
- package/src/hooks/useAdaptivePresentation.ts +35 -0
- package/src/hooks/useFocusReturnVisibility.ts +45 -0
- package/src/hooks/useFocusTrap.test.tsx +40 -0
- package/src/hooks/useFocusTrap.ts +13 -0
- package/src/theme/themingTargets.test.ts +91 -25
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
/**
|
|
6
6
|
* @file DropdownMenuSubMenu.tsx
|
|
7
7
|
* @input React, stylex, useLayer (context mode), useListFocus, useMenuHover,
|
|
8
|
-
* useTypeahead,
|
|
8
|
+
* useTypeahead, the shared viewport-safe menu-width resolver, Item, Icon,
|
|
9
|
+
* Spinner, and DropdownMenu context + item roles
|
|
9
10
|
* @output Exports DropdownMenuSubMenu — a single menu row that reveals a nested
|
|
10
11
|
* flyout menu of its own children/items.
|
|
11
12
|
* @position Sub-component; place inside a DropdownMenu (or ContextMenu)
|
|
@@ -47,14 +48,23 @@ import { layerAnimations } from "../Layer/layerAnimations.stylex.js";
|
|
|
47
48
|
import { useListFocus } from "../hooks/useListFocus.js";
|
|
48
49
|
import { useMenuHover } from "../hooks/useMenuHover.js";
|
|
49
50
|
import { useTypeahead } from "../hooks/useTypeahead.js";
|
|
51
|
+
import { useMenuOverflow } from "./useMenuOverflow.js";
|
|
52
|
+
import { resolveMenuWidth } from "./menuWidth.js";
|
|
50
53
|
import "../theme/tokens.stylex.js";
|
|
51
54
|
import { colorVars, spacingVars, radiusVars, durationVars, easeVars, shadowVars, typographyVars, typeScaleVars } from "../theme/tokens.stylex.js";
|
|
52
|
-
import { mergeProps } from "../utils/index.js";
|
|
55
|
+
import { mergeProps, rtlStyles } from "../utils/index.js";
|
|
53
56
|
import { themeProps } from "../utils/themeProps.js";
|
|
54
57
|
import { MENU_ITEM_ROLES, MENU_ITEM_SELECTOR, MENU_BOUNDARY_SELECTOR } from "./menuItemRoles.js";
|
|
55
58
|
import { DropdownMenuContext, useDropdownMenuContext } from "./DropdownMenuContext.js";
|
|
56
59
|
import { focusMenuItemOnHover } from "./menuItemHover.js";
|
|
57
60
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
61
|
+
const MENU_VIEWPORT_GUTTER = spacingVars['--spacing-4'];
|
|
62
|
+
// `useLayer` adds 4px of anchor clearance. An 8px collision margin resolves
|
|
63
|
+
// to a 4px visible gap after the browser flips the flyout.
|
|
64
|
+
const MENU_MAX_INLINE_SIZE = `calc(100vi - max(${MENU_VIEWPORT_GUTTER}, env(safe-area-inset-left, 0px)) - max(${MENU_VIEWPORT_GUTTER}, env(safe-area-inset-right, 0px)))`;
|
|
65
|
+
const MENU_MAX_INLINE_SIZE_FALLBACK = `calc(100vw - ${MENU_VIEWPORT_GUTTER} - ${MENU_VIEWPORT_GUTTER})`;
|
|
66
|
+
const MENU_MAX_BLOCK_SIZE = `min(300px, calc(100dvb - max(${MENU_VIEWPORT_GUTTER}, env(safe-area-inset-top, 0px)) - max(${MENU_VIEWPORT_GUTTER}, env(safe-area-inset-bottom, 0px))))`;
|
|
67
|
+
const MENU_MAX_BLOCK_SIZE_FALLBACK = `min(300px, calc(100vh - ${MENU_VIEWPORT_GUTTER} - ${MENU_VIEWPORT_GUTTER}))`;
|
|
58
68
|
const triggerStyles = {
|
|
59
69
|
root: {
|
|
60
70
|
kB7OPa: "x9f619",
|
|
@@ -95,16 +105,28 @@ const triggerSizeStyles = {
|
|
|
95
105
|
$$css: true
|
|
96
106
|
}
|
|
97
107
|
};
|
|
108
|
+
const _temp = {
|
|
109
|
+
kzqmXN: "x1uyokj7",
|
|
110
|
+
"$$css": true
|
|
111
|
+
};
|
|
98
112
|
const flyoutStyles = {
|
|
113
|
+
popoverViewport: {
|
|
114
|
+
kB7OPa: "x9f619",
|
|
115
|
+
kskxy: "x1hkkhfe",
|
|
116
|
+
$$css: true
|
|
117
|
+
},
|
|
99
118
|
popover: {
|
|
100
|
-
k7Eaqz: "
|
|
119
|
+
k7Eaqz: "x12knhqr",
|
|
101
120
|
$$css: true
|
|
102
121
|
},
|
|
103
122
|
popoverCustomWidth: width => [{
|
|
104
|
-
k7Eaqz:
|
|
123
|
+
k7Eaqz: width != null ? "xkj4a21" : width,
|
|
105
124
|
$$css: true
|
|
106
125
|
}, {
|
|
107
|
-
"--x-minWidth": (val => typeof val === "number" ? val + "px" : val != null ? val : undefined)(
|
|
126
|
+
"--x-minWidth": (val => typeof val === "number" ? val + "px" : val != null ? val : undefined)(width)
|
|
127
|
+
}],
|
|
128
|
+
popoverCustomIntrinsicWidth: width => [_temp, {
|
|
129
|
+
"--x-inlineSize": (val => typeof val === "number" ? val + "px" : val != null ? val : undefined)(width)
|
|
108
130
|
}]
|
|
109
131
|
};
|
|
110
132
|
/**
|
|
@@ -190,6 +212,7 @@ export function DropdownMenuSubMenu(props) {
|
|
|
190
212
|
focusTrigger: true
|
|
191
213
|
})
|
|
192
214
|
});
|
|
215
|
+
const hasOverflow = useMenuOverflow(menuRef, children, isOpen);
|
|
193
216
|
const typeahead = useTypeahead({
|
|
194
217
|
getItemLabels: () => getItems().map(el => el.textContent),
|
|
195
218
|
onMatch: focusItem,
|
|
@@ -366,10 +389,12 @@ export function DropdownMenuSubMenu(props) {
|
|
|
366
389
|
icon: "chevronRight",
|
|
367
390
|
size: "sm",
|
|
368
391
|
color: "secondary",
|
|
392
|
+
xstyle: rtlStyles.mirror,
|
|
369
393
|
...themeProps('dropdown-menu-indicator-icon')
|
|
370
394
|
})
|
|
371
395
|
});
|
|
372
|
-
const
|
|
396
|
+
const resolvedMenuWidth = menuWidth ? resolveMenuWidth(menuWidth, MENU_MAX_INLINE_SIZE_FALLBACK) : null;
|
|
397
|
+
const popoverXstyle = resolvedMenuWidth ? resolvedMenuWidth.property === 'inlineSize' ? flyoutStyles.popoverCustomIntrinsicWidth(resolvedMenuWidth.value) : flyoutStyles.popoverCustomWidth(resolvedMenuWidth.value) : flyoutStyles.popover;
|
|
373
398
|
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
374
399
|
children: [/*#__PURE__*/_jsx(Item, {
|
|
375
400
|
ref: el => setTriggerEl(el),
|
|
@@ -405,20 +430,24 @@ export function DropdownMenuSubMenu(props) {
|
|
|
405
430
|
ref: menuRef,
|
|
406
431
|
id: contentId,
|
|
407
432
|
role: "menu"
|
|
408
|
-
// Focusable as a fallback target so an empty/loading flyout
|
|
409
|
-
//
|
|
410
|
-
//
|
|
411
|
-
// parent list.
|
|
433
|
+
// Focusable as a fallback target so an empty/loading flyout can own
|
|
434
|
+
// arrow/Escape keys. An overflowing flyout joins the Tab order so its
|
|
435
|
+
// scrollable region is keyboard-accessible.
|
|
412
436
|
,
|
|
413
|
-
tabIndex: -1,
|
|
437
|
+
tabIndex: hasOverflow ? 0 : -1,
|
|
414
438
|
"aria-labelledby": triggerId,
|
|
415
439
|
onKeyDown: handleContentKeyDown,
|
|
416
440
|
onMouseEnter: contentProps.onMouseEnter,
|
|
417
441
|
onMouseLeave: contentProps.onMouseLeave,
|
|
418
442
|
"data-testid": menuDataTestId,
|
|
419
443
|
...mergeProps(themeProps('dropdown-menu'), {
|
|
420
|
-
|
|
421
|
-
|
|
444
|
+
0: {
|
|
445
|
+
className: "x9f619 x78zum5 xdt5ytf x1lsbc85 xs2v1xk x1hkkhfe x1fcsqxe xgory14 x9epnlk x1n97fys x1prclbq x1i5ehqx x1hc1fzr x19991ni xuedmi6 xlr8y92"
|
|
446
|
+
},
|
|
447
|
+
1: {
|
|
448
|
+
className: "x9f619 x78zum5 xdt5ytf x1lsbc85 xs2v1xk x1hkkhfe x1fcsqxe xgory14 x9epnlk x1n97fys x1prclbq x1i5ehqx x1hc1fzr x19991ni xuedmi6 xlr8y92 x1odjw0f x6ikm8r xish69e"
|
|
449
|
+
}
|
|
450
|
+
}[!!hasOverflow << 0]),
|
|
422
451
|
children: /*#__PURE__*/_jsx(DropdownMenuContext, {
|
|
423
452
|
value: nestedMenuContext,
|
|
424
453
|
children: children
|
|
@@ -427,7 +456,7 @@ export function DropdownMenuSubMenu(props) {
|
|
|
427
456
|
placement: 'end',
|
|
428
457
|
alignment: 'start',
|
|
429
458
|
offset: spacingVars['--spacing-1'],
|
|
430
|
-
xstyle: [popoverXstyle, layerAnimations.end]
|
|
459
|
+
xstyle: [flyoutStyles.popoverViewport, popoverXstyle, layerAnimations.end]
|
|
431
460
|
})]
|
|
432
461
|
});
|
|
433
462
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file MenuBottomSheet.tsx
|
|
3
|
+
* @input Uses BottomSheet and Section
|
|
4
|
+
* @output Internal action-sheet host for menu content
|
|
5
|
+
* @position Shared by DropdownMenu and ContextMenu adaptive presentations
|
|
6
|
+
*/
|
|
7
|
+
import type { ReactNode, RefObject } from 'react';
|
|
8
|
+
interface MenuBottomSheetProps {
|
|
9
|
+
finalFocusRef?: RefObject<HTMLElement | null>;
|
|
10
|
+
isOpen: boolean;
|
|
11
|
+
onOpenChange: (isOpen: boolean) => void;
|
|
12
|
+
label: string;
|
|
13
|
+
children: ReactNode;
|
|
14
|
+
}
|
|
15
|
+
export declare function MenuBottomSheet({ finalFocusRef, isOpen, onOpenChange, label, children, }: MenuBottomSheetProps): import("react").JSX.Element;
|
|
16
|
+
export declare namespace MenuBottomSheet {
|
|
17
|
+
var displayName: string;
|
|
18
|
+
}
|
|
19
|
+
export {};
|
|
20
|
+
//# sourceMappingURL=MenuBottomSheet.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MenuBottomSheet.d.ts","sourceRoot":"","sources":["../../src/DropdownMenu/MenuBottomSheet.tsx"],"names":[],"mappings":"AAIA;;;;;GAKG;AAEH,OAAO,KAAK,EAAC,SAAS,EAAE,SAAS,EAAC,MAAM,OAAO,CAAC;AAIhD,UAAU,oBAAoB;IAC5B,aAAa,CAAC,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;IAC9C,MAAM,EAAE,OAAO,CAAC;IAChB,YAAY,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;IACxC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED,wBAAgB,eAAe,CAAC,EAC9B,aAAa,EACb,MAAM,EACN,YAAY,EACZ,KAAK,EACL,QAAQ,GACT,EAAE,oBAAoB,+BActB;yBApBe,eAAe"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
'use client';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @file MenuBottomSheet.tsx
|
|
7
|
+
* @input Uses BottomSheet and Section
|
|
8
|
+
* @output Internal action-sheet host for menu content
|
|
9
|
+
* @position Shared by DropdownMenu and ContextMenu adaptive presentations
|
|
10
|
+
*/
|
|
11
|
+
import { BottomSheet } from "../BottomSheet/BottomSheet.js";
|
|
12
|
+
import { Section } from "../Section/Section.js";
|
|
13
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
+
export function MenuBottomSheet({
|
|
15
|
+
finalFocusRef,
|
|
16
|
+
isOpen,
|
|
17
|
+
onOpenChange,
|
|
18
|
+
label,
|
|
19
|
+
children
|
|
20
|
+
}) {
|
|
21
|
+
return /*#__PURE__*/_jsx(BottomSheet, {
|
|
22
|
+
finalFocusRef: finalFocusRef,
|
|
23
|
+
isOpen: isOpen,
|
|
24
|
+
onOpenChange: onOpenChange,
|
|
25
|
+
label: label,
|
|
26
|
+
height: "hug",
|
|
27
|
+
purpose: "info",
|
|
28
|
+
children: /*#__PURE__*/_jsx(Section, {
|
|
29
|
+
paddingBlockStart: 4,
|
|
30
|
+
paddingBlockEnd: 0,
|
|
31
|
+
paddingInline: 1,
|
|
32
|
+
children: children
|
|
33
|
+
})
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
MenuBottomSheet.displayName = 'MenuBottomSheet';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { DropdownMenuItemData, DropdownMenuOption } from './DropdownMenu';
|
|
2
|
+
export declare function MenuBottomSheetActionList({ items, onSelect, onOpenSubmenu, }: {
|
|
3
|
+
items: DropdownMenuOption[];
|
|
4
|
+
onSelect: (item: DropdownMenuItemData) => void;
|
|
5
|
+
onOpenSubmenu: (item: DropdownMenuItemData) => void;
|
|
6
|
+
}): import("react").JSX.Element;
|
|
7
|
+
export declare namespace MenuBottomSheetActionList {
|
|
8
|
+
var displayName: string;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=MenuBottomSheetActionList.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MenuBottomSheetActionList.d.ts","sourceRoot":"","sources":["../../src/DropdownMenu/MenuBottomSheetActionList.tsx"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAC,oBAAoB,EAAE,kBAAkB,EAAC,MAAM,gBAAgB,CAAC;AAyB7E,wBAAgB,yBAAyB,CAAC,EACxC,KAAK,EACL,QAAQ,EACR,aAAa,GACd,EAAE;IACD,KAAK,EAAE,kBAAkB,EAAE,CAAC;IAC5B,QAAQ,EAAE,CAAC,IAAI,EAAE,oBAAoB,KAAK,IAAI,CAAC;IAC/C,aAAa,EAAE,CAAC,IAAI,EAAE,oBAAoB,KAAK,IAAI,CAAC;CACrD,+BAqFA;yBA7Fe,yBAAyB"}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
'use client';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @file MenuBottomSheetActionList.tsx
|
|
7
|
+
* @input Uses menu data entries and callbacks for selection and drill-in
|
|
8
|
+
* @output Internal touch-friendly action list shared by DropdownMenu and ContextMenu
|
|
9
|
+
* @position Shared implementation for menu bottom-sheet presentations
|
|
10
|
+
*/
|
|
11
|
+
import * as stylex from '@stylexjs/stylex';
|
|
12
|
+
import { Divider } from "../Divider/index.js";
|
|
13
|
+
import { Heading } from "../Heading/index.js";
|
|
14
|
+
import { Icon, renderIconSlot } from "../Icon/index.js";
|
|
15
|
+
import { List, ListItem } from "../List/index.js";
|
|
16
|
+
import "../theme/tokens.stylex.js";
|
|
17
|
+
import { colorVars, spacingVars } from "../theme/tokens.stylex.js";
|
|
18
|
+
import { rtlStyles } from "../utils/index.js";
|
|
19
|
+
import { getInteractionModality } from "../utils/interactionModality.js";
|
|
20
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
21
|
+
const styles = {
|
|
22
|
+
destructiveAction: {
|
|
23
|
+
"--_item-label-color": "xufyqxy",
|
|
24
|
+
"--_item-description-color": "xqlix59",
|
|
25
|
+
kMwMTN: "xjt36v0",
|
|
26
|
+
$$css: true
|
|
27
|
+
},
|
|
28
|
+
divider: {
|
|
29
|
+
kqGvvJ: "xsq74q5",
|
|
30
|
+
$$css: true
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
function getItemKey(item, index) {
|
|
34
|
+
return `item-${item.id ?? index}`;
|
|
35
|
+
}
|
|
36
|
+
export function MenuBottomSheetActionList({
|
|
37
|
+
items,
|
|
38
|
+
onSelect,
|
|
39
|
+
onOpenSubmenu
|
|
40
|
+
}) {
|
|
41
|
+
const renderItem = (item, index) => {
|
|
42
|
+
const isSubmenu = item.items != null && item.items.length > 0;
|
|
43
|
+
const isDestructive = item.variant === 'destructive';
|
|
44
|
+
return /*#__PURE__*/_jsx(ListItem, {
|
|
45
|
+
label: item.label,
|
|
46
|
+
description: item.description,
|
|
47
|
+
startContent: item.icon ? renderIconSlot(item.icon, {
|
|
48
|
+
size: 'sm',
|
|
49
|
+
color: isDestructive ? 'error' : 'secondary'
|
|
50
|
+
}) : undefined,
|
|
51
|
+
endContent: isSubmenu ? /*#__PURE__*/_jsx(Icon, {
|
|
52
|
+
icon: "chevronRight",
|
|
53
|
+
size: "sm",
|
|
54
|
+
color: "secondary",
|
|
55
|
+
xstyle: rtlStyles.mirror
|
|
56
|
+
}) : item.endContent,
|
|
57
|
+
isDisabled: item.isDisabled,
|
|
58
|
+
onClick: event => {
|
|
59
|
+
if (getInteractionModality() === 'pointer') {
|
|
60
|
+
event.currentTarget.blur();
|
|
61
|
+
}
|
|
62
|
+
if (isSubmenu) {
|
|
63
|
+
onOpenSubmenu(item);
|
|
64
|
+
} else {
|
|
65
|
+
onSelect(item);
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
xstyle: isDestructive && styles.destructiveAction
|
|
69
|
+
}, getItemKey(item, index));
|
|
70
|
+
};
|
|
71
|
+
return /*#__PURE__*/_jsx(List, {
|
|
72
|
+
density: "spacious",
|
|
73
|
+
children: items.map((option, index) => {
|
|
74
|
+
if ('type' in option && option.type === 'divider') {
|
|
75
|
+
return /*#__PURE__*/_jsx("li", {
|
|
76
|
+
role: "presentation",
|
|
77
|
+
...{
|
|
78
|
+
className: "x3ct3a4"
|
|
79
|
+
},
|
|
80
|
+
children: /*#__PURE__*/_jsx(Divider, {
|
|
81
|
+
xstyle: styles.divider
|
|
82
|
+
})
|
|
83
|
+
}, `divider-${index}`);
|
|
84
|
+
}
|
|
85
|
+
if ('type' in option && option.type === 'section') {
|
|
86
|
+
return /*#__PURE__*/_jsx("li", {
|
|
87
|
+
role: "presentation",
|
|
88
|
+
...{
|
|
89
|
+
className: "x3ct3a4"
|
|
90
|
+
},
|
|
91
|
+
children: /*#__PURE__*/_jsxs("div", {
|
|
92
|
+
role: "group",
|
|
93
|
+
"aria-label": option.title,
|
|
94
|
+
...{
|
|
95
|
+
className: "x78zum5 xdt5ytf xzye2dw"
|
|
96
|
+
},
|
|
97
|
+
children: [option.title && /*#__PURE__*/_jsx(Heading, {
|
|
98
|
+
level: 4,
|
|
99
|
+
children: option.title
|
|
100
|
+
}), /*#__PURE__*/_jsx(List, {
|
|
101
|
+
density: "spacious",
|
|
102
|
+
children: option.items.map(renderItem)
|
|
103
|
+
})]
|
|
104
|
+
})
|
|
105
|
+
}, `section-${option.id ?? index}`);
|
|
106
|
+
}
|
|
107
|
+
return renderItem(option, index);
|
|
108
|
+
})
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
MenuBottomSheetActionList.displayName = 'MenuBottomSheetActionList';
|
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
* DropdownMenuContext + useListFocus path, so a new item type (e.g. a submenu)
|
|
13
13
|
* only shows up in their public API once it's aliased there too.
|
|
14
14
|
*/
|
|
15
|
-
export { DropdownMenu, type DropdownMenuProps, type DropdownMenuButtonProps, type DropdownMenuItemData, type DropdownMenuDividerData, type DropdownMenuSection, type DropdownMenuOption, } from './DropdownMenu';
|
|
15
|
+
export { DropdownMenu, type DropdownMenuProps, type DropdownMenuPresentation, type DropdownMenuButtonProps, type DropdownMenuItemData, type DropdownMenuDividerData, type DropdownMenuSection, type DropdownMenuOption, } from './DropdownMenu';
|
|
16
|
+
export type { AdaptivePresentation as MenuPresentation } from '../hooks/useAdaptivePresentation';
|
|
16
17
|
export { DropdownMenuItem, type DropdownMenuItemProps } from './DropdownMenuItem';
|
|
17
18
|
export { DropdownMenuDivider, type DropdownMenuDividerProps, } from './DropdownMenuDivider';
|
|
18
19
|
export { DropdownMenuCheckboxItem, type DropdownMenuCheckboxItemProps, } from './DropdownMenuCheckboxItem';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/DropdownMenu/index.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EACL,YAAY,EACZ,KAAK,iBAAiB,EACtB,KAAK,uBAAuB,EAC5B,KAAK,oBAAoB,EACzB,KAAK,uBAAuB,EAC5B,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,GACxB,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/DropdownMenu/index.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EACL,YAAY,EACZ,KAAK,iBAAiB,EACtB,KAAK,wBAAwB,EAC7B,KAAK,uBAAuB,EAC5B,KAAK,oBAAoB,EACzB,KAAK,uBAAuB,EAC5B,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,GACxB,MAAM,gBAAgB,CAAC;AACxB,YAAY,EAAC,oBAAoB,IAAI,gBAAgB,EAAC,MAAM,kCAAkC,CAAC;AAE/F,OAAO,EAAC,gBAAgB,EAAE,KAAK,qBAAqB,EAAC,MAAM,oBAAoB,CAAC;AAIhF,OAAO,EACL,mBAAmB,EACnB,KAAK,wBAAwB,GAC9B,MAAM,uBAAuB,CAAC;AAG/B,OAAO,EACL,wBAAwB,EACxB,KAAK,6BAA6B,GACnC,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,sBAAsB,EACtB,KAAK,2BAA2B,GACjC,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,qBAAqB,EACrB,KAAK,0BAA0B,GAChC,MAAM,yBAAyB,CAAC;AAIjC,OAAO,EACL,mBAAmB,EACnB,KAAK,wBAAwB,GAC9B,MAAM,uBAAuB,CAAC;AAI/B,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EACtB,KAAK,wBAAwB,EAC7B,KAAK,gBAAgB,GACtB,MAAM,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type ResolvedMenuWidth = {
|
|
2
|
+
property: 'inlineSize';
|
|
3
|
+
value: string;
|
|
4
|
+
} | {
|
|
5
|
+
property: 'minWidth';
|
|
6
|
+
value: string;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* CSS intrinsic and CSS-wide keywords cannot be arguments to `min()`. Apply
|
|
10
|
+
* those values as the preferred inline size so max-inline-size can still cap
|
|
11
|
+
* the menu. Lengths retain the existing minimum-width growth contract.
|
|
12
|
+
*/
|
|
13
|
+
export declare function resolveMenuWidth(menuWidth: number | string, maximum: string): ResolvedMenuWidth;
|
|
14
|
+
//# sourceMappingURL=menuWidth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"menuWidth.d.ts","sourceRoot":"","sources":["../../src/DropdownMenu/menuWidth.ts"],"names":[],"mappings":"AAuBA,MAAM,MAAM,iBAAiB,GACzB;IAAC,QAAQ,EAAE,YAAY,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAC,GACvC;IAAC,QAAQ,EAAE,UAAU,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAC,CAAC;AAE1C;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC9B,SAAS,EAAE,MAAM,GAAG,MAAM,EAC1B,OAAO,EAAE,MAAM,GACd,iBAAiB,CAenB"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file menuWidth.ts
|
|
5
|
+
* @input Accepts the public DropdownMenu menuWidth value and a viewport limit
|
|
6
|
+
* @output Resolves whether the value belongs on min-width or inline-size
|
|
7
|
+
* @position Shared width compatibility logic for root menus and submenu flyouts
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
const INTRINSIC_AND_CSS_WIDE_WIDTHS = new Set(['auto', 'contain', 'fit-content', 'inherit', 'initial', 'max-content', 'min-content', 'revert', 'revert-layer', 'stretch', 'unset']);
|
|
11
|
+
/**
|
|
12
|
+
* CSS intrinsic and CSS-wide keywords cannot be arguments to `min()`. Apply
|
|
13
|
+
* those values as the preferred inline size so max-inline-size can still cap
|
|
14
|
+
* the menu. Lengths retain the existing minimum-width growth contract.
|
|
15
|
+
*/
|
|
16
|
+
export function resolveMenuWidth(menuWidth, maximum) {
|
|
17
|
+
if (typeof menuWidth === 'number') {
|
|
18
|
+
return {
|
|
19
|
+
property: 'minWidth',
|
|
20
|
+
value: `min(${menuWidth}px, ${maximum})`
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
const width = menuWidth.trim();
|
|
24
|
+
const normalizedWidth = width.toLowerCase();
|
|
25
|
+
if (INTRINSIC_AND_CSS_WIDE_WIDTHS.has(normalizedWidth) || normalizedWidth.startsWith('fit-content(')) {
|
|
26
|
+
return {
|
|
27
|
+
property: 'inlineSize',
|
|
28
|
+
value: width
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
return {
|
|
32
|
+
property: 'minWidth',
|
|
33
|
+
value: `min(${width}, ${maximum})`
|
|
34
|
+
};
|
|
35
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file useMenuOverflow.ts
|
|
3
|
+
* @input Menu element ref, rendered content, and open state
|
|
4
|
+
* @output Returns whether the open menu overflows its block-size constraint
|
|
5
|
+
* @position Shared responsive helper for DropdownMenu and DropdownMenuSubMenu
|
|
6
|
+
*/
|
|
7
|
+
import { type ReactNode, type RefObject } from 'react';
|
|
8
|
+
/** Detect block-axis overflow without making a fitting menu a scroll container. */
|
|
9
|
+
export declare function useMenuOverflow(menuRef: RefObject<HTMLElement | null>, content: ReactNode, isOpen: boolean): boolean;
|
|
10
|
+
//# sourceMappingURL=useMenuOverflow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useMenuOverflow.d.ts","sourceRoot":"","sources":["../../src/DropdownMenu/useMenuOverflow.ts"],"names":[],"mappings":"AAIA;;;;;GAKG;AAEH,OAAO,EAAwB,KAAK,SAAS,EAAE,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAG5E,mFAAmF;AACnF,wBAAgB,eAAe,CAC7B,OAAO,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,EACtC,OAAO,EAAE,SAAS,EAClB,MAAM,EAAE,OAAO,GACd,OAAO,CAyDT"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
'use client';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @file useMenuOverflow.ts
|
|
7
|
+
* @input Menu element ref, rendered content, and open state
|
|
8
|
+
* @output Returns whether the open menu overflows its block-size constraint
|
|
9
|
+
* @position Shared responsive helper for DropdownMenu and DropdownMenuSubMenu
|
|
10
|
+
*/
|
|
11
|
+
import { useCallback, useState } from 'react';
|
|
12
|
+
import { useIsomorphicLayoutEffect } from "../hooks/useIsomorphicLayoutEffect.js";
|
|
13
|
+
|
|
14
|
+
/** Detect block-axis overflow without making a fitting menu a scroll container. */
|
|
15
|
+
export function useMenuOverflow(menuRef, content, isOpen) {
|
|
16
|
+
const [hasOverflow, setHasOverflow] = useState(false);
|
|
17
|
+
const measureOverflow = useCallback(() => {
|
|
18
|
+
const menu = menuRef.current;
|
|
19
|
+
if (!menu) {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
const nextHasOverflow = menu.scrollHeight > menu.clientHeight + 1;
|
|
23
|
+
// eslint-disable-next-line @eslint-react/set-state-in-effect -- DOM overflow measurement controls whether this menu becomes a scroll container
|
|
24
|
+
setHasOverflow(current => current === nextHasOverflow ? current : nextHasOverflow);
|
|
25
|
+
}, [menuRef]);
|
|
26
|
+
useIsomorphicLayoutEffect(() => {
|
|
27
|
+
if (!isOpen) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
const menu = menuRef.current;
|
|
31
|
+
if (!menu) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
measureOverflow();
|
|
35
|
+
const resizeObserver = typeof ResizeObserver === 'undefined' ? null : new ResizeObserver(measureOverflow);
|
|
36
|
+
const mutationObserver = typeof MutationObserver === 'undefined' ? null : new MutationObserver(measureOverflow);
|
|
37
|
+
resizeObserver?.observe(menu);
|
|
38
|
+
mutationObserver?.observe(menu, {
|
|
39
|
+
childList: true,
|
|
40
|
+
characterData: true,
|
|
41
|
+
subtree: true
|
|
42
|
+
});
|
|
43
|
+
menu.addEventListener('load', measureOverflow, true);
|
|
44
|
+
window.addEventListener('resize', measureOverflow);
|
|
45
|
+
window.visualViewport?.addEventListener('resize', measureOverflow);
|
|
46
|
+
return () => {
|
|
47
|
+
resizeObserver?.disconnect();
|
|
48
|
+
mutationObserver?.disconnect();
|
|
49
|
+
menu.removeEventListener('load', measureOverflow, true);
|
|
50
|
+
window.removeEventListener('resize', measureOverflow);
|
|
51
|
+
window.visualViewport?.removeEventListener('resize', measureOverflow);
|
|
52
|
+
};
|
|
53
|
+
}, [isOpen, measureOverflow, menuRef]);
|
|
54
|
+
useIsomorphicLayoutEffect(() => {
|
|
55
|
+
if (isOpen) {
|
|
56
|
+
measureOverflow();
|
|
57
|
+
}
|
|
58
|
+
}, [content, isOpen, measureOverflow]);
|
|
59
|
+
return hasOverflow;
|
|
60
|
+
}
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* - /packages/cli/assets/templates/blocks/components/MoreMenu/ (showcase blocks)
|
|
15
15
|
*/
|
|
16
16
|
import type { ReactNode } from 'react';
|
|
17
|
-
import type { DropdownMenuOption } from '../DropdownMenu';
|
|
17
|
+
import type { DropdownMenuOption, DropdownMenuPresentation } from '../DropdownMenu';
|
|
18
18
|
import type { LayerAlignment, LayerPlacement } from '../Layer';
|
|
19
19
|
import type { ButtonVariant, ButtonSize } from '../Button';
|
|
20
20
|
import type { BaseProps } from '../BaseProps';
|
|
@@ -64,6 +64,12 @@ export interface MoreMenuProps extends Pick<BaseProps, 'xstyle' | 'className' |
|
|
|
64
64
|
* @default 'start'
|
|
65
65
|
*/
|
|
66
66
|
alignment?: LayerAlignment;
|
|
67
|
+
/**
|
|
68
|
+
* Menu presentation policy. `adaptive` uses a BottomSheet on compact
|
|
69
|
+
* coarse-pointer viewports and an anchored popover elsewhere.
|
|
70
|
+
* @default 'popover'
|
|
71
|
+
*/
|
|
72
|
+
presentation?: DropdownMenuPresentation;
|
|
67
73
|
/**
|
|
68
74
|
* Controlled open state for the menu.
|
|
69
75
|
*/
|
|
@@ -90,7 +96,7 @@ export interface MoreMenuProps extends Pick<BaseProps, 'xstyle' | 'className' |
|
|
|
90
96
|
* />
|
|
91
97
|
* ```
|
|
92
98
|
*/
|
|
93
|
-
export declare function MoreMenu({ items, label: labelFromProps, variant, size: sizeProp, icon, isDisabled, placement, alignment, isMenuOpen, onOpenChange, xstyle, className: classNameProp, style, 'data-testid': testId, ref, }: MoreMenuProps): import("react").JSX.Element;
|
|
99
|
+
export declare function MoreMenu({ items, label: labelFromProps, variant, size: sizeProp, icon, isDisabled, placement, alignment, presentation, isMenuOpen, onOpenChange, xstyle, className: classNameProp, style, 'data-testid': testId, ref, }: MoreMenuProps): import("react").JSX.Element;
|
|
94
100
|
export declare namespace MoreMenu {
|
|
95
101
|
var displayName: string;
|
|
96
102
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MoreMenu.d.ts","sourceRoot":"","sources":["../../src/MoreMenu/MoreMenu.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,OAAO,CAAC;AAIrC,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"MoreMenu.d.ts","sourceRoot":"","sources":["../../src/MoreMenu/MoreMenu.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,OAAO,CAAC;AAIrC,OAAO,KAAK,EACV,kBAAkB,EAClB,wBAAwB,EACzB,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAC,cAAc,EAAE,cAAc,EAAC,MAAM,UAAU,CAAC;AAC7D,OAAO,KAAK,EAAC,aAAa,EAAE,UAAU,EAAC,MAAM,WAAW,CAAC;AACzD,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAI5C,MAAM,WAAW,aAAc,SAAQ,IAAI,CACzC,SAAS,EACT,QAAQ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
51
52
|
onOpenChange,
|
|
52
53
|
xstyle,
|
|
@@ -67,6 +68,7 @@ export function MoreMenu({
|
|
|
67
68
|
onOpenChange: onOpenChange,
|
|
68
69
|
placement: placement,
|
|
69
70
|
alignment: alignment,
|
|
71
|
+
presentation: presentation,
|
|
70
72
|
button: {
|
|
71
73
|
label,
|
|
72
74
|
icon: icon ?? moreIcon,
|
|
@@ -18,8 +18,10 @@ import type { IndicatorPosition } from '../Indicator';
|
|
|
18
18
|
import type { MultiSelectorOptionType, MultiSelectorOptionData, MultiSelectorStatus } from './types';
|
|
19
19
|
import type { BaseProps } from '../BaseProps';
|
|
20
20
|
import type { SizeValue } from '../utils/types';
|
|
21
|
+
import type { AdaptivePresentation } from '../hooks/useAdaptivePresentation';
|
|
21
22
|
export type MultiSelectorSize = 'sm' | 'md' | 'lg';
|
|
22
23
|
export type MultiSelectorVariant = 'input' | 'ghost';
|
|
24
|
+
export type MultiSelectorPresentation = AdaptivePresentation;
|
|
23
25
|
export type MultiSelectorStatusType = 'warning' | 'error' | 'success';
|
|
24
26
|
export type { MultiSelectorStatus };
|
|
25
27
|
export interface MultiSelectorSelectedItem {
|
|
@@ -227,6 +229,14 @@ export interface MultiSelectorProps<T extends MultiSelectorOptionType = MultiSel
|
|
|
227
229
|
* @default 'start'
|
|
228
230
|
*/
|
|
229
231
|
indicatorPosition?: IndicatorPosition;
|
|
232
|
+
/**
|
|
233
|
+
* How the option list is presented.
|
|
234
|
+
* - 'popover': anchored to the trigger
|
|
235
|
+
* - 'bottom-sheet': modal sheet suited to compact touch screens
|
|
236
|
+
* - 'adaptive': bottom sheet on compact coarse-pointer screens, otherwise popover
|
|
237
|
+
* @default 'popover'
|
|
238
|
+
*/
|
|
239
|
+
presentation?: MultiSelectorPresentation;
|
|
230
240
|
/**
|
|
231
241
|
* Whether the dropdown starts open on mount.
|
|
232
242
|
* Useful for showcases and previews.
|
|
@@ -253,7 +263,7 @@ export interface MultiSelectorProps<T extends MultiSelectorOptionType = MultiSel
|
|
|
253
263
|
* />
|
|
254
264
|
* ```
|
|
255
265
|
*/
|
|
256
|
-
export declare function MultiSelector<T extends MultiSelectorOptionType>({ label, isLabelHidden, description, isOptional, isRequired, isDisabled, disabledMessage, options, value, onChange, changeAction, isLoading, placeholder: placeholderFromProps, size: sizeProp, variant, status, statusVariant, labelTooltip, startIcon, hasClear, hasSelectAll, selectAllLabel: selectAllLabelFromProps, hasSearch, searchPlaceholder: searchPlaceholderFromProps, emptyText: emptyTextFromProps, emptySearchText: emptySearchTextFromProps, triggerDisplay, formatValue, maxBadges, renderOption, indicatorPosition, isDefaultOpen, 'data-testid': testId, htmlName, width, xstyle, className, style, }: MultiSelectorProps<T>): React.JSX.Element;
|
|
266
|
+
export declare function MultiSelector<T extends MultiSelectorOptionType>({ label, isLabelHidden, description, isOptional, isRequired, isDisabled, disabledMessage, options, value, onChange, changeAction, isLoading, placeholder: placeholderFromProps, size: sizeProp, variant, status, statusVariant, labelTooltip, startIcon, hasClear, hasSelectAll, selectAllLabel: selectAllLabelFromProps, hasSearch, searchPlaceholder: searchPlaceholderFromProps, emptyText: emptyTextFromProps, emptySearchText: emptySearchTextFromProps, triggerDisplay, formatValue, maxBadges, renderOption, indicatorPosition, presentation, isDefaultOpen, 'data-testid': testId, htmlName, width, xstyle, className, style, onFocus, }: MultiSelectorProps<T>): React.JSX.Element;
|
|
257
267
|
export declare namespace MultiSelector {
|
|
258
268
|
var displayName: string;
|
|
259
269
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MultiSelector.d.ts","sourceRoot":"","sources":["../../src/MultiSelector/MultiSelector.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,EASZ,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"MultiSelector.d.ts","sourceRoot":"","sources":["../../src/MultiSelector/MultiSelector.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAY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