@alfalab/core-components-input-autocomplete 9.4.7 → 10.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 (259) hide show
  1. package/Component-50136800.d.ts +6 -0
  2. package/Component-5e1b8383.d.ts +70 -3
  3. package/{Component-3885b0d7.d.ts → Component-63dec22f.d.ts} +24 -26
  4. package/{modern/Component-425c8522.d.ts → Component-72dda473.d.ts} +1 -1
  5. package/Component-bdb4c6b9.d.ts +10 -7
  6. package/Component-c76d6398.d.ts +5 -0
  7. package/Component-ebda875c.d.ts +9 -98
  8. package/Component.desktop-ebda875c.d.ts +6 -0
  9. package/Component.desktop.d.ts +11 -65
  10. package/Component.desktop.js +4 -4
  11. package/Component.mobile-06ffd24b.d.ts +41 -0
  12. package/Component.mobile-ebda875c.d.ts +6 -0
  13. package/{Component.mobile-e81c389f.d.ts → Component.mobile-f1f15074.d.ts} +2 -6
  14. package/Component.mobile.d.ts +8 -9
  15. package/Component.mobile.js +7 -7
  16. package/Component.modal.mobile-5e1b8383.d.ts +60 -0
  17. package/Component.modal.mobile.d.ts +7 -39
  18. package/Component.modal.mobile.js +5 -5
  19. package/Component.responsive.d.ts +12 -71
  20. package/Component.responsive.js +7 -5
  21. package/autocomplete-field/Component.d.ts +1 -1
  22. package/autocomplete-field/Component.js +3 -3
  23. package/autocomplete-field/index.css +2 -2
  24. package/autocomplete-field/index.js +1 -1
  25. package/autocomplete-mobile-field/Component.d.ts +9 -5
  26. package/autocomplete-mobile-field/Component.js +7 -7
  27. package/autocomplete-mobile-field/index.css +8 -8
  28. package/autocomplete-mobile-field/index.js +1 -1
  29. package/component-50136800.d.ts +44 -0
  30. package/cssm/Component-50136800.d.ts +6 -0
  31. package/cssm/Component-5e1b8383.d.ts +70 -3
  32. package/{modern/Component-3885b0d7.d.ts → cssm/Component-63dec22f.d.ts} +24 -26
  33. package/{Component-425c8522.d.ts → cssm/Component-72dda473.d.ts} +1 -1
  34. package/cssm/Component-bdb4c6b9.d.ts +10 -7
  35. package/cssm/Component-c76d6398.d.ts +5 -0
  36. package/cssm/Component-ebda875c.d.ts +9 -98
  37. package/cssm/Component.desktop-ebda875c.d.ts +6 -0
  38. package/cssm/Component.desktop.d.ts +11 -65
  39. package/cssm/Component.desktop.js +4 -4
  40. package/cssm/Component.mobile-06ffd24b.d.ts +41 -0
  41. package/cssm/Component.mobile-ebda875c.d.ts +6 -0
  42. package/{esm/Component.mobile-e81c389f.d.ts → cssm/Component.mobile-f1f15074.d.ts} +2 -6
  43. package/cssm/Component.mobile.d.ts +8 -9
  44. package/cssm/Component.mobile.js +6 -6
  45. package/cssm/Component.modal.mobile-5e1b8383.d.ts +60 -0
  46. package/cssm/Component.modal.mobile.d.ts +7 -39
  47. package/cssm/Component.modal.mobile.js +4 -4
  48. package/cssm/Component.responsive.d.ts +12 -71
  49. package/cssm/Component.responsive.js +6 -4
  50. package/cssm/autocomplete-field/Component.d.ts +1 -1
  51. package/cssm/autocomplete-field/Component.js +2 -2
  52. package/cssm/autocomplete-field/index.js +1 -1
  53. package/cssm/autocomplete-mobile-field/Component.d.ts +9 -5
  54. package/cssm/autocomplete-mobile-field/Component.js +6 -6
  55. package/cssm/autocomplete-mobile-field/index.js +1 -1
  56. package/cssm/component-50136800.d.ts +44 -0
  57. package/cssm/desktop-63dec22f.d.ts +6 -0
  58. package/cssm/desktop.d.ts +1 -1
  59. package/cssm/desktop.js +2 -2
  60. package/cssm/{hook-b4e70cb0.d.ts → hook-9ea9e32c.d.ts} +12 -10
  61. package/cssm/index-50136800.d.ts +11 -0
  62. package/cssm/{index-425c8522.d.ts → index-72dda473.d.ts} +7 -1
  63. package/cssm/index-bdb4c6b9.d.ts +2 -172
  64. package/cssm/index-c76d6398.d.ts +2 -0
  65. package/cssm/index-ebda875c.d.ts +94 -56
  66. package/cssm/index-f12ee135.d.ts +3 -287
  67. package/cssm/index.d.ts +2 -3
  68. package/cssm/index.js +9 -8
  69. package/cssm/mobile-06ffd24b.d.ts +5 -0
  70. package/cssm/mobile-96988a65.d.ts +3 -0
  71. package/cssm/mobile.d.ts +2 -2
  72. package/cssm/mobile.js +3 -4
  73. package/cssm/shared-4cd3936b.d.ts +93 -0
  74. package/cssm/types-d9f9bbcc.d.ts +259 -0
  75. package/cssm/typings-5e1b8383.d.ts +1 -1
  76. package/cssm/typings-9211a437.d.ts +95 -0
  77. package/cssm/utils-1574ad8b.d.ts +29 -0
  78. package/cssm/utils-49cc3c24.d.ts +8 -0
  79. package/desktop-63dec22f.d.ts +6 -0
  80. package/desktop.d.ts +1 -1
  81. package/desktop.js +2 -2
  82. package/esm/Component-50136800.d.ts +6 -0
  83. package/esm/Component-5e1b8383.d.ts +70 -3
  84. package/{cssm/Component-3885b0d7.d.ts → esm/Component-63dec22f.d.ts} +24 -26
  85. package/esm/{Component-425c8522.d.ts → Component-72dda473.d.ts} +1 -1
  86. package/esm/Component-bdb4c6b9.d.ts +10 -7
  87. package/esm/Component-c76d6398.d.ts +5 -0
  88. package/esm/Component-ebda875c.d.ts +9 -98
  89. package/esm/Component.desktop-ebda875c.d.ts +6 -0
  90. package/esm/Component.desktop.d.ts +11 -65
  91. package/esm/Component.desktop.js +2 -2
  92. package/esm/Component.mobile-06ffd24b.d.ts +41 -0
  93. package/esm/Component.mobile-ebda875c.d.ts +6 -0
  94. package/{modern/Component.mobile-e81c389f.d.ts → esm/Component.mobile-f1f15074.d.ts} +2 -6
  95. package/esm/Component.mobile.d.ts +8 -9
  96. package/esm/Component.mobile.js +6 -6
  97. package/esm/Component.modal.mobile-5e1b8383.d.ts +60 -0
  98. package/esm/Component.modal.mobile.d.ts +7 -39
  99. package/esm/Component.modal.mobile.js +5 -5
  100. package/esm/Component.responsive.d.ts +12 -71
  101. package/esm/Component.responsive.js +7 -5
  102. package/esm/autocomplete-field/Component.d.ts +1 -1
  103. package/esm/autocomplete-field/Component.js +4 -4
  104. package/esm/autocomplete-field/index.css +2 -2
  105. package/esm/autocomplete-field/index.js +1 -1
  106. package/esm/autocomplete-mobile-field/Component.d.ts +9 -5
  107. package/esm/autocomplete-mobile-field/Component.js +7 -7
  108. package/esm/autocomplete-mobile-field/index.css +8 -8
  109. package/esm/autocomplete-mobile-field/index.js +1 -1
  110. package/esm/component-50136800.d.ts +44 -0
  111. package/esm/desktop-63dec22f.d.ts +6 -0
  112. package/esm/desktop.d.ts +1 -1
  113. package/esm/desktop.js +2 -2
  114. package/{hook-b4e70cb0.d.ts → esm/hook-9ea9e32c.d.ts} +12 -10
  115. package/esm/index-50136800.d.ts +11 -0
  116. package/esm/{index-425c8522.d.ts → index-72dda473.d.ts} +7 -1
  117. package/esm/index-bdb4c6b9.d.ts +2 -172
  118. package/esm/index-c76d6398.d.ts +2 -0
  119. package/esm/index-ebda875c.d.ts +94 -56
  120. package/esm/index-f12ee135.d.ts +3 -287
  121. package/esm/index.d.ts +2 -3
  122. package/esm/index.js +10 -8
  123. package/esm/mobile-06ffd24b.d.ts +5 -0
  124. package/esm/mobile-96988a65.d.ts +3 -0
  125. package/esm/mobile.css +4 -4
  126. package/esm/mobile.d.ts +2 -2
  127. package/esm/mobile.js +4 -5
  128. package/esm/{mobile.module-2d568950.js → mobile.module-d324a3dd.js} +1 -1
  129. package/esm/shared-4cd3936b.d.ts +93 -0
  130. package/esm/types-d9f9bbcc.d.ts +259 -0
  131. package/esm/typings-5e1b8383.d.ts +1 -1
  132. package/esm/typings-9211a437.d.ts +95 -0
  133. package/esm/utils-1574ad8b.d.ts +29 -0
  134. package/esm/utils-49cc3c24.d.ts +8 -0
  135. package/{esm/hook-b4e70cb0.d.ts → hook-9ea9e32c.d.ts} +12 -10
  136. package/index-50136800.d.ts +11 -0
  137. package/{index-425c8522.d.ts → index-72dda473.d.ts} +7 -1
  138. package/index-bdb4c6b9.d.ts +2 -172
  139. package/index-c76d6398.d.ts +2 -0
  140. package/index-ebda875c.d.ts +94 -56
  141. package/index-f12ee135.d.ts +3 -287
  142. package/index.d.ts +2 -3
  143. package/index.js +10 -9
  144. package/mobile-06ffd24b.d.ts +5 -0
  145. package/mobile-96988a65.d.ts +3 -0
  146. package/mobile.css +4 -4
  147. package/mobile.d.ts +2 -2
  148. package/mobile.js +4 -5
  149. package/{mobile.module-80b4093b.js → mobile.module-2c3c27e1.js} +1 -1
  150. package/modern/Component-50136800.d.ts +6 -0
  151. package/modern/Component-5e1b8383.d.ts +70 -3
  152. package/{esm/Component-3885b0d7.d.ts → modern/Component-63dec22f.d.ts} +24 -26
  153. package/{cssm/Component-425c8522.d.ts → modern/Component-72dda473.d.ts} +1 -1
  154. package/modern/Component-bdb4c6b9.d.ts +10 -7
  155. package/modern/Component-c76d6398.d.ts +5 -0
  156. package/modern/Component-ebda875c.d.ts +9 -98
  157. package/modern/Component.desktop-ebda875c.d.ts +6 -0
  158. package/modern/Component.desktop.d.ts +11 -65
  159. package/modern/Component.desktop.js +2 -2
  160. package/modern/Component.mobile-06ffd24b.d.ts +41 -0
  161. package/modern/Component.mobile-ebda875c.d.ts +6 -0
  162. package/{cssm/Component.mobile-e81c389f.d.ts → modern/Component.mobile-f1f15074.d.ts} +2 -6
  163. package/modern/Component.mobile.d.ts +8 -9
  164. package/modern/Component.mobile.js +6 -6
  165. package/modern/Component.modal.mobile-5e1b8383.d.ts +60 -0
  166. package/modern/Component.modal.mobile.d.ts +7 -39
  167. package/modern/Component.modal.mobile.js +5 -5
  168. package/modern/Component.responsive.d.ts +12 -71
  169. package/modern/Component.responsive.js +7 -5
  170. package/modern/autocomplete-field/Component.d.ts +1 -1
  171. package/modern/autocomplete-field/Component.js +4 -4
  172. package/modern/autocomplete-field/index.css +2 -2
  173. package/modern/autocomplete-field/index.js +1 -1
  174. package/modern/autocomplete-mobile-field/Component.d.ts +9 -5
  175. package/modern/autocomplete-mobile-field/Component.js +7 -7
  176. package/modern/autocomplete-mobile-field/index.css +8 -8
  177. package/modern/autocomplete-mobile-field/index.js +1 -1
  178. package/modern/component-50136800.d.ts +44 -0
  179. package/modern/desktop-63dec22f.d.ts +6 -0
  180. package/modern/desktop.d.ts +1 -1
  181. package/modern/desktop.js +2 -2
  182. package/modern/{hook-b4e70cb0.d.ts → hook-9ea9e32c.d.ts} +12 -10
  183. package/modern/index-50136800.d.ts +11 -0
  184. package/modern/{index-425c8522.d.ts → index-72dda473.d.ts} +7 -1
  185. package/modern/index-bdb4c6b9.d.ts +2 -172
  186. package/modern/index-c76d6398.d.ts +2 -0
  187. package/modern/index-ebda875c.d.ts +94 -56
  188. package/modern/index-f12ee135.d.ts +3 -287
  189. package/modern/index.d.ts +2 -3
  190. package/modern/index.js +10 -8
  191. package/modern/mobile-06ffd24b.d.ts +5 -0
  192. package/modern/mobile-96988a65.d.ts +3 -0
  193. package/modern/mobile.css +4 -4
  194. package/modern/mobile.d.ts +2 -2
  195. package/modern/mobile.js +4 -5
  196. package/modern/{mobile.module-93c1e0e2.js → mobile.module-990d8697.js} +1 -1
  197. package/modern/shared-4cd3936b.d.ts +93 -0
  198. package/modern/types-d9f9bbcc.d.ts +259 -0
  199. package/modern/typings-5e1b8383.d.ts +1 -1
  200. package/modern/typings-9211a437.d.ts +95 -0
  201. package/modern/utils-1574ad8b.d.ts +29 -0
  202. package/modern/utils-49cc3c24.d.ts +8 -0
  203. package/package.json +25 -5
  204. package/shared-4cd3936b.d.ts +93 -0
  205. package/src/Component.desktop.tsx +89 -0
  206. package/src/Component.mobile.tsx +251 -0
  207. package/src/Component.modal.mobile.tsx +227 -0
  208. package/src/Component.responsive.tsx +40 -0
  209. package/src/autocomplete-field/Component.tsx +91 -0
  210. package/src/autocomplete-field/index.module.css +3 -0
  211. package/src/autocomplete-field/index.ts +1 -0
  212. package/src/autocomplete-mobile-field/Component.tsx +77 -0
  213. package/src/autocomplete-mobile-field/index.module.css +37 -0
  214. package/src/autocomplete-mobile-field/index.ts +1 -0
  215. package/src/desktop.ts +1 -0
  216. package/src/index.ts +4 -0
  217. package/src/mobile.module.css +14 -0
  218. package/src/mobile.ts +5 -0
  219. package/types-d9f9bbcc.d.ts +259 -0
  220. package/typings-5e1b8383.d.ts +1 -1
  221. package/typings-9211a437.d.ts +95 -0
  222. package/utils-1574ad8b.d.ts +29 -0
  223. package/utils-49cc3c24.d.ts +8 -0
  224. package/Component-aed0af6e.d.ts +0 -11
  225. package/Component-b4e70cb0.d.ts +0 -22
  226. package/Component-f12ee135.d.ts +0 -71
  227. package/cssm/Component-aed0af6e.d.ts +0 -11
  228. package/cssm/Component-b4e70cb0.d.ts +0 -22
  229. package/cssm/Component-f12ee135.d.ts +0 -71
  230. package/cssm/index-3885b0d7.d.ts +0 -3
  231. package/cssm/index-3e68f8db.d.ts +0 -5
  232. package/cssm/index-e81c389f.d.ts +0 -3
  233. package/cssm/responsive.d.ts +0 -2
  234. package/cssm/responsive.js +0 -26
  235. package/esm/Component-aed0af6e.d.ts +0 -11
  236. package/esm/Component-b4e70cb0.d.ts +0 -22
  237. package/esm/Component-f12ee135.d.ts +0 -71
  238. package/esm/index-3885b0d7.d.ts +0 -3
  239. package/esm/index-3e68f8db.d.ts +0 -5
  240. package/esm/index-e81c389f.d.ts +0 -3
  241. package/esm/responsive.d.ts +0 -2
  242. package/esm/responsive.js +0 -16
  243. package/index-3885b0d7.d.ts +0 -3
  244. package/index-3e68f8db.d.ts +0 -5
  245. package/index-e81c389f.d.ts +0 -3
  246. package/modern/Component-aed0af6e.d.ts +0 -11
  247. package/modern/Component-b4e70cb0.d.ts +0 -22
  248. package/modern/Component-f12ee135.d.ts +0 -71
  249. package/modern/index-3885b0d7.d.ts +0 -3
  250. package/modern/index-3e68f8db.d.ts +0 -5
  251. package/modern/index-e81c389f.d.ts +0 -3
  252. package/modern/responsive.d.ts +0 -2
  253. package/modern/responsive.js +0 -15
  254. package/responsive.d.ts +0 -2
  255. package/responsive.js +0 -24
  256. /package/cssm/{types-ebda875c.d.ts → types-83e2bd9e.d.ts} +0 -0
  257. /package/esm/{types-ebda875c.d.ts → types-83e2bd9e.d.ts} +0 -0
  258. /package/modern/{types-ebda875c.d.ts → types-83e2bd9e.d.ts} +0 -0
  259. /package/{types-ebda875c.d.ts → types-83e2bd9e.d.ts} +0 -0
@@ -0,0 +1,91 @@
1
+ import React, { useCallback, useRef } from 'react';
2
+ import mergeRefs from 'react-merge-refs';
3
+ import cn from 'classnames';
4
+
5
+ import { InputDesktop as DefaultInput } from '@alfalab/core-components-input/desktop';
6
+ import type { FieldProps } from '@alfalab/core-components-select/shared';
7
+
8
+ import { InputAutocompleteDesktopProps } from '../Component.desktop';
9
+
10
+ import styles from './index.module.css';
11
+
12
+ export type AutocompleteFieldProps = FieldProps &
13
+ Pick<InputAutocompleteDesktopProps, 'Input' | 'inputProps' | 'value' | 'onInput' | 'readOnly'>;
14
+
15
+ export const AutocompleteField = ({
16
+ label,
17
+ labelView = 'inner',
18
+ placeholder,
19
+ size,
20
+ Arrow,
21
+ Input = DefaultInput,
22
+ value,
23
+ error,
24
+ success,
25
+ hint,
26
+ disabled,
27
+ readOnly,
28
+ onInput,
29
+ inputProps = {},
30
+ innerProps,
31
+ }: AutocompleteFieldProps) => {
32
+ const inputRef = useRef<HTMLInputElement>(null);
33
+
34
+ const { onClick, onFocus } = innerProps;
35
+
36
+ const inputDisabled = disabled || readOnly;
37
+
38
+ const handleClick = useCallback(
39
+ (event: React.MouseEvent<HTMLDivElement>) => {
40
+ if (onClick) onClick(event);
41
+
42
+ if (inputRef.current) {
43
+ inputRef.current.focus();
44
+ }
45
+ },
46
+ [onClick],
47
+ );
48
+
49
+ return (
50
+ <Input
51
+ {...inputProps}
52
+ {...innerProps}
53
+ wrapperRef={mergeRefs([
54
+ innerProps.ref as React.Ref<HTMLElement>,
55
+ inputProps.wrapperRef as React.Ref<HTMLElement>,
56
+ ])}
57
+ ref={mergeRefs([inputRef, inputProps.ref as React.Ref<HTMLElement>])}
58
+ disabled={disabled}
59
+ readOnly={readOnly}
60
+ block={true}
61
+ label={label}
62
+ labelView={labelView}
63
+ placeholder={placeholder}
64
+ size={size}
65
+ error={error}
66
+ success={success}
67
+ hint={hint}
68
+ onChange={onInput}
69
+ onClick={inputDisabled ? undefined : handleClick}
70
+ onFocus={inputDisabled ? undefined : onFocus}
71
+ autoComplete='off'
72
+ value={value}
73
+ rightAddons={
74
+ (Arrow || inputProps.rightAddons) && (
75
+ <React.Fragment>
76
+ {inputProps.rightAddons}
77
+ {Arrow && (
78
+ <span
79
+ className={cn(styles.arrow, {
80
+ [styles.error]: error,
81
+ })}
82
+ >
83
+ {Arrow}
84
+ </span>
85
+ )}
86
+ </React.Fragment>
87
+ )
88
+ }
89
+ />
90
+ );
91
+ };
@@ -0,0 +1,3 @@
1
+ .arrow.error ~ * {
2
+ display: none;
3
+ }
@@ -0,0 +1 @@
1
+ export * from './Component';
@@ -0,0 +1,77 @@
1
+ import React, { useRef, useState } from 'react';
2
+ import cn from 'classnames';
3
+
4
+ import {
5
+ FormControlMobile,
6
+ FormControlMobileProps,
7
+ } from '@alfalab/core-components-form-control/mobile';
8
+ import type { FieldProps as BaseFieldProps } from '@alfalab/core-components-select/shared';
9
+ import { useFocus } from '@alfalab/hooks';
10
+
11
+ import styles from './index.module.css';
12
+
13
+ export type AutocompleteMobileFieldProps = FormControlMobileProps &
14
+ Omit<BaseFieldProps, 'selected' | 'multiple' | 'success'> & {
15
+ /**
16
+ * Значение поля ввода
17
+ */
18
+ value?: string;
19
+ };
20
+
21
+ export const AutocompleteMobileField = ({
22
+ size = 'm',
23
+ open,
24
+ disabled,
25
+ value,
26
+ innerProps,
27
+ dataTestId,
28
+ fieldClassName,
29
+ labelView = 'inner',
30
+ placeholder,
31
+ Arrow,
32
+ valueRenderer,
33
+ toggleMenu,
34
+ setSelectedItems,
35
+ selectedMultiple,
36
+ ...restProps
37
+ }: AutocompleteMobileFieldProps) => {
38
+ const [focused, setFocused] = useState(false);
39
+
40
+ const wrapperRef = useRef<HTMLDivElement>(null);
41
+
42
+ const [focusVisible] = useFocus(wrapperRef, 'keyboard');
43
+
44
+ const filled = Boolean(value);
45
+ const showPlaceholder = placeholder && !filled && labelView === 'outer';
46
+
47
+ return (
48
+ <div
49
+ className={styles.component}
50
+ ref={wrapperRef}
51
+ onFocus={() => setFocused(true)}
52
+ onBlur={() => setFocused(false)}
53
+ >
54
+ <FormControlMobile
55
+ fieldClassName={cn(styles.field, fieldClassName, {
56
+ [styles.disabled]: disabled,
57
+ [styles.focusVisible]: focusVisible,
58
+ })}
59
+ block={true}
60
+ size={size}
61
+ focused={focused}
62
+ disabled={disabled}
63
+ filled={filled}
64
+ labelView={labelView}
65
+ rightAddons={Arrow}
66
+ data-test-id={dataTestId}
67
+ {...restProps}
68
+ {...innerProps}
69
+ >
70
+ <div className={styles.contentWrapper}>
71
+ {showPlaceholder && <span className={styles.placeholder}>{placeholder}</span>}
72
+ {filled && <div className={styles.value}>{value}</div>}
73
+ </div>
74
+ </FormControlMobile>
75
+ </div>
76
+ );
77
+ };
@@ -0,0 +1,37 @@
1
+ @import '@alfalab/core-components-themes/src/default.css';
2
+
3
+ .component {
4
+ width: 100%;
5
+ outline: none;
6
+ }
7
+
8
+ .field:not(.disabled) {
9
+ cursor: pointer;
10
+ }
11
+
12
+ .disabled {
13
+ cursor: var(--disabled-cursor);
14
+ }
15
+
16
+ .placeholder {
17
+ color: var(--color-light-text-secondary);
18
+ }
19
+
20
+ .contentWrapper {
21
+ @mixin paragraph_component;
22
+
23
+ white-space: nowrap;
24
+ text-overflow: ellipsis;
25
+ overflow: hidden;
26
+ width: 100%;
27
+ }
28
+
29
+ .value {
30
+ overflow: hidden;
31
+ text-overflow: ellipsis;
32
+ text-align: left;
33
+ }
34
+
35
+ .focusVisible {
36
+ @mixin focus-outline;
37
+ }
@@ -0,0 +1 @@
1
+ export * from './Component';
package/src/desktop.ts ADDED
@@ -0,0 +1 @@
1
+ export { InputAutocompleteDesktop, InputAutocompleteDesktopProps } from './Component.desktop';
package/src/index.ts ADDED
@@ -0,0 +1,4 @@
1
+ export {
2
+ InputAutocompleteResponsive as InputAutocomplete,
3
+ InputAutocompleteResponsiveProps as InputAutocompleteProps,
4
+ } from './Component.responsive';
@@ -0,0 +1,14 @@
1
+ @import '@alfalab/core-components-themes/src/default.css';
2
+
3
+ .bottomAddonInput {
4
+ padding: 0 var(--gap-xs) var(--gap-xs);
5
+ box-sizing: border-box;
6
+ }
7
+
8
+ .footer {
9
+ display: flex;
10
+
11
+ & > button + button {
12
+ margin-left: var(--gap-m);
13
+ }
14
+ }
package/src/mobile.ts ADDED
@@ -0,0 +1,5 @@
1
+ export { InputAutocompleteMobile, InputAutocompleteMobileProps } from './Component.mobile';
2
+ export {
3
+ InputAutocompleteModalMobile,
4
+ InputAutocompleteModalMobileProps,
5
+ } from './Component.modal.mobile';
@@ -0,0 +1,259 @@
1
+ /// <reference types="react-transition-group" />
2
+ import { HTMLAttributes, ReactNode, RefObject } from 'react';
3
+ import { TransitionProps } from 'react-transition-group/Transition';
4
+ import { BaseModalProps } from "./index-bdb4c6b9";
5
+ import { NavigationBarProps } from "./index-c76d6398";
6
+ import { BackgroundColorType } from "./index-72dda473";
7
+ type BottomSheetTitleAlign = 'center' | 'left';
8
+ type BottomSheetProps = {
9
+ /**
10
+ * Контент
11
+ */
12
+ children?: ReactNode;
13
+ /**
14
+ * Управление видимостью
15
+ */
16
+ open: boolean;
17
+ /**
18
+ * Заголовок
19
+ */
20
+ title?: ReactNode;
21
+ /**
22
+ * Размер заголовка
23
+ */
24
+ titleSize?: NavigationBarProps['titleSize'];
25
+ /**
26
+ * Подзаголовок.
27
+ */
28
+ subtitle?: NavigationBarProps['subtitle'];
29
+ /**
30
+ * Кнопка действия (обычно, это кнопка закрытия)
31
+ */
32
+ actionButton?: ReactNode;
33
+ /**
34
+ * Нода, компонент или функция возвращающая их
35
+ *
36
+ * Контейнер к которому будут добавляться порталы
37
+ */
38
+ container?: BaseModalProps['container'];
39
+ /**
40
+ * Рендерить ли в контейнер через портал.
41
+ */
42
+ usePortal?: BaseModalProps['usePortal'];
43
+ /**
44
+ * Дополнительный класс
45
+ */
46
+ className?: string;
47
+ /**
48
+ * Дополнительный класс
49
+ */
50
+ contentClassName?: string;
51
+ /**
52
+ * Дополнительные пропсы на контейнер.
53
+ */
54
+ containerProps?: HTMLAttributes<HTMLDivElement>;
55
+ /**
56
+ * Дополнительный класс
57
+ */
58
+ containerClassName?: string;
59
+ /**
60
+ * Цвет фона
61
+ */
62
+ backgroundColor?: Extract<BackgroundColorType, 'primary' | 'secondary'>;
63
+ /**
64
+ * Дополнительный класс шапки
65
+ */
66
+ headerClassName?: string;
67
+ /**
68
+ * Дополнительный класс футера
69
+ */
70
+ footerClassName?: string;
71
+ /**
72
+ * Дополнительный класс для аддонов
73
+ */
74
+ addonClassName?: string;
75
+ /**
76
+ * Дополнительный класс для компонента крестика
77
+ */
78
+ closerClassName?: string;
79
+ /**
80
+ * Дополнительный класс для компонента стрелки назад
81
+ */
82
+ backerClassName?: string;
83
+ /**
84
+ * Дополнительный класс для компонента модального окна
85
+ */
86
+ modalClassName?: string;
87
+ /**
88
+ * Дополнительный класс для обертки модального окна
89
+ */
90
+ modalWrapperClassName?: string;
91
+ /**
92
+ * TransitionProps, прокидываются в компонент CSSTransitionProps.
93
+ */
94
+ transitionProps?: Partial<TransitionProps>;
95
+ /**
96
+ * Идентификатор для систем автоматизированного тестирования
97
+ */
98
+ dataTestId?: string;
99
+ /**
100
+ * z-index компонента
101
+ */
102
+ zIndex?: number;
103
+ /**
104
+ * Будет ли свайпаться шторка
105
+ * @default true
106
+ */
107
+ swipeable?: boolean;
108
+ /**
109
+ * Будет ли свайпаться контент
110
+ */
111
+ swipeableContent?: boolean;
112
+ /**
113
+ * Порог свайпа
114
+ */
115
+ swipeThreshold?: number;
116
+ /**
117
+ * Слот слева
118
+ */
119
+ leftAddons?: ReactNode;
120
+ /**
121
+ * Слот справа
122
+ */
123
+ rightAddons?: ReactNode;
124
+ /**
125
+ * Слот снизу
126
+ */
127
+ bottomAddons?: ReactNode;
128
+ /**
129
+ * Наличие компонента крестика
130
+ */
131
+ hasCloser?: boolean;
132
+ /**
133
+ * Наличие компонента стрелки назад
134
+ */
135
+ hasBacker?: boolean;
136
+ /**
137
+ * Выравнивание заголовка
138
+ */
139
+ titleAlign?: BottomSheetTitleAlign;
140
+ /**
141
+ * Фиксирует шапку
142
+ */
143
+ stickyHeader?: boolean;
144
+ /**
145
+ * Фиксирует футер
146
+ */
147
+ stickyFooter?: boolean;
148
+ /**
149
+ * Высота шторки
150
+ */
151
+ initialHeight?: 'default' | 'full';
152
+ /**
153
+ * Будет ли виден оверлэй
154
+ */
155
+ hideOverlay?: boolean;
156
+ /**
157
+ * Будет ли видна шапка
158
+ */
159
+ hideHeader?: boolean;
160
+ /**
161
+ * Будет ли обрезан заголовок
162
+ */
163
+ trimTitle?: boolean;
164
+ /**
165
+ * Запретить закрытие шторки кликом на оверлэй
166
+ */
167
+ disableOverlayClick?: boolean;
168
+ /**
169
+ * Отключает блокировку скролла при открытии модального окна
170
+ */
171
+ disableBlockingScroll?: boolean;
172
+ /**
173
+ * Отключает ловушку фокуса
174
+ */
175
+ disableFocusLock?: boolean;
176
+ /**
177
+ * @deprecated данный проп больше не используется, временно оставлен для обратной совместимости
178
+ * Не анимировать шторку при изменении размера вьюпорта
179
+ */
180
+ ignoreScreenChange?: boolean;
181
+ /**
182
+ * Свойства для Бэкдропа
183
+ */
184
+ backdropProps?: BaseModalProps['backdropProps'];
185
+ /**
186
+ * Реф на контейнер, в котором происходит скролл
187
+ */
188
+ scrollableContainerRef?: RefObject<HTMLElement>;
189
+ /**
190
+ * Реф для управления компонентом.
191
+ */
192
+ bottomSheetInstanceRef?: RefObject<{
193
+ scrollToArea: (idx: number) => void;
194
+ }>;
195
+ /**
196
+ * Реф на контейнер, в котором находится шторка
197
+ */
198
+ sheetContainerRef?: RefObject<HTMLElement>;
199
+ /**
200
+ * Магнитные области видимой высоты шторки.
201
+ * Можно использовать значения в пикселях - 10(число), либо в процентах - 10%(строка).
202
+ * По-умолчанию -[0, window.innerHeight - '24px']
203
+ * массив должен состоять минимум из 2 элементов
204
+ */
205
+ magneticAreas?: Array<number | string>;
206
+ /**
207
+ * Индекс точки из magneticAreas, к которому нужно примагнититься при первом открытии шторки.
208
+ */
209
+ initialActiveAreaIndex?: number;
210
+ /**
211
+ * Отключает скролл контентной области.
212
+ */
213
+ scrollLocked?: boolean;
214
+ /**
215
+ * Скрыть скроллбар внутри шторки
216
+ */
217
+ hideScrollbar?: boolean;
218
+ /**
219
+ * Верхний отступ шторки, если она открыта на максимальную высоту
220
+ */
221
+ headerOffset?: number;
222
+ /**
223
+ * Содержимое bottom-sheet всегда в DOM
224
+ */
225
+ keepMounted?: boolean;
226
+ /**
227
+ * Отключает автоматический перевод фокуса на bottom-sheet при открытии
228
+ */
229
+ disableAutoFocus?: boolean;
230
+ /**
231
+ * Отключает восстановление фокуса на предыдущем элементе после закрытия bottom-sheet
232
+ */
233
+ disableRestoreFocus?: boolean;
234
+ /**
235
+ * Отключает вызов `onClose` при нажатии Escape
236
+ */
237
+ disableEscapeKeyDown?: boolean;
238
+ /**
239
+ * Обработчик закрытия
240
+ */
241
+ onClose: () => void;
242
+ /**
243
+ * Обработчик нажатия на стрелку назад
244
+ */
245
+ onBack?: () => void;
246
+ /**
247
+ * Вызывается в начале анимации притягивания к одной из `magneticAreas`
248
+ */
249
+ onMagnetize?: (index: number) => void;
250
+ /**
251
+ * Вызывается после окончания анимации притягивания
252
+ */
253
+ onMagnetizeEnd?: () => void;
254
+ /**
255
+ * Вызывается при изменении положения шторки
256
+ */
257
+ onOffsetChange?: (offset: number, percent: number) => void;
258
+ };
259
+ export { BottomSheetTitleAlign, BottomSheetProps };
@@ -1,5 +1,6 @@
1
1
  import { AriaAttributes, FC, FocusEvent, MouseEvent, ReactElement, ReactNode, RefAttributes, SVGProps } from 'react';
2
2
  import { InputProps } from "@alfalab/core-components-input";
3
+ import { PopoverProps } from "./index-ebda875c";
3
4
  type AnyObject = Record<string, any>;
4
5
  type OptionShape = {
5
6
  /**
@@ -546,5 +547,4 @@ type CheckmarkProps = {
546
547
  */
547
548
  icon?: FC<SVGProps<SVGSVGElement>>;
548
549
  };
549
- export * from "./Component-ebda875c";
550
550
  export { AnyObject, OptionShape, GroupShape, BaseSelectChangePayload, BaseSelectProps, FieldProps, ArrowProps, OptionsListProps, OptgroupProps, OptionProps, CheckmarkProps };
@@ -0,0 +1,95 @@
1
+ import { AnchorHTMLAttributes, ButtonHTMLAttributes, ElementType, ReactNode } from 'react';
2
+ type StyleColors = {
3
+ default: {
4
+ [key: string]: string;
5
+ };
6
+ inverted: {
7
+ [key: string]: string;
8
+ };
9
+ };
10
+ type ComponentProps = {
11
+ /**
12
+ * Тип кнопки
13
+ * @default secondary
14
+ */
15
+ view?: 'accent' | 'primary' | 'secondary' | 'tertiary' | 'outlined' | 'filled' | 'transparent' | 'link' | 'ghost';
16
+ /**
17
+ * Слот слева
18
+ */
19
+ leftAddons?: ReactNode;
20
+ /**
21
+ * Слот справа
22
+ */
23
+ rightAddons?: ReactNode;
24
+ /**
25
+ * Размер компонента
26
+ * @default m
27
+ */
28
+ size?: 'xxs' | 'xs' | 's' | 'm' | 'l' | 'xl';
29
+ /**
30
+ * Растягивает компонент на ширину контейнера
31
+ * @default false
32
+ */
33
+ block?: boolean;
34
+ /**
35
+ * Дополнительный класс
36
+ */
37
+ className?: string;
38
+ /**
39
+ * Дополнительный класс для спиннера
40
+ */
41
+ spinnerClassName?: string;
42
+ /**
43
+ * Выводит ссылку в виде кнопки
44
+ */
45
+ href?: string;
46
+ /**
47
+ * Позволяет использовать кастомный компонент для кнопки (например Link из роутера)
48
+ */
49
+ Component?: ElementType;
50
+ /**
51
+ * Идентификатор для систем автоматизированного тестирования
52
+ */
53
+ dataTestId?: string;
54
+ /**
55
+ * Показать лоадер
56
+ * @default false
57
+ */
58
+ loading?: boolean;
59
+ /**
60
+ * Не переносить текст кнопки на новую строку
61
+ * @default false
62
+ */
63
+ nowrap?: boolean;
64
+ /**
65
+ * Набор цветов для компонента
66
+ */
67
+ colors?: 'default' | 'inverted';
68
+ /**
69
+ * Дочерние элементы.
70
+ */
71
+ children?: ReactNode;
72
+ /**
73
+ * Основные стили компонента.
74
+ */
75
+ styles: {
76
+ [key: string]: string;
77
+ };
78
+ /**
79
+ * Стили компонента для default и inverted режима.
80
+ */
81
+ colorStylesMap: StyleColors;
82
+ };
83
+ type AnchorBaseButtonProps = ComponentProps & AnchorHTMLAttributes<HTMLAnchorElement>;
84
+ type NativeBaseButtonProps = ComponentProps & ButtonHTMLAttributes<HTMLButtonElement>;
85
+ type BaseButtonProps = Partial<AnchorBaseButtonProps | NativeBaseButtonProps>;
86
+ type AnchorButtonProps = Omit<BaseButtonProps, 'styles' | 'colorStylesMap'> & AnchorHTMLAttributes<HTMLAnchorElement>;
87
+ type NativeButtonProps = Omit<BaseButtonProps, 'styles' | 'colorStylesMap'> & ButtonHTMLAttributes<HTMLButtonElement>;
88
+ type ButtonProps = Partial<AnchorButtonProps | NativeButtonProps> & {
89
+ /**
90
+ * Контрольная точка, с нее начинается desktop версия
91
+ * @default 1024
92
+ */
93
+ breakpoint?: number;
94
+ };
95
+ export { StyleColors, ComponentProps, AnchorBaseButtonProps, NativeBaseButtonProps, BaseButtonProps, AnchorButtonProps, NativeButtonProps, ButtonProps };
@@ -0,0 +1,29 @@
1
+ type SavedStyle = {
2
+ value: string;
3
+ key: string;
4
+ el: HTMLElement;
5
+ };
6
+ type RestoreStyle = {
7
+ container: HTMLElement;
8
+ modals: number;
9
+ styles: SavedStyle[];
10
+ };
11
+ declare class ModalStore {
12
+ private readonly restoreStyles;
13
+ constructor();
14
+ getRestoreStyles: () => RestoreStyle[];
15
+ }
16
+ declare const getModalStore: () => ModalStore;
17
+ declare class GlobalStore {
18
+ private readonly modalStore;
19
+ constructor();
20
+ getModalStore: () => ModalStore;
21
+ }
22
+ declare function isScrolledToTop(target: HTMLElement): boolean;
23
+ declare function isScrolledToBottom(target: HTMLElement): boolean;
24
+ declare function hasScrollbar(target: HTMLElement): boolean;
25
+ declare const getScrollbarSize: () => number;
26
+ declare const restoreContainerStyles: (container: HTMLElement) => void;
27
+ declare const handleContainer: (container?: HTMLElement) => void;
28
+ export type { SavedStyle };
29
+ export { getModalStore, GlobalStore, isScrolledToTop, isScrolledToBottom, hasScrollbar, getScrollbarSize, restoreContainerStyles, handleContainer };
@@ -0,0 +1,8 @@
1
+ declare const TIMEOUT = 500;
2
+ declare const SWIPE_VELOCITY = 0.4;
3
+ declare const MARKER_HEIGHT = 24;
4
+ declare const CLOSE_OFFSET = 0.2;
5
+ declare const SCROLL_OFFSET = 1;
6
+ declare const HEADER_OFFSET = 24;
7
+ declare const convertPercentToNumber: (value: string | number, fullHeight: number, headerOffset?: number) => number;
8
+ export { TIMEOUT, SWIPE_VELOCITY, MARKER_HEIGHT, CLOSE_OFFSET, SCROLL_OFFSET, HEADER_OFFSET, convertPercentToNumber };
@@ -1,11 +0,0 @@
1
- /// <reference types="react" />
2
- import React from 'react';
3
- import { CheckboxProps } from "./index-ebda875c";
4
- type HeaderProps = {
5
- checked?: boolean;
6
- indeterminate?: boolean;
7
- onChange?: CheckboxProps['onChange'];
8
- mobile?: boolean;
9
- };
10
- declare const Header: React.FC<HeaderProps>;
11
- export { HeaderProps, Header };
@@ -1,22 +0,0 @@
1
- /// <reference types="react" />
2
- import React from "react";
3
- import { OptionShape, OptionsListProps } from "./typings-5e1b8383";
4
- import { HeaderProps } from "./Component-aed0af6e";
5
- type FooterProps = {
6
- handleClear?: () => void;
7
- handleApply?: () => void;
8
- showClear?: boolean;
9
- selectedDraft?: OptionShape[];
10
- };
11
- declare const Footer: ({ handleApply, handleClear, showClear, selectedDraft }: FooterProps) => React.JSX.Element;
12
- declare const OptionsListWithApply: React.ForwardRefExoticComponent<OptionsListProps & {
13
- showClear?: boolean | undefined;
14
- onClose?: (() => void) | undefined;
15
- selectedDraft?: OptionShape[] | undefined;
16
- OptionsList?: React.FC<OptionsListProps & React.RefAttributes<HTMLDivElement>> | undefined;
17
- Footer?: React.FC<FooterProps> | undefined;
18
- Header?: React.FC<HeaderProps> | undefined;
19
- headerProps?: HeaderProps | undefined;
20
- showHeaderWithSelectAll?: boolean | undefined;
21
- } & React.RefAttributes<HTMLDivElement>>;
22
- export { FooterProps, Footer, OptionsListWithApply };