@alfalab/core-components-select 13.2.11 → 13.2.13
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.
- package/{cssm/Component-29488b22.d.ts → Component-088caba2.d.ts} +285 -51
- package/{Component-fc2a45a0.js → Component-088caba2.js} +31 -26
- package/{Component-0a2300e8.d.ts → Component-ca307b80.d.ts} +0 -0
- package/{Component-0a2300e8.js → Component-ca307b80.js} +10 -10
- package/Component.js +4 -4
- package/Component.responsive.js +7 -6
- package/components/arrow/Component.js +1 -1
- package/components/arrow/index.css +3 -3
- package/components/base-checkmark/Component.js +1 -1
- package/components/base-checkmark/index.css +4 -4
- package/components/base-option/Component.js +3 -3
- package/components/base-option/index.css +13 -13
- package/components/base-option/index.js +1 -1
- package/components/base-select/Component.js +2 -2
- package/components/base-select/index.css +7 -7
- package/components/base-select/index.d.ts +1 -1
- package/components/base-select/index.js +2 -2
- package/components/base-select-mobile/Component.js +5 -4
- package/components/base-select-mobile/checkmark/Component.js +1 -1
- package/components/base-select-mobile/checkmark/index.css +6 -6
- package/components/base-select-mobile/index.css +11 -11
- package/components/base-select-mobile/index.d.ts +1 -1
- package/components/base-select-mobile/index.js +5 -4
- package/components/base-select-mobile/options-list/Component.js +3 -3
- package/components/base-select-mobile/options-list/index.css +9 -9
- package/components/base-select-mobile/options-list/index.js +1 -1
- package/components/base-select-mobile/virtual-options-list/Component.d.ts +5 -0
- package/components/base-select-mobile/virtual-options-list/Component.js +112 -0
- package/components/base-select-mobile/virtual-options-list/index.css +89 -0
- package/components/base-select-mobile/virtual-options-list/index.d.ts +1 -0
- package/components/base-select-mobile/virtual-options-list/index.js +16 -0
- package/components/checkmark/Component.js +1 -1
- package/components/checkmark/index.css +10 -10
- package/components/field/Component.js +4 -4
- package/components/field/index.css +9 -9
- package/components/field/index.js +1 -1
- package/components/index.js +5 -4
- package/components/native-select/Component.js +4 -4
- package/components/native-select/index.js +1 -1
- package/components/optgroup/Component.js +1 -1
- package/components/optgroup/index.css +6 -6
- package/components/option/Component.js +3 -3
- package/components/option/index.css +20 -20
- package/components/option/index.js +1 -1
- package/components/options-list/Component.js +5 -5
- package/components/options-list/index.css +6 -6
- package/components/options-list/index.js +1 -1
- package/components/select-mobile/Component.js +5 -4
- package/components/select-mobile/index.d.ts +1 -1
- package/components/select-mobile/index.js +5 -4
- package/components/select-modal-mobile/Component.js +5 -4
- package/components/select-modal-mobile/index.d.ts +1 -1
- package/components/select-modal-mobile/index.js +5 -4
- package/components/virtual-options-list/Component.js +4 -4
- package/components/virtual-options-list/index.css +12 -12
- package/components/virtual-options-list/index.js +1 -1
- package/cssm/{Component-d0e84442.d.ts → Component-1481ef6b.d.ts} +0 -0
- package/cssm/{Component-d0e84442.js → Component-1481ef6b.js} +9 -9
- package/{modern/Component-3b90d09b.d.ts → cssm/Component-8f0723b4.d.ts} +285 -51
- package/cssm/{Component-29488b22.js → Component-8f0723b4.js} +28 -23
- package/cssm/Component.js +4 -4
- package/cssm/Component.responsive.js +7 -5
- package/cssm/components/base-option/Component.js +2 -2
- package/cssm/components/base-option/index.js +1 -1
- package/cssm/components/base-select/Component.js +2 -2
- package/cssm/components/base-select/index.d.ts +1 -1
- package/cssm/components/base-select/index.js +2 -2
- package/cssm/components/base-select-mobile/Component.js +5 -3
- package/cssm/components/base-select-mobile/index.d.ts +1 -1
- package/cssm/components/base-select-mobile/index.js +5 -3
- package/cssm/components/base-select-mobile/options-list/Component.js +2 -2
- package/cssm/components/base-select-mobile/options-list/index.js +1 -1
- package/cssm/components/base-select-mobile/virtual-options-list/Component.d.ts +5 -0
- package/cssm/components/base-select-mobile/virtual-options-list/Component.js +112 -0
- package/cssm/components/base-select-mobile/virtual-options-list/index.d.ts +1 -0
- package/cssm/components/base-select-mobile/virtual-options-list/index.js +18 -0
- package/cssm/components/base-select-mobile/virtual-options-list/index.module.css +88 -0
- package/cssm/components/field/Component.js +3 -3
- package/cssm/components/field/index.js +1 -1
- package/cssm/components/index.js +5 -3
- package/cssm/components/native-select/Component.js +4 -4
- package/cssm/components/native-select/index.js +1 -1
- package/cssm/components/option/Component.js +2 -2
- package/cssm/components/option/index.js +1 -1
- package/cssm/components/options-list/Component.js +4 -4
- package/cssm/components/options-list/index.js +1 -1
- package/cssm/components/select-mobile/Component.js +5 -3
- package/cssm/components/select-mobile/index.d.ts +1 -1
- package/cssm/components/select-mobile/index.js +5 -3
- package/cssm/components/select-modal-mobile/Component.js +5 -3
- package/cssm/components/select-modal-mobile/index.d.ts +1 -1
- package/cssm/components/select-modal-mobile/index.js +5 -3
- package/cssm/components/virtual-options-list/Component.js +3 -3
- package/cssm/components/virtual-options-list/index.js +1 -1
- package/cssm/index.js +5 -3
- package/cssm/presets/index.js +5 -3
- package/cssm/presets/useLazyLoading/hook.js +9 -9
- package/cssm/presets/useSelectWithApply/hook.js +5 -3
- package/cssm/presets/useSelectWithApply/options-list-with-apply/Component.js +5 -3
- package/cssm/presets/useSelectWithApply/options-list-with-apply/index.d.ts +1 -1
- package/cssm/presets/useSelectWithApply/options-list-with-apply/index.js +5 -3
- package/cssm/presets/useSelectWithLoading/hook.js +2 -2
- package/cssm/responsive.js +5 -3
- package/cssm/utils.js +1 -1
- package/{Component-fc2a45a0.d.ts → esm/Component-23df669b.d.ts} +285 -51
- package/esm/{Component-dd382646.js → Component-23df669b.js} +15 -10
- package/esm/{Component-4b015ad5.d.ts → Component-82c9c6a4.d.ts} +0 -0
- package/esm/{Component-4b015ad5.js → Component-82c9c6a4.js} +2 -2
- package/esm/Component.js +2 -2
- package/esm/Component.responsive.js +5 -4
- package/esm/components/arrow/Component.js +1 -1
- package/esm/components/arrow/index.css +3 -3
- package/esm/components/base-checkmark/Component.js +1 -1
- package/esm/components/base-checkmark/index.css +4 -4
- package/esm/components/base-option/Component.js +2 -2
- package/esm/components/base-option/index.css +13 -13
- package/esm/components/base-option/index.js +1 -1
- package/esm/components/base-select/Component.js +2 -2
- package/esm/components/base-select/index.css +7 -7
- package/esm/components/base-select/index.d.ts +1 -1
- package/esm/components/base-select/index.js +2 -2
- package/esm/components/base-select-mobile/Component.js +5 -4
- package/esm/components/base-select-mobile/checkmark/Component.js +1 -1
- package/esm/components/base-select-mobile/checkmark/index.css +6 -6
- package/esm/components/base-select-mobile/index.css +11 -11
- package/esm/components/base-select-mobile/index.d.ts +1 -1
- package/esm/components/base-select-mobile/index.js +5 -4
- package/esm/components/base-select-mobile/options-list/Component.js +2 -2
- package/esm/components/base-select-mobile/options-list/index.css +9 -9
- package/esm/components/base-select-mobile/options-list/index.js +1 -1
- package/esm/components/base-select-mobile/virtual-options-list/Component.d.ts +5 -0
- package/esm/components/base-select-mobile/virtual-options-list/Component.js +105 -0
- package/esm/components/base-select-mobile/virtual-options-list/index.css +89 -0
- package/esm/components/base-select-mobile/virtual-options-list/index.d.ts +1 -0
- package/esm/components/base-select-mobile/virtual-options-list/index.js +10 -0
- package/esm/components/checkmark/Component.js +1 -1
- package/esm/components/checkmark/index.css +10 -10
- package/esm/components/field/Component.js +2 -2
- package/esm/components/field/index.css +9 -9
- package/esm/components/field/index.js +1 -1
- package/esm/components/index.js +5 -4
- package/esm/components/native-select/Component.js +1 -1
- package/esm/components/native-select/index.js +1 -1
- package/esm/components/optgroup/Component.js +1 -1
- package/esm/components/optgroup/index.css +6 -6
- package/esm/components/option/Component.js +2 -2
- package/esm/components/option/index.css +20 -20
- package/esm/components/option/index.js +1 -1
- package/esm/components/options-list/Component.js +2 -2
- package/esm/components/options-list/index.css +6 -6
- package/esm/components/options-list/index.js +1 -1
- package/esm/components/select-mobile/Component.js +5 -4
- package/esm/components/select-mobile/index.d.ts +1 -1
- package/esm/components/select-mobile/index.js +5 -4
- package/esm/components/select-modal-mobile/Component.js +5 -4
- package/esm/components/select-modal-mobile/index.d.ts +1 -1
- package/esm/components/select-modal-mobile/index.js +5 -4
- package/esm/components/virtual-options-list/Component.js +2 -2
- package/esm/components/virtual-options-list/index.css +12 -12
- package/esm/components/virtual-options-list/index.js +1 -1
- package/esm/index.js +5 -4
- package/esm/{intersection-observer-48ccda2c.d.ts → intersection-observer-12c920c6.d.ts} +0 -0
- package/esm/{intersection-observer-48ccda2c.js → intersection-observer-12c920c6.js} +0 -0
- package/esm/presets/index.js +5 -4
- package/esm/presets/useLazyLoading/hook.js +3 -3
- package/esm/presets/useLazyLoading/index.css +2 -2
- package/esm/presets/useSelectWithApply/hook.js +5 -4
- package/esm/presets/useSelectWithApply/options-list-with-apply/Component.js +5 -4
- package/esm/presets/useSelectWithApply/options-list-with-apply/index.css +4 -4
- package/esm/presets/useSelectWithApply/options-list-with-apply/index.d.ts +1 -1
- package/esm/presets/useSelectWithApply/options-list-with-apply/index.js +5 -4
- package/esm/presets/useSelectWithLoading/hook.js +2 -2
- package/esm/presets/useSelectWithLoading/index.css +2 -2
- package/esm/responsive.js +5 -4
- package/esm/utils.js +1 -1
- package/index.js +5 -4
- package/{intersection-observer-404c5a30.d.ts → intersection-observer-31caed5c.d.ts} +0 -0
- package/{intersection-observer-404c5a30.js → intersection-observer-31caed5c.js} +0 -0
- package/{esm/Component-dd382646.d.ts → modern/Component-629f202b.d.ts} +285 -51
- package/modern/{Component-3b90d09b.js → Component-629f202b.js} +14 -9
- package/modern/{Component-19b9374d.d.ts → Component-c2743e76.d.ts} +0 -0
- package/modern/{Component-19b9374d.js → Component-c2743e76.js} +1 -1
- package/modern/Component.js +1 -1
- package/modern/Component.responsive.js +4 -3
- package/modern/components/arrow/Component.js +1 -1
- package/modern/components/arrow/index.css +3 -3
- package/modern/components/base-checkmark/Component.js +1 -1
- package/modern/components/base-checkmark/index.css +4 -4
- package/modern/components/base-option/Component.js +1 -1
- package/modern/components/base-option/index.css +13 -13
- package/modern/components/base-select/Component.js +1 -1
- package/modern/components/base-select/index.css +7 -7
- package/modern/components/base-select/index.d.ts +1 -1
- package/modern/components/base-select/index.js +1 -1
- package/modern/components/base-select-mobile/Component.js +4 -3
- package/modern/components/base-select-mobile/checkmark/Component.js +1 -1
- package/modern/components/base-select-mobile/checkmark/index.css +6 -6
- package/modern/components/base-select-mobile/index.css +11 -11
- package/modern/components/base-select-mobile/index.d.ts +1 -1
- package/modern/components/base-select-mobile/index.js +4 -3
- package/modern/components/base-select-mobile/options-list/Component.js +1 -1
- package/modern/components/base-select-mobile/options-list/index.css +9 -9
- package/modern/components/base-select-mobile/virtual-options-list/Component.d.ts +5 -0
- package/modern/components/base-select-mobile/virtual-options-list/Component.js +99 -0
- package/modern/components/base-select-mobile/virtual-options-list/index.css +89 -0
- package/modern/components/base-select-mobile/virtual-options-list/index.d.ts +1 -0
- package/modern/components/base-select-mobile/virtual-options-list/index.js +9 -0
- package/modern/components/checkmark/Component.js +1 -1
- package/modern/components/checkmark/index.css +10 -10
- package/modern/components/field/Component.js +1 -1
- package/modern/components/field/index.css +9 -9
- package/modern/components/index.js +4 -3
- package/modern/components/optgroup/Component.js +1 -1
- package/modern/components/optgroup/index.css +6 -6
- package/modern/components/option/Component.js +1 -1
- package/modern/components/option/index.css +20 -20
- package/modern/components/options-list/Component.js +1 -1
- package/modern/components/options-list/index.css +6 -6
- package/modern/components/select-mobile/Component.js +4 -3
- package/modern/components/select-mobile/index.d.ts +1 -1
- package/modern/components/select-mobile/index.js +4 -3
- package/modern/components/select-modal-mobile/Component.js +4 -3
- package/modern/components/select-modal-mobile/index.d.ts +1 -1
- package/modern/components/select-modal-mobile/index.js +4 -3
- package/modern/components/virtual-options-list/Component.js +1 -1
- package/modern/components/virtual-options-list/index.css +12 -12
- package/modern/index.js +4 -3
- package/modern/{intersection-observer-48ccda2c.d.ts → intersection-observer-12c920c6.d.ts} +0 -0
- package/modern/{intersection-observer-48ccda2c.js → intersection-observer-12c920c6.js} +0 -0
- package/modern/presets/index.js +4 -3
- package/modern/presets/useLazyLoading/hook.js +2 -2
- package/modern/presets/useLazyLoading/index.css +2 -2
- package/modern/presets/useSelectWithApply/hook.js +4 -3
- package/modern/presets/useSelectWithApply/options-list-with-apply/Component.js +4 -3
- package/modern/presets/useSelectWithApply/options-list-with-apply/index.css +4 -4
- package/modern/presets/useSelectWithApply/options-list-with-apply/index.d.ts +1 -1
- package/modern/presets/useSelectWithApply/options-list-with-apply/index.js +4 -3
- package/modern/presets/useSelectWithLoading/hook.js +1 -1
- package/modern/presets/useSelectWithLoading/index.css +2 -2
- package/modern/responsive.js +4 -3
- package/modern/utils.js +1 -1
- package/package.json +14 -13
- package/presets/index.js +5 -4
- package/presets/useLazyLoading/hook.js +11 -11
- package/presets/useLazyLoading/index.css +2 -2
- package/presets/useSelectWithApply/hook.js +5 -4
- package/presets/useSelectWithApply/options-list-with-apply/Component.js +5 -4
- package/presets/useSelectWithApply/options-list-with-apply/index.css +4 -4
- package/presets/useSelectWithApply/options-list-with-apply/index.d.ts +1 -1
- package/presets/useSelectWithApply/options-list-with-apply/index.js +5 -4
- package/presets/useSelectWithLoading/hook.js +3 -3
- package/presets/useSelectWithLoading/index.css +2 -2
- package/responsive.js +5 -4
- package/utils.js +1 -1
- package/cssm/tslib.es6-0e9bf404.d.ts +0 -36
- package/cssm/tslib.es6-0e9bf404.js +0 -54
- package/esm/tslib.es6-427aef08.d.ts +0 -36
- package/esm/tslib.es6-427aef08.js +0 -51
- package/tslib.es6-a986f11c.d.ts +0 -36
- package/tslib.es6-a986f11c.js +0 -54
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import React from "react";
|
|
3
|
-
import { ReactNode, FC, ButtonHTMLAttributes, ElementType, AnchorHTMLAttributes } from "react";
|
|
3
|
+
import { ReactNode, FC, ButtonHTMLAttributes, ElementType, ForwardRefExoticComponent, RefAttributes, HTMLAttributes, AnchorHTMLAttributes } from "react";
|
|
4
4
|
import { BottomSheetProps } from "@alfalab/core-components-bottom-sheet";
|
|
5
5
|
import { BaseSelectProps, OptionShape, OptionsListProps } from "./typings";
|
|
6
6
|
import { BaseModalProps, BaseModalContext } from "@alfalab/core-components-base-modal";
|
|
@@ -97,35 +97,97 @@ type ContentProps = {
|
|
|
97
97
|
*/
|
|
98
98
|
flex?: boolean;
|
|
99
99
|
};
|
|
100
|
-
|
|
100
|
+
interface CloserProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
101
|
+
/**
|
|
102
|
+
* Вид компонента
|
|
103
|
+
*/
|
|
104
|
+
view: "desktop" | "mobile";
|
|
105
|
+
/**
|
|
106
|
+
* Дополнительный класс
|
|
107
|
+
*/
|
|
108
|
+
className?: string;
|
|
109
|
+
/**
|
|
110
|
+
* Позиция крестика
|
|
111
|
+
*/
|
|
112
|
+
align?: "left" | "right";
|
|
113
|
+
/**
|
|
114
|
+
* Фиксирует крестик
|
|
115
|
+
*/
|
|
116
|
+
sticky?: boolean;
|
|
117
|
+
/**
|
|
118
|
+
* Иконка
|
|
119
|
+
*/
|
|
120
|
+
icon?: ElementType;
|
|
121
|
+
/**
|
|
122
|
+
* Идентификатор для систем автоматизированного тестирования
|
|
123
|
+
*/
|
|
124
|
+
dataTestId?: string;
|
|
125
|
+
/**
|
|
126
|
+
* Коллбэк закрытия.
|
|
127
|
+
*/
|
|
128
|
+
onClose?: (event: React.MouseEvent<HTMLElement> | React.KeyboardEvent<HTMLElement>, reason?: "backdropClick" | "escapeKeyDown" | "closerClick") => void;
|
|
129
|
+
}
|
|
130
|
+
type NavigationBarProps = {
|
|
101
131
|
/**
|
|
102
132
|
* Контент шапки
|
|
103
133
|
*/
|
|
104
134
|
children?: ReactNode;
|
|
135
|
+
/**
|
|
136
|
+
* Заголовок шапки
|
|
137
|
+
*/
|
|
138
|
+
title?: string;
|
|
139
|
+
/**
|
|
140
|
+
* Подзаголовок (доступен только в мобильной версии)
|
|
141
|
+
*/
|
|
142
|
+
subtitle?: string;
|
|
143
|
+
/**
|
|
144
|
+
* Размер заголовка (compact доступен только в мобильной версии)
|
|
145
|
+
*/
|
|
146
|
+
titleSize?: "default" | "compact";
|
|
147
|
+
/**
|
|
148
|
+
* Доп. класс для аддонов
|
|
149
|
+
*/
|
|
150
|
+
addonClassName?: string;
|
|
105
151
|
/**
|
|
106
152
|
* Слот слева
|
|
107
153
|
*/
|
|
108
154
|
leftAddons?: ReactNode;
|
|
155
|
+
/**
|
|
156
|
+
* Слот справа
|
|
157
|
+
*/
|
|
158
|
+
rightAddons?: ReactNode;
|
|
159
|
+
/**
|
|
160
|
+
* Дополнительный класс для closer
|
|
161
|
+
*/
|
|
162
|
+
closerClassName?: string;
|
|
163
|
+
/**
|
|
164
|
+
* Слот снизу
|
|
165
|
+
*/
|
|
166
|
+
bottomAddons?: ReactNode;
|
|
109
167
|
/**
|
|
110
168
|
* Наличие компонента крестика
|
|
111
169
|
*/
|
|
112
|
-
hasCloser?:
|
|
170
|
+
hasCloser?: boolean;
|
|
113
171
|
/**
|
|
114
|
-
*
|
|
172
|
+
* Наличие кнопки "Назад"
|
|
115
173
|
*/
|
|
116
|
-
|
|
174
|
+
hasBackButton?: boolean;
|
|
117
175
|
/**
|
|
118
|
-
* Дополнительный класс для
|
|
176
|
+
* Дополнительный класс для правого аддона
|
|
119
177
|
*/
|
|
120
|
-
|
|
178
|
+
backButtonClassName?: string;
|
|
179
|
+
/**
|
|
180
|
+
* Дополнительный класс
|
|
181
|
+
*/
|
|
182
|
+
className?: string;
|
|
121
183
|
/**
|
|
122
184
|
* Дополнительный класс для контента
|
|
123
185
|
*/
|
|
124
186
|
contentClassName?: string;
|
|
125
187
|
/**
|
|
126
|
-
*
|
|
188
|
+
* Дополнительный класс для нижнего аддона
|
|
127
189
|
*/
|
|
128
|
-
|
|
190
|
+
bottomAddonsClassName?: string;
|
|
129
191
|
/**
|
|
130
192
|
* Выравнивание заголовка
|
|
131
193
|
*/
|
|
@@ -142,7 +204,32 @@ type HeaderProps = {
|
|
|
142
204
|
* Идентификатор для систем автоматизированного тестирования
|
|
143
205
|
*/
|
|
144
206
|
dataTestId?: string;
|
|
207
|
+
/**
|
|
208
|
+
* Фоновое изображение
|
|
209
|
+
*/
|
|
210
|
+
imageUrl?: string;
|
|
211
|
+
/**
|
|
212
|
+
* Иконка closer.
|
|
213
|
+
*/
|
|
214
|
+
closerIcon?: React.ElementType;
|
|
215
|
+
/**
|
|
216
|
+
* Обработчик закрытия
|
|
217
|
+
*/
|
|
218
|
+
onClose?: CloserProps["onClose"];
|
|
219
|
+
/**
|
|
220
|
+
* обработчик клика по кнопке "назад"
|
|
221
|
+
*/
|
|
222
|
+
onBack?: () => void;
|
|
223
|
+
/**
|
|
224
|
+
* Вид шапки - мобильный или десктоп
|
|
225
|
+
*/
|
|
226
|
+
view: "desktop" | "mobile";
|
|
227
|
+
/**
|
|
228
|
+
* Ссылка на родительскую ноду.
|
|
229
|
+
*/
|
|
230
|
+
parentRef?: React.RefObject<HTMLDivElement>;
|
|
145
231
|
};
|
|
232
|
+
type HeaderProps = Omit<NavigationBarProps, "size" | "view" | "parentRef">;
|
|
146
233
|
type FooterProps = {
|
|
147
234
|
/**
|
|
148
235
|
* Контент футера
|
|
@@ -165,77 +252,224 @@ type FooterProps = {
|
|
|
165
252
|
*/
|
|
166
253
|
gap?: 16 | 24 | 32;
|
|
167
254
|
};
|
|
168
|
-
|
|
255
|
+
declare const ModalMobile: React.ForwardRefExoticComponent<ModalMobileProps & React.RefAttributes<HTMLDivElement>> & {
|
|
256
|
+
Content: React.FC<ContentProps>;
|
|
257
|
+
Header: React.FC<HeaderProps>;
|
|
258
|
+
Footer: React.FC<FooterProps>;
|
|
259
|
+
Closer: React.FC<CloserProps>;
|
|
260
|
+
};
|
|
261
|
+
declare const Content: FC<ContentProps>;
|
|
262
|
+
declare const Modal: React.ForwardRefExoticComponent<import("@alfalab/core-components-base-modal").BaseModalProps & {
|
|
263
|
+
size?: "s" | "m" | "l" | "xl" | "fullscreen" | undefined;
|
|
264
|
+
fullscreen?: boolean | undefined;
|
|
265
|
+
fixedPosition?: boolean | undefined;
|
|
266
|
+
hasCloser?: boolean | undefined;
|
|
267
|
+
} & {
|
|
268
|
+
view: View;
|
|
269
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
270
|
+
declare const ResponsiveContext: React.Context<TResponsiveModalContext>;
|
|
271
|
+
interface BackArrowAddonProps extends React.HTMLAttributes<HTMLButtonElement> {
|
|
169
272
|
/**
|
|
170
|
-
*
|
|
273
|
+
* Текст после иконки
|
|
171
274
|
*/
|
|
172
|
-
|
|
173
|
-
className?: string;
|
|
174
|
-
}>;
|
|
275
|
+
text?: string;
|
|
175
276
|
/**
|
|
176
|
-
*
|
|
277
|
+
* Дополнительный класс
|
|
177
278
|
*/
|
|
178
|
-
|
|
279
|
+
className?: string;
|
|
179
280
|
/**
|
|
180
|
-
*
|
|
281
|
+
* Вид компонента
|
|
181
282
|
*/
|
|
182
|
-
|
|
283
|
+
view: "mobile" | "desktop";
|
|
183
284
|
/**
|
|
184
|
-
*
|
|
285
|
+
* Прозрачность текста
|
|
286
|
+
*/
|
|
287
|
+
textOpacity?: number;
|
|
288
|
+
/**
|
|
289
|
+
* Обработчик клика
|
|
290
|
+
*/
|
|
291
|
+
onClick?: () => void;
|
|
292
|
+
}
|
|
293
|
+
declare const BackArrowAddon: React.FC<BackArrowAddonProps>;
|
|
294
|
+
declare const colors: readonly [
|
|
295
|
+
"tertiary",
|
|
296
|
+
"disabled",
|
|
297
|
+
"accent",
|
|
298
|
+
"primary",
|
|
299
|
+
"attention",
|
|
300
|
+
"positive",
|
|
301
|
+
"secondary",
|
|
302
|
+
"tertiary-inverted",
|
|
303
|
+
"primary-inverted",
|
|
304
|
+
"secondary-inverted",
|
|
305
|
+
"link",
|
|
306
|
+
"negative",
|
|
307
|
+
"static-primary-light",
|
|
308
|
+
"static-secondary-light",
|
|
309
|
+
"static-tertiary-light",
|
|
310
|
+
"static-primary-dark",
|
|
311
|
+
"static-secondary-dark",
|
|
312
|
+
"static-tertiary-dark",
|
|
313
|
+
"static-accent"
|
|
314
|
+
];
|
|
315
|
+
type Color = (typeof colors)[number];
|
|
316
|
+
type TextElementType = HTMLParagraphElement | HTMLSpanElement | HTMLDivElement;
|
|
317
|
+
type NativeProps = HTMLAttributes<HTMLSpanElement>;
|
|
318
|
+
type TextBaseProps = {
|
|
319
|
+
/**
|
|
320
|
+
* [Вариант начертания](https://core-ds.github.io/core-components/master/?path=/docs/guidelines-typography--page)
|
|
321
|
+
*/
|
|
322
|
+
view?: "primary-large" | "primary-medium" | "primary-small" | "secondary-large" | "secondary-medium" | "secondary-small" | "component" | "caps";
|
|
323
|
+
/**
|
|
324
|
+
* Цвет текста
|
|
325
|
+
*/
|
|
326
|
+
color?: Color;
|
|
327
|
+
/**
|
|
328
|
+
* Толщина шрифта
|
|
329
|
+
*/
|
|
330
|
+
weight?: "regular" | "medium" | "bold";
|
|
331
|
+
/**
|
|
332
|
+
* Делает цифры моноширинными
|
|
333
|
+
*/
|
|
334
|
+
monospaceNumbers?: boolean;
|
|
335
|
+
/**
|
|
336
|
+
* HTML тег
|
|
337
|
+
*/
|
|
338
|
+
tag?: "span" | "div";
|
|
339
|
+
/**
|
|
340
|
+
* Css-класс для стилизации (native prop)
|
|
185
341
|
*/
|
|
186
342
|
className?: string;
|
|
187
343
|
/**
|
|
188
|
-
*
|
|
344
|
+
* Id компонента для тестов
|
|
189
345
|
*/
|
|
190
346
|
dataTestId?: string;
|
|
191
347
|
/**
|
|
192
|
-
*
|
|
348
|
+
* Контент (native prop)
|
|
193
349
|
*/
|
|
194
|
-
|
|
195
|
-
} & Omit<ButtonHTMLAttributes<HTMLButtonElement>, "size"> & Pick<ButtonProps, "href" | "loading"> & Pick<AnchorHTMLAttributes<HTMLAnchorElement>, "target" | "download">;
|
|
196
|
-
type CloserProps = ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
350
|
+
children?: React.ReactNode;
|
|
197
351
|
/**
|
|
198
|
-
*
|
|
352
|
+
* Добавляет отступы к тэгу 'p'
|
|
199
353
|
*/
|
|
200
|
-
|
|
354
|
+
defaultMargins?: never;
|
|
201
355
|
/**
|
|
202
|
-
*
|
|
356
|
+
* Количество строк (не поддерживает IE)
|
|
203
357
|
*/
|
|
204
|
-
|
|
358
|
+
rowLimit?: 1 | 2 | 3;
|
|
359
|
+
};
|
|
360
|
+
type TextPTagProps = Omit<TextBaseProps, "tag" | "defaultMargins"> & {
|
|
361
|
+
tag?: "p";
|
|
362
|
+
defaultMargins?: boolean;
|
|
363
|
+
};
|
|
364
|
+
type TextProps = Omit<NativeProps, "color"> & (TextBaseProps | TextPTagProps);
|
|
365
|
+
type NativeProps$0 = HTMLAttributes<HTMLHeadingElement>;
|
|
366
|
+
type TitleProps = Omit<NativeProps$0, "color"> & {
|
|
205
367
|
/**
|
|
206
|
-
*
|
|
368
|
+
* HTML тег
|
|
207
369
|
*/
|
|
208
|
-
|
|
370
|
+
tag: "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "div";
|
|
209
371
|
/**
|
|
210
|
-
*
|
|
372
|
+
* [Вариант начертания](https://core-ds.github.io/core-components/master/?path=/docs/guidelines-typography--page)
|
|
211
373
|
*/
|
|
212
|
-
|
|
374
|
+
view?: "xlarge" | "large" | "medium" | "small" | "xsmall";
|
|
213
375
|
/**
|
|
214
|
-
*
|
|
376
|
+
* Цвет текста
|
|
215
377
|
*/
|
|
216
|
-
|
|
378
|
+
color?: Color;
|
|
217
379
|
/**
|
|
218
|
-
*
|
|
380
|
+
* Толщина шрифта
|
|
381
|
+
*/
|
|
382
|
+
weight?: "regular" | "medium" | "bold";
|
|
383
|
+
/**
|
|
384
|
+
* Шрифт текста
|
|
385
|
+
*/
|
|
386
|
+
font?: "styrene" | "system";
|
|
387
|
+
/**
|
|
388
|
+
* Добавляет отступы
|
|
389
|
+
*/
|
|
390
|
+
defaultMargins?: boolean;
|
|
391
|
+
/**
|
|
392
|
+
* Css-класс для стилизации (native prop)
|
|
393
|
+
*/
|
|
394
|
+
className?: string;
|
|
395
|
+
/**
|
|
396
|
+
* Id компонента для тестов
|
|
219
397
|
*/
|
|
220
398
|
dataTestId?: string;
|
|
399
|
+
/**
|
|
400
|
+
* Контент (native prop)
|
|
401
|
+
*/
|
|
402
|
+
children?: React.ReactNode;
|
|
403
|
+
/**
|
|
404
|
+
* Количество строк (не поддерживает IE)
|
|
405
|
+
*/
|
|
406
|
+
rowLimit?: 1 | 2 | 3;
|
|
221
407
|
};
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
408
|
+
type TitleMobileProps = Omit<TitleProps, "defaultMargins">;
|
|
409
|
+
declare const Typography: {
|
|
410
|
+
Title: FC<TitleProps>;
|
|
411
|
+
Text: ForwardRefExoticComponent<TextProps & RefAttributes<TextElementType>>;
|
|
412
|
+
TitleResponsive: FC<TitleProps>;
|
|
413
|
+
TitleMobile: FC<TitleMobileProps>;
|
|
227
414
|
};
|
|
228
|
-
declare const
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
415
|
+
declare const typographyPresets: {
|
|
416
|
+
mobile: {
|
|
417
|
+
list: {
|
|
418
|
+
text: {
|
|
419
|
+
primary: {
|
|
420
|
+
tag: string;
|
|
421
|
+
view: string;
|
|
422
|
+
};
|
|
423
|
+
secondary: {
|
|
424
|
+
tag: string;
|
|
425
|
+
color: string;
|
|
426
|
+
view: string;
|
|
427
|
+
};
|
|
428
|
+
};
|
|
429
|
+
};
|
|
430
|
+
};
|
|
431
|
+
};
|
|
432
|
+
declare const TitleResponsive: FC<TitleProps>;
|
|
433
|
+
type IconButtonProps = {
|
|
434
|
+
/**
|
|
435
|
+
* Компонент иконки
|
|
436
|
+
*/
|
|
437
|
+
icon: ElementType<{
|
|
438
|
+
className?: string;
|
|
439
|
+
}>;
|
|
440
|
+
/**
|
|
441
|
+
* Тип кнопки
|
|
442
|
+
*/
|
|
443
|
+
view?: "primary" | "secondary" | "transparent" | "tertiary" | "negative";
|
|
444
|
+
/**
|
|
445
|
+
* Размер компонента
|
|
446
|
+
*/
|
|
447
|
+
size?: "xxs" | "xs" | "s";
|
|
448
|
+
/**
|
|
449
|
+
* Дополнительный класс
|
|
450
|
+
*/
|
|
451
|
+
className?: string;
|
|
452
|
+
/**
|
|
453
|
+
* Идентификатор для систем автоматизированного тестирования
|
|
454
|
+
*/
|
|
455
|
+
dataTestId?: string;
|
|
456
|
+
/**
|
|
457
|
+
* Набор цветов для компонента
|
|
458
|
+
*/
|
|
459
|
+
colors?: "default" | "inverted";
|
|
460
|
+
} & Omit<ButtonHTMLAttributes<HTMLButtonElement>, "size"> & Pick<ButtonProps, "href" | "loading"> & Pick<AnchorHTMLAttributes<HTMLAnchorElement>, "target" | "download">;
|
|
461
|
+
declare const IconButton: React.ForwardRefExoticComponent<{
|
|
462
|
+
icon: ElementType<{
|
|
463
|
+
className?: string;
|
|
464
|
+
}>;
|
|
465
|
+
view?: "primary" | "secondary" | "tertiary" | "transparent" | "negative" | undefined;
|
|
466
|
+
size?: "s" | "xs" | "xxs" | undefined;
|
|
467
|
+
className?: string | undefined;
|
|
468
|
+
dataTestId?: string | undefined;
|
|
469
|
+
colors?: "default" | "inverted" | undefined;
|
|
470
|
+
} & Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "size"> & Pick<ButtonProps, "href" | "loading"> & Pick<React.AnchorHTMLAttributes<HTMLAnchorElement>, "download" | "target"> & React.RefAttributes<HTMLButtonElement>>;
|
|
238
471
|
declare const ModalContext: import("react").Context<BaseModalContext>;
|
|
239
472
|
type SelectModalMobileProps = Omit<BaseSelectProps, 'Checkmark' | 'onScroll'>;
|
|
240
473
|
declare const SelectModalMobile: React.ForwardRefExoticComponent<SelectModalMobileProps & React.RefAttributes<unknown>>;
|
|
241
|
-
export { AdditionalMobileProps, SelectMobileProps, SelectMobile, BaseSelectMobile, OptionsListWithApply, ModalMobile, Content, Modal, ResponsiveContext, ModalContext, SelectModalMobileProps, SelectModalMobile };
|
|
474
|
+
export { AdditionalMobileProps, SelectMobileProps, SelectMobile, BaseSelectMobile, OptionsListWithApply, ModalMobile, Content, Modal, ResponsiveContext, BackArrowAddonProps, BackArrowAddon, Typography, typographyPresets, TitleResponsive, IconButtonProps, IconButton, ModalContext, SelectModalMobileProps, SelectModalMobile };
|
|
475
|
+
export type { TitleProps, TextProps, Color };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var tslib = require('tslib');
|
|
4
4
|
var React = require('react');
|
|
5
5
|
var components_arrow_Component = require('./components/arrow/Component.js');
|
|
6
6
|
var mergeRefs = require('react-merge-refs');
|
|
@@ -9,7 +9,7 @@ var downshift = require('downshift');
|
|
|
9
9
|
var coreComponentsBottomSheet = require('@alfalab/core-components-bottom-sheet/cssm');
|
|
10
10
|
var mobile = require('@alfalab/core-components-modal/cssm/mobile');
|
|
11
11
|
require('./Component.js');
|
|
12
|
-
var components_baseSelect_Component = require('./Component-
|
|
12
|
+
var components_baseSelect_Component = require('./Component-1481ef6b.js');
|
|
13
13
|
var components_field_Component = require('./components/field/Component.js');
|
|
14
14
|
var components_optgroup_Component = require('./components/optgroup/Component.js');
|
|
15
15
|
var components_option_Component = require('./components/option/Component.js');
|
|
@@ -43,6 +43,7 @@ var styles = require('./presets/useSelectWithApply/options-list-with-apply/index
|
|
|
43
43
|
var components_baseCheckmark_Component = require('./components/base-checkmark/Component.js');
|
|
44
44
|
var components_baseSelectMobile_checkmark_Component = require('./components/base-select-mobile/checkmark/Component.js');
|
|
45
45
|
var components_baseSelectMobile_optionsList_Component = require('./components/base-select-mobile/options-list/Component.js');
|
|
46
|
+
var components_baseSelectMobile_virtualOptionsList_Component = require('./components/base-select-mobile/virtual-options-list/Component.js');
|
|
46
47
|
var styles$1 = require('./components/base-select-mobile/index.module.css');
|
|
47
48
|
|
|
48
49
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
@@ -55,14 +56,14 @@ var styles__default$1 = /*#__PURE__*/_interopDefaultCompat(styles$1);
|
|
|
55
56
|
|
|
56
57
|
var OptionsListWithApply = React.forwardRef(function (_a, ref) {
|
|
57
58
|
var _b;
|
|
58
|
-
var toggleMenu = _a.toggleMenu, _c = _a.OptionsList, OptionsList = _c === void 0 ? components_optionsList_Component.OptionsList : _c, defaultGetOptionProps = _a.getOptionProps, _d = _a.showClear, showClear = _d === void 0 ? true : _d, _e = _a.selectedDraft, selectedDraft = _e === void 0 ? [] : _e, _f = _a.flatOptions, flatOptions = _f === void 0 ? [] : _f, _g = _a.onApply, onApply = _g === void 0 ? function () { return null; } : _g, _h = _a.onClear, onClear = _h === void 0 ? function () { return null; } : _h, _j = _a.onClose, onClose = _j === void 0 ? function () { return null; } : _j, _k = _a.visibleOptions, visibleOptions = _k === void 0 ? 5 : _k, restProps =
|
|
59
|
+
var toggleMenu = _a.toggleMenu, _c = _a.OptionsList, OptionsList = _c === void 0 ? components_optionsList_Component.OptionsList : _c, defaultGetOptionProps = _a.getOptionProps, _d = _a.showClear, showClear = _d === void 0 ? true : _d, _e = _a.selectedDraft, selectedDraft = _e === void 0 ? [] : _e, _f = _a.flatOptions, flatOptions = _f === void 0 ? [] : _f, _g = _a.onApply, onApply = _g === void 0 ? function () { return null; } : _g, _h = _a.onClear, onClear = _h === void 0 ? function () { return null; } : _h, _j = _a.onClose, onClose = _j === void 0 ? function () { return null; } : _j, _k = _a.visibleOptions, visibleOptions = _k === void 0 ? 5 : _k, restProps = tslib.__rest(_a, ["toggleMenu", "OptionsList", "getOptionProps", "showClear", "selectedDraft", "flatOptions", "onApply", "onClear", "onClose", "visibleOptions"]);
|
|
59
60
|
var footerRef = React.useRef(null);
|
|
60
61
|
var getOptionProps = React.useCallback(function (option, index) {
|
|
61
62
|
var optionProps = defaultGetOptionProps(option, index);
|
|
62
63
|
var selected = option.key === SELECT_ALL_KEY
|
|
63
64
|
? selectedDraft.length === flatOptions.length - 1
|
|
64
65
|
: selectedDraft.includes(option);
|
|
65
|
-
return
|
|
66
|
+
return tslib.__assign(tslib.__assign({}, optionProps), { selected: selected });
|
|
66
67
|
}, [defaultGetOptionProps, flatOptions.length, selectedDraft]);
|
|
67
68
|
var handleApply = React.useCallback(function () {
|
|
68
69
|
onApply();
|
|
@@ -87,7 +88,7 @@ var OptionsListWithApply = React.forwardRef(function (_a, ref) {
|
|
|
87
88
|
};
|
|
88
89
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
89
90
|
}, []);
|
|
90
|
-
return (React__default.default.createElement(OptionsList,
|
|
91
|
+
return (React__default.default.createElement(OptionsList, tslib.__assign({}, restProps, { ref: ref, visibleOptions: visibleOptions, toggleMenu: toggleMenu, flatOptions: flatOptions, getOptionProps: getOptionProps, onApply: handleApply, onClear: handleClear, footer: React__default.default.createElement("div", {
|
|
91
92
|
// eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex
|
|
92
93
|
tabIndex: 0, className: cn__default.default(styles__default.default.footer, (_b = {},
|
|
93
94
|
_b[styles__default.default.withBorder] = visibleOptions && flatOptions.length > visibleOptions,
|
|
@@ -119,9 +120,9 @@ function useSelectWithApply(_a) {
|
|
|
119
120
|
});
|
|
120
121
|
}, [onChange]);
|
|
121
122
|
var handleChange = React.useCallback(function (_a) {
|
|
122
|
-
var initiator = _a.initiator, restArgs =
|
|
123
|
+
var initiator = _a.initiator, restArgs = tslib.__rest(_a, ["initiator"]);
|
|
123
124
|
if (!initiator) {
|
|
124
|
-
onChange(
|
|
125
|
+
onChange(tslib.__assign({ initiator: null }, restArgs));
|
|
125
126
|
return;
|
|
126
127
|
}
|
|
127
128
|
var initiatorSelected = selectedDraft.includes(initiator) ||
|
|
@@ -142,7 +143,7 @@ function useSelectWithApply(_a) {
|
|
|
142
143
|
setSelectedDraft(selectedOptions);
|
|
143
144
|
selectedOptionsRef.current = selectedOptions;
|
|
144
145
|
}, [selectedOptions]);
|
|
145
|
-
var memoizedOptions = React.useMemo(function () { return (showSelectAll ?
|
|
146
|
+
var memoizedOptions = React.useMemo(function () { return (showSelectAll ? tslib.__spreadArray([selectAllOption], options, true) : options); }, [options, showSelectAll]);
|
|
146
147
|
return {
|
|
147
148
|
OptionsList: OptionsListWithApply,
|
|
148
149
|
optionsListProps: {
|
|
@@ -161,9 +162,12 @@ function useSelectWithApply(_a) {
|
|
|
161
162
|
};
|
|
162
163
|
}
|
|
163
164
|
|
|
165
|
+
var VIRTUAL_OPTIONS_LIST_THRESHOLD = 30;
|
|
164
166
|
var BaseSelectMobile = React.forwardRef(function (_a, ref) {
|
|
165
167
|
var _b;
|
|
166
|
-
var dataTestId = _a.dataTestId, className = _a.className, fieldClassName = _a.fieldClassName, optionsListClassName = _a.optionsListClassName, optionClassName = _a.optionClassName, optionGroupClassName = _a.optionGroupClassName, optionsListProps = _a.optionsListProps, options = _a.options, _c = _a.autocomplete, autocomplete = _c === void 0 ? false : _c, _d = _a.multiple, multiple = _d === void 0 ? false : _d, _e = _a.allowUnselect, allowUnselect = _e === void 0 ? false : _e, _f = _a.disabled, disabled = _f === void 0 ? false : _f, _g = _a.closeOnSelect, closeOnSelect = _g === void 0 ? !multiple : _g, _h = _a.circularNavigation, circularNavigation = _h === void 0 ? false : _h, _j = _a.defaultOpen, defaultOpen = _j === void 0 ? false : _j, openProp = _a.open, name = _a.name, id = _a.id, selected = _a.selected, _k = _a.size, size = _k === void 0 ? 'm' : _k, _l = _a.optionsSize, optionsSize = _l === void 0 ? 'm' : _l, error = _a.error, hint = _a.hint, block = _a.block, label = _a.label, labelView = _a.labelView, placeholder = _a.placeholder, _m = _a.fieldProps, fieldProps = _m === void 0 ? {} : _m, _o = _a.optionProps, optionProps = _o === void 0 ? {} : _o, valueRenderer = _a.valueRenderer, onChange = _a.onChange, onOpen = _a.onOpen, onFocus = _a.onFocus, _p = _a.Arrow, Arrow = _p === void 0 ? components_arrow_Component.Arrow : _p, _q = _a.Field, Field = _q === void 0 ? components_field_Component.Field : _q, _r = _a.Optgroup, Optgroup = _r === void 0 ? components_optgroup_Component.Optgroup : _r, _s = _a.Option, Option = _s === void 0 ? components_option_Component.Option : _s, _t = _a.OptionsList, OptionsList = _t === void 0 ?
|
|
168
|
+
var dataTestId = _a.dataTestId, className = _a.className, fieldClassName = _a.fieldClassName, optionsListClassName = _a.optionsListClassName, optionClassName = _a.optionClassName, optionGroupClassName = _a.optionGroupClassName, optionsListProps = _a.optionsListProps, options = _a.options, _c = _a.autocomplete, autocomplete = _c === void 0 ? false : _c, _d = _a.multiple, multiple = _d === void 0 ? false : _d, _e = _a.allowUnselect, allowUnselect = _e === void 0 ? false : _e, _f = _a.disabled, disabled = _f === void 0 ? false : _f, _g = _a.closeOnSelect, closeOnSelect = _g === void 0 ? !multiple : _g, _h = _a.circularNavigation, circularNavigation = _h === void 0 ? false : _h, _j = _a.defaultOpen, defaultOpen = _j === void 0 ? false : _j, openProp = _a.open, name = _a.name, id = _a.id, selected = _a.selected, _k = _a.size, size = _k === void 0 ? 'm' : _k, _l = _a.optionsSize, optionsSize = _l === void 0 ? 'm' : _l, error = _a.error, hint = _a.hint, block = _a.block, label = _a.label, labelView = _a.labelView, placeholder = _a.placeholder, _m = _a.fieldProps, fieldProps = _m === void 0 ? {} : _m, _o = _a.optionProps, optionProps = _o === void 0 ? {} : _o, valueRenderer = _a.valueRenderer, onChange = _a.onChange, onOpen = _a.onOpen, onFocus = _a.onFocus, _p = _a.Arrow, Arrow = _p === void 0 ? components_arrow_Component.Arrow : _p, _q = _a.Field, Field = _q === void 0 ? components_field_Component.Field : _q, _r = _a.Optgroup, Optgroup = _r === void 0 ? components_optgroup_Component.Optgroup : _r, _s = _a.Option, Option = _s === void 0 ? components_option_Component.Option : _s, _t = _a.OptionsList, OptionsList = _t === void 0 ? options.length > VIRTUAL_OPTIONS_LIST_THRESHOLD
|
|
169
|
+
? components_baseSelectMobile_virtualOptionsList_Component.VirtualOptionsList
|
|
170
|
+
: components_baseSelectMobile_optionsList_Component.OptionsList : _t, swipeable = _a.swipeable, footer = _a.footer, isBottomSheet = _a.isBottomSheet, bottomSheetProps = _a.bottomSheetProps;
|
|
167
171
|
var rootRef = React.useRef(null);
|
|
168
172
|
var fieldRef = React.useRef(null);
|
|
169
173
|
var listRef = React.useRef(null);
|
|
@@ -171,6 +175,7 @@ var BaseSelectMobile = React.forwardRef(function (_a, ref) {
|
|
|
171
175
|
var itemToString = function (option) { return (option ? option.key : ''); };
|
|
172
176
|
var _u = React.useMemo(function () { return utils.processOptions(options, selected); }, [options, selected]), flatOptions = _u.flatOptions, selectedOptions = _u.selectedOptions;
|
|
173
177
|
var selectedOptionsRef = React.useRef(selectedOptions);
|
|
178
|
+
var scrollableContainerRef = React.useRef(null);
|
|
174
179
|
var _v = React.useState(selectedOptions), selectedDraft = _v[0], setSelectedDraft = _v[1];
|
|
175
180
|
var useMultipleSelectionProps = {
|
|
176
181
|
itemToString: itemToString,
|
|
@@ -253,7 +258,7 @@ var BaseSelectMobile = React.forwardRef(function (_a, ref) {
|
|
|
253
258
|
}
|
|
254
259
|
}
|
|
255
260
|
}
|
|
256
|
-
return
|
|
261
|
+
return tslib.__assign(tslib.__assign({}, changes), { isOpen: !closeOnSelect || multiple,
|
|
257
262
|
// при closeOnSelect === false - сохраняем подсвеченный индекс
|
|
258
263
|
highlightedIndex: state.isOpen && !closeOnSelect
|
|
259
264
|
? state.highlightedIndex
|
|
@@ -303,7 +308,7 @@ var BaseSelectMobile = React.forwardRef(function (_a, ref) {
|
|
|
303
308
|
};
|
|
304
309
|
var getOptionProps = function (option, index) {
|
|
305
310
|
var selectedItem = selectedItems.includes(option);
|
|
306
|
-
return
|
|
311
|
+
return tslib.__assign(tslib.__assign({}, optionProps), { mobile: true, className: cn__default.default(styles__default$1.default.option, optionClassName), innerProps: getItemProps({
|
|
307
312
|
index: index,
|
|
308
313
|
item: option,
|
|
309
314
|
disabled: option.disabled,
|
|
@@ -340,8 +345,8 @@ var BaseSelectMobile = React.forwardRef(function (_a, ref) {
|
|
|
340
345
|
}
|
|
341
346
|
toggleMenu();
|
|
342
347
|
};
|
|
343
|
-
return (React__default.default.createElement("div",
|
|
344
|
-
React__default.default.createElement(Field,
|
|
348
|
+
return (React__default.default.createElement("div", tslib.__assign({}, getComboboxProps(tslib.__assign(tslib.__assign({ ref: rootRef }, (disabled && { 'aria-disabled': true })), { className: cn__default.default(styles__default$1.default.component, (_b = {}, _b[styles__default$1.default.block] = block, _b), className) })), { onKeyDown: disabled ? undefined : handleFieldKeyDown, tabIndex: -1, "data-test-id": components_baseSelect_Component.getDataTestId(dataTestId) }),
|
|
349
|
+
React__default.default.createElement(Field, tslib.__assign({ selectedMultiple: selectedDraft, selected: selectedItems[0], setSelectedItems: setSelectedItems, toggleMenu: toggleMenu, multiple: multiple, open: open, disabled: disabled, size: size, placeholder: placeholder, label: label && React__default.default.createElement("span", tslib.__assign({}, getLabelProps()), label), labelView: labelView, Arrow: Arrow && React__default.default.createElement(Arrow, { open: open }), error: error, hint: hint, valueRenderer: valueRenderer, className: fieldClassName, innerProps: {
|
|
345
350
|
onFocus: disabled ? undefined : handleFieldFocus,
|
|
346
351
|
onClick: disabled ? undefined : handleFieldClick,
|
|
347
352
|
tabIndex: disabled ? -1 : 0,
|
|
@@ -354,22 +359,22 @@ var BaseSelectMobile = React.forwardRef(function (_a, ref) {
|
|
|
354
359
|
: undefined,
|
|
355
360
|
}, dataTestId: components_baseSelect_Component.getDataTestId(dataTestId, 'field') }, fieldProps)),
|
|
356
361
|
name && renderValue(),
|
|
357
|
-
isBottomSheet ? (React__default.default.createElement(coreComponentsBottomSheet.BottomSheet,
|
|
358
|
-
React__default.default.createElement("div",
|
|
359
|
-
React__default.default.createElement(OptionsListWithApply,
|
|
360
|
-
React__default.default.createElement(mobile.ModalMobile.Header, { hasCloser: true,
|
|
361
|
-
React__default.default.createElement("div",
|
|
362
|
-
React__default.default.createElement(OptionsListWithApply,
|
|
362
|
+
isBottomSheet ? (React__default.default.createElement(coreComponentsBottomSheet.BottomSheet, tslib.__assign({ open: open, onClose: handleClose, className: styles__default$1.default.sheet, contentClassName: styles__default$1.default.sheetContent, containerClassName: styles__default$1.default.sheetContainer, title: label || placeholder, actionButton: footer, stickyHeader: true, hasCloser: true, swipeable: swipeable, scrollableContainerRef: scrollableContainerRef }, bottomSheetProps),
|
|
363
|
+
React__default.default.createElement("div", tslib.__assign({}, menuProps, { className: optionsListClassName }),
|
|
364
|
+
React__default.default.createElement(OptionsListWithApply, tslib.__assign({ showFooter: multiple }, optionsListProps, { flatOptions: flatOptions, highlightedIndex: highlightedIndex, size: size, options: options, OptionsList: OptionsList, Optgroup: Optgroup, Option: Option, selectedItems: selectedItems, setSelectedItems: setSelectedItems, toggleMenu: toggleMenu, getOptionProps: getOptionProps, dataTestId: components_baseSelect_Component.getDataTestId(dataTestId, 'options-list'), optionGroupClassName: cn__default.default(styles__default$1.default.optionGroup, optionGroupClassName), onApply: handleApply, onClear: handleClear, ref: scrollableContainerRef }))))) : (React__default.default.createElement(mobile.ModalMobile, { open: open, onClose: handleClose, contentClassName: styles__default$1.default.sheetContent, hasCloser: true, ref: scrollableContainerRef },
|
|
365
|
+
React__default.default.createElement(mobile.ModalMobile.Header, { hasCloser: true, sticky: true }, label || placeholder),
|
|
366
|
+
React__default.default.createElement("div", tslib.__assign({}, menuProps, { className: optionsListClassName }),
|
|
367
|
+
React__default.default.createElement(OptionsListWithApply, tslib.__assign({ showFooter: multiple }, optionsListProps, { flatOptions: flatOptions, highlightedIndex: highlightedIndex, size: size, options: options, OptionsList: OptionsList, Optgroup: Optgroup, Option: Option, selectedItems: selectedItems, setSelectedItems: setSelectedItems, toggleMenu: toggleMenu, getOptionProps: getOptionProps, dataTestId: components_baseSelect_Component.getDataTestId(dataTestId, 'options-list'), optionGroupClassName: cn__default.default(styles__default$1.default.optionGroup, optionGroupClassName), onApply: handleApply, onClear: handleClear, ref: scrollableContainerRef })))))));
|
|
363
368
|
});
|
|
364
369
|
|
|
365
370
|
var SelectMobile = React.forwardRef(function (_a, ref) {
|
|
366
|
-
var _b = _a.autocomplete, autocomplete = _b === void 0 ? false : _b, _c = _a.multiple, multiple = _c === void 0 ? false : _c, _d = _a.allowUnselect, allowUnselect = _d === void 0 ? false : _d, _e = _a.disabled, disabled = _e === void 0 ? false : _e, _f = _a.closeOnSelect, closeOnSelect = _f === void 0 ? !multiple : _f, _g = _a.circularNavigation, circularNavigation = _g === void 0 ? false : _g, _h = _a.defaultOpen, defaultOpen = _h === void 0 ? false : _h, openProp = _a.open, _j = _a.size, size = _j === void 0 ? 'm' : _j, _k = _a.optionsSize, optionsSize = _k === void 0 ? 'm' : _k, _l = _a.fieldProps, fieldProps = _l === void 0 ? {} : _l, _m = _a.optionProps, optionProps = _m === void 0 ? {} : _m, _o = _a.Arrow, Arrow = _o === void 0 ? components_arrow_Component.Arrow : _o, _p = _a.Field, Field = _p === void 0 ? components_field_Component.Field : _p, _q = _a.Optgroup, Optgroup = _q === void 0 ? components_optgroup_Component.Optgroup : _q, _r = _a.Option, Option = _r === void 0 ? components_option_Component.Option : _r, restProps =
|
|
367
|
-
return (React__default.default.createElement(BaseSelectMobile,
|
|
371
|
+
var _b = _a.autocomplete, autocomplete = _b === void 0 ? false : _b, _c = _a.multiple, multiple = _c === void 0 ? false : _c, _d = _a.allowUnselect, allowUnselect = _d === void 0 ? false : _d, _e = _a.disabled, disabled = _e === void 0 ? false : _e, _f = _a.closeOnSelect, closeOnSelect = _f === void 0 ? !multiple : _f, _g = _a.circularNavigation, circularNavigation = _g === void 0 ? false : _g, _h = _a.defaultOpen, defaultOpen = _h === void 0 ? false : _h, openProp = _a.open, _j = _a.size, size = _j === void 0 ? 'm' : _j, _k = _a.optionsSize, optionsSize = _k === void 0 ? 'm' : _k, _l = _a.fieldProps, fieldProps = _l === void 0 ? {} : _l, _m = _a.optionProps, optionProps = _m === void 0 ? {} : _m, _o = _a.Arrow, Arrow = _o === void 0 ? components_arrow_Component.Arrow : _o, _p = _a.Field, Field = _p === void 0 ? components_field_Component.Field : _p, _q = _a.Optgroup, Optgroup = _q === void 0 ? components_optgroup_Component.Optgroup : _q, _r = _a.Option, Option = _r === void 0 ? components_option_Component.Option : _r, restProps = tslib.__rest(_a, ["autocomplete", "multiple", "allowUnselect", "disabled", "closeOnSelect", "circularNavigation", "defaultOpen", "open", "size", "optionsSize", "fieldProps", "optionProps", "Arrow", "Field", "Optgroup", "Option"]);
|
|
372
|
+
return (React__default.default.createElement(BaseSelectMobile, tslib.__assign({ ref: ref, autocomplete: autocomplete, multiple: multiple, allowUnselect: allowUnselect, disabled: disabled, closeOnSelect: closeOnSelect, circularNavigation: circularNavigation, defaultOpen: defaultOpen, open: openProp, size: size, optionsSize: optionsSize, fieldProps: fieldProps, optionProps: optionProps, Arrow: Arrow, Field: Field, Optgroup: Optgroup, Option: Option, isBottomSheet: true }, restProps)));
|
|
368
373
|
});
|
|
369
374
|
|
|
370
375
|
var SelectModalMobile = React.forwardRef(function (_a, ref) {
|
|
371
|
-
var _b = _a.autocomplete, autocomplete = _b === void 0 ? false : _b, _c = _a.multiple, multiple = _c === void 0 ? false : _c, _d = _a.allowUnselect, allowUnselect = _d === void 0 ? false : _d, _e = _a.disabled, disabled = _e === void 0 ? false : _e, _f = _a.closeOnSelect, closeOnSelect = _f === void 0 ? !multiple : _f, _g = _a.circularNavigation, circularNavigation = _g === void 0 ? false : _g, _h = _a.defaultOpen, defaultOpen = _h === void 0 ? false : _h, openProp = _a.open, _j = _a.size, size = _j === void 0 ? 'm' : _j, _k = _a.optionsSize, optionsSize = _k === void 0 ? 'm' : _k, _l = _a.fieldProps, fieldProps = _l === void 0 ? {} : _l, _m = _a.optionProps, optionProps = _m === void 0 ? {} : _m, _o = _a.Arrow, Arrow = _o === void 0 ? components_arrow_Component.Arrow : _o, _p = _a.Field, Field = _p === void 0 ? components_field_Component.Field : _p, _q = _a.Optgroup, Optgroup = _q === void 0 ? components_optgroup_Component.Optgroup : _q, _r = _a.Option, Option = _r === void 0 ? components_option_Component.Option : _r, restProps =
|
|
372
|
-
return (React__default.default.createElement(BaseSelectMobile,
|
|
376
|
+
var _b = _a.autocomplete, autocomplete = _b === void 0 ? false : _b, _c = _a.multiple, multiple = _c === void 0 ? false : _c, _d = _a.allowUnselect, allowUnselect = _d === void 0 ? false : _d, _e = _a.disabled, disabled = _e === void 0 ? false : _e, _f = _a.closeOnSelect, closeOnSelect = _f === void 0 ? !multiple : _f, _g = _a.circularNavigation, circularNavigation = _g === void 0 ? false : _g, _h = _a.defaultOpen, defaultOpen = _h === void 0 ? false : _h, openProp = _a.open, _j = _a.size, size = _j === void 0 ? 'm' : _j, _k = _a.optionsSize, optionsSize = _k === void 0 ? 'm' : _k, _l = _a.fieldProps, fieldProps = _l === void 0 ? {} : _l, _m = _a.optionProps, optionProps = _m === void 0 ? {} : _m, _o = _a.Arrow, Arrow = _o === void 0 ? components_arrow_Component.Arrow : _o, _p = _a.Field, Field = _p === void 0 ? components_field_Component.Field : _p, _q = _a.Optgroup, Optgroup = _q === void 0 ? components_optgroup_Component.Optgroup : _q, _r = _a.Option, Option = _r === void 0 ? components_option_Component.Option : _r, restProps = tslib.__rest(_a, ["autocomplete", "multiple", "allowUnselect", "disabled", "closeOnSelect", "circularNavigation", "defaultOpen", "open", "size", "optionsSize", "fieldProps", "optionProps", "Arrow", "Field", "Optgroup", "Option"]);
|
|
377
|
+
return (React__default.default.createElement(BaseSelectMobile, tslib.__assign({ ref: ref, autocomplete: autocomplete, multiple: multiple, allowUnselect: allowUnselect, disabled: disabled, closeOnSelect: closeOnSelect, circularNavigation: circularNavigation, defaultOpen: defaultOpen, open: openProp, size: size, optionsSize: optionsSize, fieldProps: fieldProps, optionProps: optionProps, Arrow: Arrow, Field: Field, Optgroup: Optgroup, Option: Option, isBottomSheet: false }, restProps)));
|
|
373
378
|
});
|
|
374
379
|
|
|
375
380
|
exports.BaseSelectMobile = BaseSelectMobile;
|
package/cssm/Component.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var tslib = require('tslib');
|
|
4
4
|
var React = require('react');
|
|
5
5
|
var components_arrow_Component = require('./components/arrow/Component.js');
|
|
6
|
-
var components_baseSelect_Component = require('./Component-
|
|
6
|
+
var components_baseSelect_Component = require('./Component-1481ef6b.js');
|
|
7
7
|
var components_field_Component = require('./components/field/Component.js');
|
|
8
8
|
var components_optgroup_Component = require('./components/optgroup/Component.js');
|
|
9
9
|
var components_option_Component = require('./components/option/Component.js');
|
|
@@ -39,8 +39,8 @@ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'defau
|
|
|
39
39
|
var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
40
40
|
|
|
41
41
|
var Select = React.forwardRef(function (_a, ref) {
|
|
42
|
-
var _b = _a.Arrow, Arrow = _b === void 0 ? components_arrow_Component.Arrow : _b, _c = _a.Field, Field = _c === void 0 ? components_field_Component.Field : _c, _d = _a.OptionsList, OptionsList = _d === void 0 ? components_optionsList_Component.OptionsList : _d, _e = _a.Optgroup, Optgroup = _e === void 0 ? components_optgroup_Component.Optgroup : _e, _f = _a.Option, Option = _f === void 0 ? components_option_Component.Option : _f, restProps =
|
|
43
|
-
return (React__default.default.createElement(components_baseSelect_Component.BaseSelect,
|
|
42
|
+
var _b = _a.Arrow, Arrow = _b === void 0 ? components_arrow_Component.Arrow : _b, _c = _a.Field, Field = _c === void 0 ? components_field_Component.Field : _c, _d = _a.OptionsList, OptionsList = _d === void 0 ? components_optionsList_Component.OptionsList : _d, _e = _a.Optgroup, Optgroup = _e === void 0 ? components_optgroup_Component.Optgroup : _e, _f = _a.Option, Option = _f === void 0 ? components_option_Component.Option : _f, restProps = tslib.__rest(_a, ["Arrow", "Field", "OptionsList", "Optgroup", "Option"]);
|
|
43
|
+
return (React__default.default.createElement(components_baseSelect_Component.BaseSelect, tslib.__assign({ ref: ref, Option: Option, Field: Field, Optgroup: Optgroup, OptionsList: OptionsList, Arrow: Arrow }, restProps)));
|
|
44
44
|
});
|
|
45
45
|
|
|
46
46
|
exports.Select = Select;
|