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,63 @@
|
|
|
1
|
+
# Table
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Styled table primitives for building data tables. Provides header, body, footer, rows, cells, and caption.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Exports
|
|
10
|
+
|
|
11
|
+
- `Table`
|
|
12
|
+
- `TableHeader`
|
|
13
|
+
- `TableBody`
|
|
14
|
+
- `TableFooter`
|
|
15
|
+
- `TableRow`
|
|
16
|
+
- `TableHead`
|
|
17
|
+
- `TableCell`
|
|
18
|
+
- `TableCaption`
|
|
19
|
+
|
|
20
|
+
All extend their corresponding HTML element props.
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## Examples
|
|
25
|
+
|
|
26
|
+
```tsx
|
|
27
|
+
import {
|
|
28
|
+
Table,
|
|
29
|
+
TableHeader,
|
|
30
|
+
TableBody,
|
|
31
|
+
TableRow,
|
|
32
|
+
TableHead,
|
|
33
|
+
TableCell,
|
|
34
|
+
TableCaption,
|
|
35
|
+
} from "laif-ds";
|
|
36
|
+
|
|
37
|
+
export function BasicTable() {
|
|
38
|
+
return (
|
|
39
|
+
<Table>
|
|
40
|
+
<TableCaption>Recent invoices</TableCaption>
|
|
41
|
+
<TableHeader>
|
|
42
|
+
<TableRow>
|
|
43
|
+
<TableHead>Customer</TableHead>
|
|
44
|
+
<TableHead>Status</TableHead>
|
|
45
|
+
<TableHead>Amount</TableHead>
|
|
46
|
+
</TableRow>
|
|
47
|
+
</TableHeader>
|
|
48
|
+
<TableBody>
|
|
49
|
+
<TableRow>
|
|
50
|
+
<TableCell>Acme Inc.</TableCell>
|
|
51
|
+
<TableCell>Paid</TableCell>
|
|
52
|
+
<TableCell>€1,200.00</TableCell>
|
|
53
|
+
</TableRow>
|
|
54
|
+
<TableRow>
|
|
55
|
+
<TableCell>Globex</TableCell>
|
|
56
|
+
<TableCell>Open</TableCell>
|
|
57
|
+
<TableCell>€680.00</TableCell>
|
|
58
|
+
</TableRow>
|
|
59
|
+
</TableBody>
|
|
60
|
+
</Table>
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
```
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# TableSkeleton
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Skeleton placeholder for tables. Renders a header row and a configurable number of body rows with skeleton cells. Supports an optional top-left corner cell with two labels.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Props
|
|
10
|
+
|
|
11
|
+
| Prop | Type | Default | Description |
|
|
12
|
+
| --- | --- | --- | --- |
|
|
13
|
+
| `headerRow` | `string[]` | `[]` | Column headers. If empty, headers are skeletons |
|
|
14
|
+
| `rowCount` | `number` | `5` | Number of skeleton rows |
|
|
15
|
+
| `columnCount` | `number` | `5` | Used when `headerRow` is empty to define columns |
|
|
16
|
+
| `className` | `string` | `undefined` | Additional wrapper classes |
|
|
17
|
+
| `cornerHeaderFrom` | `string` | `undefined` | Top-left corner label (top-left) |
|
|
18
|
+
| `cornerHeaderTo` | `string` | `undefined` | Top-left corner label (bottom-right) |
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## Example
|
|
23
|
+
|
|
24
|
+
```tsx
|
|
25
|
+
import { TableSkeleton } from "laif-ds";
|
|
26
|
+
|
|
27
|
+
export function LoadingTable() {
|
|
28
|
+
return (
|
|
29
|
+
<TableSkeleton
|
|
30
|
+
headerRow={["Name", "Email", "Role", "Status", "Actions"]}
|
|
31
|
+
rowCount={8}
|
|
32
|
+
className="mt-4"
|
|
33
|
+
/>
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### With Corner Headers
|
|
39
|
+
|
|
40
|
+
```tsx
|
|
41
|
+
<TableSkeleton
|
|
42
|
+
headerRow={["Mon", "Tue", "Wed", "Thu", "Fri"]}
|
|
43
|
+
cornerHeaderFrom="From"
|
|
44
|
+
cornerHeaderTo="To"
|
|
45
|
+
/>
|
|
46
|
+
```
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# Tabs
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Radix Tabs with design-system styling. Provides a list of triggers and matching content panels, supporting horizontal and vertical orientations, disabled tabs, and manual/automatic activation.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Components & Props
|
|
10
|
+
|
|
11
|
+
- **Tabs** (`Root`)
|
|
12
|
+
- `defaultValue?: string`
|
|
13
|
+
- `value?: string`
|
|
14
|
+
- `onValueChange?: (value: string) => void`
|
|
15
|
+
- `orientation?: "horizontal" | "vertical"` (default `"horizontal"`)
|
|
16
|
+
- `dir?: "ltr" | "rtl"` (default `"ltr"`)
|
|
17
|
+
- `activationMode?: "automatic" | "manual"` (default `"automatic"`)
|
|
18
|
+
- `className?: string`
|
|
19
|
+
- **TabsList**: Visual container for triggers.
|
|
20
|
+
- **TabsTrigger**
|
|
21
|
+
- `value: string`
|
|
22
|
+
- `disabled?: boolean`
|
|
23
|
+
- `className?: string`
|
|
24
|
+
- **TabsContent**
|
|
25
|
+
- `value: string`
|
|
26
|
+
- `className?: string`
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## Behavior
|
|
31
|
+
|
|
32
|
+
- **Activation**: `automatic` switches on focus; `manual` switches on click/Enter.
|
|
33
|
+
- **Orientation**: Vertical layout supported via `orientation="vertical"`.
|
|
34
|
+
- **Disabled**: `TabsTrigger` can be disabled and will not activate.
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## Examples
|
|
39
|
+
|
|
40
|
+
### Default
|
|
41
|
+
|
|
42
|
+
```tsx
|
|
43
|
+
import { Tabs, TabsList, TabsTrigger, TabsContent } from "laif-ds";
|
|
44
|
+
|
|
45
|
+
export function BasicTabs() {
|
|
46
|
+
return (
|
|
47
|
+
<Tabs defaultValue="account" className="w-[400px]">
|
|
48
|
+
<TabsList className="grid w-full grid-cols-2">
|
|
49
|
+
<TabsTrigger value="account">Account</TabsTrigger>
|
|
50
|
+
<TabsTrigger value="password">Password</TabsTrigger>
|
|
51
|
+
</TabsList>
|
|
52
|
+
<TabsContent value="account">Contenuto Account</TabsContent>
|
|
53
|
+
<TabsContent value="password">Contenuto Password</TabsContent>
|
|
54
|
+
</Tabs>
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Vertical
|
|
60
|
+
|
|
61
|
+
```tsx
|
|
62
|
+
export function VerticalTabs() {
|
|
63
|
+
return (
|
|
64
|
+
<Tabs defaultValue="tab1" orientation="vertical" className="flex w-[600px]">
|
|
65
|
+
<TabsList className="flex h-auto w-[200px] flex-col">
|
|
66
|
+
<TabsTrigger value="tab1" className="justify-start">Profilo</TabsTrigger>
|
|
67
|
+
<TabsTrigger value="tab2" className="justify-start">Preferenze</TabsTrigger>
|
|
68
|
+
<TabsTrigger value="tab3" className="justify-start">Notifiche</TabsTrigger>
|
|
69
|
+
</TabsList>
|
|
70
|
+
<div className="ml-4 flex-1">
|
|
71
|
+
<TabsContent value="tab1" className="border-d-border rounded-md border p-4">Profilo</TabsContent>
|
|
72
|
+
<TabsContent value="tab2" className="border-d-border rounded-md border p-4">Preferenze</TabsContent>
|
|
73
|
+
<TabsContent value="tab3" className="border-d-border rounded-md border p-4">Notifiche</TabsContent>
|
|
74
|
+
</div>
|
|
75
|
+
</Tabs>
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## Notes
|
|
83
|
+
|
|
84
|
+
- **Styling**: `TabsList` uses DS tokens for backgrounds; `TabsTrigger` highlights when active.
|
|
85
|
+
- **Accessibility**: Uses Radix semantics for roles/aria and keyboard navigation out of the box.
|
|
86
|
+
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# TextArea
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Textarea with optional label wrapper and design-system focus/invalid styles. Accepts all native `<textarea>` props.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Props
|
|
10
|
+
|
|
11
|
+
| Prop | Type | Default | Description |
|
|
12
|
+
| ---------------- | ------------------ | ----------- | ----------- |
|
|
13
|
+
| `label` | `React.ReactNode` | `undefined` | Optional label text/node above the textarea. |
|
|
14
|
+
| `labelClassName` | `string` | `undefined` | Classes for `Label`. |
|
|
15
|
+
| `wrpClassName` | `string` | `undefined` | Wrapper classes. |
|
|
16
|
+
| `id` | `string` | `auto` | If omitted and `label` is provided, an id is generated. |
|
|
17
|
+
| `...props` | `React.ComponentProps<'textarea'>` | — | All native textarea props (e.g., `rows`, `placeholder`, `disabled`). |
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## Behavior
|
|
22
|
+
|
|
23
|
+
- **Auto id**: When `label` exists and `id` is not provided, an id is generated and linked via `Label htmlFor`.
|
|
24
|
+
- **Styling**: Uses DS tokens for border, focus ring, disabled, and invalid states (`aria-invalid`).
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## Example
|
|
29
|
+
|
|
30
|
+
```tsx
|
|
31
|
+
import { Textarea } from "laif-ds";
|
|
32
|
+
|
|
33
|
+
export function Example() {
|
|
34
|
+
return (
|
|
35
|
+
<Textarea
|
|
36
|
+
label="Descrizione"
|
|
37
|
+
placeholder="Scrivi qui..."
|
|
38
|
+
defaultValue="Testo di esempio"
|
|
39
|
+
rows={4}
|
|
40
|
+
wrpClassName="w-[500px]"
|
|
41
|
+
/>
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## Notes
|
|
49
|
+
|
|
50
|
+
- **Validation**: Add `aria-invalid` to reflect error state.
|
|
51
|
+
- **Resize**: Control with native CSS `resize` via `className` if needed.
|
|
52
|
+
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# ThemeSwitcher
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Theme toggle with three options: system, light, dark. Uses a controlled/uncontrolled API and avoids hydration mismatch by rendering only after mount.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Props
|
|
10
|
+
|
|
11
|
+
| Prop | Type | Default | Description |
|
|
12
|
+
| -------------- | ---------------------------------- | --------- | ----------- |
|
|
13
|
+
| `value` | `"light" | "dark" | "system"` | `undefined` | Controlled theme value. |
|
|
14
|
+
| `onChange` | `(theme: "light" | "dark" | "system") => void` | `undefined` | Called when theme changes. |
|
|
15
|
+
| `defaultValue` | `"light" | "dark" | "system"` | `"system"` | Initial value when uncontrolled. |
|
|
16
|
+
| `className` | `string` | `undefined` | Container classes. |
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Behavior
|
|
21
|
+
|
|
22
|
+
- **SSR safe**: Renders `null` until mounted to prevent hydration mismatch.
|
|
23
|
+
- **Active state**: Highlights the active option with a rounded background.
|
|
24
|
+
- **Control**: Works in both controlled (`value`/`onChange`) and uncontrolled (`defaultValue`) modes.
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## Examples
|
|
29
|
+
|
|
30
|
+
### Default (uncontrolled)
|
|
31
|
+
|
|
32
|
+
```tsx
|
|
33
|
+
import { ThemeSwitcher } from "laif-ds";
|
|
34
|
+
|
|
35
|
+
export function DefaultTheme() {
|
|
36
|
+
return <ThemeSwitcher defaultValue="system" />;
|
|
37
|
+
}
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### Controlled
|
|
41
|
+
|
|
42
|
+
```tsx
|
|
43
|
+
import * as React from "react";
|
|
44
|
+
import { ThemeSwitcher } from "laif-ds";
|
|
45
|
+
|
|
46
|
+
export function ControlledTheme() {
|
|
47
|
+
const [theme, setTheme] = React.useState<"light" | "dark" | "system">("system");
|
|
48
|
+
return (
|
|
49
|
+
<div className="flex flex-col items-start gap-2">
|
|
50
|
+
<ThemeSwitcher value={theme} onChange={setTheme} />
|
|
51
|
+
<div className="text-d-muted-foreground text-sm">Current theme: <span className="font-medium">{theme}</span></div>
|
|
52
|
+
</div>
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Custom styling
|
|
58
|
+
|
|
59
|
+
```tsx
|
|
60
|
+
<ThemeSwitcher defaultValue="system" className="h-10 w-32 p-2" />
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## Notes
|
|
66
|
+
|
|
67
|
+
- **Icons**: The component renders icons internally; no configuration required.
|
|
68
|
+
- **Persistence**: Persisting theme choice is up to the app (e.g., localStorage + class on `html`).
|
|
69
|
+
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Toaster
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Styled `sonner` Toaster with design-system classNames for toast, description, and action buttons.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Usage
|
|
10
|
+
|
|
11
|
+
```tsx
|
|
12
|
+
import { Toaster } from "laif-ds";
|
|
13
|
+
|
|
14
|
+
export function App() {
|
|
15
|
+
return <Toaster position="top-right" />;
|
|
16
|
+
}
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Applies classNames for:
|
|
20
|
+
- `toast`
|
|
21
|
+
- `description`
|
|
22
|
+
- `actionButton`
|
|
23
|
+
- `cancelButton`
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Toggle
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Single toggle button component with variants and sizes. Built on Radix Toggle.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Props
|
|
10
|
+
|
|
11
|
+
Extends `@radix-ui/react-toggle` Root props plus variants.
|
|
12
|
+
|
|
13
|
+
- `variant`: `"default" | "outline"` (default: `"default"`)
|
|
14
|
+
- `size`: `"default" | "sm" | "lg"` (default: `"default"`)
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## Example
|
|
19
|
+
|
|
20
|
+
```tsx
|
|
21
|
+
import { Toggle } from "laif-ds";
|
|
22
|
+
import { Bold } from "lucide-react";
|
|
23
|
+
|
|
24
|
+
export function BoldToggle() {
|
|
25
|
+
return (
|
|
26
|
+
<Toggle aria-label="Toggle bold">
|
|
27
|
+
<Bold />
|
|
28
|
+
</Toggle>
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
```
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# ToggleGroup
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Group of toggle buttons with shared variant/size context. Built on Radix Toggle Group.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Exports
|
|
10
|
+
|
|
11
|
+
- `ToggleGroup` — container; supports Radix `type="single" | "multiple"`
|
|
12
|
+
- `ToggleGroupItem` — individual item inheriting variant/size from context
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## Example
|
|
17
|
+
|
|
18
|
+
```tsx
|
|
19
|
+
import { ToggleGroup, ToggleGroupItem } from "laif-ds";
|
|
20
|
+
|
|
21
|
+
export function AlignmentGroup() {
|
|
22
|
+
return (
|
|
23
|
+
<ToggleGroup type="single" defaultValue="center" variant="outline">
|
|
24
|
+
<ToggleGroupItem value="left">Left</ToggleGroupItem>
|
|
25
|
+
<ToggleGroupItem value="center">Center</ToggleGroupItem>
|
|
26
|
+
<ToggleGroupItem value="right">Right</ToggleGroupItem>
|
|
27
|
+
</ToggleGroup>
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
```
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
# Tooltip
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Radix Tooltip wrappers with DS tokens and variants. Includes `TooltipProvider` for global delay, `Tooltip` root, `TooltipTrigger`, and `TooltipContent` with `primary` and `card` looks.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Components & Props
|
|
10
|
+
|
|
11
|
+
- **TooltipProvider**
|
|
12
|
+
- `delayDuration?: number` (default `0`)
|
|
13
|
+
- Provides default open delay for nested tooltips.
|
|
14
|
+
- **Tooltip** (Root)
|
|
15
|
+
- Inherits Radix `TooltipPrimitive.Root` props: `open?`, `defaultOpen?`, `onOpenChange?`, `disableHoverableContent?`.
|
|
16
|
+
- Note: `delayDuration` is set via `TooltipProvider`, not here.
|
|
17
|
+
- **TooltipTrigger**
|
|
18
|
+
- Inherits Radix `Trigger` props. Use `asChild` to wrap buttons/links.
|
|
19
|
+
- **TooltipContent**
|
|
20
|
+
- Inherits Radix `Content` props: `side?`, `align?`, `sideOffset?` (default `0`), `alignOffset?`.
|
|
21
|
+
- `variant?: "primary" | "card"` (default `"primary"`).
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## Examples
|
|
26
|
+
|
|
27
|
+
### Default
|
|
28
|
+
|
|
29
|
+
```tsx
|
|
30
|
+
import { Button, Tooltip, TooltipTrigger, TooltipContent } from "laif-ds";
|
|
31
|
+
|
|
32
|
+
export function Basic() {
|
|
33
|
+
return (
|
|
34
|
+
<Tooltip>
|
|
35
|
+
<TooltipTrigger asChild>
|
|
36
|
+
<Button variant="outline">Passa sopra</Button>
|
|
37
|
+
</TooltipTrigger>
|
|
38
|
+
<TooltipContent>Questo è un tooltip</TooltipContent>
|
|
39
|
+
</Tooltip>
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Positioning
|
|
45
|
+
|
|
46
|
+
```tsx
|
|
47
|
+
<div className="flex items-center gap-4">
|
|
48
|
+
<Tooltip>
|
|
49
|
+
<TooltipTrigger asChild><Button size="sm">Top</Button></TooltipTrigger>
|
|
50
|
+
<TooltipContent side="top" sideOffset={5}>Tooltip in alto</TooltipContent>
|
|
51
|
+
</Tooltip>
|
|
52
|
+
<Tooltip>
|
|
53
|
+
<TooltipTrigger asChild><Button size="sm">Right</Button></TooltipTrigger>
|
|
54
|
+
<TooltipContent side="right" sideOffset={5}>Tooltip a destra</TooltipContent>
|
|
55
|
+
</Tooltip>
|
|
56
|
+
</div>
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### With Delay
|
|
60
|
+
|
|
61
|
+
```tsx
|
|
62
|
+
import { TooltipProvider } from "laif-ds";
|
|
63
|
+
|
|
64
|
+
export function WithDelay() {
|
|
65
|
+
return (
|
|
66
|
+
<TooltipProvider delayDuration={500}>
|
|
67
|
+
<Tooltip>
|
|
68
|
+
<TooltipTrigger asChild><Button>Ritardo 500ms</Button></TooltipTrigger>
|
|
69
|
+
<TooltipContent>Appare dopo 500ms</TooltipContent>
|
|
70
|
+
</Tooltip>
|
|
71
|
+
</TooltipProvider>
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Card Variant
|
|
77
|
+
|
|
78
|
+
```tsx
|
|
79
|
+
<Tooltip>
|
|
80
|
+
<TooltipTrigger asChild><Button variant="ghost">Info</Button></TooltipTrigger>
|
|
81
|
+
<TooltipContent variant="card">Contenuto con bordo e shadow</TooltipContent>
|
|
82
|
+
</Tooltip>
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
---
|
|
86
|
+
|
|
87
|
+
## Notes
|
|
88
|
+
|
|
89
|
+
- **Variants**: `primary` for compact color tooltip; `card` for bordered content blocks.
|
|
90
|
+
- **Groups**: Wrap toolbars with multiple triggers; provider can be defined once at app root.
|
|
91
|
+
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# TypingIndicator
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Animated three-dot typing indicator for chat UIs.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Example
|
|
10
|
+
|
|
11
|
+
```tsx
|
|
12
|
+
import { TypingIndicator } from "laif-ds";
|
|
13
|
+
|
|
14
|
+
export function ChatFooter() {
|
|
15
|
+
return (
|
|
16
|
+
<div className="p-2">
|
|
17
|
+
<TypingIndicator />
|
|
18
|
+
</div>
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
```
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# Typo
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Typography component with predefined variants for headings, body text, captions, and utility text. Renders a semantic HTML tag per variant (overridable via `as`).
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Props
|
|
10
|
+
|
|
11
|
+
| Prop | Type | Default | Description |
|
|
12
|
+
| ---------- | --------------------------------- | --------- | ----------- |
|
|
13
|
+
| `variant` | `TypoVariant` | `"body"` | Typographic style to apply. |
|
|
14
|
+
| `as` | `React.ElementType` | auto | Override rendered HTML element. |
|
|
15
|
+
| `className`| `string` | `undefined` | Extra classes. |
|
|
16
|
+
| `...props` | `React.HTMLAttributes<HTMLElement>` | — | Spread to rendered element. |
|
|
17
|
+
|
|
18
|
+
`TypoVariant`:
|
|
19
|
+
|
|
20
|
+
- `"hero-title"`, `"title"`, `"subtitle"`
|
|
21
|
+
- `"body"`, `"body-bold"`
|
|
22
|
+
- `"caption"`, `"overline"`, `"button"`, `"small"`
|
|
23
|
+
- `"h1"`, `"h2"`, `"h3"`, `"h4"`, `"h5"`
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## Behavior
|
|
28
|
+
|
|
29
|
+
- **Semantic tag**: Each variant maps to a sensible HTML tag (e.g., `h1` for `h1`, `p` for `body`).
|
|
30
|
+
- **Theming**: Variants use DS tokens for color and size; add `className` to tweak.
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## Examples
|
|
35
|
+
|
|
36
|
+
```tsx
|
|
37
|
+
import { Typo } from "laif-ds";
|
|
38
|
+
|
|
39
|
+
export function Variants() {
|
|
40
|
+
return (
|
|
41
|
+
<div className="space-y-2">
|
|
42
|
+
<Typo variant="hero-title">Hero Title</Typo>
|
|
43
|
+
<Typo variant="title">Page Title</Typo>
|
|
44
|
+
<Typo variant="subtitle">Subtitle</Typo>
|
|
45
|
+
<Typo variant="body">Regular body text</Typo>
|
|
46
|
+
<Typo variant="body-bold">Bold body text</Typo>
|
|
47
|
+
<Typo variant="caption">Caption</Typo>
|
|
48
|
+
<Typo variant="overline">Overline</Typo>
|
|
49
|
+
<Typo variant="small">Small text</Typo>
|
|
50
|
+
</div>
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export function OverrideElement() {
|
|
55
|
+
return <Typo variant="body" as="span">Inline body as span</Typo>;
|
|
56
|
+
}
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
## Notes
|
|
62
|
+
|
|
63
|
+
- **Accessibility**: Use heading variants (`h1`–`h5`) to reflect document structure.
|
|
64
|
+
- **Consistency**: Prefer `variant` over ad‑hoc classes for consistent typography.
|
|
65
|
+
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# WeeklyCalendar
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Week-view calendar with day columns, time column, current timeline, optional week navigation and appointment grouping by category.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Props
|
|
10
|
+
|
|
11
|
+
| Prop | Type | Default | Description |
|
|
12
|
+
| ------------------ | -------------------------------------------- | ------- | ----------- |
|
|
13
|
+
| `appointments` | `CalendarAppointment[]` | `[]` | Appointments to render across the week. |
|
|
14
|
+
| `onWeekChange` | `(weekOffset: number, weekStart: string, weekEnd: string) => void` | `undefined` | Emitted when navigating weeks. |
|
|
15
|
+
| `initialWeekOffset`| `number` | `0` | 0 = current week; negative/positive for past/future. |
|
|
16
|
+
| `showNavigation` | `boolean` | `true` | Show previous/next/current week controls. |
|
|
17
|
+
| `showWeekIndicator`| `boolean` | `false` | Show current week label. |
|
|
18
|
+
| `enableGrouping` | `boolean` | `false` | Group appointments by `appointment.groupBy`. |
|
|
19
|
+
| `groupLabel` | `string` | `undefined` | Group header label. |
|
|
20
|
+
| `calendarStartHour`| `number` | `8` | First visible hour (0-23). |
|
|
21
|
+
| `calendarEndHour` | `number` | `20` | Last visible hour (0-23). |
|
|
22
|
+
| `todayString` | `string` | `"Oggi"` | Label for "today" button.
|
|
23
|
+
|
|
24
|
+
`CalendarAppointment` minimal shape: `{ id: number|string; title: string; date: YYYY-MM-DD; startTime: HH:mm; endTime: HH:mm; description?: string; color?: string; attributes?: { key: string; value: string; showTooltip?: boolean; showPreview?: boolean }[]; groupBy?: string }`.
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## Behavior
|
|
29
|
+
|
|
30
|
+
- **Navigation**: Previous/next/current week; `onWeekChange` returns offset and ISO dates.
|
|
31
|
+
- **Grouping**: When `enableGrouping`, appointments are grouped under `groupBy` headings per day.
|
|
32
|
+
- **Attributes**: Show in tooltip or in preview card depending on flags.
|
|
33
|
+
|
|
34
|
+
---
|
|
35
|
+
|
|
36
|
+
## Examples
|
|
37
|
+
|
|
38
|
+
```tsx
|
|
39
|
+
import { WeeklyCalendar } from "laif-ds";
|
|
40
|
+
import { mockAppointments } from "laif-ds";
|
|
41
|
+
|
|
42
|
+
export function GroupedCalendar() {
|
|
43
|
+
return (
|
|
44
|
+
<div className="container mx-auto overflow-y-auto">
|
|
45
|
+
<WeeklyCalendar
|
|
46
|
+
appointments={mockAppointments}
|
|
47
|
+
calendarStartHour={6}
|
|
48
|
+
calendarEndHour={21}
|
|
49
|
+
enableGrouping
|
|
50
|
+
groupLabel="Aula studio"
|
|
51
|
+
showNavigation
|
|
52
|
+
/>
|
|
53
|
+
</div>
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## Notes
|
|
61
|
+
|
|
62
|
+
- **Localization**: Weekday labels are Italian by default; adapt as needed in upstream module.
|
|
63
|
+
- **Performance**: Efficient day partitioning and rendering; large datasets should still be chunked server-side when possible.
|
|
64
|
+
|