@noxickon/onyx 0.0.4-dev.2 → 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/pages/pages.cjs.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
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
5
|
me {
|
|
6
6
|
id
|
|
7
7
|
username
|
|
@@ -10,4 +10,4 @@
|
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
|
-
`,j=({className:i,mutation:u=h,onSubmit:
|
|
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
|
@@ -8,7 +8,7 @@ import { b as w } from "../chunks/errorHelper--G-SWQzN.js";
|
|
|
8
8
|
const O = h`
|
|
9
9
|
mutation Login($input: LoginInput!) {
|
|
10
10
|
login(input: $input) {
|
|
11
|
-
|
|
11
|
+
success
|
|
12
12
|
me {
|
|
13
13
|
id
|
|
14
14
|
username
|
|
@@ -17,7 +17,7 @@ const O = h`
|
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
|
-
`,
|
|
20
|
+
`, C = ({
|
|
21
21
|
className: t,
|
|
22
22
|
mutation: n = O,
|
|
23
23
|
onSubmit: i,
|
|
@@ -99,5 +99,5 @@ const O = h`
|
|
|
99
99
|
] }) });
|
|
100
100
|
};
|
|
101
101
|
export {
|
|
102
|
-
|
|
102
|
+
C as OxLogin
|
|
103
103
|
};
|