@sima-land/ui-nucleons 40.2.0 → 41.0.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.
- package/_internal/custom-scrollbar/index.js +3 -3
- package/alert/index.d.ts +2 -0
- package/alert/index.js +3 -3
- package/arrow-button/index.d.ts +1 -0
- package/autocomplete/index.js +12 -17
- package/avatar/index.d.ts +1 -1
- package/avatar/index.js +2 -4
- package/avatar/user.d.ts +2 -1
- package/avatar/user.js +2 -2
- package/avatar/utils.js +7 -1
- package/base-input/index.d.ts +1 -1
- package/base-input/index.js +1 -1
- package/bordered-layout/index.d.ts +1 -1
- package/bordered-layout/index.js +1 -1
- package/box/index.js +17 -36
- package/button/index.d.ts +3 -3
- package/button/index.js +4 -4
- package/card/index.d.ts +1 -0
- package/card/slots.js +1 -1
- package/carousel/draggable.js +14 -16
- package/carousel/index.d.ts +1 -1
- package/carousel/index.js +17 -37
- 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/clean-buttons/index.js +1 -3
- package/dot-nav/dot-nav.module.scss +2 -2
- package/dot-nav/index.d.ts +1 -0
- package/dropdown/dropdown.module.scss +1 -3
- package/field-grid/index.d.ts +2 -2
- package/field-grid/index.js +3 -3
- package/file-icon/index.js +5 -6
- package/helpers/bounds-of.js +1 -3
- package/helpers/find-child-element.js +1 -3
- package/helpers/find-offset-parent.js +4 -3
- package/helpers/fit-element-height.js +1 -1
- package/helpers/format-date.js +3 -1
- package/helpers/get-fraction-depth.js +1 -3
- package/hooks/identity.d.ts +1 -0
- package/hooks/identity.js +1 -0
- package/hooks/index.d.ts +2 -1
- package/hooks/index.js +9 -7
- package/layout/index.js +1 -1
- package/link/index.js +1 -3
- package/loading-overlay/index.d.ts +1 -1
- package/loading-overlay/index.js +1 -1
- package/nav-bar/index.d.ts +1 -0
- package/nav-bar/index.js +1 -1
- package/no-index-mark/index.d.ts +1 -0
- package/package.json +54 -51
- package/pagination/base-pagination.js +18 -20
- package/pagination/index.js +1 -3
- package/pagination/utils.d.ts +3 -3
- package/pagination/utils.js +7 -6
- package/panel/index.js +1 -3
- package/phone-input/index.js +19 -20
- package/price/index.d.ts +1 -0
- package/price/utils.js +1 -3
- package/range/index.js +11 -14
- package/rating/index.js +2 -2
- package/readme.md +7 -7
- package/screen/index.d.ts +12 -47
- package/screen/index.js +30 -67
- package/screen/screen.module.scss +16 -15
- package/screen/slots.d.ts +32 -0
- package/screen/slots.js +64 -0
- package/screen/utils.d.ts +1 -2
- package/select/index.js +5 -7
- package/side-page/index.d.ts +15 -2
- package/side-page/index.js +2 -2
- package/spinner/index.d.ts +1 -1
- package/spinner/index.js +1 -1
- package/spinner/spinner.module.scss +1 -4
- package/styling/fonts.js +1 -3
- package/styling/utils.js +1 -3
- 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 +3 -10
- package/timer/index.d.ts +3 -3
- package/timer/index.js +4 -4
- package/timer/utils.js +1 -4
- package/top-bar/index.js +1 -1
- package/unknown-content/index.d.ts +4 -2
- package/unknown-content/index.js +28 -2
- package/unknown-content/unknown-content.module.scss +214 -120
- package/unknown-content/utils.d.ts +6 -0
- package/unknown-content/utils.js +18 -0
- package/upload/area.js +3 -1
- package/upload/utils.d.ts +2 -2
- package/upload/utils.js +2 -2
- package/with-hint/positioning-hint.d.ts +1 -1
- package/with-hint/positioning-hint.js +1 -1
- package/with-hint/utils.js +5 -7
- package/with-in-viewport-observer/index.js +1 -1
- package/screen/screen-layout.d.ts +0 -57
- package/screen/screen-layout.js +0 -110
package/select/index.js
CHANGED
|
@@ -69,7 +69,7 @@ const Select = (_a) => {
|
|
|
69
69
|
relatedTarget !== menuRef.current && toggleMenu(false);
|
|
70
70
|
}, onKeyDown: (e) => {
|
|
71
71
|
e.key === 'Enter' && toggleMenu(true);
|
|
72
|
-
}, className: cx('field'), endAdornment:
|
|
72
|
+
}, className: cx('field'), endAdornment: react_1.default.createElement(ArrowSVG, { fill: colors_1.COLORS.get('gray38') }) })),
|
|
73
73
|
opened && (loading || options.length > 0) && (react_1.default.createElement(dropdown_1.Dropdown, Object.assign({}, (0, dropdown_2.placeDropdown)(restProps.size), { ref: menuRef, "data-testid": 'select:menu', tabIndex: -1, className: cx('menu'), onBlur: () => {
|
|
74
74
|
toggleMenu(false);
|
|
75
75
|
}, role: 'menu', onKeyDown: (event) => {
|
|
@@ -77,11 +77,9 @@ const Select = (_a) => {
|
|
|
77
77
|
toggleMenu(false);
|
|
78
78
|
fieldRef.current && fieldRef.current.focus();
|
|
79
79
|
}
|
|
80
|
-
} }), loading
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
onSelect && onSelect(option);
|
|
85
|
-
} }, renderOption(option))))))));
|
|
80
|
+
} }), loading ? (react_1.default.createElement(dropdown_loading_1.DropdownLoading, { "data-testid": 'select:loading-area' })) : (options.map((option, index) => (react_1.default.createElement(dropdown_item_1.DropdownItem, { size: optionSize, key: index, role: 'menuitem', onClick: () => {
|
|
81
|
+
toggleMenu(false);
|
|
82
|
+
onSelect && onSelect(option);
|
|
83
|
+
} }, renderOption(option)))))))));
|
|
86
84
|
};
|
|
87
85
|
exports.Select = Select;
|
package/side-page/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { WithBodyScrollLock } from '../_internal/body-scroll';
|
|
3
|
+
import { CSSTransitionProps } from 'react-transition-group/CSSTransition';
|
|
3
4
|
export interface SidePageProps extends WithBodyScrollLock {
|
|
4
5
|
/** Нужно ли показать компонент. */
|
|
5
6
|
shown?: boolean;
|
|
@@ -11,6 +12,18 @@ export interface SidePageProps extends WithBodyScrollLock {
|
|
|
11
12
|
children?: React.ReactNode;
|
|
12
13
|
/** Сработает при закрытии. */
|
|
13
14
|
onClose?: () => void;
|
|
15
|
+
/** Обработчик "onEntering" для CSSTransition. */
|
|
16
|
+
onEntering?: CSSTransitionProps['onEntering'];
|
|
17
|
+
/** Обработчик "onEnter" для CSSTransition. */
|
|
18
|
+
onEnter?: CSSTransitionProps['onEnter'];
|
|
19
|
+
/** Обработчик "onEntered" для CSSTransition. */
|
|
20
|
+
onEntered?: CSSTransitionProps['onEntered'];
|
|
21
|
+
/** Обработчик "onExiting" для CSSTransition. */
|
|
22
|
+
onExiting?: CSSTransitionProps['onExiting'];
|
|
23
|
+
/** Обработчик "onExited" для CSSTransition. */
|
|
24
|
+
onExited?: CSSTransitionProps['onExited'];
|
|
25
|
+
/** Обработчик "onExit" для CSSTransition. */
|
|
26
|
+
onExit?: CSSTransitionProps['onExit'];
|
|
14
27
|
}
|
|
15
28
|
/**
|
|
16
29
|
* Компонент модального окна, прикрепленного к правой стороне экрана.
|
|
@@ -18,7 +31,7 @@ export interface SidePageProps extends WithBodyScrollLock {
|
|
|
18
31
|
* @return Элемент.
|
|
19
32
|
*/
|
|
20
33
|
export declare const SidePage: {
|
|
21
|
-
({ shown, withTransitions, ...restProps }: SidePageProps): JSX.Element;
|
|
34
|
+
({ shown, withTransitions, onEnter, onEntering, onEntered, onExit, onExiting, onExited, ...restProps }: SidePageProps): JSX.Element;
|
|
22
35
|
Header: {
|
|
23
36
|
({ onBack, onClose, ...topBarProps }: import("../top-bar").TopBarProps & {
|
|
24
37
|
onBack?: (() => void) | undefined;
|
|
@@ -28,7 +41,7 @@ export declare const SidePage: {
|
|
|
28
41
|
};
|
|
29
42
|
Body: {
|
|
30
43
|
({ children }: {
|
|
31
|
-
children?: React.ReactNode;
|
|
44
|
+
children?: React.ReactNode; /** Обработчик "onExiting" для CSSTransition. */
|
|
32
45
|
}): JSX.Element;
|
|
33
46
|
displayName: string;
|
|
34
47
|
};
|
package/side-page/index.js
CHANGED
|
@@ -56,9 +56,9 @@ const transitionClasses = {
|
|
|
56
56
|
* @return Элемент.
|
|
57
57
|
*/
|
|
58
58
|
const SidePage = (_a) => {
|
|
59
|
-
var { shown, withTransitions } = _a, restProps = __rest(_a, ["shown", "withTransitions"]);
|
|
59
|
+
var { shown, withTransitions, onEnter, onEntering, onEntered, onExit, onExiting, onExited } = _a, restProps = __rest(_a, ["shown", "withTransitions", "onEnter", "onEntering", "onEntered", "onExit", "onExiting", "onExited"]);
|
|
60
60
|
const transitionDuration = withTransitions ? 300 : 0;
|
|
61
|
-
return (react_1.default.createElement(CSSTransition_1.default, { in: shown, timeout: transitionDuration, classNames: transitionClasses, unmountOnExit: true }, transitionStatus => (react_1.default.createElement(SidePageInner, Object.assign({}, restProps, { transitionStatus, transitionDuration })))));
|
|
61
|
+
return (react_1.default.createElement(CSSTransition_1.default, { in: shown, timeout: transitionDuration, classNames: transitionClasses, unmountOnExit: true, onEntering: onEntering, onEnter: onEnter, onEntered: onEntered, onExit: onExit, onExiting: onExiting, onExited: onExited }, transitionStatus => (react_1.default.createElement(SidePageInner, Object.assign({}, restProps, { transitionStatus, transitionDuration })))));
|
|
62
62
|
};
|
|
63
63
|
exports.SidePage = SidePage;
|
|
64
64
|
/**
|
package/spinner/index.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ export declare const DIAMETERS: Record<Size, number>;
|
|
|
15
15
|
/**
|
|
16
16
|
* Компонент спиннера.
|
|
17
17
|
* @param props Свойства.
|
|
18
|
-
* @return
|
|
18
|
+
* @return Элемент.
|
|
19
19
|
*/
|
|
20
20
|
export declare const Spinner: ({ size, color, className, style, }: SpinnerProps) => JSX.Element;
|
|
21
21
|
export {};
|
package/spinner/index.js
CHANGED
|
@@ -20,7 +20,7 @@ const AVAILABLE_COLORS = ['brand-blue', 'white'];
|
|
|
20
20
|
/**
|
|
21
21
|
* Компонент спиннера.
|
|
22
22
|
* @param props Свойства.
|
|
23
|
-
* @return
|
|
23
|
+
* @return Элемент.
|
|
24
24
|
*/
|
|
25
25
|
const Spinner = ({ size = 'medium', color = DEFAULT_COLOR, className, style, }) => {
|
|
26
26
|
const readySize = (0, lodash_1.has)(exports.DIAMETERS, size) ? size : 'medium';
|
|
@@ -23,10 +23,7 @@ $durations: (
|
|
|
23
23
|
width: #{$diameter}px;
|
|
24
24
|
height: #{$diameter}px;
|
|
25
25
|
.circle {
|
|
26
|
-
animation: dash-#{$sizeKey}
|
|
27
|
-
map-get($durations, $sizeKey)
|
|
28
|
-
linear
|
|
29
|
-
infinite;
|
|
26
|
+
animation: dash-#{$sizeKey} map-get($durations, $sizeKey) linear infinite;
|
|
30
27
|
}
|
|
31
28
|
@keyframes dash-#{$sizeKey} {
|
|
32
29
|
0% {
|
package/styling/fonts.js
CHANGED
|
@@ -7,9 +7,7 @@ exports.weight = exports.lineHeight = exports.size = exports.WEIGHTS = exports.L
|
|
|
7
7
|
const utils_1 = require("./utils");
|
|
8
8
|
const fonts_module_scss_1 = __importDefault(require("./fonts.module.scss"));
|
|
9
9
|
exports.SIZES = new Set([12, 14, 16, 20, 24, 32, 48, 64]);
|
|
10
|
-
exports.LINE_HEIGHTS = new Set([
|
|
11
|
-
16, 20, 24, 28, 32, 40, 60, 80,
|
|
12
|
-
]);
|
|
10
|
+
exports.LINE_HEIGHTS = new Set([16, 20, 24, 28, 32, 40, 60, 80]);
|
|
13
11
|
exports.WEIGHTS = new Set([400, 600, 700]);
|
|
14
12
|
exports.size = (0, utils_1.ClassGetter)(fonts_module_scss_1.default, exports.SIZES.has.bind(exports.SIZES), 'size-');
|
|
15
13
|
exports.lineHeight = (0, utils_1.ClassGetter)(fonts_module_scss_1.default, exports.LINE_HEIGHTS.has.bind(exports.LINE_HEIGHTS), 'line-height-');
|
package/styling/utils.js
CHANGED
|
@@ -14,8 +14,6 @@ const bind_1 = __importDefault(require("classnames/bind"));
|
|
|
14
14
|
*/
|
|
15
15
|
const ClassGetter = (classes, isValidKey, prefix = '') => {
|
|
16
16
|
const cx = bind_1.default.bind(classes);
|
|
17
|
-
return (value) => isValidKey(value)
|
|
18
|
-
? cx(`${prefix}${value}`)
|
|
19
|
-
: undefined;
|
|
17
|
+
return (value) => (isValidKey(value) ? cx(`${prefix}${value}`) : undefined);
|
|
20
18
|
};
|
|
21
19
|
exports.ClassGetter = ClassGetter;
|
package/tabs/index.d.ts
CHANGED
|
@@ -1,29 +1,36 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
* @param props.onSelectItem Функция, вызываемая при выборе элемента списка.
|
|
7
|
-
* @param props.isSelectedItem Функция, определяющая, является ли элемент выбранным.
|
|
8
|
-
* @param props.isDisabledItem Функция, определяющая, является ли элемент невыбираемым.
|
|
9
|
-
* @param props.type Тип таба.
|
|
10
|
-
* @param props.underline Нужно ли подчеркивание группы табов.
|
|
11
|
-
* @param props.stretch Необходимо ли растягивать табы под размер контейнера.
|
|
12
|
-
* @param props.gapSize Размер отступа между табами.
|
|
13
|
-
* @param props.className Внешние классы.
|
|
14
|
-
* @return Элемент.
|
|
15
|
-
*/
|
|
16
|
-
export declare function Tabs<T = any>({ items, getItemName, onSelectItem, isSelectedItem, isDisabledItem, view, underline, stretch, gapSize, className, 'data-testid': dataTestId, }: {
|
|
17
|
-
items?: T[];
|
|
18
|
-
} & {
|
|
19
|
-
getItemName?: (i: T) => string;
|
|
20
|
-
onSelectItem?: (i: T) => void;
|
|
21
|
-
isSelectedItem?: (i: T) => boolean | undefined;
|
|
22
|
-
isDisabledItem?: (i: T) => boolean | undefined;
|
|
23
|
-
view?: 'clean' | 'round';
|
|
24
|
-
underline?: boolean;
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface TabsProps {
|
|
3
|
+
/** Визуальный вариант вкладок. */
|
|
4
|
+
view?: 'clean' | 'clean-underline' | 'round';
|
|
5
|
+
/** Необходимо ли растягивать вкладки под размер контейнера. */
|
|
25
6
|
stretch?: boolean;
|
|
7
|
+
/** Размер отступа между вкладками. */
|
|
26
8
|
gapSize?: 's' | 'm';
|
|
9
|
+
/** Внешние классы. */
|
|
27
10
|
className?: string;
|
|
11
|
+
/** Вкладки. */
|
|
12
|
+
children?: React.ReactNode;
|
|
13
|
+
/** Идентификатор для систем автоматизированного тестирования. */
|
|
14
|
+
'data-testid'?: string;
|
|
15
|
+
}
|
|
16
|
+
export interface TabsItemProps {
|
|
17
|
+
/** Название вкладки. */
|
|
18
|
+
name: string;
|
|
19
|
+
/** Выбрана ли вкладка. */
|
|
20
|
+
selected?: boolean;
|
|
21
|
+
/** Отключена ли вкладка. */
|
|
22
|
+
disabled?: boolean;
|
|
23
|
+
/** Идентификатор для систем автоматизированного тестирования. */
|
|
28
24
|
'data-testid'?: string;
|
|
29
|
-
|
|
25
|
+
/** Обработчик клика. */
|
|
26
|
+
onClick?: React.MouseEventHandler<HTMLLIElement>;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Компонент строки вкладок.
|
|
30
|
+
* @param props Свойства.
|
|
31
|
+
* @return Элемент.
|
|
32
|
+
*/
|
|
33
|
+
export declare const Tabs: {
|
|
34
|
+
({ children, view, stretch, gapSize, className, "data-testid": testId, }: TabsProps): JSX.Element;
|
|
35
|
+
Item: ({ name, selected, disabled, "data-testid": testId, onClick, }: TabsItemProps) => JSX.Element;
|
|
36
|
+
};
|
package/tabs/index.js
CHANGED
|
@@ -1,37 +1,43 @@
|
|
|
1
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
|
+
};
|
|
2
21
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
22
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
23
|
};
|
|
5
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
25
|
exports.Tabs = void 0;
|
|
7
|
-
const react_1 =
|
|
26
|
+
const react_1 = __importStar(require("react"));
|
|
8
27
|
const bind_1 = __importDefault(require("classnames/bind"));
|
|
9
|
-
const lodash_1 = require("lodash");
|
|
10
|
-
const fp_1 = require("lodash/fp");
|
|
11
28
|
const tabs_module_scss_1 = __importDefault(require("./tabs.module.scss"));
|
|
12
29
|
const cx = bind_1.default.bind(tabs_module_scss_1.default);
|
|
13
30
|
/**
|
|
14
|
-
*
|
|
15
|
-
* @param props
|
|
16
|
-
* @
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
*
|
|
21
|
-
* @param props
|
|
22
|
-
* @param props.underline Нужно ли подчеркивание группы табов.
|
|
23
|
-
* @param props.stretch Необходимо ли растягивать табы под размер контейнера.
|
|
24
|
-
* @param props.gapSize Размер отступа между табами.
|
|
25
|
-
* @param props.className Внешние классы.
|
|
31
|
+
* Вкладка.
|
|
32
|
+
* @param props Свойства.
|
|
33
|
+
* @return Элемент.
|
|
34
|
+
*/
|
|
35
|
+
const Tab = ({ name, selected, disabled, 'data-testid': testId = 'tab', onClick, }) => (react_1.default.createElement("li", { className: cx('item', { selected, disabled }), "data-testid": testId, onClick: disabled ? undefined : onClick }, String(name)));
|
|
36
|
+
/**
|
|
37
|
+
* Компонент строки вкладок.
|
|
38
|
+
* @param props Свойства.
|
|
26
39
|
* @return Элемент.
|
|
27
40
|
*/
|
|
28
|
-
|
|
29
|
-
return (react_1.default.createElement("ul", { "data-testid": dataTestId, className: cx('root', `view-${view}`, `gap-${gapSize}`, {
|
|
30
|
-
underline,
|
|
31
|
-
stretch,
|
|
32
|
-
}, className) }, items === null || items === void 0 ? void 0 : items.map((item, index) => (react_1.default.createElement("li", { key: index, onClick: () => onSelectItem === null || onSelectItem === void 0 ? void 0 : onSelectItem(item), className: cx('tab-item', {
|
|
33
|
-
selected: isSelectedItem(item),
|
|
34
|
-
disabled: isDisabledItem(item),
|
|
35
|
-
}), "data-testid": 'tab' }, getItemName(item))))));
|
|
36
|
-
}
|
|
41
|
+
const Tabs = ({ children, view = 'clean', stretch = false, gapSize = 'm', className, 'data-testid': testId = 'tabs', }) => (react_1.default.createElement("ul", { "data-testid": testId, className: cx('root', `view-${view}`, `gap-${gapSize}`, { stretch }, className) }, react_1.Children.toArray(children).filter(child => (0, react_1.isValidElement)(child) && child.type === Tab)));
|
|
37
42
|
exports.Tabs = Tabs;
|
|
43
|
+
exports.Tabs.Item = Tab;
|
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
|
@@ -45,7 +45,7 @@ const isVisible = (value) => !(0, lodash_1.isNil)(value) && `${value}` !== '';
|
|
|
45
45
|
* @param modifiers Данные визуальных модификаторов.
|
|
46
46
|
* @return Строка с css-классами.
|
|
47
47
|
*/
|
|
48
|
-
const modifiersToClasses = ({ disabled, failed, focused, variant }) => cx(disabled && 'disabled', failed && 'failed', focused && 'focused', variant && `variant-${variant}`);
|
|
48
|
+
const modifiersToClasses = ({ disabled, failed, focused, variant, }) => cx(disabled && 'disabled', failed && 'failed', focused && 'focused', variant && `variant-${variant}`);
|
|
49
49
|
/**
|
|
50
50
|
* Компонент текстового поля.
|
|
51
51
|
* @param props Свойства.
|
|
@@ -73,20 +73,13 @@ exports.TextField = (0, react_1.forwardRef)(function TextField({ autoFocus, capt
|
|
|
73
73
|
react_1.default.createElement("div", { "data-testid": 'text-field:block', className: cx('reset', 'input-block', commonModifyClasses, size && `size-${size}`, focused && classes.blockFocused, multiline && 'multiline', withLabel && 'with-label', variant === 'desktop' && rounds !== 'none' && shapes_1.SmallRounds[rounds]), onClick: event => {
|
|
74
74
|
const input = baseInputRef.current;
|
|
75
75
|
onClick === null || onClick === void 0 ? void 0 : onClick(event);
|
|
76
|
-
input
|
|
77
|
-
&& !disabled
|
|
78
|
-
&& input !== document.activeElement
|
|
79
|
-
&& input.focus();
|
|
76
|
+
input && !disabled && input !== document.activeElement && input.focus();
|
|
80
77
|
} },
|
|
81
78
|
!multiline && Boolean(startAdornment) && (react_1.default.createElement(box_1.Box, { display: 'flex', alignItems: 'center', marginRight: 4 }, startAdornment)),
|
|
82
79
|
react_1.default.createElement("div", { className: cx('main-column') },
|
|
83
80
|
withLabel && (react_1.default.createElement("label", { className: cx('label', commonModifyClasses, hasValue && 'filled', labelAsPlaceholder && 'as-placeholder'), children: label })),
|
|
84
81
|
react_1.default.createElement("div", { className: cx('input-wrapper') },
|
|
85
|
-
react_1.default.createElement(base_input_1.BaseInput, Object.assign({}, baseInputProps, { "data-testid": 'text-field:field', multiline: multiline, ref: baseInputRef, placeholder: withLabel && labelAsPlaceholder
|
|
86
|
-
? undefined
|
|
87
|
-
: placeholder, restPlaceholder: withLabel && labelAsPlaceholder
|
|
88
|
-
? undefined
|
|
89
|
-
: restPlaceholder, autoFocus: autoFocus, className: cx('base-input', commonModifyClasses, classes.baseInput, size && `size-${size}`), defaultValue: defaultValue, value: value, readOnly: readOnly, disabled: disabled, onFocus: (event) => {
|
|
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) => {
|
|
90
83
|
(0, lodash_1.isFunction)(onFocus) && onFocus(event);
|
|
91
84
|
toggleHasValue(Boolean(event.target.value));
|
|
92
85
|
toggleFocused(true);
|
package/timer/index.d.ts
CHANGED
|
@@ -9,8 +9,8 @@ export interface TimerProps {
|
|
|
9
9
|
timeout?: number;
|
|
10
10
|
}
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
13
|
-
* @param props
|
|
12
|
+
* Компонент для вывода оставшегося времени до целевой временной отметки.
|
|
13
|
+
* @param props Свойства.
|
|
14
14
|
* @return Элемент.
|
|
15
15
|
*/
|
|
16
|
-
export declare const Timer: ({ date, format, timeout
|
|
16
|
+
export declare const Timer: ({ date, format, timeout }: TimerProps) => JSX.Element;
|
package/timer/index.js
CHANGED
|
@@ -23,11 +23,11 @@ exports.Timer = void 0;
|
|
|
23
23
|
const react_1 = __importStar(require("react"));
|
|
24
24
|
const utils_1 = require("./utils");
|
|
25
25
|
/**
|
|
26
|
-
*
|
|
27
|
-
* @param props
|
|
26
|
+
* Компонент для вывода оставшегося времени до целевой временной отметки.
|
|
27
|
+
* @param props Свойства.
|
|
28
28
|
* @return Элемент.
|
|
29
29
|
*/
|
|
30
|
-
const Timer = ({ date, format = utils_1.formatDistance, timeout = 1000
|
|
30
|
+
const Timer = ({ date, format = utils_1.formatDistance, timeout = 1000 }) => {
|
|
31
31
|
const [distance, setDistance] = (0, react_1.useState)((0, utils_1.getDistanceToNow)(date));
|
|
32
32
|
(0, react_1.useEffect)(() => {
|
|
33
33
|
const timerId = setInterval(() => {
|
|
@@ -36,6 +36,6 @@ const Timer = ({ date, format = utils_1.formatDistance, timeout = 1000, }) => {
|
|
|
36
36
|
setDistance((0, utils_1.getDistanceToNow)(date));
|
|
37
37
|
return () => clearInterval(timerId);
|
|
38
38
|
}, [timeout]);
|
|
39
|
-
return
|
|
39
|
+
return react_1.default.createElement(react_1.default.Fragment, null, format(distance));
|
|
40
40
|
};
|
|
41
41
|
exports.Timer = Timer;
|
package/timer/utils.js
CHANGED
|
@@ -14,10 +14,7 @@ const UNITS = ['day', 'hour', 'minute', 'second'];
|
|
|
14
14
|
* @param distance Оставшееся время.
|
|
15
15
|
* @return Отформатированное время.
|
|
16
16
|
*/
|
|
17
|
-
const formatDistance = ({ days, hours, minutes, seconds }) => [
|
|
18
|
-
days,
|
|
19
|
-
...[hours % 24, minutes % 60, seconds % 60].map(s => `${s}`.padStart(2, '0')),
|
|
20
|
-
].join(':');
|
|
17
|
+
const formatDistance = ({ days, hours, minutes, seconds }) => [days, ...[hours % 24, minutes % 60, seconds % 60].map(s => `${s}`.padStart(2, '0'))].join(':');
|
|
21
18
|
exports.formatDistance = formatDistance;
|
|
22
19
|
/**
|
|
23
20
|
* Возвращает объект с данными об оставшемся времени от текущего момента.
|
package/top-bar/index.js
CHANGED
|
@@ -43,7 +43,7 @@ const TopBar = ({ divided, size = 'm', title, subtitle, buttonsProps: { start, s
|
|
|
43
43
|
hasStartSecondary ? react_1.default.createElement(exports.IconButton, Object.assign({}, startSecondary)) : secondaryStub,
|
|
44
44
|
react_1.default.createElement("div", { className: cx('main-section') },
|
|
45
45
|
react_1.default.createElement("div", { className: cx('title', 'ellipsis') }, title),
|
|
46
|
-
Boolean(subtitle) &&
|
|
46
|
+
Boolean(subtitle) && react_1.default.createElement("div", { className: cx('subtitle', 'ellipsis') }, subtitle)),
|
|
47
47
|
hasEndSecondary ? react_1.default.createElement(exports.IconButton, Object.assign({}, endSecondary)) : secondaryStub,
|
|
48
48
|
hasEnd ? react_1.default.createElement(exports.IconButton, Object.assign({}, end)) : stub));
|
|
49
49
|
};
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
export interface UnknownContentProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
3
3
|
/** Строка с html-версткой. */
|
|
4
|
-
markup
|
|
4
|
+
markup?: string;
|
|
5
|
+
/** Содержимое. */
|
|
6
|
+
children?: React.ReactNode;
|
|
5
7
|
}
|
|
6
8
|
/**
|
|
7
9
|
* Компонент, стилизующий верстку по гайдам.
|
|
8
10
|
* @param props Свойства.
|
|
9
11
|
* @return Элемент.
|
|
10
12
|
*/
|
|
11
|
-
export declare const UnknownContent: ({ markup, className }: UnknownContentProps) => JSX.Element;
|
|
13
|
+
export declare const UnknownContent: ({ markup, children, className }: UnknownContentProps) => JSX.Element;
|
package/unknown-content/index.js
CHANGED
|
@@ -1,16 +1,42 @@
|
|
|
1
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
|
+
};
|
|
2
21
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
22
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
23
|
};
|
|
5
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
25
|
exports.UnknownContent = void 0;
|
|
7
|
-
const react_1 =
|
|
26
|
+
const react_1 = __importStar(require("react"));
|
|
8
27
|
const classnames_1 = __importDefault(require("classnames"));
|
|
9
28
|
const unknown_content_module_scss_1 = __importDefault(require("./unknown-content.module.scss"));
|
|
29
|
+
const utils_1 = require("./utils");
|
|
10
30
|
/**
|
|
11
31
|
* Компонент, стилизующий верстку по гайдам.
|
|
12
32
|
* @param props Свойства.
|
|
13
33
|
* @return Элемент.
|
|
14
34
|
*/
|
|
15
|
-
const UnknownContent = ({ markup, className }) =>
|
|
35
|
+
const UnknownContent = ({ markup, children, className }) => {
|
|
36
|
+
const ref = (0, react_1.useRef)(null);
|
|
37
|
+
(0, react_1.useEffect)(() => {
|
|
38
|
+
ref.current && (0, utils_1.setTableRowLabels)(ref.current);
|
|
39
|
+
});
|
|
40
|
+
return (react_1.default.createElement("div", Object.assign({ ref: ref, className: (0, classnames_1.default)(unknown_content_module_scss_1.default.root, className) }, (children ? { children } : { dangerouslySetInnerHTML: { __html: markup || '' } }))));
|
|
41
|
+
};
|
|
16
42
|
exports.UnknownContent = UnknownContent;
|