braid-ui 1.0.68 → 1.0.70
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 +229 -84
- package/dist/css/braid-ui.css +185 -0
- package/dist/css/braid-ui.min.css +1 -1
- package/dist/index.cjs +3 -18712
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +3 -18462
- package/dist/index.js.map +1 -1
- package/package.json +6 -23
- package/tailwind.config.standalone.cjs +0 -137
- package/tailwind.config.standalone.d.ts +0 -5
- package/tailwind.config.standalone.js +0 -138
- package/tailwind.preset.cjs +0 -97
- package/tailwind.preset.d.ts +0 -5
- package/tailwind.preset.js +0 -98
package/README.md
CHANGED
|
@@ -1,41 +1,90 @@
|
|
|
1
|
-
# Braid UI
|
|
1
|
+
# Braid UI
|
|
2
2
|
|
|
3
|
-
A comprehensive React UI component library built with TypeScript, Tailwind CSS, and Radix UI.
|
|
3
|
+
A comprehensive React UI component library built with TypeScript, Tailwind CSS, and Radix UI primitives.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
8
|
npm install braid-ui
|
|
9
|
+
# or
|
|
10
|
+
yarn add braid-ui
|
|
11
|
+
# or
|
|
12
|
+
pnpm add braid-ui
|
|
9
13
|
```
|
|
10
14
|
|
|
15
|
+
## Quick Start
|
|
16
|
+
|
|
17
|
+
```tsx
|
|
18
|
+
import { Button, Card } from 'braid-ui'
|
|
19
|
+
import 'braid-ui/styles'
|
|
20
|
+
|
|
21
|
+
function App() {
|
|
22
|
+
return (
|
|
23
|
+
<Card>
|
|
24
|
+
<Button>Click me</Button>
|
|
25
|
+
</Card>
|
|
26
|
+
)
|
|
27
|
+
}
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Peer Dependencies
|
|
31
|
+
|
|
32
|
+
Braid UI requires the following peer dependencies. Make sure they are installed:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
npm install react react-dom react-router-dom \
|
|
36
|
+
@radix-ui/react-accordion @radix-ui/react-alert-dialog \
|
|
37
|
+
@radix-ui/react-aspect-ratio @radix-ui/react-avatar \
|
|
38
|
+
@radix-ui/react-checkbox @radix-ui/react-collapsible \
|
|
39
|
+
@radix-ui/react-context-menu @radix-ui/react-dialog \
|
|
40
|
+
@radix-ui/react-dropdown-menu @radix-ui/react-hover-card \
|
|
41
|
+
@radix-ui/react-label @radix-ui/react-menubar \
|
|
42
|
+
@radix-ui/react-navigation-menu @radix-ui/react-popover \
|
|
43
|
+
@radix-ui/react-progress @radix-ui/react-radio-group \
|
|
44
|
+
@radix-ui/react-scroll-area @radix-ui/react-select \
|
|
45
|
+
@radix-ui/react-separator @radix-ui/react-slider \
|
|
46
|
+
@radix-ui/react-slot @radix-ui/react-switch \
|
|
47
|
+
@radix-ui/react-tabs @radix-ui/react-toast \
|
|
48
|
+
@radix-ui/react-toggle @radix-ui/react-toggle-group \
|
|
49
|
+
@radix-ui/react-tooltip \
|
|
50
|
+
@tanstack/react-query @hookform/resolvers \
|
|
51
|
+
class-variance-authority clsx cmdk date-fns \
|
|
52
|
+
embla-carousel-react input-otp lucide-react next-themes \
|
|
53
|
+
react-day-picker react-hook-form react-resizable-panels \
|
|
54
|
+
recharts sonner tailwind-merge tailwindcss-animate vaul zod \
|
|
55
|
+
lodash react-pdf
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Or install them individually as needed. See the full list in `package.json` under `peerDependencies`.
|
|
59
|
+
|
|
11
60
|
## Setup
|
|
12
61
|
|
|
13
|
-
### 1. Import
|
|
62
|
+
### 1. Import Styles
|
|
14
63
|
|
|
15
|
-
|
|
64
|
+
Import the CSS styles in your application entry point:
|
|
16
65
|
|
|
17
66
|
```tsx
|
|
18
|
-
// In your main App.tsx or
|
|
67
|
+
// In your main.tsx, App.tsx, or index.tsx
|
|
19
68
|
import 'braid-ui/styles'
|
|
20
69
|
```
|
|
21
70
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
Your project needs Tailwind CSS configured. If you don't have it:
|
|
71
|
+
Alternatively, import in your main CSS file:
|
|
25
72
|
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
|
|
73
|
+
```css
|
|
74
|
+
/* In your globals.css or main.css */
|
|
75
|
+
@import 'braid-ui/styles';
|
|
29
76
|
```
|
|
30
77
|
|
|
31
|
-
|
|
78
|
+
### 2. Configure Tailwind CSS
|
|
79
|
+
|
|
80
|
+
Braid UI requires Tailwind CSS to be configured in your project. Add the library's theme extensions to your `tailwind.config.js`:
|
|
32
81
|
|
|
33
82
|
```js
|
|
34
83
|
/** @type {import('tailwindcss').Config} */
|
|
35
84
|
module.exports = {
|
|
36
85
|
content: [
|
|
37
86
|
"./src/**/*.{js,ts,jsx,tsx}",
|
|
38
|
-
"./node_modules/braid-ui/dist/**/*.{js,ts,jsx,tsx}",
|
|
87
|
+
"./node_modules/braid-ui/dist/**/*.{js,ts,jsx,tsx}",
|
|
39
88
|
],
|
|
40
89
|
theme: {
|
|
41
90
|
extend: {
|
|
@@ -48,164 +97,260 @@ module.exports = {
|
|
|
48
97
|
primary: {
|
|
49
98
|
DEFAULT: 'hsl(var(--primary))',
|
|
50
99
|
foreground: 'hsl(var(--primary-foreground))',
|
|
100
|
+
glow: 'hsl(var(--primary-glow))'
|
|
51
101
|
},
|
|
52
102
|
secondary: {
|
|
53
103
|
DEFAULT: 'hsl(var(--secondary))',
|
|
54
|
-
foreground: 'hsl(var(--secondary-foreground))'
|
|
104
|
+
foreground: 'hsl(var(--secondary-foreground))'
|
|
55
105
|
},
|
|
56
106
|
destructive: {
|
|
57
107
|
DEFAULT: 'hsl(var(--destructive))',
|
|
58
|
-
foreground: 'hsl(var(--destructive-foreground))'
|
|
108
|
+
foreground: 'hsl(var(--destructive-foreground))'
|
|
109
|
+
},
|
|
110
|
+
success: {
|
|
111
|
+
DEFAULT: 'hsl(var(--success))',
|
|
112
|
+
foreground: 'hsl(var(--success-foreground))'
|
|
113
|
+
},
|
|
114
|
+
warning: {
|
|
115
|
+
DEFAULT: 'hsl(var(--warning))',
|
|
116
|
+
foreground: 'hsl(var(--warning-foreground))'
|
|
59
117
|
},
|
|
60
118
|
muted: {
|
|
61
119
|
DEFAULT: 'hsl(var(--muted))',
|
|
62
|
-
foreground: 'hsl(var(--muted-foreground))'
|
|
120
|
+
foreground: 'hsl(var(--muted-foreground))'
|
|
63
121
|
},
|
|
64
122
|
accent: {
|
|
65
123
|
DEFAULT: 'hsl(var(--accent))',
|
|
66
|
-
foreground: 'hsl(var(--accent-foreground))'
|
|
124
|
+
foreground: 'hsl(var(--accent-foreground))'
|
|
67
125
|
},
|
|
68
126
|
popover: {
|
|
69
127
|
DEFAULT: 'hsl(var(--popover))',
|
|
70
|
-
foreground: 'hsl(var(--popover-foreground))'
|
|
128
|
+
foreground: 'hsl(var(--popover-foreground))'
|
|
71
129
|
},
|
|
72
130
|
card: {
|
|
73
131
|
DEFAULT: 'hsl(var(--card))',
|
|
74
|
-
foreground: 'hsl(var(--card-foreground))'
|
|
132
|
+
foreground: 'hsl(var(--card-foreground))'
|
|
133
|
+
},
|
|
134
|
+
form: {
|
|
135
|
+
background: 'hsl(var(--form-background))',
|
|
136
|
+
border: 'hsl(var(--form-border))',
|
|
137
|
+
'border-focus': 'hsl(var(--form-border-focus))',
|
|
138
|
+
'border-error': 'hsl(var(--form-border-error))',
|
|
139
|
+
'border-success': 'hsl(var(--form-border-success))'
|
|
75
140
|
},
|
|
141
|
+
sidebar: {
|
|
142
|
+
DEFAULT: 'hsl(var(--sidebar-background))',
|
|
143
|
+
foreground: 'hsl(var(--sidebar-foreground))',
|
|
144
|
+
primary: 'hsl(var(--sidebar-primary))',
|
|
145
|
+
'primary-foreground': 'hsl(var(--sidebar-primary-foreground))',
|
|
146
|
+
accent: 'hsl(var(--sidebar-accent))',
|
|
147
|
+
'accent-foreground': 'hsl(var(--sidebar-accent-foreground))',
|
|
148
|
+
border: 'hsl(var(--sidebar-border))',
|
|
149
|
+
ring: 'hsl(var(--sidebar-ring))'
|
|
150
|
+
}
|
|
76
151
|
},
|
|
77
152
|
borderRadius: {
|
|
78
153
|
lg: 'var(--radius)',
|
|
79
154
|
md: 'calc(var(--radius) - 2px)',
|
|
80
|
-
sm: 'calc(var(--radius) - 4px)'
|
|
155
|
+
sm: 'calc(var(--radius) - 4px)'
|
|
81
156
|
},
|
|
82
|
-
|
|
157
|
+
keyframes: {
|
|
158
|
+
'accordion-down': {
|
|
159
|
+
from: { height: '0' },
|
|
160
|
+
to: { height: 'var(--radix-accordion-content-height)' }
|
|
161
|
+
},
|
|
162
|
+
'accordion-up': {
|
|
163
|
+
from: { height: 'var(--radix-accordion-content-height)' },
|
|
164
|
+
to: { height: '0' }
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
animation: {
|
|
168
|
+
'accordion-down': 'accordion-down 0.2s ease-out',
|
|
169
|
+
'accordion-up': 'accordion-up 0.2s ease-out'
|
|
170
|
+
},
|
|
171
|
+
backgroundImage: {
|
|
172
|
+
'gradient-primary': 'var(--gradient-primary)',
|
|
173
|
+
'gradient-subtle': 'var(--gradient-subtle)'
|
|
174
|
+
},
|
|
175
|
+
boxShadow: {
|
|
176
|
+
'form': 'var(--shadow-form)',
|
|
177
|
+
'form-focus': 'var(--shadow-form-focus)',
|
|
178
|
+
'form-error': 'var(--shadow-form-error)'
|
|
179
|
+
},
|
|
180
|
+
transitionProperty: {
|
|
181
|
+
'form': 'var(--transition-form)'
|
|
182
|
+
}
|
|
183
|
+
}
|
|
83
184
|
},
|
|
84
|
-
plugins: [],
|
|
185
|
+
plugins: [require('tailwindcss-animate')],
|
|
85
186
|
}
|
|
86
187
|
```
|
|
87
188
|
|
|
189
|
+
**Important:** Make sure `tailwindcss-animate` is installed:
|
|
190
|
+
|
|
191
|
+
```bash
|
|
192
|
+
npm install -D tailwindcss-animate
|
|
193
|
+
```
|
|
194
|
+
|
|
88
195
|
## Usage
|
|
89
196
|
|
|
90
|
-
###
|
|
197
|
+
### Importing Components
|
|
198
|
+
|
|
199
|
+
Import components directly from the main package:
|
|
91
200
|
|
|
92
201
|
```tsx
|
|
93
|
-
import { Button, Card, Dialog } from 'braid-ui
|
|
202
|
+
import { Button, Card, Dialog, Input } from 'braid-ui'
|
|
203
|
+
```
|
|
94
204
|
|
|
95
|
-
|
|
205
|
+
### Using Components
|
|
206
|
+
|
|
207
|
+
```tsx
|
|
208
|
+
import { Button, Card, CardHeader, CardTitle, CardContent } from 'braid-ui'
|
|
209
|
+
|
|
210
|
+
function MyComponent() {
|
|
96
211
|
return (
|
|
97
|
-
<
|
|
98
|
-
<
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
212
|
+
<Card>
|
|
213
|
+
<CardHeader>
|
|
214
|
+
<CardTitle>Card Title</CardTitle>
|
|
215
|
+
</CardHeader>
|
|
216
|
+
<CardContent>
|
|
217
|
+
<Button>Click me</Button>
|
|
218
|
+
</CardContent>
|
|
219
|
+
</Card>
|
|
104
220
|
)
|
|
105
221
|
}
|
|
106
222
|
```
|
|
107
223
|
|
|
108
|
-
###
|
|
224
|
+
### Using Hooks
|
|
109
225
|
|
|
110
226
|
```tsx
|
|
111
|
-
import { useToast, useEditState } from 'braid-ui
|
|
227
|
+
import { useToast, useEditState } from 'braid-ui'
|
|
112
228
|
|
|
113
229
|
function MyComponent() {
|
|
114
230
|
const { toast } = useToast()
|
|
115
|
-
const editState = useEditState()
|
|
116
231
|
|
|
117
232
|
return (
|
|
118
|
-
<button onClick={() => toast({
|
|
233
|
+
<button onClick={() => toast({
|
|
234
|
+
title: 'Success!',
|
|
235
|
+
description: 'Action completed successfully.'
|
|
236
|
+
})}>
|
|
119
237
|
Show Toast
|
|
120
238
|
</button>
|
|
121
239
|
)
|
|
122
240
|
}
|
|
123
241
|
```
|
|
124
242
|
|
|
125
|
-
###
|
|
243
|
+
### Using Pages
|
|
126
244
|
|
|
127
245
|
```tsx
|
|
128
|
-
import { Dashboard, Alerts,
|
|
246
|
+
import { Dashboard, Alerts, Businesses } from 'braid-ui'
|
|
247
|
+
import { BrowserRouter, Routes, Route } from 'react-router-dom'
|
|
129
248
|
|
|
130
249
|
function App() {
|
|
131
250
|
return (
|
|
132
|
-
<
|
|
251
|
+
<BrowserRouter>
|
|
133
252
|
<Routes>
|
|
134
253
|
<Route path="/" element={<Dashboard />} />
|
|
135
254
|
<Route path="/alerts" element={<Alerts />} />
|
|
136
|
-
<Route path="/
|
|
255
|
+
<Route path="/businesses" element={<Businesses />} />
|
|
137
256
|
</Routes>
|
|
138
|
-
</
|
|
257
|
+
</BrowserRouter>
|
|
139
258
|
)
|
|
140
259
|
}
|
|
141
260
|
```
|
|
142
261
|
|
|
143
|
-
|
|
262
|
+
## Styling Options
|
|
263
|
+
|
|
264
|
+
### With Tailwind CSS (Recommended)
|
|
265
|
+
|
|
266
|
+
If you're using Tailwind CSS, import the styles and configure your Tailwind config as shown above.
|
|
267
|
+
|
|
268
|
+
### Without Tailwind CSS
|
|
144
269
|
|
|
145
|
-
|
|
270
|
+
If you're not using Tailwind CSS, you can use the pre-compiled CSS:
|
|
146
271
|
|
|
147
272
|
```tsx
|
|
148
|
-
// Import
|
|
149
|
-
import
|
|
273
|
+
// Import pre-compiled CSS
|
|
274
|
+
import 'braid-ui/css'
|
|
275
|
+
// or minified version
|
|
276
|
+
import 'braid-ui/css/min'
|
|
277
|
+
```
|
|
150
278
|
|
|
151
|
-
|
|
152
|
-
import { useToast } from 'braid-ui-kit/hooks'
|
|
279
|
+
You can also import just the CSS variables:
|
|
153
280
|
|
|
154
|
-
|
|
155
|
-
import
|
|
281
|
+
```tsx
|
|
282
|
+
import 'braid-ui/css/variables'
|
|
156
283
|
```
|
|
157
284
|
|
|
158
|
-
##
|
|
285
|
+
## Customizing Colors
|
|
159
286
|
|
|
160
|
-
|
|
287
|
+
You can customize the color scheme by overriding CSS variables:
|
|
161
288
|
|
|
162
|
-
```
|
|
163
|
-
|
|
289
|
+
```css
|
|
290
|
+
:root {
|
|
291
|
+
--primary: 204 100% 54%;
|
|
292
|
+
--primary-foreground: 0 0% 100%;
|
|
293
|
+
--background: 240 10% 98%;
|
|
294
|
+
--foreground: 240 10% 8%;
|
|
295
|
+
/* ... override other variables as needed */
|
|
296
|
+
}
|
|
164
297
|
```
|
|
165
298
|
|
|
166
|
-
|
|
299
|
+
**Note:** Colors should be defined as HSL values without the `hsl()` wrapper.
|
|
167
300
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
301
|
+
## Dark Mode
|
|
302
|
+
|
|
303
|
+
Braid UI supports dark mode automatically. The CSS variables switch when the `.dark` class is present on a parent element (usually `<html>` or `<body>`).
|
|
304
|
+
|
|
305
|
+
If you're using a theme provider like `next-themes`:
|
|
171
306
|
|
|
172
|
-
|
|
307
|
+
```tsx
|
|
308
|
+
import { ThemeProvider } from 'next-themes'
|
|
173
309
|
|
|
174
|
-
|
|
310
|
+
function App() {
|
|
311
|
+
return (
|
|
312
|
+
<ThemeProvider attribute="class" defaultTheme="system">
|
|
313
|
+
{/* Your app */}
|
|
314
|
+
</ThemeProvider>
|
|
315
|
+
)
|
|
316
|
+
}
|
|
317
|
+
```
|
|
175
318
|
|
|
176
|
-
|
|
177
|
-
- **Form Components**: Form fields, inputs, and validation components
|
|
178
|
-
- **Layout Components**: Page layouts, containers, and grid systems
|
|
179
|
-
- **Business Components**: Specialized components for business applications
|
|
180
|
-
- **Alert Components**: Alert and notification components
|
|
319
|
+
## TypeScript
|
|
181
320
|
|
|
182
|
-
|
|
321
|
+
Braid UI is built with TypeScript and includes type definitions. No additional `@types` packages are required.
|
|
183
322
|
|
|
184
|
-
|
|
185
|
-
- `useEditState`: Edit state management
|
|
186
|
-
- `useFormWithEditState`: Form state with edit capabilities
|
|
187
|
-
- `useMobile`: Mobile detection hook
|
|
323
|
+
## Next.js Configuration
|
|
188
324
|
|
|
189
|
-
|
|
325
|
+
If you're using Braid UI in a Next.js application and need to use components that include PDF viewing (like `BusinessDetailView` with `BusinessDocuments`), you'll need to configure Next.js webpack to handle `react-pdf` dependencies correctly.
|
|
190
326
|
|
|
191
|
-
|
|
327
|
+
Add the following to your `next.config.js`:
|
|
192
328
|
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
-
|
|
197
|
-
|
|
329
|
+
```js
|
|
330
|
+
const nextConfig = {
|
|
331
|
+
webpack: (config, { isServer }) => {
|
|
332
|
+
// Fix for react-pdf/pdfjs-dist in Next.js
|
|
333
|
+
if (!isServer) {
|
|
334
|
+
config.resolve.alias = {
|
|
335
|
+
...config.resolve.alias,
|
|
336
|
+
canvas: false,
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
return config
|
|
340
|
+
},
|
|
341
|
+
}
|
|
198
342
|
|
|
199
|
-
|
|
343
|
+
module.exports = nextConfig
|
|
344
|
+
```
|
|
200
345
|
|
|
201
|
-
This
|
|
346
|
+
This prevents Next.js from trying to bundle Node.js-specific dependencies that `pdfjs-dist` might reference during webpack analysis.
|
|
202
347
|
|
|
203
|
-
-
|
|
204
|
-
- React DOM
|
|
205
|
-
- Various Radix UI components
|
|
206
|
-
- Tailwind CSS
|
|
207
|
-
- Lucide React icons
|
|
348
|
+
**Note**: If you're not using any PDF-related components, this configuration is optional.
|
|
208
349
|
|
|
209
350
|
## License
|
|
210
351
|
|
|
211
|
-
MIT
|
|
352
|
+
MIT
|
|
353
|
+
|
|
354
|
+
## Repository
|
|
355
|
+
|
|
356
|
+
[GitHub Repository](https://github.com/your-username/braid-ui-kit.git)
|