@cdx-ui/components 0.0.1-beta.51 → 0.0.1-beta.52
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/commonjs/components/AlertDialog/index.js +4 -3
- package/lib/commonjs/components/AlertDialog/index.js.map +1 -1
- package/lib/commonjs/components/Dialog/index.js +71 -16
- package/lib/commonjs/components/Dialog/index.js.map +1 -1
- package/lib/commonjs/components/Dialog/styles.js +60 -14
- package/lib/commonjs/components/Dialog/styles.js.map +1 -1
- package/lib/commonjs/figma/AlertDialog.Description.figma.js +20 -0
- package/lib/commonjs/figma/AlertDialog.Description.figma.js.map +1 -0
- package/lib/commonjs/figma/AlertDialog.Footer.figma.js +41 -0
- package/lib/commonjs/figma/AlertDialog.Footer.figma.js.map +1 -0
- package/lib/commonjs/figma/AlertDialog.Header.figma.js +28 -0
- package/lib/commonjs/figma/AlertDialog.Header.figma.js.map +1 -0
- package/lib/commonjs/figma/AlertDialog.Text.figma.js +20 -0
- package/lib/commonjs/figma/AlertDialog.Text.figma.js.map +1 -0
- package/lib/commonjs/figma/AlertDialog.Title.figma.js +27 -0
- package/lib/commonjs/figma/AlertDialog.Title.figma.js.map +1 -0
- package/lib/commonjs/figma/AlertDialog.figma.js +43 -0
- package/lib/commonjs/figma/AlertDialog.figma.js.map +1 -0
- package/lib/commonjs/figma/Dialog.Description.figma.js +20 -0
- package/lib/commonjs/figma/Dialog.Description.figma.js.map +1 -0
- package/lib/commonjs/figma/Dialog.Footer.figma.js +30 -0
- package/lib/commonjs/figma/Dialog.Footer.figma.js.map +1 -0
- package/lib/commonjs/figma/Dialog.Header.figma.js +29 -0
- package/lib/commonjs/figma/Dialog.Header.figma.js.map +1 -0
- package/lib/commonjs/figma/Dialog.Text.figma.js +20 -0
- package/lib/commonjs/figma/Dialog.Text.figma.js.map +1 -0
- package/lib/commonjs/figma/Dialog.Title.figma.js +27 -0
- package/lib/commonjs/figma/Dialog.Title.figma.js.map +1 -0
- package/lib/commonjs/figma/Dialog.figma.js +51 -0
- package/lib/commonjs/figma/Dialog.figma.js.map +1 -0
- package/lib/module/components/AlertDialog/index.js +4 -3
- package/lib/module/components/AlertDialog/index.js.map +1 -1
- package/lib/module/components/Dialog/index.js +74 -19
- package/lib/module/components/Dialog/index.js.map +1 -1
- package/lib/module/components/Dialog/styles.js +60 -14
- package/lib/module/components/Dialog/styles.js.map +1 -1
- package/lib/module/figma/AlertDialog.Description.figma.js +14 -0
- package/lib/module/figma/AlertDialog.Description.figma.js.map +1 -0
- package/lib/module/figma/AlertDialog.Footer.figma.js +35 -0
- package/lib/module/figma/AlertDialog.Footer.figma.js.map +1 -0
- package/lib/module/figma/AlertDialog.Header.figma.js +22 -0
- package/lib/module/figma/AlertDialog.Header.figma.js.map +1 -0
- package/lib/module/figma/AlertDialog.Text.figma.js +14 -0
- package/lib/module/figma/AlertDialog.Text.figma.js.map +1 -0
- package/lib/module/figma/AlertDialog.Title.figma.js +21 -0
- package/lib/module/figma/AlertDialog.Title.figma.js.map +1 -0
- package/lib/module/figma/AlertDialog.figma.js +37 -0
- package/lib/module/figma/AlertDialog.figma.js.map +1 -0
- package/lib/module/figma/Dialog.Description.figma.js +14 -0
- package/lib/module/figma/Dialog.Description.figma.js.map +1 -0
- package/lib/module/figma/Dialog.Footer.figma.js +24 -0
- package/lib/module/figma/Dialog.Footer.figma.js.map +1 -0
- package/lib/module/figma/Dialog.Header.figma.js +23 -0
- package/lib/module/figma/Dialog.Header.figma.js.map +1 -0
- package/lib/module/figma/Dialog.Text.figma.js +14 -0
- package/lib/module/figma/Dialog.Text.figma.js.map +1 -0
- package/lib/module/figma/Dialog.Title.figma.js +21 -0
- package/lib/module/figma/Dialog.Title.figma.js.map +1 -0
- package/lib/module/figma/Dialog.figma.js +45 -0
- package/lib/module/figma/Dialog.figma.js.map +1 -0
- package/lib/typescript/components/AlertDialog/index.d.ts +3 -2
- package/lib/typescript/components/AlertDialog/index.d.ts.map +1 -1
- package/lib/typescript/components/Avatar/styles.d.ts +4 -4
- package/lib/typescript/components/Dialog/index.d.ts +16 -10
- package/lib/typescript/components/Dialog/index.d.ts.map +1 -1
- package/lib/typescript/components/Dialog/styles.d.ts +16 -5
- package/lib/typescript/components/Dialog/styles.d.ts.map +1 -1
- package/lib/typescript/components/Heading/styles.d.ts +1 -1
- package/lib/typescript/components/Stack/styles.d.ts +2 -2
- package/lib/typescript/components/Text/styles.d.ts +1 -1
- package/lib/typescript/figma/AlertDialog.Description.figma.d.ts +8 -0
- package/lib/typescript/figma/AlertDialog.Description.figma.d.ts.map +1 -0
- package/lib/typescript/figma/AlertDialog.Footer.figma.d.ts +8 -0
- package/lib/typescript/figma/AlertDialog.Footer.figma.d.ts.map +1 -0
- package/lib/typescript/figma/AlertDialog.Header.figma.d.ts +8 -0
- package/lib/typescript/figma/AlertDialog.Header.figma.d.ts.map +1 -0
- package/lib/typescript/figma/AlertDialog.Text.figma.d.ts +8 -0
- package/lib/typescript/figma/AlertDialog.Text.figma.d.ts.map +1 -0
- package/lib/typescript/figma/AlertDialog.Title.figma.d.ts +8 -0
- package/lib/typescript/figma/AlertDialog.Title.figma.d.ts.map +1 -0
- package/lib/typescript/figma/AlertDialog.figma.d.ts +8 -0
- package/lib/typescript/figma/AlertDialog.figma.d.ts.map +1 -0
- package/lib/typescript/figma/Dialog.Description.figma.d.ts +8 -0
- package/lib/typescript/figma/Dialog.Description.figma.d.ts.map +1 -0
- package/lib/typescript/figma/Dialog.Footer.figma.d.ts +8 -0
- package/lib/typescript/figma/Dialog.Footer.figma.d.ts.map +1 -0
- package/lib/typescript/figma/Dialog.Header.figma.d.ts +8 -0
- package/lib/typescript/figma/Dialog.Header.figma.d.ts.map +1 -0
- package/lib/typescript/figma/Dialog.Text.figma.d.ts +8 -0
- package/lib/typescript/figma/Dialog.Text.figma.d.ts.map +1 -0
- package/lib/typescript/figma/Dialog.Title.figma.d.ts +8 -0
- package/lib/typescript/figma/Dialog.Title.figma.d.ts.map +1 -0
- package/lib/typescript/figma/Dialog.figma.d.ts +8 -0
- package/lib/typescript/figma/Dialog.figma.d.ts.map +1 -0
- package/package.json +4 -4
- package/src/components/AlertDialog/index.tsx +7 -5
- package/src/components/Dialog/index.tsx +95 -29
- package/src/components/Dialog/styles.ts +72 -30
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AlertDialog.Footer.figma.d.ts","sourceRoot":"","sources":["../../../src/figma/AlertDialog.Footer.figma.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAC;;;;;;AAgC1B,wBASE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AlertDialog.Header.figma.d.ts","sourceRoot":"","sources":["../../../src/figma/AlertDialog.Header.figma.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAC;;;;;;AAgB1B,wBAQE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AlertDialog.Text.figma.d.ts","sourceRoot":"","sources":["../../../src/figma/AlertDialog.Text.figma.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAC;;;;;;AAM1B,wBAIE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AlertDialog.Title.figma.d.ts","sourceRoot":"","sources":["../../../src/figma/AlertDialog.Title.figma.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAC;;;;;;AAe1B,wBAIE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AlertDialog.figma.d.ts","sourceRoot":"","sources":["../../../src/figma/AlertDialog.figma.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAC;;;;;;AAyB1B,wBAYE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Dialog.Description.figma.d.ts","sourceRoot":"","sources":["../../../src/figma/Dialog.Description.figma.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAC;;;;;;AAM1B,wBAIE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Dialog.Footer.figma.d.ts","sourceRoot":"","sources":["../../../src/figma/Dialog.Footer.figma.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAC;;;;;;AAgB1B,wBASE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Dialog.Header.figma.d.ts","sourceRoot":"","sources":["../../../src/figma/Dialog.Header.figma.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAC;;;;;;AAgB1B,wBASE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Dialog.Text.figma.d.ts","sourceRoot":"","sources":["../../../src/figma/Dialog.Text.figma.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAC;;;;;;AAM1B,wBAIE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Dialog.Title.figma.d.ts","sourceRoot":"","sources":["../../../src/figma/Dialog.Title.figma.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAC;;;;;;AAe1B,wBAIE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Dialog.figma.d.ts","sourceRoot":"","sources":["../../../src/figma/Dialog.figma.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAC;;;;;;AAiC1B,wBAYE"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cdx-ui/components",
|
|
3
|
-
"version": "0.0.1-beta.
|
|
3
|
+
"version": "0.0.1-beta.52",
|
|
4
4
|
"main": "lib/commonjs/index.js",
|
|
5
5
|
"module": "lib/module/index.js",
|
|
6
6
|
"react-native": "src/index.ts",
|
|
@@ -67,9 +67,9 @@
|
|
|
67
67
|
"@gorhom/bottom-sheet": "^5.2.6",
|
|
68
68
|
"class-variance-authority": "^0.7.1",
|
|
69
69
|
"uniwind": "1.6.1",
|
|
70
|
-
"@cdx-ui/primitives": "0.0.1-beta.
|
|
71
|
-
"@cdx-ui/utils": "0.0.1-beta.
|
|
72
|
-
"@cdx-ui/icons": "0.0.1-beta.
|
|
70
|
+
"@cdx-ui/primitives": "0.0.1-beta.52",
|
|
71
|
+
"@cdx-ui/utils": "0.0.1-beta.52",
|
|
72
|
+
"@cdx-ui/icons": "0.0.1-beta.52"
|
|
73
73
|
},
|
|
74
74
|
"devDependencies": {
|
|
75
75
|
"@react-navigation/bottom-tabs": "*",
|
|
@@ -85,7 +85,7 @@ const AlertDialogCancel = forwardRef<View, AlertDialogCancelProps>(
|
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
return (
|
|
88
|
-
<Button ref={ref} variant="
|
|
88
|
+
<Button ref={ref} variant="ghost" onPress={handlePress} className={className} {...props}>
|
|
89
89
|
<Button.Label>{children}</Button.Label>
|
|
90
90
|
</Button>
|
|
91
91
|
);
|
|
@@ -99,11 +99,12 @@ AlertDialogCancel.displayName = 'AlertDialog.Cancel';
|
|
|
99
99
|
|
|
100
100
|
type AlertDialogCompoundComponent = typeof AlertDialogRoot & {
|
|
101
101
|
Trigger: typeof Dialog.Trigger;
|
|
102
|
-
|
|
102
|
+
Popup: typeof Dialog.Popup;
|
|
103
103
|
Header: typeof Dialog.Header;
|
|
104
104
|
Title: typeof Dialog.Title;
|
|
105
105
|
Description: typeof Dialog.Description;
|
|
106
|
-
|
|
106
|
+
Content: typeof Dialog.Content;
|
|
107
|
+
Text: typeof Dialog.Text;
|
|
107
108
|
Footer: typeof Dialog.Footer;
|
|
108
109
|
Close: typeof Dialog.Close;
|
|
109
110
|
Action: typeof AlertDialogAction;
|
|
@@ -112,11 +113,12 @@ type AlertDialogCompoundComponent = typeof AlertDialogRoot & {
|
|
|
112
113
|
|
|
113
114
|
export const AlertDialog = Object.assign(AlertDialogRoot, {
|
|
114
115
|
Trigger: Dialog.Trigger,
|
|
115
|
-
|
|
116
|
+
Popup: Dialog.Popup,
|
|
116
117
|
Header: Dialog.Header,
|
|
117
118
|
Title: Dialog.Title,
|
|
118
119
|
Description: Dialog.Description,
|
|
119
|
-
|
|
120
|
+
Content: Dialog.Content,
|
|
121
|
+
Text: Dialog.Text,
|
|
120
122
|
Footer: Dialog.Footer,
|
|
121
123
|
Close: Dialog.Close,
|
|
122
124
|
Action: AlertDialogAction,
|
|
@@ -1,14 +1,21 @@
|
|
|
1
1
|
import { forwardRef, type ReactNode } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import {
|
|
3
|
+
Pressable,
|
|
4
|
+
Text,
|
|
5
|
+
View,
|
|
6
|
+
type PressableProps,
|
|
7
|
+
type TextProps,
|
|
8
|
+
type ViewProps,
|
|
9
|
+
} from 'react-native';
|
|
10
|
+
import { CheckCircle, Close as CloseIcon, EmergencyHome, Warning } from '@cdx-ui/icons';
|
|
4
11
|
import {
|
|
5
12
|
createDialog,
|
|
6
|
-
type IDialogBodyProps,
|
|
7
13
|
type IDialogCloseProps,
|
|
8
14
|
type IDialogContentProps,
|
|
9
15
|
type IDialogDescriptionProps,
|
|
10
16
|
type IDialogFooterProps,
|
|
11
17
|
type IDialogHeaderProps,
|
|
18
|
+
type IDialogPopupProps,
|
|
12
19
|
type IDialogRootProps,
|
|
13
20
|
type IDialogTitleProps,
|
|
14
21
|
type IDialogTriggerProps,
|
|
@@ -16,8 +23,8 @@ import {
|
|
|
16
23
|
import { cn, useStyleContext, withStyleContext } from '@cdx-ui/utils';
|
|
17
24
|
import { Icon } from '../Icon';
|
|
18
25
|
import {
|
|
26
|
+
type DialogTitleVariantProps,
|
|
19
27
|
type DialogVariantProps,
|
|
20
|
-
dialogBodyVariants,
|
|
21
28
|
dialogCloseIconVariants,
|
|
22
29
|
dialogCloseVariants,
|
|
23
30
|
dialogContentVariants,
|
|
@@ -25,6 +32,9 @@ import {
|
|
|
25
32
|
dialogFooterVariants,
|
|
26
33
|
dialogHeaderVariants,
|
|
27
34
|
dialogOverlayVariants,
|
|
35
|
+
dialogPopupVariants,
|
|
36
|
+
dialogTextVariants,
|
|
37
|
+
dialogTitleIconVariants,
|
|
28
38
|
dialogTitleVariants,
|
|
29
39
|
} from './styles';
|
|
30
40
|
|
|
@@ -59,11 +69,11 @@ const DialogPrimitive = createDialog({
|
|
|
59
69
|
Root,
|
|
60
70
|
Trigger: Pressable,
|
|
61
71
|
Overlay: StyledOverlay,
|
|
62
|
-
|
|
72
|
+
Popup: View,
|
|
63
73
|
Header: View,
|
|
64
74
|
Title: Text,
|
|
65
75
|
Description: Text,
|
|
66
|
-
|
|
76
|
+
Content: View,
|
|
67
77
|
Footer: View,
|
|
68
78
|
Close: Pressable,
|
|
69
79
|
});
|
|
@@ -78,8 +88,14 @@ export interface DialogRootProps
|
|
|
78
88
|
}
|
|
79
89
|
|
|
80
90
|
const DialogRoot = forwardRef<View, DialogRootProps>(
|
|
81
|
-
({ size = 'md', className, children, style, ...props }, ref) => (
|
|
82
|
-
<DialogPrimitive
|
|
91
|
+
({ size = 'md', fullBleed = false, className, children, style, ...props }, ref) => (
|
|
92
|
+
<DialogPrimitive
|
|
93
|
+
ref={ref}
|
|
94
|
+
className={className}
|
|
95
|
+
style={style}
|
|
96
|
+
context={{ size, fullBleed }}
|
|
97
|
+
{...props}
|
|
98
|
+
>
|
|
83
99
|
{children}
|
|
84
100
|
</DialogPrimitive>
|
|
85
101
|
),
|
|
@@ -107,29 +123,29 @@ const DialogTrigger = forwardRef<View, DialogTriggerProps>(
|
|
|
107
123
|
DialogTrigger.displayName = 'Dialog.Trigger';
|
|
108
124
|
|
|
109
125
|
// =============================================================================
|
|
110
|
-
// STYLED
|
|
126
|
+
// STYLED POPUP (wraps DialogPrimitive.Popup)
|
|
111
127
|
// =============================================================================
|
|
112
128
|
|
|
113
|
-
export interface
|
|
129
|
+
export interface DialogPopupProps extends IDialogPopupProps, Pick<DialogVariantProps, 'size'> {
|
|
114
130
|
className?: string;
|
|
115
131
|
children?: ReactNode;
|
|
116
132
|
}
|
|
117
133
|
|
|
118
|
-
const
|
|
134
|
+
const DialogPopup = forwardRef<View, DialogPopupProps>(
|
|
119
135
|
({ size: sizeProp, className, children, style, ...props }, ref) => {
|
|
120
136
|
const { size: contextSize } = useDialogStyleContext();
|
|
121
137
|
const size = sizeProp ?? contextSize;
|
|
122
|
-
const computedClassName = cn(
|
|
138
|
+
const computedClassName = cn(dialogPopupVariants({ size }), className);
|
|
123
139
|
|
|
124
140
|
return (
|
|
125
|
-
<DialogPrimitive.
|
|
141
|
+
<DialogPrimitive.Popup ref={ref} className={computedClassName} style={style} {...props}>
|
|
126
142
|
{children}
|
|
127
|
-
</DialogPrimitive.
|
|
143
|
+
</DialogPrimitive.Popup>
|
|
128
144
|
);
|
|
129
145
|
},
|
|
130
146
|
);
|
|
131
147
|
|
|
132
|
-
|
|
148
|
+
DialogPopup.displayName = 'Dialog.Popup';
|
|
133
149
|
|
|
134
150
|
// =============================================================================
|
|
135
151
|
// STYLED HEADER
|
|
@@ -158,14 +174,35 @@ DialogHeader.displayName = 'Dialog.Header';
|
|
|
158
174
|
// STYLED TITLE
|
|
159
175
|
// =============================================================================
|
|
160
176
|
|
|
161
|
-
|
|
177
|
+
const APPEARANCE_ICON_MAP = {
|
|
178
|
+
danger: EmergencyHome,
|
|
179
|
+
warning: Warning,
|
|
180
|
+
success: CheckCircle,
|
|
181
|
+
} as const;
|
|
182
|
+
|
|
183
|
+
export interface DialogTitleProps extends IDialogTitleProps, DialogTitleVariantProps {
|
|
162
184
|
className?: string;
|
|
163
185
|
children?: ReactNode;
|
|
164
186
|
}
|
|
165
187
|
|
|
166
188
|
const DialogTitle = forwardRef<Text, DialogTitleProps>(
|
|
167
|
-
({ className, children, style, ...props }, ref) => {
|
|
168
|
-
const computedClassName = cn(dialogTitleVariants(), className);
|
|
189
|
+
({ appearance = 'default', className, children, style, ...props }, ref) => {
|
|
190
|
+
const computedClassName = cn(dialogTitleVariants({ appearance }), className);
|
|
191
|
+
const IconComponent =
|
|
192
|
+
appearance && appearance in APPEARANCE_ICON_MAP
|
|
193
|
+
? APPEARANCE_ICON_MAP[appearance as keyof typeof APPEARANCE_ICON_MAP]
|
|
194
|
+
: null;
|
|
195
|
+
|
|
196
|
+
if (IconComponent) {
|
|
197
|
+
return (
|
|
198
|
+
<View className="flex-row items-center gap-1">
|
|
199
|
+
<Icon as={IconComponent} className={dialogTitleIconVariants({ appearance })} />
|
|
200
|
+
<DialogPrimitive.Title ref={ref} className={computedClassName} style={style} {...props}>
|
|
201
|
+
{children}
|
|
202
|
+
</DialogPrimitive.Title>
|
|
203
|
+
</View>
|
|
204
|
+
);
|
|
205
|
+
}
|
|
169
206
|
|
|
170
207
|
return (
|
|
171
208
|
<DialogPrimitive.Title ref={ref} className={computedClassName} style={style} {...props}>
|
|
@@ -201,27 +238,54 @@ const DialogDescription = forwardRef<Text, DialogDescriptionProps>(
|
|
|
201
238
|
DialogDescription.displayName = 'Dialog.Description';
|
|
202
239
|
|
|
203
240
|
// =============================================================================
|
|
204
|
-
// STYLED
|
|
241
|
+
// STYLED CONTENT (wraps DialogPrimitive.Content)
|
|
242
|
+
// =============================================================================
|
|
243
|
+
|
|
244
|
+
export interface DialogContentProps extends IDialogContentProps {
|
|
245
|
+
className?: string;
|
|
246
|
+
children?: ReactNode;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
const DialogContent = forwardRef<View, DialogContentProps>(
|
|
250
|
+
({ className, children, style, ...props }, ref) => {
|
|
251
|
+
const { fullBleed } = useDialogStyleContext();
|
|
252
|
+
const computedClassName = cn(
|
|
253
|
+
dialogContentVariants({ fullBleed: fullBleed ?? false }),
|
|
254
|
+
className,
|
|
255
|
+
);
|
|
256
|
+
|
|
257
|
+
return (
|
|
258
|
+
<DialogPrimitive.Content ref={ref} className={computedClassName} style={style} {...props}>
|
|
259
|
+
{children}
|
|
260
|
+
</DialogPrimitive.Content>
|
|
261
|
+
);
|
|
262
|
+
},
|
|
263
|
+
);
|
|
264
|
+
|
|
265
|
+
DialogContent.displayName = 'Dialog.Content';
|
|
266
|
+
|
|
267
|
+
// =============================================================================
|
|
268
|
+
// STYLED TEXT
|
|
205
269
|
// =============================================================================
|
|
206
270
|
|
|
207
|
-
export interface
|
|
271
|
+
export interface DialogTextProps extends TextProps {
|
|
208
272
|
className?: string;
|
|
209
273
|
children?: ReactNode;
|
|
210
274
|
}
|
|
211
275
|
|
|
212
|
-
const
|
|
276
|
+
const DialogText = forwardRef<Text, DialogTextProps>(
|
|
213
277
|
({ className, children, style, ...props }, ref) => {
|
|
214
|
-
const computedClassName = cn(
|
|
278
|
+
const computedClassName = cn(dialogTextVariants(), className);
|
|
215
279
|
|
|
216
280
|
return (
|
|
217
|
-
<
|
|
281
|
+
<Text ref={ref} className={computedClassName} style={style} {...props}>
|
|
218
282
|
{children}
|
|
219
|
-
</
|
|
283
|
+
</Text>
|
|
220
284
|
);
|
|
221
285
|
},
|
|
222
286
|
);
|
|
223
287
|
|
|
224
|
-
|
|
288
|
+
DialogText.displayName = 'Dialog.Text';
|
|
225
289
|
|
|
226
290
|
// =============================================================================
|
|
227
291
|
// STYLED FOOTER
|
|
@@ -283,22 +347,24 @@ DialogClose.displayName = 'Dialog.Close';
|
|
|
283
347
|
|
|
284
348
|
type DialogCompoundComponent = typeof DialogRoot & {
|
|
285
349
|
Trigger: typeof DialogTrigger;
|
|
286
|
-
|
|
350
|
+
Popup: typeof DialogPopup;
|
|
287
351
|
Header: typeof DialogHeader;
|
|
288
352
|
Title: typeof DialogTitle;
|
|
289
353
|
Description: typeof DialogDescription;
|
|
290
|
-
|
|
354
|
+
Content: typeof DialogContent;
|
|
355
|
+
Text: typeof DialogText;
|
|
291
356
|
Footer: typeof DialogFooter;
|
|
292
357
|
Close: typeof DialogClose;
|
|
293
358
|
};
|
|
294
359
|
|
|
295
360
|
export const Dialog = Object.assign(DialogRoot, {
|
|
296
361
|
Trigger: DialogTrigger,
|
|
297
|
-
|
|
362
|
+
Popup: DialogPopup,
|
|
298
363
|
Header: DialogHeader,
|
|
299
364
|
Title: DialogTitle,
|
|
300
365
|
Description: DialogDescription,
|
|
301
|
-
|
|
366
|
+
Content: DialogContent,
|
|
367
|
+
Text: DialogText,
|
|
302
368
|
Footer: DialogFooter,
|
|
303
369
|
Close: DialogClose,
|
|
304
370
|
}) as DialogCompoundComponent;
|
|
@@ -1,36 +1,28 @@
|
|
|
1
1
|
import { Platform } from 'react-native';
|
|
2
2
|
import { cva, type VariantProps } from 'class-variance-authority';
|
|
3
|
-
import {
|
|
4
|
-
COLOR_BG_INVERSE,
|
|
5
|
-
COLOR_BG_PRIMARY,
|
|
6
|
-
COLOR_BORDER_DEFAULT,
|
|
7
|
-
COLOR_TEXT_PRIMARY,
|
|
8
|
-
COLOR_TEXT_SECONDARY,
|
|
9
|
-
RADIUS_MD,
|
|
10
|
-
SHADOW_MD,
|
|
11
|
-
TRANSITION_COLORS,
|
|
12
|
-
} from '../../styles/primitives';
|
|
3
|
+
import { TRANSITION_COLORS } from '../../styles/primitives';
|
|
13
4
|
|
|
14
5
|
// ── Overlay ─────────────────────────────────────────────────
|
|
15
6
|
|
|
16
|
-
export const dialogOverlayVariants = cva(['absolute inset-0',
|
|
7
|
+
export const dialogOverlayVariants = cva(['absolute inset-0', 'bg-surface-backdrop']);
|
|
17
8
|
|
|
18
|
-
// ──
|
|
9
|
+
// ── Popup (renamed from dialogContentVariants) ──────────────
|
|
19
10
|
|
|
20
|
-
export const
|
|
11
|
+
export const dialogPopupVariants = cva(
|
|
21
12
|
[
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
Platform.select({ web: SHADOW_MD, default: '' }),
|
|
13
|
+
'bg-surface-primary',
|
|
14
|
+
'rounded-lg',
|
|
15
|
+
Platform.select({ web: 'shadow-lg', default: '' }),
|
|
26
16
|
'max-h-[85vh] overflow-hidden',
|
|
27
17
|
],
|
|
28
18
|
{
|
|
29
19
|
variants: {
|
|
30
20
|
size: {
|
|
21
|
+
xs: 'w-[90%] max-w-xs',
|
|
31
22
|
sm: 'w-[90%] max-w-sm',
|
|
32
23
|
md: 'w-[90%] max-w-md',
|
|
33
24
|
lg: 'w-[90%] max-w-lg',
|
|
25
|
+
xl: 'w-[90%] max-w-xl',
|
|
34
26
|
full: 'w-full mx-4',
|
|
35
27
|
},
|
|
36
28
|
},
|
|
@@ -43,46 +35,96 @@ export const dialogContentVariants = cva(
|
|
|
43
35
|
// ── Header ──────────────────────────────────────────────────
|
|
44
36
|
|
|
45
37
|
export const dialogHeaderVariants = cva([
|
|
46
|
-
'flex-
|
|
47
|
-
'
|
|
38
|
+
'flex-col items-start justify-between shrink-0',
|
|
39
|
+
'pl-6 pr-14 py-4',
|
|
48
40
|
]);
|
|
49
41
|
|
|
50
42
|
// ── Title ───────────────────────────────────────────────────
|
|
51
43
|
|
|
52
|
-
export const dialogTitleVariants = cva(['
|
|
44
|
+
export const dialogTitleVariants = cva(['heading-sm', 'text-content-primary'], {
|
|
45
|
+
variants: {
|
|
46
|
+
appearance: {
|
|
47
|
+
default: '',
|
|
48
|
+
danger: '',
|
|
49
|
+
warning: '',
|
|
50
|
+
success: '',
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
defaultVariants: {
|
|
54
|
+
appearance: 'default',
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
// ── Title Icon ──────────────────────────────────────────────
|
|
59
|
+
|
|
60
|
+
export const dialogTitleIconVariants = cva(['size-5'], {
|
|
61
|
+
variants: {
|
|
62
|
+
appearance: {
|
|
63
|
+
default: '',
|
|
64
|
+
danger: 'text-content-danger',
|
|
65
|
+
warning: 'text-content-warning',
|
|
66
|
+
success: 'text-content-success',
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
defaultVariants: {
|
|
70
|
+
appearance: 'default',
|
|
71
|
+
},
|
|
72
|
+
});
|
|
53
73
|
|
|
54
74
|
// ── Description ─────────────────────────────────────────────
|
|
55
75
|
|
|
56
|
-
export const dialogDescriptionVariants = cva(['
|
|
76
|
+
export const dialogDescriptionVariants = cva(['body-sm mt-1', 'text-content-secondary']);
|
|
77
|
+
|
|
78
|
+
// ── Content (renamed from dialogBodyVariants) ───────────────
|
|
79
|
+
|
|
80
|
+
export const dialogContentVariants = cva(['px-6 py-0 gap-2 shrink min-h-0'], {
|
|
81
|
+
variants: {
|
|
82
|
+
fullBleed: {
|
|
83
|
+
true: 'px-0',
|
|
84
|
+
false: '',
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
defaultVariants: {
|
|
88
|
+
fullBleed: false,
|
|
89
|
+
},
|
|
90
|
+
});
|
|
57
91
|
|
|
58
|
-
// ──
|
|
92
|
+
// ── Text ────────────────────────────────────────────────────
|
|
59
93
|
|
|
60
|
-
export const
|
|
94
|
+
export const dialogTextVariants = cva(['body-md', 'text-content-primary']);
|
|
61
95
|
|
|
62
96
|
// ── Footer ──────────────────────────────────────────────────
|
|
63
97
|
|
|
64
98
|
export const dialogFooterVariants = cva([
|
|
65
99
|
'flex-row items-center justify-end shrink-0',
|
|
66
|
-
'gap-
|
|
100
|
+
'gap-2 px-6 pt-4 pb-6',
|
|
67
101
|
]);
|
|
68
102
|
|
|
69
103
|
// ── Close ───────────────────────────────────────────────────
|
|
70
104
|
|
|
71
105
|
export const dialogCloseVariants = cva([
|
|
72
|
-
'
|
|
106
|
+
'absolute right-[14px] top-[14px]',
|
|
107
|
+
'min-w-[32px] min-h-[32px] items-center justify-center',
|
|
108
|
+
'p-[6px] rounded-full',
|
|
73
109
|
TRANSITION_COLORS,
|
|
74
110
|
Platform.select({
|
|
75
111
|
default: 'data-[active=true]:opacity-70',
|
|
76
112
|
web: [
|
|
77
|
-
'data-[hover=true]:bg-
|
|
78
|
-
'data-[active=true]:bg-
|
|
79
|
-
'data-[focus-visible=true]:ring-2 data-[focus-visible=true]:ring-
|
|
113
|
+
'data-[hover=true]:bg-surface-primary-hover',
|
|
114
|
+
'data-[active=true]:bg-surface-primary-active',
|
|
115
|
+
'data-[focus-visible=true]:ring-2 data-[focus-visible=true]:ring-stroke-focus data-[focus-visible=true]:ring-offset-2',
|
|
80
116
|
].join(' '),
|
|
81
117
|
}),
|
|
82
118
|
]);
|
|
83
119
|
|
|
84
120
|
// ── Close Icon ──────────────────────────────────────────────
|
|
85
121
|
|
|
86
|
-
export const dialogCloseIconVariants = cva(['size-5 text-
|
|
122
|
+
export const dialogCloseIconVariants = cva(['size-5 text-content-tertiary']);
|
|
123
|
+
|
|
124
|
+
// ── Exported types ──────────────────────────────────────────
|
|
125
|
+
|
|
126
|
+
export type DialogVariantProps = VariantProps<typeof dialogPopupVariants> & {
|
|
127
|
+
fullBleed?: boolean;
|
|
128
|
+
};
|
|
87
129
|
|
|
88
|
-
export type
|
|
130
|
+
export type DialogTitleVariantProps = VariantProps<typeof dialogTitleVariants>;
|