@moneylion/react-native-offer-carousel 1.0.6 → 1.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (116) hide show
  1. package/lib/commonjs/capabilities/core/src/system/cnfContext/schemas/Brand.js +45 -9
  2. package/lib/commonjs/capabilities/core/src/system/cnfContext/schemas/Brand.js.map +1 -1
  3. package/lib/commonjs/capabilities/ui/elements/src/components/MarkdownText/components.js +2 -2
  4. package/lib/commonjs/capabilities/ui/elements/src/components/MarkdownText/components.js.map +1 -1
  5. package/lib/commonjs/components/Button/index.js +4 -21
  6. package/lib/commonjs/components/Button/index.js.map +1 -1
  7. package/lib/commonjs/components/Common/BaseOfferCard/Stat/Stat.js +4 -4
  8. package/lib/commonjs/components/Common/BaseOfferCard/Stat/Stat.js.map +1 -1
  9. package/lib/commonjs/components/Common/BaseOfferCard/index.js +12 -11
  10. package/lib/commonjs/components/Common/BaseOfferCard/index.js.map +1 -1
  11. package/lib/commonjs/components/Common/DynamicOfferCard/CallToAction.js +2 -0
  12. package/lib/commonjs/components/Common/DynamicOfferCard/CallToAction.js.map +1 -1
  13. package/lib/commonjs/components/Common/DynamicOfferCard/SeeMore.js +1 -1
  14. package/lib/commonjs/components/Common/DynamicOfferCard/SeeMore.js.map +1 -1
  15. package/lib/commonjs/components/Common/DynamicOfferCard/index.js +1 -0
  16. package/lib/commonjs/components/Common/DynamicOfferCard/index.js.map +1 -1
  17. package/lib/commonjs/components/Layouts/CreditCardOfferCard/index.js +2 -1
  18. package/lib/commonjs/components/Layouts/CreditCardOfferCard/index.js.map +1 -1
  19. package/lib/commonjs/components/Modal/DescriptionPoints.js +2 -2
  20. package/lib/commonjs/components/Modal/DescriptionPoints.js.map +1 -1
  21. package/lib/commonjs/components/Modal/Disclaimer.js +2 -2
  22. package/lib/commonjs/components/Modal/Disclaimer.js.map +1 -1
  23. package/lib/commonjs/components/Modal/OfferDetailsModal.js +6 -2
  24. package/lib/commonjs/components/Modal/OfferDetailsModal.js.map +1 -1
  25. package/lib/commonjs/components/MoneyLionOfferCarousel.js +12 -14
  26. package/lib/commonjs/components/MoneyLionOfferCarousel.js.map +1 -1
  27. package/lib/commonjs/components/Text/index.js +18 -38
  28. package/lib/commonjs/components/Text/index.js.map +1 -1
  29. package/lib/commonjs/components/View/index.js +10 -94
  30. package/lib/commonjs/components/View/index.js.map +1 -1
  31. package/lib/commonjs/config/mocks/cnfContext.js +44 -8
  32. package/lib/commonjs/config/mocks/cnfContext.js.map +1 -1
  33. package/lib/commonjs/context/ThemeProvider.js +2 -2
  34. package/lib/commonjs/context/ThemeProvider.js.map +1 -1
  35. package/lib/module/capabilities/core/src/system/cnfContext/schemas/Brand.js +45 -9
  36. package/lib/module/capabilities/core/src/system/cnfContext/schemas/Brand.js.map +1 -1
  37. package/lib/module/capabilities/ui/elements/src/components/MarkdownText/components.js +2 -3
  38. package/lib/module/capabilities/ui/elements/src/components/MarkdownText/components.js.map +1 -1
  39. package/lib/module/components/Button/index.js +4 -21
  40. package/lib/module/components/Button/index.js.map +1 -1
  41. package/lib/module/components/Common/BaseOfferCard/Stat/Stat.js +4 -4
  42. package/lib/module/components/Common/BaseOfferCard/Stat/Stat.js.map +1 -1
  43. package/lib/module/components/Common/BaseOfferCard/index.js +12 -11
  44. package/lib/module/components/Common/BaseOfferCard/index.js.map +1 -1
  45. package/lib/module/components/Common/DynamicOfferCard/CallToAction.js +2 -0
  46. package/lib/module/components/Common/DynamicOfferCard/CallToAction.js.map +1 -1
  47. package/lib/module/components/Common/DynamicOfferCard/SeeMore.js +1 -1
  48. package/lib/module/components/Common/DynamicOfferCard/SeeMore.js.map +1 -1
  49. package/lib/module/components/Common/DynamicOfferCard/index.js +1 -0
  50. package/lib/module/components/Common/DynamicOfferCard/index.js.map +1 -1
  51. package/lib/module/components/Layouts/CreditCardOfferCard/index.js +2 -1
  52. package/lib/module/components/Layouts/CreditCardOfferCard/index.js.map +1 -1
  53. package/lib/module/components/Modal/DescriptionPoints.js +2 -2
  54. package/lib/module/components/Modal/DescriptionPoints.js.map +1 -1
  55. package/lib/module/components/Modal/Disclaimer.js +2 -2
  56. package/lib/module/components/Modal/Disclaimer.js.map +1 -1
  57. package/lib/module/components/Modal/OfferDetailsModal.js +6 -2
  58. package/lib/module/components/Modal/OfferDetailsModal.js.map +1 -1
  59. package/lib/module/components/MoneyLionOfferCarousel.js +12 -14
  60. package/lib/module/components/MoneyLionOfferCarousel.js.map +1 -1
  61. package/lib/module/components/Text/index.js +17 -38
  62. package/lib/module/components/Text/index.js.map +1 -1
  63. package/lib/module/components/View/index.js +11 -95
  64. package/lib/module/components/View/index.js.map +1 -1
  65. package/lib/module/config/mocks/cnfContext.js +44 -8
  66. package/lib/module/config/mocks/cnfContext.js.map +1 -1
  67. package/lib/module/context/ThemeProvider.js +2 -2
  68. package/lib/module/context/ThemeProvider.js.map +1 -1
  69. package/lib/typescript/src/capabilities/core/src/system/cnfContext/schemas/Brand.d.ts +90 -18
  70. package/lib/typescript/src/capabilities/core/src/system/cnfContext/schemas/Brand.d.ts.map +1 -1
  71. package/lib/typescript/src/capabilities/ui/elements/src/components/MarkdownText/components.d.ts +3 -2
  72. package/lib/typescript/src/capabilities/ui/elements/src/components/MarkdownText/components.d.ts.map +1 -1
  73. package/lib/typescript/src/components/Button/index.d.ts +3 -3
  74. package/lib/typescript/src/components/Button/index.d.ts.map +1 -1
  75. package/lib/typescript/src/components/Common/BaseOfferCard/index.d.ts +2 -2
  76. package/lib/typescript/src/components/Common/BaseOfferCard/index.d.ts.map +1 -1
  77. package/lib/typescript/src/components/Common/DynamicOfferCard/CallToAction.d.ts +1 -1
  78. package/lib/typescript/src/components/Common/DynamicOfferCard/CallToAction.d.ts.map +1 -1
  79. package/lib/typescript/src/components/Common/DynamicOfferCard/index.d.ts.map +1 -1
  80. package/lib/typescript/src/components/Layouts/CreditCardOfferCard/index.d.ts.map +1 -1
  81. package/lib/typescript/src/components/Modal/Disclaimer.d.ts.map +1 -1
  82. package/lib/typescript/src/components/Modal/OfferDetailsModal.d.ts.map +1 -1
  83. package/lib/typescript/src/components/MoneyLionOfferCarousel.d.ts +1 -0
  84. package/lib/typescript/src/components/MoneyLionOfferCarousel.d.ts.map +1 -1
  85. package/lib/typescript/src/components/Text/index.d.ts +2 -2
  86. package/lib/typescript/src/components/Text/index.d.ts.map +1 -1
  87. package/lib/typescript/src/components/View/index.d.ts +4 -2
  88. package/lib/typescript/src/components/View/index.d.ts.map +1 -1
  89. package/lib/typescript/src/config/mocks/cnfContext.d.ts.map +1 -1
  90. package/lib/typescript/src/context/ThemeProvider.d.ts +47 -11
  91. package/lib/typescript/src/context/ThemeProvider.d.ts.map +1 -1
  92. package/package.json +1 -1
  93. package/src/capabilities/core/src/system/cnfContext/schemas/Brand.ts +46 -10
  94. package/src/capabilities/ui/elements/src/components/MarkdownText/components.tsx +4 -4
  95. package/src/components/Button/index.tsx +7 -20
  96. package/src/components/Common/BaseOfferCard/Stat/Stat.tsx +4 -4
  97. package/src/components/Common/BaseOfferCard/index.tsx +32 -13
  98. package/src/components/Common/DynamicOfferCard/CallToAction.tsx +2 -0
  99. package/src/components/Common/DynamicOfferCard/SeeMore.tsx +1 -1
  100. package/src/components/Common/DynamicOfferCard/index.tsx +1 -0
  101. package/src/components/Layouts/CreditCardOfferCard/index.tsx +2 -1
  102. package/src/components/Modal/DescriptionPoints.tsx +2 -2
  103. package/src/components/Modal/Disclaimer.tsx +6 -2
  104. package/src/components/Modal/OfferDetailsModal.tsx +11 -6
  105. package/src/components/MoneyLionOfferCarousel.tsx +16 -11
  106. package/src/components/Text/index.tsx +10 -45
  107. package/src/components/View/index.tsx +13 -66
  108. package/src/config/mocks/cnfContext.ts +44 -8
  109. package/src/context/ThemeProvider.tsx +51 -14
  110. package/lib/commonjs/utils/getDefaultPaletteColor.js +0 -20
  111. package/lib/commonjs/utils/getDefaultPaletteColor.js.map +0 -1
  112. package/lib/module/utils/getDefaultPaletteColor.js +0 -13
  113. package/lib/module/utils/getDefaultPaletteColor.js.map +0 -1
  114. package/lib/typescript/src/utils/getDefaultPaletteColor.d.ts +0 -3
  115. package/lib/typescript/src/utils/getDefaultPaletteColor.d.ts.map +0 -1
  116. package/src/utils/getDefaultPaletteColor.ts +0 -15
@@ -18,11 +18,11 @@ const BaseOfferCard = ({
18
18
  children,
19
19
  showCardBorder = true,
20
20
  ...rest
21
- }: ViewProps & { showCardBorder: boolean }) => (
21
+ }: ViewProps & { showCardBorder?: boolean }) => (
22
22
  <View
23
- borderColor={showCardBorder ? "neutral" : undefined}
23
+ borderColor={showCardBorder ? "borderNeutral" : undefined}
24
24
  direction={"column"}
25
- backgroundColor={"white"}
25
+ backgroundColor={"backgroundElevationBase"}
26
26
  width={CardWidth}
27
27
  gap={1}
28
28
  style={styles.baseOfferCard}
@@ -45,7 +45,12 @@ const Container = ({ children, ...rest }: ViewProps) => (
45
45
  );
46
46
 
47
47
  const Tip = ({ children }: ViewProps) => (
48
- <Text variant="caption-2" color="positive" weight="bold" style={styles.tip}>
48
+ <Text
49
+ variant="caption-2"
50
+ color="foregroundPositive"
51
+ weight="bold"
52
+ style={styles.tip}
53
+ >
49
54
  {children}
50
55
  </Text>
51
56
  );
@@ -118,7 +123,7 @@ const TopContainer = ({ children, ...viewProps }: ViewProps) => (
118
123
  const TopBar = ({ children, ...viewProps }: ViewProps) => (
119
124
  <View
120
125
  direction={"row"}
121
- backgroundColor="primary-faded"
126
+ backgroundColor="backgroundPrimaryFaded"
122
127
  {...viewProps}
123
128
  style={styles.topBar}
124
129
  >
@@ -127,7 +132,12 @@ const TopBar = ({ children, ...viewProps }: ViewProps) => (
127
132
  );
128
133
 
129
134
  const ProductType = ({ children, ...rest }: TextProps) => (
130
- <Text weight={"bold"} variant={"caption-1"} color="primary" {...rest}>
135
+ <Text
136
+ weight={"bold"}
137
+ variant={"caption-1"}
138
+ color="foregroundPrimary"
139
+ {...rest}
140
+ >
131
141
  {children}
132
142
  </Text>
133
143
  );
@@ -153,7 +163,7 @@ const BottomBar = ({ children, ...viewProps }: ViewProps) => (
153
163
  const Headline = ({ children, ...rest }: TextProps) => (
154
164
  <Text
155
165
  variant="body-2"
156
- color="neutral"
166
+ color="foregroundNeutral"
157
167
  weight="bold"
158
168
  numberOfLines={2}
159
169
  {...rest}
@@ -163,7 +173,12 @@ const Headline = ({ children, ...rest }: TextProps) => (
163
173
  );
164
174
 
165
175
  const Description = ({ children, ...rest }: TextProps) => (
166
- <Text variant="body-3" color="neutral-faded" numberOfLines={4} {...rest}>
176
+ <Text
177
+ variant="body-3"
178
+ color="foregroundNeutralFaded"
179
+ numberOfLines={4}
180
+ {...rest}
181
+ >
167
182
  {children}
168
183
  </Text>
169
184
  );
@@ -175,7 +190,7 @@ const DescriptionPoints = ({
175
190
  descriptionPoints.length > 0 && (
176
191
  <MarkdownText
177
192
  content={arrayToMarkdownList(descriptionPoints)}
178
- color="neutral-faded"
193
+ color="foregroundNeutralFaded"
179
194
  variant="body-3"
180
195
  {...rest}
181
196
  />
@@ -195,7 +210,7 @@ const DescriptionHandler = ({
195
210
  return (
196
211
  <DescriptionPoints
197
212
  numberOfLines={4}
198
- color={"neutral-faded"}
213
+ color="foregroundNeutralFaded"
199
214
  variant={"body-3"}
200
215
  descriptionPoints={descriptionPoints}
201
216
  />
@@ -204,7 +219,7 @@ const DescriptionHandler = ({
204
219
 
205
220
  if (contentDescription) {
206
221
  return (
207
- <Description variant={"body-3"} color={"neutral-faded"}>
222
+ <Description variant={"body-3"} color="foregroundNeutralFaded">
208
223
  {contentDescription}
209
224
  </Description>
210
225
  );
@@ -221,8 +236,12 @@ const DescriptionHandler = ({
221
236
  );
222
237
  };
223
238
 
224
- const CallToAction = ({ children, ...rest }: ComponentProps<typeof Button>) => (
225
- <Button color="positive" {...rest}>
239
+ const CallToAction = ({
240
+ color,
241
+ children,
242
+ ...rest
243
+ }: ComponentProps<typeof Button>) => (
244
+ <Button color={color} {...rest}>
226
245
  {children}
227
246
  </Button>
228
247
  );
@@ -14,6 +14,7 @@ export type CTAProps = ComponentProps<typeof Button & { href: string }> & {
14
14
  };
15
15
 
16
16
  export const CallToAction = ({
17
+ color,
17
18
  children,
18
19
  offer,
19
20
  context,
@@ -23,6 +24,7 @@ export const CallToAction = ({
23
24
  const { onOfferClick, rateTableUuid, leadUuid } = useEventHandler();
24
25
  return (
25
26
  <BaseOfferCard.CallToAction
27
+ color={color}
26
28
  onPress={() => {
27
29
  onOfferClick?.({
28
30
  timestamp: new Date().toISOString(),
@@ -48,7 +48,7 @@ export const SeeMore = ({ offer, offerIndex }: SeeMoreProps) => {
48
48
  <TouchableOpacity onPress={handleMoreInfoClick} style={styles.container}>
49
49
  <Text
50
50
  variant={"body-3"}
51
- color={"neutral"}
51
+ color={"foregroundNeutral"}
52
52
  weight={"medium"}
53
53
  style={styles.text}
54
54
  >
@@ -39,6 +39,7 @@ function DynamicOfferCard({
39
39
 
40
40
  <BaseOfferCard.BottomBar>
41
41
  <CallToAction
42
+ color={"backgroundPositive"}
42
43
  offer={offer}
43
44
  overrideUrl={offer.overrideUrl}
44
45
  style={styles.cta}
@@ -49,7 +49,7 @@ export const CreditCardOfferCard = ({
49
49
  // imageAttributes={{ title: offer.financialInstitutionDisplayName }}
50
50
  alt={offer.financialInstitutionDisplayName}
51
51
  />
52
- <Text variant="body-2" color="neutral" weight="bold">
52
+ <Text variant="body-2" color="backgroundNeutral" weight="bold">
53
53
  {offer.financialInstitutionDisplayName}
54
54
  </Text>
55
55
 
@@ -74,6 +74,7 @@ export const CreditCardOfferCard = ({
74
74
 
75
75
  <BaseOfferCard.BottomBar>
76
76
  <CallToAction
77
+ color={"backgroundPositive"}
77
78
  offer={offer}
78
79
  overrideUrl={offer.overrideUrl}
79
80
  style={styles.cta}
@@ -11,12 +11,12 @@ export function DescriptionPoints({
11
11
  }) {
12
12
  return (
13
13
  <View gap={8}>
14
- <Text variant={"body-3"} weight={"bold"} color={"neutral"}>
14
+ <Text variant={"body-3"} weight={"bold"} color={"foregroundNeutral"}>
15
15
  Offer Details
16
16
  </Text>
17
17
  <MarkdownText
18
18
  variant={"body-3"}
19
- color={"neutral"}
19
+ color={"foregroundNeutral"}
20
20
  content={arrayToMarkdownList(descriptionPoints)}
21
21
  />
22
22
  </View>
@@ -6,10 +6,14 @@ import { MarkdownText } from "../../capabilities/ui/elements/src/components/Mark
6
6
  export function Disclaimer({ disclaimer }: { disclaimer: string }) {
7
7
  return (
8
8
  <View gap={16}>
9
- <Text variant={"body-3"} weight={"bold"} color={"neutral"}>
9
+ <Text variant={"body-3"} weight={"bold"} color={"foregroundNeutral"}>
10
10
  Provider Disclaimer
11
11
  </Text>
12
- <MarkdownText variant={"body-3"} color={"neutral"} content={disclaimer} />
12
+ <MarkdownText
13
+ variant={"body-3"}
14
+ color={"foregroundNeutral"}
15
+ content={disclaimer}
16
+ />
13
17
  </View>
14
18
  );
15
19
  }
@@ -31,6 +31,12 @@ export const OfferDetailsModal = ({
31
31
  onClose,
32
32
  offerIndex,
33
33
  }: OfferDetailsModalProps) => {
34
+ const showDescriptionPoints = Boolean(offer?.descriptionPoints?.length);
35
+
36
+ const showDisclaimer = Boolean(offer?.legalLanguage);
37
+
38
+ const showDivider = showDescriptionPoints && showDisclaimer;
39
+
34
40
  return (
35
41
  <Modal
36
42
  animationType="slide"
@@ -61,15 +67,14 @@ export const OfferDetailsModal = ({
61
67
  style={styles.modalContent}
62
68
  contentContainerStyle={styles.scrollContent}
63
69
  >
64
- {offer?.descriptionPoints?.length && (
65
- <DescriptionPoints descriptionPoints={offer?.descriptionPoints} />
66
- )}
67
- {offer?.descriptionPoints && offer?.legalLanguage && <Divider />}
68
- {offer?.legalLanguage && (
69
- <Disclaimer disclaimer={offer.legalLanguage} />
70
+ {showDescriptionPoints && (
71
+ <DescriptionPoints descriptionPoints={offer?.descriptionPoints!} />
70
72
  )}
73
+ {showDivider && <Divider />}
74
+ {showDisclaimer && <Disclaimer disclaimer={offer.legalLanguage!} />}
71
75
  </ScrollView>
72
76
  <CallToAction
77
+ color={"backgroundPositive"}
73
78
  offerIndex={offerIndex}
74
79
  offer={offer}
75
80
  overrideUrl={offer.overrideUrl}
@@ -16,7 +16,6 @@ import {
16
16
  import { getConfigApiBaseUrl } from "../apiEnvironment";
17
17
  import { ConfigurationProvider } from "../context/ConfigurationProvider";
18
18
  import type { CnfContext } from "../capabilities/core/src/system/cnfContext/CnfContext";
19
- import { getDefaultPaletteColor } from "../utils/getDefaultPaletteColor";
20
19
 
21
20
  export type MoneyLionOfferCarouselProps = {
22
21
  channel: string;
@@ -32,6 +31,7 @@ export type MoneyLionOfferCarouselProps = {
32
31
  showProductTypeLabel?: boolean;
33
32
  isDev: boolean;
34
33
  showCardBorder?: boolean;
34
+ showDescriptionPoints?: boolean;
35
35
  };
36
36
 
37
37
  const getConfiguration = async ({
@@ -66,7 +66,14 @@ export const MoneyLionOfferCarousel = (
66
66
  props: MoneyLionOfferCarouselProps &
67
67
  Omit<EventHandlerContextType, "rateTableUuid" | "leadUuid">
68
68
  ) => {
69
- const { channel, zone, subAccountToken, fontFamily, isDev } = props;
69
+ const {
70
+ channel,
71
+ zone,
72
+ subAccountToken,
73
+ fontFamily,
74
+ isDev,
75
+ showDescriptionPoints = true,
76
+ } = props;
70
77
 
71
78
  const {
72
79
  onInitialize,
@@ -103,7 +110,7 @@ export const MoneyLionOfferCarousel = (
103
110
  subAccountToken,
104
111
  isDev,
105
112
  });
106
- setContext({ ...(data.serializableContext as CnfContext), isDev });
113
+ setContext(data.serializableContext as CnfContext);
107
114
  } catch (err) {
108
115
  setError(
109
116
  err instanceof Error
@@ -128,7 +135,7 @@ export const MoneyLionOfferCarousel = (
128
135
  const fetchPageData = async () => {
129
136
  if (context) {
130
137
  const data = await getPageData({
131
- context,
138
+ context: { ...context, isDev },
132
139
  params: props,
133
140
  onRateTableSubmit,
134
141
  });
@@ -144,7 +151,7 @@ export const MoneyLionOfferCarousel = (
144
151
  };
145
152
 
146
153
  fetchPageData();
147
- }, [context, onRateTableResponse, onRateTableSubmit, props]);
154
+ }, [context, isDev, onRateTableResponse, onRateTableSubmit, props]);
148
155
 
149
156
  if (isLoading) {
150
157
  return <DynamicOfferSkeleton displayLayout={"fixed"} />;
@@ -182,14 +189,12 @@ export const MoneyLionOfferCarousel = (
182
189
  title,
183
190
  };
184
191
 
185
- const palette = {
186
- ...context.brand.palette,
187
- positive:
188
- context.brand.palette?.positive ?? getDefaultPaletteColor("positive"),
192
+ const themeColor = {
193
+ ...context.brand.themeColors,
189
194
  };
190
195
 
191
196
  return (
192
- <ThemeProvider palette={palette} fontFamily={fontFamily}>
197
+ <ThemeProvider themeColors={themeColor} fontFamily={fontFamily}>
193
198
  <EventHandlerProvider
194
199
  eventHandlers={{
195
200
  ...eventHandlers,
@@ -197,7 +202,7 @@ export const MoneyLionOfferCarousel = (
197
202
  leadUuid,
198
203
  }}
199
204
  >
200
- <ConfigurationProvider showDescriptionPoints={false}>
205
+ <ConfigurationProvider showDescriptionPoints={showDescriptionPoints}>
201
206
  <DynamicOffersContainer config={config} />
202
207
  </ConfigurationProvider>
203
208
  </EventHandlerProvider>
@@ -1,4 +1,3 @@
1
- // Text.tsx
2
1
  import React from "react";
3
2
  import {
4
3
  Text as RNText,
@@ -7,7 +6,7 @@ import {
7
6
  type StyleProp,
8
7
  type TextProps as RNTextProps,
9
8
  } from "react-native";
10
- import { useTheme } from "../../context/ThemeProvider";
9
+ import { useTheme, type ThemeColors } from "../../context/ThemeProvider";
11
10
 
12
11
  // Define the variant types
13
12
  export type Variant =
@@ -29,27 +28,14 @@ export type Variant =
29
28
  // Define text decoration
30
29
  export type TextDecoration = "line-through";
31
30
 
32
- // Define text color
33
- export type TextColor =
34
- | "neutral"
35
- | "neutral-faded"
36
- | "critical"
37
- | "warning"
38
- | "positive"
39
- | "primary"
40
- | "disabled";
41
-
42
31
  // Define text weight
43
32
  export type TextWeight = "normal" | "medium" | "bold";
44
33
 
45
- // // Define wrap options
46
- // export type TextWrap = "balance";
47
-
48
34
  // Define props
49
35
  export interface TextProps extends Omit<RNTextProps, "style"> {
50
36
  variant?: Variant;
51
37
  weight?: TextWeight;
52
- color?: TextColor;
38
+ color?: keyof ThemeColors;
53
39
  decoration?: TextDecoration;
54
40
  children?: React.ReactNode;
55
41
  style?: StyleProp<TextStyle>;
@@ -64,26 +50,28 @@ const Text: React.FC<TextProps> = ({
64
50
  style,
65
51
  ...restProps
66
52
  }) => {
67
- const { fontFamily } = useTheme();
53
+ const themeContext = useTheme();
54
+ const { fontFamily, theme } = themeContext || { fontFamily: {}, theme: {} };
68
55
 
69
56
  // Create style array
70
57
  const styleArray: StyleProp<TextStyle>[] = [styles.base];
71
58
 
72
59
  // Add variant styles
73
-
74
60
  if (variant) {
75
61
  styleArray.push(styles[variant]);
76
62
  }
77
63
 
78
64
  // Add font family styles
79
- styleArray.push({ fontFamily: fontFamily[weight || "normal"] });
65
+ if (fontFamily && fontFamily[weight || "normal"]) {
66
+ styleArray.push({ fontFamily: fontFamily[weight || "normal"] });
67
+ }
80
68
 
81
69
  // Add weight styles
82
70
  styleArray.push({ fontWeight: weight === "medium" ? "500" : weight });
83
71
 
84
- // Add color styles
85
- if (color) {
86
- styleArray.push(styles[`color-${color}`]);
72
+ // Add color styles from theme
73
+ if (color && theme[color]) {
74
+ styleArray.push({ color: theme[color] });
87
75
  }
88
76
 
89
77
  // Add decoration styles
@@ -104,7 +92,6 @@ const Text: React.FC<TextProps> = ({
104
92
  };
105
93
 
106
94
  // Define styles
107
- // Note: In a real implementation, these would be derived from a theme or design system
108
95
  const styles = StyleSheet.create({
109
96
  "base": {
110
97
  fontFamily: "System",
@@ -172,28 +159,6 @@ const styles = StyleSheet.create({
172
159
  fontSize: 12,
173
160
  lineHeight: 16,
174
161
  },
175
- // Colors
176
- "color-neutral": {
177
- color: "#2E2E2E",
178
- },
179
- "color-neutral-faded": {
180
- color: "#6A6A6A",
181
- },
182
- "color-critical": {
183
- color: "#D32F2F",
184
- },
185
- "color-warning": {
186
- color: "#F57C00",
187
- },
188
- "color-positive": {
189
- color: "#388E3C",
190
- },
191
- "color-primary": {
192
- color: "#007c6a",
193
- },
194
- "color-disabled": {
195
- color: "#AAAAAA",
196
- },
197
162
  });
198
163
 
199
164
  export default Text;
@@ -1,37 +1,14 @@
1
1
  import React from "react";
2
- import { View as RNView, type ViewStyle, StyleSheet } from "react-native";
2
+ import { View as RNView, type ViewStyle } from "react-native";
3
+ import { useTheme, type ThemeColors } from "../../context/ThemeProvider";
4
+
5
+ type Colors = keyof ThemeColors;
3
6
 
4
7
  export interface ViewProps {
5
8
  children?: React.ReactNode;
6
9
  style?: ViewStyle;
7
- backgroundColor?:
8
- | "neutral"
9
- | "neutral-faded"
10
- | "critical"
11
- | "critical-faded"
12
- | "positive"
13
- | "positive-faded"
14
- | "warning"
15
- | "warning-faded"
16
- | "primary"
17
- | "primary-faded"
18
- | "elevation-base"
19
- | "elevation-raised"
20
- | "elevation-overlay"
21
- | "page"
22
- | "page-faded"
23
- | "disabled"
24
- | "disabled-faded"
25
- | "brand"
26
- | "white"
27
- | "black";
28
- borderColor?:
29
- | "neutral"
30
- | "positive"
31
- | "warning"
32
- | "critical"
33
- | "primary"
34
- | string;
10
+ backgroundColor?: Colors;
11
+ borderColor?: Colors;
35
12
  direction?: "row" | "row-reverse" | "column" | "column-reverse";
36
13
  height?: number | string;
37
14
  maxHeight?: number | string;
@@ -61,22 +38,24 @@ const View: React.FC<ViewProps> = ({
61
38
  testID,
62
39
  ...rest
63
40
  }) => {
64
- // Create a single style object directly - faster than array.filter(Boolean)
41
+ const themeContext = useTheme();
42
+ const theme = themeContext?.theme || {};
43
+
44
+ // Create a single style object directly
65
45
  const containerStyles: Record<string, any> = {
66
46
  // Background color handling
67
47
  ...(backgroundColor && {
68
- backgroundColor:
69
- styles[`bg${backgroundColor}`]?.backgroundColor || backgroundColor,
48
+ backgroundColor: theme[backgroundColor] || backgroundColor,
70
49
  }),
71
50
 
72
51
  // Border color handling
73
52
  ...(borderColor && {
74
53
  borderWidth: 1,
75
- borderColor: "#bbbbbb", // This will get update in follow up one using themeColors
54
+ borderColor: theme[borderColor],
76
55
  }),
77
56
 
78
57
  // Direction handling
79
- ...(direction && styles[`direction${direction}`]),
58
+ ...(direction && { flexDirection: direction }),
80
59
 
81
60
  // Dimension styles - applied only when provided
82
61
  ...(height !== undefined && { height }),
@@ -104,36 +83,4 @@ const View: React.FC<ViewProps> = ({
104
83
  );
105
84
  };
106
85
 
107
- const styles = StyleSheet.create({
108
- "bgneutral": { backgroundColor: "#e0e0e0" },
109
- "bgneutral-faded": { backgroundColor: "#f5f5f5" },
110
- "bgcritical": { backgroundColor: "#f44336" },
111
- "bgcritical-faded": { backgroundColor: "#ffebee" },
112
- "bgpositive": { backgroundColor: "#4caf50" },
113
- "bgpositive-faded": { backgroundColor: "#e8f5e9" },
114
- "bgwarning": { backgroundColor: "#ff9800" },
115
- "bgwarning-faded": { backgroundColor: "#fff3e0" },
116
- "bgprimary": { backgroundColor: "#2196f3" },
117
- "bgprimary-faded": { backgroundColor: "#ebfff9" },
118
- "bgelevation-base": { backgroundColor: "#fafafa" },
119
- "bgelevation-raised": { backgroundColor: "#eeeeee" },
120
- "bgelevation-overlay": { backgroundColor: "#bdbdbd" },
121
- "bgpage": { backgroundColor: "#ffffff" },
122
- "bgpage-faded": { backgroundColor: "#f5f5f5" },
123
- "bgdisabled": { backgroundColor: "#bdbdbd" },
124
- "bgdisabled-faded": { backgroundColor: "#e0e0e0" },
125
- "bgbrand": { backgroundColor: "#6200ea" },
126
- "bgwhite": { backgroundColor: "#ffffff" },
127
- "bgblack": { backgroundColor: "#000000" },
128
- "borderneutral": { borderColor: "#bdbdbd" },
129
- "borderpositive": { borderColor: "#388e3c" },
130
- "borderwarning": { borderColor: "#f57c00" },
131
- "bordercritical": { borderColor: "#d32f2f" },
132
- "borderprimary": { borderColor: "#1976d2" },
133
- "directionrow": { flexDirection: "row" },
134
- "directionrow-reverse": { flexDirection: "row-reverse" },
135
- "directioncolumn": { flexDirection: "column" },
136
- "directioncolumn-reverse": { flexDirection: "column-reverse" },
137
- });
138
-
139
86
  export default View;
@@ -36,14 +36,50 @@ export const localCnfContext: CnfContext = {
36
36
  icon: null,
37
37
  },
38
38
  type: "business",
39
- palette: {
40
- promotional: "#592b86",
41
- generation: "provided",
42
- colorScheme: "balanced",
43
- positive: "#ec8a07",
44
- critical: "#ce0202",
45
- highlight: "#ec8a07",
46
- neutral: "#14181f",
39
+ themeColors: {
40
+ backgroundCritical: "#ff7200",
41
+ backgroundCriticalFaded: "#fff2e8",
42
+ backgroundCriticalHighlighted: "#ee6a00",
43
+ backgroundDisabled: "#eeeeee",
44
+ backgroundDisabledFaded: "#f6f6f6",
45
+ backgroundElevationBase: "#ffffff",
46
+ backgroundElevationOverlay: "#ffffff",
47
+ backgroundElevationRaised: "#ffffff",
48
+ backgroundNeutral: "#e2e2e2",
49
+ backgroundNeutralFaded: "#f5f5f5",
50
+ backgroundNeutralHighlighted: "#d7d7d7",
51
+ backgroundPage: "#ffffff",
52
+ backgroundPageFaded: "#f9f9f9",
53
+ backgroundPositive: "#00e5c4",
54
+ backgroundPositiveFaded: "#e8fffc",
55
+ backgroundPositiveHighlighted: "#00d9b9",
56
+ backgroundPrimary: "#00e5c4",
57
+ backgroundPrimaryFaded: "#e8fffc",
58
+ backgroundPrimaryHighlighted: "#00d9b9",
59
+ backgroundWarning: "#facc15",
60
+ backgroundWarningFaded: "#fffae9",
61
+ backgroundWarningHighlighted: "#edc113",
62
+ black: "#000000",
63
+ borderCritical: "#d35d00",
64
+ borderCriticalFaded: "#fce3ce",
65
+ borderDisabled: "#e2e2e2",
66
+ borderNeutral: "#bbbbbb",
67
+ borderNeutralFaded: "#e1e1e1",
68
+ borderPositive: "#00bfa3",
69
+ borderPositiveFaded: "#b8faf2",
70
+ borderPrimary: "#00bfa3",
71
+ borderPrimaryFaded: "#b8faf2",
72
+ borderWarning: "#cfa90f",
73
+ borderWarningFaded: "#faedbb",
74
+ brand: "#00e5c4",
75
+ foregroundCritical: "#a94900",
76
+ foregroundDisabled: "#cccccc",
77
+ foregroundNeutral: "#181818",
78
+ foregroundNeutralFaded: "#666666",
79
+ foregroundPositive: "#007362",
80
+ foregroundPrimary: "#007362",
81
+ foregroundWarning: "#7b6305",
82
+ white: "#ffffff",
47
83
  },
48
84
  isLicensed: true,
49
85
  allowedMarks: { logo: true, name: true },