@sima-land/ui-nucleons 40.3.0 → 41.2.1
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/_internal/body-scroll.d.ts +9 -0
- package/_internal/body-scroll.js +21 -1
- package/alert/index.js +1 -1
- package/arrow-button/index.d.ts +1 -0
- package/avatar/user.d.ts +1 -0
- package/card/index.d.ts +1 -0
- package/carousel/draggable.js +3 -1
- package/carousel/index.d.ts +2 -2
- package/carousel/index.js +1 -1
- package/chips/index.d.ts +5 -14
- package/chips/index.js +24 -9
- package/chips/item.d.ts +15 -0
- package/chips/item.js +20 -0
- package/constants.d.ts +6 -0
- package/constants.js +9 -0
- package/dot-nav/index.d.ts +1 -0
- package/hooks/index.d.ts +2 -1
- package/hooks/index.js +9 -7
- package/no-index-mark/index.d.ts +1 -0
- package/package.json +49 -51
- package/pagination/utils.d.ts +1 -1
- package/price/index.d.ts +1 -0
- package/rating/index.js +2 -2
- package/readme.md +6 -6
- package/screen/index.d.ts +12 -53
- package/screen/index.js +31 -85
- package/screen/screen.module.scss +16 -15
- package/screen/slots.d.ts +32 -0
- package/screen/slots.js +97 -0
- package/screen/utils.d.ts +13 -2
- package/screen/utils.js +3 -7
- package/side-page/index.d.ts +15 -2
- package/side-page/index.js +2 -2
- package/stroked-svg/index.d.ts +17 -0
- package/stroked-svg/index.js +52 -0
- package/stroked-svg/index.module.scss +17 -0
- package/super-ellipse-clip-path/index.d.ts +1 -0
- package/tabs/index.d.ts +32 -25
- package/tabs/index.js +30 -24
- package/tabs/tabs.module.scss +21 -19
- package/text-field/index.js +1 -1
- package/touch-slider/index.js +2 -1
- package/unknown-content/unknown-content.module.scss +3 -3
- package/screen/screen-layout.d.ts +0 -57
- package/screen/screen-layout.js +0 -116
package/tabs/tabs.module.scss
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
font-weight: 600;
|
|
11
11
|
line-height: 24px;
|
|
12
12
|
li {
|
|
13
|
+
display: block;
|
|
13
14
|
margin: 0;
|
|
14
15
|
&::before {
|
|
15
16
|
content: none;
|
|
@@ -17,13 +18,14 @@
|
|
|
17
18
|
}
|
|
18
19
|
&.stretch {
|
|
19
20
|
justify-items: stretch;
|
|
20
|
-
.
|
|
21
|
+
.item {
|
|
21
22
|
width: 100%;
|
|
22
23
|
}
|
|
23
24
|
}
|
|
24
|
-
&.view-clean
|
|
25
|
+
&.view-clean,
|
|
26
|
+
&.view-clean-underline {
|
|
25
27
|
height: 32px;
|
|
26
|
-
.
|
|
28
|
+
.item {
|
|
27
29
|
color: colors.$gray38;
|
|
28
30
|
&.selected {
|
|
29
31
|
position: relative;
|
|
@@ -49,22 +51,22 @@
|
|
|
49
51
|
color: colors.$gray54;
|
|
50
52
|
}
|
|
51
53
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
54
|
+
}
|
|
55
|
+
&.view-clean-underline {
|
|
56
|
+
height: 40px;
|
|
57
|
+
position: relative;
|
|
58
|
+
&::before {
|
|
59
|
+
position: absolute;
|
|
60
|
+
bottom: 0;
|
|
61
|
+
content: '';
|
|
62
|
+
height: 1px;
|
|
63
|
+
width: 100%;
|
|
64
|
+
background-color: colors.$gray12;
|
|
63
65
|
}
|
|
64
66
|
}
|
|
65
67
|
&.view-round {
|
|
66
68
|
height: 40px;
|
|
67
|
-
.
|
|
69
|
+
.item {
|
|
68
70
|
color: colors.$gray87;
|
|
69
71
|
padding: 8px 16px;
|
|
70
72
|
border-radius: 4px;
|
|
@@ -83,15 +85,15 @@
|
|
|
83
85
|
}
|
|
84
86
|
}
|
|
85
87
|
&.gap-m {
|
|
86
|
-
--gap: 24px;
|
|
88
|
+
--tabs-gap: 24px;
|
|
87
89
|
}
|
|
88
90
|
&.gap-s {
|
|
89
|
-
--gap: 16px;
|
|
91
|
+
--tabs-gap: 16px;
|
|
90
92
|
}
|
|
91
|
-
.
|
|
93
|
+
.item {
|
|
92
94
|
text-align: center;
|
|
93
95
|
&:not(:last-child) {
|
|
94
|
-
margin-right: var(--gap);
|
|
96
|
+
margin-right: var(--tabs-gap);
|
|
95
97
|
}
|
|
96
98
|
}
|
|
97
99
|
}
|
package/text-field/index.js
CHANGED
|
@@ -77,7 +77,7 @@ exports.TextField = (0, react_1.forwardRef)(function TextField({ autoFocus, capt
|
|
|
77
77
|
} },
|
|
78
78
|
!multiline && Boolean(startAdornment) && (react_1.default.createElement(box_1.Box, { display: 'flex', alignItems: 'center', marginRight: 4 }, startAdornment)),
|
|
79
79
|
react_1.default.createElement("div", { className: cx('main-column') },
|
|
80
|
-
withLabel && (react_1.default.createElement("label", { className: cx('label', commonModifyClasses, hasValue && 'filled', labelAsPlaceholder && 'as-placeholder'), children: label })),
|
|
80
|
+
withLabel && (react_1.default.createElement("label", { className: cx('label', commonModifyClasses, hasValue && 'filled', labelAsPlaceholder && 'as-placeholder'), children: label, "data-testid": 'text-field:label' })),
|
|
81
81
|
react_1.default.createElement("div", { className: cx('input-wrapper') },
|
|
82
82
|
react_1.default.createElement(base_input_1.BaseInput, Object.assign({}, baseInputProps, { "data-testid": 'text-field:field', multiline: multiline, ref: baseInputRef, placeholder: withLabel && labelAsPlaceholder ? undefined : placeholder, restPlaceholder: withLabel && labelAsPlaceholder ? undefined : restPlaceholder, autoFocus: autoFocus, className: cx('base-input', commonModifyClasses, classes.baseInput, size && `size-${size}`), defaultValue: defaultValue, value: value, readOnly: readOnly, disabled: disabled, onFocus: (event) => {
|
|
83
83
|
(0, lodash_1.isFunction)(onFocus) && onFocus(event);
|
package/touch-slider/index.js
CHANGED
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.TouchSlider = void 0;
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
8
|
const layout_1 = require("../layout");
|
|
9
|
+
const constants_1 = require("../constants");
|
|
9
10
|
const bind_1 = __importDefault(require("classnames/bind"));
|
|
10
11
|
const touch_slider_module_scss_1 = __importDefault(require("./touch-slider.module.scss"));
|
|
11
12
|
const cx = bind_1.default.bind(touch_slider_module_scss_1.default);
|
|
@@ -15,6 +16,6 @@ const cx = bind_1.default.bind(touch_slider_module_scss_1.default);
|
|
|
15
16
|
* @return Элемент.
|
|
16
17
|
*/
|
|
17
18
|
const TouchSlider = ({ children }) => (react_1.default.createElement(layout_1.MobileLayout, null,
|
|
18
|
-
react_1.default.createElement("div", { className: cx('outer', 'invisible-scroll') },
|
|
19
|
+
react_1.default.createElement("div", Object.assign({ className: cx('outer', 'invisible-scroll') }, { [constants_1.BSL_IGNORE_ATTR]: true }),
|
|
19
20
|
react_1.default.createElement("div", { className: cx('inner') }, children))));
|
|
20
21
|
exports.TouchSlider = TouchSlider;
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { NavBarProps } from '../nav-bar';
|
|
3
|
-
import { OrNil } from './utils';
|
|
4
|
-
export interface CallbackData {
|
|
5
|
-
contentElement: OrNil<HTMLDivElement>;
|
|
6
|
-
}
|
|
7
|
-
export interface ScreenLayoutProps {
|
|
8
|
-
childrenRef?: React.MutableRefObject<OrNil<HTMLDivElement>> | React.RefCallback<OrNil<HTMLDivElement>>;
|
|
9
|
-
footer?: React.ReactNode;
|
|
10
|
-
fullScrollThreshold?: number;
|
|
11
|
-
navBarProps?: NavBarProps;
|
|
12
|
-
onBack?: (data: CallbackData) => void;
|
|
13
|
-
onClose?: (data: CallbackData) => void;
|
|
14
|
-
onFullScroll?: (data: CallbackData) => void;
|
|
15
|
-
subtitle?: string;
|
|
16
|
-
title?: string;
|
|
17
|
-
withBackButton?: boolean;
|
|
18
|
-
withCloseButton?: boolean;
|
|
19
|
-
withDivideHeader?: boolean;
|
|
20
|
-
withHeader?: boolean;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Разметка содержимого компонента Screen.
|
|
24
|
-
* @param props Свойства.
|
|
25
|
-
* @param props.children Содержимое.
|
|
26
|
-
* @param props.childrenRef Ref для элемента содержимого.
|
|
27
|
-
* @param props.footer Содержимое подвала.
|
|
28
|
-
* @param props.fullScrollThreshold Отступ от нижней границы для срабатывания onFullScroll.
|
|
29
|
-
* @param props.navBarProps Свойства компонента NavBar.
|
|
30
|
-
* @param props.onBack Сработает при клике на кнопку "назад".
|
|
31
|
-
* @param props.onClose Сработает при клике на крест.
|
|
32
|
-
* @param props.onFullScroll Сработает при полной прокрутке контента.
|
|
33
|
-
* @param props.subtitle Подзаголовок.
|
|
34
|
-
* @param props.title Заголовок.
|
|
35
|
-
* @param props.withBackButton Нужно ли выводить кнопку "назад".
|
|
36
|
-
* @param props.withCloseButton Нужно ли выводить закрывающий крест.
|
|
37
|
-
* @param props.withDivideHeader Нужно ли рисовать черту между шапкой и основным содержимым.
|
|
38
|
-
* @param props.withHeader Нужно ли выводить шапку с заголовком и кнопками.
|
|
39
|
-
* @return Элемент.
|
|
40
|
-
*/
|
|
41
|
-
export declare const ScreenLayout: React.FC<ScreenLayoutProps>;
|
|
42
|
-
/**
|
|
43
|
-
* Возвращает функцию сохранения аргумента в ref-контейнер.
|
|
44
|
-
* Возвращаемая функция выполняет подписку на "scroll" и вызывает callback в момент полной прокрутки.
|
|
45
|
-
* @param options Опции.
|
|
46
|
-
* @param options.elementRef Ref-контейнер для элемента.
|
|
47
|
-
* @param options.unsubscribeRef Ref-контейнер для функции отписки от "scroll".
|
|
48
|
-
* @param options.onFullScroll Сработает при полной прокрутке.
|
|
49
|
-
* @param options.fullScrollThreshold Отступ от нижней границы для срабатывания onFullScroll.
|
|
50
|
-
* @return Функция сохранения аргумента в ref-контейнер.
|
|
51
|
-
*/
|
|
52
|
-
export declare const createTakeContentRef: ({ elementRef, unsubscribeRef, onFullScroll, fullScrollThreshold: threshold, }: {
|
|
53
|
-
elementRef: React.MutableRefObject<OrNil<HTMLDivElement>>;
|
|
54
|
-
unsubscribeRef: React.MutableRefObject<undefined | (() => void)>;
|
|
55
|
-
onFullScroll?: ((data: CallbackData) => void) | undefined;
|
|
56
|
-
fullScrollThreshold?: number | undefined;
|
|
57
|
-
}) => (element?: HTMLDivElement | undefined) => void;
|
package/screen/screen-layout.js
DELETED
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
-
}) : function(o, v) {
|
|
12
|
-
o["default"] = v;
|
|
13
|
-
});
|
|
14
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
-
if (mod && mod.__esModule) return mod;
|
|
16
|
-
var result = {};
|
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
-
__setModuleDefault(result, mod);
|
|
19
|
-
return result;
|
|
20
|
-
};
|
|
21
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
22
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
|
-
};
|
|
24
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
exports.createTakeContentRef = exports.ScreenLayout = void 0;
|
|
26
|
-
const react_1 = __importStar(require("react"));
|
|
27
|
-
const nav_bar_1 = require("../nav-bar");
|
|
28
|
-
const utils_1 = require("./utils");
|
|
29
|
-
const on_1 = __importDefault(require("../helpers/on"));
|
|
30
|
-
const is_fully_scrolled_1 = require("../helpers/is-fully-scrolled");
|
|
31
|
-
const lodash_1 = require("lodash");
|
|
32
|
-
const arrow_left_1 = __importDefault(require("@sima-land/ui-quarks/icons/24x24/Stroked/arrow-left"));
|
|
33
|
-
const cross_1 = __importDefault(require("@sima-land/ui-quarks/icons/24x24/Stroked/cross"));
|
|
34
|
-
/**
|
|
35
|
-
* Разметка содержимого компонента Screen.
|
|
36
|
-
* @param props Свойства.
|
|
37
|
-
* @param props.children Содержимое.
|
|
38
|
-
* @param props.childrenRef Ref для элемента содержимого.
|
|
39
|
-
* @param props.footer Содержимое подвала.
|
|
40
|
-
* @param props.fullScrollThreshold Отступ от нижней границы для срабатывания onFullScroll.
|
|
41
|
-
* @param props.navBarProps Свойства компонента NavBar.
|
|
42
|
-
* @param props.onBack Сработает при клике на кнопку "назад".
|
|
43
|
-
* @param props.onClose Сработает при клике на крест.
|
|
44
|
-
* @param props.onFullScroll Сработает при полной прокрутке контента.
|
|
45
|
-
* @param props.subtitle Подзаголовок.
|
|
46
|
-
* @param props.title Заголовок.
|
|
47
|
-
* @param props.withBackButton Нужно ли выводить кнопку "назад".
|
|
48
|
-
* @param props.withCloseButton Нужно ли выводить закрывающий крест.
|
|
49
|
-
* @param props.withDivideHeader Нужно ли рисовать черту между шапкой и основным содержимым.
|
|
50
|
-
* @param props.withHeader Нужно ли выводить шапку с заголовком и кнопками.
|
|
51
|
-
* @return Элемент.
|
|
52
|
-
*/
|
|
53
|
-
const ScreenLayout = ({ children, childrenRef, footer, fullScrollThreshold, navBarProps = {}, onBack, onClose, onFullScroll, subtitle, title, withBackButton, withCloseButton, withDivideHeader, withHeader, }) => {
|
|
54
|
-
const contentRef = (0, react_1.useRef)();
|
|
55
|
-
const unsubscribeRef = (0, react_1.useRef)();
|
|
56
|
-
(0, react_1.useImperativeHandle)(childrenRef, () => contentRef.current);
|
|
57
|
-
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
58
|
-
Boolean(withHeader) && (react_1.default.createElement(nav_bar_1.NavBar, Object.assign({}, navBarProps, { title: title, subtitle: subtitle, bottomBordered: withDivideHeader, buttons: Object.assign(Object.assign({}, navBarProps.buttons), { start: withBackButton
|
|
59
|
-
? {
|
|
60
|
-
// ВАЖНО: не подмешиваем свойства из navBarProps.buttons.start
|
|
61
|
-
// чтобы не распылять конфигурацию одной и той же кнопки по нескольким местам
|
|
62
|
-
icon: arrow_left_1.default,
|
|
63
|
-
onClick: () => onBack && onBack({ contentElement: contentRef.current }),
|
|
64
|
-
'aria-label': 'Вернуться назад',
|
|
65
|
-
'data-testid': 'screen:back',
|
|
66
|
-
}
|
|
67
|
-
: (0, lodash_1.get)(navBarProps.buttons, 'start'), end: withCloseButton
|
|
68
|
-
? {
|
|
69
|
-
// ВАЖНО: не подмешиваем свойства из navBarProps.buttons.end
|
|
70
|
-
// чтобы не распылять конфигурацию одной и той же кнопки по нескольким местам
|
|
71
|
-
icon: cross_1.default,
|
|
72
|
-
onClick: () => onClose && onClose({ contentElement: contentRef.current }),
|
|
73
|
-
'aria-label': `Закрыть ${title || ''}`.trim(),
|
|
74
|
-
'data-testid': 'screen:close',
|
|
75
|
-
}
|
|
76
|
-
: (0, lodash_1.get)(navBarProps.buttons, 'end') }) }))),
|
|
77
|
-
react_1.default.createElement("div", { className: (0, utils_1.cx)('content', 'full-width'), children: children, ref: (0, exports.createTakeContentRef)({
|
|
78
|
-
elementRef: contentRef,
|
|
79
|
-
unsubscribeRef,
|
|
80
|
-
onFullScroll,
|
|
81
|
-
fullScrollThreshold,
|
|
82
|
-
}) }),
|
|
83
|
-
Boolean(footer) && react_1.default.createElement("div", { className: (0, utils_1.cx)('footer', 'full-width') }, footer)));
|
|
84
|
-
};
|
|
85
|
-
exports.ScreenLayout = ScreenLayout;
|
|
86
|
-
/**
|
|
87
|
-
* Возвращает функцию сохранения аргумента в ref-контейнер.
|
|
88
|
-
* Возвращаемая функция выполняет подписку на "scroll" и вызывает callback в момент полной прокрутки.
|
|
89
|
-
* @param options Опции.
|
|
90
|
-
* @param options.elementRef Ref-контейнер для элемента.
|
|
91
|
-
* @param options.unsubscribeRef Ref-контейнер для функции отписки от "scroll".
|
|
92
|
-
* @param options.onFullScroll Сработает при полной прокрутке.
|
|
93
|
-
* @param options.fullScrollThreshold Отступ от нижней границы для срабатывания onFullScroll.
|
|
94
|
-
* @return Функция сохранения аргумента в ref-контейнер.
|
|
95
|
-
*/
|
|
96
|
-
const createTakeContentRef = ({ elementRef, unsubscribeRef, onFullScroll, fullScrollThreshold: threshold = 0, }) => (element) => {
|
|
97
|
-
if (!element) {
|
|
98
|
-
// чистим реф
|
|
99
|
-
elementRef.current = undefined;
|
|
100
|
-
// если ранее были подписаны - отписываемся
|
|
101
|
-
unsubscribeRef.current && unsubscribeRef.current();
|
|
102
|
-
}
|
|
103
|
-
else if (element !== elementRef.current) {
|
|
104
|
-
// сохраняем ссылку для последующей отправки в onClose/onBack
|
|
105
|
-
elementRef.current = element;
|
|
106
|
-
// если ранее были подписаны - отписываемся
|
|
107
|
-
unsubscribeRef.current && unsubscribeRef.current();
|
|
108
|
-
// выполняем подписку, сохраняем функцию отписки
|
|
109
|
-
unsubscribeRef.current = (0, on_1.default)(element, 'scroll', () => {
|
|
110
|
-
(0, is_fully_scrolled_1.isFullyScrolled)(element, { threshold }) &&
|
|
111
|
-
onFullScroll &&
|
|
112
|
-
onFullScroll({ contentElement: element });
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
};
|
|
116
|
-
exports.createTakeContentRef = createTakeContentRef;
|