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,77 +1,81 @@
1
- # AppStepper
2
-
3
- ## Overview
4
-
5
- High-level stepper built on `Stepper` primitives. Renders labeled steps with indicators and panels, supports horizontal/vertical layouts, separators, controlled navigation and custom click behavior.
6
-
7
- ---
8
-
9
- ## Props
10
-
11
- | Prop | Type | Default | Description |
12
- | ------------------------ | ------------------------------------------------ | ------------- | ----------- |
13
- | `steps` | `{ id: number; label: ReactNode; component: ReactNode; completed?; disabled?; loading?; }[]` | **required** | Steps to render (id is the step value). |
14
- | `align` | `"horizontal" | "vertical"` | `"horizontal"` | Layout orientation. |
15
- | `size` | `"sm" | "md"` | `"sm"` | Indicator/title sizing. |
16
- | `showSeparators` | `boolean` | `true` | Show separators between steps. |
17
- | `value` | `number` | first step id | Current step value (controlled). |
18
- | `onValueChange` | `(value: number) => void` | `undefined` | Called when step changes. |
19
- | `defaultStep` | `number` | `undefined` | Initial step if `value` is not provided. |
20
- | `allowStepNavigation` | `boolean` | `true` | If `false`, steps are not clickable. |
21
- | `allowClickOnlyCompleted`| `boolean` | `false` | If `true`, only completed steps are clickable. |
22
- | `onStepClick` | `(step, index) => void` | `undefined` | Custom click handler; if provided, handles activation manually. |
23
- | `indicators` | `{ active?; completed?; inactive?; loading? }` | `undefined` | Custom indicator content per state. |
24
-
25
- Inherits the rest of `StepperProps` (e.g., `orientation` is controlled by `align`).
26
-
27
- ---
28
-
29
- ## Behavior
30
-
31
- - **Controlled**: Always passes a `value` to `Stepper`. Update via `onValueChange`.
32
- - **Clickable steps**: Governed by `allowStepNavigation` and `allowClickOnlyCompleted`.
33
- - **Indicators**: Customize the indicator content through `indicators`.
34
-
35
- ---
36
-
37
- ## Examples
38
-
39
- ```tsx
40
- import * as React from "react";
41
- import { AppStepper } from "laif-ds";
42
-
43
- const steps = [
44
- { id: 1, label: "Account Setup", component: <div>Step 1</div> },
45
- { id: 2, label: "Profile Information", component: <div>Step 2</div> },
46
- { id: 3, label: "Preferences", component: <div>Step 3</div> },
47
- ] as const;
48
-
49
- export function HorizontalStepper() {
50
- const [current, setCurrent] = React.useState(1);
51
- return (
52
- <AppStepper
53
- steps={steps}
54
- value={current}
55
- onValueChange={setCurrent}
56
- align="horizontal"
57
- size="md"
58
- showSeparators
59
- />
60
- );
61
- }
62
-
63
- export function VerticalStepper() {
64
- const [current, setCurrent] = React.useState(1);
65
- return (
66
- <AppStepper steps={steps} value={current} onValueChange={setCurrent} align="vertical" />
67
- );
68
- }
69
- ```
70
-
71
- ---
72
-
73
- ## Notes
74
-
75
- - **Accessibility**: Based on `Stepper` primitives which manage keyboard and focus.
76
- - **Custom click logic**: Provide `onStepClick` to intercept clicks (e.g., validation before navigation).
77
-
1
+ # AppStepper
2
+
3
+ ## Overview
4
+
5
+ High-level stepper built on `Stepper` primitives. Renders labeled steps with indicators and panels, supports horizontal/vertical layouts, separators, controlled navigation and custom click behavior.
6
+
7
+ ---
8
+
9
+ ## Props
10
+
11
+ | Prop | Type | Default | Description |
12
+ | ------------------------- | -------------------------------------------------------------------------------------------- | ------------- | --------------------------------------------------------------- | ----------------------- |
13
+ | `steps` | `{ id: number; label: ReactNode; component: ReactNode; completed?; disabled?; loading?; }[]` | **required** | Steps to render (id is the step value). |
14
+ | `align` | `"horizontal" | "vertical"` | `"horizontal"` | Layout orientation. |
15
+ | `size` | `"sm" | "md"` | `"sm"` | Indicator/title sizing. |
16
+ | `showSeparators` | `boolean` | `true` | Show separators between steps. |
17
+ | `value` | `number` | first step id | Current step value (controlled). |
18
+ | `onValueChange` | `(value: number) => void` | `undefined` | Called when step changes. |
19
+ | `defaultStep` | `number` | `undefined` | Initial step if `value` is not provided. |
20
+ | `allowStepNavigation` | `boolean` | `true` | If `false`, steps are not clickable. |
21
+ | `allowClickOnlyCompleted` | `boolean` | `false` | If `true`, only completed steps are clickable. |
22
+ | `onStepClick` | `(step, index) => void` | `undefined` | Custom click handler; if provided, handles activation manually. |
23
+ | `indicators` | `{ active?; completed?; inactive?; loading? }` | `undefined` | Custom indicator content per state. |
24
+
25
+ Inherits the rest of `StepperProps` (e.g., `orientation` is controlled by `align`).
26
+
27
+ ---
28
+
29
+ ## Behavior
30
+
31
+ - **Controlled**: Always passes a `value` to `Stepper`. Update via `onValueChange`.
32
+ - **Clickable steps**: Governed by `allowStepNavigation` and `allowClickOnlyCompleted`.
33
+ - **Indicators**: Customize the indicator content through `indicators`.
34
+
35
+ ---
36
+
37
+ ## Examples
38
+
39
+ ```tsx
40
+ import * as React from "react";
41
+ import { AppStepper } from "laif-ds";
42
+
43
+ const steps = [
44
+ { id: 1, label: "Account Setup", component: <div>Step 1</div> },
45
+ { id: 2, label: "Profile Information", component: <div>Step 2</div> },
46
+ { id: 3, label: "Preferences", component: <div>Step 3</div> },
47
+ ] as const;
48
+
49
+ export function HorizontalStepper() {
50
+ const [current, setCurrent] = React.useState(1);
51
+ return (
52
+ <AppStepper
53
+ steps={steps}
54
+ value={current}
55
+ onValueChange={setCurrent}
56
+ align="horizontal"
57
+ size="md"
58
+ showSeparators
59
+ />
60
+ );
61
+ }
62
+
63
+ export function VerticalStepper() {
64
+ const [current, setCurrent] = React.useState(1);
65
+ return (
66
+ <AppStepper
67
+ steps={steps}
68
+ value={current}
69
+ onValueChange={setCurrent}
70
+ align="vertical"
71
+ />
72
+ );
73
+ }
74
+ ```
75
+
76
+ ---
77
+
78
+ ## Notes
79
+
80
+ - **Accessibility**: Based on `Stepper` primitives which manage keyboard and focus.
81
+ - **Custom click logic**: Provide `onStepClick` to intercept clicks (e.g., validation before navigation).
@@ -1,87 +1,95 @@
1
- # AspectRatio
2
-
3
- ## Overview
4
-
5
- A container that maintains a consistent aspect ratio for its content. Useful for images, videos, and any media that requires a fixed ratio.
6
-
7
- ---
8
-
9
- ## Props
10
-
11
- ### AspectRatio (Root)
12
-
13
- | Prop | Type | Default | Description |
14
- | ----------- | ------------------- | ----------- | ----------------------------------------------- |
15
- | `ratio` | `number` | `undefined` | Aspect ratio expressed as a number (e.g., 16/9).|
16
- | `className` | `string` | `""` | Additional classes applied to the container. |
17
- | `children` | `React.ReactNode` | **required**| Content inside the ratio-constrained container. |
18
-
19
- ---
20
-
21
- ## Behavior
22
-
23
- - **Responsive**: The container scales while preserving the specified ratio.
24
- - **Content fill**: Child content should handle its own layout (e.g., `object-cover`).
25
- - **Styling**: Apply width/height and styling via `className`.
26
-
27
- ---
28
-
29
- ## Examples
30
-
1
+ # AspectRatio
2
+
3
+ ## Overview
4
+
5
+ A container that maintains a consistent aspect ratio for its content. Useful for images, videos, and any media that requires a fixed ratio.
6
+
7
+ ---
8
+
9
+ ## Props
10
+
11
+ ### AspectRatio (Root)
12
+
13
+ | Prop | Type | Default | Description |
14
+ | ----------- | ----------------- | ------------ | ------------------------------------------------ |
15
+ | `ratio` | `number` | `undefined` | Aspect ratio expressed as a number (e.g., 16/9). |
16
+ | `className` | `string` | `""` | Additional classes applied to the container. |
17
+ | `children` | `React.ReactNode` | **required** | Content inside the ratio-constrained container. |
18
+
19
+ ---
20
+
21
+ ## Behavior
22
+
23
+ - **Responsive**: The container scales while preserving the specified ratio.
24
+ - **Content fill**: Child content should handle its own layout (e.g., `object-cover`).
25
+ - **Styling**: Apply width/height and styling via `className`.
26
+
27
+ ---
28
+
29
+ ## Examples
30
+
31
31
  ### 16:9 Ratio
32
-
32
+
33
33
  ```tsx
34
34
  import { AspectRatio } from "laif-ds";
35
-
35
+
36
36
  export function Ratio16x9() {
37
37
  return (
38
- <AspectRatio ratio={16 / 9} className="bg-d-secondary/10 w-[400px] rounded-md overflow-hidden">
38
+ <AspectRatio
39
+ ratio={16 / 9}
40
+ className="bg-d-secondary/10 w-[400px] overflow-hidden rounded-md"
41
+ >
39
42
  <div className="flex h-full items-center justify-center">
40
- <p className="text-sm text-d-secondary-foreground">16:9 Aspect Ratio</p>
43
+ <p className="text-d-secondary-foreground text-sm">16:9 Aspect Ratio</p>
41
44
  </div>
42
45
  </AspectRatio>
43
46
  );
44
47
  }
45
48
  ```
46
-
49
+
47
50
  ### Square (1:1)
48
-
51
+
49
52
  ```tsx
50
53
  import { AspectRatio } from "laif-ds";
51
-
54
+
52
55
  export function Square() {
53
56
  return (
54
- <AspectRatio ratio={1 / 1} className="bg-d-secondary/10 w-[400px] rounded-md overflow-hidden">
57
+ <AspectRatio
58
+ ratio={1 / 1}
59
+ className="bg-d-secondary/10 w-[400px] overflow-hidden rounded-md"
60
+ >
55
61
  <div className="flex h-full items-center justify-center">
56
- <p className="text-sm text-d-secondary-foreground">1:1 Aspect Ratio</p>
62
+ <p className="text-d-secondary-foreground text-sm">1:1 Aspect Ratio</p>
57
63
  </div>
58
64
  </AspectRatio>
59
65
  );
60
66
  }
61
67
  ```
62
-
68
+
63
69
  ### With Image
64
-
70
+
65
71
  ```tsx
66
72
  import { AspectRatio } from "laif-ds";
67
-
68
- export function ImageRatio() {
69
- return (
70
- <AspectRatio ratio={16 / 9} className="w-[400px] rounded-md overflow-hidden">
71
- <img
72
- src="https://images.unsplash.com/photo-1588345921523-c2dcdb7f1dcd?w=800&dpr=2&q=80"
73
- alt="Image"
74
- className="h-full w-full object-cover"
75
- />
76
- </AspectRatio>
77
- );
78
- }
79
- ```
80
-
81
- ---
82
-
83
- ## Notes
84
-
85
- - **Children**: Place any content inside; use `object-cover` for images to avoid distortion.
86
- - **Width**: Control width via `className`; height is computed from the ratio.
87
-
73
+
74
+ export function ImageRatio() {
75
+ return (
76
+ <AspectRatio
77
+ ratio={16 / 9}
78
+ className="w-[400px] overflow-hidden rounded-md"
79
+ >
80
+ <img
81
+ src="https://images.unsplash.com/photo-1588345921523-c2dcdb7f1dcd?w=800&dpr=2&q=80"
82
+ alt="Image"
83
+ className="h-full w-full object-cover"
84
+ />
85
+ </AspectRatio>
86
+ );
87
+ }
88
+ ```
89
+
90
+ ---
91
+
92
+ ## Notes
93
+
94
+ - **Children**: Place any content inside; use `object-cover` for images to avoid distortion.
95
+ - **Width**: Control width via `className`; height is computed from the ratio.
@@ -8,11 +8,11 @@ Canvas-based audio waveform visualizer for a MediaStream. Starts/stops with `isR
8
8
 
9
9
  ## Props
10
10
 
11
- | Prop | Type | Description |
12
- | --- | --- | --- |
13
- | `stream` | `MediaStream | null` | Input audio stream |
14
- | `isRecording` | `boolean` | Whether to render visualization |
15
- | `onClick` | `() => void` | Click handler (e.g., to toggle state) |
11
+ | Prop | Type | Description |
12
+ | ------------- | ------------ | ------------------------------------- | ------------------ |
13
+ | `stream` | `MediaStream | null` | Input audio stream |
14
+ | `isRecording` | `boolean` | Whether to render visualization |
15
+ | `onClick` | `() => void` | Click handler (e.g., to toggle state) |
16
16
 
17
17
  ---
18
18
 
@@ -1,113 +1,112 @@
1
- # Avatar
2
-
3
- ## Overview
4
-
5
- Circular user/avatar component with image and fallback. Accessible and easily styled.
6
-
7
- ---
8
-
9
- ## Props
10
-
11
- ### Avatar (Root)
12
-
13
- | Prop | Type | Default | Description |
14
- | ----------- | ----------------- | ----------- | ------------------------------------------------ |
15
- | `className` | `string` | `""` | Additional classes for size/border/layout. |
16
- | `children` | `React.ReactNode` | **required**| Typically `AvatarImage` and `AvatarFallback`. |
17
-
18
- ### Subcomponents
19
-
20
- - `AvatarImage`: The image element.
21
- - Props: `src`, `alt`, `className`.
22
- - `AvatarFallback`: Fallback content shown when the image fails or loads slowly.
23
- - Props: `children` (e.g., initials), `className`.
24
-
25
- ---
26
-
27
- ## Behavior
28
-
29
- - **Shape**: Circular by default (`rounded-full`).
30
- - **Sizing**: Control via `className` (e.g., `h-16 w-16`).
31
- - **Fallback**: Displays initials or an icon when the image is unavailable.
32
-
33
- ---
34
-
35
- ## Examples
36
-
37
- ### With Image
38
-
39
- ```tsx
40
- import { Avatar, AvatarImage, AvatarFallback } from "laif-ds";
41
-
42
- export function WithImage() {
43
- return (
44
- <Avatar>
45
- <AvatarImage src="https://github.com/shadcn.png" alt="@shadcn" />
46
- <AvatarFallback>CN</AvatarFallback>
47
- </Avatar>
48
- );
49
- }
50
- ```
51
-
52
- ### With Fallback
53
-
54
- ```tsx
55
- import { Avatar, AvatarImage, AvatarFallback } from "laif-ds";
56
-
57
- export function WithFallback() {
58
- return (
59
- <Avatar>
60
- <AvatarImage src="" alt="User" />
61
- <AvatarFallback>JD</AvatarFallback>
62
- </Avatar>
63
- );
64
- }
65
- ```
66
-
67
- ### Custom Size
68
-
69
- ```tsx
70
- import { Avatar, AvatarImage, AvatarFallback } from "laif-ds";
71
-
72
- export function CustomSize() {
73
- return (
74
- <Avatar className="h-16 w-16">
75
- <AvatarImage src="https://github.com/shadcn.png" alt="@shadcn" />
76
- <AvatarFallback>CN</AvatarFallback>
77
- </Avatar>
78
- );
79
- }
80
- ```
81
-
82
- ### Avatar Group
83
-
84
- ```tsx
85
- import { Avatar, AvatarImage, AvatarFallback } from "laif-ds";
86
-
87
- export function AvatarGroup() {
88
- return (
89
- <div className="flex -space-x-2">
90
- <Avatar className="border-background border-2">
91
- <AvatarImage src="https://github.com/shadcn.png" alt="@shadcn" />
92
- <AvatarFallback>CN</AvatarFallback>
93
- </Avatar>
94
- <Avatar className="border-background border-2">
95
- <AvatarImage src="https://github.com/shadcn.png" alt="@shadcn" />
96
- <AvatarFallback>JD</AvatarFallback>
97
- </Avatar>
98
- <Avatar className="border-background border-2">
99
- <AvatarImage src="https://github.com/shadcn.png" alt="@shadcn" />
100
- <AvatarFallback>MK</AvatarFallback>
101
- </Avatar>
102
- </div>
103
- );
104
- }
105
- ```
106
-
107
- ---
108
-
109
- ## Notes
110
-
111
- - **Accessibility**: Provide `alt` text for `AvatarImage`.
112
- - **Styling**: Combine with borders/shadows via `className`.
113
-
1
+ # Avatar
2
+
3
+ ## Overview
4
+
5
+ Circular user/avatar component with image and fallback. Accessible and easily styled.
6
+
7
+ ---
8
+
9
+ ## Props
10
+
11
+ ### Avatar (Root)
12
+
13
+ | Prop | Type | Default | Description |
14
+ | ----------- | ----------------- | ------------ | --------------------------------------------- |
15
+ | `className` | `string` | `""` | Additional classes for size/border/layout. |
16
+ | `children` | `React.ReactNode` | **required** | Typically `AvatarImage` and `AvatarFallback`. |
17
+
18
+ ### Subcomponents
19
+
20
+ - `AvatarImage`: The image element.
21
+ - Props: `src`, `alt`, `className`.
22
+ - `AvatarFallback`: Fallback content shown when the image fails or loads slowly.
23
+ - Props: `children` (e.g., initials), `className`.
24
+
25
+ ---
26
+
27
+ ## Behavior
28
+
29
+ - **Shape**: Circular by default (`rounded-full`).
30
+ - **Sizing**: Control via `className` (e.g., `h-16 w-16`).
31
+ - **Fallback**: Displays initials or an icon when the image is unavailable.
32
+
33
+ ---
34
+
35
+ ## Examples
36
+
37
+ ### With Image
38
+
39
+ ```tsx
40
+ import { Avatar, AvatarImage, AvatarFallback } from "laif-ds";
41
+
42
+ export function WithImage() {
43
+ return (
44
+ <Avatar>
45
+ <AvatarImage src="https://github.com/shadcn.png" alt="@shadcn" />
46
+ <AvatarFallback>CN</AvatarFallback>
47
+ </Avatar>
48
+ );
49
+ }
50
+ ```
51
+
52
+ ### With Fallback
53
+
54
+ ```tsx
55
+ import { Avatar, AvatarImage, AvatarFallback } from "laif-ds";
56
+
57
+ export function WithFallback() {
58
+ return (
59
+ <Avatar>
60
+ <AvatarImage src="" alt="User" />
61
+ <AvatarFallback>JD</AvatarFallback>
62
+ </Avatar>
63
+ );
64
+ }
65
+ ```
66
+
67
+ ### Custom Size
68
+
69
+ ```tsx
70
+ import { Avatar, AvatarImage, AvatarFallback } from "laif-ds";
71
+
72
+ export function CustomSize() {
73
+ return (
74
+ <Avatar className="h-16 w-16">
75
+ <AvatarImage src="https://github.com/shadcn.png" alt="@shadcn" />
76
+ <AvatarFallback>CN</AvatarFallback>
77
+ </Avatar>
78
+ );
79
+ }
80
+ ```
81
+
82
+ ### Avatar Group
83
+
84
+ ```tsx
85
+ import { Avatar, AvatarImage, AvatarFallback } from "laif-ds";
86
+
87
+ export function AvatarGroup() {
88
+ return (
89
+ <div className="flex -space-x-2">
90
+ <Avatar className="border-background border-2">
91
+ <AvatarImage src="https://github.com/shadcn.png" alt="@shadcn" />
92
+ <AvatarFallback>CN</AvatarFallback>
93
+ </Avatar>
94
+ <Avatar className="border-background border-2">
95
+ <AvatarImage src="https://github.com/shadcn.png" alt="@shadcn" />
96
+ <AvatarFallback>JD</AvatarFallback>
97
+ </Avatar>
98
+ <Avatar className="border-background border-2">
99
+ <AvatarImage src="https://github.com/shadcn.png" alt="@shadcn" />
100
+ <AvatarFallback>MK</AvatarFallback>
101
+ </Avatar>
102
+ </div>
103
+ );
104
+ }
105
+ ```
106
+
107
+ ---
108
+
109
+ ## Notes
110
+
111
+ - **Accessibility**: Provide `alt` text for `AvatarImage`.
112
+ - **Styling**: Combine with borders/shadows via `className`.