@seed-design/lynx-react 0.7.1 → 0.9.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 +42 -16
- 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/context.d.ts +2 -1
- package/lib/components/AppBar/context.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/AppBar/useAppBar.d.ts +2 -1
- package/lib/components/AppBar/useAppBar.d.ts.map +1 -1
- package/lib/components/AppBar/useAppBar.js +17 -15
- 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/Box/Box.d.ts +3 -3
- package/lib/components/Box/Box.d.ts.map +1 -1
- 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/Stack/Stack.d.ts +7 -9
- package/lib/components/Stack/Stack.d.ts.map +1 -1
- 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/hooks/useSafeArea.d.ts +8 -4
- package/lib/hooks/useSafeArea.d.ts.map +1 -1
- package/lib/hooks/useSafeArea.js +22 -20
- 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/lib/utils/styled.d.ts +46 -6
- package/lib/utils/styled.d.ts.map +1 -1
- package/lib/utils/styled.js +19 -4
- 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 +252 -3
- package/src/components/AppBar/AppBar.tsx +108 -25
- package/src/components/AppBar/context.ts +3 -1
- package/src/components/AppBar/index.ts +1 -0
- package/src/components/AppBar/useAppBar.ts +21 -15
- 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/Box/Box.test.tsx +104 -0
- package/src/components/Box/Box.tsx +9 -6
- 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/Stack/Stack.test.tsx +7 -0
- package/src/components/Stack/Stack.tsx +11 -10
- 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/hooks/useSafeArea.test.ts +13 -1
- package/src/hooks/useSafeArea.ts +25 -23
- package/src/types.ts +1 -0
- package/src/utils/styled.ts +127 -9
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export {
|
|
2
|
+
AttachmentInput,
|
|
3
|
+
AttachmentInputRoot,
|
|
4
|
+
AttachmentInputContainer,
|
|
5
|
+
AttachmentInputItemGroup,
|
|
6
|
+
AttachmentInputTrigger,
|
|
7
|
+
AttachmentInputTriggerIcon,
|
|
8
|
+
AttachmentInputTriggerItemCount,
|
|
9
|
+
AttachmentInputItem,
|
|
10
|
+
AttachmentInputItemName,
|
|
11
|
+
AttachmentInputItemSize,
|
|
12
|
+
AttachmentInputItemImage,
|
|
13
|
+
AttachmentInputItemThumbnail,
|
|
14
|
+
AttachmentInputItemMetadata,
|
|
15
|
+
AttachmentInputItemBadge,
|
|
16
|
+
AttachmentInputItemActionButton,
|
|
17
|
+
AttachmentInputItemBackdrop,
|
|
18
|
+
AttachmentInputItemSurface,
|
|
19
|
+
AttachmentInputItemRemoveButton,
|
|
20
|
+
AttachmentInputContext,
|
|
21
|
+
useAttachmentInput,
|
|
22
|
+
useAttachmentInputContext,
|
|
23
|
+
useAttachmentInputItemContext,
|
|
24
|
+
type NativeFile,
|
|
25
|
+
type AttachmentFileError,
|
|
26
|
+
type AttachmentFileRejection,
|
|
27
|
+
type AttachmentFileStatusDetails,
|
|
28
|
+
type AttachmentFileEntry,
|
|
29
|
+
type AttachmentInputProps,
|
|
30
|
+
type AttachmentInputStateProps,
|
|
31
|
+
type AttachmentInputContextValue,
|
|
32
|
+
type AttachmentInputRootProps,
|
|
33
|
+
type AttachmentInputContainerProps,
|
|
34
|
+
type AttachmentInputItemGroupProps,
|
|
35
|
+
type AttachmentInputTriggerProps,
|
|
36
|
+
type AttachmentInputTriggerIconProps,
|
|
37
|
+
type AttachmentInputTriggerItemCountProps,
|
|
38
|
+
type AttachmentInputItemProps,
|
|
39
|
+
type AttachmentInputItemNameProps,
|
|
40
|
+
type AttachmentInputItemSizeProps,
|
|
41
|
+
type AttachmentInputItemSurfaceProps,
|
|
42
|
+
type AttachmentInputItemImageProps,
|
|
43
|
+
type AttachmentInputItemThumbnailProps,
|
|
44
|
+
type AttachmentInputItemMetadataProps,
|
|
45
|
+
type AttachmentInputItemBadgeProps,
|
|
46
|
+
type AttachmentInputItemBackdropProps,
|
|
47
|
+
type AttachmentInputItemActionButtonProps,
|
|
48
|
+
type AttachmentInputItemRemoveButtonProps,
|
|
49
|
+
} from "./AttachmentInput";
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import "@testing-library/jest-dom";
|
|
2
|
+
import { createRef } from "@lynx-js/react";
|
|
1
3
|
import { fireEvent, render } from "@lynx-js/react/testing-library";
|
|
2
4
|
import { beforeEach, describe, expect, it, vi } from "vitest";
|
|
3
5
|
|
|
@@ -75,6 +77,7 @@ vi.mock("../../hooks/useSafeArea", () => ({
|
|
|
75
77
|
}));
|
|
76
78
|
|
|
77
79
|
import * as BottomSheet from "./BottomSheet.namespace";
|
|
80
|
+
import { ScrollFog } from "../ScrollFog";
|
|
78
81
|
|
|
79
82
|
describe("BottomSheet", () => {
|
|
80
83
|
beforeEach(() => {
|
|
@@ -95,19 +98,31 @@ describe("BottomSheet", () => {
|
|
|
95
98
|
});
|
|
96
99
|
});
|
|
97
100
|
|
|
98
|
-
it("renders Body as a
|
|
101
|
+
it("renders Body as a composable view with an explicit ScrollFog child", () => {
|
|
102
|
+
const bodyRef = createRef<unknown>();
|
|
99
103
|
const { container } = render(
|
|
100
104
|
<BottomSheet.Root>
|
|
101
|
-
<BottomSheet.Body>
|
|
102
|
-
<
|
|
105
|
+
<BottomSheet.Body ref={bodyRef} className="custom-body" style={{ height: "200px" }}>
|
|
106
|
+
<ScrollFog hideScrollBar placement={["top", "bottom"]}>
|
|
107
|
+
<text>Scrollable content</text>
|
|
108
|
+
</ScrollFog>
|
|
103
109
|
</BottomSheet.Body>
|
|
104
110
|
</BottomSheet.Root>,
|
|
105
111
|
);
|
|
106
112
|
|
|
107
|
-
const body = container.querySelector("
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
expect(body?.
|
|
113
|
+
const body = container.querySelector(".custom-body");
|
|
114
|
+
const scrollViews = body?.querySelectorAll("scroll-view");
|
|
115
|
+
|
|
116
|
+
expect(body?.tagName.toLowerCase()).toBe("view");
|
|
117
|
+
expect(body).toHaveStyle({ height: "200px" });
|
|
118
|
+
expect(bodyRef.current).not.toBeNull();
|
|
119
|
+
expect(scrollViews).toHaveLength(2);
|
|
120
|
+
expect(scrollViews?.item(0)).toHaveAttribute("scroll-orientation", "vertical");
|
|
121
|
+
expect(scrollViews?.item(1)).toHaveAttribute("scroll-orientation", "horizontal");
|
|
122
|
+
for (const scrollView of scrollViews ?? []) {
|
|
123
|
+
expect(scrollView).toHaveAttribute("scroll-bar-enable", "false");
|
|
124
|
+
expect(scrollView).not.toHaveAttribute("fading-edge-length");
|
|
125
|
+
}
|
|
111
126
|
});
|
|
112
127
|
|
|
113
128
|
it("renders Handle with a target-size touch area around the visual handle", () => {
|
|
@@ -392,26 +392,8 @@ function createTextSlot(
|
|
|
392
392
|
export interface BottomSheetHeaderProps extends BottomSheetSlotProps {}
|
|
393
393
|
export const BottomSheetHeader = createViewSlot("header");
|
|
394
394
|
BottomSheetHeader.displayName = "BottomSheetHeader";
|
|
395
|
-
|
|
396
395
|
export interface BottomSheetBodyProps extends BottomSheetSlotProps {}
|
|
397
|
-
export const BottomSheetBody
|
|
398
|
-
unknown,
|
|
399
|
-
BottomSheetBodyProps
|
|
400
|
-
>((props, ref) => {
|
|
401
|
-
const { children, className, style } = props;
|
|
402
|
-
const classNames = useClassNames();
|
|
403
|
-
|
|
404
|
-
return (
|
|
405
|
-
<scroll-view
|
|
406
|
-
{...(ref ? ({ ref: ref as LynxViewRef } as Record<string, unknown>) : {})}
|
|
407
|
-
scroll-y
|
|
408
|
-
className={clsx(classNames.body, className)}
|
|
409
|
-
style={style as never}
|
|
410
|
-
>
|
|
411
|
-
{children}
|
|
412
|
-
</scroll-view>
|
|
413
|
-
);
|
|
414
|
-
});
|
|
396
|
+
export const BottomSheetBody = createViewSlot("body");
|
|
415
397
|
BottomSheetBody.displayName = "BottomSheetBody";
|
|
416
398
|
|
|
417
399
|
export interface BottomSheetFooterProps extends BottomSheetSlotProps {}
|
|
@@ -9,7 +9,9 @@ interface TestLynxGlobal {
|
|
|
9
9
|
lynx?: {
|
|
10
10
|
__globalProps?: {
|
|
11
11
|
safeAreaInsetTop?: number;
|
|
12
|
+
safeAreaInsetRight?: number;
|
|
12
13
|
safeAreaInsetBottom?: number;
|
|
14
|
+
safeAreaInsetLeft?: number;
|
|
13
15
|
};
|
|
14
16
|
};
|
|
15
17
|
lynxTestingEnv?: {
|
|
@@ -82,4 +84,106 @@ describe("Box", () => {
|
|
|
82
84
|
"padding-bottom": "34px",
|
|
83
85
|
});
|
|
84
86
|
});
|
|
87
|
+
|
|
88
|
+
it("resolves left and right safe area padding from global props", () => {
|
|
89
|
+
setGlobalProps({
|
|
90
|
+
safeAreaInsetRight: 62,
|
|
91
|
+
safeAreaInsetLeft: 59,
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
render(
|
|
95
|
+
<Box className="box-test" pl="safeArea" pr="safeArea">
|
|
96
|
+
<Text>Box content</Text>
|
|
97
|
+
</Box>,
|
|
98
|
+
);
|
|
99
|
+
|
|
100
|
+
const box = getRenderedRoot().querySelector(".box-test");
|
|
101
|
+
|
|
102
|
+
expect(box).toBeInTheDocument();
|
|
103
|
+
expectStyle((box as HTMLElement).style, {
|
|
104
|
+
"padding-left": "59px",
|
|
105
|
+
"padding-right": "62px",
|
|
106
|
+
});
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
it("resolves margin with side over axis over all", () => {
|
|
110
|
+
render(<Box className="box-test" m="x1" mx="x2" ml="x3" />);
|
|
111
|
+
|
|
112
|
+
const box = getRenderedRoot().querySelector(".box-test");
|
|
113
|
+
|
|
114
|
+
expectStyle((box as HTMLElement).style, {
|
|
115
|
+
"margin-top": "var(--seed-dimension-x1)",
|
|
116
|
+
"margin-right": "var(--seed-dimension-x2)",
|
|
117
|
+
"margin-bottom": "var(--seed-dimension-x1)",
|
|
118
|
+
"margin-left": "var(--seed-dimension-x3)",
|
|
119
|
+
});
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
it("keeps auto margin", () => {
|
|
123
|
+
render(<Box className="box-test" ml="auto" />);
|
|
124
|
+
|
|
125
|
+
const box = getRenderedRoot().querySelector(".box-test");
|
|
126
|
+
|
|
127
|
+
expectStyle((box as HTMLElement).style, { "margin-left": "auto" });
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
it("negates bleed values with side over axis over all", () => {
|
|
131
|
+
render(<Box className="box-test" bleed="4px" bleedX="8px" bleedLeft="12px" />);
|
|
132
|
+
|
|
133
|
+
const box = getRenderedRoot().querySelector(".box-test");
|
|
134
|
+
|
|
135
|
+
// happy-dom folds the constant `calc(4px * -1)` that Box emits.
|
|
136
|
+
expectStyle((box as HTMLElement).style, {
|
|
137
|
+
"margin-top": "calc(-4px)",
|
|
138
|
+
"margin-right": "calc(-8px)",
|
|
139
|
+
"margin-bottom": "calc(-4px)",
|
|
140
|
+
"margin-left": "calc(-12px)",
|
|
141
|
+
});
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
it("negates safe area bleed from global props", () => {
|
|
145
|
+
setGlobalProps({
|
|
146
|
+
safeAreaInsetRight: 62,
|
|
147
|
+
safeAreaInsetLeft: 59,
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
render(<Box className="box-test" bleedX="safeArea" />);
|
|
151
|
+
|
|
152
|
+
const box = getRenderedRoot().querySelector(".box-test");
|
|
153
|
+
|
|
154
|
+
expectStyle((box as HTMLElement).style, {
|
|
155
|
+
"margin-left": "calc(-59px)",
|
|
156
|
+
"margin-right": "calc(-62px)",
|
|
157
|
+
});
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
it("negates the env() fallback when the host omits safe area bleed insets", () => {
|
|
161
|
+
render(<Box className="box-test" bleedX="safeArea" />);
|
|
162
|
+
|
|
163
|
+
const box = getRenderedRoot().querySelector(".box-test");
|
|
164
|
+
|
|
165
|
+
// happy-dom normalizes the `calc(env(...) * -1)` that Box emits.
|
|
166
|
+
expectStyle((box as HTMLElement).style, {
|
|
167
|
+
"margin-left": "calc(env(safe-area-inset-left) *-1)",
|
|
168
|
+
"margin-right": "calc(env(safe-area-inset-right) *-1)",
|
|
169
|
+
});
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
it("rejects dimension tokens as bleed values", () => {
|
|
173
|
+
// @ts-expect-error Lynx drops an inline calc() that contains a token's var().
|
|
174
|
+
render(<Box bleedX="x4" />);
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
it("lets style override margin props", () => {
|
|
178
|
+
render(<Box className="box-test" mt="x4" style={{ marginTop: "3px" }} />);
|
|
179
|
+
|
|
180
|
+
const box = getRenderedRoot().querySelector(".box-test");
|
|
181
|
+
|
|
182
|
+
expectStyle((box as HTMLElement).style, { "margin-top": "3px" });
|
|
183
|
+
});
|
|
184
|
+
|
|
185
|
+
it("rejects margin and bleed props together", () => {
|
|
186
|
+
// @ts-expect-error margin and bleed props both resolve to margin-*.
|
|
187
|
+
render(<Box m="x1" bleedX="8px" />);
|
|
188
|
+
});
|
|
85
189
|
});
|
|
@@ -2,7 +2,7 @@ import clsx from "clsx";
|
|
|
2
2
|
import * as React from "@lynx-js/react";
|
|
3
3
|
|
|
4
4
|
import type { LynxPressableProps, LynxStyledElementProps, LynxViewRef } from "../../types";
|
|
5
|
-
import { useStyleProps, type StyleProps } from "../../utils/styled";
|
|
5
|
+
import { useStyleProps, type MarginBleedStyleProps, type StyleProps } from "../../utils/styled";
|
|
6
6
|
import { mergeProps } from "../../utils/merge-props";
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -15,11 +15,14 @@ import { mergeProps } from "../../utils/merge-props";
|
|
|
15
15
|
* 컴포넌트 내부에서는 native tag와 recipe className을 사용하고, inline style은
|
|
16
16
|
* 런타임 값이 필요한 경우에만 제한적으로 사용합니다.
|
|
17
17
|
*/
|
|
18
|
-
export
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
export type BoxProps = StyleProps &
|
|
19
|
+
MarginBleedStyleProps &
|
|
20
|
+
LynxStyledElementProps &
|
|
21
|
+
LynxPressableProps & {
|
|
22
|
+
bindtouchstart?: () => void;
|
|
23
|
+
bindtouchend?: () => void;
|
|
24
|
+
bindtouchcancel?: () => void;
|
|
25
|
+
};
|
|
23
26
|
|
|
24
27
|
export const Box = React.forwardRef<unknown, BoxProps>((props, ref) => {
|
|
25
28
|
const { style, restProps } = useStyleProps(props);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export {
|
|
2
|
+
ChipTabsCarousel as Carousel,
|
|
3
|
+
ChipTabsCarouselCamera as CarouselCamera,
|
|
4
|
+
ChipTabsContent as Content,
|
|
5
|
+
ChipTabsList as List,
|
|
6
|
+
ChipTabsRoot as Root,
|
|
7
|
+
ChipTabsTrigger as Trigger,
|
|
8
|
+
type ChipTabsCarouselCameraProps as CarouselCameraProps,
|
|
9
|
+
type ChipTabsCarouselProps as CarouselProps,
|
|
10
|
+
type ChipTabsContentProps as ContentProps,
|
|
11
|
+
type ChipTabsListProps as ListProps,
|
|
12
|
+
type ChipTabsRootProps as RootProps,
|
|
13
|
+
type ChipTabsTriggerProps as TriggerProps,
|
|
14
|
+
} from "./ChipTabs";
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import * as React from "@lynx-js/react";
|
|
2
|
+
|
|
3
|
+
import { chipTabs, type ChipTabsVariantProps } from "@seed-design/lynx-css/recipes/chip-tabs";
|
|
4
|
+
|
|
5
|
+
import { createSlotRecipeContext } from "../../utils/create-slot-recipe-context";
|
|
6
|
+
|
|
7
|
+
import {
|
|
8
|
+
TabsCarousel,
|
|
9
|
+
TabsCarouselCamera,
|
|
10
|
+
TabsContent,
|
|
11
|
+
TabsList,
|
|
12
|
+
TabsRootPrimitive,
|
|
13
|
+
TabsTrigger,
|
|
14
|
+
type TabsCarouselCameraProps,
|
|
15
|
+
type TabsCarouselProps,
|
|
16
|
+
type TabsContentProps,
|
|
17
|
+
type TabsListProps,
|
|
18
|
+
type TabsRootProps,
|
|
19
|
+
type TabsTriggerProps,
|
|
20
|
+
} from "../Tabs/Tabs";
|
|
21
|
+
|
|
22
|
+
type ChipTabsRecipeState = Pick<
|
|
23
|
+
ChipTabsVariantProps,
|
|
24
|
+
"selected" | "pressed" | "disabled" | "inCarousel"
|
|
25
|
+
>;
|
|
26
|
+
|
|
27
|
+
const CHIP_TABS_TRIGGER_GAP = 8;
|
|
28
|
+
const { ClassNamesProvider: ChipTabsClassNamesProvider } = createSlotRecipeContext(chipTabs);
|
|
29
|
+
|
|
30
|
+
type ChipTabsPublicVariantProps = Omit<
|
|
31
|
+
ChipTabsVariantProps,
|
|
32
|
+
"selected" | "pressed" | "disabled" | "inCarousel"
|
|
33
|
+
>;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* @platform Lynx
|
|
37
|
+
*
|
|
38
|
+
* 웹 대비 미지원 기능:
|
|
39
|
+
* - `lazyMount`, `unmountOnExit`: native viewpager가 모든 page slot을 유지해야 함
|
|
40
|
+
* - 키보드 포커스와 roving tabindex
|
|
41
|
+
*/
|
|
42
|
+
export interface ChipTabsRootProps
|
|
43
|
+
extends Omit<TabsRootProps, "size" | "contentLayout" | "stickyList" | "triggerLayout">,
|
|
44
|
+
ChipTabsPublicVariantProps {}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Chip recipe와 Tabs의 controlled state, horizontal scrolling, and native pager behavior를 결합합니다.
|
|
48
|
+
*/
|
|
49
|
+
export const ChipTabsRoot = React.forwardRef<unknown, ChipTabsRootProps>((props, ref) => {
|
|
50
|
+
const [variantProps, rootProps] = chipTabs.splitVariantProps(props);
|
|
51
|
+
const getClassNames = React.useCallback(
|
|
52
|
+
(state: ChipTabsRecipeState = {}) =>
|
|
53
|
+
chipTabs({
|
|
54
|
+
...variantProps,
|
|
55
|
+
selected: state.selected,
|
|
56
|
+
pressed: state.pressed,
|
|
57
|
+
disabled: state.disabled,
|
|
58
|
+
inCarousel: state.inCarousel,
|
|
59
|
+
}),
|
|
60
|
+
[variantProps],
|
|
61
|
+
);
|
|
62
|
+
const recipe = React.useMemo(
|
|
63
|
+
() => ({
|
|
64
|
+
getClassNames,
|
|
65
|
+
triggerGap: CHIP_TABS_TRIGGER_GAP,
|
|
66
|
+
}),
|
|
67
|
+
[getClassNames],
|
|
68
|
+
);
|
|
69
|
+
|
|
70
|
+
return (
|
|
71
|
+
<ChipTabsClassNamesProvider value={getClassNames()}>
|
|
72
|
+
<TabsRootPrimitive {...rootProps} ref={ref} recipe={recipe} inlineNotification />
|
|
73
|
+
</ChipTabsClassNamesProvider>
|
|
74
|
+
);
|
|
75
|
+
});
|
|
76
|
+
ChipTabsRoot.displayName = "ChipTabsRoot";
|
|
77
|
+
|
|
78
|
+
////////////////////////////////////////////////////////////////////////////////////
|
|
79
|
+
|
|
80
|
+
export interface ChipTabsListProps extends Omit<TabsListProps, "scrollAlign"> {
|
|
81
|
+
/** 선택한 chip을 목록 안에서 정렬할 방식입니다. @defaultValue "nearest" */
|
|
82
|
+
scrollAlign?: TabsListProps["scrollAlign"];
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* ChipTabs는 이미 보이는 선택 chip을 움직이지 않도록 기본적으로 `"nearest"`를 사용합니다.
|
|
87
|
+
*/
|
|
88
|
+
export const ChipTabsList = React.forwardRef<unknown, ChipTabsListProps>(
|
|
89
|
+
({ scrollAlign = "nearest", ...props }, ref) => (
|
|
90
|
+
<TabsList {...props} ref={ref} scrollAlign={scrollAlign} />
|
|
91
|
+
),
|
|
92
|
+
);
|
|
93
|
+
ChipTabsList.displayName = "ChipTabsList";
|
|
94
|
+
|
|
95
|
+
////////////////////////////////////////////////////////////////////////////////////
|
|
96
|
+
|
|
97
|
+
/** Native text label and optional inline notification slot을 갖는 chip trigger입니다. */
|
|
98
|
+
export interface ChipTabsTriggerProps extends TabsTriggerProps {}
|
|
99
|
+
|
|
100
|
+
export const ChipTabsTrigger = TabsTrigger;
|
|
101
|
+
|
|
102
|
+
////////////////////////////////////////////////////////////////////////////////////
|
|
103
|
+
|
|
104
|
+
export interface ChipTabsContentProps extends TabsContentProps {}
|
|
105
|
+
|
|
106
|
+
export const ChipTabsContent = TabsContent;
|
|
107
|
+
|
|
108
|
+
////////////////////////////////////////////////////////////////////////////////////
|
|
109
|
+
|
|
110
|
+
/** @platform Lynx native viewpager를 사용하므로 Tabs Carousel의 미지원 prop과 동일합니다. */
|
|
111
|
+
export interface ChipTabsCarouselProps extends TabsCarouselProps {}
|
|
112
|
+
|
|
113
|
+
export const ChipTabsCarousel = TabsCarousel;
|
|
114
|
+
|
|
115
|
+
////////////////////////////////////////////////////////////////////////////////////
|
|
116
|
+
|
|
117
|
+
export interface ChipTabsCarouselCameraProps extends TabsCarouselCameraProps {}
|
|
118
|
+
|
|
119
|
+
export const ChipTabsCarouselCamera = TabsCarouselCamera;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export {
|
|
2
|
+
ChipTabsCarousel,
|
|
3
|
+
ChipTabsCarouselCamera,
|
|
4
|
+
ChipTabsContent,
|
|
5
|
+
ChipTabsList,
|
|
6
|
+
ChipTabsRoot,
|
|
7
|
+
ChipTabsTrigger,
|
|
8
|
+
type ChipTabsCarouselCameraProps,
|
|
9
|
+
type ChipTabsCarouselProps,
|
|
10
|
+
type ChipTabsContentProps,
|
|
11
|
+
type ChipTabsListProps,
|
|
12
|
+
type ChipTabsRootProps,
|
|
13
|
+
type ChipTabsTriggerProps,
|
|
14
|
+
} from "./ChipTabs";
|
|
15
|
+
|
|
16
|
+
export * as ChipTabs from "./ChipTabs.namespace";
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import "@testing-library/jest-dom";
|
|
2
|
+
import { fireEvent, getQueriesForElement, render } from "@lynx-js/react/testing-library";
|
|
3
|
+
import { describe, expect, it, vi } from "vitest";
|
|
4
|
+
|
|
5
|
+
import { ContextualFloatingButton } from "./ContextualFloatingButton";
|
|
6
|
+
|
|
7
|
+
function getRenderedRoot() {
|
|
8
|
+
const root = elementTree.root;
|
|
9
|
+
|
|
10
|
+
if (!root) {
|
|
11
|
+
throw new Error("Expected Lynx render root to exist.");
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
return root;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function getContextualFloatingButtonRoot() {
|
|
18
|
+
const root = getRenderedRoot();
|
|
19
|
+
|
|
20
|
+
if (root.classList.contains("seed-contextual-floating-button__root")) return root;
|
|
21
|
+
|
|
22
|
+
const button = root.querySelector<HTMLElement>(".seed-contextual-floating-button__root");
|
|
23
|
+
if (!button) {
|
|
24
|
+
throw new Error("Expected ContextualFloatingButton root to exist.");
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
return button;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
describe("ContextualFloatingButton", () => {
|
|
31
|
+
it("preserves its label under the loading indicator while blocking taps", () => {
|
|
32
|
+
const onTap = vi.fn();
|
|
33
|
+
render(
|
|
34
|
+
<ContextualFloatingButton loading bindtap={onTap}>
|
|
35
|
+
저장하기
|
|
36
|
+
</ContextualFloatingButton>,
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
const root = getContextualFloatingButtonRoot();
|
|
40
|
+
|
|
41
|
+
expect(getQueriesForElement(getRenderedRoot()).getByText("저장하기")).toBeInTheDocument();
|
|
42
|
+
expect(root.querySelector(".seed-progress-circle__root")).toBeInTheDocument();
|
|
43
|
+
|
|
44
|
+
fireEvent.tap(root);
|
|
45
|
+
|
|
46
|
+
expect(onTap).not.toHaveBeenCalled();
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
it("blocks taps and exposes disabled accessibility state when disabled", () => {
|
|
50
|
+
const onTap = vi.fn();
|
|
51
|
+
render(
|
|
52
|
+
<ContextualFloatingButton disabled bindtap={onTap}>
|
|
53
|
+
저장하기
|
|
54
|
+
</ContextualFloatingButton>,
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
const root = getContextualFloatingButtonRoot();
|
|
58
|
+
fireEvent.tap(root);
|
|
59
|
+
|
|
60
|
+
expect(onTap).not.toHaveBeenCalled();
|
|
61
|
+
expect(root).toHaveAttribute("accessibility-traits", "disabled");
|
|
62
|
+
});
|
|
63
|
+
});
|