@esuiss/ui 0.5.0 → 0.5.2
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 +148 -3
- package/package.json +23 -2
package/README.md
CHANGED
|
@@ -1,12 +1,157 @@
|
|
|
1
1
|
# @esuiss/ui
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Copy-paste React components with a clean, minimal design, built on [Base UI](https://base-ui.com) and [Tailwind CSS](https://tailwindcss.com) v4.
|
|
4
|
+
|
|
5
|
+
`@esuiss/ui` is a command-line tool. It does not ship components as a dependency. Instead, it copies their source into your project so you own the code and can change it however you like.
|
|
6
|
+
|
|
7
|
+
- 61 accessible components and 3 hooks, from buttons and dialogs to sidebars, charts, and chat views
|
|
8
|
+
- A refined color palette for light and dark mode, written in oklch
|
|
9
|
+
- [Phosphor](https://phosphoricons.com) icons
|
|
10
|
+
- Next.js and React (Vite) with TypeScript
|
|
11
|
+
- No runtime dependency on this CLI: it runs with `npx` and is never installed in your project
|
|
12
|
+
|
|
13
|
+
## Requirements
|
|
14
|
+
|
|
15
|
+
- Next.js or React with Vite
|
|
16
|
+
- TypeScript
|
|
17
|
+
- Tailwind CSS 4.2 or later (installed for you if missing)
|
|
18
|
+
- Node.js 18 or later
|
|
19
|
+
|
|
20
|
+
## Quick start
|
|
21
|
+
|
|
22
|
+
Set up a project once:
|
|
4
23
|
|
|
5
24
|
```bash
|
|
6
25
|
npx @esuiss/ui@latest init
|
|
7
|
-
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Then add components:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
npx @esuiss/ui@latest add button dialog sidebar
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Use them:
|
|
35
|
+
|
|
36
|
+
```tsx
|
|
37
|
+
import { Button } from "@/components/ui/button"
|
|
38
|
+
|
|
39
|
+
export function Example() {
|
|
40
|
+
return <Button>Continue</Button>
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## What `init` does
|
|
45
|
+
|
|
46
|
+
1. Detects Next.js or Vite and checks for TypeScript and Tailwind CSS 4.2+.
|
|
47
|
+
2. Adds the `@/*` import alias to `tsconfig.json` if it is missing.
|
|
48
|
+
3. Installs and wires up Tailwind CSS if needed (`postcss.config.mjs` for Next.js, `vite.config.ts` for Vite).
|
|
49
|
+
4. Writes the theme stylesheet to `app/globals.css` (Next.js) or `src/index.css` (Vite). It asks before replacing a stylesheet that already has content.
|
|
50
|
+
5. Installs [`@esuiss/tailwind`](https://www.npmjs.com/package/@esuiss/tailwind), which provides the variants, animations, and utilities the components rely on.
|
|
51
|
+
6. Adds the `button` component.
|
|
52
|
+
|
|
53
|
+
## Commands
|
|
54
|
+
|
|
55
|
+
### `init`
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
npx @esuiss/ui@latest init [options]
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### `add`
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
npx @esuiss/ui@latest add <component...> [options]
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Components are written to `components/ui/` (and hooks to `hooks/`) under your `@/*` alias root. Components they depend on are added too, and missing npm packages are installed with your package manager (npm, pnpm, yarn, or bun).
|
|
68
|
+
|
|
69
|
+
### Options
|
|
70
|
+
|
|
71
|
+
| Option | Description |
|
|
72
|
+
| --- | --- |
|
|
73
|
+
| `-o, --overwrite` | Replace local files that differ from the registry |
|
|
74
|
+
| `--diff` | Show how your local files differ from the registry |
|
|
75
|
+
| `-a, --all` | Add every component |
|
|
76
|
+
| `-y, --yes` | Skip confirmation prompts |
|
|
77
|
+
| `-c, --cwd <dir>` | Run in another project directory |
|
|
78
|
+
| `-h, --help` | Show help |
|
|
79
|
+
| `-v, --version` | Show the version |
|
|
80
|
+
|
|
81
|
+
## Updating components
|
|
82
|
+
|
|
83
|
+
Components are your code, so updates never overwrite your changes silently. Review the latest version first, then replace your copy if you want it:
|
|
84
|
+
|
|
85
|
+
```bash
|
|
8
86
|
npx @esuiss/ui@latest add button --diff
|
|
9
87
|
npx @esuiss/ui@latest add button --overwrite
|
|
10
88
|
```
|
|
11
89
|
|
|
12
|
-
`
|
|
90
|
+
Running `add` for a component you already have keeps your file and tells you when it differs from the registry.
|
|
91
|
+
|
|
92
|
+
## Theming
|
|
93
|
+
|
|
94
|
+
Your stylesheet holds the whole theme:
|
|
95
|
+
|
|
96
|
+
```css
|
|
97
|
+
@import "tailwindcss";
|
|
98
|
+
@import "@esuiss/tailwind";
|
|
99
|
+
|
|
100
|
+
:root {
|
|
101
|
+
--background: oklch(1 0 0);
|
|
102
|
+
--primary: oklch(0.6321 0.2018 254.09);
|
|
103
|
+
--radius: 0.75rem;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.dark {
|
|
107
|
+
--background: oklch(0 0 0);
|
|
108
|
+
--primary: oklch(0.651471 0.191972 251.4696);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
@theme inline {
|
|
112
|
+
--font-sans: system-ui, sans-serif;
|
|
113
|
+
--color-background: var(--background);
|
|
114
|
+
--color-primary: var(--primary);
|
|
115
|
+
}
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
- **Change a color:** edit its value under `:root` (light) and `.dark` (dark).
|
|
119
|
+
- **Add a color:** define it under `:root` and `.dark`, then map it in `@theme inline`, for example `--color-brand: var(--brand);`. Classes such as `bg-brand` and `text-brand` become available.
|
|
120
|
+
- **Change the font:** set `--font-sans` in `@theme inline`. By default each device's own system font is used, so nothing has to be downloaded.
|
|
121
|
+
- **Corner radius:** `--radius` scales every rounded component.
|
|
122
|
+
|
|
123
|
+
## Dark mode
|
|
124
|
+
|
|
125
|
+
Dark mode is enabled by the `dark` class on `<html>`. With Next.js, [next-themes](https://github.com/pacocoursey/next-themes) works out of the box:
|
|
126
|
+
|
|
127
|
+
```tsx
|
|
128
|
+
import { ThemeProvider } from "next-themes"
|
|
129
|
+
|
|
130
|
+
export default function RootLayout({ children }: { children: React.ReactNode }) {
|
|
131
|
+
return (
|
|
132
|
+
<html lang="en" suppressHydrationWarning>
|
|
133
|
+
<body>
|
|
134
|
+
<ThemeProvider attribute="class" defaultTheme="system" enableSystem>
|
|
135
|
+
{children}
|
|
136
|
+
</ThemeProvider>
|
|
137
|
+
</body>
|
|
138
|
+
</html>
|
|
139
|
+
)
|
|
140
|
+
}
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
## Components
|
|
144
|
+
|
|
145
|
+
accordion, alert, alert-dialog, aspect-ratio, attachment, avatar, badge, breadcrumb, bubble, button, button-group, calendar, card, carousel, chart, checkbox, collapsible, combobox, command, context-menu, dialog, direction, drawer, dropdown-menu, empty, field, hover-card, input, input-group, input-otp, item, kbd, label, marker, menubar, message, message-scroller, native-select, navigation-menu, pagination, popover, progress, questionnaire, radio-group, resizable, scroll-area, select, separator, sheet, sidebar, skeleton, slider, spinner, switch, table, tabs, textarea, toast, toggle, toggle-group, tooltip
|
|
146
|
+
|
|
147
|
+
Hooks: use-message-scroller, use-mobile, use-questionnaire
|
|
148
|
+
|
|
149
|
+
## Troubleshooting
|
|
150
|
+
|
|
151
|
+
- **"Tailwind CSS 4.2 or later is required"**: upgrade with `npm install tailwindcss@latest` and run `init` again.
|
|
152
|
+
- **"No `@/*` import alias found"**: run `init` first, or add `"paths": { "@/*": ["./src/*"] }` to `compilerOptions` in `tsconfig.json`.
|
|
153
|
+
- **A newly published version is not found**: npm can take a few minutes to make new versions available. Run `npx --prefer-online @esuiss/ui@latest ...`.
|
|
154
|
+
|
|
155
|
+
## License
|
|
156
|
+
|
|
157
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,7 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@esuiss/ui",
|
|
3
|
-
"version": "0.5.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.5.2",
|
|
4
|
+
"description": "Copy-paste React components with a clean, minimal design, built on Base UI and Tailwind CSS v4. CLI for Next.js and React (Vite).",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"react",
|
|
7
|
+
"nextjs",
|
|
8
|
+
"vite",
|
|
9
|
+
"components",
|
|
10
|
+
"ui",
|
|
11
|
+
"design-system",
|
|
12
|
+
"tailwindcss",
|
|
13
|
+
"tailwind",
|
|
14
|
+
"base-ui",
|
|
15
|
+
"oklch",
|
|
16
|
+
"dark-mode",
|
|
17
|
+
"cli",
|
|
18
|
+
"copy-paste",
|
|
19
|
+
"typescript",
|
|
20
|
+
"phosphor-icons"
|
|
21
|
+
],
|
|
22
|
+
"author": "ademceper",
|
|
5
23
|
"license": "MIT",
|
|
6
24
|
"repository": {
|
|
7
25
|
"type": "git",
|
|
@@ -9,6 +27,9 @@
|
|
|
9
27
|
"directory": "packages/cli"
|
|
10
28
|
},
|
|
11
29
|
"homepage": "https://github.com/e-suiss/ui",
|
|
30
|
+
"bugs": {
|
|
31
|
+
"url": "https://github.com/e-suiss/ui/issues"
|
|
32
|
+
},
|
|
12
33
|
"type": "module",
|
|
13
34
|
"bin": {
|
|
14
35
|
"esuiss": "index.mjs"
|