@contentful/field-editor-reference 5.5.4 → 5.8.0

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.
@@ -1,9 +1,9 @@
1
1
  import React__default, { useState, useRef, useEffect, createElement, Fragment, useMemo, useCallback } from 'react';
2
2
  import { css, cx } from 'emotion';
3
3
  import tokens from '@contentful/f36-tokens';
4
- import get from 'lodash-es/get';
5
4
  import { Menu, TextInput, Button, Paragraph, Card, Flex, SectionHeading, IconButton, Tooltip, Text, EntryCard, MenuItem, MenuDivider, AssetCard } from '@contentful/f36-components';
6
5
  import { SearchIcon, PlusIcon, ChevronDownIcon, LinkIcon, CloseIcon, FolderOpenTrimmedIcon, ClockIcon } from '@contentful/f36-icons';
6
+ import get from 'lodash-es/get';
7
7
  import moment from 'moment';
8
8
  import { FieldConnector, isValidImage, entityHelpers, shortenStorageUnit } from '@contentful/field-editor-shared';
9
9
  import deepEqual from 'deep-equal';
@@ -190,7 +190,7 @@ var action = /*#__PURE__*/css({
190
190
  });
191
191
 
192
192
  /* eslint-disable @typescript-eslint/no-explicit-any */
193
- var MAX_ITEMS_WITHOUT_SEARCH = 20;
193
+ var MAX_ITEMS_WITHOUT_SEARCH = 5;
194
194
  var menuPlacementMap = {
195
195
  'bottom-left': 'bottom-start',
196
196
  'bottom-right': 'bottom-end'
@@ -396,7 +396,8 @@ var standardStyles = {
396
396
  var redesignStyles = /*#__PURE__*/_extends({}, standardStyles, {
397
397
  action: /*#__PURE__*/css({
398
398
  textDecoration: 'none',
399
- fontWeight: 'bold'
399
+ fontWeight: 'bold',
400
+ maxWidth: '300px'
400
401
  })
401
402
  });
402
403
 
@@ -1596,7 +1597,8 @@ function _selectMultipleEntities() {
1596
1597
  return _selectMultipleEntities.apply(this, arguments);
1597
1598
  }
1598
1599
 
1599
- var _excluded = ["renderCustomActions"];
1600
+ var _excluded = ["renderCustomActions"],
1601
+ _excluded2 = ["renderCustomActions"];
1600
1602
  function useLinkActionsProps(props) {
1601
1603
  var _editorPermissions$va;
1602
1604
 
@@ -1795,10 +1797,13 @@ function LinkEntityActions(_ref4) {
1795
1797
  var renderCustomActions = _ref4.renderCustomActions,
1796
1798
  props = _objectWithoutPropertiesLoose(_ref4, _excluded);
1797
1799
 
1798
- var renderLinkActions = renderCustomActions ? renderCustomActions : function (props) {
1799
- return createElement(LinkActions, _extends({}, props));
1800
- };
1801
- return renderLinkActions(props);
1800
+ return renderCustomActions ? renderCustomActions(props) : createElement(LinkActions, _extends({}, props));
1801
+ }
1802
+ function CombinedLinkEntityActions(_ref5) {
1803
+ var renderCustomActions = _ref5.renderCustomActions,
1804
+ props = _objectWithoutPropertiesLoose(_ref5, _excluded2);
1805
+
1806
+ return renderCustomActions ? renderCustomActions(props) : createElement(CombinedLinkActions, _extends({}, props));
1802
1807
  }
1803
1808
 
1804
1809
  // eslint-disable-next-line -- TODO: describe this disable no-restricted-imports
@@ -1917,7 +1922,7 @@ function AssetThumbnail(props) {
1917
1922
  }
1918
1923
 
1919
1924
  var _excluded$1 = ["priority"],
1920
- _excluded2 = ["children"];
1925
+ _excluded2$1 = ["children"];
1921
1926
 
1922
1927
  var globalQueue = /*#__PURE__*/new PQueue({
1923
1928
  concurrency: 50
@@ -2367,7 +2372,7 @@ function useResource(resourceType, urn, options) {
2367
2372
 
2368
2373
  function EntityProvider(_ref9) {
2369
2374
  var children = _ref9.children,
2370
- props = _objectWithoutPropertiesLoose(_ref9, _excluded2);
2375
+ props = _objectWithoutPropertiesLoose(_ref9, _excluded2$1);
2371
2376
 
2372
2377
  var reactQueryClient = useMemo(function () {
2373
2378
  var queryCache = new QueryCache();
@@ -3357,7 +3362,9 @@ var styles$3 = {
3357
3362
  position: 'relative'
3358
3363
  }),
3359
3364
  item: /*#__PURE__*/css({
3360
- marginBottom: tokens.spacingM
3365
+ marginBottom: tokens.spacingM,
3366
+ zIndex: tokens.zIndexModalContent // setting this to an index above 99 fixes dragged item disappearing issue
3367
+
3361
3368
  })
3362
3369
  };
3363
3370
 
@@ -4228,7 +4235,9 @@ function ResourceEditor(props) {
4228
4235
  onSortEnd: onSortEnd,
4229
4236
  onMove: onMove,
4230
4237
  onRemoteItemAtIndex: onRemoteItemAtIndex
4231
- })), createElement(CombinedLinkActions, _extends({}, linkActionsProps)));
4238
+ })), createElement(CombinedLinkEntityActions, _extends({}, linkActionsProps, {
4239
+ renderCustomActions: props.renderCustomActions
4240
+ })));
4232
4241
  } // provides memoized callbacks bound to a given item
4233
4242
 
4234
4243
 
@@ -4276,6 +4285,7 @@ function MultipleResourceReferenceEditor(props) {
4276
4285
  items: value || EMPTY_ARRAY,
4277
4286
  isDisabled: disabled,
4278
4287
  setValue: setValue,
4288
+ renderCustomActions: props.renderCustomActions,
4279
4289
  key: externalReset + "-list"
4280
4290
  }), function (editorProps) {
4281
4291
  return createElement(SortableLinkList, _extends({}, editorProps), function (_ref4) {
@@ -4334,8 +4344,9 @@ function SingleResourceReferenceEditor(props) {
4334
4344
  resourceLink: value,
4335
4345
  isDisabled: disabled,
4336
4346
  getEntryRouteHref: props.getEntryRouteHref
4337
- }) : // TODO: support custom actions once publicly available
4338
- createElement(CombinedLinkActions, _extends({}, linkActionsProps));
4347
+ }) : createElement(CombinedLinkEntityActions, _extends({}, linkActionsProps, {
4348
+ renderCustomActions: props.renderCustomActions
4349
+ }));
4339
4350
  }));
4340
4351
  }
4341
4352