@alfalab/core-components-input-autocomplete 10.3.0 → 11.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (110) hide show
  1. package/Component.desktop.d.ts +3 -70
  2. package/Component.desktop.js +2 -1
  3. package/Component.mobile.d.ts +5 -95
  4. package/Component.mobile.js +42 -45
  5. package/Component.modal.mobile.d.ts +5 -88
  6. package/Component.modal.mobile.js +9 -62
  7. package/Component.responsive.d.ts +3 -46
  8. package/Component.responsive.js +9 -12
  9. package/autocomplete-field/Component.d.ts +2 -2
  10. package/autocomplete-field/Component.js +1 -1
  11. package/autocomplete-field/index.css +2 -2
  12. package/autocomplete-mobile-field/Component.js +6 -3
  13. package/autocomplete-mobile-field/index.css +10 -10
  14. package/cssm/Component.desktop.d.ts +3 -70
  15. package/cssm/Component.desktop.js +2 -1
  16. package/cssm/Component.mobile.d.ts +5 -95
  17. package/cssm/Component.mobile.js +39 -44
  18. package/cssm/Component.modal.mobile.d.ts +5 -88
  19. package/cssm/Component.modal.mobile.js +10 -63
  20. package/cssm/Component.responsive.d.ts +3 -46
  21. package/cssm/Component.responsive.js +9 -11
  22. package/cssm/autocomplete-field/Component.d.ts +2 -2
  23. package/cssm/autocomplete-mobile-field/Component.js +5 -2
  24. package/cssm/autocomplete-mobile-field/index.module.css +2 -2
  25. package/cssm/desktop/index.d.ts +2 -2
  26. package/cssm/desktop/index.js +1 -0
  27. package/cssm/index.d.ts +2 -2
  28. package/cssm/index.js +5 -4
  29. package/cssm/mobile/index.d.ts +3 -3
  30. package/cssm/mobile/index.js +2 -2
  31. package/cssm/mobile.module.css +3 -10
  32. package/cssm/types.d.ts +58 -0
  33. package/cssm/types.js +2 -0
  34. package/cssm/utils.d.ts +2 -0
  35. package/cssm/utils.js +9 -0
  36. package/desktop/index.d.ts +2 -2
  37. package/desktop/index.js +1 -0
  38. package/esm/Component.desktop.d.ts +3 -70
  39. package/esm/Component.desktop.js +2 -1
  40. package/esm/Component.mobile.d.ts +5 -95
  41. package/esm/Component.mobile.js +43 -46
  42. package/esm/Component.modal.mobile.d.ts +5 -88
  43. package/esm/Component.modal.mobile.js +11 -61
  44. package/esm/Component.responsive.d.ts +3 -46
  45. package/esm/Component.responsive.js +9 -12
  46. package/esm/autocomplete-field/Component.d.ts +2 -2
  47. package/esm/autocomplete-field/Component.js +1 -1
  48. package/esm/autocomplete-field/index.css +2 -2
  49. package/esm/autocomplete-mobile-field/Component.js +6 -3
  50. package/esm/autocomplete-mobile-field/index.css +10 -10
  51. package/esm/desktop/index.d.ts +2 -2
  52. package/esm/desktop/index.js +1 -0
  53. package/esm/index.d.ts +2 -2
  54. package/esm/index.js +5 -5
  55. package/esm/mobile/index.d.ts +3 -3
  56. package/esm/mobile/index.js +2 -3
  57. package/esm/mobile.css +4 -11
  58. package/esm/types.d.ts +58 -0
  59. package/esm/types.js +1 -0
  60. package/esm/utils.d.ts +2 -0
  61. package/esm/utils.js +5 -0
  62. package/index.d.ts +2 -2
  63. package/index.js +5 -5
  64. package/mobile/index.d.ts +3 -3
  65. package/mobile/index.js +2 -3
  66. package/mobile.css +4 -11
  67. package/modern/Component.desktop.d.ts +3 -70
  68. package/modern/Component.desktop.js +2 -1
  69. package/modern/Component.mobile.d.ts +5 -95
  70. package/modern/Component.mobile.js +54 -56
  71. package/modern/Component.modal.mobile.d.ts +5 -88
  72. package/modern/Component.modal.mobile.js +10 -68
  73. package/modern/Component.responsive.d.ts +3 -46
  74. package/modern/Component.responsive.js +8 -11
  75. package/modern/autocomplete-field/Component.d.ts +2 -2
  76. package/modern/autocomplete-field/Component.js +1 -1
  77. package/modern/autocomplete-field/index.css +2 -2
  78. package/modern/autocomplete-mobile-field/Component.js +5 -2
  79. package/modern/autocomplete-mobile-field/index.css +10 -10
  80. package/modern/desktop/index.d.ts +2 -2
  81. package/modern/desktop/index.js +1 -0
  82. package/modern/index.d.ts +2 -2
  83. package/modern/index.js +5 -5
  84. package/modern/mobile/index.d.ts +3 -3
  85. package/modern/mobile/index.js +2 -3
  86. package/modern/mobile.css +4 -11
  87. package/modern/types.d.ts +58 -0
  88. package/modern/types.js +1 -0
  89. package/modern/utils.d.ts +2 -0
  90. package/modern/utils.js +5 -0
  91. package/package.json +7 -6
  92. package/src/Component.desktop.tsx +6 -44
  93. package/src/Component.mobile.tsx +90 -188
  94. package/src/Component.modal.mobile.tsx +5 -223
  95. package/src/Component.responsive.tsx +10 -30
  96. package/src/autocomplete-field/Component.tsx +2 -2
  97. package/src/autocomplete-mobile-field/Component.tsx +5 -1
  98. package/src/desktop/index.ts +2 -1
  99. package/src/index.ts +2 -4
  100. package/src/mobile/index.ts +4 -5
  101. package/src/mobile.module.css +2 -11
  102. package/src/types.ts +77 -0
  103. package/src/utils.ts +3 -0
  104. package/types.d.ts +58 -0
  105. package/types.js +2 -0
  106. package/utils.d.ts +2 -0
  107. package/utils.js +9 -0
  108. package/esm/mobile.module-846d8b52.js +0 -4
  109. package/mobile.module-7c0f2a72.js +0 -6
  110. package/modern/mobile.module-7bf90bfc.js +0 -4
@@ -1,5 +1,4 @@
1
- export { InputAutocompleteMobile, InputAutocompleteMobileProps } from '../Component.mobile';
2
- export {
3
- InputAutocompleteModalMobile,
4
- InputAutocompleteModalMobileProps,
5
- } from '../Component.modal.mobile';
1
+ export { InputAutocompleteMobile } from '../Component.mobile';
2
+ export { InputAutocompleteModalMobile } from '../Component.modal.mobile';
3
+
4
+ export { InputAutocompleteMobileProps } from '../types';
@@ -1,14 +1,5 @@
1
1
  @import '@alfalab/core-components-themes/src/default.css';
2
2
 
3
- .bottomAddonInput {
4
- padding: 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
- }
3
+ .input {
4
+ width: auto;
14
5
  }
package/src/types.ts ADDED
@@ -0,0 +1,77 @@
1
+ import type { ChangeEvent, FC, RefAttributes } from 'react';
2
+
3
+ import type { InputProps } from '@alfalab/core-components-input';
4
+ import type {
5
+ BaseSelectProps,
6
+ BottomSheetSelectMobileProps,
7
+ } from '@alfalab/core-components-select/shared';
8
+
9
+ export interface InputAutocompleteCommonProps
10
+ extends Omit<
11
+ BaseSelectProps,
12
+ 'autocomplete' | 'Field' | 'nativeSelect' | 'searchProps' | 'showSearch' | 'Search'
13
+ > {
14
+ /**
15
+ * Компонент ввода значения
16
+ */
17
+ Input?: FC<InputProps & RefAttributes<HTMLInputElement>>;
18
+
19
+ /**
20
+ * Пропсы, которые будут прокинуты в инпут
21
+ */
22
+ inputProps?: InputProps & Record<string, unknown>;
23
+
24
+ /**
25
+ * Значение поля ввода
26
+ */
27
+ value?: string;
28
+
29
+ /**
30
+ * Поле доступно только для чтения
31
+ */
32
+ readOnly?: InputProps['readOnly'];
33
+
34
+ /**
35
+ * Отображение иконки успеха
36
+ */
37
+ success?: boolean;
38
+
39
+ /**
40
+ * Обработчик ввода
41
+ */
42
+ onInput?: (event: ChangeEvent<HTMLInputElement> | null, payload: { value: string }) => void;
43
+ }
44
+
45
+ type MobileProps = {
46
+ /**
47
+ * Открывать в bottom-sheet
48
+ */
49
+ isBottomSheet?: boolean;
50
+
51
+ /**
52
+ * Пропсы анимации контента (CSSTransition)
53
+ */
54
+ transitionProps?: NonNullable<
55
+ BottomSheetSelectMobileProps['bottomSheetProps']
56
+ >['transitionProps'];
57
+ };
58
+
59
+ export type InputAutocompleteMobileProps = InputAutocompleteCommonProps & MobileProps;
60
+
61
+ export interface InputAutocompleteProps extends InputAutocompleteCommonProps {
62
+ /**
63
+ * Пропсы для мобильного компонента
64
+ */
65
+ mobileProps?: MobileProps;
66
+
67
+ /**
68
+ * Контрольная точка, с нее начинается desktop версия
69
+ * @default 1024
70
+ */
71
+ breakpoint?: number;
72
+
73
+ /**
74
+ * Значение по-умолчанию для хука useMatchMedia
75
+ */
76
+ defaultMatchMediaValue?: boolean | (() => boolean);
77
+ }
package/src/utils.ts ADDED
@@ -0,0 +1,3 @@
1
+ export function searchFilterStub() {
2
+ return true;
3
+ }
package/types.d.ts ADDED
@@ -0,0 +1,58 @@
1
+ import { ChangeEvent, FC, RefAttributes } from 'react';
2
+ import { InputProps } from "@alfalab/core-components-input";
3
+ import { BaseSelectProps, BottomSheetSelectMobileProps } from "@alfalab/core-components-select/shared";
4
+ interface InputAutocompleteCommonProps extends Omit<BaseSelectProps, 'autocomplete' | 'Field' | 'nativeSelect' | 'searchProps' | 'showSearch' | 'Search'> {
5
+ /**
6
+ * Компонент ввода значения
7
+ */
8
+ Input?: FC<InputProps & RefAttributes<HTMLInputElement>>;
9
+ /**
10
+ * Пропсы, которые будут прокинуты в инпут
11
+ */
12
+ inputProps?: InputProps & Record<string, unknown>;
13
+ /**
14
+ * Значение поля ввода
15
+ */
16
+ value?: string;
17
+ /**
18
+ * Поле доступно только для чтения
19
+ */
20
+ readOnly?: InputProps['readOnly'];
21
+ /**
22
+ * Отображение иконки успеха
23
+ */
24
+ success?: boolean;
25
+ /**
26
+ * Обработчик ввода
27
+ */
28
+ onInput?: (event: ChangeEvent<HTMLInputElement> | null, payload: {
29
+ value: string;
30
+ }) => void;
31
+ }
32
+ type MobileProps = {
33
+ /**
34
+ * Открывать в bottom-sheet
35
+ */
36
+ isBottomSheet?: boolean;
37
+ /**
38
+ * Пропсы анимации контента (CSSTransition)
39
+ */
40
+ transitionProps?: NonNullable<BottomSheetSelectMobileProps['bottomSheetProps']>['transitionProps'];
41
+ };
42
+ type InputAutocompleteMobileProps = InputAutocompleteCommonProps & MobileProps;
43
+ interface InputAutocompleteProps extends InputAutocompleteCommonProps {
44
+ /**
45
+ * Пропсы для мобильного компонента
46
+ */
47
+ mobileProps?: MobileProps;
48
+ /**
49
+ * Контрольная точка, с нее начинается desktop версия
50
+ * @default 1024
51
+ */
52
+ breakpoint?: number;
53
+ /**
54
+ * Значение по-умолчанию для хука useMatchMedia
55
+ */
56
+ defaultMatchMediaValue?: boolean | (() => boolean);
57
+ }
58
+ export { InputAutocompleteCommonProps, InputAutocompleteMobileProps, InputAutocompleteProps };
package/types.js ADDED
@@ -0,0 +1,2 @@
1
+ 'use strict';
2
+
package/utils.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ declare function searchFilterStub(): boolean;
2
+ export { searchFilterStub };
package/utils.js ADDED
@@ -0,0 +1,9 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ function searchFilterStub() {
6
+ return true;
7
+ }
8
+
9
+ exports.searchFilterStub = searchFilterStub;
@@ -1,4 +0,0 @@
1
- var styles = {"bottomAddonInput":"input-autocomplete__bottomAddonInput_17ohn","footer":"input-autocomplete__footer_17ohn"};
2
- require('./mobile.css')
3
-
4
- export { styles as s };
@@ -1,6 +0,0 @@
1
- 'use strict';
2
-
3
- var styles = {"bottomAddonInput":"input-autocomplete__bottomAddonInput_17ohn","footer":"input-autocomplete__footer_17ohn"};
4
- require('./mobile.css')
5
-
6
- exports.styles = styles;
@@ -1,4 +0,0 @@
1
- const styles = {"bottomAddonInput":"input-autocomplete__bottomAddonInput_17ohn","footer":"input-autocomplete__footer_17ohn"};
2
- require('./mobile.css')
3
-
4
- export { styles as s };