@noxickon/onyx 0.0.3 → 0.0.4-dev.3
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/chunks/Button-D-v4l8ZE.js +20 -0
- package/dist/chunks/{Button-BV4_pmoH.js → Button-bARrxYyo.js} +120 -121
- package/dist/chunks/Input-CLi1H63d.js +1 -0
- package/dist/chunks/{Input-BraK4lDE.js → Input-dfvmdIHi.js} +38 -38
- package/dist/chunks/errorHelper--G-SWQzN.js +18 -0
- package/dist/chunks/errorHelper-DaP_XxEx.js +1 -0
- package/dist/chunks/formatTimestamp-CMxOnPo1.js +12 -0
- package/dist/chunks/formatTimestamp-TTsNcy7u.js +1 -0
- package/dist/chunks/{index-DnVdNmco.js → useAuth-DDRXztKj.js} +240 -178
- package/dist/chunks/{index-DGjVEo0G.js → useAuth-DPnpY3XC.js} +18 -9
- package/dist/chunks/{useForm-BAbY8X4X.js → useForm-D4co95Vn.js} +785 -801
- package/dist/chunks/useForm-DUviJ7xS.js +18 -0
- package/dist/chunks/useQuery-BvCyJMae.js +2065 -0
- package/dist/chunks/useQuery-DTNHO7so.js +3 -0
- package/dist/context/context.cjs.js +1 -1
- package/dist/context/context.es.js +1 -1
- package/dist/context.d.ts +1 -0
- package/dist/hooks/hooks.cjs.js +6 -6
- package/dist/hooks/hooks.es.js +117 -118
- package/dist/index.css +1 -1
- package/dist/index.d.ts +18 -0
- package/dist/layout/layout.cjs.js +1 -1
- package/dist/layout/layout.es.js +1 -1
- package/dist/onyx.cjs.js +1 -1
- package/dist/onyx.es.js +425 -386
- package/dist/pages/pages.cjs.js +9 -3
- package/dist/pages/pages.es.js +35 -25
- package/dist/utils/utils.cjs.js +1 -0
- package/dist/utils/utils.es.js +8 -0
- package/dist/utils.d.ts +29 -0
- package/package.json +31 -26
- package/dist/chunks/Button-CU-zvMVL.js +0 -20
- package/dist/chunks/Input-C5dK8VSu.js +0 -1
- package/dist/chunks/index-Dgwp7JKP.js +0 -601
- package/dist/chunks/index-rUH_mzKt.js +0 -2
- package/dist/chunks/useAuth-BwjRd05B.js +0 -10
- package/dist/chunks/useAuth-CR3bAGqp.js +0 -61
- package/dist/chunks/useForm-cxgyAiOs.js +0 -26
- package/dist/chunks/useQuery--6GP2-dN.js +0 -2
- package/dist/chunks/useQuery-mFRa2XuW.js +0 -1481
package/dist/pages/pages.cjs.js
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../chunks/jsx-runtime-CITbqOLs.js");require("react");const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../chunks/jsx-runtime-CITbqOLs.js");require("react");const o=require("../chunks/Button-D-v4l8ZE.js"),n=require("../chunks/Input-CLi1H63d.js"),a=require("../chunks/useAuth-DPnpY3XC.js"),p=require("../chunks/useForm-DUviJ7xS.js"),g=require("../chunks/errorHelper-DaP_XxEx.js"),h=a.gql`
|
|
2
2
|
mutation Login($input: LoginInput!) {
|
|
3
3
|
login(input: $input) {
|
|
4
|
-
|
|
4
|
+
success
|
|
5
|
+
me {
|
|
6
|
+
id
|
|
7
|
+
username
|
|
8
|
+
email
|
|
9
|
+
role
|
|
10
|
+
}
|
|
5
11
|
}
|
|
6
12
|
}
|
|
7
|
-
`,
|
|
13
|
+
`,j=({className:i,mutation:u=h,onSubmit:l,subtitle:d="",title:m="noxickon"})=>{const{setUser:x}=a.useOxAuth(),e=p.useForm({initialData:{username:"",password:""},validationRules:{username:["required"],password:["required"]},operation:u}),c=async s=>{s.preventDefault(),e.submit({onError:t=>{g.OxHandleGraphQLFormErrors(t,e)},onSuccess:t=>{x(t.data?t.data.login.me:null),l?.(t)}})};return r.jsxRuntimeExports.jsx("div",{className:o.twMerge("w-80",i),children:r.jsxRuntimeExports.jsxs("div",{className:"rounded-lg border border-neutral-700 bg-zinc-900/50 p-6 backdrop-blur-xl",children:[r.jsxRuntimeExports.jsxs("div",{className:"mb-4 text-center",children:[r.jsxRuntimeExports.jsx("h1",{className:"px-2 font-mono text-2xl text-white",children:m}),r.jsxRuntimeExports.jsx("p",{className:"px-2 py-1 font-mono text-xs text-neutral-400",children:d})]}),r.jsxRuntimeExports.jsxs(n.OxForm,{className:"space-y-6",onSubmit:c,children:[r.jsxRuntimeExports.jsx(n.OxInput,{autoComplete:"off",disabled:e.isLoading,error:e.hasError("username"),icon:"mdiAccount",label:"username",name:"username",placeholder:"Enter your username",required:!0,type:"text",value:e.data.username,onChange:s=>e.setData("username",s.target.value)}),r.jsxRuntimeExports.jsx(n.OxInput,{autoComplete:"off",disabled:e.isLoading,error:e.hasError("password"),icon:"mdiLockOutline",label:"password",name:"password",placeholder:"Enter your password",required:!0,type:"password",value:e.data.password,onChange:s=>e.setData("password",s.target.value)}),e.hasErrors&&r.jsxRuntimeExports.jsx(n.OxErrorMessage,{icon:"mdiAlertCircleOutline",children:"username or password is wrong"}),r.jsxRuntimeExports.jsx(o.OxButton,{disabled:e.isLoading,fullWidth:!0,isLoading:e.isLoading,size:"md",type:"submit",variant:"primary",children:e.isLoading?"Signing in...":"Sign In"})]})]})})};exports.OxLogin=j;
|
package/dist/pages/pages.es.js
CHANGED
|
@@ -1,23 +1,30 @@
|
|
|
1
1
|
import { j as r } from "../chunks/jsx-runtime--oOP9f8K.js";
|
|
2
2
|
import "react";
|
|
3
|
-
import { t as
|
|
4
|
-
import { O as
|
|
5
|
-
import { u as
|
|
6
|
-
import {
|
|
7
|
-
|
|
3
|
+
import { t as p, O as c } from "../chunks/Button-bARrxYyo.js";
|
|
4
|
+
import { O as x, a as o, b as g } from "../chunks/Input-dfvmdIHi.js";
|
|
5
|
+
import { g as h, u as b } from "../chunks/useAuth-DDRXztKj.js";
|
|
6
|
+
import { u as f } from "../chunks/useForm-D4co95Vn.js";
|
|
7
|
+
import { b as w } from "../chunks/errorHelper--G-SWQzN.js";
|
|
8
|
+
const O = h`
|
|
8
9
|
mutation Login($input: LoginInput!) {
|
|
9
10
|
login(input: $input) {
|
|
10
|
-
|
|
11
|
+
success
|
|
12
|
+
me {
|
|
13
|
+
id
|
|
14
|
+
username
|
|
15
|
+
email
|
|
16
|
+
role
|
|
17
|
+
}
|
|
11
18
|
}
|
|
12
19
|
}
|
|
13
|
-
`,
|
|
20
|
+
`, C = ({
|
|
14
21
|
className: t,
|
|
15
|
-
mutation: n =
|
|
16
|
-
onSubmit:
|
|
17
|
-
subtitle:
|
|
18
|
-
title:
|
|
22
|
+
mutation: n = O,
|
|
23
|
+
onSubmit: i,
|
|
24
|
+
subtitle: d = "",
|
|
25
|
+
title: l = "noxickon"
|
|
19
26
|
}) => {
|
|
20
|
-
const e =
|
|
27
|
+
const { setUser: u } = b(), e = f({
|
|
21
28
|
initialData: {
|
|
22
29
|
username: "",
|
|
23
30
|
password: ""
|
|
@@ -27,19 +34,22 @@ const f = h`
|
|
|
27
34
|
password: ["required"]
|
|
28
35
|
},
|
|
29
36
|
operation: n
|
|
30
|
-
}),
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
37
|
+
}), m = async (a) => {
|
|
38
|
+
a.preventDefault(), e.submit({
|
|
39
|
+
onError: (s) => {
|
|
40
|
+
w(s, e);
|
|
41
|
+
},
|
|
42
|
+
onSuccess: (s) => {
|
|
43
|
+
u(s.data ? s.data.login.me : null), i?.(s);
|
|
34
44
|
}
|
|
35
45
|
});
|
|
36
46
|
};
|
|
37
|
-
return /* @__PURE__ */ r.jsx("div", { className:
|
|
47
|
+
return /* @__PURE__ */ r.jsx("div", { className: p("w-80", t), children: /* @__PURE__ */ r.jsxs("div", { className: "rounded-lg border border-neutral-700 bg-zinc-900/50 p-6 backdrop-blur-xl", children: [
|
|
38
48
|
/* @__PURE__ */ r.jsxs("div", { className: "mb-4 text-center", children: [
|
|
39
|
-
/* @__PURE__ */ r.jsx("h1", { className: "px-2 font-mono text-2xl text-white", children:
|
|
40
|
-
/* @__PURE__ */ r.jsx("p", { className: "px-2 py-1 font-mono text-xs text-neutral-400", children:
|
|
49
|
+
/* @__PURE__ */ r.jsx("h1", { className: "px-2 font-mono text-2xl text-white", children: l }),
|
|
50
|
+
/* @__PURE__ */ r.jsx("p", { className: "px-2 py-1 font-mono text-xs text-neutral-400", children: d })
|
|
41
51
|
] }),
|
|
42
|
-
/* @__PURE__ */ r.jsxs(
|
|
52
|
+
/* @__PURE__ */ r.jsxs(x, { className: "space-y-6", onSubmit: m, children: [
|
|
43
53
|
/* @__PURE__ */ r.jsx(
|
|
44
54
|
o,
|
|
45
55
|
{
|
|
@@ -53,7 +63,7 @@ const f = h`
|
|
|
53
63
|
required: !0,
|
|
54
64
|
type: "text",
|
|
55
65
|
value: e.data.username,
|
|
56
|
-
onChange: (
|
|
66
|
+
onChange: (a) => e.setData("username", a.target.value)
|
|
57
67
|
}
|
|
58
68
|
),
|
|
59
69
|
/* @__PURE__ */ r.jsx(
|
|
@@ -69,12 +79,12 @@ const f = h`
|
|
|
69
79
|
required: !0,
|
|
70
80
|
type: "password",
|
|
71
81
|
value: e.data.password,
|
|
72
|
-
onChange: (
|
|
82
|
+
onChange: (a) => e.setData("password", a.target.value)
|
|
73
83
|
}
|
|
74
84
|
),
|
|
75
|
-
e.hasErrors && /* @__PURE__ */ r.jsx(
|
|
85
|
+
e.hasErrors && /* @__PURE__ */ r.jsx(g, { icon: "mdiAlertCircleOutline", children: "username or password is wrong" }),
|
|
76
86
|
/* @__PURE__ */ r.jsx(
|
|
77
|
-
|
|
87
|
+
c,
|
|
78
88
|
{
|
|
79
89
|
disabled: e.isLoading,
|
|
80
90
|
fullWidth: !0,
|
|
@@ -89,5 +99,5 @@ const f = h`
|
|
|
89
99
|
] }) });
|
|
90
100
|
};
|
|
91
101
|
export {
|
|
92
|
-
|
|
102
|
+
C as OxLogin
|
|
93
103
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../chunks/formatTimestamp-TTsNcy7u.js"),r=require("../chunks/errorHelper-DaP_XxEx.js");exports.formatTimestamp=e.formatTimestamp;exports.OxHandleFormErrors=r.OxHandleFormErrors;exports.OxHandleGraphQLFormErrors=r.OxHandleGraphQLFormErrors;exports.OxParseGraphQLErrors=r.OxParseGraphQLErrors;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { f as o } from "../chunks/formatTimestamp-CMxOnPo1.js";
|
|
2
|
+
import { a as m, b as e, O as p } from "../chunks/errorHelper--G-SWQzN.js";
|
|
3
|
+
export {
|
|
4
|
+
m as OxHandleFormErrors,
|
|
5
|
+
e as OxHandleGraphQLFormErrors,
|
|
6
|
+
p as OxParseGraphQLErrors,
|
|
7
|
+
o as formatTimestamp
|
|
8
|
+
};
|
package/dist/utils.d.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export declare const formatTimestamp: (date: Date) => string;
|
|
2
|
+
|
|
3
|
+
export declare interface OxFormState {
|
|
4
|
+
setError: (field: string, message: string) => void;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export declare interface OxGraphQLError {
|
|
8
|
+
extensions?: {
|
|
9
|
+
code?: string;
|
|
10
|
+
field?: string;
|
|
11
|
+
};
|
|
12
|
+
message: string;
|
|
13
|
+
path?: string[];
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export declare const OxHandleFormErrors: (errors: OxParsedError[], formState: OxFormState) => void;
|
|
17
|
+
|
|
18
|
+
export declare const OxHandleGraphQLFormErrors: (errors: OxGraphQLError[], formState: OxFormState) => void;
|
|
19
|
+
|
|
20
|
+
export declare interface OxParsedError {
|
|
21
|
+
code: string;
|
|
22
|
+
field?: string;
|
|
23
|
+
message: string;
|
|
24
|
+
path?: string[];
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export declare const OxParseGraphQLErrors: (errors: OxGraphQLError[]) => OxParsedError[];
|
|
28
|
+
|
|
29
|
+
export { }
|
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@noxickon/onyx",
|
|
3
|
-
"version": "0.0.3",
|
|
3
|
+
"version": "0.0.4-dev.3",
|
|
4
4
|
"type": "module",
|
|
5
|
+
"readme": "./NPM_README.md",
|
|
5
6
|
"main": "./dist/onyx.umd.js",
|
|
6
7
|
"module": "./dist/onyx.es.js",
|
|
7
8
|
"types": "./dist/index.d.ts",
|
|
@@ -27,6 +28,10 @@
|
|
|
27
28
|
"types": "./dist/layout.d.ts",
|
|
28
29
|
"import": "./dist/layout/layout.es.js"
|
|
29
30
|
},
|
|
31
|
+
"./utils": {
|
|
32
|
+
"types": "./dist/utils.d.ts",
|
|
33
|
+
"import": "./dist/utils/utils.es.js"
|
|
34
|
+
},
|
|
30
35
|
"./styles": "./dist/onyx.css",
|
|
31
36
|
"./shared": "./dist/shared.css"
|
|
32
37
|
},
|
|
@@ -36,7 +41,8 @@
|
|
|
36
41
|
"scripts": {
|
|
37
42
|
"dev": "storybook dev -p 6006",
|
|
38
43
|
"build": "tsc -b && vite build",
|
|
39
|
-
"prepublishOnly": "
|
|
44
|
+
"prepublishOnly": " npm run build",
|
|
45
|
+
"publish:dev": "npm version prerelease --preid=dev --no-git-tag-version && npm publish --tag dev",
|
|
40
46
|
"lint": "eslint .",
|
|
41
47
|
"preview": "vite preview",
|
|
42
48
|
"build:storybook": "npm run build && storybook build",
|
|
@@ -50,56 +56,55 @@
|
|
|
50
56
|
"@apollo/client": "^3.13.8",
|
|
51
57
|
"@mdi/js": "^7.4.47",
|
|
52
58
|
"@mdi/react": "^1.6.1",
|
|
53
|
-
"@tailwindcss/vite": "^4.1.
|
|
54
|
-
"axios": "^1.
|
|
55
|
-
"es-toolkit": "^1.39.
|
|
59
|
+
"@tailwindcss/vite": "^4.1.11",
|
|
60
|
+
"axios": "^1.11.0",
|
|
61
|
+
"es-toolkit": "^1.39.8",
|
|
56
62
|
"graphql": "^16.11.0",
|
|
57
63
|
"react": "^19.1.0",
|
|
58
64
|
"react-dom": "^19.1.0",
|
|
59
|
-
"recharts": "^
|
|
65
|
+
"recharts": "^3.1.0",
|
|
60
66
|
"tailwind-merge": "^3.3.1",
|
|
61
|
-
"tailwindcss": "^4.1.
|
|
62
|
-
"zod": "^
|
|
67
|
+
"tailwindcss": "^4.1.11",
|
|
68
|
+
"zod": "^4.0.10"
|
|
63
69
|
},
|
|
64
70
|
"devDependencies": {
|
|
65
71
|
"@chromatic-com/storybook": "^4.0.1",
|
|
66
|
-
"@eslint/js": "^9.
|
|
72
|
+
"@eslint/js": "^9.32.0",
|
|
67
73
|
"@storybook/addon-docs": "^9.0.18",
|
|
68
74
|
"@storybook/addon-onboarding": "^9.0.18",
|
|
69
75
|
"@storybook/addon-vitest": "^9.0.18",
|
|
70
76
|
"@storybook/react-vite": "^9.0.18",
|
|
71
77
|
"@tailwindcss/typography": "^0.5.16",
|
|
72
|
-
"@testing-library/jest-dom": "^6.6.
|
|
78
|
+
"@testing-library/jest-dom": "^6.6.4",
|
|
73
79
|
"@testing-library/react": "^16.3.0",
|
|
74
80
|
"@trivago/prettier-plugin-sort-imports": "^5.2.2",
|
|
75
81
|
"@types/jest-axe": "^3.5.9",
|
|
76
|
-
"@types/react": "^19.1.
|
|
77
|
-
"@types/react-dom": "^19.1.
|
|
78
|
-
"@
|
|
79
|
-
"@
|
|
80
|
-
"@vitest/
|
|
81
|
-
"
|
|
82
|
-
"
|
|
83
|
-
"eslint": "^9.25.0",
|
|
82
|
+
"@types/react": "^19.1.8",
|
|
83
|
+
"@types/react-dom": "^19.1.6",
|
|
84
|
+
"@vitejs/plugin-react": "^4.7.0",
|
|
85
|
+
"@vitest/browser": "^3.2.4",
|
|
86
|
+
"@vitest/coverage-v8": "^3.2.4",
|
|
87
|
+
"canvas": "^3.1.2",
|
|
88
|
+
"eslint": "^9.32.0",
|
|
84
89
|
"eslint-plugin-perfectionist": "^4.15.0",
|
|
85
90
|
"eslint-plugin-react-hooks": "^5.2.0",
|
|
86
|
-
"eslint-plugin-react-refresh": "^0.4.
|
|
91
|
+
"eslint-plugin-react-refresh": "^0.4.20",
|
|
87
92
|
"eslint-plugin-sort-destructure-keys": "^2.0.0",
|
|
88
93
|
"eslint-plugin-storybook": "^9.0.18",
|
|
89
94
|
"eslint-plugin-unused-imports": "^4.1.4",
|
|
90
|
-
"globals": "^16.
|
|
95
|
+
"globals": "^16.3.0",
|
|
91
96
|
"jest-axe": "^10.0.0",
|
|
92
97
|
"jsdom": "^26.1.0",
|
|
93
|
-
"playwright": "^1.
|
|
94
|
-
"prettier": "^3.
|
|
95
|
-
"prettier-plugin-tailwindcss": "^0.6.
|
|
98
|
+
"playwright": "^1.54.1",
|
|
99
|
+
"prettier": "^3.6.2",
|
|
100
|
+
"prettier-plugin-tailwindcss": "^0.6.14",
|
|
96
101
|
"storybook": "^9.0.18",
|
|
97
102
|
"typescript": "~5.8.3",
|
|
98
|
-
"typescript-eslint": "^8.
|
|
99
|
-
"vite": "^
|
|
103
|
+
"typescript-eslint": "^8.38.0",
|
|
104
|
+
"vite": "^7.0.6",
|
|
100
105
|
"vite-plugin-dts": "^4.5.4",
|
|
101
106
|
"vite-plugin-lib-inject-css": "^2.2.2",
|
|
102
|
-
"vitest": "^3.
|
|
107
|
+
"vitest": "^3.2.4"
|
|
103
108
|
},
|
|
104
109
|
"eslintConfig": {
|
|
105
110
|
"extends": [
|