@firecms/core 3.0.0-canary.113 → 3.0.0-canary.115

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 (31) hide show
  1. package/dist/components/ArrayContainer.d.ts +2 -1
  2. package/dist/components/EntityCollectionTable/fields/TableReferenceField.d.ts +1 -1
  3. package/dist/components/EntityPreview.d.ts +1 -1
  4. package/dist/form/components/FormikArrayContainer.d.ts +2 -1
  5. package/dist/index.es.js +114 -74
  6. package/dist/index.es.js.map +1 -1
  7. package/dist/index.umd.js +113 -73
  8. package/dist/index.umd.js.map +1 -1
  9. package/dist/preview/components/ReferencePreview.d.ts +1 -1
  10. package/dist/types/side_dialogs_controller.d.ts +10 -0
  11. package/dist/util/icons.d.ts +1 -0
  12. package/package.json +5 -5
  13. package/src/components/ArrayContainer.tsx +7 -4
  14. package/src/components/EntityCollectionTable/fields/TableReferenceField.tsx +13 -8
  15. package/src/components/EntityPreview.tsx +20 -22
  16. package/src/components/HomePage/DefaultHomePage.tsx +7 -9
  17. package/src/components/ReferenceTable/ReferenceSelectionTable.tsx +6 -2
  18. package/src/components/VirtualTable/fields/VirtualTableDateField.tsx +3 -3
  19. package/src/components/VirtualTable/fields/VirtualTableInput.tsx +2 -1
  20. package/src/components/VirtualTable/fields/VirtualTableNumberInput.tsx +2 -1
  21. package/src/core/EntityEditView.tsx +18 -16
  22. package/src/form/components/FormikArrayContainer.tsx +4 -1
  23. package/src/form/field_bindings/ArrayOfReferencesFieldBinding.tsx +4 -4
  24. package/src/form/field_bindings/BlockFieldBinding.tsx +2 -1
  25. package/src/form/field_bindings/ReferenceFieldBinding.tsx +5 -4
  26. package/src/hooks/useBuildNavigationController.tsx +0 -3
  27. package/src/internal/useBuildSideDialogsController.tsx +1 -0
  28. package/src/internal/useBuildSideEntityController.tsx +13 -2
  29. package/src/preview/components/ReferencePreview.tsx +2 -13
  30. package/src/types/side_dialogs_controller.tsx +13 -0
  31. package/src/util/icons.tsx +8 -2
@@ -11,11 +11,12 @@ interface ArrayContainerProps<T> {
11
11
  includeAddButton?: boolean;
12
12
  newDefaultEntry: T;
13
13
  onValueChange: (value: T[]) => void;
14
+ className?: string;
14
15
  }
15
16
  /**
16
17
  * @group Form custom fields
17
18
  */
18
- export declare function ArrayContainer<T>({ droppableId, addLabel, value, disabled, buildEntry, size, onInternalIdAdded, includeAddButton, newDefaultEntry, onValueChange }: ArrayContainerProps<T>): import("react/jsx-runtime").JSX.Element;
19
+ export declare function ArrayContainer<T>({ droppableId, addLabel, value, disabled, buildEntry, size, onInternalIdAdded, includeAddButton, newDefaultEntry, onValueChange, className }: ArrayContainerProps<T>): import("react/jsx-runtime").JSX.Element;
19
20
  type ArrayContainerItemProps = {
20
21
  provided: DraggableProvided;
21
22
  index: number;
@@ -15,7 +15,7 @@ type TableReferenceFieldProps = {
15
15
  includeEntityLink?: boolean;
16
16
  };
17
17
  export declare function TableReferenceField(props: TableReferenceFieldProps): import("react/jsx-runtime").JSX.Element;
18
- export declare const TableReferenceFieldSuccess: React.NamedExoticComponent<TableReferenceFieldProps & {
18
+ export declare const TableReferenceFieldInternal: React.NamedExoticComponent<TableReferenceFieldProps & {
19
19
  collection: EntityCollection;
20
20
  }>;
21
21
  export {};
@@ -27,4 +27,4 @@ export type EntityPreviewContainerProps = {
27
27
  style?: React.CSSProperties;
28
28
  onClick?: (e: React.SyntheticEvent) => void;
29
29
  };
30
- export declare const EntityPreviewContainer: React.FC<EntityPreviewContainerProps>;
30
+ export declare const EntityPreviewContainer: React.ForwardRefExoticComponent<EntityPreviewContainerProps & React.RefAttributes<HTMLDivElement>>;
@@ -10,9 +10,10 @@ interface ArrayContainerProps<T> {
10
10
  includeAddButton?: boolean;
11
11
  newDefaultEntry?: T | null;
12
12
  setFieldValue: (field: string, value: any, shouldValidate?: boolean | undefined) => void;
13
+ className?: string;
13
14
  }
14
15
  /**
15
16
  * @group Form custom fields
16
17
  */
17
- export declare function FormikArrayContainer<T>({ name, addLabel, value, disabled, buildEntry, small, onInternalIdAdded, includeAddButton, newDefaultEntry, setFieldValue }: ArrayContainerProps<T>): import("react/jsx-runtime").JSX.Element;
18
+ export declare function FormikArrayContainer<T>({ name, addLabel, value, disabled, buildEntry, small, onInternalIdAdded, includeAddButton, newDefaultEntry, setFieldValue, className }: ArrayContainerProps<T>): import("react/jsx-runtime").JSX.Element;
18
19
  export {};
package/dist/index.es.js CHANGED
@@ -4,7 +4,7 @@ import React__default, { useRef, useEffect, useContext, useCallback, useMemo, us
4
4
  import { SnackbarProvider as SnackbarProvider$1, useSnackbar } from "notistack";
5
5
  import hash from "object-hash";
6
6
  import { useCreateFormex, Formex, setIn, Field, getIn, useFormex } from "@firecms/formex";
7
- import { getColorSchemeForSeed, CHIP_COLORS, Tooltip, ErrorIcon, Typography, CircleIcon, FunctionsIcon, iconKeys, coolIconKeys, Icon, IconButton, ContentCopyIcon, OpenInNewIcon, DescriptionIcon, cls, Skeleton, Chip, defaultBorderMixin, KeyboardTabIcon, Checkbox, Markdown, TextareaAutosize, MultiSelect, MultiSelectItem, Select, SelectItem, BooleanSwitch, DateTimeField, paperMixin, ErrorOutlineIcon, EditIcon, RemoveCircleIcon, Menu, MoreVertIcon, MenuItem, CircularProgress, SearchBar, Badge, ArrowUpwardIcon, Popover, FilterListIcon, Button, AssignmentIcon, CenteredView, Label, TextField, ClearIcon, BooleanSwitchWithLabel, useOutsideAlerter, Dialog, DialogContent, DialogActions, FileCopyIcon, ArchiveIcon, DeleteIcon, AddIcon, ExpandablePanel, Card, ArrowForwardIcon, cardMixin, cardClickableMixin, StarIcon, StarBorderIcon, Collapse, Container, FilterListOffIcon, SearchIcon, LoadingButton, Avatar, DarkModeIcon, LightModeIcon, LogoutIcon, fieldBackgroundHoverMixin, HandleIcon, RemoveIcon, debounce, InfoIcon, CloseIcon, fieldBackgroundMixin, fieldBackgroundDisabledMixin, ArrowDropDownIcon, ShortTextIcon, SubjectIcon, FormatQuoteIcon, HttpIcon, EmailIcon, FlagIcon, ListIcon, ListAltIcon, NumbersIcon, FormatListNumberedIcon, UploadFileIcon, DriveFolderUploadIcon, LinkIcon, AddLinkIcon, ScheduleIcon, BallotIcon, RepeatIcon, ViewStreamIcon, NotesIcon, Tab, Tabs, Alert, Sheet, useLocaleConfig, MenuIcon, ChevronLeftIcon } from "@firecms/ui";
7
+ import { getColorSchemeForSeed, CHIP_COLORS, Tooltip, ErrorIcon, Typography, CircleIcon, FunctionsIcon, iconKeys, coolIconKeys, Icon, IconButton, ContentCopyIcon, OpenInNewIcon, DescriptionIcon, cls, Skeleton, Chip, defaultBorderMixin, KeyboardTabIcon, Checkbox, Markdown, TextareaAutosize, focusedDisabled, MultiSelect, MultiSelectItem, Select, SelectItem, BooleanSwitch, DateTimeField, paperMixin, ErrorOutlineIcon, EditIcon, RemoveCircleIcon, Menu, MoreVertIcon, MenuItem, CircularProgress, SearchBar, Badge, ArrowUpwardIcon, Popover, FilterListIcon, Button, AssignmentIcon, CenteredView, Label, TextField, ClearIcon, BooleanSwitchWithLabel, useOutsideAlerter, Dialog, DialogContent, DialogActions, FileCopyIcon, ArchiveIcon, DeleteIcon, AddIcon, ExpandablePanel, Card, ArrowForwardIcon, cardMixin, cardClickableMixin, StarIcon, StarBorderIcon, Collapse, Container, FilterListOffIcon, SearchIcon, LoadingButton, Avatar, DarkModeIcon, LightModeIcon, LogoutIcon, HandleIcon, RemoveIcon, debounce, InfoIcon, CloseIcon, fieldBackgroundMixin, fieldBackgroundDisabledMixin, fieldBackgroundHoverMixin, ArrowDropDownIcon, ShortTextIcon, SubjectIcon, FormatQuoteIcon, HttpIcon, EmailIcon, FlagIcon, ListIcon, ListAltIcon, NumbersIcon, FormatListNumberedIcon, UploadFileIcon, DriveFolderUploadIcon, LinkIcon, AddLinkIcon, ScheduleIcon, BallotIcon, RepeatIcon, ViewStreamIcon, NotesIcon, Tab, Tabs, Alert, Sheet, useLocaleConfig, MenuIcon, ChevronLeftIcon } from "@firecms/ui";
8
8
  import equal from "react-fast-compare";
9
9
  import { Link, useNavigate, useLocation, UNSAFE_NavigationContext, NavLink, Route, Routes } from "react-router-dom";
10
10
  import { format } from "date-fns";
@@ -2684,7 +2684,11 @@ function getIcon(iconKey, className) {
2684
2684
  return iconKey in iconKeysMap ? /* @__PURE__ */ jsx(Icon, { iconKey, size: "medium", className }) : void 0;
2685
2685
  }
2686
2686
  const IconForView = React__default.memo(
2687
- function IconForView2({ collectionOrView, className }) {
2687
+ function IconForView2({
2688
+ collectionOrView,
2689
+ className,
2690
+ size = "medium"
2691
+ }) {
2688
2692
  if (!collectionOrView) return /* @__PURE__ */ jsx(Fragment, {});
2689
2693
  const icon = getIcon(collectionOrView.icon, className);
2690
2694
  if (collectionOrView?.icon && icon)
@@ -2701,7 +2705,7 @@ const IconForView = React__default.memo(
2701
2705
  const iconsCount = coolIconKeys.length;
2702
2706
  if (!key)
2703
2707
  key = coolIconKeys[hashString(collectionOrView.path) % iconsCount];
2704
- return /* @__PURE__ */ jsx(Icon, { iconKey: key, size: "medium", className });
2708
+ return /* @__PURE__ */ jsx(Icon, { iconKey: key, size, className });
2705
2709
  },
2706
2710
  (prevProps, nextProps) => {
2707
2711
  return equal(prevProps.collectionOrView?.icon, nextProps.collectionOrView?.icon);
@@ -4080,7 +4084,6 @@ function useBuildNavigationController(props) {
4080
4084
  );
4081
4085
  let shouldUpdateTopLevelNav = false;
4082
4086
  if (!areCollectionListsEqual(collectionsRef.current ?? [], resolvedCollections)) {
4083
- console.log("Collections need to be updated");
4084
4087
  collectionsRef.current = resolvedCollections;
4085
4088
  shouldUpdateTopLevelNav = true;
4086
4089
  }
@@ -4089,12 +4092,10 @@ function useBuildNavigationController(props) {
4089
4092
  shouldUpdateTopLevelNav = true;
4090
4093
  }
4091
4094
  if (!equal(viewsRef.current, resolvedViews)) {
4092
- console.log("Views need to be updated");
4093
4095
  viewsRef.current = resolvedViews;
4094
4096
  shouldUpdateTopLevelNav = true;
4095
4097
  }
4096
4098
  if (!equal(adminViewsRef.current, resolvedAdminViews)) {
4097
- console.log("Admin views need to be updated");
4098
4099
  adminViewsRef.current = resolvedAdminViews;
4099
4100
  shouldUpdateTopLevelNav = true;
4100
4101
  }
@@ -4964,8 +4965,8 @@ function renderSkeletonCaptionText(index) {
4964
4965
  function renderSkeletonIcon() {
4965
4966
  return /* @__PURE__ */ jsx(Skeleton, { width: 24, height: 24 });
4966
4967
  }
4967
- const StorageThumbnail = React__default.memo(StorageThumbnailInternal, areEqual$2);
4968
- function areEqual$2(prevProps, nextProps) {
4968
+ const StorageThumbnail = React__default.memo(StorageThumbnailInternal, areEqual$1);
4969
+ function areEqual$1(prevProps, nextProps) {
4969
4970
  return prevProps.size === nextProps.size && prevProps.storagePathOrDownloadUrl === nextProps.storagePathOrDownloadUrl && prevProps.storeUrl === nextProps.storeUrl && prevProps.interactive === nextProps.interactive;
4970
4971
  }
4971
4972
  const URL_CACHE = {};
@@ -5172,15 +5173,18 @@ function EntityPreview({
5172
5173
  hover: disabled ? void 0 : hover,
5173
5174
  size,
5174
5175
  children: [
5175
- imageProperty && /* @__PURE__ */ jsx("div", { className: cls("w-10 h-10 mr-2 shrink-0 grow-0", size === "smallest" ? "my-0.5" : "m-2 self-start"), children: /* @__PURE__ */ jsx(
5176
- PropertyPreview,
5177
- {
5178
- property: imageProperty,
5179
- propertyKey: imagePropertyKey,
5180
- size: "smallest",
5181
- value: getValueInPath(entity.values, imagePropertyKey)
5182
- }
5183
- ) }),
5176
+ /* @__PURE__ */ jsxs("div", { className: cls("w-10 h-10 mr-2 shrink-0 grow-0", size === "smallest" ? "my-0.5" : "m-2 self-start"), children: [
5177
+ imageProperty && /* @__PURE__ */ jsx(
5178
+ PropertyPreview,
5179
+ {
5180
+ property: imageProperty,
5181
+ propertyKey: imagePropertyKey,
5182
+ size: "smallest",
5183
+ value: getValueInPath(entity.values, imagePropertyKey)
5184
+ }
5185
+ ),
5186
+ !imageProperty && /* @__PURE__ */ jsx(IconForView, { collectionOrView: collection, size, className: "mr-2" })
5187
+ ] }),
5184
5188
  /* @__PURE__ */ jsxs("div", { className: "flex flex-col flex-grow w-full m-1", children: [
5185
5189
  size !== "smallest" && includeId && (entity ? /* @__PURE__ */ jsx("div", { className: `${size !== "medium" ? "block whitespace-nowrap overflow-hidden truncate" : ""}`, children: /* @__PURE__ */ jsx(
5186
5190
  Typography,
@@ -5260,7 +5264,7 @@ function EntityPreview({
5260
5264
  }
5261
5265
  );
5262
5266
  }
5263
- const EntityPreviewContainerInner = React.forwardRef(({
5267
+ const EntityPreviewContainer = React.forwardRef(({
5264
5268
  children,
5265
5269
  hover,
5266
5270
  onClick,
@@ -5302,9 +5306,7 @@ const EntityPreviewContainerInner = React.forwardRef(({
5302
5306
  }
5303
5307
  );
5304
5308
  });
5305
- EntityPreviewContainerInner.displayName = "EntityPreviewContainer";
5306
- const EntityPreviewContainer = React.memo(EntityPreviewContainerInner);
5307
- const ReferencePreview = React.memo(function ReferencePreview2(props) {
5309
+ const ReferencePreview = function ReferencePreview2(props) {
5308
5310
  const reference = props.reference;
5309
5311
  if (!(typeof reference === "object" && "isEntityReference" in reference && reference.isEntityReference())) {
5310
5312
  console.warn("Reference preview received value of type", typeof reference);
@@ -5324,10 +5326,7 @@ const ReferencePreview = React.memo(function ReferencePreview2(props) {
5324
5326
  );
5325
5327
  }
5326
5328
  return /* @__PURE__ */ jsx(ReferencePreviewInternal, { ...props });
5327
- }, areEqual$1);
5328
- function areEqual$1(prevProps, nextProps) {
5329
- return prevProps.disabled === nextProps.disabled && prevProps.size === nextProps.size && prevProps.hover === nextProps.hover && prevProps.reference?.id === nextProps.reference?.id && prevProps.reference?.path === nextProps.reference?.path && prevProps.includeEntityLink === nextProps.includeEntityLink && prevProps.onClick === nextProps.onClick;
5330
- }
5329
+ };
5331
5330
  function ReferencePreviewInternal({
5332
5331
  disabled,
5333
5332
  reference,
@@ -6288,6 +6287,7 @@ function VirtualTableInput(props) {
6288
6287
  return /* @__PURE__ */ jsx(
6289
6288
  TextareaAutosize,
6290
6289
  {
6290
+ className: focusedDisabled,
6291
6291
  ref,
6292
6292
  style: {
6293
6293
  padding: 0,
@@ -6488,7 +6488,7 @@ function VirtualTableNumberInput(props) {
6488
6488
  "input",
6489
6489
  {
6490
6490
  ref,
6491
- className: "w-full text-right p-0 m-0 bg-transparent border-none resize-none outline-none font-normal leading-normal text-unset",
6491
+ className: cls("w-full text-right p-0 m-0 bg-transparent border-none resize-none outline-none font-normal leading-normal text-unset", focusedDisabled),
6492
6492
  style: {
6493
6493
  textAlign: align
6494
6494
  },
@@ -6541,8 +6541,8 @@ function VirtualTableDateField(props) {
6541
6541
  onChange: (dateValue) => updateValue(dateValue ?? null),
6542
6542
  size: "medium",
6543
6543
  invisible: true,
6544
- className: "w-full h-full",
6545
- inputClassName: "w-full h-full",
6544
+ inputClassName: cls("w-full h-full", focusedDisabled),
6545
+ className: cls("w-full h-full", focusedDisabled),
6546
6546
  mode,
6547
6547
  locale
6548
6548
  }
@@ -7153,10 +7153,10 @@ function TableReferenceField(props) {
7153
7153
  throw Error(`Couldn't find the corresponding collection view for the path: ${path}`);
7154
7154
  }
7155
7155
  }
7156
- return /* @__PURE__ */ jsx(TableReferenceFieldSuccess, { ...props, collection });
7156
+ return /* @__PURE__ */ jsx(TableReferenceFieldInternal, { ...props, collection });
7157
7157
  }
7158
- const TableReferenceFieldSuccess = React__default.memo(
7159
- function TableReferenceFieldSuccess2(props) {
7158
+ const TableReferenceFieldInternal = React__default.memo(
7159
+ function TableReferenceFieldInternal2(props) {
7160
7160
  const {
7161
7161
  name,
7162
7162
  internalValue,
@@ -7191,11 +7191,11 @@ const TableReferenceFieldSuccess = React__default.memo(
7191
7191
  forceFilter
7192
7192
  }
7193
7193
  );
7194
- const handleOpen = useCallback(() => {
7194
+ const handleOpen = () => {
7195
7195
  if (disabled)
7196
7196
  return;
7197
7197
  referenceDialogController.open();
7198
- }, [disabled, referenceDialogController]);
7198
+ };
7199
7199
  const valueNotSet = !internalValue || Array.isArray(internalValue) && internalValue.length === 0;
7200
7200
  const buildSingleReferenceField = () => {
7201
7201
  if (internalValue && !Array.isArray(internalValue) && internalValue.isEntityReference && internalValue.isEntityReference())
@@ -7258,12 +7258,21 @@ const TableReferenceFieldSuccess = React__default.memo(
7258
7258
  EntityPreviewContainer,
7259
7259
  {
7260
7260
  className: cls(
7261
- "p-4 text-sm font-medium flex items-center gap-4 uppercase",
7261
+ "p-4 text-sm font-medium flex items-center uppercase",
7262
+ multiselect ? "gap-4" : "gap-6",
7262
7263
  disabled ? "text-slate-500" : "cursor-pointer text-slate-700 dark:text-slate-300 hover:bg-slate-50 dark:hover:bg-gray-800 group-hover:bg-slate-50 dark:group-hover:bg-gray-800"
7263
7264
  ),
7264
7265
  onClick: handleOpen,
7265
7266
  size: "medium",
7266
7267
  children: [
7268
+ /* @__PURE__ */ jsx(
7269
+ IconForView,
7270
+ {
7271
+ size: "small",
7272
+ collectionOrView: collection,
7273
+ className: "text-gray-300 dark:text-gray-600"
7274
+ }
7275
+ ),
7267
7276
  "Edit ",
7268
7277
  title
7269
7278
  ]
@@ -11046,7 +11055,17 @@ function ReferenceSelectionTable({
11046
11055
  tableController,
11047
11056
  enablePopupIcon: false,
11048
11057
  tableRowActionsBuilder,
11049
- title: /* @__PURE__ */ jsx(Typography, { variant: "subtitle2", children: collection.singularName ? `Select ${collection.singularName}` : `Select from ${collection.name}` }),
11058
+ title: /* @__PURE__ */ jsxs(Typography, { variant: "subtitle2", className: "flex flex-row gap-2", children: [
11059
+ /* @__PURE__ */ jsx(
11060
+ IconForView,
11061
+ {
11062
+ size: "small",
11063
+ collectionOrView: collection,
11064
+ className: "text-gray-300 dark:text-gray-600"
11065
+ }
11066
+ ),
11067
+ collection.singularName ? `Select ${collection.singularName}` : `Select from ${collection.name}`
11068
+ ] }),
11050
11069
  defaultSize: collection.defaultSize,
11051
11070
  properties: resolvedCollection.properties,
11052
11071
  forceFilter,
@@ -11478,15 +11497,11 @@ function DefaultHomePage({
11478
11497
  groups
11479
11498
  } = navigationController.topLevelNavigation;
11480
11499
  const [filteredUrls, setFilteredUrls] = useState(null);
11481
- const filteredNavigationEntries = filteredUrls ? navigationEntries.filter((entry) => filteredUrls.includes(entry.url)) : navigationEntries;
11500
+ const performingSearch = Boolean(filteredUrls);
11501
+ const filteredNavigationEntries = filteredUrls ? filteredUrls.map((url) => navigationEntries.find((e) => e.url === url)).filter(Boolean) : navigationEntries;
11482
11502
  useEffect(() => {
11483
11503
  fuse.current = new Fuse(navigationEntries, {
11484
- keys: [
11485
- "name",
11486
- "description",
11487
- "group",
11488
- "path"
11489
- ]
11504
+ keys: ["name", "description", "group", "path"]
11490
11505
  });
11491
11506
  }, [navigationEntries]);
11492
11507
  const updateSearchResults = useCallback(
@@ -11503,7 +11518,8 @@ function DefaultHomePage({
11503
11518
  },
11504
11519
  []
11505
11520
  );
11506
- const allGroups = [...groups];
11521
+ const filteredGroups = filteredUrls ? filteredNavigationEntries.map((entry) => entry.group) : [];
11522
+ const allGroups = filteredUrls ? filteredGroups.filter((group, index) => filteredGroups.indexOf(group) === index) : [...groups];
11507
11523
  if (filteredNavigationEntries.filter((e) => !e.group).length > 0 || filteredNavigationEntries.length === 0) {
11508
11524
  allGroups.push(void 0);
11509
11525
  }
@@ -11559,7 +11575,7 @@ function DefaultHomePage({
11559
11575
  ]
11560
11576
  }
11561
11577
  ),
11562
- /* @__PURE__ */ jsx(FavouritesView, { hidden: Boolean(filteredUrls) }),
11578
+ /* @__PURE__ */ jsx(FavouritesView, { hidden: performingSearch }),
11563
11579
  additionalChildrenStart,
11564
11580
  additionalPluginChildrenStart,
11565
11581
  allGroups.map((group, index) => {
@@ -11576,7 +11592,7 @@ function DefaultHomePage({
11576
11592
  });
11577
11593
  }
11578
11594
  const thisGroupCollections = filteredNavigationEntries.filter((entry) => entry.group === group || !entry.group && group === void 0);
11579
- if (thisGroupCollections.length === 0 && AdditionalCards.length === 0)
11595
+ if (thisGroupCollections.length === 0 && (AdditionalCards.length === 0 || performingSearch))
11580
11596
  return null;
11581
11597
  return /* @__PURE__ */ jsx(
11582
11598
  NavigationGroup,
@@ -13275,7 +13291,8 @@ function ArrayContainer({
13275
13291
  onInternalIdAdded,
13276
13292
  includeAddButton,
13277
13293
  newDefaultEntry,
13278
- onValueChange
13294
+ onValueChange,
13295
+ className
13279
13296
  }) {
13280
13297
  const hasValue = value && Array.isArray(value) && value.length > 0;
13281
13298
  const internalIdsRef = useRef(buildIdsMap(value));
@@ -13364,6 +13381,7 @@ function ArrayContainer({
13364
13381
  children: (droppableProvided, droppableSnapshot) => /* @__PURE__ */ jsxs(
13365
13382
  "div",
13366
13383
  {
13384
+ className,
13367
13385
  ...droppableProvided.droppableProps,
13368
13386
  ref: droppableProvided.innerRef,
13369
13387
  children: [
@@ -13434,7 +13452,7 @@ function ArrayContainerItem({
13434
13452
  ref: provided.innerRef,
13435
13453
  ...provided.draggableProps,
13436
13454
  style: provided.draggableProps.style,
13437
- className: `${isDragging || onHover ? fieldBackgroundHoverMixin : ""} mb-1 rounded-md opacity-100`,
13455
+ className: `${isDragging || onHover ? "hover:bg-slate-50 dark:hover:bg-gray-800 dark:hover:bg-opacity-20" : ""} mb-1 rounded-md opacity-100`,
13438
13456
  children: /* @__PURE__ */ jsxs(
13439
13457
  "div",
13440
13458
  {
@@ -13443,7 +13461,7 @@ function ArrayContainerItem({
13443
13461
  /* @__PURE__ */ jsx(
13444
13462
  "div",
13445
13463
  {
13446
- className: "flex-grow w-[calc(100%-48px)] text-text-primary dark:text-text-primary-dark bg-white dark:bg-gray-900 bg-opacity-80 dark:bg-opacity-80",
13464
+ className: "flex-grow w-[calc(100%-48px)] text-text-primary dark:text-text-primary-dark",
13447
13465
  children: buildEntry(index, internalId)
13448
13466
  }
13449
13467
  ),
@@ -13753,7 +13771,8 @@ function FormikArrayContainer({
13753
13771
  onInternalIdAdded,
13754
13772
  includeAddButton,
13755
13773
  newDefaultEntry = null,
13756
- setFieldValue
13774
+ setFieldValue,
13775
+ className
13757
13776
  }) {
13758
13777
  return /* @__PURE__ */ jsx(
13759
13778
  ArrayContainer,
@@ -13767,6 +13786,7 @@ function FormikArrayContainer({
13767
13786
  onInternalIdAdded,
13768
13787
  includeAddButton,
13769
13788
  newDefaultEntry,
13789
+ className,
13770
13790
  onValueChange: (value2) => setFieldValue(name, value2)
13771
13791
  }
13772
13792
  );
@@ -14106,10 +14126,10 @@ function ArrayOfReferencesFieldBinding({
14106
14126
  forceFilter: ofProperty.forceFilter
14107
14127
  }
14108
14128
  );
14109
- const onEntryClick = useCallback((e) => {
14129
+ const onEntryClick = (e) => {
14110
14130
  e.preventDefault();
14111
14131
  referenceDialogController.open();
14112
- }, [referenceDialogController]);
14132
+ };
14113
14133
  const buildEntry = useCallback((index, internalId) => {
14114
14134
  const entryValue = value && value.length > index ? value[index] : void 0;
14115
14135
  if (!entryValue)
@@ -14137,7 +14157,7 @@ function ArrayOfReferencesFieldBinding({
14137
14157
  icon: getIconForProperty(property, "small"),
14138
14158
  required: property.validation?.required,
14139
14159
  title: property.name,
14140
- className: "flex-grow text-text-secondary dark:text-text-secondary-dark"
14160
+ className: "flex flex-grow text-text-secondary dark:text-text-secondary-dark"
14141
14161
  }
14142
14162
  ),
14143
14163
  Array.isArray(value) && /* @__PURE__ */ jsxs(Typography, { variant: "caption", className: "px-4", children: [
@@ -14170,7 +14190,7 @@ function ArrayOfReferencesFieldBinding({
14170
14190
  Button,
14171
14191
  {
14172
14192
  className: "my-4 justify-center text-left",
14173
- variant: "outlined",
14193
+ variant: "text",
14174
14194
  color: "primary",
14175
14195
  disabled: isSubmitting,
14176
14196
  onClick: onEntryClick,
@@ -14929,10 +14949,10 @@ function ReferenceFieldBindingInternal({
14929
14949
  forceFilter: property.forceFilter
14930
14950
  }
14931
14951
  );
14932
- const onEntryClick = useCallback((e) => {
14952
+ const onEntryClick = (e) => {
14933
14953
  e.preventDefault();
14934
14954
  referenceDialogController.open();
14935
- }, [referenceDialogController]);
14955
+ };
14936
14956
  return /* @__PURE__ */ jsxs(Fragment, { children: [
14937
14957
  !minimalistView && /* @__PURE__ */ jsx(
14938
14958
  LabelWithIconAndTooltip,
@@ -14974,7 +14994,13 @@ function ReferenceFieldBindingInternal({
14974
14994
  onClick: onEntryClick,
14975
14995
  size: "medium",
14976
14996
  children: [
14977
- /* @__PURE__ */ jsx(EmptyValue, {}),
14997
+ /* @__PURE__ */ jsx(
14998
+ IconForView,
14999
+ {
15000
+ collectionOrView: collection,
15001
+ className: "text-gray-300 dark:text-gray-600"
15002
+ }
15003
+ ),
14978
15004
  `Edit ${property.name}`.toUpperCase()
14979
15005
  ]
14980
15006
  }
@@ -16079,6 +16105,7 @@ function BlockFieldBinding({
16079
16105
  FormikArrayContainer,
16080
16106
  {
16081
16107
  value,
16108
+ className: "flex flex-col gap-3",
16082
16109
  name: propertyKey,
16083
16110
  addLabel: property.name ? "Add entry to " + property.name : "Add entry",
16084
16111
  buildEntry,
@@ -16160,7 +16187,7 @@ function BlockEntry({
16160
16187
  formex.setFieldValue(typeFieldName, newType);
16161
16188
  formex.setFieldValue(valueFieldName, newSelectedProperty ? getDefaultValueFor(newSelectedProperty) : null);
16162
16189
  };
16163
- return /* @__PURE__ */ jsxs("div", { className: cls(paperMixin, "bg-transparent p-2 mb-4"), children: [
16190
+ return /* @__PURE__ */ jsxs("div", { className: cls(paperMixin, "bg-transparent p-2"), children: [
16164
16191
  /* @__PURE__ */ jsx(
16165
16192
  Field,
16166
16193
  {
@@ -17350,8 +17377,8 @@ function EntityEditViewInner({
17350
17377
  entityId
17351
17378
  }
17352
17379
  );
17353
- const selectedTabRef = useRef(defaultSelectedView ?? MAIN_TAB_VALUE);
17354
- const mainViewVisible = selectedTabRef.current === MAIN_TAB_VALUE;
17380
+ const [selectedTab, setSelectedTab] = useState(defaultSelectedView ?? MAIN_TAB_VALUE);
17381
+ const mainViewVisible = selectedTab === MAIN_TAB_VALUE;
17355
17382
  const subcollections = (collection.subcollections ?? []).filter((c) => !c.hideFromNavigation);
17356
17383
  const subcollectionsCount = subcollections?.length ?? 0;
17357
17384
  const customViews = collection.entityViews;
@@ -17411,7 +17438,7 @@ function EntityEditViewInner({
17411
17438
  sideEntityController.replace({
17412
17439
  path,
17413
17440
  entityId: updatedEntity.id,
17414
- selectedSubPath: MAIN_TAB_VALUE === selectedTabRef.current ? void 0 : selectedTabRef.current,
17441
+ selectedSubPath: MAIN_TAB_VALUE === selectedTab ? void 0 : selectedTab,
17415
17442
  updateUrl: true,
17416
17443
  collection
17417
17444
  });
@@ -17559,13 +17586,13 @@ function EntityEditViewInner({
17559
17586
  formex
17560
17587
  };
17561
17588
  const resolvedEntityViews = customViews ? customViews.map((e) => resolveEntityView(e, customizationController.entityViews)).filter(Boolean) : [];
17562
- const selectedEntityView = resolvedEntityViews.find((e) => e.key === selectedTabRef.current);
17563
- const shouldShowEntityActions = !autoSave && (selectedTabRef.current === MAIN_TAB_VALUE || selectedEntityView?.includeActions);
17589
+ const selectedEntityView = resolvedEntityViews.find((e) => e.key === selectedTab);
17590
+ const shouldShowEntityActions = !autoSave && (selectedTab === MAIN_TAB_VALUE || selectedEntityView?.includeActions);
17564
17591
  const customViewsView = customViews && resolvedEntityViews.map(
17565
17592
  (customView, colIndex) => {
17566
17593
  if (!customView)
17567
17594
  return null;
17568
- if (selectedTabRef.current !== customView.key)
17595
+ if (selectedTab !== customView.key)
17569
17596
  return null;
17570
17597
  const Builder = customView.Builder;
17571
17598
  if (!Builder) {
@@ -17600,7 +17627,7 @@ function EntityEditViewInner({
17600
17627
  (subcollection, colIndex) => {
17601
17628
  const subcollectionId = subcollection.id ?? subcollection.path;
17602
17629
  const fullPath = usedEntity ? `${path}/${usedEntity?.id}/${removeInitialAndTrailingSlashes(subcollectionId)}` : void 0;
17603
- if (selectedTabRef.current !== subcollectionId)
17630
+ if (selectedTab !== subcollectionId)
17604
17631
  return null;
17605
17632
  return /* @__PURE__ */ jsxs(
17606
17633
  "div",
@@ -17634,14 +17661,16 @@ function EntityEditViewInner({
17634
17661
  onValuesAreModified(false);
17635
17662
  }, []);
17636
17663
  const onSideTabClick = (value) => {
17637
- selectedTabRef.current = value;
17638
- sideEntityController.replace({
17639
- path,
17640
- entityId,
17641
- selectedSubPath: value === MAIN_TAB_VALUE ? void 0 : value,
17642
- updateUrl: true,
17643
- collection
17644
- });
17664
+ setSelectedTab(value);
17665
+ if (status === "existing") {
17666
+ sideEntityController.replace({
17667
+ path,
17668
+ entityId,
17669
+ selectedSubPath: value === MAIN_TAB_VALUE ? void 0 : value,
17670
+ updateUrl: true,
17671
+ collection
17672
+ });
17673
+ }
17645
17674
  };
17646
17675
  const onIdUpdateError = useCallback((error) => {
17647
17676
  snackbarController.open({
@@ -18044,7 +18073,7 @@ function EntityEditViewInner({
18044
18073
  /* @__PURE__ */ jsxs(
18045
18074
  Tabs,
18046
18075
  {
18047
- value: selectedTabRef.current,
18076
+ value: selectedTab,
18048
18077
  onValueChange: (value) => {
18049
18078
  onSideTabClick(value);
18050
18079
  },
@@ -18455,6 +18484,15 @@ const useBuildSideEntityController = (navigation, sideDialogsController) => {
18455
18484
  initialised.current = true;
18456
18485
  }
18457
18486
  }, [location, navigation.loading, navigation.isUrlCollectionPath, navigation.buildUrlCollectionPath, navigation.resolveAliasesFrom, sideDialogsController, smallLayout, navigation]);
18487
+ useEffect(() => {
18488
+ const updatedSidePanels = sideDialogsController.sidePanels.map((sidePanelProps) => {
18489
+ if (sidePanelProps.additional) {
18490
+ return propsToSidePanel(sidePanelProps.additional, navigation.buildUrlCollectionPath, navigation.resolveAliasesFrom, smallLayout);
18491
+ }
18492
+ return sidePanelProps;
18493
+ });
18494
+ sideDialogsController.setSidePanels(updatedSidePanels);
18495
+ }, [smallLayout]);
18458
18496
  const close = useCallback(() => {
18459
18497
  sideDialogsController.close();
18460
18498
  }, [sideDialogsController]);
@@ -18547,7 +18585,8 @@ const propsToSidePanel = (props, buildUrlCollectionPath, resolveAliasesFrom, sma
18547
18585
  urlPath: newPath,
18548
18586
  parentUrlPath: buildUrlCollectionPath(collectionPath),
18549
18587
  width: entityViewWidth,
18550
- onClose: props.onClose
18588
+ onClose: props.onClose,
18589
+ additional: props
18551
18590
  };
18552
18591
  };
18553
18592
  function useBuildSideDialogsController() {
@@ -18640,6 +18679,7 @@ function useBuildSideDialogsController() {
18640
18679
  }, [location, navigate, sidePanels]);
18641
18680
  return {
18642
18681
  sidePanels,
18682
+ setSidePanels: updateSidePanels,
18643
18683
  close,
18644
18684
  open,
18645
18685
  replace