laif-ds 0.2.74 → 0.2.76

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 (155) hide show
  1. package/dist/CHANGELOG.md +446 -0
  2. package/dist/agent-docs/adoption-report.json +615 -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 +32 -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 +149 -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/components-list.md +1 -0
  73. package/dist/agent-docs/manifest.json +5981 -0
  74. package/dist/agent-docs/truncated-cell.md +342 -0
  75. package/dist/components/editor/editor-hooks/use-update-toolbar.js +6 -6
  76. package/dist/components/editor/plugins/actions/counter-character-plugin.js +6 -6
  77. package/dist/components/editor/plugins/toolbar/font-format-toolbar-plugin.js +18 -18
  78. package/dist/components/editor/plugins/toolbar/history-toolbar-plugin.js +10 -10
  79. package/dist/components/editor/plugins/toolbar/toolbar-plugin.js +9 -9
  80. package/dist/components/ui/app-checkbox.js +1 -1
  81. package/dist/components/ui/app-dialog.js +70 -64
  82. package/dist/components/ui/app-editor.js +51 -51
  83. package/dist/components/ui/app-form.js +81 -81
  84. package/dist/components/ui/app-multiple-select-dropdown.js +36 -36
  85. package/dist/components/ui/app-select.js +109 -104
  86. package/dist/components/ui/app-sidebar.js +41 -41
  87. package/dist/components/ui/app-stepper.js +1 -1
  88. package/dist/components/ui/app-time-picker.js +18 -18
  89. package/dist/components/ui/app-tooltip.js +1 -1
  90. package/dist/components/ui/async-select.js +5 -5
  91. package/dist/components/ui/audio-visualizer.js +61 -58
  92. package/dist/components/ui/card.js +1 -1
  93. package/dist/components/ui/carousel.js +2 -2
  94. package/dist/components/ui/chart.js +1 -1
  95. package/dist/components/ui/chat-message.js +8 -8
  96. package/dist/components/ui/chat.js +86 -88
  97. package/dist/components/ui/command.js +2 -2
  98. package/dist/components/ui/copy-button.js +4 -4
  99. package/dist/components/ui/date-picker.js +20 -20
  100. package/dist/components/ui/file-preview/index.js +13 -13
  101. package/dist/components/ui/file-previewer.js +12 -11
  102. package/dist/components/ui/file-uploader.js +86 -78
  103. package/dist/components/ui/form.js +2 -2
  104. package/dist/components/ui/gantt/components/Chart/Bars/Bars.js +56 -56
  105. package/dist/components/ui/gantt/components/Chart/Bars/BarsRow/BarItem/BarItem.js +12 -12
  106. package/dist/components/ui/gantt/components/Chart/Bars/BarsRow/BarsItems/BarItems.js +1 -1
  107. package/dist/components/ui/gantt/components/Chart/Bars/BarsRow/BarsRow.js +4 -4
  108. package/dist/components/ui/gantt/components/Chart/Bars/BarsRow/RepeteadBars/RepeteadBars.js +2 -2
  109. package/dist/components/ui/gantt/components/Chart/Chart.js +23 -23
  110. package/dist/components/ui/gantt/components/Chart/Scale/Scale.js +1 -1
  111. package/dist/components/ui/gantt/components/Chart/Tree/Tree.js +34 -34
  112. package/dist/components/ui/gantt/components/Controls/Controls.js +5 -5
  113. package/dist/components/ui/gantt/components/Gantt/Gantt.js +4 -4
  114. package/dist/components/ui/gantt/hooks/useGanttCalculate.js +25 -18
  115. package/dist/components/ui/input-selector.js +1 -1
  116. package/dist/components/ui/input.js +23 -23
  117. package/dist/components/ui/kanban.js +8 -9
  118. package/dist/components/ui/markdown-renderer.js +41 -35
  119. package/dist/components/ui/message-input.js +45 -44
  120. package/dist/components/ui/multiple-selector.js +91 -82
  121. package/dist/components/ui/secure-pdf-viewer.js +19 -7
  122. package/dist/components/ui/sidebar.js +1 -1
  123. package/dist/components/ui/slider.js +1 -1
  124. package/dist/components/ui/spinner.js +4 -4
  125. package/dist/components/ui/stepper.js +157 -138
  126. package/dist/components/ui/tables/data-cross-table/data-cross-table-buttons.js +29 -29
  127. package/dist/components/ui/tables/data-cross-table/data-cross-table.js +258 -246
  128. package/dist/components/ui/tables/data-table/components/data-table-advanced-filter.js +4 -1
  129. package/dist/components/ui/tables/data-table/components/data-table-body.js +211 -367
  130. package/dist/components/ui/tables/data-table/components/data-table-filter-inputs.js +114 -112
  131. package/dist/components/ui/tables/data-table/components/data-table-filters.js +116 -96
  132. package/dist/components/ui/tables/data-table/components/data-table-header.js +211 -0
  133. package/dist/components/ui/tables/data-table/components/data-table-searchbar.js +8 -8
  134. package/dist/components/ui/tables/data-table/components/data-table-skeleton-rows.js +33 -0
  135. package/dist/components/ui/tables/data-table/data-table.js +258 -250
  136. package/dist/components/ui/tables/data-table/data-table.service.js +112 -97
  137. package/dist/components/ui/tables/data-table/data-table.utils.js +25 -15
  138. package/dist/components/ui/textarea.js +2 -2
  139. package/dist/components/ui/theme-switcher.js +1 -1
  140. package/dist/components/ui/toggle-group.js +2 -2
  141. package/dist/components/ui/truncated-cell.js +100 -0
  142. package/dist/components/ui/weekly-calendar/appointment-card.js +16 -16
  143. package/dist/components/ui/weekly-calendar/calendar-context.js +6 -6
  144. package/dist/components/ui/weekly-calendar/calendar-header.js +12 -12
  145. package/dist/components/ui/weekly-calendar/day-column.js +16 -16
  146. package/dist/components/ui/weekly-calendar/time-column.js +4 -4
  147. package/dist/components/ui/weekly-calendar/weekly-calendar.js +4 -4
  148. package/dist/hooks/use-audio-recording.js +1 -1
  149. package/dist/hooks/use-auto-scroll.js +18 -18
  150. package/dist/hooks/use-autosize-textarea.js +12 -13
  151. package/dist/index.d.ts +100 -45
  152. package/dist/index.js +362 -360
  153. package/dist/lib/utils.js +6 -6
  154. package/dist/styles.v3.css +1 -1
  155. package/package.json +14 -4
@@ -1,147 +1,172 @@
1
- # Card
2
-
3
- ## Overview
4
-
5
- Composable container with header, content, footer, and optional action area. Supports size variants that control internal padding and spacing.
6
-
7
- ---
8
-
9
- ## Props
10
-
11
- ### Card (Root)
12
-
13
- | Prop | Type | Default | Description |
14
- | ----------- | ----------------------------- | ----------- | -------------------------------------------- |
15
- | `size` | `"default" | "sm" | "lg" | "none"` | `"default"` | Controls internal padding and spacing. |
16
- | `className` | `string` | `""` | Additional classes for layout and width. |
17
- | `children` | `React.ReactNode` | **required**| Compose with subcomponents below. |
18
-
19
- ### Subcomponents
20
-
21
- - `CardHeader`: Top section, usually with `CardTitle`, `CardDescription`, and optional `CardAction`.
22
- - `CardTitle`: Title text area.
23
- - `CardDescription`: Secondary text under the title.
24
- - `CardAction`: Right-aligned area inside the header for buttons/menus.
25
- - `CardContent`: Main content area.
26
- - `CardFooter`: Bottom area for actions or summaries.
27
-
28
- ---
29
-
30
- ## Behavior
31
-
32
- - **Size variants**: `sm`, `default`, `lg`, `none` change vertical padding and gaps.
33
- - **Header/Footer borders**: Apply border utilities on header/footer to create separators.
34
- - **Layout**: Use `className` for width and responsive behavior.
35
-
36
- ---
37
-
38
- ## Examples
39
-
40
- ### Basic
41
-
42
- ```tsx
43
- import { Card, CardHeader, CardTitle, CardDescription, CardContent, CardFooter } from "laif-ds";
44
- import { Button } from "laif-ds";
45
-
46
- export function BasicCard() {
47
- return (
48
- <Card className="w-[350px]">
49
- <CardHeader>
50
- <CardTitle>Card Title</CardTitle>
51
- <CardDescription>Card description goes here</CardDescription>
52
- </CardHeader>
53
- <CardContent>
54
- <p>This is the main content of the card. You can put any content here.</p>
55
- </CardContent>
56
- <CardFooter>
57
- <Button>Action</Button>
58
- </CardFooter>
59
- </Card>
60
- );
61
- }
62
- ```
63
-
64
- ### With Action
65
-
66
- ```tsx
67
- import { Card, CardHeader, CardTitle, CardDescription, CardAction, CardContent } from "laif-ds";
68
- import { Button } from "laif-ds";
69
-
70
- export function CardWithAction() {
71
- return (
72
- <Card className="w-[350px]">
73
- <CardHeader>
74
- <CardTitle>Card with Action</CardTitle>
75
- <CardDescription>Card with an action button in the header</CardDescription>
76
- <CardAction>
77
- <Button variant="ghost" size="icon">⋯</Button>
78
- </CardAction>
79
- </CardHeader>
80
- <CardContent>
81
- <p>This card has an action button in the top right corner.</p>
82
- </CardContent>
83
- </Card>
84
- );
85
- }
86
- ```
87
-
88
- ### Size Variants
89
-
90
- ```tsx
91
- import { Card, CardHeader, CardTitle, CardDescription, CardContent } from "laif-ds";
92
-
93
- export function SizeVariants() {
94
- return (
95
- <div className="flex flex-col gap-8">
96
- <Card size="sm" className="w-[350px]">
97
- <CardHeader>
98
- <CardTitle>Size: Small</CardTitle>
99
- <CardDescription>Reduced padding (sm)</CardDescription>
100
- </CardHeader>
101
- <CardContent>
102
- <p>This card uses size="sm".</p>
103
- </CardContent>
104
- </Card>
105
-
106
- <Card size="default" className="w-[350px]">
107
- <CardHeader>
108
- <CardTitle>Size: Default</CardTitle>
109
- <CardDescription>Standard padding (default)</CardDescription>
110
- </CardHeader>
111
- <CardContent>
112
- <p>This card uses size="default".</p>
113
- </CardContent>
114
- </Card>
115
-
116
- <Card size="lg" className="w-[350px]">
117
- <CardHeader>
118
- <CardTitle>Size: Large</CardTitle>
119
- <CardDescription>Spacious padding (lg)</CardDescription>
120
- </CardHeader>
121
- <CardContent>
122
- <p>This card uses size="lg".</p>
123
- </CardContent>
124
- </Card>
125
-
126
- <Card size="none" className="w-[350px]">
127
- <CardHeader className="border-d-border border-b p-4">
128
- <CardTitle>Size: None</CardTitle>
129
- <CardDescription>No default padding (none)</CardDescription>
130
- </CardHeader>
131
- <CardContent className="p-4">
132
- <p>This card uses size="none" with custom padding.</p>
133
- </CardContent>
134
- </Card>
135
- </div>
136
- );
137
- }
138
- ```
139
-
140
- ---
141
-
142
- ## Notes
143
-
144
- - **Composability**: Use only the subcomponents you need.
145
- - **Borders**: Add `border-b`/`border-t` to header/footer for separation.
146
- - **Action area**: `CardAction` aligns content to the top-right in the header.
147
-
1
+ # Card
2
+
3
+ ## Overview
4
+
5
+ Composable container with header, content, footer, and optional action area. Supports size variants that control internal padding and spacing.
6
+
7
+ ---
8
+
9
+ ## Props
10
+
11
+ ### Card (Root)
12
+
13
+ | Prop | Type | Default | Description |
14
+ | ----------- | ----------------- | ------------ | ---------------------------------------- | ------- | ----------- | -------------------------------------- |
15
+ | `size` | `"default" | "sm" | "lg" | "none"` | `"default"` | Controls internal padding and spacing. |
16
+ | `className` | `string` | `""` | Additional classes for layout and width. |
17
+ | `children` | `React.ReactNode` | **required** | Compose with subcomponents below. |
18
+
19
+ ### Subcomponents
20
+
21
+ - `CardHeader`: Top section, usually with `CardTitle`, `CardDescription`, and optional `CardAction`.
22
+ - `CardTitle`: Title text area.
23
+ - `CardDescription`: Secondary text under the title.
24
+ - `CardAction`: Right-aligned area inside the header for buttons/menus.
25
+ - `CardContent`: Main content area.
26
+ - `CardFooter`: Bottom area for actions or summaries.
27
+
28
+ ---
29
+
30
+ ## Behavior
31
+
32
+ - **Size variants**: `sm`, `default`, `lg`, `none` change vertical padding and gaps.
33
+ - **Header/Footer borders**: Apply border utilities on header/footer to create separators.
34
+ - **Layout**: Use `className` for width and responsive behavior.
35
+
36
+ ---
37
+
38
+ ## Examples
39
+
40
+ ### Basic
41
+
42
+ ```tsx
43
+ import {
44
+ Card,
45
+ CardHeader,
46
+ CardTitle,
47
+ CardDescription,
48
+ CardContent,
49
+ CardFooter,
50
+ } from "laif-ds";
51
+ import { Button } from "laif-ds";
52
+
53
+ export function BasicCard() {
54
+ return (
55
+ <Card className="w-[350px]">
56
+ <CardHeader>
57
+ <CardTitle>Card Title</CardTitle>
58
+ <CardDescription>Card description goes here</CardDescription>
59
+ </CardHeader>
60
+ <CardContent>
61
+ <p>
62
+ This is the main content of the card. You can put any content here.
63
+ </p>
64
+ </CardContent>
65
+ <CardFooter>
66
+ <Button>Action</Button>
67
+ </CardFooter>
68
+ </Card>
69
+ );
70
+ }
71
+ ```
72
+
73
+ ### With Action
74
+
75
+ ```tsx
76
+ import {
77
+ Card,
78
+ CardHeader,
79
+ CardTitle,
80
+ CardDescription,
81
+ CardAction,
82
+ CardContent,
83
+ } from "laif-ds";
84
+ import { Button } from "laif-ds";
85
+
86
+ export function CardWithAction() {
87
+ return (
88
+ <Card className="w-[350px]">
89
+ <CardHeader>
90
+ <CardTitle>Card with Action</CardTitle>
91
+ <CardDescription>
92
+ Card with an action button in the header
93
+ </CardDescription>
94
+ <CardAction>
95
+ <Button variant="ghost" size="icon">
96
+
97
+ </Button>
98
+ </CardAction>
99
+ </CardHeader>
100
+ <CardContent>
101
+ <p>This card has an action button in the top right corner.</p>
102
+ </CardContent>
103
+ </Card>
104
+ );
105
+ }
106
+ ```
107
+
108
+ ### Size Variants
109
+
110
+ ```tsx
111
+ import {
112
+ Card,
113
+ CardHeader,
114
+ CardTitle,
115
+ CardDescription,
116
+ CardContent,
117
+ } from "laif-ds";
118
+
119
+ export function SizeVariants() {
120
+ return (
121
+ <div className="flex flex-col gap-8">
122
+ <Card size="sm" className="w-[350px]">
123
+ <CardHeader>
124
+ <CardTitle>Size: Small</CardTitle>
125
+ <CardDescription>Reduced padding (sm)</CardDescription>
126
+ </CardHeader>
127
+ <CardContent>
128
+ <p>This card uses size="sm".</p>
129
+ </CardContent>
130
+ </Card>
131
+
132
+ <Card size="default" className="w-[350px]">
133
+ <CardHeader>
134
+ <CardTitle>Size: Default</CardTitle>
135
+ <CardDescription>Standard padding (default)</CardDescription>
136
+ </CardHeader>
137
+ <CardContent>
138
+ <p>This card uses size="default".</p>
139
+ </CardContent>
140
+ </Card>
141
+
142
+ <Card size="lg" className="w-[350px]">
143
+ <CardHeader>
144
+ <CardTitle>Size: Large</CardTitle>
145
+ <CardDescription>Spacious padding (lg)</CardDescription>
146
+ </CardHeader>
147
+ <CardContent>
148
+ <p>This card uses size="lg".</p>
149
+ </CardContent>
150
+ </Card>
151
+
152
+ <Card size="none" className="w-[350px]">
153
+ <CardHeader className="border-d-border border-b p-4">
154
+ <CardTitle>Size: None</CardTitle>
155
+ <CardDescription>No default padding (none)</CardDescription>
156
+ </CardHeader>
157
+ <CardContent className="p-4">
158
+ <p>This card uses size="none" with custom padding.</p>
159
+ </CardContent>
160
+ </Card>
161
+ </div>
162
+ );
163
+ }
164
+ ```
165
+
166
+ ---
167
+
168
+ ## Notes
169
+
170
+ - **Composability**: Use only the subcomponents you need.
171
+ - **Borders**: Add `border-b`/`border-t` to header/footer for separation.
172
+ - **Action area**: `CardAction` aligns content to the top-right in the header.
@@ -1,129 +1,148 @@
1
- # Carousel
2
-
3
- ## Overview
4
-
5
- A flexible, accessible carousel built on Embla. Supports horizontal/vertical orientation, previous/next controls, keyboard navigation, and responsive layouts.
6
-
7
- ---
8
-
9
- ## Props
10
-
11
- ### Carousel (Root)
12
-
13
- | Prop | Type | Default | Description |
14
- | -------------- | -------------------------------------- | -------------- | -------------------------------------------------- |
15
- | `orientation` | `"horizontal" | "vertical"` | `"horizontal"` | Scroll axis for the carousel. |
16
- | `opts` | `EmblaOptionsType` | `{}` | Embla options (e.g., loop). |
17
- | `plugins` | `EmblaPluginType[]` | `[]` | Embla plugins. |
18
- | `setApi` | `(api: CarouselApi) => void` | `undefined` | Receives the Embla API instance. |
19
- | `className` | `string` | `""` | Additional classes for the container. |
20
- | `children` | `React.ReactNode` | **required** | Compose with subcomponents below. |
21
-
22
- ### Subcomponents
23
-
24
- - `CarouselContent`: Scroll container (wraps slides).
25
- - `CarouselItem`: A single slide.
26
- - `CarouselPrevious`: Previous button (disabled when not scrollable).
27
- - `CarouselNext`: Next button (disabled when not scrollable).
28
-
29
- ---
30
-
31
- ## Behavior
32
-
33
- - **Keyboard**: Left/Right arrows move slides (when horizontal).
34
- - **Controls**: Prev/Next buttons enable/disable based on scroll availability.
35
- - **Orientation**: Vertical orientation rotates controls appropriately.
36
-
37
- ---
38
-
39
- ## Examples
40
-
41
- ### Basic
42
-
43
- ```tsx
44
- import { Carousel, CarouselContent, CarouselItem, CarouselPrevious, CarouselNext } from "laif-ds";
45
- import { Card, CardContent } from "laif-ds";
46
-
47
- export function BasicCarousel() {
48
- return (
49
- <Carousel className="w-full max-w-xs">
50
- <CarouselContent>
51
- {Array.from({ length: 5 }).map((_, index) => (
52
- <CarouselItem key={index}>
53
- <div className="p-1">
54
- <Card>
55
- <CardContent className="flex aspect-square items-center justify-center p-6">
56
- <span className="text-xl font-semibold">{index + 1}</span>
57
- </CardContent>
58
- </Card>
59
- </div>
60
- </CarouselItem>
61
- ))}
62
- </CarouselContent>
63
- <CarouselPrevious />
64
- <CarouselNext />
65
- </Carousel>
66
- );
67
- }
68
- ```
69
-
70
- ### Multiple Items per Row
71
-
72
- ```tsx
73
- import { Carousel, CarouselContent, CarouselItem, CarouselPrevious, CarouselNext } from "laif-ds";
74
- import { Card, CardContent } from "laif-ds";
75
-
76
- export function MultipleItems() {
77
- return (
78
- <Carousel className="w-full max-w-md">
79
- <CarouselContent className="-ml-1">
80
- {Array.from({ length: 10 }).map((_, index) => (
81
- <CarouselItem key={index} className="pl-1 md:basis-1/2 lg:basis-1/3">
82
- <div className="p-1">
83
- <Card>
84
- <CardContent className="flex aspect-square items-center justify-center p-6">
85
- <span className="text-lg font-semibold">{index + 1}</span>
86
- </CardContent>
87
- </Card>
88
- </div>
89
- </CarouselItem>
90
- ))}
91
- </CarouselContent>
92
- <CarouselPrevious />
93
- <CarouselNext />
94
- </Carousel>
95
- );
96
- }
97
- ```
98
-
99
- ### With API (loop)
100
-
101
- ```tsx
102
- import { useState } from "react";
103
- import type { CarouselApi } from "laif-ds";
104
- import { Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious } from "laif-ds";
105
-
106
- export function CarouselWithApi() {
107
- const [api, setApi] = useState<CarouselApi | null>(null);
108
- return (
109
- <Carousel className="w-full max-w-xs" setApi={setApi} opts={{ loop: true }}>
110
- <CarouselContent>
111
- {[1, 2, 3, 4, 5].map((n) => (
112
- <CarouselItem key={n}><div className="p-6">Slide {n}</div></CarouselItem>
113
- ))}
114
- </CarouselContent>
115
- <CarouselPrevious />
116
- <CarouselNext />
117
- </Carousel>
118
- );
119
- }
120
- ```
121
-
122
- ---
123
-
124
- ## Notes
125
-
126
- - **Focus**: The root handles arrow keys via `onKeyDownCapture`.
127
- - **Responsiveness**: Use `basis-*` utilities on `CarouselItem` for multi-column layouts.
128
- - **Plugins**: Pass Embla plugins via `plugins` prop when needed.
129
-
1
+ # Carousel
2
+
3
+ ## Overview
4
+
5
+ A flexible, accessible carousel built on Embla. Supports horizontal/vertical orientation, previous/next controls, keyboard navigation, and responsive layouts.
6
+
7
+ ---
8
+
9
+ ## Props
10
+
11
+ ### Carousel (Root)
12
+
13
+ | Prop | Type | Default | Description |
14
+ | ------------- | ---------------------------- | ------------ | ------------------------------------- | ----------------------------- |
15
+ | `orientation` | `"horizontal" | "vertical"` | `"horizontal"` | Scroll axis for the carousel. |
16
+ | `opts` | `EmblaOptionsType` | `{}` | Embla options (e.g., loop). |
17
+ | `plugins` | `EmblaPluginType[]` | `[]` | Embla plugins. |
18
+ | `setApi` | `(api: CarouselApi) => void` | `undefined` | Receives the Embla API instance. |
19
+ | `className` | `string` | `""` | Additional classes for the container. |
20
+ | `children` | `React.ReactNode` | **required** | Compose with subcomponents below. |
21
+
22
+ ### Subcomponents
23
+
24
+ - `CarouselContent`: Scroll container (wraps slides).
25
+ - `CarouselItem`: A single slide.
26
+ - `CarouselPrevious`: Previous button (disabled when not scrollable).
27
+ - `CarouselNext`: Next button (disabled when not scrollable).
28
+
29
+ ---
30
+
31
+ ## Behavior
32
+
33
+ - **Keyboard**: Left/Right arrows move slides (when horizontal).
34
+ - **Controls**: Prev/Next buttons enable/disable based on scroll availability.
35
+ - **Orientation**: Vertical orientation rotates controls appropriately.
36
+
37
+ ---
38
+
39
+ ## Examples
40
+
41
+ ### Basic
42
+
43
+ ```tsx
44
+ import {
45
+ Carousel,
46
+ CarouselContent,
47
+ CarouselItem,
48
+ CarouselPrevious,
49
+ CarouselNext,
50
+ } from "laif-ds";
51
+ import { Card, CardContent } from "laif-ds";
52
+
53
+ export function BasicCarousel() {
54
+ return (
55
+ <Carousel className="w-full max-w-xs">
56
+ <CarouselContent>
57
+ {Array.from({ length: 5 }).map((_, index) => (
58
+ <CarouselItem key={index}>
59
+ <div className="p-1">
60
+ <Card>
61
+ <CardContent className="flex aspect-square items-center justify-center p-6">
62
+ <span className="text-xl font-semibold">{index + 1}</span>
63
+ </CardContent>
64
+ </Card>
65
+ </div>
66
+ </CarouselItem>
67
+ ))}
68
+ </CarouselContent>
69
+ <CarouselPrevious />
70
+ <CarouselNext />
71
+ </Carousel>
72
+ );
73
+ }
74
+ ```
75
+
76
+ ### Multiple Items per Row
77
+
78
+ ```tsx
79
+ import {
80
+ Carousel,
81
+ CarouselContent,
82
+ CarouselItem,
83
+ CarouselPrevious,
84
+ CarouselNext,
85
+ } from "laif-ds";
86
+ import { Card, CardContent } from "laif-ds";
87
+
88
+ export function MultipleItems() {
89
+ return (
90
+ <Carousel className="w-full max-w-md">
91
+ <CarouselContent className="-ml-1">
92
+ {Array.from({ length: 10 }).map((_, index) => (
93
+ <CarouselItem key={index} className="pl-1 md:basis-1/2 lg:basis-1/3">
94
+ <div className="p-1">
95
+ <Card>
96
+ <CardContent className="flex aspect-square items-center justify-center p-6">
97
+ <span className="text-lg font-semibold">{index + 1}</span>
98
+ </CardContent>
99
+ </Card>
100
+ </div>
101
+ </CarouselItem>
102
+ ))}
103
+ </CarouselContent>
104
+ <CarouselPrevious />
105
+ <CarouselNext />
106
+ </Carousel>
107
+ );
108
+ }
109
+ ```
110
+
111
+ ### With API (loop)
112
+
113
+ ```tsx
114
+ import { useState } from "react";
115
+ import type { CarouselApi } from "laif-ds";
116
+ import {
117
+ Carousel,
118
+ CarouselContent,
119
+ CarouselItem,
120
+ CarouselNext,
121
+ CarouselPrevious,
122
+ } from "laif-ds";
123
+
124
+ export function CarouselWithApi() {
125
+ const [api, setApi] = useState<CarouselApi | null>(null);
126
+ return (
127
+ <Carousel className="w-full max-w-xs" setApi={setApi} opts={{ loop: true }}>
128
+ <CarouselContent>
129
+ {[1, 2, 3, 4, 5].map((n) => (
130
+ <CarouselItem key={n}>
131
+ <div className="p-6">Slide {n}</div>
132
+ </CarouselItem>
133
+ ))}
134
+ </CarouselContent>
135
+ <CarouselPrevious />
136
+ <CarouselNext />
137
+ </Carousel>
138
+ );
139
+ }
140
+ ```
141
+
142
+ ---
143
+
144
+ ## Notes
145
+
146
+ - **Focus**: The root handles arrow keys via `onKeyDownCapture`.
147
+ - **Responsiveness**: Use `basis-*` utilities on `CarouselItem` for multi-column layouts.
148
+ - **Plugins**: Pass Embla plugins via `plugins` prop when needed.