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.
Files changed (151) hide show
  1. package/dist/CHANGELOG.md +431 -0
  2. package/dist/agent-docs/adoption-report.json +614 -0
  3. package/dist/agent-docs/components/Accordion.md +46 -16
  4. package/dist/agent-docs/components/Alert.md +90 -95
  5. package/dist/agent-docs/components/AlertDialog.md +132 -126
  6. package/dist/agent-docs/components/AppEditor.md +90 -90
  7. package/dist/agent-docs/components/AppRadioGroup.md +18 -18
  8. package/dist/agent-docs/components/AppSidebar.md +129 -122
  9. package/dist/agent-docs/components/AppStepper.md +81 -77
  10. package/dist/agent-docs/components/AspectRatio.md +70 -62
  11. package/dist/agent-docs/components/AudioVisualizer.md +5 -5
  12. package/dist/agent-docs/components/Avatar.md +112 -113
  13. package/dist/agent-docs/components/Badge.md +123 -118
  14. package/dist/agent-docs/components/Breadcrumb.md +8 -1
  15. package/dist/agent-docs/components/Button.md +131 -129
  16. package/dist/agent-docs/components/Card.md +172 -147
  17. package/dist/agent-docs/components/Carousel.md +148 -129
  18. package/dist/agent-docs/components/Chat.md +121 -109
  19. package/dist/agent-docs/components/ChatMessage.md +72 -61
  20. package/dist/agent-docs/components/Checkbox.md +150 -135
  21. package/dist/agent-docs/components/CircularProgress.md +53 -49
  22. package/dist/agent-docs/components/CodeHighlighter.md +4 -4
  23. package/dist/agent-docs/components/Collapsible.md +114 -95
  24. package/dist/agent-docs/components/Command.md +141 -142
  25. package/dist/agent-docs/components/Confirmer.md +182 -175
  26. package/dist/agent-docs/components/ContextMenu.md +196 -191
  27. package/dist/agent-docs/components/DataCrossTable.md +114 -94
  28. package/dist/agent-docs/components/DataTable.md +29 -24
  29. package/dist/agent-docs/components/Dialog.md +130 -125
  30. package/dist/agent-docs/components/Drawer.md +141 -127
  31. package/dist/agent-docs/components/FilePreviewer.md +138 -139
  32. package/dist/agent-docs/components/FileUploader.md +143 -129
  33. package/dist/agent-docs/components/Form.md +3 -1
  34. package/dist/agent-docs/components/FormComposer.md +163 -137
  35. package/dist/agent-docs/components/GanttChart.md +125 -122
  36. package/dist/agent-docs/components/HoverCard.md +1 -1
  37. package/dist/agent-docs/components/Icon.md +98 -99
  38. package/dist/agent-docs/components/Input.md +173 -138
  39. package/dist/agent-docs/components/InputOtp.md +6 -1
  40. package/dist/agent-docs/components/InputSelector.md +94 -97
  41. package/dist/agent-docs/components/InterruptPrompt.md +4 -4
  42. package/dist/agent-docs/components/MarkdownRenderer.md +5 -2
  43. package/dist/agent-docs/components/Menubar.md +60 -57
  44. package/dist/agent-docs/components/MessageInput.md +134 -131
  45. package/dist/agent-docs/components/MessageList.md +110 -96
  46. package/dist/agent-docs/components/MultipleSelector.md +147 -146
  47. package/dist/agent-docs/components/NavigationMenu.md +6 -2
  48. package/dist/agent-docs/components/Popover.md +112 -103
  49. package/dist/agent-docs/components/PromptSuggestions.md +5 -5
  50. package/dist/agent-docs/components/RadioGroup.md +97 -90
  51. package/dist/agent-docs/components/Resizable.md +4 -1
  52. package/dist/agent-docs/components/ResizePrompt.md +12 -13
  53. package/dist/agent-docs/components/ScrollArea.md +6 -2
  54. package/dist/agent-docs/components/SecurePdfViewer.md +10 -6
  55. package/dist/agent-docs/components/Select.md +131 -132
  56. package/dist/agent-docs/components/Sheet.md +8 -1
  57. package/dist/agent-docs/components/ShikiHighlighter.md +5 -5
  58. package/dist/agent-docs/components/Sidebar.md +94 -85
  59. package/dist/agent-docs/components/Slider.md +62 -58
  60. package/dist/agent-docs/components/Sonner.md +1 -0
  61. package/dist/agent-docs/components/Spinner.md +14 -14
  62. package/dist/agent-docs/components/Stepper.md +93 -67
  63. package/dist/agent-docs/components/Switch.md +41 -42
  64. package/dist/agent-docs/components/TableSkeleton.md +8 -8
  65. package/dist/agent-docs/components/Tabs.md +106 -86
  66. package/dist/agent-docs/components/TextArea.md +51 -52
  67. package/dist/agent-docs/components/ThemeSwitcher.md +72 -69
  68. package/dist/agent-docs/components/Toaster.md +1 -0
  69. package/dist/agent-docs/components/Tooltip.md +102 -91
  70. package/dist/agent-docs/components/Typo.md +68 -65
  71. package/dist/agent-docs/components/WeeklyCalendar.md +63 -64
  72. package/dist/agent-docs/manifest.json +5979 -0
  73. package/dist/components/editor/editor-hooks/use-update-toolbar.js +6 -6
  74. package/dist/components/editor/plugins/actions/counter-character-plugin.js +6 -6
  75. package/dist/components/editor/plugins/toolbar/font-format-toolbar-plugin.js +18 -18
  76. package/dist/components/editor/plugins/toolbar/history-toolbar-plugin.js +10 -10
  77. package/dist/components/editor/plugins/toolbar/toolbar-plugin.js +9 -9
  78. package/dist/components/ui/app-checkbox.js +1 -1
  79. package/dist/components/ui/app-dialog.js +70 -64
  80. package/dist/components/ui/app-editor.js +51 -51
  81. package/dist/components/ui/app-form.js +81 -81
  82. package/dist/components/ui/app-multiple-select-dropdown.js +36 -36
  83. package/dist/components/ui/app-select.js +109 -104
  84. package/dist/components/ui/app-sidebar.js +41 -41
  85. package/dist/components/ui/app-stepper.js +1 -1
  86. package/dist/components/ui/app-time-picker.js +18 -18
  87. package/dist/components/ui/app-tooltip.js +1 -1
  88. package/dist/components/ui/async-select.js +5 -5
  89. package/dist/components/ui/audio-visualizer.js +61 -58
  90. package/dist/components/ui/card.js +1 -1
  91. package/dist/components/ui/carousel.js +2 -2
  92. package/dist/components/ui/chart.js +1 -1
  93. package/dist/components/ui/chat-message.js +8 -8
  94. package/dist/components/ui/chat.js +86 -88
  95. package/dist/components/ui/command.js +2 -2
  96. package/dist/components/ui/copy-button.js +4 -4
  97. package/dist/components/ui/date-picker.js +20 -20
  98. package/dist/components/ui/file-preview/index.js +13 -13
  99. package/dist/components/ui/file-previewer.js +12 -11
  100. package/dist/components/ui/form.js +2 -2
  101. package/dist/components/ui/gantt/components/Chart/Bars/Bars.js +56 -56
  102. package/dist/components/ui/gantt/components/Chart/Bars/BarsRow/BarItem/BarItem.js +12 -12
  103. package/dist/components/ui/gantt/components/Chart/Bars/BarsRow/BarsItems/BarItems.js +1 -1
  104. package/dist/components/ui/gantt/components/Chart/Bars/BarsRow/BarsRow.js +4 -4
  105. package/dist/components/ui/gantt/components/Chart/Bars/BarsRow/RepeteadBars/RepeteadBars.js +2 -2
  106. package/dist/components/ui/gantt/components/Chart/Chart.js +23 -23
  107. package/dist/components/ui/gantt/components/Chart/Scale/Scale.js +1 -1
  108. package/dist/components/ui/gantt/components/Chart/Tree/Tree.js +34 -34
  109. package/dist/components/ui/gantt/components/Controls/Controls.js +5 -5
  110. package/dist/components/ui/gantt/components/Gantt/Gantt.js +4 -4
  111. package/dist/components/ui/gantt/hooks/useGanttCalculate.js +25 -18
  112. package/dist/components/ui/input-selector.js +1 -1
  113. package/dist/components/ui/input.js +23 -23
  114. package/dist/components/ui/kanban.js +8 -9
  115. package/dist/components/ui/markdown-renderer.js +41 -35
  116. package/dist/components/ui/message-input.js +45 -44
  117. package/dist/components/ui/multiple-selector.js +91 -82
  118. package/dist/components/ui/secure-pdf-viewer.js +19 -7
  119. package/dist/components/ui/sidebar.js +1 -1
  120. package/dist/components/ui/slider.js +1 -1
  121. package/dist/components/ui/spinner.js +4 -4
  122. package/dist/components/ui/stepper.js +157 -138
  123. package/dist/components/ui/tables/data-cross-table/data-cross-table-buttons.js +29 -29
  124. package/dist/components/ui/tables/data-cross-table/data-cross-table.js +258 -246
  125. package/dist/components/ui/tables/data-table/components/data-table-advanced-filter.js +4 -1
  126. package/dist/components/ui/tables/data-table/components/data-table-body.js +204 -368
  127. package/dist/components/ui/tables/data-table/components/data-table-filter-inputs.js +114 -112
  128. package/dist/components/ui/tables/data-table/components/data-table-filters.js +116 -96
  129. package/dist/components/ui/tables/data-table/components/data-table-header.js +210 -0
  130. package/dist/components/ui/tables/data-table/components/data-table-searchbar.js +8 -8
  131. package/dist/components/ui/tables/data-table/components/data-table-skeleton-rows.js +33 -0
  132. package/dist/components/ui/tables/data-table/data-table.js +256 -250
  133. package/dist/components/ui/tables/data-table/data-table.service.js +112 -97
  134. package/dist/components/ui/tables/data-table/data-table.utils.js +2 -0
  135. package/dist/components/ui/textarea.js +2 -2
  136. package/dist/components/ui/theme-switcher.js +1 -1
  137. package/dist/components/ui/toggle-group.js +2 -2
  138. package/dist/components/ui/weekly-calendar/appointment-card.js +16 -16
  139. package/dist/components/ui/weekly-calendar/calendar-context.js +6 -6
  140. package/dist/components/ui/weekly-calendar/calendar-header.js +12 -12
  141. package/dist/components/ui/weekly-calendar/day-column.js +16 -16
  142. package/dist/components/ui/weekly-calendar/time-column.js +4 -4
  143. package/dist/components/ui/weekly-calendar/weekly-calendar.js +4 -4
  144. package/dist/hooks/use-audio-recording.js +1 -1
  145. package/dist/hooks/use-auto-scroll.js +18 -18
  146. package/dist/hooks/use-autosize-textarea.js +12 -13
  147. package/dist/index.d.ts +67 -43
  148. package/dist/index.js +229 -229
  149. package/dist/lib/utils.js +6 -6
  150. package/dist/styles.v3.css +1 -1
  151. 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 | 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. |
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 { Accordion, AccordionItem, AccordionTrigger, AccordionContent } from "laif-ds";
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 { Accordion, AccordionItem, AccordionTrigger, AccordionContent } from "laif-ds";
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 { Accordion, AccordionItem, AccordionTrigger, AccordionContent } from "laif-ds";
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 type="multiple" defaultValue={["item-1", "item-3"]} className="w-96">
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>This section is also open by default.</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 { Accordion, AccordionItem, AccordionTrigger, AccordionContent } from "laif-ds";
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 type="single" value={open} onValueChange={(v) => setOpen(v as string)} className="w-96">
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
- # 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>
46
- This is a default alert message.
47
- </AlertDescription>
48
- </Alert>
49
- );
50
- }
51
- ```
52
-
53
- ### With Icon
54
-
55
- ```tsx
56
- import { Alert, AlertTitle, AlertDescription, Icon } from "laif-ds";
57
-
58
- export function AlertWithIcon() {
59
- return (
60
- <Alert>
61
- <Icon name="Info" />
62
- <AlertTitle>Information</AlertTitle>
63
- <AlertDescription>
64
- This alert includes an icon.
65
- </AlertDescription>
66
- </Alert>
67
- );
68
- }
69
- ```
70
-
71
- ### Destructive
72
-
73
- ```tsx
74
- import { Alert, AlertTitle, AlertDescription } from "laif-ds";
75
-
76
- export function DestructiveAlert() {
77
- return (
78
- <Alert variant="destructive">
79
- <AlertTitle>Error</AlertTitle>
80
- <AlertDescription>
81
- Something went wrong. Please try again.
82
- </AlertDescription>
83
- </Alert>
84
- );
85
- }
86
- ```
87
-
88
- ---
89
-
90
- ## Notes
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
- # 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 account and remove your data from our servers.
68
- </AlertDialogDescription>
69
- </AlertDialogHeader>
70
- <AlertDialogFooter>
71
- <AlertDialogCancel>Cancel</AlertDialogCancel>
72
- <AlertDialogAction>Continue</AlertDialogAction>
73
- </AlertDialogFooter>
74
- </AlertDialogContent>
75
- </AlertDialog>
76
- );
77
- }
78
- ```
79
-
80
- ### Controlled
81
-
82
- ```tsx
83
- import { useState } from "react";
84
- import {
85
- AlertDialog,
86
- AlertDialogAction,
87
- AlertDialogCancel,
88
- AlertDialogContent,
89
- AlertDialogDescription,
90
- AlertDialogFooter,
91
- AlertDialogHeader,
92
- AlertDialogTitle,
93
- } from "laif-ds";
94
- import { Button } from "laif-ds";
95
-
96
- export function ControlledAlertDialog() {
97
- const [open, setOpen] = useState(false);
98
-
99
- return (
100
- <>
101
- <Button onClick={() => setOpen(true)}>Open dialog</Button>
102
- <AlertDialog open={open} onOpenChange={setOpen}>
103
- <AlertDialogContent>
104
- <AlertDialogHeader>
105
- <AlertDialogTitle>Confirm action</AlertDialogTitle>
106
- <AlertDialogDescription>Are you sure you want to proceed?</AlertDialogDescription>
107
- </AlertDialogHeader>
108
- <AlertDialogFooter>
109
- <AlertDialogCancel onClick={() => setOpen(false)}>Cancel</AlertDialogCancel>
110
- <AlertDialogAction onClick={() => setOpen(false)}>Confirm</AlertDialogAction>
111
- </AlertDialogFooter>
112
- </AlertDialogContent>
113
- </AlertDialog>
114
- </>
115
- );
116
- }
117
- ```
118
-
119
- ---
120
-
121
- ## Notes
122
-
123
- - **Styling**: `AlertDialogContent` is centered and responsive; customize with `className`.
124
- - **Overlay**: `AlertDialogOverlay` provides a backdrop with fade animations.
125
- - **Buttons**: `AlertDialogAction` uses default button styles; pass `className` to adjust.
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.