@noxickon/onyx 0.0.1 → 0.0.2

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.
Files changed (41) hide show
  1. package/dist/chunks/Button-CLMaoxRW.js +11054 -0
  2. package/dist/chunks/Button-CZYAHivj.js +20 -0
  3. package/dist/chunks/Input-BQQT5eZ0.js +138 -0
  4. package/dist/chunks/Input-DJZcvJdP.js +1 -0
  5. package/dist/chunks/_commonjsHelpers-C6fGbg64.js +6 -0
  6. package/dist/chunks/_commonjsHelpers-DwGv2jUC.js +1 -0
  7. package/dist/chunks/constants-B1_n9ezb.js +1 -0
  8. package/dist/chunks/constants-CDXq37n6.js +4 -0
  9. package/dist/chunks/index-1-zQ3RaM.js +601 -0
  10. package/dist/chunks/index-BgUMV1hv.js +2129 -0
  11. package/dist/chunks/index-CjVXr8mh.js +2 -0
  12. package/dist/chunks/index-XTQUUzZ1.js +22 -0
  13. package/dist/chunks/isObject-BDHKUJKN.js +1 -0
  14. package/dist/chunks/isObject-vmP43YLW.js +6 -0
  15. package/dist/chunks/jsx-runtime-C5mzlN2N.js +284 -0
  16. package/dist/chunks/jsx-runtime-DUiatUiq.js +22 -0
  17. package/dist/chunks/useAuth-C-TIgBfr.js +61 -0
  18. package/dist/chunks/useAuth-CfKOZqhG.js +10 -0
  19. package/dist/chunks/useForm-BIKRbGHj.js +3085 -0
  20. package/dist/chunks/useForm-BZEaiRaa.js +26 -0
  21. package/dist/chunks/useQuery-B_ce5e8f.js +2 -0
  22. package/dist/chunks/useQuery-CJdYhuQu.js +1481 -0
  23. package/dist/context/context.cjs.js +1 -0
  24. package/dist/context/context.es.js +6 -0
  25. package/dist/context.d.ts +44 -0
  26. package/dist/hooks/hooks.cjs.js +6 -0
  27. package/dist/hooks/hooks.es.js +1917 -0
  28. package/dist/hooks.d.ts +130 -0
  29. package/dist/index.css +1 -1
  30. package/dist/index.d.ts +148 -110
  31. package/dist/layout/layout.cjs.js +1 -0
  32. package/dist/layout/layout.es.js +264 -0
  33. package/dist/layout.d.ts +89 -0
  34. package/dist/onyx.cjs.js +12 -0
  35. package/dist/onyx.es.js +2523 -9494
  36. package/dist/pages/pages.cjs.js +7 -0
  37. package/dist/pages/pages.es.js +93 -0
  38. package/dist/pages.d.ts +14 -0
  39. package/dist/shared.css +104 -0
  40. package/package.json +41 -16
  41. package/dist/onyx.umd.js +0 -42
@@ -0,0 +1,138 @@
1
+ import { j as e } from "./jsx-runtime-C5mzlN2N.js";
2
+ import { useId as S, useState as q, useEffect as C } from "react";
3
+ import { t as x, a as p } from "./Button-CLMaoxRW.js";
4
+ import { i as G } from "./isObject-vmP43YLW.js";
5
+ const H = ({
6
+ children: r,
7
+ className: l,
8
+ disabled: s = !1,
9
+ htmlFor: t,
10
+ required: a = !1
11
+ }) => /* @__PURE__ */ e.jsxs(
12
+ "label",
13
+ {
14
+ id: `${t}-label`,
15
+ className: x(
16
+ "block text-sm font-medium text-neutral-300",
17
+ s && "cursor-not-allowed text-neutral-500",
18
+ l
19
+ ),
20
+ htmlFor: t,
21
+ children: [
22
+ r,
23
+ a && /* @__PURE__ */ e.jsx("span", { className: "ml-1 text-rose-400", children: "*" })
24
+ ]
25
+ }
26
+ ), J = ({
27
+ children: r,
28
+ className: l,
29
+ disabled: s = !1,
30
+ id: t
31
+ }) => /* @__PURE__ */ e.jsx(
32
+ "p",
33
+ {
34
+ id: t,
35
+ className: x("text-xs text-neutral-400", s && "text-neutral-500", l),
36
+ children: r
37
+ }
38
+ ), I = ({
39
+ children: r,
40
+ className: l,
41
+ icon: s = "mdiAlertCircleOutline",
42
+ id: t
43
+ }) => r ? /* @__PURE__ */ e.jsxs(
44
+ "div",
45
+ {
46
+ id: t,
47
+ className: x("flex max-w-full items-center gap-1 text-xs text-rose-400", l),
48
+ role: "alert",
49
+ children: [
50
+ s ? /* @__PURE__ */ e.jsx(p, { className: "flex-shrink-0", icon: s, size: 0.8 }) : null,
51
+ /* @__PURE__ */ e.jsx("p", { className: "min-w-0 break-words", children: r })
52
+ ]
53
+ }
54
+ ) : null, U = ({
55
+ children: r,
56
+ className: l,
57
+ fullWidth: s = !1,
58
+ noValidate: t = !0,
59
+ ...a
60
+ }) => /* @__PURE__ */ e.jsx("form", { className: x(s && "w-full", l), noValidate: t, ...a, children: r }), V = ({
61
+ className: r,
62
+ description: l,
63
+ disabled: s = !1,
64
+ error: t = !1,
65
+ errorMessage: a,
66
+ icon: i = "",
67
+ iconPosition: u = "left",
68
+ id: v,
69
+ label: h,
70
+ name: E,
71
+ onChange: o,
72
+ placeholder: L = "Input placeholder...",
73
+ readOnly: $ = !1,
74
+ required: j = !1,
75
+ showMaxLength: k = !1,
76
+ type: z = "text",
77
+ value: n,
78
+ ...g
79
+ }) => {
80
+ const A = S(), [B, b] = q(
81
+ typeof n == "string" ? n.length : 0
82
+ ), f = v || A, N = `${f}-input`, w = `${f}-description`, m = `${f}-error`, y = g.maxLength, O = t && typeof a == "string", D = t && G(a);
83
+ C(() => {
84
+ typeof n == "string" && b(n.length);
85
+ }, [n]);
86
+ const F = (c) => {
87
+ const d = c.target.value.length;
88
+ b(d), o == null || o(c);
89
+ }, R = /* @__PURE__ */ e.jsxs("div", { className: "relative flex w-full items-center", children: [
90
+ i !== "" && u === "left" ? /* @__PURE__ */ e.jsx("div", { className: "absolute left-3 flex items-center", children: /* @__PURE__ */ e.jsx(p, { icon: i, size: 0.8 }) }) : null,
91
+ /* @__PURE__ */ e.jsx(
92
+ "input",
93
+ {
94
+ id: N,
95
+ "aria-describedby": [l ? w : "", O ? m : ""].filter(Boolean).join(" ") || void 0,
96
+ "aria-invalid": t,
97
+ "aria-required": j,
98
+ className: x(
99
+ "flex h-10 w-full rounded-lg bg-transparent px-2 py-2 text-sm text-white",
100
+ "default-outset-focus",
101
+ "placeholder:text-muted-foreground placeholder:text-neutral-500",
102
+ "default-disabled",
103
+ i && (u === "left" ? "pl-10" : "pr-10"),
104
+ t ? "default-error-border" : "default-border",
105
+ r
106
+ ),
107
+ disabled: s,
108
+ name: E,
109
+ placeholder: L,
110
+ readOnly: $,
111
+ type: z,
112
+ value: n,
113
+ onChange: F,
114
+ ...g
115
+ }
116
+ ),
117
+ i !== "" && u === "right" ? /* @__PURE__ */ e.jsx("div", { className: "absolute right-3 flex items-center", children: /* @__PURE__ */ e.jsx(p, { icon: i, size: 0.8 }) }) : null
118
+ ] });
119
+ return /* @__PURE__ */ e.jsxs("div", { className: "flex w-full flex-col gap-1", children: [
120
+ h ? /* @__PURE__ */ e.jsx(H, { disabled: s, htmlFor: N, required: j, children: h }) : null,
121
+ R,
122
+ k && typeof y == "number" ? /* @__PURE__ */ e.jsxs("div", { className: "pointer-events-none mt-1 text-right text-xs text-neutral-400", children: [
123
+ B,
124
+ "/",
125
+ y
126
+ ] }) : null,
127
+ l ? /* @__PURE__ */ e.jsx(J, { id: w, disabled: s, children: l }) : null,
128
+ O ? /* @__PURE__ */ e.jsx(I, { id: m, children: a }) : null,
129
+ D && Array.isArray(a) ? /* @__PURE__ */ e.jsx("div", { className: "mt-1 space-y-1", children: a.map((c, d) => /* @__PURE__ */ e.jsx(I, { id: `${m}-${d}`, children: c }, d)) }) : null
130
+ ] });
131
+ };
132
+ export {
133
+ U as O,
134
+ V as a,
135
+ I as b,
136
+ H as c,
137
+ J as d
138
+ };
@@ -0,0 +1 @@
1
+ "use strict";const e=require("./jsx-runtime-DUiatUiq.js"),f=require("react"),x=require("./Button-CZYAHivj.js"),S=require("./isObject-BDHKUJKN.js"),I=({children:l,className:r,disabled:s=!1,htmlFor:t,required:n=!1})=>e.jsxRuntimeExports.jsxs("label",{id:`${t}-label`,className:x.twMerge("block text-sm font-medium text-neutral-300",s&&"cursor-not-allowed text-neutral-500",r),htmlFor:t,children:[l,n&&e.jsxRuntimeExports.jsx("span",{className:"ml-1 text-rose-400",children:"*"})]}),y=({children:l,className:r,disabled:s=!1,id:t})=>e.jsxRuntimeExports.jsx("p",{id:t,className:x.twMerge("text-xs text-neutral-400",s&&"text-neutral-500",r),children:l}),j=({children:l,className:r,icon:s="mdiAlertCircleOutline",id:t})=>l?e.jsxRuntimeExports.jsxs("div",{id:t,className:x.twMerge("flex max-w-full items-center gap-1 text-xs text-rose-400",r),role:"alert",children:[s?e.jsxRuntimeExports.jsx(x.OxIcon,{className:"flex-shrink-0",icon:s,size:.8}):null,e.jsxRuntimeExports.jsx("p",{className:"min-w-0 break-words",children:l})]}):null,C=({children:l,className:r,fullWidth:s=!1,noValidate:t=!0,...n})=>e.jsxRuntimeExports.jsx("form",{className:x.twMerge(s&&"w-full",r),noValidate:t,...n,children:l}),G=({className:l,description:r,disabled:s=!1,error:t=!1,errorMessage:n,icon:a="",iconPosition:c="left",id:L,label:h,name:v,onChange:m,placeholder:$="Input placeholder...",readOnly:M=!1,required:E=!1,showMaxLength:k=!1,type:q="text",value:i,...g})=>{const z=f.useId(),[A,R]=f.useState(typeof i=="string"?i.length:0),d=L||z,w=`${d}-input`,O=`${d}-description`,p=`${d}-error`,b=g.maxLength,N=t&&typeof n=="string",B=t&&S.isObject(n);f.useEffect(()=>{typeof i=="string"&&R(i.length)},[i]);const D=u=>{const o=u.target.value.length;R(o),m==null||m(u)},F=e.jsxRuntimeExports.jsxs("div",{className:"relative flex w-full items-center",children:[a!==""&&c==="left"?e.jsxRuntimeExports.jsx("div",{className:"absolute left-3 flex items-center",children:e.jsxRuntimeExports.jsx(x.OxIcon,{icon:a,size:.8})}):null,e.jsxRuntimeExports.jsx("input",{id:w,"aria-describedby":[r?O:"",N?p:""].filter(Boolean).join(" ")||void 0,"aria-invalid":t,"aria-required":E,className:x.twMerge("flex h-10 w-full rounded-lg bg-transparent px-2 py-2 text-sm text-white","default-outset-focus","placeholder:text-muted-foreground placeholder:text-neutral-500","default-disabled",a&&(c==="left"?"pl-10":"pr-10"),t?"default-error-border":"default-border",l),disabled:s,name:v,placeholder:$,readOnly:M,type:q,value:i,onChange:D,...g}),a!==""&&c==="right"?e.jsxRuntimeExports.jsx("div",{className:"absolute right-3 flex items-center",children:e.jsxRuntimeExports.jsx(x.OxIcon,{icon:a,size:.8})}):null]});return e.jsxRuntimeExports.jsxs("div",{className:"flex w-full flex-col gap-1",children:[h?e.jsxRuntimeExports.jsx(I,{disabled:s,htmlFor:w,required:E,children:h}):null,F,k&&typeof b=="number"?e.jsxRuntimeExports.jsxs("div",{className:"pointer-events-none mt-1 text-right text-xs text-neutral-400",children:[A,"/",b]}):null,r?e.jsxRuntimeExports.jsx(y,{id:O,disabled:s,children:r}):null,N?e.jsxRuntimeExports.jsx(j,{id:p,children:n}):null,B&&Array.isArray(n)?e.jsxRuntimeExports.jsx("div",{className:"mt-1 space-y-1",children:n.map((u,o)=>e.jsxRuntimeExports.jsx(j,{id:`${p}-${o}`,children:u},o))}):null]})};exports.OxDescription=y;exports.OxErrorMessage=j;exports.OxForm=C;exports.OxInput=G;exports.OxLabel=I;
@@ -0,0 +1,6 @@
1
+ function e(t) {
2
+ return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
3
+ }
4
+ export {
5
+ e as g
6
+ };
@@ -0,0 +1 @@
1
+ "use strict";function e(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}exports.getDefaultExportFromCjs=e;
@@ -0,0 +1 @@
1
+ "use strict";exports.MOBILE_BREAKPOINT=768;
@@ -0,0 +1,4 @@
1
+ const o = 768;
2
+ export {
3
+ o as M
4
+ };