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,191 +1,196 @@
1
- # ContextMenu
2
-
3
- ## Overview
4
-
5
- Right-click context menu built on Radix. Supports items, groups, separators, submenus, checkbox items, radio groups, and keyboard shortcuts.
6
-
7
- ---
8
-
9
- ## Props
10
-
11
- ### ContextMenu (Root)
12
-
13
- | Prop | Type | Default | Description |
14
- | ----------- | ----------------- | ----------- | ----------------------------------------- |
15
- | `children` | `React.ReactNode` | **required**| Include `ContextMenuTrigger` and content. |
16
-
17
- ### Subcomponents
18
-
19
- - `ContextMenuTrigger`: The element that opens the menu on right-click.
20
- - `ContextMenuContent`: The menu panel container.
21
- - `ContextMenuItem`: A clickable item. Props:
22
- - `variant?: "default" | "destructive"`
23
- - `inset?: boolean`
24
- - `ContextMenuCheckboxItem`: Checkbox-like item. Props:
25
- - `checked?: boolean`
26
- - `ContextMenuRadioGroup`: Radio group container. Props: `value: string`.
27
- - `ContextMenuRadioItem`: A radio item. Props: `value: string`.
28
- - `ContextMenuSub` / `ContextMenuSubTrigger` / `ContextMenuSubContent`: Submenu controls.
29
- - `ContextMenuLabel`: Section label. Props: `inset?: boolean`.
30
- - `ContextMenuSeparator`: Horizontal separator.
31
- - `ContextMenuShortcut`: Right-aligned text (e.g., keyboard shortcut).
32
-
33
- ---
34
-
35
- ## Behavior
36
-
37
- - **Trigger**: Right-click (contextmenu) on the trigger shows the menu.
38
- - **Submenus**: Use `ContextMenuSub` to nest menus.
39
- - **Checkbox/Radio**: Use state to control `checked` and `value` props.
40
- - **Accessibility**: Keyboard navigation and ARIA attributes handled by Radix.
41
-
42
- ---
43
-
44
- ## Examples
45
-
46
- ### Basic
47
-
48
- ```tsx
49
- import {
50
- ContextMenu,
51
- ContextMenuTrigger,
52
- ContextMenuContent,
53
- ContextMenuItem,
54
- ContextMenuSeparator,
55
- ContextMenuShortcut,
56
- } from "laif-ds";
57
-
58
- export function BasicContextMenu() {
59
- return (
60
- <ContextMenu>
61
- <ContextMenuTrigger className="flex h-[150px] w-[300px] items-center justify-center rounded-md border border-dashed text-sm">
62
- Right click here
63
- </ContextMenuTrigger>
64
- <ContextMenuContent className="w-64">
65
- <ContextMenuItem>
66
- Back
67
- <ContextMenuShortcut>⌘[</ContextMenuShortcut>
68
- </ContextMenuItem>
69
- <ContextMenuItem>
70
- Forward
71
- <ContextMenuShortcut>⌘]</ContextMenuShortcut>
72
- </ContextMenuItem>
73
- <ContextMenuItem>
74
- Reload
75
- <ContextMenuShortcut>⌘R</ContextMenuShortcut>
76
- </ContextMenuItem>
77
- <ContextMenuSeparator />
78
- <ContextMenuItem>
79
- Save As...
80
- <ContextMenuShortcut>⌘S</ContextMenuShortcut>
81
- </ContextMenuItem>
82
- <ContextMenuItem>
83
- Print...
84
- <ContextMenuShortcut>⌘P</ContextMenuShortcut>
85
- </ContextMenuItem>
86
- </ContextMenuContent>
87
- </ContextMenu>
88
- );
89
- }
90
- ```
91
-
92
- ### With Submenu
93
-
94
- ```tsx
95
- import {
96
- ContextMenu,
97
- ContextMenuTrigger,
98
- ContextMenuContent,
99
- ContextMenuItem,
100
- ContextMenuSub,
101
- ContextMenuSubTrigger,
102
- ContextMenuSubContent,
103
- ContextMenuSeparator,
104
- ContextMenuShortcut,
105
- } from "laif-ds";
106
-
107
- export function WithSubmenu() {
108
- return (
109
- <ContextMenu>
110
- <ContextMenuTrigger className="flex h-[150px] w-[300px] items-center justify-center rounded-md border border-dashed text-sm">
111
- Right click here
112
- </ContextMenuTrigger>
113
- <ContextMenuContent className="w-64">
114
- <ContextMenuItem>
115
- Back
116
- <ContextMenuShortcut>⌘[</ContextMenuShortcut>
117
- </ContextMenuItem>
118
- <ContextMenuItem>
119
- Forward
120
- <ContextMenuShortcut>⌘]</ContextMenuShortcut>
121
- </ContextMenuItem>
122
- <ContextMenuSub>
123
- <ContextMenuSubTrigger>More Tools</ContextMenuSubTrigger>
124
- <ContextMenuSubContent className="w-48">
125
- <ContextMenuItem>
126
- Save Page As...
127
- <ContextMenuShortcut>⇧⌘S</ContextMenuShortcut>
128
- </ContextMenuItem>
129
- <ContextMenuItem>Create Shortcut...</ContextMenuItem>
130
- <ContextMenuItem>Name Window...</ContextMenuItem>
131
- <ContextMenuSeparator />
132
- <ContextMenuItem>Developer Tools</ContextMenuItem>
133
- </ContextMenuSubContent>
134
- </ContextMenuSub>
135
- <ContextMenuSeparator />
136
- <ContextMenuItem>
137
- Print...
138
- <ContextMenuShortcut>⌘P</ContextMenuShortcut>
139
- </ContextMenuItem>
140
- </ContextMenuContent>
141
- </ContextMenu>
142
- );
143
- }
144
- ```
145
-
146
- ### With Checkbox and Radio
147
-
148
- ```tsx
149
- import {
150
- ContextMenu,
151
- ContextMenuTrigger,
152
- ContextMenuContent,
153
- ContextMenuCheckboxItem,
154
- ContextMenuLabel,
155
- ContextMenuSeparator,
156
- ContextMenuRadioGroup,
157
- ContextMenuRadioItem,
158
- } from "laif-ds";
159
-
160
- export function WithCheckboxAndRadio() {
161
- return (
162
- <ContextMenu>
163
- <ContextMenuTrigger className="flex h-[150px] w-[300px] items-center justify-center rounded-md border border-dashed text-sm">
164
- Right click here
165
- </ContextMenuTrigger>
166
- <ContextMenuContent className="w-64">
167
- <ContextMenuLabel>Options</ContextMenuLabel>
168
- <ContextMenuSeparator />
169
- <ContextMenuCheckboxItem>Show Bookmarks Bar</ContextMenuCheckboxItem>
170
- <ContextMenuCheckboxItem checked>Show Full URLs</ContextMenuCheckboxItem>
171
- <ContextMenuSeparator />
172
- <ContextMenuLabel>View</ContextMenuLabel>
173
- <ContextMenuRadioGroup value="comfortable">
174
- <ContextMenuRadioItem value="comfortable">Comfortable</ContextMenuRadioItem>
175
- <ContextMenuRadioItem value="compact">Compact</ContextMenuRadioItem>
176
- <ContextMenuRadioItem value="condensed">Condensed</ContextMenuRadioItem>
177
- </ContextMenuRadioGroup>
178
- </ContextMenuContent>
179
- </ContextMenu>
180
- );
181
- }
182
- ```
183
-
184
- ---
185
-
186
- ## Notes
187
-
188
- - **Variants**: Use `variant="destructive"` on `ContextMenuItem` for dangerous actions.
189
- - **Inset**: Use `inset` on items/labels to align with other content.
190
- - **Keyboard**: Use arrow keys and Enter to navigate/activate items.
191
-
1
+ # ContextMenu
2
+
3
+ ## Overview
4
+
5
+ Right-click context menu built on Radix. Supports items, groups, separators, submenus, checkbox items, radio groups, and keyboard shortcuts.
6
+
7
+ ---
8
+
9
+ ## Props
10
+
11
+ ### ContextMenu (Root)
12
+
13
+ | Prop | Type | Default | Description |
14
+ | ---------- | ----------------- | ------------ | ----------------------------------------- |
15
+ | `children` | `React.ReactNode` | **required** | Include `ContextMenuTrigger` and content. |
16
+
17
+ ### Subcomponents
18
+
19
+ - `ContextMenuTrigger`: The element that opens the menu on right-click.
20
+ - `ContextMenuContent`: The menu panel container.
21
+ - `ContextMenuItem`: A clickable item. Props:
22
+ - `variant?: "default" | "destructive"`
23
+ - `inset?: boolean`
24
+ - `ContextMenuCheckboxItem`: Checkbox-like item. Props:
25
+ - `checked?: boolean`
26
+ - `ContextMenuRadioGroup`: Radio group container. Props: `value: string`.
27
+ - `ContextMenuRadioItem`: A radio item. Props: `value: string`.
28
+ - `ContextMenuSub` / `ContextMenuSubTrigger` / `ContextMenuSubContent`: Submenu controls.
29
+ - `ContextMenuLabel`: Section label. Props: `inset?: boolean`.
30
+ - `ContextMenuSeparator`: Horizontal separator.
31
+ - `ContextMenuShortcut`: Right-aligned text (e.g., keyboard shortcut).
32
+
33
+ ---
34
+
35
+ ## Behavior
36
+
37
+ - **Trigger**: Right-click (contextmenu) on the trigger shows the menu.
38
+ - **Submenus**: Use `ContextMenuSub` to nest menus.
39
+ - **Checkbox/Radio**: Use state to control `checked` and `value` props.
40
+ - **Accessibility**: Keyboard navigation and ARIA attributes handled by Radix.
41
+
42
+ ---
43
+
44
+ ## Examples
45
+
46
+ ### Basic
47
+
48
+ ```tsx
49
+ import {
50
+ ContextMenu,
51
+ ContextMenuTrigger,
52
+ ContextMenuContent,
53
+ ContextMenuItem,
54
+ ContextMenuSeparator,
55
+ ContextMenuShortcut,
56
+ } from "laif-ds";
57
+
58
+ export function BasicContextMenu() {
59
+ return (
60
+ <ContextMenu>
61
+ <ContextMenuTrigger className="flex h-[150px] w-[300px] items-center justify-center rounded-md border border-dashed text-sm">
62
+ Right click here
63
+ </ContextMenuTrigger>
64
+ <ContextMenuContent className="w-64">
65
+ <ContextMenuItem>
66
+ Back
67
+ <ContextMenuShortcut>⌘[</ContextMenuShortcut>
68
+ </ContextMenuItem>
69
+ <ContextMenuItem>
70
+ Forward
71
+ <ContextMenuShortcut>⌘]</ContextMenuShortcut>
72
+ </ContextMenuItem>
73
+ <ContextMenuItem>
74
+ Reload
75
+ <ContextMenuShortcut>⌘R</ContextMenuShortcut>
76
+ </ContextMenuItem>
77
+ <ContextMenuSeparator />
78
+ <ContextMenuItem>
79
+ Save As...
80
+ <ContextMenuShortcut>⌘S</ContextMenuShortcut>
81
+ </ContextMenuItem>
82
+ <ContextMenuItem>
83
+ Print...
84
+ <ContextMenuShortcut>⌘P</ContextMenuShortcut>
85
+ </ContextMenuItem>
86
+ </ContextMenuContent>
87
+ </ContextMenu>
88
+ );
89
+ }
90
+ ```
91
+
92
+ ### With Submenu
93
+
94
+ ```tsx
95
+ import {
96
+ ContextMenu,
97
+ ContextMenuTrigger,
98
+ ContextMenuContent,
99
+ ContextMenuItem,
100
+ ContextMenuSub,
101
+ ContextMenuSubTrigger,
102
+ ContextMenuSubContent,
103
+ ContextMenuSeparator,
104
+ ContextMenuShortcut,
105
+ } from "laif-ds";
106
+
107
+ export function WithSubmenu() {
108
+ return (
109
+ <ContextMenu>
110
+ <ContextMenuTrigger className="flex h-[150px] w-[300px] items-center justify-center rounded-md border border-dashed text-sm">
111
+ Right click here
112
+ </ContextMenuTrigger>
113
+ <ContextMenuContent className="w-64">
114
+ <ContextMenuItem>
115
+ Back
116
+ <ContextMenuShortcut>⌘[</ContextMenuShortcut>
117
+ </ContextMenuItem>
118
+ <ContextMenuItem>
119
+ Forward
120
+ <ContextMenuShortcut>⌘]</ContextMenuShortcut>
121
+ </ContextMenuItem>
122
+ <ContextMenuSub>
123
+ <ContextMenuSubTrigger>More Tools</ContextMenuSubTrigger>
124
+ <ContextMenuSubContent className="w-48">
125
+ <ContextMenuItem>
126
+ Save Page As...
127
+ <ContextMenuShortcut>⇧⌘S</ContextMenuShortcut>
128
+ </ContextMenuItem>
129
+ <ContextMenuItem>Create Shortcut...</ContextMenuItem>
130
+ <ContextMenuItem>Name Window...</ContextMenuItem>
131
+ <ContextMenuSeparator />
132
+ <ContextMenuItem>Developer Tools</ContextMenuItem>
133
+ </ContextMenuSubContent>
134
+ </ContextMenuSub>
135
+ <ContextMenuSeparator />
136
+ <ContextMenuItem>
137
+ Print...
138
+ <ContextMenuShortcut>⌘P</ContextMenuShortcut>
139
+ </ContextMenuItem>
140
+ </ContextMenuContent>
141
+ </ContextMenu>
142
+ );
143
+ }
144
+ ```
145
+
146
+ ### With Checkbox and Radio
147
+
148
+ ```tsx
149
+ import {
150
+ ContextMenu,
151
+ ContextMenuTrigger,
152
+ ContextMenuContent,
153
+ ContextMenuCheckboxItem,
154
+ ContextMenuLabel,
155
+ ContextMenuSeparator,
156
+ ContextMenuRadioGroup,
157
+ ContextMenuRadioItem,
158
+ } from "laif-ds";
159
+
160
+ export function WithCheckboxAndRadio() {
161
+ return (
162
+ <ContextMenu>
163
+ <ContextMenuTrigger className="flex h-[150px] w-[300px] items-center justify-center rounded-md border border-dashed text-sm">
164
+ Right click here
165
+ </ContextMenuTrigger>
166
+ <ContextMenuContent className="w-64">
167
+ <ContextMenuLabel>Options</ContextMenuLabel>
168
+ <ContextMenuSeparator />
169
+ <ContextMenuCheckboxItem>Show Bookmarks Bar</ContextMenuCheckboxItem>
170
+ <ContextMenuCheckboxItem checked>
171
+ Show Full URLs
172
+ </ContextMenuCheckboxItem>
173
+ <ContextMenuSeparator />
174
+ <ContextMenuLabel>View</ContextMenuLabel>
175
+ <ContextMenuRadioGroup value="comfortable">
176
+ <ContextMenuRadioItem value="comfortable">
177
+ Comfortable
178
+ </ContextMenuRadioItem>
179
+ <ContextMenuRadioItem value="compact">Compact</ContextMenuRadioItem>
180
+ <ContextMenuRadioItem value="condensed">
181
+ Condensed
182
+ </ContextMenuRadioItem>
183
+ </ContextMenuRadioGroup>
184
+ </ContextMenuContent>
185
+ </ContextMenu>
186
+ );
187
+ }
188
+ ```
189
+
190
+ ---
191
+
192
+ ## Notes
193
+
194
+ - **Variants**: Use `variant="destructive"` on `ContextMenuItem` for dangerous actions.
195
+ - **Inset**: Use `inset` on items/labels to align with other content.
196
+ - **Keyboard**: Use arrow keys and Enter to navigate/activate items.
@@ -1,94 +1,114 @@
1
- # DataCrossTable
2
-
3
- ## Overview
4
-
5
- Cross table component that renders a matrix from two headers (top/left) with virtualized rows, sticky headers/first column, optional filtering/sorting, and an edit mode supported by a context provider and action buttons.
6
-
7
- ---
8
-
9
- ## Props
10
-
11
- | Prop | Type | Default | Description |
12
- | ------------------ | ----------------------- | ------- | ----------- |
13
- | `crossTableData` | `CrossTableData` | — | Matrix data and headers. |
14
- | `filterable` | `boolean` | `false` | Enables sorting via header buttons and row sorting by selected row. |
15
- | `loading` | `boolean` | `false` | Shows a skeleton table. |
16
- | `emptyComponent` | `ReactNode` | `undefined` | Shown when no data. |
17
- | `className` | `string` | `undefined` | Wrapper classes. |
18
- | `notFoundMessage` | `string` | `"Nessun risultato trovato."` | Fallback empty message. |
19
- | `cornerHeaderFrom` | `string` | `"Da"` | Corner label (top-left) from. |
20
- | `cornerHeaderTo` | `string` | `"A"` | Corner label (top-left) to. |
21
- | `minWidthCell` | `number` | `160` | Minimum cell width in px. |
22
- | `editable` | `boolean` | `false` | Enable edit mode features. |
23
- | `editMode` | `boolean` | `false` | Control edit mode from outside. |
24
- | `onEditModeChange` | `(editMode: boolean) => void` | `undefined` | Notified when edit mode changes. |
25
- | `onSelectedRow` | `(row: CrossTableHeader) => void` | `undefined` | Emitted when selecting a row for sorting. |
26
- | `selectedRow` | `CrossTableHeader` | `undefined` | Controlled selected row. |
27
- | `rowSortAsc` | `boolean` | `true` | Sort ascending when selecting a row. |
28
-
29
- ### Types
30
-
31
- - `CrossTableHeader` → `{ id: string; label: string }`
32
- - `CrossTableCell` → `{ render?:(fromId,toId,id?)=>ReactNode; value?: number|string|null; bgColor?: string; textColor?: string; fromId: string; toId: string; id?: string; editable?: boolean }`
33
- - `CrossTableData` → `{ headerTop: CrossTableHeader[]; headerLeft: CrossTableHeader[]; data: (CrossTableCell|null)[][] }`
34
-
35
- ---
36
-
37
- ## Provider & Actions
38
-
39
- Use `DataCrossTableProvider` to manage edit state across the table and expose a buttons group.
40
-
41
- - `DataCrossTableProvider` props:
42
- - `onConfirmedCells?(data: { editedCells: ConfirmedCell[]; toDefaultCells: ConfirmedCell[] })`
43
- - Labels: `editConfirmLabel`, `editCancelLabel`, `editRestoreDefaultLabel`
44
- - Flags: `initialEditMode` (default `false`), `showDefaultActionButton` (default `false`)
45
- - Editable input labels: `cellEditTitleLabel`, `cellEditModifiedLabel`, `cellConfirmButtonLabel`, `cellCancelButtonLabel`, `cellResetButtonLabel`
46
- - `DataCrossTableButtonsGroup`: shows Confirm/Cancel/Restore actions when `editMode=true`.
47
-
48
- ---
49
-
50
- ## Examples
51
-
52
- ### Default with Provider
53
-
54
- ```tsx
55
- import { DataCrossTable, DataCrossTableProvider, DataCrossTableButtonsGroup } from "laif-ds";
56
-
57
- export function CrossEditable({ data }: { data: CrossTableData }) {
58
- return (
59
- <DataCrossTableProvider initialEditMode onConfirmedCells={(cells) => console.log(cells)}>
60
- {({ editMode }) => (
61
- <div className="space-y-3">
62
- <DataCrossTableButtonsGroup />
63
- <DataCrossTable crossTableData={data} editable editMode={editMode} minWidthCell={200} />
64
- </div>
65
- )}
66
- </DataCrossTableProvider>
67
- );
68
- }
69
- ```
70
-
71
- ### Filterable
72
-
73
- ```tsx
74
- <DataCrossTableProvider>
75
- <DataCrossTable crossTableData={data} filterable minWidthCell={200} cornerHeaderFrom="From" cornerHeaderTo="To" />
76
- </DataCrossTableProvider>
77
- ```
78
-
79
- ### Loading State
80
-
81
- ```tsx
82
- <DataCrossTableProvider>
83
- <DataCrossTable loading crossTableData={{ headerTop: [], headerLeft: [], data: [] }} />
84
- </DataCrossTableProvider>
85
- ```
86
-
87
- ---
88
-
89
- ## Notes
90
-
91
- - **Virtualization**: Rows are virtualized for performance on large datasets.
92
- - **Sticky**: Top header row and first column are sticky; corner cell has higher z-index.
93
- - **Editing**: Editable cells open a popover editor; edited/reset markers are shown per cell.
94
-
1
+ # DataCrossTable
2
+
3
+ ## Overview
4
+
5
+ Cross table component that renders a matrix from two headers (top/left) with virtualized rows, sticky headers/first column, optional filtering/sorting, and an edit mode supported by a context provider and action buttons.
6
+
7
+ ---
8
+
9
+ ## Props
10
+
11
+ | Prop | Type | Default | Description |
12
+ | ------------------ | --------------------------------- | ----------------------------- | ------------------------------------------------------------------- |
13
+ | `crossTableData` | `CrossTableData` | — | Matrix data and headers. |
14
+ | `filterable` | `boolean` | `false` | Enables sorting via header buttons and row sorting by selected row. |
15
+ | `loading` | `boolean` | `false` | Shows a skeleton table. |
16
+ | `emptyComponent` | `ReactNode` | `undefined` | Shown when no data. |
17
+ | `className` | `string` | `undefined` | Wrapper classes. |
18
+ | `notFoundMessage` | `string` | `"Nessun risultato trovato."` | Fallback empty message. |
19
+ | `cornerHeaderFrom` | `string` | `"Da"` | Corner label (top-left) from. |
20
+ | `cornerHeaderTo` | `string` | `"A"` | Corner label (top-left) to. |
21
+ | `minWidthCell` | `number` | `160` | Minimum cell width in px. |
22
+ | `editable` | `boolean` | `false` | Enable edit mode features. |
23
+ | `editMode` | `boolean` | `false` | Control edit mode from outside. |
24
+ | `onEditModeChange` | `(editMode: boolean) => void` | `undefined` | Notified when edit mode changes. |
25
+ | `onSelectedRow` | `(row: CrossTableHeader) => void` | `undefined` | Emitted when selecting a row for sorting. |
26
+ | `selectedRow` | `CrossTableHeader` | `undefined` | Controlled selected row. |
27
+ | `rowSortAsc` | `boolean` | `true` | Sort ascending when selecting a row. |
28
+
29
+ ### Types
30
+
31
+ - `CrossTableHeader` → `{ id: string; label: string }`
32
+ - `CrossTableCell` → `{ render?:(fromId,toId,id?)=>ReactNode; value?: number|string|null; bgColor?: string; textColor?: string; fromId: string; toId: string; id?: string; editable?: boolean }`
33
+ - `CrossTableData` → `{ headerTop: CrossTableHeader[]; headerLeft: CrossTableHeader[]; data: (CrossTableCell|null)[][] }`
34
+
35
+ ---
36
+
37
+ ## Provider & Actions
38
+
39
+ Use `DataCrossTableProvider` to manage edit state across the table and expose a buttons group.
40
+
41
+ - `DataCrossTableProvider` props:
42
+ - `onConfirmedCells?(data: { editedCells: ConfirmedCell[]; toDefaultCells: ConfirmedCell[] })`
43
+ - Labels: `editConfirmLabel`, `editCancelLabel`, `editRestoreDefaultLabel`
44
+ - Flags: `initialEditMode` (default `false`), `showDefaultActionButton` (default `false`)
45
+ - Editable input labels: `cellEditTitleLabel`, `cellEditModifiedLabel`, `cellConfirmButtonLabel`, `cellCancelButtonLabel`, `cellResetButtonLabel`
46
+ - `DataCrossTableButtonsGroup`: shows Confirm/Cancel/Restore actions when `editMode=true`.
47
+
48
+ ---
49
+
50
+ ## Examples
51
+
52
+ ### Default with Provider
53
+
54
+ ```tsx
55
+ import {
56
+ DataCrossTable,
57
+ DataCrossTableProvider,
58
+ DataCrossTableButtonsGroup,
59
+ } from "laif-ds";
60
+
61
+ export function CrossEditable({ data }: { data: CrossTableData }) {
62
+ return (
63
+ <DataCrossTableProvider
64
+ initialEditMode
65
+ onConfirmedCells={(cells) => console.log(cells)}
66
+ >
67
+ {({ editMode }) => (
68
+ <div className="space-y-3">
69
+ <DataCrossTableButtonsGroup />
70
+ <DataCrossTable
71
+ crossTableData={data}
72
+ editable
73
+ editMode={editMode}
74
+ minWidthCell={200}
75
+ />
76
+ </div>
77
+ )}
78
+ </DataCrossTableProvider>
79
+ );
80
+ }
81
+ ```
82
+
83
+ ### Filterable
84
+
85
+ ```tsx
86
+ <DataCrossTableProvider>
87
+ <DataCrossTable
88
+ crossTableData={data}
89
+ filterable
90
+ minWidthCell={200}
91
+ cornerHeaderFrom="From"
92
+ cornerHeaderTo="To"
93
+ />
94
+ </DataCrossTableProvider>
95
+ ```
96
+
97
+ ### Loading State
98
+
99
+ ```tsx
100
+ <DataCrossTableProvider>
101
+ <DataCrossTable
102
+ loading
103
+ crossTableData={{ headerTop: [], headerLeft: [], data: [] }}
104
+ />
105
+ </DataCrossTableProvider>
106
+ ```
107
+
108
+ ---
109
+
110
+ ## Notes
111
+
112
+ - **Virtualization**: Rows are virtualized for performance on large datasets.
113
+ - **Sticky**: Top header row and first column are sticky; corner cell has higher z-index.
114
+ - **Editing**: Editable cells open a popover editor; edited/reset markers are shown per cell.