@trafilea/afrodita-components 6.14.1 → 6.14.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/build/index.d.ts CHANGED
@@ -5,7 +5,7 @@ import { ComponentSize as ComponentSize$1 } from 'src/types/enums';
5
5
  import * as _emotion_react_types_jsx_namespace from '@emotion/react/types/jsx-namespace';
6
6
  import { TextProps as TextProps$1 } from 'src/components/text/Text';
7
7
  import * as _emotion_react_jsx_runtime from '@emotion/react/jsx-runtime';
8
- import { ContentType as ContentType$1, IconProps as IconProps$2 } from 'src/types/types';
8
+ import { ContentType as ContentType$1, RadioGroupOption as RadioGroupOption$1, IconProps as IconProps$2 } from 'src/types/types';
9
9
  import * as _emotion_styled from '@emotion/styled';
10
10
  import { StyledComponent } from '@emotion/styled';
11
11
  export { default as styled } from '@emotion/styled';
@@ -1172,6 +1172,7 @@ declare type AutoshipPropsV2 = {
1172
1172
  frequencyValues?: Array<number>;
1173
1173
  frequencyUnit?: string;
1174
1174
  autoshipBenefits: string[];
1175
+ benefits?: string[];
1175
1176
  onChange: (values: {
1176
1177
  subscriptionPeriod: number;
1177
1178
  autoship: boolean;
@@ -2931,10 +2932,10 @@ interface RadioProps {
2931
2932
  value: string;
2932
2933
  id: string;
2933
2934
  label: string | ReactFragment;
2934
- size?: ComponentSize.Small | ComponentSize.Medium | ComponentSize.Large;
2935
+ size?: ComponentSize$1.Small | ComponentSize$1.Medium | ComponentSize$1.Large;
2935
2936
  checked?: boolean;
2936
2937
  disabled?: boolean;
2937
- onChange: (option: RadioGroupOption) => void;
2938
+ onChange: (option: RadioGroupOption$1) => void;
2938
2939
  style?: React__default.CSSProperties;
2939
2940
  useV2Style?: boolean;
2940
2941
  }
@@ -5800,7 +5800,11 @@ var Autoship = function (_a) {
5800
5800
  : benefitsColor.base }, void 0), jsx$1(BenefitText$1, __assign$1({ variant: "body" }, { children: benefit }), void 0)] }, benefit)); }) }, void 0), radioIds$1.autoship.id === radioCheck.id && (jsxs$1(Fragment$2, { children: [jsxs$1(FlexContainer$1, { children: [jsx$1(DeliveryFrequencyLabel$1, __assign$1({ variant: "body" }, { children: "Deliver every:" }), void 0), jsx$1(SimpleDropdown, { testId: "subscription-frecuency", initialValue: dropdownOptions[0], options: dropdownOptions, onChange: function (value) { return handleChange(value.value, 'dropdown'); }, placeHolder: "" }, void 0)] }, void 0), jsx$1(SubscriptionDetailsContainer, { children: jsx$1(Tooltip, __assign$1({ position: 0, content: tooltipContent, header: tooltipHeader, maxWidth: "300px", showCloseIcon: closeIcon }, { children: jsxs$1(FlexContainer$1, { children: [jsx$1(SubscriptionDetails, __assign$1({ variant: "body", weight: "demi" }, { children: "Subscription Details" }), void 0), jsx$1(Icon.Actions.CircleQuestion, { width: 1.2 }, void 0)] }, void 0) }), void 0) }, void 0)] }, void 0))] }), void 0)] }), void 0));
5801
5801
  };
5802
5802
 
5803
- var FlexContainer = newStyled.div(templateObject_1$1C || (templateObject_1$1C = __makeTemplateObject(["\n display: flex;\n"], ["\n display: flex;\n"])));
5803
+ var FlexContainer = newStyled.div(templateObject_1$1C || (templateObject_1$1C = __makeTemplateObject(["\n display: flex;\n\n ", "\n"], ["\n display: flex;\n\n ", "\n"])), function (_a) {
5804
+ var theme = _a.theme;
5805
+ return theme.name === 'TheSpaDr' &&
5806
+ "\n [data-testid='subscription-frequency'] {\n border: 0;\n padding-left: 0 !important;\n padding-right: 32px !important;\n }\n\n [role='listbox']{\n margin-left: -20px;\n }\n ";
5807
+ });
5804
5808
  var DiscountTag = newStyled.div(templateObject_2$13 || (templateObject_2$13 = __makeTemplateObject(["\n position: absolute;\n top: -25px;\n right: 5px;\n background-color: ", ";\n color: white;\n padding: 5px 10px;\n font-size: 12px;\n line-height: 14px;\n border-radius: ", ";\n font-weight: 600;\n"], ["\n position: absolute;\n top: -25px;\n right: 5px;\n background-color: ", ";\n color: white;\n padding: 5px 10px;\n font-size: 12px;\n line-height: 14px;\n border-radius: ", ";\n font-weight: 600;\n"])), function (_a) {
5805
5809
  var theme = _a.theme;
5806
5810
  return theme.component.autoship.discountTag.backgroundColor;
@@ -5808,11 +5812,16 @@ var DiscountTag = newStyled.div(templateObject_2$13 || (templateObject_2$13 = __
5808
5812
  var theme = _a.theme;
5809
5813
  return theme.component.autoship.discountTag.borderRadius;
5810
5814
  });
5815
+ var getSelectedBorder = function (_a) {
5816
+ var name = _a.name, colors = _a.colors;
5817
+ if (name === 'TheSpaDr') {
5818
+ return "2px solid ".concat(colors.pallete.primary.color);
5819
+ }
5820
+ return "1.5px solid ".concat(colors.shades['700'].color);
5821
+ };
5811
5822
  var ContainerBase = newStyled.div(templateObject_3$S || (templateObject_3$S = __makeTemplateObject(["\n border-radius: 8px;\n\n border: ", ";\n\n ", "\n\n & input:checked + div {\n border-color: ", ";\n }\n\n & label {\n cursor: pointer;\n }\n"], ["\n border-radius: 8px;\n\n border: ", ";\n\n ", "\n\n & input:checked + div {\n border-color: ", ";\n }\n\n & label {\n cursor: pointer;\n }\n"])), function (_a) {
5812
5823
  var selected = _a.selected, theme = _a.theme;
5813
- return selected
5814
- ? "1.5px solid ".concat(theme.colors.shades['700'].color)
5815
- : "1px solid ".concat(theme.colors.shades[200].color);
5824
+ return selected ? getSelectedBorder(theme) : "1px solid ".concat(theme.colors.shades[200].color);
5816
5825
  }, function (_a) {
5817
5826
  var selected = _a.selected;
5818
5827
  return selected
@@ -5856,7 +5865,7 @@ var radioIds = {
5856
5865
  var DEFAULT_DROPDOWN_OPTIONS = { key: '1', label: '1 Month', value: 1, disabled: false };
5857
5866
  var DEFAULT_FREQUENCY_UNIT = 'months';
5858
5867
  var AutoshipV2 = function (_a) {
5859
- var tooltipContent = _a.tooltipContent, tooltipHeader = _a.tooltipHeader, pricing = _a.pricing, frequencyValues = _a.frequencyValues, _b = _a.frequencyUnit, frequencyUnit = _b === void 0 ? DEFAULT_FREQUENCY_UNIT : _b, autoshipBenefits = _a.autoshipBenefits, onChange = _a.onChange, singlePurchaseLabel = _a.singlePurchaseLabel, subscriptionLabel = _a.subscriptionLabel, className = _a.className, closeIcon = _a.closeIcon, _c = _a.currencySymbol, currencySymbol = _c === void 0 ? '$' : _c, discountLabel = _a.discountLabel;
5868
+ var tooltipContent = _a.tooltipContent, tooltipHeader = _a.tooltipHeader, pricing = _a.pricing, frequencyValues = _a.frequencyValues, _b = _a.frequencyUnit, frequencyUnit = _b === void 0 ? DEFAULT_FREQUENCY_UNIT : _b, autoshipBenefits = _a.autoshipBenefits, benefits = _a.benefits, onChange = _a.onChange, singlePurchaseLabel = _a.singlePurchaseLabel, subscriptionLabel = _a.subscriptionLabel, className = _a.className, closeIcon = _a.closeIcon, _c = _a.currencySymbol, currencySymbol = _c === void 0 ? '$' : _c, discountLabel = _a.discountLabel;
5860
5869
  var theme = useTheme();
5861
5870
  var dropdownOptions = frequencyValues && (frequencyValues === null || frequencyValues === void 0 ? void 0 : frequencyValues.length) > 0
5862
5871
  ? frequencyValues.map(function (value) {
@@ -5872,7 +5881,7 @@ var AutoshipV2 = function (_a) {
5872
5881
  var autoShipSaving = Math.floor(listPrice - autoshipFinalPrice);
5873
5882
  var autoShipPctOverListPrice = (autoShipSaving / listPrice) * 100;
5874
5883
  var autoShipPctOverListPriceRounded = Math.round(autoShipPctOverListPrice / 5) * 5;
5875
- var updatedAutoshipBenefits = __spreadArray([
5884
+ var updatedAutoshipBenefits = benefits !== null && benefits !== void 0 ? benefits : __spreadArray([
5876
5885
  "Save up to ".concat(autoShipPctOverListPriceRounded, "% always")
5877
5886
  ], autoshipBenefits.slice(0), true);
5878
5887
  var createDataObject = function () {
@@ -5898,17 +5907,9 @@ var AutoshipV2 = function (_a) {
5898
5907
  onChange(__assign$1(__assign$1({}, dataObj), { subscriptionPeriod: value }));
5899
5908
  };
5900
5909
  var benefitsColor = benefitsColorMapper(theme);
5901
- function DeliveryFrequencySelector() {
5902
- if (dropdownOptions.length > 1) {
5903
- return (jsxs$1(Fragment$2, { children: [jsx$1(DeliveryFrequencyLabel, __assign$1({ variant: "body" }, { children: "Deliver every:" }), void 0), jsx$1(SimpleDropdown, { testId: "subscription-frequency", initialValue: dropdownOptions[0], options: dropdownOptions, onChange: function (value) { return handleChange(value.value, 'dropdown'); }, placeHolder: "" }, void 0)] }, void 0));
5904
- }
5905
- else {
5906
- return (jsxs$1(DeliveryFrequencyLabel, __assign$1({ variant: "body" }, { children: ["Deliver every ", dropdownOptions[0].label.toLowerCase()] }), void 0));
5907
- }
5908
- }
5909
5910
  return (jsxs$1(Container$11, __assign$1({ className: className }, { children: [jsxs$1(SubscriptionContainer, __assign$1({ "data-testid": "subscription-purchase-block", selected: radioIds.autoship.id === radioCheck.id }, { children: [jsx$1(DiscountTag, { children: discountLabel !== null && discountLabel !== void 0 ? discountLabel : "".concat(autoShipPctOverListPriceRounded, "% OFF - SAVE ").concat(currencySymbol).concat(autoShipSaving.toFixed(2)) }, void 0), jsxs$1(SubscriptionHeader, __assign$1({ onClick: function () { return handleChange(radioIds.autoship, 'radio'); } }, { children: [jsxs$1(FlexContainer, { children: [jsx$1(RadioInput, { label: subscriptionLabel, name: radioIds.autoship.id, id: radioIds.autoship.id, value: radioIds.autoship.id, checked: radioIds.autoship.id === radioCheck.id, size: ComponentSize.Medium, onChange: function () { return handleChange(radioIds.autoship, 'radio'); }, style: { marginRight: '10px' }, useV2Style: true }, void 0), jsx$1("div", __assign$1({ style: { marginTop: '5px', marginLeft: '5px' } }, { children: jsx$1(Tooltip, __assign$1({ position: 0, content: tooltipContent, header: tooltipHeader, maxWidth: "300px", showCloseIcon: closeIcon }, { children: jsx$1(Icon.Actions.CircleQuestion, { width: 1 }, void 0) }), void 0) }), void 0)] }, void 0), jsx$1(StyledPrice, { testId: "subscription", finalPrice: "$".concat(decimalFormat(Number(autoshipFinalPrice))), selected: radioIds.autoship.id === radioCheck.id, size: ComponentSize.Large, originalPrice: "$".concat(decimalFormat(Number(listPrice))) }, void 0)] }), void 0), jsx$1(BenefitsContainer, { children: updatedAutoshipBenefits.map(function (benefit) { return (jsxs$1(Benefit, { children: [jsx$1(Icon.Actions.Check, { width: 1.2, height: 1.2, fill: radioIds.autoship.id === radioCheck.id
5910
5911
  ? benefitsColor.selected
5911
- : benefitsColor.base }, void 0), jsx$1(BenefitText, __assign$1({ variant: "body" }, { children: benefit }), void 0)] }, benefit)); }) }, void 0), radioIds.autoship.id === radioCheck.id && (jsx$1(Fragment$2, { children: jsx$1(FlexContainer, { children: jsx$1(DeliveryFrequencySelector, {}, void 0) }, void 0) }, void 0))] }), void 0), jsxs$1(SinglePurchaseContainer, __assign$1({ "data-testid": "single-purchase-block", selected: radioIds.oneTime.id === radioCheck.id, onClick: function () { return handleChange(radioIds.oneTime, 'radio'); } }, { children: [jsx$1(RadioInput, { label: singlePurchaseLabel, name: radioIds.oneTime.id, id: radioIds.oneTime.id, value: radioIds.oneTime.id, checked: radioIds.oneTime.id === radioCheck.id, size: ComponentSize.Medium, onChange: function () { return handleChange(radioIds.oneTime, 'radio'); }, useV2Style: true }, void 0), jsx$1(StyledPrice, { testId: "single-purchase", finalPrice: "$".concat(decimalFormat(Number(discountedPrice))), selected: radioIds.oneTime.id === radioCheck.id, size: ComponentSize.Large, originalPrice: "$".concat(decimalFormat(Number(listPrice))) }, void 0)] }), void 0)] }), void 0));
5912
+ : benefitsColor.base }, void 0), jsx$1(BenefitText, __assign$1({ variant: "body" }, { children: benefit }), void 0)] }, benefit)); }) }, void 0), radioIds.autoship.id === radioCheck.id && (jsx$1(FlexContainer, { children: dropdownOptions.length > 1 ? (jsxs$1(Fragment$2, { children: [jsx$1(DeliveryFrequencyLabel, __assign$1({ variant: "body" }, { children: "Deliver every:" }), void 0), jsx$1(SimpleDropdown, { testId: "subscription-frequency", initialValue: dropdownOptions[0], options: dropdownOptions, onChange: function (value) { return handleChange(value.value, 'dropdown'); }, placeHolder: "" }, void 0)] }, void 0)) : (jsxs$1(DeliveryFrequencyLabel, __assign$1({ variant: "body" }, { children: ["Deliver every ", dropdownOptions[0].label.toLowerCase()] }), void 0)) }, void 0))] }), void 0), jsxs$1(SinglePurchaseContainer, __assign$1({ "data-testid": "single-purchase-block", selected: radioIds.oneTime.id === radioCheck.id, onClick: function () { return handleChange(radioIds.oneTime, 'radio'); } }, { children: [jsx$1(RadioInput, { label: singlePurchaseLabel, name: radioIds.oneTime.id, id: radioIds.oneTime.id, value: radioIds.oneTime.id, checked: radioIds.oneTime.id === radioCheck.id, size: ComponentSize.Medium, onChange: function () { return handleChange(radioIds.oneTime, 'radio'); }, useV2Style: true }, void 0), jsx$1(StyledPrice, { testId: "single-purchase", finalPrice: "$".concat(decimalFormat(Number(discountedPrice))), selected: radioIds.oneTime.id === radioCheck.id, size: ComponentSize.Large, originalPrice: "$".concat(decimalFormat(Number(listPrice))) }, void 0)] }), void 0)] }), void 0));
5912
5913
  };
5913
5914
 
5914
5915
  var _a$2;
@@ -19820,7 +19821,7 @@ var NavButtonContainer = newStyled.div(templateObject_5 || (templateObject_5 = _
19820
19821
  return theme.colors.shades.white.color;
19821
19822
  });
19822
19823
  var Button = newStyled.button(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n background: transparent;\n border: none;\n padding: 3px 8px;\n z-index: 5;\n height: 36px !important;\n cursor: pointer;\n"], ["\n background: transparent;\n border: none;\n padding: 3px 8px;\n z-index: 5;\n height: 36px !important;\n cursor: pointer;\n"])));
19823
- var SliderThumbnail = newStyled(Slider)(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n margin-top: 16px;\n padding-left: 16px;\n & .slick-slide {\n img {\n border-radius: 8px;\n overflow: hidden;\n }\n }\n & .slick-current {\n img {\n border: 2px solid ", ";\n }\n }\n"], ["\n margin-top: 16px;\n padding-left: 16px;\n & .slick-slide {\n img {\n border-radius: 8px;\n overflow: hidden;\n }\n }\n & .slick-current {\n img {\n border: 2px solid ", ";\n }\n }\n"])), function (_a) {
19824
+ var SliderThumbnail = newStyled(Slider)(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n margin-top: 16px;\n padding-left: 16px;\n & .slick-slide {\n img {\n overflow: hidden;\n }\n }\n & .slick-current {\n img {\n border: 2px solid ", ";\n }\n }\n"], ["\n margin-top: 16px;\n padding-left: 16px;\n & .slick-slide {\n img {\n overflow: hidden;\n }\n }\n & .slick-current {\n img {\n border: 2px solid ", ";\n }\n }\n"])), function (_a) {
19824
19825
  var theme = _a.theme;
19825
19826
  return theme.colors.pallete.primary.color;
19826
19827
  });
@@ -19844,25 +19845,11 @@ var SETTINGS = {
19844
19845
  dots: false,
19845
19846
  };
19846
19847
  var THUMBNAIL_SETTINGS = {
19847
- slidesToShow: 3.5,
19848
+ variableWidth: true,
19848
19849
  swipeToSlide: true,
19849
19850
  focusOnSelect: true,
19850
19851
  infinite: false,
19851
19852
  centerPadding: '16px',
19852
- responsive: [
19853
- {
19854
- breakpoint: 1024,
19855
- settings: {
19856
- slidesToShow: 5,
19857
- },
19858
- },
19859
- {
19860
- breakpoint: 640,
19861
- settings: {
19862
- slidesToShow: 4.5,
19863
- },
19864
- },
19865
- ],
19866
19853
  };
19867
19854
  var ProductGalleryMobileV4 = function (_a) {
19868
19855
  var images = _a.images, topTag = _a.topTag, bottomTag = _a.bottomTag, productImageDataTestId = _a.productImageDataTestId;