@vkontakte/vkui 5.9.0 → 5.9.2
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/dist/cjs/components/Alert/Alert.d.ts +3 -3
- package/dist/cjs/components/Alert/Alert.d.ts.map +1 -1
- package/dist/cjs/components/Alert/Alert.js +5 -3
- package/dist/cjs/components/Alert/Alert.js.map +1 -1
- package/dist/cjs/components/CalendarRange/CalendarRange.d.ts +1 -1
- package/dist/cjs/components/CalendarRange/CalendarRange.d.ts.map +1 -1
- package/dist/cjs/components/CalendarRange/CalendarRange.js +1 -2
- package/dist/cjs/components/CalendarRange/CalendarRange.js.map +1 -1
- package/dist/cjs/components/ChipsSelect/ChipsSelect.js +1 -1
- package/dist/cjs/components/ChipsSelect/ChipsSelect.js.map +1 -1
- package/dist/cjs/components/CustomScrollView/CustomScrollView.d.ts +4 -2
- package/dist/cjs/components/CustomScrollView/CustomScrollView.d.ts.map +1 -1
- package/dist/cjs/components/CustomScrollView/CustomScrollView.js +17 -5
- package/dist/cjs/components/CustomScrollView/CustomScrollView.js.map +1 -1
- package/dist/cjs/components/CustomSelect/CustomSelect.d.ts +4 -1
- package/dist/cjs/components/CustomSelect/CustomSelect.d.ts.map +1 -1
- package/dist/cjs/components/CustomSelect/CustomSelect.js.map +1 -1
- package/dist/cjs/components/FormLayout/FormLayout.d.ts +3 -3
- package/dist/cjs/components/FormLayout/FormLayout.d.ts.map +1 -1
- package/dist/cjs/components/FormLayout/FormLayout.js +5 -2
- package/dist/cjs/components/FormLayout/FormLayout.js.map +1 -1
- package/dist/cjs/components/Gallery/Gallery.d.ts.map +1 -1
- package/dist/cjs/components/Gallery/Gallery.js +3 -10
- package/dist/cjs/components/Gallery/Gallery.js.map +1 -1
- package/dist/cjs/components/Gallery/hooks.d.ts +2 -0
- package/dist/cjs/components/Gallery/hooks.d.ts.map +1 -0
- package/dist/cjs/components/Gallery/hooks.js +52 -0
- package/dist/cjs/components/Gallery/hooks.js.map +1 -0
- package/dist/cjs/components/HorizontalScroll/HorizontalScroll.d.ts.map +1 -1
- package/dist/cjs/components/HorizontalScroll/HorizontalScroll.js +49 -20
- package/dist/cjs/components/HorizontalScroll/HorizontalScroll.js.map +1 -1
- package/dist/cjs/components/ModalPageHeader/ModalPageHeader.d.ts +3 -3
- package/dist/cjs/components/ModalPageHeader/ModalPageHeader.d.ts.map +1 -1
- package/dist/cjs/components/ModalPageHeader/ModalPageHeader.js +5 -2
- package/dist/cjs/components/ModalPageHeader/ModalPageHeader.js.map +1 -1
- package/dist/cjs/components/ModalRoot/ModalRoot.js +6 -8
- package/dist/cjs/components/ModalRoot/ModalRoot.js.map +1 -1
- package/dist/cjs/components/VisuallyHiddenInput/VisuallyHiddenInput.d.ts +3 -3
- package/dist/cjs/components/VisuallyHiddenInput/VisuallyHiddenInput.d.ts.map +1 -1
- package/dist/cjs/components/VisuallyHiddenInput/VisuallyHiddenInput.js +6 -3
- package/dist/cjs/components/VisuallyHiddenInput/VisuallyHiddenInput.js.map +1 -1
- package/dist/cjs/hooks/useDirection.d.ts +39 -0
- package/dist/cjs/hooks/useDirection.d.ts.map +1 -0
- package/dist/cjs/hooks/useDirection.js +39 -0
- package/dist/cjs/hooks/useDirection.js.map +1 -0
- package/dist/cjs/lib/floating/adapters.d.ts +1 -1
- package/dist/cjs/lib/floating/adapters.d.ts.map +1 -1
- package/dist/cjs/lib/floating/adapters.js +1 -1
- package/dist/cjs/lib/floating/adapters.js.map +1 -1
- package/dist/cjs/lib/floating/index.d.ts +1 -1
- package/dist/cjs/lib/floating/index.d.ts.map +1 -1
- package/dist/cjs/lib/floating/index.js +1 -1
- package/dist/cjs/lib/floating/index.js.map +1 -1
- package/dist/cjs/lib/floating/types.d.ts +2 -2
- package/dist/cjs/lib/floating/types.d.ts.map +1 -1
- package/dist/components/Alert/Alert.d.ts +3 -3
- package/dist/components/Alert/Alert.d.ts.map +1 -1
- package/dist/components/Alert/Alert.js +5 -3
- package/dist/components/Alert/Alert.js.map +1 -1
- package/dist/components/CalendarRange/CalendarRange.d.ts +1 -1
- package/dist/components/CalendarRange/CalendarRange.d.ts.map +1 -1
- package/dist/components/CalendarRange/CalendarRange.js +1 -2
- package/dist/components/CalendarRange/CalendarRange.js.map +1 -1
- package/dist/components/ChipsSelect/ChipsSelect.js +1 -1
- package/dist/components/ChipsSelect/ChipsSelect.js.map +1 -1
- package/dist/components/CustomScrollView/CustomScrollView.d.ts +4 -2
- package/dist/components/CustomScrollView/CustomScrollView.d.ts.map +1 -1
- package/dist/components/CustomScrollView/CustomScrollView.js +17 -5
- package/dist/components/CustomScrollView/CustomScrollView.js.map +1 -1
- package/dist/components/CustomSelect/CustomSelect.d.ts +4 -1
- package/dist/components/CustomSelect/CustomSelect.d.ts.map +1 -1
- package/dist/components/CustomSelect/CustomSelect.js.map +1 -1
- package/dist/components/FormLayout/FormLayout.d.ts +3 -3
- package/dist/components/FormLayout/FormLayout.d.ts.map +1 -1
- package/dist/components/FormLayout/FormLayout.js +5 -2
- package/dist/components/FormLayout/FormLayout.js.map +1 -1
- package/dist/components/Gallery/Gallery.d.ts.map +1 -1
- package/dist/components/Gallery/Gallery.js +3 -10
- package/dist/components/Gallery/Gallery.js.map +1 -1
- package/dist/components/Gallery/hooks.d.ts +2 -0
- package/dist/components/Gallery/hooks.d.ts.map +1 -0
- package/dist/components/Gallery/hooks.js +41 -0
- package/dist/components/Gallery/hooks.js.map +1 -0
- package/dist/components/HorizontalScroll/HorizontalScroll.d.ts.map +1 -1
- package/dist/components/HorizontalScroll/HorizontalScroll.js +49 -20
- package/dist/components/HorizontalScroll/HorizontalScroll.js.map +1 -1
- package/dist/components/ModalPageHeader/ModalPageHeader.d.ts +3 -3
- package/dist/components/ModalPageHeader/ModalPageHeader.d.ts.map +1 -1
- package/dist/components/ModalPageHeader/ModalPageHeader.js +5 -2
- package/dist/components/ModalPageHeader/ModalPageHeader.js.map +1 -1
- package/dist/components/ModalRoot/ModalRoot.js +6 -8
- package/dist/components/ModalRoot/ModalRoot.js.map +1 -1
- package/dist/components/VisuallyHiddenInput/VisuallyHiddenInput.d.ts +3 -3
- package/dist/components/VisuallyHiddenInput/VisuallyHiddenInput.d.ts.map +1 -1
- package/dist/components/VisuallyHiddenInput/VisuallyHiddenInput.js +6 -3
- package/dist/components/VisuallyHiddenInput/VisuallyHiddenInput.js.map +1 -1
- package/dist/components.css +6 -6
- package/dist/components.css.map +1 -1
- package/dist/components.js.tmp +3941 -2540
- package/dist/cssm/components/Alert/Alert.d.ts +3 -3
- package/dist/cssm/components/Alert/Alert.d.ts.map +1 -1
- package/dist/cssm/components/Alert/Alert.js +3 -2
- package/dist/cssm/components/Alert/Alert.js.map +1 -1
- package/dist/cssm/components/Button/Button.module.css +3 -1
- package/dist/cssm/components/CalendarRange/CalendarRange.d.ts +1 -1
- package/dist/cssm/components/CalendarRange/CalendarRange.d.ts.map +1 -1
- package/dist/cssm/components/CalendarRange/CalendarRange.js +1 -1
- package/dist/cssm/components/CalendarRange/CalendarRange.js.map +1 -1
- package/dist/cssm/components/ChipsSelect/ChipsSelect.js +1 -1
- package/dist/cssm/components/ChipsSelect/ChipsSelect.js.map +1 -1
- package/dist/cssm/components/CustomScrollView/CustomScrollView.d.ts +4 -2
- package/dist/cssm/components/CustomScrollView/CustomScrollView.d.ts.map +1 -1
- package/dist/cssm/components/CustomScrollView/CustomScrollView.js +4 -2
- package/dist/cssm/components/CustomScrollView/CustomScrollView.js.map +1 -1
- package/dist/cssm/components/CustomSelect/CustomSelect.d.ts +4 -1
- package/dist/cssm/components/CustomSelect/CustomSelect.d.ts.map +1 -1
- package/dist/cssm/components/CustomSelect/CustomSelect.js.map +1 -1
- package/dist/cssm/components/CustomSelectOption/CustomSelectOption.module.css +0 -5
- package/dist/cssm/components/FormLayout/FormLayout.d.ts +3 -3
- package/dist/cssm/components/FormLayout/FormLayout.d.ts.map +1 -1
- package/dist/cssm/components/FormLayout/FormLayout.js +4 -2
- package/dist/cssm/components/FormLayout/FormLayout.js.map +1 -1
- package/dist/cssm/components/Gallery/Gallery.d.ts.map +1 -1
- package/dist/cssm/components/Gallery/Gallery.js +2 -7
- package/dist/cssm/components/Gallery/Gallery.js.map +1 -1
- package/dist/cssm/components/Gallery/hooks.d.ts +2 -0
- package/dist/cssm/components/Gallery/hooks.d.ts.map +1 -0
- package/dist/cssm/components/Gallery/hooks.js +39 -0
- package/dist/cssm/components/Gallery/hooks.js.map +1 -0
- package/dist/cssm/components/Group/Group.module.css +2 -2
- package/dist/cssm/components/HorizontalScroll/HorizontalScroll.d.ts.map +1 -1
- package/dist/cssm/components/HorizontalScroll/HorizontalScroll.js +48 -19
- package/dist/cssm/components/HorizontalScroll/HorizontalScroll.js.map +1 -1
- package/dist/cssm/components/ModalPage/ModalPage.module.css +1 -4
- package/dist/cssm/components/ModalPageHeader/ModalPageHeader.d.ts +3 -3
- package/dist/cssm/components/ModalPageHeader/ModalPageHeader.d.ts.map +1 -1
- package/dist/cssm/components/ModalPageHeader/ModalPageHeader.js +4 -2
- package/dist/cssm/components/ModalPageHeader/ModalPageHeader.js.map +1 -1
- package/dist/cssm/components/ModalRoot/ModalRoot.js +6 -8
- package/dist/cssm/components/ModalRoot/ModalRoot.js.map +1 -1
- package/dist/cssm/components/PanelHeaderButton/PanelHeaderButton.module.css +7 -1
- package/dist/cssm/components/Snackbar/Snackbar.module.css +1 -1
- package/dist/cssm/components/VisuallyHiddenInput/VisuallyHiddenInput.d.ts +3 -3
- package/dist/cssm/components/VisuallyHiddenInput/VisuallyHiddenInput.d.ts.map +1 -1
- package/dist/cssm/components/VisuallyHiddenInput/VisuallyHiddenInput.js +4 -2
- package/dist/cssm/components/VisuallyHiddenInput/VisuallyHiddenInput.js.map +1 -1
- package/dist/cssm/hooks/useDirection.d.ts +39 -0
- package/dist/cssm/hooks/useDirection.d.ts.map +1 -0
- package/dist/cssm/hooks/useDirection.js +55 -0
- package/dist/cssm/hooks/useDirection.js.map +1 -0
- package/dist/cssm/lib/floating/adapters.d.ts +1 -1
- package/dist/cssm/lib/floating/adapters.d.ts.map +1 -1
- package/dist/cssm/lib/floating/adapters.js +1 -1
- package/dist/cssm/lib/floating/adapters.js.map +1 -1
- package/dist/cssm/lib/floating/index.d.ts +1 -1
- package/dist/cssm/lib/floating/index.d.ts.map +1 -1
- package/dist/cssm/lib/floating/index.js +1 -1
- package/dist/cssm/lib/floating/index.js.map +1 -1
- package/dist/cssm/lib/floating/types.d.ts +2 -2
- package/dist/cssm/lib/floating/types.d.ts.map +1 -1
- package/dist/cssm/lib/floating/types.js.map +1 -1
- package/dist/hooks/useDirection.d.ts +39 -0
- package/dist/hooks/useDirection.d.ts.map +1 -0
- package/dist/hooks/useDirection.js +56 -0
- package/dist/hooks/useDirection.js.map +1 -0
- package/dist/lib/floating/adapters.d.ts +1 -1
- package/dist/lib/floating/adapters.d.ts.map +1 -1
- package/dist/lib/floating/adapters.js +1 -1
- package/dist/lib/floating/adapters.js.map +1 -1
- package/dist/lib/floating/index.d.ts +1 -1
- package/dist/lib/floating/index.d.ts.map +1 -1
- package/dist/lib/floating/index.js +1 -1
- package/dist/lib/floating/index.js.map +1 -1
- package/dist/lib/floating/types.d.ts +2 -2
- package/dist/lib/floating/types.d.ts.map +1 -1
- package/dist/lib/floating/types.js.map +1 -1
- package/dist/vkui.css +6 -6
- package/dist/vkui.css.map +1 -1
- package/dist/vkui.js.tmp +3941 -2540
- package/package.json +2 -2
- package/src/components/Alert/Alert.tsx +10 -3
- package/src/components/Button/Button.module.css +3 -1
- package/src/components/CalendarRange/CalendarRange.tsx +0 -1
- package/src/components/ChipsSelect/ChipsSelect.tsx +1 -1
- package/src/components/CustomScrollView/CustomScrollView.tsx +13 -2
- package/src/components/CustomSelect/CustomSelect.tsx +5 -1
- package/src/components/CustomSelectOption/CustomSelectOption.module.css +0 -5
- package/src/components/FormLayout/FormLayout.tsx +8 -3
- package/src/components/Gallery/Gallery.tsx +2 -6
- package/src/components/Gallery/hooks.ts +39 -0
- package/src/components/Group/Group.module.css +2 -2
- package/src/components/HorizontalScroll/HorizontalScroll.tsx +54 -20
- package/src/components/ModalPage/ModalPage.module.css +1 -4
- package/src/components/ModalPageHeader/ModalPageHeader.tsx +8 -4
- package/src/components/ModalRoot/ModalRoot.tsx +6 -5
- package/src/components/PanelHeaderButton/PanelHeaderButton.module.css +6 -1
- package/src/components/Snackbar/Snackbar.module.css +1 -1
- package/src/components/VisuallyHiddenInput/VisuallyHiddenInput.tsx +6 -2
- package/src/hooks/useDirection.ts +63 -0
- package/src/lib/floating/adapters.ts +1 -1
- package/src/lib/floating/index.ts +1 -1
- package/src/lib/floating/types.ts +2 -2
package/package.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "5.9.
|
|
2
|
+
"version": "5.9.2",
|
|
3
3
|
"name": "@vkontakte/vkui",
|
|
4
4
|
"description": "VKUI library",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
@@ -70,10 +70,10 @@
|
|
|
70
70
|
"react-dom": "^17.0.0 || ^18.1.0"
|
|
71
71
|
},
|
|
72
72
|
"dependencies": {
|
|
73
|
-
"@floating-ui/react-dom": "^2.0.2",
|
|
74
73
|
"@swc/helpers": "^0.5.2",
|
|
75
74
|
"@vkontakte/icons": "^2.62.0",
|
|
76
75
|
"@vkontakte/vkjs": "^1.1.0",
|
|
76
|
+
"@vkontakte/vkui-floating-ui": "^0.1.0",
|
|
77
77
|
"dayjs": "^1.11.10",
|
|
78
78
|
"mitt": "^3.0.1"
|
|
79
79
|
},
|
|
@@ -7,7 +7,7 @@ import { usePlatform } from '../../hooks/usePlatform';
|
|
|
7
7
|
import { useWaitTransitionFinish } from '../../hooks/useWaitTransitionFinish';
|
|
8
8
|
import { Platform } from '../../lib/platform';
|
|
9
9
|
import { stopPropagation } from '../../lib/utils';
|
|
10
|
-
import { AlignType, AnchorHTMLAttributesOnly, HasDataAttribute } from '../../types';
|
|
10
|
+
import { AlignType, AnchorHTMLAttributesOnly, HasDataAttribute, HasRootRef } from '../../types';
|
|
11
11
|
import { useScrollLock } from '../AppRoot/ScrollContext';
|
|
12
12
|
import { ButtonProps } from '../Button/Button';
|
|
13
13
|
import { FocusTrap } from '../FocusTrap/FocusTrap';
|
|
@@ -31,7 +31,7 @@ export interface AlertActionInterface
|
|
|
31
31
|
mode: AlertActionMode;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
export interface AlertProps extends React.HTMLAttributes<HTMLElement> {
|
|
34
|
+
export interface AlertProps extends React.HTMLAttributes<HTMLElement>, HasRootRef<HTMLDivElement> {
|
|
35
35
|
actionsLayout?: 'vertical' | 'horizontal';
|
|
36
36
|
actionsAlign?: AlignType;
|
|
37
37
|
actions?: AlertActionInterface[];
|
|
@@ -67,6 +67,7 @@ export const Alert = ({
|
|
|
67
67
|
renderAction,
|
|
68
68
|
actionsAlign,
|
|
69
69
|
dismissButtonMode = 'outside',
|
|
70
|
+
getRootRef,
|
|
70
71
|
...restProps
|
|
71
72
|
}: AlertProps) => {
|
|
72
73
|
const generatedId = useId();
|
|
@@ -124,7 +125,13 @@ export const Alert = ({
|
|
|
124
125
|
useScrollLock();
|
|
125
126
|
|
|
126
127
|
return (
|
|
127
|
-
<PopoutWrapper
|
|
128
|
+
<PopoutWrapper
|
|
129
|
+
className={className}
|
|
130
|
+
closing={closing}
|
|
131
|
+
style={style}
|
|
132
|
+
onClick={close}
|
|
133
|
+
getRootRef={getRootRef}
|
|
134
|
+
>
|
|
128
135
|
<FocusTrap
|
|
129
136
|
{...restProps}
|
|
130
137
|
getRootRef={elementRef}
|
|
@@ -185,7 +185,9 @@
|
|
|
185
185
|
.Button--mode-link .Button__after,
|
|
186
186
|
.Button--mode-link .Button__before,
|
|
187
187
|
.Button--mode-link .Button__content:first-child,
|
|
188
|
-
.Button--mode-link .Button__content:last-child
|
|
188
|
+
.Button--mode-link .Button__content:last-child,
|
|
189
|
+
.Button--stretched .Button__after:only-child,
|
|
190
|
+
.Button--stretched .Button__before:only-child {
|
|
189
191
|
padding-left: 0;
|
|
190
192
|
padding-right: 0;
|
|
191
193
|
}
|
|
@@ -137,7 +137,7 @@ export const ChipsSelect = <Option extends ChipOption>(props: ChipsSelectProps<O
|
|
|
137
137
|
const [popperPlacement, setPopperPlacement] = React.useState<Placement | undefined>(undefined);
|
|
138
138
|
|
|
139
139
|
const scrollBoxRef = React.useRef<HTMLDivElement>(null);
|
|
140
|
-
const rootRef = useExternRef(
|
|
140
|
+
const rootRef = useExternRef(getRootRef);
|
|
141
141
|
const {
|
|
142
142
|
fieldValue,
|
|
143
143
|
selectedOptions = [],
|
|
@@ -5,10 +5,15 @@ import { useExternRef } from '../../hooks/useExternRef';
|
|
|
5
5
|
import { DOMProps, useDOM } from '../../lib/dom';
|
|
6
6
|
import { useIsomorphicLayoutEffect } from '../../lib/useIsomorphicLayoutEffect';
|
|
7
7
|
import { stopPropagation } from '../../lib/utils';
|
|
8
|
+
import type { HasRootRef } from '../../types';
|
|
8
9
|
import { TrackerOptionsProps, useTrackerVisibility } from './useTrackerVisibility';
|
|
9
10
|
import styles from './CustomScrollView.module.css';
|
|
10
11
|
|
|
11
|
-
export interface CustomScrollViewProps
|
|
12
|
+
export interface CustomScrollViewProps
|
|
13
|
+
extends React.AllHTMLAttributes<HTMLDivElement>,
|
|
14
|
+
DOMProps, // TODO [>=6]: remove
|
|
15
|
+
HasRootRef<HTMLDivElement>,
|
|
16
|
+
TrackerOptionsProps {
|
|
12
17
|
windowResize?: boolean;
|
|
13
18
|
boxRef?: React.Ref<HTMLDivElement>;
|
|
14
19
|
className?: HTMLDivElement['className'];
|
|
@@ -24,6 +29,8 @@ export const CustomScrollView = ({
|
|
|
24
29
|
autoHideScrollbar = false,
|
|
25
30
|
autoHideScrollbarDelay,
|
|
26
31
|
onScroll,
|
|
32
|
+
getRootRef,
|
|
33
|
+
...restProps
|
|
27
34
|
}: CustomScrollViewProps) => {
|
|
28
35
|
const { document, window } = useDOM();
|
|
29
36
|
|
|
@@ -174,7 +181,11 @@ export const CustomScrollView = ({
|
|
|
174
181
|
};
|
|
175
182
|
|
|
176
183
|
return (
|
|
177
|
-
<div
|
|
184
|
+
<div
|
|
185
|
+
className={classNames(styles['CustomScrollView'], className)}
|
|
186
|
+
ref={getRootRef}
|
|
187
|
+
{...restProps}
|
|
188
|
+
>
|
|
178
189
|
<div className={styles['CustomScrollView__box']} tabIndex={-1} ref={boxRef} onScroll={scroll}>
|
|
179
190
|
{children}
|
|
180
191
|
</div>
|
|
@@ -111,6 +111,10 @@ export interface CustomSelectOptionInterface {
|
|
|
111
111
|
[index: string]: any;
|
|
112
112
|
}
|
|
113
113
|
|
|
114
|
+
interface CustomSelectRenderOption extends CustomSelectOptionProps {
|
|
115
|
+
option?: CustomSelectOptionInterface;
|
|
116
|
+
}
|
|
117
|
+
|
|
114
118
|
export interface SelectProps extends NativeSelectProps, FormFieldProps, TrackerOptionsProps {
|
|
115
119
|
/**
|
|
116
120
|
* Если `true`, то при клике на селект в нём появится текстовое поле для поиска по `options`. По умолчанию поиск
|
|
@@ -149,7 +153,7 @@ export interface SelectProps extends NativeSelectProps, FormFieldProps, TrackerO
|
|
|
149
153
|
* > Запрещается выставлять `disabled` проп опциям в обход `options`, иначе селект не будет знать об актуальном состоянии
|
|
150
154
|
* опции.
|
|
151
155
|
*/
|
|
152
|
-
renderOption?: (props:
|
|
156
|
+
renderOption?: (props: CustomSelectRenderOption) => React.ReactNode;
|
|
153
157
|
/**
|
|
154
158
|
* Рендер-проп для кастомного рендера содержимого дропдауна.
|
|
155
159
|
* В `defaultDropdownContent` содержится список опций в виде скроллящегося блока.
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
position: relative;
|
|
6
6
|
box-sizing: border-box;
|
|
7
7
|
padding: 8px 12px;
|
|
8
|
-
white-space: nowrap;
|
|
9
8
|
user-select: none;
|
|
10
9
|
cursor: pointer;
|
|
11
10
|
color: var(--vkui--color_text_primary);
|
|
@@ -52,8 +51,6 @@
|
|
|
52
51
|
|
|
53
52
|
.CustomSelectOption__children {
|
|
54
53
|
min-width: 0;
|
|
55
|
-
overflow: hidden;
|
|
56
|
-
text-overflow: ellipsis;
|
|
57
54
|
}
|
|
58
55
|
|
|
59
56
|
.CustomSelectOption__after {
|
|
@@ -65,8 +62,6 @@
|
|
|
65
62
|
|
|
66
63
|
.CustomSelectOption__description {
|
|
67
64
|
color: var(--vkui--color_text_secondary);
|
|
68
|
-
text-overflow: ellipsis;
|
|
69
|
-
overflow: hidden;
|
|
70
65
|
}
|
|
71
66
|
|
|
72
67
|
.CustomSelectOption__selectedIcon {
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { classNames } from '@vkontakte/vkjs';
|
|
3
|
-
import {
|
|
3
|
+
import { useExternRef } from '../../hooks/useExternRef';
|
|
4
|
+
import { HasComponent, HasRef, HasRootRef } from '../../types';
|
|
4
5
|
import styles from './FormLayout.module.css';
|
|
5
6
|
|
|
6
7
|
const preventDefault = (e: React.FormEvent) => e.preventDefault();
|
|
7
8
|
|
|
8
9
|
export type FormLayoutProps = React.AllHTMLAttributes<HTMLElement> &
|
|
9
10
|
HasRef<HTMLElement> &
|
|
11
|
+
HasRootRef<HTMLElement> &
|
|
10
12
|
HasComponent;
|
|
11
13
|
|
|
12
14
|
/**
|
|
@@ -15,17 +17,20 @@ export type FormLayoutProps = React.AllHTMLAttributes<HTMLElement> &
|
|
|
15
17
|
export const FormLayout = ({
|
|
16
18
|
children,
|
|
17
19
|
Component = 'form',
|
|
18
|
-
getRef,
|
|
20
|
+
getRef, // TOOD [>=6]: remove
|
|
21
|
+
getRootRef,
|
|
19
22
|
onSubmit = preventDefault,
|
|
20
23
|
className,
|
|
21
24
|
...restProps
|
|
22
25
|
}: FormLayoutProps) => {
|
|
26
|
+
const formLayoutRef = useExternRef(getRef, getRootRef);
|
|
27
|
+
|
|
23
28
|
return (
|
|
24
29
|
<Component
|
|
25
30
|
{...restProps}
|
|
26
31
|
className={classNames(styles['FormLayout'], className)}
|
|
27
32
|
onSubmit={onSubmit}
|
|
28
|
-
ref={
|
|
33
|
+
ref={formLayoutRef}
|
|
29
34
|
>
|
|
30
35
|
{children}
|
|
31
36
|
{Component === 'form' && (
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { clamp } from '../../helpers/math';
|
|
3
3
|
import { useIsClient } from '../../hooks/useIsClient';
|
|
4
|
-
import { useTimeout } from '../../hooks/useTimeout';
|
|
5
4
|
import { BaseGallery } from '../BaseGallery/BaseGallery';
|
|
6
5
|
import { CarouselBase } from '../BaseGallery/CarouselBase/CarouselBase';
|
|
7
6
|
import { BaseGalleryProps } from '../BaseGallery/types';
|
|
7
|
+
import { useAutoPlay } from './hooks';
|
|
8
8
|
|
|
9
9
|
export interface GalleryProps extends BaseGalleryProps {
|
|
10
10
|
initialSlideIndex?: number;
|
|
@@ -47,11 +47,7 @@ export const Gallery = ({
|
|
|
47
47
|
[isControlled, onChange, slideIndex],
|
|
48
48
|
);
|
|
49
49
|
|
|
50
|
-
|
|
51
|
-
React.useEffect(
|
|
52
|
-
() => (timeout ? autoplay.set() : autoplay.clear()),
|
|
53
|
-
[timeout, slideIndex, autoplay],
|
|
54
|
-
);
|
|
50
|
+
useAutoPlay(timeout, slideIndex, () => handleChange((slideIndex + 1) % childCount));
|
|
55
51
|
|
|
56
52
|
// prevent invalid slideIndex
|
|
57
53
|
// any slide index is invalid with no slides, just keep it as is
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useTimeout } from '../../hooks/useTimeout';
|
|
3
|
+
import { useDOM } from '../../lib/dom';
|
|
4
|
+
|
|
5
|
+
export function useAutoPlay(timeout: number, slideIndex: number, callbackFn: VoidFunction) {
|
|
6
|
+
const { clear: clearAutoPlay, set: setAutoPlay } = useTimeout(callbackFn, timeout);
|
|
7
|
+
const { document } = useDOM();
|
|
8
|
+
|
|
9
|
+
React.useEffect(
|
|
10
|
+
() => (timeout ? setAutoPlay() : clearAutoPlay()),
|
|
11
|
+
[timeout, slideIndex, clearAutoPlay, setAutoPlay],
|
|
12
|
+
);
|
|
13
|
+
|
|
14
|
+
// Отключаем прокрутку слайдов при неактивной вкладке
|
|
15
|
+
React.useEffect(
|
|
16
|
+
function preventSlideChange() {
|
|
17
|
+
if (!document || !timeout) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const changeAutoPlay = () => {
|
|
22
|
+
if (document.visibilityState === 'visible') {
|
|
23
|
+
clearAutoPlay();
|
|
24
|
+
setAutoPlay();
|
|
25
|
+
}
|
|
26
|
+
if (document.visibilityState === 'hidden') {
|
|
27
|
+
clearAutoPlay();
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
document.addEventListener('visibilitychange', changeAutoPlay);
|
|
32
|
+
|
|
33
|
+
return () => {
|
|
34
|
+
document.removeEventListener('visibilitychange', changeAutoPlay);
|
|
35
|
+
};
|
|
36
|
+
},
|
|
37
|
+
[document, timeout, clearAutoPlay, setAutoPlay],
|
|
38
|
+
);
|
|
39
|
+
}
|
|
@@ -9,12 +9,12 @@
|
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
.Group--mode-plain:not(:first-of-type) > .Group__header {
|
|
12
|
-
margin-top: -
|
|
12
|
+
margin-top: -8px;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
@media (--sizeX-compact) {
|
|
16
16
|
.Group--sizeX-none.Group--mode-none:not(:first-of-type) > .Group__header {
|
|
17
|
-
margin-top: -
|
|
17
|
+
margin-top: -8px;
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { classNames, noop } from '@vkontakte/vkjs';
|
|
3
3
|
import { useAdaptivityHasPointer } from '../../hooks/useAdaptivityHasPointer';
|
|
4
|
+
import { useDirection } from '../../hooks/useDirection';
|
|
4
5
|
import { useEventListener } from '../../hooks/useEventListener';
|
|
5
6
|
import { useExternRef } from '../../hooks/useExternRef';
|
|
6
7
|
import { easeInOutSine } from '../../lib/fx';
|
|
@@ -14,7 +15,7 @@ interface ScrollContext {
|
|
|
14
15
|
scrollAnimationDuration: number;
|
|
15
16
|
animationQueue: VoidFunction[];
|
|
16
17
|
getScrollPosition: (currentPosition: number) => number;
|
|
17
|
-
|
|
18
|
+
onScrollToEndBorder: VoidFunction;
|
|
18
19
|
onScrollEnd: VoidFunction;
|
|
19
20
|
onScrollStart: VoidFunction;
|
|
20
21
|
/**
|
|
@@ -22,6 +23,7 @@ interface ScrollContext {
|
|
|
22
23
|
* В некоторых случаях может отличаться от текущей ширины прокрутки из-за transforms: translate
|
|
23
24
|
*/
|
|
24
25
|
initialScrollWidth: number;
|
|
26
|
+
textDirection: 'ltr' | 'rtl';
|
|
25
27
|
}
|
|
26
28
|
|
|
27
29
|
export type ScrollPositionHandler = (currentPosition: number) => number;
|
|
@@ -58,11 +60,27 @@ function now() {
|
|
|
58
60
|
return performance && performance.now ? performance.now() : Date.now();
|
|
59
61
|
}
|
|
60
62
|
|
|
63
|
+
/**
|
|
64
|
+
* Округление к большему по модулю
|
|
65
|
+
*
|
|
66
|
+
* ## Пример
|
|
67
|
+
*
|
|
68
|
+
* ```ts
|
|
69
|
+
* import { strict as assert } from 'node:assert';
|
|
70
|
+
*
|
|
71
|
+
* assert.equal(roundingAwayFromZero(5.1), 6)
|
|
72
|
+
* assert.equal(roundingAwayFromZero(-5.1), -6)
|
|
73
|
+
* ```
|
|
74
|
+
*/
|
|
75
|
+
function roundingAwayFromZero(value: number): number {
|
|
76
|
+
return value > 0 ? Math.ceil(value) : Math.floor(value);
|
|
77
|
+
}
|
|
78
|
+
|
|
61
79
|
/**
|
|
62
80
|
* Округляем el.scrollLeft
|
|
63
81
|
* https://github.com/VKCOM/VKUI/pull/2445
|
|
64
82
|
*/
|
|
65
|
-
const roundUpElementScrollLeft = (el: HTMLElement) =>
|
|
83
|
+
const roundUpElementScrollLeft = (el: HTMLElement) => roundingAwayFromZero(el.scrollLeft);
|
|
66
84
|
|
|
67
85
|
/**
|
|
68
86
|
* Код анимации скрола, на основе полифила: https://github.com/iamdustan/smoothscroll
|
|
@@ -75,29 +93,38 @@ function doScroll({
|
|
|
75
93
|
scrollElement,
|
|
76
94
|
getScrollPosition,
|
|
77
95
|
animationQueue,
|
|
78
|
-
|
|
96
|
+
onScrollToEndBorder,
|
|
79
97
|
onScrollEnd,
|
|
80
98
|
onScrollStart,
|
|
81
99
|
initialScrollWidth,
|
|
82
100
|
scrollAnimationDuration = SCROLL_ONE_FRAME_TIME,
|
|
101
|
+
textDirection,
|
|
83
102
|
}: ScrollContext) {
|
|
84
103
|
if (!scrollElement || !getScrollPosition) {
|
|
85
104
|
return;
|
|
86
105
|
}
|
|
87
106
|
|
|
88
107
|
/**
|
|
89
|
-
*
|
|
108
|
+
* крайнее значение сдвига
|
|
90
109
|
*/
|
|
91
|
-
const
|
|
110
|
+
const extremeScrollLeft =
|
|
111
|
+
(textDirection === 'ltr' ? 1 : -1) * (initialScrollWidth - scrollElement.offsetWidth);
|
|
92
112
|
|
|
93
|
-
let
|
|
94
|
-
let
|
|
113
|
+
let startScrollLeft = roundUpElementScrollLeft(scrollElement);
|
|
114
|
+
let endScrollLeft = getScrollPosition(startScrollLeft);
|
|
95
115
|
|
|
96
116
|
onScrollStart();
|
|
97
117
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
118
|
+
/**
|
|
119
|
+
* Если окончание прокрутки вышло за ноль
|
|
120
|
+
*/
|
|
121
|
+
if (startScrollLeft * endScrollLeft < 0) {
|
|
122
|
+
endScrollLeft = 0;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
if (Math.abs(endScrollLeft) >= Math.abs(extremeScrollLeft)) {
|
|
126
|
+
onScrollToEndBorder();
|
|
127
|
+
endScrollLeft = extremeScrollLeft;
|
|
101
128
|
}
|
|
102
129
|
|
|
103
130
|
const startTime = now();
|
|
@@ -113,10 +140,12 @@ function doScroll({
|
|
|
113
140
|
|
|
114
141
|
const value = easeInOutSine(elapsed);
|
|
115
142
|
|
|
116
|
-
const
|
|
117
|
-
scrollElement.scrollLeft =
|
|
143
|
+
const currentScrollLeft = startScrollLeft + (endScrollLeft - startScrollLeft) * value;
|
|
144
|
+
scrollElement.scrollLeft = roundingAwayFromZero(currentScrollLeft);
|
|
118
145
|
|
|
119
|
-
|
|
146
|
+
const scrollEnd =
|
|
147
|
+
textDirection === 'ltr' ? Math.max(0, endScrollLeft) : Math.min(0, endScrollLeft);
|
|
148
|
+
if (roundUpElementScrollLeft(scrollElement) !== scrollEnd && elapsed !== 1) {
|
|
120
149
|
requestAnimationFrame(scroll);
|
|
121
150
|
return;
|
|
122
151
|
}
|
|
@@ -146,10 +175,14 @@ export const HorizontalScroll = ({
|
|
|
146
175
|
}: HorizontalScrollProps) => {
|
|
147
176
|
const [canScrollLeft, setCanScrollLeft] = React.useState(false);
|
|
148
177
|
const [canScrollRight, setCanScrollRight] = React.useState(false);
|
|
178
|
+
const [directionRef, textDirection = 'ltr'] = useDirection<HTMLDivElement>();
|
|
179
|
+
|
|
180
|
+
const setCanScrollStart = textDirection === 'ltr' ? setCanScrollLeft : setCanScrollRight;
|
|
181
|
+
const setCanScrollEnd = textDirection === 'ltr' ? setCanScrollRight : setCanScrollLeft;
|
|
149
182
|
|
|
150
183
|
const isCustomScrollingRef = React.useRef(false);
|
|
151
184
|
|
|
152
|
-
const scrollerRef = useExternRef(getRef);
|
|
185
|
+
const scrollerRef = useExternRef(getRef, directionRef);
|
|
153
186
|
|
|
154
187
|
const animationQueue = React.useRef<VoidFunction[]>([]);
|
|
155
188
|
|
|
@@ -164,18 +197,19 @@ export const HorizontalScroll = ({
|
|
|
164
197
|
scrollElement,
|
|
165
198
|
getScrollPosition,
|
|
166
199
|
animationQueue: animationQueue.current,
|
|
167
|
-
|
|
200
|
+
onScrollToEndBorder: () => setCanScrollEnd(false),
|
|
168
201
|
onScrollEnd: () => (isCustomScrollingRef.current = false),
|
|
169
202
|
onScrollStart: () => (isCustomScrollingRef.current = true),
|
|
170
203
|
initialScrollWidth: scrollElement?.firstElementChild?.scrollWidth || 0,
|
|
171
204
|
scrollAnimationDuration,
|
|
205
|
+
textDirection,
|
|
172
206
|
}),
|
|
173
207
|
);
|
|
174
208
|
if (animationQueue.current.length === 1) {
|
|
175
209
|
animationQueue.current[0]();
|
|
176
210
|
}
|
|
177
211
|
},
|
|
178
|
-
[scrollAnimationDuration,
|
|
212
|
+
[scrollerRef, scrollAnimationDuration, textDirection, setCanScrollEnd],
|
|
179
213
|
);
|
|
180
214
|
|
|
181
215
|
const scrollToLeft = React.useCallback(() => {
|
|
@@ -194,13 +228,13 @@ export const HorizontalScroll = ({
|
|
|
194
228
|
if (showArrows && hasPointer && scrollerRef.current && !isCustomScrollingRef.current) {
|
|
195
229
|
const scrollElement = scrollerRef.current;
|
|
196
230
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
roundUpElementScrollLeft(scrollElement) + scrollElement.offsetWidth <
|
|
231
|
+
setCanScrollStart(scrollElement.scrollLeft !== 0);
|
|
232
|
+
setCanScrollEnd(
|
|
233
|
+
Math.abs(roundUpElementScrollLeft(scrollElement)) + scrollElement.offsetWidth <
|
|
200
234
|
scrollElement.scrollWidth,
|
|
201
235
|
);
|
|
202
236
|
}
|
|
203
|
-
}, [hasPointer, scrollerRef,
|
|
237
|
+
}, [showArrows, hasPointer, scrollerRef, setCanScrollStart, setCanScrollEnd]);
|
|
204
238
|
|
|
205
239
|
const scrollEvent = useEventListener('scroll', calculateArrowsVisibility);
|
|
206
240
|
React.useEffect(
|
|
@@ -116,10 +116,7 @@
|
|
|
116
116
|
}
|
|
117
117
|
|
|
118
118
|
.ModalPage--desktop .ModalPage__content-in,
|
|
119
|
-
:global(.vkuiInternalModalRoot__modal--expandable)
|
|
120
|
-
:global(.vkuiInternalModalRoot__modal--collapsed)
|
|
121
|
-
)
|
|
122
|
-
.ModalPage__content-in {
|
|
119
|
+
:global(.vkuiInternalModalRoot__modal--expandable) .ModalPage__content-in {
|
|
123
120
|
height: 100%;
|
|
124
121
|
}
|
|
125
122
|
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { classNames } from '@vkontakte/vkjs';
|
|
3
3
|
import { useAdaptivityWithJSMediaQueries } from '../../hooks/useAdaptivityWithJSMediaQueries';
|
|
4
|
+
import { useExternRef } from '../../hooks/useExternRef';
|
|
4
5
|
import { usePlatform } from '../../hooks/usePlatform';
|
|
5
6
|
import { Platform } from '../../lib/platform';
|
|
6
|
-
import { HasRef } from '../../types';
|
|
7
|
+
import { HasRef, HasRootRef } from '../../types';
|
|
7
8
|
import { ModalPageContext } from '../ModalPage/ModalPageContext';
|
|
8
9
|
import { PanelHeader, PanelHeaderProps } from '../PanelHeader/PanelHeader';
|
|
9
10
|
import { Separator } from '../Separator/Separator';
|
|
@@ -12,7 +13,8 @@ import styles from './ModalPageHeader.module.css';
|
|
|
12
13
|
export interface ModalPageHeaderProps
|
|
13
14
|
extends React.HTMLAttributes<HTMLDivElement>,
|
|
14
15
|
Omit<PanelHeaderProps, 'fixed' | 'shadow'>,
|
|
15
|
-
HasRef<HTMLDivElement
|
|
16
|
+
HasRef<HTMLDivElement>,
|
|
17
|
+
HasRootRef<HTMLDivElement> {}
|
|
16
18
|
|
|
17
19
|
/**
|
|
18
20
|
* @see https://vkcom.github.io/VKUI/#/ModalPageHeader
|
|
@@ -20,7 +22,8 @@ export interface ModalPageHeaderProps
|
|
|
20
22
|
export const ModalPageHeader = ({
|
|
21
23
|
children,
|
|
22
24
|
separator = true,
|
|
23
|
-
getRef,
|
|
25
|
+
getRef, // TODO [>=6]: remove
|
|
26
|
+
getRootRef,
|
|
24
27
|
className,
|
|
25
28
|
typographyProps,
|
|
26
29
|
...restProps
|
|
@@ -29,6 +32,7 @@ export const ModalPageHeader = ({
|
|
|
29
32
|
const hasSeparator = separator && platform === Platform.VKCOM;
|
|
30
33
|
const { isDesktop } = useAdaptivityWithJSMediaQueries();
|
|
31
34
|
const { labelId } = React.useContext(ModalPageContext);
|
|
35
|
+
const modalPageHeaderRef = useExternRef(getRef, getRootRef);
|
|
32
36
|
|
|
33
37
|
return (
|
|
34
38
|
<div
|
|
@@ -37,7 +41,7 @@ export const ModalPageHeader = ({
|
|
|
37
41
|
platform !== Platform.VKCOM && styles['ModalPageHeader--withGaps'],
|
|
38
42
|
isDesktop && styles['ModalPageHeader--desktop'],
|
|
39
43
|
)}
|
|
40
|
-
ref={
|
|
44
|
+
ref={modalPageHeaderRef}
|
|
41
45
|
>
|
|
42
46
|
<PanelHeader
|
|
43
47
|
className={classNames('vkuiInternalModalPageHeader__in', className)}
|
|
@@ -402,7 +402,7 @@ class ModalRootTouchComponent extends React.Component<
|
|
|
402
402
|
|
|
403
403
|
modalState.translateY = translateY;
|
|
404
404
|
modalState.translateYCurrent = translateY;
|
|
405
|
-
modalState.collapsed = translateY
|
|
405
|
+
modalState.collapsed = numberInRange(translateY, modalState.collapsedRange);
|
|
406
406
|
modalState.expanded = translateY === 0;
|
|
407
407
|
modalState.hidden = translateY === 100;
|
|
408
408
|
|
|
@@ -661,9 +661,10 @@ function initPageModal(modalState: ModalsStateEntry) {
|
|
|
661
661
|
let translateYFrom;
|
|
662
662
|
let translateY;
|
|
663
663
|
let expandedRange: TranslateRange;
|
|
664
|
-
let collapsedRange: TranslateRange;
|
|
664
|
+
let collapsedRange: TranslateRange | undefined;
|
|
665
665
|
let hiddenRange: TranslateRange;
|
|
666
666
|
|
|
667
|
+
const hasCollapsedState = Boolean(modalState.expandable && modalState.settlingHeight !== 100);
|
|
667
668
|
if (modalState.expandable) {
|
|
668
669
|
translateYFrom = 100 - (modalState.settlingHeight ?? 0);
|
|
669
670
|
|
|
@@ -671,10 +672,10 @@ function initPageModal(modalState: ModalsStateEntry) {
|
|
|
671
672
|
const visiblePart = 100 - translateYFrom;
|
|
672
673
|
|
|
673
674
|
expandedRange = [0, shiftHalf];
|
|
674
|
-
collapsedRange = [shiftHalf, translateYFrom + visiblePart / 4];
|
|
675
|
+
collapsedRange = hasCollapsedState ? [shiftHalf, translateYFrom + visiblePart / 4] : undefined;
|
|
675
676
|
hiddenRange = [translateYFrom + visiblePart / 4, 100];
|
|
676
677
|
|
|
677
|
-
collapsed = translateYFrom > 0;
|
|
678
|
+
collapsed = hasCollapsedState && translateYFrom > 0;
|
|
678
679
|
expanded = translateYFrom <= 0;
|
|
679
680
|
translateY = translateYFrom;
|
|
680
681
|
} else {
|
|
@@ -686,7 +687,7 @@ function initPageModal(modalState: ModalsStateEntry) {
|
|
|
686
687
|
translateY = translateYFrom;
|
|
687
688
|
|
|
688
689
|
expandedRange = [translateY, translateY + 25];
|
|
689
|
-
collapsedRange =
|
|
690
|
+
collapsedRange = undefined;
|
|
690
691
|
hiddenRange = [translateY + 25, translateY + 100];
|
|
691
692
|
}
|
|
692
693
|
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
.PanelHeaderButton--primitive {
|
|
18
18
|
height: 48px;
|
|
19
19
|
line-height: 48px;
|
|
20
|
-
padding: 0
|
|
20
|
+
padding: 0 10px;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
/*
|
|
@@ -44,6 +44,11 @@
|
|
|
44
44
|
padding: 8px;
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
+
/* stylelint-disable-next-line @project-tools/stylelint-atomic -- фикс для иконки назад */
|
|
48
|
+
.PanelHeaderBack--ios :global(.vkuiIcon--w-20) {
|
|
49
|
+
padding-left: 4px;
|
|
50
|
+
}
|
|
51
|
+
|
|
47
52
|
/*
|
|
48
53
|
* Android
|
|
49
54
|
*/
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
align-items: center;
|
|
43
43
|
background: var(--vkui--color_background_modal);
|
|
44
44
|
box-shadow: var(--vkui--elevation4);
|
|
45
|
-
border-radius: var(--vkui--
|
|
45
|
+
border-radius: var(--vkui--size_card_border_radius--regular);
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
.Snackbar--mode-dark .Snackbar__body {
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { classNames } from '@vkontakte/vkjs';
|
|
3
|
+
import { useExternRef } from '../../hooks/useExternRef';
|
|
3
4
|
import { warnOnce } from '../../lib/warnOnce';
|
|
4
|
-
import { HasRef } from '../../types';
|
|
5
|
+
import { HasRef, HasRootRef } from '../../types';
|
|
5
6
|
import styles from './VisuallyHiddenInput.module.css';
|
|
6
7
|
|
|
7
8
|
const warn = warnOnce('VisuallyHiddenInput');
|
|
8
9
|
export interface VisuallyHiddenInputProps
|
|
9
10
|
extends React.InputHTMLAttributes<HTMLInputElement>,
|
|
11
|
+
HasRootRef<HTMLInputElement>,
|
|
10
12
|
HasRef<HTMLInputElement> {}
|
|
11
13
|
/**
|
|
12
14
|
* @deprecated v5.4.0
|
|
@@ -17,8 +19,10 @@ export interface VisuallyHiddenInputProps
|
|
|
17
19
|
export const VisuallyHiddenInput = ({
|
|
18
20
|
getRef,
|
|
19
21
|
className,
|
|
22
|
+
getRootRef,
|
|
20
23
|
...restProps
|
|
21
24
|
}: VisuallyHiddenInputProps) => {
|
|
25
|
+
const visuallyHiddenInputRef = useExternRef(getRef, getRootRef);
|
|
22
26
|
if (process.env.NODE_ENV === 'development') {
|
|
23
27
|
warn(
|
|
24
28
|
'Компонент устарел и будет удален в v6. Используйте https://vkcom.github.io/VKUI/#/VisuallyHidden',
|
|
@@ -29,7 +33,7 @@ export const VisuallyHiddenInput = ({
|
|
|
29
33
|
<input
|
|
30
34
|
{...restProps}
|
|
31
35
|
className={classNames(styles['VisuallyHiddenInput'], className)}
|
|
32
|
-
ref={
|
|
36
|
+
ref={visuallyHiddenInputRef}
|
|
33
37
|
/>
|
|
34
38
|
);
|
|
35
39
|
};
|