@dryanovski/react-native-components 1.0.6 → 1.0.8
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/assets/fonts/CodanBold.ttf +0 -0
- package/lib/module/assets/fonts/CodanBook.ttf +0 -0
- package/lib/module/assets/fonts/CodanLight.ttf +0 -0
- package/lib/module/assets/fonts/CodanMedium.ttf +0 -0
- package/lib/module/assets/fonts/CodanRegular.ttf +0 -0
- package/lib/module/components/Button/Button.js +41 -0
- package/lib/module/components/Button/Button.js.map +1 -0
- package/lib/module/components/Button/DangerButton.js +19 -0
- package/lib/module/components/Button/DangerButton.js.map +1 -0
- package/lib/module/components/Button/GhostButton.js +15 -0
- package/lib/module/components/Button/GhostButton.js.map +1 -0
- package/lib/module/components/Button/PrimaryButton.js +18 -0
- package/lib/module/components/Button/PrimaryButton.js.map +1 -0
- package/lib/module/components/Button/SecondaryButton.js +18 -0
- package/lib/module/components/Button/SecondaryButton.js.map +1 -0
- package/lib/module/components/Button/style.js +66 -0
- package/lib/module/components/Button/style.js.map +1 -0
- package/lib/module/components/Button/types.js +4 -0
- package/lib/module/components/Button/types.js.map +1 -0
- package/lib/module/components/Divider/Divider.js +33 -0
- package/lib/module/components/Divider/Divider.js.map +1 -0
- package/lib/module/components/Divider/styles.js +2 -0
- package/lib/module/components/Divider/styles.js.map +1 -0
- package/lib/module/components/Divider/types.js +4 -0
- package/lib/module/components/Divider/types.js.map +1 -0
- package/lib/module/components/Layout/HStack.js +24 -0
- package/lib/module/components/Layout/HStack.js.map +1 -0
- package/lib/module/components/Layout/VStack.js +24 -0
- package/lib/module/components/Layout/VStack.js.map +1 -0
- package/lib/module/components/Layout/layout.types.js +4 -0
- package/lib/module/components/Layout/layout.types.js.map +1 -0
- package/lib/module/index.js +17 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/providers/ThemeProvider.js +20 -1
- package/lib/module/providers/ThemeProvider.js.map +1 -1
- package/lib/module/utils/fontScale.js +66 -0
- package/lib/module/utils/fontScale.js.map +1 -0
- package/lib/module/utils/getDeviceType.js +20 -0
- package/lib/module/utils/getDeviceType.js.map +1 -0
- package/lib/module/utils/getScreenSizeCategory.js +16 -0
- package/lib/module/utils/getScreenSizeCategory.js.map +1 -0
- package/lib/typescript/src/components/Button/Button.d.ts +8 -0
- package/lib/typescript/src/components/Button/Button.d.ts.map +1 -0
- package/lib/typescript/src/components/Button/DangerButton.d.ts +8 -0
- package/lib/typescript/src/components/Button/DangerButton.d.ts.map +1 -0
- package/lib/typescript/src/components/Button/GhostButton.d.ts +4 -0
- package/lib/typescript/src/components/Button/GhostButton.d.ts.map +1 -0
- package/lib/typescript/src/components/Button/PrimaryButton.d.ts +7 -0
- package/lib/typescript/src/components/Button/PrimaryButton.d.ts.map +1 -0
- package/lib/typescript/src/components/Button/SecondaryButton.d.ts +7 -0
- package/lib/typescript/src/components/Button/SecondaryButton.d.ts.map +1 -0
- package/lib/typescript/src/components/Button/style.d.ts +64 -0
- package/lib/typescript/src/components/Button/style.d.ts.map +1 -0
- package/lib/typescript/src/components/Button/types.d.ts +51 -0
- package/lib/typescript/src/components/Button/types.d.ts.map +1 -0
- package/lib/typescript/src/components/Divider/Divider.d.ts +5 -0
- package/lib/typescript/src/components/Divider/Divider.d.ts.map +1 -0
- package/lib/typescript/src/components/Divider/styles.d.ts +1 -0
- package/lib/typescript/src/components/Divider/styles.d.ts.map +1 -0
- package/lib/typescript/src/components/Divider/types.d.ts +31 -0
- package/lib/typescript/src/components/Divider/types.d.ts.map +1 -0
- package/lib/typescript/src/components/Layout/HStack.d.ts +4 -0
- package/lib/typescript/src/components/Layout/HStack.d.ts.map +1 -0
- package/lib/typescript/src/components/Layout/VStack.d.ts +4 -0
- package/lib/typescript/src/components/Layout/VStack.d.ts.map +1 -0
- package/lib/typescript/src/components/Layout/layout.types.d.ts +8 -0
- package/lib/typescript/src/components/Layout/layout.types.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +15 -0
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/providers/ThemeProvider.d.ts.map +1 -1
- package/lib/typescript/src/utils/fontScale.d.ts +2 -0
- package/lib/typescript/src/utils/fontScale.d.ts.map +1 -0
- package/lib/typescript/src/utils/getDeviceType.d.ts +2 -0
- package/lib/typescript/src/utils/getDeviceType.d.ts.map +1 -0
- package/lib/typescript/src/utils/getScreenSizeCategory.d.ts +2 -0
- package/lib/typescript/src/utils/getScreenSizeCategory.d.ts.map +1 -0
- package/package.json +4 -3
- package/src/assets/fonts/CodanBold.ttf +0 -0
- package/src/assets/fonts/CodanBook.ttf +0 -0
- package/src/assets/fonts/CodanLight.ttf +0 -0
- package/src/assets/fonts/CodanMedium.ttf +0 -0
- package/src/assets/fonts/CodanRegular.ttf +0 -0
- package/src/components/Button/Button.tsx +55 -0
- package/src/components/Button/DangerButton.tsx +17 -0
- package/src/components/Button/GhostButton.tsx +13 -0
- package/src/components/Button/PrimaryButton.tsx +16 -0
- package/src/components/Button/SecondaryButton.tsx +16 -0
- package/src/components/Button/style.ts +76 -0
- package/src/components/Button/types.ts +62 -0
- package/src/components/Divider/Divider.tsx +28 -0
- package/src/components/Divider/styles.ts +0 -0
- package/src/components/Divider/types.ts +36 -0
- package/src/components/Layout/HStack.tsx +19 -0
- package/src/components/Layout/VStack.tsx +19 -0
- package/src/components/Layout/layout.types.ts +9 -0
- package/src/index.tsx +17 -0
- package/src/providers/ThemeProvider.tsx +20 -0
- package/src/utils/fontScale.ts +51 -0
- package/src/utils/getDeviceType.ts +20 -0
- package/src/utils/getScreenSizeCategory.ts +12 -0
|
@@ -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,51 @@
|
|
|
1
|
+
import type { ComponentRef } from 'react';
|
|
2
|
+
import type { StyleProp, TextStyle, TouchableOpacity, TouchableOpacityProps, ViewStyle } from 'react-native';
|
|
3
|
+
import type Button from './Button';
|
|
4
|
+
/**
|
|
5
|
+
* Ref type for the Button component
|
|
6
|
+
*/
|
|
7
|
+
export type ButtonRef = ComponentRef<typeof TouchableOpacity>;
|
|
8
|
+
/**
|
|
9
|
+
* The root ref type for the Button component
|
|
10
|
+
*/
|
|
11
|
+
export type ButtonBaseRef = ComponentRef<typeof Button>;
|
|
12
|
+
/**
|
|
13
|
+
* The variant types for the Button component
|
|
14
|
+
*/
|
|
15
|
+
export type ButtonVariant = 'primary' | 'secondary' | 'danger' | 'ghost';
|
|
16
|
+
/**
|
|
17
|
+
* Button size types
|
|
18
|
+
*/
|
|
19
|
+
export type ButtonSize = 'small' | 'medium' | 'large';
|
|
20
|
+
export interface ButtonBaseProps extends Omit<TouchableOpacityProps, 'style'> {
|
|
21
|
+
/**
|
|
22
|
+
* The title of the button.
|
|
23
|
+
*/
|
|
24
|
+
title: string;
|
|
25
|
+
/**
|
|
26
|
+
* The style of the button container.
|
|
27
|
+
* Optional.
|
|
28
|
+
*/
|
|
29
|
+
style?: StyleProp<ViewStyle>;
|
|
30
|
+
/**
|
|
31
|
+
* The text style of the button title.
|
|
32
|
+
* Optional.
|
|
33
|
+
*/
|
|
34
|
+
textStyle?: StyleProp<TextStyle>;
|
|
35
|
+
/**
|
|
36
|
+
* The size of the button.
|
|
37
|
+
* @default 'medium'
|
|
38
|
+
*/
|
|
39
|
+
size?: ButtonSize;
|
|
40
|
+
/**
|
|
41
|
+
* The variant of the button.
|
|
42
|
+
* @default 'primary'
|
|
43
|
+
*/
|
|
44
|
+
variant?: ButtonVariant;
|
|
45
|
+
/**
|
|
46
|
+
* Whether the button is disabled.
|
|
47
|
+
* @default false
|
|
48
|
+
*/
|
|
49
|
+
disabled?: boolean;
|
|
50
|
+
}
|
|
51
|
+
//# 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;AACtB,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AAEnC;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,YAAY,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAE9D;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,YAAY,CAAC,OAAO,MAAM,CAAC,CAAC;AAExD;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,WAAW,GAAG,QAAQ,GAAG,OAAO,CAAC;AAEzE;;GAEG;AACH,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"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { View } from 'react-native';
|
|
2
|
+
import type { DividerProps } from './types';
|
|
3
|
+
export declare const Divider: import("react").ForwardRefExoticComponent<DividerProps & import("react").RefAttributes<View>>;
|
|
4
|
+
export default Divider;
|
|
5
|
+
//# sourceMappingURL=Divider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Divider.d.ts","sourceRoot":"","sources":["../../../../../src/components/Divider/Divider.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAkB,MAAM,cAAc,CAAC;AAEpD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE5C,eAAO,MAAM,OAAO,+FAkBlB,CAAC;AAIH,eAAe,OAAO,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=styles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../../src/components/Divider/styles.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { StyleProp, ViewProps, ViewStyle } from 'react-native';
|
|
2
|
+
export type DividerThickness = 1 | 5 | 10;
|
|
3
|
+
export type DividerOrientation = 'horizontal' | 'vertical';
|
|
4
|
+
export interface DividerProps extends ViewProps {
|
|
5
|
+
/**
|
|
6
|
+
* Style for the divider component.
|
|
7
|
+
* Optional.
|
|
8
|
+
*/
|
|
9
|
+
style?: StyleProp<ViewStyle>;
|
|
10
|
+
/**
|
|
11
|
+
* The thickness of the divider.
|
|
12
|
+
* @default 1
|
|
13
|
+
*/
|
|
14
|
+
thickness?: DividerThickness;
|
|
15
|
+
/**
|
|
16
|
+
* The color of the divider.
|
|
17
|
+
* @default '#000'
|
|
18
|
+
*/
|
|
19
|
+
color?: string;
|
|
20
|
+
/**
|
|
21
|
+
* The orientation of the divider.
|
|
22
|
+
* @default 'horizontal'
|
|
23
|
+
*/
|
|
24
|
+
orientation?: DividerOrientation;
|
|
25
|
+
/**
|
|
26
|
+
* The length of the divider.
|
|
27
|
+
* @default '100%'
|
|
28
|
+
*/
|
|
29
|
+
length?: number | string;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/components/Divider/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEpE,MAAM,MAAM,gBAAgB,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC;AAE1C,MAAM,MAAM,kBAAkB,GAAG,YAAY,GAAG,UAAU,CAAC;AAE3D,MAAM,WAAW,YAAa,SAAQ,SAAS;IAC7C;;;OAGG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B;;;OAGG;IACH,SAAS,CAAC,EAAE,gBAAgB,CAAC;IAE7B;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;OAGG;IACH,WAAW,CAAC,EAAE,kBAAkB,CAAC;IAEjC;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CAC1B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HStack.d.ts","sourceRoot":"","sources":["../../../../../src/components/Layout/HStack.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAGpC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD,eAAO,MAAM,MAAM,8FAIjB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VStack.d.ts","sourceRoot":"","sources":["../../../../../src/components/Layout/VStack.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAGpC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD,eAAO,MAAM,MAAM,8FAIjB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layout.types.d.ts","sourceRoot":"","sources":["../../../../../src/components/Layout/layout.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzD,MAAM,MAAM,WAAW,GAAG;IACxB,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAC9B,CAAC"}
|
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
export * from './components/Button/Button';
|
|
2
|
+
export * from './components/Button/DangerButton';
|
|
3
|
+
export * from './components/Button/GhostButton';
|
|
4
|
+
export * from './components/Button/PrimaryButton';
|
|
5
|
+
export * from './components/Button/SecondaryButton';
|
|
1
6
|
export * from './components/Card/Card';
|
|
7
|
+
export * from './components/Divider/Divider';
|
|
8
|
+
export * from './components/Layout/HStack';
|
|
9
|
+
export * from './components/Layout/VStack';
|
|
10
|
+
export * from './components/Surface/Surface';
|
|
11
|
+
export * from './components/Button/types';
|
|
12
|
+
export * from './components/Card/types';
|
|
13
|
+
export * from './components/Divider/types';
|
|
14
|
+
export * from './components/Layout/layout.types';
|
|
15
|
+
export * from './components/Surface/types';
|
|
16
|
+
export * from './types/general.types';
|
|
2
17
|
export * from './providers/ThemeProvider';
|
|
3
18
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AACA,cAAc,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AACA,cAAc,4BAA4B,CAAC;AAC3C,cAAc,kCAAkC,CAAC;AACjD,cAAc,iCAAiC,CAAC;AAChD,cAAc,mCAAmC,CAAC;AAClD,cAAc,qCAAqC,CAAC;AACpD,cAAc,wBAAwB,CAAC;AACvC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,8BAA8B,CAAC;AAG7C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,yBAAyB,CAAC;AACxC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,kCAAkC,CAAC;AACjD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,uBAAuB,CAAC;AAGtC,cAAc,2BAA2B,CAAC"}
|
|
@@ -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;
|
|
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 @@
|
|
|
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 @@
|
|
|
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 @@
|
|
|
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.
|
|
3
|
+
"version": "1.0.8",
|
|
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.
|
|
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.
|
|
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
|
|
Binary file
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { forwardRef } 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
|
+
/**
|
|
12
|
+
* A customizable button component that supports different variants and sizes.
|
|
13
|
+
* @return A TouchableOpacity button with text.
|
|
14
|
+
*/
|
|
15
|
+
export const Button = forwardRef<ButtonRef, ButtonBaseProps>((props, ref) => {
|
|
16
|
+
const {
|
|
17
|
+
variant = 'primary',
|
|
18
|
+
title,
|
|
19
|
+
size = 'medium',
|
|
20
|
+
onPress = () => undefined,
|
|
21
|
+
style,
|
|
22
|
+
disabled = false,
|
|
23
|
+
textStyle,
|
|
24
|
+
...rest
|
|
25
|
+
} = props;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Derives the text style variant based on the button variant.
|
|
29
|
+
*/
|
|
30
|
+
const textVariant = ('text_' + variant) as `text_${ButtonVariant}`;
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<TouchableOpacity
|
|
34
|
+
ref={ref}
|
|
35
|
+
onPress={onPress}
|
|
36
|
+
disabled={disabled}
|
|
37
|
+
style={[
|
|
38
|
+
Styles._base,
|
|
39
|
+
Styles[size as ButtonSize],
|
|
40
|
+
Styles[variant as ButtonVariant],
|
|
41
|
+
disabled && Styles._disabled,
|
|
42
|
+
style,
|
|
43
|
+
]}
|
|
44
|
+
{...rest}
|
|
45
|
+
>
|
|
46
|
+
<Text style={[Styles._text, Styles[textVariant], textStyle]}>
|
|
47
|
+
{title}
|
|
48
|
+
</Text>
|
|
49
|
+
</TouchableOpacity>
|
|
50
|
+
);
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
Button.displayName = 'ButtonBase';
|
|
54
|
+
|
|
55
|
+
export default Button;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { forwardRef } from 'react';
|
|
2
|
+
import { Button } from './Button';
|
|
3
|
+
import type { ButtonBaseProps, ButtonBaseRef } 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 } from './Button';
|
|
3
|
+
import type { ButtonBaseProps, ButtonBaseRef } 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 } from './Button';
|
|
3
|
+
import type { ButtonBaseProps, ButtonBaseRef } 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 } from './Button';
|
|
3
|
+
import type { ButtonBaseProps, ButtonBaseRef } 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,62 @@
|
|
|
1
|
+
import type { ComponentRef } from 'react';
|
|
2
|
+
import type {
|
|
3
|
+
StyleProp,
|
|
4
|
+
TextStyle,
|
|
5
|
+
TouchableOpacity,
|
|
6
|
+
TouchableOpacityProps,
|
|
7
|
+
ViewStyle,
|
|
8
|
+
} from 'react-native';
|
|
9
|
+
import type Button from './Button';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Ref type for the Button component
|
|
13
|
+
*/
|
|
14
|
+
export type ButtonRef = ComponentRef<typeof TouchableOpacity>;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* The root ref type for the Button component
|
|
18
|
+
*/
|
|
19
|
+
export type ButtonBaseRef = ComponentRef<typeof Button>;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* The variant types for the Button component
|
|
23
|
+
*/
|
|
24
|
+
export type ButtonVariant = 'primary' | 'secondary' | 'danger' | 'ghost';
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Button size types
|
|
28
|
+
*/
|
|
29
|
+
export type ButtonSize = 'small' | 'medium' | 'large';
|
|
30
|
+
|
|
31
|
+
export interface ButtonBaseProps extends Omit<TouchableOpacityProps, 'style'> {
|
|
32
|
+
/**
|
|
33
|
+
* The title of the button.
|
|
34
|
+
*/
|
|
35
|
+
title: string;
|
|
36
|
+
/**
|
|
37
|
+
* The style of the button container.
|
|
38
|
+
* Optional.
|
|
39
|
+
*/
|
|
40
|
+
style?: StyleProp<ViewStyle>;
|
|
41
|
+
/**
|
|
42
|
+
* The text style of the button title.
|
|
43
|
+
* Optional.
|
|
44
|
+
*/
|
|
45
|
+
textStyle?: StyleProp<TextStyle>;
|
|
46
|
+
/**
|
|
47
|
+
* The size of the button.
|
|
48
|
+
* @default 'medium'
|
|
49
|
+
*/
|
|
50
|
+
size?: ButtonSize;
|
|
51
|
+
/**
|
|
52
|
+
* The variant of the button.
|
|
53
|
+
* @default 'primary'
|
|
54
|
+
*/
|
|
55
|
+
variant?: ButtonVariant;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Whether the button is disabled.
|
|
59
|
+
* @default false
|
|
60
|
+
*/
|
|
61
|
+
disabled?: boolean;
|
|
62
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { forwardRef } from 'react';
|
|
2
|
+
import { View, type ViewStyle } from 'react-native';
|
|
3
|
+
import type { ViewRef } from '../../types/general.types';
|
|
4
|
+
import type { DividerProps } from './types';
|
|
5
|
+
|
|
6
|
+
export const Divider = forwardRef<ViewRef, DividerProps>((props, ref) => {
|
|
7
|
+
const {
|
|
8
|
+
thickness = 1,
|
|
9
|
+
color = '#c4c4c4',
|
|
10
|
+
orientation = 'horizontal',
|
|
11
|
+
length = '100%',
|
|
12
|
+
style,
|
|
13
|
+
...rest
|
|
14
|
+
} = props;
|
|
15
|
+
|
|
16
|
+
const dividerStyle = {
|
|
17
|
+
backgroundColor: color,
|
|
18
|
+
...(orientation === 'vertical'
|
|
19
|
+
? { width: thickness, height: length }
|
|
20
|
+
: { height: thickness, width: length }),
|
|
21
|
+
} as ViewStyle;
|
|
22
|
+
|
|
23
|
+
return <View ref={ref} style={[dividerStyle, style]} {...rest} />;
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
Divider.displayName = 'Divider';
|
|
27
|
+
|
|
28
|
+
export default Divider;
|
|
File without changes
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { StyleProp, ViewProps, ViewStyle } from 'react-native';
|
|
2
|
+
|
|
3
|
+
export type DividerThickness = 1 | 5 | 10;
|
|
4
|
+
|
|
5
|
+
export type DividerOrientation = 'horizontal' | 'vertical';
|
|
6
|
+
|
|
7
|
+
export interface DividerProps extends ViewProps {
|
|
8
|
+
/**
|
|
9
|
+
* Style for the divider component.
|
|
10
|
+
* Optional.
|
|
11
|
+
*/
|
|
12
|
+
style?: StyleProp<ViewStyle>;
|
|
13
|
+
/**
|
|
14
|
+
* The thickness of the divider.
|
|
15
|
+
* @default 1
|
|
16
|
+
*/
|
|
17
|
+
thickness?: DividerThickness;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* The color of the divider.
|
|
21
|
+
* @default '#000'
|
|
22
|
+
*/
|
|
23
|
+
color?: string;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* The orientation of the divider.
|
|
27
|
+
* @default 'horizontal'
|
|
28
|
+
*/
|
|
29
|
+
orientation?: DividerOrientation;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* The length of the divider.
|
|
33
|
+
* @default '100%'
|
|
34
|
+
*/
|
|
35
|
+
length?: number | string;
|
|
36
|
+
}
|