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.
- package/dist/CHANGELOG.md +446 -0
- package/dist/agent-docs/adoption-report.json +615 -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 +32 -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 +149 -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/components-list.md +1 -0
- package/dist/agent-docs/manifest.json +5981 -0
- package/dist/agent-docs/truncated-cell.md +342 -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/file-uploader.js +86 -78
- 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 +211 -367
- 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 +211 -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 +258 -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 +25 -15
- 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/truncated-cell.js +100 -0
- 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 +100 -45
- package/dist/index.js +362 -360
- package/dist/lib/utils.js +6 -6
- package/dist/styles.v3.css +1 -1
- package/package.json +14 -4
|
@@ -1,147 +1,172 @@
|
|
|
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
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
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
|
-
|
|
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
|
-
|
|
127
|
-
-
|
|
128
|
-
|
|
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.
|