@vkontakte/vkui 7.6.3 → 7.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Calendar/Calendar.d.ts.map +1 -1
- package/dist/components/Calendar/Calendar.js +1 -2
- package/dist/components/Calendar/Calendar.js.map +1 -1
- package/dist/components/CalendarHeader/CalendarHeader.js +1 -1
- package/dist/components/CalendarHeader/CalendarHeader.js.map +1 -1
- package/dist/components/CalendarRange/CalendarRange.d.ts.map +1 -1
- package/dist/components/CalendarRange/CalendarRange.js +2 -3
- package/dist/components/CalendarRange/CalendarRange.js.map +1 -1
- package/dist/components/CalendarRange/utils.d.ts.map +1 -1
- package/dist/components/CalendarRange/utils.js +1 -2
- package/dist/components/CalendarRange/utils.js.map +1 -1
- package/dist/components/CalendarTime/CalendarTime.js +1 -1
- package/dist/components/CalendarTime/CalendarTime.js.map +1 -1
- package/dist/components/CarouselBase/CarouselBase.d.ts +1 -1
- package/dist/components/CarouselBase/CarouselBase.d.ts.map +1 -1
- package/dist/components/CarouselBase/CarouselBase.js +44 -19
- package/dist/components/CarouselBase/CarouselBase.js.map +1 -1
- package/dist/components/CarouselBase/CarouselViewPort.d.ts +3 -2
- package/dist/components/CarouselBase/CarouselViewPort.d.ts.map +1 -1
- package/dist/components/CarouselBase/CarouselViewPort.js +13 -1
- package/dist/components/CarouselBase/CarouselViewPort.js.map +1 -1
- package/dist/components/CarouselBase/ScrollArrows.d.ts +3 -2
- package/dist/components/CarouselBase/ScrollArrows.d.ts.map +1 -1
- package/dist/components/CarouselBase/ScrollArrows.js +22 -11
- package/dist/components/CarouselBase/ScrollArrows.js.map +1 -1
- package/dist/components/CarouselBase/hooks.d.ts +1 -0
- package/dist/components/CarouselBase/hooks.d.ts.map +1 -1
- package/dist/components/CarouselBase/hooks.js +4 -0
- package/dist/components/CarouselBase/hooks.js.map +1 -1
- package/dist/components/CarouselBase/types.d.ts +9 -0
- package/dist/components/CarouselBase/types.d.ts.map +1 -1
- package/dist/components/CarouselBase/types.js.map +1 -1
- package/dist/components/Cell/Cell.d.ts +4 -0
- package/dist/components/Cell/Cell.d.ts.map +1 -1
- package/dist/components/Cell/Cell.js +3 -1
- package/dist/components/Cell/Cell.js.map +1 -1
- package/dist/components/CustomSelect/CustomSelect.d.ts.map +1 -1
- package/dist/components/CustomSelect/CustomSelect.js +4 -2
- package/dist/components/CustomSelect/CustomSelect.js.map +1 -1
- package/dist/components/DateInput/DateInput.d.ts.map +1 -1
- package/dist/components/DateInput/DateInput.js +1 -2
- package/dist/components/DateInput/DateInput.js.map +1 -1
- package/dist/components/Gallery/Gallery.d.ts +5 -1
- package/dist/components/Gallery/Gallery.d.ts.map +1 -1
- package/dist/components/Gallery/Gallery.js +19 -3
- package/dist/components/Gallery/Gallery.js.map +1 -1
- package/dist/components/ModalPage/ModalPageInternal.js +16 -8
- package/dist/components/ModalPage/ModalPageInternal.js.map +1 -1
- package/dist/components/ModalPage/types.d.ts +2 -2
- package/dist/components/ModalPage/types.d.ts.map +1 -1
- package/dist/components/ModalPage/types.js.map +1 -1
- package/dist/components/Search/Search.d.ts +5 -1
- package/dist/components/Search/Search.d.ts.map +1 -1
- package/dist/components/Search/Search.js +6 -4
- package/dist/components/Search/Search.js.map +1 -1
- package/dist/components.css +1 -1
- package/dist/components.css.map +1 -1
- package/dist/cssm/components/Calendar/Calendar.js +1 -2
- package/dist/cssm/components/Calendar/Calendar.js.map +1 -1
- package/dist/cssm/components/CalendarHeader/CalendarHeader.js +1 -1
- package/dist/cssm/components/CalendarHeader/CalendarHeader.js.map +1 -1
- package/dist/cssm/components/CalendarRange/CalendarRange.js +2 -3
- package/dist/cssm/components/CalendarRange/CalendarRange.js.map +1 -1
- package/dist/cssm/components/CalendarRange/utils.js +1 -2
- package/dist/cssm/components/CalendarRange/utils.js.map +1 -1
- package/dist/cssm/components/CalendarTime/CalendarTime.js +1 -1
- package/dist/cssm/components/CalendarTime/CalendarTime.js.map +1 -1
- package/dist/cssm/components/CarouselBase/CarouselBase.js +37 -16
- package/dist/cssm/components/CarouselBase/CarouselBase.js.map +1 -1
- package/dist/cssm/components/CarouselBase/CarouselBase.module.css +2 -0
- package/dist/cssm/components/CarouselBase/CarouselViewPort.js +13 -1
- package/dist/cssm/components/CarouselBase/CarouselViewPort.js.map +1 -1
- package/dist/cssm/components/CarouselBase/ScrollArrows.js +14 -7
- package/dist/cssm/components/CarouselBase/ScrollArrows.js.map +1 -1
- package/dist/cssm/components/CarouselBase/hooks.js +4 -0
- package/dist/cssm/components/CarouselBase/hooks.js.map +1 -1
- package/dist/cssm/components/CarouselBase/types.js.map +1 -1
- package/dist/cssm/components/Cell/Cell.js +2 -1
- package/dist/cssm/components/Cell/Cell.js.map +1 -1
- package/dist/cssm/components/CustomSelect/CustomSelect.js +4 -2
- package/dist/cssm/components/CustomSelect/CustomSelect.js.map +1 -1
- package/dist/cssm/components/DateInput/DateInput.js +1 -2
- package/dist/cssm/components/DateInput/DateInput.js.map +1 -1
- package/dist/cssm/components/Gallery/Gallery.js +14 -1
- package/dist/cssm/components/Gallery/Gallery.js.map +1 -1
- package/dist/cssm/components/ModalCard/ModalCard.module.css +0 -1
- package/dist/cssm/components/ModalOutlet/ModalOutlet.module.css +1 -0
- package/dist/cssm/components/ModalPage/ModalPage.module.css +2 -9
- package/dist/cssm/components/ModalPage/ModalPageInternal.js +16 -8
- package/dist/cssm/components/ModalPage/ModalPageInternal.js.map +1 -1
- package/dist/cssm/components/ModalPage/types.js.map +1 -1
- package/dist/cssm/components/Search/Search.js +4 -3
- package/dist/cssm/components/Search/Search.js.map +1 -1
- package/dist/cssm/components/Slider/SliderThumb/SliderThumb.module.css +2 -2
- package/dist/cssm/hooks/useCalendar.js +1 -2
- package/dist/cssm/hooks/useCalendar.js.map +1 -1
- package/dist/cssm/hooks/useTodayDate.js +2 -2
- package/dist/cssm/hooks/useTodayDate.js.map +1 -1
- package/dist/cssm/lib/calendar.js +8 -12
- package/dist/cssm/lib/calendar.js.map +1 -1
- package/dist/cssm/lib/date.js +142 -1
- package/dist/cssm/lib/date.js.map +1 -1
- package/dist/cssm/styles/constants.css +3 -0
- package/dist/hooks/useCalendar.d.ts.map +1 -1
- package/dist/hooks/useCalendar.js +1 -2
- package/dist/hooks/useCalendar.js.map +1 -1
- package/dist/hooks/useTodayDate.js +2 -2
- package/dist/hooks/useTodayDate.js.map +1 -1
- package/dist/lib/calendar.d.ts.map +1 -1
- package/dist/lib/calendar.js +8 -12
- package/dist/lib/calendar.js.map +1 -1
- package/dist/lib/date.d.ts +41 -0
- package/dist/lib/date.d.ts.map +1 -1
- package/dist/lib/date.js +142 -1
- package/dist/lib/date.js.map +1 -1
- package/dist/vkui.css +1 -1
- package/dist/vkui.css.map +1 -1
- package/package.json +3 -4
- package/src/components/Calendar/Calendar.tsx +6 -2
- package/src/components/CalendarHeader/CalendarHeader.tsx +1 -1
- package/src/components/CalendarRange/CalendarRange.tsx +9 -3
- package/src/components/CalendarRange/utils.ts +1 -2
- package/src/components/CalendarTime/CalendarTime.tsx +1 -1
- package/src/components/CarouselBase/CarouselBase.module.css +2 -0
- package/src/components/CarouselBase/CarouselBase.module.css.d.ts.map +1 -1
- package/src/components/CarouselBase/CarouselBase.tsx +47 -17
- package/src/components/CarouselBase/CarouselViewPort.tsx +25 -2
- package/src/components/CarouselBase/ScrollArrows.tsx +14 -2
- package/src/components/CarouselBase/hooks.ts +6 -0
- package/src/components/CarouselBase/types.ts +9 -0
- package/src/components/Cell/Cell.tsx +6 -0
- package/src/components/CustomSelect/CustomSelect.tsx +4 -2
- package/src/components/DateInput/DateInput.tsx +8 -2
- package/src/components/Gallery/Gallery.tsx +20 -0
- package/src/components/ModalCard/ModalCard.module.css +0 -1
- package/src/components/ModalCard/ModalCard.module.css.d.ts.map +1 -1
- package/src/components/ModalOutlet/ModalOutlet.module.css +1 -0
- package/src/components/ModalPage/ModalPage.module.css +2 -9
- package/src/components/ModalPage/ModalPage.module.css.d.ts.map +1 -1
- package/src/components/ModalPage/ModalPageInternal.tsx +8 -11
- package/src/components/ModalPage/types.ts +5 -2
- package/src/components/Search/Search.tsx +44 -31
- package/src/components/Slider/SliderThumb/SliderThumb.module.css +1 -1
- package/src/hooks/useCalendar.ts +1 -2
- package/src/hooks/useTodayDate.ts +2 -2
- package/src/lib/calendar.ts +12 -10
- package/src/lib/date.ts +187 -0
- package/src/lib/floating/useFloatingWithInteractions/__snapshots__/useFloatingWithInteractions.test.tsx.snap +1 -1
- package/src/styles/constants.css +3 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.7.0",
|
|
4
4
|
"name": "@vkontakte/vkui",
|
|
5
5
|
"description": "VKUI library",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -88,9 +88,8 @@
|
|
|
88
88
|
"@swc/helpers": "^0.5.17",
|
|
89
89
|
"@vkontakte/icons": "^3.0.0",
|
|
90
90
|
"@vkontakte/vkjs": "^2.0.1",
|
|
91
|
-
"@vkontakte/vkui-date-fns-tz": "^0.0.
|
|
92
|
-
"@vkontakte/vkui-floating-ui": "^0.2.
|
|
93
|
-
"date-fns": "^4.1.0"
|
|
91
|
+
"@vkontakte/vkui-date-fns-tz": "^0.0.6",
|
|
92
|
+
"@vkontakte/vkui-floating-ui": "^0.2.7"
|
|
94
93
|
},
|
|
95
94
|
"devDependencies": {
|
|
96
95
|
"@types/node": "*",
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { classNames, isSameDate } from '@vkontakte/vkjs';
|
|
5
|
-
import { startOfMonth } from 'date-fns';
|
|
6
5
|
import { useCalendar } from '../../hooks/useCalendar';
|
|
7
6
|
import { useCustomEnsuredControl } from '../../hooks/useEnsuredControl';
|
|
8
7
|
import { Keys, pressedKey } from '../../lib/accessibility';
|
|
@@ -14,7 +13,12 @@ import {
|
|
|
14
13
|
NAVIGATION_KEYS,
|
|
15
14
|
setTimeEqual,
|
|
16
15
|
} from '../../lib/calendar';
|
|
17
|
-
import {
|
|
16
|
+
import {
|
|
17
|
+
convertDateFromTimeZone,
|
|
18
|
+
convertDateToTimeZone,
|
|
19
|
+
isSameMonth,
|
|
20
|
+
startOfMonth,
|
|
21
|
+
} from '../../lib/date';
|
|
18
22
|
import { isHTMLElement } from '../../lib/dom';
|
|
19
23
|
import { useIsomorphicLayoutEffect } from '../../lib/useIsomorphicLayoutEffect';
|
|
20
24
|
import { warnOnce } from '../../lib/warnOnce';
|
|
@@ -8,8 +8,8 @@ import {
|
|
|
8
8
|
Icon20ChevronRightOutline,
|
|
9
9
|
} from '@vkontakte/icons';
|
|
10
10
|
import { classNames } from '@vkontakte/vkjs';
|
|
11
|
-
import { addMonths, setMonth, setYear, subMonths } from 'date-fns';
|
|
12
11
|
import { DEFAULT_MAX_YEAR, DEFAULT_MIN_YEAR, getMonths, getYears } from '../../lib/calendar';
|
|
12
|
+
import { addMonths, setMonth, setYear, subMonths } from '../../lib/date';
|
|
13
13
|
import type { HTMLAttributesWithRootRef } from '../../types';
|
|
14
14
|
import { AdaptivityProvider } from '../AdaptivityProvider/AdaptivityProvider';
|
|
15
15
|
import { useConfigProvider } from '../ConfigProvider/ConfigProviderContext';
|
|
@@ -2,11 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { isSameDate } from '@vkontakte/vkjs';
|
|
5
|
-
import { addMonths, startOfDay, subMonths } from 'date-fns';
|
|
6
5
|
import { useCalendar } from '../../hooks/useCalendar';
|
|
7
6
|
import { useCustomEnsuredControl } from '../../hooks/useEnsuredControl';
|
|
8
7
|
import { isFirstDay, isLastDay } from '../../lib/calendar';
|
|
9
|
-
import {
|
|
8
|
+
import {
|
|
9
|
+
addMonths,
|
|
10
|
+
endOfDay,
|
|
11
|
+
isWithinInterval,
|
|
12
|
+
MONDAY,
|
|
13
|
+
startOfDay,
|
|
14
|
+
subMonths,
|
|
15
|
+
} from '../../lib/date';
|
|
10
16
|
import type { HTMLAttributesWithRootRef } from '../../types';
|
|
11
17
|
import {
|
|
12
18
|
CalendarDays,
|
|
@@ -117,7 +123,7 @@ export const CalendarRange = ({
|
|
|
117
123
|
disablePast,
|
|
118
124
|
disableFuture,
|
|
119
125
|
shouldDisableDate,
|
|
120
|
-
weekStartsOn =
|
|
126
|
+
weekStartsOn = MONDAY,
|
|
121
127
|
disablePickers,
|
|
122
128
|
prevMonthLabel = 'Предыдущий месяц',
|
|
123
129
|
nextMonthLabel = 'Следующий месяц',
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { isSameDate } from '@vkontakte/vkjs';
|
|
3
|
-
import { startOfMonth } from 'date-fns';
|
|
4
3
|
import { Keys, pressedKey } from '../../lib/accessibility';
|
|
5
4
|
import { navigateDate, NAVIGATION_KEYS } from '../../lib/calendar';
|
|
6
|
-
import { isSameMonth } from '../../lib/date';
|
|
5
|
+
import { isSameMonth, startOfMonth } from '../../lib/date';
|
|
7
6
|
import { isHTMLElement } from '../../lib/dom';
|
|
8
7
|
import type { DateRangeType } from './types';
|
|
9
8
|
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
import { type ChangeEvent, useRef } from 'react';
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import { classNames } from '@vkontakte/vkjs';
|
|
6
|
-
import { setHours, setMinutes } from 'date-fns';
|
|
7
6
|
import { Keys, pressedKey } from '../../lib/accessibility';
|
|
8
7
|
import { callMultiple } from '../../lib/callMultiple';
|
|
8
|
+
import { setHours, setMinutes } from '../../lib/date';
|
|
9
9
|
import { AdaptivityProvider } from '../AdaptivityProvider/AdaptivityProvider';
|
|
10
10
|
import { Button, type ButtonProps } from '../Button/Button';
|
|
11
11
|
import { CustomSelect, type SelectProps } from '../CustomSelect/CustomSelect';
|
|
@@ -78,6 +78,7 @@
|
|
|
78
78
|
|
|
79
79
|
.arrow {
|
|
80
80
|
position: absolute;
|
|
81
|
+
z-index: var(--vkui_internal--z_index_gallery_scroll_arrow);
|
|
81
82
|
opacity: 0;
|
|
82
83
|
}
|
|
83
84
|
|
|
@@ -104,6 +105,7 @@
|
|
|
104
105
|
opacity: var(--vkui--opacity_disable_accessibility);
|
|
105
106
|
}
|
|
106
107
|
|
|
108
|
+
.arrowFocusVisible,
|
|
107
109
|
.host .arrow:hover {
|
|
108
110
|
opacity: 1;
|
|
109
111
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["./CarouselBase.module.css"],"names":["host","viewport","layer","draggable","slide","customWidth","bullets","bulletsDark","bullet","bulletsLight","bulletActive","arrow","arrowAreaStretch","arrowAreaFit","arrowStart","arrowEnd"],"mappings":"AAAA;AAAA,E,aAAAA,M,WAAA;AAAA,E,aAMAC,U,WANA;AAAA,E,aAYAC,O,WAZA;AAAA,E,aAqBAC,W,WArBA;AAAA,E,aAqBWD,O,WArBX;AAAA,E,aAyBAA,O,WAzBA;AAAA,E,aA6BAE,O,WA7BA;AAAA,E,aAoCAC,a,WApCA;AAAA,E,aAoCaD,O,WApCb;AAAA,E,aAyCAA,O,WAzCA;AAAA,E,aA8CAE,S,WA9CA;AAAA,E,aAyDAC,a,WAzDA;AAAA,E,aAyDaC,Q,WAzDb;AAAA,E,aA6DAC,c,WA7DA;AAAA,E,aA6DcD,Q,WA7Dd;AAAA,E,aAiEAA,Q,WAjEA;AAAA,E,aA0EAE,c,WA1EA;AAAA,E,aA8EAC,O,WA9EA;AAAA,E,
|
|
1
|
+
{"version":3,"sources":["./CarouselBase.module.css"],"names":["host","viewport","layer","draggable","slide","customWidth","bullets","bulletsDark","bullet","bulletsLight","bulletActive","arrow","arrowAreaStretch","arrowAreaFit","arrowStart","arrowEnd","arrowFocusVisible"],"mappings":"AAAA;AAAA,E,aAAAA,M,WAAA;AAAA,E,aAMAC,U,WANA;AAAA,E,aAYAC,O,WAZA;AAAA,E,aAqBAC,W,WArBA;AAAA,E,aAqBWD,O,WArBX;AAAA,E,aAyBAA,O,WAzBA;AAAA,E,aA6BAE,O,WA7BA;AAAA,E,aAoCAC,a,WApCA;AAAA,E,aAoCaD,O,WApCb;AAAA,E,aAyCAA,O,WAzCA;AAAA,E,aA8CAE,S,WA9CA;AAAA,E,aAyDAC,a,WAzDA;AAAA,E,aAyDaC,Q,WAzDb;AAAA,E,aA6DAC,c,WA7DA;AAAA,E,aA6DcD,Q,WA7Dd;AAAA,E,aAiEAA,Q,WAjEA;AAAA,E,aA0EAE,c,WA1EA;AAAA,E,aA8EAC,O,WA9EA;AAAA,E,aAoFAA,O,WApFA;AAAA,E,aAoFMC,kB,WApFN;AAAA,E,aAwFAD,O,WAxFA;AAAA,E,aAwFME,c,WAxFN;AAAA,E,aA+FAC,Y,WA/FA;AAAA,E,aAmGAC,U,WAnGA;AAAA,E,aAuGAf,M,WAvGA;AAAA,E,aAuGYW,O,WAvGZ;AAAA,E,aA2GAK,mB,WA3GA;AAAA,E,aA4GAhB,M,WA5GA;AAAA,E,aA4GMW,O,WA5GN;AAAA;AAAA","file":"CarouselBase.module.css.d.ts","sourceRoot":""}
|
|
@@ -62,13 +62,18 @@ export const CarouselBase = ({
|
|
|
62
62
|
getRef,
|
|
63
63
|
arrowSize,
|
|
64
64
|
arrowAreaHeight,
|
|
65
|
-
arrowNextLabel,
|
|
66
|
-
arrowPrevLabel,
|
|
67
65
|
slideTestId,
|
|
68
66
|
bulletTestId,
|
|
69
67
|
nextArrowTestId,
|
|
70
68
|
prevArrowTestId,
|
|
71
69
|
looped = false,
|
|
70
|
+
|
|
71
|
+
// a11y
|
|
72
|
+
'aria-roledescription': ariaRoleDescription = 'Карусель',
|
|
73
|
+
arrowNextLabel = 'Следующий слайд',
|
|
74
|
+
arrowPrevLabel = 'Предыдущий слайд',
|
|
75
|
+
slideLabel,
|
|
76
|
+
slideRoleDescription,
|
|
72
77
|
...restProps
|
|
73
78
|
}: BaseGalleryProps): React.ReactNode => {
|
|
74
79
|
const slidesStore = React.useRef<Record<string, HTMLDivElement | null>>({});
|
|
@@ -83,7 +88,8 @@ export const CarouselBase = ({
|
|
|
83
88
|
const shiftXCurrentRef = React.useRef<number>(0);
|
|
84
89
|
const shiftXDeltaRef = React.useRef<number>(0);
|
|
85
90
|
const initialized = React.useRef<boolean>(false);
|
|
86
|
-
const { addToAnimationQueue, getAnimateFunction, startAnimation } =
|
|
91
|
+
const { animationInQueue, addToAnimationQueue, getAnimateFunction, startAnimation } =
|
|
92
|
+
useSlideAnimation();
|
|
87
93
|
const isDragging = React.useRef(false);
|
|
88
94
|
|
|
89
95
|
const [controlElementsState, setControlElementsState] =
|
|
@@ -91,6 +97,8 @@ export const CarouselBase = ({
|
|
|
91
97
|
|
|
92
98
|
const hasPointer = useAdaptivityHasPointer();
|
|
93
99
|
|
|
100
|
+
const slidesContainerId = React.useId();
|
|
101
|
+
|
|
94
102
|
const isCenterAlign = align === 'center';
|
|
95
103
|
|
|
96
104
|
const calculateCanSlideLeft = () => {
|
|
@@ -195,6 +203,7 @@ export const CarouselBase = ({
|
|
|
195
203
|
shiftXCurrentRef.current = Math.abs(shiftXDeltaRef.current) + snaps[0];
|
|
196
204
|
}
|
|
197
205
|
transformCssStyles(shiftX, animation);
|
|
206
|
+
animationFrameRef.current = null;
|
|
198
207
|
});
|
|
199
208
|
};
|
|
200
209
|
|
|
@@ -308,6 +317,12 @@ export const CarouselBase = ({
|
|
|
308
317
|
);
|
|
309
318
|
}
|
|
310
319
|
|
|
320
|
+
const isAnimationInProgress = animationInQueue() || animationFrameRef.current !== null;
|
|
321
|
+
|
|
322
|
+
if (isAnimationInProgress) {
|
|
323
|
+
return;
|
|
324
|
+
}
|
|
325
|
+
|
|
311
326
|
shiftXCurrentRef.current = snaps[slideIndex];
|
|
312
327
|
initialized.current = true;
|
|
313
328
|
|
|
@@ -521,9 +536,19 @@ export const CarouselBase = ({
|
|
|
521
536
|
|
|
522
537
|
const { isDraggable, canSlideRight, canSlideLeft } = controlElementsState;
|
|
523
538
|
|
|
539
|
+
const handleScrollForFixVoiceOverBehavior = (event: React.UIEvent<HTMLDivElement>) => {
|
|
540
|
+
restProps.onScroll?.(event);
|
|
541
|
+
if (rootRef.current) {
|
|
542
|
+
event.currentTarget.scrollLeft = 0;
|
|
543
|
+
}
|
|
544
|
+
};
|
|
545
|
+
|
|
524
546
|
return (
|
|
525
547
|
<RootComponent
|
|
526
548
|
{...restProps}
|
|
549
|
+
role="region"
|
|
550
|
+
onScroll={handleScrollForFixVoiceOverBehavior}
|
|
551
|
+
aria-roledescription={ariaRoleDescription}
|
|
527
552
|
baseClassName={classNames(
|
|
528
553
|
styles.host,
|
|
529
554
|
slideWidth === 'custom' && styles.customWidth,
|
|
@@ -531,6 +556,21 @@ export const CarouselBase = ({
|
|
|
531
556
|
)}
|
|
532
557
|
getRootRef={rootRef}
|
|
533
558
|
>
|
|
559
|
+
<ScrollArrows
|
|
560
|
+
hasPointer={hasPointer}
|
|
561
|
+
canSlideLeft={canSlideLeft}
|
|
562
|
+
canSlideRight={canSlideRight}
|
|
563
|
+
onSlideRight={slideRight}
|
|
564
|
+
onSlideLeft={slideLeft}
|
|
565
|
+
showArrows={showArrows}
|
|
566
|
+
arrowSize={arrowSize}
|
|
567
|
+
arrowAreaHeight={arrowAreaHeight}
|
|
568
|
+
arrowPrevLabel={arrowPrevLabel}
|
|
569
|
+
arrowNextLabel={arrowNextLabel}
|
|
570
|
+
prevArrowTestId={prevArrowTestId}
|
|
571
|
+
nextArrowTestId={nextArrowTestId}
|
|
572
|
+
slidesContainerId={slidesContainerId}
|
|
573
|
+
/>
|
|
534
574
|
<CarouselViewPort
|
|
535
575
|
slideWidth={slideWidth}
|
|
536
576
|
slideTestId={slideTestId}
|
|
@@ -540,6 +580,10 @@ export const CarouselBase = ({
|
|
|
540
580
|
getRootRef={viewportRef}
|
|
541
581
|
layerRef={layerRef}
|
|
542
582
|
setSlideRef={setSlideRef}
|
|
583
|
+
slidesContainerId={slidesContainerId}
|
|
584
|
+
slideLabel={slideLabel}
|
|
585
|
+
slideRoleDescription={slideRoleDescription}
|
|
586
|
+
onChange={onChange}
|
|
543
587
|
>
|
|
544
588
|
{children}
|
|
545
589
|
</CarouselViewPort>
|
|
@@ -552,20 +596,6 @@ export const CarouselBase = ({
|
|
|
552
596
|
bulletTestId={bulletTestId}
|
|
553
597
|
/>
|
|
554
598
|
)}
|
|
555
|
-
<ScrollArrows
|
|
556
|
-
hasPointer={hasPointer}
|
|
557
|
-
canSlideLeft={canSlideLeft}
|
|
558
|
-
canSlideRight={canSlideRight}
|
|
559
|
-
onSlideRight={slideRight}
|
|
560
|
-
onSlideLeft={slideLeft}
|
|
561
|
-
showArrows={showArrows}
|
|
562
|
-
arrowSize={arrowSize}
|
|
563
|
-
arrowAreaHeight={arrowAreaHeight}
|
|
564
|
-
arrowPrevLabel={arrowPrevLabel}
|
|
565
|
-
arrowNextLabel={arrowNextLabel}
|
|
566
|
-
prevArrowTestId={prevArrowTestId}
|
|
567
|
-
nextArrowTestId={nextArrowTestId}
|
|
568
|
-
/>
|
|
569
599
|
</RootComponent>
|
|
570
600
|
);
|
|
571
601
|
};
|
|
@@ -7,7 +7,10 @@ import { type CustomTouchEvent, Touch } from '../Touch/Touch';
|
|
|
7
7
|
import { type BaseGalleryProps } from './types';
|
|
8
8
|
import styles from './CarouselBase.module.css';
|
|
9
9
|
|
|
10
|
-
type GalleryViewPortProps = Pick<
|
|
10
|
+
type GalleryViewPortProps = Pick<
|
|
11
|
+
BaseGalleryProps,
|
|
12
|
+
'slideWidth' | 'slideTestId' | 'slideRoleDescription' | 'slideLabel' | 'onChange'
|
|
13
|
+
> &
|
|
11
14
|
HasRootRef<HTMLElement> &
|
|
12
15
|
HasChildren & {
|
|
13
16
|
onStart: (e: CustomTouchEvent) => void;
|
|
@@ -15,11 +18,17 @@ type GalleryViewPortProps = Pick<BaseGalleryProps, 'slideWidth' | 'slideTestId'>
|
|
|
15
18
|
onEnd: (e: CustomTouchEvent) => void;
|
|
16
19
|
setSlideRef: (slideRef: HTMLDivElement | null, slideIndex: number) => void;
|
|
17
20
|
layerRef?: React.Ref<HTMLDivElement>;
|
|
21
|
+
slidesContainerId: string;
|
|
18
22
|
};
|
|
19
23
|
|
|
24
|
+
const defaultSlideLabel = (index: number, slidesCount: number) => `${index + 1} из ${slidesCount}`;
|
|
25
|
+
|
|
20
26
|
export const CarouselViewPort = ({
|
|
21
27
|
slideTestId,
|
|
22
28
|
slideWidth,
|
|
29
|
+
slideLabel = defaultSlideLabel,
|
|
30
|
+
slideRoleDescription = 'Слайд',
|
|
31
|
+
onChange,
|
|
23
32
|
onStart,
|
|
24
33
|
onMoveX,
|
|
25
34
|
onEnd,
|
|
@@ -27,7 +36,15 @@ export const CarouselViewPort = ({
|
|
|
27
36
|
layerRef,
|
|
28
37
|
children,
|
|
29
38
|
setSlideRef,
|
|
39
|
+
slidesContainerId,
|
|
30
40
|
}: GalleryViewPortProps) => {
|
|
41
|
+
const slidesCount = React.Children.count(children);
|
|
42
|
+
|
|
43
|
+
const onSlideFocus = React.useCallback(
|
|
44
|
+
(e: React.FocusEvent<HTMLDivElement>) => onChange?.(Number(e.currentTarget.dataset.index)),
|
|
45
|
+
[onChange],
|
|
46
|
+
);
|
|
47
|
+
|
|
31
48
|
return (
|
|
32
49
|
<Touch
|
|
33
50
|
className={styles.viewport}
|
|
@@ -38,13 +55,19 @@ export const CarouselViewPort = ({
|
|
|
38
55
|
noSlideClick
|
|
39
56
|
getRootRef={getRootRef}
|
|
40
57
|
>
|
|
41
|
-
<div className={styles.layer} ref={layerRef}>
|
|
58
|
+
<div className={styles.layer} ref={layerRef} id={slidesContainerId}>
|
|
42
59
|
{React.Children.map(children, (item: React.ReactNode, i: number) => (
|
|
43
60
|
<div
|
|
61
|
+
role="group"
|
|
62
|
+
aria-roledescription={slideRoleDescription}
|
|
63
|
+
aria-label={typeof slideLabel === 'function' ? slideLabel(i, slidesCount) : slideLabel}
|
|
44
64
|
className={styles.slide}
|
|
45
65
|
key={`slide-${i}`}
|
|
46
66
|
data-testid={slideTestId?.(i)}
|
|
47
67
|
ref={(el) => setSlideRef(el, i)}
|
|
68
|
+
data-index={i}
|
|
69
|
+
tabIndex={0}
|
|
70
|
+
onFocus={onSlideFocus}
|
|
48
71
|
>
|
|
49
72
|
{item}
|
|
50
73
|
</div>
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import { classNames } from '@vkontakte/vkjs';
|
|
6
|
+
import { useFocusVisible } from '../../hooks/useFocusVisible';
|
|
6
7
|
import { ScrollArrow } from '../ScrollArrow/ScrollArrow';
|
|
7
8
|
import { type BaseGalleryProps } from './types';
|
|
8
9
|
import styles from './CarouselBase.module.css';
|
|
@@ -15,11 +16,13 @@ const stylesArrowAreaHeight = {
|
|
|
15
16
|
export const getArrowClassName = (
|
|
16
17
|
side: 'start' | 'end',
|
|
17
18
|
arrowAreaHeight: Exclude<BaseGalleryProps['arrowAreaHeight'], undefined>,
|
|
19
|
+
focusVisible: boolean,
|
|
18
20
|
) => {
|
|
19
21
|
return classNames(
|
|
20
22
|
styles.arrow,
|
|
21
23
|
side === 'start' ? styles.arrowStart : styles.arrowEnd,
|
|
22
24
|
stylesArrowAreaHeight[arrowAreaHeight],
|
|
25
|
+
focusVisible && styles.arrowFocusVisible,
|
|
23
26
|
);
|
|
24
27
|
};
|
|
25
28
|
|
|
@@ -45,6 +48,7 @@ interface ScrollArrowsProps
|
|
|
45
48
|
canSlideRight: boolean;
|
|
46
49
|
onSlideLeft: (e: React.MouseEvent) => void;
|
|
47
50
|
onSlideRight: (e: React.MouseEvent) => void;
|
|
51
|
+
slidesContainerId: string;
|
|
48
52
|
}
|
|
49
53
|
|
|
50
54
|
export const ScrollArrows = ({
|
|
@@ -60,27 +64,35 @@ export const ScrollArrows = ({
|
|
|
60
64
|
arrowNextLabel,
|
|
61
65
|
nextArrowTestId,
|
|
62
66
|
prevArrowTestId,
|
|
67
|
+
slidesContainerId,
|
|
63
68
|
}: ScrollArrowsProps) => {
|
|
69
|
+
const { focusVisible: prevArrowFocusVisible, ...prevArrowFocusHandlers } = useFocusVisible();
|
|
70
|
+
const { focusVisible: nextArrowFocusVisible, ...nextArrowFocusHandlers } = useFocusVisible();
|
|
71
|
+
|
|
64
72
|
return showArrows && hasPointer ? (
|
|
65
73
|
<>
|
|
66
74
|
{canSlideLeft && (
|
|
67
75
|
<ScrollArrow
|
|
68
|
-
className={getArrowClassName('start', arrowAreaHeight)}
|
|
76
|
+
className={getArrowClassName('start', arrowAreaHeight, prevArrowFocusVisible)}
|
|
69
77
|
direction="left"
|
|
70
78
|
onClick={onSlideLeft}
|
|
71
79
|
size={arrowSize}
|
|
72
80
|
data-testid={prevArrowTestId}
|
|
73
81
|
label={arrowPrevLabel}
|
|
82
|
+
aria-controls={slidesContainerId}
|
|
83
|
+
{...prevArrowFocusHandlers}
|
|
74
84
|
/>
|
|
75
85
|
)}
|
|
76
86
|
{canSlideRight && (
|
|
77
87
|
<ScrollArrow
|
|
78
|
-
className={getArrowClassName('end', arrowAreaHeight)}
|
|
88
|
+
className={getArrowClassName('end', arrowAreaHeight, nextArrowFocusVisible)}
|
|
79
89
|
direction="right"
|
|
80
90
|
onClick={onSlideRight}
|
|
81
91
|
size={arrowSize}
|
|
82
92
|
data-testid={nextArrowTestId}
|
|
83
93
|
label={arrowNextLabel}
|
|
94
|
+
aria-controls={slidesContainerId}
|
|
95
|
+
{...nextArrowFocusHandlers}
|
|
84
96
|
/>
|
|
85
97
|
)}
|
|
86
98
|
</>
|
|
@@ -9,6 +9,7 @@ export function useSlideAnimation(): {
|
|
|
9
9
|
getAnimateFunction: (drawFunction: DrawInterface) => () => void;
|
|
10
10
|
addToAnimationQueue: (func: VoidFunction) => void;
|
|
11
11
|
startAnimation: () => void;
|
|
12
|
+
animationInQueue: () => boolean;
|
|
12
13
|
} {
|
|
13
14
|
const animationQueue = React.useRef<VoidFunction[]>([]);
|
|
14
15
|
|
|
@@ -33,7 +34,12 @@ export function useSlideAnimation(): {
|
|
|
33
34
|
}
|
|
34
35
|
}
|
|
35
36
|
|
|
37
|
+
function animationInQueue() {
|
|
38
|
+
return !!animationQueue.current.length;
|
|
39
|
+
}
|
|
40
|
+
|
|
36
41
|
return {
|
|
42
|
+
animationInQueue,
|
|
37
43
|
getAnimateFunction,
|
|
38
44
|
addToAnimationQueue,
|
|
39
45
|
startAnimation,
|
|
@@ -125,6 +125,15 @@ export interface BaseGalleryProps
|
|
|
125
125
|
* Текст для кнопки-стрелки вправо (вперед). Делает ее доступной для ассистивных технологий.
|
|
126
126
|
*/
|
|
127
127
|
arrowNextLabel?: string;
|
|
128
|
+
/**
|
|
129
|
+
* Текст для слайда. Делает его доступным для ассистивных технологий. Может быть функцией.
|
|
130
|
+
* По умолчанию устанавливает `aria-label` вида `${Номер слайда} из ${Количества слайдов}`.
|
|
131
|
+
*/
|
|
132
|
+
slideLabel?: string | ((index: number, slidesCount: number) => string);
|
|
133
|
+
/**
|
|
134
|
+
* Описание роли для слайда, для лучше понимания пользователей скринридеров. По умолчанию - `Слайд`.
|
|
135
|
+
*/
|
|
136
|
+
slideRoleDescription?: string;
|
|
128
137
|
/**
|
|
129
138
|
* Передает атрибут `data-testid` для слайда.
|
|
130
139
|
*/
|
|
@@ -51,6 +51,10 @@ export interface CellProps
|
|
|
51
51
|
* Текст для кнопки перетаскивания ячейки.
|
|
52
52
|
*/
|
|
53
53
|
draggerLabel?: string;
|
|
54
|
+
/**
|
|
55
|
+
* Передает атрибут `data-testid` для кнопки перетаскивания ячейки.
|
|
56
|
+
*/
|
|
57
|
+
draggerTestId?: string;
|
|
54
58
|
}
|
|
55
59
|
|
|
56
60
|
/**
|
|
@@ -79,6 +83,7 @@ export const Cell: React.FC<CellProps> & {
|
|
|
79
83
|
style,
|
|
80
84
|
toggleButtonTestId,
|
|
81
85
|
removeButtonTestId,
|
|
86
|
+
draggerTestId,
|
|
82
87
|
href: hrefProp,
|
|
83
88
|
...restProps
|
|
84
89
|
}: CellProps) => {
|
|
@@ -98,6 +103,7 @@ export const Cell: React.FC<CellProps> & {
|
|
|
98
103
|
className={classNames(styles.dragger, !before && !selectable && styles.controlNoBefore)}
|
|
99
104
|
onDragStateChange={setDragging}
|
|
100
105
|
onDragFinish={onDragFinish}
|
|
106
|
+
data-testid={draggerTestId}
|
|
101
107
|
>
|
|
102
108
|
{draggerLabel}
|
|
103
109
|
</CellDragger>
|
|
@@ -94,8 +94,10 @@ const FetchingStatus = ({
|
|
|
94
94
|
if (fetching) {
|
|
95
95
|
setStatus('fetching');
|
|
96
96
|
} else {
|
|
97
|
-
|
|
98
|
-
|
|
97
|
+
if (status === 'fetching') {
|
|
98
|
+
setStatus('loaded');
|
|
99
|
+
setTimeout(() => setStatus('none'), FETCH_STATUS_RESET_DELAY);
|
|
100
|
+
}
|
|
99
101
|
}
|
|
100
102
|
},
|
|
101
103
|
[fetching],
|
|
@@ -3,12 +3,18 @@
|
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { Icon16Clear, Icon20CalendarOutline } from '@vkontakte/icons';
|
|
5
5
|
import { classNames } from '@vkontakte/vkjs';
|
|
6
|
-
import { startOfDay, startOfMinute } from 'date-fns';
|
|
7
6
|
import { useAdaptivity } from '../../hooks/useAdaptivity';
|
|
8
7
|
import { useDateInput } from '../../hooks/useDateInput';
|
|
9
8
|
import { useExternRef } from '../../hooks/useExternRef';
|
|
10
9
|
import { type UseFocusTrapProps } from '../../hooks/useFocusTrap';
|
|
11
|
-
import {
|
|
10
|
+
import {
|
|
11
|
+
dateFormatter,
|
|
12
|
+
dateTimeFormatter,
|
|
13
|
+
isMatch,
|
|
14
|
+
parse,
|
|
15
|
+
startOfDay,
|
|
16
|
+
startOfMinute,
|
|
17
|
+
} from '../../lib/date';
|
|
12
18
|
import type { PlacementWithAuto } from '../../lib/floating';
|
|
13
19
|
import { useIsomorphicLayoutEffect } from '../../lib/useIsomorphicLayoutEffect';
|
|
14
20
|
import type { HasRootRef } from '../../types';
|
|
@@ -2,8 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { clamp } from '../../helpers/math';
|
|
5
|
+
import { useExternRef } from '../../hooks/useExternRef';
|
|
6
|
+
import { useFocusWithin } from '../../hooks/useFocusWithin';
|
|
5
7
|
import { useIsClient } from '../../hooks/useIsClient';
|
|
6
8
|
import { callMultiple } from '../../lib/callMultiple';
|
|
9
|
+
import { useIsomorphicLayoutEffect } from '../../lib/useIsomorphicLayoutEffect';
|
|
7
10
|
import { CarouselBase } from '../CarouselBase/CarouselBase';
|
|
8
11
|
import type { BaseGalleryProps } from '../CarouselBase/types';
|
|
9
12
|
import { useAutoPlay } from './hooks';
|
|
@@ -15,6 +18,10 @@ export interface GalleryProps extends BaseGalleryProps {
|
|
|
15
18
|
initialSlideIndex?: number;
|
|
16
19
|
/**
|
|
17
20
|
* При передаче происходит автоматический переход к следующему слайду через переданное время в ms.
|
|
21
|
+
* Автоматический переход будет ставиться на паузу при:
|
|
22
|
+
* - начале свайпа для переключения слайда;
|
|
23
|
+
* - фокусе на любой элемент внутри компонента;
|
|
24
|
+
* - при наведении мыши на компонент.
|
|
18
25
|
*/
|
|
19
26
|
timeout?: number;
|
|
20
27
|
}
|
|
@@ -30,8 +37,12 @@ export const Gallery = ({
|
|
|
30
37
|
bullets,
|
|
31
38
|
onDragStart,
|
|
32
39
|
onDragEnd,
|
|
40
|
+
getRootRef,
|
|
41
|
+
onMouseOver,
|
|
42
|
+
onMouseOut,
|
|
33
43
|
...props
|
|
34
44
|
}: GalleryProps): React.ReactNode => {
|
|
45
|
+
const rootRef = useExternRef(getRootRef);
|
|
35
46
|
const [localSlideIndex, setSlideIndex] = React.useState(initialSlideIndex);
|
|
36
47
|
const isControlled = typeof props.slideIndex === 'number';
|
|
37
48
|
const slideIndex = isControlled ? (props.slideIndex ?? 0) : localSlideIndex;
|
|
@@ -41,6 +52,7 @@ export const Gallery = ({
|
|
|
41
52
|
);
|
|
42
53
|
const childCount = slides.length;
|
|
43
54
|
const isClient = useIsClient();
|
|
55
|
+
const focusWithin = useFocusWithin(rootRef);
|
|
44
56
|
|
|
45
57
|
const handleChange: GalleryProps['onChange'] = React.useCallback(
|
|
46
58
|
(current: number) => {
|
|
@@ -70,6 +82,11 @@ export const Gallery = ({
|
|
|
70
82
|
setSlideIndex(safeSlideIndex);
|
|
71
83
|
}, [onChange, safeSlideIndex, slideIndex]);
|
|
72
84
|
|
|
85
|
+
useIsomorphicLayoutEffect(
|
|
86
|
+
() => (focusWithin ? autoPlayControls.pause() : autoPlayControls.resume()),
|
|
87
|
+
[focusWithin, autoPlayControls.pause, autoPlayControls.resume],
|
|
88
|
+
);
|
|
89
|
+
|
|
73
90
|
if (!isClient) {
|
|
74
91
|
return null;
|
|
75
92
|
}
|
|
@@ -77,9 +94,12 @@ export const Gallery = ({
|
|
|
77
94
|
return (
|
|
78
95
|
<CarouselBase
|
|
79
96
|
dragDisabled={isControlled && !onChange}
|
|
97
|
+
getRootRef={rootRef}
|
|
80
98
|
{...props}
|
|
81
99
|
onDragStart={callMultiple(onDragStart, autoPlayControls.pause)}
|
|
82
100
|
onDragEnd={callMultiple(onDragEnd, autoPlayControls.resume)}
|
|
101
|
+
onMouseEnter={callMultiple(onMouseOver, autoPlayControls.pause)}
|
|
102
|
+
onMouseLeave={callMultiple(onMouseOut, autoPlayControls.resume)}
|
|
83
103
|
bullets={childCount > 0 && bullets}
|
|
84
104
|
slideIndex={safeSlideIndex}
|
|
85
105
|
onChange={handleChange}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["./ModalCard.module.css"],"names":["host","hostMaxWidthS","hostMaxWidthM","hostMaxWidthL","hostMobile","hostStateEnter","hostStateEntering","hostStateExiting","hostStateExited","hostDesktop"],"mappings":"AAAA;AAAA,E,aAAAA,M,WAAA;AAAA,E,aAIAA,M,WAJA;AAAA,E,aAQAC,e,WARA;AAAA,E,aAYAC,e,WAZA;AAAA,E,aAgBAC,e,WAhBA;AAAA,E,aAqBAC,Y,WArBA;AAAA,E,aAwCAA,Y,WAxCA;AAAA,E,aAwCWC,gB,WAxCX;AAAA,E,aA6CAD,Y,WA7CA;AAAA,E,aA6CWE,mB,WA7CX;AAAA,E,aAiDAF,Y,WAjDA;AAAA,E,aAiDWG,kB,WAjDX;AAAA,E,aAsDAH,Y,WAtDA;AAAA,E,aAsDWI,iB,WAtDX;AAAA,E,aA4DAC,a,WA5DA;AAAA,E,
|
|
1
|
+
{"version":3,"sources":["./ModalCard.module.css"],"names":["host","hostMaxWidthS","hostMaxWidthM","hostMaxWidthL","hostMobile","hostStateEnter","hostStateEntering","hostStateExiting","hostStateExited","hostDesktop"],"mappings":"AAAA;AAAA,E,aAAAA,M,WAAA;AAAA,E,aAIAA,M,WAJA;AAAA,E,aAQAC,e,WARA;AAAA,E,aAYAC,e,WAZA;AAAA,E,aAgBAC,e,WAhBA;AAAA,E,aAqBAC,Y,WArBA;AAAA,E,aAwCAA,Y,WAxCA;AAAA,E,aAwCWC,gB,WAxCX;AAAA,E,aA6CAD,Y,WA7CA;AAAA,E,aA6CWE,mB,WA7CX;AAAA,E,aAiDAF,Y,WAjDA;AAAA,E,aAiDWG,kB,WAjDX;AAAA,E,aAsDAH,Y,WAtDA;AAAA,E,aAsDWI,iB,WAtDX;AAAA,E,aA4DAC,a,WA5DA;AAAA,E,aAoEAA,a,WApEA;AAAA,E,aAoEYJ,gB,WApEZ;AAAA,E,aAyEAI,a,WAzEA;AAAA,E,aAyEYH,mB,WAzEZ;AAAA,E,aA6EAG,a,WA7EA;AAAA,E,aA6EYF,kB,WA7EZ;AAAA,E,aAiFAE,a,WAjFA;AAAA,E,aAiFYD,iB,WAjFZ;AAAA;AAAA","file":"ModalCard.module.css.d.ts","sourceRoot":""}
|
|
@@ -31,21 +31,14 @@
|
|
|
31
31
|
|
|
32
32
|
/* Desktop */
|
|
33
33
|
.hostDesktop {
|
|
34
|
-
--vkui_internal_ModalPage--desktopStretchedSize: calc(100% - var(--vkui--spacing_size_2xl) * 2);
|
|
35
34
|
--vkui_internal_ModalPage--desktopMaxWidth: 100%;
|
|
36
35
|
--vkui_internal_ModalPage--desktopMaxHeight: 640px;
|
|
37
36
|
--vkui_internal_ModalPage--userHeight: auto;
|
|
38
37
|
|
|
39
38
|
position: relative;
|
|
40
39
|
box-sizing: content-box;
|
|
41
|
-
max-inline-size:
|
|
42
|
-
|
|
43
|
-
var(--vkui_internal_ModalPage--desktopStretchedSize)
|
|
44
|
-
);
|
|
45
|
-
max-block-size: min(
|
|
46
|
-
var(--vkui_internal_ModalPage--desktopMaxHeight),
|
|
47
|
-
var(--vkui_internal_ModalPage--desktopStretchedSize)
|
|
48
|
-
);
|
|
40
|
+
max-inline-size: var(--vkui_internal_ModalPage--desktopMaxWidth);
|
|
41
|
+
max-block-size: min(var(--vkui_internal_ModalPage--desktopMaxHeight), 100%);
|
|
49
42
|
margin-block: auto;
|
|
50
43
|
}
|
|
51
44
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["./ModalPage.module.css"],"names":["host","hostMobile","hostMobileSafeAreaInsetTop","hostMobileSafeAreaInsetTopWithCustomOffset","hostDesktop","hostDesktopMaxWidthS","hostDesktopMaxWidthM","hostDesktopMaxWidthL","document","documentMobile","documentStateEnter","documentStateEntering","documentStateExiting","documentStateExited","documentDesktop","children","childrenMobile","childrenDesktop"],"mappings":"AAAA;AAAA,E,aAAAA,M,WAAA;AAAA,E,aAUAC,Y,WAVA;AAAA,E,aAqBAC,4B,WArBA;AAAA,E,aAyBAC,4C,WAzBA;AAAA,E,aAgCAC,a,WAhCA;AAAA,E,
|
|
1
|
+
{"version":3,"sources":["./ModalPage.module.css"],"names":["host","hostMobile","hostMobileSafeAreaInsetTop","hostMobileSafeAreaInsetTopWithCustomOffset","hostDesktop","hostDesktopMaxWidthS","hostDesktopMaxWidthM","hostDesktopMaxWidthL","document","documentMobile","documentStateEnter","documentStateEntering","documentStateExiting","documentStateExited","documentDesktop","children","childrenMobile","childrenDesktop"],"mappings":"AAAA;AAAA,E,aAAAA,M,WAAA;AAAA,E,aAUAC,Y,WAVA;AAAA,E,aAqBAC,4B,WArBA;AAAA,E,aAyBAC,4C,WAzBA;AAAA,E,aAgCAC,a,WAhCA;AAAA,E,aA4CAC,sB,WA5CA;AAAA,E,aAgDAC,sB,WAhDA;AAAA,E,aAoDAC,sB,WApDA;AAAA,E,aAwDAC,U,WAxDA;AAAA,E,aAqEAC,gB,WArEA;AAAA,E,aAsFAA,gB,WAtFA;AAAA,E,aAsFeC,oB,WAtFf;AAAA,E,aA0FAD,gB,WA1FA;AAAA,E,aA0FeE,uB,WA1Ff;AAAA,E,aA+FAF,gB,WA/FA;AAAA,E,aA+FeG,sB,WA/Ff;AAAA,E,aAoGAH,gB,WApGA;AAAA,E,aAoGeI,qB,WApGf;AAAA,E,aAyGAC,iB,WAzGA;AAAA,E,aA8GAA,iB,WA9GA;AAAA,E,aA8GgBJ,oB,WA9GhB;AAAA,E,aAkHAI,iB,WAlHA;AAAA,E,aAkHgBH,uB,WAlHhB;AAAA,E,aAuHAG,iB,WAvHA;AAAA,E,aAuHgBF,sB,WAvHhB;AAAA,E,aA4HAE,iB,WA5HA;AAAA,E,aA4HgBD,qB,WA5HhB;AAAA,E,aAgIAE,U,WAhIA;AAAA,E,aAoJAC,gB,WApJA;AAAA,E,aAyJAC,iB,WAzJA;AAAA;AAAA","file":"ModalPage.module.css.d.ts","sourceRoot":""}
|
|
@@ -118,9 +118,9 @@ export const ModalPageInternal = ({
|
|
|
118
118
|
const handleSheetRef = useExternRef<HTMLDivElement>(setSheetEl, ref);
|
|
119
119
|
const handleSheetScrollRef = useExternRef<HTMLDivElement>(setSheetScrollEl, getModalContentRef);
|
|
120
120
|
|
|
121
|
-
const [desktopMaxWidthClassName, desktopMaxWidthStyle] =
|
|
122
|
-
|
|
123
|
-
|
|
121
|
+
const [desktopMaxWidthClassName, desktopMaxWidthStyle] = isDesktop
|
|
122
|
+
? resolveDesktopMaxWidth(desktopMaxWidth)
|
|
123
|
+
: [undefined, undefined];
|
|
124
124
|
|
|
125
125
|
const modalOverlay = !disableModalOverlay && (
|
|
126
126
|
<ModalOverlay
|
|
@@ -213,16 +213,13 @@ const desktopMaxWidthClassNames = {
|
|
|
213
213
|
function resolveDesktopMaxWidth(
|
|
214
214
|
desktopMaxWidth: ModalPageInternalProps['size'] = 's',
|
|
215
215
|
): [string | undefined, CSSCustomProperties | undefined] {
|
|
216
|
-
if (typeof desktopMaxWidth === '
|
|
217
|
-
return [
|
|
216
|
+
if (typeof desktopMaxWidth === 'number') {
|
|
217
|
+
return [undefined, { '--vkui_internal_ModalPage--desktopMaxWidth': `${desktopMaxWidth}px` }];
|
|
218
218
|
}
|
|
219
219
|
|
|
220
|
-
return
|
|
221
|
-
undefined
|
|
222
|
-
|
|
223
|
-
? { '--vkui_internal_ModalPage--desktopMaxWidth': `${desktopMaxWidth}px` }
|
|
224
|
-
: undefined,
|
|
225
|
-
];
|
|
220
|
+
return desktopMaxWidthClassNames.hasOwnProperty(desktopMaxWidth)
|
|
221
|
+
? [desktopMaxWidthClassNames[desktopMaxWidth], undefined]
|
|
222
|
+
: [undefined, { '--vkui_internal_ModalPage--desktopMaxWidth': desktopMaxWidth }];
|
|
226
223
|
}
|
|
227
224
|
|
|
228
225
|
function getHeightCSSVariable(height?: number | string): CSSCustomProperties | undefined {
|