@firecms/core 3.0.0-beta.10 → 3.0.0-beta.11

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 (166) hide show
  1. package/dist/components/ArrayContainer.d.ts +17 -5
  2. package/dist/components/EntityCollectionTable/EntityCollectionTable.d.ts +1 -1
  3. package/dist/components/EntityCollectionTable/EntityCollectionTableProps.d.ts +2 -2
  4. package/dist/components/EntityCollectionTable/internal/popup_field/PopupFormField.d.ts +6 -3
  5. package/dist/components/common/useDataSourceEntityCollectionTableController.d.ts +1 -1
  6. package/dist/core/EntityEditView.d.ts +1 -1
  7. package/dist/core/FireCMS.d.ts +1 -1
  8. package/dist/form/PropertyFieldBinding.d.ts +1 -1
  9. package/dist/form/components/index.d.ts +0 -1
  10. package/dist/form/field_bindings/MapFieldBinding.d.ts +1 -1
  11. package/dist/form/field_bindings/ReferenceFieldBinding.d.ts +2 -2
  12. package/dist/form/field_bindings/SwitchFieldBinding.d.ts +1 -2
  13. package/dist/hooks/data/delete.d.ts +4 -4
  14. package/dist/hooks/data/save.d.ts +3 -3
  15. package/dist/hooks/data/useCollectionFetch.d.ts +1 -1
  16. package/dist/hooks/data/useEntityFetch.d.ts +3 -3
  17. package/dist/hooks/useAuthController.d.ts +1 -1
  18. package/dist/hooks/useBuildNavigationController.d.ts +3 -3
  19. package/dist/hooks/useFireCMSContext.d.ts +1 -1
  20. package/dist/hooks/useResolvedNavigationFrom.d.ts +3 -3
  21. package/dist/hooks/useValidateAuthenticator.d.ts +3 -3
  22. package/dist/index.es.js +17515 -14786
  23. package/dist/index.es.js.map +1 -1
  24. package/dist/index.umd.js +17912 -15184
  25. package/dist/index.umd.js.map +1 -1
  26. package/dist/preview/PropertyPreviewProps.d.ts +1 -1
  27. package/dist/preview/components/EnumValuesChip.d.ts +1 -1
  28. package/dist/preview/util.d.ts +3 -3
  29. package/dist/types/auth.d.ts +7 -9
  30. package/dist/types/collections.d.ts +14 -13
  31. package/dist/types/datasource.d.ts +0 -4
  32. package/dist/types/entity_actions.d.ts +4 -4
  33. package/dist/types/entity_callbacks.d.ts +16 -16
  34. package/dist/types/export_import.d.ts +4 -4
  35. package/dist/types/fields.d.ts +18 -2
  36. package/dist/types/firecms.d.ts +2 -2
  37. package/dist/types/firecms_context.d.ts +1 -1
  38. package/dist/types/permissions.d.ts +4 -4
  39. package/dist/types/plugins.d.ts +8 -8
  40. package/dist/types/property_config.d.ts +0 -2
  41. package/dist/types/user.d.ts +1 -0
  42. package/dist/util/builders.d.ts +2 -2
  43. package/dist/util/entities.d.ts +1 -1
  44. package/dist/util/icon_synonyms.d.ts +0 -1
  45. package/dist/util/icons.d.ts +3 -1
  46. package/dist/util/objects.d.ts +1 -0
  47. package/dist/util/permissions.d.ts +4 -4
  48. package/dist/util/property_utils.d.ts +2 -2
  49. package/dist/util/resolutions.d.ts +6 -6
  50. package/package.json +131 -125
  51. package/src/app/Scaffold.tsx +4 -4
  52. package/src/components/ArrayContainer.tsx +79 -17
  53. package/src/components/CircularProgressCenter.tsx +1 -1
  54. package/src/components/ConfirmationDialog.tsx +2 -2
  55. package/src/components/DeleteEntityDialog.tsx +9 -18
  56. package/src/components/EntityCollectionTable/EntityCollectionRowActions.tsx +4 -1
  57. package/src/components/EntityCollectionTable/EntityCollectionTable.tsx +14 -14
  58. package/src/components/EntityCollectionTable/EntityCollectionTableProps.tsx +2 -2
  59. package/src/components/EntityCollectionTable/PropertyTableCell.tsx +6 -4
  60. package/src/components/EntityCollectionTable/fields/TableReferenceField.tsx +8 -9
  61. package/src/components/EntityCollectionTable/fields/TableStorageUpload.tsx +5 -11
  62. package/src/components/EntityCollectionTable/internal/CollectionTableToolbar.tsx +2 -2
  63. package/src/components/EntityCollectionTable/internal/EntityTableCell.tsx +5 -5
  64. package/src/components/EntityCollectionTable/internal/EntityTableCellActions.tsx +2 -2
  65. package/src/components/EntityCollectionTable/internal/popup_field/PopupFormField.tsx +79 -69
  66. package/src/components/EntityCollectionView/EntityCollectionView.tsx +9 -10
  67. package/src/components/EntityCollectionView/useSelectionController.tsx +5 -4
  68. package/src/components/EntityPreview.tsx +39 -30
  69. package/src/components/EntityView.tsx +5 -5
  70. package/src/components/ErrorView.tsx +3 -3
  71. package/src/components/HomePage/DefaultHomePage.tsx +1 -0
  72. package/src/components/HomePage/FavouritesView.tsx +6 -11
  73. package/src/components/HomePage/NavigationCard.tsx +1 -1
  74. package/src/components/HomePage/NavigationCardBinding.tsx +4 -9
  75. package/src/components/HomePage/NavigationGroup.tsx +1 -1
  76. package/src/components/PropertyConfigBadge.tsx +1 -1
  77. package/src/components/PropertyIdCopyTooltip.tsx +1 -1
  78. package/src/components/ReferenceTable/ReferenceSelectionTable.tsx +2 -2
  79. package/src/components/SelectableTable/SelectableTable.tsx +2 -2
  80. package/src/components/SelectableTable/filters/DateTimeFilterField.tsx +4 -2
  81. package/src/components/SelectableTable/filters/ReferenceFilterField.tsx +3 -1
  82. package/src/components/SelectableTable/filters/StringNumberFilterField.tsx +7 -5
  83. package/src/components/VirtualTable/VirtualTableHeader.tsx +8 -8
  84. package/src/components/VirtualTable/VirtualTableHeaderRow.tsx +1 -1
  85. package/src/components/VirtualTable/VirtualTableRow.tsx +1 -1
  86. package/src/components/VirtualTable/fields/VirtualTableDateField.tsx +1 -1
  87. package/src/components/VirtualTable/fields/VirtualTableSelect.tsx +2 -0
  88. package/src/components/common/useDataSourceEntityCollectionTableController.tsx +2 -2
  89. package/src/contexts/SnackbarProvider.tsx +2 -0
  90. package/src/core/DefaultAppBar.tsx +12 -11
  91. package/src/core/DefaultDrawer.tsx +11 -9
  92. package/src/core/DrawerNavigationItem.tsx +4 -4
  93. package/src/core/EntityEditView.tsx +50 -52
  94. package/src/core/FireCMS.tsx +5 -5
  95. package/src/core/SideDialogs.tsx +1 -1
  96. package/src/core/field_configs.tsx +4 -4
  97. package/src/form/PropertyFieldBinding.tsx +27 -20
  98. package/src/form/components/CustomIdField.tsx +2 -0
  99. package/src/form/components/StorageItemPreview.tsx +3 -3
  100. package/src/form/components/index.tsx +0 -1
  101. package/src/form/field_bindings/ArrayCustomShapedFieldBinding.tsx +3 -2
  102. package/src/form/field_bindings/ArrayOfReferencesFieldBinding.tsx +16 -10
  103. package/src/form/field_bindings/BlockFieldBinding.tsx +41 -23
  104. package/src/form/field_bindings/DateTimeFieldBinding.tsx +1 -1
  105. package/src/form/field_bindings/KeyValueFieldBinding.tsx +10 -7
  106. package/src/form/field_bindings/MapFieldBinding.tsx +58 -39
  107. package/src/form/field_bindings/ReferenceFieldBinding.tsx +4 -4
  108. package/src/form/field_bindings/RepeatFieldBinding.tsx +25 -20
  109. package/src/form/field_bindings/SelectFieldBinding.tsx +5 -4
  110. package/src/form/field_bindings/StorageUploadFieldBinding.tsx +1 -1
  111. package/src/form/field_bindings/SwitchFieldBinding.tsx +25 -25
  112. package/src/form/field_bindings/TextFieldBinding.tsx +3 -3
  113. package/src/hooks/data/delete.ts +4 -4
  114. package/src/hooks/data/save.ts +7 -8
  115. package/src/hooks/data/useCollectionFetch.tsx +2 -2
  116. package/src/hooks/data/useEntityFetch.tsx +5 -5
  117. package/src/hooks/useAuthController.tsx +1 -1
  118. package/src/hooks/useBuildNavigationController.tsx +5 -6
  119. package/src/hooks/useFireCMSContext.tsx +5 -5
  120. package/src/hooks/useResolvedNavigationFrom.tsx +5 -5
  121. package/src/hooks/useValidateAuthenticator.tsx +3 -3
  122. package/src/internal/useBuildDataSource.ts +1 -1
  123. package/src/internal/useUnsavedChangesDialog.tsx +2 -2
  124. package/src/preview/PropertyPreview.tsx +3 -3
  125. package/src/preview/PropertyPreviewProps.tsx +1 -1
  126. package/src/preview/components/BooleanPreview.tsx +1 -1
  127. package/src/preview/components/EmptyValue.tsx +1 -1
  128. package/src/preview/components/EnumValuesChip.tsx +1 -1
  129. package/src/preview/components/ImagePreview.tsx +5 -6
  130. package/src/preview/components/UrlComponentPreview.tsx +4 -4
  131. package/src/preview/property_previews/ArrayOfMapsPreview.tsx +1 -1
  132. package/src/preview/property_previews/ArrayOfReferencesPreview.tsx +2 -2
  133. package/src/preview/property_previews/ArrayOfStorageComponentsPreview.tsx +2 -2
  134. package/src/preview/property_previews/ArrayOfStringsPreview.tsx +1 -1
  135. package/src/preview/property_previews/ArrayOneOfPreview.tsx +2 -2
  136. package/src/preview/property_previews/ArrayPropertyPreview.tsx +2 -2
  137. package/src/preview/property_previews/MapPropertyPreview.tsx +4 -4
  138. package/src/preview/property_previews/SkeletonPropertyComponent.tsx +12 -12
  139. package/src/preview/property_previews/StringPropertyPreview.tsx +2 -2
  140. package/src/preview/util.ts +10 -10
  141. package/src/types/auth.tsx +8 -12
  142. package/src/types/collections.ts +14 -13
  143. package/src/types/datasource.ts +0 -5
  144. package/src/types/entity_actions.tsx +4 -4
  145. package/src/types/entity_callbacks.ts +18 -18
  146. package/src/types/export_import.ts +4 -4
  147. package/src/types/fields.tsx +20 -2
  148. package/src/types/firecms.tsx +2 -2
  149. package/src/types/firecms_context.tsx +1 -1
  150. package/src/types/permissions.ts +5 -5
  151. package/src/types/plugins.tsx +8 -8
  152. package/src/types/property_config.tsx +0 -2
  153. package/src/types/user.ts +2 -0
  154. package/src/util/builders.ts +6 -6
  155. package/src/util/entities.ts +3 -1
  156. package/src/util/icon_list.ts +1 -0
  157. package/src/util/icon_synonyms.ts +0 -1
  158. package/src/util/icons.tsx +12 -8
  159. package/src/util/objects.ts +20 -0
  160. package/src/util/permissions.ts +8 -8
  161. package/src/util/property_utils.tsx +10 -3
  162. package/src/util/references.ts +8 -2
  163. package/src/util/resolutions.ts +8 -8
  164. package/src/util/useStorageUploadController.tsx +1 -1
  165. package/dist/form/components/FormikArrayContainer.d.ts +0 -19
  166. package/src/form/components/FormikArrayContainer.tsx +0 -47
@@ -10,9 +10,10 @@ export function useSelectionController<M extends Record<string, any> = any>(
10
10
  const toggleEntitySelection = useCallback((entity: Entity<M>, newSelectedState?: boolean) => {
11
11
  let newValue;
12
12
  if (newSelectedState === undefined) {
13
- if (selectedEntities.map(e => e.id).includes(entity.id)) {
13
+ const isSelected = Boolean(selectedEntities.find(e => e.id === entity.id && e.path === entity.path));
14
+ if (isSelected) {
14
15
  onSelectionChange?.(entity, false);
15
- newValue = selectedEntities.filter((item: Entity<M>) => item.id !== entity.id);
16
+ newValue = selectedEntities.filter((item: Entity<M>) => !(item.id === entity.id && item.path === entity.path));
16
17
  } else {
17
18
  onSelectionChange?.(entity, true);
18
19
  newValue = [...selectedEntities, entity];
@@ -23,14 +24,14 @@ export function useSelectionController<M extends Record<string, any> = any>(
23
24
  newValue = [...selectedEntities, entity];
24
25
  } else {
25
26
  onSelectionChange?.(entity, false);
26
- newValue = selectedEntities.filter((item: Entity<M>) => item.id !== entity.id);
27
+ newValue = selectedEntities.filter((item: Entity<M>) => !(item.id === entity.id && item.path === entity.path));
27
28
  }
28
29
  }
29
30
  setSelectedEntities(newValue);
30
31
  }, [selectedEntities]);
31
32
 
32
33
  const isEntitySelected = useCallback((entity: Entity<M>) => {
33
- return selectedEntities.map(e => e.id).includes(entity.id);
34
+ return Boolean(selectedEntities.find(e => e.id === entity.id && e.path === entity.path));
34
35
  }, [selectedEntities]);
35
36
 
36
37
  return {
@@ -62,39 +62,47 @@ export function EntityPreview({
62
62
  collection,
63
63
  path: entity.path,
64
64
  values: entity.values,
65
- fields: customizationController.propertyConfigs
65
+ propertyConfigs: customizationController.propertyConfigs
66
66
  }), [collection]);
67
67
 
68
- const listProperties = useMemo(() => getEntityPreviewKeys(resolvedCollection, customizationController.propertyConfigs, previewProperties, size === "small" || size === "medium" ? 3 : 1),
68
+ const listProperties = useMemo(() => getEntityPreviewKeys(resolvedCollection, customizationController.propertyConfigs, previewProperties, size === "medium" || size === "large" ? 3 : 1),
69
69
  [previewProperties, resolvedCollection, size]);
70
70
 
71
71
  const titleProperty = getEntityTitlePropertyKey(resolvedCollection, customizationController.propertyConfigs);
72
72
  const imagePropertyKey = getEntityImagePreviewPropertyKey(resolvedCollection);
73
73
  const imageProperty = imagePropertyKey ? resolvedCollection.properties[imagePropertyKey] : undefined;
74
-
74
+ const usedImageProperty = imageProperty && "of" in imageProperty ? imageProperty.of : imageProperty;
75
75
  const restProperties = listProperties.filter(p => p !== titleProperty && p !== imagePropertyKey);
76
76
 
77
+ const imageValue = imagePropertyKey ? getValueInPath(entity.values, imagePropertyKey) : undefined;
78
+ const usedImageValue = imageProperty !== undefined ? ("of" in imageProperty
79
+ ? ((imageValue ?? []).length > 0
80
+ ? imageValue[0] : undefined)
81
+ : imageValue)
82
+ : undefined;
83
+
77
84
  return <EntityPreviewContainer onClick={disabled ? undefined : onClick}
78
85
  hover={disabled ? undefined : hover}
79
86
  size={size}>
80
- <div className={cls("flex w-10 h-10 mr-2 shrink-0", size === "smallest" ? "my-0.5" : "m-2 self-start")}>
81
- {imageProperty && <PropertyPreview property={imageProperty}
82
- propertyKey={imagePropertyKey as string}
83
- size={"smallest"}
84
- value={getValueInPath(entity.values, imagePropertyKey as string)}/>}
85
- {!imageProperty && <IconForView collectionOrView={collection} size={size} className={"m-auto"}/>}
87
+ <div className={cls("flex w-10 h-10 ml-1 mr-2 shrink-0", size === "small" ? "my-0.5" : "m-2 self-start")}>
88
+ {usedImageProperty && usedImageValue && <PropertyPreview property={usedImageProperty}
89
+ propertyKey={imagePropertyKey as string}
90
+ size={"small"}
91
+ value={usedImageValue}/>}
92
+ {(!usedImageProperty || !usedImageValue) && <IconForView collectionOrView={collection}
93
+ color={"primary"}
94
+ size={size}
95
+ className={"m-auto p-1"}/>}
86
96
  </div>
87
97
 
88
98
 
89
- <div className={"flex flex-col grow-1 w-full max-w-full m-1"}>
99
+ <div className={"flex flex-col grow-1 w-full m-1 shrink-1"} style={{
100
+ "maxWidth": "calc(100% - 96px)"
101
+ }}>
90
102
 
91
- {size !== "smallest" && includeId && (
103
+ {size !== "small" && includeId && (
92
104
  entity
93
- ? <div className={`${
94
- size !== "medium"
95
- ? "block whitespace-nowrap overflow-hidden truncate"
96
- : ""
97
- }`}>
105
+ ? <div className={"block whitespace-nowrap overflow-hidden truncate"}>
98
106
  <Typography variant={"caption"}
99
107
  color={"disabled"}
100
108
  className={"font-mono"}>
@@ -104,17 +112,17 @@ export function EntityPreview({
104
112
  : <Skeleton/>)}
105
113
 
106
114
  {titleProperty && (
107
- <div className={"my-0.5 text-sm font-medium"}>
115
+ <div className={"truncate my-0.5 text-sm font-medium"}>
108
116
  {
109
117
  entity
110
118
  ? <PropertyPreview
111
119
  propertyKey={titleProperty as string}
112
120
  value={getValueInPath(entity.values, titleProperty)}
113
121
  property={resolvedCollection.properties[titleProperty as string] as ResolvedProperty}
114
- size={"medium"}/>
122
+ size={"large"}/>
115
123
  : <SkeletonPropertyComponent
116
124
  property={resolvedCollection.properties[titleProperty as string] as ResolvedProperty}
117
- size={"medium"}/>
125
+ size={"large"}/>
118
126
  }
119
127
  </div>
120
128
  )}
@@ -125,17 +133,17 @@ export function EntityPreview({
125
133
 
126
134
  return (
127
135
  <div key={"ref_prev_" + key}
128
- className={restProperties.length > 1 ? "my-0.5" : "my-0"}>
136
+ className={cls("truncate", restProperties.length > 1 ? "my-0.5" : "my-0")}>
129
137
  {
130
138
  entity
131
139
  ? <PropertyPreview
132
140
  propertyKey={key as string}
133
141
  value={getValueInPath(entity.values, key)}
134
142
  property={childProperty as ResolvedProperty}
135
- size={"smallest"}/>
143
+ size={"small"}/>
136
144
  : <SkeletonPropertyComponent
137
145
  property={childProperty as ResolvedProperty}
138
- size={"smallest"}/>
146
+ size={"small"}/>
139
147
  }
140
148
  </div>
141
149
  );
@@ -144,11 +152,11 @@ export function EntityPreview({
144
152
  </div>
145
153
 
146
154
  {entity && includeEntityLink &&
147
- <Tooltip title={`See details for ${entity.id}`}>
155
+ <Tooltip title={`See details for ${entity.id}`} className={"shrink-0"}>
148
156
  <IconButton
149
157
  color={"inherit"}
150
- size={"small"}
151
- className={size !== "smallest" ? "self-start" : ""}
158
+ size={"medium"}
159
+ className={size !== "small" ? "self-start" : ""}
152
160
  onClick={(e) => {
153
161
  e.stopPropagation();
154
162
  analyticsController.onAnalyticsEvent?.("entity_click_from_reference", {
@@ -162,7 +170,7 @@ export function EntityPreview({
162
170
  updateUrl: true
163
171
  });
164
172
  }}>
165
- <KeyboardTabIcon size={"small"}/>
173
+ <KeyboardTabIcon size={"medium"}/>
166
174
  </IconButton>
167
175
  </Tooltip>}
168
176
 
@@ -181,7 +189,6 @@ export type EntityPreviewContainerProps = {
181
189
  onClick?: (e: React.SyntheticEvent) => void;
182
190
  };
183
191
 
184
-
185
192
  export const EntityPreviewContainer = React.forwardRef<HTMLDivElement, EntityPreviewContainerProps>(({
186
193
  children,
187
194
  hover,
@@ -200,12 +207,12 @@ export const EntityPreviewContainer = React.forwardRef<HTMLDivElement, EntityPre
200
207
  tabindex: 0
201
208
  }}
202
209
  className={cls(
203
- "bg-white dark:bg-gray-900",
210
+ "bg-white dark:bg-surface-900",
204
211
  "min-h-[42px]",
205
212
  fullwidth ? "w-full" : "",
206
213
  "items-center",
207
- hover ? "hover:bg-slate-50 dark:hover:bg-gray-800 group-hover:bg-slate-50 dark:group-hover:bg-gray-800" : "",
208
- size === "smallest" ? "p-1" : "px-2 py-1",
214
+ hover ? "hover:bg-surface-accent-50 dark:hover:bg-surface-800 group-hover:bg-surface-accent-50 dark:group-hover:bg-surface-800" : "",
215
+ size === "small" ? "p-1" : "px-2 py-1",
209
216
  "flex border rounded-lg",
210
217
  onClick ? "cursor-pointer" : "",
211
218
  defaultBorderMixin,
@@ -220,3 +227,5 @@ export const EntityPreviewContainer = React.forwardRef<HTMLDivElement, EntityPre
220
227
  {children}
221
228
  </div>;
222
229
  });
230
+
231
+ EntityPreviewContainer.displayName = "EntityPreviewContainer";
@@ -30,7 +30,7 @@ export function EntityView<M extends Record<string, any>>(
30
30
  path,
31
31
  entityId: entity.id,
32
32
  values: entity.values,
33
- fields: customizationController.propertyConfigs
33
+ propertyConfigs: customizationController.propertyConfigs
34
34
  }), [collection, path, entity, customizationController.propertyConfigs]);
35
35
 
36
36
  const properties: ResolvedProperties = resolvedCollection.properties;
@@ -40,10 +40,10 @@ export function EntityView<M extends Record<string, any>>(
40
40
  <div className={"w-full mb-4"}>
41
41
  <div className={cls(defaultBorderMixin, "flex justify-between py-2 border-b last:border-b-0")}>
42
42
  <div className="flex items-center w-1/4">
43
- <span className="pl-2 text-sm text-gray-600">Id</span>
43
+ <span className="pl-2 text-sm text-surface-600">Id</span>
44
44
  </div>
45
45
  <div
46
- className="flex-grow p-2 ml-2 w-3/4 text-gray-900 dark:text-white min-h-[56px] flex items-center">
46
+ className="flex-grow p-2 ml-2 w-3/4 text-surface-900 dark:text-white min-h-[56px] flex items-center">
47
47
  <span className="flex-grow mr-2">{entity.id}</span>
48
48
  {customizationController?.entityLinkBuilder &&
49
49
  <a href={customizationController.entityLinkBuilder({ entity })}
@@ -64,10 +64,10 @@ export function EntityView<M extends Record<string, any>>(
64
64
  key={`reference_previews_${key}`}
65
65
  className={cls(defaultBorderMixin, "flex justify-between py-2 border-b last:border-b-0")}>
66
66
  <div className="flex items-center w-1/4">
67
- <span className="pl-2 text-sm text-gray-600">{property.name}</span>
67
+ <span className="pl-2 text-sm text-surface-600">{property.name}</span>
68
68
  </div>
69
69
  <div
70
- className="flex-grow p-2 ml-2 w-3/4 text-gray-900 dark:text-white min-h-[56px] flex items-center">
70
+ className="flex-grow p-2 ml-2 w-3/4 text-surface-900 dark:text-white min-h-[56px] flex items-center">
71
71
  <PropertyPreview
72
72
  propertyKey={key}
73
73
  value={value}
@@ -26,13 +26,13 @@ export function ErrorView({
26
26
  tooltip
27
27
  }: ErrorViewProps): React.ReactElement {
28
28
  const component = error instanceof Error ? error.message : error;
29
- console.error("ErrorView", error)
29
+ console.warn("ErrorView", error)
30
30
 
31
31
  const body = (
32
32
  <div
33
33
  className="flex items-center m-2">
34
- <ErrorIcon size={"small"} color={"error"}/>
35
- <div className="pl-2">
34
+ <ErrorIcon className={"mx-2"} size={"small"} color={"error"}/>
35
+ <div className="pl-4">
36
36
  {title && <Typography
37
37
  variant={"body2"}
38
38
  className="font-medium">{title}</Typography>}
@@ -140,6 +140,7 @@ export function DefaultHomePage({
140
140
  <SearchBar onTextSearch={updateSearchResults}
141
141
  placeholder={"Search collections"}
142
142
  large={false}
143
+ autoFocus={true}
143
144
  innerClassName={"w-full"}
144
145
  className={"w-full flex-grow"}/>
145
146
  {additionalActions}
@@ -2,7 +2,7 @@ import { useNavigate } from "react-router-dom";
2
2
  import { useNavigationController } from "../../hooks";
3
3
  import { useUserConfigurationPersistence } from "../../hooks/useUserConfigurationPersistence";
4
4
  import { TopNavigationEntry } from "../../types";
5
- import { Chip, Collapse, StarBorderIcon, StarIcon } from "@firecms/ui";
5
+ import { Chip, Collapse, StarIcon } from "@firecms/ui";
6
6
 
7
7
  function NavigationChip({ entry }: { entry: TopNavigationEntry }) {
8
8
 
@@ -29,16 +29,11 @@ function NavigationChip({ entry }: { entry: TopNavigationEntry }) {
29
29
  return <Chip
30
30
  key={entry.path}
31
31
  onClick={() => navigate(entry.url)}
32
- icon={
33
- favourite
34
- ? <StarIcon
35
- onClick={onIconClick}
36
- size={18}
37
- className={"text-secondary"}/>
38
- : <StarBorderIcon
39
- onClick={onIconClick}
40
- size={18}
41
- className={"text-gray-400 dark:text-gray-500"}/>}>
32
+ icon={<StarIcon
33
+ onClick={onIconClick}
34
+ size={18}
35
+ className={favourite ? "text-secondary" : "text-surface-400 dark:text-surface-500"}/>
36
+ }>
42
37
  {entry.name}
43
38
  </Chip>;
44
39
  }
@@ -27,7 +27,7 @@ export function NavigationCard({
27
27
  className="flex-grow w-full">
28
28
 
29
29
  <div
30
- className="h-10 flex items-center w-full justify-between text-gray-300 dark:text-gray-600">
30
+ className="h-10 flex items-center w-full justify-between text-surface-300 dark:text-surface-600">
31
31
 
32
32
  {icon}
33
33
 
@@ -4,7 +4,7 @@ import { useCustomizationController, useFireCMSContext } from "../../hooks";
4
4
  import { PluginHomePageActionsProps, TopNavigationEntry } from "../../types";
5
5
  import { IconForView } from "../../util";
6
6
  import { useUserConfigurationPersistence } from "../../hooks/useUserConfigurationPersistence";
7
- import { IconButton, StarBorderIcon, StarIcon } from "@firecms/ui";
7
+ import { IconButton, StarIcon } from "@firecms/ui";
8
8
  import { NavigationCard } from "./NavigationCard";
9
9
  import { SmallNavigationCard } from "./SmallNavigationCard";
10
10
 
@@ -60,14 +60,9 @@ export function NavigationCardBinding({
60
60
  );
61
61
  }
62
62
  }}>
63
- {
64
- favourite
65
- ? <StarIcon
66
- size={18}
67
- className={"text-secondary"}/>
68
- : <StarBorderIcon
69
- size={18}
70
- className={"text-gray-400 dark:text-gray-500"}/>}
63
+ <StarIcon
64
+ size={18}
65
+ className={favourite ? "text-secondary" : "text-surface-400 dark:text-surface-500"}/>
71
66
  </IconButton>
72
67
  ]
73
68
  : [];
@@ -12,7 +12,7 @@ export function NavigationGroup({
12
12
  return (
13
13
  <ExpandablePanel
14
14
  invisible={true}
15
- titleClassName={"font-medium text-sm text-gray-600 dark:text-gray-400"}
15
+ titleClassName={"font-medium text-sm text-surface-600 dark:text-surface-400"}
16
16
  innerClassName={"py-4"}
17
17
  initiallyExpanded={!(userConfigurationPersistence?.collapsedGroups ?? []).includes(group ?? "ungrouped")}
18
18
  onExpandedChange={expanded => {
@@ -9,7 +9,7 @@ export function PropertyConfigBadge({
9
9
  propertyConfig: PropertyConfig | undefined,
10
10
  disabled?: boolean
11
11
  }): React.ReactNode {
12
- const classes = "h-8 w-8 p-1 rounded-full shadow text-white " + (disabled ? "bg-gray-400 dark:bg-gray-600" : "");
12
+ const classes = "h-8 w-8 p-1 rounded-full shadow text-white " + (disabled ? "bg-surface-400 dark:bg-surface-600" : "");
13
13
 
14
14
  const defaultPropertyConfig = typeof propertyConfig?.property === "object" ? getDefaultFieldConfig(propertyConfig.property) : undefined;
15
15
 
@@ -29,7 +29,7 @@ export function PropertyIdCopyTooltipContent({ propertyKey }: { propertyKey: str
29
29
  return (
30
30
  <div className={"flex flex-row gap-2 items-center justify-center text-white"}>
31
31
  <div>
32
- <Typography variant={"caption"} className={"min-w-20 text-slate-400"}
32
+ <Typography variant={"caption"} className={"min-w-20 text-surface-accent-400"}
33
33
  color={"disabled"}>{copied ? "Copied" : "Property ID"}</Typography>
34
34
  <Typography variant={"caption"} className={"text-white"}><code>{propertyKey}</code></Typography>
35
35
  </div>
@@ -251,7 +251,7 @@ export function ReferenceSelectionTable<M extends Record<string, any>>(
251
251
  collection: collection,
252
252
  path: fullPath,
253
253
  values: {},
254
- fields: customizationController.propertyConfigs
254
+ propertyConfigs: customizationController.propertyConfigs
255
255
  }), [collection, customizationController.propertyConfigs, fullPath]);
256
256
 
257
257
  const displayedColumnIds = useColumnIds(resolvedCollection, false);
@@ -293,7 +293,7 @@ export function ReferenceSelectionTable<M extends Record<string, any>>(
293
293
  <IconForView
294
294
  size={"small"}
295
295
  collectionOrView={collection}
296
- className={"text-gray-300 dark:text-gray-600"}/>
296
+ className={"text-surface-300 dark:text-surface-600"}/>
297
297
  {collection.singularName ? `Select ${collection.singularName}` : `Select from ${collection.name}`}
298
298
  </Typography>}
299
299
  defaultSize={collection.defaultSize}
@@ -210,7 +210,7 @@ export const SelectableTable = React.memo<SelectableTableProps<any>>(
210
210
  selectedCell,
211
211
  }}
212
212
  >
213
- <div className="h-full w-full flex flex-col bg-white dark:bg-gray-950"
213
+ <div className="h-full w-full flex flex-col bg-white dark:bg-surface-950"
214
214
  ref={ref}>
215
215
 
216
216
  <VirtualTable
@@ -232,7 +232,7 @@ export const SelectableTable = React.memo<SelectableTableProps<any>>(
232
232
  checkFilterCombination={checkFilterCombination}
233
233
  createFilterField={filterable ? createFilterField : undefined}
234
234
  rowClassName={useCallback((entity: Entity<M>) => {
235
- return highlightedRow?.(entity) ? "bg-gray-100 bg-opacity-75 dark:bg-gray-800 dark:bg-opacity-75" : "";
235
+ return highlightedRow?.(entity) ? "bg-surface-100 bg-opacity-75 dark:bg-surface-800 dark:bg-opacity-75" : "";
236
236
  }, [highlightedRow])}
237
237
  className="flex-grow"
238
238
  emptyComponent={emptyComponent}
@@ -76,6 +76,8 @@ export function DateTimeFilterField({
76
76
  <div className="flex w-[440px]">
77
77
  <div className="w-[80px]">
78
78
  <Select value={operation}
79
+ size={"large"}
80
+ fullWidth={true}
79
81
  onValueChange={(value) => {
80
82
  updateFilter(value as VirtualTableWhereFilterOp, internalValue);
81
83
  }}
@@ -92,7 +94,7 @@ export function DateTimeFilterField({
92
94
 
93
95
  <DateTimeField
94
96
  mode={mode}
95
- size={"medium"}
97
+ size={"large"}
96
98
  locale={locale}
97
99
  value={internalValue ?? undefined}
98
100
  onChange={(dateValue: Date | null) => {
@@ -102,7 +104,7 @@ export function DateTimeFilterField({
102
104
  />
103
105
 
104
106
  <Label
105
- className="border cursor-pointer rounded-md p-2 flex items-center gap-2 [&:has(:checked)]:bg-gray-100 dark:[&:has(:checked)]:bg-gray-800"
107
+ className="border cursor-pointer rounded-md p-2 flex items-center gap-2 [&:has(:checked)]:bg-surface-100 dark:[&:has(:checked)]:bg-surface-800"
106
108
  htmlFor="null-filter"
107
109
  >
108
110
  <Checkbox id="null-filter"
@@ -147,6 +147,8 @@ export function ReferenceFilterField({
147
147
  <div className="flex w-[440px] flex-row">
148
148
  <div className="w-[140px]">
149
149
  <Select value={operation}
150
+ size={"large"}
151
+ fullWidth={true}
150
152
  onValueChange={(value) => {
151
153
  updateFilter(value as VirtualTableWhereFilterOp, internalValue);
152
154
  }}
@@ -179,7 +181,7 @@ export function ReferenceFilterField({
179
181
  }
180
182
 
181
183
  {!isArray && <Label
182
- className="border cursor-pointer rounded-md p-2 flex items-center gap-2 [&:has(:checked)]:bg-gray-100 dark:[&:has(:checked)]:bg-gray-800"
184
+ className="border cursor-pointer rounded-md p-2 flex items-center gap-2 [&:has(:checked)]:bg-surface-100 dark:[&:has(:checked)]:bg-surface-800"
183
185
  htmlFor="null-filter"
184
186
  >
185
187
  <Checkbox id="null-filter"
@@ -3,7 +3,7 @@ import { EnumValuesChip } from "../../../preview";
3
3
  import { VirtualTableWhereFilterOp } from "../../VirtualTable";
4
4
  import {
5
5
  Checkbox,
6
- ClearIcon,
6
+ CloseIcon,
7
7
  IconButton,
8
8
  Label,
9
9
  MultiSelect,
@@ -98,6 +98,7 @@ export function StringNumberFilterField({
98
98
  <div className="flex w-[440px]">
99
99
  <div className={"w-[80px]"}>
100
100
  <Select value={operation}
101
+ fullWidth={true}
101
102
  position={"item-aligned"}
102
103
  onValueChange={(value) => {
103
104
  updateFilter(value as VirtualTableWhereFilterOp, internalValue);
@@ -124,13 +125,14 @@ export function StringNumberFilterField({
124
125
  }}
125
126
  endAdornment={internalValue && <IconButton
126
127
  onClick={(e) => updateFilter(operation, undefined)}>
127
- <ClearIcon/>
128
+ <CloseIcon/>
128
129
  </IconButton>}
129
130
  />}
130
131
 
131
132
  {enumValues && !multiple &&
132
133
  <Select
133
134
  position={"item-aligned"}
135
+ fullWidth={true}
134
136
  value={typeof internalValue === "string" ? internalValue : ""}
135
137
  onValueChange={(value) => {
136
138
  if (value !== "")
@@ -139,7 +141,7 @@ export function StringNumberFilterField({
139
141
  endAdornment={internalValue && <IconButton
140
142
  className="absolute right-2 top-3"
141
143
  onClick={(e) => updateFilter(operation, undefined)}>
142
- <ClearIcon/>
144
+ <CloseIcon/>
143
145
  </IconButton>}
144
146
  renderValue={(enumKey) => {
145
147
  if (enumKey === null)
@@ -176,7 +178,7 @@ export function StringNumberFilterField({
176
178
  endAdornment={internalValue && <IconButton
177
179
  className="absolute right-2 top-3"
178
180
  onClick={(e) => updateFilter(operation, undefined)}>
179
- <ClearIcon/>
181
+ <CloseIcon/>
180
182
  </IconButton>}
181
183
  // renderValues={(enumKeys) => {
182
184
  // console.log("renderValues", enumKeys);
@@ -203,7 +205,7 @@ export function StringNumberFilterField({
203
205
  }
204
206
 
205
207
  {!isArray && <Label
206
- className="border cursor-pointer rounded-md p-2 flex items-center gap-2 [&:has(:checked)]:bg-gray-100 dark:[&:has(:checked)]:bg-gray-800"
208
+ className="border cursor-pointer rounded-md p-2 flex items-center gap-2 [&:has(:checked)]:bg-surface-100 dark:[&:has(:checked)]:bg-surface-800"
207
209
  htmlFor="null-filter"
208
210
  >
209
211
  <Checkbox id="null-filter"
@@ -85,9 +85,9 @@ export const VirtualTableHeader = React.memo<VirtualTableHeaderProps<any>>(
85
85
  return (
86
86
  <ErrorBoundary>
87
87
  <div
88
- className={cls("flex py-0 px-3 h-full text-xs uppercase font-semibold relative select-none items-center bg-gray-50 dark:bg-gray-900",
89
- "text-gray-600 hover:text-gray-800 dark:text-gray-400 dark:hover:text-gray-200 ",
90
- "hover:bg-gray-100 dark:hover:bg-gray-800 hover:bg-opacity-50 dark:hover:bg-opacity-50",
88
+ className={cls("flex py-0 px-3 h-full text-xs uppercase font-semibold relative select-none items-center bg-surface-50 dark:bg-surface-900",
89
+ "text-text-secondary hover:text-text-primary dark:text-text-secondary-dark dark:hover:text-text-primary-dark",
90
+ "hover:bg-surface-100 dark:hover:bg-surface-800 hover:bg-opacity-50 dark:hover:bg-opacity-50",
91
91
  column.frozen ? "sticky left-0 z-10" : "relative z-0"
92
92
  )}
93
93
  style={{
@@ -130,7 +130,7 @@ export const VirtualTableHeader = React.memo<VirtualTableHeaderProps<any>>(
130
130
  invisible={!sort}>
131
131
  <IconButton
132
132
  size={"small"}
133
- className={onHover || openFilter ? "bg-white dark:bg-gray-950" : undefined}
133
+ className={onHover || openFilter ? "bg-white dark:bg-surface-950" : undefined}
134
134
  onClick={() => {
135
135
  onColumnSort(column.key as Extract<keyof M, string>);
136
136
  }}
@@ -157,7 +157,7 @@ export const VirtualTableHeader = React.memo<VirtualTableHeaderProps<any>>(
157
157
  modal={true}
158
158
  trigger={
159
159
  <IconButton
160
- className={onHover || openFilter ? "bg-white dark:bg-gray-950" : undefined}
160
+ className={onHover || openFilter ? "bg-white dark:bg-surface-950" : undefined}
161
161
  size={"small"}
162
162
  onClick={handleSettingsClick}>
163
163
  <FilterListIcon size={"small"}/>
@@ -181,7 +181,7 @@ export const VirtualTableHeader = React.memo<VirtualTableHeaderProps<any>>(
181
181
  ref={resizeHandleRef}
182
182
  className={cls(
183
183
  "absolute h-full w-[6px] top-0 right-0 cursor-col-resize",
184
- hovered && "bg-gray-300 dark:bg-gray-700"
184
+ hovered && "bg-surface-300 dark:bg-surface-700"
185
185
  )}
186
186
  onMouseDown={onClickResizeColumn ? () => onClickResizeColumn(columnIndex, column) : undefined}
187
187
  />}
@@ -238,9 +238,9 @@ function FilterForm<M>({
238
238
  e.preventDefault();
239
239
  submit();
240
240
  }}
241
- className={"text-gray-900 dark:text-white"}>
241
+ className={"text-surface-900 dark:text-white"}>
242
242
  <div
243
- className={cls(defaultBorderMixin, "py-4 px-6 text-xs font-semibold uppercase border-b")}>
243
+ className={cls(defaultBorderMixin, "py-4 px-6 typography-label border-b")}>
244
244
  {column.title ?? id}
245
245
  </div>
246
246
  {filterField && <div className="m-4">
@@ -100,7 +100,7 @@ export const VirtualTableHeaderRow = ({
100
100
 
101
101
  return (
102
102
  <div
103
- className={cls(defaultBorderMixin, "z-20 sticky min-w-full flex w-fit flex-row top-0 left-0 h-12 border-b bg-gray-50 dark:bg-gray-900")}>
103
+ className={cls(defaultBorderMixin, "z-20 sticky min-w-full flex w-fit flex-row top-0 left-0 h-12 border-b bg-surface-50 dark:bg-surface-900")}>
104
104
  {columns.map((c, columnIndex) => {
105
105
  const column = columns[columnIndex];
106
106
 
@@ -29,7 +29,7 @@ export const VirtualTableRow = React.memo<VirtualTableRowProps<any>>(
29
29
  return (
30
30
  <div
31
31
  className={cls(
32
- "flex min-w-full text-sm border-b border-gray-200 dark:border-gray-800 border-opacity-40 dark:border-opacity-40",
32
+ "flex min-w-full text-sm border-b border-surface-200 dark:border-surface-800 border-opacity-40 dark:border-opacity-40",
33
33
  rowClassName ? rowClassName(rowData) : "",
34
34
  {
35
35
  "hover:bg-opacity-95": hoverRow,
@@ -26,7 +26,7 @@ export function VirtualTableDateField(props: {
26
26
  <DateTimeField
27
27
  value={internalValue ?? undefined}
28
28
  onChange={(dateValue) => updateValue(dateValue ?? null)}
29
- size={"medium"}
29
+ size={"large"}
30
30
  invisible={true}
31
31
  inputClassName={cls("w-full h-full", focusedDisabled)}
32
32
  className={cls("w-full h-full", focusedDisabled)}
@@ -91,6 +91,8 @@ export function VirtualTableSelect(props: {
91
91
  </MultiSelect>
92
92
  : <Select
93
93
  inputRef={ref}
94
+ size={"large"}
95
+ fullWidth={true}
94
96
  className="w-full h-full p-0 bg-transparent"
95
97
  position={"item-aligned"}
96
98
  disabled={disabled}
@@ -52,7 +52,7 @@ export type DataSourceEntityCollectionTableControllerProps<M extends Record<stri
52
52
  * @param lastDeleteTimestamp
53
53
  * @param forceFilterFromProps
54
54
  */
55
- export function useDataSourceEntityCollectionTableController<M extends Record<string, any> = any, UserType extends User = User>(
55
+ export function useDataSourceEntityCollectionTableController<M extends Record<string, any> = any, USER extends User = User>(
56
56
  {
57
57
  fullPath,
58
58
  collection,
@@ -112,7 +112,7 @@ export function useDataSourceEntityCollectionTableController<M extends Record<st
112
112
  const sortByProperty = sortBy ? sortBy[0] : undefined;
113
113
  const currentSort = sortBy ? sortBy[1] : undefined;
114
114
 
115
- const context: FireCMSContext<UserType> = useFireCMSContext();
115
+ const context: FireCMSContext<USER> = useFireCMSContext();
116
116
 
117
117
  const [rawData, setRawData] = useState<Entity<M>[]>([]);
118
118
 
@@ -1,3 +1,5 @@
1
+ "use client";
2
+
1
3
  import React, { PropsWithChildren } from "react";
2
4
  import { SnackbarProvider as NotistackSnackbarProvider } from "notistack";
3
5