@ballistix.digital/react-components 7.1.3-rc-67.0 → 7.1.3-rc-69.0

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.js CHANGED
@@ -633,10 +633,12 @@ var $29a51bd84954e590$export$2e2bcd8739ae039 = $29a51bd84954e590$var$AlertElemen
633
633
 
634
634
 
635
635
 
636
+
636
637
  var $ede6d6a597d91170$var$base = {
637
638
  container: 'inline-flex items-center font-medium py-0.5',
638
639
  indicator: '',
639
- button: 'shrink-0 ml-0.5 h-4 w-4 rounded-full inline-flex items-center justify-center focus:text-white focus:outline-hidden'
640
+ button: 'shrink-0 ml-0.5 h-4 w-4 rounded-full inline-flex items-center justify-center focus:text-white focus:outline-hidden cursor-pointer',
641
+ closeIcon: ''
640
642
  };
641
643
  var $ede6d6a597d91170$var$normal = {
642
644
  container: 'px-2.5'
@@ -743,7 +745,7 @@ var $ede6d6a597d91170$export$2e2bcd8739ae039 = $ede6d6a597d91170$var$styles;
743
745
 
744
746
 
745
747
  var $0b842d364fa010cf$var$BadgeElement = function(props) {
746
- var children = props.children, _a = props.color, color = _a === void 0 ? 'gray' : _a, _b = props.type, type = _b === void 0 ? 'normal' : _b, _c = props.size, size = _c === void 0 ? 'sm' : _c, _d = props.figure, figure = _d === void 0 ? 'block' : _d, isDisabled = props.isDisabled, isLoading = props.isLoading, onClose = props.onClose, stylesOverrides = props.styles, dataCy = props.dataCy;
748
+ var children = props.children, _a = props.color, color = _a === void 0 ? 'gray' : _a, _b = props.type, type = _b === void 0 ? 'normal' : _b, _c = props.size, size = _c === void 0 ? 'sm' : _c, _d = props.figure, figure = _d === void 0 ? 'block' : _d, isDisabled = props.isDisabled, isLoading = props.isLoading, onClick = props.onClick, onClose = props.onClose, stylesOverrides = props.styles, dataCy = props.dataCy;
747
749
  var handleGenerateStyle = function() {
748
750
  var result = (0, $f0c671820c340322$export$e2d2075c69d9100d)((0, $ede6d6a597d91170$export$2e2bcd8739ae039).base);
749
751
  var keys = (0, $27f90b0cff19565d$export$be5d6ab3c5b84767)((0, $ede6d6a597d91170$export$2e2bcd8739ae039).base);
@@ -753,17 +755,33 @@ var $0b842d364fa010cf$var$BadgeElement = function(props) {
753
755
  return result;
754
756
  };
755
757
  var styles = handleGenerateStyle();
756
- var xIcon = (0, $iA2ta$reactjsxruntime.jsx)("svg", {
757
- className: "h-2 w-2",
758
- stroke: "currentColor",
759
- fill: "none",
760
- viewBox: "0 0 8 8",
761
- children: (0, $iA2ta$reactjsxruntime.jsx)("path", {
762
- strokeLinecap: "round",
763
- strokeWidth: "1.5",
764
- d: "M1 1l6 6m0-6L1 7"
765
- })
766
- });
758
+ var closeButton = (0, $iA2ta$react.useMemo)(function() {
759
+ if (type !== 'close' || !onClose) return null;
760
+ var handleClose = function(e) {
761
+ e.stopPropagation();
762
+ onClose(e);
763
+ };
764
+ return (0, $iA2ta$reactjsxruntime.jsxs)("div", {
765
+ className: styles.button,
766
+ onClick: handleClose,
767
+ children: [
768
+ (0, $iA2ta$reactjsxruntime.jsx)("span", {
769
+ className: "sr-only",
770
+ children: "Remove large option"
771
+ }),
772
+ (0, $iA2ta$reactjsxruntime.jsx)((0, $2125901b4a9afff9$export$2e2bcd8739ae039), {
773
+ className: styles.closeIcon,
774
+ type: "regular",
775
+ accessor: "times"
776
+ })
777
+ ]
778
+ });
779
+ }, [
780
+ type,
781
+ onClose,
782
+ styles.button,
783
+ styles.closeIcon
784
+ ]);
767
785
  if (isLoading) return (0, $iA2ta$reactjsxruntime.jsx)("span", {
768
786
  className: (0, $622cd2936b18c771$export$4370d69198e9314a)(styles.container, 'h-4 w-12 animate-pulse'),
769
787
  children: type === 'indicator' && (0, $iA2ta$reactjsxruntime.jsx)("svg", {
@@ -778,8 +796,9 @@ var $0b842d364fa010cf$var$BadgeElement = function(props) {
778
796
  })
779
797
  });
780
798
  return (0, $iA2ta$reactjsxruntime.jsxs)("span", {
781
- className: styles.container,
799
+ className: (0, $622cd2936b18c771$export$4370d69198e9314a)(styles.container, !!onClick && 'cursor-pointer'),
782
800
  "data-cy": dataCy,
801
+ onClick: onClick,
783
802
  children: [
784
803
  type === 'indicator' && (0, $iA2ta$reactjsxruntime.jsx)("svg", {
785
804
  className: styles.indicator,
@@ -792,18 +811,7 @@ var $0b842d364fa010cf$var$BadgeElement = function(props) {
792
811
  })
793
812
  }),
794
813
  children,
795
- type === 'close' && (0, $iA2ta$reactjsxruntime.jsxs)("button", {
796
- type: "button",
797
- className: styles.button,
798
- onClick: onClose,
799
- children: [
800
- (0, $iA2ta$reactjsxruntime.jsx)("span", {
801
- className: "sr-only",
802
- children: "Remove large option"
803
- }),
804
- xIcon
805
- ]
806
- })
814
+ closeButton
807
815
  ]
808
816
  });
809
817
  };