@asantemedia-org/edwardsvacuum-design-system 1.4.3 → 1.4.5

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.esm.js CHANGED
@@ -4720,7 +4720,7 @@ function _extends() {
4720
4720
 
4721
4721
  var styles = {"cmp-button":"Button-module__cmp-button___SMjDF","cmp-button--style-primary":"Button-module__cmp-button--style-primary___hfLAd","cmp-button--style-secondary":"Button-module__cmp-button--style-secondary___3Dqvg","cmp-button--style-tertiary":"Button-module__cmp-button--style-tertiary___Akcep","cmp-button--style-outlineWhite":"Button-module__cmp-button--style-outlineWhite___v69nN","cmp-button--style-outlineGrey":"Button-module__cmp-button--style-outlineGrey___sG5nd"};
4722
4722
 
4723
- // Utility function to retrieve correct SCSS module class names
4723
+ // Utility to safely retrieve SCSS class names
4724
4724
  var getStyle = function (className) {
4725
4725
  if (styles[className]) return styles[className];
4726
4726
  var nestedMatch = Object.keys(styles).find(function (key) {
@@ -4728,16 +4728,37 @@ var getStyle = function (className) {
4728
4728
  });
4729
4729
  return nestedMatch ? styles[nestedMatch] : '';
4730
4730
  };
4731
- /**
4732
- * Primary UI component for user interaction
4733
- */
4734
4731
  var Button = function (_a) {
4735
- var style = _a.style,
4732
+ var _b = _a.className,
4733
+ className = _b === void 0 ? '' : _b,
4734
+ style = _a.style,
4736
4735
  label = _a.label,
4737
- props = __rest(_a, ["style", "label"]);
4736
+ element = _a.element,
4737
+ onClick = _a.onClick,
4738
+ href = _a.href,
4739
+ target = _a.target,
4740
+ rel = _a.rel,
4741
+ dataTargetSelector = _a["data-target-selector"],
4742
+ props = __rest(_a, ["className", "style", "label", "element", "onClick", "href", "target", "rel", 'data-target-selector']);
4738
4743
  var mode = style ? getStyle("cmp-button--style-".concat(style)) : '';
4744
+ var baseClass = getStyle('cmp-button');
4745
+ // Add js-modal class if data-target-selector is present
4746
+ var conditionalClasses = [baseClass, mode, className, dataTargetSelector ? 'js-modal' : ''].filter(Boolean).join(' ').trim();
4747
+ // Infer element type
4748
+ var inferredElement = element || (href || dataTargetSelector ? 'a' : 'button');
4749
+ if (inferredElement === 'a') {
4750
+ return /*#__PURE__*/React.createElement("a", _extends({
4751
+ className: conditionalClasses,
4752
+ href: href,
4753
+ target: target,
4754
+ rel: rel,
4755
+ "data-target-selector": dataTargetSelector
4756
+ }, props), label);
4757
+ }
4739
4758
  return /*#__PURE__*/React.createElement("button", _extends({
4740
- className: [getStyle('cmp-button'), mode].join(' ')
4759
+ className: conditionalClasses,
4760
+ type: "button",
4761
+ onClick: onClick
4741
4762
  }, props), label);
4742
4763
  };
4743
4764
 
@@ -4784,9 +4805,10 @@ var AlgoliaDynamicSearch = function (_a) {
4784
4805
  heading = _a.heading,
4785
4806
  titleSize = _a.titleSize,
4786
4807
  subtext = _a.subtext,
4787
- calltoactiontype = _a.calltoactiontype,
4808
+ callToActionType = _a.callToActionType,
4788
4809
  callToActionText = _a.callToActionText,
4789
4810
  callToActionUrl = _a.callToActionUrl,
4811
+ callToActionTargetSelector = _a.callToActionTargetSelector,
4790
4812
  _c = _a.queryType,
4791
4813
  queryType = _c === void 0 ? 'unknown' : _c,
4792
4814
  hits = _a.hits,
@@ -4846,18 +4868,26 @@ var AlgoliaDynamicSearch = function (_a) {
4846
4868
  titleSize: titleSize
4847
4869
  }, heading), /*#__PURE__*/React.createElement("p", null, subtext)), callToActionUrl && /*#__PURE__*/React.createElement("div", {
4848
4870
  className: styles$4.cmpAlgoliaDynamicSearchWidget__header__cta
4849
- }, /*#__PURE__*/React.createElement(Button, {
4850
- style: widgetStyleProps.buttonStyle,
4851
- label: callToActionText,
4852
- onClick: function () {
4853
- var _a = getCallToActionProps(calltoactiontype, callToActionUrl),
4854
- finalUrl = _a.finalUrl,
4855
- target = _a.target;
4856
- if (finalUrl) {
4857
- window.open(finalUrl, target || "_self", target === '_blank' ? "noopener,noreferrer" : undefined);
4858
- }
4859
- }
4860
- }))), /*#__PURE__*/React.createElement("div", {
4871
+ }, function () {
4872
+ var _a = getCallToActionProps(callToActionType, callToActionUrl),
4873
+ finalUrl = _a.finalUrl,
4874
+ target = _a.target;
4875
+ var isAnchor = !!callToActionTargetSelector || (callToActionType === null || callToActionType === void 0 ? void 0 : callToActionType.toLowerCase()) !== 'internal';
4876
+ return /*#__PURE__*/React.createElement(Button, {
4877
+ element: isAnchor ? 'a' : 'button',
4878
+ style: widgetStyleProps.buttonStyle,
4879
+ label: callToActionText,
4880
+ href: isAnchor ? finalUrl : undefined,
4881
+ target: target,
4882
+ rel: target === '_blank' ? 'noopener noreferrer' : undefined,
4883
+ "data-target-selector": callToActionTargetSelector,
4884
+ onClick: !isAnchor ? function () {
4885
+ if (finalUrl) {
4886
+ window.open(finalUrl, target || '_self', target === '_blank' ? 'noopener,noreferrer' : undefined);
4887
+ }
4888
+ } : undefined
4889
+ });
4890
+ }())), /*#__PURE__*/React.createElement("div", {
4861
4891
  className: styles$4.cmpAlgoliaDynamicSearchWidget__cards
4862
4892
  }, hits.slice(0, maxResults).map(function (hit, index) {
4863
4893
  var Component = Card;