@sima-land/ui-nucleons 44.2.3 → 44.2.6

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.
@@ -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, react_1.useEffect)(() => {
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
- defaultChecked, checked = defaultChecked, disabled, onChange } = _a, restProps = __rest(_a, ["className", "style", 'data-testid', "defaultChecked", "checked", "disabled", "onChange"]);
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'), onChange: event => {
62
- toggleCheck(event.target.checked);
63
- onChange === null || onChange === void 0 ? void 0 : onChange(event);
64
- }, checked: isChecked, disabled: disabled })),
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.useEffect;
29
+ export declare const useIsomorphicLayoutEffect: typeof React.useLayoutEffect;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sima-land/ui-nucleons",
3
- "version": "44.2.3",
3
+ "version": "44.2.6",
4
4
  "repository": "ssh://git@github.com:sima-land/ui-nucleons.git",
5
5
  "author": "www.sima-land.ru team",
6
6
  "license": "Apache-2.0",
package/range/index.js CHANGED
@@ -280,8 +280,8 @@ class Range extends react_1.Component {
280
280
  width: `${finish - start}%`,
281
281
  } }),
282
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', ref: this.startThumbRef, className: cx('thumb-base', 'thumb-styled'), style: { left: `${start}%` } }),
284
- react_1.default.createElement("button", { type: 'button', ref: this.finishThumbRef, className: cx('thumb-base', 'thumb-styled'), style: { left: `${finish}%` } }))));
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' }))));
285
285
  }
286
286
  }
287
287
  exports.Range = Range;
@@ -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>
@@ -1,3 +0,0 @@
1
- <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <rect x="0.5" y="0.5" width="15" height="15" rx="1.5" fill="#F5F5F5" stroke="#C2C2C2"/>
3
- </svg>
@@ -1,3 +0,0 @@
1
- <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <rect x="0.5" y="0.5" width="15" height="15" rx="1.5" stroke="#9E9E9E"/>
3
- </svg>