@dryanovski/react-native-components 1.0.2 → 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.
- 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/light.js +24 -0
- package/lib/module/themes/light.js.map +1 -0
- package/lib/module/themes/types.js +4 -0
- package/lib/module/themes/types.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/light.d.ts +3 -0
- package/lib/typescript/src/themes/light.d.ts.map +1 -0
- package/lib/typescript/src/themes/types.d.ts +9 -0
- package/lib/typescript/src/themes/types.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 +1 -1
- 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/light.ts +20 -0
- package/src/themes/types.ts +9 -0
- package/src/types/general.types.ts +4 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { forwardRef } from 'react';
|
|
4
|
+
import Surface from "../Surface/Surface.js";
|
|
4
5
|
import Styles from "./styles.js";
|
|
5
6
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
7
|
/**
|
|
@@ -13,17 +14,21 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
13
14
|
* <Text>This is a card</Text>
|
|
14
15
|
* </Card>
|
|
15
16
|
*/
|
|
16
|
-
export const Card = ({
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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,
|
|
22
27
|
style: [Styles.container, style],
|
|
23
|
-
...
|
|
28
|
+
...rest,
|
|
24
29
|
children: children
|
|
25
30
|
});
|
|
26
|
-
};
|
|
31
|
+
});
|
|
27
32
|
Card.displayName = 'Card';
|
|
28
33
|
export default Card;
|
|
29
34
|
//# sourceMappingURL=Card.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
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":[]}
|
|
@@ -1,29 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import Style from "../../utils/Style.js";
|
|
4
|
-
const DEFAULT_CARD = {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
card_shadow_offset: {
|
|
4
|
+
export const DEFAULT_CARD = {
|
|
5
|
+
border_radius: 8,
|
|
6
|
+
padding: 16,
|
|
7
|
+
shadow_color: '#000',
|
|
8
|
+
shadow_offset: {
|
|
10
9
|
width: 0,
|
|
11
10
|
height: 2
|
|
12
11
|
},
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
shadow_opacity: 0.1,
|
|
13
|
+
shadow_radius: 4,
|
|
14
|
+
elevation: 3
|
|
16
15
|
};
|
|
17
16
|
export const Styles = Style.create({
|
|
18
17
|
container: {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
elevation: DEFAULT_CARD.card_elevation
|
|
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
|
|
27
25
|
}
|
|
28
26
|
});
|
|
29
27
|
export default Styles;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Style","DEFAULT_CARD","
|
|
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,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 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../../src","sources":["components/Surface/types.ts"],"mappings":"","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 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["themes/types.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["types/general.types.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -9,6 +9,6 @@ import type { CardProps } from './types';
|
|
|
9
9
|
* <Text>This is a card</Text>
|
|
10
10
|
* </Card>
|
|
11
11
|
*/
|
|
12
|
-
export declare const Card:
|
|
12
|
+
export declare const Card: import("react").ForwardRefExoticComponent<CardProps & import("react").RefAttributes<import("react-native").View>>;
|
|
13
13
|
export default Card;
|
|
14
14
|
//# sourceMappingURL=Card.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Card.d.ts","sourceRoot":"","sources":["../../../../../src/components/Card/Card.tsx"],"names":[],"mappings":"
|
|
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"}
|
|
@@ -1,6 +1,18 @@
|
|
|
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;
|
|
1
14
|
export declare const Styles: {
|
|
2
15
|
container: {
|
|
3
|
-
backgroundColor: string;
|
|
4
16
|
borderRadius: number;
|
|
5
17
|
padding: number;
|
|
6
18
|
shadowColor: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../../src/components/Card/styles.ts"],"names":[],"mappings":"
|
|
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"}
|
|
@@ -1,9 +1,17 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ViewProps, ViewStyle } from 'react-native';
|
|
2
|
+
import type { SurfaceVariants } from '../Surface/types';
|
|
2
3
|
/**
|
|
3
4
|
* Props for the Card component
|
|
4
5
|
*/
|
|
5
|
-
export
|
|
6
|
+
export interface CardProps extends ViewProps {
|
|
7
|
+
/**
|
|
8
|
+
* Children elements to be rendered inside the Card
|
|
9
|
+
*/
|
|
6
10
|
children?: React.ReactNode;
|
|
11
|
+
/**
|
|
12
|
+
* Custom styles for the Card container
|
|
13
|
+
*/
|
|
7
14
|
style?: ViewStyle;
|
|
8
|
-
|
|
15
|
+
variant?: SurfaceVariants;
|
|
16
|
+
}
|
|
9
17
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/components/Card/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
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"}
|
|
@@ -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 @@
|
|
|
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.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",
|
|
@@ -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,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
|
+
};
|