@firecms/core 3.0.0-alpha.37 → 3.0.0-alpha.39

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.
@@ -11,7 +11,7 @@ import { ResolvedProperty } from "./resolved_entities";
11
11
  * NOTE: This is a work in progress and the API is not stable yet.
12
12
  * @group Core
13
13
  */
14
- export type FireCMSPlugin<PROPS = any, FORM_PROPS = any, EC extends EntityCollection = EntityCollection> = {
14
+ export type FireCMSPlugin<PROPS = any, FORM_PROPS = any, EC extends EntityCollection = EntityCollection, COL_ACTIONS_PROPS = any> = {
15
15
  /**
16
16
  * Name of the plugin
17
17
  */
@@ -34,7 +34,8 @@ export type FireCMSPlugin<PROPS = any, FORM_PROPS = any, EC extends EntityCollec
34
34
  * Use this component to add custom actions to the entity collections
35
35
  * toolbar.
36
36
  */
37
- CollectionActions?: React.ComponentType<CollectionActionsProps<any, any, EC>> | React.ComponentType<CollectionActionsProps<any, any, EC>>[];
37
+ CollectionActions?: React.ComponentType<CollectionActionsProps<any, any, EC> & COL_ACTIONS_PROPS> | React.ComponentType<CollectionActionsProps<any, any, EC> & COL_ACTIONS_PROPS>[];
38
+ collectionActionsProps?: COL_ACTIONS_PROPS;
38
39
  };
39
40
  form?: {
40
41
  provider?: {
@@ -8,6 +8,7 @@ export type DialogProps = {
8
8
  fullScreen?: boolean;
9
9
  scrollable?: boolean;
10
10
  maxWidth?: keyof typeof widthClasses;
11
+ modal?: boolean;
11
12
  };
12
13
  declare const widthClasses: {
13
14
  xs: string;
@@ -23,5 +24,5 @@ declare const widthClasses: {
23
24
  "7xl": string;
24
25
  full: string;
25
26
  };
26
- export declare const Dialog: ({ open, onOpenChange, children, className, fullWidth, fullHeight, fullScreen, scrollable, maxWidth }: DialogProps) => import("react/jsx-runtime").JSX.Element;
27
+ export declare const Dialog: ({ open, onOpenChange, children, className, fullWidth, fullHeight, fullScreen, scrollable, maxWidth, modal }: DialogProps) => import("react/jsx-runtime").JSX.Element;
27
28
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@firecms/core",
3
- "version": "3.0.0-alpha.37",
3
+ "version": "3.0.0-alpha.39",
4
4
  "description": "Awesome Firebase/Firestore-based headless open-source CMS",
5
5
  "funding": {
6
6
  "url": "https://github.com/sponsors/firecmsco"
@@ -48,7 +48,7 @@
48
48
  "@date-io/date-fns": "^2.17.0",
49
49
  "@fontsource/ibm-plex-mono": "^5.0.8",
50
50
  "@fontsource/roboto": "^5.0.8",
51
- "@hello-pangea/dnd": "^16.3.0",
51
+ "@hello-pangea/dnd": "^16.5.0",
52
52
  "@material-design-icons/font": "^0.14.13",
53
53
  "@radix-ui/react-checkbox": "^1.0.4",
54
54
  "@radix-ui/react-collapsible": "^1.0.3",
@@ -69,15 +69,14 @@
69
69
  "markdown-it": "^13.0.2",
70
70
  "notistack": "^3.0.1",
71
71
  "object-hash": "^3.0.0",
72
- "react-datepicker": "^4.21.0",
72
+ "react-datepicker": "^4.24.0",
73
73
  "react-dropzone": "^14.2.3",
74
74
  "react-fast-compare": "^3.2.2",
75
75
  "react-image-file-resizer": "^0.4.8",
76
76
  "react-markdown-editor-lite": "^1.3.4",
77
- "react-remove-scroll": "^2.5.6",
78
77
  "react-transition-group": "^4.4.5",
79
78
  "react-use-measure": "^2.1.1",
80
- "react-window": "^1.8.9",
79
+ "react-window": "^1.8.10",
81
80
  "tailwind-merge": "^1.14.0",
82
81
  "typeface-rubik": "^1.1.13",
83
82
  "yup": "^0.32.11"
@@ -103,38 +102,38 @@
103
102
  "@testing-library/user-event": "^14.5.1",
104
103
  "@types/jest": "^29.5.6",
105
104
  "@types/node": "^20.8.9",
106
- "@types/object-hash": "^3.0.5",
107
- "@types/react": "^18.2.33",
108
- "@types/react-dom": "^18.2.14",
109
- "@types/react-measure": "^2.0.10",
105
+ "@types/object-hash": "^3.0.6",
106
+ "@types/react": "^18.2.45",
107
+ "@types/react-dom": "^18.2.17",
108
+ "@types/react-measure": "^2.0.12",
110
109
  "@typescript-eslint/eslint-plugin": "^5.62.0",
111
110
  "@typescript-eslint/parser": "^5.62.0",
112
- "@vitejs/plugin-react": "^4.1.0",
113
- "algoliasearch": "^4.20.0",
111
+ "@vitejs/plugin-react": "^4.2.1",
112
+ "algoliasearch": "^4.22.0",
114
113
  "cross-env": "^7.0.3",
115
- "eslint": "^8.52.0",
114
+ "eslint": "^8.55.0",
116
115
  "eslint-config-standard": "^17.1.0",
117
- "eslint-plugin-import": "^2.29.0",
116
+ "eslint-plugin-import": "^2.29.1",
118
117
  "eslint-plugin-n": "^15.7.0",
119
118
  "eslint-plugin-promise": "^6.1.1",
120
119
  "eslint-plugin-react": "^7.33.2",
121
120
  "eslint-plugin-react-hooks": "^4.6.0",
122
- "firebase": "^10.5.2",
121
+ "firebase": "^10.7.1",
123
122
  "jest": "^29.7.0",
124
123
  "npm-run-all": "^4.1.5",
125
- "react-router": "^6.17.0",
126
- "react-router-dom": "^6.17.0",
124
+ "react-router": "^6.21.0",
125
+ "react-router-dom": "^6.21.0",
127
126
  "ts-jest": "^29.1.1",
128
- "ts-node": "^10.9.1",
127
+ "ts-node": "^10.9.2",
129
128
  "tsd": "^0.28.1",
130
- "typescript": "^5.3.0",
131
- "vite": "^4.5.0"
129
+ "typescript": "^5.3.3",
130
+ "vite": "^4.5.1"
132
131
  },
133
132
  "files": [
134
133
  "dist",
135
134
  "src"
136
135
  ],
137
- "gitHead": "bfe341a3a8e3d2b33d4dc3f48fabc350eccace1b",
136
+ "gitHead": "5908ef529f511bdb4c600f159e45fe12085e8262",
138
137
  "publishConfig": {
139
138
  "access": "public"
140
139
  }
@@ -6,6 +6,7 @@ import { CollectionActionsProps, EntityCollection, SelectionController, TableCon
6
6
  import { Button, IconButton, Tooltip } from "../../ui";
7
7
  import { AddIcon, DeleteIcon } from "../../icons";
8
8
  import { toArray } from "../../util/arrays";
9
+ import { ErrorBoundary } from "../ErrorBoundary";
9
10
 
10
11
  export type EntityCollectionViewActionsProps<M extends Record<string, any>> = {
11
12
  collection: EntityCollection<M>;
@@ -102,23 +103,26 @@ export function EntityCollectionViewActions<M extends Record<string, any>>({
102
103
  collectionEntitiesCount
103
104
  };
104
105
 
105
- const allActions: React.ComponentType<any>[] = [];
106
- allActions.push(...toArray(collection.Actions));
106
+ const actions = toArray(collection.Actions)
107
+ .map((Action, i) => (
108
+ <ErrorBoundary key={`actions_${i}`}>
109
+ <Action {...actionProps} />
110
+ </ErrorBoundary>
111
+ ));
112
+
107
113
  if (plugins) {
108
114
  plugins.forEach(plugin => {
109
115
  if (plugin.collections?.CollectionActions) {
110
- allActions.push(...toArray(plugin.collections?.CollectionActions));
116
+ actions.push(...toArray(plugin.collections?.CollectionActions)
117
+ .map((Action, i) => (
118
+ <ErrorBoundary key={`plugin_actions_${i}`}>
119
+ <Action {...actionProps} {...plugin.collections?.collectionActionsProps}/>
120
+ </ErrorBoundary>
121
+ )));
111
122
  }
112
123
  });
113
124
  }
114
125
 
115
- const actions = <>
116
- {allActions.map((Action, i) => (
117
- <Action key={`actions_${i}`} {...actionProps} />
118
- ))}
119
- </>
120
- ;
121
-
122
126
  return (
123
127
  <>
124
128
  {actions}
@@ -25,9 +25,6 @@ export function MapPropertyPreview<T extends Record<string, any> = Record<string
25
25
 
26
26
  const mapProperty = property as ResolvedMapProperty;
27
27
 
28
- if (propertyKey === "result.suggestions")
29
- console.log({ propertyKey, property, value })
30
-
31
28
  if (!mapProperty.properties || Object.keys(mapProperty.properties ?? {}).length === 0) {
32
29
  return (
33
30
  <KeyValuePreview value={value}/>
@@ -13,7 +13,7 @@ import { ResolvedProperty } from "./resolved_entities";
13
13
  * NOTE: This is a work in progress and the API is not stable yet.
14
14
  * @group Core
15
15
  */
16
- export type FireCMSPlugin<PROPS = any, FORM_PROPS = any, EC extends EntityCollection = EntityCollection> = {
16
+ export type FireCMSPlugin<PROPS = any, FORM_PROPS = any, EC extends EntityCollection = EntityCollection, COL_ACTIONS_PROPS = any> = {
17
17
 
18
18
  /**
19
19
  * Name of the plugin
@@ -41,7 +41,9 @@ export type FireCMSPlugin<PROPS = any, FORM_PROPS = any, EC extends EntityCollec
41
41
  * Use this component to add custom actions to the entity collections
42
42
  * toolbar.
43
43
  */
44
- CollectionActions?: React.ComponentType<CollectionActionsProps<any, any, EC>> | React.ComponentType<CollectionActionsProps<any, any, EC>>[];
44
+ CollectionActions?: React.ComponentType<CollectionActionsProps<any, any, EC> & COL_ACTIONS_PROPS> | React.ComponentType<CollectionActionsProps<any, any, EC> & COL_ACTIONS_PROPS>[];
45
+
46
+ collectionActionsProps?: COL_ACTIONS_PROPS;
45
47
 
46
48
  }
47
49
 
package/src/ui/Dialog.tsx CHANGED
@@ -13,6 +13,7 @@ export type DialogProps = {
13
13
  fullScreen?: boolean;
14
14
  scrollable?: boolean;
15
15
  maxWidth?: keyof typeof widthClasses;
16
+ modal?: boolean;
16
17
  };
17
18
 
18
19
  const widthClasses = {
@@ -39,7 +40,8 @@ export const Dialog = ({
39
40
  fullHeight,
40
41
  fullScreen,
41
42
  scrollable = true,
42
- maxWidth = "lg"
43
+ maxWidth = "lg",
44
+ modal = true
43
45
  }: DialogProps) => {
44
46
  const [displayed, setDisplayed] = useState(false);
45
47
 
@@ -58,10 +60,11 @@ export const Dialog = ({
58
60
 
59
61
  return (
60
62
  <DialogPrimitive.Root open={displayed || open}
63
+ modal={modal}
61
64
  onOpenChange={onOpenChange}>
62
65
  <DialogPrimitive.Portal>
63
66
 
64
- <div className={"fixed inset-0 z-40"}>
67
+ <div className={"fixed inset-0 z-30"}>
65
68
 
66
69
  <DialogPrimitive.Overlay
67
70
  className={cn("fixed inset-0 transition-opacity z-20 ease-in-out duration-200 bg-black bg-opacity-50 dark:bg-opacity-60 backdrop-blur-sm ",
@@ -74,7 +77,7 @@ export const Dialog = ({
74
77
  />
75
78
 
76
79
  <DialogPrimitive.Content
77
- className={cn("h-full outline-none flex justify-center items-center z-50 opacity-100 transition-all duration-200 ease-in-out")}
80
+ className={cn("h-full outline-none flex justify-center items-center z-40 opacity-100 transition-all duration-200 ease-in-out")}
78
81
  >
79
82
  <div
80
83
  className={cn(paperMixin,
package/src/ui/Select.tsx CHANGED
@@ -179,11 +179,12 @@ export function Select({
179
179
  <SelectPrimitive.Portal>
180
180
  <SelectPrimitive.Content
181
181
  position={position}
182
- className="z-50 max-h-[var(--radix-select-content-available-height)] overflow-hidden relative border border-gray-200 dark:border-gray-800 bg-white dark:bg-gray-800 p-2 rounded-lg shadow-lg">
182
+ className="z-50 relative overflow-hidden border border-gray-200 dark:border-gray-800 bg-white dark:bg-gray-800 p-2 rounded-lg shadow-lg">
183
183
  <SelectPrimitive.Viewport
184
- className={"p-1 max-h-[var(--radix-select-content-available-height)]"}
184
+ className={"p-1"}
185
185
  style={{
186
- }}>
186
+ maxHeight: "var(--radix-select-content-available-height)"
187
+ }}>
187
188
  {children}
188
189
  </SelectPrimitive.Viewport>
189
190
  </SelectPrimitive.Content>