@sima-land/ui-nucleons 45.0.0-alpha.3 → 45.0.0-alpha.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.
Files changed (199) hide show
  1. package/_internal/custom-scrollbar/index.d.ts +2 -2
  2. package/_internal/custom-scrollbar/index.js +17 -14
  3. package/_internal/dropdown-loading/index.js +2 -3
  4. package/_internal/page-scroll-lock/context.js +3 -25
  5. package/alert/index.d.ts +2 -2
  6. package/alert/index.js +4 -30
  7. package/arrow-button/arrow-button.module.scss +5 -5
  8. package/arrow-button/index.js +18 -19
  9. package/autocomplete/autocomplete.js +49 -76
  10. package/autocomplete-deprecated/index.d.ts +1 -1
  11. package/autocomplete-deprecated/index.js +43 -67
  12. package/avatar/avatar.module.scss +3 -1
  13. package/avatar/index.d.ts +1 -1
  14. package/avatar/index.js +10 -36
  15. package/avatar/user.d.ts +1 -1
  16. package/avatar/user.js +8 -29
  17. package/avatar/utils.d.ts +1 -1
  18. package/avatar/utils.js +12 -10
  19. package/base-input/base-input.js +5 -31
  20. package/base-input-deprecated/index.d.ts +2 -2
  21. package/base-input-deprecated/index.js +8 -34
  22. package/bordered-layout/index.d.ts +1 -1
  23. package/bordered-layout/index.js +2 -3
  24. package/bottom-bar/bottom-bar.js +2 -3
  25. package/box/index.d.ts +1 -1
  26. package/box/index.js +2 -2
  27. package/button/index.d.ts +2 -2
  28. package/button/index.js +6 -32
  29. package/card/index.js +2 -8
  30. package/card/slots.d.ts +1 -1
  31. package/card/slots.js +9 -31
  32. package/carousel/draggable.d.ts +1 -1
  33. package/carousel/draggable.js +5 -28
  34. package/carousel/index.d.ts +1 -1
  35. package/carousel/index.js +17 -43
  36. package/checkbox/index.d.ts +2 -2
  37. package/checkbox/index.js +3 -29
  38. package/checkbox-field/index.d.ts +2 -2
  39. package/checkbox-field/index.js +3 -31
  40. package/chips/index.d.ts +1 -1
  41. package/chips/index.js +3 -25
  42. package/chips/item.d.ts +1 -1
  43. package/chips/item.js +3 -5
  44. package/clean-buttons/index.js +6 -28
  45. package/dot-nav/index.d.ts +1 -1
  46. package/dot-nav/index.js +12 -34
  47. package/dropdown/index.d.ts +2 -2
  48. package/dropdown/index.js +3 -26
  49. package/dropdown-item/index.d.ts +1 -1
  50. package/dropdown-item/index.js +4 -9
  51. package/expandable/index.d.ts +2 -2
  52. package/expandable/index.js +8 -36
  53. package/field-block/index.js +2 -9
  54. package/field-grid/index.d.ts +1 -1
  55. package/field-grid/index.js +43 -65
  56. package/file-icon/index.d.ts +1 -1
  57. package/file-icon/index.js +5 -10
  58. package/group-overflow/index.js +7 -29
  59. package/helpers/define-slots.d.ts +1 -1
  60. package/helpers/events.d.ts +1 -1
  61. package/helpers/on.d.ts +1 -1
  62. package/hint/hint-view.js +3 -3
  63. package/hint/hint.js +3 -8
  64. package/hint/utils.d.ts +4 -1
  65. package/hint/utils.js +4 -3
  66. package/hint-deprecated/index.d.ts +2 -2
  67. package/hint-deprecated/index.js +3 -26
  68. package/hooks/breakpoint/index.js +3 -25
  69. package/info-text/index.js +15 -42
  70. package/input/index.js +8 -30
  71. package/layout/layout.js +2 -2
  72. package/layout/legacy.d.ts +5 -5
  73. package/layout/legacy.js +3 -25
  74. package/link/index.d.ts +6 -3
  75. package/link/index.js +3 -25
  76. package/loading-overlay/index.d.ts +1 -1
  77. package/loading-overlay/index.js +2 -3
  78. package/masked-field/index.d.ts +2 -2
  79. package/masked-field/index.js +3 -25
  80. package/masked-input/masked-input.js +3 -25
  81. package/modal/index.d.ts +1 -1
  82. package/modal/index.js +3 -10
  83. package/modal/slots.js +6 -29
  84. package/modal-overlay/index.js +3 -26
  85. package/no-index/index.d.ts +3 -3
  86. package/no-index/index.js +4 -8
  87. package/no-index-mark/index.d.ts +2 -2
  88. package/no-index-mark/index.js +7 -6
  89. package/package.json +6 -11
  90. package/pagination/index.d.ts +4 -20
  91. package/pagination/index.js +8 -15
  92. package/pagination/pagination-item.d.ts +8 -0
  93. package/pagination/pagination-item.js +31 -0
  94. package/pagination/pagination-item.module.scss +49 -0
  95. package/pagination/pagination.d.ts +8 -0
  96. package/pagination/pagination.js +78 -0
  97. package/pagination/pagination.module.scss +14 -70
  98. package/pagination/types.d.ts +28 -0
  99. package/pagination/types.js +2 -0
  100. package/pagination/utils.d.ts +15 -43
  101. package/pagination/utils.js +38 -87
  102. package/{pagination → pagination-deprecated}/base-pagination.d.ts +6 -1
  103. package/{pagination → pagination-deprecated}/base-pagination.js +33 -33
  104. package/pagination-deprecated/index.d.ts +22 -0
  105. package/pagination-deprecated/index.js +15 -0
  106. package/{pagination → pagination-deprecated}/page-button.d.ts +2 -1
  107. package/{pagination → pagination-deprecated}/page-button.js +3 -5
  108. package/pagination-deprecated/pagination.module.scss +76 -0
  109. package/pagination-deprecated/utils.d.ts +58 -0
  110. package/pagination-deprecated/utils.js +124 -0
  111. package/panel/index.js +3 -6
  112. package/phone-input/images/armenia.png +0 -0
  113. package/phone-input/images/azerbaijan.png +0 -0
  114. package/phone-input/images/belarus.png +0 -0
  115. package/phone-input/images/georgia.png +0 -0
  116. package/phone-input/images/kazakhstan.png +0 -0
  117. package/phone-input/images/kyrgyzstan.png +0 -0
  118. package/phone-input/images/moldova.png +0 -0
  119. package/phone-input/images/other.png +0 -0
  120. package/phone-input/images/russia.png +0 -0
  121. package/phone-input/images/tajikistan.png +0 -0
  122. package/phone-input/images/turkmenistan.png +0 -0
  123. package/phone-input/images/ukraine.png +0 -0
  124. package/phone-input/images/uzbekistan.png +0 -0
  125. package/phone-input/phone-input.js +13 -37
  126. package/phone-input/presets.js +2 -0
  127. package/phone-input-deprecated/index.d.ts +1 -1
  128. package/phone-input-deprecated/index.js +31 -57
  129. package/plate/index.d.ts +2 -2
  130. package/plate/index.js +3 -25
  131. package/popup/popup-view.js +3 -6
  132. package/popup/popup.js +4 -26
  133. package/portal/index.d.ts +1 -1
  134. package/price/index.js +2 -2
  135. package/radio-button/index.js +2 -4
  136. package/range/index.d.ts +1 -1
  137. package/range/index.js +6 -33
  138. package/rating/index.d.ts +1 -1
  139. package/rating/index.js +4 -9
  140. package/readme.md +4 -67
  141. package/screen/index.d.ts +5 -5
  142. package/screen/index.js +11 -37
  143. package/screen/slots.d.ts +3 -3
  144. package/screen/slots.js +9 -31
  145. package/select/parts/block.js +6 -28
  146. package/select/parts/button.js +7 -29
  147. package/select/parts/menu.js +12 -33
  148. package/select/select.js +4 -28
  149. package/select-deprecated/index.d.ts +1 -1
  150. package/select-deprecated/index.js +32 -56
  151. package/side-page/index.js +4 -30
  152. package/side-page/slots.js +4 -4
  153. package/spinner/index.d.ts +1 -1
  154. package/spinner/index.js +3 -5
  155. package/spinner/spinner.module.scss +3 -1
  156. package/stepper/index.d.ts +2 -2
  157. package/stepper/index.js +11 -38
  158. package/stroked-svg/index.d.ts +2 -2
  159. package/stroked-svg/index.js +3 -27
  160. package/styling/sizes.module.scss +3 -1
  161. package/super-ellipse-clip-path/index.js +2 -8
  162. package/switcher-row/index.js +5 -10
  163. package/tabs/index.d.ts +1 -1
  164. package/tabs/index.js +4 -26
  165. package/text/index.d.ts +2 -2
  166. package/text/index.js +3 -25
  167. package/text-button/index.d.ts +2 -2
  168. package/text-button/index.js +4 -7
  169. package/text-button/text-button.module.scss +1 -1
  170. package/text-field/index.d.ts +2 -2
  171. package/text-field/index.js +25 -55
  172. package/textarea/index.js +4 -26
  173. package/timer/index.d.ts +1 -1
  174. package/timer/index.js +3 -25
  175. package/toggle/index.d.ts +2 -2
  176. package/toggle/index.js +3 -27
  177. package/tooltip/index.d.ts +2 -2
  178. package/tooltip/index.js +4 -28
  179. package/top-bar/index.d.ts +1 -1
  180. package/top-bar/index.js +3 -1
  181. package/top-bar/top-bar.js +5 -45
  182. package/top-bar/utils.d.ts +2 -2
  183. package/top-bar/utils.js +6 -28
  184. package/touch-slider/index.d.ts +1 -1
  185. package/touch-slider/index.js +2 -4
  186. package/unknown-content/index.d.ts +1 -1
  187. package/unknown-content/index.js +3 -25
  188. package/upload-area/upload-area.js +8 -38
  189. package/with-hint/index.d.ts +1 -1
  190. package/with-hint/index.js +3 -28
  191. package/with-hint/positioning-hint.d.ts +1 -1
  192. package/with-hint/positioning-hint.js +3 -25
  193. package/with-tooltip/index.d.ts +1 -1
  194. package/with-tooltip/index.js +6 -31
  195. package/with-tooltip/positioning-tooltip.d.ts +1 -1
  196. package/with-tooltip/positioning-tooltip.js +4 -26
  197. package/file-icon/unknown.svg +0 -9
  198. package/rating/star.svg +0 -3
  199. package/upload-area/upload.svg +0 -6
package/readme.md CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  ### Установка
8
8
 
9
- ```bash
9
+ ```sh
10
10
  # npm
11
11
  npm i -S @sima-land/ui-nucleons
12
12
 
@@ -18,42 +18,21 @@ yarn add @sima-land/ui-nucleons
18
18
 
19
19
  Компоненты библиотеки используют:
20
20
 
21
- - импорты изображений (jpg, png..) как url/src
21
+ - импорты изображений (jpg, png...) как url/base64
22
22
  - импорты стилей
23
23
  - импорты стилей как css-модулей (каждый такой файл промаркирован в виде `%filename%.module.scss`)
24
- - импорты svg-файлов как react-компоненты
25
24
 
26
25
  #### Для работы с Webpack необходимо (как вариант):
27
26
 
28
- - добавить необходимые пакеты `@svgr/*`
29
- - сконфигурировать обработку svg, css, scss файлов
30
-
31
- ##### Зависимости
32
-
33
- ```bash
34
- npm install --save-dev @svgr/core @svgr/plugin-jsx @svgr/plugin-svgo @svgr/webpack
35
- ```
27
+ - сконфигурировать обработку импортов css, scss файлов
36
28
 
37
29
  ##### Конфигурация
38
30
 
39
31
  ```js
40
32
  // webpack.config.js
41
- const svgrOptions = require('../../svgr.config'); // опции SVGR (скопировать из данного проекта)
42
-
43
33
  module.exports = {
44
34
  module: {
45
35
  rules: [
46
- // svg
47
- {
48
- test: /\.svg$/,
49
- use: [
50
- {
51
- loader: '@svgr/webpack',
52
- options: svgrOptions,
53
- },
54
- ],
55
- },
56
-
57
36
  // стилей
58
37
  {
59
38
  test: /\.(css|scss)$/,
@@ -78,29 +57,7 @@ module.exports = {
78
57
 
79
58
  #### Для работы с Jest необходимо (как вариант):
80
59
 
81
- - добавить необходимые пакеты `@svgr/*`
82
- - сконфигурировать обработку svg, css, scss файлов
83
-
84
- ##### Добавить обработку SVG
85
-
86
- - добавить файл "трансформера" вида:
87
-
88
- ```js
89
- const babel = require('@babel/core');
90
- const babelConfig = require('../../babel.config');
91
- const svgr = require('@svgr/core');
92
- const svgrConfig = require('../../svgr.config');
93
-
94
- module.exports = {
95
- process(sourceText, sourcePath) {
96
- const code = svgr.transform.sync(sourceText, svgrConfig, { filePath: sourcePath });
97
-
98
- return babel.transformSync(code, { filename: sourcePath, ...babelConfig });
99
- },
100
- };
101
- ```
102
-
103
- - задействовать его в конфигурации Jest
60
+ - сконфигурировать обработку css, scss файлов
104
61
 
105
62
  ##### Добавить поддержку стилей
106
63
 
@@ -109,9 +66,6 @@ module.exports = {
109
66
  ```js
110
67
  module.exports = {
111
68
  transform: {
112
- // svg как react-компоненты
113
- '\\.svg$': '<rootDir>/.jest/transforms/svg.js',
114
-
115
69
  // обычный css
116
70
  '(?<!(\\.module))\\.(css|scss)$': './transformer/empty.js',
117
71
 
@@ -142,12 +96,6 @@ declare module '*.module.scss' {
142
96
  const classes: { [key: string]: string };
143
97
  export default classes;
144
98
  }
145
-
146
- // svg как React-компоненты
147
- declare module '*.svg' {
148
- const content: React.FunctionComponent<React.SVGProps<SVGSVGElement>>;
149
- export default content;
150
- }
151
99
  ```
152
100
 
153
101
  ## Разработка и поддержка
@@ -170,14 +118,3 @@ declare module '*.svg' {
170
118
  - `helpers/` - общие вспомогательные функции (для использования вне библиотеки)
171
119
  - `hooks/` - общие react-хуки (для использования вне библиотеки)
172
120
  - `_internal/` - внутренние скрипты для использования только в рамках данной библиотеки
173
-
174
- ### Тестирование
175
-
176
- Локально E2E-тесты должны запускаться через docker, пример:
177
-
178
- ```bash
179
- docker run --rm --network host -v $(pwd):/work/ -w /work/ -it mcr.microsoft.com/playwright:v1.29.2-focal /bin/bash
180
- npx playwright test
181
- ```
182
-
183
- В противном случае скриншотные тесты не будут совпадать из-за разницы окружения запуска.
package/screen/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ /// <reference types="react" />
2
2
  import { ScreenInnerProps } from './utils';
3
3
  import { WithPageScrollLock } from '../_internal/page-scroll-lock';
4
4
  export interface ScreenProps extends ScreenInnerProps, WithPageScrollLock {
@@ -18,8 +18,8 @@ export interface ScreenProps extends ScreenInnerProps, WithPageScrollLock {
18
18
  export declare const Screen: {
19
19
  ({ children, loading, loadingArea, loadingOverlayProps, onFullScroll, fullScrollThreshold, withScrollDisable, scrollDisableOptions, "data-testid": testId, }: ScreenProps): JSX.Element;
20
20
  Header: ({ divided, title, subtitle, buttons, onBack, onClose, ...restProps }: import("./slots").HeaderSlotProps) => JSX.Element;
21
- Body: React.ForwardRefExoticComponent<{
22
- children?: React.ReactNode;
23
- } & React.RefAttributes<HTMLDivElement | null>>;
24
- Footer: React.FC<{}>;
21
+ Body: import("react").ForwardRefExoticComponent<{
22
+ children?: import("react").ReactNode;
23
+ } & import("react").RefAttributes<HTMLDivElement | null>>;
24
+ Footer: import("react").FC<{}>;
25
25
  };
package/screen/index.js CHANGED
@@ -1,33 +1,11 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
26
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
4
  };
28
5
  Object.defineProperty(exports, "__esModule", { value: true });
29
6
  exports.Screen = void 0;
30
- const react_1 = __importStar(require("react"));
7
+ const jsx_runtime_1 = require("react/jsx-runtime");
8
+ const react_1 = require("react");
31
9
  const slots_1 = require("./slots");
32
10
  const layer_1 = require("../helpers/layer");
33
11
  const define_slots_1 = require("../helpers/define-slots");
@@ -53,20 +31,16 @@ const Screen = ({ children, loading, loadingArea = 'full', loadingOverlayProps,
53
31
  if (!body) {
54
32
  throw Error('Looks like you are trying to render <Screen /> without <Screen.Body /> slot, but it is required');
55
33
  }
56
- return (react_1.default.createElement("div", { ref: rootRef, className: screen_module_scss_1.default.root, style: {
34
+ return ((0, jsx_runtime_1.jsx)("div", Object.assign({ ref: rootRef, className: screen_module_scss_1.default.root, style: {
57
35
  zIndex: layer, // z-index именно здесь из-за position: fixed
58
- }, "data-testid": testId },
59
- react_1.default.createElement(layer_1.LayerProvider, { value: layer },
60
- !fullLoading && header,
61
- react_1.default.createElement(utils_1.ScreenContext.Provider, { value: {
62
- loading,
63
- loadingOverlayProps,
64
- onFullScroll,
65
- fullScrollThreshold,
66
- withScrollDisable,
67
- scrollDisableOptions,
68
- } }, body),
69
- !fullLoading && footer && (react_1.default.createElement("div", { className: screen_module_scss_1.default.footer, "data-testid": 'screen:footer' }, footer)))));
36
+ }, "data-testid": testId }, { children: (0, jsx_runtime_1.jsxs)(layer_1.LayerProvider, Object.assign({ value: layer }, { children: [!fullLoading && header, (0, jsx_runtime_1.jsx)(utils_1.ScreenContext.Provider, Object.assign({ value: {
37
+ loading,
38
+ loadingOverlayProps,
39
+ onFullScroll,
40
+ fullScrollThreshold,
41
+ withScrollDisable,
42
+ scrollDisableOptions,
43
+ } }, { children: body })), !fullLoading && footer && ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: screen_module_scss_1.default.footer, "data-testid": 'screen:footer' }, { children: footer })))] })) })));
70
44
  };
71
45
  exports.Screen = Screen;
72
46
  exports.Screen.Header = slots_1.HeaderSlot;
package/screen/slots.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ /// <reference types="react" />
2
2
  import { TopBarProps } from '../top-bar';
3
3
  export interface HeaderSlotProps extends TopBarProps {
4
4
  /** Будет вызвана при нажатии на кнопку-стрелку. */
@@ -15,9 +15,9 @@ export declare const HeaderSlot: ({ divided, title, subtitle, buttons, onBack, o
15
15
  /**
16
16
  * Слот основного контента экрана.
17
17
  */
18
- export declare const BodySlot: React.ForwardRefExoticComponent<{
18
+ export declare const BodySlot: import("react").ForwardRefExoticComponent<{
19
19
  children?: React.ReactNode;
20
- } & React.RefAttributes<HTMLDivElement | null>>;
20
+ } & import("react").RefAttributes<HTMLDivElement | null>>;
21
21
  /**
22
22
  * Слот футера экрана.
23
23
  * @param props Свойства.
package/screen/slots.js CHANGED
@@ -1,27 +1,4 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
2
  var __rest = (this && this.__rest) || function (s, e) {
26
3
  var t = {};
27
4
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
@@ -38,10 +15,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
38
15
  };
39
16
  Object.defineProperty(exports, "__esModule", { value: true });
40
17
  exports.FooterSlot = exports.BodySlot = exports.HeaderSlot = void 0;
41
- const react_1 = __importStar(require("react"));
18
+ const jsx_runtime_1 = require("react/jsx-runtime");
19
+ const react_1 = require("react");
42
20
  const lodash_1 = require("lodash");
43
- const arrow_left_1 = __importDefault(require("@sima-land/ui-quarks/icons/24x24/Stroked/arrow-left"));
44
- const cross_1 = __importDefault(require("@sima-land/ui-quarks/icons/24x24/Stroked/cross"));
21
+ const ArrowLeft_1 = __importDefault(require("@sima-land/ui-quarks/icons/24x24/Stroked/ArrowLeft"));
22
+ const Cross_1 = __importDefault(require("@sima-land/ui-quarks/icons/24x24/Stroked/Cross"));
45
23
  const page_scroll_lock_1 = require("../_internal/page-scroll-lock");
46
24
  const hooks_1 = require("../hooks");
47
25
  const loading_overlay_1 = require("../loading-overlay");
@@ -55,11 +33,11 @@ const top_bar_1 = require("../top-bar");
55
33
  */
56
34
  const HeaderSlot = (_a) => {
57
35
  var { divided, title, subtitle, buttons, onBack, onClose } = _a, restProps = __rest(_a, ["divided", "title", "subtitle", "buttons", "onBack", "onClose"]);
58
- return (react_1.default.createElement(top_bar_1.TopBar, Object.assign({}, restProps, { size: 's', title: title, subtitle: subtitle, divided: divided, buttons: Object.assign(Object.assign({}, buttons), { start: onBack
36
+ return ((0, jsx_runtime_1.jsx)(top_bar_1.TopBar, Object.assign({}, restProps, { size: 's', title: title, subtitle: subtitle, divided: divided, buttons: Object.assign(Object.assign({}, buttons), { start: onBack
59
37
  ? {
60
38
  // ВАЖНО: не подмешиваем свойства из buttons.start
61
39
  // чтобы не распылять конфигурацию одной и той же кнопки по нескольким местам
62
- icon: react_1.default.createElement(arrow_left_1.default, null),
40
+ icon: (0, jsx_runtime_1.jsx)(ArrowLeft_1.default, {}),
63
41
  onClick: onBack,
64
42
  'aria-label': 'Вернуться назад',
65
43
  'data-testid': 'screen:back',
@@ -68,7 +46,7 @@ const HeaderSlot = (_a) => {
68
46
  ? {
69
47
  // ВАЖНО: не подмешиваем свойства из buttons.end
70
48
  // чтобы не распылять конфигурацию одной и той же кнопки по нескольким местам
71
- icon: react_1.default.createElement(cross_1.default, null),
49
+ icon: (0, jsx_runtime_1.jsx)(Cross_1.default, {}),
72
50
  onClick: onClose,
73
51
  'aria-label': `Закрыть ${title || ''}`.trim(),
74
52
  'data-testid': 'screen:close',
@@ -90,12 +68,12 @@ exports.BodySlot = (0, react_1.forwardRef)(function BodySlot({ children }, outer
90
68
  (0, hooks_1.useInfiniteScroll)(ref, { onFullScroll, threshold: fullScrollThreshold });
91
69
  return (
92
70
  // ВАЖНО: элемент с ref должен выводиться всегда (без условий), т.к. он нужен для блокировки прокрутки
93
- react_1.default.createElement("div", { ref: ref, className: screen_module_scss_1.default.body, "data-testid": 'screen:body' }, loading ? (react_1.default.createElement(loading_overlay_1.LoadingOverlay, Object.assign({}, loadingOverlayProps, { fill: false, style: { height: '100%' } }))) : (children)));
71
+ (0, jsx_runtime_1.jsx)("div", Object.assign({ ref: ref, className: screen_module_scss_1.default.body, "data-testid": 'screen:body' }, { children: loading ? ((0, jsx_runtime_1.jsx)(loading_overlay_1.LoadingOverlay, Object.assign({}, loadingOverlayProps, { fill: false, style: { height: '100%' } }))) : (children) })));
94
72
  });
95
73
  /**
96
74
  * Слот футера экрана.
97
75
  * @param props Свойства.
98
76
  * @return Элемент.
99
77
  */
100
- const FooterSlot = ({ children }) => react_1.default.createElement(react_1.default.Fragment, null, children);
78
+ const FooterSlot = ({ children }) => (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: children });
101
79
  exports.FooterSlot = FooterSlot;
@@ -1,38 +1,16 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
26
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
4
  };
28
5
  Object.defineProperty(exports, "__esModule", { value: true });
29
6
  exports.SelectFieldBlock = void 0;
30
- const react_1 = __importStar(require("react"));
7
+ const jsx_runtime_1 = require("react/jsx-runtime");
8
+ const react_1 = require("react");
31
9
  const utils_1 = require("../utils");
32
10
  const field_block_1 = require("../../field-block");
33
11
  const colors_1 = require("../../colors");
34
- const up_1 = __importDefault(require("@sima-land/ui-quarks/icons/16x16/Stroked/Arrows/up"));
35
- const down_1 = __importDefault(require("@sima-land/ui-quarks/icons/16x16/Stroked/Arrows/down"));
12
+ const Up_1 = __importDefault(require("@sima-land/ui-quarks/icons/16x16/Stroked/Arrows/Up"));
13
+ const Down_1 = __importDefault(require("@sima-land/ui-quarks/icons/16x16/Stroked/Arrows/Down"));
36
14
  const block_module_scss_1 = __importDefault(require("./block.module.scss"));
37
15
  const classnames_1 = __importDefault(require("classnames"));
38
16
  /**
@@ -44,12 +22,12 @@ function SelectFieldBlock(props) {
44
22
  var _a;
45
23
  const binding = (0, react_1.useContext)(utils_1.SelectContext);
46
24
  const [focused, setFocused] = (0, react_1.useState)(false);
47
- const ArrowSVG = binding.opened ? up_1.default : down_1.default;
25
+ const ArrowSVG = binding.opened ? Up_1.default : Down_1.default;
48
26
  // @todo прокидывать ref в props.blockRef при необходимости
49
27
  const ref = (0, react_1.useRef)(null);
50
28
  (0, react_1.useImperativeHandle)(binding.anchorRef, () => ref.current);
51
29
  (0, react_1.useImperativeHandle)(binding.openerRef, () => ref.current);
52
- return (react_1.default.createElement(field_block_1.FieldBlock, Object.assign({ label: binding.label, adornmentEnd: react_1.default.createElement(ArrowSVG, { fill: colors_1.COLORS.get('basic-gray24') }) }, props, { failed: binding.failed, disabled: binding.disabled, fixedHeight: true, blockRef: ref, blockProps: Object.assign(Object.assign({}, props === null || props === void 0 ? void 0 : props.blockProps), { onFocus: event => {
30
+ return ((0, jsx_runtime_1.jsx)(field_block_1.FieldBlock, Object.assign({ label: binding.label, adornmentEnd: (0, jsx_runtime_1.jsx)(ArrowSVG, { fill: colors_1.COLORS.get('basic-gray24') }) }, props, { failed: binding.failed, disabled: binding.disabled, fixedHeight: true, blockRef: ref, blockProps: Object.assign(Object.assign({}, props === null || props === void 0 ? void 0 : props.blockProps), { onFocus: event => {
53
31
  var _a, _b;
54
32
  setFocused(true);
55
33
  (_b = (_a = props.blockProps) === null || _a === void 0 ? void 0 : _a.onFocus) === null || _b === void 0 ? void 0 : _b.call(_a, event);
@@ -1,27 +1,4 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
2
  var __rest = (this && this.__rest) || function (s, e) {
26
3
  var t = {};
27
4
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
@@ -38,11 +15,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
38
15
  };
39
16
  Object.defineProperty(exports, "__esModule", { value: true });
40
17
  exports.SelectTextButton = void 0;
41
- const react_1 = __importStar(require("react"));
18
+ const jsx_runtime_1 = require("react/jsx-runtime");
19
+ const react_1 = require("react");
42
20
  const text_button_1 = require("../../text-button");
43
21
  const utils_1 = require("../utils");
44
- const up_1 = __importDefault(require("@sima-land/ui-quarks/icons/16x16/Stroked/Arrows/up"));
45
- const down_1 = __importDefault(require("@sima-land/ui-quarks/icons/16x16/Stroked/Arrows/down"));
22
+ const Up_1 = __importDefault(require("@sima-land/ui-quarks/icons/16x16/Stroked/Arrows/Up"));
23
+ const Down_1 = __importDefault(require("@sima-land/ui-quarks/icons/16x16/Stroked/Arrows/Down"));
46
24
  /**
47
25
  * Компонент открывашки в виде текстовой кнопки.
48
26
  * @param props Свойства.
@@ -52,11 +30,11 @@ function SelectTextButton(_a) {
52
30
  var { buttonRef: buttonRefProp, children, onKeyDown, onMouseDown } = _a, props = __rest(_a, ["buttonRef", "children", "onKeyDown", "onMouseDown"]);
53
31
  const buttonRef = (0, react_1.useRef)(null);
54
32
  const binding = (0, react_1.useContext)(utils_1.SelectContext);
55
- const ArrowSVG = binding.opened ? up_1.default : down_1.default;
33
+ const ArrowSVG = binding.opened ? Up_1.default : Down_1.default;
56
34
  (0, react_1.useImperativeHandle)(buttonRefProp, () => buttonRef.current);
57
35
  (0, react_1.useImperativeHandle)(binding.anchorRef, () => buttonRef.current);
58
36
  (0, react_1.useImperativeHandle)(binding.openerRef, () => buttonRef.current);
59
- return (react_1.default.createElement(text_button_1.TextButton, Object.assign({ iconGutter: 4, endIcon: ArrowSVG }, props, { as: 'button', onMouseDown: event => {
37
+ return ((0, jsx_runtime_1.jsx)(text_button_1.TextButton, Object.assign({ iconGutter: 4, endIcon: ArrowSVG }, props, { as: 'button', onMouseDown: event => {
60
38
  var _a;
61
39
  (_a = binding.onMouseDown) === null || _a === void 0 ? void 0 : _a.call(binding, event);
62
40
  onMouseDown === null || onMouseDown === void 0 ? void 0 : onMouseDown(event);
@@ -64,6 +42,6 @@ function SelectTextButton(_a) {
64
42
  var _a;
65
43
  (_a = binding.onKeyDown) === null || _a === void 0 ? void 0 : _a.call(binding, event);
66
44
  onKeyDown === null || onKeyDown === void 0 ? void 0 : onKeyDown(event);
67
- }, disabled: binding.disabled, buttonRef: buttonRef, role: 'combobox' }), children !== null && children !== void 0 ? children : (binding.value || binding.label)));
45
+ }, disabled: binding.disabled, buttonRef: buttonRef, role: 'combobox' }, { children: children !== null && children !== void 0 ? children : (binding.value || binding.label) })));
68
46
  }
69
47
  exports.SelectTextButton = SelectTextButton;
@@ -1,27 +1,4 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
2
  var __rest = (this && this.__rest) || function (s, e) {
26
3
  var t = {};
27
4
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
@@ -38,7 +15,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
38
15
  };
39
16
  Object.defineProperty(exports, "__esModule", { value: true });
40
17
  exports.SelectMenu = void 0;
41
- const react_1 = __importStar(require("react"));
18
+ const react_1 = require("react");
19
+ const jsx_runtime_1 = require("react/jsx-runtime");
20
+ const react_2 = require("react");
42
21
  const dropdown_1 = require("../../dropdown");
43
22
  const dropdown_item_1 = require("../../dropdown-item");
44
23
  const utils_1 = require("../../dropdown-item/utils");
@@ -56,13 +35,13 @@ const MenuItemAttr = {
56
35
  */
57
36
  function SelectMenu(_a) {
58
37
  var { loading, children, menuRef, value, onKeyDown, onItemSelect } = _a, restProps = __rest(_a, ["loading", "children", "menuRef", "value", "onKeyDown", "onItemSelect"]);
59
- const ref = (0, react_1.useRef)(null);
60
- const osComponentRef = (0, react_1.useRef)(null);
61
- const [activeIndex, setActiveIndex] = (0, react_1.useState)(-1);
62
- const items = react_1.Children.toArray(children).filter(utils_1.DropdownItemUtils.is);
63
- (0, react_1.useImperativeHandle)(menuRef, () => ref.current);
38
+ const ref = (0, react_2.useRef)(null);
39
+ const osComponentRef = (0, react_2.useRef)(null);
40
+ const [activeIndex, setActiveIndex] = (0, react_2.useState)(-1);
41
+ const items = react_2.Children.toArray(children).filter(utils_1.DropdownItemUtils.is);
42
+ (0, react_2.useImperativeHandle)(menuRef, () => ref.current);
64
43
  // прокрутка до элемента списка
65
- (0, react_1.useEffect)(() => {
44
+ (0, react_2.useEffect)(() => {
66
45
  var _a, _b;
67
46
  const menu = ref.current;
68
47
  const itemSelector = `[${MenuItemAttr.name}="${MenuItemAttr.value}"]`;
@@ -74,7 +53,7 @@ function SelectMenu(_a) {
74
53
  });
75
54
  }
76
55
  }, [activeIndex]);
77
- const handleMenuKeyDown = (0, react_1.useCallback)(event => {
56
+ const handleMenuKeyDown = (0, react_2.useCallback)(event => {
78
57
  onKeyDown === null || onKeyDown === void 0 ? void 0 : onKeyDown(event);
79
58
  switch (event.code) {
80
59
  case 'Enter': {
@@ -93,13 +72,13 @@ function SelectMenu(_a) {
93
72
  break;
94
73
  }
95
74
  }, [items, activeIndex, onKeyDown]);
96
- const handleItemClick = (0, react_1.useCallback)((item) => item.props.disabled
75
+ const handleItemClick = (0, react_2.useCallback)((item) => item.props.disabled
97
76
  ? undefined
98
77
  : event => {
99
78
  var _a, _b;
100
79
  (_b = (_a = item.props).onClick) === null || _b === void 0 ? void 0 : _b.call(_a, event);
101
80
  onItemSelect === null || onItemSelect === void 0 ? void 0 : onItemSelect(item);
102
81
  }, [onItemSelect]);
103
- return (react_1.default.createElement(dropdown_1.Dropdown, Object.assign({}, restProps, { ref: ref, tabIndex: 0, role: 'listbox', onKeyDown: handleMenuKeyDown, className: (0, classnames_1.default)(menu_module_scss_1.default.menu, restProps.className), customScrollbarProps: { osComponentRef } }), loading ? (react_1.default.createElement(dropdown_loading_1.DropdownLoading, { "data-testid": 'select:loading-area' })) : (items.map((item, index) => (react_1.default.createElement(dropdown_item_1.DropdownItem, Object.assign({ checked: activeIndex === index, selected: value === utils_1.DropdownItemUtils.getValue(item) }, item.props, { key: index, role: 'option', onClick: handleItemClick(item) }, { [MenuItemAttr.name]: MenuItemAttr.value })))))));
82
+ return ((0, jsx_runtime_1.jsx)(dropdown_1.Dropdown, Object.assign({}, restProps, { ref: ref, tabIndex: 0, role: 'listbox', onKeyDown: handleMenuKeyDown, className: (0, classnames_1.default)(menu_module_scss_1.default.menu, restProps.className), customScrollbarProps: { osComponentRef } }, { children: loading ? ((0, jsx_runtime_1.jsx)(dropdown_loading_1.DropdownLoading, { "data-testid": 'select:loading-area' })) : (items.map((item, index) => ((0, react_1.createElement)(dropdown_item_1.DropdownItem, Object.assign({ checked: activeIndex === index, selected: value === utils_1.DropdownItemUtils.getValue(item) }, item.props, { key: index, role: 'option', onClick: handleItemClick(item) }, { [MenuItemAttr.name]: MenuItemAttr.value }))))) })));
104
83
  }
105
84
  exports.SelectMenu = SelectMenu;
package/select/select.js CHANGED
@@ -1,27 +1,4 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
2
  var __rest = (this && this.__rest) || function (s, e) {
26
3
  var t = {};
27
4
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
@@ -35,7 +12,8 @@ var __rest = (this && this.__rest) || function (s, e) {
35
12
  };
36
13
  Object.defineProperty(exports, "__esModule", { value: true });
37
14
  exports.Select = void 0;
38
- const react_1 = __importStar(require("react"));
15
+ const jsx_runtime_1 = require("react/jsx-runtime");
16
+ const react_1 = require("react");
39
17
  const utils_1 = require("./utils");
40
18
  const identity_1 = require("../hooks/identity");
41
19
  const utils_2 = require("../dropdown-item/utils");
@@ -49,7 +27,7 @@ const utils_3 = require("../dropdown/utils");
49
27
  * @param props Свойства.
50
28
  * @return Элемент.
51
29
  */
52
- function Select({ children, disabled, failed, loading, onValueChange, onMenuToggle, value, defaultValue, label, opener = react_1.default.createElement(block_1.SelectFieldBlock, null), renderValue = v => v, dropdownProps, }) {
30
+ function Select({ children, disabled, failed, loading, onValueChange, onMenuToggle, value, defaultValue, label, opener = (0, jsx_runtime_1.jsx)(block_1.SelectFieldBlock, {}), renderValue = v => v, dropdownProps, }) {
53
31
  // @todo по аналогии с <select /> надо проверять, есть ли значение в списке переданных
54
32
  const [initialValue] = (0, react_1.useState)(() => { var _a; return (_a = value !== null && value !== void 0 ? value : defaultValue) !== null && _a !== void 0 ? _a : ''; });
55
33
  const [currentValue, setCurrentValue] = (0, react_1.useState)(initialValue);
@@ -136,9 +114,7 @@ function Select({ children, disabled, failed, loading, onValueChange, onMenuTogg
136
114
  setNeedMenu(false);
137
115
  (_a = openerRef.current) === null || _a === void 0 ? void 0 : _a.focus();
138
116
  } });
139
- return (react_1.default.createElement(react_1.default.Fragment, null,
140
- react_1.default.createElement(utils_1.SelectContext.Provider, { value: openerBinding }, (0, react_1.isValidElement)(opener) && opener),
141
- react_1.default.createElement(react_2.FloatingPortal, { id: '' }, needMenu && react_1.default.createElement(menu_1.SelectMenu, Object.assign({}, menuProps), children))));
117
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(utils_1.SelectContext.Provider, Object.assign({ value: openerBinding }, { children: (0, react_1.isValidElement)(opener) && opener })), (0, jsx_runtime_1.jsx)(react_2.FloatingPortal, Object.assign({ id: '' }, { children: needMenu && (0, jsx_runtime_1.jsx)(menu_1.SelectMenu, Object.assign({}, menuProps, { children: children })) }))] }));
142
118
  }
143
119
  exports.Select = Select;
144
120
  Select.FieldBlock = block_1.SelectFieldBlock;
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ /// <reference types="react" />
2
2
  import { TextFieldProps } from '../text-field';
3
3
  type Size = 's' | 'm' | 'l' | 'xl';
4
4
  export interface SelectProps extends Omit<TextFieldProps, 'style' | 'endAdornment'> {