@seed-design/lynx-react 0.7.1 → 0.8.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.jsx +2 -2
- package/lib/components/ActionButton/ActionButton.jsx +1 -1
- package/lib/components/AlertDialog/AlertDialog.d.ts +64 -0
- package/lib/components/AlertDialog/AlertDialog.d.ts.map +1 -0
- package/lib/components/AlertDialog/AlertDialog.jsx +138 -0
- package/lib/components/AlertDialog/AlertDialog.namespace.d.ts +2 -0
- package/lib/components/AlertDialog/AlertDialog.namespace.d.ts.map +1 -0
- package/lib/components/AlertDialog/AlertDialog.namespace.js +17 -0
- package/lib/components/AlertDialog/index.d.ts +3 -0
- package/lib/components/AlertDialog/index.d.ts.map +1 -0
- package/lib/components/AppBar/AppBar.d.ts +14 -1
- package/lib/components/AppBar/AppBar.d.ts.map +1 -1
- package/lib/components/AppBar/AppBar.jsx +39 -8
- package/lib/components/AppBar/AppBar.namespace.d.ts +1 -1
- package/lib/components/AppBar/AppBar.namespace.d.ts.map +1 -1
- package/lib/components/AppBar/index.d.ts +1 -1
- package/lib/components/AppBar/index.d.ts.map +1 -1
- package/lib/components/AttachmentDisplay/AttachmentDisplay.d.ts +182 -0
- package/lib/components/AttachmentDisplay/AttachmentDisplay.d.ts.map +1 -0
- package/lib/components/AttachmentDisplay/AttachmentDisplay.jsx +444 -0
- package/lib/components/AttachmentDisplay/index.d.ts +2 -0
- package/lib/components/AttachmentDisplay/index.d.ts.map +1 -0
- package/lib/components/AttachmentInput/AttachmentInput.d.ts +179 -0
- package/lib/components/AttachmentInput/AttachmentInput.d.ts.map +1 -0
- package/lib/components/AttachmentInput/AttachmentInput.jsx +520 -0
- package/lib/components/AttachmentInput/index.d.ts +2 -0
- package/lib/components/AttachmentInput/index.d.ts.map +1 -0
- package/lib/components/BottomSheet/BottomSheet.d.ts +1 -1
- package/lib/components/BottomSheet/BottomSheet.d.ts.map +1 -1
- package/lib/components/BottomSheet/BottomSheet.jsx +1 -7
- package/lib/components/Callout/Callout.jsx +2 -2
- package/lib/components/Checkbox/Checkbox.jsx +2 -2
- package/lib/components/Chip/Chip.jsx +2 -2
- package/lib/components/ChipTabs/ChipTabs.d.ts +41 -0
- package/lib/components/ChipTabs/ChipTabs.d.ts.map +1 -0
- package/lib/components/ChipTabs/ChipTabs.jsx +39 -0
- package/lib/components/ChipTabs/ChipTabs.namespace.d.ts +2 -0
- package/lib/components/ChipTabs/ChipTabs.namespace.d.ts.map +1 -0
- package/lib/components/ChipTabs/ChipTabs.namespace.js +13 -0
- package/lib/components/ChipTabs/index.d.ts +3 -0
- package/lib/components/ChipTabs/index.d.ts.map +1 -0
- package/lib/components/ContextualFloatingButton/ContextualFloatingButton.d.ts +18 -0
- package/lib/components/ContextualFloatingButton/ContextualFloatingButton.d.ts.map +1 -0
- package/lib/components/ContextualFloatingButton/ContextualFloatingButton.jsx +113 -0
- package/lib/components/ContextualFloatingButton/index.d.ts +2 -0
- package/lib/components/ContextualFloatingButton/index.d.ts.map +1 -0
- package/lib/components/Dialog/Dialog.d.ts +87 -0
- package/lib/components/Dialog/Dialog.d.ts.map +1 -0
- package/lib/components/Dialog/Dialog.jsx +147 -0
- package/lib/components/Dialog/Dialog.namespace.d.ts +2 -0
- package/lib/components/Dialog/Dialog.namespace.d.ts.map +1 -0
- package/lib/components/Dialog/Dialog.namespace.js +18 -0
- package/lib/components/Dialog/index.d.ts +3 -0
- package/lib/components/Dialog/index.d.ts.map +1 -0
- package/lib/components/FloatingActionButton/FloatingActionButton.d.ts +23 -0
- package/lib/components/FloatingActionButton/FloatingActionButton.d.ts.map +1 -0
- package/lib/components/FloatingActionButton/FloatingActionButton.jsx +76 -0
- package/lib/components/FloatingActionButton/FloatingActionButton.namespace.d.ts +2 -0
- package/lib/components/FloatingActionButton/FloatingActionButton.namespace.d.ts.map +1 -0
- package/lib/components/FloatingActionButton/FloatingActionButton.namespace.js +10 -0
- package/lib/components/FloatingActionButton/index.d.ts +3 -0
- package/lib/components/FloatingActionButton/index.d.ts.map +1 -0
- package/lib/components/HelpBubble/HelpBubble.d.ts +67 -0
- package/lib/components/HelpBubble/HelpBubble.d.ts.map +1 -0
- package/lib/components/HelpBubble/HelpBubble.jsx +600 -0
- package/lib/components/HelpBubble/HelpBubble.namespace.d.ts +2 -0
- package/lib/components/HelpBubble/HelpBubble.namespace.d.ts.map +1 -0
- package/lib/components/HelpBubble/HelpBubble.namespace.js +18 -0
- package/lib/components/HelpBubble/index.d.ts +3 -0
- package/lib/components/HelpBubble/index.d.ts.map +1 -0
- package/lib/components/Icon/Icon.d.ts +1 -0
- package/lib/components/Icon/Icon.d.ts.map +1 -1
- package/lib/components/Icon/Icon.jsx +2 -1
- package/lib/components/IdentityPlaceholder/IdentityPlaceholder.d.ts +28 -0
- package/lib/components/IdentityPlaceholder/IdentityPlaceholder.d.ts.map +1 -0
- package/lib/components/IdentityPlaceholder/IdentityPlaceholder.jsx +37 -0
- package/lib/components/IdentityPlaceholder/IdentityPlaceholder.namespace.d.ts +2 -0
- package/lib/components/IdentityPlaceholder/IdentityPlaceholder.namespace.d.ts.map +1 -0
- package/lib/components/IdentityPlaceholder/IdentityPlaceholder.namespace.js +9 -0
- package/lib/components/IdentityPlaceholder/identity-placeholder-business.js +4 -0
- package/lib/components/IdentityPlaceholder/identity-placeholder-person.js +4 -0
- package/lib/components/IdentityPlaceholder/index.d.ts +3 -0
- package/lib/components/IdentityPlaceholder/index.d.ts.map +1 -0
- package/lib/components/InputButton/InputButton.d.ts +2 -0
- package/lib/components/InputButton/InputButton.d.ts.map +1 -1
- package/lib/components/InputButton/InputButton.jsx +40 -8
- package/lib/components/List/List.d.ts +1 -1
- package/lib/components/List/List.d.ts.map +1 -1
- package/lib/components/List/List.jsx +26 -12
- package/lib/components/Menu/Menu.d.ts.map +1 -1
- package/lib/components/Menu/Menu.jsx +15 -5
- package/lib/components/PageBanner/PageBanner.d.ts +3 -0
- package/lib/components/PageBanner/PageBanner.d.ts.map +1 -1
- package/lib/components/PageBanner/PageBanner.jsx +49 -11
- package/lib/components/QuantityPicker/QuantityPicker.d.ts +53 -0
- package/lib/components/QuantityPicker/QuantityPicker.d.ts.map +1 -0
- package/lib/components/QuantityPicker/QuantityPicker.jsx +282 -0
- package/lib/components/QuantityPicker/QuantityPicker.namespace.d.ts +2 -0
- package/lib/components/QuantityPicker/QuantityPicker.namespace.d.ts.map +1 -0
- package/lib/components/QuantityPicker/QuantityPicker.namespace.js +11 -0
- package/lib/components/QuantityPicker/index.d.ts +3 -0
- package/lib/components/QuantityPicker/index.d.ts.map +1 -0
- package/lib/components/RadioGroup/RadioGroup.jsx +2 -2
- package/lib/components/ReactionButton/ReactionButton.d.ts +1 -1
- package/lib/components/ReactionButton/ReactionButton.d.ts.map +1 -1
- package/lib/components/ReactionButton/ReactionButton.jsx +22 -13
- package/lib/components/ScrollFog/ScrollFog.d.ts +41 -0
- package/lib/components/ScrollFog/ScrollFog.d.ts.map +1 -0
- package/lib/components/ScrollFog/ScrollFog.jsx +65 -0
- package/lib/components/ScrollFog/index.d.ts +2 -0
- package/lib/components/ScrollFog/index.d.ts.map +1 -0
- package/lib/components/SegmentedControl/SegmentedControl.jsx +2 -2
- package/lib/components/Select/Select.d.ts +112 -0
- package/lib/components/Select/Select.d.ts.map +1 -0
- package/lib/components/Select/Select.jsx +885 -0
- package/lib/components/Select/Select.namespace.d.ts +2 -0
- package/lib/components/Select/Select.namespace.d.ts.map +1 -0
- package/lib/components/Select/Select.namespace.js +23 -0
- package/lib/components/Select/index.d.ts +3 -0
- package/lib/components/Select/index.d.ts.map +1 -0
- package/lib/components/Skeleton/Skeleton.d.ts +15 -0
- package/lib/components/Skeleton/Skeleton.d.ts.map +1 -0
- package/lib/components/Skeleton/Skeleton.jsx +18 -0
- package/lib/components/Skeleton/index.d.ts +2 -0
- package/lib/components/Skeleton/index.d.ts.map +1 -0
- package/lib/components/Slider/Slider.d.ts +101 -0
- package/lib/components/Slider/Slider.d.ts.map +1 -0
- package/lib/components/Slider/Slider.jsx +573 -0
- package/lib/components/Slider/Slider.namespace.d.ts +2 -0
- package/lib/components/Slider/Slider.namespace.d.ts.map +1 -0
- package/lib/components/Slider/Slider.namespace.js +19 -0
- package/lib/components/Slider/Slider.utils.d.ts +19 -0
- package/lib/components/Slider/Slider.utils.d.ts.map +1 -0
- package/lib/components/Slider/Slider.utils.js +106 -0
- package/lib/components/Slider/index.d.ts +3 -0
- package/lib/components/Slider/index.d.ts.map +1 -0
- package/lib/components/SwipeableMenuSheet/SwipeableMenuSheet.d.ts.map +1 -1
- package/lib/components/SwipeableMenuSheet/SwipeableMenuSheet.jsx +22 -8
- package/lib/components/Switch/Switch.d.ts.map +1 -1
- package/lib/components/Switch/Switch.jsx +5 -3
- package/lib/components/Tabs/Tabs.d.ts +34 -2
- package/lib/components/Tabs/Tabs.d.ts.map +1 -1
- package/lib/components/Tabs/Tabs.jsx +186 -56
- package/lib/components/Tabs/Tabs.utils.d.ts +14 -1
- package/lib/components/Tabs/Tabs.utils.d.ts.map +1 -1
- package/lib/components/Tabs/Tabs.utils.js +24 -3
- package/lib/components/Tabs/index.d.ts +1 -1
- package/lib/components/Tabs/index.d.ts.map +1 -1
- package/lib/components/index.d.ts +14 -0
- package/lib/components/index.d.ts.map +1 -1
- package/lib/hooks/useControllableState.d.ts +1 -14
- package/lib/hooks/useControllableState.d.ts.map +1 -1
- package/lib/hooks/usePressTap.d.ts +1 -27
- package/lib/hooks/usePressTap.d.ts.map +1 -1
- package/lib/index.js +29 -6
- package/lib/{hooks/useControllableState.js → packages/lynx-react-headless/use-controllable-state/lib/index.js} +2 -3
- package/lib/{hooks/usePressTap.js → packages/lynx-react-headless/use-press-tap/lib/index.js} +13 -10
- package/lib/types.d.ts +1 -0
- package/lib/types.d.ts.map +1 -1
- package/package.json +9 -5
- package/src/components/AlertDialog/AlertDialog.namespace.ts +22 -0
- package/src/components/AlertDialog/AlertDialog.test.tsx +226 -0
- package/src/components/AlertDialog/AlertDialog.tsx +374 -0
- package/src/components/AlertDialog/index.ts +24 -0
- package/src/components/AppBar/AppBar.namespace.ts +1 -0
- package/src/components/AppBar/AppBar.test.tsx +231 -0
- package/src/components/AppBar/AppBar.tsx +105 -13
- package/src/components/AppBar/index.ts +1 -0
- package/src/components/AttachmentDisplay/AttachmentDisplay.tsx +886 -0
- package/src/components/AttachmentDisplay/index.ts +48 -0
- package/src/components/AttachmentInput/AttachmentInput.tsx +1001 -0
- package/src/components/AttachmentInput/index.ts +49 -0
- package/src/components/BottomSheet/BottomSheet.test.tsx +22 -7
- package/src/components/BottomSheet/BottomSheet.tsx +1 -19
- package/src/components/ChipTabs/ChipTabs.namespace.ts +14 -0
- package/src/components/ChipTabs/ChipTabs.tsx +119 -0
- package/src/components/ChipTabs/index.ts +16 -0
- package/src/components/ContextualFloatingButton/ContextualFloatingButton.test.tsx +63 -0
- package/src/components/ContextualFloatingButton/ContextualFloatingButton.tsx +232 -0
- package/src/components/ContextualFloatingButton/index.ts +4 -0
- package/src/components/Dialog/Dialog.namespace.ts +24 -0
- package/src/components/Dialog/Dialog.test.tsx +172 -0
- package/src/components/Dialog/Dialog.tsx +373 -0
- package/src/components/Dialog/index.ts +26 -0
- package/src/components/FloatingActionButton/FloatingActionButton.namespace.ts +8 -0
- package/src/components/FloatingActionButton/FloatingActionButton.test.tsx +59 -0
- package/src/components/FloatingActionButton/FloatingActionButton.tsx +207 -0
- package/src/components/FloatingActionButton/index.ts +10 -0
- package/src/components/HelpBubble/HelpBubble.namespace.ts +24 -0
- package/src/components/HelpBubble/HelpBubble.tsx +998 -0
- package/src/components/HelpBubble/index.ts +26 -0
- package/src/components/Icon/Icon.test.tsx +0 -3
- package/src/components/Icon/Icon.tsx +11 -1
- package/src/components/IdentityPlaceholder/IdentityPlaceholder.namespace.ts +6 -0
- package/src/components/IdentityPlaceholder/IdentityPlaceholder.tsx +103 -0
- package/src/components/IdentityPlaceholder/assets.d.ts +4 -0
- package/src/components/IdentityPlaceholder/identity-placeholder-business.webp +0 -0
- package/src/components/IdentityPlaceholder/identity-placeholder-person.webp +0 -0
- package/src/components/IdentityPlaceholder/index.ts +8 -0
- package/src/components/InputButton/InputButton.test.tsx +128 -1
- package/src/components/InputButton/InputButton.tsx +60 -9
- package/src/components/List/List.test.tsx +54 -2
- package/src/components/List/List.tsx +43 -10
- package/src/components/Menu/Menu.tsx +14 -4
- package/src/components/Menu/__tests__/Menu.test.tsx +34 -0
- package/src/components/PageBanner/PageBanner.test.tsx +110 -3
- package/src/components/PageBanner/PageBanner.tsx +83 -19
- package/src/components/QuantityPicker/QuantityPicker.namespace.ts +10 -0
- package/src/components/QuantityPicker/QuantityPicker.test.tsx +235 -0
- package/src/components/QuantityPicker/QuantityPicker.tsx +605 -0
- package/src/components/QuantityPicker/index.ts +14 -0
- package/src/components/ReactionButton/ReactionButton.feedback.test.tsx +50 -0
- package/src/components/ReactionButton/ReactionButton.test.tsx +5 -3
- package/src/components/ReactionButton/ReactionButton.tsx +20 -12
- package/src/components/ScrollFog/ScrollFog.test.tsx +222 -0
- package/src/components/ScrollFog/ScrollFog.tsx +172 -0
- package/src/components/ScrollFog/index.ts +1 -0
- package/src/components/Select/Select.namespace.ts +34 -0
- package/src/components/Select/Select.test.tsx +297 -0
- package/src/components/Select/Select.tsx +1483 -0
- package/src/components/Select/index.ts +39 -0
- package/src/components/Skeleton/Skeleton.test.tsx +64 -0
- package/src/components/Skeleton/Skeleton.tsx +45 -0
- package/src/components/Skeleton/index.ts +1 -0
- package/src/components/Slider/Slider.namespace.ts +26 -0
- package/src/components/Slider/Slider.test.tsx +260 -0
- package/src/components/Slider/Slider.tsx +897 -0
- package/src/components/Slider/Slider.utils.ts +167 -0
- package/src/components/Slider/index.ts +30 -0
- package/src/components/SwipeableMenuSheet/SwipeableMenuSheet.test.tsx +21 -1
- package/src/components/SwipeableMenuSheet/SwipeableMenuSheet.tsx +30 -7
- package/src/components/Switch/Switch.tsx +14 -13
- package/src/components/Tabs/Tabs.test.tsx +218 -1
- package/src/components/Tabs/Tabs.tsx +346 -75
- package/src/components/Tabs/Tabs.utils.ts +51 -1
- package/src/components/Tabs/index.ts +17 -1
- package/src/components/index.ts +14 -0
- package/src/hooks/useControllableState.ts +1 -43
- package/src/hooks/usePressTap.test.ts +23 -11
- package/src/hooks/usePressTap.ts +1 -60
- package/src/types.ts +1 -0
|
@@ -21,6 +21,7 @@ import { IconSlotProvider } from "../Icon/Icon";
|
|
|
21
21
|
import { AppBarProvider, useAppBarContext } from "./context";
|
|
22
22
|
import { getLayoutWidth, getMainLayoutStyle, useAppBar } from "./useAppBar";
|
|
23
23
|
import { mergeProps } from "../../utils/merge-props";
|
|
24
|
+
import { useScaleFeedback } from "../../hooks/useScaleFeedback";
|
|
24
25
|
|
|
25
26
|
type AppBarClassNames = ReturnType<typeof appBar>;
|
|
26
27
|
type AppBarMainClassNames = ReturnType<typeof appBarMain>;
|
|
@@ -49,6 +50,66 @@ function useAppBarMainClassNames(consumer: string): AppBarMainClassNames {
|
|
|
49
50
|
}
|
|
50
51
|
}
|
|
51
52
|
|
|
53
|
+
/**
|
|
54
|
+
* 아이콘 버튼의 bleed 보정 방향. `leading`은 왼쪽, `trailing`은 오른쪽, `both`는 양쪽.
|
|
55
|
+
*/
|
|
56
|
+
export type AppBarEdge = "leading" | "trailing" | "both";
|
|
57
|
+
|
|
58
|
+
const AppBarEdgeContext = React.createContext<AppBarEdge | undefined>(undefined);
|
|
59
|
+
|
|
60
|
+
/** Fragments and arrays do not create layout boxes; retain their keys and nesting. */
|
|
61
|
+
function countEdgeChildren(children: React.ReactNode): number {
|
|
62
|
+
if (children == null || children === "" || typeof children === "boolean") return 0;
|
|
63
|
+
if (Array.isArray(children))
|
|
64
|
+
return children.reduce((count, child) => count + countEdgeChildren(child), 0);
|
|
65
|
+
if (
|
|
66
|
+
React.isValidElement<{ children?: React.ReactNode }>(children) &&
|
|
67
|
+
children.type === React.Fragment
|
|
68
|
+
) {
|
|
69
|
+
return countEdgeChildren(children.props.children);
|
|
70
|
+
}
|
|
71
|
+
return 1;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// Lynx lacks :first-child/:last-child; pass both slot edges through Context to match
|
|
75
|
+
// web spacing without shrinking the icon button's touch target.
|
|
76
|
+
function provideEdgeToChildren(children: React.ReactNode): React.ReactNode {
|
|
77
|
+
const lastIndex = countEdgeChildren(children) - 1;
|
|
78
|
+
let index = 0;
|
|
79
|
+
|
|
80
|
+
function visit(child: React.ReactNode): React.ReactNode {
|
|
81
|
+
if (child == null || child === "" || typeof child === "boolean") return child;
|
|
82
|
+
if (Array.isArray(child)) return child.map(visit);
|
|
83
|
+
if (
|
|
84
|
+
React.isValidElement<{ children?: React.ReactNode }>(child) &&
|
|
85
|
+
child.type === React.Fragment
|
|
86
|
+
) {
|
|
87
|
+
return React.cloneElement(child, { children: visit(child.props.children) });
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const childIndex = index++;
|
|
91
|
+
const edge =
|
|
92
|
+
childIndex === 0
|
|
93
|
+
? childIndex === lastIndex
|
|
94
|
+
? "both"
|
|
95
|
+
: "leading"
|
|
96
|
+
: childIndex === lastIndex
|
|
97
|
+
? "trailing"
|
|
98
|
+
: undefined;
|
|
99
|
+
if (!React.isValidElement(child)) return child;
|
|
100
|
+
// Native boxes and custom slots own their layout; do not pass an automatic edge into them.
|
|
101
|
+
const automaticEdge =
|
|
102
|
+
typeof child.type !== "string" && child.type !== AppBarSlot ? edge : undefined;
|
|
103
|
+
return (
|
|
104
|
+
<AppBarEdgeContext.Provider key={child.key} value={automaticEdge}>
|
|
105
|
+
{child}
|
|
106
|
+
</AppBarEdgeContext.Provider>
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
return visit(children);
|
|
111
|
+
}
|
|
112
|
+
|
|
52
113
|
////////////////////////////////////////////////////////////////////////////////////
|
|
53
114
|
|
|
54
115
|
export interface AppBarRootProps extends AppBarVariantProps, LynxStyledElementProps {}
|
|
@@ -114,7 +175,7 @@ export const AppBarLeft = React.forwardRef<unknown, AppBarLeftProps>((props, ref
|
|
|
114
175
|
)}
|
|
115
176
|
className={clsx(classNames.left, className)}
|
|
116
177
|
>
|
|
117
|
-
{children}
|
|
178
|
+
{provideEdgeToChildren(children)}
|
|
118
179
|
</view>
|
|
119
180
|
);
|
|
120
181
|
});
|
|
@@ -149,7 +210,7 @@ export const AppBarRight = React.forwardRef<unknown, AppBarRightProps>((props, r
|
|
|
149
210
|
)}
|
|
150
211
|
className={clsx(classNames.right, className)}
|
|
151
212
|
>
|
|
152
|
-
{children}
|
|
213
|
+
{provideEdgeToChildren(children)}
|
|
153
214
|
</view>
|
|
154
215
|
);
|
|
155
216
|
});
|
|
@@ -233,11 +294,18 @@ AppBarSubtitle.displayName = "AppBarSubtitle";
|
|
|
233
294
|
|
|
234
295
|
////////////////////////////////////////////////////////////////////////////////////
|
|
235
296
|
|
|
236
|
-
export interface AppBarIconButtonProps
|
|
297
|
+
export interface AppBarIconButtonProps
|
|
298
|
+
extends Omit<LynxElementProps, "flatten">,
|
|
299
|
+
LynxPressableProps {
|
|
237
300
|
icon?: React.ReactElement<LynxIconElementProps>;
|
|
238
301
|
"accessibility-label"?: LynxViewProps["accessibility-label"];
|
|
239
302
|
"accessibility-element"?: LynxViewProps["accessibility-element"];
|
|
240
303
|
"accessibility-traits"?: LynxViewProps["accessibility-traits"];
|
|
304
|
+
/**
|
|
305
|
+
* 슬롯의 첫·마지막 자식이 아이콘 버튼이면 해당 방향을, 유일한 자식이면 양쪽을 자동 보정한다.
|
|
306
|
+
* 명시하면 `AppBarLeft` / `AppBarRight`에서 감지한 자동 보정 방향을 덮어쓴다.
|
|
307
|
+
*/
|
|
308
|
+
edge?: AppBarEdge;
|
|
241
309
|
}
|
|
242
310
|
|
|
243
311
|
export const AppBarIconButton = React.forwardRef<unknown, AppBarIconButtonProps>((props, ref) => {
|
|
@@ -245,12 +313,16 @@ export const AppBarIconButton = React.forwardRef<unknown, AppBarIconButtonProps>
|
|
|
245
313
|
children,
|
|
246
314
|
className,
|
|
247
315
|
icon,
|
|
316
|
+
edge,
|
|
248
317
|
"accessibility-element": accessibilityElement = true,
|
|
249
318
|
"accessibility-label": accessibilityLabel,
|
|
250
319
|
"accessibility-traits": accessibilityTraits = "button",
|
|
251
320
|
...nativeProps
|
|
252
321
|
} = props;
|
|
253
322
|
const classNames = useAppBarClassNames("AppBarIconButton");
|
|
323
|
+
const { scaleFeedbackTriggerProps, scaleFeedbackTargetProps } = useScaleFeedback();
|
|
324
|
+
const automaticEdge = React.useContext(AppBarEdgeContext);
|
|
325
|
+
const resolvedEdge = edge ?? automaticEdge;
|
|
254
326
|
|
|
255
327
|
if (process.env.NODE_ENV !== "production" && accessibilityElement && !accessibilityLabel) {
|
|
256
328
|
console.warn("AppBarIconButton requires `accessibility-label` for accessibility.");
|
|
@@ -258,11 +330,24 @@ export const AppBarIconButton = React.forwardRef<unknown, AppBarIconButtonProps>
|
|
|
258
330
|
|
|
259
331
|
return (
|
|
260
332
|
<view
|
|
261
|
-
{...mergeProps(
|
|
333
|
+
{...mergeProps(
|
|
334
|
+
ref ? { ref: ref as LynxViewRef } : {},
|
|
335
|
+
scaleFeedbackTriggerProps,
|
|
336
|
+
scaleFeedbackTargetProps,
|
|
337
|
+
nativeProps,
|
|
338
|
+
)}
|
|
339
|
+
flatten={false}
|
|
262
340
|
accessibility-element={accessibilityElement}
|
|
263
341
|
accessibility-label={accessibilityLabel}
|
|
264
342
|
accessibility-traits={accessibilityTraits}
|
|
265
|
-
className={clsx(
|
|
343
|
+
className={clsx(
|
|
344
|
+
classNames.iconButton,
|
|
345
|
+
(resolvedEdge === "leading" || resolvedEdge === "both") &&
|
|
346
|
+
"seed-app-bar__icon-button-edge-leading",
|
|
347
|
+
(resolvedEdge === "trailing" || resolvedEdge === "both") &&
|
|
348
|
+
"seed-app-bar__icon-button-edge-trailing",
|
|
349
|
+
className,
|
|
350
|
+
)}
|
|
266
351
|
>
|
|
267
352
|
<IconSlotProvider value={{ classNames: { icon: classNames.icon }, deps: [classNames.icon] }}>
|
|
268
353
|
{icon ? <Icon icon={icon} /> : children}
|
|
@@ -272,19 +357,26 @@ export const AppBarIconButton = React.forwardRef<unknown, AppBarIconButtonProps>
|
|
|
272
357
|
});
|
|
273
358
|
AppBarIconButton.displayName = "AppBarIconButton";
|
|
274
359
|
|
|
275
|
-
export interface AppBarSlotProps extends LynxStyledElementProps {
|
|
360
|
+
export interface AppBarSlotProps extends LynxStyledElementProps {
|
|
361
|
+
/**
|
|
362
|
+
* @internal 커스텀 슬롯에서는 bleed 보정을 적용하지 않는다. 전달된 값은 native 속성에서 제외한다.
|
|
363
|
+
*/
|
|
364
|
+
edge?: AppBarEdge;
|
|
365
|
+
}
|
|
276
366
|
|
|
277
367
|
export const AppBarSlot = React.forwardRef<unknown, AppBarSlotProps>((props, ref) => {
|
|
278
|
-
const { children, className, ...nativeProps } = props;
|
|
368
|
+
const { children, className, edge: _edge, ...nativeProps } = props;
|
|
279
369
|
const classNames = useAppBarClassNames("AppBarSlot");
|
|
280
370
|
|
|
281
371
|
return (
|
|
282
|
-
<
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
372
|
+
<AppBarEdgeContext.Provider value={undefined}>
|
|
373
|
+
<view
|
|
374
|
+
{...mergeProps(ref ? { ref: ref as LynxViewRef } : {}, nativeProps)}
|
|
375
|
+
className={clsx(classNames.custom, className)}
|
|
376
|
+
>
|
|
377
|
+
{children}
|
|
378
|
+
</view>
|
|
379
|
+
</AppBarEdgeContext.Provider>
|
|
288
380
|
);
|
|
289
381
|
});
|
|
290
382
|
AppBarSlot.displayName = "AppBarSlot";
|