@streamplace/components 0.7.26 → 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 +37 -1
- package/dist/components/mobile-player/video.native.js +10 -1
- 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/crypto-polyfill.js +0 -0
- package/dist/crypto-polyfill.native.js +24 -0
- package/dist/index.js +1 -0
- 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/livestream-store/chat.js +0 -2
- package/dist/livestream-store/stream-key.js +1 -1
- package/dist/player-store/player-provider.js +10 -2
- package/dist/player-store/single-player-provider.js +1 -1
- package/dist/streamplace-store/stream.js +1 -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 +41 -1
- package/src/components/mobile-player/video.native.tsx +19 -4
- 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/crypto-polyfill.native.tsx +24 -0
- package/src/crypto-polyfill.tsx +0 -0
- package/src/index.tsx +2 -0
- 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/livestream-store/chat.tsx +0 -3
- package/src/livestream-store/stream-key.tsx +1 -1
- package/src/player-store/player-provider.tsx +13 -1
- package/src/player-store/single-player-provider.tsx +1 -1
- package/src/streamplace-store/stream.tsx +1 -1
- package/src/ui/index.ts +0 -2
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -8,6 +8,7 @@ const lucide_react_native_1 = require("lucide-react-native");
|
|
|
8
8
|
const react_1 = tslib_1.__importStar(require("react"));
|
|
9
9
|
const react_native_1 = require("react-native");
|
|
10
10
|
const theme_1 = require("../../lib/theme/theme");
|
|
11
|
+
const zero = tslib_1.__importStar(require("../../ui"));
|
|
11
12
|
const icons_1 = require("./icons");
|
|
12
13
|
const modal_1 = require("./primitives/modal");
|
|
13
14
|
const ThemedX = (0, icons_1.createThemedIcon)(lucide_react_native_1.X);
|
|
@@ -42,9 +43,66 @@ const dialogVariants = (0, class_variance_authority_1.cva)("", {
|
|
|
42
43
|
});
|
|
43
44
|
exports.dialogVariants = dialogVariants;
|
|
44
45
|
exports.Dialog = (0, react_1.forwardRef)(({ variant = "left", size = "md", position = "center", children, title, description, dismissible = true, showCloseButton = true, onClose, open = false, onOpenChange, ...props }, ref) => {
|
|
45
|
-
const { theme } = (0, theme_1.useTheme)();
|
|
46
|
-
//
|
|
47
|
-
const
|
|
46
|
+
const { zero: zt, theme } = (0, theme_1.useTheme)();
|
|
47
|
+
// Content styles using theme.zero
|
|
48
|
+
const contentStyles = react_1.default.useMemo(() => {
|
|
49
|
+
const baseStyle = [
|
|
50
|
+
zt.bg.card,
|
|
51
|
+
zero.r.lg,
|
|
52
|
+
zero.shadows.lg,
|
|
53
|
+
{ maxHeight: "90%", maxWidth: "90%" },
|
|
54
|
+
];
|
|
55
|
+
const variantStyle = (() => {
|
|
56
|
+
switch (variant) {
|
|
57
|
+
case "sheet":
|
|
58
|
+
return [
|
|
59
|
+
{ borderRadius: zero.borderRadius.xl },
|
|
60
|
+
{
|
|
61
|
+
borderBottomLeftRadius: 0,
|
|
62
|
+
borderBottomRightRadius: 0,
|
|
63
|
+
marginTop: "auto",
|
|
64
|
+
marginBottom: 0,
|
|
65
|
+
maxHeight: "80%",
|
|
66
|
+
width: "100%",
|
|
67
|
+
maxWidth: "100%",
|
|
68
|
+
},
|
|
69
|
+
];
|
|
70
|
+
case "fullscreen":
|
|
71
|
+
return [
|
|
72
|
+
{
|
|
73
|
+
width: "100%",
|
|
74
|
+
height: "100%",
|
|
75
|
+
maxWidth: "100%",
|
|
76
|
+
maxHeight: "100%",
|
|
77
|
+
borderRadius: 0,
|
|
78
|
+
margin: 0,
|
|
79
|
+
},
|
|
80
|
+
];
|
|
81
|
+
default:
|
|
82
|
+
return [];
|
|
83
|
+
}
|
|
84
|
+
})();
|
|
85
|
+
const sizeStyle = (() => {
|
|
86
|
+
switch (size) {
|
|
87
|
+
case "sm":
|
|
88
|
+
return { minWidth: 300, minHeight: 200 };
|
|
89
|
+
case "lg":
|
|
90
|
+
return { minWidth: 500, minHeight: 400 };
|
|
91
|
+
case "xl":
|
|
92
|
+
return { minWidth: 600, minHeight: 500 };
|
|
93
|
+
case "full":
|
|
94
|
+
return {
|
|
95
|
+
width: "95%",
|
|
96
|
+
height: "95%",
|
|
97
|
+
maxWidth: "95%",
|
|
98
|
+
maxHeight: "95%",
|
|
99
|
+
};
|
|
100
|
+
default:
|
|
101
|
+
return { minWidth: 400, minHeight: 300 };
|
|
102
|
+
}
|
|
103
|
+
})();
|
|
104
|
+
return [baseStyle, variantStyle, sizeStyle].flat();
|
|
105
|
+
}, [variant, size, zero]);
|
|
48
106
|
const handleClose = react_1.default.useCallback(() => {
|
|
49
107
|
if (onClose) {
|
|
50
108
|
onClose();
|
|
@@ -70,137 +128,46 @@ exports.Dialog = (0, react_1.forwardRef)(({ variant = "left", size = "md", posit
|
|
|
70
128
|
}
|
|
71
129
|
return "fade";
|
|
72
130
|
}, [variant]);
|
|
73
|
-
return ((0, jsx_runtime_1.jsx)(modal_1.ModalPrimitive.Root, { ref: ref, open: open, onOpenChange: onOpenChange, presentationStyle: presentationStyle, animationType: animationType, ...props, children: (0, jsx_runtime_1.jsx)(modal_1.ModalPrimitive.Overlay, { dismissible: dismissible, onDismiss: handleClose, style:
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
131
|
+
return ((0, jsx_runtime_1.jsx)(modal_1.ModalPrimitive.Root, { ref: ref, open: open, onOpenChange: onOpenChange, presentationStyle: presentationStyle, animationType: animationType, ...props, children: (0, jsx_runtime_1.jsx)(modal_1.ModalPrimitive.Overlay, { dismissible: dismissible, onDismiss: handleClose, style: zt.bg.overlay, children: (0, jsx_runtime_1.jsxs)(modal_1.ModalPrimitive.Content, { position: position || "left", size: size || "md", style: contentStyles, children: [(title || showCloseButton) && ((0, jsx_runtime_1.jsxs)(modal_1.ModalPrimitive.Header, { withBorder: variant !== "sheet", style: [
|
|
132
|
+
zero.p[4],
|
|
133
|
+
{
|
|
134
|
+
flexDirection: "row",
|
|
135
|
+
alignItems: "center",
|
|
136
|
+
justifyContent: "space-between",
|
|
137
|
+
},
|
|
138
|
+
], children: [(0, jsx_runtime_1.jsx)(exports.DialogTitle, { children: title }), showCloseButton && ((0, jsx_runtime_1.jsx)(modal_1.ModalPrimitive.Close, { onClose: handleClose, style: [
|
|
139
|
+
zero.p[2],
|
|
140
|
+
{
|
|
141
|
+
width: 44,
|
|
142
|
+
height: 44,
|
|
143
|
+
alignItems: "center",
|
|
144
|
+
justifyContent: "center",
|
|
145
|
+
},
|
|
146
|
+
], children: (0, jsx_runtime_1.jsx)(DialogCloseIcon, {}) }))] })), (0, jsx_runtime_1.jsxs)(modal_1.ModalPrimitive.Body, { scrollable: variant !== "fullscreen", style: [zero.p[6], { paddingTop: 0, flex: 1 }], children: [description && ((0, jsx_runtime_1.jsx)(exports.DialogDescription, { children: description })), children] })] }) }) }));
|
|
78
147
|
});
|
|
79
148
|
exports.Dialog.displayName = "Dialog";
|
|
80
149
|
exports.DialogTitle = (0, react_1.forwardRef)(({ children, style, ...props }, ref) => {
|
|
81
|
-
const {
|
|
82
|
-
const styles = react_1.default.useMemo(() => createStyles(theme), [theme]);
|
|
150
|
+
const { zero: zt } = (0, theme_1.useTheme)();
|
|
83
151
|
if (!children)
|
|
84
152
|
return null;
|
|
85
|
-
return ((0, jsx_runtime_1.jsx)(react_native_1.Text, { ref: ref, style: [
|
|
153
|
+
return ((0, jsx_runtime_1.jsx)(react_native_1.Text, { ref: ref, style: [zt.text.xl, { fontWeight: "600", flex: 1 }, style], ...props, children: children }));
|
|
86
154
|
});
|
|
87
155
|
exports.DialogTitle.displayName = "DialogTitle";
|
|
88
156
|
exports.DialogDescription = (0, react_1.forwardRef)(({ children, style, ...props }, ref) => {
|
|
89
|
-
const {
|
|
90
|
-
const styles = react_1.default.useMemo(() => createStyles(theme), [theme]);
|
|
157
|
+
const { zero: zt } = (0, theme_1.useTheme)();
|
|
91
158
|
if (!children)
|
|
92
159
|
return null;
|
|
93
|
-
return ((0, jsx_runtime_1.jsx)(react_native_1.Text, { ref: ref, style: [
|
|
160
|
+
return ((0, jsx_runtime_1.jsx)(react_native_1.Text, { ref: ref, style: [zt.text.muted, zero.mb[4], style], ...props, children: children }));
|
|
94
161
|
});
|
|
95
162
|
exports.DialogDescription.displayName = "DialogDescription";
|
|
96
163
|
exports.DialogFooter = (0, react_1.forwardRef)(({ children, direction = "row", justify = "flex-end", withBorder = true, style, ...props }, ref) => {
|
|
97
|
-
const {
|
|
98
|
-
const styles = react_1.default.useMemo(() => createStyles(theme), [theme]);
|
|
164
|
+
const { zero: zt } = (0, theme_1.useTheme)();
|
|
99
165
|
if (!children)
|
|
100
166
|
return null;
|
|
101
|
-
return ((0, jsx_runtime_1.jsx)(modal_1.ModalPrimitive.Footer, { ref: ref, withBorder: withBorder, direction: direction, justify: justify, style: [
|
|
167
|
+
return ((0, jsx_runtime_1.jsx)(modal_1.ModalPrimitive.Footer, { ref: ref, withBorder: withBorder, direction: direction, justify: justify, style: [zero.p[6], { gap: 8 }, style], ...props, children: children }));
|
|
102
168
|
});
|
|
103
169
|
exports.DialogFooter.displayName = "DialogFooter";
|
|
104
170
|
// Dialog Close Icon component (Lucide X)
|
|
105
171
|
const DialogCloseIcon = () => {
|
|
106
172
|
return (0, jsx_runtime_1.jsx)(ThemedX, { size: "md", variant: "default" });
|
|
107
173
|
};
|
|
108
|
-
// Create theme-aware styles
|
|
109
|
-
function createStyles(theme) {
|
|
110
|
-
return react_native_1.StyleSheet.create({
|
|
111
|
-
overlay: {
|
|
112
|
-
backgroundColor: "rgba(0, 0, 0, 0.5)",
|
|
113
|
-
},
|
|
114
|
-
content: {
|
|
115
|
-
backgroundColor: theme.colors.card,
|
|
116
|
-
borderRadius: theme.borderRadius.lg,
|
|
117
|
-
...theme.shadows.lg,
|
|
118
|
-
maxHeight: "90%",
|
|
119
|
-
maxWidth: "90%",
|
|
120
|
-
},
|
|
121
|
-
// Variant styles
|
|
122
|
-
defaultContent: {
|
|
123
|
-
// Default styles already applied in content
|
|
124
|
-
},
|
|
125
|
-
sheetContent: {
|
|
126
|
-
borderTopLeftRadius: theme.borderRadius.xl,
|
|
127
|
-
borderTopRightRadius: theme.borderRadius.xl,
|
|
128
|
-
borderBottomLeftRadius: 0,
|
|
129
|
-
borderBottomRightRadius: 0,
|
|
130
|
-
marginTop: "auto",
|
|
131
|
-
marginBottom: 0,
|
|
132
|
-
maxHeight: "80%",
|
|
133
|
-
width: "100%",
|
|
134
|
-
maxWidth: "100%",
|
|
135
|
-
},
|
|
136
|
-
fullscreenContent: {
|
|
137
|
-
width: "100%",
|
|
138
|
-
height: "100%",
|
|
139
|
-
maxWidth: "100%",
|
|
140
|
-
maxHeight: "100%",
|
|
141
|
-
borderRadius: 0,
|
|
142
|
-
margin: 0,
|
|
143
|
-
},
|
|
144
|
-
// Size styles
|
|
145
|
-
smContent: {
|
|
146
|
-
minWidth: 300,
|
|
147
|
-
minHeight: 200,
|
|
148
|
-
},
|
|
149
|
-
mdContent: {
|
|
150
|
-
minWidth: 400,
|
|
151
|
-
minHeight: 300,
|
|
152
|
-
},
|
|
153
|
-
lgContent: {
|
|
154
|
-
minWidth: 500,
|
|
155
|
-
minHeight: 400,
|
|
156
|
-
},
|
|
157
|
-
xlContent: {
|
|
158
|
-
minWidth: 600,
|
|
159
|
-
minHeight: 500,
|
|
160
|
-
},
|
|
161
|
-
fullContent: {
|
|
162
|
-
width: "95%",
|
|
163
|
-
height: "95%",
|
|
164
|
-
maxWidth: "95%",
|
|
165
|
-
maxHeight: "95%",
|
|
166
|
-
},
|
|
167
|
-
header: {
|
|
168
|
-
paddingHorizontal: theme.spacing[6],
|
|
169
|
-
paddingVertical: theme.spacing[4],
|
|
170
|
-
flexDirection: "row",
|
|
171
|
-
alignItems: "center",
|
|
172
|
-
justifyContent: "space-between",
|
|
173
|
-
},
|
|
174
|
-
body: {
|
|
175
|
-
paddingHorizontal: theme.spacing[6],
|
|
176
|
-
paddingBottom: theme.spacing[6],
|
|
177
|
-
flex: 1,
|
|
178
|
-
},
|
|
179
|
-
footer: {
|
|
180
|
-
paddingHorizontal: theme.spacing[6],
|
|
181
|
-
paddingVertical: theme.spacing[4],
|
|
182
|
-
gap: theme.spacing[2],
|
|
183
|
-
},
|
|
184
|
-
title: {
|
|
185
|
-
fontSize: 20,
|
|
186
|
-
fontWeight: "600",
|
|
187
|
-
color: theme.colors.text,
|
|
188
|
-
flex: 1,
|
|
189
|
-
lineHeight: 24,
|
|
190
|
-
},
|
|
191
|
-
description: {
|
|
192
|
-
fontSize: 16,
|
|
193
|
-
color: theme.colors.textMuted,
|
|
194
|
-
lineHeight: 22,
|
|
195
|
-
marginBottom: theme.spacing[4],
|
|
196
|
-
},
|
|
197
|
-
closeButton: {
|
|
198
|
-
width: theme.touchTargets.minimum,
|
|
199
|
-
height: theme.touchTargets.minimum,
|
|
200
|
-
alignItems: "center",
|
|
201
|
-
justifyContent: "center",
|
|
202
|
-
borderRadius: theme.borderRadius.sm,
|
|
203
|
-
marginLeft: theme.spacing[2],
|
|
204
|
-
},
|
|
205
|
-
});
|
|
206
|
-
}
|
|
@@ -10,6 +10,7 @@ const lucide_react_native_1 = require("lucide-react-native");
|
|
|
10
10
|
const react_1 = require("react");
|
|
11
11
|
const react_native_1 = require("react-native");
|
|
12
12
|
const atoms_1 = require("../../lib/theme/atoms");
|
|
13
|
+
const ui_1 = require("../../ui");
|
|
13
14
|
const text_1 = require("./primitives/text");
|
|
14
15
|
exports.DropdownMenu = DropdownMenuPrimitive.Root;
|
|
15
16
|
exports.DropdownMenuTrigger = DropdownMenuPrimitive.Trigger;
|
|
@@ -19,20 +20,22 @@ exports.DropdownMenuRadioGroup = DropdownMenuPrimitive.RadioGroup;
|
|
|
19
20
|
exports.DropdownMenuBottomSheet = (0, react_1.forwardRef)(function DropdownMenuBottomSheet({ overlayStyle, portalHost, children }, _ref) {
|
|
20
21
|
// Use the primitives' context to know if open
|
|
21
22
|
const { open, onOpenChange } = DropdownMenuPrimitive.useRootContext();
|
|
23
|
+
const { zero: zt } = (0, ui_1.useTheme)();
|
|
22
24
|
const snapPoints = (0, react_1.useMemo)(() => ["25%", "50%", "80%"], []);
|
|
23
25
|
const sheetRef = (0, react_1.useRef)(null);
|
|
24
26
|
return ((0, jsx_runtime_1.jsx)(DropdownMenuPrimitive.Portal, { hostName: portalHost, children: (0, jsx_runtime_1.jsx)(bottom_sheet_1.default, { ref: sheetRef,
|
|
25
27
|
// why the heck is this 1-indexed
|
|
26
|
-
index: open ? 3 : -1, snapPoints: snapPoints, enablePanDownToClose: true, enableDynamicSizing: true, enableContentPanningGesture: false, backdropComponent: ({ style }) => ((0, jsx_runtime_1.jsx)(react_native_1.Pressable, { style: [style, react_native_1.StyleSheet.absoluteFill], onPress: () => onOpenChange?.(false) })), onClose: () => onOpenChange?.(false), style: [overlayStyle], backgroundStyle: [
|
|
28
|
+
index: open ? 3 : -1, snapPoints: snapPoints, enablePanDownToClose: true, enableDynamicSizing: true, enableContentPanningGesture: false, backdropComponent: ({ style }) => ((0, jsx_runtime_1.jsx)(react_native_1.Pressable, { style: [style, react_native_1.StyleSheet.absoluteFill], onPress: () => onOpenChange?.(false) })), onClose: () => onOpenChange?.(false), style: [overlayStyle], backgroundStyle: [zt.bg.popover, atoms_1.a.radius.all.md, atoms_1.a.shadows.md, atoms_1.p[1]], handleIndicatorStyle: [
|
|
27
29
|
atoms_1.a.sizes.width[12],
|
|
28
30
|
atoms_1.a.sizes.height[1],
|
|
29
|
-
|
|
31
|
+
zt.bg.mutedForeground,
|
|
30
32
|
], children: (0, jsx_runtime_1.jsx)(bottom_sheet_1.BottomSheetView, { style: [atoms_1.px[2]], children: typeof children === "function"
|
|
31
33
|
? children({ pressed: true })
|
|
32
34
|
: children }) }) }));
|
|
33
35
|
});
|
|
34
36
|
exports.DropdownMenuSubTrigger = (0, react_1.forwardRef)(({ inset, children, ...props }, ref) => {
|
|
35
37
|
const { open } = DropdownMenuPrimitive.useSubContext();
|
|
38
|
+
const { icons } = (0, ui_1.useTheme)();
|
|
36
39
|
const Icon = react_native_1.Platform.OS === "web" ? lucide_react_native_1.ChevronRight : open ? lucide_react_native_1.ChevronUp : lucide_react_native_1.ChevronDown;
|
|
37
40
|
return ((0, jsx_runtime_1.jsx)(text_1.TextContext.Provider, { value: (0, text_1.objectFromObjects)([
|
|
38
41
|
atoms_1.a.textColors.primary[500],
|
|
@@ -44,23 +47,25 @@ exports.DropdownMenuSubTrigger = (0, react_1.forwardRef)(({ inset, children, ...
|
|
|
44
47
|
atoms_1.layout.flex.alignCenter,
|
|
45
48
|
atoms_1.p[2],
|
|
46
49
|
atoms_1.pr[8],
|
|
47
|
-
], children: [children, (0, jsx_runtime_1.jsx)(react_native_1.View, { style: [atoms_1.a.layout.position.absolute, atoms_1.a.position.right[1]], children: (0, jsx_runtime_1.jsx)(Icon, { size: 18, color:
|
|
50
|
+
], children: [children, (0, jsx_runtime_1.jsx)(react_native_1.View, { style: [atoms_1.a.layout.position.absolute, atoms_1.a.position.right[1]], children: (0, jsx_runtime_1.jsx)(Icon, { size: 18, color: icons.color.muted }) })] }) }) }));
|
|
48
51
|
});
|
|
49
52
|
exports.DropdownMenuSubContent = (0, react_1.forwardRef)((props, ref) => {
|
|
53
|
+
const { zero: zt } = (0, ui_1.useTheme)();
|
|
50
54
|
return ((0, jsx_runtime_1.jsx)(DropdownMenuPrimitive.SubContent, { ref: ref, style: [
|
|
51
55
|
atoms_1.a.zIndex[50],
|
|
52
56
|
atoms_1.a.sizes.minWidth[32],
|
|
53
57
|
atoms_1.a.overflow.hidden,
|
|
54
58
|
atoms_1.a.radius.all.md,
|
|
55
59
|
atoms_1.a.borders.width.thin,
|
|
56
|
-
|
|
60
|
+
zt.border.default,
|
|
57
61
|
atoms_1.mt[1],
|
|
58
|
-
|
|
62
|
+
zt.bg.popover,
|
|
59
63
|
atoms_1.p[1],
|
|
60
64
|
atoms_1.a.shadows.md,
|
|
61
65
|
], ...props }));
|
|
62
66
|
});
|
|
63
67
|
exports.DropdownMenuContent = (0, react_1.forwardRef)(({ overlayStyle, portalHost, ...props }, ref) => {
|
|
68
|
+
const { zero: zt } = (0, ui_1.useTheme)();
|
|
64
69
|
return ((0, jsx_runtime_1.jsx)(DropdownMenuPrimitive.Portal, { hostName: portalHost, children: (0, jsx_runtime_1.jsx)(DropdownMenuPrimitive.Overlay, { style: [
|
|
65
70
|
react_native_1.Platform.OS !== "web" ? react_native_1.StyleSheet.absoluteFill : undefined,
|
|
66
71
|
overlayStyle,
|
|
@@ -71,13 +76,14 @@ exports.DropdownMenuContent = (0, react_1.forwardRef)(({ overlayStyle, portalHos
|
|
|
71
76
|
atoms_1.a.overflow.hidden,
|
|
72
77
|
atoms_1.a.radius.all.md,
|
|
73
78
|
atoms_1.a.borders.width.thin,
|
|
74
|
-
|
|
75
|
-
|
|
79
|
+
zt.border.default,
|
|
80
|
+
zt.bg.popover,
|
|
76
81
|
atoms_1.p[2],
|
|
77
82
|
atoms_1.a.shadows.md,
|
|
78
83
|
], ...props }) }) }));
|
|
79
84
|
});
|
|
80
85
|
exports.DropdownMenuContentWithoutPortal = (0, react_1.forwardRef)(({ overlayStyle, ...props }, ref) => {
|
|
86
|
+
const { theme } = (0, ui_1.useTheme)();
|
|
81
87
|
return ((0, jsx_runtime_1.jsx)(DropdownMenuPrimitive.Overlay, { style: [
|
|
82
88
|
react_native_1.Platform.OS !== "web" ? react_native_1.StyleSheet.absoluteFill : undefined,
|
|
83
89
|
overlayStyle,
|
|
@@ -88,8 +94,8 @@ exports.DropdownMenuContentWithoutPortal = (0, react_1.forwardRef)(({ overlaySty
|
|
|
88
94
|
atoms_1.a.overflow.hidden,
|
|
89
95
|
atoms_1.a.radius.all.md,
|
|
90
96
|
atoms_1.a.borders.width.thin,
|
|
91
|
-
|
|
92
|
-
|
|
97
|
+
{ borderColor: theme.colors.border },
|
|
98
|
+
{ backgroundColor: theme.colors.popover },
|
|
93
99
|
atoms_1.p[2],
|
|
94
100
|
atoms_1.a.shadows.md,
|
|
95
101
|
], ...props }) }));
|
|
@@ -106,7 +112,11 @@ exports.ResponsiveDropdownMenuContent = (0, react_1.forwardRef)(({ children, ...
|
|
|
106
112
|
return ((0, jsx_runtime_1.jsx)(exports.DropdownMenuContent, { ref: ref, ...props, children: children }));
|
|
107
113
|
});
|
|
108
114
|
exports.DropdownMenuItem = (0, react_1.forwardRef)(({ inset, disabled, style, children, ...props }, ref) => {
|
|
109
|
-
|
|
115
|
+
const { theme } = (0, ui_1.useTheme)();
|
|
116
|
+
return ((0, jsx_runtime_1.jsx)(react_native_1.Pressable, { ...props, children: (0, jsx_runtime_1.jsx)(text_1.TextContext.Provider, { value: (0, text_1.objectFromObjects)([
|
|
117
|
+
{ color: theme.colors.popoverForeground },
|
|
118
|
+
atoms_1.a.fontSize.base,
|
|
119
|
+
]), children: (0, jsx_runtime_1.jsx)(react_native_1.View, { style: [
|
|
110
120
|
atoms_1.a.layout.flex.row,
|
|
111
121
|
atoms_1.a.layout.flex.alignCenter,
|
|
112
122
|
atoms_1.a.radius.all.sm,
|
|
@@ -118,6 +128,7 @@ exports.DropdownMenuItem = (0, react_1.forwardRef)(({ inset, disabled, style, ch
|
|
|
118
128
|
: children }) }) }));
|
|
119
129
|
});
|
|
120
130
|
exports.DropdownMenuCheckboxItem = (0, react_1.forwardRef)(({ children, checked, ...props }, ref) => {
|
|
131
|
+
const { theme } = (0, ui_1.useTheme)();
|
|
121
132
|
return ((0, jsx_runtime_1.jsx)(DropdownMenuPrimitive.CheckboxItem, { ref: ref, checked: checked, closeOnPress: props.closeOnPress || false, ...props, children: (0, jsx_runtime_1.jsxs)(react_native_1.View, { style: [
|
|
122
133
|
atoms_1.a.layout.flex.row,
|
|
123
134
|
atoms_1.a.layout.flex.alignCenter,
|
|
@@ -126,9 +137,10 @@ exports.DropdownMenuCheckboxItem = (0, react_1.forwardRef)(({ children, checked,
|
|
|
126
137
|
atoms_1.pl[2],
|
|
127
138
|
atoms_1.pr[2],
|
|
128
139
|
atoms_1.pr[8],
|
|
129
|
-
], children: [children, (0, jsx_runtime_1.jsx)(react_native_1.View, { style: [atoms_1.pl[1], atoms_1.layout.position.absolute, atoms_1.right[1]], children: checked ? ((0, jsx_runtime_1.jsx)(lucide_react_native_1.CheckCircle, { size: 14, strokeWidth: 3, color:
|
|
140
|
+
], children: [children, (0, jsx_runtime_1.jsx)(react_native_1.View, { style: [atoms_1.pl[1], atoms_1.layout.position.absolute, atoms_1.right[1]], children: checked ? ((0, jsx_runtime_1.jsx)(lucide_react_native_1.CheckCircle, { size: 14, strokeWidth: 3, color: theme.colors.foreground })) : ((0, jsx_runtime_1.jsx)(lucide_react_native_1.Circle, { size: 14, strokeWidth: 3, color: theme.colors.mutedForeground })) })] }) }));
|
|
130
141
|
});
|
|
131
142
|
exports.DropdownMenuRadioItem = (0, react_1.forwardRef)(({ children, ...props }, ref) => {
|
|
143
|
+
const { theme } = (0, ui_1.useTheme)();
|
|
132
144
|
return ((0, jsx_runtime_1.jsx)(DropdownMenuPrimitive.RadioItem, { ref: ref, closeOnPress: props.closeOnPress || false, ...props, children: (0, jsx_runtime_1.jsxs)(react_native_1.View, { style: [
|
|
133
145
|
atoms_1.a.layout.flex.row,
|
|
134
146
|
atoms_1.a.layout.flex.alignCenter,
|
|
@@ -136,37 +148,48 @@ exports.DropdownMenuRadioItem = (0, react_1.forwardRef)(({ children, ...props },
|
|
|
136
148
|
atoms_1.py[1],
|
|
137
149
|
atoms_1.pl[2],
|
|
138
150
|
atoms_1.pr[1],
|
|
139
|
-
], children: [(0, jsx_runtime_1.jsx)(react_native_1.View, { style: [atoms_1.pl[1], atoms_1.layout.position.absolute, atoms_1.right[1]], children: (0, jsx_runtime_1.jsx)(DropdownMenuPrimitive.ItemIndicator, { children: (0, jsx_runtime_1.jsx)(lucide_react_native_1.Check, { size: 14, strokeWidth: 3, color:
|
|
151
|
+
], children: [(0, jsx_runtime_1.jsx)(react_native_1.View, { style: [atoms_1.pl[1], atoms_1.layout.position.absolute, atoms_1.right[1]], children: (0, jsx_runtime_1.jsx)(DropdownMenuPrimitive.ItemIndicator, { children: (0, jsx_runtime_1.jsx)(lucide_react_native_1.Check, { size: 14, strokeWidth: 3, color: theme.colors.foreground }) }) }), children] }) }));
|
|
140
152
|
});
|
|
141
153
|
exports.DropdownMenuLabel = (0, react_1.forwardRef)(({ inset, ...props }, ref) => {
|
|
154
|
+
const { theme } = (0, ui_1.useTheme)();
|
|
142
155
|
return ((0, jsx_runtime_1.jsx)(react_native_1.Text, { ref: ref, style: [
|
|
143
156
|
atoms_1.px[2],
|
|
144
157
|
atoms_1.py[2],
|
|
145
|
-
|
|
158
|
+
{ color: theme.colors.textMuted },
|
|
146
159
|
atoms_1.a.fontSize.base,
|
|
147
160
|
inset && atoms_1.gap[2],
|
|
148
161
|
], ...props }));
|
|
149
162
|
});
|
|
150
163
|
exports.DropdownMenuSeparator = (0, react_1.forwardRef)((props, ref) => {
|
|
151
|
-
|
|
164
|
+
const { theme } = (0, ui_1.useTheme)();
|
|
165
|
+
return ((0, jsx_runtime_1.jsx)(react_native_1.View, { ref: ref, style: [{ height: 0.5 }, { backgroundColor: theme.colors.border }], ...props }));
|
|
152
166
|
});
|
|
153
167
|
function DropdownMenuShortcut(props) {
|
|
168
|
+
const { theme } = (0, ui_1.useTheme)();
|
|
154
169
|
return ((0, jsx_runtime_1.jsx)(react_native_1.Text, { style: [
|
|
155
170
|
atoms_1.ml.auto,
|
|
156
|
-
|
|
171
|
+
{ color: theme.colors.textMuted },
|
|
157
172
|
atoms_1.a.fontSize.sm,
|
|
158
173
|
atoms_1.a.letterSpacing.widest,
|
|
159
174
|
], ...props }));
|
|
160
175
|
}
|
|
161
176
|
exports.DropdownMenuGroup = (0, react_1.forwardRef)((props, ref) => {
|
|
177
|
+
const { theme } = (0, ui_1.useTheme)();
|
|
162
178
|
const { inset, title, children, ...rest } = props;
|
|
163
|
-
return ((0, jsx_runtime_1.jsxs)(react_native_1.View, { style: [atoms_1.pt[2], inset && atoms_1.gap[2]], ref: ref, ...rest, children: [title && ((0, jsx_runtime_1.jsx)(react_native_1.Text, { style: [
|
|
164
|
-
|
|
179
|
+
return ((0, jsx_runtime_1.jsxs)(react_native_1.View, { style: [atoms_1.pt[2], inset && atoms_1.gap[2]], ref: ref, ...rest, children: [title && ((0, jsx_runtime_1.jsx)(react_native_1.Text, { style: [{ color: theme.colors.textMuted }, atoms_1.pb[1], atoms_1.pl[2]], children: title })), (0, jsx_runtime_1.jsx)(react_native_1.View, { style: [
|
|
180
|
+
{ backgroundColor: theme.colors.muted },
|
|
165
181
|
react_native_1.Platform.OS === "web" ? [atoms_1.px[2], atoms_1.py[1]] : atoms_1.p[2],
|
|
166
182
|
atoms_1.gap.all[1],
|
|
167
183
|
{ borderRadius: atoms_1.borderRadius.lg },
|
|
168
184
|
], children: children })] }));
|
|
169
185
|
});
|
|
170
186
|
exports.DropdownMenuInfo = (0, react_1.forwardRef)(({ description, ...props }, ref) => {
|
|
171
|
-
|
|
187
|
+
const { theme } = (0, ui_1.useTheme)();
|
|
188
|
+
return ((0, jsx_runtime_1.jsx)(react_native_1.Text, { style: [
|
|
189
|
+
{ color: theme.colors.textMuted },
|
|
190
|
+
atoms_1.pt[1],
|
|
191
|
+
atoms_1.pl[2],
|
|
192
|
+
atoms_1.pb[2],
|
|
193
|
+
atoms_1.fontSize.sm,
|
|
194
|
+
], children: description }));
|
|
172
195
|
});
|
|
@@ -7,6 +7,7 @@ const class_variance_authority_1 = require("class-variance-authority");
|
|
|
7
7
|
const react_1 = tslib_1.__importStar(require("react"));
|
|
8
8
|
const react_native_1 = require("react-native");
|
|
9
9
|
const theme_1 = require("../../lib/theme/theme");
|
|
10
|
+
const zero = tslib_1.__importStar(require("../../ui"));
|
|
10
11
|
const input_1 = require("./primitives/input");
|
|
11
12
|
const inputVariants = (0, class_variance_authority_1.cva)("", {
|
|
12
13
|
variants: {
|
|
@@ -28,23 +29,61 @@ const inputVariants = (0, class_variance_authority_1.cva)("", {
|
|
|
28
29
|
});
|
|
29
30
|
exports.inputVariants = inputVariants;
|
|
30
31
|
exports.Input = (0, react_1.forwardRef)(({ variant = "default", size = "md", label, description, error, required = false, leftAddon, rightAddon, disabled = false, containerStyle, inputStyle, ...props }, ref) => {
|
|
31
|
-
const { theme } = (0, theme_1.useTheme)();
|
|
32
|
+
const { zero: zt, theme } = (0, theme_1.useTheme)();
|
|
32
33
|
const [isFocused, setIsFocused] = react_1.default.useState(false);
|
|
33
34
|
const inputRef = react_1.default.useRef(null);
|
|
34
|
-
//
|
|
35
|
-
const styles = react_1.default.useMemo(() => createStyles(theme), [theme]);
|
|
36
|
-
// Get variant and size styles
|
|
35
|
+
// Get variant and size styles using theme.zero
|
|
37
36
|
const containerStyles = react_1.default.useMemo(() => {
|
|
38
|
-
const variantStyle =
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
37
|
+
const variantStyle = (() => {
|
|
38
|
+
switch (variant) {
|
|
39
|
+
case "filled":
|
|
40
|
+
return [zt.bg.muted];
|
|
41
|
+
case "underlined":
|
|
42
|
+
return [
|
|
43
|
+
zt.bg.transparent,
|
|
44
|
+
zt.border.bottom.default,
|
|
45
|
+
{ borderRadius: 0, paddingHorizontal: 0 },
|
|
46
|
+
];
|
|
47
|
+
default:
|
|
48
|
+
return [zt.bg.background, zt.border.default];
|
|
49
|
+
}
|
|
50
|
+
})();
|
|
51
|
+
const sizeStyle = (() => {
|
|
52
|
+
switch (size) {
|
|
53
|
+
case "sm":
|
|
54
|
+
return [
|
|
55
|
+
zero.px[3],
|
|
56
|
+
zero.py[2],
|
|
57
|
+
{ borderRadius: zero.borderRadius.md },
|
|
58
|
+
];
|
|
59
|
+
case "lg":
|
|
60
|
+
return [
|
|
61
|
+
zero.px[4],
|
|
62
|
+
zero.py[3],
|
|
63
|
+
{ borderRadius: zero.borderRadius.md },
|
|
64
|
+
];
|
|
65
|
+
default:
|
|
66
|
+
return [
|
|
67
|
+
zero.px[3],
|
|
68
|
+
zero.py[2],
|
|
69
|
+
{ borderRadius: zero.borderRadius.md },
|
|
70
|
+
];
|
|
71
|
+
}
|
|
72
|
+
})();
|
|
73
|
+
const focusStyle = isFocused ? zt.border.primary : null;
|
|
74
|
+
return [variantStyle, sizeStyle, focusStyle].filter(Boolean);
|
|
75
|
+
}, [variant, size, zt, isFocused]);
|
|
43
76
|
const textStyles = react_1.default.useMemo(() => {
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
77
|
+
const baseTextStyle = [zt.text.foreground, zt.bg.transparent];
|
|
78
|
+
switch (size) {
|
|
79
|
+
case "sm":
|
|
80
|
+
return [...baseTextStyle, zt.text.sm];
|
|
81
|
+
case "lg":
|
|
82
|
+
return [...baseTextStyle, zt.text.lg];
|
|
83
|
+
default:
|
|
84
|
+
return [...baseTextStyle, zt.text.md];
|
|
85
|
+
}
|
|
86
|
+
}, [size, zt]);
|
|
48
87
|
const handleFocus = react_1.default.useCallback((event) => {
|
|
49
88
|
setIsFocused(true);
|
|
50
89
|
if (props.onFocus) {
|
|
@@ -74,12 +113,7 @@ exports.Input = (0, react_1.forwardRef)(({ variant = "default", size = "md", lab
|
|
|
74
113
|
ref.current = node;
|
|
75
114
|
}
|
|
76
115
|
}
|
|
77
|
-
}, disabled: disabled, error: !!error, onFocus: handleFocus, onBlur: handleBlur, style: [
|
|
78
|
-
textStyles,
|
|
79
|
-
styles.inputInContainer,
|
|
80
|
-
inputStyle,
|
|
81
|
-
{ outline: "none" },
|
|
82
|
-
], placeholderTextColor: disabled ? theme.colors.textDisabled : theme.colors.textMuted, ...props }), rightAddon && ((0, jsx_runtime_1.jsx)(input_1.InputPrimitive.Addon, { position: "right", children: rightAddon }))] }) }), description && !error && ((0, jsx_runtime_1.jsx)(input_1.InputPrimitive.Description, { disabled: disabled, children: description })), (0, jsx_runtime_1.jsx)(input_1.InputPrimitive.Error, { visible: !!error, children: error })] }));
|
|
116
|
+
}, disabled: disabled, error: !!error, onFocus: handleFocus, onBlur: handleBlur, style: [textStyles, inputStyle, { outline: "none" }], placeholderTextColor: disabled ? theme.colors.textDisabled : theme.colors.textMuted, ...props }), rightAddon && ((0, jsx_runtime_1.jsx)(input_1.InputPrimitive.Addon, { position: "right", children: rightAddon }))] }) }), description && !error && ((0, jsx_runtime_1.jsx)(input_1.InputPrimitive.Description, { disabled: disabled, children: description })), (0, jsx_runtime_1.jsx)(input_1.InputPrimitive.Error, { visible: !!error, children: error })] }));
|
|
83
117
|
}
|
|
84
118
|
return ((0, jsx_runtime_1.jsxs)(input_1.InputPrimitive.Group, { children: [label && ((0, jsx_runtime_1.jsx)(input_1.InputPrimitive.Label, { required: required, disabled: disabled, error: !!error, children: label })), (0, jsx_runtime_1.jsx)(input_1.InputPrimitive.Root, { ref: (node) => {
|
|
85
119
|
inputRef.current = node;
|
|
@@ -94,112 +128,3 @@ exports.Input = (0, react_1.forwardRef)(({ variant = "default", size = "md", lab
|
|
|
94
128
|
}, disabled: disabled, error: !!error, onFocus: handleFocus, onBlur: handleBlur, style: [containerStyles, textStyles, containerStyle, inputStyle], placeholderTextColor: disabled ? theme.colors.textDisabled : theme.colors.textMuted, ...props }), description && !error && ((0, jsx_runtime_1.jsx)(input_1.InputPrimitive.Description, { disabled: disabled, children: description })), (0, jsx_runtime_1.jsx)(input_1.InputPrimitive.Error, { visible: !!error, children: error })] }));
|
|
95
129
|
});
|
|
96
130
|
exports.Input.displayName = "Input";
|
|
97
|
-
// Create theme-aware styles
|
|
98
|
-
function createStyles(theme) {
|
|
99
|
-
return react_native_1.StyleSheet.create({
|
|
100
|
-
// Variant styles for containers
|
|
101
|
-
defaultContainer: {
|
|
102
|
-
backgroundColor: theme.colors.background,
|
|
103
|
-
borderWidth: 1,
|
|
104
|
-
borderColor: theme.colors.border,
|
|
105
|
-
borderRadius: theme.borderRadius.md,
|
|
106
|
-
},
|
|
107
|
-
filledContainer: {
|
|
108
|
-
backgroundColor: theme.colors.muted,
|
|
109
|
-
borderWidth: 0,
|
|
110
|
-
borderRadius: theme.borderRadius.md,
|
|
111
|
-
},
|
|
112
|
-
underlinedContainer: {
|
|
113
|
-
backgroundColor: "transparent",
|
|
114
|
-
borderWidth: 0,
|
|
115
|
-
borderBottomWidth: 1,
|
|
116
|
-
borderBottomColor: theme.colors.border,
|
|
117
|
-
borderRadius: 0,
|
|
118
|
-
paddingHorizontal: 0,
|
|
119
|
-
},
|
|
120
|
-
// Variant styles for inputs
|
|
121
|
-
defaultInput: {
|
|
122
|
-
color: theme.colors.text,
|
|
123
|
-
backgroundColor: "transparent",
|
|
124
|
-
},
|
|
125
|
-
filledInput: {
|
|
126
|
-
color: theme.colors.text,
|
|
127
|
-
backgroundColor: "transparent",
|
|
128
|
-
},
|
|
129
|
-
underlinedInput: {
|
|
130
|
-
color: theme.colors.text,
|
|
131
|
-
backgroundColor: "transparent",
|
|
132
|
-
},
|
|
133
|
-
// Size styles for containers
|
|
134
|
-
smContainer: {
|
|
135
|
-
paddingHorizontal: theme.spacing[3],
|
|
136
|
-
paddingVertical: theme.spacing[2],
|
|
137
|
-
minHeight: theme.touchTargets.minimum - 8,
|
|
138
|
-
},
|
|
139
|
-
mdContainer: {
|
|
140
|
-
paddingHorizontal: theme.spacing[3],
|
|
141
|
-
paddingVertical: theme.spacing[3],
|
|
142
|
-
minHeight: theme.touchTargets.minimum,
|
|
143
|
-
},
|
|
144
|
-
lgContainer: {
|
|
145
|
-
paddingHorizontal: theme.spacing[4],
|
|
146
|
-
paddingVertical: theme.spacing[4],
|
|
147
|
-
minHeight: theme.touchTargets.comfortable,
|
|
148
|
-
},
|
|
149
|
-
// Size styles for inputs
|
|
150
|
-
smInput: {
|
|
151
|
-
fontSize: 14,
|
|
152
|
-
lineHeight: 18,
|
|
153
|
-
...react_native_1.Platform.select({
|
|
154
|
-
ios: {
|
|
155
|
-
paddingVertical: 0,
|
|
156
|
-
},
|
|
157
|
-
android: {
|
|
158
|
-
paddingVertical: 0,
|
|
159
|
-
textAlignVertical: "center",
|
|
160
|
-
},
|
|
161
|
-
}),
|
|
162
|
-
},
|
|
163
|
-
mdInput: {
|
|
164
|
-
fontSize: 16,
|
|
165
|
-
lineHeight: 20,
|
|
166
|
-
...react_native_1.Platform.select({
|
|
167
|
-
ios: {
|
|
168
|
-
paddingVertical: 0,
|
|
169
|
-
},
|
|
170
|
-
android: {
|
|
171
|
-
paddingVertical: 0,
|
|
172
|
-
textAlignVertical: "center",
|
|
173
|
-
},
|
|
174
|
-
}),
|
|
175
|
-
},
|
|
176
|
-
lgInput: {
|
|
177
|
-
fontSize: 18,
|
|
178
|
-
lineHeight: 22,
|
|
179
|
-
...react_native_1.Platform.select({
|
|
180
|
-
ios: {
|
|
181
|
-
paddingVertical: 0,
|
|
182
|
-
},
|
|
183
|
-
android: {
|
|
184
|
-
paddingVertical: 0,
|
|
185
|
-
textAlignVertical: "center",
|
|
186
|
-
},
|
|
187
|
-
}),
|
|
188
|
-
},
|
|
189
|
-
// Special style for inputs inside containers
|
|
190
|
-
inputInContainer: {
|
|
191
|
-
flex: 1,
|
|
192
|
-
paddingHorizontal: 0,
|
|
193
|
-
paddingVertical: 0,
|
|
194
|
-
borderWidth: 0,
|
|
195
|
-
backgroundColor: "transparent",
|
|
196
|
-
minHeight: "auto",
|
|
197
|
-
borderRadius: 0,
|
|
198
|
-
},
|
|
199
|
-
// Focus styles
|
|
200
|
-
focusedContainer: {
|
|
201
|
-
borderColor: theme.colors.primary,
|
|
202
|
-
borderWidth: 1,
|
|
203
|
-
},
|
|
204
|
-
});
|
|
205
|
-
}
|
|
@@ -79,7 +79,6 @@ const primitiveStyles = react_native_1.StyleSheet.create({
|
|
|
79
79
|
alignItems: "center",
|
|
80
80
|
justifyContent: "center",
|
|
81
81
|
minHeight: 44, // iOS minimum touch target
|
|
82
|
-
minWidth: 44,
|
|
83
82
|
},
|
|
84
83
|
disabled: {
|
|
85
84
|
opacity: 0.5,
|
|
@@ -88,7 +87,6 @@ const primitiveStyles = react_native_1.StyleSheet.create({
|
|
|
88
87
|
flexDirection: "row",
|
|
89
88
|
alignItems: "center",
|
|
90
89
|
justifyContent: "center",
|
|
91
|
-
flex: 1,
|
|
92
90
|
},
|
|
93
91
|
text: {
|
|
94
92
|
textAlign: "center",
|