@trafilea/afrodita-components 4.4.0-beta.0 → 4.4.0-beta.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 +39 -12
- package/build/index.esm.js +151 -54
- package/build/index.esm.js.map +1 -1
- package/build/index.js +151 -53
- package/build/index.js.map +1 -1
- package/build/theme/shapermint.theme.d.ts +25 -0
- package/build/theme/shapermint.theme.js +25 -0
- package/build/theme/truekind.theme.d.ts +25 -0
- package/build/theme/truekind.theme.js +25 -0
- package/package.json +2 -1
package/build/index.d.ts
CHANGED
|
@@ -573,8 +573,9 @@ interface RatingProps {
|
|
|
573
573
|
size?: ComponentSize;
|
|
574
574
|
reviews: number;
|
|
575
575
|
reviewsText: string;
|
|
576
|
+
wrapWithParenthesis?: boolean;
|
|
576
577
|
}
|
|
577
|
-
declare const Rating: ({ size, reviews, reviewsText, rating, }: RatingProps) => JSX.Element;
|
|
578
|
+
declare const Rating: ({ size, reviews, reviewsText, rating, wrapWithParenthesis, }: RatingProps) => JSX.Element;
|
|
578
579
|
|
|
579
580
|
interface FitPredictorProps {
|
|
580
581
|
onClick: () => void;
|
|
@@ -830,6 +831,31 @@ declare type ThemeComponent = {
|
|
|
830
831
|
};
|
|
831
832
|
};
|
|
832
833
|
};
|
|
834
|
+
stars: {
|
|
835
|
+
element: {
|
|
836
|
+
color: string;
|
|
837
|
+
xsmall: {
|
|
838
|
+
width: string;
|
|
839
|
+
height: string;
|
|
840
|
+
marginRight: string;
|
|
841
|
+
};
|
|
842
|
+
small: {
|
|
843
|
+
width: string;
|
|
844
|
+
height: string;
|
|
845
|
+
marginRight: string;
|
|
846
|
+
};
|
|
847
|
+
medium: {
|
|
848
|
+
width: string;
|
|
849
|
+
height: string;
|
|
850
|
+
marginRight: string;
|
|
851
|
+
};
|
|
852
|
+
large: {
|
|
853
|
+
width: string;
|
|
854
|
+
height: string;
|
|
855
|
+
marginRight: string;
|
|
856
|
+
};
|
|
857
|
+
};
|
|
858
|
+
};
|
|
833
859
|
card: {
|
|
834
860
|
borderRadius: string;
|
|
835
861
|
};
|
|
@@ -1571,16 +1597,8 @@ declare const Overlay: _emotion_styled.StyledComponent<{
|
|
|
1571
1597
|
opened?: boolean | undefined;
|
|
1572
1598
|
}, React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
|
|
1573
1599
|
declare const Modal: FC<ModalProps>;
|
|
1574
|
-
declare
|
|
1575
|
-
|
|
1576
|
-
type: 'open' | 'close';
|
|
1577
|
-
};
|
|
1578
|
-
declare const modalEvent: (id: string, detail: Omit<ModalEventDetail, 'id'>) => void;
|
|
1579
|
-
declare global {
|
|
1580
|
-
interface WindowEventMap {
|
|
1581
|
-
modal: CustomEvent<ModalEventDetail>;
|
|
1582
|
-
}
|
|
1583
|
-
}
|
|
1600
|
+
declare const modalEvent: (id: string, detail: Omit<Events['modal'], 'id'>) => void;
|
|
1601
|
+
declare const useModalEvent: (id: string, cb: (event: CustomEvent<Events['modal']>) => void) => void;
|
|
1584
1602
|
|
|
1585
1603
|
interface CloseButtonProps {
|
|
1586
1604
|
onClick: () => void;
|
|
@@ -1628,6 +1646,15 @@ declare type SpacingProps = {
|
|
|
1628
1646
|
};
|
|
1629
1647
|
declare const Spacing: FC<SpacingProps>;
|
|
1630
1648
|
|
|
1649
|
+
declare global {
|
|
1650
|
+
interface Events {
|
|
1651
|
+
modal: {
|
|
1652
|
+
id: string;
|
|
1653
|
+
type: 'open' | 'close';
|
|
1654
|
+
};
|
|
1655
|
+
}
|
|
1656
|
+
}
|
|
1657
|
+
|
|
1631
1658
|
declare const useOnClickOutside: <T extends HTMLElement = HTMLElement>(ref: RefObject<T>, handler: (event: Event) => void) => void;
|
|
1632
1659
|
|
|
1633
1660
|
declare const useWindowDimensions: (breakpoints: ThemeBreakpoints) => {
|
|
@@ -1658,4 +1685,4 @@ declare const formatPrice: (value: number, { locale, currency }?: {
|
|
|
1658
1685
|
currency?: string | undefined;
|
|
1659
1686
|
}) => string;
|
|
1660
1687
|
|
|
1661
|
-
export { Accordion, AmazonButton, AssetsProvider, Bundle, ButtonPrimary, ButtonSecondary, ButtonSecondaryOutline, ButtonType, CTAProps, _default as Card, CardSectionType, CartProductItem, CategoryTag, Checkbox, Collection, Color, ColorPickerOption, ComponentPosition, ComponentSize, index_d as CrossSell, DeliveryDetails, DiscountTag, Drawer, DropdownListIcons, DropdownListIconsItem, DropdownListIconsSubItem, DropdownOption, Filter, FilterChange, FilteringDropdown, Tags as FilteringTags, FitPredictor, Icon, IconButton, IconProps, IconWithOpacityProps, Image, ImageType, Input, InputValidationType, Modal, MultiColorPicker, OfferBanner, OrderBar, Overlay, Pagination, Pattern, PaymentMethod, PaypalButton, Portal, PriceLabel, ProductGallery, ProductGalleryMobile, ProgressBar, QuantityPicker, RadioGroupInput, RadioGroupOption, RadioInput, Rating, Review, ScrollToTop, SearchBar, SearchBarOptionItem, SeasonOfferTag, SimpleDropdown, SimpleOrderItem, SingleColorPicker, SizeFitGuide, SizeOption, SizeSelector, SizeTable, SliderNavigation, Spacing, Spinner, StarList, Text, TextButton, Theme, ThemeAssets, ThemeBasicPallete, ThemeBreakpoints, ThemeColorPallete, ThemeColors, ThemeComponent, ThemeFonts, ThemeProvider, ThemeTypography, ThemeVariables, Timer, Tooltip, Totals, WithTestId, decimalFormat, formatPrice, isEmail, isEmpty, isNumber, isPhoneNumber, isValidDate, modalEvent, simulateMouseClick, sliceString, useOnClickOutside, useTheme, useThemeAssets, useWindowDimensions };
|
|
1688
|
+
export { Accordion, AmazonButton, AssetsProvider, Bundle, ButtonPrimary, ButtonSecondary, ButtonSecondaryOutline, ButtonType, CTAProps, _default as Card, CardSectionType, CartProductItem, CategoryTag, Checkbox, Collection, Color, ColorPickerOption, ComponentPosition, ComponentSize, index_d as CrossSell, DeliveryDetails, DiscountTag, Drawer, DropdownListIcons, DropdownListIconsItem, DropdownListIconsSubItem, DropdownOption, Filter, FilterChange, FilteringDropdown, Tags as FilteringTags, FitPredictor, Icon, IconButton, IconProps, IconWithOpacityProps, Image, ImageType, Input, InputValidationType, Modal, MultiColorPicker, OfferBanner, OrderBar, Overlay, Pagination, Pattern, PaymentMethod, PaypalButton, Portal, PriceLabel, ProductGallery, ProductGalleryMobile, ProgressBar, QuantityPicker, RadioGroupInput, RadioGroupOption, RadioInput, Rating, Review, ScrollToTop, SearchBar, SearchBarOptionItem, SeasonOfferTag, SimpleDropdown, SimpleOrderItem, SingleColorPicker, SizeFitGuide, SizeOption, SizeSelector, SizeTable, SliderNavigation, Spacing, Spinner, StarList, Text, TextButton, Theme, ThemeAssets, ThemeBasicPallete, ThemeBreakpoints, ThemeColorPallete, ThemeColors, ThemeComponent, ThemeFonts, ThemeProvider, ThemeTypography, ThemeVariables, Timer, Tooltip, Totals, WithTestId, decimalFormat, formatPrice, isEmail, isEmpty, isNumber, isPhoneNumber, isValidDate, modalEvent, simulateMouseClick, sliceString, useModalEvent, useOnClickOutside, useTheme, useThemeAssets, useWindowDimensions };
|
package/build/index.esm.js
CHANGED
|
@@ -6845,43 +6845,51 @@ var StarStyles = {
|
|
|
6845
6845
|
display: 'flex',
|
|
6846
6846
|
});
|
|
6847
6847
|
},
|
|
6848
|
-
xsmall: function () {
|
|
6848
|
+
xsmall: function (theme) {
|
|
6849
6849
|
return css({
|
|
6850
|
-
|
|
6851
|
-
|
|
6852
|
-
|
|
6850
|
+
svg: {
|
|
6851
|
+
width: theme.component.stars.element.xsmall.width,
|
|
6852
|
+
height: theme.component.stars.element.xsmall.height,
|
|
6853
|
+
marginRight: theme.component.stars.element.xsmall.marginRight,
|
|
6854
|
+
},
|
|
6853
6855
|
});
|
|
6854
6856
|
},
|
|
6855
|
-
small: function () {
|
|
6857
|
+
small: function (theme) {
|
|
6856
6858
|
return css({
|
|
6857
|
-
|
|
6858
|
-
|
|
6859
|
-
|
|
6859
|
+
svg: {
|
|
6860
|
+
width: theme.component.stars.element.small.width,
|
|
6861
|
+
height: theme.component.stars.element.small.height,
|
|
6862
|
+
marginRight: theme.component.stars.element.small.marginRight,
|
|
6863
|
+
},
|
|
6860
6864
|
});
|
|
6861
6865
|
},
|
|
6862
|
-
medium: function () {
|
|
6866
|
+
medium: function (theme) {
|
|
6863
6867
|
return css({
|
|
6864
|
-
|
|
6865
|
-
|
|
6866
|
-
|
|
6868
|
+
svg: {
|
|
6869
|
+
width: theme.component.stars.element.medium.width,
|
|
6870
|
+
height: theme.component.stars.element.medium.height,
|
|
6871
|
+
marginRight: theme.component.stars.element.medium.marginRight,
|
|
6872
|
+
},
|
|
6867
6873
|
});
|
|
6868
6874
|
},
|
|
6869
|
-
large: function () {
|
|
6875
|
+
large: function (theme) {
|
|
6870
6876
|
return css({
|
|
6871
|
-
|
|
6872
|
-
|
|
6873
|
-
|
|
6877
|
+
svg: {
|
|
6878
|
+
width: theme.component.stars.element.large.width,
|
|
6879
|
+
height: theme.component.stars.element.large.height,
|
|
6880
|
+
marginRight: theme.component.stars.element.large.marginRight,
|
|
6881
|
+
},
|
|
6874
6882
|
});
|
|
6875
6883
|
},
|
|
6876
6884
|
};
|
|
6877
|
-
var Container$w = newStyled.div(templateObject_1$P || (templateObject_1$P = __makeTemplateObject(["\n display: flex;\n"], ["\n display: flex;\n"])));
|
|
6885
|
+
var Container$w = newStyled.div(templateObject_1$P || (templateObject_1$P = __makeTemplateObject(["\n display: flex;\n align-items: center;\n"], ["\n display: flex;\n align-items: center;\n"])));
|
|
6878
6886
|
var templateObject_1$P;
|
|
6879
6887
|
|
|
6880
6888
|
var StarContainer = newStyled.div(function (_a) {
|
|
6881
|
-
var size = _a.size;
|
|
6889
|
+
var size = _a.size, theme = _a.theme;
|
|
6882
6890
|
return [
|
|
6883
6891
|
StarStyles.baseStyles(),
|
|
6884
|
-
StarStyles[size],
|
|
6892
|
+
StarStyles[size](theme),
|
|
6885
6893
|
];
|
|
6886
6894
|
});
|
|
6887
6895
|
var sizes = {
|
|
@@ -6892,8 +6900,9 @@ var sizes = {
|
|
|
6892
6900
|
};
|
|
6893
6901
|
var StarList = function (_a) {
|
|
6894
6902
|
var rating = _a.rating, starsNumber = _a.starsNumber, fill = _a.fill, _b = _a.size, size = _b === void 0 ? ComponentSize.Medium : _b;
|
|
6903
|
+
var theme = useTheme();
|
|
6895
6904
|
return (jsx$1(Container$w, { children: __spreadArray([], new Array(starsNumber), true).map(function (_, index) {
|
|
6896
|
-
return (jsx$1(StarContainer, __assign({ "data-testid": "star-container", size: size }, { children: index < Math.floor(rating) ? (jsx$1(Icon.PDP.Star, __assign({}, sizes[size], { fill: fill }), void 0)) : index === Math.floor(rating) && rating % 1 != 0 ? (jsx$1(Icon.PDP.StarHalf, __assign({}, sizes[size], { fill: fill }), void 0)) : (jsx$1(Icon.PDP.StarEmpty, __assign({}, sizes[size], { fill: fill }), void 0)) }), index));
|
|
6905
|
+
return (jsx$1(StarContainer, __assign({ "data-testid": "star-container", size: size, theme: theme }, { children: index < Math.floor(rating) ? (jsx$1(Icon.PDP.Star, __assign({}, sizes[size], { fill: fill }), void 0)) : index === Math.floor(rating) && rating % 1 != 0 ? (jsx$1(Icon.PDP.StarHalf, __assign({}, sizes[size], { fill: fill }), void 0)) : (jsx$1(Icon.PDP.StarEmpty, __assign({}, sizes[size], { fill: fill }), void 0)) }), index));
|
|
6897
6906
|
}) }, void 0));
|
|
6898
6907
|
};
|
|
6899
6908
|
|
|
@@ -6940,17 +6949,25 @@ var Container$v = newStyled.div(templateObject_1$O || (templateObject_1$O = __ma
|
|
|
6940
6949
|
var templateObject_1$O;
|
|
6941
6950
|
|
|
6942
6951
|
var CustomLabel = newStyled.div(function (_a) {
|
|
6943
|
-
var theme = _a.theme, size = _a.size;
|
|
6952
|
+
var theme = _a.theme, size = _a.size, wrapWithParenthesis = _a.wrapWithParenthesis;
|
|
6944
6953
|
return [
|
|
6945
6954
|
LabelStyles.baseStyles(theme),
|
|
6946
6955
|
LabelStyles[size](theme),
|
|
6956
|
+
{
|
|
6957
|
+
':before': {
|
|
6958
|
+
content: wrapWithParenthesis ? '"("' : '""',
|
|
6959
|
+
},
|
|
6960
|
+
':after': {
|
|
6961
|
+
content: wrapWithParenthesis ? '")"' : '""',
|
|
6962
|
+
},
|
|
6963
|
+
},
|
|
6947
6964
|
];
|
|
6948
6965
|
});
|
|
6949
6966
|
var starsNumber = 5;
|
|
6950
6967
|
var Rating = function (_a) {
|
|
6951
|
-
var _b = _a.size, size = _b === void 0 ? ComponentSize.Medium : _b, reviews = _a.reviews, reviewsText = _a.reviewsText, rating = _a.rating;
|
|
6968
|
+
var _b = _a.size, size = _b === void 0 ? ComponentSize.Medium : _b, reviews = _a.reviews, reviewsText = _a.reviewsText, rating = _a.rating, _c = _a.wrapWithParenthesis, wrapWithParenthesis = _c === void 0 ? false : _c;
|
|
6952
6969
|
var theme = useTheme();
|
|
6953
|
-
return (jsxs$1(Container$v, { children: [jsx$1(StarList, { rating: rating, size: size, starsNumber: starsNumber, fill: theme.
|
|
6970
|
+
return (jsxs$1(Container$v, { children: [jsx$1(StarList, { rating: rating, size: size, starsNumber: starsNumber, fill: theme.component.stars.element.color }, void 0), jsxs$1(CustomLabel, __assign({ theme: theme, size: size, wrapWithParenthesis: wrapWithParenthesis, "data-testid": "CustomLabel" }, { children: [reviews, " ", reviewsText] }), void 0)] }, void 0));
|
|
6954
6971
|
};
|
|
6955
6972
|
|
|
6956
6973
|
var Container$u = newStyled.div(templateObject_1$N || (templateObject_1$N = __makeTemplateObject(["\n display: flex;\n align-items: center;\n font-size: 0.88rem;\n"], ["\n display: flex;\n align-items: center;\n font-size: 0.88rem;\n"])));
|
|
@@ -12529,21 +12546,15 @@ var ProductItemMobile = function (_a) {
|
|
|
12529
12546
|
var title = _a.title, image = _a.image, price = _a.price, rating = _a.rating, size = _a.size, tags = _a.tags, _b = _a.alignName, alignName = _b === void 0 ? 'center' : _b, url = _a.url, className = _a.className;
|
|
12530
12547
|
var theme = useTheme();
|
|
12531
12548
|
var styles = getStylesBySize(size);
|
|
12532
|
-
var
|
|
12533
|
-
var _a
|
|
12534
|
-
|
|
12535
|
-
_a[ComponentSize.Large] =
|
|
12536
|
-
_a[ComponentSize.Medium] =
|
|
12537
|
-
_a[ComponentSize.Small] =
|
|
12549
|
+
var space = useMemo(function () {
|
|
12550
|
+
var _a;
|
|
12551
|
+
return (_a = {},
|
|
12552
|
+
_a[ComponentSize.Large] = 8,
|
|
12553
|
+
_a[ComponentSize.Medium] = 4,
|
|
12554
|
+
_a[ComponentSize.Small] = 2,
|
|
12538
12555
|
_a)[size];
|
|
12539
|
-
var second = (_b = {},
|
|
12540
|
-
_b[ComponentSize.Large] = 12,
|
|
12541
|
-
_b[ComponentSize.Medium] = 6,
|
|
12542
|
-
_b[ComponentSize.Small] = 4,
|
|
12543
|
-
_b)[size];
|
|
12544
|
-
return [first, second];
|
|
12545
12556
|
}, [size]);
|
|
12546
|
-
return (jsxs(Container$d, __assign({ as: url ? 'a' : 'div', href: url, className: className }, { children: [tags ? (jsxs(ImageContainer, __assign({ width: styles === null || styles === void 0 ? void 0 : styles.width, height: styles === null || styles === void 0 ? void 0 : styles.height, "data-testid": "tags-image-container" }, { children: [jsx(Image, { src: image.src, alt: image.alt, width: "100%", height: "100%" }, void 0), jsx(SeasonOfferTag, { text: tags.seasonOfferTagText, size: ComponentSize.Small, css: { position: 'absolute', top: 0, left: 0 } }, void 0), jsx(CategoryTag, { text: tags.categoryTagText, size: ComponentSize.Small, css: { position: 'absolute', bottom: '1rem', left: 0 } }, void 0)] }), void 0)) : (jsx(Image, { src: image.src, alt: image.alt, width: styles === null || styles === void 0 ? void 0 : styles.width, height: styles === null || styles === void 0 ? void 0 : styles.height }, void 0)), jsx(Spacing, { size:
|
|
12557
|
+
return (jsxs(Container$d, __assign({ as: url ? 'a' : 'div', href: url, className: className }, { children: [tags ? (jsxs(ImageContainer, __assign({ width: styles === null || styles === void 0 ? void 0 : styles.width, height: styles === null || styles === void 0 ? void 0 : styles.height, "data-testid": "tags-image-container" }, { children: [jsx(Image, { src: image.src, alt: image.alt, width: "100%", height: "100%" }, void 0), jsx(SeasonOfferTag, { text: tags.seasonOfferTagText, size: ComponentSize.Small, css: { position: 'absolute', top: 0, left: 0 } }, void 0), jsx(CategoryTag, { text: tags.categoryTagText, size: ComponentSize.Small, css: { position: 'absolute', bottom: '1rem', left: 0 } }, void 0)] }), void 0)) : (jsx(Image, { src: image.src, alt: image.alt, width: styles === null || styles === void 0 ? void 0 : styles.width, height: styles === null || styles === void 0 ? void 0 : styles.height }, void 0)), jsx(Spacing, { size: space }, void 0), jsx(H1, __assign({ theme: theme, align: alignName }, { children: title }), void 0), jsx(Spacing, { size: space }, void 0), jsx(PriceLabel, { finalPrice: price.finalPrice, originalPrice: price.originalPrice, color: price.color, size: ComponentSize.Small }, void 0), jsx(Spacing, { size: space }, void 0), jsx(Rating, { size: size === ComponentSize.Large ? ComponentSize.Small : ComponentSize.XSmall, rating: rating.rating, reviews: rating.reviews, reviewsText: "", wrapWithParenthesis: true }, void 0)] }), void 0));
|
|
12547
12558
|
};
|
|
12548
12559
|
var templateObject_1$j, templateObject_2$9;
|
|
12549
12560
|
|
|
@@ -13301,40 +13312,126 @@ var Portal = function (_a) {
|
|
|
13301
13312
|
return createPortal(children, container.current, id);
|
|
13302
13313
|
};
|
|
13303
13314
|
|
|
13315
|
+
var __defProp$1 = Object.defineProperty;
|
|
13316
|
+
var __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor;
|
|
13317
|
+
var __getOwnPropNames$1 = Object.getOwnPropertyNames;
|
|
13318
|
+
var __hasOwnProp$1 = Object.prototype.hasOwnProperty;
|
|
13319
|
+
var __markAsModule$1 = (target) => __defProp$1(target, "__esModule", { value: true });
|
|
13320
|
+
var __export$1 = (target, all) => {
|
|
13321
|
+
for (var name in all)
|
|
13322
|
+
__defProp$1(target, name, { get: all[name], enumerable: true });
|
|
13323
|
+
};
|
|
13324
|
+
var __reExport$1 = (target, module2, copyDefault, desc) => {
|
|
13325
|
+
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
13326
|
+
for (let key of __getOwnPropNames$1(module2))
|
|
13327
|
+
if (!__hasOwnProp$1.call(target, key) && (copyDefault || key !== "default"))
|
|
13328
|
+
__defProp$1(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc$1(module2, key)) || desc.enumerable });
|
|
13329
|
+
}
|
|
13330
|
+
return target;
|
|
13331
|
+
};
|
|
13332
|
+
var __toCommonJS$1 = /* @__PURE__ */ ((cache) => {
|
|
13333
|
+
return (module2, temp) => {
|
|
13334
|
+
return cache && cache.get(module2) || (temp = __reExport$1(__markAsModule$1({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
13335
|
+
};
|
|
13336
|
+
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
13337
|
+
|
|
13338
|
+
// src/index.ts
|
|
13339
|
+
var src_exports = {};
|
|
13340
|
+
__export$1(src_exports, {
|
|
13341
|
+
dispatchCustomEvent: () => dispatchCustomEvent,
|
|
13342
|
+
listenEvent: () => listenEvent$1,
|
|
13343
|
+
unlistenEvent: () => unlistenEvent$1
|
|
13344
|
+
});
|
|
13345
|
+
function listenEvent$1(event, handler) {
|
|
13346
|
+
window.addEventListener(event, handler);
|
|
13347
|
+
return () => unlistenEvent$1(event, handler);
|
|
13348
|
+
}
|
|
13349
|
+
function unlistenEvent$1(event, handler) {
|
|
13350
|
+
window.removeEventListener(event, handler);
|
|
13351
|
+
}
|
|
13352
|
+
function dispatchCustomEvent(event, detail) {
|
|
13353
|
+
window.dispatchEvent(new CustomEvent(event, { detail }));
|
|
13354
|
+
}
|
|
13355
|
+
var events = __toCommonJS$1(src_exports);
|
|
13356
|
+
|
|
13357
|
+
var __defProp = Object.defineProperty;
|
|
13358
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
13359
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
13360
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
13361
|
+
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
|
13362
|
+
var __export = (target, all) => {
|
|
13363
|
+
for (var name in all)
|
|
13364
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
13365
|
+
};
|
|
13366
|
+
var __reExport = (target, module2, copyDefault, desc) => {
|
|
13367
|
+
if (module2 && typeof module2 === "object" || typeof module2 === "function") {
|
|
13368
|
+
for (let key of __getOwnPropNames(module2))
|
|
13369
|
+
if (!__hasOwnProp.call(target, key) && (copyDefault || key !== "default"))
|
|
13370
|
+
__defProp(target, key, { get: () => module2[key], enumerable: !(desc = __getOwnPropDesc(module2, key)) || desc.enumerable });
|
|
13371
|
+
}
|
|
13372
|
+
return target;
|
|
13373
|
+
};
|
|
13374
|
+
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
|
13375
|
+
return (module2, temp) => {
|
|
13376
|
+
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
|
13377
|
+
};
|
|
13378
|
+
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
|
13379
|
+
|
|
13380
|
+
// src/react/index.ts
|
|
13381
|
+
var react_exports = {};
|
|
13382
|
+
__export(react_exports, {
|
|
13383
|
+
useEvent: () => useEvent
|
|
13384
|
+
});
|
|
13385
|
+
var import_react = React__default;
|
|
13386
|
+
|
|
13387
|
+
// src/index.ts
|
|
13388
|
+
function listenEvent(event, handler) {
|
|
13389
|
+
window.addEventListener(event, handler);
|
|
13390
|
+
return () => unlistenEvent(event, handler);
|
|
13391
|
+
}
|
|
13392
|
+
function unlistenEvent(event, handler) {
|
|
13393
|
+
window.removeEventListener(event, handler);
|
|
13394
|
+
}
|
|
13395
|
+
|
|
13396
|
+
// src/react/index.ts
|
|
13397
|
+
function useEvent(event, handler) {
|
|
13398
|
+
(0, import_react.useEffect)(() => {
|
|
13399
|
+
return listenEvent(event, handler);
|
|
13400
|
+
}, [event, handler]);
|
|
13401
|
+
}
|
|
13402
|
+
var react = __toCommonJS(react_exports);
|
|
13403
|
+
|
|
13304
13404
|
var visibleStyle = function (_a) {
|
|
13305
13405
|
var opened = _a.opened;
|
|
13306
13406
|
return opened
|
|
13307
13407
|
? css(templateObject_1$5 || (templateObject_1$5 = __makeTemplateObject(["\n opacity: 1;\n pointer-events: all;\n transform: translate(-50%, -50%);\n "], ["\n opacity: 1;\n pointer-events: all;\n transform: translate(-50%, -50%);\n "]))) : css(templateObject_2$1 || (templateObject_2$1 = __makeTemplateObject(["\n opacity: 0;\n pointer-events: none;\n transform: translate(-50%, -40%);\n "], ["\n opacity: 0;\n pointer-events: none;\n transform: translate(-50%, -40%);\n "])));
|
|
13308
13408
|
};
|
|
13309
|
-
var Container$2 = newStyled.div(templateObject_3$1 || (templateObject_3$1 = __makeTemplateObject(["\n border: 1px solid var(--colors-pallete-primary-color);\n border-radius: var(--radius-regular);\n padding: 20px;\n position: fixed;\n left: 50%;\n top: 50%;\n z-index: var(--zIndex-modal);\n background-color: var(--colors-background-color);\n min-width: var(--component-modal-minWidth);\n transition: transform 0.3s, opacity 0.3s;\n\n ", ";\n"], ["\n border: 1px solid var(--colors-pallete-primary-color);\n border-radius: var(--radius-regular);\n padding: 20px;\n position: fixed;\n left: 50%;\n top: 50%;\n z-index: var(--zIndex-modal);\n background-color: var(--colors-background-color);\n min-width: var(--component-modal-minWidth);\n transition: transform 0.3s, opacity 0.3s;\n\n ", ";\n"])), visibleStyle);
|
|
13409
|
+
var Container$2 = newStyled.div(templateObject_3$1 || (templateObject_3$1 = __makeTemplateObject(["\n border: 1px solid var(--colors-pallete-primary-color);\n border-radius: var(--radius-regular);\n padding: 20px;\n position: fixed;\n left: 50%;\n top: 50%;\n z-index: var(--zIndex-modal);\n background-color: var(--colors-background-color);\n min-width: var(--component-modal-minWidth);\n transition: transform 0.3s, opacity 0.3s;\n max-width: 90vw;\n max-height: 90vh;\n\n ", ";\n"], ["\n border: 1px solid var(--colors-pallete-primary-color);\n border-radius: var(--radius-regular);\n padding: 20px;\n position: fixed;\n left: 50%;\n top: 50%;\n z-index: var(--zIndex-modal);\n background-color: var(--colors-background-color);\n min-width: var(--component-modal-minWidth);\n transition: transform 0.3s, opacity 0.3s;\n max-width: 90vw;\n max-height: 90vh;\n\n ", ";\n"])), visibleStyle);
|
|
13310
13410
|
var Overlay = newStyled.div(templateObject_4$1 || (templateObject_4$1 = __makeTemplateObject(["\n position: fixed;\n left: 0;\n top: 0;\n width: 100%;\n height: 100%;\n background-color: rgba(0, 0, 0, 0.75);\n z-index: var(--zIndex-overlay);\n transition: transform 0.3s, opacity 0.3s;\n\n ", "\n\n transform: none;\n"], ["\n position: fixed;\n left: 0;\n top: 0;\n width: 100%;\n height: 100%;\n background-color: rgba(0, 0, 0, 0.75);\n z-index: var(--zIndex-overlay);\n transition: transform 0.3s, opacity 0.3s;\n\n ", "\n\n transform: none;\n"])), visibleStyle);
|
|
13311
13411
|
var Modal = function (_a) {
|
|
13312
13412
|
var id = _a.id, children = _a.children, _b = _a.dismissable, dismissable = _b === void 0 ? true : _b;
|
|
13313
13413
|
var _c = useState(false), opened = _c[0], setOpened = _c[1];
|
|
13314
|
-
|
|
13315
|
-
|
|
13316
|
-
|
|
13317
|
-
return;
|
|
13318
|
-
}
|
|
13319
|
-
setOpened(e.detail.type === 'open');
|
|
13320
|
-
};
|
|
13321
|
-
window.addEventListener('modal', onModal);
|
|
13322
|
-
return function () {
|
|
13323
|
-
window.removeEventListener('modal', onModal);
|
|
13324
|
-
};
|
|
13325
|
-
}, [id]);
|
|
13414
|
+
useModalEvent(id, useCallback(function (e) {
|
|
13415
|
+
setOpened(e.detail.type === 'open');
|
|
13416
|
+
}, []));
|
|
13326
13417
|
var onDismiss = function () {
|
|
13327
13418
|
if (!dismissable) {
|
|
13328
13419
|
return;
|
|
13329
13420
|
}
|
|
13330
|
-
|
|
13421
|
+
modalEvent(id, { type: 'close' });
|
|
13331
13422
|
};
|
|
13332
13423
|
return (jsxs(Portal, __assign({ id: id }, { children: [jsx(Container$2, __assign({ opened: opened }, { children: children }), void 0), jsx(Overlay, { opened: opened, onClick: onDismiss }, void 0)] }), void 0));
|
|
13333
13424
|
};
|
|
13334
13425
|
var modalEvent = function (id, detail) {
|
|
13335
|
-
|
|
13336
|
-
|
|
13337
|
-
|
|
13426
|
+
events.dispatchCustomEvent('modal', __assign({ id: id }, detail));
|
|
13427
|
+
};
|
|
13428
|
+
var useModalEvent = function (id, cb) {
|
|
13429
|
+
react.useEvent('modal', useCallback(function (event) {
|
|
13430
|
+
if (event.detail.id !== id) {
|
|
13431
|
+
return;
|
|
13432
|
+
}
|
|
13433
|
+
cb(event);
|
|
13434
|
+
}, [id, cb]));
|
|
13338
13435
|
};
|
|
13339
13436
|
var templateObject_1$5, templateObject_2$1, templateObject_3$1, templateObject_4$1;
|
|
13340
13437
|
|
|
@@ -13408,5 +13505,5 @@ var QuantityPicker = function (_a) {
|
|
|
13408
13505
|
};
|
|
13409
13506
|
var templateObject_1, templateObject_2, templateObject_3, templateObject_4;
|
|
13410
13507
|
|
|
13411
|
-
export { Accordion, AmazonButton, AssetsProvider, Bundle, ButtonPrimary, ButtonSecondary, ButtonSecondaryOutline, Card$1 as Card, CardSectionType, CartProductItem, CategoryTag, Checkbox, Collection, ComponentPosition, ComponentSize, index as CrossSell, DeliveryDetails, DiscountTag, Drawer, DropdownListIcons, FilteringDropdown, Tags as FilteringTags, FitPredictor, Icon, IconButton, Image, Input$1 as Input, InputValidationType, Modal, MultiColorPicker, OfferBanner, OrderBar, Overlay, Pagination, PaymentMethod, PaypalButton, Portal, PriceLabel, ProductGallery, ProductGalleryMobile, ProgressBar, QuantityPicker, RadioGroupInput, RadioInput, Rating, Review, ScrollToTop, SearchBar, SeasonOfferTag, SimpleDropdown, SimpleOrderItem, SingleColorPicker, SizeFitGuide, SizeSelector, SizeTable, SliderNavigation, Spacing, Spinner, StarList, Text$5 as Text, TextButton, ThemeProvider, ThemeVariables, Timer, Tooltip, Totals, decimalFormat, formatPrice, isEmail, isEmpty, isNumber, isPhoneNumber, isValidDate, modalEvent, simulateMouseClick, sliceString, useOnClickOutside, useTheme, useThemeAssets, useWindowDimensions };
|
|
13508
|
+
export { Accordion, AmazonButton, AssetsProvider, Bundle, ButtonPrimary, ButtonSecondary, ButtonSecondaryOutline, Card$1 as Card, CardSectionType, CartProductItem, CategoryTag, Checkbox, Collection, ComponentPosition, ComponentSize, index as CrossSell, DeliveryDetails, DiscountTag, Drawer, DropdownListIcons, FilteringDropdown, Tags as FilteringTags, FitPredictor, Icon, IconButton, Image, Input$1 as Input, InputValidationType, Modal, MultiColorPicker, OfferBanner, OrderBar, Overlay, Pagination, PaymentMethod, PaypalButton, Portal, PriceLabel, ProductGallery, ProductGalleryMobile, ProgressBar, QuantityPicker, RadioGroupInput, RadioInput, Rating, Review, ScrollToTop, SearchBar, SeasonOfferTag, SimpleDropdown, SimpleOrderItem, SingleColorPicker, SizeFitGuide, SizeSelector, SizeTable, SliderNavigation, Spacing, Spinner, StarList, Text$5 as Text, TextButton, ThemeProvider, ThemeVariables, Timer, Tooltip, Totals, decimalFormat, formatPrice, isEmail, isEmpty, isNumber, isPhoneNumber, isValidDate, modalEvent, simulateMouseClick, sliceString, useModalEvent, useOnClickOutside, useTheme, useThemeAssets, useWindowDimensions };
|
|
13412
13509
|
//# sourceMappingURL=index.esm.js.map
|