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

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