@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.
- package/dist/components/content-metadata/content-metadata-form.js +467 -0
- package/dist/components/content-metadata/content-rights.js +78 -0
- package/dist/components/content-metadata/content-warnings.js +68 -0
- package/dist/components/content-metadata/index.js +11 -0
- package/dist/components/mobile-player/player.js +4 -0
- package/dist/components/mobile-player/ui/report-modal.js +3 -2
- package/dist/components/ui/checkbox.js +87 -0
- package/dist/components/ui/dialog.js +188 -83
- package/dist/components/ui/primitives/input.js +13 -1
- package/dist/components/ui/primitives/modal.js +2 -2
- package/dist/components/ui/select.js +89 -0
- package/dist/components/ui/textarea.js +23 -4
- package/dist/components/ui/toast.js +464 -114
- package/dist/components/ui/tooltip.js +103 -0
- package/dist/index.js +2 -0
- package/dist/lib/metadata-constants.js +157 -0
- package/dist/lib/theme/theme.js +5 -3
- package/dist/streamplace-provider/index.js +14 -4
- package/dist/streamplace-store/content-metadata-actions.js +124 -0
- package/dist/streamplace-store/streamplace-store.js +22 -5
- package/dist/streamplace-store/user.js +67 -7
- package/node-compile-cache/v22.15.0-x64-efe9a9df-0/37be0eec +0 -0
- package/package.json +3 -3
- package/src/components/content-metadata/content-metadata-form.tsx +893 -0
- package/src/components/content-metadata/content-rights.tsx +104 -0
- package/src/components/content-metadata/content-warnings.tsx +100 -0
- package/src/components/content-metadata/index.tsx +10 -0
- package/src/components/mobile-player/player.tsx +5 -0
- package/src/components/mobile-player/ui/report-modal.tsx +13 -7
- package/src/components/ui/checkbox.tsx +147 -0
- package/src/components/ui/dialog.tsx +319 -99
- package/src/components/ui/primitives/input.tsx +19 -2
- package/src/components/ui/primitives/modal.tsx +4 -2
- package/src/components/ui/select.tsx +175 -0
- package/src/components/ui/textarea.tsx +47 -29
- package/src/components/ui/toast.tsx +785 -179
- package/src/components/ui/tooltip.tsx +131 -0
- package/src/index.tsx +3 -0
- package/src/lib/metadata-constants.ts +180 -0
- package/src/lib/theme/theme.tsx +10 -6
- package/src/streamplace-provider/index.tsx +20 -2
- package/src/streamplace-store/content-metadata-actions.tsx +145 -0
- package/src/streamplace-store/streamplace-store.tsx +41 -4
- package/src/streamplace-store/user.tsx +71 -7
- 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
|
-
|
|
6
|
-
style,
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
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 };
|