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,90 +1,90 @@
1
- # AppEditor
2
-
3
- ## Overview
4
-
5
- Rich text editor powered by Lexical with optional Markdown sync. Supports configurable toolbars (block format, font format, history), clear action, and character counter.
6
-
7
- ---
8
-
9
- ## Props
10
-
11
- | Prop | Type | Default | Description |
12
- | --------------- | ------------------------------------ | --------- | ----------- |
13
- | `defaultValue` | `string` | `undefined` | Initial content. Interpreted as Markdown when `onlyMarkdown=true`, plain text otherwise. |
14
- | `onMarkdownEdit`| `(markdown: string) => void` | `undefined` | Emits current content as Markdown on change. |
15
- | `plugins` | `("clear" | "counter")[]` | `[]` | Enable optional plugins: clear buttons, character counter. |
16
- | `toolbars` | `("block-format" | "font-format" | "history")[]` | `[]` | Enable toolbar groups. |
17
- | `placeholder` | `string` | `"Start typing..."` | Placeholder for empty editor. |
18
- | `onlyMarkdown` | `boolean` | `true` | Treat `defaultValue` as Markdown and sync editor to Markdown. If `false`, `defaultValue` is plain text. |
19
- | `className` | `string` | `"overflow-hidden rounded-lg border border-d-border"` | Extra classes for the content editable. |
20
-
21
- ---
22
-
23
- ## Behavior
24
-
25
- - **Markdown sync**: When `onlyMarkdown=true`, initializes from Markdown and emits Markdown on every change.
26
- - **Toolbars**:
27
- - `history`: undo/redo toolbar.
28
- - `block-format`: heading levels, list types, quote.
29
- - `font-format`: bold/italic/underline/strikethrough.
30
- - **Plugins**:
31
- - `clear`: clear actions in the footer.
32
- - `counter`: UTF-16 character counter in the footer.
33
- - **Editing**: Autosave via `onMarkdownEdit`. Keyboard navigation and selection per Lexical defaults.
34
-
35
- ---
36
-
37
- ## Examples
38
-
39
- ### Full Toolbar + Plugins
40
-
41
- ```tsx
42
- import * as React from "react";
43
- import { AppEditor } from "laif-ds";
44
-
45
- export function EditorFull() {
46
- const [markdown, setMarkdown] = React.useState("Hello world");
47
- return (
48
- <div className="space-y-4">
49
- <AppEditor
50
- defaultValue={markdown}
51
- onMarkdownEdit={setMarkdown}
52
- toolbars={["block-format", "font-format", "history"]}
53
- plugins={["clear", "counter"]}
54
- className="h-96"
55
- />
56
- <div className="text-d-muted-foreground text-sm">
57
- <span className="font-medium">Current markdown:</span> {markdown || "(empty)"}
58
- </div>
59
- </div>
60
- );
61
- }
62
- ```
63
-
64
- ### Markdown Default Value
65
-
66
- ```tsx
67
- import * as React from "react";
68
- import { AppEditor } from "laif-ds";
69
-
70
- export function MarkdownDefault() {
71
- const initial = "**Titolo** con testo in markdown";
72
- const [md, setMd] = React.useState(initial);
73
- return (
74
- <AppEditor
75
- defaultValue={initial}
76
- onMarkdownEdit={setMd}
77
- toolbars={["block-format", "font-format", "history"]}
78
- />
79
- );
80
- }
81
- ```
82
-
83
- ---
84
-
85
- ## Notes
86
-
87
- - **Sizing**: Control height via `className` (e.g., `h-96`).
88
- - **Performance**: Prefer Markdown mode for content pipelines that store Markdown; use `onlyMarkdown=false` for plain text initialization.
89
- - **Accessibility**: Toolbar buttons and editor area follow Lexical best practices.
90
-
1
+ # AppEditor
2
+
3
+ ## Overview
4
+
5
+ Rich text editor powered by Lexical with optional Markdown sync. Supports configurable toolbars (block format, font format, history), clear action, and character counter.
6
+
7
+ ---
8
+
9
+ ## Props
10
+
11
+ | Prop | Type | Default | Description |
12
+ | ---------------- | ---------------------------- | ----------------------------------------------------- | ------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------- | ---------------------- |
13
+ | `defaultValue` | `string` | `undefined` | Initial content. Interpreted as Markdown when `onlyMarkdown=true`, plain text otherwise. |
14
+ | `onMarkdownEdit` | `(markdown: string) => void` | `undefined` | Emits current content as Markdown on change. |
15
+ | `plugins` | `("clear" | "counter")[]` | `[]` | Enable optional plugins: clear buttons, character counter. |
16
+ | `toolbars` | `("block-format" | "font-format" | "history")[]` | `[]` | Enable toolbar groups. |
17
+ | `placeholder` | `string` | `"Start typing..."` | Placeholder for empty editor. |
18
+ | `onlyMarkdown` | `boolean` | `true` | Treat `defaultValue` as Markdown and sync editor to Markdown. If `false`, `defaultValue` is plain text. |
19
+ | `className` | `string` | `"overflow-hidden rounded-lg border border-d-border"` | Extra classes for the content editable. |
20
+
21
+ ---
22
+
23
+ ## Behavior
24
+
25
+ - **Markdown sync**: When `onlyMarkdown=true`, initializes from Markdown and emits Markdown on every change.
26
+ - **Toolbars**:
27
+ - `history`: undo/redo toolbar.
28
+ - `block-format`: heading levels, list types, quote.
29
+ - `font-format`: bold/italic/underline/strikethrough.
30
+ - **Plugins**:
31
+ - `clear`: clear actions in the footer.
32
+ - `counter`: UTF-16 character counter in the footer.
33
+ - **Editing**: Autosave via `onMarkdownEdit`. Keyboard navigation and selection per Lexical defaults.
34
+
35
+ ---
36
+
37
+ ## Examples
38
+
39
+ ### Full Toolbar + Plugins
40
+
41
+ ```tsx
42
+ import * as React from "react";
43
+ import { AppEditor } from "laif-ds";
44
+
45
+ export function EditorFull() {
46
+ const [markdown, setMarkdown] = React.useState("Hello world");
47
+ return (
48
+ <div className="space-y-4">
49
+ <AppEditor
50
+ defaultValue={markdown}
51
+ onMarkdownEdit={setMarkdown}
52
+ toolbars={["block-format", "font-format", "history"]}
53
+ plugins={["clear", "counter"]}
54
+ className="h-96"
55
+ />
56
+ <div className="text-d-muted-foreground text-sm">
57
+ <span className="font-medium">Current markdown:</span>{" "}
58
+ {markdown || "(empty)"}
59
+ </div>
60
+ </div>
61
+ );
62
+ }
63
+ ```
64
+
65
+ ### Markdown Default Value
66
+
67
+ ```tsx
68
+ import * as React from "react";
69
+ import { AppEditor } from "laif-ds";
70
+
71
+ export function MarkdownDefault() {
72
+ const initial = "**Titolo** con testo in markdown";
73
+ const [md, setMd] = React.useState(initial);
74
+ return (
75
+ <AppEditor
76
+ defaultValue={initial}
77
+ onMarkdownEdit={setMd}
78
+ toolbars={["block-format", "font-format", "history"]}
79
+ />
80
+ );
81
+ }
82
+ ```
83
+
84
+ ---
85
+
86
+ ## Notes
87
+
88
+ - **Sizing**: Control height via `className` (e.g., `h-96`).
89
+ - **Performance**: Prefer Markdown mode for content pipelines that store Markdown; use `onlyMarkdown=false` for plain text initialization.
90
+ - **Accessibility**: Toolbar buttons and editor area follow Lexical best practices.
@@ -24,24 +24,24 @@ export interface AppRadioGroupOption {
24
24
 
25
25
  ## Props
26
26
 
27
- | Prop | Type | Default | Description |
28
- | ----------------- | -------------------------------- | ------------ | ---------------------------------------------- |
29
- | `options` | `AppRadioGroupOption[]` | **required** | Array of radio options |
30
- | `value` | `string` | `undefined` | Controlled value |
31
- | `defaultValue` | `string` | `undefined` | Uncontrolled default value |
32
- | `onValueChange` | `(value: string) => void` | `undefined` | Callback when value changes |
33
- | `label` | `string \| React.ReactNode` | `undefined` | Label for the radio group |
34
- | `description` | `string \| React.ReactNode` | `undefined` | Description text below label |
35
- | `disabled` | `boolean` | `false` | Disables all options |
36
- | `required` | `boolean` | `false` | Shows required asterisk |
37
- | `name` | `string` | `undefined` | Form name attribute |
38
- | `orientation` | `"horizontal" \| "vertical"` | `"vertical"` | Layout orientation |
39
- | `loop` | `boolean` | `true` | Enable keyboard navigation looping |
40
- | `className` | `string` | `""` | Additional classes for radio group container |
41
- | `wrpClassName` | `string` | `""` | Additional classes for outer wrapper |
42
- | `optionClassName` | `string` | `""` | Additional classes for each option |
43
- | `layout` | `"default" \| "card"` | `"default"` | Visual layout style |
44
- | `error` | `string` | `undefined` | Error message to display |
27
+ | Prop | Type | Default | Description |
28
+ | ----------------- | ---------------------------- | ------------ | -------------------------------------------- |
29
+ | `options` | `AppRadioGroupOption[]` | **required** | Array of radio options |
30
+ | `value` | `string` | `undefined` | Controlled value |
31
+ | `defaultValue` | `string` | `undefined` | Uncontrolled default value |
32
+ | `onValueChange` | `(value: string) => void` | `undefined` | Callback when value changes |
33
+ | `label` | `string \| React.ReactNode` | `undefined` | Label for the radio group |
34
+ | `description` | `string \| React.ReactNode` | `undefined` | Description text below label |
35
+ | `disabled` | `boolean` | `false` | Disables all options |
36
+ | `required` | `boolean` | `false` | Shows required asterisk |
37
+ | `name` | `string` | `undefined` | Form name attribute |
38
+ | `orientation` | `"horizontal" \| "vertical"` | `"vertical"` | Layout orientation |
39
+ | `loop` | `boolean` | `true` | Enable keyboard navigation looping |
40
+ | `className` | `string` | `""` | Additional classes for radio group container |
41
+ | `wrpClassName` | `string` | `""` | Additional classes for outer wrapper |
42
+ | `optionClassName` | `string` | `""` | Additional classes for each option |
43
+ | `layout` | `"default" \| "card"` | `"default"` | Visual layout style |
44
+ | `error` | `string` | `undefined` | Error message to display |
45
45
 
46
46
  ---
47
47
 
@@ -1,122 +1,129 @@
1
- # AppSidebar
2
-
3
- ## Overview
4
-
5
- High-level app sidebar built on top of `Sidebar` primitives. Renders navigation groups, nested items, header/footer content, optional versions area and an optional rail for resizing/collapsing.
6
-
7
- ---
8
-
9
- ## Props
10
-
11
- | Prop | Type | Default | Description |
12
- | ------------------ | ------------------------------------ | ----------- | ----------- |
13
- | `navigation` | `NavGroup[]` | **required**| Main navigation groups. |
14
- | `navigationFooter` | `NavGroup[]` | `undefined` | Footer navigation groups. |
15
- | `versions` | `string[]` | `undefined` | Optional versions list. |
16
- | `defaultVersion` | `string` | `undefined` | Default selected version. |
17
- | `headerContent` | `React.ReactNode` | `undefined` | Custom content at the top. |
18
- | `footerContent` | `React.ReactNode` | `undefined` | Custom content at the bottom. |
19
- | `showRail` | `boolean` | `true` | Show the draggable sidebar rail. |
20
- | `linkComponent` | `React.ComponentType<any>` | `undefined` | Custom link component for items. |
21
- | `linkProps` | `Record<string, any>` | `{}` | Extra props passed to the link component. |
22
-
23
- `NavGroup` → `{ title: string; url?: string; items: NavItem[] }`
24
-
25
- `NavItem` → `{ title: string; url: string; isActive?: boolean; iconName?: IconName; subItems?: NavSubItem[] }`
26
-
27
- `NavSubItem` → `{ title: string; url: string; isActive?: boolean; iconName?: IconName }`
28
-
29
- Inherits other props from `Sidebar` via `React.ComponentProps<typeof Sidebar>`.
30
-
31
- ---
32
-
33
- ## Behavior
34
-
35
- - **Collapsible groups**: Clicking items with `subItems` toggles nested lists.
36
- - **Active state**: `isActive` highlights and expands relevant items/groups.
37
- - **Links**: Use `linkComponent` for framework routers (e.g., Next.js `Link`).
38
- - **Rail**: `showRail` displays a thin draggable handle to collapse/expand.
39
-
40
- ---
41
-
42
- ## Examples
43
-
44
- ### Basic
45
-
46
- ```tsx
47
- import { SidebarProvider, SidebarTrigger } from "laif-ds";
48
- import { AppSidebar } from "laif-ds";
49
-
50
- const navigation = [
51
- {
52
- title: "Generale",
53
- items: [
54
- { title: "Dashboard", url: "#", isActive: true, iconName: "Home" },
55
- { title: "Utenti", url: "#", iconName: "Users" },
56
- {
57
- title: "Messaggi",
58
- url: "#",
59
- iconName: "MessageSquare",
60
- subItems: [
61
- { title: "Inbox", url: "#inbox", iconName: "Inbox" },
62
- { title: "Inviati", url: "#sent", iconName: "Send" },
63
- ],
64
- },
65
- ],
66
- },
67
- ];
68
-
69
- export function Layout() {
70
- return (
71
- <SidebarProvider>
72
- <div className="flex h-[100vh] overflow-hidden">
73
- <AppSidebar navigation={navigation} showRail />
74
- <div className="flex-1 overflow-auto p-4">
75
- <SidebarTrigger />
76
- {/* Page content */}
77
- </div>
78
- </div>
79
- </SidebarProvider>
80
- );
81
- }
82
- ```
83
-
84
- ### With Header/Footer Content
85
-
86
- ```tsx
87
- import { Button, Input } from "laif-ds";
88
-
89
- export function WithHeaderFooter() {
90
- return (
91
- <SidebarProvider>
92
- <div className="flex h-[100vh] overflow-hidden">
93
- <AppSidebar
94
- navigation={[]}
95
- headerContent={
96
- <div className="p-4">
97
- <Input iconLeft="Search" placeholder="Cerca..." className="bg-d-background pl-8" />
98
- </div>
99
- }
100
- footerContent={
101
- <div className="border-d-border border-t p-4">
102
- <Button variant="ghost" className="w-full justify-start" iconLeft="Settings">
103
- Impostazioni
104
- </Button>
105
- </div>
106
- }
107
- />
108
- <div className="flex-1 overflow-auto p-4" />
109
- </div>
110
- </SidebarProvider>
111
- );
112
- }
113
- ```
114
-
115
- ---
116
-
117
- ## Notes
118
-
119
- - **Routing**: Prefer `linkComponent` to avoid full page reloads (e.g., `next/link`).
120
- - **Icons**: Use `laif-ds` `Icon` by passing `iconName` in navigation items.
121
- - **Accessibility**: Sidebar primitives manage keyboard navigation and focus.
122
-
1
+ # AppSidebar
2
+
3
+ ## Overview
4
+
5
+ High-level app sidebar built on top of `Sidebar` primitives. Renders navigation groups, nested items, header/footer content, optional versions area and an optional rail for resizing/collapsing.
6
+
7
+ ---
8
+
9
+ ## Props
10
+
11
+ | Prop | Type | Default | Description |
12
+ | ------------------ | -------------------------- | ------------ | ----------------------------------------- |
13
+ | `navigation` | `NavGroup[]` | **required** | Main navigation groups. |
14
+ | `navigationFooter` | `NavGroup[]` | `undefined` | Footer navigation groups. |
15
+ | `versions` | `string[]` | `undefined` | Optional versions list. |
16
+ | `defaultVersion` | `string` | `undefined` | Default selected version. |
17
+ | `headerContent` | `React.ReactNode` | `undefined` | Custom content at the top. |
18
+ | `footerContent` | `React.ReactNode` | `undefined` | Custom content at the bottom. |
19
+ | `showRail` | `boolean` | `true` | Show the draggable sidebar rail. |
20
+ | `linkComponent` | `React.ComponentType<any>` | `undefined` | Custom link component for items. |
21
+ | `linkProps` | `Record<string, any>` | `{}` | Extra props passed to the link component. |
22
+
23
+ `NavGroup` → `{ title: string; url?: string; items: NavItem[] }`
24
+
25
+ `NavItem` → `{ title: string; url: string; isActive?: boolean; iconName?: IconName; subItems?: NavSubItem[] }`
26
+
27
+ `NavSubItem` → `{ title: string; url: string; isActive?: boolean; iconName?: IconName }`
28
+
29
+ Inherits other props from `Sidebar` via `React.ComponentProps<typeof Sidebar>`.
30
+
31
+ ---
32
+
33
+ ## Behavior
34
+
35
+ - **Collapsible groups**: Clicking items with `subItems` toggles nested lists.
36
+ - **Active state**: `isActive` highlights and expands relevant items/groups.
37
+ - **Links**: Use `linkComponent` for framework routers (e.g., Next.js `Link`).
38
+ - **Rail**: `showRail` displays a thin draggable handle to collapse/expand.
39
+
40
+ ---
41
+
42
+ ## Examples
43
+
44
+ ### Basic
45
+
46
+ ```tsx
47
+ import { SidebarProvider, SidebarTrigger } from "laif-ds";
48
+ import { AppSidebar } from "laif-ds";
49
+
50
+ const navigation = [
51
+ {
52
+ title: "Generale",
53
+ items: [
54
+ { title: "Dashboard", url: "#", isActive: true, iconName: "Home" },
55
+ { title: "Utenti", url: "#", iconName: "Users" },
56
+ {
57
+ title: "Messaggi",
58
+ url: "#",
59
+ iconName: "MessageSquare",
60
+ subItems: [
61
+ { title: "Inbox", url: "#inbox", iconName: "Inbox" },
62
+ { title: "Inviati", url: "#sent", iconName: "Send" },
63
+ ],
64
+ },
65
+ ],
66
+ },
67
+ ];
68
+
69
+ export function Layout() {
70
+ return (
71
+ <SidebarProvider>
72
+ <div className="flex h-[100vh] overflow-hidden">
73
+ <AppSidebar navigation={navigation} showRail />
74
+ <div className="flex-1 overflow-auto p-4">
75
+ <SidebarTrigger />
76
+ {/* Page content */}
77
+ </div>
78
+ </div>
79
+ </SidebarProvider>
80
+ );
81
+ }
82
+ ```
83
+
84
+ ### With Header/Footer Content
85
+
86
+ ```tsx
87
+ import { Button, Input } from "laif-ds";
88
+
89
+ export function WithHeaderFooter() {
90
+ return (
91
+ <SidebarProvider>
92
+ <div className="flex h-[100vh] overflow-hidden">
93
+ <AppSidebar
94
+ navigation={[]}
95
+ headerContent={
96
+ <div className="p-4">
97
+ <Input
98
+ iconLeft="Search"
99
+ placeholder="Cerca..."
100
+ className="bg-d-background pl-8"
101
+ />
102
+ </div>
103
+ }
104
+ footerContent={
105
+ <div className="border-d-border border-t p-4">
106
+ <Button
107
+ variant="ghost"
108
+ className="w-full justify-start"
109
+ iconLeft="Settings"
110
+ >
111
+ Impostazioni
112
+ </Button>
113
+ </div>
114
+ }
115
+ />
116
+ <div className="flex-1 overflow-auto p-4" />
117
+ </div>
118
+ </SidebarProvider>
119
+ );
120
+ }
121
+ ```
122
+
123
+ ---
124
+
125
+ ## Notes
126
+
127
+ - **Routing**: Prefer `linkComponent` to avoid full page reloads (e.g., `next/link`).
128
+ - **Icons**: Use `laif-ds` `Icon` by passing `iconName` in navigation items.
129
+ - **Accessibility**: Sidebar primitives manage keyboard navigation and focus.