@sima-land/moleculas 12.3.3 → 13.1.2
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/adult-block/{adult-block.d.ts → index.d.ts} +1 -2
- package/common/components/adult-block/{adult-block.js → index.js} +2 -1
- package/common/components/badge-list/badge-list.module.scss +0 -1
- package/common/components/badge-list/index.d.ts +2 -6
- package/common/components/badge-list/index.js +26 -5
- package/common/components/product-info/index.d.ts +11 -49
- package/common/components/product-info/index.js +24 -35
- package/common/components/product-info/parts.d.ts +41 -0
- package/common/components/product-info/parts.js +176 -0
- package/common/components/product-info/product-info.module.scss +159 -28
- package/common/components/product-info/types.d.ts +5 -0
- package/common/components/product-info/types.js +2 -0
- package/common/components/product-info/utils.d.ts +3 -0
- package/{mobile/components/product-slider → common/components/product-info}/utils.js +2 -2
- package/common/icons/eighteen-plus.svg +3 -1
- package/desktop/components/item-image/index.d.ts +1 -1
- package/desktop/components/item-image/index.js +5 -3
- package/desktop/components/person-modal/index.d.ts +0 -1
- package/desktop/components/person-modal/index.js +0 -1
- package/desktop/components/product-card/index.d.ts +11 -24
- package/desktop/components/product-card/index.js +47 -31
- package/desktop/components/product-card/product-card.module.scss +7 -48
- package/desktop/components/product-carousel/hover-card.d.ts +1 -4
- package/desktop/components/product-carousel/hover-card.js +18 -6
- package/desktop/components/product-carousel/index.d.ts +5 -9
- package/desktop/components/product-carousel/index.js +28 -25
- package/desktop/components/product-carousel/utils.js +4 -1
- package/mobile/components/garland-calculator-button/garland-calculator-button.module.scss +32 -3
- package/mobile/components/garland-calculator-button/index.d.ts +2 -3
- package/mobile/components/garland-calculator-button/index.js +9 -14
- package/mobile/components/item-image/index.d.ts +4 -4
- package/mobile/components/item-image/index.js +9 -10
- package/mobile/components/person-screen/index.d.ts +3 -3
- package/mobile/components/person-screen/index.js +16 -14
- package/mobile/components/product-actions-alert/index.d.ts +2 -5
- package/mobile/components/product-actions-alert/index.js +2 -5
- package/mobile/components/product-slider/index.d.ts +6 -9
- package/mobile/components/product-slider/index.js +14 -11
- package/mobile/components/product-slider/{item.module.scss → product-slider.module.scss} +1 -12
- package/mobile/components/pseudo-input/index.d.ts +5 -8
- package/mobile/components/pseudo-input/index.js +21 -10
- package/mobile/components/pseudo-input/pseudo-input.module.scss +6 -9
- package/mobile/components/select-screen/index.d.ts +11 -2
- package/mobile/components/select-screen/index.js +46 -12
- package/mobile/components/select-screen/select-screen.module.scss +3 -1
- package/package.json +3 -3
- package/common/__fixtures__/list-item.d.ts +0 -53
- package/common/__fixtures__/list-item.js +0 -107
- package/common/helpers/get-contained-items.d.ts +0 -7
- package/common/helpers/get-contained-items.js +0 -18
- package/common/icons/filled-rate.svg +0 -3
- package/common/icons/full-left-arrow.svg +0 -1
- package/common/icons/full-right-arrow.svg +0 -1
- package/common/icons/grid-small.svg +0 -11
- package/common/icons/grid.svg +0 -6
- package/common/icons/list.svg +0 -5
- package/common/icons/page.svg +0 -1
- package/common/icons/step-arrows.svg +0 -4
- package/common/icons/triple-dots.svg +0 -3
- package/common/icons/white-spinner.svg +0 -3
- package/desktop/components/breadcrumbs/items.d.ts +0 -3
- package/desktop/components/breadcrumbs/items.js +0 -157
- package/mobile/components/garland-calculator-button/tree-in-circle.svg +0 -6
- package/mobile/components/product-slider/item.d.ts +0 -18
- package/mobile/components/product-slider/item.js +0 -58
- package/mobile/components/product-slider/utils.d.ts +0 -4
|
@@ -31,6 +31,7 @@ const media_1 = require("@sima-land/ui-nucleons/hooks/media");
|
|
|
31
31
|
const product_info_1 = require("../../../common/components/product-info");
|
|
32
32
|
const bind_1 = __importDefault(require("classnames/bind"));
|
|
33
33
|
const product_carousel_module_scss_1 = __importDefault(require("./product-carousel.module.scss"));
|
|
34
|
+
const layer_1 = require("@sima-land/ui-nucleons/helpers/layer");
|
|
34
35
|
const cx = bind_1.default.bind(product_carousel_module_scss_1.default);
|
|
35
36
|
const getSizeClasses = (size = {}) => [
|
|
36
37
|
`size-xs-${size.xs || 4}`,
|
|
@@ -39,45 +40,42 @@ const getSizeClasses = (size = {}) => [
|
|
|
39
40
|
`size-l-${size.l || 2}`,
|
|
40
41
|
`size-xl-${size.xl || 2}`,
|
|
41
42
|
];
|
|
42
|
-
/**
|
|
43
|
-
* Компонент для проброса данных элемента карусели в компонент карусели.
|
|
44
|
-
* Экспериментальный вариант.
|
|
45
|
-
* @return Null.
|
|
46
|
-
*/
|
|
47
|
-
const Item = () => null;
|
|
48
43
|
/**
|
|
49
44
|
* Карусель рекомендованных товаров.
|
|
50
45
|
* @param props Свойства.
|
|
51
46
|
* @return Элемент.
|
|
52
47
|
*/
|
|
53
48
|
const ProductCarousel = ({ className, itemSize, onInViewport, onNeedRequest, withHoverCard, children, }) => {
|
|
49
|
+
const layer = (0, layer_1.useLayer)();
|
|
54
50
|
const [activeItemIndex, setActiveItemIndex] = (0, react_1.useState)(null);
|
|
55
51
|
const cardShow = (0, utils_1.useAllowFlag)();
|
|
56
52
|
const needBigArrows = (0, media_1.useMedia)('(min-width: 1600px)');
|
|
57
|
-
const
|
|
58
|
-
const stubRef = (0, react_1.useRef)(null);
|
|
53
|
+
const rootRef = (0, react_1.useRef)(null);
|
|
59
54
|
const targetItemRef = (0, react_1.useRef)(null);
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}
|
|
55
|
+
let items;
|
|
56
|
+
if (Array.isArray(children)) {
|
|
57
|
+
items = children;
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
items = children ? [children] : [];
|
|
61
|
+
}
|
|
64
62
|
// вычисляем ширину элемента карусели для позиционирования стрелок
|
|
65
|
-
const itemWidth = (0, utils_1.useChildWidth)(
|
|
63
|
+
const itemWidth = (0, utils_1.useChildWidth)(rootRef, `.${cx('item')}`, [items.length]);
|
|
66
64
|
// инициируем загрузку данных, когда компонент почти попал в зону видимости
|
|
67
|
-
(0, utils_1.useViewport)(
|
|
65
|
+
(0, utils_1.useViewport)(rootRef, onNeedRequest, {
|
|
68
66
|
rootMargin: '200px 0px 200px 0px',
|
|
69
67
|
});
|
|
70
68
|
// отправляем статистку, когда компонент попадает в зону видимости
|
|
71
|
-
(0, utils_1.useViewport)(
|
|
72
|
-
return
|
|
73
|
-
react_1.default.createElement(carousel_1.Carousel, Object.assign({ step: 3, draggable: false,
|
|
69
|
+
(0, utils_1.useViewport)(rootRef, onInViewport);
|
|
70
|
+
return (react_1.default.createElement("div", { ref: rootRef, className: cx('root', className) },
|
|
71
|
+
items.length > 0 && (react_1.default.createElement(carousel_1.Carousel, Object.assign({ step: 3, draggable: false,
|
|
74
72
|
// докидываем индекс чтобы позже брать актуальные данные из списка по нему
|
|
75
73
|
items: items.map((item, index) => [item, index]) }, (itemWidth !== null && {
|
|
76
74
|
withControls: true,
|
|
77
75
|
controlProps: {
|
|
78
76
|
size: needBigArrows ? 'l' : 's',
|
|
79
77
|
style: {
|
|
80
|
-
zIndex:
|
|
78
|
+
zIndex: layer + 2,
|
|
81
79
|
top: `${itemWidth / 2}px`,
|
|
82
80
|
},
|
|
83
81
|
},
|
|
@@ -86,16 +84,21 @@ const ProductCarousel = ({ className, itemSize, onInViewport, onNeedRequest, wit
|
|
|
86
84
|
targetItemRef.current = e.currentTarget;
|
|
87
85
|
setActiveItemIndex(index);
|
|
88
86
|
}
|
|
89
|
-
} },
|
|
90
|
-
react_1.
|
|
87
|
+
} }, (0, react_1.cloneElement)(item, {
|
|
88
|
+
children: react_1.Children.toArray(item.props.children).reduce((list, child) => {
|
|
89
|
+
if ((0, react_1.isValidElement)(child)) {
|
|
90
|
+
child.type === product_info_1.Parts.Image &&
|
|
91
|
+
list.push(withHoverCard ? (0, react_1.cloneElement)(child, { children: undefined }) : child);
|
|
92
|
+
child.type !== product_info_1.Parts.Footer && list.push(child);
|
|
93
|
+
}
|
|
94
|
+
return list;
|
|
95
|
+
}, []),
|
|
96
|
+
}))),
|
|
91
97
|
// длительность прокрутки в Carousel - 320, делаем слегка с запасом
|
|
92
98
|
// @todo после восстановления проверить позицию курсора чтобы показать карточку (если будет критично)
|
|
93
|
-
onChangeTargetIndex: () => cardShow.disallowFor(360) })),
|
|
99
|
+
onChangeTargetIndex: () => cardShow.disallowFor(360) }))),
|
|
94
100
|
withHoverCard &&
|
|
95
101
|
activeItemIndex !== null &&
|
|
96
|
-
[items[activeItemIndex]].map(item => (react_1.default.createElement(hover_card_1.HoverCard, { key: activeItemIndex, targetRef: targetItemRef, onMouseLeave: () => setActiveItemIndex(null),
|
|
97
|
-
// данные элемента карусели
|
|
98
|
-
data: item.data, onLinkClick: item.onLinkClick, onQuickViewClick: item.onQuickViewClick, renderCartControl: item.renderCartControl }))))) : (react_1.default.createElement("div", { ref: stubRef }));
|
|
102
|
+
[items[activeItemIndex]].map(item => (react_1.default.createElement(hover_card_1.HoverCard, Object.assign({ key: activeItemIndex, targetRef: targetItemRef, onMouseLeave: () => setActiveItemIndex(null) }, item.props))))));
|
|
99
103
|
};
|
|
100
104
|
exports.ProductCarousel = ProductCarousel;
|
|
101
|
-
exports.ProductCarousel.Item = Item;
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.useChildWidth = exports.useAllowFlag = exports.useViewport = void 0;
|
|
7
7
|
const react_1 = require("react");
|
|
8
8
|
const on_1 = __importDefault(require("@sima-land/ui-nucleons/helpers/on"));
|
|
9
|
+
const identity_1 = require("@sima-land/ui-nucleons/hooks/identity");
|
|
9
10
|
/**
|
|
10
11
|
* Вызывает callback когда заданный в ref элемент попал во viewport.
|
|
11
12
|
* @param ref Ref отслеживаемого элемента.
|
|
@@ -13,12 +14,14 @@ const on_1 = __importDefault(require("@sima-land/ui-nucleons/helpers/on"));
|
|
|
13
14
|
* @param options Опции IntersectionObserver.
|
|
14
15
|
*/
|
|
15
16
|
const useViewport = (ref, callback, options) => {
|
|
17
|
+
const callbackRef = (0, identity_1.useIdentityRef)(callback);
|
|
16
18
|
(0, react_1.useEffect)(() => {
|
|
17
19
|
const element = ref.current;
|
|
18
20
|
if (element) {
|
|
19
21
|
const observer = new IntersectionObserver(entries => {
|
|
22
|
+
const fn = callbackRef.current;
|
|
20
23
|
for (const entry of entries) {
|
|
21
|
-
entry.target === element && entry.isIntersecting &&
|
|
24
|
+
entry.target === element && entry.isIntersecting && fn && fn();
|
|
22
25
|
break;
|
|
23
26
|
}
|
|
24
27
|
}, options);
|
|
@@ -1,4 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
@use 'node_modules/@sima-land/ui-nucleons/colors';
|
|
2
|
+
|
|
3
|
+
.root {
|
|
4
|
+
padding: 24px;
|
|
5
|
+
display: flex;
|
|
6
|
+
justify-content: space-between;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.main {
|
|
10
|
+
margin-right: 20px;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.text {
|
|
14
|
+
font-size: 14px;
|
|
15
|
+
line-height: 20px;
|
|
16
|
+
margin-bottom: 12px;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.icon {
|
|
20
|
+
flex-shrink: 0;
|
|
21
|
+
width: 48px;
|
|
22
|
+
height: 48px;
|
|
23
|
+
display: flex;
|
|
24
|
+
align-items: center;
|
|
25
|
+
justify-content: center;
|
|
26
|
+
background: rgba(colors.$additional-amber, 0.5);
|
|
27
|
+
border-radius: 50%;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.svg {
|
|
31
|
+
display: block;
|
|
32
|
+
fill: #fff;
|
|
4
33
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
export interface GarlandCalculatorButtonProps {
|
|
3
|
-
/** Обработчик
|
|
4
|
-
onClick?: React.MouseEventHandler
|
|
3
|
+
/** Обработчик клика. */
|
|
4
|
+
onClick?: React.MouseEventHandler<HTMLAnchorElement>;
|
|
5
5
|
/** CSS-класс. */
|
|
6
6
|
className?: string;
|
|
7
7
|
}
|
|
@@ -11,4 +11,3 @@ export interface GarlandCalculatorButtonProps {
|
|
|
11
11
|
* @return Элемент.
|
|
12
12
|
*/
|
|
13
13
|
export declare const GarlandCalculatorButton: ({ className, onClick }: GarlandCalculatorButtonProps) => JSX.Element;
|
|
14
|
-
export default GarlandCalculatorButton;
|
|
@@ -5,25 +5,20 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.GarlandCalculatorButton = void 0;
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
|
-
const box_1 = require("@sima-land/ui-nucleons/box");
|
|
9
|
-
const text_1 = require("@sima-land/ui-nucleons/text");
|
|
10
8
|
const link_1 = require("@sima-land/ui-nucleons/link");
|
|
11
|
-
const
|
|
12
|
-
const
|
|
9
|
+
const plate_1 = require("@sima-land/ui-nucleons/plate");
|
|
10
|
+
const spruce_1 = __importDefault(require("@sima-land/ui-quarks/icons/24x24/Stroked/spruce"));
|
|
11
|
+
const classnames_1 = __importDefault(require("classnames"));
|
|
13
12
|
const garland_calculator_button_module_scss_1 = __importDefault(require("./garland-calculator-button.module.scss"));
|
|
14
|
-
const cx = bind_1.default.bind(garland_calculator_button_module_scss_1.default);
|
|
15
13
|
/**
|
|
16
14
|
* Компонент плашки с кнопкой открытия гирлянды.
|
|
17
15
|
* @param props Свойства компонента.
|
|
18
16
|
* @return Элемент.
|
|
19
17
|
*/
|
|
20
|
-
const GarlandCalculatorButton = ({ className, onClick }) => (react_1.default.createElement(
|
|
21
|
-
react_1.default.createElement(
|
|
22
|
-
react_1.default.createElement(
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
react_1.default.createElement(box_1.Box, { flex: 'none' },
|
|
27
|
-
react_1.default.createElement(tree_in_circle_svg_1.default, { width: 48, height: 48 })))));
|
|
18
|
+
const GarlandCalculatorButton = ({ className, onClick }) => (react_1.default.createElement(plate_1.Plate, { rounds: 'm', shadow: 'z3', className: (0, classnames_1.default)(garland_calculator_button_module_scss_1.default.root, className) },
|
|
19
|
+
react_1.default.createElement("div", { className: garland_calculator_button_module_scss_1.default.main },
|
|
20
|
+
react_1.default.createElement("div", { className: garland_calculator_button_module_scss_1.default.text }, "\u0421\u043A\u043E\u043B\u044C\u043A\u043E \u043C\u0435\u0442\u0440\u043E\u0432 \u0433\u0438\u0440\u043B\u044F\u043D\u0434\u044B \u043F\u043E\u043A\u0443\u043F\u0430\u0442\u044C? \u041F\u043E\u043C\u043E\u0436\u0435\u043C \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u0430\u0442\u044C \u043E\u043F\u0442\u0438\u043C\u0430\u043B\u044C\u043D\u0443\u044E \u0434\u043B\u0438\u043D\u0443"),
|
|
21
|
+
react_1.default.createElement(link_1.Link, { pseudo: true, onClick: onClick }, "\u0420\u0430\u0441\u0441\u0447\u0438\u0442\u0430\u0442\u044C")),
|
|
22
|
+
react_1.default.createElement("div", { className: garland_calculator_button_module_scss_1.default.icon },
|
|
23
|
+
react_1.default.createElement(spruce_1.default, { className: garland_calculator_button_module_scss_1.default.svg }))));
|
|
28
24
|
exports.GarlandCalculatorButton = GarlandCalculatorButton;
|
|
29
|
-
exports.default = exports.GarlandCalculatorButton;
|
|
@@ -10,12 +10,12 @@ export interface ItemImageProps {
|
|
|
10
10
|
onClick?: React.MouseEventHandler;
|
|
11
11
|
};
|
|
12
12
|
className?: string;
|
|
13
|
-
onClick
|
|
14
|
-
badges
|
|
13
|
+
onClick?: React.MouseEventHandler;
|
|
14
|
+
badges?: BadgeProps[];
|
|
15
15
|
withBlur?: boolean;
|
|
16
16
|
itemUrl?: string;
|
|
17
17
|
isFetchingWishItems?: boolean;
|
|
18
|
-
onLoadImage
|
|
18
|
+
onLoadImage?: (duration: number) => void;
|
|
19
19
|
}
|
|
20
20
|
/**
|
|
21
21
|
* Компонент изображения товара с избранным.
|
|
@@ -29,7 +29,7 @@ export interface ItemImageProps {
|
|
|
29
29
|
* @param props.withBlur Добавление блюра.
|
|
30
30
|
* @param props.isFetchingWishItems Признак загрузки добавления товара в список избранного.
|
|
31
31
|
*/
|
|
32
|
-
export
|
|
32
|
+
export declare class ItemImage extends Component<ItemImageProps> {
|
|
33
33
|
bootStartTime: number;
|
|
34
34
|
image: any;
|
|
35
35
|
/**
|
|
@@ -22,14 +22,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
22
22
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
23
|
};
|
|
24
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
exports.ItemImage = void 0;
|
|
25
26
|
const react_1 = __importStar(require("react"));
|
|
26
27
|
const link_1 = require("@sima-land/ui-nucleons/link");
|
|
27
|
-
const lodash_1 = require("lodash");
|
|
28
|
-
const item_image_module_scss_1 = __importDefault(require("./item-image.module.scss"));
|
|
29
|
-
const bind_1 = __importDefault(require("classnames/bind"));
|
|
30
28
|
const badge_list_1 = require("../../../common/components/badge-list");
|
|
31
|
-
const
|
|
29
|
+
const badge_1 = require("../../../common/components/badge");
|
|
32
30
|
const wish_button_1 = require("../../../common/components/wish-button");
|
|
31
|
+
const eighteen_plus_svg_1 = __importDefault(require("../../../common/icons/eighteen-plus.svg"));
|
|
32
|
+
const bind_1 = __importDefault(require("classnames/bind"));
|
|
33
|
+
const item_image_module_scss_1 = __importDefault(require("./item-image.module.scss"));
|
|
33
34
|
const cx = bind_1.default.bind(item_image_module_scss_1.default);
|
|
34
35
|
/**
|
|
35
36
|
* Компонент изображения товара с избранным.
|
|
@@ -67,9 +68,7 @@ class ItemImage extends react_1.Component {
|
|
|
67
68
|
componentDidMount() {
|
|
68
69
|
const img = this.image.current;
|
|
69
70
|
const { onLoadImage } = this.props;
|
|
70
|
-
|
|
71
|
-
onLoadImage(Date.now() - this.bootStartTime);
|
|
72
|
-
}
|
|
71
|
+
img && img.complete && (onLoadImage === null || onLoadImage === void 0 ? void 0 : onLoadImage(Date.now() - this.bootStartTime));
|
|
73
72
|
}
|
|
74
73
|
/**
|
|
75
74
|
* @inheritdoc
|
|
@@ -78,12 +77,12 @@ class ItemImage extends react_1.Component {
|
|
|
78
77
|
const { src, alt, hasWishButton, wishProps, className, onClick, badges, withBlur, itemUrl, isFetchingWishItems, } = this.props;
|
|
79
78
|
return (react_1.default.createElement("div", { className: cx('wrapper', className) },
|
|
80
79
|
withBlur && (react_1.default.createElement("div", { className: cx('with-blur') },
|
|
81
|
-
react_1.default.createElement(eighteen_plus_svg_1.default, { width: 124, height: 124 }))),
|
|
80
|
+
react_1.default.createElement(eighteen_plus_svg_1.default, { width: 124, height: 124, opacity: '0.3' }))),
|
|
82
81
|
react_1.default.createElement("div", { className: cx('image-wrapper') },
|
|
83
82
|
react_1.default.createElement(link_1.Link, { href: itemUrl }, withBlur ? (react_1.default.createElement("div", { className: cx('with-filter-blur'), children: this.getImage({ src, alt }, onClick) })) : (this.getImage({ src, alt }, onClick)))),
|
|
84
83
|
Array.isArray(badges) && Boolean(badges.length) && !withBlur && (react_1.default.createElement("div", { className: cx('badges') },
|
|
85
|
-
react_1.default.createElement(badge_list_1.BadgeList, {
|
|
84
|
+
react_1.default.createElement(badge_list_1.BadgeList, null, badges.map((badge, index) => (react_1.default.createElement(badge_1.Badge, Object.assign({ key: index }, badge))))))),
|
|
86
85
|
hasWishButton && (react_1.default.createElement(wish_button_1.WishButton, { checked: wishProps === null || wishProps === void 0 ? void 0 : wishProps.isWished, className: wishProps === null || wishProps === void 0 ? void 0 : wishProps.className, onClick: wishProps === null || wishProps === void 0 ? void 0 : wishProps.onClick, disabled: isFetchingWishItems }))));
|
|
87
86
|
}
|
|
88
87
|
}
|
|
89
|
-
exports.
|
|
88
|
+
exports.ItemImage = ItemImage;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
3
|
-
export interface PersonScreenProps extends ScreenProps {
|
|
2
|
+
export interface PersonScreenProps {
|
|
4
3
|
name?: string;
|
|
5
4
|
appointment?: string;
|
|
6
5
|
photoUrl?: string;
|
|
@@ -11,6 +10,7 @@ export interface PersonScreenProps extends ScreenProps {
|
|
|
11
10
|
secondPhoneHref?: string;
|
|
12
11
|
secondPhoneText?: string;
|
|
13
12
|
arbitraryLinkProps?: React.AnchorHTMLAttributes<HTMLAnchorElement>;
|
|
13
|
+
onClose?: () => void;
|
|
14
14
|
}
|
|
15
15
|
/**
|
|
16
16
|
* Компонент экрана персональных данных.
|
|
@@ -27,7 +27,7 @@ export interface PersonScreenProps extends ScreenProps {
|
|
|
27
27
|
* @param props.arbitraryLinkProps Свойства произвольной ссылки.
|
|
28
28
|
* @return Элемент.
|
|
29
29
|
*/
|
|
30
|
-
export declare const PersonScreen: ({ name, appointment, photoUrl, email, skype, phoneHref, phoneText, secondPhoneHref, secondPhoneText, arbitraryLinkProps, ...screenProps }: PersonScreenProps) => JSX.Element;
|
|
30
|
+
export declare const PersonScreen: ({ name, appointment, photoUrl, email, skype, phoneHref, phoneText, secondPhoneHref, secondPhoneText, arbitraryLinkProps, onClose, ...screenProps }: PersonScreenProps) => JSX.Element;
|
|
31
31
|
/**
|
|
32
32
|
* Компонент блока-ссылки для связи.
|
|
33
33
|
* @param props Свойства.
|
|
@@ -44,20 +44,22 @@ const cx = bind_1.default.bind(person_screen_module_scss_1.default);
|
|
|
44
44
|
* @return Элемент.
|
|
45
45
|
*/
|
|
46
46
|
const PersonScreen = (_a) => {
|
|
47
|
-
var { name, appointment, photoUrl, email, skype, phoneHref, phoneText, secondPhoneHref, secondPhoneText, arbitraryLinkProps } = _a, screenProps = __rest(_a, ["name", "appointment", "photoUrl", "email", "skype", "phoneHref", "phoneText", "secondPhoneHref", "secondPhoneText", "arbitraryLinkProps"]);
|
|
48
|
-
return (react_1.default.createElement(screen_1.Screen, Object.assign({}, screenProps
|
|
49
|
-
react_1.default.createElement(
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
47
|
+
var { name, appointment, photoUrl, email, skype, phoneHref, phoneText, secondPhoneHref, secondPhoneText, arbitraryLinkProps, onClose } = _a, screenProps = __rest(_a, ["name", "appointment", "photoUrl", "email", "skype", "phoneHref", "phoneText", "secondPhoneHref", "secondPhoneText", "arbitraryLinkProps", "onClose"]);
|
|
48
|
+
return (react_1.default.createElement(screen_1.Screen, Object.assign({}, screenProps),
|
|
49
|
+
react_1.default.createElement(screen_1.Screen.Header, { onClose: onClose }),
|
|
50
|
+
react_1.default.createElement(screen_1.Screen.Body, null,
|
|
51
|
+
react_1.default.createElement("div", { className: cx('avatar', 'small') },
|
|
52
|
+
react_1.default.createElement(user_1.UserAvatar, { size: 64, title: name, imageUrl: photoUrl })),
|
|
53
|
+
react_1.default.createElement("div", { className: cx('avatar', 'big') },
|
|
54
|
+
react_1.default.createElement(user_1.UserAvatar, { size: 104, title: name, imageUrl: photoUrl })),
|
|
55
|
+
react_1.default.createElement("span", { className: cx('name') }, name),
|
|
56
|
+
Boolean(appointment) && react_1.default.createElement("span", { className: cx('appointment') }, appointment),
|
|
57
|
+
arbitraryLinkProps && (react_1.default.createElement("div", { className: cx('profile-url'), children: react_1.default.createElement("a", Object.assign({ className: cx('link') }, arbitraryLinkProps)) })),
|
|
58
|
+
react_1.default.createElement("div", { className: cx('items', borders_1.InnerBorder.bottom) },
|
|
59
|
+
Boolean(email) && (react_1.default.createElement(exports.CommunicateLink, { href: `mailto:${email}`, primaryText: email, secondaryText: '\u042D\u043B\u0435\u043A\u0442\u0440\u043E\u043D\u043D\u0430\u044F \u043F\u043E\u0447\u0442\u0430', icon: react_1.default.createElement(mail_1.default, null) })),
|
|
60
|
+
Boolean(skype) && (react_1.default.createElement(exports.CommunicateLink, { href: `skype:${skype}?chat`, primaryText: skype, secondaryText: 'Skype', icon: react_1.default.createElement(skype_1.default, null) })),
|
|
61
|
+
Boolean(phoneText) && (react_1.default.createElement(exports.CommunicateLink, { href: phoneHref || undefined, primaryText: phoneText, secondaryText: '\u0420\u0430\u0431\u043E\u0447\u0438\u0439', icon: react_1.default.createElement(phone_1.default, null) })),
|
|
62
|
+
Boolean(secondPhoneText) && (react_1.default.createElement(exports.CommunicateLink, { href: secondPhoneHref || undefined, primaryText: secondPhoneText, secondaryText: '\u0421\u043E\u0442\u043E\u0432\u044B\u0439', icon: react_1.default.createElement(mobile_1.default, null) }))))));
|
|
61
63
|
};
|
|
62
64
|
exports.PersonScreen = PersonScreen;
|
|
63
65
|
/**
|
|
@@ -11,11 +11,8 @@ export interface ProductActionsAlertProps {
|
|
|
11
11
|
onClose?: React.MouseEventHandler;
|
|
12
12
|
}
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
15
|
-
* @param props
|
|
16
|
-
* @param props.buttons Конфигурация кнопок.
|
|
17
|
-
* @param props.alertProps Свойства компонента Alert.
|
|
18
|
-
* @param props.onClose Обработчик закрытия.
|
|
14
|
+
* Alert действий с товаром.
|
|
15
|
+
* @param props Свойства.
|
|
19
16
|
* @return Элемент.
|
|
20
17
|
*/
|
|
21
18
|
export declare const ProductActionsAlert: ({ buttons, alertProps, onClose }: ProductActionsAlertProps) => JSX.Element;
|
|
@@ -12,11 +12,8 @@ const bind_1 = __importDefault(require("classnames/bind"));
|
|
|
12
12
|
const product_actions_alert_module_scss_1 = __importDefault(require("./product-actions-alert.module.scss"));
|
|
13
13
|
const cx = bind_1.default.bind(product_actions_alert_module_scss_1.default);
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
16
|
-
* @param props
|
|
17
|
-
* @param props.buttons Конфигурация кнопок.
|
|
18
|
-
* @param props.alertProps Свойства компонента Alert.
|
|
19
|
-
* @param props.onClose Обработчик закрытия.
|
|
15
|
+
* Alert действий с товаром.
|
|
16
|
+
* @param props Свойства.
|
|
20
17
|
* @return Элемент.
|
|
21
18
|
*/
|
|
22
19
|
const ProductActionsAlert = ({ buttons, alertProps, onClose }) => (react_1.default.createElement(alert_1.Alert, Object.assign({}, alertProps, { footer: react_1.default.createElement(clean_buttons_1.Clean.Group, null,
|
|
@@ -1,20 +1,17 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { ProductInfo, ProductInfoProps } from '../../../common/components/product-info';
|
|
3
|
+
export declare type ItemElement = React.ReactElement<ProductInfoProps, typeof ProductInfo>;
|
|
3
4
|
export interface ProductSliderProps {
|
|
4
5
|
/** Товары. */
|
|
5
|
-
children?:
|
|
6
|
+
children?: ItemElement | ItemElement[];
|
|
6
7
|
/** Функция, вызываемая при попадании компонента в поле видимости. */
|
|
7
8
|
onInViewport?: () => void;
|
|
8
9
|
/** Функция, инициализирующая загрузку рекомендаций. */
|
|
9
10
|
onNeedRequest?: () => void;
|
|
10
11
|
}
|
|
11
|
-
export interface ProductSliderComponent {
|
|
12
|
-
(props: ProductSliderProps): JSX.Element;
|
|
13
|
-
Item: typeof ProductSliderItem;
|
|
14
|
-
}
|
|
15
12
|
/**
|
|
16
|
-
*
|
|
17
|
-
* @param props
|
|
13
|
+
* Слайдер товаров.
|
|
14
|
+
* @param props Свойства.
|
|
18
15
|
* @return Элемент.
|
|
19
16
|
*/
|
|
20
|
-
export declare const ProductSlider:
|
|
17
|
+
export declare const ProductSlider: ({ children, onInViewport, onNeedRequest }: ProductSliderProps) => JSX.Element;
|
|
@@ -18,32 +18,35 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
18
18
|
__setModuleDefault(result, mod);
|
|
19
19
|
return result;
|
|
20
20
|
};
|
|
21
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
22
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
|
+
};
|
|
21
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
25
|
exports.ProductSlider = void 0;
|
|
23
26
|
const react_1 = __importStar(require("react"));
|
|
24
27
|
const utils_1 = require("../../../desktop/components/product-carousel/utils");
|
|
25
|
-
const item_1 = require("./item");
|
|
26
28
|
const touch_slider_1 = require("@sima-land/ui-nucleons/touch-slider");
|
|
27
|
-
const
|
|
29
|
+
const product_info_1 = require("../../../common/components/product-info");
|
|
30
|
+
const product_slider_module_scss_1 = __importDefault(require("./product-slider.module.scss"));
|
|
28
31
|
/**
|
|
29
|
-
*
|
|
30
|
-
* @param props
|
|
32
|
+
* Слайдер товаров.
|
|
33
|
+
* @param props Свойства.
|
|
31
34
|
* @return Элемент.
|
|
32
35
|
*/
|
|
33
|
-
const ProductSlider = ({ children, onInViewport, onNeedRequest
|
|
36
|
+
const ProductSlider = ({ children, onInViewport, onNeedRequest }) => {
|
|
34
37
|
const rootRef = (0, react_1.useRef)(null);
|
|
35
|
-
const [mounted, setMounted] = (0, react_1.useState)(false);
|
|
36
38
|
// инициируем загрузку данных, когда компонент почти попал в зону видимости
|
|
37
39
|
(0, utils_1.useViewport)(rootRef, onNeedRequest, {
|
|
38
40
|
rootMargin: '200px 0px 200px 0px',
|
|
39
41
|
});
|
|
40
42
|
// сообщаем, когда компонент попадет в зону видимости
|
|
41
43
|
(0, utils_1.useViewport)(rootRef, onInViewport);
|
|
42
|
-
// разрешаем загружать картинки только после монтирования
|
|
43
|
-
(0, react_1.useEffect)(() => setMounted(true), []);
|
|
44
44
|
return (react_1.default.createElement("div", { ref: rootRef },
|
|
45
|
-
react_1.default.createElement(touch_slider_1.TouchSlider, null,
|
|
46
|
-
|
|
45
|
+
react_1.default.createElement(touch_slider_1.TouchSlider, null, react_1.Children.toArray(children).reduce((list, item) => {
|
|
46
|
+
(0, react_1.isValidElement)(item) &&
|
|
47
|
+
item.type === product_info_1.ProductInfo &&
|
|
48
|
+
list.push(react_1.default.createElement("div", { key: item.key, className: product_slider_module_scss_1.default.item }, item));
|
|
49
|
+
return list;
|
|
50
|
+
}, []))));
|
|
47
51
|
};
|
|
48
52
|
exports.ProductSlider = ProductSlider;
|
|
49
|
-
exports.ProductSlider.Item = item_1.ProductSliderItem;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
@use 'sass:math';
|
|
2
1
|
@use 'node_modules/@sima-land/ui-nucleons/breakpoints';
|
|
3
2
|
|
|
4
|
-
.
|
|
3
|
+
.item {
|
|
5
4
|
position: relative;
|
|
6
5
|
flex-shrink: 0;
|
|
7
6
|
width: 160px;
|
|
@@ -12,13 +11,3 @@
|
|
|
12
11
|
margin-right: 16px;
|
|
13
12
|
}
|
|
14
13
|
}
|
|
15
|
-
|
|
16
|
-
.favorite-button {
|
|
17
|
-
position: absolute;
|
|
18
|
-
top: 4px;
|
|
19
|
-
right: 4px;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
.footer {
|
|
23
|
-
margin-top: 12px;
|
|
24
|
-
}
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
export interface
|
|
2
|
+
export interface PseudoInputProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
3
|
+
/** Текст, введенный в поле. */
|
|
3
4
|
text?: string;
|
|
4
|
-
onClick?: React.MouseEventHandler<HTMLDivElement>;
|
|
5
5
|
}
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
8
|
-
* @param props
|
|
9
|
-
* @param props.text Текст подсказки.
|
|
10
|
-
* @param props.onClick Обработчик клика.
|
|
7
|
+
* Псевдо-поле поиска.
|
|
8
|
+
* @param props Свойства.
|
|
11
9
|
* @return Элемент.
|
|
12
10
|
*/
|
|
13
|
-
declare const PseudoInput: ({ text,
|
|
14
|
-
export default PseudoInput;
|
|
11
|
+
export declare const PseudoInput: ({ text, className, ...rest }: PseudoInputProps) => JSX.Element;
|
|
@@ -1,23 +1,34 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
2
13
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
14
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
15
|
};
|
|
5
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.PseudoInput = void 0;
|
|
6
18
|
const react_1 = __importDefault(require("react"));
|
|
7
19
|
const bind_1 = __importDefault(require("classnames/bind"));
|
|
8
20
|
const search_1 = __importDefault(require("@sima-land/ui-quarks/icons/24x24/Stroked/search"));
|
|
9
21
|
const pseudo_input_module_scss_1 = __importDefault(require("./pseudo-input.module.scss"));
|
|
10
|
-
const colors_1 = require("@sima-land/ui-nucleons/colors");
|
|
11
22
|
const cx = bind_1.default.bind(pseudo_input_module_scss_1.default);
|
|
12
23
|
/**
|
|
13
|
-
*
|
|
14
|
-
* @param props
|
|
15
|
-
* @param props.text Текст подсказки.
|
|
16
|
-
* @param props.onClick Обработчик клика.
|
|
24
|
+
* Псевдо-поле поиска.
|
|
25
|
+
* @param props Свойства.
|
|
17
26
|
* @return Элемент.
|
|
18
27
|
*/
|
|
19
|
-
const PseudoInput = (
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
28
|
+
const PseudoInput = (_a) => {
|
|
29
|
+
var { text, className } = _a, rest = __rest(_a, ["text", "className"]);
|
|
30
|
+
return (react_1.default.createElement("div", Object.assign({}, rest, { role: 'button', className: cx('input', className) }),
|
|
31
|
+
react_1.default.createElement(search_1.default, { className: cx('icon'), "aria-hidden": 'true' }),
|
|
32
|
+
react_1.default.createElement("span", { className: cx('text') }, text)));
|
|
33
|
+
};
|
|
34
|
+
exports.PseudoInput = PseudoInput;
|
|
@@ -1,21 +1,18 @@
|
|
|
1
|
-
@
|
|
1
|
+
@use 'node_modules/@sima-land/ui-nucleons/colors';
|
|
2
2
|
|
|
3
3
|
.input {
|
|
4
|
-
box-sizing: border-box;
|
|
5
4
|
display: flex;
|
|
6
5
|
align-items: center;
|
|
7
|
-
width: 100%;
|
|
8
6
|
height: 40px;
|
|
9
|
-
margin-top: 24px;
|
|
10
7
|
padding: 0 16px 0 12px;
|
|
11
8
|
border-radius: 8px;
|
|
12
|
-
background-color:
|
|
9
|
+
background-color: colors.$gray4;
|
|
13
10
|
}
|
|
14
11
|
|
|
15
12
|
.icon {
|
|
16
|
-
display:
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
display: block;
|
|
14
|
+
flex-shrink: 0;
|
|
15
|
+
fill: colors.$gray38;
|
|
19
16
|
}
|
|
20
17
|
|
|
21
18
|
.text {
|
|
@@ -23,5 +20,5 @@
|
|
|
23
20
|
margin-left: 12px;
|
|
24
21
|
font-size: 16px;
|
|
25
22
|
line-height: 24px;
|
|
26
|
-
color:
|
|
23
|
+
color: colors.$gray38;
|
|
27
24
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { LayoutProps } from '@sima-land/ui-nucleons/layout';
|
|
2
3
|
export interface SelectScreenProps {
|
|
3
4
|
items?: any[];
|
|
4
5
|
getItemName?: (item: any) => string;
|
|
@@ -8,9 +9,14 @@ export interface SelectScreenProps {
|
|
|
8
9
|
}) => React.ReactNode;
|
|
9
10
|
isItemSelected?: (item: any) => boolean | void;
|
|
10
11
|
onItemClick?: (item: any) => void;
|
|
12
|
+
title?: string;
|
|
13
|
+
subtitle?: string;
|
|
14
|
+
onBack?: () => void;
|
|
15
|
+
onClose?: () => void;
|
|
11
16
|
}
|
|
12
17
|
/**
|
|
13
18
|
* Экран выбора опции.
|
|
19
|
+
* @deprecated Вместо SelectScreen используйте SelectScreenLayout и SelectScreenOption вместе с Screen.
|
|
14
20
|
* @param props Свойства. Поддерживаются свойства Screen.
|
|
15
21
|
* @param props.items Список опций.
|
|
16
22
|
* @param props.getItemName Вернет имя опции.
|
|
@@ -19,5 +25,8 @@ export interface SelectScreenProps {
|
|
|
19
25
|
* @param props.onItemClick Сработает при клике на опцию.
|
|
20
26
|
* @return Экран выбора опции.
|
|
21
27
|
*/
|
|
22
|
-
declare const SelectScreen: ({ items, getItemName, displayItem, isItemSelected, onItemClick,
|
|
23
|
-
export
|
|
28
|
+
export declare const SelectScreen: ({ items, getItemName, displayItem, isItemSelected, onItemClick, title, subtitle, onBack, onClose, }: SelectScreenProps) => JSX.Element;
|
|
29
|
+
export declare const SelectScreenLayout: ({ children, ...props }: LayoutProps) => JSX.Element;
|
|
30
|
+
export declare const SelectScreenOption: ({ children, className, selected, ...props }: React.ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
31
|
+
selected?: boolean | undefined;
|
|
32
|
+
}) => JSX.Element;
|