@makroz/mobile 1.0.1 → 1.1.2
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/dist/__mocks__/flash-list.d.ts.map +1 -0
- package/dist/__mocks__/flash-list.js +15 -0
- package/dist/__mocks__/flash-list.js.map +1 -0
- package/dist/__mocks__/react-native.d.ts.map +1 -0
- package/dist/__mocks__/react-native.js +58 -0
- package/dist/__mocks__/react-native.js.map +1 -0
- package/dist/auth/MkAuthForm.js +1 -1
- package/dist/auth/MkAuthForm.js.map +1 -1
- package/dist/auth/secureStorage.js +1 -1
- package/dist/auth/types.js +2 -2
- package/dist/components/MkAccordion.js +1 -1
- package/dist/components/MkAccordion.js.map +1 -1
- package/dist/components/MkAccordion.test.d.ts.map +1 -0
- package/dist/components/MkAccordion.test.js +30 -0
- package/dist/components/MkAccordion.test.js.map +1 -0
- package/dist/components/MkAlert.test.d.ts.map +1 -0
- package/dist/components/MkAlert.test.js +30 -0
- package/dist/components/MkAlert.test.js.map +1 -0
- package/dist/components/MkAvatar.test.d.ts.map +1 -0
- package/dist/components/MkAvatar.test.js +30 -0
- package/dist/components/MkAvatar.test.js.map +1 -0
- package/dist/components/MkBadge.test.d.ts.map +1 -0
- package/dist/components/MkBadge.test.js +30 -0
- package/dist/components/MkBadge.test.js.map +1 -0
- package/dist/components/MkButton.js +1 -1
- package/dist/components/MkButton.js.map +1 -1
- package/dist/components/MkButton.test.d.ts.map +1 -0
- package/dist/components/MkButton.test.js +30 -0
- package/dist/components/MkButton.test.js.map +1 -0
- package/dist/components/MkCard.js +1 -1
- package/dist/components/MkCard.js.map +1 -1
- package/dist/components/MkCard.test.d.ts.map +1 -0
- package/dist/components/MkCard.test.js +30 -0
- package/dist/components/MkCard.test.js.map +1 -0
- package/dist/components/MkCheck.js +1 -1
- package/dist/components/MkCheck.js.map +1 -1
- package/dist/components/MkCheck.test.d.ts.map +1 -0
- package/dist/components/MkCheck.test.js +30 -0
- package/dist/components/MkCheck.test.js.map +1 -0
- package/dist/components/MkDatePicker.js +1 -1
- package/dist/components/MkDatePicker.js.map +1 -1
- package/dist/components/MkDatePicker.test.d.ts.map +1 -0
- package/dist/components/MkDatePicker.test.js +30 -0
- package/dist/components/MkDatePicker.test.js.map +1 -0
- package/dist/components/MkDivider.test.d.ts.map +1 -0
- package/dist/components/MkDivider.test.js +30 -0
- package/dist/components/MkDivider.test.js.map +1 -0
- package/dist/components/MkDropDown.js +1 -1
- package/dist/components/MkDropDown.js.map +1 -1
- package/dist/components/MkDropDown.test.d.ts.map +1 -0
- package/dist/components/MkDropDown.test.js +30 -0
- package/dist/components/MkDropDown.test.js.map +1 -0
- package/dist/components/MkEmptyState.test.d.ts.map +1 -0
- package/dist/components/MkEmptyState.test.js +30 -0
- package/dist/components/MkEmptyState.test.js.map +1 -0
- package/dist/components/MkFileUpload.test.d.ts.map +1 -0
- package/dist/components/MkFileUpload.test.js +30 -0
- package/dist/components/MkFileUpload.test.js.map +1 -0
- package/dist/components/MkIcons.d.ts.map +1 -1
- package/dist/components/MkInfiniteList.d.ts.map +1 -1
- package/dist/components/MkInfiniteList.js +1 -3
- package/dist/components/MkInfiniteList.js.map +1 -1
- package/dist/components/MkInfiniteList.test.d.ts.map +1 -0
- package/dist/components/MkInfiniteList.test.js +30 -0
- package/dist/components/MkInfiniteList.test.js.map +1 -0
- package/dist/components/MkInput.js +1 -1
- package/dist/components/MkInput.js.map +1 -1
- package/dist/components/MkInput.test.d.ts.map +1 -0
- package/dist/components/MkInput.test.js +30 -0
- package/dist/components/MkInput.test.js.map +1 -0
- package/dist/components/MkLoading.test.d.ts.map +1 -0
- package/dist/components/MkLoading.test.js +30 -0
- package/dist/components/MkLoading.test.js.map +1 -0
- package/dist/components/MkModal.test.d.ts.map +1 -0
- package/dist/components/MkModal.test.js +30 -0
- package/dist/components/MkModal.test.js.map +1 -0
- package/dist/components/MkProgressBar.test.d.ts.map +1 -0
- package/dist/components/MkProgressBar.test.js +30 -0
- package/dist/components/MkProgressBar.test.js.map +1 -0
- package/dist/components/MkRadio.test.d.ts.map +1 -0
- package/dist/components/MkRadio.test.js +30 -0
- package/dist/components/MkRadio.test.js.map +1 -0
- package/dist/components/MkSearchInput.test.d.ts.map +1 -0
- package/dist/components/MkSearchInput.test.js +30 -0
- package/dist/components/MkSearchInput.test.js.map +1 -0
- package/dist/components/MkSelect.js +1 -1
- package/dist/components/MkSelect.js.map +1 -1
- package/dist/components/MkSelect.test.d.ts.map +1 -0
- package/dist/components/MkSelect.test.js +30 -0
- package/dist/components/MkSelect.test.js.map +1 -0
- package/dist/components/MkSkeleton.test.d.ts.map +1 -0
- package/dist/components/MkSkeleton.test.js +30 -0
- package/dist/components/MkSkeleton.test.js.map +1 -0
- package/dist/components/MkSwitch.test.d.ts.map +1 -0
- package/dist/components/MkSwitch.test.js +30 -0
- package/dist/components/MkSwitch.test.js.map +1 -0
- package/dist/components/MkTable.d.ts.map +1 -1
- package/dist/components/MkTable.js +1 -1
- package/dist/components/MkTable.js.map +1 -1
- package/dist/components/MkTable.test.d.ts.map +1 -0
- package/dist/components/MkTable.test.js +30 -0
- package/dist/components/MkTable.test.js.map +1 -0
- package/dist/components/MkTabs.js +1 -1
- package/dist/components/MkTabs.js.map +1 -1
- package/dist/components/MkTabs.test.d.ts.map +1 -0
- package/dist/components/MkTabs.test.js +30 -0
- package/dist/components/MkTabs.test.js.map +1 -0
- package/dist/components/MkTextArea.js +1 -1
- package/dist/components/MkTextArea.js.map +1 -1
- package/dist/components/MkTextArea.test.d.ts.map +1 -0
- package/dist/components/MkTextArea.test.js +30 -0
- package/dist/components/MkTextArea.test.js.map +1 -0
- package/dist/components/MkToastRenderer.test.d.ts.map +1 -0
- package/dist/components/MkToastRenderer.test.js +30 -0
- package/dist/components/MkToastRenderer.test.js.map +1 -0
- package/dist/components/MkTooltip.test.d.ts.map +1 -0
- package/dist/components/MkTooltip.test.js +30 -0
- package/dist/components/MkTooltip.test.js.map +1 -0
- package/dist/components/MkWindowList.d.ts.map +1 -1
- package/dist/components/MkWindowList.js +1 -1
- package/dist/components/MkWindowList.js.map +1 -1
- package/dist/components/MkWindowList.test.d.ts.map +1 -0
- package/dist/components/MkWindowList.test.js +30 -0
- package/dist/components/MkWindowList.test.js.map +1 -0
- package/dist/context/MkApiContext.d.ts.map +1 -1
- package/dist/context/MkAuthContext.d.ts.map +1 -1
- package/dist/context/MkAuthContext.js +1 -1
- package/dist/context/MkAuthContext.js.map +1 -1
- package/dist/context/MkConfirmContext.d.ts.map +1 -1
- package/dist/context/MkToastContext.d.ts.map +1 -1
- package/dist/hooks/useApi.d.ts.map +1 -1
- package/dist/hooks/useMkCrud.d.ts.map +1 -1
- package/dist/hooks/useMkEvent.js +1 -1
- package/dist/hooks/useMkForm.d.ts.map +1 -1
- package/dist/hooks/useMkForm.js +1 -1
- package/dist/hooks/useMkForm.js.map +1 -1
- package/dist/test-setup.d.ts.map +1 -0
- package/dist/test-setup.js +41 -0
- package/dist/test-setup.js.map +1 -0
- package/dist/test-utils.d.ts.map +1 -0
- package/dist/test-utils.js +178 -0
- package/dist/test-utils.js.map +1 -0
- package/dist/theme/MkThemeProvider.d.ts.map +1 -1
- package/dist/theme/MkThemeProvider.js +1 -1
- package/dist/theme/MkThemeProvider.js.map +1 -1
- package/package.json +14 -9
- package/dist/auth/MkAuthContext.d.ts +0 -72
- package/dist/auth/MkAuthForm.d.ts +0 -31
- package/dist/auth/MkAuthProvider.d.ts +0 -57
- package/dist/auth/secureStorage.d.ts +0 -63
- package/dist/auth/types.d.ts +0 -65
- package/dist/auth/useMkAuth.d.ts +0 -17
- package/dist/components/MkAccordion.d.ts +0 -19
- package/dist/components/MkAlert.d.ts +0 -18
- package/dist/components/MkAvatar.d.ts +0 -12
- package/dist/components/MkBadge.d.ts +0 -11
- package/dist/components/MkButton.d.ts +0 -13
- package/dist/components/MkCard.d.ts +0 -15
- package/dist/components/MkCheck.d.ts +0 -18
- package/dist/components/MkDatePicker.d.ts +0 -30
- package/dist/components/MkDivider.d.ts +0 -11
- package/dist/components/MkDropDown.d.ts +0 -37
- package/dist/components/MkEmptyState.d.ts +0 -11
- package/dist/components/MkFileUpload.d.ts +0 -63
- package/dist/components/MkIcons.d.ts +0 -15
- package/dist/components/MkInfiniteList.d.ts +0 -22
- package/dist/components/MkInput.d.ts +0 -16
- package/dist/components/MkLoading.d.ts +0 -12
- package/dist/components/MkModal.d.ts +0 -20
- package/dist/components/MkProgressBar.d.ts +0 -13
- package/dist/components/MkRadio.d.ts +0 -20
- package/dist/components/MkSearchInput.d.ts +0 -21
- package/dist/components/MkSelect.d.ts +0 -16
- package/dist/components/MkSkeleton.d.ts +0 -13
- package/dist/components/MkSwitch.d.ts +0 -13
- package/dist/components/MkTable.d.ts +0 -39
- package/dist/components/MkTabs.d.ts +0 -19
- package/dist/components/MkTextArea.d.ts +0 -17
- package/dist/components/MkToastRenderer.d.ts +0 -3
- package/dist/components/MkTooltip.d.ts +0 -15
- package/dist/components/MkWindowList.d.ts +0 -47
- package/dist/components/index.d.ts +0 -30
- package/dist/context/MkApiContext.d.ts +0 -15
- package/dist/context/MkAuthContext.d.ts +0 -19
- package/dist/context/MkConfirmContext.d.ts +0 -8
- package/dist/context/MkToastContext.d.ts +0 -19
- package/dist/hooks/filePicker.types.d.ts +0 -13
- package/dist/hooks/useApi.d.ts +0 -19
- package/dist/hooks/useApi.test.d.ts +0 -2
- package/dist/hooks/useMkCrud.d.ts +0 -39
- package/dist/hooks/useMkDebounce.d.ts +0 -24
- package/dist/hooks/useMkEffectDebug.d.ts +0 -6
- package/dist/hooks/useMkEvent.d.ts +0 -42
- package/dist/hooks/useMkFilePickerCli.d.ts +0 -59
- package/dist/hooks/useMkFilePickerExpo.d.ts +0 -38
- package/dist/hooks/useMkForm.d.ts +0 -43
- package/dist/hooks/useMkInfiniteList.d.ts +0 -16
- package/dist/hooks/useMkList.d.ts +0 -61
- package/dist/hooks/useMkLocalStorage.d.ts +0 -6
- package/dist/hooks/useMkPrevious.d.ts +0 -6
- package/dist/hooks/useMkToggle.d.ts +0 -6
- package/dist/index.d.ts +0 -29
- package/dist/theme/MkThemeProvider.d.ts +0 -14
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
export * from './MkButton';
|
|
2
|
-
export * from './MkInput';
|
|
3
|
-
export * from './MkTextArea';
|
|
4
|
-
export * from './MkCheck';
|
|
5
|
-
export * from './MkSwitch';
|
|
6
|
-
export * from './MkRadio';
|
|
7
|
-
export * from './MkSelect';
|
|
8
|
-
export * from './MkFileUpload';
|
|
9
|
-
export * from './MkSearchInput';
|
|
10
|
-
export * from './MkDatePicker';
|
|
11
|
-
export * from './MkAccordion';
|
|
12
|
-
export * from './MkAlert';
|
|
13
|
-
export * from './MkAvatar';
|
|
14
|
-
export * from './MkBadge';
|
|
15
|
-
export * from './MkCard';
|
|
16
|
-
export * from './MkDivider';
|
|
17
|
-
export * from './MkEmptyState';
|
|
18
|
-
export * from './MkLoading';
|
|
19
|
-
export * from './MkProgressBar';
|
|
20
|
-
export * from './MkSkeleton';
|
|
21
|
-
export * from './MkTabs';
|
|
22
|
-
export * from './MkTooltip';
|
|
23
|
-
export * from './MkModal';
|
|
24
|
-
export * from './MkDropDown';
|
|
25
|
-
export * from './MkToastRenderer';
|
|
26
|
-
export * from './MkTable';
|
|
27
|
-
export * from './MkInfiniteList';
|
|
28
|
-
export * from './MkWindowList';
|
|
29
|
-
export * from './MkIcons';
|
|
30
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { ReactNode } from 'react';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
export interface MkApiContextType {
|
|
4
|
-
waiting: number;
|
|
5
|
-
setWaiting: (change: number, origin?: string) => void;
|
|
6
|
-
baseUrl: string;
|
|
7
|
-
headers: Record<string, string>;
|
|
8
|
-
}
|
|
9
|
-
export declare function MkApiProvider({ children, baseUrl, initialHeaders }: {
|
|
10
|
-
children: ReactNode;
|
|
11
|
-
baseUrl?: string;
|
|
12
|
-
initialHeaders?: Record<string, string>;
|
|
13
|
-
}): React.JSX.Element;
|
|
14
|
-
export declare function useMkApiContext(): MkApiContextType;
|
|
15
|
-
//# sourceMappingURL=MkApiContext.d.ts.map
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { ReactNode } from 'react';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import type { MkAuthContextType } from '@mk/core';
|
|
4
|
-
export interface MkAuthProviderProps {
|
|
5
|
-
children: ReactNode;
|
|
6
|
-
endpoints?: {
|
|
7
|
-
login?: string;
|
|
8
|
-
logout?: string;
|
|
9
|
-
user?: string;
|
|
10
|
-
};
|
|
11
|
-
storage?: {
|
|
12
|
-
getItem: (key: string) => Promise<string | null> | string | null;
|
|
13
|
-
setItem: (key: string, value: string) => Promise<void> | void;
|
|
14
|
-
removeItem: (key: string) => Promise<void> | void;
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
export declare const MkAuthProvider: React.FC<MkAuthProviderProps>;
|
|
18
|
-
export declare const useMkAuth: () => MkAuthContextType;
|
|
19
|
-
//# sourceMappingURL=MkAuthContext.d.ts.map
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { ReactNode } from 'react';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import type { MkConfirmContextValue } from '@mk/core';
|
|
4
|
-
export declare const MkConfirmProvider: React.FC<{
|
|
5
|
-
children: ReactNode;
|
|
6
|
-
}>;
|
|
7
|
-
export declare const useMkConfirm: () => MkConfirmContextValue;
|
|
8
|
-
//# sourceMappingURL=MkConfirmContext.d.ts.map
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { ReactNode } from 'react';
|
|
2
|
-
import React from 'react';
|
|
3
|
-
import type { MkToastOptions, MkToastContextValue } from '@mk/core';
|
|
4
|
-
export interface MkToastProviderProps {
|
|
5
|
-
children: ReactNode;
|
|
6
|
-
/** Default position for toasts. Default: 'top-right'. */
|
|
7
|
-
defaultPosition?: MkToastOptions['position'];
|
|
8
|
-
/** Default timeout in ms. Default: 4000. */
|
|
9
|
-
defaultTimeout?: number;
|
|
10
|
-
/** Maximum concurrent toasts. Default: 5. */
|
|
11
|
-
maxToasts?: number;
|
|
12
|
-
}
|
|
13
|
-
export declare const MkToastProvider: React.FC<MkToastProviderProps>;
|
|
14
|
-
/**
|
|
15
|
-
* Hook to access toast operations.
|
|
16
|
-
* Must be used within MkToastProvider.
|
|
17
|
-
*/
|
|
18
|
-
export declare const useMkToast: () => MkToastContextValue;
|
|
19
|
-
//# sourceMappingURL=MkToastContext.d.ts.map
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module filePicker.types
|
|
3
|
-
* @internal
|
|
4
|
-
* Shared types for MkFileUpload picker adapters.
|
|
5
|
-
*/
|
|
6
|
-
import type { MkFilePickerResult } from '../components/MkFileUpload';
|
|
7
|
-
/** Return type of useMkFilePickerExpo and useMkFilePickerCli. */
|
|
8
|
-
export interface UseMkFilePickerReturn {
|
|
9
|
-
/** Pass directly to MkFileUpload's `onTap` prop. */
|
|
10
|
-
pick: () => Promise<MkFilePickerResult[]>;
|
|
11
|
-
}
|
|
12
|
-
export type { MkFilePickerResult };
|
|
13
|
-
//# sourceMappingURL=filePicker.types.d.ts.map
|
package/dist/hooks/useApi.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { MkResponse, ApiStatus } from '@mk/core';
|
|
2
|
-
interface UseApiOptions {
|
|
3
|
-
baseUrl?: string;
|
|
4
|
-
headers?: Record<string, string>;
|
|
5
|
-
}
|
|
6
|
-
export declare function useApi(options?: UseApiOptions): {
|
|
7
|
-
status: ApiStatus;
|
|
8
|
-
data: any;
|
|
9
|
-
error: any;
|
|
10
|
-
waiting: number;
|
|
11
|
-
loading: boolean;
|
|
12
|
-
get: (endpoint: string, params?: any) => Promise<MkResponse<unknown>>;
|
|
13
|
-
post: (endpoint: string, body: any) => Promise<MkResponse<unknown>>;
|
|
14
|
-
put: (endpoint: string, body: any) => Promise<MkResponse<unknown>>;
|
|
15
|
-
delete: (endpoint: string) => Promise<MkResponse<unknown>>;
|
|
16
|
-
remove: (endpoint: string) => Promise<MkResponse<unknown>>;
|
|
17
|
-
};
|
|
18
|
-
export {};
|
|
19
|
-
//# sourceMappingURL=useApi.d.ts.map
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import type { MkCrudConfig, MkCrudAction, MkCrudReturn } from '@mk/core';
|
|
2
|
-
/**
|
|
3
|
-
* @module useMkCrud
|
|
4
|
-
* @description Full CRUD operations hook with form management, validation, and API integration.
|
|
5
|
-
* Same API surface for both mk-web and mk-mobile.
|
|
6
|
-
*
|
|
7
|
-
* @example
|
|
8
|
-
* ```tsx
|
|
9
|
-
* const crud = useMkCrud({
|
|
10
|
-
* module: 'users',
|
|
11
|
-
* singular: 'Usuario',
|
|
12
|
-
* plural: 'Usuarios',
|
|
13
|
-
* fields: {
|
|
14
|
-
* name: { rules: ['required', 'min:3'], api: 'ae', label: 'Nombre' },
|
|
15
|
-
* email: { rules: ['required', 'email'], api: 'ae', label: 'Email' },
|
|
16
|
-
* },
|
|
17
|
-
* });
|
|
18
|
-
*
|
|
19
|
-
* // In your component:
|
|
20
|
-
* <MkButton label="Nuevo" onPress={crud.onAdd} />
|
|
21
|
-
*
|
|
22
|
-
* // In the modal:
|
|
23
|
-
* <MkInput label="Nombre" value={crud.form.formState.name}
|
|
24
|
-
* error={crud.form.errors.name}
|
|
25
|
-
* onChangeText={v => crud.form.setField('name', v)} />
|
|
26
|
-
* <MkButton label="Guardar" loading={crud.saving} onPress={crud.onSave} />
|
|
27
|
-
* ```
|
|
28
|
-
*/
|
|
29
|
-
interface UseMkCrudOptions extends MkCrudConfig {
|
|
30
|
-
/** Callback after successful save. */
|
|
31
|
-
onSuccess?: (action: MkCrudAction, data: any) => void;
|
|
32
|
-
/** Callback after failed save. */
|
|
33
|
-
onError?: (action: MkCrudAction, error: any) => void;
|
|
34
|
-
/** External reload function (from useMkList). */
|
|
35
|
-
onReload?: () => void;
|
|
36
|
-
}
|
|
37
|
-
export declare function useMkCrud<T extends Record<string, any> = Record<string, any>>(config: UseMkCrudOptions): MkCrudReturn<T>;
|
|
38
|
-
export {};
|
|
39
|
-
//# sourceMappingURL=useMkCrud.d.ts.map
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module useMkDebounce
|
|
3
|
-
* @description Returns a debounced value — the value only updates after the specified
|
|
4
|
-
* delay of inactivity. Useful for search inputs, filters, and API-driven queries.
|
|
5
|
-
*
|
|
6
|
-
* API is identical between mk-web and mk-mobile.
|
|
7
|
-
*
|
|
8
|
-
* @template T - Type of the input value.
|
|
9
|
-
* @param value - The value to debounce.
|
|
10
|
-
* @param delay - Milliseconds to wait before updating. Default 300.
|
|
11
|
-
* @returns The debounced value.
|
|
12
|
-
*
|
|
13
|
-
* @example
|
|
14
|
-
* ```tsx
|
|
15
|
-
* const [search, setSearch] = useState('');
|
|
16
|
-
* const debouncedSearch = useMkDebounce(search, 400);
|
|
17
|
-
*
|
|
18
|
-
* useEffect(() => {
|
|
19
|
-
* if (debouncedSearch) api.get('/search', { q: debouncedSearch });
|
|
20
|
-
* }, [debouncedSearch]);
|
|
21
|
-
* ```
|
|
22
|
-
*/
|
|
23
|
-
export declare const useMkDebounce: <T = any>(value: T, delay?: number) => T;
|
|
24
|
-
//# sourceMappingURL=useMkDebounce.d.ts.map
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module useMkEvent
|
|
3
|
-
* @description Lightweight event bus for cross-component communication in React Native.
|
|
4
|
-
* Uses a shared in-memory Map — no DOM APIs, no external dependencies.
|
|
5
|
-
* API matches mk-web's useMkEvent exactly: { emit }.
|
|
6
|
-
*
|
|
7
|
-
* @example
|
|
8
|
-
* ```tsx
|
|
9
|
-
* // Component A — listen
|
|
10
|
-
* useMkEvent('cart:updated', (data) => {
|
|
11
|
-
* console.log('Cart updated:', data);
|
|
12
|
-
* });
|
|
13
|
-
*
|
|
14
|
-
* // Component B — emit
|
|
15
|
-
* const { emit } = useMkEvent('cart:updated');
|
|
16
|
-
* emit({ items: 5 });
|
|
17
|
-
* ```
|
|
18
|
-
*/
|
|
19
|
-
type Listener = (data?: any) => void;
|
|
20
|
-
declare function _on(event: string, fn: Listener): void;
|
|
21
|
-
declare function _off(event: string, fn: Listener): void;
|
|
22
|
-
declare function _emit(event: string, data?: any): void;
|
|
23
|
-
export declare function useMkEvent<T = any>(eventName: string, handler?: (data: T) => void): {
|
|
24
|
-
emit: (data?: T) => void;
|
|
25
|
-
};
|
|
26
|
-
/**
|
|
27
|
-
* Imperative event API — for use outside React components (services, callbacks).
|
|
28
|
-
* @example
|
|
29
|
-
* import { MkEventBus } from '@mk/mobile';
|
|
30
|
-
* MkEventBus.emit('notification:received', payload);
|
|
31
|
-
*/
|
|
32
|
-
export declare const MkEventBus: {
|
|
33
|
-
readonly on: typeof _on;
|
|
34
|
-
readonly off: typeof _off;
|
|
35
|
-
readonly emit: typeof _emit;
|
|
36
|
-
/** Clear all listeners for an event. */
|
|
37
|
-
readonly clear: (event: string) => void;
|
|
38
|
-
/** Clear ALL listeners. */
|
|
39
|
-
readonly clearAll: () => void;
|
|
40
|
-
};
|
|
41
|
-
export {};
|
|
42
|
-
//# sourceMappingURL=useMkEvent.d.ts.map
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import type { UseMkFilePickerReturn } from './filePicker.types';
|
|
2
|
-
/**
|
|
3
|
-
* @module useMkFilePickerCli
|
|
4
|
-
* @description Picker adapter for **React Native CLI** projects.
|
|
5
|
-
*
|
|
6
|
-
* **Required peer packages** (choose what you need):
|
|
7
|
-
* ```bash
|
|
8
|
-
* # Images / Videos:
|
|
9
|
-
* npm install react-native-image-picker
|
|
10
|
-
* cd ios && pod install && cd ..
|
|
11
|
-
*
|
|
12
|
-
* # Documents (PDF, Word, etc.):
|
|
13
|
-
* npm install react-native-document-picker
|
|
14
|
-
* cd ios && pod install && cd ..
|
|
15
|
-
* ```
|
|
16
|
-
*
|
|
17
|
-
* **Android** — add to AndroidManifest.xml:
|
|
18
|
-
* ```xml
|
|
19
|
-
* <uses-permission android:name="android.permission.READ_MEDIA_IMAGES" />
|
|
20
|
-
* <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
|
21
|
-
* ```
|
|
22
|
-
*
|
|
23
|
-
* **iOS** — add to Info.plist:
|
|
24
|
-
* ```xml
|
|
25
|
-
* <key>NSPhotoLibraryUsageDescription</key>
|
|
26
|
-
* <string>Necesitamos acceso para subir imágenes</string>
|
|
27
|
-
* ```
|
|
28
|
-
*
|
|
29
|
-
* @example Images
|
|
30
|
-
* ```tsx
|
|
31
|
-
* const picker = useMkFilePickerCli({ mediaType: 'images', multiple: true });
|
|
32
|
-
* <MkFileUpload onTap={picker.pick} onFiles={setFiles} />
|
|
33
|
-
* ```
|
|
34
|
-
*
|
|
35
|
-
* @example Documents
|
|
36
|
-
* ```tsx
|
|
37
|
-
* const picker = useMkFilePickerCli({
|
|
38
|
-
* mediaType: 'documents',
|
|
39
|
-
* documentMimeTypes: ['application/pdf'],
|
|
40
|
-
* });
|
|
41
|
-
* <MkFileUpload onTap={picker.pick} onFiles={setFiles} />
|
|
42
|
-
* ```
|
|
43
|
-
*/
|
|
44
|
-
export type CliMediaType = 'images' | 'videos' | 'documents' | 'all';
|
|
45
|
-
export interface UseMkFilePickerCliOptions {
|
|
46
|
-
/** What type of files to pick. Default 'images'. */
|
|
47
|
-
mediaType?: CliMediaType;
|
|
48
|
-
/** Allow multiple selection. Default false. */
|
|
49
|
-
multiple?: boolean;
|
|
50
|
-
/** Image quality 0–1. Default 0.8. */
|
|
51
|
-
quality?: number;
|
|
52
|
-
/**
|
|
53
|
-
* MIME types for document picker.
|
|
54
|
-
* Default: ['image/*', 'application/pdf']
|
|
55
|
-
*/
|
|
56
|
-
documentMimeTypes?: string[];
|
|
57
|
-
}
|
|
58
|
-
export declare function useMkFilePickerCli(options?: UseMkFilePickerCliOptions): UseMkFilePickerReturn;
|
|
59
|
-
//# sourceMappingURL=useMkFilePickerCli.d.ts.map
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import type { UseMkFilePickerReturn } from './filePicker.types';
|
|
2
|
-
/**
|
|
3
|
-
* @module useMkFilePickerExpo
|
|
4
|
-
* @description Picker adapter for **Expo** projects.
|
|
5
|
-
*
|
|
6
|
-
* **Required peer packages** (install separately in your app):
|
|
7
|
-
* ```bash
|
|
8
|
-
* npx expo install expo-image-picker expo-document-picker
|
|
9
|
-
* ```
|
|
10
|
-
*
|
|
11
|
-
* This hook uses `require()` at runtime so the library compiles even if these
|
|
12
|
-
* packages are not installed. A clear error message is shown if they're missing.
|
|
13
|
-
*
|
|
14
|
-
* @example Images
|
|
15
|
-
* ```tsx
|
|
16
|
-
* const picker = useMkFilePickerExpo({ mediaType: 'images', multiple: true });
|
|
17
|
-
* <MkFileUpload onTap={picker.pick} onFiles={setFiles} />
|
|
18
|
-
* ```
|
|
19
|
-
*
|
|
20
|
-
* @example Documents
|
|
21
|
-
* ```tsx
|
|
22
|
-
* const picker = useMkFilePickerExpo({ mediaType: 'documents' });
|
|
23
|
-
* <MkFileUpload onTap={picker.pick} onFiles={setFiles} accept=".pdf" />
|
|
24
|
-
* ```
|
|
25
|
-
*/
|
|
26
|
-
export type ExpoMediaType = 'images' | 'videos' | 'documents' | 'all';
|
|
27
|
-
export interface UseMkFilePickerExpoOptions {
|
|
28
|
-
/** What type of files to pick. Default 'images'. */
|
|
29
|
-
mediaType?: ExpoMediaType;
|
|
30
|
-
/** Allow multiple selection. Default false. */
|
|
31
|
-
multiple?: boolean;
|
|
32
|
-
/** Allow editing after picking (images only, ignored when multiple=true). */
|
|
33
|
-
allowsEditing?: boolean;
|
|
34
|
-
/** Image quality 0–1. Default 0.8. */
|
|
35
|
-
quality?: number;
|
|
36
|
-
}
|
|
37
|
-
export declare function useMkFilePickerExpo(options?: UseMkFilePickerExpoOptions): UseMkFilePickerReturn;
|
|
38
|
-
//# sourceMappingURL=useMkFilePickerExpo.d.ts.map
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import type { MkFormFields, MkFormReturn, MkCrudAction } from '@mk/core';
|
|
2
|
-
/**
|
|
3
|
-
* @module useMkForm
|
|
4
|
-
* @description Unified form state manager with built-in validation.
|
|
5
|
-
* Works on both Web and Mobile — zero platform dependencies.
|
|
6
|
-
*
|
|
7
|
-
* Uses mkValidation from mk-core for field-level and form-level validation,
|
|
8
|
-
* and mkValidation.getApiFields for extracting API-ready data.
|
|
9
|
-
*
|
|
10
|
-
* @example
|
|
11
|
-
* ```tsx
|
|
12
|
-
* const form = useMkForm({
|
|
13
|
-
* fields: {
|
|
14
|
-
* name: { rules: ['required', 'min:3'], api: 'ae' },
|
|
15
|
-
* email: { rules: ['required', 'email'], api: 'ae' },
|
|
16
|
-
* phone: { rules: ['phone'], api: 'ae*' },
|
|
17
|
-
* },
|
|
18
|
-
* initialData: { name: '', email: '', phone: '' },
|
|
19
|
-
* });
|
|
20
|
-
*
|
|
21
|
-
* // In handler
|
|
22
|
-
* <MkInput label="Nombre" value={form.formState.name} error={form.errors.name}
|
|
23
|
-
* onChange={v => form.setField('name', v)} />
|
|
24
|
-
*
|
|
25
|
-
* const handleSave = () => {
|
|
26
|
-
* if (!form.validate()) return;
|
|
27
|
-
* const data = form.getApiData();
|
|
28
|
-
* api.post('/users', data);
|
|
29
|
-
* };
|
|
30
|
-
* ```
|
|
31
|
-
*/
|
|
32
|
-
export interface UseMkFormOptions<T = Record<string, any>> {
|
|
33
|
-
/** Field definitions with rules and API flags. */
|
|
34
|
-
fields: MkFormFields;
|
|
35
|
-
/** Initial data for the form. */
|
|
36
|
-
initialData?: Partial<T>;
|
|
37
|
-
/** Current CRUD action (affects which rules apply). Default 'add'. */
|
|
38
|
-
action?: MkCrudAction;
|
|
39
|
-
/** Validate on every setField call. Default false. */
|
|
40
|
-
validateOnChange?: boolean;
|
|
41
|
-
}
|
|
42
|
-
export declare function useMkForm<T extends Record<string, any> = Record<string, any>>({ fields, initialData, action, validateOnChange, }: UseMkFormOptions<T>): MkFormReturn<T>;
|
|
43
|
-
//# sourceMappingURL=useMkForm.d.ts.map
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export interface InfiniteListOptions {
|
|
2
|
-
per_page?: number;
|
|
3
|
-
q?: string;
|
|
4
|
-
filter?: Record<string, any>;
|
|
5
|
-
sort?: string;
|
|
6
|
-
}
|
|
7
|
-
export declare function useMkInfiniteList(endpoint: string, options?: InfiniteListOptions): {
|
|
8
|
-
items: any[];
|
|
9
|
-
loading: boolean;
|
|
10
|
-
error: any;
|
|
11
|
-
isRefreshing: boolean;
|
|
12
|
-
hasMore: boolean;
|
|
13
|
-
loadMore: (isInitial?: boolean) => Promise<void>;
|
|
14
|
-
onRefresh: () => Promise<void>;
|
|
15
|
-
};
|
|
16
|
-
//# sourceMappingURL=useMkInfiniteList.d.ts.map
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module useMkList
|
|
3
|
-
* @description Paginated list manager for React Native — mirrors mk-web's useMkList API.
|
|
4
|
-
* Manages page, search, sort, and filters with auto-refresh on param changes.
|
|
5
|
-
*
|
|
6
|
-
* @example
|
|
7
|
-
* ```tsx
|
|
8
|
-
* const { data, loading, params, setSearch, setPage, setSort, setFilter, refresh } = useMkList('/users');
|
|
9
|
-
*
|
|
10
|
-
* // Search
|
|
11
|
-
* setSearch('mario');
|
|
12
|
-
*
|
|
13
|
-
* // Change page
|
|
14
|
-
* setPage(2);
|
|
15
|
-
*
|
|
16
|
-
* // Sort
|
|
17
|
-
* setSort('-created_at');
|
|
18
|
-
*
|
|
19
|
-
* // Filter
|
|
20
|
-
* setFilter('status', 'active');
|
|
21
|
-
* ```
|
|
22
|
-
*/
|
|
23
|
-
export interface MkListParams {
|
|
24
|
-
page?: number;
|
|
25
|
-
per_page?: number;
|
|
26
|
-
q?: string;
|
|
27
|
-
sort?: string;
|
|
28
|
-
filter?: Record<string, any>;
|
|
29
|
-
}
|
|
30
|
-
export interface MkListOptions {
|
|
31
|
-
/** Initial params. */
|
|
32
|
-
initialParams?: MkListParams;
|
|
33
|
-
/** Whether to auto-fetch on mount and param changes. Default true. */
|
|
34
|
-
autoFetch?: boolean;
|
|
35
|
-
/** Debounce delay in ms for search updates. Default 0 (no debounce). */
|
|
36
|
-
debounceMs?: number;
|
|
37
|
-
}
|
|
38
|
-
export declare function useMkList(endpoint: string, options?: MkListOptions): {
|
|
39
|
-
params: MkListParams;
|
|
40
|
-
setParams: import("react").Dispatch<import("react").SetStateAction<MkListParams>>;
|
|
41
|
-
setFilter: (field: string, value: any) => void;
|
|
42
|
-
setPage: (page: number) => void;
|
|
43
|
-
setSearch: (q: string) => void;
|
|
44
|
-
setSort: (sort: string) => void;
|
|
45
|
-
setPerPage: (per_page: number) => void;
|
|
46
|
-
resetFilters: () => void;
|
|
47
|
-
refresh: (extraParams?: MkListParams) => Promise<import("@mk/core").MkResponse<unknown>>;
|
|
48
|
-
/** Pagination meta from __extraData */
|
|
49
|
-
pagination: any;
|
|
50
|
-
status: import("@mk/core").ApiStatus;
|
|
51
|
-
data: any;
|
|
52
|
-
error: any;
|
|
53
|
-
waiting: number;
|
|
54
|
-
loading: boolean;
|
|
55
|
-
get: (endpoint: string, params?: any) => Promise<import("@mk/core").MkResponse<unknown>>;
|
|
56
|
-
post: (endpoint: string, body: any) => Promise<import("@mk/core").MkResponse<unknown>>;
|
|
57
|
-
put: (endpoint: string, body: any) => Promise<import("@mk/core").MkResponse<unknown>>;
|
|
58
|
-
delete: (endpoint: string) => Promise<import("@mk/core").MkResponse<unknown>>;
|
|
59
|
-
remove: (endpoint: string) => Promise<import("@mk/core").MkResponse<unknown>>;
|
|
60
|
-
};
|
|
61
|
-
//# sourceMappingURL=useMkList.d.ts.map
|
package/dist/index.d.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
export * from './components';
|
|
2
|
-
export * from './theme/MkThemeProvider';
|
|
3
|
-
export * from './context/MkApiContext';
|
|
4
|
-
export * from './context/MkAuthContext';
|
|
5
|
-
export * from './context/MkConfirmContext';
|
|
6
|
-
export * from './context/MkToastContext';
|
|
7
|
-
export { MkAuthProvider } from './auth/MkAuthProvider';
|
|
8
|
-
export type { MkAuthProviderProps } from './auth/MkAuthProvider';
|
|
9
|
-
export { useMkAuth } from './auth/useMkAuth';
|
|
10
|
-
export { MkAuthForm } from './auth/MkAuthForm';
|
|
11
|
-
export type { MkAuthFormProps } from './auth/MkAuthForm';
|
|
12
|
-
export type { MkAuthContextValue } from './auth/MkAuthContext';
|
|
13
|
-
export type { AdminDto, AuthTokens, LoginInput, LoginResponse, RefreshResponse } from './auth/types';
|
|
14
|
-
export { getAccessToken, setAccessToken, getRefreshToken, setRefreshToken, getUser, setUser, clearAll, SECURE_KEYS, } from './auth/secureStorage';
|
|
15
|
-
export type { SecureKey } from './auth/secureStorage';
|
|
16
|
-
export * from './hooks/useApi';
|
|
17
|
-
export * from './hooks/useMkList';
|
|
18
|
-
export * from './hooks/useMkInfiniteList';
|
|
19
|
-
export * from './hooks/useMkDebounce';
|
|
20
|
-
export * from './hooks/useMkEffectDebug';
|
|
21
|
-
export * from './hooks/useMkEvent';
|
|
22
|
-
export * from './hooks/useMkLocalStorage';
|
|
23
|
-
export * from './hooks/useMkPrevious';
|
|
24
|
-
export * from './hooks/useMkToggle';
|
|
25
|
-
export * from './hooks/useMkForm';
|
|
26
|
-
export * from './hooks/useMkCrud';
|
|
27
|
-
export * from './hooks/useMkFilePickerExpo';
|
|
28
|
-
export * from './hooks/useMkFilePickerCli';
|
|
29
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { MkTheme } from '@mk/core';
|
|
3
|
-
interface ThemeContextType {
|
|
4
|
-
theme: MkTheme;
|
|
5
|
-
isDark: boolean;
|
|
6
|
-
toggleTheme: () => void;
|
|
7
|
-
}
|
|
8
|
-
export declare const MkThemeProvider: React.FC<{
|
|
9
|
-
children: React.ReactNode;
|
|
10
|
-
initialDark?: boolean;
|
|
11
|
-
}>;
|
|
12
|
-
export declare const useMkTheme: () => ThemeContextType;
|
|
13
|
-
export {};
|
|
14
|
-
//# sourceMappingURL=MkThemeProvider.d.ts.map
|