cite-ui 0.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.
@@ -0,0 +1,155 @@
1
+ import { jsxs as s, jsx as e, Fragment as h } from "react/jsx-runtime";
2
+ import { useState as d } from "react";
3
+ const b = ({ logo: a, links: n = [], ctaLabel: l, ctaHref: t }) => {
4
+ const [c, o] = d(!1);
5
+ return /* @__PURE__ */ s("nav", { className: "sticky top-0 z-50 bg-white border-b border-gray-200", children: [
6
+ /* @__PURE__ */ e("div", { className: "max-w-7xl mx-auto px-4 sm:px-6 lg:px-8", children: /* @__PURE__ */ s("div", { className: "flex items-center justify-between h-16", children: [
7
+ /* @__PURE__ */ e("div", { className: "text-xl font-bold tracking-tight", children: a }),
8
+ /* @__PURE__ */ e("div", { className: "hidden md:flex items-center gap-8", children: n.map((r, i) => /* @__PURE__ */ e(
9
+ "a",
10
+ {
11
+ href: r.href,
12
+ className: "text-gray-600 hover:text-black transition-colors",
13
+ children: r.label
14
+ },
15
+ i
16
+ )) }),
17
+ /* @__PURE__ */ s("div", { className: "flex items-center gap-4", children: [
18
+ l && t && /* @__PURE__ */ e(
19
+ "a",
20
+ {
21
+ href: t,
22
+ className: "hidden md:inline-block bg-black text-white rounded-lg px-5 py-2 text-sm font-medium hover:bg-gray-800 transition-colors",
23
+ children: l
24
+ }
25
+ ),
26
+ /* @__PURE__ */ e(
27
+ "button",
28
+ {
29
+ onClick: () => o((r) => !r),
30
+ className: "md:hidden p-2 rounded-md text-gray-600 hover:text-black",
31
+ "aria-label": "Toggle menu",
32
+ children: /* @__PURE__ */ e(
33
+ "svg",
34
+ {
35
+ className: "w-6 h-6",
36
+ fill: "none",
37
+ stroke: "currentColor",
38
+ viewBox: "0 0 24 24",
39
+ children: c ? /* @__PURE__ */ e(
40
+ "path",
41
+ {
42
+ strokeLinecap: "round",
43
+ strokeLinejoin: "round",
44
+ strokeWidth: 2,
45
+ d: "M6 18L18 6M6 6l12 12"
46
+ }
47
+ ) : /* @__PURE__ */ e(
48
+ "path",
49
+ {
50
+ strokeLinecap: "round",
51
+ strokeLinejoin: "round",
52
+ strokeWidth: 2,
53
+ d: "M4 6h16M4 12h16M4 18h16"
54
+ }
55
+ )
56
+ }
57
+ )
58
+ }
59
+ )
60
+ ] })
61
+ ] }) }),
62
+ c && /* @__PURE__ */ s("div", { className: "md:hidden border-t border-gray-200 px-4 pb-4 pt-2 space-y-3", children: [
63
+ n.map((r, i) => /* @__PURE__ */ e(
64
+ "a",
65
+ {
66
+ href: r.href,
67
+ className: "block text-gray-600 hover:text-black transition-colors",
68
+ children: r.label
69
+ },
70
+ i
71
+ )),
72
+ l && t && /* @__PURE__ */ e(
73
+ "a",
74
+ {
75
+ href: t,
76
+ className: "block text-center bg-black text-white rounded-lg px-5 py-2 text-sm font-medium hover:bg-gray-800 transition-colors",
77
+ children: l
78
+ }
79
+ )
80
+ ] })
81
+ ] });
82
+ }, m = {
83
+ primary: "bg-black text-white rounded-lg px-6 py-3",
84
+ secondary: "bg-transparent border border-black text-black rounded-lg px-6 py-3",
85
+ whatsapp: "bg-[#25D366] text-white rounded-lg px-6 py-3"
86
+ }, u = ({ variant: a = "primary", label: n, onClick: l, className: t = "" }) => /* @__PURE__ */ s(
87
+ "button",
88
+ {
89
+ onClick: l,
90
+ className: `${m[a]} ${t}`,
91
+ children: [
92
+ a === "whatsapp" && /* @__PURE__ */ e("span", { children: "💬 " }),
93
+ n
94
+ ]
95
+ }
96
+ ), g = {
97
+ 1: "lg:grid-cols-1",
98
+ 2: "lg:grid-cols-2",
99
+ 3: "lg:grid-cols-3",
100
+ 4: "lg:grid-cols-4",
101
+ 5: "lg:grid-cols-5",
102
+ 6: "lg:grid-cols-6"
103
+ }, k = ({ images: a = [], columns: n = 3, gap: l = 4 }) => {
104
+ const [t, c] = d(null);
105
+ return /* @__PURE__ */ s(h, { children: [
106
+ /* @__PURE__ */ e(
107
+ "div",
108
+ {
109
+ className: `grid grid-cols-1 sm:grid-cols-2 ${g[n] || ""}`,
110
+ style: { gap: `${l * 0.25}rem` },
111
+ children: a.map((o, r) => /* @__PURE__ */ e(
112
+ "img",
113
+ {
114
+ src: o.src,
115
+ alt: o.alt,
116
+ className: "w-full h-64 object-cover rounded-lg cursor-pointer",
117
+ onClick: () => c(o)
118
+ },
119
+ r
120
+ ))
121
+ }
122
+ ),
123
+ t && /* @__PURE__ */ s(
124
+ "div",
125
+ {
126
+ className: "fixed inset-0 z-50 bg-black/80 flex items-center justify-center",
127
+ onClick: () => c(null),
128
+ children: [
129
+ /* @__PURE__ */ e(
130
+ "button",
131
+ {
132
+ className: "absolute top-4 right-4 text-white text-4xl leading-none hover:opacity-70",
133
+ onClick: () => c(null),
134
+ children: "×"
135
+ }
136
+ ),
137
+ /* @__PURE__ */ e(
138
+ "img",
139
+ {
140
+ src: t.src,
141
+ alt: t.alt,
142
+ className: "max-w-[90vw] max-h-[90vh] object-contain rounded-lg",
143
+ onClick: (o) => o.stopPropagation()
144
+ }
145
+ )
146
+ ]
147
+ }
148
+ )
149
+ ] });
150
+ };
151
+ export {
152
+ u as Button,
153
+ k as Gallery,
154
+ b as Navbar
155
+ };
@@ -0,0 +1 @@
1
+ (function(r,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("react/jsx-runtime"),require("react")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react"],e):(r=typeof globalThis<"u"?globalThis:r||self,e(r.CiteUI={},r.ReactJsxRuntime,r.React))})(this,function(r,e,i){"use strict";const h=({logo:o,links:c=[],ctaLabel:s,ctaHref:t})=>{const[d,a]=i.useState(!1);return e.jsxs("nav",{className:"sticky top-0 z-50 bg-white border-b border-gray-200",children:[e.jsx("div",{className:"max-w-7xl mx-auto px-4 sm:px-6 lg:px-8",children:e.jsxs("div",{className:"flex items-center justify-between h-16",children:[e.jsx("div",{className:"text-xl font-bold tracking-tight",children:o}),e.jsx("div",{className:"hidden md:flex items-center gap-8",children:c.map((l,n)=>e.jsx("a",{href:l.href,className:"text-gray-600 hover:text-black transition-colors",children:l.label},n))}),e.jsxs("div",{className:"flex items-center gap-4",children:[s&&t&&e.jsx("a",{href:t,className:"hidden md:inline-block bg-black text-white rounded-lg px-5 py-2 text-sm font-medium hover:bg-gray-800 transition-colors",children:s}),e.jsx("button",{onClick:()=>a(l=>!l),className:"md:hidden p-2 rounded-md text-gray-600 hover:text-black","aria-label":"Toggle menu",children:e.jsx("svg",{className:"w-6 h-6",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:d?e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"}):e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 6h16M4 12h16M4 18h16"})})})]})]})}),d&&e.jsxs("div",{className:"md:hidden border-t border-gray-200 px-4 pb-4 pt-2 space-y-3",children:[c.map((l,n)=>e.jsx("a",{href:l.href,className:"block text-gray-600 hover:text-black transition-colors",children:l.label},n)),s&&t&&e.jsx("a",{href:t,className:"block text-center bg-black text-white rounded-lg px-5 py-2 text-sm font-medium hover:bg-gray-800 transition-colors",children:s})]})]})},g={primary:"bg-black text-white rounded-lg px-6 py-3",secondary:"bg-transparent border border-black text-black rounded-lg px-6 py-3",whatsapp:"bg-[#25D366] text-white rounded-lg px-6 py-3"},p=({variant:o="primary",label:c,onClick:s,className:t=""})=>e.jsxs("button",{onClick:s,className:`${g[o]} ${t}`,children:[o==="whatsapp"&&e.jsx("span",{children:"💬 "}),c]}),x={1:"lg:grid-cols-1",2:"lg:grid-cols-2",3:"lg:grid-cols-3",4:"lg:grid-cols-4",5:"lg:grid-cols-5",6:"lg:grid-cols-6"},b=({images:o=[],columns:c=3,gap:s=4})=>{const[t,d]=i.useState(null);return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:`grid grid-cols-1 sm:grid-cols-2 ${x[c]||""}`,style:{gap:`${s*.25}rem`},children:o.map((a,l)=>e.jsx("img",{src:a.src,alt:a.alt,className:"w-full h-64 object-cover rounded-lg cursor-pointer",onClick:()=>d(a)},l))}),t&&e.jsxs("div",{className:"fixed inset-0 z-50 bg-black/80 flex items-center justify-center",onClick:()=>d(null),children:[e.jsx("button",{className:"absolute top-4 right-4 text-white text-4xl leading-none hover:opacity-70",onClick:()=>d(null),children:"×"}),e.jsx("img",{src:t.src,alt:t.alt,className:"max-w-[90vw] max-h-[90vh] object-contain rounded-lg",onClick:a=>a.stopPropagation()})]})]})};r.Button=p,r.Gallery=b,r.Navbar=h,Object.defineProperty(r,Symbol.toStringTag,{value:"Module"})});
package/package.json ADDED
@@ -0,0 +1,32 @@
1
+ {
2
+ "name": "cite-ui",
3
+ "version": "0.1.0",
4
+ "type": "module",
5
+ "main": "dist/cite-ui.umd.js",
6
+ "module": "dist/cite-ui.es.js",
7
+ "exports": {
8
+ ".": {
9
+ "import": "./dist/cite-ui.es.js",
10
+ "require": "./dist/cite-ui.umd.js"
11
+ }
12
+ },
13
+ "files": ["dist", "src"],
14
+ "scripts": {
15
+ "dev": "vite",
16
+ "build": "vite build",
17
+ "preview": "vite preview"
18
+ },
19
+ "peerDependencies": {
20
+ "react": "^18.0.0",
21
+ "react-dom": "^18.0.0"
22
+ },
23
+ "devDependencies": {
24
+ "react": "^18.3.1",
25
+ "react-dom": "^18.3.1",
26
+ "@vitejs/plugin-react": "^4.3.4",
27
+ "autoprefixer": "^10.4.20",
28
+ "postcss": "^8.5.3",
29
+ "tailwindcss": "^3.4.17",
30
+ "vite": "^5.4.19"
31
+ }
32
+ }
@@ -0,0 +1,19 @@
1
+ const variantStyles = {
2
+ primary: 'bg-black text-white rounded-lg px-6 py-3',
3
+ secondary: 'bg-transparent border border-black text-black rounded-lg px-6 py-3',
4
+ whatsapp: 'bg-[#25D366] text-white rounded-lg px-6 py-3',
5
+ }
6
+
7
+ const Button = ({ variant = 'primary', label, onClick, className = '' }) => {
8
+ return (
9
+ <button
10
+ onClick={onClick}
11
+ className={`${variantStyles[variant]} ${className}`}
12
+ >
13
+ {variant === 'whatsapp' && <span>💬 </span>}
14
+ {label}
15
+ </button>
16
+ )
17
+ }
18
+
19
+ export default Button
@@ -0,0 +1,55 @@
1
+ import { useState } from 'react'
2
+
3
+ const colMap = {
4
+ 1: 'lg:grid-cols-1',
5
+ 2: 'lg:grid-cols-2',
6
+ 3: 'lg:grid-cols-3',
7
+ 4: 'lg:grid-cols-4',
8
+ 5: 'lg:grid-cols-5',
9
+ 6: 'lg:grid-cols-6',
10
+ }
11
+
12
+ const Gallery = ({ images = [], columns = 3, gap = 4 }) => {
13
+ const [selected, setSelected] = useState(null)
14
+
15
+ return (
16
+ <>
17
+ <div
18
+ className={`grid grid-cols-1 sm:grid-cols-2 ${colMap[columns] || ''}`}
19
+ style={{ gap: `${gap * 0.25}rem` }}
20
+ >
21
+ {images.map((img, i) => (
22
+ <img
23
+ key={i}
24
+ src={img.src}
25
+ alt={img.alt}
26
+ className="w-full h-64 object-cover rounded-lg cursor-pointer"
27
+ onClick={() => setSelected(img)}
28
+ />
29
+ ))}
30
+ </div>
31
+
32
+ {selected && (
33
+ <div
34
+ className="fixed inset-0 z-50 bg-black/80 flex items-center justify-center"
35
+ onClick={() => setSelected(null)}
36
+ >
37
+ <button
38
+ className="absolute top-4 right-4 text-white text-4xl leading-none hover:opacity-70"
39
+ onClick={() => setSelected(null)}
40
+ >
41
+ &times;
42
+ </button>
43
+ <img
44
+ src={selected.src}
45
+ alt={selected.alt}
46
+ className="max-w-[90vw] max-h-[90vh] object-contain rounded-lg"
47
+ onClick={(e) => e.stopPropagation()}
48
+ />
49
+ </div>
50
+ )}
51
+ </>
52
+ )
53
+ }
54
+
55
+ export default Gallery
@@ -0,0 +1,91 @@
1
+ import { useState } from 'react'
2
+
3
+ const Navbar = ({ logo, links = [], ctaLabel, ctaHref }) => {
4
+ const [open, setOpen] = useState(false)
5
+
6
+ return (
7
+ <nav className="sticky top-0 z-50 bg-white border-b border-gray-200">
8
+ <div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
9
+ <div className="flex items-center justify-between h-16">
10
+ <div className="text-xl font-bold tracking-tight">{logo}</div>
11
+
12
+ <div className="hidden md:flex items-center gap-8">
13
+ {links.map((link, i) => (
14
+ <a
15
+ key={i}
16
+ href={link.href}
17
+ className="text-gray-600 hover:text-black transition-colors"
18
+ >
19
+ {link.label}
20
+ </a>
21
+ ))}
22
+ </div>
23
+
24
+ <div className="flex items-center gap-4">
25
+ {ctaLabel && ctaHref && (
26
+ <a
27
+ href={ctaHref}
28
+ className="hidden md:inline-block bg-black text-white rounded-lg px-5 py-2 text-sm font-medium hover:bg-gray-800 transition-colors"
29
+ >
30
+ {ctaLabel}
31
+ </a>
32
+ )}
33
+
34
+ <button
35
+ onClick={() => setOpen((v) => !v)}
36
+ className="md:hidden p-2 rounded-md text-gray-600 hover:text-black"
37
+ aria-label="Toggle menu"
38
+ >
39
+ <svg
40
+ className="w-6 h-6"
41
+ fill="none"
42
+ stroke="currentColor"
43
+ viewBox="0 0 24 24"
44
+ >
45
+ {open ? (
46
+ <path
47
+ strokeLinecap="round"
48
+ strokeLinejoin="round"
49
+ strokeWidth={2}
50
+ d="M6 18L18 6M6 6l12 12"
51
+ />
52
+ ) : (
53
+ <path
54
+ strokeLinecap="round"
55
+ strokeLinejoin="round"
56
+ strokeWidth={2}
57
+ d="M4 6h16M4 12h16M4 18h16"
58
+ />
59
+ )}
60
+ </svg>
61
+ </button>
62
+ </div>
63
+ </div>
64
+ </div>
65
+
66
+ {open && (
67
+ <div className="md:hidden border-t border-gray-200 px-4 pb-4 pt-2 space-y-3">
68
+ {links.map((link, i) => (
69
+ <a
70
+ key={i}
71
+ href={link.href}
72
+ className="block text-gray-600 hover:text-black transition-colors"
73
+ >
74
+ {link.label}
75
+ </a>
76
+ ))}
77
+ {ctaLabel && ctaHref && (
78
+ <a
79
+ href={ctaHref}
80
+ className="block text-center bg-black text-white rounded-lg px-5 py-2 text-sm font-medium hover:bg-gray-800 transition-colors"
81
+ >
82
+ {ctaLabel}
83
+ </a>
84
+ )}
85
+ </div>
86
+ )}
87
+ </nav>
88
+ )
89
+ }
90
+
91
+ export default Navbar
package/src/index.jsx ADDED
@@ -0,0 +1,3 @@
1
+ export { default as Navbar } from './components/Navbar'
2
+ export { default as Button } from './components/Button'
3
+ export { default as Gallery } from './components/Gallery'
package/src/styles.css ADDED
@@ -0,0 +1,3 @@
1
+ @tailwind base;
2
+ @tailwind components;
3
+ @tailwind utilities;