@impulse-ui-native/theme 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,125 @@
1
+ import { DimensionValue } from "react-native";
2
+
3
+ export type SpaceSizesKeys =
4
+ | "none"
5
+ | "auto"
6
+ | "xxs"
7
+ | "xs"
8
+ | "mxs"
9
+ | "sm"
10
+ | "msm"
11
+ | "md"
12
+ | "lg"
13
+ | "xl"
14
+ | "xxl";
15
+ export type Space = Record<SpaceSizesKeys, DimensionValue>;
16
+
17
+ export type FontSizesKeys =
18
+ | "xxs"
19
+ | "xs"
20
+ | "xsm"
21
+ | "sm"
22
+ | "md"
23
+ | "lg"
24
+ | "xl"
25
+ | "xxl"
26
+ | "xxxl"
27
+ | "huge"
28
+ | "massive";
29
+ export type FontSizes = Record<FontSizesKeys, number>;
30
+
31
+ export type LineHeightKeys = "xxs" | "xs" | "sm" | "md" | "lg" | "xl" | "xxl";
32
+ export type LineHeights = Record<LineHeightKeys, string>;
33
+
34
+ export type FontWeightKey =
35
+ | "thin"
36
+ | "extraLight"
37
+ | "light"
38
+ | "regular"
39
+ | "medium"
40
+ | "semiBold"
41
+ | "bold"
42
+ | "extraBold"
43
+ | "black";
44
+ export type FontWeights = Record<
45
+ FontWeightKey,
46
+ "100" | "200" | "300" | "400" | "500" | "600" | "700" | "800" | "900"
47
+ >;
48
+
49
+ export type LetterSpacingKey =
50
+ | "tightest"
51
+ | "tighter"
52
+ | "tight"
53
+ | "normal"
54
+ | "wide"
55
+ | "wider"
56
+ | "widest"
57
+ | "ultraWide";
58
+ export type LetterSpacings = Record<LetterSpacingKey, number>;
59
+
60
+ export type BorderSizeKey = "sm" | "md" | "lg" | "xl" | "xxl";
61
+ export type BorderSizes = Record<BorderSizeKey, number>;
62
+
63
+ export type RadiusKey = "sm" | "md" | "lg" | "xl" | "xxl" | "xxxl" | "round";
64
+ export type Radii = Record<RadiusKey, number>;
65
+
66
+ export type RadiusDrawnKey =
67
+ | "drawn1"
68
+ | "drawn2"
69
+ | "drawn3"
70
+ | "drawn4"
71
+ | "drawn5"
72
+ | "drawn6";
73
+ export type RadiiDrawn = Record<RadiusDrawnKey, string>;
74
+
75
+ export type RadiusBlobKey = "blob1" | "blob2" | "blob3" | "blob4" | "blob5";
76
+ export type RadiiBlob = Record<RadiusBlobKey, string>;
77
+
78
+ export type RadiusConditionalKey =
79
+ | "conditional1"
80
+ | "conditional2"
81
+ | "conditional3"
82
+ | "conditional4"
83
+ | "conditional5"
84
+ | "conditional6";
85
+ export type RadiiConditional = Record<RadiusConditionalKey, string>;
86
+
87
+ export type NeutralColorKey =
88
+ | "0"
89
+ | "1"
90
+ | "2"
91
+ | "3"
92
+ | "4"
93
+ | "5"
94
+ | "6"
95
+ | "7"
96
+ | "8"
97
+ | "9"
98
+ | "10"
99
+ | "11"
100
+ | "12"
101
+ | "13";
102
+
103
+ export type NeutralColors = Record<NeutralColorKey, string>;
104
+
105
+ export type FontFamilyKey =
106
+ | "thin"
107
+ | "thinItalic"
108
+ | "extraLight"
109
+ | "extraLightItalic"
110
+ | "light"
111
+ | "lightItalic"
112
+ | "regular"
113
+ | "italic"
114
+ | "medium"
115
+ | "mediumItalic"
116
+ | "semiBold"
117
+ | "semiBoldItalic"
118
+ | "bold"
119
+ | "boldItalic"
120
+ | "extraBold"
121
+ | "extraBoldItalic"
122
+ | "black"
123
+ | "blackItalic";
124
+
125
+ export type FontFamilyMap = Record<FontFamilyKey, string>;
@@ -0,0 +1,42 @@
1
+ import { TextStyle } from 'react-native';
2
+
3
+ export type TypographyProps = {
4
+ fontSize?: TextStyle['fontSize'];
5
+ fontFamily?: TextStyle['fontFamily'];
6
+ fontWeight?: TextStyle['fontWeight'];
7
+ fontStyle?: TextStyle['fontStyle'];
8
+ letterSpacing?: TextStyle['letterSpacing'];
9
+ lineHeight?: TextStyle['lineHeight'];
10
+ textAlign?: TextStyle['textAlign'];
11
+ textDecorationLine?: TextStyle['textDecorationLine'];
12
+ textDecorationStyle?: TextStyle['textDecorationStyle'];
13
+ textDecorationColor?: TextStyle['textDecorationColor'];
14
+ textTransform?: TextStyle['textTransform'];
15
+ includeFontPadding?: TextStyle['includeFontPadding']; // Android only
16
+ textAlignVertical?: TextStyle['textAlignVertical']; // Android only
17
+ writingDirection?: TextStyle['writingDirection'];
18
+ };
19
+
20
+ export type TypographyPresetKey =
21
+ | 'Master'
22
+ | 'DisplayLarge'
23
+ | 'DisplayMedium'
24
+ | 'DisplaySmall'
25
+ | 'Title1'
26
+ | 'Title2'
27
+ | 'Title3'
28
+ | 'Title4'
29
+ | 'Title5'
30
+ | 'Title6'
31
+ | 'Subtitle1'
32
+ | 'Subtitle2'
33
+ | 'BodyLarge'
34
+ | 'Body'
35
+ | 'BodySmall'
36
+ | 'Caption'
37
+ | 'Label'
38
+ | 'Overline'
39
+ | 'Helper'
40
+ | 'Code'
41
+ | 'Quote'
42
+ | 'Eyebrow';
@@ -0,0 +1 @@
1
+ export * from './style.utils';
@@ -0,0 +1,31 @@
1
+ import { StylePropsSet } from '../constants';
2
+ import { StylePropKey, StyleProps } from '../types';
3
+
4
+ const isStylePropKey = (k: string): k is StylePropKey =>
5
+ StylePropsSet.has(k as StylePropKey);
6
+
7
+ export const extractStyleProps = <Props extends object>(
8
+ props: Props
9
+ ): StyleProps => {
10
+ const style: StyleProps = {};
11
+
12
+ for (const k in props) {
13
+ if (isStylePropKey(k) && props[k] !== undefined) {
14
+ style[k] = props[k] as any;
15
+ }
16
+ }
17
+
18
+ return style;
19
+ };
20
+
21
+ export const createStyleKey = <Props extends object>(props: Props) => {
22
+ let key = '';
23
+
24
+ for (const k in props) {
25
+ if (isStylePropKey(k)) {
26
+ key += String(props[k as keyof Props]);
27
+ }
28
+ }
29
+
30
+ return key;
31
+ };