@dryanovski/react-native-components 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 (65) hide show
  1. package/lib/module/assets/fonts/CodanBold.ttf +0 -0
  2. package/lib/module/assets/fonts/CodanBook.ttf +0 -0
  3. package/lib/module/assets/fonts/CodanLight.ttf +0 -0
  4. package/lib/module/assets/fonts/CodanMedium.ttf +0 -0
  5. package/lib/module/assets/fonts/CodanRegular.ttf +0 -0
  6. package/lib/module/components/Button/Button.js +41 -0
  7. package/lib/module/components/Button/Button.js.map +1 -0
  8. package/lib/module/components/Button/DangerButton.js +19 -0
  9. package/lib/module/components/Button/DangerButton.js.map +1 -0
  10. package/lib/module/components/Button/GhostButton.js +15 -0
  11. package/lib/module/components/Button/GhostButton.js.map +1 -0
  12. package/lib/module/components/Button/PrimaryButton.js +18 -0
  13. package/lib/module/components/Button/PrimaryButton.js.map +1 -0
  14. package/lib/module/components/Button/SecondaryButton.js +18 -0
  15. package/lib/module/components/Button/SecondaryButton.js.map +1 -0
  16. package/lib/module/components/Button/style.js +66 -0
  17. package/lib/module/components/Button/style.js.map +1 -0
  18. package/lib/module/components/Button/types.js +4 -0
  19. package/lib/module/components/Button/types.js.map +1 -0
  20. package/lib/module/providers/ThemeProvider.js +20 -1
  21. package/lib/module/providers/ThemeProvider.js.map +1 -1
  22. package/lib/module/utils/fontScale.js +66 -0
  23. package/lib/module/utils/fontScale.js.map +1 -0
  24. package/lib/module/utils/getDeviceType.js +20 -0
  25. package/lib/module/utils/getDeviceType.js.map +1 -0
  26. package/lib/module/utils/getScreenSizeCategory.js +16 -0
  27. package/lib/module/utils/getScreenSizeCategory.js.map +1 -0
  28. package/lib/typescript/src/components/Button/Button.d.ts +10 -0
  29. package/lib/typescript/src/components/Button/Button.d.ts.map +1 -0
  30. package/lib/typescript/src/components/Button/DangerButton.d.ts +8 -0
  31. package/lib/typescript/src/components/Button/DangerButton.d.ts.map +1 -0
  32. package/lib/typescript/src/components/Button/GhostButton.d.ts +4 -0
  33. package/lib/typescript/src/components/Button/GhostButton.d.ts.map +1 -0
  34. package/lib/typescript/src/components/Button/PrimaryButton.d.ts +7 -0
  35. package/lib/typescript/src/components/Button/PrimaryButton.d.ts.map +1 -0
  36. package/lib/typescript/src/components/Button/SecondaryButton.d.ts +7 -0
  37. package/lib/typescript/src/components/Button/SecondaryButton.d.ts.map +1 -0
  38. package/lib/typescript/src/components/Button/style.d.ts +64 -0
  39. package/lib/typescript/src/components/Button/style.d.ts.map +1 -0
  40. package/lib/typescript/src/components/Button/types.d.ts +40 -0
  41. package/lib/typescript/src/components/Button/types.d.ts.map +1 -0
  42. package/lib/typescript/src/providers/ThemeProvider.d.ts.map +1 -1
  43. package/lib/typescript/src/utils/fontScale.d.ts +2 -0
  44. package/lib/typescript/src/utils/fontScale.d.ts.map +1 -0
  45. package/lib/typescript/src/utils/getDeviceType.d.ts +2 -0
  46. package/lib/typescript/src/utils/getDeviceType.d.ts.map +1 -0
  47. package/lib/typescript/src/utils/getScreenSizeCategory.d.ts +2 -0
  48. package/lib/typescript/src/utils/getScreenSizeCategory.d.ts.map +1 -0
  49. package/package.json +4 -3
  50. package/src/assets/fonts/CodanBold.ttf +0 -0
  51. package/src/assets/fonts/CodanBook.ttf +0 -0
  52. package/src/assets/fonts/CodanLight.ttf +0 -0
  53. package/src/assets/fonts/CodanMedium.ttf +0 -0
  54. package/src/assets/fonts/CodanRegular.ttf +0 -0
  55. package/src/components/Button/Button.tsx +57 -0
  56. package/src/components/Button/DangerButton.tsx +17 -0
  57. package/src/components/Button/GhostButton.tsx +13 -0
  58. package/src/components/Button/PrimaryButton.tsx +16 -0
  59. package/src/components/Button/SecondaryButton.tsx +16 -0
  60. package/src/components/Button/style.ts +76 -0
  61. package/src/components/Button/types.ts +50 -0
  62. package/src/providers/ThemeProvider.tsx +20 -0
  63. package/src/utils/fontScale.ts +51 -0
  64. package/src/utils/getDeviceType.ts +20 -0
  65. package/src/utils/getScreenSizeCategory.ts +12 -0
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+
3
+ import { forwardRef } from 'react';
4
+ import { Text, TouchableOpacity } from 'react-native';
5
+ import Styles from "./style.js";
6
+ import { jsx as _jsx } from "react/jsx-runtime";
7
+ /**
8
+ * A customizable button component that supports different variants and sizes.
9
+ * @return A TouchableOpacity button with text.
10
+ */
11
+ export const Button = /*#__PURE__*/forwardRef((props, ref) => {
12
+ const {
13
+ variant = 'primary',
14
+ title,
15
+ size = 'medium',
16
+ onPress = () => undefined,
17
+ style,
18
+ disabled = false,
19
+ textStyle,
20
+ ...rest
21
+ } = props;
22
+
23
+ /**
24
+ * Derives the text style variant based on the button variant.
25
+ */
26
+ const textVariant = 'text_' + variant;
27
+ return /*#__PURE__*/_jsx(TouchableOpacity, {
28
+ ref: ref,
29
+ onPress: onPress,
30
+ disabled: disabled,
31
+ style: [Styles._base, Styles[size], Styles[variant], disabled && Styles._disabled, style],
32
+ ...rest,
33
+ children: /*#__PURE__*/_jsx(Text, {
34
+ style: [Styles._text, Styles[textVariant], textStyle],
35
+ children: title
36
+ })
37
+ });
38
+ });
39
+ Button.displayName = 'ButtonBase';
40
+ export default Button;
41
+ //# sourceMappingURL=Button.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["forwardRef","Text","TouchableOpacity","Styles","jsx","_jsx","Button","props","ref","variant","title","size","onPress","undefined","style","disabled","textStyle","rest","textVariant","_base","_disabled","children","_text","displayName"],"sourceRoot":"../../../../src","sources":["components/Button/Button.tsx"],"mappings":";;AAAA,SAASA,UAAU,QAA2B,OAAO;AACrD,SAASC,IAAI,EAAEC,gBAAgB,QAAQ,cAAc;AACrD,OAAOC,MAAM,MAAM,YAAS;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAU7B;AACA;AACA;AACA;AACA,OAAO,MAAMC,MAAM,gBAAGN,UAAU,CAA6B,CAACO,KAAK,EAAEC,GAAG,KAAK;EAC3E,MAAM;IACJC,OAAO,GAAG,SAAS;IACnBC,KAAK;IACLC,IAAI,GAAG,QAAQ;IACfC,OAAO,GAAGA,CAAA,KAAMC,SAAS;IACzBC,KAAK;IACLC,QAAQ,GAAG,KAAK;IAChBC,SAAS;IACT,GAAGC;EACL,CAAC,GAAGV,KAAK;;EAET;AACF;AACA;EACE,MAAMW,WAAW,GAAI,OAAO,GAAGT,OAAmC;EAElE,oBACEJ,IAAA,CAACH,gBAAgB;IACfM,GAAG,EAAEA,GAAI;IACTI,OAAO,EAAEA,OAAQ;IACjBG,QAAQ,EAAEA,QAAS;IACnBD,KAAK,EAAE,CACLX,MAAM,CAACgB,KAAK,EACZhB,MAAM,CAACQ,IAAI,CAAe,EAC1BR,MAAM,CAACM,OAAO,CAAkB,EAChCM,QAAQ,IAAIZ,MAAM,CAACiB,SAAS,EAC5BN,KAAK,CACL;IAAA,GACEG,IAAI;IAAAI,QAAA,eAERhB,IAAA,CAACJ,IAAI;MAACa,KAAK,EAAE,CAACX,MAAM,CAACmB,KAAK,EAAEnB,MAAM,CAACe,WAAW,CAAC,EAAEF,SAAS,CAAE;MAAAK,QAAA,EACzDX;IAAK,CACF;EAAC,CACS,CAAC;AAEvB,CAAC,CAAC;AAEFJ,MAAM,CAACiB,WAAW,GAAG,YAAY;AAEjC,eAAejB,MAAM","ignoreList":[]}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+
3
+ import { forwardRef } from 'react';
4
+ import { Button } from "./Button.js";
5
+ import { jsx as _jsx } from "react/jsx-runtime";
6
+ /**
7
+ * A button component styled for dangerous actions, such as deletions.
8
+ * @returns A ButtonBase component with the "danger" variant.
9
+ */
10
+ export const DangerButton = /*#__PURE__*/forwardRef((props, ref) => {
11
+ return /*#__PURE__*/_jsx(Button, {
12
+ ref: ref,
13
+ variant: "danger",
14
+ ...props
15
+ });
16
+ });
17
+ DangerButton.displayName = 'DangerButton';
18
+ export default DangerButton;
19
+ //# sourceMappingURL=DangerButton.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["forwardRef","Button","jsx","_jsx","DangerButton","props","ref","variant","displayName"],"sourceRoot":"../../../../src","sources":["components/Button/DangerButton.tsx"],"mappings":";;AAAA,SAASA,UAAU,QAAQ,OAAO;AAClC,SAASC,MAAM,QAA4B,aAAU;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAGtD;AACA;AACA;AACA;AACA,OAAO,MAAMC,YAAY,gBAAGJ,UAAU,CACpC,CAACK,KAAK,EAAEC,GAAG,KAAK;EACd,oBAAOH,IAAA,CAACF,MAAM;IAACK,GAAG,EAAEA,GAAI;IAACC,OAAO,EAAC,QAAQ;IAAA,GAAKF;EAAK,CAAG,CAAC;AACzD,CACF,CAAC;AAEDD,YAAY,CAACI,WAAW,GAAG,cAAc;AAEzC,eAAeJ,YAAY","ignoreList":[]}
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+
3
+ import { forwardRef } from 'react';
4
+ import { Button } from "./Button.js";
5
+ import { jsx as _jsx } from "react/jsx-runtime";
6
+ export const GhostButton = /*#__PURE__*/forwardRef((props, ref) => {
7
+ return /*#__PURE__*/_jsx(Button, {
8
+ ref: ref,
9
+ variant: "ghost",
10
+ ...props
11
+ });
12
+ });
13
+ GhostButton.displayName = 'GhostButton';
14
+ export default GhostButton;
15
+ //# sourceMappingURL=GhostButton.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["forwardRef","Button","jsx","_jsx","GhostButton","props","ref","variant","displayName"],"sourceRoot":"../../../../src","sources":["components/Button/GhostButton.tsx"],"mappings":";;AAAA,SAASA,UAAU,QAAQ,OAAO;AAClC,SAASC,MAAM,QAA4B,aAAU;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAGtD,OAAO,MAAMC,WAAW,gBAAGJ,UAAU,CACnC,CAACK,KAAK,EAAEC,GAAG,KAAK;EACd,oBAAOH,IAAA,CAACF,MAAM;IAACK,GAAG,EAAEA,GAAI;IAACC,OAAO,EAAC,OAAO;IAAA,GAAKF;EAAK,CAAG,CAAC;AACxD,CACF,CAAC;AAEDD,WAAW,CAACI,WAAW,GAAG,aAAa;AAEvC,eAAeJ,WAAW","ignoreList":[]}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+
3
+ import { forwardRef } from 'react';
4
+ import { Button } from "./Button.js";
5
+ import { jsx as _jsx } from "react/jsx-runtime";
6
+ /**
7
+ * A button component styled for primary actions.
8
+ */
9
+ export const PrimaryButton = /*#__PURE__*/forwardRef((props, ref) => {
10
+ return /*#__PURE__*/_jsx(Button, {
11
+ ref: ref,
12
+ variant: "primary",
13
+ ...props
14
+ });
15
+ });
16
+ PrimaryButton.displayName = 'PrimaryButton';
17
+ export default PrimaryButton;
18
+ //# sourceMappingURL=PrimaryButton.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["forwardRef","Button","jsx","_jsx","PrimaryButton","props","ref","variant","displayName"],"sourceRoot":"../../../../src","sources":["components/Button/PrimaryButton.tsx"],"mappings":";;AAAA,SAASA,UAAU,QAAQ,OAAO;AAClC,SAASC,MAAM,QAA4B,aAAU;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAGtD;AACA;AACA;AACA,OAAO,MAAMC,aAAa,gBAAGJ,UAAU,CACrC,CAACK,KAAK,EAAEC,GAAG,KAAK;EACd,oBAAOH,IAAA,CAACF,MAAM;IAACK,GAAG,EAAEA,GAAI;IAACC,OAAO,EAAC,SAAS;IAAA,GAAKF;EAAK,CAAG,CAAC;AAC1D,CACF,CAAC;AAEDD,aAAa,CAACI,WAAW,GAAG,eAAe;AAE3C,eAAeJ,aAAa","ignoreList":[]}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+
3
+ import { forwardRef } from 'react';
4
+ import { Button } from "./Button.js";
5
+ import { jsx as _jsx } from "react/jsx-runtime";
6
+ /**
7
+ * A button component styled for secondary actions.
8
+ */
9
+ export const SecondaryButton = /*#__PURE__*/forwardRef((props, ref) => {
10
+ return /*#__PURE__*/_jsx(Button, {
11
+ ref: ref,
12
+ variant: "secondary",
13
+ ...props
14
+ });
15
+ });
16
+ SecondaryButton.displayName = 'SecondaryButton';
17
+ export default SecondaryButton;
18
+ //# sourceMappingURL=SecondaryButton.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["forwardRef","Button","jsx","_jsx","SecondaryButton","props","ref","variant","displayName"],"sourceRoot":"../../../../src","sources":["components/Button/SecondaryButton.tsx"],"mappings":";;AAAA,SAASA,UAAU,QAAQ,OAAO;AAClC,SAASC,MAAM,QAA4B,aAAU;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAGtD;AACA;AACA;AACA,OAAO,MAAMC,eAAe,gBAAGJ,UAAU,CACvC,CAACK,KAAK,EAAEC,GAAG,KAAK;EACd,oBAAOH,IAAA,CAACF,MAAM;IAACK,GAAG,EAAEA,GAAI;IAACC,OAAO,EAAC,WAAW;IAAA,GAAKF;EAAK,CAAG,CAAC;AAC5D,CACF,CAAC;AAEDD,eAAe,CAACI,WAAW,GAAG,iBAAiB;AAE/C,eAAeJ,eAAe","ignoreList":[]}
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+
3
+ import Style from "../../utils/Style.js";
4
+ export const DEFAULT_BUTTON = {
5
+ primary_background_color: '#007bff',
6
+ primary_text_color: '#ffffff',
7
+ secondary_background_color: '#6c757d',
8
+ secondary_text_color: '#ffffff',
9
+ danger_background_color: '#dc3545',
10
+ danger_text_color: '#ffffff',
11
+ ghost_background_color: 'transparent',
12
+ ghost_text_color: '#007bff'
13
+ };
14
+ export const Styles = Style.create({
15
+ _base: {
16
+ paddingVertical: 12,
17
+ paddingHorizontal: 24,
18
+ borderRadius: 6,
19
+ alignItems: 'center',
20
+ justifyContent: 'center',
21
+ flexDirection: 'row',
22
+ gap: 10
23
+ },
24
+ _disabled: {
25
+ opacity: 0.6
26
+ },
27
+ small: {
28
+ paddingVertical: 8,
29
+ paddingHorizontal: 16
30
+ },
31
+ medium: {
32
+ paddingVertical: 12,
33
+ paddingHorizontal: 20
34
+ },
35
+ large: {
36
+ paddingVertical: 16,
37
+ paddingHorizontal: 24
38
+ },
39
+ _text: {},
40
+ text_primary: {
41
+ color: DEFAULT_BUTTON.primary_text_color
42
+ },
43
+ text_secondary: {
44
+ color: DEFAULT_BUTTON.secondary_text_color
45
+ },
46
+ text_danger: {
47
+ color: DEFAULT_BUTTON.danger_text_color
48
+ },
49
+ text_ghost: {
50
+ color: DEFAULT_BUTTON.ghost_text_color
51
+ },
52
+ primary: {
53
+ backgroundColor: DEFAULT_BUTTON.primary_background_color
54
+ },
55
+ secondary: {
56
+ backgroundColor: DEFAULT_BUTTON.secondary_background_color
57
+ },
58
+ danger: {
59
+ backgroundColor: DEFAULT_BUTTON.danger_background_color
60
+ },
61
+ ghost: {
62
+ backgroundColor: DEFAULT_BUTTON.ghost_background_color
63
+ }
64
+ });
65
+ export default Styles;
66
+ //# sourceMappingURL=style.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["Style","DEFAULT_BUTTON","primary_background_color","primary_text_color","secondary_background_color","secondary_text_color","danger_background_color","danger_text_color","ghost_background_color","ghost_text_color","Styles","create","_base","paddingVertical","paddingHorizontal","borderRadius","alignItems","justifyContent","flexDirection","gap","_disabled","opacity","small","medium","large","_text","text_primary","color","text_secondary","text_danger","text_ghost","primary","backgroundColor","secondary","danger","ghost"],"sourceRoot":"../../../../src","sources":["components/Button/style.ts"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,sBAAmB;AAErC,OAAO,MAAMC,cAAc,GAAG;EAC5BC,wBAAwB,EAAE,SAAS;EACnCC,kBAAkB,EAAE,SAAS;EAE7BC,0BAA0B,EAAE,SAAS;EACrCC,oBAAoB,EAAE,SAAS;EAE/BC,uBAAuB,EAAE,SAAS;EAClCC,iBAAiB,EAAE,SAAS;EAE5BC,sBAAsB,EAAE,aAAa;EACrCC,gBAAgB,EAAE;AACpB,CAAC;AAID,OAAO,MAAMC,MAAM,GAAGV,KAAK,CAACW,MAAM,CAAC;EACjCC,KAAK,EAAE;IACLC,eAAe,EAAE,EAAE;IACnBC,iBAAiB,EAAE,EAAE;IACrBC,YAAY,EAAE,CAAC;IACfC,UAAU,EAAE,QAAQ;IACpBC,cAAc,EAAE,QAAQ;IACxBC,aAAa,EAAE,KAAK;IACpBC,GAAG,EAAE;EACP,CAAC;EAEDC,SAAS,EAAE;IACTC,OAAO,EAAE;EACX,CAAC;EAEDC,KAAK,EAAE;IACLT,eAAe,EAAE,CAAC;IAClBC,iBAAiB,EAAE;EACrB,CAAC;EACDS,MAAM,EAAE;IACNV,eAAe,EAAE,EAAE;IACnBC,iBAAiB,EAAE;EACrB,CAAC;EACDU,KAAK,EAAE;IACLX,eAAe,EAAE,EAAE;IACnBC,iBAAiB,EAAE;EACrB,CAAC;EAEDW,KAAK,EAAE,CAAC,CAAC;EAETC,YAAY,EAAE;IACZC,KAAK,EAAE1B,cAAc,CAACE;EACxB,CAAC;EACDyB,cAAc,EAAE;IACdD,KAAK,EAAE1B,cAAc,CAACI;EACxB,CAAC;EACDwB,WAAW,EAAE;IACXF,KAAK,EAAE1B,cAAc,CAACM;EACxB,CAAC;EACDuB,UAAU,EAAE;IACVH,KAAK,EAAE1B,cAAc,CAACQ;EACxB,CAAC;EAEDsB,OAAO,EAAE;IACPC,eAAe,EAAE/B,cAAc,CAACC;EAClC,CAAC;EACD+B,SAAS,EAAE;IACTD,eAAe,EAAE/B,cAAc,CAACG;EAClC,CAAC;EACD8B,MAAM,EAAE;IACNF,eAAe,EAAE/B,cAAc,CAACK;EAClC,CAAC;EACD6B,KAAK,EAAE;IACLH,eAAe,EAAE/B,cAAc,CAACO;EAClC;AACF,CAAC,CAAC;AAEF,eAAeE,MAAM","ignoreList":[]}
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+
3
+ export {};
4
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"../../../../src","sources":["components/Button/types.ts"],"mappings":"","ignoreList":[]}
@@ -2,11 +2,13 @@
2
2
 
3
3
  import React, { useCallback, useContext, useEffect, useState } from 'react';
4
4
  import { useColorScheme as useDeviceColorScheme } from 'react-native';
5
- import { jsx as _jsx } from "react/jsx-runtime";
5
+ import * as Font from 'expo-font';
6
+
6
7
  /**
7
8
  * Create a ThemeContext with default value null
8
9
  * @type {React.Context<ThemeContextType | null>}
9
10
  */
11
+ import { jsx as _jsx } from "react/jsx-runtime";
10
12
  const ThemeContext = /*#__PURE__*/React.createContext(null);
11
13
 
12
14
  /**
@@ -56,6 +58,23 @@ export const ThemeProvider = ({
56
58
  }
57
59
  setTheme(newTheme);
58
60
  }, [deviceColorscheme]);
61
+ useEffect(() => {
62
+ (async function loadAsyncFonts() {
63
+ try {
64
+ await Font.loadAsync({
65
+ CodanRegular: require('../assets/fonts/CodanRegular.ttf'),
66
+ CodanBold: require('../assets/fonts/CodanBold.ttf'),
67
+ CodanBook: require('../assets/fonts/CodanBook.ttf'),
68
+ CodanLight: require('../assets/fonts/CodanLight.ttf'),
69
+ CodanMedium: require('../assets/fonts/CodanMedium.ttf')
70
+ });
71
+ } catch (e) {
72
+ console.warn('Error loading fonts:', e);
73
+ } finally {
74
+ console.log('Theme Fonts loaded');
75
+ }
76
+ })();
77
+ }, []);
59
78
  return /*#__PURE__*/_jsx(ThemeContext.Provider, {
60
79
  value: {
61
80
  theme: currentTheme,
@@ -1 +1 @@
1
- {"version":3,"names":["React","useCallback","useContext","useEffect","useState","useColorScheme","useDeviceColorScheme","jsx","_jsx","ThemeContext","createContext","useTheme","context","Error","ThemeProvider","children","theme","defaultTheme","onThemeChange","undefined","deviceColorscheme","currentTheme","setTheme","changeTheme","newTheme","Provider","value"],"sourceRoot":"../../../src","sources":["providers/ThemeProvider.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,WAAW,EAAEC,UAAU,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAC3E,SAASC,cAAc,IAAIC,oBAAoB,QAAQ,cAAc;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAOtE;AACA;AACA;AACA;AACA,MAAMC,YAAY,gBAAGT,KAAK,CAACU,aAAa,CAA0B,IAAI,CAAC;;AAEvE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,QAAQ,GAAGA,CAAA,KAAM;EAC5B,MAAMC,OAAO,GAAGV,UAAU,CAACO,YAAY,CAAC;EACxC,IAAI,CAACG,OAAO,EAAE;IACZ,MAAM,IAAIC,KAAK,CAAC,8CAA8C,CAAC;EACjE;EACA,OAAOD,OAAO;AAChB,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAME,aAA2C,GAAGA,CAAC;EAC1DC,QAAQ;EACRC,KAAK;EACLC,YAAY,GAAG,OAAO;EACtBC,aAAa,GAAGA,CAAA,KAAMC;AACxB,CAAC,KAAK;EACJ,MAAMC,iBAAiB,GAAGd,oBAAoB,CAAC,CAAC;EAChD,MAAM,CAACe,YAAY,EAAEC,QAAQ,CAAC,GAAGlB,QAAQ,CACvCY,KAAK,IAAIC,YACX,CAAC;EAEDd,SAAS,CAAC,MAAM;IACde,aAAa,IAAIF,KAAK,IAAIE,aAAa,CAACF,KAAK,CAAC;EAChD,CAAC,EAAE,CAACA,KAAK,EAAEE,aAAa,CAAC,CAAC;EAE1B,MAAMK,WAAW,GAAGtB,WAAW,CAC5BuB,QAAuB,IAAK;IAC3B,IAAIA,QAAQ,KAAK,QAAQ,EAAE;MACzBF,QAAQ,CAACF,iBAAiB,KAAK,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;MACzD;IACF;IACAE,QAAQ,CAACE,QAAQ,CAAC;EACpB,CAAC,EACD,CAACJ,iBAAiB,CACpB,CAAC;EAED,oBACEZ,IAAA,CAACC,YAAY,CAACgB,QAAQ;IAACC,KAAK,EAAE;MAAEV,KAAK,EAAEK,YAAY;MAAEE;IAAY,CAAE;IAAAR,QAAA,EAChEA;EAAQ,CACY,CAAC;AAE5B,CAAC;AAED,eAAeD,aAAa","ignoreList":[]}
1
+ {"version":3,"names":["React","useCallback","useContext","useEffect","useState","useColorScheme","useDeviceColorScheme","Font","jsx","_jsx","ThemeContext","createContext","useTheme","context","Error","ThemeProvider","children","theme","defaultTheme","onThemeChange","undefined","deviceColorscheme","currentTheme","setTheme","changeTheme","newTheme","loadAsyncFonts","loadAsync","CodanRegular","require","CodanBold","CodanBook","CodanLight","CodanMedium","e","console","warn","log","Provider","value"],"sourceRoot":"../../../src","sources":["providers/ThemeProvider.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,WAAW,EAAEC,UAAU,EAAEC,SAAS,EAAEC,QAAQ,QAAQ,OAAO;AAC3E,SAASC,cAAc,IAAIC,oBAAoB,QAAQ,cAAc;AAOrE,OAAO,KAAKC,IAAI,MAAM,WAAW;;AAEjC;AACA;AACA;AACA;AAHA,SAAAC,GAAA,IAAAC,IAAA;AAIA,MAAMC,YAAY,gBAAGV,KAAK,CAACW,aAAa,CAA0B,IAAI,CAAC;;AAEvE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,QAAQ,GAAGA,CAAA,KAAM;EAC5B,MAAMC,OAAO,GAAGX,UAAU,CAACQ,YAAY,CAAC;EACxC,IAAI,CAACG,OAAO,EAAE;IACZ,MAAM,IAAIC,KAAK,CAAC,8CAA8C,CAAC;EACjE;EACA,OAAOD,OAAO;AAChB,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAME,aAA2C,GAAGA,CAAC;EAC1DC,QAAQ;EACRC,KAAK;EACLC,YAAY,GAAG,OAAO;EACtBC,aAAa,GAAGA,CAAA,KAAMC;AACxB,CAAC,KAAK;EACJ,MAAMC,iBAAiB,GAAGf,oBAAoB,CAAC,CAAC;EAChD,MAAM,CAACgB,YAAY,EAAEC,QAAQ,CAAC,GAAGnB,QAAQ,CACvCa,KAAK,IAAIC,YACX,CAAC;EAEDf,SAAS,CAAC,MAAM;IACdgB,aAAa,IAAIF,KAAK,IAAIE,aAAa,CAACF,KAAK,CAAC;EAChD,CAAC,EAAE,CAACA,KAAK,EAAEE,aAAa,CAAC,CAAC;EAE1B,MAAMK,WAAW,GAAGvB,WAAW,CAC5BwB,QAAuB,IAAK;IAC3B,IAAIA,QAAQ,KAAK,QAAQ,EAAE;MACzBF,QAAQ,CAACF,iBAAiB,KAAK,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;MACzD;IACF;IACAE,QAAQ,CAACE,QAAQ,CAAC;EACpB,CAAC,EACD,CAACJ,iBAAiB,CACpB,CAAC;EAEDlB,SAAS,CAAC,MAAM;IACd,CAAC,eAAeuB,cAAcA,CAAA,EAAG;MAC/B,IAAI;QACF,MAAMnB,IAAI,CAACoB,SAAS,CAAC;UACnBC,YAAY,EAAEC,OAAO,CAAC,kCAAkC,CAAC;UACzDC,SAAS,EAAED,OAAO,CAAC,+BAA+B,CAAC;UACnDE,SAAS,EAAEF,OAAO,CAAC,+BAA+B,CAAC;UACnDG,UAAU,EAAEH,OAAO,CAAC,gCAAgC,CAAC;UACrDI,WAAW,EAAEJ,OAAO,CAAC,iCAAiC;QACxD,CAAC,CAAC;MACJ,CAAC,CAAC,OAAOK,CAAC,EAAE;QACVC,OAAO,CAACC,IAAI,CAAC,sBAAsB,EAAEF,CAAC,CAAC;MACzC,CAAC,SAAS;QACRC,OAAO,CAACE,GAAG,CAAC,oBAAoB,CAAC;MACnC;IACF,CAAC,EAAE,CAAC;EACN,CAAC,EAAE,EAAE,CAAC;EAEN,oBACE5B,IAAA,CAACC,YAAY,CAAC4B,QAAQ;IAACC,KAAK,EAAE;MAAEtB,KAAK,EAAEK,YAAY;MAAEE;IAAY,CAAE;IAAAR,QAAA,EAChEA;EAAQ,CACY,CAAC;AAE5B,CAAC;AAED,eAAeD,aAAa","ignoreList":[]}
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+
3
+ import { Dimensions, PixelRatio } from 'react-native';
4
+ import { getDeviceType } from "./getDeviceType.js";
5
+ import { getScreenSizeCategory } from "./getScreenSizeCategory.js";
6
+ const {
7
+ width: SCREEN_WIDTH,
8
+ height: SCREEN_HEIGHT
9
+ } = Dimensions.get('window');
10
+
11
+ // Use whichever is smaller, width or height
12
+ const SCALE = SCREEN_WIDTH > SCREEN_HEIGHT ? SCREEN_HEIGHT : SCREEN_WIDTH;
13
+ const BASE_WIDTH = 375;
14
+ const fontConfig = {
15
+ phone: {
16
+ small: {
17
+ min: 0.8,
18
+ max: 1
19
+ },
20
+ medium: {
21
+ min: 0.9,
22
+ max: 1.1
23
+ },
24
+ large: {
25
+ min: 1,
26
+ max: 1.2
27
+ }
28
+ },
29
+ tablet: {
30
+ small: {
31
+ min: 1.3,
32
+ max: 1.4
33
+ },
34
+ medium: {
35
+ min: 1.4,
36
+ max: 1.5
37
+ },
38
+ large: {
39
+ min: 1.5,
40
+ max: 1.7
41
+ }
42
+ }
43
+ };
44
+ export function fontScale(size) {
45
+ const deviceType = getDeviceType();
46
+ const screenCategory = getScreenSizeCategory();
47
+ const config = fontConfig[deviceType][screenCategory];
48
+
49
+ // Calculate the scale factor
50
+ const scaleFactor = SCALE / BASE_WIDTH;
51
+
52
+ // Clamp the scale factor between the configured min and max
53
+ const clampedScaleFactor = Math.min(Math.max(scaleFactor, config.min), config.max);
54
+
55
+ // Calculate the new size
56
+ let newSize = size * clampedScaleFactor;
57
+
58
+ // Additional scaling for tablets to ensure text isn't too small
59
+ if (deviceType === 'tablet') {
60
+ newSize *= 1.1; // Increase tablet font sizes by an additional 10%
61
+ }
62
+
63
+ // Round the size and adjust for the device's font scale
64
+ return Math.round(PixelRatio.roundToNearestPixel(newSize)) / PixelRatio.getFontScale();
65
+ }
66
+ //# sourceMappingURL=fontScale.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["Dimensions","PixelRatio","getDeviceType","getScreenSizeCategory","width","SCREEN_WIDTH","height","SCREEN_HEIGHT","get","SCALE","BASE_WIDTH","fontConfig","phone","small","min","max","medium","large","tablet","fontScale","size","deviceType","screenCategory","config","scaleFactor","clampedScaleFactor","Math","newSize","round","roundToNearestPixel","getFontScale"],"sourceRoot":"../../../src","sources":["utils/fontScale.ts"],"mappings":";;AAAA,SAASA,UAAU,EAAEC,UAAU,QAAQ,cAAc;AACrD,SAASC,aAAa,QAAQ,oBAAiB;AAC/C,SAASC,qBAAqB,QAAQ,4BAAyB;AAE/D,MAAM;EAAEC,KAAK,EAAEC,YAAY;EAAEC,MAAM,EAAEC;AAAc,CAAC,GAAGP,UAAU,CAACQ,GAAG,CAAC,QAAQ,CAAC;;AAE/E;AACA,MAAMC,KAAK,GAAGJ,YAAY,GAAGE,aAAa,GAAGA,aAAa,GAAGF,YAAY;AACzE,MAAMK,UAAU,GAAG,GAAG;AAEtB,MAAMC,UAAU,GAAG;EACjBC,KAAK,EAAE;IACLC,KAAK,EAAE;MAAEC,GAAG,EAAE,GAAG;MAAEC,GAAG,EAAE;IAAE,CAAC;IAC3BC,MAAM,EAAE;MAAEF,GAAG,EAAE,GAAG;MAAEC,GAAG,EAAE;IAAI,CAAC;IAC9BE,KAAK,EAAE;MAAEH,GAAG,EAAE,CAAC;MAAEC,GAAG,EAAE;IAAI;EAC5B,CAAC;EACDG,MAAM,EAAE;IACNL,KAAK,EAAE;MAAEC,GAAG,EAAE,GAAG;MAAEC,GAAG,EAAE;IAAI,CAAC;IAC7BC,MAAM,EAAE;MAAEF,GAAG,EAAE,GAAG;MAAEC,GAAG,EAAE;IAAI,CAAC;IAC9BE,KAAK,EAAE;MAAEH,GAAG,EAAE,GAAG;MAAEC,GAAG,EAAE;IAAI;EAC9B;AACF,CAAC;AAED,OAAO,SAASI,SAASA,CAACC,IAAY,EAAE;EACtC,MAAMC,UAAU,GAAGnB,aAAa,CAAC,CAAC;EAClC,MAAMoB,cAAc,GAAGnB,qBAAqB,CAAC,CAAC;EAC9C,MAAMoB,MAAM,GAAGZ,UAAU,CAACU,UAAU,CAAC,CAACC,cAAc,CAAC;;EAErD;EACA,MAAME,WAAW,GAAGf,KAAK,GAAGC,UAAU;;EAEtC;EACA,MAAMe,kBAAkB,GAAGC,IAAI,CAACZ,GAAG,CACjCY,IAAI,CAACX,GAAG,CAACS,WAAW,EAAED,MAAM,CAACT,GAAG,CAAC,EACjCS,MAAM,CAACR,GACT,CAAC;;EAED;EACA,IAAIY,OAAO,GAAGP,IAAI,GAAGK,kBAAkB;;EAEvC;EACA,IAAIJ,UAAU,KAAK,QAAQ,EAAE;IAC3BM,OAAO,IAAI,GAAG,CAAC,CAAC;EAClB;;EAEA;EACA,OACED,IAAI,CAACE,KAAK,CAAC3B,UAAU,CAAC4B,mBAAmB,CAACF,OAAO,CAAC,CAAC,GACnD1B,UAAU,CAAC6B,YAAY,CAAC,CAAC;AAE7B","ignoreList":[]}
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+
3
+ import { Dimensions, PixelRatio } from 'react-native';
4
+ const {
5
+ width: SCREEN_WIDTH,
6
+ height: SCREEN_HEIGHT
7
+ } = Dimensions.get('window');
8
+ export const getDeviceType = () => {
9
+ const pixelDensity = PixelRatio.get();
10
+ const adjustedWidth = SCREEN_WIDTH * pixelDensity;
11
+ const adjustedHeight = SCREEN_HEIGHT * pixelDensity;
12
+ if (pixelDensity < 2 && (adjustedWidth >= 1000 || adjustedHeight >= 1000)) {
13
+ return 'tablet';
14
+ } else if (pixelDensity === 2 && (adjustedWidth >= 1920 || adjustedHeight >= 1920)) {
15
+ return 'tablet';
16
+ } else {
17
+ return 'phone';
18
+ }
19
+ };
20
+ //# sourceMappingURL=getDeviceType.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["Dimensions","PixelRatio","width","SCREEN_WIDTH","height","SCREEN_HEIGHT","get","getDeviceType","pixelDensity","adjustedWidth","adjustedHeight"],"sourceRoot":"../../../src","sources":["utils/getDeviceType.ts"],"mappings":";;AAAA,SAASA,UAAU,EAAEC,UAAU,QAAQ,cAAc;AAErD,MAAM;EAAEC,KAAK,EAAEC,YAAY;EAAEC,MAAM,EAAEC;AAAc,CAAC,GAAGL,UAAU,CAACM,GAAG,CAAC,QAAQ,CAAC;AAE/E,OAAO,MAAMC,aAAa,GAAGA,CAAA,KAA0B;EACrD,MAAMC,YAAY,GAAGP,UAAU,CAACK,GAAG,CAAC,CAAC;EACrC,MAAMG,aAAa,GAAGN,YAAY,GAAGK,YAAY;EACjD,MAAME,cAAc,GAAGL,aAAa,GAAGG,YAAY;EAEnD,IAAIA,YAAY,GAAG,CAAC,KAAKC,aAAa,IAAI,IAAI,IAAIC,cAAc,IAAI,IAAI,CAAC,EAAE;IACzE,OAAO,QAAQ;EACjB,CAAC,MAAM,IACLF,YAAY,KAAK,CAAC,KACjBC,aAAa,IAAI,IAAI,IAAIC,cAAc,IAAI,IAAI,CAAC,EACjD;IACA,OAAO,QAAQ;EACjB,CAAC,MAAM;IACL,OAAO,OAAO;EAChB;AACF,CAAC","ignoreList":[]}
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ import { Dimensions } from 'react-native';
4
+ const {
5
+ width: SCREEN_WIDTH,
6
+ height: SCREEN_HEIGHT
7
+ } = Dimensions.get('window');
8
+
9
+ // Use whichever is smaller, width or height
10
+ const SCALE = SCREEN_WIDTH > SCREEN_HEIGHT ? SCREEN_HEIGHT : SCREEN_WIDTH;
11
+ export const getScreenSizeCategory = () => {
12
+ if (SCALE < 350) return 'small';
13
+ if (SCALE > 500) return 'large';
14
+ return 'medium';
15
+ };
16
+ //# sourceMappingURL=getScreenSizeCategory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["Dimensions","width","SCREEN_WIDTH","height","SCREEN_HEIGHT","get","SCALE","getScreenSizeCategory"],"sourceRoot":"../../../src","sources":["utils/getScreenSizeCategory.ts"],"mappings":";;AAAA,SAASA,UAAU,QAAQ,cAAc;AAEzC,MAAM;EAAEC,KAAK,EAAEC,YAAY;EAAEC,MAAM,EAAEC;AAAc,CAAC,GAAGJ,UAAU,CAACK,GAAG,CAAC,QAAQ,CAAC;;AAE/E;AACA,MAAMC,KAAK,GAAGJ,YAAY,GAAGE,aAAa,GAAGA,aAAa,GAAGF,YAAY;AAEzE,OAAO,MAAMK,qBAAqB,GAAGA,CAAA,KAAoC;EACvE,IAAID,KAAK,GAAG,GAAG,EAAE,OAAO,OAAO;EAC/B,IAAIA,KAAK,GAAG,GAAG,EAAE,OAAO,OAAO;EAC/B,OAAO,QAAQ;AACjB,CAAC","ignoreList":[]}
@@ -0,0 +1,10 @@
1
+ import { type ComponentRef } from 'react';
2
+ import type { ButtonBaseProps } from './types';
3
+ export type ButtonBaseRef = ComponentRef<typeof Button>;
4
+ /**
5
+ * A customizable button component that supports different variants and sizes.
6
+ * @return A TouchableOpacity button with text.
7
+ */
8
+ export declare const Button: import("react").ForwardRefExoticComponent<ButtonBaseProps & import("react").RefAttributes<import("react-native").View>>;
9
+ export default Button;
10
+ //# sourceMappingURL=Button.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../../../src/components/Button/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,YAAY,EAAE,MAAM,OAAO,CAAC;AAGtD,OAAO,KAAK,EACV,eAAe,EAIhB,MAAM,SAAS,CAAC;AAEjB,MAAM,MAAM,aAAa,GAAG,YAAY,CAAC,OAAO,MAAM,CAAC,CAAC;AAExD;;;GAGG;AACH,eAAO,MAAM,MAAM,yHAoCjB,CAAC;AAIH,eAAe,MAAM,CAAC"}
@@ -0,0 +1,8 @@
1
+ import type { ButtonBaseProps } from './types';
2
+ /**
3
+ * A button component styled for dangerous actions, such as deletions.
4
+ * @returns A ButtonBase component with the "danger" variant.
5
+ */
6
+ export declare const DangerButton: import("react").ForwardRefExoticComponent<ButtonBaseProps & import("react").RefAttributes<import("react-native").View>>;
7
+ export default DangerButton;
8
+ //# sourceMappingURL=DangerButton.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DangerButton.d.ts","sourceRoot":"","sources":["../../../../../src/components/Button/DangerButton.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/C;;;GAGG;AACH,eAAO,MAAM,YAAY,yHAIxB,CAAC;AAIF,eAAe,YAAY,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { ButtonBaseProps } from './types';
2
+ export declare const GhostButton: import("react").ForwardRefExoticComponent<ButtonBaseProps & import("react").RefAttributes<import("react-native").View>>;
3
+ export default GhostButton;
4
+ //# sourceMappingURL=GhostButton.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GhostButton.d.ts","sourceRoot":"","sources":["../../../../../src/components/Button/GhostButton.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/C,eAAO,MAAM,WAAW,yHAIvB,CAAC;AAIF,eAAe,WAAW,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { ButtonBaseProps } from './types';
2
+ /**
3
+ * A button component styled for primary actions.
4
+ */
5
+ export declare const PrimaryButton: import("react").ForwardRefExoticComponent<ButtonBaseProps & import("react").RefAttributes<import("react-native").View>>;
6
+ export default PrimaryButton;
7
+ //# sourceMappingURL=PrimaryButton.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PrimaryButton.d.ts","sourceRoot":"","sources":["../../../../../src/components/Button/PrimaryButton.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/C;;GAEG;AACH,eAAO,MAAM,aAAa,yHAIzB,CAAC;AAIF,eAAe,aAAa,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { ButtonBaseProps } from './types';
2
+ /**
3
+ * A button component styled for secondary actions.
4
+ */
5
+ export declare const SecondaryButton: import("react").ForwardRefExoticComponent<ButtonBaseProps & import("react").RefAttributes<import("react-native").View>>;
6
+ export default SecondaryButton;
7
+ //# sourceMappingURL=SecondaryButton.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SecondaryButton.d.ts","sourceRoot":"","sources":["../../../../../src/components/Button/SecondaryButton.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/C;;GAEG;AACH,eAAO,MAAM,eAAe,yHAI3B,CAAC;AAIF,eAAe,eAAe,CAAC"}
@@ -0,0 +1,64 @@
1
+ export declare const DEFAULT_BUTTON: {
2
+ primary_background_color: string;
3
+ primary_text_color: string;
4
+ secondary_background_color: string;
5
+ secondary_text_color: string;
6
+ danger_background_color: string;
7
+ danger_text_color: string;
8
+ ghost_background_color: string;
9
+ ghost_text_color: string;
10
+ };
11
+ export type ButtonStyleVariables = typeof DEFAULT_BUTTON;
12
+ export declare const Styles: {
13
+ _base: {
14
+ paddingVertical: number;
15
+ paddingHorizontal: number;
16
+ borderRadius: number;
17
+ alignItems: "center";
18
+ justifyContent: "center";
19
+ flexDirection: "row";
20
+ gap: number;
21
+ };
22
+ _disabled: {
23
+ opacity: number;
24
+ };
25
+ small: {
26
+ paddingVertical: number;
27
+ paddingHorizontal: number;
28
+ };
29
+ medium: {
30
+ paddingVertical: number;
31
+ paddingHorizontal: number;
32
+ };
33
+ large: {
34
+ paddingVertical: number;
35
+ paddingHorizontal: number;
36
+ };
37
+ _text: {};
38
+ text_primary: {
39
+ color: string;
40
+ };
41
+ text_secondary: {
42
+ color: string;
43
+ };
44
+ text_danger: {
45
+ color: string;
46
+ };
47
+ text_ghost: {
48
+ color: string;
49
+ };
50
+ primary: {
51
+ backgroundColor: string;
52
+ };
53
+ secondary: {
54
+ backgroundColor: string;
55
+ };
56
+ danger: {
57
+ backgroundColor: string;
58
+ };
59
+ ghost: {
60
+ backgroundColor: string;
61
+ };
62
+ };
63
+ export default Styles;
64
+ //# sourceMappingURL=style.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"style.d.ts","sourceRoot":"","sources":["../../../../../src/components/Button/style.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,cAAc;;;;;;;;;CAY1B,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG,OAAO,cAAc,CAAC;AAEzD,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuDjB,CAAC;AAEH,eAAe,MAAM,CAAC"}
@@ -0,0 +1,40 @@
1
+ import type { ComponentRef } from 'react';
2
+ import type { StyleProp, TextStyle, TouchableOpacity, TouchableOpacityProps, ViewStyle } from 'react-native';
3
+ /**
4
+ * Ref type for the Button component
5
+ */
6
+ export type ButtonRef = ComponentRef<typeof TouchableOpacity>;
7
+ export type ButtonVariant = 'primary' | 'secondary' | 'danger' | 'ghost';
8
+ export type ButtonSize = 'small' | 'medium' | 'large';
9
+ export interface ButtonBaseProps extends Omit<TouchableOpacityProps, 'style'> {
10
+ /**
11
+ * The title of the button.
12
+ */
13
+ title: string;
14
+ /**
15
+ * The style of the button container.
16
+ * Optional.
17
+ */
18
+ style?: StyleProp<ViewStyle>;
19
+ /**
20
+ * The text style of the button title.
21
+ * Optional.
22
+ */
23
+ textStyle?: StyleProp<TextStyle>;
24
+ /**
25
+ * The size of the button.
26
+ * @default 'medium'
27
+ */
28
+ size?: ButtonSize;
29
+ /**
30
+ * The variant of the button.
31
+ * @default 'primary'
32
+ */
33
+ variant?: ButtonVariant;
34
+ /**
35
+ * Whether the button is disabled.
36
+ * @default false
37
+ */
38
+ disabled?: boolean;
39
+ }
40
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/components/Button/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,KAAK,EACV,SAAS,EACT,SAAS,EACT,gBAAgB,EAChB,qBAAqB,EACrB,SAAS,EACV,MAAM,cAAc,CAAC;AAEtB;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,YAAY,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE9D,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,WAAW,GAAG,QAAQ,GAAG,OAAO,CAAC;AAEzE,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;AAEtD,MAAM,WAAW,eAAgB,SAAQ,IAAI,CAAC,qBAAqB,EAAE,OAAO,CAAC;IAC3E;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B;;;OAGG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IACjC;;;OAGG;IACH,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB;;;OAGG;IACH,OAAO,CAAC,EAAE,aAAa,CAAC;IAExB;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB"}
@@ -1 +1 @@
1
- {"version":3,"file":"ThemeProvider.d.ts","sourceRoot":"","sources":["../../../../src/providers/ThemeProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAuD,MAAM,OAAO,CAAC;AAE5E,OAAO,KAAK,EACV,gBAAgB,EAChB,kBAAkB,EAEnB,MAAM,SAAS,CAAC;AAQjB;;;;;;;GAOG;AACH,eAAO,MAAM,QAAQ,wBAMpB,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CA+BtD,CAAC;AAEF,eAAe,aAAa,CAAC"}
1
+ {"version":3,"file":"ThemeProvider.d.ts","sourceRoot":"","sources":["../../../../src/providers/ThemeProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAuD,MAAM,OAAO,CAAC;AAE5E,OAAO,KAAK,EACV,gBAAgB,EAChB,kBAAkB,EAEnB,MAAM,SAAS,CAAC;AAUjB;;;;;;;GAOG;AACH,eAAO,MAAM,QAAQ,wBAMpB,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAiDtD,CAAC;AAEF,eAAe,aAAa,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function fontScale(size: number): number;
2
+ //# sourceMappingURL=fontScale.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fontScale.d.ts","sourceRoot":"","sources":["../../../../src/utils/fontScale.ts"],"names":[],"mappings":"AAuBA,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,UA2BrC"}
@@ -0,0 +1,2 @@
1
+ export declare const getDeviceType: () => "phone" | "tablet";
2
+ //# sourceMappingURL=getDeviceType.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getDeviceType.d.ts","sourceRoot":"","sources":["../../../../src/utils/getDeviceType.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,aAAa,QAAO,OAAO,GAAG,QAe1C,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare const getScreenSizeCategory: () => "small" | "medium" | "large";
2
+ //# sourceMappingURL=getScreenSizeCategory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getScreenSizeCategory.d.ts","sourceRoot":"","sources":["../../../../src/utils/getScreenSizeCategory.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,qBAAqB,QAAO,OAAO,GAAG,QAAQ,GAAG,OAI7D,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dryanovski/react-native-components",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
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",
@@ -39,6 +39,7 @@
39
39
  "@testing-library/react-native": "^13.3.3",
40
40
  "@types/jest": "^29.5.5",
41
41
  "@types/react": "^19.0.12",
42
+ "expo-font": "~14.0.10",
42
43
  "babel-plugin-module-resolver": "^5.0.2",
43
44
  "babel-plugin-transform-remove-imports": "^1.8.0",
44
45
  "del-cli": "^5.1.0",
@@ -48,7 +49,7 @@
48
49
  "jest": "^29.7.0",
49
50
  "prettier": "^3.0.3",
50
51
  "prettier-plugin-organize-imports": "^4.1.0",
51
- "react": "19.1.0",
52
+ "react": "19.2.3",
52
53
  "react-native": "0.81.5",
53
54
  "react-native-builder-bob": "^0.40.12",
54
55
  "react-native-gesture-handler": "^2.28.0",
@@ -57,7 +58,7 @@
57
58
  "react-native-screens": "~4.16.0",
58
59
  "react-native-svg": "15.12.1",
59
60
  "react-native-worklets": "0.5.1",
60
- "react-test-renderer": "19.1.0",
61
+ "react-test-renderer": "19.2.3",
61
62
  "typescript": "^5.8.3"
62
63
  },
63
64
  "peerDependencies": {
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1,57 @@
1
+ import { forwardRef, type ComponentRef } from 'react';
2
+ import { Text, TouchableOpacity } from 'react-native';
3
+ import Styles from './style';
4
+ import type {
5
+ ButtonBaseProps,
6
+ ButtonRef,
7
+ ButtonSize,
8
+ ButtonVariant,
9
+ } from './types';
10
+
11
+ export type ButtonBaseRef = ComponentRef<typeof Button>;
12
+
13
+ /**
14
+ * A customizable button component that supports different variants and sizes.
15
+ * @return A TouchableOpacity button with text.
16
+ */
17
+ export const Button = forwardRef<ButtonRef, ButtonBaseProps>((props, ref) => {
18
+ const {
19
+ variant = 'primary',
20
+ title,
21
+ size = 'medium',
22
+ onPress = () => undefined,
23
+ style,
24
+ disabled = false,
25
+ textStyle,
26
+ ...rest
27
+ } = props;
28
+
29
+ /**
30
+ * Derives the text style variant based on the button variant.
31
+ */
32
+ const textVariant = ('text_' + variant) as `text_${ButtonVariant}`;
33
+
34
+ return (
35
+ <TouchableOpacity
36
+ ref={ref}
37
+ onPress={onPress}
38
+ disabled={disabled}
39
+ style={[
40
+ Styles._base,
41
+ Styles[size as ButtonSize],
42
+ Styles[variant as ButtonVariant],
43
+ disabled && Styles._disabled,
44
+ style,
45
+ ]}
46
+ {...rest}
47
+ >
48
+ <Text style={[Styles._text, Styles[textVariant], textStyle]}>
49
+ {title}
50
+ </Text>
51
+ </TouchableOpacity>
52
+ );
53
+ });
54
+
55
+ Button.displayName = 'ButtonBase';
56
+
57
+ export default Button;
@@ -0,0 +1,17 @@
1
+ import { forwardRef } from 'react';
2
+ import { Button, type ButtonBaseRef } from './Button';
3
+ import type { ButtonBaseProps } from './types';
4
+
5
+ /**
6
+ * A button component styled for dangerous actions, such as deletions.
7
+ * @returns A ButtonBase component with the "danger" variant.
8
+ */
9
+ export const DangerButton = forwardRef<ButtonBaseRef, ButtonBaseProps>(
10
+ (props, ref) => {
11
+ return <Button ref={ref} variant="danger" {...props} />;
12
+ }
13
+ );
14
+
15
+ DangerButton.displayName = 'DangerButton';
16
+
17
+ export default DangerButton;
@@ -0,0 +1,13 @@
1
+ import { forwardRef } from 'react';
2
+ import { Button, type ButtonBaseRef } from './Button';
3
+ import type { ButtonBaseProps } from './types';
4
+
5
+ export const GhostButton = forwardRef<ButtonBaseRef, ButtonBaseProps>(
6
+ (props, ref) => {
7
+ return <Button ref={ref} variant="ghost" {...props} />;
8
+ }
9
+ );
10
+
11
+ GhostButton.displayName = 'GhostButton';
12
+
13
+ export default GhostButton;
@@ -0,0 +1,16 @@
1
+ import { forwardRef } from 'react';
2
+ import { Button, type ButtonBaseRef } from './Button';
3
+ import type { ButtonBaseProps } from './types';
4
+
5
+ /**
6
+ * A button component styled for primary actions.
7
+ */
8
+ export const PrimaryButton = forwardRef<ButtonBaseRef, ButtonBaseProps>(
9
+ (props, ref) => {
10
+ return <Button ref={ref} variant="primary" {...props} />;
11
+ }
12
+ );
13
+
14
+ PrimaryButton.displayName = 'PrimaryButton';
15
+
16
+ export default PrimaryButton;
@@ -0,0 +1,16 @@
1
+ import { forwardRef } from 'react';
2
+ import { Button, type ButtonBaseRef } from './Button';
3
+ import type { ButtonBaseProps } from './types';
4
+
5
+ /**
6
+ * A button component styled for secondary actions.
7
+ */
8
+ export const SecondaryButton = forwardRef<ButtonBaseRef, ButtonBaseProps>(
9
+ (props, ref) => {
10
+ return <Button ref={ref} variant="secondary" {...props} />;
11
+ }
12
+ );
13
+
14
+ SecondaryButton.displayName = 'SecondaryButton';
15
+
16
+ export default SecondaryButton;
@@ -0,0 +1,76 @@
1
+ import Style from '../../utils/Style';
2
+
3
+ export const DEFAULT_BUTTON = {
4
+ primary_background_color: '#007bff',
5
+ primary_text_color: '#ffffff',
6
+
7
+ secondary_background_color: '#6c757d',
8
+ secondary_text_color: '#ffffff',
9
+
10
+ danger_background_color: '#dc3545',
11
+ danger_text_color: '#ffffff',
12
+
13
+ ghost_background_color: 'transparent',
14
+ ghost_text_color: '#007bff',
15
+ };
16
+
17
+ export type ButtonStyleVariables = typeof DEFAULT_BUTTON;
18
+
19
+ export const Styles = Style.create({
20
+ _base: {
21
+ paddingVertical: 12,
22
+ paddingHorizontal: 24,
23
+ borderRadius: 6,
24
+ alignItems: 'center',
25
+ justifyContent: 'center',
26
+ flexDirection: 'row',
27
+ gap: 10,
28
+ },
29
+
30
+ _disabled: {
31
+ opacity: 0.6,
32
+ },
33
+
34
+ small: {
35
+ paddingVertical: 8,
36
+ paddingHorizontal: 16,
37
+ },
38
+ medium: {
39
+ paddingVertical: 12,
40
+ paddingHorizontal: 20,
41
+ },
42
+ large: {
43
+ paddingVertical: 16,
44
+ paddingHorizontal: 24,
45
+ },
46
+
47
+ _text: {},
48
+
49
+ text_primary: {
50
+ color: DEFAULT_BUTTON.primary_text_color,
51
+ },
52
+ text_secondary: {
53
+ color: DEFAULT_BUTTON.secondary_text_color,
54
+ },
55
+ text_danger: {
56
+ color: DEFAULT_BUTTON.danger_text_color,
57
+ },
58
+ text_ghost: {
59
+ color: DEFAULT_BUTTON.ghost_text_color,
60
+ },
61
+
62
+ primary: {
63
+ backgroundColor: DEFAULT_BUTTON.primary_background_color,
64
+ },
65
+ secondary: {
66
+ backgroundColor: DEFAULT_BUTTON.secondary_background_color,
67
+ },
68
+ danger: {
69
+ backgroundColor: DEFAULT_BUTTON.danger_background_color,
70
+ },
71
+ ghost: {
72
+ backgroundColor: DEFAULT_BUTTON.ghost_background_color,
73
+ },
74
+ });
75
+
76
+ export default Styles;
@@ -0,0 +1,50 @@
1
+ import type { ComponentRef } from 'react';
2
+ import type {
3
+ StyleProp,
4
+ TextStyle,
5
+ TouchableOpacity,
6
+ TouchableOpacityProps,
7
+ ViewStyle,
8
+ } from 'react-native';
9
+
10
+ /**
11
+ * Ref type for the Button component
12
+ */
13
+ export type ButtonRef = ComponentRef<typeof TouchableOpacity>;
14
+
15
+ export type ButtonVariant = 'primary' | 'secondary' | 'danger' | 'ghost';
16
+
17
+ export type ButtonSize = 'small' | 'medium' | 'large';
18
+
19
+ export interface ButtonBaseProps extends Omit<TouchableOpacityProps, 'style'> {
20
+ /**
21
+ * The title of the button.
22
+ */
23
+ title: string;
24
+ /**
25
+ * The style of the button container.
26
+ * Optional.
27
+ */
28
+ style?: StyleProp<ViewStyle>;
29
+ /**
30
+ * The text style of the button title.
31
+ * Optional.
32
+ */
33
+ textStyle?: StyleProp<TextStyle>;
34
+ /**
35
+ * The size of the button.
36
+ * @default 'medium'
37
+ */
38
+ size?: ButtonSize;
39
+ /**
40
+ * The variant of the button.
41
+ * @default 'primary'
42
+ */
43
+ variant?: ButtonVariant;
44
+
45
+ /**
46
+ * Whether the button is disabled.
47
+ * @default false
48
+ */
49
+ disabled?: boolean;
50
+ }
@@ -6,6 +6,8 @@ import type {
6
6
  ThemeVariants,
7
7
  } from './types';
8
8
 
9
+ import * as Font from 'expo-font';
10
+
9
11
  /**
10
12
  * Create a ThemeContext with default value null
11
13
  * @type {React.Context<ThemeContextType | null>}
@@ -67,6 +69,24 @@ export const ThemeProvider: React.FC<ThemeProviderProps> = ({
67
69
  [deviceColorscheme]
68
70
  );
69
71
 
72
+ useEffect(() => {
73
+ (async function loadAsyncFonts() {
74
+ try {
75
+ await Font.loadAsync({
76
+ CodanRegular: require('../assets/fonts/CodanRegular.ttf'),
77
+ CodanBold: require('../assets/fonts/CodanBold.ttf'),
78
+ CodanBook: require('../assets/fonts/CodanBook.ttf'),
79
+ CodanLight: require('../assets/fonts/CodanLight.ttf'),
80
+ CodanMedium: require('../assets/fonts/CodanMedium.ttf'),
81
+ });
82
+ } catch (e) {
83
+ console.warn('Error loading fonts:', e);
84
+ } finally {
85
+ console.log('Theme Fonts loaded');
86
+ }
87
+ })();
88
+ }, []);
89
+
70
90
  return (
71
91
  <ThemeContext.Provider value={{ theme: currentTheme, changeTheme }}>
72
92
  {children}
@@ -0,0 +1,51 @@
1
+ import { Dimensions, PixelRatio } from 'react-native';
2
+ import { getDeviceType } from './getDeviceType';
3
+ import { getScreenSizeCategory } from './getScreenSizeCategory';
4
+
5
+ const { width: SCREEN_WIDTH, height: SCREEN_HEIGHT } = Dimensions.get('window');
6
+
7
+ // Use whichever is smaller, width or height
8
+ const SCALE = SCREEN_WIDTH > SCREEN_HEIGHT ? SCREEN_HEIGHT : SCREEN_WIDTH;
9
+ const BASE_WIDTH = 375;
10
+
11
+ const fontConfig = {
12
+ phone: {
13
+ small: { min: 0.8, max: 1 },
14
+ medium: { min: 0.9, max: 1.1 },
15
+ large: { min: 1, max: 1.2 },
16
+ },
17
+ tablet: {
18
+ small: { min: 1.3, max: 1.4 },
19
+ medium: { min: 1.4, max: 1.5 },
20
+ large: { min: 1.5, max: 1.7 },
21
+ },
22
+ };
23
+
24
+ export function fontScale(size: number) {
25
+ const deviceType = getDeviceType();
26
+ const screenCategory = getScreenSizeCategory();
27
+ const config = fontConfig[deviceType][screenCategory];
28
+
29
+ // Calculate the scale factor
30
+ const scaleFactor = SCALE / BASE_WIDTH;
31
+
32
+ // Clamp the scale factor between the configured min and max
33
+ const clampedScaleFactor = Math.min(
34
+ Math.max(scaleFactor, config.min),
35
+ config.max
36
+ );
37
+
38
+ // Calculate the new size
39
+ let newSize = size * clampedScaleFactor;
40
+
41
+ // Additional scaling for tablets to ensure text isn't too small
42
+ if (deviceType === 'tablet') {
43
+ newSize *= 1.1; // Increase tablet font sizes by an additional 10%
44
+ }
45
+
46
+ // Round the size and adjust for the device's font scale
47
+ return (
48
+ Math.round(PixelRatio.roundToNearestPixel(newSize)) /
49
+ PixelRatio.getFontScale()
50
+ );
51
+ }
@@ -0,0 +1,20 @@
1
+ import { Dimensions, PixelRatio } from 'react-native';
2
+
3
+ const { width: SCREEN_WIDTH, height: SCREEN_HEIGHT } = Dimensions.get('window');
4
+
5
+ export const getDeviceType = (): 'phone' | 'tablet' => {
6
+ const pixelDensity = PixelRatio.get();
7
+ const adjustedWidth = SCREEN_WIDTH * pixelDensity;
8
+ const adjustedHeight = SCREEN_HEIGHT * pixelDensity;
9
+
10
+ if (pixelDensity < 2 && (adjustedWidth >= 1000 || adjustedHeight >= 1000)) {
11
+ return 'tablet';
12
+ } else if (
13
+ pixelDensity === 2 &&
14
+ (adjustedWidth >= 1920 || adjustedHeight >= 1920)
15
+ ) {
16
+ return 'tablet';
17
+ } else {
18
+ return 'phone';
19
+ }
20
+ };
@@ -0,0 +1,12 @@
1
+ import { Dimensions } from 'react-native';
2
+
3
+ const { width: SCREEN_WIDTH, height: SCREEN_HEIGHT } = Dimensions.get('window');
4
+
5
+ // Use whichever is smaller, width or height
6
+ const SCALE = SCREEN_WIDTH > SCREEN_HEIGHT ? SCREEN_HEIGHT : SCREEN_WIDTH;
7
+
8
+ export const getScreenSizeCategory = (): 'small' | 'medium' | 'large' => {
9
+ if (SCALE < 350) return 'small';
10
+ if (SCALE > 500) return 'large';
11
+ return 'medium';
12
+ };