@srcroot/ui 1.0.4 → 1.0.5
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 +33 -153
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -1,20 +1,9 @@
|
|
|
1
1
|
# @srcroot/ui
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
## Features
|
|
6
|
-
|
|
7
|
-
- **Framework-Aware**: Automatically detects Next.js or Vite and uses optimized component variants
|
|
8
|
-
- **Polymorphic**: Most components support an `as` prop to change the underlying HTML element
|
|
9
|
-
- **Accessible**: Built on standard HTML elements and WAI-ARIA patterns
|
|
10
|
-
- **Copy/Paste**: Components are copied directly into your project — you own the code
|
|
11
|
-
- **Styled**: Beautiful defaults using Tailwind CSS and `class-variance-authority`
|
|
12
|
-
- **Zero Runtime Dependencies**: No library bundle — just copy what you need
|
|
3
|
+
UI components for Next.js and Vite. Copy-paste into your project.
|
|
13
4
|
|
|
14
5
|
## Install
|
|
15
6
|
|
|
16
|
-
Initialize your project with `@srcroot/ui`:
|
|
17
|
-
|
|
18
7
|
```bash
|
|
19
8
|
# npm
|
|
20
9
|
npx @srcroot/ui init
|
|
@@ -34,143 +23,17 @@ deno run -A npm:@srcroot/ui init
|
|
|
34
23
|
|
|
35
24
|
## Add Components
|
|
36
25
|
|
|
37
|
-
Add components to your project:
|
|
38
|
-
|
|
39
26
|
```bash
|
|
40
|
-
#
|
|
27
|
+
# Interactive
|
|
41
28
|
npx @srcroot/ui add
|
|
42
|
-
npx @srcroot/ui add button card input
|
|
43
|
-
npx @srcroot/ui add --all
|
|
44
|
-
|
|
45
|
-
# yarn
|
|
46
|
-
yarn dlx @srcroot/ui add
|
|
47
|
-
yarn dlx @srcroot/ui add button card input
|
|
48
|
-
yarn dlx @srcroot/ui add --all
|
|
49
|
-
|
|
50
|
-
# pnpm
|
|
51
|
-
pnpm dlx @srcroot/ui add
|
|
52
|
-
pnpm dlx @srcroot/ui add button card input
|
|
53
|
-
pnpm dlx @srcroot/ui add --all
|
|
54
29
|
|
|
55
|
-
#
|
|
56
|
-
|
|
57
|
-
bunx @srcroot/ui add button card input
|
|
58
|
-
bunx @srcroot/ui add --all
|
|
30
|
+
# Specific components
|
|
31
|
+
npx @srcroot/ui add button card input
|
|
59
32
|
|
|
60
|
-
#
|
|
61
|
-
|
|
62
|
-
deno run -A npm:@srcroot/ui add button card input
|
|
63
|
-
deno run -A npm:@srcroot/ui add --all
|
|
33
|
+
# All components
|
|
34
|
+
npx @srcroot/ui add --all
|
|
64
35
|
```
|
|
65
36
|
|
|
66
|
-
## Supported Package Managers
|
|
67
|
-
|
|
68
|
-
The CLI automatically detects and uses your package manager:
|
|
69
|
-
|
|
70
|
-
| Manager | Command |
|
|
71
|
-
|---------|---------|
|
|
72
|
-
| npm | `npm install` |
|
|
73
|
-
| Yarn | `yarn add` |
|
|
74
|
-
| pnpm | `pnpm add` |
|
|
75
|
-
| Bun | `bun add` |
|
|
76
|
-
| Deno | `deno add -A` |
|
|
77
|
-
|
|
78
|
-
## Framework Detection
|
|
79
|
-
|
|
80
|
-
| Framework | Detection | Notes |
|
|
81
|
-
|-----------|-----------|-------|
|
|
82
|
-
| Next.js | `next.config.ts/js/mjs` or `src/app` | Uses `next/script` for analytics |
|
|
83
|
-
| Vite | `vite.config.ts/js/mjs` | Uses `useEffect` for analytics, localStorage for themes |
|
|
84
|
-
|
|
85
|
-
## Components
|
|
86
|
-
|
|
87
|
-
### Analytics
|
|
88
|
-
- `google-analytics` - Google Analytics 4 integration
|
|
89
|
-
- `google-tag-manager` - Google Tag Manager container
|
|
90
|
-
- `meta-pixel` - Meta/Facebook Pixel tracking
|
|
91
|
-
- `microsoft-clarity` - Microsoft Clarity analytics
|
|
92
|
-
- `tiktok-pixel` - TikTok Pixel tracking
|
|
93
|
-
|
|
94
|
-
### Core
|
|
95
|
-
- `button` - Polymorphic button with variants
|
|
96
|
-
- `badge` - Status indicators
|
|
97
|
-
- `avatar` - User profile images with fallbacks
|
|
98
|
-
- `separator` - Visual divider
|
|
99
|
-
- `button-group` - Attached or spaced button sets
|
|
100
|
-
- `slot` - Polymorphic slot for component composition
|
|
101
|
-
|
|
102
|
-
### Forms
|
|
103
|
-
- `input` - Basic text input
|
|
104
|
-
- `textarea` - Multi-line text input
|
|
105
|
-
- `checkbox` - Toggle selection
|
|
106
|
-
- `radio` - Single selection from list
|
|
107
|
-
- `switch` - Toggle switch
|
|
108
|
-
- `select` - Dropdown selection
|
|
109
|
-
- `slider` - Range input
|
|
110
|
-
- `otp-input` - One-time password verification
|
|
111
|
-
- `search` - Search input with debounce
|
|
112
|
-
- `calendar` - Date and range picker
|
|
113
|
-
- `date-picker` - Date selection component
|
|
114
|
-
- `form-field` - Form field wrapper with label and validation
|
|
115
|
-
- `input-group` - Input with attached elements
|
|
116
|
-
|
|
117
|
-
### Layout
|
|
118
|
-
- `card` - Content container with header/content/footer
|
|
119
|
-
- `container` - Centered layout wrapper
|
|
120
|
-
- `aspect-ratio` - Maintain element proportions
|
|
121
|
-
- `resizable` - Resizable panel groups
|
|
122
|
-
|
|
123
|
-
### Data Display
|
|
124
|
-
- `text` - Polymorphic typography
|
|
125
|
-
- `label` - Accessible form label
|
|
126
|
-
- `table` - Responsive data table
|
|
127
|
-
- `table-of-contents` - Auto-generated TOC
|
|
128
|
-
- `accordion` - Collapsible content sections
|
|
129
|
-
- `collapsible` - Expandable panel
|
|
130
|
-
- `tabs` - Tabbed content switcher
|
|
131
|
-
- `progress` - Progress bar
|
|
132
|
-
- `skeleton` - Loading placeholder
|
|
133
|
-
- `image` - Enhanced image with fallback
|
|
134
|
-
- `carousel` - Content slider with autoplay
|
|
135
|
-
- `marquee` - Scrolling marquee animation
|
|
136
|
-
|
|
137
|
-
### Feedback
|
|
138
|
-
- `loading-spinner` - SVG spinner with variants
|
|
139
|
-
- `star-rating` - Interactive rating component
|
|
140
|
-
- `toast` - Transient notifications
|
|
141
|
-
- `alert` - Critical information banner
|
|
142
|
-
- `scroll-to-top` - Scroll to top button
|
|
143
|
-
- `scroll-animation` - Scroll-triggered animations
|
|
144
|
-
|
|
145
|
-
### Overlays
|
|
146
|
-
- `dialog` - Modal dialog
|
|
147
|
-
- `alert-dialog` - Modal for confirming actions
|
|
148
|
-
- `sheet` - Side-panel overlay
|
|
149
|
-
- `popover` - Content appearing over trigger
|
|
150
|
-
- `tooltip` - Hover information
|
|
151
|
-
- `dropdown-menu` - Menu for actions/navigation
|
|
152
|
-
- `context-menu` - Right-click context menu
|
|
153
|
-
|
|
154
|
-
### Navigation
|
|
155
|
-
- `breadcrumb` - Navigation trail
|
|
156
|
-
- `pagination` - Page navigation controls
|
|
157
|
-
- `sidebar` - Collapsible sidebar with navigation
|
|
158
|
-
- `menubar` - Menu bar component
|
|
159
|
-
|
|
160
|
-
### Specialized
|
|
161
|
-
- `chatbot` - Chat interface widget
|
|
162
|
-
- `chart` - Recharts-based chart component
|
|
163
|
-
- `map` - Google Maps embed
|
|
164
|
-
- `combobox` - Searchable dropdown (Command menu pattern)
|
|
165
|
-
- `command` - Command menu (Cmd+k style)
|
|
166
|
-
- `file-upload` - Drag-and-drop file upload
|
|
167
|
-
- `hover-card` - Hover-triggered card
|
|
168
|
-
- `native-select` - Native select wrapper
|
|
169
|
-
- `patterns` - Decorative background patterns
|
|
170
|
-
- `theme-switcher` - Light/dark/system theme toggle
|
|
171
|
-
- `whatsapp` - WhatsApp floating button
|
|
172
|
-
- `floating-dock` - macOS-style floating dock
|
|
173
|
-
|
|
174
37
|
## Usage
|
|
175
38
|
|
|
176
39
|
```tsx
|
|
@@ -191,23 +54,40 @@ export default function Home() {
|
|
|
191
54
|
}
|
|
192
55
|
```
|
|
193
56
|
|
|
194
|
-
##
|
|
57
|
+
## Components
|
|
195
58
|
|
|
196
|
-
|
|
59
|
+
**Analytics:** google-analytics, google-tag-manager, meta-pixel, microsoft-clarity, tiktok-pixel
|
|
197
60
|
|
|
198
|
-
|
|
199
|
-
<Button as="a" href="/login">Login</Button>
|
|
61
|
+
**Core:** button, badge, avatar, separator, button-group, slot
|
|
200
62
|
|
|
201
|
-
|
|
202
|
-
|
|
63
|
+
**Forms:** input, textarea, checkbox, radio, switch, select, slider, otp-input, search, calendar, date-picker, form-field, input-group
|
|
64
|
+
|
|
65
|
+
**Layout:** card, container, aspect-ratio, resizable
|
|
66
|
+
|
|
67
|
+
**Data Display:** text, label, table, table-of-contents, accordion, collapsible, tabs, progress, skeleton, image, carousel, marquee
|
|
68
|
+
|
|
69
|
+
**Feedback:** loading-spinner, star-rating, toast, alert, scroll-to-top, scroll-animation
|
|
70
|
+
|
|
71
|
+
**Overlays:** dialog, alert-dialog, sheet, popover, tooltip, dropdown-menu, context-menu
|
|
72
|
+
|
|
73
|
+
**Navigation:** breadcrumb, pagination, sidebar, menubar
|
|
74
|
+
|
|
75
|
+
**Specialized:** chatbot, chart, map, combobox, command, file-upload, hover-card, native-select, patterns, theme-switcher, whatsapp, floating-dock
|
|
76
|
+
|
|
77
|
+
## Features
|
|
78
|
+
|
|
79
|
+
- **Framework-aware** — auto-detects Next.js (uses `next/script`) or Vite (uses `useEffect`)
|
|
80
|
+
- **Polymorphic** — use `as` prop to change the HTML element: `<Button as="a" href="/">`
|
|
81
|
+
- **Accessible** — built on WAI-ARIA patterns
|
|
82
|
+
- **No bundle** — components live in your project
|
|
203
83
|
|
|
204
|
-
## CLI
|
|
84
|
+
## CLI
|
|
205
85
|
|
|
206
86
|
```bash
|
|
207
|
-
npx @srcroot/ui init
|
|
208
|
-
npx @srcroot/ui add [comps] Add
|
|
87
|
+
npx @srcroot/ui init Setup project
|
|
88
|
+
npx @srcroot/ui add [comps] Add components
|
|
209
89
|
npx @srcroot/ui add --all Add all components
|
|
210
|
-
npx @srcroot/ui list List
|
|
90
|
+
npx @srcroot/ui list List all components
|
|
211
91
|
```
|
|
212
92
|
|
|
213
93
|
## License
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@srcroot/ui",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"description": "A UI library with polymorphic, accessible React components",
|
|
5
5
|
"author": "Shifaul Islam",
|
|
6
6
|
"license": "MIT",
|
|
@@ -14,7 +14,8 @@
|
|
|
14
14
|
},
|
|
15
15
|
"files": [
|
|
16
16
|
"dist",
|
|
17
|
-
"src/registry"
|
|
17
|
+
"src/registry",
|
|
18
|
+
"README.md"
|
|
18
19
|
],
|
|
19
20
|
"keywords": [
|
|
20
21
|
"react",
|