@n3wth/ui 0.2.2 → 0.2.3
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/LICENSE +21 -0
- package/README.md +155 -11
- package/package.json +3 -2
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Oliver Newth
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,40 +1,184 @@
|
|
|
1
1
|
# @n3wth/ui
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/@n3wth/ui)
|
|
4
|
+
[](https://www.npmjs.com/package/@n3wth/ui)
|
|
5
|
+
[](https://opensource.org/licenses/MIT)
|
|
4
6
|
|
|
5
|
-
|
|
7
|
+
Atomic design system for Newth sites. Flat, minimal, iOS-inspired. No shadows, no glows, just clean glass morphism.
|
|
8
|
+
|
|
9
|
+
**Demo**: [ui.newth.ai](https://ui.newth.ai)
|
|
10
|
+
|
|
11
|
+
## Installation
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install @n3wth/ui
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
### Peer Dependencies
|
|
18
|
+
|
|
19
|
+
Requires React 18+ and React DOM:
|
|
6
20
|
|
|
7
21
|
```bash
|
|
8
|
-
npm
|
|
22
|
+
npm install react react-dom
|
|
9
23
|
```
|
|
10
24
|
|
|
11
|
-
##
|
|
25
|
+
## Quick Start
|
|
12
26
|
|
|
13
27
|
```tsx
|
|
14
28
|
import { Button, Card, Nav } from '@n3wth/ui'
|
|
15
29
|
import '@n3wth/ui/styles'
|
|
16
30
|
```
|
|
17
31
|
|
|
18
|
-
### Tailwind Preset
|
|
32
|
+
### Tailwind CSS Preset
|
|
33
|
+
|
|
34
|
+
Include the design tokens in your Tailwind config:
|
|
19
35
|
|
|
20
36
|
```js
|
|
21
37
|
// tailwind.config.js
|
|
22
38
|
export default {
|
|
23
|
-
presets: [require('@n3wth/ui/tailwind')]
|
|
39
|
+
presets: [require('@n3wth/ui/tailwind')],
|
|
40
|
+
content: [
|
|
41
|
+
'./src/**/*.{js,ts,jsx,tsx}',
|
|
42
|
+
'./node_modules/@n3wth/ui/dist/**/*.js'
|
|
43
|
+
]
|
|
24
44
|
}
|
|
25
45
|
```
|
|
26
46
|
|
|
27
47
|
## Components
|
|
28
48
|
|
|
29
|
-
|
|
49
|
+
### Atoms
|
|
50
|
+
|
|
51
|
+
Basic building blocks:
|
|
52
|
+
|
|
53
|
+
| Component | Description |
|
|
54
|
+
|-----------|-------------|
|
|
55
|
+
| `Button` | Primary, secondary, ghost, glass variants with loading state |
|
|
56
|
+
| `Badge` | Default, sage, coral, mint, gold, outline variants |
|
|
57
|
+
| `Input` | Text input with glass variant, icons, and error state |
|
|
58
|
+
| `Icon` | 20+ SVG icons (arrows, check, x, copy, search, github, etc.) |
|
|
59
|
+
| `AnimatedText` | Text with entrance animations |
|
|
60
|
+
| `HamburgerIcon` | Animated menu icon |
|
|
61
|
+
| `NoiseOverlay` | Subtle noise texture overlay |
|
|
62
|
+
| `ScrollIndicator` | Scroll progress indicator |
|
|
63
|
+
|
|
64
|
+
### Molecules
|
|
65
|
+
|
|
66
|
+
Composite components:
|
|
67
|
+
|
|
68
|
+
| Component | Description |
|
|
69
|
+
|-----------|-------------|
|
|
70
|
+
| `Card` | Container with header, content, footer. Glass/interactive variants |
|
|
71
|
+
| `NavLink` | Navigation link with underline/pill styles |
|
|
72
|
+
| `CommandBox` | Copy-to-clipboard code display |
|
|
73
|
+
| `ThemeToggle` | Dark/light mode toggle |
|
|
74
|
+
| `MobileDrawer` | Slide-out mobile navigation |
|
|
75
|
+
|
|
76
|
+
### Organisms
|
|
77
|
+
|
|
78
|
+
Complex UI sections:
|
|
79
|
+
|
|
80
|
+
| Component | Description |
|
|
81
|
+
|-----------|-------------|
|
|
82
|
+
| `Nav` | Fixed navigation with mobile menu and theme toggle |
|
|
83
|
+
| `Hero` | Hero section with badge, title, description, CTAs |
|
|
84
|
+
| `Section` | Content section wrapper with header |
|
|
85
|
+
| `Footer` | Multi-column footer with sections |
|
|
86
|
+
|
|
87
|
+
## Hooks
|
|
88
|
+
|
|
89
|
+
```tsx
|
|
90
|
+
import { useTheme, useMediaQuery, useKeyboardShortcuts, useReducedMotion } from '@n3wth/ui'
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
| Hook | Description |
|
|
94
|
+
|------|-------------|
|
|
95
|
+
| `useTheme` | Dark/light theme management with system preference detection |
|
|
96
|
+
| `useMediaQuery` | Responsive breakpoint detection |
|
|
97
|
+
| `useKeyboardShortcuts` | Keyboard shortcut handler |
|
|
98
|
+
| `useReducedMotion` | Respects user's motion preferences |
|
|
99
|
+
|
|
100
|
+
## Design Tokens
|
|
101
|
+
|
|
102
|
+
The Tailwind preset includes:
|
|
103
|
+
|
|
104
|
+
- **Colors**: Semantic color palette with dark mode support
|
|
105
|
+
- **Typography**: Display and body font families
|
|
106
|
+
- **Spacing**: Consistent spacing scale
|
|
107
|
+
- **Effects**: Glass morphism and blur effects
|
|
108
|
+
|
|
109
|
+
## Development
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
# Install dependencies
|
|
113
|
+
npm install
|
|
114
|
+
|
|
115
|
+
# Watch mode for library development
|
|
116
|
+
npm run dev
|
|
117
|
+
|
|
118
|
+
# Run demo app at localhost:5173
|
|
119
|
+
npm run demo
|
|
120
|
+
|
|
121
|
+
# Build library to dist/
|
|
122
|
+
npm run build
|
|
123
|
+
|
|
124
|
+
# Build demo for deployment
|
|
125
|
+
npm run demo:build
|
|
126
|
+
|
|
127
|
+
# Lint
|
|
128
|
+
npm run lint
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
## Project Structure
|
|
132
|
+
|
|
133
|
+
```
|
|
134
|
+
src/
|
|
135
|
+
atoms/ # Button, Badge, Input, Icon, etc.
|
|
136
|
+
molecules/ # Card, NavLink, CommandBox, etc.
|
|
137
|
+
organisms/ # Nav, Hero, Footer, Section
|
|
138
|
+
hooks/ # useTheme, useMediaQuery, etc.
|
|
139
|
+
tokens/ # Design tokens (colors, typography)
|
|
140
|
+
demo/ # Demo app (ui.newth.ai)
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
## Usage Examples
|
|
144
|
+
|
|
145
|
+
### Button
|
|
30
146
|
|
|
31
|
-
|
|
147
|
+
```tsx
|
|
148
|
+
import { Button, Icon } from '@n3wth/ui'
|
|
149
|
+
|
|
150
|
+
<Button variant="primary">Primary</Button>
|
|
151
|
+
<Button variant="glass" isLoading>Loading</Button>
|
|
152
|
+
<Button leftIcon={<Icon name="github" />}>GitHub</Button>
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
### Card
|
|
32
156
|
|
|
33
|
-
|
|
157
|
+
```tsx
|
|
158
|
+
import { Card, CardHeader, CardTitle, CardContent } from '@n3wth/ui'
|
|
159
|
+
|
|
160
|
+
<Card variant="glass">
|
|
161
|
+
<CardHeader>
|
|
162
|
+
<CardTitle>Title</CardTitle>
|
|
163
|
+
</CardHeader>
|
|
164
|
+
<CardContent>Content here</CardContent>
|
|
165
|
+
</Card>
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
### Theme
|
|
169
|
+
|
|
170
|
+
```tsx
|
|
171
|
+
import { useTheme, ThemeToggle } from '@n3wth/ui'
|
|
172
|
+
|
|
173
|
+
function App() {
|
|
174
|
+
const { theme, toggleTheme } = useTheme()
|
|
175
|
+
return <ThemeToggle theme={theme} onToggle={toggleTheme} />
|
|
176
|
+
}
|
|
177
|
+
```
|
|
34
178
|
|
|
35
|
-
##
|
|
179
|
+
## Browser Support
|
|
36
180
|
|
|
37
|
-
|
|
181
|
+
Supports all modern browsers. Uses CSS custom properties and backdrop-filter for glass effects.
|
|
38
182
|
|
|
39
183
|
## License
|
|
40
184
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@n3wth/ui",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"description": "Atomic design system for Newth sites - flat, minimal, iOS-inspired",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -40,6 +40,7 @@
|
|
|
40
40
|
"@types/react": "^19.0.0",
|
|
41
41
|
"@types/react-dom": "^19.0.0",
|
|
42
42
|
"@vitejs/plugin-react": "^4.3.0",
|
|
43
|
+
"eslint": "^9.39.2",
|
|
43
44
|
"react": "^19.2.4",
|
|
44
45
|
"react-dom": "^19.2.4",
|
|
45
46
|
"tailwindcss": "^4.1.18",
|
|
@@ -56,6 +57,6 @@
|
|
|
56
57
|
"license": "MIT",
|
|
57
58
|
"repository": {
|
|
58
59
|
"type": "git",
|
|
59
|
-
"url": "https://github.com/n3wth/
|
|
60
|
+
"url": "https://github.com/n3wth/ui"
|
|
60
61
|
}
|
|
61
62
|
}
|