@firecms/core 3.0.0-canary.250 → 3.0.0-canary.251

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/dist/index.es.js CHANGED
@@ -3186,12 +3186,19 @@ function hashString(str) {
3186
3186
  return Math.abs(hash2);
3187
3187
  }
3188
3188
  function getIcon(iconKey, className, color, size) {
3189
+ if (React__default.isValidElement(iconKey)) {
3190
+ return iconKey;
3191
+ }
3189
3192
  if (!iconKey) return void 0;
3190
- iconKey = slugify(iconKey);
3191
- if (!(iconKey in iconKeysMap)) {
3192
- return void 0;
3193
+ if (typeof iconKey === "string") {
3194
+ const usedIconKey = slugify(iconKey);
3195
+ if (!(usedIconKey in iconKeysMap)) {
3196
+ return void 0;
3197
+ }
3198
+ return usedIconKey in iconKeysMap ? /* @__PURE__ */ jsx(Icon, { iconKey: usedIconKey, size, className, color }) : void 0;
3193
3199
  }
3194
- return iconKey in iconKeysMap ? /* @__PURE__ */ jsx(Icon, { iconKey, size, className, color }) : void 0;
3200
+ console.warn("Invalid icon key provided:", iconKey);
3201
+ return void 0;
3195
3202
  }
3196
3203
  const IconForView = React__default.memo(function IconForView2(t0) {
3197
3204
  const $ = c(15);
@@ -7836,10 +7843,10 @@ function StorageUploadProgress({
7836
7843
  };
7837
7844
  }, [entry.file, entry.fileName, upload]);
7838
7845
  if (simple) {
7839
- return /* @__PURE__ */ jsx("div", { className: `m-4 w-${imageSize} h-${imageSize}`, children: loading && /* @__PURE__ */ jsx(Skeleton, { className: `w-${imageSize} h-${imageSize}` }) });
7846
+ return /* @__PURE__ */ jsx("div", { className: `w-${imageSize} h-${imageSize}`, children: loading && /* @__PURE__ */ jsx(Skeleton, { className: `w-${imageSize} h-${imageSize}` }) });
7840
7847
  }
7841
- return /* @__PURE__ */ jsxs("div", { className: cls(paperMixin, "relative m-4 border-box flex items-center justify-center", `min-w-[${imageSize}px] min-h-[${imageSize}px]`), children: [
7842
- loading && /* @__PURE__ */ jsx(Skeleton, { className: "m-4 w-full h-full" }),
7848
+ return /* @__PURE__ */ jsxs("div", { className: cls(paperMixin, "p-4 relative border-box flex items-center justify-center", `min-w-[${imageSize}px] min-h-[${imageSize}px]`), children: [
7849
+ loading && /* @__PURE__ */ jsx(Skeleton, { className: "w-full h-full" }),
7843
7850
  error && /* @__PURE__ */ jsx(ErrorView, { title: "Error uploading file", error })
7844
7851
  ] });
7845
7852
  }
@@ -15892,7 +15899,7 @@ function StorageItemPreview(t0) {
15892
15899
  const t1 = size === "large" ? "min-w-[220px] min-h-[220px] max-w-[220px]" : "min-w-[118px] min-h-[118px] max-w-[118px]";
15893
15900
  let t2;
15894
15901
  if ($[0] !== className || $[1] !== t1) {
15895
- t2 = cls(paperMixin, "relative m-4 border-box flex items-center justify-center", t1, className);
15902
+ t2 = cls(paperMixin, "relative border-box flex items-center justify-center", t1, className);
15896
15903
  $[0] = className;
15897
15904
  $[1] = t1;
15898
15905
  $[2] = t2;
@@ -16115,7 +16122,7 @@ function StorageUploadFieldBinding(t0) {
16115
16122
  return t12;
16116
16123
  }
16117
16124
  function SortableStorageItem(t0) {
16118
- const $ = c(35);
16125
+ const $ = c(34);
16119
16126
  const {
16120
16127
  id,
16121
16128
  entry,
@@ -16153,98 +16160,95 @@ function SortableStorageItem(t0) {
16153
16160
  t2 = $[3];
16154
16161
  }
16155
16162
  const t3 = isDragging ? 100 : void 0;
16156
- const t4 = isDragging ? 0.8 : 1;
16157
- let t5;
16158
- if ($[4] !== t2 || $[5] !== t3 || $[6] !== t4 || $[7] !== transition) {
16159
- t5 = {
16163
+ let t4;
16164
+ if ($[4] !== t2 || $[5] !== t3 || $[6] !== transition) {
16165
+ t4 = {
16160
16166
  transform: t2,
16161
16167
  transition,
16162
- zIndex: t3,
16163
- opacity: t4
16168
+ zIndex: t3
16164
16169
  };
16165
16170
  $[4] = t2;
16166
16171
  $[5] = t3;
16167
- $[6] = t4;
16168
- $[7] = transition;
16169
- $[8] = t5;
16172
+ $[6] = transition;
16173
+ $[7] = t4;
16170
16174
  } else {
16171
- t5 = $[8];
16175
+ t4 = $[7];
16172
16176
  }
16173
- const style = t5;
16177
+ const style = t4;
16174
16178
  const getImageSizeNumber = _temp$a;
16175
16179
  let child;
16176
16180
  if (entry.storagePathOrDownloadUrl) {
16177
- const t62 = `storage_preview_${entry.storagePathOrDownloadUrl}`;
16178
- let t72;
16179
- if ($[9] !== entry.storagePathOrDownloadUrl || $[10] !== onClear) {
16180
- t72 = () => onClear(entry.storagePathOrDownloadUrl);
16181
- $[9] = entry.storagePathOrDownloadUrl;
16182
- $[10] = onClear;
16183
- $[11] = t72;
16181
+ const t52 = `storage_preview_${entry.storagePathOrDownloadUrl}`;
16182
+ let t62;
16183
+ if ($[8] !== entry.storagePathOrDownloadUrl || $[9] !== onClear) {
16184
+ t62 = () => onClear(entry.storagePathOrDownloadUrl);
16185
+ $[8] = entry.storagePathOrDownloadUrl;
16186
+ $[9] = onClear;
16187
+ $[10] = t62;
16184
16188
  } else {
16185
- t72 = $[11];
16189
+ t62 = $[10];
16186
16190
  }
16187
- let t8;
16188
- if ($[12] !== disabled || $[13] !== entry.size || $[14] !== entry.storagePathOrDownloadUrl || $[15] !== property || $[16] !== t62 || $[17] !== t72) {
16189
- t8 = /* @__PURE__ */ jsx(StorageItemPreview, { name: t62, property, disabled, value: entry.storagePathOrDownloadUrl, onRemove: t72, size: entry.size });
16190
- $[12] = disabled;
16191
- $[13] = entry.size;
16192
- $[14] = entry.storagePathOrDownloadUrl;
16193
- $[15] = property;
16191
+ let t7;
16192
+ if ($[11] !== disabled || $[12] !== entry.size || $[13] !== entry.storagePathOrDownloadUrl || $[14] !== property || $[15] !== t52 || $[16] !== t62) {
16193
+ t7 = /* @__PURE__ */ jsx(StorageItemPreview, { name: t52, property, disabled, value: entry.storagePathOrDownloadUrl, onRemove: t62, size: entry.size });
16194
+ $[11] = disabled;
16195
+ $[12] = entry.size;
16196
+ $[13] = entry.storagePathOrDownloadUrl;
16197
+ $[14] = property;
16198
+ $[15] = t52;
16194
16199
  $[16] = t62;
16195
- $[17] = t72;
16196
- $[18] = t8;
16200
+ $[17] = t7;
16197
16201
  } else {
16198
- t8 = $[18];
16202
+ t7 = $[17];
16199
16203
  }
16200
- child = t8;
16204
+ child = t7;
16201
16205
  } else {
16202
16206
  if (entry.file) {
16203
- let t62;
16204
- if ($[19] !== entry.file || $[20] !== storagePathBuilder) {
16205
- t62 = storagePathBuilder(entry.file);
16206
- $[19] = entry.file;
16207
- $[20] = storagePathBuilder;
16208
- $[21] = t62;
16207
+ let t52;
16208
+ if ($[18] !== entry.file || $[19] !== storagePathBuilder) {
16209
+ t52 = storagePathBuilder(entry.file);
16210
+ $[18] = entry.file;
16211
+ $[19] = storagePathBuilder;
16212
+ $[20] = t52;
16209
16213
  } else {
16210
- t62 = $[21];
16214
+ t52 = $[20];
16211
16215
  }
16212
- const t72 = getImageSizeNumber(entry.size);
16213
- let t8;
16214
- if ($[22] !== entry || $[23] !== metadata || $[24] !== onFileUploadComplete || $[25] !== t62 || $[26] !== t72) {
16215
- t8 = /* @__PURE__ */ jsx(StorageUploadProgress, { entry, metadata, storagePath: t62, onFileUploadComplete, imageSize: t72, simple: false });
16216
- $[22] = entry;
16217
- $[23] = metadata;
16218
- $[24] = onFileUploadComplete;
16216
+ const t62 = getImageSizeNumber(entry.size);
16217
+ let t7;
16218
+ if ($[21] !== entry || $[22] !== metadata || $[23] !== onFileUploadComplete || $[24] !== t52 || $[25] !== t62) {
16219
+ t7 = /* @__PURE__ */ jsx(StorageUploadProgress, { entry, metadata, storagePath: t52, onFileUploadComplete, imageSize: t62, simple: false });
16220
+ $[21] = entry;
16221
+ $[22] = metadata;
16222
+ $[23] = onFileUploadComplete;
16223
+ $[24] = t52;
16219
16224
  $[25] = t62;
16220
- $[26] = t72;
16221
- $[27] = t8;
16225
+ $[26] = t7;
16222
16226
  } else {
16223
- t8 = $[27];
16227
+ t7 = $[26];
16224
16228
  }
16225
- child = t8;
16229
+ child = t7;
16226
16230
  }
16227
16231
  }
16228
- let t6;
16229
- if ($[28] === Symbol.for("react.memo_cache_sentinel")) {
16230
- t6 = cls("rounded-md m-1");
16231
- $[28] = t6;
16232
+ let t5;
16233
+ if ($[27] === Symbol.for("react.memo_cache_sentinel")) {
16234
+ t5 = cls("rounded-md m-1");
16235
+ $[27] = t5;
16232
16236
  } else {
16233
- t6 = $[28];
16237
+ t5 = $[27];
16234
16238
  }
16235
- let t7;
16236
- if ($[29] !== attributes || $[30] !== child || $[31] !== listeners2 || $[32] !== setNodeRef || $[33] !== style) {
16237
- t7 = /* @__PURE__ */ jsx("div", { ref: setNodeRef, style, ...attributes, ...listeners2, className: t6, tabIndex: -1, children: child });
16238
- $[29] = attributes;
16239
- $[30] = child;
16240
- $[31] = listeners2;
16241
- $[32] = setNodeRef;
16242
- $[33] = style;
16243
- $[34] = t7;
16239
+ let t6;
16240
+ if ($[28] !== attributes || $[29] !== child || $[30] !== listeners2 || $[31] !== setNodeRef || $[32] !== style) {
16241
+ t6 = /* @__PURE__ */ jsx("div", { ref: setNodeRef, style, ...attributes, ...listeners2, className: t5, tabIndex: -1, children: child });
16242
+ $[28] = attributes;
16243
+ $[29] = child;
16244
+ $[30] = listeners2;
16245
+ $[31] = setNodeRef;
16246
+ $[32] = style;
16247
+ $[33] = t6;
16244
16248
  } else {
16245
- t7 = $[34];
16249
+ t6 = $[33];
16246
16250
  }
16247
- return t7;
16251
+ return t6;
16248
16252
  }
16249
16253
  function _temp$a(previewSize) {
16250
16254
  switch (previewSize) {
@@ -16263,7 +16267,7 @@ function _temp$a(previewSize) {
16263
16267
  }
16264
16268
  }
16265
16269
  function FileDropComponent(t0) {
16266
- const $ = c(63);
16270
+ const $ = c(61);
16267
16271
  const {
16268
16272
  storage,
16269
16273
  disabled,
@@ -16354,7 +16358,7 @@ function FileDropComponent(t0) {
16354
16358
  }
16355
16359
  const t6 = disabled ? fieldBackgroundDisabledMixin : fieldBackgroundHoverMixin;
16356
16360
  const t7 = disabled ? "text-surface-accent-600 dark:text-surface-accent-500" : "";
16357
- const t8 = multipleFilesSupported && internalValue.length === 0 && "flex";
16361
+ const t8 = multipleFilesSupported && internalValue.length ? "" : "flex";
16358
16362
  const t9 = !isDragActive;
16359
16363
  const t10 = disabled || isDndItemDragging;
16360
16364
  let t11;
@@ -16378,107 +16382,103 @@ function FileDropComponent(t0) {
16378
16382
  } else {
16379
16383
  t11 = $[21];
16380
16384
  }
16381
- const t12 = multipleFilesSupported && internalValue.length ? "flex-row overflow-x-auto" : "flex-col";
16382
- const t13 = internalValue.length === 0 && "min-h-[250px] justify-center";
16383
- const t14 = multipleFilesSupported && internalValue.length > 0 && "min-h-[180px]";
16384
- const t15 = !multipleFilesSupported && internalValue.length > 0 && "min-h-[250px]";
16385
- let t16;
16386
- if ($[22] !== t12 || $[23] !== t13 || $[24] !== t14 || $[25] !== t15) {
16387
- t16 = cls("flex items-center p-1 no-scrollbar", t12, t13, t14, t15);
16385
+ const t12 = multipleFilesSupported && internalValue.length ? "overflow-auto" : "";
16386
+ const t13 = multipleFilesSupported && internalValue.length ? "min-h-[180px]" : "min-h-[250px]";
16387
+ let t14;
16388
+ if ($[22] !== t12 || $[23] !== t13) {
16389
+ t14 = cls("flex items-center p-1 px-4 no-scrollbar", t12, t13);
16388
16390
  $[22] = t12;
16389
16391
  $[23] = t13;
16390
16392
  $[24] = t14;
16391
- $[25] = t15;
16392
- $[26] = t16;
16393
16393
  } else {
16394
- t16 = $[26];
16394
+ t14 = $[24];
16395
16395
  }
16396
- let t17;
16397
- if ($[27] !== getInputProps) {
16398
- t17 = getInputProps();
16399
- $[27] = getInputProps;
16400
- $[28] = t17;
16396
+ let t15;
16397
+ if ($[25] !== getInputProps) {
16398
+ t15 = getInputProps();
16399
+ $[25] = getInputProps;
16400
+ $[26] = t15;
16401
16401
  } else {
16402
- t17 = $[28];
16402
+ t15 = $[26];
16403
16403
  }
16404
- let t18;
16405
- if ($[29] !== autoFocus || $[30] !== t17) {
16406
- t18 = /* @__PURE__ */ jsx("input", { autoFocus, ...t17 });
16407
- $[29] = autoFocus;
16408
- $[30] = t17;
16409
- $[31] = t18;
16404
+ let t16;
16405
+ if ($[27] !== autoFocus || $[28] !== t15) {
16406
+ t16 = /* @__PURE__ */ jsx("input", { autoFocus, ...t15 });
16407
+ $[27] = autoFocus;
16408
+ $[28] = t15;
16409
+ $[29] = t16;
16410
16410
  } else {
16411
- t18 = $[31];
16411
+ t16 = $[29];
16412
16412
  }
16413
- let t19;
16414
- if ($[32] !== disabled || $[33] !== internalValue || $[34] !== metadata || $[35] !== multipleFilesSupported || $[36] !== name || $[37] !== onClear || $[38] !== onFileUploadComplete || $[39] !== property || $[40] !== storagePathBuilder) {
16415
- let t202;
16416
- if ($[42] !== disabled || $[43] !== metadata || $[44] !== multipleFilesSupported || $[45] !== name || $[46] !== onClear || $[47] !== onFileUploadComplete || $[48] !== property || $[49] !== storagePathBuilder) {
16417
- t202 = (entry) => /* @__PURE__ */ jsx(SortableStorageItem, { id: entry.id, entry, property, name, metadata, storagePathBuilder, onFileUploadComplete, onClear, disabled, isSortable: multipleFilesSupported }, entry.id);
16418
- $[42] = disabled;
16419
- $[43] = metadata;
16420
- $[44] = multipleFilesSupported;
16421
- $[45] = name;
16422
- $[46] = onClear;
16423
- $[47] = onFileUploadComplete;
16424
- $[48] = property;
16425
- $[49] = storagePathBuilder;
16426
- $[50] = t202;
16413
+ let t17;
16414
+ if ($[30] !== disabled || $[31] !== internalValue || $[32] !== metadata || $[33] !== multipleFilesSupported || $[34] !== name || $[35] !== onClear || $[36] !== onFileUploadComplete || $[37] !== property || $[38] !== storagePathBuilder) {
16415
+ let t182;
16416
+ if ($[40] !== disabled || $[41] !== metadata || $[42] !== multipleFilesSupported || $[43] !== name || $[44] !== onClear || $[45] !== onFileUploadComplete || $[46] !== property || $[47] !== storagePathBuilder) {
16417
+ t182 = (entry) => /* @__PURE__ */ jsx(SortableStorageItem, { id: entry.id, entry, property, name, metadata, storagePathBuilder, onFileUploadComplete, onClear, disabled, isSortable: multipleFilesSupported }, entry.id);
16418
+ $[40] = disabled;
16419
+ $[41] = metadata;
16420
+ $[42] = multipleFilesSupported;
16421
+ $[43] = name;
16422
+ $[44] = onClear;
16423
+ $[45] = onFileUploadComplete;
16424
+ $[46] = property;
16425
+ $[47] = storagePathBuilder;
16426
+ $[48] = t182;
16427
16427
  } else {
16428
- t202 = $[50];
16429
- }
16430
- t19 = internalValue.map(t202);
16431
- $[32] = disabled;
16432
- $[33] = internalValue;
16433
- $[34] = metadata;
16434
- $[35] = multipleFilesSupported;
16435
- $[36] = name;
16436
- $[37] = onClear;
16437
- $[38] = onFileUploadComplete;
16438
- $[39] = property;
16439
- $[40] = storagePathBuilder;
16440
- $[41] = t19;
16441
- } else {
16442
- t19 = $[41];
16428
+ t182 = $[48];
16429
+ }
16430
+ t17 = internalValue.map(t182);
16431
+ $[30] = disabled;
16432
+ $[31] = internalValue;
16433
+ $[32] = metadata;
16434
+ $[33] = multipleFilesSupported;
16435
+ $[34] = name;
16436
+ $[35] = onClear;
16437
+ $[36] = onFileUploadComplete;
16438
+ $[37] = property;
16439
+ $[38] = storagePathBuilder;
16440
+ $[39] = t17;
16441
+ } else {
16442
+ t17 = $[39];
16443
16443
  }
16444
- let t20;
16445
- if ($[51] !== t16 || $[52] !== t18 || $[53] !== t19) {
16446
- t20 = /* @__PURE__ */ jsxs("div", { className: t16, children: [
16447
- t18,
16448
- t19
16444
+ let t18;
16445
+ if ($[49] !== t14 || $[50] !== t16 || $[51] !== t17) {
16446
+ t18 = /* @__PURE__ */ jsxs("div", { className: t14, children: [
16447
+ t16,
16448
+ t17
16449
16449
  ] });
16450
- $[51] = t16;
16450
+ $[49] = t14;
16451
+ $[50] = t16;
16452
+ $[51] = t17;
16451
16453
  $[52] = t18;
16452
- $[53] = t19;
16453
- $[54] = t20;
16454
16454
  } else {
16455
- t20 = $[54];
16455
+ t18 = $[52];
16456
16456
  }
16457
- const t21 = disabled ? "text-surface-accent-600 dark:text-surface-accent-500" : "";
16458
- let t22;
16459
- if ($[55] !== helpText || $[56] !== t21) {
16460
- t22 = /* @__PURE__ */ jsx("div", { className: "flex-grow min-h-[38px] box-border m-2 text-center", children: /* @__PURE__ */ jsx(Typography, { align: "center", variant: "label", className: t21, children: helpText }) });
16461
- $[55] = helpText;
16462
- $[56] = t21;
16463
- $[57] = t22;
16457
+ const t19 = disabled ? "text-surface-accent-600 dark:text-surface-accent-500" : "";
16458
+ let t20;
16459
+ if ($[53] !== helpText || $[54] !== t19) {
16460
+ t20 = /* @__PURE__ */ jsx("div", { className: "flex-grow min-h-[38px] box-border m-2 text-center", children: /* @__PURE__ */ jsx(Typography, { align: "center", variant: "label", className: t19, children: helpText }) });
16461
+ $[53] = helpText;
16462
+ $[54] = t19;
16463
+ $[55] = t20;
16464
16464
  } else {
16465
- t22 = $[57];
16465
+ t20 = $[55];
16466
16466
  }
16467
- let t23;
16468
- if ($[58] !== t11 || $[59] !== t20 || $[60] !== t22 || $[61] !== t5) {
16469
- t23 = /* @__PURE__ */ jsxs("div", { ...t5, className: t11, children: [
16470
- t20,
16471
- t22
16467
+ let t21;
16468
+ if ($[56] !== t11 || $[57] !== t18 || $[58] !== t20 || $[59] !== t5) {
16469
+ t21 = /* @__PURE__ */ jsxs("div", { ...t5, className: t11, children: [
16470
+ t18,
16471
+ t20
16472
16472
  ] });
16473
- $[58] = t11;
16474
- $[59] = t20;
16475
- $[60] = t22;
16476
- $[61] = t5;
16477
- $[62] = t23;
16473
+ $[56] = t11;
16474
+ $[57] = t18;
16475
+ $[58] = t20;
16476
+ $[59] = t5;
16477
+ $[60] = t21;
16478
16478
  } else {
16479
- t23 = $[62];
16479
+ t21 = $[60];
16480
16480
  }
16481
- return t23;
16481
+ return t21;
16482
16482
  }
16483
16483
  function _temp2$4(acc, ext) {
16484
16484
  return {