sapo-components-ui-rn 1.0.47 → 1.0.49

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.
@@ -254,6 +254,8 @@ export declare const tokens: {
254
254
  borderPrimaryFocused: string;
255
255
  borderWarningInverseDefault: string;
256
256
  borderSuccessInverseDefault: string;
257
+ toggleBackgroundDefault: string;
258
+ toggleBackgroundActive: string;
257
259
  };
258
260
  };
259
261
  light: {
@@ -395,6 +397,8 @@ export declare const tokens: {
395
397
  borderPrimaryFocused: string;
396
398
  borderWarningInverseDefault: string;
397
399
  borderSuccessInverseDefault: string;
400
+ toggleBackgroundDefault: string;
401
+ toggleBackgroundActive: string;
398
402
  };
399
403
  };
400
404
  };
@@ -667,6 +671,8 @@ export declare const ThemeColors: {
667
671
  borderPrimaryFocused: string;
668
672
  borderWarningInverseDefault: string;
669
673
  borderSuccessInverseDefault: string;
674
+ toggleBackgroundDefault: string;
675
+ toggleBackgroundActive: string;
670
676
  };
671
677
  };
672
678
  light: {
@@ -808,6 +814,8 @@ export declare const ThemeColors: {
808
814
  borderPrimaryFocused: string;
809
815
  borderWarningInverseDefault: string;
810
816
  borderSuccessInverseDefault: string;
817
+ toggleBackgroundDefault: string;
818
+ toggleBackgroundActive: string;
811
819
  };
812
820
  };
813
821
  };
package/dist/types.d.ts CHANGED
@@ -150,6 +150,8 @@ export type ThemeColors = {
150
150
  textWarningPressed: string;
151
151
  selectBackgroundDisabled: string;
152
152
  selectIconDisabled: string;
153
+ toggleBackgroundDefault: string;
154
+ toggleBackgroundActive: string;
153
155
  };
154
156
  export type ThemeProp = $DeepPartial<InternalTheme>;
155
157
  export type ThemeBase = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sapo-components-ui-rn",
3
- "version": "1.0.47",
3
+ "version": "1.0.49",
4
4
  "description": "React Native UI Components Library",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.esm.js",
@@ -15,6 +15,10 @@ import IconArrowDown from "../../icons/IconArrowDown";
15
15
  import IconClearText from "../../icons/IconClearText";
16
16
  import IconSearch from "@/icons/IconSearch";
17
17
  import IconClose from "@/icons/IconClose";
18
+ import IconSuccess from "@/icons/IconSuccess";
19
+ import IconError from "@/icons/IconError";
20
+ import IconInfo from "@/icons/IconInfo";
21
+ import IconWarning from "@/icons/IconWarning";
18
22
 
19
23
  export type IconType =
20
24
  | "FontAwesome"
@@ -34,7 +38,11 @@ export interface IconProps {
34
38
  | "IconArrowDown"
35
39
  | "IconClearText"
36
40
  | "IconSearch"
37
- | "IconClose";
41
+ | "IconClose"
42
+ | "IconSuccess"
43
+ | "IconError"
44
+ | "IconInfo"
45
+ | "IconWarning";
38
46
  backgroundColor?: string;
39
47
  size?: number;
40
48
  color?: string;
@@ -95,6 +103,14 @@ const Icon: React.FC<IconProps> = ({
95
103
  return IconSearch;
96
104
  case "IconClose":
97
105
  return IconClose;
106
+ case "IconSuccess":
107
+ return IconSuccess;
108
+ case "IconError":
109
+ return IconError;
110
+ case "IconInfo":
111
+ return IconInfo;
112
+ case "IconWarning":
113
+ return IconWarning;
98
114
  default:
99
115
  return IconCheckbox;
100
116
  }
@@ -1,7 +1,6 @@
1
1
  import * as React from "react";
2
2
  import {
3
3
  NativeModules,
4
- Platform,
5
4
  StyleProp,
6
5
  Switch as NativeSwitch,
7
6
  ViewStyle,
@@ -67,7 +66,7 @@ const Switch = ({
67
66
  ...rest
68
67
  }: Props) => {
69
68
  const theme = useInternalTheme();
70
- const { checkedColor, onTintColor, thumbTintColor } = getSwitchColor({
69
+ const { onTintColor, thumbTintColor } = getSwitchColor({
71
70
  theme,
72
71
  disabled,
73
72
  value,
@@ -80,12 +79,6 @@ const Switch = ({
80
79
  onTintColor,
81
80
  thumbTintColor,
82
81
  }
83
- : Platform.OS === "web"
84
- ? {
85
- activeTrackColor: onTintColor,
86
- thumbColor: thumbTintColor,
87
- activeThumbColor: checkedColor,
88
- }
89
82
  : {
90
83
  thumbColor: thumbTintColor,
91
84
  trackColor: {
@@ -19,7 +19,7 @@ const getCheckedColor = ({
19
19
  return color;
20
20
  }
21
21
 
22
- return theme.colors.surfaceBrandDefault;
22
+ return theme.colors.toggleBackgroundActive;
23
23
  };
24
24
 
25
25
  const getThumbTintColor = ({
@@ -36,9 +36,9 @@ const getThumbTintColor = ({
36
36
 
37
37
  if (disabled) {
38
38
  if (theme.dark) {
39
- return theme.colors.backgroundPrimary;
39
+ return theme.colors.toggleBackgroundDefault;
40
40
  }
41
- return theme.colors.backgroundPrimary;
41
+ return theme.colors.toggleBackgroundDefault;
42
42
  }
43
43
 
44
44
  if (value) {
@@ -46,9 +46,9 @@ const getThumbTintColor = ({
46
46
  }
47
47
 
48
48
  if (theme.dark) {
49
- return theme.colors.backgroundPrimary;
49
+ return theme.colors.toggleBackgroundDefault;
50
50
  }
51
- return theme.colors.backgroundPrimary;
51
+ return theme.colors.toggleBackgroundDefault;
52
52
  };
53
53
 
54
54
  const getOnTintColor = ({
@@ -65,9 +65,9 @@ const getOnTintColor = ({
65
65
 
66
66
  if (disabled) {
67
67
  if (theme.dark) {
68
- return theme.colors.backgroundPrimary;
68
+ return theme.colors.toggleBackgroundDefault;
69
69
  }
70
- return theme.colors.backgroundPrimary;
70
+ return theme.colors.toggleBackgroundDefault;
71
71
  }
72
72
 
73
73
  if (value) {
@@ -75,9 +75,9 @@ const getOnTintColor = ({
75
75
  }
76
76
 
77
77
  if (theme.dark) {
78
- return theme.colors.backgroundPrimary;
78
+ return theme.colors.toggleBackgroundDefault;
79
79
  }
80
- return theme.colors.backgroundPrimary;
80
+ return theme.colors.toggleBackgroundDefault;
81
81
  };
82
82
 
83
83
  export const getSwitchColor = ({
@@ -10,6 +10,7 @@ import View from "../View";
10
10
  import { memoWithRef } from "@/utils/function-utils";
11
11
  import ViewVisibleAnimated from "../ViewVisibleAnimated";
12
12
  import { useInternalTheme } from "../../core/theming";
13
+ import Icon from "../Icon";
13
14
 
14
15
  const POSITION = {
15
16
  TOP: "top",
@@ -165,15 +166,15 @@ const Toast = memoWithRef(
165
166
  const getSourceIcon = () => {
166
167
  switch (options.type) {
167
168
  case "success":
168
- return require("./assets/images/success.png");
169
+ return "IconSuccess";
169
170
  case "error":
170
- return require("./assets/images/error.png");
171
+ return "IconError";
171
172
  case "info":
172
- return require("./assets/images/info.png");
173
+ return "IconInfo";
173
174
  case "warning":
174
- return require("./assets/images/warning.png");
175
+ return "IconWarning";
175
176
  default:
176
- return require("./assets/images/success.png");
177
+ return "IconSuccess";
177
178
  }
178
179
  };
179
180
 
@@ -234,7 +235,7 @@ const Toast = memoWithRef(
234
235
  >
235
236
  <View row style={{ alignItems: "flex-start" }}>
236
237
  <View>
237
- <RNImage source={getSourceIcon()} style={styles.img} />
238
+ <Icon name={getSourceIcon()} type="Svg" size={20} />
238
239
  </View>
239
240
  <View full paddingLeft={CONSTANTS.SPACE_8}>
240
241
  <Text bold color={colors.textOnFillDefault}>
@@ -0,0 +1,21 @@
1
+ import React from "react";
2
+ import Svg, { Path } from "react-native-svg";
3
+ import { SvgProps } from "react-native-svg";
4
+ const IconError = (props: SvgProps) => (
5
+ <Svg width="20" height="20" viewBox="0 0 20 20" fill="none" {...props}>
6
+ <Path
7
+ fillRule="evenodd"
8
+ clipRule="evenodd"
9
+ d="M10 2.5C5.85786 2.5 2.5 5.85786 2.5 10C2.5 14.1421 5.85786 17.5 10 17.5C14.1421 17.5 17.5 14.1421 17.5 10C17.5 5.85786 14.1421 2.5 10 2.5ZM3.86364 10C3.86364 6.61098 6.61098 3.86364 10 3.86364C13.389 3.86364 16.1364 6.61098 16.1364 10C16.1364 13.389 13.389 16.1364 10 16.1364C6.61098 16.1364 3.86364 13.389 3.86364 10Z"
10
+ fill="white"
11
+ />
12
+ <Path
13
+ fillRule="evenodd"
14
+ clipRule="evenodd"
15
+ d="M13.3333 6.66667L10 10L6.66667 6.66667L5.83333 7.5L9.16667 10.8333L5.83333 14.1667L6.66667 15L10 11.6667L13.3333 15L14.1667 14.1667L10.8333 10.8333L14.1667 7.5L13.3333 6.66667Z"
16
+ fill="white"
17
+ />
18
+ </Svg>
19
+ );
20
+
21
+ export default IconError;
@@ -0,0 +1,27 @@
1
+ import React from "react";
2
+ import Svg, { Path, SvgProps } from "react-native-svg";
3
+
4
+ const IconInfo = (props: SvgProps) => (
5
+ <Svg width="20" height="20" viewBox="0 0 20 20" fill="none" {...props}>
6
+ <Path
7
+ fillRule="evenodd"
8
+ clipRule="evenodd"
9
+ d="M10 2.5C5.85786 2.5 2.5 5.85786 2.5 10C2.5 14.1421 5.85786 17.5 10 17.5C14.1421 17.5 17.5 14.1421 17.5 10C17.5 5.85786 14.1421 2.5 10 2.5ZM3.86364 10C3.86364 6.61098 6.61098 3.86364 10 3.86364C13.389 3.86364 16.1364 6.61098 16.1364 10C16.1364 13.389 13.389 16.1364 10 16.1364C6.61098 16.1364 3.86364 13.389 3.86364 10Z"
10
+ fill="white"
11
+ />
12
+ <Path
13
+ fillRule="evenodd"
14
+ clipRule="evenodd"
15
+ d="M10 6.66667C10.4602 6.66667 10.8333 7.03976 10.8333 7.5V10.8333C10.8333 11.2936 10.4602 11.6667 10 11.6667C9.53976 11.6667 9.16667 11.2936 9.16667 10.8333V7.5C9.16667 7.03976 9.53976 6.66667 10 6.66667Z"
16
+ fill="white"
17
+ />
18
+ <Path
19
+ fillRule="evenodd"
20
+ clipRule="evenodd"
21
+ d="M10 12.5C10.4602 12.5 10.8333 12.8731 10.8333 13.3333C10.8333 13.7936 10.4602 14.1667 10 14.1667C9.53976 14.1667 9.16667 13.7936 9.16667 13.3333C9.16667 12.8731 9.53976 12.5 10 12.5Z"
22
+ fill="white"
23
+ />
24
+ </Svg>
25
+ );
26
+
27
+ export default IconInfo;
@@ -0,0 +1,21 @@
1
+ import React from "react";
2
+ import Svg, { Path, SvgProps } from "react-native-svg";
3
+
4
+ const IconSuccess = (props: SvgProps) => (
5
+ <Svg width="20" height="20" viewBox="0 0 20 20" fill="none" {...props}>
6
+ <Path
7
+ fillRule="evenodd"
8
+ clipRule="evenodd"
9
+ d="M10 2.5C5.85786 2.5 2.5 5.85786 2.5 10C2.5 14.1421 5.85786 17.5 10 17.5C14.1421 17.5 17.5 14.1421 17.5 10C17.5 5.85786 14.1421 2.5 10 2.5ZM3.86364 10C3.86364 6.61098 6.61098 3.86364 10 3.86364C13.389 3.86364 16.1364 6.61098 16.1364 10C16.1364 13.389 13.389 16.1364 10 16.1364C6.61098 16.1364 3.86364 13.389 3.86364 10Z"
10
+ fill="white"
11
+ />
12
+ <Path
13
+ fillRule="evenodd"
14
+ clipRule="evenodd"
15
+ d="M8.875 10.9242L12.8447 6.9545L13.9053 8.01516L8.875 13.0455L6.09467 10.2652L7.15533 9.2045L8.875 10.9242Z"
16
+ fill="white"
17
+ />
18
+ </Svg>
19
+ );
20
+
21
+ export default IconSuccess;
@@ -0,0 +1,27 @@
1
+ import React from "react";
2
+ import Svg, { Path, SvgProps } from "react-native-svg";
3
+
4
+ const IconWarning = (props: SvgProps) => (
5
+ <Svg width="20" height="20" viewBox="0 0 20 20" fill="none" {...props}>
6
+ <Path
7
+ fillRule="evenodd"
8
+ clipRule="evenodd"
9
+ d="M10 2.5L17.5 17.5H2.5L10 2.5ZM10 5.83333L4.16667 15.8333H15.8333L10 5.83333Z"
10
+ fill="white"
11
+ />
12
+ <Path
13
+ fillRule="evenodd"
14
+ clipRule="evenodd"
15
+ d="M10 7.5C10.4602 7.5 10.8333 7.8731 10.8333 8.33333V11.6667C10.8333 12.1269 10.4602 12.5 10 12.5C9.53976 12.5 9.16667 12.1269 9.16667 11.6667V8.33333C9.16667 7.8731 9.53976 7.5 10 7.5Z"
16
+ fill="white"
17
+ />
18
+ <Path
19
+ fillRule="evenodd"
20
+ clipRule="evenodd"
21
+ d="M10 13.3333C10.4602 13.3333 10.8333 13.7064 10.8333 14.1667C10.8333 14.6269 10.4602 15 10 15C9.53976 15 9.16667 14.6269 9.16667 14.1667C9.16667 13.7064 9.53976 13.3333 10 13.3333Z"
22
+ fill="white"
23
+ />
24
+ </Svg>
25
+ );
26
+
27
+ export default IconWarning;
@@ -152,5 +152,7 @@ export const DarkTheme: AppTheme = {
152
152
  borderPrimaryFocused: blue.BLUE100,
153
153
  borderWarningInverseDefault: yellow.YELLOW40,
154
154
  borderSuccessInverseDefault: green.GREEN40,
155
+ toggleBackgroundDefault: ink.INK10,
156
+ toggleBackgroundActive: green.GREEN80,
155
157
  },
156
158
  };
@@ -151,6 +151,8 @@ export const LightTheme: AppTheme = {
151
151
  borderPrimaryFocused: blue.BLUE100,
152
152
  borderWarningInverseDefault: yellow.YELLOW40,
153
153
  borderSuccessInverseDefault: green.GREEN40,
154
+ toggleBackgroundDefault: ink.INK10,
155
+ toggleBackgroundActive: green.GREEN80,
154
156
  },
155
157
  fonts: configureFonts(),
156
158
  animation: {
@@ -150,6 +150,8 @@ const ref = {
150
150
  borderPrimaryFocused: blue.BLUE100,
151
151
  borderWarningInverseDefault: yellow.YELLOW40,
152
152
  borderSuccessInverseDefault: green.GREEN40,
153
+ toggleBackgroundDefault: ink.INK10,
154
+ toggleBackgroundActive: green.GREEN80,
153
155
  },
154
156
  },
155
157
  light: {
@@ -292,6 +294,8 @@ const ref = {
292
294
  borderPrimaryFocused: blue.BLUE100,
293
295
  borderWarningInverseDefault: yellow.YELLOW40,
294
296
  borderSuccessInverseDefault: green.GREEN40,
297
+ toggleBackgroundDefault: ink.INK10,
298
+ toggleBackgroundActive: green.GREEN80,
295
299
  },
296
300
  },
297
301
  },
package/src/types.ts CHANGED
@@ -178,6 +178,9 @@ export type ThemeColors = {
178
178
 
179
179
  selectBackgroundDisabled: string;
180
180
  selectIconDisabled: string;
181
+
182
+ toggleBackgroundDefault: string;
183
+ toggleBackgroundActive: string
181
184
  };
182
185
 
183
186
  export type ThemeProp = $DeepPartial<InternalTheme>;