@beyondcorp/beyond-ui 1.2.83 โ†’ 1.2.87

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 (67) hide show
  1. package/README.md +394 -394
  2. package/dist/components/Alert/Alert.example.js.map +1 -1
  3. package/dist/components/Auth/LoginForm.example.js.map +1 -1
  4. package/dist/components/Auth/PasswordResetForm.example.js.map +1 -1
  5. package/dist/components/Auth/PasswordResetForm.js.map +1 -1
  6. package/dist/components/Auth/ProtectedRoute.example.js.map +1 -1
  7. package/dist/components/Auth/SignupForm.example.js.map +1 -1
  8. package/dist/components/Avatar/Avatar.example.js.map +1 -1
  9. package/dist/components/Badge/Badge.example.js.map +1 -1
  10. package/dist/components/Blog/BlogShowcase.js +36 -36
  11. package/dist/components/Blog/BlogShowcase.js.map +1 -1
  12. package/dist/components/Button/Button.example.js.map +1 -1
  13. package/dist/components/Card/Card.example.js.map +1 -1
  14. package/dist/components/Card/Card.js.map +1 -1
  15. package/dist/components/Checkbox/Checkbox.example.js.map +1 -1
  16. package/dist/components/CodeHighlight/CodeHighlight.js.map +1 -1
  17. package/dist/components/ComponentShowcase/ComponentShowcase.js.map +1 -1
  18. package/dist/components/ComponentShowcase/componentDocs.js +21 -21
  19. package/dist/components/ComponentShowcase/componentDocs.js.map +1 -1
  20. package/dist/components/ComponentShowcase/showcaseRegistry.js.map +1 -1
  21. package/dist/components/DashboardGrid/DashboardGrid.example.js.map +1 -1
  22. package/dist/components/DashboardGrid/DashboardGrid.js.map +1 -1
  23. package/dist/components/DashboardHeader/DashboardHeader.example.js.map +1 -1
  24. package/dist/components/DashboardHeader/DashboardHeader.js +5 -5
  25. package/dist/components/DashboardHeader/DashboardHeader.js.map +1 -1
  26. package/dist/components/DashboardLayout/DashboardLayout.example.js.map +1 -1
  27. package/dist/components/DashboardLayout/DashboardLayout.js +1 -1
  28. package/dist/components/DashboardLayout/DashboardLayout.js.map +1 -1
  29. package/dist/components/DataTable/DataTable.js +9 -9
  30. package/dist/components/DataTable/DataTable.js.map +1 -1
  31. package/dist/components/Image/Image.js.map +1 -1
  32. package/dist/components/Input/Input.example.js.map +1 -1
  33. package/dist/components/Marketplace/AllProductsView.js.map +1 -1
  34. package/dist/components/Marketplace/MarketplaceComponent.js.map +1 -1
  35. package/dist/components/Marketplace/MarketplaceSidebar.js.map +1 -1
  36. package/dist/components/Marketplace/components/MarketplaceControls.js.map +1 -1
  37. package/dist/components/Marketplace/components/MarketplaceHeader.js.map +1 -1
  38. package/dist/components/Marketplace/components/ProductCard.js.map +1 -1
  39. package/dist/components/Marketplace/hooks/useScrollToTop.js.map +1 -1
  40. package/dist/components/Marketplace/utils/sanitizeProduct.js.map +1 -1
  41. package/dist/components/Modal/Modal.example.js.map +1 -1
  42. package/dist/components/Modal/Modal.js +3 -3
  43. package/dist/components/Modal/Modal.js.map +1 -1
  44. package/dist/components/Navbar/Navbar.example.js.map +1 -1
  45. package/dist/components/NightModeSwitch/NightModeSwitch.js.map +1 -1
  46. package/dist/components/ProfileManagement/EditModal.js.map +1 -1
  47. package/dist/components/ProfileManagement/ProfileCard.js +1 -1
  48. package/dist/components/ProfileManagement/ProfileCard.js.map +1 -1
  49. package/dist/components/Radio/Radio.js.map +1 -1
  50. package/dist/components/Select/Select.js.map +1 -1
  51. package/dist/components/Sidebar/LogoutButton.js.map +1 -1
  52. package/dist/components/Sidebar/ProfileButton.js.map +1 -1
  53. package/dist/components/Sidebar/Sidebar.example.js.map +1 -1
  54. package/dist/components/Sidebar/Sidebar.js +5 -5
  55. package/dist/components/Sidebar/Sidebar.js.map +1 -1
  56. package/dist/components/Sidebar/SidebarHeader.js +1 -1
  57. package/dist/components/Sidebar/SidebarHeader.js.map +1 -1
  58. package/dist/components/Skeleton/Skeleton.example.js.map +1 -1
  59. package/dist/components/Spinner/Spinner.example.js.map +1 -1
  60. package/dist/components/StatsCard/StatsCard.example.js.map +1 -1
  61. package/dist/components/Switch/Switch.example.js.map +1 -1
  62. package/dist/components/Tabs/Tabs.example.js.map +1 -1
  63. package/dist/components/Textarea/Textarea.example.js.map +1 -1
  64. package/dist/components/Toast/Toast.example.js.map +1 -1
  65. package/dist/hooks/useIntersectionObserver.js.map +1 -1
  66. package/dist/styles.css +1 -1
  67. package/package.json +113 -113
package/README.md CHANGED
@@ -1,394 +1,394 @@
1
- # Beyond-UI
2
-
3
- **A full-fledged React + TailwindCSS component library. Theme-agnostic, reusable, type-safe, and built for productive UIs.**
4
-
5
- ---
6
-
7
- ## ๐Ÿš€ Overview
8
-
9
- ### Local Development Setup
10
-
11
- | Requirement | Version |
12
- | ----------- | ------- |
13
- | Node.js | >= 18.0.0 |
14
- | npm | >= 9.0.0 |
15
-
16
- ```bash
17
- # clone the repo
18
- git clone https://github.com/soitechnologysolutions/beyond-ui.git
19
- cd beyond-ui
20
-
21
- # install dependencies
22
- npm install
23
-
24
- # start the playground
25
- npm run dev
26
- ```
27
-
28
- ### Scripts you will use often
29
-
30
- | Script | Description |
31
- | ------ | ----------- |
32
- | `npm run dev` | Launches Vite playground for landing/showcase pages |
33
- | `npm run storybook` | Starts Storybook on http://localhost:6006 |
34
- | `npm run lint` | Runs ESLint across src/stories/tests |
35
- | `npm test` | Executes Jest + React Testing Library suites |
36
- | `npm run build` | Builds component library + docs assets |
37
-
38
- Beyond-UI is a comprehensive collection of ready-to-use, themeable React UI components and hooks, built with TypeScript, TailwindCSS, and Vite. Inspired by the best of modern design systems, itโ€™s built to be both design-consistent (via semantic theming) and easily composable for dashboards, apps, platforms, and SaaS.
39
-
40
- - **Built for teams:** Use everywhere React and TailwindCSS runโ€”admin panels, SaaS, dashboards, internal tools, consumer apps.
41
- - **Theme-agnostic:** Every style resolves to semantic Tailwind tokens (e.g., `bg-primary`), not hardcoded colors.
42
- - **Reusable hooks:** Utilities like `useDarkMode`, `useDebounce`, and more included.
43
- - **Customizable:** Extend via className or swap out theme tokens, with Storybook-ready demos.
44
-
45
- ---
46
-
47
- ## ๐Ÿ“ฆ Features
48
-
49
- - **20+ reusable, composable components:** Button, Input, Card, Modal, Navbar, Sidebar, Tabs, Table, Alert, Spinner, Badge... (see below)
50
- - **Variants/Theme support with [class-variance-authority (CVA)](https://cva.style/)**
51
- - **Super-charged hooks:** `useDarkMode`, `useDebounce`, `useLocalStorage`, `useToggle`, `useBreakpoint`
52
- - **Utility functions:** `cn()` (merge class names safely), default semantic `theme/default.ts`
53
- - **Storybook documentation for every component**
54
- - **Typed end-to-end (TypeScript)**
55
- - **Testing with Jest & React Testing Library**
56
- - **Easy Tailwind integration & custom theming**
57
- - **Out-of-the-box default theme/fallback**
58
- - **First-class DX: Vite, modern structure, peer deps for React/Tailwind**
59
- - **NPM published, ready for mass reuse**
60
-
61
- ---
62
-
63
- ## โšก๏ธ Getting Started (Import CSS, No Tailwind Config Required)
64
-
65
- Beyond-UI now bundles a ready-to-use CSS file for all styling.
66
- Just add this line to your app's entry file (e.g. main.tsx or index.js):
67
-
68
- ```js
69
- import '@beyondcorp/beyond-ui/dist/styles.css';
70
- ```
71
-
72
- - You do **not** need to configure Tailwind content scanning for the library.
73
- - This CSS is built with [Tailwind CSS](https://tailwindcss.com/) for all components and utilities included in the library.
74
- - If you want to customize theme tokens (e.g. primary, secondary), you can still extend Tailwindโ€™s theme.
75
-
76
- ---
77
-
78
- ## ๐ŸŽจ Theming Sidebar & DashboardLayout
79
-
80
- Beyond-UI is **completely theme-agnostic**:
81
- - All UI is styled with semantic tokens (e.g., `bg-primary-50`, `text-primary-700`, `border-primary-600`) rather than direct color values.
82
- - Defaults to Tailwind's built-in palette (e.g., gray/white) but is overrideable using Tailwind config.
83
- - Ships with a fallback theme ([`theme/default.ts`](src/theme/default.ts)) for instant appearance.
84
-
85
- ### Adding Sidebar Items in DashboardLayout
86
-
87
- To have a configurable sidebar within your dashboard layout:
88
-
89
- 1. **Define menu items** as an array of `MenuItem` objects (each with `id`, `label`, `icon`, `href`, `badge`, and optional `children` for nested menus).
90
- 2. **Pass them to `DashboardLayout`** using the `sidebarMenuItems` prop.
91
- 3. **Control the highlighted menu** by managing the `activeSidebarItem` prop.
92
- 4. **Handle user interaction** with `onSidebarItemClick`.
93
-
94
- **Example:**
95
- ```tsx
96
- import { DashboardLayout } from "@beyondcorp/beyond-ui";
97
- import { Home, BarChart3, Users } from "lucide-react";
98
- import '@beyondcorp/beyond-ui/dist/styles.css';
99
-
100
- const menuItems = [
101
- {
102
- id: "dashboard",
103
- label: "Dashboard",
104
- icon: <Home className="h-5 w-5" />,
105
- href: "/dashboard",
106
- },
107
- {
108
- id: "analytics",
109
- label: "Analytics",
110
- icon: <BarChart3 className="h-5 w-5" />,
111
- href: "/analytics",
112
- badge: "New",
113
- },
114
- {
115
- id: "users",
116
- label: "Users",
117
- icon: <Users className="h-5 w-5" />,
118
- children: [
119
- {
120
- id: "all-users",
121
- label: "All Users",
122
- icon: <Users className="h-4 w-4" />,
123
- },
124
- ],
125
- },
126
- ];
127
- export default function DemoDashboard() {
128
- const [active, setActive] = React.useState("dashboard");
129
- return (
130
- <DashboardLayout
131
- sidebarMenuItems={menuItems}
132
- activeSidebarItem={active}
133
- onSidebarItemClick={setActive}
134
- >
135
- <main>
136
- {/* Main dashboard content goes here */}
137
- </main>
138
- </DashboardLayout>
139
- );
140
- }
141
- ```
142
- You can build any sidebar structureโ€”single-level, nested, badgesโ€”using this pattern and pass it to the layout.
143
-
144
- ### Customizing Sidebar/DashboardLayout Colors
145
-
146
- To override the sidebar background, accent, and dashboard colors, extend your `tailwind.config.js` with your color palette:
147
-
148
- ```js
149
- theme: {
150
- extend: {
151
- colors: {
152
- primary: {
153
- 50: '#f2f8ff', // sidebar background
154
- 100: '#dbeafe',
155
- 600: '#2563eb', // sidebar brand area (logo bg, borders)
156
- 700: '#1d4ed8',
157
- },
158
- secondary: {
159
- 50: '#f4f6fa',
160
- 700: '#3b82f6',
161
- },
162
- danger: {
163
- 50: '#fef2f2',
164
- 600: '#dc2626',
165
- },
166
- // You can add other tokens
167
- // See theme/default.ts for all required keys
168
- }
169
- }
170
- }
171
- ```
172
-
173
- Sidebar, DashboardLayout, and badge/notification UI use these tokens for their background, text, borders, and hover states.
174
-
175
- **Example: Custom Sidebar**
176
- ```tsx
177
- import { Sidebar } from "@beyondcorp/beyond-ui";
178
- import '@beyondcorp/beyond-ui/dist/styles.css';
179
-
180
- // Nested menu, custom badges
181
- const menuItems = [
182
- {
183
- id: "main",
184
- label: "Main",
185
- icon: <span>M</span>,
186
- badge: "Hot",
187
- children: [
188
- {
189
- id: "nested1",
190
- label: "Nested Item",
191
- icon: <span>N</span>,
192
- badge: "New",
193
- },
194
- ]
195
- },
196
- ];
197
-
198
- <Sidebar
199
- menuItems={menuItems}
200
- className="shadow-xl"
201
- />
202
- ```
203
-
204
- ### Fallback Theme
205
-
206
- If your Tailwind config doesn't specify semantic tokens, Beyond-UI defaults to the palette in [`theme/default.ts`](src/theme/default.ts), ensuring that all layouts/components always render.
207
-
208
- ---
209
-
210
- ## ๐Ÿงฉ Components
211
-
212
- | Name | Features / Variants |
213
- |---------------|---------------------------------|
214
- | Button | Variants (primary, secondary, danger, ghost), Sizes (sm, md, lg), Full type safety |
215
- | Input | Variants (default, error, success), Sizes, Icon support |
216
- | Textarea | Auto-resize, char counter |
217
- | Select | Dropdown, search, async |
218
- | Checkbox | Label, indeterminate |
219
- | Radio | Group support |
220
- | Switch | Animation, boolean toggle |
221
- | Card | Header, body, footer slots |
222
- | Modal | Overlay, keyboard dismiss |
223
- | Badge | Variants (info, warning, error) |
224
- | Tabs | Horizontal/vertical, variants |
225
- | Table | Sortable, customized cells |
226
- | Alert | Info/success/warning/danger |
227
- | Toast | Notifications, timeouts |
228
- | Skeleton | Loading states |
229
- | Spinner | Loader, multiple sizes |
230
- | Navbar, Sidebar | Layout primitives |
231
- | StatsCard | Dashboard blocks |
232
- | ChartWrapper | Recharts integration |
233
- | ... | More (see Storybook) |
234
-
235
- ---
236
-
237
- ## ๐ŸŒ™ NightModeSwitch Component
238
-
239
- A reusable, theme-agnostic dark/light mode toggle with sun/moon icons.
240
-
241
- ### Usage
242
-
243
- ```tsx
244
- import { NightModeSwitch } from "src/components/NightModeSwitch";
245
-
246
- <NightModeSwitch
247
- variant="ghost"
248
- size="md"
249
- iconStyle="filled"
250
- ariaLabel="Toggle dark mode"
251
- className="ml-2"
252
- />
253
- ```
254
-
255
- ### Props
256
-
257
- - `variant`: "primary" | "secondary" | "ghost" (default: "ghost")
258
- - `size`: "sm" | "md" | "lg" (default: "md")
259
- - `iconStyle`: "filled" | "outline" (default: "filled")
260
- - `ariaLabel`: string (default: "Toggle dark mode")
261
- - `className`: string (optional)
262
-
263
- ### Theming
264
-
265
- - Uses semantic Tailwind tokens (`bg-primary`, `text-primary`, etc.).
266
- - Respects default theme in [`src/theme/default.ts`](src/theme/default.ts:1).
267
- - No hardcoded colors; fully theme-agnostic.
268
-
269
- ### Integration Example
270
-
271
- Add to Navbar:
272
-
273
- ```tsx
274
- import { Navbar } from "src/components/Navbar";
275
- import { NightModeSwitch } from "src/components/NightModeSwitch";
276
-
277
- <Navbar>
278
- <div className="flex items-center gap-4 px-4 w-full">
279
- <span className="font-bold text-xl">My App</span>
280
- <nav className="flex gap-2 ml-auto">
281
- <a href="/" className="text-blue-500">Home</a>
282
- <a href="/about" className="text-blue-500">About</a>
283
- </nav>
284
- <NightModeSwitch className="ml-4" variant="ghost" size="md" ariaLabel="Toggle dark mode" />
285
- </div>
286
- </Navbar>
287
- ```
288
-
289
- ### Accessibility
290
-
291
- - Keyboard and screen reader accessible.
292
- - Uses `aria-label` and `aria-pressed`.
293
-
294
- ### Storybook
295
-
296
- See `stories/NightModeSwitch.stories.tsx` for live examples and customization.
297
- ---
298
-
299
- ## ๐Ÿงต Hooks & Utilities
300
-
301
- | Hook | Purpose |
302
- |---------------------|----------------------------------|
303
- | useDarkMode | Toggle and persist theme |
304
- | useDebounce | Debounce values/input |
305
- | useLocalStorage | Persistent state |
306
- | useToggle | Boolean flip and set |
307
- | useBreakpoint | Responsive breakpoint API |
308
-
309
- | Utility | Description |
310
- |---------|--------------|
311
- | cn() | Merges class names with tailwind-merge |
312
- | defaultTheme | Fallback theme definitions |
313
-
314
- ---
315
-
316
- ## ๐Ÿง‘โ€๐Ÿ’ป Usage Example
317
-
318
- ```tsx
319
- import { Button, Card, useBreakpoint } from '@beyondcorp/beyond-ui';
320
- import '@beyondcorp/beyond-ui/dist/styles.css';
321
-
322
- export default function Demo() {
323
- const { isAbove } = useBreakpoint();
324
- return (
325
- <Card>
326
- <Button variant="primary" size={isAbove('md') ? "lg" : "sm"}>
327
- Click me
328
- </Button>
329
- </Card>
330
- );
331
- }
332
- ```
333
-
334
- ---
335
-
336
- ## ๐Ÿ“– Documentation & Storybook
337
-
338
- - [Public Storybook](https://storybook.ui.beyondsoftwares.com) โ€” hosted component gallery and prop reference
339
- - [Library landing page](https://ui.beyondsoftwares.com)
340
- - [Getting Started guide](./docs/getting-started.md)
341
- - [Theming & customization](./docs/theming.md)
342
- - [Security & DX notes](./docs/security-dx-notes.md)
343
- - Run `npm run storybook` locally for the full docs experience
344
-
345
- ---
346
-
347
- ## ๐Ÿ›  Project Structure
348
-
349
- ```
350
- beyond-ui/
351
- โ”œโ”€ src/
352
- โ”‚ โ”œโ”€ components/
353
- โ”‚ โ”œโ”€ hooks/
354
- โ”‚ โ”œโ”€ utils/
355
- โ”‚ โ”œโ”€ theme/
356
- โ”‚ โ””โ”€ index.ts
357
- โ”œโ”€ .storybook/
358
- โ”œโ”€ tests/
359
- โ”œโ”€ tailwind.config.js
360
- โ”œโ”€ tsconfig.json
361
- โ”œโ”€ vite.config.ts
362
- โ”œโ”€ package.json
363
- โ””โ”€ README.md
364
- ```
365
-
366
- ---
367
-
368
- ## ๐Ÿ›ค Roadmap & Milestones
369
-
370
- - M1: Project setup, theme, utilities
371
- - M2: Core components (Button, Input, Card, Modal, Badge, ... )
372
- - M3: All reusable hooks
373
- - M4: Storybook & docs
374
- - M5: Complete Jest test coverage & accessibility
375
- - M6: npm package v1 stable release
376
- - M7: Dashboard, charts, advanced table, improved theming
377
- - See roadmap.md for complete breakdown.
378
-
379
- ---
380
-
381
- ## ๐Ÿค Contributing
382
-
383
- - Contributions, PRs, and issues welcome!
384
- - Please see `/CONTRIBUTING.md` for details, coding standards, and branch workflow.
385
-
386
- ---
387
-
388
- ## ๐Ÿ“ License
389
-
390
- MIT ยฉ Beyond Corp, Soi Technology Solutions 2025
391
-
392
- ---
393
-
394
- # Beyond-UI: Build clean, scalable UIs faster, with every detail documented and ready to use.
1
+ # Beyond-UI
2
+
3
+ **A full-fledged React + TailwindCSS component library. Theme-agnostic, reusable, type-safe, and built for productive UIs.**
4
+
5
+ ---
6
+
7
+ ## ๐Ÿš€ Overview
8
+
9
+ ### Local Development Setup
10
+
11
+ | Requirement | Version |
12
+ | ----------- | ------- |
13
+ | Node.js | >= 18.0.0 |
14
+ | npm | >= 9.0.0 |
15
+
16
+ ```bash
17
+ # clone the repo
18
+ git clone https://github.com/soitechnologysolutions/beyond-ui.git
19
+ cd beyond-ui
20
+
21
+ # install dependencies
22
+ npm install
23
+
24
+ # start the playground
25
+ npm run dev
26
+ ```
27
+
28
+ ### Scripts you will use often
29
+
30
+ | Script | Description |
31
+ | ------ | ----------- |
32
+ | `npm run dev` | Launches Vite playground for landing/showcase pages |
33
+ | `npm run storybook` | Starts Storybook on http://localhost:6006 |
34
+ | `npm run lint` | Runs ESLint across src/stories/tests |
35
+ | `npm test` | Executes Jest + React Testing Library suites |
36
+ | `npm run build` | Builds component library + docs assets |
37
+
38
+ Beyond-UI is a comprehensive collection of ready-to-use, themeable React UI components and hooks, built with TypeScript, TailwindCSS, and Vite. Inspired by the best of modern design systems, itโ€™s built to be both design-consistent (via semantic theming) and easily composable for dashboards, apps, platforms, and SaaS.
39
+
40
+ - **Built for teams:** Use everywhere React and TailwindCSS runโ€”admin panels, SaaS, dashboards, internal tools, consumer apps.
41
+ - **Theme-agnostic:** Every style resolves to semantic Tailwind tokens (e.g., `bg-primary`), not hardcoded colors.
42
+ - **Reusable hooks:** Utilities like `useDarkMode`, `useDebounce`, and more included.
43
+ - **Customizable:** Extend via className or swap out theme tokens, with Storybook-ready demos.
44
+
45
+ ---
46
+
47
+ ## ๐Ÿ“ฆ Features
48
+
49
+ - **20+ reusable, composable components:** Button, Input, Card, Modal, Navbar, Sidebar, Tabs, Table, Alert, Spinner, Badge... (see below)
50
+ - **Variants/Theme support with [class-variance-authority (CVA)](https://cva.style/)**
51
+ - **Super-charged hooks:** `useDarkMode`, `useDebounce`, `useLocalStorage`, `useToggle`, `useBreakpoint`
52
+ - **Utility functions:** `cn()` (merge class names safely), default semantic `theme/default.ts`
53
+ - **Storybook documentation for every component**
54
+ - **Typed end-to-end (TypeScript)**
55
+ - **Testing with Jest & React Testing Library**
56
+ - **Easy Tailwind integration & custom theming**
57
+ - **Out-of-the-box default theme/fallback**
58
+ - **First-class DX: Vite, modern structure, peer deps for React/Tailwind**
59
+ - **NPM published, ready for mass reuse**
60
+
61
+ ---
62
+
63
+ ## โšก๏ธ Getting Started (Import CSS, No Tailwind Config Required)
64
+
65
+ Beyond-UI now bundles a ready-to-use CSS file for all styling.
66
+ Just add this line to your app's entry file (e.g. main.tsx or index.js):
67
+
68
+ ```js
69
+ import '@beyondcorp/beyond-ui/dist/styles.css';
70
+ ```
71
+
72
+ - You do **not** need to configure Tailwind content scanning for the library.
73
+ - This CSS is built with [Tailwind CSS](https://tailwindcss.com/) for all components and utilities included in the library.
74
+ - If you want to customize theme tokens (e.g. primary, secondary), you can still extend Tailwindโ€™s theme.
75
+
76
+ ---
77
+
78
+ ## ๐ŸŽจ Theming Sidebar & DashboardLayout
79
+
80
+ Beyond-UI is **completely theme-agnostic**:
81
+ - All UI is styled with semantic tokens (e.g., `bg-primary-50`, `text-primary-700`, `border-primary-600`) rather than direct color values.
82
+ - Defaults to Tailwind's built-in palette (e.g., gray/white) but is overrideable using Tailwind config.
83
+ - Ships with a fallback theme ([`theme/default.ts`](src/theme/default.ts)) for instant appearance.
84
+
85
+ ### Adding Sidebar Items in DashboardLayout
86
+
87
+ To have a configurable sidebar within your dashboard layout:
88
+
89
+ 1. **Define menu items** as an array of `MenuItem` objects (each with `id`, `label`, `icon`, `href`, `badge`, and optional `children` for nested menus).
90
+ 2. **Pass them to `DashboardLayout`** using the `sidebarMenuItems` prop.
91
+ 3. **Control the highlighted menu** by managing the `activeSidebarItem` prop.
92
+ 4. **Handle user interaction** with `onSidebarItemClick`.
93
+
94
+ **Example:**
95
+ ```tsx
96
+ import { DashboardLayout } from "@beyondcorp/beyond-ui";
97
+ import { Home, BarChart3, Users } from "lucide-react";
98
+ import '@beyondcorp/beyond-ui/dist/styles.css';
99
+
100
+ const menuItems = [
101
+ {
102
+ id: "dashboard",
103
+ label: "Dashboard",
104
+ icon: <Home className="h-5 w-5" />,
105
+ href: "/dashboard",
106
+ },
107
+ {
108
+ id: "analytics",
109
+ label: "Analytics",
110
+ icon: <BarChart3 className="h-5 w-5" />,
111
+ href: "/analytics",
112
+ badge: "New",
113
+ },
114
+ {
115
+ id: "users",
116
+ label: "Users",
117
+ icon: <Users className="h-5 w-5" />,
118
+ children: [
119
+ {
120
+ id: "all-users",
121
+ label: "All Users",
122
+ icon: <Users className="h-4 w-4" />,
123
+ },
124
+ ],
125
+ },
126
+ ];
127
+ export default function DemoDashboard() {
128
+ const [active, setActive] = React.useState("dashboard");
129
+ return (
130
+ <DashboardLayout
131
+ sidebarMenuItems={menuItems}
132
+ activeSidebarItem={active}
133
+ onSidebarItemClick={setActive}
134
+ >
135
+ <main>
136
+ {/* Main dashboard content goes here */}
137
+ </main>
138
+ </DashboardLayout>
139
+ );
140
+ }
141
+ ```
142
+ You can build any sidebar structureโ€”single-level, nested, badgesโ€”using this pattern and pass it to the layout.
143
+
144
+ ### Customizing Sidebar/DashboardLayout Colors
145
+
146
+ To override the sidebar background, accent, and dashboard colors, extend your `tailwind.config.js` with your color palette:
147
+
148
+ ```js
149
+ theme: {
150
+ extend: {
151
+ colors: {
152
+ primary: {
153
+ 50: '#f2f8ff', // sidebar background
154
+ 100: '#dbeafe',
155
+ 600: '#2563eb', // sidebar brand area (logo bg, borders)
156
+ 700: '#1d4ed8',
157
+ },
158
+ secondary: {
159
+ 50: '#f4f6fa',
160
+ 700: '#3b82f6',
161
+ },
162
+ danger: {
163
+ 50: '#fef2f2',
164
+ 600: '#dc2626',
165
+ },
166
+ // You can add other tokens
167
+ // See theme/default.ts for all required keys
168
+ }
169
+ }
170
+ }
171
+ ```
172
+
173
+ Sidebar, DashboardLayout, and badge/notification UI use these tokens for their background, text, borders, and hover states.
174
+
175
+ **Example: Custom Sidebar**
176
+ ```tsx
177
+ import { Sidebar } from "@beyondcorp/beyond-ui";
178
+ import '@beyondcorp/beyond-ui/dist/styles.css';
179
+
180
+ // Nested menu, custom badges
181
+ const menuItems = [
182
+ {
183
+ id: "main",
184
+ label: "Main",
185
+ icon: <span>M</span>,
186
+ badge: "Hot",
187
+ children: [
188
+ {
189
+ id: "nested1",
190
+ label: "Nested Item",
191
+ icon: <span>N</span>,
192
+ badge: "New",
193
+ },
194
+ ]
195
+ },
196
+ ];
197
+
198
+ <Sidebar
199
+ menuItems={menuItems}
200
+ className="shadow-xl"
201
+ />
202
+ ```
203
+
204
+ ### Fallback Theme
205
+
206
+ If your Tailwind config doesn't specify semantic tokens, Beyond-UI defaults to the palette in [`theme/default.ts`](src/theme/default.ts), ensuring that all layouts/components always render.
207
+
208
+ ---
209
+
210
+ ## ๐Ÿงฉ Components
211
+
212
+ | Name | Features / Variants |
213
+ |---------------|---------------------------------|
214
+ | Button | Variants (primary, secondary, danger, ghost), Sizes (sm, md, lg), Full type safety |
215
+ | Input | Variants (default, error, success), Sizes, Icon support |
216
+ | Textarea | Auto-resize, char counter |
217
+ | Select | Dropdown, search, async |
218
+ | Checkbox | Label, indeterminate |
219
+ | Radio | Group support |
220
+ | Switch | Animation, boolean toggle |
221
+ | Card | Header, body, footer slots |
222
+ | Modal | Overlay, keyboard dismiss |
223
+ | Badge | Variants (info, warning, error) |
224
+ | Tabs | Horizontal/vertical, variants |
225
+ | Table | Sortable, customized cells |
226
+ | Alert | Info/success/warning/danger |
227
+ | Toast | Notifications, timeouts |
228
+ | Skeleton | Loading states |
229
+ | Spinner | Loader, multiple sizes |
230
+ | Navbar, Sidebar | Layout primitives |
231
+ | StatsCard | Dashboard blocks |
232
+ | ChartWrapper | Recharts integration |
233
+ | ... | More (see Storybook) |
234
+
235
+ ---
236
+
237
+ ## ๐ŸŒ™ NightModeSwitch Component
238
+
239
+ A reusable, theme-agnostic dark/light mode toggle with sun/moon icons.
240
+
241
+ ### Usage
242
+
243
+ ```tsx
244
+ import { NightModeSwitch } from "src/components/NightModeSwitch";
245
+
246
+ <NightModeSwitch
247
+ variant="ghost"
248
+ size="md"
249
+ iconStyle="filled"
250
+ ariaLabel="Toggle dark mode"
251
+ className="ml-2"
252
+ />
253
+ ```
254
+
255
+ ### Props
256
+
257
+ - `variant`: "primary" | "secondary" | "ghost" (default: "ghost")
258
+ - `size`: "sm" | "md" | "lg" (default: "md")
259
+ - `iconStyle`: "filled" | "outline" (default: "filled")
260
+ - `ariaLabel`: string (default: "Toggle dark mode")
261
+ - `className`: string (optional)
262
+
263
+ ### Theming
264
+
265
+ - Uses semantic Tailwind tokens (`bg-primary`, `text-primary`, etc.).
266
+ - Respects default theme in [`src/theme/default.ts`](src/theme/default.ts:1).
267
+ - No hardcoded colors; fully theme-agnostic.
268
+
269
+ ### Integration Example
270
+
271
+ Add to Navbar:
272
+
273
+ ```tsx
274
+ import { Navbar } from "src/components/Navbar";
275
+ import { NightModeSwitch } from "src/components/NightModeSwitch";
276
+
277
+ <Navbar>
278
+ <div className="flex items-center gap-4 px-4 w-full">
279
+ <span className="font-bold text-xl">My App</span>
280
+ <nav className="flex gap-2 ml-auto">
281
+ <a href="/" className="text-blue-500">Home</a>
282
+ <a href="/about" className="text-blue-500">About</a>
283
+ </nav>
284
+ <NightModeSwitch className="ml-4" variant="ghost" size="md" ariaLabel="Toggle dark mode" />
285
+ </div>
286
+ </Navbar>
287
+ ```
288
+
289
+ ### Accessibility
290
+
291
+ - Keyboard and screen reader accessible.
292
+ - Uses `aria-label` and `aria-pressed`.
293
+
294
+ ### Storybook
295
+
296
+ See `stories/NightModeSwitch.stories.tsx` for live examples and customization.
297
+ ---
298
+
299
+ ## ๐Ÿงต Hooks & Utilities
300
+
301
+ | Hook | Purpose |
302
+ |---------------------|----------------------------------|
303
+ | useDarkMode | Toggle and persist theme |
304
+ | useDebounce | Debounce values/input |
305
+ | useLocalStorage | Persistent state |
306
+ | useToggle | Boolean flip and set |
307
+ | useBreakpoint | Responsive breakpoint API |
308
+
309
+ | Utility | Description |
310
+ |---------|--------------|
311
+ | cn() | Merges class names with tailwind-merge |
312
+ | defaultTheme | Fallback theme definitions |
313
+
314
+ ---
315
+
316
+ ## ๐Ÿง‘โ€๐Ÿ’ป Usage Example
317
+
318
+ ```tsx
319
+ import { Button, Card, useBreakpoint } from '@beyondcorp/beyond-ui';
320
+ import '@beyondcorp/beyond-ui/dist/styles.css';
321
+
322
+ export default function Demo() {
323
+ const { isAbove } = useBreakpoint();
324
+ return (
325
+ <Card>
326
+ <Button variant="primary" size={isAbove('md') ? "lg" : "sm"}>
327
+ Click me
328
+ </Button>
329
+ </Card>
330
+ );
331
+ }
332
+ ```
333
+
334
+ ---
335
+
336
+ ## ๐Ÿ“– Documentation & Storybook
337
+
338
+ - [Public Storybook](https://storybook.ui.beyondsoftwares.com) โ€” hosted component gallery and prop reference
339
+ - [Library landing page](https://ui.beyondsoftwares.com)
340
+ - [Getting Started guide](./docs/getting-started.md)
341
+ - [Theming & customization](./docs/theming.md)
342
+ - [Security & DX notes](./docs/security-dx-notes.md)
343
+ - Run `npm run storybook` locally for the full docs experience
344
+
345
+ ---
346
+
347
+ ## ๐Ÿ›  Project Structure
348
+
349
+ ```
350
+ beyond-ui/
351
+ โ”œโ”€ src/
352
+ โ”‚ โ”œโ”€ components/
353
+ โ”‚ โ”œโ”€ hooks/
354
+ โ”‚ โ”œโ”€ utils/
355
+ โ”‚ โ”œโ”€ theme/
356
+ โ”‚ โ””โ”€ index.ts
357
+ โ”œโ”€ .storybook/
358
+ โ”œโ”€ tests/
359
+ โ”œโ”€ tailwind.config.js
360
+ โ”œโ”€ tsconfig.json
361
+ โ”œโ”€ vite.config.ts
362
+ โ”œโ”€ package.json
363
+ โ””โ”€ README.md
364
+ ```
365
+
366
+ ---
367
+
368
+ ## ๐Ÿ›ค Roadmap & Milestones
369
+
370
+ - M1: Project setup, theme, utilities
371
+ - M2: Core components (Button, Input, Card, Modal, Badge, ... )
372
+ - M3: All reusable hooks
373
+ - M4: Storybook & docs
374
+ - M5: Complete Jest test coverage & accessibility
375
+ - M6: npm package v1 stable release
376
+ - M7: Dashboard, charts, advanced table, improved theming
377
+ - See roadmap.md for complete breakdown.
378
+
379
+ ---
380
+
381
+ ## ๐Ÿค Contributing
382
+
383
+ - Contributions, PRs, and issues welcome!
384
+ - Please see `/CONTRIBUTING.md` for details, coding standards, and branch workflow.
385
+
386
+ ---
387
+
388
+ ## ๐Ÿ“ License
389
+
390
+ MIT ยฉ Beyond Corp, Soi Technology Solutions 2025
391
+
392
+ ---
393
+
394
+ # Beyond-UI: Build clean, scalable UIs faster, with every detail documented and ready to use.