@erxes/ui 0.0.0-stage → 3.2.19-2

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 (746) hide show
  1. package/LICENSE.md +672 -0
  2. package/README.md +6 -2
  3. package/dist/components/accordion.d.ts +7 -0
  4. package/dist/components/alert-dialog.d.ts +20 -0
  5. package/dist/components/alert.d.ts +13 -0
  6. package/dist/components/avatar.d.ts +13 -0
  7. package/dist/components/background-gradient-animation.d.ts +16 -0
  8. package/dist/components/badge.d.ts +9 -0
  9. package/dist/components/breadcrumb.d.ts +19 -0
  10. package/dist/components/button.d.ts +10 -0
  11. package/dist/components/calendar.d.ts +5 -0
  12. package/dist/components/card.d.ts +8 -0
  13. package/dist/components/charts.d.ts +61 -0
  14. package/dist/components/checkbox.d.ts +3 -0
  15. package/dist/components/choicebox-group.d.ts +16 -0
  16. package/dist/components/collapsible.d.ts +10 -0
  17. package/dist/components/color-picker.d.ts +34 -0
  18. package/dist/components/combobox.d.ts +83 -0
  19. package/dist/components/command-bar.d.ts +17 -0
  20. package/dist/components/command.d.ts +205 -0
  21. package/dist/components/context-menu.d.ts +27 -0
  22. package/dist/components/copy-text.d.ts +7 -0
  23. package/dist/components/date-picker.d.ts +30 -0
  24. package/dist/components/dialog.d.ts +30 -0
  25. package/dist/components/drag-handle.d.ts +3 -0
  26. package/dist/components/dropdown-menu.d.ts +27 -0
  27. package/dist/components/empty.d.ts +18 -0
  28. package/dist/components/erxes-logo-icon.d.ts +1 -0
  29. package/dist/components/form.d.ts +25 -0
  30. package/dist/components/hover-card.d.ts +6 -0
  31. package/dist/components/index.d.ts +59 -0
  32. package/dist/components/info-card.d.ts +9 -0
  33. package/dist/components/input.d.ts +296 -0
  34. package/dist/components/kbd.d.ts +7 -0
  35. package/dist/components/label.d.ts +6 -0
  36. package/dist/components/multiselect.d.ts +72 -0
  37. package/dist/components/popover.d.ts +12 -0
  38. package/dist/components/radio-group.d.ts +6 -0
  39. package/dist/components/resizable.d.ts +24 -0
  40. package/dist/components/scroll-area.d.ts +13 -0
  41. package/dist/components/search-order-select.d.ts +8 -0
  42. package/dist/components/select.d.ts +14 -0
  43. package/dist/components/separator.d.ts +5 -0
  44. package/dist/components/sheet.d.ts +37 -0
  45. package/dist/components/sidebar/constants.d.ts +11 -0
  46. package/dist/components/sidebar/context.d.ts +26 -0
  47. package/dist/components/sidebar/group.d.ts +9 -0
  48. package/dist/components/sidebar/hooks.d.ts +2 -0
  49. package/dist/components/sidebar/layout.d.ts +11 -0
  50. package/dist/components/sidebar/menu-sub.d.ts +8 -0
  51. package/dist/components/sidebar/menu.d.ts +22 -0
  52. package/dist/components/sidebar/panel.d.ts +6 -0
  53. package/dist/components/sidebar/root.d.ts +9 -0
  54. package/dist/components/sidebar/trigger.d.ts +2 -0
  55. package/dist/components/sidebar-tree-indicator.d.ts +8 -0
  56. package/dist/components/sidebar.d.ts +78 -0
  57. package/dist/components/skeleton.d.ts +4 -0
  58. package/dist/components/slider.d.ts +6 -0
  59. package/dist/components/spinner.d.ts +14 -0
  60. package/dist/components/stepper.d.ts +28 -0
  61. package/dist/components/string-array.d.ts +16 -0
  62. package/dist/components/switch.d.ts +6 -0
  63. package/dist/components/table.d.ts +10 -0
  64. package/dist/components/tabs.d.ts +13 -0
  65. package/dist/components/text-overflow.d.ts +15 -0
  66. package/dist/components/textarea.d.ts +2 -0
  67. package/dist/components/time-picker.d.ts +11 -0
  68. package/dist/components/toaster.d.ts +1 -0
  69. package/dist/components/toasts.d.ts +19 -0
  70. package/dist/components/toggle-group.d.ts +12 -0
  71. package/dist/components/toggle.d.ts +11 -0
  72. package/dist/components/tooltip.d.ts +7 -0
  73. package/dist/components/upload-new.d.ts +16 -0
  74. package/dist/components/upload.d.ts +23 -0
  75. package/dist/constants/AttachmentGql.d.ts +1 -0
  76. package/dist/constants/CountryPhoneCodes.d.ts +2 -0
  77. package/dist/constants/CurrencyCodes.d.ts +6 -0
  78. package/dist/constants/EmailValidationStatusInfos.d.ts +11 -0
  79. package/dist/constants/GraphqlConstants.d.ts +3 -0
  80. package/dist/constants/IanaTimeZones.d.ts +5 -0
  81. package/dist/constants/IntlLanguages.d.ts +74 -0
  82. package/dist/constants/PhoneValidationStatusInfos.d.ts +12 -0
  83. package/dist/constants/SexCodes.d.ts +4 -0
  84. package/dist/constants/index.d.ts +5 -0
  85. package/dist/hooks/index.d.ts +9 -0
  86. package/dist/hooks/use-confirm.d.ts +29 -0
  87. package/dist/hooks/use-cursor-pagination.d.ts +10 -0
  88. package/dist/hooks/use-is-matching-location.d.ts +1 -0
  89. package/dist/hooks/use-media-query.d.ts +1 -0
  90. package/dist/hooks/use-mobile.d.ts +1 -0
  91. package/dist/hooks/use-query-state.d.ts +13 -0
  92. package/dist/hooks/use-toast.d.ts +21 -0
  93. package/dist/hooks/use-upload-chunked.d.ts +13 -0
  94. package/dist/hooks/use-upload-new.d.ts +73 -0
  95. package/dist/hooks/use-upload.d.ts +45 -0
  96. package/dist/index.d.ts +8 -0
  97. package/dist/lib/index.d.ts +1 -0
  98. package/dist/lib/utils.d.ts +11 -0
  99. package/dist/modules/attachments/attachments.d.ts +38 -0
  100. package/dist/modules/attachments/context.d.ts +12 -0
  101. package/dist/modules/attachments/index.d.ts +5 -0
  102. package/dist/modules/attachments/types.d.ts +19 -0
  103. package/dist/modules/blocks/components/BarcodeAttribute.d.ts +12 -0
  104. package/dist/modules/blocks/components/BlockEditor.d.ts +42 -0
  105. package/dist/modules/blocks/components/BlockEditorReadOnly.d.ts +5 -0
  106. package/dist/modules/blocks/components/CustomFileBlock.d.ts +40 -0
  107. package/dist/modules/blocks/components/CustomImageBlock.d.ts +79 -0
  108. package/dist/modules/blocks/components/CustomVideoBlock.d.ts +70 -0
  109. package/dist/modules/blocks/components/DocumentPlaceholderBlock.d.ts +40 -0
  110. package/dist/modules/blocks/components/Editor.d.ts +2 -0
  111. package/dist/modules/blocks/components/FontFamilyButton.d.ts +1 -0
  112. package/dist/modules/blocks/components/GalleryBlock.d.ts +30 -0
  113. package/dist/modules/blocks/components/ImageStyleButton.d.ts +1 -0
  114. package/dist/modules/blocks/components/SlashMenu.d.ts +2 -0
  115. package/dist/modules/blocks/components/SuggestionMenu.d.ts +7 -0
  116. package/dist/modules/blocks/components/TableHandleWithRemove.d.ts +2 -0
  117. package/dist/modules/blocks/components/Toolbar.d.ts +1 -0
  118. package/dist/modules/blocks/components/index.d.ts +6 -0
  119. package/dist/modules/blocks/constant/blockEditorSchema.d.ts +712 -0
  120. package/dist/modules/blocks/constant/index.d.ts +1 -0
  121. package/dist/modules/blocks/hooks/useBlockEditor.d.ts +7 -0
  122. package/dist/modules/blocks/index.d.ts +5 -0
  123. package/dist/modules/blocks/types/TextEditor.d.ts +28 -0
  124. package/dist/modules/blocks/types/index.d.ts +1 -0
  125. package/dist/modules/blocks/utils/getBlockAttachments.d.ts +12 -0
  126. package/dist/modules/blocks/utils/getMentionedUserIds.d.ts +2 -0
  127. package/dist/modules/blocks/utils/index.d.ts +3 -0
  128. package/dist/modules/blocks/utils/parseBlocks.d.ts +2 -0
  129. package/dist/modules/board/components/Board.d.ts +22 -0
  130. package/dist/modules/board/contexts/BoardContext.d.ts +2 -0
  131. package/dist/modules/board/index.d.ts +2 -0
  132. package/dist/modules/board/states/boardStates.d.ts +2 -0
  133. package/dist/modules/board/types/boardTypes.d.ts +42 -0
  134. package/dist/modules/chat-viz/components/ChatVizArea.d.ts +9 -0
  135. package/dist/modules/chat-viz/components/ChatVizBar.d.ts +9 -0
  136. package/dist/modules/chat-viz/components/ChatVizCartesianDecorations.d.ts +7 -0
  137. package/dist/modules/chat-viz/components/ChatVizLine.d.ts +9 -0
  138. package/dist/modules/chat-viz/components/ChatVizMessage.d.ts +16 -0
  139. package/dist/modules/chat-viz/components/ChatVizPie.d.ts +13 -0
  140. package/dist/modules/chat-viz/components/ChatVizSendButton.d.ts +17 -0
  141. package/dist/modules/chat-viz/hooks/useChatVizSend.d.ts +11 -0
  142. package/dist/modules/chat-viz/hooks/useIsClient.d.ts +8 -0
  143. package/dist/modules/chat-viz/index.d.ts +12 -0
  144. package/dist/modules/chat-viz/types/chatVizTypes.d.ts +53 -0
  145. package/dist/modules/chat-viz/utils/chartVizPresentation.d.ts +10 -0
  146. package/dist/modules/chat-viz/utils/chartVizTransforms.d.ts +19 -0
  147. package/dist/modules/chat-viz/utils/chatVizSanitize.d.ts +25 -0
  148. package/dist/modules/display/components/CurrencyDisplay.d.ts +15 -0
  149. package/dist/modules/display/components/EllipsisDisplay.d.ts +2 -0
  150. package/dist/modules/display/components/EmailDisplay.d.ts +2 -0
  151. package/dist/modules/display/components/PhoneDisplay.d.ts +2 -0
  152. package/dist/modules/display/components/RelativeDateDisplay.d.ts +288 -0
  153. package/dist/modules/display/components/SexDisplay.d.ts +4 -0
  154. package/dist/modules/display/index.d.ts +6 -0
  155. package/dist/modules/display/utils/formatEmails.d.ts +3 -0
  156. package/dist/modules/display/utils/formatPhones.d.ts +3 -0
  157. package/dist/modules/email-editor/components/EmailEditor.d.ts +3 -0
  158. package/dist/modules/email-editor/components/EmailPreviewDeviceToggle.d.ts +7 -0
  159. package/dist/modules/email-editor/components/EmailPreviewFrame.d.ts +8 -0
  160. package/dist/modules/email-editor/components/EmailTableBackground.d.ts +4 -0
  161. package/dist/modules/email-editor/components/EmailTableToolbar.d.ts +8 -0
  162. package/dist/modules/email-editor/components/index.d.ts +3 -0
  163. package/dist/modules/email-editor/constant/index.d.ts +4 -0
  164. package/dist/modules/email-editor/extensions/documentPlaceholder.d.ts +20 -0
  165. package/dist/modules/email-editor/extensions/documentPlaceholderBlock.d.ts +19 -0
  166. package/dist/modules/email-editor/extensions/table.d.ts +38 -0
  167. package/dist/modules/email-editor/extensions/tableBlock.d.ts +12 -0
  168. package/dist/modules/email-editor/hooks/useEmailHtml.d.ts +6 -0
  169. package/dist/modules/email-editor/index.d.ts +6 -0
  170. package/dist/modules/email-editor/types/index.d.ts +29 -0
  171. package/dist/modules/email-editor/utils/expandCustomNodes.d.ts +2 -0
  172. package/dist/modules/email-editor/utils/renderEmailHtml.d.ts +5 -0
  173. package/dist/modules/filter/components/Filter.d.ts +909 -0
  174. package/dist/modules/filter/context/FilterContext.d.ts +2 -0
  175. package/dist/modules/filter/date-filter/components/DateFilterCommand.d.ts +7 -0
  176. package/dist/modules/filter/date-filter/components/DialogDateView.d.ts +9 -0
  177. package/dist/modules/filter/date-filter/constants/dateTypes.d.ts +3 -0
  178. package/dist/modules/filter/date-filter/index.d.ts +2 -0
  179. package/dist/modules/filter/date-filter/utils/dateTokens.d.ts +8 -0
  180. package/dist/modules/filter/date-filter/utils/getActiveTab.d.ts +1 -0
  181. package/dist/modules/filter/date-filter/utils/getDisplayValue.d.ts +1 -0
  182. package/dist/modules/filter/date-filter/utils/getYears.d.ts +1 -0
  183. package/dist/modules/filter/date-filter/utils/parseDateRangeFromString.d.ts +4 -0
  184. package/dist/modules/filter/hooks/useFilterContext.d.ts +1 -0
  185. package/dist/modules/filter/hooks/useFilterQueryState.d.ts +4 -0
  186. package/dist/modules/filter/index.d.ts +5 -0
  187. package/dist/modules/filter/states/filterStates.d.ts +15 -0
  188. package/dist/modules/filter/types/filter.d.ts +23 -0
  189. package/dist/modules/focus-sheet/components/focus-sheet.d.ts +51 -0
  190. package/dist/modules/hotkey/components/PopoverScoped.d.ts +10 -0
  191. package/dist/modules/hotkey/constants/defaultHotkeysScopeCustomScopes.d.ts +2 -0
  192. package/dist/modules/hotkey/constants/initialHotkeysScope.d.ts +2 -0
  193. package/dist/modules/hotkey/hooks/usePreviousHotkeyScope.d.ts +5 -0
  194. package/dist/modules/hotkey/hooks/useScopedHotKeysCallback.d.ts +9 -0
  195. package/dist/modules/hotkey/hooks/useScopedHotkeys.d.ts +3 -0
  196. package/dist/modules/hotkey/hooks/useSequenceHotkeys.d.ts +4 -0
  197. package/dist/modules/hotkey/hooks/useSetHotkeyScope.d.ts +2 -0
  198. package/dist/modules/hotkey/index.d.ts +13 -0
  199. package/dist/modules/hotkey/states/internal/currentHotkeyScopeState.d.ts +4 -0
  200. package/dist/modules/hotkey/states/internal/internalHotkeysEnabledScopeState.d.ts +3 -0
  201. package/dist/modules/hotkey/states/internal/pendingHotkeyState.d.ts +2 -0
  202. package/dist/modules/hotkey/states/internal/previousHotkeyScopeState.d.ts +2 -0
  203. package/dist/modules/hotkey/states/setHotkeyScopeState.d.ts +5 -0
  204. package/dist/modules/hotkey/types/AppHotkeyScope.d.ts +7 -0
  205. package/dist/modules/hotkey/types/CustomHotkeyScope.d.ts +6 -0
  206. package/dist/modules/hotkey/types/HotkeyScope.d.ts +5 -0
  207. package/dist/modules/hotkey/utils/isNonTextWritingKey.d.ts +1 -0
  208. package/dist/modules/icons/components/IconComponent.d.ts +5 -0
  209. package/dist/modules/icons/components/IconPicker.d.ts +6 -0
  210. package/dist/modules/icons/components/TablerIcons.d.ts +292 -0
  211. package/dist/modules/icons/hooks/useIcons.d.ts +4 -0
  212. package/dist/modules/icons/index.d.ts +3 -0
  213. package/dist/modules/icons/providers/IconsProvider.d.ts +5 -0
  214. package/dist/modules/icons/states/iconsState.d.ts +4 -0
  215. package/dist/modules/index.d.ts +22 -0
  216. package/dist/modules/inputs/components/CurrencyField.d.ts +442 -0
  217. package/dist/modules/inputs/components/EmailField.d.ts +30 -0
  218. package/dist/modules/inputs/components/FullNameField.d.ts +9 -0
  219. package/dist/modules/inputs/components/LanguageSelect.d.ts +7 -0
  220. package/dist/modules/inputs/components/NumberField.d.ts +6 -0
  221. package/dist/modules/inputs/components/PhoneField.d.ts +56 -0
  222. package/dist/modules/inputs/components/SexField.d.ts +5 -0
  223. package/dist/modules/inputs/components/TimezoneSelect.d.ts +7 -0
  224. package/dist/modules/inputs/contexts/EmailFieldsContext.d.ts +8 -0
  225. package/dist/modules/inputs/contexts/FullNameFieldContext.d.ts +7 -0
  226. package/dist/modules/inputs/contexts/PhoneFieldsContext.d.ts +6 -0
  227. package/dist/modules/inputs/hooks/useEmailFields.d.ts +6 -0
  228. package/dist/modules/inputs/hooks/useFullNameField.d.ts +7 -0
  229. package/dist/modules/inputs/hooks/usePhoneFields.d.ts +5 -0
  230. package/dist/modules/inputs/index.d.ts +8 -0
  231. package/dist/modules/inputs/states/emailFieldStates.d.ts +8 -0
  232. package/dist/modules/inputs/states/phoneFieldStates.d.ts +8 -0
  233. package/dist/modules/inputs/validations/emailValidation.d.ts +8 -0
  234. package/dist/modules/inputs/validations/phoneValidation.d.ts +8 -0
  235. package/dist/modules/layout/components/Page.d.ts +5 -0
  236. package/dist/modules/layout/index.d.ts +1 -0
  237. package/dist/modules/motion/components/TextEffect.d.ts +26 -0
  238. package/dist/modules/motion/components/TextLoop.d.ts +12 -0
  239. package/dist/modules/motion/index.d.ts +2 -0
  240. package/dist/modules/navigation-menu/components/NavigationMenu.d.ts +55 -0
  241. package/dist/modules/navigation-menu/components/NavigationMenuItemControls.d.ts +11 -0
  242. package/dist/modules/navigation-menu/index.d.ts +3 -0
  243. package/dist/modules/navigation-menu/states/activePluginState.d.ts +1 -0
  244. package/dist/modules/preview/components/Preview.d.ts +43 -0
  245. package/dist/modules/preview/context/PreviewContext.d.ts +6 -0
  246. package/dist/modules/record-field/components/NumberField.d.ts +18 -0
  247. package/dist/modules/record-field/components/TextField.d.ts +17 -0
  248. package/dist/modules/record-field/index.d.ts +3 -0
  249. package/dist/modules/record-field/meta-inputs/components/EmailVerificationInput.d.ts +8 -0
  250. package/dist/modules/record-field/meta-inputs/components/PhoneInput.d.ts +13 -0
  251. package/dist/modules/record-field/meta-inputs/components/PhoneVerificationInput.d.ts +8 -0
  252. package/dist/modules/record-field/meta-inputs/components/TextFieldInput.d.ts +4 -0
  253. package/dist/modules/record-table/components/CheckboxColumn.d.ts +2 -0
  254. package/dist/modules/record-table/components/MoreColumn.d.ts +3 -0
  255. package/dist/modules/record-table/components/RecordTableArrowEffect.d.ts +4 -0
  256. package/dist/modules/record-table/components/RecordTableCell.d.ts +5 -0
  257. package/dist/modules/record-table/components/RecordTableCellInline.d.ts +14 -0
  258. package/dist/modules/record-table/components/RecordTableColumnSelector.d.ts +4 -0
  259. package/dist/modules/record-table/components/RecordTableContainer.d.ts +7 -0
  260. package/dist/modules/record-table/components/RecordTableCursor.d.ts +20 -0
  261. package/dist/modules/record-table/components/RecordTableDnDProvider.d.ts +8 -0
  262. package/dist/modules/record-table/components/RecordTableHead.d.ts +9 -0
  263. package/dist/modules/record-table/components/RecordTableHeader.d.ts +3 -0
  264. package/dist/modules/record-table/components/RecordTableHotkeyCell.d.ts +8 -0
  265. package/dist/modules/record-table/components/RecordTableInlineHead.d.ts +5 -0
  266. package/dist/modules/record-table/components/RecordTableProvider.d.ts +14 -0
  267. package/dist/modules/record-table/components/RecordTableRoot.d.ts +2 -0
  268. package/dist/modules/record-table/components/RecordTableRow.d.ts +6 -0
  269. package/dist/modules/record-table/components/RecordTableRowList.d.ts +5 -0
  270. package/dist/modules/record-table/components/RecordTableRowSkeleton.d.ts +6 -0
  271. package/dist/modules/record-table/components/RecordTableScroll.d.ts +4 -0
  272. package/dist/modules/record-table/components/RecordTableTree.d.ts +23 -0
  273. package/dist/modules/record-table/contexts/RecordTableCursorContext.d.ts +2 -0
  274. package/dist/modules/record-table/contexts/RecordTableHotkeyContext.d.ts +16 -0
  275. package/dist/modules/record-table/contexts/RecordTableTreeContext.d.ts +2 -0
  276. package/dist/modules/record-table/hooks/usePopoverOnEnter.d.ts +3 -0
  277. package/dist/modules/record-table/hooks/useRecordTableCursor.d.ts +6 -0
  278. package/dist/modules/record-table/hooks/useRecordTableCursorContext.d.ts +1 -0
  279. package/dist/modules/record-table/hooks/useRecordTableTree.d.ts +9 -0
  280. package/dist/modules/record-table/hooks/useTablePreferences.d.ts +11 -0
  281. package/dist/modules/record-table/states/EditModePositionComponentState.d.ts +3 -0
  282. package/dist/modules/record-table/states/RecordTableCursorState.d.ts +3 -0
  283. package/dist/modules/record-table/states/RecordTableTreeState.d.ts +3 -0
  284. package/dist/modules/record-table/types/RecordTableCursorTypes.d.ts +23 -0
  285. package/dist/modules/record-table/types/RecordTableScope.d.ts +3 -0
  286. package/dist/modules/record-table/types/RecordTableTreeTypes.d.ts +6 -0
  287. package/dist/modules/record-table/types/recordTableTypes.d.ts +7 -0
  288. package/dist/modules/record-table/utils/columnUtils.d.ts +4 -0
  289. package/dist/modules/record-table/utils/cursorUtils.d.ts +25 -0
  290. package/dist/modules/report/components/report-page-container.d.ts +4 -0
  291. package/dist/modules/report/components/report-table.d.ts +19 -0
  292. package/dist/modules/report/index.d.ts +2 -0
  293. package/dist/modules/report/states/reportSettingsState.d.ts +13 -0
  294. package/dist/modules/select-operation/components/SelectOperation.d.ts +17 -0
  295. package/dist/modules/select-operation/index.d.ts +1 -0
  296. package/dist/modules/select-tree/components/SelectTree.d.ts +63 -0
  297. package/dist/modules/select-tree/context/SelectTreeContext.d.ts +3 -0
  298. package/dist/modules/select-tree/hooks/useSelectTreeHide.d.ts +6 -0
  299. package/dist/modules/select-tree/index.d.ts +1 -0
  300. package/dist/modules/select-tree/states/selectTreeStates.d.ts +3 -0
  301. package/dist/modules/select-tree/types/selectTreeTypes.d.ts +11 -0
  302. package/dist/modules/side-menu/components/SideMenu.d.ts +34 -0
  303. package/dist/modules/side-menu/context/SideMenuContext.d.ts +8 -0
  304. package/dist/state/index.d.ts +2 -0
  305. package/dist/state/sidebarPanelState.d.ts +1 -0
  306. package/dist/state/themeState.d.ts +2 -0
  307. package/dist/types/CountryCode.d.ts +6 -0
  308. package/dist/types/CurrencyCode.d.ts +159 -0
  309. package/dist/types/Displays.d.ts +5 -0
  310. package/dist/types/Gql.d.ts +14 -0
  311. package/dist/types/Key.d.ts +997 -0
  312. package/dist/types/Relations.d.ts +13 -0
  313. package/dist/types/SexCode.d.ts +6 -0
  314. package/dist/types/Theme.d.ts +2 -0
  315. package/dist/types/UIConfig.d.ts +167 -0
  316. package/dist/types/Utils.d.ts +11 -0
  317. package/dist/types/ValidationStatus.d.ts +4 -0
  318. package/dist/types/index.d.ts +11 -0
  319. package/dist/utils/IsUndefinedOrNull.d.ts +1 -0
  320. package/dist/utils/colors.d.ts +7 -0
  321. package/dist/utils/config/index.d.ts +14 -0
  322. package/dist/utils/cookie-storage.d.ts +9 -0
  323. package/dist/utils/core.d.ts +2 -0
  324. package/dist/utils/fixOrder.d.ts +4 -0
  325. package/dist/utils/format/formatAmount.d.ts +1 -0
  326. package/dist/utils/format/formatPhoneNumber.d.ts +5 -0
  327. package/dist/utils/format/index.d.ts +2 -0
  328. package/dist/utils/getPluginAssetsUrl.d.ts +1 -0
  329. package/dist/utils/highlightMatch.d.ts +1 -0
  330. package/dist/utils/index.d.ts +18 -0
  331. package/dist/utils/isAnObject.d.ts +1 -0
  332. package/dist/utils/isDeeplyEqual.d.ts +3 -0
  333. package/dist/utils/isDefined.d.ts +1 -0
  334. package/dist/utils/isEnabled.d.ts +1 -0
  335. package/dist/utils/localization/detectTimeZone.d.ts +5 -0
  336. package/dist/utils/localization/formatDateISOStringToRelativeDate.d.ts +2 -0
  337. package/dist/utils/localization/formatTimeZoneLabel.d.ts +7 -0
  338. package/dist/utils/localization/index.d.ts +3 -0
  339. package/dist/utils/logDebug.d.ts +1 -0
  340. package/dist/utils/regex/index.d.ts +1 -0
  341. package/dist/utils/regex/passwordRegex.d.ts +1 -0
  342. package/dist/utils/searchProvider.d.ts +9 -0
  343. package/dist/utils/string-array.d.ts +6 -0
  344. package/dist/utils/stripHtml.d.ts +5 -0
  345. package/dist/utils/urlParser.d.ts +8 -0
  346. package/dist/utils/videoEmbed.d.ts +14 -0
  347. package/package.json +106 -4
  348. package/src/components/__stories__/accordion.stories.tsx +69 -0
  349. package/src/components/__stories__/alert-dialog.stories.tsx +39 -0
  350. package/src/components/__stories__/avatar.stories.tsx +32 -0
  351. package/src/components/__stories__/badge.stories.tsx +46 -0
  352. package/src/components/__stories__/breadcrumb.stories.tsx +50 -0
  353. package/src/components/__stories__/button.stories.tsx +22 -0
  354. package/src/components/__stories__/calendar.stories.tsx +47 -0
  355. package/src/components/__stories__/calendarTwoMonths.stories.tsx +47 -0
  356. package/src/components/__stories__/card.stories.tsx +60 -0
  357. package/src/components/__stories__/checkbox.stories.tsx +74 -0
  358. package/src/components/__stories__/collapsible.stories.tsx +78 -0
  359. package/src/components/__stories__/combobox.stories.tsx +158 -0
  360. package/src/components/__stories__/command.stories.tsx +78 -0
  361. package/src/components/__stories__/commandbar.stories.tsx +42 -0
  362. package/src/components/__stories__/date-picker.stories.tsx +83 -0
  363. package/src/components/__stories__/dialog.stories.tsx +53 -0
  364. package/src/components/__stories__/dropdown-menu.stories.tsx +140 -0
  365. package/src/components/__stories__/form.stories.tsx +166 -0
  366. package/src/components/__stories__/hover-card.stories.tsx +50 -0
  367. package/src/components/__stories__/input.stories.tsx +75 -0
  368. package/src/components/__stories__/inputnumber.stories.tsx +35 -0
  369. package/src/components/__stories__/kbd.stories.tsx +91 -0
  370. package/src/components/__stories__/label.stories.tsx +82 -0
  371. package/src/components/__stories__/multiselect.stories.tsx +178 -0
  372. package/src/components/__stories__/popover.stories.tsx +106 -0
  373. package/src/components/__stories__/radio-group.stories.tsx +97 -0
  374. package/src/components/__stories__/resizeble.stories.tsx +76 -0
  375. package/src/components/__stories__/scroll-area.stories.tsx +36 -0
  376. package/src/components/__stories__/select.stories.tsx +107 -0
  377. package/src/components/__stories__/separator.stories.tsx +53 -0
  378. package/src/components/__stories__/sheet.stories.tsx +62 -0
  379. package/src/components/__stories__/sidebar.stories.tsx +104 -0
  380. package/src/components/__stories__/skeleton.stories.tsx +27 -0
  381. package/src/components/__stories__/slider.stories.tsx +71 -0
  382. package/src/components/__stories__/spinner.stories.tsx +39 -0
  383. package/src/components/__stories__/switch.stories.tsx +63 -0
  384. package/src/components/__stories__/table.stories.tsx +140 -0
  385. package/src/components/__stories__/tabs.stories.tsx +76 -0
  386. package/src/components/__stories__/text-overflow.stories.tsx +32 -0
  387. package/src/components/__stories__/textarea.stories.tsx +75 -0
  388. package/src/components/__stories__/time-picker.stories.tsx +0 -0
  389. package/src/components/__stories__/toaster.stories.tsx +53 -0
  390. package/src/components/__stories__/toggle-group.stories.tsx +50 -0
  391. package/src/components/__stories__/toggle.stories.tsx +38 -0
  392. package/src/components/__stories__/tooltip.stories.tsx +90 -0
  393. package/src/components/accordion.tsx +64 -0
  394. package/src/components/alert-dialog.tsx +139 -0
  395. package/src/components/alert.tsx +71 -0
  396. package/src/components/avatar.tsx +75 -0
  397. package/src/components/background-gradient-animation.tsx +192 -0
  398. package/src/components/badge.tsx +61 -0
  399. package/src/components/breadcrumb.tsx +118 -0
  400. package/src/components/button.tsx +58 -0
  401. package/src/components/calendar.tsx +178 -0
  402. package/src/components/card.tsx +85 -0
  403. package/src/components/charts.tsx +363 -0
  404. package/src/components/checkbox.tsx +50 -0
  405. package/src/components/choicebox-group.tsx +103 -0
  406. package/src/components/collapsible.tsx +46 -0
  407. package/src/components/color-picker.tsx +195 -0
  408. package/src/components/combobox.tsx +212 -0
  409. package/src/components/command-bar.tsx +108 -0
  410. package/src/components/command.tsx +261 -0
  411. package/src/components/context-menu.tsx +183 -0
  412. package/src/components/copy-text.tsx +52 -0
  413. package/src/components/date-picker.tsx +418 -0
  414. package/src/components/dialog.tsx +169 -0
  415. package/src/components/drag-handle.tsx +30 -0
  416. package/src/components/dropdown-menu.tsx +186 -0
  417. package/src/components/empty.tsx +102 -0
  418. package/src/components/erxes-logo-icon.tsx +16 -0
  419. package/src/components/form.tsx +174 -0
  420. package/src/components/hover-card.tsx +27 -0
  421. package/src/components/index.ts +59 -0
  422. package/src/components/info-card.tsx +70 -0
  423. package/src/components/input.tsx +95 -0
  424. package/src/components/kbd.tsx +30 -0
  425. package/src/components/label.tsx +35 -0
  426. package/src/components/multiselect.tsx +647 -0
  427. package/src/components/popover.tsx +57 -0
  428. package/src/components/radio-group.tsx +54 -0
  429. package/src/components/resizable.tsx +47 -0
  430. package/src/components/scroll-area.tsx +81 -0
  431. package/src/components/search-order-select.tsx +30 -0
  432. package/src/components/select.tsx +156 -0
  433. package/src/components/separator.tsx +50 -0
  434. package/src/components/sheet.tsx +184 -0
  435. package/src/components/sidebar/constants.ts +19 -0
  436. package/src/components/sidebar/context.tsx +206 -0
  437. package/src/components/sidebar/group.tsx +79 -0
  438. package/src/components/sidebar/hooks.ts +21 -0
  439. package/src/components/sidebar/layout.tsx +91 -0
  440. package/src/components/sidebar/menu-sub.tsx +66 -0
  441. package/src/components/sidebar/menu.tsx +216 -0
  442. package/src/components/sidebar/panel.tsx +160 -0
  443. package/src/components/sidebar/root.tsx +169 -0
  444. package/src/components/sidebar/trigger.tsx +39 -0
  445. package/src/components/sidebar-tree-indicator.tsx +125 -0
  446. package/src/components/sidebar.tsx +66 -0
  447. package/src/components/skeleton.tsx +29 -0
  448. package/src/components/slider.tsx +30 -0
  449. package/src/components/spinner.tsx +168 -0
  450. package/src/components/stepper.tsx +304 -0
  451. package/src/components/string-array.tsx +72 -0
  452. package/src/components/switch.tsx +50 -0
  453. package/src/components/table.tsx +116 -0
  454. package/src/components/tabs.tsx +93 -0
  455. package/src/components/text-overflow.tsx +128 -0
  456. package/src/components/textarea.tsx +21 -0
  457. package/src/components/time-picker.tsx +89 -0
  458. package/src/components/toaster.tsx +42 -0
  459. package/src/components/toasts.tsx +140 -0
  460. package/src/components/toggle-group.tsx +68 -0
  461. package/src/components/toggle.tsx +39 -0
  462. package/src/components/tooltip.tsx +36 -0
  463. package/src/components/upload-new.tsx +301 -0
  464. package/src/components/upload.tsx +335 -0
  465. package/src/constants/AttachmentGql.ts +9 -0
  466. package/src/constants/CountryPhoneCodes.ts +360 -0
  467. package/src/constants/CurrencyCodes.ts +214 -0
  468. package/src/constants/EmailValidationStatusInfos.tsx +46 -0
  469. package/src/constants/GraphqlConstants.ts +23 -0
  470. package/src/constants/IanaTimeZones.ts +600 -0
  471. package/src/constants/IntlLanguages.ts +74 -0
  472. package/src/constants/PhoneValidationStatusInfos.tsx +57 -0
  473. package/src/constants/SexCodes.ts +16 -0
  474. package/src/constants/index.ts +5 -0
  475. package/src/hooks/index.ts +9 -0
  476. package/src/hooks/use-confirm.tsx +212 -0
  477. package/src/hooks/use-cursor-pagination.tsx +42 -0
  478. package/src/hooks/use-is-matching-location.tsx +17 -0
  479. package/src/hooks/use-media-query.tsx +26 -0
  480. package/src/hooks/use-mobile.tsx +7 -0
  481. package/src/hooks/use-query-state.tsx +193 -0
  482. package/src/hooks/use-toast.tsx +188 -0
  483. package/src/hooks/use-upload-chunked.ts +173 -0
  484. package/src/hooks/use-upload-new.ts +242 -0
  485. package/src/hooks/use-upload.tsx +223 -0
  486. package/src/index.ts +8 -0
  487. package/src/lib/index.ts +1 -0
  488. package/src/lib/utils.ts +74 -0
  489. package/src/modules/__stories__/IconPicker.stories.tsx +19 -0
  490. package/src/modules/__stories__/RelativeDateDisplay.stories.tsx +97 -0
  491. package/src/modules/__stories__/blocks.stories.tsx +132 -0
  492. package/src/modules/__stories__/currencyDisplay.stories.tsx +78 -0
  493. package/src/modules/__stories__/icons.stories.tsx +29 -0
  494. package/src/modules/__stories__/preview.stories.tsx +55 -0
  495. package/src/modules/attachments/attachments.tsx +743 -0
  496. package/src/modules/attachments/context.tsx +116 -0
  497. package/src/modules/attachments/index.ts +11 -0
  498. package/src/modules/attachments/types.ts +72 -0
  499. package/src/modules/blocks/components/BarcodeAttribute.tsx +142 -0
  500. package/src/modules/blocks/components/BlockEditor.tsx +248 -0
  501. package/src/modules/blocks/components/BlockEditorReadOnly.tsx +67 -0
  502. package/src/modules/blocks/components/CustomFileBlock.tsx +85 -0
  503. package/src/modules/blocks/components/CustomImageBlock.tsx +366 -0
  504. package/src/modules/blocks/components/CustomVideoBlock.tsx +118 -0
  505. package/src/modules/blocks/components/DocumentPlaceholderBlock.tsx +114 -0
  506. package/src/modules/blocks/components/Editor.tsx +156 -0
  507. package/src/modules/blocks/components/FontFamilyButton.tsx +121 -0
  508. package/src/modules/blocks/components/GalleryBlock.tsx +380 -0
  509. package/src/modules/blocks/components/ImageStyleButton.tsx +100 -0
  510. package/src/modules/blocks/components/SlashMenu.tsx +76 -0
  511. package/src/modules/blocks/components/SuggestionMenu.tsx +57 -0
  512. package/src/modules/blocks/components/TableHandleWithRemove.tsx +238 -0
  513. package/src/modules/blocks/components/Toolbar.tsx +67 -0
  514. package/src/modules/blocks/components/index.ts +6 -0
  515. package/src/modules/blocks/constant/blockEditorSchema.ts +56 -0
  516. package/src/modules/blocks/constant/index.ts +1 -0
  517. package/src/modules/blocks/hooks/useBlockEditor.tsx +65 -0
  518. package/src/modules/blocks/index.ts +5 -0
  519. package/src/modules/blocks/types/TextEditor.ts +37 -0
  520. package/src/modules/blocks/types/index.ts +1 -0
  521. package/src/modules/blocks/utils/getBlockAttachments.ts +68 -0
  522. package/src/modules/blocks/utils/getMentionedUserIds.ts +22 -0
  523. package/src/modules/blocks/utils/index.ts +3 -0
  524. package/src/modules/blocks/utils/parseBlocks.ts +33 -0
  525. package/src/modules/board/components/Board.tsx +301 -0
  526. package/src/modules/board/contexts/BoardContext.ts +8 -0
  527. package/src/modules/board/index.ts +2 -0
  528. package/src/modules/board/states/boardStates.ts +8 -0
  529. package/src/modules/board/types/boardTypes.ts +61 -0
  530. package/src/modules/chat-viz/components/ChatVizArea.tsx +69 -0
  531. package/src/modules/chat-viz/components/ChatVizBar.tsx +62 -0
  532. package/src/modules/chat-viz/components/ChatVizCartesianDecorations.tsx +42 -0
  533. package/src/modules/chat-viz/components/ChatVizLine.tsx +68 -0
  534. package/src/modules/chat-viz/components/ChatVizMessage.tsx +210 -0
  535. package/src/modules/chat-viz/components/ChatVizPie.tsx +104 -0
  536. package/src/modules/chat-viz/components/ChatVizSendButton.tsx +49 -0
  537. package/src/modules/chat-viz/hooks/useChatVizSend.ts +22 -0
  538. package/src/modules/chat-viz/hooks/useIsClient.ts +16 -0
  539. package/src/modules/chat-viz/index.ts +31 -0
  540. package/src/modules/chat-viz/types/chatVizTypes.ts +59 -0
  541. package/src/modules/chat-viz/utils/chartVizPresentation.ts +34 -0
  542. package/src/modules/chat-viz/utils/chartVizTransforms.ts +177 -0
  543. package/src/modules/chat-viz/utils/chatVizInteractive.test.ts +152 -0
  544. package/src/modules/chat-viz/utils/chatVizSanitize.ts +276 -0
  545. package/src/modules/display/components/CurrencyDisplay.tsx +78 -0
  546. package/src/modules/display/components/EllipsisDisplay.tsx +18 -0
  547. package/src/modules/display/components/EmailDisplay.tsx +36 -0
  548. package/src/modules/display/components/PhoneDisplay.tsx +37 -0
  549. package/src/modules/display/components/RelativeDateDisplay.tsx +53 -0
  550. package/src/modules/display/components/SexDisplay.tsx +10 -0
  551. package/src/modules/display/index.ts +6 -0
  552. package/src/modules/display/utils/formatEmails.ts +29 -0
  553. package/src/modules/display/utils/formatPhones.ts +29 -0
  554. package/src/modules/email-editor/components/EmailEditor.tsx +165 -0
  555. package/src/modules/email-editor/components/EmailPreviewDeviceToggle.tsx +33 -0
  556. package/src/modules/email-editor/components/EmailPreviewFrame.tsx +35 -0
  557. package/src/modules/email-editor/components/EmailTableBackground.tsx +134 -0
  558. package/src/modules/email-editor/components/EmailTableToolbar.tsx +82 -0
  559. package/src/modules/email-editor/components/index.ts +3 -0
  560. package/src/modules/email-editor/constant/index.ts +63 -0
  561. package/src/modules/email-editor/extensions/documentPlaceholder.ts +114 -0
  562. package/src/modules/email-editor/extensions/documentPlaceholderBlock.tsx +36 -0
  563. package/src/modules/email-editor/extensions/table.ts +352 -0
  564. package/src/modules/email-editor/extensions/tableBlock.tsx +13 -0
  565. package/src/modules/email-editor/hooks/useEmailHtml.ts +36 -0
  566. package/src/modules/email-editor/index.ts +6 -0
  567. package/src/modules/email-editor/maily-subpaths.d.ts +90 -0
  568. package/src/modules/email-editor/types/index.ts +37 -0
  569. package/src/modules/email-editor/utils/expandCustomNodes.ts +190 -0
  570. package/src/modules/email-editor/utils/renderEmailHtml.ts +52 -0
  571. package/src/modules/filter/components/Filter.tsx +568 -0
  572. package/src/modules/filter/context/FilterContext.tsx +6 -0
  573. package/src/modules/filter/date-filter/components/DateFilterCommand.tsx +59 -0
  574. package/src/modules/filter/date-filter/components/DialogDateView.tsx +270 -0
  575. package/src/modules/filter/date-filter/constants/dateTypes.tsx +25 -0
  576. package/src/modules/filter/date-filter/index.ts +2 -0
  577. package/src/modules/filter/date-filter/utils/dateTokens.ts +28 -0
  578. package/src/modules/filter/date-filter/utils/getActiveTab.ts +17 -0
  579. package/src/modules/filter/date-filter/utils/getDisplayValue.ts +49 -0
  580. package/src/modules/filter/date-filter/utils/getYears.ts +13 -0
  581. package/src/modules/filter/date-filter/utils/parseDateRangeFromString.ts +101 -0
  582. package/src/modules/filter/hooks/useFilterContext.tsx +6 -0
  583. package/src/modules/filter/hooks/useFilterQueryState.tsx +24 -0
  584. package/src/modules/filter/index.ts +5 -0
  585. package/src/modules/filter/states/filterStates.ts +14 -0
  586. package/src/modules/filter/types/filter.ts +29 -0
  587. package/src/modules/focus-sheet/components/focus-sheet.tsx +335 -0
  588. package/src/modules/hotkey/components/PopoverScoped.tsx +77 -0
  589. package/src/modules/hotkey/constants/defaultHotkeysScopeCustomScopes.ts +6 -0
  590. package/src/modules/hotkey/constants/initialHotkeysScope.ts +12 -0
  591. package/src/modules/hotkey/hooks/usePreviousHotkeyScope.tsx +59 -0
  592. package/src/modules/hotkey/hooks/useScopedHotKeysCallback.tsx +83 -0
  593. package/src/modules/hotkey/hooks/useScopedHotkeys.tsx +61 -0
  594. package/src/modules/hotkey/hooks/useSequenceHotkeys.tsx +79 -0
  595. package/src/modules/hotkey/hooks/useSetHotkeyScope.tsx +27 -0
  596. package/src/modules/hotkey/index.ts +18 -0
  597. package/src/modules/hotkey/states/internal/currentHotkeyScopeState.ts +6 -0
  598. package/src/modules/hotkey/states/internal/internalHotkeysEnabledScopeState.ts +3 -0
  599. package/src/modules/hotkey/states/internal/pendingHotkeyState.ts +4 -0
  600. package/src/modules/hotkey/states/internal/previousHotkeyScopeState.ts +4 -0
  601. package/src/modules/hotkey/states/setHotkeyScopeState.ts +92 -0
  602. package/src/modules/hotkey/types/AppHotkeyScope.ts +7 -0
  603. package/src/modules/hotkey/types/CustomHotkeyScope.ts +6 -0
  604. package/src/modules/hotkey/types/HotkeyScope.ts +6 -0
  605. package/src/modules/hotkey/utils/isNonTextWritingKey.ts +57 -0
  606. package/src/modules/icons/components/IconComponent.tsx +13 -0
  607. package/src/modules/icons/components/IconPicker.tsx +55 -0
  608. package/src/modules/icons/components/TablerIcons.ts +585 -0
  609. package/src/modules/icons/hooks/useIcons.ts +23 -0
  610. package/src/modules/icons/index.ts +3 -0
  611. package/src/modules/icons/providers/IconsProvider.tsx +20 -0
  612. package/src/modules/icons/states/iconsState.ts +4 -0
  613. package/src/modules/index.ts +22 -0
  614. package/src/modules/inputs/components/CurrencyField.tsx +217 -0
  615. package/src/modules/inputs/components/EmailField.tsx +425 -0
  616. package/src/modules/inputs/components/FullNameField.tsx +121 -0
  617. package/src/modules/inputs/components/LanguageSelect.tsx +46 -0
  618. package/src/modules/inputs/components/NumberField.tsx +29 -0
  619. package/src/modules/inputs/components/PhoneField.tsx +491 -0
  620. package/src/modules/inputs/components/SexField.tsx +31 -0
  621. package/src/modules/inputs/components/TimezoneSelect.tsx +48 -0
  622. package/src/modules/inputs/contexts/EmailFieldsContext.tsx +15 -0
  623. package/src/modules/inputs/contexts/FullNameFieldContext.tsx +9 -0
  624. package/src/modules/inputs/contexts/PhoneFieldsContext.tsx +12 -0
  625. package/src/modules/inputs/hooks/useEmailFields.tsx +4 -0
  626. package/src/modules/inputs/hooks/useFullNameField.tsx +12 -0
  627. package/src/modules/inputs/hooks/usePhoneFields.tsx +4 -0
  628. package/src/modules/inputs/index.ts +8 -0
  629. package/src/modules/inputs/states/emailFieldStates.ts +15 -0
  630. package/src/modules/inputs/states/phoneFieldStates.ts +15 -0
  631. package/src/modules/inputs/validations/emailValidation.ts +7 -0
  632. package/src/modules/inputs/validations/phoneValidation.ts +12 -0
  633. package/src/modules/layout/components/Page.tsx +37 -0
  634. package/src/modules/layout/index.ts +1 -0
  635. package/src/modules/motion/components/TextEffect.tsx +288 -0
  636. package/src/modules/motion/components/TextLoop.tsx +71 -0
  637. package/src/modules/motion/index.ts +2 -0
  638. package/src/modules/navigation-menu/components/NavigationMenu.tsx +182 -0
  639. package/src/modules/navigation-menu/components/NavigationMenuItemControls.tsx +18 -0
  640. package/src/modules/navigation-menu/index.ts +3 -0
  641. package/src/modules/navigation-menu/states/activePluginState.tsx +10 -0
  642. package/src/modules/preview/components/Preview.tsx +108 -0
  643. package/src/modules/preview/context/PreviewContext.tsx +16 -0
  644. package/src/modules/record-field/components/NumberField.tsx +124 -0
  645. package/src/modules/record-field/components/TextField.tsx +103 -0
  646. package/src/modules/record-field/index.ts +3 -0
  647. package/src/modules/record-field/meta-inputs/components/EmailVerificationInput.tsx +95 -0
  648. package/src/modules/record-field/meta-inputs/components/PhoneInput.tsx +217 -0
  649. package/src/modules/record-field/meta-inputs/components/PhoneVerificationInput.tsx +80 -0
  650. package/src/modules/record-field/meta-inputs/components/TextFieldInput.tsx +17 -0
  651. package/src/modules/record-table/components/CheckboxColumn.tsx +107 -0
  652. package/src/modules/record-table/components/MoreColumn.tsx +26 -0
  653. package/src/modules/record-table/components/RecordTableArrowEffect.tsx +67 -0
  654. package/src/modules/record-table/components/RecordTableCell.tsx +43 -0
  655. package/src/modules/record-table/components/RecordTableCellInline.tsx +104 -0
  656. package/src/modules/record-table/components/RecordTableColumnSelector.tsx +204 -0
  657. package/src/modules/record-table/components/RecordTableContainer.tsx +70 -0
  658. package/src/modules/record-table/components/RecordTableCursor.tsx +143 -0
  659. package/src/modules/record-table/components/RecordTableDnDProvider.tsx +63 -0
  660. package/src/modules/record-table/components/RecordTableHead.tsx +143 -0
  661. package/src/modules/record-table/components/RecordTableHeader.tsx +91 -0
  662. package/src/modules/record-table/components/RecordTableHotkeyCell.tsx +97 -0
  663. package/src/modules/record-table/components/RecordTableInlineHead.tsx +13 -0
  664. package/src/modules/record-table/components/RecordTableProvider.tsx +201 -0
  665. package/src/modules/record-table/components/RecordTableRoot.tsx +17 -0
  666. package/src/modules/record-table/components/RecordTableRow.tsx +42 -0
  667. package/src/modules/record-table/components/RecordTableRowList.tsx +47 -0
  668. package/src/modules/record-table/components/RecordTableRowSkeleton.tsx +66 -0
  669. package/src/modules/record-table/components/RecordTableScroll.tsx +23 -0
  670. package/src/modules/record-table/components/RecordTableTree.tsx +135 -0
  671. package/src/modules/record-table/contexts/RecordTableCursorContext.tsx +5 -0
  672. package/src/modules/record-table/contexts/RecordTableHotkeyContext.tsx +56 -0
  673. package/src/modules/record-table/contexts/RecordTableTreeContext.tsx +6 -0
  674. package/src/modules/record-table/hooks/usePopoverOnEnter.tsx +38 -0
  675. package/src/modules/record-table/hooks/useRecordTableCursor.tsx +22 -0
  676. package/src/modules/record-table/hooks/useRecordTableCursorContext.tsx +12 -0
  677. package/src/modules/record-table/hooks/useRecordTableTree.tsx +44 -0
  678. package/src/modules/record-table/hooks/useTablePreferences.ts +45 -0
  679. package/src/modules/record-table/index.ts +52 -0
  680. package/src/modules/record-table/states/EditModePositionComponentState.ts +7 -0
  681. package/src/modules/record-table/states/RecordTableCursorState.ts +6 -0
  682. package/src/modules/record-table/states/RecordTableTreeState.ts +6 -0
  683. package/src/modules/record-table/types/RecordTableCursorTypes.ts +26 -0
  684. package/src/modules/record-table/types/RecordTableScope.ts +3 -0
  685. package/src/modules/record-table/types/RecordTableTreeTypes.ts +6 -0
  686. package/src/modules/record-table/types/recordTableTypes.ts +8 -0
  687. package/src/modules/record-table/utils/columnUtils.ts +10 -0
  688. package/src/modules/record-table/utils/cursorUtils.ts +66 -0
  689. package/src/modules/report/components/report-page-container.tsx +179 -0
  690. package/src/modules/report/components/report-table.tsx +123 -0
  691. package/src/modules/report/index.ts +2 -0
  692. package/src/modules/report/states/reportSettingsState.ts +9 -0
  693. package/src/modules/select-operation/components/SelectOperation.tsx +167 -0
  694. package/src/modules/select-operation/index.ts +1 -0
  695. package/src/modules/select-tree/components/SelectTree.tsx +182 -0
  696. package/src/modules/select-tree/context/SelectTreeContext.tsx +15 -0
  697. package/src/modules/select-tree/hooks/useSelectTreeHide.tsx +29 -0
  698. package/src/modules/select-tree/index.ts +1 -0
  699. package/src/modules/select-tree/states/selectTreeStates.tsx +5 -0
  700. package/src/modules/select-tree/types/selectTreeTypes.ts +14 -0
  701. package/src/modules/side-menu/components/SideMenu.tsx +143 -0
  702. package/src/modules/side-menu/context/SideMenuContext.tsx +20 -0
  703. package/src/state/index.ts +2 -0
  704. package/src/state/sidebarPanelState.ts +8 -0
  705. package/src/state/themeState.ts +4 -0
  706. package/src/theme.css +275 -0
  707. package/src/types/CountryCode.ts +6 -0
  708. package/src/types/CurrencyCode.ts +161 -0
  709. package/src/types/Displays.ts +6 -0
  710. package/src/types/Gql.ts +34 -0
  711. package/src/types/Key.ts +1312 -0
  712. package/src/types/Relations.ts +14 -0
  713. package/src/types/SexCode.ts +6 -0
  714. package/src/types/Theme.ts +2 -0
  715. package/src/types/UIConfig.ts +198 -0
  716. package/src/types/Utils.ts +12 -0
  717. package/src/types/ValidationStatus.ts +4 -0
  718. package/src/types/index.ts +11 -0
  719. package/src/utils/IsUndefinedOrNull.ts +4 -0
  720. package/src/utils/colors.ts +68 -0
  721. package/src/utils/config/index.ts +83 -0
  722. package/src/utils/cookie-storage.ts +29 -0
  723. package/src/utils/core.ts +82 -0
  724. package/src/utils/fixOrder.ts +16 -0
  725. package/src/utils/format/formatAmount.ts +17 -0
  726. package/src/utils/format/formatPhoneNumber.ts +11 -0
  727. package/src/utils/format/index.ts +2 -0
  728. package/src/utils/getPluginAssetsUrl.ts +16 -0
  729. package/src/utils/highlightMatch.tsx +35 -0
  730. package/src/utils/index.ts +18 -0
  731. package/src/utils/isAnObject.ts +3 -0
  732. package/src/utils/isDeeplyEqual.ts +4 -0
  733. package/src/utils/isDefined.ts +4 -0
  734. package/src/utils/isEnabled.ts +7 -0
  735. package/src/utils/localization/detectTimeZone.ts +6 -0
  736. package/src/utils/localization/formatDateISOStringToRelativeDate.ts +39 -0
  737. package/src/utils/localization/formatTimeZoneLabel.ts +29 -0
  738. package/src/utils/localization/index.ts +3 -0
  739. package/src/utils/logDebug.ts +4 -0
  740. package/src/utils/regex/index.ts +1 -0
  741. package/src/utils/regex/passwordRegex.ts +1 -0
  742. package/src/utils/searchProvider.ts +77 -0
  743. package/src/utils/string-array.ts +24 -0
  744. package/src/utils/stripHtml.ts +15 -0
  745. package/src/utils/urlParser.ts +66 -0
  746. package/src/utils/videoEmbed.ts +56 -0
@@ -0,0 +1,743 @@
1
+ import { Button, Dialog, Spinner, Upload, cn, readImage } from 'erxes-ui/index';
2
+ import { getCloudflareStreamBase } from 'erxes-ui/utils';
3
+ import {
4
+ IconChevronLeft,
5
+ IconChevronRight,
6
+ IconDownload,
7
+ IconFile,
8
+ IconMusic,
9
+ IconPaperclip,
10
+ IconPhoto,
11
+ IconPlayerPlayFilled,
12
+ IconX,
13
+ IconZoomIn,
14
+ } from '@tabler/icons-react';
15
+ import { useEffect, useRef, useState } from 'react';
16
+
17
+ import {
18
+ AttachmentRoot,
19
+ useAttachmentContext,
20
+ type AttachmentRootProps,
21
+ } from './context';
22
+ import { RecordTableInlineCell } from 'erxes-ui/modules/record-table';
23
+ import type { IAttachment } from './types';
24
+
25
+ // ---------------------------------------------------------------------------
26
+ // Shared constants
27
+ // ---------------------------------------------------------------------------
28
+
29
+ const SCROLL_STEP = 150;
30
+
31
+ const DEFAULT_FILE_TYPES = new Set([
32
+ 'text/plain',
33
+ 'application/pdf',
34
+ 'application/msword',
35
+ 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
36
+ 'application/vnd.ms-excel',
37
+ 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
38
+ 'application/vnd.ms-powerpoint',
39
+ 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
40
+ ]);
41
+
42
+ function stripTypename<T extends object>(obj: T): T {
43
+ const { __typename, ...rest } = obj as T & { __typename?: unknown };
44
+ return rest as T;
45
+ }
46
+
47
+ // ---------------------------------------------------------------------------
48
+ // Shared scroll track — used by both Files and Preview
49
+ // ---------------------------------------------------------------------------
50
+
51
+ type ScrollTrackProps = {
52
+ children: React.ReactNode;
53
+ label: string;
54
+ };
55
+
56
+ const ScrollTrack = ({ children, label }: ScrollTrackProps) => {
57
+ const ref = useRef<HTMLDivElement>(null);
58
+
59
+ const scroll = (dir: 'left' | 'right') =>
60
+ ref.current?.scrollBy({
61
+ left: dir === 'left' ? -SCROLL_STEP : SCROLL_STEP,
62
+ behavior: 'smooth',
63
+ });
64
+
65
+ return (
66
+ <div className="relative">
67
+ <div className="absolute top-1/2 -left-4 -translate-y-1/2 hidden lg:block z-10">
68
+ <button
69
+ className="bg-background p-1 rounded-full shadow"
70
+ onClick={() => scroll('left')}
71
+ aria-label={`Scroll ${label} left`}
72
+ >
73
+ <IconChevronLeft size={20} />
74
+ </button>
75
+ </div>
76
+
77
+ <div
78
+ ref={ref}
79
+ className="overflow-x-auto flex gap-4 scroll-smooth"
80
+ role="list"
81
+ aria-label={label}
82
+ >
83
+ {children}
84
+ </div>
85
+
86
+ <div className="absolute top-1/2 -right-4 -translate-y-1/2 hidden lg:block z-10">
87
+ <button
88
+ className="bg-background p-1 rounded-full shadow"
89
+ onClick={() => scroll('right')}
90
+ aria-label={`Scroll ${label} right`}
91
+ >
92
+ <IconChevronRight size={20} />
93
+ </button>
94
+ </div>
95
+ </div>
96
+ );
97
+ };
98
+
99
+ // ---------------------------------------------------------------------------
100
+ // Attachments.Files
101
+ // ---------------------------------------------------------------------------
102
+
103
+ export type AttachmentFilesProps = {
104
+ /** Override the accepted MIME type set. */
105
+ fileTypes?: Set<string>;
106
+ heading?: string;
107
+ };
108
+
109
+ const AttachmentFiles = ({
110
+ fileTypes = DEFAULT_FILE_TYPES,
111
+ heading = 'File Attachments',
112
+ }: AttachmentFilesProps) => {
113
+ const { attachments, handleRemoveAttachment, removingUrl, isLoading } =
114
+ useAttachmentContext();
115
+
116
+ const fileAttachments = attachments.filter(
117
+ (a) => a?.type != null && fileTypes.has(a.type),
118
+ );
119
+
120
+ if (fileAttachments.length === 0) return null;
121
+
122
+ return (
123
+ <div className="py-4 px-8">
124
+ <h4 className="uppercase text-sm text-muted-foreground pb-4">
125
+ {heading}
126
+ </h4>
127
+ <ScrollTrack label="File attachments">
128
+ {fileAttachments.map((attachment) => {
129
+ const isRemoving = removingUrl === attachment.url;
130
+ const url = readImage(decodeURIComponent(attachment.url));
131
+ return (
132
+ <div
133
+ key={attachment.url}
134
+ role="listitem"
135
+ className="relative group p-2 bg-background text-primary rounded-md flex items-center gap-2 shrink-0"
136
+ >
137
+ <a
138
+ href={url}
139
+ target="_blank"
140
+ rel="noreferrer"
141
+ className="text-sm truncate max-w-40"
142
+ title={attachment.name}
143
+ >
144
+ {attachment.name}
145
+ </a>
146
+ <Button
147
+ variant="ghost"
148
+ disabled={isLoading && isRemoving}
149
+ onClick={(e) => handleRemoveAttachment(e, attachment)}
150
+ className="absolute hidden group-hover:flex items-center justify-center top-1 right-1 bg-destructive/40 hover:bg-destructive/80 text-background rounded-full p-1 w-5 h-5 shadow-md z-10"
151
+ aria-label={`Remove ${attachment.name}`}
152
+ >
153
+ <IconX size={10} aria-hidden />
154
+ </Button>
155
+ </div>
156
+ );
157
+ })}
158
+ </ScrollTrack>
159
+ </div>
160
+ );
161
+ };
162
+
163
+ // ---------------------------------------------------------------------------
164
+ // Attachments.Preview (image lightbox)
165
+ // ---------------------------------------------------------------------------
166
+
167
+ export type AttachmentPreviewProps = {
168
+ heading?: string;
169
+ className?: string;
170
+ renderThumbnails?: (openPreview: (index: number) => void) => React.ReactNode;
171
+ };
172
+
173
+ const AttachmentPreview = ({
174
+ heading = 'Media Attachments',
175
+ className,
176
+ renderThumbnails,
177
+ }: AttachmentPreviewProps) => {
178
+ const [open, setOpen] = useState(false);
179
+ const [currentIndex, setCurrentIndex] = useState(0);
180
+
181
+ const { attachments, handleRemoveAttachment, removingUrl, isLoading } =
182
+ useAttachmentContext();
183
+
184
+ const mediaAttachments = attachments.filter(
185
+ (a) => a?.type != null && a.type.startsWith('image/'),
186
+ );
187
+
188
+ const current =
189
+ mediaAttachments[Math.min(currentIndex, mediaAttachments.length - 1)];
190
+
191
+ // Clamp index when list shrinks
192
+ useEffect(() => {
193
+ if (
194
+ currentIndex >= mediaAttachments.length &&
195
+ mediaAttachments.length > 0
196
+ ) {
197
+ setCurrentIndex(mediaAttachments.length - 1);
198
+ }
199
+ }, [mediaAttachments.length, currentIndex]);
200
+
201
+ // Keyboard nav — only when dialog is open
202
+ useEffect(() => {
203
+ if (!open || mediaAttachments.length === 0) return;
204
+ const onKey = (e: KeyboardEvent) => {
205
+ if (e.key === 'ArrowRight')
206
+ setCurrentIndex((i) => (i + 1) % mediaAttachments.length);
207
+ if (e.key === 'ArrowLeft')
208
+ setCurrentIndex((i) => (i === 0 ? mediaAttachments.length - 1 : i - 1));
209
+ };
210
+ document.addEventListener('keydown', onKey);
211
+ return () => document.removeEventListener('keydown', onKey);
212
+ }, [open, mediaAttachments.length]);
213
+
214
+ if (mediaAttachments.length === 0) return null;
215
+
216
+ const prev = () =>
217
+ setCurrentIndex((i) => (i === 0 ? mediaAttachments.length - 1 : i - 1));
218
+ const next = () => setCurrentIndex((i) => (i + 1) % mediaAttachments.length);
219
+ const openPreview = (index: number) => {
220
+ setCurrentIndex(index);
221
+ setOpen(true);
222
+ };
223
+
224
+ return (
225
+ <div className={cn('py-4 px-8', className)}>
226
+ {heading && (
227
+ <h4 className="uppercase text-sm text-muted-foreground pb-4">
228
+ {heading}
229
+ </h4>
230
+ )}
231
+
232
+ {renderThumbnails ? (
233
+ renderThumbnails(openPreview)
234
+ ) : (
235
+ <ScrollTrack label="Media attachments">
236
+ {mediaAttachments.map((attachment, index) => {
237
+ const isRemoving = removingUrl === attachment.url;
238
+ return (
239
+ <div
240
+ key={attachment.url}
241
+ role="listitem"
242
+ className="group relative w-36 h-36 rounded-lg border border-border shadow-md shrink-0 cursor-zoom-in"
243
+ onClick={() => openPreview(index)}
244
+ >
245
+ <img
246
+ className="w-full h-full object-cover rounded-lg"
247
+ src={readImage(attachment.url)}
248
+ alt={attachment.name}
249
+ loading="lazy"
250
+ />
251
+ <div className="absolute inset-0 flex items-center justify-center bg-background/30 opacity-0 group-hover:opacity-100 transition-opacity rounded-lg">
252
+ {isLoading && isRemoving ? (
253
+ <Spinner />
254
+ ) : (
255
+ <IconZoomIn
256
+ size={28}
257
+ className="text-primary-foreground"
258
+ aria-hidden
259
+ />
260
+ )}
261
+ </div>
262
+ <Button
263
+ variant="ghost"
264
+ disabled={isLoading && isRemoving}
265
+ onClick={(e) => {
266
+ e.stopPropagation();
267
+ handleRemoveAttachment(e, attachment);
268
+ }}
269
+ className="absolute hidden group-hover:flex items-center justify-center top-1 right-1 bg-destructive/40 hover:bg-destructive/80 text-background rounded-full p-1 w-5 h-5 shadow-md z-10"
270
+ aria-label={`Remove ${attachment.name}`}
271
+ >
272
+ <IconX size={10} aria-hidden />
273
+ </Button>
274
+ </div>
275
+ );
276
+ })}
277
+ </ScrollTrack>
278
+ )}
279
+
280
+ {/* Lightbox */}
281
+ <Dialog open={open} onOpenChange={setOpen}>
282
+ <Dialog.Content
283
+ className="relative bg-transparent max-w-fit shadow-none border-0"
284
+ aria-describedby={undefined}
285
+ >
286
+ <Dialog.Title className="sr-only">
287
+ {current.name || 'Image preview'}
288
+ </Dialog.Title>
289
+ <Button
290
+ variant={'secondary'}
291
+ size={'icon'}
292
+ className="absolute top-6 -right-4 bg-background/80 hover:bg-background p-1.5 rounded-full z-50 transition-colors"
293
+ onClick={() => setOpen(false)}
294
+ aria-label="Close lightbox"
295
+ >
296
+ <IconX size={20} />
297
+ </Button>
298
+ <Button
299
+ variant={'secondary'}
300
+ size={'icon'}
301
+ aria-label="Download file"
302
+ asChild
303
+ role="link"
304
+ >
305
+ <a
306
+ target={'__blank'}
307
+ href={readImage(current.url)}
308
+ className="absolute top-20 -right-4 -translate-y-1/2 bg-background/80 hover:bg-background p-1.5 rounded-full z-50 transition-colors"
309
+ >
310
+ <IconDownload />
311
+ </a>
312
+ </Button>
313
+
314
+ <Button
315
+ variant={'secondary'}
316
+ size={'icon'}
317
+ className="absolute -left-4 top-1/2 -translate-y-1/2 bg-background/80 hover:bg-background p-1.5 rounded-full z-50 transition-colors"
318
+ onClick={prev}
319
+ aria-label="Previous image"
320
+ >
321
+ <IconChevronLeft size={24} />
322
+ </Button>
323
+
324
+ {current && (
325
+ <img
326
+ key={current.url}
327
+ src={readImage(current.url)}
328
+ alt={current.name}
329
+ className="max-w-[90vw] max-h-[90vh] object-contain rounded shadow-2xl select-none"
330
+ draggable={false}
331
+ />
332
+ )}
333
+
334
+ <Button
335
+ variant={'secondary'}
336
+ size={'icon'}
337
+ className="absolute -right-4 top-1/2 -translate-y-1/2 bg-background/80 hover:bg-background p-1.5 rounded-full z-50 transition-colors"
338
+ onClick={next}
339
+ aria-label="Next image"
340
+ >
341
+ <IconChevronRight size={24} />
342
+ </Button>
343
+
344
+ {mediaAttachments.length > 1 && (
345
+ <div className="absolute bottom-4 left-1/2 -translate-x-1/2 bg-background/70 text-foreground text-xs px-3 py-1 rounded-full">
346
+ {currentIndex + 1} / {mediaAttachments.length}
347
+ </div>
348
+ )}
349
+ </Dialog.Content>
350
+ </Dialog>
351
+ </div>
352
+ );
353
+ };
354
+
355
+ export type AttachmentVideoProps = {
356
+ heading?: string;
357
+ };
358
+
359
+ const AttachmentVideo = ({
360
+ heading = 'Video Attachments',
361
+ }: AttachmentVideoProps) => {
362
+ const [open, setOpen] = useState(false);
363
+ const [currentIndex, setCurrentIndex] = useState(0);
364
+
365
+ const { attachments, handleRemoveAttachment, removingUrl, isLoading } =
366
+ useAttachmentContext();
367
+
368
+ const videoAttachments = attachments.filter(
369
+ (a) => a?.type != null && a.type.startsWith('video/'),
370
+ );
371
+
372
+ const current = videoAttachments[currentIndex];
373
+
374
+ // Clamp index when list shrinks
375
+ useEffect(() => {
376
+ if (
377
+ currentIndex >= videoAttachments.length &&
378
+ videoAttachments.length > 0
379
+ ) {
380
+ setCurrentIndex(videoAttachments.length - 1);
381
+ }
382
+ }, [videoAttachments.length, currentIndex]);
383
+
384
+ useEffect(() => {
385
+ if (!open) return;
386
+ const onKey = (e: KeyboardEvent) => {
387
+ if (e.key === 'ArrowRight')
388
+ setCurrentIndex((i) => (i + 1) % videoAttachments.length);
389
+ if (e.key === 'ArrowLeft')
390
+ setCurrentIndex((i) => (i === 0 ? videoAttachments.length - 1 : i - 1));
391
+ };
392
+ document.addEventListener('keydown', onKey);
393
+ return () => document.removeEventListener('keydown', onKey);
394
+ }, [open, videoAttachments.length]);
395
+
396
+ if (videoAttachments.length === 0) return null;
397
+
398
+ const prev = () =>
399
+ setCurrentIndex((i) => (i === 0 ? videoAttachments.length - 1 : i - 1));
400
+ const next = () => setCurrentIndex((i) => (i + 1) % videoAttachments.length);
401
+
402
+ const currentBase = current ? getCloudflareStreamBase(current.url) : null;
403
+
404
+ return (
405
+ <div className="py-4 px-8">
406
+ <h4 className="uppercase text-sm text-muted-foreground pb-4">
407
+ {heading}
408
+ </h4>
409
+
410
+ <ScrollTrack label="Video attachments">
411
+ {videoAttachments.map((attachment, index) => {
412
+ const isRemoving = removingUrl === attachment.url;
413
+ const base = getCloudflareStreamBase(attachment.url);
414
+ return (
415
+ <div
416
+ key={attachment.url}
417
+ role="listitem"
418
+ className="group relative w-36 h-36 rounded-lg border border-border shadow-md shrink-0 cursor-pointer bg-black overflow-hidden"
419
+ onClick={() => {
420
+ setCurrentIndex(index);
421
+ setOpen(true);
422
+ }}
423
+ >
424
+ {base ? (
425
+ <img
426
+ className="w-full h-full object-cover rounded-lg"
427
+ src={`${base}/thumbnails/thumbnail.jpg`}
428
+ alt={attachment.name}
429
+ loading="lazy"
430
+ />
431
+ ) : (
432
+ <video
433
+ className="w-full h-full object-cover rounded-lg"
434
+ src={readImage(attachment.url)}
435
+ preload="metadata"
436
+ muted
437
+ />
438
+ )}
439
+ <div className="absolute inset-0 flex items-center justify-center bg-background/30 group-hover:bg-background/40 transition-colors rounded-lg">
440
+ {isLoading && isRemoving ? (
441
+ <Spinner />
442
+ ) : (
443
+ <IconPlayerPlayFilled
444
+ size={28}
445
+ className="text-primary-foreground"
446
+ aria-hidden
447
+ />
448
+ )}
449
+ </div>
450
+ <Button
451
+ variant="ghost"
452
+ disabled={isLoading && isRemoving}
453
+ onClick={(e) => {
454
+ e.stopPropagation();
455
+ handleRemoveAttachment(e, attachment);
456
+ }}
457
+ className="absolute hidden group-hover:flex items-center justify-center top-1 right-1 bg-destructive/40 hover:bg-destructive/80 text-background rounded-full p-1 w-5 h-5 shadow-md z-10"
458
+ aria-label={`Remove ${attachment.name}`}
459
+ >
460
+ <IconX size={10} aria-hidden />
461
+ </Button>
462
+ </div>
463
+ );
464
+ })}
465
+ </ScrollTrack>
466
+
467
+ <Dialog open={open} onOpenChange={setOpen}>
468
+ <Dialog.Content className="bg-transparent max-w-fit shadow-none border-0">
469
+ <Button
470
+ variant={'secondary'}
471
+ size={'icon'}
472
+ className="absolute top-6 -right-4 bg-background/80 hover:bg-background p-1.5 rounded-full z-50 transition-colors"
473
+ onClick={() => setOpen(false)}
474
+ aria-label="Close lightbox"
475
+ >
476
+ <IconX size={20} />
477
+ </Button>
478
+
479
+ <Button
480
+ variant={'secondary'}
481
+ size={'icon'}
482
+ className="absolute -left-4 top-1/2 -translate-y-1/2 bg-background/80 hover:bg-background p-1.5 rounded-full z-50 transition-colors"
483
+ onClick={prev}
484
+ aria-label="Previous video"
485
+ >
486
+ <IconChevronLeft size={24} />
487
+ </Button>
488
+
489
+ {current &&
490
+ (currentBase ? (
491
+ <iframe
492
+ key={current.url}
493
+ className="w-[80vw] max-w-3xl aspect-video rounded shadow-2xl"
494
+ src={`${currentBase}/iframe`}
495
+ title={current.name}
496
+ allow="accelerometer; gyroscope; autoplay; encrypted-media; picture-in-picture;"
497
+ allowFullScreen
498
+ />
499
+ ) : (
500
+ <video
501
+ key={current.url}
502
+ className="max-w-[90vw] max-h-[90vh] rounded shadow-2xl"
503
+ src={readImage(current.url)}
504
+ controls
505
+ autoPlay
506
+ />
507
+ ))}
508
+
509
+ <Button
510
+ variant={'secondary'}
511
+ size={'icon'}
512
+ className="absolute -right-4 top-1/2 -translate-y-1/2 bg-background/80 hover:bg-background p-1.5 rounded-full z-50 transition-colors"
513
+ onClick={next}
514
+ aria-label="Next video"
515
+ >
516
+ <IconChevronRight size={24} />
517
+ </Button>
518
+
519
+ {videoAttachments.length > 1 && (
520
+ <div className="absolute bottom-4 left-1/2 -translate-x-1/2 bg-background/70 text-foreground text-xs px-3 py-1 rounded-full">
521
+ {currentIndex + 1} / {videoAttachments.length}
522
+ </div>
523
+ )}
524
+ </Dialog.Content>
525
+ </Dialog>
526
+ </div>
527
+ );
528
+ };
529
+
530
+ export type AttachmentAudioProps = {
531
+ heading?: string;
532
+ };
533
+
534
+ const AttachmentAudio = ({
535
+ heading = 'Audio Attachments',
536
+ }: AttachmentAudioProps) => {
537
+ const { attachments, handleRemoveAttachment, removingUrl, isLoading } =
538
+ useAttachmentContext();
539
+
540
+ const audioAttachments = attachments.filter(
541
+ (a) => a?.type != null && a.type.startsWith('audio/'),
542
+ );
543
+
544
+ if (audioAttachments.length === 0) return null;
545
+
546
+ return (
547
+ <div className="py-4 px-8">
548
+ <h4 className="uppercase text-sm text-muted-foreground pb-4">
549
+ {heading}
550
+ </h4>
551
+
552
+ <div className="flex flex-col gap-2" role="list" aria-label={heading}>
553
+ {audioAttachments.map((attachment) => {
554
+ const isRemoving = removingUrl === attachment.url;
555
+ return (
556
+ <div
557
+ key={attachment.url}
558
+ role="listitem"
559
+ className="group relative w-72 max-w-full rounded-lg border border-border shadow-sm bg-background p-2"
560
+ >
561
+ <div className="flex items-center gap-1.5 pb-1.5 pr-5">
562
+ <IconMusic
563
+ size={14}
564
+ className="text-muted-foreground shrink-0"
565
+ aria-hidden
566
+ />
567
+ <span
568
+ className="text-xs font-medium truncate"
569
+ title={attachment.name}
570
+ >
571
+ {attachment.name}
572
+ </span>
573
+ </div>
574
+ <audio
575
+ className="w-full"
576
+ src={readImage(attachment.url)}
577
+ controls
578
+ preload="metadata"
579
+ >
580
+ <track kind="captions" />
581
+ </audio>
582
+ <Button
583
+ variant="ghost"
584
+ disabled={isLoading && isRemoving}
585
+ onClick={(e) => handleRemoveAttachment(e, attachment)}
586
+ className="absolute hidden group-hover:flex items-center justify-center top-1 right-1 bg-destructive/40 hover:bg-destructive/80 text-background rounded-full p-1 w-5 h-5 shadow-md z-10"
587
+ aria-label={`Remove ${attachment.name}`}
588
+ >
589
+ <IconX size={10} aria-hidden />
590
+ </Button>
591
+ </div>
592
+ );
593
+ })}
594
+ </div>
595
+ </div>
596
+ );
597
+ };
598
+
599
+ export type AttachmentUploaderProps = {
600
+ onSave?: (attachments: IAttachment[]) => Promise<void> | void;
601
+ id?: string;
602
+ label?: string;
603
+ };
604
+
605
+ const AttachmentUploader = ({
606
+ onSave,
607
+ id,
608
+ label = 'Add attachments',
609
+ }: AttachmentUploaderProps) => {
610
+ const [isUploading, setIsUploading] = useState(false);
611
+ const [uploadProgress, setUploadProgress] = useState({
612
+ uploaded: 0,
613
+ total: 0,
614
+ });
615
+
616
+ const { addAttachment, attachments } = useAttachmentContext();
617
+
618
+ const attachmentsRef = useRef(attachments);
619
+ useEffect(() => {
620
+ attachmentsRef.current = attachments;
621
+ }, [attachments]);
622
+
623
+ // Batch-complete — fires once all files in a batch finish
624
+ useEffect(() => {
625
+ if (
626
+ uploadProgress.total > 0 &&
627
+ uploadProgress.uploaded === uploadProgress.total
628
+ ) {
629
+ const cleaned = attachmentsRef.current.map(stripTypename);
630
+ onSave?.(cleaned);
631
+ setUploadProgress({ uploaded: 0, total: 0 });
632
+ setIsUploading(false);
633
+ }
634
+ // eslint-disable-next-line react-hooks/exhaustive-deps
635
+ }, [uploadProgress]);
636
+
637
+ return (
638
+ <Upload.Root
639
+ value=""
640
+ multiple
641
+ className={cn('items-center', {
642
+ 'pointer-events-none opacity-50': isUploading,
643
+ })}
644
+ onChange={(fileInfo) => {
645
+ if (fileInfo && 'url' in fileInfo) {
646
+ addAttachment(fileInfo as unknown as IAttachment);
647
+ }
648
+ }}
649
+ >
650
+ <Upload.Preview
651
+ className="hidden"
652
+ onUploadStart={(count) => {
653
+ setIsUploading(true);
654
+ setUploadProgress({ uploaded: 0, total: count ?? 0 });
655
+ }}
656
+ onUploadProgress={() =>
657
+ setUploadProgress((prev) => ({
658
+ ...prev,
659
+ uploaded: prev.uploaded + 1,
660
+ }))
661
+ }
662
+ onAllUploadsComplete={() => setIsUploading(false)}
663
+ />
664
+ <Upload.Button
665
+ size="sm"
666
+ variant="ghost"
667
+ type="button"
668
+ className="flex items-center gap-1 cursor-pointer text-sm"
669
+ >
670
+ {isUploading ? (
671
+ <>
672
+ <Spinner />
673
+ <span aria-live="polite">
674
+ {uploadProgress.uploaded}/{uploadProgress.total}
675
+ </span>
676
+ </>
677
+ ) : (
678
+ <IconPaperclip size={16} aria-hidden />
679
+ )}
680
+ {label}
681
+ </Upload.Button>
682
+ </Upload.Root>
683
+ );
684
+ };
685
+
686
+ // ---------------------------------------------------------------------------
687
+ // Attachments.Inline (read-only summary pills for table cells)
688
+ // ---------------------------------------------------------------------------
689
+
690
+ export type AttachmentsInlineProps = {
691
+ attachments: IAttachment[];
692
+ /** Override the file MIME type set used to identify non-image files. */
693
+ fileTypes?: Set<string>;
694
+ };
695
+
696
+ const AttachmentsInline = ({
697
+ attachments,
698
+ fileTypes = DEFAULT_FILE_TYPES,
699
+ }: AttachmentsInlineProps) => {
700
+ const images = attachments.filter((a) => a?.type?.startsWith('image/'));
701
+ const files = attachments.filter(
702
+ (a) => a?.type != null && fileTypes.has(a.type),
703
+ );
704
+
705
+ return (
706
+ <RecordTableInlineCell>
707
+ {images.length === 0 && files.length === 0 ? (
708
+ <span className="text-muted-foreground select-none">—</span>
709
+ ) : (
710
+ <div className="flex items-center gap-1.5">
711
+ {images.length > 0 && (
712
+ <span className="inline-flex items-center gap-1 px-1.5 py-0.5 rounded bg-muted text-muted-foreground text-xs font-medium">
713
+ <IconPhoto size={13} aria-hidden />
714
+ {images.length}
715
+ </span>
716
+ )}
717
+ {files.length > 0 && (
718
+ <span className="inline-flex items-center gap-1 px-1.5 py-0.5 rounded bg-muted text-muted-foreground text-xs font-medium">
719
+ <IconFile size={13} aria-hidden />
720
+ {files.length}
721
+ </span>
722
+ )}
723
+ </div>
724
+ )}
725
+ </RecordTableInlineCell>
726
+ );
727
+ };
728
+
729
+ // ---------------------------------------------------------------------------
730
+ // Attachments namespace export
731
+ // ---------------------------------------------------------------------------
732
+
733
+ export const Attachments = {
734
+ Root: AttachmentRoot,
735
+ Files: AttachmentFiles,
736
+ Preview: AttachmentPreview,
737
+ Video: AttachmentVideo,
738
+ Audio: AttachmentAudio,
739
+ Uploader: AttachmentUploader,
740
+ Inline: AttachmentsInline,
741
+ } as const;
742
+
743
+ export type { AttachmentRootProps };