@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.
@@ -1,10 +1,10 @@
1
- import { a0 as Z, R as r, M as H, Y as ee, e as te, a1 as se, _ as K } from "../chunks/ui-CbFPvWIc.js";
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 ie, q as ae } from "../chunks/hooks-CUNBk2tZ.js";
4
- import { gql as re } from "@apollo/client";
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 oe } from "../chunks/query-D2S9cFBP.js";
7
- const le = re`
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
- `, pe = (B) => {
20
- const e = ie.c(70);
21
- let l, n, d, S, N, O, C;
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: C,
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] = C) : (l = e[1], n = e[2], d = e[3], S = e[4], N = e[5], O = e[6], C = e[7]);
31
- const M = S === void 0 ? oe : S, z = N === void 0 ? le : N, I = O === void 0 ? "" : O, V = C === void 0 ? "noxickon" : C;
32
- let q, D;
33
- e[8] === Symbol.for("react.memo_cache_sentinel") ? (q = {
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] = q, e[9] = D) : (q = e[8], D = e[9]);
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: (i, a) => {
42
+ update: (a, i) => {
43
43
  const {
44
44
  data: J
45
- } = a;
46
- J?.login.success && i.writeQuery({
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: q,
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 = ae(F);
61
+ const t = oe(F);
62
62
  let R;
63
- e[15] !== t || e[16] !== n ? (R = async (i) => {
64
- i.preventDefault(), t.submit({
65
- onError: (a) => {
66
- se(a, t);
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: (a) => {
69
- a.data && a.data.login.success ? n?.(a) : console.error("Login failed: Invalid credentials");
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] !== I ? (f = I ? /* @__PURE__ */ s("p", { className: "px-2 py-1 font-mono text-xs", children: I }) : null, e[22] = I, e[23] = f) : f = e[23];
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 = (i) => t.setData("username", i), e[30] = t, e[31] = g) : g = e[31];
92
- let A, Q;
93
- e[32] === Symbol.for("react.memo_cache_sentinel") ? (A = /* @__PURE__ */ s(r.Icon, { path: "mdiAccount" }), Q = /* @__PURE__ */ s(r, { autoComplete: "off", name: "username", placeholder: "Enter your username" }), e[32] = A, e[33] = Q) : (A = e[32], Q = e[33]);
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
- A,
99
- Q
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 U;
103
- e[39] === Symbol.for("react.memo_cache_sentinel") ? (U = /* @__PURE__ */ s(K, { children: "password" }), e[39] = U) : U = e[39];
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 = (i) => t.setData("password", i), e[42] = t, e[43] = L) : L = e[43];
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: "mdiLockOutline" }), $ = /* @__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]);
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
- U,
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(ee, { icon: "mdiAlertCircleOutline", children: "username or password is wrong" }) : null, e[52] = t.hasErrors, e[53] = w) : w = e[53];
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(te, { 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];
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
- pe as OxLogin
141
+ ge as OxLogin
142
142
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("../chunks/ui-9efLp51u.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;
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;
@@ -1,4 +1,4 @@
1
- import "../chunks/ui-CbFPvWIc.js";
1
+ import "../chunks/ui-ULvcrJjV.js";
2
2
  import { u as s } from "../chunks/useAuth-BFgXzu6Q.js";
3
3
  import { v as a } from "../chunks/hooks-CUNBk2tZ.js";
4
4
  const v = (e) => {
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../chunks/ui-9efLp51u.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;
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;
@@ -1,17 +1,17 @@
1
- import { a6 as s, a5 as e, a0 as o, a7 as t, a8 as l, ac as m, ad as d, ae as i, af as n, ag as f, a9 as h, aa as p, a1 as c, ah as b, ab as E, ai as u, aj as T, al as g, ak as v } from "../chunks/ui-CbFPvWIc.js";
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
- e as buildUrl,
5
- o as cn,
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
- f as formatTimestamp,
13
- h as generateRandomString,
14
- p as handleFormErrors,
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,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@noxickon/onyx",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "type": "module",
5
5
  "main": "./dist/onyx.umd.js",
6
6
  "module": "./dist/onyx.es.js",