@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.d.ts +3 -1
- package/build/index.esm.js +17 -25
- package/build/index.esm.js.map +1 -1
- package/build/index.js +17 -25
- package/build/index.js.map +1 -1
- package/package.json +1 -1
package/build/index.d.ts
CHANGED
|
@@ -115,6 +115,7 @@ interface SearchBarOptionItem {
|
|
|
115
115
|
src: string;
|
|
116
116
|
price: string;
|
|
117
117
|
title: string;
|
|
118
|
+
optionUrl: string;
|
|
118
119
|
}
|
|
119
120
|
|
|
120
121
|
declare const SixtyDaysGuarantee: ({ height, width, fill, title }: IconProps) => JSX.Element;
|
|
@@ -1586,11 +1587,12 @@ interface SearchBarProps {
|
|
|
1586
1587
|
resultOptions: SearchBarOptionItem[];
|
|
1587
1588
|
onChange: (text: string) => void;
|
|
1588
1589
|
onSearch: (term: string) => void;
|
|
1590
|
+
onClose: () => void;
|
|
1589
1591
|
resultsPanelDataTestId?: string;
|
|
1590
1592
|
allResults?: number;
|
|
1591
1593
|
initialTerm?: string;
|
|
1592
1594
|
}
|
|
1593
|
-
declare const SearchBar: ({ suggestions, resultOptions, onChange, onSearch, resultsPanelDataTestId, allResults, initialTerm, }: SearchBarProps) => JSX.Element;
|
|
1595
|
+
declare const SearchBar: ({ suggestions, resultOptions, onChange, onSearch, onClose, resultsPanelDataTestId, allResults, initialTerm, }: SearchBarProps) => JSX.Element;
|
|
1594
1596
|
|
|
1595
1597
|
interface ProductGalleryMobileProps {
|
|
1596
1598
|
images: ImageType[];
|
package/build/index.esm.js
CHANGED
|
@@ -3607,9 +3607,9 @@ var BaseCTA = function (_a) {
|
|
|
3607
3607
|
};
|
|
3608
3608
|
|
|
3609
3609
|
var ButtonPrimary = function (_a) {
|
|
3610
|
-
_a.testId
|
|
3610
|
+
var _b = _a.testId, testId = _b === void 0 ? 'button-primary' : _b, props = __rest(_a, ["testId"]);
|
|
3611
3611
|
var theme = useTheme();
|
|
3612
|
-
return (jsx(BaseCTA, __assign$1({}, props, { css: {
|
|
3612
|
+
return (jsx(BaseCTA, __assign$1({}, props, { testId: testId, css: {
|
|
3613
3613
|
backgroundColor: theme.component.button.primary.active.backgroundColor,
|
|
3614
3614
|
color: theme.component.button.primary.active.color,
|
|
3615
3615
|
border: theme.component.button.border,
|
|
@@ -4537,11 +4537,11 @@ var ImageSmallPreview = function (_a) {
|
|
|
4537
4537
|
var templateObject_1$Y;
|
|
4538
4538
|
|
|
4539
4539
|
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"])));
|
|
4540
|
-
var Button$
|
|
4540
|
+
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"])));
|
|
4541
4541
|
var ImagePreviewList = function (_a) {
|
|
4542
4542
|
var images = _a.images, selectedImage = _a.selectedImage, onClick = _a.onClick, testId = _a.testId;
|
|
4543
4543
|
return (jsx$1(Container$B, __assign$1({ "data-testid": testId }, { children: images.map(function (item) {
|
|
4544
|
-
return (jsx$1(Button$
|
|
4544
|
+
return (jsx$1(Button$4, __assign$1({ onClick: function () { return onClick(item); } }, { children: jsx$1(ImageSmallPreview, { imageUrl: item.imageUrl, alt: item.alt, selected: item.key === selectedImage.key }, void 0) }), item.key));
|
|
4545
4545
|
}) }), void 0));
|
|
4546
4546
|
};
|
|
4547
4547
|
var templateObject_1$X, templateObject_2$B;
|
|
@@ -5461,7 +5461,7 @@ var BaseInput = function (_a) {
|
|
|
5461
5461
|
: '' }, { children: [label && (jsx$1(InputLabel, { label: label, isDisabled: rest.disabled, isRequired: Boolean(required) }, void 0)), jsxs$1(InputWrapper, __assign$1({ className: "inputWrapper", size: size }, { children: [jsx$1(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 === InputValidationType.Error && jsx$1(Error$1, { error: required }, void 0)] }), void 0));
|
|
5462
5462
|
};
|
|
5463
5463
|
|
|
5464
|
-
var Button$
|
|
5464
|
+
var Button$3 = function (_a) {
|
|
5465
5465
|
var variant = _a.variant, props = __rest(_a, ["variant"]);
|
|
5466
5466
|
if (variant === 'primary') {
|
|
5467
5467
|
return jsx$1(ButtonPrimary, __assign$1({}, props), void 0);
|
|
@@ -5492,7 +5492,7 @@ var Custom = function (_a) {
|
|
|
5492
5492
|
text: text,
|
|
5493
5493
|
disabled: rest.disabled,
|
|
5494
5494
|
}); }, [variant, onClick, text, rest.disabled]);
|
|
5495
|
-
return (jsx$1(Container$o, __assign$1({ theme: theme }, { children: jsx$1(BaseInput, __assign$1({}, rest, { children: jsx$1(ButtonContainer$1, __assign$1({ theme: theme }, { children: jsx$1(Button$
|
|
5495
|
+
return (jsx$1(Container$o, __assign$1({ theme: theme }, { children: jsx$1(BaseInput, __assign$1({}, rest, { children: jsx$1(ButtonContainer$1, __assign$1({ theme: theme }, { children: jsx$1(Button$3, __assign$1({}, props), void 0) }), void 0) }), void 0) }), void 0));
|
|
5496
5496
|
};
|
|
5497
5497
|
var templateObject_1$G, templateObject_2$r;
|
|
5498
5498
|
|
|
@@ -5849,7 +5849,7 @@ var Review = function (_a) {
|
|
|
5849
5849
|
};
|
|
5850
5850
|
var templateObject_1$s, templateObject_2$g, templateObject_3$d, templateObject_4$8, templateObject_5$6, templateObject_6$5, templateObject_7$2;
|
|
5851
5851
|
|
|
5852
|
-
var Button$
|
|
5852
|
+
var Button$2 = newStyled.button(function () { return ({
|
|
5853
5853
|
background: 'transparent',
|
|
5854
5854
|
border: 'none',
|
|
5855
5855
|
cursor: 'pointer',
|
|
@@ -5861,7 +5861,7 @@ var Direction;
|
|
|
5861
5861
|
})(Direction || (Direction = {}));
|
|
5862
5862
|
var ArrowButton$1 = function (_a) {
|
|
5863
5863
|
var direction = _a.direction, onClick = _a.onClick, width = _a.width, height = _a.height, className = _a.className;
|
|
5864
|
-
return (jsx$1(Button$
|
|
5864
|
+
return (jsx$1(Button$2, __assign$1({ className: className, type: "button", onClick: onClick, "data-testid": "arrow-button-".concat(direction) }, { children: direction === 'left' ? (jsx$1(Icon.Arrows.ChevronLeft, { width: width, height: height, opacity: 0.5 }, void 0)) : (jsx$1(Icon.Arrows.ChevronRight, { width: width, height: height, opacity: 0.5 }, void 0)) }), void 0));
|
|
5865
5865
|
};
|
|
5866
5866
|
|
|
5867
5867
|
function _defineProperty(obj, key, value) {
|
|
@@ -10462,12 +10462,13 @@ var Li = newStyled.li(templateObject_1$g || (templateObject_1$g = __makeTemplate
|
|
|
10462
10462
|
padding: [0, '0rem 1rem'],
|
|
10463
10463
|
borderRadius: [0, '0.5rem'],
|
|
10464
10464
|
}));
|
|
10465
|
-
var
|
|
10465
|
+
var Anchor = newStyled.a({
|
|
10466
10466
|
width: '100%',
|
|
10467
10467
|
border: 'none',
|
|
10468
10468
|
background: 'transparent',
|
|
10469
10469
|
cursor: 'pointer',
|
|
10470
10470
|
padding: 0,
|
|
10471
|
+
textDecoration: 'none',
|
|
10471
10472
|
});
|
|
10472
10473
|
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({
|
|
10473
10474
|
border: ['none', '0.063rem solid var(--colors-pallete-secondary-color)'],
|
|
@@ -10478,9 +10479,9 @@ var Header$1 = newStyled.div(templateObject_3$8 || (templateObject_3$8 = __makeT
|
|
|
10478
10479
|
margin: ['0rem 0rem 1rem 0rem', '1rem'],
|
|
10479
10480
|
}));
|
|
10480
10481
|
var ResultsPanel = function (_a) {
|
|
10481
|
-
var options = _a.options, header = _a.header, footer = _a.footer,
|
|
10482
|
+
var options = _a.options, header = _a.header, footer = _a.footer, onViewAll = _a.onViewAll, testId = _a.testId;
|
|
10482
10483
|
var theme = useTheme();
|
|
10483
|
-
return (jsxs$1(Container$9, __assign$1({ "data-testid": testId, theme: theme }, { children: [header && (jsx$1(Header$1, __assign$1({ theme: theme }, { children: jsx$1(Text$5, __assign$1({ variant: "heading6", weight: "demi" }, { children: header }), void 0) }), void 0)), jsx$1(Ul, { children: options.map(function (item, index) { return (jsx$1(Li, __assign$1({ theme: theme }, { children: jsx$1(
|
|
10484
|
+
return (jsxs$1(Container$9, __assign$1({ "data-testid": testId, theme: theme }, { children: [header && (jsx$1(Header$1, __assign$1({ theme: theme }, { children: jsx$1(Text$5, __assign$1({ variant: "heading6", weight: "demi" }, { children: header }), void 0) }), void 0)), jsx$1(Ul, { children: options.map(function (item, index) { return (jsx$1(Li, __assign$1({ theme: theme }, { children: jsx$1(Anchor, __assign$1({ href: item.optionUrl }, { children: jsx$1(ProductItem, { src: item.src, title: item.title, price: item.price }, void 0) }), void 0) }), index)); }) }, void 0), footer && jsx$1(Footer, { text: footer, onClick: onViewAll }, void 0)] }), void 0));
|
|
10484
10485
|
};
|
|
10485
10486
|
var templateObject_1$g, templateObject_2$8, templateObject_3$8;
|
|
10486
10487
|
|
|
@@ -10576,11 +10577,11 @@ var SearchIconContainer = newStyled.div({
|
|
|
10576
10577
|
alignSelf: 'center',
|
|
10577
10578
|
});
|
|
10578
10579
|
var SearchControl = function (_a) {
|
|
10579
|
-
var open = _a.open, onSearch = _a.onSearch,
|
|
10580
|
+
var open = _a.open, onSearch = _a.onSearch, onClose = _a.onClose;
|
|
10580
10581
|
var theme = useTheme();
|
|
10581
10582
|
var isMobile = useWindowDimensions(theme.mediaQueries).isMobile;
|
|
10582
10583
|
if (isMobile) {
|
|
10583
|
-
return open ? (jsx(ClearButton, { onClick:
|
|
10584
|
+
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));
|
|
10584
10585
|
}
|
|
10585
10586
|
else {
|
|
10586
10587
|
return (jsxs(Fragment, { children: [jsx(ButtonSecondary, { css: {
|
|
@@ -10590,7 +10591,7 @@ var SearchControl = function (_a) {
|
|
|
10590
10591
|
borderTopLeftRadius: 0,
|
|
10591
10592
|
borderBottomLeftRadius: 0,
|
|
10592
10593
|
padding: '0.875rem 1.5rem',
|
|
10593
|
-
}, text: "SEARCH", onClick: onSearch }, void 0), jsx(ClearButton, { onClick:
|
|
10594
|
+
}, text: "SEARCH", onClick: onSearch }, void 0), jsx(ClearButton, { onClick: onClose }, void 0)] }, void 0));
|
|
10594
10595
|
}
|
|
10595
10596
|
};
|
|
10596
10597
|
|
|
@@ -10600,15 +10601,9 @@ var reducer = function (state, action) {
|
|
|
10600
10601
|
case 'UPDATE_TERM': {
|
|
10601
10602
|
return __assign$1(__assign$1({}, state), { term: action.payload.term });
|
|
10602
10603
|
}
|
|
10603
|
-
case 'UPDATE_OPTION': {
|
|
10604
|
-
return __assign$1(__assign$1({}, state), { selectedOption: action.payload.selectedOption, term: action.payload.selectedOption.title.replaceAll(/(<([^>]+)>)/gi, ''), open: false });
|
|
10605
|
-
}
|
|
10606
10604
|
case 'TOGGLE_PANEL': {
|
|
10607
10605
|
return __assign$1(__assign$1({}, state), { open: action.payload.open });
|
|
10608
10606
|
}
|
|
10609
|
-
case 'CLEAR': {
|
|
10610
|
-
return __assign$1(__assign$1({}, state), { term: '', open: false });
|
|
10611
|
-
}
|
|
10612
10607
|
}
|
|
10613
10608
|
};
|
|
10614
10609
|
var Container$8 = newStyled.div({
|
|
@@ -10616,7 +10611,7 @@ var Container$8 = newStyled.div({
|
|
|
10616
10611
|
display: 'flex',
|
|
10617
10612
|
});
|
|
10618
10613
|
var SearchBar = function (_a) {
|
|
10619
|
-
var suggestions = _a.suggestions, resultOptions = _a.resultOptions, onChange = _a.onChange, onSearch = _a.onSearch, resultsPanelDataTestId = _a.resultsPanelDataTestId, allResults = _a.allResults, initialTerm = _a.initialTerm;
|
|
10614
|
+
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;
|
|
10620
10615
|
var theme = useTheme();
|
|
10621
10616
|
if (initialTerm) {
|
|
10622
10617
|
initialState$1.term = initialTerm;
|
|
@@ -10639,10 +10634,7 @@ var SearchBar = function (_a) {
|
|
|
10639
10634
|
: shouldDisplaySuggestion()
|
|
10640
10635
|
? suggestions
|
|
10641
10636
|
: [];
|
|
10642
|
-
return (jsxs$1("form", __assign$1({ role: "search", onSubmit: function (e) { return e.preventDefault(); }, ref: ref, style: { position: 'relative' } }, { children: [jsxs$1(Container$8, __assign$1({ theme: theme }, { children: [jsx$1(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), jsx$1(SearchControl, { open: state.open,
|
|
10643
|
-
onSearch(value.title);
|
|
10644
|
-
dispatch({ type: 'UPDATE_OPTION', payload: { selectedOption: value } });
|
|
10645
|
-
}, onViewAll: function () { return onSearch(state.term); } }, void 0))] }), void 0));
|
|
10637
|
+
return (jsxs$1("form", __assign$1({ role: "search", onSubmit: function (e) { return e.preventDefault(); }, ref: ref, style: { position: 'relative' } }, { children: [jsxs$1(Container$8, __assign$1({ theme: theme }, { children: [jsx$1(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), jsx$1(SearchControl, { open: state.open, onClose: onClose, onSearch: function () { return onSearch(state.term); } }, void 0)] }), void 0), state.open && !!options.length && (jsx$1(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));
|
|
10646
10638
|
};
|
|
10647
10639
|
|
|
10648
10640
|
function _extends() {
|