@trafilea/afrodita-components 6.2.0 → 6.3.0
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 +8 -3
- package/build/index.esm.js +63 -24
- package/build/index.esm.js.map +1 -1
- package/build/index.js +63 -24
- package/build/index.js.map +1 -1
- package/package.json +1 -1
package/build/index.js
CHANGED
|
@@ -3227,19 +3227,26 @@ var fetchWithCache = function (request, saveToCacheFn) {
|
|
|
3227
3227
|
var createIconImage = function (_a) {
|
|
3228
3228
|
var src = _a.src;
|
|
3229
3229
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
3230
|
-
var
|
|
3230
|
+
var localUrl, error_1;
|
|
3231
3231
|
return __generator(this, function (_b) {
|
|
3232
3232
|
switch (_b.label) {
|
|
3233
3233
|
case 0:
|
|
3234
3234
|
_b.trys.push([0, 2, , 3]);
|
|
3235
|
-
return [4 /*yield*/, fetchWithCache(src, function (response) { return
|
|
3235
|
+
return [4 /*yield*/, fetchWithCache(src, function (response) { return __awaiter(void 0, void 0, void 0, function () {
|
|
3236
|
+
var blob;
|
|
3237
|
+
return __generator(this, function (_a) {
|
|
3238
|
+
switch (_a.label) {
|
|
3239
|
+
case 0: return [4 /*yield*/, response.blob()];
|
|
3240
|
+
case 1:
|
|
3241
|
+
blob = _a.sent();
|
|
3242
|
+
return [2 /*return*/, URL.createObjectURL(blob)];
|
|
3243
|
+
}
|
|
3244
|
+
});
|
|
3245
|
+
}); })];
|
|
3236
3246
|
case 1:
|
|
3237
|
-
|
|
3238
|
-
localUrl_1 = URL.createObjectURL(blob);
|
|
3239
|
-
cleanup = function () { return URL.revokeObjectURL(localUrl_1); };
|
|
3247
|
+
localUrl = _b.sent();
|
|
3240
3248
|
return [2 /*return*/, {
|
|
3241
|
-
src:
|
|
3242
|
-
cleanup: cleanup,
|
|
3249
|
+
src: localUrl,
|
|
3243
3250
|
}];
|
|
3244
3251
|
case 2:
|
|
3245
3252
|
error_1 = _b.sent();
|
|
@@ -3288,11 +3295,10 @@ var IconFromExtSource = function (_a) {
|
|
|
3288
3295
|
if (!localSource) {
|
|
3289
3296
|
fetchIcon();
|
|
3290
3297
|
}
|
|
3291
|
-
|
|
3292
|
-
}, [iconURL, localSource === null || localSource === void 0 ? void 0 : localSource.cleanup]);
|
|
3298
|
+
}, [iconURL]);
|
|
3293
3299
|
var imageProperties = __assign$1({ alt: title !== null && title !== void 0 ? title : name, 'data-testid': testId, height: height, width: width }, rest);
|
|
3294
3300
|
if (error) {
|
|
3295
|
-
return jsxRuntime.jsx(StyledImageWrapper, __assign$1({}, imageProperties,
|
|
3301
|
+
return jsxRuntime.jsx(StyledImageWrapper, __assign$1({}, imageProperties, { src: iconURL }), void 0);
|
|
3296
3302
|
}
|
|
3297
3303
|
if (!localSource) {
|
|
3298
3304
|
return jsxRuntime.jsx(SkeletonBox, { width: width, height: height }, void 0);
|
|
@@ -3304,7 +3310,7 @@ var IconFromExtSource = function (_a) {
|
|
|
3304
3310
|
};
|
|
3305
3311
|
|
|
3306
3312
|
/* eslint-disable react/forbid-component-props */
|
|
3307
|
-
var
|
|
3313
|
+
var UnmemoIcon = function (_a) {
|
|
3308
3314
|
var height = _a.height, _b = _a.width, width = _b === void 0 ? 1 : _b, title = _a.title, testId = _a.testId, fill = _a.fill, name = _a.name, svgProps = _a.svgProps, rest = __rest(_a, ["height", "width", "title", "testId", "fill", "name", "svgProps"]);
|
|
3309
3315
|
var assets = useTheme().assets;
|
|
3310
3316
|
var newWidth = width && getIconDimension(width);
|
|
@@ -3316,7 +3322,8 @@ var Icon$1 = function (_a) {
|
|
|
3316
3322
|
return (jsxRuntime.jsxs(StyledSvgWrapper, __assign$1({ "data-testid": testId, fill: fill, height: newHeight, type: "image/svg+xml", width: newWidth }, rest, svgProps, { children: [jsxRuntime.jsx("title", { children: title !== null && title !== void 0 ? title : name }, void 0), jsxRuntime.jsx("use", { xlinkHref: "".concat(iconURL, "#").concat(svgId) }, void 0)] }), void 0));
|
|
3317
3323
|
}
|
|
3318
3324
|
return (jsxRuntime.jsx(IconFromExtSource, __assign$1({ svgId: svgId, iconURL: iconURL, testId: testId, fill: fill, height: newHeight, svgProps: svgProps, width: newWidth, name: name, title: title }, rest), void 0));
|
|
3319
|
-
};
|
|
3325
|
+
};
|
|
3326
|
+
var Icon$1 = React__default["default"].memo(UnmemoIcon, function (prevProps, nextProps) { return prevProps.name !== nextProps.name; });
|
|
3320
3327
|
|
|
3321
3328
|
var Add = function (props) { return jsxRuntime.jsx(Icon$1, __assign$1({}, props, { name: "actions/add" }), void 0); };
|
|
3322
3329
|
|
|
@@ -5235,28 +5242,60 @@ var DiscountTag = function (_a) {
|
|
|
5235
5242
|
};
|
|
5236
5243
|
var templateObject_1$1A, templateObject_2$10;
|
|
5237
5244
|
|
|
5245
|
+
//TODO Move this to types with ThemeBreakpoints
|
|
5246
|
+
var Viewports = {
|
|
5247
|
+
mobile: 'mobile',
|
|
5248
|
+
tablet: 'tablet',
|
|
5249
|
+
desktop: 'desktop',
|
|
5250
|
+
};
|
|
5238
5251
|
function getWindowDimensions() {
|
|
5252
|
+
if (typeof window === 'undefined')
|
|
5253
|
+
return { width: 0, height: 0 };
|
|
5239
5254
|
var width = window.innerWidth, height = window.innerHeight;
|
|
5240
5255
|
return {
|
|
5241
5256
|
width: width,
|
|
5242
5257
|
height: height,
|
|
5243
5258
|
};
|
|
5244
5259
|
}
|
|
5245
|
-
var
|
|
5246
|
-
|
|
5260
|
+
var getViewport = function (breakpoints, width) {
|
|
5261
|
+
if (width <= breakpoints.mobile)
|
|
5262
|
+
return Viewports.mobile;
|
|
5263
|
+
if (breakpoints.tablet && width <= breakpoints.tablet) {
|
|
5264
|
+
return Viewports.tablet;
|
|
5265
|
+
}
|
|
5266
|
+
return Viewports.desktop;
|
|
5267
|
+
};
|
|
5268
|
+
var useWindowDimensions = function (breakpoints, shouldListenChanges) {
|
|
5269
|
+
var _a = React$2.useState(function () {
|
|
5270
|
+
var dimension = getWindowDimensions();
|
|
5271
|
+
return {
|
|
5272
|
+
windowDimensions: dimension,
|
|
5273
|
+
viewport: getViewport(breakpoints, dimension.width),
|
|
5274
|
+
};
|
|
5275
|
+
}), state = _a[0], setState = _a[1];
|
|
5247
5276
|
React$2.useEffect(function () {
|
|
5248
5277
|
function handleResize() {
|
|
5249
|
-
|
|
5278
|
+
var newDimension = getWindowDimensions();
|
|
5279
|
+
var newViewport = getViewport(breakpoints, newDimension.width);
|
|
5280
|
+
setState(function (oldState) {
|
|
5281
|
+
if (shouldListenChanges || oldState.viewport !== newViewport) {
|
|
5282
|
+
return {
|
|
5283
|
+
windowDimensions: newDimension,
|
|
5284
|
+
viewport: newViewport,
|
|
5285
|
+
};
|
|
5286
|
+
}
|
|
5287
|
+
return oldState;
|
|
5288
|
+
});
|
|
5250
5289
|
}
|
|
5251
|
-
// calling it here updates the dimensions on first render
|
|
5252
5290
|
handleResize();
|
|
5253
5291
|
window.addEventListener('resize', handleResize);
|
|
5254
5292
|
return function () { return window.removeEventListener('resize', handleResize); };
|
|
5255
|
-
|
|
5256
|
-
|
|
5257
|
-
|
|
5258
|
-
|
|
5259
|
-
|
|
5293
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
5294
|
+
}, [shouldListenChanges]);
|
|
5295
|
+
var isMobile = state.viewport === Viewports.mobile;
|
|
5296
|
+
var isTablet = state.viewport === Viewports.tablet;
|
|
5297
|
+
var isDesktop = state.viewport === Viewports.desktop;
|
|
5298
|
+
return __assign$1(__assign$1({}, state), { isMobile: isMobile, isTablet: isTablet, isDesktop: isDesktop });
|
|
5260
5299
|
};
|
|
5261
5300
|
|
|
5262
5301
|
var getStylesBySize$c = function (size, theme) {
|
|
@@ -13727,9 +13766,9 @@ var range = function (limit) { return __spreadArray([], new Array(limit), true).
|
|
|
13727
13766
|
var SlideDots = function (_a) {
|
|
13728
13767
|
var quantity = _a.quantity, selectedIndex = _a.selectedIndex, containerDataTestId = _a.containerDataTestId;
|
|
13729
13768
|
var theme = useTheme();
|
|
13730
|
-
return (jsxRuntime.jsx(Container$u, __assign$1({ "data-testid": containerDataTestId }, { children: range(quantity).map(function (index) { return (jsxRuntime.jsx(Icon
|
|
13769
|
+
return (jsxRuntime.jsx(Container$u, __assign$1({ "data-testid": containerDataTestId }, { children: range(quantity).map(function (index) { return (jsxRuntime.jsx(Icon$1, { name: "navigation/slide_dot".concat(index === selectedIndex ? '_solid' : ''), height: 0.75, width: 0.75, fill: index === selectedIndex
|
|
13731
13770
|
? theme.component.slideNavigation.slideDots.selectedDotColor
|
|
13732
|
-
: theme.component.slideNavigation.slideDots.unselectedDotColor, opacity: theme.component.slideNavigation.slideDots.dotsOpacity, testId: "slide-dot-".concat(index) }, index)); }) }), void 0));
|
|
13771
|
+
: theme.component.slideNavigation.slideDots.unselectedDotColor, opacity: theme.component.slideNavigation.slideDots.dotsOpacity, testId: "slide-dot-".concat(index) }, "Icon-".concat(index, "-navigation/slide_dot").concat(index === selectedIndex ? '_solid' : ''))); }) }), void 0));
|
|
13733
13772
|
};
|
|
13734
13773
|
var templateObject_1$E;
|
|
13735
13774
|
|
|
@@ -19227,7 +19266,7 @@ var getDefaultCountdown = function () {
|
|
|
19227
19266
|
var HurryUp = function (_a) {
|
|
19228
19267
|
var hurryUpText = _a.hurryUpText, backgroundColor = _a.backgroundColor, _b = _a.iconSize, iconSize = _b === void 0 ? 1.5 : _b, _c = _a.textPosition, textPosition = _c === void 0 ? 'center' : _c, _d = _a.showTimer, showTimer = _d === void 0 ? false : _d, _e = _a.clockPosition, clockPosition = _e === void 0 ? 'left' : _e, _f = _a.countdown, countdown = _f === void 0 ? getDefaultCountdown() : _f, timerProps = __rest(_a, ["hurryUpText", "backgroundColor", "iconSize", "textPosition", "showTimer", "clockPosition", "countdown"]);
|
|
19229
19268
|
var theme = useTheme();
|
|
19230
|
-
return (jsxRuntime.jsxs(TimerContainer, __assign$1({ backgroundColor: backgroundColor || theme.component.card.backgroundColor, textPosition: textPosition, borderRadius: theme.component.hurryUp.borderRadius, "data-testid": "HurryUp" }, { children: [clockPosition === 'left' && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Icon.PDP.Stopwatch, { width: iconSize, height: iconSize, fill: theme.colors.pallete.secondary.color }, void 0), "\u00A0"] }, void 0)), jsxRuntime.jsx(Text$8, __assign$1({ testId: "HurryUpText", variant: "body", size: "small", weight: "demi" }, { children: hurryUpText }), void 0), clockPosition === 'right' && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Icon.PDP.Stopwatch, { width: iconSize, height: iconSize, fill: theme.colors.pallete.secondary.color }, void 0), "\u00A0"] }, void 0)), showTimer && jsxRuntime.jsx(Timer, __assign$1({ countdown: countdown, onTimeUp: function () { } }, timerProps), void 0)] }), void 0));
|
|
19269
|
+
return (jsxRuntime.jsxs(TimerContainer, __assign$1({ backgroundColor: backgroundColor || theme.component.card.backgroundColor, textPosition: textPosition, borderRadius: theme.component.hurryUp.borderRadius, "data-testid": "HurryUp" }, { children: [clockPosition === 'left' && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Icon.PDP.Stopwatch, { width: iconSize, height: iconSize, fill: theme.colors.pallete.secondary.color }, void 0), "\u00A0"] }, void 0)), jsxRuntime.jsx(Text$8, __assign$1({ testId: "HurryUpText", variant: "body", size: "small", weight: "demi" }, { children: hurryUpText }), void 0), "\u00A0", clockPosition === 'right' && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(Icon.PDP.Stopwatch, { width: iconSize, height: iconSize, fill: theme.colors.pallete.secondary.color }, void 0), "\u00A0"] }, void 0)), showTimer && jsxRuntime.jsx(Timer, __assign$1({ countdown: countdown, onTimeUp: function () { } }, timerProps), void 0)] }), void 0));
|
|
19231
19270
|
};
|
|
19232
19271
|
|
|
19233
19272
|
var Container = newStyled.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n width: ", ";\n height: ", ";\n svg {\n vertical-align: unset;\n }\n"], ["\n width: ", ";\n height: ", ";\n svg {\n vertical-align: unset;\n }\n"])), function (_a) {
|