@jetbrains/ring-ui-built 7.0.112 → 7.0.114
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/components/date-picker/animate-date.js +1 -0
- package/components/date-picker/consts.d.ts +3 -2
- package/components/date-picker/consts.js +31 -6
- package/components/date-picker/date-popup.d.ts +1 -3
- package/components/date-picker/date-popup.js +38 -32
- package/components/date-picker/day.js +1 -0
- package/components/date-picker/scroll-arith.js +1 -0
- package/components/date-picker/use-scroll-behavior.js +1 -0
- package/components/date-picker/weekdays.js +1 -0
- package/components/date-picker/years.js +1 -0
- package/components/old-browsers-message/white-list.js +2 -2
- package/components/popup/position-css.js +4 -5
- package/components/style.css +1 -1
- package/package.json +2 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ReactNode } from 'react';
|
|
2
|
-
import type
|
|
2
|
+
import { type Locale } from 'date-fns';
|
|
3
3
|
declare const units: {
|
|
4
4
|
unit: number;
|
|
5
5
|
cellSize: number;
|
|
@@ -24,10 +24,11 @@ export declare const yearDuration: number;
|
|
|
24
24
|
export declare const yearScrollSpeed: number;
|
|
25
25
|
export declare const DOUBLE = 2;
|
|
26
26
|
export declare const HALF = 0.5;
|
|
27
|
-
export declare function parseTime(time: string): string | null;
|
|
27
|
+
export declare function parseTime(time: string | null | undefined): string | null;
|
|
28
28
|
export declare function shiftWeekArray<T>(arr: T[], startOfWeek: number): T[];
|
|
29
29
|
export declare function getWeekStartsOn(locale: Locale | undefined): number;
|
|
30
30
|
export declare function getDayNumInWeek(locale: Locale | undefined, day: number): number;
|
|
31
|
+
export declare function getDefaultScrollDate({ minDate, maxDate, parseDateInput, }: Pick<DatePopupBaseProps, 'minDate' | 'maxDate' | 'parseDateInput'>): Date;
|
|
31
32
|
export interface DateInputTranslations {
|
|
32
33
|
addFirstDate?: string;
|
|
33
34
|
addSecondDate?: string;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { add } from 'date-fns/add';
|
|
2
|
+
import { endOfDay } from 'date-fns';
|
|
2
3
|
import sniffr from '../global/sniffer.js';
|
|
3
4
|
import 'sniffr';
|
|
4
5
|
|
|
@@ -32,13 +33,14 @@ const yearScrollSpeed = yearDuration / (YEAR * units.cellSize);
|
|
|
32
33
|
const DOUBLE = 2;
|
|
33
34
|
const HALF = 0.5;
|
|
34
35
|
function parseTime(time) {
|
|
35
|
-
|
|
36
|
+
if (!time) return null;
|
|
36
37
|
if (/^([01][0-9]|2[0-3]):[0-5][0-9]$/.test(time)) {
|
|
37
|
-
|
|
38
|
-
} else if (/^([0-9]|2[0-3]):[0-5][0-9]$/.test(time)) {
|
|
39
|
-
result = `0${time}`;
|
|
38
|
+
return time;
|
|
40
39
|
}
|
|
41
|
-
|
|
40
|
+
if (/^([0-9]|2[0-3]):[0-5][0-9]$/.test(time)) {
|
|
41
|
+
return `0${time}`;
|
|
42
|
+
}
|
|
43
|
+
return null;
|
|
42
44
|
}
|
|
43
45
|
function shiftWeekArray(arr, startOfWeek) {
|
|
44
46
|
const shiftTimes = startOfWeek - 1;
|
|
@@ -52,6 +54,29 @@ function getDayNumInWeek(locale, day) {
|
|
|
52
54
|
const weekDays = shiftWeekArray(Object.values(weekdays), getWeekStartsOn(locale));
|
|
53
55
|
return weekDays.indexOf(day);
|
|
54
56
|
}
|
|
57
|
+
function getDefaultScrollDate({
|
|
58
|
+
minDate,
|
|
59
|
+
maxDate,
|
|
60
|
+
parseDateInput
|
|
61
|
+
}) {
|
|
62
|
+
const minDateParsed = parseDateInput(minDate);
|
|
63
|
+
const maxDateParsed = parseDateInput(maxDate);
|
|
64
|
+
const maxDateEndOfDayNum = maxDateParsed ? Number(endOfDay(maxDateParsed)) : null;
|
|
65
|
+
const now = Date.now();
|
|
66
|
+
if (minDateParsed != null && maxDateEndOfDayNum != null) {
|
|
67
|
+
if (minDateParsed.getTime() <= now && now <= maxDateEndOfDayNum) {
|
|
68
|
+
return new Date(now);
|
|
69
|
+
}
|
|
70
|
+
return minDateParsed;
|
|
71
|
+
}
|
|
72
|
+
if (minDateParsed != null && minDateParsed.getTime() > now) {
|
|
73
|
+
return minDateParsed;
|
|
74
|
+
}
|
|
75
|
+
if (maxDateParsed != null && maxDateEndOfDayNum != null && maxDateEndOfDayNum < now) {
|
|
76
|
+
return maxDateParsed;
|
|
77
|
+
}
|
|
78
|
+
return new Date(now);
|
|
79
|
+
}
|
|
55
80
|
/**
|
|
56
81
|
* Safari on iPhone doesn't allow setting scrollTop while a scroll is in progress.
|
|
57
82
|
* If you do, the browser will overwrite it during the next scroll event.
|
|
@@ -68,4 +93,4 @@ const calendarSyncOnYearScrollUpdateDelay = isSafariOnIPhone ? 130 : 100;
|
|
|
68
93
|
const dateAnimationDuration = 150;
|
|
69
94
|
const yearsAnimationDuration = 200;
|
|
70
95
|
|
|
71
|
-
export { DOUBLE, FIFTH_DAY, HALF, MIDDLE_DAY, WEEK, YEAR, calendarSyncOnYearScrollUpdateDelay, dateAnimationDuration, units as default, getDayNumInWeek, getWeekStartsOn, isSafariOnIPhone, parseTime, scrollerReRenderDelayIPhone, shiftWeekArray, weekdays, yearDuration, yearScrollSpeed, yearsAnimationDuration };
|
|
96
|
+
export { DOUBLE, FIFTH_DAY, HALF, MIDDLE_DAY, WEEK, YEAR, calendarSyncOnYearScrollUpdateDelay, dateAnimationDuration, units as default, getDayNumInWeek, getDefaultScrollDate, getWeekStartsOn, isSafariOnIPhone, parseTime, scrollerReRenderDelayIPhone, shiftWeekArray, weekdays, yearDuration, yearScrollSpeed, yearsAnimationDuration };
|
|
@@ -7,13 +7,11 @@ export default class DatePopup extends Component<DatePopupProps, DatePopupState>
|
|
|
7
7
|
onChange(): void;
|
|
8
8
|
};
|
|
9
9
|
constructor(props: DatePopupProps);
|
|
10
|
-
componentDidUpdate(
|
|
10
|
+
componentDidUpdate(_prevProps: DatePopupBaseProps, prevState: DatePopupState): void;
|
|
11
11
|
componentWillUnmount(): void;
|
|
12
12
|
private animationCleanup;
|
|
13
13
|
isInTimeMode: () => boolean;
|
|
14
14
|
componentRef: React.RefObject<HTMLDivElement | null>;
|
|
15
|
-
parse(text: string | null | undefined, type: 'time'): string;
|
|
16
|
-
parse(text: Date | number | string | null | undefined, type?: 'date' | 'from' | 'to'): Date;
|
|
17
15
|
select(changes: DatePickerChange): void;
|
|
18
16
|
confirm(name: Field): void;
|
|
19
17
|
isValidDate: (parsedText: Date) => boolean;
|
|
@@ -9,7 +9,7 @@ import DateInput from './date-input.js';
|
|
|
9
9
|
import Months from './months.js';
|
|
10
10
|
import Years from './years.js';
|
|
11
11
|
import Weekdays from './weekdays.js';
|
|
12
|
-
import { parseTime } from './consts.js';
|
|
12
|
+
import { getDefaultScrollDate, parseTime } from './consts.js';
|
|
13
13
|
import { animateDate } from './animate-date.js';
|
|
14
14
|
import MonthNames from './month-names.js';
|
|
15
15
|
import { s as styles } from '../_helpers/date-picker.js';
|
|
@@ -79,31 +79,33 @@ class DatePopup extends Component {
|
|
|
79
79
|
};
|
|
80
80
|
const {
|
|
81
81
|
range,
|
|
82
|
-
withTime
|
|
82
|
+
withTime,
|
|
83
|
+
parseDateInput
|
|
83
84
|
} = props;
|
|
84
85
|
if (!range) {
|
|
85
|
-
const parsedDate =
|
|
86
|
+
const parsedDate = parseDateInput(props.date);
|
|
86
87
|
const active = withTime && parsedDate && !props.time ? 'time' : 'date';
|
|
87
88
|
this.state = {
|
|
88
89
|
...defaultState,
|
|
89
90
|
active,
|
|
90
91
|
scrollDate: {
|
|
91
|
-
date: parsedDate,
|
|
92
|
+
date: parsedDate !== null && parsedDate !== void 0 ? parsedDate : getDefaultScrollDate(props),
|
|
92
93
|
source: 'other'
|
|
93
94
|
}
|
|
94
95
|
};
|
|
95
96
|
} else {
|
|
97
|
+
var _parseDateInput;
|
|
96
98
|
this.state = {
|
|
97
99
|
...defaultState,
|
|
98
100
|
active: props.from && !props.to ? 'to' : 'from',
|
|
99
101
|
scrollDate: {
|
|
100
|
-
date:
|
|
102
|
+
date: (_parseDateInput = parseDateInput(props.from)) !== null && _parseDateInput !== void 0 ? _parseDateInput : getDefaultScrollDate(props),
|
|
101
103
|
source: 'other'
|
|
102
104
|
}
|
|
103
105
|
};
|
|
104
106
|
}
|
|
105
107
|
}
|
|
106
|
-
componentDidUpdate(
|
|
108
|
+
componentDidUpdate(_prevProps, prevState) {
|
|
107
109
|
if (this.state.active !== prevState.active) {
|
|
108
110
|
if (this.state.text && prevState.active) {
|
|
109
111
|
this.confirm(prevState.active);
|
|
@@ -119,16 +121,11 @@ class DatePopup extends Component {
|
|
|
119
121
|
animationCleanup = null;
|
|
120
122
|
isInTimeMode = () => !this.props.range && this.props.withTime || false;
|
|
121
123
|
componentRef = /*#__PURE__*/React.createRef();
|
|
122
|
-
parse(text, type) {
|
|
123
|
-
if (type === 'time') {
|
|
124
|
-
return parseTime(String(text));
|
|
125
|
-
}
|
|
126
|
-
return this.props.parseDateInput(text);
|
|
127
|
-
}
|
|
128
124
|
select(changes) {
|
|
129
125
|
const {
|
|
130
126
|
range,
|
|
131
|
-
withTime
|
|
127
|
+
withTime,
|
|
128
|
+
parseDateInput
|
|
132
129
|
} = this.props;
|
|
133
130
|
const prevActive = this.state.active;
|
|
134
131
|
if (!range && !withTime) {
|
|
@@ -144,8 +141,8 @@ class DatePopup extends Component {
|
|
|
144
141
|
this.props.onChange(adjustedDate);
|
|
145
142
|
this.props.onComplete();
|
|
146
143
|
} else if (!range && withTime) {
|
|
147
|
-
const date =
|
|
148
|
-
const time =
|
|
144
|
+
const date = parseDateInput(this.props.date);
|
|
145
|
+
const time = parseTime(this.props.time);
|
|
149
146
|
const changeToSubmit = {
|
|
150
147
|
date: changes.date || date,
|
|
151
148
|
time: changes.time || time
|
|
@@ -167,8 +164,8 @@ class DatePopup extends Component {
|
|
|
167
164
|
...this.props,
|
|
168
165
|
...changes
|
|
169
166
|
};
|
|
170
|
-
from =
|
|
171
|
-
to =
|
|
167
|
+
from = parseDateInput(from);
|
|
168
|
+
to = parseDateInput(to);
|
|
172
169
|
// proceed to setting the end by default
|
|
173
170
|
let active = 'to';
|
|
174
171
|
let complete = false;
|
|
@@ -204,14 +201,17 @@ class DatePopup extends Component {
|
|
|
204
201
|
const text = this.state.text;
|
|
205
202
|
let result;
|
|
206
203
|
if (name === 'time') {
|
|
207
|
-
result =
|
|
208
|
-
const time =
|
|
204
|
+
result = parseTime(text);
|
|
205
|
+
const time = parseTime('time' in this.props ? this.props.time : '');
|
|
209
206
|
const emptyCase = this.state.active === 'time' ? '00:00' : null;
|
|
210
207
|
result = result || time || emptyCase;
|
|
211
208
|
} else {
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
209
|
+
const {
|
|
210
|
+
parseDateInput
|
|
211
|
+
} = this.props;
|
|
212
|
+
result = parseDateInput(text);
|
|
213
|
+
if (!result || !this.isValidDate(result)) {
|
|
214
|
+
result = parseDateInput(name in this.props ? this.props[name] : '');
|
|
215
215
|
}
|
|
216
216
|
}
|
|
217
217
|
this.select({
|
|
@@ -219,10 +219,15 @@ class DatePopup extends Component {
|
|
|
219
219
|
});
|
|
220
220
|
}
|
|
221
221
|
isValidDate = parsedText => {
|
|
222
|
-
const
|
|
223
|
-
|
|
222
|
+
const {
|
|
223
|
+
parseDateInput,
|
|
224
|
+
minDate,
|
|
225
|
+
maxDate
|
|
226
|
+
} = this.props;
|
|
227
|
+
const parsedMinDate = parseDateInput(minDate);
|
|
228
|
+
const parsedMaxDate = parseDateInput(maxDate);
|
|
224
229
|
if (parsedText) {
|
|
225
|
-
return !(
|
|
230
|
+
return !(parsedMinDate && isBefore(parsedText, parsedMinDate) || parsedMaxDate && isAfter(parsedText, parsedMaxDate));
|
|
226
231
|
}
|
|
227
232
|
return false;
|
|
228
233
|
};
|
|
@@ -234,8 +239,8 @@ class DatePopup extends Component {
|
|
|
234
239
|
}));
|
|
235
240
|
handleInput = (text, name) => {
|
|
236
241
|
if (name !== 'time') {
|
|
237
|
-
const parsed = this.
|
|
238
|
-
if (this.isValidDate(parsed)) {
|
|
242
|
+
const parsed = this.props.parseDateInput(text);
|
|
243
|
+
if (parsed && this.isValidDate(parsed)) {
|
|
239
244
|
this.animationCleanup?.();
|
|
240
245
|
const currentScrollDate = this.state.scrollDate?.date;
|
|
241
246
|
if (currentScrollDate != null) {
|
|
@@ -299,7 +304,8 @@ class DatePopup extends Component {
|
|
|
299
304
|
render() {
|
|
300
305
|
const {
|
|
301
306
|
range,
|
|
302
|
-
locale
|
|
307
|
+
locale,
|
|
308
|
+
parseDateInput
|
|
303
309
|
} = this.props;
|
|
304
310
|
const {
|
|
305
311
|
from,
|
|
@@ -308,17 +314,17 @@ class DatePopup extends Component {
|
|
|
308
314
|
time,
|
|
309
315
|
...restProps
|
|
310
316
|
} = this.props;
|
|
311
|
-
const parsedDate =
|
|
312
|
-
const parsedTo =
|
|
317
|
+
const parsedDate = parseDateInput(date);
|
|
318
|
+
const parsedTo = parseDateInput(to);
|
|
313
319
|
const names = range ? ['from', 'to'] : ['date'];
|
|
314
320
|
const dates = names.reduce((obj, key) => {
|
|
315
321
|
const value = this.props[key];
|
|
316
322
|
return {
|
|
317
323
|
...obj,
|
|
318
|
-
[key]:
|
|
324
|
+
[key]: parseDateInput(value)
|
|
319
325
|
};
|
|
320
326
|
}, {});
|
|
321
|
-
const activeDate = this.state.active !== 'time' ? this.state.hoverDate || (this.state.text ?
|
|
327
|
+
const activeDate = this.state.active !== 'time' ? this.state.hoverDate || (this.state.text ? parseDateInput(this.state.text) : null) : this.state.hoverDate || null;
|
|
322
328
|
const currentRange = range && dates.from && dates.to && [dates.from, dates.to] || null;
|
|
323
329
|
let activeRange = null;
|
|
324
330
|
if (range && activeDate) {
|
|
@@ -14,6 +14,7 @@ import { getDayNumInWeek, weekdays } from './consts.js';
|
|
|
14
14
|
import { s as styles } from '../_helpers/date-picker.js';
|
|
15
15
|
import { jsx } from 'react/jsx-runtime';
|
|
16
16
|
import 'date-fns/add';
|
|
17
|
+
import 'date-fns';
|
|
17
18
|
import '../global/sniffer.js';
|
|
18
19
|
import 'sniffr';
|
|
19
20
|
|
|
@@ -3,6 +3,7 @@ import { useState, useRef, useEffect, useLayoutEffect } from 'react';
|
|
|
3
3
|
import units, { isSafariOnIPhone, scrollerReRenderDelayIPhone } from './consts.js';
|
|
4
4
|
import useEventCallback from '../global/use-event-callback.js';
|
|
5
5
|
import 'date-fns/add';
|
|
6
|
+
import 'date-fns';
|
|
6
7
|
import '../global/sniffer.js';
|
|
7
8
|
import 'sniffr';
|
|
8
9
|
|
|
@@ -9,6 +9,7 @@ import { shiftWeekArray, getWeekStartsOn, weekdays } from './consts.js';
|
|
|
9
9
|
import { s as styles } from '../_helpers/date-picker.js';
|
|
10
10
|
import { jsx } from 'react/jsx-runtime';
|
|
11
11
|
import 'date-fns/add';
|
|
12
|
+
import 'date-fns';
|
|
12
13
|
import '../global/sniffer.js';
|
|
13
14
|
import 'sniffr';
|
|
14
15
|
|
|
@@ -17,6 +17,7 @@ import { useIntersectionObserver, useVisibility } from './use-intersection-obser
|
|
|
17
17
|
import { s as styles } from '../_helpers/date-picker.js';
|
|
18
18
|
import { jsx } from 'react/jsx-runtime';
|
|
19
19
|
import 'date-fns/add';
|
|
20
|
+
import 'date-fns';
|
|
20
21
|
import '../global/sniffer.js';
|
|
21
22
|
import 'sniffr';
|
|
22
23
|
import '../global/use-event-callback.js';
|
|
@@ -6,11 +6,11 @@ const MAJOR_VERSION_INDEX = 0;
|
|
|
6
6
|
/**
|
|
7
7
|
* SUPPORTED_BROWSERS are defined by Babel plugin, see babel config
|
|
8
8
|
*/
|
|
9
|
-
if (!["and_chr
|
|
9
|
+
if (!["and_chr 148", "and_ff 150", "and_qq 14.9", "and_uc 15.5", "android 148", "chrome 148", "chrome 147", "chrome 146", "chrome 145", "chrome 144", "chrome 143", "chrome 142", "chrome 141", "chrome 140", "chrome 139", "chrome 138", "chrome 137", "chrome 136", "chrome 135", "chrome 134", "chrome 133", "chrome 132", "chrome 131", "chrome 130", "chrome 129", "chrome 128", "chrome 127", "chrome 126", "chrome 125", "chrome 124", "chrome 123", "chrome 122", "chrome 121", "chrome 120", "chrome 112", "chrome 109", "edge 148", "edge 147", "edge 146", "edge 145", "edge 144", "edge 143", "edge 142", "edge 141", "edge 140", "edge 139", "edge 138", "edge 137", "edge 136", "edge 135", "edge 134", "edge 133", "edge 132", "edge 131", "edge 130", "edge 129", "edge 128", "edge 127", "edge 126", "edge 125", "edge 124", "edge 123", "edge 122", "edge 121", "edge 120", "firefox 150", "firefox 149", "firefox 148", "firefox 147", "firefox 146", "firefox 145", "firefox 144", "firefox 143", "firefox 142", "firefox 141", "firefox 140", "firefox 139", "firefox 138", "firefox 137", "firefox 136", "firefox 135", "firefox 134", "firefox 133", "firefox 132", "firefox 131", "firefox 130", "firefox 129", "firefox 128", "firefox 127", "firefox 126", "firefox 125", "firefox 124", "firefox 123", "firefox 122", "firefox 121", "firefox 120", "ios_saf 26.4", "ios_saf 26.3", "ios_saf 26.2", "ios_saf 26.1", "ios_saf 26.0", "ios_saf 18.5-18.7", "ios_saf 18.4", "ios_saf 18.3", "ios_saf 18.2", "ios_saf 18.1", "ios_saf 18.0", "ios_saf 17.6-17.7", "ios_saf 17.5", "ios_saf 17.4", "ios_saf 17.3", "ios_saf 17.2", "ios_saf 17.1", "ios_saf 17.0", "kaios 3.0-3.1", "kaios 2.5", "op_mini all", "op_mob 80", "opera 131", "opera 127", "safari 26.4", "safari 26.3", "safari 26.2", "safari 26.1", "safari 26.0", "safari 18.5-18.7", "safari 18.4", "safari 18.3", "safari 18.2", "safari 18.1", "safari 18.0", "safari 17.6", "safari 17.5", "safari 17.4", "safari 17.3", "safari 17.2", "safari 17.1", "safari 17.0", "samsung 29", "samsung 28"]) {
|
|
10
10
|
// eslint-disable-next-line no-console
|
|
11
11
|
console.warn('Ring UI: no SUPPORTED_BROWSERS passed. Please check babel config.');
|
|
12
12
|
}
|
|
13
|
-
const SUPPORTED = ["and_chr
|
|
13
|
+
const SUPPORTED = ["and_chr 148", "and_ff 150", "and_qq 14.9", "and_uc 15.5", "android 148", "chrome 148", "chrome 147", "chrome 146", "chrome 145", "chrome 144", "chrome 143", "chrome 142", "chrome 141", "chrome 140", "chrome 139", "chrome 138", "chrome 137", "chrome 136", "chrome 135", "chrome 134", "chrome 133", "chrome 132", "chrome 131", "chrome 130", "chrome 129", "chrome 128", "chrome 127", "chrome 126", "chrome 125", "chrome 124", "chrome 123", "chrome 122", "chrome 121", "chrome 120", "chrome 112", "chrome 109", "edge 148", "edge 147", "edge 146", "edge 145", "edge 144", "edge 143", "edge 142", "edge 141", "edge 140", "edge 139", "edge 138", "edge 137", "edge 136", "edge 135", "edge 134", "edge 133", "edge 132", "edge 131", "edge 130", "edge 129", "edge 128", "edge 127", "edge 126", "edge 125", "edge 124", "edge 123", "edge 122", "edge 121", "edge 120", "firefox 150", "firefox 149", "firefox 148", "firefox 147", "firefox 146", "firefox 145", "firefox 144", "firefox 143", "firefox 142", "firefox 141", "firefox 140", "firefox 139", "firefox 138", "firefox 137", "firefox 136", "firefox 135", "firefox 134", "firefox 133", "firefox 132", "firefox 131", "firefox 130", "firefox 129", "firefox 128", "firefox 127", "firefox 126", "firefox 125", "firefox 124", "firefox 123", "firefox 122", "firefox 121", "firefox 120", "ios_saf 26.4", "ios_saf 26.3", "ios_saf 26.2", "ios_saf 26.1", "ios_saf 26.0", "ios_saf 18.5-18.7", "ios_saf 18.4", "ios_saf 18.3", "ios_saf 18.2", "ios_saf 18.1", "ios_saf 18.0", "ios_saf 17.6-17.7", "ios_saf 17.5", "ios_saf 17.4", "ios_saf 17.3", "ios_saf 17.2", "ios_saf 17.1", "ios_saf 17.0", "kaios 3.0-3.1", "kaios 2.5", "op_mini all", "op_mob 80", "opera 131", "opera 127", "safari 26.4", "safari 26.3", "safari 26.2", "safari 26.1", "safari 26.0", "safari 18.5-18.7", "safari 18.4", "safari 18.3", "safari 18.2", "safari 18.1", "safari 18.0", "safari 17.6", "safari 17.5", "safari 17.4", "safari 17.3", "safari 17.2", "safari 17.1", "safari 17.0", "samsung 29", "samsung 28"] || [];
|
|
14
14
|
const WHITE_LISTED_BROWSERS = ['chrome', 'firefox', 'safari', 'edge'];
|
|
15
15
|
const WHITE_LIST = SUPPORTED.reduce((acc, item) => {
|
|
16
16
|
var _item$match;
|
|
@@ -61,11 +61,10 @@ const setCSSAnchorPositioning = ({
|
|
|
61
61
|
if (calculatedMinWidth !== null) {
|
|
62
62
|
popup.style.minWidth = `${calculatedMinWidth}px`;
|
|
63
63
|
}
|
|
64
|
-
if (top) {
|
|
65
|
-
popup.style.transform = `translateY(${top}px)
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
popup.style.left = `${left}px`;
|
|
64
|
+
if (top || left) {
|
|
65
|
+
popup.style.transform = [top && `translateY(${top}px)`, left && `translateX(${left}px)`].filter(Boolean).join(' ');
|
|
66
|
+
} else {
|
|
67
|
+
popup.style.removeProperty('transform');
|
|
69
68
|
}
|
|
70
69
|
// When all directions are BOTTOM, the `max-height: 100%` from CSS should stay applied so popup doesn't overflow the anchor RG-2754
|
|
71
70
|
const SHOULD_AUTO_SHRINK = directions.every(d => d.startsWith('BOTTOM'));
|