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

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 (308) hide show
  1. package/README.md +6 -6
  2. package/dist/base.css +17 -4
  3. package/dist/components/accordion.d.ts +6 -7
  4. package/dist/components/accordion.js +8 -13
  5. package/dist/components/alert-dialog.d.ts +12 -11
  6. package/dist/components/alert-dialog.js +26 -29
  7. package/dist/components/alert.js +2 -2
  8. package/dist/components/avatar.d.ts +7 -5
  9. package/dist/components/avatar.js +30 -19
  10. package/dist/components/background-gradient-animation.d.ts +2 -11
  11. package/dist/components/background-gradient-animation.js +21 -50
  12. package/dist/components/badge.d.ts +3 -2
  13. package/dist/components/badge.js +36 -21
  14. package/dist/components/breadcrumb.d.ts +6 -4
  15. package/dist/components/breadcrumb.js +18 -14
  16. package/dist/components/button.d.ts +15 -7
  17. package/dist/components/button.js +46 -23
  18. package/dist/components/calendar.js +1 -1
  19. package/dist/components/card.js +1 -1
  20. package/dist/components/chart-config.d.ts +4 -18
  21. package/dist/components/chart-config.js +1 -6
  22. package/dist/components/charts.d.ts +1 -1
  23. package/dist/components/charts.js +20 -28
  24. package/dist/components/checkbox.d.ts +2 -3
  25. package/dist/components/checkbox.js +4 -6
  26. package/dist/components/choicebox-group.d.ts +1 -1
  27. package/dist/components/choicebox-group.js +5 -9
  28. package/dist/components/collapsible.d.ts +5 -9
  29. package/dist/components/collapsible.js +8 -25
  30. package/dist/components/color-picker.js +9 -8
  31. package/dist/components/combobox.d.ts +6 -6
  32. package/dist/components/combobox.js +19 -18
  33. package/dist/components/command-bar.js +22 -19
  34. package/dist/components/command.d.ts +18 -8
  35. package/dist/components/command.js +62 -26
  36. package/dist/components/context-menu.d.ts +17 -29
  37. package/dist/components/context-menu.js +20 -66
  38. package/dist/components/copy-text.js +7 -11
  39. package/dist/components/date-picker.js +21 -18
  40. package/dist/components/date-text-input.js +3 -3
  41. package/dist/components/date-time-input.d.ts +12 -0
  42. package/dist/components/date-time-input.js +21 -0
  43. package/dist/components/dialog.d.ts +17 -12
  44. package/dist/components/dialog.js +36 -32
  45. package/dist/components/drag-handle.d.ts +2 -2
  46. package/dist/components/drag-handle.js +0 -1
  47. package/dist/components/dropdown-menu.d.ts +35 -16
  48. package/dist/components/dropdown-menu.js +78 -37
  49. package/dist/components/empty.js +2 -2
  50. package/dist/components/form.d.ts +15 -6
  51. package/dist/components/form.js +34 -17
  52. package/dist/components/hover-card.d.ts +6 -5
  53. package/dist/components/hover-card.js +18 -9
  54. package/dist/components/info-card.js +5 -6
  55. package/dist/components/input-group.d.ts +22 -0
  56. package/dist/components/input-group.js +42 -0
  57. package/dist/components/input.d.ts +11 -2
  58. package/dist/components/input.js +21 -8
  59. package/dist/components/kbd.js +2 -2
  60. package/dist/components/label.d.ts +3 -3
  61. package/dist/components/label.js +9 -6
  62. package/dist/components/multiselect.d.ts +21 -6
  63. package/dist/components/multiselect.js +81 -127
  64. package/dist/components/on-demand.d.ts +17 -0
  65. package/dist/components/on-demand.js +42 -0
  66. package/dist/components/popover.d.ts +18 -9
  67. package/dist/components/popover.js +38 -13
  68. package/dist/components/radio-group.d.ts +5 -5
  69. package/dist/components/radio-group.js +23 -29
  70. package/dist/components/resizable.d.ts +8 -21
  71. package/dist/components/resizable.js +5 -10
  72. package/dist/components/scroll-area.d.ts +12 -7
  73. package/dist/components/scroll-area.js +18 -18
  74. package/dist/components/select.d.ts +22 -14
  75. package/dist/components/select.js +90 -51
  76. package/dist/components/separator.d.ts +3 -3
  77. package/dist/components/separator.js +8 -12
  78. package/dist/components/sheet.d.ts +15 -11
  79. package/dist/components/sheet.js +63 -47
  80. package/dist/components/sidebar/context.js +4 -4
  81. package/dist/components/sidebar/group.d.ts +9 -8
  82. package/dist/components/sidebar/group.js +18 -13
  83. package/dist/components/sidebar/layout.d.ts +7 -2
  84. package/dist/components/sidebar/layout.js +11 -3
  85. package/dist/components/sidebar/menu-sub.d.ts +4 -3
  86. package/dist/components/sidebar/menu-sub.js +13 -13
  87. package/dist/components/sidebar/menu.d.ts +6 -6
  88. package/dist/components/sidebar/menu.js +28 -40
  89. package/dist/components/sidebar/panel.js +10 -15
  90. package/dist/components/sidebar/root.d.ts +1 -2
  91. package/dist/components/sidebar/root.js +7 -8
  92. package/dist/components/sidebar/trigger.js +1 -1
  93. package/dist/components/sidebar-tree-indicator.js +4 -4
  94. package/dist/components/skeleton.d.ts +7 -1
  95. package/dist/components/skeleton.js +18 -2
  96. package/dist/components/slider.d.ts +5 -5
  97. package/dist/components/slider.js +20 -11
  98. package/dist/components/spinner.d.ts +2 -2
  99. package/dist/components/spinner.js +24 -188
  100. package/dist/components/string-array.js +2 -2
  101. package/dist/components/switch.d.ts +2 -3
  102. package/dist/components/switch.js +6 -8
  103. package/dist/components/table.d.ts +14 -3
  104. package/dist/components/table.js +33 -9
  105. package/dist/components/tabs.d.ts +34 -8
  106. package/dist/components/tabs.js +96 -23
  107. package/dist/components/text-overflow.d.ts +8 -10
  108. package/dist/components/text-overflow.js +33 -39
  109. package/dist/components/textarea.d.ts +8 -1
  110. package/dist/components/textarea.js +24 -3
  111. package/dist/components/toaster.d.ts +1 -0
  112. package/dist/components/toaster.js +41 -20
  113. package/dist/components/toggle-group.d.ts +5 -3
  114. package/dist/components/toggle-group.js +11 -12
  115. package/dist/components/toggle.d.ts +3 -4
  116. package/dist/components/toggle.js +6 -6
  117. package/dist/components/tooltip.d.ts +7 -6
  118. package/dist/components/tooltip.js +18 -8
  119. package/dist/components/upload.d.ts +7 -2
  120. package/dist/components/upload.js +28 -7
  121. package/dist/components.css +325 -0
  122. package/dist/constants/CountryPhoneCodes.d.ts +1 -1
  123. package/dist/constants/CountryPhoneCodes.js +2 -2
  124. package/dist/federation.d.ts +10 -0
  125. package/dist/federation.js +24 -0
  126. package/dist/fonts.css +1 -1
  127. package/dist/hooks/use-confirm.js +17 -19
  128. package/dist/hooks/use-toast.d.ts +14 -16
  129. package/dist/hooks/use-toast.js +13 -108
  130. package/dist/index.d.ts +9 -8
  131. package/dist/index.js +7 -7
  132. package/dist/lib/cn-tables.d.ts +27 -0
  133. package/dist/lib/cn-tables.js +128 -0
  134. package/dist/lib/utils.d.ts +14 -2
  135. package/dist/lib/utils.js +14 -6
  136. package/dist/modules/attachments/attachment-media.js +56 -56
  137. package/dist/modules/blocks/components/BarcodeAttribute.js +11 -8
  138. package/dist/modules/blocks/components/BarcodeSizeSettings.js +5 -6
  139. package/dist/modules/blocks/components/BlockEditor.js +14 -4
  140. package/dist/modules/blocks/components/BlockEditorInlineContent.d.ts +26 -36
  141. package/dist/modules/blocks/components/BlockEditorInlineContent.js +2 -2
  142. package/dist/modules/blocks/components/BlockToolbar.d.ts +6 -0
  143. package/dist/modules/blocks/components/BlockToolbar.js +19 -4
  144. package/dist/modules/blocks/components/CustomFileBlock.d.ts +13 -39
  145. package/dist/modules/blocks/components/CustomFileBlock.js +8 -9
  146. package/dist/modules/blocks/components/CustomImageBlock.d.ts +28 -78
  147. package/dist/modules/blocks/components/CustomImageBlock.js +20 -99
  148. package/dist/modules/blocks/components/CustomVideoBlock.d.ts +26 -63
  149. package/dist/modules/blocks/components/CustomVideoBlock.js +10 -8
  150. package/dist/modules/blocks/components/DocumentPlaceholderBlock.d.ts +13 -39
  151. package/dist/modules/blocks/components/DocumentPlaceholderBlock.js +1 -2
  152. package/dist/modules/blocks/components/Editor.d.ts +1 -1
  153. package/dist/modules/blocks/components/Editor.js +5 -4
  154. package/dist/modules/blocks/components/FontFamilyButton.js +25 -21
  155. package/dist/modules/blocks/components/FontSizeButton.js +26 -22
  156. package/dist/modules/blocks/components/GalleryBlock.d.ts +7 -25
  157. package/dist/modules/blocks/components/GalleryBlock.js +2 -35
  158. package/dist/modules/blocks/components/GalleryBlockContent.js +8 -3
  159. package/dist/modules/blocks/components/GalleryBlockParts.js +23 -21
  160. package/dist/modules/blocks/components/GalleryExternalHtml.d.ts +2 -0
  161. package/dist/modules/blocks/components/GalleryExternalHtml.js +36 -0
  162. package/dist/modules/blocks/components/ImageExternalHtml.d.ts +2 -0
  163. package/dist/modules/blocks/components/ImageExternalHtml.js +51 -0
  164. package/dist/modules/blocks/components/ImageStyleButton.js +22 -18
  165. package/dist/modules/blocks/components/LazyEditor.d.ts +9 -0
  166. package/dist/modules/blocks/components/LazyEditor.js +14 -0
  167. package/dist/modules/blocks/components/MediaBlockWrapper.d.ts +24 -0
  168. package/dist/modules/blocks/components/MediaBlockWrapper.js +98 -0
  169. package/dist/modules/blocks/components/SlashMenu.js +2 -2
  170. package/dist/modules/blocks/components/SuggestionMenu.js +5 -6
  171. package/dist/modules/blocks/components/TableColorPicker.d.ts +1 -1
  172. package/dist/modules/blocks/components/TableColorPicker.js +20 -27
  173. package/dist/modules/blocks/components/TableHandleWithRemove.js +34 -50
  174. package/dist/modules/blocks/components/toolbar/buttons/ToolbarButton.d.ts +2 -2
  175. package/dist/modules/blocks/components/toolbar/buttons/ToolbarButton.js +3 -4
  176. package/dist/modules/blocks/components/toolbar/buttons/ToolbarToggle.d.ts +2 -2
  177. package/dist/modules/blocks/components/toolbar/buttons/ToolbarToggle.js +3 -4
  178. package/dist/modules/blocks/components/toolbar/menus/MenuCheckboxItem.d.ts +3 -0
  179. package/dist/modules/blocks/components/toolbar/menus/MenuCheckboxItem.js +8 -0
  180. package/dist/modules/blocks/components/toolbar/menus/ToolbarMenuDropdown.js +1 -1
  181. package/dist/modules/blocks/components/toolbar/menus/ToolbarMenuItem.d.ts +2 -2
  182. package/dist/modules/blocks/components/toolbar/menus/ToolbarMenuItem.js +5 -16
  183. package/dist/modules/blocks/components/toolbar/menus/ToolbarSelect.d.ts +1 -1
  184. package/dist/modules/blocks/components/toolbar/menus/ToolbarSelect.js +24 -20
  185. package/dist/modules/blocks/constant/blockEditorSchema.d.ts +268 -653
  186. package/dist/modules/blocks/constant/blockEditorSchema.js +33 -41
  187. package/dist/modules/blocks/constant/galleryBlockConfig.d.ts +1 -2
  188. package/dist/modules/blocks/constant/imageBlockConfig.d.ts +46 -0
  189. package/dist/modules/blocks/constant/imageBlockConfig.js +39 -0
  190. package/dist/modules/blocks/constant/toolbar/editorUIComponents.d.ts +2 -3
  191. package/dist/modules/blocks/constant/toolbar/editorUIComponents.js +7 -9
  192. package/dist/modules/blocks/hooks/toolbar/useCodeActive.js +5 -7
  193. package/dist/modules/blocks/hooks/toolbar/useStringStyle.d.ts +9 -0
  194. package/dist/modules/blocks/hooks/toolbar/useStringStyle.js +27 -0
  195. package/dist/modules/blocks/hooks/useBlockEditor.d.ts +2 -0
  196. package/dist/modules/blocks/hooks/useBlockEditor.js +9 -3
  197. package/dist/modules/blocks/hooks/useEditorValue.d.ts +2 -1
  198. package/dist/modules/blocks/hooks/useEditorValue.js +8 -19
  199. package/dist/modules/blocks/types/TextEditor.d.ts +3 -1
  200. package/dist/modules/blocks/types/toolbar/ImageStyleOption.d.ts +1 -1
  201. package/dist/modules/blocks/utils/getSlashMenuItems.js +0 -15
  202. package/dist/modules/blocks/utils/parseBlocks.d.ts +3 -1
  203. package/dist/modules/blocks/utils/parseBlocks.js +14 -1
  204. package/dist/modules/display/components/EmailDisplay.js +26 -27
  205. package/dist/modules/display/components/PhoneDisplay.js +2 -2
  206. package/dist/modules/display/components/RelativeDateDisplay.d.ts +2 -2
  207. package/dist/modules/display/components/RelativeDateDisplay.js +7 -10
  208. package/dist/modules/filter/components/FilterBar.js +6 -6
  209. package/dist/modules/filter/components/FilterDialog.js +13 -20
  210. package/dist/modules/filter/components/FilterPopover.js +20 -28
  211. package/dist/modules/hotkey/components/PopoverScoped.d.ts +5 -4
  212. package/dist/modules/hotkey/components/PopoverScoped.js +5 -5
  213. package/dist/modules/hotkey/hooks/useScopedHotkeys.d.ts +3 -3
  214. package/dist/modules/hotkey/hooks/useScopedHotkeys.js +15 -24
  215. package/dist/modules/icons/components/IconComponent.d.ts +1 -1
  216. package/dist/modules/icons/components/IconPicker.js +15 -14
  217. package/dist/modules/inputs/components/ContactFieldParts.js +13 -14
  218. package/dist/modules/inputs/components/EmailFieldForm.js +2 -3
  219. package/dist/modules/inputs/components/FullNameField.js +6 -4
  220. package/dist/modules/inputs/components/PhoneFieldForm.js +2 -1
  221. package/dist/modules/layout/components/AppLayout.js +18 -20
  222. package/dist/modules/layout/components/AppLayoutPageSlot.js +1 -1
  223. package/dist/modules/layout/components/AppLayoutResizeHandle.js +1 -1
  224. package/dist/modules/layout/components/Page.d.ts +6 -1
  225. package/dist/modules/layout/components/Page.js +11 -3
  226. package/dist/modules/layout/components/PageHeader.d.ts +10 -3
  227. package/dist/modules/layout/components/PageHeader.js +19 -4
  228. package/dist/modules/navigation-menu/components/NavigationMenu.js +12 -15
  229. package/dist/modules/record-field/components/NumberField.d.ts +2 -2
  230. package/dist/modules/record-field/components/NumberField.js +22 -25
  231. package/dist/modules/record-field/components/TextField.d.ts +3 -3
  232. package/dist/modules/record-field/components/TextField.js +25 -28
  233. package/dist/modules/record-field/meta-inputs/components/PhoneInput.d.ts +3 -1
  234. package/dist/modules/record-field/meta-inputs/components/PhoneInput.js +18 -12
  235. package/dist/modules/record-table/components/CheckboxColumn.d.ts +4 -3
  236. package/dist/modules/record-table/components/CheckboxColumn.js +52 -35
  237. package/dist/modules/record-table/components/MoreColumn.js +4 -3
  238. package/dist/modules/record-table/components/RecordTable.d.ts +3 -2
  239. package/dist/modules/record-table/components/RecordTable.js +2 -1
  240. package/dist/modules/record-table/components/RecordTableCell.d.ts +6 -3
  241. package/dist/modules/record-table/components/RecordTableCell.js +17 -11
  242. package/dist/modules/record-table/components/RecordTableCellInline.d.ts +15 -4
  243. package/dist/modules/record-table/components/RecordTableCellInline.js +48 -24
  244. package/dist/modules/record-table/components/RecordTableColumnSelector.d.ts +1 -2
  245. package/dist/modules/record-table/components/RecordTableColumnSelector.js +48 -45
  246. package/dist/modules/record-table/components/RecordTableContainer.d.ts +8 -3
  247. package/dist/modules/record-table/components/RecordTableContainer.js +28 -16
  248. package/dist/modules/record-table/components/RecordTableCursor.js +4 -4
  249. package/dist/modules/record-table/components/RecordTableHead.d.ts +9 -4
  250. package/dist/modules/record-table/components/RecordTableHead.js +40 -34
  251. package/dist/modules/record-table/components/RecordTableHeader.js +24 -15
  252. package/dist/modules/record-table/components/RecordTableProvider.d.ts +30 -7
  253. package/dist/modules/record-table/components/RecordTableProvider.js +32 -22
  254. package/dist/modules/record-table/components/RecordTableRoot.d.ts +2 -1
  255. package/dist/modules/record-table/components/RecordTableRoot.js +7 -12
  256. package/dist/modules/record-table/components/RecordTableRow.d.ts +8 -1
  257. package/dist/modules/record-table/components/RecordTableRow.js +13 -12
  258. package/dist/modules/record-table/components/RecordTableRowList.d.ts +6 -1
  259. package/dist/modules/record-table/components/RecordTableRowList.js +28 -20
  260. package/dist/modules/record-table/components/RecordTableRowSkeleton.js +8 -12
  261. package/dist/modules/record-table/hooks/useColumnLayout.d.ts +2 -2
  262. package/dist/modules/record-table/hooks/useColumnLayout.js +8 -5
  263. package/dist/modules/record-table/hooks/useTablePreferences.d.ts +5 -5
  264. package/dist/modules/record-table/hooks/useTablePreferences.js +3 -3
  265. package/dist/modules/record-table/utils/columnLayout.d.ts +4 -4
  266. package/dist/modules/record-table/utils/columnLayout.js +7 -7
  267. package/dist/modules/record-table/utils/columnUtils.d.ts +3 -2
  268. package/dist/modules/record-table/utils/rowFields.d.ts +1 -0
  269. package/dist/modules/record-table/utils/rowFields.js +10 -9
  270. package/dist/styles.css +3 -0
  271. package/dist/theme.css +102 -69
  272. package/dist/utils/file-storage.d.ts +1 -1
  273. package/dist/utils/plugin-runtime.d.ts +1 -1
  274. package/dist/utils/record-timeline.d.ts +1 -1
  275. package/dist/utils/record-timeline.js +1 -1
  276. package/package.json +25 -22
  277. package/dist/components/multiselect-options.d.ts +0 -16
  278. package/dist/components/multiselect-options.js +0 -13
  279. package/dist/components/multiselect-parts.d.ts +0 -23
  280. package/dist/components/multiselect-parts.js +0 -62
  281. package/dist/components/multiselect-state.d.ts +0 -66
  282. package/dist/components/multiselect-state.js +0 -131
  283. package/dist/components/time-picker.d.ts +0 -10
  284. package/dist/components/time-picker.js +0 -33
  285. package/dist/components/toasts.d.ts +0 -21
  286. package/dist/components/toasts.js +0 -69
  287. package/dist/modules/blocks/hooks/toolbar/useFontFamily.d.ts +0 -2
  288. package/dist/modules/blocks/hooks/toolbar/useFontFamily.js +0 -24
  289. package/dist/modules/blocks/hooks/toolbar/useFontSize.d.ts +0 -2
  290. package/dist/modules/blocks/hooks/toolbar/useFontSize.js +0 -24
  291. package/dist/modules/blocks/types/toolbar/EditorVisibleBounds.d.ts +0 -6
  292. package/dist/modules/blocks/types/toolbar/EditorVisibleBounds.js +0 -0
  293. package/dist/modules/blocks/types/toolbar/FontFamily.d.ts +0 -5
  294. package/dist/modules/blocks/types/toolbar/FontFamily.js +0 -0
  295. package/dist/modules/blocks/types/toolbar/FontSize.d.ts +0 -5
  296. package/dist/modules/blocks/types/toolbar/FontSize.js +0 -0
  297. package/dist/modules/blocks/types/toolbar/ToolbarMenuItemProps.d.ts +0 -4
  298. package/dist/modules/blocks/types/toolbar/ToolbarMenuItemProps.js +0 -0
  299. package/dist/modules/blocks/types/toolbar/ToolbarPositioningOptions.d.ts +0 -3
  300. package/dist/modules/blocks/types/toolbar/ToolbarPositioningOptions.js +0 -0
  301. package/dist/modules/blocks/utils/toolbar/getEditorVisibleBounds.d.ts +0 -2
  302. package/dist/modules/blocks/utils/toolbar/getEditorVisibleBounds.js +0 -30
  303. package/dist/modules/blocks/utils/toolbar/getToolbarPositioning.d.ts +0 -2
  304. package/dist/modules/blocks/utils/toolbar/getToolbarPositioning.js +0 -41
  305. package/dist/modules/hotkey/hooks/useScopedHotKeysCallback.d.ts +0 -9
  306. package/dist/modules/hotkey/hooks/useScopedHotKeysCallback.js +0 -15
  307. package/dist/modules/hotkey/states/internal/pendingHotkeyState.d.ts +0 -4
  308. package/dist/modules/hotkey/states/internal/pendingHotkeyState.js +0 -4
@@ -5,9 +5,10 @@ import { useToast } from "../hooks/use-toast.js";
5
5
  import { useUpload } from "../hooks/use-upload.js";
6
6
  import { cn } from "../lib/utils.js";
7
7
  import { readImage } from "../utils/core.js";
8
- import { createContext, useContext, useRef, useState } from "react";
9
8
  import { IconTrash, IconUpload, IconUserCircle } from "@tabler/icons-react";
10
9
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
10
+ import { createContext, useContext, useRef, useState } from "react";
11
+ import { cva } from "class-variance-authority";
11
12
  import { useTranslation } from "react-i18next";
12
13
  // src/components/upload.tsx
13
14
  const UploadContext = createContext(null);
@@ -36,14 +37,15 @@ const UploadRoot = ({ ref, className, value, onChange, multiple, ...rest }) => {
36
37
  children: [/* @__PURE__ */ jsx(Dialog, {
37
38
  open: isImageFocused,
38
39
  onOpenChange: setIsImageFocused,
39
- children: /* @__PURE__ */ jsxs(Dialog.Portal, { children: [/* @__PURE__ */ jsx(Dialog.Overlay, { className: "fixed inset-0 bg-accent" }), /* @__PURE__ */ jsx(Dialog.Content, {
40
- className: "fixed left-[50%] top-[50%] translate-x-[-50%] translate-y-[-50%] max-w-none w-auto bg-transparent border-0 p-0",
40
+ children: /* @__PURE__ */ jsx(Dialog.Content, {
41
+ variant: "bare",
42
+ className: "max-w-none w-auto",
41
43
  children: /* @__PURE__ */ jsx("img", {
42
44
  src: readImage(url),
43
45
  alt: "Focused view",
44
- className: "max-h-[90vh] max-w-[90vw] object-contain"
46
+ className: "max-h-lightbox max-w-lightbox object-contain"
45
47
  })
46
- })] })
48
+ })
47
49
  }), /* @__PURE__ */ jsx("div", {
48
50
  ref,
49
51
  className: cn("flex gap-4", className),
@@ -51,6 +53,22 @@ const UploadRoot = ({ ref, className, value, onChange, multiple, ...rest }) => {
51
53
  })]
52
54
  });
53
55
  };
56
+ const uploadPreviewVariants = cva("relative overflow-hidden", {
57
+ variants: {
58
+ variant: {
59
+ default: "",
60
+ avatar: "rounded-full border border-border p-0 shadow-none"
61
+ },
62
+ size: {
63
+ default: "size-16",
64
+ sm: "size-8"
65
+ }
66
+ },
67
+ defaultVariants: {
68
+ variant: "default",
69
+ size: "default"
70
+ }
71
+ });
54
72
  /** Uploads the chosen files, reporting each one and the end of the batch. */
55
73
  const useUploadChosenFiles = ({ onUploadStart, onUploadProgress, onAllUploadsComplete }) => {
56
74
  const { isLoading, upload } = useUpload();
@@ -83,7 +101,7 @@ const useUploadChosenFiles = ({ onUploadStart, onUploadProgress, onAllUploadsCom
83
101
  handleFileChange
84
102
  };
85
103
  };
86
- const UploadPreview = ({ className, ...callbacks }) => {
104
+ const UploadPreview = ({ className, variant, size, ...callbacks }) => {
87
105
  const { url, multiple, fileInputRef, chooseFile, setIsImageFocused } = useUploadContext();
88
106
  const { isLoading, handleFileChange } = useUploadChosenFiles(callbacks);
89
107
  return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("div", {
@@ -91,7 +109,10 @@ const UploadPreview = ({ className, ...callbacks }) => {
91
109
  children: [/* @__PURE__ */ jsxs(Button, {
92
110
  type: "button",
93
111
  variant: "outline",
94
- className: "relative size-16 overflow-hidden",
112
+ className: uploadPreviewVariants({
113
+ variant,
114
+ size
115
+ }),
95
116
  onClick: url ? () => setIsImageFocused(true) : chooseFile,
96
117
  "aria-label": url ? "Change image" : "Upload image",
97
118
  children: [
@@ -0,0 +1,325 @@
1
+ /*
2
+ * Styles utilities can't reach: the BlockNote editor's own markup (slash menu, toolbar, drag
3
+ * handle, headings, theme variables) and the sidebar menu's nested selectors.
4
+ */
5
+ .bn-shadcn {
6
+ --background: 0 0% 100%;
7
+ --foreground: 0 0% 3.9%;
8
+ --card: 0 0% 100%;
9
+ --card-foreground: 0 0% 3.9%;
10
+ --popover: 0 0% 100%;
11
+ --popover-foreground: 240 10% 3.9%;
12
+ --primary: 243 75% 59%;
13
+ --primary-foreground: 0 0% 98%;
14
+ --secondary: 0 0% 96.1%;
15
+ --secondary-foreground: 0 0% 9%;
16
+ --muted: 0 0% 96.1%;
17
+ --muted-foreground: 0 0% 45.1%;
18
+ --accent: 0 0% 96.1%;
19
+ --accent-foreground: 0 0% 9%;
20
+ --destructive: 0 84.2% 60.2%;
21
+ --destructive-foreground: 0 0% 98%;
22
+ --border: 240 5.9% 90%;
23
+ --input: 240 5.9% 90%;
24
+ --ring: 243 75% 59%;
25
+ }
26
+
27
+ .bn-shadcn.dark {
28
+ --background: 240 10% 3.9%;
29
+ --foreground: 0 0% 98%;
30
+ --card: 240 10% 3.9%;
31
+ --card-foreground: 0 0% 98%;
32
+ --popover: 240 10% 3.9%;
33
+ --popover-foreground: 0 0% 98%;
34
+ --secondary: 240 3.7% 15.9%;
35
+ --secondary-foreground: 0 0% 98%;
36
+ --muted: 240 3.7% 15.9%;
37
+ --muted-foreground: 240 5% 64.9%;
38
+ --accent: 240 3.7% 15.9%;
39
+ --accent-foreground: 0 0% 98%;
40
+ --destructive: 0 62.8% 30.6%;
41
+ --destructive-foreground: 0 0% 98%;
42
+ --border: 240 3.7% 15.9%;
43
+ --input: 240 3.7% 15.9%;
44
+ --ring: 234.5 89.5% 73.9%;
45
+ }
46
+
47
+ /* The empty-line placeholder and the drag handle take BlockNote's side-menu colour,
48
+ #cfcfcf by default (1.6:1 on white). */
49
+ .bn-shadcn,
50
+ .bn-shadcn.dark {
51
+ --bn-colors-side-menu: hsl(var(--muted-foreground));
52
+ }
53
+
54
+ .bn-inline-content:has(> .ProseMirror-trailingBreak:only-child):before {
55
+ font-style: normal;
56
+ }
57
+
58
+ .bn-editor {
59
+ padding-inline: 36px;
60
+ min-height: 100%;
61
+ height: 100%;
62
+ }
63
+
64
+ .bn-shadcn .bn-editor {
65
+ background-color: transparent;
66
+ }
67
+
68
+ .bn-default-styles {
69
+ font-size: inherit;
70
+ }
71
+
72
+ .bn-editor [class^='_inlineContent']:before {
73
+ color: var(--muted-foreground);
74
+ font-style: normal !important;
75
+ }
76
+
77
+ .bn-editor .bn-inline-content:has(> .ProseMirror-trailingBreak):before {
78
+ font-style: normal;
79
+ }
80
+
81
+ .bn-editor .bn-container .bn-drag-handle {
82
+ width: 20px;
83
+ height: 20px;
84
+ }
85
+
86
+ .bn-editor .bn-block-content[data-content-type='checkListItem'] > div > div {
87
+ display: flex;
88
+ align-items: center;
89
+ }
90
+
91
+ .bn-editor .bn-drag-handle-menu {
92
+ background: var(--background);
93
+ backdrop-filter: var(--blur-medium);
94
+ box-shadow: var(--shadow-medium);
95
+ min-width: 160px;
96
+ min-height: 96px;
97
+ padding: 4px;
98
+ border: 1px solid var(--border);
99
+ left: 26px;
100
+ }
101
+
102
+ .bn-editor .bn-inline-content,
103
+ .bn-editor .ProseMirror,
104
+ .bn-editor [contenteditable='true'] {
105
+ min-width: 0;
106
+ max-width: 100%;
107
+ overflow-wrap: anywhere;
108
+ }
109
+ .bn-editor .bn-container .bn-suggestion-menu-item:hover {
110
+ background-color: var(--primary);
111
+ }
112
+
113
+ .bn-editor .bn-container .bn-suggestion-menu {
114
+ padding: 4px;
115
+ border-radius: 8px;
116
+ border: 1px solid var(--border);
117
+ background: var(--background);
118
+ backdrop-filter: var(--blur-medium);
119
+ }
120
+
121
+ .bn-editor .bn-color-picker-dropdown {
122
+ margin-left: 8px;
123
+ }
124
+
125
+ .bn-editor .bn-inline-content code {
126
+ font-family: monospace;
127
+ color: var(--font-color-danger);
128
+ padding: 2px 4px;
129
+ border-radius: 4px;
130
+ border: 1px solid var(--font-color-extra-light);
131
+ font-size: 0.9rem;
132
+ background-color: var(--background-transparent-light);
133
+ }
134
+
135
+ .bn-toolbar.bn-formatting-toolbar {
136
+ padding: 2px;
137
+ gap: 2px;
138
+ }
139
+
140
+ .bn-toolbar.bn-formatting-toolbar button {
141
+ height: 28px;
142
+ padding: 4px 7px;
143
+ font-size: 13px;
144
+ outline: none;
145
+ }
146
+
147
+ .read-only.bn-shadcn .bn-editor {
148
+ background-color: transparent;
149
+ padding-inline: 0;
150
+ }
151
+
152
+ .bn-side-menu {
153
+ height: 26px;
154
+ }
155
+
156
+ [data-content-type='heading'] {
157
+ --level: 24px;
158
+ }
159
+ [data-content-type='heading'][data-level='2'] {
160
+ --level: 20px;
161
+ }
162
+
163
+ [data-content-type='heading'][data-level='3'] {
164
+ --level: 16px;
165
+ }
166
+
167
+ .erxes-blocknote {
168
+ --erxes-block-background: var(--background);
169
+ --erxes-block-foreground: var(--foreground);
170
+ --erxes-block-card: var(--background);
171
+ --erxes-block-card-foreground: var(--foreground);
172
+ --erxes-block-primary: var(--primary);
173
+ --erxes-block-primary-foreground: var(--primary-foreground);
174
+ --erxes-block-accent: var(--accent);
175
+ --erxes-block-accent-foreground: var(--accent-foreground);
176
+ --erxes-block-muted: var(--muted);
177
+ --erxes-block-muted-foreground: var(--muted-foreground);
178
+ --erxes-block-destructive: var(--destructive);
179
+ --erxes-block-destructive-foreground: var(--destructive-foreground);
180
+ --erxes-block-border: var(--border);
181
+ --erxes-block-input: var(--input);
182
+ --erxes-block-ring: var(--ring);
183
+ }
184
+ .erxes-block-controls {
185
+ --background: var(--erxes-block-background);
186
+ --foreground: var(--erxes-block-foreground);
187
+ --card: var(--erxes-block-card);
188
+ --card-foreground: var(--erxes-block-card-foreground);
189
+ --primary: var(--erxes-block-primary);
190
+ --primary-foreground: var(--erxes-block-primary-foreground);
191
+ --accent: var(--erxes-block-accent);
192
+ --accent-foreground: var(--erxes-block-accent-foreground);
193
+ --muted: var(--erxes-block-muted);
194
+ --muted-foreground: var(--erxes-block-muted-foreground);
195
+ --destructive: var(--erxes-block-destructive);
196
+ --destructive-foreground: var(--erxes-block-destructive-foreground);
197
+ --border: var(--erxes-block-border);
198
+ --input: var(--erxes-block-input);
199
+ --ring: var(--erxes-block-ring);
200
+ }
201
+
202
+ /* Sidebar body (plugin ./sidebar remotes, core modules): top-level groups use
203
+ 0.5rem padding on all sides; nested groups (like sales board rows) keep theirs */
204
+ [data-navigation-context]
205
+ [data-sidebar='group']:not([data-sidebar='group'] [data-sidebar='group']) {
206
+ padding: 0.5rem;
207
+ }
208
+ /* Sidebar body: the first group starts flush with the switcher, however deeply it is wrapped */
209
+ [data-navigation-context] > [data-sidebar='group']:first-child,
210
+ [data-navigation-context] > :first-child [data-sidebar='group']:first-child,
211
+ [data-navigation-context]
212
+ > [data-sidebar='separator']:first-child
213
+ + *
214
+ [data-sidebar='group']:first-child,
215
+ [data-navigation-context] > [data-sidebar='separator']:first-child + [data-sidebar='group'] {
216
+ padding-top: 0;
217
+ }
218
+ /* All sidebar menus: muted icons, sharper labels */
219
+ :is([data-sidebar='menu-button'], [data-sidebar='menu-sub-button'], [data-nav-row]) {
220
+ transition: color 0.15s ease-out;
221
+ }
222
+ :is([data-sidebar='menu-button'], [data-sidebar='menu-sub-button'], [data-nav-row]) svg {
223
+ color: inherit;
224
+ transition: color 0.15s ease-out;
225
+ }
226
+ :is([data-sidebar='menu-button'], [data-sidebar='menu-sub-button'], [data-nav-row]):not(
227
+ [data-active='true'],
228
+ [data-state='active'],
229
+ .text-primary-text
230
+ ) {
231
+ color: color-mix(in oklab, var(--foreground) 85%, transparent);
232
+ }
233
+ :is([data-sidebar='menu-button'], [data-sidebar='menu-sub-button'], [data-nav-row]):not(
234
+ [data-active='true'],
235
+ [data-state='active'],
236
+ .text-primary-text
237
+ )
238
+ svg {
239
+ color: var(--muted-foreground);
240
+ }
241
+ :is([data-sidebar='menu-button'], [data-sidebar='menu-sub-button'], [data-nav-row]):not(
242
+ [data-active='true'],
243
+ [data-state='active'],
244
+ .text-primary-text
245
+ ):hover,
246
+ :is([data-sidebar='menu-button'], [data-sidebar='menu-sub-button'], [data-nav-row]):not(
247
+ [data-active='true'],
248
+ [data-state='active'],
249
+ .text-primary-text
250
+ ):hover
251
+ svg {
252
+ color: var(--foreground);
253
+ }
254
+ [data-navigation-context]
255
+ [data-sidebar='menu-item']:has([data-nav-actions])
256
+ [data-sidebar='menu-button']:not(:has([data-nav-chevron])) {
257
+ padding-right: 3.75rem;
258
+ }
259
+ [data-navigation-context] [data-sidebar='menu-item']:has([data-nav-actions]) [data-nav-chevron] {
260
+ margin-left: 3.25rem;
261
+ }
262
+ [data-navigation-context] [data-sidebar='menu-item']:has([data-nav-chevron]) [data-nav-actions] {
263
+ right: 1.75rem;
264
+ }
265
+
266
+ /* Inside the editor BlockNote redefines --background/--border as HSL parts, so
267
+ erxes-ui's bg-background/border resolve to nothing: give the slash menu
268
+ solid colours the way BlockNote's own components read them. */
269
+ .bn-shadcn .erxes-suggestion-menu {
270
+ background-color: hsl(var(--background));
271
+ border-color: hsl(var(--border));
272
+ color: hsl(var(--foreground));
273
+ }
274
+
275
+ /* BackgroundGradientAnimation: five colour blobs orbit over a violet to navy backdrop. They
276
+ fill the middle 80%, blend in hard light, and goo merges them through the component's
277
+ #blurMe SVG filter. */
278
+ @utility gradient-backdrop {
279
+ background-image: linear-gradient(40deg, rgb(108 0 162), rgb(0 17 82));
280
+ }
281
+ @utility gradient-blob {
282
+ position: absolute;
283
+ inset: 10%;
284
+ mix-blend-mode: hard-light;
285
+ background-repeat: no-repeat;
286
+ }
287
+ @utility gradient-blob-1 {
288
+ background-image: radial-gradient(circle at center, rgb(18 113 255) 0, rgb(18 113 255) 50%);
289
+ transform-origin: center;
290
+ }
291
+ @utility gradient-blob-2 {
292
+ background-image: radial-gradient(
293
+ circle at center,
294
+ rgb(221 74 255 / 0.8) 0,
295
+ rgb(221 74 255 / 0) 50%
296
+ );
297
+ transform-origin: calc(50% - 400px);
298
+ }
299
+ @utility gradient-blob-3 {
300
+ background-image: radial-gradient(
301
+ circle at center,
302
+ rgb(100 220 255 / 0.8) 0,
303
+ rgb(100 220 255 / 0) 50%
304
+ );
305
+ transform-origin: calc(50% + 400px);
306
+ }
307
+ @utility gradient-blob-4 {
308
+ background-image: radial-gradient(
309
+ circle at center,
310
+ rgb(200 50 50 / 0.8) 0,
311
+ rgb(200 50 50 / 0) 50%
312
+ );
313
+ transform-origin: calc(50% - 200px);
314
+ }
315
+ @utility gradient-blob-5 {
316
+ background-image: radial-gradient(
317
+ circle at center,
318
+ rgb(180 180 50 / 0.8) 0,
319
+ rgb(180 180 50 / 0) 50%
320
+ );
321
+ transform-origin: calc(50% - 800px) calc(50% + 800px);
322
+ }
323
+ @utility goo {
324
+ filter: url(#blurMe) blur(40px);
325
+ }
@@ -3,5 +3,5 @@ import { CountryCode } from "libphonenumber-js";
3
3
  export type PhoneCountry = TCountryCode & {
4
4
  code: CountryCode;
5
5
  };
6
- /** Every country libphonenumber-js knows, with its English name and calling code, by name. */
6
+ /** Every country libphonenumber-js knows, with its English name and calling code: Mongolia first, then by name. */
7
7
  export declare const CountryPhoneCodes: PhoneCountry[];
@@ -3,11 +3,11 @@ import { getCountries, getCountryCallingCode } from "libphonenumber-js";
3
3
  const regionNames = new Intl.DisplayNames(["en"], { type: "region" });
4
4
  /** The flag emoji: each letter of the ISO 3166 code as a regional indicator symbol. */
5
5
  const flagOf = (code) => String.fromCodePoint(...Array.from(code, (letter) => 127397 + letter.charCodeAt(0)));
6
- /** Every country libphonenumber-js knows, with its English name and calling code, by name. */
6
+ /** Every country libphonenumber-js knows, with its English name and calling code: Mongolia first, then by name. */
7
7
  const CountryPhoneCodes = getCountries().map((code) => ({
8
8
  code,
9
9
  name: regionNames.of(code) ?? code,
10
10
  flag: flagOf(code),
11
11
  dial_code: `+${getCountryCallingCode(code)}`
12
- })).toSorted((a, b) => a.name.localeCompare(b.name));
12
+ })).toSorted((a, b) => Number(b.code === "MN") - Number(a.code === "MN") || a.name.localeCompare(b.name));
13
13
  export { CountryPhoneCodes };
@@ -0,0 +1,10 @@
1
+ /**
2
+ * The libraries web shares with plugin UIs as single instances. web's
3
+ * rsbuild.config.ts provides each one; a plugin UI imports this list from
4
+ * `erxes-ui/federation` and declares the same names with `import: false`, so
5
+ * it never bundles a second React, router, query client or erxes-ui. A shared
6
+ * name matches only that exact import, so React's entry points are listed one
7
+ * by one: a remote that bundles its own `react/jsx-runtime` breaks as soon as
8
+ * its React differs from the host's.
9
+ */
10
+ export declare const SHARED: string[];
@@ -0,0 +1,24 @@
1
+ // src/federation.ts
2
+ /**
3
+ * The libraries web shares with plugin UIs as single instances. web's
4
+ * rsbuild.config.ts provides each one; a plugin UI imports this list from
5
+ * `erxes-ui/federation` and declares the same names with `import: false`, so
6
+ * it never bundles a second React, router, query client or erxes-ui. A shared
7
+ * name matches only that exact import, so React's entry points are listed one
8
+ * by one: a remote that bundles its own `react/jsx-runtime` breaks as soon as
9
+ * its React differs from the host's.
10
+ */
11
+ const SHARED = [
12
+ "react",
13
+ "react/jsx-runtime",
14
+ "react/jsx-dev-runtime",
15
+ "react-dom",
16
+ "react-dom/client",
17
+ "react-router",
18
+ "react-router-dom",
19
+ "erxes-ui",
20
+ "jotai",
21
+ "react-i18next",
22
+ "@tanstack/react-query"
23
+ ];
24
+ export { SHARED };
package/dist/fonts.css CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- The fonts erxes uses (Inter, Roboto Mono). Optional: core-ui loads them from
2
+ The fonts erxes uses (Inter, Roboto Mono). Optional: web loads them from
3
3
  its index.html; a standalone app without that page imports this file.
4
4
  */
5
5
  @import url('https://fonts.googleapis.com/css2?family=Inter:opsz,wght@14..32,100..900&family=Roboto+Mono:wght@100..700&display=swap');
@@ -1,9 +1,8 @@
1
1
  import { AlertDialog } from "../components/alert-dialog.js";
2
- import { buttonVariants } from "../components/button.js";
3
2
  import { Input } from "../components/input.js";
4
3
  import { Label } from "../components/label.js";
5
- import { useCallback, useId, useRef, useState } from "react";
6
4
  import { jsx, jsxs } from "react/jsx-runtime";
5
+ import { useCallback, useId, useRef, useState } from "react";
7
6
  import { createRoot } from "react-dom/client";
8
7
  // src/hooks/use-confirm.tsx
9
8
  /** The typed confirmation, when the options ask for one. */
@@ -12,18 +11,21 @@ const ConfirmationField = ({ value, expected, error, inputRef, onChange }) => {
12
11
  return /* @__PURE__ */ jsxs("div", {
13
12
  className: "space-y-2",
14
13
  children: [
15
- /* @__PURE__ */ jsxs(Label, {
14
+ /* @__PURE__ */ jsx(Label, {
16
15
  htmlFor: id,
17
- className: "text-xs select-none",
16
+ className: "select-none",
18
17
  variant: "peer",
19
- children: [
20
- "Type ",
21
- /* @__PURE__ */ jsx("span", {
22
- className: "font-semibold",
23
- children: expected
24
- }),
25
- " in the field below to confirm."
26
- ]
18
+ children: /* @__PURE__ */ jsxs("span", {
19
+ className: "text-xs",
20
+ children: [
21
+ "Type ",
22
+ /* @__PURE__ */ jsx("span", {
23
+ className: "font-semibold",
24
+ children: expected
25
+ }),
26
+ " in the field below to confirm."
27
+ ]
28
+ })
27
29
  }),
28
30
  /* @__PURE__ */ jsx(Input, {
29
31
  id,
@@ -64,11 +66,7 @@ const ConfirmDialog = ({ message, options = {}, onConfirm, onDismiss }) => {
64
66
  return /* @__PURE__ */ jsx(AlertDialog, {
65
67
  open: true,
66
68
  children: /* @__PURE__ */ jsxs(AlertDialog.Content, {
67
- onOpenAutoFocus: (event) => {
68
- if (!inputRef.current) return;
69
- event.preventDefault();
70
- inputRef.current.focus();
71
- },
69
+ initialFocus: confirmationValue ? inputRef : void 0,
72
70
  children: [
73
71
  /* @__PURE__ */ jsxs(AlertDialog.Header, { children: [/* @__PURE__ */ jsx(AlertDialog.Title, { children: message }), description && /* @__PURE__ */ jsxs(AlertDialog.Description, { children: [
74
72
  " ",
@@ -90,11 +88,11 @@ const ConfirmDialog = ({ message, options = {}, onConfirm, onDismiss }) => {
90
88
  /* @__PURE__ */ jsxs(AlertDialog.Footer, { children: [/* @__PURE__ */ jsx(AlertDialog.Cancel, {
91
89
  onClick: onDismiss,
92
90
  type: "button",
93
- className: variants.cancel ? buttonVariants({ variant: variants.cancel }) : void 0,
91
+ variant: variants.cancel,
94
92
  children: cancelLabel
95
93
  }), /* @__PURE__ */ jsx(AlertDialog.Action, {
96
94
  type: "submit",
97
- className: variants.ok ? buttonVariants({ variant: variants.ok }) : void 0,
95
+ variant: variants.ok,
98
96
  children: okLabel
99
97
  })] })
100
98
  ]
@@ -1,21 +1,19 @@
1
- import { ToastActionElement, ToastProps } from "../components/toasts.js";
2
- import React from "react";
3
- type ToasterToast = ToastProps & {
4
- id: string;
5
- title?: React.ReactNode;
6
- description?: React.ReactNode;
7
- action?: ToastActionElement;
8
- dismissOnPointerEnter?: boolean;
1
+ import { ReactElement, ReactNode } from "react";
2
+ export type ToastVariant = 'default' | 'success' | 'warning' | 'destructive';
3
+ export type ToastData = {
4
+ action?: ReactElement;
9
5
  };
10
- type Toast = Omit<ToasterToast, 'id'>;
11
- export declare function toast(props: Toast): {
6
+ /** The one queue every toast goes through; the Toaster renders it. */
7
+ export declare const toastManager: import("@base-ui/react").ToastManager<ToastData>;
8
+ export declare const toast: ({ title, description, variant, action }: {
9
+ title?: ReactNode;
10
+ description?: ReactNode;
11
+ variant?: ToastVariant;
12
+ action?: ReactElement;
13
+ }) => {
12
14
  id: string;
13
15
  dismiss: () => void;
14
- update: (next: ToasterToast) => void;
15
16
  };
16
- export declare function useToast(): {
17
- toasts: ToasterToast[];
17
+ export declare const useToast: () => {
18
18
  toast: typeof toast;
19
- dismiss: (toastId?: string) => void;
20
- };
21
- export {};
19
+ };