@seed-design/lynx-react 0.6.2 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/components/Accordion/Accordion.d.ts.map +1 -1
- package/lib/components/Accordion/Accordion.jsx +24 -14
- package/lib/components/ActionButton/ActionButton.d.ts +1 -1
- package/lib/components/ActionButton/ActionButton.d.ts.map +1 -1
- package/lib/components/ActionButton/ActionButton.jsx +12 -4
- package/lib/components/AppBar/AppBar.d.ts.map +1 -1
- package/lib/components/AppBar/AppBar.jsx +9 -8
- package/lib/components/Badge/Badge.d.ts.map +1 -1
- package/lib/components/Badge/Badge.jsx +2 -1
- package/lib/components/BottomSheet/BottomSheet.d.ts.map +1 -1
- package/lib/components/BottomSheet/BottomSheet.jsx +9 -9
- package/lib/components/Box/Box.d.ts.map +1 -1
- package/lib/components/Box/Box.jsx +2 -1
- package/lib/components/Callout/Callout.d.ts +2 -2
- package/lib/components/Callout/Callout.d.ts.map +1 -1
- package/lib/components/Callout/Callout.jsx +20 -10
- package/lib/components/Checkbox/Checkbox.d.ts +4 -2
- package/lib/components/Checkbox/Checkbox.d.ts.map +1 -1
- package/lib/components/Checkbox/Checkbox.jsx +33 -17
- package/lib/components/Chip/Chip.d.ts +1 -1
- package/lib/components/Chip/Chip.d.ts.map +1 -1
- package/lib/components/Chip/Chip.jsx +36 -16
- package/lib/components/Count/Count.d.ts +7 -0
- package/lib/components/Count/Count.d.ts.map +1 -0
- package/lib/components/Count/Count.jsx +19 -0
- package/lib/components/Count/index.d.ts +2 -0
- package/lib/components/Count/index.d.ts.map +1 -0
- package/lib/components/Divider/Divider.d.ts.map +1 -1
- package/lib/components/Divider/Divider.jsx +2 -1
- package/lib/components/Field/Field.d.ts.map +1 -1
- package/lib/components/Field/Field.jsx +11 -15
- package/lib/components/Icon/Icon.d.ts.map +1 -1
- package/lib/components/Icon/Icon.jsx +4 -3
- package/lib/components/InputButton/InputButton.d.ts +40 -0
- package/lib/components/InputButton/InputButton.d.ts.map +1 -0
- package/lib/components/InputButton/InputButton.jsx +118 -0
- package/lib/components/InputButton/InputButton.namespace.d.ts +2 -0
- package/lib/components/InputButton/InputButton.namespace.d.ts.map +1 -0
- package/lib/components/InputButton/InputButton.namespace.js +16 -0
- package/lib/components/InputButton/index.d.ts +3 -0
- package/lib/components/InputButton/index.d.ts.map +1 -0
- package/lib/components/KeyboardAvoidingScrollView/KeyboardAvoidingScrollView.d.ts.map +1 -1
- package/lib/components/KeyboardAvoidingScrollView/KeyboardAvoidingScrollView.jsx +12 -8
- package/lib/components/List/List.d.ts +51 -0
- package/lib/components/List/List.d.ts.map +1 -0
- package/lib/components/List/List.jsx +176 -0
- package/lib/components/List/List.namespace.d.ts +2 -0
- package/lib/components/List/List.namespace.d.ts.map +1 -0
- package/lib/components/List/List.namespace.js +18 -0
- package/lib/components/List/index.d.ts +3 -0
- package/lib/components/List/index.d.ts.map +1 -0
- package/lib/components/MannerTemp/MannerTemp.d.ts.map +1 -1
- package/lib/components/MannerTemp/MannerTemp.jsx +3 -2
- package/lib/components/MannerTempBadge/MannerTempBadge.d.ts.map +1 -1
- package/lib/components/MannerTempBadge/MannerTempBadge.jsx +2 -1
- package/lib/components/Menu/Menu.d.ts +69 -0
- package/lib/components/Menu/Menu.d.ts.map +1 -0
- package/lib/components/Menu/Menu.jsx +520 -0
- package/lib/components/Menu/Menu.namespace.d.ts +2 -0
- package/lib/components/Menu/Menu.namespace.d.ts.map +1 -0
- package/lib/components/Menu/Menu.namespace.js +21 -0
- package/lib/components/Menu/index.d.ts +3 -0
- package/lib/components/Menu/index.d.ts.map +1 -0
- package/lib/components/NotificationBadge/NotificationBadge.d.ts.map +1 -1
- package/lib/components/NotificationBadge/NotificationBadge.jsx +3 -2
- package/lib/components/PageBanner/PageBanner.d.ts +5 -5
- package/lib/components/PageBanner/PageBanner.d.ts.map +1 -1
- package/lib/components/PageBanner/PageBanner.jsx +25 -14
- package/lib/components/ProgressCircle/ProgressCircle.d.ts +2 -2
- package/lib/components/ProgressCircle/ProgressCircle.d.ts.map +1 -1
- package/lib/components/ProgressCircle/ProgressCircle.jsx +4 -3
- package/lib/components/RadioGroup/RadioGroup.d.ts +5 -3
- package/lib/components/RadioGroup/RadioGroup.d.ts.map +1 -1
- package/lib/components/RadioGroup/RadioGroup.jsx +22 -9
- package/lib/components/ReactionButton/ReactionButton.d.ts +20 -0
- package/lib/components/ReactionButton/ReactionButton.d.ts.map +1 -0
- package/lib/components/ReactionButton/ReactionButton.jsx +88 -0
- package/lib/components/ReactionButton/index.d.ts +2 -0
- package/lib/components/ReactionButton/index.d.ts.map +1 -0
- package/lib/components/ScaleFeedback/ScaleFeedback.d.ts +11 -0
- package/lib/components/ScaleFeedback/ScaleFeedback.d.ts.map +1 -0
- package/lib/components/ScaleFeedback/ScaleFeedback.jsx +16 -0
- package/lib/components/ScaleFeedback/index.d.ts +2 -0
- package/lib/components/ScaleFeedback/index.d.ts.map +1 -0
- package/lib/components/SegmentedControl/SegmentedControl.d.ts +1 -0
- package/lib/components/SegmentedControl/SegmentedControl.d.ts.map +1 -1
- package/lib/components/SegmentedControl/SegmentedControl.jsx +23 -10
- package/lib/components/SelectBox/SelectBox.d.ts.map +1 -1
- package/lib/components/SelectBox/SelectBox.jsx +23 -13
- package/lib/components/Stack/Stack.d.ts.map +1 -1
- package/lib/components/Stack/Stack.jsx +2 -1
- package/lib/components/SwipeableMenuSheet/SwipeableMenuSheet.d.ts +85 -0
- package/lib/components/SwipeableMenuSheet/SwipeableMenuSheet.d.ts.map +1 -0
- package/lib/components/SwipeableMenuSheet/SwipeableMenuSheet.jsx +256 -0
- package/lib/components/SwipeableMenuSheet/SwipeableMenuSheet.namespace.d.ts +2 -0
- package/lib/components/SwipeableMenuSheet/SwipeableMenuSheet.namespace.d.ts.map +1 -0
- package/lib/components/SwipeableMenuSheet/SwipeableMenuSheet.namespace.js +24 -0
- package/lib/components/SwipeableMenuSheet/index.d.ts +3 -0
- package/lib/components/SwipeableMenuSheet/index.d.ts.map +1 -0
- package/lib/components/Switch/Switch.d.ts +27 -3
- package/lib/components/Switch/Switch.d.ts.map +1 -1
- package/lib/components/Switch/Switch.jsx +22 -9
- package/lib/components/Tabs/Tabs.d.ts +4 -2
- package/lib/components/Tabs/Tabs.d.ts.map +1 -1
- package/lib/components/Tabs/Tabs.jsx +37 -22
- package/lib/components/TagGroup/TagGroup.d.ts.map +1 -1
- package/lib/components/TagGroup/TagGroup.jsx +4 -3
- package/lib/components/Text/Text.d.ts.map +1 -1
- package/lib/components/Text/Text.jsx +2 -1
- package/lib/components/TextField/TextField.d.ts.map +1 -1
- package/lib/components/TextField/TextField.jsx +35 -23
- package/lib/components/index.d.ts +7 -0
- package/lib/components/index.d.ts.map +1 -1
- package/lib/components/private/Positioning.d.ts +69 -0
- package/lib/components/private/Positioning.d.ts.map +1 -0
- package/lib/components/private/Positioning.js +109 -0
- package/lib/components/private/TrackPositioning.d.ts +22 -0
- package/lib/components/private/TrackPositioning.d.ts.map +1 -0
- package/lib/contexts/ScaleFeedbackContentContext.d.ts +4 -0
- package/lib/contexts/ScaleFeedbackContentContext.d.ts.map +1 -0
- package/lib/contexts/ScaleFeedbackContentContext.js +6 -0
- package/lib/contexts/index.d.ts +2 -0
- package/lib/contexts/index.d.ts.map +1 -0
- package/lib/hooks/index.d.ts +1 -0
- package/lib/hooks/index.d.ts.map +1 -1
- package/lib/hooks/useIconColor.d.ts.map +1 -1
- package/lib/hooks/useIconColor.js +8 -3
- package/lib/hooks/usePressTap.d.ts +4 -3
- package/lib/hooks/usePressTap.d.ts.map +1 -1
- package/lib/hooks/useScaleFeedback.d.ts +48 -0
- package/lib/hooks/useScaleFeedback.d.ts.map +1 -0
- package/lib/hooks/useScaleFeedback.js +108 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +17 -3
- package/lib/node_modules/.bun/@floating-ui_core@1.8.0/node_modules/@floating-ui/core/dist/floating-ui.core.js +493 -0
- package/lib/node_modules/.bun/@floating-ui_utils@0.2.12/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +114 -0
- package/lib/utils/calculate-scale-feedback.d.ts +5 -0
- package/lib/utils/calculate-scale-feedback.d.ts.map +1 -0
- package/lib/utils/calculate-scale-feedback.js +13 -0
- package/lib/utils/compose-event-handlers.d.ts +5 -0
- package/lib/utils/compose-event-handlers.d.ts.map +1 -0
- package/lib/utils/compose-event-handlers.js +16 -0
- package/lib/utils/create-slot-recipe-context.d.ts.map +1 -1
- package/lib/utils/create-slot-recipe-context.jsx +6 -16
- package/lib/utils/index.d.ts +1 -0
- package/lib/utils/index.d.ts.map +1 -1
- package/lib/utils/merge-props.d.ts +15 -0
- package/lib/utils/merge-props.d.ts.map +1 -0
- package/lib/utils/merge-props.js +36 -0
- package/lib/utils/merge-refs.d.ts +8 -0
- package/lib/utils/merge-refs.d.ts.map +1 -0
- package/lib/utils/merge-refs.js +38 -0
- package/package.json +6 -5
- package/src/components/Accordion/Accordion.tsx +36 -27
- package/src/components/ActionButton/ActionButton.tsx +27 -12
- package/src/components/AppBar/AppBar.tsx +17 -18
- package/src/components/Badge/Badge.tsx +2 -2
- package/src/components/BottomSheet/BottomSheet.tsx +9 -17
- package/src/components/Box/Box.tsx +2 -2
- package/src/components/Callout/Callout.tsx +39 -22
- package/src/components/Checkbox/Checkbox.test.tsx +44 -0
- package/src/components/Checkbox/Checkbox.tsx +52 -21
- package/src/components/Chip/Chip.test.tsx +50 -1
- package/src/components/Chip/Chip.tsx +75 -31
- package/src/components/Count/Count.tsx +35 -0
- package/src/components/Count/index.ts +1 -0
- package/src/components/Divider/Divider.tsx +2 -2
- package/src/components/Field/Field.tsx +15 -28
- package/src/components/Icon/Icon.test.tsx +4 -6
- package/src/components/Icon/Icon.tsx +14 -7
- package/src/components/InputButton/InputButton.namespace.ts +20 -0
- package/src/components/InputButton/InputButton.test.tsx +82 -0
- package/src/components/InputButton/InputButton.tsx +295 -0
- package/src/components/InputButton/index.ts +2 -0
- package/src/components/KeyboardAvoidingScrollView/KeyboardAvoidingScrollView.tsx +16 -21
- package/src/components/List/List.namespace.ts +24 -0
- package/src/components/List/List.test.tsx +162 -0
- package/src/components/List/List.tsx +476 -0
- package/src/components/List/index.ts +3 -0
- package/src/components/MannerTemp/MannerTemp.tsx +3 -4
- package/src/components/MannerTempBadge/MannerTempBadge.tsx +2 -2
- package/src/components/Menu/Menu.namespace.ts +26 -0
- package/src/components/Menu/Menu.tsx +883 -0
- package/src/components/Menu/index.ts +31 -0
- package/src/components/NotificationBadge/NotificationBadge.tsx +4 -9
- package/src/components/PageBanner/PageBanner.test.tsx +3 -0
- package/src/components/PageBanner/PageBanner.tsx +54 -45
- package/src/components/ProgressCircle/ProgressCircle.test.tsx +48 -0
- package/src/components/ProgressCircle/ProgressCircle.tsx +22 -3
- package/src/components/RadioGroup/RadioGroup.test.tsx +87 -0
- package/src/components/RadioGroup/RadioGroup.tsx +50 -14
- package/src/components/ReactionButton/ReactionButton.test.tsx +122 -0
- package/src/components/ReactionButton/ReactionButton.tsx +139 -0
- package/src/components/ReactionButton/index.ts +1 -0
- package/src/components/ScaleFeedback/ScaleFeedback.test.tsx +41 -0
- package/src/components/ScaleFeedback/ScaleFeedback.tsx +32 -0
- package/src/components/ScaleFeedback/index.ts +1 -0
- package/src/components/SegmentedControl/SegmentedControl.test.tsx +15 -3
- package/src/components/SegmentedControl/SegmentedControl.tsx +35 -14
- package/src/components/SelectBox/SelectBox.test.tsx +39 -1
- package/src/components/SelectBox/SelectBox.tsx +27 -16
- package/src/components/Stack/Stack.tsx +2 -2
- package/src/components/SwipeableMenuSheet/SwipeableMenuSheet.namespace.ts +37 -0
- package/src/components/SwipeableMenuSheet/SwipeableMenuSheet.test.tsx +258 -0
- package/src/components/SwipeableMenuSheet/SwipeableMenuSheet.tsx +655 -0
- package/src/components/SwipeableMenuSheet/index.ts +43 -0
- package/src/components/Switch/Switch.test.tsx +57 -0
- package/src/components/Switch/Switch.tsx +60 -16
- package/src/components/Tabs/Tabs.test.tsx +19 -0
- package/src/components/Tabs/Tabs.tsx +72 -40
- package/src/components/TagGroup/TagGroup.tsx +4 -6
- package/src/components/Text/Text.tsx +2 -2
- package/src/components/TextField/TextField.tsx +60 -54
- package/src/components/index.ts +7 -0
- package/src/components/private/Positioning.test.ts +235 -0
- package/src/components/private/Positioning.ts +223 -0
- package/src/components/private/TrackPositioning.test.ts +58 -0
- package/src/components/private/TrackPositioning.ts +37 -0
- package/src/contexts/ScaleFeedbackContentContext.ts +4 -0
- package/src/contexts/index.ts +1 -0
- package/src/hooks/index.ts +1 -0
- package/src/hooks/useIconColor.test.ts +4 -4
- package/src/hooks/useIconColor.ts +13 -6
- package/src/hooks/usePressTap.ts +4 -3
- package/src/hooks/useScaleFeedback.integration.test.tsx +85 -0
- package/src/hooks/useScaleFeedback.test.ts +50 -0
- package/src/hooks/useScaleFeedback.ts +199 -0
- package/src/index.ts +1 -0
- package/src/utils/calculate-scale-feedback.ts +12 -0
- package/src/utils/compose-event-handlers.ts +16 -0
- package/src/utils/create-slot-recipe-context.tsx +6 -7
- package/src/utils/index.ts +1 -0
- package/src/utils/merge-props.test.tsx +152 -0
- package/src/utils/merge-props.ts +62 -0
- package/src/utils/merge-refs.ts +44 -0
|
@@ -0,0 +1,520 @@
|
|
|
1
|
+
import { useControllableState } from "../../hooks/useControllableState.js";
|
|
2
|
+
import { usePressTap } from "../../hooks/usePressTap.js";
|
|
3
|
+
import { toArray } from "../../utils/children.js";
|
|
4
|
+
import { IconSlotProvider } from "../Icon/Icon.jsx";
|
|
5
|
+
import { computePosition } from "../private/Positioning.js";
|
|
6
|
+
import * as React from "@lynx-js/react";
|
|
7
|
+
import clsx from "clsx";
|
|
8
|
+
import { getRectByRef } from "@lynx-js/lynx-ui-common";
|
|
9
|
+
import { menu } from "@seed-design/lynx-css/vars/component";
|
|
10
|
+
import { menu as menu$1 } from "@seed-design/lynx-css/recipes/menu";
|
|
11
|
+
import { menuItem } from "@seed-design/lynx-css/recipes/menu-item";
|
|
12
|
+
//#region src/components/Menu/Menu.tsx
|
|
13
|
+
var menuMaxHeight = Number.parseFloat(menu.base.enabled.root.maxHeight);
|
|
14
|
+
var menuMinimumHeight = 200;
|
|
15
|
+
var MenuContext = React.createContext(null);
|
|
16
|
+
var MenuItemClassNamesContext = React.createContext(null);
|
|
17
|
+
var MenuGroupPositionContext = React.createContext({ isFirst: true });
|
|
18
|
+
function useMenuContext(consumer) {
|
|
19
|
+
const context = React.useContext(MenuContext);
|
|
20
|
+
if (!context) throw new Error(`<${consumer}/> must be rendered inside <MenuRoot/>.`);
|
|
21
|
+
return context;
|
|
22
|
+
}
|
|
23
|
+
function useMenuItemClassNames(consumer) {
|
|
24
|
+
const context = React.useContext(MenuItemClassNamesContext);
|
|
25
|
+
if (!context) throw new Error(`<${consumer}/> must be rendered inside <MenuItem/>.`);
|
|
26
|
+
return context;
|
|
27
|
+
}
|
|
28
|
+
function mergeNodeRef(forwardedRef, node) {
|
|
29
|
+
if (typeof forwardedRef === "function") forwardedRef(node);
|
|
30
|
+
else if (forwardedRef) forwardedRef.current = node;
|
|
31
|
+
}
|
|
32
|
+
function getScreenRect() {
|
|
33
|
+
const systemInfo = typeof SystemInfo === "undefined" ? void 0 : SystemInfo;
|
|
34
|
+
const pixelWidth = systemInfo?.pixelWidth;
|
|
35
|
+
const pixelHeight = systemInfo?.pixelHeight;
|
|
36
|
+
const pixelRatio = systemInfo?.pixelRatio;
|
|
37
|
+
if (typeof pixelWidth !== "number" || typeof pixelHeight !== "number" || typeof pixelRatio !== "number" || pixelWidth <= 0 || pixelHeight <= 0 || pixelRatio <= 0) return null;
|
|
38
|
+
const width = pixelWidth / pixelRatio;
|
|
39
|
+
const height = pixelHeight / pixelRatio;
|
|
40
|
+
return {
|
|
41
|
+
left: 0,
|
|
42
|
+
top: 0,
|
|
43
|
+
right: width,
|
|
44
|
+
bottom: height,
|
|
45
|
+
width,
|
|
46
|
+
height
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
function getRootRect() {
|
|
50
|
+
"background only";
|
|
51
|
+
return getRectByRef({ current: lynx.createSelectorQuery().selectRoot() }, true);
|
|
52
|
+
}
|
|
53
|
+
function toPixel(value) {
|
|
54
|
+
return `${value}px`;
|
|
55
|
+
}
|
|
56
|
+
function getLayoutSize(event) {
|
|
57
|
+
const width = event.detail?.width ?? event.params?.width;
|
|
58
|
+
const height = event.detail?.height ?? event.params?.height;
|
|
59
|
+
if (!Number.isFinite(width) || !Number.isFinite(height)) return null;
|
|
60
|
+
return {
|
|
61
|
+
width: Math.max(0, width),
|
|
62
|
+
height: Math.max(0, height)
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
function hasExitTransition(event) {
|
|
66
|
+
if (event.target.uid !== event.currentTarget.uid) return false;
|
|
67
|
+
return event.params.animation_type === "transition-opacity" || event.params.animation_name === "opacity";
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* @platform Lynx
|
|
71
|
+
*
|
|
72
|
+
* Lynx menu supports native tap and accessibility semantics. It does not expose
|
|
73
|
+
* web DOM focus, keyboard navigation, typeahead, `asChild`, or nested submenus.
|
|
74
|
+
*/
|
|
75
|
+
var MenuRoot = React.forwardRef((props, ref) => {
|
|
76
|
+
const { size: sizeProp = "medium", open: openProp, ...restProps } = props;
|
|
77
|
+
const [variantProps, otherProps] = menu$1.splitVariantProps({
|
|
78
|
+
...restProps,
|
|
79
|
+
size: sizeProp === "responsive" ? void 0 : sizeProp
|
|
80
|
+
});
|
|
81
|
+
const { children, className, defaultOpen = false, onOpenChange, disabled = false, placement = "bottom", gutter = 8, overflowPadding = 8, matchReferenceWidth = false, ...nativeProps } = otherProps;
|
|
82
|
+
const [open, setOpen] = useControllableState({
|
|
83
|
+
value: openProp,
|
|
84
|
+
defaultValue: defaultOpen
|
|
85
|
+
});
|
|
86
|
+
const [mounted, setMounted] = React.useState(open);
|
|
87
|
+
const [positionedEpoch, setPositionedEpoch] = React.useState(null);
|
|
88
|
+
const isOpenRef = React.useRef(open);
|
|
89
|
+
const openEpochRef = React.useRef(0);
|
|
90
|
+
if (open && !isOpenRef.current) openEpochRef.current++;
|
|
91
|
+
isOpenRef.current = open;
|
|
92
|
+
const openEpoch = openEpochRef.current;
|
|
93
|
+
const positioned = positionedEpoch === openEpoch;
|
|
94
|
+
const setPositioned = React.useCallback((nextPositioned) => setPositionedEpoch(nextPositioned ? openEpochRef.current : null), []);
|
|
95
|
+
const [triggerHandlers, setTriggerHandlers] = React.useState({});
|
|
96
|
+
const anchorRef = React.useRef(null);
|
|
97
|
+
const triggerRef = React.useRef(null);
|
|
98
|
+
React.useEffect(() => {
|
|
99
|
+
"background only";
|
|
100
|
+
if (open) {
|
|
101
|
+
setMounted(true);
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
if (!positioned) setMounted(false);
|
|
105
|
+
}, [open, positioned]);
|
|
106
|
+
const requestOpen = React.useCallback((nextOpen, details) => {
|
|
107
|
+
"background only";
|
|
108
|
+
if (disabled && nextOpen) return;
|
|
109
|
+
if (nextOpen === open) return;
|
|
110
|
+
setOpen(nextOpen);
|
|
111
|
+
onOpenChange?.(nextOpen, details);
|
|
112
|
+
}, [
|
|
113
|
+
disabled,
|
|
114
|
+
onOpenChange,
|
|
115
|
+
open,
|
|
116
|
+
setOpen
|
|
117
|
+
]);
|
|
118
|
+
const finishClose = React.useCallback((immediate = false) => {
|
|
119
|
+
"background only";
|
|
120
|
+
if (immediate || !isOpenRef.current) {
|
|
121
|
+
setMounted(false);
|
|
122
|
+
setPositionedEpoch(null);
|
|
123
|
+
}
|
|
124
|
+
}, []);
|
|
125
|
+
const screenRect = getScreenRect();
|
|
126
|
+
const resolvedSize = sizeProp === "responsive" && screenRect?.width != null && screenRect.width >= 1280 ? "small" : variantProps.size ?? "medium";
|
|
127
|
+
const classes = menu$1({
|
|
128
|
+
size: resolvedSize,
|
|
129
|
+
open,
|
|
130
|
+
positioned
|
|
131
|
+
});
|
|
132
|
+
const contextValue = React.useMemo(() => ({
|
|
133
|
+
open,
|
|
134
|
+
mounted,
|
|
135
|
+
openEpoch,
|
|
136
|
+
disabled,
|
|
137
|
+
size: resolvedSize,
|
|
138
|
+
placement,
|
|
139
|
+
gutter,
|
|
140
|
+
overflowPadding,
|
|
141
|
+
matchReferenceWidth,
|
|
142
|
+
isOpenRef,
|
|
143
|
+
openEpochRef,
|
|
144
|
+
anchorRef,
|
|
145
|
+
triggerRef,
|
|
146
|
+
triggerHandlers,
|
|
147
|
+
setTriggerHandlers,
|
|
148
|
+
classes,
|
|
149
|
+
positioned,
|
|
150
|
+
setPositioned,
|
|
151
|
+
requestOpen,
|
|
152
|
+
finishClose
|
|
153
|
+
}), [
|
|
154
|
+
classes,
|
|
155
|
+
disabled,
|
|
156
|
+
finishClose,
|
|
157
|
+
gutter,
|
|
158
|
+
matchReferenceWidth,
|
|
159
|
+
mounted,
|
|
160
|
+
openEpoch,
|
|
161
|
+
setPositioned,
|
|
162
|
+
openEpochRef,
|
|
163
|
+
triggerHandlers,
|
|
164
|
+
resolvedSize,
|
|
165
|
+
open,
|
|
166
|
+
overflowPadding,
|
|
167
|
+
placement,
|
|
168
|
+
positioned,
|
|
169
|
+
requestOpen
|
|
170
|
+
]);
|
|
171
|
+
return <MenuContext.Provider value={contextValue}>
|
|
172
|
+
<view {...ref ? { ref } : {}} className={className} {...nativeProps}>
|
|
173
|
+
{children}
|
|
174
|
+
</view>
|
|
175
|
+
</MenuContext.Provider>;
|
|
176
|
+
});
|
|
177
|
+
MenuRoot.displayName = "MenuRoot";
|
|
178
|
+
var MenuAnchor = React.forwardRef((props, ref) => {
|
|
179
|
+
const { children, className, ...nativeProps } = props;
|
|
180
|
+
const context = useMenuContext("MenuAnchor");
|
|
181
|
+
const handleRef = React.useCallback((node) => {
|
|
182
|
+
context.anchorRef.current = node;
|
|
183
|
+
mergeNodeRef(ref, node);
|
|
184
|
+
}, [context.anchorRef, ref]);
|
|
185
|
+
return <view ref={handleRef} className={className} {...nativeProps}>
|
|
186
|
+
{children}
|
|
187
|
+
</view>;
|
|
188
|
+
});
|
|
189
|
+
MenuAnchor.displayName = "MenuAnchor";
|
|
190
|
+
var MenuTrigger = React.forwardRef((props, ref) => {
|
|
191
|
+
const { children, className, bindtap, "main-thread:bindtap": mainThreadBindtap, disabled: disabledProp = false, "accessibility-element": accessibilityElement = true, "accessibility-label": accessibilityLabel, "accessibility-traits": accessibilityTraits, ...nativeProps } = props;
|
|
192
|
+
const context = useMenuContext("MenuTrigger");
|
|
193
|
+
const disabled = context.disabled || disabledProp;
|
|
194
|
+
const { bindtap: proxyBindtap, ...pressHandlers } = usePressTap({
|
|
195
|
+
disabled,
|
|
196
|
+
onTap: React.useCallback((event, instance) => {
|
|
197
|
+
"background only";
|
|
198
|
+
context.requestOpen(!context.open, {
|
|
199
|
+
reason: "trigger",
|
|
200
|
+
event
|
|
201
|
+
});
|
|
202
|
+
bindtap?.(event, instance);
|
|
203
|
+
}, [bindtap, context]),
|
|
204
|
+
mainThreadOnTap: mainThreadBindtap
|
|
205
|
+
});
|
|
206
|
+
const mainThreadProxyBindtap = pressHandlers["main-thread:bindtap"];
|
|
207
|
+
React.useEffect(() => {
|
|
208
|
+
"background only";
|
|
209
|
+
context.setTriggerHandlers({
|
|
210
|
+
bindtap: proxyBindtap,
|
|
211
|
+
"main-thread:bindtap": mainThreadProxyBindtap
|
|
212
|
+
});
|
|
213
|
+
return () => context.setTriggerHandlers({});
|
|
214
|
+
}, [
|
|
215
|
+
context.setTriggerHandlers,
|
|
216
|
+
mainThreadProxyBindtap,
|
|
217
|
+
proxyBindtap
|
|
218
|
+
]);
|
|
219
|
+
const handleRef = React.useCallback((node) => {
|
|
220
|
+
context.triggerRef.current = node;
|
|
221
|
+
mergeNodeRef(ref, node);
|
|
222
|
+
}, [context.triggerRef, ref]);
|
|
223
|
+
return <view ref={handleRef} className={className} accessibility-element={accessibilityElement} accessibility-label={accessibilityLabel} accessibility-role-description="button" accessibility-value={context.open ? "expanded" : "collapsed"} accessibility-traits={disabled ? "disabled" : accessibilityTraits ?? "button"} {...nativeProps} {...pressHandlers} bindtap={proxyBindtap}>
|
|
224
|
+
{children}
|
|
225
|
+
</view>;
|
|
226
|
+
});
|
|
227
|
+
MenuTrigger.displayName = "MenuTrigger";
|
|
228
|
+
var MenuContent = React.forwardRef((props, ref) => {
|
|
229
|
+
const { children, className, style, ...nativeProps } = props;
|
|
230
|
+
const context = useMenuContext("MenuContent");
|
|
231
|
+
const measurementVersionRef = React.useRef(0);
|
|
232
|
+
const intrinsicWidthRef = React.useRef(null);
|
|
233
|
+
const [overlayNode, setOverlayNode] = React.useState(null);
|
|
234
|
+
const measurementConfigRef = React.useRef(0);
|
|
235
|
+
const [intrinsicSize, setIntrinsicSize] = React.useState(null);
|
|
236
|
+
const [position, setPosition] = React.useState(null);
|
|
237
|
+
const [widthConstraint, setWidthConstraint] = React.useState(null);
|
|
238
|
+
const [overlayRect, setOverlayRect] = React.useState(null);
|
|
239
|
+
const [triggerRect, setTriggerRect] = React.useState(null);
|
|
240
|
+
const measurePosition = React.useCallback(async () => {
|
|
241
|
+
"background only";
|
|
242
|
+
const referenceNode = context.anchorRef.current ?? context.triggerRef.current;
|
|
243
|
+
const triggerNode = context.triggerRef.current;
|
|
244
|
+
const openEpoch = context.openEpoch;
|
|
245
|
+
if (!context.open || !referenceNode || !overlayNode || !intrinsicSize || intrinsicSize.epoch !== openEpoch || intrinsicSize.config !== measurementConfigRef.current) return;
|
|
246
|
+
const version = ++measurementVersionRef.current;
|
|
247
|
+
try {
|
|
248
|
+
const [reference, boundary, overlay, trigger] = await Promise.all([
|
|
249
|
+
getRectByRef({ current: referenceNode }, true),
|
|
250
|
+
getRootRect(),
|
|
251
|
+
getRectByRef({ current: overlayNode }, true),
|
|
252
|
+
triggerNode ? getRectByRef({ current: triggerNode }, true) : Promise.resolve(null)
|
|
253
|
+
]);
|
|
254
|
+
if (version !== measurementVersionRef.current || !context.isOpenRef.current || openEpoch !== context.openEpochRef.current) return;
|
|
255
|
+
const intrinsicWidth = context.matchReferenceWidth ? reference.width : intrinsicWidthRef.current ?? intrinsicSize.width;
|
|
256
|
+
const width = widthConstraint ?? intrinsicWidth;
|
|
257
|
+
const nextPosition = await computePosition({
|
|
258
|
+
reference,
|
|
259
|
+
boundary,
|
|
260
|
+
width,
|
|
261
|
+
height: Math.min(intrinsicSize.height, menuMaxHeight),
|
|
262
|
+
placement: context.placement,
|
|
263
|
+
gutter: context.gutter,
|
|
264
|
+
overflowPadding: context.overflowPadding,
|
|
265
|
+
flip: { fallbackStrategy: "bestFit" },
|
|
266
|
+
shift: { crossAxis: true },
|
|
267
|
+
size: {
|
|
268
|
+
order: "beforeFlip",
|
|
269
|
+
minimumHeight: menuMinimumHeight
|
|
270
|
+
}
|
|
271
|
+
});
|
|
272
|
+
if (version !== measurementVersionRef.current || !context.isOpenRef.current || openEpoch !== context.openEpochRef.current) return;
|
|
273
|
+
if (nextPosition.availableWidth < width) {
|
|
274
|
+
const constrainedWidth = nextPosition.availableWidth;
|
|
275
|
+
if (widthConstraint !== constrainedWidth) {
|
|
276
|
+
setWidthConstraint(constrainedWidth);
|
|
277
|
+
setIntrinsicSize(null);
|
|
278
|
+
setPosition(null);
|
|
279
|
+
setOverlayRect(null);
|
|
280
|
+
setTriggerRect(null);
|
|
281
|
+
context.setPositioned(false);
|
|
282
|
+
}
|
|
283
|
+
return;
|
|
284
|
+
}
|
|
285
|
+
setPosition((previous) => {
|
|
286
|
+
if (previous?.left === nextPosition.left && previous.top === nextPosition.top && previous.width === nextPosition.width && previous.height === nextPosition.height && previous.placement === nextPosition.placement) return previous;
|
|
287
|
+
return nextPosition;
|
|
288
|
+
});
|
|
289
|
+
setOverlayRect(overlay);
|
|
290
|
+
setTriggerRect(trigger);
|
|
291
|
+
context.setPositioned(true);
|
|
292
|
+
} catch {}
|
|
293
|
+
}, [
|
|
294
|
+
context,
|
|
295
|
+
intrinsicSize,
|
|
296
|
+
overlayNode,
|
|
297
|
+
widthConstraint
|
|
298
|
+
]);
|
|
299
|
+
React.useEffect(() => {
|
|
300
|
+
"background only";
|
|
301
|
+
measurementVersionRef.current++;
|
|
302
|
+
setWidthConstraint(null);
|
|
303
|
+
setPosition(null);
|
|
304
|
+
setOverlayRect(null);
|
|
305
|
+
setTriggerRect(null);
|
|
306
|
+
setIntrinsicSize((current) => current ? {
|
|
307
|
+
...current,
|
|
308
|
+
epoch: context.openEpoch
|
|
309
|
+
} : current);
|
|
310
|
+
}, [context.openEpoch]);
|
|
311
|
+
React.useEffect(() => {
|
|
312
|
+
"background only";
|
|
313
|
+
measurementVersionRef.current++;
|
|
314
|
+
intrinsicWidthRef.current = null;
|
|
315
|
+
measurementConfigRef.current++;
|
|
316
|
+
setWidthConstraint(null);
|
|
317
|
+
setIntrinsicSize((current) => current ? {
|
|
318
|
+
...current,
|
|
319
|
+
config: measurementConfigRef.current
|
|
320
|
+
} : current);
|
|
321
|
+
setPosition(null);
|
|
322
|
+
setOverlayRect(null);
|
|
323
|
+
setTriggerRect(null);
|
|
324
|
+
context.setPositioned(false);
|
|
325
|
+
}, [
|
|
326
|
+
className,
|
|
327
|
+
context.setPositioned,
|
|
328
|
+
context.size,
|
|
329
|
+
style
|
|
330
|
+
]);
|
|
331
|
+
React.useEffect(() => {
|
|
332
|
+
"background only";
|
|
333
|
+
if (context.open) measurePosition();
|
|
334
|
+
}, [context.open, measurePosition]);
|
|
335
|
+
const handleShowOverlay = React.useCallback(() => {
|
|
336
|
+
"background only";
|
|
337
|
+
measurePosition();
|
|
338
|
+
}, [measurePosition]);
|
|
339
|
+
const handleRef = React.useCallback((node) => {
|
|
340
|
+
measurementVersionRef.current++;
|
|
341
|
+
mergeNodeRef(ref, node);
|
|
342
|
+
}, [ref]);
|
|
343
|
+
const handlePositionerRef = React.useCallback((node) => {
|
|
344
|
+
setOverlayNode(node);
|
|
345
|
+
}, []);
|
|
346
|
+
const handleIntrinsicLayoutChange = React.useCallback((event) => {
|
|
347
|
+
"background only";
|
|
348
|
+
const nextSize = getLayoutSize(event);
|
|
349
|
+
if (!nextSize || !context.open) return;
|
|
350
|
+
if (intrinsicWidthRef.current === null) intrinsicWidthRef.current = nextSize.width;
|
|
351
|
+
setIntrinsicSize((current) => {
|
|
352
|
+
const nextWidth = intrinsicWidthRef.current ?? nextSize.width;
|
|
353
|
+
if (current?.width === nextWidth && current.height === nextSize.height && current.epoch === context.openEpoch && current.config === measurementConfigRef.current) return current;
|
|
354
|
+
return {
|
|
355
|
+
width: nextWidth,
|
|
356
|
+
height: nextSize.height,
|
|
357
|
+
epoch: context.openEpoch,
|
|
358
|
+
config: measurementConfigRef.current
|
|
359
|
+
};
|
|
360
|
+
});
|
|
361
|
+
}, [context.open, context.openEpoch]);
|
|
362
|
+
const handleTransitionEnd = React.useCallback((event) => {
|
|
363
|
+
"background only";
|
|
364
|
+
if (!context.open && hasExitTransition(event)) context.finishClose();
|
|
365
|
+
}, [context]);
|
|
366
|
+
const handleBackdropTap = React.useCallback((event) => {
|
|
367
|
+
"background only";
|
|
368
|
+
context.requestOpen(false, {
|
|
369
|
+
reason: "interactOutside",
|
|
370
|
+
event
|
|
371
|
+
});
|
|
372
|
+
}, [context]);
|
|
373
|
+
const handleNativeDismiss = React.useCallback((event) => {
|
|
374
|
+
"background only";
|
|
375
|
+
context.requestOpen(false, {
|
|
376
|
+
reason: "dismiss",
|
|
377
|
+
event
|
|
378
|
+
});
|
|
379
|
+
context.finishClose(true);
|
|
380
|
+
}, [context]);
|
|
381
|
+
const handleRequestClose = React.useCallback((event) => {
|
|
382
|
+
"background only";
|
|
383
|
+
context.requestOpen(false, {
|
|
384
|
+
reason: "dismiss",
|
|
385
|
+
event
|
|
386
|
+
});
|
|
387
|
+
}, [context]);
|
|
388
|
+
if (!context.mounted) return null;
|
|
389
|
+
const geometryStyle = position && overlayRect ? {
|
|
390
|
+
left: toPixel(position.left - overlayRect.left),
|
|
391
|
+
top: toPixel(position.top - overlayRect.top),
|
|
392
|
+
width: toPixel(position.width),
|
|
393
|
+
transformOrigin: position.transformOrigin
|
|
394
|
+
} : void 0;
|
|
395
|
+
const scrollStyle = position ? { height: toPixel(position.height) } : void 0;
|
|
396
|
+
const triggerProxyStyle = triggerRect && overlayRect ? {
|
|
397
|
+
left: toPixel(triggerRect.left - overlayRect.left),
|
|
398
|
+
top: toPixel(triggerRect.top - overlayRect.top),
|
|
399
|
+
width: toPixel(triggerRect.width),
|
|
400
|
+
height: toPixel(triggerRect.height)
|
|
401
|
+
} : void 0;
|
|
402
|
+
const childNodes = toArray(children);
|
|
403
|
+
return <overlay visible style={{ position: "fixed" }} binddismissoverlay={handleNativeDismiss} bindshowoverlay={handleShowOverlay} bindrequestclose={handleRequestClose}>
|
|
404
|
+
<view ref={handlePositionerRef} className={context.classes.positioner}>
|
|
405
|
+
<view className={context.classes.backdrop} bindtap={handleBackdropTap} />
|
|
406
|
+
{triggerProxyStyle && <view style={{
|
|
407
|
+
position: "absolute",
|
|
408
|
+
...triggerProxyStyle
|
|
409
|
+
}} bindtap={context.triggerHandlers.bindtap} main-thread:bindtap={context.triggerHandlers["main-thread:bindtap"]} />}
|
|
410
|
+
<view ref={handleRef} className={clsx(context.classes.content, className)} style={{
|
|
411
|
+
...geometryStyle,
|
|
412
|
+
...style,
|
|
413
|
+
...widthConstraint != null ? { width: toPixel(widthConstraint) } : {}
|
|
414
|
+
}} bindtransitionend={handleTransitionEnd} {...nativeProps}>
|
|
415
|
+
<scroll-view className={context.classes.scrollArea} scroll-orientation="vertical" style={scrollStyle}>
|
|
416
|
+
<view className={context.classes.scrollContent} bindlayoutchange={handleIntrinsicLayoutChange}>
|
|
417
|
+
{childNodes.map((child, index) => <MenuGroupPositionContext.Provider key={React.isValidElement(child) ? child.key ?? index : index} value={{ isFirst: index === 0 }}>
|
|
418
|
+
{child}
|
|
419
|
+
</MenuGroupPositionContext.Provider>)}
|
|
420
|
+
</view>
|
|
421
|
+
</scroll-view>
|
|
422
|
+
</view>
|
|
423
|
+
</view>
|
|
424
|
+
</overlay>;
|
|
425
|
+
});
|
|
426
|
+
MenuContent.displayName = "MenuContent";
|
|
427
|
+
var MenuScrollArea = React.forwardRef((props, ref) => {
|
|
428
|
+
const { children, className, ...nativeProps } = props;
|
|
429
|
+
const classes = useMenuContext("MenuScrollArea").classes;
|
|
430
|
+
return <scroll-view {...ref ? { ref } : {}} className={clsx(classes.scrollArea, className)} scroll-orientation="vertical" {...nativeProps}>
|
|
431
|
+
<view className={classes.scrollContent}>{children}</view>
|
|
432
|
+
</scroll-view>;
|
|
433
|
+
});
|
|
434
|
+
MenuScrollArea.displayName = "MenuScrollArea";
|
|
435
|
+
var MenuGroup = React.forwardRef((props, ref) => {
|
|
436
|
+
const { children, className, ...nativeProps } = props;
|
|
437
|
+
const classes = useMenuContext("MenuGroup").classes;
|
|
438
|
+
const position = React.useContext(MenuGroupPositionContext);
|
|
439
|
+
return <view {...ref ? { ref } : {}} className={clsx(classes.group, className)} {...nativeProps}>
|
|
440
|
+
{!position.isFirst ? <view className={classes.separator} accessibility-elements-hidden={true} /> : null}
|
|
441
|
+
{children}
|
|
442
|
+
</view>;
|
|
443
|
+
});
|
|
444
|
+
MenuGroup.displayName = "MenuGroup";
|
|
445
|
+
var MenuGroupLabel = React.forwardRef((props, ref) => {
|
|
446
|
+
const { children, className, "accessibility-heading": accessibilityHeading = true, ...nativeProps } = props;
|
|
447
|
+
const classes = useMenuContext("MenuGroupLabel").classes;
|
|
448
|
+
return <text {...ref ? { ref } : {}} className={clsx(classes.groupLabel, className)} accessibility-heading={accessibilityHeading} {...nativeProps}>
|
|
449
|
+
{children}
|
|
450
|
+
</text>;
|
|
451
|
+
});
|
|
452
|
+
MenuGroupLabel.displayName = "MenuGroupLabel";
|
|
453
|
+
var MenuItem = React.forwardRef((props, ref) => {
|
|
454
|
+
const [variantProps, otherProps] = menuItem.splitVariantProps(props);
|
|
455
|
+
const { disabled: disabledProp = false, tone = "neutral" } = variantProps;
|
|
456
|
+
const { children, className, bindtap, "main-thread:bindtap": mainThreadBindtap, "accessibility-element": accessibilityElement = true, "accessibility-label": accessibilityLabel, "accessibility-traits": accessibilityTraits, ...nativeProps } = otherProps;
|
|
457
|
+
const context = useMenuContext("MenuItem");
|
|
458
|
+
const disabled = context.disabled || disabledProp;
|
|
459
|
+
const { pressed, ...pressHandlers } = usePressTap({
|
|
460
|
+
disabled,
|
|
461
|
+
onTap: React.useCallback((event, instance) => {
|
|
462
|
+
"background only";
|
|
463
|
+
bindtap?.(event, instance);
|
|
464
|
+
context.requestOpen(false, {
|
|
465
|
+
reason: "itemClick",
|
|
466
|
+
event
|
|
467
|
+
});
|
|
468
|
+
}, [bindtap, context]),
|
|
469
|
+
mainThreadOnTap: mainThreadBindtap
|
|
470
|
+
});
|
|
471
|
+
const classes = menuItem({
|
|
472
|
+
...variantProps,
|
|
473
|
+
size: context.size,
|
|
474
|
+
tone,
|
|
475
|
+
disabled,
|
|
476
|
+
pressed
|
|
477
|
+
});
|
|
478
|
+
const iconSlots = React.useMemo(() => ({
|
|
479
|
+
classNames: {
|
|
480
|
+
prefixIcon: classes.prefixIcon,
|
|
481
|
+
suffixIcon: classes.suffixIcon
|
|
482
|
+
},
|
|
483
|
+
deps: [classes.prefixIcon, classes.suffixIcon]
|
|
484
|
+
}), [classes.prefixIcon, classes.suffixIcon]);
|
|
485
|
+
return <MenuItemClassNamesContext.Provider value={classes}>
|
|
486
|
+
<IconSlotProvider value={iconSlots}>
|
|
487
|
+
<view {...ref ? { ref } : {}} className={clsx(classes.root, className)} accessibility-element={accessibilityElement} accessibility-label={accessibilityLabel} accessibility-role-description="button" accessibility-traits={disabled ? "disabled" : accessibilityTraits ?? "button"} {...nativeProps} {...pressHandlers}>
|
|
488
|
+
<view className={classes.pressedOverlay} accessibility-elements-hidden={true} />
|
|
489
|
+
{children}
|
|
490
|
+
</view>
|
|
491
|
+
</IconSlotProvider>
|
|
492
|
+
</MenuItemClassNamesContext.Provider>;
|
|
493
|
+
});
|
|
494
|
+
MenuItem.displayName = "MenuItem";
|
|
495
|
+
var MenuItemBody = React.forwardRef((props, ref) => {
|
|
496
|
+
const { children, className, ...nativeProps } = props;
|
|
497
|
+
const classes = useMenuItemClassNames("MenuItemBody");
|
|
498
|
+
return <view {...ref ? { ref } : {}} className={clsx(classes.body, className)} {...nativeProps}>
|
|
499
|
+
{children}
|
|
500
|
+
</view>;
|
|
501
|
+
});
|
|
502
|
+
MenuItemBody.displayName = "MenuItemBody";
|
|
503
|
+
var MenuItemLabel = React.forwardRef((props, ref) => {
|
|
504
|
+
const { children, className, ...nativeProps } = props;
|
|
505
|
+
const classes = useMenuItemClassNames("MenuItemLabel");
|
|
506
|
+
return <text {...ref ? { ref } : {}} className={clsx(classes.label, className)} {...nativeProps}>
|
|
507
|
+
{children}
|
|
508
|
+
</text>;
|
|
509
|
+
});
|
|
510
|
+
MenuItemLabel.displayName = "MenuItemLabel";
|
|
511
|
+
var MenuItemDescription = React.forwardRef((props, ref) => {
|
|
512
|
+
const { children, className, ...nativeProps } = props;
|
|
513
|
+
const classes = useMenuItemClassNames("MenuItemDescription");
|
|
514
|
+
return <text {...ref ? { ref } : {}} className={clsx(classes.description, className)} {...nativeProps}>
|
|
515
|
+
{children}
|
|
516
|
+
</text>;
|
|
517
|
+
});
|
|
518
|
+
MenuItemDescription.displayName = "MenuItemDescription";
|
|
519
|
+
//#endregion
|
|
520
|
+
export { MenuAnchor, MenuContent, MenuGroup, MenuGroupLabel, MenuItem, MenuItemBody, MenuItemDescription, MenuItemLabel, MenuRoot, MenuScrollArea, MenuTrigger };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { MenuAnchor as Anchor, MenuContent as Content, MenuGroup as Group, MenuGroupLabel as GroupLabel, MenuItem as Item, MenuItemBody as ItemBody, MenuItemDescription as ItemDescription, MenuItemLabel as ItemLabel, MenuPrefixIcon as PrefixIcon, MenuRoot as Root, MenuScrollArea as ScrollArea, MenuSuffixIcon as SuffixIcon, MenuTrigger as Trigger, type MenuAnchorProps as AnchorProps, type MenuContentProps as ContentProps, type MenuGroupLabelProps as GroupLabelProps, type MenuGroupProps as GroupProps, type MenuItemBodyProps as ItemBodyProps, type MenuItemDescriptionProps as ItemDescriptionProps, type MenuItemLabelProps as ItemLabelProps, type MenuItemProps as ItemProps, type MenuRootProps as RootProps, type MenuScrollAreaProps as ScrollAreaProps, type MenuTriggerProps as TriggerProps, } from './Menu';
|
|
2
|
+
//# sourceMappingURL=Menu.namespace.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Menu.namespace.d.ts","sourceRoot":"","sources":["../../../src/components/Menu/Menu.namespace.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,IAAI,MAAM,EACpB,WAAW,IAAI,OAAO,EACtB,SAAS,IAAI,KAAK,EAClB,cAAc,IAAI,UAAU,EAC5B,QAAQ,IAAI,IAAI,EAChB,YAAY,IAAI,QAAQ,EACxB,mBAAmB,IAAI,eAAe,EACtC,aAAa,IAAI,SAAS,EAC1B,cAAc,IAAI,UAAU,EAC5B,QAAQ,IAAI,IAAI,EAChB,cAAc,IAAI,UAAU,EAC5B,cAAc,IAAI,UAAU,EAC5B,WAAW,IAAI,OAAO,EACtB,KAAK,eAAe,IAAI,WAAW,EACnC,KAAK,gBAAgB,IAAI,YAAY,EACrC,KAAK,mBAAmB,IAAI,eAAe,EAC3C,KAAK,cAAc,IAAI,UAAU,EACjC,KAAK,iBAAiB,IAAI,aAAa,EACvC,KAAK,wBAAwB,IAAI,oBAAoB,EACrD,KAAK,kBAAkB,IAAI,cAAc,EACzC,KAAK,aAAa,IAAI,SAAS,EAC/B,KAAK,aAAa,IAAI,SAAS,EAC/B,KAAK,mBAAmB,IAAI,eAAe,EAC3C,KAAK,gBAAgB,IAAI,YAAY,GACtC,MAAM,QAAQ,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { __exportAll } from "../../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { PrefixIcon, SuffixIcon } from "../Icon/Icon.jsx";
|
|
3
|
+
import { MenuAnchor, MenuContent, MenuGroup, MenuGroupLabel, MenuItem, MenuItemBody, MenuItemDescription, MenuItemLabel, MenuRoot, MenuScrollArea, MenuTrigger } from "./Menu.jsx";
|
|
4
|
+
//#region src/components/Menu/Menu.namespace.ts
|
|
5
|
+
var Menu_namespace_exports = /* @__PURE__ */ __exportAll({
|
|
6
|
+
Anchor: () => MenuAnchor,
|
|
7
|
+
Content: () => MenuContent,
|
|
8
|
+
Group: () => MenuGroup,
|
|
9
|
+
GroupLabel: () => MenuGroupLabel,
|
|
10
|
+
Item: () => MenuItem,
|
|
11
|
+
ItemBody: () => MenuItemBody,
|
|
12
|
+
ItemDescription: () => MenuItemDescription,
|
|
13
|
+
ItemLabel: () => MenuItemLabel,
|
|
14
|
+
PrefixIcon: () => PrefixIcon,
|
|
15
|
+
Root: () => MenuRoot,
|
|
16
|
+
ScrollArea: () => MenuScrollArea,
|
|
17
|
+
SuffixIcon: () => SuffixIcon,
|
|
18
|
+
Trigger: () => MenuTrigger
|
|
19
|
+
});
|
|
20
|
+
//#endregion
|
|
21
|
+
export { Menu_namespace_exports };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { MenuAnchor, MenuContent, MenuGroup, MenuGroupLabel, MenuItem, MenuItemBody, MenuItemDescription, MenuItemLabel, MenuPrefixIcon, MenuRoot, MenuScrollArea, MenuSuffixIcon, MenuTrigger, type MenuAnchorProps, type MenuContentProps, type MenuGroupLabelProps, type MenuGroupProps, type MenuItemBodyProps, type MenuItemDescriptionProps, type MenuItemLabelProps, type MenuItemProps, type MenuOpenChangeDetails, type MenuOpenChangeReason, type MenuPlacement, type MenuRootProps, type MenuScrollAreaProps, type MenuTriggerProps, } from './Menu';
|
|
2
|
+
export * as Menu from './Menu.namespace';
|
|
3
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Menu/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,WAAW,EACX,SAAS,EACT,cAAc,EACd,QAAQ,EACR,YAAY,EACZ,mBAAmB,EACnB,aAAa,EACb,cAAc,EACd,QAAQ,EACR,cAAc,EACd,cAAc,EACd,WAAW,EACX,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EACxB,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACtB,KAAK,wBAAwB,EAC7B,KAAK,kBAAkB,EACvB,KAAK,aAAa,EAClB,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,EACzB,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,GACtB,MAAM,QAAQ,CAAC;AAEhB,OAAO,KAAK,IAAI,MAAM,kBAAkB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotificationBadge.d.ts","sourceRoot":"","sources":["../../../src/components/NotificationBadge/NotificationBadge.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,6BAA6B,EACnC,MAAM,kDAAkD,CAAC;AAC1D,OAAO,EAEL,KAAK,uCAAuC,EAC7C,MAAM,6DAA6D,CAAC;AAErE,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAC;AAExC,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"NotificationBadge.d.ts","sourceRoot":"","sources":["../../../src/components/NotificationBadge/NotificationBadge.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,6BAA6B,EACnC,MAAM,kDAAkD,CAAC;AAC1D,OAAO,EAEL,KAAK,uCAAuC,EAC7C,MAAM,6DAA6D,CAAC;AAErE,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAC;AAExC,OAAO,KAAK,EAAE,sBAAsB,EAAE,sBAAsB,EAAe,MAAM,aAAa,CAAC;AAK/F;;;;;;GAMG;AACH,MAAM,WAAW,sBACf,SAAQ,6BAA6B,EACnC,sBAAsB,EACtB,sBAAsB;CAAG;AAE7B,eAAO,MAAM,iBAAiB,wFAmB7B,CAAC;AAIF,MAAM,WAAW,gCACf,SAAQ,uCAAuC,EAC7C,sBAAsB;CAAG;AAE7B,eAAO,MAAM,2BAA2B,kGAkBtC,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { mergeProps } from "../../utils/merge-props.js";
|
|
1
2
|
import * as React from "@lynx-js/react";
|
|
2
3
|
import clsx from "clsx";
|
|
3
4
|
import { notificationBadge } from "@seed-design/lynx-css/recipes/notification-badge";
|
|
@@ -12,7 +13,7 @@ var NotificationBadge = React.forwardRef((innerProps, ref) => {
|
|
|
12
13
|
const [variantProps, otherProps] = notificationBadge.splitVariantProps(props);
|
|
13
14
|
const classes = notificationBadge(variantProps);
|
|
14
15
|
const { children, className, ...nativeProps } = otherProps;
|
|
15
|
-
return <view {...ref ? { ref } : {}
|
|
16
|
+
return <view {...mergeProps(ref ? { ref } : {}, nativeProps)} className={clsx(classes.root, className)}>
|
|
16
17
|
<text className={classes.label} text-single-line-vertical-align="center">
|
|
17
18
|
{children}
|
|
18
19
|
</text>
|
|
@@ -24,7 +25,7 @@ var NotificationBadgePositioner = React.forwardRef((props, ref) => {
|
|
|
24
25
|
const { children, className, ...nativeProps } = otherProps;
|
|
25
26
|
const contextValue = React.useMemo(() => ({ size: variantProps.size }), [variantProps.size]);
|
|
26
27
|
return <NotificationBadgeContext.Provider value={contextValue}>
|
|
27
|
-
<view {...ref ? { ref } : {}
|
|
28
|
+
<view {...mergeProps(ref ? { ref } : {}, nativeProps)} className={clsx(notificationBadgePositioner(variantProps), className)}>
|
|
28
29
|
{children}
|
|
29
30
|
</view>
|
|
30
31
|
</NotificationBadgeContext.Provider>;
|
|
@@ -4,11 +4,11 @@ import * as React from "@lynx-js/react";
|
|
|
4
4
|
/**
|
|
5
5
|
* @platform Lynx
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
* -
|
|
9
|
-
* -
|
|
7
|
+
* Differences from React Web:
|
|
8
|
+
* - Uses Lynx native `<view>` and `bindtap` instead of `asChild` and DOM events.
|
|
9
|
+
* - Does not provide a web focus ring.
|
|
10
10
|
*/
|
|
11
|
-
export interface PageBannerRootProps extends Omit<PageBannerVariantProps, "pressed" | "closeButtonPressed">, LynxStyledElementProps, LynxPressableProps, LynxAccessibilityProps {
|
|
11
|
+
export interface PageBannerRootProps extends Omit<PageBannerVariantProps, "pressed" | "closeButtonPressed" | "interactive">, LynxStyledElementProps, LynxPressableProps, LynxAccessibilityProps {
|
|
12
12
|
defaultOpen?: boolean;
|
|
13
13
|
open?: boolean;
|
|
14
14
|
onDismiss?: () => void;
|
|
@@ -29,7 +29,7 @@ export declare const PageBannerDescription: React.ForwardRefExoticComponent<Page
|
|
|
29
29
|
export interface PageBannerButtonProps extends LynxStyledElementProps, LynxPressableProps, LynxAccessibilityProps {
|
|
30
30
|
}
|
|
31
31
|
export declare const PageBannerButton: React.ForwardRefExoticComponent<PageBannerButtonProps & React.RefAttributes<unknown>>;
|
|
32
|
-
export interface PageBannerCloseButtonProps extends LynxStyledElementProps, LynxPressableProps, LynxAccessibilityProps {
|
|
32
|
+
export interface PageBannerCloseButtonProps extends Omit<LynxStyledElementProps, "flatten">, LynxPressableProps, LynxAccessibilityProps {
|
|
33
33
|
}
|
|
34
34
|
export declare const PageBannerCloseButton: React.ForwardRefExoticComponent<PageBannerCloseButtonProps & React.RefAttributes<unknown>>;
|
|
35
35
|
//# sourceMappingURL=PageBanner.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PageBanner.d.ts","sourceRoot":"","sources":["../../../src/components/PageBanner/PageBanner.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,sBAAsB,EAAE,MAAM,2CAA2C,CAAC;AACpG,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"PageBanner.d.ts","sourceRoot":"","sources":["../../../src/components/PageBanner/PageBanner.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,sBAAsB,EAAE,MAAM,2CAA2C,CAAC;AACpG,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAC;AAOxC,OAAO,KAAK,EACV,sBAAsB,EACtB,kBAAkB,EAClB,sBAAsB,EAIvB,MAAM,aAAa,CAAC;AA6BrB;;;;;;GAMG;AACH,MAAM,WAAW,mBACf,SAAQ,IAAI,CAAC,sBAAsB,EAAE,SAAS,GAAG,oBAAoB,GAAG,aAAa,CAAC,EACpF,sBAAsB,EACtB,kBAAkB,EAClB,sBAAsB;IACxB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;CACxB;AAED,eAAO,MAAM,cAAc,qFAyFzB,CAAC;AAKH,MAAM,WAAW,sBAAuB,SAAQ,sBAAsB,EAAE,sBAAsB;CAAG;AAEjG,eAAO,MAAM,iBAAiB,wFAa5B,CAAC;AAKH,MAAM,WAAW,mBAAoB,SAAQ,sBAAsB,EAAE,sBAAsB;CAAG;AAE9F,eAAO,MAAM,cAAc,qFAazB,CAAC;AAKH,MAAM,WAAW,oBAAqB,SAAQ,sBAAsB,EAAE,sBAAsB;CAAG;AAE/F,eAAO,MAAM,eAAe,sFAc1B,CAAC;AAKH,MAAM,WAAW,0BACf,SAAQ,sBAAsB,EAC5B,sBAAsB;CAAG;AAE7B,eAAO,MAAM,qBAAqB,4FAejC,CAAC;AAKF,MAAM,WAAW,qBACf,SAAQ,sBAAsB,EAC5B,kBAAkB,EAClB,sBAAsB;CAAG;AAE7B,eAAO,MAAM,gBAAgB,uFAwB3B,CAAC;AAKH,MAAM,WAAW,0BAEf,SAAQ,IAAI,CAAC,sBAAsB,EAAE,SAAS,CAAC,EAC7C,kBAAkB,EAClB,sBAAsB;CAAG;AAE7B,eAAO,MAAM,qBAAqB,4FAmEjC,CAAC"}
|