@dryanovski/react-native-components 1.0.2 → 1.0.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/lib/module/components/Card/Card.js +14 -9
- package/lib/module/components/Card/Card.js.map +1 -1
- package/lib/module/components/Card/styles.js +15 -17
- package/lib/module/components/Card/styles.js.map +1 -1
- package/lib/module/components/Surface/Surface.js +34 -0
- package/lib/module/components/Surface/Surface.js.map +1 -0
- package/lib/module/components/Surface/styles.js +25 -0
- package/lib/module/components/Surface/styles.js.map +1 -0
- package/lib/module/components/Surface/types.js +4 -0
- package/lib/module/components/Surface/types.js.map +1 -0
- package/lib/module/themes/colors.js +122 -0
- package/lib/module/themes/colors.js.map +1 -0
- package/lib/module/themes/light.js +34 -0
- package/lib/module/themes/light.js.map +1 -0
- package/lib/module/themes/radius.js +11 -0
- package/lib/module/themes/radius.js.map +1 -0
- package/lib/module/themes/size.js +11 -0
- package/lib/module/themes/size.js.map +1 -0
- package/lib/module/themes/spacing.js +13 -0
- package/lib/module/themes/spacing.js.map +1 -0
- package/lib/module/themes/types.js +4 -0
- package/lib/module/themes/types.js.map +1 -0
- package/lib/module/themes/typography.js +31 -0
- package/lib/module/themes/typography.js.map +1 -0
- package/lib/module/types/general.types.js +4 -0
- package/lib/module/types/general.types.js.map +1 -0
- package/lib/typescript/src/components/Card/Card.d.ts +1 -1
- package/lib/typescript/src/components/Card/Card.d.ts.map +1 -1
- package/lib/typescript/src/components/Card/styles.d.ts +13 -1
- package/lib/typescript/src/components/Card/styles.d.ts.map +1 -1
- package/lib/typescript/src/components/Card/types.d.ts +11 -3
- package/lib/typescript/src/components/Card/types.d.ts.map +1 -1
- package/lib/typescript/src/components/Surface/Surface.d.ts +16 -0
- package/lib/typescript/src/components/Surface/Surface.d.ts.map +1 -0
- package/lib/typescript/src/components/Surface/styles.d.ts +22 -0
- package/lib/typescript/src/components/Surface/styles.d.ts.map +1 -0
- package/lib/typescript/src/components/Surface/types.d.ts +12 -0
- package/lib/typescript/src/components/Surface/types.d.ts.map +1 -0
- package/lib/typescript/src/themes/colors.d.ts +108 -0
- package/lib/typescript/src/themes/colors.d.ts.map +1 -0
- package/lib/typescript/src/themes/light.d.ts +3 -0
- package/lib/typescript/src/themes/light.d.ts.map +1 -0
- package/lib/typescript/src/themes/radius.d.ts +10 -0
- package/lib/typescript/src/themes/radius.d.ts.map +1 -0
- package/lib/typescript/src/themes/size.d.ts +10 -0
- package/lib/typescript/src/themes/size.d.ts.map +1 -0
- package/lib/typescript/src/themes/spacing.d.ts +12 -0
- package/lib/typescript/src/themes/spacing.d.ts.map +1 -0
- package/lib/typescript/src/themes/types.d.ts +19 -0
- package/lib/typescript/src/themes/types.d.ts.map +1 -0
- package/lib/typescript/src/themes/typography.d.ts +30 -0
- package/lib/typescript/src/themes/typography.d.ts.map +1 -0
- package/lib/typescript/src/types/general.types.d.ts +4 -0
- package/lib/typescript/src/types/general.types.d.ts.map +1 -0
- package/package.json +3 -3
- package/src/components/Card/Card.tsx +13 -5
- package/src/components/Card/styles.ts +17 -17
- package/src/components/Card/types.ts +12 -3
- package/src/components/Surface/Surface.tsx +29 -0
- package/src/components/Surface/styles.ts +28 -0
- package/src/components/Surface/types.ts +14 -0
- package/src/themes/colors.ts +125 -0
- package/src/themes/light.ts +30 -0
- package/src/themes/radius.ts +10 -0
- package/src/themes/size.ts +10 -0
- package/src/themes/spacing.ts +12 -0
- package/src/themes/types.ts +19 -0
- package/src/themes/typography.ts +33 -0
- package/src/types/general.types.ts +4 -0
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
export declare const colors: {
|
|
2
|
+
readonly primary: {
|
|
3
|
+
readonly 50: "#F0F7FF";
|
|
4
|
+
readonly 100: "#D9E9FF";
|
|
5
|
+
readonly 200: "#B3D3FF";
|
|
6
|
+
readonly 300: "#8DBDFF";
|
|
7
|
+
readonly 400: "#66A7FF";
|
|
8
|
+
readonly 500: "#3F91FF";
|
|
9
|
+
readonly 600: "#2376E6";
|
|
10
|
+
readonly 700: "#1658B3";
|
|
11
|
+
readonly 800: "#0A3A80";
|
|
12
|
+
readonly 900: "#001D4D";
|
|
13
|
+
};
|
|
14
|
+
readonly secondary: {
|
|
15
|
+
readonly 50: "#F5F5FF";
|
|
16
|
+
readonly 100: "#E6E4FF";
|
|
17
|
+
readonly 200: "#C8C4FF";
|
|
18
|
+
readonly 300: "#AAA3FF";
|
|
19
|
+
readonly 400: "#8C82FF";
|
|
20
|
+
readonly 500: "#6E61FF";
|
|
21
|
+
readonly 600: "#554ACC";
|
|
22
|
+
readonly 700: "#3D3499";
|
|
23
|
+
readonly 800: "#251E66";
|
|
24
|
+
readonly 900: "#100A33";
|
|
25
|
+
};
|
|
26
|
+
readonly success: {
|
|
27
|
+
readonly 50: "#EBFDF3";
|
|
28
|
+
readonly 100: "#C8F9DF";
|
|
29
|
+
readonly 200: "#A3F3C6";
|
|
30
|
+
readonly 300: "#7DEDAE";
|
|
31
|
+
readonly 400: "#57E796";
|
|
32
|
+
readonly 500: "#32D880";
|
|
33
|
+
readonly 600: "#28B56A";
|
|
34
|
+
readonly 700: "#1E9254";
|
|
35
|
+
readonly 800: "#146F3E";
|
|
36
|
+
readonly 900: "#0A4C28";
|
|
37
|
+
};
|
|
38
|
+
readonly warning: {
|
|
39
|
+
readonly 50: "#FFFAEA";
|
|
40
|
+
readonly 100: "#FFF2C2";
|
|
41
|
+
readonly 200: "#FFE08A";
|
|
42
|
+
readonly 300: "#FFCE52";
|
|
43
|
+
readonly 400: "#FFBC1A";
|
|
44
|
+
readonly 500: "#F5A000";
|
|
45
|
+
readonly 600: "#CC8300";
|
|
46
|
+
readonly 700: "#A36600";
|
|
47
|
+
readonly 800: "#7A4A00";
|
|
48
|
+
readonly 900: "#523000";
|
|
49
|
+
};
|
|
50
|
+
readonly danger: {
|
|
51
|
+
readonly 50: "#FFF5F5";
|
|
52
|
+
readonly 100: "#FFE0E0";
|
|
53
|
+
readonly 200: "#FFB8B8";
|
|
54
|
+
readonly 300: "#FF8A8A";
|
|
55
|
+
readonly 400: "#FF5C5C";
|
|
56
|
+
readonly 500: "#FF2E2E";
|
|
57
|
+
readonly 600: "#CC2323";
|
|
58
|
+
readonly 700: "#991A1A";
|
|
59
|
+
readonly 800: "#661212";
|
|
60
|
+
readonly 900: "#330909";
|
|
61
|
+
};
|
|
62
|
+
readonly error: {
|
|
63
|
+
readonly 50: "#FFF4F2";
|
|
64
|
+
readonly 100: "#FFE3DE";
|
|
65
|
+
readonly 200: "#FFC0B8";
|
|
66
|
+
readonly 300: "#FF9A8E";
|
|
67
|
+
readonly 400: "#FF6B5C";
|
|
68
|
+
readonly 500: "#F04438";
|
|
69
|
+
readonly 600: "#D92D20";
|
|
70
|
+
readonly 700: "#B42318";
|
|
71
|
+
readonly 800: "#912018";
|
|
72
|
+
readonly 900: "#7A271A";
|
|
73
|
+
};
|
|
74
|
+
readonly disabled: {
|
|
75
|
+
readonly bg: "#E5E7EB";
|
|
76
|
+
readonly text: "#9CA3AF";
|
|
77
|
+
readonly border: "#D1D5DB";
|
|
78
|
+
};
|
|
79
|
+
readonly gray: {
|
|
80
|
+
readonly 50: "#F9FAFB";
|
|
81
|
+
readonly 100: "#F3F4F6";
|
|
82
|
+
readonly 200: "#E5E7EB";
|
|
83
|
+
readonly 300: "#D1D5DB";
|
|
84
|
+
readonly 400: "#9CA3AF";
|
|
85
|
+
readonly 500: "#6B7280";
|
|
86
|
+
readonly 600: "#4B5563";
|
|
87
|
+
readonly 700: "#374151";
|
|
88
|
+
readonly 800: "#1F2937";
|
|
89
|
+
readonly 900: "#111827";
|
|
90
|
+
};
|
|
91
|
+
readonly background: {
|
|
92
|
+
readonly primary: "#FFFFFF";
|
|
93
|
+
readonly secondary: "#F7F7F8";
|
|
94
|
+
readonly tertiary: "#EFEFF1";
|
|
95
|
+
readonly disabled: "#E5E7EB";
|
|
96
|
+
};
|
|
97
|
+
readonly text: {
|
|
98
|
+
readonly primary: "#111827";
|
|
99
|
+
readonly secondary: "#4B5563";
|
|
100
|
+
readonly muted: "#6B7280";
|
|
101
|
+
readonly inverted: "#FFFFFF";
|
|
102
|
+
};
|
|
103
|
+
readonly white: "#FFFFFF";
|
|
104
|
+
readonly black: "#000000";
|
|
105
|
+
readonly transparent: "transparent";
|
|
106
|
+
};
|
|
107
|
+
export type ColorToken = typeof colors;
|
|
108
|
+
//# sourceMappingURL=colors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"colors.d.ts","sourceRoot":"","sources":["../../../../src/themes/colors.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0HT,CAAC;AAEX,MAAM,MAAM,UAAU,GAAG,OAAO,MAAM,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"light.d.ts","sourceRoot":"","sources":["../../../../src/themes/light.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAG/C,eAAO,MAAM,UAAU,EAAE,eAsBxB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"radius.d.ts","sourceRoot":"","sources":["../../../../src/themes/radius.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,KAAK;;;;;;;CAOR,CAAC;AAEX,MAAM,MAAM,WAAW,GAAG,MAAM,OAAO,KAAK,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"size.d.ts","sourceRoot":"","sources":["../../../../src/themes/size.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,KAAK;;;;;;;CAOR,CAAC;AAEX,MAAM,MAAM,SAAS,GAAG,MAAM,OAAO,KAAK,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const spacing: {
|
|
2
|
+
readonly none: 0;
|
|
3
|
+
readonly xs: 4;
|
|
4
|
+
readonly sm: 8;
|
|
5
|
+
readonly md: 12;
|
|
6
|
+
readonly lg: 16;
|
|
7
|
+
readonly xl: 24;
|
|
8
|
+
readonly '2xl': 32;
|
|
9
|
+
readonly '3xl': 40;
|
|
10
|
+
};
|
|
11
|
+
export type SpacingToken = keyof typeof spacing;
|
|
12
|
+
//# sourceMappingURL=spacing.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spacing.d.ts","sourceRoot":"","sources":["../../../../src/themes/spacing.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO;;;;;;;;;CASV,CAAC;AAEX,MAAM,MAAM,YAAY,GAAG,MAAM,OAAO,OAAO,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { CardStyleVariables } from '../components/Card/styles';
|
|
2
|
+
import type { SurfaceStyleVariables } from '../components/Surface/styles';
|
|
3
|
+
import type { colors } from './colors';
|
|
4
|
+
import type { radii } from './radius';
|
|
5
|
+
import type { sizes } from './size';
|
|
6
|
+
import type { spacing } from './spacing';
|
|
7
|
+
import type { typography } from './typography';
|
|
8
|
+
export type ThemeDefinition = {
|
|
9
|
+
color: typeof colors;
|
|
10
|
+
size: typeof sizes;
|
|
11
|
+
spacing: typeof spacing;
|
|
12
|
+
typography: typeof typography;
|
|
13
|
+
radius: typeof radii;
|
|
14
|
+
components: {
|
|
15
|
+
card: CardStyleVariables;
|
|
16
|
+
surface: SurfaceStyleVariables;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/themes/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAC1E,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/C,MAAM,MAAM,eAAe,GAAG;IAC5B,KAAK,EAAE,OAAO,MAAM,CAAC;IACrB,IAAI,EAAE,OAAO,KAAK,CAAC;IACnB,OAAO,EAAE,OAAO,OAAO,CAAC;IACxB,UAAU,EAAE,OAAO,UAAU,CAAC;IAC9B,MAAM,EAAE,OAAO,KAAK,CAAC;IACrB,UAAU,EAAE;QACV,IAAI,EAAE,kBAAkB,CAAC;QACzB,OAAO,EAAE,qBAAqB,CAAC;KAChC,CAAC;CACH,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export declare const typography: {
|
|
2
|
+
readonly fonts: {
|
|
3
|
+
readonly regular: "System";
|
|
4
|
+
readonly medium: "System";
|
|
5
|
+
readonly bold: "System";
|
|
6
|
+
};
|
|
7
|
+
readonly fontSizes: {
|
|
8
|
+
readonly xs: 12;
|
|
9
|
+
readonly sm: 14;
|
|
10
|
+
readonly md: 16;
|
|
11
|
+
readonly lg: 20;
|
|
12
|
+
readonly xl: 24;
|
|
13
|
+
readonly '2xl': 32;
|
|
14
|
+
};
|
|
15
|
+
readonly lineHeights: {
|
|
16
|
+
readonly xs: 16;
|
|
17
|
+
readonly sm: 18;
|
|
18
|
+
readonly md: 20;
|
|
19
|
+
readonly lg: 28;
|
|
20
|
+
readonly xl: 32;
|
|
21
|
+
readonly '2xl': 40;
|
|
22
|
+
};
|
|
23
|
+
readonly fontWeights: {
|
|
24
|
+
readonly regular: "400";
|
|
25
|
+
readonly medium: "500";
|
|
26
|
+
readonly bold: "700";
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
export type TypographyToken = typeof typography;
|
|
30
|
+
//# sourceMappingURL=typography.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typography.d.ts","sourceRoot":"","sources":["../../../../src/themes/typography.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8Bb,CAAC;AAEX,MAAM,MAAM,eAAe,GAAG,OAAO,UAAU,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"general.types.d.ts","sourceRoot":"","sources":["../../../../src/types/general.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEzC,MAAM,MAAM,OAAO,GAAG,YAAY,CAAC,OAAO,IAAI,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dryanovski/react-native-components",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"description": "Collection of reusable React Native components for building mobile applications.",
|
|
5
5
|
"main": "./lib/module/index.js",
|
|
6
6
|
"types": "./lib/typescript/src/index.d.ts",
|
|
@@ -61,8 +61,8 @@
|
|
|
61
61
|
"typescript": "^5.8.3"
|
|
62
62
|
},
|
|
63
63
|
"peerDependencies": {
|
|
64
|
-
"react": ">=19
|
|
65
|
-
"react-native": ">=0.81.
|
|
64
|
+
"react": ">=19",
|
|
65
|
+
"react-native": ">=0.81.5",
|
|
66
66
|
"react-native-reanimated": "~4.1.1",
|
|
67
67
|
"react-native-safe-area-context": "~5.6.0",
|
|
68
68
|
"react-native-screens": ">=4",
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { forwardRef } from 'react';
|
|
2
|
+
import type { ViewRef } from '../../types/general.types';
|
|
3
|
+
import Surface from '../Surface/Surface';
|
|
2
4
|
import Styles from './styles';
|
|
3
5
|
import type { CardProps } from './types';
|
|
4
6
|
|
|
@@ -12,13 +14,19 @@ import type { CardProps } from './types';
|
|
|
12
14
|
* <Text>This is a card</Text>
|
|
13
15
|
* </Card>
|
|
14
16
|
*/
|
|
15
|
-
export const Card
|
|
17
|
+
export const Card = forwardRef<ViewRef, CardProps>((props, ref) => {
|
|
18
|
+
const { children, variant = 'default', style = {}, ...rest } = props;
|
|
16
19
|
return (
|
|
17
|
-
<
|
|
20
|
+
<Surface
|
|
21
|
+
ref={ref}
|
|
22
|
+
variant={variant}
|
|
23
|
+
style={[Styles.container, style]}
|
|
24
|
+
{...rest}
|
|
25
|
+
>
|
|
18
26
|
{children}
|
|
19
|
-
</
|
|
27
|
+
</Surface>
|
|
20
28
|
);
|
|
21
|
-
};
|
|
29
|
+
});
|
|
22
30
|
|
|
23
31
|
Card.displayName = 'Card';
|
|
24
32
|
|
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
import Style from '../../utils/Style';
|
|
2
2
|
|
|
3
|
-
const DEFAULT_CARD = {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
card_elevation: 3,
|
|
3
|
+
export const DEFAULT_CARD = {
|
|
4
|
+
border_radius: 8,
|
|
5
|
+
padding: 16,
|
|
6
|
+
shadow_color: '#000',
|
|
7
|
+
shadow_offset: { width: 0, height: 2 },
|
|
8
|
+
shadow_opacity: 0.1,
|
|
9
|
+
shadow_radius: 4,
|
|
10
|
+
elevation: 3,
|
|
12
11
|
};
|
|
13
12
|
|
|
13
|
+
export type CardStyleVariables = typeof DEFAULT_CARD;
|
|
14
|
+
|
|
14
15
|
export const Styles = Style.create({
|
|
15
16
|
container: {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
elevation: DEFAULT_CARD.card_elevation,
|
|
17
|
+
borderRadius: DEFAULT_CARD.border_radius,
|
|
18
|
+
padding: DEFAULT_CARD.padding,
|
|
19
|
+
shadowColor: DEFAULT_CARD.shadow_color,
|
|
20
|
+
shadowOffset: DEFAULT_CARD.shadow_offset,
|
|
21
|
+
shadowOpacity: DEFAULT_CARD.shadow_opacity,
|
|
22
|
+
shadowRadius: DEFAULT_CARD.shadow_radius,
|
|
23
|
+
elevation: DEFAULT_CARD.elevation,
|
|
24
24
|
},
|
|
25
25
|
});
|
|
26
26
|
|
|
@@ -1,9 +1,18 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ViewProps, ViewStyle } from 'react-native';
|
|
2
|
+
import type { SurfaceVariants } from '../Surface/types';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* Props for the Card component
|
|
5
6
|
*/
|
|
6
|
-
export
|
|
7
|
+
export interface CardProps extends ViewProps {
|
|
8
|
+
/**
|
|
9
|
+
* Children elements to be rendered inside the Card
|
|
10
|
+
*/
|
|
7
11
|
children?: React.ReactNode;
|
|
12
|
+
/**
|
|
13
|
+
* Custom styles for the Card container
|
|
14
|
+
*/
|
|
8
15
|
style?: ViewStyle;
|
|
9
|
-
|
|
16
|
+
|
|
17
|
+
variant?: SurfaceVariants;
|
|
18
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { forwardRef } from 'react';
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
import type { ViewRef } from '../../types/general.types';
|
|
4
|
+
import { Styles } from './styles';
|
|
5
|
+
import type { SurfaceProps } from './types';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Surface component to provide a styled container
|
|
9
|
+
* @param {React.ReactNode} children - The content to be displayed inside the surface
|
|
10
|
+
* @param {ViewStyle} style - Additional styles for the surface container
|
|
11
|
+
* @param {SurfaceVariants} variant - The variant of the surface styling
|
|
12
|
+
* @returns {JSX.Element} The Surface component
|
|
13
|
+
* @example
|
|
14
|
+
* <Surface variant="secondary" style={{ margin: 10 }}>
|
|
15
|
+
* <Text>This is a surface</Text>
|
|
16
|
+
* </Surface>
|
|
17
|
+
*/
|
|
18
|
+
export const Surface = forwardRef<ViewRef, SurfaceProps>((props, ref) => {
|
|
19
|
+
const { children, variant = 'default', style, ...rest } = props;
|
|
20
|
+
return (
|
|
21
|
+
<View ref={ref} style={[Styles.base, Styles[variant], style]} {...rest}>
|
|
22
|
+
{children}
|
|
23
|
+
</View>
|
|
24
|
+
);
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
Surface.displayName = 'Surface';
|
|
28
|
+
|
|
29
|
+
export default Surface;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import Style from '../../utils/Style';
|
|
2
|
+
|
|
3
|
+
export const DEFAULT_SURFACE = {
|
|
4
|
+
default_background_color: '#fff',
|
|
5
|
+
secondary_background_color: '#f0f0f0',
|
|
6
|
+
transparent_background_color: 'transparent',
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export type SurfaceStyleVariables = typeof DEFAULT_SURFACE;
|
|
10
|
+
|
|
11
|
+
export const Styles = Style.create({
|
|
12
|
+
base: {},
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Variants
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
default: {
|
|
19
|
+
backgroundColor: DEFAULT_SURFACE.default_background_color,
|
|
20
|
+
},
|
|
21
|
+
secondary: {
|
|
22
|
+
backgroundColor: DEFAULT_SURFACE.secondary_background_color,
|
|
23
|
+
},
|
|
24
|
+
|
|
25
|
+
transparent: {
|
|
26
|
+
backgroundColor: DEFAULT_SURFACE.transparent_background_color,
|
|
27
|
+
},
|
|
28
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ViewProps, ViewStyle } from 'react-native';
|
|
2
|
+
|
|
3
|
+
export type SurfaceVariants = 'default' | 'secondary' | 'transparent';
|
|
4
|
+
|
|
5
|
+
export interface SurfaceProps extends ViewProps {
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
style?: ViewStyle | ViewStyle[];
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* The variant of the Surface component.
|
|
11
|
+
* @default 'default'
|
|
12
|
+
*/
|
|
13
|
+
variant?: SurfaceVariants;
|
|
14
|
+
}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
export const colors = {
|
|
2
|
+
// ----- BRAND COLORS -----
|
|
3
|
+
primary: {
|
|
4
|
+
50: '#F0F7FF',
|
|
5
|
+
100: '#D9E9FF',
|
|
6
|
+
200: '#B3D3FF',
|
|
7
|
+
300: '#8DBDFF',
|
|
8
|
+
400: '#66A7FF',
|
|
9
|
+
500: '#3F91FF', // main brand color
|
|
10
|
+
600: '#2376E6',
|
|
11
|
+
700: '#1658B3',
|
|
12
|
+
800: '#0A3A80',
|
|
13
|
+
900: '#001D4D',
|
|
14
|
+
},
|
|
15
|
+
|
|
16
|
+
secondary: {
|
|
17
|
+
50: '#F5F5FF',
|
|
18
|
+
100: '#E6E4FF',
|
|
19
|
+
200: '#C8C4FF',
|
|
20
|
+
300: '#AAA3FF',
|
|
21
|
+
400: '#8C82FF',
|
|
22
|
+
500: '#6E61FF', // accent / complementary
|
|
23
|
+
600: '#554ACC',
|
|
24
|
+
700: '#3D3499',
|
|
25
|
+
800: '#251E66',
|
|
26
|
+
900: '#100A33',
|
|
27
|
+
},
|
|
28
|
+
|
|
29
|
+
// ----- STATUS COLORS -----
|
|
30
|
+
success: {
|
|
31
|
+
50: '#EBFDF3',
|
|
32
|
+
100: '#C8F9DF',
|
|
33
|
+
200: '#A3F3C6',
|
|
34
|
+
300: '#7DEDAE',
|
|
35
|
+
400: '#57E796',
|
|
36
|
+
500: '#32D880', // success default
|
|
37
|
+
600: '#28B56A',
|
|
38
|
+
700: '#1E9254',
|
|
39
|
+
800: '#146F3E',
|
|
40
|
+
900: '#0A4C28',
|
|
41
|
+
},
|
|
42
|
+
|
|
43
|
+
warning: {
|
|
44
|
+
50: '#FFFAEA',
|
|
45
|
+
100: '#FFF2C2',
|
|
46
|
+
200: '#FFE08A',
|
|
47
|
+
300: '#FFCE52',
|
|
48
|
+
400: '#FFBC1A',
|
|
49
|
+
500: '#F5A000', // warning default
|
|
50
|
+
600: '#CC8300',
|
|
51
|
+
700: '#A36600',
|
|
52
|
+
800: '#7A4A00',
|
|
53
|
+
900: '#523000',
|
|
54
|
+
},
|
|
55
|
+
|
|
56
|
+
danger: {
|
|
57
|
+
50: '#FFF5F5',
|
|
58
|
+
100: '#FFE0E0',
|
|
59
|
+
200: '#FFB8B8',
|
|
60
|
+
300: '#FF8A8A',
|
|
61
|
+
400: '#FF5C5C',
|
|
62
|
+
500: '#FF2E2E', // danger default
|
|
63
|
+
600: '#CC2323',
|
|
64
|
+
700: '#991A1A',
|
|
65
|
+
800: '#661212',
|
|
66
|
+
900: '#330909',
|
|
67
|
+
},
|
|
68
|
+
|
|
69
|
+
error: {
|
|
70
|
+
50: '#FFF4F2',
|
|
71
|
+
100: '#FFE3DE',
|
|
72
|
+
200: '#FFC0B8',
|
|
73
|
+
300: '#FF9A8E',
|
|
74
|
+
400: '#FF6B5C',
|
|
75
|
+
500: '#F04438', // common red error
|
|
76
|
+
600: '#D92D20',
|
|
77
|
+
700: '#B42318',
|
|
78
|
+
800: '#912018',
|
|
79
|
+
900: '#7A271A',
|
|
80
|
+
},
|
|
81
|
+
|
|
82
|
+
// ----- DISABLED -----
|
|
83
|
+
disabled: {
|
|
84
|
+
bg: '#E5E7EB',
|
|
85
|
+
text: '#9CA3AF',
|
|
86
|
+
border: '#D1D5DB',
|
|
87
|
+
},
|
|
88
|
+
|
|
89
|
+
// ----- NEUTRALS -----
|
|
90
|
+
gray: {
|
|
91
|
+
50: '#F9FAFB',
|
|
92
|
+
100: '#F3F4F6',
|
|
93
|
+
200: '#E5E7EB',
|
|
94
|
+
300: '#D1D5DB',
|
|
95
|
+
400: '#9CA3AF',
|
|
96
|
+
500: '#6B7280',
|
|
97
|
+
600: '#4B5563',
|
|
98
|
+
700: '#374151',
|
|
99
|
+
800: '#1F2937',
|
|
100
|
+
900: '#111827',
|
|
101
|
+
},
|
|
102
|
+
|
|
103
|
+
// ----- BACKGROUND -----
|
|
104
|
+
background: {
|
|
105
|
+
primary: '#FFFFFF',
|
|
106
|
+
secondary: '#F7F7F8',
|
|
107
|
+
tertiary: '#EFEFF1',
|
|
108
|
+
disabled: '#E5E7EB',
|
|
109
|
+
},
|
|
110
|
+
|
|
111
|
+
// ----- TEXT -----
|
|
112
|
+
text: {
|
|
113
|
+
primary: '#111827',
|
|
114
|
+
secondary: '#4B5563',
|
|
115
|
+
muted: '#6B7280',
|
|
116
|
+
inverted: '#FFFFFF',
|
|
117
|
+
},
|
|
118
|
+
|
|
119
|
+
// ----- BLACK & WHITE -----
|
|
120
|
+
white: '#FFFFFF',
|
|
121
|
+
black: '#000000',
|
|
122
|
+
transparent: 'transparent',
|
|
123
|
+
} as const;
|
|
124
|
+
|
|
125
|
+
export type ColorToken = typeof colors;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { colors } from './colors';
|
|
2
|
+
import { radii } from './radius';
|
|
3
|
+
import { sizes } from './size';
|
|
4
|
+
import { spacing } from './spacing';
|
|
5
|
+
import type { ThemeDefinition } from './types';
|
|
6
|
+
import { typography } from './typography';
|
|
7
|
+
|
|
8
|
+
export const LightTheme: ThemeDefinition = {
|
|
9
|
+
color: colors,
|
|
10
|
+
size: sizes,
|
|
11
|
+
spacing: spacing,
|
|
12
|
+
typography: typography,
|
|
13
|
+
radius: radii,
|
|
14
|
+
components: {
|
|
15
|
+
card: {
|
|
16
|
+
border_radius: radii.md,
|
|
17
|
+
padding: spacing.lg,
|
|
18
|
+
shadow_color: colors.black,
|
|
19
|
+
shadow_offset: { width: 0, height: 2 },
|
|
20
|
+
shadow_opacity: 0.1,
|
|
21
|
+
shadow_radius: radii.sm,
|
|
22
|
+
elevation: 3,
|
|
23
|
+
},
|
|
24
|
+
surface: {
|
|
25
|
+
default_background_color: colors.primary[50],
|
|
26
|
+
secondary_background_color: colors.primary[100],
|
|
27
|
+
transparent_background_color: colors.transparent,
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { CardStyleVariables } from '../components/Card/styles';
|
|
2
|
+
import type { SurfaceStyleVariables } from '../components/Surface/styles';
|
|
3
|
+
import type { colors } from './colors';
|
|
4
|
+
import type { radii } from './radius';
|
|
5
|
+
import type { sizes } from './size';
|
|
6
|
+
import type { spacing } from './spacing';
|
|
7
|
+
import type { typography } from './typography';
|
|
8
|
+
|
|
9
|
+
export type ThemeDefinition = {
|
|
10
|
+
color: typeof colors;
|
|
11
|
+
size: typeof sizes;
|
|
12
|
+
spacing: typeof spacing;
|
|
13
|
+
typography: typeof typography;
|
|
14
|
+
radius: typeof radii;
|
|
15
|
+
components: {
|
|
16
|
+
card: CardStyleVariables;
|
|
17
|
+
surface: SurfaceStyleVariables;
|
|
18
|
+
};
|
|
19
|
+
};
|