@firecms/core 3.0.0-canary.11 → 3.0.0-canary.110

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 (269) hide show
  1. package/README.md +1 -1
  2. package/dist/app/AppBar.d.ts +12 -0
  3. package/dist/app/Drawer.d.ts +17 -0
  4. package/dist/app/Scaffold.d.ts +30 -0
  5. package/dist/app/index.d.ts +4 -0
  6. package/dist/app/useApp.d.ts +16 -0
  7. package/dist/components/CircularProgressCenter.d.ts +1 -1
  8. package/dist/components/ClearFilterSortButton.d.ts +5 -0
  9. package/dist/components/EntityCollectionTable/EntityCollectionRowActions.d.ts +11 -12
  10. package/dist/components/EntityCollectionTable/EntityCollectionTable.d.ts +1 -1
  11. package/dist/components/EntityCollectionTable/EntityCollectionTableProps.d.ts +5 -3
  12. package/dist/components/EntityCollectionTable/PropertyTableCell.d.ts +1 -0
  13. package/dist/components/EntityCollectionTable/column_utils.d.ts +1 -2
  14. package/dist/components/EntityCollectionTable/fields/TableReferenceField.d.ts +2 -0
  15. package/dist/components/EntityCollectionTable/internal/CollectionTableToolbar.d.ts +1 -4
  16. package/dist/components/EntityCollectionTable/internal/EntityTableCell.d.ts +2 -2
  17. package/dist/components/EntityCollectionTable/internal/popup_field/PopupFormField.d.ts +2 -2
  18. package/dist/components/EntityCollectionView/EntityCollectionView.d.ts +12 -2
  19. package/dist/components/EntityCollectionView/EntityCollectionViewStartActions.d.ts +11 -0
  20. package/dist/components/EntityPreview.d.ts +5 -4
  21. package/dist/components/ErrorView.d.ts +1 -1
  22. package/dist/components/HomePage/DefaultHomePage.d.ts +1 -1
  23. package/dist/components/HomePage/NavigationCardBinding.d.ts +1 -1
  24. package/dist/components/PropertyIdCopyTooltip.d.ts +8 -0
  25. package/dist/components/ReferenceWidget.d.ts +3 -1
  26. package/dist/components/SelectableTable/SelectableTable.d.ts +1 -1
  27. package/dist/components/SelectableTable/filters/ReferenceFilterField.d.ts +2 -1
  28. package/dist/components/VirtualTable/VirtualTableProps.d.ts +15 -12
  29. package/dist/components/VirtualTable/types.d.ts +3 -3
  30. package/dist/components/{EntityCollectionTable/internal → common}/default_entity_actions.d.ts +1 -1
  31. package/dist/components/common/index.d.ts +1 -0
  32. package/dist/components/common/table_height.d.ts +5 -0
  33. package/dist/components/common/types.d.ts +4 -6
  34. package/dist/components/common/useColumnsIds.d.ts +2 -1
  35. package/dist/components/common/useDataSourceEntityCollectionTableController.d.ts +3 -0
  36. package/dist/components/index.d.ts +3 -1
  37. package/dist/{components/FireCMSAppBar.d.ts → core/DefaultAppBar.d.ts} +6 -9
  38. package/dist/core/DefaultDrawer.d.ts +19 -0
  39. package/dist/core/DrawerNavigationItem.d.ts +9 -0
  40. package/dist/core/EntityEditView.d.ts +18 -4
  41. package/dist/core/FireCMS.d.ts +1 -1
  42. package/dist/core/NavigationRoutes.d.ts +3 -3
  43. package/dist/core/index.d.ts +3 -4
  44. package/dist/form/PropertyFieldBinding.d.ts +1 -1
  45. package/dist/form/components/ErrorFocus.d.ts +1 -1
  46. package/dist/form/components/FieldHelperText.d.ts +3 -3
  47. package/dist/form/components/LabelWithIcon.d.ts +1 -1
  48. package/dist/form/components/LabelWithIconAndTooltip.d.ts +15 -0
  49. package/dist/form/components/StorageItemPreview.d.ts +4 -4
  50. package/dist/form/components/index.d.ts +1 -0
  51. package/dist/form/field_bindings/ArrayCustomShapedFieldBinding.d.ts +1 -1
  52. package/dist/form/field_bindings/ArrayOfReferencesFieldBinding.d.ts +1 -1
  53. package/dist/form/field_bindings/BlockFieldBinding.d.ts +1 -1
  54. package/dist/form/field_bindings/KeyValueFieldBinding.d.ts +1 -1
  55. package/dist/form/field_bindings/MapFieldBinding.d.ts +1 -1
  56. package/dist/form/field_bindings/MarkdownEditorFieldBinding.d.ts +11 -0
  57. package/dist/form/field_bindings/MultiSelectBinding.d.ts +1 -1
  58. package/dist/form/field_bindings/ReadOnlyFieldBinding.d.ts +1 -1
  59. package/dist/form/field_bindings/RepeatFieldBinding.d.ts +1 -1
  60. package/dist/form/field_bindings/SelectFieldBinding.d.ts +1 -1
  61. package/dist/form/field_bindings/StorageUploadFieldBinding.d.ts +3 -5
  62. package/dist/form/field_bindings/TextFieldBinding.d.ts +1 -1
  63. package/dist/form/index.d.ts +2 -4
  64. package/dist/hooks/data/save.d.ts +1 -2
  65. package/dist/hooks/index.d.ts +1 -0
  66. package/dist/hooks/useBuildNavigationController.d.ts +1 -2
  67. package/dist/hooks/useProjectLog.d.ts +2 -2
  68. package/dist/hooks/useValidateAuthenticator.d.ts +4 -8
  69. package/dist/index.d.ts +1 -0
  70. package/dist/index.es.js +15627 -12442
  71. package/dist/index.es.js.map +1 -1
  72. package/dist/index.umd.js +19866 -587
  73. package/dist/index.umd.js.map +1 -1
  74. package/dist/internal/useBuildDataSource.d.ts +1 -16
  75. package/dist/preview/PropertyPreviewProps.d.ts +6 -1
  76. package/dist/preview/components/EnumValuesChip.d.ts +1 -1
  77. package/dist/preview/components/ReferencePreview.d.ts +2 -1
  78. package/dist/preview/components/StorageThumbnail.d.ts +2 -1
  79. package/dist/preview/components/UrlComponentPreview.d.ts +2 -1
  80. package/dist/types/auth.d.ts +3 -3
  81. package/dist/types/collections.d.ts +39 -5
  82. package/dist/types/datasource.d.ts +45 -31
  83. package/dist/types/entities.d.ts +6 -1
  84. package/dist/types/entity_actions.d.ts +14 -0
  85. package/dist/types/fields.d.ts +45 -39
  86. package/dist/types/index.d.ts +0 -1
  87. package/dist/types/navigation.d.ts +6 -5
  88. package/dist/types/plugins.d.ts +14 -4
  89. package/dist/types/properties.d.ts +32 -19
  90. package/dist/types/storage.d.ts +11 -3
  91. package/dist/util/entities.d.ts +1 -1
  92. package/dist/util/icon_list.d.ts +5 -1
  93. package/dist/util/icon_synonyms.d.ts +1 -97
  94. package/dist/util/icons.d.ts +2 -2
  95. package/dist/util/index.d.ts +1 -0
  96. package/dist/util/navigation_utils.d.ts +2 -2
  97. package/dist/util/objects.d.ts +1 -1
  98. package/dist/util/plurals.d.ts +0 -2
  99. package/dist/util/resolutions.d.ts +14 -13
  100. package/dist/util/storage.d.ts +23 -2
  101. package/dist/util/useStorageUploadController.d.ts +1 -1
  102. package/package.json +128 -119
  103. package/src/app/AppBar.tsx +18 -0
  104. package/src/app/Drawer.tsx +25 -0
  105. package/src/app/Scaffold.tsx +245 -0
  106. package/src/app/index.ts +4 -0
  107. package/src/app/useApp.tsx +32 -0
  108. package/src/components/ArrayContainer.tsx +9 -7
  109. package/src/components/CircularProgressCenter.tsx +1 -1
  110. package/src/components/ClearFilterSortButton.tsx +41 -0
  111. package/src/components/EntityCollectionTable/EntityCollectionRowActions.tsx +12 -19
  112. package/src/components/EntityCollectionTable/EntityCollectionTable.tsx +21 -20
  113. package/src/components/EntityCollectionTable/EntityCollectionTableProps.tsx +10 -6
  114. package/src/components/EntityCollectionTable/PropertyTableCell.tsx +41 -35
  115. package/src/components/EntityCollectionTable/column_utils.tsx +3 -3
  116. package/src/components/EntityCollectionTable/fields/TableReferenceField.tsx +22 -12
  117. package/src/components/EntityCollectionTable/fields/TableStorageUpload.tsx +14 -6
  118. package/src/components/EntityCollectionTable/internal/CollectionTableToolbar.tsx +29 -34
  119. package/src/components/EntityCollectionTable/internal/EntityTableCell.tsx +17 -13
  120. package/src/components/EntityCollectionTable/internal/EntityTableCellActions.tsx +19 -7
  121. package/src/components/EntityCollectionTable/internal/popup_field/PopupFormField.tsx +7 -10
  122. package/src/components/EntityCollectionView/EntityCollectionView.tsx +75 -51
  123. package/src/components/EntityCollectionView/EntityCollectionViewStartActions.tsx +68 -0
  124. package/src/components/EntityCollectionView/useSelectionController.tsx +19 -7
  125. package/src/components/EntityPreview.tsx +21 -15
  126. package/src/components/EntityView.tsx +5 -5
  127. package/src/components/ErrorView.tsx +1 -1
  128. package/src/components/HomePage/DefaultHomePage.tsx +24 -15
  129. package/src/components/HomePage/NavigationCard.tsx +3 -3
  130. package/src/components/HomePage/NavigationCardBinding.tsx +1 -1
  131. package/src/components/HomePage/SmallNavigationCard.tsx +5 -6
  132. package/src/components/PropertyIdCopyTooltip.tsx +48 -0
  133. package/src/components/ReferenceTable/ReferenceSelectionTable.tsx +2 -5
  134. package/src/components/ReferenceWidget.tsx +22 -12
  135. package/src/components/SearchIconsView.tsx +11 -7
  136. package/src/components/SelectableTable/SelectableTable.tsx +7 -7
  137. package/src/components/SelectableTable/filters/BooleanFilterField.tsx +2 -3
  138. package/src/components/SelectableTable/filters/DateTimeFilterField.tsx +22 -7
  139. package/src/components/SelectableTable/filters/ReferenceFilterField.tsx +28 -6
  140. package/src/components/SelectableTable/filters/StringNumberFilterField.tsx +35 -15
  141. package/src/components/VirtualTable/VirtualTable.tsx +70 -37
  142. package/src/components/VirtualTable/VirtualTableCell.tsx +1 -1
  143. package/src/components/VirtualTable/VirtualTableHeader.tsx +4 -4
  144. package/src/components/VirtualTable/VirtualTableHeaderRow.tsx +2 -2
  145. package/src/components/VirtualTable/VirtualTableProps.tsx +18 -14
  146. package/src/components/VirtualTable/VirtualTableRow.tsx +4 -5
  147. package/src/components/VirtualTable/fields/VirtualTableDateField.tsx +1 -1
  148. package/src/components/VirtualTable/types.tsx +2 -3
  149. package/src/components/{EntityCollectionTable/internal → common}/default_entity_actions.tsx +2 -2
  150. package/src/components/common/index.ts +1 -0
  151. package/src/components/{VirtualTable/common.tsx → common/table_height.tsx} +5 -2
  152. package/src/components/common/types.tsx +4 -6
  153. package/src/components/common/useColumnsIds.tsx +23 -2
  154. package/src/components/common/useDataSourceEntityCollectionTableController.tsx +11 -0
  155. package/src/components/common/useTableSearchHelper.ts +53 -12
  156. package/src/components/index.tsx +3 -1
  157. package/src/contexts/DialogsProvider.tsx +2 -2
  158. package/src/{components/FireCMSAppBar.tsx → core/DefaultAppBar.tsx} +52 -37
  159. package/src/core/DefaultDrawer.tsx +177 -0
  160. package/src/core/DrawerNavigationItem.tsx +64 -0
  161. package/src/core/EntityEditView.tsx +702 -137
  162. package/src/core/EntitySidePanel.tsx +1 -2
  163. package/src/core/FireCMS.tsx +39 -44
  164. package/src/core/NavigationRoutes.tsx +7 -8
  165. package/src/core/SideDialogs.tsx +4 -0
  166. package/src/core/field_configs.tsx +4 -5
  167. package/src/core/index.tsx +3 -4
  168. package/src/form/PropertyFieldBinding.tsx +53 -21
  169. package/src/form/components/CustomIdField.tsx +4 -2
  170. package/src/form/components/FieldHelperText.tsx +4 -4
  171. package/src/form/components/LabelWithIcon.tsx +27 -19
  172. package/src/form/components/LabelWithIconAndTooltip.tsx +28 -0
  173. package/src/form/components/StorageItemPreview.tsx +21 -11
  174. package/src/form/components/StorageUploadProgress.tsx +3 -4
  175. package/src/form/components/index.tsx +1 -0
  176. package/src/form/field_bindings/ArrayCustomShapedFieldBinding.tsx +15 -11
  177. package/src/form/field_bindings/ArrayOfReferencesFieldBinding.tsx +26 -21
  178. package/src/form/field_bindings/BlockFieldBinding.tsx +13 -12
  179. package/src/form/field_bindings/DateTimeFieldBinding.tsx +17 -14
  180. package/src/form/field_bindings/KeyValueFieldBinding.tsx +52 -46
  181. package/src/form/field_bindings/MapFieldBinding.tsx +15 -15
  182. package/src/form/field_bindings/MarkdownEditorFieldBinding.tsx +138 -0
  183. package/src/form/field_bindings/MultiSelectBinding.tsx +9 -5
  184. package/src/form/field_bindings/ReadOnlyFieldBinding.tsx +11 -16
  185. package/src/form/field_bindings/ReferenceFieldBinding.tsx +37 -27
  186. package/src/form/field_bindings/RepeatFieldBinding.tsx +20 -16
  187. package/src/form/field_bindings/SelectFieldBinding.tsx +47 -41
  188. package/src/form/field_bindings/StorageUploadFieldBinding.tsx +31 -52
  189. package/src/form/field_bindings/SwitchFieldBinding.tsx +9 -5
  190. package/src/form/field_bindings/TextFieldBinding.tsx +26 -22
  191. package/src/form/index.tsx +6 -6
  192. package/src/form/validation.ts +1 -17
  193. package/src/hooks/data/save.ts +6 -1
  194. package/src/hooks/data/useDataSource.tsx +1 -1
  195. package/src/hooks/index.tsx +1 -0
  196. package/src/hooks/useBuildLocalConfigurationPersistence.tsx +8 -10
  197. package/src/hooks/useBuildModeController.tsx +11 -5
  198. package/src/hooks/useBuildNavigationController.tsx +86 -29
  199. package/src/hooks/useProjectLog.tsx +19 -8
  200. package/src/hooks/useResolvedNavigationFrom.tsx +1 -1
  201. package/src/hooks/useValidateAuthenticator.tsx +21 -41
  202. package/src/index.ts +1 -0
  203. package/src/internal/useBuildDataSource.ts +84 -62
  204. package/src/internal/useBuildSideEntityController.tsx +90 -21
  205. package/src/internal/useUnsavedChangesDialog.tsx +3 -1
  206. package/src/preview/PropertyPreview.tsx +10 -17
  207. package/src/preview/PropertyPreviewProps.tsx +7 -1
  208. package/src/preview/components/BooleanPreview.tsx +2 -2
  209. package/src/preview/components/EnumValuesChip.tsx +2 -2
  210. package/src/preview/components/ImagePreview.tsx +24 -34
  211. package/src/preview/components/ReferencePreview.tsx +23 -23
  212. package/src/preview/components/StorageThumbnail.tsx +5 -1
  213. package/src/preview/components/UrlComponentPreview.tsx +44 -11
  214. package/src/preview/property_previews/ArrayOfMapsPreview.tsx +0 -1
  215. package/src/preview/property_previews/ArrayOfReferencesPreview.tsx +3 -2
  216. package/src/preview/property_previews/ArrayOfStorageComponentsPreview.tsx +1 -2
  217. package/src/preview/property_previews/ArrayOfStringsPreview.tsx +0 -1
  218. package/src/preview/property_previews/ArrayOneOfPreview.tsx +3 -4
  219. package/src/preview/property_previews/ArrayPropertyPreview.tsx +3 -4
  220. package/src/preview/property_previews/MapPropertyPreview.tsx +6 -6
  221. package/src/preview/property_previews/SkeletonPropertyComponent.tsx +2 -2
  222. package/src/preview/property_previews/StringPropertyPreview.tsx +3 -3
  223. package/src/preview/util.ts +2 -2
  224. package/src/types/auth.tsx +3 -3
  225. package/src/types/collections.ts +48 -7
  226. package/src/types/customization_controller.tsx +0 -1
  227. package/src/types/datasource.ts +53 -39
  228. package/src/types/entities.ts +11 -1
  229. package/src/types/entity_actions.tsx +16 -3
  230. package/src/types/fields.tsx +49 -43
  231. package/src/types/index.ts +0 -1
  232. package/src/types/navigation.ts +7 -7
  233. package/src/types/plugins.tsx +16 -6
  234. package/src/types/properties.ts +37 -20
  235. package/src/types/storage.ts +12 -3
  236. package/src/util/entities.ts +5 -4
  237. package/src/util/enums.ts +1 -1
  238. package/src/util/icon_list.ts +15 -10
  239. package/src/util/icon_synonyms.ts +3 -99
  240. package/src/util/index.ts +1 -0
  241. package/src/util/navigation_utils.ts +6 -6
  242. package/src/util/objects.ts +25 -28
  243. package/src/util/permissions.ts +1 -0
  244. package/src/util/plurals.ts +0 -2
  245. package/src/util/references.ts +3 -0
  246. package/src/util/resolutions.ts +44 -39
  247. package/src/util/storage.ts +76 -22
  248. package/src/util/strings.ts +2 -2
  249. package/src/util/useStorageUploadController.tsx +22 -4
  250. package/src/util/useTraceUpdate.tsx +1 -0
  251. package/dist/components/PropertyIdCopyTooltipContent.d.ts +0 -3
  252. package/dist/components/VirtualTable/common.d.ts +0 -2
  253. package/dist/core/Drawer.d.ts +0 -23
  254. package/dist/core/Scaffold.d.ts +0 -55
  255. package/dist/core/SideEntityView.d.ts +0 -7
  256. package/dist/form/EntityForm.d.ts +0 -77
  257. package/dist/form/field_bindings/MarkdownFieldBinding.d.ts +0 -9
  258. package/dist/internal/useBuildCustomizationController.d.ts +0 -2
  259. package/dist/internal/useLocaleConfig.d.ts +0 -1
  260. package/dist/types/appcheck.d.ts +0 -26
  261. package/src/components/PropertyIdCopyTooltipContent.tsx +0 -28
  262. package/src/core/Drawer.tsx +0 -191
  263. package/src/core/Scaffold.tsx +0 -281
  264. package/src/core/SideEntityView.tsx +0 -38
  265. package/src/form/EntityForm.tsx +0 -728
  266. package/src/form/field_bindings/MarkdownFieldBinding.tsx +0 -695
  267. package/src/internal/useBuildCustomizationController.tsx +0 -5
  268. package/src/internal/useLocaleConfig.tsx +0 -18
  269. package/src/types/appcheck.ts +0 -29
@@ -1,17 +1,9 @@
1
1
  import React, { useCallback } from "react";
2
2
 
3
- import {
4
- ArrayProperty,
5
- Entity,
6
- EntityCollection,
7
- FieldProps,
8
- ResolvedArrayProperty,
9
- ResolvedStringProperty,
10
- StorageConfig
11
- } from "../../types";
3
+ import { ArrayProperty, FieldProps, ResolvedArrayProperty, ResolvedStringProperty, StorageConfig } from "../../types";
12
4
  import { useDropzone } from "react-dropzone";
13
5
  import { PreviewSize } from "../../preview";
14
- import { FieldHelperText, LabelWithIcon } from "../components";
6
+ import { FieldHelperText, LabelWithIconAndTooltip } from "../components";
15
7
 
16
8
  import { getIconForProperty, isReadOnly } from "../../util";
17
9
  import { useSnackbarController, useStorageSource } from "../../hooks";
@@ -20,18 +12,17 @@ import { StorageFieldItem, useStorageUploadController } from "../../util/useStor
20
12
  import { StorageUploadProgress } from "../components/StorageUploadProgress";
21
13
  import { StorageItemPreview } from "../components/StorageItemPreview";
22
14
  import {
23
- cn,
15
+ cls,
24
16
  fieldBackgroundDisabledMixin,
25
17
  fieldBackgroundHoverMixin,
26
18
  fieldBackgroundMixin,
27
- focusedMixin,
28
19
  Typography
29
20
  } from "@firecms/ui";
30
21
  import { useClearRestoreValue } from "../useClearRestoreValue";
31
22
 
32
23
  const dropZoneClasses = "box-border relative pt-[2px] items-center border border-transparent min-h-[254px] outline-none rounded-md duration-200 ease-[cubic-bezier(0.4,0,0.2,1)] focus:border-primary-solid";
33
24
  const disabledClasses = "border-dotted-gray"
34
- const nonActiveDropClasses = "hover:bg-field-hover dark:hover:bg-field-hover-dark"
25
+ const nonActiveDropClasses = fieldBackgroundHoverMixin
35
26
  const activeDropClasses = "pt-0 border-2 border-solid"
36
27
  const acceptDropClasses = "transition-colors duration-200 ease-[cubic-bezier(0,0,0.2,1)] border-2 border-solid border-green-500"
37
28
  const rejectDropClasses = "transition-colors duration-200 ease-[cubic-bezier(0,0,0.2,1)] border-2 border-solid border-red-500"
@@ -52,7 +43,7 @@ export function StorageUploadFieldBinding({
52
43
  error,
53
44
  showError,
54
45
  autoFocus,
55
- tableMode,
46
+ minimalistView,
56
47
  property,
57
48
  includeDescription,
58
49
  context,
@@ -81,7 +72,7 @@ export function StorageUploadFieldBinding({
81
72
  propertyKey,
82
73
  value,
83
74
  storageSource,
84
- disabled,
75
+ disabled: disabled ?? false,
85
76
  onChange: setValue
86
77
  });
87
78
 
@@ -91,33 +82,27 @@ export function StorageUploadFieldBinding({
91
82
  setValue
92
83
  });
93
84
 
94
- const entity: Entity<any> = {
95
- id: context.entityId,
96
- values: context.values,
97
- path: context.path
98
- };
99
-
100
85
  return (
101
86
 
102
87
  <>
103
88
 
104
- {!tableMode &&
105
- <LabelWithIcon icon={getIconForProperty(property, "small")}
106
- required={property.validation?.required}
107
- title={property.name}
108
- className={"text-text-secondary dark:text-text-secondary-dark ml-3.5"}/>}
89
+ {!minimalistView &&
90
+ <LabelWithIconAndTooltip
91
+ propertyKey={propertyKey}
92
+ icon={getIconForProperty(property, "small")}
93
+ required={property.validation?.required}
94
+ title={property.name}
95
+ className={"text-text-secondary dark:text-text-secondary-dark ml-3.5"}/>}
109
96
 
110
97
  <StorageUpload
111
98
  value={internalValue}
112
- collection={context.collection}
113
99
  name={propertyKey}
114
- disabled={disabled}
115
- autoFocus={autoFocus}
100
+ disabled={disabled ?? false}
101
+ autoFocus={autoFocus ?? false}
116
102
  property={property}
117
103
  onChange={setValue}
118
104
  setInternalValue={setInternalValue}
119
105
  onFilesAdded={onFilesAdded}
120
- entity={entity}
121
106
  onFileUploadComplete={onFileUploadComplete}
122
107
  storagePathBuilder={storagePathBuilder}
123
108
  storage={storage}
@@ -135,7 +120,6 @@ export function StorageUploadFieldBinding({
135
120
 
136
121
  function FileDropComponent({
137
122
  storage,
138
- collection,
139
123
  disabled,
140
124
  isDraggingOver,
141
125
  onFilesAdded,
@@ -144,7 +128,6 @@ function FileDropComponent({
144
128
  autoFocus,
145
129
  internalValue,
146
130
  property,
147
- entity,
148
131
  onClear,
149
132
  metadata,
150
133
  storagePathBuilder,
@@ -154,7 +137,6 @@ function FileDropComponent({
154
137
  helpText
155
138
  }: {
156
139
  storage: StorageConfig,
157
- collection: EntityCollection,
158
140
  disabled: boolean,
159
141
  isDraggingOver: boolean,
160
142
  droppableProvided: any,
@@ -165,7 +147,6 @@ function FileDropComponent({
165
147
  property: ResolvedStringProperty,
166
148
  onClear: (clearedStoragePathOrDownloadUrl: string) => void,
167
149
  metadata: any,
168
- entity: Entity<any>;
169
150
  storagePathBuilder: (file: File) => string,
170
151
  onFileUploadComplete: (uploadedPath: string, entry: StorageFieldItem, fileMetadata?: any) => Promise<void>,
171
152
  size: PreviewSize,
@@ -190,10 +171,18 @@ function FileDropComponent({
190
171
  onDropRejected: (fileRejections, event) => {
191
172
  for (const fileRejection of fileRejections) {
192
173
  for (const error of fileRejection.errors) {
193
- snackbarContext.open({
194
- type: "error",
195
- message: `Error uploading file: File is larger than ${storage.maxSize} bytes`
196
- });
174
+ console.log("Error uploading file: ", error);
175
+ if (error.code === "file-too-large") {
176
+ snackbarContext.open({
177
+ type: "error",
178
+ message: `Error uploading file: File is larger than ${storage.maxSize} bytes`
179
+ });
180
+ } else if (error.code === "file-invalid-type") {
181
+ snackbarContext.open({
182
+ type: "error",
183
+ message: "Error uploading file: File type is not supported"
184
+ });
185
+ }
197
186
  }
198
187
  }
199
188
  }
@@ -203,12 +192,11 @@ function FileDropComponent({
203
192
  return (
204
193
  <div
205
194
  {...getRootProps()}
206
- className={cn(
195
+ className={cls(
207
196
  fieldBackgroundMixin,
208
197
  disabled ? fieldBackgroundDisabledMixin : fieldBackgroundHoverMixin,
209
198
  dropZoneClasses,
210
199
  multipleFilesSupported && internalValue.length ? "" : "flex",
211
- focusedMixin,
212
200
  {
213
201
  [nonActiveDropClasses]: !isDragActive,
214
202
  [activeDropClasses]: isDragActive,
@@ -220,7 +208,7 @@ function FileDropComponent({
220
208
  <div
221
209
  {...droppableProvided.droppableProps}
222
210
  ref={droppableProvided.innerRef}
223
- className={cn("flex items-center p-1 no-scrollbar",
211
+ className={cls("flex items-center p-1 no-scrollbar",
224
212
  multipleFilesSupported && internalValue.length ? "overflow-auto" : "",
225
213
  multipleFilesSupported && internalValue.length ? "min-h-[180px]" : "min-h-[250px]"
226
214
  )}
@@ -235,11 +223,9 @@ function FileDropComponent({
235
223
  if (entry.storagePathOrDownloadUrl) {
236
224
  child = (
237
225
  <StorageItemPreview
238
- collection={collection}
239
226
  name={`storage_preview_${entry.storagePathOrDownloadUrl}`}
240
227
  property={property}
241
228
  disabled={disabled}
242
- entity={entity}
243
229
  value={entry.storagePathOrDownloadUrl}
244
230
  onRemove={onClear}
245
231
  size={entry.size}/>
@@ -268,7 +254,7 @@ function FileDropComponent({
268
254
  ref={provided.innerRef}
269
255
  {...provided.draggableProps}
270
256
  {...provided.dragHandleProps}
271
- className={cn(focusedMixin, "rounded-md")}
257
+ className={cls("rounded-md")}
272
258
  style={{
273
259
  ...provided.draggableProps.style
274
260
  }}
@@ -299,7 +285,6 @@ function FileDropComponent({
299
285
 
300
286
  export interface StorageUploadProps {
301
287
  value: StorageFieldItem[];
302
- collection: EntityCollection;
303
288
  setInternalValue: (v: StorageFieldItem[]) => void;
304
289
  name: string;
305
290
  property: ResolvedStringProperty | ResolvedArrayProperty<string[]>;
@@ -307,7 +292,6 @@ export interface StorageUploadProps {
307
292
  multipleFilesSupported: boolean;
308
293
  autoFocus: boolean;
309
294
  disabled: boolean;
310
- entity: Entity<any>;
311
295
  storage: StorageConfig;
312
296
  onFilesAdded: (acceptedFiles: File[]) => void;
313
297
  storagePathBuilder: (file: File) => string;
@@ -315,7 +299,6 @@ export interface StorageUploadProps {
315
299
  }
316
300
 
317
301
  export function StorageUpload({
318
- collection,
319
302
  property,
320
303
  name,
321
304
  value,
@@ -327,7 +310,6 @@ export function StorageUpload({
327
310
  onFilesAdded,
328
311
  autoFocus,
329
312
  storage,
330
- entity,
331
313
  storagePathBuilder,
332
314
  }: StorageUploadProps) {
333
315
 
@@ -408,11 +390,10 @@ export function StorageUpload({
408
390
  className="rounded"
409
391
  >
410
392
  <StorageItemPreview
411
- collection={collection}
412
393
  name={`storage_preview_${entry.storagePathOrDownloadUrl}`}
394
+ placeholder={true}
413
395
  property={renderProperty}
414
396
  disabled={true}
415
- entity={entity}
416
397
  value={entry.storagePathOrDownloadUrl as string}
417
398
  onRemove={onClear}
418
399
  size={entry.size}/>
@@ -422,7 +403,6 @@ export function StorageUpload({
422
403
  >
423
404
  {(provided, snapshot) => {
424
405
  return <FileDropComponent storage={storage}
425
- collection={collection}
426
406
  disabled={disabled}
427
407
  isDraggingOver={snapshot.isDraggingOver}
428
408
  droppableProvided={provided}
@@ -431,7 +411,6 @@ export function StorageUpload({
431
411
  autoFocus={autoFocus}
432
412
  internalValue={value}
433
413
  property={renderProperty}
434
- entity={entity}
435
414
  onClear={onClear}
436
415
  metadata={metadata}
437
416
  storagePathBuilder={storagePathBuilder}
@@ -5,6 +5,7 @@ import { getIconForProperty } from "../../util";
5
5
  import { FieldHelperText, LabelWithIcon } from "../components";
6
6
  import { BooleanSwitchWithLabel } from "@firecms/ui";
7
7
  import { useClearRestoreValue } from "../useClearRestoreValue";
8
+ import { PropertyIdCopyTooltip } from "../../components";
8
9
 
9
10
  type SwitchFieldProps = FieldProps<boolean>;
10
11
 
@@ -23,7 +24,7 @@ export const SwitchFieldBinding = React.forwardRef(function SwitchFieldBinding({
23
24
  showError,
24
25
  autoFocus,
25
26
  disabled,
26
- touched,
27
+ size = "medium",
27
28
  property,
28
29
  includeDescription
29
30
  }: SwitchFieldProps, ref) {
@@ -37,17 +38,20 @@ export const SwitchFieldBinding = React.forwardRef(function SwitchFieldBinding({
37
38
  return (
38
39
  <>
39
40
 
41
+ <PropertyIdCopyTooltip propertyKey={propertyKey}>
40
42
  <BooleanSwitchWithLabel
41
43
  value={value}
42
44
  onValueChange={(v) => setValue(v)}
43
45
  error={showError}
44
- label={<LabelWithIcon icon={getIconForProperty(property, "small")}
45
- required={property.validation?.required}
46
- title={property.name}/>}
46
+ label={<LabelWithIcon
47
+ icon={getIconForProperty(property, "small")}
48
+ required={property.validation?.required}
49
+ title={property.name}/>}
47
50
  disabled={disabled}
48
51
  autoFocus={autoFocus}
49
- size={"medium"}
52
+ size={size}
50
53
  />
54
+ </PropertyIdCopyTooltip>
51
55
 
52
56
  <FieldHelperText includeDescription={includeDescription}
53
57
  showError={showError}
@@ -6,6 +6,7 @@ import { FieldHelperText, LabelWithIcon } from "../components";
6
6
  import { getIconForProperty } from "../../util";
7
7
  import { PropertyPreview } from "../../preview";
8
8
  import { useClearRestoreValue } from "../useClearRestoreValue";
9
+ import { PropertyIdCopyTooltip } from "../../components/PropertyIdCopyTooltip";
9
10
 
10
11
  interface TextFieldBindingProps<T extends string | number> extends FieldProps<T> {
11
12
  allowInfinity?: boolean
@@ -28,6 +29,7 @@ export function TextFieldBinding<T extends string | number>({
28
29
  autoFocus,
29
30
  property,
30
31
  includeDescription,
32
+ size = "medium"
31
33
  }: TextFieldBindingProps<T>) {
32
34
 
33
35
  let multiline: boolean | undefined;
@@ -67,27 +69,29 @@ export function TextFieldBinding<T extends string | number>({
67
69
  const isMultiline = Boolean(multiline);
68
70
 
69
71
  const inputType = property.dataType === "number" ? "number" : undefined;
70
- return (
71
- <>
72
- <TextField
73
- value={value}
74
- onChange={onChange}
75
- autoFocus={autoFocus}
76
- label={<LabelWithIcon icon={getIconForProperty(property, "small")}
77
- required={property.validation?.required}
78
- title={property.name}/>}
79
- type={inputType}
80
- multiline={isMultiline}
81
- disabled={disabled}
82
- endAdornment={
83
- property.clearable && <IconButton
84
- onClick={handleClearClick}>
85
- <ClearIcon/>
86
- </IconButton>
87
- }
88
- error={showError ? error : undefined}
89
- inputClassName={error ? "text-red-500 dark:text-red-600" : ""}/>
90
-
72
+ return (<>
73
+ <PropertyIdCopyTooltip propertyKey={propertyKey}>
74
+ <TextField
75
+ size={size}
76
+ value={value}
77
+ onChange={onChange}
78
+ autoFocus={autoFocus}
79
+ label={<LabelWithIcon
80
+ icon={getIconForProperty(property, "small")}
81
+ required={property.validation?.required}
82
+ title={property.name}/>}
83
+ type={inputType}
84
+ multiline={isMultiline}
85
+ disabled={disabled}
86
+ endAdornment={
87
+ property.clearable && <IconButton
88
+ onClick={handleClearClick}>
89
+ <ClearIcon/>
90
+ </IconButton>
91
+ }
92
+ error={showError ? error : undefined}
93
+ inputClassName={error ? "text-red-500 dark:text-red-600" : ""}/>
94
+ </PropertyIdCopyTooltip>
91
95
  <FieldHelperText includeDescription={includeDescription}
92
96
  showError={showError}
93
97
  error={error}
@@ -100,7 +104,7 @@ export function TextFieldBinding<T extends string | number>({
100
104
  <PropertyPreview
101
105
  value={value}
102
106
  property={property}
103
- size={"medium"}/>
107
+ size={size}/>
104
108
  </Collapse>}
105
109
 
106
110
  </>
@@ -11,7 +11,7 @@ import { KeyValueFieldBinding } from "./field_bindings/KeyValueFieldBinding";
11
11
  import { RepeatFieldBinding } from "./field_bindings/RepeatFieldBinding";
12
12
  import { BlockFieldBinding } from "./field_bindings/BlockFieldBinding";
13
13
  import { ReadOnlyFieldBinding } from "./field_bindings/ReadOnlyFieldBinding";
14
- import { MarkdownFieldBinding } from "./field_bindings/MarkdownFieldBinding";
14
+ import { MarkdownEditorFieldBinding } from "./field_bindings/MarkdownEditorFieldBinding";
15
15
  import { ArrayCustomShapedFieldBinding } from "./field_bindings/ArrayCustomShapedFieldBinding";
16
16
 
17
17
  export {
@@ -28,16 +28,16 @@ export {
28
28
  SelectFieldBinding,
29
29
  StorageUploadFieldBinding,
30
30
  SwitchFieldBinding,
31
- MarkdownFieldBinding,
31
+ MarkdownEditorFieldBinding,
32
32
  TextFieldBinding
33
33
  };
34
34
 
35
35
  export * from "./components";
36
36
 
37
- export type { EntityFormProps } from "./EntityForm";
38
- export {
39
- EntityForm
40
- } from "./EntityForm";
37
+ // export type { EntityFormProps } from "./EntityForm";
38
+ // export {
39
+ // EntityForm
40
+ // } from "./EntityForm";
41
41
 
42
42
  export { PropertyFieldBinding } from "./PropertyFieldBinding";
43
43
  export * from "./useClearRestoreValue";
@@ -112,23 +112,7 @@ export function getYupMapObjectSchema({
112
112
  if (validation?.required) {
113
113
  return shape.required(validation?.requiredMessage ? validation.requiredMessage : "Required").nullable(true);
114
114
  }
115
- return shape.nullable(true);
116
- // const object: ObjectSchema<any> = yup.object().shape(objectSchema);
117
- // return validation?.required
118
- // ? object.required(validation?.requiredMessage ? validation.requiredMessage : "Required").nullable(true)
119
- // : yup.object().optional().default(undefined).notRequired().nullable(true).test(
120
- // "empty-check",
121
- // "Optional map can be empty",
122
- // (o: any, testContext: any) => {
123
- // try {
124
- // if (!o || Object.keys(o).length === 0) return true;
125
- // return object.validateSync(o);
126
- // } catch (e) {
127
- // testContext.createError(e);
128
- // console.error(e);
129
- // return false;
130
- // }
131
- // });
115
+ return yup.object().shape(shape.fields).default(undefined).notRequired().nullable(true);
132
116
  }
133
117
 
134
118
  function getYupStringSchema({
@@ -17,7 +17,6 @@ import { resolveCollection } from "../../util";
17
17
  export type SaveEntityWithCallbacksProps<M extends Record<string, any>> =
18
18
  SaveEntityProps<M> &
19
19
  {
20
- callbacks?: EntityCallbacks<M>;
21
20
  onSaveSuccess?: (updatedEntity: Entity<M>) => void,
22
21
  onSaveFailure?: (e: Error) => void,
23
22
  onPreSaveHookError?: (e: Error) => void,
@@ -109,6 +108,11 @@ export async function saveEntityWithCallbacks<M extends Record<string, any>, Use
109
108
  updatedValues = values;
110
109
  }
111
110
 
111
+ console.log("Saving entity", {
112
+ entityId,
113
+ updatedValues,
114
+ collection
115
+ });
112
116
  return dataSource.saveEntity({
113
117
  collection,
114
118
  path: resolvedPath,
@@ -145,6 +149,7 @@ export async function saveEntityWithCallbacks<M extends Record<string, any>, Use
145
149
  onSaveSuccess(entity);
146
150
  })
147
151
  .catch((e) => {
152
+ console.error("!!!", e);
148
153
  if (callbacks?.onSaveFailure) {
149
154
 
150
155
  const resolvedCollection = resolveCollection<M>({
@@ -1,4 +1,4 @@
1
- import { useContext, useMemo } from "react";
1
+ import { useContext } from "react";
2
2
  import { DataSource, EntityCollection } from "../../types";
3
3
  import { DataSourceContext } from "../../contexts/DataSourceContext";
4
4
 
@@ -10,6 +10,7 @@ export * from "./useResolvedNavigationFrom";
10
10
 
11
11
  export * from "./useStorageSource";
12
12
  export * from "./useAuthController";
13
+ export * from "./useDialogsController";
13
14
  export * from "./useSideDialogsController";
14
15
  export * from "./useSideEntityController";
15
16
  export * from "./useFireCMSContext";
@@ -1,10 +1,10 @@
1
- import { useCallback, useEffect, useState } from "react";
1
+ import { useCallback, useEffect, useRef, useState } from "react";
2
2
  import { PartialEntityCollection, UserConfigurationPersistence } from "../types";
3
3
  import { mergeDeep, stripCollectionPath } from "../util";
4
4
 
5
5
  export function useBuildLocalConfigurationPersistence(): UserConfigurationPersistence {
6
6
 
7
- const [configCache, setConfigCache] = useState<Record<string, PartialEntityCollection>>({});
7
+ const configCache = useRef<Record<string, PartialEntityCollection>>({});
8
8
 
9
9
  const getCollectionFromStorage = useCallback((storageKey: string) => {
10
10
  const item = localStorage.getItem(storageKey);
@@ -13,20 +13,18 @@ export function useBuildLocalConfigurationPersistence(): UserConfigurationPersis
13
13
 
14
14
  const getCollectionConfig = useCallback(<M extends Record<string, any>>(path: string): PartialEntityCollection<M> => {
15
15
  const storageKey = `collection_config::${stripCollectionPath(path)}`;
16
- if (configCache[storageKey]) {
17
- return configCache[storageKey] as PartialEntityCollection<M>;
16
+ if (configCache.current[storageKey]) {
17
+ return configCache.current[storageKey] as PartialEntityCollection<M>;
18
18
  }
19
19
  return getCollectionFromStorage(storageKey);
20
- }, [configCache, getCollectionFromStorage]);
20
+ }, [getCollectionFromStorage]);
21
21
 
22
22
  const onCollectionModified = useCallback(<M extends Record<string, any>>(path: string, data: PartialEntityCollection<M>) => {
23
23
  const storageKey = `collection_config::${stripCollectionPath(path)}`;
24
24
  localStorage.setItem(storageKey, JSON.stringify(data));
25
- setConfigCache((currentCache) => {
26
- const cachedConfig = currentCache[storageKey];
27
- const newConfig = mergeDeep(cachedConfig ?? getCollectionFromStorage(path), data);
28
- return (mergeDeep(currentCache, newConfig));
29
- });
25
+ const cachedConfig = configCache.current[storageKey];
26
+ const newConfig = mergeDeep(cachedConfig ?? getCollectionFromStorage(path), data);
27
+ configCache.current[storageKey] = mergeDeep(configCache.current[storageKey], newConfig);
30
28
  }, [getCollectionFromStorage]);
31
29
 
32
30
  const [recentlyVisitedPaths, _setRecentlyVisitedPaths] = useState<string[]>([]);
@@ -8,8 +8,13 @@ import { ModeController } from "./index";
8
8
  */
9
9
  export function useBuildModeController(): ModeController {
10
10
 
11
- const prefersDarkModeQuery = typeof window !== "undefined" &&
12
- window.matchMedia("(prefers-color-scheme: dark)");
11
+ const prefersDarkModeQuery = useCallback((): boolean => {
12
+ if (typeof window === "undefined")
13
+ return false;
14
+ const mediaQueryList = window.matchMedia("(prefers-color-scheme: dark)");
15
+ return mediaQueryList.matches;
16
+ }, []);
17
+
13
18
  const prefersDarkModeStorage: boolean | null = localStorage.getItem("prefers-dark-mode") != null ? localStorage.getItem("prefers-dark-mode") === "true" : null;
14
19
  const prefersDarkMode = prefersDarkModeStorage ?? prefersDarkModeQuery;
15
20
  const [mode, setMode] = useState<"light" | "dark">(prefersDarkMode ? "dark" : "light");
@@ -23,7 +28,7 @@ export function useBuildModeController(): ModeController {
23
28
  const setDarkMode = useCallback(() => {
24
29
  setMode("dark");
25
30
  setDocumentMode("dark");
26
- }, [prefersDarkModeQuery]);
31
+ }, []);
27
32
 
28
33
  const setLightMode = useCallback(() => {
29
34
  setMode("light");
@@ -37,14 +42,15 @@ export function useBuildModeController(): ModeController {
37
42
 
38
43
  const toggleMode = useCallback(() => {
39
44
 
45
+ const prefersDarkModeQueryResult = prefersDarkModeQuery();
40
46
  if (mode === "light") {
41
- if (!prefersDarkModeQuery)
47
+ if (!prefersDarkModeQueryResult)
42
48
  localStorage.setItem("prefers-dark-mode", "true");
43
49
  else
44
50
  localStorage.removeItem("prefers-dark-mode");
45
51
  setDarkMode();
46
52
  } else {
47
- if (prefersDarkModeQuery)
53
+ if (prefersDarkModeQueryResult)
48
54
  localStorage.setItem("prefers-dark-mode", "false");
49
55
  else
50
56
  localStorage.removeItem("prefers-dark-mode");