@eqtylab/equality 2.2.1 → 2.2.3

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;
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;
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,17 +457,24 @@ function Badge({
456
457
  }) {
457
458
  const effectiveIcon = icon ?? (variant ? defaultVariantIcons2[variant] : void 0);
458
459
  const renderClosable = () => {
459
- if (closeable && handleClosable)
460
+ if (closeable && handleClosable) {
460
461
  return /* @__PURE__ */ jsx(
461
462
  Button,
462
463
  {
464
+ type: "button",
463
465
  variant: "tertiary",
464
466
  size: "sm",
465
- onClick: handleClosable,
467
+ onPointerDown: (e) => e.stopPropagation(),
468
+ onClick: (e) => {
469
+ e.stopPropagation();
470
+ handleClosable();
471
+ },
472
+ "aria-label": closeLabel,
466
473
  className: styles7["closable-btn"],
467
474
  children: /* @__PURE__ */ jsx(XIcon, {})
468
475
  }
469
476
  );
477
+ }
470
478
  return null;
471
479
  };
472
480
  const renderChildren = () => {
@@ -745,6 +753,7 @@ var ResourceBadge = ({
745
753
  display = "both",
746
754
  closeable,
747
755
  handleClosable,
756
+ closeLabel,
748
757
  children
749
758
  }) => {
750
759
  const config = getTypeConfig(type);
@@ -757,6 +766,7 @@ var ResourceBadge = ({
757
766
  variant: null,
758
767
  closeable,
759
768
  handleClosable,
769
+ closeLabel,
760
770
  children: children ?? config.label
761
771
  }
762
772
  );