@bienui/core 0.1.13

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.
Files changed (72) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +417 -0
  3. package/dist/bien-ui.cjs.js +31 -0
  4. package/dist/bien-ui.cjs.js.map +1 -0
  5. package/dist/bien-ui.esm.js +15571 -0
  6. package/dist/bien-ui.esm.js.map +1 -0
  7. package/dist/components/Display/Avatar.d.ts +19 -0
  8. package/dist/components/Display/Badge.d.ts +10 -0
  9. package/dist/components/Display/Card.d.ts +25 -0
  10. package/dist/components/Display/ColorSwatch.d.ts +8 -0
  11. package/dist/components/Display/List.d.ts +62 -0
  12. package/dist/components/Display/Meter.d.ts +59 -0
  13. package/dist/components/Display/ProfileAvatar.d.ts +16 -0
  14. package/dist/components/Display/Table.d.ts +66 -0
  15. package/dist/components/Display/Tags.d.ts +10 -0
  16. package/dist/components/Display/Text.d.ts +21 -0
  17. package/dist/components/Display/Timeline.d.ts +13 -0
  18. package/dist/components/Display/index.d.ts +11 -0
  19. package/dist/components/Feedback/Accordion.d.ts +40 -0
  20. package/dist/components/Feedback/AccordionItem.d.ts +10 -0
  21. package/dist/components/Feedback/Banner.d.ts +20 -0
  22. package/dist/components/Feedback/Callout.d.ts +22 -0
  23. package/dist/components/Feedback/EmptyState.d.ts +42 -0
  24. package/dist/components/Feedback/Loading.d.ts +16 -0
  25. package/dist/components/Feedback/Modal.d.ts +17 -0
  26. package/dist/components/Feedback/Stepper.d.ts +18 -0
  27. package/dist/components/Feedback/Tabs.d.ts +19 -0
  28. package/dist/components/Feedback/index.d.ts +8 -0
  29. package/dist/components/Forms/Checkbox.d.ts +7 -0
  30. package/dist/components/Forms/DatePicker.d.ts +17 -0
  31. package/dist/components/Forms/Input.d.ts +8 -0
  32. package/dist/components/Forms/MarkdownTextarea.d.ts +10 -0
  33. package/dist/components/Forms/MultiSelect.d.ts +21 -0
  34. package/dist/components/Forms/Radio.d.ts +12 -0
  35. package/dist/components/Forms/RadioGroup.d.ts +20 -0
  36. package/dist/components/Forms/Select.d.ts +13 -0
  37. package/dist/components/Forms/Slider.d.ts +7 -0
  38. package/dist/components/Forms/Switch.d.ts +6 -0
  39. package/dist/components/Forms/Textarea.d.ts +8 -0
  40. package/dist/components/Forms/index.d.ts +11 -0
  41. package/dist/components/Icons/icons.d.ts +30 -0
  42. package/dist/components/Icons/index.d.ts +1 -0
  43. package/dist/components/Interactive/Button.d.ts +11 -0
  44. package/dist/components/Interactive/DraggableList.d.ts +20 -0
  45. package/dist/components/Interactive/FileDrop.d.ts +18 -0
  46. package/dist/components/Interactive/Hotspot.d.ts +33 -0
  47. package/dist/components/Interactive/Menu.d.ts +50 -0
  48. package/dist/components/Interactive/Panel.d.ts +29 -0
  49. package/dist/components/Interactive/Tooltip.d.ts +10 -0
  50. package/dist/components/Interactive/index.d.ts +7 -0
  51. package/dist/components/Layout/Container.d.ts +9 -0
  52. package/dist/components/Layout/Divider.d.ts +11 -0
  53. package/dist/components/Layout/Grid.d.ts +13 -0
  54. package/dist/components/Layout/Section.d.ts +9 -0
  55. package/dist/components/Layout/Spacer.d.ts +6 -0
  56. package/dist/components/Layout/Stack.d.ts +13 -0
  57. package/dist/components/Layout/index.d.ts +6 -0
  58. package/dist/components/Navigation/Breadcrumb.d.ts +16 -0
  59. package/dist/components/Navigation/Header.d.ts +20 -0
  60. package/dist/components/Navigation/Link.d.ts +26 -0
  61. package/dist/components/Navigation/Sidenav.d.ts +18 -0
  62. package/dist/components/Navigation/index.d.ts +4 -0
  63. package/dist/components/Providers/BienProvider.d.ts +14 -0
  64. package/dist/components/Providers/ToastProvider.d.ts +16 -0
  65. package/dist/components/Providers/TooltipProvider.d.ts +2 -0
  66. package/dist/components/Providers/index.d.ts +3 -0
  67. package/dist/components/Utils/ThinkingText.d.ts +10 -0
  68. package/dist/components/Utils/Toast.d.ts +16 -0
  69. package/dist/components/Utils/index.d.ts +1 -0
  70. package/dist/index.d.ts +12 -0
  71. package/dist/types/index.d.ts +14 -0
  72. package/package.json +156 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Anh Bien
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,417 @@
1
+ # Bien UI
2
+
3
+ A production-ready, token-first React component library built with:
4
+
5
+ - **pnpm workspaces** for monorepo management
6
+ - **TypeScript** for type safety
7
+ - **Radix UI** primitives for accessibility
8
+ - **vanilla-extract** for type-safe styling
9
+ - **Token-first theming** with light/dark modes + comfortable/compact density
10
+ - **Storybook** for documentation
11
+ - **tsup** for fast builds
12
+ - **changesets** for versioning and publishing
13
+
14
+ ## ๐Ÿ“ฆ Packages
15
+
16
+ - **`@bien/tokens`** - Design tokens (colors, spacing, typography, etc.)
17
+ - **`@bien/ui`** - React component library
18
+
19
+ ## ๐Ÿš€ Quick Start
20
+
21
+ ### Installation
22
+
23
+ ```bash
24
+ # Install dependencies
25
+ pnpm install
26
+
27
+ # Build all packages
28
+ pnpm build
29
+
30
+ # Start Storybook (development)
31
+ pnpm storybook
32
+ ```
33
+
34
+ ### Build Commands
35
+
36
+ ```bash
37
+ # Build all packages in the workspace
38
+ pnpm build
39
+
40
+ # Build and watch for changes
41
+ pnpm --filter @bien/tokens dev
42
+ pnpm --filter @bien/ui dev
43
+
44
+ # Build Storybook for production
45
+ pnpm build:storybook
46
+ ```
47
+
48
+ ### Development Commands
49
+
50
+ ```bash
51
+ # Run Storybook (development mode)
52
+ pnpm dev
53
+ # or
54
+ pnpm storybook
55
+
56
+ # Lint code
57
+ pnpm lint
58
+
59
+ # Format code
60
+ pnpm format
61
+
62
+ # Format check (CI)
63
+ pnpm format:check
64
+ ```
65
+
66
+ ### Code Formatting (Auto-setup)
67
+
68
+ **โœจ Prettier runs automatically on commit and save!**
69
+
70
+ - **On Commit**: Husky + lint-staged auto-formats staged files
71
+ - **On Save**: VS Code auto-formats when you save (if you have Prettier extension)
72
+ - **Manual**: Run `pnpm format` to format all files
73
+
74
+ **Setup for new developers:**
75
+ 1. Install recommended VS Code extensions (prompted automatically)
76
+ 2. Prettier will format on save automatically
77
+ 3. Git commits will auto-format staged files
78
+
79
+ **Configuration files:**
80
+ - `.prettierrc` - Prettier formatting rules
81
+ - `.husky/pre-commit` - Git hook for auto-formatting
82
+ - `.vscode/extensions.json` - Recommended extensions
83
+ - `package.json` - lint-staged configuration
84
+
85
+ ### Versioning & Publishing
86
+
87
+ ```bash
88
+ # Create a changeset (describe your changes)
89
+ pnpm changeset
90
+
91
+ # Version packages based on changesets
92
+ pnpm version-packages
93
+
94
+ # Build and publish packages to npm
95
+ pnpm release
96
+
97
+ # Manual version bumping
98
+ npm run version:patch # 0.1.0 -> 0.1.1
99
+ npm run version:minor # 0.1.0 -> 0.2.0
100
+ npm run version:major # 0.1.0 -> 1.0.0
101
+ ```
102
+
103
+ ## ๐Ÿš€ Deployment & GitHub Pages
104
+
105
+ ### Automatic Deployment
106
+ - **๐Ÿ”„ Auto-deploy**: Every push to `main`/`master` triggers automatic deployment
107
+ - **๐Ÿ“ˆ Auto-versioning**: Version number automatically bumps on each deploy
108
+ - **๐Ÿท๏ธ Auto-releases**: GitHub releases created automatically with changelog
109
+ - **๐Ÿ“š Live Storybook**: Available at your GitHub Pages URL
110
+
111
+ ### Deployment Process
112
+ 1. **Push to main/master branch**
113
+ 2. **GitHub Actions automatically**:
114
+ - Bumps patch version (0.1.0 โ†’ 0.1.1)
115
+ - Commits version change
116
+ - Builds Storybook with accessibility testing
117
+ - Deploys to GitHub Pages
118
+ - Creates GitHub release with changelog
119
+
120
+ ### Manual Deployment
121
+
122
+ ```bash
123
+ # Test build locally
124
+ npm run build-storybook
125
+
126
+ # Test deploy command (builds only)
127
+ npm run deploy:storybook
128
+ ```
129
+
130
+ ### Setup GitHub Pages (One-time)
131
+ 1. Go to repository **Settings** โ†’ **Pages**
132
+ 2. Set **Source** to "GitHub Actions"
133
+ 3. The workflow will handle the rest automatically
134
+
135
+ **Live Storybook URL**: `https://<username>.github.io/<repository-name>/`
136
+
137
+ ## ๐Ÿ“š Using Bien UI in Your App
138
+
139
+ ### 1. Install packages
140
+
141
+ ```bash
142
+ pnpm add @bien/tokens @bien/ui
143
+ ```
144
+
145
+ ### 2. Setup providers and styles
146
+
147
+ In your app entry point (`main.tsx` or `App.tsx`):
148
+
149
+ ```tsx
150
+ import { BienProvider, TooltipProvider, ToastProvider } from '@bien/ui';
151
+ import '@bien/tokens/styles.css';
152
+
153
+ function App() {
154
+ return (
155
+ <BienProvider theme="light" density="comfortable">
156
+ <TooltipProvider>
157
+ <ToastProvider>
158
+ {/* Your app content */}
159
+ </ToastProvider>
160
+ </TooltipProvider>
161
+ </BienProvider>
162
+ );
163
+ }
164
+ ```
165
+
166
+ ### 3. Use components
167
+
168
+ ```tsx
169
+ import { Button, Input, Card, Modal, Text } from '@bien/ui';
170
+
171
+ function MyComponent() {
172
+ return (
173
+ <Card>
174
+ <Text weight="semibold" size="lg">Welcome</Text>
175
+ <Input label="Email" placeholder="you@example.com" />
176
+ <Button variant="primary">Submit</Button>
177
+ </Card>
178
+ );
179
+ }
180
+ ```
181
+
182
+ ## ๐ŸŽจ Theming
183
+
184
+ ### Switch theme dynamically
185
+
186
+ ```tsx
187
+ import { useState } from 'react';
188
+ import { BienProvider } from '@bien/ui';
189
+
190
+ function App() {
191
+ const [theme, setTheme] = useState<'light' | 'dark'>('light');
192
+ const [density, setDensity] = useState<'comfortable' | 'compact'>('comfortable');
193
+
194
+ return (
195
+ <BienProvider theme={theme} density={density}>
196
+ <button onClick={() => setTheme(theme === 'light' ? 'dark' : 'light')}>
197
+ Toggle Theme
198
+ </button>
199
+ <button onClick={() => setDensity(density === 'comfortable' ? 'compact' : 'comfortable')}>
200
+ Toggle Density
201
+ </button>
202
+ {/* Your app */}
203
+ </BienProvider>
204
+ );
205
+ }
206
+ ```
207
+
208
+ ### Using tokens in custom components
209
+
210
+ ```tsx
211
+ import { tokens } from '@bien/tokens';
212
+ import { style } from '@vanilla-extract/css';
213
+
214
+ export const myCustomStyle = style({
215
+ backgroundColor: tokens.color.surface.base,
216
+ padding: tokens.space.md,
217
+ borderRadius: tokens.radius.lg,
218
+ border: `1px solid ${tokens.color.border.base}`,
219
+ });
220
+ ```
221
+
222
+ ## ๐Ÿงฉ Available Components
223
+
224
+ ### Core Components
225
+
226
+ - **Button** - Multiple variants (primary, secondary, ghost, danger), sizes, loading states
227
+ - **Text** - Typography with size, weight, tone options
228
+ - **Card** - Content containers with elevation
229
+ - **Input** + **FormField** - Text inputs with label, hint, error, proper ARIA
230
+ - **Modal** - Dialog with focus trap, keyboard support (Escape to close)
231
+ - **Drawer** - Side-positioned modal (left/right)
232
+ - **Tooltip** - Accessible tooltips with positioning
233
+ - **Tabs** - Tab navigation with keyboard support
234
+ - **Toast** - Notification system with variants (success, error, warning, info)
235
+
236
+ ### Component Features
237
+
238
+ - โœ… **Full keyboard support** (Tab, Escape, Arrow keys where appropriate)
239
+ - โœ… **Proper ARIA attributes** via Radix UI
240
+ - โœ… **Focus management** (focus trapping in modals, focus return)
241
+ - โœ… **Reduced motion support** (respects `prefers-reduced-motion`)
242
+ - โœ… **Type-safe** with TypeScript
243
+ - โœ… **forwardRef** where appropriate for ref forwarding
244
+
245
+ ## ๐ŸŽฏ Token System
246
+
247
+ ### Token Categories
248
+
249
+ #### Colors
250
+ - `bg` - Background layers
251
+ - `surface` - Cards, panels, overlays
252
+ - `text` - Text hierarchy (primary, secondary, tertiary, inverse, disabled)
253
+ - `border` - Border colors
254
+ - `brand` - Brand/accent colors
255
+ - `status` - Success, warning, error, info
256
+ - `interactive` - Hover, active, disabled states
257
+
258
+ #### Spacing
259
+ - `space.xs` through `space.xl`
260
+ - `component.*` - Component-specific spacing (buttons, inputs, cards)
261
+
262
+ #### Typography
263
+ - `font.size` - xs, sm, md, lg, xl
264
+ - `font.weight` - normal, medium, semibold, bold
265
+ - `font.lineHeight` - tight, normal, relaxed
266
+
267
+ #### Other
268
+ - `radius` - Border radius scale
269
+ - `shadow` - Elevation shadows
270
+ - `zIndex` - Stacking order
271
+ - `duration` - Animation timing
272
+ - `easing` - Animation curves
273
+
274
+ ### Themes
275
+
276
+ - **Light theme** - Default light color scheme
277
+ - **Dark theme** - Dark color scheme optimized for low-light
278
+
279
+ ### Density
280
+
281
+ - **Comfortable** - Default spacing (44px touch targets, 16px padding)
282
+ - **Compact** - Tighter spacing for information-dense UIs
283
+
284
+ ## ๐Ÿ“‚ Project Structure
285
+
286
+ ```
287
+ bien-ui-monorepo/
288
+ โ”œโ”€โ”€ .changeset/ # Changesets configuration
289
+ โ”œโ”€โ”€ packages/
290
+ โ”‚ โ”œโ”€โ”€ tokens/ # Design tokens package
291
+ โ”‚ โ”‚ โ”œโ”€โ”€ src/
292
+ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ primitives.ts # Raw token values
293
+ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ contract.ts # Token contract
294
+ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ themes.ts # Light/dark themes
295
+ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ density.ts # Density variants
296
+ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ global.css.ts # Global styles
297
+ โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ index.ts
298
+ โ”‚ โ”‚ โ”œโ”€โ”€ package.json
299
+ โ”‚ โ”‚ โ””โ”€โ”€ tsup.config.ts
300
+ โ”‚ โ””โ”€โ”€ ui/ # Component library
301
+ โ”‚ โ”œโ”€โ”€ src/
302
+ โ”‚ โ”‚ โ”œโ”€โ”€ components/
303
+ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ Button/
304
+ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ Text/
305
+ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ Card/
306
+ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ Input/
307
+ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ Modal/
308
+ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ Tooltip/
309
+ โ”‚ โ”‚ โ”‚ โ”œโ”€โ”€ Tabs/
310
+ โ”‚ โ”‚ โ”‚ โ””โ”€โ”€ Toast/
311
+ โ”‚ โ”‚ โ”œโ”€โ”€ provider.tsx
312
+ โ”‚ โ”‚ โ””โ”€โ”€ index.ts
313
+ โ”‚ โ”œโ”€โ”€ package.json
314
+ โ”‚ โ””โ”€โ”€ tsup.config.ts
315
+ โ”œโ”€โ”€ apps/
316
+ โ”‚ โ””โ”€โ”€ storybook/ # Storybook documentation
317
+ โ”‚ โ”œโ”€โ”€ .storybook/
318
+ โ”‚ โ”œโ”€โ”€ stories/
319
+ โ”‚ โ””โ”€โ”€ package.json
320
+ โ”œโ”€โ”€ package.json # Root package.json
321
+ โ”œโ”€โ”€ pnpm-workspace.yaml # Workspace configuration
322
+ โ”œโ”€โ”€ tsconfig.json # Shared TypeScript config
323
+ โ””โ”€โ”€ README.md
324
+ ```
325
+
326
+ ## ๐Ÿ”ง Configuration
327
+
328
+ ### Package Exports
329
+
330
+ Both packages are configured with proper exports for ESM, CJS, and TypeScript:
331
+
332
+ ```json
333
+ {
334
+ "exports": {
335
+ ".": {
336
+ "import": "./dist/index.mjs",
337
+ "require": "./dist/index.js",
338
+ "types": "./dist/index.d.ts"
339
+ },
340
+ "./styles.css": "./dist/index.css"
341
+ }
342
+ }
343
+ ```
344
+
345
+ ### Peer Dependencies
346
+
347
+ `@bien/ui` marks React as a peer dependency:
348
+
349
+ ```json
350
+ {
351
+ "peerDependencies": {
352
+ "react": "^18.0.0",
353
+ "react-dom": "^18.0.0"
354
+ }
355
+ }
356
+ ```
357
+
358
+ ## ๐Ÿงช Testing in Consuming Apps
359
+
360
+ Before publishing, you can test the packages locally using pnpm link or by referencing the workspace:
361
+
362
+ ```json
363
+ {
364
+ "dependencies": {
365
+ "@bien/tokens": "workspace:*",
366
+ "@bien/ui": "workspace:*"
367
+ }
368
+ }
369
+ ```
370
+
371
+ ## ๐Ÿ“– Documentation
372
+
373
+ Run Storybook to explore all components, variants, and usage examples:
374
+
375
+ ```bash
376
+ pnpm storybook
377
+ ```
378
+
379
+ Storybook includes:
380
+ - Interactive component playground
381
+ - Auto-generated prop documentation
382
+ - Theme switcher (light/dark)
383
+ - Density switcher (comfortable/compact)
384
+ - Live code examples
385
+
386
+ ## ๐Ÿšข Publishing Workflow
387
+
388
+ 1. Make changes to packages
389
+ 2. Create a changeset:
390
+ ```bash
391
+ pnpm changeset
392
+ ```
393
+ 3. Commit the changeset
394
+ 4. When ready to release:
395
+ ```bash
396
+ pnpm version-packages # Updates versions
397
+ pnpm release # Builds and publishes
398
+ ```
399
+
400
+ ## ๐Ÿ› ๏ธ Tech Stack
401
+
402
+ - **React 18** - UI library
403
+ - **TypeScript 5** - Type safety
404
+ - **vanilla-extract** - Zero-runtime CSS-in-JS
405
+ - **Radix UI** - Accessible component primitives
406
+ - **tsup** - Fast TypeScript bundler
407
+ - **Storybook 7** - Component documentation
408
+ - **changesets** - Version management
409
+ - **pnpm** - Fast, efficient package manager
410
+
411
+ ## ๐Ÿ“ License
412
+
413
+ MIT
414
+
415
+ ---
416
+
417
+ Built with โค๏ธ by your design systems team