@cdx-ui/components 0.0.1-alpha.2 → 0.0.1-alpha.21
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/README.md +2 -2
- package/lib/commonjs/components/Avatar/index.js +156 -0
- package/lib/commonjs/components/Avatar/index.js.map +1 -0
- package/lib/commonjs/components/Avatar/styles.js +80 -0
- package/lib/commonjs/components/Avatar/styles.js.map +1 -0
- package/lib/commonjs/components/BottomSheet/index.js +248 -0
- package/lib/commonjs/components/BottomSheet/index.js.map +1 -0
- package/lib/commonjs/components/BottomSheet/styles.js +61 -0
- package/lib/commonjs/components/BottomSheet/styles.js.map +1 -0
- package/lib/commonjs/components/Box/Box.js +1 -0
- package/lib/commonjs/components/Box/Box.js.map +1 -1
- package/lib/commonjs/components/Button/index.js +28 -13
- package/lib/commonjs/components/Button/index.js.map +1 -1
- package/lib/commonjs/components/Button/styles.js +323 -139
- package/lib/commonjs/components/Button/styles.js.map +1 -1
- package/lib/commonjs/components/Card/index.js +104 -0
- package/lib/commonjs/components/Card/index.js.map +1 -0
- package/lib/commonjs/components/Card/styles.js +28 -0
- package/lib/commonjs/components/Card/styles.js.map +1 -0
- package/lib/commonjs/components/Checkbox/index.js +180 -0
- package/lib/commonjs/components/Checkbox/index.js.map +1 -0
- package/lib/commonjs/components/Checkbox/styles.js +68 -0
- package/lib/commonjs/components/Checkbox/styles.js.map +1 -0
- package/lib/commonjs/components/Chip/index.js +103 -0
- package/lib/commonjs/components/Chip/index.js.map +1 -0
- package/lib/commonjs/components/Chip/styles.js +50 -0
- package/lib/commonjs/components/Chip/styles.js.map +1 -0
- package/lib/commonjs/components/Heading/index.js +35 -0
- package/lib/commonjs/components/Heading/index.js.map +1 -0
- package/lib/commonjs/components/Heading/styles.js +24 -0
- package/lib/commonjs/components/Heading/styles.js.map +1 -0
- package/lib/commonjs/components/Icon/index.js +61 -0
- package/lib/commonjs/components/Icon/index.js.map +1 -0
- package/lib/commonjs/components/Input/index.js +10 -16
- package/lib/commonjs/components/Input/index.js.map +1 -1
- package/lib/commonjs/components/Input/styles.js +16 -30
- package/lib/commonjs/components/Input/styles.js.map +1 -1
- package/lib/commonjs/components/Link/index.js +94 -0
- package/lib/commonjs/components/Link/index.js.map +1 -0
- package/lib/commonjs/components/Link/styles.js +16 -0
- package/lib/commonjs/components/Link/styles.js.map +1 -0
- package/lib/commonjs/components/Select/index.js +11 -12
- package/lib/commonjs/components/Select/index.js.map +1 -1
- package/lib/commonjs/components/Select/styles.js +29 -53
- package/lib/commonjs/components/Select/styles.js.map +1 -1
- package/lib/commonjs/components/Stack/HStack.js +8 -21
- package/lib/commonjs/components/Stack/HStack.js.map +1 -1
- package/lib/commonjs/components/Stack/VStack.js +8 -21
- package/lib/commonjs/components/Stack/VStack.js.map +1 -1
- package/lib/commonjs/components/Stack/styles.js +39 -0
- package/lib/commonjs/components/Stack/styles.js.map +1 -0
- package/lib/commonjs/components/Switch/BaseSwitch.js +46 -0
- package/lib/commonjs/components/Switch/BaseSwitch.js.map +1 -0
- package/lib/commonjs/components/Switch/BaseSwitch.web.js +56 -0
- package/lib/commonjs/components/Switch/BaseSwitch.web.js.map +1 -0
- package/lib/commonjs/components/Switch/index.js +13 -0
- package/lib/commonjs/components/Switch/index.js.map +1 -0
- package/lib/commonjs/components/Switch/styles.js +128 -0
- package/lib/commonjs/components/Switch/styles.js.map +1 -0
- package/lib/commonjs/components/Text/index.js +18 -9
- package/lib/commonjs/components/Text/index.js.map +1 -1
- package/lib/commonjs/components/Text/styles.js +24 -0
- package/lib/commonjs/components/Text/styles.js.map +1 -0
- package/lib/commonjs/components/VirtualizedList/index.js +19 -0
- package/lib/commonjs/components/VirtualizedList/index.js.map +1 -0
- package/lib/commonjs/components/index.js +120 -0
- package/lib/commonjs/components/index.js.map +1 -1
- package/lib/commonjs/metro/withCdxMetroConfig.js +24 -0
- package/lib/commonjs/metro/withCdxMetroConfig.js.map +1 -0
- package/lib/commonjs/styles/index.js +17 -0
- package/lib/commonjs/styles/index.js.map +1 -0
- package/lib/commonjs/styles/primitives.js +123 -0
- package/lib/commonjs/styles/primitives.js.map +1 -0
- package/lib/module/components/Avatar/index.js +152 -0
- package/lib/module/components/Avatar/index.js.map +1 -0
- package/lib/module/components/Avatar/styles.js +77 -0
- package/lib/module/components/Avatar/styles.js.map +1 -0
- package/lib/module/components/BottomSheet/index.js +242 -0
- package/lib/module/components/BottomSheet/index.js.map +1 -0
- package/lib/module/components/BottomSheet/styles.js +58 -0
- package/lib/module/components/BottomSheet/styles.js.map +1 -0
- package/lib/module/components/Box/Box.js +1 -0
- package/lib/module/components/Box/Box.js.map +1 -1
- package/lib/module/components/Button/index.js +29 -14
- package/lib/module/components/Button/index.js.map +1 -1
- package/lib/module/components/Button/styles.js +322 -138
- package/lib/module/components/Button/styles.js.map +1 -1
- package/lib/module/components/Card/index.js +100 -0
- package/lib/module/components/Card/index.js.map +1 -0
- package/lib/module/components/Card/styles.js +25 -0
- package/lib/module/components/Card/styles.js.map +1 -0
- package/lib/module/components/Checkbox/index.js +176 -0
- package/lib/module/components/Checkbox/index.js.map +1 -0
- package/lib/module/components/Checkbox/styles.js +64 -0
- package/lib/module/components/Checkbox/styles.js.map +1 -0
- package/lib/module/components/Chip/index.js +99 -0
- package/lib/module/components/Chip/index.js.map +1 -0
- package/lib/module/components/Chip/styles.js +46 -0
- package/lib/module/components/Chip/styles.js.map +1 -0
- package/lib/module/components/Heading/index.js +31 -0
- package/lib/module/components/Heading/index.js.map +1 -0
- package/lib/module/components/Heading/styles.js +20 -0
- package/lib/module/components/Heading/styles.js.map +1 -0
- package/lib/module/components/Icon/index.js +57 -0
- package/lib/module/components/Icon/index.js.map +1 -0
- package/lib/module/components/Input/index.js +10 -16
- package/lib/module/components/Input/index.js.map +1 -1
- package/lib/module/components/Input/styles.js +16 -30
- package/lib/module/components/Input/styles.js.map +1 -1
- package/lib/module/components/Link/index.js +85 -0
- package/lib/module/components/Link/index.js.map +1 -0
- package/lib/module/components/Link/styles.js +12 -0
- package/lib/module/components/Link/styles.js.map +1 -0
- package/lib/module/components/Select/index.js +12 -13
- package/lib/module/components/Select/index.js.map +1 -1
- package/lib/module/components/Select/styles.js +29 -53
- package/lib/module/components/Select/styles.js.map +1 -1
- package/lib/module/components/Stack/HStack.js +8 -21
- package/lib/module/components/Stack/HStack.js.map +1 -1
- package/lib/module/components/Stack/VStack.js +8 -21
- package/lib/module/components/Stack/VStack.js.map +1 -1
- package/lib/module/components/Stack/styles.js +35 -0
- package/lib/module/components/Stack/styles.js.map +1 -0
- package/lib/module/components/Switch/BaseSwitch.js +42 -0
- package/lib/module/components/Switch/BaseSwitch.js.map +1 -0
- package/lib/module/components/Switch/BaseSwitch.web.js +52 -0
- package/lib/module/components/Switch/BaseSwitch.web.js.map +1 -0
- package/lib/module/components/Switch/index.js +9 -0
- package/lib/module/components/Switch/index.js.map +1 -0
- package/lib/module/components/Switch/styles.js +125 -0
- package/lib/module/components/Switch/styles.js.map +1 -0
- package/lib/module/components/Text/index.js +19 -1
- package/lib/module/components/Text/index.js.map +1 -1
- package/lib/module/components/Text/styles.js +20 -0
- package/lib/module/components/Text/styles.js.map +1 -0
- package/lib/module/components/VirtualizedList/index.js +15 -0
- package/lib/module/components/VirtualizedList/index.js.map +1 -0
- package/lib/module/components/index.js +10 -0
- package/lib/module/components/index.js.map +1 -1
- package/lib/module/metro/withCdxMetroConfig.js +20 -0
- package/lib/module/metro/withCdxMetroConfig.js.map +1 -0
- package/lib/module/styles/index.js +4 -0
- package/lib/module/styles/index.js.map +1 -0
- package/lib/module/styles/primitives.js +119 -0
- package/lib/module/styles/primitives.js.map +1 -0
- package/lib/typescript/components/Avatar/index.d.ts +40 -0
- package/lib/typescript/components/Avatar/index.d.ts.map +1 -0
- package/lib/typescript/components/Avatar/styles.d.ts +16 -0
- package/lib/typescript/components/Avatar/styles.d.ts.map +1 -0
- package/lib/typescript/components/BottomSheet/index.d.ts +61 -0
- package/lib/typescript/components/BottomSheet/index.d.ts.map +1 -0
- package/lib/typescript/components/BottomSheet/styles.d.ts +16 -0
- package/lib/typescript/components/BottomSheet/styles.d.ts.map +1 -0
- package/lib/typescript/components/Box/Box.d.ts +1 -0
- package/lib/typescript/components/Box/Box.d.ts.map +1 -1
- package/lib/typescript/components/Button/index.d.ts +6 -3
- package/lib/typescript/components/Button/index.d.ts.map +1 -1
- package/lib/typescript/components/Button/styles.d.ts +14 -8
- package/lib/typescript/components/Button/styles.d.ts.map +1 -1
- package/lib/typescript/components/Card/index.d.ts +30 -0
- package/lib/typescript/components/Card/index.d.ts.map +1 -0
- package/lib/typescript/components/Card/styles.d.ts +6 -0
- package/lib/typescript/components/Card/styles.d.ts.map +1 -0
- package/lib/typescript/components/Checkbox/index.d.ts +46 -0
- package/lib/typescript/components/Checkbox/index.d.ts.map +1 -0
- package/lib/typescript/components/Checkbox/styles.d.ts +18 -0
- package/lib/typescript/components/Checkbox/styles.d.ts.map +1 -0
- package/lib/typescript/components/Chip/index.d.ts +27 -0
- package/lib/typescript/components/Chip/index.d.ts.map +1 -0
- package/lib/typescript/components/Chip/styles.d.ts +12 -0
- package/lib/typescript/components/Chip/styles.d.ts.map +1 -0
- package/lib/typescript/components/Heading/index.d.ts +10 -0
- package/lib/typescript/components/Heading/index.d.ts.map +1 -0
- package/lib/typescript/components/Heading/styles.d.ts +6 -0
- package/lib/typescript/components/Heading/styles.d.ts.map +1 -0
- package/lib/typescript/components/Icon/index.d.ts +27 -0
- package/lib/typescript/components/Icon/index.d.ts.map +1 -0
- package/lib/typescript/components/Input/index.d.ts +6 -4
- package/lib/typescript/components/Input/index.d.ts.map +1 -1
- package/lib/typescript/components/Input/styles.d.ts +5 -7
- package/lib/typescript/components/Input/styles.d.ts.map +1 -1
- package/lib/typescript/components/Link/index.d.ts +26 -0
- package/lib/typescript/components/Link/index.d.ts.map +1 -0
- package/lib/typescript/components/Link/styles.d.ts +4 -0
- package/lib/typescript/components/Link/styles.d.ts.map +1 -0
- package/lib/typescript/components/Select/index.d.ts +6 -3
- package/lib/typescript/components/Select/index.d.ts.map +1 -1
- package/lib/typescript/components/Select/styles.d.ts +6 -8
- package/lib/typescript/components/Select/styles.d.ts.map +1 -1
- package/lib/typescript/components/Stack/HStack.d.ts +1 -12
- package/lib/typescript/components/Stack/HStack.d.ts.map +1 -1
- package/lib/typescript/components/Stack/VStack.d.ts +1 -12
- package/lib/typescript/components/Stack/VStack.d.ts.map +1 -1
- package/lib/typescript/components/Stack/styles.d.ts +10 -0
- package/lib/typescript/components/Stack/styles.d.ts.map +1 -0
- package/lib/typescript/components/Switch/BaseSwitch.d.ts +9 -0
- package/lib/typescript/components/Switch/BaseSwitch.d.ts.map +1 -0
- package/lib/typescript/components/Switch/BaseSwitch.web.d.ts +15 -0
- package/lib/typescript/components/Switch/BaseSwitch.web.d.ts.map +1 -0
- package/lib/typescript/components/Switch/index.d.ts +8 -0
- package/lib/typescript/components/Switch/index.d.ts.map +1 -0
- package/lib/typescript/components/Switch/styles.d.ts +26 -0
- package/lib/typescript/components/Switch/styles.d.ts.map +1 -0
- package/lib/typescript/components/Text/index.d.ts +9 -1
- package/lib/typescript/components/Text/index.d.ts.map +1 -1
- package/lib/typescript/components/Text/styles.d.ts +6 -0
- package/lib/typescript/components/Text/styles.d.ts.map +1 -0
- package/lib/typescript/components/VirtualizedList/index.d.ts +8 -0
- package/lib/typescript/components/VirtualizedList/index.d.ts.map +1 -0
- package/lib/typescript/components/index.d.ts +10 -0
- package/lib/typescript/components/index.d.ts.map +1 -1
- package/lib/typescript/metro/withCdxMetroConfig.d.ts +19 -0
- package/lib/typescript/metro/withCdxMetroConfig.d.ts.map +1 -0
- package/lib/typescript/styles/index.d.ts +2 -0
- package/lib/typescript/styles/index.d.ts.map +1 -0
- package/lib/typescript/styles/primitives.d.ts +85 -0
- package/lib/typescript/styles/primitives.d.ts.map +1 -0
- package/package.json +22 -13
- package/src/components/Avatar/index.tsx +174 -0
- package/src/components/Avatar/styles.ts +83 -0
- package/src/components/BottomSheet/index.tsx +316 -0
- package/src/components/BottomSheet/styles.ts +79 -0
- package/src/components/Box/Box.tsx +1 -0
- package/src/components/Button/index.tsx +23 -15
- package/src/components/Button/styles.ts +353 -144
- package/src/components/Card/index.tsx +115 -0
- package/src/components/Card/styles.ts +41 -0
- package/src/components/Checkbox/index.tsx +209 -0
- package/src/components/Checkbox/styles.ts +103 -0
- package/src/components/Chip/index.tsx +91 -0
- package/src/components/Chip/styles.ts +51 -0
- package/src/components/Heading/index.tsx +36 -0
- package/src/components/Heading/styles.tsx +26 -0
- package/src/components/Icon/index.tsx +54 -0
- package/src/components/Input/index.tsx +9 -20
- package/src/components/Input/styles.ts +42 -37
- package/src/components/Link/index.tsx +83 -0
- package/src/components/Link/styles.ts +20 -0
- package/src/components/Select/index.tsx +12 -11
- package/src/components/Select/styles.ts +63 -74
- package/src/components/Stack/HStack.tsx +8 -19
- package/src/components/Stack/VStack.tsx +8 -23
- package/src/components/Stack/styles.ts +37 -0
- package/src/components/Switch/BaseSwitch.tsx +38 -0
- package/src/components/Switch/BaseSwitch.web.tsx +69 -0
- package/src/components/Switch/index.tsx +13 -0
- package/src/components/Switch/styles.ts +120 -0
- package/src/components/Text/index.tsx +16 -0
- package/src/components/Text/styles.tsx +26 -0
- package/src/components/VirtualizedList/index.tsx +19 -0
- package/src/components/index.ts +10 -0
- package/src/metro/withCdxMetroConfig.ts +29 -0
- package/src/styles/index.ts +1 -0
- package/src/styles/primitives.ts +107 -0
- package/lib/commonjs/components/Text/Text.js +0 -30
- package/lib/commonjs/components/Text/Text.js.map +0 -1
- package/lib/module/components/Text/Text.js +0 -26
- package/lib/module/components/Text/Text.js.map +0 -1
- package/lib/typescript/components/Text/Text.d.ts +0 -11
- package/lib/typescript/components/Text/Text.d.ts.map +0 -1
- package/src/components/Text/Text.tsx +0 -58
- package/src/components/Text/index.ts +0 -1
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { forwardRef, type ReactNode } from 'react';
|
|
2
|
+
import { Image, Text, View, type ImageProps, type TextProps, type ViewProps } from 'react-native';
|
|
3
|
+
import { createAvatar, type IAvatarImageProps, type IAvatarProps } from '@cdx-ui/primitives';
|
|
4
|
+
import { cn, useStyleContext, withStyleContext } from '@cdx-ui/utils';
|
|
5
|
+
import { Icon as IconComponent, type IconProps } from '../Icon';
|
|
6
|
+
import {
|
|
7
|
+
type AvatarVariantProps,
|
|
8
|
+
avatarBadgeVariants,
|
|
9
|
+
avatarIconVariants,
|
|
10
|
+
avatarTextVariants,
|
|
11
|
+
avatarImageVariants,
|
|
12
|
+
avatarRootVariants,
|
|
13
|
+
} from './styles';
|
|
14
|
+
|
|
15
|
+
const SCOPE = 'AVATAR';
|
|
16
|
+
|
|
17
|
+
const Root = withStyleContext(View, SCOPE);
|
|
18
|
+
|
|
19
|
+
const useAvatarStyleContext = () => useStyleContext(SCOPE) as AvatarVariantProps;
|
|
20
|
+
|
|
21
|
+
const AvatarPrimitive = createAvatar({
|
|
22
|
+
Root,
|
|
23
|
+
Image,
|
|
24
|
+
Text,
|
|
25
|
+
Icon: IconComponent,
|
|
26
|
+
Badge: View,
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
// =============================================================================
|
|
30
|
+
// AVATAR ROOT
|
|
31
|
+
// =============================================================================
|
|
32
|
+
|
|
33
|
+
export interface AvatarProps extends ViewProps, IAvatarProps, AvatarVariantProps {
|
|
34
|
+
className?: string;
|
|
35
|
+
children?: ReactNode;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const AvatarRoot = forwardRef<View, AvatarProps>(
|
|
39
|
+
({ size = 'lg', className, children, style, ...props }, ref) => {
|
|
40
|
+
const computedClassName = cn(avatarRootVariants({ size }), className);
|
|
41
|
+
|
|
42
|
+
return (
|
|
43
|
+
<AvatarPrimitive
|
|
44
|
+
ref={ref as never}
|
|
45
|
+
className={computedClassName}
|
|
46
|
+
style={style}
|
|
47
|
+
context={{ size }}
|
|
48
|
+
{...props}
|
|
49
|
+
>
|
|
50
|
+
{children}
|
|
51
|
+
</AvatarPrimitive>
|
|
52
|
+
);
|
|
53
|
+
},
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
AvatarRoot.displayName = 'Avatar';
|
|
57
|
+
|
|
58
|
+
// =============================================================================
|
|
59
|
+
// AVATAR IMAGE
|
|
60
|
+
// =============================================================================
|
|
61
|
+
|
|
62
|
+
export interface AvatarImageProps extends Omit<ImageProps, 'source'>, IAvatarImageProps {
|
|
63
|
+
className?: string;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const AvatarImage = forwardRef<Image, AvatarImageProps>(({ className, style, ...props }, ref) => {
|
|
67
|
+
const computedClassName = cn(avatarImageVariants(), className);
|
|
68
|
+
|
|
69
|
+
return (
|
|
70
|
+
<AvatarPrimitive.Image
|
|
71
|
+
ref={ref as never}
|
|
72
|
+
className={computedClassName}
|
|
73
|
+
style={style}
|
|
74
|
+
{...props}
|
|
75
|
+
/>
|
|
76
|
+
);
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
AvatarImage.displayName = 'Avatar.Image';
|
|
80
|
+
|
|
81
|
+
// =============================================================================
|
|
82
|
+
// AVATAR TEXT
|
|
83
|
+
// =============================================================================
|
|
84
|
+
|
|
85
|
+
export interface AvatarTextProps extends TextProps {
|
|
86
|
+
className?: string;
|
|
87
|
+
children?: ReactNode;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const AvatarText = forwardRef<Text, AvatarTextProps>(
|
|
91
|
+
({ className, children, style, ...props }, ref) => {
|
|
92
|
+
const { size } = useAvatarStyleContext();
|
|
93
|
+
const computedClassName = cn(avatarTextVariants({ size }), className);
|
|
94
|
+
|
|
95
|
+
return (
|
|
96
|
+
<AvatarPrimitive.Text
|
|
97
|
+
ref={ref as never}
|
|
98
|
+
className={computedClassName}
|
|
99
|
+
style={style}
|
|
100
|
+
{...props}
|
|
101
|
+
>
|
|
102
|
+
{children}
|
|
103
|
+
</AvatarPrimitive.Text>
|
|
104
|
+
);
|
|
105
|
+
},
|
|
106
|
+
);
|
|
107
|
+
|
|
108
|
+
AvatarText.displayName = 'Avatar.Text';
|
|
109
|
+
|
|
110
|
+
// =============================================================================
|
|
111
|
+
// AVATAR ICON
|
|
112
|
+
// =============================================================================
|
|
113
|
+
|
|
114
|
+
export interface AvatarIconProps extends Omit<IconProps, 'children'> {
|
|
115
|
+
className?: string;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
const AvatarIcon = ({ className, style, ...props }: AvatarIconProps) => {
|
|
119
|
+
const { size } = useAvatarStyleContext();
|
|
120
|
+
const computedClassName = cn(avatarIconVariants({ size }), className);
|
|
121
|
+
|
|
122
|
+
return <AvatarPrimitive.Icon className={computedClassName} style={style} {...props} />;
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
AvatarIcon.displayName = 'Avatar.Icon';
|
|
126
|
+
|
|
127
|
+
// =============================================================================
|
|
128
|
+
// AVATAR BADGE
|
|
129
|
+
// =============================================================================
|
|
130
|
+
|
|
131
|
+
export interface AvatarBadgeProps extends ViewProps {
|
|
132
|
+
className?: string;
|
|
133
|
+
children?: ReactNode;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
const AvatarBadge = forwardRef<View, AvatarBadgeProps>(
|
|
137
|
+
({ className, children, style, ...props }, ref) => {
|
|
138
|
+
const { size } = useAvatarStyleContext();
|
|
139
|
+
const computedClassName = cn(avatarBadgeVariants({ size }), className);
|
|
140
|
+
|
|
141
|
+
return (
|
|
142
|
+
<AvatarPrimitive.Badge
|
|
143
|
+
ref={ref as never}
|
|
144
|
+
className={computedClassName}
|
|
145
|
+
style={style}
|
|
146
|
+
{...props}
|
|
147
|
+
>
|
|
148
|
+
{children}
|
|
149
|
+
</AvatarPrimitive.Badge>
|
|
150
|
+
);
|
|
151
|
+
},
|
|
152
|
+
);
|
|
153
|
+
|
|
154
|
+
AvatarBadge.displayName = 'Avatar.Badge';
|
|
155
|
+
|
|
156
|
+
// =============================================================================
|
|
157
|
+
// COMPOUND COMPONENT
|
|
158
|
+
// =============================================================================
|
|
159
|
+
|
|
160
|
+
type AvatarCompoundComponent = typeof AvatarRoot & {
|
|
161
|
+
Image: typeof AvatarImage;
|
|
162
|
+
Text: typeof AvatarText;
|
|
163
|
+
Icon: typeof AvatarIcon;
|
|
164
|
+
Badge: typeof AvatarBadge;
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
export const Avatar = Object.assign(AvatarRoot, {
|
|
168
|
+
Image: AvatarImage,
|
|
169
|
+
Text: AvatarText,
|
|
170
|
+
Icon: AvatarIcon,
|
|
171
|
+
Badge: AvatarBadge,
|
|
172
|
+
}) as AvatarCompoundComponent;
|
|
173
|
+
|
|
174
|
+
export type { AvatarVariantProps };
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { cva, type VariantProps } from 'class-variance-authority';
|
|
2
|
+
import { COLOR_BG_MUTED, COLOR_TEXT_SECONDARY, RADIUS_FULL } from '../../styles/primitives';
|
|
3
|
+
|
|
4
|
+
// ── Root ─────────────────────────────────────────────────
|
|
5
|
+
|
|
6
|
+
export const avatarRootVariants = cva(
|
|
7
|
+
[RADIUS_FULL, 'relative items-center justify-center', COLOR_BG_MUTED],
|
|
8
|
+
{
|
|
9
|
+
variants: {
|
|
10
|
+
size: {
|
|
11
|
+
sm: 'w-8 h-8',
|
|
12
|
+
md: 'w-10 h-10',
|
|
13
|
+
lg: 'w-12 h-12',
|
|
14
|
+
xl: 'w-16 h-16',
|
|
15
|
+
'2xl': 'w-20 h-20',
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
defaultVariants: {
|
|
19
|
+
size: 'lg',
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
// ── Image ────────────────────────────────────────────────
|
|
25
|
+
|
|
26
|
+
export const avatarImageVariants = cva([
|
|
27
|
+
'absolute top-0 left-0 w-full h-full',
|
|
28
|
+
RADIUS_FULL,
|
|
29
|
+
'overflow-hidden',
|
|
30
|
+
]);
|
|
31
|
+
|
|
32
|
+
// ── Text ─────────────────────────────────────────────────
|
|
33
|
+
|
|
34
|
+
export const avatarTextVariants = cva([COLOR_TEXT_SECONDARY, 'font-semibold'], {
|
|
35
|
+
variants: {
|
|
36
|
+
size: {
|
|
37
|
+
sm: 'text-xs',
|
|
38
|
+
md: 'text-sm',
|
|
39
|
+
lg: 'text-base',
|
|
40
|
+
xl: 'text-xl',
|
|
41
|
+
'2xl': 'text-2xl',
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
defaultVariants: {
|
|
45
|
+
size: 'lg',
|
|
46
|
+
},
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
// ── Icon ─────────────────────────────────────────────────
|
|
50
|
+
|
|
51
|
+
export const avatarIconVariants = cva([COLOR_TEXT_SECONDARY], {
|
|
52
|
+
variants: {
|
|
53
|
+
size: {
|
|
54
|
+
sm: 'size-4',
|
|
55
|
+
md: 'size-5',
|
|
56
|
+
lg: 'size-6',
|
|
57
|
+
xl: 'size-8',
|
|
58
|
+
'2xl': 'size-10',
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
defaultVariants: {
|
|
62
|
+
size: 'lg',
|
|
63
|
+
},
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
// ── Badge ────────────────────────────────────────────────
|
|
67
|
+
|
|
68
|
+
export const avatarBadgeVariants = cva(['absolute border-2 border-white', RADIUS_FULL], {
|
|
69
|
+
variants: {
|
|
70
|
+
size: {
|
|
71
|
+
sm: 'w-2.5 h-2.5 bottom-0 right-0',
|
|
72
|
+
md: 'w-3 h-3 bottom-0 right-0',
|
|
73
|
+
lg: 'w-3.5 h-3.5 bottom-0 right-0',
|
|
74
|
+
xl: 'w-4 h-4 bottom-0.5 right-0.5',
|
|
75
|
+
'2xl': 'w-5 h-5 bottom-0.5 right-0.5',
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
defaultVariants: {
|
|
79
|
+
size: 'lg',
|
|
80
|
+
},
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
export type AvatarVariantProps = VariantProps<typeof avatarRootVariants>;
|
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
import React, { forwardRef, useCallback, useRef, type ReactNode } from 'react';
|
|
2
|
+
import { Dimensions, Pressable, View, ViewStyle } from 'react-native';
|
|
3
|
+
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
4
|
+
import {
|
|
5
|
+
BottomSheetModal,
|
|
6
|
+
BottomSheetModalProvider,
|
|
7
|
+
BottomSheetScrollView,
|
|
8
|
+
BottomSheetView,
|
|
9
|
+
BottomSheetBackdrop,
|
|
10
|
+
BottomSheetFooter as GorhomBottomSheetFooter,
|
|
11
|
+
type BottomSheetBackdropProps,
|
|
12
|
+
type BottomSheetFooterProps as GorhomBottomSheetFooterProps,
|
|
13
|
+
} from '@gorhom/bottom-sheet';
|
|
14
|
+
import { cn } from '@cdx-ui/utils';
|
|
15
|
+
import { ArrowBackIosNew, Close } from '@cdx-ui/icons';
|
|
16
|
+
import { Heading } from '../Heading';
|
|
17
|
+
import { Icon } from '../Icon';
|
|
18
|
+
import { Text } from '../Text';
|
|
19
|
+
import {
|
|
20
|
+
bottomSheetBackButtonVariants,
|
|
21
|
+
bottomSheetBackIconVariants,
|
|
22
|
+
bottomSheetCloseButtonVariants,
|
|
23
|
+
bottomSheetCloseIconVariants,
|
|
24
|
+
bottomSheetContainerVariants,
|
|
25
|
+
bottomSheetContentVariants,
|
|
26
|
+
bottomSheetFooterVariants,
|
|
27
|
+
bottomSheetHeaderVariants,
|
|
28
|
+
bottomSheetSubtitleVariants,
|
|
29
|
+
handleIndicatorStyle,
|
|
30
|
+
} from './styles';
|
|
31
|
+
|
|
32
|
+
/** Ref type for BottomSheet; forwards the @gorhom modal ref (present, dismiss, snapToIndex, minimize, restore, etc.). */
|
|
33
|
+
export type BottomSheetModalRef = React.ComponentRef<typeof BottomSheetModal>;
|
|
34
|
+
|
|
35
|
+
export interface BottomSheetHeaderProps {
|
|
36
|
+
title?: string;
|
|
37
|
+
subtitle?: string;
|
|
38
|
+
children?: ReactNode;
|
|
39
|
+
className?: string;
|
|
40
|
+
onClose?: () => void;
|
|
41
|
+
closeAccessibilityLabel?: string;
|
|
42
|
+
onBack?: () => void;
|
|
43
|
+
backAccessibilityLabel?: string;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function BottomSheetHeaderComponent(
|
|
47
|
+
{
|
|
48
|
+
title,
|
|
49
|
+
subtitle,
|
|
50
|
+
children,
|
|
51
|
+
className,
|
|
52
|
+
onClose,
|
|
53
|
+
closeAccessibilityLabel,
|
|
54
|
+
onBack,
|
|
55
|
+
backAccessibilityLabel = 'Go back',
|
|
56
|
+
}: BottomSheetHeaderProps,
|
|
57
|
+
ref: React.Ref<View>,
|
|
58
|
+
) {
|
|
59
|
+
const hasTitle = title !== undefined && title !== '';
|
|
60
|
+
const hasContent = hasTitle || !!children || !!onBack;
|
|
61
|
+
const computedClassName = cn(bottomSheetHeaderVariants({ hasTitle: hasContent }), className);
|
|
62
|
+
return (
|
|
63
|
+
<View ref={ref} className={computedClassName}>
|
|
64
|
+
{onBack && (
|
|
65
|
+
<Pressable
|
|
66
|
+
onPress={onBack}
|
|
67
|
+
hitSlop={12}
|
|
68
|
+
accessibilityRole="button"
|
|
69
|
+
accessibilityLabel={backAccessibilityLabel}
|
|
70
|
+
className={cn(bottomSheetBackButtonVariants())}
|
|
71
|
+
>
|
|
72
|
+
<Icon as={ArrowBackIosNew} className={bottomSheetBackIconVariants()} />
|
|
73
|
+
</Pressable>
|
|
74
|
+
)}
|
|
75
|
+
<View className="flex-1">
|
|
76
|
+
{children ??
|
|
77
|
+
(hasTitle ? (
|
|
78
|
+
<View>
|
|
79
|
+
<Heading size="xs" className="text-lg">
|
|
80
|
+
{title}
|
|
81
|
+
</Heading>
|
|
82
|
+
{subtitle ? <Text className={bottomSheetSubtitleVariants()}>{subtitle}</Text> : null}
|
|
83
|
+
</View>
|
|
84
|
+
) : null)}
|
|
85
|
+
</View>
|
|
86
|
+
{onClose && (
|
|
87
|
+
<BottomSheetCloseButton
|
|
88
|
+
onPress={onClose}
|
|
89
|
+
{...(closeAccessibilityLabel !== undefined && {
|
|
90
|
+
accessibilityLabel: closeAccessibilityLabel,
|
|
91
|
+
})}
|
|
92
|
+
/>
|
|
93
|
+
)}
|
|
94
|
+
</View>
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
BottomSheetHeaderComponent.displayName = 'BottomSheet.Header';
|
|
99
|
+
|
|
100
|
+
const BottomSheetHeader = forwardRef<View, BottomSheetHeaderProps>(BottomSheetHeaderComponent);
|
|
101
|
+
BottomSheetHeader.displayName = 'BottomSheet.Header';
|
|
102
|
+
|
|
103
|
+
// =============================================================================
|
|
104
|
+
// CLOSEBUTTON
|
|
105
|
+
// =============================================================================
|
|
106
|
+
interface BottomSheetCloseButtonProps {
|
|
107
|
+
onPress: () => void;
|
|
108
|
+
className?: string;
|
|
109
|
+
accessibilityLabel?: string;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
function BottomSheetCloseButton({
|
|
113
|
+
onPress,
|
|
114
|
+
className,
|
|
115
|
+
accessibilityLabel = 'Close',
|
|
116
|
+
}: BottomSheetCloseButtonProps) {
|
|
117
|
+
return (
|
|
118
|
+
<Pressable
|
|
119
|
+
onPress={onPress}
|
|
120
|
+
hitSlop={12}
|
|
121
|
+
accessibilityRole="button"
|
|
122
|
+
accessibilityLabel={accessibilityLabel}
|
|
123
|
+
className={cn(bottomSheetCloseButtonVariants(), className)}
|
|
124
|
+
>
|
|
125
|
+
<Icon as={Close} className={bottomSheetCloseIconVariants()} />
|
|
126
|
+
</Pressable>
|
|
127
|
+
);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
BottomSheetCloseButton.displayName = 'BottomSheet.CloseButton';
|
|
131
|
+
|
|
132
|
+
// =============================================================================
|
|
133
|
+
// CONTENT
|
|
134
|
+
// =============================================================================
|
|
135
|
+
|
|
136
|
+
export interface BottomSheetContentProps {
|
|
137
|
+
children?: ReactNode;
|
|
138
|
+
className?: string;
|
|
139
|
+
hasSafeAreaInset?: boolean;
|
|
140
|
+
style?: ViewStyle;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
const BottomSheetContent = forwardRef<View, BottomSheetContentProps>(
|
|
144
|
+
({ children, className, hasSafeAreaInset, style }, ref) => {
|
|
145
|
+
const insets = useSafeAreaInsets();
|
|
146
|
+
const computedClassName = cn(bottomSheetContentVariants(), className);
|
|
147
|
+
return (
|
|
148
|
+
<View
|
|
149
|
+
ref={ref}
|
|
150
|
+
className={computedClassName}
|
|
151
|
+
style={hasSafeAreaInset ? { paddingBottom: insets.bottom, ...style } : style}
|
|
152
|
+
pointerEvents="box-none"
|
|
153
|
+
>
|
|
154
|
+
{children}
|
|
155
|
+
</View>
|
|
156
|
+
);
|
|
157
|
+
},
|
|
158
|
+
);
|
|
159
|
+
|
|
160
|
+
BottomSheetContent.displayName = 'BottomSheet.Content';
|
|
161
|
+
|
|
162
|
+
// =============================================================================
|
|
163
|
+
// FOOTER
|
|
164
|
+
// =============================================================================
|
|
165
|
+
export interface BottomSheetFooterProps {
|
|
166
|
+
children?: ReactNode;
|
|
167
|
+
className?: string;
|
|
168
|
+
style?: ViewStyle;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
const BottomSheetFooter = forwardRef<View, BottomSheetFooterProps>(
|
|
172
|
+
({ children, className, style }, ref) => {
|
|
173
|
+
const insets = useSafeAreaInsets();
|
|
174
|
+
const computedClassName = cn(bottomSheetFooterVariants(), className);
|
|
175
|
+
return (
|
|
176
|
+
<View
|
|
177
|
+
ref={ref}
|
|
178
|
+
className={computedClassName}
|
|
179
|
+
style={{ paddingBottom: Math.max(insets.bottom, 24), ...style }}
|
|
180
|
+
pointerEvents="box-none"
|
|
181
|
+
>
|
|
182
|
+
{children}
|
|
183
|
+
</View>
|
|
184
|
+
);
|
|
185
|
+
},
|
|
186
|
+
);
|
|
187
|
+
|
|
188
|
+
BottomSheetFooter.displayName = 'BottomSheet.Footer';
|
|
189
|
+
|
|
190
|
+
// =============================================================================
|
|
191
|
+
// MODAL WRAPPER (WITH STYLES)
|
|
192
|
+
// =============================================================================
|
|
193
|
+
|
|
194
|
+
export interface BottomSheetModalProps extends React.ComponentPropsWithoutRef<
|
|
195
|
+
typeof BottomSheetModal
|
|
196
|
+
> {
|
|
197
|
+
/** Show the drag handle indicator. When false, `handleComponent` is set to null. @default true */
|
|
198
|
+
handleVisible?: boolean;
|
|
199
|
+
/** Footer content rendered via gorhom's BottomSheetFooter for proper animated positioning and safe-area handling. */
|
|
200
|
+
footer?: ReactNode;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
const MAX_DYNAMIC_CONTENT_SIZE = Dimensions.get('window').height * 0.9;
|
|
204
|
+
|
|
205
|
+
const CustomBackdrop = (props: BottomSheetBackdropProps) => {
|
|
206
|
+
return (
|
|
207
|
+
<BottomSheetBackdrop
|
|
208
|
+
{...props}
|
|
209
|
+
disappearsOnIndex={-1}
|
|
210
|
+
appearsOnIndex={0}
|
|
211
|
+
opacity={0.5}
|
|
212
|
+
pressBehavior="close"
|
|
213
|
+
/>
|
|
214
|
+
);
|
|
215
|
+
};
|
|
216
|
+
|
|
217
|
+
const BottomSheetModalStyled = forwardRef<
|
|
218
|
+
React.ComponentRef<typeof BottomSheetModal>,
|
|
219
|
+
BottomSheetModalProps
|
|
220
|
+
>(({ handleVisible = true, footer, ...rest }, ref) => {
|
|
221
|
+
const renderFooter = useCallback(
|
|
222
|
+
(props: GorhomBottomSheetFooterProps) => (
|
|
223
|
+
<GorhomBottomSheetFooter {...props}>{footer}</GorhomBottomSheetFooter>
|
|
224
|
+
),
|
|
225
|
+
[footer],
|
|
226
|
+
);
|
|
227
|
+
|
|
228
|
+
return (
|
|
229
|
+
<BottomSheetModal
|
|
230
|
+
ref={ref}
|
|
231
|
+
enableDynamicSizing
|
|
232
|
+
maxDynamicContentSize={MAX_DYNAMIC_CONTENT_SIZE}
|
|
233
|
+
handleComponent={handleVisible ? undefined : null}
|
|
234
|
+
handleIndicatorStyle={handleVisible ? handleIndicatorStyle : undefined}
|
|
235
|
+
backdropComponent={CustomBackdrop}
|
|
236
|
+
backgroundComponent={(backgroundProps) => (
|
|
237
|
+
<View {...backgroundProps} className={cn(bottomSheetContainerVariants())} />
|
|
238
|
+
)}
|
|
239
|
+
{...rest}
|
|
240
|
+
{...(footer != null && { footerComponent: renderFooter })}
|
|
241
|
+
/>
|
|
242
|
+
);
|
|
243
|
+
});
|
|
244
|
+
|
|
245
|
+
BottomSheetModalStyled.displayName = 'BottomSheet.Modal';
|
|
246
|
+
|
|
247
|
+
// =============================================================================
|
|
248
|
+
// SCROLLVIEW WRAPPER (with footer margin adjustment enabled by default)
|
|
249
|
+
// =============================================================================
|
|
250
|
+
|
|
251
|
+
function BottomSheetScrollViewStyled({
|
|
252
|
+
enableFooterMarginAdjustment = true,
|
|
253
|
+
children,
|
|
254
|
+
...rest
|
|
255
|
+
}: React.ComponentPropsWithoutRef<typeof BottomSheetScrollView>) {
|
|
256
|
+
return (
|
|
257
|
+
<BottomSheetScrollView enableFooterMarginAdjustment={enableFooterMarginAdjustment} {...rest}>
|
|
258
|
+
{children}
|
|
259
|
+
</BottomSheetScrollView>
|
|
260
|
+
);
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
BottomSheetScrollViewStyled.displayName = 'BottomSheet.ScrollView';
|
|
264
|
+
|
|
265
|
+
// =============================================================================
|
|
266
|
+
// VIEW WRAPPER (with footer margin adjustment enabled by default)
|
|
267
|
+
// =============================================================================
|
|
268
|
+
|
|
269
|
+
function BottomSheetViewStyled({
|
|
270
|
+
enableFooterMarginAdjustment = true,
|
|
271
|
+
children,
|
|
272
|
+
...rest
|
|
273
|
+
}: React.ComponentPropsWithoutRef<typeof BottomSheetView>) {
|
|
274
|
+
return (
|
|
275
|
+
<BottomSheetView enableFooterMarginAdjustment={enableFooterMarginAdjustment} {...rest}>
|
|
276
|
+
{children}
|
|
277
|
+
</BottomSheetView>
|
|
278
|
+
);
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
BottomSheetViewStyled.displayName = 'BottomSheet.View';
|
|
282
|
+
|
|
283
|
+
// Display names for gorhom components exposed as BottomSheet.*
|
|
284
|
+
interface WithDisplayName {
|
|
285
|
+
displayName?: string;
|
|
286
|
+
}
|
|
287
|
+
(BottomSheetModalProvider as WithDisplayName).displayName = 'BottomSheet.Provider';
|
|
288
|
+
|
|
289
|
+
// ── Public exports ────────────────────────────────────────
|
|
290
|
+
|
|
291
|
+
interface BottomSheetCompound {
|
|
292
|
+
Modal: typeof BottomSheetModalStyled;
|
|
293
|
+
Header: typeof BottomSheetHeader;
|
|
294
|
+
Content: typeof BottomSheetContent;
|
|
295
|
+
Footer: typeof BottomSheetFooter;
|
|
296
|
+
Provider: typeof BottomSheetModalProvider;
|
|
297
|
+
ScrollView: typeof BottomSheetScrollViewStyled;
|
|
298
|
+
View: typeof BottomSheetViewStyled;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
export const BottomSheet = {
|
|
302
|
+
Modal: BottomSheetModalStyled,
|
|
303
|
+
Header: BottomSheetHeader,
|
|
304
|
+
Content: BottomSheetContent,
|
|
305
|
+
Footer: BottomSheetFooter,
|
|
306
|
+
Provider: BottomSheetModalProvider,
|
|
307
|
+
ScrollView: BottomSheetScrollViewStyled,
|
|
308
|
+
View: BottomSheetViewStyled,
|
|
309
|
+
} as BottomSheetCompound;
|
|
310
|
+
|
|
311
|
+
// ── Hooks ────────────────────────────────────────────────
|
|
312
|
+
|
|
313
|
+
export function useBottomSheet() {
|
|
314
|
+
const ref = useRef<BottomSheetModalRef>(null);
|
|
315
|
+
return { ref, present: () => ref.current?.present(), dismiss: () => ref.current?.dismiss() };
|
|
316
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { type ViewStyle } from 'react-native';
|
|
2
|
+
import { cva, type VariantProps } from 'class-variance-authority';
|
|
3
|
+
import {
|
|
4
|
+
COLOR_BG_PRIMARY,
|
|
5
|
+
COLOR_BORDER_DEFAULT,
|
|
6
|
+
COLOR_TEXT_PRIMARY,
|
|
7
|
+
COLOR_TEXT_SECONDARY,
|
|
8
|
+
} from '../../styles/primitives';
|
|
9
|
+
|
|
10
|
+
// ── Container ──────────────────────────────────────────────
|
|
11
|
+
|
|
12
|
+
export const bottomSheetContainerVariants = cva([
|
|
13
|
+
'rounded-t-3xl border-t border-x overflow-hidden',
|
|
14
|
+
COLOR_BG_PRIMARY,
|
|
15
|
+
COLOR_BORDER_DEFAULT,
|
|
16
|
+
]);
|
|
17
|
+
|
|
18
|
+
// ── Header ─────────────────────────────────────────────────
|
|
19
|
+
|
|
20
|
+
export const bottomSheetHeaderVariants = cva(
|
|
21
|
+
[
|
|
22
|
+
'flex-row items-center justify-between min-h-12 px-4 pt-3 pb-2',
|
|
23
|
+
COLOR_BG_PRIMARY,
|
|
24
|
+
COLOR_TEXT_PRIMARY,
|
|
25
|
+
],
|
|
26
|
+
{
|
|
27
|
+
variants: {
|
|
28
|
+
hasTitle: {
|
|
29
|
+
true: '',
|
|
30
|
+
false: 'justify-end',
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
defaultVariants: {
|
|
34
|
+
hasTitle: true,
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
// ── Content ────────────────────────────────────────────────
|
|
40
|
+
|
|
41
|
+
export const bottomSheetContentVariants = cva([COLOR_BG_PRIMARY, 'px-4 pb-6']);
|
|
42
|
+
|
|
43
|
+
// ── Footer ─────────────────────────────────────────────────
|
|
44
|
+
|
|
45
|
+
export const bottomSheetFooterVariants = cva([
|
|
46
|
+
'px-4 pt-3 pb-4 border-t',
|
|
47
|
+
COLOR_BG_PRIMARY,
|
|
48
|
+
COLOR_BORDER_DEFAULT,
|
|
49
|
+
]);
|
|
50
|
+
|
|
51
|
+
// ── Subtitle ────────────────────────────────────────────────
|
|
52
|
+
|
|
53
|
+
export const bottomSheetSubtitleVariants = cva(['text-sm', COLOR_TEXT_SECONDARY]);
|
|
54
|
+
|
|
55
|
+
// ── Back Button ─────────────────────────────────────────────
|
|
56
|
+
|
|
57
|
+
export const bottomSheetBackButtonVariants = cva(['p-1 -m-1 mr-2 rounded-full active:opacity-70']);
|
|
58
|
+
|
|
59
|
+
export const bottomSheetBackIconVariants = cva(['size-5 text-slate-500']);
|
|
60
|
+
|
|
61
|
+
// ── Close Button ───────────────────────────────────────────
|
|
62
|
+
|
|
63
|
+
export const bottomSheetCloseButtonVariants = cva(['p-1 -m-1 rounded-full active:opacity-70']);
|
|
64
|
+
|
|
65
|
+
// ── Close Icon ─────────────────────────────────────────────
|
|
66
|
+
|
|
67
|
+
export const bottomSheetCloseIconVariants = cva(['size-5 text-slate-500']);
|
|
68
|
+
|
|
69
|
+
// ── Handle indicator ────────────────────────────────────────
|
|
70
|
+
// Plain ViewStyle — gorhom's handleIndicatorStyle doesn't accept classNames.
|
|
71
|
+
// slate-300 (#cbd5e1) maps to COLOR_BORDER_STRONG; update when raw token palette is available (TODO).
|
|
72
|
+
export const handleIndicatorStyle: ViewStyle = {
|
|
73
|
+
backgroundColor: '#cbd5e1',
|
|
74
|
+
width: 36,
|
|
75
|
+
height: 4,
|
|
76
|
+
borderRadius: 2,
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
export type BottomSheetHeaderVariants = VariantProps<typeof bottomSheetHeaderVariants>;
|
|
@@ -8,6 +8,7 @@ export interface BoxProps extends ViewProps {
|
|
|
8
8
|
textProps?: TextProps;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
+
/** @deprecated Use View instead */
|
|
11
12
|
export const Box = forwardRef<View, BoxProps>(
|
|
12
13
|
({ style, className, children, textProps, ...restProps }, ref: ForwardedRef<View>) => {
|
|
13
14
|
return (
|