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,146 @@
|
|
|
1
|
+
# MultipleSelector (Deprecated)
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Tag-style multi-select built on `cmdk` and `Popover` with search, grouping, creatable options, and badges for selections.
|
|
6
|
+
|
|
7
|
+
- ⚠️ This component is deprecated. Prefer `AppSelect` for new code.
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Types
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
// Deprecated interface. Prefer AppSelect options.
|
|
15
|
+
export interface Option {
|
|
16
|
+
value: string;
|
|
17
|
+
label: string;
|
|
18
|
+
disable?: boolean;
|
|
19
|
+
fixed?: boolean; // fixed option that can't be removed
|
|
20
|
+
[key: string]: string | boolean | undefined; // for grouping keys
|
|
21
|
+
}
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## Props (highlights)
|
|
27
|
+
|
|
28
|
+
| Prop | Type | Default | Description |
|
|
29
|
+
| ----------------------------- | -------------------------------------- | ------------------------------- | ----------- |
|
|
30
|
+
| `value` | `Option[]` | `[]` | Controlled selected options. |
|
|
31
|
+
| `defaultOptions` | `Option[]` | `[]` | Initial options to display. |
|
|
32
|
+
| `options` | `Option[]` | `undefined` | Manually controlled options (when not using search). |
|
|
33
|
+
| `placeholder` | `string` | `"Cerca..."` | Input placeholder. |
|
|
34
|
+
| `onSearch` | `(q: string) => Promise<Option[]>` | `undefined` | Async search. Debounced by `delay`. |
|
|
35
|
+
| `onSearchSync` | `(q: string) => Option[]` | `undefined` | Sync search alternative. |
|
|
36
|
+
| `delay` | `number` | `500` | Debounce ms for `onSearch`. |
|
|
37
|
+
| `triggerSearchOnFocus` | `boolean` | `false` | Trigger search when input focuses. |
|
|
38
|
+
| `onChange` | `(opts: Option[]) => void` | `undefined` | Fired on selection change. |
|
|
39
|
+
| `maxSelected` | `number` | `Number.MAX_SAFE_INTEGER` | Selection limit. |
|
|
40
|
+
| `onMaxSelected` | `(limit: number) => void` | `undefined` | Called when limit reached. |
|
|
41
|
+
| `groupBy` | `string` | `undefined` | Group options by key. |
|
|
42
|
+
| `disabled` | `boolean` | `false` | Disable interactions. |
|
|
43
|
+
| `hidePlaceholderWhenSelected` | `boolean` | `true` | Hide placeholder when badges exist. |
|
|
44
|
+
| `selectFirstItem` | `boolean` | `true` | Cmdk behavior workaround. |
|
|
45
|
+
| `creatable` | `boolean` | `false` | Allow creating new option if not found. |
|
|
46
|
+
| `hideClearAllButton` | `boolean` | `false` | Hide the clear-all icon. |
|
|
47
|
+
| `className` | `string` | `""` | Trigger wrapper classes. |
|
|
48
|
+
| `badgeClassName` | `string` | `""` | Badge classes. |
|
|
49
|
+
| `label` | `string | React.ReactNode` | `undefined` | Optional label above control. |
|
|
50
|
+
|
|
51
|
+
Also exposes `commandProps` and `inputProps` to pass through to internal `Command` and search input.
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## Behavior
|
|
56
|
+
|
|
57
|
+
- **Search**: Use `onSearch` (async) or `onSearchSync` (sync). Debounced input.
|
|
58
|
+
- **Grouping**: Provide `groupBy` key to group options.
|
|
59
|
+
- **Creatable**: When enabled, offers "Create \"query\"" item when not found.
|
|
60
|
+
- **Badges**: Selected options render as removable badges. `fixed` badges cannot be removed.
|
|
61
|
+
- **Limits**: Enforces `maxSelected`; calls `onMaxSelected` when exceeded.
|
|
62
|
+
- **Clear all**: Built-in clear-all icon (hidden with `hideClearAllButton`).
|
|
63
|
+
- **Disabled**: Disables input and badge removal.
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## Examples
|
|
68
|
+
|
|
69
|
+
### Default
|
|
70
|
+
|
|
71
|
+
```tsx
|
|
72
|
+
import { MultipleSelector } from "laif-ds";
|
|
73
|
+
|
|
74
|
+
export function DefaultMulti() {
|
|
75
|
+
return (
|
|
76
|
+
<div className="w-[400px]">
|
|
77
|
+
<MultipleSelector
|
|
78
|
+
placeholder="Seleziona dei tag..."
|
|
79
|
+
defaultOptions={[
|
|
80
|
+
{ value: "react", label: "React" },
|
|
81
|
+
{ value: "typescript", label: "TypeScript" },
|
|
82
|
+
]}
|
|
83
|
+
/>
|
|
84
|
+
</div>
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Grouped Options
|
|
90
|
+
|
|
91
|
+
```tsx
|
|
92
|
+
import { MultipleSelector } from "laif-ds";
|
|
93
|
+
|
|
94
|
+
const frameworks = [
|
|
95
|
+
{ value: "react", label: "React", category: "Frontend" },
|
|
96
|
+
{ value: "node", label: "Node.js", category: "Backend" },
|
|
97
|
+
];
|
|
98
|
+
|
|
99
|
+
export function Grouped() {
|
|
100
|
+
return (
|
|
101
|
+
<div className="w-[400px]">
|
|
102
|
+
<MultipleSelector
|
|
103
|
+
placeholder="Seleziona dei framework..."
|
|
104
|
+
defaultOptions={frameworks}
|
|
105
|
+
groupBy="category"
|
|
106
|
+
/>
|
|
107
|
+
</div>
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### Async Search
|
|
113
|
+
|
|
114
|
+
```tsx
|
|
115
|
+
import { MultipleSelector } from "laif-ds";
|
|
116
|
+
|
|
117
|
+
async function mockSearch(query: string) {
|
|
118
|
+
await new Promise((r) => setTimeout(r, 300));
|
|
119
|
+
const tags = [
|
|
120
|
+
{ value: "react", label: "React" },
|
|
121
|
+
{ value: "typescript", label: "TypeScript" },
|
|
122
|
+
];
|
|
123
|
+
return tags.filter((t) => t.label.toLowerCase().includes(query.toLowerCase()));
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export function AsyncSearch() {
|
|
127
|
+
return (
|
|
128
|
+
<div className="w-[400px]">
|
|
129
|
+
<MultipleSelector
|
|
130
|
+
placeholder="Cerca dei tag..."
|
|
131
|
+
onSearch={mockSearch}
|
|
132
|
+
delay={300}
|
|
133
|
+
triggerSearchOnFocus
|
|
134
|
+
/>
|
|
135
|
+
</div>
|
|
136
|
+
);
|
|
137
|
+
}
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
---
|
|
141
|
+
|
|
142
|
+
## Notes
|
|
143
|
+
|
|
144
|
+
- **Use AppSelect**: Prefer `AppSelect` for multiselect scenarios.
|
|
145
|
+
- **A11y**: The trigger is keyboard-accessible; ensure label association when using `label`.
|
|
146
|
+
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# NavigationMenu
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Accessible navigation menu with optional animated viewport. Built on Radix Navigation Menu.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Exports
|
|
10
|
+
|
|
11
|
+
- `NavigationMenu` (prop: `viewport?: boolean = true`)
|
|
12
|
+
- `NavigationMenuList`
|
|
13
|
+
- `NavigationMenuItem`
|
|
14
|
+
- `NavigationMenuTrigger`
|
|
15
|
+
- `NavigationMenuContent`
|
|
16
|
+
- `NavigationMenuLink`
|
|
17
|
+
- `NavigationMenuIndicator`
|
|
18
|
+
- `NavigationMenuViewport`
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## Example
|
|
23
|
+
|
|
24
|
+
```tsx
|
|
25
|
+
import {
|
|
26
|
+
NavigationMenu,
|
|
27
|
+
NavigationMenuList,
|
|
28
|
+
NavigationMenuItem,
|
|
29
|
+
NavigationMenuTrigger,
|
|
30
|
+
NavigationMenuContent,
|
|
31
|
+
NavigationMenuLink,
|
|
32
|
+
} from "laif-ds";
|
|
33
|
+
|
|
34
|
+
export function MainNav() {
|
|
35
|
+
return (
|
|
36
|
+
<NavigationMenu>
|
|
37
|
+
<NavigationMenuList>
|
|
38
|
+
<NavigationMenuItem>
|
|
39
|
+
<NavigationMenuTrigger>Products</NavigationMenuTrigger>
|
|
40
|
+
<NavigationMenuContent>
|
|
41
|
+
<div className="grid w-[300px] gap-2 p-2">
|
|
42
|
+
<NavigationMenuLink href="/products/a">Product A</NavigationMenuLink>
|
|
43
|
+
<NavigationMenuLink href="/products/b">Product B</NavigationMenuLink>
|
|
44
|
+
</div>
|
|
45
|
+
</NavigationMenuContent>
|
|
46
|
+
</NavigationMenuItem>
|
|
47
|
+
</NavigationMenuList>
|
|
48
|
+
</NavigationMenu>
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
```
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# Pagination
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Composable pagination controls with first/previous/next/last buttons and page links.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Exports
|
|
10
|
+
|
|
11
|
+
- `Pagination`, `PaginationContent`, `PaginationItem`
|
|
12
|
+
- `PaginationLink` (props: `isActive?`, `isDisabled?`, `label?`, `size?`)
|
|
13
|
+
- `PaginationFirst`, `PaginationPrevious`, `PaginationNext`, `PaginationLast`
|
|
14
|
+
- `PaginationEllipsis`
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## Example
|
|
19
|
+
|
|
20
|
+
```tsx
|
|
21
|
+
import {
|
|
22
|
+
Pagination,
|
|
23
|
+
PaginationContent,
|
|
24
|
+
PaginationItem,
|
|
25
|
+
PaginationLink,
|
|
26
|
+
PaginationPrevious,
|
|
27
|
+
PaginationNext,
|
|
28
|
+
PaginationEllipsis,
|
|
29
|
+
} from "laif-ds";
|
|
30
|
+
|
|
31
|
+
export function Pager() {
|
|
32
|
+
return (
|
|
33
|
+
<Pagination>
|
|
34
|
+
<PaginationContent>
|
|
35
|
+
<PaginationItem>
|
|
36
|
+
<PaginationPrevious href="#" />
|
|
37
|
+
</PaginationItem>
|
|
38
|
+
{[1, 2, 3].map((p) => (
|
|
39
|
+
<PaginationItem key={p}>
|
|
40
|
+
<PaginationLink href="#" isActive={p === 2}>
|
|
41
|
+
{p}
|
|
42
|
+
</PaginationLink>
|
|
43
|
+
</PaginationItem>
|
|
44
|
+
))}
|
|
45
|
+
<PaginationItem>
|
|
46
|
+
<PaginationEllipsis />
|
|
47
|
+
</PaginationItem>
|
|
48
|
+
<PaginationItem>
|
|
49
|
+
<PaginationNext href="#" />
|
|
50
|
+
</PaginationItem>
|
|
51
|
+
</PaginationContent>
|
|
52
|
+
</Pagination>
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
```
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
# Popover
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Small floating content panel anchored to a trigger. Useful for lightweight forms, hints, and quick actions.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Subcomponents & Props
|
|
10
|
+
|
|
11
|
+
- **Popover**: Root container. Extends Radix Popover Root props.
|
|
12
|
+
- **PopoverTrigger**: The element that opens the popover (often `asChild`).
|
|
13
|
+
- **PopoverContent**: Floating panel.
|
|
14
|
+
- `align`: `start | center | end` (default `center`)
|
|
15
|
+
- `side`: `top | right | bottom | left` (Radix prop)
|
|
16
|
+
- `sideOffset`: `number` (default `4`)
|
|
17
|
+
- `container`: `HTMLElement | null` (portal target)
|
|
18
|
+
- **PopoverAnchor**: Optional explicit anchor element.
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## Behavior
|
|
23
|
+
|
|
24
|
+
- **Positioning**: Uses Radix positioning with transform-origin aware animations.
|
|
25
|
+
- **Focus management**: Traps focus while open, returns focus on close.
|
|
26
|
+
- **Accessibility**: Proper aria attributes via Radix; close on outside click/Escape.
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## Examples
|
|
31
|
+
|
|
32
|
+
### Basic
|
|
33
|
+
|
|
34
|
+
```tsx
|
|
35
|
+
import { Button, Input, Label } from "laif-ds";
|
|
36
|
+
import { Popover, PopoverTrigger, PopoverContent } from "laif-ds";
|
|
37
|
+
|
|
38
|
+
export function BasicPopover() {
|
|
39
|
+
return (
|
|
40
|
+
<Popover>
|
|
41
|
+
<PopoverTrigger asChild>
|
|
42
|
+
<Button variant="outline">Open Popover</Button>
|
|
43
|
+
</PopoverTrigger>
|
|
44
|
+
<PopoverContent className="w-80">
|
|
45
|
+
<div className="grid gap-4">
|
|
46
|
+
<div className="space-y-2">
|
|
47
|
+
<h4 className="font-medium leading-none">Dimensions</h4>
|
|
48
|
+
<p className="text-d-muted-foreground text-sm">Set layer dimensions.</p>
|
|
49
|
+
</div>
|
|
50
|
+
<div className="grid gap-2">
|
|
51
|
+
<div className="grid grid-cols-3 items-center gap-4">
|
|
52
|
+
<Label htmlFor="width">Width</Label>
|
|
53
|
+
<Input id="width" defaultValue="100%" className="col-span-2 h-8" />
|
|
54
|
+
</div>
|
|
55
|
+
<div className="grid grid-cols-3 items-center gap-4">
|
|
56
|
+
<Label htmlFor="maxWidth">Max. width</Label>
|
|
57
|
+
<Input id="maxWidth" defaultValue="300px" className="col-span-2 h-8" />
|
|
58
|
+
</div>
|
|
59
|
+
</div>
|
|
60
|
+
</div>
|
|
61
|
+
</PopoverContent>
|
|
62
|
+
</Popover>
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Positioned
|
|
68
|
+
|
|
69
|
+
```tsx
|
|
70
|
+
import { Button } from "laif-ds";
|
|
71
|
+
import { Popover, PopoverTrigger, PopoverContent } from "laif-ds";
|
|
72
|
+
|
|
73
|
+
export function PositionedPopovers() {
|
|
74
|
+
return (
|
|
75
|
+
<div className="flex space-x-4">
|
|
76
|
+
<Popover>
|
|
77
|
+
<PopoverTrigger asChild>
|
|
78
|
+
<Button variant="outline">Top</Button>
|
|
79
|
+
</PopoverTrigger>
|
|
80
|
+
<PopoverContent side="top" className="w-40">
|
|
81
|
+
<p className="text-sm">Appears on top.</p>
|
|
82
|
+
</PopoverContent>
|
|
83
|
+
</Popover>
|
|
84
|
+
<Popover>
|
|
85
|
+
<PopoverTrigger asChild>
|
|
86
|
+
<Button variant="outline">Right</Button>
|
|
87
|
+
</PopoverTrigger>
|
|
88
|
+
<PopoverContent side="right" className="w-40">
|
|
89
|
+
<p className="text-sm">Appears on the right.</p>
|
|
90
|
+
</PopoverContent>
|
|
91
|
+
</Popover>
|
|
92
|
+
</div>
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
## Notes
|
|
100
|
+
|
|
101
|
+
- **Portal container**: Use `container` on `PopoverContent` to mount into a specific element.
|
|
102
|
+
- **Sizing**: Set width/height via utility classes; content scrolls when needed.
|
|
103
|
+
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Progress
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Linear progress bar built on Radix Progress. Controlled via a `value` number. Styles are theme-aware.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Props
|
|
10
|
+
|
|
11
|
+
Extends `@radix-ui/react-progress` Root props.
|
|
12
|
+
|
|
13
|
+
- `value?: number` — 0 to 100. Determines the filled portion.
|
|
14
|
+
- `className?: string`
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## Examples
|
|
19
|
+
|
|
20
|
+
```tsx
|
|
21
|
+
import { Progress } from "laif-ds";
|
|
22
|
+
|
|
23
|
+
export function UploadProgress({ percent }: { percent: number }) {
|
|
24
|
+
return <Progress value={percent} className="w-full" />;
|
|
25
|
+
}
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### Indeterminate style hint
|
|
29
|
+
|
|
30
|
+
When `value` is `undefined`, the bar renders empty by default. Provide your own animation class for indeterminate states if needed.
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# PromptSuggestions
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Clickable suggestion chips that append a user message via provided callback.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Props
|
|
10
|
+
|
|
11
|
+
| Prop | Type | Description |
|
|
12
|
+
| --- | --- | --- |
|
|
13
|
+
| `label` | `string` | Header text |
|
|
14
|
+
| `append` | `(message: { role: "user"; content: string }) => void` | Callback invoked when a suggestion is clicked |
|
|
15
|
+
| `suggestions` | `string[]` | List of suggestion texts |
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## Example
|
|
20
|
+
|
|
21
|
+
```tsx
|
|
22
|
+
import { PromptSuggestions } from "laif-ds";
|
|
23
|
+
|
|
24
|
+
export function SuggestionsDemo() {
|
|
25
|
+
return (
|
|
26
|
+
<PromptSuggestions
|
|
27
|
+
label="Try one of these"
|
|
28
|
+
suggestions={["What is React?", "Explain TypeScript", "Show me a chart"]}
|
|
29
|
+
append={(msg) => console.log("append", msg)}
|
|
30
|
+
/>
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
```
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# RadioGroup
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Set of mutually exclusive options with accessible keyboard navigation. Includes an item component styled for DS tokens.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Subcomponents & Props
|
|
10
|
+
|
|
11
|
+
- **RadioGroup**: Root container (Radix RadioGroup Root props)
|
|
12
|
+
- `value`, `defaultValue`: controlled/uncontrolled
|
|
13
|
+
- `onValueChange(value: string)`: change handler
|
|
14
|
+
- `orientation`: `"horizontal" | "vertical"` (default `"vertical"`)
|
|
15
|
+
- `disabled`: `boolean`
|
|
16
|
+
- `required`: `boolean`
|
|
17
|
+
- `name`: `string`
|
|
18
|
+
- **RadioGroupItem**: Individual radio control (Radix Item props)
|
|
19
|
+
- `value`: `string`
|
|
20
|
+
- `disabled`: `boolean`
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## Behavior
|
|
25
|
+
|
|
26
|
+
- **Keyboard**: Arrow keys move focus; Space/Enter selects.
|
|
27
|
+
- **Validation styles**: `aria-invalid` triggers error ring/border.
|
|
28
|
+
- **Accessibility**: Pair with `Label` using `htmlFor` and `id`.
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## Examples
|
|
33
|
+
|
|
34
|
+
### Default
|
|
35
|
+
|
|
36
|
+
```tsx
|
|
37
|
+
import { useState } from "react";
|
|
38
|
+
import { Label, RadioGroup, RadioGroupItem } from "laif-ds";
|
|
39
|
+
|
|
40
|
+
export function PlanSelector() {
|
|
41
|
+
const [plan, setPlan] = useState("startup");
|
|
42
|
+
return (
|
|
43
|
+
<RadioGroup value={plan} onValueChange={setPlan} className="space-y-4">
|
|
44
|
+
<div className="flex items-start space-x-3">
|
|
45
|
+
<RadioGroupItem value="startup" id="startup" className="mt-1" />
|
|
46
|
+
<div className="grid gap-1">
|
|
47
|
+
<Label htmlFor="startup" className="font-medium">Startup</Label>
|
|
48
|
+
<p className="text-d-muted-foreground text-sm">Fino a 10 utenti</p>
|
|
49
|
+
</div>
|
|
50
|
+
</div>
|
|
51
|
+
<div className="flex items-start space-x-3">
|
|
52
|
+
<RadioGroupItem value="business" id="business" className="mt-1" />
|
|
53
|
+
<div className="grid gap-1">
|
|
54
|
+
<Label htmlFor="business" className="font-medium">Business</Label>
|
|
55
|
+
<p className="text-d-muted-foreground text-sm">Fino a 100 utenti</p>
|
|
56
|
+
</div>
|
|
57
|
+
</div>
|
|
58
|
+
</RadioGroup>
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Disabled
|
|
64
|
+
|
|
65
|
+
```tsx
|
|
66
|
+
import { Label, RadioGroup, RadioGroupItem } from "laif-ds";
|
|
67
|
+
|
|
68
|
+
export function DisabledRadios() {
|
|
69
|
+
return (
|
|
70
|
+
<RadioGroup defaultValue="option1" disabled className="space-y-2">
|
|
71
|
+
<div className="flex items-center space-x-2">
|
|
72
|
+
<RadioGroupItem value="option1" id="disabled1" />
|
|
73
|
+
<Label htmlFor="disabled1" className="text-d-muted-foreground">Opzione 1</Label>
|
|
74
|
+
</div>
|
|
75
|
+
<div className="flex items-center space-x-2">
|
|
76
|
+
<RadioGroupItem value="option2" id="disabled2" />
|
|
77
|
+
<Label htmlFor="disabled2" className="text-d-muted-foreground">Opzione 2</Label>
|
|
78
|
+
</div>
|
|
79
|
+
</RadioGroup>
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
## Notes
|
|
87
|
+
|
|
88
|
+
- **Deprecated?** In some projects a higher-level `AppRadioGroup` may be preferred. Check your project conventions.
|
|
89
|
+
- **A11y**: Always link `Label` to `RadioGroupItem` via `htmlFor`/`id`.
|
|
90
|
+
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Resizable
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Resizable panel group with handles. Built on `react-resizable-panels`.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Exports
|
|
10
|
+
|
|
11
|
+
- `ResizablePanelGroup` — container (horizontal by default; vertical when `direction="vertical"`)
|
|
12
|
+
- `ResizablePanel` — content panel
|
|
13
|
+
- `ResizableHandle` — draggable separator (prop: `withHandle?: boolean`)
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Example
|
|
18
|
+
|
|
19
|
+
```tsx
|
|
20
|
+
import { ResizablePanelGroup, ResizablePanel, ResizableHandle } from "laif-ds";
|
|
21
|
+
|
|
22
|
+
export function SplitLayout() {
|
|
23
|
+
return (
|
|
24
|
+
<ResizablePanelGroup direction="horizontal" className="h-64 rounded-md border">
|
|
25
|
+
<ResizablePanel defaultSize={50}>
|
|
26
|
+
<div className="p-4">Left</div>
|
|
27
|
+
</ResizablePanel>
|
|
28
|
+
<ResizableHandle withHandle />
|
|
29
|
+
<ResizablePanel defaultSize={50}>
|
|
30
|
+
<div className="p-4">Right</div>
|
|
31
|
+
</ResizablePanel>
|
|
32
|
+
</ResizablePanelGroup>
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
```
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# ResizePrompt
|
|
2
|
+
|
|
3
|
+
## Status
|
|
4
|
+
|
|
5
|
+
This component is deprecated and no longer available in the UI library.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Notes
|
|
10
|
+
|
|
11
|
+
- If you need resizable layouts or panels, refer to current layout primitives or container-level CSS techniques used in the design system.
|
|
12
|
+
- For responsive behavior, prefer flexbox utilities and app-specific layout components.
|
|
13
|
+
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# ScrollArea
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Custom scrollable area with styled scrollbars. Built on Radix Scroll Area.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Exports
|
|
10
|
+
|
|
11
|
+
- `ScrollArea`
|
|
12
|
+
- `ScrollBar` (prop: `orientation = "vertical"`)
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## Examples
|
|
17
|
+
|
|
18
|
+
```tsx
|
|
19
|
+
import { ScrollArea } from "laif-ds";
|
|
20
|
+
|
|
21
|
+
export function VerticalScroll() {
|
|
22
|
+
return (
|
|
23
|
+
<ScrollArea className="h-40 w-64 rounded-md border p-2">
|
|
24
|
+
<div className="space-y-2">
|
|
25
|
+
{Array.from({ length: 20 }).map((_, i) => (
|
|
26
|
+
<div key={i} className="rounded bg-muted p-2">Row {i + 1}</div>
|
|
27
|
+
))}
|
|
28
|
+
</div>
|
|
29
|
+
</ScrollArea>
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
```tsx
|
|
35
|
+
import { ScrollArea, ScrollBar } from "laif-ds";
|
|
36
|
+
|
|
37
|
+
export function HorizontalScroll() {
|
|
38
|
+
return (
|
|
39
|
+
<ScrollArea className="w-64 rounded-md border p-2">
|
|
40
|
+
<div className="flex w-[600px] gap-2">
|
|
41
|
+
{Array.from({ length: 10 }).map((_, i) => (
|
|
42
|
+
<div key={i} className="w-48 shrink-0 rounded bg-muted p-2">Card {i + 1}</div>
|
|
43
|
+
))}
|
|
44
|
+
</div>
|
|
45
|
+
<ScrollBar orientation="horizontal" />
|
|
46
|
+
</ScrollArea>
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
```
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# SecurePdfViewer
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
PDF viewer with secure defaults and dynamic worker setup. Uses `react-pdf` with automatic worker URL and responsive sizing.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Props
|
|
10
|
+
|
|
11
|
+
| Prop | Type | Default | Description |
|
|
12
|
+
| --- | --- | --- | --- |
|
|
13
|
+
| `url` | `string` | — | PDF URL to load |
|
|
14
|
+
| `initialPage` | `number` | `1` | Starting page number |
|
|
15
|
+
| `className` | `string` | `""` | Additional wrapper classes |
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## Behavior
|
|
20
|
+
|
|
21
|
+
- Dynamically imports `react-pdf` and sets `pdfjs` worker src
|
|
22
|
+
- Measures container width to render pages responsively
|
|
23
|
+
- Provides basic pagination controls (prev/next)
|
|
24
|
+
- Shows loading and error placeholders
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## Example
|
|
29
|
+
|
|
30
|
+
```tsx
|
|
31
|
+
import { SecurePdfViewer } from "laif-ds";
|
|
32
|
+
|
|
33
|
+
export function InvoiceViewer() {
|
|
34
|
+
return (
|
|
35
|
+
<SecurePdfViewer url="/docs/invoice.pdf" initialPage={1} className="h-[700px]" />
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
```
|