@streamplace/components 0.7.35 → 0.8.3

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 (45) hide show
  1. package/dist/components/content-metadata/content-metadata-form.js +467 -0
  2. package/dist/components/content-metadata/content-rights.js +78 -0
  3. package/dist/components/content-metadata/content-warnings.js +68 -0
  4. package/dist/components/content-metadata/index.js +11 -0
  5. package/dist/components/mobile-player/player.js +4 -0
  6. package/dist/components/mobile-player/ui/report-modal.js +3 -2
  7. package/dist/components/ui/checkbox.js +87 -0
  8. package/dist/components/ui/dialog.js +188 -83
  9. package/dist/components/ui/primitives/input.js +13 -1
  10. package/dist/components/ui/primitives/modal.js +2 -2
  11. package/dist/components/ui/select.js +89 -0
  12. package/dist/components/ui/textarea.js +23 -4
  13. package/dist/components/ui/toast.js +464 -114
  14. package/dist/components/ui/tooltip.js +103 -0
  15. package/dist/index.js +2 -0
  16. package/dist/lib/metadata-constants.js +157 -0
  17. package/dist/lib/theme/theme.js +5 -3
  18. package/dist/streamplace-provider/index.js +14 -4
  19. package/dist/streamplace-store/content-metadata-actions.js +124 -0
  20. package/dist/streamplace-store/streamplace-store.js +22 -5
  21. package/dist/streamplace-store/user.js +67 -7
  22. package/node-compile-cache/v22.15.0-x64-efe9a9df-0/37be0eec +0 -0
  23. package/package.json +3 -3
  24. package/src/components/content-metadata/content-metadata-form.tsx +893 -0
  25. package/src/components/content-metadata/content-rights.tsx +104 -0
  26. package/src/components/content-metadata/content-warnings.tsx +100 -0
  27. package/src/components/content-metadata/index.tsx +10 -0
  28. package/src/components/mobile-player/player.tsx +5 -0
  29. package/src/components/mobile-player/ui/report-modal.tsx +13 -7
  30. package/src/components/ui/checkbox.tsx +147 -0
  31. package/src/components/ui/dialog.tsx +319 -99
  32. package/src/components/ui/primitives/input.tsx +19 -2
  33. package/src/components/ui/primitives/modal.tsx +4 -2
  34. package/src/components/ui/select.tsx +175 -0
  35. package/src/components/ui/textarea.tsx +47 -29
  36. package/src/components/ui/toast.tsx +785 -179
  37. package/src/components/ui/tooltip.tsx +131 -0
  38. package/src/index.tsx +3 -0
  39. package/src/lib/metadata-constants.ts +180 -0
  40. package/src/lib/theme/theme.tsx +10 -6
  41. package/src/streamplace-provider/index.tsx +20 -2
  42. package/src/streamplace-store/content-metadata-actions.tsx +145 -0
  43. package/src/streamplace-store/streamplace-store.tsx +41 -4
  44. package/src/streamplace-store/user.tsx +71 -7
  45. package/tsconfig.tsbuildinfo +1 -1
@@ -0,0 +1,175 @@
1
+ import { ChevronDown } from "lucide-react-native";
2
+ import { forwardRef, useState } from "react";
3
+ import {
4
+ FlatList,
5
+ Modal,
6
+ StyleSheet,
7
+ TouchableOpacity,
8
+ View,
9
+ } from "react-native";
10
+ import { useTheme } from "../../lib/theme/theme";
11
+ import { Text } from "./text";
12
+
13
+ export interface SelectItem {
14
+ label: string;
15
+ value: string;
16
+ description?: string;
17
+ }
18
+
19
+ export interface SelectProps {
20
+ value?: string;
21
+ onValueChange: (value: string) => void;
22
+ placeholder?: string;
23
+ items: SelectItem[];
24
+ disabled?: boolean;
25
+ style?: any;
26
+ }
27
+
28
+ export const Select = forwardRef<any, SelectProps>(
29
+ (
30
+ {
31
+ value,
32
+ onValueChange,
33
+ placeholder = "Select...",
34
+ items,
35
+ disabled = false,
36
+ style,
37
+ },
38
+ ref,
39
+ ) => {
40
+ const { theme } = useTheme();
41
+ const [isOpen, setIsOpen] = useState(false);
42
+
43
+ const selectedItem = items.find((item) => item.value === value);
44
+
45
+ const handleSelect = (itemValue: string) => {
46
+ onValueChange(itemValue);
47
+ setIsOpen(false);
48
+ };
49
+
50
+ const styles = createStyles(theme, disabled);
51
+
52
+ return (
53
+ <>
54
+ <TouchableOpacity
55
+ ref={ref}
56
+ style={[styles.container, style]}
57
+ onPress={() => !disabled && setIsOpen(true)}
58
+ disabled={disabled}
59
+ >
60
+ <Text style={styles.value}>{selectedItem?.label || placeholder}</Text>
61
+ <ChevronDown size={16} color={theme.colors.textMuted} />
62
+ </TouchableOpacity>
63
+
64
+ <Modal
65
+ visible={isOpen}
66
+ transparent
67
+ animationType="fade"
68
+ onRequestClose={() => setIsOpen(false)}
69
+ >
70
+ <TouchableOpacity
71
+ style={styles.overlay}
72
+ activeOpacity={1}
73
+ onPress={() => setIsOpen(false)}
74
+ >
75
+ <View style={styles.dropdown}>
76
+ <FlatList
77
+ data={items}
78
+ keyExtractor={(item) => item.value}
79
+ renderItem={({ item }) => (
80
+ <TouchableOpacity
81
+ style={[
82
+ styles.item,
83
+ item.value === value && styles.selectedItem,
84
+ ]}
85
+ onPress={() => handleSelect(item.value)}
86
+ >
87
+ <Text
88
+ style={[
89
+ styles.itemText,
90
+ item.value === value ? styles.selectedItemText : {},
91
+ ]}
92
+ >
93
+ {item.label}
94
+ </Text>
95
+ {item.description && (
96
+ <Text style={styles.itemDescription}>
97
+ {item.description}
98
+ </Text>
99
+ )}
100
+ </TouchableOpacity>
101
+ )}
102
+ style={styles.list}
103
+ />
104
+ </View>
105
+ </TouchableOpacity>
106
+ </Modal>
107
+ </>
108
+ );
109
+ },
110
+ );
111
+
112
+ Select.displayName = "Select";
113
+
114
+ function createStyles(theme: any, disabled: boolean) {
115
+ return StyleSheet.create({
116
+ container: {
117
+ flexDirection: "row",
118
+ alignItems: "center",
119
+ justifyContent: "space-between",
120
+ paddingHorizontal: theme.spacing[3],
121
+ paddingVertical: theme.spacing[3],
122
+ borderWidth: 1,
123
+ borderColor: theme.colors.border,
124
+ borderRadius: theme.borderRadius.md,
125
+ backgroundColor: disabled ? theme.colors.muted : theme.colors.card,
126
+ minHeight: theme.touchTargets.minimum,
127
+ },
128
+ value: {
129
+ fontSize: 16,
130
+ color: disabled ? theme.colors.textDisabled : theme.colors.text,
131
+ flex: 1,
132
+ },
133
+ overlay: {
134
+ flex: 1,
135
+ backgroundColor: "rgba(0, 0, 0, 0.5)",
136
+ justifyContent: "center",
137
+ alignItems: "center",
138
+ },
139
+ dropdown: {
140
+ backgroundColor: theme.colors.background,
141
+ borderRadius: theme.borderRadius.md,
142
+ borderWidth: 1,
143
+ borderColor: theme.colors.border,
144
+ maxHeight: 300,
145
+ width: "90%",
146
+ maxWidth: 400,
147
+ ...theme.shadows.lg,
148
+ },
149
+ list: {
150
+ maxHeight: 300,
151
+ },
152
+ item: {
153
+ paddingHorizontal: theme.spacing[4],
154
+ paddingVertical: theme.spacing[3],
155
+ borderBottomWidth: 1,
156
+ borderBottomColor: theme.colors.border,
157
+ },
158
+ selectedItem: {
159
+ backgroundColor: theme.colors.primary,
160
+ },
161
+ itemText: {
162
+ fontSize: 16,
163
+ color: theme.colors.text,
164
+ },
165
+ selectedItemText: {
166
+ color: theme.colors.primaryForeground,
167
+ fontWeight: "500",
168
+ },
169
+ itemDescription: {
170
+ fontSize: 14,
171
+ color: theme.colors.textMuted,
172
+ marginTop: theme.spacing[1],
173
+ },
174
+ });
175
+ }
@@ -1,34 +1,52 @@
1
+ import {
2
+ BottomSheetTextInput,
3
+ useBottomSheetInternal,
4
+ } from "@gorhom/bottom-sheet";
1
5
  import * as React from "react";
2
- import { TextInput, type TextInputProps } from "react-native";
6
+ import { Platform, TextInput, type TextInputProps } from "react-native";
3
7
  import { bg, borders, flex, p, text } from "../../lib/theme/atoms";
4
8
 
5
- function Textarea({
6
- style,
7
- multiline = true,
8
- numberOfLines = 4,
9
- ...props
10
- }: TextInputProps & {
11
- ref?: React.RefObject<TextInput>;
12
- }) {
13
- return (
14
- <TextInput
15
- style={[
16
- flex.values[1],
17
- borders.width.thin,
18
- borders.color.gray[400],
19
- bg.gray[900],
20
- p[3],
21
- text.gray[200],
22
- props.editable === false && { opacity: 0.5 },
23
- { borderRadius: 10 },
24
- style,
25
- ]}
26
- multiline={multiline}
27
- numberOfLines={numberOfLines}
28
- textAlignVertical="top"
29
- {...props}
30
- />
31
- );
32
- }
9
+ const Textarea = React.forwardRef<TextInput, TextInputProps>(
10
+ ({ style, multiline = true, numberOfLines = 4, ...props }, ref) => {
11
+ // Detect if we're inside a bottom sheet
12
+ let isInBottomSheet = false;
13
+ try {
14
+ useBottomSheetInternal();
15
+ isInBottomSheet = true;
16
+ } catch {
17
+ // Not in a bottom sheet context
18
+ isInBottomSheet = false;
19
+ }
20
+
21
+ // Use BottomSheetTextInput when inside a bottom sheet, regular TextInput otherwise
22
+ const InputComponent =
23
+ isInBottomSheet && Platform.OS !== "web"
24
+ ? BottomSheetTextInput
25
+ : TextInput;
26
+
27
+ return (
28
+ <InputComponent
29
+ ref={ref as any}
30
+ style={[
31
+ flex.values[1],
32
+ borders.width.thin,
33
+ borders.color.gray[400],
34
+ bg.gray[900],
35
+ p[3],
36
+ text.gray[200],
37
+ props.editable === false && { opacity: 0.5 },
38
+ { borderRadius: 10 },
39
+ style,
40
+ ]}
41
+ multiline={multiline}
42
+ numberOfLines={numberOfLines}
43
+ textAlignVertical="top"
44
+ {...props}
45
+ />
46
+ );
47
+ },
48
+ );
49
+
50
+ Textarea.displayName = "Textarea";
33
51
 
34
52
  export { Textarea };