@nomos-ui/core 0.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 ADDED
@@ -0,0 +1,3 @@
1
+ # Nomos UI Core
2
+
3
+ > **νόμος** (nomos) - Greek: law, order, principle
@@ -0,0 +1,38 @@
1
+ import { ReactNode } from "react";
2
+ /**
3
+ * Configuration for custom Link components to support different routing systems
4
+ *
5
+ * @property component - The Link component to render (e.g., Next.js Link, React Router Link)
6
+ * @property hrefKey - The prop name used for the URL path (defaults to "href")
7
+ *
8
+ * @example
9
+ * // Next.js Link (uses "href")
10
+ * { component: NextLink, hrefKey: "href" }
11
+ *
12
+ * @example
13
+ * // React Router Link (uses "to")
14
+ * { component: RouterLink, hrefKey: "to" }
15
+ *
16
+ * @default
17
+ * - component: <a> (HTML anchor tag)
18
+ * - hrefKey: "href"
19
+ */
20
+ export type LinkConfig = {
21
+ component: ReactNode;
22
+ hrefKey?: string;
23
+ };
24
+ export type ProviderContext = {
25
+ children: React.ReactNode;
26
+ components?: {
27
+ Link?: ReactNode | LinkConfig;
28
+ };
29
+ };
30
+ export declare const ProviderContext: import("react").Context<Omit<ProviderContext, "children">>;
31
+ /**
32
+ * Provider component that supplies context for customizable UI components.
33
+ *
34
+ * @param children - Child components that will have access to the provider context
35
+ * @param components.Link - Optional custom Link component configuration
36
+ */
37
+ export default function Provider({ children, ...props }: ProviderContext): import("react/jsx-runtime").JSX.Element;
38
+ //# sourceMappingURL=provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../src/components/provider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiB,SAAS,EAAE,MAAM,OAAO,CAAC;AAEjD;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB,SAAS,EAAE,SAAS,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,UAAU,CAAC,EAAE;QACX,IAAI,CAAC,EAAE,SAAS,GAAG,UAAU,CAAC;KAC/B,CAAC;CACH,CAAC;AAEF,eAAO,MAAM,eAAe,4DAE3B,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,eAAe,2CAMvE"}
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ProviderContext = void 0;
4
+ exports.default = Provider;
5
+ const jsx_runtime_1 = require("react/jsx-runtime");
6
+ const react_1 = require("react");
7
+ exports.ProviderContext = (0, react_1.createContext)({});
8
+ /**
9
+ * Provider component that supplies context for customizable UI components.
10
+ *
11
+ * @param children - Child components that will have access to the provider context
12
+ * @param components.Link - Optional custom Link component configuration
13
+ */
14
+ function Provider({ children, ...props }) {
15
+ return ((0, jsx_runtime_1.jsx)(exports.ProviderContext.Provider, { value: { ...props }, children: children }));
16
+ }
17
+ //# sourceMappingURL=provider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"provider.js","sourceRoot":"","sources":["../../src/components/provider.tsx"],"names":[],"mappings":";;;AA0CA,2BAMC;;AAhDD,iCAAiD;AAgCpC,QAAA,eAAe,GAAG,IAAA,qBAAa,EAC1C,EAAE,CACH,CAAC;AAEF;;;;;GAKG;AACH,SAAwB,QAAQ,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAmB;IACtE,OAAO,CACL,uBAAC,uBAAe,CAAC,QAAQ,IAAC,KAAK,EAAE,EAAE,GAAG,KAAK,EAAE,YAC1C,QAAQ,GACgB,CAC5B,CAAC;AACJ,CAAC"}
@@ -0,0 +1,4 @@
1
+ import Provider, { ProviderContext } from "../components/provider";
2
+ import { useProvider } from "../hooks/use-provider";
3
+ export { Provider, ProviderContext, useProvider };
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/exports/index.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,EAAE,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEpD,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,WAAW,EAAE,CAAC"}
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.useProvider = exports.ProviderContext = exports.Provider = void 0;
37
+ const provider_1 = __importStar(require("../components/provider"));
38
+ exports.Provider = provider_1.default;
39
+ Object.defineProperty(exports, "ProviderContext", { enumerable: true, get: function () { return provider_1.ProviderContext; } });
40
+ const use_provider_1 = require("../hooks/use-provider");
41
+ Object.defineProperty(exports, "useProvider", { enumerable: true, get: function () { return use_provider_1.useProvider; } });
42
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/exports/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mEAAmE;AAG1D,mBAHF,kBAAQ,CAGE;AAAE,gGAHA,0BAAe,OAGA;AAFlC,wDAAoD;AAEhB,4FAF3B,0BAAW,OAE2B"}
@@ -0,0 +1,21 @@
1
+ import { LinkConfig } from "../components/provider";
2
+ /**
3
+ * Hook to access the provider context for customizable components
4
+ *
5
+ * @returns The provider context containing component configurations with defaults applied
6
+ *
7
+ * @example
8
+ * const { components } = useProvider();
9
+ * // components.Link defaults to "a" if not provided
10
+ *
11
+ * @throws {Error} If used outside of Provider
12
+ */
13
+ export declare function useProvider(): {
14
+ components: {
15
+ Link: {
16
+ component: string | number | bigint | true | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<import("react").ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<import("react").ReactNode> | null | undefined> | LinkConfig;
17
+ hrefKey: string;
18
+ };
19
+ };
20
+ };
21
+ //# sourceMappingURL=use-provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-provider.d.ts","sourceRoot":"","sources":["../../src/hooks/use-provider.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAmB,MAAM,wBAAwB,CAAC;AAErE;;;;;;;;;;GAUG;AACH,wBAAgB,WAAW;;;;;;;EAwB1B"}
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useProvider = useProvider;
4
+ const react_1 = require("react");
5
+ const provider_1 = require("../components/provider");
6
+ /**
7
+ * Hook to access the provider context for customizable components
8
+ *
9
+ * @returns The provider context containing component configurations with defaults applied
10
+ *
11
+ * @example
12
+ * const { components } = useProvider();
13
+ * // components.Link defaults to "a" if not provided
14
+ *
15
+ * @throws {Error} If used outside of Provider
16
+ */
17
+ function useProvider() {
18
+ const context = (0, react_1.useContext)(provider_1.ProviderContext);
19
+ if (!context) {
20
+ throw new Error("useProvider must be used within a Provider");
21
+ }
22
+ return {
23
+ ...context,
24
+ components: {
25
+ ...context.components,
26
+ Link: context?.components?.Link?.component
27
+ ? {
28
+ component: context?.components?.Link?.component || "a",
29
+ hrefKey: context?.components?.Link?.hrefKey || "href",
30
+ }
31
+ : {
32
+ component: context?.components?.Link || "a",
33
+ hrefKey: "href",
34
+ },
35
+ },
36
+ };
37
+ }
38
+ //# sourceMappingURL=use-provider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-provider.js","sourceRoot":"","sources":["../../src/hooks/use-provider.tsx"],"names":[],"mappings":";;AAcA,kCAwBC;AAtCD,iCAAmC;AACnC,qDAAqE;AAErE;;;;;;;;;;GAUG;AACH,SAAgB,WAAW;IACzB,MAAM,OAAO,GAAG,IAAA,kBAAU,EAAC,0BAAe,CAAC,CAAC;IAE5C,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;IAChE,CAAC;IAED,OAAO;QACL,GAAG,OAAO;QACV,UAAU,EAAE;YACV,GAAG,OAAO,CAAC,UAAU;YACrB,IAAI,EAAG,OAAO,EAAE,UAAU,EAAE,IAAmB,EAAE,SAAS;gBACxD,CAAC,CAAC;oBACE,SAAS,EACN,OAAO,EAAE,UAAU,EAAE,IAAmB,EAAE,SAAS,IAAI,GAAG;oBAC7D,OAAO,EACJ,OAAO,EAAE,UAAU,EAAE,IAAmB,EAAE,OAAO,IAAI,MAAM;iBAC/D;gBACH,CAAC,CAAC;oBACE,SAAS,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,IAAI,GAAG;oBAC3C,OAAO,EAAE,MAAM;iBAChB;SACN;KACF,CAAC;AACJ,CAAC"}
package/package.json ADDED
@@ -0,0 +1,112 @@
1
+ {
2
+ "name": "@nomos-ui/core",
3
+ "version": "0.0.1",
4
+ "description": "The Shadcn library for building robust React layouts",
5
+ "main": "dist/index.js",
6
+ "module": "dist/exports/index.js",
7
+ "types": "dist/exports/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/exports/index.d.ts",
11
+ "import": "./dist/exports/index.js",
12
+ "require": "./dist/exports/index.js"
13
+ },
14
+ "./types": {
15
+ "types": "./dist/exports/types/index.d.ts",
16
+ "import": "./dist/exports/types/index.js",
17
+ "require": "./dist/exports/types/index.js"
18
+ }
19
+ },
20
+ "typesVersions": {
21
+ "*": {
22
+ "dashboard": ["./dist/exports/dashboard/index.d.ts"],
23
+ "types": ["./dist/types/index.d.ts"]
24
+ }
25
+ },
26
+ "scripts": {
27
+ "build": "trash dist && tsc",
28
+ "dev": "tsc --watch",
29
+ "clean": "rm -rf dist",
30
+ "lint": "eslint src --ext .ts,.tsx",
31
+ "type-check": "tsc --noEmit",
32
+ "test": "vitest",
33
+ "test:watch": "vitest --watch",
34
+ "test:ui": "vitest --ui",
35
+ "test:coverage": "vitest --coverage",
36
+ "prepublishOnly": "pnpm run build"
37
+ },
38
+ "keywords": [
39
+ "react",
40
+ "react-hook-form",
41
+ "form",
42
+ "forms",
43
+ "validation",
44
+ "components",
45
+ "ui",
46
+ "input",
47
+ "select",
48
+ "checkbox",
49
+ "accessible",
50
+ "a11y",
51
+ "tailwind",
52
+ "typescript",
53
+ "nomos"
54
+ ],
55
+ "author": "Uanela Como",
56
+ "license": "MIT",
57
+ "repository": {
58
+ "type": "git",
59
+ "url": "git+https://github.com/uanela/nomos-ui.git",
60
+ "directory": "packages/layout"
61
+ },
62
+ "bugs": {
63
+ "url": "https://github.com/uanela/nomos-ui/issues"
64
+ },
65
+ "homepage": "https://github.com/uanela/nomos-ui",
66
+ "files": ["dist", "README.md", "LICENSE"],
67
+ "sideEffects": false,
68
+ "packageManager": "pnpm@10.13.1",
69
+ "dependencies": {},
70
+ "devDependencies": {
71
+ "@types/react": "^19.2.2",
72
+ "@types/react-dom": "^19.2.0",
73
+ "@typescript-eslint/eslint-plugin": "^6.0.0",
74
+ "@typescript-eslint/parser": "^6.0.0",
75
+ "eslint": "^8.56.0",
76
+ "eslint-plugin-react": "^7.33.2",
77
+ "eslint-plugin-react-hooks": "^4.6.0",
78
+ "tailwindcss": "^4.1.16",
79
+ "trash-cli": "^7.0.0",
80
+ "tsx": "^4.20.3",
81
+ "typescript": "^5.9.3",
82
+ "vitest": "^4.0.3"
83
+ },
84
+ "peerDependencies": {
85
+ "react": "^18.0.0 || ^19.0.0",
86
+ "react-dom": "^18.0.0 || ^19.0.0",
87
+ "react-hook-form": "^7.0.0",
88
+ "@tailwindcss/postcss": "^4.1.16",
89
+ "@tailwindcss/vite": "^4.1.16",
90
+ "class-variance-authority": "^0.7.1",
91
+ "clsx": "^2.1.1",
92
+ "lucide-react": "^0.548.0",
93
+ "tailwind-merge": "^3.5.0"
94
+ },
95
+ "peerDependenciesMeta": {
96
+ "react": {
97
+ "optional": false
98
+ },
99
+ "react-dom": {
100
+ "optional": false
101
+ },
102
+ "react-hook-form": {
103
+ "optional": false
104
+ }
105
+ },
106
+ "engines": {
107
+ "node": ">=18.0.0"
108
+ },
109
+ "publishConfig": {
110
+ "access": "public"
111
+ }
112
+ }