@nomos-ui/next-adapter 0.0.5
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/README.md +5 -0
- package/dist/exports/index.d.ts +3 -0
- package/dist/exports/index.d.ts.map +1 -0
- package/dist/exports/index.js +6 -0
- package/dist/exports/index.js.map +1 -0
- package/dist/hooks/use-update-search-params.d.ts +5 -0
- package/dist/hooks/use-update-search-params.d.ts.map +1 -0
- package/dist/hooks/use-update-search-params.js +13 -0
- package/dist/hooks/use-update-search-params.js.map +1 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +70 -0
- package/dist/index.js.map +1 -0
- package/package.json +117 -0
package/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/exports/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,IAAI,CAAC;AAEjC,OAAO,EAAE,WAAW,EAAE,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NextAdapter = void 0;
|
|
4
|
+
const __1 = require("..");
|
|
5
|
+
Object.defineProperty(exports, "NextAdapter", { enumerable: true, get: function () { return __1.NextAdapter; } });
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/exports/index.ts"],"names":[],"mappings":";;;AAAA,0BAAiC;AAExB,4FAFA,eAAW,OAEA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-update-search-params.d.ts","sourceRoot":"","sources":["../../src/hooks/use-update-search-params.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,OAAO,UAAU,qBAAqB,KAE1B,QAAQ;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,EAAE,UAK3D"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = useUpdateSearchParams;
|
|
4
|
+
const navigation_1 = require("next/navigation");
|
|
5
|
+
function useUpdateSearchParams() {
|
|
6
|
+
const router = (0, navigation_1.useRouter)();
|
|
7
|
+
return function (fields) {
|
|
8
|
+
const url = new URL(location.href);
|
|
9
|
+
fields.forEach((field) => url.searchParams.set(field.name, field.value));
|
|
10
|
+
router.push(url.href);
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=use-update-search-params.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-update-search-params.js","sourceRoot":"","sources":["../../src/hooks/use-update-search-params.ts"],"names":[],"mappings":";;AAEA,wCAOC;AATD,gDAA4C;AAE5C,SAAwB,qBAAqB;IAC3C,MAAM,MAAM,GAAG,IAAA,sBAAS,GAAE,CAAC;IAC3B,OAAO,UAAU,MAAyC;QACxD,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QACnC,MAAM,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;QACzE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACxB,CAAC,CAAC;AACJ,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { RouterAdapter } from "@nomos-ui/core";
|
|
2
|
+
/**
|
|
3
|
+
* Next.js router adapter for `@nomos-ui/core` Provider.
|
|
4
|
+
* Implements the `RouterAdapter` contract using Next.js navigation hooks and components.
|
|
5
|
+
*
|
|
6
|
+
* Pass this to the `adapter` prop of the Provider to enable routing support
|
|
7
|
+
* in all `@nomos-ui` components when using Next.js.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```tsx
|
|
11
|
+
* import { NextAdapter } from "@nomos-ui/next-adapter";
|
|
12
|
+
*
|
|
13
|
+
* <Provider queryLibrary="rtk-query" adapters={{ core: NextAdapter }}>
|
|
14
|
+
* <App />
|
|
15
|
+
* </Provider>
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
export declare const NextAdapter: RouterAdapter;
|
|
19
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAwC/C;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,WAAW,EAAE,aAOzB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.NextAdapter = void 0;
|
|
7
|
+
const link_1 = __importDefault(require("next/link"));
|
|
8
|
+
const navigation_1 = require("next/navigation");
|
|
9
|
+
const use_update_search_params_1 = __importDefault(require("./hooks/use-update-search-params"));
|
|
10
|
+
/**
|
|
11
|
+
* Returns a normalized search params object with a `.get()` interface.
|
|
12
|
+
* Wraps Next.js `useSearchParams` to match the `RouterAdapter` contract.
|
|
13
|
+
*
|
|
14
|
+
* @returns An object with a `get` method to read search params by key
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```ts
|
|
18
|
+
* const searchParams = useSearchParams();
|
|
19
|
+
* searchParams.get("page"); // "1"
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
function useSearchParams() {
|
|
23
|
+
const searchParams = (0, navigation_1.useSearchParams)();
|
|
24
|
+
return {
|
|
25
|
+
get: (key) => searchParams.get(key),
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Returns a normalized route params object with a `.get()` interface.
|
|
30
|
+
* Wraps Next.js `useParams` to match the `RouterAdapter` contract.
|
|
31
|
+
*
|
|
32
|
+
* @returns An object with a `get` method to read route params by key
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```ts
|
|
36
|
+
* const params = useParams();
|
|
37
|
+
* params.get("id"); // "648339adsf043c8ed"
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
function useParams() {
|
|
41
|
+
const params = (0, navigation_1.useParams)();
|
|
42
|
+
return {
|
|
43
|
+
get: (key) => params[key] ?? null,
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Next.js router adapter for `@nomos-ui/core` Provider.
|
|
48
|
+
* Implements the `RouterAdapter` contract using Next.js navigation hooks and components.
|
|
49
|
+
*
|
|
50
|
+
* Pass this to the `adapter` prop of the Provider to enable routing support
|
|
51
|
+
* in all `@nomos-ui` components when using Next.js.
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* ```tsx
|
|
55
|
+
* import { NextAdapter } from "@nomos-ui/next-adapter";
|
|
56
|
+
*
|
|
57
|
+
* <Provider queryLibrary="rtk-query" adapters={{ core: NextAdapter }}>
|
|
58
|
+
* <App />
|
|
59
|
+
* </Provider>
|
|
60
|
+
* ```
|
|
61
|
+
*/
|
|
62
|
+
exports.NextAdapter = {
|
|
63
|
+
useSearchParams,
|
|
64
|
+
useUpdateSearchParams: use_update_search_params_1.default,
|
|
65
|
+
useParams,
|
|
66
|
+
components: {
|
|
67
|
+
Link: { component: link_1.default, hrefKey: "href" },
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,qDAA6B;AAC7B,gDAGyB;AACzB,gGAAyE;AAGzE;;;;;;;;;;;GAWG;AACH,SAAS,eAAe;IACtB,MAAM,YAAY,GAAG,IAAA,4BAAmB,GAAE,CAAC;IAC3C,OAAO;QACL,GAAG,EAAE,CAAC,GAAW,EAAE,EAAE,CAAC,YAAY,CAAC,GAAG,CAAC,GAAG,CAAC;KAC5C,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;GAWG;AACH,SAAS,SAAS;IAChB,MAAM,MAAM,GAAG,IAAA,sBAAa,GAAE,CAAC;IAC/B,OAAO;QACL,GAAG,EAAE,CAAC,GAAW,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,IAAI;KAC1C,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;;;GAeG;AACU,QAAA,WAAW,GAAkB;IACxC,eAAe;IACf,qBAAqB,EAAE,kCAAyB;IAChD,SAAS;IACT,UAAU,EAAE;QACV,IAAI,EAAE,EAAE,SAAS,EAAE,cAAI,EAAE,OAAO,EAAE,MAAM,EAAE;KAC3C;CACF,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@nomos-ui/next-adapter",
|
|
3
|
+
"version": "0.0.5",
|
|
4
|
+
"description": "The Shadcn library for building robust React layouts",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"module": "dist/exports/index.js",
|
|
7
|
+
"types": "dist/exports/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/exports/index.d.ts",
|
|
11
|
+
"import": "./dist/exports/index.js",
|
|
12
|
+
"require": "./dist/exports/index.js"
|
|
13
|
+
},
|
|
14
|
+
"./dashboard": {
|
|
15
|
+
"types": "./dist/exports/dashboard/index.d.ts",
|
|
16
|
+
"import": "./dist/exports/dashboard/index.js",
|
|
17
|
+
"require": "./dist/exports/dashboard/index.js"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"typesVersions": {
|
|
21
|
+
"*": {
|
|
22
|
+
"dashboard": [
|
|
23
|
+
"./dist/exports/dashboard/index.d.ts"
|
|
24
|
+
],
|
|
25
|
+
"types": [
|
|
26
|
+
"./dist/exports/index.d.ts"
|
|
27
|
+
]
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"scripts": {
|
|
31
|
+
"build": "trash dist && tsc",
|
|
32
|
+
"dev": "tsc --watch",
|
|
33
|
+
"clean": "rm -rf dist",
|
|
34
|
+
"lint": "eslint src --ext .ts,.tsx",
|
|
35
|
+
"type-check": "tsc --noEmit",
|
|
36
|
+
"test": "vitest",
|
|
37
|
+
"test:watch": "vitest --watch",
|
|
38
|
+
"test:ui": "vitest --ui",
|
|
39
|
+
"test:coverage": "vitest --coverage",
|
|
40
|
+
"prepublishOnly": "pnpm run build"
|
|
41
|
+
},
|
|
42
|
+
"keywords": [
|
|
43
|
+
"react",
|
|
44
|
+
"react-hook-form",
|
|
45
|
+
"form",
|
|
46
|
+
"forms",
|
|
47
|
+
"validation",
|
|
48
|
+
"components",
|
|
49
|
+
"ui",
|
|
50
|
+
"input",
|
|
51
|
+
"select",
|
|
52
|
+
"checkbox",
|
|
53
|
+
"accessible",
|
|
54
|
+
"a11y",
|
|
55
|
+
"tailwind",
|
|
56
|
+
"typescript",
|
|
57
|
+
"nomos"
|
|
58
|
+
],
|
|
59
|
+
"author": "Uanela Como",
|
|
60
|
+
"license": "MIT",
|
|
61
|
+
"repository": {
|
|
62
|
+
"type": "git",
|
|
63
|
+
"url": "git+https://github.com/uanela/nomos-ui.git",
|
|
64
|
+
"directory": "packages/layout"
|
|
65
|
+
},
|
|
66
|
+
"bugs": {
|
|
67
|
+
"url": "https://github.com/uanela/nomos-ui/issues"
|
|
68
|
+
},
|
|
69
|
+
"homepage": "https://github.com/uanela/nomos-ui",
|
|
70
|
+
"files": [
|
|
71
|
+
"dist",
|
|
72
|
+
"README.md",
|
|
73
|
+
"LICENSE"
|
|
74
|
+
],
|
|
75
|
+
"sideEffects": false,
|
|
76
|
+
"packageManager": "pnpm@10.13.1",
|
|
77
|
+
"dependencies": {
|
|
78
|
+
"@nomos-ui/core": "^0.2.2"
|
|
79
|
+
},
|
|
80
|
+
"devDependencies": {
|
|
81
|
+
"@types/node": "^24.9.1",
|
|
82
|
+
"@types/react": "^19.2.2",
|
|
83
|
+
"@types/react-dom": "^19.2.0",
|
|
84
|
+
"@typescript-eslint/eslint-plugin": "^6.0.0",
|
|
85
|
+
"@typescript-eslint/parser": "^6.0.0",
|
|
86
|
+
"eslint": "^8.56.0",
|
|
87
|
+
"eslint-plugin-react": "^7.33.2",
|
|
88
|
+
"eslint-plugin-react-hooks": "^4.6.0",
|
|
89
|
+
"tailwindcss": "^4.1.16",
|
|
90
|
+
"trash-cli": "^7.0.0",
|
|
91
|
+
"tsx": "^4.20.3",
|
|
92
|
+
"typescript": "^5.9.3",
|
|
93
|
+
"vitest": "^4.0.3"
|
|
94
|
+
},
|
|
95
|
+
"peerDependencies": {
|
|
96
|
+
"next": "^15.5.12 || ^16.1.6",
|
|
97
|
+
"react": "^18.0.0 || ^19.0.0",
|
|
98
|
+
"react-dom": "^18.0.0 || ^19.0.0"
|
|
99
|
+
},
|
|
100
|
+
"peerDependenciesMeta": {
|
|
101
|
+
"react": {
|
|
102
|
+
"optional": false
|
|
103
|
+
},
|
|
104
|
+
"react-dom": {
|
|
105
|
+
"optional": false
|
|
106
|
+
},
|
|
107
|
+
"react-hook-form": {
|
|
108
|
+
"optional": false
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
"engines": {
|
|
112
|
+
"node": ">=18.0.0"
|
|
113
|
+
},
|
|
114
|
+
"publishConfig": {
|
|
115
|
+
"access": "public"
|
|
116
|
+
}
|
|
117
|
+
}
|