@sima-land/ui-nucleons 44.2.9 → 45.0.0-alpha.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 (376) hide show
  1. package/_internal/custom-scrollbar/index.d.ts +13 -7
  2. package/_internal/custom-scrollbar/index.js +29 -15
  3. package/_internal/dropdown-loading/index.d.ts +3 -3
  4. package/_internal/dropdown-loading/index.js +4 -2
  5. package/_internal/page-scroll-lock/adapters/body-scroll-lock.d.ts +39 -0
  6. package/_internal/page-scroll-lock/adapters/body-scroll-lock.js +62 -0
  7. package/_internal/page-scroll-lock/adapters/ui-nucleons.d.ts +25 -0
  8. package/_internal/page-scroll-lock/adapters/ui-nucleons.js +103 -0
  9. package/_internal/page-scroll-lock/context.d.ts +13 -0
  10. package/_internal/page-scroll-lock/context.js +54 -0
  11. package/_internal/page-scroll-lock/hook.d.ts +12 -0
  12. package/_internal/page-scroll-lock/hook.js +26 -0
  13. package/_internal/page-scroll-lock/index.d.ts +4 -0
  14. package/_internal/page-scroll-lock/index.js +9 -0
  15. package/_internal/page-scroll-lock/types.d.ts +22 -0
  16. package/_internal/{checkbox/index.js → page-scroll-lock/types.js} +0 -0
  17. package/_internal/readme.md +2 -0
  18. package/_internal/utils/dropdown.d.ts +1 -0
  19. package/_internal/utils/dropdown.js +1 -0
  20. package/alert/alert.module.scss +1 -24
  21. package/alert/index.d.ts +11 -17
  22. package/alert/index.js +33 -16
  23. package/arrow-button/arrow-button.module.scss +2 -0
  24. package/arrow-button/index.d.ts +2 -2
  25. package/autocomplete/autocomplete.d.ts +8 -0
  26. package/autocomplete/autocomplete.js +190 -0
  27. package/autocomplete/autocomplete.module.scss +2 -15
  28. package/autocomplete/index.d.ts +2 -27
  29. package/autocomplete/index.js +2 -126
  30. package/autocomplete/types.d.ts +19 -0
  31. package/autocomplete/types.js +2 -0
  32. package/autocomplete-deprecated/autocomplete.module.scss +20 -0
  33. package/autocomplete-deprecated/index.d.ts +28 -0
  34. package/autocomplete-deprecated/index.js +130 -0
  35. package/avatar/index.d.ts +2 -2
  36. package/avatar/user.d.ts +1 -1
  37. package/base-input/base-input.d.ts +11 -0
  38. package/base-input/base-input.js +96 -0
  39. package/base-input/base-input.module.scss +3 -3
  40. package/base-input/index.d.ts +2 -23
  41. package/base-input/index.js +2 -76
  42. package/base-input/types.d.ts +31 -0
  43. package/base-input/types.js +2 -0
  44. package/base-input/utils.d.ts +6 -0
  45. package/base-input/utils.js +14 -0
  46. package/base-input-deprecated/base-input.module.scss +66 -0
  47. package/base-input-deprecated/index.d.ts +24 -0
  48. package/base-input-deprecated/index.js +80 -0
  49. package/bordered-layout/index.d.ts +1 -0
  50. package/bordered-layout/index.js +1 -0
  51. package/bottom-bar/bottom-bar-util.scss +20 -0
  52. package/bottom-bar/bottom-bar.d.ts +12 -0
  53. package/bottom-bar/bottom-bar.js +47 -0
  54. package/bottom-bar/bottom-bar.module.scss +14 -0
  55. package/bottom-bar/index.d.ts +2 -21
  56. package/bottom-bar/index.js +5 -44
  57. package/bottom-bar/types.d.ts +10 -0
  58. package/bottom-bar/types.js +2 -0
  59. package/box/index.d.ts +1 -1
  60. package/breakpoints.scss +1 -1
  61. package/button/button.module.scss +70 -53
  62. package/button/index.d.ts +26 -41
  63. package/button/index.js +22 -46
  64. package/card/index.d.ts +2 -1
  65. package/card/index.js +23 -6
  66. package/card/slots.d.ts +17 -3
  67. package/card/slots.js +15 -13
  68. package/carousel/draggable.d.ts +7 -3
  69. package/carousel/draggable.js +10 -3
  70. package/carousel/helpers/draggable-event.d.ts +5 -2
  71. package/carousel/helpers/draggable-event.js +5 -0
  72. package/carousel/index.d.ts +1 -1
  73. package/carousel/index.js +24 -24
  74. package/checkbox/checkbox.module.scss +2 -0
  75. package/checkbox/index.d.ts +3 -3
  76. package/checkbox-field/index.d.ts +3 -0
  77. package/checkbox-field/index.js +3 -0
  78. package/clean-buttons/clean-buttons-util.scss +15 -0
  79. package/clean-buttons/clean-buttons.module.scss +5 -3
  80. package/clean-buttons/index.d.ts +16 -7
  81. package/clean-buttons/index.js +17 -14
  82. package/clean-buttons/types.d.ts +1 -1
  83. package/clean-buttons/utils.d.ts +5 -1
  84. package/clean-buttons/utils.js +4 -0
  85. package/{colors.d.ts → colors/index.d.ts} +1 -1
  86. package/{colors.js → colors/index.js} +0 -0
  87. package/dot-nav/index.d.ts +1 -1
  88. package/dropdown/index.d.ts +1 -0
  89. package/dropdown/utils.d.ts +19 -0
  90. package/dropdown/utils.js +45 -0
  91. package/dropdown-item/dropdown-item.module.scss +80 -15
  92. package/dropdown-item/index.d.ts +20 -9
  93. package/dropdown-item/index.js +12 -9
  94. package/dropdown-item/types.d.ts +3 -0
  95. package/dropdown-item/types.js +2 -0
  96. package/dropdown-item/utils.d.ts +45 -0
  97. package/dropdown-item/utils.js +89 -0
  98. package/expandable/utils.js +3 -3
  99. package/field-block/field-block.module.scss +155 -0
  100. package/field-block/index.d.ts +63 -0
  101. package/field-block/index.js +43 -0
  102. package/field-grid/index.d.ts +5 -4
  103. package/field-grid/index.js +1 -0
  104. package/helpers/bounds-of.d.ts +5 -1
  105. package/helpers/bounds-of.js +5 -0
  106. package/helpers/center-of.d.ts +4 -1
  107. package/helpers/center-of.js +8 -1
  108. package/helpers/create-container.d.ts +5 -2
  109. package/helpers/create-container.js +7 -2
  110. package/helpers/define-slots.d.ts +3 -3
  111. package/helpers/define-slots.js +5 -3
  112. package/helpers/events.d.ts +16 -8
  113. package/helpers/events.js +41 -15
  114. package/helpers/find-child-element.d.ts +12 -9
  115. package/helpers/find-child-element.js +9 -5
  116. package/helpers/find-offset-parent.d.ts +1 -2
  117. package/helpers/find-offset-parent.js +2 -2
  118. package/helpers/find-sibling-index.d.ts +11 -8
  119. package/helpers/find-sibling-index.js +8 -3
  120. package/helpers/fit-element-height.d.ts +5 -5
  121. package/helpers/fit-element-height.js +9 -7
  122. package/helpers/format-date.d.ts +11 -11
  123. package/helpers/format-date.js +15 -13
  124. package/helpers/format-number.d.ts +1 -1
  125. package/helpers/format-number.js +2 -2
  126. package/helpers/get-date-interval-data.d.ts +4 -1
  127. package/helpers/get-date-interval-data.js +7 -2
  128. package/helpers/get-declination.d.ts +5 -1
  129. package/helpers/get-declination.js +5 -0
  130. package/helpers/get-fraction-depth.d.ts +1 -1
  131. package/helpers/get-fraction-depth.js +2 -2
  132. package/helpers/get-no-index.d.ts +2 -2
  133. package/helpers/get-no-index.js +4 -3
  134. package/helpers/get-relative-pos.d.ts +4 -1
  135. package/helpers/get-relative-pos.js +7 -2
  136. package/helpers/get-scroll-parent.d.ts +1 -2
  137. package/helpers/get-scroll-parent.js +5 -5
  138. package/helpers/is-browser.d.ts +4 -1
  139. package/helpers/is-browser.js +8 -1
  140. package/helpers/is-fully-scrolled.d.ts +3 -3
  141. package/helpers/is-fully-scrolled.js +2 -2
  142. package/helpers/is-touch-device.d.ts +1 -1
  143. package/helpers/is-touch-device.js +4 -5
  144. package/helpers/layer.d.ts +1 -1
  145. package/helpers/layer.js +2 -2
  146. package/helpers/max-index-of.d.ts +4 -1
  147. package/helpers/max-index-of.js +7 -2
  148. package/helpers/media-query-list.d.ts +1 -1
  149. package/helpers/media-query-list.js +2 -2
  150. package/helpers/on.d.ts +4 -1
  151. package/helpers/on.js +7 -2
  152. package/helpers/point.d.ts +4 -1
  153. package/helpers/point.js +8 -1
  154. package/helpers/rename.d.ts +3 -1
  155. package/helpers/rename.js +1 -0
  156. package/helpers/scroll-to-child.d.ts +1 -1
  157. package/helpers/scroll-to-child.js +3 -2
  158. package/helpers/styles.d.ts +8 -2
  159. package/helpers/styles.js +18 -4
  160. package/helpers/with-prevent.d.ts +9 -6
  161. package/helpers/with-prevent.js +16 -9
  162. package/hint/hint-view.d.ts +26 -0
  163. package/hint/hint-view.js +43 -0
  164. package/hint/hint-view.module.scss +31 -0
  165. package/hint/hint.d.ts +14 -0
  166. package/hint/hint.js +41 -0
  167. package/hint/index.d.ts +5 -8
  168. package/hint/index.js +13 -48
  169. package/hint/utils.d.ts +61 -0
  170. package/hint/utils.js +161 -0
  171. package/{hint → hint-deprecated}/hint.module.scss +0 -0
  172. package/hint-deprecated/index.d.ts +11 -0
  173. package/hint-deprecated/index.js +53 -0
  174. package/hooks/breakpoint/index.d.ts +7 -4
  175. package/hooks/breakpoint/index.js +21 -13
  176. package/hooks/breakpoint/types.d.ts +3 -4
  177. package/hooks/breakpoint/utils.d.ts +2 -1
  178. package/hooks/breakpoint/utils.js +2 -1
  179. package/hooks/index.d.ts +8 -8
  180. package/hooks/index.js +27 -19
  181. package/hooks/intersection/test-utils.d.ts +1 -1
  182. package/hooks/intersection/test-utils.js +2 -1
  183. package/hooks/styles.d.ts +6 -0
  184. package/hooks/styles.js +26 -0
  185. package/info-text/index.d.ts +23 -0
  186. package/info-text/index.js +60 -0
  187. package/info-text/info-text.module.scss +28 -0
  188. package/input/index.d.ts +32 -0
  189. package/input/index.js +96 -0
  190. package/input/input.module.scss +20 -0
  191. package/input/utils.d.ts +36 -0
  192. package/input/utils.js +71 -0
  193. package/layout/index.d.ts +6 -11
  194. package/layout/index.js +6 -60
  195. package/layout/layout.d.ts +10 -0
  196. package/layout/layout.js +32 -0
  197. package/layout/layout.module.scss +33 -26
  198. package/layout/legacy.d.ts +15 -0
  199. package/layout/legacy.js +68 -0
  200. package/layout/legacy.module.scss +49 -0
  201. package/layout/types.d.ts +6 -0
  202. package/layout/types.js +2 -0
  203. package/link/index.d.ts +4 -1
  204. package/link/index.js +2 -2
  205. package/link/link.module.scss +10 -0
  206. package/loading-overlay/index.d.ts +1 -0
  207. package/loading-overlay/index.js +1 -0
  208. package/masked-field/index.d.ts +1 -0
  209. package/masked-field/index.js +1 -0
  210. package/masked-input/hook.d.ts +8 -0
  211. package/masked-input/hook.js +72 -0
  212. package/masked-input/index.d.ts +5 -0
  213. package/masked-input/index.js +7 -0
  214. package/masked-input/masked-input.d.ts +8 -0
  215. package/masked-input/masked-input.js +73 -0
  216. package/masked-input/types.d.ts +51 -0
  217. package/masked-input/types.js +2 -0
  218. package/masked-input/utils.d.ts +15 -0
  219. package/masked-input/utils.js +49 -0
  220. package/modal/index.d.ts +10 -12
  221. package/modal/index.js +27 -64
  222. package/modal/modal.module.scss +98 -55
  223. package/modal/slots.d.ts +13 -10
  224. package/modal/slots.js +30 -28
  225. package/modal/utils.d.ts +8 -10
  226. package/modal/utils.js +2 -26
  227. package/modal-overlay/index.d.ts +13 -0
  228. package/modal-overlay/index.js +60 -0
  229. package/modal-overlay/modal-overlay-util.scss +1 -0
  230. package/modal-overlay/modal-overlay.module.scss +14 -0
  231. package/modal-overlay/utils.d.ts +14 -0
  232. package/modal-overlay/utils.js +32 -0
  233. package/package.json +49 -41
  234. package/pagination/utils.d.ts +2 -2
  235. package/panel/index.d.ts +27 -13
  236. package/panel/index.js +43 -9
  237. package/panel/panel.module.scss +49 -8
  238. package/phone-input/index.d.ts +4 -28
  239. package/phone-input/index.js +2 -121
  240. package/phone-input/phone-input.d.ts +8 -0
  241. package/phone-input/phone-input.js +133 -0
  242. package/phone-input/phone-input.module.scss +8 -32
  243. package/phone-input/presets.d.ts +21 -22
  244. package/phone-input/presets.js +1 -2
  245. package/phone-input/types.d.ts +6 -0
  246. package/phone-input/types.js +2 -0
  247. package/phone-input/utils.d.ts +30 -1
  248. package/phone-input/utils.js +52 -3
  249. package/phone-input-deprecated/index.d.ts +29 -0
  250. package/phone-input-deprecated/index.js +124 -0
  251. package/phone-input-deprecated/phone-input.module.scss +41 -0
  252. package/plate/index.d.ts +3 -3
  253. package/plate/index.js +2 -2
  254. package/plate/plate.module.scss +3 -0
  255. package/popup/index.d.ts +5 -0
  256. package/popup/index.js +12 -0
  257. package/popup/popup-view.d.ts +14 -0
  258. package/popup/popup-view.js +35 -0
  259. package/popup/popup-view.module.scss +40 -0
  260. package/popup/popup.d.ts +17 -0
  261. package/popup/popup.js +73 -0
  262. package/popup/utils.d.ts +38 -0
  263. package/popup/utils.js +83 -0
  264. package/price/index.d.ts +1 -1
  265. package/price/index.js +3 -3
  266. package/price/utils.d.ts +5 -5
  267. package/price/utils.js +33 -23
  268. package/radio-button/index.d.ts +10 -0
  269. package/radio-button/index.js +33 -0
  270. package/radio-button/radio-button.module.scss +46 -0
  271. package/rating/index.d.ts +2 -1
  272. package/rating/types.d.ts +1 -1
  273. package/readme.md +34 -41
  274. package/screen/index.d.ts +4 -2
  275. package/screen/index.js +34 -3
  276. package/screen/screen.module.scss +0 -2
  277. package/screen/slots.d.ts +2 -8
  278. package/screen/slots.js +8 -9
  279. package/screen/utils.d.ts +2 -1
  280. package/select/index.d.ts +2 -33
  281. package/select/index.js +3 -109
  282. package/select/parts/block.d.ts +8 -0
  283. package/select/parts/block.js +70 -0
  284. package/select/parts/block.module.scss +3 -0
  285. package/select/parts/button.d.ts +8 -0
  286. package/select/parts/button.js +69 -0
  287. package/select/parts/menu.d.ts +8 -0
  288. package/select/parts/menu.js +105 -0
  289. package/select/parts/menu.module.scss +4 -0
  290. package/select/select.d.ts +14 -0
  291. package/select/select.js +145 -0
  292. package/select/types.d.ts +55 -0
  293. package/select/types.js +2 -0
  294. package/select/utils.d.ts +3 -0
  295. package/select/utils.js +13 -0
  296. package/select-deprecated/index.d.ts +34 -0
  297. package/select-deprecated/index.js +112 -0
  298. package/{select → select-deprecated}/select.module.scss +0 -0
  299. package/shadows.scss +18 -0
  300. package/side-page/index.d.ts +11 -26
  301. package/side-page/index.js +21 -26
  302. package/side-page/side-page.module.scss +35 -29
  303. package/side-page/slots.d.ts +12 -20
  304. package/side-page/slots.js +16 -28
  305. package/spinner/index.d.ts +18 -6
  306. package/spinner/index.js +25 -12
  307. package/spinner/spinner.module.scss +8 -0
  308. package/stepper/index.d.ts +18 -10
  309. package/stepper/index.js +17 -8
  310. package/stepper/stepper.module.scss +14 -15
  311. package/styling/fonts.d.ts +3 -3
  312. package/switcher-row/index.d.ts +42 -0
  313. package/switcher-row/index.js +59 -0
  314. package/switcher-row/switcher-row.module.scss +55 -0
  315. package/text/index.d.ts +1 -1
  316. package/text-button/index.d.ts +42 -0
  317. package/text-button/index.js +46 -0
  318. package/text-button/text-button.module.scss +99 -0
  319. package/text-field/index.d.ts +7 -6
  320. package/text-field/index.js +3 -2
  321. package/textarea/index.d.ts +21 -0
  322. package/textarea/index.js +85 -0
  323. package/textarea/textarea.module.scss +15 -0
  324. package/toggle/index.d.ts +3 -3
  325. package/toggle/toggle.module.scss +17 -8
  326. package/tooltip/index.d.ts +1 -0
  327. package/tooltip/index.js +1 -0
  328. package/top-bar/index.d.ts +3 -40
  329. package/top-bar/index.js +4 -60
  330. package/top-bar/top-bar-util.scss +29 -0
  331. package/top-bar/top-bar.d.ts +9 -0
  332. package/top-bar/top-bar.js +101 -0
  333. package/top-bar/top-bar.module.scss +129 -67
  334. package/top-bar/types.d.ts +31 -0
  335. package/top-bar/types.js +2 -0
  336. package/top-bar/utils.d.ts +14 -0
  337. package/top-bar/utils.js +56 -0
  338. package/touch-slider/index.d.ts +1 -0
  339. package/touch-slider/index.js +3 -2
  340. package/types.d.ts +18 -0
  341. package/types.js +2 -0
  342. package/unknown-content/index.d.ts +3 -3
  343. package/unknown-content/index.js +3 -3
  344. package/unknown-content/unknown-content.module.scss +16 -12
  345. package/upload-area/index.d.ts +2 -0
  346. package/upload-area/index.js +5 -0
  347. package/upload-area/types.d.ts +32 -0
  348. package/upload-area/types.js +2 -0
  349. package/upload-area/upload-area-util.scss +17 -0
  350. package/upload-area/upload-area.d.ts +8 -0
  351. package/upload-area/upload-area.js +105 -0
  352. package/upload-area/upload-area.module.scss +78 -0
  353. package/{upload → upload-area}/upload.svg +0 -0
  354. package/upload-area/utils.d.ts +17 -0
  355. package/upload-area/utils.js +48 -0
  356. package/utils.scss +74 -1
  357. package/with-hint/index.d.ts +3 -2
  358. package/with-hint/index.js +1 -0
  359. package/with-hint/positioning-hint.d.ts +1 -1
  360. package/with-hint/positioning-hint.js +2 -2
  361. package/with-tooltip/index.d.ts +2 -1
  362. package/with-tooltip/index.js +1 -0
  363. package/with-tooltip/utils.d.ts +2 -2
  364. package/_internal/body-scroll.d.ts +0 -23
  365. package/_internal/body-scroll.js +0 -41
  366. package/_internal/checkbox/index.d.ts +0 -5
  367. package/constants.d.ts +0 -6
  368. package/constants.js +0 -9
  369. package/nav-bar/index.d.ts +0 -46
  370. package/nav-bar/index.js +0 -76
  371. package/nav-bar/nav-bar.module.scss +0 -95
  372. package/upload/area.d.ts +0 -25
  373. package/upload/area.js +0 -65
  374. package/upload/area.module.scss +0 -44
  375. package/upload/utils.d.ts +0 -29
  376. package/upload/utils.js +0 -45
@@ -0,0 +1,130 @@
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
+ var __rest = (this && this.__rest) || function (s, e) {
26
+ var t = {};
27
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
28
+ t[p] = s[p];
29
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
30
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
31
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
32
+ t[p[i]] = s[p[i]];
33
+ }
34
+ return t;
35
+ };
36
+ var __importDefault = (this && this.__importDefault) || function (mod) {
37
+ return (mod && mod.__esModule) ? mod : { "default": mod };
38
+ };
39
+ Object.defineProperty(exports, "__esModule", { value: true });
40
+ exports.Autocomplete = void 0;
41
+ const react_1 = __importStar(require("react"));
42
+ const dropdown_1 = require("../dropdown");
43
+ const dropdown_item_1 = require("../dropdown-item");
44
+ const text_field_1 = require("../text-field");
45
+ const dropdown_2 = require("../_internal/utils/dropdown");
46
+ const down_1 = __importDefault(require("@sima-land/ui-quarks/icons/16x16/Stroked/Arrows/down"));
47
+ const up_1 = __importDefault(require("@sima-land/ui-quarks/icons/16x16/Stroked/Arrows/up"));
48
+ const dropdown_loading_1 = require("../_internal/dropdown-loading");
49
+ const bind_1 = __importDefault(require("classnames/bind"));
50
+ const autocomplete_module_scss_1 = __importDefault(require("./autocomplete.module.scss"));
51
+ const cx = bind_1.default.bind(autocomplete_module_scss_1.default);
52
+ /**
53
+ * Поле ввода с подсказками.
54
+ * @deprecated Нужно использовать новую реализацию "@sima-land/ui-nucleons/autocomplete".
55
+ * @param props Свойства.
56
+ * @return Элемент.
57
+ */
58
+ const Autocomplete = (_a) => {
59
+ var { items, itemSize, onSelect, onChange, onKeyDown, style, className, value, defaultValue, loading, renderItem = String, preset = 'default', 'data-testid': dataTestId } = _a, restProps = __rest(_a, ["items", "itemSize", "onSelect", "onChange", "onKeyDown", "style", "className", "value", "defaultValue", "loading", "renderItem", "preset", 'data-testid']);
60
+ const osComponentRef = (0, react_1.useRef)(null);
61
+ const fieldRef = (0, react_1.useRef)(null);
62
+ const menuRef = (0, react_1.useRef)(null);
63
+ const [withMenu, toggleMenu] = (0, react_1.useState)(false);
64
+ const [realValue, setRealValue] = (0, react_1.useState)(value || defaultValue);
65
+ const [activeIndex, setActiveIndex] = (0, react_1.useState)(null);
66
+ const needMenu = preset === 'filled-only-list' ? withMenu && realValue && realValue.length > 0 : withMenu;
67
+ const arrowIcon = needMenu ? (react_1.default.createElement(up_1.default, { className: cx('arrow'), "data-testid": 'autocomplete:arrow-up' })) : (react_1.default.createElement(down_1.default, { className: cx('arrow'), "data-testid": 'autocomplete:arrow-down' }));
68
+ const endAdornment = preset === 'default' ? arrowIcon : undefined;
69
+ (0, react_1.useEffect)(() => {
70
+ setRealValue(value);
71
+ }, [value]);
72
+ (0, react_1.useEffect)(() => {
73
+ setActiveIndex(null);
74
+ }, [items]);
75
+ (0, react_1.useEffect)(() => {
76
+ var _a;
77
+ const menu = menuRef.current;
78
+ const osInstance = (_a = osComponentRef.current) === null || _a === void 0 ? void 0 : _a.osInstance();
79
+ if (menu && osInstance && activeIndex !== null) {
80
+ const child = menu.querySelectorAll('[role="menuitem"]')[activeIndex];
81
+ child instanceof HTMLElement &&
82
+ osInstance.scroll({
83
+ el: child,
84
+ scroll: { y: 'ifneeded' },
85
+ });
86
+ }
87
+ }, [activeIndex]);
88
+ return (react_1.default.createElement("div", { style: style, className: cx('root', className), "data-testid": dataTestId },
89
+ react_1.default.createElement(text_field_1.TextField, Object.assign({}, restProps, { ref: fieldRef, focused: withMenu, endAdornment: endAdornment, "data-testid": 'autocomplete:field', variant: 'desktop', value: realValue, multiline: false, className: cx('field'), onFocus: () => {
90
+ toggleMenu(true);
91
+ setActiveIndex(null);
92
+ }, onBlur: () => {
93
+ toggleMenu(false);
94
+ }, onChange: (event) => {
95
+ setRealValue(event.target.value);
96
+ setActiveIndex(0);
97
+ onChange === null || onChange === void 0 ? void 0 : onChange(event);
98
+ }, onKeyDown: (event) => {
99
+ const size = (items === null || items === void 0 ? void 0 : items.length) || 0;
100
+ let nextIndex;
101
+ switch (event.key) {
102
+ case 'ArrowDown':
103
+ nextIndex = (activeIndex !== null ? size + activeIndex + 1 : 0) % size;
104
+ break;
105
+ case 'ArrowUp':
106
+ nextIndex = (size + Number(activeIndex) - 1) % size;
107
+ break;
108
+ case 'Enter':
109
+ if (items && activeIndex !== null && items.length > activeIndex) {
110
+ onSelect && onSelect(items[activeIndex]);
111
+ toggleMenu(false);
112
+ }
113
+ break;
114
+ }
115
+ if (typeof nextIndex === 'number') {
116
+ event.preventDefault(); // не даём каретке в поле перемещаться
117
+ setActiveIndex(nextIndex);
118
+ }
119
+ onKeyDown === null || onKeyDown === void 0 ? void 0 : onKeyDown(event);
120
+ } })),
121
+ needMenu && (react_1.default.createElement(dropdown_1.Dropdown, Object.assign({}, (0, dropdown_2.placeDropdown)(restProps.size), { ref: menuRef, "data-testid": 'autocomplete:menu', className: cx('menu'), role: 'menu', customScrollbarProps: { osComponentRef } }), loading ? (react_1.default.createElement(dropdown_loading_1.DropdownLoading, { "data-testid": 'autocomplete:loading-area' })) : (react_1.default.createElement(react_1.default.Fragment, null, items && items.length > 0 ? (items.map((item, index) => (react_1.default.createElement(dropdown_item_1.DropdownItem, { size: itemSize, key: index, role: 'menuitem', checked: index === activeIndex, onMouseDown: event => {
122
+ // чтобы при нажатии на опцию предотвратить blur на поле
123
+ event.preventDefault();
124
+ }, onClick: () => {
125
+ onSelect === null || onSelect === void 0 ? void 0 : onSelect(item);
126
+ setActiveIndex(null);
127
+ toggleMenu(false);
128
+ } }, renderItem(item))))) : (react_1.default.createElement(dropdown_item_1.DropdownItem, { size: 'm', noHover: true }, "\u041D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u043E"))))))));
129
+ };
130
+ exports.Autocomplete = Autocomplete;
package/avatar/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import { CSSProperties } from 'react';
2
2
  import { Token } from '../colors';
3
3
  export interface AvatarProps {
4
4
  /** Цвет аватара без картинки. */
@@ -14,7 +14,7 @@ export interface AvatarProps {
14
14
  /** Размер аватара. */
15
15
  size?: number;
16
16
  /** Стиль элементов rect/image, формирующего маску "super ellipse". */
17
- style?: React.CSSProperties;
17
+ style?: CSSProperties;
18
18
  /** Цвет текста без картинки. */
19
19
  textColor?: Token;
20
20
  /** Текст без картинки. */
package/avatar/user.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import { AvatarProps } from '.';
3
- export declare type UserAvatarProps = Omit<AvatarProps, 'bgColor' | 'bgOpacity' | 'textColor'>;
3
+ export type UserAvatarProps = Omit<AvatarProps, 'bgColor' | 'bgOpacity' | 'textColor'>;
4
4
  export declare const colorKey: unique symbol;
5
5
  /**
6
6
  * Компонент аватара пользователя (не сотрудника).
@@ -0,0 +1,11 @@
1
+ /// <reference types="react" />
2
+ import { BaseInputProps } from './types';
3
+ /**
4
+ * Поле ввода текста.
5
+ * Позволяет выводить "остаточный placeholder".
6
+ * Может выводиться в однострочном и многострочном режимах.
7
+ * В многострочном режиме автоматически подстраивает высоту под введенный текст.
8
+ * @param props Свойства.
9
+ * @return Элемент.
10
+ */
11
+ export declare function BaseInput({ inputRef, textareaRef, style, className, restPlaceholder: restPlaceholderProp, 'data-testid': testId, ...props }: BaseInputProps): JSX.Element;
@@ -0,0 +1,96 @@
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
+ var __rest = (this && this.__rest) || function (s, e) {
26
+ var t = {};
27
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
28
+ t[p] = s[p];
29
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
30
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
31
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
32
+ t[p[i]] = s[p[i]];
33
+ }
34
+ return t;
35
+ };
36
+ var __importDefault = (this && this.__importDefault) || function (mod) {
37
+ return (mod && mod.__esModule) ? mod : { "default": mod };
38
+ };
39
+ Object.defineProperty(exports, "__esModule", { value: true });
40
+ exports.BaseInput = void 0;
41
+ const react_1 = __importStar(require("react"));
42
+ const fit_element_height_1 = require("../helpers/fit-element-height");
43
+ const hooks_1 = require("../hooks");
44
+ const utils_1 = require("./utils");
45
+ const bind_1 = __importDefault(require("classnames/bind"));
46
+ const base_input_module_scss_1 = __importDefault(require("./base-input.module.scss"));
47
+ const cx = bind_1.default.bind(base_input_module_scss_1.default);
48
+ /**
49
+ * Поле ввода текста.
50
+ * Позволяет выводить "остаточный placeholder".
51
+ * Может выводиться в однострочном и многострочном режимах.
52
+ * В многострочном режиме автоматически подстраивает высоту под введенный текст.
53
+ * @param props Свойства.
54
+ * @return Элемент.
55
+ */
56
+ function BaseInput(_a) {
57
+ var _b;
58
+ var { inputRef, textareaRef, style, className, restPlaceholder: restPlaceholderProp, 'data-testid': testId = 'base-input' } = _a, props = __rest(_a, ["inputRef", "textareaRef", "style", "className", "restPlaceholder", 'data-testid']);
59
+ const textareaInnerRef = (0, react_1.useRef)(null);
60
+ const inputInnerRef = (0, react_1.useRef)(null);
61
+ (0, react_1.useImperativeHandle)(textareaRef, () => textareaInnerRef.current);
62
+ (0, react_1.useImperativeHandle)(inputRef, () => inputInnerRef.current);
63
+ (0, hooks_1.useIsomorphicLayoutEffect)(() => {
64
+ // ВАЖНО: после каждого render'а подгоняем высоту многострочного поля под содержимое
65
+ if (textareaInnerRef.current) {
66
+ (0, fit_element_height_1.fitElementHeight)({ target: textareaInnerRef.current });
67
+ }
68
+ });
69
+ let field;
70
+ if (props.multiline) {
71
+ field = (react_1.default.createElement("textarea", Object.assign({}, (0, utils_1.omitMultiline)(props), { ref: textareaInnerRef, rows: (_b = props.rows) !== null && _b !== void 0 ? _b : 1, "data-testid": 'base-input:field' // ВАЖНО: не даем переопределить data-test-id
72
+ , className: cx('field', 'reset', 'multiline'), onInput: e => {
73
+ var _a;
74
+ (_a = props.onInput) === null || _a === void 0 ? void 0 : _a.call(props, e);
75
+ (0, fit_element_height_1.fitElementHeight)({ target: e.currentTarget });
76
+ } })));
77
+ }
78
+ else {
79
+ field = (react_1.default.createElement("input", Object.assign({}, (0, utils_1.omitMultiline)(props), { ref: inputInnerRef, "data-testid": 'base-input:field' // ВАЖНО: не даем переопределить data-test-id
80
+ , className: cx('field', 'reset') })));
81
+ }
82
+ let restPlaceholder = null;
83
+ // скрываем rest placeholder для неконтролируемых полей
84
+ if (typeof props.value !== 'undefined') {
85
+ restPlaceholder =
86
+ typeof restPlaceholderProp === 'string'
87
+ ? { shiftValue: String(props.value), value: restPlaceholderProp }
88
+ : Object.assign({ shiftValue: String(props.value), value: '' }, restPlaceholderProp);
89
+ }
90
+ return (react_1.default.createElement("div", { style: style, className: cx('reset', 'root', className), "data-testid": testId },
91
+ !props.multiline && restPlaceholder && restPlaceholder.value && (react_1.default.createElement("span", { "aria-hidden": true, className: cx('rest-placeholder') },
92
+ react_1.default.createElement("span", { "data-testid": 'rest-placeholder-shift', className: cx('shift-part') }, restPlaceholder.shiftValue),
93
+ react_1.default.createElement("span", { "data-testid": 'rest-placeholder', className: cx('main-part') }, restPlaceholder.value))),
94
+ field));
95
+ }
96
+ exports.BaseInput = BaseInput;
@@ -44,7 +44,7 @@
44
44
  }
45
45
  }
46
46
 
47
- .fake-text {
47
+ .rest-placeholder {
48
48
  pointer-events: none;
49
49
  position: absolute;
50
50
  top: 0;
@@ -57,10 +57,10 @@
57
57
  line-height: inherit;
58
58
  overflow: hidden;
59
59
  z-index: 0;
60
- .invisible-value {
60
+ .shift-part {
61
61
  color: transparent;
62
62
  }
63
- .placeholder {
63
+ .main-part {
64
64
  color: var(--placeholder-color);
65
65
  }
66
66
  }
@@ -1,23 +1,2 @@
1
- import React from 'react';
2
- interface RestPlaceholder {
3
- value: string;
4
- shiftValue?: string;
5
- }
6
- interface BaseInputStyle extends React.CSSProperties {
7
- '--placeholder-color'?: string;
8
- }
9
- export interface CustomProps {
10
- multiline?: boolean;
11
- /** Остаточный placeholder (выводится после введенного значения). */
12
- restPlaceholder?: string | RestPlaceholder;
13
- /** Стили. */
14
- style?: BaseInputStyle;
15
- }
16
- export declare type BaseInputProps = CustomProps & React.TextareaHTMLAttributes<HTMLTextAreaElement> & React.InputHTMLAttributes<HTMLInputElement>;
17
- /**
18
- * Компонент поля ввода.
19
- * @param props Свойства. Поддерживаются свойства элемента input.
20
- * @return Элемент.
21
- */
22
- export declare const BaseInput: React.ForwardRefExoticComponent<CustomProps & React.TextareaHTMLAttributes<HTMLTextAreaElement> & React.InputHTMLAttributes<HTMLInputElement> & React.RefAttributes<HTMLInputElement | HTMLTextAreaElement | undefined>>;
23
- export {};
1
+ export type { RestPlaceholderDefinition, BaseInputAsInputProps, BaseInputAsTextareaProps, BaseInputProps, BaseInputStyle, } from './types';
2
+ export { BaseInput } from './base-input';
@@ -1,79 +1,5 @@
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
- var __rest = (this && this.__rest) || function (s, e) {
26
- var t = {};
27
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
28
- t[p] = s[p];
29
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
30
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
31
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
32
- t[p[i]] = s[p[i]];
33
- }
34
- return t;
35
- };
36
- var __importDefault = (this && this.__importDefault) || function (mod) {
37
- return (mod && mod.__esModule) ? mod : { "default": mod };
38
- };
39
2
  Object.defineProperty(exports, "__esModule", { value: true });
40
3
  exports.BaseInput = void 0;
41
- const react_1 = __importStar(require("react"));
42
- const fit_element_height_1 = require("../helpers/fit-element-height");
43
- const bind_1 = __importDefault(require("classnames/bind"));
44
- const base_input_module_scss_1 = __importDefault(require("./base-input.module.scss"));
45
- const cx = bind_1.default.bind(base_input_module_scss_1.default);
46
- /**
47
- * Компонент поля ввода.
48
- * @param props Свойства. Поддерживаются свойства элемента input.
49
- * @return Элемент.
50
- */
51
- exports.BaseInput = (0, react_1.forwardRef)(function BaseInput(_a, ref) {
52
- var { className, disabled, multiline, onInput, restPlaceholder: restPlaceholderProp, rows = 1, style, value } = _a, props = __rest(_a, ["className", "disabled", "multiline", "onInput", "restPlaceholder", "rows", "style", "value"]);
53
- const Element = multiline
54
- ? 'textarea'
55
- : 'input';
56
- const inputRef = (0, react_1.useRef)();
57
- (0, react_1.useImperativeHandle)(ref, () => inputRef.current);
58
- // при каждом рендере подгоняем высоту поля под содержимое
59
- (0, react_1.useEffect)(() => {
60
- multiline &&
61
- inputRef.current &&
62
- (0, fit_element_height_1.fitElementHeight)({
63
- target: inputRef.current,
64
- });
65
- });
66
- const restPlaceholder = typeof restPlaceholderProp === 'string'
67
- ? { shiftValue: value, value: restPlaceholderProp }
68
- : Object.assign({ shiftValue: value }, restPlaceholderProp);
69
- return (react_1.default.createElement("div", { style: style, className: cx('reset', 'root', disabled && 'disabled', className) },
70
- !multiline && Boolean(restPlaceholder.value) && (react_1.default.createElement("span", { "aria-hidden": true, className: cx('fake-text') },
71
- react_1.default.createElement("span", { className: cx('invisible-value') }, restPlaceholder.shiftValue),
72
- react_1.default.createElement("span", { className: cx('placeholder') }, restPlaceholder.value))),
73
- react_1.default.createElement(Element, Object.assign({}, props, { rows: multiline ? rows : undefined, ref: inputRef, disabled: disabled,
74
- // ВАЖНО: не даем возможности задать стили/классы именно для этого элемента
75
- className: cx('field', 'reset', multiline && 'multiline'), value: value, onInput: (event) => {
76
- multiline && (0, fit_element_height_1.fitElementHeight)(event);
77
- onInput === null || onInput === void 0 ? void 0 : onInput(event);
78
- } }))));
79
- });
4
+ var base_input_1 = require("./base-input");
5
+ Object.defineProperty(exports, "BaseInput", { enumerable: true, get: function () { return base_input_1.BaseInput; } });
@@ -0,0 +1,31 @@
1
+ import { InputHTMLAttributes, Ref, TextareaHTMLAttributes } from 'react';
2
+ export interface RestPlaceholderDefinition {
3
+ /** Текст placeholder'а. */
4
+ value: string;
5
+ /** Значение, смещающее placeholder. По умолчанию используется значение в поле ввода. */
6
+ shiftValue?: string;
7
+ }
8
+ export interface BaseInputStyle extends React.CSSProperties {
9
+ '--placeholder-color'?: string;
10
+ }
11
+ export interface CommonProps {
12
+ /** Остаточный placeholder (выводится после введенного значения). */
13
+ restPlaceholder?: string | RestPlaceholderDefinition;
14
+ /** Стили корневого элемента. */
15
+ style?: BaseInputStyle;
16
+ /** CSS-класс корневого элемента. */
17
+ className?: string;
18
+ /** Ref элемента input. Будет заполнен только при multiline=false. */
19
+ inputRef?: Ref<HTMLInputElement | null>;
20
+ /** Ref элемента textarea. Будет заполнен только при multiline=true. */
21
+ textareaRef?: Ref<HTMLTextAreaElement | null>;
22
+ /** Идентификатор для систем автоматизированного тестирования. */
23
+ 'data-testid'?: string;
24
+ }
25
+ export type BaseInputAsInputProps = CommonProps & Omit<InputHTMLAttributes<HTMLInputElement>, keyof CommonProps> & {
26
+ multiline?: false;
27
+ };
28
+ export type BaseInputAsTextareaProps = CommonProps & Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, keyof CommonProps> & {
29
+ multiline: true;
30
+ };
31
+ export type BaseInputProps = BaseInputAsInputProps | BaseInputAsTextareaProps;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Получив объект, вернет его копию но без свойства multiline.
3
+ * @param source Объект.
4
+ * @return Копия без свойства multiline.
5
+ */
6
+ export declare function omitMultiline<T extends Record<string, any>>(source: T): Omit<T, 'multiline'>;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.omitMultiline = void 0;
4
+ /**
5
+ * Получив объект, вернет его копию но без свойства multiline.
6
+ * @param source Объект.
7
+ * @return Копия без свойства multiline.
8
+ */
9
+ function omitMultiline(source) {
10
+ const next = Object.assign({}, source);
11
+ delete next.multiline;
12
+ return next;
13
+ }
14
+ exports.omitMultiline = omitMultiline;
@@ -0,0 +1,66 @@
1
+ @use '../utils';
2
+
3
+ .reset {
4
+ border: 0;
5
+ box-sizing: border-box;
6
+ font: inherit;
7
+ margin: 0;
8
+ outline: 0;
9
+ padding: 0;
10
+ }
11
+
12
+ .root {
13
+ position: relative;
14
+ background-color: transparent;
15
+ width: 0;
16
+ flex-grow: 1;
17
+ display: flex;
18
+ overflow: hidden;
19
+ }
20
+
21
+ .field {
22
+ width: 0;
23
+ flex-grow: 1;
24
+ display: block;
25
+ color: inherit;
26
+ font-size: inherit;
27
+ line-height: inherit;
28
+ z-index: 1;
29
+ text-overflow: inherit;
30
+ background: inherit;
31
+ &::placeholder {
32
+ opacity: 1;
33
+ color: var(--placeholder-color);
34
+ }
35
+ &::-ms-clear {
36
+ // отключаем системный крестик в IE
37
+ display: none;
38
+ height: 0;
39
+ width: 0;
40
+ }
41
+ &.multiline {
42
+ resize: none;
43
+ @include utils.hidden-scrollbars;
44
+ }
45
+ }
46
+
47
+ .fake-text {
48
+ pointer-events: none;
49
+ position: absolute;
50
+ top: 0;
51
+ right: 0;
52
+ bottom: 0;
53
+ left: 0;
54
+ padding: inherit;
55
+ font-family: inherit;
56
+ font-size: inherit;
57
+ line-height: inherit;
58
+ overflow: hidden;
59
+ z-index: 0;
60
+ .invisible-value {
61
+ color: transparent;
62
+ }
63
+ .placeholder {
64
+ color: var(--placeholder-color);
65
+ }
66
+ }
@@ -0,0 +1,24 @@
1
+ import React from 'react';
2
+ interface RestPlaceholder {
3
+ value: string;
4
+ shiftValue?: string;
5
+ }
6
+ interface BaseInputStyle extends React.CSSProperties {
7
+ '--placeholder-color'?: string;
8
+ }
9
+ export interface CustomProps {
10
+ multiline?: boolean;
11
+ /** Остаточный placeholder (выводится после введенного значения). */
12
+ restPlaceholder?: string | RestPlaceholder;
13
+ /** Стили. */
14
+ style?: BaseInputStyle;
15
+ }
16
+ export type BaseInputProps = CustomProps & React.TextareaHTMLAttributes<HTMLTextAreaElement> & React.InputHTMLAttributes<HTMLInputElement>;
17
+ /**
18
+ * Компонент поля ввода.
19
+ * @deprecated Нужно использовать новую реализацию "@sima-land/ui-nucleons/base-input".
20
+ * @param props Свойства. Поддерживаются свойства элемента input.
21
+ * @return Элемент.
22
+ */
23
+ export declare const BaseInput: React.ForwardRefExoticComponent<CustomProps & React.TextareaHTMLAttributes<HTMLTextAreaElement> & React.InputHTMLAttributes<HTMLInputElement> & React.RefAttributes<HTMLInputElement | HTMLTextAreaElement | undefined>>;
24
+ export {};
@@ -0,0 +1,80 @@
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
+ var __rest = (this && this.__rest) || function (s, e) {
26
+ var t = {};
27
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
28
+ t[p] = s[p];
29
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
30
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
31
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
32
+ t[p[i]] = s[p[i]];
33
+ }
34
+ return t;
35
+ };
36
+ var __importDefault = (this && this.__importDefault) || function (mod) {
37
+ return (mod && mod.__esModule) ? mod : { "default": mod };
38
+ };
39
+ Object.defineProperty(exports, "__esModule", { value: true });
40
+ exports.BaseInput = void 0;
41
+ const react_1 = __importStar(require("react"));
42
+ const fit_element_height_1 = require("../helpers/fit-element-height");
43
+ const bind_1 = __importDefault(require("classnames/bind"));
44
+ const base_input_module_scss_1 = __importDefault(require("./base-input.module.scss"));
45
+ const cx = bind_1.default.bind(base_input_module_scss_1.default);
46
+ /**
47
+ * Компонент поля ввода.
48
+ * @deprecated Нужно использовать новую реализацию "@sima-land/ui-nucleons/base-input".
49
+ * @param props Свойства. Поддерживаются свойства элемента input.
50
+ * @return Элемент.
51
+ */
52
+ exports.BaseInput = (0, react_1.forwardRef)(function BaseInput(_a, ref) {
53
+ var { className, disabled, multiline, onInput, restPlaceholder: restPlaceholderProp, rows = 1, style, value } = _a, props = __rest(_a, ["className", "disabled", "multiline", "onInput", "restPlaceholder", "rows", "style", "value"]);
54
+ const Element = multiline
55
+ ? 'textarea'
56
+ : 'input';
57
+ const inputRef = (0, react_1.useRef)();
58
+ (0, react_1.useImperativeHandle)(ref, () => inputRef.current);
59
+ // при каждом рендере подгоняем высоту поля под содержимое
60
+ (0, react_1.useEffect)(() => {
61
+ multiline &&
62
+ inputRef.current &&
63
+ (0, fit_element_height_1.fitElementHeight)({
64
+ target: inputRef.current,
65
+ });
66
+ });
67
+ const restPlaceholder = typeof restPlaceholderProp === 'string'
68
+ ? { shiftValue: value, value: restPlaceholderProp }
69
+ : Object.assign({ shiftValue: value }, restPlaceholderProp);
70
+ return (react_1.default.createElement("div", { "data-testid": 'base-input:root', style: style, className: cx('reset', 'root', disabled && 'disabled', className) },
71
+ !multiline && Boolean(restPlaceholder.value) && (react_1.default.createElement("span", { "aria-hidden": true, className: cx('fake-text') },
72
+ react_1.default.createElement("span", { className: cx('invisible-value') }, restPlaceholder.shiftValue),
73
+ react_1.default.createElement("span", { className: cx('placeholder') }, restPlaceholder.value))),
74
+ react_1.default.createElement(Element, Object.assign({ "data-testid": 'base-input:field' }, props, { rows: multiline ? rows : undefined, ref: inputRef, disabled: disabled,
75
+ // ВАЖНО: не даем возможности задать стили/классы именно для этого элемента
76
+ className: cx('field', 'reset', multiline && 'multiline'), value: value, onInput: (event) => {
77
+ multiline && (0, fit_element_height_1.fitElementHeight)(event);
78
+ onInput === null || onInput === void 0 ? void 0 : onInput(event);
79
+ } }))));
80
+ });
@@ -9,6 +9,7 @@ export interface BorderedLayoutProps {
9
9
  }
10
10
  /**
11
11
  * Выводит содержимое по мобильному layout'у с вертикальными полосками.
12
+ * @deprecated Можно использовать комбинацию Layout, пример есть в Storybook.
12
13
  * @param props Свойства компонента.
13
14
  * @return Элемент.
14
15
  */
@@ -12,6 +12,7 @@ const bordered_layout_module_scss_1 = __importDefault(require("./bordered-layout
12
12
  const cx = bind_1.default.bind(bordered_layout_module_scss_1.default);
13
13
  /**
14
14
  * Выводит содержимое по мобильному layout'у с вертикальными полосками.
15
+ * @deprecated Можно использовать комбинацию Layout, пример есть в Storybook.
15
16
  * @param props Свойства компонента.
16
17
  * @return Элемент.
17
18
  */