@eqtylab/equality 2.2.1 → 2.2.2

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.d.cts CHANGED
@@ -85,6 +85,7 @@ type BadgeDisplayMode = 'both' | 'text-only' | 'icon-only';
85
85
  interface BadgeProps extends React$1.HTMLAttributes<HTMLDivElement>, VariantProps<typeof badgeVariants> {
86
86
  closeable?: boolean;
87
87
  handleClosable?: () => void;
88
+ closeLabel?: string;
88
89
  truncate?: boolean;
89
90
  truncateLength?: number;
90
91
  icon?: React$1.ReactElement | string;
@@ -92,7 +93,7 @@ interface BadgeProps extends React$1.HTMLAttributes<HTMLDivElement>, VariantProp
92
93
  monospace?: boolean;
93
94
  pill?: boolean;
94
95
  }
95
- declare function Badge({ className, variant, size, closeable, handleClosable, truncate, truncateLength, icon, display, monospace, pill, ...props }: BadgeProps): react_jsx_runtime.JSX.Element;
96
+ declare function Badge({ className, variant, size, closeable, handleClosable, closeLabel, truncate, truncateLength, icon, display, monospace, pill, ...props }: BadgeProps): react_jsx_runtime.JSX.Element;
96
97
 
97
98
  interface BarGraphSegmentProps extends Omit<React$1.HTMLAttributes<HTMLDivElement>, 'color'> {
98
99
  /** Proportional value used to compute the segment's width (`value / sum of all values`). */
@@ -234,9 +235,10 @@ interface ResourceBadgeProps {
234
235
  display?: ResourceDisplayMode;
235
236
  closeable?: boolean;
236
237
  handleClosable?: () => void;
238
+ closeLabel?: string;
237
239
  children?: React$1.ReactNode;
238
240
  }
239
- declare const ResourceBadge: ({ type, display, closeable, handleClosable, children, }: ResourceBadgeProps) => react_jsx_runtime.JSX.Element;
241
+ declare const ResourceBadge: ({ type, display, closeable, handleClosable, closeLabel, children, }: ResourceBadgeProps) => react_jsx_runtime.JSX.Element;
240
242
 
241
243
  interface CardContentHeaderProps {
242
244
  className?: string;
@@ -876,7 +878,7 @@ declare const TruncatedDescription: ({ className, description, maxLength, }: Tru
876
878
 
877
879
  declare const iconVariants: (props?: ({
878
880
  size?: "xs" | "sm" | "md" | "lg" | null | undefined;
879
- background?: "square" | "circle" | "transparent" | null | undefined;
881
+ background?: "circle" | "square" | "transparent" | null | undefined;
880
882
  } & class_variance_authority_types.ClassProp) | undefined) => string;
881
883
  declare const iconElevationVariants: (props?: ({
882
884
  elevation?: string | number | null | undefined;
package/dist/index.d.ts CHANGED
@@ -85,6 +85,7 @@ type BadgeDisplayMode = 'both' | 'text-only' | 'icon-only';
85
85
  interface BadgeProps extends React$1.HTMLAttributes<HTMLDivElement>, VariantProps<typeof badgeVariants> {
86
86
  closeable?: boolean;
87
87
  handleClosable?: () => void;
88
+ closeLabel?: string;
88
89
  truncate?: boolean;
89
90
  truncateLength?: number;
90
91
  icon?: React$1.ReactElement | string;
@@ -92,7 +93,7 @@ interface BadgeProps extends React$1.HTMLAttributes<HTMLDivElement>, VariantProp
92
93
  monospace?: boolean;
93
94
  pill?: boolean;
94
95
  }
95
- declare function Badge({ className, variant, size, closeable, handleClosable, truncate, truncateLength, icon, display, monospace, pill, ...props }: BadgeProps): react_jsx_runtime.JSX.Element;
96
+ declare function Badge({ className, variant, size, closeable, handleClosable, closeLabel, truncate, truncateLength, icon, display, monospace, pill, ...props }: BadgeProps): react_jsx_runtime.JSX.Element;
96
97
 
97
98
  interface BarGraphSegmentProps extends Omit<React$1.HTMLAttributes<HTMLDivElement>, 'color'> {
98
99
  /** Proportional value used to compute the segment's width (`value / sum of all values`). */
@@ -234,9 +235,10 @@ interface ResourceBadgeProps {
234
235
  display?: ResourceDisplayMode;
235
236
  closeable?: boolean;
236
237
  handleClosable?: () => void;
238
+ closeLabel?: string;
237
239
  children?: React$1.ReactNode;
238
240
  }
239
- declare const ResourceBadge: ({ type, display, closeable, handleClosable, children, }: ResourceBadgeProps) => react_jsx_runtime.JSX.Element;
241
+ declare const ResourceBadge: ({ type, display, closeable, handleClosable, closeLabel, children, }: ResourceBadgeProps) => react_jsx_runtime.JSX.Element;
240
242
 
241
243
  interface CardContentHeaderProps {
242
244
  className?: string;
@@ -876,7 +878,7 @@ declare const TruncatedDescription: ({ className, description, maxLength, }: Tru
876
878
 
877
879
  declare const iconVariants: (props?: ({
878
880
  size?: "xs" | "sm" | "md" | "lg" | null | undefined;
879
- background?: "square" | "circle" | "transparent" | null | undefined;
881
+ background?: "circle" | "square" | "transparent" | null | undefined;
880
882
  } & class_variance_authority_types.ClassProp) | undefined) => string;
881
883
  declare const iconElevationVariants: (props?: ({
882
884
  elevation?: string | number | null | undefined;
package/dist/index.js CHANGED
@@ -446,6 +446,7 @@ function Badge({
446
446
  size,
447
447
  closeable,
448
448
  handleClosable,
449
+ closeLabel = "Remove",
449
450
  truncate = false,
450
451
  truncateLength = 50,
451
452
  icon,
@@ -456,18 +457,19 @@ function Badge({
456
457
  }) {
457
458
  const effectiveIcon = icon ?? (variant ? defaultVariantIcons2[variant] : void 0);
458
459
  const renderClosable = () => {
459
- if (closeable && handleClosable)
460
- return /* @__PURE__ */ jsx(
461
- Button,
462
- {
463
- variant: "tertiary",
464
- size: "sm",
465
- onClick: handleClosable,
466
- className: styles7["closable-btn"],
467
- children: /* @__PURE__ */ jsx(XIcon, {})
468
- }
469
- );
470
- return null;
460
+ if (!closeable) return null;
461
+ return /* @__PURE__ */ jsx(
462
+ Button,
463
+ {
464
+ type: "button",
465
+ variant: "tertiary",
466
+ size: "sm",
467
+ onClick: handleClosable,
468
+ "aria-label": closeLabel,
469
+ className: styles7["closable-btn"],
470
+ children: /* @__PURE__ */ jsx(XIcon, {})
471
+ }
472
+ );
471
473
  };
472
474
  const renderChildren = () => {
473
475
  const children = props.children;
@@ -745,6 +747,7 @@ var ResourceBadge = ({
745
747
  display = "both",
746
748
  closeable,
747
749
  handleClosable,
750
+ closeLabel,
748
751
  children
749
752
  }) => {
750
753
  const config = getTypeConfig(type);
@@ -757,6 +760,7 @@ var ResourceBadge = ({
757
760
  variant: null,
758
761
  closeable,
759
762
  handleClosable,
763
+ closeLabel,
760
764
  children: children ?? config.label
761
765
  }
762
766
  );