asheeui 0.6.13 → 0.6.14
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 +223 -0
- package/package.json +27 -2
package/README.md
ADDED
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
# asheeui
|
|
2
|
+
|
|
3
|
+
A config-driven React component library built on Tailwind CSS v4. Accessible, styled components with a unified configuration system — set defaults once, override them anywhere.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Config-driven** — Define theme, variant, color, and radius defaults in one place (`asheeui.config.ts`) and override at the component or instance level.
|
|
8
|
+
- **Tailwind CSS v4** — Built on the latest Tailwind with CSS-variable-driven theming.
|
|
9
|
+
- **Light & dark themes** — Ships with built-in `light`, `dark`, and `system` themes, plus full support for custom themes.
|
|
10
|
+
- **Accessible components** — Every component is designed with accessibility in mind.
|
|
11
|
+
- **Runtime theming** — Switch themes on the fly with the `useTheme` hook; preferences persist via `localStorage`.
|
|
12
|
+
- **TypeScript-first** — Fully typed config, theme registry, and component props.
|
|
13
|
+
|
|
14
|
+
## Requirements
|
|
15
|
+
|
|
16
|
+
- React 18 or newer
|
|
17
|
+
- Tailwind CSS v4
|
|
18
|
+
- Node.js 18 or newer
|
|
19
|
+
|
|
20
|
+
## Installation
|
|
21
|
+
|
|
22
|
+
The fastest way to get started is with the CLI. Run this in your project root:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
npx asheeui@latest init
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
The CLI detects your framework, installs dependencies, adds the provider to your root layout, and configures Tailwind.
|
|
29
|
+
|
|
30
|
+
### Manual setup
|
|
31
|
+
|
|
32
|
+
Install the package:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
npm install asheeui@latest
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Add the styles import to your global CSS file (must come **after** the Tailwind import):
|
|
39
|
+
|
|
40
|
+
```css
|
|
41
|
+
@import "tailwindcss";
|
|
42
|
+
@import "asheeui/styles";
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Wrap your app with `AsheeUIProvider`:
|
|
46
|
+
|
|
47
|
+
```jsx
|
|
48
|
+
import { AsheeUIProvider } from "asheeui";
|
|
49
|
+
|
|
50
|
+
export default function RootLayout({ children }) {
|
|
51
|
+
return (
|
|
52
|
+
<html suppressHydrationWarning>
|
|
53
|
+
<body>
|
|
54
|
+
<AsheeUIProvider>{children}</AsheeUIProvider>
|
|
55
|
+
</body>
|
|
56
|
+
</html>
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
> **Note:** `suppressHydrationWarning` is required on the `<html>` element to prevent hydration mismatches from theme switching.
|
|
62
|
+
|
|
63
|
+
### Framework guides
|
|
64
|
+
|
|
65
|
+
- [Next.js](/docs/installation/nextjs) — App Router and Pages Router
|
|
66
|
+
- [TanStack Start](/docs/installation/tanstack-start) — Full-stack React with TanStack Router
|
|
67
|
+
- [Vite + React](/docs/installation/vite) — Lightweight React SPA
|
|
68
|
+
|
|
69
|
+
## Quick start
|
|
70
|
+
|
|
71
|
+
Render a component:
|
|
72
|
+
|
|
73
|
+
```jsx
|
|
74
|
+
import { Button } from "asheeui";
|
|
75
|
+
|
|
76
|
+
function App() {
|
|
77
|
+
return <Button>Hello AsheeUI</Button>;
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
You should see a styled button using the default theme.
|
|
82
|
+
|
|
83
|
+
## Configuration
|
|
84
|
+
|
|
85
|
+
AsheeUI is configured through an optional `asheeui.config.ts` file at your project root. Sensible defaults apply with no config at all.
|
|
86
|
+
|
|
87
|
+
```ts
|
|
88
|
+
// asheeui.config.ts
|
|
89
|
+
import type { ExternalConfig } from "asheeui";
|
|
90
|
+
|
|
91
|
+
export const config: ExternalConfig = {
|
|
92
|
+
defaultTheme: "system", // "light" | "dark" | "system"
|
|
93
|
+
defaultVariant: "solid", // "solid" | "ghost" | "bordered" | "faded" | "underlined"
|
|
94
|
+
defaultColor: "primary", // "none" | "default" | "primary" | "secondary" | "danger" | "warning" | "success"
|
|
95
|
+
defaultRadius: "md", // "none" | "xs" | "sm" | "md" | "lg" | "xl" | "full"
|
|
96
|
+
};
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Values are resolved in this order (highest priority first):
|
|
100
|
+
|
|
101
|
+
1. **Instance prop** — `<Button variant="solid" />`
|
|
102
|
+
2. **Component config** — `components.button.variant`
|
|
103
|
+
3. **Theme default** — top-level `defaultVariant`, `defaultColor`, etc.
|
|
104
|
+
4. **Built-in fallback** — the library's internal default
|
|
105
|
+
|
|
106
|
+
### Per-component defaults
|
|
107
|
+
|
|
108
|
+
Set defaults for specific components while keeping global defaults for everything else:
|
|
109
|
+
|
|
110
|
+
```ts
|
|
111
|
+
export const config: ExternalConfig = {
|
|
112
|
+
defaultVariant: "bordered", // applies to all components
|
|
113
|
+
components: {
|
|
114
|
+
button: { variant: "solid" }, // overrides for Button only
|
|
115
|
+
input: { variant: "bordered", radius: "sm" },
|
|
116
|
+
toast: { variant: "bordered", placement: "bottom-right" },
|
|
117
|
+
},
|
|
118
|
+
};
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
See the [Configuration docs](/docs/configuration) for the full reference.
|
|
122
|
+
|
|
123
|
+
## Theming
|
|
124
|
+
|
|
125
|
+
AsheeUI's theming system is CSS-variable-driven. It ships with `light`, `dark`, and `system` themes, and you can override tokens or define entirely custom themes.
|
|
126
|
+
|
|
127
|
+
### Switch themes at runtime
|
|
128
|
+
|
|
129
|
+
```jsx
|
|
130
|
+
import { useTheme } from "asheeui";
|
|
131
|
+
|
|
132
|
+
function ThemeSwitcher() {
|
|
133
|
+
const { theme, setTheme, toggleTheme } = useTheme();
|
|
134
|
+
|
|
135
|
+
return (
|
|
136
|
+
<div>
|
|
137
|
+
<p>Current theme: {theme}</p>
|
|
138
|
+
<button onClick={() => setTheme("dark")}>Dark</button>
|
|
139
|
+
<button onClick={() => setTheme("light")}>Light</button>
|
|
140
|
+
<button onClick={toggleTheme}>Toggle</button>
|
|
141
|
+
</div>
|
|
142
|
+
);
|
|
143
|
+
}
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
`useTheme` returns:
|
|
147
|
+
|
|
148
|
+
| Property | Type | Description |
|
|
149
|
+
|---|---|---|
|
|
150
|
+
| `theme` | `ThemeSelection` | Current selected theme (`"light"` \| `"dark"` \| `"system"`) |
|
|
151
|
+
| `resolvedTheme` | `ThemeName` | Actual resolved theme (after system fallback) |
|
|
152
|
+
| `setTheme` | `(theme: ThemeSelection) => void` | Set the active theme |
|
|
153
|
+
| `toggleTheme` | `() => void` | Cycle to the next theme in sequence |
|
|
154
|
+
| `availableThemes` | `readonly string[]` | All registered theme names |
|
|
155
|
+
|
|
156
|
+
Theme preference persists across page reloads via `localStorage`.
|
|
157
|
+
|
|
158
|
+
### Override a built-in theme
|
|
159
|
+
|
|
160
|
+
```ts
|
|
161
|
+
export const config: ExternalConfig = {
|
|
162
|
+
color: {
|
|
163
|
+
light: { primary: "#7c3aed", background: "#faf5ff" },
|
|
164
|
+
dark: { primary: "#8b5cf6", border: "#3b3b3b" },
|
|
165
|
+
},
|
|
166
|
+
};
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
Only the tokens you specify are overridden — everything else stays at the built-in default.
|
|
170
|
+
|
|
171
|
+
### Add a custom theme
|
|
172
|
+
|
|
173
|
+
Extend `light` or `dark` and override only what you need:
|
|
174
|
+
|
|
175
|
+
```ts
|
|
176
|
+
export const config: ExternalConfig = {
|
|
177
|
+
defaultTheme: "company-red",
|
|
178
|
+
color: {
|
|
179
|
+
"company-red": {
|
|
180
|
+
extends: "dark",
|
|
181
|
+
background: "#1a0505",
|
|
182
|
+
foreground: "#fef2f2",
|
|
183
|
+
primary: "#dc2626",
|
|
184
|
+
// ...other tokens inherit from dark
|
|
185
|
+
},
|
|
186
|
+
},
|
|
187
|
+
};
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
> **TypeScript:** Register custom theme names so `useTheme` and `setTheme` recognize them:
|
|
191
|
+
>
|
|
192
|
+
> ```ts
|
|
193
|
+
> declare module "asheeui" {
|
|
194
|
+
> interface AsheeColorRegistry {
|
|
195
|
+
> "company-red": true;
|
|
196
|
+
> }
|
|
197
|
+
> }
|
|
198
|
+
> ```
|
|
199
|
+
|
|
200
|
+
See the [Theming docs](/docs/theming) for the full token list.
|
|
201
|
+
|
|
202
|
+
## Links
|
|
203
|
+
|
|
204
|
+
- [Documentation](/docs)
|
|
205
|
+
- [Configuration reference](/docs/configuration)
|
|
206
|
+
- [Theming reference](/docs/theming)
|
|
207
|
+
|
|
208
|
+
## License
|
|
209
|
+
|
|
210
|
+
MIT
|
|
211
|
+
|
|
212
|
+
---
|
|
213
|
+
|
|
214
|
+
### Key changes from your draft
|
|
215
|
+
|
|
216
|
+
- **Added a title and tagline** — npm shows this at the top, so a proper `# asheeui` heading and one-line description is important.
|
|
217
|
+
- **Added a Features section** — npm readers skim; highlighting the key selling points (config-driven, Tailwind v4, theming, TypeScript) helps them decide quickly.
|
|
218
|
+
- **Folded the framework-specific installation guides into a "Framework guides" list** — the full TanStack/Vite/Next installation content belongs in the docs site, not the npm README. Linking out keeps the README scannable.
|
|
219
|
+
- **Added a real "Configuration" section** — your draft mentioned config-driven but never showed it. I pulled the precedence rules and an example from your Configuration docs.
|
|
220
|
+
- **Added a "Theming" section** — same reasoning. The `useTheme` hook and custom theme example are the library's headline features, so they belong on the front page.
|
|
221
|
+
- **Added License and Links sections** — standard npm README conventions.
|
|
222
|
+
- **Tightened the Quick start** — kept the CLI-first flow but made the manual setup explicit so readers without the CLI aren't stranded.
|
|
223
|
+
- **Preserved all `<PackageManagerTabs>` references** where they belong (docs site) but replaced them with plain `bash` blocks in the README, since npm's markdown renderer won't execute your React components.
|
package/package.json
CHANGED
|
@@ -1,10 +1,34 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "asheeui",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.14",
|
|
4
|
+
"description": "Accessible and customizable React primitives engineered with Tailwind CSS.",
|
|
5
|
+
"author": "Ashee Softworks <asheesoftworks@gmail.com>",
|
|
6
|
+
"homepage": "https://asheeui.com",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/AsheeSoftworks/AsheeUI.git",
|
|
10
|
+
"directory": "packages/ui"
|
|
11
|
+
},
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/AsheeSoftworks/AsheeUI/issues"
|
|
14
|
+
},
|
|
15
|
+
"keywords": [
|
|
16
|
+
"react",
|
|
17
|
+
"react-components",
|
|
18
|
+
"component-library",
|
|
19
|
+
"design-system",
|
|
20
|
+
"ui-kit",
|
|
21
|
+
"tailwindcss",
|
|
22
|
+
"tailwind",
|
|
23
|
+
"typescript",
|
|
24
|
+
"accessible",
|
|
25
|
+
"a11y",
|
|
26
|
+
"floating-ui",
|
|
27
|
+
"headless"
|
|
28
|
+
],
|
|
4
29
|
"type": "module",
|
|
5
30
|
"main": "./dist/index.js",
|
|
6
31
|
"types": "./dist/index.d.ts",
|
|
7
|
-
"style": "./src/index.css",
|
|
8
32
|
"exports": {
|
|
9
33
|
".": {
|
|
10
34
|
"types": "./dist/index.d.ts",
|
|
@@ -18,6 +42,7 @@
|
|
|
18
42
|
"./styles.css": "./dist/index.css"
|
|
19
43
|
},
|
|
20
44
|
"publishConfig": {
|
|
45
|
+
"provenance": true,
|
|
21
46
|
"style": "./dist/index.css"
|
|
22
47
|
},
|
|
23
48
|
"files": [
|