@retrodevs/ui-library 0.4.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 +180 -0
- package/dist/index.d.ts +1840 -0
- package/dist/index.js +32392 -0
- package/dist/styles.css +1 -0
- package/dist/styles.d.ts +1 -0
- package/dist/styles.js +1 -0
- package/package.json +78 -0
package/README.md
ADDED
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
# @retrodevs/ui-library
|
|
2
|
+
|
|
3
|
+
A modern, ESM-only React UI component library built with Vite, TypeScript, and Tailwind CSS.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- 🚀 **Pure ESM** - Modern ES modules only, no CommonJS
|
|
8
|
+
- 📦 **Tree-shakeable** - Import only what you need
|
|
9
|
+
- 🎨 **Tailwind CSS** - Styled with Tailwind CSS and CSS variables
|
|
10
|
+
- 🧩 **Radix UI** - Built on accessible Radix UI primitives
|
|
11
|
+
- 📝 **TypeScript** - Fully typed with TypeScript
|
|
12
|
+
- 🎭 **React Cosmos** - Component development and documentation with Cosmos
|
|
13
|
+
- 🎯 **Zero Runtime** - No runtime dependencies for styling
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm install @retrodevs/ui-library
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### Peer Dependencies
|
|
22
|
+
|
|
23
|
+
This library requires React and React DOM as peer dependencies:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
npm install react react-dom
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Usage
|
|
30
|
+
|
|
31
|
+
```tsx
|
|
32
|
+
import { Button, Card, Input } from '@retrodevs/ui-library'
|
|
33
|
+
|
|
34
|
+
function App() {
|
|
35
|
+
return (
|
|
36
|
+
<div>
|
|
37
|
+
<Button variant="default">Click me</Button>
|
|
38
|
+
<Card>
|
|
39
|
+
<CardHeader>
|
|
40
|
+
<CardTitle>Card Title</CardTitle>
|
|
41
|
+
</CardHeader>
|
|
42
|
+
<CardContent>
|
|
43
|
+
<Input placeholder="Enter text..." />
|
|
44
|
+
</CardContent>
|
|
45
|
+
</Card>
|
|
46
|
+
</div>
|
|
47
|
+
)
|
|
48
|
+
}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Components
|
|
52
|
+
|
|
53
|
+
### UI Components
|
|
54
|
+
|
|
55
|
+
- **Button** - Versatile button component with multiple variants
|
|
56
|
+
- **Card** - Container component for content sections
|
|
57
|
+
- **Input** - Text input component
|
|
58
|
+
- **Avatar** - User avatar with image and fallback
|
|
59
|
+
- **Checkbox** - Checkbox input component
|
|
60
|
+
- **Switch** - Toggle switch component
|
|
61
|
+
- **Dialog** - Modal dialog component
|
|
62
|
+
- **AlertDialog** - Alert dialog component
|
|
63
|
+
- **Popover** - Popover component
|
|
64
|
+
- **Select** - Select dropdown component
|
|
65
|
+
- **Sheet** - Side sheet component
|
|
66
|
+
- **Tabs** - Tab navigation component
|
|
67
|
+
- **Tooltip** - Tooltip component
|
|
68
|
+
- **DropdownMenu** - Dropdown menu component
|
|
69
|
+
- **Form** - Form component with validation
|
|
70
|
+
- **Label** - Form label component
|
|
71
|
+
- **Textarea** - Textarea input component
|
|
72
|
+
- **Carousel** - Carousel component
|
|
73
|
+
- **Table** - Table component
|
|
74
|
+
- **Toaster** - Toast notification component
|
|
75
|
+
- **Chart** - Chart components (ChartContainer, ChartTooltip, etc.)
|
|
76
|
+
|
|
77
|
+
### Reusable Components
|
|
78
|
+
|
|
79
|
+
- **BaseCarousel** - Base carousel component
|
|
80
|
+
- **BasePopover** - Base popover component
|
|
81
|
+
- **BaseSelect** - Base select component
|
|
82
|
+
- **BaseSheet** - Base sheet component
|
|
83
|
+
- **BaseTooltip** - Base tooltip component
|
|
84
|
+
- **FormBase** - Base form component
|
|
85
|
+
- **FormField** - Form field component
|
|
86
|
+
- **FormFooter** - Form footer component
|
|
87
|
+
- **BaseDropdown** - Base dropdown component
|
|
88
|
+
- **BaseConfirmation** - Base confirmation dialog component
|
|
89
|
+
- **BaseAvatar** - Base avatar component
|
|
90
|
+
|
|
91
|
+
## Development
|
|
92
|
+
|
|
93
|
+
### Prerequisites
|
|
94
|
+
|
|
95
|
+
- Node.js 18+
|
|
96
|
+
- npm or yarn
|
|
97
|
+
|
|
98
|
+
### Setup
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
# Install dependencies
|
|
102
|
+
npm install
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### Build
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
# Build the library
|
|
109
|
+
npm run build
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
The build output will be in the `dist` directory:
|
|
113
|
+
- `dist/index.js` - ESM bundle
|
|
114
|
+
- `dist/index.d.ts` - TypeScript type definitions
|
|
115
|
+
|
|
116
|
+
### React Cosmos
|
|
117
|
+
|
|
118
|
+
This library uses React Cosmos for component development and documentation.
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
# Start Cosmos dev server
|
|
122
|
+
npm run cosmos
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
This will start the Cosmos UI at `http://localhost:5002` where you can:
|
|
126
|
+
- Browse and test all components
|
|
127
|
+
- View component fixtures
|
|
128
|
+
- Develop new components in isolation
|
|
129
|
+
|
|
130
|
+
### Linting
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
# Run ESLint
|
|
134
|
+
npm run lint
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
## Styling
|
|
138
|
+
|
|
139
|
+
This library uses Tailwind CSS with CSS variables for theming. To use the components in your project, you'll need to:
|
|
140
|
+
|
|
141
|
+
1. **Install Tailwind CSS** in your project (if not already installed)
|
|
142
|
+
2. **Import the CSS variables** - The library components use CSS variables for theming. You may need to configure your Tailwind setup to match the library's theme variables.
|
|
143
|
+
|
|
144
|
+
The library includes the following CSS variables:
|
|
145
|
+
- `--background`, `--foreground`
|
|
146
|
+
- `--primary`, `--primary-foreground`
|
|
147
|
+
- `--secondary`, `--secondary-foreground`
|
|
148
|
+
- `--muted`, `--muted-foreground`
|
|
149
|
+
- `--accent`, `--accent-foreground`
|
|
150
|
+
- `--destructive`, `--destructive-foreground`
|
|
151
|
+
- `--border`, `--input`, `--ring`
|
|
152
|
+
- And more...
|
|
153
|
+
|
|
154
|
+
## Publishing
|
|
155
|
+
|
|
156
|
+
This library is configured for npm publishing under the `@retrodevs` scope.
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
# Build the library
|
|
160
|
+
npm run build
|
|
161
|
+
|
|
162
|
+
# Publish to npm (requires npm login)
|
|
163
|
+
npm publish --access public
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
## Styles
|
|
167
|
+
|
|
168
|
+
Import the library’s base styles once in your app (after your Tailwind setup):
|
|
169
|
+
|
|
170
|
+
```ts
|
|
171
|
+
import "@retrodevs/ui-library/styles.css";
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
## License
|
|
175
|
+
|
|
176
|
+
MIT
|
|
177
|
+
|
|
178
|
+
## Contributing
|
|
179
|
+
|
|
180
|
+
Contributions are welcome! Please feel free to submit a Pull Request.
|