@streamplace/components 0.7.0 → 0.7.2

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 (97) hide show
  1. package/dist/components/chat/chat-box.js +46 -43
  2. package/dist/components/chat/chat-message.js +36 -33
  3. package/dist/components/chat/chat.js +31 -27
  4. package/dist/components/chat/mention-suggestions.js +16 -13
  5. package/dist/components/chat/mod-view.js +20 -17
  6. package/dist/components/mobile-player/fullscreen.js +21 -17
  7. package/dist/components/mobile-player/fullscreen.native.js +39 -35
  8. package/dist/components/mobile-player/player.js +38 -32
  9. package/dist/components/mobile-player/props.js +2 -1
  10. package/dist/components/mobile-player/shared.js +16 -13
  11. package/dist/components/mobile-player/ui/countdown.js +23 -19
  12. package/dist/components/mobile-player/ui/index.js +9 -5
  13. package/dist/components/mobile-player/ui/input.js +16 -12
  14. package/dist/components/mobile-player/ui/metrics.js +20 -16
  15. package/dist/components/mobile-player/ui/streamer-context-menu.js +6 -3
  16. package/dist/components/mobile-player/ui/viewer-context-menu.js +19 -16
  17. package/dist/components/mobile-player/ui/viewers.js +23 -0
  18. package/dist/components/mobile-player/use-webrtc.js +29 -24
  19. package/dist/components/mobile-player/video.js +109 -99
  20. package/dist/components/mobile-player/video.native.js +108 -84
  21. package/dist/components/mobile-player/webrtc-diagnostics.js +9 -5
  22. package/dist/components/mobile-player/webrtc-primitives.js +8 -6
  23. package/dist/components/mobile-player/webrtc-primitives.native.js +8 -1
  24. package/dist/components/ui/button.js +26 -23
  25. package/dist/components/ui/dialog.js +43 -40
  26. package/dist/components/ui/dropdown.js +121 -116
  27. package/dist/components/ui/icons.js +8 -5
  28. package/dist/components/ui/index.js +27 -19
  29. package/dist/components/ui/input.js +31 -28
  30. package/dist/components/ui/loader.js +9 -6
  31. package/dist/components/ui/primitives/button.js +33 -29
  32. package/dist/components/ui/primitives/input.js +44 -40
  33. package/dist/components/ui/primitives/modal.js +45 -41
  34. package/dist/components/ui/primitives/text.js +35 -29
  35. package/dist/components/ui/resizeable.js +54 -43
  36. package/dist/components/ui/text.js +50 -48
  37. package/dist/components/ui/textarea.js +13 -11
  38. package/dist/components/ui/toast.js +26 -23
  39. package/dist/components/ui/view.js +41 -39
  40. package/dist/hooks/index.js +12 -8
  41. package/dist/hooks/useAvatars.js +11 -8
  42. package/dist/hooks/useCameraToggle.js +7 -4
  43. package/dist/hooks/useKeyboard.js +13 -10
  44. package/dist/hooks/useKeyboardSlide.js +8 -5
  45. package/dist/hooks/useLivestreamInfo.js +17 -14
  46. package/dist/hooks/useOuterAndInnerDimensions.js +9 -6
  47. package/dist/hooks/usePlayerDimensions.js +9 -6
  48. package/dist/hooks/useSegmentDimensions.js +17 -0
  49. package/dist/hooks/useSegmentTiming.js +13 -10
  50. package/dist/index.js +24 -15
  51. package/dist/lib/facet.js +5 -1
  52. package/dist/lib/theme/atoms.js +153 -148
  53. package/dist/lib/theme/atoms.types.js +2 -1
  54. package/dist/lib/theme/index.js +31 -5
  55. package/dist/lib/theme/theme.js +91 -83
  56. package/dist/lib/theme/tokens.js +15 -12
  57. package/dist/lib/utils.js +22 -11
  58. package/dist/livestream-provider/index.js +19 -14
  59. package/dist/livestream-provider/websocket.js +14 -10
  60. package/dist/livestream-store/chat.js +26 -19
  61. package/dist/livestream-store/context.js +5 -2
  62. package/dist/livestream-store/index.js +7 -4
  63. package/dist/livestream-store/livestream-state.js +2 -1
  64. package/dist/livestream-store/livestream-store.js +31 -18
  65. package/dist/livestream-store/stream-key.js +22 -18
  66. package/dist/livestream-store/websocket-consumer.js +18 -14
  67. package/dist/player-store/context.js +5 -2
  68. package/dist/player-store/index.js +8 -5
  69. package/dist/player-store/player-provider.js +20 -15
  70. package/dist/player-store/player-state.js +9 -6
  71. package/dist/player-store/player-store.js +32 -21
  72. package/dist/player-store/single-player-provider.js +35 -23
  73. package/dist/streamplace-provider/context.js +5 -2
  74. package/dist/streamplace-provider/index.js +14 -10
  75. package/dist/streamplace-provider/poller.js +20 -17
  76. package/dist/streamplace-store/block.js +6 -3
  77. package/dist/streamplace-store/index.js +6 -3
  78. package/dist/streamplace-store/stream.js +14 -10
  79. package/dist/streamplace-store/streamplace-store.js +23 -13
  80. package/dist/streamplace-store/user.js +19 -14
  81. package/dist/streamplace-store/xrpc.js +10 -7
  82. package/node-compile-cache/v22.15.0-x64-92db9086-0/37be0eec +0 -0
  83. package/node-compile-cache/v22.15.0-x64-92db9086-0/56540125 +0 -0
  84. package/node-compile-cache/{v22.15.0-x64-efe9a9df-0 → v22.15.0-x64-92db9086-0}/67b1eb60 +0 -0
  85. package/node-compile-cache/{v22.15.0-x64-efe9a9df-0 → v22.15.0-x64-92db9086-0}/7c275f90 +0 -0
  86. package/package.json +6 -7
  87. package/src/components/mobile-player/ui/index.ts +1 -0
  88. package/src/components/mobile-player/ui/viewer-context-menu.tsx +5 -4
  89. package/src/components/mobile-player/ui/viewers.tsx +32 -0
  90. package/src/components/mobile-player/video.native.tsx +50 -5
  91. package/src/components/ui/resizeable.tsx +15 -3
  92. package/src/hooks/index.ts +1 -0
  93. package/src/hooks/useSegmentDimensions.tsx +18 -0
  94. package/tsconfig.json +2 -1
  95. package/tsconfig.tsbuildinfo +1 -1
  96. package/node-compile-cache/v22.15.0-x64-efe9a9df-0/37be0eec +0 -0
  97. package/node-compile-cache/v22.15.0-x64-efe9a9df-0/56540125 +0 -0
@@ -1,29 +1,33 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import React, { forwardRef } from "react";
3
- import { StyleSheet, Text, TouchableOpacity, View, } from "react-native";
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ButtonPrimitive = exports.ButtonContent = exports.ButtonLoading = exports.ButtonIcon = exports.ButtonText = exports.ButtonRoot = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const jsx_runtime_1 = require("react/jsx-runtime");
6
+ const react_1 = tslib_1.__importStar(require("react"));
7
+ const react_native_1 = require("react-native");
4
8
  // Button root primitive - handles all touch interactions
5
- export const ButtonRoot = forwardRef(({ children, disabled = false, loading = false, onPress, onPressIn, onPressOut, onLongPress, accessibilityRole = "button", accessibilityLabel, accessibilityHint, accessibilityState, testID, style, activeOpacity = 0.7, ...props }, ref) => {
6
- const handlePress = React.useCallback((event) => {
9
+ exports.ButtonRoot = (0, react_1.forwardRef)(({ children, disabled = false, loading = false, onPress, onPressIn, onPressOut, onLongPress, accessibilityRole = "button", accessibilityLabel, accessibilityHint, accessibilityState, testID, style, activeOpacity = 0.7, ...props }, ref) => {
10
+ const handlePress = react_1.default.useCallback((event) => {
7
11
  if (!disabled && !loading && onPress) {
8
12
  onPress(event);
9
13
  }
10
14
  }, [disabled, loading, onPress]);
11
- const handlePressIn = React.useCallback((event) => {
15
+ const handlePressIn = react_1.default.useCallback((event) => {
12
16
  if (!disabled && !loading && onPressIn) {
13
17
  onPressIn(event);
14
18
  }
15
19
  }, [disabled, loading, onPressIn]);
16
- const handlePressOut = React.useCallback((event) => {
20
+ const handlePressOut = react_1.default.useCallback((event) => {
17
21
  if (!disabled && !loading && onPressOut) {
18
22
  onPressOut(event);
19
23
  }
20
24
  }, [disabled, loading, onPressOut]);
21
- const handleLongPress = React.useCallback((event) => {
25
+ const handleLongPress = react_1.default.useCallback((event) => {
22
26
  if (!disabled && !loading && onLongPress) {
23
27
  onLongPress(event);
24
28
  }
25
29
  }, [disabled, loading, onLongPress]);
26
- return (_jsx(TouchableOpacity, { ref: ref, onPress: handlePress, onPressIn: handlePressIn, onPressOut: handlePressOut, onLongPress: handleLongPress, disabled: disabled || loading, activeOpacity: disabled || loading ? 1 : activeOpacity, accessibilityRole: accessibilityRole, accessibilityLabel: accessibilityLabel, accessibilityHint: accessibilityHint, accessibilityState: {
30
+ return ((0, jsx_runtime_1.jsx)(react_native_1.TouchableOpacity, { ref: ref, onPress: handlePress, onPressIn: handlePressIn, onPressOut: handlePressOut, onLongPress: handleLongPress, disabled: disabled || loading, activeOpacity: disabled || loading ? 1 : activeOpacity, accessibilityRole: accessibilityRole, accessibilityLabel: accessibilityLabel, accessibilityHint: accessibilityHint, accessibilityState: {
27
31
  disabled: disabled || loading,
28
32
  busy: loading,
29
33
  ...accessibilityState,
@@ -33,31 +37,31 @@ export const ButtonRoot = forwardRef(({ children, disabled = false, loading = fa
33
37
  style,
34
38
  ], ...props, children: children }));
35
39
  });
36
- ButtonRoot.displayName = "ButtonRoot";
37
- export const ButtonText = forwardRef(({ children, disabled, loading, style, ...props }, ref) => {
38
- return (_jsx(Text, { ref: ref, style: [
40
+ exports.ButtonRoot.displayName = "ButtonRoot";
41
+ exports.ButtonText = (0, react_1.forwardRef)(({ children, disabled, loading, style, ...props }, ref) => {
42
+ return ((0, jsx_runtime_1.jsx)(react_native_1.Text, { ref: ref, style: [
39
43
  primitiveStyles.text,
40
44
  (disabled || loading) && primitiveStyles.textDisabled,
41
45
  style,
42
46
  ], ...props, children: children }));
43
47
  });
44
- ButtonText.displayName = "ButtonText";
45
- export const ButtonIcon = forwardRef(({ children, position = "left", disabled, loading, style, ...props }, ref) => {
46
- return (_jsx(View, { ref: ref, style: [
48
+ exports.ButtonText.displayName = "ButtonText";
49
+ exports.ButtonIcon = (0, react_1.forwardRef)(({ children, position = "left", disabled, loading, style, ...props }, ref) => {
50
+ return ((0, jsx_runtime_1.jsx)(react_native_1.View, { ref: ref, style: [
47
51
  primitiveStyles.icon,
48
52
  (disabled || loading) && primitiveStyles.iconDisabled,
49
53
  style,
50
54
  ], ...props, children: children }));
51
55
  });
52
- ButtonIcon.displayName = "ButtonIcon";
53
- export const ButtonLoading = forwardRef(({ children, visible = false, style, ...props }, ref) => {
56
+ exports.ButtonIcon.displayName = "ButtonIcon";
57
+ exports.ButtonLoading = (0, react_1.forwardRef)(({ children, visible = false, style, ...props }, ref) => {
54
58
  if (!visible)
55
59
  return null;
56
- return (_jsx(View, { ref: ref, style: [primitiveStyles.loading, style], ...props, children: children }));
60
+ return ((0, jsx_runtime_1.jsx)(react_native_1.View, { ref: ref, style: [primitiveStyles.loading, style], ...props, children: children }));
57
61
  });
58
- ButtonLoading.displayName = "ButtonLoading";
59
- export const ButtonContent = forwardRef(({ children, direction = "row", align = "center", justify = "center", style, ...props }, ref) => {
60
- return (_jsx(View, { ref: ref, style: [
62
+ exports.ButtonLoading.displayName = "ButtonLoading";
63
+ exports.ButtonContent = (0, react_1.forwardRef)(({ children, direction = "row", align = "center", justify = "center", style, ...props }, ref) => {
64
+ return ((0, jsx_runtime_1.jsx)(react_native_1.View, { ref: ref, style: [
61
65
  primitiveStyles.content,
62
66
  {
63
67
  flexDirection: direction,
@@ -67,9 +71,9 @@ export const ButtonContent = forwardRef(({ children, direction = "row", align =
67
71
  style,
68
72
  ], ...props, children: children }));
69
73
  });
70
- ButtonContent.displayName = "ButtonContent";
74
+ exports.ButtonContent.displayName = "ButtonContent";
71
75
  // Primitive styles (minimal, unstyled)
72
- const primitiveStyles = StyleSheet.create({
76
+ const primitiveStyles = react_native_1.StyleSheet.create({
73
77
  button: {
74
78
  flexDirection: "row",
75
79
  alignItems: "center",
@@ -112,10 +116,10 @@ const primitiveStyles = StyleSheet.create({
112
116
  },
113
117
  });
114
118
  // Export primitive collection
115
- export const ButtonPrimitive = {
116
- Root: ButtonRoot,
117
- Text: ButtonText,
118
- Icon: ButtonIcon,
119
- Loading: ButtonLoading,
120
- Content: ButtonContent,
119
+ exports.ButtonPrimitive = {
120
+ Root: exports.ButtonRoot,
121
+ Text: exports.ButtonText,
122
+ Icon: exports.ButtonIcon,
123
+ Loading: exports.ButtonLoading,
124
+ Content: exports.ButtonContent,
121
125
  };
@@ -1,10 +1,14 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import React, { forwardRef } from "react";
3
- import { Platform, StyleSheet, Text, TextInput, TouchableOpacity, View, } from "react-native";
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.InputPrimitive = exports.InputGroup = exports.InputAddon = exports.InputError = exports.InputDescription = exports.InputLabel = exports.InputContainer = exports.InputRoot = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const jsx_runtime_1 = require("react/jsx-runtime");
6
+ const react_1 = tslib_1.__importStar(require("react"));
7
+ const react_native_1 = require("react-native");
4
8
  // Input root primitive - the main TextInput component
5
- export const InputRoot = forwardRef(({ value, onChangeText, onChange, onFocus, onBlur, error = false, disabled = false, loading = false, editable, style, placeholderTextColor = "#9ca3af", ...props }, ref) => {
6
- const [isFocused, setIsFocused] = React.useState(false);
7
- const handleChangeText = React.useCallback((text) => {
9
+ exports.InputRoot = (0, react_1.forwardRef)(({ value, onChangeText, onChange, onFocus, onBlur, error = false, disabled = false, loading = false, editable, style, placeholderTextColor = "#9ca3af", ...props }, ref) => {
10
+ const [isFocused, setIsFocused] = react_1.default.useState(false);
11
+ const handleChangeText = react_1.default.useCallback((text) => {
8
12
  if (onChangeText) {
9
13
  onChangeText(text);
10
14
  }
@@ -12,19 +16,19 @@ export const InputRoot = forwardRef(({ value, onChangeText, onChange, onFocus, o
12
16
  onChange(text);
13
17
  }
14
18
  }, [onChangeText, onChange]);
15
- const handleFocus = React.useCallback((event) => {
19
+ const handleFocus = react_1.default.useCallback((event) => {
16
20
  setIsFocused(true);
17
21
  if (onFocus) {
18
22
  onFocus(event);
19
23
  }
20
24
  }, [onFocus]);
21
- const handleBlur = React.useCallback((event) => {
25
+ const handleBlur = react_1.default.useCallback((event) => {
22
26
  setIsFocused(false);
23
27
  if (onBlur) {
24
28
  onBlur(event);
25
29
  }
26
30
  }, [onBlur]);
27
- return (_jsx(TextInput, { ref: ref, value: value, onChangeText: handleChangeText, onFocus: handleFocus, onBlur: handleBlur, editable: !disabled && !loading && editable, placeholderTextColor: placeholderTextColor, style: [
31
+ return ((0, jsx_runtime_1.jsx)(react_native_1.TextInput, { ref: ref, value: value, onChangeText: handleChangeText, onFocus: handleFocus, onBlur: handleBlur, editable: !disabled && !loading && editable, placeholderTextColor: placeholderTextColor, style: [
28
32
  primitiveStyles.input,
29
33
  style,
30
34
  error && primitiveStyles.inputError,
@@ -32,9 +36,9 @@ export const InputRoot = forwardRef(({ value, onChangeText, onChange, onFocus, o
32
36
  loading && primitiveStyles.inputLoading,
33
37
  ], ...props }));
34
38
  });
35
- InputRoot.displayName = "InputRoot";
36
- export const InputContainer = forwardRef(({ children, focused = false, error = false, disabled = false, style, ...props }, ref) => {
37
- return (_jsx(View, { ref: ref, style: [
39
+ exports.InputRoot.displayName = "InputRoot";
40
+ exports.InputContainer = (0, react_1.forwardRef)(({ children, focused = false, error = false, disabled = false, style, ...props }, ref) => {
41
+ return ((0, jsx_runtime_1.jsx)(react_native_1.View, { ref: ref, style: [
38
42
  primitiveStyles.container,
39
43
  style,
40
44
  focused && primitiveStyles.containerFocused,
@@ -42,49 +46,49 @@ export const InputContainer = forwardRef(({ children, focused = false, error = f
42
46
  disabled && primitiveStyles.containerDisabled,
43
47
  ], ...props, children: children }));
44
48
  });
45
- InputContainer.displayName = "InputContainer";
46
- export const InputLabel = forwardRef(({ children, required = false, disabled = false, error = false, style, ...props }, ref) => {
47
- return (_jsxs(Text, { ref: ref, style: [
49
+ exports.InputContainer.displayName = "InputContainer";
50
+ exports.InputLabel = (0, react_1.forwardRef)(({ children, required = false, disabled = false, error = false, style, ...props }, ref) => {
51
+ return ((0, jsx_runtime_1.jsxs)(react_native_1.Text, { ref: ref, style: [
48
52
  primitiveStyles.label,
49
53
  style,
50
54
  error && primitiveStyles.labelError,
51
55
  disabled && primitiveStyles.labelDisabled,
52
- ], ...props, children: [children, required && _jsx(Text, { style: primitiveStyles.required, children: " *" })] }));
56
+ ], ...props, children: [children, required && (0, jsx_runtime_1.jsx)(react_native_1.Text, { style: primitiveStyles.required, children: " *" })] }));
53
57
  });
54
- InputLabel.displayName = "InputLabel";
55
- export const InputDescription = forwardRef(({ children, error = false, disabled = false, style, ...props }, ref) => {
56
- return (_jsx(Text, { ref: ref, style: [
58
+ exports.InputLabel.displayName = "InputLabel";
59
+ exports.InputDescription = (0, react_1.forwardRef)(({ children, error = false, disabled = false, style, ...props }, ref) => {
60
+ return ((0, jsx_runtime_1.jsx)(react_native_1.Text, { ref: ref, style: [
57
61
  primitiveStyles.description,
58
62
  style,
59
63
  error && primitiveStyles.descriptionError,
60
64
  disabled && primitiveStyles.descriptionDisabled,
61
65
  ], ...props, children: children }));
62
66
  });
63
- InputDescription.displayName = "InputDescription";
64
- export const InputError = forwardRef(({ children, visible = true, style, ...props }, ref) => {
67
+ exports.InputDescription.displayName = "InputDescription";
68
+ exports.InputError = (0, react_1.forwardRef)(({ children, visible = true, style, ...props }, ref) => {
65
69
  if (!visible || !children)
66
70
  return null;
67
- return (_jsx(Text, { ref: ref, style: [primitiveStyles.error, style], ...props, children: children }));
71
+ return ((0, jsx_runtime_1.jsx)(react_native_1.Text, { ref: ref, style: [primitiveStyles.error, style], ...props, children: children }));
68
72
  });
69
- InputError.displayName = "InputError";
70
- export const InputAddon = forwardRef(({ children, position = "left", touchable = false, onPress, style, ...props }, ref) => {
73
+ exports.InputError.displayName = "InputError";
74
+ exports.InputAddon = (0, react_1.forwardRef)(({ children, position = "left", touchable = false, onPress, style, ...props }, ref) => {
71
75
  const addonStyle = [
72
76
  primitiveStyles.addon,
73
77
  primitiveStyles[`addon${position.charAt(0).toUpperCase() + position.slice(1)}`],
74
78
  style,
75
79
  ];
76
80
  if (touchable && onPress) {
77
- return (_jsx(TouchableOpacity, { ref: ref, style: addonStyle, onPress: onPress, ...props, children: children }));
81
+ return ((0, jsx_runtime_1.jsx)(react_native_1.TouchableOpacity, { ref: ref, style: addonStyle, onPress: onPress, ...props, children: children }));
78
82
  }
79
- return (_jsx(View, { ref: ref, style: addonStyle, ...props, children: children }));
83
+ return ((0, jsx_runtime_1.jsx)(react_native_1.View, { ref: ref, style: addonStyle, ...props, children: children }));
80
84
  });
81
- InputAddon.displayName = "InputAddon";
82
- export const InputGroup = forwardRef(({ children, spacing = 8, style, ...props }, ref) => {
83
- return (_jsx(View, { ref: ref, style: [primitiveStyles.group, { gap: spacing }, style], ...props, children: children }));
85
+ exports.InputAddon.displayName = "InputAddon";
86
+ exports.InputGroup = (0, react_1.forwardRef)(({ children, spacing = 8, style, ...props }, ref) => {
87
+ return ((0, jsx_runtime_1.jsx)(react_native_1.View, { ref: ref, style: [primitiveStyles.group, { gap: spacing }, style], ...props, children: children }));
84
88
  });
85
- InputGroup.displayName = "InputGroup";
89
+ exports.InputGroup.displayName = "InputGroup";
86
90
  // Primitive styles (minimal, unstyled)
87
- const primitiveStyles = StyleSheet.create({
91
+ const primitiveStyles = react_native_1.StyleSheet.create({
88
92
  input: {
89
93
  minHeight: 44, // iOS minimum touch target
90
94
  paddingHorizontal: 12,
@@ -94,7 +98,7 @@ const primitiveStyles = StyleSheet.create({
94
98
  borderColor: "#d1d5db",
95
99
  borderRadius: 8,
96
100
  backgroundColor: "white",
97
- ...Platform.select({
101
+ ...react_native_1.Platform.select({
98
102
  ios: {
99
103
  paddingVertical: 12,
100
104
  },
@@ -191,12 +195,12 @@ const primitiveStyles = StyleSheet.create({
191
195
  },
192
196
  });
193
197
  // Export primitive collection
194
- export const InputPrimitive = {
195
- Root: InputRoot,
196
- Container: InputContainer,
197
- Label: InputLabel,
198
- Description: InputDescription,
199
- Error: InputError,
200
- Addon: InputAddon,
201
- Group: InputGroup,
198
+ exports.InputPrimitive = {
199
+ Root: exports.InputRoot,
200
+ Container: exports.InputContainer,
201
+ Label: exports.InputLabel,
202
+ Description: exports.InputDescription,
203
+ Error: exports.InputError,
204
+ Addon: exports.InputAddon,
205
+ Group: exports.InputGroup,
202
206
  };
@@ -1,10 +1,14 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import React, { forwardRef } from "react";
3
- import { Dimensions, Modal, Platform, ScrollView, StyleSheet, TouchableOpacity, View, } from "react-native";
4
- const { width: screenWidth, height: screenHeight } = Dimensions.get("window");
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ModalPrimitive = exports.ModalClose = exports.ModalFooter = exports.ModalBody = exports.ModalHeader = exports.ModalContent = exports.ModalOverlay = exports.ModalRoot = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const jsx_runtime_1 = require("react/jsx-runtime");
6
+ const react_1 = tslib_1.__importStar(require("react"));
7
+ const react_native_1 = require("react-native");
8
+ const { width: screenWidth, height: screenHeight } = react_native_1.Dimensions.get("window");
5
9
  // Modal root primitive - handles the native Modal component
6
- export const ModalRoot = forwardRef(({ open = false, onOpenChange, children, onRequestClose, animationType = "fade", presentationStyle = Platform.OS === "ios" ? "pageSheet" : "fullScreen", transparent = true, statusBarTranslucent = Platform.OS === "android", ...props }, ref) => {
7
- const handleRequestClose = React.useCallback((e) => {
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) => {
11
+ const handleRequestClose = react_1.default.useCallback((e) => {
8
12
  if (onOpenChange) {
9
13
  onOpenChange(false);
10
14
  }
@@ -12,11 +16,11 @@ export const ModalRoot = forwardRef(({ open = false, onOpenChange, children, onR
12
16
  onRequestClose(e);
13
17
  }
14
18
  }, [onOpenChange, onRequestClose]);
15
- return (_jsx(Modal, { visible: open, onRequestClose: handleRequestClose, animationType: animationType, presentationStyle: presentationStyle, transparent: transparent, statusBarTranslucent: statusBarTranslucent, ...props, children: _jsx(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, transparent: transparent, statusBarTranslucent: statusBarTranslucent, ...props, children: (0, jsx_runtime_1.jsx)(react_native_1.View, { ref: ref, style: primitiveStyles.container, children: children }) }));
16
20
  });
17
- ModalRoot.displayName = "ModalRoot";
18
- export const ModalOverlay = forwardRef(({ dismissible = true, onDismiss, onPress, style, children, activeOpacity = 1, ...props }, ref) => {
19
- const handlePress = React.useCallback((event) => {
21
+ exports.ModalRoot.displayName = "ModalRoot";
22
+ exports.ModalOverlay = (0, react_1.forwardRef)(({ dismissible = true, onDismiss, onPress, style, children, activeOpacity = 1, ...props }, ref) => {
23
+ const handlePress = react_1.default.useCallback((event) => {
20
24
  if (dismissible && onDismiss) {
21
25
  onDismiss();
22
26
  }
@@ -24,15 +28,15 @@ export const ModalOverlay = forwardRef(({ dismissible = true, onDismiss, onPress
24
28
  onPress(event);
25
29
  }
26
30
  }, [dismissible, onDismiss, onPress]);
27
- return (_jsx(TouchableOpacity, { ref: ref, style: [primitiveStyles.overlay, style], activeOpacity: activeOpacity, onPress: handlePress, ...props, children: children }));
31
+ return ((0, jsx_runtime_1.jsx)(react_native_1.TouchableOpacity, { ref: ref, style: [primitiveStyles.overlay, style], activeOpacity: activeOpacity, onPress: handlePress, ...props, children: children }));
28
32
  });
29
- ModalOverlay.displayName = "ModalOverlay";
30
- export const ModalContent = forwardRef(({ children, position = "center", size = "md", style, onStartShouldSetResponder, ...props }, ref) => {
33
+ exports.ModalOverlay.displayName = "ModalOverlay";
34
+ exports.ModalContent = (0, react_1.forwardRef)(({ children, position = "center", size = "md", style, onStartShouldSetResponder, ...props }, ref) => {
31
35
  // Prevent touches from propagating to overlay
32
- const handleStartShouldSetResponder = React.useCallback(() => {
36
+ const handleStartShouldSetResponder = react_1.default.useCallback(() => {
33
37
  return true;
34
38
  }, []);
35
- const positionStyle = React.useMemo(() => {
39
+ const positionStyle = react_1.default.useMemo(() => {
36
40
  switch (position) {
37
41
  case "top":
38
42
  return primitiveStyles.contentTop;
@@ -47,7 +51,7 @@ export const ModalContent = forwardRef(({ children, position = "center", size =
47
51
  return primitiveStyles.contentCenter;
48
52
  }
49
53
  }, [position]);
50
- const sizeStyle = React.useMemo(() => {
54
+ const sizeStyle = react_1.default.useMemo(() => {
51
55
  switch (size) {
52
56
  case "sm":
53
57
  return primitiveStyles.sizeSm;
@@ -62,26 +66,26 @@ export const ModalContent = forwardRef(({ children, position = "center", size =
62
66
  return primitiveStyles.sizeMd;
63
67
  }
64
68
  }, [size]);
65
- return (_jsx(View, { ref: ref, style: [primitiveStyles.content, positionStyle, sizeStyle, style], onStartShouldSetResponder: onStartShouldSetResponder || handleStartShouldSetResponder, ...props, children: children }));
69
+ return ((0, jsx_runtime_1.jsx)(react_native_1.View, { ref: ref, style: [primitiveStyles.content, positionStyle, sizeStyle, style], onStartShouldSetResponder: onStartShouldSetResponder || handleStartShouldSetResponder, ...props, children: children }));
66
70
  });
67
- ModalContent.displayName = "ModalContent";
68
- export const ModalHeader = forwardRef(({ children, withBorder = false, style, ...props }, ref) => {
69
- return (_jsx(View, { ref: ref, style: [
71
+ exports.ModalContent.displayName = "ModalContent";
72
+ exports.ModalHeader = (0, react_1.forwardRef)(({ children, withBorder = false, style, ...props }, ref) => {
73
+ return ((0, jsx_runtime_1.jsx)(react_native_1.View, { ref: ref, style: [
70
74
  primitiveStyles.header,
71
75
  withBorder && primitiveStyles.headerBorder,
72
76
  style,
73
77
  ], ...props, children: children }));
74
78
  });
75
- ModalHeader.displayName = "ModalHeader";
76
- export const ModalBody = forwardRef(({ children, scrollable = true, style, ...props }, ref) => {
79
+ exports.ModalHeader.displayName = "ModalHeader";
80
+ exports.ModalBody = (0, react_1.forwardRef)(({ children, scrollable = true, style, ...props }, ref) => {
77
81
  if (!scrollable) {
78
- return _jsx(View, { style: [primitiveStyles.body, style], children: children });
82
+ return (0, jsx_runtime_1.jsx)(react_native_1.View, { style: [primitiveStyles.body, style], children: children });
79
83
  }
80
- return (_jsx(ScrollView, { ref: ref, style: [primitiveStyles.body, style], showsVerticalScrollIndicator: false, keyboardShouldPersistTaps: "handled", ...props, children: children }));
84
+ return ((0, jsx_runtime_1.jsx)(react_native_1.ScrollView, { ref: ref, style: [primitiveStyles.body, style], showsVerticalScrollIndicator: false, keyboardShouldPersistTaps: "handled", ...props, children: children }));
81
85
  });
82
- ModalBody.displayName = "ModalBody";
83
- export const ModalFooter = forwardRef(({ children, withBorder = false, direction = "row", justify = "flex-end", style, ...props }, ref) => {
84
- return (_jsx(View, { ref: ref, style: [
86
+ exports.ModalBody.displayName = "ModalBody";
87
+ exports.ModalFooter = (0, react_1.forwardRef)(({ children, withBorder = false, direction = "row", justify = "flex-end", style, ...props }, ref) => {
88
+ return ((0, jsx_runtime_1.jsx)(react_native_1.View, { ref: ref, style: [
85
89
  primitiveStyles.footer,
86
90
  withBorder && primitiveStyles.footerBorder,
87
91
  {
@@ -91,9 +95,9 @@ export const ModalFooter = forwardRef(({ children, withBorder = false, direction
91
95
  style,
92
96
  ], ...props, children: children }));
93
97
  });
94
- ModalFooter.displayName = "ModalFooter";
95
- export const ModalClose = forwardRef(({ children, onClose, onPress, ...props }, ref) => {
96
- const handlePress = React.useCallback((event) => {
98
+ exports.ModalFooter.displayName = "ModalFooter";
99
+ exports.ModalClose = (0, react_1.forwardRef)(({ children, onClose, onPress, ...props }, ref) => {
100
+ const handlePress = react_1.default.useCallback((event) => {
97
101
  if (onClose) {
98
102
  onClose();
99
103
  }
@@ -101,11 +105,11 @@ export const ModalClose = forwardRef(({ children, onClose, onPress, ...props },
101
105
  onPress(event);
102
106
  }
103
107
  }, [onClose, onPress]);
104
- return (_jsx(TouchableOpacity, { ref: ref, onPress: handlePress, ...props, children: children }));
108
+ return ((0, jsx_runtime_1.jsx)(react_native_1.TouchableOpacity, { ref: ref, onPress: handlePress, ...props, children: children }));
105
109
  });
106
- ModalClose.displayName = "ModalClose";
110
+ exports.ModalClose.displayName = "ModalClose";
107
111
  // Primitive styles (minimal, unstyled)
108
- const primitiveStyles = StyleSheet.create({
112
+ const primitiveStyles = react_native_1.StyleSheet.create({
109
113
  container: {
110
114
  flex: 1,
111
115
  },
@@ -192,12 +196,12 @@ const primitiveStyles = StyleSheet.create({
192
196
  },
193
197
  });
194
198
  // Export primitive collection
195
- export const ModalPrimitive = {
196
- Root: ModalRoot,
197
- Overlay: ModalOverlay,
198
- Content: ModalContent,
199
- Header: ModalHeader,
200
- Body: ModalBody,
201
- Footer: ModalFooter,
202
- Close: ModalClose,
199
+ exports.ModalPrimitive = {
200
+ Root: exports.ModalRoot,
201
+ Overlay: exports.ModalOverlay,
202
+ Content: exports.ModalContent,
203
+ Header: exports.ModalHeader,
204
+ Body: exports.ModalBody,
205
+ Footer: exports.ModalFooter,
206
+ Close: exports.ModalClose,
203
207
  };
@@ -1,10 +1,16 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { createContext, forwardRef, useContext } from "react";
3
- import { Platform, Text as RNText, } from "react-native";
4
- import { useTheme } from "../../../lib/theme/theme";
5
- import { typography } from "../../../lib/theme/tokens";
6
- export const TextContext = createContext(null);
7
- export function objectFromObjects(arr) {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TextPrimitive = exports.TextBlock = exports.TextSpan = exports.TextRoot = exports.TextContext = void 0;
4
+ exports.objectFromObjects = objectFromObjects;
5
+ exports.useTextContext = useTextContext;
6
+ exports.createTextStyle = createTextStyle;
7
+ const jsx_runtime_1 = require("react/jsx-runtime");
8
+ const react_1 = require("react");
9
+ const react_native_1 = require("react-native");
10
+ const theme_1 = require("../../../lib/theme/theme");
11
+ const tokens_1 = require("../../../lib/theme/tokens");
12
+ exports.TextContext = (0, react_1.createContext)(null);
13
+ function objectFromObjects(arr) {
8
14
  return Object.assign({}, ...arr);
9
15
  }
10
16
  // Size mapping
@@ -51,12 +57,12 @@ const trackingMap = {
51
57
  const getVariantStyles = () => {
52
58
  // get platform-specific typography
53
59
  // iOS, Android, Web (Universal)
54
- const typographicPlatform = (Platform.OS === "ios"
60
+ const typographicPlatform = (react_native_1.Platform.OS === "ios"
55
61
  ? "ios"
56
- : Platform.OS === "android"
62
+ : react_native_1.Platform.OS === "android"
57
63
  ? "android"
58
64
  : "universal");
59
- const platformTypography = typography[typographicPlatform];
65
+ const platformTypography = tokens_1.typography[typographicPlatform];
60
66
  if (!platformTypography) {
61
67
  throw new Error("Platform typography not defined");
62
68
  }
@@ -113,9 +119,9 @@ const getVariantStyles = () => {
113
119
  }
114
120
  };
115
121
  // Text root primitive
116
- export const TextRoot = forwardRef(({ variant, size, weight, color, align, leading, tracking, transform, decoration, italic = false, opacity, style, inherit = true, reset = false, children, ...props }, ref) => {
117
- const { theme } = useTheme();
118
- const parentContext = useContext(TextContext);
122
+ exports.TextRoot = (0, react_1.forwardRef)(({ variant, size, weight, color, align, leading, tracking, transform, decoration, italic = false, opacity, style, inherit = true, reset = false, children, ...props }, ref) => {
123
+ const { theme } = (0, theme_1.useTheme)();
124
+ const parentContext = (0, react_1.useContext)(exports.TextContext);
119
125
  // Get variant styles
120
126
  const variantStyles = getVariantStyles();
121
127
  // Calculate inherited values
@@ -217,25 +223,25 @@ export const TextRoot = forwardRef(({ variant, size, weight, color, align, leadi
217
223
  fontStyle: finalStyles.fontStyle,
218
224
  opacity: finalStyles.opacity,
219
225
  };
220
- return (_jsx(TextContext.Provider, { value: contextValue, children: _jsx(RNText, { ref: ref, style: [finalStyles, style], ...props, children: children }) }));
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 }) }));
221
227
  });
222
- TextRoot.displayName = "TextRoot";
228
+ exports.TextRoot.displayName = "TextRoot";
223
229
  // Text span primitive (inherits from parent but doesn't create new context)
224
- export const TextSpan = forwardRef(({ children, ...props }, ref) => {
225
- return (_jsx(TextRoot, { ref: ref, inherit: true, ...props, children: children }));
230
+ exports.TextSpan = (0, react_1.forwardRef)(({ children, ...props }, ref) => {
231
+ return ((0, jsx_runtime_1.jsx)(exports.TextRoot, { ref: ref, inherit: true, ...props, children: children }));
226
232
  });
227
- TextSpan.displayName = "TextSpan";
233
+ exports.TextSpan.displayName = "TextSpan";
228
234
  // Text block primitive (always creates new context)
229
- export const TextBlock = forwardRef(({ children, reset = true, ...props }, ref) => {
230
- return (_jsx(TextRoot, { ref: ref, reset: reset, ...props, children: children }));
235
+ exports.TextBlock = (0, react_1.forwardRef)(({ children, reset = true, ...props }, ref) => {
236
+ return ((0, jsx_runtime_1.jsx)(exports.TextRoot, { ref: ref, reset: reset, ...props, children: children }));
231
237
  });
232
- TextBlock.displayName = "TextBlock";
238
+ exports.TextBlock.displayName = "TextBlock";
233
239
  // Hook to access current text context
234
- export function useTextContext() {
235
- return useContext(TextContext);
240
+ function useTextContext() {
241
+ return (0, react_1.useContext)(exports.TextContext);
236
242
  }
237
243
  // Utility function to create text styles
238
- export function createTextStyle(props) {
244
+ function createTextStyle(props) {
239
245
  // This is a utility function that can be used to generate styles
240
246
  // without rendering a component
241
247
  const style = {};
@@ -276,11 +282,11 @@ export function createTextStyle(props) {
276
282
  return style;
277
283
  }
278
284
  // Export primitive collection
279
- export const TextPrimitive = {
280
- Root: TextRoot,
281
- Span: TextSpan,
282
- Block: TextBlock,
283
- Context: TextContext,
285
+ exports.TextPrimitive = {
286
+ Root: exports.TextRoot,
287
+ Span: exports.TextSpan,
288
+ Block: exports.TextBlock,
289
+ Context: exports.TextContext,
284
290
  useContext: useTextContext,
285
291
  createStyle: createTextStyle,
286
292
  };