@sima-land/ui-nucleons 40.2.1 → 41.1.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 (100) hide show
  1. package/_internal/custom-scrollbar/index.js +3 -3
  2. package/alert/index.d.ts +2 -0
  3. package/alert/index.js +3 -3
  4. package/arrow-button/index.d.ts +1 -0
  5. package/autocomplete/index.js +12 -17
  6. package/avatar/index.d.ts +1 -1
  7. package/avatar/index.js +2 -4
  8. package/avatar/user.d.ts +2 -1
  9. package/avatar/user.js +2 -2
  10. package/avatar/utils.js +7 -1
  11. package/base-input/index.d.ts +1 -1
  12. package/base-input/index.js +1 -1
  13. package/bordered-layout/index.d.ts +1 -1
  14. package/bordered-layout/index.js +1 -1
  15. package/box/index.js +17 -36
  16. package/button/index.d.ts +3 -3
  17. package/button/index.js +4 -4
  18. package/card/index.d.ts +1 -0
  19. package/card/slots.js +1 -1
  20. package/carousel/draggable.js +14 -16
  21. package/carousel/index.d.ts +1 -1
  22. package/carousel/index.js +17 -37
  23. package/chips/index.d.ts +5 -14
  24. package/chips/index.js +24 -9
  25. package/chips/item.d.ts +15 -0
  26. package/chips/item.js +20 -0
  27. package/clean-buttons/index.js +1 -3
  28. package/dot-nav/dot-nav.module.scss +2 -2
  29. package/dot-nav/index.d.ts +1 -0
  30. package/dropdown/dropdown.module.scss +1 -3
  31. package/field-grid/index.d.ts +2 -2
  32. package/field-grid/index.js +3 -3
  33. package/file-icon/index.js +5 -6
  34. package/helpers/bounds-of.js +1 -3
  35. package/helpers/find-child-element.js +1 -3
  36. package/helpers/find-offset-parent.js +4 -3
  37. package/helpers/fit-element-height.js +1 -1
  38. package/helpers/format-date.js +3 -1
  39. package/helpers/get-fraction-depth.js +1 -3
  40. package/hooks/identity.d.ts +1 -0
  41. package/hooks/identity.js +1 -0
  42. package/hooks/index.d.ts +2 -1
  43. package/hooks/index.js +9 -7
  44. package/layout/index.js +1 -1
  45. package/link/index.js +1 -3
  46. package/loading-overlay/index.d.ts +1 -1
  47. package/loading-overlay/index.js +1 -1
  48. package/no-index-mark/index.d.ts +1 -0
  49. package/package.json +47 -45
  50. package/pagination/base-pagination.js +18 -20
  51. package/pagination/index.js +1 -3
  52. package/pagination/utils.d.ts +3 -3
  53. package/pagination/utils.js +7 -6
  54. package/panel/index.js +1 -3
  55. package/phone-input/index.js +19 -20
  56. package/price/index.d.ts +1 -0
  57. package/price/utils.js +1 -3
  58. package/range/index.js +11 -14
  59. package/rating/index.js +2 -2
  60. package/readme.md +7 -7
  61. package/screen/index.d.ts +12 -47
  62. package/screen/index.js +30 -67
  63. package/screen/screen.module.scss +16 -15
  64. package/screen/slots.d.ts +32 -0
  65. package/screen/slots.js +64 -0
  66. package/screen/utils.d.ts +1 -2
  67. package/select/index.js +5 -7
  68. package/side-page/index.d.ts +15 -2
  69. package/side-page/index.js +2 -2
  70. package/spinner/index.d.ts +1 -1
  71. package/spinner/index.js +1 -1
  72. package/spinner/spinner.module.scss +1 -4
  73. package/stroked-svg/index.d.ts +17 -0
  74. package/stroked-svg/index.js +52 -0
  75. package/stroked-svg/index.module.scss +17 -0
  76. package/styling/fonts.js +1 -3
  77. package/styling/utils.js +1 -3
  78. package/super-ellipse-clip-path/index.d.ts +1 -0
  79. package/tabs/index.d.ts +32 -25
  80. package/tabs/index.js +30 -24
  81. package/tabs/tabs.module.scss +21 -19
  82. package/text-field/index.js +3 -10
  83. package/timer/index.d.ts +3 -3
  84. package/timer/index.js +4 -4
  85. package/timer/utils.js +1 -4
  86. package/top-bar/index.js +1 -1
  87. package/unknown-content/index.d.ts +4 -2
  88. package/unknown-content/index.js +28 -2
  89. package/unknown-content/unknown-content.module.scss +213 -119
  90. package/unknown-content/utils.d.ts +6 -0
  91. package/unknown-content/utils.js +18 -0
  92. package/upload/area.js +3 -1
  93. package/upload/utils.d.ts +2 -2
  94. package/upload/utils.js +2 -2
  95. package/with-hint/positioning-hint.d.ts +1 -1
  96. package/with-hint/positioning-hint.js +1 -1
  97. package/with-hint/utils.js +5 -7
  98. package/with-in-viewport-observer/index.js +1 -1
  99. package/screen/screen-layout.d.ts +0 -57
  100. package/screen/screen-layout.js +0 -116
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;
@@ -44,9 +44,7 @@ const cx = bind_1.default.bind(clean_buttons_module_scss_1.default);
44
44
  * @param props Свойства.
45
45
  * @return Элемент.
46
46
  */
47
- const CleanGroup = ({ children }) => (react_1.default.createElement("div", { className: cx('clean-group') }, react_1.Children.toArray(children).map(item => (0, react_1.isValidElement)(item) && item.type === CleanButton
48
- ? item
49
- : null)));
47
+ const CleanGroup = ({ children }) => (react_1.default.createElement("div", { className: cx('clean-group') }, react_1.Children.toArray(children).map(item => (0, react_1.isValidElement)(item) && item.type === CleanButton ? item : null)));
50
48
  /**
51
49
  * Компонент прозрачной кнопки.
52
50
  * @param props Свойства. Поддерживаются свойства элементов button/a (зависит от того, передан ли asLink).
@@ -40,12 +40,12 @@
40
40
  background: colors.$gray12;
41
41
 
42
42
  // используем 10 чтобы проще считать коэффициенты масштабирования
43
- // ВАЖНО: не надо использовать здесь число болье чем размер родителя с overflow:hidden - моргает в Safari
43
+ // ВАЖНО: не надо использовать здесь число больше чем размер родителя с overflow:hidden - моргает в Safari
44
44
  width: 10px;
45
45
  height: 10px;
46
46
 
47
47
  // используем scale() чтобы плавное изменение размера выглядело нормально
48
- transform: translate3d(-50%, -50%, 0) scale(calc(1 / (10 / var(--dot-size))));
48
+ transform: translate3d(-50%, -50%, 0) scale(calc(var(--dot-size) / 10));
49
49
  transition: transform 0.3s, background 0.3s;
50
50
  }
51
51
  &.active::after {
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export declare type DotNavSize = 's' | 'l';
2
3
  export interface DotNavProps {
3
4
  /** Индекс выбранной точки. */
@@ -9,7 +9,5 @@
9
9
  }
10
10
 
11
11
  .inner {
12
- max-height: calc(
13
- var(--dropdown-max-height, 304px) - 16px
14
- ); // вычитаем padding корневого элемента
12
+ max-height: calc(var(--dropdown-max-height, 304px) - 16px); // вычитаем padding корневого элемента
15
13
  }
@@ -33,7 +33,7 @@ export interface FieldGridComponent extends React.FC<FieldGridProps> {
33
33
  * @param props Свойства.
34
34
  * @param props.children Содержимое, дочерними элементами могут быть только FieldGrid.Row.
35
35
  * @param props.rootProps Свойства корневого элемента.
36
- * @return Компонент сетки полей.
36
+ * @return Элемент.
37
37
  */
38
38
  export declare const FieldGrid: FieldGridComponent;
39
39
  /**
@@ -52,7 +52,7 @@ declare const Row: React.FC<RowProps>;
52
52
  * @param props.rounds Скругления для поля (будет задан автоматически).
53
53
  * @param props.field Поле.
54
54
  * @param props.renderField Должна вернуть поле получив свойства для него.
55
- * @return Компонент ряда для сетки полей.
55
+ * @return Элемент.
56
56
  */
57
57
  declare const Cell: React.FC<CellProps>;
58
58
  export {};
@@ -41,7 +41,7 @@ const TypeCheck = {
41
41
  * @param props Свойства.
42
42
  * @param props.children Содержимое, дочерними элементами могут быть только FieldGrid.Row.
43
43
  * @param props.rootProps Свойства корневого элемента.
44
- * @return Компонент сетки полей.
44
+ * @return Элемент.
45
45
  */
46
46
  const FieldGrid = ({ children, rootProps }) => {
47
47
  const rows = react_1.Children.toArray(children).filter(TypeCheck.isRow);
@@ -111,7 +111,7 @@ const Row = ({ isFirst: isFirstRow, isLast: isLastRow, children }) => {
111
111
  * @param props.rounds Скругления для поля (будет задан автоматически).
112
112
  * @param props.field Поле.
113
113
  * @param props.renderField Должна вернуть поле получив свойства для него.
114
- * @return Компонент ряда для сетки полей.
114
+ * @return Элемент.
115
115
  */
116
116
  const Cell = ({ size, rounds, field, renderField }) => {
117
117
  var _a;
@@ -127,7 +127,7 @@ const Cell = ({ size, rounds, field, renderField }) => {
127
127
  className: cx(field.props.className, 'size-full'),
128
128
  });
129
129
  }
130
- return (react_1.default.createElement("div", { className: cx('cell', `size-${size}`) }, content));
130
+ return react_1.default.createElement("div", { className: cx('cell', `size-${size}`) }, content);
131
131
  };
132
132
  exports.FieldGrid.Row = Row;
133
133
  exports.FieldGrid.Cell = Cell;
@@ -34,11 +34,10 @@ const VARIANTS = {
34
34
  const FileIcon = (_a) => {
35
35
  var { type } = _a, svgProps = __rest(_a, ["type"]);
36
36
  const typeProps = VARIANTS[type];
37
- return type && typeProps
38
- ? (react_1.default.createElement("svg", Object.assign({ width: '32', height: '32', viewBox: '0 0 32 32' }, svgProps),
39
- react_1.default.createElement("path", { opacity: '0.88', d: 'M6 5C6 3.89543 6.89543 3 8 3H20L26 9V27C26 28.1046 25.1046 29 24 29H8C6.89543 29 6 28.1046 6 27V5Z', fill: typeProps.fill }),
40
- react_1.default.createElement("path", { opacity: '0.32', d: 'M21 9L26 9L20 3L20 8C20 8.55229 20.4477 9 21 9Z', fill: 'white' }),
41
- react_1.default.createElement("path", { opacity: '0.24', d: 'M25.1667 9L21 9L26 15L26 9C25.5833 9 25.6269 9 25.1667 9Z', fill: 'black' }),
42
- react_1.default.createElement("text", { x: '16', y: '23', textAnchor: 'middle', fontSize: '6.5', fontWeight: '700', fill: '#fff' }, type.toUpperCase()))) : (react_1.default.createElement(unknown_svg_1.default, Object.assign({}, svgProps)));
37
+ return type && typeProps ? (react_1.default.createElement("svg", Object.assign({ width: '32', height: '32', viewBox: '0 0 32 32' }, svgProps),
38
+ react_1.default.createElement("path", { opacity: '0.88', d: 'M6 5C6 3.89543 6.89543 3 8 3H20L26 9V27C26 28.1046 25.1046 29 24 29H8C6.89543 29 6 28.1046 6 27V5Z', fill: typeProps.fill }),
39
+ react_1.default.createElement("path", { opacity: '0.32', d: 'M21 9L26 9L20 3L20 8C20 8.55229 20.4477 9 21 9Z', fill: 'white' }),
40
+ react_1.default.createElement("path", { opacity: '0.24', d: 'M25.1667 9L21 9L26 15L26 9C25.5833 9 25.6269 9 25.1667 9Z', fill: 'black' }),
41
+ react_1.default.createElement("text", { x: '16', y: '23', textAnchor: 'middle', fontSize: '6.5', fontWeight: '700', fill: '#fff' }, type.toUpperCase()))) : (react_1.default.createElement(unknown_svg_1.default, Object.assign({}, svgProps)));
43
42
  };
44
43
  exports.FileIcon = FileIcon;
@@ -6,8 +6,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  * @return Ограничивающий прямоугольник.
7
7
  */
8
8
  function boundsOf(element) {
9
- return (element instanceof Element
10
- ? element.getBoundingClientRect()
11
- : null);
9
+ return (element instanceof Element ? element.getBoundingClientRect() : null);
12
10
  }
13
11
  exports.default = boundsOf;
@@ -14,9 +14,7 @@ const lodash_1 = require("lodash");
14
14
  */
15
15
  const findChildElement = ({ target, startIndex = 0, increment = 1, defaultResult = -1, isSuitable, needBreakLoop = lodash_1.identity, }) => {
16
16
  let result = defaultResult;
17
- if (target
18
- && target.children
19
- && isSuitable !== undefined) {
17
+ if (target && target.children && isSuitable !== undefined) {
20
18
  const { children } = target;
21
19
  for (let i = startIndex; i >= 0 && i < children.length; i += increment) {
22
20
  const sibling = children[i];
@@ -9,9 +9,10 @@ exports.findOffsetParent = void 0;
9
9
  const findOffsetParent = (element) => {
10
10
  let parent = element.offsetParent || document.body;
11
11
  if (getComputedStyle(parent).position === 'static') {
12
- parent = getComputedStyle(document.documentElement).position === 'static'
13
- ? null
14
- : document.documentElement;
12
+ parent =
13
+ getComputedStyle(document.documentElement).position === 'static'
14
+ ? null
15
+ : document.documentElement;
15
16
  }
16
17
  return parent;
17
18
  };
@@ -9,7 +9,7 @@ exports.fitElementHeight = void 0;
9
9
  const fitElementHeight = ({ target }) => {
10
10
  target.style.height = 'auto';
11
11
  // актуальные значения после установки "auto" (в начало функции не переносить)
12
- const { scrollHeight, offsetHeight, clientHeight, } = target;
12
+ const { scrollHeight, offsetHeight, clientHeight } = target;
13
13
  target.style.height = `${scrollHeight + offsetHeight - clientHeight}px`;
14
14
  };
15
15
  exports.fitElementHeight = fitElementHeight;
@@ -21,7 +21,9 @@ const createDateFormatter = ({ formatFrom = ['yyyy-MM-dd', 'dd.MM.yyyy'], format
21
21
  const date = (0, exports.parseMultiple)(dateString, formatFrom, new Date());
22
22
  let result = invalidPlaceholder;
23
23
  if ((0, isValid_1.default)(date)) {
24
- result = (0, format_1.default)(date, (0, lodash_1.isFunction)(formatTo) ? formatTo(new Date(date.getTime())) : formatTo, { locale: ru_1.default });
24
+ result = (0, format_1.default)(date, (0, lodash_1.isFunction)(formatTo) ? formatTo(new Date(date.getTime())) : formatTo, {
25
+ locale: ru_1.default,
26
+ });
25
27
  }
26
28
  return result;
27
29
  };
@@ -8,8 +8,6 @@ exports.getFractionDepth = void 0;
8
8
  */
9
9
  const getFractionDepth = (fraction = null) => {
10
10
  const fractionString = Number(fraction).toString();
11
- return fractionString.includes('.')
12
- ? fractionString.length - fractionString.indexOf('.') - 1
13
- : 0;
11
+ return fractionString.includes('.') ? fractionString.length - fractionString.indexOf('.') - 1 : 0;
14
12
  };
15
13
  exports.getFractionDepth = getFractionDepth;
@@ -1,6 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  /**
3
3
  * Реф с актуальным переданным значением.
4
+ * Нужен, когда в ref-значение нужно обновлять значение при каждом рендере.
4
5
  * @param value Значение.
5
6
  * @return Реф.
6
7
  */
package/hooks/identity.js CHANGED
@@ -4,6 +4,7 @@ exports.useIdentityRef = void 0;
4
4
  const react_1 = require("react");
5
5
  /**
6
6
  * Реф с актуальным переданным значением.
7
+ * Нужен, когда в ref-значение нужно обновлять значение при каждом рендере.
7
8
  * @param value Значение.
8
9
  * @return Реф.
9
10
  */
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
  /**
package/layout/index.js CHANGED
@@ -42,7 +42,7 @@ const cx = bind_1.default.bind(layout_module_scss_1.default);
42
42
  * Возвращает созданный функциональный компонент, формирующий Layout.
43
43
  * @param specificClass Специальный класс.
44
44
  * @param displayName Отображаемое имя компонента.
45
- * @return Компонент.
45
+ * @return Элемент.
46
46
  */
47
47
  const createLayout = (specificClass, displayName) => {
48
48
  const Component = (0, react_1.forwardRef)((_a, ref) => {
package/link/index.js CHANGED
@@ -45,9 +45,7 @@ const cx = bind_1.default.bind(link_module_scss_1.default);
45
45
  * @param noIndex Флаг запрета индексации.
46
46
  * @return Объект со свойствами, формирующими содержимое..
47
47
  */
48
- const getContentProps = (children, noIndex) => noIndex
49
- ? { dangerouslySetInnerHTML: (0, get_no_index_1.getNoIndex)(children) }
50
- : { children };
48
+ const getContentProps = (children, noIndex) => noIndex ? { dangerouslySetInnerHTML: (0, get_no_index_1.getNoIndex)(children) } : { children };
51
49
  /**
52
50
  * Компонент ссылки.
53
51
  * @param props Свойства компонента. Поддерживаются свойства span/a.
@@ -15,4 +15,4 @@ export interface LoadingOverlayProps {
15
15
  * @param props Свойства.
16
16
  * @return Элемент.
17
17
  */
18
- export declare const LoadingOverlay: ({ style, className, spinnerProps, fill }: LoadingOverlayProps) => JSX.Element;
18
+ export declare const LoadingOverlay: ({ style, className, spinnerProps, fill, }: LoadingOverlayProps) => JSX.Element;
@@ -14,6 +14,6 @@ const cx = bind_1.default.bind(loading_overlay_module_scss_1.default);
14
14
  * @param props Свойства.
15
15
  * @return Элемент.
16
16
  */
17
- const LoadingOverlay = ({ style, className, spinnerProps = {}, fill = true }) => (react_1.default.createElement("div", { className: cx('loading-overlay', fill && 'fill', className), style: style },
17
+ const LoadingOverlay = ({ style, className, spinnerProps = {}, fill = true, }) => (react_1.default.createElement("div", { className: cx('loading-overlay', fill && 'fill', className), style: style },
18
18
  react_1.default.createElement(spinner_1.Spinner, Object.assign({}, spinnerProps))));
19
19
  exports.LoadingOverlay = LoadingOverlay;
@@ -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.1",
3
+ "version": "41.1.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
- "react-docgen-typescript": "^1.21.0",
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,13 +88,15 @@
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
+ "prettier": "prettier --write \"./src/**/*.{js,jsx,ts,tsx,css,scss}\" --loglevel error",
100
+ "prettier:check": "prettier --check \"./src/**/*.{js,jsx,ts,tsx,css,scss}\" --loglevel error"
99
101
  }
100
102
  }
@@ -62,34 +62,32 @@ const BasePagination = ({ total, current, onButtonClick, isButtonSelected = (0,
62
62
  buttonKeys: exports.BUTTON_TYPES,
63
63
  });
64
64
  return (react_1.default.createElement("div", { className: (0, utils_1.cx)('base-pagination-wrapper') },
65
- needPrevButton({ current, total }) && renderButton({
66
- 'aria-label': 'Назад',
67
- type: exports.BUTTON_TYPES.prev,
68
- children: exports.BUTTON_CONTENTS.prev,
69
- onClick: () => onButtonClick && onButtonClick(current - 1),
70
- page: current - 1,
71
- }),
65
+ needPrevButton({ current, total }) &&
66
+ renderButton({
67
+ 'aria-label': 'Назад',
68
+ type: exports.BUTTON_TYPES.prev,
69
+ children: exports.BUTTON_CONTENTS.prev,
70
+ onClick: () => onButtonClick && onButtonClick(current - 1),
71
+ page: current - 1,
72
+ }),
72
73
  pageButtons.map(({ content, value }, index) => renderButton({
73
- type: content === exports.BUTTON_TYPES.more
74
- ? exports.BUTTON_TYPES.more
75
- : undefined,
74
+ type: content === exports.BUTTON_TYPES.more ? exports.BUTTON_TYPES.more : undefined,
76
75
  isFirst: index === 0,
77
76
  isLast: index === pageButtons.length - 1,
78
- children: (0, lodash_1.has)(exports.BUTTON_CONTENTS, content)
79
- ? exports.BUTTON_CONTENTS[content]
80
- : content,
77
+ children: (0, lodash_1.has)(exports.BUTTON_CONTENTS, content) ? exports.BUTTON_CONTENTS[content] : content,
81
78
  selected: isButtonSelected(content),
82
79
  'aria-label': `Перейти на страницу ${value}`,
83
80
  onClick: () => onButtonClick && onButtonClick(value),
84
81
  page: value,
85
82
  }, index)),
86
- needNextButton({ current, total }) && renderButton({
87
- 'aria-label': 'Вперед',
88
- type: exports.BUTTON_TYPES.next,
89
- children: exports.BUTTON_CONTENTS.next,
90
- onClick: () => onButtonClick && onButtonClick(current + 1),
91
- page: current + 1,
92
- })));
83
+ needNextButton({ current, total }) &&
84
+ renderButton({
85
+ 'aria-label': 'Вперед',
86
+ type: exports.BUTTON_TYPES.next,
87
+ children: exports.BUTTON_CONTENTS.next,
88
+ onClick: () => onButtonClick && onButtonClick(current + 1),
89
+ page: current + 1,
90
+ })));
93
91
  };
94
92
  exports.BasePagination = BasePagination;
95
93
  const resolveRounded = (0, fp_1.cond)([
@@ -12,8 +12,6 @@ const base_pagination_1 = require("./base-pagination");
12
12
  * @return Элемент.
13
13
  */
14
14
  const Pagination = ({ total, current, onChange, renderButton, }) => (react_1.default.createElement(base_pagination_1.BasePagination, { total: total, current: current, renderButton: renderButton, onButtonClick: content => {
15
- Number.isFinite(content)
16
- && onChange
17
- && onChange({ value: content });
15
+ Number.isFinite(content) && onChange && onChange({ value: content });
18
16
  } }));
19
17
  exports.Pagination = Pagination;