@sima-land/ui-nucleons 40.2.0 → 41.0.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 (99) 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/nav-bar/index.d.ts +1 -0
  49. package/nav-bar/index.js +1 -1
  50. package/no-index-mark/index.d.ts +1 -0
  51. package/package.json +54 -51
  52. package/pagination/base-pagination.js +18 -20
  53. package/pagination/index.js +1 -3
  54. package/pagination/utils.d.ts +3 -3
  55. package/pagination/utils.js +7 -6
  56. package/panel/index.js +1 -3
  57. package/phone-input/index.js +19 -20
  58. package/price/index.d.ts +1 -0
  59. package/price/utils.js +1 -3
  60. package/range/index.js +11 -14
  61. package/rating/index.js +2 -2
  62. package/readme.md +7 -7
  63. package/screen/index.d.ts +12 -47
  64. package/screen/index.js +30 -67
  65. package/screen/screen.module.scss +16 -15
  66. package/screen/slots.d.ts +32 -0
  67. package/screen/slots.js +64 -0
  68. package/screen/utils.d.ts +1 -2
  69. package/select/index.js +5 -7
  70. package/side-page/index.d.ts +15 -2
  71. package/side-page/index.js +2 -2
  72. package/spinner/index.d.ts +1 -1
  73. package/spinner/index.js +1 -1
  74. package/spinner/spinner.module.scss +1 -4
  75. package/styling/fonts.js +1 -3
  76. package/styling/utils.js +1 -3
  77. package/super-ellipse-clip-path/index.d.ts +1 -0
  78. package/tabs/index.d.ts +32 -25
  79. package/tabs/index.js +30 -24
  80. package/tabs/tabs.module.scss +21 -19
  81. package/text-field/index.js +3 -10
  82. package/timer/index.d.ts +3 -3
  83. package/timer/index.js +4 -4
  84. package/timer/utils.js +1 -4
  85. package/top-bar/index.js +1 -1
  86. package/unknown-content/index.d.ts +4 -2
  87. package/unknown-content/index.js +28 -2
  88. package/unknown-content/unknown-content.module.scss +214 -120
  89. package/unknown-content/utils.d.ts +6 -0
  90. package/unknown-content/utils.js +18 -0
  91. package/upload/area.js +3 -1
  92. package/upload/utils.d.ts +2 -2
  93. package/upload/utils.js +2 -2
  94. package/with-hint/positioning-hint.d.ts +1 -1
  95. package/with-hint/positioning-hint.js +1 -1
  96. package/with-hint/utils.js +5 -7
  97. package/with-in-viewport-observer/index.js +1 -1
  98. package/screen/screen-layout.d.ts +0 -57
  99. package/screen/screen-layout.js +0 -110
@@ -1,110 +0,0 @@
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
- };
21
- var __importDefault = (this && this.__importDefault) || function (mod) {
22
- return (mod && mod.__esModule) ? mod : { "default": mod };
23
- };
24
- Object.defineProperty(exports, "__esModule", { value: true });
25
- exports.createTakeContentRef = exports.ScreenLayout = void 0;
26
- const react_1 = __importStar(require("react"));
27
- const nav_bar_1 = require("../nav-bar");
28
- const utils_1 = require("./utils");
29
- const on_1 = __importDefault(require("../helpers/on"));
30
- const is_fully_scrolled_1 = require("../helpers/is-fully-scrolled");
31
- const lodash_1 = require("lodash");
32
- const arrow_left_1 = __importDefault(require("@sima-land/ui-quarks/icons/24x24/Stroked/arrow-left"));
33
- const cross_1 = __importDefault(require("@sima-land/ui-quarks/icons/24x24/Stroked/cross"));
34
- /**
35
- * Разметка содержимого компонента Screen.
36
- * @param props Свойства.
37
- * @param props.children Содержимое.
38
- * @param props.childrenRef Ref для элемента содержимого.
39
- * @param props.footer Содержимое подвала.
40
- * @param props.fullScrollThreshold Отступ от нижней границы для срабатывания onFullScroll.
41
- * @param props.navBarProps Свойства компонента NavBar.
42
- * @param props.onBack Сработает при клике на кнопку "назад".
43
- * @param props.onClose Сработает при клике на крест.
44
- * @param props.onFullScroll Сработает при полной прокрутке контента.
45
- * @param props.subtitle Подзаголовок.
46
- * @param props.title Заголовок.
47
- * @param props.withBackButton Нужно ли выводить кнопку "назад".
48
- * @param props.withCloseButton Нужно ли выводить закрывающий крест.
49
- * @param props.withDivideHeader Нужно ли рисовать черту между шапкой и основным содержимым.
50
- * @param props.withHeader Нужно ли выводить шапку с заголовком и кнопками.
51
- * @return Элемент.
52
- */
53
- const ScreenLayout = ({ children, childrenRef, footer, fullScrollThreshold, navBarProps = {}, onBack, onClose, onFullScroll, subtitle, title, withBackButton, withCloseButton, withDivideHeader, withHeader, }) => {
54
- const contentRef = (0, react_1.useRef)();
55
- const unsubscribeRef = (0, react_1.useRef)();
56
- (0, react_1.useImperativeHandle)(childrenRef, () => contentRef.current);
57
- return (react_1.default.createElement(react_1.default.Fragment, null,
58
- Boolean(withHeader) && (react_1.default.createElement(nav_bar_1.NavBar, Object.assign({}, navBarProps, { title: title, subtitle: subtitle, bottomBordered: withDivideHeader, buttons: Object.assign(Object.assign({}, navBarProps.buttons), { start: withBackButton
59
- ? {
60
- icon: arrow_left_1.default,
61
- onClick: () => onBack && onBack({ contentElement: contentRef.current }),
62
- 'aria-label': 'Вернуться назад',
63
- }
64
- : (0, lodash_1.get)(navBarProps.buttons, 'start'), end: withCloseButton
65
- ? {
66
- icon: cross_1.default,
67
- onClick: () => onClose && onClose({ contentElement: contentRef.current }),
68
- 'aria-label': `Закрыть ${title || ''}`.trim(),
69
- }
70
- : (0, lodash_1.get)(navBarProps.buttons, 'end') }) }))),
71
- react_1.default.createElement("div", { className: (0, utils_1.cx)('content', 'full-width'), children: children, ref: (0, exports.createTakeContentRef)({
72
- elementRef: contentRef,
73
- unsubscribeRef,
74
- onFullScroll,
75
- fullScrollThreshold,
76
- }) }),
77
- Boolean(footer) && (react_1.default.createElement("div", { className: (0, utils_1.cx)('footer', 'full-width') }, footer))));
78
- };
79
- exports.ScreenLayout = ScreenLayout;
80
- /**
81
- * Возвращает функцию сохранения аргумента в ref-контейнер.
82
- * Возвращаемая функция выполняет подписку на "scroll" и вызывает callback в момент полной прокрутки.
83
- * @param options Опции.
84
- * @param options.elementRef Ref-контейнер для элемента.
85
- * @param options.unsubscribeRef Ref-контейнер для функции отписки от "scroll".
86
- * @param options.onFullScroll Сработает при полной прокрутке.
87
- * @param options.fullScrollThreshold Отступ от нижней границы для срабатывания onFullScroll.
88
- * @return Функция сохранения аргумента в ref-контейнер.
89
- */
90
- const createTakeContentRef = ({ elementRef, unsubscribeRef, onFullScroll, fullScrollThreshold: threshold = 0, }) => (element) => {
91
- if (!element) {
92
- // чистим реф
93
- elementRef.current = undefined;
94
- // если ранее были подписаны - отписываемся
95
- unsubscribeRef.current && unsubscribeRef.current();
96
- }
97
- else if (element !== elementRef.current) {
98
- // сохраняем ссылку для последующей отправки в onClose/onBack
99
- elementRef.current = element;
100
- // если ранее были подписаны - отписываемся
101
- unsubscribeRef.current && unsubscribeRef.current();
102
- // выполняем подписку, сохраняем функцию отписки
103
- unsubscribeRef.current = (0, on_1.default)(element, 'scroll', () => {
104
- (0, is_fully_scrolled_1.isFullyScrolled)(element, { threshold })
105
- && onFullScroll
106
- && onFullScroll({ contentElement: element });
107
- });
108
- }
109
- };
110
- exports.createTakeContentRef = createTakeContentRef;