@seed-design/react 2.2.2 → 2.4.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/ActionButton/ActionButton.cjs +5 -2
- package/lib/components/ActionButton/ActionButton.d.ts.map +1 -1
- package/lib/components/ActionButton/ActionButton.js +5 -2
- package/lib/components/AttachmentDisplay/AttachmentDisplayItem.cjs +9 -6
- package/lib/components/AttachmentDisplay/AttachmentDisplayItem.d.ts.map +1 -1
- package/lib/components/AttachmentDisplay/AttachmentDisplayItem.js +9 -6
- package/lib/components/AttachmentDisplay/AttachmentDisplayTrigger.cjs +2 -1
- package/lib/components/AttachmentDisplay/AttachmentDisplayTrigger.d.ts.map +1 -1
- package/lib/components/AttachmentDisplay/AttachmentDisplayTrigger.js +2 -1
- package/lib/components/AttachmentInput/AttachmentInputItem.cjs +9 -6
- package/lib/components/AttachmentInput/AttachmentInputItem.d.ts.map +1 -1
- package/lib/components/AttachmentInput/AttachmentInputItem.js +9 -6
- package/lib/components/AttachmentInput/AttachmentInputTrigger.cjs +2 -1
- package/lib/components/AttachmentInput/AttachmentInputTrigger.d.ts.map +1 -1
- package/lib/components/AttachmentInput/AttachmentInputTrigger.js +2 -1
- package/lib/components/BottomSheet/BottomSheet.cjs +5 -3
- package/lib/components/BottomSheet/BottomSheet.d.ts.map +1 -1
- package/lib/components/BottomSheet/BottomSheet.js +5 -3
- package/lib/components/Callout/Callout.cjs +3 -2
- package/lib/components/Callout/Callout.d.ts.map +1 -1
- package/lib/components/Callout/Callout.js +3 -2
- package/lib/components/Checkbox/Checkbox.cjs +2 -1
- package/lib/components/Checkbox/Checkbox.d.ts.map +1 -1
- package/lib/components/Checkbox/Checkbox.js +2 -1
- package/lib/components/Chip/Chip.cjs +2 -1
- package/lib/components/Chip/Chip.d.ts.map +1 -1
- package/lib/components/Chip/Chip.js +2 -1
- package/lib/components/ChipTabs/ChipTabs.cjs +2 -1
- package/lib/components/ChipTabs/ChipTabs.d.ts.map +1 -1
- package/lib/components/ChipTabs/ChipTabs.js +2 -1
- package/lib/components/ContentDialog/ContentDialog.cjs +5 -3
- package/lib/components/ContentDialog/ContentDialog.d.ts.map +1 -1
- package/lib/components/ContentDialog/ContentDialog.js +5 -3
- package/lib/components/ContextualFloatingButton/ContextualFloatingButton.cjs +5 -2
- package/lib/components/ContextualFloatingButton/ContextualFloatingButton.d.ts.map +1 -1
- package/lib/components/ContextualFloatingButton/ContextualFloatingButton.js +5 -2
- package/lib/components/DatePicker/DatePicker.cjs +2 -2
- package/lib/components/DatePicker/DatePicker.d.ts +10 -4
- package/lib/components/DatePicker/DatePicker.d.ts.map +1 -1
- package/lib/components/DatePicker/DatePicker.js +2 -2
- package/lib/components/DatePicker/index.d.ts +1 -1
- package/lib/components/DatePicker/index.d.ts.map +1 -1
- package/lib/components/FieldButton/FieldButton.cjs +2 -1
- package/lib/components/FieldButton/FieldButton.d.ts.map +1 -1
- package/lib/components/FieldButton/FieldButton.js +2 -1
- package/lib/components/FloatingActionButton/FloatingActionButton.cjs +2 -1
- package/lib/components/FloatingActionButton/FloatingActionButton.d.ts.map +1 -1
- package/lib/components/FloatingActionButton/FloatingActionButton.js +2 -1
- package/lib/components/HelpBubble/HelpBubble.cjs +2 -1
- package/lib/components/HelpBubble/HelpBubble.d.ts.map +1 -1
- package/lib/components/HelpBubble/HelpBubble.js +2 -1
- package/lib/components/ImageFrame/ImageFrame.cjs +5 -2
- package/lib/components/ImageFrame/ImageFrame.d.ts.map +1 -1
- package/lib/components/ImageFrame/ImageFrame.js +5 -2
- package/lib/components/LoadingIndicator/usePendingButton.d.ts +57 -57
- package/lib/components/MenuSheet/MenuSheet.cjs +2 -1
- package/lib/components/MenuSheet/MenuSheet.d.ts.map +1 -1
- package/lib/components/MenuSheet/MenuSheet.js +2 -1
- package/lib/components/PageBanner/PageBanner.cjs +3 -2
- package/lib/components/PageBanner/PageBanner.d.ts.map +1 -1
- package/lib/components/PageBanner/PageBanner.js +3 -2
- package/lib/components/QuantityPicker/QuantityPicker.cjs +8 -4
- package/lib/components/QuantityPicker/QuantityPicker.d.ts.map +1 -1
- package/lib/components/QuantityPicker/QuantityPicker.js +8 -4
- package/lib/components/RadioGroup/RadioGroup.cjs +2 -1
- package/lib/components/RadioGroup/RadioGroup.d.ts.map +1 -1
- package/lib/components/RadioGroup/RadioGroup.js +2 -1
- package/lib/components/ReactionButton/ReactionButton.cjs +5 -2
- package/lib/components/ReactionButton/ReactionButton.d.ts.map +1 -1
- package/lib/components/ReactionButton/ReactionButton.js +5 -2
- package/lib/components/ScrollFog/ScrollFog.d.ts +4 -6
- package/lib/components/ScrollFog/ScrollFog.d.ts.map +1 -1
- package/lib/components/ScrollFog/ScrollFog.test.d.ts +2 -0
- package/lib/components/ScrollFog/ScrollFog.test.d.ts.map +1 -0
- package/lib/components/SideNavigation/SideNavigation.cjs +1 -1
- package/lib/components/SideNavigation/SideNavigation.js +1 -1
- package/lib/components/SidePanel/SidePanel.cjs +5 -3
- package/lib/components/SidePanel/SidePanel.d.ts.map +1 -1
- package/lib/components/SidePanel/SidePanel.js +5 -3
- package/lib/components/Slider/Slider.cjs +1 -1
- package/lib/components/Slider/Slider.js +1 -1
- package/lib/components/Snackbar/Snackbar.cjs +2 -1
- package/lib/components/Snackbar/Snackbar.d.ts.map +1 -1
- package/lib/components/Snackbar/Snackbar.js +2 -1
- package/lib/components/SwipeableMenuSheet/SwipeableMenuSheet.cjs +2 -1
- package/lib/components/SwipeableMenuSheet/SwipeableMenuSheet.d.ts.map +1 -1
- package/lib/components/SwipeableMenuSheet/SwipeableMenuSheet.js +2 -1
- package/lib/components/Switch/Switch.cjs +2 -1
- package/lib/components/Switch/Switch.d.ts.map +1 -1
- package/lib/components/Switch/Switch.js +2 -1
- package/lib/components/Tabs/Tabs.cjs +2 -1
- package/lib/components/Tabs/Tabs.d.ts.map +1 -1
- package/lib/components/Tabs/Tabs.js +2 -1
- package/lib/components/TextField/TextField.cjs +1 -1
- package/lib/components/TextField/TextField.js +1 -1
- package/lib/components/TextField/useTextFieldWithGraphemes.cjs +2 -5
- package/lib/components/TextField/useTextFieldWithGraphemes.d.ts.map +1 -1
- package/lib/components/TextField/useTextFieldWithGraphemes.js +3 -6
- package/lib/components/ToggleButton/ToggleButton.cjs +5 -2
- package/lib/components/ToggleButton/ToggleButton.d.ts.map +1 -1
- package/lib/components/ToggleButton/ToggleButton.js +5 -2
- package/lib/components/WheelPicker/WheelPicker.cjs +94 -0
- package/lib/components/WheelPicker/WheelPicker.d.ts +56 -0
- package/lib/components/WheelPicker/WheelPicker.d.ts.map +1 -0
- package/lib/components/WheelPicker/WheelPicker.js +89 -0
- package/lib/components/WheelPicker/WheelPicker.namespace.cjs +15 -0
- package/lib/components/WheelPicker/WheelPicker.namespace.d.ts +2 -0
- package/lib/components/WheelPicker/WheelPicker.namespace.d.ts.map +1 -0
- package/lib/components/WheelPicker/WheelPicker.namespace.js +10 -0
- package/lib/components/WheelPicker/WheelPicker.test.d.ts +2 -0
- package/lib/components/WheelPicker/WheelPicker.test.d.ts.map +1 -0
- package/lib/components/WheelPicker/index.cjs +12 -0
- package/lib/components/WheelPicker/index.d.ts +3 -0
- package/lib/components/WheelPicker/index.d.ts.map +1 -0
- package/lib/components/WheelPicker/index.js +3 -0
- package/lib/components/index.cjs +11 -0
- package/lib/components/index.d.ts +1 -0
- package/lib/components/index.d.ts.map +1 -1
- package/lib/components/index.js +3 -1
- package/lib/components/private/WheelPicker.cjs +2 -3
- package/lib/components/private/WheelPicker.d.ts +3 -3
- package/lib/components/private/WheelPicker.d.ts.map +1 -1
- package/lib/components/private/WheelPicker.js +3 -3
- package/lib/components/private/useDismissible.d.ts +123 -123
- package/lib/index.cjs +14 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +4 -1
- package/lib/utils/elementSizeVars.cjs +76 -0
- package/lib/utils/elementSizeVars.d.ts +15 -0
- package/lib/utils/elementSizeVars.d.ts.map +1 -0
- package/lib/utils/elementSizeVars.js +74 -0
- package/lib/utils/scaleFeedback.cjs +99 -0
- package/lib/utils/scaleFeedback.d.ts +58 -0
- package/lib/utils/scaleFeedback.d.ts.map +1 -0
- package/lib/utils/scaleFeedback.js +94 -0
- package/package.json +7 -7
- package/src/components/ActionButton/ActionButton.tsx +5 -2
- package/src/components/AttachmentDisplay/AttachmentDisplayItem.tsx +14 -9
- package/src/components/AttachmentDisplay/AttachmentDisplayTrigger.tsx +7 -4
- package/src/components/AttachmentInput/AttachmentInputItem.tsx +14 -9
- package/src/components/AttachmentInput/AttachmentInputTrigger.tsx +3 -3
- package/src/components/BottomSheet/BottomSheet.tsx +5 -3
- package/src/components/Callout/Callout.tsx +9 -4
- package/src/components/Checkbox/Checkbox.tsx +3 -3
- package/src/components/Chip/Chip.tsx +2 -1
- package/src/components/ChipTabs/ChipTabs.tsx +3 -3
- package/src/components/ContentDialog/ContentDialog.tsx +5 -3
- package/src/components/ContextualFloatingButton/ContextualFloatingButton.tsx +5 -2
- package/src/components/DatePicker/DatePicker.test.tsx +70 -0
- package/src/components/DatePicker/DatePicker.tsx +17 -16
- package/src/components/DatePicker/index.ts +2 -0
- package/src/components/FieldButton/FieldButton.tsx +6 -3
- package/src/components/FloatingActionButton/FloatingActionButton.tsx +4 -4
- package/src/components/HelpBubble/HelpBubble.tsx +7 -4
- package/src/components/HelpBubbleTooltip/HelpBubbleTooltip.tsx +1 -1
- package/src/components/ImageFrame/ImageFrame.tsx +8 -1
- package/src/components/MenuSheet/MenuSheet.tsx +6 -3
- package/src/components/PageBanner/PageBanner.tsx +5 -6
- package/src/components/QuantityPicker/QuantityPicker.tsx +8 -4
- package/src/components/RadioGroup/RadioGroup.tsx +7 -4
- package/src/components/ReactionButton/ReactionButton.tsx +5 -2
- package/src/components/ScrollFog/ScrollFog.test.tsx +13 -0
- package/src/components/ScrollFog/ScrollFog.tsx +5 -7
- package/src/components/SidePanel/SidePanel.tsx +5 -3
- package/src/components/Snackbar/Snackbar.tsx +6 -3
- package/src/components/SwipeableMenuSheet/SwipeableMenuSheet.tsx +7 -4
- package/src/components/Switch/Switch.tsx +3 -3
- package/src/components/Tabs/Tabs.tsx +3 -3
- package/src/components/TextField/useTextFieldWithGraphemes.ts +3 -7
- package/src/components/ToggleButton/ToggleButton.tsx +5 -2
- package/src/components/WheelPicker/WheelPicker.namespace.ts +9 -0
- package/src/components/WheelPicker/WheelPicker.test.tsx +270 -0
- package/src/components/WheelPicker/WheelPicker.tsx +210 -0
- package/src/components/WheelPicker/index.ts +11 -0
- package/src/components/index.ts +1 -0
- package/src/components/private/WheelPicker.test.tsx +1 -0
- package/src/components/private/WheelPicker.tsx +6 -6
- package/src/index.ts +2 -0
- package/src/utils/elementSizeVars.tsx +112 -0
- package/src/utils/scaleFeedback.tsx +128 -0
- package/lib/components/TextField/memoize.cjs +0 -13
- package/lib/components/TextField/memoize.d.ts +0 -2
- package/lib/components/TextField/memoize.d.ts.map +0 -1
- package/lib/components/TextField/memoize.js +0 -13
- package/src/components/TextField/memoize.ts +0 -14
|
@@ -14,8 +14,10 @@ import { imageFrameReactionButton } from "@seed-design/css/recipes/image-frame-r
|
|
|
14
14
|
import { mergeProps } from "@seed-design/dom-utils";
|
|
15
15
|
import { Image } from "@seed-design/react-image";
|
|
16
16
|
import { Toggle as TogglePrimitive, useToggleContext } from "@seed-design/react-toggle";
|
|
17
|
+
import { useComposedRefs } from "@radix-ui/react-compose-refs";
|
|
17
18
|
import clsx from "clsx";
|
|
18
19
|
import * as React from "react";
|
|
20
|
+
import { useScaleFeedback } from "../../utils/scaleFeedback";
|
|
19
21
|
import { createSlotRecipeContext } from "../../utils/createSlotRecipeContext";
|
|
20
22
|
import type { DistributiveOmit } from "../../utils/styled";
|
|
21
23
|
import { AspectRatio, type AspectRatioProps } from "../AspectRatio/AspectRatio";
|
|
@@ -249,10 +251,15 @@ export const ImageFrameReactionButton = React.forwardRef<
|
|
|
249
251
|
ImageFrameReactionButtonProps
|
|
250
252
|
>(({ className, ...rest }, ref) => {
|
|
251
253
|
const classNames = imageFrameReactionButton();
|
|
254
|
+
const { scaleFeedbackRef, scaleFeedbackClassName } = useScaleFeedback();
|
|
252
255
|
|
|
253
256
|
return (
|
|
254
257
|
<ImageFrameReactionButtonClassNamesProvider value={classNames}>
|
|
255
|
-
<TogglePrimitive.Root
|
|
258
|
+
<TogglePrimitive.Root
|
|
259
|
+
ref={useComposedRefs(scaleFeedbackRef, ref)}
|
|
260
|
+
className={clsx(classNames.root, scaleFeedbackClassName, className)}
|
|
261
|
+
{...rest}
|
|
262
|
+
>
|
|
256
263
|
<ReactionButtonIcon />
|
|
257
264
|
</TogglePrimitive.Root>
|
|
258
265
|
</ImageFrameReactionButtonClassNamesProvider>
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
} from "@seed-design/css/recipes/menu-sheet-item";
|
|
8
8
|
import * as React from "react";
|
|
9
9
|
import { createSlotRecipeContext } from "../../utils/createSlotRecipeContext";
|
|
10
|
+
import { withScaleFeedback } from "../../utils/scaleFeedback";
|
|
10
11
|
import { createWithStateProps } from "../../utils/createWithStateProps";
|
|
11
12
|
import clsx from "clsx";
|
|
12
13
|
|
|
@@ -319,7 +320,9 @@ export interface MenuSheetCloseButtonProps extends DialogPrimitive.CloseButtonPr
|
|
|
319
320
|
/**
|
|
320
321
|
* @deprecated Use `SwipeableMenuSheet` instead.
|
|
321
322
|
*/
|
|
322
|
-
export const MenuSheetCloseButton =
|
|
323
|
-
|
|
324
|
-
|
|
323
|
+
export const MenuSheetCloseButton = withScaleFeedback(
|
|
324
|
+
withContext<HTMLDivElement, MenuSheetCloseButtonProps>(
|
|
325
|
+
DialogPrimitive.CloseButton,
|
|
326
|
+
"closeButton",
|
|
327
|
+
),
|
|
325
328
|
);
|
|
@@ -4,6 +4,7 @@ import { forwardRef } from "react";
|
|
|
4
4
|
import { pageBanner, type PageBannerVariantProps } from "@seed-design/css/recipes/page-banner";
|
|
5
5
|
import { Primitive, type PrimitiveProps } from "@seed-design/react-primitive";
|
|
6
6
|
import { createSlotRecipeContext } from "../../utils/createSlotRecipeContext";
|
|
7
|
+
import { withScaleFeedback } from "../../utils/scaleFeedback";
|
|
7
8
|
import {
|
|
8
9
|
DismissibleCloseButton,
|
|
9
10
|
DismissibleRoot,
|
|
@@ -93,16 +94,14 @@ export interface PageBannerButtonProps
|
|
|
93
94
|
extends PrimitiveProps,
|
|
94
95
|
React.ButtonHTMLAttributes<HTMLButtonElement> {}
|
|
95
96
|
|
|
96
|
-
export const PageBannerButton =
|
|
97
|
-
Primitive.button,
|
|
98
|
-
"button",
|
|
97
|
+
export const PageBannerButton = withScaleFeedback(
|
|
98
|
+
withContext<HTMLButtonElement, PageBannerButtonProps>(Primitive.button, "button"),
|
|
99
99
|
);
|
|
100
100
|
|
|
101
101
|
export interface PageBannerCloseButtonProps
|
|
102
102
|
extends PrimitiveProps,
|
|
103
103
|
React.ButtonHTMLAttributes<HTMLButtonElement> {}
|
|
104
104
|
|
|
105
|
-
export const PageBannerCloseButton =
|
|
106
|
-
DismissibleCloseButton,
|
|
107
|
-
"closeButton",
|
|
105
|
+
export const PageBannerCloseButton = withScaleFeedback(
|
|
106
|
+
withContext<HTMLButtonElement, PageBannerCloseButtonProps>(DismissibleCloseButton, "closeButton"),
|
|
108
107
|
);
|
|
@@ -12,8 +12,10 @@ import {
|
|
|
12
12
|
} from "@seed-design/css/recipes/quantity-picker";
|
|
13
13
|
import clsx from "clsx";
|
|
14
14
|
import * as React from "react";
|
|
15
|
+
import { useComposedRefs } from "@radix-ui/react-compose-refs";
|
|
15
16
|
import { createSlotRecipeContext } from "../../utils/createSlotRecipeContext";
|
|
16
17
|
import { createWithStateProps } from "../../utils/createWithStateProps";
|
|
18
|
+
import { useScaleFeedback } from "../../utils/scaleFeedback";
|
|
17
19
|
|
|
18
20
|
const { ClassNamesProvider, useClassNames } = createSlotRecipeContext(quantityPicker);
|
|
19
21
|
const withStateProps = createWithStateProps([useQuantityPickerContext]);
|
|
@@ -154,11 +156,12 @@ export const QuantityPickerDecrementButton = React.forwardRef<
|
|
|
154
156
|
? (removeIcon ?? icon)
|
|
155
157
|
: icon;
|
|
156
158
|
const contentIsIcon = content !== null && content !== undefined;
|
|
159
|
+
const { scaleFeedbackRef, scaleFeedbackClassName } = useScaleFeedback();
|
|
157
160
|
|
|
158
161
|
return (
|
|
159
162
|
<QuantityPickerPrimitive.DecrementButton
|
|
160
|
-
ref={ref}
|
|
161
|
-
className={clsx(classNames.decrementButton, className)}
|
|
163
|
+
ref={useComposedRefs(scaleFeedbackRef, ref)}
|
|
164
|
+
className={clsx(classNames.decrementButton, scaleFeedbackClassName, className)}
|
|
162
165
|
{...props}
|
|
163
166
|
>
|
|
164
167
|
{renderIcon(content ?? children, classNames.decrementIcon, decrementIconProps, contentIsIcon)}
|
|
@@ -208,11 +211,12 @@ export const QuantityPickerIncrementButton = React.forwardRef<
|
|
|
208
211
|
const { incrementIconProps, incrementLoading } = useQuantityPickerContext();
|
|
209
212
|
const content = incrementLoading ? loadingIndicator : icon;
|
|
210
213
|
const contentIsIcon = content !== null && content !== undefined;
|
|
214
|
+
const { scaleFeedbackRef, scaleFeedbackClassName } = useScaleFeedback();
|
|
211
215
|
|
|
212
216
|
return (
|
|
213
217
|
<QuantityPickerPrimitive.IncrementButton
|
|
214
|
-
ref={ref}
|
|
215
|
-
className={clsx(classNames.incrementButton, className)}
|
|
218
|
+
ref={useComposedRefs(scaleFeedbackRef, ref)}
|
|
219
|
+
className={clsx(classNames.incrementButton, scaleFeedbackClassName, className)}
|
|
216
220
|
{...props}
|
|
217
221
|
>
|
|
218
222
|
{renderIcon(content ?? children, classNames.incrementIcon, incrementIconProps, contentIsIcon)}
|
|
@@ -11,6 +11,7 @@ import clsx from "clsx";
|
|
|
11
11
|
import { forwardRef } from "react";
|
|
12
12
|
import { createSlotRecipeContext } from "../../utils/createSlotRecipeContext";
|
|
13
13
|
import { createWithStateProps } from "../../utils/createWithStateProps";
|
|
14
|
+
import { withScaleFeedback } from "../../utils/scaleFeedback";
|
|
14
15
|
import { InternalIcon } from "../private/Icon";
|
|
15
16
|
import { splitMultipleVariantsProps } from "../../utils/splitMultipleVariantsProps";
|
|
16
17
|
import { createRecipeContext } from "../../utils/createRecipeContext";
|
|
@@ -81,10 +82,12 @@ export interface RadioGroupItemControlProps
|
|
|
81
82
|
extends RadiomarkVariantProps,
|
|
82
83
|
RadioGroupPrimitive.ItemControlProps {}
|
|
83
84
|
|
|
84
|
-
export const RadioGroupItemControl =
|
|
85
|
-
HTMLDivElement,
|
|
86
|
-
|
|
87
|
-
|
|
85
|
+
export const RadioGroupItemControl = withScaleFeedback(
|
|
86
|
+
withRadiomarkProvider<HTMLDivElement, RadioGroupItemControlProps>(
|
|
87
|
+
RadioGroupPrimitive.ItemControl,
|
|
88
|
+
"root",
|
|
89
|
+
),
|
|
90
|
+
);
|
|
88
91
|
|
|
89
92
|
////////////////////////////////////////////////////////////////////////////////////
|
|
90
93
|
|
|
@@ -2,9 +2,11 @@ import {
|
|
|
2
2
|
reactionButton,
|
|
3
3
|
type ReactionButtonVariantProps,
|
|
4
4
|
} from "@seed-design/css/recipes/reaction-button";
|
|
5
|
+
import { useComposedRefs } from "@radix-ui/react-compose-refs";
|
|
5
6
|
import { Toggle as TogglePrimitive } from "@seed-design/react-toggle";
|
|
6
7
|
import clsx from "clsx";
|
|
7
8
|
import * as React from "react";
|
|
9
|
+
import { useScaleFeedback } from "../../utils/scaleFeedback";
|
|
8
10
|
import {
|
|
9
11
|
PendingButtonProvider,
|
|
10
12
|
usePendingButton,
|
|
@@ -20,12 +22,13 @@ export const ReactionButton = React.forwardRef<HTMLButtonElement, ReactionButton
|
|
|
20
22
|
({ size = "small", loading = false, className, ...otherProps }, ref) => {
|
|
21
23
|
const recipeClassName = reactionButton({ size });
|
|
22
24
|
const api = usePendingButton({ loading, disabled: otherProps.disabled });
|
|
25
|
+
const { scaleFeedbackRef, scaleFeedbackClassName } = useScaleFeedback();
|
|
23
26
|
|
|
24
27
|
return (
|
|
25
28
|
<PendingButtonProvider value={api}>
|
|
26
29
|
<TogglePrimitive.Root
|
|
27
|
-
ref={ref}
|
|
28
|
-
className={clsx(recipeClassName, className)}
|
|
30
|
+
ref={useComposedRefs(scaleFeedbackRef, ref)}
|
|
31
|
+
className={clsx(recipeClassName, scaleFeedbackClassName, className)}
|
|
29
32
|
{...api.stateProps}
|
|
30
33
|
{...otherProps}
|
|
31
34
|
/>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { render } from "@testing-library/react";
|
|
2
|
+
import { describe, expect, it } from "bun:test";
|
|
3
|
+
import { ScrollFog } from "./ScrollFog";
|
|
4
|
+
|
|
5
|
+
describe("ScrollFog", () => {
|
|
6
|
+
it("CSS 길이 계산식을 Fog 크기로 전달한다", () => {
|
|
7
|
+
const { container } = render(<ScrollFog size="min(40%, 132px)" />);
|
|
8
|
+
const scrollFog = container.firstElementChild as HTMLElement;
|
|
9
|
+
|
|
10
|
+
expect(scrollFog.style.getPropertyValue("--scroll-fog-size-top")).toBe("min(40%, 132px)");
|
|
11
|
+
expect(scrollFog.style.getPropertyValue("--scroll-fog-size-bottom")).toBe("min(40%, 132px)");
|
|
12
|
+
});
|
|
13
|
+
});
|
|
@@ -15,20 +15,18 @@ export interface ScrollFogProps
|
|
|
15
15
|
extends ScrollFogVariantProps,
|
|
16
16
|
React.HTMLAttributes<HTMLDivElement> {
|
|
17
17
|
/**
|
|
18
|
-
*
|
|
18
|
+
* Fog 효과를 표시할 방향입니다.
|
|
19
19
|
* @default ["top", "bottom"]
|
|
20
20
|
*/
|
|
21
21
|
placement?: ScrollPlacement[];
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
|
-
*
|
|
24
|
+
* Fog 효과의 크기입니다. 숫자는 px 단위로 처리하며 CSS 길이 또는 계산식도 사용할 수 있습니다.
|
|
25
25
|
* @default 20
|
|
26
26
|
*/
|
|
27
|
-
size?: number;
|
|
27
|
+
size?: number | string;
|
|
28
28
|
|
|
29
|
-
/**
|
|
30
|
-
* Size of the fog effect for each direction in pixels
|
|
31
|
-
*/
|
|
29
|
+
/** 방향별 Fog 효과의 크기입니다. */
|
|
32
30
|
sizes?: SizesConfig;
|
|
33
31
|
}
|
|
34
32
|
|
|
@@ -42,7 +40,7 @@ export const ScrollFog = forwardRef<HTMLDivElement, ScrollFogProps>(
|
|
|
42
40
|
...props,
|
|
43
41
|
});
|
|
44
42
|
const scrollFogClassName = scrollFog(variantProps);
|
|
45
|
-
const sizePx = typeof size === "number" ? `${size}px` : size;
|
|
43
|
+
const sizePx = typeof size === "number" ? `${size}px` : size;
|
|
46
44
|
|
|
47
45
|
const sizeStyle = useMemo(() => {
|
|
48
46
|
const finalSizes = {
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { sidePanel, type SidePanelVariantProps } from "@seed-design/css/recipes/side-panel";
|
|
2
2
|
import { Drawer } from "@seed-design/react-drawer";
|
|
3
3
|
import { Primitive, type PrimitiveProps } from "@seed-design/react-primitive";
|
|
4
|
-
import { composeRefs } from "@radix-ui/react-compose-refs";
|
|
4
|
+
import { composeRefs, useComposedRefs } from "@radix-ui/react-compose-refs";
|
|
5
5
|
import { dataAttr } from "@seed-design/dom-utils";
|
|
6
6
|
import clsx from "clsx";
|
|
7
7
|
import * as React from "react";
|
|
8
8
|
import { createRenderTrackingContext } from "../../utils/createRenderTrackingContext";
|
|
9
9
|
import { createSlotRecipeContext } from "../../utils/createSlotRecipeContext";
|
|
10
|
+
import { useScaleFeedback } from "../../utils/scaleFeedback";
|
|
10
11
|
import { useStyleProps, withStyleProps, type StyleProps } from "../../utils/styled";
|
|
11
12
|
|
|
12
13
|
const { withContext, useClassNames, ClassNamesProvider } = createSlotRecipeContext(sidePanel);
|
|
@@ -202,11 +203,12 @@ export const SidePanelCloseButton = React.forwardRef<HTMLButtonElement, SidePane
|
|
|
202
203
|
({ className, ...props }, ref) => {
|
|
203
204
|
const classNames = useClassNames();
|
|
204
205
|
const { trackRef } = closeButtonTracker.useRenderTracking();
|
|
206
|
+
const { scaleFeedbackRef, scaleFeedbackClassName } = useScaleFeedback();
|
|
205
207
|
|
|
206
208
|
return (
|
|
207
209
|
<Drawer.CloseButton
|
|
208
|
-
ref={
|
|
209
|
-
className={clsx(classNames.closeButton, className)}
|
|
210
|
+
ref={useComposedRefs(scaleFeedbackRef, ref, trackRef)}
|
|
211
|
+
className={clsx(classNames.closeButton, scaleFeedbackClassName, className)}
|
|
210
212
|
{...props}
|
|
211
213
|
/>
|
|
212
214
|
);
|
|
@@ -6,6 +6,7 @@ import { Snackbar as SnackbarPrimitive } from "@seed-design/react-snackbar";
|
|
|
6
6
|
import { forwardRef } from "react";
|
|
7
7
|
import { createRecipeContext } from "../../utils/createRecipeContext";
|
|
8
8
|
import { createSlotRecipeContext } from "../../utils/createSlotRecipeContext";
|
|
9
|
+
import { withScaleFeedback } from "../../utils/scaleFeedback";
|
|
9
10
|
import { InternalIcon, type InternalIconProps } from "../private/Icon";
|
|
10
11
|
|
|
11
12
|
const { withContext: withRegionContext } = createRecipeContext(snackbarRegion);
|
|
@@ -69,9 +70,11 @@ export const SnackbarPrefixIcon = withContext<HTMLDivElement, SnackbarPrefixIcon
|
|
|
69
70
|
|
|
70
71
|
export interface SnackbarActionButtonProps extends SnackbarPrimitive.ActionButtonProps {}
|
|
71
72
|
|
|
72
|
-
export const SnackbarActionButton =
|
|
73
|
-
|
|
74
|
-
|
|
73
|
+
export const SnackbarActionButton = withScaleFeedback(
|
|
74
|
+
withContext<HTMLButtonElement, SnackbarActionButtonProps>(
|
|
75
|
+
SnackbarPrimitive.ActionButton,
|
|
76
|
+
"actionButton",
|
|
77
|
+
),
|
|
75
78
|
);
|
|
76
79
|
|
|
77
80
|
////////////////////////////////////////////////////////////////////////////////////
|
|
@@ -9,6 +9,7 @@ import { Primitive, type PrimitiveProps } from "@seed-design/react-primitive";
|
|
|
9
9
|
import clsx from "clsx";
|
|
10
10
|
import * as React from "react";
|
|
11
11
|
import { createSlotRecipeContext } from "../../utils/createSlotRecipeContext";
|
|
12
|
+
import { withScaleFeedback } from "../../utils/scaleFeedback";
|
|
12
13
|
|
|
13
14
|
const { withContext, useClassNames, ClassNamesProvider } = createSlotRecipeContext(menuSheet);
|
|
14
15
|
const {
|
|
@@ -263,7 +264,9 @@ export interface SwipeableMenuSheetCloseButtonProps extends Drawer.CloseButtonPr
|
|
|
263
264
|
/**
|
|
264
265
|
* Visible button that closes the swipeable menu sheet.
|
|
265
266
|
*/
|
|
266
|
-
export const SwipeableMenuSheetCloseButton =
|
|
267
|
-
HTMLButtonElement,
|
|
268
|
-
|
|
269
|
-
|
|
267
|
+
export const SwipeableMenuSheetCloseButton = withScaleFeedback(
|
|
268
|
+
withContext<HTMLButtonElement, SwipeableMenuSheetCloseButtonProps>(
|
|
269
|
+
Drawer.CloseButton,
|
|
270
|
+
"closeButton",
|
|
271
|
+
),
|
|
272
|
+
);
|
|
@@ -4,6 +4,7 @@ import { switchmark, type SwitchmarkVariantProps } from "@seed-design/css/recipe
|
|
|
4
4
|
import { createSlotRecipeContext } from "../../utils/createSlotRecipeContext";
|
|
5
5
|
import { Primitive, type PrimitiveProps } from "@seed-design/react-primitive";
|
|
6
6
|
import { createWithStateProps } from "../../utils/createWithStateProps";
|
|
7
|
+
import { withScaleFeedback } from "../../utils/scaleFeedback";
|
|
7
8
|
import React from "react";
|
|
8
9
|
import clsx from "clsx";
|
|
9
10
|
import { splitMultipleVariantsProps } from "../../utils/splitMultipleVariantsProps";
|
|
@@ -49,9 +50,8 @@ SwitchRoot.displayName = "SwitchRoot";
|
|
|
49
50
|
|
|
50
51
|
export interface SwitchControlProps extends SwitchmarkVariantProps, SwitchPrimitive.ControlProps {}
|
|
51
52
|
|
|
52
|
-
export const SwitchControl =
|
|
53
|
-
SwitchPrimitive.Control,
|
|
54
|
-
"root",
|
|
53
|
+
export const SwitchControl = withScaleFeedback(
|
|
54
|
+
withControlProvider<HTMLDivElement, SwitchControlProps>(SwitchPrimitive.Control, "root"),
|
|
55
55
|
);
|
|
56
56
|
|
|
57
57
|
////////////////////////////////////////////////////////////////////////////////////
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { tabs, type TabsVariantProps } from "@seed-design/css/recipes/tabs";
|
|
2
2
|
import { Tabs as TabsPrimitive } from "@seed-design/react-tabs";
|
|
3
3
|
import { createSlotRecipeContext } from "../../utils/createSlotRecipeContext";
|
|
4
|
+
import { withScaleFeedback } from "../../utils/scaleFeedback";
|
|
4
5
|
|
|
5
6
|
const { withProvider, withContext } = createSlotRecipeContext(tabs);
|
|
6
7
|
|
|
@@ -20,9 +21,8 @@ export const TabsList = withContext<HTMLDivElement, TabsListProps>(TabsPrimitive
|
|
|
20
21
|
|
|
21
22
|
export interface TabsTriggerProps extends TabsPrimitive.TriggerProps {}
|
|
22
23
|
|
|
23
|
-
export const TabsTrigger =
|
|
24
|
-
TabsPrimitive.Trigger,
|
|
25
|
-
"trigger",
|
|
24
|
+
export const TabsTrigger = withScaleFeedback(
|
|
25
|
+
withContext<HTMLButtonElement, TabsTriggerProps>(TabsPrimitive.Trigger, "trigger"),
|
|
26
26
|
);
|
|
27
27
|
|
|
28
28
|
////////////////////////////////////////////////////////////////////////////////////
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { useState, useMemo, useCallback } from "react";
|
|
2
|
-
import {
|
|
3
|
-
import { memoize } from "./memoize";
|
|
2
|
+
import { collectGraphemes } from "unicode-segmenter/grapheme";
|
|
4
3
|
|
|
5
4
|
export interface UseTextFieldWithGraphemesParams {
|
|
6
5
|
maxGraphemeCount?: number;
|
|
@@ -14,9 +13,6 @@ export interface UseTextFieldWithGraphemesParams {
|
|
|
14
13
|
}) => void;
|
|
15
14
|
}
|
|
16
15
|
|
|
17
|
-
const getGraphemes = (string: string) => Array.from(splitGraphemes(string));
|
|
18
|
-
const memoizedGetGraphemes = memoize(getGraphemes);
|
|
19
|
-
|
|
20
16
|
export function useTextFieldWithGraphemes({
|
|
21
17
|
maxGraphemeCount,
|
|
22
18
|
value: controlledValue,
|
|
@@ -27,11 +23,11 @@ export function useTextFieldWithGraphemes({
|
|
|
27
23
|
const isControlled = controlledValue !== undefined;
|
|
28
24
|
const value = isControlled ? controlledValue : uncontrolledValue;
|
|
29
25
|
|
|
30
|
-
const graphemes = useMemo(() =>
|
|
26
|
+
const graphemes = useMemo(() => collectGraphemes(value), [value]);
|
|
31
27
|
|
|
32
28
|
const handleValueChange = useCallback(
|
|
33
29
|
(newValue: string) => {
|
|
34
|
-
const newGraphemes =
|
|
30
|
+
const newGraphemes = collectGraphemes(newValue);
|
|
35
31
|
const newSlicedGraphemes =
|
|
36
32
|
maxGraphemeCount === undefined ? newGraphemes : newGraphemes.slice(0, maxGraphemeCount);
|
|
37
33
|
const newSlicedValue = newSlicedGraphemes.join("");
|
|
@@ -2,9 +2,11 @@ import {
|
|
|
2
2
|
toggleButton,
|
|
3
3
|
type ToggleButtonVariantProps,
|
|
4
4
|
} from "@seed-design/css/recipes/toggle-button";
|
|
5
|
+
import { useComposedRefs } from "@radix-ui/react-compose-refs";
|
|
5
6
|
import { Toggle as TogglePrimitive } from "@seed-design/react-toggle";
|
|
6
7
|
import clsx from "clsx";
|
|
7
8
|
import * as React from "react";
|
|
9
|
+
import { useScaleFeedback } from "../../utils/scaleFeedback";
|
|
8
10
|
import {
|
|
9
11
|
PendingButtonProvider,
|
|
10
12
|
usePendingButton,
|
|
@@ -20,12 +22,13 @@ export const ToggleButton = React.forwardRef<HTMLButtonElement, ToggleButtonProp
|
|
|
20
22
|
({ variant = "brandSolid", size = "small", loading = false, className, ...otherProps }, ref) => {
|
|
21
23
|
const recipeClassName = toggleButton({ variant, size });
|
|
22
24
|
const api = usePendingButton({ loading, disabled: otherProps.disabled });
|
|
25
|
+
const { scaleFeedbackRef, scaleFeedbackClassName } = useScaleFeedback();
|
|
23
26
|
|
|
24
27
|
return (
|
|
25
28
|
<PendingButtonProvider value={api}>
|
|
26
29
|
<TogglePrimitive.Root
|
|
27
|
-
ref={ref}
|
|
28
|
-
className={clsx(recipeClassName, className)}
|
|
30
|
+
ref={useComposedRefs(scaleFeedbackRef, ref)}
|
|
31
|
+
className={clsx(recipeClassName, scaleFeedbackClassName, className)}
|
|
29
32
|
{...api.stateProps}
|
|
30
33
|
{...otherProps}
|
|
31
34
|
/>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export {
|
|
2
|
+
WheelPickerRoot as Root,
|
|
3
|
+
WheelPickerColumn as Column,
|
|
4
|
+
WheelPickerItemLabel as ItemLabel,
|
|
5
|
+
type WheelPickerRootProps as RootProps,
|
|
6
|
+
type WheelPickerColumnProps as ColumnProps,
|
|
7
|
+
type WheelPickerItemLabelProps as ItemLabelProps,
|
|
8
|
+
type WheelPickerOption as Option,
|
|
9
|
+
} from "./WheelPicker";
|