@sima-land/moleculas 16.0.0-alpha.22 → 16.0.0-alpha.23
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/README.md +1 -1
- package/common/components/hover-slider/hover-slider-nav.d.ts +7 -0
- package/common/components/hover-slider/hover-slider-nav.js +21 -0
- package/common/components/hover-slider/hover-slider-nav.js.map +1 -0
- package/common/components/hover-slider/hover-slider-nav.m.scss +22 -0
- package/common/components/hover-slider/hover-slider.d.ts +9 -0
- package/common/components/hover-slider/hover-slider.js +88 -0
- package/common/components/hover-slider/hover-slider.js.map +1 -0
- package/common/components/hover-slider/hover-slider.m.scss +36 -0
- package/common/components/hover-slider/index.d.ts +3 -0
- package/common/components/hover-slider/index.js +9 -0
- package/common/components/hover-slider/index.js.map +1 -0
- package/common/components/hover-slider/types.d.ts +28 -0
- package/common/components/hover-slider/types.js.map +1 -0
- package/common/components/hover-slider/utils.d.ts +8 -0
- package/common/components/hover-slider/utils.js +23 -0
- package/common/components/hover-slider/utils.js.map +1 -0
- package/common/components/product-image/index.d.ts +3 -0
- package/common/components/product-image/index.js +8 -0
- package/common/components/product-image/index.js.map +1 -0
- package/common/components/product-image/product-image.d.ts +10 -0
- package/common/components/product-image/product-image.js +33 -0
- package/common/components/product-image/product-image.js.map +1 -0
- package/common/components/product-image/product-image.m.scss +62 -0
- package/common/components/product-image/types.d.ts +30 -0
- package/common/components/product-image/types.js +3 -0
- package/common/components/product-image/types.js.map +1 -0
- package/common/components/product-image/utils.d.ts +3 -0
- package/common/components/product-image/utils.js +6 -0
- package/common/components/product-image/utils.js.map +1 -0
- package/common/components/product-info/index.d.ts +4 -1
- package/common/components/product-info/index.js +5 -2
- package/common/components/product-info/index.js.map +1 -1
- package/common/components/product-info/parts/adult-confirm-button.d.ts +7 -0
- package/common/components/product-info/parts/adult-confirm-button.js +20 -0
- package/common/components/product-info/parts/adult-confirm-button.js.map +1 -0
- package/common/components/product-info/parts/badges.d.ts +7 -0
- package/common/components/product-info/parts/badges.js +20 -0
- package/common/components/product-info/parts/badges.js.map +1 -0
- package/common/components/product-info/parts/badges.m.scss +3 -0
- package/common/components/product-info/parts/cart-control.d.ts +7 -0
- package/common/components/product-info/parts/cart-control.js +19 -0
- package/common/components/product-info/parts/cart-control.js.map +1 -0
- package/common/components/product-info/parts/cart-control.m.scss +41 -0
- package/common/components/product-info/parts/footer.d.ts +7 -0
- package/common/components/product-info/parts/footer.js +22 -0
- package/common/components/product-info/parts/footer.js.map +1 -0
- package/common/components/product-info/parts/footer.m.scss +3 -0
- package/common/components/product-info/parts/image-button.d.ts +7 -0
- package/common/components/product-info/parts/image-button.js +39 -0
- package/common/components/product-info/parts/image-button.js.map +1 -0
- package/common/components/product-info/parts/image-button.m.scss +40 -0
- package/common/components/product-info/parts/image.d.ts +7 -0
- package/common/components/product-info/parts/image.js +27 -0
- package/common/components/product-info/parts/image.js.map +1 -0
- package/common/components/product-info/parts/image.m.scss +24 -0
- package/common/components/product-info/parts/index.d.ts +34 -0
- package/common/components/product-info/parts/index.js +38 -0
- package/common/components/product-info/parts/index.js.map +1 -0
- package/common/components/product-info/parts/media.d.ts +7 -0
- package/common/components/product-info/parts/media.js +19 -0
- package/common/components/product-info/parts/media.js.map +1 -0
- package/common/components/product-info/parts/media.m.scss +10 -0
- package/common/components/product-info/parts/parts.m.scss +15 -0
- package/common/components/product-info/parts/prices.d.ts +7 -0
- package/common/components/product-info/parts/prices.js +26 -0
- package/common/components/product-info/parts/prices.js.map +1 -0
- package/common/components/product-info/parts/prices.m.scss +28 -0
- package/common/components/product-info/parts/rating-counter.m.scss +12 -0
- package/common/components/product-info/parts/rating-couter.d.ts +7 -0
- package/common/components/product-info/parts/rating-couter.js +20 -0
- package/common/components/product-info/parts/rating-couter.js.map +1 -0
- package/common/components/product-info/parts/secondary-info.d.ts +7 -0
- package/common/components/product-info/parts/secondary-info.js +19 -0
- package/common/components/product-info/parts/secondary-info.js.map +1 -0
- package/common/components/product-info/parts/secondary-info.m.scss +8 -0
- package/common/components/product-info/parts/title.d.ts +7 -0
- package/common/components/product-info/parts/title.js +24 -0
- package/common/components/product-info/parts/title.js.map +1 -0
- package/common/components/product-info/parts/title.m.scss +23 -0
- package/common/components/product-info/parts/trademark-link.d.ts +7 -0
- package/common/components/product-info/parts/trademark-link.js +20 -0
- package/common/components/product-info/parts/trademark-link.js.map +1 -0
- package/common/components/product-info/parts/trademark-link.m.scss +9 -0
- package/common/components/product-info/parts/wait-list-add-link.d.ts +7 -0
- package/common/components/product-info/parts/wait-list-add-link.js +20 -0
- package/common/components/product-info/parts/wait-list-add-link.js.map +1 -0
- package/common/components/product-info/parts/wait-list-added-link.d.ts +7 -0
- package/common/components/product-info/parts/wait-list-added-link.js +22 -0
- package/common/components/product-info/parts/wait-list-added-link.js.map +1 -0
- package/common/components/product-info/parts/wait-list-added-link.m.scss +13 -0
- package/common/components/product-info/product-info.d.ts +3 -6
- package/common/components/product-info/product-info.js +15 -10
- package/common/components/product-info/product-info.js.map +1 -1
- package/common/components/product-info/types.d.ts +59 -2
- package/common/components/product-info/utils.d.ts +3 -0
- package/common/components/product-info/utils.js +7 -2
- package/common/components/product-info/utils.js.map +1 -1
- package/common/components/rating-counter/rating-counter.js +1 -1
- package/common/components/rating-counter/rating-counter.js.map +1 -1
- package/common/hooks/index.d.ts +3 -19
- package/common/hooks/index.js +7 -36
- package/common/hooks/index.js.map +1 -1
- package/common/hooks/use-client-width.d.ts +8 -0
- package/common/hooks/use-client-width.js +28 -0
- package/common/hooks/use-client-width.js.map +1 -0
- package/common/hooks/use-image-stub.d.ts +14 -0
- package/common/hooks/use-image-stub.js +26 -0
- package/common/hooks/use-image-stub.js.map +1 -0
- package/common/hooks/use-mounted.d.ts +5 -0
- package/common/hooks/use-mounted.js +19 -0
- package/common/hooks/use-mounted.js.map +1 -0
- package/desktop/components/product-carousel/product-carousel.d.ts +1 -1
- package/desktop/components/product-carousel/product-carousel.js +20 -40
- package/desktop/components/product-carousel/product-carousel.js.map +1 -1
- package/desktop/components/product-carousel/product-carousel.m.scss +0 -6
- package/desktop/components/product-carousel/types.d.ts +1 -4
- package/package.json +2 -2
- package/common/components/product-info/parts.d.ts +0 -69
- package/common/components/product-info/parts.js +0 -160
- package/common/components/product-info/parts.js.map +0 -1
- package/common/components/product-info/product-info.m.scss +0 -280
- package/desktop/components/product-card/index.d.ts +0 -2
- package/desktop/components/product-card/index.js +0 -9
- package/desktop/components/product-card/index.js.map +0 -1
- package/desktop/components/product-card/product-card.d.ts +0 -23
- package/desktop/components/product-card/product-card.js +0 -94
- package/desktop/components/product-card/product-card.js.map +0 -1
- package/desktop/components/product-card/product-card.m.scss +0 -12
- package/desktop/components/product-card/types.d.ts +0 -19
- package/desktop/components/product-card/types.js.map +0 -1
- package/desktop/components/product-carousel/hover-card.d.ts +0 -7
- package/desktop/components/product-carousel/hover-card.js +0 -40
- package/desktop/components/product-carousel/hover-card.js.map +0 -1
- package/desktop/components/product-carousel/hover-card.m.scss +0 -14
- package/desktop/components/product-carousel/utils.d.ts +0 -16
- package/desktop/components/product-carousel/utils.js +0 -45
- package/desktop/components/product-carousel/utils.js.map +0 -1
- /package/{desktop/components/product-card → common/components/hover-slider}/types.js +0 -0
package/README.md
CHANGED
|
@@ -18,6 +18,6 @@ yarn add @sima-land/moleculas
|
|
|
18
18
|
|
|
19
19
|
Компоненты библиотеки используют:
|
|
20
20
|
|
|
21
|
-
- импорты css/scss-файлов как css-модулей (каждый такой файл промаркирован в виде `*.
|
|
21
|
+
- импорты css/scss-файлов как css-модулей (каждый такой файл промаркирован в виде `*.m.{css,scss}`)
|
|
22
22
|
|
|
23
23
|
Поэтому, для использования библиотеки необходимо сконфигурировать среду (сборщик или тестовый фреймворк) таким образом чтобы данные импорты работали корректно.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { HoverSliderNavProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Навигация карусели. Отображает общее количество и текущий элемент.
|
|
4
|
+
* @param props Свойства.
|
|
5
|
+
* @return Элемент.
|
|
6
|
+
*/
|
|
7
|
+
export declare function HoverSliderNav({ current, total, className, ...restProps }: HoverSliderNavProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.HoverSliderNav = void 0;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const react_1 = require("react");
|
|
9
|
+
const classnames_1 = __importDefault(require("classnames"));
|
|
10
|
+
const hover_slider_nav_m_scss_1 = __importDefault(require("./hover-slider-nav.m.scss"));
|
|
11
|
+
/**
|
|
12
|
+
* Навигация карусели. Отображает общее количество и текущий элемент.
|
|
13
|
+
* @param props Свойства.
|
|
14
|
+
* @return Элемент.
|
|
15
|
+
*/
|
|
16
|
+
function HoverSliderNav({ current, total, className, ...restProps }) {
|
|
17
|
+
const indices = (0, react_1.useMemo)(() => [...Array(total).keys()], [total]);
|
|
18
|
+
return ((0, jsx_runtime_1.jsx)("div", { ...restProps, className: (0, classnames_1.default)(hover_slider_nav_m_scss_1.default.nav, className), children: indices.map(index => ((0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)(hover_slider_nav_m_scss_1.default['nav-item'], index === current && hover_slider_nav_m_scss_1.default['nav-item-active']) }, index))) }));
|
|
19
|
+
}
|
|
20
|
+
exports.HoverSliderNav = HoverSliderNav;
|
|
21
|
+
//# sourceMappingURL=hover-slider-nav.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hover-slider-nav.js","sourceRoot":"","sources":["../../../../src/common/components/hover-slider/hover-slider-nav.tsx"],"names":[],"mappings":";;;;;;;AACA,iCAAgC;AAChC,4DAAoC;AACpC,wFAA+C;AAE/C;;;;GAIG;AACH,SAAgB,cAAc,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,SAAS,EAAuB;IAC7F,MAAM,OAAO,GAAG,IAAA,eAAO,EAAC,GAAG,EAAE,CAAC,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IAEjE,OAAO,CACL,mCAAS,SAAS,EAAE,SAAS,EAAE,IAAA,oBAAU,EAAC,iCAAM,CAAC,GAAG,EAAE,SAAS,CAAC,YAC7D,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,CACpB,gCAEE,SAAS,EAAE,IAAA,oBAAU,EAAC,iCAAM,CAAC,UAAU,CAAC,EAAE,KAAK,KAAK,OAAO,IAAI,iCAAM,CAAC,iBAAiB,CAAC,CAAC,IADpF,KAAK,CAEV,CACH,CAAC,GACE,CACP,CAAC;AACJ,CAAC;AAbD,wCAaC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
@use 'node_modules/@sima-land/ui-nucleons/colors';
|
|
2
|
+
|
|
3
|
+
.nav {
|
|
4
|
+
padding: 2px;
|
|
5
|
+
display: flex;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.nav-item {
|
|
9
|
+
flex-grow: 1;
|
|
10
|
+
height: 4px;
|
|
11
|
+
border-radius: 2px;
|
|
12
|
+
background: colors.$basic-gray38;
|
|
13
|
+
opacity: 0.32;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.nav-item + .nav-item {
|
|
17
|
+
margin-left: 4px;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.nav-item-active {
|
|
21
|
+
opacity: 1;
|
|
22
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { HoverSliderProps, HoverSliderItemProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Блок карусели с прокруткой при движении мыши над ним.
|
|
4
|
+
* @param props Свойства.
|
|
5
|
+
* @return Элемент.
|
|
6
|
+
*/
|
|
7
|
+
export declare function HoverSlider({ rootRef: rootRefProp, withNav, children, beforeList, afterList, className, 'data-testid': testId, ...restProps }: HoverSliderProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
/** @inheritdoc */
|
|
9
|
+
export declare function HoverSliderItem({ children, className, ...restProps }: HoverSliderItemProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.HoverSliderItem = exports.HoverSlider = void 0;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const react_1 = require("react");
|
|
9
|
+
const utils_1 = require("./utils");
|
|
10
|
+
const hover_slider_nav_1 = require("./hover-slider-nav");
|
|
11
|
+
const hooks_1 = require("@sima-land/ui-nucleons/hooks");
|
|
12
|
+
const helpers_1 = require("@sima-land/ui-nucleons/helpers");
|
|
13
|
+
const classnames_1 = __importDefault(require("classnames"));
|
|
14
|
+
const hover_slider_m_scss_1 = __importDefault(require("./hover-slider.m.scss"));
|
|
15
|
+
/**
|
|
16
|
+
* Блок карусели с прокруткой при движении мыши над ним.
|
|
17
|
+
* @param props Свойства.
|
|
18
|
+
* @return Элемент.
|
|
19
|
+
*/
|
|
20
|
+
function HoverSlider({ rootRef: rootRefProp, withNav = true, children, beforeList, afterList, className, 'data-testid': testId = 'hover-slider', ...restProps }) {
|
|
21
|
+
const rootRef = (0, react_1.useRef)(null);
|
|
22
|
+
const listRef = (0, react_1.useRef)(null);
|
|
23
|
+
const [activeIndex, setActiveIndex] = (0, react_1.useState)(0);
|
|
24
|
+
const { count, contextValue } = (0, utils_1.useSlideCount)();
|
|
25
|
+
(0, react_1.useImperativeHandle)(rootRefProp, () => rootRef.current);
|
|
26
|
+
// ВАЖНО: подписываемся напрямую через ref так как React вызывает onMouseLeave не на mouseleave а на mouseout
|
|
27
|
+
(0, react_1.useEffect)(() => {
|
|
28
|
+
const list = listRef.current;
|
|
29
|
+
const root = rootRef.current;
|
|
30
|
+
if (!root || !list || count < 2) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
/** @inheritdoc */
|
|
34
|
+
const onMouseMove = (event) => {
|
|
35
|
+
const rootRect = root.getBoundingClientRect();
|
|
36
|
+
const rootClientX = event.clientX - rootRect.left;
|
|
37
|
+
const imageIndex = Math.floor(rootClientX / (rootRect.width / count));
|
|
38
|
+
list.scrollLeft = rootRect.width * imageIndex;
|
|
39
|
+
setActiveIndex(imageIndex);
|
|
40
|
+
};
|
|
41
|
+
/** @inheritdoc */
|
|
42
|
+
const onMouseLeave = () => {
|
|
43
|
+
list.scrollLeft = 0;
|
|
44
|
+
setActiveIndex(0);
|
|
45
|
+
};
|
|
46
|
+
const off = [
|
|
47
|
+
//
|
|
48
|
+
(0, helpers_1.on)(root, 'mousemove', onMouseMove),
|
|
49
|
+
(0, helpers_1.on)(root, 'mouseleave', onMouseLeave),
|
|
50
|
+
];
|
|
51
|
+
return () => {
|
|
52
|
+
off.forEach(fn => fn());
|
|
53
|
+
};
|
|
54
|
+
}, [count]);
|
|
55
|
+
(0, react_1.useEffect)(() => {
|
|
56
|
+
const list = listRef.current;
|
|
57
|
+
if (!list || count < 2) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
/** @inheritdoc */
|
|
61
|
+
const onScroll = () => {
|
|
62
|
+
setActiveIndex(Math.round(list.scrollLeft / list.getBoundingClientRect().width));
|
|
63
|
+
};
|
|
64
|
+
const off = [
|
|
65
|
+
//
|
|
66
|
+
(0, helpers_1.on)(list, 'scroll', onScroll),
|
|
67
|
+
];
|
|
68
|
+
return () => {
|
|
69
|
+
off.forEach(fn => fn());
|
|
70
|
+
};
|
|
71
|
+
}, [count]);
|
|
72
|
+
return ((0, jsx_runtime_1.jsx)(utils_1.HoverSliderContext.Provider, { value: contextValue, children: (0, jsx_runtime_1.jsxs)("div", { ...restProps, ref: rootRef, className: (0, classnames_1.default)(hover_slider_m_scss_1.default.root, className), "data-testid": testId, children: [beforeList, (0, jsx_runtime_1.jsx)("div", { ref: listRef, className: hover_slider_m_scss_1.default.list, children: children }), afterList, withNav && count > 1 && ((0, jsx_runtime_1.jsx)(hover_slider_nav_1.HoverSliderNav, { current: activeIndex, total: count, className: hover_slider_m_scss_1.default.nav }))] }) }));
|
|
73
|
+
}
|
|
74
|
+
exports.HoverSlider = HoverSlider;
|
|
75
|
+
/** @inheritdoc */
|
|
76
|
+
function HoverSliderItem({ children, className, ...restProps }) {
|
|
77
|
+
const { itemMounted, itemUnmounted } = (0, react_1.useContext)(utils_1.HoverSliderContext);
|
|
78
|
+
const itemId = (0, react_1.useMemo)(() => Math.random().toString(16).slice(2), []);
|
|
79
|
+
(0, hooks_1.useIsomorphicLayoutEffect)(() => {
|
|
80
|
+
itemMounted(itemId);
|
|
81
|
+
return () => {
|
|
82
|
+
itemUnmounted(itemId);
|
|
83
|
+
};
|
|
84
|
+
}, [itemId, itemMounted, itemUnmounted]);
|
|
85
|
+
return ((0, jsx_runtime_1.jsx)("div", { ...restProps, className: (0, classnames_1.default)(hover_slider_m_scss_1.default['list-item'], className), children: children }));
|
|
86
|
+
}
|
|
87
|
+
exports.HoverSliderItem = HoverSliderItem;
|
|
88
|
+
//# sourceMappingURL=hover-slider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hover-slider.js","sourceRoot":"","sources":["../../../../src/common/components/hover-slider/hover-slider.tsx"],"names":[],"mappings":";;;;;;;AAAA,iCAA8F;AAE9F,mCAA4D;AAC5D,yDAAoD;AACpD,wDAAyE;AACzE,4DAAoD;AACpD,4DAAoC;AACpC,gFAA2C;AAE3C;;;;GAIG;AACH,SAAgB,WAA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_modules/@sima-land/ui-nucleons/utils';
|
|
3
|
+
|
|
4
|
+
.root {
|
|
5
|
+
position: relative;
|
|
6
|
+
width: var(--hover-slider-width, 320px);
|
|
7
|
+
height: var(--hover-slider-height, 320px);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.list {
|
|
11
|
+
width: 100%;
|
|
12
|
+
height: 100%;
|
|
13
|
+
overflow: hidden;
|
|
14
|
+
overflow-x: auto;
|
|
15
|
+
display: flex;
|
|
16
|
+
scroll-snap-type: x mandatory;
|
|
17
|
+
overscroll-behavior: none;
|
|
18
|
+
@include utils.hidden-scrollbars;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.list-item {
|
|
22
|
+
scroll-snap-align: center;
|
|
23
|
+
display: block;
|
|
24
|
+
width: 100%;
|
|
25
|
+
height: 100%;
|
|
26
|
+
flex-shrink: 0;
|
|
27
|
+
flex-grow: 1;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.nav {
|
|
31
|
+
position: absolute;
|
|
32
|
+
top: 0;
|
|
33
|
+
left: 0;
|
|
34
|
+
width: 100%;
|
|
35
|
+
pointer-events: none;
|
|
36
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.HoverSliderNav = exports.HoverSliderItem = exports.HoverSlider = void 0;
|
|
4
|
+
var hover_slider_1 = require("./hover-slider");
|
|
5
|
+
Object.defineProperty(exports, "HoverSlider", { enumerable: true, get: function () { return hover_slider_1.HoverSlider; } });
|
|
6
|
+
Object.defineProperty(exports, "HoverSliderItem", { enumerable: true, get: function () { return hover_slider_1.HoverSliderItem; } });
|
|
7
|
+
var hover_slider_nav_1 = require("./hover-slider-nav");
|
|
8
|
+
Object.defineProperty(exports, "HoverSliderNav", { enumerable: true, get: function () { return hover_slider_nav_1.HoverSliderNav; } });
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/common/components/hover-slider/index.ts"],"names":[],"mappings":";;;AACA,+CAA8D;AAArD,2GAAA,WAAW,OAAA;AAAE,+GAAA,eAAe,OAAA;AACrC,uDAAoD;AAA3C,kHAAA,cAAc,OAAA"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { WithTestId } from '@sima-land/ui-nucleons/types';
|
|
2
|
+
import type { CSSProperties, HTMLAttributes, ReactNode, Ref } from 'react';
|
|
3
|
+
export interface HoverSliderStyle extends CSSProperties {
|
|
4
|
+
'--hover-slider-width'?: string;
|
|
5
|
+
'--hover-slider-height'?: string;
|
|
6
|
+
}
|
|
7
|
+
export interface HoverSliderProps extends HTMLAttributes<HTMLDivElement>, WithTestId {
|
|
8
|
+
/** Нужно ли показывать навигационные элементы. */
|
|
9
|
+
withNav?: boolean;
|
|
10
|
+
/** Контент перед элементом списка. */
|
|
11
|
+
beforeList?: ReactNode;
|
|
12
|
+
/** Контент после элемента списка. */
|
|
13
|
+
afterList?: ReactNode;
|
|
14
|
+
/** Стили. */
|
|
15
|
+
style?: HoverSliderStyle;
|
|
16
|
+
/** Реф корневого элемента. */
|
|
17
|
+
rootRef?: Ref<HTMLDivElement>;
|
|
18
|
+
}
|
|
19
|
+
export interface HoverSliderItemProps extends HTMLAttributes<HTMLDivElement> {
|
|
20
|
+
}
|
|
21
|
+
export interface HoverSliderNavProps extends HTMLAttributes<HTMLDivElement> {
|
|
22
|
+
current: number;
|
|
23
|
+
total: number;
|
|
24
|
+
}
|
|
25
|
+
export interface HoverSliderContextValue {
|
|
26
|
+
itemMounted: (itemId: string) => void;
|
|
27
|
+
itemUnmounted: (itemId: string) => void;
|
|
28
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/common/components/hover-slider/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { HoverSliderContextValue } from './types';
|
|
3
|
+
export declare const HoverSliderContext: import("react").Context<HoverSliderContextValue>;
|
|
4
|
+
/** @inheritdoc */
|
|
5
|
+
export declare function useSlideCount(): {
|
|
6
|
+
count: number;
|
|
7
|
+
contextValue: HoverSliderContextValue;
|
|
8
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useSlideCount = exports.HoverSliderContext = void 0;
|
|
4
|
+
const react_1 = require("react");
|
|
5
|
+
exports.HoverSliderContext = (0, react_1.createContext)({
|
|
6
|
+
itemMounted: () => { },
|
|
7
|
+
itemUnmounted: () => { },
|
|
8
|
+
});
|
|
9
|
+
/** @inheritdoc */
|
|
10
|
+
function useSlideCount() {
|
|
11
|
+
const [slideIds, setSlideIds] = (0, react_1.useState)(() => []);
|
|
12
|
+
const contextValue = (0, react_1.useMemo)(() => ({
|
|
13
|
+
itemMounted: itemId => {
|
|
14
|
+
setSlideIds(list => (list.includes(itemId) ? list : [...list, itemId]));
|
|
15
|
+
},
|
|
16
|
+
itemUnmounted: itemId => {
|
|
17
|
+
setSlideIds(list => (list.includes(itemId) ? list.filter(item => item !== itemId) : list));
|
|
18
|
+
},
|
|
19
|
+
}), []);
|
|
20
|
+
return { count: slideIds.length, contextValue };
|
|
21
|
+
}
|
|
22
|
+
exports.useSlideCount = useSlideCount;
|
|
23
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/common/components/hover-slider/utils.ts"],"names":[],"mappings":";;;AAAA,iCAAyD;AAG5C,QAAA,kBAAkB,GAAG,IAAA,qBAAa,EAA0B;IACvE,WAAW,EAAE,GAAG,EAAE,GAAE,CAAC;IACrB,aAAa,EAAE,GAAG,EAAE,GAAE,CAAC;CACxB,CAAC,CAAC;AAEH,kBAAkB;AAClB,SAAgB,aAAa;IAC3B,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,IAAA,gBAAQ,EAAW,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC;IAE7D,MAAM,YAAY,GAAG,IAAA,eAAO,EAC1B,GAAG,EAAE,CAAC,CAAC;QACL,WAAW,EAAE,MAAM,CAAC,EAAE;YACpB,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;QAC1E,CAAC;QACD,aAAa,EAAE,MAAM,CAAC,EAAE;YACtB,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;QAC7F,CAAC;KACF,CAAC,EACF,EAAE,CACH,CAAC;IAEF,OAAO,EAAE,KAAK,EAAE,QAAQ,CAAC,MAAM,EAAE,YAAY,EAAE,CAAC;AAClD,CAAC;AAhBD,sCAgBC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ProductImageContext = exports.ProductImage = void 0;
|
|
4
|
+
var product_image_1 = require("./product-image");
|
|
5
|
+
Object.defineProperty(exports, "ProductImage", { enumerable: true, get: function () { return product_image_1.ProductImage; } });
|
|
6
|
+
var utils_1 = require("./utils");
|
|
7
|
+
Object.defineProperty(exports, "ProductImageContext", { enumerable: true, get: function () { return utils_1.ProductImageContext; } });
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/common/components/product-image/index.ts"],"names":[],"mappings":";;;AACA,iDAA+C;AAAtC,6GAAA,YAAY,OAAA;AACrB,iCAA8C;AAArC,4GAAA,mBAAmB,OAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type ProductImageProps } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Изображение товара.
|
|
4
|
+
* Добавляет наложение поверх по гайдам.
|
|
5
|
+
* Размывает изображения для взрослых при указании атрибута adult.
|
|
6
|
+
* Выводит заглушку для не загрузившихся изображений.
|
|
7
|
+
* @param props Свойства.
|
|
8
|
+
* @return Элемент.
|
|
9
|
+
*/
|
|
10
|
+
export declare function ProductImage({ src, alt, style, className, rootRef, imageRef, imageProps, adult: adultFromProps, adultContent, stubContent, 'data-testid': testId, ...restProps }: ProductImageProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ProductImage = void 0;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const utils_1 = require("./utils");
|
|
9
|
+
const react_1 = require("react");
|
|
10
|
+
const hooks_1 = require("../../../common/hooks");
|
|
11
|
+
const img_stub_1 = require("../img-stub");
|
|
12
|
+
const EighteenPlus_1 = __importDefault(require("@sima-land/ui-quarks/icons/64x64/Stroked/EighteenPlus"));
|
|
13
|
+
const classnames_1 = __importDefault(require("classnames"));
|
|
14
|
+
const product_image_m_scss_1 = __importDefault(require("./product-image.m.scss"));
|
|
15
|
+
const defaultAdultContent = (0, jsx_runtime_1.jsx)(EighteenPlus_1.default, { className: product_image_m_scss_1.default['adult-icon'] });
|
|
16
|
+
const defaultStubContent = (0, jsx_runtime_1.jsx)(img_stub_1.ImgStub, { className: product_image_m_scss_1.default['broken-stub'] });
|
|
17
|
+
/**
|
|
18
|
+
* Изображение товара.
|
|
19
|
+
* Добавляет наложение поверх по гайдам.
|
|
20
|
+
* Размывает изображения для взрослых при указании атрибута adult.
|
|
21
|
+
* Выводит заглушку для не загрузившихся изображений.
|
|
22
|
+
* @param props Свойства.
|
|
23
|
+
* @return Элемент.
|
|
24
|
+
*/
|
|
25
|
+
function ProductImage({ src, alt = '', style, className, rootRef, imageRef, imageProps, adult: adultFromProps, adultContent = defaultAdultContent, stubContent = defaultStubContent, 'data-testid': testId = 'product-image', ...restProps }) {
|
|
26
|
+
var _a, _b;
|
|
27
|
+
const { adult: adultFromContext } = (0, react_1.useContext)(utils_1.ProductImageContext);
|
|
28
|
+
const { failed, handleError } = (0, hooks_1.useImageStub)(src, imageProps === null || imageProps === void 0 ? void 0 : imageProps.onError);
|
|
29
|
+
const adult = adultFromProps !== null && adultFromProps !== void 0 ? adultFromProps : adultFromContext;
|
|
30
|
+
return ((0, jsx_runtime_1.jsxs)("div", { ...restProps, ref: rootRef, style: style, className: (0, classnames_1.default)(product_image_m_scss_1.default.root, !failed && product_image_m_scss_1.default.overlay, className), "data-testid": testId, children: [(0, jsx_runtime_1.jsx)("img", { ...imageProps, ref: imageRef, src: (_a = imageProps === null || imageProps === void 0 ? void 0 : imageProps.src) !== null && _a !== void 0 ? _a : src, alt: (_b = imageProps === null || imageProps === void 0 ? void 0 : imageProps.alt) !== null && _b !== void 0 ? _b : alt, onError: handleError, className: (0, classnames_1.default)(product_image_m_scss_1.default.image, adult && product_image_m_scss_1.default.adult, imageProps === null || imageProps === void 0 ? void 0 : imageProps.className) }), adult && adultContent, failed && stubContent] }));
|
|
31
|
+
}
|
|
32
|
+
exports.ProductImage = ProductImage;
|
|
33
|
+
//# sourceMappingURL=product-image.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"product-image.js","s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UAAU,CAAE,GAAG,mCAAI,GAAG,EAC3B,GAAG,EAAE,MAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,GAAG,mCAAI,GAAG,EAC3B,OAAO,EAAE,WAAW,EACpB,SAAS,EAAE,IAAA,oBAAU,EAAC,8BAAM,CAAC,KAAK,EAAE,KAAK,IAAI,8BAAM,CAAC,KAAK,EAAE,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,SAAS,CAAC,GACjF,EAED,KAAK,IAAI,YAAY,EAErB,MAAM,IAAI,WAAW,IAClB,CACP,CAAC;AACJ,CAAC;AAzCD,oCAyCC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
@use 'node_modules/@sima-land/ui-nucleons/colors';
|
|
2
|
+
|
|
3
|
+
.root {
|
|
4
|
+
position: relative;
|
|
5
|
+
width: var(--product-image-width, 200px);
|
|
6
|
+
height: var(--product-image-height, 200px);
|
|
7
|
+
overflow: hidden;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.overlay::after {
|
|
11
|
+
content: '';
|
|
12
|
+
position: absolute;
|
|
13
|
+
top: 0;
|
|
14
|
+
left: 0;
|
|
15
|
+
right: 0;
|
|
16
|
+
bottom: 0;
|
|
17
|
+
background-color: var(--product-image-overlay-color, rgba(0, 0, 0, 0.04));
|
|
18
|
+
|
|
19
|
+
// ВАЖНО: чтобы можно было сохранять фото с помощью контекстного меню
|
|
20
|
+
pointer-events: none;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.image {
|
|
24
|
+
position: absolute;
|
|
25
|
+
top: 0;
|
|
26
|
+
left: 0;
|
|
27
|
+
width: 100%;
|
|
28
|
+
height: 100%;
|
|
29
|
+
display: block;
|
|
30
|
+
max-width: 100%;
|
|
31
|
+
object-fit: var(--product-image-object-fit, contain);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.adult {
|
|
35
|
+
opacity: 0.2;
|
|
36
|
+
|
|
37
|
+
// ВАЖНО: чтобы нельзя было сохранить с помощью ПКМ
|
|
38
|
+
pointer-events: none;
|
|
39
|
+
user-select: none;
|
|
40
|
+
|
|
41
|
+
// @todo на больших изображениях blur(24px) не будет скрывать изображение также как на маленьких
|
|
42
|
+
filter: blur(24px);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.broken-stub {
|
|
46
|
+
position: absolute;
|
|
47
|
+
top: 0;
|
|
48
|
+
left: 0;
|
|
49
|
+
width: 100%;
|
|
50
|
+
height: 100%;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.adult-icon {
|
|
54
|
+
display: block;
|
|
55
|
+
position: absolute;
|
|
56
|
+
width: 40%;
|
|
57
|
+
height: 40%;
|
|
58
|
+
top: 50%;
|
|
59
|
+
left: 50%;
|
|
60
|
+
transform: translate(-50%, -50%);
|
|
61
|
+
fill: colors.$basic-gray38;
|
|
62
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { WithTestId } from '@sima-land/ui-nucleons/types';
|
|
2
|
+
import type { CSSProperties, HTMLAttributes, ImgHTMLAttributes, ReactNode, Ref } from 'react';
|
|
3
|
+
export interface ProductImageStyle extends CSSProperties {
|
|
4
|
+
'--product-image-width'?: string;
|
|
5
|
+
'--product-image-height'?: string;
|
|
6
|
+
'--product-image-object-fit'?: string;
|
|
7
|
+
'--product-image-overlay-color'?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface ProductImageProps extends HTMLAttributes<HTMLDivElement>, WithTestId {
|
|
10
|
+
/** Источник изображения. */
|
|
11
|
+
src?: string;
|
|
12
|
+
/** Альтернативный текст. */
|
|
13
|
+
alt?: string;
|
|
14
|
+
/** Нужно ли размыть изображение и добавить маркировку 18+. */
|
|
15
|
+
adult?: boolean;
|
|
16
|
+
/** Стили корневого элемента. */
|
|
17
|
+
style?: ProductImageStyle;
|
|
18
|
+
/** Класс корневого элемента. */
|
|
19
|
+
className?: string;
|
|
20
|
+
/** Реф корневого элемента. */
|
|
21
|
+
rootRef?: Ref<HTMLDivElement>;
|
|
22
|
+
/** Реф элемента img. */
|
|
23
|
+
imageRef?: Ref<HTMLImageElement>;
|
|
24
|
+
/** Прочие свойства элемента img. */
|
|
25
|
+
imageProps?: ImgHTMLAttributes<HTMLImageElement>;
|
|
26
|
+
/** Доп.контент, который будет выведен при adult=true. */
|
|
27
|
+
adultContent?: ReactNode;
|
|
28
|
+
/** Доп.контент, который будет выведен при ошибке загрузки. */
|
|
29
|
+
stubContent?: ReactNode;
|
|
30
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/common/components/product-image/types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/common/components/product-image/utils.ts"],"names":[],"mappings":";;;AAAA,iCAAsC;AAGzB,QAAA,mBAAmB,GAAG,IAAA,qBAAa,EAAmC,EAAE,CAAC,CAAC"}
|
|
@@ -1 +1,4 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export type { ProductInfoProps, ProductInfoRestriction } from './types';
|
|
2
|
+
export { ProductInfo } from './product-info';
|
|
3
|
+
export { ProductInfoContext } from './utils';
|
|
4
|
+
export { Parts } from './parts';
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Parts = exports.ProductInfo = void 0;
|
|
3
|
+
exports.Parts = exports.ProductInfoContext = exports.ProductInfo = void 0;
|
|
4
4
|
var product_info_1 = require("./product-info");
|
|
5
5
|
Object.defineProperty(exports, "ProductInfo", { enumerable: true, get: function () { return product_info_1.ProductInfo; } });
|
|
6
|
-
|
|
6
|
+
var utils_1 = require("./utils");
|
|
7
|
+
Object.defineProperty(exports, "ProductInfoContext", { enumerable: true, get: function () { return utils_1.ProductInfoContext; } });
|
|
8
|
+
var parts_1 = require("./parts");
|
|
9
|
+
Object.defineProperty(exports, "Parts", { enumerable: true, get: function () { return parts_1.Parts; } });
|
|
7
10
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/common/components/product-info/index.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/common/components/product-info/index.ts"],"names":[],"mappings":";;;AACA,+CAA6C;AAApC,2GAAA,WAAW,OAAA;AACpB,iCAA6C;AAApC,2GAAA,kBAAkB,OAAA;AAC3B,iCAAgC;AAAvB,8FAAA,KAAK,OAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type LinkProps } from '@sima-land/ui-nucleons/link';
|
|
2
|
+
/**
|
|
3
|
+
* Кнопка "подтвердить".
|
|
4
|
+
* @param props Свойства.
|
|
5
|
+
* @return Элемент.
|
|
6
|
+
*/
|
|
7
|
+
export declare function AdultConfirmButton({ children, pseudo, color, className, 'data-testid': testId, ...restProps }: LinkProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.AdultConfirmButton = void 0;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const link_1 = require("@sima-land/ui-nucleons/link");
|
|
9
|
+
const classnames_1 = __importDefault(require("classnames"));
|
|
10
|
+
const parts_m_scss_1 = __importDefault(require("./parts.m.scss"));
|
|
11
|
+
/**
|
|
12
|
+
* Кнопка "подтвердить".
|
|
13
|
+
* @param props Свойства.
|
|
14
|
+
* @return Элемент.
|
|
15
|
+
*/
|
|
16
|
+
function AdultConfirmButton({ children = 'Подтвердить', pseudo = true, color = 'basic-blue', className, 'data-testid': testId = 'product-info:adult-confirm-button', ...restProps }) {
|
|
17
|
+
return ((0, jsx_runtime_1.jsx)(link_1.Link, { ...restProps, pseudo: pseudo, color: color, className: (0, classnames_1.default)(parts_m_scss_1.default['text-button'], className), "data-testid": testId, children: children }));
|
|
18
|
+
}
|
|
19
|
+
exports.AdultConfirmButton = AdultConfirmButton;
|
|
20
|
+
//# sourceMappingURL=adult-confirm-button.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adult-confirm-button.js","sourceRoot":"","sources":["../../../../../src/common/components/product-info/parts/adult-confirm-button.tsx"],"names":[],"mappings":";;;;;;;AAAA,sDAAmE;AACnE,4DAAoC;AACpC,kEAAoC;AAEpC;;;;GAIG;AACH,SAAgB,kBAAkB,CAAC,EACjC,QAAQ,GAAG,aAAa,EACxB,MAAM,GAAG,IAAI,EACb,KAAK,GAAG,YAAY,EACpB,SAAS,EACT,aAAa,EAAE,MAAM,GAAG,mCAAmC,EAC3D,GAAG,SAAS,EACF;IACV,OAAO,CACL,uBAAC,WAAI,OACC,SAAS,EACb,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,IAAA,oBAAU,EAAC,sBAAM,CAAC,aAAa,CAAC,EAAE,SAAS,CAAC,iBAC1C,MAAM,YAElB,QAAQ,GACJ,CACR,CAAC;AACJ,CAAC;AAnBD,gDAmBC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type BadgeListProps } from '../../badge-list';
|
|
2
|
+
/**
|
|
3
|
+
* Слот для вывода шильдиков.
|
|
4
|
+
* @param props Свойства.
|
|
5
|
+
* @return Элемент.
|
|
6
|
+
*/
|
|
7
|
+
export declare function ProductInfoBadges({ children, className, ...restProps }: BadgeListProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ProductInfoBadges = void 0;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const badge_list_1 = require("../../badge-list");
|
|
9
|
+
const classnames_1 = __importDefault(require("classnames"));
|
|
10
|
+
const badges_m_scss_1 = __importDefault(require("./badges.m.scss"));
|
|
11
|
+
/**
|
|
12
|
+
* Слот для вывода шильдиков.
|
|
13
|
+
* @param props Свойства.
|
|
14
|
+
* @return Элемент.
|
|
15
|
+
*/
|
|
16
|
+
function ProductInfoBadges({ children, className, ...restProps }) {
|
|
17
|
+
return ((0, jsx_runtime_1.jsx)(badge_list_1.BadgeList, { className: (0, classnames_1.default)(badges_m_scss_1.default.badges, className), ...restProps, children: children }));
|
|
18
|
+
}
|
|
19
|
+
exports.ProductInfoBadges = ProductInfoBadges;
|
|
20
|
+
//# sourceMappingURL=badges.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"badges.js","sourceRoot":"","sources":["../../../../../src/common/components/product-info/parts/badges.tsx"],"names":[],"mappings":";;;;;;;AAAA,iDAAkE;AAClE,4DAAoC;AACpC,oEAAqC;AAErC;;;;GAIG;AACH,SAAgB,iBAAiB,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,SAAS,EAAkB;IACrF,OAAO,CACL,uBAAC,sBAAS,IAAC,SAAS,EAAE,IAAA,oBAAU,EAAC,uBAAM,CAAC,MAAM,EAAE,SAAS,CAAC,KAAM,SAAS,YACtE,QAAQ,GACC,CACb,CAAC;AACJ,CAAC;AAND,8CAMC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ProductInfoCartControlProps } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Блок управления корзиной.
|
|
4
|
+
* @param props Свойства.
|
|
5
|
+
* @return Элемент.
|
|
6
|
+
*/
|
|
7
|
+
export declare function ProductInfoCartControl({ children, stepText, markupText, loading, }: ProductInfoCartControlProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ProductInfoCartControl = void 0;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const cart_control_m_scss_1 = __importDefault(require("./cart-control.m.scss"));
|
|
9
|
+
const classnames_1 = __importDefault(require("classnames"));
|
|
10
|
+
/**
|
|
11
|
+
* Блок управления корзиной.
|
|
12
|
+
* @param props Свойства.
|
|
13
|
+
* @return Элемент.
|
|
14
|
+
*/
|
|
15
|
+
function ProductInfoCartControl({ children, stepText, markupText, loading, }) {
|
|
16
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: (0, classnames_1.default)(cart_control_m_scss_1.default.root, loading && cart_control_m_scss_1.default.loading), children: [(0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)(cart_control_m_scss_1.default.main), children: !loading && children }), (loading || stepText) && ((0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)(cart_control_m_scss_1.default.aside), "data-testid": 'product-info:cart-step', children: !loading && stepText })), !loading && markupText && ((0, jsx_runtime_1.jsx)("div", { className: (0, classnames_1.default)(cart_control_m_scss_1.default.footer), "data-testid": 'product-info:cart-info', children: markupText }))] }));
|
|
17
|
+
}
|
|
18
|
+
exports.ProductInfoCartControl = ProductInfoCartControl;
|
|
19
|
+
//# sourceMappingURL=cart-control.js.map
|