@sima-land/moleculas 13.2.1 → 13.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -3,13 +3,11 @@ export interface BadgeField {
|
|
|
3
3
|
type: 'text' | 'timer' | 'svg-url';
|
|
4
4
|
value: string;
|
|
5
5
|
}
|
|
6
|
-
export interface BadgeProps extends React.
|
|
6
|
+
export interface BadgeProps extends Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, 'color'> {
|
|
7
7
|
/** Основной цвет, используется как цвет обводки, иконок и текста. */
|
|
8
8
|
color?: string;
|
|
9
9
|
/** Содержимое шильдика. */
|
|
10
10
|
fields: Array<BadgeField>;
|
|
11
|
-
/** Ссылка, переход по которой будет произведён по нажатию на шильдик. */
|
|
12
|
-
href?: string;
|
|
13
11
|
/** Идентификатор для систем автоматизированного тестирования. */
|
|
14
12
|
'data-testid'?: string;
|
|
15
13
|
}
|
|
@@ -30,9 +30,8 @@ const cx = bind_1.default.bind(badge_module_scss_1.default);
|
|
|
30
30
|
*/
|
|
31
31
|
const Badge = (_a) => {
|
|
32
32
|
var { className, color, fields, href, style, 'data-testid': testId = 'badge' } = _a, restProps = __rest(_a, ["className", "color", "fields", "href", "style", 'data-testid']);
|
|
33
|
-
const Element = href ? 'a' : 'span';
|
|
34
33
|
const iconOnly = fields.length === 1 && fields[0].type === 'svg-url';
|
|
35
|
-
return (react_1.default.createElement(
|
|
34
|
+
return (react_1.default.createElement("a", Object.assign({}, restProps, { "data-testid": testId, href: href, style: Object.assign(Object.assign({}, style), { '--badge-color': color }), className: cx('root', iconOnly && 'icon-only', href && 'interactive', className), children: iconOnly ? (react_1.default.createElement("img", { className: cx('icon'), src: fields[0].value })) : (
|
|
36
35
|
// вложенный span нужен для того чтобы объединить `display: inline-flex` и `text-overflow: ellipsis`
|
|
37
36
|
react_1.default.createElement("span", { className: cx('content') }, fields.reduce((acc, item, i) => {
|
|
38
37
|
let result = null;
|
|
@@ -99,6 +99,7 @@ const ProductCarousel = ({ className, itemSize, onInViewport, onNeedRequest, wit
|
|
|
99
99
|
onChangeTargetIndex: () => cardShow.disallowFor(360) }))),
|
|
100
100
|
withHoverCard &&
|
|
101
101
|
activeItemIndex !== null &&
|
|
102
|
+
items[activeItemIndex] &&
|
|
102
103
|
[items[activeItemIndex]].map(item => (react_1.default.createElement(hover_card_1.HoverCard, Object.assign({ key: activeItemIndex, targetRef: targetItemRef, onMouseLeave: () => setActiveItemIndex(null) }, item.props))))));
|
|
103
104
|
};
|
|
104
105
|
exports.ProductCarousel = ProductCarousel;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sima-land/moleculas",
|
|
3
|
-
"version": "13.
|
|
3
|
+
"version": "13.3.0",
|
|
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",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"prettier:check": "prettier --check \"./src/**/*.{js,jsx,ts,tsx,css,scss}\" --loglevel error"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@sima-land/ui-nucleons": "^43.0
|
|
28
|
+
"@sima-land/ui-nucleons": "^43.1.0",
|
|
29
29
|
"@sima-land/ui-quarks": "^2.2.0",
|
|
30
30
|
"classnames": "^2.3.1",
|
|
31
31
|
"date-fns": "^2.26.0",
|