laif-ds 0.2.74 → 0.2.75
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/CHANGELOG.md +431 -0
- package/dist/agent-docs/adoption-report.json +614 -0
- package/dist/agent-docs/components/Accordion.md +46 -16
- package/dist/agent-docs/components/Alert.md +90 -95
- package/dist/agent-docs/components/AlertDialog.md +132 -126
- package/dist/agent-docs/components/AppEditor.md +90 -90
- package/dist/agent-docs/components/AppRadioGroup.md +18 -18
- package/dist/agent-docs/components/AppSidebar.md +129 -122
- package/dist/agent-docs/components/AppStepper.md +81 -77
- package/dist/agent-docs/components/AspectRatio.md +70 -62
- package/dist/agent-docs/components/AudioVisualizer.md +5 -5
- package/dist/agent-docs/components/Avatar.md +112 -113
- package/dist/agent-docs/components/Badge.md +123 -118
- package/dist/agent-docs/components/Breadcrumb.md +8 -1
- package/dist/agent-docs/components/Button.md +131 -129
- package/dist/agent-docs/components/Card.md +172 -147
- package/dist/agent-docs/components/Carousel.md +148 -129
- package/dist/agent-docs/components/Chat.md +121 -109
- package/dist/agent-docs/components/ChatMessage.md +72 -61
- package/dist/agent-docs/components/Checkbox.md +150 -135
- package/dist/agent-docs/components/CircularProgress.md +53 -49
- package/dist/agent-docs/components/CodeHighlighter.md +4 -4
- package/dist/agent-docs/components/Collapsible.md +114 -95
- package/dist/agent-docs/components/Command.md +141 -142
- package/dist/agent-docs/components/Confirmer.md +182 -175
- package/dist/agent-docs/components/ContextMenu.md +196 -191
- package/dist/agent-docs/components/DataCrossTable.md +114 -94
- package/dist/agent-docs/components/DataTable.md +29 -24
- package/dist/agent-docs/components/Dialog.md +130 -125
- package/dist/agent-docs/components/Drawer.md +141 -127
- package/dist/agent-docs/components/FilePreviewer.md +138 -139
- package/dist/agent-docs/components/FileUploader.md +143 -129
- package/dist/agent-docs/components/Form.md +3 -1
- package/dist/agent-docs/components/FormComposer.md +163 -137
- package/dist/agent-docs/components/GanttChart.md +125 -122
- package/dist/agent-docs/components/HoverCard.md +1 -1
- package/dist/agent-docs/components/Icon.md +98 -99
- package/dist/agent-docs/components/Input.md +173 -138
- package/dist/agent-docs/components/InputOtp.md +6 -1
- package/dist/agent-docs/components/InputSelector.md +94 -97
- package/dist/agent-docs/components/InterruptPrompt.md +4 -4
- package/dist/agent-docs/components/MarkdownRenderer.md +5 -2
- package/dist/agent-docs/components/Menubar.md +60 -57
- package/dist/agent-docs/components/MessageInput.md +134 -131
- package/dist/agent-docs/components/MessageList.md +110 -96
- package/dist/agent-docs/components/MultipleSelector.md +147 -146
- package/dist/agent-docs/components/NavigationMenu.md +6 -2
- package/dist/agent-docs/components/Popover.md +112 -103
- package/dist/agent-docs/components/PromptSuggestions.md +5 -5
- package/dist/agent-docs/components/RadioGroup.md +97 -90
- package/dist/agent-docs/components/Resizable.md +4 -1
- package/dist/agent-docs/components/ResizePrompt.md +12 -13
- package/dist/agent-docs/components/ScrollArea.md +6 -2
- package/dist/agent-docs/components/SecurePdfViewer.md +10 -6
- package/dist/agent-docs/components/Select.md +131 -132
- package/dist/agent-docs/components/Sheet.md +8 -1
- package/dist/agent-docs/components/ShikiHighlighter.md +5 -5
- package/dist/agent-docs/components/Sidebar.md +94 -85
- package/dist/agent-docs/components/Slider.md +62 -58
- package/dist/agent-docs/components/Sonner.md +1 -0
- package/dist/agent-docs/components/Spinner.md +14 -14
- package/dist/agent-docs/components/Stepper.md +93 -67
- package/dist/agent-docs/components/Switch.md +41 -42
- package/dist/agent-docs/components/TableSkeleton.md +8 -8
- package/dist/agent-docs/components/Tabs.md +106 -86
- package/dist/agent-docs/components/TextArea.md +51 -52
- package/dist/agent-docs/components/ThemeSwitcher.md +72 -69
- package/dist/agent-docs/components/Toaster.md +1 -0
- package/dist/agent-docs/components/Tooltip.md +102 -91
- package/dist/agent-docs/components/Typo.md +68 -65
- package/dist/agent-docs/components/WeeklyCalendar.md +63 -64
- package/dist/agent-docs/manifest.json +5979 -0
- package/dist/components/editor/editor-hooks/use-update-toolbar.js +6 -6
- package/dist/components/editor/plugins/actions/counter-character-plugin.js +6 -6
- package/dist/components/editor/plugins/toolbar/font-format-toolbar-plugin.js +18 -18
- package/dist/components/editor/plugins/toolbar/history-toolbar-plugin.js +10 -10
- package/dist/components/editor/plugins/toolbar/toolbar-plugin.js +9 -9
- package/dist/components/ui/app-checkbox.js +1 -1
- package/dist/components/ui/app-dialog.js +70 -64
- package/dist/components/ui/app-editor.js +51 -51
- package/dist/components/ui/app-form.js +81 -81
- package/dist/components/ui/app-multiple-select-dropdown.js +36 -36
- package/dist/components/ui/app-select.js +109 -104
- package/dist/components/ui/app-sidebar.js +41 -41
- package/dist/components/ui/app-stepper.js +1 -1
- package/dist/components/ui/app-time-picker.js +18 -18
- package/dist/components/ui/app-tooltip.js +1 -1
- package/dist/components/ui/async-select.js +5 -5
- package/dist/components/ui/audio-visualizer.js +61 -58
- package/dist/components/ui/card.js +1 -1
- package/dist/components/ui/carousel.js +2 -2
- package/dist/components/ui/chart.js +1 -1
- package/dist/components/ui/chat-message.js +8 -8
- package/dist/components/ui/chat.js +86 -88
- package/dist/components/ui/command.js +2 -2
- package/dist/components/ui/copy-button.js +4 -4
- package/dist/components/ui/date-picker.js +20 -20
- package/dist/components/ui/file-preview/index.js +13 -13
- package/dist/components/ui/file-previewer.js +12 -11
- package/dist/components/ui/form.js +2 -2
- package/dist/components/ui/gantt/components/Chart/Bars/Bars.js +56 -56
- package/dist/components/ui/gantt/components/Chart/Bars/BarsRow/BarItem/BarItem.js +12 -12
- package/dist/components/ui/gantt/components/Chart/Bars/BarsRow/BarsItems/BarItems.js +1 -1
- package/dist/components/ui/gantt/components/Chart/Bars/BarsRow/BarsRow.js +4 -4
- package/dist/components/ui/gantt/components/Chart/Bars/BarsRow/RepeteadBars/RepeteadBars.js +2 -2
- package/dist/components/ui/gantt/components/Chart/Chart.js +23 -23
- package/dist/components/ui/gantt/components/Chart/Scale/Scale.js +1 -1
- package/dist/components/ui/gantt/components/Chart/Tree/Tree.js +34 -34
- package/dist/components/ui/gantt/components/Controls/Controls.js +5 -5
- package/dist/components/ui/gantt/components/Gantt/Gantt.js +4 -4
- package/dist/components/ui/gantt/hooks/useGanttCalculate.js +25 -18
- package/dist/components/ui/input-selector.js +1 -1
- package/dist/components/ui/input.js +23 -23
- package/dist/components/ui/kanban.js +8 -9
- package/dist/components/ui/markdown-renderer.js +41 -35
- package/dist/components/ui/message-input.js +45 -44
- package/dist/components/ui/multiple-selector.js +91 -82
- package/dist/components/ui/secure-pdf-viewer.js +19 -7
- package/dist/components/ui/sidebar.js +1 -1
- package/dist/components/ui/slider.js +1 -1
- package/dist/components/ui/spinner.js +4 -4
- package/dist/components/ui/stepper.js +157 -138
- package/dist/components/ui/tables/data-cross-table/data-cross-table-buttons.js +29 -29
- package/dist/components/ui/tables/data-cross-table/data-cross-table.js +258 -246
- package/dist/components/ui/tables/data-table/components/data-table-advanced-filter.js +4 -1
- package/dist/components/ui/tables/data-table/components/data-table-body.js +204 -368
- package/dist/components/ui/tables/data-table/components/data-table-filter-inputs.js +114 -112
- package/dist/components/ui/tables/data-table/components/data-table-filters.js +116 -96
- package/dist/components/ui/tables/data-table/components/data-table-header.js +210 -0
- package/dist/components/ui/tables/data-table/components/data-table-searchbar.js +8 -8
- package/dist/components/ui/tables/data-table/components/data-table-skeleton-rows.js +33 -0
- package/dist/components/ui/tables/data-table/data-table.js +256 -250
- package/dist/components/ui/tables/data-table/data-table.service.js +112 -97
- package/dist/components/ui/tables/data-table/data-table.utils.js +2 -0
- package/dist/components/ui/textarea.js +2 -2
- package/dist/components/ui/theme-switcher.js +1 -1
- package/dist/components/ui/toggle-group.js +2 -2
- package/dist/components/ui/weekly-calendar/appointment-card.js +16 -16
- package/dist/components/ui/weekly-calendar/calendar-context.js +6 -6
- package/dist/components/ui/weekly-calendar/calendar-header.js +12 -12
- package/dist/components/ui/weekly-calendar/day-column.js +16 -16
- package/dist/components/ui/weekly-calendar/time-column.js +4 -4
- package/dist/components/ui/weekly-calendar/weekly-calendar.js +4 -4
- package/dist/hooks/use-audio-recording.js +1 -1
- package/dist/hooks/use-auto-scroll.js +18 -18
- package/dist/hooks/use-autosize-textarea.js +12 -13
- package/dist/index.d.ts +67 -43
- package/dist/index.js +229 -229
- package/dist/lib/utils.js +6 -6
- package/dist/styles.v3.css +1 -1
- package/package.json +14 -4
|
@@ -12,14 +12,14 @@ Props are passed through to the underlying Radix Accordion primitives. The most
|
|
|
12
12
|
|
|
13
13
|
### Accordion (Root)
|
|
14
14
|
|
|
15
|
-
| Prop | Type
|
|
16
|
-
| --------------- |
|
|
17
|
-
| `type` | `"single" \| "multiple"`
|
|
18
|
-
| `collapsible` | `boolean`
|
|
19
|
-
| `value` | `string \| string[]`
|
|
20
|
-
| `defaultValue` | `string \| string[]`
|
|
21
|
-
| `onValueChange` | `(value: string \| string[]) => any` | `undefined` | Callback fired when open item(s) change.
|
|
22
|
-
| `className` | `string` | `""` | Additional classes applied to the root.
|
|
15
|
+
| Prop | Type | Default | Description |
|
|
16
|
+
| --------------- | ------------------------------------ | ----------- | ----------------------------------------------------------------------- |
|
|
17
|
+
| `type` | `"single" \| "multiple"` | `"single"` | Single allows one item open at a time. Multiple allows many open items. |
|
|
18
|
+
| `collapsible` | `boolean` | `false` | Only for `type="single"`. If true, allows closing the last open item. |
|
|
19
|
+
| `value` | `string \| string[]` | `undefined` | Controlled value of the open item(s). |
|
|
20
|
+
| `defaultValue` | `string \| string[]` | `undefined` | Uncontrolled default open item(s). |
|
|
21
|
+
| `onValueChange` | `(value: string \| string[]) => any` | `undefined` | Callback fired when open item(s) change. |
|
|
22
|
+
| `className` | `string` | `""` | Additional classes applied to the root. |
|
|
23
23
|
|
|
24
24
|
### Subcomponents
|
|
25
25
|
|
|
@@ -43,7 +43,12 @@ Props are passed through to the underlying Radix Accordion primitives. The most
|
|
|
43
43
|
### Basic (Single)
|
|
44
44
|
|
|
45
45
|
```tsx
|
|
46
|
-
import {
|
|
46
|
+
import {
|
|
47
|
+
Accordion,
|
|
48
|
+
AccordionItem,
|
|
49
|
+
AccordionTrigger,
|
|
50
|
+
AccordionContent,
|
|
51
|
+
} from "laif-ds";
|
|
47
52
|
|
|
48
53
|
export function BasicAccordion() {
|
|
49
54
|
return (
|
|
@@ -74,7 +79,12 @@ export function BasicAccordion() {
|
|
|
74
79
|
### With Default Open (Single, collapsible)
|
|
75
80
|
|
|
76
81
|
```tsx
|
|
77
|
-
import {
|
|
82
|
+
import {
|
|
83
|
+
Accordion,
|
|
84
|
+
AccordionItem,
|
|
85
|
+
AccordionTrigger,
|
|
86
|
+
AccordionContent,
|
|
87
|
+
} from "laif-ds";
|
|
78
88
|
|
|
79
89
|
export function AccordionWithDefaultOpen() {
|
|
80
90
|
return (
|
|
@@ -101,11 +111,20 @@ export function AccordionWithDefaultOpen() {
|
|
|
101
111
|
### Multiple Mode with Multiple Default Open
|
|
102
112
|
|
|
103
113
|
```tsx
|
|
104
|
-
import {
|
|
114
|
+
import {
|
|
115
|
+
Accordion,
|
|
116
|
+
AccordionItem,
|
|
117
|
+
AccordionTrigger,
|
|
118
|
+
AccordionContent,
|
|
119
|
+
} from "laif-ds";
|
|
105
120
|
|
|
106
121
|
export function MultipleModeAccordion() {
|
|
107
122
|
return (
|
|
108
|
-
<Accordion
|
|
123
|
+
<Accordion
|
|
124
|
+
type="multiple"
|
|
125
|
+
defaultValue={["item-1", "item-3"]}
|
|
126
|
+
className="w-96"
|
|
127
|
+
>
|
|
109
128
|
<AccordionItem value="item-1">
|
|
110
129
|
<AccordionTrigger>First section (default open)</AccordionTrigger>
|
|
111
130
|
<AccordionContent>This section is open by default.</AccordionContent>
|
|
@@ -116,7 +135,9 @@ export function MultipleModeAccordion() {
|
|
|
116
135
|
</AccordionItem>
|
|
117
136
|
<AccordionItem value="item-3">
|
|
118
137
|
<AccordionTrigger>Third section (default open)</AccordionTrigger>
|
|
119
|
-
<AccordionContent>
|
|
138
|
+
<AccordionContent>
|
|
139
|
+
This section is also open by default.
|
|
140
|
+
</AccordionContent>
|
|
120
141
|
</AccordionItem>
|
|
121
142
|
</Accordion>
|
|
122
143
|
);
|
|
@@ -127,13 +148,23 @@ export function MultipleModeAccordion() {
|
|
|
127
148
|
|
|
128
149
|
```tsx
|
|
129
150
|
import { useState } from "react";
|
|
130
|
-
import {
|
|
151
|
+
import {
|
|
152
|
+
Accordion,
|
|
153
|
+
AccordionItem,
|
|
154
|
+
AccordionTrigger,
|
|
155
|
+
AccordionContent,
|
|
156
|
+
} from "laif-ds";
|
|
131
157
|
|
|
132
158
|
export function ControlledAccordion() {
|
|
133
159
|
const [open, setOpen] = useState<string>("item-1");
|
|
134
160
|
|
|
135
161
|
return (
|
|
136
|
-
<Accordion
|
|
162
|
+
<Accordion
|
|
163
|
+
type="single"
|
|
164
|
+
value={open}
|
|
165
|
+
onValueChange={(v) => setOpen(v as string)}
|
|
166
|
+
className="w-96"
|
|
167
|
+
>
|
|
137
168
|
<AccordionItem value="item-1">
|
|
138
169
|
<AccordionTrigger>First</AccordionTrigger>
|
|
139
170
|
<AccordionContent>First content</AccordionContent>
|
|
@@ -154,4 +185,3 @@ export function ControlledAccordion() {
|
|
|
154
185
|
- **Accessibility**: Uses proper ARIA roles/attributes and keyboard navigation.
|
|
155
186
|
- **Animations**: `AccordionContent` has built-in open/close animations.
|
|
156
187
|
- **Styling**: Customize with `className` on root/items/triggers/contents.
|
|
157
|
-
|
|
@@ -1,95 +1,90 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
- **Styling**: Use `className` on the root to add layout constraints (e.g., width).
|
|
93
|
-
- **Content**: `AlertDescription` supports rich content and multi-line paragraphs.
|
|
94
|
-
- **Icons**: Use `Icon` from `laif-ds` to add an optional leading icon.
|
|
95
|
-
|
|
1
|
+
# Alert
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
A simple, accessible alert component with title and description. Supports variants for information and destructive/error states.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Props
|
|
10
|
+
|
|
11
|
+
### Alert (Root)
|
|
12
|
+
|
|
13
|
+
| Prop | Type | Default | Description |
|
|
14
|
+
| ----------- | ----------------- | -------------- | ----------------------------------------------- | -------------------------- |
|
|
15
|
+
| `variant` | `"default" | "destructive"` | `"default"` | Visual style of the alert. |
|
|
16
|
+
| `className` | `string` | `""` | Additional classes applied to the root element. |
|
|
17
|
+
| `children` | `React.ReactNode` | **required** | Content of the alert (title/description/icon). |
|
|
18
|
+
|
|
19
|
+
### Subcomponents
|
|
20
|
+
|
|
21
|
+
- `AlertTitle`: Title area of the alert (bold line).
|
|
22
|
+
- `AlertDescription`: Secondary text, supports rich content and paragraphs.
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## Behavior
|
|
27
|
+
|
|
28
|
+
- **Accessible**: Uses `role="alert"` and semantic slots for screen readers.
|
|
29
|
+
- **Variants**: `destructive` applies error coloring; `default` uses neutral styling.
|
|
30
|
+
- **Layout**: Supports optional leading icon; layout adapts when an icon is present.
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## Examples
|
|
35
|
+
|
|
36
|
+
### Default
|
|
37
|
+
|
|
38
|
+
```tsx
|
|
39
|
+
import { Alert, AlertTitle, AlertDescription } from "laif-ds";
|
|
40
|
+
|
|
41
|
+
export function DefaultAlert() {
|
|
42
|
+
return (
|
|
43
|
+
<Alert>
|
|
44
|
+
<AlertTitle>Default Alert</AlertTitle>
|
|
45
|
+
<AlertDescription>This is a default alert message.</AlertDescription>
|
|
46
|
+
</Alert>
|
|
47
|
+
);
|
|
48
|
+
}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### With Icon
|
|
52
|
+
|
|
53
|
+
```tsx
|
|
54
|
+
import { Alert, AlertTitle, AlertDescription, Icon } from "laif-ds";
|
|
55
|
+
|
|
56
|
+
export function AlertWithIcon() {
|
|
57
|
+
return (
|
|
58
|
+
<Alert>
|
|
59
|
+
<Icon name="Info" />
|
|
60
|
+
<AlertTitle>Information</AlertTitle>
|
|
61
|
+
<AlertDescription>This alert includes an icon.</AlertDescription>
|
|
62
|
+
</Alert>
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Destructive
|
|
68
|
+
|
|
69
|
+
```tsx
|
|
70
|
+
import { Alert, AlertTitle, AlertDescription } from "laif-ds";
|
|
71
|
+
|
|
72
|
+
export function DestructiveAlert() {
|
|
73
|
+
return (
|
|
74
|
+
<Alert variant="destructive">
|
|
75
|
+
<AlertTitle>Error</AlertTitle>
|
|
76
|
+
<AlertDescription>
|
|
77
|
+
Something went wrong. Please try again.
|
|
78
|
+
</AlertDescription>
|
|
79
|
+
</Alert>
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
## Notes
|
|
87
|
+
|
|
88
|
+
- **Styling**: Use `className` on the root to add layout constraints (e.g., width).
|
|
89
|
+
- **Content**: `AlertDescription` supports rich content and multi-line paragraphs.
|
|
90
|
+
- **Icons**: Use `Icon` from `laif-ds` to add an optional leading icon.
|
|
@@ -1,126 +1,132 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
1
|
+
# AlertDialog
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Accessible modal dialog for critical confirmations. Built on Radix Alert Dialog primitives with composable subcomponents and focus management.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Props
|
|
10
|
+
|
|
11
|
+
### AlertDialog (Root)
|
|
12
|
+
|
|
13
|
+
| Prop | Type | Default | Description |
|
|
14
|
+
| -------------- | ------------------------- | ----------- | --------------------------------- |
|
|
15
|
+
| `open` | `boolean` | `undefined` | Controlled open state. |
|
|
16
|
+
| `defaultOpen` | `boolean` | `false` | Uncontrolled initial open state. |
|
|
17
|
+
| `onOpenChange` | `(open: boolean) => void` | `undefined` | Callback when open state changes. |
|
|
18
|
+
|
|
19
|
+
### Subcomponents
|
|
20
|
+
|
|
21
|
+
- `AlertDialogTrigger`: Element that opens the dialog (can be `asChild`).
|
|
22
|
+
- `AlertDialogContent`: The dialog content container.
|
|
23
|
+
- `AlertDialogHeader` / `AlertDialogFooter`: Layout sections for content and actions.
|
|
24
|
+
- `AlertDialogTitle` / `AlertDialogDescription`: Title and supporting description.
|
|
25
|
+
- `AlertDialogAction`: Primary action button.
|
|
26
|
+
- `AlertDialogCancel`: Secondary cancel button.
|
|
27
|
+
- `AlertDialogPortal`, `AlertDialogOverlay`: Portal and overlay elements.
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## Behavior
|
|
32
|
+
|
|
33
|
+
- **Focus management**: Traps focus within the dialog, returns focus on close.
|
|
34
|
+
- **Accessibility**: Proper ARIA roles and keyboard interactions (Esc to close).
|
|
35
|
+
- **Composability**: Use any button (e.g., `Button`) with `AlertDialogTrigger asChild`.
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## Examples
|
|
40
|
+
|
|
41
|
+
### Basic
|
|
42
|
+
|
|
43
|
+
```tsx
|
|
44
|
+
import {
|
|
45
|
+
AlertDialog,
|
|
46
|
+
AlertDialogAction,
|
|
47
|
+
AlertDialogCancel,
|
|
48
|
+
AlertDialogContent,
|
|
49
|
+
AlertDialogDescription,
|
|
50
|
+
AlertDialogFooter,
|
|
51
|
+
AlertDialogHeader,
|
|
52
|
+
AlertDialogTitle,
|
|
53
|
+
AlertDialogTrigger,
|
|
54
|
+
} from "laif-ds";
|
|
55
|
+
import { Button } from "laif-ds";
|
|
56
|
+
|
|
57
|
+
export function BasicAlertDialog() {
|
|
58
|
+
return (
|
|
59
|
+
<AlertDialog>
|
|
60
|
+
<AlertDialogTrigger asChild>
|
|
61
|
+
<Button variant="outline">Show Alert Dialog</Button>
|
|
62
|
+
</AlertDialogTrigger>
|
|
63
|
+
<AlertDialogContent>
|
|
64
|
+
<AlertDialogHeader>
|
|
65
|
+
<AlertDialogTitle>Are you absolutely sure?</AlertDialogTitle>
|
|
66
|
+
<AlertDialogDescription>
|
|
67
|
+
This action cannot be undone. This will permanently delete your
|
|
68
|
+
account and remove your data from our servers.
|
|
69
|
+
</AlertDialogDescription>
|
|
70
|
+
</AlertDialogHeader>
|
|
71
|
+
<AlertDialogFooter>
|
|
72
|
+
<AlertDialogCancel>Cancel</AlertDialogCancel>
|
|
73
|
+
<AlertDialogAction>Continue</AlertDialogAction>
|
|
74
|
+
</AlertDialogFooter>
|
|
75
|
+
</AlertDialogContent>
|
|
76
|
+
</AlertDialog>
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Controlled
|
|
82
|
+
|
|
83
|
+
```tsx
|
|
84
|
+
import { useState } from "react";
|
|
85
|
+
import {
|
|
86
|
+
AlertDialog,
|
|
87
|
+
AlertDialogAction,
|
|
88
|
+
AlertDialogCancel,
|
|
89
|
+
AlertDialogContent,
|
|
90
|
+
AlertDialogDescription,
|
|
91
|
+
AlertDialogFooter,
|
|
92
|
+
AlertDialogHeader,
|
|
93
|
+
AlertDialogTitle,
|
|
94
|
+
} from "laif-ds";
|
|
95
|
+
import { Button } from "laif-ds";
|
|
96
|
+
|
|
97
|
+
export function ControlledAlertDialog() {
|
|
98
|
+
const [open, setOpen] = useState(false);
|
|
99
|
+
|
|
100
|
+
return (
|
|
101
|
+
<>
|
|
102
|
+
<Button onClick={() => setOpen(true)}>Open dialog</Button>
|
|
103
|
+
<AlertDialog open={open} onOpenChange={setOpen}>
|
|
104
|
+
<AlertDialogContent>
|
|
105
|
+
<AlertDialogHeader>
|
|
106
|
+
<AlertDialogTitle>Confirm action</AlertDialogTitle>
|
|
107
|
+
<AlertDialogDescription>
|
|
108
|
+
Are you sure you want to proceed?
|
|
109
|
+
</AlertDialogDescription>
|
|
110
|
+
</AlertDialogHeader>
|
|
111
|
+
<AlertDialogFooter>
|
|
112
|
+
<AlertDialogCancel onClick={() => setOpen(false)}>
|
|
113
|
+
Cancel
|
|
114
|
+
</AlertDialogCancel>
|
|
115
|
+
<AlertDialogAction onClick={() => setOpen(false)}>
|
|
116
|
+
Confirm
|
|
117
|
+
</AlertDialogAction>
|
|
118
|
+
</AlertDialogFooter>
|
|
119
|
+
</AlertDialogContent>
|
|
120
|
+
</AlertDialog>
|
|
121
|
+
</>
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
## Notes
|
|
129
|
+
|
|
130
|
+
- **Styling**: `AlertDialogContent` is centered and responsive; customize with `className`.
|
|
131
|
+
- **Overlay**: `AlertDialogOverlay` provides a backdrop with fade animations.
|
|
132
|
+
- **Buttons**: `AlertDialogAction` uses default button styles; pass `className` to adjust.
|