@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/components/BooleanSwitchWithLabel.d.ts +4 -1
- package/dist/index.es.js +15 -5
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +15 -5
- package/dist/index.umd.js.map +1 -1
- package/package.json +2 -2
- package/src/components/Avatar.tsx +34 -21
- package/src/components/BooleanSwitchWithLabel.tsx +12 -4
@@ -6,9 +6,12 @@ export type BooleanSwitchWithLabelProps = BooleanSwitchProps & {
|
|
6
6
|
label?: React.ReactNode;
|
7
7
|
error?: boolean;
|
8
8
|
autoFocus?: boolean;
|
9
|
+
fullWidth?: boolean;
|
10
|
+
className?: string;
|
11
|
+
inputClassName?: string;
|
9
12
|
};
|
10
13
|
/**
|
11
14
|
* Simple boolean switch.
|
12
15
|
*
|
13
16
|
*/
|
14
|
-
export declare const BooleanSwitchWithLabel: ({ value, position, invisible, onValueChange, error, label, autoFocus, disabled, size, ...props }: BooleanSwitchWithLabelProps) => import("react/jsx-runtime").JSX.Element;
|
17
|
+
export declare const BooleanSwitchWithLabel: ({ value, position, invisible, onValueChange, error, label, autoFocus, disabled, size, className, fullWidth, inputClassName, ...props }: BooleanSwitchWithLabelProps) => import("react/jsx-runtime").JSX.Element;
|
package/dist/index.es.js
CHANGED
@@ -366,6 +366,10 @@ const AvatarInner = ({
|
|
366
366
|
outerClassName,
|
367
367
|
...props
|
368
368
|
}, ref) => {
|
369
|
+
const [isImageError, setIsImageError] = useState(false);
|
370
|
+
const handleImageError = () => {
|
371
|
+
setIsImageError(true);
|
372
|
+
};
|
369
373
|
return /* @__PURE__ */ jsx(
|
370
374
|
"button",
|
371
375
|
{
|
@@ -377,7 +381,7 @@ const AvatarInner = ({
|
|
377
381
|
"p-1 hover:bg-slate-200 hover:dark:bg-slate-700 w-12 h-12 min-w-12 min-h-12",
|
378
382
|
outerClassName
|
379
383
|
),
|
380
|
-
children: src ? /* @__PURE__ */ jsx(
|
384
|
+
children: src && !isImageError ? /* @__PURE__ */ jsx(
|
381
385
|
"img",
|
382
386
|
{
|
383
387
|
className: cls(
|
@@ -386,7 +390,8 @@ const AvatarInner = ({
|
|
386
390
|
className
|
387
391
|
),
|
388
392
|
src,
|
389
|
-
alt
|
393
|
+
alt,
|
394
|
+
onError: handleImageError
|
390
395
|
}
|
391
396
|
) : /* @__PURE__ */ jsx(
|
392
397
|
"span",
|
@@ -485,6 +490,9 @@ const BooleanSwitchWithLabel = function BooleanSwitchWithLabel2({
|
|
485
490
|
autoFocus,
|
486
491
|
disabled,
|
487
492
|
size,
|
493
|
+
className,
|
494
|
+
fullWidth = true,
|
495
|
+
inputClassName,
|
488
496
|
...props
|
489
497
|
}) {
|
490
498
|
const ref = React__default.useRef(null);
|
@@ -506,13 +514,15 @@ const BooleanSwitchWithLabel = function BooleanSwitchWithLabel2({
|
|
506
514
|
!invisible && fieldBackgroundMixin,
|
507
515
|
!invisible && (disabled ? fieldBackgroundDisabledMixin : fieldBackgroundHoverMixin),
|
508
516
|
disabled ? "cursor-default" : "cursor-pointer",
|
509
|
-
"rounded-md max-w-full justify-between
|
517
|
+
"rounded-md max-w-full justify-between box-border relative inline-flex items-center",
|
510
518
|
!invisible && focus && !disabled ? focusedClasses : "",
|
511
519
|
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",
|
512
520
|
size === "smallest" ? "min-h-[40px]" : size === "small" ? "min-h-[48px]" : "min-h-[64px]",
|
513
521
|
size === "smallest" ? "pl-2" : "pl-4",
|
514
522
|
size === "smallest" ? "pr-4" : "pr-6",
|
515
|
-
position === "end" ? "flex-row-reverse" : "flex-row"
|
523
|
+
position === "end" ? "flex-row-reverse" : "flex-row",
|
524
|
+
fullWidth ? "w-full" : "",
|
525
|
+
className
|
516
526
|
),
|
517
527
|
onClick: disabled ? void 0 : (e) => {
|
518
528
|
if (props.allowIndeterminate) {
|
@@ -530,7 +540,7 @@ const BooleanSwitchWithLabel = function BooleanSwitchWithLabel2({
|
|
530
540
|
value,
|
531
541
|
ref: refInput,
|
532
542
|
size,
|
533
|
-
className: invisible && focus ? focusedClasses : "",
|
543
|
+
className: cls(invisible && focus ? focusedClasses : "", inputClassName),
|
534
544
|
disabled,
|
535
545
|
...props
|
536
546
|
}
|