banhaten-ui 0.0.9
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 +275 -0
- package/dist/assets/index-BUzQLa3D.js +120 -0
- package/dist/assets/index-CxVUKmCr.css +1 -0
- package/dist/index.html +20 -0
- package/package.json +96 -0
- package/tailwind.preset.js +277 -0
package/README.md
ADDED
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
# @banhaten/design-system
|
|
2
|
+
|
|
3
|
+
A comprehensive React component library with full RTL (Right-to-Left) support, built with TypeScript and Tailwind CSS. Sourced from a complete RTL-supporting Figma library.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- 🌍 **Full RTL Support** - Built-in support for Arabic, Hebrew, and other RTL languages
|
|
8
|
+
- 🎨 **10 Production-Ready Components** - Button, Badge, SocialButton, ButtonGroup, Checkbox, CheckmarkCard, Divider, Menu, Accordion, Alert
|
|
9
|
+
- 📦 **Tree-Shakeable** - Import only what you need
|
|
10
|
+
- 🎯 **TypeScript First** - Full type safety with comprehensive type definitions
|
|
11
|
+
- 🎭 **Tailwind CSS** - Customizable design tokens via Tailwind preset
|
|
12
|
+
- 📐 **Figma-Accurate** - Matches design specs precisely with visual documentation
|
|
13
|
+
- ⚡ **Modern Stack** - React 18, TypeScript, Vite
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm install @banhaten/design-system
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### Peer Dependencies
|
|
22
|
+
|
|
23
|
+
This library requires the following peer dependencies:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
npm install react react-dom tailwindcss
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Quick Start
|
|
30
|
+
|
|
31
|
+
### 1. Import Styles
|
|
32
|
+
|
|
33
|
+
Import the base styles in your main entry file:
|
|
34
|
+
|
|
35
|
+
```typescript
|
|
36
|
+
import '@banhaten/design-system/dist/style.css';
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### 2. Configure Tailwind CSS
|
|
40
|
+
|
|
41
|
+
Extend your `tailwind.config.js` with the Banhaten preset:
|
|
42
|
+
|
|
43
|
+
```javascript
|
|
44
|
+
module.exports = {
|
|
45
|
+
presets: [
|
|
46
|
+
require('@banhaten/design-system/tailwind.preset')
|
|
47
|
+
],
|
|
48
|
+
content: [
|
|
49
|
+
'./src/**/*.{js,jsx,ts,tsx}',
|
|
50
|
+
'./node_modules/@banhaten/design-system/dist/**/*.js'
|
|
51
|
+
],
|
|
52
|
+
// Your custom config...
|
|
53
|
+
}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### 3. Use Components
|
|
57
|
+
|
|
58
|
+
```typescript
|
|
59
|
+
import { Button, Badge, Alert } from '@banhaten/design-system';
|
|
60
|
+
|
|
61
|
+
function App() {
|
|
62
|
+
return (
|
|
63
|
+
<div>
|
|
64
|
+
<Button variant="primary" size="md">
|
|
65
|
+
Click Me
|
|
66
|
+
</Button>
|
|
67
|
+
|
|
68
|
+
<Badge color="blue" style="Solid">
|
|
69
|
+
New
|
|
70
|
+
</Badge>
|
|
71
|
+
|
|
72
|
+
<Alert
|
|
73
|
+
variant="info"
|
|
74
|
+
title="Welcome"
|
|
75
|
+
message="This is a sample alert"
|
|
76
|
+
/>
|
|
77
|
+
</div>
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## RTL Support
|
|
83
|
+
|
|
84
|
+
All components support RTL out of the box. Simply pass the `rtl` prop:
|
|
85
|
+
|
|
86
|
+
```typescript
|
|
87
|
+
<Button rtl variant="primary">
|
|
88
|
+
زر
|
|
89
|
+
</Button>
|
|
90
|
+
|
|
91
|
+
<Badge rtl color="green">
|
|
92
|
+
جديد
|
|
93
|
+
</Badge>
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Available Components
|
|
97
|
+
|
|
98
|
+
### Buttons
|
|
99
|
+
- **Button** - Primary UI button with multiple variants, sizes, and icon support
|
|
100
|
+
- **SocialButton** - Pre-styled buttons for social platforms (Facebook, Google, Apple, etc.)
|
|
101
|
+
- **ButtonGroup** - Grouped button controls
|
|
102
|
+
|
|
103
|
+
### Form Controls
|
|
104
|
+
- **Checkbox** - Accessible checkbox with support text
|
|
105
|
+
- **CheckmarkCard** - Card-style selectable component
|
|
106
|
+
|
|
107
|
+
### Display
|
|
108
|
+
- **Badge** - Status indicators and labels
|
|
109
|
+
- **Alert** - Contextual feedback messages
|
|
110
|
+
- **Divider** - Visual separators
|
|
111
|
+
|
|
112
|
+
### Navigation
|
|
113
|
+
- **Menu** - Dropdown menu with rich item types
|
|
114
|
+
- **Accordion** - Collapsible content sections
|
|
115
|
+
|
|
116
|
+
### Other
|
|
117
|
+
- **CodeBlock** - Syntax-highlighted code display
|
|
118
|
+
|
|
119
|
+
## Component Examples
|
|
120
|
+
|
|
121
|
+
### Button with Icons
|
|
122
|
+
|
|
123
|
+
```typescript
|
|
124
|
+
import { Button } from '@banhaten/design-system';
|
|
125
|
+
import { Search, Settings } from 'lucide-react';
|
|
126
|
+
|
|
127
|
+
<Button
|
|
128
|
+
variant="primary"
|
|
129
|
+
size="md"
|
|
130
|
+
iconLeft={<Search />}
|
|
131
|
+
>
|
|
132
|
+
Search
|
|
133
|
+
</Button>
|
|
134
|
+
|
|
135
|
+
<Button
|
|
136
|
+
variant="outline"
|
|
137
|
+
icon={<Settings />}
|
|
138
|
+
/>
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### Badge Colors
|
|
142
|
+
|
|
143
|
+
```typescript
|
|
144
|
+
<Badge color="blue" style="Solid">Info</Badge>
|
|
145
|
+
<Badge color="green" style="Light">Success</Badge>
|
|
146
|
+
<Badge color="red" style="Outline">Error</Badge>
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### Accordion
|
|
150
|
+
|
|
151
|
+
```typescript
|
|
152
|
+
<Accordion
|
|
153
|
+
label="Section Title"
|
|
154
|
+
description="Section content goes here"
|
|
155
|
+
expandable
|
|
156
|
+
style="Boxed"
|
|
157
|
+
/>
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
## TypeScript Support
|
|
161
|
+
|
|
162
|
+
All components are fully typed with exported type definitions:
|
|
163
|
+
|
|
164
|
+
```typescript
|
|
165
|
+
import type {
|
|
166
|
+
ButtonProps,
|
|
167
|
+
ButtonVariant,
|
|
168
|
+
ButtonSize,
|
|
169
|
+
BadgeProps,
|
|
170
|
+
BadgeColor
|
|
171
|
+
} from '@banhaten/design-system';
|
|
172
|
+
|
|
173
|
+
const variant: ButtonVariant = 'primary';
|
|
174
|
+
const size: ButtonSize = 'md';
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
## Customization
|
|
178
|
+
|
|
179
|
+
### Design Tokens
|
|
180
|
+
|
|
181
|
+
The Tailwind preset includes:
|
|
182
|
+
- **Colors**: Primary, Critical, Neutral, and semantic colors
|
|
183
|
+
- **Shadows**: 3-layer shadow system matching Figma specs
|
|
184
|
+
- **Typography**: Inter, Noto Sans Arabic, JetBrains Mono, Space Grotesk
|
|
185
|
+
- **Spacing**: Consistent spacing scale
|
|
186
|
+
- **Border Radius**: Control-specific radii
|
|
187
|
+
|
|
188
|
+
### Overriding Defaults
|
|
189
|
+
|
|
190
|
+
```javascript
|
|
191
|
+
// tailwind.config.js
|
|
192
|
+
module.exports = {
|
|
193
|
+
presets: [require('@banhaten/design-system/tailwind.preset')],
|
|
194
|
+
theme: {
|
|
195
|
+
extend: {
|
|
196
|
+
colors: {
|
|
197
|
+
primary: {
|
|
198
|
+
// Override primary colors
|
|
199
|
+
600: '#your-color',
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
## Development
|
|
208
|
+
|
|
209
|
+
### Building from Source
|
|
210
|
+
|
|
211
|
+
```bash
|
|
212
|
+
# Install dependencies
|
|
213
|
+
npm install
|
|
214
|
+
|
|
215
|
+
# Build the library
|
|
216
|
+
npm run build
|
|
217
|
+
|
|
218
|
+
# Watch mode
|
|
219
|
+
npm run build:watch
|
|
220
|
+
|
|
221
|
+
# Type check
|
|
222
|
+
npm run typecheck
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
### Development Server
|
|
226
|
+
|
|
227
|
+
```bash
|
|
228
|
+
npm run dev
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
### Storybook
|
|
232
|
+
|
|
233
|
+
```bash
|
|
234
|
+
npm run storybook
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
## Package Structure
|
|
238
|
+
|
|
239
|
+
```
|
|
240
|
+
dist/
|
|
241
|
+
├── index.js # ESM bundle
|
|
242
|
+
├── index.cjs # CommonJS bundle
|
|
243
|
+
├── index.d.ts # TypeScript definitions
|
|
244
|
+
└── style.css # Component styles
|
|
245
|
+
|
|
246
|
+
tailwind.preset.js # Tailwind configuration preset
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
## Browser Support
|
|
250
|
+
|
|
251
|
+
- Chrome (latest)
|
|
252
|
+
- Firefox (latest)
|
|
253
|
+
- Safari (latest)
|
|
254
|
+
- Edge (latest)
|
|
255
|
+
|
|
256
|
+
## License
|
|
257
|
+
|
|
258
|
+
ISC
|
|
259
|
+
|
|
260
|
+
## Contributing
|
|
261
|
+
|
|
262
|
+
Contributions are welcome! Please ensure:
|
|
263
|
+
- Components maintain RTL support
|
|
264
|
+
- TypeScript types are comprehensive
|
|
265
|
+
- Figma design specs are matched
|
|
266
|
+
- Tests pass and code is linted
|
|
267
|
+
|
|
268
|
+
## Credits
|
|
269
|
+
|
|
270
|
+
UI Design by the Banhaten design team.
|
|
271
|
+
Developed and maintained by Ibrahim SP.
|
|
272
|
+
|
|
273
|
+
---
|
|
274
|
+
|
|
275
|
+
**Need Help?** Check out our [Storybook documentation](#) or [open an issue](https://github.com/ibrahimSP/banhaten-design-system/issues).
|