@planningcenter/chat-react-native 1.5.0 → 1.6.0
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/build/components/conversations.d.ts.map +1 -1
- package/build/components/conversations.js +29 -8
- package/build/components/conversations.js.map +1 -1
- package/build/components/display/button.d.ts +71 -0
- package/build/components/display/button.d.ts.map +1 -0
- package/build/components/display/button.js +136 -0
- package/build/components/display/button.js.map +1 -0
- package/build/components/display/button_color_utils.d.ts +24 -0
- package/build/components/display/button_color_utils.d.ts.map +1 -0
- package/build/components/display/button_color_utils.js +43 -0
- package/build/components/display/button_color_utils.js.map +1 -0
- package/build/components/display/heading.d.ts +4 -0
- package/build/components/display/heading.d.ts.map +1 -1
- package/build/components/display/heading.js +3 -0
- package/build/components/display/heading.js.map +1 -1
- package/build/components/display/icon.d.ts +8 -4
- package/build/components/display/icon.d.ts.map +1 -1
- package/build/components/display/icon.js +21 -13
- package/build/components/display/icon.js.map +1 -1
- package/build/components/display/image.d.ts +7 -2
- package/build/components/display/image.d.ts.map +1 -1
- package/build/components/display/image.js +5 -5
- package/build/components/display/image.js.map +1 -1
- package/build/components/display/index.d.ts +10 -7
- package/build/components/display/index.d.ts.map +1 -1
- package/build/components/display/index.js +10 -7
- package/build/components/display/index.js.map +1 -1
- package/build/components/display/spinner.d.ts +5 -1
- package/build/components/display/spinner.d.ts.map +1 -1
- package/build/components/display/spinner.js +19 -13
- package/build/components/display/spinner.js.map +1 -1
- package/build/components/display/text.d.ts +13 -3
- package/build/components/display/text.d.ts.map +1 -1
- package/build/components/display/text.js +17 -5
- package/build/components/display/text.js.map +1 -1
- package/build/components/display/text_button.d.ts +37 -0
- package/build/components/display/text_button.d.ts.map +1 -0
- package/build/components/display/text_button.js +36 -0
- package/build/components/display/text_button.js.map +1 -0
- package/build/components/display/text_inline_button.d.ts +12 -0
- package/build/components/display/text_inline_button.d.ts.map +1 -0
- package/build/components/display/text_inline_button.js +53 -0
- package/build/components/display/text_inline_button.js.map +1 -0
- package/build/components/index.d.ts +1 -0
- package/build/components/index.d.ts.map +1 -1
- package/build/components/index.js +1 -0
- package/build/components/index.js.map +1 -1
- package/build/components/primitive/avatar_primitive.d.ts +1 -1
- package/build/components/primitive/avatar_primitive.d.ts.map +1 -1
- package/build/components/primitive/avatar_primitive.js +6 -9
- package/build/components/primitive/avatar_primitive.js.map +1 -1
- package/build/contexts/api_provider.d.ts +4 -6
- package/build/contexts/api_provider.d.ts.map +1 -1
- package/build/contexts/api_provider.js +13 -20
- package/build/contexts/api_provider.js.map +1 -1
- package/build/contexts/chat_context.d.ts +7 -5
- package/build/contexts/chat_context.d.ts.map +1 -1
- package/build/contexts/chat_context.js +40 -4
- package/build/contexts/chat_context.js.map +1 -1
- package/build/hooks/index.d.ts +4 -0
- package/build/hooks/index.d.ts.map +1 -1
- package/build/hooks/index.js +4 -0
- package/build/hooks/index.js.map +1 -1
- package/build/hooks/use_create_android_ripple_color.d.ts +4 -0
- package/build/hooks/use_create_android_ripple_color.d.ts.map +1 -0
- package/build/hooks/use_create_android_ripple_color.js +15 -0
- package/build/hooks/use_create_android_ripple_color.js.map +1 -0
- package/build/hooks/use_current_person.d.ts +3 -0
- package/build/hooks/use_current_person.d.ts.map +1 -0
- package/build/hooks/use_current_person.js +13 -0
- package/build/hooks/use_current_person.js.map +1 -0
- package/build/hooks/use_font_scale.d.ts +4 -0
- package/build/hooks/use_font_scale.d.ts.map +1 -0
- package/build/hooks/use_font_scale.js +8 -0
- package/build/hooks/use_font_scale.js.map +1 -0
- package/build/hooks/use_suspense_api.d.ts +61 -0
- package/build/hooks/use_suspense_api.d.ts.map +1 -0
- package/build/hooks/use_suspense_api.js +39 -0
- package/build/hooks/use_suspense_api.js.map +1 -0
- package/build/navigation/index.d.ts +1 -0
- package/build/navigation/index.d.ts.map +1 -1
- package/build/navigation/index.js +7 -4
- package/build/navigation/index.js.map +1 -1
- package/build/screens/conversation_screen.d.ts.map +1 -1
- package/build/screens/conversation_screen.js +59 -6
- package/build/screens/conversation_screen.js.map +1 -1
- package/build/screens/display.d.ts.map +1 -1
- package/build/screens/display.js +277 -51
- package/build/screens/display.js.map +1 -1
- package/build/screens/not_found.js +1 -1
- package/build/screens/not_found.js.map +1 -1
- package/build/types/api_primitives.d.ts +23 -0
- package/build/types/api_primitives.d.ts.map +1 -0
- package/build/types/api_primitives.js +2 -0
- package/build/types/api_primitives.js.map +1 -0
- package/build/types/index.d.ts +4 -0
- package/build/types/index.d.ts.map +1 -0
- package/build/types/index.js +4 -0
- package/build/types/index.js.map +1 -0
- package/build/types/resources/conversation.d.ts +15 -0
- package/build/types/resources/conversation.d.ts.map +1 -0
- package/build/types/resources/conversation.js +2 -0
- package/build/types/resources/conversation.js.map +1 -0
- package/build/types/resources/index.d.ts +5 -0
- package/build/types/resources/index.d.ts.map +1 -0
- package/build/types/resources/index.js +5 -0
- package/build/types/resources/index.js.map +1 -0
- package/build/types/resources/message.d.ts +16 -0
- package/build/types/resources/message.d.ts.map +1 -0
- package/build/types/resources/message.js +2 -0
- package/build/types/resources/message.js.map +1 -0
- package/build/types/resources/oauth_token.d.ts +9 -0
- package/build/types/resources/oauth_token.d.ts.map +1 -0
- package/build/types/resources/oauth_token.js +2 -0
- package/build/types/resources/oauth_token.js.map +1 -0
- package/build/types/resources/person.d.ts +9 -0
- package/build/types/resources/person.d.ts.map +1 -0
- package/build/types/resources/person.js +2 -0
- package/build/types/resources/person.js.map +1 -0
- package/build/types/resources/reaction.d.ts +10 -0
- package/build/types/resources/reaction.d.ts.map +1 -0
- package/build/types/resources/reaction.js +2 -0
- package/build/types/resources/reaction.js.map +1 -0
- package/build/types/utils/index.d.ts +4 -0
- package/build/types/utils/index.d.ts.map +1 -0
- package/build/types/utils/index.js +4 -0
- package/build/types/utils/index.js.map +1 -0
- package/build/utils/client/client.d.ts +21 -12
- package/build/utils/client/client.d.ts.map +1 -1
- package/build/utils/client/client.js +24 -22
- package/build/utils/client/client.js.map +1 -1
- package/build/utils/index.d.ts +1 -0
- package/build/utils/index.d.ts.map +1 -1
- package/build/utils/index.js +1 -0
- package/build/utils/index.js.map +1 -1
- package/build/utils/session.d.ts +0 -5
- package/build/utils/session.d.ts.map +1 -1
- package/build/utils/session.js +0 -10
- package/build/utils/session.js.map +1 -1
- package/build/utils/styles.d.ts +5 -0
- package/build/utils/styles.d.ts.map +1 -1
- package/build/utils/styles.js +9 -0
- package/build/utils/styles.js.map +1 -1
- package/build/utils/theme.d.ts +3 -1
- package/build/utils/theme.d.ts.map +1 -1
- package/build/utils/theme.js +6 -2
- package/build/utils/theme.js.map +1 -1
- package/build/vendor/tapestry/alias_tokens_color_map.d.ts +8 -0
- package/build/vendor/tapestry/alias_tokens_color_map.d.ts.map +1 -1
- package/build/vendor/tapestry/alias_tokens_color_map.js +8 -0
- package/build/vendor/tapestry/alias_tokens_color_map.js.map +1 -1
- package/build/vendor/tapestry/tokens.d.ts +21 -0
- package/build/vendor/tapestry/tokens.d.ts.map +1 -1
- package/build/vendor/tapestry/tokens.js +21 -0
- package/build/vendor/tapestry/tokens.js.map +1 -1
- package/package.json +4 -3
- package/src/__tests__/client.ts +72 -19
- package/src/__tests__/session.ts +0 -11
- package/src/__utils__/handlers.ts +1 -1
- package/src/components/conversations.tsx +33 -11
- package/src/components/display/button.tsx +293 -0
- package/src/components/display/button_color_utils.ts +72 -0
- package/src/components/display/heading.tsx +12 -0
- package/src/components/display/icon.tsx +35 -16
- package/src/components/display/image.tsx +29 -7
- package/src/components/display/index.ts +10 -7
- package/src/components/display/spinner.tsx +42 -13
- package/src/components/display/text.tsx +34 -13
- package/src/components/display/text_button.tsx +102 -0
- package/src/components/display/text_inline_button.tsx +91 -0
- package/src/components/index.tsx +1 -0
- package/src/components/primitive/avatar_primitive.tsx +12 -6
- package/src/contexts/api_provider.tsx +18 -26
- package/src/contexts/chat_context.tsx +61 -7
- package/src/hooks/index.ts +4 -0
- package/src/hooks/use_create_android_ripple_color.ts +18 -0
- package/src/hooks/use_current_person.ts +15 -0
- package/src/hooks/use_font_scale.ts +9 -0
- package/src/hooks/use_suspense_api.ts +60 -0
- package/src/navigation/index.tsx +14 -4
- package/src/screens/conversation_screen.tsx +83 -7
- package/src/screens/display.tsx +447 -51
- package/src/screens/not_found.tsx +1 -1
- package/src/types/api_primitives.ts +24 -0
- package/src/types/index.ts +3 -0
- package/src/types/resources/conversation.ts +15 -0
- package/src/types/resources/index.ts +4 -0
- package/src/types/resources/message.ts +18 -0
- package/src/types/resources/oauth_token.ts +8 -0
- package/src/types/resources/person.ts +9 -0
- package/src/types/resources/reaction.ts +9 -0
- package/src/types/utils/index.ts +6 -0
- package/src/utils/client/client.ts +41 -34
- package/src/utils/client/types.d.ts +2 -0
- package/src/utils/index.ts +1 -0
- package/src/utils/session.ts +0 -13
- package/src/utils/styles.ts +12 -0
- package/src/utils/theme.ts +9 -3
- package/src/vendor/tapestry/alias_tokens_color_map.ts +12 -0
- package/src/vendor/tapestry/tokens.ts +21 -0
- package/build/utils/api.d.ts +0 -9
- package/build/utils/api.d.ts.map +0 -1
- package/build/utils/api.js +0 -36
- package/build/utils/api.js.map +0 -1
- package/src/types.d.ts +0 -35
- package/src/utils/api.ts +0 -47
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversations.d.ts","sourceRoot":"","sources":["../../src/components/conversations.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"conversations.d.ts","sourceRoot":"","sources":["../../src/components/conversations.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAA;AAQzB,eAAO,MAAM,aAAa,yBAmDzB,CAAA"}
|
|
@@ -1,21 +1,42 @@
|
|
|
1
1
|
import { useNavigation } from '@react-navigation/native';
|
|
2
|
-
import { useSuspenseQuery } from '@tanstack/react-query';
|
|
3
2
|
import React from 'react';
|
|
4
3
|
import { FlatList, Pressable, StyleSheet } from 'react-native';
|
|
5
4
|
import { useTheme } from '../hooks';
|
|
6
|
-
import {
|
|
5
|
+
import { useSuspensePaginator } from '../hooks/use_suspense_api';
|
|
6
|
+
import { Heading, Text } from './display';
|
|
7
7
|
export const Conversations = () => {
|
|
8
8
|
const styles = useStyles();
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
const request = {
|
|
10
|
+
url: '/me/conversations',
|
|
11
|
+
data: {
|
|
12
|
+
perPage: 20,
|
|
13
|
+
order: '-last_message',
|
|
14
|
+
fields: {
|
|
15
|
+
Conversation: [
|
|
16
|
+
'title',
|
|
17
|
+
'last_message_created_at',
|
|
18
|
+
'last_message_author_name',
|
|
19
|
+
'last_message_text_preview',
|
|
20
|
+
'unread_count',
|
|
21
|
+
],
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
const { data: conversations, fetchNextPage } = useSuspensePaginator(request);
|
|
26
|
+
// TODO: Filter using the API
|
|
27
|
+
const nonEmptyConversations = conversations.filter(c => c.lastMessageTextPreview) || [];
|
|
12
28
|
const navigation = useNavigation();
|
|
13
|
-
return (<FlatList data={
|
|
29
|
+
return (<FlatList data={nonEmptyConversations} contentContainerStyle={styles.container} style={styles.scrollView} ListEmptyComponent={<Text>No conversations found</Text>} renderItem={({ item }) => (<Pressable onPress={() => navigation.navigate('Conversation', {
|
|
14
30
|
conversation_id: item.id,
|
|
15
31
|
chat_group_graph_id: item.id,
|
|
16
32
|
})}>
|
|
17
|
-
<
|
|
18
|
-
|
|
33
|
+
<Heading numberOfLines={1} variant="h3">
|
|
34
|
+
{item.title}
|
|
35
|
+
</Heading>
|
|
36
|
+
<Text style={styles.listItem}>
|
|
37
|
+
{item.lastMessageAuthorName}: {item.lastMessageTextPreview}
|
|
38
|
+
</Text>
|
|
39
|
+
</Pressable>)} onEndReached={() => fetchNextPage()}/>);
|
|
19
40
|
};
|
|
20
41
|
const useStyles = () => {
|
|
21
42
|
const { colors } = useTheme();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversations.js","sourceRoot":"","sources":["../../src/components/conversations.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"conversations.js","sourceRoot":"","sources":["../../src/components/conversations.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AACxD,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAC9D,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AACnC,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAA;AAGhE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAEzC,MAAM,CAAC,MAAM,aAAa,GAAG,GAAG,EAAE;IAChC,MAAM,MAAM,GAAG,SAAS,EAAE,CAAA;IAC1B,MAAM,OAAO,GAAe;QAC1B,GAAG,EAAE,mBAAmB;QACxB,IAAI,EAAE;YACJ,OAAO,EAAE,EAAE;YACX,KAAK,EAAE,eAAe;YACtB,MAAM,EAAE;gBACN,YAAY,EAAE;oBACZ,OAAO;oBACP,yBAAyB;oBACzB,0BAA0B;oBAC1B,2BAA2B;oBAC3B,cAAc;iBACf;aACF;SACF;KACF,CAAA;IACD,MAAM,EAAE,IAAI,EAAE,aAAa,EAAE,aAAa,EAAE,GAAG,oBAAoB,CAAuB,OAAO,CAAC,CAAA;IAElG,6BAA6B;IAC7B,MAAM,qBAAqB,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,sBAAsB,CAAC,IAAI,EAAE,CAAA;IAEvF,MAAM,UAAU,GAAG,aAAa,EAAE,CAAA;IAElC,OAAO,CACL,CAAC,QAAQ,CACP,IAAI,CAAC,CAAC,qBAAqB,CAAC,CAC5B,qBAAqB,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CACxC,KAAK,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,CACzB,kBAAkB,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AAC,CAAA","sourcesContent":["import { useNavigation } from '@react-navigation/native'\nimport React from 'react'\nimport { FlatList, Pressable, StyleSheet } from 'react-native'\nimport { useTheme } from '../hooks'\nimport { useSuspensePaginator } from '../hooks/use_suspense_api'\nimport { ConversationResource } from '../types'\nimport { GetRequest } from '../utils/client/types'\nimport { Heading, Text } from './display'\n\nexport const Conversations = () => {\n const styles = useStyles()\n const request: GetRequest = {\n url: '/me/conversations',\n data: {\n perPage: 20,\n order: '-last_message',\n fields: {\n Conversation: [\n 'title',\n 'last_message_created_at',\n 'last_message_author_name',\n 'last_message_text_preview',\n 'unread_count',\n ],\n },\n },\n }\n const { data: conversations, fetchNextPage } = useSuspensePaginator<ConversationResource>(request)\n\n // TODO: Filter using the API\n const nonEmptyConversations = conversations.filter(c => c.lastMessageTextPreview) || []\n\n const navigation = useNavigation()\n\n return (\n <FlatList\n data={nonEmptyConversations}\n contentContainerStyle={styles.container}\n style={styles.scrollView}\n ListEmptyComponent={<Text>No conversations found</Text>}\n renderItem={({ item }) => (\n <Pressable\n onPress={() =>\n navigation.navigate('Conversation', {\n conversation_id: item.id,\n chat_group_graph_id: item.id,\n })\n }\n >\n <Heading numberOfLines={1} variant=\"h3\">\n {item.title}\n </Heading>\n <Text style={styles.listItem}>\n {item.lastMessageAuthorName}: {item.lastMessageTextPreview}\n </Text>\n </Pressable>\n )}\n onEndReached={() => fetchNextPage()}\n />\n )\n}\n\nconst useStyles = () => {\n const { colors } = useTheme()\n\n return StyleSheet.create({\n scrollView: { flex: 1, backgroundColor: colors.fillColorNeutral090 },\n container: { gap: 8, padding: 16 },\n foo: { fontSize: 24, color: colors.testColor },\n listItem: { color: colors.fillColorNeutral020 },\n })\n}\n"]}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { PressableProps, ViewStyle } from 'react-native';
|
|
3
|
+
import type { AppearanceUnion } from './button_color_utils';
|
|
4
|
+
declare const SIZES: {
|
|
5
|
+
readonly sm: "sm";
|
|
6
|
+
readonly md: "md";
|
|
7
|
+
readonly lg: "lg";
|
|
8
|
+
};
|
|
9
|
+
type SizeUnion = (typeof SIZES)[keyof typeof SIZES];
|
|
10
|
+
declare const VARIANTS: {
|
|
11
|
+
readonly fill: "fill";
|
|
12
|
+
readonly outline: "outline";
|
|
13
|
+
};
|
|
14
|
+
type VariantUnion = (typeof VARIANTS)[keyof typeof VARIANTS];
|
|
15
|
+
interface ButtonProps extends PressableProps {
|
|
16
|
+
/**
|
|
17
|
+
* Specifies whether fonts should be scaled down automatically to fit given style constraints.
|
|
18
|
+
*/
|
|
19
|
+
adjustsFontSizeToFit?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Specifies whether fonts should scale to respect the device's text size accessibility settings. The default is true.
|
|
22
|
+
*/
|
|
23
|
+
allowFontScaling?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Updates the button's colors
|
|
26
|
+
*/
|
|
27
|
+
appearance?: AppearanceUnion;
|
|
28
|
+
/**
|
|
29
|
+
* Styles the inner View that wraps the button's content
|
|
30
|
+
*/
|
|
31
|
+
buttonInnerStyles?: ViewStyle;
|
|
32
|
+
/**
|
|
33
|
+
* Styles the outer LinearGradient that gives the button it's backgrounnd and outline color
|
|
34
|
+
*/
|
|
35
|
+
buttonOuterStyles?: ViewStyle;
|
|
36
|
+
/**
|
|
37
|
+
* Generates an icon to the left of the button text
|
|
38
|
+
*/
|
|
39
|
+
iconNameLeft?: string;
|
|
40
|
+
/**
|
|
41
|
+
* Generates an icon to the right of the button text
|
|
42
|
+
*/
|
|
43
|
+
iconNameRight?: string;
|
|
44
|
+
/**
|
|
45
|
+
* Disables the button and replaces its content with a spinner
|
|
46
|
+
*/
|
|
47
|
+
loading?: boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Specifies the maximum size a font can reach when allowFontScaling is enabled.
|
|
50
|
+
*/
|
|
51
|
+
maxFontSizeMultiplier?: number;
|
|
52
|
+
/**
|
|
53
|
+
* Specifies smallest possible scale a font can reach when adjustsFontSizeToFit is enabled. (values 0.01-1.0).
|
|
54
|
+
*/
|
|
55
|
+
minimumFontScale?: number;
|
|
56
|
+
/**
|
|
57
|
+
* Changes the overall size of the button and its contents
|
|
58
|
+
*/
|
|
59
|
+
size?: SizeUnion;
|
|
60
|
+
/**
|
|
61
|
+
* Renders as text within the button
|
|
62
|
+
*/
|
|
63
|
+
title: string;
|
|
64
|
+
/**
|
|
65
|
+
* Fill buttons are visually more propmonitent then outline buttons
|
|
66
|
+
*/
|
|
67
|
+
variant?: VariantUnion;
|
|
68
|
+
}
|
|
69
|
+
export declare function Button({ adjustsFontSizeToFit, allowFontScaling, appearance, buttonInnerStyles, buttonOuterStyles, disabled, iconNameLeft, iconNameRight, loading, maxFontSizeMultiplier, minimumFontScale, size, title, variant, ...props }: ButtonProps): React.JSX.Element;
|
|
70
|
+
export {};
|
|
71
|
+
//# sourceMappingURL=button.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../../src/components/display/button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAQ7D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAM3D,QAAA,MAAM,KAAK;;;;CAID,CAAA;AAEV,KAAK,SAAS,GAAG,CAAC,OAAO,KAAK,CAAC,CAAC,MAAM,OAAO,KAAK,CAAC,CAAA;AAYnD,QAAA,MAAM,QAAQ;;;CAGJ,CAAA;AAEV,KAAK,YAAY,GAAG,CAAC,OAAO,QAAQ,CAAC,CAAC,MAAM,OAAO,QAAQ,CAAC,CAAA;AAa5D,UAAU,WAAY,SAAQ,cAAc;IAC1C;;OAEG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAA;IAC9B;;OAEG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B;;OAEG;IACH,UAAU,CAAC,EAAE,eAAe,CAAA;IAC5B;;OAEG;IACH,iBAAiB,CAAC,EAAE,SAAS,CAAA;IAC7B;;OAEG;IACH,iBAAiB,CAAC,EAAE,SAAS,CAAA;IAC7B;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB;;OAEG;IACH,qBAAqB,CAAC,EAAE,MAAM,CAAA;IAC9B;;OAEG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB;;OAEG;IACH,IAAI,CAAC,EAAE,SAAS,CAAA;IAChB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAA;IACb;;OAEG;IACH,OAAO,CAAC,EAAE,YAAY,CAAA;CACvB;AAED,wBAAgB,MAAM,CAAC,EACrB,oBAA4B,EAC5B,gBAAuB,EACvB,UAAsB,EACtB,iBAAiB,EACjB,iBAAiB,EACjB,QAAgB,EAChB,YAAY,EACZ,aAAa,EACb,OAAO,EACP,qBAAqB,EACrB,gBAAgB,EAChB,IAAW,EACX,KAAK,EACL,OAAgB,EAChB,GAAG,KAAK,EACT,EAAE,WAAW,qBA4Db"}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Pressable, StyleSheet, Text, View } from 'react-native';
|
|
3
|
+
import LinearGradient from 'react-native-linear-gradient';
|
|
4
|
+
import { Icon } from './icon';
|
|
5
|
+
import { useTheme, useFontScale, useCreateAndroidRippleColor } from '../../hooks';
|
|
6
|
+
import { tokens } from '../../vendor/tapestry/tokens';
|
|
7
|
+
import { platformFontWeightBold, platformPressedOpacityStyle } from '../../utils';
|
|
8
|
+
import { Spinner } from './spinner';
|
|
9
|
+
import { getColorKey, useColorOptionMap, useGradientColorMap } from './button_color_utils';
|
|
10
|
+
// =================================
|
|
11
|
+
// ====== Constants ================
|
|
12
|
+
// =================================
|
|
13
|
+
const SIZES = {
|
|
14
|
+
sm: 'sm',
|
|
15
|
+
md: 'md',
|
|
16
|
+
lg: 'lg',
|
|
17
|
+
};
|
|
18
|
+
const VARIANTS = {
|
|
19
|
+
fill: 'fill',
|
|
20
|
+
outline: 'outline',
|
|
21
|
+
};
|
|
22
|
+
export function Button({ adjustsFontSizeToFit = false, allowFontScaling = true, appearance = 'primary', buttonInnerStyles, buttonOuterStyles, disabled = false, iconNameLeft, iconNameRight, loading, maxFontSizeMultiplier, minimumFontScale, size = 'md', title, variant = 'fill', ...props }) {
|
|
23
|
+
const styles = useStyles({ appearance, disabled, loading, maxFontSizeMultiplier, size, variant });
|
|
24
|
+
const gradientOptionsMap = useGradientColorMap();
|
|
25
|
+
const colorKey = getColorKey({ disabled, loading, appearance });
|
|
26
|
+
const textStyles = [styles.text, disabled && styles.textDisabled, loading && styles.iconLoading];
|
|
27
|
+
const iconStyles = [styles.icon, disabled && styles.iconDisabled, loading && styles.textLoading];
|
|
28
|
+
const androidRippleColor = useCreateAndroidRippleColor({ color: gradientOptionsMap[colorKey][0] });
|
|
29
|
+
return (<Pressable style={({ pressed }) => [styles.pressable, pressed && platformPressedOpacityStyle]} accessibilityRole="button" disabled={disabled || loading} accessibilityState={{ busy: loading }} android_ripple={{ color: androidRippleColor, borderless: false, foreground: true }} {...props}>
|
|
30
|
+
<LinearGradient start={{ x: 0.1, y: 0.1 }} end={{ x: 0.9, y: 0.9 }} colors={gradientOptionsMap[colorKey]} style={[styles.colorWrapper, buttonOuterStyles]}>
|
|
31
|
+
{loading && (<Spinner size={styles.spinner.fontSize} maxFontSizeMultiplier={maxFontSizeMultiplier || 0}/>)}
|
|
32
|
+
<View style={[styles.innerWrapper, buttonInnerStyles]}>
|
|
33
|
+
{iconNameLeft && (<Icon name={iconNameLeft} style={iconStyles} maxFontSizeMultiplier={maxFontSizeMultiplier}/>)}
|
|
34
|
+
<Text allowFontScaling={allowFontScaling} minimumFontScale={minimumFontScale} maxFontSizeMultiplier={maxFontSizeMultiplier} adjustsFontSizeToFit={adjustsFontSizeToFit} numberOfLines={1} style={textStyles}>
|
|
35
|
+
{title}
|
|
36
|
+
</Text>
|
|
37
|
+
{iconNameRight && (<Icon name={iconNameRight} style={iconStyles} maxFontSizeMultiplier={maxFontSizeMultiplier}/>)}
|
|
38
|
+
</View>
|
|
39
|
+
</LinearGradient>
|
|
40
|
+
</Pressable>);
|
|
41
|
+
}
|
|
42
|
+
// =================================
|
|
43
|
+
// ====== Styles ===================
|
|
44
|
+
// =================================
|
|
45
|
+
const useStyles = ({ appearance = 'primary', disabled = false, loading = false, maxFontSizeMultiplier, size = 'md', variant = 'fill', }) => {
|
|
46
|
+
const { colors } = useTheme();
|
|
47
|
+
const fontScale = useFontScale({ maxFontSizeMultiplier });
|
|
48
|
+
const colorOptionMap = useColorOptionMap();
|
|
49
|
+
const outlineOffsetSm = 2;
|
|
50
|
+
const outlineOffset = 4;
|
|
51
|
+
const sizeStyleMap = {
|
|
52
|
+
[SIZES.sm]: {
|
|
53
|
+
fontSize: 12,
|
|
54
|
+
paddingHorizontal: 12 * fontScale,
|
|
55
|
+
height: 24 * fontScale - outlineOffsetSm,
|
|
56
|
+
borderRadius: 24 * fontScale,
|
|
57
|
+
gap: 4 * fontScale,
|
|
58
|
+
},
|
|
59
|
+
[SIZES.md]: {
|
|
60
|
+
fontSize: 14,
|
|
61
|
+
paddingHorizontal: 16 * fontScale,
|
|
62
|
+
height: 32 * fontScale - outlineOffset,
|
|
63
|
+
borderRadius: 32 * fontScale,
|
|
64
|
+
gap: 6 * fontScale,
|
|
65
|
+
},
|
|
66
|
+
[SIZES.lg]: {
|
|
67
|
+
fontSize: 16,
|
|
68
|
+
paddingHorizontal: 24 * fontScale,
|
|
69
|
+
height: 40 * fontScale - outlineOffset,
|
|
70
|
+
borderRadius: 40 * fontScale,
|
|
71
|
+
gap: 8 * fontScale,
|
|
72
|
+
},
|
|
73
|
+
};
|
|
74
|
+
const variantOutlineColor = disabled || loading ? colors.fillColorNeutral090 : colors.fillColorNeutral100Inverted;
|
|
75
|
+
const variantStyleMap = {
|
|
76
|
+
fill: {
|
|
77
|
+
backgroundColor: 'transparent',
|
|
78
|
+
color: tokens.colorNeutral100White,
|
|
79
|
+
},
|
|
80
|
+
outline: {
|
|
81
|
+
backgroundColor: variantOutlineColor,
|
|
82
|
+
color: colorOptionMap[appearance],
|
|
83
|
+
},
|
|
84
|
+
};
|
|
85
|
+
return StyleSheet.create({
|
|
86
|
+
pressable: {
|
|
87
|
+
borderRadius: sizeStyleMap[size].borderRadius,
|
|
88
|
+
overflow: 'hidden',
|
|
89
|
+
},
|
|
90
|
+
colorWrapper: {
|
|
91
|
+
flexDirection: 'row',
|
|
92
|
+
justifyContent: 'center',
|
|
93
|
+
alignItems: 'center',
|
|
94
|
+
borderRadius: sizeStyleMap[size].borderRadius,
|
|
95
|
+
},
|
|
96
|
+
innerWrapper: {
|
|
97
|
+
flexDirection: 'row',
|
|
98
|
+
justifyContent: 'center',
|
|
99
|
+
alignItems: 'center',
|
|
100
|
+
margin: size === 'sm' ? 1 : 2,
|
|
101
|
+
gap: sizeStyleMap[size].gap,
|
|
102
|
+
borderRadius: sizeStyleMap[size].borderRadius,
|
|
103
|
+
height: sizeStyleMap[size].height,
|
|
104
|
+
backgroundColor: variantStyleMap[variant].backgroundColor,
|
|
105
|
+
paddingHorizontal: sizeStyleMap[size].paddingHorizontal,
|
|
106
|
+
},
|
|
107
|
+
text: {
|
|
108
|
+
textAlign: 'center',
|
|
109
|
+
textAlignVertical: 'center',
|
|
110
|
+
includeFontPadding: false,
|
|
111
|
+
fontWeight: platformFontWeightBold,
|
|
112
|
+
fontSize: sizeStyleMap[size].fontSize,
|
|
113
|
+
color: variantStyleMap[variant].color,
|
|
114
|
+
},
|
|
115
|
+
textDisabled: {
|
|
116
|
+
color: colors.textColorDefaultDisabled,
|
|
117
|
+
},
|
|
118
|
+
textLoading: {
|
|
119
|
+
opacity: 0,
|
|
120
|
+
},
|
|
121
|
+
icon: {
|
|
122
|
+
fontSize: sizeStyleMap[size].fontSize,
|
|
123
|
+
color: variantStyleMap[variant].color,
|
|
124
|
+
},
|
|
125
|
+
iconDisabled: {
|
|
126
|
+
color: colors.iconColorDefaultDisabled,
|
|
127
|
+
},
|
|
128
|
+
iconLoading: {
|
|
129
|
+
opacity: 0,
|
|
130
|
+
},
|
|
131
|
+
spinner: {
|
|
132
|
+
fontSize: sizeStyleMap[size].fontSize,
|
|
133
|
+
},
|
|
134
|
+
});
|
|
135
|
+
};
|
|
136
|
+
//# sourceMappingURL=button.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"button.js","sourceRoot":"","sources":["../../../src/components/display/button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAEhE,OAAO,cAAc,MAAM,8BAA8B,CAAA;AACzD,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAC7B,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,2BAA2B,EAAE,MAAM,aAAa,CAAA;AACjF,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAA;AACrD,OAAO,EAAE,sBAAsB,EAAE,2BAA2B,EAAE,MAAM,aAAa,CAAA;AACjF,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAA;AAG1F,oCAAoC;AACpC,oCAAoC;AACpC,oCAAoC;AAEpC,MAAM,KAAK,GAAG;IACZ,EAAE,EAAE,IAAI;IACR,EAAE,EAAE,IAAI;IACR,EAAE,EAAE,IAAI;CACA,CAAA;AAcV,MAAM,QAAQ,GAAG;IACf,IAAI,EAAE,MAAM;IACZ,OAAO,EAAE,SAAS;CACV,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jC,eAAe,EAAE,eAAe,CAAC,OAAO,CAAC,CAAC,eAAe;YACzD,iBAAiB,EAAE,YAAY,CAAC,IAAI,CAAC,CAAC,iBAAiB;SACxD;QACD,IAAI,EAAE;YACJ,SAAS,EAAE,QAAQ;YACnB,iBAAiB,EAAE,QAAQ;YAC3B,kBAAkB,EAAE,KAAK;YACzB,UAAU,EAAE,sBAAsB;YAClC,QAAQ,EAAE,YAAY,CAAC,IAAI,CAAC,CAAC,QAAQ;YACrC,KAAK,EAAE,eAAe,CAAC,OAAO,CAAC,CAAC,KAAK;SACtC;QACD,YAAY,EAAE;YACZ,KAAK,EAAE,MAAM,CAAC,wBAAwB;SACvC;QACD,WAAW,EAAE;YACX,OAAO,EAAE,CAAC;SACX;QACD,IAAI,EAAE;YACJ,QAAQ,EAAE,YAAY,CAAC,IAAI,CAAC,CAAC,QAAQ;YACrC,KAAK,EAAE,eAAe,CAAC,OAAO,CAAC,CAAC,KAAK;SACtC;QACD,YAAY,EAAE;YACZ,KAAK,EAAE,MAAM,CAAC,wBAAwB;SACvC;QACD,WAAW,EAAE;YACX,OAAO,EAAE,CAAC;SACX;QACD,OAAO,EAAE;YACP,QAAQ,EAAE,YAAY,CAAC,IAAI,CAAC,CAAC,QAAQ;SACtC;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import React from 'react'\nimport { Pressable, StyleSheet, Text, View } from 'react-native'\nimport type { PressableProps, ViewStyle } from 'react-native'\nimport LinearGradient from 'react-native-linear-gradient'\nimport { Icon } from './icon'\nimport { useTheme, useFontScale, useCreateAndroidRippleColor } from '../../hooks'\nimport { tokens } from '../../vendor/tapestry/tokens'\nimport { platformFontWeightBold, platformPressedOpacityStyle } from '../../utils'\nimport { Spinner } from './spinner'\nimport { getColorKey, useColorOptionMap, useGradientColorMap } from './button_color_utils'\nimport type { AppearanceUnion } from './button_color_utils'\n\n// =================================\n// ====== Constants ================\n// =================================\n\nconst SIZES = {\n sm: 'sm',\n md: 'md',\n lg: 'lg',\n} as const\n\ntype SizeUnion = (typeof SIZES)[keyof typeof SIZES]\ntype SizeStyle = Record<\n SizeUnion,\n {\n fontSize: number\n paddingHorizontal: number\n height: number\n borderRadius: number\n gap: number\n }\n>\n\nconst VARIANTS = {\n fill: 'fill',\n outline: 'outline',\n} as const\n\ntype VariantUnion = (typeof VARIANTS)[keyof typeof VARIANTS]\ntype VariantColors = Record<\n VariantUnion,\n {\n backgroundColor: string\n color: string\n }\n>\n\n// =================================\n// ====== Component ================\n// =================================\n\ninterface ButtonProps extends PressableProps {\n /**\n * Specifies whether fonts should be scaled down automatically to fit given style constraints.\n */\n adjustsFontSizeToFit?: boolean\n /**\n * Specifies whether fonts should scale to respect the device's text size accessibility settings. The default is true.\n */\n allowFontScaling?: boolean\n /**\n * Updates the button's colors\n */\n appearance?: AppearanceUnion\n /**\n * Styles the inner View that wraps the button's content\n */\n buttonInnerStyles?: ViewStyle\n /**\n * Styles the outer LinearGradient that gives the button it's backgrounnd and outline color\n */\n buttonOuterStyles?: ViewStyle\n /**\n * Generates an icon to the left of the button text\n */\n iconNameLeft?: string\n /**\n * Generates an icon to the right of the button text\n */\n iconNameRight?: string\n /**\n * Disables the button and replaces its content with a spinner\n */\n loading?: boolean\n /**\n * Specifies the maximum size a font can reach when allowFontScaling is enabled.\n */\n maxFontSizeMultiplier?: number\n /**\n * Specifies smallest possible scale a font can reach when adjustsFontSizeToFit is enabled. (values 0.01-1.0).\n */\n minimumFontScale?: number\n /**\n * Changes the overall size of the button and its contents\n */\n size?: SizeUnion\n /**\n * Renders as text within the button\n */\n title: string\n /**\n * Fill buttons are visually more propmonitent then outline buttons\n */\n variant?: VariantUnion\n}\n\nexport function Button({\n adjustsFontSizeToFit = false,\n allowFontScaling = true,\n appearance = 'primary',\n buttonInnerStyles,\n buttonOuterStyles,\n disabled = false,\n iconNameLeft,\n iconNameRight,\n loading,\n maxFontSizeMultiplier,\n minimumFontScale,\n size = 'md',\n title,\n variant = 'fill',\n ...props\n}: ButtonProps) {\n const styles = useStyles({ appearance, disabled, loading, maxFontSizeMultiplier, size, variant })\n const gradientOptionsMap = useGradientColorMap()\n const colorKey = getColorKey({ disabled, loading, appearance })\n\n const textStyles = [styles.text, disabled && styles.textDisabled, loading && styles.iconLoading]\n const iconStyles = [styles.icon, disabled && styles.iconDisabled, loading && styles.textLoading]\n\n const androidRippleColor = useCreateAndroidRippleColor({ color: gradientOptionsMap[colorKey][0] })\n\n return (\n <Pressable\n style={({ pressed }) => [styles.pressable, pressed && platformPressedOpacityStyle]}\n accessibilityRole=\"button\"\n disabled={disabled || loading}\n accessibilityState={{ busy: loading }}\n android_ripple={{ color: androidRippleColor, borderless: false, foreground: true }}\n {...props}\n >\n <LinearGradient\n start={{ x: 0.1, y: 0.1 }}\n end={{ x: 0.9, y: 0.9 }}\n colors={gradientOptionsMap[colorKey]}\n style={[styles.colorWrapper, buttonOuterStyles]}\n >\n {loading && (\n <Spinner\n size={styles.spinner.fontSize}\n maxFontSizeMultiplier={maxFontSizeMultiplier || 0}\n />\n )}\n <View style={[styles.innerWrapper, buttonInnerStyles]}>\n {iconNameLeft && (\n <Icon\n name={iconNameLeft}\n style={iconStyles}\n maxFontSizeMultiplier={maxFontSizeMultiplier}\n />\n )}\n <Text\n allowFontScaling={allowFontScaling}\n minimumFontScale={minimumFontScale}\n maxFontSizeMultiplier={maxFontSizeMultiplier}\n adjustsFontSizeToFit={adjustsFontSizeToFit}\n numberOfLines={1}\n style={textStyles}\n >\n {title}\n </Text>\n {iconNameRight && (\n <Icon\n name={iconNameRight}\n style={iconStyles}\n maxFontSizeMultiplier={maxFontSizeMultiplier}\n />\n )}\n </View>\n </LinearGradient>\n </Pressable>\n )\n}\n\n// =================================\n// ====== Styles ===================\n// =================================\n\nconst useStyles = ({\n appearance = 'primary',\n disabled = false,\n loading = false,\n maxFontSizeMultiplier,\n size = 'md',\n variant = 'fill',\n}: Partial<ButtonProps>) => {\n const { colors } = useTheme()\n const fontScale = useFontScale({ maxFontSizeMultiplier })\n const colorOptionMap = useColorOptionMap()\n\n const outlineOffsetSm = 2\n const outlineOffset = 4\n\n const sizeStyleMap: SizeStyle = {\n [SIZES.sm]: {\n fontSize: 12,\n paddingHorizontal: 12 * fontScale,\n height: 24 * fontScale - outlineOffsetSm,\n borderRadius: 24 * fontScale,\n gap: 4 * fontScale,\n },\n [SIZES.md]: {\n fontSize: 14,\n paddingHorizontal: 16 * fontScale,\n height: 32 * fontScale - outlineOffset,\n borderRadius: 32 * fontScale,\n gap: 6 * fontScale,\n },\n [SIZES.lg]: {\n fontSize: 16,\n paddingHorizontal: 24 * fontScale,\n height: 40 * fontScale - outlineOffset,\n borderRadius: 40 * fontScale,\n gap: 8 * fontScale,\n },\n }\n\n const variantOutlineColor =\n disabled || loading ? colors.fillColorNeutral090 : colors.fillColorNeutral100Inverted\n\n const variantStyleMap: VariantColors = {\n fill: {\n backgroundColor: 'transparent',\n color: tokens.colorNeutral100White,\n },\n outline: {\n backgroundColor: variantOutlineColor,\n color: colorOptionMap[appearance],\n },\n }\n\n return StyleSheet.create({\n pressable: {\n borderRadius: sizeStyleMap[size].borderRadius,\n overflow: 'hidden',\n },\n colorWrapper: {\n flexDirection: 'row',\n justifyContent: 'center',\n alignItems: 'center',\n borderRadius: sizeStyleMap[size].borderRadius,\n },\n innerWrapper: {\n flexDirection: 'row',\n justifyContent: 'center',\n alignItems: 'center',\n margin: size === 'sm' ? 1 : 2,\n gap: sizeStyleMap[size].gap,\n borderRadius: sizeStyleMap[size].borderRadius,\n height: sizeStyleMap[size].height,\n backgroundColor: variantStyleMap[variant].backgroundColor,\n paddingHorizontal: sizeStyleMap[size].paddingHorizontal,\n },\n text: {\n textAlign: 'center',\n textAlignVertical: 'center',\n includeFontPadding: false,\n fontWeight: platformFontWeightBold,\n fontSize: sizeStyleMap[size].fontSize,\n color: variantStyleMap[variant].color,\n },\n textDisabled: {\n color: colors.textColorDefaultDisabled,\n },\n textLoading: {\n opacity: 0,\n },\n icon: {\n fontSize: sizeStyleMap[size].fontSize,\n color: variantStyleMap[variant].color,\n },\n iconDisabled: {\n color: colors.iconColorDefaultDisabled,\n },\n iconLoading: {\n opacity: 0,\n },\n spinner: {\n fontSize: sizeStyleMap[size].fontSize,\n },\n })\n}\n"]}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export { getColorKey, useColorOptionMap, useGradientColorMap };
|
|
2
|
+
export type { AppearanceUnion };
|
|
3
|
+
declare const APPEARANCES: {
|
|
4
|
+
readonly primary: "primary";
|
|
5
|
+
readonly danger: "danger";
|
|
6
|
+
};
|
|
7
|
+
type AppearanceUnion = (typeof APPEARANCES)[keyof typeof APPEARANCES];
|
|
8
|
+
declare const COLOR_OPTIONS: {
|
|
9
|
+
readonly disabled: "disabled";
|
|
10
|
+
readonly primary: "primary";
|
|
11
|
+
readonly danger: "danger";
|
|
12
|
+
};
|
|
13
|
+
type ColorOptionUnion = (typeof COLOR_OPTIONS)[keyof typeof COLOR_OPTIONS];
|
|
14
|
+
type ColorOptionMap = Record<ColorOptionUnion, string>;
|
|
15
|
+
declare function useColorOptionMap(): ColorOptionMap;
|
|
16
|
+
type GradientColorMap = Record<ColorOptionUnion, [string, string]>;
|
|
17
|
+
declare function useGradientColorMap(): GradientColorMap;
|
|
18
|
+
interface GetColorKeyArgs {
|
|
19
|
+
disabled: boolean | null;
|
|
20
|
+
loading?: boolean;
|
|
21
|
+
appearance: AppearanceUnion;
|
|
22
|
+
}
|
|
23
|
+
declare function getColorKey({ disabled, loading, appearance }: GetColorKeyArgs): AppearanceUnion | "disabled";
|
|
24
|
+
//# sourceMappingURL=button_color_utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"button_color_utils.d.ts","sourceRoot":"","sources":["../../../src/components/display/button_color_utils.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,CAAA;AAC9D,YAAY,EAAE,eAAe,EAAE,CAAA;AAM/B,QAAA,MAAM,WAAW;;;CAGP,CAAA;AAEV,KAAK,eAAe,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,OAAO,WAAW,CAAC,CAAA;AAErE,QAAA,MAAM,aAAa;;;;CAGT,CAAA;AAEV,KAAK,gBAAgB,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,OAAO,aAAa,CAAC,CAAA;AAM1E,KAAK,cAAc,GAAG,MAAM,CAAC,gBAAgB,EAAE,MAAM,CAAC,CAAA;AACtD,iBAAS,iBAAiB,IAAI,cAAc,CAQ3C;AAED,KAAK,gBAAgB,GAAG,MAAM,CAAC,gBAAgB,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;AAClE,iBAAS,mBAAmB,IAAI,gBAAgB,CAc/C;AAMD,UAAU,eAAe;IACvB,QAAQ,EAAE,OAAO,GAAG,IAAI,CAAA;IACxB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,UAAU,EAAE,eAAe,CAAA;CAC5B;AACD,iBAAS,WAAW,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,EAAE,eAAe,gCAGtE"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { useTheme } from '../../hooks';
|
|
2
|
+
// =================================
|
|
3
|
+
// ====== Exports ==================
|
|
4
|
+
// =================================
|
|
5
|
+
export { getColorKey, useColorOptionMap, useGradientColorMap };
|
|
6
|
+
// =================================
|
|
7
|
+
// ====== Constants ================
|
|
8
|
+
// =================================
|
|
9
|
+
const APPEARANCES = {
|
|
10
|
+
primary: 'primary',
|
|
11
|
+
danger: 'danger',
|
|
12
|
+
};
|
|
13
|
+
const COLOR_OPTIONS = {
|
|
14
|
+
...APPEARANCES,
|
|
15
|
+
disabled: 'disabled',
|
|
16
|
+
};
|
|
17
|
+
function useColorOptionMap() {
|
|
18
|
+
const { colors } = useTheme();
|
|
19
|
+
return {
|
|
20
|
+
primary: colors.interaction,
|
|
21
|
+
danger: colors.fillColorStatusErrorMedium,
|
|
22
|
+
disabled: colors.textColorDefaultDisabled,
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function useGradientColorMap() {
|
|
26
|
+
const { colors } = useTheme();
|
|
27
|
+
const defaultColorStart = colors.buttonStart || colors.interaction;
|
|
28
|
+
const defaultColorEnd = colors.buttonEnd || colors.interaction;
|
|
29
|
+
return {
|
|
30
|
+
primary: [defaultColorStart, defaultColorEnd],
|
|
31
|
+
danger: [colors.fillColorStatusErrorMedium, colors.fillColorStatusErrorMedium],
|
|
32
|
+
disabled: [
|
|
33
|
+
colors.fillColorButtonNeutralSolidDisabled,
|
|
34
|
+
colors.fillColorButtonNeutralSolidDisabled,
|
|
35
|
+
],
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
function getColorKey({ disabled, loading, appearance }) {
|
|
39
|
+
if (disabled || loading)
|
|
40
|
+
return 'disabled';
|
|
41
|
+
return appearance;
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=button_color_utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"button_color_utils.js","sourceRoot":"","sources":["../../../src/components/display/button_color_utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAEtC,oCAAoC;AACpC,oCAAoC;AACpC,oCAAoC;AAEpC,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,CAAA;AAG9D,oCAAoC;AACpC,oCAAoC;AACpC,oCAAoC;AAEpC,MAAM,WAAW,GAAG;IAClB,OAAO,EAAE,SAAS;IAClB,MAAM,EAAE,QAAQ;CACR,CAAA;AAIV,MAAM,aAAa,GAAG;IACpB,GAAG,WAAW;IACd,QAAQ,EAAE,UAAU;CACZ,CAAA;AASV,SAAS,iBAAiB;IACxB,MAAM,EAAE,MAAM,EAAE,GAAG,QAAQ,EAAE,CAAA;IAE7B,OAAO;QACL,OAAO,EAAE,MAAM,CAAC,WAAW;QAC3B,MAAM,EAAE,MAAM,CAAC,0BAA0B;QACzC,QAAQ,EAAE,MAAM,CAAC,wBAAwB;KAC1C,CAAA;AACH,CAAC;AAGD,SAAS,mBAAmB;IAC1B,MAAM,EAAE,MAAM,EAAE,GAAG,QAAQ,EAAE,CAAA;IAE7B,MAAM,iBAAiB,GAAG,MAAM,CAAC,WAAW,IAAI,MAAM,CAAC,WAAW,CAAA;IAClE,MAAM,eAAe,GAAG,MAAM,CAAC,SAAS,IAAI,MAAM,CAAC,WAAW,CAAA;IAE9D,OAAO;QACL,OAAO,EAAE,CAAC,iBAAiB,EAAE,eAAe,CAAC;QAC7C,MAAM,EAAE,CAAC,MAAM,CAAC,0BAA0B,EAAE,MAAM,CAAC,0BAA0B,CAAC;QAC9E,QAAQ,EAAE;YACR,MAAM,CAAC,mCAAmC;YAC1C,MAAM,CAAC,mCAAmC;SAC3C;KACF,CAAA;AACH,CAAC;AAWD,SAAS,WAAW,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAmB;IACrE,IAAI,QAAQ,IAAI,OAAO;QAAE,OAAO,UAAU,CAAA;IAC1C,OAAO,UAAU,CAAA;AACnB,CAAC","sourcesContent":["import { useTheme } from '../../hooks'\n\n// =================================\n// ====== Exports ==================\n// =================================\n\nexport { getColorKey, useColorOptionMap, useGradientColorMap }\nexport type { AppearanceUnion }\n\n// =================================\n// ====== Constants ================\n// =================================\n\nconst APPEARANCES = {\n primary: 'primary',\n danger: 'danger',\n} as const\n\ntype AppearanceUnion = (typeof APPEARANCES)[keyof typeof APPEARANCES]\n\nconst COLOR_OPTIONS = {\n ...APPEARANCES,\n disabled: 'disabled',\n} as const\n\ntype ColorOptionUnion = (typeof COLOR_OPTIONS)[keyof typeof COLOR_OPTIONS]\n\n// =================================\n// ====== Hooks ====================\n// =================================\n\ntype ColorOptionMap = Record<ColorOptionUnion, string>\nfunction useColorOptionMap(): ColorOptionMap {\n const { colors } = useTheme()\n\n return {\n primary: colors.interaction,\n danger: colors.fillColorStatusErrorMedium,\n disabled: colors.textColorDefaultDisabled,\n }\n}\n\ntype GradientColorMap = Record<ColorOptionUnion, [string, string]>\nfunction useGradientColorMap(): GradientColorMap {\n const { colors } = useTheme()\n\n const defaultColorStart = colors.buttonStart || colors.interaction\n const defaultColorEnd = colors.buttonEnd || colors.interaction\n\n return {\n primary: [defaultColorStart, defaultColorEnd],\n danger: [colors.fillColorStatusErrorMedium, colors.fillColorStatusErrorMedium],\n disabled: [\n colors.fillColorButtonNeutralSolidDisabled,\n colors.fillColorButtonNeutralSolidDisabled,\n ],\n }\n}\n\n// =================================\n// ====== Functions ================\n// =================================\n\ninterface GetColorKeyArgs {\n disabled: boolean | null\n loading?: boolean\n appearance: AppearanceUnion\n}\nfunction getColorKey({ disabled, loading, appearance }: GetColorKeyArgs) {\n if (disabled || loading) return 'disabled'\n return appearance\n}\n"]}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { TextProps as ReactNativeTextProps } from 'react-native';
|
|
3
3
|
interface TextProps extends ReactNativeTextProps {
|
|
4
|
+
/**
|
|
5
|
+
* Changes the styles and size of the text.
|
|
6
|
+
* Semantically all React Native headings have the same 'hierarchical' level.
|
|
7
|
+
*/
|
|
4
8
|
variant?: 'h1' | 'h2' | 'h3' | 'h4';
|
|
5
9
|
}
|
|
6
10
|
export declare function Heading({ style, variant, children, ...props }: TextProps): React.JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"heading.d.ts","sourceRoot":"","sources":["../../../src/components/display/heading.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAIL,SAAS,IAAI,oBAAoB,EAClC,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"heading.d.ts","sourceRoot":"","sources":["../../../src/components/display/heading.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAIL,SAAS,IAAI,oBAAoB,EAClC,MAAM,cAAc,CAAA;AAQrB,UAAU,SAAU,SAAQ,oBAAoB;IAC9C;;;OAGG;IACH,OAAO,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAA;CACpC;AAED,wBAAgB,OAAO,CAAC,EAAE,KAAK,EAAE,OAAc,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,SAAS,qBAkB/E"}
|
|
@@ -15,6 +15,9 @@ export function Heading({ style, variant = 'h1', children, ...props }) {
|
|
|
15
15
|
{children}
|
|
16
16
|
</ReactNativeText>);
|
|
17
17
|
}
|
|
18
|
+
// =================================
|
|
19
|
+
// ====== Styles ===================
|
|
20
|
+
// =================================
|
|
18
21
|
const useStyles = () => {
|
|
19
22
|
const { colors } = useTheme();
|
|
20
23
|
return StyleSheet.create({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"heading.js","sourceRoot":"","sources":["../../../src/components/display/heading.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EACL,QAAQ,EACR,UAAU,EACV,IAAI,IAAI,eAAe,GAExB,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAA;AACrD,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAA;
|
|
1
|
+
{"version":3,"file":"heading.js","sourceRoot":"","sources":["../../../src/components/display/heading.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACtC,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EACL,QAAQ,EACR,UAAU,EACV,IAAI,IAAI,eAAe,GAExB,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAA;AACrD,OAAO,EAAE,sBA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AE,MAAM,CAAC,wBAAwB;YACtC,UAAU,EAAE,sBAAsB;YAClC,QAAQ,EAAE,MAAM,CAAC,UAAU;YAC3B,UAAU,EAAE,EAAE;SACf;QACD,QAAQ,EAAE;YACR,KAAK,EAAE,MAAM,CAAC,yBAAyB;YACvC,UAAU,EAAE,sBAAsB;YAClC,QAAQ,EAAE,MAAM,CAAC,UAAU;YAC3B,UAAU,EAAE,EAAE;YACd,aAAa,EAAE,WAAW;SAC3B;KACF,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["import { useTheme } from '../../hooks'\nimport React from 'react'\nimport {\n Platform,\n StyleSheet,\n Text as ReactNativeText,\n TextProps as ReactNativeTextProps,\n} from 'react-native'\nimport { tokens } from '../../vendor/tapestry/tokens'\nimport { platformFontWeightBold } from '../../utils/styles'\n\n// =================================\n// ====== Component ================\n// =================================\n\ninterface TextProps extends ReactNativeTextProps {\n /**\n * Changes the styles and size of the text.\n * Semantically all React Native headings have the same 'hierarchical' level.\n */\n variant?: 'h1' | 'h2' | 'h3' | 'h4'\n}\n\nexport function Heading({ style, variant = 'h1', children, ...props }: TextProps) {\n const styles = useStyles()\n const variantStyleMap = {\n h1: styles.heading1,\n h2: styles.heading2,\n h3: styles.heading3,\n h4: styles.heading4,\n }\n\n return (\n <ReactNativeText\n style={[styles.global, variantStyleMap[variant], style]}\n accessibilityRole=\"header\"\n {...props}\n >\n {children}\n </ReactNativeText>\n )\n}\n\n// =================================\n// ====== Styles ===================\n// =================================\n\nconst useStyles = () => {\n const { colors } = useTheme()\n\n return StyleSheet.create({\n global: {\n fontFamily: Platform.select({\n ios: 'System',\n android: 'normal',\n }),\n },\n heading1: {\n color: colors.textColorDefaultHeadline,\n fontSize: 25, // Todo: Check with UX on correct token\n lineHeight: 32,\n },\n heading2: {\n color: colors.textColorDefaultHeadline,\n fontWeight: platformFontWeightBold,\n fontSize: 21, // Todo: Check with UX on correct token\n lineHeight: 24,\n },\n heading3: {\n color: colors.textColorDefaultHeadline,\n fontWeight: platformFontWeightBold,\n fontSize: tokens.fontSizeLg,\n lineHeight: 22,\n },\n heading4: {\n color: colors.textColorDefaultSecondary,\n fontWeight: platformFontWeightBold,\n fontSize: tokens.fontSizeSm,\n lineHeight: 20,\n textTransform: 'uppercase',\n },\n })\n}\n"]}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { ViewStyle } from 'react-native';
|
|
2
|
+
import type { StyleProp, ViewStyle } from 'react-native';
|
|
3
3
|
import type { XmlProps } from 'react-native-svg';
|
|
4
4
|
type IconStyle = ViewStyle & {
|
|
5
5
|
fontSize?: number;
|
|
6
6
|
color?: string;
|
|
7
7
|
};
|
|
8
|
-
interface IconProps extends Omit<XmlProps, 'xml'> {
|
|
8
|
+
interface IconProps extends Omit<XmlProps, 'xml' | 'fontSize'> {
|
|
9
9
|
/**
|
|
10
10
|
* Made up of the set.iconName.
|
|
11
11
|
* Example: "general.textMessage"
|
|
@@ -16,11 +16,15 @@ interface IconProps extends Omit<XmlProps, 'xml'> {
|
|
|
16
16
|
* Providing a fontSize style will allow the icon to scale with the device's text a11y size.
|
|
17
17
|
*/
|
|
18
18
|
size?: number;
|
|
19
|
+
/**
|
|
20
|
+
* Specifies the maximum size a font can reach when allowFontScaling is enabled.
|
|
21
|
+
*/
|
|
22
|
+
maxFontSizeMultiplier?: number;
|
|
19
23
|
/**
|
|
20
24
|
* Icon can handle ViewStyle, color, and fontSize.
|
|
21
25
|
*/
|
|
22
|
-
style?: IconStyle
|
|
26
|
+
style?: StyleProp<IconStyle>;
|
|
23
27
|
}
|
|
24
|
-
export declare function Icon({ name, size, style, accessibilityElementsHidden, accessibilityLabel, ...props }: IconProps): React.JSX.Element;
|
|
28
|
+
export declare function Icon({ name, size, style, accessibilityElementsHidden, accessibilityLabel, maxFontSizeMultiplier, ...props }: IconProps): React.JSX.Element;
|
|
25
29
|
export {};
|
|
26
30
|
//# sourceMappingURL=icon.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icon.d.ts","sourceRoot":"","sources":["../../../src/components/display/icon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"icon.d.ts","sourceRoot":"","sources":["../../../src/components/display/icon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAEzB,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAExD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AA0BhD,KAAK,SAAS,GAAG,SAAS,GAAG;IAC3B,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAAA;AAMD,UAAU,SAAU,SAAQ,IAAI,CAAC,QAAQ,EAAE,KAAK,GAAG,UAAU,CAAC;IAC5D;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAA;IACZ;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAA;IACb;;OAEG;IACH,qBAAqB,CAAC,EAAE,MAAM,CAAA;IAC9B;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAA;CAC7B;AAED,wBAAgB,IAAI,CAAC,EACnB,IAAI,EACJ,IAAI,EACJ,KAAK,EACL,2BAA2B,EAC3B,kBAAkB,EAClB,qBAAqB,EACrB,GAAG,KAAK,EACT,EAAE,SAAS,qBA0BX"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { StyleSheet, View } from 'react-native';
|
|
3
3
|
import { SvgXml } from 'react-native-svg';
|
|
4
|
-
import { useTheme } from '../../hooks';
|
|
4
|
+
import { useFontScale, useTheme } from '../../hooks';
|
|
5
5
|
import * as general from '@planningcenter/icons/paths/general';
|
|
6
6
|
import * as groups from '@planningcenter/icons/paths/groups';
|
|
7
7
|
import * as calendar from '@planningcenter/icons/paths/calendar';
|
|
@@ -9,6 +9,9 @@ import * as people from '@planningcenter/icons/paths/people';
|
|
|
9
9
|
import * as churchCenter from '@planningcenter/icons/paths/church-center';
|
|
10
10
|
import * as logomark from '@planningcenter/icons/paths/logomark';
|
|
11
11
|
import * as brand from '@planningcenter/icons/paths/brand';
|
|
12
|
+
// =================================
|
|
13
|
+
// ====== Constants ================
|
|
14
|
+
// =================================
|
|
12
15
|
const FALLBACK_SIZE = 12;
|
|
13
16
|
const ICONS = {
|
|
14
17
|
calendar,
|
|
@@ -19,10 +22,11 @@ const ICONS = {
|
|
|
19
22
|
logomark,
|
|
20
23
|
brand,
|
|
21
24
|
};
|
|
22
|
-
export function Icon({ name, size, style, accessibilityElementsHidden, accessibilityLabel, ...props }) {
|
|
25
|
+
export function Icon({ name, size, style, accessibilityElementsHidden, accessibilityLabel, maxFontSizeMultiplier, ...props }) {
|
|
26
|
+
const flattenStyles = StyleSheet.flatten(style);
|
|
27
|
+
const iconSize = useGetIconSize(size, flattenStyles, maxFontSizeMultiplier);
|
|
23
28
|
const path = getIconPath(name);
|
|
24
|
-
const
|
|
25
|
-
const styles = useStyles(iconSize);
|
|
29
|
+
const styles = useStyles({ iconSize });
|
|
26
30
|
if (!path) {
|
|
27
31
|
console.warn(`No icon available named ${name}. Remember to use the format "set.iconName"`);
|
|
28
32
|
return <View style={styles.noIcon}/>;
|
|
@@ -31,26 +35,30 @@ export function Icon({ name, size, style, accessibilityElementsHidden, accessibi
|
|
|
31
35
|
<svg viewBox="0 0 16 16">
|
|
32
36
|
<path d="${path}" fill="currentColor" />
|
|
33
37
|
</svg>
|
|
34
|
-
`} height={iconSize} width={iconSize} style={{ ...styles.icon, ...
|
|
38
|
+
`} height={iconSize} width={iconSize} style={{ ...styles.icon, ...flattenStyles }} {...props}/>);
|
|
35
39
|
}
|
|
36
|
-
const
|
|
37
|
-
const fontSize =
|
|
40
|
+
const useGetIconSize = (size, style, maxFontSizeMultiplier) => {
|
|
41
|
+
const fontSize = style?.fontSize;
|
|
42
|
+
const fontScale = useFontScale({ maxFontSizeMultiplier });
|
|
38
43
|
if (fontSize)
|
|
39
|
-
return fontSize *
|
|
44
|
+
return fontSize * fontScale;
|
|
40
45
|
return size || FALLBACK_SIZE;
|
|
41
46
|
};
|
|
42
47
|
const getIconPath = (name) => {
|
|
43
48
|
const [setName, iconName] = name.split('.');
|
|
44
49
|
return ICONS[setName]?.[iconName];
|
|
45
50
|
};
|
|
46
|
-
|
|
51
|
+
// =================================
|
|
52
|
+
// ====== Styles ===================
|
|
53
|
+
// =================================
|
|
54
|
+
const useStyles = ({ iconSize }) => {
|
|
47
55
|
const { colors } = useTheme();
|
|
48
56
|
return StyleSheet.create({
|
|
49
57
|
noIcon: {
|
|
50
58
|
backgroundColor: colors.iconColorDefaultDisabled,
|
|
51
|
-
width:
|
|
52
|
-
height:
|
|
53
|
-
borderRadius:
|
|
59
|
+
width: iconSize,
|
|
60
|
+
height: iconSize,
|
|
61
|
+
borderRadius: iconSize / 2,
|
|
54
62
|
},
|
|
55
63
|
icon: {
|
|
56
64
|
color: colors.iconColorDefaultPrimary,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"icon.js","sourceRoot":"","sources":["../../../src/components/display/icon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,UAAU,EAAE,
|
|
1
|
+
{"version":3,"file":"icon.js","sourceRoot":"","sources":["../../../src/components/display/icon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAE/C,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAA;AAEzC,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACpD,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ourcesContent":["import React from 'react'\nimport { StyleSheet, View } from 'react-native'\nimport type { StyleProp, ViewStyle } from 'react-native'\nimport { SvgXml } from 'react-native-svg'\nimport type { XmlProps } from 'react-native-svg'\nimport { useFontScale, useTheme } from '../../hooks'\nimport * as general from '@planningcenter/icons/paths/general'\nimport * as groups from '@planningcenter/icons/paths/groups'\nimport * as calendar from '@planningcenter/icons/paths/calendar'\nimport * as people from '@planningcenter/icons/paths/people'\nimport * as churchCenter from '@planningcenter/icons/paths/church-center'\nimport * as logomark from '@planningcenter/icons/paths/logomark'\nimport * as brand from '@planningcenter/icons/paths/brand'\n\n// =================================\n// ====== Constants ================\n// =================================\n\nconst FALLBACK_SIZE = 12\n\nconst ICONS = {\n calendar,\n people,\n churchCenter,\n groups,\n general,\n logomark,\n brand,\n} as const\n\ntype IconStyle = ViewStyle & {\n fontSize?: number\n color?: string\n}\n\n// =================================\n// ====== Component ================\n// =================================\n\ninterface IconProps extends Omit<XmlProps, 'xml' | 'fontSize'> {\n /**\n * Made up of the set.iconName.\n * Example: \"general.textMessage\"\n */\n name: string\n /**\n * This sets a static size for the icon.\n * Providing a fontSize style will allow the icon to scale with the device's text a11y size.\n */\n size?: number\n /**\n * Specifies the maximum size a font can reach when allowFontScaling is enabled.\n */\n maxFontSizeMultiplier?: number\n /**\n * Icon can handle ViewStyle, color, and fontSize.\n */\n style?: StyleProp<IconStyle>\n}\n\nexport function Icon({\n name,\n size,\n style,\n accessibilityElementsHidden,\n accessibilityLabel,\n maxFontSizeMultiplier,\n ...props\n}: IconProps) {\n const flattenStyles = StyleSheet.flatten(style)\n const iconSize = useGetIconSize(size, flattenStyles, maxFontSizeMultiplier)\n const path = getIconPath(name)\n const styles = useStyles({ iconSize })\n\n if (!path) {\n console.warn(`No icon available named ${name}. Remember to use the format \"set.iconName\"`)\n return <View style={styles.noIcon} />\n }\n\n return (\n <SvgXml\n accessibilityElementsHidden={accessibilityElementsHidden}\n accessibilityLabel={accessibilityLabel}\n xml={`\n <svg viewBox=\"0 0 16 16\">\n <path d=\"${path}\" fill=\"currentColor\" />\n </svg>\n `}\n height={iconSize}\n width={iconSize}\n style={{ ...styles.icon, ...flattenStyles }}\n {...props}\n />\n )\n}\n\nconst useGetIconSize = (size?: number, style?: IconStyle, maxFontSizeMultiplier?: number) => {\n const fontSize = style?.fontSize\n const fontScale = useFontScale({ maxFontSizeMultiplier })\n\n if (fontSize) return fontSize * fontScale\n\n return size || FALLBACK_SIZE\n}\n\nconst getIconPath = (name: string): string => {\n const [setName, iconName] = name.split('.')\n\n return ICONS[setName]?.[iconName]\n}\n\n// =================================\n// ====== Styles ===================\n// =================================\n\nconst useStyles = ({ iconSize }: { iconSize: number }) => {\n const { colors } = useTheme()\n\n return StyleSheet.create({\n noIcon: {\n backgroundColor: colors.iconColorDefaultDisabled,\n width: iconSize,\n height: iconSize,\n borderRadius: iconSize / 2,\n },\n icon: {\n color: colors.iconColorDefaultPrimary,\n },\n })\n}\n"]}
|
|
@@ -2,7 +2,12 @@ import React from 'react';
|
|
|
2
2
|
import { ImageProps as ReactNativeImageProps, ViewStyle } from 'react-native';
|
|
3
3
|
export interface ImageProps extends ReactNativeImageProps {
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* Describes the image to screen-readers and marks the image as `accessible`.
|
|
6
|
+
* Passing an empty string will hide the image from screen-readers.
|
|
7
|
+
*/
|
|
8
|
+
alt: string;
|
|
9
|
+
/**
|
|
10
|
+
* Shows the image's loading spinner right away. Enabled by default.
|
|
6
11
|
*/
|
|
7
12
|
defaultLoading?: boolean;
|
|
8
13
|
/**
|
|
@@ -22,5 +27,5 @@ export interface ImageProps extends ReactNativeImageProps {
|
|
|
22
27
|
*/
|
|
23
28
|
wrapperStyle?: ViewStyle;
|
|
24
29
|
}
|
|
25
|
-
export declare function Image({ source, onLoad, defaultLoading, loadingEnabled, loaderSize, loadingBackgroundStyles, style, wrapperStyle, ...props }: ImageProps): React.JSX.Element;
|
|
30
|
+
export declare function Image({ source, onLoad, defaultLoading, loadingEnabled, loaderSize, loadingBackgroundStyles, style, wrapperStyle, alt, ...props }: ImageProps): React.JSX.Element;
|
|
26
31
|
//# sourceMappingURL=image.d.ts.map
|