@vkontakte/vkui 5.9.2 → 5.9.4
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/ActionSheet/ActionSheet.js +1 -1
- package/dist/cjs/components/ActionSheet/ActionSheet.js.map +1 -1
- package/dist/cjs/components/CustomSelect/CustomSelect.d.ts +1 -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/Header/Header.d.ts +3 -3
- package/dist/cjs/components/Header/Header.d.ts.map +1 -1
- package/dist/cjs/components/Header/Header.js +4 -5
- package/dist/cjs/components/Header/Header.js.map +1 -1
- package/dist/cjs/components/HorizontalScroll/HorizontalScroll.d.ts.map +1 -1
- package/dist/cjs/components/HorizontalScroll/HorizontalScroll.js +4 -0
- package/dist/cjs/components/HorizontalScroll/HorizontalScroll.js.map +1 -1
- package/dist/cjs/components/ModalRoot/ModalRoot.d.ts.map +1 -1
- package/dist/cjs/components/ModalRoot/ModalRoot.js +7 -1
- package/dist/cjs/components/ModalRoot/ModalRoot.js.map +1 -1
- package/dist/cjs/components/PullToRefresh/PullToRefresh.d.ts.map +1 -1
- package/dist/cjs/components/PullToRefresh/PullToRefresh.js +35 -7
- package/dist/cjs/components/PullToRefresh/PullToRefresh.js.map +1 -1
- package/dist/cjs/components/Tappable/Tappable.d.ts.map +1 -1
- package/dist/cjs/components/Tappable/Tappable.js +1 -3
- package/dist/cjs/components/Tappable/Tappable.js.map +1 -1
- package/dist/cjs/components/Typography/Caption/Caption.d.ts +2 -0
- package/dist/cjs/components/Typography/Caption/Caption.d.ts.map +1 -1
- package/dist/cjs/components/Typography/Caption/Caption.js.map +1 -1
- package/dist/cjs/components/Typography/Footnote/Footnote.d.ts +2 -0
- package/dist/cjs/components/Typography/Footnote/Footnote.d.ts.map +1 -1
- package/dist/cjs/components/Typography/Footnote/Footnote.js.map +1 -1
- package/dist/cjs/components/Typography/Headline/Headline.d.ts +2 -0
- package/dist/cjs/components/Typography/Headline/Headline.d.ts.map +1 -1
- package/dist/cjs/components/Typography/Headline/Headline.js.map +1 -1
- package/dist/cjs/components/Typography/Paragraph/Paragraph.d.ts +2 -0
- package/dist/cjs/components/Typography/Paragraph/Paragraph.d.ts.map +1 -1
- package/dist/cjs/components/Typography/Paragraph/Paragraph.js.map +1 -1
- package/dist/cjs/components/Typography/Subhead/Subhead.d.ts +2 -0
- package/dist/cjs/components/Typography/Subhead/Subhead.d.ts.map +1 -1
- package/dist/cjs/components/Typography/Subhead/Subhead.js.map +1 -1
- package/dist/cjs/components/Typography/Text/Text.d.ts +2 -0
- package/dist/cjs/components/Typography/Text/Text.d.ts.map +1 -1
- package/dist/cjs/components/Typography/Text/Text.js.map +1 -1
- package/dist/cjs/components/Typography/Title/Title.d.ts +2 -0
- package/dist/cjs/components/Typography/Title/Title.d.ts.map +1 -1
- package/dist/cjs/components/Typography/Title/Title.js.map +1 -1
- package/dist/components/ActionSheet/ActionSheet.js +1 -1
- package/dist/components/ActionSheet/ActionSheet.js.map +1 -1
- package/dist/components/CustomSelect/CustomSelect.d.ts +1 -1
- package/dist/components/CustomSelect/CustomSelect.d.ts.map +1 -1
- package/dist/components/CustomSelect/CustomSelect.js.map +1 -1
- package/dist/components/Header/Header.d.ts +3 -3
- package/dist/components/Header/Header.d.ts.map +1 -1
- package/dist/components/Header/Header.js +4 -5
- package/dist/components/Header/Header.js.map +1 -1
- package/dist/components/HorizontalScroll/HorizontalScroll.d.ts.map +1 -1
- package/dist/components/HorizontalScroll/HorizontalScroll.js +4 -0
- package/dist/components/HorizontalScroll/HorizontalScroll.js.map +1 -1
- package/dist/components/ModalRoot/ModalRoot.d.ts.map +1 -1
- package/dist/components/ModalRoot/ModalRoot.js +7 -1
- package/dist/components/ModalRoot/ModalRoot.js.map +1 -1
- package/dist/components/PullToRefresh/PullToRefresh.d.ts.map +1 -1
- package/dist/components/PullToRefresh/PullToRefresh.js +35 -7
- package/dist/components/PullToRefresh/PullToRefresh.js.map +1 -1
- package/dist/components/Tappable/Tappable.d.ts.map +1 -1
- package/dist/components/Tappable/Tappable.js +1 -3
- package/dist/components/Tappable/Tappable.js.map +1 -1
- package/dist/components/Typography/Caption/Caption.d.ts +2 -0
- package/dist/components/Typography/Caption/Caption.d.ts.map +1 -1
- package/dist/components/Typography/Caption/Caption.js +2 -0
- package/dist/components/Typography/Caption/Caption.js.map +1 -1
- package/dist/components/Typography/Footnote/Footnote.d.ts +2 -0
- package/dist/components/Typography/Footnote/Footnote.d.ts.map +1 -1
- package/dist/components/Typography/Footnote/Footnote.js +2 -0
- package/dist/components/Typography/Footnote/Footnote.js.map +1 -1
- package/dist/components/Typography/Headline/Headline.d.ts +2 -0
- package/dist/components/Typography/Headline/Headline.d.ts.map +1 -1
- package/dist/components/Typography/Headline/Headline.js +2 -0
- package/dist/components/Typography/Headline/Headline.js.map +1 -1
- package/dist/components/Typography/Paragraph/Paragraph.d.ts +2 -0
- package/dist/components/Typography/Paragraph/Paragraph.d.ts.map +1 -1
- package/dist/components/Typography/Paragraph/Paragraph.js +2 -0
- package/dist/components/Typography/Paragraph/Paragraph.js.map +1 -1
- package/dist/components/Typography/Subhead/Subhead.d.ts +2 -0
- package/dist/components/Typography/Subhead/Subhead.d.ts.map +1 -1
- package/dist/components/Typography/Subhead/Subhead.js +2 -0
- package/dist/components/Typography/Subhead/Subhead.js.map +1 -1
- package/dist/components/Typography/Text/Text.d.ts +2 -0
- package/dist/components/Typography/Text/Text.d.ts.map +1 -1
- package/dist/components/Typography/Text/Text.js +2 -0
- package/dist/components/Typography/Text/Text.js.map +1 -1
- package/dist/components/Typography/Title/Title.d.ts +2 -0
- package/dist/components/Typography/Title/Title.d.ts.map +1 -1
- package/dist/components/Typography/Title/Title.js +2 -0
- package/dist/components/Typography/Title/Title.js.map +1 -1
- package/dist/components.css +2 -2
- package/dist/components.css.map +1 -1
- package/dist/components.js.tmp +1557 -1538
- package/dist/cssm/components/ActionSheet/ActionSheet.js +1 -1
- package/dist/cssm/components/ActionSheet/ActionSheet.js.map +1 -1
- package/dist/cssm/components/Alert/Alert.module.css +5 -0
- package/dist/cssm/components/CustomSelect/CustomSelect.d.ts +1 -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/Header/Header.d.ts +3 -3
- package/dist/cssm/components/Header/Header.d.ts.map +1 -1
- package/dist/cssm/components/Header/Header.js +2 -3
- package/dist/cssm/components/Header/Header.js.map +1 -1
- package/dist/cssm/components/HorizontalScroll/HorizontalScroll.d.ts.map +1 -1
- package/dist/cssm/components/HorizontalScroll/HorizontalScroll.js +4 -0
- package/dist/cssm/components/HorizontalScroll/HorizontalScroll.js.map +1 -1
- package/dist/cssm/components/ModalRoot/ModalRoot.d.ts.map +1 -1
- package/dist/cssm/components/ModalRoot/ModalRoot.js +7 -1
- package/dist/cssm/components/ModalRoot/ModalRoot.js.map +1 -1
- package/dist/cssm/components/PullToRefresh/PullToRefresh.d.ts.map +1 -1
- package/dist/cssm/components/PullToRefresh/PullToRefresh.js +35 -7
- package/dist/cssm/components/PullToRefresh/PullToRefresh.js.map +1 -1
- package/dist/cssm/components/Tappable/Tappable.d.ts.map +1 -1
- package/dist/cssm/components/Tappable/Tappable.js +1 -3
- package/dist/cssm/components/Tappable/Tappable.js.map +1 -1
- package/dist/cssm/components/Typography/Caption/Caption.d.ts +2 -0
- package/dist/cssm/components/Typography/Caption/Caption.d.ts.map +1 -1
- package/dist/cssm/components/Typography/Caption/Caption.js +2 -0
- package/dist/cssm/components/Typography/Caption/Caption.js.map +1 -1
- package/dist/cssm/components/Typography/Footnote/Footnote.d.ts +2 -0
- package/dist/cssm/components/Typography/Footnote/Footnote.d.ts.map +1 -1
- package/dist/cssm/components/Typography/Footnote/Footnote.js +2 -0
- package/dist/cssm/components/Typography/Footnote/Footnote.js.map +1 -1
- package/dist/cssm/components/Typography/Headline/Headline.d.ts +2 -0
- package/dist/cssm/components/Typography/Headline/Headline.d.ts.map +1 -1
- package/dist/cssm/components/Typography/Headline/Headline.js +2 -0
- package/dist/cssm/components/Typography/Headline/Headline.js.map +1 -1
- package/dist/cssm/components/Typography/Paragraph/Paragraph.d.ts +2 -0
- package/dist/cssm/components/Typography/Paragraph/Paragraph.d.ts.map +1 -1
- package/dist/cssm/components/Typography/Paragraph/Paragraph.js +2 -0
- package/dist/cssm/components/Typography/Paragraph/Paragraph.js.map +1 -1
- package/dist/cssm/components/Typography/Subhead/Subhead.d.ts +2 -0
- package/dist/cssm/components/Typography/Subhead/Subhead.d.ts.map +1 -1
- package/dist/cssm/components/Typography/Subhead/Subhead.js +2 -0
- package/dist/cssm/components/Typography/Subhead/Subhead.js.map +1 -1
- package/dist/cssm/components/Typography/Text/Text.d.ts +2 -0
- package/dist/cssm/components/Typography/Text/Text.d.ts.map +1 -1
- package/dist/cssm/components/Typography/Text/Text.js +2 -0
- package/dist/cssm/components/Typography/Text/Text.js.map +1 -1
- package/dist/cssm/components/Typography/Title/Title.d.ts +2 -0
- package/dist/cssm/components/Typography/Title/Title.d.ts.map +1 -1
- package/dist/cssm/components/Typography/Title/Title.js +2 -0
- package/dist/cssm/components/Typography/Title/Title.js.map +1 -1
- package/dist/cssm/styles/common.css +5 -0
- package/dist/vkui.css +2 -2
- package/dist/vkui.css.map +1 -1
- package/dist/vkui.js.tmp +1557 -1538
- package/package.json +1 -1
- package/src/components/ActionSheet/ActionSheet.tsx +2 -2
- package/src/components/Alert/Alert.module.css +5 -0
- package/src/components/CustomSelect/CustomSelect.tsx +1 -1
- package/src/components/Header/Header.tsx +3 -3
- package/src/components/HorizontalScroll/HorizontalScroll.tsx +4 -0
- package/src/components/ModalRoot/ModalRoot.tsx +9 -1
- package/src/components/PullToRefresh/PullToRefresh.tsx +43 -9
- package/src/components/Tappable/Tappable.tsx +1 -3
- package/src/components/Typography/Caption/Caption.tsx +2 -0
- package/src/components/Typography/Footnote/Footnote.tsx +2 -0
- package/src/components/Typography/Headline/Headline.tsx +2 -0
- package/src/components/Typography/Paragraph/Paragraph.tsx +2 -0
- package/src/components/Typography/Subhead/Subhead.tsx +2 -0
- package/src/components/Typography/Text/Text.tsx +2 -0
- package/src/components/Typography/Title/Title.tsx +2 -0
- package/src/styles/common.css +6 -0
- package/dist/cjs/hooks/useAdaptivityHasHover.d.ts +0 -9
- package/dist/cjs/hooks/useAdaptivityHasHover.d.ts.map +0 -1
- package/dist/cjs/hooks/useAdaptivityHasHover.js +0 -28
- package/dist/cjs/hooks/useAdaptivityHasHover.js.map +0 -1
- package/dist/cssm/hooks/useAdaptivityHasHover.d.ts +0 -9
- package/dist/cssm/hooks/useAdaptivityHasHover.d.ts.map +0 -1
- package/dist/cssm/hooks/useAdaptivityHasHover.js +0 -16
- package/dist/cssm/hooks/useAdaptivityHasHover.js.map +0 -1
- package/dist/hooks/useAdaptivityHasHover.d.ts +0 -9
- package/dist/hooks/useAdaptivityHasHover.d.ts.map +0 -1
- package/dist/hooks/useAdaptivityHasHover.js +0 -17
- package/dist/hooks/useAdaptivityHasHover.js.map +0 -1
- package/src/hooks/useAdaptivityHasHover.ts +0 -26
package/package.json
CHANGED
|
@@ -130,14 +130,14 @@ export const ActionSheet = ({
|
|
|
130
130
|
>
|
|
131
131
|
<div className={styles['ActionSheet__content-wrapper']}>
|
|
132
132
|
{(header || text) && (
|
|
133
|
-
<
|
|
133
|
+
<div className={styles['ActionSheet__header']}>
|
|
134
134
|
{header && (
|
|
135
135
|
<Footnote weight="2" className={styles['ActionSheet__title']}>
|
|
136
136
|
{header}
|
|
137
137
|
</Footnote>
|
|
138
138
|
)}
|
|
139
139
|
{text && <Footnote className={styles['ActionSheet__text']}>{text}</Footnote>}
|
|
140
|
-
</
|
|
140
|
+
</div>
|
|
141
141
|
)}
|
|
142
142
|
{children}
|
|
143
143
|
</div>
|
|
@@ -112,7 +112,7 @@ export interface CustomSelectOptionInterface {
|
|
|
112
112
|
}
|
|
113
113
|
|
|
114
114
|
interface CustomSelectRenderOption extends CustomSelectOptionProps {
|
|
115
|
-
option
|
|
115
|
+
option: CustomSelectOptionInterface;
|
|
116
116
|
}
|
|
117
117
|
|
|
118
118
|
export interface SelectProps extends NativeSelectProps, FormFieldProps, TrackerOptionsProps {
|
|
@@ -11,7 +11,7 @@ import { Subhead } from '../Typography/Subhead/Subhead';
|
|
|
11
11
|
import { Title } from '../Typography/Title/Title';
|
|
12
12
|
import styles from './Header.module.css';
|
|
13
13
|
|
|
14
|
-
export interface HeaderProps extends HTMLAttributesWithRootRef<HTMLElement
|
|
14
|
+
export interface HeaderProps extends HTMLAttributesWithRootRef<HTMLElement>, HasComponent {
|
|
15
15
|
mode?: 'primary' | 'secondary' | 'tertiary';
|
|
16
16
|
size?: 'regular' | 'large';
|
|
17
17
|
subtitle?: React.ReactNode;
|
|
@@ -75,6 +75,7 @@ const stylesMode = {
|
|
|
75
75
|
export const Header = ({
|
|
76
76
|
mode = 'primary',
|
|
77
77
|
size = 'regular',
|
|
78
|
+
Component = 'h2',
|
|
78
79
|
children,
|
|
79
80
|
subtitle,
|
|
80
81
|
indicator,
|
|
@@ -84,7 +85,6 @@ export const Header = ({
|
|
|
84
85
|
}: HeaderProps) => {
|
|
85
86
|
return (
|
|
86
87
|
<RootComponent
|
|
87
|
-
Component="header"
|
|
88
88
|
{...restProps}
|
|
89
89
|
baseClassName={classNames(
|
|
90
90
|
styles['Header'],
|
|
@@ -97,7 +97,7 @@ export const Header = ({
|
|
|
97
97
|
<div className={styles['Header__main']}>
|
|
98
98
|
<HeaderContent
|
|
99
99
|
className={styles['Header__content']}
|
|
100
|
-
Component=
|
|
100
|
+
Component={Component}
|
|
101
101
|
mode={mode}
|
|
102
102
|
size={size}
|
|
103
103
|
>
|
|
@@ -288,9 +288,11 @@ export const HorizontalScroll = ({
|
|
|
288
288
|
>
|
|
289
289
|
{showArrows && (hasPointer || hasPointer === undefined) && canScrollLeft && (
|
|
290
290
|
<ScrollArrow
|
|
291
|
+
data-testid={process.env.NODE_ENV === 'test' ? 'ScrollArrow' : undefined}
|
|
291
292
|
size={arrowSize}
|
|
292
293
|
offsetY={arrowOffsetY}
|
|
293
294
|
direction="left"
|
|
295
|
+
aria-hidden
|
|
294
296
|
className={classNames(
|
|
295
297
|
styles['HorizontalScroll__arrow'],
|
|
296
298
|
styles['HorizontalScroll__arrowLeft'],
|
|
@@ -300,9 +302,11 @@ export const HorizontalScroll = ({
|
|
|
300
302
|
)}
|
|
301
303
|
{showArrows && (hasPointer || hasPointer === undefined) && canScrollRight && (
|
|
302
304
|
<ScrollArrow
|
|
305
|
+
data-testid={process.env.NODE_ENV === 'test' ? 'ScrollArrow' : undefined}
|
|
303
306
|
size={arrowSize}
|
|
304
307
|
offsetY={arrowOffsetY}
|
|
305
308
|
direction="right"
|
|
309
|
+
aria-hidden
|
|
306
310
|
className={classNames(
|
|
307
311
|
styles['HorizontalScroll__arrow'],
|
|
308
312
|
styles['HorizontalScroll__arrowRight'],
|
|
@@ -146,7 +146,10 @@ class ModalRootTouchComponent extends React.Component<
|
|
|
146
146
|
this.documentScrolling = enabled;
|
|
147
147
|
|
|
148
148
|
if (enabled) {
|
|
149
|
-
//
|
|
149
|
+
// восстанавливаем значение overscroll behavior
|
|
150
|
+
// eslint-disable-next-line no-restricted-properties
|
|
151
|
+
this.document.documentElement.classList.remove('vkui--disable-overscroll-behavior');
|
|
152
|
+
|
|
150
153
|
// некоторые браузеры на странных вендорах типа Meizu не удаляют обработчик.
|
|
151
154
|
// https://github.com/VKCOM/VKUI/issues/444
|
|
152
155
|
this.window.removeEventListener('touchmove', this.preventTouch, {
|
|
@@ -154,6 +157,11 @@ class ModalRootTouchComponent extends React.Component<
|
|
|
154
157
|
passive: false,
|
|
155
158
|
});
|
|
156
159
|
} else {
|
|
160
|
+
// отключаем нативный pull-to-refresh при открытом модальном окне
|
|
161
|
+
// чтобы он не срабатывал при закрытии модалки смахиванием вниз
|
|
162
|
+
// eslint-disable-next-line no-restricted-properties
|
|
163
|
+
this.document.documentElement.classList.add('vkui--disable-overscroll-behavior');
|
|
164
|
+
|
|
157
165
|
this.window.addEventListener('touchmove', this.preventTouch, {
|
|
158
166
|
passive: false,
|
|
159
167
|
});
|
|
@@ -8,6 +8,7 @@ import { useTimeout } from '../../hooks/useTimeout';
|
|
|
8
8
|
import { DOMProps, useDOM } from '../../lib/dom';
|
|
9
9
|
import { Platform } from '../../lib/platform';
|
|
10
10
|
import { runTapticImpactOccurred } from '../../lib/taptic';
|
|
11
|
+
import { coordY, VKUITouchEvent } from '../../lib/touch';
|
|
11
12
|
import { useIsomorphicLayoutEffect } from '../../lib/useIsomorphicLayoutEffect';
|
|
12
13
|
import { AnyFunction, HasChildren } from '../../types';
|
|
13
14
|
import { ScrollContextInterface, useScroll } from '../AppRoot/ScrollContext';
|
|
@@ -113,15 +114,6 @@ export const PullToRefresh = ({
|
|
|
113
114
|
const [contentShift, setContentShift] = React.useState(0);
|
|
114
115
|
const [spinnerProgress, setSpinnerProgress] = React.useState(0);
|
|
115
116
|
|
|
116
|
-
const onWindowTouchMove = (event: Event) => {
|
|
117
|
-
if (refreshing) {
|
|
118
|
-
event.preventDefault();
|
|
119
|
-
event.stopPropagation();
|
|
120
|
-
}
|
|
121
|
-
};
|
|
122
|
-
|
|
123
|
-
useGlobalEventListener(document, 'touchmove', onWindowTouchMove, TOUCH_MOVE_EVENT_PARAMS);
|
|
124
|
-
|
|
125
117
|
const resetRefreshingState = React.useCallback(() => {
|
|
126
118
|
setWatching(false);
|
|
127
119
|
setCanRefresh(false);
|
|
@@ -199,13 +191,49 @@ export const PullToRefresh = ({
|
|
|
199
191
|
runRefreshing,
|
|
200
192
|
]);
|
|
201
193
|
|
|
194
|
+
const startYRef = React.useRef(0);
|
|
195
|
+
|
|
202
196
|
const onTouchStart = (e: TouchEvent) => {
|
|
203
197
|
if (refreshing) {
|
|
204
198
|
cancelEvent(e);
|
|
205
199
|
}
|
|
206
200
|
setTouchDown(true);
|
|
201
|
+
startYRef.current = e.startY;
|
|
202
|
+
|
|
203
|
+
if (document) {
|
|
204
|
+
// eslint-disable-next-line no-restricted-properties
|
|
205
|
+
document.documentElement.classList.add('vkui--disable-overscroll-behavior');
|
|
206
|
+
}
|
|
207
207
|
};
|
|
208
208
|
|
|
209
|
+
const shouldPreventTouchMove = (event: VKUITouchEvent) => {
|
|
210
|
+
if (watching || refreshing) {
|
|
211
|
+
return true;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
/* Нам нужно запретить touchmove у документа как только стало понятно, что
|
|
215
|
+
* начинается pull.
|
|
216
|
+
* состояния watching и refreshing устанавливаются слишком поздно и браузер
|
|
217
|
+
* может успеть начать нативный pull to refresh.
|
|
218
|
+
*
|
|
219
|
+
* Этот код является запасным вариантом, на случай, если css свойство
|
|
220
|
+
* overscroll-behavior не поддерживается
|
|
221
|
+
* */
|
|
222
|
+
const shiftY = coordY(event) - startYRef.current;
|
|
223
|
+
const pageYOffset = scroll?.getScroll().y;
|
|
224
|
+
const isRefreshGestureStarted = pageYOffset === 0 && shiftY > 0 && touchDown;
|
|
225
|
+
return isRefreshGestureStarted;
|
|
226
|
+
};
|
|
227
|
+
|
|
228
|
+
const onWindowTouchMove = (event: VKUITouchEvent) => {
|
|
229
|
+
if (shouldPreventTouchMove(event)) {
|
|
230
|
+
event.preventDefault();
|
|
231
|
+
event.stopPropagation();
|
|
232
|
+
}
|
|
233
|
+
};
|
|
234
|
+
|
|
235
|
+
useGlobalEventListener(document, 'touchmove', onWindowTouchMove, TOUCH_MOVE_EVENT_PARAMS);
|
|
236
|
+
|
|
209
237
|
const onTouchMove = (e: TouchEvent) => {
|
|
210
238
|
const { isY, shiftY } = e;
|
|
211
239
|
const { start, max } = initParams;
|
|
@@ -242,6 +270,12 @@ export const PullToRefresh = ({
|
|
|
242
270
|
const onTouchEnd = () => {
|
|
243
271
|
setWatching(false);
|
|
244
272
|
setTouchDown(false);
|
|
273
|
+
|
|
274
|
+
// восстанавливаем overscroll behavior
|
|
275
|
+
if (document) {
|
|
276
|
+
// eslint-disable-next-line no-restricted-properties
|
|
277
|
+
document.documentElement.classList.remove('vkui--disable-overscroll-behavior');
|
|
278
|
+
}
|
|
245
279
|
};
|
|
246
280
|
|
|
247
281
|
const spinnerTransform = `translate3d(0, ${spinnerY}px, 0)`;
|
|
@@ -2,7 +2,6 @@ import * as React from 'react';
|
|
|
2
2
|
import { classNames, noop } from '@vkontakte/vkjs';
|
|
3
3
|
import mitt from 'mitt';
|
|
4
4
|
import { useAdaptivity } from '../../hooks/useAdaptivity';
|
|
5
|
-
import { useAdaptivityHasHover } from '../../hooks/useAdaptivityHasHover';
|
|
6
5
|
import { useAdaptivityHasPointer } from '../../hooks/useAdaptivityHasPointer';
|
|
7
6
|
import { useBooleanState } from '../../hooks/useBooleanState';
|
|
8
7
|
import { useExternRef } from '../../hooks/useExternRef';
|
|
@@ -224,9 +223,8 @@ export const Tappable = ({
|
|
|
224
223
|
const insideTouchRoot = React.useContext(TouchRootContext);
|
|
225
224
|
const platform = usePlatform();
|
|
226
225
|
const { focusVisible, onBlur, onFocus } = useFocusVisible();
|
|
227
|
-
const { sizeX = 'none' } = useAdaptivity();
|
|
226
|
+
const { sizeX = 'none', hasHover: hasHoverContext = true } = useAdaptivity();
|
|
228
227
|
const hasPointerContext = useAdaptivityHasPointer();
|
|
229
|
-
const hasHoverContext = useAdaptivityHasHover();
|
|
230
228
|
|
|
231
229
|
const [clicks, setClicks] = React.useState<Wave[]>([]);
|
|
232
230
|
const [childHover, setChildHover] = React.useState(false);
|
package/src/styles/common.css
CHANGED
|
@@ -38,3 +38,9 @@
|
|
|
38
38
|
.vkui--layout-plain {
|
|
39
39
|
background: var(--vkui--color_background_content);
|
|
40
40
|
}
|
|
41
|
+
|
|
42
|
+
/* отключаем нативный pull-to-refresh при взаимодействии с компонентом
|
|
43
|
+
* PullToRefresh или при открывании модалки */
|
|
44
|
+
.vkui--disable-overscroll-behavior {
|
|
45
|
+
overscroll-behavior-y: none;
|
|
46
|
+
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Определение происходит с помощью `window.matchMedia`. Для того, чтобы не было ошибок при гидратации, по умолчанию
|
|
3
|
-
* откладываем определение на второй рендер.
|
|
4
|
-
*
|
|
5
|
-
* [No SSR] Если передать `false`, то определение будет сразу.
|
|
6
|
-
*/
|
|
7
|
-
export declare function useAdaptivityHasHover(deferDetect?: true): undefined | boolean;
|
|
8
|
-
export declare function useAdaptivityHasHover(deferDetect?: false): boolean;
|
|
9
|
-
//# sourceMappingURL=useAdaptivityHasHover.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useAdaptivityHasHover.d.ts","sourceRoot":"","sources":["../../../src/hooks/useAdaptivityHasHover.ts"],"names":[],"mappings":"AAKA;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,WAAW,CAAC,EAAE,IAAI,GAAG,SAAS,GAAG,OAAO,CAAC;AAC/E,wBAAgB,qBAAqB,CAAC,WAAW,CAAC,EAAE,KAAK,GAAG,OAAO,CAAC"}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "useAdaptivityHasHover", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return useAdaptivityHasHover;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
var _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard");
|
|
12
|
-
var _react = /*#__PURE__*/ _interop_require_wildcard._(require("react"));
|
|
13
|
-
var _vkjs = require("@vkontakte/vkjs");
|
|
14
|
-
var _AdaptivityContext = require("../components/AdaptivityProvider/AdaptivityContext");
|
|
15
|
-
var _useIsClient = require("./useIsClient");
|
|
16
|
-
function useAdaptivityHasHover() {
|
|
17
|
-
var deferDetect = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true;
|
|
18
|
-
var _React_useContext = _react.useContext(_AdaptivityContext.AdaptivityContext), hasHoverContext = _React_useContext.hasHover;
|
|
19
|
-
var hasHover = hasHoverContext === undefined ? _vkjs.hasHover : hasHoverContext;
|
|
20
|
-
var needTwoPassRendering = deferDetect || hasHoverContext === undefined;
|
|
21
|
-
var isClient = (0, _useIsClient.useIsClient)(!needTwoPassRendering);
|
|
22
|
-
if (!isClient || hasHoverContext !== undefined) {
|
|
23
|
-
return hasHoverContext;
|
|
24
|
-
}
|
|
25
|
-
return hasHover;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
//# sourceMappingURL=useAdaptivityHasHover.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/hooks/useAdaptivityHasHover.ts"],"sourcesContent":["import * as React from 'react';\nimport { hasHover as hasHoverLib } from '@vkontakte/vkjs';\nimport { AdaptivityContext } from '../components/AdaptivityProvider/AdaptivityContext';\nimport { useIsClient } from './useIsClient';\n\n/**\n * Определение происходит с помощью `window.matchMedia`. Для того, чтобы не было ошибок при гидратации, по умолчанию\n * откладываем определение на второй рендер.\n *\n * [No SSR] Если передать `false`, то определение будет сразу.\n */\nexport function useAdaptivityHasHover(deferDetect?: true): undefined | boolean;\nexport function useAdaptivityHasHover(deferDetect?: false): boolean;\nexport function useAdaptivityHasHover(deferDetect = true): undefined | boolean {\n const { hasHover: hasHoverContext } = React.useContext(AdaptivityContext);\n const hasHover = hasHoverContext === undefined ? hasHoverLib : hasHoverContext;\n\n const needTwoPassRendering = deferDetect || hasHoverContext === undefined;\n\n const isClient = useIsClient(!needTwoPassRendering);\n if (!isClient || hasHoverContext !== undefined) {\n return hasHoverContext;\n }\n\n return hasHover;\n}\n"],"names":["useAdaptivityHasHover","deferDetect","React","useContext","AdaptivityContext","hasHover","hasHoverContext","undefined","hasHoverLib","needTwoPassRendering","isClient","useIsClient"],"mappings":";;;;+BAagBA;;;eAAAA;;;;+DAbO;oBACiB;iCACN;2BACN;AAUrB,SAASA;QAAsBC,cAAAA,iEAAc;IAClD,IAAsCC,oBAAAA,OAAMC,UAAU,CAACC,oCAAiB,GAAhEC,AAAUC,kBAAoBJ,kBAA9BG;IACR,IAAMA,WAAWC,oBAAoBC,YAAYC,cAAW,GAAGF;IAE/D,IAAMG,uBAAuBR,eAAeK,oBAAoBC;IAEhE,IAAMG,WAAWC,IAAAA,wBAAW,EAAC,CAACF;IAC9B,IAAI,CAACC,YAAYJ,oBAAoBC,WAAW;QAC9C,OAAOD;IACT;IAEA,OAAOD;AACT"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Определение происходит с помощью `window.matchMedia`. Для того, чтобы не было ошибок при гидратации, по умолчанию
|
|
3
|
-
* откладываем определение на второй рендер.
|
|
4
|
-
*
|
|
5
|
-
* [No SSR] Если передать `false`, то определение будет сразу.
|
|
6
|
-
*/
|
|
7
|
-
export declare function useAdaptivityHasHover(deferDetect?: true): undefined | boolean;
|
|
8
|
-
export declare function useAdaptivityHasHover(deferDetect?: false): boolean;
|
|
9
|
-
//# sourceMappingURL=useAdaptivityHasHover.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useAdaptivityHasHover.d.ts","sourceRoot":"","sources":["../../../src/hooks/useAdaptivityHasHover.ts"],"names":[],"mappings":"AAKA;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,WAAW,CAAC,EAAE,IAAI,GAAG,SAAS,GAAG,OAAO,CAAC;AAC/E,wBAAgB,qBAAqB,CAAC,WAAW,CAAC,EAAE,KAAK,GAAG,OAAO,CAAC"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { hasHover as hasHoverLib } from '@vkontakte/vkjs';
|
|
3
|
-
import { AdaptivityContext } from '../components/AdaptivityProvider/AdaptivityContext';
|
|
4
|
-
import { useIsClient } from './useIsClient';
|
|
5
|
-
export function useAdaptivityHasHover(deferDetect = true) {
|
|
6
|
-
const { hasHover: hasHoverContext } = React.useContext(AdaptivityContext);
|
|
7
|
-
const hasHover = hasHoverContext === undefined ? hasHoverLib : hasHoverContext;
|
|
8
|
-
const needTwoPassRendering = deferDetect || hasHoverContext === undefined;
|
|
9
|
-
const isClient = useIsClient(!needTwoPassRendering);
|
|
10
|
-
if (!isClient || hasHoverContext !== undefined) {
|
|
11
|
-
return hasHoverContext;
|
|
12
|
-
}
|
|
13
|
-
return hasHover;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
//# sourceMappingURL=useAdaptivityHasHover.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/hooks/useAdaptivityHasHover.ts"],"sourcesContent":["import * as React from 'react';\nimport { hasHover as hasHoverLib } from '@vkontakte/vkjs';\nimport { AdaptivityContext } from '../components/AdaptivityProvider/AdaptivityContext';\nimport { useIsClient } from './useIsClient';\n\n/**\n * Определение происходит с помощью `window.matchMedia`. Для того, чтобы не было ошибок при гидратации, по умолчанию\n * откладываем определение на второй рендер.\n *\n * [No SSR] Если передать `false`, то определение будет сразу.\n */\nexport function useAdaptivityHasHover(deferDetect?: true): undefined | boolean;\nexport function useAdaptivityHasHover(deferDetect?: false): boolean;\nexport function useAdaptivityHasHover(deferDetect = true): undefined | boolean {\n const { hasHover: hasHoverContext } = React.useContext(AdaptivityContext);\n const hasHover = hasHoverContext === undefined ? hasHoverLib : hasHoverContext;\n\n const needTwoPassRendering = deferDetect || hasHoverContext === undefined;\n\n const isClient = useIsClient(!needTwoPassRendering);\n if (!isClient || hasHoverContext !== undefined) {\n return hasHoverContext;\n }\n\n return hasHover;\n}\n"],"names":["React","hasHover","hasHoverLib","AdaptivityContext","useIsClient","useAdaptivityHasHover","deferDetect","hasHoverContext","useContext","undefined","needTwoPassRendering","isClient"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,YAAYC,WAAW,QAAQ,kBAAkB;AAC1D,SAASC,iBAAiB,QAAQ,qDAAqD;AACvF,SAASC,WAAW,QAAQ,gBAAgB;AAU5C,OAAO,SAASC,sBAAsBC,cAAc,IAAI;IACtD,MAAM,EAAEL,UAAUM,eAAe,EAAE,GAAGP,MAAMQ,UAAU,CAACL;IACvD,MAAMF,WAAWM,oBAAoBE,YAAYP,cAAcK;IAE/D,MAAMG,uBAAuBJ,eAAeC,oBAAoBE;IAEhE,MAAME,WAAWP,YAAY,CAACM;IAC9B,IAAI,CAACC,YAAYJ,oBAAoBE,WAAW;QAC9C,OAAOF;IACT;IAEA,OAAON;AACT"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Определение происходит с помощью `window.matchMedia`. Для того, чтобы не было ошибок при гидратации, по умолчанию
|
|
3
|
-
* откладываем определение на второй рендер.
|
|
4
|
-
*
|
|
5
|
-
* [No SSR] Если передать `false`, то определение будет сразу.
|
|
6
|
-
*/
|
|
7
|
-
export declare function useAdaptivityHasHover(deferDetect?: true): undefined | boolean;
|
|
8
|
-
export declare function useAdaptivityHasHover(deferDetect?: false): boolean;
|
|
9
|
-
//# sourceMappingURL=useAdaptivityHasHover.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useAdaptivityHasHover.d.ts","sourceRoot":"","sources":["../../src/hooks/useAdaptivityHasHover.ts"],"names":[],"mappings":"AAKA;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,WAAW,CAAC,EAAE,IAAI,GAAG,SAAS,GAAG,OAAO,CAAC;AAC/E,wBAAgB,qBAAqB,CAAC,WAAW,CAAC,EAAE,KAAK,GAAG,OAAO,CAAC"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import { hasHover as hasHoverLib } from "@vkontakte/vkjs";
|
|
3
|
-
import { AdaptivityContext } from "../components/AdaptivityProvider/AdaptivityContext";
|
|
4
|
-
import { useIsClient } from "./useIsClient";
|
|
5
|
-
export function useAdaptivityHasHover() {
|
|
6
|
-
var deferDetect = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true;
|
|
7
|
-
var _React_useContext = React.useContext(AdaptivityContext), hasHoverContext = _React_useContext.hasHover;
|
|
8
|
-
var hasHover = hasHoverContext === undefined ? hasHoverLib : hasHoverContext;
|
|
9
|
-
var needTwoPassRendering = deferDetect || hasHoverContext === undefined;
|
|
10
|
-
var isClient = useIsClient(!needTwoPassRendering);
|
|
11
|
-
if (!isClient || hasHoverContext !== undefined) {
|
|
12
|
-
return hasHoverContext;
|
|
13
|
-
}
|
|
14
|
-
return hasHover;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
//# sourceMappingURL=useAdaptivityHasHover.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/hooks/useAdaptivityHasHover.ts"],"sourcesContent":["import * as React from 'react';\nimport { hasHover as hasHoverLib } from '@vkontakte/vkjs';\nimport { AdaptivityContext } from '../components/AdaptivityProvider/AdaptivityContext';\nimport { useIsClient } from './useIsClient';\n\n/**\n * Определение происходит с помощью `window.matchMedia`. Для того, чтобы не было ошибок при гидратации, по умолчанию\n * откладываем определение на второй рендер.\n *\n * [No SSR] Если передать `false`, то определение будет сразу.\n */\nexport function useAdaptivityHasHover(deferDetect?: true): undefined | boolean;\nexport function useAdaptivityHasHover(deferDetect?: false): boolean;\nexport function useAdaptivityHasHover(deferDetect = true): undefined | boolean {\n const { hasHover: hasHoverContext } = React.useContext(AdaptivityContext);\n const hasHover = hasHoverContext === undefined ? hasHoverLib : hasHoverContext;\n\n const needTwoPassRendering = deferDetect || hasHoverContext === undefined;\n\n const isClient = useIsClient(!needTwoPassRendering);\n if (!isClient || hasHoverContext !== undefined) {\n return hasHoverContext;\n }\n\n return hasHover;\n}\n"],"names":["React","hasHover","hasHoverLib","AdaptivityContext","useIsClient","useAdaptivityHasHover","deferDetect","useContext","hasHoverContext","undefined","needTwoPassRendering","isClient"],"mappings":"AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,YAAYC,WAAW,QAAQ,kBAAkB;AAC1D,SAASC,iBAAiB,QAAQ,qDAAqD;AACvF,SAASC,WAAW,QAAQ,gBAAgB;AAU5C,OAAO,SAASC;QAAsBC,cAAAA,iEAAc;IAClD,IAAsCN,oBAAAA,MAAMO,UAAU,CAACJ,oBAA/CF,AAAUO,kBAAoBR,kBAA9BC;IACR,IAAMA,WAAWO,oBAAoBC,YAAYP,cAAcM;IAE/D,IAAME,uBAAuBJ,eAAeE,oBAAoBC;IAEhE,IAAME,WAAWP,YAAY,CAACM;IAC9B,IAAI,CAACC,YAAYH,oBAAoBC,WAAW;QAC9C,OAAOD;IACT;IAEA,OAAOP;AACT"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { hasHover as hasHoverLib } from '@vkontakte/vkjs';
|
|
3
|
-
import { AdaptivityContext } from '../components/AdaptivityProvider/AdaptivityContext';
|
|
4
|
-
import { useIsClient } from './useIsClient';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Определение происходит с помощью `window.matchMedia`. Для того, чтобы не было ошибок при гидратации, по умолчанию
|
|
8
|
-
* откладываем определение на второй рендер.
|
|
9
|
-
*
|
|
10
|
-
* [No SSR] Если передать `false`, то определение будет сразу.
|
|
11
|
-
*/
|
|
12
|
-
export function useAdaptivityHasHover(deferDetect?: true): undefined | boolean;
|
|
13
|
-
export function useAdaptivityHasHover(deferDetect?: false): boolean;
|
|
14
|
-
export function useAdaptivityHasHover(deferDetect = true): undefined | boolean {
|
|
15
|
-
const { hasHover: hasHoverContext } = React.useContext(AdaptivityContext);
|
|
16
|
-
const hasHover = hasHoverContext === undefined ? hasHoverLib : hasHoverContext;
|
|
17
|
-
|
|
18
|
-
const needTwoPassRendering = deferDetect || hasHoverContext === undefined;
|
|
19
|
-
|
|
20
|
-
const isClient = useIsClient(!needTwoPassRendering);
|
|
21
|
-
if (!isClient || hasHoverContext !== undefined) {
|
|
22
|
-
return hasHoverContext;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
return hasHover;
|
|
26
|
-
}
|