@trafilea/afrodita-components 5.0.0-beta.21 → 5.0.0-beta.24

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/build/index.js CHANGED
@@ -3633,9 +3633,9 @@ var BaseCTA = function (_a) {
3633
3633
  };
3634
3634
 
3635
3635
  var ButtonPrimary = function (_a) {
3636
- _a.testId; var props = __rest(_a, ["testId"]);
3636
+ var _b = _a.testId, testId = _b === void 0 ? 'button-primary' : _b, props = __rest(_a, ["testId"]);
3637
3637
  var theme = useTheme();
3638
- return (jsx(BaseCTA, __assign$1({}, props, { css: {
3638
+ return (jsx(BaseCTA, __assign$1({}, props, { testId: testId, css: {
3639
3639
  backgroundColor: theme.component.button.primary.active.backgroundColor,
3640
3640
  color: theme.component.button.primary.active.color,
3641
3641
  border: theme.component.button.border,
@@ -4563,11 +4563,11 @@ var ImageSmallPreview = function (_a) {
4563
4563
  var templateObject_1$Y;
4564
4564
 
4565
4565
  var Container$B = newStyled.div(templateObject_1$X || (templateObject_1$X = __makeTemplateObject(["\n grid-row-gap: 20px;\n display: grid;\n max-height: 45rem;\n height: min-content;\n overflow: auto;\n align-items: flex-start;\n"], ["\n grid-row-gap: 20px;\n display: grid;\n max-height: 45rem;\n height: min-content;\n overflow: auto;\n align-items: flex-start;\n"])));
4566
- var Button$5 = newStyled.button(templateObject_2$B || (templateObject_2$B = __makeTemplateObject(["\n padding: 0;\n border: none;\n text-decoration: none;\n background: transparent;\n"], ["\n padding: 0;\n border: none;\n text-decoration: none;\n background: transparent;\n"])));
4566
+ var Button$4 = newStyled.button(templateObject_2$B || (templateObject_2$B = __makeTemplateObject(["\n padding: 0;\n border: none;\n text-decoration: none;\n background: transparent;\n"], ["\n padding: 0;\n border: none;\n text-decoration: none;\n background: transparent;\n"])));
4567
4567
  var ImagePreviewList = function (_a) {
4568
4568
  var images = _a.images, selectedImage = _a.selectedImage, onClick = _a.onClick, testId = _a.testId;
4569
4569
  return (jsxRuntime.jsx(Container$B, __assign$1({ "data-testid": testId }, { children: images.map(function (item) {
4570
- return (jsxRuntime.jsx(Button$5, __assign$1({ onClick: function () { return onClick(item); } }, { children: jsxRuntime.jsx(ImageSmallPreview, { imageUrl: item.imageUrl, alt: item.alt, selected: item.key === selectedImage.key }, void 0) }), item.key));
4570
+ return (jsxRuntime.jsx(Button$4, __assign$1({ onClick: function () { return onClick(item); } }, { children: jsxRuntime.jsx(ImageSmallPreview, { imageUrl: item.imageUrl, alt: item.alt, selected: item.key === selectedImage.key }, void 0) }), item.key));
4571
4571
  }) }), void 0));
4572
4572
  };
4573
4573
  var templateObject_1$X, templateObject_2$B;
@@ -5487,7 +5487,7 @@ var BaseInput = function (_a) {
5487
5487
  : '' }, { children: [label && (jsxRuntime.jsx(InputLabel, { label: label, isDisabled: rest.disabled, isRequired: Boolean(required) }, void 0)), jsxRuntime.jsxs(InputWrapper, __assign$1({ className: "inputWrapper", size: size }, { children: [jsxRuntime.jsx(StyledInput, __assign$1({ "data-testid": "base-input", type: "text", onChange: handleChange, onBlur: validate, required: Boolean(required), value: internalValue }, rest, styling), void 0), children] }), void 0), required && status === exports.InputValidationType.Error && jsxRuntime.jsx(Error$1, { error: required }, void 0)] }), void 0));
5488
5488
  };
5489
5489
 
5490
- var Button$4 = function (_a) {
5490
+ var Button$3 = function (_a) {
5491
5491
  var variant = _a.variant, props = __rest(_a, ["variant"]);
5492
5492
  if (variant === 'primary') {
5493
5493
  return jsxRuntime.jsx(ButtonPrimary, __assign$1({}, props), void 0);
@@ -5518,7 +5518,7 @@ var Custom = function (_a) {
5518
5518
  text: text,
5519
5519
  disabled: rest.disabled,
5520
5520
  }); }, [variant, onClick, text, rest.disabled]);
5521
- return (jsxRuntime.jsx(Container$o, __assign$1({ theme: theme }, { children: jsxRuntime.jsx(BaseInput, __assign$1({}, rest, { children: jsxRuntime.jsx(ButtonContainer$1, __assign$1({ theme: theme }, { children: jsxRuntime.jsx(Button$4, __assign$1({}, props), void 0) }), void 0) }), void 0) }), void 0));
5521
+ return (jsxRuntime.jsx(Container$o, __assign$1({ theme: theme }, { children: jsxRuntime.jsx(BaseInput, __assign$1({}, rest, { children: jsxRuntime.jsx(ButtonContainer$1, __assign$1({ theme: theme }, { children: jsxRuntime.jsx(Button$3, __assign$1({}, props), void 0) }), void 0) }), void 0) }), void 0));
5522
5522
  };
5523
5523
  var templateObject_1$G, templateObject_2$r;
5524
5524
 
@@ -5875,7 +5875,7 @@ var Review = function (_a) {
5875
5875
  };
5876
5876
  var templateObject_1$s, templateObject_2$g, templateObject_3$d, templateObject_4$8, templateObject_5$6, templateObject_6$5, templateObject_7$2;
5877
5877
 
5878
- var Button$3 = newStyled.button(function () { return ({
5878
+ var Button$2 = newStyled.button(function () { return ({
5879
5879
  background: 'transparent',
5880
5880
  border: 'none',
5881
5881
  cursor: 'pointer',
@@ -5887,7 +5887,7 @@ var Direction;
5887
5887
  })(Direction || (Direction = {}));
5888
5888
  var ArrowButton$1 = function (_a) {
5889
5889
  var direction = _a.direction, onClick = _a.onClick, width = _a.width, height = _a.height, className = _a.className;
5890
- return (jsxRuntime.jsx(Button$3, __assign$1({ className: className, type: "button", onClick: onClick, "data-testid": "arrow-button-".concat(direction) }, { children: direction === 'left' ? (jsxRuntime.jsx(Icon.Arrows.ChevronLeft, { width: width, height: height, opacity: 0.5 }, void 0)) : (jsxRuntime.jsx(Icon.Arrows.ChevronRight, { width: width, height: height, opacity: 0.5 }, void 0)) }), void 0));
5890
+ return (jsxRuntime.jsx(Button$2, __assign$1({ className: className, type: "button", onClick: onClick, "data-testid": "arrow-button-".concat(direction) }, { children: direction === 'left' ? (jsxRuntime.jsx(Icon.Arrows.ChevronLeft, { width: width, height: height, opacity: 0.5 }, void 0)) : (jsxRuntime.jsx(Icon.Arrows.ChevronRight, { width: width, height: height, opacity: 0.5 }, void 0)) }), void 0));
5891
5891
  };
5892
5892
 
5893
5893
  function _defineProperty(obj, key, value) {
@@ -10488,12 +10488,13 @@ var Li = newStyled.li(templateObject_1$g || (templateObject_1$g = __makeTemplate
10488
10488
  padding: [0, '0rem 1rem'],
10489
10489
  borderRadius: [0, '0.5rem'],
10490
10490
  }));
10491
- var Button$2 = newStyled.button({
10491
+ var Anchor = newStyled.a({
10492
10492
  width: '100%',
10493
10493
  border: 'none',
10494
10494
  background: 'transparent',
10495
10495
  cursor: 'pointer',
10496
10496
  padding: 0,
10497
+ textDecoration: 'none',
10497
10498
  });
10498
10499
  var Container$9 = newStyled.div(templateObject_2$8 || (templateObject_2$8 = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n margin: 0rem;\n padding: 0rem;\n position: absolute;\n width: 100%;\n background-color: white;\n box-sizing: border-box;\n z-index: 2;\n ", ",\n"], ["\n display: flex;\n flex-direction: column;\n margin: 0rem;\n padding: 0rem;\n position: absolute;\n width: 100%;\n background-color: white;\n box-sizing: border-box;\n z-index: 2;\n ", ",\n"])), mediaQueries({
10499
10500
  border: ['none', '0.063rem solid var(--colors-pallete-secondary-color)'],
@@ -10504,9 +10505,9 @@ var Header$1 = newStyled.div(templateObject_3$8 || (templateObject_3$8 = __makeT
10504
10505
  margin: ['0rem 0rem 1rem 0rem', '1rem'],
10505
10506
  }));
10506
10507
  var ResultsPanel = function (_a) {
10507
- var options = _a.options, header = _a.header, footer = _a.footer, onClick = _a.onClick, onViewAll = _a.onViewAll, testId = _a.testId;
10508
+ var options = _a.options, header = _a.header, footer = _a.footer, onViewAll = _a.onViewAll, testId = _a.testId;
10508
10509
  var theme = useTheme();
10509
- return (jsxRuntime.jsxs(Container$9, __assign$1({ "data-testid": testId, theme: theme }, { children: [header && (jsxRuntime.jsx(Header$1, __assign$1({ theme: theme }, { children: jsxRuntime.jsx(Text$5, __assign$1({ variant: "heading6", weight: "demi" }, { children: header }), void 0) }), void 0)), jsxRuntime.jsx(Ul, { children: options.map(function (item, index) { return (jsxRuntime.jsx(Li, __assign$1({ theme: theme }, { children: jsxRuntime.jsx(Button$2, __assign$1({ onClick: function () { return onClick(item); } }, { children: jsxRuntime.jsx(ProductItem, { src: item.src, title: item.title, price: item.price }, void 0) }), void 0) }), index)); }) }, void 0), footer && jsxRuntime.jsx(Footer, { text: footer, onClick: onViewAll }, void 0)] }), void 0));
10510
+ return (jsxRuntime.jsxs(Container$9, __assign$1({ "data-testid": testId, theme: theme }, { children: [header && (jsxRuntime.jsx(Header$1, __assign$1({ theme: theme }, { children: jsxRuntime.jsx(Text$5, __assign$1({ variant: "heading6", weight: "demi" }, { children: header }), void 0) }), void 0)), jsxRuntime.jsx(Ul, { children: options.map(function (item, index) { return (jsxRuntime.jsx(Li, __assign$1({ theme: theme }, { children: jsxRuntime.jsx(Anchor, __assign$1({ href: item.optionUrl }, { children: jsxRuntime.jsx(ProductItem, { src: item.src, title: item.title, price: item.price }, void 0) }), void 0) }), index)); }) }, void 0), footer && jsxRuntime.jsx(Footer, { text: footer, onClick: onViewAll }, void 0)] }), void 0));
10510
10511
  };
10511
10512
  var templateObject_1$g, templateObject_2$8, templateObject_3$8;
10512
10513
 
@@ -10602,11 +10603,11 @@ var SearchIconContainer = newStyled.div({
10602
10603
  alignSelf: 'center',
10603
10604
  });
10604
10605
  var SearchControl = function (_a) {
10605
- var open = _a.open, onSearch = _a.onSearch, onClear = _a.onClear;
10606
+ var open = _a.open, onSearch = _a.onSearch, onClose = _a.onClose;
10606
10607
  var theme = useTheme();
10607
10608
  var isMobile = useWindowDimensions(theme.mediaQueries).isMobile;
10608
10609
  if (isMobile) {
10609
- return open ? (jsx(ClearButton, { onClick: onClear }, void 0)) : (jsx(SearchIconContainer, { children: jsx(Icon.Navigation.Search, { height: 1.25, width: 1.25 }, void 0) }, void 0));
10610
+ return open ? (jsx(ClearButton, { onClick: onClose }, void 0)) : (jsx(SearchIconContainer, { children: jsx(Icon.Navigation.Search, { height: 1.25, width: 1.25 }, void 0) }, void 0));
10610
10611
  }
10611
10612
  else {
10612
10613
  return (jsxs(Fragment, { children: [jsx(ButtonSecondary, { css: {
@@ -10616,7 +10617,7 @@ var SearchControl = function (_a) {
10616
10617
  borderTopLeftRadius: 0,
10617
10618
  borderBottomLeftRadius: 0,
10618
10619
  padding: '0.875rem 1.5rem',
10619
- }, text: "SEARCH", onClick: onSearch }, void 0), jsx(ClearButton, { onClick: onClear }, void 0)] }, void 0));
10620
+ }, text: "SEARCH", onClick: onSearch }, void 0), jsx(ClearButton, { onClick: onClose }, void 0)] }, void 0));
10620
10621
  }
10621
10622
  };
10622
10623
 
@@ -10626,15 +10627,9 @@ var reducer = function (state, action) {
10626
10627
  case 'UPDATE_TERM': {
10627
10628
  return __assign$1(__assign$1({}, state), { term: action.payload.term });
10628
10629
  }
10629
- case 'UPDATE_OPTION': {
10630
- return __assign$1(__assign$1({}, state), { selectedOption: action.payload.selectedOption, term: action.payload.selectedOption.title.replaceAll(/(<([^>]+)>)/gi, ''), open: false });
10631
- }
10632
10630
  case 'TOGGLE_PANEL': {
10633
10631
  return __assign$1(__assign$1({}, state), { open: action.payload.open });
10634
10632
  }
10635
- case 'CLEAR': {
10636
- return __assign$1(__assign$1({}, state), { term: '', open: false });
10637
- }
10638
10633
  }
10639
10634
  };
10640
10635
  var Container$8 = newStyled.div({
@@ -10642,7 +10637,7 @@ var Container$8 = newStyled.div({
10642
10637
  display: 'flex',
10643
10638
  });
10644
10639
  var SearchBar = function (_a) {
10645
- var suggestions = _a.suggestions, resultOptions = _a.resultOptions, onChange = _a.onChange, onSearch = _a.onSearch, resultsPanelDataTestId = _a.resultsPanelDataTestId, allResults = _a.allResults, initialTerm = _a.initialTerm;
10640
+ var suggestions = _a.suggestions, resultOptions = _a.resultOptions, onChange = _a.onChange, onSearch = _a.onSearch, onClose = _a.onClose, resultsPanelDataTestId = _a.resultsPanelDataTestId, allResults = _a.allResults, initialTerm = _a.initialTerm;
10646
10641
  var theme = useTheme();
10647
10642
  if (initialTerm) {
10648
10643
  initialState$1.term = initialTerm;
@@ -10665,10 +10660,7 @@ var SearchBar = function (_a) {
10665
10660
  : shouldDisplaySuggestion()
10666
10661
  ? suggestions
10667
10662
  : [];
10668
- return (jsxRuntime.jsxs("form", __assign$1({ role: "search", onSubmit: function (e) { return e.preventDefault(); }, ref: ref, style: { position: 'relative' } }, { children: [jsxRuntime.jsxs(Container$8, __assign$1({ theme: theme }, { children: [jsxRuntime.jsx(Input, { value: state.term, placeholder: "Search for products", onChange: function (e) { return dispatch({ type: 'UPDATE_TERM', payload: { term: e.target.value } }); }, onFocus: function () { return dispatch({ type: 'TOGGLE_PANEL', payload: { open: true } }); }, id: "search", autoComplete: "off", theme: theme, "aria-label": "Search for products" }, void 0), jsxRuntime.jsx(SearchControl, { open: state.open, onClear: function () { return dispatch({ type: 'CLEAR', payload: {} }); }, onSearch: function () { return onSearch(state.term); } }, void 0)] }), void 0), state.open && !!options.length && (jsxRuntime.jsx(ResultsPanel, { testId: resultsPanelDataTestId, options: options, header: shouldDisplaySuggestion() ? 'Most popular products' : undefined, footer: allResults ? "View all results (".concat(allResults, ")") : undefined, onClick: function (value) {
10669
- onSearch(value.title);
10670
- dispatch({ type: 'UPDATE_OPTION', payload: { selectedOption: value } });
10671
- }, onViewAll: function () { return onSearch(state.term); } }, void 0))] }), void 0));
10663
+ return (jsxRuntime.jsxs("form", __assign$1({ role: "search", onSubmit: function (e) { return e.preventDefault(); }, ref: ref, style: { position: 'relative' } }, { children: [jsxRuntime.jsxs(Container$8, __assign$1({ theme: theme }, { children: [jsxRuntime.jsx(Input, { value: state.term, placeholder: "Search for products", onChange: function (e) { return dispatch({ type: 'UPDATE_TERM', payload: { term: e.target.value } }); }, onFocus: function () { return dispatch({ type: 'TOGGLE_PANEL', payload: { open: true } }); }, id: "search", autoComplete: "off", theme: theme, "aria-label": "Search for products" }, void 0), jsxRuntime.jsx(SearchControl, { open: state.open, onClose: onClose, onSearch: function () { return onSearch(state.term); } }, void 0)] }), void 0), state.open && !!options.length && (jsxRuntime.jsx(ResultsPanel, { testId: resultsPanelDataTestId, options: options, header: shouldDisplaySuggestion() ? 'Most popular products' : undefined, footer: allResults ? "View all results (".concat(allResults, ")") : undefined, onViewAll: function () { return onSearch(state.term); } }, void 0))] }), void 0));
10672
10664
  };
10673
10665
 
10674
10666
  function _extends() {