@seed-design/lynx-react 0.0.0-alpha-20260622094810
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/_virtual/_rolldown/runtime.js +13 -0
- package/lib/components/ActionButton/ActionButton.d.ts +49 -0
- package/lib/components/ActionButton/ActionButton.d.ts.map +1 -0
- package/lib/components/ActionButton/ActionButton.jsx +158 -0
- package/lib/components/ActionButton/index.d.ts +2 -0
- package/lib/components/ActionButton/index.d.ts.map +1 -0
- package/lib/components/AppBar/AppBar.d.ts +35 -0
- package/lib/components/AppBar/AppBar.d.ts.map +1 -0
- package/lib/components/AppBar/AppBar.jsx +132 -0
- package/lib/components/AppBar/AppBar.namespace.d.ts +2 -0
- package/lib/components/AppBar/AppBar.namespace.d.ts.map +1 -0
- package/lib/components/AppBar/AppBar.namespace.js +15 -0
- package/lib/components/AppBar/context.d.ts +13 -0
- package/lib/components/AppBar/context.d.ts.map +1 -0
- package/lib/components/AppBar/context.js +12 -0
- package/lib/components/AppBar/index.d.ts +3 -0
- package/lib/components/AppBar/index.d.ts.map +1 -0
- package/lib/components/AppBar/useAppBar.d.ts +15 -0
- package/lib/components/AppBar/useAppBar.d.ts.map +1 -0
- package/lib/components/AppBar/useAppBar.js +72 -0
- package/lib/components/Badge/Badge.d.ts +14 -0
- package/lib/components/Badge/Badge.d.ts.map +1 -0
- package/lib/components/Badge/Badge.jsx +15 -0
- package/lib/components/Badge/index.d.ts +2 -0
- package/lib/components/Badge/index.d.ts.map +1 -0
- package/lib/components/BottomSheet/BottomSheet.d.ts +87 -0
- package/lib/components/BottomSheet/BottomSheet.d.ts.map +1 -0
- package/lib/components/BottomSheet/BottomSheet.jsx +163 -0
- package/lib/components/BottomSheet/BottomSheet.namespace.d.ts +2 -0
- package/lib/components/BottomSheet/BottomSheet.namespace.d.ts.map +1 -0
- package/lib/components/BottomSheet/BottomSheet.namespace.js +18 -0
- package/lib/components/BottomSheet/index.d.ts +3 -0
- package/lib/components/BottomSheet/index.d.ts.map +1 -0
- package/lib/components/Box/Box.d.ts +20 -0
- package/lib/components/Box/Box.d.ts.map +1 -0
- package/lib/components/Box/Box.jsx +14 -0
- package/lib/components/Box/index.d.ts +2 -0
- package/lib/components/Box/index.d.ts.map +1 -0
- package/lib/components/Checkbox/Checkbox.d.ts +35 -0
- package/lib/components/Checkbox/Checkbox.d.ts.map +1 -0
- package/lib/components/Checkbox/Checkbox.jsx +130 -0
- package/lib/components/Checkbox/Checkbox.namespace.d.ts +2 -0
- package/lib/components/Checkbox/Checkbox.namespace.d.ts.map +1 -0
- package/lib/components/Checkbox/Checkbox.namespace.js +12 -0
- package/lib/components/Checkbox/index.d.ts +3 -0
- package/lib/components/Checkbox/index.d.ts.map +1 -0
- package/lib/components/Icon/Icon.d.ts +37 -0
- package/lib/components/Icon/Icon.d.ts.map +1 -0
- package/lib/components/Icon/Icon.jsx +143 -0
- package/lib/components/Icon/index.d.ts +2 -0
- package/lib/components/Icon/index.d.ts.map +1 -0
- package/lib/components/ProgressCircle/ProgressCircle.d.ts +25 -0
- package/lib/components/ProgressCircle/ProgressCircle.d.ts.map +1 -0
- package/lib/components/ProgressCircle/ProgressCircle.jsx +281 -0
- package/lib/components/ProgressCircle/ProgressCircle.namespace.d.ts +2 -0
- package/lib/components/ProgressCircle/ProgressCircle.namespace.d.ts.map +1 -0
- package/lib/components/ProgressCircle/ProgressCircle.namespace.js +9 -0
- package/lib/components/ProgressCircle/index.d.ts +3 -0
- package/lib/components/ProgressCircle/index.d.ts.map +1 -0
- package/lib/components/RadioGroup/RadioGroup.d.ts +34 -0
- package/lib/components/RadioGroup/RadioGroup.d.ts.map +1 -0
- package/lib/components/RadioGroup/RadioGroup.jsx +160 -0
- package/lib/components/RadioGroup/RadioGroup.namespace.d.ts +2 -0
- package/lib/components/RadioGroup/RadioGroup.namespace.d.ts.map +1 -0
- package/lib/components/RadioGroup/RadioGroup.namespace.js +12 -0
- package/lib/components/RadioGroup/index.d.ts +3 -0
- package/lib/components/RadioGroup/index.d.ts.map +1 -0
- package/lib/components/Stack/Stack.d.ts +33 -0
- package/lib/components/Stack/Stack.d.ts.map +1 -0
- package/lib/components/Stack/Stack.jsx +39 -0
- package/lib/components/Stack/index.d.ts +2 -0
- package/lib/components/Stack/index.d.ts.map +1 -0
- package/lib/components/Switch/Switch.d.ts +21 -0
- package/lib/components/Switch/Switch.d.ts.map +1 -0
- package/lib/components/Switch/Switch.jsx +101 -0
- package/lib/components/Switch/Switch.namespace.d.ts +2 -0
- package/lib/components/Switch/Switch.namespace.d.ts.map +1 -0
- package/lib/components/Switch/Switch.namespace.js +11 -0
- package/lib/components/Switch/index.d.ts +3 -0
- package/lib/components/Switch/index.d.ts.map +1 -0
- package/lib/components/TagGroup/TagGroup.d.ts +34 -0
- package/lib/components/TagGroup/TagGroup.d.ts.map +1 -0
- package/lib/components/TagGroup/TagGroup.jsx +57 -0
- package/lib/components/TagGroup/TagGroup.namespace.d.ts +2 -0
- package/lib/components/TagGroup/TagGroup.namespace.d.ts.map +1 -0
- package/lib/components/TagGroup/TagGroup.namespace.js +10 -0
- package/lib/components/TagGroup/index.d.ts +3 -0
- package/lib/components/TagGroup/index.d.ts.map +1 -0
- package/lib/components/Text/Text.d.ts +7 -0
- package/lib/components/Text/Text.d.ts.map +1 -0
- package/lib/components/Text/Text.jsx +28 -0
- package/lib/components/Text/index.d.ts +2 -0
- package/lib/components/Text/index.d.ts.map +1 -0
- package/lib/components/index.d.ts +14 -0
- package/lib/components/index.d.ts.map +1 -0
- package/lib/hooks/index.d.ts +5 -0
- package/lib/hooks/index.d.ts.map +1 -0
- package/lib/hooks/useControllableState.d.ts +15 -0
- package/lib/hooks/useControllableState.d.ts.map +1 -0
- package/lib/hooks/useControllableState.js +27 -0
- package/lib/hooks/useIconColor.d.ts +19 -0
- package/lib/hooks/useIconColor.d.ts.map +1 -0
- package/lib/hooks/useIconColor.js +38 -0
- package/lib/hooks/usePressTap.d.ts +27 -0
- package/lib/hooks/usePressTap.d.ts.map +1 -0
- package/lib/hooks/usePressTap.js +35 -0
- package/lib/hooks/useSafeArea.d.ts +19 -0
- package/lib/hooks/useSafeArea.d.ts.map +1 -0
- package/lib/hooks/useSafeArea.js +33 -0
- package/lib/index.d.ts +5 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +29 -0
- package/lib/types.d.ts +51 -0
- package/lib/types.d.ts.map +1 -0
- package/lib/utils/children.d.ts +3 -0
- package/lib/utils/children.d.ts.map +1 -0
- package/lib/utils/children.js +8 -0
- package/lib/utils/create-slot-recipe-context.d.ts +27 -0
- package/lib/utils/create-slot-recipe-context.d.ts.map +1 -0
- package/lib/utils/create-slot-recipe-context.jsx +94 -0
- package/lib/utils/get-seed-class-name.d.ts +22 -0
- package/lib/utils/get-seed-class-name.d.ts.map +1 -0
- package/lib/utils/get-seed-class-name.js +28 -0
- package/lib/utils/index.d.ts +5 -0
- package/lib/utils/index.d.ts.map +1 -0
- package/lib/utils/resolve-recipe-token.d.ts +38 -0
- package/lib/utils/resolve-recipe-token.d.ts.map +1 -0
- package/lib/utils/resolve-recipe-token.js +49 -0
- package/lib/utils/split-multiple-variants-props.d.ts +29 -0
- package/lib/utils/split-multiple-variants-props.d.ts.map +1 -0
- package/lib/utils/split-multiple-variants-props.js +34 -0
- package/lib/utils/styled.d.ts +83 -0
- package/lib/utils/styled.d.ts.map +1 -0
- package/lib/utils/styled.js +144 -0
- package/package.json +54 -0
- package/src/components/ActionButton/ActionButton.test.tsx +167 -0
- package/src/components/ActionButton/ActionButton.tsx +363 -0
- package/src/components/ActionButton/index.ts +1 -0
- package/src/components/AppBar/AppBar.namespace.ts +18 -0
- package/src/components/AppBar/AppBar.test.tsx +270 -0
- package/src/components/AppBar/AppBar.tsx +288 -0
- package/src/components/AppBar/context.ts +27 -0
- package/src/components/AppBar/index.ts +21 -0
- package/src/components/AppBar/useAppBar.ts +100 -0
- package/src/components/Badge/Badge.test.tsx +54 -0
- package/src/components/Badge/Badge.tsx +32 -0
- package/src/components/Badge/index.ts +1 -0
- package/src/components/BottomSheet/BottomSheet.namespace.ts +24 -0
- package/src/components/BottomSheet/BottomSheet.test.tsx +219 -0
- package/src/components/BottomSheet/BottomSheet.tsx +423 -0
- package/src/components/BottomSheet/index.ts +27 -0
- package/src/components/Box/Box.test.tsx +85 -0
- package/src/components/Box/Box.tsx +39 -0
- package/src/components/Box/index.ts +1 -0
- package/src/components/Checkbox/Checkbox.namespace.ts +12 -0
- package/src/components/Checkbox/Checkbox.tsx +282 -0
- package/src/components/Checkbox/index.ts +14 -0
- package/src/components/Icon/Icon.tsx +265 -0
- package/src/components/Icon/index.ts +8 -0
- package/src/components/ProgressCircle/ProgressCircle.namespace.ts +5 -0
- package/src/components/ProgressCircle/ProgressCircle.tsx +424 -0
- package/src/components/ProgressCircle/index.ts +9 -0
- package/src/components/RadioGroup/RadioGroup.namespace.ts +12 -0
- package/src/components/RadioGroup/RadioGroup.tsx +320 -0
- package/src/components/RadioGroup/index.ts +14 -0
- package/src/components/Stack/Stack.tsx +97 -0
- package/src/components/Stack/index.ts +1 -0
- package/src/components/Switch/Switch.namespace.ts +10 -0
- package/src/components/Switch/Switch.tsx +200 -0
- package/src/components/Switch/index.ts +12 -0
- package/src/components/TagGroup/TagGroup.namespace.ts +8 -0
- package/src/components/TagGroup/TagGroup.tsx +127 -0
- package/src/components/TagGroup/index.ts +10 -0
- package/src/components/Text/Text.tsx +64 -0
- package/src/components/Text/index.ts +1 -0
- package/src/components/index.ts +13 -0
- package/src/hooks/index.ts +4 -0
- package/src/hooks/useControllableState.test.ts +120 -0
- package/src/hooks/useControllableState.ts +38 -0
- package/src/hooks/useIconColor.test.ts +13 -0
- package/src/hooks/useIconColor.ts +67 -0
- package/src/hooks/usePressTap.test.ts +129 -0
- package/src/hooks/usePressTap.ts +58 -0
- package/src/hooks/useSafeArea.test.ts +83 -0
- package/src/hooks/useSafeArea.ts +56 -0
- package/src/index.ts +4 -0
- package/src/types.ts +76 -0
- package/src/utils/children.ts +13 -0
- package/src/utils/create-slot-recipe-context.test.tsx +96 -0
- package/src/utils/create-slot-recipe-context.tsx +187 -0
- package/src/utils/get-seed-class-name.ts +47 -0
- package/src/utils/index.ts +4 -0
- package/src/utils/resolve-recipe-token.ts +47 -0
- package/src/utils/split-multiple-variants-props.test.ts +61 -0
- package/src/utils/split-multiple-variants-props.ts +59 -0
- package/src/utils/styled.ts +442 -0
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { BottomSheetVariantProps } from '@seed-design/lynx-css/recipes/bottom-sheet';
|
|
2
|
+
import { SheetBackdropProps, SheetContentProps, SheetHandleProps, SheetRootProps, SheetRootRef, SheetViewProps } from '@lynx-js/lynx-ui-sheet';
|
|
3
|
+
import { ForwardRefExoticComponent, PropsWithoutRef, ReactElement, RefAttributes } from '@lynx-js/react';
|
|
4
|
+
import { LynxPressableProps, LynxStyledElementProps } from '../../types';
|
|
5
|
+
type LynxForwardRefComponent<T, P> = ForwardRefExoticComponent<PropsWithoutRef<P> & RefAttributes<T>>;
|
|
6
|
+
export type BottomSheetRootRef = SheetRootRef;
|
|
7
|
+
export interface BottomSheetRootProps extends BottomSheetVariantProps, Omit<SheetRootProps, "show" | "defaultShow" | "onShowChange"> {
|
|
8
|
+
/**
|
|
9
|
+
* Whether the sheet is open (controlled mode).
|
|
10
|
+
* Internally mapped to `show` of `@lynx-js/lynx-ui-sheet`.
|
|
11
|
+
*/
|
|
12
|
+
open?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Whether the sheet is open by default (uncontrolled mode).
|
|
15
|
+
* Internally mapped to `defaultShow`.
|
|
16
|
+
* @defaultValue false
|
|
17
|
+
*/
|
|
18
|
+
defaultOpen?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Called when the sheet's open state is about to change.
|
|
21
|
+
* Internally mapped to `onShowChange`.
|
|
22
|
+
*/
|
|
23
|
+
onOpenChange?: (open: boolean) => void;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* @platform Lynx — wraps `@lynx-js/lynx-ui-sheet`
|
|
27
|
+
*
|
|
28
|
+
* 웹 대비 미지원 기능:
|
|
29
|
+
* - `lazyMount`, `unmountOnExit`: lynx-ui-sheet의 `forceMount`로 대체
|
|
30
|
+
* - `BottomSheetPositioner`: lynx-ui-sheet의 `SheetView`가 자동 처리하므로 별도 슬롯 없음
|
|
31
|
+
* - `BottomSheetCloseButton`: Tier B (Lynx SVG 지원 후 추가 예정)
|
|
32
|
+
* - `BottomSheetTrigger`의 `asChild`: 미지원 (기본 `<view>`만)
|
|
33
|
+
*/
|
|
34
|
+
export declare const BottomSheetRoot: LynxForwardRefComponent<SheetRootRef, BottomSheetRootProps>;
|
|
35
|
+
export interface BottomSheetTriggerProps extends LynxStyledElementProps, Pick<LynxPressableProps, "bindtap"> {
|
|
36
|
+
}
|
|
37
|
+
export declare const BottomSheetTrigger: LynxForwardRefComponent<unknown, BottomSheetTriggerProps>;
|
|
38
|
+
export interface BottomSheetPositionerProps extends SheetViewProps {
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Backdrop/Content는 반드시 `BottomSheetPositioner` 안에 배치해야 한다.
|
|
42
|
+
*
|
|
43
|
+
* `SheetView`는 `mounted || forceMount` 조건으로 자식을 gating하므로 시트가 처음
|
|
44
|
+
* 열리기 전까지는 SheetBackdrop/SheetContent가 마운트되지 않아 motion value
|
|
45
|
+
* 초기화 레이스를 피할 수 있다. Trigger는 이 컴포넌트 밖에 두어야 탭 가능하다.
|
|
46
|
+
*
|
|
47
|
+
* recipe의 `positioner` slot className을 자동 적용해 `position: fixed` + 전체
|
|
48
|
+
* 뷰포트 커버 레이아웃을 보장한다.
|
|
49
|
+
*/
|
|
50
|
+
export declare const BottomSheetPositioner: LynxForwardRefComponent<unknown, BottomSheetPositionerProps>;
|
|
51
|
+
export interface BottomSheetBackdropProps extends SheetBackdropProps {
|
|
52
|
+
}
|
|
53
|
+
export declare const BottomSheetBackdrop: LynxForwardRefComponent<unknown, BottomSheetBackdropProps>;
|
|
54
|
+
export interface BottomSheetContentProps extends SheetContentProps {
|
|
55
|
+
}
|
|
56
|
+
export declare const BottomSheetContent: LynxForwardRefComponent<unknown, BottomSheetContentProps>;
|
|
57
|
+
export interface BottomSheetHandleProps extends SheetHandleProps {
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* @remarks
|
|
61
|
+
* `SheetHandle`은 forwardRef가 아니므로 ref 시그니처는 제공하지 않는다.
|
|
62
|
+
* Lynx drag handler는 `SheetHandle`의 outer view에 붙으므로, 44x44 target
|
|
63
|
+
* area는 `SheetHandle`에 적용하고 보이는 handle은 그 중심에 배치한다.
|
|
64
|
+
*/
|
|
65
|
+
export declare function BottomSheetHandle(props: BottomSheetHandleProps): ReactElement;
|
|
66
|
+
export declare namespace BottomSheetHandle {
|
|
67
|
+
var displayName: string;
|
|
68
|
+
}
|
|
69
|
+
export interface BottomSheetSlotProps extends LynxStyledElementProps {
|
|
70
|
+
}
|
|
71
|
+
export interface BottomSheetHeaderProps extends BottomSheetSlotProps {
|
|
72
|
+
}
|
|
73
|
+
export declare const BottomSheetHeader: LynxForwardRefComponent<unknown, BottomSheetSlotProps>;
|
|
74
|
+
export interface BottomSheetBodyProps extends BottomSheetSlotProps {
|
|
75
|
+
}
|
|
76
|
+
export declare const BottomSheetBody: LynxForwardRefComponent<unknown, BottomSheetBodyProps>;
|
|
77
|
+
export interface BottomSheetFooterProps extends BottomSheetSlotProps {
|
|
78
|
+
}
|
|
79
|
+
export declare const BottomSheetFooter: LynxForwardRefComponent<unknown, BottomSheetSlotProps>;
|
|
80
|
+
export interface BottomSheetTitleProps extends BottomSheetSlotProps {
|
|
81
|
+
}
|
|
82
|
+
export declare const BottomSheetTitle: LynxForwardRefComponent<unknown, BottomSheetSlotProps>;
|
|
83
|
+
export interface BottomSheetDescriptionProps extends BottomSheetSlotProps {
|
|
84
|
+
}
|
|
85
|
+
export declare const BottomSheetDescription: LynxForwardRefComponent<unknown, BottomSheetSlotProps>;
|
|
86
|
+
export {};
|
|
87
|
+
//# sourceMappingURL=BottomSheet.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BottomSheet.d.ts","sourceRoot":"","sources":["../../../src/components/BottomSheet/BottomSheet.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,uBAAuB,EAC7B,MAAM,4CAA4C,CAAC;AAEpD,OAAO,EAML,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,YAAY,EAEjB,KAAK,cAAc,EACpB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAOL,KAAK,yBAAyB,EAC9B,KAAK,eAAe,EACpB,KAAK,YAAY,EAEjB,KAAK,aAAa,EACnB,MAAM,gBAAgB,CAAC;AAIxB,OAAO,KAAK,EACV,kBAAkB,EAClB,sBAAsB,EAGvB,MAAM,aAAa,CAAC;AAIrB,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,yBAAyB,CAC5D,eAAe,CAAC,CAAC,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,CACtC,CAAC;AAmEF,MAAM,MAAM,kBAAkB,GAAG,YAAY,CAAC;AAE9C,MAAM,WAAW,oBACf,SAAQ,uBAAuB,EAC7B,IAAI,CAAC,cAAc,EAAE,MAAM,GAAG,aAAa,GAAG,cAAc,CAAC;IAC/D;;;OAGG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;OAGG;IACH,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;CACxC;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,eAAe,EAAE,uBAAuB,CAAC,YAAY,EAAE,oBAAoB,CAsDpF,CAAC;AAOL,MAAM,WAAW,uBACf,SAAQ,sBAAsB,EAC5B,IAAI,CAAC,kBAAkB,EAAE,SAAS,CAAC;CAAG;AAE1C,eAAO,MAAM,kBAAkB,EAAE,uBAAuB,CAAC,OAAO,EAAE,uBAAuB,CA6BrF,CAAC;AAOL,MAAM,WAAW,0BAA2B,SAAQ,cAAc;CAAG;AAErE;;;;;;;;;GASG;AACH,eAAO,MAAM,qBAAqB,EAAE,uBAAuB,CAAC,OAAO,EAAE,0BAA0B,CACpB,CAAC;AAY5E,MAAM,WAAW,wBAAyB,SAAQ,kBAAkB;CAAG;AAEvE,eAAO,MAAM,mBAAmB,EAAE,uBAAuB,CAAC,OAAO,EAAE,wBAAwB,CAChB,CAAC;AAG5E,MAAM,WAAW,uBAAwB,SAAQ,iBAAiB;CAAG;AAErE,eAAO,MAAM,kBAAkB,EAAE,uBAAuB,CAAC,OAAO,EAAE,uBAAuB,CA2BrF,CAAC;AAOL,MAAM,WAAW,sBAAuB,SAAQ,gBAAgB;CAAG;AAEnE;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,GAAG,YAAY,CAW7E;yBAXe,iBAAiB;;;AAwBjC,MAAM,WAAW,oBAAqB,SAAQ,sBAAsB;CAAG;AA0CvE,MAAM,WAAW,sBAAuB,SAAQ,oBAAoB;CAAG;AACvE,eAAO,MAAM,iBAAiB,wDAA2B,CAAC;AAG1D,MAAM,WAAW,oBAAqB,SAAQ,oBAAoB;CAAG;AACrE,eAAO,MAAM,eAAe,EAAE,uBAAuB,CAAC,OAAO,EAAE,oBAAoB,CAiBjF,CAAC;AAGH,MAAM,WAAW,sBAAuB,SAAQ,oBAAoB;CAAG;AACvE,eAAO,MAAM,iBAAiB,wDAA2B,CAAC;AAG1D,MAAM,WAAW,qBAAsB,SAAQ,oBAAoB;CAAG;AACtE,eAAO,MAAM,gBAAgB,wDAA0B,CAAC;AAGxD,MAAM,WAAW,2BAA4B,SAAQ,oBAAoB;CAAG;AAC5E,eAAO,MAAM,sBAAsB,wDAAgC,CAAC"}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { createSlotRecipeContext } from "../../utils/create-slot-recipe-context.jsx";
|
|
2
|
+
import { useSafeArea } from "../../hooks/useSafeArea.js";
|
|
3
|
+
import clsx from "clsx";
|
|
4
|
+
import { createContext, forwardRef, useCallback, useContext, useMemo, useRef } from "@lynx-js/react";
|
|
5
|
+
import { bottomSheet } from "@seed-design/lynx-css/recipes/bottom-sheet";
|
|
6
|
+
import { bottomSheetHandle } from "@seed-design/lynx-css/recipes/bottom-sheet-handle";
|
|
7
|
+
import { SheetBackdrop, SheetContent, SheetHandle, SheetRoot, SheetView } from "@lynx-js/lynx-ui-sheet";
|
|
8
|
+
//#region src/components/BottomSheet/BottomSheet.tsx
|
|
9
|
+
var { ClassNamesProvider, useClassNames, withContext } = createSlotRecipeContext(bottomSheet);
|
|
10
|
+
var DEFAULT_SNAP_POINTS = ["fit"];
|
|
11
|
+
var SKIP_ANIMATION_TRANSITION = {
|
|
12
|
+
type: "tween",
|
|
13
|
+
duration: 0
|
|
14
|
+
};
|
|
15
|
+
var SEED_SNAP_ANIMATION = {
|
|
16
|
+
type: "spring",
|
|
17
|
+
stiffness: 400,
|
|
18
|
+
damping: 35
|
|
19
|
+
};
|
|
20
|
+
var SEED_ENTER_ANIMATION = {
|
|
21
|
+
type: "spring",
|
|
22
|
+
stiffness: 350,
|
|
23
|
+
damping: 32
|
|
24
|
+
};
|
|
25
|
+
var SEED_EXIT_ANIMATION = {
|
|
26
|
+
type: "spring",
|
|
27
|
+
stiffness: 400,
|
|
28
|
+
damping: 40
|
|
29
|
+
};
|
|
30
|
+
var BottomSheetContext = createContext(null);
|
|
31
|
+
function useBottomSheetContext() {
|
|
32
|
+
const ctx = useContext(BottomSheetContext);
|
|
33
|
+
if (!ctx) throw new Error("BottomSheet compound components must be used within BottomSheetRoot");
|
|
34
|
+
return ctx;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* @platform Lynx — wraps `@lynx-js/lynx-ui-sheet`
|
|
38
|
+
*
|
|
39
|
+
* 웹 대비 미지원 기능:
|
|
40
|
+
* - `lazyMount`, `unmountOnExit`: lynx-ui-sheet의 `forceMount`로 대체
|
|
41
|
+
* - `BottomSheetPositioner`: lynx-ui-sheet의 `SheetView`가 자동 처리하므로 별도 슬롯 없음
|
|
42
|
+
* - `BottomSheetCloseButton`: Tier B (Lynx SVG 지원 후 추가 예정)
|
|
43
|
+
* - `BottomSheetTrigger`의 `asChild`: 미지원 (기본 `<view>`만)
|
|
44
|
+
*/
|
|
45
|
+
var BottomSheetRoot = forwardRef((props, forwardedRef) => {
|
|
46
|
+
const [variantProps, restProps] = bottomSheet.splitVariantProps(props);
|
|
47
|
+
const { open, defaultOpen, onOpenChange, snapPoints, children, ...nativeProps } = restProps;
|
|
48
|
+
const { headerAlign, skipAnimation } = variantProps;
|
|
49
|
+
const internalRef = useRef(null);
|
|
50
|
+
const mergedRef = useCallback((value) => {
|
|
51
|
+
internalRef.current = value;
|
|
52
|
+
if (typeof forwardedRef === "function") forwardedRef(value);
|
|
53
|
+
else if (forwardedRef) forwardedRef.current = value;
|
|
54
|
+
}, [forwardedRef]);
|
|
55
|
+
const classNames = useMemo(() => bottomSheet(variantProps), [headerAlign, skipAnimation]);
|
|
56
|
+
const shouldSkipAnimation = skipAnimation === true;
|
|
57
|
+
const context = useMemo(() => ({
|
|
58
|
+
rootRef: internalRef,
|
|
59
|
+
options: { skipAnimation: shouldSkipAnimation }
|
|
60
|
+
}), [shouldSkipAnimation]);
|
|
61
|
+
return <BottomSheetContext.Provider value={context}>
|
|
62
|
+
<ClassNamesProvider value={classNames}>
|
|
63
|
+
<SheetRoot ref={mergedRef} show={open} defaultShow={defaultOpen} onShowChange={onOpenChange} snapPoints={snapPoints ?? DEFAULT_SNAP_POINTS} {...nativeProps}>
|
|
64
|
+
{children}
|
|
65
|
+
</SheetRoot>
|
|
66
|
+
</ClassNamesProvider>
|
|
67
|
+
</BottomSheetContext.Provider>;
|
|
68
|
+
});
|
|
69
|
+
BottomSheetRoot.displayName = "BottomSheetRoot";
|
|
70
|
+
var BottomSheetTrigger = forwardRef((props, ref) => {
|
|
71
|
+
const { children, className, style, bindtap: userBindtap } = props;
|
|
72
|
+
const { rootRef, options } = useBottomSheetContext();
|
|
73
|
+
const handlers = { bindtap: (event, instance) => {
|
|
74
|
+
if (options.skipAnimation) rootRef.current?.open({ animate: false });
|
|
75
|
+
else rootRef.current?.open();
|
|
76
|
+
userBindtap?.(event, instance);
|
|
77
|
+
} };
|
|
78
|
+
return <view {...ref ? { ref } : {}} {...handlers} className={className} style={style}>
|
|
79
|
+
{children}
|
|
80
|
+
</view>;
|
|
81
|
+
});
|
|
82
|
+
BottomSheetTrigger.displayName = "BottomSheetTrigger";
|
|
83
|
+
/**
|
|
84
|
+
* Backdrop/Content는 반드시 `BottomSheetPositioner` 안에 배치해야 한다.
|
|
85
|
+
*
|
|
86
|
+
* `SheetView`는 `mounted || forceMount` 조건으로 자식을 gating하므로 시트가 처음
|
|
87
|
+
* 열리기 전까지는 SheetBackdrop/SheetContent가 마운트되지 않아 motion value
|
|
88
|
+
* 초기화 레이스를 피할 수 있다. Trigger는 이 컴포넌트 밖에 두어야 탭 가능하다.
|
|
89
|
+
*
|
|
90
|
+
* recipe의 `positioner` slot className을 자동 적용해 `position: fixed` + 전체
|
|
91
|
+
* 뷰포트 커버 레이아웃을 보장한다.
|
|
92
|
+
*/
|
|
93
|
+
var BottomSheetPositioner = withContext(SheetView, "positioner");
|
|
94
|
+
BottomSheetPositioner.displayName = "BottomSheetPositioner";
|
|
95
|
+
var BottomSheetBackdrop = withContext(SheetBackdrop, "backdrop");
|
|
96
|
+
BottomSheetBackdrop.displayName = "BottomSheetBackdrop";
|
|
97
|
+
var BottomSheetContent = forwardRef((props, ref) => {
|
|
98
|
+
const { className, innerStyle, snapAnimation, enterAnimation, exitAnimation, ...restProps } = props;
|
|
99
|
+
const classNames = useClassNames();
|
|
100
|
+
const { options } = useBottomSheetContext();
|
|
101
|
+
const { safeAreaInsetBottom } = useSafeArea();
|
|
102
|
+
const defaultAnimation = options.skipAnimation ? SKIP_ANIMATION_TRANSITION : void 0;
|
|
103
|
+
return <SheetContent {...ref ? { ref } : {}} {...restProps} className={clsx(classNames.content, className)} innerStyle={{
|
|
104
|
+
display: "flex",
|
|
105
|
+
flexDirection: "column",
|
|
106
|
+
minHeight: "0",
|
|
107
|
+
paddingBottom: safeAreaInsetBottom,
|
|
108
|
+
...innerStyle
|
|
109
|
+
}} snapAnimation={snapAnimation ?? defaultAnimation ?? SEED_SNAP_ANIMATION} enterAnimation={enterAnimation ?? defaultAnimation ?? SEED_ENTER_ANIMATION} exitAnimation={exitAnimation ?? defaultAnimation ?? SEED_EXIT_ANIMATION} />;
|
|
110
|
+
});
|
|
111
|
+
BottomSheetContent.displayName = "BottomSheetContent";
|
|
112
|
+
/**
|
|
113
|
+
* @remarks
|
|
114
|
+
* `SheetHandle`은 forwardRef가 아니므로 ref 시그니처는 제공하지 않는다.
|
|
115
|
+
* Lynx drag handler는 `SheetHandle`의 outer view에 붙으므로, 44x44 target
|
|
116
|
+
* area는 `SheetHandle`에 적용하고 보이는 handle은 그 중심에 배치한다.
|
|
117
|
+
*/
|
|
118
|
+
function BottomSheetHandle(props) {
|
|
119
|
+
const { children, className, style, ...rest } = props;
|
|
120
|
+
const classNames = bottomSheetHandle();
|
|
121
|
+
return <SheetHandle className={classNames.touchArea} {...rest}>
|
|
122
|
+
<view className={clsx(classNames.root, className)} style={style}>
|
|
123
|
+
{children}
|
|
124
|
+
</view>
|
|
125
|
+
</SheetHandle>;
|
|
126
|
+
}
|
|
127
|
+
BottomSheetHandle.displayName = "BottomSheetHandle";
|
|
128
|
+
function createViewSlot(slotName) {
|
|
129
|
+
return forwardRef((props, ref) => {
|
|
130
|
+
const { children, className, style } = props;
|
|
131
|
+
const classNames = useClassNames();
|
|
132
|
+
return <view {...ref ? { ref } : {}} className={clsx(classNames[slotName], className)} style={style}>
|
|
133
|
+
{children}
|
|
134
|
+
</view>;
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
function createTextSlot(slotName) {
|
|
138
|
+
return forwardRef((props, ref) => {
|
|
139
|
+
const { children, className, style } = props;
|
|
140
|
+
const classNames = useClassNames();
|
|
141
|
+
return <text {...ref ? { ref } : {}} className={clsx(classNames[slotName], className)} style={style}>
|
|
142
|
+
{children}
|
|
143
|
+
</text>;
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
var BottomSheetHeader = createViewSlot("header");
|
|
147
|
+
BottomSheetHeader.displayName = "BottomSheetHeader";
|
|
148
|
+
var BottomSheetBody = forwardRef((props, ref) => {
|
|
149
|
+
const { children, className, style } = props;
|
|
150
|
+
const classNames = useClassNames();
|
|
151
|
+
return <scroll-view {...ref ? { ref } : {}} scroll-y className={clsx(classNames.body, className)} style={style}>
|
|
152
|
+
{children}
|
|
153
|
+
</scroll-view>;
|
|
154
|
+
});
|
|
155
|
+
BottomSheetBody.displayName = "BottomSheetBody";
|
|
156
|
+
var BottomSheetFooter = createViewSlot("footer");
|
|
157
|
+
BottomSheetFooter.displayName = "BottomSheetFooter";
|
|
158
|
+
var BottomSheetTitle = createTextSlot("title");
|
|
159
|
+
BottomSheetTitle.displayName = "BottomSheetTitle";
|
|
160
|
+
var BottomSheetDescription = createTextSlot("description");
|
|
161
|
+
BottomSheetDescription.displayName = "BottomSheetDescription";
|
|
162
|
+
//#endregion
|
|
163
|
+
export { BottomSheetBackdrop, BottomSheetBody, BottomSheetContent, BottomSheetDescription, BottomSheetFooter, BottomSheetHandle, BottomSheetHeader, BottomSheetPositioner, BottomSheetRoot, BottomSheetTitle, BottomSheetTrigger };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { BottomSheetBackdrop as Backdrop, BottomSheetBody as Body, BottomSheetContent as Content, BottomSheetDescription as Description, BottomSheetFooter as Footer, BottomSheetHandle as Handle, BottomSheetHeader as Header, BottomSheetPositioner as Positioner, BottomSheetRoot as Root, BottomSheetTitle as Title, BottomSheetTrigger as Trigger, type BottomSheetBackdropProps as BackdropProps, type BottomSheetBodyProps as BodyProps, type BottomSheetContentProps as ContentProps, type BottomSheetDescriptionProps as DescriptionProps, type BottomSheetFooterProps as FooterProps, type BottomSheetHandleProps as HandleProps, type BottomSheetHeaderProps as HeaderProps, type BottomSheetPositionerProps as PositionerProps, type BottomSheetRootProps as RootProps, type BottomSheetTitleProps as TitleProps, type BottomSheetTriggerProps as TriggerProps, } from './BottomSheet';
|
|
2
|
+
//# sourceMappingURL=BottomSheet.namespace.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BottomSheet.namespace.d.ts","sourceRoot":"","sources":["../../../src/components/BottomSheet/BottomSheet.namespace.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,IAAI,QAAQ,EAC/B,eAAe,IAAI,IAAI,EACvB,kBAAkB,IAAI,OAAO,EAC7B,sBAAsB,IAAI,WAAW,EACrC,iBAAiB,IAAI,MAAM,EAC3B,iBAAiB,IAAI,MAAM,EAC3B,iBAAiB,IAAI,MAAM,EAC3B,qBAAqB,IAAI,UAAU,EACnC,eAAe,IAAI,IAAI,EACvB,gBAAgB,IAAI,KAAK,EACzB,kBAAkB,IAAI,OAAO,EAC7B,KAAK,wBAAwB,IAAI,aAAa,EAC9C,KAAK,oBAAoB,IAAI,SAAS,EACtC,KAAK,uBAAuB,IAAI,YAAY,EAC5C,KAAK,2BAA2B,IAAI,gBAAgB,EACpD,KAAK,sBAAsB,IAAI,WAAW,EAC1C,KAAK,sBAAsB,IAAI,WAAW,EAC1C,KAAK,sBAAsB,IAAI,WAAW,EAC1C,KAAK,0BAA0B,IAAI,eAAe,EAClD,KAAK,oBAAoB,IAAI,SAAS,EACtC,KAAK,qBAAqB,IAAI,UAAU,EACxC,KAAK,uBAAuB,IAAI,YAAY,GAC7C,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { __exportAll } from "../../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { BottomSheetBackdrop, BottomSheetBody, BottomSheetContent, BottomSheetDescription, BottomSheetFooter, BottomSheetHandle, BottomSheetHeader, BottomSheetPositioner, BottomSheetRoot, BottomSheetTitle, BottomSheetTrigger } from "./BottomSheet.jsx";
|
|
3
|
+
//#region src/components/BottomSheet/BottomSheet.namespace.ts
|
|
4
|
+
var BottomSheet_namespace_exports = /* @__PURE__ */ __exportAll({
|
|
5
|
+
Backdrop: () => BottomSheetBackdrop,
|
|
6
|
+
Body: () => BottomSheetBody,
|
|
7
|
+
Content: () => BottomSheetContent,
|
|
8
|
+
Description: () => BottomSheetDescription,
|
|
9
|
+
Footer: () => BottomSheetFooter,
|
|
10
|
+
Handle: () => BottomSheetHandle,
|
|
11
|
+
Header: () => BottomSheetHeader,
|
|
12
|
+
Positioner: () => BottomSheetPositioner,
|
|
13
|
+
Root: () => BottomSheetRoot,
|
|
14
|
+
Title: () => BottomSheetTitle,
|
|
15
|
+
Trigger: () => BottomSheetTrigger
|
|
16
|
+
});
|
|
17
|
+
//#endregion
|
|
18
|
+
export { BottomSheet_namespace_exports };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { BottomSheetBackdrop, type BottomSheetBackdropProps, BottomSheetBody, type BottomSheetBodyProps, BottomSheetContent, type BottomSheetContentProps, BottomSheetDescription, type BottomSheetDescriptionProps, BottomSheetFooter, type BottomSheetFooterProps, BottomSheetHandle, type BottomSheetHandleProps, BottomSheetHeader, type BottomSheetHeaderProps, BottomSheetPositioner, type BottomSheetPositionerProps, BottomSheetRoot, type BottomSheetRootProps, type BottomSheetRootRef, BottomSheetTitle, type BottomSheetTitleProps, BottomSheetTrigger, type BottomSheetTriggerProps, } from './BottomSheet';
|
|
2
|
+
export * as BottomSheet from './BottomSheet.namespace';
|
|
3
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/BottomSheet/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,KAAK,wBAAwB,EAC7B,eAAe,EACf,KAAK,oBAAoB,EACzB,kBAAkB,EAClB,KAAK,uBAAuB,EAC5B,sBAAsB,EACtB,KAAK,2BAA2B,EAChC,iBAAiB,EACjB,KAAK,sBAAsB,EAC3B,iBAAiB,EACjB,KAAK,sBAAsB,EAC3B,iBAAiB,EACjB,KAAK,sBAAsB,EAC3B,qBAAqB,EACrB,KAAK,0BAA0B,EAC/B,eAAe,EACf,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,EACvB,gBAAgB,EAChB,KAAK,qBAAqB,EAC1B,kBAAkB,EAClB,KAAK,uBAAuB,GAC7B,MAAM,eAAe,CAAC;AAEvB,OAAO,KAAK,WAAW,MAAM,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { LynxPressableProps, LynxStyledElementProps } from '../../types';
|
|
2
|
+
import { StyleProps } from '../../utils/styled';
|
|
3
|
+
import * as React from "@lynx-js/react";
|
|
4
|
+
/**
|
|
5
|
+
* @platform Lynx
|
|
6
|
+
*
|
|
7
|
+
* `Box`는 SEED style prop을 native `<view>`의 object style로 변환하는 편의
|
|
8
|
+
* primitive입니다. 많은 항목을 반복 렌더링하는 화면에서는 primitive 컴포넌트
|
|
9
|
+
* 렌더링과 style prop 해석 비용이 누적될 수 있습니다. 앱 코드에서는 native
|
|
10
|
+
* `<view>`/`<text>`와 Tailwind utility className을 우선 고려하세요. 패키지
|
|
11
|
+
* 컴포넌트 내부에서는 native tag와 recipe className을 사용하고, inline style은
|
|
12
|
+
* 런타임 값이 필요한 경우에만 제한적으로 사용합니다.
|
|
13
|
+
*/
|
|
14
|
+
export interface BoxProps extends StyleProps, LynxStyledElementProps, LynxPressableProps {
|
|
15
|
+
bindtouchstart?: () => void;
|
|
16
|
+
bindtouchend?: () => void;
|
|
17
|
+
bindtouchcancel?: () => void;
|
|
18
|
+
}
|
|
19
|
+
export declare const Box: React.ForwardRefExoticComponent<BoxProps & React.RefAttributes<unknown>>;
|
|
20
|
+
//# sourceMappingURL=Box.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Box.d.ts","sourceRoot":"","sources":["../../../src/components/Box/Box.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAC;AAExC,OAAO,KAAK,EAAE,kBAAkB,EAAE,sBAAsB,EAAe,MAAM,aAAa,CAAC;AAC3F,OAAO,EAAiB,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEpE;;;;;;;;;GASG;AACH,MAAM,WAAW,QAAS,SAAQ,UAAU,EAAE,sBAAsB,EAAE,kBAAkB;IACtF,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAC5B,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,eAAe,CAAC,EAAE,MAAM,IAAI,CAAC;CAC9B;AAED,eAAO,MAAM,GAAG,0EAcd,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { useStyleProps } from "../../utils/styled.js";
|
|
2
|
+
import clsx from "clsx";
|
|
3
|
+
import * as React from "@lynx-js/react";
|
|
4
|
+
//#region src/components/Box/Box.tsx
|
|
5
|
+
var Box = React.forwardRef((props, ref) => {
|
|
6
|
+
const { style, restProps } = useStyleProps(props);
|
|
7
|
+
const { children, className, ...nativeProps } = restProps;
|
|
8
|
+
return <view {...ref ? { ref } : {}} {...nativeProps} className={clsx(className)} style={style}>
|
|
9
|
+
{children}
|
|
10
|
+
</view>;
|
|
11
|
+
});
|
|
12
|
+
Box.displayName = "Box";
|
|
13
|
+
//#endregion
|
|
14
|
+
export { Box };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Box/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,KAAK,QAAQ,EAAE,MAAM,OAAO,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { ReactElement } from '@lynx-js/react';
|
|
2
|
+
import { CheckboxVariantProps } from '@seed-design/lynx-css/recipes/checkbox';
|
|
3
|
+
import { CheckmarkVariantProps } from '@seed-design/lynx-css/recipes/checkmark';
|
|
4
|
+
import { LynxIconElementProps, LynxStyledElementProps } from '../../types';
|
|
5
|
+
import * as React from "@lynx-js/react";
|
|
6
|
+
export interface CheckboxRootProps extends CheckboxVariantProps, Omit<CheckmarkVariantProps, "size" | "checked" | "disabled" | "indeterminate">, LynxStyledElementProps {
|
|
7
|
+
checked?: boolean;
|
|
8
|
+
defaultChecked?: boolean;
|
|
9
|
+
indeterminate?: boolean;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
onCheckedChange?: (checked: boolean) => void;
|
|
12
|
+
}
|
|
13
|
+
export declare const CheckboxRoot: React.ForwardRefExoticComponent<CheckboxRootProps & React.RefAttributes<unknown>>;
|
|
14
|
+
export interface CheckboxControlProps extends Pick<CheckmarkVariantProps, "tone" | "variant" | "size">, LynxStyledElementProps {
|
|
15
|
+
}
|
|
16
|
+
export declare const CheckboxControl: React.ForwardRefExoticComponent<CheckboxControlProps & React.RefAttributes<unknown>>;
|
|
17
|
+
export interface CheckboxIndicatorProps extends Pick<LynxStyledElementProps, "className" | "style"> {
|
|
18
|
+
/** Icon rendered when neither checked nor indeterminate. Optional. */
|
|
19
|
+
unchecked?: ReactElement<LynxIconElementProps>;
|
|
20
|
+
/** Icon rendered when `checked=true` and `indeterminate=false`. */
|
|
21
|
+
checked: ReactElement<LynxIconElementProps>;
|
|
22
|
+
/** Icon rendered when `indeterminate=true`. */
|
|
23
|
+
indeterminate?: ReactElement<LynxIconElementProps>;
|
|
24
|
+
}
|
|
25
|
+
export declare function CheckboxIndicator(props: CheckboxIndicatorProps): React.JSX.Element | null;
|
|
26
|
+
export declare namespace CheckboxIndicator {
|
|
27
|
+
var displayName: string;
|
|
28
|
+
}
|
|
29
|
+
export interface CheckboxLabelProps extends LynxStyledElementProps {
|
|
30
|
+
}
|
|
31
|
+
export declare const CheckboxLabel: React.ForwardRefExoticComponent<CheckboxLabelProps & React.RefAttributes<unknown>>;
|
|
32
|
+
export interface CheckboxGroupProps extends LynxStyledElementProps {
|
|
33
|
+
}
|
|
34
|
+
export declare const CheckboxGroup: React.ForwardRefExoticComponent<CheckboxGroupProps & React.RefAttributes<unknown>>;
|
|
35
|
+
//# sourceMappingURL=Checkbox.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Checkbox.d.ts","sourceRoot":"","sources":["../../../src/components/Checkbox/Checkbox.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAkB,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAInE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wCAAwC,CAAC;AAEnF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AAKrF,OAAO,KAAK,EACV,oBAAoB,EACpB,sBAAsB,EAGvB,MAAM,aAAa,CAAC;AAuDrB,MAAM,WAAW,iBACf,SAAQ,oBAAoB,EAC1B,IAAI,CAAC,qBAAqB,EAAE,MAAM,GAAG,SAAS,GAAG,UAAU,GAAG,eAAe,CAAC,EAC9E,sBAAsB;IACxB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,eAAe,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;CAC9C;AAED,eAAO,MAAM,YAAY,mFA8DvB,CAAC;AAKH,MAAM,WAAW,oBACf,SAAQ,IAAI,CAAC,qBAAqB,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAAC,EAC9D,sBAAsB;CAAG;AAE7B,eAAO,MAAM,eAAe,sFA2B1B,CAAC;AAKH,MAAM,WAAW,sBACf,SAAQ,IAAI,CAAC,sBAAsB,EAAE,WAAW,GAAG,OAAO,CAAC;IAC3D,sEAAsE;IACtE,SAAS,CAAC,EAAE,YAAY,CAAC,oBAAoB,CAAC,CAAC;IAC/C,mEAAmE;IACnE,OAAO,EAAE,YAAY,CAAC,oBAAoB,CAAC,CAAC;IAC5C,+CAA+C;IAC/C,aAAa,CAAC,EAAE,YAAY,CAAC,oBAAoB,CAAC,CAAC;CACpD;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,4BAwC9D;yBAxCe,iBAAiB;;;AA6CjC,MAAM,WAAW,kBAAmB,SAAQ,sBAAsB;CAAG;AAErE,eAAO,MAAM,aAAa,oFAiBxB,CAAC;AAKH,MAAM,WAAW,kBAAmB,SAAQ,sBAAsB;CAAG;AAErE,eAAO,MAAM,aAAa,oFAaxB,CAAC"}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { usePressTap } from "../../hooks/usePressTap.js";
|
|
2
|
+
import { InternalIcon } from "../Icon/Icon.jsx";
|
|
3
|
+
import { useControllableState } from "../../hooks/useControllableState.js";
|
|
4
|
+
import { splitMultipleVariantsProps } from "../../utils/split-multiple-variants-props.js";
|
|
5
|
+
import clsx from "clsx";
|
|
6
|
+
import * as React from "@lynx-js/react";
|
|
7
|
+
import { isValidElement } from "@lynx-js/react";
|
|
8
|
+
import { checkbox } from "@seed-design/lynx-css/recipes/checkbox";
|
|
9
|
+
import { checkmark } from "@seed-design/lynx-css/recipes/checkmark";
|
|
10
|
+
import { checkboxGroup } from "@seed-design/lynx-css/recipes/checkbox-group";
|
|
11
|
+
//#region src/components/Checkbox/Checkbox.tsx
|
|
12
|
+
var CheckboxContext = React.createContext(null);
|
|
13
|
+
function useCheckboxContext(consumer) {
|
|
14
|
+
const ctx = React.useContext(CheckboxContext);
|
|
15
|
+
if (!ctx) throw new Error(`<${consumer}/> must be rendered inside <CheckboxRoot/>.`);
|
|
16
|
+
return ctx;
|
|
17
|
+
}
|
|
18
|
+
var CheckmarkControlContext = React.createContext(null);
|
|
19
|
+
function useCheckmarkControlContext(consumer) {
|
|
20
|
+
const ctx = React.useContext(CheckmarkControlContext);
|
|
21
|
+
if (!ctx) throw new Error(`<${consumer}/> must be rendered inside <CheckboxControl/>.`);
|
|
22
|
+
return ctx;
|
|
23
|
+
}
|
|
24
|
+
var CheckboxRoot = React.forwardRef((props, ref) => {
|
|
25
|
+
const { children, className, checked: checkedProp, defaultChecked = false, indeterminate = false, disabled = false, onCheckedChange, ...restProps } = props;
|
|
26
|
+
const [{ checkbox: checkboxVariantProps, checkmark: checkmarkVariantProps }, nativeProps] = splitMultipleVariantsProps(restProps, {
|
|
27
|
+
checkbox,
|
|
28
|
+
checkmark
|
|
29
|
+
});
|
|
30
|
+
const [checked, setChecked] = useControllableState({
|
|
31
|
+
value: checkedProp,
|
|
32
|
+
defaultValue: defaultChecked,
|
|
33
|
+
onChange: onCheckedChange
|
|
34
|
+
});
|
|
35
|
+
const toggle = React.useCallback(() => setChecked(!checked), [checked, setChecked]);
|
|
36
|
+
const { pressed, ...pressHandlers } = usePressTap({
|
|
37
|
+
disabled,
|
|
38
|
+
onTap: toggle
|
|
39
|
+
});
|
|
40
|
+
const rootClassName = checkbox({
|
|
41
|
+
...checkboxVariantProps,
|
|
42
|
+
disabled
|
|
43
|
+
}).root;
|
|
44
|
+
const contextValue = React.useMemo(() => ({
|
|
45
|
+
checked,
|
|
46
|
+
indeterminate,
|
|
47
|
+
disabled,
|
|
48
|
+
pressed,
|
|
49
|
+
checkboxVariantProps,
|
|
50
|
+
checkmarkVariantProps,
|
|
51
|
+
toggle
|
|
52
|
+
}), [
|
|
53
|
+
checked,
|
|
54
|
+
indeterminate,
|
|
55
|
+
disabled,
|
|
56
|
+
pressed,
|
|
57
|
+
checkboxVariantProps,
|
|
58
|
+
checkmarkVariantProps,
|
|
59
|
+
toggle
|
|
60
|
+
]);
|
|
61
|
+
return <CheckboxContext.Provider value={contextValue}>
|
|
62
|
+
<view {...ref ? { ref } : {}} className={clsx(rootClassName, className)} {...pressHandlers} {...nativeProps}>
|
|
63
|
+
{children}
|
|
64
|
+
</view>
|
|
65
|
+
</CheckboxContext.Provider>;
|
|
66
|
+
});
|
|
67
|
+
CheckboxRoot.displayName = "CheckboxRoot";
|
|
68
|
+
var CheckboxControl = React.forwardRef((props, ref) => {
|
|
69
|
+
const [variantProps, restProps] = checkmark.splitVariantProps(props);
|
|
70
|
+
const { children, className, ...nativeProps } = restProps;
|
|
71
|
+
const context = useCheckboxContext("CheckboxControl");
|
|
72
|
+
const checkmarkVariantProps = {
|
|
73
|
+
...context.checkmarkVariantProps,
|
|
74
|
+
...variantProps,
|
|
75
|
+
checked: context.checked,
|
|
76
|
+
disabled: context.disabled,
|
|
77
|
+
indeterminate: context.indeterminate,
|
|
78
|
+
pressed: context.pressed
|
|
79
|
+
};
|
|
80
|
+
const classes = checkmark(checkmarkVariantProps);
|
|
81
|
+
return <CheckmarkControlContext.Provider value={{
|
|
82
|
+
iconClassName: classes.icon,
|
|
83
|
+
checkmarkVariantProps
|
|
84
|
+
}}>
|
|
85
|
+
<view {...ref ? { ref } : {}} className={clsx(classes.root, className)} {...nativeProps}>
|
|
86
|
+
{children}
|
|
87
|
+
</view>
|
|
88
|
+
</CheckmarkControlContext.Provider>;
|
|
89
|
+
});
|
|
90
|
+
CheckboxControl.displayName = "CheckboxControl";
|
|
91
|
+
function CheckboxIndicator(props) {
|
|
92
|
+
const { unchecked, checked: checkedIcon, indeterminate: indeterminateIcon, className, style } = props;
|
|
93
|
+
const context = useCheckboxContext("CheckboxIndicator");
|
|
94
|
+
const { iconClassName, checkmarkVariantProps } = useCheckmarkControlContext("CheckboxIndicator");
|
|
95
|
+
if (process.env.NODE_ENV !== "production" && context.indeterminate && !indeterminateIcon) console.warn("[seed-design] CheckboxIndicator: `indeterminate` prop must be provided when the checkbox is in an indeterminate state.");
|
|
96
|
+
const icon = context.indeterminate ? indeterminateIcon : context.checked ? checkedIcon : unchecked;
|
|
97
|
+
if (!icon || !isValidElement(icon)) return null;
|
|
98
|
+
return <InternalIcon icon={icon} className={clsx(iconClassName, className)} style={style} deps={[
|
|
99
|
+
context.checked,
|
|
100
|
+
context.indeterminate,
|
|
101
|
+
context.disabled,
|
|
102
|
+
context.pressed,
|
|
103
|
+
checkmarkVariantProps.tone,
|
|
104
|
+
checkmarkVariantProps.variant,
|
|
105
|
+
checkmarkVariantProps.size
|
|
106
|
+
]} />;
|
|
107
|
+
}
|
|
108
|
+
CheckboxIndicator.displayName = "CheckboxIndicator";
|
|
109
|
+
var CheckboxLabel = React.forwardRef((props, ref) => {
|
|
110
|
+
const { children, className, ...nativeProps } = props;
|
|
111
|
+
const context = useCheckboxContext("CheckboxLabel");
|
|
112
|
+
const labelClassName = checkbox({
|
|
113
|
+
...context.checkboxVariantProps,
|
|
114
|
+
disabled: context.disabled
|
|
115
|
+
}).label;
|
|
116
|
+
return <text {...ref ? { ref } : {}} className={clsx(labelClassName, className)} {...nativeProps}>
|
|
117
|
+
{children}
|
|
118
|
+
</text>;
|
|
119
|
+
});
|
|
120
|
+
CheckboxLabel.displayName = "CheckboxLabel";
|
|
121
|
+
var CheckboxGroup = React.forwardRef((props, ref) => {
|
|
122
|
+
const { children, className, ...nativeProps } = props;
|
|
123
|
+
const classes = checkboxGroup();
|
|
124
|
+
return <view {...ref ? { ref } : {}} className={clsx(classes.root, className)} {...nativeProps}>
|
|
125
|
+
{children}
|
|
126
|
+
</view>;
|
|
127
|
+
});
|
|
128
|
+
CheckboxGroup.displayName = "CheckboxGroup";
|
|
129
|
+
//#endregion
|
|
130
|
+
export { CheckboxControl, CheckboxGroup, CheckboxIndicator, CheckboxLabel, CheckboxRoot };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { CheckboxControl as Control, CheckboxGroup as Group, CheckboxIndicator as Indicator, CheckboxLabel as Label, CheckboxRoot as Root, type CheckboxControlProps as ControlProps, type CheckboxGroupProps as GroupProps, type CheckboxIndicatorProps as IndicatorProps, type CheckboxLabelProps as LabelProps, type CheckboxRootProps as RootProps, } from './Checkbox';
|
|
2
|
+
//# sourceMappingURL=Checkbox.namespace.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Checkbox.namespace.d.ts","sourceRoot":"","sources":["../../../src/components/Checkbox/Checkbox.namespace.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,IAAI,OAAO,EAC1B,aAAa,IAAI,KAAK,EACtB,iBAAiB,IAAI,SAAS,EAC9B,aAAa,IAAI,KAAK,EACtB,YAAY,IAAI,IAAI,EACpB,KAAK,oBAAoB,IAAI,YAAY,EACzC,KAAK,kBAAkB,IAAI,UAAU,EACrC,KAAK,sBAAsB,IAAI,cAAc,EAC7C,KAAK,kBAAkB,IAAI,UAAU,EACrC,KAAK,iBAAiB,IAAI,SAAS,GACpC,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { __exportAll } from "../../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { CheckboxControl, CheckboxGroup, CheckboxIndicator, CheckboxLabel, CheckboxRoot } from "./Checkbox.jsx";
|
|
3
|
+
//#region src/components/Checkbox/Checkbox.namespace.ts
|
|
4
|
+
var Checkbox_namespace_exports = /* @__PURE__ */ __exportAll({
|
|
5
|
+
Control: () => CheckboxControl,
|
|
6
|
+
Group: () => CheckboxGroup,
|
|
7
|
+
Indicator: () => CheckboxIndicator,
|
|
8
|
+
Label: () => CheckboxLabel,
|
|
9
|
+
Root: () => CheckboxRoot
|
|
10
|
+
});
|
|
11
|
+
//#endregion
|
|
12
|
+
export { Checkbox_namespace_exports };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { CheckboxRoot, CheckboxControl, CheckboxIndicator, CheckboxLabel, CheckboxGroup, type CheckboxRootProps, type CheckboxControlProps, type CheckboxIndicatorProps, type CheckboxLabelProps, type CheckboxGroupProps, } from './Checkbox';
|
|
2
|
+
export * as Checkbox from './Checkbox.namespace';
|
|
3
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Checkbox/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,eAAe,EACf,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,KAAK,iBAAiB,EACtB,KAAK,oBAAoB,EACzB,KAAK,sBAAsB,EAC3B,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,GACxB,MAAM,YAAY,CAAC;AAEpB,OAAO,KAAK,QAAQ,MAAM,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { DependencyList, ReactElement } from '@lynx-js/react';
|
|
2
|
+
import { LynxIconElementProps, LynxStyledElementProps } from '../../types';
|
|
3
|
+
import { StyleProps } from '../../utils/styled';
|
|
4
|
+
import * as React from "@lynx-js/react";
|
|
5
|
+
export type IconSlotName = "icon" | "prefixIcon" | "suffixIcon";
|
|
6
|
+
interface IconSlotContextValue {
|
|
7
|
+
classNames?: Partial<Record<IconSlotName, string>>;
|
|
8
|
+
deps?: DependencyList;
|
|
9
|
+
}
|
|
10
|
+
export declare function IconRequired({ children, enabled, }: {
|
|
11
|
+
children: React.ReactNode;
|
|
12
|
+
enabled: boolean;
|
|
13
|
+
}): React.JSX.Element;
|
|
14
|
+
export declare function IconSlotProvider({ value, children, }: {
|
|
15
|
+
value: IconSlotContextValue;
|
|
16
|
+
children: React.ReactNode;
|
|
17
|
+
}): React.JSX.Element;
|
|
18
|
+
export declare function getIconSlotName(node: React.ReactNode): IconSlotName | null;
|
|
19
|
+
export interface IconProps extends LynxStyledElementProps {
|
|
20
|
+
icon: ReactElement<LynxIconElementProps>;
|
|
21
|
+
size?: StyleProps["height"] | number;
|
|
22
|
+
color?: StyleProps["color"];
|
|
23
|
+
}
|
|
24
|
+
export interface PrefixIconProps extends IconProps {
|
|
25
|
+
}
|
|
26
|
+
export interface SuffixIconProps extends IconProps {
|
|
27
|
+
}
|
|
28
|
+
export declare const Icon: React.ForwardRefExoticComponent<IconProps & React.RefAttributes<unknown>>;
|
|
29
|
+
export declare const PrefixIcon: React.ForwardRefExoticComponent<PrefixIconProps & React.RefAttributes<unknown>>;
|
|
30
|
+
export declare const SuffixIcon: React.ForwardRefExoticComponent<SuffixIconProps & React.RefAttributes<unknown>>;
|
|
31
|
+
export interface InternalIconProps extends LynxStyledElementProps {
|
|
32
|
+
icon: ReactElement<LynxIconElementProps>;
|
|
33
|
+
deps?: DependencyList;
|
|
34
|
+
}
|
|
35
|
+
export declare const InternalIcon: React.ForwardRefExoticComponent<InternalIconProps & React.RefAttributes<unknown>>;
|
|
36
|
+
export {};
|
|
37
|
+
//# sourceMappingURL=Icon.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Icon.d.ts","sourceRoot":"","sources":["../../../src/components/Icon/Icon.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAGL,KAAK,cAAc,EACnB,KAAK,YAAY,EAClB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,KAAK,EAAE,oBAAoB,EAAE,sBAAsB,EAAe,MAAM,aAAa,CAAC;AAC7F,OAAO,EAAgC,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEnF,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,YAAY,GAAG,YAAY,CAAC;AAIhE,UAAU,oBAAoB;IAC5B,UAAU,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC,CAAC;IACnD,IAAI,CAAC,EAAE,cAAc,CAAC;CACvB;AAWD,wBAAgB,YAAY,CAAC,EAC3B,QAAQ,EACR,OAAO,GACR,EAAE;IACD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,OAAO,EAAE,OAAO,CAAC;CAClB,qBAyCA;AAED,wBAAgB,gBAAgB,CAAC,EAC/B,KAAK,EACL,QAAQ,GACT,EAAE;IACD,KAAK,EAAE,oBAAoB,CAAC;IAC5B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,qBAEA;AAUD,wBAAgB,eAAe,CAAC,IAAI,EAAE,KAAK,CAAC,SAAS,GAAG,YAAY,GAAG,IAAI,CAI1E;AAID,MAAM,WAAW,SAAU,SAAQ,sBAAsB;IACvD,IAAI,EAAE,YAAY,CAAC,oBAAoB,CAAC,CAAC;IACzC,IAAI,CAAC,EAAE,UAAU,CAAC,QAAQ,CAAC,GAAG,MAAM,CAAC;IACrC,KAAK,CAAC,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC;CAC7B;AAED,MAAM,WAAW,eAAgB,SAAQ,SAAS;CAAG;AAErD,MAAM,WAAW,eAAgB,SAAQ,SAAS;CAAG;AAqGrD,eAAO,MAAM,IAAI,2EAA8D,CAAC;AAChF,eAAO,MAAM,UAAU,iFAItB,CAAC;AACF,eAAO,MAAM,UAAU,iFAItB,CAAC;AAIF,MAAM,WAAW,iBAAkB,SAAQ,sBAAsB;IAC/D,IAAI,EAAE,YAAY,CAAC,oBAAoB,CAAC,CAAC;IACzC,IAAI,CAAC,EAAE,cAAc,CAAC;CACvB;AAED,eAAO,MAAM,YAAY,mFA2BvB,CAAC"}
|