@noxickon/onyx 0.0.1 → 0.0.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.
Files changed (41) hide show
  1. package/dist/chunks/Button-BV4_pmoH.js +11054 -0
  2. package/dist/chunks/Button-CU-zvMVL.js +20 -0
  3. package/dist/chunks/Input-BraK4lDE.js +138 -0
  4. package/dist/chunks/Input-C5dK8VSu.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-DGjVEo0G.js +22 -0
  10. package/dist/chunks/index-Dgwp7JKP.js +601 -0
  11. package/dist/chunks/index-DnVdNmco.js +2129 -0
  12. package/dist/chunks/index-rUH_mzKt.js +2 -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--oOP9f8K.js +284 -0
  16. package/dist/chunks/jsx-runtime-CITbqOLs.js +22 -0
  17. package/dist/chunks/useAuth-BwjRd05B.js +10 -0
  18. package/dist/chunks/useAuth-CR3bAGqp.js +61 -0
  19. package/dist/chunks/useForm-BAbY8X4X.js +3085 -0
  20. package/dist/chunks/useForm-cxgyAiOs.js +26 -0
  21. package/dist/chunks/useQuery--6GP2-dN.js +2 -0
  22. package/dist/chunks/useQuery-mFRa2XuW.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 +144 -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 +1 -0
  35. package/dist/onyx.es.js +1219 -9485
  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 +40 -16
  41. package/dist/onyx.umd.js +0 -42
@@ -0,0 +1,7 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("../chunks/jsx-runtime-CITbqOLs.js");require("react");const i=require("../chunks/Button-CU-zvMVL.js"),t=require("../chunks/Input-C5dK8VSu.js"),p=require("../chunks/useForm-cxgyAiOs.js"),m=require("../chunks/index-DGjVEo0G.js"),c=m.gql`
2
+ mutation Login($input: LoginInput!) {
3
+ login(input: $input) {
4
+ isAuthenticated
5
+ }
6
+ }
7
+ `,g=({className:o,mutation:a=c,onSubmit:n,subtitle:u="",title:d="noxickon"})=>{const e=p.useForm({initialData:{username:"",password:""},validationRules:{username:["required"],password:["required"]},operation:a}),l=async s=>{s.preventDefault(),e.submit({onSuccess:x=>{n==null||n(x)}})};return r.jsxRuntimeExports.jsx("div",{className:i.twMerge("w-80",o),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:d}),r.jsxRuntimeExports.jsx("p",{className:"px-2 py-1 font-mono text-xs text-neutral-400",children:u})]}),r.jsxRuntimeExports.jsxs(t.OxForm,{className:"space-y-6",onSubmit:l,children:[r.jsxRuntimeExports.jsx(t.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(t.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(t.OxErrorMessage,{icon:"mdiAlertCircleOutline",children:"username or password is wrong"}),r.jsxRuntimeExports.jsx(i.OxButton,{disabled:e.isLoading,fullWidth:!0,isLoading:e.isLoading,size:"md",type:"submit",variant:"primary",children:e.isLoading?"Signing in...":"Sign In"})]})]})})};exports.OxLogin=g;
@@ -0,0 +1,93 @@
1
+ import { j as r } from "../chunks/jsx-runtime--oOP9f8K.js";
2
+ import "react";
3
+ import { t as m, O as p } from "../chunks/Button-BV4_pmoH.js";
4
+ import { O as c, a as o, b as x } from "../chunks/Input-BraK4lDE.js";
5
+ import { u as g } from "../chunks/useForm-BAbY8X4X.js";
6
+ import { g as h } from "../chunks/index-DnVdNmco.js";
7
+ const f = h`
8
+ mutation Login($input: LoginInput!) {
9
+ login(input: $input) {
10
+ isAuthenticated
11
+ }
12
+ }
13
+ `, y = ({
14
+ className: t,
15
+ mutation: n = f,
16
+ onSubmit: a,
17
+ subtitle: i = "",
18
+ title: d = "noxickon"
19
+ }) => {
20
+ const e = g({
21
+ initialData: {
22
+ username: "",
23
+ password: ""
24
+ },
25
+ validationRules: {
26
+ username: ["required"],
27
+ password: ["required"]
28
+ },
29
+ operation: n
30
+ }), l = async (s) => {
31
+ s.preventDefault(), e.submit({
32
+ onSuccess: (u) => {
33
+ a == null || a(u);
34
+ }
35
+ });
36
+ };
37
+ return /* @__PURE__ */ r.jsx("div", { className: m("w-80", t), children: /* @__PURE__ */ r.jsxs("div", { className: "rounded-lg border border-neutral-700 bg-zinc-900/50 p-6 backdrop-blur-xl", children: [
38
+ /* @__PURE__ */ r.jsxs("div", { className: "mb-4 text-center", children: [
39
+ /* @__PURE__ */ r.jsx("h1", { className: "px-2 font-mono text-2xl text-white", children: d }),
40
+ /* @__PURE__ */ r.jsx("p", { className: "px-2 py-1 font-mono text-xs text-neutral-400", children: i })
41
+ ] }),
42
+ /* @__PURE__ */ r.jsxs(c, { className: "space-y-6", onSubmit: l, children: [
43
+ /* @__PURE__ */ r.jsx(
44
+ o,
45
+ {
46
+ autoComplete: "off",
47
+ disabled: e.isLoading,
48
+ error: e.hasError("username"),
49
+ icon: "mdiAccount",
50
+ label: "username",
51
+ name: "username",
52
+ placeholder: "Enter your username",
53
+ required: !0,
54
+ type: "text",
55
+ value: e.data.username,
56
+ onChange: (s) => e.setData("username", s.target.value)
57
+ }
58
+ ),
59
+ /* @__PURE__ */ r.jsx(
60
+ o,
61
+ {
62
+ autoComplete: "off",
63
+ disabled: e.isLoading,
64
+ error: e.hasError("password"),
65
+ icon: "mdiLockOutline",
66
+ label: "password",
67
+ name: "password",
68
+ placeholder: "Enter your password",
69
+ required: !0,
70
+ type: "password",
71
+ value: e.data.password,
72
+ onChange: (s) => e.setData("password", s.target.value)
73
+ }
74
+ ),
75
+ e.hasErrors && /* @__PURE__ */ r.jsx(x, { icon: "mdiAlertCircleOutline", children: "username or password is wrong" }),
76
+ /* @__PURE__ */ r.jsx(
77
+ p,
78
+ {
79
+ disabled: e.isLoading,
80
+ fullWidth: !0,
81
+ isLoading: e.isLoading,
82
+ size: "md",
83
+ type: "submit",
84
+ variant: "primary",
85
+ children: e.isLoading ? "Signing in..." : "Sign In"
86
+ }
87
+ )
88
+ ] })
89
+ ] }) });
90
+ };
91
+ export {
92
+ y as OxLogin
93
+ };
@@ -0,0 +1,14 @@
1
+ import { default as default_2 } from 'react';
2
+ import { DocumentNode } from 'graphql';
3
+
4
+ export declare const OxLogin: default_2.FC<OxLoginProps>;
5
+
6
+ export declare interface OxLoginProps {
7
+ className?: string;
8
+ mutation?: DocumentNode;
9
+ onSubmit: (response: unknown) => void;
10
+ subtitle?: string;
11
+ title?: string;
12
+ }
13
+
14
+ export { }
@@ -0,0 +1,104 @@
1
+ @theme {
2
+ --font-sans: 'Inter', ui-sans-serif, system-ui, sans-serif;
3
+ --font-mono: 'JetBrains Mono', ui-monospace, monospace;
4
+
5
+ --color-zinc-1000: #09090b;
6
+
7
+ --container-8xl: 88rem;
8
+ --container-9xl: 96rem;
9
+ --container-10xl: 104rem;
10
+ --container-12xl: 120rem;
11
+ }
12
+
13
+ @layer components {
14
+ .default-border {
15
+ @apply border border-neutral-700 transition-colors duration-150;
16
+ }
17
+
18
+ .default-error-border {
19
+ @apply border !border-rose-400;
20
+ }
21
+
22
+ .default-outset-focus {
23
+ @apply focus:outline-none focus-visible:ring-2 focus-visible:ring-violet-700 focus-visible:ring-offset-1 focus-visible:ring-offset-zinc-900;
24
+ }
25
+
26
+ .default-inset-focus {
27
+ @apply focus:outline-none focus-visible:ring-2 focus-visible:ring-violet-700 focus-visible:ring-inset;
28
+ }
29
+
30
+ .secondary-outset-focus {
31
+ @apply focus:outline-none focus-visible:ring-2 focus-visible:ring-neutral-500 focus-visible:ring-offset-1 focus-visible:ring-offset-zinc-900;
32
+ }
33
+
34
+ .secondary-inset-focus {
35
+ @apply focus:outline-none focus-visible:ring-2 focus-visible:ring-neutral-500 focus-visible:ring-inset;
36
+ }
37
+
38
+ .default-disabled {
39
+ @apply disabled:cursor-not-allowed disabled:text-neutral-500 disabled:hover:bg-transparent disabled:focus-visible:ring-0;
40
+ }
41
+
42
+ * {
43
+ scrollbar-width: thin;
44
+ scrollbar-color: color-mix(in oklab, var(--color-white) 25%, transparent) transparent;
45
+ }
46
+
47
+ *::-webkit-scrollbar {
48
+ width: 12px;
49
+ }
50
+
51
+ *::-webkit-scrollbar-track {
52
+ background: transparent;
53
+ }
54
+
55
+ *::-webkit-scrollbar-thumb {
56
+ background-color: color-mix(in oklab, var(--color-white) 25%, transparent);
57
+ border-radius: 6px;
58
+ border: 3px solid transparent;
59
+ }
60
+
61
+ *::-webkit-scrollbar-thumb:hover {
62
+ background-color: color-mix(in oklab, var(--color-white) 40%, transparent);
63
+ }
64
+ }
65
+
66
+ @layer utilities {
67
+ @keyframes dropdownInBottom {
68
+ 0% {
69
+ opacity: 0;
70
+ transform: translateY(-4px);
71
+ }
72
+ 100% {
73
+ opacity: 1;
74
+ transform: translateY(0);
75
+ }
76
+ }
77
+
78
+ @keyframes dropdownInTop {
79
+ 0% {
80
+ opacity: 0;
81
+ transform: translateY(4px);
82
+ }
83
+ 100% {
84
+ opacity: 1;
85
+ transform: translateY(0);
86
+ }
87
+ }
88
+
89
+ .animate-dropdown-in-bottom {
90
+ animation: dropdownInBottom 150ms ease-out forwards;
91
+ }
92
+
93
+ .animate-dropdown-in-top {
94
+ animation: dropdownInTop 150ms ease-out forwards;
95
+ }
96
+ }
97
+
98
+ input:-webkit-autofill,
99
+ input:-webkit-autofill:hover,
100
+ input:-webkit-autofill:focus,
101
+ input:-webkit-autofill:active {
102
+ transition: background-color 5000s ease-in-out 0s;
103
+ -webkit-text-fill-color: white !important;
104
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@noxickon/onyx",
3
- "version": "0.0.1",
3
+ "version": "0.0.3",
4
4
  "type": "module",
5
5
  "main": "./dist/onyx.umd.js",
6
6
  "module": "./dist/onyx.es.js",
@@ -8,10 +8,27 @@
8
8
  "style": "./dist/onyx.css",
9
9
  "exports": {
10
10
  ".": {
11
- "import": "./dist/onyx.es.js",
12
- "require": "./dist/onyx.umd.js"
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/onyx.es.js"
13
13
  },
14
- "./styles": "./dist/onyx.css"
14
+ "./hooks": {
15
+ "types": "./dist/hooks.d.ts",
16
+ "import": "./dist/hooks/hooks.es.js"
17
+ },
18
+ "./pages": {
19
+ "types": "./dist/pages.d.ts",
20
+ "import": "./dist/pages/pages.es.js"
21
+ },
22
+ "./context": {
23
+ "types": "./dist/context.d.ts",
24
+ "import": "./dist/context/context.es.js"
25
+ },
26
+ "./layout": {
27
+ "types": "./dist/layout.d.ts",
28
+ "import": "./dist/layout/layout.es.js"
29
+ },
30
+ "./styles": "./dist/onyx.css",
31
+ "./shared": "./dist/shared.css"
15
32
  },
16
33
  "files": [
17
34
  "dist"
@@ -19,32 +36,38 @@
19
36
  "scripts": {
20
37
  "dev": "storybook dev -p 6006",
21
38
  "build": "tsc -b && vite build",
22
- "prepublishOnly": "npm run test && npm run build",
39
+ "prepublishOnly": "npm run test:coverage && npm run build",
23
40
  "lint": "eslint .",
24
41
  "preview": "vite preview",
25
- "build:storybook": "storybook build",
42
+ "build:storybook": "npm run build && storybook build",
26
43
  "preview:storybook": "vite preview --outDir storybook-static",
27
44
  "format": "prettier --write .",
28
45
  "test": "vitest run",
29
- "test:coverage": "vitest run --coverage"
46
+ "test:coverage": "vitest run --coverage",
47
+ "coverage:preview": "vite preview --outDir coverage"
30
48
  },
31
49
  "dependencies": {
50
+ "@apollo/client": "^3.13.8",
32
51
  "@mdi/js": "^7.4.47",
33
52
  "@mdi/react": "^1.6.1",
34
53
  "@tailwindcss/vite": "^4.1.7",
35
- "clsx": "^2.1.1",
54
+ "axios": "^1.10.0",
55
+ "es-toolkit": "^1.39.6",
56
+ "graphql": "^16.11.0",
36
57
  "react": "^19.1.0",
37
58
  "react-dom": "^19.1.0",
38
59
  "recharts": "^2.15.3",
39
- "tailwindcss": "^4.1.7"
60
+ "tailwind-merge": "^3.3.1",
61
+ "tailwindcss": "^4.1.7",
62
+ "zod": "^3.25.76"
40
63
  },
41
64
  "devDependencies": {
42
- "@chromatic-com/storybook": "^4.0.0",
65
+ "@chromatic-com/storybook": "^4.0.1",
43
66
  "@eslint/js": "^9.25.0",
44
- "@storybook/addon-docs": "^9.0.12",
45
- "@storybook/addon-onboarding": "^9.0.12",
46
- "@storybook/addon-vitest": "^9.0.12",
47
- "@storybook/react-vite": "^9.0.12",
67
+ "@storybook/addon-docs": "^9.0.18",
68
+ "@storybook/addon-onboarding": "^9.0.18",
69
+ "@storybook/addon-vitest": "^9.0.18",
70
+ "@storybook/react-vite": "^9.0.18",
48
71
  "@tailwindcss/typography": "^0.5.16",
49
72
  "@testing-library/jest-dom": "^6.6.3",
50
73
  "@testing-library/react": "^16.3.0",
@@ -58,10 +81,11 @@
58
81
  "@vitest/coverage-v8": "^3.1.4",
59
82
  "canvas": "^3.1.0",
60
83
  "eslint": "^9.25.0",
84
+ "eslint-plugin-perfectionist": "^4.15.0",
61
85
  "eslint-plugin-react-hooks": "^5.2.0",
62
86
  "eslint-plugin-react-refresh": "^0.4.19",
63
87
  "eslint-plugin-sort-destructure-keys": "^2.0.0",
64
- "eslint-plugin-storybook": "^9.0.12",
88
+ "eslint-plugin-storybook": "^9.0.18",
65
89
  "eslint-plugin-unused-imports": "^4.1.4",
66
90
  "globals": "^16.0.0",
67
91
  "jest-axe": "^10.0.0",
@@ -69,7 +93,7 @@
69
93
  "playwright": "^1.52.0",
70
94
  "prettier": "^3.5.3",
71
95
  "prettier-plugin-tailwindcss": "^0.6.11",
72
- "storybook": "^9.0.12",
96
+ "storybook": "^9.0.18",
73
97
  "typescript": "~5.8.3",
74
98
  "typescript-eslint": "^8.30.1",
75
99
  "vite": "^6.3.5",