@alfalab/core-components-select 15.3.0 → 16.0.1

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 (301) hide show
  1. package/Component.desktop.d.ts +3 -15
  2. package/Component.desktop.js +4 -2
  3. package/Component.mobile.d.ts +3 -39
  4. package/Component.mobile.js +23 -10
  5. package/Component.modal.mobile.d.ts +2 -256
  6. package/Component.modal.mobile.js +23 -35
  7. package/Component.responsive.d.ts +3 -17
  8. package/Component.responsive.js +11 -13
  9. package/components/arrow/Component.js +1 -1
  10. package/components/arrow/index.css +5 -5
  11. package/components/base-checkmark/Component.js +1 -1
  12. package/components/base-checkmark/index.css +4 -4
  13. package/components/base-option/Component.js +1 -1
  14. package/components/base-option/index.css +16 -16
  15. package/components/base-select/Component.d.ts +17 -2
  16. package/components/base-select/Component.js +188 -81
  17. package/components/base-select/index.css +12 -12
  18. package/components/base-select/index.js +1 -1
  19. package/{esm/components/base-select-mobile/index.css → components/base-select/mobile.css} +13 -22
  20. package/components/checkmark/Component.js +1 -1
  21. package/components/checkmark/index.css +11 -11
  22. package/components/checkmark-mobile/Component.js +1 -1
  23. package/components/checkmark-mobile/index.css +6 -6
  24. package/components/field/Component.js +1 -1
  25. package/components/field/index.css +15 -17
  26. package/components/footer/Component.d.ts +12 -0
  27. package/components/{base-select-mobile/footer → footer}/Component.js +6 -5
  28. package/components/{base-select-mobile/footer → footer}/index.css +6 -6
  29. package/components/footer/index.d.ts +1 -0
  30. package/components/{base-select-mobile/footer → footer}/index.js +3 -2
  31. package/components/index.js +2 -1
  32. package/components/optgroup/Component.js +1 -1
  33. package/components/optgroup/index.css +7 -7
  34. package/components/option/Component.js +1 -1
  35. package/components/option/index.css +24 -24
  36. package/components/options-list/Component.js +7 -3
  37. package/components/options-list/index.css +11 -11
  38. package/components/options-list/index.js +2 -1
  39. package/components/search/Component.d.ts +2 -4
  40. package/components/search/Component.js +1 -1
  41. package/components/search/index.css +2 -2
  42. package/components/virtual-options-list/Component.js +7 -3
  43. package/components/virtual-options-list/index.css +18 -18
  44. package/components/virtual-options-list/index.js +2 -1
  45. package/cssm/Component.desktop.d.ts +3 -15
  46. package/cssm/Component.desktop.js +5 -2
  47. package/cssm/Component.mobile.d.ts +3 -39
  48. package/cssm/Component.mobile.js +27 -13
  49. package/cssm/Component.modal.mobile.d.ts +2 -256
  50. package/cssm/Component.modal.mobile.js +28 -39
  51. package/cssm/Component.responsive.d.ts +3 -17
  52. package/cssm/Component.responsive.js +13 -15
  53. package/cssm/components/arrow/index.module.css +2 -2
  54. package/cssm/components/base-option/index.module.css +3 -3
  55. package/cssm/components/base-select/Component.d.ts +17 -2
  56. package/cssm/components/base-select/Component.js +186 -80
  57. package/cssm/components/base-select/index.js +2 -1
  58. package/cssm/components/base-select/index.module.css +2 -2
  59. package/cssm/components/{base-select-mobile/index.module.css → base-select/mobile.module.css} +0 -9
  60. package/cssm/components/checkmark/index.module.css +1 -1
  61. package/cssm/components/field/index.module.css +3 -5
  62. package/cssm/components/footer/Component.d.ts +12 -0
  63. package/cssm/components/{base-select-mobile/footer → footer}/Component.js +5 -4
  64. package/cssm/components/footer/index.d.ts +1 -0
  65. package/cssm/components/{base-select-mobile/footer → footer}/index.js +3 -2
  66. package/cssm/components/{base-select-mobile/footer → footer}/index.module.css +1 -1
  67. package/cssm/components/index.js +3 -1
  68. package/cssm/components/optgroup/index.module.css +1 -1
  69. package/cssm/components/option/index.module.css +4 -4
  70. package/cssm/components/options-list/Component.js +6 -2
  71. package/cssm/components/options-list/index.js +2 -1
  72. package/cssm/components/options-list/index.module.css +2 -2
  73. package/cssm/components/search/Component.d.ts +2 -4
  74. package/cssm/components/virtual-options-list/Component.js +6 -2
  75. package/cssm/components/virtual-options-list/index.js +2 -1
  76. package/cssm/components/virtual-options-list/index.module.css +3 -3
  77. package/cssm/desktop/index.d.ts +2 -2
  78. package/cssm/desktop/index.js +4 -1
  79. package/cssm/{hook-244c8d6e.js → hook-2f9ec939.js} +9 -5
  80. package/{esm/hook-8abfea97.d.ts → cssm/hook-ad89c253.d.ts} +3 -2
  81. package/cssm/index.d.ts +2 -2
  82. package/cssm/index.js +10 -9
  83. package/cssm/mobile/index.d.ts +1 -3
  84. package/cssm/mobile/index.js +15 -10
  85. package/cssm/presets/index.d.ts +1 -1
  86. package/cssm/presets/index.js +3 -2
  87. package/cssm/presets/useSelectWithApply/hook.js +3 -2
  88. package/cssm/presets/useSelectWithApply/options-list-with-apply/Component.js +3 -2
  89. package/cssm/presets/useSelectWithApply/options-list-with-apply/index.d.ts +1 -1
  90. package/cssm/presets/useSelectWithApply/options-list-with-apply/index.js +3 -2
  91. package/cssm/shared/index.d.ts +9 -2
  92. package/cssm/shared/index.js +50 -48
  93. package/cssm/typings.d.ts +86 -7
  94. package/desktop/index.d.ts +2 -2
  95. package/desktop/index.js +3 -1
  96. package/esm/Component.desktop.d.ts +3 -15
  97. package/esm/Component.desktop.js +4 -2
  98. package/esm/Component.mobile.d.ts +3 -39
  99. package/esm/Component.mobile.js +22 -9
  100. package/esm/Component.modal.mobile.d.ts +2 -256
  101. package/esm/Component.modal.mobile.js +24 -36
  102. package/esm/Component.responsive.d.ts +3 -17
  103. package/esm/Component.responsive.js +11 -13
  104. package/esm/components/arrow/Component.js +1 -1
  105. package/esm/components/arrow/index.css +5 -5
  106. package/esm/components/base-checkmark/Component.js +1 -1
  107. package/esm/components/base-checkmark/index.css +4 -4
  108. package/esm/components/base-option/Component.js +1 -1
  109. package/esm/components/base-option/index.css +16 -16
  110. package/esm/components/base-select/Component.d.ts +17 -2
  111. package/esm/components/base-select/Component.js +190 -83
  112. package/esm/components/base-select/index.css +12 -12
  113. package/esm/components/base-select/index.js +1 -1
  114. package/{modern/components/base-select-mobile/index.css → esm/components/base-select/mobile.css} +13 -22
  115. package/esm/components/checkmark/Component.js +1 -1
  116. package/esm/components/checkmark/index.css +11 -11
  117. package/esm/components/checkmark-mobile/Component.js +1 -1
  118. package/esm/components/checkmark-mobile/index.css +6 -6
  119. package/esm/components/field/Component.js +1 -1
  120. package/esm/components/field/index.css +15 -17
  121. package/esm/components/footer/Component.d.ts +12 -0
  122. package/esm/components/{base-select-mobile/footer → footer}/Component.js +6 -5
  123. package/esm/components/{base-select-mobile/footer → footer}/index.css +6 -6
  124. package/esm/components/footer/index.d.ts +1 -0
  125. package/esm/components/{base-select-mobile/footer → footer}/index.js +1 -0
  126. package/esm/components/index.js +2 -1
  127. package/esm/components/optgroup/Component.js +1 -1
  128. package/esm/components/optgroup/index.css +7 -7
  129. package/esm/components/option/Component.js +1 -1
  130. package/esm/components/option/index.css +24 -24
  131. package/esm/components/options-list/Component.js +7 -3
  132. package/esm/components/options-list/index.css +11 -11
  133. package/esm/components/options-list/index.js +2 -1
  134. package/esm/components/search/Component.d.ts +2 -4
  135. package/esm/components/search/Component.js +1 -1
  136. package/esm/components/search/index.css +2 -2
  137. package/esm/components/virtual-options-list/Component.js +7 -3
  138. package/esm/components/virtual-options-list/index.css +18 -18
  139. package/esm/components/virtual-options-list/index.js +2 -1
  140. package/esm/desktop/index.d.ts +2 -2
  141. package/esm/desktop/index.js +3 -1
  142. package/{hook-8abfea97.d.ts → esm/hook-ad89c253.d.ts} +3 -2
  143. package/esm/{hook-70d58270.js → hook-d82699d1.js} +10 -6
  144. package/esm/index.d.ts +2 -2
  145. package/esm/index.js +8 -7
  146. package/esm/mobile/index.d.ts +1 -3
  147. package/esm/mobile/index.js +12 -8
  148. package/esm/presets/index.d.ts +1 -1
  149. package/esm/presets/index.js +3 -2
  150. package/esm/presets/useSelectWithApply/hook.js +3 -2
  151. package/esm/presets/useSelectWithApply/options-list-with-apply/Component.js +3 -2
  152. package/esm/presets/useSelectWithApply/options-list-with-apply/footer/Component.js +1 -1
  153. package/esm/presets/useSelectWithApply/options-list-with-apply/footer/index.css +3 -3
  154. package/esm/presets/useSelectWithApply/options-list-with-apply/header/Component.js +1 -1
  155. package/esm/presets/useSelectWithApply/options-list-with-apply/header/index.css +3 -3
  156. package/esm/presets/useSelectWithApply/options-list-with-apply/index.d.ts +1 -1
  157. package/esm/presets/useSelectWithApply/options-list-with-apply/index.js +3 -2
  158. package/esm/presets/useSelectWithLoading/hook.js +1 -1
  159. package/esm/presets/useSelectWithLoading/index.css +2 -2
  160. package/esm/shared/index.d.ts +9 -2
  161. package/esm/shared/index.js +30 -29
  162. package/esm/typings.d.ts +86 -7
  163. package/{cssm/hook-8abfea97.d.ts → hook-ad89c253.d.ts} +3 -2
  164. package/{hook-0a5c9f56.js → hook-df30325f.js} +9 -5
  165. package/index.d.ts +2 -2
  166. package/index.js +8 -7
  167. package/mobile/index.d.ts +1 -3
  168. package/mobile/index.js +12 -8
  169. package/modern/Component.desktop.d.ts +3 -15
  170. package/modern/Component.desktop.js +5 -3
  171. package/modern/Component.mobile.d.ts +3 -39
  172. package/modern/Component.mobile.js +29 -13
  173. package/modern/Component.modal.mobile.d.ts +2 -256
  174. package/modern/Component.modal.mobile.js +23 -43
  175. package/modern/Component.responsive.d.ts +3 -17
  176. package/modern/Component.responsive.js +11 -13
  177. package/modern/components/arrow/Component.js +1 -1
  178. package/modern/components/arrow/index.css +5 -5
  179. package/modern/components/base-checkmark/Component.js +1 -1
  180. package/modern/components/base-checkmark/index.css +4 -4
  181. package/modern/components/base-option/Component.js +1 -1
  182. package/modern/components/base-option/index.css +16 -16
  183. package/modern/components/base-select/Component.d.ts +17 -2
  184. package/modern/components/base-select/Component.js +179 -72
  185. package/modern/components/base-select/index.css +12 -12
  186. package/modern/components/base-select/index.js +1 -1
  187. package/{components/base-select-mobile/index.css → modern/components/base-select/mobile.css} +13 -22
  188. package/modern/components/checkmark/Component.js +1 -1
  189. package/modern/components/checkmark/index.css +11 -11
  190. package/modern/components/checkmark-mobile/Component.js +1 -1
  191. package/modern/components/checkmark-mobile/index.css +6 -6
  192. package/modern/components/field/Component.js +1 -1
  193. package/modern/components/field/index.css +15 -17
  194. package/modern/components/footer/Component.d.ts +12 -0
  195. package/modern/components/{base-select-mobile/footer → footer}/Component.js +5 -4
  196. package/modern/components/{base-select-mobile/footer → footer}/index.css +6 -6
  197. package/modern/components/footer/index.d.ts +1 -0
  198. package/modern/components/{base-select-mobile/footer → footer}/index.js +1 -0
  199. package/modern/components/index.js +2 -1
  200. package/modern/components/optgroup/Component.js +1 -1
  201. package/modern/components/optgroup/index.css +7 -7
  202. package/modern/components/option/Component.js +1 -1
  203. package/modern/components/option/index.css +24 -24
  204. package/modern/components/options-list/Component.js +5 -3
  205. package/modern/components/options-list/index.css +11 -11
  206. package/modern/components/options-list/index.js +2 -1
  207. package/modern/components/search/Component.d.ts +2 -4
  208. package/modern/components/search/Component.js +1 -1
  209. package/modern/components/search/index.css +2 -2
  210. package/modern/components/virtual-options-list/Component.js +5 -3
  211. package/modern/components/virtual-options-list/index.css +18 -18
  212. package/modern/components/virtual-options-list/index.js +2 -1
  213. package/modern/desktop/index.d.ts +2 -2
  214. package/modern/desktop/index.js +3 -1
  215. package/modern/{hook-8abfea97.d.ts → hook-ad89c253.d.ts} +3 -2
  216. package/modern/{hook-4eceefed.js → hook-d879e08e.js} +7 -3
  217. package/modern/index.d.ts +2 -2
  218. package/modern/index.js +8 -7
  219. package/modern/mobile/index.d.ts +1 -3
  220. package/modern/mobile/index.js +12 -8
  221. package/modern/presets/index.d.ts +1 -1
  222. package/modern/presets/index.js +3 -2
  223. package/modern/presets/useSelectWithApply/hook.js +3 -2
  224. package/modern/presets/useSelectWithApply/options-list-with-apply/Component.js +3 -2
  225. package/modern/presets/useSelectWithApply/options-list-with-apply/footer/Component.js +1 -1
  226. package/modern/presets/useSelectWithApply/options-list-with-apply/footer/index.css +3 -3
  227. package/modern/presets/useSelectWithApply/options-list-with-apply/header/Component.js +1 -1
  228. package/modern/presets/useSelectWithApply/options-list-with-apply/header/index.css +3 -3
  229. package/modern/presets/useSelectWithApply/options-list-with-apply/index.d.ts +1 -1
  230. package/modern/presets/useSelectWithApply/options-list-with-apply/index.js +3 -2
  231. package/modern/presets/useSelectWithLoading/hook.js +1 -1
  232. package/modern/presets/useSelectWithLoading/index.css +2 -2
  233. package/modern/shared/index.d.ts +9 -2
  234. package/modern/shared/index.js +29 -28
  235. package/modern/typings.d.ts +86 -7
  236. package/package.json +13 -11
  237. package/presets/index.d.ts +1 -1
  238. package/presets/index.js +3 -2
  239. package/presets/useSelectWithApply/hook.js +3 -2
  240. package/presets/useSelectWithApply/options-list-with-apply/Component.js +3 -2
  241. package/presets/useSelectWithApply/options-list-with-apply/footer/Component.js +1 -1
  242. package/presets/useSelectWithApply/options-list-with-apply/footer/index.css +3 -3
  243. package/presets/useSelectWithApply/options-list-with-apply/header/Component.js +1 -1
  244. package/presets/useSelectWithApply/options-list-with-apply/header/index.css +3 -3
  245. package/presets/useSelectWithApply/options-list-with-apply/index.d.ts +1 -1
  246. package/presets/useSelectWithApply/options-list-with-apply/index.js +3 -2
  247. package/presets/useSelectWithLoading/hook.js +1 -1
  248. package/presets/useSelectWithLoading/index.css +2 -2
  249. package/shared/index.d.ts +9 -2
  250. package/shared/index.js +39 -38
  251. package/src/Component.desktop.tsx +5 -14
  252. package/src/Component.mobile.tsx +38 -57
  253. package/src/Component.modal.mobile.tsx +5 -147
  254. package/src/Component.responsive.tsx +9 -44
  255. package/src/components/base-select/Component.tsx +380 -156
  256. package/src/components/base-select/index.module.css +1 -1
  257. package/src/components/{base-select-mobile/index.module.css → base-select/mobile.module.css} +0 -15
  258. package/src/components/{base-select-mobile/footer → footer}/Component.tsx +22 -4
  259. package/src/components/{base-select-mobile/footer → footer}/index.module.css +1 -1
  260. package/src/components/footer/index.ts +1 -0
  261. package/src/components/options-list/Component.tsx +6 -2
  262. package/src/components/virtual-options-list/Component.tsx +6 -2
  263. package/src/desktop/index.ts +2 -1
  264. package/src/index.ts +2 -4
  265. package/src/mobile/index.ts +1 -2
  266. package/src/presets/useSelectWithApply/hook.tsx +9 -3
  267. package/src/shared/index.ts +10 -2
  268. package/src/typings.ts +110 -9
  269. package/src/vars.css +1 -1
  270. package/typings.d.ts +86 -7
  271. package/components/base-select-mobile/Component.d.ts +0 -71
  272. package/components/base-select-mobile/Component.js +0 -296
  273. package/components/base-select-mobile/footer/Component.d.ts +0 -9
  274. package/components/base-select-mobile/footer/index.d.ts +0 -1
  275. package/components/base-select-mobile/index.d.ts +0 -1
  276. package/components/base-select-mobile/index.js +0 -36
  277. package/cssm/components/base-select-mobile/Component.d.ts +0 -71
  278. package/cssm/components/base-select-mobile/Component.js +0 -303
  279. package/cssm/components/base-select-mobile/footer/Component.d.ts +0 -9
  280. package/cssm/components/base-select-mobile/footer/index.d.ts +0 -1
  281. package/cssm/components/base-select-mobile/index.d.ts +0 -1
  282. package/cssm/components/base-select-mobile/index.js +0 -45
  283. package/esm/components/base-select-mobile/Component.d.ts +0 -71
  284. package/esm/components/base-select-mobile/Component.js +0 -286
  285. package/esm/components/base-select-mobile/footer/Component.d.ts +0 -9
  286. package/esm/components/base-select-mobile/footer/index.d.ts +0 -1
  287. package/esm/components/base-select-mobile/index.d.ts +0 -1
  288. package/esm/components/base-select-mobile/index.js +0 -28
  289. package/modern/components/base-select-mobile/Component.d.ts +0 -71
  290. package/modern/components/base-select-mobile/Component.js +0 -285
  291. package/modern/components/base-select-mobile/footer/Component.d.ts +0 -9
  292. package/modern/components/base-select-mobile/footer/index.d.ts +0 -1
  293. package/modern/components/base-select-mobile/index.d.ts +0 -1
  294. package/modern/components/base-select-mobile/index.js +0 -27
  295. package/src/components/base-select-mobile/Component.tsx +0 -572
  296. package/src/components/base-select-mobile/footer/index.ts +0 -1
  297. package/src/components/base-select-mobile/index.ts +0 -1
  298. /package/cssm/{hook-244c8d6e.d.ts → hook-2f9ec939.d.ts} +0 -0
  299. /package/esm/{hook-70d58270.d.ts → hook-d82699d1.d.ts} +0 -0
  300. /package/{hook-0a5c9f56.d.ts → hook-df30325f.d.ts} +0 -0
  301. /package/modern/{hook-4eceefed.d.ts → hook-d879e08e.d.ts} +0 -0
package/esm/typings.d.ts CHANGED
@@ -1,6 +1,11 @@
1
1
  import { AriaAttributes, FC, FocusEvent, MouseEvent, ReactElement, ReactNode, RefAttributes, SVGProps } from 'react';
2
+ import { BottomSheetProps } from "@alfalab/core-components-bottom-sheet";
3
+ import { FormControlProps } from "@alfalab/core-components-form-control";
2
4
  import { InputProps } from "@alfalab/core-components-input";
5
+ import { ModalProps } from "@alfalab/core-components-modal";
6
+ import { ModalFooterProps, ModalHeaderProps } from "@alfalab/core-components-modal/shared";
3
7
  import { PopoverProps } from "@alfalab/core-components-popover";
8
+ import { UseSelectWithApplyProps } from "./hook-ad89c253";
4
9
  type AnyObject = Record<string, any>;
5
10
  type OptionShape = {
6
11
  /**
@@ -217,13 +222,14 @@ type BaseSelectProps = {
217
222
  /**
218
223
  * Компонент поиска
219
224
  */
220
- Search?: FC<SearchProps & RefAttributes<HTMLInputElement>>;
225
+ Search?: FC<SearchProps>;
221
226
  /**
222
227
  * Настройки поиска
223
228
  */
224
229
  searchProps?: {
225
230
  componentProps?: SearchProps;
226
231
  accessor?: (option: OptionShape) => string;
232
+ filterFn?: (optionText: string, search: string) => boolean;
227
233
  value?: string;
228
234
  onChange?: (value: string) => void;
229
235
  };
@@ -528,10 +534,10 @@ type OptionProps = {
528
534
  */
529
535
  innerProps: {
530
536
  id: string;
531
- onClick: (event: MouseEvent<HTMLDivElement>) => void;
532
- onMouseDown: (event: MouseEvent<HTMLDivElement>) => void;
533
- onMouseMove: (event: MouseEvent<HTMLDivElement>) => void;
534
- role: string;
537
+ onClick?: (event: MouseEvent<HTMLDivElement>) => void;
538
+ onMouseDown?: (event: MouseEvent<HTMLDivElement>) => void;
539
+ onMouseMove?: (event: MouseEvent<HTMLDivElement>) => void;
540
+ role?: string;
535
541
  } & RefAttributes<HTMLDivElement> & AriaAttributes;
536
542
  /**
537
543
  * Идентификатор для систем автоматизированного тестирования
@@ -572,5 +578,78 @@ type CheckmarkProps = {
572
578
  */
573
579
  icon?: FC<SVGProps<SVGSVGElement>>;
574
580
  };
575
- type SearchProps = InputProps;
576
- export { AnyObject, OptionShape, GroupShape, BaseSelectChangePayload, BaseSelectProps, FieldProps, ArrowProps, OptionsListProps, OptgroupProps, OptionProps, CheckmarkProps, SearchProps };
581
+ type SearchProps = InputProps & RefAttributes<HTMLInputElement>;
582
+ type SelectFieldProps = Omit<FormControlProps, 'size'> & Record<string, unknown>;
583
+ type AdditionalMobileProps = {
584
+ /**
585
+ * Показывать кнопку 'Сбросить' в футере мобильного компонента
586
+ */
587
+ showClear?: UseSelectWithApplyProps['showClear'];
588
+ /**
589
+ * Показывать пункт "Выбрать все"
590
+ */
591
+ showSelectAll?: UseSelectWithApplyProps['showSelectAll'];
592
+ /**
593
+ * Показывать пункт "Выбрать все" в заголовке списка у мобильного компонента
594
+ */
595
+ showHeaderWithSelectAll?: UseSelectWithApplyProps['showHeaderWithSelectAll'];
596
+ /**
597
+ * Использовать ли хук useSelectWithApply в мобильном компоненте
598
+ */
599
+ useWithApplyHook?: boolean;
600
+ };
601
+ type BottomSheetSelectMobileProps = {
602
+ /**
603
+ * Футер
604
+ * @deprecated Используйте bottomSheetProps.actionButton
605
+ */
606
+ footer?: ReactNode;
607
+ /**
608
+ * Будет ли свайпаться шторка
609
+ * @deprecated Используйте bottomSheetProps.swipeable
610
+ */
611
+ swipeable?: boolean;
612
+ /**
613
+ * Дополнительные пропсы шторки
614
+ */
615
+ bottomSheetProps?: Partial<BottomSheetProps>;
616
+ };
617
+ type ModalSelectMobileProps = {
618
+ /**
619
+ * Дополнительные пропсы шапки модалки
620
+ */
621
+ modalHeaderProps?: Partial<ModalHeaderProps>;
622
+ /**
623
+ * Дополнительные пропсы модалки
624
+ */
625
+ modalProps?: Partial<ModalProps & RefAttributes<HTMLDivElement>>;
626
+ /**
627
+ * Дополнительные пропсы футера модалки
628
+ */
629
+ modalFooterProps?: Partial<ModalFooterProps>;
630
+ };
631
+ type ConditionalMobileProps = ({
632
+ isBottomSheet?: true;
633
+ } & BottomSheetSelectMobileProps) | ({
634
+ isBottomSheet: false;
635
+ } & ModalSelectMobileProps);
636
+ type SelectModalMobileProps = Omit<BaseSelectProps, 'Checkmark'> & AdditionalMobileProps & ModalSelectMobileProps;
637
+ type SelectMobileProps = Omit<BaseSelectProps, 'Checkmark'> & AdditionalMobileProps & ConditionalMobileProps;
638
+ type SelectDesktopProps = Omit<BaseSelectProps, 'fieldProps'> & {
639
+ /**
640
+ * Пропсы, которые будут прокинуты в компонент поля
641
+ */
642
+ fieldProps?: SelectFieldProps;
643
+ };
644
+ type SelectProps = BaseSelectProps & AdditionalMobileProps & ConditionalMobileProps & {
645
+ /**
646
+ * Контрольная точка, с нее начинается desktop версия
647
+ * @default 1024
648
+ */
649
+ breakpoint?: number;
650
+ /**
651
+ * Значение по-умолчанию для хука useMatchMedia
652
+ */
653
+ defaultMatchMediaValue?: boolean | (() => boolean);
654
+ };
655
+ export { AnyObject, OptionShape, GroupShape, BaseSelectChangePayload, BaseSelectProps, FieldProps, ArrowProps, OptionsListProps, OptgroupProps, OptionProps, CheckmarkProps, SearchProps, SelectFieldProps, AdditionalMobileProps, BottomSheetSelectMobileProps, ModalSelectMobileProps, SelectModalMobileProps, SelectMobileProps, SelectDesktopProps, SelectProps };
@@ -81,9 +81,10 @@ declare function useSelectWithApply({ options, selected, onChange, OptionsList,
81
81
  showSearch: boolean | undefined;
82
82
  searchProps: {
83
83
  value: string;
84
- onChange: import("react").Dispatch<import("react").SetStateAction<string>>;
85
- componentProps?: import("@alfalab/core-components-input").InputProps | undefined;
84
+ onChange: ((value: string) => void) | undefined;
85
+ componentProps?: import("./typings").SearchProps | undefined;
86
86
  accessor?: ((option: OptionShape) => string) | undefined;
87
+ filterFn?: ((optionText: string, search: string) => boolean) | undefined;
87
88
  } | undefined;
88
89
  };
89
90
  export { UseSelectWithApplyProps, SELECT_ALL_KEY, useSelectWithApply };
@@ -56,12 +56,16 @@ var SELECT_ALL_KEY = 'select_all';
56
56
  var selectAllOption = { key: SELECT_ALL_KEY, content: 'Выбрать все' };
57
57
  function useSelectWithApply(_a) {
58
58
  var options = _a.options, selected = _a.selected, _b = _a.onChange, onChange = _b === void 0 ? function () { return null; } : _b, OptionsList = _a.OptionsList, _c = _a.optionsListProps, optionsListProps = _c === void 0 ? {} : _c, _d = _a.showClear, showClear = _d === void 0 ? true : _d, _e = _a.showSelectAll, showSelectAll = _e === void 0 ? false : _e, _f = _a.showHeaderWithSelectAll, showHeaderWithSelectAll = _f === void 0 ? false : _f, showSearch = _a.showSearch, _g = _a.searchProps, searchProps = _g === void 0 ? {} : _g;
59
- var _h = React.useState(''), search = _h[0], setSearch = _h[1];
59
+ var _h = React.useState(''), searchState = _h[0], setSearchState = _h[1];
60
+ var _j = typeof (searchProps === null || searchProps === void 0 ? void 0 : searchProps.value) === 'string'
61
+ ? [searchProps.value, searchProps.onChange]
62
+ : [searchState, setSearchState], search = _j[0], setSearch = _j[1];
60
63
  var accessor = searchProps.accessor || utils.defaultAccessor;
61
- var _j = React.useMemo(function () {
62
- return utils.processOptions(options, selected, showSearch ? function (option) { return utils.defaultFilterFn(accessor(option), search); } : undefined);
63
- }, [accessor, options, search, selected, showSearch]), flatOptions = _j.flatOptions, selectedOptions = _j.selectedOptions;
64
- var _k = React.useState(selectedOptions), selectedDraft = _k[0], setSelectedDraft = _k[1];
64
+ var filterFn = searchProps.filterFn || utils.defaultFilterFn;
65
+ var _k = React.useMemo(function () {
66
+ return utils.processOptions(options, selected, showSearch ? function (option) { return filterFn(accessor(option), search); } : undefined);
67
+ }, [filterFn, accessor, options, search, selected, showSearch]), flatOptions = _k.flatOptions, selectedOptions = _k.selectedOptions;
68
+ var _l = React.useState(selectedOptions), selectedDraft = _l[0], setSelectedDraft = _l[1];
65
69
  var selectedOptionsRef = React.useRef(selectedOptions);
66
70
  var handleApply = function () {
67
71
  onChange({
package/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export { SelectResponsive as Select, SelectResponsiveProps as SelectProps } from "./Component.responsive";
2
- export {};
1
+ export { SelectResponsive as Select } from "./Component.responsive";
2
+ export type { SelectProps } from "./typings";
package/index.js CHANGED
@@ -5,18 +5,20 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  var Component_responsive = require('./Component.responsive.js');
6
6
  require('tslib');
7
7
  require('react');
8
- require('@alfalab/hooks');
8
+ require('@alfalab/core-components-mq');
9
9
  require('./Component.desktop.js');
10
10
  require('@alfalab/core-components-form-control/desktop');
11
+ require('@alfalab/core-components-popover');
11
12
  require('./components/arrow/Component.js');
12
13
  require('classnames');
13
14
  require('@alfalab/icons-glyph/ChevronDownMIcon');
14
15
  require('./components/base-select/Component.js');
15
16
  require('react-merge-refs');
16
17
  require('@juggle/resize-observer');
18
+ require('compute-scroll-into-view');
17
19
  require('downshift');
18
- require('@alfalab/core-components-popover');
19
20
  require('@alfalab/core-components-shared');
21
+ require('@alfalab/hooks');
20
22
  require('./utils.js');
21
23
  require('./components/native-select/Component.js');
22
24
  require('./components/field/Component.js');
@@ -35,16 +37,15 @@ require('./components/search/Component.js');
35
37
  require('@alfalab/core-components-input');
36
38
  require('@alfalab/icons-glyph/MagnifierMIcon');
37
39
  require('./Component.mobile.js');
38
- require('@alfalab/core-components-form-control/mobile');
39
- require('./components/base-select-mobile/Component.js');
40
40
  require('@alfalab/core-components-bottom-sheet');
41
- require('@alfalab/core-components-modal/mobile');
42
- require('./components/base-select-mobile/footer/Component.js');
41
+ require('@alfalab/core-components-form-control/mobile');
42
+ require('@alfalab/core-components-modal/Component.mobile');
43
+ require('./components/footer/Component.js');
43
44
  require('@alfalab/core-components-base-modal');
44
45
  require('@alfalab/core-components-button/mobile');
45
46
  require('./components/virtual-options-list/Component.js');
46
47
  require('react-virtual');
47
- require('./hook-0a5c9f56.js');
48
+ require('./hook-df30325f.js');
48
49
  require('./presets/useSelectWithApply/options-list-with-apply/footer/Component.js');
49
50
  require('@alfalab/core-components-button/desktop');
50
51
  require('./presets/useSelectWithApply/options-list-with-apply/header/Component.js');
package/mobile/index.d.ts CHANGED
@@ -1,5 +1,3 @@
1
1
  export { SelectMobile } from "../Component.mobile";
2
2
  export { SelectModalMobile } from "../Component.modal.mobile";
3
- export type { SelectMobileProps } from "../Component.mobile";
4
- export type { SelectModalMobileProps } from "../Component.modal.mobile";
5
- export {};
3
+ export type { SelectMobileProps, SelectModalMobileProps } from "../typings";
package/mobile/index.js CHANGED
@@ -6,19 +6,25 @@ var Component_mobile = require('../Component.mobile.js');
6
6
  var Component_modal_mobile = require('../Component.modal.mobile.js');
7
7
  require('tslib');
8
8
  require('react');
9
+ require('@alfalab/core-components-bottom-sheet');
9
10
  require('@alfalab/core-components-form-control/mobile');
11
+ require('@alfalab/core-components-modal/Component.mobile');
10
12
  require('../components/arrow/Component.js');
11
13
  require('classnames');
12
14
  require('@alfalab/icons-glyph/ChevronDownMIcon');
13
- require('../components/base-select-mobile/Component.js');
15
+ require('../components/base-select/Component.js');
14
16
  require('react-merge-refs');
17
+ require('@juggle/resize-observer');
18
+ require('compute-scroll-into-view');
15
19
  require('downshift');
16
- require('@alfalab/core-components-bottom-sheet');
17
- require('@alfalab/core-components-modal/mobile');
18
20
  require('@alfalab/core-components-shared');
21
+ require('@alfalab/hooks');
19
22
  require('../utils.js');
23
+ require('../components/native-select/Component.js');
20
24
  require('../components/field/Component.js');
21
- require('@alfalab/hooks');
25
+ require('../components/footer/Component.js');
26
+ require('@alfalab/core-components-base-modal');
27
+ require('@alfalab/core-components-button/mobile');
22
28
  require('../components/optgroup/Component.js');
23
29
  require('../components/option/Component.js');
24
30
  require('../components/checkmark/Component.js');
@@ -28,17 +34,15 @@ require('@alfalab/icons-glyph/CheckmarkCircleMIcon');
28
34
  require('@alfalab/icons-glyph/CheckmarkMIcon');
29
35
  require('../components/checkmark-mobile/Component.js');
30
36
  require('../components/options-list/Component.js');
37
+ require('@alfalab/core-components-mq');
31
38
  require('@alfalab/core-components-scrollbar');
32
39
  require('../consts.js');
33
40
  require('../components/search/Component.js');
34
41
  require('@alfalab/core-components-input');
35
42
  require('@alfalab/icons-glyph/MagnifierMIcon');
36
- require('../components/base-select-mobile/footer/Component.js');
37
- require('@alfalab/core-components-base-modal');
38
- require('@alfalab/core-components-button/mobile');
39
43
  require('../components/virtual-options-list/Component.js');
40
44
  require('react-virtual');
41
- require('../hook-0a5c9f56.js');
45
+ require('../hook-df30325f.js');
42
46
  require('../presets/useSelectWithApply/options-list-with-apply/footer/Component.js');
43
47
  require('@alfalab/core-components-button/desktop');
44
48
  require('../presets/useSelectWithApply/options-list-with-apply/header/Component.js');
@@ -1,18 +1,6 @@
1
1
  /// <reference types="react" />
2
2
  import React from 'react';
3
- import { FormControlDesktopProps } from "@alfalab/core-components-form-control/desktop";
4
- import { BaseSelectProps } from "./typings";
5
- type SelectFieldProps = Omit<FormControlDesktopProps, 'size'> & Record<string, unknown>;
6
- type SelectDesktopProps = Omit<BaseSelectProps, 'fieldProps'> & {
7
- /**
8
- * Пропсы, которые будут прокинуты в компонент поля
9
- */
10
- fieldProps?: SelectFieldProps;
11
- };
12
- declare const SelectDesktop: React.ForwardRefExoticComponent<Omit<BaseSelectProps, "fieldProps"> & {
13
- /**
14
- * Пропсы, которые будут прокинуты в компонент поля
15
- */
16
- fieldProps?: SelectFieldProps | undefined;
3
+ declare const SelectDesktop: React.ForwardRefExoticComponent<Omit<import("./typings").BaseSelectProps, "fieldProps"> & {
4
+ fieldProps?: import("./typings").SelectFieldProps | undefined;
17
5
  } & React.RefAttributes<HTMLDivElement>>;
18
- export { SelectFieldProps, SelectDesktopProps, SelectDesktop };
6
+ export { SelectDesktop };
@@ -1,5 +1,6 @@
1
1
  import React, { forwardRef } from 'react';
2
2
  import { FormControlDesktop } from '@alfalab/core-components-form-control/modern/desktop';
3
+ import { Popover } from '@alfalab/core-components-popover/modern';
3
4
  import { Arrow } from './components/arrow/Component.js';
4
5
  import { BaseSelect } from './components/base-select/Component.js';
5
6
  import { Field } from './components/field/Component.js';
@@ -11,8 +12,8 @@ import 'classnames';
11
12
  import '@alfalab/icons-glyph/ChevronDownMIcon';
12
13
  import 'react-merge-refs';
13
14
  import '@juggle/resize-observer';
15
+ import 'compute-scroll-into-view';
14
16
  import 'downshift';
15
- import '@alfalab/core-components-popover/modern';
16
17
  import '@alfalab/core-components-shared/modern';
17
18
  import '@alfalab/hooks';
18
19
  import './utils.js';
@@ -23,14 +24,15 @@ import '@alfalab/core-components-checkbox/modern';
23
24
  import '@alfalab/icons-glyph/CheckmarkCircleMIcon';
24
25
  import '@alfalab/icons-glyph/CheckmarkMIcon';
25
26
  import './components/checkmark-mobile/Component.js';
27
+ import '@alfalab/core-components-mq/modern';
26
28
  import '@alfalab/core-components-scrollbar/modern';
27
29
  import './consts.js';
28
30
  import '@alfalab/core-components-input/modern';
29
31
  import '@alfalab/icons-glyph/MagnifierMIcon';
30
32
 
31
- const SelectDesktop = forwardRef(({ Arrow: Arrow$1 = Arrow, Field: Field$1 = Field, OptionsList: OptionsList$1 = OptionsList, Optgroup: Optgroup$1 = Optgroup, Option: Option$1 = Option, Search: Search$1 = Search, fieldProps = {}, ...restProps }, ref) => (React.createElement(BaseSelect, { ref: ref, Option: Option$1, Field: Field$1, fieldProps: {
33
+ const SelectDesktop = forwardRef(({ Arrow: Arrow$1 = Arrow, Field: Field$1 = Field, OptionsList: OptionsList$1 = OptionsList, Optgroup: Optgroup$1 = Optgroup, Option: Option$1 = Option, Search: Search$1 = Search, fieldProps = {}, ...restProps }, ref) => (React.createElement(BaseSelect, { ref: ref, view: 'desktop', Option: Option$1, Field: Field$1, fieldProps: {
32
34
  FormControlComponent: FormControlDesktop,
33
35
  ...fieldProps,
34
- }, Search: Search$1, Optgroup: Optgroup$1, OptionsList: OptionsList$1, Arrow: Arrow$1, ...restProps })));
36
+ }, Search: Search$1, Optgroup: Optgroup$1, OptionsList: OptionsList$1, Arrow: Arrow$1, Popover: Popover, ...restProps })));
35
37
 
36
38
  export { SelectDesktop };
@@ -1,41 +1,5 @@
1
1
  /// <reference types="react" />
2
2
  import React from 'react';
3
- import { ReactNode } from "react";
4
- import { BottomSheetProps } from "@alfalab/core-components-bottom-sheet";
5
- import { UseSelectWithApplyProps } from "./hook-8abfea97";
6
- import { BaseSelectProps } from "./typings";
7
- type AdditionalMobileProps = {
8
- /**
9
- * Футер
10
- * @deprecated Используйте bottomSheetProps.actionButton
11
- */
12
- footer?: ReactNode;
13
- /**
14
- * Будет ли свайпаться шторка
15
- * @deprecated Используйте bottomSheetProps.swipeable
16
- */
17
- swipeable?: boolean;
18
- /**
19
- * Дополнительные пропсы шторки
20
- */
21
- bottomSheetProps?: Partial<BottomSheetProps>;
22
- /**
23
- * Показывать кнопку очистки
24
- */
25
- showClear?: UseSelectWithApplyProps['showClear'];
26
- /**
27
- * Показывать пункт "Выбрать все"
28
- */
29
- showSelectAll?: UseSelectWithApplyProps['showSelectAll'];
30
- /**
31
- * Показывать пункт "Выбрать все" в заголовке списка
32
- */
33
- showHeaderWithSelectAll?: UseSelectWithApplyProps['showHeaderWithSelectAll'];
34
- /**
35
- * Использовать ли хук useSelectWithApply
36
- */
37
- useWithApplyHook?: boolean;
38
- };
39
- type SelectMobileProps = Omit<BaseSelectProps, 'Checkmark' | 'onScroll'> & AdditionalMobileProps;
40
- declare const SelectMobile: React.ForwardRefExoticComponent<Omit<BaseSelectProps, "onScroll" | "Checkmark"> & AdditionalMobileProps & React.RefAttributes<unknown>>;
41
- export { AdditionalMobileProps, SelectMobileProps, SelectMobile };
3
+ import { SelectMobileProps } from "./typings";
4
+ declare const SelectMobile: React.ForwardRefExoticComponent<SelectMobileProps & React.RefAttributes<unknown>>;
5
+ export { SelectMobile };
@@ -1,33 +1,37 @@
1
1
  import React, { forwardRef } from 'react';
2
+ import { BottomSheet } from '@alfalab/core-components-bottom-sheet/modern';
2
3
  import { FormControlMobile } from '@alfalab/core-components-form-control/modern/mobile';
4
+ import { ModalMobile } from '@alfalab/core-components-modal/modern/Component.mobile';
3
5
  import { Arrow } from './components/arrow/Component.js';
4
- import { BaseSelectMobile } from './components/base-select-mobile/Component.js';
5
- import { Footer } from './components/base-select-mobile/footer/Component.js';
6
+ import { BaseSelect } from './components/base-select/Component.js';
6
7
  import { Field } from './components/field/Component.js';
8
+ import { Footer } from './components/footer/Component.js';
7
9
  import { Optgroup } from './components/optgroup/Component.js';
8
10
  import { Option } from './components/option/Component.js';
9
11
  import { OptionsList } from './components/options-list/Component.js';
10
12
  import { Search } from './components/search/Component.js';
11
13
  import { VirtualOptionsList } from './components/virtual-options-list/Component.js';
12
- import { u as useSelectWithApply } from './hook-4eceefed.js';
14
+ import { u as useSelectWithApply } from './hook-d879e08e.js';
13
15
  import { Header } from './presets/useSelectWithApply/options-list-with-apply/header/Component.js';
14
16
  import 'classnames';
15
17
  import '@alfalab/icons-glyph/ChevronDownMIcon';
16
18
  import 'react-merge-refs';
19
+ import '@juggle/resize-observer';
20
+ import 'compute-scroll-into-view';
17
21
  import 'downshift';
18
- import '@alfalab/core-components-bottom-sheet/modern';
19
- import '@alfalab/core-components-modal/modern/mobile';
20
22
  import '@alfalab/core-components-shared/modern';
23
+ import '@alfalab/hooks';
21
24
  import './utils.js';
25
+ import './components/native-select/Component.js';
22
26
  import '@alfalab/core-components-base-modal/modern';
23
27
  import '@alfalab/core-components-button/modern/mobile';
24
- import '@alfalab/hooks';
25
28
  import './components/checkmark/Component.js';
26
29
  import '@alfalab/core-components-badge/modern';
27
30
  import '@alfalab/core-components-checkbox/modern';
28
31
  import '@alfalab/icons-glyph/CheckmarkCircleMIcon';
29
32
  import '@alfalab/icons-glyph/CheckmarkMIcon';
30
33
  import './components/checkmark-mobile/Component.js';
34
+ import '@alfalab/core-components-mq/modern';
31
35
  import '@alfalab/core-components-scrollbar/modern';
32
36
  import './consts.js';
33
37
  import '@alfalab/core-components-input/modern';
@@ -37,9 +41,11 @@ import './presets/useSelectWithApply/options-list-with-apply/footer/Component.js
37
41
  import '@alfalab/core-components-button/modern/desktop';
38
42
 
39
43
  const VIRTUAL_OPTIONS_LIST_THRESHOLD = 30;
40
- const SelectMobile = forwardRef(({ autocomplete = false, multiple = false, allowUnselect = false, disabled = false, closeOnSelect = !multiple, circularNavigation = false, defaultOpen = false, open: openProp, size = 'm', optionsSize = 'm', fieldProps = {}, optionProps = {}, optionsListProps = {}, Arrow: Arrow$1 = Arrow, Field: Field$1 = Field, Optgroup: Optgroup$1 = Optgroup, Option: Option$1 = Option, Search: Search$1 = Search, selected, options, OptionsList: OptionsList$1 = options.length > VIRTUAL_OPTIONS_LIST_THRESHOLD
44
+ const SelectMobile = forwardRef(({ autocomplete = false, multiple = false, allowUnselect = false, disabled = false, closeOnSelect = !multiple, circularNavigation = false, defaultOpen = false, open: openProp, size = 'm', optionsSize = 'm', fieldProps = {}, optionProps = {}, optionsListProps = {}, Arrow: Arrow$1 = Arrow, Field: Field$1 = Field, Optgroup: Optgroup$1 = Optgroup, Option: Option$1 = Option, Search: Search$1 = Search, selected, isBottomSheet = true, options, OptionsList: OptionsList$1 = options.length > VIRTUAL_OPTIONS_LIST_THRESHOLD
41
45
  ? VirtualOptionsList
42
- : OptionsList, onChange, bottomSheetProps, showClear = true, showSelectAll, showHeaderWithSelectAll, useWithApplyHook = multiple, showSearch, searchProps, ...restProps }, ref) => {
46
+ : OptionsList, onChange, showClear = true, showSelectAll, showHeaderWithSelectAll, useWithApplyHook = multiple, showSearch, searchProps, ...restProps }, ref) => {
47
+ const typedRestBottomSheetProps = restProps;
48
+ const typedRestModalProps = restProps;
43
49
  const applyProps = useSelectWithApply({
44
50
  optionsListProps: {
45
51
  ...optionsListProps,
@@ -54,13 +60,23 @@ const SelectMobile = forwardRef(({ autocomplete = false, multiple = false, allow
54
60
  showClear,
55
61
  showSelectAll,
56
62
  });
57
- return (React.createElement(BaseSelectMobile, { ref: ref, autocomplete: autocomplete, multiple: multiple, allowUnselect: allowUnselect, disabled: disabled, closeOnSelect: closeOnSelect, circularNavigation: circularNavigation, defaultOpen: defaultOpen, open: openProp, size: size, optionsSize: optionsSize, fieldProps: {
63
+ const bottomAddons = useWithApplyHook && showHeaderWithSelectAll && (React.createElement(Header, { ...applyProps.optionsListProps.headerProps, mobile: true }));
64
+ return (React.createElement(BaseSelect, { ref: ref, view: 'mobile', autocomplete: autocomplete, multiple: multiple, allowUnselect: allowUnselect, disabled: disabled, closeOnSelect: closeOnSelect, circularNavigation: circularNavigation, defaultOpen: defaultOpen, open: openProp, size: size, optionsSize: optionsSize, fieldProps: {
58
65
  FormControlComponent: FormControlMobile,
59
66
  ...fieldProps,
60
- }, optionProps: optionProps, Arrow: Arrow$1, Field: Field$1, Optgroup: Optgroup$1, Option: Option$1, Search: Search$1, isBottomSheet: true, options: options, selected: selected, onChange: onChange, OptionsList: OptionsList$1, showSearch: showSearch, searchProps: searchProps, bottomSheetProps: {
61
- bottomAddons: useWithApplyHook && showHeaderWithSelectAll && (React.createElement(Header, { ...applyProps.optionsListProps.headerProps, mobile: true })),
62
- ...bottomSheetProps,
63
- }, optionsListProps: optionsListProps, ...restProps, ...(useWithApplyHook && applyProps) }));
67
+ }, optionProps: optionProps, Arrow: Arrow$1, Field: Field$1, Optgroup: Optgroup$1, Option: Option$1, Search: Search$1, isBottomSheet: isBottomSheet, options: options, selected: selected, onChange: onChange, OptionsList: OptionsList$1, showSearch: showSearch, searchProps: searchProps, BottomSheet: BottomSheet, ModalMobile: ModalMobile, ...(isBottomSheet
68
+ ? {
69
+ bottomSheetProps: {
70
+ bottomAddons,
71
+ ...typedRestBottomSheetProps.bottomSheetProps,
72
+ },
73
+ }
74
+ : {
75
+ modalHeaderProps: {
76
+ bottomAddons,
77
+ ...typedRestModalProps.modalHeaderProps,
78
+ },
79
+ }), optionsListProps: optionsListProps, ...restProps, ...(useWithApplyHook && applyProps) }));
64
80
  });
65
81
 
66
82
  export { SelectMobile };