@gaddario98/react-native-core 1.0.32 → 2.0.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/LICENSE.txt +20 -20
- package/README.md +15 -15
- package/dist/auth/index.d.ts +1 -1
- package/dist/auth/index.js +1 -1
- package/dist/auth/index.mjs +1 -1
- package/dist/config/index.d.ts +11 -16
- package/dist/config/index.js +122 -25
- package/dist/config/index.js.map +1 -1
- package/dist/config/index.mjs +122 -25
- package/dist/config/index.mjs.map +1 -1
- package/dist/expo/index.d.ts +17 -1
- package/dist/expo/index.js +445 -1
- package/dist/expo/index.js.map +1 -1
- package/dist/expo/index.mjs +445 -1
- package/dist/expo/index.mjs.map +1 -1
- package/dist/form/index.d.ts +1 -1
- package/dist/form/index.js +1 -1
- package/dist/form/index.mjs +1 -1
- package/dist/index.d.ts +160 -26
- package/dist/index.js +1 -26
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -26
- package/dist/index.mjs.map +1 -1
- package/dist/layouts/index.d.ts +30 -1
- package/dist/layouts/index.js +43 -1
- package/dist/layouts/index.js.map +1 -1
- package/dist/layouts/index.mjs +43 -1
- package/dist/layouts/index.mjs.map +1 -1
- package/dist/localization/index.d.ts +1 -1
- package/dist/localization/index.js +1 -1
- package/dist/localization/index.mjs +1 -1
- package/dist/pages/index.d.ts +11 -1
- package/dist/pages/index.js +231 -1
- package/dist/pages/index.js.map +1 -1
- package/dist/pages/index.mjs +231 -1
- package/dist/pages/index.mjs.map +1 -1
- package/dist/providers/index.d.ts +18 -1
- package/dist/providers/index.js +24 -1
- package/dist/providers/index.js.map +1 -1
- package/dist/providers/index.mjs +24 -1
- package/dist/providers/index.mjs.map +1 -1
- package/dist/queries/index.d.ts +1 -1
- package/dist/queries/index.js +1 -1
- package/dist/queries/index.mjs +1 -1
- package/dist/state/index.d.ts +10 -1
- package/dist/state/index.js +241 -1
- package/dist/state/index.js.map +1 -1
- package/dist/state/index.mjs +241 -1
- package/dist/state/index.mjs.map +1 -1
- package/dist/tabs/index.d.ts +89 -1
- package/dist/tabs/index.js +485 -1
- package/dist/tabs/index.js.map +1 -1
- package/dist/tabs/index.mjs +485 -1
- package/dist/tabs/index.mjs.map +1 -1
- package/dist/utiles/index.d.ts +5 -1
- package/dist/utiles/index.js +3 -1
- package/dist/utiles/index.js.map +1 -1
- package/dist/utiles/index.mjs +3 -1
- package/dist/utiles/index.mjs.map +1 -1
- package/package.json +181 -153
package/dist/index.d.ts
CHANGED
|
@@ -1,29 +1,163 @@
|
|
|
1
|
-
export * from '@gaddario98/react-auth';
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
export * from '@gaddario98/
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
export * from '@gaddario98/react-
|
|
13
|
-
|
|
14
|
-
export * from '@gaddario98/react-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
1
|
+
export * from '@gaddario98/react-core/auth';
|
|
2
|
+
import * as _tanstack_query_persist_client_core from '@tanstack/query-persist-client-core';
|
|
3
|
+
import { CoreConfig } from '@gaddario98/react-core';
|
|
4
|
+
import * as React$1 from 'react';
|
|
5
|
+
import React__default from 'react';
|
|
6
|
+
import * as Notifications from 'expo-notifications';
|
|
7
|
+
import { FieldValues } from '@gaddario98/react-core/form';
|
|
8
|
+
export * from '@gaddario98/react-core/form';
|
|
9
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
10
|
+
import { NativeStackHeaderProps, NativeStackNavigationOptions } from '@react-navigation/native-stack';
|
|
11
|
+
import { Href, HrefObject } from 'expo-router';
|
|
12
|
+
export * from '@gaddario98/react-core/localization';
|
|
13
|
+
import { DefaultContainerProps, ViewSettings } from '@gaddario98/react-core/pages';
|
|
14
|
+
export * from '@gaddario98/react-core/pages';
|
|
15
|
+
import { QueriesArray } from '@gaddario98/react-core/queries';
|
|
16
|
+
export * from '@gaddario98/react-core/queries';
|
|
17
|
+
import { StyleProp, ViewStyle, TextStyle } from 'react-native';
|
|
18
|
+
export * from '@gaddario98/react-core/utiles';
|
|
19
|
+
export { AtomGeneratorOptions, AtomState, PrimitiveAtom, SyncStorage, atomStateGenerator } from '@gaddario98/react-core/state';
|
|
20
|
+
|
|
21
|
+
declare const asyncStoragePersister: _tanstack_query_persist_client_core.Persister;
|
|
22
|
+
declare const useReactNativeCoreConfig: (props: Partial<CoreConfig>) => void;
|
|
23
|
+
|
|
24
|
+
declare const ReactNativeCoreProvider: ({ children, coreConfig, }: {
|
|
25
|
+
children: React.ReactNode;
|
|
26
|
+
coreConfig?: Partial<CoreConfig>;
|
|
27
|
+
}) => React$1.ReactNode;
|
|
28
|
+
|
|
29
|
+
type NotificationPermissionStatus = "granted" | "denied" | "undetermined";
|
|
30
|
+
interface UseNotificationsReturn {
|
|
31
|
+
expoPushToken: string;
|
|
32
|
+
permissionStatus: NotificationPermissionStatus | null;
|
|
33
|
+
initializeNotifications: (id: string) => Promise<void>;
|
|
34
|
+
sendLocalNotification: (title: string, body: string, data?: Record<string, unknown>) => Promise<void>;
|
|
35
|
+
}
|
|
36
|
+
interface Props {
|
|
37
|
+
updateToken: (token: string) => Promise<void>;
|
|
38
|
+
setNotification: (notification: Notifications.Notification) => void;
|
|
39
|
+
}
|
|
40
|
+
declare const useExpoNotifications: ({ updateToken, setNotification, }: Props) => UseNotificationsReturn;
|
|
41
|
+
|
|
42
|
+
interface Screen {
|
|
43
|
+
name: string;
|
|
44
|
+
requireAuth?: boolean;
|
|
45
|
+
hideIfAuth?: boolean;
|
|
46
|
+
ns?: string;
|
|
47
|
+
userType?: string;
|
|
48
|
+
redirectTo?: Href | "tab";
|
|
49
|
+
header?: (props: NativeStackHeaderProps) => React.ReactNode;
|
|
50
|
+
options?: NativeStackNavigationOptions;
|
|
51
|
+
}
|
|
52
|
+
interface LayoutGeneratorProps {
|
|
53
|
+
screens: Screen[];
|
|
54
|
+
userType?: string;
|
|
55
|
+
initialRouteName?: string;
|
|
56
|
+
}
|
|
57
|
+
interface LayoutGeneratorConfig {
|
|
58
|
+
header?: (props: NativeStackHeaderProps) => React.ReactNode;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
declare const LayoutGenerator: ({ screens, userType, initialRouteName, }: LayoutGeneratorProps) => react_jsx_runtime.JSX.Element;
|
|
62
|
+
|
|
63
|
+
declare let layoutGeneratorConfig: LayoutGeneratorConfig;
|
|
64
|
+
declare const setLayoutGeneratorConfig: (config: LayoutGeneratorConfig) => void;
|
|
65
|
+
|
|
66
|
+
declare const DefaultView: <F extends FieldValues, Q extends QueriesArray, V extends Record<string, unknown>>({ viewSettings, handleRefresh, children, }: DefaultContainerProps<F, Q, V>) => react_jsx_runtime.JSX.Element;
|
|
67
|
+
|
|
68
|
+
declare const Element: <F extends FieldValues = FieldValues, Q extends QueriesArray = QueriesArray, V extends Record<string, unknown> = Record<string, unknown>>({ children, withoutPadding, }: Omit<DefaultContainerProps<F, Q, V>, "viewSettings"> & ViewSettings["header"]) => react_jsx_runtime.JSX.Element;
|
|
69
|
+
|
|
70
|
+
declare const storage: {
|
|
71
|
+
getItem: (key: string) => Promise<string | null>;
|
|
72
|
+
setItem: (key: string, value: string) => Promise<void>;
|
|
73
|
+
removeItem: (key: string) => Promise<void>;
|
|
74
|
+
};
|
|
75
|
+
declare const setReactNativeStorage: () => void;
|
|
76
|
+
|
|
77
|
+
interface TabItemConfig {
|
|
78
|
+
name: string;
|
|
79
|
+
tabBarIcon?: (props: {
|
|
80
|
+
focused: boolean;
|
|
81
|
+
color: string;
|
|
82
|
+
size: number;
|
|
83
|
+
}) => React__default.ReactNode;
|
|
84
|
+
title?: string;
|
|
85
|
+
initialParams?: Record<string, any>;
|
|
86
|
+
href?: string | HrefObject;
|
|
87
|
+
badge?: number | string;
|
|
88
|
+
badgeColor?: string;
|
|
89
|
+
badgeTextColor?: string;
|
|
90
|
+
accessibilityLabel?: string;
|
|
91
|
+
}
|
|
92
|
+
type TabBarVariant = "auto" | "top" | "bottom";
|
|
93
|
+
type BarShadow = {
|
|
94
|
+
color?: string;
|
|
95
|
+
opacity?: number;
|
|
96
|
+
radius?: number;
|
|
97
|
+
offset?: {
|
|
98
|
+
height: number;
|
|
99
|
+
width: number;
|
|
100
|
+
};
|
|
101
|
+
elevation?: number;
|
|
102
|
+
};
|
|
103
|
+
type BarBorder = {
|
|
104
|
+
width?: number;
|
|
105
|
+
color?: string;
|
|
106
|
+
topOnly?: boolean;
|
|
107
|
+
};
|
|
108
|
+
interface TabLayoutProps {
|
|
109
|
+
tabs: Array<TabItemConfig>;
|
|
110
|
+
ns?: string;
|
|
111
|
+
initialRouteName?: string;
|
|
112
|
+
translateTitles?: boolean;
|
|
113
|
+
onTabChange?: (prev: string | undefined, next: string) => void;
|
|
114
|
+
bar?: {
|
|
115
|
+
height?: number;
|
|
116
|
+
position?: "absolute" | "relative";
|
|
117
|
+
margin?: {
|
|
118
|
+
bottom?: number;
|
|
119
|
+
horizontal?: number;
|
|
120
|
+
};
|
|
121
|
+
padding?: {
|
|
122
|
+
top?: number;
|
|
123
|
+
bottom?: number;
|
|
124
|
+
horizontal?: number;
|
|
125
|
+
};
|
|
126
|
+
rounded?: boolean | number;
|
|
127
|
+
radius?: number | {
|
|
128
|
+
topLeft?: number;
|
|
129
|
+
topRight?: number;
|
|
130
|
+
bottomLeft?: number;
|
|
131
|
+
bottomRight?: number;
|
|
132
|
+
};
|
|
133
|
+
colors?: {
|
|
134
|
+
background?: string;
|
|
135
|
+
activeTint?: string;
|
|
136
|
+
inactiveTint?: string;
|
|
137
|
+
border?: string;
|
|
138
|
+
shadow?: string;
|
|
139
|
+
surface?: string;
|
|
140
|
+
secondary?: string;
|
|
141
|
+
onSecondary?: string;
|
|
142
|
+
};
|
|
143
|
+
shadow?: boolean | BarShadow;
|
|
144
|
+
border?: boolean | BarBorder;
|
|
145
|
+
glass?: boolean | {
|
|
146
|
+
alpha?: number;
|
|
147
|
+
};
|
|
148
|
+
compact?: boolean;
|
|
149
|
+
useSafeAreaInset?: boolean;
|
|
150
|
+
style?: StyleProp<ViewStyle>;
|
|
151
|
+
itemStyle?: StyleProp<ViewStyle>;
|
|
152
|
+
labelStyle?: StyleProp<TextStyle>;
|
|
153
|
+
glowItemStyle?: StyleProp<ViewStyle>;
|
|
24
154
|
};
|
|
25
155
|
}
|
|
26
|
-
declare const
|
|
156
|
+
declare const _default: React__default.NamedExoticComponent<TabLayoutProps>;
|
|
157
|
+
|
|
158
|
+
declare const useActiveTab: <T extends string>() => T;
|
|
159
|
+
|
|
160
|
+
declare const openLink: (url: string) => void;
|
|
27
161
|
|
|
28
|
-
export {
|
|
29
|
-
export type {
|
|
162
|
+
export { DefaultView, Element, LayoutGenerator, ReactNativeCoreProvider, _default as TabLayout, asyncStoragePersister, layoutGeneratorConfig, openLink, setLayoutGeneratorConfig, setReactNativeStorage, storage, useActiveTab, useExpoNotifications, useReactNativeCoreConfig };
|
|
163
|
+
export type { LayoutGeneratorConfig, LayoutGeneratorProps, Screen, TabBarVariant, TabItemConfig, TabLayoutProps, UseNotificationsReturn };
|
package/dist/index.js
CHANGED
|
@@ -1,26 +1 @@
|
|
|
1
|
-
'use strict';var
|
|
2
|
-
var pages = _ref.pages,
|
|
3
|
-
endpoints = _ref.endpoints,
|
|
4
|
-
localization = _ref.localization,
|
|
5
|
-
links = _ref.links;
|
|
6
|
-
if (localization === null || localization === void 0 ? void 0 : localization.i18nInitializer) {
|
|
7
|
-
reactLocalization.setI18nInitializer(localization.i18nInitializer);
|
|
8
|
-
}
|
|
9
|
-
if (localization === null || localization === void 0 ? void 0 : localization.translationAdapter) {
|
|
10
|
-
reactLocalization.setTranslationAdapter(localization.translationAdapter);
|
|
11
|
-
}
|
|
12
|
-
if (localization === null || localization === void 0 ? void 0 : localization.localResources) {
|
|
13
|
-
reactLocalization.initializeI18n(localization.localResources);
|
|
14
|
-
}
|
|
15
|
-
reactNativeState.setReactNativeStorage();
|
|
16
|
-
reactNativePages.setReactNativePageConfig(pages);
|
|
17
|
-
reactQueries.setEndpoints(endpoints);
|
|
18
|
-
reactNativeUtiles.setAppLinks(links);
|
|
19
|
-
reactForm.setDefaultFormContainer(function (_ref2) {
|
|
20
|
-
var children = _ref2.children;
|
|
21
|
-
return jsxRuntime.jsx(reactNative.KeyboardAvoidingView, {
|
|
22
|
-
behavior: reactNative.Platform.OS === "ios" ? "padding" : undefined,
|
|
23
|
-
children: children
|
|
24
|
-
});
|
|
25
|
-
});
|
|
26
|
-
};exports.setReactNativeConfig=setReactNativeConfig;Object.keys(reactAuth).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return reactAuth[k]}})});Object.keys(reactNativeState).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return reactNativeState[k]}})});Object.keys(reactQueries).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return reactQueries[k]}})});Object.keys(reactNativePages).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return reactNativePages[k]}})});Object.keys(reactLocalization).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return reactLocalization[k]}})});Object.keys(reactNativeUtiles).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return reactNativeUtiles[k]}})});Object.keys(reactForm).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return reactForm[k]}})});Object.keys(expo).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return expo[k]}})});Object.keys(reactNativeLayouts).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return reactNativeLayouts[k]}})});Object.keys(reactNativeProviders).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return reactNativeProviders[k]}})});Object.keys(reactNativeTabs).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return reactNativeTabs[k]}})});//# sourceMappingURL=index.js.map
|
|
1
|
+
'use strict';var index_ts=require('./auth/index.js'),index_ts$1=require('./config/index.ts'),index_ts$2=require('./expo/index.js'),index_ts$3=require('./form/index.js'),index_ts$4=require('./layouts/index.js'),index_ts$5=require('./localization/index.js'),index_ts$6=require('./pages/index.js'),index_ts$7=require('./queries/index.js'),index_ts$8=require('./state/index.js'),index_ts$9=require('./tabs/index.js'),index_ts$a=require('./utiles/index.js');Object.keys(index_ts).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return index_ts[k]}})});Object.keys(index_ts$1).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return index_ts$1[k]}})});Object.keys(index_ts$2).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return index_ts$2[k]}})});Object.keys(index_ts$3).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return index_ts$3[k]}})});Object.keys(index_ts$4).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return index_ts$4[k]}})});Object.keys(index_ts$5).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return index_ts$5[k]}})});Object.keys(index_ts$6).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return index_ts$6[k]}})});Object.keys(index_ts$7).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return index_ts$7[k]}})});Object.keys(index_ts$8).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return index_ts$8[k]}})});Object.keys(index_ts$9).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return index_ts$9[k]}})});Object.keys(index_ts$a).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return index_ts$a[k]}})});//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/dist/index.mjs
CHANGED
|
@@ -1,26 +1 @@
|
|
|
1
|
-
export*from'
|
|
2
|
-
var pages = _ref.pages,
|
|
3
|
-
endpoints = _ref.endpoints,
|
|
4
|
-
localization = _ref.localization,
|
|
5
|
-
links = _ref.links;
|
|
6
|
-
if (localization === null || localization === void 0 ? void 0 : localization.i18nInitializer) {
|
|
7
|
-
setI18nInitializer(localization.i18nInitializer);
|
|
8
|
-
}
|
|
9
|
-
if (localization === null || localization === void 0 ? void 0 : localization.translationAdapter) {
|
|
10
|
-
setTranslationAdapter(localization.translationAdapter);
|
|
11
|
-
}
|
|
12
|
-
if (localization === null || localization === void 0 ? void 0 : localization.localResources) {
|
|
13
|
-
initializeI18n(localization.localResources);
|
|
14
|
-
}
|
|
15
|
-
setReactNativeStorage();
|
|
16
|
-
setReactNativePageConfig(pages);
|
|
17
|
-
setEndpoints(endpoints);
|
|
18
|
-
setAppLinks(links);
|
|
19
|
-
setDefaultFormContainer(function (_ref2) {
|
|
20
|
-
var children = _ref2.children;
|
|
21
|
-
return jsx(KeyboardAvoidingView, {
|
|
22
|
-
behavior: Platform.OS === "ios" ? "padding" : undefined,
|
|
23
|
-
children: children
|
|
24
|
-
});
|
|
25
|
-
});
|
|
26
|
-
};export{setReactNativeConfig};//# sourceMappingURL=index.mjs.map
|
|
1
|
+
export*from'./auth/index.mjs';export*from'./config/index.ts';export*from'./expo/index.mjs';export*from'./form/index.mjs';export*from'./layouts/index.mjs';export*from'./localization/index.mjs';export*from'./pages/index.mjs';export*from'./queries/index.mjs';export*from'./state/index.mjs';export*from'./tabs/index.mjs';export*from'./utiles/index.mjs';//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":[
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
package/dist/layouts/index.d.ts
CHANGED
|
@@ -1 +1,30 @@
|
|
|
1
|
-
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { NativeStackHeaderProps, NativeStackNavigationOptions } from '@react-navigation/native-stack';
|
|
3
|
+
import { Href } from 'expo-router';
|
|
4
|
+
|
|
5
|
+
interface Screen {
|
|
6
|
+
name: string;
|
|
7
|
+
requireAuth?: boolean;
|
|
8
|
+
hideIfAuth?: boolean;
|
|
9
|
+
ns?: string;
|
|
10
|
+
userType?: string;
|
|
11
|
+
redirectTo?: Href | "tab";
|
|
12
|
+
header?: (props: NativeStackHeaderProps) => React.ReactNode;
|
|
13
|
+
options?: NativeStackNavigationOptions;
|
|
14
|
+
}
|
|
15
|
+
interface LayoutGeneratorProps {
|
|
16
|
+
screens: Screen[];
|
|
17
|
+
userType?: string;
|
|
18
|
+
initialRouteName?: string;
|
|
19
|
+
}
|
|
20
|
+
interface LayoutGeneratorConfig {
|
|
21
|
+
header?: (props: NativeStackHeaderProps) => React.ReactNode;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
declare const LayoutGenerator: ({ screens, userType, initialRouteName, }: LayoutGeneratorProps) => react_jsx_runtime.JSX.Element;
|
|
25
|
+
|
|
26
|
+
declare let layoutGeneratorConfig: LayoutGeneratorConfig;
|
|
27
|
+
declare const setLayoutGeneratorConfig: (config: LayoutGeneratorConfig) => void;
|
|
28
|
+
|
|
29
|
+
export { LayoutGenerator, layoutGeneratorConfig, setLayoutGeneratorConfig };
|
|
30
|
+
export type { LayoutGeneratorConfig, LayoutGeneratorProps, Screen };
|
package/dist/layouts/index.js
CHANGED
|
@@ -1 +1,43 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var jsxRuntime=require('react/jsx-runtime'),expoRouter=require('expo-router'),react=require('react'),auth=require('@gaddario98/react-core/auth'),index_ts=require('../pages/index.js');exports.layoutGeneratorConfig=void 0;
|
|
2
|
+
var setLayoutGeneratorConfig = function setLayoutGeneratorConfig(config) {
|
|
3
|
+
exports.layoutGeneratorConfig = config;
|
|
4
|
+
};var LayoutGenerator = function LayoutGenerator(_ref) {
|
|
5
|
+
var screens = _ref.screens,
|
|
6
|
+
userType = _ref.userType,
|
|
7
|
+
initialRouteName = _ref.initialRouteName;
|
|
8
|
+
var user = auth.useAuthValue();
|
|
9
|
+
var _usePageConfigValue = index_ts.usePageConfigValue(),
|
|
10
|
+
isLogged = _usePageConfigValue.isLogged;
|
|
11
|
+
var isAuthenticated = react.useMemo(function () {
|
|
12
|
+
return isLogged(user);
|
|
13
|
+
}, [isLogged, user]);
|
|
14
|
+
var isRedirect = react.useCallback(function (screen) {
|
|
15
|
+
var val = false;
|
|
16
|
+
if (!screen) return false;
|
|
17
|
+
if (screen.requireAuth) val = !isAuthenticated;
|
|
18
|
+
if (screen.hideIfAuth) val = isAuthenticated;
|
|
19
|
+
if (screen.userType && userType !== screen.userType) val = true;
|
|
20
|
+
return val;
|
|
21
|
+
}, [isAuthenticated, userType]);
|
|
22
|
+
var screenOptions = react.useMemo(function () {
|
|
23
|
+
return {
|
|
24
|
+
headerShown: false,
|
|
25
|
+
keyboardHandlingEnabled: true
|
|
26
|
+
};
|
|
27
|
+
}, []);
|
|
28
|
+
return jsxRuntime.jsx(expoRouter.Stack, {
|
|
29
|
+
screenOptions: screenOptions,
|
|
30
|
+
initialRouteName: initialRouteName,
|
|
31
|
+
children: screens.map(function (screen_0) {
|
|
32
|
+
var _a;
|
|
33
|
+
return jsxRuntime.jsx(expoRouter.Stack.Screen, {
|
|
34
|
+
name: screen_0.name,
|
|
35
|
+
options: Object.assign({
|
|
36
|
+
headerShown: Boolean(screen_0.header || (exports.layoutGeneratorConfig === null || exports.layoutGeneratorConfig === void 0 ? void 0 : exports.layoutGeneratorConfig.header)),
|
|
37
|
+
header: screen_0.header || (exports.layoutGeneratorConfig === null || exports.layoutGeneratorConfig === void 0 ? void 0 : exports.layoutGeneratorConfig.header)
|
|
38
|
+
}, (_a = screen_0 === null || screen_0 === void 0 ? void 0 : screen_0.options) !== null && _a !== void 0 ? _a : {}),
|
|
39
|
+
redirect: isRedirect(screen_0)
|
|
40
|
+
}, screen_0.name);
|
|
41
|
+
})
|
|
42
|
+
});
|
|
43
|
+
};exports.LayoutGenerator=LayoutGenerator;exports.setLayoutGeneratorConfig=setLayoutGeneratorConfig;//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../layouts/config.ts","../../layouts/LayoutGenerator.tsx"],"sourcesContent":["import { LayoutGeneratorConfig } from \"./types\";\n\nlet layoutGeneratorConfig: LayoutGeneratorConfig;\n\nconst setLayoutGeneratorConfig = (config: LayoutGeneratorConfig) => {\n layoutGeneratorConfig = config;\n};\n\nexport { layoutGeneratorConfig, setLayoutGeneratorConfig };\n","import { Stack } from \"expo-router\";\nimport { ComponentProps, useCallback, useMemo } from \"react\";\nimport \"react-native-reanimated\";\nimport { LayoutGeneratorProps, Screen } from \"./types\";\nimport { useAuthValue } from \"@gaddario98/react-core/auth\";\nimport { layoutGeneratorConfig } from \"./config\";\nimport { usePageConfigValue } from \"../pages\";\n\nconst LayoutGenerator = ({\n screens,\n userType,\n initialRouteName,\n}: LayoutGeneratorProps) => {\n const user = useAuthValue();\n const { isLogged } = usePageConfigValue();\n\n const isAuthenticated = useMemo(() => isLogged(user), [isLogged, user]);\n\n const isRedirect = useCallback(\n (screen: Screen) => {\n let val = false;\n if (!screen) return false;\n if (screen.requireAuth) val = !isAuthenticated;\n if (screen.hideIfAuth) val = isAuthenticated;\n if (screen.userType && userType !== screen.userType) val = true;\n return val;\n },\n [isAuthenticated, userType],\n );\n\n const screenOptions = useMemo(\n (): ComponentProps<typeof Stack>[\"screenOptions\"] => ({\n headerShown: false,\n keyboardHandlingEnabled: true,\n }),\n [],\n );\n\n return (\n <Stack screenOptions={screenOptions} initialRouteName={initialRouteName}>\n {screens.map((screen) => {\n return (\n <Stack.Screen\n key={screen.name}\n name={screen.name}\n options={{\n headerShown: Boolean(\n screen.header || layoutGeneratorConfig?.header,\n ),\n header: screen.header || layoutGeneratorConfig?.header,\n ...(screen?.options ?? {}),\n }}\n redirect={isRedirect(screen)}\n />\n );\n })}\n </Stack>\n );\n};\n\nexport default LayoutGenerator;\n"],"names":["layoutGeneratorConfig","setLayoutGeneratorConfig","config","LayoutGenerator","_ref","screens","userType","initialRouteName","user","useAuthValue","_usePageConfigValue","usePageConfigValue","isLogged","isAuthenticated","useMemo","isRedirect","useCallback","screen","val","requireAuth","hideIfAuth","screenOptions","headerShown","keyboardHandlingEnabled","_jsx","Stack","children","map","Screen","name","options","Object","assign","Boolean","header","_a","redirect"],"mappings":"oMAEIA;AAEJ,IAAMC,wBAAwB,GAAG,SAA3BA,wBAAwBA,CAAIC,MAA6B,EAAI;AACjEF,EAAAA,6BAAqB,GAAGE,MAAM;AAChC,ECEA,IAAMC,eAAe,GAAG,SAAlBA,eAAeA,CAAAC,IAAA,EAIM;AAAA,EAAA,IAHzBC,OAAO,GAAAD,IAAA,CAAPC,OAAO;IACPC,QAAQ,GAAAF,IAAA,CAARE,QAAQ;IACRC,gBAAgB,GAAAH,IAAA,CAAhBG,gBAAgB;AAEhB,EAAA,IAAMC,IAAI,GAAGC,iBAAY,EAAE;AAC3B,EAAA,IAAAC,mBAAA,GAAqBC,2BAAkB,EAAE;IAAjCC,QAAQ,GAAAF,mBAAA,CAARE,QAAQ;EAEhB,IAAMC,eAAe,GAAGC,aAAO,CAAC,YAAA;IAAA,OAAMF,QAAQ,CAACJ,IAAI,CAAC;AAAA,EAAA,CAAA,EAAE,CAACI,QAAQ,EAAEJ,IAAI,CAAC,CAAC;AAEvE,EAAA,IAAMO,UAAU,GAAGC,iBAAW,CAC5B,UAACC,MAAc,EAAI;IACjB,IAAIC,GAAG,GAAG,KAAK;AACf,IAAA,IAAI,CAACD,MAAM,EAAE,OAAO,KAAK;AACzB,IAAA,IAAIA,MAAM,CAACE,WAAW,EAAED,GAAG,GAAG,CAACL,eAAe;AAC9C,IAAA,IAAII,MAAM,CAACG,UAAU,EAAEF,GAAG,GAAGL,eAAe;AAC5C,IAAA,IAAII,MAAM,CAACX,QAAQ,IAAIA,QAAQ,KAAKW,MAAM,CAACX,QAAQ,EAAEY,GAAG,GAAG,IAAI;AAC/D,IAAA,OAAOA,GAAG;AACZ,EAAA,CAAC,EACD,CAACL,eAAe,EAAEP,QAAQ,CAAC,CAC5B;EAED,IAAMe,aAAa,GAAGP,aAAO,CAC3B,YAAA;IAAA,OAAsD;AACpDQ,MAAAA,WAAW,EAAE,KAAK;AAClBC,MAAAA,uBAAuB,EAAE;KAC1B;EAAA,CAAC,EACF,EAAE,CACH;EAED,OACEC,cAAA,CAACC,gBAAK;AAACJ,IAAAA,aAAa,EAAEA,aAAa;AAAEd,IAAAA,gBAAgB,EAAEA,gBAAgB;AAAAmB,IAAAA,QAAA,EACpErB,OAAO,CAACsB,GAAG,CAAC,UAACV,QAAM,EAAI;;AACtB,MAAA,OACEO,cAAA,CAACC,gBAAK,CAACG,MAAM,EAAA;QAEXC,IAAI,EAAEZ,QAAM,CAACY,IAAI;AACjBC,QAAAA,OAAO,EAAAC,MAAA,CAAAC,MAAA,CAAA;UACLV,WAAW,EAAEW,OAAO,CAClBhB,QAAM,CAACiB,MAAM,KAAIlC,6BAAqB,aAArBA,6BAAqB,KAAA,MAAA,GAAA,MAAA,GAArBA,6BAAqB,CAAEkC,MAAM,CAAA,CAC/C;AACDA,UAAAA,MAAM,EAAEjB,QAAM,CAACiB,MAAM,KAAIlC,6BAAqB,KAAA,IAAA,IAArBA,6BAAqB,KAAA,MAAA,GAAA,MAAA,GAArBA,6BAAqB,CAAEkC,MAAM;AAAA,SAAA,EAClD,CAAAC,EAAA,GAAAlB,QAAM,KAAA,IAAA,IAANA,QAAM,uBAANA,QAAM,CAAEa,OAAO,MAAA,IAAA,IAAAK,EAAA,KAAA,MAAA,GAAAA,EAAA,GAAI,EAAG,CAAA;QAE5BC,QAAQ,EAAErB,UAAU,CAACE,QAAM;SATtBA,QAAM,CAACY,IAAI,CAUhB;IAEN,CAAC;AAAC,GAAA,CACI;AAEZ"}
|
package/dist/layouts/index.mjs
CHANGED
|
@@ -1 +1,43 @@
|
|
|
1
|
-
|
|
1
|
+
import {jsx}from'react/jsx-runtime';import {Stack}from'expo-router';import {useMemo,useCallback}from'react';import {useAuthValue}from'@gaddario98/react-core/auth';import {usePageConfigValue}from'../pages/index.mjs';var layoutGeneratorConfig;
|
|
2
|
+
var setLayoutGeneratorConfig = function setLayoutGeneratorConfig(config) {
|
|
3
|
+
layoutGeneratorConfig = config;
|
|
4
|
+
};var LayoutGenerator = function LayoutGenerator(_ref) {
|
|
5
|
+
var screens = _ref.screens,
|
|
6
|
+
userType = _ref.userType,
|
|
7
|
+
initialRouteName = _ref.initialRouteName;
|
|
8
|
+
var user = useAuthValue();
|
|
9
|
+
var _usePageConfigValue = usePageConfigValue(),
|
|
10
|
+
isLogged = _usePageConfigValue.isLogged;
|
|
11
|
+
var isAuthenticated = useMemo(function () {
|
|
12
|
+
return isLogged(user);
|
|
13
|
+
}, [isLogged, user]);
|
|
14
|
+
var isRedirect = useCallback(function (screen) {
|
|
15
|
+
var val = false;
|
|
16
|
+
if (!screen) return false;
|
|
17
|
+
if (screen.requireAuth) val = !isAuthenticated;
|
|
18
|
+
if (screen.hideIfAuth) val = isAuthenticated;
|
|
19
|
+
if (screen.userType && userType !== screen.userType) val = true;
|
|
20
|
+
return val;
|
|
21
|
+
}, [isAuthenticated, userType]);
|
|
22
|
+
var screenOptions = useMemo(function () {
|
|
23
|
+
return {
|
|
24
|
+
headerShown: false,
|
|
25
|
+
keyboardHandlingEnabled: true
|
|
26
|
+
};
|
|
27
|
+
}, []);
|
|
28
|
+
return jsx(Stack, {
|
|
29
|
+
screenOptions: screenOptions,
|
|
30
|
+
initialRouteName: initialRouteName,
|
|
31
|
+
children: screens.map(function (screen_0) {
|
|
32
|
+
var _a;
|
|
33
|
+
return jsx(Stack.Screen, {
|
|
34
|
+
name: screen_0.name,
|
|
35
|
+
options: Object.assign({
|
|
36
|
+
headerShown: Boolean(screen_0.header || (layoutGeneratorConfig === null || layoutGeneratorConfig === void 0 ? void 0 : layoutGeneratorConfig.header)),
|
|
37
|
+
header: screen_0.header || (layoutGeneratorConfig === null || layoutGeneratorConfig === void 0 ? void 0 : layoutGeneratorConfig.header)
|
|
38
|
+
}, (_a = screen_0 === null || screen_0 === void 0 ? void 0 : screen_0.options) !== null && _a !== void 0 ? _a : {}),
|
|
39
|
+
redirect: isRedirect(screen_0)
|
|
40
|
+
}, screen_0.name);
|
|
41
|
+
})
|
|
42
|
+
});
|
|
43
|
+
};export{LayoutGenerator,layoutGeneratorConfig,setLayoutGeneratorConfig};//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../layouts/config.ts","../../layouts/LayoutGenerator.tsx"],"sourcesContent":["import { LayoutGeneratorConfig } from \"./types\";\n\nlet layoutGeneratorConfig: LayoutGeneratorConfig;\n\nconst setLayoutGeneratorConfig = (config: LayoutGeneratorConfig) => {\n layoutGeneratorConfig = config;\n};\n\nexport { layoutGeneratorConfig, setLayoutGeneratorConfig };\n","import { Stack } from \"expo-router\";\nimport { ComponentProps, useCallback, useMemo } from \"react\";\nimport \"react-native-reanimated\";\nimport { LayoutGeneratorProps, Screen } from \"./types\";\nimport { useAuthValue } from \"@gaddario98/react-core/auth\";\nimport { layoutGeneratorConfig } from \"./config\";\nimport { usePageConfigValue } from \"../pages\";\n\nconst LayoutGenerator = ({\n screens,\n userType,\n initialRouteName,\n}: LayoutGeneratorProps) => {\n const user = useAuthValue();\n const { isLogged } = usePageConfigValue();\n\n const isAuthenticated = useMemo(() => isLogged(user), [isLogged, user]);\n\n const isRedirect = useCallback(\n (screen: Screen) => {\n let val = false;\n if (!screen) return false;\n if (screen.requireAuth) val = !isAuthenticated;\n if (screen.hideIfAuth) val = isAuthenticated;\n if (screen.userType && userType !== screen.userType) val = true;\n return val;\n },\n [isAuthenticated, userType],\n );\n\n const screenOptions = useMemo(\n (): ComponentProps<typeof Stack>[\"screenOptions\"] => ({\n headerShown: false,\n keyboardHandlingEnabled: true,\n }),\n [],\n );\n\n return (\n <Stack screenOptions={screenOptions} initialRouteName={initialRouteName}>\n {screens.map((screen) => {\n return (\n <Stack.Screen\n key={screen.name}\n name={screen.name}\n options={{\n headerShown: Boolean(\n screen.header || layoutGeneratorConfig?.header,\n ),\n header: screen.header || layoutGeneratorConfig?.header,\n ...(screen?.options ?? {}),\n }}\n redirect={isRedirect(screen)}\n />\n );\n })}\n </Stack>\n );\n};\n\nexport default LayoutGenerator;\n"],"names":["layoutGeneratorConfig","setLayoutGeneratorConfig","config","LayoutGenerator","_ref","screens","userType","initialRouteName","user","useAuthValue","_usePageConfigValue","usePageConfigValue","isLogged","isAuthenticated","useMemo","isRedirect","useCallback","screen","val","requireAuth","hideIfAuth","screenOptions","headerShown","keyboardHandlingEnabled","_jsx","Stack","children","map","Screen","name","options","Object","assign","Boolean","header","_a","redirect"],"mappings":"uNAEA,IAAIA;AAEJ,IAAMC,wBAAwB,GAAG,SAA3BA,wBAAwBA,CAAIC,MAA6B,EAAI;AACjEF,EAAAA,qBAAqB,GAAGE,MAAM;AAChC,ECEA,IAAMC,eAAe,GAAG,SAAlBA,eAAeA,CAAAC,IAAA,EAIM;AAAA,EAAA,IAHzBC,OAAO,GAAAD,IAAA,CAAPC,OAAO;IACPC,QAAQ,GAAAF,IAAA,CAARE,QAAQ;IACRC,gBAAgB,GAAAH,IAAA,CAAhBG,gBAAgB;AAEhB,EAAA,IAAMC,IAAI,GAAGC,YAAY,EAAE;AAC3B,EAAA,IAAAC,mBAAA,GAAqBC,kBAAkB,EAAE;IAAjCC,QAAQ,GAAAF,mBAAA,CAARE,QAAQ;EAEhB,IAAMC,eAAe,GAAGC,OAAO,CAAC,YAAA;IAAA,OAAMF,QAAQ,CAACJ,IAAI,CAAC;AAAA,EAAA,CAAA,EAAE,CAACI,QAAQ,EAAEJ,IAAI,CAAC,CAAC;AAEvE,EAAA,IAAMO,UAAU,GAAGC,WAAW,CAC5B,UAACC,MAAc,EAAI;IACjB,IAAIC,GAAG,GAAG,KAAK;AACf,IAAA,IAAI,CAACD,MAAM,EAAE,OAAO,KAAK;AACzB,IAAA,IAAIA,MAAM,CAACE,WAAW,EAAED,GAAG,GAAG,CAACL,eAAe;AAC9C,IAAA,IAAII,MAAM,CAACG,UAAU,EAAEF,GAAG,GAAGL,eAAe;AAC5C,IAAA,IAAII,MAAM,CAACX,QAAQ,IAAIA,QAAQ,KAAKW,MAAM,CAACX,QAAQ,EAAEY,GAAG,GAAG,IAAI;AAC/D,IAAA,OAAOA,GAAG;AACZ,EAAA,CAAC,EACD,CAACL,eAAe,EAAEP,QAAQ,CAAC,CAC5B;EAED,IAAMe,aAAa,GAAGP,OAAO,CAC3B,YAAA;IAAA,OAAsD;AACpDQ,MAAAA,WAAW,EAAE,KAAK;AAClBC,MAAAA,uBAAuB,EAAE;KAC1B;EAAA,CAAC,EACF,EAAE,CACH;EAED,OACEC,GAAA,CAACC,KAAK;AAACJ,IAAAA,aAAa,EAAEA,aAAa;AAAEd,IAAAA,gBAAgB,EAAEA,gBAAgB;AAAAmB,IAAAA,QAAA,EACpErB,OAAO,CAACsB,GAAG,CAAC,UAACV,QAAM,EAAI;;AACtB,MAAA,OACEO,GAAA,CAACC,KAAK,CAACG,MAAM,EAAA;QAEXC,IAAI,EAAEZ,QAAM,CAACY,IAAI;AACjBC,QAAAA,OAAO,EAAAC,MAAA,CAAAC,MAAA,CAAA;UACLV,WAAW,EAAEW,OAAO,CAClBhB,QAAM,CAACiB,MAAM,KAAIlC,qBAAqB,aAArBA,qBAAqB,KAAA,MAAA,GAAA,MAAA,GAArBA,qBAAqB,CAAEkC,MAAM,CAAA,CAC/C;AACDA,UAAAA,MAAM,EAAEjB,QAAM,CAACiB,MAAM,KAAIlC,qBAAqB,KAAA,IAAA,IAArBA,qBAAqB,KAAA,MAAA,GAAA,MAAA,GAArBA,qBAAqB,CAAEkC,MAAM;AAAA,SAAA,EAClD,CAAAC,EAAA,GAAAlB,QAAM,KAAA,IAAA,IAANA,QAAM,uBAANA,QAAM,CAAEa,OAAO,MAAA,IAAA,IAAAK,EAAA,KAAA,MAAA,GAAAA,EAAA,GAAI,EAAG,CAAA;QAE5BC,QAAQ,EAAErB,UAAU,CAACE,QAAM;SATtBA,QAAM,CAACY,IAAI,CAUhB;IAEN,CAAC;AAAC,GAAA,CACI;AAEZ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from '@gaddario98/react-localization';
|
|
1
|
+
export * from '@gaddario98/react-core/localization';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';var
|
|
1
|
+
'use strict';var localization=require('@gaddario98/react-core/localization');Object.keys(localization).forEach(function(k){if(k!=='default'&&!Object.prototype.hasOwnProperty.call(exports,k))Object.defineProperty(exports,k,{enumerable:true,get:function(){return localization[k]}})});//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export*from'@gaddario98/react-localization';//# sourceMappingURL=index.mjs.map
|
|
1
|
+
export*from'@gaddario98/react-core/localization';//# sourceMappingURL=index.mjs.map
|
package/dist/pages/index.d.ts
CHANGED
|
@@ -1 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
import { DefaultContainerProps, ViewSettings } from '@gaddario98/react-core/pages';
|
|
2
|
+
export * from '@gaddario98/react-core/pages';
|
|
3
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
|
+
import { QueriesArray } from '@gaddario98/react-core/queries';
|
|
5
|
+
import { FieldValues } from '@gaddario98/react-core/form';
|
|
6
|
+
|
|
7
|
+
declare const DefaultView: <F extends FieldValues, Q extends QueriesArray, V extends Record<string, unknown>>({ viewSettings, handleRefresh, children, }: DefaultContainerProps<F, Q, V>) => react_jsx_runtime.JSX.Element;
|
|
8
|
+
|
|
9
|
+
declare const Element: <F extends FieldValues = FieldValues, Q extends QueriesArray = QueriesArray, V extends Record<string, unknown> = Record<string, unknown>>({ children, withoutPadding, }: Omit<DefaultContainerProps<F, Q, V>, "viewSettings"> & ViewSettings["header"]) => react_jsx_runtime.JSX.Element;
|
|
10
|
+
|
|
11
|
+
export { DefaultView, Element };
|