@trafilea/afrodita-components 5.0.0-beta.96 → 5.0.0-beta.98

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
@@ -107,7 +107,7 @@ declare type Filter = {
107
107
  checked?: boolean;
108
108
  isLinkItem?: boolean;
109
109
  link?: string;
110
- uncheckedLink?: string;
110
+ blockUncheck?: boolean;
111
111
  }>;
112
112
  };
113
113
  declare type FilterChange = {
@@ -1548,11 +1548,12 @@ interface CheckboxProps {
1548
1548
  size?: ComponentSize.Large | ComponentSize.Medium | ComponentSize.Small;
1549
1549
  text: string;
1550
1550
  checked?: boolean;
1551
+ blockUncheck?: boolean;
1551
1552
  id: string;
1552
1553
  backgroundColor?: string;
1553
1554
  variant: 'primary' | 'secondary';
1554
1555
  }
1555
- declare const Checkbox: ({ disabled, onChange, size, text, checked, id, variant, }: CheckboxProps) => JSX.Element;
1556
+ declare const Checkbox: ({ disabled, onChange, size, text, checked, id, variant, blockUncheck, }: CheckboxProps) => JSX.Element;
1556
1557
 
1557
1558
  interface RadioGroupInputProps {
1558
1559
  name: string;
@@ -4568,16 +4568,16 @@ var Input$3 = newStyled.input(templateObject_2$O || (templateObject_2$O = __make
4568
4568
  return (disabled ? 'not-allowed' : 'pointer');
4569
4569
  });
4570
4570
  var Checkbox = function (_a) {
4571
- var _b = _a.disabled, disabled = _b === void 0 ? false : _b, onChange = _a.onChange, _c = _a.size, size = _c === void 0 ? ComponentSize.Medium : _c, text = _a.text, _d = _a.checked, checked = _d === void 0 ? false : _d, id = _a.id, variant = _a.variant;
4571
+ var _b = _a.disabled, disabled = _b === void 0 ? false : _b, onChange = _a.onChange, _c = _a.size, size = _c === void 0 ? ComponentSize.Medium : _c, text = _a.text, _d = _a.checked, checked = _d === void 0 ? false : _d, id = _a.id, variant = _a.variant, blockUncheck = _a.blockUncheck;
4572
4572
  var theme = useTheme();
4573
4573
  var _e = useState(checked), isChecked = _e[0], setIsChecked = _e[1];
4574
4574
  var mounted = useRef(false);
4575
4575
  var handleChange = useCallback(function () {
4576
- if (disabled) {
4576
+ if (disabled || (isChecked && blockUncheck)) {
4577
4577
  return;
4578
4578
  }
4579
4579
  setIsChecked(function (checked) { return !checked; });
4580
- }, [disabled]);
4580
+ }, [blockUncheck, disabled, isChecked]);
4581
4581
  useEffect(function () {
4582
4582
  if (disabled || !mounted.current) {
4583
4583
  return;
@@ -12574,8 +12574,8 @@ var getStylesBySize = function (size) {
12574
12574
  };
12575
12575
  }
12576
12576
  };
12577
- var TopTagContainer$1 = newStyled.div(templateObject_4$8 || (templateObject_4$8 = __makeTemplateObject(["\n position: absolute;\n left: 0;\n top: 0;\n width: inherit;\n"], ["\n position: absolute;\n left: 0;\n top: 0;\n width: inherit;\n"])));
12578
- var BottomTagContainer$1 = newStyled.div(templateObject_5$4 || (templateObject_5$4 = __makeTemplateObject(["\n position: absolute;\n bottom: 15%;\n left: 0;\n width: inherit;\n"], ["\n position: absolute;\n bottom: 15%;\n left: 0;\n width: inherit;\n"])));
12577
+ var TopTagContainer$1 = newStyled.div(templateObject_4$8 || (templateObject_4$8 = __makeTemplateObject(["\n position: absolute;\n left: 0;\n top: 0;\n width: inherit;\n z-index: 1;\n"], ["\n position: absolute;\n left: 0;\n top: 0;\n width: inherit;\n z-index: 1;\n"])));
12578
+ var BottomTagContainer$1 = newStyled.div(templateObject_5$4 || (templateObject_5$4 = __makeTemplateObject(["\n position: absolute;\n bottom: 15%;\n left: 0;\n width: inherit;\n z-index: 1;\n"], ["\n position: absolute;\n bottom: 15%;\n left: 0;\n width: inherit;\n z-index: 1;\n"])));
12579
12579
  var ProductItemMobile = function (_a) {
12580
12580
  var title = _a.title, image = _a.image, imageHover = _a.imageHover, price = _a.price, rating = _a.rating, size = _a.size, _b = _a.alignName, alignName = _b === void 0 ? 'center' : _b, url = _a.url, className = _a.className, topTag = _a.topTag, bottomTag = _a.bottomTag, onClick = _a.onClick, _c = _a.priceDisplayType, priceDisplayType = _c === void 0 ? 'default' : _c;
12581
12581
  var theme = useTheme();
@@ -17465,9 +17465,6 @@ var Filters = function (_a) {
17465
17465
  if (checked) {
17466
17466
  window.location.assign(currentFilterItem.link);
17467
17467
  }
17468
- else if (currentFilterItem === null || currentFilterItem === void 0 ? void 0 : currentFilterItem.uncheckedLink) {
17469
- window.location.assign(currentFilterItem.uncheckedLink);
17470
- }
17471
17468
  return;
17472
17469
  }
17473
17470
  setCheckedItems(function (prev) {
@@ -17516,14 +17513,14 @@ var Filters = function (_a) {
17516
17513
  .filter(function (filter) { return filter.isLinkOption; })
17517
17514
  .map(function (option, index) { return (jsx$1(OptionContainer, { children: jsx$1(FilterLink, __assign$1({ color: option.color || theme.colors.shades['550'].color, href: option.link }, { children: option.title }), void 0) }, index)); }), filters
17518
17515
  .filter(function (filter) { return !filter.isLinkOption; })
17519
- .map(function (filter) { return (jsx$1(Accordion, __assign$1({ title: filter.title, isOpenByDefault: filter.isOpenByDefault }, { children: jsx$1(SectionContent, __assign$1({ cols: filter.columns }, { children: filter.items.map(function (item, itemIndex) { return (jsx$1(FilterCheckbox, { onChange: handleCheckboxClick, text: item.label === '$75 And Above' ? '+$75' : item.label, checked: item.checked, itemIndex: itemIndex, sectionIndex: filters.findIndex(function (filt) { return filt.title === filter.title; }) }, "".concat(item.checked, "-").concat(item.label))); }) }), void 0) }), filters.findIndex(function (filt) { return filt.title === filter.title; }))); }), isMobile && (jsxs$1(MobileFooter, __assign$1({ "data-testid": "MobileFooter" }, { children: [jsxs$1(MobileClearContainer, __assign$1({ onClick: handleClearAllClick }, { children: [jsx$1(MobileIconsContainer, { children: jsx$1(Icon.Actions.Trash, { fill: theme.colors.shades['700'].color }, void 0) }, void 0), jsx$1(ClearAll, __assign$1({ color: theme.colors.shades['700'].color }, { children: clearAllText }), void 0)] }), void 0), jsx$1(ButtonSecondary, { text: applyText, onClick: mobileApplyButtonClick }, void 0)] }), void 0))] }, void 0));
17516
+ .map(function (filter) { return (jsx$1(Accordion, __assign$1({ title: filter.title, isOpenByDefault: filter.isOpenByDefault }, { children: jsx$1(SectionContent, __assign$1({ cols: filter.columns }, { children: filter.items.map(function (item, itemIndex) { return (jsx$1(FilterCheckbox, { onChange: handleCheckboxClick, text: item.label === '$75 And Above' ? '+$75' : item.label, checked: item.checked, itemIndex: itemIndex, sectionIndex: filters.findIndex(function (filt) { return filt.title === filter.title; }), blockUncheck: item.blockUncheck }, "".concat(item.checked, "-").concat(item.label))); }) }), void 0) }), filters.findIndex(function (filt) { return filt.title === filter.title; }))); }), isMobile && (jsxs$1(MobileFooter, __assign$1({ "data-testid": "MobileFooter" }, { children: [jsxs$1(MobileClearContainer, __assign$1({ onClick: handleClearAllClick }, { children: [jsx$1(MobileIconsContainer, { children: jsx$1(Icon.Actions.Trash, { fill: theme.colors.shades['700'].color }, void 0) }, void 0), jsx$1(ClearAll, __assign$1({ color: theme.colors.shades['700'].color }, { children: clearAllText }), void 0)] }), void 0), jsx$1(ButtonSecondary, { text: applyText, onClick: mobileApplyButtonClick }, void 0)] }), void 0))] }, void 0));
17520
17517
  };
17521
17518
  var FilterCheckbox = function (_a) {
17522
- var sectionIndex = _a.sectionIndex, text = _a.text, itemIndex = _a.itemIndex, onChangeProp = _a.onChange, checked = _a.checked;
17519
+ var sectionIndex = _a.sectionIndex, text = _a.text, itemIndex = _a.itemIndex, onChangeProp = _a.onChange, checked = _a.checked, blockUncheck = _a.blockUncheck;
17523
17520
  var onChange = useCallback(function (checked) {
17524
17521
  onChangeProp({ sectionIndex: sectionIndex, itemIndex: itemIndex, checked: checked });
17525
- }, [sectionIndex, itemIndex, onChangeProp]);
17526
- return (jsx$1(Checkbox, { onChange: onChange, checked: checked, text: text, id: "filter[".concat(sectionIndex, ",").concat(itemIndex, "]"), size: ComponentSize.Small, variant: "secondary" }, itemIndex));
17522
+ }, [onChangeProp, sectionIndex, itemIndex]);
17523
+ return (jsx$1(Checkbox, { onChange: onChange, checked: checked, text: text, id: "filter[".concat(sectionIndex, ",").concat(itemIndex, "]"), size: ComponentSize.Small, variant: "secondary", blockUncheck: blockUncheck }, itemIndex));
17527
17524
  };
17528
17525
 
17529
17526
  var Container$7 = newStyled.div(templateObject_1$8 || (templateObject_1$8 = __makeTemplateObject(["\n display: flex;\n flex-wrap: wrap;\n padding: 0 1rem 1rem;\n"], ["\n display: flex;\n flex-wrap: wrap;\n padding: 0 1rem 1rem;\n"])));