laif-ds 0.2.44 → 0.2.45
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/dist/_virtual/index4.js +5 -5
- package/dist/_virtual/index5.js +5 -5
- package/dist/_virtual/index6.js +2 -2
- package/dist/_virtual/index7.js +2 -2
- package/dist/agent-docs/components/Accordion.md +157 -0
- package/dist/agent-docs/components/Alert.md +95 -0
- package/dist/agent-docs/components/AlertDialog.md +126 -0
- package/dist/agent-docs/components/AppEditor.md +90 -0
- package/dist/agent-docs/components/AppForm.md +242 -0
- package/dist/agent-docs/components/AppMultipleSelectDropdown.md +38 -0
- package/dist/agent-docs/components/AppRadioGroup.md +223 -0
- package/dist/agent-docs/components/AppSelect.md +427 -0
- package/dist/agent-docs/components/AppSidebar.md +122 -0
- package/dist/agent-docs/components/AppStepper.md +77 -0
- package/dist/agent-docs/components/AspectRatio.md +87 -0
- package/dist/agent-docs/components/AsyncSelect.md +127 -0
- package/dist/agent-docs/components/AudioVisualizer.md +41 -0
- package/dist/agent-docs/components/Avatar.md +113 -0
- package/dist/agent-docs/components/Badge.md +118 -0
- package/dist/agent-docs/components/Breadcrumb.md +78 -0
- package/dist/agent-docs/components/Button.md +129 -0
- package/dist/agent-docs/components/Calendar.md +222 -0
- package/dist/agent-docs/components/Card.md +147 -0
- package/dist/agent-docs/components/Carousel.md +129 -0
- package/dist/agent-docs/components/Chart.md +75 -0
- package/dist/agent-docs/components/Chat.md +109 -0
- package/dist/agent-docs/components/ChatMessage.md +61 -0
- package/dist/agent-docs/components/Checkbox.md +135 -0
- package/dist/agent-docs/components/CircularProgress.md +49 -0
- package/dist/agent-docs/components/CodeHighlighter.md +31 -0
- package/dist/agent-docs/components/Collapsible.md +95 -0
- package/dist/agent-docs/components/Command.md +142 -0
- package/dist/agent-docs/components/Confirmer.md +175 -0
- package/dist/agent-docs/components/ContextMenu.md +191 -0
- package/dist/agent-docs/components/CopyButton.md +26 -0
- package/dist/agent-docs/components/DataCrossTable.md +94 -0
- package/dist/agent-docs/components/DataTable.md +254 -0
- package/dist/agent-docs/components/DatePicker.md +109 -0
- package/dist/agent-docs/components/Dialog.md +125 -0
- package/dist/agent-docs/components/Drawer.md +127 -0
- package/dist/agent-docs/components/DropdownMenu.md +57 -0
- package/dist/agent-docs/components/FilePreview.md +99 -0
- package/dist/agent-docs/components/FilePreviewer.md +139 -0
- package/dist/agent-docs/components/FileUploader.md +129 -0
- package/dist/agent-docs/components/Form.md +62 -0
- package/dist/agent-docs/components/FormComposer.md +137 -0
- package/dist/agent-docs/components/GanttChart.md +122 -0
- package/dist/agent-docs/components/HoverCard.md +37 -0
- package/dist/agent-docs/components/Icon.md +99 -0
- package/dist/agent-docs/components/Input.md +138 -0
- package/dist/agent-docs/components/InputOtp.md +40 -0
- package/dist/agent-docs/components/InputSelector.md +97 -0
- package/dist/agent-docs/components/InterruptPrompt.md +32 -0
- package/dist/agent-docs/components/Label.md +28 -0
- package/dist/agent-docs/components/MarkdownRenderer.md +36 -0
- package/dist/agent-docs/components/Menubar.md +164 -0
- package/dist/agent-docs/components/MessageInput.md +131 -0
- package/dist/agent-docs/components/MessageList.md +96 -0
- package/dist/agent-docs/components/MultipleSelector.md +146 -0
- package/dist/agent-docs/components/NavigationMenu.md +51 -0
- package/dist/agent-docs/components/Pagination.md +55 -0
- package/dist/agent-docs/components/Popover.md +103 -0
- package/dist/agent-docs/components/Progress.md +30 -0
- package/dist/agent-docs/components/PromptSuggestions.md +33 -0
- package/dist/agent-docs/components/RadioGroup.md +90 -0
- package/dist/agent-docs/components/Resizable.md +35 -0
- package/dist/agent-docs/components/ResizePrompt.md +13 -0
- package/dist/agent-docs/components/ScrollArea.md +49 -0
- package/dist/agent-docs/components/SecurePdfViewer.md +38 -0
- package/dist/agent-docs/components/Select.md +132 -0
- package/dist/agent-docs/components/Separator.md +32 -0
- package/dist/agent-docs/components/Sheet.md +40 -0
- package/dist/agent-docs/components/ShikiHighlighter.md +31 -0
- package/dist/agent-docs/components/Sidebar.md +85 -0
- package/dist/agent-docs/components/Skeleton.md +29 -0
- package/dist/agent-docs/components/Slider.md +58 -0
- package/dist/agent-docs/components/Sonner.md +21 -0
- package/dist/agent-docs/components/Spinner.md +139 -0
- package/dist/agent-docs/components/Stepper.md +67 -0
- package/dist/agent-docs/components/Switch.md +42 -0
- package/dist/agent-docs/components/Table.md +63 -0
- package/dist/agent-docs/components/TableSkeleton.md +46 -0
- package/dist/agent-docs/components/Tabs.md +86 -0
- package/dist/agent-docs/components/TextArea.md +52 -0
- package/dist/agent-docs/components/ThemeSwitcher.md +69 -0
- package/dist/agent-docs/components/Toaster.md +23 -0
- package/dist/agent-docs/components/Toggle.md +31 -0
- package/dist/agent-docs/components/ToggleGroup.md +30 -0
- package/dist/agent-docs/components/Tooltip.md +91 -0
- package/dist/agent-docs/components/TypingIndicator.md +21 -0
- package/dist/agent-docs/components/Typo.md +65 -0
- package/dist/agent-docs/components/WeeklyCalendar.md +64 -0
- package/dist/agent-docs/components-list.md +144 -0
- package/dist/node_modules/eventemitter3/index2.js +1 -1
- package/dist/node_modules/hast-util-to-jsx-runtime/lib/index.js +1 -1
- package/dist/node_modules/style-to-object/cjs/index.js +1 -1
- package/dist/node_modules/unified/lib/index.js +1 -1
- package/package.json +3 -2
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
# Select (Deprecated)
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Single-selection dropdown built on Radix Select.
|
|
6
|
+
|
|
7
|
+
- ⚠️ This component is deprecated. Prefer `AppSelect` for new code.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Subcomponents & Props
|
|
12
|
+
|
|
13
|
+
- **Select**: Root container with optional label
|
|
14
|
+
- `size`: `"sm" | "default" | "lg"` (default `"default"`)
|
|
15
|
+
- `label`: `string | React.ReactNode`
|
|
16
|
+
- `className`, `labelClassName`
|
|
17
|
+
- **SelectTrigger**: Button that opens the list
|
|
18
|
+
- `size?`: optional override of context size
|
|
19
|
+
- **SelectContent**: Floating list panel (Radix Content props)
|
|
20
|
+
- **SelectGroup**: Group wrapper
|
|
21
|
+
- **SelectItem**: Option row
|
|
22
|
+
- **SelectLabel**: Group label
|
|
23
|
+
- **SelectSeparator**: Separator line
|
|
24
|
+
- **SelectValue**: Selected value placeholder/slot
|
|
25
|
+
- **SelectScrollUpButton / SelectScrollDownButton**: Scroll affordances
|
|
26
|
+
|
|
27
|
+
Root also exposes typical controlled props from Radix (`value`, `defaultValue`, `onValueChange`, `disabled`, `required`, `name`).
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## Behavior
|
|
32
|
+
|
|
33
|
+
- **Sizes**: `size` controls trigger height and font size.
|
|
34
|
+
- **Keyboard**: Typeahead, arrow navigation, Enter/Space to select.
|
|
35
|
+
- **Accessibility**: Labels via `Label` + `htmlFor`/`id`.
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## Examples
|
|
40
|
+
|
|
41
|
+
### Interactive
|
|
42
|
+
|
|
43
|
+
```tsx
|
|
44
|
+
import { useState } from "react";
|
|
45
|
+
import { Label } from "laif-ds";
|
|
46
|
+
import {
|
|
47
|
+
Select,
|
|
48
|
+
SelectTrigger,
|
|
49
|
+
SelectValue,
|
|
50
|
+
SelectContent,
|
|
51
|
+
SelectGroup,
|
|
52
|
+
SelectLabel,
|
|
53
|
+
SelectItem,
|
|
54
|
+
SelectSeparator,
|
|
55
|
+
} from "laif-ds";
|
|
56
|
+
|
|
57
|
+
export function InteractiveSelect() {
|
|
58
|
+
const [value, setValue] = useState("");
|
|
59
|
+
return (
|
|
60
|
+
<div className="w-full max-w-sm space-y-6">
|
|
61
|
+
<div className="space-y-2">
|
|
62
|
+
<Label htmlFor="framework">Framework</Label>
|
|
63
|
+
<Select value={value} onValueChange={setValue}>
|
|
64
|
+
<SelectTrigger id="framework" className="w-full">
|
|
65
|
+
<SelectValue placeholder="Seleziona un framework" />
|
|
66
|
+
</SelectTrigger>
|
|
67
|
+
<SelectContent>
|
|
68
|
+
<SelectGroup>
|
|
69
|
+
<SelectLabel>Frontend</SelectLabel>
|
|
70
|
+
<SelectItem value="react">React</SelectItem>
|
|
71
|
+
<SelectItem value="vue">Vue</SelectItem>
|
|
72
|
+
<SelectItem value="angular">Angular</SelectItem>
|
|
73
|
+
</SelectGroup>
|
|
74
|
+
<SelectSeparator />
|
|
75
|
+
<SelectGroup>
|
|
76
|
+
<SelectLabel>Backend</SelectLabel>
|
|
77
|
+
<SelectItem value="node">Node.js</SelectItem>
|
|
78
|
+
<SelectItem value="django">Django</SelectItem>
|
|
79
|
+
</SelectGroup>
|
|
80
|
+
</SelectContent>
|
|
81
|
+
</Select>
|
|
82
|
+
</div>
|
|
83
|
+
</div>
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Sizes
|
|
89
|
+
|
|
90
|
+
```tsx
|
|
91
|
+
import {
|
|
92
|
+
Select,
|
|
93
|
+
SelectTrigger,
|
|
94
|
+
SelectValue,
|
|
95
|
+
SelectContent,
|
|
96
|
+
SelectItem,
|
|
97
|
+
} from "laif-ds";
|
|
98
|
+
|
|
99
|
+
export function SelectSizes() {
|
|
100
|
+
return (
|
|
101
|
+
<div className="flex flex-col space-y-4">
|
|
102
|
+
<Select>
|
|
103
|
+
<SelectTrigger size="sm" className="w-[180px]">
|
|
104
|
+
<SelectValue placeholder="Small" />
|
|
105
|
+
</SelectTrigger>
|
|
106
|
+
<SelectContent>
|
|
107
|
+
<SelectItem value="1">Opzione 1</SelectItem>
|
|
108
|
+
<SelectItem value="2">Opzione 2</SelectItem>
|
|
109
|
+
</SelectContent>
|
|
110
|
+
</Select>
|
|
111
|
+
|
|
112
|
+
<Select>
|
|
113
|
+
<SelectTrigger className="w-[180px]">
|
|
114
|
+
<SelectValue placeholder="Default" />
|
|
115
|
+
</SelectTrigger>
|
|
116
|
+
<SelectContent>
|
|
117
|
+
<SelectItem value="1">Opzione 1</SelectItem>
|
|
118
|
+
<SelectItem value="2">Opzione 2</SelectItem>
|
|
119
|
+
</SelectContent>
|
|
120
|
+
</Select>
|
|
121
|
+
</div>
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
## Notes
|
|
129
|
+
|
|
130
|
+
- **Use AppSelect**: Prefer `AppSelect` for production features (search, multiselect, async, etc.).
|
|
131
|
+
- **A11y**: Keep labels synchronized with triggers using `id` and `htmlFor`.
|
|
132
|
+
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Separator
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Visual divider component. Built on Radix Separator.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Props
|
|
10
|
+
|
|
11
|
+
Extends `@radix-ui/react-separator` Root props.
|
|
12
|
+
|
|
13
|
+
- `orientation`: `"horizontal" | "vertical"` (default: `"horizontal"`)
|
|
14
|
+
- `decorative`: `boolean` (default: `true`)
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## Example
|
|
19
|
+
|
|
20
|
+
```tsx
|
|
21
|
+
import { Separator } from "laif-ds";
|
|
22
|
+
|
|
23
|
+
export function Example() {
|
|
24
|
+
return (
|
|
25
|
+
<div className="space-y-4">
|
|
26
|
+
<div>Section A</div>
|
|
27
|
+
<Separator />
|
|
28
|
+
<div>Section B</div>
|
|
29
|
+
</div>
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
```
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# Sheet
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Side sheet/dialog component with overlay, animated content, header/footer and close button. Built on Radix Dialog.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Exports
|
|
10
|
+
|
|
11
|
+
- `Sheet`, `SheetTrigger`, `SheetClose`, `SheetContent`
|
|
12
|
+
- `SheetHeader`, `SheetFooter`, `SheetTitle`, `SheetDescription`
|
|
13
|
+
|
|
14
|
+
`SheetContent` prop `side` supports: `"top" | "right" | "bottom" | "left"` (default: `"right"`).
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## Example
|
|
19
|
+
|
|
20
|
+
```tsx
|
|
21
|
+
import { Sheet, SheetTrigger, SheetContent, SheetHeader, SheetTitle, SheetDescription } from "laif-ds";
|
|
22
|
+
import { Button } from "laif-ds";
|
|
23
|
+
|
|
24
|
+
export function FiltersSheet() {
|
|
25
|
+
return (
|
|
26
|
+
<Sheet>
|
|
27
|
+
<SheetTrigger asChild>
|
|
28
|
+
<Button variant="outline">Open filters</Button>
|
|
29
|
+
</SheetTrigger>
|
|
30
|
+
<SheetContent side="right">
|
|
31
|
+
<SheetHeader>
|
|
32
|
+
<SheetTitle>Filters</SheetTitle>
|
|
33
|
+
<SheetDescription>Select filters and apply</SheetDescription>
|
|
34
|
+
</SheetHeader>
|
|
35
|
+
{/* content */}
|
|
36
|
+
</SheetContent>
|
|
37
|
+
</Sheet>
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
```
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# ShikiHighlighter
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Client-side code highlighter using Shiki tokens. Falls back to plain `<pre><code>` when loading fails or language unsupported.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Props
|
|
10
|
+
|
|
11
|
+
| Prop | Type | Description |
|
|
12
|
+
| --- | --- | --- |
|
|
13
|
+
| `children` | `string` | Code string to highlight |
|
|
14
|
+
| `language` | `string` | Language key supported by Shiki |
|
|
15
|
+
| `className` | `string` | Optional classes for `<pre>` |
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## Example
|
|
20
|
+
|
|
21
|
+
```tsx
|
|
22
|
+
import ShikiHighlighter from "laif-ds/ShikiHighlighter";
|
|
23
|
+
|
|
24
|
+
export function CodeBlock() {
|
|
25
|
+
return (
|
|
26
|
+
<ShikiHighlighter language="ts" className="rounded-md border p-3 text-sm">
|
|
27
|
+
{`const x: number = 42;`}
|
|
28
|
+
</ShikiHighlighter>
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
```
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# Sidebar (Primitives)
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Low-level primitives to build responsive sidebars with desktop/offcanvas modes, collapsible icon mode, floating/inset variants, groups, menus, badges, actions and a keyboard shortcut (⌘/Ctrl + B) to toggle.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Main Components
|
|
10
|
+
|
|
11
|
+
- **SidebarProvider**: Context provider. Props: `defaultOpen?`, `open?`, `onOpenChange?`.
|
|
12
|
+
- **Sidebar**: Shell. Props: `side="left|right"`, `variant="sidebar|floating|inset"`, `collapsible="offcanvas|icon|none"`.
|
|
13
|
+
- **SidebarTrigger**: Button to toggle (uses provider).
|
|
14
|
+
- **SidebarRail**: Thin draggable/toggle rail.
|
|
15
|
+
- **SidebarInset**: Main content wrapper that adapts to inset variant.
|
|
16
|
+
- **SidebarHeader / SidebarFooter**: Top/bottom containers.
|
|
17
|
+
- **SidebarContent**: Scrollable body.
|
|
18
|
+
- **SidebarGroup / SidebarGroupLabel / SidebarGroupAction / SidebarGroupContent**: Labeled groups with optional action.
|
|
19
|
+
- **SidebarMenu / SidebarMenuItem / SidebarMenuButton / SidebarMenuAction / SidebarMenuBadge**: Menu building blocks.
|
|
20
|
+
- **SidebarMenuSub / SidebarMenuSubItem / SidebarMenuSubButton**: Nested menus.
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## Behavior
|
|
25
|
+
|
|
26
|
+
- **Mobile**: Offcanvas via `Sheet` when on mobile; desktop uses fixed panel.
|
|
27
|
+
- **Collapsible**: `icon` mode shows only icons and tooltips; `offcanvas` moves panel off-screen.
|
|
28
|
+
- **Keyboard**: Toggle with ⌘/Ctrl + B.
|
|
29
|
+
- **Tooltips**: Menu buttons show tooltips only when collapsed on desktop.
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## Example
|
|
34
|
+
|
|
35
|
+
```tsx
|
|
36
|
+
import {
|
|
37
|
+
SidebarProvider, Sidebar, SidebarHeader, SidebarContent, SidebarFooter,
|
|
38
|
+
SidebarMenu, SidebarMenuItem, SidebarMenuButton, SidebarMenuBadge,
|
|
39
|
+
SidebarGroup, SidebarGroupLabel, SidebarGroupContent, SidebarTrigger
|
|
40
|
+
} from "laif-ds";
|
|
41
|
+
|
|
42
|
+
export function Shell() {
|
|
43
|
+
return (
|
|
44
|
+
<SidebarProvider>
|
|
45
|
+
<div className="flex h-[100vh] overflow-hidden">
|
|
46
|
+
<Sidebar>
|
|
47
|
+
<SidebarHeader>Header</SidebarHeader>
|
|
48
|
+
<SidebarContent>
|
|
49
|
+
<SidebarMenu>
|
|
50
|
+
<SidebarMenuItem>
|
|
51
|
+
<SidebarMenuButton isActive>
|
|
52
|
+
<span>Dashboard</span>
|
|
53
|
+
</SidebarMenuButton>
|
|
54
|
+
<SidebarMenuBadge>3</SidebarMenuBadge>
|
|
55
|
+
</SidebarMenuItem>
|
|
56
|
+
</SidebarMenu>
|
|
57
|
+
<SidebarGroup>
|
|
58
|
+
<SidebarGroupLabel>Section</SidebarGroupLabel>
|
|
59
|
+
<SidebarGroupContent>
|
|
60
|
+
<SidebarMenu>
|
|
61
|
+
<SidebarMenuItem>
|
|
62
|
+
<SidebarMenuButton>Item</SidebarMenuButton>
|
|
63
|
+
</SidebarMenuItem>
|
|
64
|
+
</SidebarMenu>
|
|
65
|
+
</SidebarGroupContent>
|
|
66
|
+
</SidebarGroup>
|
|
67
|
+
</SidebarContent>
|
|
68
|
+
<SidebarFooter>Footer</SidebarFooter>
|
|
69
|
+
</Sidebar>
|
|
70
|
+
<div className="flex-1 overflow-auto p-4">
|
|
71
|
+
<SidebarTrigger />
|
|
72
|
+
</div>
|
|
73
|
+
</div>
|
|
74
|
+
</SidebarProvider>
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
## Notes
|
|
82
|
+
|
|
83
|
+
- **Icons**: Use `laif-ds` `Icon` component inside buttons.
|
|
84
|
+
- **A11y**: Focus management, ARIA attributes and tooltips included in primitives.
|
|
85
|
+
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Skeleton
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Animated placeholder for loading states.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Props
|
|
10
|
+
|
|
11
|
+
Extends `<div>` props.
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## Example
|
|
16
|
+
|
|
17
|
+
```tsx
|
|
18
|
+
import { Skeleton } from "laif-ds";
|
|
19
|
+
|
|
20
|
+
export function CardSkeleton() {
|
|
21
|
+
return (
|
|
22
|
+
<div className="space-y-2">
|
|
23
|
+
<Skeleton className="h-6 w-1/3" />
|
|
24
|
+
<Skeleton className="h-4 w-2/3" />
|
|
25
|
+
<Skeleton className="h-4 w-1/2" />
|
|
26
|
+
</div>
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
```
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# Slider
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Radix-based slider with DS styling, optional value labels, sticky labels on thumbs, predefined step snapping, and center-offset fill.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Props
|
|
10
|
+
|
|
11
|
+
| Prop | Type | Default | Description |
|
|
12
|
+
| ----------------- | -------------------------------------------------- | ----------- | ----------- |
|
|
13
|
+
| `value` | `number[]` | `undefined` | Controlled value (single `[n]` or range `[a,b]`). |
|
|
14
|
+
| `defaultValue` | `number[]` | `undefined` | Uncontrolled initial value. |
|
|
15
|
+
| `min` | `number` | `0` | Minimum. |
|
|
16
|
+
| `max` | `number` | `100` | Maximum. |
|
|
17
|
+
| `step` | `number` | `1` | Increment. |
|
|
18
|
+
| `size` | `"base" | "medium" | "large"` | `"base"` | Track/thumb sizing. |
|
|
19
|
+
| `formatValue` | `(value: number) => string` | `undefined` | Formatter for labels. |
|
|
20
|
+
| `showValues` | `boolean` | `false` | Show min/current (and max for single-value). |
|
|
21
|
+
| `showStickyLabel` | `boolean` | `false` | Show a `Badge` over the thumb with current value. |
|
|
22
|
+
| `stickyLabelSuffix`| `string` | `""` | Suffix for sticky label. |
|
|
23
|
+
| `fillOffset` | `boolean` | `false` | Fill track from center/`offsetValue` to current value. |
|
|
24
|
+
| `offsetValue` | `number` | `undefined` | Center reference for `fillOffset`. |
|
|
25
|
+
| `steps` | `number[]` | `undefined` | Predefined snapping steps. |
|
|
26
|
+
| `showStepMarkers` | `boolean` | `false` | Visual markers for `steps`. |
|
|
27
|
+
|
|
28
|
+
Inherits other Radix `Slider` props.
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## Examples
|
|
33
|
+
|
|
34
|
+
```tsx
|
|
35
|
+
import * as React from "react";
|
|
36
|
+
import { Slider } from "laif-ds";
|
|
37
|
+
|
|
38
|
+
export function Controlled() {
|
|
39
|
+
const [value, setValue] = React.useState([25]);
|
|
40
|
+
return <Slider value={value} onValueChange={setValue} size="medium" />;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export function WithSteps() {
|
|
44
|
+
const [val, setVal] = React.useState([50]);
|
|
45
|
+
return (
|
|
46
|
+
<Slider value={val} onValueChange={setVal} steps={[0,25,50,75,100]} showStepMarkers />
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## Notes
|
|
54
|
+
|
|
55
|
+
- **Snapping**: When `steps` provided, values snap to nearest step.
|
|
56
|
+
- **Range**: Provide two values like `[min, max]` to enable a range slider.
|
|
57
|
+
- **Theming**: Uses DS tokens for track, range and thumb states.
|
|
58
|
+
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Sonner
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Theme-aware wrapper around `sonner` Toaster that syncs with `next-themes`.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Usage
|
|
10
|
+
|
|
11
|
+
```tsx
|
|
12
|
+
import { Toaster } from "laif-ds/sonner"; // Ensure correct import path in your setup
|
|
13
|
+
|
|
14
|
+
export function App() {
|
|
15
|
+
return <Toaster richColors closeButton />;
|
|
16
|
+
}
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Notes:
|
|
20
|
+
- Sets CSS variables for popover colors to match the design system
|
|
21
|
+
- `theme` derives from `useTheme()` (system, light, dark)
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
# Spinner
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Animated loading spinner component with multiple size and color variants. Provides a rotating circular indicator for loading states.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Props
|
|
10
|
+
|
|
11
|
+
| Prop | Type | Default | Description |
|
|
12
|
+
| ---------- | --------------------------------------------------------- | ----------- | -------------------------------------------- |
|
|
13
|
+
| `size` | `"xxs" \| "xs" \| "sm" \| "md" \| "lg" \| "xl" \| "xxl" \| number` | `"md"` | Size of the spinner (preset or custom px) |
|
|
14
|
+
| `variant` | `"default" \| "destructive" \| "primary" \| "secondary"` | `"default"` | Color variant of the spinner |
|
|
15
|
+
| `className`| `string` | `""` | Additional Tailwind classes |
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## Size Mapping
|
|
20
|
+
|
|
21
|
+
| Size | Pixels |
|
|
22
|
+
| ------- | ------ |
|
|
23
|
+
| `xxs` | 12px |
|
|
24
|
+
| `xs` | 14px |
|
|
25
|
+
| `sm` | 16px |
|
|
26
|
+
| `md` | 20px |
|
|
27
|
+
| `lg` | 24px |
|
|
28
|
+
| `xl` | 28px |
|
|
29
|
+
| `xxl` | 36px |
|
|
30
|
+
|
|
31
|
+
You can also provide a custom number for precise pixel sizing.
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## Variants
|
|
36
|
+
|
|
37
|
+
- **`default`**: Uses foreground color (`text-d-foreground`)
|
|
38
|
+
- **`destructive`**: Uses destructive color (`text-d-destructive`)
|
|
39
|
+
- **`primary`**: Uses primary color (`text-d-primary`)
|
|
40
|
+
- **`secondary`**: Uses secondary color (`text-d-secondary`)
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## Examples
|
|
45
|
+
|
|
46
|
+
### Basic Usage
|
|
47
|
+
|
|
48
|
+
```tsx
|
|
49
|
+
import { Spinner } from "laif-ds";
|
|
50
|
+
|
|
51
|
+
export function BasicSpinner() {
|
|
52
|
+
return <Spinner />;
|
|
53
|
+
}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Size Variants
|
|
57
|
+
|
|
58
|
+
```tsx
|
|
59
|
+
import { Spinner } from "laif-ds";
|
|
60
|
+
|
|
61
|
+
export function SpinnerSizes() {
|
|
62
|
+
return (
|
|
63
|
+
<div className="flex items-center gap-4">
|
|
64
|
+
<Spinner size="xxs" />
|
|
65
|
+
<Spinner size="xs" />
|
|
66
|
+
<Spinner size="sm" />
|
|
67
|
+
<Spinner size="md" />
|
|
68
|
+
<Spinner size="lg" />
|
|
69
|
+
<Spinner size="xl" />
|
|
70
|
+
<Spinner size="xxl" />
|
|
71
|
+
</div>
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Color Variants
|
|
77
|
+
|
|
78
|
+
```tsx
|
|
79
|
+
import { Spinner } from "laif-ds";
|
|
80
|
+
|
|
81
|
+
export function SpinnerColors() {
|
|
82
|
+
return (
|
|
83
|
+
<div className="flex items-center gap-4">
|
|
84
|
+
<Spinner variant="default" />
|
|
85
|
+
<Spinner variant="primary" />
|
|
86
|
+
<Spinner variant="secondary" />
|
|
87
|
+
<Spinner variant="destructive" />
|
|
88
|
+
</div>
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Custom Size
|
|
94
|
+
|
|
95
|
+
```tsx
|
|
96
|
+
import { Spinner } from "laif-ds";
|
|
97
|
+
|
|
98
|
+
export function CustomSizeSpinner() {
|
|
99
|
+
return <Spinner size={48} />;
|
|
100
|
+
}
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### In Button
|
|
104
|
+
|
|
105
|
+
```tsx
|
|
106
|
+
import { Spinner, Button } from "laif-ds";
|
|
107
|
+
|
|
108
|
+
export function ButtonWithSpinner() {
|
|
109
|
+
return (
|
|
110
|
+
<Button disabled>
|
|
111
|
+
<Spinner size="sm" className="mr-2" />
|
|
112
|
+
Loading...
|
|
113
|
+
</Button>
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### Centered Loading
|
|
119
|
+
|
|
120
|
+
```tsx
|
|
121
|
+
import { Spinner } from "laif-ds";
|
|
122
|
+
|
|
123
|
+
export function CenteredSpinner() {
|
|
124
|
+
return (
|
|
125
|
+
<div className="flex h-screen items-center justify-center">
|
|
126
|
+
<Spinner size="xl" variant="primary" />
|
|
127
|
+
</div>
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
## Notes
|
|
135
|
+
|
|
136
|
+
- **Animation**: Uses Tailwind's `animate-spin` utility for smooth rotation
|
|
137
|
+
- **SVG Based**: Rendered as an SVG element for crisp display at any size
|
|
138
|
+
- **Current Color**: Inherits text color from parent if no variant specified
|
|
139
|
+
- **Accessibility**: Consider adding `aria-label` or visually hidden text for screen readers
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# Stepper (Primitives)
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Accessible stepper primitives to build multi-step flows with keyboard navigation, indicators, separators and panels. Supports horizontal and vertical layouts.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Subcomponents & Props
|
|
10
|
+
|
|
11
|
+
- **Stepper**: Root context.
|
|
12
|
+
- `defaultValue?: number` (default `1`)
|
|
13
|
+
- `value?: number`, `onValueChange?: (n:number)=>void`
|
|
14
|
+
- `orientation?: "horizontal" | "vertical"` (default `"horizontal"`)
|
|
15
|
+
- `indicators?: { active?, completed?, inactive?, loading? }`
|
|
16
|
+
- **StepperItem**: Defines a step. Props: `step` (number), `completed?`, `disabled?`, `loading?`, `orientation?`.
|
|
17
|
+
- **StepperTrigger**: Click/keyboard target to activate step. Props: `size?: "sm"|"default"|"lg"`.
|
|
18
|
+
- **StepperIndicator**: Circular indicator; accepts `size`.
|
|
19
|
+
- **StepperTitle / StepperDescription**: Labels; accept `size`.
|
|
20
|
+
- **StepperSeparator**: Visual separator between steps; respects orientation.
|
|
21
|
+
- **StepperNav**: Wraps triggers; accepts `orientation?`.
|
|
22
|
+
- **StepperPanel**: Container for contents.
|
|
23
|
+
- **StepperContent**: Conditional render area for a given `value` (step id). `forceMount?` keeps DOM mounted.
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## Behavior
|
|
28
|
+
|
|
29
|
+
- **Keyboard**: Arrow keys navigate between triggers; Home/End jump to first/last; Enter/Space selects.
|
|
30
|
+
- **Controlled/Uncontrolled**: Use `value/onValueChange` or `defaultValue`.
|
|
31
|
+
- **Indicators**: Provide custom nodes for states via `indicators`.
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## Example
|
|
36
|
+
|
|
37
|
+
```tsx
|
|
38
|
+
import { Stepper, StepperNav, StepperItem, StepperTrigger, StepperIndicator, StepperTitle, StepperSeparator, StepperPanel, StepperContent } from "laif-ds";
|
|
39
|
+
|
|
40
|
+
export function BasicStepper() {
|
|
41
|
+
const [step, setStep] = React.useState(1);
|
|
42
|
+
return (
|
|
43
|
+
<Stepper value={step} onValueChange={setStep}>
|
|
44
|
+
<div className="flex w-full flex-col">
|
|
45
|
+
<StepperNav>
|
|
46
|
+
<StepperItem step={1}><StepperTrigger><StepperIndicator>1</StepperIndicator><StepperTitle>Account</StepperTitle></StepperTrigger><StepperSeparator/></StepperItem>
|
|
47
|
+
<StepperItem step={2}><StepperTrigger><StepperIndicator>2</StepperIndicator><StepperTitle>Profile</StepperTitle></StepperTrigger><StepperSeparator/></StepperItem>
|
|
48
|
+
<StepperItem step={3}><StepperTrigger><StepperIndicator>3</StepperIndicator><StepperTitle>Done</StepperTitle></StepperTrigger></StepperItem>
|
|
49
|
+
</StepperNav>
|
|
50
|
+
<StepperPanel className="mt-6">
|
|
51
|
+
<StepperContent value={1}>Step 1</StepperContent>
|
|
52
|
+
<StepperContent value={2}>Step 2</StepperContent>
|
|
53
|
+
<StepperContent value={3}>Step 3</StepperContent>
|
|
54
|
+
</StepperPanel>
|
|
55
|
+
</div>
|
|
56
|
+
</Stepper>
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## Notes
|
|
64
|
+
|
|
65
|
+
- **Focus**: Triggers manage focus order for accessible navigation.
|
|
66
|
+
- **Layouts**: Use `orientation="vertical"` to show left rail of steps with content on the right.
|
|
67
|
+
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Switch
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Accessible on/off toggle built on Radix Switch with DS tokens and smooth thumb slide.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Props
|
|
10
|
+
|
|
11
|
+
Inherits Radix Switch props:
|
|
12
|
+
|
|
13
|
+
- `checked?`, `defaultChecked?`
|
|
14
|
+
- `onCheckedChange?(checked: boolean)`
|
|
15
|
+
- `disabled?`, `required?`, `name?`, `value?`
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## Example
|
|
20
|
+
|
|
21
|
+
```tsx
|
|
22
|
+
import * as React from "react";
|
|
23
|
+
import { Switch } from "laif-ds";
|
|
24
|
+
|
|
25
|
+
export function ControlledSwitch() {
|
|
26
|
+
const [checked, setChecked] = React.useState(false);
|
|
27
|
+
return (
|
|
28
|
+
<div className="flex items-center gap-2">
|
|
29
|
+
<Switch id="wifi" checked={checked} onCheckedChange={setChecked} />
|
|
30
|
+
<label htmlFor="wifi">Wi‑Fi {checked ? "on" : "off"}</label>
|
|
31
|
+
</div>
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## Notes
|
|
39
|
+
|
|
40
|
+
- Track uses `bg-d-primary` when checked and `bg-d-foreground/20` when unchecked.
|
|
41
|
+
- Thumb translation is optimized for a 32px track with 16px thumb.
|
|
42
|
+
|