@firecms/core 3.0.1 → 3.1.0-canary.02232f4

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 (334) hide show
  1. package/README.md +1 -1
  2. package/dist/components/AIIcon.d.ts +16 -0
  3. package/dist/components/EntityCollectionTable/EntityCollectionRowActions.d.ts +7 -1
  4. package/dist/components/EntityCollectionTable/EntityCollectionTable.d.ts +1 -1
  5. package/dist/components/EntityCollectionTable/EntityCollectionTableProps.d.ts +14 -0
  6. package/dist/components/EntityCollectionTable/PropertyTableCell.d.ts +6 -0
  7. package/dist/components/EntityCollectionTable/internal/CollectionTableToolbar.d.ts +5 -4
  8. package/dist/components/EntityCollectionTable/internal/EntityTableCell.d.ts +6 -0
  9. package/dist/components/EntityCollectionTable/internal/popup_field/useDraggable.d.ts +2 -2
  10. package/dist/components/EntityCollectionView/Board.d.ts +2 -0
  11. package/dist/components/EntityCollectionView/BoardColumn.d.ts +42 -0
  12. package/dist/components/EntityCollectionView/BoardColumnTitle.d.ts +9 -0
  13. package/dist/components/EntityCollectionView/BoardSortableList.d.ts +14 -0
  14. package/dist/components/EntityCollectionView/CollectionDataErrorBanner.d.ts +4 -0
  15. package/dist/components/EntityCollectionView/EntityBoardCard.d.ts +26 -0
  16. package/dist/components/EntityCollectionView/EntityCard.d.ts +19 -0
  17. package/dist/components/EntityCollectionView/EntityCollectionBoardView.d.ts +20 -0
  18. package/dist/components/EntityCollectionView/EntityCollectionCardView.d.ts +31 -0
  19. package/dist/components/EntityCollectionView/EntityCollectionViewActions.d.ts +2 -2
  20. package/dist/components/EntityCollectionView/EntityCollectionViewStartActions.d.ts +7 -3
  21. package/dist/components/EntityCollectionView/FiltersDialog.d.ts +14 -0
  22. package/dist/components/EntityCollectionView/ViewModeToggle.d.ts +44 -0
  23. package/dist/components/EntityCollectionView/board_types.d.ts +105 -0
  24. package/dist/components/EntityCollectionView/useBoardDataController.d.ts +60 -0
  25. package/dist/components/ErrorBoundary.d.ts +4 -2
  26. package/dist/components/HomePage/DefaultHomePage.d.ts +0 -1
  27. package/dist/components/LanguageToggle.d.ts +1 -0
  28. package/dist/components/SelectableTable/SelectableTable.d.ts +5 -1
  29. package/dist/components/SelectableTable/filters/DateTimeFilterField.d.ts +2 -1
  30. package/dist/components/UnsavedChangesDialog.d.ts +1 -0
  31. package/dist/components/VirtualTable/VirtualTableCell.d.ts +6 -0
  32. package/dist/components/VirtualTable/VirtualTableHeader.d.ts +4 -1
  33. package/dist/components/VirtualTable/VirtualTableHeaderRow.d.ts +1 -1
  34. package/dist/components/VirtualTable/VirtualTableProps.d.ts +17 -1
  35. package/dist/components/VirtualTable/fields/VirtualTableDateField.d.ts +1 -0
  36. package/dist/components/VirtualTable/types.d.ts +3 -0
  37. package/dist/components/index.d.ts +4 -0
  38. package/dist/contexts/index.d.ts +10 -0
  39. package/dist/core/DrawerNavigationGroup.d.ts +45 -0
  40. package/dist/core/index.d.ts +1 -0
  41. package/dist/editor/components/SlashCommandMenu.d.ts +6 -0
  42. package/dist/editor/components/editor-bubble-item.d.ts +8 -0
  43. package/dist/editor/components/editor-bubble.d.ts +8 -0
  44. package/dist/editor/components/image-bubble.d.ts +5 -0
  45. package/dist/editor/components/index.d.ts +16 -0
  46. package/dist/editor/components/table-bubble.d.ts +5 -0
  47. package/dist/editor/editor.d.ts +30 -0
  48. package/dist/editor/extensions/HighlightDecorationExtension.d.ts +24 -0
  49. package/dist/editor/extensions/Image/index.d.ts +6 -0
  50. package/dist/editor/extensions/Image.d.ts +6 -0
  51. package/dist/editor/extensions/TextLoadingDecorationExtension.d.ts +16 -0
  52. package/dist/editor/extensions/clipboard.d.ts +7 -0
  53. package/dist/editor/extensions/custom-keymap.d.ts +1 -0
  54. package/dist/editor/extensions/drag-and-drop.d.ts +9 -0
  55. package/dist/editor/hooks/useProseMirror.d.ts +13 -0
  56. package/dist/editor/hooks/useProseMirrorContext.d.ts +9 -0
  57. package/dist/editor/index.d.ts +2 -0
  58. package/dist/editor/markdown.d.ts +5 -0
  59. package/dist/editor/nodeViews/ImageComponent.d.ts +3 -0
  60. package/dist/editor/nodeViews/ReactNodeView.d.ts +29 -0
  61. package/dist/editor/nodeViews/TaskItemComponent.d.ts +3 -0
  62. package/dist/editor/nodeViews/index.d.ts +6 -0
  63. package/dist/editor/plugins/index.d.ts +2 -0
  64. package/dist/editor/plugins/inputrules.d.ts +6 -0
  65. package/dist/editor/plugins/placeholderPlugin.d.ts +3 -0
  66. package/dist/editor/plugins/slashCommandPlugin.d.ts +12 -0
  67. package/dist/editor/schema.d.ts +2 -0
  68. package/dist/editor/selectors/ai-selector.d.ts +0 -0
  69. package/dist/editor/selectors/color-selector.d.ts +10 -0
  70. package/dist/editor/selectors/link-selector.d.ts +8 -0
  71. package/dist/editor/selectors/node-selector.d.ts +15 -0
  72. package/dist/editor/selectors/text-buttons.d.ts +1 -0
  73. package/dist/editor/types.d.ts +5 -0
  74. package/dist/editor/useProseMirror.d.ts +16 -0
  75. package/dist/editor/utils/prosemirror-utils.d.ts +6 -0
  76. package/dist/editor/utils/remove_classes.d.ts +1 -0
  77. package/dist/editor/utils/useDebouncedCallback.d.ts +1 -0
  78. package/dist/form/components/ErrorFocus.d.ts +1 -1
  79. package/dist/form/field_bindings/MapFieldBinding.d.ts +1 -1
  80. package/dist/form/field_bindings/MarkdownEditorFieldBinding.d.ts +1 -1
  81. package/dist/form/validation.d.ts +3 -2
  82. package/dist/hooks/index.d.ts +1 -0
  83. package/dist/hooks/useBreadcrumbsController.d.ts +16 -0
  84. package/dist/hooks/useBuildNavigationController.d.ts +0 -1
  85. package/dist/hooks/useCollapsedGroups.d.ts +6 -3
  86. package/dist/hooks/useTranslation.d.ts +17 -0
  87. package/dist/i18n/FireCMSi18nProvider.d.ts +33 -0
  88. package/dist/index.d.ts +5 -0
  89. package/dist/index.es.js +30146 -15178
  90. package/dist/index.es.js.map +1 -1
  91. package/dist/index.umd.js +30032 -15085
  92. package/dist/index.umd.js.map +1 -1
  93. package/dist/internal/useRestoreScroll.d.ts +1 -1
  94. package/dist/locales/de.d.ts +2 -0
  95. package/dist/locales/en.d.ts +10 -0
  96. package/dist/locales/es.d.ts +10 -0
  97. package/dist/locales/fr.d.ts +2 -0
  98. package/dist/locales/hi.d.ts +2 -0
  99. package/dist/locales/it.d.ts +2 -0
  100. package/dist/locales/pt.d.ts +7 -0
  101. package/dist/preview/PropertyPreviewProps.d.ts +5 -0
  102. package/dist/preview/components/DatePreview.d.ts +13 -3
  103. package/dist/preview/components/ImagePreview.d.ts +5 -1
  104. package/dist/preview/components/StorageThumbnail.d.ts +2 -1
  105. package/dist/preview/components/UrlComponentPreview.d.ts +2 -1
  106. package/dist/preview/property_previews/ArrayOfStorageComponentsPreview.d.ts +1 -1
  107. package/dist/preview/property_previews/ArrayOfStringsPreview.d.ts +1 -1
  108. package/dist/preview/property_previews/SkeletonPropertyComponent.d.ts +1 -1
  109. package/dist/types/analytics.d.ts +1 -1
  110. package/dist/types/collections.d.ts +88 -2
  111. package/dist/types/customization_controller.d.ts +2 -1
  112. package/dist/types/datasource.d.ts +0 -1
  113. package/dist/types/firecms.d.ts +2 -1
  114. package/dist/types/index.d.ts +1 -0
  115. package/dist/types/navigation.d.ts +2 -2
  116. package/dist/types/plugins.d.ts +69 -1
  117. package/dist/types/properties.d.ts +268 -12
  118. package/dist/types/storage.d.ts +1 -0
  119. package/dist/types/translations.d.ts +669 -0
  120. package/dist/util/__tests__/conditions.test.d.ts +1 -0
  121. package/dist/util/__tests__/objects.test.d.ts +1 -0
  122. package/dist/util/conditions.d.ts +26 -0
  123. package/dist/util/entities.d.ts +2 -3
  124. package/dist/util/index.d.ts +3 -1
  125. package/dist/util/lazy_eager.d.ts +7 -0
  126. package/dist/util/objects.d.ts +1 -0
  127. package/dist/util/property_utils.d.ts +2 -1
  128. package/dist/util/resolutions.d.ts +3 -3
  129. package/dist/util/useStorageUploadController.d.ts +10 -1
  130. package/package.json +51 -12
  131. package/src/app/Scaffold.tsx +20 -19
  132. package/src/components/AIIcon.tsx +41 -0
  133. package/src/components/ArrayContainer.tsx +7 -8
  134. package/src/components/ClearFilterSortButton.tsx +25 -19
  135. package/src/components/ConfirmationDialog.tsx +4 -4
  136. package/src/components/DeleteEntityDialog.tsx +12 -11
  137. package/src/components/EntityCollectionTable/EntityCollectionRowActions.tsx +82 -43
  138. package/src/components/EntityCollectionTable/EntityCollectionTable.tsx +130 -79
  139. package/src/components/EntityCollectionTable/EntityCollectionTableProps.tsx +121 -104
  140. package/src/components/EntityCollectionTable/PropertyTableCell.tsx +132 -103
  141. package/src/components/EntityCollectionTable/fields/TableReferenceField.tsx +6 -3
  142. package/src/components/EntityCollectionTable/internal/CollectionTableToolbar.tsx +24 -44
  143. package/src/components/EntityCollectionTable/internal/EntityTableCell.tsx +90 -49
  144. package/src/components/EntityCollectionTable/internal/EntityTableCellActions.tsx +1 -1
  145. package/src/components/EntityCollectionTable/internal/popup_field/PopupFormField.tsx +3 -2
  146. package/src/components/EntityCollectionTable/internal/popup_field/useDraggable.tsx +11 -11
  147. package/src/components/EntityCollectionView/Board.tsx +324 -0
  148. package/src/components/EntityCollectionView/BoardColumn.tsx +158 -0
  149. package/src/components/EntityCollectionView/BoardColumnTitle.tsx +45 -0
  150. package/src/components/EntityCollectionView/BoardSortableList.tsx +174 -0
  151. package/src/components/EntityCollectionView/CollectionDataErrorBanner.tsx +43 -0
  152. package/src/components/EntityCollectionView/EntityBoardCard.tsx +212 -0
  153. package/src/components/EntityCollectionView/EntityCard.tsx +235 -0
  154. package/src/components/EntityCollectionView/EntityCollectionBoardView.tsx +706 -0
  155. package/src/components/EntityCollectionView/EntityCollectionCardView.tsx +236 -0
  156. package/src/components/EntityCollectionView/EntityCollectionView.tsx +531 -209
  157. package/src/components/EntityCollectionView/EntityCollectionViewActions.tsx +35 -22
  158. package/src/components/EntityCollectionView/EntityCollectionViewStartActions.tsx +86 -15
  159. package/src/components/EntityCollectionView/FiltersDialog.tsx +252 -0
  160. package/src/components/EntityCollectionView/ViewModeToggle.tsx +202 -0
  161. package/src/components/EntityCollectionView/board_types.ts +113 -0
  162. package/src/components/EntityCollectionView/useBoardDataController.tsx +490 -0
  163. package/src/components/EntityJsonPreview.tsx +2 -1
  164. package/src/components/EntityView.tsx +3 -2
  165. package/src/components/ErrorBoundary.tsx +27 -15
  166. package/src/components/ErrorTooltip.tsx +2 -1
  167. package/src/components/HomePage/DefaultHomePage.tsx +65 -22
  168. package/src/components/HomePage/HomePageDnD.tsx +59 -42
  169. package/src/components/HomePage/NavigationCard.tsx +20 -18
  170. package/src/components/HomePage/NavigationGroup.tsx +20 -17
  171. package/src/components/HomePage/RenameGroupDialog.tsx +15 -15
  172. package/src/components/HomePage/SmallNavigationCard.tsx +10 -9
  173. package/src/components/LanguageToggle.tsx +66 -0
  174. package/src/components/NotFoundPage.tsx +5 -3
  175. package/src/components/ReferenceTable/ReferenceSelectionTable.tsx +12 -17
  176. package/src/components/ReferenceWidget.tsx +5 -6
  177. package/src/components/SearchIconsView.tsx +3 -1
  178. package/src/components/SelectableTable/SelectableTable.tsx +75 -67
  179. package/src/components/SelectableTable/filters/BooleanFilterField.tsx +7 -6
  180. package/src/components/SelectableTable/filters/DateTimeFilterField.tsx +50 -40
  181. package/src/components/SelectableTable/filters/ReferenceFilterField.tsx +53 -40
  182. package/src/components/SelectableTable/filters/StringNumberFilterField.tsx +60 -58
  183. package/src/components/UnsavedChangesDialog.tsx +6 -6
  184. package/src/components/UserDisplay.tsx +4 -4
  185. package/src/components/VirtualTable/VirtualTable.performance.test.tsx +1 -0
  186. package/src/components/VirtualTable/VirtualTable.tsx +275 -119
  187. package/src/components/VirtualTable/VirtualTableCell.tsx +18 -2
  188. package/src/components/VirtualTable/VirtualTableHeader.tsx +76 -64
  189. package/src/components/VirtualTable/VirtualTableHeaderRow.tsx +163 -42
  190. package/src/components/VirtualTable/VirtualTableProps.tsx +21 -2
  191. package/src/components/VirtualTable/VirtualTableRow.tsx +1 -1
  192. package/src/components/VirtualTable/fields/VirtualTableDateField.tsx +3 -0
  193. package/src/components/VirtualTable/fields/VirtualTableSelect.tsx +19 -6
  194. package/src/components/VirtualTable/types.tsx +3 -0
  195. package/src/components/common/default_entity_actions.tsx +4 -0
  196. package/src/components/common/useColumnsIds.tsx +95 -3
  197. package/src/components/common/useDataSourceTableController.tsx +12 -4
  198. package/src/components/index.tsx +5 -0
  199. package/src/contexts/BreacrumbsContext.tsx +15 -8
  200. package/src/contexts/index.ts +10 -0
  201. package/src/core/DefaultAppBar.tsx +49 -32
  202. package/src/core/DefaultDrawer.tsx +49 -57
  203. package/src/core/DrawerNavigationGroup.tsx +120 -0
  204. package/src/core/DrawerNavigationItem.tsx +4 -3
  205. package/src/core/EntityEditView.tsx +94 -50
  206. package/src/core/EntityEditViewFormActions.tsx +24 -17
  207. package/src/core/EntitySidePanel.tsx +34 -30
  208. package/src/core/FireCMS.tsx +33 -6
  209. package/src/core/SideDialogs.tsx +4 -2
  210. package/src/core/field_configs.tsx +18 -11
  211. package/src/core/index.tsx +1 -0
  212. package/src/editor/components/SlashCommandMenu.tsx +516 -0
  213. package/src/editor/components/editor-bubble-item.tsx +32 -0
  214. package/src/editor/components/editor-bubble.tsx +118 -0
  215. package/src/editor/components/image-bubble.tsx +156 -0
  216. package/src/editor/components/index.ts +14 -0
  217. package/src/editor/components/table-bubble.tsx +165 -0
  218. package/src/editor/editor.tsx +455 -0
  219. package/src/editor/extensions/HighlightDecorationExtension.ts +114 -0
  220. package/src/editor/extensions/Image/index.ts +133 -0
  221. package/src/editor/extensions/Image.ts +159 -0
  222. package/src/editor/extensions/TextLoadingDecorationExtension.tsx +107 -0
  223. package/src/editor/extensions/clipboard.ts +72 -0
  224. package/src/editor/extensions/custom-keymap.ts +24 -0
  225. package/src/editor/extensions/drag-and-drop.tsx +480 -0
  226. package/src/editor/hooks/useProseMirror.ts +124 -0
  227. package/src/editor/hooks/useProseMirrorContext.ts +15 -0
  228. package/src/editor/index.ts +2 -0
  229. package/src/editor/markdown.ts +172 -0
  230. package/src/editor/nodeViews/ImageComponent.tsx +20 -0
  231. package/src/editor/nodeViews/ReactNodeView.tsx +89 -0
  232. package/src/editor/nodeViews/TaskItemComponent.tsx +29 -0
  233. package/src/editor/nodeViews/index.ts +35 -0
  234. package/src/editor/plugins/index.ts +58 -0
  235. package/src/editor/plugins/inputrules.ts +82 -0
  236. package/src/editor/plugins/placeholderPlugin.ts +55 -0
  237. package/src/editor/plugins/slashCommandPlugin.ts +61 -0
  238. package/src/editor/schema.ts +240 -0
  239. package/src/editor/selectors/ai-selector.tsx +111 -0
  240. package/src/editor/selectors/color-selector.tsx +200 -0
  241. package/src/editor/selectors/link-selector.tsx +118 -0
  242. package/src/editor/selectors/node-selector.tsx +157 -0
  243. package/src/editor/selectors/text-buttons.tsx +86 -0
  244. package/src/editor/types.ts +6 -0
  245. package/src/editor/useProseMirror.ts +126 -0
  246. package/src/editor/utils/prosemirror-utils.ts +108 -0
  247. package/src/editor/utils/remove_classes.ts +17 -0
  248. package/src/editor/utils/useDebouncedCallback.ts +25 -0
  249. package/src/form/EntityForm.tsx +149 -67
  250. package/src/form/EntityFormActions.tsx +19 -12
  251. package/src/form/PropertyFieldBinding.tsx +68 -51
  252. package/src/form/components/ErrorFocus.tsx +3 -3
  253. package/src/form/components/LocalChangesMenu.tsx +13 -13
  254. package/src/form/components/StorageItemPreview.tsx +5 -3
  255. package/src/form/components/StorageUploadProgress.tsx +18 -3
  256. package/src/form/field_bindings/ArrayCustomShapedFieldBinding.tsx +18 -5
  257. package/src/form/field_bindings/ArrayOfReferencesFieldBinding.tsx +22 -10
  258. package/src/form/field_bindings/BlockFieldBinding.tsx +26 -9
  259. package/src/form/field_bindings/DateTimeFieldBinding.tsx +18 -17
  260. package/src/form/field_bindings/KeyValueFieldBinding.tsx +46 -25
  261. package/src/form/field_bindings/MapFieldBinding.tsx +88 -70
  262. package/src/form/field_bindings/MarkdownEditorFieldBinding.tsx +93 -52
  263. package/src/form/field_bindings/MultiSelectFieldBinding.tsx +15 -1
  264. package/src/form/field_bindings/ReferenceAsStringFieldBinding.tsx +25 -11
  265. package/src/form/field_bindings/ReferenceFieldBinding.tsx +25 -11
  266. package/src/form/field_bindings/RepeatFieldBinding.tsx +21 -6
  267. package/src/form/field_bindings/SelectFieldBinding.tsx +7 -5
  268. package/src/form/field_bindings/StorageUploadFieldBinding.tsx +110 -92
  269. package/src/form/field_bindings/SwitchFieldBinding.tsx +31 -14
  270. package/src/form/field_bindings/TextFieldBinding.tsx +77 -38
  271. package/src/form/field_bindings/UserSelectFieldBinding.tsx +7 -5
  272. package/src/form/validation.ts +245 -160
  273. package/src/hooks/index.tsx +1 -0
  274. package/src/hooks/useBreadcrumbsController.tsx +18 -0
  275. package/src/hooks/useBuildNavigationController.tsx +91 -41
  276. package/src/hooks/useCollapsedGroups.ts +18 -9
  277. package/src/hooks/useTranslation.ts +31 -0
  278. package/src/hooks/useValidateAuthenticator.tsx +1 -1
  279. package/src/i18n/FireCMSi18nProvider.tsx +160 -0
  280. package/src/index.ts +5 -0
  281. package/src/internal/useBuildDataSource.ts +68 -34
  282. package/src/internal/useBuildSideDialogsController.tsx +11 -8
  283. package/src/internal/useBuildSideEntityController.tsx +24 -24
  284. package/src/internal/useRestoreScroll.tsx +26 -14
  285. package/src/locales/de.ts +718 -0
  286. package/src/locales/en.ts +730 -0
  287. package/src/locales/es.ts +730 -0
  288. package/src/locales/fr.ts +718 -0
  289. package/src/locales/hi.ts +718 -0
  290. package/src/locales/it.ts +718 -0
  291. package/src/locales/pt.ts +727 -0
  292. package/src/preview/PropertyPreview.tsx +43 -33
  293. package/src/preview/PropertyPreviewProps.tsx +6 -0
  294. package/src/preview/components/DatePreview.tsx +72 -4
  295. package/src/preview/components/EmptyValue.tsx +1 -1
  296. package/src/preview/components/ImagePreview.tsx +37 -21
  297. package/src/preview/components/ReferencePreview.tsx +2 -1
  298. package/src/preview/components/StorageThumbnail.tsx +16 -12
  299. package/src/preview/components/UrlComponentPreview.tsx +32 -27
  300. package/src/preview/components/UserPreview.tsx +3 -1
  301. package/src/preview/property_previews/ArrayOfStorageComponentsPreview.tsx +9 -7
  302. package/src/preview/property_previews/ArrayOfStringsPreview.tsx +11 -9
  303. package/src/preview/property_previews/ArrayPropertyPreview.tsx +26 -24
  304. package/src/preview/property_previews/MapPropertyPreview.tsx +49 -27
  305. package/src/preview/property_previews/SkeletonPropertyComponent.tsx +61 -56
  306. package/src/routes/CustomCMSRoute.tsx +1 -0
  307. package/src/routes/FireCMSRoute.tsx +87 -65
  308. package/src/types/analytics.ts +10 -0
  309. package/src/types/collections.ts +97 -3
  310. package/src/types/customization_controller.tsx +2 -1
  311. package/src/types/datasource.ts +54 -56
  312. package/src/types/firecms.tsx +2 -1
  313. package/src/types/index.ts +1 -0
  314. package/src/types/navigation.ts +2 -2
  315. package/src/types/plugins.tsx +77 -1
  316. package/src/types/properties.ts +359 -37
  317. package/src/types/storage.ts +2 -1
  318. package/src/types/translations.ts +752 -0
  319. package/src/util/__tests__/conditions.test.ts +506 -0
  320. package/src/util/__tests__/objects.test.ts +196 -0
  321. package/src/util/callbacks.ts +6 -3
  322. package/src/util/collections.ts +51 -6
  323. package/src/util/conditions.ts +339 -0
  324. package/src/util/entities.ts +29 -30
  325. package/src/util/entity_cache.ts +2 -1
  326. package/src/util/index.ts +3 -1
  327. package/src/util/join_collections.ts +10 -8
  328. package/src/util/lazy_eager.tsx +33 -0
  329. package/src/util/objects.ts +46 -13
  330. package/src/util/{references.ts → previews.ts} +16 -2
  331. package/src/util/property_utils.tsx +37 -11
  332. package/src/util/resolutions.ts +62 -58
  333. package/src/util/useStorageUploadController.tsx +23 -29
  334. /package/dist/util/{references.d.ts → previews.d.ts} +0 -0
@@ -1,7 +1,7 @@
1
1
  import { CMSType, DataType, Entity, EntityReference, EntityStatus, EntityValues, PropertiesOrBuilders, Property, PropertyBuilder, PropertyOrBuilder, ResolvedProperties, ResolvedProperty } from "../types";
2
2
  export declare function isReadOnly(property: Property<any> | ResolvedProperty<any>): boolean;
3
3
  export declare function isHidden(property: Property | ResolvedProperty): boolean;
4
- export declare function isPropertyBuilder<T extends CMSType, M extends Record<string, any>>(propertyOrBuilder?: PropertyOrBuilder<T, M> | Property<T> | ResolvedProperty<T>): propertyOrBuilder is PropertyBuilder<T, M>;
4
+ export declare function isPropertyBuilder<T extends CMSType = CMSType, M extends Record<string, any> = any>(propertyOrBuilder?: PropertyOrBuilder<T, M> | Property | ResolvedProperty): propertyOrBuilder is PropertyBuilder<T, M>;
5
5
  export declare function getDefaultValuesFor<M extends Record<string, any>>(properties: PropertiesOrBuilders<M> | ResolvedProperties<M>): Partial<EntityValues<M>>;
6
6
  export declare function getDefaultValueFor(property?: PropertyOrBuilder): {} | null | undefined;
7
7
  export declare function getDefaultValueForDataType(dataType: DataType): {} | null;
@@ -9,12 +9,11 @@ export declare function getDefaultValueForDataType(dataType: DataType): {} | nul
9
9
  * Update the automatic values in an entity before save
10
10
  * @group Datasource
11
11
  */
12
- export declare function updateDateAutoValues<M extends Record<string, any>>({ inputValues, properties, status, timestampNowValue, setDateToMidnight }: {
12
+ export declare function updateDateAutoValues<M extends Record<string, any>>({ inputValues, properties, status, timestampNowValue }: {
13
13
  inputValues: Partial<EntityValues<M>>;
14
14
  properties: ResolvedProperties<M>;
15
15
  status: EntityStatus;
16
16
  timestampNowValue: any;
17
- setDateToMidnight: (input?: any) => any | undefined;
18
17
  }): EntityValues<M>;
19
18
  /**
20
19
  * Add missing required fields, expected in the collection, to the values of an entity
@@ -16,7 +16,7 @@ export * from "./icon_list";
16
16
  export * from "./icon_synonyms";
17
17
  export * from "./icons";
18
18
  export * from "./plurals";
19
- export * from "./references";
19
+ export * from "./previews";
20
20
  export * from "./flatten_object";
21
21
  export * from "./make_properties_editable";
22
22
  export * from "./join_collections";
@@ -24,3 +24,5 @@ export * from "./builders";
24
24
  export * from "./useTraceUpdate";
25
25
  export * from "./storage";
26
26
  export * from "./callbacks";
27
+ export * from "./conditions";
28
+ export * from "./lazy_eager";
@@ -0,0 +1,7 @@
1
+ import React from "react";
2
+ /**
3
+ * Returns a React.lazy component that is also preloaded immediately using
4
+ * requestIdleCallback or setTimeout.
5
+ * This ensures that chunks are split, but fetched in the background before they are actually needed.
6
+ */
7
+ export declare function lazyEager<T extends React.ComponentType<any>>(factory: () => Promise<any>, exportName?: string): React.LazyExoticComponent<T>;
@@ -10,3 +10,4 @@ export declare function removeUndefined(value: any, removeEmptyStrings?: boolean
10
10
  export declare function removeNulls(value: any): any;
11
11
  export declare function isEmptyObject(obj: object): boolean;
12
12
  export declare function removePropsIfExisting(source: any, comparison: any): any;
13
+ export declare function jsonStringifyReplacer(key: string, value: any): any;
@@ -15,7 +15,8 @@ export declare function getPropertyInPath<M extends Record<string, any>>(propert
15
15
  export declare function getResolvedPropertyInPath(properties: Record<string, ResolvedProperty>, path: string): ResolvedProperty | undefined;
16
16
  export declare function getBracketNotation(path: string): string;
17
17
  /**
18
- * Get properties exclusively indexed by their order
18
+ * Get properties sorted by their order, but include ALL properties.
19
+ * Nested keys (like "data.mode") in propertiesOrder are ignored - they're for column ordering.
19
20
  * @param properties
20
21
  * @param propertiesOrder
21
22
  */
@@ -1,4 +1,4 @@
1
- import { ArrayProperty, AuthController, CMSType, CustomizationController, EntityAction, EntityCollection, EntityCustomView, EntityValues, EnumValueConfig, EnumValues, NumberProperty, PropertiesOrBuilders, PropertyConfig, PropertyOrBuilder, ResolvedArrayProperty, ResolvedEntityCollection, ResolvedNumberProperty, ResolvedProperties, ResolvedProperty, ResolvedStringProperty, StringProperty, UserConfigurationPersistence } from "../types";
1
+ import { ArrayProperty, AuthController, CMSType, CustomizationController, EntityAction, EntityCollection, EntityCustomView, EntityValues, EnumValueConfig, EnumValues, NumberProperty, PropertiesOrBuilders, Property, PropertyConfig, PropertyOrBuilder, ResolvedArrayProperty, ResolvedEntityCollection, ResolvedNumberProperty, ResolvedProperties, ResolvedProperty, ResolvedStringProperty, StringProperty, UserConfigurationPersistence } from "../types";
2
2
  export declare const resolveCollection: <M extends Record<string, any>>({ collection, path, entityId, values, previousValues, userConfigPersistence, propertyConfigs, ignoreMissingFields, authController }: {
3
3
  collection: EntityCollection<M> | ResolvedEntityCollection<M>;
4
4
  path: string;
@@ -17,7 +17,7 @@ export declare const resolveCollection: <M extends Record<string, any>>({ collec
17
17
  */
18
18
  export declare function resolveProperty<T extends CMSType = CMSType, M extends Record<string, any> = any>({ propertyOrBuilder, fromBuilder, ignoreMissingFields, ...props }: {
19
19
  propertyKey?: string;
20
- propertyOrBuilder: PropertyOrBuilder<T, M> | ResolvedProperty<T>;
20
+ propertyOrBuilder: PropertyOrBuilder<T, M> | ResolvedProperty<T> | PropertyOrBuilder | Property | ResolvedProperty | undefined;
21
21
  values?: Partial<M>;
22
22
  previousValues?: Partial<M>;
23
23
  path?: string;
@@ -54,7 +54,7 @@ export declare function resolveArrayProperty<T extends any[], M>({ propertyKey,
54
54
  propertyConfigs?: Record<string, PropertyConfig>;
55
55
  ignoreMissingFields?: boolean;
56
56
  authController: AuthController;
57
- }): ResolvedArrayProperty;
57
+ }): ResolvedArrayProperty | null;
58
58
  /**
59
59
  * Resolve enums and arrays for properties
60
60
  * @param properties
@@ -1,4 +1,4 @@
1
- import { ArrayProperty, EntityValues, ResolvedArrayProperty, ResolvedStringProperty, StorageConfig, StorageSource, StringProperty } from "../types";
1
+ import { ArrayProperty, EntityValues, ImageResize, ResolvedArrayProperty, ResolvedStringProperty, StorageConfig, StorageSource, StringProperty } from "../types";
2
2
  import { PreviewSize } from "../preview";
3
3
  /**
4
4
  * Internal representation of an item in the storage
@@ -35,3 +35,12 @@ export declare function useStorageUploadController<M extends object>({ entityId,
35
35
  onFilesAdded: (acceptedFiles: File[]) => Promise<void>;
36
36
  multipleFilesSupported: boolean;
37
37
  };
38
+ /**
39
+ * Check if a file is an image type supported for resizing
40
+ */
41
+ export declare function isImageFile(file: File): boolean;
42
+ /**
43
+ * Resize and compress an image using compressorjs.
44
+ * Supports both the new imageResize API and legacy imageCompression for backward compatibility.
45
+ */
46
+ export declare function resizeImage(file: File, imageResize?: StorageConfig["imageResize"], legacyCompression?: ImageResize): Promise<File>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@firecms/core",
3
3
  "type": "module",
4
- "version": "3.0.1",
4
+ "version": "3.1.0-canary.02232f4",
5
5
  "description": "Awesome Firebase/Firestore-based headless open-source CMS",
6
6
  "funding": {
7
7
  "url": "https://github.com/sponsors/firecmsco"
@@ -53,30 +53,55 @@
53
53
  "@dnd-kit/core": "^6.3.1",
54
54
  "@dnd-kit/modifiers": "^9.0.0",
55
55
  "@dnd-kit/sortable": "^10.0.0",
56
- "@firecms/editor": "^3.0.1",
57
- "@firecms/formex": "^3.0.1",
58
- "@firecms/ui": "^3.0.1",
56
+ "@firecms/formex": "^3.1.0-canary.02232f4",
57
+ "@firecms/ui": "^3.1.0-canary.02232f4",
58
+ "@floating-ui/dom": "^1.7.4",
59
59
  "@radix-ui/react-portal": "^1.1.10",
60
+ "@radix-ui/react-slot": "^1.2.4",
60
61
  "clsx": "^2.1.1",
61
62
  "compressorjs": "^1.2.1",
62
63
  "date-fns": "^3.6.0",
63
64
  "fuse.js": "^7.1.0",
64
65
  "history": "^5.3.0",
66
+ "i18next": "^23.16.4",
67
+ "json-logic-js": "^2.0.5",
65
68
  "markdown-it": "^14.1.0",
69
+ "markdown-it-ins": "^4.0.0",
70
+ "markdown-it-mark": "^4.0.0",
71
+ "markdown-it-task-lists": "^2.1.1",
66
72
  "notistack": "^3.0.2",
67
73
  "object-hash": "^3.0.0",
68
74
  "prism-react-renderer": "^2.4.1",
75
+ "prosemirror-commands": "^1.6.0",
76
+ "prosemirror-dropcursor": "^1.8.1",
77
+ "prosemirror-example-setup": "^1.2.3",
78
+ "prosemirror-gapcursor": "^1.3.2",
79
+ "prosemirror-history": "^1.4.1",
80
+ "prosemirror-inputrules": "^1.5.1",
81
+ "prosemirror-keymap": "^1.2.2",
82
+ "prosemirror-markdown": "^1.13.0",
83
+ "prosemirror-model": "^1.22.3",
84
+ "prosemirror-schema-basic": "^1.2.3",
85
+ "prosemirror-schema-list": "^1.4.1",
86
+ "prosemirror-state": "^1.4.3",
87
+ "prosemirror-tables": "^1.8.5",
88
+ "prosemirror-transform": "^1.10.0",
89
+ "prosemirror-view": "^1.33.8",
69
90
  "react-dropzone": "^14.3.8",
70
91
  "react-fast-compare": "^3.2.2",
92
+ "react-i18next": "^14.1.3",
93
+ "react-image-crop": "^11.0.10",
94
+ "react-markdown": "^9.1.0",
95
+ "react-moveable": "^0.56.0",
71
96
  "react-transition-group": "^4.4.5",
72
97
  "react-use-measure": "^2.1.7",
73
98
  "react-window": "^1.8.11",
74
99
  "vite-plugin-static-copy": "3.1.4",
75
- "yup": "^0.32.11"
100
+ "yup": "^1.7.1"
76
101
  },
77
102
  "peerDependencies": {
78
- "react": ">=18.0.0",
79
- "react-dom": ">=18.0.0",
103
+ "react": ">=18.3.1 || >=19.0.0",
104
+ "react-dom": ">=18.3.1 || >=19.0.0",
80
105
  "react-router": "^6.28.0",
81
106
  "react-router-dom": "^6.28.0"
82
107
  },
@@ -85,14 +110,16 @@
85
110
  "@testing-library/react": "^16.3.0",
86
111
  "@testing-library/user-event": "^14.6.1",
87
112
  "@types/jest": "^29.5.14",
113
+ "@types/json-logic-js": "^2.0.8",
88
114
  "@types/node": "^20.19.17",
89
115
  "@types/object-hash": "^3.0.6",
90
- "@types/react": "^18.3.24",
91
- "@types/react-dom": "^18.3.7",
116
+ "@types/react": "^19.2.3",
117
+ "@types/react-dom": "^19.2.3",
92
118
  "@types/react-measure": "^2.0.12",
93
119
  "@vitejs/plugin-react": "^4.7.0",
94
120
  "babel-plugin-react-compiler": "^19.0.0-beta-af1b7da-20250417",
95
121
  "cross-env": "^7.0.3",
122
+ "eslint-plugin-i18next": "^6.1.3",
96
123
  "eslint-plugin-react-compiler": "^19.1.0-rc.2",
97
124
  "jest": "^29.7.0",
98
125
  "jest-environment-jsdom": "^30.2.0",
@@ -109,15 +136,27 @@
109
136
  "dist",
110
137
  "src"
111
138
  ],
112
- "gitHead": "72d951d01d15ef5a7efcde6c63839f65964d2f7a",
139
+ "gitHead": "6281205d9f39f85991e1d8533474bfb9a542ed03",
113
140
  "publishConfig": {
114
141
  "access": "public"
115
142
  },
116
143
  "eslintConfig": {
117
144
  "extends": [
118
145
  "react-app",
119
- "react-app/jest"
120
- ]
146
+ "react-app/jest",
147
+ "plugin:i18next/recommended"
148
+ ],
149
+ "plugins": [
150
+ "i18next"
151
+ ],
152
+ "rules": {
153
+ "i18next/no-literal-string": [
154
+ "warn",
155
+ {
156
+ "markupOnly": true
157
+ }
158
+ ]
159
+ }
121
160
  },
122
161
  "jest": {
123
162
  "transform": {
@@ -4,6 +4,7 @@ import equal from "react-fast-compare"
4
4
  import { useLargeLayout } from "../hooks";
5
5
  import { ErrorBoundary } from "../components";
6
6
  import { AppContext } from "./useApp";
7
+ import { useTranslation } from "../hooks/useTranslation";
7
8
 
8
9
  export const DRAWER_WIDTH = 280;
9
10
 
@@ -123,7 +124,7 @@ export const Scaffold = React.memo<PropsWithChildren<ScaffoldProps>>(
123
124
  <main
124
125
  className="flex flex-col flex-grow overflow-auto">
125
126
 
126
- {hasAppBar && <DrawerHeader/>}
127
+ {hasAppBar && <DrawerHeader />}
127
128
 
128
129
  <div
129
130
  className={cls(defaultBorderMixin, "flex-grow overflow-auto m-0 ", {
@@ -163,6 +164,7 @@ function DrawerWrapper(props: {
163
164
  onMouseLeave: () => void
164
165
  }) {
165
166
 
167
+ const { t } = useTranslation();
166
168
  const width = !props.displayed ? 0 : (props.open ? DRAWER_WIDTH : 72);
167
169
  const innerDrawer = <div
168
170
  className={"relative h-full no-scrollbar overflow-y-auto overflow-x-hidden"}
@@ -173,33 +175,32 @@ function DrawerWrapper(props: {
173
175
  >
174
176
 
175
177
  {!props.open && props.displayed && (
176
- <Tooltip title="Open menu"
177
- side="right"
178
- sideOffset={12}
179
- asChild={true}>
178
+ <Tooltip title={t("open_menu")}
179
+ side="right"
180
+ sideOffset={12}
181
+ asChild={true}>
180
182
  <div
181
183
  className="ml-2 fixed top-1 left-2 sm:top-2 sm:left-2 !bg-surface-50 dark:!bg-surface-900 rounded-full w-fit z-20">
182
184
  <IconButton
183
185
  color="inherit"
184
- aria-label="Open menu"
186
+ aria-label={t("open_menu")}
185
187
  onClick={() => props.setDrawerOpen(true)}
186
188
  size="large"
187
189
  >
188
- <MenuIcon/>
190
+ <MenuIcon size="small" />
189
191
  </IconButton>
190
192
  </div>
191
193
  </Tooltip>
192
194
  )}
193
195
 
194
196
  <div
195
- className={`z-20 absolute right-0 top-4 ${
196
- props.open ? "opacity-100" : "opacity-0 invisible"
197
- } transition-opacity duration-200 ease-in-out`}>
197
+ className={`z-20 absolute right-0 top-4 ${props.open ? "opacity-100" : "opacity-0 invisible"
198
+ } transition-opacity duration-200 ease-in-out`}>
198
199
  <IconButton
199
- aria-label="Close drawer"
200
+ aria-label={t("close_drawer")}
200
201
  onClick={() => props.setDrawerOpen(false)}
201
202
  >
202
- <ChevronLeftIcon/>
203
+ <ChevronLeftIcon />
203
204
  </IconButton>
204
205
  </div>
205
206
 
@@ -216,19 +217,19 @@ function DrawerWrapper(props: {
216
217
  return <>
217
218
  <IconButton
218
219
  color="inherit"
219
- aria-label="Open drawer"
220
+ aria-label={t("open_menu")}
220
221
  onClick={() => props.setDrawerOpen(true)}
221
222
  size="large"
222
223
  className="absolute sm:top-2 sm:left-4 top-1 left-2"
223
224
  >
224
- <MenuIcon/>
225
+ <MenuIcon />
225
226
  </IconButton>
226
227
  <Sheet side={"left"}
227
- transparent={true}
228
- open={props.open}
229
- onOpenChange={props.setDrawerOpen}
230
- title={"Navigation drawer"}
231
- overlayClassName={"bg-white bg-opacity-80"}
228
+ transparent={true}
229
+ open={props.open}
230
+ onOpenChange={props.setDrawerOpen}
231
+ title={t("navigation_drawer")}
232
+ overlayClassName={"bg-white bg-opacity-80 bg-white/80"}
232
233
  >
233
234
  {innerDrawer}
234
235
  </Sheet>
@@ -0,0 +1,41 @@
1
+ import React from "react";
2
+ import { AutoAwesomeIcon } from "@firecms/ui";
3
+ import { useTranslation } from "../hooks";
4
+
5
+ export interface AIIconProps {
6
+ size?: "smallest" | "small" | "medium" | "large";
7
+ className?: string;
8
+ }
9
+
10
+ /**
11
+ * AI-styled AutoAwesome icon with gradient coloring.
12
+ * Used consistently across AI features for visual identification.
13
+ */
14
+ export function AIIcon({ size = "small", className }: AIIconProps) {
15
+ return (
16
+ <AutoAwesomeIcon
17
+ size={size}
18
+ className={className}
19
+ style={{
20
+ background: "linear-gradient(to right, var(--color-primary), var(--color-secondary))",
21
+ WebkitBackgroundClip: "text",
22
+ WebkitTextFillColor: "transparent",
23
+ backgroundClip: "text"
24
+ }}
25
+ />
26
+ );
27
+ }
28
+
29
+ /**
30
+ * Small animated dot indicator for AI-modified elements.
31
+ * Shows a pulsing gradient dot.
32
+ */
33
+ export function AIModifiedIndicator({ className }: { className?: string }) {
34
+ const { t } = useTranslation();
35
+ return (
36
+ <div
37
+ className={`w-2 h-2 rounded-full bg-gradient-to-r from-primary to-secondary animate-pulse ${className ?? ""}`}
38
+ title={t("ai_modified")}
39
+ />
40
+ );
41
+ }
@@ -13,6 +13,7 @@ import { restrictToVerticalAxis } from "@dnd-kit/modifiers";
13
13
  import { SortableContext, useSortable, verticalListSortingStrategy } from "@dnd-kit/sortable";
14
14
  import { CSS } from "@dnd-kit/utilities";
15
15
  import { getHashValue } from "../util";
16
+ import { useTranslation } from "../hooks";
16
17
  import {
17
18
  AddIcon,
18
19
  Button,
@@ -186,7 +187,7 @@ export function ArrayContainerItem({
186
187
  <div
187
188
  ref={nodeRef}
188
189
  style={style}
189
- className={`relative ${!isDragging ? "hover\\:bg-surface-accent-50 dark\\:hover\\:bg-surface-800 dark\\:hover\\:bg-opacity-20" : ""} rounded-md opacity-100`}
190
+ className={`relative ${!isDragging ? "hover\\:bg-surface-accent-50 dark\\:hover\\:bg-surface-800 dark\\:hover\\:bg-opacity-20 dark\\:hover\\:bg-surface-800/20" : ""} rounded-md opacity-100`}
190
191
  >
191
192
  <div className="flex items-start">
192
193
  <div className="flex-grow w-[calc(100%-48px)] text-text-primary dark:text-text-primary-dark">
@@ -235,6 +236,7 @@ export function ArrayItemOptions({
235
236
  canAddElements?: boolean;
236
237
  addInIndex?: (index: number) => void;
237
238
  }) {
239
+ const { t } = useTranslation();
238
240
  const [menuOpen, setMenuOpen] = useState(false);
239
241
  const iconRef = useRef<HTMLDivElement>(null);
240
242
  useOutsideAlerter(iconRef, () => {
@@ -296,7 +298,7 @@ export function ArrayItemOptions({
296
298
  }}
297
299
  >
298
300
  <RemoveIcon size={"small"}/>
299
- Remove
301
+ {t("remove")}
300
302
  </MenuItem>
301
303
  <MenuItem
302
304
  dense
@@ -306,7 +308,7 @@ export function ArrayItemOptions({
306
308
  }}
307
309
  >
308
310
  <ContentCopyIcon size={"small"}/>
309
- Copy
311
+ {t("copy")}
310
312
  </MenuItem>
311
313
  {addInIndex && (
312
314
  <MenuItem
@@ -317,7 +319,7 @@ export function ArrayItemOptions({
317
319
  }}
318
320
  >
319
321
  <KeyboardArrowUpIcon size={"small"}/>
320
- Add on top
322
+ {t("add_on_top")}
321
323
  </MenuItem>
322
324
  )}
323
325
  {addInIndex && (
@@ -329,7 +331,7 @@ export function ArrayItemOptions({
329
331
  }}
330
332
  >
331
333
  <KeyboardArrowDownIcon size={"small"}/>
332
- Add below
334
+ {t("add_below")}
333
335
  </MenuItem>
334
336
  )}
335
337
  </Menu>
@@ -484,11 +486,9 @@ export function ArrayContainer<T>({
484
486
  <Button
485
487
  variant={"text"}
486
488
  size={size === "small" ? "small" : "medium"}
487
- color="primary"
488
489
  disabled={disabled || (value?.length ?? 0) >= max}
489
490
  startIcon={<AddIcon/>}
490
491
  onClick={insertInEnd}
491
- className={"ml-3.5"}
492
492
  >
493
493
  {addLabel ?? "Add"}
494
494
  </Button>
@@ -527,7 +527,6 @@ export function ArrayContainer<T>({
527
527
  <Button
528
528
  variant={"text"}
529
529
  size={size === "small" ? "small" : "medium"}
530
- color="primary"
531
530
  disabled={disabled || (value?.length ?? 0) >= max}
532
531
  startIcon={<AddIcon/>}
533
532
  onClick={insertInEnd}
@@ -1,13 +1,16 @@
1
- import { Button, FilterListOffIcon } from "@firecms/ui";
1
+ import { FilterListOffIcon, Button, Tooltip } from "@firecms/ui";
2
2
  import { EntityTableController } from "../types";
3
+ import { useTranslation } from "../hooks";
3
4
 
4
5
  export function ClearFilterSortButton({
5
- tableController,
6
- enabled
7
- }: {
6
+ tableController,
7
+ enabled
8
+ }: {
8
9
  enabled: boolean;
9
10
  tableController: EntityTableController
10
11
  }) {
12
+ const { t } = useTranslation();
13
+
11
14
  if (!enabled) {
12
15
  return null;
13
16
  }
@@ -18,24 +21,27 @@ export function ClearFilterSortButton({
18
21
  if ((filterIsSet || sortIsSet) && (tableController.clearFilter || tableController.setSortBy)) {
19
22
  let label;
20
23
  if (filterIsSet && sortIsSet) {
21
- label = "Clear filter/sort";
24
+ label = t("clear_filter_sort");
22
25
  } else if (filterIsSet) {
23
- label = "Clear filter";
26
+ label = t("clear_filter");
24
27
  } else {
25
- label = "Clear sort";
28
+ label = t("clear_sort");
26
29
  }
27
- return <Button
28
- variant={"outlined"}
29
- className="h-fit-content"
30
- aria-label="filter clear"
31
- onClick={() => {
32
- tableController.clearFilter?.();
33
- tableController.setSortBy?.(undefined);
34
- }}
35
- size={"small"}>
36
- <FilterListOffIcon/>
37
- {label}
38
- </Button>
30
+ return (
31
+ <Tooltip title={label}>
32
+ <Button
33
+ size={"small"}
34
+ variant={"text"}
35
+ aria-label={label}
36
+ onClick={() => {
37
+ tableController.clearFilter?.();
38
+ tableController.setSortBy?.(undefined);
39
+ }}
40
+ >
41
+ <FilterListOffIcon size="small" />
42
+ </Button>
43
+ </Tooltip>
44
+ );
39
45
  }
40
46
  return null;
41
47
  }
@@ -1,6 +1,7 @@
1
1
  import React from "react";
2
2
 
3
3
  import { Button, Dialog, DialogActions, DialogContent, DialogTitle, LoadingButton } from "@firecms/ui";
4
+ import { useTranslation } from "../hooks/useTranslation";
4
5
 
5
6
  export function ConfirmationDialog({
6
7
  open,
@@ -17,6 +18,7 @@ export function ConfirmationDialog({
17
18
  title: React.ReactNode,
18
19
  body?: React.ReactNode,
19
20
  }) {
21
+ const { t } = useTranslation();
20
22
  return (
21
23
  <Dialog
22
24
  open={open}
@@ -29,18 +31,16 @@ export function ConfirmationDialog({
29
31
 
30
32
  <DialogActions>
31
33
  <Button
32
- color={"primary"}
33
34
  variant={"text"}
34
35
  onClick={onCancel}
35
- autoFocus>Cancel</Button>
36
+ autoFocus>{t("cancel")}</Button>
36
37
 
37
38
  <LoadingButton
38
- color="primary"
39
39
  type="submit"
40
40
  loading={loading}
41
41
  onClick={onAccept}
42
42
  autoFocus>
43
- Ok
43
+ {t("ok")}
44
44
  </LoadingButton>
45
45
  </DialogActions>
46
46
  </Dialog>
@@ -11,6 +11,7 @@ import {
11
11
  } from "../hooks";
12
12
  import { resolveCollection } from "../util";
13
13
  import { EntityView } from "./EntityView";
14
+ import { useTranslation } from "../hooks/useTranslation";
14
15
 
15
16
  export interface DeleteEntityDialogProps<M extends Record<string, any>> {
16
17
  entityOrEntitiesToDelete?: Entity<M> | Entity<M>[],
@@ -39,6 +40,8 @@ export function DeleteEntityDialog<M extends Record<string, any>>({
39
40
  const dataSource = useDataSource(collection);
40
41
  const customizationController = useCustomizationController();
41
42
  const snackbarController = useSnackbarController();
43
+ const { t } = useTranslation();
44
+
42
45
  const [loading, setLoading] = useState(false);
43
46
 
44
47
  const context = useFireCMSContext();
@@ -66,7 +69,7 @@ export function DeleteEntityDialog<M extends Record<string, any>>({
66
69
  const onDeleteFailure = useCallback((entity: Entity<any>, e: Error) => {
67
70
  snackbarController.open({
68
71
  type: "error",
69
- message: "Error deleting: " + e?.message
72
+ message: t("error_deleting", { message: e?.message })
70
73
  });
71
74
 
72
75
  console.error("Error deleting entity");
@@ -76,7 +79,7 @@ export function DeleteEntityDialog<M extends Record<string, any>>({
76
79
  const onPreDeleteHookError = useCallback((entity: Entity<any>, e: Error) => {
77
80
  snackbarController.open({
78
81
  type: "error",
79
- message: "Error before deleting: " + e?.message
82
+ message: t("error_before_delete", { message: e?.message })
80
83
  });
81
84
  console.error(e);
82
85
  }, [resolvedCollection.name]);
@@ -153,7 +156,7 @@ export function DeleteEntityDialog<M extends Record<string, any>>({
153
156
 
154
157
  let content: React.ReactNode;
155
158
  if (entityOrEntities && multipleEntities) {
156
- content = <>Multiple entities</>;
159
+ content = <>{t("multiple_entities")}</>;
157
160
  } else {
158
161
  const entity = entityOrEntities as Entity<M> | undefined;
159
162
  content = entity
@@ -165,8 +168,8 @@ export function DeleteEntityDialog<M extends Record<string, any>>({
165
168
  }
166
169
 
167
170
  const dialogTitle = multipleEntities
168
- ? <><b>{resolvedCollection.name}</b>: Confirm multiple delete?</>
169
- : `Would you like to delete this ${resolvedCollection.singularName ?? resolvedCollection.name}?`;
171
+ ? <><b>{resolvedCollection.name}</b>: {t("confirm_multiple_delete")}</>
172
+ : t("delete_entity_confirm_title", { entityName: resolvedCollection.singularName ?? resolvedCollection.name });
170
173
 
171
174
  return (
172
175
  <Dialog
@@ -187,17 +190,15 @@ export function DeleteEntityDialog<M extends Record<string, any>>({
187
190
 
188
191
  <Button onClick={handleCancel}
189
192
  disabled={loading}
190
- variant="text"
191
- color="primary">
192
- Cancel
193
+ variant="text">
194
+ {t("cancel")}
193
195
  </Button>
194
196
  <Button
195
197
  autoFocus
196
198
  disabled={loading}
197
199
  onClick={handleOk}
198
- variant="filled"
199
- color="primary">
200
- Ok
200
+ variant="filled">
201
+ {t("ok")}
201
202
  </Button>
202
203
  </DialogActions>
203
204