@sima-land/ui-nucleons 40.2.2 → 41.2.0

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.
Files changed (45) hide show
  1. package/_internal/body-scroll.d.ts +9 -0
  2. package/_internal/body-scroll.js +21 -1
  3. package/alert/index.d.ts +2 -0
  4. package/alert/index.js +3 -3
  5. package/arrow-button/index.d.ts +1 -0
  6. package/avatar/user.d.ts +1 -0
  7. package/card/index.d.ts +1 -0
  8. package/chips/index.d.ts +5 -14
  9. package/chips/index.js +24 -9
  10. package/chips/item.d.ts +15 -0
  11. package/chips/item.js +20 -0
  12. package/constants.d.ts +6 -0
  13. package/constants.js +9 -0
  14. package/dot-nav/index.d.ts +1 -0
  15. package/hooks/index.d.ts +2 -1
  16. package/hooks/index.js +9 -7
  17. package/no-index-mark/index.d.ts +1 -0
  18. package/package.json +44 -44
  19. package/pagination/utils.d.ts +1 -1
  20. package/price/index.d.ts +1 -0
  21. package/readme.md +6 -6
  22. package/screen/index.d.ts +12 -53
  23. package/screen/index.js +31 -85
  24. package/screen/screen.module.scss +16 -15
  25. package/screen/slots.d.ts +32 -0
  26. package/screen/slots.js +97 -0
  27. package/screen/utils.d.ts +13 -2
  28. package/screen/utils.js +3 -7
  29. package/side-page/index.d.ts +15 -2
  30. package/side-page/index.js +2 -2
  31. package/stroked-svg/index.d.ts +17 -0
  32. package/stroked-svg/index.js +52 -0
  33. package/stroked-svg/index.module.scss +17 -0
  34. package/super-ellipse-clip-path/index.d.ts +1 -0
  35. package/tabs/index.d.ts +32 -25
  36. package/tabs/index.js +30 -24
  37. package/tabs/tabs.module.scss +21 -19
  38. package/touch-slider/index.js +2 -1
  39. package/unknown-content/index.d.ts +4 -2
  40. package/unknown-content/index.js +28 -2
  41. package/unknown-content/unknown-content.module.scss +213 -119
  42. package/unknown-content/utils.d.ts +6 -0
  43. package/unknown-content/utils.js +18 -0
  44. package/screen/screen-layout.d.ts +0 -57
  45. package/screen/screen-layout.js +0 -116
@@ -12,3 +12,12 @@ export interface WithBodyScrollLock {
12
12
  * @param options Опции.
13
13
  */
14
14
  export declare const useBodyScrollLock: (ref: React.RefObject<HTMLElement>, needDisable: boolean | undefined, options?: BodyScrollOptions | undefined) => void;
15
+ /**
16
+ * Проверяет необходимость блокировки дочерних элементов в прокручиваемом элементе.
17
+ * Необходима для того, чтобы в прокручиваемых контейнерах вложенные прокручиваемые элементы,
18
+ * имеющие специальный атрибут, прокручивались нормально.
19
+ * @see {@link https://github.com/willmcpo/body-scroll-lock#more-complex}
20
+ * @param startEl Начальный элемент.
21
+ * @return Нужно ли позволить перетаскивание элемента.
22
+ */
23
+ export declare const allowTouchMove: Required<BodyScrollOptions>['allowTouchMove'];
@@ -1,8 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useBodyScrollLock = void 0;
3
+ exports.allowTouchMove = exports.useBodyScrollLock = void 0;
4
4
  const body_scroll_lock_1 = require("body-scroll-lock");
5
5
  const react_1 = require("react");
6
+ const constants_1 = require("../constants");
6
7
  /**
7
8
  * Хук управления блокировкой прокрутки body.
8
9
  * @param ref Реф элемента для которого нужно отключить прокрутку body.
@@ -19,3 +20,22 @@ const useBodyScrollLock = (ref, needDisable, options) => {
19
20
  }, [needDisable, options]);
20
21
  };
21
22
  exports.useBodyScrollLock = useBodyScrollLock;
23
+ /**
24
+ * Проверяет необходимость блокировки дочерних элементов в прокручиваемом элементе.
25
+ * Необходима для того, чтобы в прокручиваемых контейнерах вложенные прокручиваемые элементы,
26
+ * имеющие специальный атрибут, прокручивались нормально.
27
+ * @see {@link https://github.com/willmcpo/body-scroll-lock#more-complex}
28
+ * @param startEl Начальный элемент.
29
+ * @return Нужно ли позволить перетаскивание элемента.
30
+ */
31
+ const allowTouchMove = (startEl) => {
32
+ let el = startEl;
33
+ while (el && el !== document.body) {
34
+ if (el.getAttribute(constants_1.BSL_IGNORE_ATTR) !== null) {
35
+ return true;
36
+ }
37
+ el = el.parentElement;
38
+ }
39
+ return false;
40
+ };
41
+ exports.allowTouchMove = allowTouchMove;
package/alert/index.d.ts CHANGED
@@ -18,6 +18,8 @@ export interface AlertProps extends WithBodyScrollLock {
18
18
  withDivideNavBar?: boolean;
19
19
  /** Нужна ли шапка. */
20
20
  withNavBar?: boolean;
21
+ /** Будет вызвана при закрытии окна нажатием на затемнение. */
22
+ onClose?: () => void;
21
23
  }
22
24
  /**
23
25
  * Компонент модального диалога.
package/alert/index.js CHANGED
@@ -62,11 +62,11 @@ exports.Alert = Alert;
62
62
  * @param props Свойства.
63
63
  * @return Элемент.
64
64
  */
65
- const AlertInner = ({ children, className, footer, navBarProps, title, withDivideNavBar, withNavBar = Boolean(title), withScrollDisable = false, scrollDisableOptions, }) => {
65
+ const AlertInner = ({ children, className, footer, navBarProps, title, withDivideNavBar, withNavBar = Boolean(title), withScrollDisable = false, scrollDisableOptions, onClose, }) => {
66
66
  const rootRef = (0, react_1.useRef)(null);
67
67
  const layer = (0, layer_1.useLayer)();
68
- (0, body_scroll_1.useBodyScrollLock)(rootRef, withScrollDisable, scrollDisableOptions);
69
- return (react_1.default.createElement("div", { ref: rootRef, className: cx('overlay'), style: { zIndex: layer } },
68
+ (0, body_scroll_1.useBodyScrollLock)(rootRef, withScrollDisable, Object.assign({ allowTouchMove: body_scroll_1.allowTouchMove }, scrollDisableOptions));
69
+ return (react_1.default.createElement("div", { ref: rootRef, className: cx('overlay'), style: { zIndex: layer }, onClick: e => e.target === e.currentTarget && (onClose === null || onClose === void 0 ? void 0 : onClose()), "data-testid": 'alert:overlay' },
70
70
  react_1.default.createElement("div", { className: cx('alert', className), "data-testid": 'alert' },
71
71
  withNavBar && (react_1.default.createElement(nav_bar_1.NavBar, Object.assign({}, navBarProps, { title: title, bottomBordered: withDivideNavBar, className: cx('header') }))),
72
72
  react_1.default.createElement("div", { className: cx('main') }, children),
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  declare type Size = 's' | 'l';
2
3
  declare type Direction = 'up' | 'right' | 'down' | 'left';
3
4
  export interface ArrowButtonProps extends Omit<JSX.IntrinsicElements['button'], 'size' | 'children'> {
package/avatar/user.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { AvatarProps } from '.';
2
3
  export declare type UserAvatarProps = Omit<AvatarProps, 'bgColor' | 'bgOpacity' | 'textColor'>;
3
4
  export declare const colorKey: unique symbol;
package/card/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { PlateProps } from '../plate';
2
3
  import { CardContent, CardFooter, CardHeader } from './slots';
3
4
  export declare type CardProps = PlateProps;
package/chips/index.d.ts CHANGED
@@ -1,18 +1,7 @@
1
1
  import React from 'react';
2
- interface ChipsItem {
3
- href?: string;
4
- children?: React.ReactNode;
5
- withCross?: boolean;
6
- target?: string;
7
- [x: string]: any;
8
- }
9
2
  export interface ChipsProps extends React.HTMLAttributes<HTMLDivElement> {
10
3
  /** Элементы списка. */
11
- items: ChipsItem[];
12
- /** Сработает при клике на элемент. */
13
- onItemClick?: (item: ChipsItem, event: React.MouseEvent<HTMLAnchorElement>) => void;
14
- /** Определит, отмечен ли переданный элемент. */
15
- isItemChecked?: (item: ChipsItem, index: number) => boolean;
4
+ children: React.ReactNode;
16
5
  /** Идентификатор для систем автоматизированного тестирования. */
17
6
  'data-testid'?: string;
18
7
  }
@@ -21,5 +10,7 @@ export interface ChipsProps extends React.HTMLAttributes<HTMLDivElement> {
21
10
  * @param props Свойства.
22
11
  * @return Элемент.
23
12
  */
24
- export declare const Chips: ({ items, onItemClick, isItemChecked, className, "data-testid": testId, ...restProps }: ChipsProps) => JSX.Element;
25
- export {};
13
+ export declare const Chips: {
14
+ ({ children, className, "data-testid": testId, ...restProps }: ChipsProps): JSX.Element;
15
+ Item: ({ href, children, withCross, target, onClick, checked, }: import("./item").ChipsItemProps) => JSX.Element;
16
+ };
package/chips/index.js CHANGED
@@ -1,4 +1,23 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
+ }) : (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ o[k2] = m[k];
8
+ }));
9
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
10
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
11
+ }) : function(o, v) {
12
+ o["default"] = v;
13
+ });
14
+ var __importStar = (this && this.__importStar) || function (mod) {
15
+ if (mod && mod.__esModule) return mod;
16
+ var result = {};
17
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
18
+ __setModuleDefault(result, mod);
19
+ return result;
20
+ };
2
21
  var __rest = (this && this.__rest) || function (s, e) {
3
22
  var t = {};
4
23
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
@@ -15,9 +34,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
15
34
  };
16
35
  Object.defineProperty(exports, "__esModule", { value: true });
17
36
  exports.Chips = void 0;
18
- const react_1 = __importDefault(require("react"));
37
+ const react_1 = __importStar(require("react"));
38
+ const item_1 = require("./item");
19
39
  const bind_1 = __importDefault(require("classnames/bind"));
20
- const cross_1 = __importDefault(require("@sima-land/ui-quarks/icons/16x16/Stroked/cross"));
21
40
  const chips_module_scss_1 = __importDefault(require("./chips.module.scss"));
22
41
  const cx = bind_1.default.bind(chips_module_scss_1.default);
23
42
  /**
@@ -26,12 +45,8 @@ const cx = bind_1.default.bind(chips_module_scss_1.default);
26
45
  * @return Элемент.
27
46
  */
28
47
  const Chips = (_a) => {
29
- var { items, onItemClick, isItemChecked, className, 'data-testid': testId = 'chips' } = _a, restProps = __rest(_a, ["items", "onItemClick", "isItemChecked", "className", 'data-testid']);
30
- return (react_1.default.createElement("div", Object.assign({}, restProps, { className: cx('list', className), "data-testid": testId }), items.map((item, index) => {
31
- const { href, target, children, withCross } = item;
32
- return (react_1.default.createElement("a", { href: href, role: href ? undefined : 'button', key: index, className: cx('item', (isItemChecked === null || isItemChecked === void 0 ? void 0 : isItemChecked(item, index)) && 'checked'), target: target, onClick: e => onItemClick === null || onItemClick === void 0 ? void 0 : onItemClick(item, e), "data-testid": 'chips:item' },
33
- react_1.default.createElement("span", { className: chips_module_scss_1.default.text }, children),
34
- withCross && react_1.default.createElement(cross_1.default, { className: cx('cross-svg') })));
35
- })));
48
+ var { children, className, 'data-testid': testId = 'chips' } = _a, restProps = __rest(_a, ["children", "className", 'data-testid']);
49
+ return (react_1.default.createElement("div", Object.assign({}, restProps, { className: cx('list', className), "data-testid": testId }), react_1.Children.toArray(children).filter(c => (0, react_1.isValidElement)(c) && c.type === item_1.ChipsItem)));
36
50
  };
37
51
  exports.Chips = Chips;
52
+ exports.Chips.Item = item_1.ChipsItem;
@@ -0,0 +1,15 @@
1
+ import React from 'react';
2
+ export interface ChipsItemProps {
3
+ href?: string;
4
+ children?: React.ReactNode;
5
+ withCross?: boolean;
6
+ target?: string;
7
+ onClick?: React.MouseEventHandler<HTMLAnchorElement>;
8
+ checked?: boolean;
9
+ }
10
+ /**
11
+ * Элемент списка "чипсов".
12
+ * @param props Свойства.
13
+ * @return Элемент.
14
+ */
15
+ export declare const ChipsItem: ({ href, children, withCross, target, onClick, checked, }: ChipsItemProps) => JSX.Element;
package/chips/item.js ADDED
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.ChipsItem = void 0;
7
+ const react_1 = __importDefault(require("react"));
8
+ const bind_1 = __importDefault(require("classnames/bind"));
9
+ const cross_1 = __importDefault(require("@sima-land/ui-quarks/icons/16x16/Stroked/cross"));
10
+ const chips_module_scss_1 = __importDefault(require("./chips.module.scss"));
11
+ const cx = bind_1.default.bind(chips_module_scss_1.default);
12
+ /**
13
+ * Элемент списка "чипсов".
14
+ * @param props Свойства.
15
+ * @return Элемент.
16
+ */
17
+ const ChipsItem = ({ href, children, withCross, target, onClick, checked, }) => (react_1.default.createElement("a", { href: href, role: href ? undefined : 'button', className: cx('item', { checked }), target: target, onClick: onClick, "data-testid": 'chips:item' },
18
+ react_1.default.createElement("span", { className: chips_module_scss_1.default.text }, children),
19
+ withCross && react_1.default.createElement(cross_1.default, { className: cx('cross-svg') })));
20
+ exports.ChipsItem = ChipsItem;
package/constants.d.ts ADDED
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Имя атрибута, устанавливаемого на элемент, имеющий прокрутку.
3
+ * Атрибут устанавливается на элемент в случае, если
4
+ * прокручиваемый родитель элемента обрабатывается с помощью body-scroll-lock.
5
+ */
6
+ export declare const BSL_IGNORE_ATTR = "data-bsl-ignore";
package/constants.js ADDED
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BSL_IGNORE_ATTR = void 0;
4
+ /**
5
+ * Имя атрибута, устанавливаемого на элемент, имеющий прокрутку.
6
+ * Атрибут устанавливается на элемент в случае, если
7
+ * прокручиваемый родитель элемента обрабатывается с помощью body-scroll-lock.
8
+ */
9
+ exports.BSL_IGNORE_ATTR = 'data-bsl-ignore';
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export declare type DotNavSize = 's' | 'l';
2
3
  export interface DotNavProps {
3
4
  /** Индекс выбранной точки. */
package/hooks/index.d.ts CHANGED
@@ -10,11 +10,12 @@ export declare const useIsTouchDevice: () => boolean;
10
10
  * @param options Опции.
11
11
  * @param options.onFullScroll Сработает при событии полной прокрутки.
12
12
  * @param options.threshold Отступ от конца списка по которому событие должно срабатывать.
13
+ * @param moreDeps Зависимости эффекта (нужны, когда ref заполняется не на этапе render'а).
13
14
  */
14
15
  export declare const useInfiniteScroll: (ref: React.MutableRefObject<HTMLElement | undefined | null>, { onFullScroll, threshold, }: {
15
16
  onFullScroll?: ((event: UIEvent) => void) | undefined;
16
17
  threshold?: number | undefined;
17
- }) => void;
18
+ }, moreDeps?: React.DependencyList | undefined) => void;
18
19
  /**
19
20
  * Запускает переданный обработчик при клике вне элемента.
20
21
  * @param elementRef Ref элемента, клик вне которого нужно обработать.
package/hooks/index.js CHANGED
@@ -8,6 +8,7 @@ const react_1 = require("react");
8
8
  const is_touch_device_1 = require("../helpers/is-touch-device");
9
9
  const lodash_1 = require("lodash");
10
10
  const on_1 = __importDefault(require("../helpers/on"));
11
+ const identity_1 = require("./identity");
11
12
  /**
12
13
  * При монтировании проверяет, поддерживает ли устройство touch события.
13
14
  * @return True - если поддерживает, false - если нет.
@@ -26,21 +27,22 @@ exports.useIsTouchDevice = useIsTouchDevice;
26
27
  * @param options Опции.
27
28
  * @param options.onFullScroll Сработает при событии полной прокрутки.
28
29
  * @param options.threshold Отступ от конца списка по которому событие должно срабатывать.
30
+ * @param moreDeps Зависимости эффекта (нужны, когда ref заполняется не на этапе render'а).
29
31
  */
30
- const useInfiniteScroll = (ref, { onFullScroll, threshold = 0, }) => {
32
+ const useInfiniteScroll = (ref, { onFullScroll, threshold = 0, }, moreDeps) => {
33
+ const callbackRef = (0, identity_1.useIdentityRef)(onFullScroll);
31
34
  (0, react_1.useEffect)(() => {
32
- const { current: element } = ref;
35
+ const element = ref.current;
33
36
  if (element) {
34
- return (0, on_1.default)(element, 'scroll', (event) => {
37
+ return (0, on_1.default)(element, 'scroll', event => {
38
+ var _a;
35
39
  const { scrollTop, clientHeight, scrollHeight } = event.target;
36
40
  const bottom = threshold + scrollTop + clientHeight;
37
41
  const isFullyScrolled = bottom >= scrollHeight;
38
- if (isFullyScrolled && onFullScroll) {
39
- onFullScroll(event);
40
- }
42
+ isFullyScrolled && ((_a = callbackRef.current) === null || _a === void 0 ? void 0 : _a.call(callbackRef, event));
41
43
  });
42
44
  }
43
- }, [ref.current, threshold, onFullScroll]);
45
+ }, [ref, threshold, ...(moreDeps || [])]);
44
46
  };
45
47
  exports.useInfiniteScroll = useInfiniteScroll;
46
48
  /**
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export interface NoIndexMarkProps {
2
3
  /** Флаг закрывающегося тэга. */
3
4
  closing?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sima-land/ui-nucleons",
3
- "version": "40.2.2",
3
+ "version": "41.2.0",
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",
@@ -10,74 +10,74 @@
10
10
  },
11
11
  "dependencies": {
12
12
  "@krutoo/input-mask": "^0.0.8",
13
- "@sima-land/ui-quarks": "^2.0.1",
14
- "@types/body-scroll-lock": "^2.6.1",
13
+ "@sima-land/ui-quarks": "^2.2.0",
15
14
  "body-scroll-lock": "3.1.5",
16
- "date-fns": "^2.14.0",
17
- "intersection-observer": "^0.7.0",
15
+ "classnames": "^2.3.1",
16
+ "date-fns": "^2.26.0",
17
+ "intersection-observer": "^0.12.0",
18
18
  "lodash": "^4.17.21",
19
19
  "overlayscrollbars": "^1.13.1",
20
- "overlayscrollbars-react": "^0.2.2",
20
+ "overlayscrollbars-react": "^0.2.3",
21
21
  "react-transition-group": "^4.4.2"
22
22
  },
23
23
  "devDependencies": {
24
- "@babel/core": "^7.12.10",
25
- "@babel/plugin-proposal-class-properties": "^7.12.1",
26
- "@babel/plugin-proposal-optional-chaining": "^7.12.7",
27
- "@babel/preset-env": "^7.12.11",
28
- "@babel/preset-react": "^7.12.10",
29
- "@rushstack/eslint-patch": "^1.0.6",
30
- "@sima-land/linters": "^2.1.0",
24
+ "@babel/core": "^7.16.0",
25
+ "@babel/plugin-proposal-class-properties": "^7.16.0",
26
+ "@babel/plugin-proposal-optional-chaining": "^7.16.0",
27
+ "@babel/preset-env": "^7.16.4",
28
+ "@babel/preset-react": "^7.16.0",
29
+ "@rushstack/eslint-patch": "^1.1.0",
30
+ "@sima-land/linters": "^2.1.1",
31
31
  "@storybook/addon-actions": "^6.3.12",
32
32
  "@storybook/addon-backgrounds": "^6.3.12",
33
33
  "@storybook/addon-docs": "^6.3.12",
34
34
  "@storybook/addon-storysource": "^6.3.12",
35
35
  "@storybook/addons": "^6.3.12",
36
+ "@storybook/builder-webpack5": "^6.3.12",
37
+ "@storybook/manager-webpack5": "^6.3.12",
36
38
  "@storybook/react": "^6.3.12",
37
39
  "@storybook/theming": "^6.3.12",
38
40
  "@svgr/core": "^5.5.0",
39
41
  "@svgr/plugin-svgo": "^5.5.0",
40
42
  "@svgr/webpack": "^5.5.0",
41
- "@testing-library/react": "^12.0.0",
42
- "@types/classnames": "^2.2.11",
43
- "@types/enzyme": "^3.10.8",
44
- "@types/jest": "^26.0.20",
45
- "@types/lodash": "^4.14.168",
46
- "@types/react": "^17.0.2",
47
- "@types/react-dom": "^17.0.2",
48
- "@types/react-transition-group": "^4.4.3",
49
- "@typescript-eslint/eslint-plugin": "^4.15.2",
50
- "@typescript-eslint/parser": "^4.15.2",
51
- "@wojtekmaj/enzyme-adapter-react-17": "^0.6.3",
52
- "babel-loader": "^8.0.5",
53
- "babel-preset-jest": "^26.6.2",
54
- "classnames": "^2.2.6",
43
+ "@testing-library/react": "^12.1.2",
44
+ "@types/body-scroll-lock": "^3.1.0",
45
+ "@types/enzyme": "^3.10.10",
46
+ "@types/jest": "^27.0.2",
47
+ "@types/lodash": "^4.14.177",
48
+ "@types/react": "^17.0.36",
49
+ "@types/react-dom": "^17.0.11",
50
+ "@types/react-transition-group": "^4.4.4",
51
+ "@typescript-eslint/eslint-plugin": "^5.4.0",
52
+ "@typescript-eslint/parser": "^5.4.0",
53
+ "@wojtekmaj/enzyme-adapter-react-17": "^0.6.5",
54
+ "babel-loader": "^8.2.3",
55
+ "babel-preset-jest": "^27.2.0",
55
56
  "copyfiles": "^2.4.1",
56
- "css-loader": "^5.0.1",
57
- "del": "^4.1.1",
57
+ "css-loader": "^5.2.7",
58
58
  "enzyme": "^3.9.0",
59
- "enzyme-adapter-react-16": "^1.13.0",
60
- "enzyme-to-json": "^3.3.5",
59
+ "enzyme-to-json": "^3.6.2",
61
60
  "eslint": "^7.31.0",
62
61
  "file-loader": "^6.2.0",
63
- "husky": "^5.1.1",
62
+ "husky": "^7.0.4",
64
63
  "identity-obj-proxy": "^3.0.0",
65
- "jest": "^26.6.3",
66
- "jest-css-modules-transform": "^4.2.0",
67
- "lint-staged": "^10.5.4",
68
- "prettier": "^2.3.2",
64
+ "jest": "^27.3.1",
65
+ "jest-css-modules-transform": "^4.3.0",
66
+ "lint-staged": "^12.1.2",
67
+ "postcss": "^8.3.11",
68
+ "prettier": "^2.4.1",
69
69
  "react": "^17.0.2",
70
70
  "react-docgen-typescript": "^2.1.1",
71
71
  "react-dom": "^17.0.2",
72
72
  "rimraf": "^3.0.2",
73
- "sass": "^1.30.0",
73
+ "sass": "^1.43.4",
74
74
  "sass-loader": "^10.1.0",
75
75
  "style-loader": "^2.0.0",
76
- "stylelint": "^13.8.0",
77
- "ts-jest": "^26.5.2",
78
- "typescript": "^4.4.3",
79
- "typescript-plugin-css-modules": "^3.2.0",
80
- "webpack": "^5.11.0"
76
+ "stylelint": "^14.1.0",
77
+ "ts-jest": "^27.0.7",
78
+ "typescript": "^4.5.2",
79
+ "typescript-plugin-css-modules": "^3.4.0",
80
+ "webpack": "^5.64.2"
81
81
  },
82
82
  "peerDependencies": {
83
83
  "react": ">=17",
@@ -88,14 +88,14 @@
88
88
  "build:before": "rimraf build",
89
89
  "build:main": "tsc --project tsconfig.build.json",
90
90
  "build:after": "node dist.js",
91
- "build": "yarn build:before && yarn build:main && yarn build:after",
91
+ "build": "npm run build:before && npm run build:main && npm run build:after",
92
92
  "test": "jest",
93
93
  "type-check": "tsc -p . --noEmit",
94
94
  "coverage": "jest --clearCache && jest --coverage",
95
95
  "lint:scripts": "eslint --cache src/ --ext .js,.jsx,.ts,.tsx",
96
96
  "lint:styles": "stylelint 'src/**/*.{css,scss}'",
97
97
  "storybook": "start-storybook -p 9009 -c .storybook",
98
- "storybook:build": "build-storybook --no-dll --quiet --loglevel error -o build-storybook",
98
+ "storybook:build": "build-storybook --quiet --loglevel error -o build-storybook",
99
99
  "prettier": "prettier --write \"./src/**/*.{js,jsx,ts,tsx,css,scss}\" --loglevel error",
100
100
  "prettier:check": "prettier --check \"./src/**/*.{js,jsx,ts,tsx,css,scss}\" --loglevel error"
101
101
  }
@@ -7,7 +7,7 @@ declare type State = {
7
7
  range: number;
8
8
  total: number;
9
9
  };
10
- export declare const cx: import("classnames/types").ClassNamesFn;
10
+ export declare const cx: (...args: import("classnames").Argument[]) => string;
11
11
  /**
12
12
  * Фабрика объектов с данными о кнопке страницы.
13
13
  * @param value Номер целевой страницы.
package/price/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export interface PriceProps {
2
3
  /** Класс/стили цены. */
3
4
  className?: string;
package/readme.md CHANGED
@@ -158,12 +158,12 @@ declare module '*.svg' {
158
158
  - компонент интерфейса не должен иметь внешних отступов по умолчанию
159
159
 
160
160
  ### Консольные команды, необходимые в процессе разработки
161
- * ```yarn build``` - сборка компонентов в `./build` для публикации
162
- * ```yarn test``` - запуск тестов *Jest*
163
- * ```yarn lint:scripts``` - запуск линтера *ESLint*
164
- * ```yarn lint:styles``` - запуск линтера *styleLint*
165
- * ```yarn type-check``` - Проверка типов TS
166
- * ```yarn storybook``` - запуск *storybook*
161
+ * ```npm run build``` - сборка компонентов в `./build` для публикации
162
+ * ```npm run test``` - запуск тестов *Jest*
163
+ * ```npm run lint:scripts``` - запуск линтера *ESLint*
164
+ * ```npm run lint:styles``` - запуск линтера *styleLint*
165
+ * ```npm run type-check``` - Проверка типов TS
166
+ * ```npm run storybook``` - запуск *storybook*
167
167
 
168
168
  ### Структура библиотеки
169
169
 
package/screen/index.d.ts CHANGED
@@ -1,64 +1,23 @@
1
1
  import React from 'react';
2
- import { ScreenLayoutProps, CallbackData } from './screen-layout';
3
- import { OrNil } from './utils';
4
- import { LoadingOverlayProps } from '../loading-overlay';
5
- interface AdvancedCallbackData extends CallbackData {
6
- rootElement: OrNil<HTMLDivElement>;
7
- }
8
- export interface ScreenProps {
2
+ import { ScreenInnerProps } from './utils';
3
+ export interface ScreenProps extends ScreenInnerProps {
9
4
  /** Содержимое. */
10
5
  children?: React.ReactNode;
11
- /** Реф контента. */
12
- contentRef?: ScreenLayoutProps['childrenRef'];
13
- /** Содержимое подвала. */
14
- footer?: any;
15
- /** Отступ от нижней границы для срабатывания onFullScroll. */
16
- fullScrollThreshold?: number;
17
- /** Нужно ли выводить вместо содержимого состояние загрузки. */
18
- loading?: boolean;
19
6
  /** Определяет область отображаемую как загружающуюся. */
20
7
  loadingArea?: 'content' | 'full';
21
- /** Свойства компонента LoadingOverlay. */
22
- loadingOverlayProps?: LoadingOverlayProps;
23
- /** Свойства компонента NavBar. */
24
- navBarProps?: ScreenLayoutProps['navBarProps'];
25
- /** Сработает при клике на кнопку "назад". */
26
- onBack?: (data: AdvancedCallbackData) => void;
27
- /** Сработает при кнопке на крест. */
28
- onClose?: (data: AdvancedCallbackData) => void;
29
- /** Сработает при полной прокрутке контента. */
30
- onFullScroll?: ScreenLayoutProps['onFullScroll'];
31
- /** Подзаголовок. */
32
- subtitle?: string;
33
- /** Заголовок. */
34
- title?: string;
35
- /** Нужно ли выводить кнопку "назад". */
36
- withBackButton?: boolean;
37
- /** Нужно ли выводить закрывающий крест. */
38
- withCloseButton?: boolean;
39
- /** Нужно ли рисовать черту между шапкой и основным содержимым. */
40
- withDivideHeader?: boolean;
41
- /** Нужно ли выводить кнопку "назад". */
42
- withHeader?: boolean;
43
- /** Нужно ли выводить Layer (при SSR необходимо указать false). */
44
- inPortal?: boolean;
8
+ /** Идентификатор для систем автоматизированного тестирования. */
9
+ 'data-testid'?: string;
45
10
  }
46
11
  /**
47
12
  * Экран.
48
13
  * @param props Свойства.
49
14
  * @return Элемент.
50
15
  */
51
- export declare const Screen: React.FC<ScreenProps>;
52
- /**
53
- * Записывает переданное значение в ref контента.
54
- * @param ref Ref-контейнер.
55
- * @param value Значение для записи.
56
- */
57
- export declare const setRefValue: (ref: React.RefCallback<any> | React.MutableRefObject<any>, value: any) => void;
58
- /**
59
- * Записывает полученный элемент в ref и отключает прокрутку.
60
- * @param ref Ref-контейнер.
61
- * @param element Элемент для записи.
62
- */
63
- export declare const takeScrollableElement: (ref: React.MutableRefObject<OrNil<HTMLDivElement>>, element?: HTMLDivElement | null | undefined) => void;
64
- export {};
16
+ export declare const Screen: {
17
+ ({ children, loading, loadingArea, loadingOverlayProps, onFullScroll, fullScrollThreshold, "data-testid": testId, }: ScreenProps): JSX.Element;
18
+ Header: ({ divided, title, subtitle, buttons, onBack, onClose, ...restProps }: import("./slots").HeaderSlotProps) => JSX.Element;
19
+ Body: React.ForwardRefExoticComponent<{
20
+ children?: React.ReactNode;
21
+ } & React.RefAttributes<HTMLDivElement | null>>;
22
+ Footer: React.FC<{}>;
23
+ };