@clarlabs/ui 0.1.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 +172 -0
- package/dist/index.d.ts +625 -0
- package/dist/index.js +24 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +1625 -0
- package/dist/index.mjs.map +1 -0
- package/dist/ui.css +1 -0
- package/package.json +68 -0
package/README.md
ADDED
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
# @clarlabs/ui
|
|
2
|
+
|
|
3
|
+
A modern, lightweight UI component library for React applications.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @clarlabs/ui
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
or
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
yarn add @clarlabs/ui
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
or
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
pnpm add @clarlabs/ui
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Usage
|
|
24
|
+
|
|
25
|
+
### Basic Example
|
|
26
|
+
|
|
27
|
+
```tsx
|
|
28
|
+
import { Button, Input } from '@clarlabs/ui'
|
|
29
|
+
|
|
30
|
+
function App() {
|
|
31
|
+
return (
|
|
32
|
+
<div>
|
|
33
|
+
<Button variant="primary" size="md">
|
|
34
|
+
Click me
|
|
35
|
+
</Button>
|
|
36
|
+
|
|
37
|
+
<Input label="Email" type="email" placeholder="Enter your email" />
|
|
38
|
+
</div>
|
|
39
|
+
)
|
|
40
|
+
}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Components
|
|
44
|
+
|
|
45
|
+
### Button
|
|
46
|
+
|
|
47
|
+
A versatile button component with multiple variants and sizes.
|
|
48
|
+
|
|
49
|
+
**Props:**
|
|
50
|
+
|
|
51
|
+
- `variant?: 'primary' | 'secondary' | 'outline' | 'ghost'` - Button style variant (default: `'primary'`)
|
|
52
|
+
- `size?: 'sm' | 'md' | 'lg'` - Button size (default: `'md'`)
|
|
53
|
+
- `fullWidth?: boolean` - Whether button should take full width (default: `false`)
|
|
54
|
+
- All standard HTML button attributes are supported
|
|
55
|
+
|
|
56
|
+
**Example:**
|
|
57
|
+
|
|
58
|
+
```tsx
|
|
59
|
+
import { Button } from '@clarlabs/ui'
|
|
60
|
+
|
|
61
|
+
function Example() {
|
|
62
|
+
return (
|
|
63
|
+
<>
|
|
64
|
+
<Button variant="primary" size="lg">
|
|
65
|
+
Primary Button
|
|
66
|
+
</Button>
|
|
67
|
+
|
|
68
|
+
<Button variant="outline" size="sm" onClick={() => console.log('clicked')}>
|
|
69
|
+
Small Outline
|
|
70
|
+
</Button>
|
|
71
|
+
|
|
72
|
+
<Button variant="ghost" disabled>
|
|
73
|
+
Disabled Ghost
|
|
74
|
+
</Button>
|
|
75
|
+
</>
|
|
76
|
+
)
|
|
77
|
+
}
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Input
|
|
81
|
+
|
|
82
|
+
A flexible input component with label, error, and helper text support.
|
|
83
|
+
|
|
84
|
+
**Props:**
|
|
85
|
+
|
|
86
|
+
- `label?: string` - Label text for the input
|
|
87
|
+
- `error?: string` - Error message to display
|
|
88
|
+
- `helperText?: string` - Helper text to display below input
|
|
89
|
+
- `fullWidth?: boolean` - Whether input should take full width (default: `false`)
|
|
90
|
+
- All standard HTML input attributes are supported
|
|
91
|
+
|
|
92
|
+
**Example:**
|
|
93
|
+
|
|
94
|
+
```tsx
|
|
95
|
+
import { Input } from '@clarlabs/ui'
|
|
96
|
+
|
|
97
|
+
function Example() {
|
|
98
|
+
const [value, setValue] = useState('')
|
|
99
|
+
const [error, setError] = useState('')
|
|
100
|
+
|
|
101
|
+
return (
|
|
102
|
+
<>
|
|
103
|
+
<Input
|
|
104
|
+
label="Username"
|
|
105
|
+
value={value}
|
|
106
|
+
onChange={(e) => setValue(e.target.value)}
|
|
107
|
+
placeholder="Enter username"
|
|
108
|
+
helperText="Choose a unique username"
|
|
109
|
+
/>
|
|
110
|
+
|
|
111
|
+
<Input label="Email" type="email" error={error} fullWidth />
|
|
112
|
+
</>
|
|
113
|
+
)
|
|
114
|
+
}
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## Development
|
|
118
|
+
|
|
119
|
+
### Prerequisites
|
|
120
|
+
|
|
121
|
+
- Node.js 16+
|
|
122
|
+
- npm/yarn/pnpm
|
|
123
|
+
|
|
124
|
+
### Setup
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
# Install dependencies
|
|
128
|
+
npm install
|
|
129
|
+
|
|
130
|
+
# Build the library
|
|
131
|
+
npm run build
|
|
132
|
+
|
|
133
|
+
# Watch mode for development
|
|
134
|
+
npm run dev
|
|
135
|
+
|
|
136
|
+
# Type checking
|
|
137
|
+
npm run typecheck
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### Project Structure
|
|
141
|
+
|
|
142
|
+
```
|
|
143
|
+
src/
|
|
144
|
+
├── components/
|
|
145
|
+
│ ├── Button/
|
|
146
|
+
│ │ ├── Button.tsx
|
|
147
|
+
│ │ ├── Button.css
|
|
148
|
+
│ │ └── index.ts
|
|
149
|
+
│ └── Input/
|
|
150
|
+
│ ├── Input.tsx
|
|
151
|
+
│ ├── Input.css
|
|
152
|
+
│ └── index.ts
|
|
153
|
+
└── index.ts
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
## Publishing
|
|
157
|
+
|
|
158
|
+
This package is configured for publishing to NPM. To publish:
|
|
159
|
+
|
|
160
|
+
1. Update version in `package.json`
|
|
161
|
+
2. Build the package: `npm run build`
|
|
162
|
+
3. Publish: `npm publish`
|
|
163
|
+
|
|
164
|
+
The package is configured with `"access": "public"` for scoped packages.
|
|
165
|
+
|
|
166
|
+
## License
|
|
167
|
+
|
|
168
|
+
MIT
|
|
169
|
+
|
|
170
|
+
## Contributing
|
|
171
|
+
|
|
172
|
+
Contributions are welcome! Please feel free to submit a Pull Request.
|