@sima-land/moleculas 16.0.0-alpha.12 → 16.0.0-alpha.14

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.
@@ -1,26 +1,2 @@
1
- import { ReactElement, HTMLAttributes } from 'react';
2
- import { ProductInfo, ProductInfoProps } from '../../../common/components/product-info';
3
- import { PlateProps } from '@sima-land/ui-nucleons/plate';
4
- export type ProductCardChildren = ReactElement<ProductInfoProps, typeof ProductInfo>;
5
- export interface ProductCardProps extends HTMLAttributes<HTMLDivElement> {
6
- children: ProductCardChildren;
7
- }
8
- export declare const HoverCard: import("react").ForwardRefExoticComponent<PlateProps & import("react").RefAttributes<HTMLDivElement | null>>;
9
- /**
10
- * Карточка данных товара с расширенной инф-ой при наведении.
11
- * @param props Свойства.
12
- * @return Элемент.
13
- */
14
- export declare const ProductCard: ({ children, className, ...props }: ProductCardProps) => import("react/jsx-runtime").JSX.Element;
15
- /**
16
- * Фильтрует содержимое карточки для вывода состояния без наведения.
17
- * @param el Элемент.
18
- * @return Элемент.
19
- */
20
- export declare const reduceBaseInfo: (el: ProductCardChildren) => import("react").FunctionComponentElement<ProductInfoProps>;
21
- /**
22
- * Получив содержимое карточки фильтрует/меняет его для вывода в карточке при наведении.
23
- * @param el Содержимое.
24
- * @return Элемент.
25
- */
26
- export declare const reduceHoverInfo: (el: ProductCardChildren) => import("react").FunctionComponentElement<ProductInfoProps>;
1
+ export { ProductCardProps } from './types';
2
+ export { ProductCard, HoverCard, reduceBaseInfo, reduceHoverInfo } from './product-card';
@@ -1,70 +1,9 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.reduceHoverInfo = exports.reduceBaseInfo = exports.ProductCard = exports.HoverCard = void 0;
7
- const jsx_runtime_1 = require("react/jsx-runtime");
8
- const react_1 = require("react");
9
- const product_info_1 = require("../../../common/components/product-info");
10
- const plate_1 = require("@sima-land/ui-nucleons/plate");
11
- const layer_1 = require("@sima-land/ui-nucleons/helpers/layer");
12
- const classnames_1 = __importDefault(require("classnames"));
13
- const product_card_module_scss_1 = __importDefault(require("./product-card.module.scss"));
14
- exports.HoverCard = (0, react_1.forwardRef)((props, ref) => {
15
- const layer = (0, layer_1.useLayer)() + 1;
16
- return ((0, jsx_runtime_1.jsx)(plate_1.Plate, { ...props, style: { ...props.style, zIndex: layer }, ref: ref, rounds: 'm', shadow: 'z4', className: (0, classnames_1.default)(product_card_module_scss_1.default.card, props.className), "data-testid": 'product-card:hover-card' }));
17
- });
18
- /**
19
- * Карточка данных товара с расширенной инф-ой при наведении.
20
- * @param props Свойства.
21
- * @return Элемент.
22
- */
23
- const ProductCard = ({ children, className, ...props }) => {
24
- const [hovered, toggle] = (0, react_1.useState)(false);
25
- return ((0, jsx_runtime_1.jsxs)("div", { ...props, "data-testid": 'product-card', className: (0, classnames_1.default)(product_card_module_scss_1.default.root, className), onMouseEnter: () => toggle(true),
26
- // вешаем onMouseLeave на корневой элемент так как в Chrome проблемы если вешать на "product-card:info"
27
- onMouseLeave: () => toggle(false), children: [(0, jsx_runtime_1.jsx)("div", { "data-testid": 'product-card:info', children: (0, exports.reduceBaseInfo)(children) }), hovered && (0, jsx_runtime_1.jsx)(exports.HoverCard, { children: (0, exports.reduceHoverInfo)(children) })] }));
28
- };
29
- exports.ProductCard = ProductCard;
30
- /**
31
- * Фильтрует содержимое карточки для вывода состояния без наведения.
32
- * @param el Элемент.
33
- * @return Элемент.
34
- */
35
- const reduceBaseInfo = (el) => (0, react_1.cloneElement)(el, {
36
- children: react_1.Children.map(el.props.children, child => {
37
- let result;
38
- if ((0, react_1.isValidElement)(child)) {
39
- switch (child.type) {
40
- // игнорируем кнопки-иконки на изображении
41
- case product_info_1.Parts.Image:
42
- result = (0, react_1.cloneElement)(child, { children: undefined });
43
- break;
44
- // игнорируем футер
45
- case product_info_1.Parts.Footer:
46
- result = null;
47
- break;
48
- // остальное оставляем без изменений
49
- default:
50
- result = child;
51
- break;
52
- }
53
- }
54
- return result;
55
- }),
56
- });
57
- exports.reduceBaseInfo = reduceBaseInfo;
58
- /**
59
- * Получив содержимое карточки фильтрует/меняет его для вывода в карточке при наведении.
60
- * @param el Содержимое.
61
- * @return Элемент.
62
- */
63
- const reduceHoverInfo = (el) => (0, react_1.cloneElement)(el, {
64
- // при наведении у изображения строго непрозрачность = 1
65
- children: react_1.Children.map(el.props.children, child => (0, react_1.isValidElement)(child) && child.type === product_info_1.Parts.Image
66
- ? (0, react_1.cloneElement)(child, { opacity: 1 })
67
- : child),
68
- });
69
- exports.reduceHoverInfo = reduceHoverInfo;
3
+ exports.reduceHoverInfo = exports.reduceBaseInfo = exports.HoverCard = exports.ProductCard = void 0;
4
+ var product_card_1 = require("./product-card");
5
+ Object.defineProperty(exports, "ProductCard", { enumerable: true, get: function () { return product_card_1.ProductCard; } });
6
+ Object.defineProperty(exports, "HoverCard", { enumerable: true, get: function () { return product_card_1.HoverCard; } });
7
+ Object.defineProperty(exports, "reduceBaseInfo", { enumerable: true, get: function () { return product_card_1.reduceBaseInfo; } });
8
+ Object.defineProperty(exports, "reduceHoverInfo", { enumerable: true, get: function () { return product_card_1.reduceHoverInfo; } });
70
9
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/desktop/components/product-card/index.tsx"],"names":[],"mappings":";;;;;;;AAAA,iCAQe;AACf,0EAA+F;AAC/F,wDAAiE;AACjE,gEAAgE;AAChE,4DAA4B;AAC5B,0FAAgD;AASnC,QAAA,SAAS,GAAG,IAAA,kBAAU,EAAoC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;IACpF,MAAM,KAAK,GAAG,IAAA,gBAAQ,GAAE,GAAG,CAAC,CAAC;IAE7B,OAAO,CACL,uBAAC,aAAK,OACA,KAAK,EACT,KAAK,EAAE,EAAE,GAAG,K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ClB,0CAA0C;gBAC1C,KAAK,oBAAK,CAAC,KAAK;oBACd,MAAM,GAAG,IAAA,oBAAY,EAAM,KAAK,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC,CAAC;oBAC3D,MAAM;gBAER,mBAAmB;gBACnB,KAAK,oBAAK,CAAC,MAAM;oBACf,MAAM,GAAG,IAAI,CAAC;oBACd,MAAM;gBAER,oCAAoC;gBACpC;oBACE,MAAM,GAAG,KAAK,CAAC;oBACf,MAAM;aACT;SACF;QAED,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC;CACH,CAAC,CAAC;AA1BQ,QAAA,cAAc,kBA0BtB;AAEL;;;;GAIG;AACI,MAAM,eAAe,GAAG,CAAC,EAAuB,EAAE,EAAE,CACzD,IAAA,oBAAY,EAAC,EAAE,EAAE;IACf,wDAAwD;IACxD,QAAQ,EAAE,gBAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC,EAAE,CAChD,IAAA,sBAAc,EAAa,KAAK,CAAC,IAAI,KAAK,CAAC,IAAI,KAAK,oBAAK,CAAC,KAAK;QAC7D,CAAC,CAAC,IAAA,oBAAY,EAAa,KAAK,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;QACjD,CAAC,CAAC,KAAK,CACV;CACF,CAAC,CAAC;AARQ,QAAA,eAAe,mBAQvB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/desktop/components/product-card/index.ts"],"names":[],"mappings":";;;AACA,+CAAyF;AAAhF,2GAAA,WAAW,OAAA;AAAE,yGAAA,SAAS,OAAA;AAAE,8GAAA,cAAc,OAAA;AAAE,+GAAA,eAAe,OAAA"}
@@ -0,0 +1,23 @@
1
+ /// <reference types="react" />
2
+ import { ProductCardChildren, ProductCardProps, ReduceBaseInfoOptions } from './types';
3
+ import { PlateProps } from '@sima-land/ui-nucleons/plate';
4
+ /**
5
+ * Карточка данных товара с расширенной инф-ой при наведении.
6
+ * @param props Свойства.
7
+ * @return Элемент.
8
+ */
9
+ export declare function ProductCard({ reduceBaseInfo: reduceBaseInfoProp, reduceHoverInfo: reduceHoverInfoProp, children, className, ...props }: ProductCardProps): import("react/jsx-runtime").JSX.Element;
10
+ export declare const HoverCard: import("react").ForwardRefExoticComponent<PlateProps & import("react").RefAttributes<HTMLDivElement | null>>;
11
+ /**
12
+ * Фильтрует содержимое карточки для вывода состояния без наведения.
13
+ * @param element Элемент.
14
+ * @param options Опции.
15
+ * @return Элемент.
16
+ */
17
+ export declare function reduceBaseInfo(element: ProductCardChildren, { hideImageButtons, hideFooter }?: ReduceBaseInfoOptions): import("react").FunctionComponentElement<import("../../../common/components/product-info").ProductInfoProps>;
18
+ /**
19
+ * Получив содержимое карточки фильтрует/меняет его для вывода в карточке при наведении.
20
+ * @param element Содержимое.
21
+ * @return Элемент.
22
+ */
23
+ export declare function reduceHoverInfo(element: ProductCardChildren): import("react").FunctionComponentElement<import("../../../common/components/product-info").ProductInfoProps>;
@@ -0,0 +1,92 @@
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.reduceHoverInfo = exports.reduceBaseInfo = exports.HoverCard = exports.ProductCard = void 0;
7
+ const jsx_runtime_1 = require("react/jsx-runtime");
8
+ const react_1 = require("react");
9
+ const product_info_1 = require("../../../common/components/product-info");
10
+ const plate_1 = require("@sima-land/ui-nucleons/plate");
11
+ const layer_1 = require("@sima-land/ui-nucleons/helpers/layer");
12
+ const bind_1 = __importDefault(require("classnames/bind"));
13
+ const product_card_module_scss_1 = __importDefault(require("./product-card.module.scss"));
14
+ const cx = bind_1.default.bind(product_card_module_scss_1.default);
15
+ /**
16
+ * Карточка данных товара с расширенной инф-ой при наведении.
17
+ * @param props Свойства.
18
+ * @return Элемент.
19
+ */
20
+ function ProductCard({ reduceBaseInfo: reduceBaseInfoProp = reduceBaseInfo, reduceHoverInfo: reduceHoverInfoProp = reduceHoverInfo, children, className, ...props }) {
21
+ const [hovered, toggle] = (0, react_1.useState)(false);
22
+ return ((0, jsx_runtime_1.jsxs)("div", { ...props, "data-testid": 'product-card', className: cx('root', className), onMouseEnter: () => toggle(true),
23
+ // ВАЖНО: вешаем onMouseLeave на корневой элемент так как в Chrome проблемы если вешать на "product-card:info"
24
+ onMouseLeave: () => toggle(false), children: [(0, jsx_runtime_1.jsx)("div", { "data-testid": 'product-card:info', children: reduceBaseInfoProp(children) }), hovered && (0, jsx_runtime_1.jsx)(exports.HoverCard, { children: reduceHoverInfoProp(children) })] }));
25
+ }
26
+ exports.ProductCard = ProductCard;
27
+ exports.HoverCard = (0, react_1.forwardRef)((props, ref) => {
28
+ const layer = (0, layer_1.useLayer)() + 1;
29
+ return ((0, jsx_runtime_1.jsx)(plate_1.Plate, { ...props, style: { ...props.style, zIndex: layer }, ref: ref, rounds: 'm', shadow: 'z4', className: cx('card', props.className), "data-testid": 'product-card:hover-card' }));
30
+ });
31
+ /**
32
+ * Фильтрует содержимое карточки для вывода состояния без наведения.
33
+ * @param element Элемент.
34
+ * @param options Опции.
35
+ * @return Элемент.
36
+ */
37
+ function reduceBaseInfo(element, { hideImageButtons = true, hideFooter = true } = {}) {
38
+ return (0, react_1.cloneElement)(element, {
39
+ children: react_1.Children.map(element.props.children, child => {
40
+ let result;
41
+ if ((0, react_1.isValidElement)(child)) {
42
+ switch (true) {
43
+ // игнорируем или фильтруем кнопки-иконки на изображении
44
+ case Boolean(child.type === product_info_1.Parts.Image && hideImageButtons):
45
+ result = (0, react_1.cloneElement)(child, {
46
+ children: typeof hideImageButtons === 'function'
47
+ ? react_1.Children.toArray(child.props.children).filter(hideImageButtons)
48
+ : undefined,
49
+ });
50
+ break;
51
+ // игнорируем футер
52
+ case Boolean(child.type === product_info_1.Parts.Footer && hideFooter):
53
+ result = null;
54
+ break;
55
+ // остальное оставляем без изменений
56
+ default:
57
+ result = child;
58
+ break;
59
+ }
60
+ }
61
+ return result;
62
+ }),
63
+ });
64
+ }
65
+ exports.reduceBaseInfo = reduceBaseInfo;
66
+ /**
67
+ * Получив содержимое карточки фильтрует/меняет его для вывода в карточке при наведении.
68
+ * @param element Содержимое.
69
+ * @return Элемент.
70
+ */
71
+ function reduceHoverInfo(element) {
72
+ return (0, react_1.cloneElement)(element, {
73
+ children: react_1.Children.map(element.props.children, child => {
74
+ let result;
75
+ if ((0, react_1.isValidElement)(child)) {
76
+ switch (child.type) {
77
+ // при наведении у изображения строго непрозрачность = 1
78
+ case product_info_1.Parts.Image:
79
+ result = (0, react_1.cloneElement)(child, { opacity: 1 });
80
+ break;
81
+ // остальное оставляем без изменений
82
+ default:
83
+ result = child;
84
+ break;
85
+ }
86
+ }
87
+ return result;
88
+ }),
89
+ });
90
+ }
91
+ exports.reduceHoverInfo = reduceHoverInfo;
92
+ //# sourceMappingURL=product-card.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"product-card.js","sourceRoot":"","sources":["../../../../src/desktop/components/product-card/product-card.tsx"],"names":[],"mappings":";;;;;;;AAAA,iCAAqF;AAErF,0EAAgE;AAChE,wDAAiE;AACjE,gEAAgE;AAChE,2DAAyC;AACzC,0FAAgD;AAEhD,MAAM,EAAE,GAAG,cAAU,CAAC,IAAI,CAAC,kCAAM,CAAC,CAAC;AAEnC;;;;GAIG;AACH,SAAgB,WAAW,CAAC,EAC1B,cAAc,EAAE,kBAAkB,GAAG,cAAc,EACnD,eAAe,EAAE,mBAAmB,GAAG,eAAe,EACtD,QAAQ,EACR,SAAS,EACT,GAAG,KAAK,EACS;IACjB,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,GAAG,IAAA,gBAAQ,EAAU,KAAK,CAAC,CAAC;IAEnD,OAAO,CACL,oCACM,KAAK,iBACG,cAAc,EAC1B,SAAS,EAAE,EAAE,CAAC,MAAM,EAAE,SAAS,CAAC,EAChC,YAAY,EAAE,GAAG,EAAE,CAAC,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import type { ProductInfo, ProductInfoProps } from '../../../common/components/product-info';
3
+ /** Допустимое содержимое компонента ProductCard. */
4
+ export type ProductCardChildren = ReactElement<ProductInfoProps, typeof ProductInfo>;
5
+ export interface ProductCardProps extends HTMLAttributes<HTMLDivElement> {
6
+ /** Содержимое. */
7
+ children: ProductCardChildren;
8
+ /** Получив содержимое должен вернуть то что будет выведено без наведения. */
9
+ reduceBaseInfo?: (children: ProductCardChildren) => ReactNode;
10
+ /** Получив содержимое должен вернуть то что будет выведено во всплывающей карточке. */
11
+ reduceHoverInfo?: (children: ProductCardChildren) => ReactNode;
12
+ }
13
+ /** Опции фильтрации содержимого карточки без наведения. */
14
+ export interface ReduceBaseInfoOptions {
15
+ /** Надо ли скрыть кнопки на картинке. При передаче функции она будет применена для каждого дочернего элемента внутри картинки как фильтр. */
16
+ hideImageButtons?: boolean | ((element: ReactNode) => boolean);
17
+ /** Надо ли скрыть футер. */
18
+ hideFooter?: boolean;
19
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/desktop/components/product-card/types.ts"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sima-land/moleculas",
3
- "version": "16.0.0-alpha.12",
3
+ "version": "16.0.0-alpha.14",
4
4
  "repository": "ssh://git@github.com:sima-land/moleculas.git",
5
5
  "author": "www.sima-land.ru team",
6
6
  "license": "Apache-2.0",
@@ -1,2 +0,0 @@
1
- import { ModifierType } from './types';
2
- export declare const MODIFIER_TYPE: Record<ModifierType, ModifierType>;
@@ -1,9 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MODIFIER_TYPE = void 0;
4
- exports.MODIFIER_TYPE = {
5
- text: 'text',
6
- image: 'image',
7
- color: 'color',
8
- };
9
- //# sourceMappingURL=constants.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/common/constants.ts"],"names":[],"mappings":";;;AAEa,QAAA,aAAa,GAAuC;IAC/D,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,OAAO;IACd,KAAK,EAAE,OAAO;CACN,CAAC"}
package/common/types.d.ts DELETED
@@ -1 +0,0 @@
1
- export type ModifierType = 'text' | 'image' | 'color';
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/common/types.ts"],"names":[],"mappings":""}