@sima-land/ui-nucleons 45.0.0-alpha.3 → 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.d.ts +2 -2
- package/_internal/custom-scrollbar/index.js +17 -14
- 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/arrow-button.module.scss +5 -5
- 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 +10 -36
- package/avatar/user.d.ts +1 -1
- package/avatar/user.js +8 -29
- package/avatar/utils.d.ts +1 -1
- package/avatar/utils.js +12 -10
- 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 +7 -29
- 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/utils.d.ts +4 -1
- package/hint/utils.js +4 -3
- 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-button/text-button.module.scss +1 -1
- 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/index.d.ts +1 -1
- package/top-bar/index.js +3 -1
- 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/panel/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.Panel = exports.LINK_COLOR_BY_TYPE = void 0;
|
|
7
|
-
const
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
8
|
const colors_1 = require("../styling/colors");
|
|
9
9
|
const bind_1 = __importDefault(require("classnames/bind"));
|
|
10
10
|
const panel_module_scss_1 = __importDefault(require("./panel.module.scss"));
|
|
@@ -41,10 +41,7 @@ exports.LINK_COLOR_BY_TYPE = {
|
|
|
41
41
|
function Panel({ type = 'info', adornmentStart, adornmentEnd, className, style, children, 'data-testid': testId = 'panel', }) {
|
|
42
42
|
const textColor = PANEL_COLORS_BY_TYPE[type].textColor;
|
|
43
43
|
const panelColor = PANEL_COLORS_BY_TYPE[type].panelColor;
|
|
44
|
-
return (
|
|
45
|
-
adornmentStart && react_1.default.createElement("div", { className: cx('adornment') }, adornmentStart),
|
|
46
|
-
react_1.default.createElement("div", { className: cx('main') }, children),
|
|
47
|
-
adornmentEnd && react_1.default.createElement("div", { className: cx('adornment') }, adornmentEnd)));
|
|
44
|
+
return ((0, jsx_runtime_1.jsxs)("div", Object.assign({ className: cx('root', `type-${type}`, (0, colors_1.bgColor)(panelColor), (0, colors_1.color)(textColor), className), "data-testid": testId, style: style }, { children: [adornmentStart && (0, jsx_runtime_1.jsx)("div", Object.assign({ className: cx('adornment') }, { children: adornmentStart })), (0, jsx_runtime_1.jsx)("div", Object.assign({ className: cx('main') }, { children: children })), adornmentEnd && (0, jsx_runtime_1.jsx)("div", Object.assign({ className: cx('adornment') }, { children: adornmentEnd }))] })));
|
|
48
45
|
}
|
|
49
46
|
exports.Panel = Panel;
|
|
50
47
|
/**
|
|
@@ -53,6 +50,6 @@ exports.Panel = Panel;
|
|
|
53
50
|
* @return Элемент.
|
|
54
51
|
*/
|
|
55
52
|
function PanelUnknownContent({ markup }) {
|
|
56
|
-
return
|
|
53
|
+
return (0, jsx_runtime_1.jsx)("div", { className: cx('unknown-content'), dangerouslySetInnerHTML: { __html: markup } });
|
|
57
54
|
}
|
|
58
55
|
Panel.UnknownContent = PanelUnknownContent;
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -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.PhoneInput = void 0;
|
|
41
|
-
const
|
|
18
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
19
|
+
const react_1 = require("react");
|
|
42
20
|
const dropdown_item_1 = require("../dropdown-item");
|
|
43
21
|
const hooks_1 = require("../hooks");
|
|
44
22
|
const masked_input_1 = require("../masked-input");
|
|
@@ -46,8 +24,8 @@ const presets_1 = require("./presets");
|
|
|
46
24
|
const utils_1 = require("./utils");
|
|
47
25
|
const select_1 = require("../select");
|
|
48
26
|
const utils_2 = require("../select/utils");
|
|
49
|
-
const
|
|
50
|
-
const
|
|
27
|
+
const Up_1 = __importDefault(require("@sima-land/ui-quarks/icons/16x16/Stroked/Arrows/Up"));
|
|
28
|
+
const Down_1 = __importDefault(require("@sima-land/ui-quarks/icons/16x16/Stroked/Arrows/Down"));
|
|
51
29
|
const bind_1 = __importDefault(require("classnames/bind"));
|
|
52
30
|
const phone_input_module_scss_1 = __importDefault(require("./phone-input.module.scss"));
|
|
53
31
|
const cx = bind_1.default.bind(phone_input_module_scss_1.default);
|
|
@@ -96,7 +74,7 @@ function PhoneInput(_a) {
|
|
|
96
74
|
setCountry(selected);
|
|
97
75
|
setCleanValue('');
|
|
98
76
|
}, []);
|
|
99
|
-
return (
|
|
77
|
+
return ((0, jsx_runtime_1.jsx)(select_1.Select, Object.assign({ opener: (0, jsx_runtime_1.jsx)(PhoneMaskedInput, Object.assign({}, props, { "data-testid": testId, country: country, inputRef: inputRef, blockRef: blockRef, label: label, mask: country.mask, onFocus: (event, data) => {
|
|
100
78
|
onFocus === null || onFocus === void 0 ? void 0 : onFocus(event, processData(data));
|
|
101
79
|
}, onChange: (event, data) => {
|
|
102
80
|
onChange === null || onChange === void 0 ? void 0 : onChange(event, processData(data));
|
|
@@ -105,11 +83,11 @@ function PhoneInput(_a) {
|
|
|
105
83
|
}, value: cleanValue })), onValueChange: itemValue => {
|
|
106
84
|
const item = presets_1.countriesList.find(c => c.id === itemValue);
|
|
107
85
|
item && changeCountry(item);
|
|
108
|
-
} }, presets_1.countriesList.map((item, index) => (
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
86
|
+
} }, { children: presets_1.countriesList.map((item, index) => ((0, jsx_runtime_1.jsx)(dropdown_item_1.DropdownItem, Object.assign({ value: item.id, size: 'm', role: 'menuitem', onMouseDown: event => {
|
|
87
|
+
// ВАЖНО: клик по блоку поля вызывает фокус на поле и preventDefault()
|
|
88
|
+
// отменяем с помощью другого preventDefault()
|
|
89
|
+
event.preventDefault();
|
|
90
|
+
}, selected: item.id === country.id, startContent: (0, jsx_runtime_1.jsx)("img", { alt: '', width: 24, height: 24, src: item.imageSrc }), endContent: item.code }, { children: item.name }), index))) })));
|
|
113
91
|
}
|
|
114
92
|
exports.PhoneInput = PhoneInput;
|
|
115
93
|
/**
|
|
@@ -124,10 +102,8 @@ function PhoneMaskedInput(_a) {
|
|
|
124
102
|
const [openerFocused, setOpenerFocused] = (0, react_1.useState)(false);
|
|
125
103
|
(0, react_1.useImperativeHandle)(blockRefProp, () => blockRef.current);
|
|
126
104
|
(0, react_1.useImperativeHandle)(select.anchorRef, () => blockRef.current);
|
|
127
|
-
const ArrowSVG = select.opened ?
|
|
128
|
-
return (
|
|
105
|
+
const ArrowSVG = select.opened ? Up_1.default : Down_1.default;
|
|
106
|
+
return ((0, jsx_runtime_1.jsx)(masked_input_1.MaskedInput, Object.assign({}, props, {
|
|
129
107
|
// ВАЖНО: undefined нужен для поведения по умолчанию если меню скрыто и кнопка не в фокусе
|
|
130
|
-
focused: select.opened || openerFocused || undefined, blockRef: blockRef, baseInputProps: Object.assign({ restPlaceholder: country.id === presets_1.IDS.other ? '' : undefined }, props.baseInputProps), adornmentEnd:
|
|
131
|
-
react_1.default.createElement("img", { alt: '', width: 24, height: 24, src: country.imageSrc }),
|
|
132
|
-
react_1.default.createElement(ArrowSVG, { className: phone_input_module_scss_1.default.arrow })) })));
|
|
108
|
+
focused: select.opened || openerFocused || undefined, blockRef: blockRef, baseInputProps: Object.assign({ restPlaceholder: country.id === presets_1.IDS.other ? '' : undefined }, props.baseInputProps), adornmentEnd: (0, jsx_runtime_1.jsxs)("div", Object.assign({ ref: select.openerRef, tabIndex: 0, onFocus: () => setOpenerFocused(true), onBlur: () => setOpenerFocused(false), role: 'combobox', "aria-label": '\u0412\u044B\u0431\u043E\u0440 \u0441\u0442\u0440\u0430\u043D\u044B', className: cx('opener'), "data-testid": 'phone-input:menu-opener', onKeyDown: select.onKeyDown, onMouseDown: select.onMouseDown }, { children: [(0, jsx_runtime_1.jsx)("img", { alt: '', width: 24, height: 24, src: country.imageSrc }), (0, jsx_runtime_1.jsx)(ArrowSVG, { className: phone_input_module_scss_1.default.arrow })] })) })));
|
|
133
109
|
}
|
package/phone-input/presets.js
CHANGED
|
@@ -77,6 +77,8 @@ const IMAGES = {
|
|
|
77
77
|
[exports.IDS.ukraine]: ukraine_png_1.default,
|
|
78
78
|
[exports.IDS.other]: other_png_1.default,
|
|
79
79
|
};
|
|
80
|
+
// @todo <Flag country='russia' /> под капотом оптимизация для флагов состоящих только из полос
|
|
81
|
+
// (простые флаги можно сделать на css чтобы не хранить лишние png)
|
|
80
82
|
const CODES = {
|
|
81
83
|
[exports.IDS.russia]: '+7',
|
|
82
84
|
[exports.IDS.kazakhstan]: '+7',
|
|
@@ -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,9 +15,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
38
15
|
};
|
|
39
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
17
|
exports.PhoneInput = void 0;
|
|
41
|
-
const
|
|
42
|
-
const
|
|
43
|
-
const
|
|
18
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
19
|
+
const react_1 = require("react");
|
|
20
|
+
const Down_1 = __importDefault(require("@sima-land/ui-quarks/icons/16x16/Stroked/Arrows/Down"));
|
|
21
|
+
const Up_1 = __importDefault(require("@sima-land/ui-quarks/icons/16x16/Stroked/Arrows/Up"));
|
|
44
22
|
const dropdown_1 = require("../dropdown");
|
|
45
23
|
const dropdown_item_1 = require("../dropdown-item");
|
|
46
24
|
const text_field_1 = require("../text-field");
|
|
@@ -78,12 +56,10 @@ const PhoneInput = (_a) => {
|
|
|
78
56
|
(0, hooks_1.useOutsideClick)(rootRef, () => {
|
|
79
57
|
toggleMenu(false);
|
|
80
58
|
});
|
|
81
|
-
const AdornmentSVG = withMenu ?
|
|
82
|
-
const commonFieldProps = Object.assign(Object.assign({}, restProps), { label, multiline: false, className: cx('field'), endAdornment: (
|
|
59
|
+
const AdornmentSVG = withMenu ? Up_1.default : Down_1.default;
|
|
60
|
+
const commonFieldProps = Object.assign(Object.assign({}, restProps), { label, multiline: false, className: cx('field'), endAdornment: ((0, jsx_runtime_1.jsxs)("div", Object.assign({ ref: openerRef, className: cx('adornment'), "data-testid": 'phone-input:dropdown-opener', onClick: () => {
|
|
83
61
|
toggleMenu(a => !a);
|
|
84
|
-
} },
|
|
85
|
-
react_1.default.createElement("img", { alt: '', width: 24, height: 24, src: country.imageSrc }),
|
|
86
|
-
react_1.default.createElement(AdornmentSVG, { className: cx('arrow') }))), onClick: event => {
|
|
62
|
+
} }, { children: [(0, jsx_runtime_1.jsx)("img", { alt: '', width: 24, height: 24, src: country.imageSrc }), (0, jsx_runtime_1.jsx)(AdornmentSVG, { className: cx('arrow') })] }))), onClick: event => {
|
|
87
63
|
const opener = openerRef.current;
|
|
88
64
|
if (opener instanceof Node &&
|
|
89
65
|
event.target instanceof Node &&
|
|
@@ -94,31 +70,29 @@ const PhoneInput = (_a) => {
|
|
|
94
70
|
toggleMenu(false);
|
|
95
71
|
}
|
|
96
72
|
} });
|
|
97
|
-
return (
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
onCountrySelect && onCountrySelect(item);
|
|
122
|
-
}, startContent: react_1.default.createElement("img", { alt: '', width: 24, height: 24, src: item.imageSrc, className: cx('country-icon') }), endContent: item.code }, item.name)))))));
|
|
73
|
+
return ((0, jsx_runtime_1.jsxs)("div", Object.assign({ ref: rootRef, "data-testid": testId, style: style, className: cx('root', className) }, { children: [country.id === presets_1.IDS.other ? ((0, jsx_runtime_1.jsx)(text_field_1.TextField, Object.assign({}, commonFieldProps, { value: cleanValue, onChange: (e) => {
|
|
74
|
+
const nextValue = e.target.value.replace(/\D/g, '').slice(0, 20);
|
|
75
|
+
e.target.value = nextValue;
|
|
76
|
+
setCleanValue(nextValue);
|
|
77
|
+
onChange && onChange(e);
|
|
78
|
+
}, onBlur: e => {
|
|
79
|
+
onBlur &&
|
|
80
|
+
onBlur(e, {
|
|
81
|
+
value: e.target.value,
|
|
82
|
+
cleanValue: e.target.value,
|
|
83
|
+
ready: e.target.value.length > 0,
|
|
84
|
+
});
|
|
85
|
+
} }))) : ((0, jsx_runtime_1.jsx)(masked_field_1.MaskedField, Object.assign({}, commonFieldProps, {
|
|
86
|
+
// убираем код страны, так как он уже зашит в маску
|
|
87
|
+
value: cleanValue, mask: country.mask, onBlur: (event, state) => {
|
|
88
|
+
onBlur &&
|
|
89
|
+
onBlur(event, Object.assign(Object.assign({}, state), {
|
|
90
|
+
// вставляем код страны обратно в чистое значение
|
|
91
|
+
cleanValue: `${country.codeChars}${state.cleanValue}` }));
|
|
92
|
+
} }))), withMenu && ((0, jsx_runtime_1.jsx)(dropdown_1.Dropdown, Object.assign({ role: 'menu', className: cx('menu'), "data-testid": 'phone-input:dropdown' }, { children: presets_1.countriesList.map((item, index) => item.id === country.id ? null : ((0, jsx_runtime_1.jsx)(dropdown_item_1.DropdownItem, Object.assign({ size: 'm', role: 'menuitem', className: cx('menu-item'), onClick: () => {
|
|
93
|
+
toggleMenu(false);
|
|
94
|
+
setCountry(item);
|
|
95
|
+
onCountrySelect && onCountrySelect(item);
|
|
96
|
+
}, startContent: (0, jsx_runtime_1.jsx)("img", { alt: '', width: 24, height: 24, src: item.imageSrc, className: cx('country-icon') }), endContent: item.code }, { children: item.name }), index))) })))] })));
|
|
123
97
|
};
|
|
124
98
|
exports.PhoneInput = PhoneInput;
|
package/plate/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
2
|
import { BoxShadow } from '../styling/shadows';
|
|
3
3
|
export interface PlateProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
4
4
|
/** Тень. */
|
|
@@ -12,4 +12,4 @@ export interface PlateProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
12
12
|
* Plate это просто div с возможностью легко задавать тень и скругления.
|
|
13
13
|
* И он должен оставаться компонентом, который только задает оформление обычного div.
|
|
14
14
|
*/
|
|
15
|
-
export declare const Plate:
|
|
15
|
+
export declare const Plate: import("react").ForwardRefExoticComponent<PlateProps & import("react").RefAttributes<HTMLDivElement | null>>;
|
package/plate/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.Plate = void 0;
|
|
41
|
-
const
|
|
18
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
19
|
+
const react_1 = require("react");
|
|
42
20
|
const shadows_1 = require("../styling/shadows");
|
|
43
21
|
const shapes_1 = require("../styling/shapes");
|
|
44
22
|
const classnames_1 = __importDefault(require("classnames"));
|
|
@@ -49,5 +27,5 @@ const plate_module_scss_1 = __importDefault(require("./plate.module.scss"));
|
|
|
49
27
|
*/
|
|
50
28
|
exports.Plate = (0, react_1.forwardRef)(function Plate(_a, ref) {
|
|
51
29
|
var { className, children, rounds = 's', shadow = 'z1', 'data-testid': testId = 'plate' } = _a, restProps = __rest(_a, ["className", "children", "rounds", "shadow", 'data-testid']);
|
|
52
|
-
return (
|
|
30
|
+
return ((0, jsx_runtime_1.jsx)("div", Object.assign({ ref: ref, className: (0, classnames_1.default)(plate_module_scss_1.default.root, className, shadow && shadows_1.BoxShadow[shadow], rounds === 's' && shapes_1.SmallRounds.all, rounds === 'm' && shapes_1.MediumRounds.all), "data-testid": testId, children: children }, restProps)));
|
|
53
31
|
});
|
package/popup/popup-view.js
CHANGED
|
@@ -15,8 +15,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
exports.PopupView = void 0;
|
|
18
|
-
const
|
|
19
|
-
const
|
|
18
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
19
|
+
const Cross_1 = __importDefault(require("@sima-land/ui-quarks/icons/16x16/Stroked/Cross"));
|
|
20
20
|
const bind_1 = __importDefault(require("classnames/bind"));
|
|
21
21
|
const popup_view_module_scss_1 = __importDefault(require("./popup-view.module.scss"));
|
|
22
22
|
const cx = bind_1.default.bind(popup_view_module_scss_1.default);
|
|
@@ -27,9 +27,6 @@ const cx = bind_1.default.bind(popup_view_module_scss_1.default);
|
|
|
27
27
|
*/
|
|
28
28
|
function PopupView(_a) {
|
|
29
29
|
var { children, onClose, popupRef, className, 'data-testid': testId = 'popup' } = _a, rest = __rest(_a, ["children", "onClose", "popupRef", "className", 'data-testid']);
|
|
30
|
-
return (
|
|
31
|
-
onClose && (react_1.default.createElement("button", { "aria-label": '\u0417\u0430\u043A\u0440\u044B\u0442\u044C', className: cx('close'), onClick: onClose, "data-testid": 'popup:close' },
|
|
32
|
-
react_1.default.createElement(cross_1.default, null))),
|
|
33
|
-
react_1.default.createElement("div", { className: cx('content') }, children)));
|
|
30
|
+
return ((0, jsx_runtime_1.jsxs)("div", Object.assign({}, rest, { className: cx('root', className), ref: popupRef, "data-testid": testId }, { children: [onClose && ((0, jsx_runtime_1.jsx)("button", Object.assign({ "aria-label": '\u0417\u0430\u043A\u0440\u044B\u0442\u044C', className: cx('close'), onClick: onClose, "data-testid": 'popup:close' }, { children: (0, jsx_runtime_1.jsx)(Cross_1.default, {}) }))), (0, jsx_runtime_1.jsx)("div", Object.assign({ className: cx('content') }, { children: children }))] })));
|
|
34
31
|
}
|
|
35
32
|
exports.PopupView = PopupView;
|
package/popup/popup.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.Popup = void 0;
|
|
38
|
-
const
|
|
15
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
16
|
+
const react_1 = require("react");
|
|
39
17
|
const popup_view_1 = require("./popup-view");
|
|
40
18
|
const react_2 = require("@floating-ui/react");
|
|
41
19
|
const hooks_1 = require("../hooks");
|
|
@@ -49,7 +27,7 @@ const portal_1 = require("../portal");
|
|
|
49
27
|
*/
|
|
50
28
|
function Popup(_a) {
|
|
51
29
|
var { showFor } = _a, rest = __rest(_a, ["showFor"]);
|
|
52
|
-
return
|
|
30
|
+
return (0, jsx_runtime_1.jsx)(portal_1.Portal, { children: showFor && (0, jsx_runtime_1.jsx)(PopupInner, Object.assign({ showFor: showFor }, rest)) });
|
|
53
31
|
}
|
|
54
32
|
exports.Popup = Popup;
|
|
55
33
|
/**
|
|
@@ -69,5 +47,5 @@ function PopupInner(_a) {
|
|
|
69
47
|
enabled: floating.isPositioned,
|
|
70
48
|
afterDeactivate: onDismiss,
|
|
71
49
|
});
|
|
72
|
-
return (
|
|
50
|
+
return ((0, jsx_runtime_1.jsx)(popup_view_1.PopupView, Object.assign({}, rest, { popupRef: refs.setFloating, style: Object.assign(Object.assign({}, style), floatingStyle), onClose: onDismiss }, { children: children })));
|
|
73
51
|
}
|
package/portal/index.d.ts
CHANGED
package/price/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.Price = void 0;
|
|
7
|
-
const
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
8
|
const utils_1 = require("./utils");
|
|
9
9
|
const bind_1 = __importDefault(require("classnames/bind"));
|
|
10
10
|
const price_module_scss_1 = __importDefault(require("./price.module.scss"));
|
|
@@ -18,6 +18,6 @@ function Price({ className, currencyGrapheme: grapheme, graphemeBefore, crossedO
|
|
|
18
18
|
const content = (0, utils_1.formatPrice)(value, grapheme, {
|
|
19
19
|
graphemeBefore,
|
|
20
20
|
});
|
|
21
|
-
return (
|
|
21
|
+
return ((0, jsx_runtime_1.jsx)("span", Object.assign({ className: cx('root', className, crossedOut && 'crossed-out'), "data-testid": testId }, { children: content })));
|
|
22
22
|
}
|
|
23
23
|
exports.Price = Price;
|
package/radio-button/index.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.RadioButton = void 0;
|
|
18
|
-
const
|
|
18
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
19
19
|
const bind_1 = __importDefault(require("classnames/bind"));
|
|
20
20
|
const radio_button_module_scss_1 = __importDefault(require("./radio-button.module.scss"));
|
|
21
21
|
const cx = bind_1.default.bind(radio_button_module_scss_1.default);
|
|
@@ -26,8 +26,6 @@ const cx = bind_1.default.bind(radio_button_module_scss_1.default);
|
|
|
26
26
|
*/
|
|
27
27
|
function RadioButton(_a) {
|
|
28
28
|
var { style, className, 'data-testid': testId = 'radio-button' } = _a, restProps = __rest(_a, ["style", "className", 'data-testid']);
|
|
29
|
-
return (
|
|
30
|
-
react_1.default.createElement("input", Object.assign({}, restProps, { type: 'radio', className: cx('input'), "data-testid": testId })),
|
|
31
|
-
react_1.default.createElement("div", { className: cx('circle') })));
|
|
29
|
+
return ((0, jsx_runtime_1.jsxs)("div", Object.assign({ style: style, className: cx('root', className) }, { children: [(0, jsx_runtime_1.jsx)("input", Object.assign({}, restProps, { type: 'radio', className: cx('input'), "data-testid": testId })), (0, jsx_runtime_1.jsx)("div", { className: cx('circle') })] })));
|
|
32
30
|
}
|
|
33
31
|
exports.RadioButton = RadioButton;
|
package/range/index.d.ts
CHANGED
package/range/index.js
CHANGED
|
@@ -1,33 +1,11 @@
|
|
|
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.Range = void 0;
|
|
30
|
-
const
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const react_1 = require("react");
|
|
31
9
|
const with_prevent_1 = __importDefault(require("../helpers/with-prevent"));
|
|
32
10
|
const bounds_of_1 = __importDefault(require("../helpers/bounds-of"));
|
|
33
11
|
const create_container_1 = __importDefault(require("../helpers/create-container"));
|
|
@@ -273,15 +251,10 @@ class Range extends react_1.Component {
|
|
|
273
251
|
render() {
|
|
274
252
|
var _a;
|
|
275
253
|
const [start, finish] = this.getPercents();
|
|
276
|
-
return (
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
left: `${start}
|
|
280
|
-
width: `${finish - start}%`,
|
|
281
|
-
} }),
|
|
282
|
-
react_1.default.createElement("div", { ref: this.containerRef, className: cx('range-container-base', 'range-container-styled') },
|
|
283
|
-
react_1.default.createElement("button", { type: 'button', "aria-label": '\u041D\u0430\u0447\u0430\u043B\u044C\u043D\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D\u0430', ref: this.startThumbRef, className: cx('thumb-base', 'thumb-styled'), style: { left: `${start}%` }, "data-testid": 'range:thumb-start' }),
|
|
284
|
-
react_1.default.createElement("button", { type: 'button', "aria-label": '\u041A\u043E\u043D\u0435\u0447\u043D\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D\u0430', ref: this.finishThumbRef, className: cx('thumb-base', 'thumb-styled'), style: { left: `${finish}%` }, "data-testid": 'range:thumb-end' }))));
|
|
254
|
+
return ((0, jsx_runtime_1.jsxs)("div", Object.assign({}, this.props.wrapperProps, { className: cx('range-wrapper-base', 'range-wrapper-styled', this.props.disabled && 'disabled', (_a = this.props.wrapperProps) === null || _a === void 0 ? void 0 : _a.className) }, { children: [(0, jsx_runtime_1.jsx)("div", { className: cx('track-base', 'available-base', 'available-styled') }), (0, jsx_runtime_1.jsx)("div", { ref: this.rangeRef, className: cx('track-base', 'selected-base', 'selected-styled'), style: {
|
|
255
|
+
left: `${start}%`,
|
|
256
|
+
width: `${finish - start}%`,
|
|
257
|
+
} }), (0, jsx_runtime_1.jsxs)("div", Object.assign({ ref: this.containerRef, className: cx('range-container-base', 'range-container-styled') }, { children: [(0, jsx_runtime_1.jsx)("button", { type: 'button', "aria-label": '\u041D\u0430\u0447\u0430\u043B\u044C\u043D\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D\u0430', ref: this.startThumbRef, className: cx('thumb-base', 'thumb-styled'), style: { left: `${start}%` }, "data-testid": 'range:thumb-start' }), (0, jsx_runtime_1.jsx)("button", { type: 'button', "aria-label": '\u041A\u043E\u043D\u0435\u0447\u043D\u043E\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D\u0430', ref: this.finishThumbRef, className: cx('thumb-base', 'thumb-styled'), style: { left: `${finish}%` }, "data-testid": 'range:thumb-end' })] }))] })));
|
|
285
258
|
}
|
|
286
259
|
}
|
|
287
260
|
exports.Range = Range;
|
package/rating/index.d.ts
CHANGED
package/rating/index.js
CHANGED
|
@@ -15,10 +15,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
exports.Rating = void 0;
|
|
18
|
-
const
|
|
18
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
19
19
|
const utils_1 = require("./utils");
|
|
20
20
|
const bind_1 = __importDefault(require("classnames/bind"));
|
|
21
|
-
const
|
|
21
|
+
const Star_1 = __importDefault(require("@sima-land/ui-quarks/icons/16x16/Filled/Star"));
|
|
22
22
|
const rating_module_scss_1 = __importDefault(require("./rating.module.scss"));
|
|
23
23
|
const cx = bind_1.default.bind(rating_module_scss_1.default);
|
|
24
24
|
/**
|
|
@@ -28,7 +28,7 @@ const cx = bind_1.default.bind(rating_module_scss_1.default);
|
|
|
28
28
|
*/
|
|
29
29
|
const Rating = (_a) => {
|
|
30
30
|
var { size = 's', value, className, 'data-testid': testId = 'rating' } = _a, restProps = __rest(_a, ["size", "value", "className", 'data-testid']);
|
|
31
|
-
return (
|
|
31
|
+
return ((0, jsx_runtime_1.jsx)("div", Object.assign({}, restProps, { className: cx('root', className), "data-testid": testId, "data-rating": value }, { children: (0, utils_1.getStars)(Math.min(5, value), 5).map((type, index) => ((0, jsx_runtime_1.jsx)(Star, { type: type, size: size }, index))) })));
|
|
32
32
|
};
|
|
33
33
|
exports.Rating = Rating;
|
|
34
34
|
/**
|
|
@@ -36,9 +36,4 @@ exports.Rating = Rating;
|
|
|
36
36
|
* @param props Свойства.
|
|
37
37
|
* @return Элемент.
|
|
38
38
|
*/
|
|
39
|
-
const Star = ({ type, size }) => (
|
|
40
|
-
type === 'empty' && react_1.default.createElement(star_svg_1.default, { className: cx('svg') }),
|
|
41
|
-
type === 'half' && (react_1.default.createElement(react_1.default.Fragment, null,
|
|
42
|
-
react_1.default.createElement(star_svg_1.default, { className: cx('svg') }),
|
|
43
|
-
react_1.default.createElement(star_svg_1.default, { className: cx('svg', 'half'), preserveAspectRatio: 'xMinYMin slice' }))),
|
|
44
|
-
type === 'full' && react_1.default.createElement(star_svg_1.default, { className: cx('svg', 'full') })));
|
|
39
|
+
const Star = ({ type, size }) => ((0, jsx_runtime_1.jsxs)("div", Object.assign({ className: cx('star', `size-${size}`) }, { children: [type === 'empty' && (0, jsx_runtime_1.jsx)(Star_1.default, { className: cx('svg') }), type === 'half' && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Star_1.default, { className: cx('svg') }), (0, jsx_runtime_1.jsx)(Star_1.default, { className: cx('svg', 'half'), preserveAspectRatio: 'xMinYMin slice' })] })), type === 'full' && (0, jsx_runtime_1.jsx)(Star_1.default, { className: cx('svg', 'full') })] })));
|