@farm-junction/design-library 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.
- package/README.md +101 -0
- package/dist/index.d.ts +51 -0
- package/dist/index.js +3075 -0
- package/dist/styles.css +1 -0
- package/dist/tailwind-preset.css +3 -0
- package/dist/tokens/theme.css +37 -0
- package/package.json +72 -0
package/README.md
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# @farm-junction/design-library
|
|
2
|
+
|
|
3
|
+
Farm Junction React design system — design tokens, components, Storybook docs, and a Tailwind 4 preset for consuming apps.
|
|
4
|
+
|
|
5
|
+
## Stack
|
|
6
|
+
|
|
7
|
+
- React 19 + TypeScript 5
|
|
8
|
+
- Tailwind CSS 4 (`@theme` tokens)
|
|
9
|
+
- Storybook 8 (Vite)
|
|
10
|
+
- Vite library build (ESM + types + CSS)
|
|
11
|
+
|
|
12
|
+
## Scripts
|
|
13
|
+
|
|
14
|
+
| Command | Description |
|
|
15
|
+
|---------|-------------|
|
|
16
|
+
| `npm run dev` | Start Storybook on port 6006 |
|
|
17
|
+
| `npm run build` | Typecheck and build `dist/` |
|
|
18
|
+
| `npm run build-storybook` | Static Storybook build |
|
|
19
|
+
| `npm run lint` | ESLint |
|
|
20
|
+
|
|
21
|
+
## Development
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
npm install
|
|
25
|
+
npm run dev
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Open [http://localhost:6006](http://localhost:6006) to browse components and token swatches.
|
|
29
|
+
|
|
30
|
+
## Package exports
|
|
31
|
+
|
|
32
|
+
| Import path | Description |
|
|
33
|
+
|-------------|-------------|
|
|
34
|
+
| `@farm-junction/design-library` | React components, `cn`, `tokens` |
|
|
35
|
+
| `@farm-junction/design-library/styles.css` | Compiled component styles |
|
|
36
|
+
| `@farm-junction/design-library/tailwind-preset` | Tailwind 4 theme + base for app integration |
|
|
37
|
+
|
|
38
|
+
## Usage in a Next.js app
|
|
39
|
+
|
|
40
|
+
### 1. Install
|
|
41
|
+
|
|
42
|
+
Local development (from this repo):
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
npm install ../design-library
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Or publish to your registry and install as usual.
|
|
49
|
+
|
|
50
|
+
### 2. Import compiled styles
|
|
51
|
+
|
|
52
|
+
In your root layout (e.g. `app/layout.tsx`):
|
|
53
|
+
|
|
54
|
+
```tsx
|
|
55
|
+
import "@farm-junction/design-library/styles.css";
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### 3. Extend Tailwind 4 in your app CSS
|
|
59
|
+
|
|
60
|
+
In `app/globals.css` (or your main CSS entry):
|
|
61
|
+
|
|
62
|
+
```css
|
|
63
|
+
@import "tailwindcss";
|
|
64
|
+
@import "@farm-junction/design-library/tailwind-preset";
|
|
65
|
+
@source "../node_modules/@farm-junction/design-library/dist";
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Adjust the `@source` path if your app lives in a monorepo or uses a different `node_modules` layout.
|
|
69
|
+
|
|
70
|
+
### 4. Use components
|
|
71
|
+
|
|
72
|
+
```tsx
|
|
73
|
+
import { Button } from "@farm-junction/design-library";
|
|
74
|
+
|
|
75
|
+
export default function Page() {
|
|
76
|
+
return <Button variant="primary">Get started</Button>;
|
|
77
|
+
}
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Project structure
|
|
81
|
+
|
|
82
|
+
```
|
|
83
|
+
src/
|
|
84
|
+
├── tokens/ # @theme CSS + TS token mirror
|
|
85
|
+
├── styles/ # Tailwind entry (dev + build)
|
|
86
|
+
├── components/ # React components + stories
|
|
87
|
+
├── lib/utils.ts # cn() helper
|
|
88
|
+
├── tailwind-preset.css
|
|
89
|
+
└── index.ts # Public API
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## Adding a component
|
|
93
|
+
|
|
94
|
+
1. Create `src/components/MyComponent/MyComponent.tsx`
|
|
95
|
+
2. Add `MyComponent.stories.tsx` for Storybook
|
|
96
|
+
3. Export from `src/components/index.ts` and `src/index.ts`
|
|
97
|
+
4. Use Tailwind utilities that reference `@theme` tokens (e.g. `bg-primary`)
|
|
98
|
+
|
|
99
|
+
## License
|
|
100
|
+
|
|
101
|
+
Private — Farm Junction internal use.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { ButtonHTMLAttributes } from 'react';
|
|
2
|
+
import { ClassValue } from 'clsx';
|
|
3
|
+
import { ForwardRefExoticComponent } from 'react';
|
|
4
|
+
import { RefAttributes } from 'react';
|
|
5
|
+
|
|
6
|
+
export declare const Button: ForwardRefExoticComponent<ButtonProps & RefAttributes<HTMLButtonElement>>;
|
|
7
|
+
|
|
8
|
+
export declare interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
9
|
+
variant?: ButtonVariant;
|
|
10
|
+
size?: ButtonSize;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export declare type ButtonSize = "sm" | "md" | "lg";
|
|
14
|
+
|
|
15
|
+
export declare type ButtonVariant = "primary" | "secondary" | "ghost";
|
|
16
|
+
|
|
17
|
+
export declare function cn(...inputs: ClassValue[]): string;
|
|
18
|
+
|
|
19
|
+
export declare type Tokens = typeof tokens;
|
|
20
|
+
|
|
21
|
+
export declare const tokens: {
|
|
22
|
+
readonly colors: {
|
|
23
|
+
readonly brand: {
|
|
24
|
+
readonly 50: "#eff6ff";
|
|
25
|
+
readonly 100: "#dbeafe";
|
|
26
|
+
readonly 500: "#2563eb";
|
|
27
|
+
readonly 600: "#1d4ed8";
|
|
28
|
+
readonly 700: "#1e40af";
|
|
29
|
+
};
|
|
30
|
+
readonly primary: "#1d4ed8";
|
|
31
|
+
readonly primaryHover: "#1e40af";
|
|
32
|
+
readonly onPrimary: "#ffffff";
|
|
33
|
+
readonly secondary: "#f1f5f9";
|
|
34
|
+
readonly onSecondary: "#0f172a";
|
|
35
|
+
readonly surface: "#ffffff";
|
|
36
|
+
readonly onSurface: "#0f172a";
|
|
37
|
+
readonly danger: "#dc2626";
|
|
38
|
+
readonly onDanger: "#ffffff";
|
|
39
|
+
readonly border: "#e2e8f0";
|
|
40
|
+
};
|
|
41
|
+
readonly radius: {
|
|
42
|
+
readonly sm: "0.25rem";
|
|
43
|
+
readonly md: "0.375rem";
|
|
44
|
+
readonly lg: "0.5rem";
|
|
45
|
+
};
|
|
46
|
+
readonly fontFamily: {
|
|
47
|
+
readonly sans: "\"Mulish\", ui-sans-serif, system-ui, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\", \"Noto Color Emoji\"";
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export { }
|