@ed.yakovich/example-component-library--molecules--nav 1.0.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.
@@ -0,0 +1,49 @@
1
+ import { jsx as t } from "react/jsx-runtime";
2
+ import { createContext as $, useContext as C } from "react";
3
+ import { Link as H } from "@tanstack/react-router";
4
+ const P = $({}), T = () => C(P), w = (n) => {
5
+ const { isHidden: a, componentId: l = "", children: i, display: r = "solid", size: u = "md", className: p = "", disabled: s = !1, href: o = "", target: b = "_self", buttonType: m = "button" } = n, c = T(), h = c == null ? void 0 : c.isHidden, f = () => ({
6
+ isHiddenVal: h || a
7
+ }), { isHiddenVal: x } = f(), y = (e) => /* @__PURE__ */ t((d) => e.actionType === "button" ? /* @__PURE__ */ t("button", { "data-nested-type": "button", className: e.className, disabled: s, type: m, ...(e == null ? void 0 : e.onClick) && { onClick: e.onClick }, children: d.children }) : e.actionType === "internal" ? /* @__PURE__ */ t(H, { "data-nested-type": "internal", className: e.className, disabled: s, to: o, ...(e == null ? void 0 : e.activeProps) && { activeProps: e == null ? void 0 : e.activeProps }, children: d.children }) : /* @__PURE__ */ t("a", { "data-nested-type": "anchor", className: e.className, href: o, target: b, children: d.children }), { ...e, children: e.children }), N = () => {
8
+ switch (r) {
9
+ case "link":
10
+ return "hover:underline text-blue-500";
11
+ case "outline":
12
+ return "text-blue-500 font-bold rounded-full border-solid border-3 border-blue-500";
13
+ default:
14
+ return "text-white font-bold rounded-full bg-blue-500";
15
+ }
16
+ }, v = () => {
17
+ if (r === "link") return "text-base";
18
+ switch (u) {
19
+ case "lg":
20
+ return "text-xl py-3 px-6";
21
+ case "sm":
22
+ return "text-xs";
23
+ default:
24
+ return "text-base py-2 px-4";
25
+ }
26
+ }, g = () => s ? "cursor-default opacity-50" : "cursor-pointer", k = {
27
+ ...n,
28
+ "data-component-id": l || "Button",
29
+ className: `${N()} ${v()} ${p || ""} ${g()}`
30
+ };
31
+ return x ? null : /* @__PURE__ */ t(y, { ...k, children: i });
32
+ }, B = (n) => {
33
+ const { pages: a } = n;
34
+ return /* @__PURE__ */ t("nav", { "data-component-id": "Nav", className: "p-6", children: /* @__PURE__ */ t("div", { className: "flex justify-center gap-4", children: a.map(({ name: l, url: i }, r) => /* @__PURE__ */ t("div", { children: /* @__PURE__ */ t(
35
+ w,
36
+ {
37
+ actionType: "internal",
38
+ display: "link",
39
+ size: "sm",
40
+ href: i,
41
+ activeProps: { className: "font-bold border-blue-500 border-3 rounded-md" },
42
+ className: "py-1 px-2 text-blue-500",
43
+ children: /* @__PURE__ */ t("strong", { children: l })
44
+ }
45
+ ) }, `${l}-${r}`)) }) });
46
+ };
47
+ export {
48
+ B as Nav
49
+ };
@@ -0,0 +1,7 @@
1
+ export type NavType = {
2
+ pages: {
3
+ name: string;
4
+ url: string;
5
+ }[];
6
+ };
7
+ export declare const Nav: (props: NavType) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ export { Nav } from './component';
2
+ export type { NavType } from './component';
package/dist/main.js ADDED
@@ -0,0 +1,4 @@
1
+ import { Nav as a } from "./component/index.js";
2
+ export {
3
+ a as Nav
4
+ };
package/package.json ADDED
@@ -0,0 +1,49 @@
1
+ {
2
+ "name": "@ed.yakovich/example-component-library--molecules--nav",
3
+ "author": "Ed Yakovich",
4
+ "private": false,
5
+ "version": "1.0.0",
6
+ "type": "module",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./dist/lib/main.d.ts",
10
+ "default": "./dist/main.js"
11
+ }
12
+ },
13
+ "files": [
14
+ "dist"
15
+ ],
16
+ "sideEffects": [
17
+ "**/*.css"
18
+ ],
19
+ "scripts": {
20
+ "dev": "vite",
21
+ "build": "tsc -b ./tsconfig.lib.json && vite build",
22
+ "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
23
+ "preview": "vite preview"
24
+ },
25
+ "peerDependencies": {
26
+ "react": "^18.0.0 || ^19.0.0",
27
+ "react-dom": "^18.0.0 || ^19.0.0"
28
+ },
29
+ "devDependencies": {
30
+ "@types/node": "^22.5.4",
31
+ "@types/react": "^18.3.5",
32
+ "@types/react-dom": "^18.3.0",
33
+ "@typescript-eslint/eslint-plugin": "^7.18.0",
34
+ "@typescript-eslint/parser": "^7.18.0",
35
+ "@vitejs/plugin-react": "^4.3.1",
36
+ "ajv": "^8.17.1",
37
+ "eslint": "^8.57.0",
38
+ "eslint-plugin-react-hooks": "^4.6.2",
39
+ "eslint-plugin-react-refresh": "^0.4.11",
40
+ "glob": "^11.0.0",
41
+ "react": "^18.3.1",
42
+ "react-dom": "^18.3.1",
43
+ "typescript": "^5.6.2",
44
+ "vite": "^5.4.4",
45
+ "vite-plugin-dts": "^4.2.1",
46
+ "vite-plugin-lib-inject-css": "^2.1.1",
47
+ "@ed.yakovich/example-component-library--atoms--button": "^1.0.0"
48
+ }
49
+ }