@sima-land/ui-nucleons 45.0.0-alpha.4 → 45.0.0-alpha.5
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 +5 -27
- package/_internal/dropdown-loading/index.js +2 -3
- package/_internal/page-scroll-lock/context.js +3 -25
- package/alert/index.d.ts +2 -2
- package/alert/index.js +4 -30
- package/arrow-button/index.js +18 -19
- package/autocomplete/autocomplete.js +49 -76
- package/autocomplete-deprecated/index.d.ts +1 -1
- package/autocomplete-deprecated/index.js +43 -67
- package/avatar/avatar.module.scss +3 -1
- package/avatar/index.d.ts +1 -1
- package/avatar/index.js +7 -33
- package/avatar/user.d.ts +1 -1
- package/avatar/user.js +8 -29
- package/base-input/base-input.js +5 -31
- package/base-input-deprecated/index.d.ts +2 -2
- package/base-input-deprecated/index.js +8 -34
- package/bordered-layout/index.d.ts +1 -1
- package/bordered-layout/index.js +2 -3
- package/bottom-bar/bottom-bar.js +2 -3
- package/box/index.d.ts +1 -1
- package/box/index.js +2 -2
- package/button/index.d.ts +2 -2
- package/button/index.js +6 -32
- package/card/index.js +2 -8
- package/card/slots.d.ts +1 -1
- package/card/slots.js +9 -31
- package/carousel/draggable.d.ts +1 -1
- package/carousel/draggable.js +5 -28
- package/carousel/index.d.ts +1 -1
- package/carousel/index.js +17 -43
- package/checkbox/index.d.ts +2 -2
- package/checkbox/index.js +3 -29
- package/checkbox-field/index.d.ts +2 -2
- package/checkbox-field/index.js +3 -31
- package/chips/index.d.ts +1 -1
- package/chips/index.js +3 -25
- package/chips/item.d.ts +1 -1
- package/chips/item.js +3 -5
- package/clean-buttons/index.js +6 -28
- package/dot-nav/index.d.ts +1 -1
- package/dot-nav/index.js +12 -34
- package/dropdown/index.d.ts +2 -2
- package/dropdown/index.js +3 -26
- package/dropdown-item/index.d.ts +1 -1
- package/dropdown-item/index.js +4 -9
- package/expandable/index.d.ts +2 -2
- package/expandable/index.js +8 -36
- package/field-block/index.js +2 -9
- package/field-grid/index.d.ts +1 -1
- package/field-grid/index.js +43 -65
- package/file-icon/index.d.ts +1 -1
- package/file-icon/index.js +5 -10
- package/group-overflow/index.js +6 -30
- package/helpers/define-slots.d.ts +1 -1
- package/helpers/events.d.ts +1 -1
- package/helpers/on.d.ts +1 -1
- package/hint/hint-view.js +3 -3
- package/hint/hint.js +3 -8
- package/hint-deprecated/index.d.ts +2 -2
- package/hint-deprecated/index.js +3 -26
- package/hooks/breakpoint/index.js +3 -25
- package/info-text/index.js +15 -42
- package/input/index.js +8 -30
- package/layout/layout.js +2 -2
- package/layout/legacy.d.ts +5 -5
- package/layout/legacy.js +3 -25
- package/link/index.d.ts +6 -3
- package/link/index.js +3 -25
- package/loading-overlay/index.d.ts +1 -1
- package/loading-overlay/index.js +2 -3
- package/masked-field/index.d.ts +2 -2
- package/masked-field/index.js +3 -25
- package/masked-input/masked-input.js +3 -25
- package/modal/index.d.ts +1 -1
- package/modal/index.js +3 -10
- package/modal/slots.js +6 -29
- package/modal-overlay/index.js +3 -26
- package/no-index/index.d.ts +3 -3
- package/no-index/index.js +4 -8
- package/no-index-mark/index.d.ts +2 -2
- package/no-index-mark/index.js +7 -6
- package/package.json +6 -11
- package/pagination/index.d.ts +4 -20
- package/pagination/index.js +8 -15
- package/pagination/pagination-item.d.ts +8 -0
- package/pagination/pagination-item.js +31 -0
- package/pagination/pagination-item.module.scss +49 -0
- package/pagination/pagination.d.ts +8 -0
- package/pagination/pagination.js +78 -0
- package/pagination/pagination.module.scss +14 -70
- package/pagination/types.d.ts +28 -0
- package/pagination/types.js +2 -0
- package/pagination/utils.d.ts +15 -43
- package/pagination/utils.js +38 -87
- package/{pagination → pagination-deprecated}/base-pagination.d.ts +6 -1
- package/{pagination → pagination-deprecated}/base-pagination.js +33 -33
- package/pagination-deprecated/index.d.ts +22 -0
- package/pagination-deprecated/index.js +15 -0
- package/{pagination → pagination-deprecated}/page-button.d.ts +2 -1
- package/{pagination → pagination-deprecated}/page-button.js +3 -5
- package/pagination-deprecated/pagination.module.scss +76 -0
- package/pagination-deprecated/utils.d.ts +58 -0
- package/pagination-deprecated/utils.js +124 -0
- package/panel/index.js +3 -6
- package/phone-input/images/armenia.png +0 -0
- package/phone-input/images/azerbaijan.png +0 -0
- package/phone-input/images/belarus.png +0 -0
- package/phone-input/images/georgia.png +0 -0
- package/phone-input/images/kazakhstan.png +0 -0
- package/phone-input/images/kyrgyzstan.png +0 -0
- package/phone-input/images/moldova.png +0 -0
- package/phone-input/images/other.png +0 -0
- package/phone-input/images/russia.png +0 -0
- package/phone-input/images/tajikistan.png +0 -0
- package/phone-input/images/turkmenistan.png +0 -0
- package/phone-input/images/ukraine.png +0 -0
- package/phone-input/images/uzbekistan.png +0 -0
- package/phone-input/phone-input.js +13 -37
- package/phone-input/presets.js +2 -0
- package/phone-input-deprecated/index.d.ts +1 -1
- package/phone-input-deprecated/index.js +31 -57
- package/plate/index.d.ts +2 -2
- package/plate/index.js +3 -25
- package/popup/popup-view.js +3 -6
- package/popup/popup.js +4 -26
- package/portal/index.d.ts +1 -1
- package/price/index.js +2 -2
- package/radio-button/index.js +2 -4
- package/range/index.d.ts +1 -1
- package/range/index.js +6 -33
- package/rating/index.d.ts +1 -1
- package/rating/index.js +4 -9
- package/readme.md +4 -67
- package/screen/index.d.ts +5 -5
- package/screen/index.js +11 -37
- package/screen/slots.d.ts +3 -3
- package/screen/slots.js +9 -31
- package/select/parts/block.js +6 -28
- package/select/parts/button.js +7 -29
- package/select/parts/menu.js +12 -33
- package/select/select.js +4 -28
- package/select-deprecated/index.d.ts +1 -1
- package/select-deprecated/index.js +32 -56
- package/side-page/index.js +4 -30
- package/side-page/slots.js +4 -4
- package/spinner/index.d.ts +1 -1
- package/spinner/index.js +3 -5
- package/spinner/spinner.module.scss +3 -1
- package/stepper/index.d.ts +2 -2
- package/stepper/index.js +11 -38
- package/stroked-svg/index.d.ts +2 -2
- package/stroked-svg/index.js +3 -27
- package/styling/sizes.module.scss +3 -1
- package/super-ellipse-clip-path/index.js +2 -8
- package/switcher-row/index.js +5 -10
- package/tabs/index.d.ts +1 -1
- package/tabs/index.js +4 -26
- package/text/index.d.ts +2 -2
- package/text/index.js +3 -25
- package/text-button/index.d.ts +2 -2
- package/text-button/index.js +4 -7
- package/text-field/index.d.ts +2 -2
- package/text-field/index.js +25 -55
- package/textarea/index.js +4 -26
- package/timer/index.d.ts +1 -1
- package/timer/index.js +3 -25
- package/toggle/index.d.ts +2 -2
- package/toggle/index.js +3 -27
- package/tooltip/index.d.ts +2 -2
- package/tooltip/index.js +4 -28
- package/top-bar/top-bar.js +5 -45
- package/top-bar/utils.d.ts +2 -2
- package/top-bar/utils.js +6 -28
- package/touch-slider/index.d.ts +1 -1
- package/touch-slider/index.js +2 -4
- package/unknown-content/index.d.ts +1 -1
- package/unknown-content/index.js +3 -25
- package/upload-area/upload-area.js +8 -38
- package/with-hint/index.d.ts +1 -1
- package/with-hint/index.js +3 -28
- package/with-hint/positioning-hint.d.ts +1 -1
- package/with-hint/positioning-hint.js +3 -25
- package/with-tooltip/index.d.ts +1 -1
- package/with-tooltip/index.js +6 -31
- package/with-tooltip/positioning-tooltip.d.ts +1 -1
- package/with-tooltip/positioning-tooltip.js +4 -26
- package/file-icon/unknown.svg +0 -9
- package/rating/star.svg +0 -3
- package/upload-area/upload.svg +0 -6
package/screen/slots.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
2
|
import { TopBarProps } from '../top-bar';
|
|
3
3
|
export interface HeaderSlotProps extends TopBarProps {
|
|
4
4
|
/** Будет вызвана при нажатии на кнопку-стрелку. */
|
|
@@ -15,9 +15,9 @@ export declare const HeaderSlot: ({ divided, title, subtitle, buttons, onBack, o
|
|
|
15
15
|
/**
|
|
16
16
|
* Слот основного контента экрана.
|
|
17
17
|
*/
|
|
18
|
-
export declare const BodySlot:
|
|
18
|
+
export declare const BodySlot: import("react").ForwardRefExoticComponent<{
|
|
19
19
|
children?: React.ReactNode;
|
|
20
|
-
} &
|
|
20
|
+
} & import("react").RefAttributes<HTMLDivElement | null>>;
|
|
21
21
|
/**
|
|
22
22
|
* Слот футера экрана.
|
|
23
23
|
* @param props Свойства.
|
package/screen/slots.js
CHANGED
|
@@ -1,27 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
2
|
var __rest = (this && this.__rest) || function (s, e) {
|
|
26
3
|
var t = {};
|
|
27
4
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
@@ -38,10 +15,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
38
15
|
};
|
|
39
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
17
|
exports.FooterSlot = exports.BodySlot = exports.HeaderSlot = void 0;
|
|
41
|
-
const
|
|
18
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
19
|
+
const react_1 = require("react");
|
|
42
20
|
const lodash_1 = require("lodash");
|
|
43
|
-
const
|
|
44
|
-
const
|
|
21
|
+
const ArrowLeft_1 = __importDefault(require("@sima-land/ui-quarks/icons/24x24/Stroked/ArrowLeft"));
|
|
22
|
+
const Cross_1 = __importDefault(require("@sima-land/ui-quarks/icons/24x24/Stroked/Cross"));
|
|
45
23
|
const page_scroll_lock_1 = require("../_internal/page-scroll-lock");
|
|
46
24
|
const hooks_1 = require("../hooks");
|
|
47
25
|
const loading_overlay_1 = require("../loading-overlay");
|
|
@@ -55,11 +33,11 @@ const top_bar_1 = require("../top-bar");
|
|
|
55
33
|
*/
|
|
56
34
|
const HeaderSlot = (_a) => {
|
|
57
35
|
var { divided, title, subtitle, buttons, onBack, onClose } = _a, restProps = __rest(_a, ["divided", "title", "subtitle", "buttons", "onBack", "onClose"]);
|
|
58
|
-
return (
|
|
36
|
+
return ((0, jsx_runtime_1.jsx)(top_bar_1.TopBar, Object.assign({}, restProps, { size: 's', title: title, subtitle: subtitle, divided: divided, buttons: Object.assign(Object.assign({}, buttons), { start: onBack
|
|
59
37
|
? {
|
|
60
38
|
// ВАЖНО: не подмешиваем свойства из buttons.start
|
|
61
39
|
// чтобы не распылять конфигурацию одной и той же кнопки по нескольким местам
|
|
62
|
-
icon:
|
|
40
|
+
icon: (0, jsx_runtime_1.jsx)(ArrowLeft_1.default, {}),
|
|
63
41
|
onClick: onBack,
|
|
64
42
|
'aria-label': 'Вернуться назад',
|
|
65
43
|
'data-testid': 'screen:back',
|
|
@@ -68,7 +46,7 @@ const HeaderSlot = (_a) => {
|
|
|
68
46
|
? {
|
|
69
47
|
// ВАЖНО: не подмешиваем свойства из buttons.end
|
|
70
48
|
// чтобы не распылять конфигурацию одной и той же кнопки по нескольким местам
|
|
71
|
-
icon:
|
|
49
|
+
icon: (0, jsx_runtime_1.jsx)(Cross_1.default, {}),
|
|
72
50
|
onClick: onClose,
|
|
73
51
|
'aria-label': `Закрыть ${title || ''}`.trim(),
|
|
74
52
|
'data-testid': 'screen:close',
|
|
@@ -90,12 +68,12 @@ exports.BodySlot = (0, react_1.forwardRef)(function BodySlot({ children }, outer
|
|
|
90
68
|
(0, hooks_1.useInfiniteScroll)(ref, { onFullScroll, threshold: fullScrollThreshold });
|
|
91
69
|
return (
|
|
92
70
|
// ВАЖНО: элемент с ref должен выводиться всегда (без условий), т.к. он нужен для блокировки прокрутки
|
|
93
|
-
|
|
71
|
+
(0, jsx_runtime_1.jsx)("div", Object.assign({ ref: ref, className: screen_module_scss_1.default.body, "data-testid": 'screen:body' }, { children: loading ? ((0, jsx_runtime_1.jsx)(loading_overlay_1.LoadingOverlay, Object.assign({}, loadingOverlayProps, { fill: false, style: { height: '100%' } }))) : (children) })));
|
|
94
72
|
});
|
|
95
73
|
/**
|
|
96
74
|
* Слот футера экрана.
|
|
97
75
|
* @param props Свойства.
|
|
98
76
|
* @return Элемент.
|
|
99
77
|
*/
|
|
100
|
-
const FooterSlot = ({ children }) =>
|
|
78
|
+
const FooterSlot = ({ children }) => (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: children });
|
|
101
79
|
exports.FooterSlot = FooterSlot;
|
package/select/parts/block.js
CHANGED
|
@@ -1,38 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
4
|
};
|
|
28
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
6
|
exports.SelectFieldBlock = void 0;
|
|
30
|
-
const
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const react_1 = require("react");
|
|
31
9
|
const utils_1 = require("../utils");
|
|
32
10
|
const field_block_1 = require("../../field-block");
|
|
33
11
|
const colors_1 = require("../../colors");
|
|
34
|
-
const
|
|
35
|
-
const
|
|
12
|
+
const Up_1 = __importDefault(require("@sima-land/ui-quarks/icons/16x16/Stroked/Arrows/Up"));
|
|
13
|
+
const Down_1 = __importDefault(require("@sima-land/ui-quarks/icons/16x16/Stroked/Arrows/Down"));
|
|
36
14
|
const block_module_scss_1 = __importDefault(require("./block.module.scss"));
|
|
37
15
|
const classnames_1 = __importDefault(require("classnames"));
|
|
38
16
|
/**
|
|
@@ -44,12 +22,12 @@ function SelectFieldBlock(props) {
|
|
|
44
22
|
var _a;
|
|
45
23
|
const binding = (0, react_1.useContext)(utils_1.SelectContext);
|
|
46
24
|
const [focused, setFocused] = (0, react_1.useState)(false);
|
|
47
|
-
const ArrowSVG = binding.opened ?
|
|
25
|
+
const ArrowSVG = binding.opened ? Up_1.default : Down_1.default;
|
|
48
26
|
// @todo прокидывать ref в props.blockRef при необходимости
|
|
49
27
|
const ref = (0, react_1.useRef)(null);
|
|
50
28
|
(0, react_1.useImperativeHandle)(binding.anchorRef, () => ref.current);
|
|
51
29
|
(0, react_1.useImperativeHandle)(binding.openerRef, () => ref.current);
|
|
52
|
-
return (
|
|
30
|
+
return ((0, jsx_runtime_1.jsx)(field_block_1.FieldBlock, Object.assign({ label: binding.label, adornmentEnd: (0, jsx_runtime_1.jsx)(ArrowSVG, { fill: colors_1.COLORS.get('basic-gray24') }) }, props, { failed: binding.failed, disabled: binding.disabled, fixedHeight: true, blockRef: ref, blockProps: Object.assign(Object.assign({}, props === null || props === void 0 ? void 0 : props.blockProps), { onFocus: event => {
|
|
53
31
|
var _a, _b;
|
|
54
32
|
setFocused(true);
|
|
55
33
|
(_b = (_a = props.blockProps) === null || _a === void 0 ? void 0 : _a.onFocus) === null || _b === void 0 ? void 0 : _b.call(_a, event);
|
package/select/parts/button.js
CHANGED
|
@@ -1,27 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
2
|
var __rest = (this && this.__rest) || function (s, e) {
|
|
26
3
|
var t = {};
|
|
27
4
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
@@ -38,11 +15,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
38
15
|
};
|
|
39
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
17
|
exports.SelectTextButton = void 0;
|
|
41
|
-
const
|
|
18
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
19
|
+
const react_1 = require("react");
|
|
42
20
|
const text_button_1 = require("../../text-button");
|
|
43
21
|
const utils_1 = require("../utils");
|
|
44
|
-
const
|
|
45
|
-
const
|
|
22
|
+
const Up_1 = __importDefault(require("@sima-land/ui-quarks/icons/16x16/Stroked/Arrows/Up"));
|
|
23
|
+
const Down_1 = __importDefault(require("@sima-land/ui-quarks/icons/16x16/Stroked/Arrows/Down"));
|
|
46
24
|
/**
|
|
47
25
|
* Компонент открывашки в виде текстовой кнопки.
|
|
48
26
|
* @param props Свойства.
|
|
@@ -52,11 +30,11 @@ function SelectTextButton(_a) {
|
|
|
52
30
|
var { buttonRef: buttonRefProp, children, onKeyDown, onMouseDown } = _a, props = __rest(_a, ["buttonRef", "children", "onKeyDown", "onMouseDown"]);
|
|
53
31
|
const buttonRef = (0, react_1.useRef)(null);
|
|
54
32
|
const binding = (0, react_1.useContext)(utils_1.SelectContext);
|
|
55
|
-
const ArrowSVG = binding.opened ?
|
|
33
|
+
const ArrowSVG = binding.opened ? Up_1.default : Down_1.default;
|
|
56
34
|
(0, react_1.useImperativeHandle)(buttonRefProp, () => buttonRef.current);
|
|
57
35
|
(0, react_1.useImperativeHandle)(binding.anchorRef, () => buttonRef.current);
|
|
58
36
|
(0, react_1.useImperativeHandle)(binding.openerRef, () => buttonRef.current);
|
|
59
|
-
return (
|
|
37
|
+
return ((0, jsx_runtime_1.jsx)(text_button_1.TextButton, Object.assign({ iconGutter: 4, endIcon: ArrowSVG }, props, { as: 'button', onMouseDown: event => {
|
|
60
38
|
var _a;
|
|
61
39
|
(_a = binding.onMouseDown) === null || _a === void 0 ? void 0 : _a.call(binding, event);
|
|
62
40
|
onMouseDown === null || onMouseDown === void 0 ? void 0 : onMouseDown(event);
|
|
@@ -64,6 +42,6 @@ function SelectTextButton(_a) {
|
|
|
64
42
|
var _a;
|
|
65
43
|
(_a = binding.onKeyDown) === null || _a === void 0 ? void 0 : _a.call(binding, event);
|
|
66
44
|
onKeyDown === null || onKeyDown === void 0 ? void 0 : onKeyDown(event);
|
|
67
|
-
}, disabled: binding.disabled, buttonRef: buttonRef, role: 'combobox' }
|
|
45
|
+
}, disabled: binding.disabled, buttonRef: buttonRef, role: 'combobox' }, { children: children !== null && children !== void 0 ? children : (binding.value || binding.label) })));
|
|
68
46
|
}
|
|
69
47
|
exports.SelectTextButton = SelectTextButton;
|
package/select/parts/menu.js
CHANGED
|
@@ -1,27 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
2
|
var __rest = (this && this.__rest) || function (s, e) {
|
|
26
3
|
var t = {};
|
|
27
4
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
@@ -38,7 +15,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
38
15
|
};
|
|
39
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
17
|
exports.SelectMenu = void 0;
|
|
41
|
-
const react_1 =
|
|
18
|
+
const react_1 = require("react");
|
|
19
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
20
|
+
const react_2 = require("react");
|
|
42
21
|
const dropdown_1 = require("../../dropdown");
|
|
43
22
|
const dropdown_item_1 = require("../../dropdown-item");
|
|
44
23
|
const utils_1 = require("../../dropdown-item/utils");
|
|
@@ -56,13 +35,13 @@ const MenuItemAttr = {
|
|
|
56
35
|
*/
|
|
57
36
|
function SelectMenu(_a) {
|
|
58
37
|
var { loading, children, menuRef, value, onKeyDown, onItemSelect } = _a, restProps = __rest(_a, ["loading", "children", "menuRef", "value", "onKeyDown", "onItemSelect"]);
|
|
59
|
-
const ref = (0,
|
|
60
|
-
const osComponentRef = (0,
|
|
61
|
-
const [activeIndex, setActiveIndex] = (0,
|
|
62
|
-
const items =
|
|
63
|
-
(0,
|
|
38
|
+
const ref = (0, react_2.useRef)(null);
|
|
39
|
+
const osComponentRef = (0, react_2.useRef)(null);
|
|
40
|
+
const [activeIndex, setActiveIndex] = (0, react_2.useState)(-1);
|
|
41
|
+
const items = react_2.Children.toArray(children).filter(utils_1.DropdownItemUtils.is);
|
|
42
|
+
(0, react_2.useImperativeHandle)(menuRef, () => ref.current);
|
|
64
43
|
// прокрутка до элемента списка
|
|
65
|
-
(0,
|
|
44
|
+
(0, react_2.useEffect)(() => {
|
|
66
45
|
var _a, _b;
|
|
67
46
|
const menu = ref.current;
|
|
68
47
|
const itemSelector = `[${MenuItemAttr.name}="${MenuItemAttr.value}"]`;
|
|
@@ -74,7 +53,7 @@ function SelectMenu(_a) {
|
|
|
74
53
|
});
|
|
75
54
|
}
|
|
76
55
|
}, [activeIndex]);
|
|
77
|
-
const handleMenuKeyDown = (0,
|
|
56
|
+
const handleMenuKeyDown = (0, react_2.useCallback)(event => {
|
|
78
57
|
onKeyDown === null || onKeyDown === void 0 ? void 0 : onKeyDown(event);
|
|
79
58
|
switch (event.code) {
|
|
80
59
|
case 'Enter': {
|
|
@@ -93,13 +72,13 @@ function SelectMenu(_a) {
|
|
|
93
72
|
break;
|
|
94
73
|
}
|
|
95
74
|
}, [items, activeIndex, onKeyDown]);
|
|
96
|
-
const handleItemClick = (0,
|
|
75
|
+
const handleItemClick = (0, react_2.useCallback)((item) => item.props.disabled
|
|
97
76
|
? undefined
|
|
98
77
|
: event => {
|
|
99
78
|
var _a, _b;
|
|
100
79
|
(_b = (_a = item.props).onClick) === null || _b === void 0 ? void 0 : _b.call(_a, event);
|
|
101
80
|
onItemSelect === null || onItemSelect === void 0 ? void 0 : onItemSelect(item);
|
|
102
81
|
}, [onItemSelect]);
|
|
103
|
-
return (
|
|
82
|
+
return ((0, jsx_runtime_1.jsx)(dropdown_1.Dropdown, Object.assign({}, restProps, { ref: ref, tabIndex: 0, role: 'listbox', onKeyDown: handleMenuKeyDown, className: (0, classnames_1.default)(menu_module_scss_1.default.menu, restProps.className), customScrollbarProps: { osComponentRef } }, { children: loading ? ((0, jsx_runtime_1.jsx)(dropdown_loading_1.DropdownLoading, { "data-testid": 'select:loading-area' })) : (items.map((item, index) => ((0, react_1.createElement)(dropdown_item_1.DropdownItem, Object.assign({ checked: activeIndex === index, selected: value === utils_1.DropdownItemUtils.getValue(item) }, item.props, { key: index, role: 'option', onClick: handleItemClick(item) }, { [MenuItemAttr.name]: MenuItemAttr.value }))))) })));
|
|
104
83
|
}
|
|
105
84
|
exports.SelectMenu = SelectMenu;
|
package/select/select.js
CHANGED
|
@@ -1,27 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
2
|
var __rest = (this && this.__rest) || function (s, e) {
|
|
26
3
|
var t = {};
|
|
27
4
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
@@ -35,7 +12,8 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
35
12
|
};
|
|
36
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
14
|
exports.Select = void 0;
|
|
38
|
-
const
|
|
15
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
16
|
+
const react_1 = require("react");
|
|
39
17
|
const utils_1 = require("./utils");
|
|
40
18
|
const identity_1 = require("../hooks/identity");
|
|
41
19
|
const utils_2 = require("../dropdown-item/utils");
|
|
@@ -49,7 +27,7 @@ const utils_3 = require("../dropdown/utils");
|
|
|
49
27
|
* @param props Свойства.
|
|
50
28
|
* @return Элемент.
|
|
51
29
|
*/
|
|
52
|
-
function Select({ children, disabled, failed, loading, onValueChange, onMenuToggle, value, defaultValue, label, opener =
|
|
30
|
+
function Select({ children, disabled, failed, loading, onValueChange, onMenuToggle, value, defaultValue, label, opener = (0, jsx_runtime_1.jsx)(block_1.SelectFieldBlock, {}), renderValue = v => v, dropdownProps, }) {
|
|
53
31
|
// @todo по аналогии с <select /> надо проверять, есть ли значение в списке переданных
|
|
54
32
|
const [initialValue] = (0, react_1.useState)(() => { var _a; return (_a = value !== null && value !== void 0 ? value : defaultValue) !== null && _a !== void 0 ? _a : ''; });
|
|
55
33
|
const [currentValue, setCurrentValue] = (0, react_1.useState)(initialValue);
|
|
@@ -136,9 +114,7 @@ function Select({ children, disabled, failed, loading, onValueChange, onMenuTogg
|
|
|
136
114
|
setNeedMenu(false);
|
|
137
115
|
(_a = openerRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
138
116
|
} });
|
|
139
|
-
return (
|
|
140
|
-
react_1.default.createElement(utils_1.SelectContext.Provider, { value: openerBinding }, (0, react_1.isValidElement)(opener) && opener),
|
|
141
|
-
react_1.default.createElement(react_2.FloatingPortal, { id: '' }, needMenu && react_1.default.createElement(menu_1.SelectMenu, Object.assign({}, menuProps), children))));
|
|
117
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(utils_1.SelectContext.Provider, Object.assign({ value: openerBinding }, { children: (0, react_1.isValidElement)(opener) && opener })), (0, jsx_runtime_1.jsx)(react_2.FloatingPortal, Object.assign({ id: '' }, { children: needMenu && (0, jsx_runtime_1.jsx)(menu_1.SelectMenu, Object.assign({}, menuProps, { children: children })) }))] }));
|
|
142
118
|
}
|
|
143
119
|
exports.Select = Select;
|
|
144
120
|
Select.FieldBlock = block_1.SelectFieldBlock;
|
|
@@ -1,27 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
2
|
var __rest = (this && this.__rest) || function (s, e) {
|
|
26
3
|
var t = {};
|
|
27
4
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
@@ -38,14 +15,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
38
15
|
};
|
|
39
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
17
|
exports.Select = exports.renderDefaultArrow = void 0;
|
|
41
|
-
const
|
|
18
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
19
|
+
const react_1 = require("react");
|
|
42
20
|
const dropdown_1 = require("../dropdown");
|
|
43
21
|
const dropdown_item_1 = require("../dropdown-item");
|
|
44
22
|
const text_field_1 = require("../text-field");
|
|
45
23
|
const dropdown_2 = require("../_internal/utils/dropdown");
|
|
46
24
|
const bind_1 = __importDefault(require("classnames/bind"));
|
|
47
|
-
const
|
|
48
|
-
const
|
|
25
|
+
const Down_1 = __importDefault(require("@sima-land/ui-quarks/icons/16x16/Stroked/Arrows/Down"));
|
|
26
|
+
const Up_1 = __importDefault(require("@sima-land/ui-quarks/icons/16x16/Stroked/Arrows/Up"));
|
|
49
27
|
const select_module_scss_1 = __importDefault(require("./select.module.scss"));
|
|
50
28
|
const colors_1 = require("../colors");
|
|
51
29
|
const dropdown_loading_1 = require("../_internal/dropdown-loading");
|
|
@@ -57,8 +35,8 @@ const cx = bind_1.default.bind(select_module_scss_1.default);
|
|
|
57
35
|
* @return Элемент.
|
|
58
36
|
*/
|
|
59
37
|
const renderDefaultArrow = (opened) => {
|
|
60
|
-
const ArrowSVG = opened ?
|
|
61
|
-
return
|
|
38
|
+
const ArrowSVG = opened ? Up_1.default : Down_1.default;
|
|
39
|
+
return (0, jsx_runtime_1.jsx)(ArrowSVG, { fill: colors_1.COLORS.get('basic-gray38') });
|
|
62
40
|
};
|
|
63
41
|
exports.renderDefaultArrow = renderDefaultArrow;
|
|
64
42
|
/**
|
|
@@ -78,35 +56,33 @@ const Select = (_a) => {
|
|
|
78
56
|
onMenuToggle && onMenuToggle(opened);
|
|
79
57
|
}, [opened]);
|
|
80
58
|
(0, hooks_1.useOutsideClick)(rootRef, toggleMenu.bind(null, false));
|
|
81
|
-
return (
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
},
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
tabIndex: -1,
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
59
|
+
return ((0, jsx_runtime_1.jsxs)("div", Object.assign({ ref: rootRef, style: style, className: cx('root', className), "data-testid": dataTestId }, { children: [(0, jsx_runtime_1.jsx)(text_field_1.TextField, Object.assign({}, restProps, { size: size, blockProps: {
|
|
60
|
+
ref: fieldRef,
|
|
61
|
+
tabIndex: 0,
|
|
62
|
+
onMouseDown: () => {
|
|
63
|
+
toggleMenu(a => !a);
|
|
64
|
+
},
|
|
65
|
+
onKeyDown: e => {
|
|
66
|
+
e.key === 'Enter' && toggleMenu(true);
|
|
67
|
+
},
|
|
68
|
+
}, onClick: e => {
|
|
69
|
+
e.preventDefault();
|
|
70
|
+
onClick && onClick(e);
|
|
71
|
+
}, className: select_module_scss_1.default.field, "data-testid": 'select:field', label: label, focused: opened, baseInputProps: {
|
|
72
|
+
// чтобы не ловить фокус на поле
|
|
73
|
+
style: { pointerEvents: 'none' },
|
|
74
|
+
tabIndex: -1,
|
|
75
|
+
}, value: value, multiline: false, variant: 'desktop', readOnly: true, endAdornment: typeof endAdornment === 'function' ? endAdornment(opened) : endAdornment })), opened && (loading || options.length > 0) && ((0, jsx_runtime_1.jsx)(dropdown_1.Dropdown, Object.assign({}, (0, dropdown_2.placeDropdown)(size), { ref: menuRef, "data-testid": 'select:menu', role: 'menu', tabIndex: -1, className: cx('menu'), onKeyDown: event => {
|
|
76
|
+
if (event.key === 'Enter') {
|
|
77
|
+
toggleMenu(false);
|
|
78
|
+
fieldRef.current && fieldRef.current.focus();
|
|
79
|
+
}
|
|
80
|
+
}, onBlur: () => {
|
|
101
81
|
toggleMenu(false);
|
|
102
82
|
fieldRef.current && fieldRef.current.focus();
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
} }), 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: () => {
|
|
108
|
-
toggleMenu(false);
|
|
109
|
-
onSelect && onSelect(option);
|
|
110
|
-
} }, renderOption(option)))))))));
|
|
83
|
+
} }, { children: loading ? ((0, jsx_runtime_1.jsx)(dropdown_loading_1.DropdownLoading, { "data-testid": 'select:loading-area' })) : (options.map((option, index) => ((0, jsx_runtime_1.jsx)(dropdown_item_1.DropdownItem, Object.assign({ size: optionSize, role: 'menuitem', onClick: () => {
|
|
84
|
+
toggleMenu(false);
|
|
85
|
+
onSelect && onSelect(option);
|
|
86
|
+
} }, { children: renderOption(option) }), index)))) })))] })));
|
|
111
87
|
};
|
|
112
88
|
exports.Select = Select;
|
package/side-page/index.js
CHANGED
|
@@ -1,27 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
2
|
var __rest = (this && this.__rest) || function (s, e) {
|
|
26
3
|
var t = {};
|
|
27
4
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
@@ -38,7 +15,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
38
15
|
};
|
|
39
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
17
|
exports.SidePage = void 0;
|
|
41
|
-
const
|
|
18
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
19
|
+
const react_1 = require("react");
|
|
42
20
|
const define_slots_1 = require("../helpers/define-slots");
|
|
43
21
|
const page_scroll_lock_1 = require("../_internal/page-scroll-lock");
|
|
44
22
|
const slots_1 = require("./slots");
|
|
@@ -62,7 +40,7 @@ const transitionClasses = {
|
|
|
62
40
|
function SidePage(_a) {
|
|
63
41
|
var { shown, withTransitions, onEnter, onEntering, onEntered, onExit, onExiting, onExited } = _a, restProps = __rest(_a, ["shown", "withTransitions", "onEnter", "onEntering", "onEntered", "onExit", "onExiting", "onExited"]);
|
|
64
42
|
const transitionDuration = withTransitions ? 300 : 0;
|
|
65
|
-
return (
|
|
43
|
+
return ((0, jsx_runtime_1.jsx)(CSSTransition_1.default, Object.assign({ in: shown, timeout: transitionDuration, classNames: transitionClasses, unmountOnExit: true, onEntering: onEntering, onEnter: onEnter, onEntered: onEntered, onExit: onExit, onExiting: onExiting, onExited: onExited }, { children: transitionStatus => ((0, jsx_runtime_1.jsx)(SidePageInner, Object.assign({}, restProps, { transitionStatus, transitionDuration }))) })));
|
|
66
44
|
}
|
|
67
45
|
exports.SidePage = SidePage;
|
|
68
46
|
/**
|
|
@@ -80,11 +58,7 @@ function SidePageInner({ size = 'm', children, onClose, withScrollDisable = fals
|
|
|
80
58
|
footer: SidePage.Footer,
|
|
81
59
|
});
|
|
82
60
|
const overlayProps = Object.assign({ style: { '--transition-duration': `${transitionDuration}ms` } }, (transitionStatus !== 'entering' && overlayClickBind));
|
|
83
|
-
return (
|
|
84
|
-
react_1.default.createElement("div", { className: cx('side-page', `size-${size}`) },
|
|
85
|
-
header,
|
|
86
|
-
react_1.default.createElement("div", { ref: ref, className: cx('body') }, body),
|
|
87
|
-
footer)));
|
|
61
|
+
return ((0, jsx_runtime_1.jsx)(modal_overlay_1.ModalOverlay, Object.assign({}, overlayProps, { children: (0, jsx_runtime_1.jsxs)("div", Object.assign({ className: cx('side-page', `size-${size}`) }, { children: [header, (0, jsx_runtime_1.jsx)("div", Object.assign({ ref: ref, className: cx('body') }, { children: body })), footer] })) })));
|
|
88
62
|
}
|
|
89
63
|
SidePage.Header = slots_1.SidePageHeader;
|
|
90
64
|
SidePage.Body = slots_1.SidePageBody;
|
package/side-page/slots.js
CHANGED
|
@@ -15,7 +15,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
exports.SidePageFooter = exports.SidePageBody = exports.SidePageHeader = void 0;
|
|
18
|
-
const
|
|
18
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
19
19
|
const top_bar_1 = require("../top-bar");
|
|
20
20
|
const bottom_bar_1 = require("../bottom-bar");
|
|
21
21
|
const utils_1 = require("../top-bar/utils");
|
|
@@ -28,7 +28,7 @@ const side_page_module_scss_1 = __importDefault(require("./side-page.module.scss
|
|
|
28
28
|
*/
|
|
29
29
|
function SidePageHeader(_a) {
|
|
30
30
|
var { onBack, onClose, buttons } = _a, topBarProps = __rest(_a, ["onBack", "onClose", "buttons"]);
|
|
31
|
-
return (
|
|
31
|
+
return ((0, jsx_runtime_1.jsx)(top_bar_1.TopBar, Object.assign({}, topBarProps, { size: 'unset', className: side_page_module_scss_1.default.header, buttons: (0, utils_1.navigationButtons)({ buttons, onBack, onClose }) })));
|
|
32
32
|
}
|
|
33
33
|
exports.SidePageHeader = SidePageHeader;
|
|
34
34
|
/**
|
|
@@ -37,7 +37,7 @@ exports.SidePageHeader = SidePageHeader;
|
|
|
37
37
|
* @return Элемент.
|
|
38
38
|
*/
|
|
39
39
|
function SidePageBody({ children }) {
|
|
40
|
-
return
|
|
40
|
+
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: children });
|
|
41
41
|
}
|
|
42
42
|
exports.SidePageBody = SidePageBody;
|
|
43
43
|
/**
|
|
@@ -47,6 +47,6 @@ exports.SidePageBody = SidePageBody;
|
|
|
47
47
|
*/
|
|
48
48
|
function SidePageFooter(_a) {
|
|
49
49
|
var props = __rest(_a, []);
|
|
50
|
-
return
|
|
50
|
+
return (0, jsx_runtime_1.jsx)(bottom_bar_1.BottomBar, Object.assign({}, props, { size: 'unset', className: (0, classnames_1.default)(side_page_module_scss_1.default.footer) }));
|
|
51
51
|
}
|
|
52
52
|
exports.SidePageFooter = SidePageFooter;
|
package/spinner/index.d.ts
CHANGED
package/spinner/index.js
CHANGED
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.SpinnerSVG = exports.Spinner = exports.DIAMETERS = void 0;
|
|
7
|
-
const
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
8
|
const lodash_1 = require("lodash");
|
|
9
9
|
const colors_1 = require("../colors");
|
|
10
10
|
const bind_1 = __importDefault(require("classnames/bind"));
|
|
@@ -28,8 +28,7 @@ const DEFAULT_COLOR = 'basic-blue';
|
|
|
28
28
|
function Spinner({ size = 'm', color = DEFAULT_COLOR, className, style, 'data-testid': testId = 'spinner', }) {
|
|
29
29
|
const readySize = (0, lodash_1.has)(exports.DIAMETERS, size) ? size : 'm';
|
|
30
30
|
const readyColor = colors_1.COLORS.has(color) ? color : DEFAULT_COLOR;
|
|
31
|
-
return (
|
|
32
|
-
react_1.default.createElement(SpinnerSVG, { size: readySize, color: readyColor, "data-testid": null })));
|
|
31
|
+
return ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: className, style: style, "data-testid": testId }, { children: (0, jsx_runtime_1.jsx)(SpinnerSVG, { size: readySize, color: readyColor, "data-testid": null }) })));
|
|
33
32
|
}
|
|
34
33
|
exports.Spinner = Spinner;
|
|
35
34
|
/**
|
|
@@ -41,7 +40,6 @@ exports.Spinner = Spinner;
|
|
|
41
40
|
function SpinnerSVG({ size = 'm', color = DEFAULT_COLOR, className, style, 'data-testid': testId = 'spinner', }) {
|
|
42
41
|
const diameter = exports.DIAMETERS[size];
|
|
43
42
|
const radius = diameter / 2;
|
|
44
|
-
return (
|
|
45
|
-
react_1.default.createElement("circle", { className: cx('circle'), cx: radius, cy: radius, r: radius - 1 })));
|
|
43
|
+
return ((0, jsx_runtime_1.jsx)("svg", Object.assign({ style: style, className: cx('spinner', `size-${size}`, className), viewBox: `0 0 ${diameter} ${diameter}`, width: diameter, height: diameter, stroke: colors_1.COLORS.get(color), "data-testid": testId }, { children: (0, jsx_runtime_1.jsx)("circle", { className: cx('circle'), cx: radius, cy: radius, r: radius - 1 }) })));
|
|
46
44
|
}
|
|
47
45
|
exports.SpinnerSVG = SpinnerSVG;
|