@bienui/core 1.0.1 → 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 +191 -39
- package/dist/bien-ui.cjs.js +19 -19
- package/dist/bien-ui.cjs.js.map +1 -1
- package/dist/bien-ui.css +1 -0
- package/dist/bien-ui.esm.js +3216 -3057
- package/dist/bien-ui.esm.js.map +1 -1
- package/dist/components/Interactive/Drawer.d.ts +29 -0
- package/dist/components/Interactive/index.d.ts +1 -0
- package/dist/index.d.ts +2 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -152,17 +152,18 @@ yarn add @bienui/core
|
|
|
152
152
|
pnpm add @bienui/core
|
|
153
153
|
```
|
|
154
154
|
|
|
155
|
-
### 2. Setup providers
|
|
155
|
+
### 2. Setup providers
|
|
156
156
|
|
|
157
157
|
In your app entry point (`main.tsx` or `App.tsx`):
|
|
158
158
|
|
|
159
159
|
```tsx
|
|
160
160
|
import { BienProvider, TooltipProvider, ToastProvider } from '@bienui/core';
|
|
161
|
+
// Import styles
|
|
161
162
|
import '@bienui/core/styles';
|
|
162
163
|
|
|
163
164
|
function App() {
|
|
164
165
|
return (
|
|
165
|
-
<BienProvider
|
|
166
|
+
<BienProvider>
|
|
166
167
|
<TooltipProvider>
|
|
167
168
|
<ToastProvider>
|
|
168
169
|
{/* Your app content */}
|
|
@@ -176,14 +177,18 @@ function App() {
|
|
|
176
177
|
### 3. Use components
|
|
177
178
|
|
|
178
179
|
```tsx
|
|
179
|
-
import { Button, Input, Card,
|
|
180
|
+
import { Button, Input, Card, Text, VStack } from '@bienui/core';
|
|
180
181
|
|
|
181
182
|
function MyComponent() {
|
|
182
183
|
return (
|
|
183
184
|
<Card>
|
|
184
|
-
<
|
|
185
|
-
|
|
186
|
-
|
|
185
|
+
<VStack gap="md">
|
|
186
|
+
<Text as="h2" size="lg" weight="semibold">
|
|
187
|
+
Welcome
|
|
188
|
+
</Text>
|
|
189
|
+
<Input placeholder="Enter your email" />
|
|
190
|
+
<Button variant="primary">Get Started</Button>
|
|
191
|
+
</VStack>
|
|
187
192
|
</Card>
|
|
188
193
|
);
|
|
189
194
|
}
|
|
@@ -191,24 +196,23 @@ function MyComponent() {
|
|
|
191
196
|
|
|
192
197
|
## 🎨 Theming
|
|
193
198
|
|
|
194
|
-
###
|
|
199
|
+
### Theme switching
|
|
195
200
|
|
|
196
201
|
```tsx
|
|
197
202
|
import { useState } from 'react';
|
|
198
|
-
import { BienProvider } from '@bienui/core';
|
|
203
|
+
import { BienProvider, Button } from '@bienui/core';
|
|
199
204
|
|
|
200
205
|
function App() {
|
|
201
|
-
const [
|
|
202
|
-
const [density, setDensity] = useState<'comfortable' | 'compact'>('comfortable');
|
|
206
|
+
const [isDark, setIsDark] = useState(false);
|
|
203
207
|
|
|
204
208
|
return (
|
|
205
|
-
<BienProvider
|
|
206
|
-
<
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
</
|
|
209
|
+
<BienProvider className={isDark ? 'dark' : 'light'}>
|
|
210
|
+
<Button
|
|
211
|
+
onClick={() => setIsDark(!isDark)}
|
|
212
|
+
variant="secondary"
|
|
213
|
+
>
|
|
214
|
+
Switch to {isDark ? 'Light' : 'Dark'} Mode
|
|
215
|
+
</Button>
|
|
212
216
|
{/* Your app */}
|
|
213
217
|
</BienProvider>
|
|
214
218
|
);
|
|
@@ -218,30 +222,168 @@ function App() {
|
|
|
218
222
|
### Using design tokens in custom components
|
|
219
223
|
|
|
220
224
|
```tsx
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
}
|
|
225
|
+
// Access design tokens via CSS custom properties
|
|
226
|
+
export const CustomCard = () => (
|
|
227
|
+
<div
|
|
228
|
+
style={{
|
|
229
|
+
backgroundColor: 'var(--surface-base)',
|
|
230
|
+
padding: 'var(--space-md)',
|
|
231
|
+
borderRadius: 'var(--radius-lg)',
|
|
232
|
+
border: '1px solid var(--border-base)',
|
|
233
|
+
}}
|
|
234
|
+
>
|
|
235
|
+
Custom styled component
|
|
236
|
+
</div>
|
|
237
|
+
);
|
|
238
|
+
|
|
239
|
+
// Or use className with CSS
|
|
240
|
+
// .custom-card {
|
|
241
|
+
// background-color: var(--surface-base);
|
|
242
|
+
// padding: var(--space-md);
|
|
243
|
+
// border-radius: var(--radius-lg);
|
|
244
|
+
// }
|
|
230
245
|
```
|
|
231
246
|
|
|
232
247
|
## 🧩 Available Components
|
|
233
248
|
|
|
234
|
-
###
|
|
249
|
+
### Layout
|
|
250
|
+
- **Container** - Max-width content wrapper
|
|
251
|
+
- **Grid** - CSS Grid layout component
|
|
252
|
+
- **VStack** / **HStack** - Vertical and horizontal stack layouts
|
|
253
|
+
- **Section** - Semantic content sections
|
|
254
|
+
- **Spacer** - Flexible spacing component
|
|
255
|
+
- **Divider** - Visual content separators
|
|
256
|
+
|
|
257
|
+
### Forms
|
|
258
|
+
- **Input** - Text input with validation states
|
|
259
|
+
- **Textarea** - Multi-line text input
|
|
260
|
+
- **MarkdownTextarea** - Markdown-enabled textarea
|
|
261
|
+
- **Select** / **MultiSelect** - Dropdown selections
|
|
262
|
+
- **Checkbox** / **Radio** / **RadioGroup** - Selection controls
|
|
263
|
+
- **Switch** - Toggle switch
|
|
264
|
+
- **Slider** - Range input slider
|
|
265
|
+
- **DatePicker** - Date selection input
|
|
266
|
+
|
|
267
|
+
### Display
|
|
268
|
+
- **Text** - Typography component with `as`, `size`, `weight` props
|
|
269
|
+
- **Card** - Content container
|
|
270
|
+
- **Badge** - Status indicators
|
|
271
|
+
- **Avatar** / **AvatarGroup** / **ProfileAvatar** - User avatars
|
|
272
|
+
- **Timeline** - Sequential event display
|
|
273
|
+
- **Meter** / **CircularMeter** - Progress indicators
|
|
274
|
+
- **Table** - Data tables
|
|
275
|
+
- **List** / **ListItem** - List components
|
|
276
|
+
- **DescriptionList** - Definition lists
|
|
277
|
+
- **ColorSwatch** - Color display component
|
|
278
|
+
|
|
279
|
+
### Interactive
|
|
280
|
+
- **Button** - Primary interaction element
|
|
281
|
+
- **Tooltip** - Contextual help
|
|
282
|
+
- **Menu** / **MenuItem** / **MenuGroup** - Dropdown menus
|
|
283
|
+
- **Hotspot** - Interactive markers
|
|
284
|
+
- **DraggableList** - Drag and drop lists
|
|
285
|
+
- **FileDrop** - File upload area
|
|
286
|
+
- **Panel** - Collapsible content panels
|
|
287
|
+
|
|
288
|
+
### Feedback
|
|
289
|
+
- **Loading** - Loading states
|
|
290
|
+
- **EmptyState** - No content messaging
|
|
291
|
+
- **Banner** - Important announcements
|
|
292
|
+
- **Callout** - Highlighted information
|
|
293
|
+
- **Modal** - Dialog overlays
|
|
294
|
+
- **Accordion** - Collapsible content
|
|
295
|
+
- **Tabs** - Tabbed navigation
|
|
296
|
+
- **Stepper** - Step-by-step processes
|
|
297
|
+
|
|
298
|
+
### Navigation
|
|
299
|
+
- **Link** - Navigation links
|
|
300
|
+
- **Breadcrumb** - Hierarchical navigation
|
|
301
|
+
- **Header** - Page headers
|
|
302
|
+
- **Sidenav** - Sidebar navigation
|
|
303
|
+
|
|
304
|
+
### Utilities
|
|
305
|
+
- **ThinkingText** - Animated typing effect
|
|
306
|
+
- **useToast** - Toast notification hook
|
|
307
|
+
|
|
308
|
+
### Example Usage
|
|
235
309
|
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
310
|
+
```tsx
|
|
311
|
+
import {
|
|
312
|
+
Button,
|
|
313
|
+
Text,
|
|
314
|
+
Card,
|
|
315
|
+
Input,
|
|
316
|
+
Avatar,
|
|
317
|
+
Badge,
|
|
318
|
+
Tooltip,
|
|
319
|
+
VStack,
|
|
320
|
+
HStack,
|
|
321
|
+
useToast
|
|
322
|
+
} from '@bienui/core';
|
|
323
|
+
|
|
324
|
+
function Dashboard() {
|
|
325
|
+
const { toast } = useToast();
|
|
326
|
+
|
|
327
|
+
const handleSend = () => {
|
|
328
|
+
toast({
|
|
329
|
+
title: "Message sent!",
|
|
330
|
+
description: "Your message has been delivered.",
|
|
331
|
+
variant: "success"
|
|
332
|
+
});
|
|
333
|
+
};
|
|
334
|
+
|
|
335
|
+
return (
|
|
336
|
+
<Card>
|
|
337
|
+
<VStack gap="md">
|
|
338
|
+
<HStack gap="sm" align="center">
|
|
339
|
+
<Avatar src="/user.jpg" alt="User" fallback="U" />
|
|
340
|
+
<VStack gap="xs">
|
|
341
|
+
<Text as="h3" size="md" weight="semibold">
|
|
342
|
+
John Doe
|
|
343
|
+
</Text>
|
|
344
|
+
<Badge variant="success">Active</Badge>
|
|
345
|
+
</VStack>
|
|
346
|
+
</HStack>
|
|
347
|
+
|
|
348
|
+
<Input placeholder="Enter message..." />
|
|
349
|
+
|
|
350
|
+
<HStack gap="sm">
|
|
351
|
+
<Button variant="primary" onClick={handleSend}>
|
|
352
|
+
Send
|
|
353
|
+
</Button>
|
|
354
|
+
<Tooltip content="Save as draft">
|
|
355
|
+
<Button variant="secondary">Save</Button>
|
|
356
|
+
</Tooltip>
|
|
357
|
+
</HStack>
|
|
358
|
+
</VStack>
|
|
359
|
+
</Card>
|
|
360
|
+
);
|
|
361
|
+
}
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
### Toast Notifications
|
|
365
|
+
|
|
366
|
+
```tsx
|
|
367
|
+
import { useToast, Button } from '@bienui/core';
|
|
368
|
+
|
|
369
|
+
function NotificationExample() {
|
|
370
|
+
const { toast } = useToast();
|
|
371
|
+
|
|
372
|
+
return (
|
|
373
|
+
<Button
|
|
374
|
+
onClick={() => {
|
|
375
|
+
toast({
|
|
376
|
+
title: "Success!",
|
|
377
|
+
description: "Operation completed successfully.",
|
|
378
|
+
variant: "success"
|
|
379
|
+
});
|
|
380
|
+
}}
|
|
381
|
+
>
|
|
382
|
+
Show Toast
|
|
383
|
+
</Button>
|
|
384
|
+
);
|
|
385
|
+
}
|
|
386
|
+
```
|
|
245
387
|
|
|
246
388
|
### Component Features
|
|
247
389
|
|
|
@@ -355,8 +497,9 @@ The package is configured with proper exports for ESM, CJS, and TypeScript:
|
|
|
355
497
|
|
|
356
498
|
## 🧪 Testing in Consuming Apps
|
|
357
499
|
|
|
358
|
-
Before publishing, you can test the package locally
|
|
500
|
+
Before publishing, you can test the package locally:
|
|
359
501
|
|
|
502
|
+
### Method 1: Build and Link
|
|
360
503
|
```bash
|
|
361
504
|
# In BienUI Core project
|
|
362
505
|
yarn build:lib
|
|
@@ -366,12 +509,21 @@ yarn link
|
|
|
366
509
|
yarn link @bienui/core
|
|
367
510
|
```
|
|
368
511
|
|
|
369
|
-
|
|
512
|
+
### Method 2: Pack and Install
|
|
513
|
+
```bash
|
|
514
|
+
# In BienUI Core project
|
|
515
|
+
yarn build:lib
|
|
516
|
+
npm pack
|
|
517
|
+
|
|
518
|
+
# This creates a .tgz file, then in your test project:
|
|
519
|
+
npm install /path/to/bienui-core-1.0.0.tgz
|
|
520
|
+
```
|
|
370
521
|
|
|
522
|
+
### Method 3: File Reference
|
|
371
523
|
```json
|
|
372
524
|
{
|
|
373
525
|
"dependencies": {
|
|
374
|
-
"@bienui/core": "file:../
|
|
526
|
+
"@bienui/core": "file:../BienUI"
|
|
375
527
|
}
|
|
376
528
|
}
|
|
377
529
|
```
|