@himanshu-sorathiya/react-kit 1.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/README.md ADDED
@@ -0,0 +1,3 @@
1
+ # react-kit
2
+
3
+ An opinionated collection of react hooks, and reusable UI components.
package/dist/index.css ADDED
@@ -0,0 +1,2 @@
1
+ :where(html){scrollbar-gutter:stable both}:where(body:has(dialog[open])){overflow:hidden}:where(dialog.universal-modal){box-sizing:border-box;max-width:var(--modal-max-width,500px);background:0 0;border:none;width:calc(100% - 2rem);padding:0}:where(dialog.universal-modal .modal-container){box-sizing:border-box;padding:var(--modal-padding,24px);background-color:var(--modal-bg,#fff);border-radius:var(--modal-radius,8px);box-shadow:var(--modal-shadow,0 4px 12px #00000026)}dialog.universal-modal::backdrop{background-color:var(--modal-backdrop-bg,#00000080);-webkit-backdrop-filter:blur(var(--modal-backdrop-blur,none));backdrop-filter:blur(var(--modal-backdrop-blur,none))}:where(dialog.universal-modal[open]){animation:.2s ease-out modal-fade-in}@keyframes modal-fade-in{0%{opacity:0;transform:scale(.95)}to{opacity:1;transform:scale(1)}}
2
+ /*$vite$:1*/
package/dist/index.js ADDED
@@ -0,0 +1,51 @@
1
+ import { useEffect as e, useRef as t } from "react";
2
+ import { createPortal as n } from "react-dom";
3
+ import { createStore as r, useSelector as i } from "@tanstack/react-store";
4
+ import { jsx as a } from "react/jsx-runtime";
5
+ //#region src/store/modalStore.ts
6
+ var o = r({
7
+ id: null,
8
+ data: void 0
9
+ }, ({ setState: e }) => ({
10
+ open: (t, n) => e((e) => ({
11
+ ...e,
12
+ id: t,
13
+ data: n
14
+ })),
15
+ close: () => e((e) => ({
16
+ ...e,
17
+ id: null,
18
+ data: void 0
19
+ }))
20
+ }));
21
+ //#endregion
22
+ //#region src/hooks/useModal.ts
23
+ function s() {
24
+ return {
25
+ id: i(o, (e) => e.id),
26
+ data: i(o, (e) => e.data),
27
+ openModal: o.actions.open,
28
+ closeModal: o.actions.close
29
+ };
30
+ }
31
+ //#endregion
32
+ //#region src/components/Modal.tsx
33
+ function c({ children: r, className: i = "" }) {
34
+ let { id: o, closeModal: c } = s(), l = t(null);
35
+ return e(() => {
36
+ let e = l.current;
37
+ e && (o && !e.open ? e.showModal() : !o && e.open && e.close());
38
+ }, [o]), n(/* @__PURE__ */ a("dialog", {
39
+ ref: l,
40
+ onCancel: (e) => {
41
+ e.preventDefault(), c();
42
+ },
43
+ className: `universal-modal ${i ?? ""}`,
44
+ children: /* @__PURE__ */ a("div", {
45
+ className: "modal-container",
46
+ children: r
47
+ })
48
+ }), document.body);
49
+ }
50
+ //#endregion
51
+ export { c as Modal, s as useModal };
package/package.json ADDED
@@ -0,0 +1,69 @@
1
+ {
2
+ "name": "@himanshu-sorathiya/react-kit",
3
+ "version": "1.0.0",
4
+ "description": "An opinionated collection of react hooks, and reusable UI components.",
5
+ "type": "module",
6
+ "module": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "files": [
9
+ "dist"
10
+ ],
11
+ "exports": {
12
+ ".": {
13
+ "types": "./dist/index.d.ts",
14
+ "import": "./dist/index.js"
15
+ },
16
+ "./styles.css": "./dist/index.css"
17
+ },
18
+ "scripts": {
19
+ "dev": "vite",
20
+ "build": "tsc -b && vite build",
21
+ "lint": "eslint .",
22
+ "preview": "vite preview",
23
+ "format": "prettier . --write"
24
+ },
25
+ "dependencies": {
26
+ "@tanstack/react-store": "^0.11.0"
27
+ },
28
+ "peerDependencies": {
29
+ "react": "^17.0.0 || ^18.0.0 || ^19.0.0",
30
+ "react-dom": "^17.0.0 || ^18.0.0 || ^19.0.0"
31
+ },
32
+ "devDependencies": {
33
+ "@eslint/js": "^10.0.1",
34
+ "@types/node": "^24.12.3",
35
+ "@types/react": "^19.2.14",
36
+ "@types/react-dom": "^19.2.3",
37
+ "@vitejs/plugin-react": "^6.0.1",
38
+ "eslint": "^10.3.0",
39
+ "eslint-plugin-react-hooks": "^7.1.1",
40
+ "eslint-plugin-react-refresh": "^0.5.2",
41
+ "globals": "^17.6.0",
42
+ "prettier": "^3.8.3",
43
+ "react": "^19.2.6",
44
+ "react-dom": "^19.2.6",
45
+ "typescript": "~6.0.2",
46
+ "typescript-eslint": "^8.59.2",
47
+ "vite": "^8.0.12"
48
+ },
49
+ "sideEffects": [
50
+ "**/*.css"
51
+ ],
52
+ "keywords": [
53
+ "react",
54
+ "react-kit",
55
+ "hooks",
56
+ "components",
57
+ "state-management"
58
+ ],
59
+ "homepage": "https://github.com/Himanshu-Sorathiya-Simform/react-kit#readme",
60
+ "bugs": {
61
+ "url": "https://github.com/Himanshu-Sorathiya-Simform/react-kit/issues"
62
+ },
63
+ "repository": {
64
+ "type": "git",
65
+ "url": "git+https://github.com/Himanshu-Sorathiya-Simform/react-kit.git"
66
+ },
67
+ "license": "MIT",
68
+ "author": "Himanshu Sorathiya"
69
+ }