@alkimi.org/ui-kit 0.1.23 → 0.1.24
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 +181 -0
- package/README.npm.md +181 -0
- package/dist/components/button.d.mts +1 -1
- package/dist/components/button.d.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -242,6 +242,187 @@ Make sure to include your custom font using `@font-face` or a web font service l
|
|
|
242
242
|
}
|
|
243
243
|
```
|
|
244
244
|
|
|
245
|
+
## Available Components
|
|
246
|
+
|
|
247
|
+
### Sidebar
|
|
248
|
+
|
|
249
|
+
A collapsible sidebar component with responsive design and keyboard shortcuts. The sidebar supports multiple variants, collapsible modes, and includes all necessary sub-components for building navigation interfaces.
|
|
250
|
+
|
|
251
|
+
#### Basic Usage
|
|
252
|
+
|
|
253
|
+
```tsx
|
|
254
|
+
import {
|
|
255
|
+
Sidebar,
|
|
256
|
+
SidebarContent,
|
|
257
|
+
SidebarHeader,
|
|
258
|
+
SidebarProvider,
|
|
259
|
+
SidebarInset,
|
|
260
|
+
SidebarTrigger,
|
|
261
|
+
} from "@alkimi.org/ui-kit"
|
|
262
|
+
|
|
263
|
+
function App() {
|
|
264
|
+
return (
|
|
265
|
+
<SidebarProvider>
|
|
266
|
+
<Sidebar collapsible="icon">
|
|
267
|
+
<SidebarHeader showTrigger>
|
|
268
|
+
<h2>My App</h2>
|
|
269
|
+
</SidebarHeader>
|
|
270
|
+
<SidebarContent>
|
|
271
|
+
{/* Your sidebar content */}
|
|
272
|
+
</SidebarContent>
|
|
273
|
+
</Sidebar>
|
|
274
|
+
<SidebarInset>
|
|
275
|
+
<header>
|
|
276
|
+
<SidebarTrigger />
|
|
277
|
+
<h1>Main Content Area</h1>
|
|
278
|
+
</header>
|
|
279
|
+
{/* Your main content */}
|
|
280
|
+
</SidebarInset>
|
|
281
|
+
</SidebarProvider>
|
|
282
|
+
)
|
|
283
|
+
}
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
#### Components
|
|
287
|
+
|
|
288
|
+
##### SidebarProvider
|
|
289
|
+
|
|
290
|
+
Wraps your entire layout and provides sidebar context.
|
|
291
|
+
|
|
292
|
+
**Props:**
|
|
293
|
+
- `defaultOpen?: boolean` - Initial sidebar state (default: `true`)
|
|
294
|
+
- `open?: boolean` - Controlled sidebar state
|
|
295
|
+
- `onOpenChange?: (open: boolean) => void` - Callback when sidebar state changes
|
|
296
|
+
|
|
297
|
+
##### Sidebar
|
|
298
|
+
|
|
299
|
+
The main sidebar container.
|
|
300
|
+
|
|
301
|
+
**Props:**
|
|
302
|
+
- `side?: "left" | "right"` - Sidebar position (default: `"left"`)
|
|
303
|
+
- `variant?: "sidebar" | "floating" | "inset"` - Visual style (default: `"sidebar"`)
|
|
304
|
+
- `collapsible?: "offcanvas" | "icon" | "none"` - Collapse behavior (default: `"offcanvas"`)
|
|
305
|
+
- `offcanvas` - Sidebar slides completely off-screen
|
|
306
|
+
- `icon` - Sidebar collapses to icon-only mode
|
|
307
|
+
- `none` - Sidebar is always visible and non-collapsible
|
|
308
|
+
|
|
309
|
+
##### SidebarHeader
|
|
310
|
+
|
|
311
|
+
Header section of the sidebar.
|
|
312
|
+
|
|
313
|
+
**Props:**
|
|
314
|
+
- `showTrigger?: boolean` - Show toggle button in header (default: `false`)
|
|
315
|
+
|
|
316
|
+
##### SidebarContent
|
|
317
|
+
|
|
318
|
+
Scrollable content area of the sidebar.
|
|
319
|
+
|
|
320
|
+
##### SidebarFooter
|
|
321
|
+
|
|
322
|
+
Footer section of the sidebar.
|
|
323
|
+
|
|
324
|
+
##### SidebarTrigger
|
|
325
|
+
|
|
326
|
+
Button to toggle sidebar visibility. Automatically shows appropriate icons for mobile and desktop.
|
|
327
|
+
|
|
328
|
+
##### SidebarInset
|
|
329
|
+
|
|
330
|
+
Main content area wrapper that adapts to sidebar state.
|
|
331
|
+
|
|
332
|
+
##### Navigation Components
|
|
333
|
+
|
|
334
|
+
Build navigation menus using these components:
|
|
335
|
+
|
|
336
|
+
```tsx
|
|
337
|
+
import {
|
|
338
|
+
SidebarMenu,
|
|
339
|
+
SidebarMenuItem,
|
|
340
|
+
SidebarMenuButton,
|
|
341
|
+
SidebarGroup,
|
|
342
|
+
SidebarGroupLabel,
|
|
343
|
+
SidebarGroupContent,
|
|
344
|
+
} from "@alkimi.org/ui-kit"
|
|
345
|
+
|
|
346
|
+
<SidebarGroup>
|
|
347
|
+
<SidebarGroupLabel>Navigation</SidebarGroupLabel>
|
|
348
|
+
<SidebarGroupContent>
|
|
349
|
+
<SidebarMenu>
|
|
350
|
+
<SidebarMenuItem>
|
|
351
|
+
<SidebarMenuButton tooltip="Home">
|
|
352
|
+
<Home />
|
|
353
|
+
<span>Home</span>
|
|
354
|
+
</SidebarMenuButton>
|
|
355
|
+
</SidebarMenuItem>
|
|
356
|
+
</SidebarMenu>
|
|
357
|
+
</SidebarGroupContent>
|
|
358
|
+
</SidebarGroup>
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
**Available Components:**
|
|
362
|
+
- `SidebarGroup` - Groups related menu items
|
|
363
|
+
- `SidebarGroupLabel` - Label for a group
|
|
364
|
+
- `SidebarGroupContent` - Container for group items
|
|
365
|
+
- `SidebarGroupAction` - Action button for a group
|
|
366
|
+
- `SidebarMenu` - Menu list container
|
|
367
|
+
- `SidebarMenuItem` - Individual menu item
|
|
368
|
+
- `SidebarMenuButton` - Interactive menu button with tooltip support
|
|
369
|
+
- `SidebarMenuAction` - Action button for menu items
|
|
370
|
+
- `SidebarMenuBadge` - Badge/count indicator
|
|
371
|
+
- `SidebarMenuSub` - Submenu container
|
|
372
|
+
- `SidebarMenuSubItem` - Submenu item
|
|
373
|
+
- `SidebarMenuSubButton` - Submenu button
|
|
374
|
+
|
|
375
|
+
##### SidebarMenuButton Props
|
|
376
|
+
|
|
377
|
+
- `variant?: "default" | "outline"` - Visual style
|
|
378
|
+
- `size?: "default" | "sm" | "lg"` - Button size
|
|
379
|
+
- `isActive?: boolean` - Highlight as active
|
|
380
|
+
- `tooltip?: string | TooltipProps` - Tooltip text or props
|
|
381
|
+
- `asChild?: boolean` - Render as child component (e.g., for links)
|
|
382
|
+
|
|
383
|
+
##### Utility Components
|
|
384
|
+
|
|
385
|
+
- `SidebarInput` - Styled input for sidebar (e.g., search)
|
|
386
|
+
- `SidebarSeparator` - Visual separator
|
|
387
|
+
- `SidebarRail` - Clickable rail for toggling sidebar
|
|
388
|
+
- `SidebarMenuSkeleton` - Loading skeleton for menu items
|
|
389
|
+
|
|
390
|
+
##### useSidebar Hook
|
|
391
|
+
|
|
392
|
+
Access sidebar state and controls from any component within `SidebarProvider`:
|
|
393
|
+
|
|
394
|
+
```tsx
|
|
395
|
+
import { useSidebar } from "@alkimi.org/ui-kit"
|
|
396
|
+
|
|
397
|
+
function MyComponent() {
|
|
398
|
+
const { state, open, toggleSidebar, isMobile } = useSidebar()
|
|
399
|
+
|
|
400
|
+
return (
|
|
401
|
+
<div>
|
|
402
|
+
Sidebar is {state} {/* "expanded" or "collapsed" */}
|
|
403
|
+
</div>
|
|
404
|
+
)
|
|
405
|
+
}
|
|
406
|
+
```
|
|
407
|
+
|
|
408
|
+
**Returns:**
|
|
409
|
+
- `state: "expanded" | "collapsed"` - Current sidebar state
|
|
410
|
+
- `open: boolean` - Whether sidebar is open (desktop)
|
|
411
|
+
- `setOpen: (open: boolean) => void` - Set sidebar state
|
|
412
|
+
- `openMobile: boolean` - Whether sidebar is open (mobile)
|
|
413
|
+
- `setOpenMobile: (open: boolean) => void` - Set mobile sidebar state
|
|
414
|
+
- `isMobile: boolean` - Whether viewing on mobile
|
|
415
|
+
- `toggleSidebar: () => void` - Toggle sidebar visibility
|
|
416
|
+
|
|
417
|
+
#### Keyboard Shortcuts
|
|
418
|
+
|
|
419
|
+
- `Cmd+B` (Mac) or `Ctrl+B` (Windows/Linux) - Toggle sidebar
|
|
420
|
+
|
|
421
|
+
#### Responsive Behavior
|
|
422
|
+
|
|
423
|
+
- **Desktop**: Sidebar is fixed and collapsible based on the `collapsible` prop
|
|
424
|
+
- **Mobile**: Sidebar automatically becomes a slide-out sheet overlay
|
|
425
|
+
|
|
245
426
|
## Usage
|
|
246
427
|
|
|
247
428
|
You can import components in two ways:
|
package/README.npm.md
CHANGED
|
@@ -242,6 +242,187 @@ Make sure to include your custom font using `@font-face` or a web font service l
|
|
|
242
242
|
}
|
|
243
243
|
```
|
|
244
244
|
|
|
245
|
+
## Available Components
|
|
246
|
+
|
|
247
|
+
### Sidebar
|
|
248
|
+
|
|
249
|
+
A collapsible sidebar component with responsive design and keyboard shortcuts. The sidebar supports multiple variants, collapsible modes, and includes all necessary sub-components for building navigation interfaces.
|
|
250
|
+
|
|
251
|
+
#### Basic Usage
|
|
252
|
+
|
|
253
|
+
```tsx
|
|
254
|
+
import {
|
|
255
|
+
Sidebar,
|
|
256
|
+
SidebarContent,
|
|
257
|
+
SidebarHeader,
|
|
258
|
+
SidebarProvider,
|
|
259
|
+
SidebarInset,
|
|
260
|
+
SidebarTrigger,
|
|
261
|
+
} from "@alkimi.org/ui-kit"
|
|
262
|
+
|
|
263
|
+
function App() {
|
|
264
|
+
return (
|
|
265
|
+
<SidebarProvider>
|
|
266
|
+
<Sidebar collapsible="icon">
|
|
267
|
+
<SidebarHeader showTrigger>
|
|
268
|
+
<h2>My App</h2>
|
|
269
|
+
</SidebarHeader>
|
|
270
|
+
<SidebarContent>
|
|
271
|
+
{/* Your sidebar content */}
|
|
272
|
+
</SidebarContent>
|
|
273
|
+
</Sidebar>
|
|
274
|
+
<SidebarInset>
|
|
275
|
+
<header>
|
|
276
|
+
<SidebarTrigger />
|
|
277
|
+
<h1>Main Content Area</h1>
|
|
278
|
+
</header>
|
|
279
|
+
{/* Your main content */}
|
|
280
|
+
</SidebarInset>
|
|
281
|
+
</SidebarProvider>
|
|
282
|
+
)
|
|
283
|
+
}
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
#### Components
|
|
287
|
+
|
|
288
|
+
##### SidebarProvider
|
|
289
|
+
|
|
290
|
+
Wraps your entire layout and provides sidebar context.
|
|
291
|
+
|
|
292
|
+
**Props:**
|
|
293
|
+
- `defaultOpen?: boolean` - Initial sidebar state (default: `true`)
|
|
294
|
+
- `open?: boolean` - Controlled sidebar state
|
|
295
|
+
- `onOpenChange?: (open: boolean) => void` - Callback when sidebar state changes
|
|
296
|
+
|
|
297
|
+
##### Sidebar
|
|
298
|
+
|
|
299
|
+
The main sidebar container.
|
|
300
|
+
|
|
301
|
+
**Props:**
|
|
302
|
+
- `side?: "left" | "right"` - Sidebar position (default: `"left"`)
|
|
303
|
+
- `variant?: "sidebar" | "floating" | "inset"` - Visual style (default: `"sidebar"`)
|
|
304
|
+
- `collapsible?: "offcanvas" | "icon" | "none"` - Collapse behavior (default: `"offcanvas"`)
|
|
305
|
+
- `offcanvas` - Sidebar slides completely off-screen
|
|
306
|
+
- `icon` - Sidebar collapses to icon-only mode
|
|
307
|
+
- `none` - Sidebar is always visible and non-collapsible
|
|
308
|
+
|
|
309
|
+
##### SidebarHeader
|
|
310
|
+
|
|
311
|
+
Header section of the sidebar.
|
|
312
|
+
|
|
313
|
+
**Props:**
|
|
314
|
+
- `showTrigger?: boolean` - Show toggle button in header (default: `false`)
|
|
315
|
+
|
|
316
|
+
##### SidebarContent
|
|
317
|
+
|
|
318
|
+
Scrollable content area of the sidebar.
|
|
319
|
+
|
|
320
|
+
##### SidebarFooter
|
|
321
|
+
|
|
322
|
+
Footer section of the sidebar.
|
|
323
|
+
|
|
324
|
+
##### SidebarTrigger
|
|
325
|
+
|
|
326
|
+
Button to toggle sidebar visibility. Automatically shows appropriate icons for mobile and desktop.
|
|
327
|
+
|
|
328
|
+
##### SidebarInset
|
|
329
|
+
|
|
330
|
+
Main content area wrapper that adapts to sidebar state.
|
|
331
|
+
|
|
332
|
+
##### Navigation Components
|
|
333
|
+
|
|
334
|
+
Build navigation menus using these components:
|
|
335
|
+
|
|
336
|
+
```tsx
|
|
337
|
+
import {
|
|
338
|
+
SidebarMenu,
|
|
339
|
+
SidebarMenuItem,
|
|
340
|
+
SidebarMenuButton,
|
|
341
|
+
SidebarGroup,
|
|
342
|
+
SidebarGroupLabel,
|
|
343
|
+
SidebarGroupContent,
|
|
344
|
+
} from "@alkimi.org/ui-kit"
|
|
345
|
+
|
|
346
|
+
<SidebarGroup>
|
|
347
|
+
<SidebarGroupLabel>Navigation</SidebarGroupLabel>
|
|
348
|
+
<SidebarGroupContent>
|
|
349
|
+
<SidebarMenu>
|
|
350
|
+
<SidebarMenuItem>
|
|
351
|
+
<SidebarMenuButton tooltip="Home">
|
|
352
|
+
<Home />
|
|
353
|
+
<span>Home</span>
|
|
354
|
+
</SidebarMenuButton>
|
|
355
|
+
</SidebarMenuItem>
|
|
356
|
+
</SidebarMenu>
|
|
357
|
+
</SidebarGroupContent>
|
|
358
|
+
</SidebarGroup>
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
**Available Components:**
|
|
362
|
+
- `SidebarGroup` - Groups related menu items
|
|
363
|
+
- `SidebarGroupLabel` - Label for a group
|
|
364
|
+
- `SidebarGroupContent` - Container for group items
|
|
365
|
+
- `SidebarGroupAction` - Action button for a group
|
|
366
|
+
- `SidebarMenu` - Menu list container
|
|
367
|
+
- `SidebarMenuItem` - Individual menu item
|
|
368
|
+
- `SidebarMenuButton` - Interactive menu button with tooltip support
|
|
369
|
+
- `SidebarMenuAction` - Action button for menu items
|
|
370
|
+
- `SidebarMenuBadge` - Badge/count indicator
|
|
371
|
+
- `SidebarMenuSub` - Submenu container
|
|
372
|
+
- `SidebarMenuSubItem` - Submenu item
|
|
373
|
+
- `SidebarMenuSubButton` - Submenu button
|
|
374
|
+
|
|
375
|
+
##### SidebarMenuButton Props
|
|
376
|
+
|
|
377
|
+
- `variant?: "default" | "outline"` - Visual style
|
|
378
|
+
- `size?: "default" | "sm" | "lg"` - Button size
|
|
379
|
+
- `isActive?: boolean` - Highlight as active
|
|
380
|
+
- `tooltip?: string | TooltipProps` - Tooltip text or props
|
|
381
|
+
- `asChild?: boolean` - Render as child component (e.g., for links)
|
|
382
|
+
|
|
383
|
+
##### Utility Components
|
|
384
|
+
|
|
385
|
+
- `SidebarInput` - Styled input for sidebar (e.g., search)
|
|
386
|
+
- `SidebarSeparator` - Visual separator
|
|
387
|
+
- `SidebarRail` - Clickable rail for toggling sidebar
|
|
388
|
+
- `SidebarMenuSkeleton` - Loading skeleton for menu items
|
|
389
|
+
|
|
390
|
+
##### useSidebar Hook
|
|
391
|
+
|
|
392
|
+
Access sidebar state and controls from any component within `SidebarProvider`:
|
|
393
|
+
|
|
394
|
+
```tsx
|
|
395
|
+
import { useSidebar } from "@alkimi.org/ui-kit"
|
|
396
|
+
|
|
397
|
+
function MyComponent() {
|
|
398
|
+
const { state, open, toggleSidebar, isMobile } = useSidebar()
|
|
399
|
+
|
|
400
|
+
return (
|
|
401
|
+
<div>
|
|
402
|
+
Sidebar is {state} {/* "expanded" or "collapsed" */}
|
|
403
|
+
</div>
|
|
404
|
+
)
|
|
405
|
+
}
|
|
406
|
+
```
|
|
407
|
+
|
|
408
|
+
**Returns:**
|
|
409
|
+
- `state: "expanded" | "collapsed"` - Current sidebar state
|
|
410
|
+
- `open: boolean` - Whether sidebar is open (desktop)
|
|
411
|
+
- `setOpen: (open: boolean) => void` - Set sidebar state
|
|
412
|
+
- `openMobile: boolean` - Whether sidebar is open (mobile)
|
|
413
|
+
- `setOpenMobile: (open: boolean) => void` - Set mobile sidebar state
|
|
414
|
+
- `isMobile: boolean` - Whether viewing on mobile
|
|
415
|
+
- `toggleSidebar: () => void` - Toggle sidebar visibility
|
|
416
|
+
|
|
417
|
+
#### Keyboard Shortcuts
|
|
418
|
+
|
|
419
|
+
- `Cmd+B` (Mac) or `Ctrl+B` (Windows/Linux) - Toggle sidebar
|
|
420
|
+
|
|
421
|
+
#### Responsive Behavior
|
|
422
|
+
|
|
423
|
+
- **Desktop**: Sidebar is fixed and collapsible based on the `collapsible` prop
|
|
424
|
+
- **Mobile**: Sidebar automatically becomes a slide-out sheet overlay
|
|
425
|
+
|
|
245
426
|
## Usage
|
|
246
427
|
|
|
247
428
|
You can import components in two ways:
|
|
@@ -3,7 +3,7 @@ import * as React from 'react';
|
|
|
3
3
|
import { VariantProps } from 'class-variance-authority';
|
|
4
4
|
|
|
5
5
|
declare const buttonVariants: (props?: ({
|
|
6
|
-
variant?: "default" | "
|
|
6
|
+
variant?: "default" | "link" | "destructive" | "outline" | "secondary" | "ghost" | null | undefined;
|
|
7
7
|
size?: "default" | "sm" | "lg" | "icon" | null | undefined;
|
|
8
8
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
9
9
|
interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
|
|
@@ -3,7 +3,7 @@ import * as React from 'react';
|
|
|
3
3
|
import { VariantProps } from 'class-variance-authority';
|
|
4
4
|
|
|
5
5
|
declare const buttonVariants: (props?: ({
|
|
6
|
-
variant?: "default" | "
|
|
6
|
+
variant?: "default" | "link" | "destructive" | "outline" | "secondary" | "ghost" | null | undefined;
|
|
7
7
|
size?: "default" | "sm" | "lg" | "icon" | null | undefined;
|
|
8
8
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
9
9
|
interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
|