@sima-land/moleculas 16.0.0-alpha.30 → 16.0.0-alpha.31
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/common/components/product-info/parts/image.d.ts +1 -1
- package/common/components/product-info/parts/image.js +2 -2
- package/common/components/product-info/parts/image.js.map +1 -1
- package/common/components/product-info/types.d.ts +3 -0
- package/desktop/components/product-carousel/product-carousel.d.ts +1 -1
- package/desktop/components/product-carousel/product-carousel.js +5 -3
- package/desktop/components/product-carousel/product-carousel.js.map +1 -1
- package/desktop/components/product-carousel/types.d.ts +5 -0
- package/package.json +1 -1
|
@@ -4,4 +4,4 @@ import { ProductInfoImageProps } from '../types';
|
|
|
4
4
|
* @param props Свойства.
|
|
5
5
|
* @return Элемент.
|
|
6
6
|
*/
|
|
7
|
-
export declare function ProductInfoImage({ images, href, children, anchorProps, sliderProps, ...restProps }: ProductInfoImageProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export declare function ProductInfoImage({ images, href, children, anchorProps, sliderProps, anchorRef, ...restProps }: ProductInfoImageProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -17,11 +17,11 @@ const image_m_scss_1 = __importDefault(require("./image.m.scss"));
|
|
|
17
17
|
* @param props Свойства.
|
|
18
18
|
* @return Элемент.
|
|
19
19
|
*/
|
|
20
|
-
function ProductInfoImage({ images = [], href, children, anchorProps, sliderProps, ...restProps }) {
|
|
20
|
+
function ProductInfoImage({ images = [], href, children, anchorProps, sliderProps, anchorRef, ...restProps }) {
|
|
21
21
|
const { restriction } = (0, react_1.useContext)(utils_1.ProductInfoContext);
|
|
22
22
|
const adult = restriction === 'adult';
|
|
23
23
|
const rootClassName = (0, classnames_1.default)(image_m_scss_1.default.link, restriction && !adult && image_m_scss_1.default.unavailable, anchorProps === null || anchorProps === void 0 ? void 0 : anchorProps.className);
|
|
24
|
-
return ((0, jsx_runtime_1.jsxs)(media_1.ProductInfoMedia, { ...restProps, children: [(0, jsx_runtime_1.jsx)("a", { ...anchorProps, "data-testid": 'product-image-link', href: adult ? undefined : href, className: rootClassName, children: images.length > 1 && !adult ? ((0, jsx_runtime_1.jsx)(hover_slider_1.HoverSlider, { withNav: !adult, ...sliderProps, className: (0, classnames_1.default)(image_m_scss_1.default.slider, sliderProps === null || sliderProps === void 0 ? void 0 : sliderProps.className), children: images.map((imageProps, index) => ((0, jsx_runtime_1.jsx)(hover_slider_1.HoverSliderItem, { children: renderImage(imageProps) }, index))) })) : (images.slice(0, 1).map(renderImage)) }), !adult && (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: children })] }));
|
|
24
|
+
return ((0, jsx_runtime_1.jsxs)(media_1.ProductInfoMedia, { ...restProps, children: [(0, jsx_runtime_1.jsx)("a", { ...anchorProps, ref: anchorRef, "data-testid": 'product-image-link', href: adult ? undefined : href, className: rootClassName, children: images.length > 1 && !adult ? ((0, jsx_runtime_1.jsx)(hover_slider_1.HoverSlider, { withNav: !adult, ...sliderProps, className: (0, classnames_1.default)(image_m_scss_1.default.slider, sliderProps === null || sliderProps === void 0 ? void 0 : sliderProps.className), children: images.map((imageProps, index) => ((0, jsx_runtime_1.jsx)(hover_slider_1.HoverSliderItem, { children: renderImage(imageProps) }, index))) })) : (images.slice(0, 1).map(renderImage)) }), !adult && (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: children })] }));
|
|
25
25
|
}
|
|
26
26
|
exports.ProductInfoImage = ProductInfoImage;
|
|
27
27
|
/** @inheritdoc */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"image.js","sourceRoot":"","sources":["../../../../../src/common/components/product-info/parts/image.tsx"],"names":[],"mappings":";;;;;;;AACA,iCAAmC;AACnC,uDAAsE;AACtE,qDAAkE;AAClE,oCAA8C;AAC9C,mCAA2C;AAC3C,4DAAoC;AACpC,kEAAoC;AAEpC;;;;GAIG;AACH,SAAgB,gBAAgB,CAAC,EAC/B,MAAM,GAAG,EAAE,EACX,IAAI,EACJ,QAAQ,EACR,WAAW,EACX,WAAW,EACX,GAAG,SAAS,EACU;IACtB,MAAM,EAAE,WAAW,EAAE,GAAG,IAAA,kBAAU,EAAC,0BAAkB,CAAC,CAAC;IAEvD,MAAM,KAAK,GAAG,WAAW,KAAK,OAAO,CAAC;IAEtC,MAAM,aAAa,GAAG,IAAA,oBAAU,EAC9B,sBAAM,CAAC,IAAI,EACX,WAAW,IAAI,CAAC,KAAK,IAAI,sBAAM,CAAC,WAAW,EAC3C,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,SAAS,CACvB,CAAC;IAEF,OAAO,CACL,wBAAC,wBAAgB,OAAK,SAAS,aAC7B,iCACM,WAAW,
|
|
1
|
+
{"version":3,"file":"image.js","sourceRoot":"","sources":["../../../../../src/common/components/product-info/parts/image.tsx"],"names":[],"mappings":";;;;;;;AACA,iCAAmC;AACnC,uDAAsE;AACtE,qDAAkE;AAClE,oCAA8C;AAC9C,mCAA2C;AAC3C,4DAAoC;AACpC,kEAAoC;AAEpC;;;;GAIG;AACH,SAAgB,gBAAgB,CAAC,EAC/B,MAAM,GAAG,EAAE,EACX,IAAI,EACJ,QAAQ,EACR,WAAW,EACX,WAAW,EACX,SAAS,EACT,GAAG,SAAS,EACU;IACtB,MAAM,EAAE,WAAW,EAAE,GAAG,IAAA,kBAAU,EAAC,0BAAkB,CAAC,CAAC;IAEvD,MAAM,KAAK,GAAG,WAAW,KAAK,OAAO,CAAC;IAEtC,MAAM,aAAa,GAAG,IAAA,oBAAU,EAC9B,sBAAM,CAAC,IAAI,EACX,WAAW,IAAI,CAAC,KAAK,IAAI,sBAAM,CAAC,WAAW,EAC3C,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,SAAS,CACvB,CAAC;IAEF,OAAO,CACL,wBAAC,wBAAgB,OAAK,SAAS,aAC7B,iCACM,WAAW,EACf,GAAG,EAAE,SAAS,iBACF,oBAAoB,EAChC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,EAC9B,SAAS,EAAE,aAAa,YAEvB,MAAM,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAC7B,uBAAC,0BAAW,IACV,OAAO,EAAE,CAAC,KAAK,KACX,WAAW,EACf,SAAS,EAAE,IAAA,oBAAU,EAAC,sBAAM,CAAC,MAAM,EAAE,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,SAAS,CAAC,YAE3D,MAAM,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,KAAK,EAAE,EAAE,CAAC,CACjC,uBAAC,8BAAe,cAAc,WAAW,CAAC,UAAU,CAAC,IAA/B,KAAK,CAA6C,CACzE,CAAC,GACU,CACf,CAAC,CAAC,CAAC,CACF,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,WAAW,CAAC,CACpC,GACC,EAGH,CAAC,KAAK,IAAI,2DAAG,QAAQ,GAAI,IACT,CACpB,CAAC;AACJ,CAAC;AA/CD,4CA+CC;AAED,kBAAkB;AAClB,SAAS,WAAW,CAAC,KAAwB,EAAE,GAAwC;IACrF,OAAO,CACL,uBAAC,4BAAY,OAAe,KAAK,EAAE,SAAS,EAAE,IAAA,oBAAU,EAAC,sBAAM,CAAC,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC,IAApE,GAAG,CAAqE,CAC5F,CAAC;AACJ,CAAC"}
|
|
@@ -26,8 +26,11 @@ export interface ProductInfoImageProps extends ProductInfoMediaProps {
|
|
|
26
26
|
href?: string;
|
|
27
27
|
/** Картинки. */
|
|
28
28
|
images?: ProductImageProps[];
|
|
29
|
+
/** Реф элемента-ссылки. */
|
|
30
|
+
anchorRef?: Ref<HTMLAnchorElement>;
|
|
29
31
|
/** Прочие атрибуты элемента-ссылки. */
|
|
30
32
|
anchorProps?: AnchorHTMLAttributes<HTMLAnchorElement>;
|
|
33
|
+
/** Свойства слайдера. */
|
|
31
34
|
sliderProps?: HoverSliderProps;
|
|
32
35
|
}
|
|
33
36
|
export interface ImageButtonProps extends Omit<StrokedSVGProps, 'component'> {
|
|
@@ -4,4 +4,4 @@ import { ProductCarouselProps } from './types';
|
|
|
4
4
|
* @param props Свойства.
|
|
5
5
|
* @return Элемент.
|
|
6
6
|
*/
|
|
7
|
-
export declare function ProductCarousel({ infinite, className, itemSize, itemProps, onInViewport, onNeedRequest, children, }: ProductCarouselProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export declare function ProductCarousel({ infinite, className, itemSize, itemProps, onInViewport, onNeedRequest, children, controlProps, itemImageRatio, }: ProductCarouselProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -29,7 +29,7 @@ const getSizeClasses = (size) => size && size !== 'unset'
|
|
|
29
29
|
* @param props Свойства.
|
|
30
30
|
* @return Элемент.
|
|
31
31
|
*/
|
|
32
|
-
function ProductCarousel({ infinite = true, className, itemSize = { xs: 4, s: 3, m: 2, l: 2, xl: 2 }, itemProps, onInViewport, onNeedRequest, children, }) {
|
|
32
|
+
function ProductCarousel({ infinite = true, className, itemSize = { xs: 4, s: 3, m: 2, l: 2, xl: 2 }, itemProps, onInViewport, onNeedRequest, children, controlProps, itemImageRatio = 1, }) {
|
|
33
33
|
const layer = (0, helpers_1.useLayer)();
|
|
34
34
|
const needBigArrows = (0, hooks_2.useMedia)('(min-width: 1600px)');
|
|
35
35
|
const rootRef = (0, react_1.useRef)(null);
|
|
@@ -58,10 +58,12 @@ function ProductCarousel({ infinite = true, className, itemSize = { xs: 4, s: 3,
|
|
|
58
58
|
size: needBigArrows ? 'l' : 's',
|
|
59
59
|
style: {
|
|
60
60
|
zIndex: layer + 2, // чтобы кнопки были над HoverCard
|
|
61
|
-
top: `${itemWidth / 2}px`,
|
|
61
|
+
top: `${(itemWidth * itemImageRatio) / 2}px`,
|
|
62
|
+
...controlProps === null || controlProps === void 0 ? void 0 : controlProps.style,
|
|
62
63
|
},
|
|
64
|
+
...controlProps,
|
|
63
65
|
}
|
|
64
|
-
:
|
|
66
|
+
: controlProps, renderItem: (item, realIndex) => ((0, jsx_runtime_1.jsx)(CarouselItem, { rootRef: realIndex === 0 ? firstItemRef : undefined, className: cx(getSizeClasses(itemSize), itemProps === null || itemProps === void 0 ? void 0 : itemProps.className), style: itemProps === null || itemProps === void 0 ? void 0 : itemProps.style, children: item })) })) }));
|
|
65
67
|
}
|
|
66
68
|
exports.ProductCarousel = ProductCarousel;
|
|
67
69
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"product-carousel.js","sourceRoot":"","sources":["../../../../src/desktop/components/product-carousel/product-carousel.tsx"],"names":[],"mappings":";;;;;;;AAAA,iCAAiG;AACjG,8DAA2D;AAC3D,iDAAuD;AACvD,wDAAyE;AACzE,0EAAwF;AACxF,4DAA0D;AAE1D,2DAAyC;AACzC,wFAA+C;AAE/C,MAAM,EAAE,GAAG,cAAU,CAAC,IAAI,CAAC,iCAAM,CAAC,CAAC;AAEnC,yCAAyC;AACzC,MAAM,cAAc,GAAG,CAAC,IAAsC,EAAE,EAAE,CAChE,IAAI,IAAI,IAAI,KAAK,OAAO;IACtB,CAAC,CAAC;QACE,WAAW,IAAI,CAAC,EAAE,IAAI,CAAC,EAAE;QACzB,UAAU,IAAI,CAAC,CAAC,IAAI,CAAC,EAAE;QACvB,UAAU,IAAI,CAAC,CAAC,IAAI,CAAC,EAAE;QACvB,UAAU,IAAI,CAAC,CAAC,IAAI,CAAC,EAAE;QACvB,WAAW,IAAI,CAAC,EAAE,IAAI,CAAC,EAAE;KAC1B;IACH,CAAC,CAAC,EAAE,CAAC;AAET;;;;GAIG;AACH,SAAgB,eAAe,CAAC,EAC9B,QAAQ,GAAG,IAAI,EACf,SAAS,EACT,QAAQ,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAC7C,SAAS,EACT,YAAY,EACZ,aAAa,EACb,QAAQ,
|
|
1
|
+
{"version":3,"file":"product-carousel.js","sourceRoot":"","sources":["../../../../src/desktop/components/product-carousel/product-carousel.tsx"],"names":[],"mappings":";;;;;;;AAAA,iCAAiG;AACjG,8DAA2D;AAC3D,iDAAuD;AACvD,wDAAyE;AACzE,0EAAwF;AACxF,4DAA0D;AAE1D,2DAAyC;AACzC,wFAA+C;AAE/C,MAAM,EAAE,GAAG,cAAU,CAAC,IAAI,CAAC,iCAAM,CAAC,CAAC;AAEnC,yCAAyC;AACzC,MAAM,cAAc,GAAG,CAAC,IAAsC,EAAE,EAAE,CAChE,IAAI,IAAI,IAAI,KAAK,OAAO;IACtB,CAAC,CAAC;QACE,WAAW,IAAI,CAAC,EAAE,IAAI,CAAC,EAAE;QACzB,UAAU,IAAI,CAAC,CAAC,IAAI,CAAC,EAAE;QACvB,UAAU,IAAI,CAAC,CAAC,IAAI,CAAC,EAAE;QACvB,UAAU,IAAI,CAAC,CAAC,IAAI,CAAC,EAAE;QACvB,WAAW,IAAI,CAAC,EAAE,IAAI,CAAC,EAAE;KAC1B;IACH,CAAC,CAAC,EAAE,CAAC;AAET;;;;GAIG;AACH,SAAgB,eAAe,CAAC,EAC9B,QAAQ,GAAG,IAAI,EACf,SAAS,EACT,QAAQ,GAAG,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAC7C,SAAS,EACT,YAAY,EACZ,aAAa,EACb,QAAQ,EACR,YAAY,EACZ,cAAc,GAAG,CAAC,GACG;IACrB,MAAM,KAAK,GAAG,IAAA,kBAAQ,GAAE,CAAC;IACzB,MAAM,aAAa,GAAG,IAAA,gBAAQ,EAAC,qBAAqB,CAAC,CAAC;IACtD,MAAM,OAAO,GAAG,IAAA,cAAM,EAAiB,IAAI,CAAC,CAAC;IAE7C,MAAM,KAAK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selProps } from '@sima-land/ui-nucleons/carousel';
|
|
2
3
|
export interface ItemSize {
|
|
3
4
|
xs?: 2 | 3 | 4;
|
|
4
5
|
s?: 2 | 3 | 4;
|
|
@@ -24,6 +25,10 @@ export interface ProductCarouselProps {
|
|
|
24
25
|
};
|
|
25
26
|
/** Активирует "бесконечную" прокрутку карусели. */
|
|
26
27
|
infinite?: boolean;
|
|
28
|
+
/** Свойства стрелок. */
|
|
29
|
+
controlProps?: CarouselProps['controlProps'];
|
|
30
|
+
/** Отношение высоты картинки товара к ее ширине. Нужно для позиционирования стрелок. */
|
|
31
|
+
itemImageRatio?: number;
|
|
27
32
|
}
|
|
28
33
|
export interface HoverCardProps {
|
|
29
34
|
targetRef: RefObject<HTMLElement | null>;
|
package/package.json
CHANGED