@navegarti/rn-design-system 0.7.9 → 0.8.0
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/api.js +1 -0
- package/components.js +1 -0
- package/form.js +1 -0
- package/hooks.js +1 -0
- package/lib/module/api/axios-adapter.js +2 -22
- package/lib/module/components/Card/index.js +16 -0
- package/lib/module/components/Card/styles.js +38 -0
- package/lib/module/components/Card/types.js +4 -0
- package/lib/module/components/Carousel/components/see-all-button.js +3 -3
- package/lib/module/components/Input/components/input-password-toggle.js +1 -1
- package/lib/module/components.js +1 -0
- package/lib/module/form.js +0 -1
- package/lib/module/index.js +1 -2
- package/lib/module/utils.js +0 -1
- package/lib/typescript/src/api/axios-adapter.d.ts +5 -9
- package/lib/typescript/src/api/types.d.ts +4 -14
- package/lib/typescript/src/api.d.ts +1 -1
- package/lib/typescript/src/components/Card/index.d.ts +1202 -0
- package/lib/typescript/src/components/Card/styles.d.ts +1348 -0
- package/lib/typescript/src/components/Card/types.d.ts +13 -0
- package/lib/typescript/src/components/Input/components/input-field.d.ts +1 -1
- package/lib/typescript/src/components/Input/index.d.ts +1 -1
- package/lib/typescript/src/components/OTPInput/utils.d.ts +1 -1
- package/lib/typescript/src/components.d.ts +2 -0
- package/lib/typescript/src/form.d.ts +0 -1
- package/lib/typescript/src/index.d.ts +3 -3
- package/lib/typescript/src/utils.d.ts +0 -1
- package/package.json +8 -7
- package/src/api/axios-adapter.ts +9 -42
- package/src/api/types.ts +4 -21
- package/src/api.tsx +1 -1
- package/src/components/Card/index.tsx +23 -0
- package/src/components/Card/styles.ts +45 -0
- package/src/components/Card/types.ts +22 -0
- package/src/components/Carousel/components/see-all-button.tsx +7 -3
- package/src/components/Input/components/input-field.tsx +1 -1
- package/src/components/Input/components/input-password-toggle.tsx +1 -1
- package/src/components.tsx +2 -0
- package/src/form.tsx +0 -1
- package/src/index.tsx +3 -3
- package/src/utils.tsx +0 -1
- package/utils.js +1 -0
- package/lib/module/components/Icon/index.js +0 -11
- package/lib/module/libs/tanstack-form.js +0 -5
- package/lib/module/utils/shadowStyledIos.js +0 -8
- package/lib/typescript/src/components/Icon/index.d.ts +0 -9
- package/lib/typescript/src/libs/tanstack-form.d.ts +0 -3
- package/lib/typescript/src/utils/shadowStyledIos.d.ts +0 -3
- package/src/components/Icon/index.tsx +0 -14
- package/src/libs/tanstack-form.tsx +0 -3
- package/src/utils/shadowStyledIos.ts +0 -6
package/api.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './lib/module/api.js';
|
package/components.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './lib/module/components.js';
|
package/form.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './lib/module/form.js';
|
package/hooks.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './lib/module/hooks.js';
|
|
@@ -84,24 +84,7 @@ export class AxiosAdapter {
|
|
|
84
84
|
* Transforms axios response to standardized ApiResponse format
|
|
85
85
|
*/
|
|
86
86
|
transformResponse(response) {
|
|
87
|
-
return
|
|
88
|
-
success: true,
|
|
89
|
-
data: response.data,
|
|
90
|
-
statusCode: response.status,
|
|
91
|
-
error: ''
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* Transforms error to standardized ApiResponse format
|
|
97
|
-
*/
|
|
98
|
-
transformError(error, statusCode = 0) {
|
|
99
|
-
return {
|
|
100
|
-
success: false,
|
|
101
|
-
data: null,
|
|
102
|
-
statusCode,
|
|
103
|
-
error: error.message
|
|
104
|
-
};
|
|
87
|
+
return response.data;
|
|
105
88
|
}
|
|
106
89
|
|
|
107
90
|
/**
|
|
@@ -114,10 +97,7 @@ export class AxiosAdapter {
|
|
|
114
97
|
});
|
|
115
98
|
return this.transformResponse(response);
|
|
116
99
|
} catch (error) {
|
|
117
|
-
|
|
118
|
-
const statusCode = mappedError instanceof NetworkError ? 0 : mappedError.statusCode ?? 0;
|
|
119
|
-
console.error('[API Error]', mappedError);
|
|
120
|
-
return this.transformError(mappedError, statusCode);
|
|
100
|
+
throw this.mapError(error, url, method);
|
|
121
101
|
}
|
|
122
102
|
}
|
|
123
103
|
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { CardContainer, CardContent, CardDescription, CardImage, CardTitle } from "./styles.js";
|
|
4
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
|
+
const CardRoot = props => /*#__PURE__*/_jsx(CardContainer, {
|
|
6
|
+
activeOpacity: 0.7,
|
|
7
|
+
...props
|
|
8
|
+
});
|
|
9
|
+
const Card = Object.assign(CardRoot, {
|
|
10
|
+
Image: CardImage,
|
|
11
|
+
Content: CardContent,
|
|
12
|
+
Title: CardTitle,
|
|
13
|
+
Description: CardDescription
|
|
14
|
+
});
|
|
15
|
+
export { Card };
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import styled from '@emotion/native';
|
|
4
|
+
import { Text } from "../Text/index.js";
|
|
5
|
+
export const CardContainer = styled.TouchableOpacity(({
|
|
6
|
+
shadow = true,
|
|
7
|
+
borderRadius = 12
|
|
8
|
+
}) => ({
|
|
9
|
+
backgroundColor: '#fff',
|
|
10
|
+
borderRadius,
|
|
11
|
+
overflow: 'hidden',
|
|
12
|
+
...(shadow && {
|
|
13
|
+
boxShadow: '0px 2px 8px rgba(0, 0, 0, 0.15)',
|
|
14
|
+
elevation: 3
|
|
15
|
+
})
|
|
16
|
+
}));
|
|
17
|
+
export const CardImage = styled.Image(({
|
|
18
|
+
height = 200
|
|
19
|
+
}) => ({
|
|
20
|
+
width: '100%',
|
|
21
|
+
height,
|
|
22
|
+
resizeMode: 'cover'
|
|
23
|
+
}));
|
|
24
|
+
export const CardContent = styled.View({
|
|
25
|
+
padding: 20,
|
|
26
|
+
gap: 4
|
|
27
|
+
});
|
|
28
|
+
export const CardTitle = styled(Text)({
|
|
29
|
+
fontSize: 16,
|
|
30
|
+
fontWeight: 'bold',
|
|
31
|
+
color: '#333'
|
|
32
|
+
});
|
|
33
|
+
export const CardDescription = styled(Text)({
|
|
34
|
+
fontSize: 13,
|
|
35
|
+
fontWeight: '400',
|
|
36
|
+
color: '#666'
|
|
37
|
+
});
|
|
38
|
+
//# sourceMappingURL=styles.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import { faChevronRight } from '@fortawesome/
|
|
4
|
-
import
|
|
3
|
+
import { faChevronRight } from '@fortawesome/free-solid-svg-icons';
|
|
4
|
+
import { FontAwesomeIcon } from '@fortawesome/react-native-fontawesome';
|
|
5
5
|
import { Text } from "../../Text/index.js";
|
|
6
6
|
import { SeeAllButton } from "../styles.js";
|
|
7
7
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -15,7 +15,7 @@ const CarouselSeeAllButton = ({
|
|
|
15
15
|
weight: "bold",
|
|
16
16
|
color: color ?? '#014661',
|
|
17
17
|
children: "Ver todos"
|
|
18
|
-
}), /*#__PURE__*/_jsx(
|
|
18
|
+
}), /*#__PURE__*/_jsx(FontAwesomeIcon, {
|
|
19
19
|
icon: faChevronRight,
|
|
20
20
|
size: 12,
|
|
21
21
|
color: color ?? '#014661'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import { faEye, faEyeSlash } from '@fortawesome/
|
|
3
|
+
import { faEye, faEyeSlash } from '@fortawesome/free-solid-svg-icons';
|
|
4
4
|
import { FontAwesomeIcon } from '@fortawesome/react-native-fontawesome';
|
|
5
5
|
import { Pressable } from 'react-native';
|
|
6
6
|
import { useInputContext } from "../context.js";
|
package/lib/module/components.js
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
export { Button } from "./components/Button/index.js";
|
|
9
|
+
export { Card } from "./components/Card/index.js";
|
|
9
10
|
export { Carousel } from "./components/Carousel/index.js";
|
|
10
11
|
export { Checkbox } from "./components/Checkbox/index.js";
|
|
11
12
|
export { FAB } from "./components/FAB/index.js";
|
package/lib/module/form.js
CHANGED
package/lib/module/index.js
CHANGED
|
@@ -16,6 +16,7 @@ export { ApiError, AuthError, NetworkError, NotFoundError, RateLimitError, Serve
|
|
|
16
16
|
export { AxiosAdapter, apiRequest, useAuthStore } from "./api/index.js";
|
|
17
17
|
// Components
|
|
18
18
|
export { Button } from "./components/Button/index.js";
|
|
19
|
+
export { Card } from "./components/Card/index.js";
|
|
19
20
|
export { Carousel } from "./components/Carousel/index.js";
|
|
20
21
|
export { Checkbox } from "./components/Checkbox/index.js";
|
|
21
22
|
export { FAB } from "./components/FAB/index.js";
|
|
@@ -37,7 +38,6 @@ export { useAppIsActive } from "./hooks/useAppIsActive.js";
|
|
|
37
38
|
export { useAppSecurity } from "./hooks/useAppSecurity.js";
|
|
38
39
|
export { useNetworkMonitor, useNetworkStatus } from "./hooks/useNetworkStatus.js";
|
|
39
40
|
export { useStatusBar } from "./hooks/useStatusBar.js";
|
|
40
|
-
export { tanstackForm } from "./libs/tanstack-form.js";
|
|
41
41
|
|
|
42
42
|
// Utils
|
|
43
43
|
export { camelCase } from "./utils/camelCase.js";
|
|
@@ -54,7 +54,6 @@ export { isObject } from "./utils/isObject.js";
|
|
|
54
54
|
export { Masks } from "./utils/masks.js";
|
|
55
55
|
export { priceFormatter } from "./utils/priceFormatter.js";
|
|
56
56
|
export { removeTextAccents } from "./utils/removeTextAccents.js";
|
|
57
|
-
export { shadowStyledIos } from "./utils/shadowStyledIos.js";
|
|
58
57
|
export { sortBy } from "./utils/sortBy.js";
|
|
59
58
|
export { uniqBy } from "./utils/uniqBy.js";
|
|
60
59
|
export { userFullnameInitialsExtractor } from "./utils/userFullnameInitialsExtractor.js";
|
package/lib/module/utils.js
CHANGED
|
@@ -19,7 +19,6 @@ export { isObject } from "./utils/isObject.js";
|
|
|
19
19
|
export { Masks } from "./utils/masks.js";
|
|
20
20
|
export { priceFormatter } from "./utils/priceFormatter.js";
|
|
21
21
|
export { removeTextAccents } from "./utils/removeTextAccents.js";
|
|
22
|
-
export { shadowStyledIos } from "./utils/shadowStyledIos.js";
|
|
23
22
|
export { sortBy } from "./utils/sortBy.js";
|
|
24
23
|
export { uniqBy } from "./utils/uniqBy.js";
|
|
25
24
|
export { userFullnameInitialsExtractor } from "./utils/userFullnameInitialsExtractor.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type AxiosRequestConfig } from 'axios';
|
|
2
|
-
import type { ApiConfig,
|
|
2
|
+
import type { ApiConfig, IHttpAdapter } from './types';
|
|
3
3
|
/**
|
|
4
4
|
* Axios-based HTTP adapter implementation
|
|
5
5
|
* Implements retry logic, error handling, and token management
|
|
@@ -20,10 +20,6 @@ export declare class AxiosAdapter implements IHttpAdapter {
|
|
|
20
20
|
* Transforms axios response to standardized ApiResponse format
|
|
21
21
|
*/
|
|
22
22
|
private transformResponse;
|
|
23
|
-
/**
|
|
24
|
-
* Transforms error to standardized ApiResponse format
|
|
25
|
-
*/
|
|
26
|
-
private transformError;
|
|
27
23
|
/**
|
|
28
24
|
* Executes HTTP request with retry logic and error handling
|
|
29
25
|
*/
|
|
@@ -31,19 +27,19 @@ export declare class AxiosAdapter implements IHttpAdapter {
|
|
|
31
27
|
/**
|
|
32
28
|
* Performs GET request
|
|
33
29
|
*/
|
|
34
|
-
get<T = unknown>(url: string, config?: AxiosRequestConfig): Promise<
|
|
30
|
+
get<T = unknown>(url: string, config?: AxiosRequestConfig): Promise<T>;
|
|
35
31
|
/**
|
|
36
32
|
* Performs POST request
|
|
37
33
|
*/
|
|
38
|
-
post<T = unknown>(url: string, data?: unknown, config?: AxiosRequestConfig): Promise<
|
|
34
|
+
post<T = unknown>(url: string, data?: unknown, config?: AxiosRequestConfig): Promise<T>;
|
|
39
35
|
/**
|
|
40
36
|
* Performs PUT request
|
|
41
37
|
*/
|
|
42
|
-
put<T = unknown>(url: string, data?: unknown, config?: AxiosRequestConfig): Promise<
|
|
38
|
+
put<T = unknown>(url: string, data?: unknown, config?: AxiosRequestConfig): Promise<T>;
|
|
43
39
|
/**
|
|
44
40
|
* Performs DELETE request
|
|
45
41
|
*/
|
|
46
|
-
delete<T = unknown>(url: string, config?: AxiosRequestConfig): Promise<
|
|
42
|
+
delete<T = unknown>(url: string, config?: AxiosRequestConfig): Promise<T>;
|
|
47
43
|
/**
|
|
48
44
|
* Adds authentication token to store
|
|
49
45
|
* Token will be automatically included in all subsequent requests
|
|
@@ -1,14 +1,4 @@
|
|
|
1
1
|
import type { AxiosRequestConfig } from 'axios';
|
|
2
|
-
/**
|
|
3
|
-
* Standardized API response format
|
|
4
|
-
* @template T - The type of data returned on success
|
|
5
|
-
*/
|
|
6
|
-
export interface ApiResponse<T = unknown> {
|
|
7
|
-
success: boolean;
|
|
8
|
-
data: T | null;
|
|
9
|
-
statusCode: number;
|
|
10
|
-
error: string;
|
|
11
|
-
}
|
|
12
2
|
/**
|
|
13
3
|
* Configuration options for API adapter
|
|
14
4
|
*/
|
|
@@ -27,22 +17,22 @@ export interface IHttpAdapter {
|
|
|
27
17
|
* Performs a GET request
|
|
28
18
|
* @template T - Expected response data type
|
|
29
19
|
*/
|
|
30
|
-
get<T = unknown>(url: string, config?: AxiosRequestConfig): Promise<
|
|
20
|
+
get<T = unknown>(url: string, config?: AxiosRequestConfig): Promise<T>;
|
|
31
21
|
/**
|
|
32
22
|
* Performs a POST request
|
|
33
23
|
* @template T - Expected response data type
|
|
34
24
|
*/
|
|
35
|
-
post<T = unknown>(url: string, data?: unknown, config?: AxiosRequestConfig): Promise<
|
|
25
|
+
post<T = unknown>(url: string, data?: unknown, config?: AxiosRequestConfig): Promise<T>;
|
|
36
26
|
/**
|
|
37
27
|
* Performs a PUT request
|
|
38
28
|
* @template T - Expected response data type
|
|
39
29
|
*/
|
|
40
|
-
put<T = unknown>(url: string, data?: unknown, config?: AxiosRequestConfig): Promise<
|
|
30
|
+
put<T = unknown>(url: string, data?: unknown, config?: AxiosRequestConfig): Promise<T>;
|
|
41
31
|
/**
|
|
42
32
|
* Performs a DELETE request
|
|
43
33
|
* @template T - Expected response data type
|
|
44
34
|
*/
|
|
45
|
-
delete<T = unknown>(url: string, config?: AxiosRequestConfig): Promise<
|
|
35
|
+
delete<T = unknown>(url: string, config?: AxiosRequestConfig): Promise<T>;
|
|
46
36
|
/**
|
|
47
37
|
* Adds authentication token to all subsequent requests
|
|
48
38
|
*/
|
|
@@ -4,5 +4,5 @@
|
|
|
4
4
|
*/
|
|
5
5
|
export { ApiError, AuthError, NetworkError, NotFoundError, RateLimitError, ServerError, TimeoutError, ValidationError, } from './api/errors';
|
|
6
6
|
export { AxiosAdapter, apiRequest, useAuthStore } from './api/index';
|
|
7
|
-
export type { ApiConfig,
|
|
7
|
+
export type { ApiConfig, IHttpAdapter } from './api/types';
|
|
8
8
|
//# sourceMappingURL=api.d.ts.map
|