@noxickon/onyx 2.0.0 → 2.0.1
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 +107 -11
- package/dist/chunks/ui-DmUf2PZA.js +20 -0
- package/dist/chunks/{ui-CbFPvWIc.js → ui-ULvcrJjV.js} +2154 -2149
- package/dist/contexts/contexts.cjs.js +1 -1
- package/dist/contexts/contexts.es.js +1 -1
- package/dist/layouts/layouts.cjs.js +1 -1
- package/dist/layouts/layouts.es.js +90 -90
- package/dist/onyx.cjs.js +1 -1
- package/dist/onyx.es.js +1 -1
- package/dist/pages/pages.cjs.js +2 -2
- package/dist/pages/pages.es.js +39 -39
- package/dist/routes/routes.cjs.js +1 -1
- package/dist/routes/routes.es.js +1 -1
- package/dist/utils/utils.cjs.js +1 -1
- package/dist/utils/utils.es.js +6 -6
- package/package.json +1 -1
- package/dist/chunks/ui-9efLp51u.js +0 -20
package/dist/pages/pages.es.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { a0 as Z, R as r, M as H, Y as
|
|
1
|
+
import { a0 as Z, R as r, a1 as ee, M as H, a2 as te, Y as se, e as ae, a3 as ie, _ as K } from "../chunks/ui-ULvcrJjV.js";
|
|
2
2
|
import { jsx as s, jsxs as o } from "react/jsx-runtime";
|
|
3
|
-
import { d as
|
|
4
|
-
import { gql as
|
|
3
|
+
import { d as re, q as oe } from "../chunks/hooks-CUNBk2tZ.js";
|
|
4
|
+
import { gql as le } from "@apollo/client";
|
|
5
5
|
import "react";
|
|
6
|
-
import { D as
|
|
7
|
-
const
|
|
6
|
+
import { D as ne } from "../chunks/query-D2S9cFBP.js";
|
|
7
|
+
const de = le`
|
|
8
8
|
mutation Login($input: LoginInput!) {
|
|
9
9
|
login(input: $input) {
|
|
10
10
|
success
|
|
@@ -16,34 +16,34 @@ const le = re`
|
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
|
-
`,
|
|
20
|
-
const e =
|
|
21
|
-
let l, n, d, S, N, O,
|
|
19
|
+
`, ge = (B) => {
|
|
20
|
+
const e = re.c(70);
|
|
21
|
+
let l, n, d, S, N, O, I;
|
|
22
22
|
e[0] !== B ? ({
|
|
23
23
|
cacheQuery: S,
|
|
24
24
|
className: l,
|
|
25
25
|
mutation: N,
|
|
26
26
|
onSubmit: n,
|
|
27
27
|
subtitle: O,
|
|
28
|
-
title:
|
|
28
|
+
title: I,
|
|
29
29
|
...d
|
|
30
|
-
} = B, e[0] = B, e[1] = l, e[2] = n, e[3] = d, e[4] = S, e[5] = N, e[6] = O, e[7] =
|
|
31
|
-
const M = S === void 0 ?
|
|
32
|
-
let
|
|
33
|
-
e[8] === Symbol.for("react.memo_cache_sentinel") ? (
|
|
30
|
+
} = B, e[0] = B, e[1] = l, e[2] = n, e[3] = d, e[4] = S, e[5] = N, e[6] = O, e[7] = I) : (l = e[1], n = e[2], d = e[3], S = e[4], N = e[5], O = e[6], I = e[7]);
|
|
31
|
+
const M = S === void 0 ? ne : S, z = N === void 0 ? de : N, q = O === void 0 ? "" : O, V = I === void 0 ? "noxickon" : I;
|
|
32
|
+
let C, D;
|
|
33
|
+
e[8] === Symbol.for("react.memo_cache_sentinel") ? (C = {
|
|
34
34
|
username: "",
|
|
35
35
|
password: ""
|
|
36
36
|
}, D = {
|
|
37
37
|
username: ["required"],
|
|
38
38
|
password: ["required"]
|
|
39
|
-
}, e[8] =
|
|
39
|
+
}, e[8] = C, e[9] = D) : (C = e[8], D = e[9]);
|
|
40
40
|
let c;
|
|
41
41
|
e[10] !== M ? (c = {
|
|
42
|
-
update: (
|
|
42
|
+
update: (a, i) => {
|
|
43
43
|
const {
|
|
44
44
|
data: J
|
|
45
|
-
} =
|
|
46
|
-
J?.login.success &&
|
|
45
|
+
} = i;
|
|
46
|
+
J?.login.success && a.writeQuery({
|
|
47
47
|
query: M,
|
|
48
48
|
data: {
|
|
49
49
|
me: J.login.me
|
|
@@ -53,20 +53,20 @@ const le = re`
|
|
|
53
53
|
}, e[10] = M, e[11] = c) : c = e[11];
|
|
54
54
|
let F;
|
|
55
55
|
e[12] !== z || e[13] !== c ? (F = {
|
|
56
|
-
initialData:
|
|
56
|
+
initialData: C,
|
|
57
57
|
validationRules: D,
|
|
58
58
|
operation: z,
|
|
59
59
|
options: c
|
|
60
60
|
}, e[12] = z, e[13] = c, e[14] = F) : F = e[14];
|
|
61
|
-
const t =
|
|
61
|
+
const t = oe(F);
|
|
62
62
|
let R;
|
|
63
|
-
e[15] !== t || e[16] !== n ? (R = async (
|
|
64
|
-
|
|
65
|
-
onError: (
|
|
66
|
-
|
|
63
|
+
e[15] !== t || e[16] !== n ? (R = async (a) => {
|
|
64
|
+
a.preventDefault(), t.submit({
|
|
65
|
+
onError: (i) => {
|
|
66
|
+
ie(i, t);
|
|
67
67
|
},
|
|
68
|
-
onSuccess: (
|
|
69
|
-
|
|
68
|
+
onSuccess: (i) => {
|
|
69
|
+
i.data && i.data.login.success ? n?.(i) : console.error("Login failed: Invalid credentials");
|
|
70
70
|
}
|
|
71
71
|
});
|
|
72
72
|
}, e[15] = t, e[16] = n, e[17] = R) : R = e[17];
|
|
@@ -76,7 +76,7 @@ const le = re`
|
|
|
76
76
|
let u;
|
|
77
77
|
e[20] !== V ? (u = /* @__PURE__ */ s("h1", { className: "px-2 font-mono text-2xl text-gray-1200", children: V }), e[20] = V, e[21] = u) : u = e[21];
|
|
78
78
|
let f;
|
|
79
|
-
e[22] !==
|
|
79
|
+
e[22] !== q ? (f = q ? /* @__PURE__ */ s("p", { className: "px-2 py-1 font-mono text-xs", children: q }) : null, e[22] = q, e[23] = f) : f = e[23];
|
|
80
80
|
let p;
|
|
81
81
|
e[24] !== u || e[25] !== f ? (p = /* @__PURE__ */ o("div", { className: "mb-4 text-center", children: [
|
|
82
82
|
u,
|
|
@@ -88,29 +88,29 @@ const le = re`
|
|
|
88
88
|
let h;
|
|
89
89
|
e[28] !== t ? (h = t.hasError("username"), e[28] = t, e[29] = h) : h = e[29];
|
|
90
90
|
let g;
|
|
91
|
-
e[30] !== t ? (g = (
|
|
92
|
-
let
|
|
93
|
-
e[32] === Symbol.for("react.memo_cache_sentinel") ? (
|
|
91
|
+
e[30] !== t ? (g = (a) => t.setData("username", a), e[30] = t, e[31] = g) : g = e[31];
|
|
92
|
+
let Q, U;
|
|
93
|
+
e[32] === Symbol.for("react.memo_cache_sentinel") ? (Q = /* @__PURE__ */ s(r.Icon, { path: ee }), U = /* @__PURE__ */ s(r, { autoComplete: "off", name: "username", placeholder: "Enter your username" }), e[32] = Q, e[33] = U) : (Q = e[32], U = e[33]);
|
|
94
94
|
let x;
|
|
95
95
|
e[34] !== t.data.username || e[35] !== t.isLoading || e[36] !== h || e[37] !== g ? (x = /* @__PURE__ */ o(H.Field, { children: [
|
|
96
96
|
T,
|
|
97
97
|
/* @__PURE__ */ o(r.Container, { disabled: P, error: h, required: !0, value: t.data.username, onChange: g, children: [
|
|
98
|
-
|
|
99
|
-
|
|
98
|
+
Q,
|
|
99
|
+
U
|
|
100
100
|
] })
|
|
101
101
|
] }), e[34] = t.data.username, e[35] = t.isLoading, e[36] = h, e[37] = g, e[38] = x) : x = e[38];
|
|
102
|
-
let
|
|
103
|
-
e[39] === Symbol.for("react.memo_cache_sentinel") ? (
|
|
102
|
+
let A;
|
|
103
|
+
e[39] === Symbol.for("react.memo_cache_sentinel") ? (A = /* @__PURE__ */ s(K, { children: "password" }), e[39] = A) : A = e[39];
|
|
104
104
|
const X = t.isLoading;
|
|
105
105
|
let y;
|
|
106
106
|
e[40] !== t ? (y = t.hasError("password"), e[40] = t, e[41] = y) : y = e[41];
|
|
107
107
|
let L;
|
|
108
|
-
e[42] !== t ? (L = (
|
|
108
|
+
e[42] !== t ? (L = (a) => t.setData("password", a), e[42] = t, e[43] = L) : L = e[43];
|
|
109
109
|
let G, $, j;
|
|
110
|
-
e[44] === Symbol.for("react.memo_cache_sentinel") ? (G = /* @__PURE__ */ s(r.Icon, { path:
|
|
110
|
+
e[44] === Symbol.for("react.memo_cache_sentinel") ? (G = /* @__PURE__ */ s(r.Icon, { path: te }), $ = /* @__PURE__ */ s(r, { autoComplete: "off", name: "password", placeholder: "Enter your password" }), j = /* @__PURE__ */ s(r.VisibilityButton, {}), e[44] = G, e[45] = $, e[46] = j) : (G = e[44], $ = e[45], j = e[46]);
|
|
111
111
|
let b;
|
|
112
112
|
e[47] !== t.data.password || e[48] !== t.isLoading || e[49] !== y || e[50] !== L ? (b = /* @__PURE__ */ o(H.Field, { children: [
|
|
113
|
-
|
|
113
|
+
A,
|
|
114
114
|
/* @__PURE__ */ o(r.Container, { disabled: X, error: y, required: !0, type: "password", value: t.data.password, onChange: L, children: [
|
|
115
115
|
G,
|
|
116
116
|
$,
|
|
@@ -118,10 +118,10 @@ const le = re`
|
|
|
118
118
|
] })
|
|
119
119
|
] }), e[47] = t.data.password, e[48] = t.isLoading, e[49] = y, e[50] = L, e[51] = b) : b = e[51];
|
|
120
120
|
let w;
|
|
121
|
-
e[52] !== t.hasErrors ? (w = t.hasErrors ? /* @__PURE__ */ s(
|
|
121
|
+
e[52] !== t.hasErrors ? (w = t.hasErrors ? /* @__PURE__ */ s(se, { children: "username or password is wrong" }) : null, e[52] = t.hasErrors, e[53] = w) : w = e[53];
|
|
122
122
|
const Y = t.isLoading ? "Signing in..." : "Sign In";
|
|
123
123
|
let E;
|
|
124
|
-
e[54] !== t.isLoading || e[55] !== Y ? (E = /* @__PURE__ */ s(
|
|
124
|
+
e[54] !== t.isLoading || e[55] !== Y ? (E = /* @__PURE__ */ s(ae, { disabled: t.isLoading, fullWidth: !0, isLoading: t.isLoading, size: "sm", type: "submit", variant: "primary", children: Y }), e[54] = t.isLoading, e[55] = Y, e[56] = E) : E = e[56];
|
|
125
125
|
let _;
|
|
126
126
|
e[57] !== W || e[58] !== x || e[59] !== b || e[60] !== w || e[61] !== E ? (_ = /* @__PURE__ */ o(H, { className: "space-y-6", onSubmit: W, children: [
|
|
127
127
|
x,
|
|
@@ -138,5 +138,5 @@ const le = re`
|
|
|
138
138
|
return e[66] !== d || e[67] !== m || e[68] !== v ? (k = /* @__PURE__ */ s("div", { className: m, ...d, children: v }), e[66] = d, e[67] = m, e[68] = v, e[69] = k) : k = e[69], k;
|
|
139
139
|
};
|
|
140
140
|
export {
|
|
141
|
-
|
|
141
|
+
ge as OxLogin
|
|
142
142
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../chunks/ui-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../chunks/ui-DmUf2PZA.js");const d=require("../chunks/useAuth-DxoDe3YA.js"),a=require("../chunks/hooks-UiKjBucd.js"),g=u=>{const{children:i,onAuthenticated:n,onLoading:t}=u,o=n===void 0?null:n,r=t===void 0?null:t,{isLoggedIn:s,loading:e}=d.useOxAuth();return e?r:s?o:i},h=u=>{const{children:i,onLoading:n,onUnauthenticated:t}=u,o=n===void 0?null:n,r=t===void 0?null:t,{isLoggedIn:s,loading:e}=d.useOxAuth();return e?o:s?i:r},O=u=>{const{children:i,onLoading:n,onUnauthorized:t,roles:o}=u,r=n===void 0?null:n,s=t===void 0?null:t,e=o===void 0?["admin"]:o,{loading:l,user:c}=d.useOxAuth();return l?r:!c||a.isEmpty(e)||!e.includes(c.role)?s:i};exports.OxGuestRoute=g;exports.OxProtectedRoute=h;exports.OxRoleRoute=O;
|
package/dist/routes/routes.es.js
CHANGED
package/dist/utils/utils.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../chunks/ui-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../chunks/ui-DmUf2PZA.js");exports.buildMailTo=r.buildMailTo;exports.buildUrl=r.buildUrl;exports.cn=r.cn;exports.copyToClipboard=r.copyToClipboard;exports.createId=r.createId;exports.formatBytes=r.formatBytes;exports.formatCurrency=r.formatCurrency;exports.formatDate=r.formatDate;exports.formatNumber=r.formatNumber;exports.formatTimestamp=r.formatTimestamp;exports.generateRandomString=r.generateRandomString;exports.handleFormErrors=r.handleFormErrors;exports.handleGraphQLFormErrors=r.handleGraphQLFormErrors;exports.hasDataSlot=r.hasDataSlot;exports.parseGraphQLErrors=r.parseGraphQLErrors;exports.scrollToElement=r.scrollToElement;exports.validateEmail=r.validateEmail;exports.validatePhone=r.validatePhone;exports.validateUrl=r.validateUrl;
|
package/dist/utils/utils.es.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ab as s, aa as o, a0 as e, ac as t, ad as l, ah as m, ai as d, aj as i, ak as n, al as p, ae as f, af as h, a3 as c, am as b, ag as E, an as u, ao as T, aq as g, ap as v } from "../chunks/ui-ULvcrJjV.js";
|
|
2
2
|
export {
|
|
3
3
|
s as buildMailTo,
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
o as buildUrl,
|
|
5
|
+
e as cn,
|
|
6
6
|
t as copyToClipboard,
|
|
7
7
|
l as createId,
|
|
8
8
|
m as formatBytes,
|
|
9
9
|
d as formatCurrency,
|
|
10
10
|
i as formatDate,
|
|
11
11
|
n as formatNumber,
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
p as formatTimestamp,
|
|
13
|
+
f as generateRandomString,
|
|
14
|
+
h as handleFormErrors,
|
|
15
15
|
c as handleGraphQLFormErrors,
|
|
16
16
|
b as hasDataSlot,
|
|
17
17
|
E as parseGraphQLErrors,
|