@firecms/ui 3.0.0-canary.142 → 3.0.0-canary.144

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
@@ -377,6 +377,10 @@
377
377
  outerClassName,
378
378
  ...props
379
379
  }, ref) => {
380
+ const [isImageError, setIsImageError] = React.useState(false);
381
+ const handleImageError = () => {
382
+ setIsImageError(true);
383
+ };
380
384
  return /* @__PURE__ */ jsxRuntime.jsx(
381
385
  "button",
382
386
  {
@@ -388,7 +392,7 @@
388
392
  "p-1 hover:bg-slate-200 hover:dark:bg-slate-700 w-12 h-12 min-w-12 min-h-12",
389
393
  outerClassName
390
394
  ),
391
- children: src ? /* @__PURE__ */ jsxRuntime.jsx(
395
+ children: src && !isImageError ? /* @__PURE__ */ jsxRuntime.jsx(
392
396
  "img",
393
397
  {
394
398
  className: cls(
@@ -397,7 +401,8 @@
397
401
  className
398
402
  ),
399
403
  src,
400
- alt
404
+ alt,
405
+ onError: handleImageError
401
406
  }
402
407
  ) : /* @__PURE__ */ jsxRuntime.jsx(
403
408
  "span",
@@ -496,6 +501,9 @@
496
501
  autoFocus,
497
502
  disabled,
498
503
  size,
504
+ className,
505
+ fullWidth = true,
506
+ inputClassName,
499
507
  ...props
500
508
  }) {
501
509
  const ref = React.useRef(null);
@@ -517,13 +525,15 @@
517
525
  !invisible && fieldBackgroundMixin,
518
526
  !invisible && (disabled ? fieldBackgroundDisabledMixin : fieldBackgroundHoverMixin),
519
527
  disabled ? "cursor-default" : "cursor-pointer",
520
- "rounded-md max-w-full justify-between w-full box-border relative inline-flex items-center",
528
+ "rounded-md max-w-full justify-between box-border relative inline-flex items-center",
521
529
  !invisible && focus && !disabled ? focusedClasses : "",
522
530
  error ? "text-red-500 dark:text-red-600" : focus && !disabled ? "text-primary" : !disabled ? "text-text-primary dark:text-text-primary-dark" : "text-text-secondary dark:text-text-secondary-dark",
523
531
  size === "smallest" ? "min-h-[40px]" : size === "small" ? "min-h-[48px]" : "min-h-[64px]",
524
532
  size === "smallest" ? "pl-2" : "pl-4",
525
533
  size === "smallest" ? "pr-4" : "pr-6",
526
- position === "end" ? "flex-row-reverse" : "flex-row"
534
+ position === "end" ? "flex-row-reverse" : "flex-row",
535
+ fullWidth ? "w-full" : "",
536
+ className
527
537
  ),
528
538
  onClick: disabled ? void 0 : (e) => {
529
539
  if (props.allowIndeterminate) {
@@ -541,7 +551,7 @@
541
551
  value,
542
552
  ref: refInput,
543
553
  size,
544
- className: invisible && focus ? focusedClasses : "",
554
+ className: cls(invisible && focus ? focusedClasses : "", inputClassName),
545
555
  disabled,
546
556
  ...props
547
557
  }