@sima-land/ui-nucleons 45.0.0-alpha.0 → 45.0.0-alpha.2
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/bottom-bar/bottom-bar.d.ts +1 -1
- package/bottom-bar/index.d.ts +1 -1
- package/breakpoints.scss +33 -2
- package/colors/index.d.ts +1 -1
- package/colors/index.js +2 -1
- package/colors.scss +2 -0
- package/dropdown/utils.js +2 -0
- package/dropdown-item/index.d.ts +1 -1
- package/dropdown-item/index.js +4 -3
- package/expandable/index.d.ts +1 -0
- package/hint/hint-view.module.scss +1 -0
- package/hooks/index.js +3 -1
- package/hooks/keydown.js +2 -5
- package/link/index.d.ts +1 -1
- package/link/link-util.scss +37 -0
- package/link/link.module.scss +13 -16
- package/modal/modal.module.scss +1 -1
- package/modal-overlay/modal-overlay.module.scss +5 -2
- package/package.json +1 -1
- package/readme.md +27 -29
- package/select/parts/block.js +1 -1
- package/select/parts/block.module.scss +4 -0
- package/switcher-row/index.js +3 -2
- package/switcher-row/switcher-row.module.scss +5 -1
- package/text-button/text-button.module.scss +13 -16
- package/toggle/toggle.module.scss +8 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { BottomBarProps, BottomBarSize } from './types';
|
|
2
|
+
import { BottomBarProps, type BottomBarSize } from './types';
|
|
3
3
|
export declare const BOTTOM_BAR_HEIGHT: Record<BottomBarSize, number>;
|
|
4
4
|
export declare const BOTTOM_BAR_DEFAULTS: {
|
|
5
5
|
readonly size: "m";
|
package/bottom-bar/index.d.ts
CHANGED
package/breakpoints.scss
CHANGED
|
@@ -10,7 +10,12 @@ $map: (
|
|
|
10
10
|
xl: 1920px,
|
|
11
11
|
) !default;
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
/**
|
|
14
|
+
* ВАЖНО: здесь должны быть только утилиты позволяющие применить стили ">=" либо "<" начала диапазона (breakpoint range).
|
|
15
|
+
* Не должно возникать ситуаций в которых нужно применить стили "<=" или ">" начала диапазона.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
@mixin greaterThanOrEqual($breakpoint) {
|
|
14
19
|
@if map-has-key($map, $breakpoint) {
|
|
15
20
|
@media (min-width: map-get($map, $breakpoint)) {
|
|
16
21
|
@content;
|
|
@@ -20,7 +25,7 @@ $map: (
|
|
|
20
25
|
}
|
|
21
26
|
}
|
|
22
27
|
|
|
23
|
-
@mixin
|
|
28
|
+
@mixin lessThan($breakpoint) {
|
|
24
29
|
@if map-has-key($map, $breakpoint) {
|
|
25
30
|
@media (max-width: (map-get($map, $breakpoint) - 1px)) {
|
|
26
31
|
@content;
|
|
@@ -29,3 +34,29 @@ $map: (
|
|
|
29
34
|
@warn 'No such breakpoint `#{$breakpoint}`. Available values: #{map-keys($map)}.';
|
|
30
35
|
}
|
|
31
36
|
}
|
|
37
|
+
|
|
38
|
+
@mixin gte($args...) {
|
|
39
|
+
@include greaterThanOrEqual($args...) {
|
|
40
|
+
@content;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
@mixin lt($args...) {
|
|
45
|
+
@include lessThan($args...) {
|
|
46
|
+
@content;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** @deprecated */
|
|
51
|
+
@mixin up($args...) {
|
|
52
|
+
@include greaterThanOrEqual($args...) {
|
|
53
|
+
@content;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** @deprecated */
|
|
58
|
+
@mixin down($args...) {
|
|
59
|
+
@include lessThan($args...) {
|
|
60
|
+
@content;
|
|
61
|
+
}
|
|
62
|
+
}
|
package/colors/index.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ declare const collection: {
|
|
|
10
10
|
readonly 'basic-gray8': "#ebebeb";
|
|
11
11
|
readonly 'basic-gray4': "#f5f5f5";
|
|
12
12
|
readonly 'basic-gray2': "#fafafa";
|
|
13
|
-
readonly 'basic-white': "#
|
|
13
|
+
readonly 'basic-white': "#fff";
|
|
14
14
|
readonly 'additional-deep-red': "#d50000";
|
|
15
15
|
readonly 'additional-red': "#fb3a2f";
|
|
16
16
|
readonly 'additional-light-red': "#feebea";
|
package/colors/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
// GENERATED FILE - DO NOT CHANGE IT MANUALLY
|
|
2
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
4
|
exports.COLORS = void 0;
|
|
4
5
|
const collection = {
|
|
@@ -14,7 +15,7 @@ const collection = {
|
|
|
14
15
|
'basic-gray8': '#ebebeb',
|
|
15
16
|
'basic-gray4': '#f5f5f5',
|
|
16
17
|
'basic-gray2': '#fafafa',
|
|
17
|
-
'basic-white': '#
|
|
18
|
+
'basic-white': '#fff',
|
|
18
19
|
// additional
|
|
19
20
|
'additional-deep-red': '#d50000',
|
|
20
21
|
'additional-red': '#fb3a2f',
|
package/colors.scss
CHANGED
package/dropdown/utils.js
CHANGED
|
@@ -12,6 +12,8 @@ function dropdownFloatingConfig() {
|
|
|
12
12
|
whileElementsMounted: react_1.autoUpdate,
|
|
13
13
|
placement: 'bottom-start',
|
|
14
14
|
middleware: [
|
|
15
|
+
// @todo в будущем с дизайнерами можем решить использовать autoPlacement
|
|
16
|
+
// но есть сложности: https://github.com/floating-ui/floating-ui/discussions/2155
|
|
15
17
|
(0, react_1.flip)({
|
|
16
18
|
padding: 16,
|
|
17
19
|
}),
|
package/dropdown-item/index.d.ts
CHANGED
|
@@ -31,4 +31,4 @@ export interface DropdownItemProps extends Omit<React.HTMLAttributes<HTMLDivElem
|
|
|
31
31
|
* @param props Свойства.
|
|
32
32
|
* @return Элемент.
|
|
33
33
|
*/
|
|
34
|
-
export declare function DropdownItem({ size, children, className, selected, disabled, noHover, checked, startContent, startIcon: StartIcon, endContent, endIcon: EndIcon, comment, 'data-testid': testId, ...restProps }: DropdownItemProps): JSX.Element;
|
|
34
|
+
export declare function DropdownItem({ size, children, className, selected, disabled, noHover, checked, startContent, startIcon: StartIcon, endContent, endIcon: EndIcon, comment, dangerouslySetInnerHTML, 'data-testid': testId, ...restProps }: DropdownItemProps): JSX.Element;
|
package/dropdown-item/index.js
CHANGED
|
@@ -25,14 +25,15 @@ const cx = bind_1.default.bind(dropdown_item_module_scss_1.default);
|
|
|
25
25
|
* @return Элемент.
|
|
26
26
|
*/
|
|
27
27
|
function DropdownItem(_a) {
|
|
28
|
-
var { size = 'm', children, className, selected, disabled, noHover, checked, startContent, startIcon: StartIcon, endContent, endIcon: EndIcon, comment, 'data-testid': testId = 'dropdown-item' } = _a, restProps = __rest(_a, ["size", "children", "className", "selected", "disabled", "noHover", "checked", "startContent", "startIcon", "endContent", "endIcon", "comment", 'data-testid']);
|
|
28
|
+
var { size = 'm', children, className, selected, disabled, noHover, checked, startContent, startIcon: StartIcon, endContent, endIcon: EndIcon, comment, dangerouslySetInnerHTML, 'data-testid': testId = 'dropdown-item' } = _a, restProps = __rest(_a, ["size", "children", "className", "selected", "disabled", "noHover", "checked", "startContent", "startIcon", "endContent", "endIcon", "comment", "dangerouslySetInnerHTML", 'data-testid']);
|
|
29
29
|
const start = StartIcon ? react_1.default.createElement(StartIcon, { className: cx('icon') }) : startContent;
|
|
30
30
|
const end = EndIcon ? react_1.default.createElement(EndIcon, { className: cx('icon') }) : endContent;
|
|
31
|
-
|
|
31
|
+
const hasChildren = [start, children, end].some(item => typeof item !== 'undefined');
|
|
32
|
+
return (react_1.default.createElement("div", Object.assign({}, restProps, { className: cx('root', `size-${size}`, selected && 'selected', checked && 'checked', disabled && 'disabled', noHover && 'no-hover', className), dangerouslySetInnerHTML: dangerouslySetInnerHTML, "data-testid": testId }), hasChildren ? (react_1.default.createElement(react_1.default.Fragment, null,
|
|
32
33
|
start && react_1.default.createElement("div", { className: cx('col', 'col-start') }, start),
|
|
33
34
|
react_1.default.createElement("div", { className: cx('col', 'col-center') },
|
|
34
35
|
react_1.default.createElement("div", { className: cx('row-main') }, children),
|
|
35
36
|
size === 'xl' && comment && react_1.default.createElement("div", { className: cx('row-comment') }, comment)),
|
|
36
|
-
end && react_1.default.createElement("div", { className: cx('col', 'col-end') }, end)));
|
|
37
|
+
end && react_1.default.createElement("div", { className: cx('col', 'col-end') }, end))) : undefined));
|
|
37
38
|
}
|
|
38
39
|
exports.DropdownItem = DropdownItem;
|
package/expandable/index.d.ts
CHANGED
package/hooks/index.js
CHANGED
|
@@ -64,7 +64,9 @@ function useOutsideClick(elementRef, callback) {
|
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
66
|
isOutsideClick && ((_a = callbackRef.current) === null || _a === void 0 ? void 0 : _a.call(callbackRef, event));
|
|
67
|
-
}
|
|
67
|
+
},
|
|
68
|
+
// ВАЖНО: чтобы изменение DOM не приводило к ложному срабатыванию
|
|
69
|
+
{ capture: true });
|
|
68
70
|
return off;
|
|
69
71
|
}, []);
|
|
70
72
|
}
|
package/hooks/keydown.js
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.useKeydown = void 0;
|
|
7
4
|
const react_1 = require("react");
|
|
8
5
|
const identity_1 = require("./identity");
|
|
9
|
-
const on_1 =
|
|
6
|
+
const on_1 = require("../helpers/on");
|
|
10
7
|
/**
|
|
11
8
|
* Хук, добавляющий обработчик нажатия на клавишу.
|
|
12
9
|
* @param targetKey Клавиша, для которой отслеживается нажатие.
|
|
@@ -14,7 +11,7 @@ const on_1 = __importDefault(require("../helpers/on"));
|
|
|
14
11
|
*/
|
|
15
12
|
function useKeydown(targetKey, callback) {
|
|
16
13
|
const ref = (0, identity_1.useIdentityRef)(callback);
|
|
17
|
-
(0, react_1.useEffect)(() => (0, on_1.
|
|
14
|
+
(0, react_1.useEffect)(() => (0, on_1.on)(document, 'keydown', event => {
|
|
18
15
|
const handler = ref.current;
|
|
19
16
|
(event.key === targetKey || event.code === targetKey) && (handler === null || handler === void 0 ? void 0 : handler(event));
|
|
20
17
|
}), [targetKey]);
|
package/link/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Token } from '../colors';
|
|
3
|
-
export type LinkColor = Extract<Token, 'basic-blue' | 'basic-gray87' | 'basic-gray38' | 'basic-white'>;
|
|
3
|
+
export type LinkColor = Extract<Token, 'basic-blue' | 'basic-gray87' | 'basic-gray38' | 'basic-white' | 'additional-red' | 'additional-teal'>;
|
|
4
4
|
export interface LinkProps extends React.AnchorHTMLAttributes<HTMLAnchorElement> {
|
|
5
5
|
/** Цвет (название токена). */
|
|
6
6
|
color?: LinkColor;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
@use '../colors';
|
|
2
|
+
|
|
3
|
+
@mixin color($key) {
|
|
4
|
+
@if $key == 'basic-blue' {
|
|
5
|
+
color: colors.$basic-blue;
|
|
6
|
+
&:hover {
|
|
7
|
+
color: colors.$additional-deep-blue;
|
|
8
|
+
}
|
|
9
|
+
} @else if $key == 'basic-gray87' {
|
|
10
|
+
color: colors.$basic-gray87;
|
|
11
|
+
&:hover {
|
|
12
|
+
color: colors.$basic-gray54;
|
|
13
|
+
}
|
|
14
|
+
} @else if $key == 'basic-gray38' {
|
|
15
|
+
color: colors.$basic-gray38;
|
|
16
|
+
&:hover {
|
|
17
|
+
color: colors.$basic-gray54;
|
|
18
|
+
}
|
|
19
|
+
} @else if $key == 'basic-white' {
|
|
20
|
+
color: colors.$basic-white;
|
|
21
|
+
&:hover {
|
|
22
|
+
color: colors.$basic-gray4;
|
|
23
|
+
}
|
|
24
|
+
} @else if $key == 'additional-red' {
|
|
25
|
+
color: colors.$additional-red;
|
|
26
|
+
&:hover {
|
|
27
|
+
color: colors.$additional-deep-red;
|
|
28
|
+
}
|
|
29
|
+
} @else if $key == 'additional-teal' {
|
|
30
|
+
color: colors.$additional-teal;
|
|
31
|
+
&:hover {
|
|
32
|
+
color: colors.$additional-green;
|
|
33
|
+
}
|
|
34
|
+
} @else {
|
|
35
|
+
@warn '[link-color] No such color `#{$key}`.';
|
|
36
|
+
}
|
|
37
|
+
}
|
package/link/link.module.scss
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
@use '../colors';
|
|
2
|
+
@use './link-util';
|
|
2
3
|
|
|
3
4
|
.link,
|
|
4
5
|
.link:link,
|
|
@@ -25,29 +26,25 @@
|
|
|
25
26
|
}
|
|
26
27
|
|
|
27
28
|
.link:not(.disabled).basic-blue {
|
|
28
|
-
color
|
|
29
|
-
&:hover {
|
|
30
|
-
color: colors.$additional-deep-blue;
|
|
31
|
-
}
|
|
29
|
+
@include link-util.color('basic-blue');
|
|
32
30
|
}
|
|
33
31
|
|
|
34
32
|
.link:not(.disabled).basic-gray87 {
|
|
35
|
-
color
|
|
36
|
-
&:hover {
|
|
37
|
-
color: colors.$basic-gray54;
|
|
38
|
-
}
|
|
33
|
+
@include link-util.color('basic-gray87');
|
|
39
34
|
}
|
|
40
35
|
|
|
41
36
|
.link:not(.disabled).basic-gray38 {
|
|
42
|
-
color
|
|
43
|
-
&:hover {
|
|
44
|
-
color: colors.$basic-gray54;
|
|
45
|
-
}
|
|
37
|
+
@include link-util.color('basic-gray38');
|
|
46
38
|
}
|
|
47
39
|
|
|
48
40
|
.link:not(.disabled).basic-white {
|
|
49
|
-
color
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
41
|
+
@include link-util.color('basic-white');
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.link:not(.disabled).additional-red {
|
|
45
|
+
@include link-util.color('additional-red');
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.link:not(.disabled).additional-teal {
|
|
49
|
+
@include link-util.color('additional-teal');
|
|
53
50
|
}
|
package/modal/modal.module.scss
CHANGED
|
@@ -5,9 +5,12 @@
|
|
|
5
5
|
position: fixed;
|
|
6
6
|
top: 0;
|
|
7
7
|
left: 0;
|
|
8
|
+
|
|
9
|
+
// ВАЖНО: высота/ширина в процентах тк при использовании 100vw/100vh размер ломается если у body указан min-width
|
|
10
|
+
height: 100%;
|
|
11
|
+
width: 100%;
|
|
12
|
+
|
|
8
13
|
display: flex;
|
|
9
|
-
width: 100vw;
|
|
10
|
-
height: calc(var(--vh, 1vh) * 100);
|
|
11
14
|
background: modal-overlay-util.$overlay-color;
|
|
12
15
|
overflow: auto;
|
|
13
16
|
@include utils.hidden-scrollbars;
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
## Использование
|
|
6
6
|
|
|
7
|
-
Установка
|
|
7
|
+
### Установка
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
10
|
# npm
|
|
@@ -14,10 +14,11 @@ npm i -S @sima-land/ui-nucleons
|
|
|
14
14
|
yarn add @sima-land/ui-nucleons
|
|
15
15
|
```
|
|
16
16
|
|
|
17
|
-
### Настройка
|
|
17
|
+
### Настройка среды
|
|
18
18
|
|
|
19
19
|
Компоненты библиотеки используют:
|
|
20
20
|
|
|
21
|
+
- импорты изображений (jpg, png..) как url/src
|
|
21
22
|
- импорты стилей
|
|
22
23
|
- импорты стилей как css-модулей (каждый такой файл промаркирован в виде `%filename%.module.scss`)
|
|
23
24
|
- импорты svg-файлов как react-компоненты
|
|
@@ -27,13 +28,13 @@ yarn add @sima-land/ui-nucleons
|
|
|
27
28
|
- добавить необходимые пакеты `@svgr/*`
|
|
28
29
|
- сконфигурировать обработку svg, css, scss файлов
|
|
29
30
|
|
|
30
|
-
#####
|
|
31
|
+
##### Зависимости
|
|
31
32
|
|
|
32
33
|
```bash
|
|
33
|
-
npm install --save-dev @svgr/core @svgr/plugin-svgo @svgr/webpack
|
|
34
|
+
npm install --save-dev @svgr/core @svgr/plugin-jsx @svgr/plugin-svgo @svgr/webpack
|
|
34
35
|
```
|
|
35
36
|
|
|
36
|
-
##### Конфигурация
|
|
37
|
+
##### Конфигурация
|
|
37
38
|
|
|
38
39
|
```js
|
|
39
40
|
// webpack.config.js
|
|
@@ -42,7 +43,7 @@ const svgrOptions = require('../../svgr.config'); // опции SVGR (скопи
|
|
|
42
43
|
module.exports = {
|
|
43
44
|
module: {
|
|
44
45
|
rules: [
|
|
45
|
-
//
|
|
46
|
+
// svg
|
|
46
47
|
{
|
|
47
48
|
test: /\.svg$/,
|
|
48
49
|
use: [
|
|
@@ -53,23 +54,17 @@ module.exports = {
|
|
|
53
54
|
],
|
|
54
55
|
},
|
|
55
56
|
|
|
56
|
-
//
|
|
57
|
+
// стилей
|
|
57
58
|
{
|
|
58
59
|
test: /\.(css|scss)$/,
|
|
59
|
-
exclude: /\.module\.(css|scss)$/,
|
|
60
|
-
use: ['css-loader', 'sass-loader'],
|
|
61
|
-
},
|
|
62
|
-
|
|
63
|
-
// обработка css-модулей
|
|
64
|
-
{
|
|
65
|
-
test: /\.module\.(css|scss)$/,
|
|
66
60
|
use: [
|
|
61
|
+
// ...здесь style-loader, mini-css-extract-plugin или что-то другое
|
|
67
62
|
{
|
|
68
63
|
loader: 'css-loader',
|
|
69
64
|
options: {
|
|
70
65
|
modules: {
|
|
71
|
-
|
|
72
|
-
|
|
66
|
+
auto: /\.module\.(css|scss)$/,
|
|
67
|
+
localIdentName: '[name]__[local]--[hash:hex:3]',
|
|
73
68
|
},
|
|
74
69
|
},
|
|
75
70
|
},
|
|
@@ -83,21 +78,24 @@ module.exports = {
|
|
|
83
78
|
|
|
84
79
|
#### Для работы с Jest необходимо (как вариант):
|
|
85
80
|
|
|
81
|
+
- добавить необходимые пакеты `@svgr/*`
|
|
82
|
+
- сконфигурировать обработку svg, css, scss файлов
|
|
83
|
+
|
|
86
84
|
##### Добавить обработку SVG
|
|
87
85
|
|
|
88
86
|
- добавить файл "трансформера" вида:
|
|
89
87
|
|
|
90
88
|
```js
|
|
91
|
-
const
|
|
89
|
+
const babel = require('@babel/core');
|
|
90
|
+
const babelConfig = require('../../babel.config');
|
|
92
91
|
const svgr = require('@svgr/core');
|
|
93
92
|
const svgrConfig = require('../../svgr.config');
|
|
94
93
|
|
|
95
94
|
module.exports = {
|
|
96
95
|
process(sourceText, sourcePath) {
|
|
97
96
|
const code = svgr.transform.sync(sourceText, svgrConfig, { filePath: sourcePath });
|
|
98
|
-
const result = swc.transformSync(code);
|
|
99
97
|
|
|
100
|
-
return
|
|
98
|
+
return babel.transformSync(code, { filename: sourcePath, ...babelConfig });
|
|
101
99
|
},
|
|
102
100
|
};
|
|
103
101
|
```
|
|
@@ -111,19 +109,19 @@ module.exports = {
|
|
|
111
109
|
```js
|
|
112
110
|
module.exports = {
|
|
113
111
|
transform: {
|
|
114
|
-
// svg
|
|
115
|
-
'\\.svg$': '<rootDir
|
|
112
|
+
// svg как react-компоненты
|
|
113
|
+
'\\.svg$': '<rootDir>/.jest/transforms/svg.js',
|
|
116
114
|
|
|
117
|
-
//
|
|
118
|
-
'\\.module\\.(css|scss)$': '
|
|
115
|
+
// обычный css
|
|
116
|
+
'(?<!(\\.module))\\.(css|scss)$': './transformer/empty.js',
|
|
119
117
|
|
|
120
|
-
//
|
|
121
|
-
|
|
122
|
-
moduleNameMapper: {
|
|
123
|
-
// обычные стили делаем просто пустыми модулями
|
|
124
|
-
'(?<!(.+\\.module))(\\.css|\\.scss)$': '<rootDir>/jest/mocks/style.js',
|
|
118
|
+
// css-модули
|
|
119
|
+
'\\.module\\.(css|scss)$': 'jest-css-modules-transform',
|
|
125
120
|
},
|
|
126
|
-
|
|
121
|
+
transformIgnorePatterns: [
|
|
122
|
+
// в пакете содержится css-модули, поэтому игнорируем только скрипты
|
|
123
|
+
'/node_modules/.+js$',
|
|
124
|
+
],
|
|
127
125
|
// ...
|
|
128
126
|
};
|
|
129
127
|
```
|
package/select/parts/block.js
CHANGED
|
@@ -65,6 +65,6 @@ function SelectFieldBlock(props) {
|
|
|
65
65
|
var _a, _b, _c;
|
|
66
66
|
(_a = binding.onMouseDown) === null || _a === void 0 ? void 0 : _a.call(binding, event);
|
|
67
67
|
(_c = (_b = props.blockProps) === null || _b === void 0 ? void 0 : _b.onMouseDown) === null || _c === void 0 ? void 0 : _c.call(_b, event);
|
|
68
|
-
}, role: 'combobox', tabIndex: binding.disabled ? undefined : 0, className: (0, classnames_1.default)(block_module_scss_1.default.block, (_a = props.blockProps) === null || _a === void 0 ? void 0 : _a.className) }), focused: focused || binding.opened, labelAsPlaceholder: !binding.value, main: binding.value })));
|
|
68
|
+
}, role: 'combobox', tabIndex: binding.disabled ? undefined : 0, className: (0, classnames_1.default)(block_module_scss_1.default.block, (_a = props.blockProps) === null || _a === void 0 ? void 0 : _a.className) }), focused: focused || binding.opened, labelAsPlaceholder: !binding.value, main: binding.value, mainProps: { className: block_module_scss_1.default.main } })));
|
|
69
69
|
}
|
|
70
70
|
exports.SelectFieldBlock = SelectFieldBlock;
|
package/switcher-row/index.js
CHANGED
|
@@ -17,7 +17,7 @@ const cx = bind_1.default.bind(switcher_row_module_scss_1.default);
|
|
|
17
17
|
* @param props Свойства.
|
|
18
18
|
* @return Элемент.
|
|
19
19
|
*/
|
|
20
|
-
function SwitcherRow({ children, className, style, textAlign, fieldPosition = 'start', 'data-testid': testId = 'switcher-row', }) {
|
|
20
|
+
function SwitcherRow({ children, className, style, textAlign = 'left', fieldPosition = 'start', 'data-testid': testId = 'switcher-row', }) {
|
|
21
21
|
var _a;
|
|
22
22
|
const { toggle, checkbox, radio, label, comment } = (0, define_slots_1.defineSlots)(children, {
|
|
23
23
|
toggle: toggle_1.Toggle,
|
|
@@ -30,7 +30,8 @@ function SwitcherRow({ children, className, style, textAlign, fieldPosition = 's
|
|
|
30
30
|
const failed = input === null || input === void 0 ? void 0 : input.props.failed;
|
|
31
31
|
const disabled = input === null || input === void 0 ? void 0 : input.props.disabled;
|
|
32
32
|
const fieldId = input === null || input === void 0 ? void 0 : input.props.id;
|
|
33
|
-
|
|
33
|
+
// @todo в Safari position: relative ломает vertical-align
|
|
34
|
+
const fieldColumn = input && (react_1.default.createElement("div", { className: cx('col', 'field-col', { 'toggle-col': toggle }) }, input));
|
|
34
35
|
return (react_1.default.createElement("div", { className: cx('root', `text-align-${textAlign}`, { failed, disabled }, className), style: style, "data-testid": testId },
|
|
35
36
|
fieldPosition === 'start' && fieldColumn,
|
|
36
37
|
react_1.default.createElement("label", { className: cx('col', 'main-col'), htmlFor: fieldId },
|
|
@@ -21,6 +21,10 @@
|
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
.col + .col {
|
|
24
|
+
margin-left: 8px;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.toggle-col + .col {
|
|
24
28
|
margin-left: 12px;
|
|
25
29
|
}
|
|
26
30
|
|
|
@@ -29,7 +33,7 @@
|
|
|
29
33
|
}
|
|
30
34
|
|
|
31
35
|
.main-col {
|
|
32
|
-
flex-grow: 1
|
|
36
|
+
// ВАЖНО: чтобы область нажатия ограничивалась текстом не задаем тут flex-grow: 1
|
|
33
37
|
cursor: pointer;
|
|
34
38
|
}
|
|
35
39
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
@use '../colors';
|
|
2
2
|
@use '../utils';
|
|
3
|
+
@use '../link/link-util';
|
|
3
4
|
|
|
4
5
|
.root {
|
|
5
6
|
@include utils.reset-button;
|
|
@@ -56,31 +57,27 @@
|
|
|
56
57
|
}
|
|
57
58
|
|
|
58
59
|
.root:not(.disabled).color-basic-blue {
|
|
59
|
-
color
|
|
60
|
-
&:hover {
|
|
61
|
-
color: colors.$additional-deep-blue;
|
|
62
|
-
}
|
|
60
|
+
@include link-util.color('basic-blue');
|
|
63
61
|
}
|
|
64
62
|
|
|
65
63
|
.root:not(.disabled).color-basic-gray87 {
|
|
66
|
-
color
|
|
67
|
-
&:hover {
|
|
68
|
-
color: colors.$basic-gray54;
|
|
69
|
-
}
|
|
64
|
+
@include link-util.color('basic-gray87');
|
|
70
65
|
}
|
|
71
66
|
|
|
72
67
|
.root:not(.disabled).color-basic-gray38 {
|
|
73
|
-
color
|
|
74
|
-
&:hover {
|
|
75
|
-
color: colors.$basic-gray54;
|
|
76
|
-
}
|
|
68
|
+
@include link-util.color('basic-gray38');
|
|
77
69
|
}
|
|
78
70
|
|
|
79
71
|
.root:not(.disabled).color-basic-white {
|
|
80
|
-
color
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
72
|
+
@include link-util.color('basic-white');
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.root:not(.disabled).color-additional-red {
|
|
76
|
+
@include link-util.color('additional-red');
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.root:not(.disabled).color-additional-teal {
|
|
80
|
+
@include link-util.color('additional-teal');
|
|
84
81
|
}
|
|
85
82
|
|
|
86
83
|
// иконки
|
|
@@ -6,11 +6,17 @@
|
|
|
6
6
|
cursor: pointer;
|
|
7
7
|
user-select: none;
|
|
8
8
|
vertical-align: -2px;
|
|
9
|
-
overflow: hidden;
|
|
10
9
|
}
|
|
11
10
|
|
|
12
11
|
.input {
|
|
13
|
-
|
|
12
|
+
position: absolute;
|
|
13
|
+
display: block;
|
|
14
|
+
opacity: 0;
|
|
15
|
+
padding: 0;
|
|
16
|
+
margin: 0;
|
|
17
|
+
width: 0;
|
|
18
|
+
height: 0;
|
|
19
|
+
pointer-events: none;
|
|
14
20
|
&:not(:checked) + .switch {
|
|
15
21
|
--toggle-slider-position: 2px;
|
|
16
22
|
}
|