@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
package/AGENTS.md ADDED
@@ -0,0 +1,58 @@
1
+ # erxes-ui
2
+
3
+ The design system web and plugin UIs build on (`README.md` says who imports what). Screens
4
+ compose these components and the theme's tokens; each component owns how it looks. `vp run check`
5
+ enforces that with `@shadcn/lint`, configured in `tools/config/design.ts`, and every finding
6
+ points here. `CATALOG.md` lists every export with the first sentence of its doc comment;
7
+ `tools/ui-exports.ts` writes it and fails on an export without one.
8
+
9
+ ## Tokens
10
+
11
+ - `src/theme.css` maps tokens to Tailwind utilities; `src/base.css` holds their light and dark
12
+ values on `:root` and `.dark`. Colours are the `--color-*` names there (`bg-muted`,
13
+ `text-muted-foreground`, `border-input`, `text-primary-text`). Primary-coloured text is
14
+ `text-primary-text`; `primary` itself is for fills and borders, since it reads at 2.6:1 as text
15
+ in dark.
16
+ - Type, radius, shadow, spacing, easing and animation scales are the `@theme` entries in
17
+ `src/theme.css`. A size the scales lack is a new token there, never `text-[11px]` or
18
+ `ease-[cubic-bezier(…)]`. A layout the scales can't name, such as a fixed grid template, is an
19
+ `@utility` there.
20
+ - Classes merge through `cn` (`src/lib/utils.ts`), whose tables `cn build` generates from the
21
+ `@theme` scales, so `cn('shadow-sm', 'shadow-focus')` keeps only the last. After changing
22
+ `@theme`, run `pnpm --filter @erxes/ui cn:tables`; `pnpm check:generated` fails on stale tables.
23
+ - No raw palette colours (`bg-gray-100`, `#fff`), no arbitrary values, no `<style>` and no inline
24
+ style properties. A value only known at runtime (a dragged width, a chart series colour) goes
25
+ in a CSS variable: `style={{ '--panel-width': `${width}px` }}` with `w-(--panel-width)`. When
26
+ the keys are only known at runtime too (one per table column or chart series), build the object
27
+ as ``const cssVariables: Record<`--${string}`, string>`` and pass `style={cssVariables}`; the lint
28
+ accepts that name only. The editor blocks' `*ExternalHtml.tsx` are the one place with inline
29
+ styles, since their HTML is read without this stylesheet.
30
+ - Motion goes through the theme too. An entrance is `animate-appear` with its offset and timing
31
+ in `--appear-x`, `--appear-y`, `--appear-scale`, `--appear-duration`, `--appear-easing` and
32
+ `--appear-delay`. Styles for the collapsed sidebar use the `navigation-collapsed:` variant.
33
+ - Class names are written out in full, never built (`` `bg-${tone}` ``): a variant map such as
34
+ `{ success: 'bg-success', warning: 'bg-warning' }[tone]`, or a cva variant.
35
+
36
+ ## What a screen may change
37
+
38
+ `className` on an erxes-ui component carries layout: margin, width, height and size, flex and grid
39
+ placement, position, display, and `opacity-0`/`opacity-100` to reveal a control on hover.
40
+ `grid-cols-*`, `grid-rows-*`, `max-w-*`, `max-h-*` and `min-h-*` are allowed by glob, because
41
+ shadcn-lint 0.2.5 reads no grid or max/min size tokens from `@theme` and can't place them. The
42
+ few components that accept more, such as inline text that takes its colour from where it sits,
43
+ are the contracts in `tools/config/design.ts`.
44
+
45
+ Colour, type, padding, gap, border, radius, shadow and motion belong to the component. Plain
46
+ elements (`div`, `span`) take any token class, so spacing between a component's children goes on
47
+ a plain element inside it.
48
+
49
+ ## When the lint fires
50
+
51
+ 1. Drop the class when the component already looks that way.
52
+ 2. Use an existing variant or size. The error lists them.
53
+ 3. Add a variant or size to the component's `cva` (`src/components/<name>.tsx`), named for what
54
+ it is (`muted`, `flush`), not for the screen that needs it. Add one when the design repeats it
55
+ or it is a real state; the screens that hand-rolled the same look switch to it.
56
+ 4. A composition that restyles a component throughout is its own component here.
57
+ 5. A contract is for a property the screen owns by nature, and goes in `tools/config/design.ts`
58
+ with the reason.
package/CATALOG.md ADDED
@@ -0,0 +1,251 @@
1
+ # erxes-ui catalog
2
+
3
+ Generated by `tools/ui-exports.ts` from the doc comments in erxes-ui. Find what you need here
4
+ before writing a component, hook or helper, and import it from `erxes-ui`.
5
+
6
+ ## Pages
7
+
8
+ Copy the screen beside each kind. `ui/…` is your plugin's own template; `apps/web/…` is
9
+ core's, in the erxes repo on branch `postgre`. The `ui-patterns` skill has the rules.
10
+
11
+ | Page | Build with | Copy |
12
+ | ------------------------ | ------------------------------------------------------------------- | --------------------------------------------------------------- |
13
+ | List | `PageHeader`, `ViewBar`, `ListFilter`, `RecordTable` | `ui/src/modules/items/ItemsPage.tsx` |
14
+ | Grouped list (by status) | `RecordList`, `DisplayMenu`, `useListDisplay` | none in core yet |
15
+ | Board | `DisplayMenu`, `useListDisplay` | `apps/web/src/modules/leads/LeadsBoard.tsx` |
16
+ | Record detail | `PanelSection`, `PanelField`, `RecordTableInlineCell`, `RecordPage` | `ui/src/modules/items/ItemPanel.tsx` |
17
+ | Create/edit form | `PanelFormLayout`, `PanelFormRow` | `ui/src/modules/items/ItemPanel.tsx` |
18
+ | Settings list | `PageHeader`, `RecordTable` | `apps/web/src/modules/settings/tags/TagsSettingsPage.tsx` |
19
+ | Settings form | `Form`, `Switch`, `ScrollArea` | `apps/web/src/modules/settings/profile/ProfileSettingsPage.tsx` |
20
+ | Filters | `ListFilter`, `useListFilterParams` | `ui/src/modules/items/ItemsPage.tsx` |
21
+
22
+ ## Page
23
+
24
+ - `<AppLayout id sidebar footer title>` An app's full-height layout under core's top bar, with its own sidebar.
25
+ - `<AppLayoutFooterLink to name icon>` A link pinned to the foot of an app sidebar, in `AppLayout`'s `footer`.
26
+ - `<NavigationMenuLinkItem name icon to isActive label>` A sidebar link that lights up while the address is under its `to`.
27
+ - `<PageContainer>` A page's outer box, full height, with `PageHeader` first inside it.
28
+ - `PageHeader.{Start, End}` A page's title bar, with the breadcrumb and its one primary action.
29
+ - `<PageSubHeader variant>` A bar under the page header with a rule below it, for tabs or controls.
30
+
31
+ ## Lists
32
+
33
+ - `<DisplayMenu list displays>` The Display menu in a list's filter bar: table, board or grouped list.
34
+ - `EnumCursorDirection` Which way a cursor-paged table loads more rows: forward or backward.
35
+ - `Filter.{Trigger, Popover, Item, CommandItem, View, …}` Parts of a filter popover and bar, which `ListFilter` is built from.
36
+ - `<ListFilter {...TListFilterProps}>` A list's filter bar, with a field menu, search and conditions as chips.
37
+ - `listFilterQuery` The URL params holding a list's filter, as nuqs parsers.
38
+ - `RecordList.{Provider, Skeleton, useSelection}` Rows grouped under headers that fold away, such as tasks by status.
39
+ - `type RecordListGroup { id, label, icon, rows, action }` A run of rows under one header, such as the tasks in one status.
40
+ - `RecordTable.{Provider, Header, Head, InlineHead, RowList, …}` The table every record list uses; never `Table` or a plain `<table>`.
41
+ - `type RecordTableColumnDef` A record table column for rows of `TData`.
42
+ - `RecordTableInlineCell.{LabelledBy, Trigger, Content, Anchor}` A table cell value, and the trigger and popover that edit it in place.
43
+ - `type TListDisplay` How a list shows its records: grouped rows, a table or a board.
44
+ - `type TListFilterField { path, label, type, options, icon, … }` A field a list can filter by, for `ListFilter`'s `fields`.
45
+ - `type TListFilterProps` The props of `ListFilter`: its `id`, `fields`, lookups and record count.
46
+ - `useFilterContext()` Controls of the enclosing `Filter`: open or close it and switch views.
47
+ - `useListDisplay(list, displays)` The display a list shows, as picked in its Display menu.
48
+ - `useListFilterParams()` `ListFilter`'s conditions and search, as params for the list's query.
49
+ - `<ViewBar allLabel tabs>` A list's one bar under its page header: views left, filter right.
50
+
51
+ ## Records
52
+
53
+ - `type CompanyContact { id, primaryName, primaryEmail, primaryPhone, avatarUrl }` What a company reads as: core's `Company` has these fields and more.
54
+ - `companyTitle(company)` A company's name, else its email or phone.
55
+ - `<ContactLink contentType contentId contacts placeholder>` A customer or company as a chip: its avatar and name.
56
+ - `type ContactQueries { customer, company }` Where customers and companies come from, as TanStack query options.
57
+ - `type CustomerContact { id, firstName, middleName, lastName, primaryEmail, … }` What a customer reads as: core's `Customer` has these fields and more.
58
+ - `customerTitle(customer)` A customer's name, else its email or phone.
59
+ - `<PanelDescriptionEditor value scope readonly isHTML onSave>` A record's description as a full-size tab.
60
+ - `<PanelDescriptionField label value scope readonly isHTML>` A rich-text description row in the side panel, across its width.
61
+ - `PanelExpansionContext` Provided by the host's record panel; erxes-ui's panel parts read it.
62
+ - `<PanelField label icon placeholder htmlFor cell>` A side panel row: icon and label, then the value as a table cell.
63
+ - `<PanelFieldTrigger>` A table cell trigger with the side panel's rounded hover.
64
+ - `<PanelFormLayout onCancel saving saveLabel>` A new record's form in the side panel: its rows, then Cancel and Save.
65
+ - `<PanelFormRow label icon required error>` One field of a new record's form, laid out like `PanelField`.
66
+ - `<PanelLabel tooltip>` A side panel label cut at two lines, with the full text on hover.
67
+ - `<PanelSection title icon nested>` A plain heading that groups the side panel's rows.
68
+ - `<RecordOpenerProvider open openNew>` The host app's way to open records, which `useOpenRecord` calls.
69
+ - `RecordPage` A record on its own page, as core draws a customer's.
70
+ - `type RecordRef { contentType, contentId }` A record the host can open, by `contentType` and `contentId`.
71
+ - `RecordTimeline` Core's timeline of notes, calls and events for a plugin's record.
72
+ - `type RecordTimelineProps { type, id }` Which record `RecordTimeline` shows: its timeline type and id.
73
+ - `setRecordPage` Web registers how a record draws on its own page.
74
+ - `setRecordTimeline` Registers core's timeline; web calls it at startup and plugins don't.
75
+ - `type TContactContentType` The customer or company types `ContactLink` shows.
76
+ - `useOpenRecord()` Opens a record, or a new draft, in core's side panel.
77
+ - `usePanelExpanded()` Whether the record shows at full size on its own page.
78
+
79
+ ## Fields and pickers
80
+
81
+ - `<ConditionsEditor>` Edits a condition group of rules, for automations and advanced filters.
82
+ - `<Editor>` The block editor, fetched the first time one renders.
83
+ - `editorText(content)` Stored editor content, block JSON or HTML, as the plain text it shows.
84
+ - `<EmailDisplay maxVisible primaryEmail emails emailValidationStatus>` A record's emails as chips, the primary one with its validation mark.
85
+ - `<EmailListField recordId onValueChange onValidationStatusChange noValidation primaryEmail>` An editable list of a record's emails, each with its own menu.
86
+ - `<EntityPicker items itemKey renderItem value onValueChange>` The searchable list behind every record picker; build a picker on it.
87
+ - `<FullNameField firstName lastName onValueChange scope>` First and last name inputs in a popover, saved when it closes.
88
+ - `<FullNameValue>` The name `FullNameField` is editing, or "Unknown" when it is empty.
89
+ - `<IconComponent name>` A Tabler icon by its name, such as one stored on a record.
90
+ - `<IconPicker value onValueChange>` A button that picks a Tabler icon from a searchable list in a popover.
91
+ - `<IconsProvider>` Loads the Tabler icon set in the background for `IconComponent`.
92
+ - `isRule(rule)` Whether a condition entry is a rule rather than a nested group.
93
+ - `<LookupPicker lookup value onValueChange multiple placeholder>` A button that picks members or tags, one or several with `multiple`.
94
+ - `type Member { id, email, fullName, username, avatarUrl, … }` A team member as the pickers show one.
95
+ - `<MemberInline memberId members placeholder size>` A member's avatar and name by id, or a placeholder without one.
96
+ - `memberName(member)` How a member reads: the display name, else the username, else the email.
97
+ - `type MemberQueries { team, byIds }` Where members come from, as TanStack query options.
98
+ - `<NumberField placeholder value scope onSave onValueChange>` A number in a table cell or panel row that edits in a popover.
99
+ - `<PhoneDisplay maxVisible primaryPhone phones phoneValidationStatus>` A record's phones as chips, the primary one with its validation mark.
100
+ - `<PhoneField recordId onValueChange onValidationStatusChange primaryPhone phones>` An editable list of a record's phones, each with its own menu.
101
+ - `<PhoneInput value onChange defaultCountry placeholder onEnter>` A phone input with a country flag picker that formats as you type.
102
+ - `RelativeDateDisplay.{Value}` A date as how long ago it was, with the date and time on hover.
103
+ - `SelectMember` The member picker as a table cell and as a field.
104
+ - `<SexDisplay value>` A sex code as its label, or nothing when it is not known.
105
+ - `<SexField value onValueChange>` A searchable list to pick a sex code, for a popover or cell editor.
106
+ - `type Tag { id, name }` A tag as the pickers show one: core's `Tag` has these fields and more.
107
+ - `type TagsQuery` TanStack query options for the tags of one record type.
108
+ - `type TConditionField { path, label, type, options, group, … }` A field conditions can use: a record's, or an earlier step's output.
109
+ - `type TConditionGroup { match, rules }` Rules (or nested groups) that must all, or any, hold.
110
+ - `type TConditionLookups { members, tags }` Where `member` and `tags` values pick from.
111
+ - `type TConditionRule { path, op, value }` One rule of a condition: a `path`, an operator and maybe a value.
112
+ - `<TextField placeholder value scope onSave onValueChange>` A text value in a table cell or panel row that edits in a popover.
113
+ - `useMemberOptions(members, enabled, picked)` The active team members as picker options.
114
+ - `useMembersById(ids, members)` Members by id, any status.
115
+ - `useTagOptions(tags, enabled)` A record type's tags as picker options; none without `tags`.
116
+
117
+ ## Components
118
+
119
+ - `Accordion.{Item, Trigger, Panel}` Stacked sections whose headers fold their content open and shut.
120
+ - `Alert.{Title, Description}` An inline notice: icon, title and text, plain, warning or destructive.
121
+ - `AlertDialog.{Action, Cancel, Content, Description, Footer, …}` A modal that asks the member to confirm or cancel one action.
122
+ - `Avatar.{Image, Fallback}` A person's picture, round or square, falling back to their initials.
123
+ - `type AvatarProps` Base UI avatar props plus `corners`, `ring` and `size`.
124
+ - `<BackgroundGradientAnimation containerClassName>` Slowly moving colour blobs behind `children`, as a backdrop.
125
+ - `<Badge variant size onClose>` A small tinted label for a status, tag or count; `onClose` adds an x.
126
+ - `type BadgeProps { onClose }` Div props plus `variant`, `size` and `onClose`, which adds a remove x.
127
+ - `badgeVariants` The badge's classes by `variant` and `size`, to style another element.
128
+ - `Breadcrumb.{List, Item, Link, Page, Separator, …}` The trail of links to the current page, on the left of a `PageHeader`.
129
+ - `<Button variant tone size>` A button in the theme's variants, tones and sizes; native by default.
130
+ - `type ButtonProps` Base UI button props plus `variant`, `tone` and `size`.
131
+ - `buttonVariants(props)` Button classes by `variant`, `tone` and `size`, to style a link as one.
132
+ - `<Calendar classNames>` A month grid to pick a day or range, with month and year selects.
133
+ - `type CalendarProps` react-day-picker's `DayPicker` props.
134
+ - `Card.{Header, Footer, Title, Description, Content}` A raised panel with header, title, description, content and footer.
135
+ - `type ChartConfig` Each series' label, icon and colour by data key, for `ChartContainer`.
136
+ - `<ChartContainer config style>` The frame for a recharts chart: size, theme and series colours.
137
+ - `<ChartLegendContent hideIcon payload verticalAlign nameKey>` The themed body for a recharts `Legend`: each series' icon and label.
138
+ - `<ChartTooltipContent>` The themed body for a recharts `Tooltip`, labelled from the config.
139
+ - `<Checkbox>` A themed checkbox; pass `indeterminate` for a partial selection.
140
+ - `ChoiceboxGroup.{Item}` Radio choices drawn as large tiles with a title and text.
141
+ - `Collapsible.{Trigger, TriggerIcon, Panel}` One section that folds open and shut, with a caret icon for its trigger.
142
+ - `ColorPicker.{Provider, Trigger, Content}` A swatch button that opens preset colours and a hex input in a popover.
143
+ - `Combobox` Parts of a popover picker: trigger, value, content, check, load-more.
144
+ - `Command.{Dialog, Input, List, Empty, Group, …}` A searchable list of items to pick or run, built on cmdk.
145
+ - `CommandBar.{Value, Bar}` A bar floating at the page bottom with bulk actions for a selection.
146
+ - `ContextMenu.{Trigger, Content, Item, Group, Label, …}` A menu that opens on right-click, beside the pointer.
147
+ - `<CopyText value>` Text that copies `value` to the clipboard on click and shows "Copied!".
148
+ - `<DateInput>` A calendar date typed in.
149
+ - `<DatePicker {...DatePickerProps}>` A date field with a calendar popover, for one day, several or a range.
150
+ - `Dialog.{Trigger, Close, Portal, Backdrop, Content, …}` A centered modal over a dimmed page, such as an image lightbox.
151
+ - `<DragHandle variant>` A small grip button to drag a row or card by, for a sortable list.
152
+ - `DropdownMenu.{Trigger, Group, Sub, SubTrigger, SubContent, …}` A menu of actions that opens from a button, such as a row's "more" menu.
153
+ - `Empty.{Header, Title, Description, Content, Media}` A list's or page's empty state: icon, title, a line and an action.
154
+ - `Form.{Control, Description, Field, Item, Label, …}` react-hook-form's provider with field, label, control and error parts.
155
+ - `HoverCard.{Trigger, Content}` A preview card that opens when the pointer rests on a link, after 700ms.
156
+ - `<IconTip label hotkey>` The hover label of an icon-only button, with its shortcut if it has one.
157
+ - `InfoCard.{Content}` A tinted dashboard tile: a caps title, an info tip and a content box.
158
+ - `Input.{Number}` A themed text input; `Input.Number` adds thousands separators.
159
+ - `InputGroup.{Addon, Input, Textarea}` An input or textarea with an icon or button inside the same box.
160
+ - `<Kbd variant>` A keyboard key, such as a shortcut in a tooltip or menu.
161
+ - `<Label variant htmlFor>` A form control's label, a native `<label>` since Base UI has none.
162
+ - `<MultipleSelector>` Picks several options from a list, shown as removable badges.
163
+ - `type MultiSelectOption { value, label }` One option of `MultipleSelector`: its value and the label shown.
164
+ - `Popover.{Trigger, Content, Close}` A floating box anchored to its trigger, for a picker or a few controls.
165
+ - `RadioGroup.{Item}` A set of radio buttons where one value is picked.
166
+ - `Resizable` Side-by-side panels with handles that drag their sizes.
167
+ - `ScrollArea.{Root, Viewport, Bar}` A scrolling box with thin scrollbars that show on hover or scroll.
168
+ - `Select.{Group, Value, Trigger, Content, Label, …}` A dropdown to pick one value from a short fixed list.
169
+ - `Separator.{Inline}` A thin horizontal or vertical line between sections.
170
+ - `Sheet.{Trigger, View, Backdrop, Content, Header, …}` A panel that slides in from a page edge over a dimmed page.
171
+ - `Sidebar.{Content, Footer, Group, GroupAction, GroupContent, …}` A collapsible side navigation with groups, menus and sub-menus.
172
+ - `<Skeleton radius>` A pulsing grey block that holds the place of content while it loads.
173
+ - `<Slider>` A draggable slider for one number or a range.
174
+ - `<Spinner size show area containerClassName>` A spinning loader; `area` pads it to stand in for a section or page.
175
+ - `<StringArrayInput value onValueChange placeholder>` A list of short strings as removable badges.
176
+ - `<Switch size>` An on/off toggle for a setting that applies as soon as it flips.
177
+ - `<TabButton render variant active dragging split>` A tab-looking button for a strip that isn't a `Tabs` list.
178
+ - `Table.{Header, Body, Footer, Head, Row, …}` A plain styled HTML table, for small static grids of values.
179
+ - `Tabs.{List, Trigger, Content}` Tabs that switch between panels of one view.
180
+ - `<Textarea variant text truncate>` A themed multi-line text box; `flat` and `ghost` drop the border.
181
+ - `TextOverflowTooltip.{Input}` Text cut with an ellipsis that shows the full value in a tooltip.
182
+ - `<TimeField>` A time of day.
183
+ - `<Toaster>` Draws the toasts `toast()` raises; core's web app already mounts it.
184
+ - `<Toggle variant size>` A button that stays pressed or not, such as bold in a toolbar.
185
+ - `ToggleGroup.{Item}` A row of toggle buttons where one or several stay pressed.
186
+ - `Tooltip.{Provider, Trigger, Content}` A short label that shows on hover or focus of its trigger.
187
+ - `Upload` An image upload: a preview tile, an upload button and a remove button.
188
+
189
+ ## Plugin runtime
190
+
191
+ - `addPluginStyles(plugin, css)` Adds a plugin UI's compiled Tailwind to the page, minus what web has.
192
+ - `type FileStorageAdapter { upload, remove }` Where erxes-ui's upload hooks and components send files.
193
+ - `getPluginAssetsUrl(pluginName, url)` A file's URL in a plugin UI's deployed `assets` folder.
194
+ - `getPluginRuntime()` The host's plugin runtime, or null outside erxes.
195
+ - `type IUIConfig { name, path, icon, recordSections, recordTypes, … }` A plugin UI's `CONFIG`, exported from its `./config` remote.
196
+ - `pluginFetch(plugin, path, init)` `fetch` against a plugin's API as the signed-in member.
197
+ - `pluginJson(plugin, path, schema, init)` JSON in, JSON out, checked against `schema`.
198
+ - `type PluginLiveMessage` A message on core's live stream: a plugin's changed topics, or resync.
199
+ - `type PluginRuntime { session, subscribe }` What the host gives plugin UIs: plugin API sessions and the live stream.
200
+ - `type PluginSession { token, expiresAt, apiUrl }` A member's short-lived token for one plugin's API, and its address.
201
+ - `setFileStorage(next)` Sets where uploads go; web calls it at startup and plugins don't.
202
+ - `setPluginRuntime(next)` Sets the plugin runtime; web calls it at startup and plugins don't.
203
+ - `type TActivityRowProps { activity }` Props of a plugin's activity row component in `widgets.activityRows`.
204
+ - `type TDashboardWidgetPreview` The schematic a dashboard widget shows in the widget catalog.
205
+ - `type TPanelRecordType { contentType, title, icon, detailPath, Title, … }` A record type a plugin shows in core's side panel.
206
+ - `type TPropertyInputMeta` A property input's own settings, stored with the custom field.
207
+ - `type TPropertyInputProps { value, onValueChange, meta, onMetaChange, disabled }` Props of a custom property input in `widgets.propertyInputs`.
208
+ - `type TRecordContacts { customerIds, companyIds }` The customers and companies a record is about.
209
+ - `type TRecordDraftProps { defaults, onCreated, onCancel }` Props of a plugin record type's `New` slot, the draft form.
210
+ - `type TRecordSection { contentType, title, icon, component }` A plugin's section on a customer's or company's detail in core's panel.
211
+ - `type TRecordSectionProps { contentType, contentId }` What a record section is given: the customer or company it shows on.
212
+ - `type TRecordSlotProps` What each slot of a plugin record is given: the record.
213
+ - `type TRecordTab { value, label, icon, after, component }` A plugin record type's own tab, after core's Detail or Activity tab.
214
+ - `type TRelationTab { name, title, icon, hosts, component }` A plugin's tab on other records' panels, listing its own records.
215
+ - `type TRelationTabProps` Props of a relation tab: the record it shows on, and its contacts.
216
+ - `useLiveSignal(plugin, topics, onSignal)` Runs `onSignal` when a plugin says one of `topics` changed, to refetch.
217
+
218
+ ## Hooks and helpers
219
+
220
+ - `amountStep(currency)` A number input's `step` for a currency: 0.01 for USD, 1 for JPY.
221
+ - `cn` Joins classes and drops the ones a later class overrides.
222
+ - `formatMoney(amount, currency, language)` An amount as people read it in `language`: 150000 MNT → "MNT 1,500.00".
223
+ - `formatPhoneNumber({ defaultCountry, value })` A phone number formatted as people write it, even half typed.
224
+ - `formatter(language)` The formatters for `language` (an i18next code), for code outside React.
225
+ - `fromAmountInput(text, currency)` A number input's text as an amount in minor units: "12.5" USD → 1250.
226
+ - `isUndefinedOrNull(value)` True for `null` and `undefined`, and narrows the value's type.
227
+ - `jsonOf(schema)` A zod schema for a JSON string that decodes to `schema`.
228
+ - `LANGUAGES` The UI's languages, each with its own name and date-fns locale.
229
+ - `localTimeZone()` The browser's time zone ("Asia/Ulaanbaatar"), when it says.
230
+ - `oneOf(options, value)` `value` narrowed to one of `options`, else undefined.
231
+ - `<PopoverScoped scope onOpenChange onEnter closeOnEnter dependencies>` A `Popover` that takes over the hotkey scope while it is open.
232
+ - `readImage(value)` The address to show a stored file at.
233
+ - `SexCode` A person's sex as an ISO/IEC 5218 code.
234
+ - `stored({ key, schema, initial, session })` An atom kept in browser storage under `key`.
235
+ - `storedFamily({ key })` One stored atom per id (a table, a user, a list), under `<key>:<id>`.
236
+ - `textOf(value)` A stored value of any JSON shape as text, for showing or editing it.
237
+ - `ThemeOption` The UI theme a member picks: `light`, `dark` or `system`.
238
+ - `themeState` The member's theme choice as a jotai atom, kept in localStorage.
239
+ - `toAmountInput(amount, currency)` An amount as a number input's value, with all the currency's decimals.
240
+ - `toast({ title, description, variant, action })` Shows a toast: `toast({ title, description, variant: 'success' })`.
241
+ - `toIsoDay(date)` A local day as stored and typed, `yyyy-MM-dd`, in every language.
242
+ - `useConfirm()` `confirm` shows a confirmation dialog in its own root.
243
+ - `useFormat()` Date, number and money formatters in the UI's language, for components.
244
+ - `useItemKeys(length)` Stable React keys for an editable list whose items have no id.
245
+ - `useMoney()` `formatMoney` in the UI's language.
246
+ - `usePageHotkey(keys, action, { when, useKey })` A page shortcut, skipped while typing or while a dialog or menu is open.
247
+ - `usePreviousHotkeyScope()` Sets a hotkey scope and remembers the old one to go back to.
248
+ - `useScopedHotkeys(keys, callback, scope, dependencies, options)` Runs `callback` on `keys` while the hotkey `scope` is enabled.
249
+ - `useToast()` `{ toast }` as a hook; calling `toast` directly does the same.
250
+ - `useUpload()` Uploads files to the host's file storage, one request per file.
251
+ - `zoneOffset(zone)` A time zone's offset today, like "UTC+8".
package/README.md CHANGED
@@ -24,9 +24,32 @@ Only what something uses:
24
24
  - what web imports,
25
25
  - what plugin UIs import (the HR plugin is the first consumer),
26
26
  - the plugin API in the plugin skills: `getPluginRuntime`, `pluginFetch`, `pluginJson`,
27
- `useLiveSignal`, `RecordTimeline`, `getPluginAssetsUrl` and the `IUIConfig` types,
27
+ `useLiveSignal`, `RecordTimeline`, `getPluginAssetsUrl`, `addPluginStyles` and the `IUIConfig` types,
28
28
  - the design-system primitives in `src/components` (Accordion, Card, Slider …), even unused,
29
- because plugins build on them.
29
+ because plugins build on them,
30
+ - the record views plugins build lists from: `RecordTable` and `RecordList` (rows grouped under
31
+ headers that fold away, such as tasks by status; the Operation plugin is the first consumer),
32
+ - the pickers in `src/modules/pickers`: `EntityPicker`, and `SelectMember`, `MemberInline` and
33
+ `useMembersById`, which take `memberQueries` from `@erxes/core-contract/client`. They read
34
+ through TanStack query options, so erxes-ui imports nothing from core.
35
+ - core's records in `src/modules/records`: `ContactLink` (a customer or company by id, read
36
+ through `contactQueries` from `@erxes/core-contract/client`) and `useOpenRecord`, which open a
37
+ record or a draft in web's side panel through the `RecordOpenerProvider` web mounts, and
38
+ `RecordPage`, a record on its own page.
39
+ - the record panel's rows in `src/modules/record-panel`, which web's side panel and the slots
40
+ of a plugin's record types (`IUIConfig.recordTypes`) both fill it with: `PanelSection`,
41
+ `PanelField`, `PanelFormRow`, `PanelFormLayout`, `PanelLabel`, the description field and
42
+ editor, and `usePanelExpanded`. The panel itself (header, tabs, resize) is web's.
43
+ - a list's bar in `src/modules/list`: `ViewBar`, `DisplayMenu` with `useListDisplay`, and
44
+ `ListFilter` with `useListFilterParams`. `ListFilter` draws core's filter bar itself, with or
45
+ without web: its `member` fields pick from `members` (`memberQueries` from
46
+ `@erxes/core-contract/client`) and its `tags` fields from `tags` (a tags query of the record
47
+ type); a plugin outside erxes passes its own. Web's lists and the automation builder use the
48
+ same bar and the condition editor under its advanced filter (`ConditionsEditor`,
49
+ `src/modules/conditions`).
50
+ - what the host app provides at startup, rendered through `hostComponent`
51
+ (`src/utils/host-component.tsx`): `setRecordTimeline` and `setRecordPage`. Outside erxes they
52
+ render nothing.
30
53
 
31
54
  Anything else is removed, not kept "in case". Before you remove an export, check the HR plugin
32
55
  UI and `.agents/skills/plugin-contract/SKILL.md`.
@@ -2,6 +2,7 @@ import { Accordion as Accordion$1 } from "@base-ui/react/accordion";
2
2
  declare const AccordionItem: ({ className, ...props }: Accordion$1.Item.Props) => import("react").JSX.Element;
3
3
  declare const AccordionTrigger: ({ className, children, ...props }: Accordion$1.Trigger.Props) => import("react").JSX.Element;
4
4
  declare const AccordionPanel: ({ className, children, ...props }: Accordion$1.Panel.Props) => import("react").JSX.Element;
5
+ /** Stacked sections whose headers fold their content open and shut. */
5
6
  export declare const Accordion: (<Value = any>(props: Accordion$1.Root.Props<Value>) => React.JSX.Element) & {
6
7
  Item: typeof AccordionItem;
7
8
  Trigger: typeof AccordionTrigger;
@@ -26,6 +26,7 @@ const AccordionPanel = ({ className, children, ...props }) => /* @__PURE__ */ js
26
26
  children
27
27
  })
28
28
  });
29
+ /** Stacked sections whose headers fold their content open and shut. */
29
30
  const Accordion = Object.assign(Accordion$1.Root, {
30
31
  Item: AccordionItem,
31
32
  Trigger: AccordionTrigger,
@@ -11,6 +11,10 @@ declare const AlertDialogDescription: ({ className, ...props }: AlertDialog$1.De
11
11
  type AlertDialogButtonProps = AlertDialog$1.Close.Props & Pick<VariantProps<typeof buttonVariants>, 'variant'>;
12
12
  declare const AlertDialogAction: ({ className, variant, ...props }: AlertDialogButtonProps) => React.JSX.Element;
13
13
  declare const AlertDialogCancel: ({ className, variant, ...props }: AlertDialogButtonProps) => React.JSX.Element;
14
+ /**
15
+ * A modal that asks the member to confirm or cancel one action.
16
+ * Call `useConfirm` instead of building one; it draws this. Cancel takes focus on open.
17
+ */
14
18
  export declare const AlertDialog: typeof AlertDialog$1.Root & {
15
19
  Action: typeof AlertDialogAction;
16
20
  Cancel: typeof AlertDialogCancel;
@@ -44,6 +44,10 @@ const AlertDialogCancel = ({ className, variant = "outline", ...props }) => /* @
44
44
  className: cn(buttonVariants({ variant }), "mt-2 sm:mt-0", className),
45
45
  ...props
46
46
  });
47
+ /**
48
+ * A modal that asks the member to confirm or cancel one action.
49
+ * Call `useConfirm` instead of building one; it draws this. Cancel takes focus on open.
50
+ */
47
51
  const AlertDialog = Object.assign(AlertDialog$1.Root, {
48
52
  Action: AlertDialogAction,
49
53
  Cancel: AlertDialogCancel,
@@ -6,6 +6,7 @@ declare const alertVariants: (props?: ({
6
6
  declare function AlertRoot({ className, variant, ...props }: React.ComponentProps<'div'> & VariantProps<typeof alertVariants>): React.JSX.Element;
7
7
  declare function AlertTitle({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
8
8
  declare function AlertDescription({ className, ...props }: React.ComponentProps<'div'>): React.JSX.Element;
9
+ /** An inline notice: icon, title and text, plain, warning or destructive. */
9
10
  export declare const Alert: typeof AlertRoot & {
10
11
  Title: typeof AlertTitle;
11
12
  Description: typeof AlertDescription;
@@ -33,6 +33,7 @@ function AlertDescription({ className, ...props }) {
33
33
  ...props
34
34
  });
35
35
  }
36
+ /** An inline notice: icon, title and text, plain, warning or destructive. */
36
37
  const Alert = Object.assign(AlertRoot, {
37
38
  Title: AlertTitle,
38
39
  Description: AlertDescription
@@ -6,10 +6,12 @@ declare const avatarVariants: (props?: ({
6
6
  ring?: "lg" | "sm" | null | undefined;
7
7
  size?: "default" | "lg" | "sm" | "xl" | "xs" | null | undefined;
8
8
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
9
+ /** Base UI avatar props plus `corners`, `ring` and `size`. */
9
10
  export type AvatarProps = React.ComponentProps<typeof Avatar$1.Root> & VariantProps<typeof avatarVariants>;
10
11
  declare const AvatarRoot: ({ className, corners, ring, size, ...props }: AvatarProps) => React.JSX.Element;
11
12
  declare const AvatarImage: ({ className, ...props }: React.ComponentProps<typeof Avatar$1.Image>) => React.JSX.Element;
12
13
  declare const AvatarFallback: ({ className, style, ...props }: React.ComponentProps<typeof Avatar$1.Fallback>) => React.JSX.Element;
14
+ /** A person's picture, round or square, falling back to their initials. */
13
15
  export declare const Avatar: typeof AvatarRoot & {
14
16
  Image: typeof AvatarImage;
15
17
  Fallback: typeof AvatarFallback;
@@ -45,6 +45,7 @@ const AvatarFallback = ({ className, style, ...props }) => {
45
45
  ...props
46
46
  });
47
47
  };
48
+ /** A person's picture, round or square, falling back to their initials. */
48
49
  const Avatar = Object.assign(AvatarRoot, {
49
50
  Image: AvatarImage,
50
51
  Fallback: AvatarFallback
@@ -1,5 +1,8 @@
1
1
  import { ReactNode } from "react";
2
- /** Slowly moving colour blobs behind `children` (components.css draws them). */
2
+ /**
3
+ * Slowly moving colour blobs behind `children`, as a backdrop.
4
+ * components.css draws them.
5
+ */
3
6
  export declare const BackgroundGradientAnimation: ({ children, className, containerClassName }: {
4
7
  children?: ReactNode;
5
8
  className?: string;
@@ -33,7 +33,10 @@ const GooFilter = () => /* @__PURE__ */ jsx("svg", {
33
33
  ]
34
34
  }) })
35
35
  });
36
- /** Slowly moving colour blobs behind `children` (components.css draws them). */
36
+ /**
37
+ * Slowly moving colour blobs behind `children`, as a backdrop.
38
+ * components.css draws them.
39
+ */
37
40
  const BackgroundGradientAnimation = ({ children, className, containerClassName }) => /* @__PURE__ */ jsxs("div", {
38
41
  className: cn("gradient-backdrop relative top-0 left-0 flex w-1/2 flex-col overflow-hidden", containerClassName),
39
42
  children: [
@@ -1,10 +1,13 @@
1
1
  import React from "react";
2
2
  import { VariantProps } from "class-variance-authority";
3
+ /** The badge's classes by `variant` and `size`, to style another element. */
3
4
  export declare const badgeVariants: (props?: ({
4
5
  variant?: "default" | "destructive" | "ghost" | "info" | "muted" | "secondary" | "success" | "warning" | null | undefined;
5
6
  size?: "default" | "lg" | "sm" | null | undefined;
6
7
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
8
+ /** Div props plus `variant`, `size` and `onClose`, which adds a remove x. */
7
9
  export interface BadgeProps extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof badgeVariants> {
8
10
  onClose?: () => void;
9
11
  }
12
+ /** A small tinted label for a status, tag or count; `onClose` adds an x. */
10
13
  export declare const Badge: ({ ref, className, variant, size, children, onClose, ...props }: BadgeProps & React.RefAttributes<HTMLDivElement>) => React.JSX.Element;
@@ -5,6 +5,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
5
5
  import "react";
6
6
  import { cva } from "class-variance-authority";
7
7
  // src/components/badge.tsx
8
+ /** The badge's classes by `variant` and `size`, to style another element. */
8
9
  const badgeVariants = cva("inline-flex items-center rounded-sm transition-colors focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 whitespace-nowrap font-medium w-fit border gap-1", {
9
10
  variants: {
10
11
  variant: {
@@ -30,6 +31,7 @@ const badgeVariants = cva("inline-flex items-center rounded-sm transition-colors
30
31
  size: "default"
31
32
  }
32
33
  });
34
+ /** A small tinted label for a status, tag or count; `onClose` adds an x. */
33
35
  const Badge = ({ ref, className, variant, size, children, onClose, ...props }) => {
34
36
  return /* @__PURE__ */ jsxs("div", {
35
37
  ref,
@@ -12,6 +12,7 @@ declare const breadcrumbPageVariants: (props?: ({
12
12
  declare const BreadcrumbPage: ({ ref, className, variant, ...props }: React.ComponentProps<'span'> & VariantProps<typeof breadcrumbPageVariants>) => React.JSX.Element;
13
13
  declare const BreadcrumbSeparator: ({ children, className, ...props }: React.ComponentProps<'li'>) => React.JSX.Element;
14
14
  declare const BreadcrumbEllipsis: ({ className, ...props }: React.ComponentProps<'span'>) => React.JSX.Element;
15
+ /** The trail of links to the current page, on the left of a `PageHeader`. */
15
16
  export declare const Breadcrumb: typeof BreadcrumbRoot & {
16
17
  List: typeof BreadcrumbList;
17
18
  Item: typeof BreadcrumbItem;
@@ -55,6 +55,7 @@ const BreadcrumbEllipsis = ({ className, ...props }) => /* @__PURE__ */ jsxs("sp
55
55
  children: "More"
56
56
  })]
57
57
  });
58
+ /** The trail of links to the current page, on the left of a `PageHeader`. */
58
59
  const Breadcrumb = Object.assign(BreadcrumbRoot, {
59
60
  List: BreadcrumbList,
60
61
  Item: BreadcrumbItem,
@@ -7,12 +7,17 @@ declare const variants: (props?: ({
7
7
  size?: "default" | "flush" | "icon" | "lg" | "sm" | "xs" | null | undefined;
8
8
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
9
9
  /**
10
+ * Button classes by `variant`, `tone` and `size`, to style a link as one.
10
11
  * The size variants override the base padding, gap and text size, so the classes go through
11
12
  * tailwind-merge. Without it a link styled as a small button gets whichever rule the CSS
12
13
  * happens to list last.
13
14
  */
14
15
  export declare const buttonVariants: (props?: Parameters<typeof variants>[0]) => string;
16
+ /** Base UI button props plus `variant`, `tone` and `size`. */
15
17
  export type ButtonProps = React.ComponentProps<typeof Button$1> & VariantProps<typeof buttonVariants>;
16
- /** A native button by default. Links styled as buttons put `buttonVariants` on the link instead. */
18
+ /**
19
+ * A button in the theme's variants, tones and sizes; native by default.
20
+ * Links styled as buttons put `buttonVariants` on the link instead.
21
+ */
17
22
  export declare const Button: ({ className, variant, tone, size, ...props }: ButtonProps) => React.JSX.Element;
18
23
  export {};
@@ -48,12 +48,16 @@ const variants = cva("inline-flex items-center justify-center gap-2 px-3 whitesp
48
48
  }
49
49
  });
50
50
  /**
51
+ * Button classes by `variant`, `tone` and `size`, to style a link as one.
51
52
  * The size variants override the base padding, gap and text size, so the classes go through
52
53
  * tailwind-merge. Without it a link styled as a small button gets whichever rule the CSS
53
54
  * happens to list last.
54
55
  */
55
56
  const buttonVariants = (props) => cn(variants(props));
56
- /** A native button by default. Links styled as buttons put `buttonVariants` on the link instead. */
57
+ /**
58
+ * A button in the theme's variants, tones and sizes; native by default.
59
+ * Links styled as buttons put `buttonVariants` on the link instead.
60
+ */
57
61
  const Button = ({ className, variant, tone, size, ...props }) => /* @__PURE__ */ jsx(Button$1, {
58
62
  className: buttonVariants({
59
63
  variant,
@@ -1,4 +1,9 @@
1
1
  import { ComponentProps } from "react";
2
2
  import { DayPicker } from "react-day-picker";
3
+ /** react-day-picker's `DayPicker` props. */
3
4
  export type CalendarProps = ComponentProps<typeof DayPicker>;
5
+ /**
6
+ * A month grid to pick a day or range, with month and year selects.
7
+ * For a field, use `DatePicker`, which puts this in a popover. Years run 1980 to ten ahead.
8
+ */
4
9
  export declare const Calendar: ({ className, classNames, ...props }: CalendarProps) => import("react").JSX.Element;
@@ -75,6 +75,10 @@ const YearsDropdown = ({ value, options }) => {
75
75
  };
76
76
  const END_MONTH = new Date((/* @__PURE__ */ new Date()).getFullYear() + 10, 11);
77
77
  const START_MONTH = new Date(1980, 6);
78
+ /**
79
+ * A month grid to pick a day or range, with month and year selects.
80
+ * For a field, use `DatePicker`, which puts this in a popover. Years run 1980 to ten ahead.
81
+ */
78
82
  const Calendar = ({ className, classNames, ...props }) => /* @__PURE__ */ jsx(DayPicker, {
79
83
  className: cn("p-3", className),
80
84
  classNames: getBaseClassNames({
@@ -5,6 +5,7 @@ declare const CardTitle: ({ ref, className, ...props }: React.ComponentProps<'di
5
5
  declare const CardDescription: ({ ref, className, ...props }: React.ComponentProps<'div'>) => React.JSX.Element;
6
6
  declare const CardContent: ({ ref, className, ...props }: React.ComponentProps<'div'>) => React.JSX.Element;
7
7
  declare const CardFooter: ({ ref, className, ...props }: React.ComponentProps<'div'>) => React.JSX.Element;
8
+ /** A raised panel with header, title, description, content and footer. */
8
9
  export declare const Card: typeof CardRoot & {
9
10
  Header: typeof CardHeader;
10
11
  Footer: typeof CardFooter;
@@ -32,6 +32,7 @@ const CardFooter = ({ ref, className, ...props }) => /* @__PURE__ */ jsx("div",
32
32
  className: cn("flex items-center p-6 pt-0", className),
33
33
  ...props
34
34
  });
35
+ /** A raised panel with header, title, description, content and footer. */
35
36
  const Card = Object.assign(CardRoot, {
36
37
  Header: CardHeader,
37
38
  Footer: CardFooter,
@@ -1,5 +1,8 @@
1
1
  import React from "react";
2
- /** A series' colour is a theme colour, such as `var(--chart-1)`, so it follows light and dark. */
2
+ /**
3
+ * Each series' label, icon and colour by data key, for `ChartContainer`.
4
+ * A series' colour is a theme colour, such as `var(--chart-1)`, so it follows light and dark.
5
+ */
3
6
  export type ChartConfig = { [k in string]: {
4
7
  label?: React.ReactNode;
5
8
  icon?: React.ComponentType;
@@ -3,6 +3,10 @@ import React from "react";
3
3
  import * as RechartsPrimitive from "recharts";
4
4
  import { LegendPayload } from "recharts/types/component/DefaultLegendContent";
5
5
  import { Payload } from "recharts/types/component/DefaultTooltipContent";
6
+ /**
7
+ * The frame for a recharts chart: size, theme and series colours.
8
+ * Each `config` colour becomes a `--color-<key>` variable the chart's parts can use.
9
+ */
6
10
  declare const ChartContainer: ({ ref, className, children, config, style, ...props }: React.ComponentProps<'div'> & {
7
11
  config: ChartConfig;
8
12
  children: React.ComponentProps<typeof RechartsPrimitive.ResponsiveContainer>['children'];
@@ -17,7 +21,9 @@ type ChartTooltipContentProps = React.ComponentProps<typeof RechartsPrimitive.To
17
21
  payload?: TooltipItem[];
18
22
  label?: React.ReactNode;
19
23
  };
24
+ /** The themed body for a recharts `Tooltip`, labelled from the config. */
20
25
  declare const ChartTooltipContent: ({ ref, ...props }: ChartTooltipContentProps & React.RefAttributes<HTMLDivElement>) => React.JSX.Element | null;
26
+ /** The themed body for a recharts `Legend`: each series' icon and label. */
21
27
  declare const ChartLegendContent: ({ ref, className, hideIcon, payload, verticalAlign, nameKey }: React.ComponentProps<'div'> & {
22
28
  verticalAlign?: 'top' | 'middle' | 'bottom';
23
29
  payload?: readonly LegendPayload[];