@trafilea/afrodita-components 5.0.0-beta.179 → 5.0.0-beta.180
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 +5 -2
- package/build/index.esm.js +41 -10
- package/build/index.esm.js.map +1 -1
- package/build/index.js +41 -10
- package/build/index.js.map +1 -1
- package/package.json +1 -1
package/build/index.d.ts
CHANGED
|
@@ -105,12 +105,14 @@ declare type Filter = {
|
|
|
105
105
|
link?: string;
|
|
106
106
|
color?: string;
|
|
107
107
|
isMultiselect: boolean;
|
|
108
|
+
type?: string;
|
|
108
109
|
items: Array<{
|
|
109
110
|
label: string;
|
|
110
111
|
checked?: boolean;
|
|
111
112
|
isLinkItem?: boolean;
|
|
112
113
|
link?: string;
|
|
113
114
|
blockUncheck?: boolean;
|
|
115
|
+
value?: string;
|
|
114
116
|
}>;
|
|
115
117
|
showInMobile: boolean;
|
|
116
118
|
};
|
|
@@ -1011,6 +1013,7 @@ interface BaseButtonProps {
|
|
|
1011
1013
|
inline?: boolean;
|
|
1012
1014
|
uppercase?: boolean;
|
|
1013
1015
|
testId?: string;
|
|
1016
|
+
id?: string;
|
|
1014
1017
|
}
|
|
1015
1018
|
|
|
1016
1019
|
declare type BaseProps = Pick<BaseButtonProps, 'disabled' | 'type' | 'onClick'>;
|
|
@@ -1776,9 +1779,9 @@ interface CheckboxProps {
|
|
|
1776
1779
|
blockUncheck?: boolean;
|
|
1777
1780
|
id: string;
|
|
1778
1781
|
backgroundColor?: string;
|
|
1779
|
-
variant: 'primary' | 'secondary';
|
|
1782
|
+
variant: 'primary' | 'secondary' | 'color';
|
|
1780
1783
|
}
|
|
1781
|
-
declare const Checkbox: ({ disabled, onChange, size, text, checked, id, variant, blockUncheck, }: CheckboxProps) => JSX.Element;
|
|
1784
|
+
declare const Checkbox: ({ disabled, onChange, size, text, checked, id, variant, blockUncheck, backgroundColor, }: CheckboxProps) => JSX.Element;
|
|
1782
1785
|
|
|
1783
1786
|
interface RadioGroupInputProps {
|
|
1784
1787
|
name: string;
|
package/build/index.esm.js
CHANGED
|
@@ -4232,7 +4232,7 @@ function jsxs(type, props, key) {
|
|
|
4232
4232
|
}
|
|
4233
4233
|
|
|
4234
4234
|
var BaseButton = function (_a) {
|
|
4235
|
-
var children = _a.children, renderLeading = _a.renderLeading, renderTrailing = _a.renderTrailing, disabled = _a.disabled, _b = _a.type, type = _b === void 0 ? 'button' : _b, onClick = _a.onClick, className = _a.className, inline = _a.inline, _c = _a.uppercase, uppercase = _c === void 0 ? true : _c, _d = _a.testId, testId = _d === void 0 ? 'base-button' : _d;
|
|
4235
|
+
var children = _a.children, renderLeading = _a.renderLeading, renderTrailing = _a.renderTrailing, disabled = _a.disabled, _b = _a.type, type = _b === void 0 ? 'button' : _b, onClick = _a.onClick, className = _a.className, inline = _a.inline, _c = _a.uppercase, uppercase = _c === void 0 ? true : _c, _d = _a.testId, testId = _d === void 0 ? 'base-button' : _d, id = _a.id;
|
|
4236
4236
|
return (jsxs("button", __assign$1({ onClick: onClick, disabled: disabled, className: className, type: type, "data-testid": testId, css: {
|
|
4237
4237
|
display: inline ? 'inline-flex' : 'flex',
|
|
4238
4238
|
justifyContent: 'center',
|
|
@@ -4242,7 +4242,7 @@ var BaseButton = function (_a) {
|
|
|
4242
4242
|
textTransform: uppercase ? 'uppercase' : 'unset',
|
|
4243
4243
|
boxSizing: 'border-box',
|
|
4244
4244
|
cursor: 'pointer',
|
|
4245
|
-
} }, { children: [renderLeading, children, renderTrailing] }), void 0));
|
|
4245
|
+
}, id: id }, { children: [renderLeading, children, renderTrailing] }), void 0));
|
|
4246
4246
|
};
|
|
4247
4247
|
|
|
4248
4248
|
var getStylesBySize$a = function (size, theme) {
|
|
@@ -4582,19 +4582,31 @@ var CustomCheckboxStyles = {
|
|
|
4582
4582
|
: theme.component.checkbox.borderColor,
|
|
4583
4583
|
});
|
|
4584
4584
|
},
|
|
4585
|
+
color: function () {
|
|
4586
|
+
return css({
|
|
4587
|
+
borderRadius: '50%',
|
|
4588
|
+
border: 'none',
|
|
4589
|
+
});
|
|
4590
|
+
},
|
|
4585
4591
|
};
|
|
4586
4592
|
|
|
4587
4593
|
var Container$U = newStyled.div(templateObject_1$1m || (templateObject_1$1m = __makeTemplateObject(["\n display: flex;\n align-items: center;\n justify-content: center;\n width: fit-content;\n user-select: none;\n position: relative;\n"], ["\n display: flex;\n align-items: center;\n justify-content: center;\n width: fit-content;\n user-select: none;\n position: relative;\n"])));
|
|
4588
4594
|
var CustomCheckbox = newStyled.div(CustomCheckboxStyles.baseStyles, function (props) { return [
|
|
4589
4595
|
CustomCheckboxStyles[props.size](props.theme),
|
|
4590
4596
|
CustomCheckboxStyles[props.variant](props.theme, props.isChecked, props.disabled),
|
|
4597
|
+
"\n ".concat(props.backgroundColor ? "background-color: ".concat(props.backgroundColor, ";") : '', "\n ").concat(props.text === 'White' ||
|
|
4598
|
+
props.text === 'Nude' ||
|
|
4599
|
+
props.text === 'Latte' ||
|
|
4600
|
+
props.text === 'Sand'
|
|
4601
|
+
? "\n svg {\n path {\n fill: var(--colors-shades-black-color);\n }\n }"
|
|
4602
|
+
: '', "\n ").concat(props.text === 'White' ? "border: 0.27px var(--colors-shades-300-color) solid;" : ''),
|
|
4591
4603
|
]; });
|
|
4592
4604
|
var Input$3 = newStyled.input(templateObject_2$U || (templateObject_2$U = __makeTemplateObject(["\n position: absolute;\n height: 100%;\n width: 100%;\n margin: 0;\n opacity: 0;\n cursor: ", ";\n"], ["\n position: absolute;\n height: 100%;\n width: 100%;\n margin: 0;\n opacity: 0;\n cursor: ", ";\n"])), function (_a) {
|
|
4593
4605
|
var disabled = _a.disabled;
|
|
4594
4606
|
return (disabled ? 'not-allowed' : 'pointer');
|
|
4595
4607
|
});
|
|
4596
4608
|
var Checkbox = function (_a) {
|
|
4597
|
-
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;
|
|
4609
|
+
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, backgroundColor = _a.backgroundColor;
|
|
4598
4610
|
var theme = useTheme();
|
|
4599
4611
|
var _e = useState(checked), isChecked = _e[0], setIsChecked = _e[1];
|
|
4600
4612
|
var mounted = useRef(false);
|
|
@@ -4618,7 +4630,7 @@ var Checkbox = function (_a) {
|
|
|
4618
4630
|
useEffect(function () {
|
|
4619
4631
|
mounted.current = true;
|
|
4620
4632
|
}, []);
|
|
4621
|
-
return (jsxs$1(Container$U, { children: [jsx$1(Input$3, { type: "checkbox", checked: isChecked, disabled: disabled, onChange: handleChange, id: id }, void 0), jsx$1(CustomCheckbox, __assign$1({ theme: theme, size: size, disabled: disabled, isChecked: isChecked, "data-testid": "checkbox", variant: variant }, { children: isChecked && jsx$1(Icon.Actions.Check, { fill: "#fff" }, void 0) }), void 0), jsx$1(Label$3, __assign$1({ "data-testid": "checkbox-text", size: size, variant: isChecked ? 'demi' : 'regular', htmlFor: id, disabled: disabled }, { children: text }), void 0)] }, void 0));
|
|
4633
|
+
return (jsxs$1(Container$U, { children: [jsx$1(Input$3, { type: "checkbox", checked: isChecked, disabled: disabled, onChange: handleChange, id: id }, void 0), jsx$1(CustomCheckbox, __assign$1({ theme: theme, size: size, disabled: disabled, isChecked: isChecked, "data-testid": "checkbox", variant: variant, backgroundColor: backgroundColor, text: text }, { children: isChecked && jsx$1(Icon.Actions.Check, { fill: "#fff" }, void 0) }), void 0), jsx$1(Label$3, __assign$1({ "data-testid": "checkbox-text", size: size, variant: isChecked ? 'demi' : 'regular', htmlFor: id, disabled: disabled }, { children: text }), void 0)] }, void 0));
|
|
4622
4634
|
};
|
|
4623
4635
|
var templateObject_1$1m, templateObject_2$U;
|
|
4624
4636
|
|
|
@@ -4727,7 +4739,7 @@ var getStylesBySize$9 = function (size, theme) {
|
|
|
4727
4739
|
}
|
|
4728
4740
|
};
|
|
4729
4741
|
var SimpleSelector = function (_a) {
|
|
4730
|
-
var text = _a.text, className = _a.className, _b = _a.disabled, disabled = _b === void 0 ? false : _b, _c = _a.size, size = _c === void 0 ? ComponentSize.Medium : _c, _d = _a.active, active = _d === void 0 ? false : _d, _e = _a.testId, testId = _e === void 0 ? 'base-button' : _e, _f = _a.width, width = _f === void 0 ? '' : _f, onClick = _a.onClick;
|
|
4742
|
+
var text = _a.text, className = _a.className, _b = _a.disabled, disabled = _b === void 0 ? false : _b, _c = _a.size, size = _c === void 0 ? ComponentSize.Medium : _c, _d = _a.active, active = _d === void 0 ? false : _d, _e = _a.testId, testId = _e === void 0 ? 'base-button' : _e, _f = _a.width, width = _f === void 0 ? '' : _f, onClick = _a.onClick, id = _a.id;
|
|
4731
4743
|
var theme = useTheme();
|
|
4732
4744
|
var stylesBySize = getStylesBySize$9(size, theme);
|
|
4733
4745
|
var activeStyles = active
|
|
@@ -4738,11 +4750,11 @@ var SimpleSelector = function (_a) {
|
|
|
4738
4750
|
}, '&:disabled': {
|
|
4739
4751
|
color: theme.colors.shades['250'].color,
|
|
4740
4752
|
cursor: 'not-allowed',
|
|
4741
|
-
} }) }, { children: text }), void 0));
|
|
4753
|
+
} }), id: id }, { children: text }), void 0));
|
|
4742
4754
|
};
|
|
4743
4755
|
|
|
4744
4756
|
var SelectorSecondary = function (_a) {
|
|
4745
|
-
var text = _a.text, size = _a.size, disabled = _a.disabled, active = _a.active, className = _a.className, testId = _a.testId, width = _a.width, onClick = _a.onClick, showNoStockStyles = _a.showNoStockStyles;
|
|
4757
|
+
var text = _a.text, size = _a.size, disabled = _a.disabled, active = _a.active, className = _a.className, testId = _a.testId, width = _a.width, onClick = _a.onClick, showNoStockStyles = _a.showNoStockStyles, id = _a.id;
|
|
4746
4758
|
var theme = useTheme();
|
|
4747
4759
|
var stylesByActive = active
|
|
4748
4760
|
? {
|
|
@@ -4772,7 +4784,7 @@ var SelectorSecondary = function (_a) {
|
|
|
4772
4784
|
border: theme.component.selector.disabled.border,
|
|
4773
4785
|
background: theme.colors.background.disabled,
|
|
4774
4786
|
color: theme.colors.text.disabled,
|
|
4775
|
-
} }) }, void 0));
|
|
4787
|
+
} }), id: id }, void 0));
|
|
4776
4788
|
};
|
|
4777
4789
|
|
|
4778
4790
|
// This defines which HTML tag to render for each `variant`, it also defines
|
|
@@ -17408,7 +17420,7 @@ var Accordion = function (_a) {
|
|
|
17408
17420
|
};
|
|
17409
17421
|
var templateObject_1$i, templateObject_2$d, templateObject_3$d, templateObject_4$7;
|
|
17410
17422
|
|
|
17411
|
-
var SectionContent = newStyled.div(templateObject_1$h || (templateObject_1$h = __makeTemplateObject(["\n display: grid;\n grid-template-columns: repeat(", ", 1fr);\n grid-gap:
|
|
17423
|
+
var SectionContent = newStyled.div(templateObject_1$h || (templateObject_1$h = __makeTemplateObject(["\n display: grid;\n grid-template-columns: repeat(", ", 1fr);\n grid-gap: 10px;\n margin: 1.25rem 0;\n"], ["\n display: grid;\n grid-template-columns: repeat(", ", 1fr);\n grid-gap: 10px;\n margin: 1.25rem 0;\n"])), function (props) { return props.cols; });
|
|
17412
17424
|
var Header = newStyled.div(templateObject_2$c || (templateObject_2$c = __makeTemplateObject(["\n display: flex;\n align-items: center;\n justify-content: space-between;\n margin-bottom: 1.063rem;\n"], ["\n display: flex;\n align-items: center;\n justify-content: space-between;\n margin-bottom: 1.063rem;\n"])));
|
|
17413
17425
|
var MobileHeader = newStyled.div(templateObject_3$c || (templateObject_3$c = __makeTemplateObject(["\n display: flex;\n align-items: center;\n justify-content: space-between;\n margin-bottom: 2.25rem;\n margin-top: 1.063rem;\n"], ["\n display: flex;\n align-items: center;\n justify-content: space-between;\n margin-bottom: 2.25rem;\n margin-top: 1.063rem;\n"])));
|
|
17414
17426
|
var MobileIconsContainer = newStyled.div(templateObject_4$6 || (templateObject_4$6 = __makeTemplateObject(["\n width: 1.5rem;\n height: 1.5rem;\n cursor: pointer;\n"], ["\n width: 1.5rem;\n height: 1.5rem;\n cursor: pointer;\n"])));
|
|
@@ -17506,7 +17518,19 @@ var Filters = function (_a) {
|
|
|
17506
17518
|
.filter(function (filter) { return filter.isLinkOption; })
|
|
17507
17519
|
.map(function (option, index) { return (jsx$1(OptionContainer, __assign$1({ showInMobile: option.showInMobile, "data-testid": "linkOption" }, { children: jsx$1(FilterLink, __assign$1({ color: option.color || theme.colors.shades['550'].color, href: option.link }, { children: option.title }), void 0) }), index)); }), filters
|
|
17508
17520
|
.filter(function (filter) { return !filter.isLinkOption; })
|
|
17509
|
-
.map(function (filter) { return (jsx$1(Accordion, __assign$1({ title: filter.title, isOpenByDefault: filter.isOpenByDefault, showInMobile: filter.showInMobile }, { children:
|
|
17521
|
+
.map(function (filter) { return (jsx$1(Accordion, __assign$1({ title: filter.title, isOpenByDefault: filter.isOpenByDefault, showInMobile: filter.showInMobile }, { children: jsxs$1(SectionContent, __assign$1({ cols: filter.columns }, { children: [filter.type === 'size' &&
|
|
17522
|
+
filter.items.map(function (item, itemIndex) {
|
|
17523
|
+
var calculatedSectionIndex = filters.findIndex(function (filt) { return filt.title === filter.title; });
|
|
17524
|
+
return (jsx$1(SelectorSecondary, { size: ComponentSize.Medium, text: item.label, active: item.checked, disabled: item.blockUncheck, onClick: function () {
|
|
17525
|
+
return handleCheckboxClick({
|
|
17526
|
+
sectionIndex: calculatedSectionIndex,
|
|
17527
|
+
itemIndex: itemIndex,
|
|
17528
|
+
checked: !item.checked,
|
|
17529
|
+
});
|
|
17530
|
+
}, width: "50px", id: "filter[".concat(calculatedSectionIndex, ",").concat(itemIndex, "]") }, item.label));
|
|
17531
|
+
}), filter.type === 'color' &&
|
|
17532
|
+
filter.items.map(function (item, itemIndex) { return (jsx$1(FilterCheckboxColor, { onChange: handleCheckboxClick, text: item.label, checked: item.checked, itemIndex: itemIndex, sectionIndex: filters.findIndex(function (filt) { return filt.title === filter.title; }), blockUncheck: item.blockUncheck, color: item.value || '' }, "".concat(item.checked, "-").concat(item.label))); }), !filter.type &&
|
|
17533
|
+
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));
|
|
17510
17534
|
};
|
|
17511
17535
|
var FilterCheckbox = function (_a) {
|
|
17512
17536
|
var sectionIndex = _a.sectionIndex, text = _a.text, itemIndex = _a.itemIndex, onChangeProp = _a.onChange, checked = _a.checked, blockUncheck = _a.blockUncheck;
|
|
@@ -17514,6 +17538,13 @@ var FilterCheckbox = function (_a) {
|
|
|
17514
17538
|
onChangeProp({ sectionIndex: sectionIndex, itemIndex: itemIndex, checked: checked });
|
|
17515
17539
|
}, [onChangeProp, sectionIndex, itemIndex]);
|
|
17516
17540
|
return (jsx$1(Checkbox, { onChange: onChange, checked: checked, text: text, id: "filter[".concat(sectionIndex, ",").concat(itemIndex, "]"), size: ComponentSize.Small, variant: "secondary", blockUncheck: blockUncheck }, itemIndex));
|
|
17541
|
+
};
|
|
17542
|
+
var FilterCheckboxColor = function (_a) {
|
|
17543
|
+
var sectionIndex = _a.sectionIndex, text = _a.text, itemIndex = _a.itemIndex, onChangeProp = _a.onChange, checked = _a.checked, blockUncheck = _a.blockUncheck, color = _a.color;
|
|
17544
|
+
var onChange = useCallback(function (checked) {
|
|
17545
|
+
onChangeProp({ sectionIndex: sectionIndex, itemIndex: itemIndex, checked: checked });
|
|
17546
|
+
}, [onChangeProp, sectionIndex, itemIndex]);
|
|
17547
|
+
return (jsx$1(Checkbox, { onChange: onChange, checked: checked, text: text, id: "filter[".concat(sectionIndex, ",").concat(itemIndex, "]"), size: ComponentSize.Medium, variant: "color", blockUncheck: blockUncheck, backgroundColor: color }, itemIndex));
|
|
17517
17548
|
};
|
|
17518
17549
|
|
|
17519
17550
|
var Container$d = newStyled.div(templateObject_1$g || (templateObject_1$g = __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"])));
|