@planningcenter/chat-react-native 1.3.0-rc.3 → 1.3.0-rc.5
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/CHANGELOG.md +24 -0
- package/build/components/conversations.d.ts +3 -0
- package/build/components/conversations.d.ts.map +1 -0
- package/build/components/conversations.js +52 -0
- package/build/components/conversations.js.map +1 -0
- package/build/components/error_boundary.d.ts +12 -0
- package/build/components/error_boundary.d.ts.map +1 -0
- package/build/components/error_boundary.js +24 -0
- package/build/components/error_boundary.js.map +1 -0
- package/build/contexts/chat_context.d.ts +9 -0
- package/build/contexts/chat_context.d.ts.map +1 -0
- package/build/contexts/chat_context.js +7 -0
- package/build/contexts/chat_context.js.map +1 -0
- package/build/hooks/use_create_chat_theme.d.ts +10 -0
- package/build/hooks/use_create_chat_theme.d.ts.map +1 -0
- package/build/hooks/use_create_chat_theme.js +20 -0
- package/build/hooks/use_create_chat_theme.js.map +1 -0
- package/build/hooks/use_theme.d.ts +3 -0
- package/build/hooks/use_theme.d.ts.map +1 -0
- package/build/hooks/use_theme.js +7 -0
- package/build/hooks/use_theme.js.map +1 -0
- package/build/index.d.ts +6 -5
- package/build/index.d.ts.map +1 -1
- package/build/index.js +4 -38
- package/build/index.js.map +1 -1
- package/build/utils/theme.d.ts +34 -0
- package/build/utils/theme.d.ts.map +1 -0
- package/build/utils/theme.js +33 -0
- package/build/utils/theme.js.map +1 -0
- package/build/vendor/tapestry/tapestry_alias_tokens_color_map.d.ts +41 -0
- package/build/vendor/tapestry/tapestry_alias_tokens_color_map.d.ts.map +1 -0
- package/build/vendor/tapestry/tapestry_alias_tokens_color_map.js +50 -0
- package/build/vendor/tapestry/tapestry_alias_tokens_color_map.js.map +1 -0
- package/build/vendor/tapestry/tokens.d.ts +38 -0
- package/build/vendor/tapestry/tokens.d.ts.map +1 -0
- package/build/vendor/tapestry/tokens.js +50 -0
- package/build/vendor/tapestry/tokens.js.map +1 -0
- package/package.json +6 -2
- package/src/components/conversations.tsx +75 -0
- package/src/components/error_boundary.tsx +27 -0
- package/src/contexts/chat_context.tsx +14 -0
- package/src/hooks/use_create_chat_theme.tsx +31 -0
- package/src/hooks/use_theme.tsx +9 -0
- package/src/index.tsx +12 -58
- package/src/types.d.ts +25 -0
- package/src/utils/theme.ts +73 -0
- package/src/vendor/tapestry/tapestry_alias_tokens_color_map.ts +82 -0
- package/src/vendor/tapestry/tokens.ts +97 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,30 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [1.3.0-rc.5](https://github.com/planningcenter/chat-js/compare/v1.2.0...v1.3.0-rc.5) (2025-02-10)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* add auth to the example app ([#50](https://github.com/planningcenter/chat-js/issues/50)) ([5e0ae00](https://github.com/planningcenter/chat-js/commit/5e0ae008345743f6bba388e982a3ad768265971a))
|
|
12
|
+
* create higher fidelity components ([#54](https://github.com/planningcenter/chat-js/issues/54)) ([367b707](https://github.com/planningcenter/chat-js/commit/367b7076b6d3a81ede7852248e98a199adea9978))
|
|
13
|
+
* drop stream and set global dependencies ([#49](https://github.com/planningcenter/chat-js/issues/49)) ([1214b9f](https://github.com/planningcenter/chat-js/commit/1214b9fbc17f4ab67a1de1d39954604a28268f35))
|
|
14
|
+
* **StreamChat:** export core package ([#41](https://github.com/planningcenter/chat-js/issues/41)) ([e9afde0](https://github.com/planningcenter/chat-js/commit/e9afde0e2a11d9c7e13b84f8eee8a6cfa7aff795)), closes [#45](https://github.com/planningcenter/chat-js/issues/45)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
## [1.3.0-rc.4](https://github.com/planningcenter/chat-js/compare/v1.2.0...v1.3.0-rc.4) (2025-02-07)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### Features
|
|
22
|
+
|
|
23
|
+
* add auth to the example app ([#50](https://github.com/planningcenter/chat-js/issues/50)) ([5e0ae00](https://github.com/planningcenter/chat-js/commit/5e0ae008345743f6bba388e982a3ad768265971a))
|
|
24
|
+
* create higher fidelity components ([#54](https://github.com/planningcenter/chat-js/issues/54)) ([367b707](https://github.com/planningcenter/chat-js/commit/367b7076b6d3a81ede7852248e98a199adea9978))
|
|
25
|
+
* drop stream and set global dependencies ([#49](https://github.com/planningcenter/chat-js/issues/49)) ([1214b9f](https://github.com/planningcenter/chat-js/commit/1214b9fbc17f4ab67a1de1d39954604a28268f35))
|
|
26
|
+
* **StreamChat:** export core package ([#41](https://github.com/planningcenter/chat-js/issues/41)) ([e9afde0](https://github.com/planningcenter/chat-js/commit/e9afde0e2a11d9c7e13b84f8eee8a6cfa7aff795)), closes [#45](https://github.com/planningcenter/chat-js/issues/45)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
6
30
|
## [1.3.0-rc.3](https://github.com/planningcenter/chat-js/compare/v1.2.0...v1.3.0-rc.3) (2025-02-06)
|
|
7
31
|
|
|
8
32
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conversations.d.ts","sourceRoot":"","sources":["../../src/components/conversations.tsx"],"names":[],"mappings":"AACA,OAAO,KAA+B,MAAM,OAAO,CAAA;AAanD,wBAAgB,aAAa,sBAQ5B"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { useSuspenseQuery } from '@tanstack/react-query';
|
|
2
|
+
import React, { Suspense, useContext } from 'react';
|
|
3
|
+
import { FlatList, StyleSheet, Text } from 'react-native';
|
|
4
|
+
import { ChatContext } from '../contexts/chat_context';
|
|
5
|
+
import ErrorBoundary from './error_boundary';
|
|
6
|
+
import { useTheme } from '../hooks/use_theme';
|
|
7
|
+
export function Conversations() {
|
|
8
|
+
return (<ErrorBoundary>
|
|
9
|
+
<Suspense fallback={<></>}>
|
|
10
|
+
<Loaded />
|
|
11
|
+
</Suspense>
|
|
12
|
+
</ErrorBoundary>);
|
|
13
|
+
}
|
|
14
|
+
const Loaded = () => {
|
|
15
|
+
const { token, onTokenExpired } = useContext(ChatContext);
|
|
16
|
+
const styles = useStyles();
|
|
17
|
+
const { data: conversations } = useSuspenseQuery({
|
|
18
|
+
queryKey: ['conversations', token],
|
|
19
|
+
queryFn: () =>
|
|
20
|
+
// TODO: replace with an api client
|
|
21
|
+
fetch('https://api.planningcenteronline.com/chat/v2/me/conversations', {
|
|
22
|
+
headers: {
|
|
23
|
+
Authorization: `Bearer ${token?.access_token}`,
|
|
24
|
+
},
|
|
25
|
+
})
|
|
26
|
+
.then(validateResponse)
|
|
27
|
+
.then(response => response.json())
|
|
28
|
+
.catch(error => {
|
|
29
|
+
if (error.message === 'Token expired') {
|
|
30
|
+
onTokenExpired();
|
|
31
|
+
}
|
|
32
|
+
return null;
|
|
33
|
+
}),
|
|
34
|
+
});
|
|
35
|
+
return (<FlatList data={conversations?.data} ListEmptyComponent={<Text>No conversations</Text>} contentContainerStyle={styles.container} ListHeaderComponent={<Text style={styles.foo}>Conversations</Text>} renderItem={({ item }) => <Text style={styles.listItem}>{item.attributes.title}</Text>}/>);
|
|
36
|
+
};
|
|
37
|
+
const useStyles = () => {
|
|
38
|
+
const { colors } = useTheme();
|
|
39
|
+
return StyleSheet.create({
|
|
40
|
+
container: { columnGap: 16, backgroundColor: colors.fillColorNeutral080 },
|
|
41
|
+
foo: { fontSize: 24, color: colors.testColor },
|
|
42
|
+
listItem: { color: colors.fillColorNeutral020 },
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
const validateResponse = (response) => {
|
|
46
|
+
const isExpired = response.status === 401;
|
|
47
|
+
if (isExpired) {
|
|
48
|
+
throw new Error('Token expired');
|
|
49
|
+
}
|
|
50
|
+
return response;
|
|
51
|
+
};
|
|
52
|
+
//# sourceMappingURL=conversations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conversations.js","sourceRoot":"","sources":["../../src/components/conversations.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AACxD,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AACnD,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AAEtD,OAAO,aAAa,MAAM,kBAAkB,CAAA;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAQ7C,MAAM,UAAU,aAAa;IAC3B,OAAO,CACL,CAAC,aAAa,CACZ;MAAA,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CACxB;QAAA,CAAC,MAAM,CAAC,AAAD,EACT;MAAA,EAAE,QAAQ,CACZ;IAAA,EAAE,aAAa,CAAC,CACjB,CAAA;AACH,CAAC;AAED,MAAM,MAAM,GAAG,GAAG,EAAE;IAClB,MAAM,EAAE,KAAK,EAAE,cAAc,EAAE,GAAG,UAAU,CAAC,WAAW,CAAC,CAAA;IACzD,MAAM,MAAM,GAAG,SAAS,EAAE,CAAA;IAC1B,MAAM,EAAE,IAAI,EAAE,aAAa,EAAE,GAAG,gBAAgB,CAAwB;QACtE,QAAQ,EAAE,CAAC,eAAe,EAAE,KAAK,CAAC;QAClC,OAAO,EAAE,GAAG,EAAE;QACZ,mCAAmC;QACnC,KAAK,CAAC,+DAA+D,EAAE;YACrE,OAAO,EAAE;gBACP,aAAa,EAAE,UAAU,KAAK,EAAE,YAAY,EAAE;aAC/C;SACF,CAAC;aACC,IAAI,CAAC,gBAAgB,CAAC;aACtB,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;aACjC,KAAK,CAAC,KAAK,CAAC,EAAE;YACb,IAAI,KAAK,CAAC,OAAO,KAAK,eAAe,EAAE,CAAC;gBACtC,cAAc,EAAE,CAAA;YAClB,CAAC;YACD,OAAO,IAAI,CAAA;QACb,CAAC,CAAC;KACP,CAAC,CAAA;IAEF,OAAO,CACL,CAAC,QAAQ,CACP,IAAI,CAAC,CAAC,aAAa,EAAE,IAAI,CAAC,CAC1B,kBAAkB,CAAC,CAAC,CAAC,IAAI,CAAC,gBAAgB,EAAE,IAAI,CAAC,CAAC,CAClD,qBAAqB,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CACxC,mBAAmB,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC,CACnE,UAAU,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,CAAC,EACvF,CACH,CAAA;AACH,CAAC,CAAA;AAED,MAAM,SAAS,GAAG,GAAG,EAAE;IACrB,MAAM,EAAE,MAAM,EAAE,GAAG,QAAQ,EAAE,CAAA;IAE7B,OAAO,UAAU,CAAC,MAAM,CAAC;QACvB,SAAS,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,eAAe,EAAE,MAAM,CAAC,mBAAmB,EAAE;QACzE,GAAG,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,SAAS,EAAE;QAC9C,QAAQ,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,mBAAmB,EAAE;KAChD,CAAC,CAAA;AACJ,CAAC,CAAA;AAED,MAAM,gBAAgB,GAAG,CAAC,QAAkB,EAAE,EAAE;IAC9C,MAAM,SAAS,GAAG,QAAQ,CAAC,MAAM,KAAK,GAAG,CAAA;IACzC,IAAI,SAAS,EAAE,CAAC;QACd,MAAM,IAAI,KAAK,CAAC,eAAe,CAAC,CAAA;IAClC,CAAC;IAED,OAAO,QAAQ,CAAA;AACjB,CAAC,CAAA","sourcesContent":["import { useSuspenseQuery } from '@tanstack/react-query'\nimport React, { Suspense, useContext } from 'react'\nimport { FlatList, StyleSheet, Text } from 'react-native'\nimport { ChatContext } from '../contexts/chat_context'\nimport { ConversationRecord } from '../types'\nimport ErrorBoundary from './error_boundary'\nimport { useTheme } from '../hooks/use_theme'\n\ntype ConversationsResponse = {\n data: ConversationRecord[]\n links: Record<string, string>\n meta: Record<string, string>\n}\n\nexport function Conversations() {\n return (\n <ErrorBoundary>\n <Suspense fallback={<></>}>\n <Loaded />\n </Suspense>\n </ErrorBoundary>\n )\n}\n\nconst Loaded = () => {\n const { token, onTokenExpired } = useContext(ChatContext)\n const styles = useStyles()\n const { data: conversations } = useSuspenseQuery<ConversationsResponse>({\n queryKey: ['conversations', token],\n queryFn: () =>\n // TODO: replace with an api client\n fetch('https://api.planningcenteronline.com/chat/v2/me/conversations', {\n headers: {\n Authorization: `Bearer ${token?.access_token}`,\n },\n })\n .then(validateResponse)\n .then(response => response.json())\n .catch(error => {\n if (error.message === 'Token expired') {\n onTokenExpired()\n }\n return null\n }),\n })\n\n return (\n <FlatList\n data={conversations?.data}\n ListEmptyComponent={<Text>No conversations</Text>}\n contentContainerStyle={styles.container}\n ListHeaderComponent={<Text style={styles.foo}>Conversations</Text>}\n renderItem={({ item }) => <Text style={styles.listItem}>{item.attributes.title}</Text>}\n />\n )\n}\n\nconst useStyles = () => {\n const { colors } = useTheme()\n\n return StyleSheet.create({\n container: { columnGap: 16, backgroundColor: colors.fillColorNeutral080 },\n foo: { fontSize: 24, color: colors.testColor },\n listItem: { color: colors.fillColorNeutral020 },\n })\n}\n\nconst validateResponse = (response: Response) => {\n const isExpired = response.status === 401\n if (isExpired) {\n throw new Error('Token expired')\n }\n\n return response\n}\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React, { PropsWithChildren } from 'react';
|
|
2
|
+
declare class ErrorBoundary extends React.Component<PropsWithChildren<{}>> {
|
|
3
|
+
state: {
|
|
4
|
+
error: null;
|
|
5
|
+
unsubscriber: () => void;
|
|
6
|
+
};
|
|
7
|
+
componentDidCatch(error: any): void;
|
|
8
|
+
handleError(error: any): void;
|
|
9
|
+
render(): string | number | bigint | boolean | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | React.JSX.Element | null | undefined;
|
|
10
|
+
}
|
|
11
|
+
export default ErrorBoundary;
|
|
12
|
+
//# sourceMappingURL=error_boundary.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error_boundary.d.ts","sourceRoot":"","sources":["../../src/components/error_boundary.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAA;AAGhD,cAAM,aAAc,SAAQ,KAAK,CAAC,SAAS,CAAC,iBAAiB,CAAC,EAAE,CAAC,CAAC;IAChE,KAAK;;;MAGJ;IAED,iBAAiB,CAAC,KAAK,EAAE,GAAG;IAI5B,WAAW,CAAC,KAAK,EAAE,GAAG;IAItB,MAAM;CAOP;AAED,eAAe,aAAa,CAAA"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Text } from 'react-native';
|
|
3
|
+
class ErrorBoundary extends React.Component {
|
|
4
|
+
state = {
|
|
5
|
+
error: null,
|
|
6
|
+
unsubscriber: () => { },
|
|
7
|
+
};
|
|
8
|
+
componentDidCatch(error) {
|
|
9
|
+
this.handleError(error);
|
|
10
|
+
}
|
|
11
|
+
handleError(error) {
|
|
12
|
+
this.setState({ error });
|
|
13
|
+
}
|
|
14
|
+
render() {
|
|
15
|
+
if (this.state.error) {
|
|
16
|
+
return <Text>{JSON.stringify(this.state.error, null, 2)}</Text>;
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
return this.props.children;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
export default ErrorBoundary;
|
|
24
|
+
//# sourceMappingURL=error_boundary.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error_boundary.js","sourceRoot":"","sources":["../../src/components/error_boundary.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4B,MAAM,OAAO,CAAA;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAA;AAEnC,MAAM,aAAc,SAAQ,KAAK,CAAC,SAAgC;IAChE,KAAK,GAAG;QACN,KAAK,EAAE,IAAI;QACX,YAAY,EAAE,GAAG,EAAE,GAAE,CAAC;KACvB,CAAA;IAED,iBAAiB,CAAC,KAAU;QAC1B,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAA;IACzB,CAAC;IAED,WAAW,CAAC,KAAU;QACpB,IAAI,CAAC,QAAQ,CAAC,EAAE,KAAK,EAAE,CAAC,CAAA;IAC1B,CAAC;IAED,MAAM;QACJ,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;YACrB,OAAO,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAA;QACjE,CAAC;aAAM,CAAC;YACN,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAA;QAC5B,CAAC;IACH,CAAC;CACF;AAED,eAAe,aAAa,CAAA","sourcesContent":["import React, { PropsWithChildren } from 'react'\nimport { Text } from 'react-native'\n\nclass ErrorBoundary extends React.Component<PropsWithChildren<{}>> {\n state = {\n error: null,\n unsubscriber: () => {},\n }\n\n componentDidCatch(error: any) {\n this.handleError(error)\n }\n\n handleError(error: any) {\n this.setState({ error })\n }\n\n render() {\n if (this.state.error) {\n return <Text>{JSON.stringify(this.state.error, null, 2)}</Text>\n } else {\n return this.props.children\n }\n }\n}\n\nexport default ErrorBoundary\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { OauthToken } from '../types';
|
|
2
|
+
type ContextValue = {
|
|
3
|
+
token: OauthToken | null;
|
|
4
|
+
onTokenExpired: () => void;
|
|
5
|
+
theme: any;
|
|
6
|
+
};
|
|
7
|
+
export declare const ChatContext: import("react").Context<ContextValue>;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=chat_context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat_context.d.ts","sourceRoot":"","sources":["../../src/contexts/chat_context.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAErC,KAAK,YAAY,GAAG;IAClB,KAAK,EAAE,UAAU,GAAG,IAAI,CAAA;IACxB,cAAc,EAAE,MAAM,IAAI,CAAA;IAC1B,KAAK,EAAE,GAAG,CAAA;CACX,CAAA;AAED,eAAO,MAAM,WAAW,uCAItB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat_context.js","sourceRoot":"","sources":["../../src/contexts/chat_context.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AASrC,MAAM,CAAC,MAAM,WAAW,GAAG,aAAa,CAAe;IACrD,KAAK,EAAE,IAAI;IACX,KAAK,EAAE,IAAI;IACX,cAAc,EAAE,GAAG,EAAE,GAAE,CAAC;CACzB,CAAC,CAAA","sourcesContent":["import { createContext } from 'react'\nimport { OauthToken } from '../types'\n\ntype ContextValue = {\n token: OauthToken | null\n onTokenExpired: () => void\n theme: any\n}\n\nexport const ChatContext = createContext<ContextValue>({\n theme: null,\n token: null,\n onTokenExpired: () => {},\n})\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ColorSchemeName } from 'react-native';
|
|
2
|
+
import { DefaultTheme } from '../utils/theme';
|
|
3
|
+
import { DeepPartial } from '../types';
|
|
4
|
+
interface CreateChatThemeProps {
|
|
5
|
+
theme?: DeepPartial<DefaultTheme>;
|
|
6
|
+
colorScheme?: ColorSchemeName;
|
|
7
|
+
}
|
|
8
|
+
export declare const useCreateChatTheme: ({ theme: customTheme, colorScheme: appColorScheme, }: CreateChatThemeProps) => any;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=use_create_chat_theme.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use_create_chat_theme.d.ts","sourceRoot":"","sources":["../../src/hooks/use_create_chat_theme.tsx"],"names":[],"mappings":"AACA,OAAO,EAAkB,eAAe,EAAE,MAAM,cAAc,CAAA;AAC9D,OAAO,EAAgB,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAItC,UAAU,oBAAoB;IAC5B,KAAK,CAAC,EAAE,WAAW,CAAC,YAAY,CAAC,CAAA;IACjC,WAAW,CAAC,EAAE,eAAe,CAAA;CAC9B;AAED,eAAO,MAAM,kBAAkB,yDAG5B,oBAAoB,QAetB,CAAA"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
import { useColorScheme } from 'react-native';
|
|
3
|
+
import { defaultTheme } from '../utils/theme';
|
|
4
|
+
import { tapestryAliasTokensColorMap } from '../vendor/tapestry/tapestry_alias_tokens_color_map';
|
|
5
|
+
import { merge } from 'lodash';
|
|
6
|
+
export const useCreateChatTheme = ({ theme: customTheme = {}, colorScheme: appColorScheme, }) => {
|
|
7
|
+
const internalColorScheme = useColorScheme() || 'light';
|
|
8
|
+
const colorScheme = appColorScheme || internalColorScheme;
|
|
9
|
+
const memoizedTheme = useMemo(() => {
|
|
10
|
+
return {
|
|
11
|
+
...merge({}, defaultTheme(colorScheme), customTheme),
|
|
12
|
+
colors: {
|
|
13
|
+
...merge({}, defaultTheme(colorScheme).colors, customTheme?.colors),
|
|
14
|
+
...tapestryAliasTokensColorMap[colorScheme],
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
}, [colorScheme, customTheme]);
|
|
18
|
+
return memoizedTheme;
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=use_create_chat_theme.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use_create_chat_theme.js","sourceRoot":"","sources":["../../src/hooks/use_create_chat_theme.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAA;AAC/B,OAAO,EAAE,cAAc,EAAmB,MAAM,cAAc,CAAA;AAC9D,OAAO,EAAE,YAAY,EAAgB,MAAM,gBAAgB,CAAA;AAE3D,OAAO,EAAE,2BAA2B,EAAE,MAAM,oDAAoD,CAAA;AAChG,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAA;AAO9B,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,EACjC,KAAK,EAAE,WAAW,GAAG,EAAE,EACvB,WAAW,EAAE,cAAc,GACN,EAAE,EAAE;IACzB,MAAM,mBAAmB,GAAG,cAAc,EAAE,IAAI,OAAO,CAAA;IACvD,MAAM,WAAW,GAAG,cAAc,IAAI,mBAAmB,CAAA;IAEzD,MAAM,aAAa,GAAG,OAAO,CAAC,GAAG,EAAE;QACjC,OAAO;YACL,GAAG,KAAK,CAAC,EAAE,EAAE,YAAY,CAAC,WAAW,CAAC,EAAE,WAAW,CAAC;YACpD,MAAM,EAAE;gBACN,GAAG,KAAK,CAAC,EAAE,EAAE,YAAY,CAAC,WAAW,CAAC,CAAC,MAAM,EAAE,WAAW,EAAE,MAAM,CAAC;gBACnE,GAAG,2BAA2B,CAAC,WAAW,CAAC;aAC5C;SACF,CAAA;IACH,CAAC,EAAE,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC,CAAA;IAE9B,OAAO,aAAa,CAAA;AACtB,CAAC,CAAA","sourcesContent":["import { useMemo } from 'react'\nimport { useColorScheme, ColorSchemeName } from 'react-native'\nimport { defaultTheme, DefaultTheme } from '../utils/theme'\nimport { DeepPartial } from '../types'\nimport { tapestryAliasTokensColorMap } from '../vendor/tapestry/tapestry_alias_tokens_color_map'\nimport { merge } from 'lodash'\n\ninterface CreateChatThemeProps {\n theme?: DeepPartial<DefaultTheme>\n colorScheme?: ColorSchemeName\n}\n\nexport const useCreateChatTheme = ({\n theme: customTheme = {},\n colorScheme: appColorScheme,\n}: CreateChatThemeProps) => {\n const internalColorScheme = useColorScheme() || 'light'\n const colorScheme = appColorScheme || internalColorScheme\n\n const memoizedTheme = useMemo(() => {\n return {\n ...merge({}, defaultTheme(colorScheme), customTheme),\n colors: {\n ...merge({}, defaultTheme(colorScheme).colors, customTheme?.colors),\n ...tapestryAliasTokensColorMap[colorScheme],\n },\n }\n }, [colorScheme, customTheme])\n\n return memoizedTheme\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use_theme.d.ts","sourceRoot":"","sources":["../../src/hooks/use_theme.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAE1C,eAAO,MAAM,QAAQ,QAAO,SAI3B,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use_theme.js","sourceRoot":"","sources":["../../src/hooks/use_theme.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAClC,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AAGtD,MAAM,CAAC,MAAM,QAAQ,GAAG,GAAc,EAAE;IACtC,MAAM,EAAE,KAAK,EAAE,GAAG,UAAU,CAAC,WAAW,CAAC,CAAA;IAEzC,OAAO,KAAK,CAAA;AACd,CAAC,CAAA","sourcesContent":["import { useContext } from 'react'\nimport { ChatContext } from '../contexts/chat_context'\nimport { ChatTheme } from '../utils/theme'\n\nexport const useTheme = (): ChatTheme => {\n const { theme } = useContext(ChatContext)\n\n return theme\n}\n"]}
|
package/build/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
1
|
+
import { Conversations } from './components/conversations';
|
|
2
|
+
import { ChatContext } from './contexts/chat_context';
|
|
3
|
+
import { useCreateChatTheme } from './hooks/use_create_chat_theme';
|
|
4
|
+
import { OauthToken } from './types';
|
|
5
|
+
import { TemporaryDefaultColorsType } from './utils/theme';
|
|
6
|
+
export { ChatContext, Conversations, OauthToken as OathToken, TemporaryDefaultColorsType, useCreateChatTheme, };
|
|
6
7
|
//# sourceMappingURL=index.d.ts.map
|
package/build/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAA;AAClE,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACpC,OAAO,EAAE,0BAA0B,EAAE,MAAM,eAAe,CAAA;AAE1D,OAAO,EACL,WAAW,EACX,aAAa,EACb,UAAU,IAAI,SAAS,EACvB,0BAA0B,EAC1B,kBAAkB,GACnB,CAAA"}
|
package/build/index.js
CHANGED
|
@@ -1,39 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const styles = useStyles();
|
|
6
|
-
useEffect(() => {
|
|
7
|
-
if (!token) {
|
|
8
|
-
return;
|
|
9
|
-
}
|
|
10
|
-
fetch('https://api.planningcenteronline.com/chat/v2/me/conversations', {
|
|
11
|
-
headers: {
|
|
12
|
-
Authorization: `Bearer ${token.access_token}`,
|
|
13
|
-
},
|
|
14
|
-
})
|
|
15
|
-
.then(validateResponse)
|
|
16
|
-
.then(response => response.json())
|
|
17
|
-
.then(setConversations)
|
|
18
|
-
.catch(error => {
|
|
19
|
-
if (error.message === 'Token expired') {
|
|
20
|
-
onTokenExpired();
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
}, [onTokenExpired, token]);
|
|
24
|
-
return (<FlatList data={conversations?.data} ListEmptyComponent={<Text>No conversations</Text>} contentContainerStyle={styles.container} ListHeaderComponent={<Text style={styles.foo}>Conversations</Text>} renderItem={({ item }) => <Text>{item.attributes.title}</Text>}/>);
|
|
25
|
-
}
|
|
26
|
-
const useStyles = () => {
|
|
27
|
-
return StyleSheet.create({
|
|
28
|
-
container: { columnGap: 16 },
|
|
29
|
-
foo: { fontSize: 24 },
|
|
30
|
-
});
|
|
31
|
-
};
|
|
32
|
-
const validateResponse = (response) => {
|
|
33
|
-
const isExpired = response.status === 401;
|
|
34
|
-
if (isExpired) {
|
|
35
|
-
throw new Error('Token expired');
|
|
36
|
-
}
|
|
37
|
-
return response;
|
|
38
|
-
};
|
|
1
|
+
import { Conversations } from './components/conversations';
|
|
2
|
+
import { ChatContext } from './contexts/chat_context';
|
|
3
|
+
import { useCreateChatTheme } from './hooks/use_create_chat_theme';
|
|
4
|
+
export { ChatContext, Conversations, useCreateChatTheme, };
|
|
39
5
|
//# sourceMappingURL=index.js.map
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAA;AAIlE,OAAO,EACL,WAAW,EACX,aAAa,EAGb,kBAAkB,GACnB,CAAA","sourcesContent":["import { Conversations } from './components/conversations'\nimport { ChatContext } from './contexts/chat_context'\nimport { useCreateChatTheme } from './hooks/use_create_chat_theme'\nimport { OauthToken } from './types'\nimport { TemporaryDefaultColorsType } from './utils/theme'\n\nexport {\n ChatContext,\n Conversations,\n OauthToken as OathToken,\n TemporaryDefaultColorsType,\n useCreateChatTheme,\n}\n"]}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { TextStyle, ViewStyle, ColorSchemeName } from 'react-native';
|
|
2
|
+
import { tapestryAliasTokensColorMap } from '../vendor/tapestry/tapestry_alias_tokens_color_map';
|
|
3
|
+
export interface ChatTheme extends DefaultTheme {
|
|
4
|
+
colors: DefaultTheme['colors'] & (typeof tapestryAliasTokensColorMap.light | typeof tapestryAliasTokensColorMap.dark);
|
|
5
|
+
}
|
|
6
|
+
/** =============================================
|
|
7
|
+
NOTE: The specific values for `colors` and the `productBadge` are temporary examples that can be replaced once we start building out UI. This line's comment can be removed at that time too.
|
|
8
|
+
|
|
9
|
+
The default theme is intended to support two types of customizations:
|
|
10
|
+
1. Specific color properties for a chat component (eg. `primaryButtonBackgroundColor`)
|
|
11
|
+
2. Any styles for a specific component. (Use only one level of nesting.)
|
|
12
|
+
```
|
|
13
|
+
primaryButton: {
|
|
14
|
+
container: ViewStyle
|
|
15
|
+
text: TextStyle
|
|
16
|
+
}
|
|
17
|
+
```
|
|
18
|
+
============================================= */
|
|
19
|
+
export interface DefaultTheme {
|
|
20
|
+
colors: ChatColors;
|
|
21
|
+
temporaryProductBadge: {
|
|
22
|
+
container: ViewStyle;
|
|
23
|
+
text: TextStyle;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export declare const defaultTheme: (colorScheme: ColorSchemeName) => DefaultTheme;
|
|
27
|
+
export type TemporaryDefaultColorsType = Partial<ChatColors>;
|
|
28
|
+
interface ChatColors {
|
|
29
|
+
name: string;
|
|
30
|
+
temporaryButtonBackgroundColor: string;
|
|
31
|
+
testColor: string;
|
|
32
|
+
}
|
|
33
|
+
export {};
|
|
34
|
+
//# sourceMappingURL=theme.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../src/utils/theme.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAEpE,OAAO,EAAE,2BAA2B,EAAE,MAAM,oDAAoD,CAAA;AAEhG,MAAM,WAAW,SAAU,SAAQ,YAAY;IAC7C,MAAM,EAAE,YAAY,CAAC,QAAQ,CAAC,GAC5B,CAAC,OAAO,2BAA2B,CAAC,KAAK,GAAG,OAAO,2BAA2B,CAAC,IAAI,CAAC,CAAA;CACvF;AAED;;;;;;;;;;;;gDAYgD;AAEhD,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,UAAU,CAAA;IAClB,qBAAqB,EAAE;QACrB,SAAS,EAAE,SAAS,CAAA;QACpB,IAAI,EAAE,SAAS,CAAA;KAChB,CAAA;CACF;AAED,eAAO,MAAM,YAAY,gBAAiB,eAAe,KAAG,YAgB3D,CAAA;AAED,MAAM,MAAM,0BAA0B,GAAG,OAAO,CAAC,UAAU,CAAC,CAAA;AAE5D,UAAU,UAAU;IAClB,IAAI,EAAE,MAAM,CAAA;IACZ,8BAA8B,EAAE,MAAM,CAAA;IACtC,SAAS,EAAE,MAAM,CAAA;CAClB"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { tokens } from '../vendor/tapestry/tokens';
|
|
2
|
+
import { tapestryAliasTokensColorMap } from '../vendor/tapestry/tapestry_alias_tokens_color_map';
|
|
3
|
+
export const defaultTheme = (colorScheme) => {
|
|
4
|
+
const scheme = colorScheme || 'light';
|
|
5
|
+
return {
|
|
6
|
+
colors: chatThemeColorMap[scheme],
|
|
7
|
+
temporaryProductBadge: {
|
|
8
|
+
container: {
|
|
9
|
+
paddingHorizontal: tokens.spacing1,
|
|
10
|
+
backgroundColor: tapestryAliasTokensColorMap[scheme].fillColorNeutral070,
|
|
11
|
+
borderWidth: tokens.borderSizeDefault,
|
|
12
|
+
},
|
|
13
|
+
text: {
|
|
14
|
+
textAlign: 'center',
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
const colorsChatLight = {
|
|
20
|
+
name: 'light',
|
|
21
|
+
temporaryButtonBackgroundColor: tokens.colorNeutral95,
|
|
22
|
+
testColor: 'red',
|
|
23
|
+
};
|
|
24
|
+
const colorsChatDark = {
|
|
25
|
+
name: 'dark',
|
|
26
|
+
temporaryButtonBackgroundColor: tokens.colorNeutral17,
|
|
27
|
+
testColor: 'blue',
|
|
28
|
+
};
|
|
29
|
+
const chatThemeColorMap = {
|
|
30
|
+
light: colorsChatLight,
|
|
31
|
+
dark: colorsChatDark,
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=theme.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme.js","sourceRoot":"","sources":["../../src/utils/theme.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAA;AAClD,OAAO,EAAE,2BAA2B,EAAE,MAAM,oDAAoD,CAAA;AA6BhG,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,WAA4B,EAAgB,EAAE;IACzE,MAAM,MAAM,GAAG,WAAW,IAAI,OAAO,CAAA;IAErC,OAAO;QACL,MAAM,EAAE,iBAAiB,CAAC,MAAM,CAAC;QACjC,qBAAqB,EAAE;YACrB,SAAS,EAAE;gBACT,iBAAiB,EAAE,MAAM,CAAC,QAAQ;gBAClC,eAAe,EAAE,2BAA2B,CAAC,MAAM,CAAC,CAAC,mBAAmB;gBACxE,WAAW,EAAE,MAAM,CAAC,iBAAiB;aACtC;YACD,IAAI,EAAE;gBACJ,SAAS,EAAE,QAAQ;aACpB;SACF;KACF,CAAA;AACH,CAAC,CAAA;AAUD,MAAM,eAAe,GAAe;IAClC,IAAI,EAAE,OAAO;IACb,8BAA8B,EAAE,MAAM,CAAC,cAAc;IACrD,SAAS,EAAE,KAAK;CACjB,CAAA;AAED,MAAM,cAAc,GAAe;IACjC,IAAI,EAAE,MAAM;IACZ,8BAA8B,EAAE,MAAM,CAAC,cAAc;IACrD,SAAS,EAAE,MAAM;CAClB,CAAA;AAED,MAAM,iBAAiB,GAAG;IACxB,KAAK,EAAE,eAAe;IACtB,IAAI,EAAE,cAAc;CACrB,CAAA","sourcesContent":["import { TextStyle, ViewStyle, ColorSchemeName } from 'react-native'\nimport { tokens } from '../vendor/tapestry/tokens'\nimport { tapestryAliasTokensColorMap } from '../vendor/tapestry/tapestry_alias_tokens_color_map'\n\nexport interface ChatTheme extends DefaultTheme {\n colors: DefaultTheme['colors'] &\n (typeof tapestryAliasTokensColorMap.light | typeof tapestryAliasTokensColorMap.dark)\n}\n\n/** =============================================\n NOTE: The specific values for `colors` and the `productBadge` are temporary examples that can be replaced once we start building out UI. This line's comment can be removed at that time too.\n\n The default theme is intended to support two types of customizations:\n 1. Specific color properties for a chat component (eg. `primaryButtonBackgroundColor`)\n 2. Any styles for a specific component. (Use only one level of nesting.)\n ```\n primaryButton: {\n container: ViewStyle\n text: TextStyle\n }\n ```\n============================================= */\n\nexport interface DefaultTheme {\n colors: ChatColors\n temporaryProductBadge: {\n container: ViewStyle\n text: TextStyle\n }\n}\n\nexport const defaultTheme = (colorScheme: ColorSchemeName): DefaultTheme => {\n const scheme = colorScheme || 'light'\n\n return {\n colors: chatThemeColorMap[scheme],\n temporaryProductBadge: {\n container: {\n paddingHorizontal: tokens.spacing1,\n backgroundColor: tapestryAliasTokensColorMap[scheme].fillColorNeutral070,\n borderWidth: tokens.borderSizeDefault,\n },\n text: {\n textAlign: 'center',\n },\n },\n }\n}\n\nexport type TemporaryDefaultColorsType = Partial<ChatColors>\n\ninterface ChatColors {\n name: string\n temporaryButtonBackgroundColor: string\n testColor: string\n}\n\nconst colorsChatLight: ChatColors = {\n name: 'light',\n temporaryButtonBackgroundColor: tokens.colorNeutral95,\n testColor: 'red',\n}\n\nconst colorsChatDark: ChatColors = {\n name: 'dark',\n temporaryButtonBackgroundColor: tokens.colorNeutral17,\n testColor: 'blue',\n}\n\nconst chatThemeColorMap = {\n light: colorsChatLight,\n dark: colorsChatDark,\n}\n"]}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export declare const tapestryAliasTokensColorMap: {
|
|
2
|
+
light: {
|
|
3
|
+
name: string;
|
|
4
|
+
iconColorDefaultPrimary: string;
|
|
5
|
+
iconColorDefaultSecondary: string;
|
|
6
|
+
iconColorDefaultDim: string;
|
|
7
|
+
iconColorDefaultDisabled: string;
|
|
8
|
+
iconColorDefaultInverted: string;
|
|
9
|
+
fillColorNeutral000: string;
|
|
10
|
+
fillColorNeutral010: string;
|
|
11
|
+
fillColorNeutral020: string;
|
|
12
|
+
fillColorNeutral030: string;
|
|
13
|
+
fillColorNeutral040: string;
|
|
14
|
+
fillColorNeutral050Base: string;
|
|
15
|
+
fillColorNeutral060: string;
|
|
16
|
+
fillColorNeutral070: string;
|
|
17
|
+
fillColorNeutral080: string;
|
|
18
|
+
fillColorNeutral090: string;
|
|
19
|
+
fillColorNeutral100Inverted: string;
|
|
20
|
+
};
|
|
21
|
+
dark: {
|
|
22
|
+
name: string;
|
|
23
|
+
iconColorDefaultPrimary: string;
|
|
24
|
+
iconColorDefaultSecondary: string;
|
|
25
|
+
iconColorDefaultDim: string;
|
|
26
|
+
iconColorDefaultDisabled: string;
|
|
27
|
+
iconColorDefaultInverted: string;
|
|
28
|
+
fillColorNeutral000: string;
|
|
29
|
+
fillColorNeutral010: string;
|
|
30
|
+
fillColorNeutral020: string;
|
|
31
|
+
fillColorNeutral030: string;
|
|
32
|
+
fillColorNeutral040: string;
|
|
33
|
+
fillColorNeutral050Base: string;
|
|
34
|
+
fillColorNeutral060: string;
|
|
35
|
+
fillColorNeutral070: string;
|
|
36
|
+
fillColorNeutral080: string;
|
|
37
|
+
fillColorNeutral090: string;
|
|
38
|
+
fillColorNeutral100Inverted: string;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=tapestry_alias_tokens_color_map.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tapestry_alias_tokens_color_map.d.ts","sourceRoot":"","sources":["../../../src/vendor/tapestry/tapestry_alias_tokens_color_map.ts"],"names":[],"mappings":"AA8EA,eAAO,MAAM,2BAA2B;;cA1BhC,MAAM;iCACa,MAAM;mCACJ,MAAM;6BACZ,MAAM;kCACD,MAAM;kCACN,MAAM;6BAjDX,MAAM;6BACN,MAAM;6BACN,MAAM;6BACN,MAAM;6BACN,MAAM;iCACF,MAAM;6BACV,MAAM;6BACN,MAAM;6BACN,MAAM;6BACN,MAAM;qCACE,MAAM;;;cAkC7B,MAAM;iCACa,MAAM;mCACJ,MAAM;6BACZ,MAAM;kCACD,MAAM;kCACN,MAAM;6BAjDX,MAAM;6BACN,MAAM;6BACN,MAAM;6BACN,MAAM;6BACN,MAAM;iCACF,MAAM;6BACV,MAAM;6BACN,MAAM;6BACN,MAAM;6BACN,MAAM;qCACE,MAAM;;CA+DpC,CAAA"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { tokens } from './tokens';
|
|
2
|
+
const neutralsLight = {
|
|
3
|
+
name: 'light',
|
|
4
|
+
fillColorNeutral000: tokens.colorNeutral12,
|
|
5
|
+
fillColorNeutral010: tokens.colorNeutral24,
|
|
6
|
+
fillColorNeutral020: tokens.colorNeutral45,
|
|
7
|
+
fillColorNeutral030: tokens.colorNeutral58,
|
|
8
|
+
fillColorNeutral040: tokens.colorNeutral81,
|
|
9
|
+
fillColorNeutral050Base: tokens.colorNeutral88,
|
|
10
|
+
fillColorNeutral060: tokens.colorNeutral93,
|
|
11
|
+
fillColorNeutral070: tokens.colorNeutral95,
|
|
12
|
+
fillColorNeutral080: tokens.colorNeutral97,
|
|
13
|
+
fillColorNeutral090: tokens.colorNeutral98,
|
|
14
|
+
fillColorNeutral100Inverted: tokens.colorNeutral100White,
|
|
15
|
+
};
|
|
16
|
+
const neutralsDark = {
|
|
17
|
+
name: 'dark',
|
|
18
|
+
fillColorNeutral000: tokens.colorNeutral98,
|
|
19
|
+
fillColorNeutral010: tokens.colorNeutral88,
|
|
20
|
+
fillColorNeutral020: tokens.colorNeutral68,
|
|
21
|
+
fillColorNeutral030: tokens.colorNeutral50,
|
|
22
|
+
fillColorNeutral040: tokens.colorNeutral32,
|
|
23
|
+
fillColorNeutral050Base: tokens.colorNeutral24,
|
|
24
|
+
fillColorNeutral060: tokens.colorNeutral19,
|
|
25
|
+
fillColorNeutral070: tokens.colorNeutral17,
|
|
26
|
+
fillColorNeutral080: tokens.colorNeutral15,
|
|
27
|
+
fillColorNeutral090: tokens.colorNeutral12,
|
|
28
|
+
fillColorNeutral100Inverted: tokens.colorNeutral7,
|
|
29
|
+
};
|
|
30
|
+
const semanticAliasesLight = {
|
|
31
|
+
name: 'light',
|
|
32
|
+
iconColorDefaultPrimary: neutralsLight.fillColorNeutral010,
|
|
33
|
+
iconColorDefaultSecondary: neutralsLight.fillColorNeutral020,
|
|
34
|
+
iconColorDefaultDim: neutralsLight.fillColorNeutral030,
|
|
35
|
+
iconColorDefaultDisabled: neutralsLight.fillColorNeutral040,
|
|
36
|
+
iconColorDefaultInverted: neutralsLight.fillColorNeutral100Inverted,
|
|
37
|
+
};
|
|
38
|
+
const semanticAliasesDark = {
|
|
39
|
+
name: 'dark',
|
|
40
|
+
iconColorDefaultPrimary: neutralsDark.fillColorNeutral010,
|
|
41
|
+
iconColorDefaultSecondary: neutralsDark.fillColorNeutral020,
|
|
42
|
+
iconColorDefaultDim: neutralsDark.fillColorNeutral030,
|
|
43
|
+
iconColorDefaultDisabled: neutralsDark.fillColorNeutral040,
|
|
44
|
+
iconColorDefaultInverted: neutralsDark.fillColorNeutral100Inverted,
|
|
45
|
+
};
|
|
46
|
+
export const tapestryAliasTokensColorMap = {
|
|
47
|
+
light: { ...neutralsLight, ...semanticAliasesLight },
|
|
48
|
+
dark: { ...neutralsDark, ...semanticAliasesDark },
|
|
49
|
+
};
|
|
50
|
+
//# sourceMappingURL=tapestry_alias_tokens_color_map.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tapestry_alias_tokens_color_map.js","sourceRoot":"","sources":["../../../src/vendor/tapestry/tapestry_alias_tokens_color_map.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAqBjC,MAAM,aAAa,GAAkB;IACnC,IAAI,EAAE,OAAO;IACb,mBAAmB,EAAE,MAAM,CAAC,cAAc;IAC1C,mBAAmB,EAAE,MAAM,CAAC,cAAc;IAC1C,mBAAmB,EAAE,MAAM,CAAC,cAAc;IAC1C,mBAAmB,EAAE,MAAM,CAAC,cAAc;IAC1C,mBAAmB,EAAE,MAAM,CAAC,cAAc;IAC1C,uBAAuB,EAAE,MAAM,CAAC,cAAc;IAC9C,mBAAmB,EAAE,MAAM,CAAC,cAAc;IAC1C,mBAAmB,EAAE,MAAM,CAAC,cAAc;IAC1C,mBAAmB,EAAE,MAAM,CAAC,cAAc;IAC1C,mBAAmB,EAAE,MAAM,CAAC,cAAc;IAC1C,2BAA2B,EAAE,MAAM,CAAC,oBAAoB;CACzD,CAAA;AAED,MAAM,YAAY,GAAkB;IAClC,IAAI,EAAE,MAAM;IACZ,mBAAmB,EAAE,MAAM,CAAC,cAAc;IAC1C,mBAAmB,EAAE,MAAM,CAAC,cAAc;IAC1C,mBAAmB,EAAE,MAAM,CAAC,cAAc;IAC1C,mBAAmB,EAAE,MAAM,CAAC,cAAc;IAC1C,mBAAmB,EAAE,MAAM,CAAC,cAAc;IAC1C,uBAAuB,EAAE,MAAM,CAAC,cAAc;IAC9C,mBAAmB,EAAE,MAAM,CAAC,cAAc;IAC1C,mBAAmB,EAAE,MAAM,CAAC,cAAc;IAC1C,mBAAmB,EAAE,MAAM,CAAC,cAAc;IAC1C,mBAAmB,EAAE,MAAM,CAAC,cAAc;IAC1C,2BAA2B,EAAE,MAAM,CAAC,aAAa;CAClD,CAAA;AAWD,MAAM,oBAAoB,GAA0B;IAClD,IAAI,EAAE,OAAO;IACb,uBAAuB,EAAE,aAAa,CAAC,mBAAmB;IAC1D,yBAAyB,EAAE,aAAa,CAAC,mBAAmB;IAC5D,mBAAmB,EAAE,aAAa,CAAC,mBAAmB;IACtD,wBAAwB,EAAE,aAAa,CAAC,mBAAmB;IAC3D,wBAAwB,EAAE,aAAa,CAAC,2BAA2B;CACpE,CAAA;AAED,MAAM,mBAAmB,GAA0B;IACjD,IAAI,EAAE,MAAM;IACZ,uBAAuB,EAAE,YAAY,CAAC,mBAAmB;IACzD,yBAAyB,EAAE,YAAY,CAAC,mBAAmB;IAC3D,mBAAmB,EAAE,YAAY,CAAC,mBAAmB;IACrD,wBAAwB,EAAE,YAAY,CAAC,mBAAmB;IAC1D,wBAAwB,EAAE,YAAY,CAAC,2BAA2B;CACnE,CAAA;AAED,MAAM,CAAC,MAAM,2BAA2B,GAAG;IACzC,KAAK,EAAE,EAAE,GAAG,aAAa,EAAE,GAAG,oBAAoB,EAAE;IACpD,IAAI,EAAE,EAAE,GAAG,YAAY,EAAE,GAAG,mBAAmB,EAAE;CAClD,CAAA","sourcesContent":["import { tokens } from './tokens'\n\n// Copied from `@planningcenter/tapestry` package.\n// Defining these tokens locally is a temporary solution until the package supports mobile.\n// Tokens Reference: https://planningcenter.github.io/tapestry/?path=/docs/foundations-design-tokens--docs\n\ninterface NeutralColors {\n name: string\n fillColorNeutral000: string\n fillColorNeutral010: string\n fillColorNeutral020: string\n fillColorNeutral030: string\n fillColorNeutral040: string\n fillColorNeutral050Base: string\n fillColorNeutral060: string\n fillColorNeutral070: string\n fillColorNeutral080: string\n fillColorNeutral090: string\n fillColorNeutral100Inverted: string\n}\n\nconst neutralsLight: NeutralColors = {\n name: 'light',\n fillColorNeutral000: tokens.colorNeutral12,\n fillColorNeutral010: tokens.colorNeutral24,\n fillColorNeutral020: tokens.colorNeutral45,\n fillColorNeutral030: tokens.colorNeutral58,\n fillColorNeutral040: tokens.colorNeutral81,\n fillColorNeutral050Base: tokens.colorNeutral88,\n fillColorNeutral060: tokens.colorNeutral93,\n fillColorNeutral070: tokens.colorNeutral95,\n fillColorNeutral080: tokens.colorNeutral97,\n fillColorNeutral090: tokens.colorNeutral98,\n fillColorNeutral100Inverted: tokens.colorNeutral100White,\n}\n\nconst neutralsDark: NeutralColors = {\n name: 'dark',\n fillColorNeutral000: tokens.colorNeutral98,\n fillColorNeutral010: tokens.colorNeutral88,\n fillColorNeutral020: tokens.colorNeutral68,\n fillColorNeutral030: tokens.colorNeutral50,\n fillColorNeutral040: tokens.colorNeutral32,\n fillColorNeutral050Base: tokens.colorNeutral24,\n fillColorNeutral060: tokens.colorNeutral19,\n fillColorNeutral070: tokens.colorNeutral17,\n fillColorNeutral080: tokens.colorNeutral15,\n fillColorNeutral090: tokens.colorNeutral12,\n fillColorNeutral100Inverted: tokens.colorNeutral7,\n}\n\ninterface SemanticAliasesColors {\n name: string\n iconColorDefaultPrimary: string\n iconColorDefaultSecondary: string\n iconColorDefaultDim: string\n iconColorDefaultDisabled: string\n iconColorDefaultInverted: string\n}\n\nconst semanticAliasesLight: SemanticAliasesColors = {\n name: 'light',\n iconColorDefaultPrimary: neutralsLight.fillColorNeutral010,\n iconColorDefaultSecondary: neutralsLight.fillColorNeutral020,\n iconColorDefaultDim: neutralsLight.fillColorNeutral030,\n iconColorDefaultDisabled: neutralsLight.fillColorNeutral040,\n iconColorDefaultInverted: neutralsLight.fillColorNeutral100Inverted,\n}\n\nconst semanticAliasesDark: SemanticAliasesColors = {\n name: 'dark',\n iconColorDefaultPrimary: neutralsDark.fillColorNeutral010,\n iconColorDefaultSecondary: neutralsDark.fillColorNeutral020,\n iconColorDefaultDim: neutralsDark.fillColorNeutral030,\n iconColorDefaultDisabled: neutralsDark.fillColorNeutral040,\n iconColorDefaultInverted: neutralsDark.fillColorNeutral100Inverted,\n}\n\nexport const tapestryAliasTokensColorMap = {\n light: { ...neutralsLight, ...semanticAliasesLight },\n dark: { ...neutralsDark, ...semanticAliasesDark },\n}\n"]}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export declare const tokens: {
|
|
2
|
+
borderRadiusDefault: number;
|
|
3
|
+
spacingFourth: number;
|
|
4
|
+
spacingHalf: number;
|
|
5
|
+
spacing1: number;
|
|
6
|
+
spacing2: number;
|
|
7
|
+
spacing3: number;
|
|
8
|
+
spacing4: number;
|
|
9
|
+
spacing5: number;
|
|
10
|
+
spacing6: number;
|
|
11
|
+
spacing7: number;
|
|
12
|
+
borderRadiusSm: number;
|
|
13
|
+
borderRadiusMd: number;
|
|
14
|
+
borderRadiusLg: number;
|
|
15
|
+
borderRadiusXl: number;
|
|
16
|
+
borderRadiusRound: number;
|
|
17
|
+
borderSizeDefault: number;
|
|
18
|
+
borderSizeThick: number;
|
|
19
|
+
colorNeutral7: string;
|
|
20
|
+
colorNeutral12: string;
|
|
21
|
+
colorNeutral15: string;
|
|
22
|
+
colorNeutral17: string;
|
|
23
|
+
colorNeutral19: string;
|
|
24
|
+
colorNeutral24: string;
|
|
25
|
+
colorNeutral32: string;
|
|
26
|
+
colorNeutral45: string;
|
|
27
|
+
colorNeutral50: string;
|
|
28
|
+
colorNeutral58: string;
|
|
29
|
+
colorNeutral68: string;
|
|
30
|
+
colorNeutral81: string;
|
|
31
|
+
colorNeutral88: string;
|
|
32
|
+
colorNeutral93: string;
|
|
33
|
+
colorNeutral95: string;
|
|
34
|
+
colorNeutral97: string;
|
|
35
|
+
colorNeutral98: string;
|
|
36
|
+
colorNeutral100White: string;
|
|
37
|
+
};
|
|
38
|
+
//# sourceMappingURL=tokens.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../../../src/vendor/tapestry/tokens.ts"],"names":[],"mappings":"AA4FA,eAAO,MAAM,MAAM;yBAPI,MAAM;mBAtCZ,MAAM;iBACR,MAAM;cACT,MAAM;cACN,MAAM;cACN,MAAM;cACN,MAAM;cACN,MAAM;cACN,MAAM;cACN,MAAM;oBACA,MAAM;oBACN,MAAM;oBACN,MAAM;oBACN,MAAM;uBACH,MAAM;uBACN,MAAM;qBACR,MAAM;mBAzDR,MAAM;oBACL,MAAM;oBACN,MAAM;oBACN,MAAM;oBACN,MAAM;oBACN,MAAM;oBACN,MAAM;oBACN,MAAM;oBACN,MAAM;oBACN,MAAM;oBACN,MAAM;oBACN,MAAM;oBACN,MAAM;oBACN,MAAM;oBACN,MAAM;oBACN,MAAM;oBACN,MAAM;0BACA,MAAM;CA0E7B,CAAA"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
// Copied from `@planningcenter/tapestry` package.
|
|
2
|
+
// Defining these tokens locally is a temporary solution until the package supports mobile.
|
|
3
|
+
// Tokens Reference: https://planningcenter.github.io/tapestry/?path=/docs/foundations-design-tokens--docs
|
|
4
|
+
const colorPrimitives = {
|
|
5
|
+
colorNeutral7: 'hsl(0, 0%, 7%)',
|
|
6
|
+
colorNeutral12: 'hsl(0, 0%, 12%)',
|
|
7
|
+
colorNeutral15: 'hsl(0, 0%, 15%)',
|
|
8
|
+
colorNeutral17: 'hsl(0, 0%, 17%)',
|
|
9
|
+
colorNeutral19: 'hsl(0, 0%, 19%)',
|
|
10
|
+
colorNeutral24: 'hsl(0, 0%, 24%)',
|
|
11
|
+
colorNeutral32: 'hsl(0, 0%, 32%)',
|
|
12
|
+
colorNeutral45: 'hsl(0, 0%, 45%)',
|
|
13
|
+
colorNeutral50: 'hsl(0, 0%, 50%)',
|
|
14
|
+
colorNeutral58: 'hsl(0, 0%, 58%)',
|
|
15
|
+
colorNeutral68: 'hsl(0, 0%, 68%)',
|
|
16
|
+
colorNeutral81: 'hsl(0, 0%, 81%)',
|
|
17
|
+
colorNeutral88: 'hsl(0, 0%, 88%)',
|
|
18
|
+
colorNeutral93: 'hsl(0, 0%, 93%)',
|
|
19
|
+
colorNeutral95: 'hsl(0, 0%, 95%)',
|
|
20
|
+
colorNeutral97: 'hsl(0, 0%, 97%)',
|
|
21
|
+
colorNeutral98: 'hsl(0, 0%, 98%)',
|
|
22
|
+
colorNeutral100White: 'hsl(0, 0%, 100%)',
|
|
23
|
+
};
|
|
24
|
+
const numericPrimtives = {
|
|
25
|
+
spacingFourth: 2,
|
|
26
|
+
spacingHalf: 4,
|
|
27
|
+
spacing1: 8,
|
|
28
|
+
spacing2: 16,
|
|
29
|
+
spacing3: 24,
|
|
30
|
+
spacing4: 32,
|
|
31
|
+
spacing5: 40,
|
|
32
|
+
spacing6: 48,
|
|
33
|
+
spacing7: 56,
|
|
34
|
+
borderRadiusSm: 2,
|
|
35
|
+
borderRadiusMd: 4,
|
|
36
|
+
borderRadiusLg: 8,
|
|
37
|
+
borderRadiusXl: 16,
|
|
38
|
+
borderRadiusRound: 56,
|
|
39
|
+
borderSizeDefault: 1,
|
|
40
|
+
borderSizeThick: 2,
|
|
41
|
+
};
|
|
42
|
+
const numericAliases = {
|
|
43
|
+
borderRadiusDefault: numericPrimtives.borderRadiusMd,
|
|
44
|
+
};
|
|
45
|
+
export const tokens = {
|
|
46
|
+
...colorPrimitives,
|
|
47
|
+
...numericPrimtives,
|
|
48
|
+
...numericAliases,
|
|
49
|
+
};
|
|
50
|
+
//# sourceMappingURL=tokens.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tokens.js","sourceRoot":"","sources":["../../../src/vendor/tapestry/tokens.ts"],"names":[],"mappings":"AAAA,kDAAkD;AAClD,2FAA2F;AAC3F,0GAA0G;AAuB1G,MAAM,eAAe,GAAmB;IACtC,aAAa,EAAE,gBAAgB;IAC/B,cAAc,EAAE,iBAAiB;IACjC,cAAc,EAAE,iBAAiB;IACjC,cAAc,EAAE,iBAAiB;IACjC,cAAc,EAAE,iBAAiB;IACjC,cAAc,EAAE,iBAAiB;IACjC,cAAc,EAAE,iBAAiB;IACjC,cAAc,EAAE,iBAAiB;IACjC,cAAc,EAAE,iBAAiB;IACjC,cAAc,EAAE,iBAAiB;IACjC,cAAc,EAAE,iBAAiB;IACjC,cAAc,EAAE,iBAAiB;IACjC,cAAc,EAAE,iBAAiB;IACjC,cAAc,EAAE,iBAAiB;IACjC,cAAc,EAAE,iBAAiB;IACjC,cAAc,EAAE,iBAAiB;IACjC,cAAc,EAAE,iBAAiB;IACjC,oBAAoB,EAAE,kBAAkB;CACzC,CAAA;AAqBD,MAAM,gBAAgB,GAAsB;IAC1C,aAAa,EAAE,CAAC;IAChB,WAAW,EAAE,CAAC;IACd,QAAQ,EAAE,CAAC;IACX,QAAQ,EAAE,EAAE;IACZ,QAAQ,EAAE,EAAE;IACZ,QAAQ,EAAE,EAAE;IACZ,QAAQ,EAAE,EAAE;IACZ,QAAQ,EAAE,EAAE;IACZ,QAAQ,EAAE,EAAE;IACZ,cAAc,EAAE,CAAC;IACjB,cAAc,EAAE,CAAC;IACjB,cAAc,EAAE,CAAC;IACjB,cAAc,EAAE,EAAE;IAClB,iBAAiB,EAAE,EAAE;IACrB,iBAAiB,EAAE,CAAC;IACpB,eAAe,EAAE,CAAC;CACnB,CAAA;AAMD,MAAM,cAAc,GAAmB;IACrC,mBAAmB,EAAE,gBAAgB,CAAC,cAAc;CACrD,CAAA;AAED,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,GAAG,eAAe;IAClB,GAAG,gBAAgB;IACnB,GAAG,cAAc;CAClB,CAAA","sourcesContent":["// Copied from `@planningcenter/tapestry` package.\n// Defining these tokens locally is a temporary solution until the package supports mobile.\n// Tokens Reference: https://planningcenter.github.io/tapestry/?path=/docs/foundations-design-tokens--docs\n\ninterface ColorPrimitves {\n colorNeutral7: string\n colorNeutral12: string\n colorNeutral15: string\n colorNeutral17: string\n colorNeutral19: string\n colorNeutral24: string\n colorNeutral32: string\n colorNeutral45: string\n colorNeutral50: string\n colorNeutral58: string\n colorNeutral68: string\n colorNeutral81: string\n colorNeutral88: string\n colorNeutral93: string\n colorNeutral95: string\n colorNeutral97: string\n colorNeutral98: string\n colorNeutral100White: string\n}\n\nconst colorPrimitives: ColorPrimitves = {\n colorNeutral7: 'hsl(0, 0%, 7%)',\n colorNeutral12: 'hsl(0, 0%, 12%)',\n colorNeutral15: 'hsl(0, 0%, 15%)',\n colorNeutral17: 'hsl(0, 0%, 17%)',\n colorNeutral19: 'hsl(0, 0%, 19%)',\n colorNeutral24: 'hsl(0, 0%, 24%)',\n colorNeutral32: 'hsl(0, 0%, 32%)',\n colorNeutral45: 'hsl(0, 0%, 45%)',\n colorNeutral50: 'hsl(0, 0%, 50%)',\n colorNeutral58: 'hsl(0, 0%, 58%)',\n colorNeutral68: 'hsl(0, 0%, 68%)',\n colorNeutral81: 'hsl(0, 0%, 81%)',\n colorNeutral88: 'hsl(0, 0%, 88%)',\n colorNeutral93: 'hsl(0, 0%, 93%)',\n colorNeutral95: 'hsl(0, 0%, 95%)',\n colorNeutral97: 'hsl(0, 0%, 97%)',\n colorNeutral98: 'hsl(0, 0%, 98%)',\n colorNeutral100White: 'hsl(0, 0%, 100%)',\n}\n\ninterface NumericPrimitives {\n spacingFourth: number\n spacingHalf: number\n spacing1: number\n spacing2: number\n spacing3: number\n spacing4: number\n spacing5: number\n spacing6: number\n spacing7: number\n borderRadiusSm: number\n borderRadiusMd: number\n borderRadiusLg: number\n borderRadiusXl: number\n borderRadiusRound: number\n borderSizeDefault: number\n borderSizeThick: number\n}\n\nconst numericPrimtives: NumericPrimitives = {\n spacingFourth: 2,\n spacingHalf: 4,\n spacing1: 8,\n spacing2: 16,\n spacing3: 24,\n spacing4: 32,\n spacing5: 40,\n spacing6: 48,\n spacing7: 56,\n borderRadiusSm: 2,\n borderRadiusMd: 4,\n borderRadiusLg: 8,\n borderRadiusXl: 16,\n borderRadiusRound: 56,\n borderSizeDefault: 1,\n borderSizeThick: 2,\n}\n\ninterface NumericAliases {\n borderRadiusDefault: number\n}\n\nconst numericAliases: NumericAliases = {\n borderRadiusDefault: numericPrimtives.borderRadiusMd,\n}\n\nexport const tokens = {\n ...colorPrimitives,\n ...numericPrimtives,\n ...numericAliases,\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@planningcenter/chat-react-native",
|
|
3
|
-
"version": "1.3.0-rc.
|
|
3
|
+
"version": "1.3.0-rc.5",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -13,15 +13,19 @@
|
|
|
13
13
|
"prepublishOnly": "expo-module prepublishOnly"
|
|
14
14
|
},
|
|
15
15
|
"peerDependencies": {
|
|
16
|
+
"@tanstack/react-query": "^5.0.0",
|
|
17
|
+
"lodash": "*",
|
|
16
18
|
"react": "*",
|
|
17
19
|
"react-native": "*"
|
|
18
20
|
},
|
|
19
21
|
"devDependencies": {
|
|
20
22
|
"@react-native/eslint-config": "^0.77.0",
|
|
23
|
+
"@tanstack/react-query": "^5.66.0",
|
|
21
24
|
"@typescript-eslint/parser": "^8.23.0",
|
|
22
25
|
"expo-module-scripts": "^3.4.0",
|
|
26
|
+
"lodash": "^4.17.21",
|
|
23
27
|
"prettier": "^3.4.2",
|
|
24
28
|
"react-native": "0.74.5"
|
|
25
29
|
},
|
|
26
|
-
"gitHead": "
|
|
30
|
+
"gitHead": "b0ba2e1902e5749a90ccf1aaa0a925d80b712285"
|
|
27
31
|
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { useSuspenseQuery } from '@tanstack/react-query'
|
|
2
|
+
import React, { Suspense, useContext } from 'react'
|
|
3
|
+
import { FlatList, StyleSheet, Text } from 'react-native'
|
|
4
|
+
import { ChatContext } from '../contexts/chat_context'
|
|
5
|
+
import { ConversationRecord } from '../types'
|
|
6
|
+
import ErrorBoundary from './error_boundary'
|
|
7
|
+
import { useTheme } from '../hooks/use_theme'
|
|
8
|
+
|
|
9
|
+
type ConversationsResponse = {
|
|
10
|
+
data: ConversationRecord[]
|
|
11
|
+
links: Record<string, string>
|
|
12
|
+
meta: Record<string, string>
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function Conversations() {
|
|
16
|
+
return (
|
|
17
|
+
<ErrorBoundary>
|
|
18
|
+
<Suspense fallback={<></>}>
|
|
19
|
+
<Loaded />
|
|
20
|
+
</Suspense>
|
|
21
|
+
</ErrorBoundary>
|
|
22
|
+
)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const Loaded = () => {
|
|
26
|
+
const { token, onTokenExpired } = useContext(ChatContext)
|
|
27
|
+
const styles = useStyles()
|
|
28
|
+
const { data: conversations } = useSuspenseQuery<ConversationsResponse>({
|
|
29
|
+
queryKey: ['conversations', token],
|
|
30
|
+
queryFn: () =>
|
|
31
|
+
// TODO: replace with an api client
|
|
32
|
+
fetch('https://api.planningcenteronline.com/chat/v2/me/conversations', {
|
|
33
|
+
headers: {
|
|
34
|
+
Authorization: `Bearer ${token?.access_token}`,
|
|
35
|
+
},
|
|
36
|
+
})
|
|
37
|
+
.then(validateResponse)
|
|
38
|
+
.then(response => response.json())
|
|
39
|
+
.catch(error => {
|
|
40
|
+
if (error.message === 'Token expired') {
|
|
41
|
+
onTokenExpired()
|
|
42
|
+
}
|
|
43
|
+
return null
|
|
44
|
+
}),
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<FlatList
|
|
49
|
+
data={conversations?.data}
|
|
50
|
+
ListEmptyComponent={<Text>No conversations</Text>}
|
|
51
|
+
contentContainerStyle={styles.container}
|
|
52
|
+
ListHeaderComponent={<Text style={styles.foo}>Conversations</Text>}
|
|
53
|
+
renderItem={({ item }) => <Text style={styles.listItem}>{item.attributes.title}</Text>}
|
|
54
|
+
/>
|
|
55
|
+
)
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const useStyles = () => {
|
|
59
|
+
const { colors } = useTheme()
|
|
60
|
+
|
|
61
|
+
return StyleSheet.create({
|
|
62
|
+
container: { columnGap: 16, backgroundColor: colors.fillColorNeutral080 },
|
|
63
|
+
foo: { fontSize: 24, color: colors.testColor },
|
|
64
|
+
listItem: { color: colors.fillColorNeutral020 },
|
|
65
|
+
})
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const validateResponse = (response: Response) => {
|
|
69
|
+
const isExpired = response.status === 401
|
|
70
|
+
if (isExpired) {
|
|
71
|
+
throw new Error('Token expired')
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return response
|
|
75
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React, { PropsWithChildren } from 'react'
|
|
2
|
+
import { Text } from 'react-native'
|
|
3
|
+
|
|
4
|
+
class ErrorBoundary extends React.Component<PropsWithChildren<{}>> {
|
|
5
|
+
state = {
|
|
6
|
+
error: null,
|
|
7
|
+
unsubscriber: () => {},
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
componentDidCatch(error: any) {
|
|
11
|
+
this.handleError(error)
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
handleError(error: any) {
|
|
15
|
+
this.setState({ error })
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
render() {
|
|
19
|
+
if (this.state.error) {
|
|
20
|
+
return <Text>{JSON.stringify(this.state.error, null, 2)}</Text>
|
|
21
|
+
} else {
|
|
22
|
+
return this.props.children
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export default ErrorBoundary
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { createContext } from 'react'
|
|
2
|
+
import { OauthToken } from '../types'
|
|
3
|
+
|
|
4
|
+
type ContextValue = {
|
|
5
|
+
token: OauthToken | null
|
|
6
|
+
onTokenExpired: () => void
|
|
7
|
+
theme: any
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const ChatContext = createContext<ContextValue>({
|
|
11
|
+
theme: null,
|
|
12
|
+
token: null,
|
|
13
|
+
onTokenExpired: () => {},
|
|
14
|
+
})
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { useMemo } from 'react'
|
|
2
|
+
import { useColorScheme, ColorSchemeName } from 'react-native'
|
|
3
|
+
import { defaultTheme, DefaultTheme } from '../utils/theme'
|
|
4
|
+
import { DeepPartial } from '../types'
|
|
5
|
+
import { tapestryAliasTokensColorMap } from '../vendor/tapestry/tapestry_alias_tokens_color_map'
|
|
6
|
+
import { merge } from 'lodash'
|
|
7
|
+
|
|
8
|
+
interface CreateChatThemeProps {
|
|
9
|
+
theme?: DeepPartial<DefaultTheme>
|
|
10
|
+
colorScheme?: ColorSchemeName
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const useCreateChatTheme = ({
|
|
14
|
+
theme: customTheme = {},
|
|
15
|
+
colorScheme: appColorScheme,
|
|
16
|
+
}: CreateChatThemeProps) => {
|
|
17
|
+
const internalColorScheme = useColorScheme() || 'light'
|
|
18
|
+
const colorScheme = appColorScheme || internalColorScheme
|
|
19
|
+
|
|
20
|
+
const memoizedTheme = useMemo(() => {
|
|
21
|
+
return {
|
|
22
|
+
...merge({}, defaultTheme(colorScheme), customTheme),
|
|
23
|
+
colors: {
|
|
24
|
+
...merge({}, defaultTheme(colorScheme).colors, customTheme?.colors),
|
|
25
|
+
...tapestryAliasTokensColorMap[colorScheme],
|
|
26
|
+
},
|
|
27
|
+
}
|
|
28
|
+
}, [colorScheme, customTheme])
|
|
29
|
+
|
|
30
|
+
return memoizedTheme
|
|
31
|
+
}
|
package/src/index.tsx
CHANGED
|
@@ -1,59 +1,13 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
useEffect(() => {
|
|
15
|
-
if (!token) {
|
|
16
|
-
return
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
fetch('https://api.planningcenteronline.com/chat/v2/me/conversations', {
|
|
20
|
-
headers: {
|
|
21
|
-
Authorization: `Bearer ${token.access_token}`,
|
|
22
|
-
},
|
|
23
|
-
})
|
|
24
|
-
.then(validateResponse)
|
|
25
|
-
.then(response => response.json())
|
|
26
|
-
.then(setConversations)
|
|
27
|
-
.catch(error => {
|
|
28
|
-
if (error.message === 'Token expired') {
|
|
29
|
-
onTokenExpired()
|
|
30
|
-
}
|
|
31
|
-
})
|
|
32
|
-
}, [onTokenExpired, token])
|
|
33
|
-
|
|
34
|
-
return (
|
|
35
|
-
<FlatList
|
|
36
|
-
data={conversations?.data}
|
|
37
|
-
ListEmptyComponent={<Text>No conversations</Text>}
|
|
38
|
-
contentContainerStyle={styles.container}
|
|
39
|
-
ListHeaderComponent={<Text style={styles.foo}>Conversations</Text>}
|
|
40
|
-
renderItem={({ item }) => <Text>{item.attributes.title}</Text>}
|
|
41
|
-
/>
|
|
42
|
-
)
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
const useStyles = () => {
|
|
46
|
-
return StyleSheet.create({
|
|
47
|
-
container: { columnGap: 16 },
|
|
48
|
-
foo: { fontSize: 24 },
|
|
49
|
-
})
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
const validateResponse = (response: Response) => {
|
|
53
|
-
const isExpired = response.status === 401
|
|
54
|
-
if (isExpired) {
|
|
55
|
-
throw new Error('Token expired')
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
return response
|
|
1
|
+
import { Conversations } from './components/conversations'
|
|
2
|
+
import { ChatContext } from './contexts/chat_context'
|
|
3
|
+
import { useCreateChatTheme } from './hooks/use_create_chat_theme'
|
|
4
|
+
import { OauthToken } from './types'
|
|
5
|
+
import { TemporaryDefaultColorsType } from './utils/theme'
|
|
6
|
+
|
|
7
|
+
export {
|
|
8
|
+
ChatContext,
|
|
9
|
+
Conversations,
|
|
10
|
+
OauthToken as OathToken,
|
|
11
|
+
TemporaryDefaultColorsType,
|
|
12
|
+
useCreateChatTheme,
|
|
59
13
|
}
|
package/src/types.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export type ConversationRecord = {
|
|
2
|
+
id: string
|
|
3
|
+
type: 'Conversation'
|
|
4
|
+
attributes: {
|
|
5
|
+
title: string
|
|
6
|
+
created_at: string
|
|
7
|
+
updated_at: string
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export type OauthToken = {
|
|
12
|
+
subdomain: any
|
|
13
|
+
type: any
|
|
14
|
+
access_token: any
|
|
15
|
+
created_at: number
|
|
16
|
+
expires_in: any
|
|
17
|
+
person: any
|
|
18
|
+
refresh_token: any
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// Sets all the properties of of a deeply nested object to optional.
|
|
22
|
+
// Example: `DeepPartial<ChatTheme>`
|
|
23
|
+
export type DeepPartial<T> = {
|
|
24
|
+
[P in keyof T]?: DeepPartial<T[P]>
|
|
25
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { TextStyle, ViewStyle, ColorSchemeName } from 'react-native'
|
|
2
|
+
import { tokens } from '../vendor/tapestry/tokens'
|
|
3
|
+
import { tapestryAliasTokensColorMap } from '../vendor/tapestry/tapestry_alias_tokens_color_map'
|
|
4
|
+
|
|
5
|
+
export interface ChatTheme extends DefaultTheme {
|
|
6
|
+
colors: DefaultTheme['colors'] &
|
|
7
|
+
(typeof tapestryAliasTokensColorMap.light | typeof tapestryAliasTokensColorMap.dark)
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/** =============================================
|
|
11
|
+
NOTE: The specific values for `colors` and the `productBadge` are temporary examples that can be replaced once we start building out UI. This line's comment can be removed at that time too.
|
|
12
|
+
|
|
13
|
+
The default theme is intended to support two types of customizations:
|
|
14
|
+
1. Specific color properties for a chat component (eg. `primaryButtonBackgroundColor`)
|
|
15
|
+
2. Any styles for a specific component. (Use only one level of nesting.)
|
|
16
|
+
```
|
|
17
|
+
primaryButton: {
|
|
18
|
+
container: ViewStyle
|
|
19
|
+
text: TextStyle
|
|
20
|
+
}
|
|
21
|
+
```
|
|
22
|
+
============================================= */
|
|
23
|
+
|
|
24
|
+
export interface DefaultTheme {
|
|
25
|
+
colors: ChatColors
|
|
26
|
+
temporaryProductBadge: {
|
|
27
|
+
container: ViewStyle
|
|
28
|
+
text: TextStyle
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export const defaultTheme = (colorScheme: ColorSchemeName): DefaultTheme => {
|
|
33
|
+
const scheme = colorScheme || 'light'
|
|
34
|
+
|
|
35
|
+
return {
|
|
36
|
+
colors: chatThemeColorMap[scheme],
|
|
37
|
+
temporaryProductBadge: {
|
|
38
|
+
container: {
|
|
39
|
+
paddingHorizontal: tokens.spacing1,
|
|
40
|
+
backgroundColor: tapestryAliasTokensColorMap[scheme].fillColorNeutral070,
|
|
41
|
+
borderWidth: tokens.borderSizeDefault,
|
|
42
|
+
},
|
|
43
|
+
text: {
|
|
44
|
+
textAlign: 'center',
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export type TemporaryDefaultColorsType = Partial<ChatColors>
|
|
51
|
+
|
|
52
|
+
interface ChatColors {
|
|
53
|
+
name: string
|
|
54
|
+
temporaryButtonBackgroundColor: string
|
|
55
|
+
testColor: string
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const colorsChatLight: ChatColors = {
|
|
59
|
+
name: 'light',
|
|
60
|
+
temporaryButtonBackgroundColor: tokens.colorNeutral95,
|
|
61
|
+
testColor: 'red',
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const colorsChatDark: ChatColors = {
|
|
65
|
+
name: 'dark',
|
|
66
|
+
temporaryButtonBackgroundColor: tokens.colorNeutral17,
|
|
67
|
+
testColor: 'blue',
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const chatThemeColorMap = {
|
|
71
|
+
light: colorsChatLight,
|
|
72
|
+
dark: colorsChatDark,
|
|
73
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { tokens } from './tokens'
|
|
2
|
+
|
|
3
|
+
// Copied from `@planningcenter/tapestry` package.
|
|
4
|
+
// Defining these tokens locally is a temporary solution until the package supports mobile.
|
|
5
|
+
// Tokens Reference: https://planningcenter.github.io/tapestry/?path=/docs/foundations-design-tokens--docs
|
|
6
|
+
|
|
7
|
+
interface NeutralColors {
|
|
8
|
+
name: string
|
|
9
|
+
fillColorNeutral000: string
|
|
10
|
+
fillColorNeutral010: string
|
|
11
|
+
fillColorNeutral020: string
|
|
12
|
+
fillColorNeutral030: string
|
|
13
|
+
fillColorNeutral040: string
|
|
14
|
+
fillColorNeutral050Base: string
|
|
15
|
+
fillColorNeutral060: string
|
|
16
|
+
fillColorNeutral070: string
|
|
17
|
+
fillColorNeutral080: string
|
|
18
|
+
fillColorNeutral090: string
|
|
19
|
+
fillColorNeutral100Inverted: string
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const neutralsLight: NeutralColors = {
|
|
23
|
+
name: 'light',
|
|
24
|
+
fillColorNeutral000: tokens.colorNeutral12,
|
|
25
|
+
fillColorNeutral010: tokens.colorNeutral24,
|
|
26
|
+
fillColorNeutral020: tokens.colorNeutral45,
|
|
27
|
+
fillColorNeutral030: tokens.colorNeutral58,
|
|
28
|
+
fillColorNeutral040: tokens.colorNeutral81,
|
|
29
|
+
fillColorNeutral050Base: tokens.colorNeutral88,
|
|
30
|
+
fillColorNeutral060: tokens.colorNeutral93,
|
|
31
|
+
fillColorNeutral070: tokens.colorNeutral95,
|
|
32
|
+
fillColorNeutral080: tokens.colorNeutral97,
|
|
33
|
+
fillColorNeutral090: tokens.colorNeutral98,
|
|
34
|
+
fillColorNeutral100Inverted: tokens.colorNeutral100White,
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const neutralsDark: NeutralColors = {
|
|
38
|
+
name: 'dark',
|
|
39
|
+
fillColorNeutral000: tokens.colorNeutral98,
|
|
40
|
+
fillColorNeutral010: tokens.colorNeutral88,
|
|
41
|
+
fillColorNeutral020: tokens.colorNeutral68,
|
|
42
|
+
fillColorNeutral030: tokens.colorNeutral50,
|
|
43
|
+
fillColorNeutral040: tokens.colorNeutral32,
|
|
44
|
+
fillColorNeutral050Base: tokens.colorNeutral24,
|
|
45
|
+
fillColorNeutral060: tokens.colorNeutral19,
|
|
46
|
+
fillColorNeutral070: tokens.colorNeutral17,
|
|
47
|
+
fillColorNeutral080: tokens.colorNeutral15,
|
|
48
|
+
fillColorNeutral090: tokens.colorNeutral12,
|
|
49
|
+
fillColorNeutral100Inverted: tokens.colorNeutral7,
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
interface SemanticAliasesColors {
|
|
53
|
+
name: string
|
|
54
|
+
iconColorDefaultPrimary: string
|
|
55
|
+
iconColorDefaultSecondary: string
|
|
56
|
+
iconColorDefaultDim: string
|
|
57
|
+
iconColorDefaultDisabled: string
|
|
58
|
+
iconColorDefaultInverted: string
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const semanticAliasesLight: SemanticAliasesColors = {
|
|
62
|
+
name: 'light',
|
|
63
|
+
iconColorDefaultPrimary: neutralsLight.fillColorNeutral010,
|
|
64
|
+
iconColorDefaultSecondary: neutralsLight.fillColorNeutral020,
|
|
65
|
+
iconColorDefaultDim: neutralsLight.fillColorNeutral030,
|
|
66
|
+
iconColorDefaultDisabled: neutralsLight.fillColorNeutral040,
|
|
67
|
+
iconColorDefaultInverted: neutralsLight.fillColorNeutral100Inverted,
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const semanticAliasesDark: SemanticAliasesColors = {
|
|
71
|
+
name: 'dark',
|
|
72
|
+
iconColorDefaultPrimary: neutralsDark.fillColorNeutral010,
|
|
73
|
+
iconColorDefaultSecondary: neutralsDark.fillColorNeutral020,
|
|
74
|
+
iconColorDefaultDim: neutralsDark.fillColorNeutral030,
|
|
75
|
+
iconColorDefaultDisabled: neutralsDark.fillColorNeutral040,
|
|
76
|
+
iconColorDefaultInverted: neutralsDark.fillColorNeutral100Inverted,
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export const tapestryAliasTokensColorMap = {
|
|
80
|
+
light: { ...neutralsLight, ...semanticAliasesLight },
|
|
81
|
+
dark: { ...neutralsDark, ...semanticAliasesDark },
|
|
82
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
// Copied from `@planningcenter/tapestry` package.
|
|
2
|
+
// Defining these tokens locally is a temporary solution until the package supports mobile.
|
|
3
|
+
// Tokens Reference: https://planningcenter.github.io/tapestry/?path=/docs/foundations-design-tokens--docs
|
|
4
|
+
|
|
5
|
+
interface ColorPrimitves {
|
|
6
|
+
colorNeutral7: string
|
|
7
|
+
colorNeutral12: string
|
|
8
|
+
colorNeutral15: string
|
|
9
|
+
colorNeutral17: string
|
|
10
|
+
colorNeutral19: string
|
|
11
|
+
colorNeutral24: string
|
|
12
|
+
colorNeutral32: string
|
|
13
|
+
colorNeutral45: string
|
|
14
|
+
colorNeutral50: string
|
|
15
|
+
colorNeutral58: string
|
|
16
|
+
colorNeutral68: string
|
|
17
|
+
colorNeutral81: string
|
|
18
|
+
colorNeutral88: string
|
|
19
|
+
colorNeutral93: string
|
|
20
|
+
colorNeutral95: string
|
|
21
|
+
colorNeutral97: string
|
|
22
|
+
colorNeutral98: string
|
|
23
|
+
colorNeutral100White: string
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const colorPrimitives: ColorPrimitves = {
|
|
27
|
+
colorNeutral7: 'hsl(0, 0%, 7%)',
|
|
28
|
+
colorNeutral12: 'hsl(0, 0%, 12%)',
|
|
29
|
+
colorNeutral15: 'hsl(0, 0%, 15%)',
|
|
30
|
+
colorNeutral17: 'hsl(0, 0%, 17%)',
|
|
31
|
+
colorNeutral19: 'hsl(0, 0%, 19%)',
|
|
32
|
+
colorNeutral24: 'hsl(0, 0%, 24%)',
|
|
33
|
+
colorNeutral32: 'hsl(0, 0%, 32%)',
|
|
34
|
+
colorNeutral45: 'hsl(0, 0%, 45%)',
|
|
35
|
+
colorNeutral50: 'hsl(0, 0%, 50%)',
|
|
36
|
+
colorNeutral58: 'hsl(0, 0%, 58%)',
|
|
37
|
+
colorNeutral68: 'hsl(0, 0%, 68%)',
|
|
38
|
+
colorNeutral81: 'hsl(0, 0%, 81%)',
|
|
39
|
+
colorNeutral88: 'hsl(0, 0%, 88%)',
|
|
40
|
+
colorNeutral93: 'hsl(0, 0%, 93%)',
|
|
41
|
+
colorNeutral95: 'hsl(0, 0%, 95%)',
|
|
42
|
+
colorNeutral97: 'hsl(0, 0%, 97%)',
|
|
43
|
+
colorNeutral98: 'hsl(0, 0%, 98%)',
|
|
44
|
+
colorNeutral100White: 'hsl(0, 0%, 100%)',
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
interface NumericPrimitives {
|
|
48
|
+
spacingFourth: number
|
|
49
|
+
spacingHalf: number
|
|
50
|
+
spacing1: number
|
|
51
|
+
spacing2: number
|
|
52
|
+
spacing3: number
|
|
53
|
+
spacing4: number
|
|
54
|
+
spacing5: number
|
|
55
|
+
spacing6: number
|
|
56
|
+
spacing7: number
|
|
57
|
+
borderRadiusSm: number
|
|
58
|
+
borderRadiusMd: number
|
|
59
|
+
borderRadiusLg: number
|
|
60
|
+
borderRadiusXl: number
|
|
61
|
+
borderRadiusRound: number
|
|
62
|
+
borderSizeDefault: number
|
|
63
|
+
borderSizeThick: number
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const numericPrimtives: NumericPrimitives = {
|
|
67
|
+
spacingFourth: 2,
|
|
68
|
+
spacingHalf: 4,
|
|
69
|
+
spacing1: 8,
|
|
70
|
+
spacing2: 16,
|
|
71
|
+
spacing3: 24,
|
|
72
|
+
spacing4: 32,
|
|
73
|
+
spacing5: 40,
|
|
74
|
+
spacing6: 48,
|
|
75
|
+
spacing7: 56,
|
|
76
|
+
borderRadiusSm: 2,
|
|
77
|
+
borderRadiusMd: 4,
|
|
78
|
+
borderRadiusLg: 8,
|
|
79
|
+
borderRadiusXl: 16,
|
|
80
|
+
borderRadiusRound: 56,
|
|
81
|
+
borderSizeDefault: 1,
|
|
82
|
+
borderSizeThick: 2,
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
interface NumericAliases {
|
|
86
|
+
borderRadiusDefault: number
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
const numericAliases: NumericAliases = {
|
|
90
|
+
borderRadiusDefault: numericPrimtives.borderRadiusMd,
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export const tokens = {
|
|
94
|
+
...colorPrimitives,
|
|
95
|
+
...numericPrimtives,
|
|
96
|
+
...numericAliases,
|
|
97
|
+
}
|