@seed-design/lynx-react 0.6.3 → 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 +1 -1
- 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.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.ts +5 -4
- 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,476 @@
|
|
|
1
|
+
import * as React from "@lynx-js/react";
|
|
2
|
+
import clsx from "clsx";
|
|
3
|
+
|
|
4
|
+
import { list } from "@seed-design/lynx-css/recipes/list";
|
|
5
|
+
import { listHeader, type ListHeaderVariantProps } from "@seed-design/lynx-css/recipes/list-header";
|
|
6
|
+
import { listItem, type ListItemVariantProps } from "@seed-design/lynx-css/recipes/list-item";
|
|
7
|
+
|
|
8
|
+
import { usePressTap } from "../../hooks/usePressTap";
|
|
9
|
+
import type {
|
|
10
|
+
LynxAccessibilityProps,
|
|
11
|
+
LynxPressableProps,
|
|
12
|
+
LynxStyledElementProps,
|
|
13
|
+
LynxTextRef,
|
|
14
|
+
LynxTouchProps,
|
|
15
|
+
LynxViewRef,
|
|
16
|
+
} from "../../types";
|
|
17
|
+
import { createSlotRecipeContext } from "../../utils/create-slot-recipe-context";
|
|
18
|
+
import { CheckboxRoot, type CheckboxRootProps, useCheckboxContext } from "../Checkbox/Checkbox";
|
|
19
|
+
import { IconSlotProvider } from "../Icon/Icon";
|
|
20
|
+
import {
|
|
21
|
+
RadioGroupItem,
|
|
22
|
+
type RadioGroupItemProps,
|
|
23
|
+
useRadioGroupItemContext,
|
|
24
|
+
} from "../RadioGroup/RadioGroup";
|
|
25
|
+
import { SwitchRoot, type SwitchRootProps, useSwitchContext } from "../Switch/Switch";
|
|
26
|
+
|
|
27
|
+
type PublicListItemVariantProps = Omit<ListItemVariantProps, "pressed" | "disabled">;
|
|
28
|
+
|
|
29
|
+
const { ClassNamesProvider, useClassNames } = createSlotRecipeContext(listItem);
|
|
30
|
+
|
|
31
|
+
function splitAccessibilityProps<T extends LynxAccessibilityProps>(props: T) {
|
|
32
|
+
const {
|
|
33
|
+
"accessibility-label": accessibilityLabel,
|
|
34
|
+
"accessibility-traits": accessibilityTraits,
|
|
35
|
+
"accessibility-element": accessibilityElement,
|
|
36
|
+
"accessibility-value": accessibilityValue,
|
|
37
|
+
"accessibility-role-description": accessibilityRoleDescription,
|
|
38
|
+
"accessibility-elements-hidden": accessibilityElementsHidden,
|
|
39
|
+
"accessibility-heading": accessibilityHeading,
|
|
40
|
+
"accessibility-actions": accessibilityActions,
|
|
41
|
+
"accessibility-exclusive-focus": accessibilityExclusiveFocus,
|
|
42
|
+
"ios-platform-accessibility-id": iosPlatformAccessibilityId,
|
|
43
|
+
...restProps
|
|
44
|
+
} = props;
|
|
45
|
+
|
|
46
|
+
return [
|
|
47
|
+
{
|
|
48
|
+
"accessibility-label": accessibilityLabel,
|
|
49
|
+
"accessibility-traits": accessibilityTraits,
|
|
50
|
+
"accessibility-element": accessibilityElement,
|
|
51
|
+
"accessibility-value": accessibilityValue,
|
|
52
|
+
"accessibility-role-description": accessibilityRoleDescription,
|
|
53
|
+
"accessibility-elements-hidden": accessibilityElementsHidden,
|
|
54
|
+
"accessibility-heading": accessibilityHeading,
|
|
55
|
+
...(accessibilityActions === undefined
|
|
56
|
+
? {}
|
|
57
|
+
: { "accessibility-actions": accessibilityActions }),
|
|
58
|
+
"accessibility-exclusive-focus": accessibilityExclusiveFocus,
|
|
59
|
+
"ios-platform-accessibility-id": iosPlatformAccessibilityId,
|
|
60
|
+
},
|
|
61
|
+
restProps,
|
|
62
|
+
] as const;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
////////////////////////////////////////////////////////////////////////////////////
|
|
66
|
+
|
|
67
|
+
export interface ListRootProps extends LynxStyledElementProps, LynxAccessibilityProps {}
|
|
68
|
+
|
|
69
|
+
export const ListRoot = React.forwardRef<unknown, ListRootProps>((props, ref) => {
|
|
70
|
+
const { children, className, style, ...nativeProps } = props;
|
|
71
|
+
|
|
72
|
+
return (
|
|
73
|
+
<view
|
|
74
|
+
{...(ref ? { ref: ref as LynxViewRef } : {})}
|
|
75
|
+
{...nativeProps}
|
|
76
|
+
className={clsx(list(), className)}
|
|
77
|
+
style={style}
|
|
78
|
+
>
|
|
79
|
+
{children}
|
|
80
|
+
</view>
|
|
81
|
+
);
|
|
82
|
+
});
|
|
83
|
+
ListRoot.displayName = "ListRoot";
|
|
84
|
+
|
|
85
|
+
////////////////////////////////////////////////////////////////////////////////////
|
|
86
|
+
|
|
87
|
+
interface ListItemSurfaceProps
|
|
88
|
+
extends PublicListItemVariantProps,
|
|
89
|
+
LynxStyledElementProps,
|
|
90
|
+
LynxAccessibilityProps,
|
|
91
|
+
LynxTouchProps {
|
|
92
|
+
disabled?: boolean;
|
|
93
|
+
pressed?: boolean;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
const ListItemSurface = React.forwardRef<unknown, ListItemSurfaceProps>((props, ref) => {
|
|
97
|
+
const { children, className, style, disabled = false, pressed = false, ...restProps } = props;
|
|
98
|
+
const [variantProps, nativeProps] = listItem.splitVariantProps(restProps);
|
|
99
|
+
const classes = listItem({ ...variantProps, disabled, pressed });
|
|
100
|
+
|
|
101
|
+
return (
|
|
102
|
+
<ClassNamesProvider value={classes}>
|
|
103
|
+
<IconSlotProvider
|
|
104
|
+
value={{
|
|
105
|
+
classNames: {
|
|
106
|
+
prefixIcon: classes.prefixIcon,
|
|
107
|
+
suffixIcon: classes.suffixIcon,
|
|
108
|
+
},
|
|
109
|
+
deps: [disabled, pressed, variantProps.highlighted],
|
|
110
|
+
}}
|
|
111
|
+
>
|
|
112
|
+
<view
|
|
113
|
+
{...(ref ? { ref: ref as LynxViewRef } : {})}
|
|
114
|
+
{...nativeProps}
|
|
115
|
+
className={clsx(classes.root, className)}
|
|
116
|
+
style={style}
|
|
117
|
+
>
|
|
118
|
+
<view className={classes.highlightedOverlay} accessibility-elements-hidden={true} />
|
|
119
|
+
<view className={classes.pressedOverlay} accessibility-elements-hidden={true} />
|
|
120
|
+
<view className={classes.layout}>{children}</view>
|
|
121
|
+
</view>
|
|
122
|
+
</IconSlotProvider>
|
|
123
|
+
</ClassNamesProvider>
|
|
124
|
+
);
|
|
125
|
+
});
|
|
126
|
+
ListItemSurface.displayName = "ListItemSurface";
|
|
127
|
+
|
|
128
|
+
export interface ListItemProps
|
|
129
|
+
extends PublicListItemVariantProps,
|
|
130
|
+
LynxStyledElementProps,
|
|
131
|
+
LynxAccessibilityProps {
|
|
132
|
+
disabled?: boolean;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export const ListItem = React.forwardRef<unknown, ListItemProps>((props, ref) => {
|
|
136
|
+
return <ListItemSurface ref={ref} {...props} />;
|
|
137
|
+
});
|
|
138
|
+
ListItem.displayName = "ListItem";
|
|
139
|
+
|
|
140
|
+
////////////////////////////////////////////////////////////////////////////////////
|
|
141
|
+
|
|
142
|
+
export interface ListButtonItemProps
|
|
143
|
+
extends PublicListItemVariantProps,
|
|
144
|
+
LynxStyledElementProps,
|
|
145
|
+
LynxAccessibilityProps,
|
|
146
|
+
LynxPressableProps {
|
|
147
|
+
disabled?: boolean;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
export const ListButtonItem = React.forwardRef<unknown, ListButtonItemProps>((props, ref) => {
|
|
151
|
+
const {
|
|
152
|
+
disabled = false,
|
|
153
|
+
bindtap,
|
|
154
|
+
"main-thread:bindtap": mainThreadOnTap,
|
|
155
|
+
"accessibility-element": accessibilityElement = true,
|
|
156
|
+
"accessibility-role-description": accessibilityRoleDescription = "button",
|
|
157
|
+
"accessibility-traits": accessibilityTraits,
|
|
158
|
+
...restProps
|
|
159
|
+
} = props;
|
|
160
|
+
const { pressed, ...pressHandlers } = usePressTap({
|
|
161
|
+
disabled,
|
|
162
|
+
onTap: bindtap,
|
|
163
|
+
mainThreadOnTap,
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
return (
|
|
167
|
+
<ListItemSurface
|
|
168
|
+
ref={ref}
|
|
169
|
+
disabled={disabled}
|
|
170
|
+
pressed={pressed}
|
|
171
|
+
accessibility-element={accessibilityElement}
|
|
172
|
+
accessibility-role-description={accessibilityRoleDescription}
|
|
173
|
+
accessibility-traits={accessibilityTraits ?? (disabled ? "disabled" : "button")}
|
|
174
|
+
{...pressHandlers}
|
|
175
|
+
{...restProps}
|
|
176
|
+
/>
|
|
177
|
+
);
|
|
178
|
+
});
|
|
179
|
+
ListButtonItem.displayName = "ListButtonItem";
|
|
180
|
+
|
|
181
|
+
////////////////////////////////////////////////////////////////////////////////////
|
|
182
|
+
|
|
183
|
+
interface ListCheckboxItemSurfaceProps
|
|
184
|
+
extends PublicListItemVariantProps,
|
|
185
|
+
LynxStyledElementProps,
|
|
186
|
+
LynxAccessibilityProps {}
|
|
187
|
+
|
|
188
|
+
function ListCheckboxItemSurface(props: ListCheckboxItemSurfaceProps) {
|
|
189
|
+
const context = useCheckboxContext("ListCheckboxItem");
|
|
190
|
+
|
|
191
|
+
return (
|
|
192
|
+
<ListItemSurface
|
|
193
|
+
{...props}
|
|
194
|
+
disabled={context.disabled}
|
|
195
|
+
pressed={context.pressed}
|
|
196
|
+
accessibility-element={props["accessibility-element"] ?? true}
|
|
197
|
+
accessibility-role-description={props["accessibility-role-description"] ?? "checkbox"}
|
|
198
|
+
accessibility-value={
|
|
199
|
+
props["accessibility-value"] ?? (context.checked ? "선택됨" : "선택 안 됨")
|
|
200
|
+
}
|
|
201
|
+
accessibility-traits={
|
|
202
|
+
props["accessibility-traits"] ?? (context.disabled ? "disabled" : "button")
|
|
203
|
+
}
|
|
204
|
+
/>
|
|
205
|
+
);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
export interface ListCheckboxItemProps
|
|
209
|
+
extends PublicListItemVariantProps,
|
|
210
|
+
Omit<CheckboxRootProps, "children" | "className" | "style" | "disabled">,
|
|
211
|
+
LynxStyledElementProps,
|
|
212
|
+
LynxAccessibilityProps {
|
|
213
|
+
disabled?: boolean;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
export const ListCheckboxItem = React.forwardRef<unknown, ListCheckboxItemProps>((props, ref) => {
|
|
217
|
+
const { children, className, style, disabled = false, ...restProps } = props;
|
|
218
|
+
const [variantProps, remainingProps] = listItem.splitVariantProps(restProps);
|
|
219
|
+
const [accessibilityProps, checkboxProps] = splitAccessibilityProps(remainingProps);
|
|
220
|
+
const interactionRootClassName = listItem().interactionRoot;
|
|
221
|
+
|
|
222
|
+
return (
|
|
223
|
+
<CheckboxRoot
|
|
224
|
+
ref={ref}
|
|
225
|
+
{...checkboxProps}
|
|
226
|
+
disabled={disabled}
|
|
227
|
+
className={interactionRootClassName}
|
|
228
|
+
>
|
|
229
|
+
<ListCheckboxItemSurface
|
|
230
|
+
{...variantProps}
|
|
231
|
+
className={className}
|
|
232
|
+
style={style}
|
|
233
|
+
{...accessibilityProps}
|
|
234
|
+
>
|
|
235
|
+
{children}
|
|
236
|
+
</ListCheckboxItemSurface>
|
|
237
|
+
</CheckboxRoot>
|
|
238
|
+
);
|
|
239
|
+
});
|
|
240
|
+
ListCheckboxItem.displayName = "ListCheckboxItem";
|
|
241
|
+
|
|
242
|
+
////////////////////////////////////////////////////////////////////////////////////
|
|
243
|
+
|
|
244
|
+
interface ListRadioItemSurfaceProps
|
|
245
|
+
extends PublicListItemVariantProps,
|
|
246
|
+
LynxStyledElementProps,
|
|
247
|
+
LynxAccessibilityProps {}
|
|
248
|
+
|
|
249
|
+
function ListRadioItemSurface(props: ListRadioItemSurfaceProps) {
|
|
250
|
+
const context = useRadioGroupItemContext("ListRadioItem");
|
|
251
|
+
|
|
252
|
+
return (
|
|
253
|
+
<ListItemSurface
|
|
254
|
+
{...props}
|
|
255
|
+
disabled={context.disabled}
|
|
256
|
+
pressed={context.pressed}
|
|
257
|
+
accessibility-element={props["accessibility-element"] ?? true}
|
|
258
|
+
accessibility-role-description={props["accessibility-role-description"] ?? "radio"}
|
|
259
|
+
accessibility-value={
|
|
260
|
+
props["accessibility-value"] ?? (context.checked ? "선택됨" : "선택 안 됨")
|
|
261
|
+
}
|
|
262
|
+
accessibility-traits={
|
|
263
|
+
props["accessibility-traits"] ?? (context.disabled ? "disabled" : "button")
|
|
264
|
+
}
|
|
265
|
+
/>
|
|
266
|
+
);
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
export interface ListRadioItemProps
|
|
270
|
+
extends PublicListItemVariantProps,
|
|
271
|
+
Omit<RadioGroupItemProps, "children" | "className" | "style" | "disabled">,
|
|
272
|
+
LynxStyledElementProps,
|
|
273
|
+
LynxAccessibilityProps {
|
|
274
|
+
disabled?: boolean;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
export const ListRadioItem = React.forwardRef<unknown, ListRadioItemProps>((props, ref) => {
|
|
278
|
+
const { children, className, style, disabled = false, value, ...restProps } = props;
|
|
279
|
+
const [variantProps, remainingProps] = listItem.splitVariantProps(restProps);
|
|
280
|
+
const [accessibilityProps] = splitAccessibilityProps(remainingProps);
|
|
281
|
+
const interactionRootClassName = listItem().interactionRoot;
|
|
282
|
+
|
|
283
|
+
return (
|
|
284
|
+
<RadioGroupItem
|
|
285
|
+
ref={ref}
|
|
286
|
+
value={value}
|
|
287
|
+
disabled={disabled}
|
|
288
|
+
className={interactionRootClassName}
|
|
289
|
+
>
|
|
290
|
+
<ListRadioItemSurface
|
|
291
|
+
{...variantProps}
|
|
292
|
+
className={className}
|
|
293
|
+
style={style}
|
|
294
|
+
{...accessibilityProps}
|
|
295
|
+
>
|
|
296
|
+
{children}
|
|
297
|
+
</ListRadioItemSurface>
|
|
298
|
+
</RadioGroupItem>
|
|
299
|
+
);
|
|
300
|
+
});
|
|
301
|
+
ListRadioItem.displayName = "ListRadioItem";
|
|
302
|
+
|
|
303
|
+
////////////////////////////////////////////////////////////////////////////////////
|
|
304
|
+
|
|
305
|
+
interface ListSwitchItemSurfaceProps
|
|
306
|
+
extends PublicListItemVariantProps,
|
|
307
|
+
LynxStyledElementProps,
|
|
308
|
+
LynxAccessibilityProps {}
|
|
309
|
+
|
|
310
|
+
function ListSwitchItemSurface(props: ListSwitchItemSurfaceProps) {
|
|
311
|
+
const context = useSwitchContext("ListSwitchItem");
|
|
312
|
+
|
|
313
|
+
return (
|
|
314
|
+
<ListItemSurface
|
|
315
|
+
{...props}
|
|
316
|
+
disabled={context.disabled}
|
|
317
|
+
pressed={context.pressed}
|
|
318
|
+
accessibility-element={props["accessibility-element"] ?? true}
|
|
319
|
+
accessibility-role-description={props["accessibility-role-description"] ?? "switch"}
|
|
320
|
+
accessibility-value={props["accessibility-value"] ?? (context.checked ? "켜짐" : "꺼짐")}
|
|
321
|
+
accessibility-traits={
|
|
322
|
+
props["accessibility-traits"] ?? (context.disabled ? "disabled" : "button")
|
|
323
|
+
}
|
|
324
|
+
/>
|
|
325
|
+
);
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
export interface ListSwitchItemProps
|
|
329
|
+
extends PublicListItemVariantProps,
|
|
330
|
+
Omit<SwitchRootProps, "children" | "className" | "style" | "disabled">,
|
|
331
|
+
LynxStyledElementProps,
|
|
332
|
+
LynxAccessibilityProps {
|
|
333
|
+
disabled?: boolean;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
export const ListSwitchItem = React.forwardRef<unknown, ListSwitchItemProps>((props, ref) => {
|
|
337
|
+
const { children, className, style, disabled = false, ...restProps } = props;
|
|
338
|
+
const [variantProps, remainingProps] = listItem.splitVariantProps(restProps);
|
|
339
|
+
const [accessibilityProps, switchProps] = splitAccessibilityProps(remainingProps);
|
|
340
|
+
const interactionRootClassName = listItem().interactionRoot;
|
|
341
|
+
|
|
342
|
+
return (
|
|
343
|
+
<SwitchRoot ref={ref} {...switchProps} disabled={disabled} className={interactionRootClassName}>
|
|
344
|
+
<ListSwitchItemSurface
|
|
345
|
+
{...variantProps}
|
|
346
|
+
className={className}
|
|
347
|
+
style={style}
|
|
348
|
+
{...accessibilityProps}
|
|
349
|
+
>
|
|
350
|
+
{children}
|
|
351
|
+
</ListSwitchItemSurface>
|
|
352
|
+
</SwitchRoot>
|
|
353
|
+
);
|
|
354
|
+
});
|
|
355
|
+
ListSwitchItem.displayName = "ListSwitchItem";
|
|
356
|
+
|
|
357
|
+
////////////////////////////////////////////////////////////////////////////////////
|
|
358
|
+
|
|
359
|
+
export interface ListContentProps extends LynxStyledElementProps {}
|
|
360
|
+
|
|
361
|
+
export const ListContent = React.forwardRef<unknown, ListContentProps>((props, ref) => {
|
|
362
|
+
const { children, className, style, ...nativeProps } = props;
|
|
363
|
+
const classes = useClassNames();
|
|
364
|
+
|
|
365
|
+
return (
|
|
366
|
+
<view
|
|
367
|
+
{...(ref ? { ref: ref as LynxViewRef } : {})}
|
|
368
|
+
{...nativeProps}
|
|
369
|
+
className={clsx(classes.content, className)}
|
|
370
|
+
style={style}
|
|
371
|
+
>
|
|
372
|
+
{children}
|
|
373
|
+
</view>
|
|
374
|
+
);
|
|
375
|
+
});
|
|
376
|
+
ListContent.displayName = "ListContent";
|
|
377
|
+
|
|
378
|
+
export interface ListPrefixProps extends LynxStyledElementProps {}
|
|
379
|
+
|
|
380
|
+
export const ListPrefix = React.forwardRef<unknown, ListPrefixProps>((props, ref) => {
|
|
381
|
+
const { children, className, style, ...nativeProps } = props;
|
|
382
|
+
const classes = useClassNames();
|
|
383
|
+
|
|
384
|
+
return (
|
|
385
|
+
<view
|
|
386
|
+
{...(ref ? { ref: ref as LynxViewRef } : {})}
|
|
387
|
+
{...nativeProps}
|
|
388
|
+
className={clsx(classes.prefix, className)}
|
|
389
|
+
style={style}
|
|
390
|
+
>
|
|
391
|
+
{children}
|
|
392
|
+
</view>
|
|
393
|
+
);
|
|
394
|
+
});
|
|
395
|
+
ListPrefix.displayName = "ListPrefix";
|
|
396
|
+
|
|
397
|
+
export interface ListSuffixProps extends LynxStyledElementProps {}
|
|
398
|
+
|
|
399
|
+
export const ListSuffix = React.forwardRef<unknown, ListSuffixProps>((props, ref) => {
|
|
400
|
+
const { children, className, style, ...nativeProps } = props;
|
|
401
|
+
const classes = useClassNames();
|
|
402
|
+
|
|
403
|
+
return (
|
|
404
|
+
<view
|
|
405
|
+
{...(ref ? { ref: ref as LynxViewRef } : {})}
|
|
406
|
+
{...nativeProps}
|
|
407
|
+
className={clsx(classes.suffix, className)}
|
|
408
|
+
style={style}
|
|
409
|
+
>
|
|
410
|
+
{children}
|
|
411
|
+
</view>
|
|
412
|
+
);
|
|
413
|
+
});
|
|
414
|
+
ListSuffix.displayName = "ListSuffix";
|
|
415
|
+
|
|
416
|
+
export interface ListTitleProps extends LynxStyledElementProps {}
|
|
417
|
+
|
|
418
|
+
export const ListTitle = React.forwardRef<unknown, ListTitleProps>((props, ref) => {
|
|
419
|
+
const { children, className, style, ...nativeProps } = props;
|
|
420
|
+
const classes = useClassNames();
|
|
421
|
+
|
|
422
|
+
return (
|
|
423
|
+
<text
|
|
424
|
+
{...(ref ? { ref: ref as LynxTextRef } : {})}
|
|
425
|
+
{...nativeProps}
|
|
426
|
+
className={clsx(classes.title, className)}
|
|
427
|
+
style={style}
|
|
428
|
+
>
|
|
429
|
+
{children}
|
|
430
|
+
</text>
|
|
431
|
+
);
|
|
432
|
+
});
|
|
433
|
+
ListTitle.displayName = "ListTitle";
|
|
434
|
+
|
|
435
|
+
export interface ListDetailProps extends LynxStyledElementProps {}
|
|
436
|
+
|
|
437
|
+
export const ListDetail = React.forwardRef<unknown, ListDetailProps>((props, ref) => {
|
|
438
|
+
const { children, className, style, ...nativeProps } = props;
|
|
439
|
+
const classes = useClassNames();
|
|
440
|
+
|
|
441
|
+
return (
|
|
442
|
+
<text
|
|
443
|
+
{...(ref ? { ref: ref as LynxTextRef } : {})}
|
|
444
|
+
{...nativeProps}
|
|
445
|
+
className={clsx(classes.detail, className)}
|
|
446
|
+
style={style}
|
|
447
|
+
>
|
|
448
|
+
{children}
|
|
449
|
+
</text>
|
|
450
|
+
);
|
|
451
|
+
});
|
|
452
|
+
ListDetail.displayName = "ListDetail";
|
|
453
|
+
|
|
454
|
+
////////////////////////////////////////////////////////////////////////////////////
|
|
455
|
+
|
|
456
|
+
export interface ListHeaderProps
|
|
457
|
+
extends ListHeaderVariantProps,
|
|
458
|
+
LynxStyledElementProps,
|
|
459
|
+
LynxAccessibilityProps {}
|
|
460
|
+
|
|
461
|
+
export const ListHeader = React.forwardRef<unknown, ListHeaderProps>((props, ref) => {
|
|
462
|
+
const [variantProps, restProps] = listHeader.splitVariantProps(props);
|
|
463
|
+
const { children, className, style, ...nativeProps } = restProps;
|
|
464
|
+
|
|
465
|
+
return (
|
|
466
|
+
<text
|
|
467
|
+
{...(ref ? { ref: ref as LynxTextRef } : {})}
|
|
468
|
+
{...nativeProps}
|
|
469
|
+
className={clsx(listHeader(variantProps), className)}
|
|
470
|
+
style={style}
|
|
471
|
+
>
|
|
472
|
+
{children}
|
|
473
|
+
</text>
|
|
474
|
+
);
|
|
475
|
+
});
|
|
476
|
+
ListHeader.displayName = "ListHeader";
|
|
@@ -6,6 +6,7 @@ import { isValidElement } from "@lynx-js/react";
|
|
|
6
6
|
|
|
7
7
|
import type { LynxStyledElementProps, LynxViewRef } from "../../types";
|
|
8
8
|
import { toArray } from "../../utils/children";
|
|
9
|
+
import { mergeProps } from "../../utils/merge-props";
|
|
9
10
|
|
|
10
11
|
type MannerTempLevel = NonNullable<MannerTempVariantProps["level"]>;
|
|
11
12
|
|
|
@@ -35,8 +36,7 @@ export const MannerTempEmote = React.forwardRef<unknown, MannerTempEmoteProps>((
|
|
|
35
36
|
|
|
36
37
|
return (
|
|
37
38
|
<image
|
|
38
|
-
{...(ref ? { ref: ref as React.Ref<NodesRef> } : {})}
|
|
39
|
-
{...nativeProps}
|
|
39
|
+
{...mergeProps(ref ? { ref: ref as React.Ref<NodesRef> } : {}, nativeProps)}
|
|
40
40
|
src={emoteSources[level]}
|
|
41
41
|
mode="aspectFit"
|
|
42
42
|
accessibility-elements-hidden={true}
|
|
@@ -71,8 +71,7 @@ export const MannerTemp = React.forwardRef<unknown, MannerTempProps>((props, ref
|
|
|
71
71
|
return (
|
|
72
72
|
<MannerTempLevelContext.Provider value={level}>
|
|
73
73
|
<view
|
|
74
|
-
{...(ref ? { ref: ref as LynxViewRef } : {})}
|
|
75
|
-
{...nativeProps}
|
|
74
|
+
{...mergeProps(ref ? { ref: ref as LynxViewRef } : {}, nativeProps)}
|
|
76
75
|
className={clsx(classes.root, className)}
|
|
77
76
|
>
|
|
78
77
|
<text className={classes.label}>{labelChildren}</text>
|
|
@@ -6,6 +6,7 @@ import clsx from "clsx";
|
|
|
6
6
|
import * as React from "@lynx-js/react";
|
|
7
7
|
|
|
8
8
|
import type { LynxStyledElementProps, LynxViewRef } from "../../types";
|
|
9
|
+
import { mergeProps } from "../../utils/merge-props";
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* @platform Lynx
|
|
@@ -22,8 +23,7 @@ export const MannerTempBadge = React.forwardRef<unknown, MannerTempBadgeProps>((
|
|
|
22
23
|
|
|
23
24
|
return (
|
|
24
25
|
<view
|
|
25
|
-
{...(ref ? { ref: ref as LynxViewRef } : {})}
|
|
26
|
-
{...nativeProps}
|
|
26
|
+
{...mergeProps(ref ? { ref: ref as LynxViewRef } : {}, nativeProps)}
|
|
27
27
|
className={clsx(classes.root, className)}
|
|
28
28
|
>
|
|
29
29
|
<text className={classes.label}>{children}</text>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export {
|
|
2
|
+
MenuAnchor as Anchor,
|
|
3
|
+
MenuContent as Content,
|
|
4
|
+
MenuGroup as Group,
|
|
5
|
+
MenuGroupLabel as GroupLabel,
|
|
6
|
+
MenuItem as Item,
|
|
7
|
+
MenuItemBody as ItemBody,
|
|
8
|
+
MenuItemDescription as ItemDescription,
|
|
9
|
+
MenuItemLabel as ItemLabel,
|
|
10
|
+
MenuPrefixIcon as PrefixIcon,
|
|
11
|
+
MenuRoot as Root,
|
|
12
|
+
MenuScrollArea as ScrollArea,
|
|
13
|
+
MenuSuffixIcon as SuffixIcon,
|
|
14
|
+
MenuTrigger as Trigger,
|
|
15
|
+
type MenuAnchorProps as AnchorProps,
|
|
16
|
+
type MenuContentProps as ContentProps,
|
|
17
|
+
type MenuGroupLabelProps as GroupLabelProps,
|
|
18
|
+
type MenuGroupProps as GroupProps,
|
|
19
|
+
type MenuItemBodyProps as ItemBodyProps,
|
|
20
|
+
type MenuItemDescriptionProps as ItemDescriptionProps,
|
|
21
|
+
type MenuItemLabelProps as ItemLabelProps,
|
|
22
|
+
type MenuItemProps as ItemProps,
|
|
23
|
+
type MenuRootProps as RootProps,
|
|
24
|
+
type MenuScrollAreaProps as ScrollAreaProps,
|
|
25
|
+
type MenuTriggerProps as TriggerProps,
|
|
26
|
+
} from "./Menu";
|