@contentful/field-editor-reference 2.21.2 → 4.0.2
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/CHANGELOG.md +76 -415
- package/dist/assets/WrappedAssetCard/AssetCardActions.d.ts +2 -2
- package/dist/assets/WrappedAssetCard/FetchingWrappedAssetCard.d.ts +3 -3
- package/dist/assets/WrappedAssetCard/WrappedAssetCard.d.ts +3 -3
- package/dist/assets/WrappedAssetCard/WrappedAssetLink.d.ts +3 -3
- package/dist/common/customCardTypes.d.ts +2 -2
- package/dist/components/CreateEntryLinkButton/CreateEntryLinkButton.d.ts +2 -3
- package/dist/components/CreateEntryLinkButton/CreateEntryMenuTrigger.d.ts +2 -3
- package/dist/components/ScheduledIconWithTooltip/ScheduleTooltip.d.ts +2 -2
- package/dist/components/index.d.ts +1 -1
- package/dist/entries/WrappedEntryCard/FetchingWrappedEntryCard.d.ts +3 -3
- package/dist/entries/WrappedEntryCard/WrappedEntryCard.d.ts +3 -3
- package/dist/field-editor-reference.cjs.development.js +270 -355
- package/dist/field-editor-reference.cjs.development.js.map +1 -1
- package/dist/field-editor-reference.cjs.production.min.js +1 -1
- package/dist/field-editor-reference.cjs.production.min.js.map +1 -1
- package/dist/field-editor-reference.esm.js +258 -343
- package/dist/field-editor-reference.esm.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/types.d.ts +5 -0
- package/package.json +7 -6
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import React__default, {
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import tokens from '@contentful/forma-36-tokens';
|
|
1
|
+
import React__default, { useState, useRef, useEffect, createElement, Fragment, useMemo, useCallback, useReducer } from 'react';
|
|
2
|
+
import { css } from 'emotion';
|
|
3
|
+
import tokens from '@contentful/f36-tokens';
|
|
5
4
|
import get from 'lodash-es/get';
|
|
5
|
+
import { SearchIcon, PlusIcon, ChevronDownIcon, LinkIcon, CloseIcon, ClockIcon } from '@contentful/f36-icons';
|
|
6
|
+
import { Menu, TextInput, Button, Paragraph, Card, SectionHeading, IconButton, Tooltip, EntryCard, MenuItem, MenuDivider, Text, AssetCard } from '@contentful/f36-components';
|
|
6
7
|
import moment from 'moment';
|
|
7
8
|
import deepEqual from 'deep-equal';
|
|
8
9
|
import { FieldConnector, isValidImage, entityHelpers, shortenStorageUnit } from '@contentful/field-editor-shared';
|
|
@@ -93,21 +94,20 @@ var action = /*#__PURE__*/css({
|
|
|
93
94
|
fontWeight: 'bold'
|
|
94
95
|
});
|
|
95
96
|
|
|
96
|
-
var useGlobalMouseUp = function useGlobalMouseUp(handler) {
|
|
97
|
-
useEffect(function () {
|
|
98
|
-
document.addEventListener('mouseup', handler);
|
|
99
|
-
return function () {
|
|
100
|
-
return document.removeEventListener('mouseup', handler);
|
|
101
|
-
};
|
|
102
|
-
}, [handler]);
|
|
103
|
-
};
|
|
104
|
-
|
|
105
97
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
106
98
|
var MAX_ITEMS_WITHOUT_SEARCH = 20;
|
|
99
|
+
var menuPlacementMap = {
|
|
100
|
+
'bottom-left': 'bottom-start',
|
|
101
|
+
'bottom-right': 'bottom-end'
|
|
102
|
+
};
|
|
107
103
|
var styles = {
|
|
108
104
|
wrapper: /*#__PURE__*/css({
|
|
109
105
|
position: 'relative'
|
|
110
106
|
}),
|
|
107
|
+
inputWrapper: /*#__PURE__*/css({
|
|
108
|
+
position: 'relative',
|
|
109
|
+
padding: "0 " + tokens.spacing2Xs
|
|
110
|
+
}),
|
|
111
111
|
searchInput: function searchInput(parentHasDropdown) {
|
|
112
112
|
return css({
|
|
113
113
|
'& > input': {
|
|
@@ -147,7 +147,7 @@ var CreateEntryMenuTrigger = function CreateEntryMenuTrigger(_ref) {
|
|
|
147
147
|
dropdownSettings = _ref$dropdownSettings === void 0 ? {
|
|
148
148
|
position: 'bottom-left'
|
|
149
149
|
} : _ref$dropdownSettings,
|
|
150
|
-
|
|
150
|
+
customDropdownItems = _ref.customDropdownItems,
|
|
151
151
|
children = _ref.children;
|
|
152
152
|
|
|
153
153
|
var _useState = useState(false),
|
|
@@ -164,7 +164,7 @@ var CreateEntryMenuTrigger = function CreateEntryMenuTrigger(_ref) {
|
|
|
164
164
|
|
|
165
165
|
var wrapper = useRef(null);
|
|
166
166
|
var textField = useRef(null);
|
|
167
|
-
var
|
|
167
|
+
var menuListRef = useRef(null);
|
|
168
168
|
/*
|
|
169
169
|
By default, dropdown wraps it's content, so it's width = the width of the widest item
|
|
170
170
|
During search, menu items change, and so the widest menu item can change
|
|
@@ -174,11 +174,11 @@ var CreateEntryMenuTrigger = function CreateEntryMenuTrigger(_ref) {
|
|
|
174
174
|
That it had on initial mount and that fits any menu item in has
|
|
175
175
|
*/
|
|
176
176
|
|
|
177
|
-
var _useState4 = useState(
|
|
177
|
+
var _useState4 = useState(),
|
|
178
178
|
dropdownWidth = _useState4[0],
|
|
179
179
|
setDropdownWidth = _useState4[1];
|
|
180
180
|
|
|
181
|
-
var hasDropdown = contentTypes.length > 1 || !!
|
|
181
|
+
var hasDropdown = contentTypes.length > 1 || !!customDropdownItems;
|
|
182
182
|
|
|
183
183
|
var closeMenu = function closeMenu() {
|
|
184
184
|
return setOpen(false);
|
|
@@ -189,10 +189,19 @@ var CreateEntryMenuTrigger = function CreateEntryMenuTrigger(_ref) {
|
|
|
189
189
|
setTimeout(function () {
|
|
190
190
|
var _textField$current, _textField$current$qu;
|
|
191
191
|
|
|
192
|
-
|
|
192
|
+
(_textField$current = textField.current) == null ? void 0 : (_textField$current$qu = _textField$current.querySelector('input')) == null ? void 0 : _textField$current$qu.focus({
|
|
193
|
+
preventScroll: true
|
|
194
|
+
});
|
|
193
195
|
}, 200);
|
|
194
196
|
}
|
|
195
197
|
}, [isOpen]);
|
|
198
|
+
useEffect(function () {
|
|
199
|
+
if (isOpen && !dropdownWidth) {
|
|
200
|
+
var _menuListRef$current;
|
|
201
|
+
|
|
202
|
+
setDropdownWidth((_menuListRef$current = menuListRef.current) == null ? void 0 : _menuListRef$current.clientWidth);
|
|
203
|
+
}
|
|
204
|
+
}, [isOpen, dropdownWidth]);
|
|
196
205
|
|
|
197
206
|
var handleSelect = function handleSelect(item) {
|
|
198
207
|
closeMenu();
|
|
@@ -208,20 +217,14 @@ var CreateEntryMenuTrigger = function CreateEntryMenuTrigger(_ref) {
|
|
|
208
217
|
}
|
|
209
218
|
};
|
|
210
219
|
|
|
211
|
-
var
|
|
220
|
+
var handleMenuOpen = function handleMenuOpen() {
|
|
212
221
|
if (hasDropdown) {
|
|
213
|
-
setOpen(
|
|
222
|
+
setOpen(true);
|
|
214
223
|
} else {
|
|
215
224
|
handleSelect(contentTypes[0]);
|
|
216
225
|
}
|
|
217
226
|
};
|
|
218
227
|
|
|
219
|
-
var mouseUpHandler = useCallback(function (event) {
|
|
220
|
-
if (wrapper && wrapper.current && dropdownRef && dropdownRef.current && !wrapper.current.contains(event.target) && !dropdownRef.current.contains(event.target)) {
|
|
221
|
-
closeMenu();
|
|
222
|
-
}
|
|
223
|
-
}, [wrapper]);
|
|
224
|
-
useGlobalMouseUp(mouseUpHandler);
|
|
225
228
|
useEffect(function () {
|
|
226
229
|
if (!isOpen) {
|
|
227
230
|
setSearchInput('');
|
|
@@ -229,8 +232,7 @@ var CreateEntryMenuTrigger = function CreateEntryMenuTrigger(_ref) {
|
|
|
229
232
|
}, [isOpen]);
|
|
230
233
|
|
|
231
234
|
var renderSearchResultsCount = function renderSearchResultsCount(resultsLength) {
|
|
232
|
-
return resultsLength ? React__default.createElement(
|
|
233
|
-
isTitle: true,
|
|
235
|
+
return resultsLength ? React__default.createElement(Menu.SectionTitle, {
|
|
234
236
|
testId: "add-entru-menu-search-results"
|
|
235
237
|
}, resultsLength, " result", resultsLength > 1 ? 's' : '') : null;
|
|
236
238
|
};
|
|
@@ -247,32 +249,26 @@ var CreateEntryMenuTrigger = function CreateEntryMenuTrigger(_ref) {
|
|
|
247
249
|
className: styles.wrapper,
|
|
248
250
|
ref: wrapper,
|
|
249
251
|
"data-test-id": testId
|
|
250
|
-
}, React__default.createElement(
|
|
251
|
-
|
|
252
|
-
position: dropdownSettings.position,
|
|
252
|
+
}, React__default.createElement(Menu, {
|
|
253
|
+
placement: menuPlacementMap[dropdownSettings.position],
|
|
253
254
|
isAutoalignmentEnabled: dropdownSettings.isAutoalignmentEnabled,
|
|
254
|
-
isOpen: isOpen
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
getContainerRef: function getContainerRef(ref) {
|
|
262
|
-
dropdownRef.current = ref;
|
|
263
|
-
|
|
264
|
-
if (!dropdownWidth && ref) {
|
|
265
|
-
setDropdownWidth(ref.clientWidth);
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
}, renderCustomDropdownItems && React__default.createElement(DropdownList, {
|
|
255
|
+
isOpen: isOpen,
|
|
256
|
+
onClose: closeMenu,
|
|
257
|
+
onOpen: handleMenuOpen
|
|
258
|
+
}, React__default.createElement(Menu.Trigger, null, children({
|
|
259
|
+
isOpen: isOpen,
|
|
260
|
+
isSelecting: isSelecting
|
|
261
|
+
})), isOpen && React__default.createElement(Menu.List, {
|
|
269
262
|
className: styles.dropdownList,
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
263
|
+
style: {
|
|
264
|
+
width: dropdownWidth != undefined ? dropdownWidth + "px" : undefined,
|
|
265
|
+
maxHeight: maxDropdownHeight + "px"
|
|
266
|
+
},
|
|
267
|
+
ref: menuListRef,
|
|
268
|
+
testId: "add-entry-menu"
|
|
269
|
+
}, Boolean(customDropdownItems) && React__default.createElement(React__default.Fragment, null, customDropdownItems, React__default.createElement(Menu.Divider, null)), isSearchable && React__default.createElement(React__default.Fragment, null, React__default.createElement("div", {
|
|
274
270
|
ref: textField,
|
|
275
|
-
className: styles.
|
|
271
|
+
className: styles.inputWrapper
|
|
276
272
|
}, React__default.createElement(TextInput, {
|
|
277
273
|
className: styles.searchInput(hasDropdown),
|
|
278
274
|
placeholder: "Search all content types",
|
|
@@ -281,37 +277,22 @@ var CreateEntryMenuTrigger = function CreateEntryMenuTrigger(_ref) {
|
|
|
281
277
|
onChange: function onChange(e) {
|
|
282
278
|
return setSearchInput(e.target.value);
|
|
283
279
|
}
|
|
284
|
-
}), React__default.createElement(
|
|
285
|
-
icon: "Search",
|
|
280
|
+
}), React__default.createElement(SearchIcon, {
|
|
286
281
|
className: styles.searchIcon
|
|
287
|
-
})), React__default.createElement(
|
|
288
|
-
className: styles.dropdownList,
|
|
289
|
-
border: "top",
|
|
290
|
-
styles: {
|
|
291
|
-
width: dropdownWidth || '',
|
|
292
|
-
maxHeight: maxDropdownHeight
|
|
293
|
-
},
|
|
294
|
-
maxHeight: maxDropdownHeight
|
|
295
|
-
}, searchInput && renderSearchResultsCount(filteredContentTypes.length), suggestedContentType && !searchInput && React__default.createElement(React__default.Fragment, null, React__default.createElement(DropdownListItem, {
|
|
296
|
-
isTitle: true
|
|
297
|
-
}, "Suggested Content Type"), React__default.createElement(DropdownListItem, {
|
|
282
|
+
})), React__default.createElement(Menu.Divider, null)), searchInput && renderSearchResultsCount(filteredContentTypes.length), suggestedContentType && !searchInput && React__default.createElement(React__default.Fragment, null, React__default.createElement(Menu.SectionTitle, null, "Suggested Content Type"), React__default.createElement(Menu.Item, {
|
|
298
283
|
testId: "suggested",
|
|
299
284
|
onClick: function onClick() {
|
|
300
285
|
return handleSelect(suggestedContentType);
|
|
301
286
|
}
|
|
302
|
-
}, get(suggestedContentType, 'name')), React__default.createElement(
|
|
303
|
-
|
|
304
|
-
})), !searchInput && React__default.createElement(DropdownListItem, {
|
|
305
|
-
isTitle: true
|
|
306
|
-
}, contentTypesLabel), filteredContentTypes.length ? filteredContentTypes.map(function (contentType, i) {
|
|
307
|
-
return React__default.createElement(DropdownListItem, {
|
|
287
|
+
}, get(suggestedContentType, 'name')), React__default.createElement(Menu.Divider, null)), !searchInput && React__default.createElement(Menu.SectionTitle, null, contentTypesLabel), filteredContentTypes.length ? filteredContentTypes.map(function (contentType, i) {
|
|
288
|
+
return React__default.createElement(Menu.Item, {
|
|
308
289
|
testId: "contentType",
|
|
309
290
|
key: get(contentType, 'name') + "-" + i,
|
|
310
291
|
onClick: function onClick() {
|
|
311
292
|
return handleSelect(contentType);
|
|
312
293
|
}
|
|
313
294
|
}, get(contentType, 'name', 'Untitled'));
|
|
314
|
-
}) : React__default.createElement(
|
|
295
|
+
}) : React__default.createElement(Menu.Item, {
|
|
315
296
|
testId: "add-entru-menu-search-results"
|
|
316
297
|
}, "No results found"))));
|
|
317
298
|
};
|
|
@@ -337,7 +318,7 @@ var redesignStyles = /*#__PURE__*/_extends({}, standardStyles, {
|
|
|
337
318
|
var CreateEntryLinkButton = function CreateEntryLinkButton(_ref) {
|
|
338
319
|
var contentTypes = _ref.contentTypes,
|
|
339
320
|
onSelect = _ref.onSelect,
|
|
340
|
-
|
|
321
|
+
customDropdownItems = _ref.customDropdownItems,
|
|
341
322
|
text = _ref.text,
|
|
342
323
|
testId = _ref.testId,
|
|
343
324
|
_ref$hasPlusIcon = _ref.hasPlusIcon,
|
|
@@ -351,9 +332,9 @@ var CreateEntryLinkButton = function CreateEntryLinkButton(_ref) {
|
|
|
351
332
|
return ct.sys.id === suggestedContentTypeId;
|
|
352
333
|
});
|
|
353
334
|
var buttonText = text || "Add " + get(suggestedContentType || (contentTypes.length === 1 ? contentTypes[0] : {}), 'name', 'entry');
|
|
354
|
-
var hasDropdown = contentTypes.length > 1 ||
|
|
335
|
+
var hasDropdown = contentTypes.length > 1 || customDropdownItems; // TODO: Introduce `icon: string` and remove `hasPlusIcon` or remove "Plus" if we keep new layout.
|
|
355
336
|
|
|
356
|
-
var plusIcon = hasPlusIcon ?
|
|
337
|
+
var plusIcon = hasPlusIcon ? React__default.createElement(PlusIcon, null) : undefined; // TODO: Always use "New content" here if we fully switch to new layout.
|
|
357
338
|
|
|
358
339
|
var contentTypesLabel = useExperimentalStyles ? 'New content' : undefined;
|
|
359
340
|
var styles = useExperimentalStyles ? redesignStyles : standardStyles;
|
|
@@ -364,26 +345,19 @@ var CreateEntryLinkButton = function CreateEntryLinkButton(_ref) {
|
|
|
364
345
|
onSelect: onSelect,
|
|
365
346
|
testId: testId,
|
|
366
347
|
dropdownSettings: dropdownSettings,
|
|
367
|
-
|
|
348
|
+
customDropdownItems: customDropdownItems
|
|
368
349
|
}, function (_ref2) {
|
|
369
|
-
var
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
key: "spinner",
|
|
374
|
-
className: styles.spinnerMargin
|
|
375
|
-
}), React__default.createElement(Button, {
|
|
376
|
-
buttonType: "muted",
|
|
377
|
-
onClick: function onClick() {
|
|
378
|
-
openMenu();
|
|
379
|
-
},
|
|
350
|
+
var isSelecting = _ref2.isSelecting;
|
|
351
|
+
return React__default.createElement(Button, {
|
|
352
|
+
endIcon: hasDropdown ? React__default.createElement(ChevronDownIcon, null) : undefined,
|
|
353
|
+
variant: "secondary",
|
|
380
354
|
className: styles.action,
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
indicateDropdown: Boolean(hasDropdown),
|
|
355
|
+
isDisabled: disabled || isSelecting || contentTypes && contentTypes.length === 0,
|
|
356
|
+
startIcon: isSelecting ? undefined : plusIcon,
|
|
384
357
|
size: "small",
|
|
385
|
-
testId: "create-entry-link-button"
|
|
386
|
-
|
|
358
|
+
testId: "create-entry-link-button",
|
|
359
|
+
isLoading: isSelecting
|
|
360
|
+
}, buttonText);
|
|
387
361
|
});
|
|
388
362
|
};
|
|
389
363
|
|
|
@@ -445,24 +419,24 @@ function LinkActions(props) {
|
|
|
445
419
|
return contentTypeId ? props.onCreate(contentTypeId, props.itemsLength) : Promise.resolve();
|
|
446
420
|
}
|
|
447
421
|
}), props.entityType === 'Asset' && createElement(Button, {
|
|
448
|
-
|
|
422
|
+
isDisabled: props.isDisabled,
|
|
449
423
|
testId: testIds.createAndLink,
|
|
450
424
|
onClick: function onClick() {
|
|
451
425
|
props.onCreate(undefined, props.itemsLength);
|
|
452
426
|
},
|
|
453
|
-
|
|
454
|
-
|
|
427
|
+
variant: "secondary",
|
|
428
|
+
startIcon: createElement(PlusIcon, null),
|
|
455
429
|
size: "small"
|
|
456
430
|
}, labels.createNew()), createElement("span", {
|
|
457
431
|
className: separator
|
|
458
432
|
})), props.canLinkEntity && createElement(Button, {
|
|
459
|
-
|
|
433
|
+
isDisabled: props.isDisabled,
|
|
460
434
|
testId: testIds.linkExisting,
|
|
461
435
|
onClick: function onClick() {
|
|
462
436
|
props.onLinkExisting();
|
|
463
437
|
},
|
|
464
|
-
|
|
465
|
-
|
|
438
|
+
variant: "secondary",
|
|
439
|
+
startIcon: createElement(LinkIcon, null),
|
|
466
440
|
size: "small"
|
|
467
441
|
}, labels.linkExisting({
|
|
468
442
|
canLinkMultiple: props.canLinkMultiple
|
|
@@ -510,27 +484,23 @@ function CombinedEntryLinkActions(props) {
|
|
|
510
484
|
onSelect: function onSelect(contentTypeId) {
|
|
511
485
|
return contentTypeId ? props.onCreate(contentTypeId) : Promise.resolve();
|
|
512
486
|
},
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
props.onLinkExisting();
|
|
520
|
-
}
|
|
521
|
-
}, "Add existing content");
|
|
522
|
-
} : undefined
|
|
487
|
+
customDropdownItems: props.canLinkEntity ? createElement(Menu.Item, {
|
|
488
|
+
testId: testIds$1.linkExisting,
|
|
489
|
+
onClick: function onClick() {
|
|
490
|
+
props.onLinkExisting();
|
|
491
|
+
}
|
|
492
|
+
}, "Add existing content") : undefined
|
|
523
493
|
});
|
|
524
494
|
} else if (props.canLinkEntity) {
|
|
525
495
|
return createElement(Button, {
|
|
526
|
-
|
|
496
|
+
isDisabled: props.isDisabled,
|
|
527
497
|
testId: testIds$1.linkExisting,
|
|
528
498
|
className: action,
|
|
529
499
|
onClick: function onClick() {
|
|
530
500
|
props.onLinkExisting();
|
|
531
501
|
},
|
|
532
|
-
|
|
533
|
-
|
|
502
|
+
variant: "secondary",
|
|
503
|
+
startIcon: createElement(LinkIcon, null),
|
|
534
504
|
size: "small"
|
|
535
505
|
}, "Add existing content");
|
|
536
506
|
}
|
|
@@ -546,28 +516,28 @@ function CombinedAssetLinkActions(props) {
|
|
|
546
516
|
if (!props.canLinkEntity || !props.canCreateEntity) {
|
|
547
517
|
if (props.canLinkEntity) {
|
|
548
518
|
return createElement(Button, {
|
|
549
|
-
|
|
519
|
+
isDisabled: props.isDisabled,
|
|
550
520
|
testId: testIds$1.linkExisting,
|
|
551
521
|
className: action,
|
|
552
522
|
onClick: function onClick() {
|
|
553
523
|
props.onLinkExisting();
|
|
554
524
|
},
|
|
555
|
-
|
|
556
|
-
|
|
525
|
+
variant: "secondary",
|
|
526
|
+
startIcon: createElement(PlusIcon, null),
|
|
557
527
|
size: "small"
|
|
558
528
|
}, "Add existing media");
|
|
559
529
|
}
|
|
560
530
|
|
|
561
531
|
if (props.canCreateEntity) {
|
|
562
532
|
return createElement(Button, {
|
|
563
|
-
|
|
533
|
+
isDisabled: props.isDisabled,
|
|
564
534
|
testId: testIds$1.createAndLink,
|
|
565
535
|
className: action,
|
|
566
536
|
onClick: function onClick() {
|
|
567
537
|
props.onCreate();
|
|
568
538
|
},
|
|
569
|
-
|
|
570
|
-
|
|
539
|
+
variant: "secondary",
|
|
540
|
+
startIcon: createElement(PlusIcon, null),
|
|
571
541
|
size: "small"
|
|
572
542
|
}, "Add media");
|
|
573
543
|
}
|
|
@@ -577,35 +547,32 @@ function CombinedAssetLinkActions(props) {
|
|
|
577
547
|
// that works without content types to cover asset use-case.
|
|
578
548
|
|
|
579
549
|
|
|
580
|
-
return createElement(
|
|
550
|
+
return createElement(Menu, {
|
|
581
551
|
isOpen: isOpen,
|
|
582
552
|
onClose: function onClose() {
|
|
583
|
-
|
|
553
|
+
setOpen(false);
|
|
584
554
|
},
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
}, createElement(DropdownList, {
|
|
555
|
+
onOpen: function onOpen() {
|
|
556
|
+
setOpen(true);
|
|
557
|
+
}
|
|
558
|
+
}, createElement(Menu.Trigger, null, createElement(Button, {
|
|
559
|
+
endIcon: createElement(ChevronDownIcon, null),
|
|
560
|
+
isDisabled: props.isDisabled,
|
|
561
|
+
testId: testIds$1.actionsWrapper,
|
|
562
|
+
className: action,
|
|
563
|
+
variant: "secondary",
|
|
564
|
+
startIcon: createElement(PlusIcon, null),
|
|
565
|
+
size: "small"
|
|
566
|
+
}, "Add media")), isOpen && createElement(Menu.List, {
|
|
598
567
|
testId: testIds$1.dropdown
|
|
599
|
-
}, createElement(
|
|
568
|
+
}, createElement(Menu.Item, {
|
|
600
569
|
testId: testIds$1.linkExisting,
|
|
601
570
|
onClick: function onClick() {
|
|
602
|
-
setOpen(false);
|
|
603
571
|
props.onLinkExisting();
|
|
604
572
|
}
|
|
605
|
-
}, "Add existing media"), createElement(
|
|
573
|
+
}, "Add existing media"), createElement(Menu.Item, {
|
|
606
574
|
testId: testIds$1.createAndLink,
|
|
607
575
|
onClick: function onClick() {
|
|
608
|
-
setOpen(false);
|
|
609
576
|
props.onCreate();
|
|
610
577
|
}
|
|
611
578
|
}, "Add new media")));
|
|
@@ -632,13 +599,15 @@ function MissingEntityCard(props) {
|
|
|
632
599
|
className: card
|
|
633
600
|
}, React__default.createElement("div", {
|
|
634
601
|
className: props.asSquare ? squareCard : ''
|
|
635
|
-
}, React__default.createElement(SectionHeading,
|
|
602
|
+
}, React__default.createElement(SectionHeading, {
|
|
603
|
+
marginBottom: "none"
|
|
604
|
+
}, props.entityType === 'Entry' && 'Entry is missing or inaccessible', props.entityType === 'Asset' && 'Asset is missing or inaccessible')), !props.isDisabled && props.onRemove && React__default.createElement(IconButton, {
|
|
605
|
+
variant: "transparent",
|
|
606
|
+
icon: React__default.createElement(CloseIcon, {
|
|
607
|
+
variant: "muted"
|
|
608
|
+
}),
|
|
636
609
|
className: close,
|
|
637
|
-
|
|
638
|
-
label: "Delete",
|
|
639
|
-
iconProps: {
|
|
640
|
-
icon: 'Close'
|
|
641
|
-
},
|
|
610
|
+
"aria-label": "Delete",
|
|
642
611
|
onClick: function onClick() {
|
|
643
612
|
props.onRemove && props.onRemove();
|
|
644
613
|
}
|
|
@@ -1773,67 +1742,20 @@ var formatDateAndTime = function formatDateAndTime(date, _short2) {
|
|
|
1773
1742
|
return formatDate(date, _short2) + " at " + formatTime(date);
|
|
1774
1743
|
};
|
|
1775
1744
|
|
|
1776
|
-
var
|
|
1777
|
-
// @ts-expect-error
|
|
1778
|
-
statusTag: /*#__PURE__*/css({
|
|
1779
|
-
marginLeft: tokens.spacingM,
|
|
1780
|
-
zIndex: '0 !important'
|
|
1781
|
-
}),
|
|
1782
|
-
positiveColor: /*#__PURE__*/css({
|
|
1783
|
-
color: tokens.colorPositive
|
|
1784
|
-
}),
|
|
1785
|
-
secondaryColor: /*#__PURE__*/css({
|
|
1786
|
-
color: tokens.gray500
|
|
1787
|
-
}),
|
|
1788
|
-
marginRightXS: /*#__PURE__*/css({
|
|
1789
|
-
marginRight: tokens.spacing2Xs
|
|
1790
|
-
}),
|
|
1791
|
-
paragraph: /*#__PURE__*/css({
|
|
1792
|
-
textAlign: 'center',
|
|
1793
|
-
color: tokens.gray500
|
|
1794
|
-
}),
|
|
1795
|
-
time: /*#__PURE__*/css({
|
|
1796
|
-
color: tokens.gray200
|
|
1797
|
-
})
|
|
1798
|
-
};
|
|
1799
|
-
var ScheduleTooltipContent = function ScheduleTooltipContent(_ref) {
|
|
1745
|
+
var getScheduleTooltipContent = function getScheduleTooltipContent(_ref) {
|
|
1800
1746
|
var job = _ref.job,
|
|
1801
1747
|
jobsCount = _ref.jobsCount;
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
switch (job.action.toLowerCase()) {
|
|
1805
|
-
case 'publish':
|
|
1806
|
-
colorPalette = styles$1.positiveColor;
|
|
1807
|
-
break;
|
|
1808
|
-
|
|
1809
|
-
case 'unpublish':
|
|
1810
|
-
colorPalette = styles$1.secondaryColor;
|
|
1811
|
-
break;
|
|
1812
|
-
|
|
1813
|
-
default:
|
|
1814
|
-
colorPalette = styles$1.secondaryColor;
|
|
1815
|
-
}
|
|
1816
|
-
|
|
1817
|
-
return React__default.createElement(React__default.Fragment, null, React__default.createElement("span", {
|
|
1818
|
-
className: styles$1.time,
|
|
1819
|
-
"data-test-id": "cf-scheduled-time-tootlip-content"
|
|
1820
|
-
}, formatDateAndTime(job.scheduledFor.datetime)), React__default.createElement(Tag, {
|
|
1821
|
-
tagType: job.action === 'publish' ? 'positive' : 'secondary',
|
|
1822
|
-
testId: "scheduled-publish-trigger",
|
|
1823
|
-
className: cx(styles$1.statusTag, colorPalette)
|
|
1824
|
-
}, job.action.toUpperCase()), jobsCount > 1 && React__default.createElement(Paragraph, {
|
|
1825
|
-
className: styles$1.paragraph
|
|
1826
|
-
}, "+ ", jobsCount - 1, " more"));
|
|
1748
|
+
return "Will " + job.action.toLowerCase() + " " + formatDateAndTime(job.scheduledFor.datetime).toLowerCase() + "\n " + (jobsCount > 1 && "+ " + (jobsCount - 1) + " more");
|
|
1827
1749
|
};
|
|
1828
1750
|
var ScheduleTooltip = function ScheduleTooltip(_ref2) {
|
|
1829
1751
|
var job = _ref2.job,
|
|
1830
1752
|
jobsCount = _ref2.jobsCount,
|
|
1831
1753
|
children = _ref2.children;
|
|
1832
1754
|
return React__default.createElement(Tooltip, {
|
|
1833
|
-
|
|
1755
|
+
placement: "top",
|
|
1834
1756
|
testId: job.sys.id,
|
|
1835
|
-
|
|
1836
|
-
content:
|
|
1757
|
+
as: "div",
|
|
1758
|
+
content: getScheduleTooltipContent({
|
|
1837
1759
|
job: job,
|
|
1838
1760
|
jobsCount: jobsCount
|
|
1839
1761
|
})
|
|
@@ -2489,7 +2411,7 @@ var getEntryTitle = entityHelpers.getEntryTitle,
|
|
|
2489
2411
|
getEntityDescription = entityHelpers.getEntityDescription,
|
|
2490
2412
|
getEntryStatus = entityHelpers.getEntryStatus,
|
|
2491
2413
|
getEntryImage = entityHelpers.getEntryImage;
|
|
2492
|
-
var styles$
|
|
2414
|
+
var styles$1 = {
|
|
2493
2415
|
scheduleIcon: /*#__PURE__*/css({
|
|
2494
2416
|
marginRight: tokens.spacing2Xs
|
|
2495
2417
|
})
|
|
@@ -2544,75 +2466,61 @@ function WrappedEntryCard(props) {
|
|
|
2544
2466
|
localeCode: props.localeCode,
|
|
2545
2467
|
defaultLocaleCode: props.defaultLocaleCode
|
|
2546
2468
|
});
|
|
2547
|
-
return (
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
// @ts-expect-error
|
|
2576
|
-
onClick: function onClick(e) {
|
|
2577
|
-
e.stopPropagation();
|
|
2578
|
-
}
|
|
2579
|
-
}, props.hasCardEditActions && props.onEdit && createElement(DropdownListItem, {
|
|
2580
|
-
onClick: function onClick() {
|
|
2581
|
-
props.onEdit && props.onEdit();
|
|
2582
|
-
},
|
|
2583
|
-
testId: "edit"
|
|
2584
|
-
}, "Edit"), props.onRemove && createElement(DropdownListItem, {
|
|
2585
|
-
onClick: function onClick() {
|
|
2586
|
-
props.onRemove && props.onRemove();
|
|
2587
|
-
},
|
|
2588
|
-
isDisabled: props.isDisabled,
|
|
2589
|
-
testId: "delete"
|
|
2590
|
-
}, "Remove")), props.hasMoveOptions ? createElement(DropdownList, {
|
|
2591
|
-
border: "top",
|
|
2592
|
-
// @ts-expect-error
|
|
2593
|
-
onClick: function onClick(e) {
|
|
2594
|
-
e.stopPropagation();
|
|
2595
|
-
}
|
|
2596
|
-
}, createElement(DropdownListItem, {
|
|
2597
|
-
onClick: function onClick() {
|
|
2598
|
-
return props.onMoveTop && props.onMoveTop();
|
|
2599
|
-
},
|
|
2600
|
-
isDisabled: !props.onMoveTop,
|
|
2601
|
-
testId: "move-top"
|
|
2602
|
-
}, "Move to top"), createElement(DropdownListItem, {
|
|
2603
|
-
onClick: function onClick() {
|
|
2604
|
-
return props.onMoveBottom && props.onMoveBottom();
|
|
2605
|
-
},
|
|
2606
|
-
isDisabled: !props.onMoveBottom,
|
|
2607
|
-
testId: "move-bottom"
|
|
2608
|
-
}, "Move to bottom")) : createElement(Fragment, null)) : undefined,
|
|
2609
|
-
onClick: function onClick(e) {
|
|
2610
|
-
e.preventDefault();
|
|
2611
|
-
if (!props.isClickable) return;
|
|
2469
|
+
return createElement(EntryCard, {
|
|
2470
|
+
as: props.entryUrl ? 'a' : 'article',
|
|
2471
|
+
href: props.entryUrl,
|
|
2472
|
+
title: title,
|
|
2473
|
+
description: description,
|
|
2474
|
+
contentType: contentType == null ? void 0 : contentType.name,
|
|
2475
|
+
size: props.size,
|
|
2476
|
+
isSelected: props.isSelected,
|
|
2477
|
+
status: status,
|
|
2478
|
+
icon: createElement(ScheduledIconWithTooltip, {
|
|
2479
|
+
getEntityScheduledActions: props.getEntityScheduledActions,
|
|
2480
|
+
entityType: "Entry",
|
|
2481
|
+
entityId: props.entry.sys.id
|
|
2482
|
+
}, createElement(ClockIcon, {
|
|
2483
|
+
className: styles$1.scheduleIcon,
|
|
2484
|
+
size: "small",
|
|
2485
|
+
variant: "muted",
|
|
2486
|
+
testId: "schedule-icon"
|
|
2487
|
+
})),
|
|
2488
|
+
thumbnailElement: file && isValidImage(file) ? createElement(AssetThumbnail, {
|
|
2489
|
+
file: file
|
|
2490
|
+
}) : undefined,
|
|
2491
|
+
dragHandleRender: props.renderDragHandle,
|
|
2492
|
+
withDragHandle: !!props.renderDragHandle,
|
|
2493
|
+
actions: props.onEdit || props.onRemove ? [props.hasCardEditActions && props.onEdit ? createElement(MenuItem, {
|
|
2494
|
+
key: "edit",
|
|
2495
|
+
testId: "edit",
|
|
2496
|
+
onClick: function onClick() {
|
|
2612
2497
|
props.onEdit && props.onEdit();
|
|
2613
2498
|
}
|
|
2614
|
-
})
|
|
2615
|
-
|
|
2499
|
+
}, "Edit") : null, props.onRemove ? createElement(MenuItem, {
|
|
2500
|
+
key: "delete",
|
|
2501
|
+
testId: "delete",
|
|
2502
|
+
onClick: function onClick() {
|
|
2503
|
+
props.onRemove && props.onRemove();
|
|
2504
|
+
}
|
|
2505
|
+
}, "Remove") : null, props.hasMoveOptions && (props.onMoveTop || props.onMoveBottom) ? createElement(MenuDivider, null) : null, props.hasMoveOptions && props.onMoveTop ? createElement(MenuItem, {
|
|
2506
|
+
onClick: function onClick() {
|
|
2507
|
+
return props.onMoveTop && props.onMoveTop();
|
|
2508
|
+
},
|
|
2509
|
+
testId: "move-top"
|
|
2510
|
+
}, "Move to top") : null, props.hasMoveOptions && props.onMoveBottom ? createElement(MenuItem, {
|
|
2511
|
+
onClick: function onClick() {
|
|
2512
|
+
return props.onMoveBottom && props.onMoveBottom();
|
|
2513
|
+
},
|
|
2514
|
+
testId: "move-bottom"
|
|
2515
|
+
}, "Move to bottom") : null].filter(function (item) {
|
|
2516
|
+
return item;
|
|
2517
|
+
}) : [],
|
|
2518
|
+
onClick: function onClick(e) {
|
|
2519
|
+
e.preventDefault();
|
|
2520
|
+
if (!props.isClickable) return;
|
|
2521
|
+
props.onEdit && props.onEdit();
|
|
2522
|
+
}
|
|
2523
|
+
});
|
|
2616
2524
|
}
|
|
2617
2525
|
WrappedEntryCard.defaultProps = defaultProps;
|
|
2618
2526
|
|
|
@@ -2763,7 +2671,7 @@ function FetchingWrappedEntryCard(props) {
|
|
|
2763
2671
|
if (entry === undefined) {
|
|
2764
2672
|
return createElement(EntryCard, {
|
|
2765
2673
|
size: size,
|
|
2766
|
-
|
|
2674
|
+
isLoading: true
|
|
2767
2675
|
});
|
|
2768
2676
|
}
|
|
2769
2677
|
|
|
@@ -2778,7 +2686,7 @@ function FetchingWrappedEntryCard(props) {
|
|
|
2778
2686
|
size: size,
|
|
2779
2687
|
localeCode: props.sdk.field.locale,
|
|
2780
2688
|
defaultLocaleCode: props.sdk.locales["default"],
|
|
2781
|
-
|
|
2689
|
+
renderDragHandle: props.renderDragHandle,
|
|
2782
2690
|
onEdit: onEdit,
|
|
2783
2691
|
onRemove: onRemoveEntry,
|
|
2784
2692
|
onMoveTop: props.onMoveTop,
|
|
@@ -2935,7 +2843,7 @@ MultipleReferenceEditor.defaultProps = {
|
|
|
2935
2843
|
hasCardEditActions: true
|
|
2936
2844
|
};
|
|
2937
2845
|
|
|
2938
|
-
var styles$
|
|
2846
|
+
var styles$2 = {
|
|
2939
2847
|
containter: /*#__PURE__*/css({
|
|
2940
2848
|
position: 'relative'
|
|
2941
2849
|
}),
|
|
@@ -2943,18 +2851,23 @@ var styles$3 = {
|
|
|
2943
2851
|
marginBottom: tokens.spacingM
|
|
2944
2852
|
})
|
|
2945
2853
|
};
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
|
|
2854
|
+
|
|
2855
|
+
var DragHandle = function DragHandle(props) {
|
|
2856
|
+
var SortableDragHandle = SortableHandle(function () {
|
|
2857
|
+
return props.drag;
|
|
2858
|
+
});
|
|
2859
|
+
return React__default.createElement(SortableDragHandle, null);
|
|
2860
|
+
};
|
|
2861
|
+
|
|
2949
2862
|
var SortableLink = /*#__PURE__*/SortableElement(function (props) {
|
|
2950
2863
|
return React__default.createElement("div", {
|
|
2951
|
-
className: styles$
|
|
2864
|
+
className: styles$2.item
|
|
2952
2865
|
}, props.children);
|
|
2953
2866
|
});
|
|
2954
2867
|
var SortableLinkList = /*#__PURE__*/SortableContainer(function (props) {
|
|
2955
2868
|
var lastIndex = props.items.length - 1;
|
|
2956
2869
|
return React__default.createElement("div", {
|
|
2957
|
-
className: styles$
|
|
2870
|
+
className: styles$2.containter
|
|
2958
2871
|
}, props.items.map(function (item, index) {
|
|
2959
2872
|
return React__default.createElement(SortableLink, {
|
|
2960
2873
|
disabled: props.isDisabled,
|
|
@@ -2977,7 +2890,7 @@ var SortableLinkList = /*#__PURE__*/SortableContainer(function (props) {
|
|
|
2977
2890
|
onMoveBottom: index !== lastIndex ? function () {
|
|
2978
2891
|
return props.onMove(index, lastIndex);
|
|
2979
2892
|
} : undefined,
|
|
2980
|
-
|
|
2893
|
+
renderDragHandle: props.isDisabled ? undefined : DragHandle
|
|
2981
2894
|
})));
|
|
2982
2895
|
}));
|
|
2983
2896
|
});
|
|
@@ -2993,17 +2906,6 @@ function MultipleEntryReferenceEditor(props) {
|
|
|
2993
2906
|
});
|
|
2994
2907
|
}
|
|
2995
2908
|
|
|
2996
|
-
var styles$4 = {
|
|
2997
|
-
cardDropdown: /*#__PURE__*/css({
|
|
2998
|
-
width: '300px'
|
|
2999
|
-
}),
|
|
3000
|
-
truncated: /*#__PURE__*/css({
|
|
3001
|
-
overflow: 'hidden',
|
|
3002
|
-
whiteSpace: 'nowrap',
|
|
3003
|
-
textOverflow: 'ellipsis'
|
|
3004
|
-
})
|
|
3005
|
-
};
|
|
3006
|
-
|
|
3007
2909
|
function downloadAsset(url) {
|
|
3008
2910
|
window.open(url, '_blank', 'noopener,noreferrer');
|
|
3009
2911
|
}
|
|
@@ -3014,47 +2916,51 @@ function renderAssetInfo(props) {
|
|
|
3014
2916
|
var mimeType = get(entityFile, 'contentType');
|
|
3015
2917
|
var fileSize = get(entityFile, 'details.size');
|
|
3016
2918
|
var image = get(entityFile, 'details.image');
|
|
3017
|
-
return React__default.createElement(
|
|
3018
|
-
|
|
3019
|
-
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
|
|
3024
|
-
|
|
3025
|
-
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
|
|
2919
|
+
return [React__default.createElement(Menu.SectionTitle, {
|
|
2920
|
+
key: "file-section"
|
|
2921
|
+
}, "File info"), fileName && React__default.createElement(Menu.Item, {
|
|
2922
|
+
key: "file-name"
|
|
2923
|
+
}, React__default.createElement(Text, {
|
|
2924
|
+
isTruncated: true
|
|
2925
|
+
}, fileName)), mimeType && React__default.createElement(Menu.Item, {
|
|
2926
|
+
key: "file-type"
|
|
2927
|
+
}, React__default.createElement(Text, {
|
|
2928
|
+
isTruncated: true
|
|
2929
|
+
}, mimeType)), fileSize && React__default.createElement(Menu.Item, {
|
|
2930
|
+
key: "file-size"
|
|
2931
|
+
}, shortenStorageUnit(fileSize, 'B')), image && React__default.createElement(Menu.Item, {
|
|
2932
|
+
key: "file-dimentions"
|
|
2933
|
+
}, image.width + " \xD7 " + image.height)].filter(function (item) {
|
|
2934
|
+
return item;
|
|
2935
|
+
});
|
|
3029
2936
|
}
|
|
3030
2937
|
function renderActions(props) {
|
|
3031
2938
|
var entityFile = props.entityFile,
|
|
3032
2939
|
isDisabled = props.isDisabled,
|
|
3033
2940
|
onEdit = props.onEdit,
|
|
3034
2941
|
onRemove = props.onRemove;
|
|
3035
|
-
return React__default.createElement(
|
|
3036
|
-
|
|
3037
|
-
|
|
3038
|
-
|
|
3039
|
-
e.stopPropagation();
|
|
3040
|
-
}
|
|
3041
|
-
}, React__default.createElement(DropdownListItem, {
|
|
3042
|
-
isTitle: true
|
|
3043
|
-
}, "Actions"), onEdit && React__default.createElement(DropdownListItem, {
|
|
2942
|
+
return [React__default.createElement(Menu.SectionTitle, {
|
|
2943
|
+
key: "section-title"
|
|
2944
|
+
}, "Actions"), onEdit ? React__default.createElement(Menu.Item, {
|
|
2945
|
+
key: "edit",
|
|
3044
2946
|
onClick: onEdit,
|
|
3045
2947
|
testId: "card-action-edit"
|
|
3046
|
-
}, "Edit"), entityFile
|
|
2948
|
+
}, "Edit") : null, entityFile ? React__default.createElement(Menu.Item, {
|
|
2949
|
+
key: "download",
|
|
3047
2950
|
onClick: function onClick() {
|
|
3048
2951
|
if (typeof entityFile.url === 'string') {
|
|
3049
2952
|
downloadAsset(entityFile.url);
|
|
3050
2953
|
}
|
|
3051
2954
|
},
|
|
3052
2955
|
testId: "card-action-download"
|
|
3053
|
-
}, "Download"), onRemove
|
|
3054
|
-
|
|
2956
|
+
}, "Download") : null, onRemove ? React__default.createElement(Menu.Item, {
|
|
2957
|
+
key: "remove",
|
|
2958
|
+
disabled: isDisabled,
|
|
3055
2959
|
onClick: onRemove,
|
|
3056
2960
|
testId: "card-action-remove"
|
|
3057
|
-
}, "Remove"))
|
|
2961
|
+
}, "Remove") : null].filter(function (item) {
|
|
2962
|
+
return item;
|
|
2963
|
+
});
|
|
3058
2964
|
}
|
|
3059
2965
|
|
|
3060
2966
|
var groupToIconMap = {
|
|
@@ -3070,7 +2976,7 @@ var groupToIconMap = {
|
|
|
3070
2976
|
code: 'code',
|
|
3071
2977
|
markup: 'markup'
|
|
3072
2978
|
};
|
|
3073
|
-
var styles$
|
|
2979
|
+
var styles$3 = {
|
|
3074
2980
|
scheduleIcon: /*#__PURE__*/css({
|
|
3075
2981
|
marginRight: tokens.spacing2Xs
|
|
3076
2982
|
})
|
|
@@ -3118,47 +3024,49 @@ var WrappedAssetCard = function WrappedAssetCard(props) {
|
|
|
3118
3024
|
defaultTitle: 'Untitled'
|
|
3119
3025
|
});
|
|
3120
3026
|
var entityFile = props.asset.fields.file ? props.asset.fields.file[props.localeCode] || props.asset.fields.file[props.defaultLocaleCode] : undefined;
|
|
3027
|
+
var href = getAssetUrl ? getAssetUrl(props.asset.sys.id) : undefined;
|
|
3121
3028
|
return React__default.createElement(AssetCard, {
|
|
3029
|
+
as: href ? 'a' : 'article',
|
|
3122
3030
|
type: getFileType(entityFile),
|
|
3123
3031
|
title: entityTitle,
|
|
3124
3032
|
className: className,
|
|
3125
|
-
|
|
3126
|
-
href:
|
|
3033
|
+
isSelected: isSelected,
|
|
3034
|
+
href: href,
|
|
3127
3035
|
status: status,
|
|
3128
|
-
|
|
3036
|
+
icon: React__default.createElement(ScheduledIconWithTooltip, {
|
|
3129
3037
|
getEntityScheduledActions: props.getEntityScheduledActions,
|
|
3130
3038
|
entityType: "Asset",
|
|
3131
3039
|
entityId: props.asset.sys.id
|
|
3132
|
-
}, React__default.createElement(
|
|
3133
|
-
className: styles$
|
|
3134
|
-
icon: "Clock",
|
|
3040
|
+
}, React__default.createElement(ClockIcon, {
|
|
3041
|
+
className: styles$3.scheduleIcon,
|
|
3135
3042
|
size: "small",
|
|
3136
|
-
|
|
3043
|
+
variant: "muted",
|
|
3137
3044
|
testId: "schedule-icon"
|
|
3138
3045
|
})),
|
|
3139
3046
|
src: entityFile && entityFile.url ? size === 'small' ? entityFile.url + "?w=150&h=150&fit=thumb" : entityFile.url + "?h=300" : '',
|
|
3140
|
-
// @ts-expect-error
|
|
3141
3047
|
onClick: function onClick(e) {
|
|
3142
3048
|
e.preventDefault();
|
|
3143
3049
|
if (!isClickable) return;
|
|
3144
3050
|
onEdit && onEdit();
|
|
3145
3051
|
},
|
|
3146
|
-
|
|
3147
|
-
withDragHandle: !!props.
|
|
3148
|
-
|
|
3052
|
+
dragHandleRender: props.renderDragHandle,
|
|
3053
|
+
withDragHandle: !!props.renderDragHandle,
|
|
3054
|
+
actions: [].concat(renderActions({
|
|
3149
3055
|
entityFile: entityFile,
|
|
3150
3056
|
isDisabled: isDisabled,
|
|
3151
3057
|
onEdit: onEdit,
|
|
3152
3058
|
onRemove: onRemove
|
|
3153
3059
|
}), entityFile ? renderAssetInfo({
|
|
3154
3060
|
entityFile: entityFile
|
|
3155
|
-
}) :
|
|
3061
|
+
}) : []).filter(function (item) {
|
|
3062
|
+
return item;
|
|
3063
|
+
}),
|
|
3156
3064
|
size: size
|
|
3157
3065
|
});
|
|
3158
3066
|
};
|
|
3159
3067
|
WrappedAssetCard.defaultProps = defaultProps$1;
|
|
3160
3068
|
|
|
3161
|
-
var styles$
|
|
3069
|
+
var styles$4 = {
|
|
3162
3070
|
scheduleIcon: /*#__PURE__*/css({
|
|
3163
3071
|
marginRight: tokens.spacing2Xs
|
|
3164
3072
|
})
|
|
@@ -3187,37 +3095,42 @@ var WrappedAssetLink = function WrappedAssetLink(props) {
|
|
|
3187
3095
|
});
|
|
3188
3096
|
var entityFile = props.asset.fields.file ? props.asset.fields.file[props.localeCode] || props.asset.fields.file[props.defaultLocaleCode] : undefined;
|
|
3189
3097
|
return React__default.createElement(EntryCard, {
|
|
3098
|
+
as: href ? 'a' : 'article',
|
|
3190
3099
|
contentType: "Asset",
|
|
3191
3100
|
title: entityTitle,
|
|
3192
3101
|
className: className,
|
|
3193
3102
|
href: href,
|
|
3194
3103
|
size: "small",
|
|
3195
3104
|
status: status,
|
|
3196
|
-
|
|
3105
|
+
thumbnailElement: entityFile && isValidImage(entityFile) ? React__default.createElement(AssetThumbnail, {
|
|
3106
|
+
file: entityFile
|
|
3107
|
+
}) : undefined,
|
|
3108
|
+
icon: React__default.createElement(ScheduledIconWithTooltip, {
|
|
3197
3109
|
getEntityScheduledActions: props.getEntityScheduledActions,
|
|
3198
3110
|
entityType: "Asset",
|
|
3199
3111
|
entityId: props.asset.sys.id
|
|
3200
|
-
}, React__default.createElement(
|
|
3201
|
-
className: styles$
|
|
3202
|
-
icon: "Clock",
|
|
3112
|
+
}, React__default.createElement(ClockIcon, {
|
|
3113
|
+
className: styles$4.scheduleIcon,
|
|
3203
3114
|
size: "small",
|
|
3204
|
-
|
|
3115
|
+
variant: "muted",
|
|
3205
3116
|
testId: "schedule-icon"
|
|
3206
3117
|
})),
|
|
3207
3118
|
onClick: function onClick(e) {
|
|
3208
3119
|
e.preventDefault();
|
|
3209
3120
|
onEdit();
|
|
3210
3121
|
},
|
|
3211
|
-
|
|
3212
|
-
withDragHandle: !!props.
|
|
3213
|
-
|
|
3122
|
+
dragHandleRender: props.renderDragHandle,
|
|
3123
|
+
withDragHandle: !!props.renderDragHandle,
|
|
3124
|
+
actions: [renderActions({
|
|
3214
3125
|
entityFile: entityFile,
|
|
3215
3126
|
isDisabled: isDisabled,
|
|
3216
3127
|
onEdit: onEdit,
|
|
3217
3128
|
onRemove: onRemove
|
|
3218
3129
|
}), entityFile ? renderAssetInfo({
|
|
3219
3130
|
entityFile: entityFile
|
|
3220
|
-
}) :
|
|
3131
|
+
}) : null].filter(function (item) {
|
|
3132
|
+
return item;
|
|
3133
|
+
})
|
|
3221
3134
|
});
|
|
3222
3135
|
};
|
|
3223
3136
|
|
|
@@ -3320,7 +3233,7 @@ function FetchingWrappedAssetCard(props) {
|
|
|
3320
3233
|
isDisabled: props.isDisabled,
|
|
3321
3234
|
localeCode: props.sdk.field.locale,
|
|
3322
3235
|
defaultLocaleCode: props.sdk.locales["default"],
|
|
3323
|
-
|
|
3236
|
+
renderDragHandle: props.renderDragHandle,
|
|
3324
3237
|
onEdit: onEdit,
|
|
3325
3238
|
onRemove: onRemove
|
|
3326
3239
|
};
|
|
@@ -3329,7 +3242,7 @@ function FetchingWrappedAssetCard(props) {
|
|
|
3329
3242
|
if (asset === undefined) {
|
|
3330
3243
|
return createElement(EntryCard, {
|
|
3331
3244
|
size: "small",
|
|
3332
|
-
|
|
3245
|
+
isLoading: true
|
|
3333
3246
|
});
|
|
3334
3247
|
}
|
|
3335
3248
|
|
|
@@ -3342,10 +3255,7 @@ function FetchingWrappedAssetCard(props) {
|
|
|
3342
3255
|
if (asset === undefined) {
|
|
3343
3256
|
return createElement(AssetCard, {
|
|
3344
3257
|
size: size,
|
|
3345
|
-
isLoading: true
|
|
3346
|
-
title: "",
|
|
3347
|
-
src: "",
|
|
3348
|
-
href: ""
|
|
3258
|
+
isLoading: true
|
|
3349
3259
|
});
|
|
3350
3260
|
}
|
|
3351
3261
|
|
|
@@ -3398,7 +3308,7 @@ SingleMediaEditor.defaultProps = {
|
|
|
3398
3308
|
isInitiallyDisabled: true
|
|
3399
3309
|
};
|
|
3400
3310
|
|
|
3401
|
-
var styles$
|
|
3311
|
+
var styles$5 = {
|
|
3402
3312
|
gridContainter: /*#__PURE__*/css({
|
|
3403
3313
|
position: 'relative',
|
|
3404
3314
|
display: 'flex',
|
|
@@ -3412,17 +3322,22 @@ var styles$7 = {
|
|
|
3412
3322
|
marginRight: tokens.spacingM
|
|
3413
3323
|
})
|
|
3414
3324
|
};
|
|
3415
|
-
|
|
3416
|
-
|
|
3417
|
-
|
|
3325
|
+
|
|
3326
|
+
var DragHandle$1 = function DragHandle(props) {
|
|
3327
|
+
var SortableDragHandle = SortableHandle(function () {
|
|
3328
|
+
return props.drag;
|
|
3329
|
+
});
|
|
3330
|
+
return React__default.createElement(SortableDragHandle, null);
|
|
3331
|
+
};
|
|
3332
|
+
|
|
3418
3333
|
var SortableLink$1 = /*#__PURE__*/SortableElement(function (props) {
|
|
3419
3334
|
return React__default.createElement("div", {
|
|
3420
|
-
className: styles$
|
|
3335
|
+
className: styles$5.item
|
|
3421
3336
|
}, props.children);
|
|
3422
3337
|
});
|
|
3423
3338
|
var SortableLinkList$1 = /*#__PURE__*/SortableContainer(function (props) {
|
|
3424
3339
|
return React__default.createElement("div", {
|
|
3425
|
-
className: props.viewType === 'card' ? styles$
|
|
3340
|
+
className: props.viewType === 'card' ? styles$5.gridContainter : styles$5.container
|
|
3426
3341
|
}, props.items.map(function (item, index) {
|
|
3427
3342
|
return React__default.createElement(SortableLink$1, {
|
|
3428
3343
|
disabled: props.isDisabled,
|
|
@@ -3437,7 +3352,7 @@ var SortableLinkList$1 = /*#__PURE__*/SortableContainer(function (props) {
|
|
|
3437
3352
|
return i !== index;
|
|
3438
3353
|
}));
|
|
3439
3354
|
},
|
|
3440
|
-
|
|
3355
|
+
renderDragHandle: props.isDisabled ? undefined : DragHandle$1
|
|
3441
3356
|
})));
|
|
3442
3357
|
}));
|
|
3443
3358
|
});
|
|
@@ -3456,5 +3371,5 @@ MultipleMediaEditor.defaultProps = {
|
|
|
3456
3371
|
isInitiallyDisabled: true
|
|
3457
3372
|
};
|
|
3458
3373
|
|
|
3459
|
-
export { AssetThumbnail, CombinedLinkActions, CreateEntryLinkButton, CreateEntryMenuTrigger, EntityProvider, MissingEntityCard, MultipleEntryReferenceEditor, MultipleMediaEditor,
|
|
3374
|
+
export { AssetThumbnail, CombinedLinkActions, CreateEntryLinkButton, CreateEntryMenuTrigger, EntityProvider, MissingEntityCard, MultipleEntryReferenceEditor, MultipleMediaEditor, ScheduledIconWithTooltip, SingleEntryReferenceEditor, SingleMediaEditor, WrappedAssetCard, WrappedEntryCard, getScheduleTooltipContent, useEntities };
|
|
3460
3375
|
//# sourceMappingURL=field-editor-reference.esm.js.map
|