@dryanovski/react-native-components 1.0.1 → 1.0.3

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 (56) hide show
  1. package/lib/module/components/Card/Card.js +34 -0
  2. package/lib/module/components/Card/Card.js.map +1 -0
  3. package/lib/module/components/Card/styles.js +28 -0
  4. package/lib/module/components/Card/styles.js.map +1 -0
  5. package/lib/module/components/Card/types.js +4 -0
  6. package/lib/module/components/Card/types.js.map +1 -0
  7. package/lib/module/components/Surface/Surface.js +34 -0
  8. package/lib/module/components/Surface/Surface.js.map +1 -0
  9. package/lib/module/components/Surface/styles.js +25 -0
  10. package/lib/module/components/Surface/styles.js.map +1 -0
  11. package/lib/module/components/Surface/types.js +4 -0
  12. package/lib/module/components/Surface/types.js.map +1 -0
  13. package/lib/module/index.js +3 -0
  14. package/lib/module/index.js.map +1 -1
  15. package/lib/module/themes/light.js +24 -0
  16. package/lib/module/themes/light.js.map +1 -0
  17. package/lib/module/themes/types.js +4 -0
  18. package/lib/module/themes/types.js.map +1 -0
  19. package/lib/module/types/general.types.js +4 -0
  20. package/lib/module/types/general.types.js.map +1 -0
  21. package/lib/module/utils/Style.js +6 -0
  22. package/lib/module/utils/Style.js.map +1 -0
  23. package/lib/typescript/src/components/Card/Card.d.ts +14 -0
  24. package/lib/typescript/src/components/Card/Card.d.ts.map +1 -0
  25. package/lib/typescript/src/components/Card/styles.d.ts +29 -0
  26. package/lib/typescript/src/components/Card/styles.d.ts.map +1 -0
  27. package/lib/typescript/src/components/Card/types.d.ts +17 -0
  28. package/lib/typescript/src/components/Card/types.d.ts.map +1 -0
  29. package/lib/typescript/src/components/Surface/Surface.d.ts +16 -0
  30. package/lib/typescript/src/components/Surface/Surface.d.ts.map +1 -0
  31. package/lib/typescript/src/components/Surface/styles.d.ts +22 -0
  32. package/lib/typescript/src/components/Surface/styles.d.ts.map +1 -0
  33. package/lib/typescript/src/components/Surface/types.d.ts +12 -0
  34. package/lib/typescript/src/components/Surface/types.d.ts.map +1 -0
  35. package/lib/typescript/src/index.d.ts +1 -0
  36. package/lib/typescript/src/index.d.ts.map +1 -1
  37. package/lib/typescript/src/themes/light.d.ts +3 -0
  38. package/lib/typescript/src/themes/light.d.ts.map +1 -0
  39. package/lib/typescript/src/themes/types.d.ts +9 -0
  40. package/lib/typescript/src/themes/types.d.ts.map +1 -0
  41. package/lib/typescript/src/types/general.types.d.ts +4 -0
  42. package/lib/typescript/src/types/general.types.d.ts.map +1 -0
  43. package/lib/typescript/src/utils/Style.d.ts +4 -0
  44. package/lib/typescript/src/utils/Style.d.ts.map +1 -0
  45. package/package.json +8 -7
  46. package/src/components/Card/Card.tsx +33 -0
  47. package/src/components/Card/styles.ts +27 -0
  48. package/src/components/Card/types.ts +18 -0
  49. package/src/components/Surface/Surface.tsx +29 -0
  50. package/src/components/Surface/styles.ts +28 -0
  51. package/src/components/Surface/types.ts +14 -0
  52. package/src/index.tsx +3 -0
  53. package/src/themes/light.ts +20 -0
  54. package/src/themes/types.ts +9 -0
  55. package/src/types/general.types.ts +4 -0
  56. package/src/utils/Style.ts +5 -0
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+
3
+ import { forwardRef } from 'react';
4
+ import Surface from "../Surface/Surface.js";
5
+ import Styles from "./styles.js";
6
+ import { jsx as _jsx } from "react/jsx-runtime";
7
+ /**
8
+ * Card component to display content within a styled container
9
+ * @param {React.ReactNode} children - The content to be displayed inside the card
10
+ * @param {ViewStyle} style - Additional styles for the card container
11
+ * @returns {JSX.Element} The Card component
12
+ * @example
13
+ * <Card style={{ margin: 10 }}>
14
+ * <Text>This is a card</Text>
15
+ * </Card>
16
+ */
17
+ export const Card = /*#__PURE__*/forwardRef((props, ref) => {
18
+ const {
19
+ children,
20
+ variant = 'default',
21
+ style = {},
22
+ ...rest
23
+ } = props;
24
+ return /*#__PURE__*/_jsx(Surface, {
25
+ ref: ref,
26
+ variant: variant,
27
+ style: [Styles.container, style],
28
+ ...rest,
29
+ children: children
30
+ });
31
+ });
32
+ Card.displayName = 'Card';
33
+ export default Card;
34
+ //# sourceMappingURL=Card.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["forwardRef","Surface","Styles","jsx","_jsx","Card","props","ref","children","variant","style","rest","container","displayName"],"sourceRoot":"../../../../src","sources":["components/Card/Card.tsx"],"mappings":";;AAAA,SAASA,UAAU,QAAQ,OAAO;AAElC,OAAOC,OAAO,MAAM,uBAAoB;AACxC,OAAOC,MAAM,MAAM,aAAU;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAG9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,IAAI,gBAAGL,UAAU,CAAqB,CAACM,KAAK,EAAEC,GAAG,KAAK;EACjE,MAAM;IAAEC,QAAQ;IAAEC,OAAO,GAAG,SAAS;IAAEC,KAAK,GAAG,CAAC,CAAC;IAAE,GAAGC;EAAK,CAAC,GAAGL,KAAK;EACpE,oBACEF,IAAA,CAACH,OAAO;IACNM,GAAG,EAAEA,GAAI;IACTE,OAAO,EAAEA,OAAQ;IACjBC,KAAK,EAAE,CAACR,MAAM,CAACU,SAAS,EAAEF,KAAK,CAAE;IAAA,GAC7BC,IAAI;IAAAH,QAAA,EAEPA;EAAQ,CACF,CAAC;AAEd,CAAC,CAAC;AAEFH,IAAI,CAACQ,WAAW,GAAG,MAAM;AAEzB,eAAeR,IAAI","ignoreList":[]}
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+
3
+ import Style from "../../utils/Style.js";
4
+ export const DEFAULT_CARD = {
5
+ border_radius: 8,
6
+ padding: 16,
7
+ shadow_color: '#000',
8
+ shadow_offset: {
9
+ width: 0,
10
+ height: 2
11
+ },
12
+ shadow_opacity: 0.1,
13
+ shadow_radius: 4,
14
+ elevation: 3
15
+ };
16
+ export const Styles = Style.create({
17
+ container: {
18
+ borderRadius: DEFAULT_CARD.border_radius,
19
+ padding: DEFAULT_CARD.padding,
20
+ shadowColor: DEFAULT_CARD.shadow_color,
21
+ shadowOffset: DEFAULT_CARD.shadow_offset,
22
+ shadowOpacity: DEFAULT_CARD.shadow_opacity,
23
+ shadowRadius: DEFAULT_CARD.shadow_radius,
24
+ elevation: DEFAULT_CARD.elevation
25
+ }
26
+ });
27
+ export default Styles;
28
+ //# sourceMappingURL=styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["Style","DEFAULT_CARD","border_radius","padding","shadow_color","shadow_offset","width","height","shadow_opacity","shadow_radius","elevation","Styles","create","container","borderRadius","shadowColor","shadowOffset","shadowOpacity","shadowRadius"],"sourceRoot":"../../../../src","sources":["components/Card/styles.ts"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,sBAAmB;AAErC,OAAO,MAAMC,YAAY,GAAG;EAC1BC,aAAa,EAAE,CAAC;EAChBC,OAAO,EAAE,EAAE;EACXC,YAAY,EAAE,MAAM;EACpBC,aAAa,EAAE;IAAEC,KAAK,EAAE,CAAC;IAAEC,MAAM,EAAE;EAAE,CAAC;EACtCC,cAAc,EAAE,GAAG;EACnBC,aAAa,EAAE,CAAC;EAChBC,SAAS,EAAE;AACb,CAAC;AAID,OAAO,MAAMC,MAAM,GAAGX,KAAK,CAACY,MAAM,CAAC;EACjCC,SAAS,EAAE;IACTC,YAAY,EAAEb,YAAY,CAACC,aAAa;IACxCC,OAAO,EAAEF,YAAY,CAACE,OAAO;IAC7BY,WAAW,EAAEd,YAAY,CAACG,YAAY;IACtCY,YAAY,EAAEf,YAAY,CAACI,aAAa;IACxCY,aAAa,EAAEhB,YAAY,CAACO,cAAc;IAC1CU,YAAY,EAAEjB,YAAY,CAACQ,aAAa;IACxCC,SAAS,EAAET,YAAY,CAACS;EAC1B;AACF,CAAC,CAAC;AAEF,eAAeC,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/Card/types.ts"],"mappings":"","ignoreList":[]}
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+
3
+ import { forwardRef } from 'react';
4
+ import { View } from 'react-native';
5
+ import { Styles } from "./styles.js";
6
+ import { jsx as _jsx } from "react/jsx-runtime";
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 = /*#__PURE__*/forwardRef((props, ref) => {
19
+ const {
20
+ children,
21
+ variant = 'default',
22
+ style,
23
+ ...rest
24
+ } = props;
25
+ return /*#__PURE__*/_jsx(View, {
26
+ ref: ref,
27
+ style: [Styles.base, Styles[variant], style],
28
+ ...rest,
29
+ children: children
30
+ });
31
+ });
32
+ Surface.displayName = 'Surface';
33
+ export default Surface;
34
+ //# sourceMappingURL=Surface.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["forwardRef","View","Styles","jsx","_jsx","Surface","props","ref","children","variant","style","rest","base","displayName"],"sourceRoot":"../../../../src","sources":["components/Surface/Surface.tsx"],"mappings":";;AAAA,SAASA,UAAU,QAAQ,OAAO;AAClC,SAASC,IAAI,QAAQ,cAAc;AAEnC,SAASC,MAAM,QAAQ,aAAU;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAGlC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,OAAO,gBAAGL,UAAU,CAAwB,CAACM,KAAK,EAAEC,GAAG,KAAK;EACvE,MAAM;IAAEC,QAAQ;IAAEC,OAAO,GAAG,SAAS;IAAEC,KAAK;IAAE,GAAGC;EAAK,CAAC,GAAGL,KAAK;EAC/D,oBACEF,IAAA,CAACH,IAAI;IAACM,GAAG,EAAEA,GAAI;IAACG,KAAK,EAAE,CAACR,MAAM,CAACU,IAAI,EAAEV,MAAM,CAACO,OAAO,CAAC,EAAEC,KAAK,CAAE;IAAA,GAAKC,IAAI;IAAAH,QAAA,EACnEA;EAAQ,CACL,CAAC;AAEX,CAAC,CAAC;AAEFH,OAAO,CAACQ,WAAW,GAAG,SAAS;AAE/B,eAAeR,OAAO","ignoreList":[]}
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+
3
+ import Style from "../../utils/Style.js";
4
+ export const DEFAULT_SURFACE = {
5
+ default_background_color: '#fff',
6
+ secondary_background_color: '#f0f0f0',
7
+ transparent_background_color: 'transparent'
8
+ };
9
+ export const Styles = Style.create({
10
+ base: {},
11
+ /**
12
+ * Variants
13
+ */
14
+
15
+ default: {
16
+ backgroundColor: DEFAULT_SURFACE.default_background_color
17
+ },
18
+ secondary: {
19
+ backgroundColor: DEFAULT_SURFACE.secondary_background_color
20
+ },
21
+ transparent: {
22
+ backgroundColor: DEFAULT_SURFACE.transparent_background_color
23
+ }
24
+ });
25
+ //# sourceMappingURL=styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["Style","DEFAULT_SURFACE","default_background_color","secondary_background_color","transparent_background_color","Styles","create","base","default","backgroundColor","secondary","transparent"],"sourceRoot":"../../../../src","sources":["components/Surface/styles.ts"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,sBAAmB;AAErC,OAAO,MAAMC,eAAe,GAAG;EAC7BC,wBAAwB,EAAE,MAAM;EAChCC,0BAA0B,EAAE,SAAS;EACrCC,4BAA4B,EAAE;AAChC,CAAC;AAID,OAAO,MAAMC,MAAM,GAAGL,KAAK,CAACM,MAAM,CAAC;EACjCC,IAAI,EAAE,CAAC,CAAC;EAER;AACF;AACA;;EAEEC,OAAO,EAAE;IACPC,eAAe,EAAER,eAAe,CAACC;EACnC,CAAC;EACDQ,SAAS,EAAE;IACTD,eAAe,EAAER,eAAe,CAACE;EACnC,CAAC;EAEDQ,WAAW,EAAE;IACXF,eAAe,EAAER,eAAe,CAACG;EACnC;AACF,CAAC,CAAC","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/Surface/types.ts"],"mappings":"","ignoreList":[]}
@@ -1,5 +1,8 @@
1
1
  "use strict";
2
2
 
3
+ // Export Components
4
+ export * from "./components/Card/Card.js";
5
+
3
6
  // Provider
4
7
  export * from "./providers/ThemeProvider.js";
5
8
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":[],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA;AACA,cAAc,8BAA2B","ignoreList":[]}
1
+ {"version":3,"names":[],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA;AACA,cAAc,2BAAwB;;AAEtC;AACA,cAAc,8BAA2B","ignoreList":[]}
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+
3
+ export const LightTheme = {
4
+ components: {
5
+ card: {
6
+ border_radius: 8,
7
+ padding: 16,
8
+ shadow_color: '#000',
9
+ shadow_offset: {
10
+ width: 0,
11
+ height: 2
12
+ },
13
+ shadow_opacity: 0.1,
14
+ shadow_radius: 4,
15
+ elevation: 3
16
+ },
17
+ surface: {
18
+ default_background_color: '#fff',
19
+ secondary_background_color: '#f0f0f0',
20
+ transparent_background_color: 'transparent'
21
+ }
22
+ }
23
+ };
24
+ //# sourceMappingURL=light.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["LightTheme","components","card","border_radius","padding","shadow_color","shadow_offset","width","height","shadow_opacity","shadow_radius","elevation","surface","default_background_color","secondary_background_color","transparent_background_color"],"sourceRoot":"../../../src","sources":["themes/light.ts"],"mappings":";;AAEA,OAAO,MAAMA,UAA2B,GAAG;EACzCC,UAAU,EAAE;IACVC,IAAI,EAAE;MACJC,aAAa,EAAE,CAAC;MAChBC,OAAO,EAAE,EAAE;MACXC,YAAY,EAAE,MAAM;MACpBC,aAAa,EAAE;QAAEC,KAAK,EAAE,CAAC;QAAEC,MAAM,EAAE;MAAE,CAAC;MACtCC,cAAc,EAAE,GAAG;MACnBC,aAAa,EAAE,CAAC;MAChBC,SAAS,EAAE;IACb,CAAC;IACDC,OAAO,EAAE;MACPC,wBAAwB,EAAE,MAAM;MAChCC,0BAA0B,EAAE,SAAS;MACrCC,4BAA4B,EAAE;IAChC;EACF;AACF,CAAC","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":["themes/types.ts"],"mappings":"","ignoreList":[]}
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+
3
+ export {};
4
+ //# sourceMappingURL=general.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"../../../src","sources":["types/general.types.ts"],"mappings":"","ignoreList":[]}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+
3
+ import { StyleSheet } from 'react-native';
4
+ export const Style = StyleSheet;
5
+ export default Style;
6
+ //# sourceMappingURL=Style.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["StyleSheet","Style"],"sourceRoot":"../../../src","sources":["utils/Style.ts"],"mappings":";;AAAA,SAASA,UAAU,QAAQ,cAAc;AAEzC,OAAO,MAAMC,KAAK,GAAGD,UAAU;AAE/B,eAAeC,KAAK","ignoreList":[]}
@@ -0,0 +1,14 @@
1
+ import type { CardProps } from './types';
2
+ /**
3
+ * Card component to display content within a styled container
4
+ * @param {React.ReactNode} children - The content to be displayed inside the card
5
+ * @param {ViewStyle} style - Additional styles for the card container
6
+ * @returns {JSX.Element} The Card component
7
+ * @example
8
+ * <Card style={{ margin: 10 }}>
9
+ * <Text>This is a card</Text>
10
+ * </Card>
11
+ */
12
+ export declare const Card: import("react").ForwardRefExoticComponent<CardProps & import("react").RefAttributes<import("react-native").View>>;
13
+ export default Card;
14
+ //# sourceMappingURL=Card.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Card.d.ts","sourceRoot":"","sources":["../../../../../src/components/Card/Card.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEzC;;;;;;;;;GASG;AACH,eAAO,MAAM,IAAI,mHAYf,CAAC;AAIH,eAAe,IAAI,CAAC"}
@@ -0,0 +1,29 @@
1
+ export declare const DEFAULT_CARD: {
2
+ border_radius: number;
3
+ padding: number;
4
+ shadow_color: string;
5
+ shadow_offset: {
6
+ width: number;
7
+ height: number;
8
+ };
9
+ shadow_opacity: number;
10
+ shadow_radius: number;
11
+ elevation: number;
12
+ };
13
+ export type CardStyleVariables = typeof DEFAULT_CARD;
14
+ export declare const Styles: {
15
+ container: {
16
+ borderRadius: number;
17
+ padding: number;
18
+ shadowColor: string;
19
+ shadowOffset: {
20
+ width: number;
21
+ height: number;
22
+ };
23
+ shadowOpacity: number;
24
+ shadowRadius: number;
25
+ elevation: number;
26
+ };
27
+ };
28
+ export default Styles;
29
+ //# sourceMappingURL=styles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../../src/components/Card/styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,YAAY;;;;;;;;;;;CAQxB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,OAAO,YAAY,CAAC;AAErD,eAAO,MAAM,MAAM;;;;;;;;;;;;;CAUjB,CAAC;AAEH,eAAe,MAAM,CAAC"}
@@ -0,0 +1,17 @@
1
+ import type { ViewProps, ViewStyle } from 'react-native';
2
+ import type { SurfaceVariants } from '../Surface/types';
3
+ /**
4
+ * Props for the Card component
5
+ */
6
+ export interface CardProps extends ViewProps {
7
+ /**
8
+ * Children elements to be rendered inside the Card
9
+ */
10
+ children?: React.ReactNode;
11
+ /**
12
+ * Custom styles for the Card container
13
+ */
14
+ style?: ViewStyle;
15
+ variant?: SurfaceVariants;
16
+ }
17
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/components/Card/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAExD;;GAEG;AACH,MAAM,WAAW,SAAU,SAAQ,SAAS;IAC1C;;OAEG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAElB,OAAO,CAAC,EAAE,eAAe,CAAC;CAC3B"}
@@ -0,0 +1,16 @@
1
+ import { View } from 'react-native';
2
+ import type { SurfaceProps } from './types';
3
+ /**
4
+ * Surface component to provide a styled container
5
+ * @param {React.ReactNode} children - The content to be displayed inside the surface
6
+ * @param {ViewStyle} style - Additional styles for the surface container
7
+ * @param {SurfaceVariants} variant - The variant of the surface styling
8
+ * @returns {JSX.Element} The Surface component
9
+ * @example
10
+ * <Surface variant="secondary" style={{ margin: 10 }}>
11
+ * <Text>This is a surface</Text>
12
+ * </Surface>
13
+ */
14
+ export declare const Surface: import("react").ForwardRefExoticComponent<SurfaceProps & import("react").RefAttributes<View>>;
15
+ export default Surface;
16
+ //# sourceMappingURL=Surface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Surface.d.ts","sourceRoot":"","sources":["../../../../../src/components/Surface/Surface.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAGpC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C;;;;;;;;;;GAUG;AACH,eAAO,MAAM,OAAO,+FAOlB,CAAC;AAIH,eAAe,OAAO,CAAC"}
@@ -0,0 +1,22 @@
1
+ export declare const DEFAULT_SURFACE: {
2
+ default_background_color: string;
3
+ secondary_background_color: string;
4
+ transparent_background_color: string;
5
+ };
6
+ export type SurfaceStyleVariables = typeof DEFAULT_SURFACE;
7
+ export declare const Styles: {
8
+ base: {};
9
+ /**
10
+ * Variants
11
+ */
12
+ default: {
13
+ backgroundColor: string;
14
+ };
15
+ secondary: {
16
+ backgroundColor: string;
17
+ };
18
+ transparent: {
19
+ backgroundColor: string;
20
+ };
21
+ };
22
+ //# sourceMappingURL=styles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../../src/components/Surface/styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,eAAe;;;;CAI3B,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG,OAAO,eAAe,CAAC;AAE3D,eAAO,MAAM,MAAM;;IAGjB;;OAEG;;;;;;;;;;CAYH,CAAC"}
@@ -0,0 +1,12 @@
1
+ import type { ViewProps, ViewStyle } from 'react-native';
2
+ export type SurfaceVariants = 'default' | 'secondary' | 'transparent';
3
+ export interface SurfaceProps extends ViewProps {
4
+ children: React.ReactNode;
5
+ style?: ViewStyle | ViewStyle[];
6
+ /**
7
+ * The variant of the Surface component.
8
+ * @default 'default'
9
+ */
10
+ variant?: SurfaceVariants;
11
+ }
12
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/components/Surface/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzD,MAAM,MAAM,eAAe,GAAG,SAAS,GAAG,WAAW,GAAG,aAAa,CAAC;AAEtE,MAAM,WAAW,YAAa,SAAQ,SAAS;IAC7C,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,KAAK,CAAC,EAAE,SAAS,GAAG,SAAS,EAAE,CAAC;IAEhC;;;OAGG;IACH,OAAO,CAAC,EAAE,eAAe,CAAC;CAC3B"}
@@ -1,2 +1,3 @@
1
+ export * from './components/Card/Card';
1
2
  export * from './providers/ThemeProvider';
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AACA,cAAc,2BAA2B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AACA,cAAc,wBAAwB,CAAC;AAGvC,cAAc,2BAA2B,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { ThemeDefinition } from './types';
2
+ export declare const LightTheme: ThemeDefinition;
3
+ //# sourceMappingURL=light.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"light.d.ts","sourceRoot":"","sources":["../../../../src/themes/light.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAE/C,eAAO,MAAM,UAAU,EAAE,eAiBxB,CAAC"}
@@ -0,0 +1,9 @@
1
+ import type { CardStyleVariables } from '../components/Card/styles';
2
+ import type { SurfaceStyleVariables } from '../components/Surface/styles';
3
+ export type ThemeDefinition = {
4
+ components: {
5
+ card: CardStyleVariables;
6
+ surface: SurfaceStyleVariables;
7
+ };
8
+ };
9
+ //# 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;AAE1E,MAAM,MAAM,eAAe,GAAG;IAC5B,UAAU,EAAE;QACV,IAAI,EAAE,kBAAkB,CAAC;QACzB,OAAO,EAAE,qBAAqB,CAAC;KAChC,CAAC;CACH,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { ComponentRef } from 'react';
2
+ import type { View } from 'react-native';
3
+ export type ViewRef = ComponentRef<typeof View>;
4
+ //# sourceMappingURL=general.types.d.ts.map
@@ -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"}
@@ -0,0 +1,4 @@
1
+ import { StyleSheet } from 'react-native';
2
+ export declare const Style: typeof StyleSheet;
3
+ export default Style;
4
+ //# sourceMappingURL=Style.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Style.d.ts","sourceRoot":"","sources":["../../../../src/utils/Style.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,eAAO,MAAM,KAAK,mBAAa,CAAC;AAEhC,eAAe,KAAK,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dryanovski/react-native-components",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
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",
@@ -17,6 +17,12 @@
17
17
  "src",
18
18
  "lib"
19
19
  ],
20
+ "scripts": {
21
+ "test": "jest",
22
+ "lint": "eslint \"**/*.{js,ts,tsx}\"",
23
+ "clean": "del-cli lib",
24
+ "prepare": "bob build"
25
+ },
20
26
  "keywords": [
21
27
  "react-native",
22
28
  "ios",
@@ -106,10 +112,5 @@
106
112
  "eslint-plugin-react": "^7.37.5",
107
113
  "eslint-plugin-react-hooks": "^7.0.1",
108
114
  "eslint-plugin-react-native": "^5.0.0"
109
- },
110
- "scripts": {
111
- "test": "jest",
112
- "lint": "eslint \"**/*.{js,ts,tsx}\"",
113
- "clean": "del-cli lib"
114
115
  }
115
- }
116
+ }
@@ -0,0 +1,33 @@
1
+ import { forwardRef } from 'react';
2
+ import type { ViewRef } from '../../types/general.types';
3
+ import Surface from '../Surface/Surface';
4
+ import Styles from './styles';
5
+ import type { CardProps } from './types';
6
+
7
+ /**
8
+ * Card component to display content within a styled container
9
+ * @param {React.ReactNode} children - The content to be displayed inside the card
10
+ * @param {ViewStyle} style - Additional styles for the card container
11
+ * @returns {JSX.Element} The Card component
12
+ * @example
13
+ * <Card style={{ margin: 10 }}>
14
+ * <Text>This is a card</Text>
15
+ * </Card>
16
+ */
17
+ export const Card = forwardRef<ViewRef, CardProps>((props, ref) => {
18
+ const { children, variant = 'default', style = {}, ...rest } = props;
19
+ return (
20
+ <Surface
21
+ ref={ref}
22
+ variant={variant}
23
+ style={[Styles.container, style]}
24
+ {...rest}
25
+ >
26
+ {children}
27
+ </Surface>
28
+ );
29
+ });
30
+
31
+ Card.displayName = 'Card';
32
+
33
+ export default Card;
@@ -0,0 +1,27 @@
1
+ import Style from '../../utils/Style';
2
+
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,
11
+ };
12
+
13
+ export type CardStyleVariables = typeof DEFAULT_CARD;
14
+
15
+ export const Styles = Style.create({
16
+ container: {
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
+ },
25
+ });
26
+
27
+ export default Styles;
@@ -0,0 +1,18 @@
1
+ import type { ViewProps, ViewStyle } from 'react-native';
2
+ import type { SurfaceVariants } from '../Surface/types';
3
+
4
+ /**
5
+ * Props for the Card component
6
+ */
7
+ export interface CardProps extends ViewProps {
8
+ /**
9
+ * Children elements to be rendered inside the Card
10
+ */
11
+ children?: React.ReactNode;
12
+ /**
13
+ * Custom styles for the Card container
14
+ */
15
+ style?: ViewStyle;
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
+ }
package/src/index.tsx CHANGED
@@ -1,2 +1,5 @@
1
+ // Export Components
2
+ export * from './components/Card/Card';
3
+
1
4
  // Provider
2
5
  export * from './providers/ThemeProvider';
@@ -0,0 +1,20 @@
1
+ import type { ThemeDefinition } from './types';
2
+
3
+ export const LightTheme: ThemeDefinition = {
4
+ components: {
5
+ card: {
6
+ border_radius: 8,
7
+ padding: 16,
8
+ shadow_color: '#000',
9
+ shadow_offset: { width: 0, height: 2 },
10
+ shadow_opacity: 0.1,
11
+ shadow_radius: 4,
12
+ elevation: 3,
13
+ },
14
+ surface: {
15
+ default_background_color: '#fff',
16
+ secondary_background_color: '#f0f0f0',
17
+ transparent_background_color: 'transparent',
18
+ },
19
+ },
20
+ };
@@ -0,0 +1,9 @@
1
+ import type { CardStyleVariables } from '../components/Card/styles';
2
+ import type { SurfaceStyleVariables } from '../components/Surface/styles';
3
+
4
+ export type ThemeDefinition = {
5
+ components: {
6
+ card: CardStyleVariables;
7
+ surface: SurfaceStyleVariables;
8
+ };
9
+ };
@@ -0,0 +1,4 @@
1
+ import type { ComponentRef } from 'react';
2
+ import type { View } from 'react-native';
3
+
4
+ export type ViewRef = ComponentRef<typeof View>;
@@ -0,0 +1,5 @@
1
+ import { StyleSheet } from 'react-native';
2
+
3
+ export const Style = StyleSheet;
4
+
5
+ export default Style;