@eliseubatista99/react-scaffold-core 1.2.7 → 1.2.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.
@@ -1 +1,2 @@
1
1
  export * from './useNavigation';
2
+ export type { NavigationParamInput, NavigationParamValue, NavigationParams, } from './useNavigationParams';
@@ -1,29 +1,16 @@
1
+ import { NavigationParamInput } from './useNavigationParams';
1
2
  export type GoToParams = {
2
3
  path: string;
3
4
  addToHistory?: boolean;
4
- params?: Record<string, unknown>;
5
+ params?: Record<string, NavigationParamInput>;
5
6
  };
6
7
  export type GoBackParams = {
7
8
  steps?: number;
8
9
  defaultBackPath?: string;
9
- params?: Record<string, unknown>;
10
10
  };
11
11
  export declare const useNavigation: () => {
12
12
  currentPath: string;
13
- history: string[];
14
- searchParams: {
15
- getAll: () => {
16
- [k: string]: string;
17
- };
18
- get: <T>(key: string) => T | null;
19
- getMany: (keys: string[]) => Record<string, string | null>;
20
- set: (key: string, value: any) => void;
21
- setMany: (values: Record<string, any>) => void;
22
- remove: (key: string) => void;
23
- removeMany: (keys: string[]) => void;
24
- removeAll: () => void;
25
- };
26
- goBack: (data: GoBackParams) => void;
13
+ searchParams: import('./useNavigationParams').NavigationParams;
14
+ goBack: (data?: GoBackParams) => void;
27
15
  goTo: (data: GoToParams) => void;
28
- clearHistory: () => void;
29
16
  };
@@ -1,12 +1,14 @@
1
- export declare const useNavigationParams: () => {
2
- getAll: () => {
3
- [k: string]: string;
4
- };
5
- get: <T>(key: string) => T | null;
6
- getMany: (keys: string[]) => Record<string, string | null>;
7
- set: (key: string, value: any) => void;
8
- setMany: (values: Record<string, any>) => void;
1
+ export type NavigationParamValue = string | number | boolean | null | undefined;
2
+ export type NavigationParamInput = NavigationParamValue | readonly NavigationParamValue[];
3
+ export interface NavigationParams {
4
+ getAll: () => Record<string, string>;
5
+ getAllValues: (key: string) => string[];
6
+ get: (key: string) => string | null;
7
+ getMany: (keys: readonly string[]) => Record<string, string | null>;
8
+ set: (key: string, value: NavigationParamInput) => void;
9
+ setMany: (values: Record<string, NavigationParamInput>) => void;
9
10
  remove: (key: string) => void;
10
- removeMany: (keys: string[]) => void;
11
+ removeMany: (keys: readonly string[]) => void;
11
12
  removeAll: () => void;
12
- };
13
+ }
14
+ export declare const useNavigationParams: () => NavigationParams;
@@ -0,0 +1,5 @@
1
+ export interface NavigationHistoryTracker {
2
+ entries: string[];
3
+ index: number;
4
+ }
5
+ export declare const NavigationHistoryContext: import('react').Context<NavigationHistoryTracker | null>;
@@ -8,4 +8,6 @@ export interface NavigationProviderInputProps {
8
8
  routes: NavigationProviderRoute[];
9
9
  children?: React.ReactNode;
10
10
  }
11
- export declare const NavigationProvider: ({ isReady, routes, children, }: NavigationProviderInputProps) => import("react/jsx-runtime").JSX.Element;
11
+ export type NavigationRoutesProps = NavigationProviderInputProps;
12
+ export declare const NavigationRoutes: ({ isReady, routes, children, }: NavigationRoutesProps) => import("react/jsx-runtime").JSX.Element;
13
+ export declare const NavigationProvider: (props: NavigationProviderInputProps) => import("react/jsx-runtime").JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eliseubatista99/react-scaffold-core",
3
- "version": "1.2.7",
3
+ "version": "1.2.8",
4
4
  "private": false,
5
5
  "description": "A library which provides basic components, hooks, helpers and providers to easily build a React application and avoid repeating the usual code.",
6
6
  "main": "dist/index.cjs.js",
@@ -32,11 +32,14 @@
32
32
  "clean": "rm -rf dist",
33
33
  "lint": "eslint .",
34
34
  "preview": "vite preview",
35
- "start": "vite"
35
+ "start": "vite",
36
+ "test": "vitest run --environment jsdom",
37
+ "test:package": "npm run build && node tests/package-router-smoke.cjs"
36
38
  },
37
39
  "devDependencies": {
38
40
  "@emotion/styled": "^11.14.1",
39
41
  "@eslint/js": "^9.30.1",
42
+ "@testing-library/react": "^16.3.3",
40
43
  "@types/react": "^19.1.8",
41
44
  "@types/react-dom": "^19.1.6",
42
45
  "@vitejs/plugin-react": "^4.6.0",
@@ -44,18 +47,20 @@
44
47
  "eslint-plugin-react-hooks": "^5.2.0",
45
48
  "eslint-plugin-react-refresh": "^0.4.20",
46
49
  "globals": "^16.3.0",
50
+ "jsdom": "^29.1.1",
47
51
  "rimraf": "^3.0.2",
48
52
  "typescript": "~5.8.3",
49
53
  "typescript-eslint": "^8.35.1",
50
54
  "vite": "^7.0.4",
51
- "vite-plugin-dts": "^4.5.4"
55
+ "vite-plugin-dts": "^4.5.4",
56
+ "vitest": "^5.0.5"
52
57
  },
53
58
  "peerDependencies": {
59
+ "dayjs": "^1.11.19",
54
60
  "react": "^19.1.0",
55
61
  "react-dom": "^19.1.0",
56
62
  "react-router-dom": "^7.6.3",
57
63
  "react-slick": "^0.31.0",
58
- "slick-carousel": "^1.8.1",
59
- "dayjs": "^1.11.19"
64
+ "slick-carousel": "^1.8.1"
60
65
  }
61
66
  }
@@ -1,8 +0,0 @@
1
- import { default as React } from 'react';
2
- export interface NavigationContextData {
3
- history: string[];
4
- addToHistory: (entry: string) => void;
5
- popFromHistory: (count: number) => string;
6
- replaceHistory: (entries: string[]) => void;
7
- }
8
- export declare const NavigationProviderContext: React.Context<NavigationContextData>;