@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
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { useControllableState } from "../../hooks/useControllableState.js";
|
|
2
2
|
import { usePressTap } from "../../hooks/usePressTap.js";
|
|
3
|
+
import { useScaleFeedback } from "../../hooks/useScaleFeedback.js";
|
|
4
|
+
import { mergeProps } from "../../utils/merge-props.js";
|
|
3
5
|
import { createSlotRecipeContext } from "../../utils/create-slot-recipe-context.jsx";
|
|
4
6
|
import { IconSlotProvider } from "../Icon/Icon.jsx";
|
|
7
|
+
import { ScaleFeedback } from "../ScaleFeedback/ScaleFeedback.jsx";
|
|
5
8
|
import * as React from "@lynx-js/react";
|
|
6
9
|
import clsx from "clsx";
|
|
7
10
|
import { useMemoizedFn } from "@lynx-js/lynx-ui-common";
|
|
@@ -30,7 +33,8 @@ var PageBannerRoot = React.forwardRef((props, ref) => {
|
|
|
30
33
|
});
|
|
31
34
|
const classNames = pageBanner({
|
|
32
35
|
...variantProps,
|
|
33
|
-
pressed: pressTap.pressed
|
|
36
|
+
pressed: pressTap.pressed,
|
|
37
|
+
interactive: isInteractive
|
|
34
38
|
});
|
|
35
39
|
const dismiss = useMemoizedFn(() => {
|
|
36
40
|
if (!open) return;
|
|
@@ -60,7 +64,7 @@ var PageBannerRoot = React.forwardRef((props, ref) => {
|
|
|
60
64
|
<ClassNamesProvider value={classNames}>
|
|
61
65
|
<PropsProvider value={variantProps}>
|
|
62
66
|
<IconSlotProvider value={iconSlotContextValue}>
|
|
63
|
-
<view {...ref ? { ref } : {}
|
|
67
|
+
<view {...mergeProps(ref ? { ref } : {}, isInteractive ? pressTap : {}, nativeProps)} accessibility-element={accessibilityElement ?? (isInteractive ? true : void 0)} accessibility-traits={accessibilityTraits ?? (isInteractive ? "button" : void 0)} className={clsx(classNames.root, className)} style={style}>
|
|
64
68
|
{children}
|
|
65
69
|
</view>
|
|
66
70
|
</IconSlotProvider>
|
|
@@ -72,7 +76,7 @@ PageBannerRoot.displayName = "PageBannerRoot";
|
|
|
72
76
|
var PageBannerContent = React.forwardRef((props, ref) => {
|
|
73
77
|
const { children, className, style, ...nativeProps } = props;
|
|
74
78
|
const classNames = useClassNames();
|
|
75
|
-
return <view {...ref ? { ref } : {}
|
|
79
|
+
return <view {...mergeProps(ref ? { ref } : {}, nativeProps)} className={clsx(classNames.content, className)} style={style}>
|
|
76
80
|
{children}
|
|
77
81
|
</view>;
|
|
78
82
|
});
|
|
@@ -80,7 +84,7 @@ PageBannerContent.displayName = "PageBannerContent";
|
|
|
80
84
|
var PageBannerBody = React.forwardRef((props, ref) => {
|
|
81
85
|
const { children, className, style, ...nativeProps } = props;
|
|
82
86
|
const classNames = useClassNames();
|
|
83
|
-
return <text {...ref ? { ref } : {}
|
|
87
|
+
return <text {...mergeProps(ref ? { ref } : {}, nativeProps)} className={clsx(classNames.body, className)} style={style}>
|
|
84
88
|
{children}
|
|
85
89
|
</text>;
|
|
86
90
|
});
|
|
@@ -88,7 +92,7 @@ PageBannerBody.displayName = "PageBannerBody";
|
|
|
88
92
|
var PageBannerTitle = React.forwardRef((props, ref) => {
|
|
89
93
|
const { children, className, style, ...nativeProps } = props;
|
|
90
94
|
const classNames = useClassNames();
|
|
91
|
-
return <text {...ref ? { ref } : {}
|
|
95
|
+
return <text {...mergeProps(ref ? { ref } : {}, nativeProps)} className={clsx(classNames.title, className)} style={style}>
|
|
92
96
|
{children}
|
|
93
97
|
{" "}
|
|
94
98
|
</text>;
|
|
@@ -97,7 +101,7 @@ PageBannerTitle.displayName = "PageBannerTitle";
|
|
|
97
101
|
var PageBannerDescription = React.forwardRef((props, ref) => {
|
|
98
102
|
const { children, className, style, ...nativeProps } = props;
|
|
99
103
|
const classNames = useClassNames();
|
|
100
|
-
return <text {...ref ? { ref } : {}
|
|
104
|
+
return <text {...mergeProps(ref ? { ref } : {}, nativeProps)} className={clsx(classNames.description, className)} style={style}>
|
|
101
105
|
{children}
|
|
102
106
|
</text>;
|
|
103
107
|
});
|
|
@@ -105,42 +109,49 @@ PageBannerDescription.displayName = "PageBannerDescription";
|
|
|
105
109
|
var PageBannerButton = React.forwardRef((props, ref) => {
|
|
106
110
|
const { children, className, style, "accessibility-element": accessibilityElement = true, "accessibility-traits": accessibilityTraits = "button", ...nativeProps } = props;
|
|
107
111
|
const classNames = useClassNames();
|
|
108
|
-
return <
|
|
109
|
-
{
|
|
110
|
-
|
|
112
|
+
return <ScaleFeedback>
|
|
113
|
+
<text {...mergeProps(ref ? { ref } : {}, nativeProps)} accessibility-element={accessibilityElement} accessibility-traits={accessibilityTraits} className={clsx(classNames.button, className)} style={style}>
|
|
114
|
+
{children}
|
|
115
|
+
</text>
|
|
116
|
+
</ScaleFeedback>;
|
|
111
117
|
});
|
|
112
118
|
PageBannerButton.displayName = "PageBannerButton";
|
|
113
119
|
var PageBannerCloseButton = React.forwardRef((props, ref) => {
|
|
114
120
|
const { children, className, style, bindtap, "main-thread:bindtap": mainThreadBindtap, "accessibility-element": accessibilityElement = true, "accessibility-label": accessibilityLabel, "accessibility-traits": accessibilityTraits = "button", ...nativeProps } = props;
|
|
115
121
|
const parentVariantProps = useProps() ?? {};
|
|
116
122
|
const { dismiss } = usePageBannerContext("PageBannerCloseButton");
|
|
117
|
-
const
|
|
123
|
+
const { pressed, bindtouchstart, bindtouchend, bindtouchcancel, ...pressTapHandlers } = usePressTap({
|
|
118
124
|
onTap: useMemoizedFn((event) => {
|
|
119
125
|
bindtap?.(event);
|
|
120
126
|
dismiss();
|
|
121
127
|
}),
|
|
122
128
|
mainThreadOnTap: mainThreadBindtap
|
|
123
129
|
});
|
|
130
|
+
const { scaleFeedbackTriggerProps, scaleFeedbackTargetProps } = useScaleFeedback({
|
|
131
|
+
onTouchStart: bindtouchstart,
|
|
132
|
+
onTouchEnd: bindtouchend,
|
|
133
|
+
onTouchCancel: bindtouchcancel
|
|
134
|
+
});
|
|
124
135
|
const classNames = pageBanner({
|
|
125
136
|
...parentVariantProps,
|
|
126
|
-
closeButtonPressed:
|
|
137
|
+
closeButtonPressed: pressed
|
|
127
138
|
});
|
|
128
139
|
const iconSlotContextValue = React.useMemo(() => ({
|
|
129
140
|
classNames: { suffixIcon: classNames.closeButtonIcon },
|
|
130
141
|
deps: [
|
|
131
142
|
parentVariantProps.tone ?? "neutral",
|
|
132
143
|
parentVariantProps.variant ?? "weak",
|
|
133
|
-
|
|
144
|
+
pressed
|
|
134
145
|
]
|
|
135
146
|
}), [
|
|
136
147
|
classNames.closeButtonIcon,
|
|
137
148
|
parentVariantProps.tone,
|
|
138
149
|
parentVariantProps.variant,
|
|
139
|
-
|
|
150
|
+
pressed
|
|
140
151
|
]);
|
|
141
152
|
if (process.env.NODE_ENV !== "production" && accessibilityElement && !accessibilityLabel) console.warn("PageBannerCloseButton requires `accessibility-label` for accessibility.");
|
|
142
153
|
return <IconSlotProvider value={iconSlotContextValue}>
|
|
143
|
-
<view {...ref ? { ref } : {}
|
|
154
|
+
<view {...mergeProps(ref ? { ref } : {}, pressTapHandlers, scaleFeedbackTriggerProps, scaleFeedbackTargetProps, nativeProps)} accessibility-element={accessibilityElement} accessibility-label={accessibilityLabel} accessibility-traits={accessibilityTraits} className={clsx(classNames.closeButton, className)} style={style} flatten={false}>
|
|
144
155
|
{children}
|
|
145
156
|
</view>
|
|
146
157
|
</IconSlotProvider>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ProgressCircleVariantProps } from '@seed-design/lynx-css/recipes/progress-circle';
|
|
2
|
-
import { LynxStyledElementProps } from '../../types';
|
|
2
|
+
import { LynxAccessibilityProps, LynxStyledElementProps } from '../../types';
|
|
3
3
|
import type * as React from "@lynx-js/react";
|
|
4
|
-
export interface ProgressCircleRootProps extends ProgressCircleVariantProps, LynxStyledElementProps {
|
|
4
|
+
export interface ProgressCircleRootProps extends ProgressCircleVariantProps, LynxStyledElementProps, LynxAccessibilityProps {
|
|
5
5
|
minValue?: number;
|
|
6
6
|
maxValue?: number;
|
|
7
7
|
value?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProgressCircle.d.ts","sourceRoot":"","sources":["../../../src/components/ProgressCircle/ProgressCircle.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,KAAK,MAAM,gBAAgB,CAAC;AAa7C,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,+CAA+C,CAAC;AAChG,OAAO,KAAK,EAAE,sBAAsB,EAAe,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"ProgressCircle.d.ts","sourceRoot":"","sources":["../../../src/components/ProgressCircle/ProgressCircle.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,KAAK,MAAM,gBAAgB,CAAC;AAa7C,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,+CAA+C,CAAC;AAChG,OAAO,KAAK,EAAE,sBAAsB,EAAE,sBAAsB,EAAe,MAAM,aAAa,CAAC;AA2I/F,MAAM,WAAW,uBACf,SAAQ,0BAA0B,EAChC,sBAAsB,EACtB,sBAAsB;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,MAAM,SAAS,GAAG,uBAAuB,CAAC;AAIhD;;;;;;;;;GASG;AACH,eAAO,MAAM,kBAAkB,yFAgD7B,CAAC;AAIH,eAAO,MAAM,mBAAmB;;;CAQ/B,CAAC"}
|
|
@@ -114,13 +114,14 @@ var TRANSITION_DURATION = 300;
|
|
|
114
114
|
*/
|
|
115
115
|
var ProgressCircleRoot = forwardRef((props, ref) => {
|
|
116
116
|
const [variantProps, otherProps] = progressCircle.splitVariantProps(props);
|
|
117
|
-
const { children, className, style, minValue, maxValue, value } = otherProps;
|
|
117
|
+
const { children, className, style, minValue, maxValue, value, "accessibility-element": accessibilityElement = true, "accessibility-role-description": accessibilityRoleDescription = "progressbar", "accessibility-value": accessibilityValue, ...nativeProps } = otherProps;
|
|
118
118
|
const size = variantProps.size ?? "40";
|
|
119
119
|
const tone = variantProps.tone ?? "neutral";
|
|
120
120
|
const numSize = Number(size);
|
|
121
121
|
const isDeterminate = minValue !== void 0 && maxValue !== void 0 && value !== void 0;
|
|
122
122
|
const range = (maxValue ?? 1) - (minValue ?? 0);
|
|
123
123
|
const progress = isDeterminate ? range === 0 ? 0 : ((value ?? 0) - (minValue ?? 0)) / range : 0;
|
|
124
|
+
const defaultAccessibilityValue = isDeterminate ? `minimum ${minValue}, maximum ${maxValue}, current ${value}` : "indeterminate";
|
|
124
125
|
const classes = progressCircle({
|
|
125
126
|
tone,
|
|
126
127
|
size
|
|
@@ -137,11 +138,11 @@ var ProgressCircleRoot = forwardRef((props, ref) => {
|
|
|
137
138
|
classes
|
|
138
139
|
]);
|
|
139
140
|
return <ProgressCircleContext.Provider value={ctx}>
|
|
140
|
-
<view {...ref ? { ref } : {}} className={clsx(classes.root, className)} style={{
|
|
141
|
+
<view {...nativeProps} {...ref ? { ref } : {}} className={clsx(classes.root, className)} style={{
|
|
141
142
|
...style,
|
|
142
143
|
width: `${numSize}px`,
|
|
143
144
|
height: `${numSize}px`
|
|
144
|
-
}}>
|
|
145
|
+
}} accessibility-element={accessibilityElement} accessibility-role-description={accessibilityRoleDescription} accessibility-value={accessibilityValue ?? defaultAccessibilityValue}>
|
|
145
146
|
{children}
|
|
146
147
|
</view>
|
|
147
148
|
</ProgressCircleContext.Provider>;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { ReactElement } from '@lynx-js/react';
|
|
2
2
|
import { RadioVariantProps } from '@seed-design/lynx-css/recipes/radio';
|
|
3
3
|
import { RadiomarkVariantProps } from '@seed-design/lynx-css/recipes/radiomark';
|
|
4
|
-
import {
|
|
4
|
+
import { ScaleFeedbackTargetProps } from '../../hooks/useScaleFeedback';
|
|
5
|
+
import { LynxAccessibilityProps, LynxIconElementProps, LynxStyledElementProps } from '../../types';
|
|
5
6
|
import * as React from "@lynx-js/react";
|
|
6
7
|
interface RadioGroupItemContextValue {
|
|
7
8
|
value: string;
|
|
@@ -9,16 +10,17 @@ interface RadioGroupItemContextValue {
|
|
|
9
10
|
disabled: boolean;
|
|
10
11
|
pressed: boolean;
|
|
11
12
|
select: () => void;
|
|
13
|
+
scaleFeedbackTargetProps: ScaleFeedbackTargetProps;
|
|
12
14
|
}
|
|
13
15
|
export declare function useRadioGroupItemContext(consumer: string): RadioGroupItemContextValue;
|
|
14
|
-
export interface RadioGroupRootProps extends RadioVariantProps, Omit<RadiomarkVariantProps, "size" | "checked" | "disabled">, LynxStyledElementProps {
|
|
16
|
+
export interface RadioGroupRootProps extends RadioVariantProps, Omit<RadiomarkVariantProps, "size" | "checked" | "disabled">, LynxStyledElementProps, LynxAccessibilityProps {
|
|
15
17
|
value?: string;
|
|
16
18
|
defaultValue?: string;
|
|
17
19
|
disabled?: boolean;
|
|
18
20
|
onValueChange?: (value: string) => void;
|
|
19
21
|
}
|
|
20
22
|
export declare const RadioGroupRoot: React.ForwardRefExoticComponent<RadioGroupRootProps & React.RefAttributes<unknown>>;
|
|
21
|
-
export interface RadioGroupItemProps extends LynxStyledElementProps {
|
|
23
|
+
export interface RadioGroupItemProps extends LynxStyledElementProps, LynxAccessibilityProps {
|
|
22
24
|
value: string;
|
|
23
25
|
disabled?: boolean;
|
|
24
26
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RadioGroup.d.ts","sourceRoot":"","sources":["../../../src/components/RadioGroup/RadioGroup.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAkB,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAInE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AAE7E,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;
|
|
1
|
+
{"version":3,"file":"RadioGroup.d.ts","sourceRoot":"","sources":["../../../src/components/RadioGroup/RadioGroup.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAkB,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAInE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AAE7E,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AAMrF,OAAO,EAAoB,KAAK,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AAC/F,OAAO,KAAK,EACV,sBAAsB,EACtB,oBAAoB,EACpB,sBAAsB,EAGvB,MAAM,aAAa,CAAC;AAoCrB,UAAU,0BAA0B;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,wBAAwB,EAAE,wBAAwB,CAAC;CACpD;AAID,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,MAAM,GAAG,0BAA0B,CAMrF;AAmBD,MAAM,WAAW,mBACf,SAAQ,iBAAiB,EACvB,IAAI,CAAC,qBAAqB,EAAE,MAAM,GAAG,SAAS,GAAG,UAAU,CAAC,EAC5D,sBAAsB,EACtB,sBAAsB;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACzC;AAED,eAAO,MAAM,cAAc,qFAiEzB,CAAC;AAKH,MAAM,WAAW,mBAAoB,SAAQ,sBAAsB,EAAE,sBAAsB;IACzF,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,eAAO,MAAM,cAAc,qFAiEzB,CAAC;AAKH,MAAM,WAAW,0BACf,SAAQ,IAAI,CAAC,qBAAqB,EAAE,MAAM,CAAC,EACzC,sBAAsB;CAAG;AAE7B,eAAO,MAAM,qBAAqB,4FAmCjC,CAAC;AAKF,MAAM,WAAW,4BACf,SAAQ,IAAI,CAAC,sBAAsB,EAAE,WAAW,GAAG,OAAO,CAAC;IAC3D,kGAAkG;IAClG,SAAS,CAAC,EAAE,YAAY,CAAC,oBAAoB,CAAC,CAAC;IAC/C,0GAA0G;IAC1G,OAAO,CAAC,EAAE,YAAY,CAAC,oBAAoB,CAAC,CAAC;CAC9C;AAED,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,4BAA4B,qBA6B1E;yBA7Be,uBAAuB;;;AAkCvC,MAAM,WAAW,wBAAyB,SAAQ,sBAAsB;CAAG;AAE3E,eAAO,MAAM,mBAAmB,0FAmB/B,CAAC"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { useControllableState } from "../../hooks/useControllableState.js";
|
|
2
2
|
import { usePressTap } from "../../hooks/usePressTap.js";
|
|
3
|
+
import { useScaleFeedback } from "../../hooks/useScaleFeedback.js";
|
|
4
|
+
import { mergeProps } from "../../utils/merge-props.js";
|
|
3
5
|
import { InternalIcon } from "../Icon/Icon.jsx";
|
|
6
|
+
import { ScaleFeedbackContentContext } from "../../contexts/ScaleFeedbackContentContext.js";
|
|
4
7
|
import { splitMultipleVariantsProps } from "../../utils/split-multiple-variants-props.js";
|
|
5
8
|
import * as React from "@lynx-js/react";
|
|
6
9
|
import { isValidElement } from "@lynx-js/react";
|
|
@@ -29,10 +32,11 @@ function useRadiomarkControlContext(consumer) {
|
|
|
29
32
|
}
|
|
30
33
|
var RadioGroupRoot = React.forwardRef((props, ref) => {
|
|
31
34
|
const { children, className, value: valueProp, defaultValue, disabled = false, onValueChange, ...restProps } = props;
|
|
32
|
-
const [{ radio: radioVariantProps, radiomark: radiomarkVariantProps },
|
|
35
|
+
const [{ radio: radioVariantProps, radiomark: radiomarkVariantProps }, restNativeProps] = splitMultipleVariantsProps(restProps, {
|
|
33
36
|
radio,
|
|
34
37
|
radiomark
|
|
35
38
|
});
|
|
39
|
+
const { "accessibility-element": accessibilityElement = true, "accessibility-role-description": accessibilityRoleDescription = "radiogroup", "accessibility-traits": accessibilityTraits, ...nativeProps } = restNativeProps;
|
|
36
40
|
const handleChange = React.useCallback((next) => {
|
|
37
41
|
if (next !== null) onValueChange?.(next);
|
|
38
42
|
}, [onValueChange]);
|
|
@@ -59,14 +63,14 @@ var RadioGroupRoot = React.forwardRef((props, ref) => {
|
|
|
59
63
|
radiomarkVariantProps
|
|
60
64
|
]);
|
|
61
65
|
return <RadioGroupContext.Provider value={contextValue}>
|
|
62
|
-
<view {...ref ? { ref } : {}} className={clsx(rootClassName, className)} {
|
|
66
|
+
<view {...mergeProps(ref ? { ref } : {}, nativeProps)} className={clsx(rootClassName, className)} accessibility-element={accessibilityElement} accessibility-role-description={accessibilityRoleDescription} accessibility-traits={accessibilityTraits ?? (disabled ? "disabled" : void 0)}>
|
|
63
67
|
{children}
|
|
64
68
|
</view>
|
|
65
69
|
</RadioGroupContext.Provider>;
|
|
66
70
|
});
|
|
67
71
|
RadioGroupRoot.displayName = "RadioGroupRoot";
|
|
68
72
|
var RadioGroupItem = React.forwardRef((props, ref) => {
|
|
69
|
-
const { value: itemValue, disabled: itemDisabled = false, children, className, ...nativeProps } = props;
|
|
73
|
+
const { value: itemValue, disabled: itemDisabled = false, children, className, "accessibility-element": accessibilityElement = true, "accessibility-role-description": accessibilityRoleDescription = "radio", "accessibility-traits": accessibilityTraits, "accessibility-value": accessibilityValue, ...nativeProps } = props;
|
|
70
74
|
const groupContext = useRadioGroupContext("RadioGroupItem");
|
|
71
75
|
const disabled = groupContext.disabled || itemDisabled;
|
|
72
76
|
const checked = groupContext.value === itemValue;
|
|
@@ -78,10 +82,16 @@ var RadioGroupItem = React.forwardRef((props, ref) => {
|
|
|
78
82
|
groupContext,
|
|
79
83
|
itemValue
|
|
80
84
|
]);
|
|
81
|
-
const { pressed, ...pressHandlers } = usePressTap({
|
|
85
|
+
const { pressed, bindtouchstart, bindtouchend, bindtouchcancel, ...pressHandlers } = usePressTap({
|
|
82
86
|
disabled,
|
|
83
87
|
onTap: select
|
|
84
88
|
});
|
|
89
|
+
const { scaleFeedbackTriggerProps, scaleFeedbackTargetProps } = useScaleFeedback({
|
|
90
|
+
disabled,
|
|
91
|
+
onTouchStart: bindtouchstart,
|
|
92
|
+
onTouchEnd: bindtouchend,
|
|
93
|
+
onTouchCancel: bindtouchcancel
|
|
94
|
+
});
|
|
85
95
|
const rootClassName = radio({
|
|
86
96
|
...groupContext.radioVariantProps,
|
|
87
97
|
disabled
|
|
@@ -91,16 +101,18 @@ var RadioGroupItem = React.forwardRef((props, ref) => {
|
|
|
91
101
|
checked,
|
|
92
102
|
disabled,
|
|
93
103
|
pressed,
|
|
94
|
-
select
|
|
104
|
+
select,
|
|
105
|
+
scaleFeedbackTargetProps
|
|
95
106
|
}), [
|
|
96
107
|
itemValue,
|
|
97
108
|
checked,
|
|
98
109
|
disabled,
|
|
99
110
|
pressed,
|
|
100
|
-
select
|
|
111
|
+
select,
|
|
112
|
+
scaleFeedbackTargetProps
|
|
101
113
|
]);
|
|
102
114
|
return <RadioGroupItemContext.Provider value={itemContextValue}>
|
|
103
|
-
<view {...ref ? { ref } : {}} className={clsx(rootClassName, className)} {
|
|
115
|
+
<view {...mergeProps(ref ? { ref } : {}, scaleFeedbackTriggerProps, pressHandlers, nativeProps)} className={clsx(rootClassName, className)} accessibility-element={accessibilityElement} accessibility-role-description={accessibilityRoleDescription} accessibility-traits={accessibilityTraits ?? (disabled ? "disabled" : void 0)} accessibility-value={accessibilityValue ?? (checked ? "selected" : "not selected")}>
|
|
104
116
|
{children}
|
|
105
117
|
</view>
|
|
106
118
|
</RadioGroupItemContext.Provider>;
|
|
@@ -111,6 +123,7 @@ var RadioGroupItemControl = React.forwardRef((props, ref) => {
|
|
|
111
123
|
const { children, className, ...nativeProps } = restProps;
|
|
112
124
|
const groupContext = useRadioGroupContext("RadioGroupItemControl");
|
|
113
125
|
const itemContext = useRadioGroupItemContext("RadioGroupItemControl");
|
|
126
|
+
const hasScaledContent = React.useContext(ScaleFeedbackContentContext);
|
|
114
127
|
const radiomarkVariantProps = {
|
|
115
128
|
...groupContext.radiomarkVariantProps,
|
|
116
129
|
...variantProps,
|
|
@@ -124,7 +137,7 @@ var RadioGroupItemControl = React.forwardRef((props, ref) => {
|
|
|
124
137
|
iconClassName: classes.icon,
|
|
125
138
|
radiomarkVariantProps
|
|
126
139
|
}}>
|
|
127
|
-
<view {...ref ? { ref } : {}} className={clsx(classes.root, controlClassName, className)} {
|
|
140
|
+
<view {...mergeProps(ref ? { ref } : {}, !hasScaledContent ? itemContext.scaleFeedbackTargetProps : {}, nativeProps)} className={clsx(classes.root, controlClassName, className)} {...!hasScaledContent ? { flatten: false } : {}}>
|
|
128
141
|
{children}
|
|
129
142
|
</view>
|
|
130
143
|
</RadiomarkControlContext.Provider>;
|
|
@@ -152,7 +165,7 @@ var RadioGroupItemLabel = React.forwardRef((props, ref) => {
|
|
|
152
165
|
...useRadioGroupContext("RadioGroupItemLabel").radioVariantProps,
|
|
153
166
|
disabled: itemContext.disabled
|
|
154
167
|
}).label;
|
|
155
|
-
return <text {...ref ? { ref } : {}} className={clsx(labelClassName, className)}
|
|
168
|
+
return <text {...mergeProps(ref ? { ref } : {}, nativeProps)} className={clsx(labelClassName, className)}>
|
|
156
169
|
{children}
|
|
157
170
|
</text>;
|
|
158
171
|
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ReactionButtonVariantProps } from '@seed-design/lynx-css/recipes/reaction-button';
|
|
2
|
+
import { LynxAccessibilityProps, LynxPressableProps, LynxStyledElementProps } from '../../types';
|
|
3
|
+
import * as React from "@lynx-js/react";
|
|
4
|
+
/**
|
|
5
|
+
* @platform Lynx
|
|
6
|
+
*
|
|
7
|
+
* 웹 대비 미지원 기능:
|
|
8
|
+
* - HTML button 속성 및 native form 제출
|
|
9
|
+
* - 키보드 focus / focusVisible
|
|
10
|
+
* - `asChild`
|
|
11
|
+
*/
|
|
12
|
+
export interface ReactionButtonProps extends Omit<ReactionButtonVariantProps, "selected" | "pressed" | "disabled" | "loading">, LynxStyledElementProps, LynxPressableProps, LynxAccessibilityProps {
|
|
13
|
+
pressed?: boolean;
|
|
14
|
+
defaultPressed?: boolean;
|
|
15
|
+
onPressedChange?: (pressed: boolean) => void;
|
|
16
|
+
disabled?: boolean;
|
|
17
|
+
loading?: boolean;
|
|
18
|
+
}
|
|
19
|
+
export declare const ReactionButton: React.ForwardRefExoticComponent<ReactionButtonProps & React.RefAttributes<unknown>>;
|
|
20
|
+
//# sourceMappingURL=ReactionButton.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ReactionButton.d.ts","sourceRoot":"","sources":["../../../src/components/ReactionButton/ReactionButton.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,+CAA+C,CAAC;AAEhG,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAC;AAKxC,OAAO,KAAK,EACV,sBAAsB,EACtB,kBAAkB,EAClB,sBAAsB,EAEvB,MAAM,aAAa,CAAC;AAMrB;;;;;;;GAOG;AACH,MAAM,WAAW,mBACf,SAAQ,IAAI,CAAC,0BAA0B,EAAE,UAAU,GAAG,SAAS,GAAG,UAAU,GAAG,SAAS,CAAC,EACvF,sBAAsB,EACtB,kBAAkB,EAClB,sBAAsB;IACxB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,eAAe,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IAC7C,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,eAAO,MAAM,cAAc,qFAkGzB,CAAC"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { useControllableState } from "../../hooks/useControllableState.js";
|
|
2
|
+
import { usePressTap } from "../../hooks/usePressTap.js";
|
|
3
|
+
import { toArray } from "../../utils/children.js";
|
|
4
|
+
import { IconSlotProvider, getIconSlotName } from "../Icon/Icon.jsx";
|
|
5
|
+
import { ProgressCircleRange, ProgressCircleRoot } from "../ProgressCircle/ProgressCircle.jsx";
|
|
6
|
+
import { isCountElement } from "../Count/Count.jsx";
|
|
7
|
+
import * as React from "@lynx-js/react";
|
|
8
|
+
import { cloneElement, useMemo } from "@lynx-js/react";
|
|
9
|
+
import clsx from "clsx";
|
|
10
|
+
import { reactionButton } from "@seed-design/lynx-css/recipes/reaction-button";
|
|
11
|
+
//#region src/components/ReactionButton/ReactionButton.tsx
|
|
12
|
+
var ReactionButton = React.forwardRef((props, ref) => {
|
|
13
|
+
const [variantProps, otherProps] = reactionButton.splitVariantProps(props);
|
|
14
|
+
const { children, className, style, defaultPressed = false, onPressedChange, bindtap, "main-thread:bindtap": mainThreadBindtap, "accessibility-element": accessibilityElement = true, "accessibility-traits": accessibilityTraits, ...nativeProps } = otherProps;
|
|
15
|
+
const { size, pressed: pressedProp, disabled = false, loading = false } = variantProps;
|
|
16
|
+
const [selected, setSelected] = useControllableState({
|
|
17
|
+
value: pressedProp,
|
|
18
|
+
defaultValue: defaultPressed,
|
|
19
|
+
onChange: onPressedChange
|
|
20
|
+
});
|
|
21
|
+
const { pressed, ...pressHandlers } = usePressTap({
|
|
22
|
+
disabled,
|
|
23
|
+
onTap: React.useCallback((...args) => {
|
|
24
|
+
setSelected(!selected);
|
|
25
|
+
bindtap?.(...args);
|
|
26
|
+
}, [
|
|
27
|
+
bindtap,
|
|
28
|
+
selected,
|
|
29
|
+
setSelected
|
|
30
|
+
]),
|
|
31
|
+
mainThreadOnTap: mainThreadBindtap
|
|
32
|
+
});
|
|
33
|
+
const classNames = reactionButton({
|
|
34
|
+
...variantProps,
|
|
35
|
+
selected,
|
|
36
|
+
pressed,
|
|
37
|
+
disabled,
|
|
38
|
+
loading
|
|
39
|
+
});
|
|
40
|
+
const iconSlotContextValue = useMemo(() => ({
|
|
41
|
+
classNames: { prefixIcon: classNames.prefixIcon },
|
|
42
|
+
deps: [
|
|
43
|
+
size ?? "small",
|
|
44
|
+
selected,
|
|
45
|
+
pressed,
|
|
46
|
+
disabled,
|
|
47
|
+
loading
|
|
48
|
+
]
|
|
49
|
+
}), [
|
|
50
|
+
classNames.prefixIcon,
|
|
51
|
+
size,
|
|
52
|
+
selected,
|
|
53
|
+
pressed,
|
|
54
|
+
disabled,
|
|
55
|
+
loading
|
|
56
|
+
]);
|
|
57
|
+
const prefixIconChildren = [];
|
|
58
|
+
const labelChildren = [];
|
|
59
|
+
const countChildren = [];
|
|
60
|
+
for (const child of toArray(children)) {
|
|
61
|
+
if (getIconSlotName(child) === "prefixIcon") {
|
|
62
|
+
prefixIconChildren.push(child);
|
|
63
|
+
continue;
|
|
64
|
+
}
|
|
65
|
+
if (isCountElement(child)) {
|
|
66
|
+
countChildren.push(child);
|
|
67
|
+
continue;
|
|
68
|
+
}
|
|
69
|
+
labelChildren.push(child);
|
|
70
|
+
}
|
|
71
|
+
return <IconSlotProvider value={iconSlotContextValue}>
|
|
72
|
+
<view {...ref ? { ref } : {}} {...nativeProps} className={clsx(classNames.root, className)} style={style} accessibility-element={accessibilityElement} accessibility-traits={disabled ? "disabled" : selected ? "selected" : accessibilityTraits ?? "button"} {...pressHandlers}>
|
|
73
|
+
<view className={classNames.content}>
|
|
74
|
+
{prefixIconChildren}
|
|
75
|
+
{labelChildren.length > 0 ? <text className={classNames.label}>{labelChildren}</text> : null}
|
|
76
|
+
{countChildren.map((child) => cloneElement(child, { className: clsx(classNames.count, child.props.className) }))}
|
|
77
|
+
</view>
|
|
78
|
+
{loading ? <view className={classNames.loadingIndicator}>
|
|
79
|
+
<ProgressCircleRoot size="14" tone="inherit">
|
|
80
|
+
<ProgressCircleRange />
|
|
81
|
+
</ProgressCircleRoot>
|
|
82
|
+
</view> : null}
|
|
83
|
+
</view>
|
|
84
|
+
</IconSlotProvider>;
|
|
85
|
+
});
|
|
86
|
+
ReactionButton.displayName = "ReactionButton";
|
|
87
|
+
//#endregion
|
|
88
|
+
export { ReactionButton };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/ReactionButton/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,KAAK,mBAAmB,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { UseScaleFeedbackOptions } from '../../hooks/useScaleFeedback';
|
|
2
|
+
import * as React from "@lynx-js/react";
|
|
3
|
+
export interface ScaleFeedbackProps extends UseScaleFeedbackOptions {
|
|
4
|
+
/** Content rendered inside the native element that receives Self Scale Feedback. */
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Applies Self Scale Feedback through a native Lynx view.
|
|
9
|
+
*/
|
|
10
|
+
export declare const ScaleFeedback: React.ForwardRefExoticComponent<ScaleFeedbackProps & React.RefAttributes<unknown>>;
|
|
11
|
+
//# sourceMappingURL=ScaleFeedback.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ScaleFeedback.d.ts","sourceRoot":"","sources":["../../../src/components/ScaleFeedback/ScaleFeedback.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAoB,KAAK,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAI9F,MAAM,WAAW,kBAAmB,SAAQ,uBAAuB;IACjE,oFAAoF;IACpF,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED;;GAEG;AACH,eAAO,MAAM,aAAa,oFAgBzB,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { useScaleFeedback } from "../../hooks/useScaleFeedback.js";
|
|
2
|
+
import { mergeProps } from "../../utils/merge-props.js";
|
|
3
|
+
import * as React from "@lynx-js/react";
|
|
4
|
+
//#region src/components/ScaleFeedback/ScaleFeedback.tsx
|
|
5
|
+
/**
|
|
6
|
+
* Applies Self Scale Feedback through a native Lynx view.
|
|
7
|
+
*/
|
|
8
|
+
var ScaleFeedback = React.forwardRef(({ children, ...options }, ref) => {
|
|
9
|
+
const { scaleFeedbackTriggerProps, scaleFeedbackTargetProps } = useScaleFeedback(options);
|
|
10
|
+
return <view {...mergeProps(ref ? { ref } : {}, scaleFeedbackTriggerProps, scaleFeedbackTargetProps)}>
|
|
11
|
+
{children}
|
|
12
|
+
</view>;
|
|
13
|
+
});
|
|
14
|
+
ScaleFeedback.displayName = "ScaleFeedback";
|
|
15
|
+
//#endregion
|
|
16
|
+
export { ScaleFeedback };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/ScaleFeedback/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC"}
|
|
@@ -17,6 +17,7 @@ export interface SegmentedControlRootProps extends LynxStyledElementProps, LynxA
|
|
|
17
17
|
export declare const SegmentedControlRoot: React.ForwardRefExoticComponent<SegmentedControlRootProps & React.RefAttributes<unknown>>;
|
|
18
18
|
export interface SegmentedControlItemProps extends Omit<LynxStyledElementProps, "children">, LynxAccessibilityProps, LynxPressableProps {
|
|
19
19
|
children: string | number;
|
|
20
|
+
notification?: React.ReactNode;
|
|
20
21
|
value: string;
|
|
21
22
|
disabled?: boolean;
|
|
22
23
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SegmentedControl.d.ts","sourceRoot":"","sources":["../../../src/components/SegmentedControl/SegmentedControl.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"SegmentedControl.d.ts","sourceRoot":"","sources":["../../../src/components/SegmentedControl/SegmentedControl.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAC;AAMxC,OAAO,KAAK,EACV,sBAAsB,EACtB,kBAAkB,EAClB,sBAAsB,EAGvB,MAAM,aAAa,CAAC;AAwBrB;;;;;;;GAOG;AACH,MAAM,WAAW,yBAA0B,SAAQ,sBAAsB,EAAE,sBAAsB;IAC/F,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACzC;AAED,eAAO,MAAM,oBAAoB,2FA4EhC,CAAC;AAGF,MAAM,WAAW,yBACf,SAAQ,IAAI,CAAC,sBAAsB,EAAE,UAAU,CAAC,EAC9C,sBAAsB,EACtB,kBAAkB;IACpB,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAC;IAC1B,YAAY,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,eAAO,MAAM,oBAAoB,2FA+FhC,CAAC;AAGF,MAAM,WAAW,8BAA+B,SAAQ,sBAAsB;CAAG;AAEjF,eAAO,MAAM,yBAAyB,gGAcrC,CAAC"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { useControllableState } from "../../hooks/useControllableState.js";
|
|
2
2
|
import { usePressTap } from "../../hooks/usePressTap.js";
|
|
3
|
+
import { useScaleFeedback } from "../../hooks/useScaleFeedback.js";
|
|
4
|
+
import { mergeProps } from "../../utils/merge-props.js";
|
|
3
5
|
import { createSlotRecipeContext } from "../../utils/create-slot-recipe-context.jsx";
|
|
6
|
+
import { HStack } from "../Stack/Stack.jsx";
|
|
4
7
|
import * as React from "@lynx-js/react";
|
|
5
8
|
import clsx from "clsx";
|
|
6
9
|
import { segmentedControl } from "@seed-design/lynx-css/recipes/segmented-control";
|
|
@@ -53,7 +56,7 @@ var SegmentedControlRoot = React.forwardRef((props, ref) => {
|
|
|
53
56
|
]);
|
|
54
57
|
return <SegmentedControlContext.Provider value={contextValue}>
|
|
55
58
|
<ClassNamesProvider value={classNames}>
|
|
56
|
-
<view {...ref ? { ref } : {}
|
|
59
|
+
<view {...mergeProps(ref ? { ref } : {}, nativeProps)} accessibility-element={accessibilityElement} accessibility-role-description={accessibilityRoleDescription} className={clsx(classNames.root, className)} style={{
|
|
57
60
|
"--segment-count": Math.max(items.length, 1).toString(),
|
|
58
61
|
"--segment-index": Math.max(selectedIndex, 0).toString(),
|
|
59
62
|
...style
|
|
@@ -65,7 +68,7 @@ var SegmentedControlRoot = React.forwardRef((props, ref) => {
|
|
|
65
68
|
});
|
|
66
69
|
SegmentedControlRoot.displayName = "SegmentedControlRoot";
|
|
67
70
|
var SegmentedControlItem = React.forwardRef((props, ref) => {
|
|
68
|
-
const { children, className, style, value: itemValue, disabled: itemDisabled = false, bindtap, "main-thread:bindtap": mainThreadBindtap, "accessibility-element": accessibilityElement = true, "accessibility-label": accessibilityLabel, "accessibility-role-description": accessibilityRoleDescription = "radio", "accessibility-traits": accessibilityTraits, ...nativeProps } = props;
|
|
71
|
+
const { children, notification, className, style, value: itemValue, disabled: itemDisabled = false, bindtap, "main-thread:bindtap": mainThreadBindtap, "accessibility-element": accessibilityElement = true, "accessibility-label": accessibilityLabel, "accessibility-role-description": accessibilityRoleDescription = "radio", "accessibility-traits": accessibilityTraits, ...nativeProps } = props;
|
|
69
72
|
const context = useSegmentedControlContext("SegmentedControlItem");
|
|
70
73
|
const disabled = context.disabled || itemDisabled;
|
|
71
74
|
const selected = context.value === itemValue;
|
|
@@ -84,15 +87,20 @@ var SegmentedControlItem = React.forwardRef((props, ref) => {
|
|
|
84
87
|
selected
|
|
85
88
|
]);
|
|
86
89
|
const pressSelectionRef = React.useRef(selected);
|
|
87
|
-
const { pressed, bindtouchstart, ...pressHandlers } = usePressTap({
|
|
90
|
+
const { pressed, bindtouchstart, bindtouchend, bindtouchcancel, ...pressHandlers } = usePressTap({
|
|
88
91
|
disabled,
|
|
89
92
|
onTap: handleTap,
|
|
90
93
|
mainThreadOnTap: mainThreadBindtap
|
|
91
94
|
});
|
|
92
|
-
const
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
95
|
+
const { scaleFeedbackTriggerProps, scaleFeedbackTargetProps } = useScaleFeedback({
|
|
96
|
+
disabled,
|
|
97
|
+
onTouchStart: React.useCallback((...args) => {
|
|
98
|
+
pressSelectionRef.current = selected;
|
|
99
|
+
bindtouchstart(...args);
|
|
100
|
+
}, [bindtouchstart, selected]),
|
|
101
|
+
onTouchEnd: bindtouchend,
|
|
102
|
+
onTouchCancel: bindtouchcancel
|
|
103
|
+
});
|
|
96
104
|
const classes = segmentedControl({
|
|
97
105
|
selected,
|
|
98
106
|
disabled,
|
|
@@ -104,16 +112,21 @@ var SegmentedControlItem = React.forwardRef((props, ref) => {
|
|
|
104
112
|
pressed
|
|
105
113
|
});
|
|
106
114
|
const label = typeof children === "string" || typeof children === "number" ? String(children) : void 0;
|
|
107
|
-
return <view {...ref ? { ref } : {}
|
|
115
|
+
return <view {...mergeProps(ref ? { ref } : {}, scaleFeedbackTriggerProps, pressHandlers, nativeProps)} accessibility-element={accessibilityElement} accessibility-label={accessibilityLabel ?? label} accessibility-role-description={accessibilityRoleDescription} accessibility-value={selected ? "selected" : "not selected"} accessibility-traits={disabled ? "disabled" : selected ? "selected" : accessibilityTraits ?? "button"} className={clsx(classes.item, className)} style={style}>
|
|
108
116
|
<view accessibility-elements-hidden={true} className={pressStartClasses.itemBackground} />
|
|
109
|
-
<
|
|
117
|
+
<view className={classes.itemContent} {...scaleFeedbackTargetProps}>
|
|
118
|
+
{notification ? <HStack position="relative" align="flex-start">
|
|
119
|
+
<text className={classes.label}>{children}</text>
|
|
120
|
+
<view accessibility-elements-hidden={true}>{notification}</view>
|
|
121
|
+
</HStack> : <text className={classes.label}>{children}</text>}
|
|
122
|
+
</view>
|
|
110
123
|
</view>;
|
|
111
124
|
});
|
|
112
125
|
SegmentedControlItem.displayName = "SegmentedControlItem";
|
|
113
126
|
var SegmentedControlIndicator = React.forwardRef((props, ref) => {
|
|
114
127
|
const { className, style, ...nativeProps } = props;
|
|
115
128
|
const classNames = useClassNames();
|
|
116
|
-
return <view {...ref ? { ref } : {}
|
|
129
|
+
return <view {...mergeProps(ref ? { ref } : {}, nativeProps)} accessibility-elements-hidden={true} className={clsx(classNames.indicator, className)} style={style} />;
|
|
117
130
|
});
|
|
118
131
|
SegmentedControlIndicator.displayName = "SegmentedControlIndicator";
|
|
119
132
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectBox.d.ts","sourceRoot":"","sources":["../../../src/components/SelectBox/SelectBox.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAC;AAGxC,OAAO,EAAa,KAAK,qBAAqB,EAAE,MAAM,0CAA0C,CAAC;
|
|
1
|
+
{"version":3,"file":"SelectBox.d.ts","sourceRoot":"","sources":["../../../src/components/SelectBox/SelectBox.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAC;AAGxC,OAAO,EAAa,KAAK,qBAAqB,EAAE,MAAM,0CAA0C,CAAC;AASjG,OAAO,KAAK,EACV,sBAAsB,EACtB,sBAAsB,EAIvB,MAAM,aAAa,CAAC;AAErB,OAAO,EAAgB,KAAK,iBAAiB,EAAsB,MAAM,sBAAsB,CAAC;AAChG,OAAO,EAAkC,KAAK,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACtF,OAAO,EAEL,KAAK,mBAAmB,EAEzB,MAAM,0BAA0B,CAAC;AAGlC;;;;;;;GAOG;AAEH,KAAK,gBAAgB,GAAG,eAAe,GAAG,mBAAmB,GAAG,QAAQ,CAAC;AACzE,KAAK,2BAA2B,GAAG,IAAI,CACrC,qBAAqB,EACrB,UAAU,GAAG,SAAS,GAAG,UAAU,GAAG,YAAY,CACnD,CAAC;AA6EF,MAAM,WAAW,mBAAoB,SAAQ,sBAAsB;IACjE;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAqBD,MAAM,WAAW,wBAAyB,SAAQ,mBAAmB;CAAG;AACxE,eAAO,MAAM,mBAAmB,qFAAiB,CAAC;AAElD,MAAM,WAAW,wBAAyB,SAAQ,mBAAmB;CAAG;AACxE,eAAO,MAAM,mBAAmB,qFAAiB,CAAC;AAIlD,MAAM,WAAW,uBACf,SAAQ,2BAA2B,EACjC,sBAAsB,EACtB,sBAAsB,EACtB,IAAI,CACF,iBAAiB,EACjB,SAAS,GAAG,gBAAgB,GAAG,eAAe,GAAG,UAAU,GAAG,iBAAiB,CAChF;IACH,+BAA+B;IAC/B,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;CACrC;AAoCD,eAAO,MAAM,kBAAkB,yFA6C9B,CAAC;AAKF,MAAM,WAAW,uBACf,SAAQ,2BAA2B,EACjC,sBAAsB,EACtB,sBAAsB,EACtB,IAAI,CAAC,mBAAmB,EAAE,OAAO,GAAG,UAAU,CAAC;IACjD,+BAA+B;IAC/B,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;CACrC;AAoCD,eAAO,MAAM,kBAAkB,yFAuC9B,CAAC;AAiEF,MAAM,WAAW,0BAA2B,SAAQ,sBAAsB;CAAG;AAC7E,eAAO,MAAM,qBAAqB,wFAAqD,CAAC;AACxF,MAAM,WAAW,0BAA2B,SAAQ,sBAAsB;CAAG;AAC7E,eAAO,MAAM,qBAAqB,wFAAqD,CAAC;AACxF,MAAM,WAAW,uBAAwB,SAAQ,sBAAsB;CAAG;AAC1E,eAAO,MAAM,kBAAkB,wFAA+C,CAAC;AAC/E,MAAM,WAAW,wBAAyB,SAAQ,sBAAsB;CAAG;AAC3E,eAAO,MAAM,mBAAmB,wFAAyC,CAAC;AAC1E,MAAM,WAAW,8BAA+B,SAAQ,sBAAsB;CAAG;AACjF,eAAO,MAAM,yBAAyB,wFAA6D,CAAC;AAEpG,MAAM,WAAW,0BAA2B,SAAQ,sBAAsB;CAAG;AAC7E,eAAO,MAAM,qBAAqB,wFAAqD,CAAC;AACxF,MAAM,WAAW,0BAA2B,SAAQ,sBAAsB;CAAG;AAC7E,eAAO,MAAM,qBAAqB,wFAAqD,CAAC;AACxF,MAAM,WAAW,uBAAwB,SAAQ,sBAAsB;CAAG;AAC1E,eAAO,MAAM,kBAAkB,wFAA+C,CAAC;AAC/E,MAAM,WAAW,wBAAyB,SAAQ,sBAAsB;CAAG;AAC3E,eAAO,MAAM,mBAAmB,wFAAyC,CAAC;AAC1E,MAAM,WAAW,8BAA+B,SAAQ,sBAAsB;CAAG;AACjF,eAAO,MAAM,yBAAyB,wFAA6D,CAAC;AAIpG,MAAM,WAAW,oBAAqB,SAAQ,sBAAsB,EAAE,sBAAsB;CAAG;AAqD/F,MAAM,WAAW,yBAA0B,SAAQ,oBAAoB;CAAG;AAC1E,eAAO,MAAM,oBAAoB,sFAAkB,CAAC;AACpD,MAAM,WAAW,yBAA0B,SAAQ,oBAAoB;CAAG;AAC1E,eAAO,MAAM,oBAAoB,sFAAkB,CAAC;AAWpD,MAAM,WAAW,mCAAoC,SAAQ,sBAAsB;CAAG;AAEtF,eAAO,MAAM,8BAA8B,qGAwBzC,CAAC;AAGH,MAAM,WAAW,gCAAiC,SAAQ,IAAI,CAAC,iBAAiB,EAAE,MAAM,CAAC;CAAG;AAE5F,eAAO,MAAM,2BAA2B,kGAuBtC,CAAC"}
|