@openpeepshq/rn-components 0.6.0 → 0.6.1
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/package.json +3 -3
- package/src/components/conversations/ConversationParticipantsModal.tsx +6 -1
- package/src/components/conversations/ConversationPreviewCard.tsx +1 -1
- package/src/components/post/types/Event.tsx +39 -20
- package/src/components/ui/button.tsx +2 -2
- package/src/global.css +43 -41
- package/src/pages/conversations/Show.tsx +54 -12
- package/src/theme/OpenPeepsThemeProvider.tsx +1 -5
- package/src/theme/defaults.ts +7 -7
- package/src/theme/utils.ts +17 -1
- package/tailwind.config.js +90 -28
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openpeepshq/rn-components",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.1",
|
|
4
4
|
"description": "React Native community screens and shared UI (extracted from the Black Ambition app) for the OpenPeeps stack.",
|
|
5
5
|
"source": "./src/index.ts",
|
|
6
6
|
"main": "./src/index.ts",
|
|
@@ -140,8 +140,8 @@
|
|
|
140
140
|
"timezones-list": "^3.1.0",
|
|
141
141
|
"validator": "^13.15.23",
|
|
142
142
|
"zustand": "^5.0.3",
|
|
143
|
-
"@openpeepshq/
|
|
144
|
-
"@openpeepshq/
|
|
143
|
+
"@openpeepshq/react": "^0.6.0",
|
|
144
|
+
"@openpeepshq/common": "^0.3.0"
|
|
145
145
|
},
|
|
146
146
|
"devDependencies": {
|
|
147
147
|
"@babel/core": "^7.26.7",
|
|
@@ -34,7 +34,12 @@ export const ConversationParticipantsModal = ({
|
|
|
34
34
|
</ThemedText>
|
|
35
35
|
</View>
|
|
36
36
|
{participants.map((profile) => (
|
|
37
|
-
<ProfileCard
|
|
37
|
+
<ProfileCard
|
|
38
|
+
key={profile.id}
|
|
39
|
+
profile={profile}
|
|
40
|
+
showAction={false}
|
|
41
|
+
hasAction={false}
|
|
42
|
+
/>
|
|
38
43
|
))}
|
|
39
44
|
</BaseSheet>
|
|
40
45
|
);
|
|
@@ -73,7 +73,7 @@ export const ConversationPreviewCard = ({
|
|
|
73
73
|
>
|
|
74
74
|
<View className="flex w-full flex-col gap-x-1 border-b p-3 text-left">
|
|
75
75
|
<View className="flex flex-row items-center gap-4">
|
|
76
|
-
<View className="flex -space-x-2">
|
|
76
|
+
<View className="flex-row -space-x-2">
|
|
77
77
|
{participants.slice(0, 3).map((p) => (
|
|
78
78
|
<ProfileAvatar
|
|
79
79
|
key={p.id}
|
|
@@ -1,23 +1,29 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Event, PublicPost } from '@openpeepshq/common';
|
|
3
3
|
import { formatEventRecurrence } from '@openpeepshq/common/lib';
|
|
4
|
-
import { View } from 'react-native';
|
|
4
|
+
import { Pressable, View } from 'react-native';
|
|
5
5
|
import { useTranslation } from 'react-i18next';
|
|
6
|
+
import { useNavigation } from '@react-navigation/native';
|
|
6
7
|
import { CachedImage } from '../../custom/common/index';
|
|
7
8
|
import { ParticipantAvatar } from '../../custom/common/participant-avatar';
|
|
8
9
|
import { ThemedText } from '../../ui/themed-text';
|
|
9
10
|
import { formatEventDate } from '../../../lib/utils';
|
|
11
|
+
import { MainStackParamList } from '../../navigation/types/index';
|
|
12
|
+
import { NativeStackNavigationProp } from '@react-navigation/native-stack';
|
|
13
|
+
import { Button } from '../../ui/button';
|
|
10
14
|
|
|
11
15
|
export const FeedEvent = ({ post }: { post: PublicPost }) => {
|
|
12
16
|
const { t } = useTranslation();
|
|
17
|
+
const navigation =
|
|
18
|
+
useNavigation<NativeStackNavigationProp<MainStackParamList>>();
|
|
13
19
|
const eventData = post.data as Event;
|
|
14
20
|
const start = post.occurrenceStart ?? eventData.start;
|
|
15
21
|
const end = post.occurrenceEnd ?? eventData.end;
|
|
16
22
|
|
|
17
23
|
return (
|
|
18
|
-
|
|
24
|
+
<View className="w-full flex-col gap-1">
|
|
19
25
|
{eventData.image && (
|
|
20
|
-
<View className="w-full aspect-video overflow-hidden">
|
|
26
|
+
<View className="w-full aspect-video overflow-hidden rounded-md">
|
|
21
27
|
<CachedImage
|
|
22
28
|
url={eventData.image}
|
|
23
29
|
className="w-full h-full"
|
|
@@ -26,35 +32,48 @@ export const FeedEvent = ({ post }: { post: PublicPost }) => {
|
|
|
26
32
|
</View>
|
|
27
33
|
)}
|
|
28
34
|
|
|
29
|
-
<View className="
|
|
30
|
-
<ThemedText className="text-muted-foreground text-sm
|
|
35
|
+
<View className="flex-row items-center justify-between">
|
|
36
|
+
<ThemedText className="text-muted-foreground text-sm">
|
|
31
37
|
{formatEventDate(start)}
|
|
32
38
|
{end && ` - ${formatEventDate(end)}`}
|
|
33
39
|
{eventData.timeZone && ` (${eventData.timeZone})`}
|
|
34
40
|
</ThemedText>
|
|
41
|
+
<Button
|
|
42
|
+
variant="outline"
|
|
43
|
+
size="sm"
|
|
44
|
+
onPress={() => navigation.navigate('Post', { id: post.id })}
|
|
45
|
+
>
|
|
46
|
+
<ThemedText className="text-xs">
|
|
47
|
+
{t('posts.event.viewEvent', { defaultValue: 'View Event' })}
|
|
48
|
+
</ThemedText>
|
|
49
|
+
</Button>
|
|
50
|
+
</View>
|
|
35
51
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
52
|
+
<ThemedText className="text-lg font-semibold">
|
|
53
|
+
{eventData.name}
|
|
54
|
+
</ThemedText>
|
|
39
55
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
56
|
+
{eventData.recurrence ? (
|
|
57
|
+
<ThemedText className="text-muted-foreground text-sm">
|
|
58
|
+
{formatEventRecurrence(eventData.recurrence, t, eventData.start)}
|
|
59
|
+
</ThemedText>
|
|
60
|
+
) : null}
|
|
45
61
|
|
|
46
|
-
|
|
47
|
-
|
|
62
|
+
{eventData.url ? (
|
|
63
|
+
<Pressable onPress={() => navigation.navigate('Post', { id: post.id })}>
|
|
64
|
+
<ThemedText className="text-sm text-primary">
|
|
48
65
|
🔗 {eventData.url}
|
|
49
66
|
</ThemedText>
|
|
50
|
-
|
|
67
|
+
</Pressable>
|
|
68
|
+
) : null}
|
|
51
69
|
|
|
52
|
-
|
|
53
|
-
|
|
70
|
+
{eventData?.moderators && eventData.moderators.length > 0 ? (
|
|
71
|
+
<View className="flex-row items-center gap-1">
|
|
72
|
+
{eventData.moderators.slice(0, 2).map((moderator, index) => (
|
|
54
73
|
<ParticipantAvatar key={index} profileId={moderator} />
|
|
55
74
|
))}
|
|
56
75
|
</View>
|
|
57
|
-
|
|
58
|
-
|
|
76
|
+
) : null}
|
|
77
|
+
</View>
|
|
59
78
|
);
|
|
60
79
|
};
|
|
@@ -20,8 +20,8 @@ const buttonVariants = cva(
|
|
|
20
20
|
},
|
|
21
21
|
size: {
|
|
22
22
|
default: 'h-10 px-4 py-2 native:h-12 native:px-5 native:py-3',
|
|
23
|
-
sm: 'h-9
|
|
24
|
-
lg: 'h-11
|
|
23
|
+
sm: 'h-9 px-3',
|
|
24
|
+
lg: 'h-11 px-8 native:h-14',
|
|
25
25
|
icon: 'h-10 w-10',
|
|
26
26
|
},
|
|
27
27
|
},
|
package/src/global.css
CHANGED
|
@@ -4,48 +4,50 @@
|
|
|
4
4
|
|
|
5
5
|
@layer base {
|
|
6
6
|
:root {
|
|
7
|
-
--background:
|
|
8
|
-
--foreground:
|
|
9
|
-
--card:
|
|
10
|
-
--card-foreground:
|
|
11
|
-
--popover:
|
|
12
|
-
--popover-foreground:
|
|
13
|
-
--primary:
|
|
14
|
-
--primary-foreground:
|
|
15
|
-
--secondary:
|
|
16
|
-
--secondary-foreground:
|
|
17
|
-
--muted:
|
|
18
|
-
--muted-foreground:
|
|
19
|
-
--accent:
|
|
20
|
-
--accent-foreground:
|
|
21
|
-
--destructive:
|
|
22
|
-
--destructive-foreground:
|
|
23
|
-
--border:
|
|
24
|
-
--input:
|
|
25
|
-
--ring:
|
|
26
|
-
--alpha:
|
|
7
|
+
--background: 255 255 255;
|
|
8
|
+
--foreground: 10 10 11;
|
|
9
|
+
--card: 255 255 255;
|
|
10
|
+
--card-foreground: 10 10 11;
|
|
11
|
+
--popover: 255 255 255;
|
|
12
|
+
--popover-foreground: 10 10 11;
|
|
13
|
+
--primary: 22 22 26;
|
|
14
|
+
--primary-foreground: 250 250 250;
|
|
15
|
+
--secondary: 244 244 245;
|
|
16
|
+
--secondary-foreground: 22 22 26;
|
|
17
|
+
--muted: 244 244 246;
|
|
18
|
+
--muted-foreground: 113 113 122;
|
|
19
|
+
--accent: 244 244 245;
|
|
20
|
+
--accent-foreground: 22 22 26;
|
|
21
|
+
--destructive: 239 68 68;
|
|
22
|
+
--destructive-foreground: 250 250 250;
|
|
23
|
+
--border: 228 228 231;
|
|
24
|
+
--input: 228 228 231;
|
|
25
|
+
--ring: 22 22 26;
|
|
26
|
+
--alpha: 250 250 250;
|
|
27
|
+
--surface-2: 228 228 231;
|
|
27
28
|
}
|
|
28
29
|
|
|
29
30
|
.dark:root {
|
|
30
|
-
--background:
|
|
31
|
-
--foreground:
|
|
32
|
-
--card:
|
|
33
|
-
--card-foreground:
|
|
34
|
-
--popover:
|
|
35
|
-
--popover-foreground:
|
|
36
|
-
--primary:
|
|
37
|
-
--primary-foreground:
|
|
38
|
-
--secondary:
|
|
39
|
-
--secondary-foreground:
|
|
40
|
-
--muted:
|
|
41
|
-
--muted-foreground:
|
|
42
|
-
--accent:
|
|
43
|
-
--accent-foreground:
|
|
44
|
-
--destructive:
|
|
45
|
-
--destructive-foreground:
|
|
46
|
-
--border:
|
|
47
|
-
--input:
|
|
48
|
-
--ring:
|
|
49
|
-
--alpha:
|
|
31
|
+
--background: 10 10 15;
|
|
32
|
+
--foreground: 250 250 250;
|
|
33
|
+
--card: 10 10 15;
|
|
34
|
+
--card-foreground: 250 250 250;
|
|
35
|
+
--popover: 10 10 15;
|
|
36
|
+
--popover-foreground: 250 250 250;
|
|
37
|
+
--primary: 250 250 250;
|
|
38
|
+
--primary-foreground: 22 22 26;
|
|
39
|
+
--secondary: 40 40 46;
|
|
40
|
+
--secondary-foreground: 250 250 250;
|
|
41
|
+
--muted: 39 39 42;
|
|
42
|
+
--muted-foreground: 161 161 170;
|
|
43
|
+
--accent: 40 40 46;
|
|
44
|
+
--accent-foreground: 250 250 250;
|
|
45
|
+
--destructive: 220 38 38;
|
|
46
|
+
--destructive-foreground: 250 250 250;
|
|
47
|
+
--border: 40 40 46;
|
|
48
|
+
--input: 40 40 46;
|
|
49
|
+
--ring: 212 212 216;
|
|
50
|
+
--alpha: 24 24 27;
|
|
51
|
+
--surface-2: 63 63 70;
|
|
50
52
|
}
|
|
51
|
-
}
|
|
53
|
+
}
|
|
@@ -29,6 +29,8 @@ import {
|
|
|
29
29
|
ConversationProfileHeader,
|
|
30
30
|
MessageInThread,
|
|
31
31
|
} from '../../components/conversations/index';
|
|
32
|
+
import { ProfileAvatar } from '../../components/profile/Avatar';
|
|
33
|
+
import { ProfileCard } from '../../components/profile/ProfileCard';
|
|
32
34
|
|
|
33
35
|
type ConversationProps = MainScreenProps<'Conversation'>;
|
|
34
36
|
|
|
@@ -46,12 +48,18 @@ export const ConversationShow = ({ route, navigation }: ConversationProps) => {
|
|
|
46
48
|
const [participantsOpen, setParticipantsOpen] = useState(false);
|
|
47
49
|
|
|
48
50
|
const sendMessage = openpeepsApi.createConversationPostAction({ id });
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
51
|
+
|
|
52
|
+
// Mirror the web Show page: derive participants from the last message's
|
|
53
|
+
// audience, excluding the current profile.
|
|
54
|
+
const lastMessage = messages?.slice(-1)[0];
|
|
55
|
+
const participants =
|
|
56
|
+
lastMessage?.audience?.filter((a) => a.id !== currentProfile?.id) ?? [];
|
|
57
|
+
const multipleParticipants = participants.length > 1;
|
|
58
|
+
|
|
59
|
+
const participantNames =
|
|
60
|
+
participants.length > 0
|
|
61
|
+
? participants.map((p) => p.displayName || `@${p.handle}`).join(', ')
|
|
62
|
+
: t('conversations.title', { defaultValue: 'Conversation' });
|
|
55
63
|
|
|
56
64
|
const resetForm = useCallback(() => {
|
|
57
65
|
setContent('');
|
|
@@ -65,7 +73,6 @@ export const ConversationShow = ({ route, navigation }: ConversationProps) => {
|
|
|
65
73
|
|
|
66
74
|
try {
|
|
67
75
|
setIsSending(true);
|
|
68
|
-
const lastMessage = messages?.slice(-1)[0];
|
|
69
76
|
await sendMessage({
|
|
70
77
|
visibility: 'direct',
|
|
71
78
|
audience: lastMessage?.audience,
|
|
@@ -105,8 +112,10 @@ export const ConversationShow = ({ route, navigation }: ConversationProps) => {
|
|
|
105
112
|
useSetPageHeader(
|
|
106
113
|
isLoading ? undefined : (
|
|
107
114
|
<ConversationProfileHeader
|
|
108
|
-
participants={
|
|
109
|
-
onPress={
|
|
115
|
+
participants={participants}
|
|
116
|
+
onPress={
|
|
117
|
+
multipleParticipants ? () => setParticipantsOpen(true) : undefined
|
|
118
|
+
}
|
|
110
119
|
/>
|
|
111
120
|
),
|
|
112
121
|
isLoading ? undefined : (
|
|
@@ -129,6 +138,39 @@ export const ConversationShow = ({ route, navigation }: ConversationProps) => {
|
|
|
129
138
|
return (
|
|
130
139
|
<ThemedView className="flex-1">
|
|
131
140
|
<View className="flex-1">
|
|
141
|
+
{/* Section under the page header showing the participants,
|
|
142
|
+
mirroring the web conversation Show page. */}
|
|
143
|
+
<View className="border-b border-border">
|
|
144
|
+
{participants.length === 1 && participants[0] ? (
|
|
145
|
+
<ProfileCard
|
|
146
|
+
profile={participants[0]}
|
|
147
|
+
showAction={false}
|
|
148
|
+
hasAction={false}
|
|
149
|
+
/>
|
|
150
|
+
) : multipleParticipants ? (
|
|
151
|
+
<TouchableOpacity
|
|
152
|
+
onPress={() => setParticipantsOpen(true)}
|
|
153
|
+
className="w-full flex-row items-center gap-2 p-3"
|
|
154
|
+
>
|
|
155
|
+
<View className="flex-row -space-x-2 shrink-0">
|
|
156
|
+
{participants.slice(0, 4).map((p) => (
|
|
157
|
+
<ProfileAvatar
|
|
158
|
+
key={p.id}
|
|
159
|
+
profile={p}
|
|
160
|
+
className="size-9 border-0"
|
|
161
|
+
/>
|
|
162
|
+
))}
|
|
163
|
+
</View>
|
|
164
|
+
<ThemedText
|
|
165
|
+
className="min-w-0 truncate text-sm font-medium"
|
|
166
|
+
numberOfLines={1}
|
|
167
|
+
>
|
|
168
|
+
{participantNames}
|
|
169
|
+
</ThemedText>
|
|
170
|
+
</TouchableOpacity>
|
|
171
|
+
) : null}
|
|
172
|
+
</View>
|
|
173
|
+
|
|
132
174
|
<DropdownMenu>
|
|
133
175
|
<KeyboardAvoidingView
|
|
134
176
|
className="flex-1"
|
|
@@ -147,7 +189,7 @@ export const ConversationShow = ({ route, navigation }: ConversationProps) => {
|
|
|
147
189
|
<MessageInThread
|
|
148
190
|
previous={messages[idx - 1]}
|
|
149
191
|
message={message}
|
|
150
|
-
multipleParticipants={
|
|
192
|
+
multipleParticipants={multipleParticipants}
|
|
151
193
|
conversationRootId={id}
|
|
152
194
|
/>
|
|
153
195
|
</View>
|
|
@@ -206,11 +248,11 @@ export const ConversationShow = ({ route, navigation }: ConversationProps) => {
|
|
|
206
248
|
</View>
|
|
207
249
|
</KeyboardAvoidingView>
|
|
208
250
|
</DropdownMenu>
|
|
209
|
-
{
|
|
251
|
+
{multipleParticipants && participantsOpen ? (
|
|
210
252
|
<ConversationParticipantsModal
|
|
211
253
|
open
|
|
212
254
|
onOpenChange={setParticipantsOpen}
|
|
213
|
-
participants={
|
|
255
|
+
participants={participants}
|
|
214
256
|
/>
|
|
215
257
|
) : null}
|
|
216
258
|
</View>
|
|
@@ -48,11 +48,7 @@ export const OpenPeepsThemeProvider = ({
|
|
|
48
48
|
buttonRadius: resolvedTheme.buttonRadius,
|
|
49
49
|
radius: resolvedTheme.radius,
|
|
50
50
|
}),
|
|
51
|
-
[
|
|
52
|
-
resolvedTheme.buttonRadius,
|
|
53
|
-
resolvedTheme.radius,
|
|
54
|
-
theme.colors,
|
|
55
|
-
]
|
|
51
|
+
[resolvedTheme.buttonRadius, resolvedTheme.radius, theme.colors]
|
|
56
52
|
);
|
|
57
53
|
|
|
58
54
|
useEffect(() => {
|
package/src/theme/defaults.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { OpenPeepsTheme, ColorName, ColorValue } from './types';
|
|
1
|
+
import type { OpenPeepsTheme, ColorName, ColorValue } from './types';
|
|
2
2
|
|
|
3
3
|
export const DEFAULT_COLORS: ColorValue[] = [
|
|
4
4
|
{
|
|
@@ -8,7 +8,7 @@ export const DEFAULT_COLORS: ColorValue[] = [
|
|
|
8
8
|
},
|
|
9
9
|
{
|
|
10
10
|
name: 'foreground',
|
|
11
|
-
light: '#
|
|
11
|
+
light: '#0a0a0b',
|
|
12
12
|
dark: '#fafafa',
|
|
13
13
|
},
|
|
14
14
|
{
|
|
@@ -18,7 +18,7 @@ export const DEFAULT_COLORS: ColorValue[] = [
|
|
|
18
18
|
},
|
|
19
19
|
{
|
|
20
20
|
name: 'card-foreground',
|
|
21
|
-
light: '#
|
|
21
|
+
light: '#0a0a0b',
|
|
22
22
|
dark: '#fafafa',
|
|
23
23
|
},
|
|
24
24
|
{
|
|
@@ -28,7 +28,7 @@ export const DEFAULT_COLORS: ColorValue[] = [
|
|
|
28
28
|
},
|
|
29
29
|
{
|
|
30
30
|
name: 'popover-foreground',
|
|
31
|
-
light: '#
|
|
31
|
+
light: '#0a0a0b',
|
|
32
32
|
dark: '#fafafa',
|
|
33
33
|
},
|
|
34
34
|
{
|
|
@@ -43,7 +43,7 @@ export const DEFAULT_COLORS: ColorValue[] = [
|
|
|
43
43
|
},
|
|
44
44
|
{
|
|
45
45
|
name: 'secondary',
|
|
46
|
-
light: '#
|
|
46
|
+
light: '#f4f4f5',
|
|
47
47
|
dark: '#28282e',
|
|
48
48
|
},
|
|
49
49
|
{
|
|
@@ -54,7 +54,7 @@ export const DEFAULT_COLORS: ColorValue[] = [
|
|
|
54
54
|
{
|
|
55
55
|
name: 'muted',
|
|
56
56
|
light: '#f4f4f6',
|
|
57
|
-
dark: '#
|
|
57
|
+
dark: '#27272a',
|
|
58
58
|
},
|
|
59
59
|
{
|
|
60
60
|
name: 'muted-foreground',
|
|
@@ -63,7 +63,7 @@ export const DEFAULT_COLORS: ColorValue[] = [
|
|
|
63
63
|
},
|
|
64
64
|
{
|
|
65
65
|
name: 'accent',
|
|
66
|
-
light: '#
|
|
66
|
+
light: '#f4f4f5',
|
|
67
67
|
dark: '#28282e',
|
|
68
68
|
},
|
|
69
69
|
{
|
package/src/theme/utils.ts
CHANGED
|
@@ -2,13 +2,29 @@ import { vars } from 'nativewind';
|
|
|
2
2
|
import { mapColors } from './defaults';
|
|
3
3
|
import type { OpenPeepsTheme } from './types';
|
|
4
4
|
|
|
5
|
+
/** Convert a hex color (#rrggbb) to "R G B" channel string for CSS `rgb()` usage. */
|
|
6
|
+
const hexToRgbChannels = (hex: string): string => {
|
|
7
|
+
const sanitized = hex.replaceAll('##', '#');
|
|
8
|
+
const m = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(sanitized);
|
|
9
|
+
if (!m) return hex;
|
|
10
|
+
const [, r, g, b] = m;
|
|
11
|
+
if (r === undefined || g === undefined || b === undefined) return hex;
|
|
12
|
+
return `${parseInt(r, 16)} ${parseInt(g, 16)} ${parseInt(b, 16)}`;
|
|
13
|
+
};
|
|
14
|
+
|
|
5
15
|
export const getThemeVars = (
|
|
6
16
|
colors: OpenPeepsTheme['colors'],
|
|
7
17
|
radii?: { buttonRadius?: string; radius?: string }
|
|
8
18
|
) =>
|
|
9
19
|
vars({
|
|
20
|
+
// CSS custom properties consumed by Tailwind `channel()` classes need
|
|
21
|
+
// "R G B" channel format so `rgb(var(--x) / <alpha-value>)` resolves.
|
|
22
|
+
// The `colors` object keeps hex strings for direct RN style usage.
|
|
10
23
|
...Object.fromEntries(
|
|
11
|
-
Object.entries(colors).map(([key, value]) => [
|
|
24
|
+
Object.entries(colors).map(([key, value]) => [
|
|
25
|
+
`--${key}`,
|
|
26
|
+
hexToRgbChannels(value),
|
|
27
|
+
])
|
|
12
28
|
),
|
|
13
29
|
'--theme-rounded-base': radii?.buttonRadius || '9999px',
|
|
14
30
|
'--theme-rounded-container': radii?.radius || '0.5rem',
|
package/tailwind.config.js
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
const { hairlineWidth } = require('nativewind/theme');
|
|
2
2
|
|
|
3
|
+
/** `channel()` pattern: `rgb(var(--name) / <alpha-value>)` so `/N` opacity
|
|
4
|
+
* modifiers (e.g. `bg-primary/10`) work on native. Requires CSS variables to
|
|
5
|
+
* be in "R G B" channel format (see global.css / theme/utils.ts). */
|
|
6
|
+
const channel = (name) => `rgb(var(${name}) / <alpha-value>)`;
|
|
7
|
+
|
|
3
8
|
export default {
|
|
4
9
|
// NOTE: Update this to include the paths to all of your component files.
|
|
5
10
|
darkMode: 'class',
|
|
@@ -9,40 +14,51 @@ export default {
|
|
|
9
14
|
theme: {
|
|
10
15
|
extend: {
|
|
11
16
|
colors: {
|
|
12
|
-
border: '
|
|
13
|
-
input: '
|
|
14
|
-
ring: '
|
|
15
|
-
background: '
|
|
16
|
-
foreground: '
|
|
17
|
-
primary: {
|
|
18
|
-
DEFAULT: '
|
|
19
|
-
foreground: '
|
|
17
|
+
'border': channel('--border'),
|
|
18
|
+
'input': channel('--input'),
|
|
19
|
+
'ring': channel('--ring'),
|
|
20
|
+
'background': channel('--background'),
|
|
21
|
+
'foreground': channel('--foreground'),
|
|
22
|
+
'primary': {
|
|
23
|
+
DEFAULT: channel('--primary'),
|
|
24
|
+
foreground: channel('--primary-foreground'),
|
|
25
|
+
},
|
|
26
|
+
'secondary': {
|
|
27
|
+
DEFAULT: channel('--secondary'),
|
|
28
|
+
foreground: channel('--secondary-foreground'),
|
|
20
29
|
},
|
|
21
|
-
|
|
22
|
-
DEFAULT: '
|
|
23
|
-
foreground: '
|
|
30
|
+
'destructive': {
|
|
31
|
+
DEFAULT: channel('--destructive'),
|
|
32
|
+
foreground: channel('--destructive-foreground'),
|
|
24
33
|
},
|
|
25
|
-
|
|
26
|
-
DEFAULT: '
|
|
27
|
-
foreground: '
|
|
34
|
+
'muted': {
|
|
35
|
+
DEFAULT: channel('--muted'),
|
|
36
|
+
foreground: channel('--muted-foreground'),
|
|
28
37
|
},
|
|
29
|
-
|
|
30
|
-
DEFAULT: '
|
|
31
|
-
foreground: '
|
|
38
|
+
'accent': {
|
|
39
|
+
DEFAULT: channel('--accent'),
|
|
40
|
+
foreground: channel('--accent-foreground'),
|
|
32
41
|
},
|
|
33
|
-
|
|
34
|
-
DEFAULT: '
|
|
35
|
-
foreground: '
|
|
42
|
+
'popover': {
|
|
43
|
+
DEFAULT: channel('--popover'),
|
|
44
|
+
foreground: channel('--popover-foreground'),
|
|
36
45
|
},
|
|
37
|
-
|
|
38
|
-
DEFAULT: '
|
|
39
|
-
foreground: '
|
|
46
|
+
'card': {
|
|
47
|
+
DEFAULT: channel('--card'),
|
|
48
|
+
foreground: channel('--card-foreground'),
|
|
40
49
|
},
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
50
|
+
// `surface` mirrors `muted` (same token on the web preset).
|
|
51
|
+
'surface': {
|
|
52
|
+
DEFAULT: channel('--muted'),
|
|
53
|
+
foreground: channel('--muted-foreground'),
|
|
44
54
|
},
|
|
45
|
-
|
|
55
|
+
'surface-2': channel('--surface-2'),
|
|
56
|
+
'alpha': channel('--alpha'),
|
|
57
|
+
},
|
|
58
|
+
// Override Tailwind's default `borderColor.DEFAULT` so bare `border`/`border-b`
|
|
59
|
+
// utilities follow the theme border color instead of a static gray.
|
|
60
|
+
borderColor: {
|
|
61
|
+
DEFAULT: channel('--border'),
|
|
46
62
|
},
|
|
47
63
|
borderWidth: {
|
|
48
64
|
hairline: hairlineWidth(),
|
|
@@ -53,7 +69,53 @@ export default {
|
|
|
53
69
|
md: 'calc(var(--theme-rounded-container, 0.5rem) - 2px)',
|
|
54
70
|
sm: 'calc(var(--theme-rounded-container, 0.5rem) - 4px)',
|
|
55
71
|
},
|
|
72
|
+
fontFamily: {
|
|
73
|
+
sans: 'var(--theme-font-family-base, system-ui)',
|
|
74
|
+
heading: 'var(--theme-font-family-heading, system-ui)',
|
|
75
|
+
},
|
|
76
|
+
keyframes: {
|
|
77
|
+
'accordion-down': {
|
|
78
|
+
from: { height: '0' },
|
|
79
|
+
to: { height: 'var(--radix-accordion-content-height)' },
|
|
80
|
+
},
|
|
81
|
+
'accordion-up': {
|
|
82
|
+
from: { height: 'var(--radix-accordion-content-height)' },
|
|
83
|
+
to: { height: '0' },
|
|
84
|
+
},
|
|
85
|
+
'spin': {
|
|
86
|
+
to: { transform: 'rotate(360deg)' },
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
animation: {
|
|
90
|
+
'accordion-down': 'accordion-down 0.2s ease-out',
|
|
91
|
+
'accordion-up': 'accordion-up 0.2s ease-out',
|
|
92
|
+
'spin': 'spin 1s linear infinite',
|
|
93
|
+
},
|
|
94
|
+
spacing: {
|
|
95
|
+
70: '17.5rem',
|
|
96
|
+
128: '32rem',
|
|
97
|
+
},
|
|
56
98
|
},
|
|
57
99
|
},
|
|
58
|
-
plugins: [
|
|
100
|
+
plugins: [
|
|
101
|
+
// Constrain iframes rendered inside markdown prose so they can't
|
|
102
|
+
// break through scroll/overflow boundaries (Safari doesn't clip iframes
|
|
103
|
+
// via overflow:hidden alone).
|
|
104
|
+
function ({ addComponents }) {
|
|
105
|
+
addComponents({
|
|
106
|
+
'.allpeep-markdown iframe': {
|
|
107
|
+
maxWidth: '100% !important',
|
|
108
|
+
width: '100% !important',
|
|
109
|
+
border: '0',
|
|
110
|
+
display: 'block',
|
|
111
|
+
},
|
|
112
|
+
'.allpeep-markdown iframe[style]': {
|
|
113
|
+
// Override inline styles set by markdown source so iframes
|
|
114
|
+
// can never exceed the container bounds.
|
|
115
|
+
maxWidth: '100% !important',
|
|
116
|
+
width: '100% !important',
|
|
117
|
+
},
|
|
118
|
+
});
|
|
119
|
+
},
|
|
120
|
+
],
|
|
59
121
|
};
|