@sima-land/ui-nucleons 44.2.2 → 44.2.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/body-scroll.js +2 -2
- package/checkbox/checkbox.module.scss +21 -0
- package/checkbox/index.js +6 -18
- package/hooks/index.d.ts +1 -1
- package/package.json +1 -1
- package/text-field/text-field.module.scss +5 -5
- package/checkbox/svg/checked.svg +0 -4
- package/checkbox/svg/disabled-checked.svg +0 -4
- package/checkbox/svg/disabled-unchecked.svg +0 -3
- package/checkbox/svg/unchecked.svg +0 -3
package/_internal/body-scroll.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.allowTouchMove = exports.useBodyScrollLock = void 0;
|
|
4
4
|
const body_scroll_lock_1 = require("body-scroll-lock");
|
|
5
|
-
const react_1 = require("react");
|
|
6
5
|
const constants_1 = require("../constants");
|
|
6
|
+
const hooks_1 = require("../hooks");
|
|
7
7
|
/**
|
|
8
8
|
* Хук управления блокировкой прокрутки body.
|
|
9
9
|
* @param ref Реф элемента для которого нужно отключить прокрутку body.
|
|
@@ -11,7 +11,7 @@ const constants_1 = require("../constants");
|
|
|
11
11
|
* @param options Опции.
|
|
12
12
|
*/
|
|
13
13
|
const useBodyScrollLock = (ref, needDisable, options) => {
|
|
14
|
-
(0,
|
|
14
|
+
(0, hooks_1.useIsomorphicLayoutEffect)(() => {
|
|
15
15
|
const element = ref.current;
|
|
16
16
|
if (element && needDisable) {
|
|
17
17
|
(0, body_scroll_lock_1.disableBodyScroll)(element, options);
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
@use '../colors';
|
|
2
|
+
|
|
1
3
|
.root {
|
|
2
4
|
position: relative;
|
|
3
5
|
display: inline-block;
|
|
@@ -17,4 +19,23 @@
|
|
|
17
19
|
opacity: 0;
|
|
18
20
|
margin: 0;
|
|
19
21
|
padding: 0;
|
|
22
|
+
&:not(:checked) + svg .mark {
|
|
23
|
+
display: none;
|
|
24
|
+
}
|
|
25
|
+
&:not(:checked) + svg .square {
|
|
26
|
+
fill: #fff;
|
|
27
|
+
stroke: colors.$basic-gray24;
|
|
28
|
+
}
|
|
29
|
+
&:checked + svg .square {
|
|
30
|
+
fill: colors.$basic-blue;
|
|
31
|
+
stroke: colors.$basic-blue;
|
|
32
|
+
}
|
|
33
|
+
&:disabled:not(:checked) + svg .square {
|
|
34
|
+
fill: colors.$basic-gray4;
|
|
35
|
+
stroke: colors.$basic-gray24;
|
|
36
|
+
}
|
|
37
|
+
&:disabled:checked + svg .square {
|
|
38
|
+
fill: colors.$basic-gray12;
|
|
39
|
+
stroke: colors.$basic-gray12;
|
|
40
|
+
}
|
|
20
41
|
}
|
package/checkbox/index.js
CHANGED
|
@@ -39,10 +39,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
39
39
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
40
40
|
exports.Checkbox = void 0;
|
|
41
41
|
const react_1 = __importStar(require("react"));
|
|
42
|
-
const checked_svg_1 = __importDefault(require("./svg/checked.svg"));
|
|
43
|
-
const unchecked_svg_1 = __importDefault(require("./svg/unchecked.svg"));
|
|
44
|
-
const disabled_checked_svg_1 = __importDefault(require("./svg/disabled-checked.svg"));
|
|
45
|
-
const disabled_unchecked_svg_1 = __importDefault(require("./svg/disabled-unchecked.svg"));
|
|
46
42
|
const bind_1 = __importDefault(require("classnames/bind"));
|
|
47
43
|
const checkbox_module_scss_1 = __importDefault(require("./checkbox.module.scss"));
|
|
48
44
|
const cx = bind_1.default.bind(checkbox_module_scss_1.default);
|
|
@@ -50,21 +46,13 @@ const cx = bind_1.default.bind(checkbox_module_scss_1.default);
|
|
|
50
46
|
* Компонент стилизованного переключателя (input[type=checkbox]).
|
|
51
47
|
*/
|
|
52
48
|
exports.Checkbox = (0, react_1.forwardRef)((_a, ref) => {
|
|
53
|
-
var { className, style, 'data-testid': testId = 'checkbox',
|
|
49
|
+
var { className, style, 'data-testid': testId = 'checkbox' } = _a,
|
|
54
50
|
// input props
|
|
55
|
-
|
|
56
|
-
const [isChecked, toggleCheck] = (0, react_1.useState)(Boolean(checked));
|
|
57
|
-
(0, react_1.useEffect)(() => {
|
|
58
|
-
toggleCheck(Boolean(checked));
|
|
59
|
-
}, [checked]);
|
|
51
|
+
restProps = __rest(_a, ["className", "style", 'data-testid']);
|
|
60
52
|
return (react_1.default.createElement("span", { className: cx('root', className), style: style },
|
|
61
|
-
react_1.default.createElement("input", Object.assign({}, restProps, { "data-testid": testId, ref: ref, type: 'checkbox', className: cx('input'),
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
!isChecked && !disabled && react_1.default.createElement(unchecked_svg_1.default, null),
|
|
66
|
-
isChecked && !disabled && react_1.default.createElement(checked_svg_1.default, null),
|
|
67
|
-
!isChecked && disabled && react_1.default.createElement(disabled_unchecked_svg_1.default, null),
|
|
68
|
-
isChecked && disabled && react_1.default.createElement(disabled_checked_svg_1.default, null)));
|
|
53
|
+
react_1.default.createElement("input", Object.assign({}, restProps, { "data-testid": testId, ref: ref, type: 'checkbox', className: cx('input') })),
|
|
54
|
+
react_1.default.createElement("svg", { width: '16', height: '16', viewBox: '0 0 16 16', fill: 'none' },
|
|
55
|
+
react_1.default.createElement("rect", { x: '0.5', y: '0.5', width: '15', height: '15', rx: '1.5', className: cx('square') }),
|
|
56
|
+
react_1.default.createElement("path", { fillRule: 'evenodd', clipRule: 'evenodd', d: 'M10.8 5.21967L6.4 9.18934L5.36569 8.21967C5.05327 7.92678 4.54673 7.92678 4.23431 8.21967C3.9219 8.51256 3.9219 8.98744 4.23431 9.28033L5.83431 10.7803C6.14673 11.0732 6.65327 11.0732 6.96569 10.7803L11.7657 6.28033C12.0781 5.98744 12.0781 5.51256 11.7657 5.21967C11.4533 4.92678 11.1124 4.92678 10.8 5.21967Z', fill: 'white', className: cx('mark') }))));
|
|
69
57
|
});
|
|
70
58
|
exports.Checkbox.displayName = 'Checkbox';
|
package/hooks/index.d.ts
CHANGED
|
@@ -26,4 +26,4 @@ export declare const useOutsideClick: (elementRef: React.MutableRefObject<HTMLEl
|
|
|
26
26
|
* Нужен для того чтобы не получать ошибку при использовании в SSR с NodeJS.
|
|
27
27
|
* @see {@link https://gist.github.com/gaearon/e7d97cdf38a2907924ea12e4ebdf3c85#gistcomment-2911761}
|
|
28
28
|
*/
|
|
29
|
-
export declare const useIsomorphicLayoutEffect: typeof React.
|
|
29
|
+
export declare const useIsomorphicLayoutEffect: typeof React.useLayoutEffect;
|
package/package.json
CHANGED
|
@@ -91,7 +91,7 @@ input.reset {
|
|
|
91
91
|
box-shadow: inset 0 -1px colors.$basic-blue;
|
|
92
92
|
}
|
|
93
93
|
&.failed:not(:disabled) {
|
|
94
|
-
box-shadow: inset 0 -1px colors.$additional-red;
|
|
94
|
+
box-shadow: inset 0 -1px colors.$additional-deep-red;
|
|
95
95
|
}
|
|
96
96
|
&:not(.multiline) {
|
|
97
97
|
height: 48px;
|
|
@@ -158,12 +158,12 @@ input.reset {
|
|
|
158
158
|
}
|
|
159
159
|
&.failed.focused,
|
|
160
160
|
&.failed.filled {
|
|
161
|
-
color: colors.$additional-red;
|
|
161
|
+
color: colors.$additional-deep-red;
|
|
162
162
|
}
|
|
163
163
|
}
|
|
164
164
|
&.variant-desktop {
|
|
165
165
|
&.failed:not(.focused):not(.filled) {
|
|
166
|
-
color: colors.$additional-red;
|
|
166
|
+
color: colors.$additional-deep-red;
|
|
167
167
|
}
|
|
168
168
|
}
|
|
169
169
|
}
|
|
@@ -190,7 +190,7 @@ input.reset {
|
|
|
190
190
|
text-overflow: ellipsis;
|
|
191
191
|
}
|
|
192
192
|
&.variant-desktop.failed {
|
|
193
|
-
color: colors.$additional-red;
|
|
193
|
+
color: colors.$additional-deep-red;
|
|
194
194
|
--placeholder-color: #{colors.$additional-deep-red};
|
|
195
195
|
}
|
|
196
196
|
}
|
|
@@ -200,6 +200,6 @@ input.reset {
|
|
|
200
200
|
line-height: 16px;
|
|
201
201
|
color: colors.$basic-gray38;
|
|
202
202
|
&.failed {
|
|
203
|
-
color: colors.$additional-red;
|
|
203
|
+
color: colors.$additional-deep-red;
|
|
204
204
|
}
|
|
205
205
|
}
|
package/checkbox/svg/checked.svg
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
-
<rect width="16" height="16" rx="2" fill="#1F84DB"/>
|
|
3
|
-
<path fill-rule="evenodd" clip-rule="evenodd" d="M10.8 5.21967L6.4 9.18934L5.36569 8.21967C5.05327 7.92678 4.54673 7.92678 4.23431 8.21967C3.9219 8.51256 3.9219 8.98744 4.23431 9.28033L5.83431 10.7803C6.14673 11.0732 6.65327 11.0732 6.96569 10.7803L11.7657 6.28033C12.0781 5.98744 12.0781 5.51256 11.7657 5.21967C11.4533 4.92678 11.1124 4.92678 10.8 5.21967Z" fill="white"/>
|
|
4
|
-
</svg>
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
-
<rect width="16" height="16" rx="2" fill="#E0E0E0"/>
|
|
3
|
-
<path fill-rule="evenodd" clip-rule="evenodd" d="M10.8 5.21967L6.4 9.18934L5.36569 8.21967C5.05327 7.92678 4.54673 7.92678 4.23431 8.21967C3.9219 8.51256 3.9219 8.98744 4.23431 9.28033L5.83431 10.7803C6.14673 11.0732 6.65327 11.0732 6.96569 10.7803L11.7657 6.28033C12.0781 5.98744 12.0781 5.51256 11.7657 5.21967C11.4533 4.92678 11.1124 4.92678 10.8 5.21967Z" fill="#F5F5F5"/>
|
|
4
|
-
</svg>
|