@contentful/field-editor-reference 2.21.0 → 4.0.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.
- package/CHANGELOG.md +74 -406
- 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 +265 -362
- 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 +253 -350
- 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 -7
|
@@ -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
|
+
})), 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
|
}
|
|
@@ -539,35 +509,31 @@ function CombinedEntryLinkActions(props) {
|
|
|
539
509
|
}
|
|
540
510
|
|
|
541
511
|
function CombinedAssetLinkActions(props) {
|
|
542
|
-
var _React$useState = useState(false),
|
|
543
|
-
isOpen = _React$useState[0],
|
|
544
|
-
setOpen = _React$useState[1];
|
|
545
|
-
|
|
546
512
|
if (!props.canLinkEntity || !props.canCreateEntity) {
|
|
547
513
|
if (props.canLinkEntity) {
|
|
548
514
|
return createElement(Button, {
|
|
549
|
-
|
|
515
|
+
isDisabled: props.isDisabled,
|
|
550
516
|
testId: testIds$1.linkExisting,
|
|
551
517
|
className: action,
|
|
552
518
|
onClick: function onClick() {
|
|
553
519
|
props.onLinkExisting();
|
|
554
520
|
},
|
|
555
|
-
|
|
556
|
-
|
|
521
|
+
variant: "secondary",
|
|
522
|
+
startIcon: createElement(PlusIcon, null),
|
|
557
523
|
size: "small"
|
|
558
524
|
}, "Add existing media");
|
|
559
525
|
}
|
|
560
526
|
|
|
561
527
|
if (props.canCreateEntity) {
|
|
562
528
|
return createElement(Button, {
|
|
563
|
-
|
|
529
|
+
isDisabled: props.isDisabled,
|
|
564
530
|
testId: testIds$1.createAndLink,
|
|
565
531
|
className: action,
|
|
566
532
|
onClick: function onClick() {
|
|
567
533
|
props.onCreate();
|
|
568
534
|
},
|
|
569
|
-
|
|
570
|
-
|
|
535
|
+
variant: "secondary",
|
|
536
|
+
startIcon: createElement(PlusIcon, null),
|
|
571
537
|
size: "small"
|
|
572
538
|
}, "Add media");
|
|
573
539
|
}
|
|
@@ -577,35 +543,24 @@ function CombinedAssetLinkActions(props) {
|
|
|
577
543
|
// that works without content types to cover asset use-case.
|
|
578
544
|
|
|
579
545
|
|
|
580
|
-
return createElement(
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
onClick: function onClick() {
|
|
590
|
-
setOpen(!isOpen);
|
|
591
|
-
},
|
|
592
|
-
buttonType: "muted",
|
|
593
|
-
icon: "Plus",
|
|
594
|
-
indicateDropdown: true,
|
|
595
|
-
size: "small"
|
|
596
|
-
}, "Add media"))
|
|
597
|
-
}, createElement(DropdownList, {
|
|
546
|
+
return createElement(Menu, null, createElement(Menu.Trigger, null, createElement(Button, {
|
|
547
|
+
endIcon: createElement(ChevronDownIcon, null),
|
|
548
|
+
isDisabled: props.isDisabled,
|
|
549
|
+
testId: testIds$1.actionsWrapper,
|
|
550
|
+
className: action,
|
|
551
|
+
variant: "secondary",
|
|
552
|
+
startIcon: createElement(PlusIcon, null),
|
|
553
|
+
size: "small"
|
|
554
|
+
}, "Add media")), createElement(Menu.List, {
|
|
598
555
|
testId: testIds$1.dropdown
|
|
599
|
-
}, createElement(
|
|
556
|
+
}, createElement(Menu.Item, {
|
|
600
557
|
testId: testIds$1.linkExisting,
|
|
601
558
|
onClick: function onClick() {
|
|
602
|
-
setOpen(false);
|
|
603
559
|
props.onLinkExisting();
|
|
604
560
|
}
|
|
605
|
-
}, "Add existing media"), createElement(
|
|
561
|
+
}, "Add existing media"), createElement(Menu.Item, {
|
|
606
562
|
testId: testIds$1.createAndLink,
|
|
607
563
|
onClick: function onClick() {
|
|
608
|
-
setOpen(false);
|
|
609
564
|
props.onCreate();
|
|
610
565
|
}
|
|
611
566
|
}, "Add new media")));
|
|
@@ -632,13 +587,15 @@ function MissingEntityCard(props) {
|
|
|
632
587
|
className: card
|
|
633
588
|
}, React__default.createElement("div", {
|
|
634
589
|
className: props.asSquare ? squareCard : ''
|
|
635
|
-
}, React__default.createElement(SectionHeading,
|
|
590
|
+
}, React__default.createElement(SectionHeading, {
|
|
591
|
+
marginBottom: "none"
|
|
592
|
+
}, props.entityType === 'Entry' && 'Entry is missing or inaccessible', props.entityType === 'Asset' && 'Asset is missing or inaccessible')), !props.isDisabled && props.onRemove && React__default.createElement(IconButton, {
|
|
593
|
+
variant: "transparent",
|
|
594
|
+
icon: React__default.createElement(CloseIcon, {
|
|
595
|
+
variant: "muted"
|
|
596
|
+
}),
|
|
636
597
|
className: close,
|
|
637
|
-
|
|
638
|
-
label: "Delete",
|
|
639
|
-
iconProps: {
|
|
640
|
-
icon: 'Close'
|
|
641
|
-
},
|
|
598
|
+
"aria-label": "Delete",
|
|
642
599
|
onClick: function onClick() {
|
|
643
600
|
props.onRemove && props.onRemove();
|
|
644
601
|
}
|
|
@@ -1773,67 +1730,20 @@ var formatDateAndTime = function formatDateAndTime(date, _short2) {
|
|
|
1773
1730
|
return formatDate(date, _short2) + " at " + formatTime(date);
|
|
1774
1731
|
};
|
|
1775
1732
|
|
|
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) {
|
|
1733
|
+
var getScheduleTooltipContent = function getScheduleTooltipContent(_ref) {
|
|
1800
1734
|
var job = _ref.job,
|
|
1801
1735
|
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"));
|
|
1736
|
+
return "Will " + job.action.toLowerCase() + " " + formatDateAndTime(job.scheduledFor.datetime).toLowerCase() + "\n " + (jobsCount > 1 && "+ " + (jobsCount - 1) + " more");
|
|
1827
1737
|
};
|
|
1828
1738
|
var ScheduleTooltip = function ScheduleTooltip(_ref2) {
|
|
1829
1739
|
var job = _ref2.job,
|
|
1830
1740
|
jobsCount = _ref2.jobsCount,
|
|
1831
1741
|
children = _ref2.children;
|
|
1832
1742
|
return React__default.createElement(Tooltip, {
|
|
1833
|
-
|
|
1743
|
+
placement: "top",
|
|
1834
1744
|
testId: job.sys.id,
|
|
1835
|
-
|
|
1836
|
-
content:
|
|
1745
|
+
as: "div",
|
|
1746
|
+
content: getScheduleTooltipContent({
|
|
1837
1747
|
job: job,
|
|
1838
1748
|
jobsCount: jobsCount
|
|
1839
1749
|
})
|
|
@@ -2489,7 +2399,7 @@ var getEntryTitle = entityHelpers.getEntryTitle,
|
|
|
2489
2399
|
getEntityDescription = entityHelpers.getEntityDescription,
|
|
2490
2400
|
getEntryStatus = entityHelpers.getEntryStatus,
|
|
2491
2401
|
getEntryImage = entityHelpers.getEntryImage;
|
|
2492
|
-
var styles$
|
|
2402
|
+
var styles$1 = {
|
|
2493
2403
|
scheduleIcon: /*#__PURE__*/css({
|
|
2494
2404
|
marginRight: tokens.spacing2Xs
|
|
2495
2405
|
})
|
|
@@ -2544,75 +2454,61 @@ function WrappedEntryCard(props) {
|
|
|
2544
2454
|
localeCode: props.localeCode,
|
|
2545
2455
|
defaultLocaleCode: props.defaultLocaleCode
|
|
2546
2456
|
});
|
|
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;
|
|
2457
|
+
return createElement(EntryCard, {
|
|
2458
|
+
as: props.entryUrl ? 'a' : 'article',
|
|
2459
|
+
href: props.entryUrl,
|
|
2460
|
+
title: title,
|
|
2461
|
+
description: description,
|
|
2462
|
+
contentType: contentType == null ? void 0 : contentType.name,
|
|
2463
|
+
size: props.size,
|
|
2464
|
+
isSelected: props.isSelected,
|
|
2465
|
+
status: status,
|
|
2466
|
+
icon: createElement(ScheduledIconWithTooltip, {
|
|
2467
|
+
getEntityScheduledActions: props.getEntityScheduledActions,
|
|
2468
|
+
entityType: "Entry",
|
|
2469
|
+
entityId: props.entry.sys.id
|
|
2470
|
+
}, createElement(ClockIcon, {
|
|
2471
|
+
className: styles$1.scheduleIcon,
|
|
2472
|
+
size: "small",
|
|
2473
|
+
variant: "muted",
|
|
2474
|
+
testId: "schedule-icon"
|
|
2475
|
+
})),
|
|
2476
|
+
thumbnailElement: file && isValidImage(file) ? createElement(AssetThumbnail, {
|
|
2477
|
+
file: file
|
|
2478
|
+
}) : undefined,
|
|
2479
|
+
dragHandleRender: props.renderDragHandle,
|
|
2480
|
+
withDragHandle: !!props.renderDragHandle,
|
|
2481
|
+
actions: props.onEdit || props.onRemove ? [props.hasCardEditActions && props.onEdit ? createElement(MenuItem, {
|
|
2482
|
+
key: "edit",
|
|
2483
|
+
testId: "edit",
|
|
2484
|
+
onClick: function onClick() {
|
|
2612
2485
|
props.onEdit && props.onEdit();
|
|
2613
2486
|
}
|
|
2614
|
-
})
|
|
2615
|
-
|
|
2487
|
+
}, "Edit") : null, props.onRemove ? createElement(MenuItem, {
|
|
2488
|
+
key: "delete",
|
|
2489
|
+
testId: "delete",
|
|
2490
|
+
onClick: function onClick() {
|
|
2491
|
+
props.onRemove && props.onRemove();
|
|
2492
|
+
}
|
|
2493
|
+
}, "Remove") : null, props.hasMoveOptions && (props.onMoveTop || props.onMoveBottom) ? createElement(MenuDivider, null) : null, props.hasMoveOptions && props.onMoveTop ? createElement(MenuItem, {
|
|
2494
|
+
onClick: function onClick() {
|
|
2495
|
+
return props.onMoveTop && props.onMoveTop();
|
|
2496
|
+
},
|
|
2497
|
+
testId: "move-top"
|
|
2498
|
+
}, "Move to top") : null, props.hasMoveOptions && props.onMoveBottom ? createElement(MenuItem, {
|
|
2499
|
+
onClick: function onClick() {
|
|
2500
|
+
return props.onMoveBottom && props.onMoveBottom();
|
|
2501
|
+
},
|
|
2502
|
+
testId: "move-bottom"
|
|
2503
|
+
}, "Move to bottom") : null].filter(function (item) {
|
|
2504
|
+
return item;
|
|
2505
|
+
}) : [],
|
|
2506
|
+
onClick: function onClick(e) {
|
|
2507
|
+
e.preventDefault();
|
|
2508
|
+
if (!props.isClickable) return;
|
|
2509
|
+
props.onEdit && props.onEdit();
|
|
2510
|
+
}
|
|
2511
|
+
});
|
|
2616
2512
|
}
|
|
2617
2513
|
WrappedEntryCard.defaultProps = defaultProps;
|
|
2618
2514
|
|
|
@@ -2763,7 +2659,7 @@ function FetchingWrappedEntryCard(props) {
|
|
|
2763
2659
|
if (entry === undefined) {
|
|
2764
2660
|
return createElement(EntryCard, {
|
|
2765
2661
|
size: size,
|
|
2766
|
-
|
|
2662
|
+
isLoading: true
|
|
2767
2663
|
});
|
|
2768
2664
|
}
|
|
2769
2665
|
|
|
@@ -2778,7 +2674,7 @@ function FetchingWrappedEntryCard(props) {
|
|
|
2778
2674
|
size: size,
|
|
2779
2675
|
localeCode: props.sdk.field.locale,
|
|
2780
2676
|
defaultLocaleCode: props.sdk.locales["default"],
|
|
2781
|
-
|
|
2677
|
+
renderDragHandle: props.renderDragHandle,
|
|
2782
2678
|
onEdit: onEdit,
|
|
2783
2679
|
onRemove: onRemoveEntry,
|
|
2784
2680
|
onMoveTop: props.onMoveTop,
|
|
@@ -2935,7 +2831,7 @@ MultipleReferenceEditor.defaultProps = {
|
|
|
2935
2831
|
hasCardEditActions: true
|
|
2936
2832
|
};
|
|
2937
2833
|
|
|
2938
|
-
var styles$
|
|
2834
|
+
var styles$2 = {
|
|
2939
2835
|
containter: /*#__PURE__*/css({
|
|
2940
2836
|
position: 'relative'
|
|
2941
2837
|
}),
|
|
@@ -2943,18 +2839,23 @@ var styles$3 = {
|
|
|
2943
2839
|
marginBottom: tokens.spacingM
|
|
2944
2840
|
})
|
|
2945
2841
|
};
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
|
|
2842
|
+
|
|
2843
|
+
var DragHandle = function DragHandle(props) {
|
|
2844
|
+
var SortableDragHandle = SortableHandle(function () {
|
|
2845
|
+
return props.drag;
|
|
2846
|
+
});
|
|
2847
|
+
return React__default.createElement(SortableDragHandle, null);
|
|
2848
|
+
};
|
|
2849
|
+
|
|
2949
2850
|
var SortableLink = /*#__PURE__*/SortableElement(function (props) {
|
|
2950
2851
|
return React__default.createElement("div", {
|
|
2951
|
-
className: styles$
|
|
2852
|
+
className: styles$2.item
|
|
2952
2853
|
}, props.children);
|
|
2953
2854
|
});
|
|
2954
2855
|
var SortableLinkList = /*#__PURE__*/SortableContainer(function (props) {
|
|
2955
2856
|
var lastIndex = props.items.length - 1;
|
|
2956
2857
|
return React__default.createElement("div", {
|
|
2957
|
-
className: styles$
|
|
2858
|
+
className: styles$2.containter
|
|
2958
2859
|
}, props.items.map(function (item, index) {
|
|
2959
2860
|
return React__default.createElement(SortableLink, {
|
|
2960
2861
|
disabled: props.isDisabled,
|
|
@@ -2977,7 +2878,7 @@ var SortableLinkList = /*#__PURE__*/SortableContainer(function (props) {
|
|
|
2977
2878
|
onMoveBottom: index !== lastIndex ? function () {
|
|
2978
2879
|
return props.onMove(index, lastIndex);
|
|
2979
2880
|
} : undefined,
|
|
2980
|
-
|
|
2881
|
+
renderDragHandle: props.isDisabled ? undefined : DragHandle
|
|
2981
2882
|
})));
|
|
2982
2883
|
}));
|
|
2983
2884
|
});
|
|
@@ -2993,17 +2894,6 @@ function MultipleEntryReferenceEditor(props) {
|
|
|
2993
2894
|
});
|
|
2994
2895
|
}
|
|
2995
2896
|
|
|
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
2897
|
function downloadAsset(url) {
|
|
3008
2898
|
window.open(url, '_blank', 'noopener,noreferrer');
|
|
3009
2899
|
}
|
|
@@ -3014,47 +2904,51 @@ function renderAssetInfo(props) {
|
|
|
3014
2904
|
var mimeType = get(entityFile, 'contentType');
|
|
3015
2905
|
var fileSize = get(entityFile, 'details.size');
|
|
3016
2906
|
var image = get(entityFile, 'details.image');
|
|
3017
|
-
return React__default.createElement(
|
|
3018
|
-
|
|
3019
|
-
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
|
|
3024
|
-
|
|
3025
|
-
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
|
|
2907
|
+
return [React__default.createElement(Menu.SectionTitle, {
|
|
2908
|
+
key: "file-section"
|
|
2909
|
+
}, "File info"), fileName && React__default.createElement(Menu.Item, {
|
|
2910
|
+
key: "file-name"
|
|
2911
|
+
}, React__default.createElement(Text, {
|
|
2912
|
+
isTruncated: true
|
|
2913
|
+
}, fileName)), mimeType && React__default.createElement(Menu.Item, {
|
|
2914
|
+
key: "file-type"
|
|
2915
|
+
}, React__default.createElement(Text, {
|
|
2916
|
+
isTruncated: true
|
|
2917
|
+
}, mimeType)), fileSize && React__default.createElement(Menu.Item, {
|
|
2918
|
+
key: "file-size"
|
|
2919
|
+
}, shortenStorageUnit(fileSize, 'B')), image && React__default.createElement(Menu.Item, {
|
|
2920
|
+
key: "file-dimentions"
|
|
2921
|
+
}, image.width + " \xD7 " + image.height)].filter(function (item) {
|
|
2922
|
+
return item;
|
|
2923
|
+
});
|
|
3029
2924
|
}
|
|
3030
2925
|
function renderActions(props) {
|
|
3031
2926
|
var entityFile = props.entityFile,
|
|
3032
2927
|
isDisabled = props.isDisabled,
|
|
3033
2928
|
onEdit = props.onEdit,
|
|
3034
2929
|
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, {
|
|
2930
|
+
return [React__default.createElement(Menu.SectionTitle, {
|
|
2931
|
+
key: "section-title"
|
|
2932
|
+
}, "Actions"), onEdit ? React__default.createElement(Menu.Item, {
|
|
2933
|
+
key: "edit",
|
|
3044
2934
|
onClick: onEdit,
|
|
3045
2935
|
testId: "card-action-edit"
|
|
3046
|
-
}, "Edit"), entityFile
|
|
2936
|
+
}, "Edit") : null, entityFile ? React__default.createElement(Menu.Item, {
|
|
2937
|
+
key: "download",
|
|
3047
2938
|
onClick: function onClick() {
|
|
3048
2939
|
if (typeof entityFile.url === 'string') {
|
|
3049
2940
|
downloadAsset(entityFile.url);
|
|
3050
2941
|
}
|
|
3051
2942
|
},
|
|
3052
2943
|
testId: "card-action-download"
|
|
3053
|
-
}, "Download"), onRemove
|
|
3054
|
-
|
|
2944
|
+
}, "Download") : null, onRemove ? React__default.createElement(Menu.Item, {
|
|
2945
|
+
key: "remove",
|
|
2946
|
+
disabled: isDisabled,
|
|
3055
2947
|
onClick: onRemove,
|
|
3056
2948
|
testId: "card-action-remove"
|
|
3057
|
-
}, "Remove"))
|
|
2949
|
+
}, "Remove") : null].filter(function (item) {
|
|
2950
|
+
return item;
|
|
2951
|
+
});
|
|
3058
2952
|
}
|
|
3059
2953
|
|
|
3060
2954
|
var groupToIconMap = {
|
|
@@ -3070,7 +2964,7 @@ var groupToIconMap = {
|
|
|
3070
2964
|
code: 'code',
|
|
3071
2965
|
markup: 'markup'
|
|
3072
2966
|
};
|
|
3073
|
-
var styles$
|
|
2967
|
+
var styles$3 = {
|
|
3074
2968
|
scheduleIcon: /*#__PURE__*/css({
|
|
3075
2969
|
marginRight: tokens.spacing2Xs
|
|
3076
2970
|
})
|
|
@@ -3118,47 +3012,49 @@ var WrappedAssetCard = function WrappedAssetCard(props) {
|
|
|
3118
3012
|
defaultTitle: 'Untitled'
|
|
3119
3013
|
});
|
|
3120
3014
|
var entityFile = props.asset.fields.file ? props.asset.fields.file[props.localeCode] || props.asset.fields.file[props.defaultLocaleCode] : undefined;
|
|
3015
|
+
var href = getAssetUrl ? getAssetUrl(props.asset.sys.id) : undefined;
|
|
3121
3016
|
return React__default.createElement(AssetCard, {
|
|
3017
|
+
as: href ? 'a' : 'article',
|
|
3122
3018
|
type: getFileType(entityFile),
|
|
3123
3019
|
title: entityTitle,
|
|
3124
3020
|
className: className,
|
|
3125
|
-
|
|
3126
|
-
href:
|
|
3021
|
+
isSelected: isSelected,
|
|
3022
|
+
href: href,
|
|
3127
3023
|
status: status,
|
|
3128
|
-
|
|
3024
|
+
icon: React__default.createElement(ScheduledIconWithTooltip, {
|
|
3129
3025
|
getEntityScheduledActions: props.getEntityScheduledActions,
|
|
3130
3026
|
entityType: "Asset",
|
|
3131
3027
|
entityId: props.asset.sys.id
|
|
3132
|
-
}, React__default.createElement(
|
|
3133
|
-
className: styles$
|
|
3134
|
-
icon: "Clock",
|
|
3028
|
+
}, React__default.createElement(ClockIcon, {
|
|
3029
|
+
className: styles$3.scheduleIcon,
|
|
3135
3030
|
size: "small",
|
|
3136
|
-
|
|
3031
|
+
variant: "muted",
|
|
3137
3032
|
testId: "schedule-icon"
|
|
3138
3033
|
})),
|
|
3139
3034
|
src: entityFile && entityFile.url ? size === 'small' ? entityFile.url + "?w=150&h=150&fit=thumb" : entityFile.url + "?h=300" : '',
|
|
3140
|
-
// @ts-expect-error
|
|
3141
3035
|
onClick: function onClick(e) {
|
|
3142
3036
|
e.preventDefault();
|
|
3143
3037
|
if (!isClickable) return;
|
|
3144
3038
|
onEdit && onEdit();
|
|
3145
3039
|
},
|
|
3146
|
-
|
|
3147
|
-
withDragHandle: !!props.
|
|
3148
|
-
|
|
3040
|
+
dragHandleRender: props.renderDragHandle,
|
|
3041
|
+
withDragHandle: !!props.renderDragHandle,
|
|
3042
|
+
actions: [].concat(renderActions({
|
|
3149
3043
|
entityFile: entityFile,
|
|
3150
3044
|
isDisabled: isDisabled,
|
|
3151
3045
|
onEdit: onEdit,
|
|
3152
3046
|
onRemove: onRemove
|
|
3153
3047
|
}), entityFile ? renderAssetInfo({
|
|
3154
3048
|
entityFile: entityFile
|
|
3155
|
-
}) :
|
|
3049
|
+
}) : []).filter(function (item) {
|
|
3050
|
+
return item;
|
|
3051
|
+
}),
|
|
3156
3052
|
size: size
|
|
3157
3053
|
});
|
|
3158
3054
|
};
|
|
3159
3055
|
WrappedAssetCard.defaultProps = defaultProps$1;
|
|
3160
3056
|
|
|
3161
|
-
var styles$
|
|
3057
|
+
var styles$4 = {
|
|
3162
3058
|
scheduleIcon: /*#__PURE__*/css({
|
|
3163
3059
|
marginRight: tokens.spacing2Xs
|
|
3164
3060
|
})
|
|
@@ -3187,37 +3083,42 @@ var WrappedAssetLink = function WrappedAssetLink(props) {
|
|
|
3187
3083
|
});
|
|
3188
3084
|
var entityFile = props.asset.fields.file ? props.asset.fields.file[props.localeCode] || props.asset.fields.file[props.defaultLocaleCode] : undefined;
|
|
3189
3085
|
return React__default.createElement(EntryCard, {
|
|
3086
|
+
as: href ? 'a' : 'article',
|
|
3190
3087
|
contentType: "Asset",
|
|
3191
3088
|
title: entityTitle,
|
|
3192
3089
|
className: className,
|
|
3193
3090
|
href: href,
|
|
3194
3091
|
size: "small",
|
|
3195
3092
|
status: status,
|
|
3196
|
-
|
|
3093
|
+
thumbnailElement: entityFile && isValidImage(entityFile) ? React__default.createElement(AssetThumbnail, {
|
|
3094
|
+
file: entityFile
|
|
3095
|
+
}) : undefined,
|
|
3096
|
+
icon: React__default.createElement(ScheduledIconWithTooltip, {
|
|
3197
3097
|
getEntityScheduledActions: props.getEntityScheduledActions,
|
|
3198
3098
|
entityType: "Asset",
|
|
3199
3099
|
entityId: props.asset.sys.id
|
|
3200
|
-
}, React__default.createElement(
|
|
3201
|
-
className: styles$
|
|
3202
|
-
icon: "Clock",
|
|
3100
|
+
}, React__default.createElement(ClockIcon, {
|
|
3101
|
+
className: styles$4.scheduleIcon,
|
|
3203
3102
|
size: "small",
|
|
3204
|
-
|
|
3103
|
+
variant: "muted",
|
|
3205
3104
|
testId: "schedule-icon"
|
|
3206
3105
|
})),
|
|
3207
3106
|
onClick: function onClick(e) {
|
|
3208
3107
|
e.preventDefault();
|
|
3209
3108
|
onEdit();
|
|
3210
3109
|
},
|
|
3211
|
-
|
|
3212
|
-
withDragHandle: !!props.
|
|
3213
|
-
|
|
3110
|
+
dragHandleRender: props.renderDragHandle,
|
|
3111
|
+
withDragHandle: !!props.renderDragHandle,
|
|
3112
|
+
actions: [renderActions({
|
|
3214
3113
|
entityFile: entityFile,
|
|
3215
3114
|
isDisabled: isDisabled,
|
|
3216
3115
|
onEdit: onEdit,
|
|
3217
3116
|
onRemove: onRemove
|
|
3218
3117
|
}), entityFile ? renderAssetInfo({
|
|
3219
3118
|
entityFile: entityFile
|
|
3220
|
-
}) :
|
|
3119
|
+
}) : null].filter(function (item) {
|
|
3120
|
+
return item;
|
|
3121
|
+
})
|
|
3221
3122
|
});
|
|
3222
3123
|
};
|
|
3223
3124
|
|
|
@@ -3320,7 +3221,7 @@ function FetchingWrappedAssetCard(props) {
|
|
|
3320
3221
|
isDisabled: props.isDisabled,
|
|
3321
3222
|
localeCode: props.sdk.field.locale,
|
|
3322
3223
|
defaultLocaleCode: props.sdk.locales["default"],
|
|
3323
|
-
|
|
3224
|
+
renderDragHandle: props.renderDragHandle,
|
|
3324
3225
|
onEdit: onEdit,
|
|
3325
3226
|
onRemove: onRemove
|
|
3326
3227
|
};
|
|
@@ -3329,7 +3230,7 @@ function FetchingWrappedAssetCard(props) {
|
|
|
3329
3230
|
if (asset === undefined) {
|
|
3330
3231
|
return createElement(EntryCard, {
|
|
3331
3232
|
size: "small",
|
|
3332
|
-
|
|
3233
|
+
isLoading: true
|
|
3333
3234
|
});
|
|
3334
3235
|
}
|
|
3335
3236
|
|
|
@@ -3342,10 +3243,7 @@ function FetchingWrappedAssetCard(props) {
|
|
|
3342
3243
|
if (asset === undefined) {
|
|
3343
3244
|
return createElement(AssetCard, {
|
|
3344
3245
|
size: size,
|
|
3345
|
-
isLoading: true
|
|
3346
|
-
title: "",
|
|
3347
|
-
src: "",
|
|
3348
|
-
href: ""
|
|
3246
|
+
isLoading: true
|
|
3349
3247
|
});
|
|
3350
3248
|
}
|
|
3351
3249
|
|
|
@@ -3398,7 +3296,7 @@ SingleMediaEditor.defaultProps = {
|
|
|
3398
3296
|
isInitiallyDisabled: true
|
|
3399
3297
|
};
|
|
3400
3298
|
|
|
3401
|
-
var styles$
|
|
3299
|
+
var styles$5 = {
|
|
3402
3300
|
gridContainter: /*#__PURE__*/css({
|
|
3403
3301
|
position: 'relative',
|
|
3404
3302
|
display: 'flex',
|
|
@@ -3412,17 +3310,22 @@ var styles$7 = {
|
|
|
3412
3310
|
marginRight: tokens.spacingM
|
|
3413
3311
|
})
|
|
3414
3312
|
};
|
|
3415
|
-
|
|
3416
|
-
|
|
3417
|
-
|
|
3313
|
+
|
|
3314
|
+
var DragHandle$1 = function DragHandle(props) {
|
|
3315
|
+
var SortableDragHandle = SortableHandle(function () {
|
|
3316
|
+
return props.drag;
|
|
3317
|
+
});
|
|
3318
|
+
return React__default.createElement(SortableDragHandle, null);
|
|
3319
|
+
};
|
|
3320
|
+
|
|
3418
3321
|
var SortableLink$1 = /*#__PURE__*/SortableElement(function (props) {
|
|
3419
3322
|
return React__default.createElement("div", {
|
|
3420
|
-
className: styles$
|
|
3323
|
+
className: styles$5.item
|
|
3421
3324
|
}, props.children);
|
|
3422
3325
|
});
|
|
3423
3326
|
var SortableLinkList$1 = /*#__PURE__*/SortableContainer(function (props) {
|
|
3424
3327
|
return React__default.createElement("div", {
|
|
3425
|
-
className: props.viewType === 'card' ? styles$
|
|
3328
|
+
className: props.viewType === 'card' ? styles$5.gridContainter : styles$5.container
|
|
3426
3329
|
}, props.items.map(function (item, index) {
|
|
3427
3330
|
return React__default.createElement(SortableLink$1, {
|
|
3428
3331
|
disabled: props.isDisabled,
|
|
@@ -3437,7 +3340,7 @@ var SortableLinkList$1 = /*#__PURE__*/SortableContainer(function (props) {
|
|
|
3437
3340
|
return i !== index;
|
|
3438
3341
|
}));
|
|
3439
3342
|
},
|
|
3440
|
-
|
|
3343
|
+
renderDragHandle: props.isDisabled ? undefined : DragHandle$1
|
|
3441
3344
|
})));
|
|
3442
3345
|
}));
|
|
3443
3346
|
});
|
|
@@ -3456,5 +3359,5 @@ MultipleMediaEditor.defaultProps = {
|
|
|
3456
3359
|
isInitiallyDisabled: true
|
|
3457
3360
|
};
|
|
3458
3361
|
|
|
3459
|
-
export { AssetThumbnail, CombinedLinkActions, CreateEntryLinkButton, CreateEntryMenuTrigger, EntityProvider, MissingEntityCard, MultipleEntryReferenceEditor, MultipleMediaEditor,
|
|
3362
|
+
export { AssetThumbnail, CombinedLinkActions, CreateEntryLinkButton, CreateEntryMenuTrigger, EntityProvider, MissingEntityCard, MultipleEntryReferenceEditor, MultipleMediaEditor, ScheduledIconWithTooltip, SingleEntryReferenceEditor, SingleMediaEditor, WrappedAssetCard, WrappedEntryCard, getScheduleTooltipContent, useEntities };
|
|
3460
3363
|
//# sourceMappingURL=field-editor-reference.esm.js.map
|