@firecms/core 3.0.0-canary.146 → 3.0.0-canary.148

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.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@firecms/core",
3
3
  "type": "module",
4
- "version": "3.0.0-canary.146",
4
+ "version": "3.0.0-canary.148",
5
5
  "description": "Awesome Firebase/Firestore-based headless open-source CMS",
6
6
  "funding": {
7
7
  "url": "https://github.com/sponsors/firecmsco"
@@ -46,9 +46,9 @@
46
46
  "./package.json": "./package.json"
47
47
  },
48
48
  "dependencies": {
49
- "@firecms/editor": "^3.0.0-canary.146",
50
- "@firecms/formex": "^3.0.0-canary.146",
51
- "@firecms/ui": "^3.0.0-canary.146",
49
+ "@firecms/editor": "^3.0.0-canary.148",
50
+ "@firecms/formex": "^3.0.0-canary.148",
51
+ "@firecms/ui": "^3.0.0-canary.148",
52
52
  "@hello-pangea/dnd": "^17.0.0",
53
53
  "@radix-ui/react-portal": "^1.1.2",
54
54
  "clsx": "^2.1.1",
@@ -100,7 +100,7 @@
100
100
  "dist",
101
101
  "src"
102
102
  ],
103
- "gitHead": "601e622a79787f5b08f7ac27646d044787b972f1",
103
+ "gitHead": "69ccd5bec8161008d5219388a34b49ccdccda040",
104
104
  "publishConfig": {
105
105
  "access": "public"
106
106
  },
@@ -168,7 +168,7 @@ function DrawerWrapper(props: {
168
168
  sideOffset={12}
169
169
  asChild={true}>
170
170
  <div
171
- className="ml-2 fixed top-1 left-2 sm:top-2 sm:left-3 !bg-surface-50 dark:!bg-surface-900 rounded-full w-fit z-20">
171
+ 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">
172
172
  <IconButton
173
173
  color="inherit"
174
174
  aria-label="Open menu"
@@ -209,7 +209,7 @@ function DrawerWrapper(props: {
209
209
  aria-label="Open drawer"
210
210
  onClick={() => props.setDrawerOpen(true)}
211
211
  size="large"
212
- className="absolute sm:top-2 sm:left-5 top-1 left-2"
212
+ className="absolute sm:top-2 sm:left-4 top-1 left-2"
213
213
  >
214
214
  <MenuIcon/>
215
215
  </IconButton>
@@ -217,7 +217,7 @@ function DrawerWrapper(props: {
217
217
  transparent={true}
218
218
  open={props.open}
219
219
  onOpenChange={props.setDrawerOpen}
220
- title={"Navigaion drawer"}
220
+ title={"Navigation drawer"}
221
221
  overlayClassName={"bg-white bg-opacity-80"}
222
222
  >
223
223
  {innerDrawer}
@@ -10,6 +10,8 @@ import {
10
10
  ContentCopyIcon,
11
11
  HandleIcon,
12
12
  IconButton,
13
+ KeyboardArrowDownIcon,
14
+ KeyboardArrowUpIcon,
13
15
  Menu,
14
16
  MenuItem,
15
17
  RemoveIcon,
@@ -132,6 +134,18 @@ export function ArrayContainer<T>({
132
134
  onValueChange([...value.slice(0, index + 1), copyingItem, ...value.slice(index + 1)]);
133
135
  };
134
136
 
137
+ const addInIndex = (index: number) => {
138
+ const id = getRandomId();
139
+ const newIds: number[] = [
140
+ ...internalIds.splice(0, index),
141
+ id,
142
+ ...internalIds.slice(index)];
143
+ if (onInternalIdAdded)
144
+ onInternalIdAdded(id);
145
+ setInternalIds(newIds);
146
+ onValueChange([...value.slice(0, index), newDefaultEntry, ...value.slice(index)]);
147
+ }
148
+
135
149
  const onDragEnd = (result: any) => {
136
150
  // dropped outside the list
137
151
  if (!result.destination) {
@@ -168,6 +182,7 @@ export function ArrayContainer<T>({
168
182
  isDragging={snapshot.isDragging}
169
183
  storedProps={itemCustomPropsRef.current[internalId]}
170
184
  updateItemCustomProps={updateItemCustomProps}
185
+ addInIndex={addInIndex}
171
186
  />
172
187
  );
173
188
  }}
@@ -197,6 +212,7 @@ export function ArrayContainer<T>({
197
212
  isDragging={snapshot.isDragging}
198
213
  storedProps={itemCustomPropsRef.current[internalId]}
199
214
  updateItemCustomProps={updateItemCustomProps}
215
+ addInIndex={addInIndex}
200
216
  />
201
217
  )}
202
218
  </Draggable>
@@ -232,6 +248,7 @@ type ArrayContainerItemProps = {
232
248
  buildEntry: ArrayEntryBuilder,
233
249
  remove: (index: number) => void,
234
250
  copy: (index: number) => void,
251
+ addInIndex?: (index: number) => void,
235
252
  isDragging: boolean,
236
253
  storedProps?: object,
237
254
  updateItemCustomProps: (internalId: number, props: object) => void
@@ -245,6 +262,7 @@ export function ArrayContainerItem({
245
262
  disabled,
246
263
  buildEntry,
247
264
  remove,
265
+ addInIndex,
248
266
  copy,
249
267
  isDragging,
250
268
  storedProps,
@@ -276,6 +294,7 @@ export function ArrayContainerItem({
276
294
  remove={remove}
277
295
  index={index}
278
296
  provided={provided}
297
+ addInIndex={addInIndex}
279
298
  copy={copy}/>
280
299
  </div>
281
300
  </div>;
@@ -288,13 +307,15 @@ export function ArrayItemOptions({
288
307
  index,
289
308
  provided,
290
309
  copy,
310
+ addInIndex
291
311
  }: {
292
312
  direction?: "row" | "column",
293
313
  disabled: boolean,
294
314
  remove: (index: number) => void,
295
315
  index: number,
296
316
  provided: any,
297
- copy: (index: number) => void
317
+ copy: (index: number) => void,
318
+ addInIndex?: (index: number) => void
298
319
  }) {
299
320
 
300
321
  const [menuOpen, setMenuOpen] = useState(false);
@@ -344,6 +365,24 @@ export function ArrayItemOptions({
344
365
  Copy
345
366
  </MenuItem>
346
367
 
368
+ {addInIndex && <MenuItem dense
369
+ onClick={() => {
370
+ setMenuOpen(false);
371
+ addInIndex(index);
372
+ }}>
373
+ <KeyboardArrowUpIcon size={"small"}/>
374
+ Add on top
375
+ </MenuItem>}
376
+
377
+ {addInIndex && <MenuItem dense
378
+ onClick={() => {
379
+ setMenuOpen(false);
380
+ addInIndex(index + 1);
381
+ }}>
382
+ <KeyboardArrowDownIcon size={"small"}/>
383
+ Add below
384
+ </MenuItem>}
385
+
347
386
  </Menu>
348
387
  </Tooltip>
349
388
 
@@ -31,8 +31,8 @@ export function ErrorView({
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>}
@@ -85,7 +85,7 @@ export function DefaultDrawer({
85
85
 
86
86
  {groupsWithoutAdmin.map((group) => (
87
87
  <div
88
- className={"bg-surface-50 dark:bg-surface-800 dark:bg-opacity-30 my-4 rounded-lg ml-4"}
88
+ className={"bg-surface-50 dark:bg-surface-800 dark:bg-opacity-30 my-4 rounded-lg ml-3 mr-1"}
89
89
  key={`drawer_group_${group}`}>
90
90
  {buildGroupHeader(group)}
91
91
  {Object.values(navigationEntries)
@@ -163,7 +163,7 @@ export function DrawerLogo({ logo }: {
163
163
  transition: "padding 100ms cubic-bezier(0.4, 0, 0.6, 1) 0ms",
164
164
  padding: drawerOpen ? "32px 144px 0px 24px" : "72px 12px 0px 12px"
165
165
  }}
166
- className={cls("cursor-pointer ml-4")}>
166
+ className={cls("cursor-pointer ml-3 mr-1")}>
167
167
 
168
168
  <Tooltip title={"Home"}
169
169
  sideOffset={20}
@@ -34,12 +34,12 @@ export function DrawerNavigationItem({
34
34
  transition: drawerOpen ? "width 150ms ease-in" : undefined
35
35
  }}
36
36
  className={({ isActive }: any) => cls("rounded-lg truncate",
37
- "hover:bg-surface-accent-300 hover:bg-opacity-75 dark:hover:bg-surface-accent-800 dark:hover:bg-opacity-75 text-text-secondary dark:text-surface-200 hover:text-surface-900 hover:dark:text-white",
37
+ "hover:bg-surface-accent-300 hover:bg-opacity-75 dark:hover:bg-surface-accent-800 dark:hover:bg-opacity-75 text-text-primary dark:text-surface-200 hover:text-surface-900 hover:dark:text-white",
38
38
  "flex flex-row items-center mr-8",
39
39
  // "transition-all ease-in-out delay-100 duration-300",
40
40
  // drawerOpen ? "w-full" : "w-18",
41
41
  drawerOpen ? "pl-4 h-12" : "pl-4 h-11",
42
- "font-medium text-sm",
42
+ "font-semibold text-xs",
43
43
  isActive ? "bg-surface-accent-200 bg-opacity-60 dark:bg-surface-800 dark:bg-opacity-50" : ""
44
44
  )}
45
45
  to={url}