@erxes/ui 4.0.0-v2.1 → 4.0.0-v2.10

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 (318) hide show
  1. package/AGENTS.md +58 -0
  2. package/CATALOG.md +251 -0
  3. package/README.md +25 -2
  4. package/dist/components/accordion.d.ts +1 -0
  5. package/dist/components/accordion.js +1 -0
  6. package/dist/components/alert-dialog.d.ts +4 -0
  7. package/dist/components/alert-dialog.js +4 -0
  8. package/dist/components/alert.d.ts +1 -0
  9. package/dist/components/alert.js +1 -0
  10. package/dist/components/avatar.d.ts +2 -0
  11. package/dist/components/avatar.js +1 -0
  12. package/dist/components/background-gradient-animation.d.ts +4 -1
  13. package/dist/components/background-gradient-animation.js +4 -1
  14. package/dist/components/badge.d.ts +3 -0
  15. package/dist/components/badge.js +2 -0
  16. package/dist/components/breadcrumb.d.ts +1 -0
  17. package/dist/components/breadcrumb.js +1 -0
  18. package/dist/components/button.d.ts +6 -1
  19. package/dist/components/button.js +5 -1
  20. package/dist/components/calendar.d.ts +5 -0
  21. package/dist/components/calendar.js +4 -0
  22. package/dist/components/card.d.ts +1 -0
  23. package/dist/components/card.js +1 -0
  24. package/dist/components/chart-config.d.ts +4 -1
  25. package/dist/components/charts.d.ts +6 -0
  26. package/dist/components/charts.js +12 -3
  27. package/dist/components/checkbox.d.ts +1 -0
  28. package/dist/components/checkbox.js +1 -0
  29. package/dist/components/choicebox-group.d.ts +1 -0
  30. package/dist/components/choicebox-group.js +1 -0
  31. package/dist/components/collapsible.d.ts +1 -0
  32. package/dist/components/collapsible.js +1 -0
  33. package/dist/components/color-picker.d.ts +1 -0
  34. package/dist/components/color-picker.js +13 -6
  35. package/dist/components/combobox.d.ts +6 -1
  36. package/dist/components/combobox.js +9 -1
  37. package/dist/components/command-bar.d.ts +4 -0
  38. package/dist/components/command-bar.js +4 -0
  39. package/dist/components/command.d.ts +4 -0
  40. package/dist/components/command.js +4 -0
  41. package/dist/components/context-menu.d.ts +1 -0
  42. package/dist/components/context-menu.js +1 -0
  43. package/dist/components/copy-text.d.ts +1 -0
  44. package/dist/components/copy-text.js +1 -0
  45. package/dist/components/date-picker-value.d.ts +5 -9
  46. package/dist/components/date-picker-value.js +15 -34
  47. package/dist/components/date-picker.d.ts +4 -4
  48. package/dist/components/date-picker.js +9 -7
  49. package/dist/components/date-text-input.d.ts +2 -4
  50. package/dist/components/date-text-input.js +11 -9
  51. package/dist/components/dialog.d.ts +4 -0
  52. package/dist/components/dialog.js +5 -1
  53. package/dist/components/drag-handle.d.ts +1 -0
  54. package/dist/components/drag-handle.js +1 -0
  55. package/dist/components/dropdown-menu.d.ts +1 -0
  56. package/dist/components/dropdown-menu.js +1 -0
  57. package/dist/components/empty.d.ts +6 -1
  58. package/dist/components/empty.js +25 -2
  59. package/dist/components/form.d.ts +6 -2
  60. package/dist/components/form.js +8 -2
  61. package/dist/components/hover-card.d.ts +1 -0
  62. package/dist/components/hover-card.js +1 -0
  63. package/dist/components/icon-tip.d.ts +7 -0
  64. package/dist/components/icon-tip.js +16 -0
  65. package/dist/components/info-card.d.ts +4 -0
  66. package/dist/components/info-card.js +4 -0
  67. package/dist/components/input-group.d.ts +5 -4
  68. package/dist/components/input-group.js +5 -4
  69. package/dist/components/input.d.ts +1 -0
  70. package/dist/components/input.js +1 -0
  71. package/dist/components/kbd.d.ts +2 -1
  72. package/dist/components/kbd.js +2 -1
  73. package/dist/components/label.d.ts +1 -1
  74. package/dist/components/label.js +1 -1
  75. package/dist/components/multiselect.d.ts +1 -0
  76. package/dist/components/multiselect.js +3 -2
  77. package/dist/components/on-demand.d.ts +6 -0
  78. package/dist/components/on-demand.js +6 -0
  79. package/dist/components/popover.d.ts +4 -0
  80. package/dist/components/popover.js +4 -0
  81. package/dist/components/radio-group.d.ts +1 -0
  82. package/dist/components/radio-group.js +1 -0
  83. package/dist/components/scroll-area.d.ts +1 -0
  84. package/dist/components/scroll-area.js +1 -0
  85. package/dist/components/select.d.ts +5 -1
  86. package/dist/components/select.js +7 -1
  87. package/dist/components/separator.d.ts +4 -0
  88. package/dist/components/separator.js +4 -0
  89. package/dist/components/sheet.d.ts +4 -0
  90. package/dist/components/sheet.js +8 -4
  91. package/dist/components/sidebar/panel.js +29 -7
  92. package/dist/components/sidebar.d.ts +1 -0
  93. package/dist/components/sidebar.js +1 -0
  94. package/dist/components/skeleton.d.ts +1 -0
  95. package/dist/components/skeleton.js +1 -0
  96. package/dist/components/spinner.d.ts +1 -0
  97. package/dist/components/spinner.js +1 -0
  98. package/dist/components/string-array.js +1 -0
  99. package/dist/components/switch.d.ts +1 -0
  100. package/dist/components/switch.js +1 -0
  101. package/dist/components/table.d.ts +4 -0
  102. package/dist/components/table.js +4 -0
  103. package/dist/components/tabs.d.ts +8 -1
  104. package/dist/components/tabs.js +8 -1
  105. package/dist/components/text-overflow.d.ts +4 -1
  106. package/dist/components/text-overflow.js +4 -1
  107. package/dist/components/textarea.d.ts +1 -0
  108. package/dist/components/textarea.js +1 -0
  109. package/dist/components/toaster.d.ts +4 -1
  110. package/dist/components/toaster.js +5 -2
  111. package/dist/components/toggle-group.d.ts +5 -0
  112. package/dist/components/toggle-group.js +19 -11
  113. package/dist/components/toggle.d.ts +1 -0
  114. package/dist/components/toggle.js +1 -0
  115. package/dist/components/tooltip.d.ts +4 -0
  116. package/dist/components/tooltip.js +4 -0
  117. package/dist/components/upload.d.ts +4 -0
  118. package/dist/components/upload.js +20 -11
  119. package/dist/federation.d.ts +8 -1
  120. package/dist/federation.js +12 -2
  121. package/dist/hooks/use-item-keys.d.ts +11 -0
  122. package/dist/hooks/use-item-keys.js +24 -0
  123. package/dist/hooks/use-page-hotkey.d.ts +12 -0
  124. package/dist/hooks/use-page-hotkey.js +22 -0
  125. package/dist/hooks/use-toast.d.ts +5 -0
  126. package/dist/hooks/use-toast.js +5 -0
  127. package/dist/index.d.ts +33 -6
  128. package/dist/index.js +31 -4
  129. package/dist/lib/format.d.ts +60 -0
  130. package/dist/lib/format.js +86 -0
  131. package/dist/lib/money.d.ts +13 -0
  132. package/dist/lib/money.js +21 -0
  133. package/dist/lib/stored.d.ts +13 -0
  134. package/dist/lib/stored.js +41 -0
  135. package/dist/lib/text.d.ts +11 -0
  136. package/dist/lib/text.js +18 -0
  137. package/dist/modules/attachments/use-carousel.js +5 -10
  138. package/dist/modules/blocks/hooks/useBarcodeSizeForm.d.ts +1 -1
  139. package/dist/modules/blocks/utils/parseBlocks.d.ts +1 -1
  140. package/dist/modules/blocks/utils/parseBlocks.js +1 -1
  141. package/dist/modules/conditions/ConditionValueInput.d.ts +10 -0
  142. package/dist/modules/conditions/ConditionValueInput.js +166 -0
  143. package/dist/modules/conditions/ConditionsEditor.d.ts +11 -0
  144. package/dist/modules/conditions/ConditionsEditor.js +209 -0
  145. package/dist/modules/conditions/LazyConditionsEditor.d.ts +10 -0
  146. package/dist/modules/conditions/LazyConditionsEditor.js +11 -0
  147. package/dist/modules/conditions/PathPicker.d.ts +8 -0
  148. package/dist/modules/conditions/PathPicker.js +51 -0
  149. package/dist/modules/conditions/conditions.d.ts +66 -0
  150. package/dist/modules/conditions/conditions.js +136 -0
  151. package/dist/modules/display/components/EmailDisplay.d.ts +4 -0
  152. package/dist/modules/display/components/EmailDisplay.js +6 -3
  153. package/dist/modules/display/components/PhoneDisplay.d.ts +4 -0
  154. package/dist/modules/display/components/PhoneDisplay.js +4 -0
  155. package/dist/modules/display/components/RelativeDateDisplay.d.ts +7 -5
  156. package/dist/modules/display/components/RelativeDateDisplay.js +10 -8
  157. package/dist/modules/display/components/SexDisplay.d.ts +1 -0
  158. package/dist/modules/display/components/SexDisplay.js +1 -0
  159. package/dist/modules/filter/components/Filter.d.ts +4 -0
  160. package/dist/modules/filter/components/Filter.js +4 -0
  161. package/dist/modules/filter/components/FilterBar.js +5 -7
  162. package/dist/modules/filter/components/FilterDialog.js +4 -5
  163. package/dist/modules/filter/components/FilterPopover.js +1 -1
  164. package/dist/modules/filter/components/FilterProvider.d.ts +1 -2
  165. package/dist/modules/filter/components/FilterProvider.js +22 -16
  166. package/dist/modules/filter/hooks/useFilterContext.d.ts +1 -0
  167. package/dist/modules/filter/hooks/useFilterContext.js +1 -0
  168. package/dist/modules/filter/types/filter.d.ts +0 -1
  169. package/dist/modules/hotkey/components/PopoverScoped.d.ts +5 -0
  170. package/dist/modules/hotkey/components/PopoverScoped.js +5 -0
  171. package/dist/modules/hotkey/hooks/usePreviousHotkeyScope.d.ts +1 -0
  172. package/dist/modules/hotkey/hooks/usePreviousHotkeyScope.js +1 -0
  173. package/dist/modules/hotkey/hooks/useScopedHotkeys.d.ts +5 -1
  174. package/dist/modules/hotkey/hooks/useScopedHotkeys.js +5 -1
  175. package/dist/modules/icons/components/IconComponent.d.ts +4 -0
  176. package/dist/modules/icons/components/IconComponent.js +4 -0
  177. package/dist/modules/icons/components/IconPicker.d.ts +4 -0
  178. package/dist/modules/icons/components/IconPicker.js +7 -5
  179. package/dist/modules/icons/providers/IconsProvider.d.ts +1 -0
  180. package/dist/modules/icons/providers/IconsProvider.js +1 -0
  181. package/dist/modules/inputs/components/EmailField.d.ts +4 -1
  182. package/dist/modules/inputs/components/EmailField.js +4 -1
  183. package/dist/modules/inputs/components/FullNameField.d.ts +6 -0
  184. package/dist/modules/inputs/components/FullNameField.js +20 -8
  185. package/dist/modules/inputs/components/PhoneField.d.ts +4 -1
  186. package/dist/modules/inputs/components/PhoneField.js +4 -1
  187. package/dist/modules/inputs/components/SexField.d.ts +1 -0
  188. package/dist/modules/inputs/components/SexField.js +1 -0
  189. package/dist/modules/layout/components/AppLayout.d.ts +6 -6
  190. package/dist/modules/layout/components/AppLayout.js +12 -13
  191. package/dist/modules/layout/components/AppLayoutResizeHandle.d.ts +5 -12
  192. package/dist/modules/layout/components/AppLayoutResizeHandle.js +15 -18
  193. package/dist/modules/layout/components/Page.d.ts +5 -0
  194. package/dist/modules/layout/components/Page.js +5 -0
  195. package/dist/modules/layout/components/PageHeader.d.ts +4 -1
  196. package/dist/modules/layout/components/PageHeader.js +9 -3
  197. package/dist/modules/list/DisplayMenu.d.ts +24 -0
  198. package/dist/modules/list/DisplayMenu.js +87 -0
  199. package/dist/modules/list/ListFilter.d.ts +63 -0
  200. package/dist/modules/list/ListFilter.js +44 -0
  201. package/dist/modules/list/ViewBar.d.ts +13 -0
  202. package/dist/modules/list/ViewBar.js +30 -0
  203. package/dist/modules/list/filter/AdvancedFilterDialog.d.ts +5 -0
  204. package/dist/modules/list/filter/AdvancedFilterDialog.js +52 -0
  205. package/dist/modules/list/filter/FieldMenus.d.ts +5 -0
  206. package/dist/modules/list/filter/FieldMenus.js +184 -0
  207. package/dist/modules/list/filter/ListFilterBar.d.ts +6 -0
  208. package/dist/modules/list/filter/ListFilterBar.js +246 -0
  209. package/dist/modules/list/filter/RecordCount.d.ts +7 -0
  210. package/dist/modules/list/filter/RecordCount.js +22 -0
  211. package/dist/modules/list/filter/RuleChips.d.ts +2 -0
  212. package/dist/modules/list/filter/RuleChips.js +157 -0
  213. package/dist/modules/list/filter/fieldIcons.d.ts +7 -0
  214. package/dist/modules/list/filter/fieldIcons.js +16 -0
  215. package/dist/modules/list/filter/filterRules.d.ts +46 -0
  216. package/dist/modules/list/filter/filterRules.js +166 -0
  217. package/dist/modules/list/filter/listFilterContext.d.ts +29 -0
  218. package/dist/modules/list/filter/listFilterContext.js +34 -0
  219. package/dist/modules/list/filter/listFilterQuery.d.ts +16 -0
  220. package/dist/modules/list/filter/listFilterQuery.js +22 -0
  221. package/dist/modules/navigation-menu/components/NavigationMenu.d.ts +4 -3
  222. package/dist/modules/navigation-menu/components/NavigationMenu.js +7 -7
  223. package/dist/modules/pickers/EntityPicker.d.ts +37 -0
  224. package/dist/modules/pickers/EntityPicker.js +67 -0
  225. package/dist/modules/pickers/LookupPicker.d.ts +51 -0
  226. package/dist/modules/pickers/LookupPicker.js +84 -0
  227. package/dist/modules/pickers/SelectMember.d.ts +41 -0
  228. package/dist/modules/pickers/SelectMember.js +122 -0
  229. package/dist/modules/pickers/members.d.ts +30 -0
  230. package/dist/modules/pickers/members.js +18 -0
  231. package/dist/modules/record-field/components/NumberField.d.ts +5 -0
  232. package/dist/modules/record-field/components/NumberField.js +14 -7
  233. package/dist/modules/record-field/components/TextField.d.ts +4 -0
  234. package/dist/modules/record-field/components/TextField.js +14 -3
  235. package/dist/modules/record-field/meta-inputs/components/PhoneInput.d.ts +5 -0
  236. package/dist/modules/record-field/meta-inputs/components/PhoneInput.js +5 -0
  237. package/dist/modules/record-list/RecordList.d.ts +18 -0
  238. package/dist/modules/record-list/RecordList.js +23 -0
  239. package/dist/modules/record-list/RecordListProvider.d.ts +30 -0
  240. package/dist/modules/record-list/RecordListProvider.js +57 -0
  241. package/dist/modules/record-list/RecordListRoot.d.ts +28 -0
  242. package/dist/modules/record-list/RecordListRoot.js +124 -0
  243. package/dist/modules/record-list/selection.d.ts +22 -0
  244. package/dist/modules/record-list/selection.js +54 -0
  245. package/dist/modules/record-panel/PanelDescriptionEditor.d.ts +9 -0
  246. package/dist/modules/record-panel/PanelDescriptionEditor.js +39 -0
  247. package/dist/modules/record-panel/PanelDescriptionField.d.ts +13 -0
  248. package/dist/modules/record-panel/PanelDescriptionField.js +39 -0
  249. package/dist/modules/record-panel/PanelField.d.ts +17 -0
  250. package/dist/modules/record-panel/PanelField.js +47 -0
  251. package/dist/modules/record-panel/PanelForm.d.ts +22 -0
  252. package/dist/modules/record-panel/PanelForm.js +81 -0
  253. package/dist/modules/record-panel/PanelLabel.d.ts +10 -0
  254. package/dist/modules/record-panel/PanelLabel.js +55 -0
  255. package/dist/modules/record-panel/PanelSection.d.ts +12 -0
  256. package/dist/modules/record-panel/PanelSection.js +24 -0
  257. package/dist/modules/record-panel/panelExpansion.d.ts +10 -0
  258. package/dist/modules/record-panel/panelExpansion.js +7 -0
  259. package/dist/modules/record-panel/useSaveOnLeave.d.ts +14 -0
  260. package/dist/modules/record-panel/useSaveOnLeave.js +42 -0
  261. package/dist/modules/record-table/components/RecordTable.d.ts +6 -0
  262. package/dist/modules/record-table/components/RecordTable.js +6 -0
  263. package/dist/modules/record-table/components/RecordTableCell.d.ts +9 -0
  264. package/dist/modules/record-table/components/RecordTableCell.js +16 -2
  265. package/dist/modules/record-table/components/RecordTableCellInline.d.ts +5 -0
  266. package/dist/modules/record-table/components/RecordTableCellInline.js +8 -7
  267. package/dist/modules/record-table/components/RecordTableCursor.js +30 -28
  268. package/dist/modules/record-table/components/RecordTableProvider.js +12 -7
  269. package/dist/modules/record-table/hooks/useTablePreferences.d.ts +1 -1
  270. package/dist/modules/record-table/hooks/useTablePreferences.js +18 -31
  271. package/dist/modules/record-table/states/RecordTableCursorState.d.ts +21 -1
  272. package/dist/modules/record-table/states/RecordTableCursorState.js +21 -3
  273. package/dist/modules/record-table/types/RecordTableCursorTypes.d.ts +1 -0
  274. package/dist/modules/record-table/types/RecordTableCursorTypes.js +1 -0
  275. package/dist/modules/records/ContactLink.d.ts +13 -0
  276. package/dist/modules/records/ContactLink.js +77 -0
  277. package/dist/modules/records/contacts.d.ts +35 -0
  278. package/dist/modules/records/contacts.js +10 -0
  279. package/dist/modules/records/openRecord.d.ts +44 -0
  280. package/dist/modules/records/openRecord.js +48 -0
  281. package/dist/state/sidebarPanelState.d.ts +5 -1
  282. package/dist/state/sidebarPanelState.js +11 -3
  283. package/dist/state/themeState.d.ts +13 -2
  284. package/dist/state/themeState.js +18 -4
  285. package/dist/theme.css +5 -2
  286. package/dist/types/SexCode.d.ts +1 -0
  287. package/dist/types/SexCode.js +1 -0
  288. package/dist/types/UIConfig.d.ts +131 -3
  289. package/dist/utils/IsUndefinedOrNull.d.ts +1 -0
  290. package/dist/utils/IsUndefinedOrNull.js +1 -0
  291. package/dist/utils/file-storage.d.ts +1 -0
  292. package/dist/utils/file-storage.js +1 -0
  293. package/dist/utils/format/formatPhoneNumber.d.ts +4 -0
  294. package/dist/utils/format/formatPhoneNumber.js +4 -0
  295. package/dist/utils/getPluginAssetsUrl.d.ts +5 -0
  296. package/dist/utils/getPluginAssetsUrl.js +5 -0
  297. package/dist/utils/host-component.d.ts +10 -0
  298. package/dist/utils/host-component.js +34 -0
  299. package/dist/utils/json.d.ts +3 -2
  300. package/dist/utils/json.js +3 -2
  301. package/dist/utils/plugin-runtime.d.ts +21 -17
  302. package/dist/utils/plugin-runtime.js +59 -12
  303. package/dist/utils/plugin-styles.d.ts +7 -0
  304. package/dist/utils/plugin-styles.js +54 -0
  305. package/dist/utils/record-timeline.d.ts +10 -9
  306. package/dist/utils/record-timeline.js +12 -17
  307. package/exports.txt +226 -0
  308. package/package.json +13 -3
  309. package/dist/constants/IntlLanguages.d.ts +0 -74
  310. package/dist/constants/IntlLanguages.js +0 -76
  311. package/dist/hooks/use-query-state.d.ts +0 -16
  312. package/dist/hooks/use-query-state.js +0 -122
  313. package/dist/modules/filter/hooks/useFilterQueryState.d.ts +0 -4
  314. package/dist/modules/filter/hooks/useFilterQueryState.js +0 -14
  315. package/dist/types/Theme.d.ts +0 -1
  316. package/dist/types/Theme.js +0 -0
  317. package/dist/utils/localization/formatDateISOStringToRelativeDate.d.ts +0 -2
  318. package/dist/utils/localization/formatDateISOStringToRelativeDate.js +0 -16
@@ -0,0 +1,54 @@
1
+ // src/modules/record-list/selection.ts
2
+ /**
3
+ * The rows a click on `id` picks. With `anchor` (the row clicked before), every row from it to
4
+ * `id` in `order`, the rows as shown; without, or when either left the list, `id` alone.
5
+ */
6
+ const rowsBetween = (order, anchor, id) => {
7
+ const from = anchor === null ? -1 : order.indexOf(anchor);
8
+ const to = order.indexOf(id);
9
+ if (from === -1 || to === -1) return [id];
10
+ return order.slice(Math.min(from, to), Math.max(from, to) + 1);
11
+ };
12
+ /** `picked` with `ids` added (`on`) or taken out. */
13
+ const withRows = (picked, ids, on) => {
14
+ const next = new Set(picked);
15
+ for (const id of ids) if (on) next.add(id);
16
+ else next.delete(id);
17
+ return next;
18
+ };
19
+ /**
20
+ * One list's picked rows, outside React: each row subscribes to its own state, so a click
21
+ * renders only the rows it changes. Every change starts from the current state, so changes
22
+ * made before a render all count.
23
+ */
24
+ const createSelection = () => {
25
+ let picked = /* @__PURE__ */ new Set();
26
+ let anchor = null;
27
+ const listeners = /* @__PURE__ */ new Set();
28
+ const set = (next) => {
29
+ picked = next;
30
+ for (const listener of listeners) listener();
31
+ };
32
+ return {
33
+ subscribe: (listener) => {
34
+ listeners.add(listener);
35
+ return () => {
36
+ listeners.delete(listener);
37
+ };
38
+ },
39
+ picked: () => picked,
40
+ /** With `order` (the rows as shown), a shift-click: every row since the last click. */
41
+ toggle: (id, order) => {
42
+ const rows = order ? rowsBetween(order, anchor, id) : [id];
43
+ anchor = id;
44
+ set(withRows(picked, rows, !picked.has(id)));
45
+ },
46
+ /** Picks all of `ids`, or clears them when all are picked. */
47
+ toggleAll: (ids) => set(withRows(picked, ids, !ids.every((id) => picked.has(id)))),
48
+ clear: () => {
49
+ anchor = null;
50
+ set(/* @__PURE__ */ new Set());
51
+ }
52
+ };
53
+ };
54
+ export { createSelection, rowsBetween, withRows };
@@ -0,0 +1,9 @@
1
+ /** A record's description as a full-size tab. It saves when the editor loses focus. */
2
+ export declare const PanelDescriptionEditor: ({ value, scope, readonly, isHTML, onSave }: {
3
+ value: string;
4
+ scope: string;
5
+ readonly?: boolean;
6
+ /** Stores HTML instead of the editor's blocks. */
7
+ isHTML?: boolean;
8
+ onSave: (description: string) => void;
9
+ }) => import("react").JSX.Element;
@@ -0,0 +1,39 @@
1
+ import { usePageHotkey } from "../../hooks/use-page-hotkey.js";
2
+ import { Editor } from "../blocks/components/LazyEditor.js";
3
+ import { useSaveOnLeave } from "./useSaveOnLeave.js";
4
+ import { jsx } from "react/jsx-runtime";
5
+ // src/modules/record-panel/PanelDescriptionEditor.tsx
6
+ /** The editor inside `container`, when it is shown (an inactive tab's panel is `hidden`). */
7
+ const visibleEditor = (container) => {
8
+ const editor = container?.querySelector("[contenteditable=\"true\"]");
9
+ if (!editor?.getClientRects().length) return null;
10
+ return editor.closest("[hidden], [inert]") ? null : editor;
11
+ };
12
+ /** `/` focuses the description editor, unless it is read-only or not shown (another panel's may be). */
13
+ const useSlashFocus = (containerRef, readonly) => usePageHotkey("/", () => visibleEditor(containerRef.current)?.focus(), {
14
+ useKey: true,
15
+ when: () => !readonly && visibleEditor(containerRef.current) !== null
16
+ });
17
+ /** A record's description as a full-size tab. It saves when the editor loses focus. */
18
+ const PanelDescriptionEditor = ({ value, scope, readonly, isHTML, onSave }) => {
19
+ const { containerRef, onChange } = useSaveOnLeave({
20
+ value,
21
+ readonly,
22
+ onSave
23
+ });
24
+ useSlashFocus(containerRef, readonly);
25
+ return /* @__PURE__ */ jsx("div", {
26
+ ref: containerRef,
27
+ className: "flex min-h-0 flex-1 flex-col p-3",
28
+ children: /* @__PURE__ */ jsx(Editor, {
29
+ initialContent: value,
30
+ onChange,
31
+ scope,
32
+ readonly,
33
+ isHTML,
34
+ variant: "default",
35
+ className: "h-full min-h-0 flex-1 [&_.bn-container]:h-full [&_.bn-editor]:min-h-full"
36
+ })
37
+ });
38
+ };
39
+ export { PanelDescriptionEditor };
@@ -0,0 +1,13 @@
1
+ /**
2
+ * A rich-text description row in the side panel, across its width.
3
+ * Like the other cells it saves when you leave it, never while typing.
4
+ */
5
+ export declare const PanelDescriptionField: ({ label, value, scope, readonly, isHTML, onSave }: {
6
+ label: string;
7
+ value: string;
8
+ scope: string;
9
+ readonly?: boolean;
10
+ /** Stores HTML instead of the editor's blocks. */
11
+ isHTML?: boolean;
12
+ onSave: (value: string) => void;
13
+ }) => import("react").JSX.Element;
@@ -0,0 +1,39 @@
1
+ import { Editor } from "../blocks/components/LazyEditor.js";
2
+ import { useSaveOnLeave } from "./useSaveOnLeave.js";
3
+ import { IconAlignLeft } from "@tabler/icons-react";
4
+ import { jsx, jsxs } from "react/jsx-runtime";
5
+ // src/modules/record-panel/PanelDescriptionField.tsx
6
+ /**
7
+ * A rich-text description row in the side panel, across its width.
8
+ * Like the other cells it saves when you leave it, never while typing.
9
+ */
10
+ const PanelDescriptionField = ({ label, value, scope, readonly, isHTML, onSave }) => {
11
+ const { containerRef, onChange } = useSaveOnLeave({
12
+ value,
13
+ readonly,
14
+ onSave
15
+ });
16
+ return /* @__PURE__ */ jsxs("div", {
17
+ className: "flex flex-col gap-1.5 pt-2",
18
+ children: [/* @__PURE__ */ jsxs("span", {
19
+ className: "flex items-center gap-1.5 text-xs font-medium text-accent-foreground",
20
+ children: [/* @__PURE__ */ jsx(IconAlignLeft, {
21
+ className: "size-3.5 shrink-0",
22
+ "aria-hidden": "true"
23
+ }), label]
24
+ }), /* @__PURE__ */ jsx("div", {
25
+ ref: containerRef,
26
+ children: /* @__PURE__ */ jsx(Editor, {
27
+ initialContent: value,
28
+ onChange,
29
+ scope,
30
+ label,
31
+ readonly,
32
+ isHTML,
33
+ variant: "ghost",
34
+ className: "h-auto min-h-20"
35
+ })
36
+ })]
37
+ });
38
+ };
39
+ export { PanelDescriptionField };
@@ -0,0 +1,17 @@
1
+ import { RecordTableInlineCell } from "../record-table/components/RecordTableCellInline.js";
2
+ import { Icon } from "@tabler/icons-react";
3
+ /**
4
+ * A side panel row: icon and label, then the value as a table cell.
5
+ * Click to edit; Enter saves and Escape cancels, as in the list. `cell={false}` keeps a value's
6
+ * own layout, such as an avatar upload.
7
+ */
8
+ export declare const PanelField: ({ label, icon: Icon, children, placeholder, htmlFor, cell }: {
9
+ label: React.ReactNode;
10
+ icon?: Icon;
11
+ placeholder?: React.ReactNode;
12
+ htmlFor?: string;
13
+ children: React.ReactNode;
14
+ cell?: boolean;
15
+ }) => import("react").JSX.Element;
16
+ /** A table cell trigger with the side panel's rounded hover. */
17
+ export declare const PanelFieldTrigger: (props: React.ComponentProps<typeof RecordTableInlineCell.Trigger>) => import("react").JSX.Element;
@@ -0,0 +1,47 @@
1
+ import { Label } from "../../components/label.js";
2
+ import { cn } from "../../lib/utils.js";
3
+ import { RecordTableInlineCell } from "../record-table/components/RecordTableCellInline.js";
4
+ import { PanelLabel } from "./PanelLabel.js";
5
+ import { IconForms } from "@tabler/icons-react";
6
+ import { jsx, jsxs } from "react/jsx-runtime";
7
+ import { useId } from "react";
8
+ // src/modules/record-panel/PanelField.tsx
9
+ /**
10
+ * A side panel row: icon and label, then the value as a table cell.
11
+ * Click to edit; Enter saves and Escape cancels, as in the list. `cell={false}` keeps a value's
12
+ * own layout, such as an avatar upload.
13
+ */
14
+ const PanelField = ({ label, icon: Icon = IconForms, children, placeholder, htmlFor, cell = true }) => {
15
+ const labelId = useId();
16
+ return /* @__PURE__ */ jsxs("div", {
17
+ className: "grid grid-cols-field items-center gap-x-2 min-h-7",
18
+ children: [/* @__PURE__ */ jsxs(Label, {
19
+ id: labelId,
20
+ htmlFor,
21
+ variant: "muted",
22
+ className: "flex min-w-0 items-center",
23
+ children: [Icon && /* @__PURE__ */ jsx(Icon, {
24
+ className: "size-3.5 shrink-0",
25
+ "aria-hidden": "true"
26
+ }), /* @__PURE__ */ jsx(PanelLabel, { children: label })]
27
+ }), /* @__PURE__ */ jsxs("div", {
28
+ className: cn("relative min-w-0", cell && "text-xs [&_button:not([role=switch],[data-panel-inline])]:h-7 [&_button:not([role=switch])]:text-xs [&_input]:text-xs"),
29
+ children: [/* @__PURE__ */ jsx(RecordTableInlineCell.LabelledBy, {
30
+ value: labelId,
31
+ children
32
+ }), placeholder && /* @__PURE__ */ jsxs("span", {
33
+ className: "pointer-events-none absolute inset-y-0 left-2 flex items-center gap-1.5 text-xs text-muted-foreground",
34
+ children: [/* @__PURE__ */ jsx(Icon, {
35
+ className: "size-3.5 shrink-0",
36
+ "aria-hidden": "true"
37
+ }), placeholder]
38
+ })]
39
+ })]
40
+ });
41
+ };
42
+ /** A table cell trigger with the side panel's rounded hover. */
43
+ const PanelFieldTrigger = (props) => /* @__PURE__ */ jsx(RecordTableInlineCell.Trigger, {
44
+ variant: "field",
45
+ ...props
46
+ });
47
+ export { PanelField, PanelFieldTrigger };
@@ -0,0 +1,22 @@
1
+ import { Icon } from "@tabler/icons-react";
2
+ /**
3
+ * One field of a new record's form, laid out like `PanelField`.
4
+ * Its label, then the input, with the field's error under it.
5
+ */
6
+ export declare const PanelFormRow: ({ label, icon: Icon, required, error, children }: {
7
+ label: React.ReactNode;
8
+ icon?: Icon;
9
+ required?: boolean;
10
+ error?: string;
11
+ children: React.ReactNode;
12
+ }) => import("react").JSX.Element;
13
+ /**
14
+ * A new record's form in the side panel: its rows, then Cancel and Save.
15
+ * Nothing is saved until Save.
16
+ */
17
+ export declare const PanelFormLayout: ({ children, onCancel, saving, saveLabel }: {
18
+ children: React.ReactNode;
19
+ onCancel: () => void;
20
+ saving?: boolean;
21
+ saveLabel?: string;
22
+ }) => import("react").JSX.Element;
@@ -0,0 +1,81 @@
1
+ import { Button } from "../../components/button.js";
2
+ import { Spinner } from "../../components/spinner.js";
3
+ import { RecordTableInlineCell } from "../record-table/components/RecordTableCellInline.js";
4
+ import { PanelLabel } from "./PanelLabel.js";
5
+ import { IconForms } from "@tabler/icons-react";
6
+ import { jsx, jsxs } from "react/jsx-runtime";
7
+ import { useId } from "react";
8
+ import { useTranslation } from "react-i18next";
9
+ // src/modules/record-panel/PanelForm.tsx
10
+ /**
11
+ * One field of a new record's form, laid out like `PanelField`.
12
+ * Its label, then the input, with the field's error under it.
13
+ */
14
+ const PanelFormRow = ({ label, icon: Icon = IconForms, required, error, children }) => {
15
+ const labelId = useId();
16
+ return /* @__PURE__ */ jsxs("div", {
17
+ className: "grid grid-cols-field items-center gap-x-2 gap-y-0.5 min-h-7",
18
+ children: [
19
+ /* @__PURE__ */ jsxs("span", {
20
+ id: labelId,
21
+ className: "flex min-w-0 items-center gap-1.5 text-xs font-medium text-accent-foreground",
22
+ children: [/* @__PURE__ */ jsx(Icon, {
23
+ className: "size-3.5 shrink-0",
24
+ "aria-hidden": "true"
25
+ }), /* @__PURE__ */ jsxs(PanelLabel, {
26
+ tooltip: label,
27
+ children: [label, required && /* @__PURE__ */ jsx("span", {
28
+ className: "text-destructive",
29
+ children: " *"
30
+ })]
31
+ })]
32
+ }),
33
+ /* @__PURE__ */ jsxs("div", {
34
+ className: "group/panel-value relative min-w-0 text-xs [&_button:not([role=switch])]:text-xs [&_input:placeholder-shown]:pl-7",
35
+ children: [/* @__PURE__ */ jsx(Icon, {
36
+ className: "pointer-events-none absolute left-2 top-1/2 z-1 hidden size-3.5 -translate-y-1/2 text-muted-foreground group-has-[input:placeholder-shown]/panel-value:block",
37
+ "aria-hidden": "true"
38
+ }), /* @__PURE__ */ jsx(RecordTableInlineCell.LabelledBy, {
39
+ value: labelId,
40
+ children
41
+ })]
42
+ }),
43
+ error && /* @__PURE__ */ jsx("span", {
44
+ className: "col-start-2 text-xs text-destructive",
45
+ children: error
46
+ })
47
+ ]
48
+ });
49
+ };
50
+ /**
51
+ * A new record's form in the side panel: its rows, then Cancel and Save.
52
+ * Nothing is saved until Save.
53
+ */
54
+ const PanelFormLayout = ({ children, onCancel, saving, saveLabel }) => {
55
+ const { t } = useTranslation("common", { keyPrefix: "side-panel" });
56
+ return /* @__PURE__ */ jsxs("div", {
57
+ className: "flex flex-1 min-h-0 flex-col",
58
+ children: [/* @__PURE__ */ jsx("div", {
59
+ className: "flex-1 min-h-0 overflow-y-auto",
60
+ children: /* @__PURE__ */ jsx("div", {
61
+ className: "flex flex-col gap-1 p-3",
62
+ children
63
+ })
64
+ }), /* @__PURE__ */ jsxs("div", {
65
+ className: "flex shrink-0 justify-end gap-1 border-t bg-background p-2",
66
+ children: [/* @__PURE__ */ jsx(Button, {
67
+ type: "button",
68
+ variant: "ghost",
69
+ size: "sm",
70
+ onClick: onCancel,
71
+ children: t("cancel", "Cancel")
72
+ }), /* @__PURE__ */ jsxs(Button, {
73
+ type: "submit",
74
+ size: "sm",
75
+ disabled: saving,
76
+ children: [saving && /* @__PURE__ */ jsx(Spinner, { size: "sm" }), saveLabel || t("save", "Save")]
77
+ })]
78
+ })]
79
+ });
80
+ };
81
+ export { PanelFormLayout, PanelFormRow };
@@ -0,0 +1,10 @@
1
+ /**
2
+ * A side panel label cut at two lines, with the full text on hover.
3
+ * On the record's own page (`usePanelExpanded`) it shows in full. `tooltip` replaces the hover
4
+ * text.
5
+ */
6
+ export declare const PanelLabel: ({ children, tooltip, className }: {
7
+ children: React.ReactNode;
8
+ tooltip?: React.ReactNode;
9
+ className?: string;
10
+ }) => import("react").JSX.Element;
@@ -0,0 +1,55 @@
1
+ import { Tooltip } from "../../components/tooltip.js";
2
+ import { cn } from "../../lib/utils.js";
3
+ import { usePanelExpanded } from "./panelExpansion.js";
4
+ import { jsx, jsxs } from "react/jsx-runtime";
5
+ import { useEffect, useRef, useState } from "react";
6
+ // src/modules/record-panel/PanelLabel.tsx
7
+ /** Whether the label is cut off; the observers see the clamp come and go with the panel width. */
8
+ const useIsClamped = () => {
9
+ const ref = useRef(null);
10
+ const [isClamped, setIsClamped] = useState(false);
11
+ useEffect(() => {
12
+ const element = ref.current;
13
+ if (!element) return;
14
+ const check = () => setIsClamped(element.scrollHeight > element.clientHeight + 1);
15
+ const resizeObserver = new ResizeObserver(check);
16
+ const contentObserver = new MutationObserver(check);
17
+ check();
18
+ resizeObserver.observe(element);
19
+ contentObserver.observe(element, {
20
+ childList: true,
21
+ subtree: true,
22
+ characterData: true
23
+ });
24
+ return () => {
25
+ resizeObserver.disconnect();
26
+ contentObserver.disconnect();
27
+ };
28
+ }, []);
29
+ return {
30
+ ref,
31
+ isClamped
32
+ };
33
+ };
34
+ /**
35
+ * A side panel label cut at two lines, with the full text on hover.
36
+ * On the record's own page (`usePanelExpanded`) it shows in full. `tooltip` replaces the hover
37
+ * text.
38
+ */
39
+ const PanelLabel = ({ children, tooltip, className }) => {
40
+ const expanded = usePanelExpanded();
41
+ const { ref, isClamped } = useIsClamped();
42
+ const showTooltip = isClamped && !expanded;
43
+ return /* @__PURE__ */ jsx(Tooltip.Provider, {
44
+ delay: 100,
45
+ children: /* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(Tooltip.Trigger, {
46
+ render: /* @__PURE__ */ jsx("span", { className: cn("my-1 block min-w-0 wrap-break-word", className) }),
47
+ children: /* @__PURE__ */ jsx("span", {
48
+ ref,
49
+ className: cn("block", !expanded && "line-clamp-2"),
50
+ children
51
+ })
52
+ }), showTooltip && /* @__PURE__ */ jsx(Tooltip.Content, { children: tooltip ?? children })] })
53
+ });
54
+ };
55
+ export { PanelLabel };
@@ -0,0 +1,12 @@
1
+ import { ElementType, ReactNode } from "react";
2
+ /**
3
+ * A plain heading that groups the side panel's rows.
4
+ * It separates a record's fields, tags and linked records.
5
+ */
6
+ export declare const PanelSection: ({ title, icon: Icon, children, nested }: {
7
+ title: string;
8
+ /** Beside the title, as a plugin's section has it. */
9
+ icon?: ElementType;
10
+ children: ReactNode;
11
+ nested?: boolean;
12
+ }) => import("react").JSX.Element;
@@ -0,0 +1,24 @@
1
+ import { cn } from "../../lib/utils.js";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ // src/modules/record-panel/PanelSection.tsx
4
+ /**
5
+ * A plain heading that groups the side panel's rows.
6
+ * It separates a record's fields, tags and linked records.
7
+ */
8
+ const PanelSection = ({ title, icon: Icon, children, nested = false }) => /* @__PURE__ */ jsxs("section", {
9
+ className: cn("pt-1", !nested && "border-b last:border-b-0"),
10
+ children: [/* @__PURE__ */ jsxs("h3", {
11
+ className: cn("flex items-center gap-1.5 text-xs", nested ? "h-7 px-1 font-normal text-muted-foreground" : "h-10 px-3 font-medium"),
12
+ children: [Icon && /* @__PURE__ */ jsx(Icon, {
13
+ className: "size-3.5 flex-none text-muted-foreground",
14
+ "aria-hidden": "true"
15
+ }), title]
16
+ }), /* @__PURE__ */ jsx("div", {
17
+ className: cn("min-w-0", nested ? "pb-1" : "px-3 pb-2"),
18
+ children: /* @__PURE__ */ jsx("div", {
19
+ className: "flex min-w-0 flex-col gap-1",
20
+ children
21
+ })
22
+ })]
23
+ });
24
+ export { PanelSection };
@@ -0,0 +1,10 @@
1
+ /** Whether the nearest record panel fills a page, and how to switch it. */
2
+ type PanelExpansion = {
3
+ expanded: boolean;
4
+ toggle?: () => void;
5
+ } | null;
6
+ /** Provided by the host's record panel; erxes-ui's panel parts read it. */
7
+ export declare const PanelExpansionContext: import("react").Context<PanelExpansion>;
8
+ /** Whether the record shows at full size on its own page. A slot can lay out wider then. */
9
+ export declare const usePanelExpanded: () => boolean;
10
+ export {};
@@ -0,0 +1,7 @@
1
+ import { createContext, useContext } from "react";
2
+ // src/modules/record-panel/panelExpansion.ts
3
+ /** Provided by the host's record panel; erxes-ui's panel parts read it. */
4
+ const PanelExpansionContext = createContext(null);
5
+ /** Whether the record shows at full size on its own page. A slot can lay out wider then. */
6
+ const usePanelExpanded = () => useContext(PanelExpansionContext)?.expanded ?? false;
7
+ export { PanelExpansionContext, usePanelExpanded };
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Saves a description editor when you click or tab anywhere outside it, never while
3
+ * typing. Focus can't be trusted to leave the editor first: closing the image preview
4
+ * or a toolbar menu drops it on the page. An edit that arrives while focus is already
5
+ * outside, such as an upload that finishes after you moved on, saves right away.
6
+ */
7
+ export declare const useSaveOnLeave: ({ value, readonly, onSave }: {
8
+ value: string;
9
+ readonly?: boolean;
10
+ onSave: (value: string) => void;
11
+ }) => {
12
+ containerRef: import("react").RefObject<HTMLDivElement | null>;
13
+ onChange: (next: string) => void;
14
+ };
@@ -0,0 +1,42 @@
1
+ import { useEffect, useRef } from "react";
2
+ // src/modules/record-panel/useSaveOnLeave.ts
3
+ /**
4
+ * Saves a description editor when you click or tab anywhere outside it, never while
5
+ * typing. Focus can't be trusted to leave the editor first: closing the image preview
6
+ * or a toolbar menu drops it on the page. An edit that arrives while focus is already
7
+ * outside, such as an upload that finishes after you moved on, saves right away.
8
+ */
9
+ const useSaveOnLeave = ({ value, readonly, onSave }) => {
10
+ const containerRef = useRef(null);
11
+ const latest = useRef(value);
12
+ const saved = useRef(value);
13
+ useEffect(() => {
14
+ latest.current = value;
15
+ saved.current = value;
16
+ }, [value]);
17
+ const save = () => {
18
+ if (readonly || latest.current === saved.current) return;
19
+ saved.current = latest.current;
20
+ onSave(latest.current);
21
+ };
22
+ useEffect(() => {
23
+ const leave = (event) => {
24
+ if (event.target instanceof Node && containerRef.current?.contains(event.target)) return;
25
+ save();
26
+ };
27
+ document.addEventListener("pointerdown", leave, true);
28
+ document.addEventListener("focusin", leave);
29
+ return () => {
30
+ document.removeEventListener("pointerdown", leave, true);
31
+ document.removeEventListener("focusin", leave);
32
+ };
33
+ });
34
+ return {
35
+ containerRef,
36
+ onChange: (next) => {
37
+ latest.current = next;
38
+ if (!containerRef.current?.contains(document.activeElement)) save();
39
+ }
40
+ };
41
+ };
42
+ export { useSaveOnLeave };
@@ -12,6 +12,12 @@ import { RecordTableRow } from "./RecordTableRow.js";
12
12
  import { RecordTableRowList } from "./RecordTableRowList.js";
13
13
  import { RecordTableRowSkeleton } from "./RecordTableRowSkeleton.js";
14
14
  import { RecordTableScroll } from "./RecordTableScroll.js";
15
+ /**
16
+ * The table every record list uses; never `Table` or a plain `<table>`.
17
+ * `RecordTable.Provider` takes the `columns` and `data`; `checkboxColumn` adds row selection,
18
+ * `ColumnSelector` lets a member pick columns, and `CursorProvider` with its skeletons loads
19
+ * more rows by cursor.
20
+ */
15
21
  export declare const RecordTable: typeof RecordTableRoot & {
16
22
  Provider: typeof RecordTableProvider;
17
23
  Header: typeof RecordTableHeader;
@@ -14,6 +14,12 @@ import { RecordTableRowList } from "./RecordTableRowList.js";
14
14
  import { RecordTableRowSkeleton } from "./RecordTableRowSkeleton.js";
15
15
  import { RecordTableScroll } from "./RecordTableScroll.js";
16
16
  // src/modules/record-table/components/RecordTable.tsx
17
+ /**
18
+ * The table every record list uses; never `Table` or a plain `<table>`.
19
+ * `RecordTable.Provider` takes the `columns` and `data`; `checkboxColumn` adds row selection,
20
+ * `ColumnSelector` lets a member pick columns, and `CursorProvider` with its skeletons loads
21
+ * more rows by cursor.
22
+ */
17
23
  const RecordTable = Object.assign(RecordTableRoot, {
18
24
  Provider: RecordTableProvider,
19
25
  Header: RecordTableHeader,
@@ -1,6 +1,15 @@
1
1
  import React from "react";
2
2
  /** The header cell id of the column a cell sits in, so its control is named by the column. */
3
3
  export declare const CellColumnHead: React.Context<string | undefined>;
4
+ /**
5
+ * A cell control's id and name: the column head (or a side panel field's label), then the
6
+ * control's own text ("Emails ada@…"), so an empty value is still named. Spread it before the
7
+ * caller's props, which win.
8
+ */
9
+ export declare const useCellLabel: (id?: string) => {
10
+ id: string;
11
+ 'aria-labelledby': string | undefined;
12
+ };
4
13
  /** A body cell. Its width and pinned offset are CSS variables the table container sets. */
5
14
  export declare const RecordTableCell: ({ ref, children, className, columnId, pinned, style, ...props }: React.HTMLAttributes<HTMLTableCellElement> & {
6
15
  columnId: string;
@@ -2,10 +2,24 @@ import { Table } from "../../../components/table.js";
2
2
  import { cn } from "../../../lib/utils.js";
3
3
  import { useRecordTable } from "./RecordTableProvider.js";
4
4
  import { jsx } from "react/jsx-runtime";
5
- import { createContext } from "react";
5
+ import { createContext, use, useId } from "react";
6
6
  // src/modules/record-table/components/RecordTableCell.tsx
7
7
  /** The header cell id of the column a cell sits in, so its control is named by the column. */
8
8
  const CellColumnHead = createContext(void 0);
9
+ /**
10
+ * A cell control's id and name: the column head (or a side panel field's label), then the
11
+ * control's own text ("Emails ada@…"), so an empty value is still named. Spread it before the
12
+ * caller's props, which win.
13
+ */
14
+ const useCellLabel = (id) => {
15
+ const ownId = useId();
16
+ const controlId = id ?? ownId;
17
+ const head = use(CellColumnHead);
18
+ return {
19
+ id: controlId,
20
+ "aria-labelledby": head ? `${head} ${controlId}` : void 0
21
+ };
22
+ };
9
23
  /** A body cell. Its width and pinned offset are CSS variables the table container sets. */
10
24
  const RecordTableCell = ({ ref, children, className, columnId, pinned, style, ...props }) => {
11
25
  const { headId } = useRecordTable();
@@ -32,4 +46,4 @@ const RecordTableCell = ({ ref, children, className, columnId, pinned, style, ..
32
46
  })
33
47
  });
34
48
  };
35
- export { CellColumnHead, RecordTableCell };
49
+ export { CellColumnHead, RecordTableCell, useCellLabel };
@@ -15,6 +15,11 @@ declare const cellDisplayVariants: (props?: ({
15
15
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
16
16
  declare const RecordTableCellDisplay: ({ className, variant, ...props }: React.ComponentProps<'div'> & VariantProps<typeof cellDisplayVariants>) => React.JSX.Element;
17
17
  declare const RecordTableInlineAnchor: ({ ref, className, onClick, children, ...props }: React.ComponentProps<typeof Badge>) => React.JSX.Element;
18
+ /**
19
+ * A table cell value, and the trigger and popover that edit it in place.
20
+ * Used bare it shows a read-only value. `Trigger` and `Content` go inside a `Popover` or
21
+ * `PopoverScoped`; `Trigger`'s `variant="field"` fits a side panel row.
22
+ */
18
23
  export declare const RecordTableInlineCell: typeof RecordTableCellDisplay & {
19
24
  /** Names the triggers inside by the element with this id, as the column head does in a table. */
20
25
  LabelledBy: React.Context<string | undefined>;
@@ -2,9 +2,8 @@ import { Badge } from "../../../components/badge.js";
2
2
  import { Button, buttonVariants } from "../../../components/button.js";
3
3
  import { Popover } from "../../../components/popover.js";
4
4
  import { cn } from "../../../lib/utils.js";
5
- import { CellColumnHead } from "./RecordTableCell.js";
5
+ import { CellColumnHead, useCellLabel } from "./RecordTableCell.js";
6
6
  import { jsx } from "react/jsx-runtime";
7
- import { use, useId } from "react";
8
7
  import { cva } from "class-variance-authority";
9
8
  // src/modules/record-table/components/RecordTableCellInline.tsx
10
9
  const cellTriggerVariants = cva("h-8 px-2 w-full justify-start text-left focus-visible:relative focus-visible:z-10 focus-visible:outline-none focus-visible:shadow-subtle overflow-hidden", {
@@ -20,13 +19,10 @@ const cellTriggerVariants = cva("h-8 px-2 w-full justify-start text-left focus-v
20
19
  defaultVariants: { variant: "cell" }
21
20
  });
22
21
  const RecordTableCellTrigger = ({ ref, children, className, id, variant, empty, ...props }) => {
23
- const ownId = useId();
24
- const triggerId = id ?? ownId;
25
- const columnHead = use(CellColumnHead);
22
+ const label = useCellLabel(id);
26
23
  return /* @__PURE__ */ jsx(Popover.Trigger, {
27
24
  render: /* @__PURE__ */ jsx(Button, {
28
- id: triggerId,
29
- "aria-labelledby": columnHead ? `${columnHead} ${triggerId}` : void 0,
25
+ ...label,
30
26
  variant: "ghost",
31
27
  className: cn(cellTriggerVariants({
32
28
  variant,
@@ -73,6 +69,11 @@ const RecordTableInlineAnchor = ({ ref, className, onClick, children, ...props }
73
69
  children
74
70
  });
75
71
  };
72
+ /**
73
+ * A table cell value, and the trigger and popover that edit it in place.
74
+ * Used bare it shows a read-only value. `Trigger` and `Content` go inside a `Popover` or
75
+ * `PopoverScoped`; `Trigger`'s `variant="field"` fits a side panel row.
76
+ */
76
77
  const RecordTableInlineCell = Object.assign(RecordTableCellDisplay, {
77
78
  /** Names the triggers inside by the element with this id, as the column head does in a table. */
78
79
  LabelledBy: CellColumnHead,