@noxickon/onyx 1.0.5 → 1.1.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/dist/animations.css +25 -72
- package/dist/chunks/{hooks-B6Ov6Z0O.js → hooks-CUNBk2tZ.js} +2719 -2417
- package/dist/chunks/hooks-UiKjBucd.js +47 -0
- package/dist/chunks/ui-DGkJW_Fa.js +20745 -0
- package/dist/chunks/ui-DRRDAnVI.js +20 -0
- package/dist/contexts/contexts.cjs.js +2 -2
- package/dist/contexts/contexts.es.js +172 -140
- package/dist/hooks/hooks.cjs.js +1 -1
- package/dist/hooks/hooks.es.js +2 -2
- package/dist/index.d.ts +248 -210
- package/dist/layouts/layouts.cjs.js +1 -1
- package/dist/layouts/layouts.es.js +749 -673
- package/dist/layouts.d.ts +46 -36
- package/dist/onyx.cjs.js +1 -1
- package/dist/onyx.es.js +36 -34
- package/dist/pages/pages.cjs.js +2 -2
- package/dist/pages/pages.es.js +120 -94
- package/dist/pages.d.ts +2 -2
- package/dist/routes/routes.cjs.js +1 -1
- package/dist/routes/routes.es.js +36 -27
- package/dist/shared.css +15 -10
- package/dist/ui.css +1 -1
- package/dist/utils/utils.cjs.js +1 -1
- package/dist/utils/utils.es.js +1 -1
- package/package.json +4 -3
- package/dist/chunks/hooks-BGvU5VHk.js +0 -27
- package/dist/chunks/ui-CZGrB58H.js +0 -20
- package/dist/chunks/ui-Dmzl3_Y3.js +0 -20368
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const T=require("../chunks/ui-DRRDAnVI.js"),b=require("../chunks/query-CIsrxNi-.js"),O=require("react/jsx-runtime"),R=require("../chunks/useAuth-DxoDe3YA.js"),m=require("../chunks/hooks-UiKjBucd.js"),j=require("@apollo/client"),g=require("react");function L({adminRole:t="ADMIN",children:e,getCurrentUserQuery:a=b.DEFAULT_GET_CURRENT_USER,options:i={},pollInterval:f=300*1e3}){const{data:u,error:o,loading:d,refetch:s}=m.useQuery(a,{fetchPolicy:"cache-and-network",nextFetchPolicy:"cache-first",errorPolicy:"all",pollInterval:f,...i}),r=!!u?.me,l=u?.me?.role===t;return O.jsx(R.OxAuthContext.Provider,{value:{user:u?.me||null,loading:d,error:o??null,isLoggedIn:r,isAdmin:l,refreshUser:s},children:e})}const U=j.gql`
|
|
2
2
|
query getFeatures {
|
|
3
3
|
features
|
|
4
4
|
}
|
|
5
|
-
`,
|
|
5
|
+
`,w=g.createContext(void 0);function N({children:t,enableDevMode:e=!1,getFeaturesQuery:a=U,options:i={},pollInterval:f=300*1e3}){const{data:u,error:o,loading:d,refetch:s}=m.useQuery(a,{fetchPolicy:"cache-and-network",nextFetchPolicy:"cache-first",errorPolicy:"all",pollInterval:f,skip:e,...i}),r=u?.features||{},l=_=>e?!0:r[_]??!1;return O.jsx(w.Provider,{value:{features:r,isEnabled:l,loading:d,error:o??null,refreshFeatures:s,enableDevMode:e},children:t})}function C(){const t=g.useContext(w);if(!t)throw new Error("useOxFeature must be used within an OxFeatureProvider");return t}const k=t=>{const e=m.compilerRuntimeExports.c(8),{children:a,className:i,fallback:f,name:u}=t,o=f===void 0?null:f,{isEnabled:d}=C();if(!d(u)){let l;return e[0]!==i||e[1]!==o?(l=o?O.jsx("div",{className:T.cn("contents",i),children:o}):null,e[0]=i,e[1]=o,e[2]=l):l=e[2],l}let s;e[3]!==i?(s=T.cn("contents",i),e[3]=i,e[4]=s):s=e[4];let r;return e[5]!==a||e[6]!==s?(r=O.jsx("div",{className:s,children:a}),e[5]=a,e[6]=s,e[7]=r):r=e[7],r},S=g.createContext(null),G=t=>{const e=m.compilerRuntimeExports.c(17),{children:a,maxDialogs:i}=t,f=i===void 0?3:i;let u;e[0]===Symbol.for("react.memo_cache_sentinel")?(u=[],e[0]=u):u=e[0];const[o,d]=g.useState(u);let s,r;e[1]!==o?(s=()=>(o.some(I)?document.body.classList.add("overflow-hidden"):document.body.classList.remove("overflow-hidden"),Q),r=[o],e[1]=o,e[2]=s,e[3]=r):(s=e[2],r=e[3]),g.useEffect(s,r);let l;e[4]===Symbol.for("react.memo_cache_sentinel")?(l=()=>{let c=null;d(n=>{const h=n.filter($),p=m.head(h);return p?(c=p.id,n.map(E=>E.id===p.id?{...E,isOpen:!1}:E)):n}),c&&setTimeout(()=>{d(n=>m.reject(n,h=>h.id===c))},200)},e[4]=l):l=e[4];const _=l;let D;e[5]!==f?(D=(c,n)=>{const h=m.uniqueId(),p={id:h,content:c,isOpen:!0,options:n};return d(E=>[p,...E].slice(0,f)),h},e[5]=f,e[6]=D):D=e[6];const F=D;let v;e[7]===Symbol.for("react.memo_cache_sentinel")?(v=()=>{d(B),setTimeout(()=>{d([])},200)},e[7]=v):v=e[7];const q=v;let y;e[8]!==F?(y=Object.assign((c,n)=>F(c,n),{open:F,dismiss:_,dismissAll:q}),e[8]=F,e[9]=y):y=e[9];const P=y;let x;if(e[10]!==o){let c;e[12]===Symbol.for("react.memo_cache_sentinel")?(c=n=>O.jsx(T.OxDialog,{isOpen:n.isOpen,onClose:_,...n.options,children:n.content},n.id),e[12]=c):c=e[12],x=o.map(c),e[10]=o,e[11]=x}else x=e[11];let A;return e[13]!==a||e[14]!==P||e[15]!==x?(A=O.jsxs(S.Provider,{value:P,children:[a,x]}),e[13]=a,e[14]=P,e[15]=x,e[16]=A):A=e[16],A};function I(t){return t.isOpen}function Q(){document.body.classList.remove("overflow-hidden")}function $(t){return t.isOpen}function z(t){return{...t,isOpen:!1}}function B(t){return t.map(z)}const H=()=>{const t=g.useContext(S);if(!t)throw new Error("useOxDialog must be used within a DialogProvider");return t};exports.DEFAULT_GET_CURRENT_USER=b.DEFAULT_GET_CURRENT_USER;exports.OxAuthContext=R.OxAuthContext;exports.useOxAuth=R.useOxAuth;exports.DEFAULT_GET_FEATURES=U;exports.OxAuthProvider=L;exports.OxDialogProvider=G;exports.OxFeatureFlag=k;exports.OxFeatureProvider=N;exports.useOxDialog=H;exports.useOxFeature=C;
|
|
@@ -1,158 +1,190 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { D as
|
|
3
|
-
import { jsx as
|
|
4
|
-
import { O as
|
|
5
|
-
import { u as
|
|
6
|
-
import {
|
|
7
|
-
import { gql as
|
|
8
|
-
import { createContext as
|
|
9
|
-
function
|
|
10
|
-
adminRole:
|
|
11
|
-
children:
|
|
12
|
-
getCurrentUserQuery:
|
|
13
|
-
options:
|
|
14
|
-
pollInterval:
|
|
1
|
+
import { a0 as F, p as U } from "../chunks/ui-DGkJW_Fa.js";
|
|
2
|
+
import { D as k } from "../chunks/query-D2S9cFBP.js";
|
|
3
|
+
import { jsx as g, jsxs as N } from "react/jsx-runtime";
|
|
4
|
+
import { O as R } from "../chunks/useAuth-BFgXzu6Q.js";
|
|
5
|
+
import { u as fe } from "../chunks/useAuth-BFgXzu6Q.js";
|
|
6
|
+
import { w as P, d as b, x as j, r as I, n as q } from "../chunks/hooks-CUNBk2tZ.js";
|
|
7
|
+
import { gql as G } from "@apollo/client";
|
|
8
|
+
import { createContext as A, useContext as T, useState as $, useEffect as Q } from "react";
|
|
9
|
+
function re({
|
|
10
|
+
adminRole: t = "ADMIN",
|
|
11
|
+
children: e,
|
|
12
|
+
getCurrentUserQuery: u = k,
|
|
13
|
+
options: i = {},
|
|
14
|
+
pollInterval: m = 300 * 1e3
|
|
15
15
|
}) {
|
|
16
|
-
const {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
},
|
|
37
|
-
children: r
|
|
38
|
-
}
|
|
39
|
-
);
|
|
16
|
+
const {
|
|
17
|
+
data: a,
|
|
18
|
+
error: o,
|
|
19
|
+
loading: f,
|
|
20
|
+
refetch: s
|
|
21
|
+
} = P(u, {
|
|
22
|
+
fetchPolicy: "cache-and-network",
|
|
23
|
+
nextFetchPolicy: "cache-first",
|
|
24
|
+
errorPolicy: "all",
|
|
25
|
+
pollInterval: m,
|
|
26
|
+
...i
|
|
27
|
+
}), r = !!a?.me, l = a?.me?.role === t;
|
|
28
|
+
return /* @__PURE__ */ g(R.Provider, { value: {
|
|
29
|
+
user: a?.me || null,
|
|
30
|
+
loading: f,
|
|
31
|
+
error: o ?? null,
|
|
32
|
+
isLoggedIn: r,
|
|
33
|
+
isAdmin: l,
|
|
34
|
+
refreshUser: s
|
|
35
|
+
}, children: e });
|
|
40
36
|
}
|
|
41
|
-
const
|
|
37
|
+
const z = G`
|
|
42
38
|
query getFeatures {
|
|
43
39
|
features
|
|
44
40
|
}
|
|
45
|
-
`,
|
|
46
|
-
function
|
|
47
|
-
children:
|
|
48
|
-
enableDevMode:
|
|
49
|
-
getFeaturesQuery:
|
|
50
|
-
options:
|
|
51
|
-
pollInterval:
|
|
41
|
+
`, C = A(void 0);
|
|
42
|
+
function ne({
|
|
43
|
+
children: t,
|
|
44
|
+
enableDevMode: e = !1,
|
|
45
|
+
getFeaturesQuery: u = z,
|
|
46
|
+
options: i = {},
|
|
47
|
+
pollInterval: m = 300 * 1e3
|
|
52
48
|
}) {
|
|
53
|
-
const {
|
|
49
|
+
const {
|
|
50
|
+
data: a,
|
|
51
|
+
error: o,
|
|
52
|
+
loading: f,
|
|
53
|
+
refetch: s
|
|
54
|
+
} = P(u, {
|
|
54
55
|
fetchPolicy: "cache-and-network",
|
|
55
56
|
nextFetchPolicy: "cache-first",
|
|
56
57
|
errorPolicy: "all",
|
|
57
|
-
pollInterval:
|
|
58
|
-
skip:
|
|
59
|
-
...
|
|
60
|
-
}),
|
|
61
|
-
return /* @__PURE__ */
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
refreshFeatures: e,
|
|
70
|
-
enableDevMode: r
|
|
71
|
-
},
|
|
72
|
-
children: o
|
|
73
|
-
}
|
|
74
|
-
);
|
|
58
|
+
pollInterval: m,
|
|
59
|
+
skip: e,
|
|
60
|
+
...i
|
|
61
|
+
}), r = a?.features || {}, l = (O) => e ? !0 : r[O] ?? !1;
|
|
62
|
+
return /* @__PURE__ */ g(C.Provider, { value: {
|
|
63
|
+
features: r,
|
|
64
|
+
isEnabled: l,
|
|
65
|
+
loading: f,
|
|
66
|
+
error: o ?? null,
|
|
67
|
+
refreshFeatures: s,
|
|
68
|
+
enableDevMode: e
|
|
69
|
+
}, children: t });
|
|
75
70
|
}
|
|
76
|
-
function
|
|
77
|
-
const
|
|
78
|
-
if (!
|
|
71
|
+
function B() {
|
|
72
|
+
const t = T(C);
|
|
73
|
+
if (!t)
|
|
79
74
|
throw new Error("useOxFeature must be used within an OxFeatureProvider");
|
|
80
|
-
return
|
|
75
|
+
return t;
|
|
81
76
|
}
|
|
82
|
-
const
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
77
|
+
const ie = (t) => {
|
|
78
|
+
const e = b.c(8), {
|
|
79
|
+
children: u,
|
|
80
|
+
className: i,
|
|
81
|
+
fallback: m,
|
|
82
|
+
name: a
|
|
83
|
+
} = t, o = m === void 0 ? null : m, {
|
|
84
|
+
isEnabled: f
|
|
85
|
+
} = B();
|
|
86
|
+
if (!f(a)) {
|
|
87
|
+
let l;
|
|
88
|
+
return e[0] !== i || e[1] !== o ? (l = o ? /* @__PURE__ */ g("div", { className: F("contents", i), children: o }) : null, e[0] = i, e[1] = o, e[2] = l) : l = e[2], l;
|
|
89
|
+
}
|
|
90
|
+
let s;
|
|
91
|
+
e[3] !== i ? (s = F("contents", i), e[3] = i, e[4] = s) : s = e[4];
|
|
92
|
+
let r;
|
|
93
|
+
return e[5] !== u || e[6] !== s ? (r = /* @__PURE__ */ g("div", { className: s, children: u }), e[5] = u, e[6] = s, e[7] = r) : r = e[7], r;
|
|
94
|
+
}, S = A(null), le = (t) => {
|
|
95
|
+
const e = b.c(17), {
|
|
96
|
+
children: u,
|
|
97
|
+
maxDialogs: i
|
|
98
|
+
} = t, m = i === void 0 ? 3 : i;
|
|
99
|
+
let a;
|
|
100
|
+
e[0] === Symbol.for("react.memo_cache_sentinel") ? (a = [], e[0] = a) : a = e[0];
|
|
101
|
+
const [o, f] = $(a);
|
|
102
|
+
let s, r;
|
|
103
|
+
e[1] !== o ? (s = () => (o.some(H) ? document.body.classList.add("overflow-hidden") : document.body.classList.remove("overflow-hidden"), J), r = [o], e[1] = o, e[2] = s, e[3] = r) : (s = e[2], r = e[3]), Q(s, r);
|
|
104
|
+
let l;
|
|
105
|
+
e[4] === Symbol.for("react.memo_cache_sentinel") ? (l = () => {
|
|
106
|
+
let c = null;
|
|
107
|
+
f((n) => {
|
|
108
|
+
const h = n.filter(K), p = j(h);
|
|
109
|
+
return p ? (c = p.id, n.map((x) => x.id === p.id ? {
|
|
110
|
+
...x,
|
|
111
|
+
isOpen: !1
|
|
112
|
+
} : x)) : n;
|
|
113
|
+
}), c && setTimeout(() => {
|
|
114
|
+
f((n) => I(n, (h) => h.id === c));
|
|
104
115
|
}, 200);
|
|
105
|
-
}, [])
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
}
|
|
115
|
-
[
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
116
|
+
}, e[4] = l) : l = e[4];
|
|
117
|
+
const O = l;
|
|
118
|
+
let D;
|
|
119
|
+
e[5] !== m ? (D = (c, n) => {
|
|
120
|
+
const h = q(), p = {
|
|
121
|
+
id: h,
|
|
122
|
+
content: c,
|
|
123
|
+
isOpen: !0,
|
|
124
|
+
options: n
|
|
125
|
+
};
|
|
126
|
+
return f((x) => [p, ...x].slice(0, m)), h;
|
|
127
|
+
}, e[5] = m, e[6] = D) : D = e[6];
|
|
128
|
+
const _ = D;
|
|
129
|
+
let v;
|
|
130
|
+
e[7] === Symbol.for("react.memo_cache_sentinel") ? (v = () => {
|
|
131
|
+
f(W), setTimeout(() => {
|
|
132
|
+
f([]);
|
|
119
133
|
}, 200);
|
|
120
|
-
}, [])
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
);
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
134
|
+
}, e[7] = v) : v = e[7];
|
|
135
|
+
const L = v;
|
|
136
|
+
let y;
|
|
137
|
+
e[8] !== _ ? (y = Object.assign((c, n) => _(c, n), {
|
|
138
|
+
open: _,
|
|
139
|
+
dismiss: O,
|
|
140
|
+
dismissAll: L
|
|
141
|
+
}), e[8] = _, e[9] = y) : y = e[9];
|
|
142
|
+
const E = y;
|
|
143
|
+
let d;
|
|
144
|
+
if (e[10] !== o) {
|
|
145
|
+
let c;
|
|
146
|
+
e[12] === Symbol.for("react.memo_cache_sentinel") ? (c = (n) => /* @__PURE__ */ g(U, { isOpen: n.isOpen, onClose: O, ...n.options, children: n.content }, n.id), e[12] = c) : c = e[12], d = o.map(c), e[10] = o, e[11] = d;
|
|
147
|
+
} else
|
|
148
|
+
d = e[11];
|
|
149
|
+
let w;
|
|
150
|
+
return e[13] !== u || e[14] !== E || e[15] !== d ? (w = /* @__PURE__ */ N(S.Provider, { value: E, children: [
|
|
151
|
+
u,
|
|
152
|
+
d
|
|
153
|
+
] }), e[13] = u, e[14] = E, e[15] = d, e[16] = w) : w = e[16], w;
|
|
154
|
+
};
|
|
155
|
+
function H(t) {
|
|
156
|
+
return t.isOpen;
|
|
157
|
+
}
|
|
158
|
+
function J() {
|
|
159
|
+
document.body.classList.remove("overflow-hidden");
|
|
160
|
+
}
|
|
161
|
+
function K(t) {
|
|
162
|
+
return t.isOpen;
|
|
163
|
+
}
|
|
164
|
+
function V(t) {
|
|
165
|
+
return {
|
|
166
|
+
...t,
|
|
167
|
+
isOpen: !1
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
function W(t) {
|
|
171
|
+
return t.map(V);
|
|
172
|
+
}
|
|
173
|
+
const ce = () => {
|
|
174
|
+
const t = T(S);
|
|
175
|
+
if (!t)
|
|
144
176
|
throw new Error("useOxDialog must be used within a DialogProvider");
|
|
145
|
-
return
|
|
177
|
+
return t;
|
|
146
178
|
};
|
|
147
179
|
export {
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
180
|
+
k as DEFAULT_GET_CURRENT_USER,
|
|
181
|
+
z as DEFAULT_GET_FEATURES,
|
|
182
|
+
R as OxAuthContext,
|
|
183
|
+
re as OxAuthProvider,
|
|
184
|
+
le as OxDialogProvider,
|
|
185
|
+
ie as OxFeatureFlag,
|
|
186
|
+
ne as OxFeatureProvider,
|
|
187
|
+
fe as useOxAuth,
|
|
188
|
+
ce as useOxDialog,
|
|
189
|
+
B as useOxFeature
|
|
158
190
|
};
|
package/dist/hooks/hooks.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../chunks/hooks-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../chunks/hooks-UiKjBucd.js");exports.handleRules=e.handleRules;exports.useControllableState=e.useControllableState;exports.useFileUpload=e.useFileUpload;exports.useFilter=e.useFilter;exports.useFocus=e.useFocus;exports.useForm=e.useForm;exports.useFormState=e.useFormState;exports.useKeyboard=e.useKeyboard;exports.useOverflowDetection=e.useOverflowDetection;exports.validator=e.validator;
|
package/dist/hooks/hooks.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { z as a, h as o, B as l, C as t, j as u, q as r, y as F, k as d, l as i, A as m } from "../chunks/hooks-CUNBk2tZ.js";
|
|
2
2
|
export {
|
|
3
3
|
a as handleRules,
|
|
4
4
|
o as useControllableState,
|
|
@@ -9,5 +9,5 @@ export {
|
|
|
9
9
|
F as useFormState,
|
|
10
10
|
d as useKeyboard,
|
|
11
11
|
i as useOverflowDetection,
|
|
12
|
-
|
|
12
|
+
m as validator
|
|
13
13
|
};
|