@streamplace/components 0.7.27 → 0.7.29
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/dist/components/chat/chat-box.js +2 -2
- package/dist/components/chat/chat.js +1 -1
- package/dist/components/mobile-player/ui/autoplay-button.js +1 -0
- package/dist/components/mobile-player/ui/viewer-context-menu.js +1 -1
- package/dist/components/mobile-player/ui/viewer-loading-overlay.js +2 -2
- package/dist/components/mobile-player/use-webrtc.js +30 -0
- package/dist/components/ui/button.js +107 -155
- package/dist/components/ui/dialog.js +83 -116
- package/dist/components/ui/dropdown.js +41 -18
- package/dist/components/ui/input.js +53 -128
- package/dist/components/ui/primitives/button.js +0 -2
- package/dist/components/ui/primitives/modal.js +2 -2
- package/dist/components/ui/primitives/text.js +48 -8
- package/dist/components/ui/text.js +37 -66
- package/dist/components/ui/toast.js +78 -40
- package/dist/components/ui/view.js +28 -41
- package/dist/lib/theme/index.js +1 -2
- package/dist/lib/theme/theme.js +106 -54
- package/dist/lib/theme/tokens.js +94 -1
- package/dist/ui/index.js +2 -3
- package/node-compile-cache/v22.15.0-x64-efe9a9df-0/37be0eec +0 -0
- package/package.json +3 -2
- package/src/components/chat/chat-box.tsx +6 -3
- package/src/components/chat/chat.tsx +1 -0
- package/src/components/mobile-player/ui/autoplay-button.tsx +1 -0
- package/src/components/mobile-player/ui/viewer-context-menu.tsx +2 -2
- package/src/components/mobile-player/ui/viewer-loading-overlay.tsx +2 -2
- package/src/components/mobile-player/use-webrtc.tsx +31 -0
- package/src/components/ui/button.tsx +110 -172
- package/src/components/ui/dialog.tsx +96 -138
- package/src/components/ui/dropdown.tsx +60 -22
- package/src/components/ui/input.tsx +57 -144
- package/src/components/ui/primitives/button.tsx +0 -2
- package/src/components/ui/primitives/modal.tsx +0 -2
- package/src/components/ui/primitives/text.tsx +51 -8
- package/src/components/ui/text.tsx +42 -67
- package/src/components/ui/toast.tsx +108 -90
- package/src/components/ui/view.tsx +27 -41
- package/src/lib/theme/index.ts +0 -2
- package/src/lib/theme/theme.tsx +179 -72
- package/src/lib/theme/tokens.ts +97 -0
- package/src/ui/index.ts +0 -2
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { cva, type VariantProps } from "class-variance-authority";
|
|
2
2
|
import React, { forwardRef, useMemo } from "react";
|
|
3
|
-
import { ActivityIndicator
|
|
3
|
+
import { ActivityIndicator } from "react-native";
|
|
4
4
|
import { useTheme } from "../../lib/theme/theme";
|
|
5
|
-
import * as
|
|
5
|
+
import * as zero from "../../ui";
|
|
6
6
|
import { ButtonPrimitive, ButtonPrimitiveProps } from "./primitives/button";
|
|
7
7
|
import { TextPrimitive } from "./primitives/text";
|
|
8
8
|
|
|
@@ -57,44 +57,117 @@ export const Button = forwardRef<any, ButtonProps>(
|
|
|
57
57
|
},
|
|
58
58
|
ref,
|
|
59
59
|
) => {
|
|
60
|
-
const {
|
|
60
|
+
const { zero: zt, icons } = useTheme();
|
|
61
61
|
|
|
62
|
-
//
|
|
63
|
-
const styles = useMemo(() => createStyles(theme), [theme]);
|
|
64
|
-
|
|
65
|
-
// Get variant styles
|
|
62
|
+
// Get variant styles using theme.zero
|
|
66
63
|
const buttonStyle = useMemo(() => {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
64
|
+
switch (variant) {
|
|
65
|
+
case "primary":
|
|
66
|
+
return zt.button.primary;
|
|
67
|
+
case "secondary":
|
|
68
|
+
return zt.button.secondary;
|
|
69
|
+
case "outline":
|
|
70
|
+
return zt.button.outline;
|
|
71
|
+
case "ghost":
|
|
72
|
+
return zt.button.ghost;
|
|
73
|
+
case "destructive":
|
|
74
|
+
return [zt.bg.destructive, zero.shadows.sm];
|
|
75
|
+
case "success":
|
|
76
|
+
return [zt.bg.success, zero.shadows.sm];
|
|
77
|
+
default:
|
|
78
|
+
return zt.button.primary;
|
|
79
|
+
}
|
|
80
|
+
}, [variant, zt]);
|
|
71
81
|
|
|
72
|
-
// Get
|
|
73
|
-
const
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
82
|
+
// Get text styles using theme.zero
|
|
83
|
+
const textStyle = useMemo(() => {
|
|
84
|
+
switch (variant) {
|
|
85
|
+
case "primary":
|
|
86
|
+
return [zt.text.primaryForeground, { fontWeight: "600" }];
|
|
87
|
+
case "secondary":
|
|
88
|
+
return [zt.text.secondaryForeground, { fontWeight: "500" }];
|
|
89
|
+
case "outline":
|
|
90
|
+
case "ghost":
|
|
91
|
+
return [zt.text.foreground, { fontWeight: "500" }];
|
|
92
|
+
case "destructive":
|
|
93
|
+
return [zt.text.destructiveForeground, { fontWeight: "600" }];
|
|
94
|
+
case "success":
|
|
95
|
+
return [zt.text.successForeground, { fontWeight: "600" }];
|
|
96
|
+
default:
|
|
97
|
+
return [zt.text.primaryForeground, { fontWeight: "600" }];
|
|
98
|
+
}
|
|
99
|
+
}, [variant, zt]);
|
|
78
100
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
101
|
+
// Size styles using theme.zero
|
|
102
|
+
const sizeStyles = useMemo(() => {
|
|
103
|
+
switch (size) {
|
|
104
|
+
case "sm":
|
|
105
|
+
return {
|
|
106
|
+
button: [
|
|
107
|
+
zero.px[3],
|
|
108
|
+
zero.py[2],
|
|
109
|
+
{ borderRadius: zero.borderRadius.md },
|
|
110
|
+
],
|
|
111
|
+
inner: { gap: 4 },
|
|
112
|
+
text: zt.text.sm,
|
|
113
|
+
};
|
|
114
|
+
case "lg":
|
|
115
|
+
return {
|
|
116
|
+
button: [
|
|
117
|
+
zero.px[6],
|
|
118
|
+
zero.py[3],
|
|
119
|
+
{ borderRadius: zero.borderRadius.md },
|
|
120
|
+
],
|
|
121
|
+
inner: { gap: 8 },
|
|
122
|
+
text: zt.text.lg,
|
|
123
|
+
};
|
|
124
|
+
case "xl":
|
|
125
|
+
return {
|
|
126
|
+
button: [
|
|
127
|
+
zero.px[8],
|
|
128
|
+
zero.py[4],
|
|
129
|
+
{ borderRadius: zero.borderRadius.lg },
|
|
130
|
+
],
|
|
131
|
+
inner: { gap: 12 },
|
|
132
|
+
text: zt.text.xl,
|
|
133
|
+
};
|
|
134
|
+
case "pill":
|
|
135
|
+
return {
|
|
136
|
+
button: [
|
|
137
|
+
zero.px[4],
|
|
138
|
+
zero.py[2],
|
|
139
|
+
{ borderRadius: zero.borderRadius.full },
|
|
140
|
+
],
|
|
141
|
+
inner: { gap: 4 },
|
|
142
|
+
text: zt.text.sm,
|
|
143
|
+
};
|
|
144
|
+
case "md":
|
|
145
|
+
default:
|
|
146
|
+
return {
|
|
147
|
+
button: [
|
|
148
|
+
zero.px[4],
|
|
149
|
+
zero.py[2],
|
|
150
|
+
{ borderRadius: zero.borderRadius.md },
|
|
151
|
+
],
|
|
152
|
+
inner: { gap: 6 },
|
|
153
|
+
text: zt.text.md,
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
}, [size, zt]);
|
|
84
157
|
|
|
85
158
|
const iconSize = React.useMemo(() => {
|
|
86
159
|
switch (size) {
|
|
87
160
|
case "sm":
|
|
88
|
-
return
|
|
161
|
+
return icons.size.sm;
|
|
89
162
|
case "lg":
|
|
90
|
-
return
|
|
163
|
+
return icons.size.lg;
|
|
91
164
|
case "xl":
|
|
92
|
-
return
|
|
165
|
+
return icons.size.xl;
|
|
93
166
|
case "md":
|
|
94
167
|
default:
|
|
95
|
-
return
|
|
168
|
+
return icons.size.md;
|
|
96
169
|
}
|
|
97
|
-
}, [size]);
|
|
170
|
+
}, [size, icons]);
|
|
98
171
|
|
|
99
172
|
const spinnerSize = useMemo(() => {
|
|
100
173
|
switch (size) {
|
|
@@ -113,24 +186,26 @@ export const Button = forwardRef<any, ButtonProps>(
|
|
|
113
186
|
switch (variant) {
|
|
114
187
|
case "outline":
|
|
115
188
|
case "ghost":
|
|
116
|
-
return
|
|
189
|
+
return icons.color.primary;
|
|
117
190
|
case "secondary":
|
|
118
|
-
return
|
|
191
|
+
return icons.color.secondary;
|
|
119
192
|
case "destructive":
|
|
120
|
-
return
|
|
193
|
+
return icons.color.destructive;
|
|
194
|
+
case "success":
|
|
195
|
+
return icons.color.success;
|
|
121
196
|
default:
|
|
122
|
-
return
|
|
197
|
+
return icons.color.default;
|
|
123
198
|
}
|
|
124
|
-
}, [variant,
|
|
199
|
+
}, [variant, icons]);
|
|
125
200
|
|
|
126
201
|
return (
|
|
127
202
|
<ButtonPrimitive.Root
|
|
128
203
|
ref={ref}
|
|
129
204
|
disabled={disabled || loading}
|
|
130
|
-
style={[buttonStyle, style]}
|
|
205
|
+
style={[buttonStyle, sizeStyles.button, style]}
|
|
131
206
|
{...props}
|
|
132
207
|
>
|
|
133
|
-
<ButtonPrimitive.Content style={
|
|
208
|
+
<ButtonPrimitive.Content style={sizeStyles.inner}>
|
|
134
209
|
{loading && !leftIcon ? (
|
|
135
210
|
<ButtonPrimitive.Icon position="left">
|
|
136
211
|
<ActivityIndicator size={spinnerSize} color={spinnerColor} />
|
|
@@ -144,7 +219,7 @@ export const Button = forwardRef<any, ButtonProps>(
|
|
|
144
219
|
</ButtonPrimitive.Icon>
|
|
145
220
|
) : null}
|
|
146
221
|
|
|
147
|
-
<TextPrimitive.Root style={textStyle}>
|
|
222
|
+
<TextPrimitive.Root style={[textStyle, sizeStyles.text]}>
|
|
148
223
|
{loading && loadingText ? loadingText : children}
|
|
149
224
|
</TextPrimitive.Root>
|
|
150
225
|
|
|
@@ -168,142 +243,5 @@ export const Button = forwardRef<any, ButtonProps>(
|
|
|
168
243
|
|
|
169
244
|
Button.displayName = "Button";
|
|
170
245
|
|
|
171
|
-
// Create theme-based styles
|
|
172
|
-
function createStyles(theme: any) {
|
|
173
|
-
return StyleSheet.create({
|
|
174
|
-
// Variant styles
|
|
175
|
-
primaryButton: {
|
|
176
|
-
backgroundColor: theme.colors.primary,
|
|
177
|
-
borderWidth: 0,
|
|
178
|
-
...theme.shadows.sm,
|
|
179
|
-
},
|
|
180
|
-
primaryText: {
|
|
181
|
-
color: theme.colors.primaryForeground,
|
|
182
|
-
fontWeight: "600",
|
|
183
|
-
},
|
|
184
|
-
|
|
185
|
-
secondaryButton: {
|
|
186
|
-
backgroundColor: theme.colors.secondary,
|
|
187
|
-
borderWidth: 0,
|
|
188
|
-
},
|
|
189
|
-
secondaryText: {
|
|
190
|
-
color: theme.colors.secondaryForeground,
|
|
191
|
-
fontWeight: "500",
|
|
192
|
-
},
|
|
193
|
-
|
|
194
|
-
outlineButton: {
|
|
195
|
-
backgroundColor: "transparent",
|
|
196
|
-
borderWidth: 1,
|
|
197
|
-
borderColor: theme.colors.border,
|
|
198
|
-
},
|
|
199
|
-
outlineText: {
|
|
200
|
-
color: theme.colors.foreground,
|
|
201
|
-
fontWeight: "500",
|
|
202
|
-
},
|
|
203
|
-
|
|
204
|
-
ghostButton: {
|
|
205
|
-
backgroundColor: "transparent",
|
|
206
|
-
borderWidth: 0,
|
|
207
|
-
},
|
|
208
|
-
ghostText: {
|
|
209
|
-
color: theme.colors.foreground,
|
|
210
|
-
fontWeight: "500",
|
|
211
|
-
},
|
|
212
|
-
|
|
213
|
-
destructiveButton: {
|
|
214
|
-
backgroundColor: theme.colors.destructive,
|
|
215
|
-
borderWidth: 0,
|
|
216
|
-
...theme.shadows.sm,
|
|
217
|
-
},
|
|
218
|
-
destructiveText: {
|
|
219
|
-
color: theme.colors.destructiveForeground,
|
|
220
|
-
fontWeight: "600",
|
|
221
|
-
},
|
|
222
|
-
|
|
223
|
-
successButton: {
|
|
224
|
-
backgroundColor: theme.colors.success,
|
|
225
|
-
borderWidth: 0,
|
|
226
|
-
...theme.shadows.sm,
|
|
227
|
-
},
|
|
228
|
-
successText: {
|
|
229
|
-
color: theme.colors.successForeground,
|
|
230
|
-
fontWeight: "600",
|
|
231
|
-
},
|
|
232
|
-
|
|
233
|
-
pillButton: {
|
|
234
|
-
paddingHorizontal: theme.spacing[2],
|
|
235
|
-
paddingVertical: theme.spacing[1],
|
|
236
|
-
borderRadius: tokens.borderRadius.full,
|
|
237
|
-
minHeight: tokens.touchTargets.minimum / 2,
|
|
238
|
-
},
|
|
239
|
-
|
|
240
|
-
pillText: {
|
|
241
|
-
color: theme.colors.primaryForeground,
|
|
242
|
-
fontWeight: "400",
|
|
243
|
-
},
|
|
244
|
-
|
|
245
|
-
// Size styles
|
|
246
|
-
smButton: {
|
|
247
|
-
paddingHorizontal: theme.spacing[3],
|
|
248
|
-
paddingVertical: theme.spacing[2],
|
|
249
|
-
borderRadius: tokens.borderRadius.md,
|
|
250
|
-
minHeight: tokens.touchTargets.minimum,
|
|
251
|
-
gap: theme.spacing[1],
|
|
252
|
-
},
|
|
253
|
-
smButtonInner: {
|
|
254
|
-
gap: theme.spacing[1],
|
|
255
|
-
},
|
|
256
|
-
smText: {
|
|
257
|
-
fontSize: 14,
|
|
258
|
-
lineHeight: 16,
|
|
259
|
-
},
|
|
260
|
-
|
|
261
|
-
mdButton: {
|
|
262
|
-
paddingHorizontal: theme.spacing[4],
|
|
263
|
-
paddingVertical: theme.spacing[3],
|
|
264
|
-
borderRadius: tokens.borderRadius.md,
|
|
265
|
-
minHeight: tokens.touchTargets.minimum,
|
|
266
|
-
gap: theme.spacing[2],
|
|
267
|
-
},
|
|
268
|
-
mdButtonInner: {
|
|
269
|
-
gap: theme.spacing[2],
|
|
270
|
-
},
|
|
271
|
-
mdText: {
|
|
272
|
-
fontSize: 16,
|
|
273
|
-
lineHeight: 18,
|
|
274
|
-
},
|
|
275
|
-
|
|
276
|
-
lgButton: {
|
|
277
|
-
paddingHorizontal: theme.spacing[6],
|
|
278
|
-
paddingVertical: theme.spacing[4],
|
|
279
|
-
borderRadius: tokens.borderRadius.md,
|
|
280
|
-
minHeight: tokens.touchTargets.comfortable,
|
|
281
|
-
gap: theme.spacing[3],
|
|
282
|
-
},
|
|
283
|
-
lgButtonInner: {
|
|
284
|
-
gap: theme.spacing[3],
|
|
285
|
-
},
|
|
286
|
-
lgText: {
|
|
287
|
-
fontSize: 18,
|
|
288
|
-
lineHeight: 20,
|
|
289
|
-
},
|
|
290
|
-
|
|
291
|
-
xlButton: {
|
|
292
|
-
paddingHorizontal: theme.spacing[8],
|
|
293
|
-
paddingVertical: theme.spacing[5],
|
|
294
|
-
borderRadius: tokens.borderRadius.lg,
|
|
295
|
-
minHeight: tokens.touchTargets.large,
|
|
296
|
-
gap: theme.spacing[4],
|
|
297
|
-
},
|
|
298
|
-
xlButtonInner: {
|
|
299
|
-
gap: theme.spacing[4],
|
|
300
|
-
},
|
|
301
|
-
xlText: {
|
|
302
|
-
fontSize: 20,
|
|
303
|
-
lineHeight: 24,
|
|
304
|
-
},
|
|
305
|
-
});
|
|
306
|
-
}
|
|
307
|
-
|
|
308
246
|
// Export button variants for external use
|
|
309
247
|
export { buttonVariants };
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { cva, type VariantProps } from "class-variance-authority";
|
|
2
2
|
import { X } from "lucide-react-native";
|
|
3
3
|
import React, { forwardRef } from "react";
|
|
4
|
-
import { Platform,
|
|
4
|
+
import { Platform, Text } from "react-native";
|
|
5
5
|
import { useTheme } from "../../lib/theme/theme";
|
|
6
|
+
import * as zero from "../../ui";
|
|
6
7
|
import { createThemedIcon } from "./icons";
|
|
7
8
|
import { ModalPrimitive, ModalPrimitiveProps } from "./primitives/modal";
|
|
8
9
|
|
|
@@ -67,10 +68,70 @@ export const Dialog = forwardRef<any, DialogProps>(
|
|
|
67
68
|
},
|
|
68
69
|
ref,
|
|
69
70
|
) => {
|
|
70
|
-
const { theme } = useTheme();
|
|
71
|
-
|
|
72
|
-
//
|
|
73
|
-
const
|
|
71
|
+
const { zero: zt, theme } = useTheme();
|
|
72
|
+
|
|
73
|
+
// Content styles using theme.zero
|
|
74
|
+
const contentStyles = React.useMemo(() => {
|
|
75
|
+
const baseStyle = [
|
|
76
|
+
zt.bg.card,
|
|
77
|
+
zero.r.lg,
|
|
78
|
+
zero.shadows.lg,
|
|
79
|
+
{ maxHeight: "90%", maxWidth: "90%" },
|
|
80
|
+
];
|
|
81
|
+
|
|
82
|
+
const variantStyle = (() => {
|
|
83
|
+
switch (variant) {
|
|
84
|
+
case "sheet":
|
|
85
|
+
return [
|
|
86
|
+
{ borderRadius: zero.borderRadius.xl },
|
|
87
|
+
{
|
|
88
|
+
borderBottomLeftRadius: 0,
|
|
89
|
+
borderBottomRightRadius: 0,
|
|
90
|
+
marginTop: "auto",
|
|
91
|
+
marginBottom: 0,
|
|
92
|
+
maxHeight: "80%",
|
|
93
|
+
width: "100%",
|
|
94
|
+
maxWidth: "100%",
|
|
95
|
+
},
|
|
96
|
+
];
|
|
97
|
+
case "fullscreen":
|
|
98
|
+
return [
|
|
99
|
+
{
|
|
100
|
+
width: "100%",
|
|
101
|
+
height: "100%",
|
|
102
|
+
maxWidth: "100%",
|
|
103
|
+
maxHeight: "100%",
|
|
104
|
+
borderRadius: 0,
|
|
105
|
+
margin: 0,
|
|
106
|
+
},
|
|
107
|
+
];
|
|
108
|
+
default:
|
|
109
|
+
return [];
|
|
110
|
+
}
|
|
111
|
+
})();
|
|
112
|
+
|
|
113
|
+
const sizeStyle = (() => {
|
|
114
|
+
switch (size) {
|
|
115
|
+
case "sm":
|
|
116
|
+
return { minWidth: 300, minHeight: 200 };
|
|
117
|
+
case "lg":
|
|
118
|
+
return { minWidth: 500, minHeight: 400 };
|
|
119
|
+
case "xl":
|
|
120
|
+
return { minWidth: 600, minHeight: 500 };
|
|
121
|
+
case "full":
|
|
122
|
+
return {
|
|
123
|
+
width: "95%",
|
|
124
|
+
height: "95%",
|
|
125
|
+
maxWidth: "95%",
|
|
126
|
+
maxHeight: "95%",
|
|
127
|
+
};
|
|
128
|
+
default:
|
|
129
|
+
return { minWidth: 400, minHeight: 300 };
|
|
130
|
+
}
|
|
131
|
+
})();
|
|
132
|
+
|
|
133
|
+
return [baseStyle, variantStyle, sizeStyle].flat();
|
|
134
|
+
}, [variant, size, zero]);
|
|
74
135
|
|
|
75
136
|
const handleClose = React.useCallback(() => {
|
|
76
137
|
if (onClose) {
|
|
@@ -112,27 +173,38 @@ export const Dialog = forwardRef<any, DialogProps>(
|
|
|
112
173
|
<ModalPrimitive.Overlay
|
|
113
174
|
dismissible={dismissible}
|
|
114
175
|
onDismiss={handleClose}
|
|
115
|
-
style={
|
|
176
|
+
style={zt.bg.overlay}
|
|
116
177
|
>
|
|
117
178
|
<ModalPrimitive.Content
|
|
118
179
|
position={position || "left"}
|
|
119
180
|
size={size || "md"}
|
|
120
|
-
style={
|
|
121
|
-
styles.content,
|
|
122
|
-
styles[`${variant}Content` as keyof typeof styles],
|
|
123
|
-
styles[`${size}Content` as keyof typeof styles],
|
|
124
|
-
]}
|
|
181
|
+
style={contentStyles}
|
|
125
182
|
>
|
|
126
183
|
{(title || showCloseButton) && (
|
|
127
184
|
<ModalPrimitive.Header
|
|
128
185
|
withBorder={variant !== "sheet"}
|
|
129
|
-
style={
|
|
186
|
+
style={[
|
|
187
|
+
zero.p[4],
|
|
188
|
+
{
|
|
189
|
+
flexDirection: "row",
|
|
190
|
+
alignItems: "center",
|
|
191
|
+
justifyContent: "space-between",
|
|
192
|
+
},
|
|
193
|
+
]}
|
|
130
194
|
>
|
|
131
195
|
<DialogTitle>{title}</DialogTitle>
|
|
132
196
|
{showCloseButton && (
|
|
133
197
|
<ModalPrimitive.Close
|
|
134
198
|
onClose={handleClose}
|
|
135
|
-
style={
|
|
199
|
+
style={[
|
|
200
|
+
zero.p[2],
|
|
201
|
+
{
|
|
202
|
+
width: 44,
|
|
203
|
+
height: 44,
|
|
204
|
+
alignItems: "center",
|
|
205
|
+
justifyContent: "center",
|
|
206
|
+
},
|
|
207
|
+
]}
|
|
136
208
|
>
|
|
137
209
|
<DialogCloseIcon />
|
|
138
210
|
</ModalPrimitive.Close>
|
|
@@ -142,7 +214,7 @@ export const Dialog = forwardRef<any, DialogProps>(
|
|
|
142
214
|
|
|
143
215
|
<ModalPrimitive.Body
|
|
144
216
|
scrollable={variant !== "fullscreen"}
|
|
145
|
-
style={
|
|
217
|
+
style={[zero.p[6], { paddingTop: 0, flex: 1 }]}
|
|
146
218
|
>
|
|
147
219
|
{description && (
|
|
148
220
|
<DialogDescription>{description}</DialogDescription>
|
|
@@ -166,13 +238,16 @@ export interface DialogTitleProps {
|
|
|
166
238
|
|
|
167
239
|
export const DialogTitle = forwardRef<any, DialogTitleProps>(
|
|
168
240
|
({ children, style, ...props }, ref) => {
|
|
169
|
-
const {
|
|
170
|
-
const styles = React.useMemo(() => createStyles(theme), [theme]);
|
|
241
|
+
const { zero: zt } = useTheme();
|
|
171
242
|
|
|
172
243
|
if (!children) return null;
|
|
173
244
|
|
|
174
245
|
return (
|
|
175
|
-
<Text
|
|
246
|
+
<Text
|
|
247
|
+
ref={ref}
|
|
248
|
+
style={[zt.text.xl, { fontWeight: "600", flex: 1 }, style]}
|
|
249
|
+
{...props}
|
|
250
|
+
>
|
|
176
251
|
{children}
|
|
177
252
|
</Text>
|
|
178
253
|
);
|
|
@@ -189,13 +264,12 @@ export interface DialogDescriptionProps {
|
|
|
189
264
|
|
|
190
265
|
export const DialogDescription = forwardRef<any, DialogDescriptionProps>(
|
|
191
266
|
({ children, style, ...props }, ref) => {
|
|
192
|
-
const {
|
|
193
|
-
const styles = React.useMemo(() => createStyles(theme), [theme]);
|
|
267
|
+
const { zero: zt } = useTheme();
|
|
194
268
|
|
|
195
269
|
if (!children) return null;
|
|
196
270
|
|
|
197
271
|
return (
|
|
198
|
-
<Text ref={ref} style={[
|
|
272
|
+
<Text ref={ref} style={[zt.text.muted, zero.mb[4], style]} {...props}>
|
|
199
273
|
{children}
|
|
200
274
|
</Text>
|
|
201
275
|
);
|
|
@@ -230,8 +304,7 @@ export const DialogFooter = forwardRef<any, DialogFooterProps>(
|
|
|
230
304
|
},
|
|
231
305
|
ref,
|
|
232
306
|
) => {
|
|
233
|
-
const {
|
|
234
|
-
const styles = React.useMemo(() => createStyles(theme), [theme]);
|
|
307
|
+
const { zero: zt } = useTheme();
|
|
235
308
|
|
|
236
309
|
if (!children) return null;
|
|
237
310
|
|
|
@@ -241,7 +314,7 @@ export const DialogFooter = forwardRef<any, DialogFooterProps>(
|
|
|
241
314
|
withBorder={withBorder}
|
|
242
315
|
direction={direction}
|
|
243
316
|
justify={justify}
|
|
244
|
-
style={[
|
|
317
|
+
style={[zero.p[6], { gap: 8 }, style]}
|
|
245
318
|
{...props}
|
|
246
319
|
>
|
|
247
320
|
{children}
|
|
@@ -257,120 +330,5 @@ const DialogCloseIcon = () => {
|
|
|
257
330
|
return <ThemedX size="md" variant="default" />;
|
|
258
331
|
};
|
|
259
332
|
|
|
260
|
-
// Create theme-aware styles
|
|
261
|
-
function createStyles(theme: any) {
|
|
262
|
-
return StyleSheet.create({
|
|
263
|
-
overlay: {
|
|
264
|
-
backgroundColor: "rgba(0, 0, 0, 0.5)",
|
|
265
|
-
},
|
|
266
|
-
|
|
267
|
-
content: {
|
|
268
|
-
backgroundColor: theme.colors.card,
|
|
269
|
-
borderRadius: theme.borderRadius.lg,
|
|
270
|
-
...theme.shadows.lg,
|
|
271
|
-
maxHeight: "90%",
|
|
272
|
-
maxWidth: "90%",
|
|
273
|
-
},
|
|
274
|
-
|
|
275
|
-
// Variant styles
|
|
276
|
-
defaultContent: {
|
|
277
|
-
// Default styles already applied in content
|
|
278
|
-
},
|
|
279
|
-
|
|
280
|
-
sheetContent: {
|
|
281
|
-
borderTopLeftRadius: theme.borderRadius.xl,
|
|
282
|
-
borderTopRightRadius: theme.borderRadius.xl,
|
|
283
|
-
borderBottomLeftRadius: 0,
|
|
284
|
-
borderBottomRightRadius: 0,
|
|
285
|
-
marginTop: "auto",
|
|
286
|
-
marginBottom: 0,
|
|
287
|
-
maxHeight: "80%",
|
|
288
|
-
width: "100%",
|
|
289
|
-
maxWidth: "100%",
|
|
290
|
-
},
|
|
291
|
-
|
|
292
|
-
fullscreenContent: {
|
|
293
|
-
width: "100%",
|
|
294
|
-
height: "100%",
|
|
295
|
-
maxWidth: "100%",
|
|
296
|
-
maxHeight: "100%",
|
|
297
|
-
borderRadius: 0,
|
|
298
|
-
margin: 0,
|
|
299
|
-
},
|
|
300
|
-
|
|
301
|
-
// Size styles
|
|
302
|
-
smContent: {
|
|
303
|
-
minWidth: 300,
|
|
304
|
-
minHeight: 200,
|
|
305
|
-
},
|
|
306
|
-
|
|
307
|
-
mdContent: {
|
|
308
|
-
minWidth: 400,
|
|
309
|
-
minHeight: 300,
|
|
310
|
-
},
|
|
311
|
-
|
|
312
|
-
lgContent: {
|
|
313
|
-
minWidth: 500,
|
|
314
|
-
minHeight: 400,
|
|
315
|
-
},
|
|
316
|
-
|
|
317
|
-
xlContent: {
|
|
318
|
-
minWidth: 600,
|
|
319
|
-
minHeight: 500,
|
|
320
|
-
},
|
|
321
|
-
|
|
322
|
-
fullContent: {
|
|
323
|
-
width: "95%",
|
|
324
|
-
height: "95%",
|
|
325
|
-
maxWidth: "95%",
|
|
326
|
-
maxHeight: "95%",
|
|
327
|
-
},
|
|
328
|
-
|
|
329
|
-
header: {
|
|
330
|
-
paddingHorizontal: theme.spacing[6],
|
|
331
|
-
paddingVertical: theme.spacing[4],
|
|
332
|
-
flexDirection: "row",
|
|
333
|
-
alignItems: "center",
|
|
334
|
-
justifyContent: "space-between",
|
|
335
|
-
},
|
|
336
|
-
|
|
337
|
-
body: {
|
|
338
|
-
paddingHorizontal: theme.spacing[6],
|
|
339
|
-
paddingBottom: theme.spacing[6],
|
|
340
|
-
flex: 1,
|
|
341
|
-
},
|
|
342
|
-
|
|
343
|
-
footer: {
|
|
344
|
-
paddingHorizontal: theme.spacing[6],
|
|
345
|
-
paddingVertical: theme.spacing[4],
|
|
346
|
-
gap: theme.spacing[2],
|
|
347
|
-
},
|
|
348
|
-
|
|
349
|
-
title: {
|
|
350
|
-
fontSize: 20,
|
|
351
|
-
fontWeight: "600",
|
|
352
|
-
color: theme.colors.text,
|
|
353
|
-
flex: 1,
|
|
354
|
-
lineHeight: 24,
|
|
355
|
-
},
|
|
356
|
-
|
|
357
|
-
description: {
|
|
358
|
-
fontSize: 16,
|
|
359
|
-
color: theme.colors.textMuted,
|
|
360
|
-
lineHeight: 22,
|
|
361
|
-
marginBottom: theme.spacing[4],
|
|
362
|
-
},
|
|
363
|
-
|
|
364
|
-
closeButton: {
|
|
365
|
-
width: theme.touchTargets.minimum,
|
|
366
|
-
height: theme.touchTargets.minimum,
|
|
367
|
-
alignItems: "center",
|
|
368
|
-
justifyContent: "center",
|
|
369
|
-
borderRadius: theme.borderRadius.sm,
|
|
370
|
-
marginLeft: theme.spacing[2],
|
|
371
|
-
},
|
|
372
|
-
});
|
|
373
|
-
}
|
|
374
|
-
|
|
375
333
|
// Export dialog variants for external use
|
|
376
334
|
export { dialogVariants };
|