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,135 +1,150 @@
|
|
|
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
|
-
|
|
1
|
+
# Checkbox
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Accessible checkbox with support for checked, unchecked, and indeterminate states. Keyboard focus styles and disabled state included.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Props
|
|
10
|
+
|
|
11
|
+
### Checkbox (Root)
|
|
12
|
+
|
|
13
|
+
| Prop | Type | Default | Description |
|
|
14
|
+
| ----------------- | ---------------------------- | ----------- | -------------------------------------------- |
|
|
15
|
+
| `checked` | `boolean \| "indeterminate"` | `false` | Current state of the checkbox. |
|
|
16
|
+
| `disabled` | `boolean` | `false` | Disables interactions. |
|
|
17
|
+
| `onCheckedChange` | `(checked: boolean) => void` | `undefined` | Called when the state changes. |
|
|
18
|
+
| `id` | `string` | `undefined` | Useful when paired with a label's `htmlFor`. |
|
|
19
|
+
| `className` | `string` | `""` | Additional classes for size/layout. |
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## Behavior
|
|
24
|
+
|
|
25
|
+
- **Indeterminate**: Use `checked="indeterminate"` to display a dash indicator.
|
|
26
|
+
- **Focus & invalid**: Visual feedback for focus and invalid states is included.
|
|
27
|
+
- **Labeling**: Pair with `Label` and `htmlFor` for accessible labeling.
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## Examples
|
|
32
|
+
|
|
33
|
+
### Default
|
|
34
|
+
|
|
35
|
+
```tsx
|
|
36
|
+
import { Checkbox } from "laif-ds";
|
|
37
|
+
import { Label } from "laif-ds";
|
|
38
|
+
|
|
39
|
+
export function DefaultCheckbox() {
|
|
40
|
+
return (
|
|
41
|
+
<div className="flex items-center gap-2">
|
|
42
|
+
<Checkbox id="terms" />
|
|
43
|
+
<Label htmlFor="terms">Accept terms and conditions</Label>
|
|
44
|
+
</div>
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Indeterminate
|
|
50
|
+
|
|
51
|
+
```tsx
|
|
52
|
+
import { Checkbox } from "laif-ds";
|
|
53
|
+
import { Label } from "laif-ds";
|
|
54
|
+
|
|
55
|
+
export function IndeterminateCheckbox() {
|
|
56
|
+
return (
|
|
57
|
+
<div className="flex items-center gap-2">
|
|
58
|
+
<Checkbox id="partial" checked="indeterminate" />
|
|
59
|
+
<Label htmlFor="partial">Partially selected options</Label>
|
|
60
|
+
</div>
|
|
61
|
+
);
|
|
62
|
+
}
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Disabled
|
|
66
|
+
|
|
67
|
+
```tsx
|
|
68
|
+
import { Checkbox } from "laif-ds";
|
|
69
|
+
import { Label } from "laif-ds";
|
|
70
|
+
|
|
71
|
+
export function DisabledCheckbox() {
|
|
72
|
+
return (
|
|
73
|
+
<div className="flex items-center gap-2">
|
|
74
|
+
<Checkbox id="disabled" disabled />
|
|
75
|
+
<Label htmlFor="disabled">Accept terms and conditions</Label>
|
|
76
|
+
</div>
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Select All Pattern
|
|
82
|
+
|
|
83
|
+
```tsx
|
|
84
|
+
import * as React from "react";
|
|
85
|
+
import { Checkbox } from "laif-ds";
|
|
86
|
+
import { Label } from "laif-ds";
|
|
87
|
+
|
|
88
|
+
export function SelectAllExample() {
|
|
89
|
+
const [items, setItems] = React.useState([
|
|
90
|
+
{ id: "item1", label: "Item 1", checked: false },
|
|
91
|
+
{ id: "item2", label: "Item 2", checked: true },
|
|
92
|
+
{ id: "item3", label: "Item 3", checked: false },
|
|
93
|
+
]);
|
|
94
|
+
|
|
95
|
+
const checkedCount = items.filter((i) => i.checked).length;
|
|
96
|
+
const selectAllState =
|
|
97
|
+
checkedCount === 0
|
|
98
|
+
? false
|
|
99
|
+
: checkedCount === items.length
|
|
100
|
+
? true
|
|
101
|
+
: ("indeterminate" as const);
|
|
102
|
+
|
|
103
|
+
const handleSelectAll = () => {
|
|
104
|
+
const newChecked = selectAllState !== true;
|
|
105
|
+
setItems(items.map((i) => ({ ...i, checked: newChecked })));
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
return (
|
|
109
|
+
<div className="space-y-4">
|
|
110
|
+
<div className="flex items-center gap-2 border-b pb-2">
|
|
111
|
+
<Checkbox
|
|
112
|
+
id="select-all"
|
|
113
|
+
checked={selectAllState}
|
|
114
|
+
onCheckedChange={handleSelectAll}
|
|
115
|
+
/>
|
|
116
|
+
<Label htmlFor="select-all">
|
|
117
|
+
Select All ({checkedCount}/{items.length})
|
|
118
|
+
</Label>
|
|
119
|
+
</div>
|
|
120
|
+
<div className="space-y-2 pl-6">
|
|
121
|
+
{items.map((item) => (
|
|
122
|
+
<div key={item.id} className="flex items-center gap-2">
|
|
123
|
+
<Checkbox
|
|
124
|
+
id={item.id}
|
|
125
|
+
checked={item.checked}
|
|
126
|
+
onCheckedChange={(checked) =>
|
|
127
|
+
setItems(
|
|
128
|
+
items.map((i) =>
|
|
129
|
+
i.id === item.id
|
|
130
|
+
? { ...i, checked: checked as boolean }
|
|
131
|
+
: i,
|
|
132
|
+
),
|
|
133
|
+
)
|
|
134
|
+
}
|
|
135
|
+
/>
|
|
136
|
+
<Label htmlFor={item.id}>{item.label}</Label>
|
|
137
|
+
</div>
|
|
138
|
+
))}
|
|
139
|
+
</div>
|
|
140
|
+
</div>
|
|
141
|
+
);
|
|
142
|
+
}
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
---
|
|
146
|
+
|
|
147
|
+
## Notes
|
|
148
|
+
|
|
149
|
+
- **Indicator**: A check icon is shown when `checked=true`, a dash for indeterminate.
|
|
150
|
+
- **Disabled**: Applies reduced opacity and disables pointer events.
|
|
@@ -1,49 +1,53 @@
|
|
|
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
|
-
|
|
1
|
+
# CircularProgress
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
SVG-based circular progress with customizable size, stroke widths, end-cap shape, and optional centered label.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Props
|
|
10
|
+
|
|
11
|
+
| Prop | Type | Default | Description |
|
|
12
|
+
| --------------------- | ----------------------------- | ------------ | ------------------------------------------------- | ---------------------- |
|
|
13
|
+
| `value` | `number` | **required** | Percentage [0-100]. |
|
|
14
|
+
| `renderLabel` | `(progress: number) => number | string` | `undefined` | Custom label renderer. |
|
|
15
|
+
| `size` | `number` | `100` | Diameter in px. |
|
|
16
|
+
| `strokeWidth` | `number` | `undefined` | Overrides both circle and progress stroke widths. |
|
|
17
|
+
| `circleStrokeWidth` | `number` | `10` | Base circle stroke width. |
|
|
18
|
+
| `progressStrokeWidth` | `number` | `10` | Progress stroke width. |
|
|
19
|
+
| `shape` | `"square" | "round"` | `"round"` | Stroke line cap. |
|
|
20
|
+
| `className` | `string` | `undefined` | Base circle classes. |
|
|
21
|
+
| `progressClassName` | `string` | `undefined` | Progress circle classes. |
|
|
22
|
+
| `labelClassName` | `string` | `undefined` | Center label classes. |
|
|
23
|
+
| `showLabel` | `boolean` | `false` | Show `{value}` (or `renderLabel(value)`) inside. |
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## Examples
|
|
28
|
+
|
|
29
|
+
```tsx
|
|
30
|
+
import { CircularProgress } from "laif-ds";
|
|
31
|
+
|
|
32
|
+
export function Basic() {
|
|
33
|
+
return <CircularProgress value={65} size={100} showLabel />;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export function CustomLabel() {
|
|
37
|
+
return (
|
|
38
|
+
<CircularProgress
|
|
39
|
+
value={42}
|
|
40
|
+
size={120}
|
|
41
|
+
showLabel
|
|
42
|
+
renderLabel={(v) => `${v}%`}
|
|
43
|
+
/>
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## Notes
|
|
51
|
+
|
|
52
|
+
- **Theming**: Base circle uses `stroke-d-primary/25`; progress uses `stroke-d-primary`.
|
|
53
|
+
- **Performance**: Pure SVG; safe to animate via CSS if needed.
|
|
@@ -8,10 +8,10 @@ Client-side code highlighter using Shiki with internal loading state and gracefu
|
|
|
8
8
|
|
|
9
9
|
## Props
|
|
10
10
|
|
|
11
|
-
| Prop
|
|
12
|
-
|
|
|
13
|
-
| `children`
|
|
14
|
-
| `language`
|
|
11
|
+
| Prop | Type | Description |
|
|
12
|
+
| ----------- | -------- | ---------------------------- |
|
|
13
|
+
| `children` | `string` | Code string |
|
|
14
|
+
| `language` | `string` | Shiki language key |
|
|
15
15
|
| `className` | `string` | Optional classes for `<pre>` |
|
|
16
16
|
|
|
17
17
|
---
|
|
@@ -1,95 +1,114 @@
|
|
|
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
|
-
|
|
1
|
+
# Collapsible
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
A simple container that can show/hide content. Provides a trigger element and animated content area. Useful for progressive disclosure of details.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Props
|
|
10
|
+
|
|
11
|
+
### Collapsible (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` | Called when open state changes. |
|
|
18
|
+
| `className` | `string` | `""` | Additional classes for the root. |
|
|
19
|
+
|
|
20
|
+
### Subcomponents
|
|
21
|
+
|
|
22
|
+
- `CollapsibleTrigger`: The element that toggles visibility (can be used with `asChild`).
|
|
23
|
+
- `CollapsibleContent`: The collapsible content region.
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## Behavior
|
|
28
|
+
|
|
29
|
+
- **Controlled**: Use `open` + `onOpenChange` to control state.
|
|
30
|
+
- **Uncontrolled**: Use `defaultOpen` for initial state.
|
|
31
|
+
- **Accessibility**: Works with button triggers and keyboard navigation.
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## Examples
|
|
36
|
+
|
|
37
|
+
### Basic
|
|
38
|
+
|
|
39
|
+
```tsx
|
|
40
|
+
import { useState } from "react";
|
|
41
|
+
import { Button } from "laif-ds";
|
|
42
|
+
import { Collapsible, CollapsibleTrigger, CollapsibleContent } from "laif-ds";
|
|
43
|
+
|
|
44
|
+
export function BasicCollapsible() {
|
|
45
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
46
|
+
return (
|
|
47
|
+
<Collapsible
|
|
48
|
+
open={isOpen}
|
|
49
|
+
onOpenChange={setIsOpen}
|
|
50
|
+
className="w-[350px] space-y-2"
|
|
51
|
+
>
|
|
52
|
+
<div className="flex items-center justify-between gap-4 px-4">
|
|
53
|
+
<h4 className="text-sm font-semibold">Details</h4>
|
|
54
|
+
<CollapsibleTrigger asChild>
|
|
55
|
+
<Button variant="ghost" size="sm">
|
|
56
|
+
Toggle
|
|
57
|
+
</Button>
|
|
58
|
+
</CollapsibleTrigger>
|
|
59
|
+
</div>
|
|
60
|
+
<CollapsibleContent className="space-y-2">
|
|
61
|
+
<div className="border-d-border rounded-md border px-4 py-3 text-sm">
|
|
62
|
+
Item A
|
|
63
|
+
</div>
|
|
64
|
+
<div className="border-d-border rounded-md border px-4 py-3 text-sm">
|
|
65
|
+
Item B
|
|
66
|
+
</div>
|
|
67
|
+
<div className="border-d-border rounded-md border px-4 py-3 text-sm">
|
|
68
|
+
Item C
|
|
69
|
+
</div>
|
|
70
|
+
</CollapsibleContent>
|
|
71
|
+
</Collapsible>
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Open by Default
|
|
77
|
+
|
|
78
|
+
```tsx
|
|
79
|
+
import { useState } from "react";
|
|
80
|
+
import { Button } from "laif-ds";
|
|
81
|
+
import { Collapsible, CollapsibleTrigger, CollapsibleContent } from "laif-ds";
|
|
82
|
+
|
|
83
|
+
export function OpenByDefault() {
|
|
84
|
+
const [isOpen, setIsOpen] = useState(true);
|
|
85
|
+
return (
|
|
86
|
+
<Collapsible
|
|
87
|
+
open={isOpen}
|
|
88
|
+
onOpenChange={setIsOpen}
|
|
89
|
+
className="w-[350px] space-y-2"
|
|
90
|
+
>
|
|
91
|
+
<div className="flex items-center justify-between gap-4 px-4">
|
|
92
|
+
<h4 className="text-sm font-semibold">Details</h4>
|
|
93
|
+
<CollapsibleTrigger asChild>
|
|
94
|
+
<Button variant="ghost" size="sm">
|
|
95
|
+
Toggle
|
|
96
|
+
</Button>
|
|
97
|
+
</CollapsibleTrigger>
|
|
98
|
+
</div>
|
|
99
|
+
<CollapsibleContent className="space-y-2">
|
|
100
|
+
<div className="rounded-md border px-4 py-3 text-sm">
|
|
101
|
+
This is additional information.
|
|
102
|
+
</div>
|
|
103
|
+
</CollapsibleContent>
|
|
104
|
+
</Collapsible>
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
## Notes
|
|
112
|
+
|
|
113
|
+
- **asChild**: Wrap your own button/link as trigger while preserving styles.
|
|
114
|
+
- **Styling**: Use `className` on root/content to adjust spacing and borders.
|