@alanas/ui 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 +62 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.js +78 -0
- package/dist/index.js.map +1 -0
- package/package.json +50 -0
package/README.md
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# @alanas/ui
|
|
2
|
+
|
|
3
|
+
React UI components built with **TypeScript** and **Tailwind CSS v4** utility classes. Designed for use in Next.js, Vite, or any React app that uses Tailwind v4.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @alanas/ui
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Peer dependencies (you must have these in your app):
|
|
12
|
+
|
|
13
|
+
- `react` ^18 or ^19
|
|
14
|
+
- `react-dom` ^18 or ^19
|
|
15
|
+
- `tailwindcss` ^4
|
|
16
|
+
|
|
17
|
+
## Tailwind v4 setup (required)
|
|
18
|
+
|
|
19
|
+
This package does not bundle Tailwind. Your app must use **Tailwind CSS v4** and tell it to scan this package so the component classes are included.
|
|
20
|
+
|
|
21
|
+
In your main CSS file (e.g. `globals.css` or `app.css`), add:
|
|
22
|
+
|
|
23
|
+
```css
|
|
24
|
+
@import "tailwindcss";
|
|
25
|
+
|
|
26
|
+
/* So Tailwind includes this package's classes */
|
|
27
|
+
@source "../node_modules/@alanas/ui/dist";
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Adjust the `@source` path so it points to `node_modules/@alanas/ui/dist` relative to that CSS file (e.g. from `src/app/` you might use `../../node_modules/@alanas/ui/dist`).
|
|
31
|
+
|
|
32
|
+
## Usage
|
|
33
|
+
|
|
34
|
+
```tsx
|
|
35
|
+
import { Button, Card, CardTitle, CardDescription } from "@alanas/ui";
|
|
36
|
+
|
|
37
|
+
export default function Page() {
|
|
38
|
+
return (
|
|
39
|
+
<>
|
|
40
|
+
<Button variant="primary" size="md">Click me</Button>
|
|
41
|
+
<Card>
|
|
42
|
+
<CardTitle>Title</CardTitle>
|
|
43
|
+
<CardDescription>Description text.</CardDescription>
|
|
44
|
+
</Card>
|
|
45
|
+
</>
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### Button
|
|
51
|
+
|
|
52
|
+
- **variant**: `"primary"` | `"secondary"` | `"outline"`
|
|
53
|
+
- **size**: `"sm"` | `"md"` | `"lg"`
|
|
54
|
+
- All native `<button>` props are supported.
|
|
55
|
+
|
|
56
|
+
### Card
|
|
57
|
+
|
|
58
|
+
- **Card**, **CardTitle**, **CardDescription** – use as shown above. All accept standard HTML props and `className`.
|
|
59
|
+
|
|
60
|
+
## License
|
|
61
|
+
|
|
62
|
+
MIT
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ButtonHTMLAttributes, HTMLAttributes } from 'react';
|
|
3
|
+
|
|
4
|
+
interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
5
|
+
variant?: "primary" | "secondary" | "outline";
|
|
6
|
+
size?: "sm" | "md" | "lg";
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
}
|
|
9
|
+
declare function Button({ variant, size, className, children, ...props }: ButtonProps): react_jsx_runtime.JSX.Element;
|
|
10
|
+
|
|
11
|
+
interface CardProps extends HTMLAttributes<HTMLDivElement> {
|
|
12
|
+
children: React.ReactNode;
|
|
13
|
+
}
|
|
14
|
+
declare function Card({ className, children, ...props }: CardProps): react_jsx_runtime.JSX.Element;
|
|
15
|
+
declare function CardTitle({ className, children, ...props }: HTMLAttributes<HTMLHeadingElement>): react_jsx_runtime.JSX.Element;
|
|
16
|
+
declare function CardDescription({ className, children, ...props }: HTMLAttributes<HTMLParagraphElement>): react_jsx_runtime.JSX.Element;
|
|
17
|
+
|
|
18
|
+
export { Button, Card, CardDescription, CardTitle };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
|
|
4
|
+
// src/Button.tsx
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
function Button({
|
|
7
|
+
variant = "primary",
|
|
8
|
+
size = "md",
|
|
9
|
+
className = "",
|
|
10
|
+
children,
|
|
11
|
+
...props
|
|
12
|
+
}) {
|
|
13
|
+
const base = "inline-flex items-center justify-center font-medium rounded-lg transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2 disabled:opacity-50 disabled:pointer-events-none";
|
|
14
|
+
const variants = {
|
|
15
|
+
primary: "bg-blue-600 text-white hover:bg-blue-700 focus:ring-blue-500 shadow-sm",
|
|
16
|
+
secondary: "bg-slate-100 text-slate-900 hover:bg-slate-200 focus:ring-slate-400",
|
|
17
|
+
outline: "border-2 border-slate-300 bg-transparent hover:bg-slate-50 focus:ring-slate-400"
|
|
18
|
+
};
|
|
19
|
+
const sizes = {
|
|
20
|
+
sm: "px-3 py-1.5 text-sm",
|
|
21
|
+
md: "px-4 py-2 text-base",
|
|
22
|
+
lg: "px-6 py-3 text-lg"
|
|
23
|
+
};
|
|
24
|
+
return /* @__PURE__ */ jsx(
|
|
25
|
+
"button",
|
|
26
|
+
{
|
|
27
|
+
type: "button",
|
|
28
|
+
className: `${base} ${variants[variant]} ${sizes[size]} ${className}`,
|
|
29
|
+
...props,
|
|
30
|
+
children
|
|
31
|
+
}
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
__name(Button, "Button");
|
|
35
|
+
|
|
36
|
+
// src/Card.tsx
|
|
37
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
38
|
+
function Card({ className = "", children, ...props }) {
|
|
39
|
+
return /* @__PURE__ */ jsx2(
|
|
40
|
+
"div",
|
|
41
|
+
{
|
|
42
|
+
className: `rounded-xl border border-slate-200 bg-white p-6 shadow-sm transition-shadow hover:shadow-md ${className}`,
|
|
43
|
+
...props,
|
|
44
|
+
children
|
|
45
|
+
}
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
__name(Card, "Card");
|
|
49
|
+
function CardTitle({
|
|
50
|
+
className = "",
|
|
51
|
+
children,
|
|
52
|
+
...props
|
|
53
|
+
}) {
|
|
54
|
+
return /* @__PURE__ */ jsx2(
|
|
55
|
+
"h3",
|
|
56
|
+
{
|
|
57
|
+
className: `text-lg font-semibold text-slate-900 ${className}`,
|
|
58
|
+
...props,
|
|
59
|
+
children
|
|
60
|
+
}
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
__name(CardTitle, "CardTitle");
|
|
64
|
+
function CardDescription({
|
|
65
|
+
className = "",
|
|
66
|
+
children,
|
|
67
|
+
...props
|
|
68
|
+
}) {
|
|
69
|
+
return /* @__PURE__ */ jsx2("p", { className: `mt-1 text-sm text-slate-500 ${className}`, ...props, children });
|
|
70
|
+
}
|
|
71
|
+
__name(CardDescription, "CardDescription");
|
|
72
|
+
export {
|
|
73
|
+
Button,
|
|
74
|
+
Card,
|
|
75
|
+
CardDescription,
|
|
76
|
+
CardTitle
|
|
77
|
+
};
|
|
78
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/Button.tsx","../src/Card.tsx"],"sourcesContent":["import type { ButtonHTMLAttributes } from \"react\";\n\nexport interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {\n variant?: \"primary\" | \"secondary\" | \"outline\";\n size?: \"sm\" | \"md\" | \"lg\";\n children: React.ReactNode;\n}\n\nexport function Button({\n variant = \"primary\",\n size = \"md\",\n className = \"\",\n children,\n ...props\n}: ButtonProps) {\n const base =\n \"inline-flex items-center justify-center font-medium rounded-lg transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2 disabled:opacity-50 disabled:pointer-events-none\";\n const variants = {\n primary:\n \"bg-blue-600 text-white hover:bg-blue-700 focus:ring-blue-500 shadow-sm\",\n secondary:\n \"bg-slate-100 text-slate-900 hover:bg-slate-200 focus:ring-slate-400\",\n outline:\n \"border-2 border-slate-300 bg-transparent hover:bg-slate-50 focus:ring-slate-400\",\n };\n const sizes = {\n sm: \"px-3 py-1.5 text-sm\",\n md: \"px-4 py-2 text-base\",\n lg: \"px-6 py-3 text-lg\",\n };\n\n return (\n <button\n type=\"button\"\n className={`${base} ${variants[variant]} ${sizes[size]} ${className}`}\n {...props}\n >\n {children}\n </button>\n );\n}\n","import type { HTMLAttributes } from \"react\";\n\nexport interface CardProps extends HTMLAttributes<HTMLDivElement> {\n children: React.ReactNode;\n}\n\nexport function Card({ className = \"\", children, ...props }: CardProps) {\n return (\n <div\n className={`rounded-xl border border-slate-200 bg-white p-6 shadow-sm transition-shadow hover:shadow-md ${className}`}\n {...props}\n >\n {children}\n </div>\n );\n}\n\nexport function CardTitle({\n className = \"\",\n children,\n ...props\n}: HTMLAttributes<HTMLHeadingElement>) {\n return (\n <h3\n className={`text-lg font-semibold text-slate-900 ${className}`}\n {...props}\n >\n {children}\n </h3>\n );\n}\n\nexport function CardDescription({\n className = \"\",\n children,\n ...props\n}: HTMLAttributes<HTMLParagraphElement>) {\n return (\n <p className={`mt-1 text-sm text-slate-500 ${className}`} {...props}>\n {children}\n </p>\n );\n}\n"],"mappings":";;;;AAgCI;AAxBG,SAAS,OAAO;AAAA,EACrB,UAAU;AAAA,EACV,OAAO;AAAA,EACP,YAAY;AAAA,EACZ;AAAA,EACA,GAAG;AACL,GAAgB;AACd,QAAM,OACJ;AACF,QAAM,WAAW;AAAA,IACf,SACE;AAAA,IACF,WACE;AAAA,IACF,SACE;AAAA,EACJ;AACA,QAAM,QAAQ;AAAA,IACZ,IAAI;AAAA,IACJ,IAAI;AAAA,IACJ,IAAI;AAAA,EACN;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC,MAAK;AAAA,MACL,WAAW,GAAG,IAAI,IAAI,SAAS,OAAO,CAAC,IAAI,MAAM,IAAI,CAAC,IAAI,SAAS;AAAA,MAClE,GAAG;AAAA,MAEH;AAAA;AAAA,EACH;AAEJ;AAhCgB;;;ACAZ,gBAAAA,YAAA;AAFG,SAAS,KAAK,EAAE,YAAY,IAAI,UAAU,GAAG,MAAM,GAAc;AACtE,SACE,gBAAAA;AAAA,IAAC;AAAA;AAAA,MACC,WAAW,+FAA+F,SAAS;AAAA,MAClH,GAAG;AAAA,MAEH;AAAA;AAAA,EACH;AAEJ;AATgB;AAWT,SAAS,UAAU;AAAA,EACxB,YAAY;AAAA,EACZ;AAAA,EACA,GAAG;AACL,GAAuC;AACrC,SACE,gBAAAA;AAAA,IAAC;AAAA;AAAA,MACC,WAAW,wCAAwC,SAAS;AAAA,MAC3D,GAAG;AAAA,MAEH;AAAA;AAAA,EACH;AAEJ;AAbgB;AAeT,SAAS,gBAAgB;AAAA,EAC9B,YAAY;AAAA,EACZ;AAAA,EACA,GAAG;AACL,GAAyC;AACvC,SACE,gBAAAA,KAAC,OAAE,WAAW,+BAA+B,SAAS,IAAK,GAAG,OAC3D,UACH;AAEJ;AAVgB;","names":["jsx"]}
|
package/package.json
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@alanas/ui",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "React UI components with TypeScript and Tailwind CSS v4",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"module": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"import": "./dist/index.js",
|
|
12
|
+
"types": "./dist/index.d.ts"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist",
|
|
17
|
+
"README.md"
|
|
18
|
+
],
|
|
19
|
+
"scripts": {
|
|
20
|
+
"build": "tsup",
|
|
21
|
+
"dev": "tsup --watch",
|
|
22
|
+
"prepublishOnly": "npm run build"
|
|
23
|
+
},
|
|
24
|
+
"peerDependencies": {
|
|
25
|
+
"react": "^18.0.0 || ^19.0.0",
|
|
26
|
+
"react-dom": "^18.0.0 || ^19.0.0"
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"@types/react": "^18.3.0",
|
|
30
|
+
"@types/react-dom": "^18.3.0",
|
|
31
|
+
"react": "^18.3.0",
|
|
32
|
+
"react-dom": "^18.3.0",
|
|
33
|
+
"tailwindcss": "^4.0.0",
|
|
34
|
+
"tsup": "^8.0.0",
|
|
35
|
+
"typescript": "^5.0.0"
|
|
36
|
+
},
|
|
37
|
+
"keywords": [
|
|
38
|
+
"react",
|
|
39
|
+
"components",
|
|
40
|
+
"tailwind",
|
|
41
|
+
"tailwindcss",
|
|
42
|
+
"ui",
|
|
43
|
+
"typescript"
|
|
44
|
+
],
|
|
45
|
+
"license": "MIT",
|
|
46
|
+
"repository": {
|
|
47
|
+
"type": "git",
|
|
48
|
+
"url": "https://github.com/alanas/ui.git"
|
|
49
|
+
}
|
|
50
|
+
}
|