@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.
Files changed (43) hide show
  1. package/dist/components/chat/chat-box.js +2 -2
  2. package/dist/components/chat/chat.js +1 -1
  3. package/dist/components/mobile-player/ui/autoplay-button.js +1 -0
  4. package/dist/components/mobile-player/ui/viewer-context-menu.js +1 -1
  5. package/dist/components/mobile-player/ui/viewer-loading-overlay.js +2 -2
  6. package/dist/components/mobile-player/use-webrtc.js +30 -0
  7. package/dist/components/ui/button.js +107 -155
  8. package/dist/components/ui/dialog.js +83 -116
  9. package/dist/components/ui/dropdown.js +41 -18
  10. package/dist/components/ui/input.js +53 -128
  11. package/dist/components/ui/primitives/button.js +0 -2
  12. package/dist/components/ui/primitives/modal.js +2 -2
  13. package/dist/components/ui/primitives/text.js +48 -8
  14. package/dist/components/ui/text.js +37 -66
  15. package/dist/components/ui/toast.js +78 -40
  16. package/dist/components/ui/view.js +28 -41
  17. package/dist/lib/theme/index.js +1 -2
  18. package/dist/lib/theme/theme.js +106 -54
  19. package/dist/lib/theme/tokens.js +94 -1
  20. package/dist/ui/index.js +2 -3
  21. package/node-compile-cache/v22.15.0-x64-efe9a9df-0/37be0eec +0 -0
  22. package/package.json +3 -2
  23. package/src/components/chat/chat-box.tsx +6 -3
  24. package/src/components/chat/chat.tsx +1 -0
  25. package/src/components/mobile-player/ui/autoplay-button.tsx +1 -0
  26. package/src/components/mobile-player/ui/viewer-context-menu.tsx +2 -2
  27. package/src/components/mobile-player/ui/viewer-loading-overlay.tsx +2 -2
  28. package/src/components/mobile-player/use-webrtc.tsx +31 -0
  29. package/src/components/ui/button.tsx +110 -172
  30. package/src/components/ui/dialog.tsx +96 -138
  31. package/src/components/ui/dropdown.tsx +60 -22
  32. package/src/components/ui/input.tsx +57 -144
  33. package/src/components/ui/primitives/button.tsx +0 -2
  34. package/src/components/ui/primitives/modal.tsx +0 -2
  35. package/src/components/ui/primitives/text.tsx +51 -8
  36. package/src/components/ui/text.tsx +42 -67
  37. package/src/components/ui/toast.tsx +108 -90
  38. package/src/components/ui/view.tsx +27 -41
  39. package/src/lib/theme/index.ts +0 -2
  40. package/src/lib/theme/theme.tsx +179 -72
  41. package/src/lib/theme/tokens.ts +97 -0
  42. package/src/ui/index.ts +0 -2
  43. package/tsconfig.tsbuildinfo +1 -1
@@ -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: [atoms_1.bg.black, atoms_1.a.radius.all.md, atoms_1.a.shadows.md, atoms_1.p[1]], handleIndicatorStyle: [
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
- atoms_1.bg.gray[500],
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: atoms_1.colors.gray[200] }) })] }) }) }));
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
- atoms_1.a.borders.color.gray[600],
60
+ zt.border.default,
57
61
  atoms_1.mt[1],
58
- atoms_1.bg.black,
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
- atoms_1.a.borders.color.gray[800],
75
- atoms_1.bg.gray[950],
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
- atoms_1.a.borders.color.gray[800],
92
- atoms_1.bg.gray[950],
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
- 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)([atoms_1.a.textColors.gray[900], atoms_1.a.fontSize.base]), children: (0, jsx_runtime_1.jsx)(react_native_1.View, { style: [
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: "white" })) : ((0, jsx_runtime_1.jsx)(lucide_react_native_1.Circle, { size: 14, strokeWidth: 3, color: atoms_1.a.colors.gray[400] })) })] }) }));
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: "white" }) }) }), children] }) }));
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
- atoms_1.a.textColors.gray[200],
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
- return (0, jsx_runtime_1.jsx)(react_native_1.View, { ref: ref, style: [{ height: 0.5 }, atoms_1.bg.gray[800]], ...props });
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
- atoms_1.a.textColors.gray[500],
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: [atoms_1.textColors.gray[400], atoms_1.pb[1], atoms_1.pl[2]], children: title })), (0, jsx_runtime_1.jsx)(react_native_1.View, { style: [
164
- atoms_1.bg.gray[900],
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
- return ((0, jsx_runtime_1.jsx)(react_native_1.Text, { style: [atoms_1.textColors.gray[400], atoms_1.pt[1], atoms_1.pl[2], atoms_1.pb[2], atoms_1.fontSize.sm], children: description }));
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
- // Create dynamic styles based on theme
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 = styles[`${variant}Container`];
39
- const sizeStyle = styles[`${size}Container`];
40
- const focusStyle = isFocused ? styles.focusedContainer : null;
41
- return [variantStyle, sizeStyle, focusStyle];
42
- }, [variant, size, styles, isFocused]);
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 variantTextStyle = styles[`${variant}Input`];
45
- const sizeTextStyle = styles[`${size}Input`];
46
- return [variantTextStyle, sizeTextStyle];
47
- }, [variant, size, styles]);
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",
@@ -7,7 +7,7 @@ const react_1 = tslib_1.__importStar(require("react"));
7
7
  const react_native_1 = require("react-native");
8
8
  const { width: screenWidth, height: screenHeight } = react_native_1.Dimensions.get("window");
9
9
  // Modal root primitive - handles the native Modal component
10
- exports.ModalRoot = (0, react_1.forwardRef)(({ open = false, onOpenChange, children, onRequestClose, animationType = "fade", presentationStyle = react_native_1.Platform.OS === "ios" ? "pageSheet" : "fullScreen", transparent = true, statusBarTranslucent = react_native_1.Platform.OS === "android", ...props }, ref) => {
10
+ exports.ModalRoot = (0, react_1.forwardRef)(({ open = false, onOpenChange, children, onRequestClose, animationType = "fade", presentationStyle = react_native_1.Platform.OS === "ios" ? "pageSheet" : "fullScreen", statusBarTranslucent = react_native_1.Platform.OS === "android", ...props }, ref) => {
11
11
  const handleRequestClose = react_1.default.useCallback((e) => {
12
12
  if (onOpenChange) {
13
13
  onOpenChange(false);
@@ -16,7 +16,7 @@ exports.ModalRoot = (0, react_1.forwardRef)(({ open = false, onOpenChange, child
16
16
  onRequestClose(e);
17
17
  }
18
18
  }, [onOpenChange, onRequestClose]);
19
- return ((0, jsx_runtime_1.jsx)(react_native_1.Modal, { visible: open, onRequestClose: handleRequestClose, animationType: animationType, presentationStyle: presentationStyle, transparent: transparent, statusBarTranslucent: statusBarTranslucent, ...props, children: (0, jsx_runtime_1.jsx)(react_native_1.View, { ref: ref, style: primitiveStyles.container, children: children }) }));
19
+ return ((0, jsx_runtime_1.jsx)(react_native_1.Modal, { visible: open, onRequestClose: handleRequestClose, animationType: animationType, presentationStyle: presentationStyle, statusBarTranslucent: statusBarTranslucent, ...props, children: (0, jsx_runtime_1.jsx)(react_native_1.View, { ref: ref, style: primitiveStyles.container, children: children }) }));
20
20
  });
21
21
  exports.ModalRoot.displayName = "ModalRoot";
22
22
  exports.ModalOverlay = (0, react_1.forwardRef)(({ dismissible = true, onDismiss, onPress, style, children, activeOpacity = 1, ...props }, ref) => {
@@ -24,6 +24,17 @@ const sizeMap = {
24
24
  "3xl": 30,
25
25
  "4xl": 36,
26
26
  };
27
+ // Size-specific line height mapping (provides better default line heights for each size)
28
+ const sizeLineHeightMap = {
29
+ xs: 16, // 12px * 1.33 = tight but readable
30
+ sm: 20, // 14px * 1.43 = good for small text
31
+ base: 24, // 16px * 1.5 = standard body text
32
+ lg: 28, // 18px * 1.56 = comfortable for larger text
33
+ xl: 30, // 20px * 1.5 = balanced
34
+ "2xl": 32, // 24px * 1.33 = tighter for headings
35
+ "3xl": 36, // 30px * 1.2 = tight for large headings
36
+ "4xl": 40, // 36px * 1.11 = very tight for display text
37
+ };
27
38
  // Weight mapping
28
39
  const weightMap = {
29
40
  thin: "100",
@@ -85,12 +96,12 @@ const getVariantStyles = () => {
85
96
  }
86
97
  else if (typographicPlatform === "android") {
87
98
  return {
88
- h1: platformTypography.headline1,
89
- h2: platformTypography.headline2,
90
- h3: platformTypography.headline3,
91
- h4: platformTypography.headline4,
92
- h5: platformTypography.headline5,
93
- h6: platformTypography.headline6,
99
+ h1: platformTypography.headline4, // 34px instead of 96px
100
+ h2: platformTypography.headline5, // 24px instead of 60px
101
+ h3: platformTypography.headline6, // 20px instead of 48px
102
+ h4: platformTypography.subtitle1, // 16px instead of 34px
103
+ h5: platformTypography.subtitle2, // 14px instead of 24px
104
+ h6: platformTypography.subtitle2, // 14px - consistent with h5
94
105
  subtitle1: platformTypography.subtitle1,
95
106
  subtitle2: platformTypography.subtitle2,
96
107
  body1: platformTypography.body1,
@@ -143,9 +154,15 @@ exports.TextRoot = (0, react_1.forwardRef)(({ variant, size, weight, color, alig
143
154
  // Apply variant styles (these may override inherited)
144
155
  ...(variant && variantStyles[variant]),
145
156
  // Apply explicit prop styles (these should override inherited and variant)
146
- // Apply size
157
+ // Apply size (with corresponding line height if not explicitly set)
147
158
  ...(size && {
148
159
  fontSize: typeof size === "number" ? size : sizeMap[size],
160
+ // Apply size-specific line height only if leading is not explicitly set
161
+ ...(leading === undefined && {
162
+ lineHeight: typeof size === "number"
163
+ ? size // Auto line height for numeric sizes
164
+ : sizeLineHeightMap[size],
165
+ }),
149
166
  }),
150
167
  // Apply weight
151
168
  ...(weight && {
@@ -204,6 +221,22 @@ exports.TextRoot = (0, react_1.forwardRef)(({ variant, size, weight, color, alig
204
221
  };
205
222
  finalStyles.color = finalStyles.color;
206
223
  // Create context value for children
224
+ // Process custom styles to auto-add line height for fontSize
225
+ const processedStyle = Array.isArray(style)
226
+ ? style
227
+ : [style].filter(Boolean);
228
+ const enhancedStyles = processedStyle.map((styleObj) => {
229
+ if (styleObj && typeof styleObj === "object" && "fontSize" in styleObj) {
230
+ const fontSize = styleObj.fontSize;
231
+ if (typeof fontSize === "number" && !styleObj.lineHeight && !leading) {
232
+ return {
233
+ ...styleObj,
234
+ lineHeight: fontSize * 1.2,
235
+ };
236
+ }
237
+ }
238
+ return styleObj;
239
+ });
207
240
  const contextValue = {
208
241
  fontSize: typeof finalStyles.fontSize === "number"
209
242
  ? finalStyles.fontSize
@@ -223,7 +256,7 @@ exports.TextRoot = (0, react_1.forwardRef)(({ variant, size, weight, color, alig
223
256
  fontStyle: finalStyles.fontStyle,
224
257
  opacity: finalStyles.opacity,
225
258
  };
226
- return ((0, jsx_runtime_1.jsx)(exports.TextContext.Provider, { value: contextValue, children: (0, jsx_runtime_1.jsx)(react_native_1.Text, { ref: ref, style: [finalStyles, style], ...props, children: children }) }));
259
+ return ((0, jsx_runtime_1.jsx)(exports.TextContext.Provider, { value: contextValue, children: (0, jsx_runtime_1.jsx)(react_native_1.Text, { ref: ref, style: [finalStyles, ...enhancedStyles], ...props, children: children }) }));
227
260
  });
228
261
  exports.TextRoot.displayName = "TextRoot";
229
262
  // Text span primitive (inherits from parent but doesn't create new context)
@@ -248,6 +281,13 @@ function createTextStyle(props) {
248
281
  if (props.size) {
249
282
  style.fontSize =
250
283
  typeof props.size === "number" ? props.size : sizeMap[props.size];
284
+ // Apply size-specific line height only if leading is not explicitly set
285
+ if (props.leading === undefined) {
286
+ style.lineHeight =
287
+ typeof props.size === "number"
288
+ ? props.size * 1.2 // Auto line height for numeric sizes
289
+ : sizeLineHeightMap[props.size];
290
+ }
251
291
  }
252
292
  if (props.weight) {
253
293
  style.fontWeight = weightMap[props.weight];
@@ -5,8 +5,9 @@ const tslib_1 = require("tslib");
5
5
  const jsx_runtime_1 = require("react/jsx-runtime");
6
6
  const class_variance_authority_1 = require("class-variance-authority");
7
7
  const react_1 = tslib_1.__importStar(require("react"));
8
- const react_native_1 = require("react-native");
9
- const atoms_1 = require("../../lib/theme/atoms");
8
+ const theme_1 = require("../../lib/theme/theme");
9
+ const tokens_1 = require("../../lib/theme/tokens");
10
+ const zero = tslib_1.__importStar(require("../../ui"));
10
11
  const text_1 = require("./primitives/text");
11
12
  Object.defineProperty(exports, "TextPrimitive", { enumerable: true, get: function () { return text_1.TextPrimitive; } });
12
13
  // Text variants using class-variance-authority pattern
@@ -65,8 +66,7 @@ const textVariants = (0, class_variance_authority_1.cva)("", {
65
66
  });
66
67
  exports.textVariants = textVariants;
67
68
  exports.Text = (0, react_1.forwardRef)(({ variant = undefined, size = undefined, weight = undefined, color = undefined, muted = false, bold = false, italic = false, underline = false, strikethrough = false, uppercase = false, lowercase = false, capitalize = false, center = false, right = false, justify = false, customColor, style, children, ...props }, ref) => {
68
- // Create dynamic styles based on atoms
69
- const styles = react_1.default.useMemo(() => createStyles(), []);
69
+ const { zero: zt } = (0, theme_1.useTheme)();
70
70
  // Override props based on convenience props
71
71
  const finalColor = customColor ? customColor : muted ? "muted" : color;
72
72
  const finalTransform = uppercase
@@ -90,8 +90,31 @@ exports.Text = (0, react_1.forwardRef)(({ variant = undefined, size = undefined,
90
90
  : justify
91
91
  ? "justify"
92
92
  : "left";
93
- // Get variant-specific styles
94
- const variantStyle = styles[`${variant}Style`] || {};
93
+ // Get variant-specific styles using theme.zero
94
+ const variantStyle = react_1.default.useMemo(() => {
95
+ switch (variant) {
96
+ case "h1":
97
+ return zero.my[6];
98
+ case "h2":
99
+ case "h3":
100
+ return zero.my[4];
101
+ case "h4":
102
+ case "h5":
103
+ case "h6":
104
+ case "subtitle1":
105
+ return zero.my[2];
106
+ case "subtitle2":
107
+ case "caption":
108
+ case "overline":
109
+ return zero.my[1];
110
+ case "body1":
111
+ return zero.my[4];
112
+ case "body2":
113
+ return zero.my[2];
114
+ default:
115
+ return {};
116
+ }
117
+ }, [variant, zt]);
95
118
  const styleArr = (Array.isArray(style) ? style : [style || undefined]).filter((s) => s !== undefined);
96
119
  return ((0, jsx_runtime_1.jsx)(text_1.TextPrimitive.Root, { ref: ref, variant: variant || "body1", size: size || "base", color: finalColor || "default", align: finalAlign, transform: finalTransform, decoration: finalDecoration, italic: italic, style: [variantStyle, ...styleArr], ...props, children: children }));
97
120
  });
@@ -108,70 +131,18 @@ exports.Caption.displayName = "Caption";
108
131
  exports.Label = (0, react_1.forwardRef)((props, ref) => ((0, jsx_runtime_1.jsx)(exports.Text, { ref: ref, variant: "subtitle1", weight: "medium", ...props })));
109
132
  exports.Label.displayName = "Label";
110
133
  exports.Code = (0, react_1.forwardRef)(({ style, ...props }, ref) => {
111
- const styles = react_1.default.useMemo(() => createStyles(), []);
134
+ const { zero: zt } = (0, theme_1.useTheme)();
135
+ const codeStyle = react_1.default.useMemo(() => [
136
+ {
137
+ borderRadius: zero.borderRadius.sm,
138
+ fontFamily: tokens_1.fontFamilies.monoRegular,
139
+ },
140
+ ], [zt]);
112
141
  // if style is not an array, convert it to an array
113
142
  const styleArr = (Array.isArray(style) ? style : [style || undefined]).filter((s) => s !== undefined);
114
- return (0, jsx_runtime_1.jsx)(exports.Text, { ref: ref, style: [styles.codeStyle, ...styleArr], ...props });
143
+ return (0, jsx_runtime_1.jsx)(exports.Text, { ref: ref, style: [...codeStyle, ...styleArr], ...props });
115
144
  });
116
145
  exports.Code.displayName = "Code";
117
146
  // Span component for inline text styling (inherits from parent)
118
147
  exports.Span = (0, react_1.forwardRef)(({ children, ...props }, ref) => ((0, jsx_runtime_1.jsx)(text_1.TextPrimitive.Span, { ref: ref, ...props, children: children })));
119
148
  exports.Span.displayName = "Span";
120
- // Create atom-based styles
121
- function createStyles() {
122
- return react_native_1.StyleSheet.create({
123
- // Variant-specific styles
124
- h1Style: {
125
- marginBottom: atoms_1.spacing[4],
126
- },
127
- h2Style: {
128
- marginBottom: atoms_1.spacing[3],
129
- },
130
- h3Style: {
131
- marginBottom: atoms_1.spacing[3],
132
- },
133
- h4Style: {
134
- marginBottom: atoms_1.spacing[2],
135
- },
136
- h5Style: {
137
- marginBottom: atoms_1.spacing[2],
138
- },
139
- h6Style: {
140
- marginBottom: atoms_1.spacing[2],
141
- },
142
- subtitle1Style: {
143
- marginBottom: atoms_1.spacing[2],
144
- },
145
- subtitle2Style: {
146
- marginBottom: atoms_1.spacing[1],
147
- },
148
- body1Style: {
149
- marginBottom: atoms_1.spacing[3],
150
- },
151
- body2Style: {
152
- marginBottom: atoms_1.spacing[2],
153
- },
154
- captionStyle: {
155
- marginBottom: atoms_1.spacing[1],
156
- },
157
- overlineStyle: {
158
- marginBottom: atoms_1.spacing[1],
159
- textTransform: "uppercase",
160
- letterSpacing: 1,
161
- },
162
- labelStyle: {
163
- marginBottom: atoms_1.spacing[1],
164
- },
165
- buttonStyle: {
166
- textAlign: "center",
167
- },
168
- codeStyle: {
169
- fontFamily: "monospace",
170
- backgroundColor: atoms_1.colors["muted"],
171
- paddingHorizontal: atoms_1.spacing[1],
172
- paddingVertical: 2,
173
- borderRadius: atoms_1.borderRadius.sm,
174
- fontSize: 14,
175
- },
176
- });
177
- }