@hoddy-ui/core 1.0.87 → 1.0.89
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/next/components/AdaptiveStatusBarNext.tsx +38 -0
- package/next/dist/index.d.mts +548 -0
- package/next/dist/index.d.ts +548 -0
- package/next/dist/index.js +2097 -0
- package/next/dist/index.js.map +1 -0
- package/next/dist/index.mjs +2061 -0
- package/next/dist/index.mjs.map +1 -0
- package/next/index.ts +33 -0
- package/next/package.json +50 -0
- package/next/tsup.config.ts +11 -0
- package/package.json +1 -1
- package/src/Components/Button.tsx +91 -81
- package/src/Components/TextField.tsx +1 -20
- package/src/Components/Typography.tsx +55 -48
- package/src/theme/colors.ts +63 -63
|
@@ -1,54 +1,61 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import {
|
|
3
|
-
import { moderateScale,
|
|
1
|
+
import React, { forwardRef } from "react";
|
|
2
|
+
import { StyleSheet, Text } from "react-native";
|
|
3
|
+
import { moderateScale, verticalScale } from "react-native-size-matters";
|
|
4
4
|
import { useColors } from "../hooks";
|
|
5
5
|
import { TypographyProps } from "../types";
|
|
6
6
|
|
|
7
|
-
const Typography: React.FC<TypographyProps> = (
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
h1: moderateScale(42),
|
|
22
|
-
h2: moderateScale(37),
|
|
23
|
-
h3: moderateScale(32),
|
|
24
|
-
h4: moderateScale(27),
|
|
25
|
-
h5: moderateScale(22),
|
|
26
|
-
h6: moderateScale(17),
|
|
27
|
-
body1: moderateScale(15),
|
|
28
|
-
body2: moderateScale(12),
|
|
29
|
-
caption: moderateScale(10),
|
|
30
|
-
};
|
|
31
|
-
const styles: any = StyleSheet.create({
|
|
32
|
-
text: {
|
|
33
|
-
fontSize: fontSize[variant],
|
|
34
|
-
marginBottom: verticalScale(gutterBottom) || 0,
|
|
35
|
-
color: colors[color]?.main || color,
|
|
36
|
-
textTransform: textCase,
|
|
37
|
-
alignItems: "center",
|
|
38
|
-
textAlign: align,
|
|
39
|
-
fontWeight: fontWeight.toString(),
|
|
7
|
+
const Typography: React.FC<TypographyProps> = forwardRef(
|
|
8
|
+
(
|
|
9
|
+
{
|
|
10
|
+
children,
|
|
11
|
+
color = "dark",
|
|
12
|
+
style = {},
|
|
13
|
+
textCase = null,
|
|
14
|
+
variant = "body1",
|
|
15
|
+
align = "left",
|
|
16
|
+
gutterBottom = 0,
|
|
17
|
+
numberOfLines,
|
|
18
|
+
adjustsFontSizeToFit,
|
|
19
|
+
fontWeight = 400,
|
|
20
|
+
...props
|
|
40
21
|
},
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
22
|
+
ref
|
|
23
|
+
) => {
|
|
24
|
+
const colors: any = useColors();
|
|
25
|
+
const fontSize = {
|
|
26
|
+
h1: moderateScale(42),
|
|
27
|
+
h2: moderateScale(37),
|
|
28
|
+
h3: moderateScale(32),
|
|
29
|
+
h4: moderateScale(27),
|
|
30
|
+
h5: moderateScale(22),
|
|
31
|
+
h6: moderateScale(17),
|
|
32
|
+
body1: moderateScale(15),
|
|
33
|
+
body2: moderateScale(12),
|
|
34
|
+
caption: moderateScale(10),
|
|
35
|
+
};
|
|
36
|
+
const styles: any = StyleSheet.create({
|
|
37
|
+
text: {
|
|
38
|
+
fontSize: fontSize[variant],
|
|
39
|
+
marginBottom: verticalScale(gutterBottom) || 0,
|
|
40
|
+
color: colors[color]?.main || color,
|
|
41
|
+
textTransform: textCase,
|
|
42
|
+
alignItems: "center",
|
|
43
|
+
textAlign: align,
|
|
44
|
+
fontWeight: fontWeight.toString(),
|
|
45
|
+
},
|
|
46
|
+
});
|
|
47
|
+
return (
|
|
48
|
+
<Text
|
|
49
|
+
ref={ref as any}
|
|
50
|
+
numberOfLines={numberOfLines}
|
|
51
|
+
adjustsFontSizeToFit={adjustsFontSizeToFit}
|
|
52
|
+
style={{ ...styles.text, ...style }}
|
|
53
|
+
{...props}
|
|
54
|
+
>
|
|
55
|
+
{children}
|
|
56
|
+
</Text>
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
);
|
|
52
60
|
|
|
53
|
-
<Typography color="#f90">col</Typography>;
|
|
54
61
|
export default Typography;
|
package/src/theme/colors.ts
CHANGED
|
@@ -1,73 +1,73 @@
|
|
|
1
1
|
import { ThemeTypes, extraColorTypes } from "../types";
|
|
2
2
|
|
|
3
|
-
const lightColors = {
|
|
4
|
-
white: {
|
|
5
|
-
1: "#fff",
|
|
6
|
-
2: "#f7f7f7",
|
|
7
|
-
3: "#eee",
|
|
8
|
-
4: "#ddd",
|
|
9
|
-
5: "#bbb",
|
|
10
|
-
},
|
|
11
|
-
black: {
|
|
12
|
-
1: "#888",
|
|
13
|
-
2: "#777",
|
|
14
|
-
3: "#555",
|
|
15
|
-
4: "#333",
|
|
16
|
-
5: "#000",
|
|
17
|
-
},
|
|
18
|
-
};
|
|
19
|
-
|
|
20
3
|
let extraColors: extraColorTypes = {};
|
|
21
4
|
|
|
22
5
|
export const setExtraColors = (c: extraColorTypes) => (extraColors = c);
|
|
23
6
|
|
|
24
|
-
const darkColors = {
|
|
25
|
-
black: {
|
|
26
|
-
1: "#fff",
|
|
27
|
-
2: "#f7f7f7",
|
|
28
|
-
3: "#eee",
|
|
29
|
-
4: "#ddd",
|
|
30
|
-
5: "#aaa",
|
|
31
|
-
},
|
|
32
|
-
white: {
|
|
33
|
-
1: "#000",
|
|
34
|
-
2: "#222",
|
|
35
|
-
3: "#333",
|
|
36
|
-
4: "#444",
|
|
37
|
-
5: "#555",
|
|
38
|
-
},
|
|
39
|
-
dark: {
|
|
40
|
-
main: "#f2f3f4",
|
|
41
|
-
light: "#fff",
|
|
42
|
-
dark: "#ddd",
|
|
43
|
-
text: "#000",
|
|
44
|
-
...extraColors?.dark?.dark,
|
|
45
|
-
},
|
|
46
|
-
light: {
|
|
47
|
-
main: "#111",
|
|
48
|
-
light: "#555",
|
|
49
|
-
dark: "#333",
|
|
50
|
-
text: "#fff",
|
|
51
|
-
...extraColors?.dark?.light,
|
|
52
|
-
},
|
|
53
|
-
textSecondary: {
|
|
54
|
-
main: "#666",
|
|
55
|
-
light: "#777",
|
|
56
|
-
dark: "#444",
|
|
57
|
-
text: "#fff",
|
|
58
|
-
...extraColors?.dark?.textSecondary,
|
|
59
|
-
},
|
|
60
|
-
primary: {
|
|
61
|
-
main: "#f80",
|
|
62
|
-
light: "#FEFFD3",
|
|
63
|
-
dark: "#fa0",
|
|
64
|
-
text: "#fff",
|
|
65
|
-
...extraColors?.light?.primary,
|
|
66
|
-
...extraColors?.dark?.primary,
|
|
67
|
-
},
|
|
68
|
-
};
|
|
69
|
-
|
|
70
7
|
export default function colors(theme: ThemeTypes) {
|
|
8
|
+
const lightColors = {
|
|
9
|
+
white: {
|
|
10
|
+
1: "#fff",
|
|
11
|
+
2: "#f7f7f7",
|
|
12
|
+
3: "#eee",
|
|
13
|
+
4: "#ddd",
|
|
14
|
+
5: "#bbb",
|
|
15
|
+
},
|
|
16
|
+
black: {
|
|
17
|
+
1: "#888",
|
|
18
|
+
2: "#777",
|
|
19
|
+
3: "#555",
|
|
20
|
+
4: "#333",
|
|
21
|
+
5: "#000",
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const darkColors = {
|
|
26
|
+
black: {
|
|
27
|
+
1: "#fff",
|
|
28
|
+
2: "#f7f7f7",
|
|
29
|
+
3: "#eee",
|
|
30
|
+
4: "#ddd",
|
|
31
|
+
5: "#aaa",
|
|
32
|
+
},
|
|
33
|
+
white: {
|
|
34
|
+
1: "#000",
|
|
35
|
+
2: "#222",
|
|
36
|
+
3: "#333",
|
|
37
|
+
4: "#444",
|
|
38
|
+
5: "#555",
|
|
39
|
+
},
|
|
40
|
+
dark: {
|
|
41
|
+
main: "#f2f3f4",
|
|
42
|
+
light: "#fff",
|
|
43
|
+
dark: "#ddd",
|
|
44
|
+
text: "#000",
|
|
45
|
+
...extraColors?.dark?.dark,
|
|
46
|
+
},
|
|
47
|
+
light: {
|
|
48
|
+
main: "#111",
|
|
49
|
+
light: "#555",
|
|
50
|
+
dark: "#333",
|
|
51
|
+
text: "#fff",
|
|
52
|
+
...extraColors?.dark?.light,
|
|
53
|
+
},
|
|
54
|
+
textSecondary: {
|
|
55
|
+
main: "#666",
|
|
56
|
+
light: "#777",
|
|
57
|
+
dark: "#444",
|
|
58
|
+
text: "#fff",
|
|
59
|
+
...extraColors?.dark?.textSecondary,
|
|
60
|
+
},
|
|
61
|
+
primary: {
|
|
62
|
+
main: "#f80",
|
|
63
|
+
light: "#FEFFD3",
|
|
64
|
+
dark: "#fa0",
|
|
65
|
+
text: "#fff",
|
|
66
|
+
...extraColors?.light?.primary,
|
|
67
|
+
...extraColors?.dark?.primary,
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
|
|
71
71
|
const dynamicColors = theme === "dark" ? darkColors : lightColors;
|
|
72
72
|
return {
|
|
73
73
|
...extraColors[theme],
|