@wix/editor-react-components 1.2289.0 → 1.2290.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/site/components/AccordionComponent/component.js +1 -1
- package/dist/site/components/AccordionComponent/manifest.js +1 -1
- package/dist/site/components/AnimatedIcon/manifest.js +1 -1
- package/dist/site/components/AudioPlayer/component.js +12 -10
- package/dist/site/components/AudioPlayer/manifest.js +1 -1
- package/dist/site/components/BoxContainer/component.js +1 -1
- package/dist/site/components/BoxContainer/manifest.js +1 -1
- package/dist/site/components/Breadcrumbs/component.js +2 -2
- package/dist/site/components/Breadcrumbs/manifest.js +1 -1
- package/dist/site/components/Button/manifest.js +1 -1
- package/dist/site/components/CollapsibleText/component.js +1 -1
- package/dist/site/components/CollapsibleText/manifest.js +1 -1
- package/dist/site/components/DatePicker/component.js +3290 -9827
- package/dist/site/components/DatePicker/manifest.js +1 -1
- package/dist/site/components/Dropdown/component.js +1 -1
- package/dist/site/components/Dropdown/manifest.js +1 -1
- package/dist/site/components/HTMLComponent/component.js +1 -1
- package/dist/site/components/HipaaIcon/component.js +1 -1
- package/dist/site/components/HipaaIcon/manifest.js +1 -1
- package/dist/site/components/LinkBar/component.js +1 -1
- package/dist/site/components/LinkBar/manifest.js +1 -1
- package/dist/site/components/Logo/component.js +1 -1
- package/dist/site/components/Logo/manifest.js +1 -1
- package/dist/site/components/Logo/sdk.js +1 -1
- package/dist/site/components/Lottie/component.js +1 -1
- package/dist/site/components/Lottie/manifest.js +1 -1
- package/dist/site/components/Menu/component.js +1 -1
- package/dist/site/components/Menu/manifest.js +1 -1
- package/dist/site/components/MultiStateBox/component.js +1 -1
- package/dist/site/components/MultiStateBox/manifest.js +1 -1
- package/dist/site/components/ProgressBar/component.js +1 -1
- package/dist/site/components/ProgressBar/manifest.js +1 -1
- package/dist/site/components/ProgressBar/sdk.js +1 -1
- package/dist/site/components/Repeater/component.js +1 -1
- package/dist/site/components/Repeater/manifest.js +1 -1
- package/dist/site/components/ShareButtons/component.js +1 -1
- package/dist/site/components/ShareButtons/manifest.js +1 -1
- package/dist/site/components/Tabs/component.js +1 -1
- package/dist/site/components/Tabs/manifest.js +1 -1
- package/dist/site/components/TextBox/component.js +1 -1
- package/dist/site/components/TextBox/manifest.js +1 -1
- package/dist/site/components/TextEffects3d/component.js +1 -1
- package/dist/site/components/TextEffects3d/manifest.js +1 -1
- package/dist/site/components/TextEffectsBauhaus/component.js +1 -1
- package/dist/site/components/TextEffectsBauhaus/manifest.js +1 -1
- package/dist/site/components/TextEffectsGlass/component.js +1 -1
- package/dist/site/components/TextEffectsGlass/manifest.js +1 -1
- package/dist/site/components/TextEffectsGlitch/component.js +1 -1
- package/dist/site/components/TextEffectsGlitch/manifest.js +1 -1
- package/dist/site/components/TextEffectsLetterPress/component.js +1 -1
- package/dist/site/components/TextEffectsLetterPress/manifest.js +1 -1
- package/dist/site/components/TextEffectsMatrix/component.js +1 -1
- package/dist/site/components/TextEffectsMatrix/manifest.js +1 -1
- package/dist/site/components/TextEffectsNeonSign/component.js +1 -1
- package/dist/site/components/TextEffectsNeonSign/manifest.js +1 -1
- package/dist/site/components/TextEffectsNoisy/component.js +1 -1
- package/dist/site/components/TextEffectsNoisy/manifest.js +1 -1
- package/dist/site/components/TextEffectsOutlineOut/component.js +2 -2
- package/dist/site/components/TextEffectsOutlineOut/manifest.js +1 -1
- package/dist/site/components/TextEffectsRetro/component.js +1 -1
- package/dist/site/components/TextEffectsRetro/manifest.js +1 -1
- package/dist/site/components/TextEffectsShook/component.js +1 -1
- package/dist/site/components/TextEffectsShook/manifest.js +1 -1
- package/dist/site/components/TextEffectsSticker/component.js +1 -1
- package/dist/site/components/TextEffectsSticker/manifest.js +2 -2
- package/dist/site/components/TextEffectsStriped/component.js +1 -1
- package/dist/site/components/TextEffectsStriped/manifest.js +1 -1
- package/dist/site/components/TextInput/component.js +171 -170
- package/dist/site/components/TextInput/manifest.js +1 -1
- package/dist/site/components/TimePicker/TimePicker.d.ts +3 -0
- package/dist/site/components/TimePicker/TimePicker.types.d.ts +29 -0
- package/dist/site/components/TimePicker/component.d.ts +2 -0
- package/dist/site/components/TimePicker/component.js +146 -0
- package/dist/site/components/TimePicker/component.preview.d.ts +2 -0
- package/dist/site/components/TimePicker/components/TimePickerField.d.ts +4 -0
- package/dist/site/components/TimePicker/constants.d.ts +32 -0
- package/dist/site/components/TimePicker/css.css +64 -0
- package/dist/site/components/TimePicker/hooks/useTimePickerValue.d.ts +10 -0
- package/dist/site/components/TimePicker/index.d.ts +2 -0
- package/dist/site/components/TimePicker/index.js +6 -0
- package/dist/site/components/TimePicker/manifest.d.ts +5 -0
- package/dist/site/components/TimePicker/manifest.js +113 -0
- package/dist/site/components/TimePicker/timePickerUtils.d.ts +15 -0
- package/dist/site/components/chunks/AnimatedIcon.js +1 -1
- package/dist/site/components/chunks/Button.js +1 -1
- package/dist/site/components/chunks/Button2.js +10 -829
- package/dist/site/components/chunks/DateField.js +6763 -0
- package/dist/site/components/chunks/Group.js +42 -155
- package/dist/site/components/chunks/I18nProvider.js +3 -3
- package/dist/site/components/chunks/Input.js +5 -5
- package/dist/site/components/chunks/Patterns.js +1 -1
- package/dist/site/components/chunks/TextEffectsShared.js +1 -1
- package/dist/site/components/chunks/constants10.js +14 -12
- package/dist/site/components/chunks/constants11.js +9 -9
- package/dist/site/components/chunks/constants12.js +10 -8
- package/dist/site/components/chunks/constants13.js +9 -13
- package/dist/site/components/chunks/constants14.js +14 -17
- package/dist/site/components/chunks/constants15.js +17 -12
- package/dist/site/components/chunks/constants16.js +11 -13
- package/dist/site/components/chunks/constants17.js +20 -66
- package/dist/site/components/chunks/constants18.js +67 -17
- package/dist/site/components/chunks/constants19.js +15 -50
- package/dist/site/components/chunks/constants2.js +30 -50
- package/dist/site/components/chunks/constants20.js +43 -45
- package/dist/site/components/chunks/constants21.js +48 -297
- package/dist/site/components/chunks/constants22.js +299 -41
- package/dist/site/components/chunks/constants23.js +44 -29
- package/dist/site/components/chunks/constants24.js +32 -17
- package/dist/site/components/chunks/constants25.js +16 -402
- package/dist/site/components/chunks/constants26.js +393 -73
- package/dist/site/components/chunks/constants27.js +80 -15
- package/dist/site/components/chunks/constants28.js +11 -42
- package/dist/site/components/chunks/constants29.js +44 -23
- package/dist/site/components/chunks/constants3.js +49 -14
- package/dist/site/components/chunks/constants30.js +28 -10
- package/dist/site/components/chunks/constants31.js +10 -132
- package/dist/site/components/chunks/constants32.js +112 -147
- package/dist/site/components/chunks/constants33.js +152 -49
- package/dist/site/components/chunks/constants34.js +53 -71
- package/dist/site/components/chunks/constants35.js +73 -77
- package/dist/site/components/chunks/constants36.js +76 -57
- package/dist/site/components/chunks/constants37.js +72 -0
- package/dist/site/components/chunks/constants4.js +10 -19
- package/dist/site/components/chunks/constants5.js +14 -14
- package/dist/site/components/chunks/constants6.js +11 -10
- package/dist/site/components/chunks/constants7.js +14 -14
- package/dist/site/components/chunks/constants8.js +22 -65
- package/dist/site/components/chunks/constants9.js +65 -20
- package/dist/site/components/chunks/filterDOMProps.js +7 -7
- package/dist/site/components/chunks/manifestBase.js +1 -1
- package/dist/site/components/chunks/useFocusable.js +118 -0
- package/dist/site/components/chunks/useLocalizedStringFormatter.js +1 -1
- package/dist/site/components/chunks/usePress.js +825 -0
- package/dist/site/components/chunks/utils.js +1 -1
- package/dist/site/components/extensions.js +9 -4
- package/package.json +3 -3
|
@@ -0,0 +1,825 @@
|
|
|
1
|
+
var __typeError = (msg) => {
|
|
2
|
+
throw TypeError(msg);
|
|
3
|
+
};
|
|
4
|
+
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
5
|
+
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
6
|
+
var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
7
|
+
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
|
8
|
+
var _shouldStopPropagation;
|
|
9
|
+
import { u as $2add3ce32c6007eb$export$fedb369cb70207f1, k as $d447af545b77c9f1$export$b204af158042fbac, F as $081cb5757e08788e$export$24490316f764c430, p as $d447af545b77c9f1$export$f21a1ffae260145a, v as $48a7d519b337145d$export$4eaf04e54aa8eed6, t as $fe16bffc7a557bf0$export$7f54fc3180508a52, G as $a92dc41f639950be$export$c2b7abe5d61ec696, H as $a92dc41f639950be$export$525bc4921d56d4a, i as $23f2114a1b82827e$export$4282f70798064fe0, d as $23f2114a1b82827e$export$e58f029f0fbfdb29, I as $b5c62b033c25b96d$export$29bf1b5f2c56cf63, J as $a92dc41f639950be$export$cabe61c495ee3649, K as $1969ac565cfec8d0$export$de79e2c695e052f3, L as $b5c62b033c25b96d$export$60278871457622de, c as $bbaa08b3cd72f041$export$9d1611c77c2fe928, M as $b7115c395c64f7b5$export$4debdb1a3f0fa79e, N as $caaf0dd3060ed57c$export$95185d699e05d4d7, O as $a4e76a5424781910$export$e08e3b67e392101e, z as $2add3ce32c6007eb$export$9ac100e40613ea10 } from "./Group.js";
|
|
10
|
+
import React__default, { useState, useRef, useCallback, useMemo, useEffect, useContext } from "react";
|
|
11
|
+
import { flushSync } from "react-dom";
|
|
12
|
+
let $1dfb119a85e764e5$var$formatterCache = /* @__PURE__ */ new Map();
|
|
13
|
+
let $1dfb119a85e764e5$var$supportsSignDisplay = false;
|
|
14
|
+
try {
|
|
15
|
+
$1dfb119a85e764e5$var$supportsSignDisplay = new Intl.NumberFormat("de-DE", {
|
|
16
|
+
signDisplay: "exceptZero"
|
|
17
|
+
}).resolvedOptions().signDisplay === "exceptZero";
|
|
18
|
+
} catch {
|
|
19
|
+
}
|
|
20
|
+
let $1dfb119a85e764e5$var$supportsUnit = false;
|
|
21
|
+
try {
|
|
22
|
+
$1dfb119a85e764e5$var$supportsUnit = new Intl.NumberFormat("de-DE", {
|
|
23
|
+
style: "unit",
|
|
24
|
+
unit: "degree"
|
|
25
|
+
}).resolvedOptions().style === "unit";
|
|
26
|
+
} catch {
|
|
27
|
+
}
|
|
28
|
+
const $1dfb119a85e764e5$var$UNITS = {
|
|
29
|
+
degree: {
|
|
30
|
+
narrow: {
|
|
31
|
+
default: "°",
|
|
32
|
+
"ja-JP": " 度",
|
|
33
|
+
"zh-TW": "度",
|
|
34
|
+
"sl-SI": " °"
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
class $1dfb119a85e764e5$export$cc77c4ff7e8673c5 {
|
|
39
|
+
constructor(locale, options = {}) {
|
|
40
|
+
this.numberFormatter = $1dfb119a85e764e5$var$getCachedNumberFormatter(locale, options);
|
|
41
|
+
this.options = options;
|
|
42
|
+
}
|
|
43
|
+
/** Formats a number value as a string, according to the locale and options provided to the constructor. */
|
|
44
|
+
format(value) {
|
|
45
|
+
var _a;
|
|
46
|
+
let res = "";
|
|
47
|
+
if (!$1dfb119a85e764e5$var$supportsSignDisplay && this.options.signDisplay != null) res = $1dfb119a85e764e5$export$711b50b3c525e0f2(this.numberFormatter, this.options.signDisplay, value);
|
|
48
|
+
else res = this.numberFormatter.format(value);
|
|
49
|
+
if (this.options.style === "unit" && !$1dfb119a85e764e5$var$supportsUnit) {
|
|
50
|
+
let { unit, unitDisplay = "short", locale } = this.resolvedOptions();
|
|
51
|
+
if (!unit) return res;
|
|
52
|
+
let values = (_a = $1dfb119a85e764e5$var$UNITS[unit]) == null ? void 0 : _a[unitDisplay];
|
|
53
|
+
res += values[locale] || values.default;
|
|
54
|
+
}
|
|
55
|
+
return res;
|
|
56
|
+
}
|
|
57
|
+
/** Formats a number to an array of parts such as separators, digits, punctuation, and more. */
|
|
58
|
+
formatToParts(value) {
|
|
59
|
+
return this.numberFormatter.formatToParts(value);
|
|
60
|
+
}
|
|
61
|
+
/** Formats a number range as a string. */
|
|
62
|
+
formatRange(start, end) {
|
|
63
|
+
if (typeof this.numberFormatter.formatRange === "function") return this.numberFormatter.formatRange(start, end);
|
|
64
|
+
if (end < start) throw new RangeError("End date must be >= start date");
|
|
65
|
+
return `${this.format(start)} – ${this.format(end)}`;
|
|
66
|
+
}
|
|
67
|
+
/** Formats a number range as an array of parts. */
|
|
68
|
+
formatRangeToParts(start, end) {
|
|
69
|
+
if (typeof this.numberFormatter.formatRangeToParts === "function") return this.numberFormatter.formatRangeToParts(start, end);
|
|
70
|
+
if (end < start) throw new RangeError("End date must be >= start date");
|
|
71
|
+
let startParts = this.numberFormatter.formatToParts(start);
|
|
72
|
+
let endParts = this.numberFormatter.formatToParts(end);
|
|
73
|
+
return [
|
|
74
|
+
...startParts.map((p) => ({
|
|
75
|
+
...p,
|
|
76
|
+
source: "startRange"
|
|
77
|
+
})),
|
|
78
|
+
{
|
|
79
|
+
type: "literal",
|
|
80
|
+
value: " – ",
|
|
81
|
+
source: "shared"
|
|
82
|
+
},
|
|
83
|
+
...endParts.map((p) => ({
|
|
84
|
+
...p,
|
|
85
|
+
source: "endRange"
|
|
86
|
+
}))
|
|
87
|
+
];
|
|
88
|
+
}
|
|
89
|
+
/** Returns the resolved formatting options based on the values passed to the constructor. */
|
|
90
|
+
resolvedOptions() {
|
|
91
|
+
let options = this.numberFormatter.resolvedOptions();
|
|
92
|
+
if (!$1dfb119a85e764e5$var$supportsSignDisplay && this.options.signDisplay != null) options = {
|
|
93
|
+
...options,
|
|
94
|
+
signDisplay: this.options.signDisplay
|
|
95
|
+
};
|
|
96
|
+
if (!$1dfb119a85e764e5$var$supportsUnit && this.options.style === "unit") options = {
|
|
97
|
+
...options,
|
|
98
|
+
style: "unit",
|
|
99
|
+
unit: this.options.unit,
|
|
100
|
+
unitDisplay: this.options.unitDisplay
|
|
101
|
+
};
|
|
102
|
+
return options;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
function $1dfb119a85e764e5$var$getCachedNumberFormatter(locale, options = {}) {
|
|
106
|
+
var _a;
|
|
107
|
+
let { numberingSystem } = options;
|
|
108
|
+
if (numberingSystem && locale.includes("-nu-")) {
|
|
109
|
+
if (!locale.includes("-u-")) locale += "-u-";
|
|
110
|
+
locale += `-nu-${numberingSystem}`;
|
|
111
|
+
}
|
|
112
|
+
if (options.style === "unit" && !$1dfb119a85e764e5$var$supportsUnit) {
|
|
113
|
+
let { unit, unitDisplay = "short" } = options;
|
|
114
|
+
if (!unit) throw new Error('unit option must be provided with style: "unit"');
|
|
115
|
+
if (!((_a = $1dfb119a85e764e5$var$UNITS[unit]) == null ? void 0 : _a[unitDisplay])) throw new Error(`Unsupported unit ${unit} with unitDisplay = ${unitDisplay}`);
|
|
116
|
+
options = {
|
|
117
|
+
...options,
|
|
118
|
+
style: "decimal"
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
let cacheKey = locale + (options ? Object.entries(options).sort((a, b) => a[0] < b[0] ? -1 : 1).join() : "");
|
|
122
|
+
if ($1dfb119a85e764e5$var$formatterCache.has(cacheKey)) return $1dfb119a85e764e5$var$formatterCache.get(cacheKey);
|
|
123
|
+
let numberFormatter = new Intl.NumberFormat(locale, options);
|
|
124
|
+
$1dfb119a85e764e5$var$formatterCache.set(cacheKey, numberFormatter);
|
|
125
|
+
return numberFormatter;
|
|
126
|
+
}
|
|
127
|
+
function $1dfb119a85e764e5$export$711b50b3c525e0f2(numberFormat, signDisplay, num) {
|
|
128
|
+
if (signDisplay === "auto") return numberFormat.format(num);
|
|
129
|
+
else if (signDisplay === "never") return numberFormat.format(Math.abs(num));
|
|
130
|
+
else {
|
|
131
|
+
let needsPositiveSign = false;
|
|
132
|
+
if (signDisplay === "always") needsPositiveSign = num > 0 || Object.is(num, 0);
|
|
133
|
+
else if (signDisplay === "exceptZero") {
|
|
134
|
+
if (Object.is(num, -0) || Object.is(num, 0)) num = Math.abs(num);
|
|
135
|
+
else needsPositiveSign = num > 0;
|
|
136
|
+
}
|
|
137
|
+
if (needsPositiveSign) {
|
|
138
|
+
let negative = numberFormat.format(-num);
|
|
139
|
+
let noSign = numberFormat.format(num);
|
|
140
|
+
let minus = negative.replace(noSign, "").replace(/\u200e|\u061C/, "");
|
|
141
|
+
if ([
|
|
142
|
+
...minus
|
|
143
|
+
].length !== 1) console.warn("@react-aria/i18n polyfill for NumberFormat signDisplay: Unsupported case");
|
|
144
|
+
let positive = negative.replace(noSign, "!!!").replace(minus, "+").replace("!!!", noSign);
|
|
145
|
+
return positive;
|
|
146
|
+
} else return numberFormat.format(num);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
let $cbf007e418543821$var$state = "default";
|
|
150
|
+
let $cbf007e418543821$var$savedUserSelect = "";
|
|
151
|
+
let $cbf007e418543821$var$modifiedElementMap = /* @__PURE__ */ new WeakMap();
|
|
152
|
+
function $cbf007e418543821$export$16a4697467175487(target) {
|
|
153
|
+
if ($2add3ce32c6007eb$export$fedb369cb70207f1()) {
|
|
154
|
+
if ($cbf007e418543821$var$state === "default") {
|
|
155
|
+
const documentObject = $d447af545b77c9f1$export$b204af158042fbac(target);
|
|
156
|
+
$cbf007e418543821$var$savedUserSelect = documentObject.documentElement.style.webkitUserSelect;
|
|
157
|
+
documentObject.documentElement.style.webkitUserSelect = "none";
|
|
158
|
+
}
|
|
159
|
+
$cbf007e418543821$var$state = "disabled";
|
|
160
|
+
} else if (target instanceof HTMLElement || target instanceof SVGElement) {
|
|
161
|
+
let property = "userSelect" in target.style ? "userSelect" : "webkitUserSelect";
|
|
162
|
+
$cbf007e418543821$var$modifiedElementMap.set(target, target.style[property]);
|
|
163
|
+
target.style[property] = "none";
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
function $cbf007e418543821$export$b0d6fa1ab32e3295(target) {
|
|
167
|
+
if ($2add3ce32c6007eb$export$fedb369cb70207f1()) {
|
|
168
|
+
if ($cbf007e418543821$var$state !== "disabled") return;
|
|
169
|
+
$cbf007e418543821$var$state = "restoring";
|
|
170
|
+
setTimeout(() => {
|
|
171
|
+
$081cb5757e08788e$export$24490316f764c430(() => {
|
|
172
|
+
if ($cbf007e418543821$var$state === "restoring") {
|
|
173
|
+
const documentObject = $d447af545b77c9f1$export$b204af158042fbac(target);
|
|
174
|
+
if (documentObject.documentElement.style.webkitUserSelect === "none") documentObject.documentElement.style.webkitUserSelect = $cbf007e418543821$var$savedUserSelect || "";
|
|
175
|
+
$cbf007e418543821$var$savedUserSelect = "";
|
|
176
|
+
$cbf007e418543821$var$state = "default";
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
}, 300);
|
|
180
|
+
} else if (target instanceof HTMLElement || target instanceof SVGElement) {
|
|
181
|
+
if (target && $cbf007e418543821$var$modifiedElementMap.has(target)) {
|
|
182
|
+
let targetOldUserSelect = $cbf007e418543821$var$modifiedElementMap.get(target);
|
|
183
|
+
let property = "userSelect" in target.style ? "userSelect" : "webkitUserSelect";
|
|
184
|
+
if (target.style[property] === "none") target.style[property] = targetOldUserSelect;
|
|
185
|
+
if (target.getAttribute("style") === "") target.removeAttribute("style");
|
|
186
|
+
$cbf007e418543821$var$modifiedElementMap.delete(target);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
function $2b2d34ff061957fb$var$getWebpackNonce(doc) {
|
|
191
|
+
let ownerWindow = doc == null ? void 0 : doc.defaultView;
|
|
192
|
+
return (ownerWindow == null ? void 0 : ownerWindow.__webpack_nonce__) || globalThis["__webpack_nonce__"] || void 0;
|
|
193
|
+
}
|
|
194
|
+
let $2b2d34ff061957fb$var$nonceCache = /* @__PURE__ */ new WeakMap();
|
|
195
|
+
function $2b2d34ff061957fb$export$2b85b721e524d74b(doc) {
|
|
196
|
+
let d = doc ?? (typeof document !== "undefined" ? document : void 0);
|
|
197
|
+
if (!d) return $2b2d34ff061957fb$var$getWebpackNonce(d);
|
|
198
|
+
if ($2b2d34ff061957fb$var$nonceCache.has(d)) return $2b2d34ff061957fb$var$nonceCache.get(d);
|
|
199
|
+
let meta = d.querySelector('meta[property="csp-nonce"]');
|
|
200
|
+
let nonce = meta && meta instanceof $d447af545b77c9f1$export$f21a1ffae260145a(meta).HTMLMetaElement && (meta.nonce || meta.content) || $2b2d34ff061957fb$var$getWebpackNonce(d) || void 0;
|
|
201
|
+
if (nonce !== void 0) $2b2d34ff061957fb$var$nonceCache.set(d, nonce);
|
|
202
|
+
return nonce;
|
|
203
|
+
}
|
|
204
|
+
const $24f9a20f226ad820$export$5165eccb35aaadb5 = React__default.createContext({
|
|
205
|
+
register: () => {
|
|
206
|
+
}
|
|
207
|
+
});
|
|
208
|
+
$24f9a20f226ad820$export$5165eccb35aaadb5.displayName = "PressResponderContext";
|
|
209
|
+
function $d27d541f9569d26d$var$usePressResponderContext(props) {
|
|
210
|
+
let context = useContext($24f9a20f226ad820$export$5165eccb35aaadb5);
|
|
211
|
+
if (context) {
|
|
212
|
+
let { register, ref, ...contextProps } = context;
|
|
213
|
+
props = $bbaa08b3cd72f041$export$9d1611c77c2fe928(contextProps, props);
|
|
214
|
+
register();
|
|
215
|
+
}
|
|
216
|
+
$b7115c395c64f7b5$export$4debdb1a3f0fa79e(context, props.ref);
|
|
217
|
+
return props;
|
|
218
|
+
}
|
|
219
|
+
class $d27d541f9569d26d$var$PressEvent {
|
|
220
|
+
constructor(type, pointerType, originalEvent, state) {
|
|
221
|
+
__privateAdd(this, _shouldStopPropagation);
|
|
222
|
+
__privateSet(this, _shouldStopPropagation, true);
|
|
223
|
+
let currentTarget = (state == null ? void 0 : state.target) ?? originalEvent.currentTarget;
|
|
224
|
+
const rect = currentTarget == null ? void 0 : currentTarget.getBoundingClientRect();
|
|
225
|
+
let x, y = 0;
|
|
226
|
+
let clientX, clientY = null;
|
|
227
|
+
if (originalEvent.clientX != null && originalEvent.clientY != null) {
|
|
228
|
+
clientX = originalEvent.clientX;
|
|
229
|
+
clientY = originalEvent.clientY;
|
|
230
|
+
}
|
|
231
|
+
if (rect) {
|
|
232
|
+
if (clientX != null && clientY != null) {
|
|
233
|
+
x = clientX - rect.left;
|
|
234
|
+
y = clientY - rect.top;
|
|
235
|
+
} else {
|
|
236
|
+
x = rect.width / 2;
|
|
237
|
+
y = rect.height / 2;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
this.type = type;
|
|
241
|
+
this.pointerType = pointerType;
|
|
242
|
+
this.target = originalEvent.currentTarget;
|
|
243
|
+
this.shiftKey = originalEvent.shiftKey;
|
|
244
|
+
this.metaKey = originalEvent.metaKey;
|
|
245
|
+
this.ctrlKey = originalEvent.ctrlKey;
|
|
246
|
+
this.altKey = originalEvent.altKey;
|
|
247
|
+
this.x = x;
|
|
248
|
+
this.y = y;
|
|
249
|
+
this.key = originalEvent.key;
|
|
250
|
+
}
|
|
251
|
+
continuePropagation() {
|
|
252
|
+
__privateSet(this, _shouldStopPropagation, false);
|
|
253
|
+
}
|
|
254
|
+
get shouldStopPropagation() {
|
|
255
|
+
return __privateGet(this, _shouldStopPropagation);
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
_shouldStopPropagation = new WeakMap();
|
|
259
|
+
const $d27d541f9569d26d$var$LINK_CLICKED = Symbol("linkClicked");
|
|
260
|
+
const $d27d541f9569d26d$var$STYLE_ID = "react-aria-pressable-style";
|
|
261
|
+
const $d27d541f9569d26d$var$PRESSABLE_ATTRIBUTE = "data-react-aria-pressable";
|
|
262
|
+
function $d27d541f9569d26d$export$45712eceda6fad21(props) {
|
|
263
|
+
let { onPress, onPressChange, onPressStart, onPressEnd, onPressUp, onClick, isDisabled, isPressed: isPressedProp, preventFocusOnPress, shouldCancelOnPointerExit, allowTextSelectionOnPress, ref: domRef, ...domProps } = $d27d541f9569d26d$var$usePressResponderContext(props);
|
|
264
|
+
let [isPressed, setPressed] = useState(false);
|
|
265
|
+
let ref = useRef({
|
|
266
|
+
isPressed: false,
|
|
267
|
+
ignoreEmulatedMouseEvents: false,
|
|
268
|
+
didFirePressStart: false,
|
|
269
|
+
isTriggeringEvent: false,
|
|
270
|
+
activePointerId: null,
|
|
271
|
+
target: null,
|
|
272
|
+
isOverTarget: false,
|
|
273
|
+
pointerType: null,
|
|
274
|
+
disposables: []
|
|
275
|
+
});
|
|
276
|
+
let { addGlobalListener, removeAllGlobalListeners } = $48a7d519b337145d$export$4eaf04e54aa8eed6();
|
|
277
|
+
let triggerPressStart = useCallback((originalEvent, pointerType) => {
|
|
278
|
+
let state = ref.current;
|
|
279
|
+
if (isDisabled || state.didFirePressStart) return false;
|
|
280
|
+
let shouldStopPropagation = true;
|
|
281
|
+
state.isTriggeringEvent = true;
|
|
282
|
+
if (onPressStart) {
|
|
283
|
+
let event = new $d27d541f9569d26d$var$PressEvent("pressstart", pointerType, originalEvent);
|
|
284
|
+
onPressStart(event);
|
|
285
|
+
shouldStopPropagation = event.shouldStopPropagation;
|
|
286
|
+
}
|
|
287
|
+
if (onPressChange) onPressChange(true);
|
|
288
|
+
state.isTriggeringEvent = false;
|
|
289
|
+
state.didFirePressStart = true;
|
|
290
|
+
setPressed(true);
|
|
291
|
+
return shouldStopPropagation;
|
|
292
|
+
}, [
|
|
293
|
+
isDisabled,
|
|
294
|
+
onPressStart,
|
|
295
|
+
onPressChange
|
|
296
|
+
]);
|
|
297
|
+
let triggerPressEnd = useCallback((originalEvent, pointerType, wasPressed = true) => {
|
|
298
|
+
let state = ref.current;
|
|
299
|
+
if (!state.didFirePressStart) return false;
|
|
300
|
+
state.didFirePressStart = false;
|
|
301
|
+
state.isTriggeringEvent = true;
|
|
302
|
+
let shouldStopPropagation = true;
|
|
303
|
+
if (onPressEnd) {
|
|
304
|
+
let event = new $d27d541f9569d26d$var$PressEvent("pressend", pointerType, originalEvent);
|
|
305
|
+
onPressEnd(event);
|
|
306
|
+
shouldStopPropagation = event.shouldStopPropagation;
|
|
307
|
+
}
|
|
308
|
+
if (onPressChange) onPressChange(false);
|
|
309
|
+
setPressed(false);
|
|
310
|
+
if (onPress && wasPressed && !isDisabled) {
|
|
311
|
+
let event = new $d27d541f9569d26d$var$PressEvent("press", pointerType, originalEvent);
|
|
312
|
+
onPress(event);
|
|
313
|
+
shouldStopPropagation && (shouldStopPropagation = event.shouldStopPropagation);
|
|
314
|
+
}
|
|
315
|
+
state.isTriggeringEvent = false;
|
|
316
|
+
return shouldStopPropagation;
|
|
317
|
+
}, [
|
|
318
|
+
isDisabled,
|
|
319
|
+
onPressEnd,
|
|
320
|
+
onPressChange,
|
|
321
|
+
onPress
|
|
322
|
+
]);
|
|
323
|
+
let triggerPressEndEvent = $fe16bffc7a557bf0$export$7f54fc3180508a52(triggerPressEnd);
|
|
324
|
+
let triggerPressUp = useCallback((originalEvent, pointerType) => {
|
|
325
|
+
let state = ref.current;
|
|
326
|
+
if (isDisabled) return false;
|
|
327
|
+
if (onPressUp) {
|
|
328
|
+
state.isTriggeringEvent = true;
|
|
329
|
+
let event = new $d27d541f9569d26d$var$PressEvent("pressup", pointerType, originalEvent);
|
|
330
|
+
onPressUp(event);
|
|
331
|
+
state.isTriggeringEvent = false;
|
|
332
|
+
return event.shouldStopPropagation;
|
|
333
|
+
}
|
|
334
|
+
return true;
|
|
335
|
+
}, [
|
|
336
|
+
isDisabled,
|
|
337
|
+
onPressUp
|
|
338
|
+
]);
|
|
339
|
+
let triggerPressUpEvent = $fe16bffc7a557bf0$export$7f54fc3180508a52(triggerPressUp);
|
|
340
|
+
let cancel = useCallback((e) => {
|
|
341
|
+
let state = ref.current;
|
|
342
|
+
if (state.isPressed && state.target) {
|
|
343
|
+
if (state.didFirePressStart && state.pointerType != null) triggerPressEnd($d27d541f9569d26d$var$createEvent(state.target, e), state.pointerType, false);
|
|
344
|
+
state.isPressed = false;
|
|
345
|
+
state.isOverTarget = false;
|
|
346
|
+
state.activePointerId = null;
|
|
347
|
+
state.pointerType = null;
|
|
348
|
+
removeAllGlobalListeners();
|
|
349
|
+
if (!allowTextSelectionOnPress) $cbf007e418543821$export$b0d6fa1ab32e3295(state.target);
|
|
350
|
+
for (let dispose of state.disposables) dispose();
|
|
351
|
+
state.disposables = [];
|
|
352
|
+
}
|
|
353
|
+
}, [
|
|
354
|
+
allowTextSelectionOnPress,
|
|
355
|
+
removeAllGlobalListeners,
|
|
356
|
+
triggerPressEnd
|
|
357
|
+
]);
|
|
358
|
+
let cancelEvent = $fe16bffc7a557bf0$export$7f54fc3180508a52(cancel);
|
|
359
|
+
let cancelOnPointerExit = useCallback((e) => {
|
|
360
|
+
if (shouldCancelOnPointerExit) cancel(e);
|
|
361
|
+
}, [
|
|
362
|
+
shouldCancelOnPointerExit,
|
|
363
|
+
cancel
|
|
364
|
+
]);
|
|
365
|
+
let triggerClick = useCallback((e) => {
|
|
366
|
+
if (isDisabled) return;
|
|
367
|
+
onClick == null ? void 0 : onClick(e);
|
|
368
|
+
}, [
|
|
369
|
+
isDisabled,
|
|
370
|
+
onClick
|
|
371
|
+
]);
|
|
372
|
+
let triggerSyntheticClick = useCallback((e, target) => {
|
|
373
|
+
if (isDisabled) return;
|
|
374
|
+
if (onClick) {
|
|
375
|
+
let event = new MouseEvent("click", e);
|
|
376
|
+
$a92dc41f639950be$export$c2b7abe5d61ec696(event, target);
|
|
377
|
+
onClick($a92dc41f639950be$export$525bc4921d56d4a(event));
|
|
378
|
+
}
|
|
379
|
+
}, [
|
|
380
|
+
isDisabled,
|
|
381
|
+
onClick
|
|
382
|
+
]);
|
|
383
|
+
let pressProps = useMemo(() => {
|
|
384
|
+
let state = ref.current;
|
|
385
|
+
let pressProps2 = {
|
|
386
|
+
onKeyDown(e) {
|
|
387
|
+
var _a;
|
|
388
|
+
if ($d27d541f9569d26d$var$isValidKeyboardEvent(e.nativeEvent, e.currentTarget) && $23f2114a1b82827e$export$4282f70798064fe0(e.currentTarget, $23f2114a1b82827e$export$e58f029f0fbfdb29(e))) {
|
|
389
|
+
if ($d27d541f9569d26d$var$shouldPreventDefaultKeyboard($23f2114a1b82827e$export$e58f029f0fbfdb29(e), e.key)) e.preventDefault();
|
|
390
|
+
let shouldStopPropagation = true;
|
|
391
|
+
if (!state.isPressed && !e.repeat) {
|
|
392
|
+
state.target = e.currentTarget;
|
|
393
|
+
state.isPressed = true;
|
|
394
|
+
state.pointerType = "keyboard";
|
|
395
|
+
shouldStopPropagation = triggerPressStart(e, "keyboard");
|
|
396
|
+
}
|
|
397
|
+
let originalTarget = e.currentTarget;
|
|
398
|
+
let pressUp = (e2) => {
|
|
399
|
+
if ($d27d541f9569d26d$var$isValidKeyboardEvent(e2, originalTarget) && !e2.repeat && $23f2114a1b82827e$export$4282f70798064fe0(originalTarget, $23f2114a1b82827e$export$e58f029f0fbfdb29(e2)) && state.target)
|
|
400
|
+
triggerPressUpEvent($d27d541f9569d26d$var$createEvent(state.target, e2), "keyboard");
|
|
401
|
+
};
|
|
402
|
+
addGlobalListener($d447af545b77c9f1$export$b204af158042fbac(e.currentTarget), "keyup", $a4e76a5424781910$export$e08e3b67e392101e(pressUp, onKeyUp), true);
|
|
403
|
+
if (shouldStopPropagation) e.stopPropagation();
|
|
404
|
+
if (e.metaKey && $2add3ce32c6007eb$export$9ac100e40613ea10()) (_a = state.metaKeyEvents) == null ? void 0 : _a.set(e.key, e.nativeEvent);
|
|
405
|
+
} else if (e.key === "Meta") state.metaKeyEvents = /* @__PURE__ */ new Map();
|
|
406
|
+
},
|
|
407
|
+
onClick(e) {
|
|
408
|
+
if (e && !$23f2114a1b82827e$export$4282f70798064fe0(e.currentTarget, $23f2114a1b82827e$export$e58f029f0fbfdb29(e))) return;
|
|
409
|
+
if (e && e.button === 0 && !state.isTriggeringEvent && !$caaf0dd3060ed57c$export$95185d699e05d4d7.isOpening) {
|
|
410
|
+
let shouldStopPropagation = true;
|
|
411
|
+
if (isDisabled) e.preventDefault();
|
|
412
|
+
if (!state.ignoreEmulatedMouseEvents && !state.isPressed && (state.pointerType === "virtual" || $b5c62b033c25b96d$export$60278871457622de(e.nativeEvent))) {
|
|
413
|
+
let stopPressStart = triggerPressStart(e, "virtual");
|
|
414
|
+
let stopPressUp = triggerPressUpEvent(e, "virtual");
|
|
415
|
+
let stopPressEnd = triggerPressEndEvent(e, "virtual");
|
|
416
|
+
triggerClick(e);
|
|
417
|
+
shouldStopPropagation = stopPressStart && stopPressUp && stopPressEnd;
|
|
418
|
+
} else if (state.isPressed && state.pointerType !== "keyboard") {
|
|
419
|
+
let pointerType = state.pointerType || e.nativeEvent.pointerType || "virtual";
|
|
420
|
+
let stopPressUp = triggerPressUpEvent($d27d541f9569d26d$var$createEvent(e.currentTarget, e), pointerType);
|
|
421
|
+
let stopPressEnd = triggerPressEndEvent($d27d541f9569d26d$var$createEvent(e.currentTarget, e), pointerType, true);
|
|
422
|
+
shouldStopPropagation = stopPressUp && stopPressEnd;
|
|
423
|
+
state.isOverTarget = false;
|
|
424
|
+
triggerClick(e);
|
|
425
|
+
cancelEvent(e);
|
|
426
|
+
}
|
|
427
|
+
state.ignoreEmulatedMouseEvents = false;
|
|
428
|
+
if (shouldStopPropagation) e.stopPropagation();
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
};
|
|
432
|
+
let onKeyUp = (e) => {
|
|
433
|
+
var _a, _b, _c;
|
|
434
|
+
if (state.isPressed && state.target && $d27d541f9569d26d$var$isValidKeyboardEvent(e, state.target)) {
|
|
435
|
+
if ($d27d541f9569d26d$var$shouldPreventDefaultKeyboard($23f2114a1b82827e$export$e58f029f0fbfdb29(e), e.key)) e.preventDefault();
|
|
436
|
+
let target = $23f2114a1b82827e$export$e58f029f0fbfdb29(e);
|
|
437
|
+
let wasPressed = $23f2114a1b82827e$export$4282f70798064fe0(state.target, target);
|
|
438
|
+
triggerPressEndEvent($d27d541f9569d26d$var$createEvent(state.target, e), "keyboard", wasPressed);
|
|
439
|
+
if (wasPressed) triggerSyntheticClick(e, state.target);
|
|
440
|
+
removeAllGlobalListeners();
|
|
441
|
+
if (e.key !== "Enter" && $d27d541f9569d26d$var$isHTMLAnchorLink(state.target) && $23f2114a1b82827e$export$4282f70798064fe0(state.target, target) && !e[$d27d541f9569d26d$var$LINK_CLICKED]) {
|
|
442
|
+
e[$d27d541f9569d26d$var$LINK_CLICKED] = true;
|
|
443
|
+
$caaf0dd3060ed57c$export$95185d699e05d4d7(state.target, e, false);
|
|
444
|
+
}
|
|
445
|
+
state.isPressed = false;
|
|
446
|
+
(_a = state.metaKeyEvents) == null ? void 0 : _a.delete(e.key);
|
|
447
|
+
} else if (e.key === "Meta" && ((_b = state.metaKeyEvents) == null ? void 0 : _b.size)) {
|
|
448
|
+
let events = state.metaKeyEvents;
|
|
449
|
+
state.metaKeyEvents = void 0;
|
|
450
|
+
for (let event of events.values()) (_c = state.target) == null ? void 0 : _c.dispatchEvent(new KeyboardEvent("keyup", event));
|
|
451
|
+
}
|
|
452
|
+
};
|
|
453
|
+
if (typeof PointerEvent !== "undefined") {
|
|
454
|
+
pressProps2.onPointerDown = (e) => {
|
|
455
|
+
if (e.button !== 0 || !$23f2114a1b82827e$export$4282f70798064fe0(e.currentTarget, $23f2114a1b82827e$export$e58f029f0fbfdb29(e))) return;
|
|
456
|
+
if ($b5c62b033c25b96d$export$29bf1b5f2c56cf63(e.nativeEvent)) {
|
|
457
|
+
state.pointerType = "virtual";
|
|
458
|
+
return;
|
|
459
|
+
}
|
|
460
|
+
state.pointerType = e.pointerType;
|
|
461
|
+
let shouldStopPropagation = true;
|
|
462
|
+
if (!state.isPressed) {
|
|
463
|
+
state.isPressed = true;
|
|
464
|
+
state.isOverTarget = true;
|
|
465
|
+
state.activePointerId = e.pointerId;
|
|
466
|
+
state.target = e.currentTarget;
|
|
467
|
+
if (!allowTextSelectionOnPress) $cbf007e418543821$export$16a4697467175487(state.target);
|
|
468
|
+
shouldStopPropagation = triggerPressStart(e, state.pointerType);
|
|
469
|
+
let target = $23f2114a1b82827e$export$e58f029f0fbfdb29(e);
|
|
470
|
+
if ("releasePointerCapture" in target) {
|
|
471
|
+
if ("hasPointerCapture" in target) {
|
|
472
|
+
if (target.hasPointerCapture(e.pointerId)) target.releasePointerCapture(e.pointerId);
|
|
473
|
+
} else target.releasePointerCapture(e.pointerId);
|
|
474
|
+
}
|
|
475
|
+
addGlobalListener($d447af545b77c9f1$export$b204af158042fbac(e.currentTarget), "pointerup", onPointerUp, false);
|
|
476
|
+
addGlobalListener($d447af545b77c9f1$export$b204af158042fbac(e.currentTarget), "pointercancel", onPointerCancel, false);
|
|
477
|
+
}
|
|
478
|
+
if (shouldStopPropagation) e.stopPropagation();
|
|
479
|
+
};
|
|
480
|
+
pressProps2.onMouseDown = (e) => {
|
|
481
|
+
if (!$23f2114a1b82827e$export$4282f70798064fe0(e.currentTarget, $23f2114a1b82827e$export$e58f029f0fbfdb29(e))) return;
|
|
482
|
+
if (e.button === 0) {
|
|
483
|
+
if (preventFocusOnPress) {
|
|
484
|
+
let dispose = $a92dc41f639950be$export$cabe61c495ee3649(e.target);
|
|
485
|
+
if (dispose) state.disposables.push(dispose);
|
|
486
|
+
}
|
|
487
|
+
e.stopPropagation();
|
|
488
|
+
}
|
|
489
|
+
};
|
|
490
|
+
pressProps2.onPointerUp = (e) => {
|
|
491
|
+
if (!$23f2114a1b82827e$export$4282f70798064fe0(e.currentTarget, $23f2114a1b82827e$export$e58f029f0fbfdb29(e)) || state.pointerType === "virtual") return;
|
|
492
|
+
if (e.button === 0 && !state.isPressed)
|
|
493
|
+
triggerPressUpEvent(e, state.pointerType || e.pointerType);
|
|
494
|
+
};
|
|
495
|
+
pressProps2.onPointerEnter = (e) => {
|
|
496
|
+
if (e.pointerId === state.activePointerId && state.target && !state.isOverTarget && state.pointerType != null) {
|
|
497
|
+
state.isOverTarget = true;
|
|
498
|
+
triggerPressStart($d27d541f9569d26d$var$createEvent(state.target, e), state.pointerType);
|
|
499
|
+
}
|
|
500
|
+
};
|
|
501
|
+
pressProps2.onPointerLeave = (e) => {
|
|
502
|
+
if (e.pointerId === state.activePointerId && state.target && state.isOverTarget && state.pointerType != null) {
|
|
503
|
+
state.isOverTarget = false;
|
|
504
|
+
triggerPressEndEvent($d27d541f9569d26d$var$createEvent(state.target, e), state.pointerType, false);
|
|
505
|
+
cancelOnPointerExit(e);
|
|
506
|
+
}
|
|
507
|
+
};
|
|
508
|
+
let onPointerUp = (e) => {
|
|
509
|
+
if (e.pointerId === state.activePointerId && state.isPressed && e.button === 0 && state.target) {
|
|
510
|
+
if ($23f2114a1b82827e$export$4282f70798064fe0(state.target, $23f2114a1b82827e$export$e58f029f0fbfdb29(e)) && state.pointerType != null) {
|
|
511
|
+
let clicked = false;
|
|
512
|
+
let timeout = setTimeout(() => {
|
|
513
|
+
if (state.isPressed && state.target instanceof HTMLElement) {
|
|
514
|
+
if (clicked)
|
|
515
|
+
cancelEvent(e);
|
|
516
|
+
else {
|
|
517
|
+
$1969ac565cfec8d0$export$de79e2c695e052f3(state.target);
|
|
518
|
+
state.target.click();
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
}, 80);
|
|
522
|
+
addGlobalListener(e.currentTarget, "click", () => clicked = true, true);
|
|
523
|
+
state.disposables.push(() => clearTimeout(timeout));
|
|
524
|
+
} else
|
|
525
|
+
cancelEvent(e);
|
|
526
|
+
state.isOverTarget = false;
|
|
527
|
+
}
|
|
528
|
+
};
|
|
529
|
+
let onPointerCancel = (e) => {
|
|
530
|
+
cancelEvent(e);
|
|
531
|
+
};
|
|
532
|
+
pressProps2.onDragStart = (e) => {
|
|
533
|
+
if (!$23f2114a1b82827e$export$4282f70798064fe0(e.currentTarget, $23f2114a1b82827e$export$e58f029f0fbfdb29(e))) return;
|
|
534
|
+
cancelEvent(e);
|
|
535
|
+
};
|
|
536
|
+
} else if (process.env.NODE_ENV === "test") {
|
|
537
|
+
pressProps2.onMouseDown = (e) => {
|
|
538
|
+
if (e.button !== 0 || !$23f2114a1b82827e$export$4282f70798064fe0(e.currentTarget, $23f2114a1b82827e$export$e58f029f0fbfdb29(e))) return;
|
|
539
|
+
if (state.ignoreEmulatedMouseEvents) {
|
|
540
|
+
e.stopPropagation();
|
|
541
|
+
return;
|
|
542
|
+
}
|
|
543
|
+
state.isPressed = true;
|
|
544
|
+
state.isOverTarget = true;
|
|
545
|
+
state.target = e.currentTarget;
|
|
546
|
+
state.pointerType = $b5c62b033c25b96d$export$60278871457622de(e.nativeEvent) ? "virtual" : "mouse";
|
|
547
|
+
let shouldStopPropagation = flushSync(() => triggerPressStart(e, state.pointerType));
|
|
548
|
+
if (shouldStopPropagation) e.stopPropagation();
|
|
549
|
+
if (preventFocusOnPress) {
|
|
550
|
+
let dispose = $a92dc41f639950be$export$cabe61c495ee3649(e.target);
|
|
551
|
+
if (dispose) state.disposables.push(dispose);
|
|
552
|
+
}
|
|
553
|
+
addGlobalListener($d447af545b77c9f1$export$b204af158042fbac(e.currentTarget), "mouseup", onMouseUp, false);
|
|
554
|
+
};
|
|
555
|
+
pressProps2.onMouseEnter = (e) => {
|
|
556
|
+
if (!$23f2114a1b82827e$export$4282f70798064fe0(e.currentTarget, $23f2114a1b82827e$export$e58f029f0fbfdb29(e))) return;
|
|
557
|
+
let shouldStopPropagation = true;
|
|
558
|
+
if (state.isPressed && !state.ignoreEmulatedMouseEvents && state.pointerType != null) {
|
|
559
|
+
state.isOverTarget = true;
|
|
560
|
+
shouldStopPropagation = triggerPressStart(e, state.pointerType);
|
|
561
|
+
}
|
|
562
|
+
if (shouldStopPropagation) e.stopPropagation();
|
|
563
|
+
};
|
|
564
|
+
pressProps2.onMouseLeave = (e) => {
|
|
565
|
+
if (!$23f2114a1b82827e$export$4282f70798064fe0(e.currentTarget, $23f2114a1b82827e$export$e58f029f0fbfdb29(e))) return;
|
|
566
|
+
let shouldStopPropagation = true;
|
|
567
|
+
if (state.isPressed && !state.ignoreEmulatedMouseEvents && state.pointerType != null) {
|
|
568
|
+
state.isOverTarget = false;
|
|
569
|
+
shouldStopPropagation = triggerPressEndEvent(e, state.pointerType, false);
|
|
570
|
+
cancelOnPointerExit(e);
|
|
571
|
+
}
|
|
572
|
+
if (shouldStopPropagation) e.stopPropagation();
|
|
573
|
+
};
|
|
574
|
+
pressProps2.onMouseUp = (e) => {
|
|
575
|
+
if (!$23f2114a1b82827e$export$4282f70798064fe0(e.currentTarget, $23f2114a1b82827e$export$e58f029f0fbfdb29(e))) return;
|
|
576
|
+
if (!state.ignoreEmulatedMouseEvents && e.button === 0 && !state.isPressed)
|
|
577
|
+
triggerPressUpEvent(e, state.pointerType || "mouse");
|
|
578
|
+
};
|
|
579
|
+
let onMouseUp = (e) => {
|
|
580
|
+
if (e.button !== 0) return;
|
|
581
|
+
if (state.ignoreEmulatedMouseEvents) {
|
|
582
|
+
state.ignoreEmulatedMouseEvents = false;
|
|
583
|
+
return;
|
|
584
|
+
}
|
|
585
|
+
if (state.target && $23f2114a1b82827e$export$4282f70798064fe0(state.target, $23f2114a1b82827e$export$e58f029f0fbfdb29(e)) && state.pointerType != null) ;
|
|
586
|
+
else
|
|
587
|
+
cancelEvent(e);
|
|
588
|
+
state.isOverTarget = false;
|
|
589
|
+
};
|
|
590
|
+
pressProps2.onTouchStart = (e) => {
|
|
591
|
+
if (!$23f2114a1b82827e$export$4282f70798064fe0(e.currentTarget, $23f2114a1b82827e$export$e58f029f0fbfdb29(e))) return;
|
|
592
|
+
let touch = $d27d541f9569d26d$var$getTouchFromEvent(e.nativeEvent);
|
|
593
|
+
if (!touch) return;
|
|
594
|
+
state.activePointerId = touch.identifier;
|
|
595
|
+
state.ignoreEmulatedMouseEvents = true;
|
|
596
|
+
state.isOverTarget = true;
|
|
597
|
+
state.isPressed = true;
|
|
598
|
+
state.target = e.currentTarget;
|
|
599
|
+
state.pointerType = "touch";
|
|
600
|
+
if (!allowTextSelectionOnPress) $cbf007e418543821$export$16a4697467175487(state.target);
|
|
601
|
+
let shouldStopPropagation = triggerPressStart($d27d541f9569d26d$var$createTouchEvent(state.target, e), state.pointerType);
|
|
602
|
+
if (shouldStopPropagation) e.stopPropagation();
|
|
603
|
+
addGlobalListener($d447af545b77c9f1$export$f21a1ffae260145a(e.currentTarget), "scroll", onScroll, true);
|
|
604
|
+
};
|
|
605
|
+
pressProps2.onTouchMove = (e) => {
|
|
606
|
+
if (!$23f2114a1b82827e$export$4282f70798064fe0(e.currentTarget, $23f2114a1b82827e$export$e58f029f0fbfdb29(e))) return;
|
|
607
|
+
if (!state.isPressed) {
|
|
608
|
+
e.stopPropagation();
|
|
609
|
+
return;
|
|
610
|
+
}
|
|
611
|
+
let touch = $d27d541f9569d26d$var$getTouchById(e.nativeEvent, state.activePointerId);
|
|
612
|
+
let shouldStopPropagation = true;
|
|
613
|
+
if (touch && $d27d541f9569d26d$var$isOverTarget(touch, e.currentTarget)) {
|
|
614
|
+
if (!state.isOverTarget && state.pointerType != null) {
|
|
615
|
+
state.isOverTarget = true;
|
|
616
|
+
shouldStopPropagation = triggerPressStart($d27d541f9569d26d$var$createTouchEvent(state.target, e), state.pointerType);
|
|
617
|
+
}
|
|
618
|
+
} else if (state.isOverTarget && state.pointerType != null) {
|
|
619
|
+
state.isOverTarget = false;
|
|
620
|
+
shouldStopPropagation = triggerPressEndEvent($d27d541f9569d26d$var$createTouchEvent(state.target, e), state.pointerType, false);
|
|
621
|
+
cancelOnPointerExit($d27d541f9569d26d$var$createTouchEvent(state.target, e));
|
|
622
|
+
}
|
|
623
|
+
if (shouldStopPropagation) e.stopPropagation();
|
|
624
|
+
};
|
|
625
|
+
pressProps2.onTouchEnd = (e) => {
|
|
626
|
+
if (!$23f2114a1b82827e$export$4282f70798064fe0(e.currentTarget, $23f2114a1b82827e$export$e58f029f0fbfdb29(e))) return;
|
|
627
|
+
if (!state.isPressed) {
|
|
628
|
+
e.stopPropagation();
|
|
629
|
+
return;
|
|
630
|
+
}
|
|
631
|
+
let touch = $d27d541f9569d26d$var$getTouchById(e.nativeEvent, state.activePointerId);
|
|
632
|
+
let shouldStopPropagation = true;
|
|
633
|
+
if (touch && $d27d541f9569d26d$var$isOverTarget(touch, e.currentTarget) && state.pointerType != null) {
|
|
634
|
+
triggerPressUpEvent($d27d541f9569d26d$var$createTouchEvent(state.target, e), state.pointerType);
|
|
635
|
+
shouldStopPropagation = triggerPressEndEvent($d27d541f9569d26d$var$createTouchEvent(state.target, e), state.pointerType);
|
|
636
|
+
triggerSyntheticClick(e.nativeEvent, state.target);
|
|
637
|
+
} else if (state.isOverTarget && state.pointerType != null)
|
|
638
|
+
shouldStopPropagation = triggerPressEndEvent($d27d541f9569d26d$var$createTouchEvent(state.target, e), state.pointerType, false);
|
|
639
|
+
if (shouldStopPropagation) e.stopPropagation();
|
|
640
|
+
state.isPressed = false;
|
|
641
|
+
state.activePointerId = null;
|
|
642
|
+
state.isOverTarget = false;
|
|
643
|
+
state.ignoreEmulatedMouseEvents = true;
|
|
644
|
+
if (state.target && !allowTextSelectionOnPress) $cbf007e418543821$export$b0d6fa1ab32e3295(state.target);
|
|
645
|
+
removeAllGlobalListeners();
|
|
646
|
+
};
|
|
647
|
+
pressProps2.onTouchCancel = (e) => {
|
|
648
|
+
if (!$23f2114a1b82827e$export$4282f70798064fe0(e.currentTarget, $23f2114a1b82827e$export$e58f029f0fbfdb29(e))) return;
|
|
649
|
+
e.stopPropagation();
|
|
650
|
+
if (state.isPressed)
|
|
651
|
+
cancelEvent($d27d541f9569d26d$var$createTouchEvent(state.target, e));
|
|
652
|
+
};
|
|
653
|
+
let onScroll = (e) => {
|
|
654
|
+
if (state.isPressed && $23f2114a1b82827e$export$4282f70798064fe0($23f2114a1b82827e$export$e58f029f0fbfdb29(e), state.target))
|
|
655
|
+
cancelEvent({
|
|
656
|
+
currentTarget: state.target,
|
|
657
|
+
shiftKey: false,
|
|
658
|
+
ctrlKey: false,
|
|
659
|
+
metaKey: false,
|
|
660
|
+
altKey: false
|
|
661
|
+
});
|
|
662
|
+
};
|
|
663
|
+
pressProps2.onDragStart = (e) => {
|
|
664
|
+
if (!$23f2114a1b82827e$export$4282f70798064fe0(e.currentTarget, $23f2114a1b82827e$export$e58f029f0fbfdb29(e))) return;
|
|
665
|
+
cancelEvent(e);
|
|
666
|
+
};
|
|
667
|
+
}
|
|
668
|
+
return pressProps2;
|
|
669
|
+
}, [
|
|
670
|
+
addGlobalListener,
|
|
671
|
+
isDisabled,
|
|
672
|
+
preventFocusOnPress,
|
|
673
|
+
removeAllGlobalListeners,
|
|
674
|
+
allowTextSelectionOnPress,
|
|
675
|
+
cancelOnPointerExit,
|
|
676
|
+
triggerPressStart,
|
|
677
|
+
triggerClick,
|
|
678
|
+
triggerSyntheticClick
|
|
679
|
+
]);
|
|
680
|
+
useEffect(() => {
|
|
681
|
+
if (!domRef || process.env.NODE_ENV === "test") return;
|
|
682
|
+
const ownerDocument = $d447af545b77c9f1$export$b204af158042fbac(domRef.current);
|
|
683
|
+
if (!ownerDocument || !ownerDocument.head || ownerDocument.getElementById($d27d541f9569d26d$var$STYLE_ID)) return;
|
|
684
|
+
const style = ownerDocument.createElement("style");
|
|
685
|
+
style.id = $d27d541f9569d26d$var$STYLE_ID;
|
|
686
|
+
let nonce = $2b2d34ff061957fb$export$2b85b721e524d74b(ownerDocument);
|
|
687
|
+
if (nonce) style.nonce = nonce;
|
|
688
|
+
style.textContent = `
|
|
689
|
+
@layer {
|
|
690
|
+
[${$d27d541f9569d26d$var$PRESSABLE_ATTRIBUTE}] {
|
|
691
|
+
touch-action: pan-x pan-y pinch-zoom;
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
`.trim();
|
|
695
|
+
ownerDocument.head.prepend(style);
|
|
696
|
+
}, [
|
|
697
|
+
domRef
|
|
698
|
+
]);
|
|
699
|
+
useEffect(() => {
|
|
700
|
+
let state = ref.current;
|
|
701
|
+
return () => {
|
|
702
|
+
if (!allowTextSelectionOnPress) $cbf007e418543821$export$b0d6fa1ab32e3295(state.target ?? void 0);
|
|
703
|
+
for (let dispose of state.disposables) dispose();
|
|
704
|
+
state.disposables = [];
|
|
705
|
+
};
|
|
706
|
+
}, [
|
|
707
|
+
allowTextSelectionOnPress
|
|
708
|
+
]);
|
|
709
|
+
return {
|
|
710
|
+
isPressed: isPressedProp || isPressed,
|
|
711
|
+
pressProps: $bbaa08b3cd72f041$export$9d1611c77c2fe928(domProps, pressProps, {
|
|
712
|
+
[$d27d541f9569d26d$var$PRESSABLE_ATTRIBUTE]: true
|
|
713
|
+
})
|
|
714
|
+
};
|
|
715
|
+
}
|
|
716
|
+
function $d27d541f9569d26d$var$isHTMLAnchorLink(target) {
|
|
717
|
+
return target.tagName === "A" && target.hasAttribute("href");
|
|
718
|
+
}
|
|
719
|
+
function $d27d541f9569d26d$var$isValidKeyboardEvent(event, currentTarget) {
|
|
720
|
+
const { key, code } = event;
|
|
721
|
+
const element = currentTarget;
|
|
722
|
+
const role = element.getAttribute("role");
|
|
723
|
+
return (key === "Enter" || key === " " || key === "Spacebar" || code === "Space") && !(element instanceof $d447af545b77c9f1$export$f21a1ffae260145a(element).HTMLInputElement && !$d27d541f9569d26d$var$isValidInputKey(element, key) || element instanceof $d447af545b77c9f1$export$f21a1ffae260145a(element).HTMLTextAreaElement || element.isContentEditable) && // Links should only trigger with Enter key
|
|
724
|
+
!((role === "link" || !role && $d27d541f9569d26d$var$isHTMLAnchorLink(element)) && key !== "Enter");
|
|
725
|
+
}
|
|
726
|
+
function $d27d541f9569d26d$var$getTouchFromEvent(event) {
|
|
727
|
+
const { targetTouches } = event;
|
|
728
|
+
if (targetTouches.length > 0) return targetTouches[0];
|
|
729
|
+
return null;
|
|
730
|
+
}
|
|
731
|
+
function $d27d541f9569d26d$var$getTouchById(event, pointerId) {
|
|
732
|
+
const changedTouches = event.changedTouches;
|
|
733
|
+
for (let i = 0; i < changedTouches.length; i++) {
|
|
734
|
+
const touch = changedTouches[i];
|
|
735
|
+
if (touch.identifier === pointerId) return touch;
|
|
736
|
+
}
|
|
737
|
+
return null;
|
|
738
|
+
}
|
|
739
|
+
function $d27d541f9569d26d$var$createTouchEvent(target, e) {
|
|
740
|
+
let clientX = 0;
|
|
741
|
+
let clientY = 0;
|
|
742
|
+
if (e.targetTouches && e.targetTouches.length === 1) {
|
|
743
|
+
clientX = e.targetTouches[0].clientX;
|
|
744
|
+
clientY = e.targetTouches[0].clientY;
|
|
745
|
+
}
|
|
746
|
+
return {
|
|
747
|
+
currentTarget: target,
|
|
748
|
+
shiftKey: e.shiftKey,
|
|
749
|
+
ctrlKey: e.ctrlKey,
|
|
750
|
+
metaKey: e.metaKey,
|
|
751
|
+
altKey: e.altKey,
|
|
752
|
+
clientX,
|
|
753
|
+
clientY
|
|
754
|
+
};
|
|
755
|
+
}
|
|
756
|
+
function $d27d541f9569d26d$var$createEvent(target, e) {
|
|
757
|
+
let clientX = e.clientX;
|
|
758
|
+
let clientY = e.clientY;
|
|
759
|
+
return {
|
|
760
|
+
currentTarget: target,
|
|
761
|
+
shiftKey: e.shiftKey,
|
|
762
|
+
ctrlKey: e.ctrlKey,
|
|
763
|
+
metaKey: e.metaKey,
|
|
764
|
+
altKey: e.altKey,
|
|
765
|
+
clientX,
|
|
766
|
+
clientY,
|
|
767
|
+
key: e.key
|
|
768
|
+
};
|
|
769
|
+
}
|
|
770
|
+
function $d27d541f9569d26d$var$getPointClientRect(point) {
|
|
771
|
+
let offsetX = 0;
|
|
772
|
+
let offsetY = 0;
|
|
773
|
+
if (point.width !== void 0) offsetX = point.width / 2;
|
|
774
|
+
else if (point.radiusX !== void 0) offsetX = point.radiusX;
|
|
775
|
+
if (point.height !== void 0) offsetY = point.height / 2;
|
|
776
|
+
else if (point.radiusY !== void 0) offsetY = point.radiusY;
|
|
777
|
+
return {
|
|
778
|
+
top: point.clientY - offsetY,
|
|
779
|
+
right: point.clientX + offsetX,
|
|
780
|
+
bottom: point.clientY + offsetY,
|
|
781
|
+
left: point.clientX - offsetX
|
|
782
|
+
};
|
|
783
|
+
}
|
|
784
|
+
function $d27d541f9569d26d$var$areRectanglesOverlapping(a, b) {
|
|
785
|
+
if (a.left > b.right || b.left > a.right) return false;
|
|
786
|
+
if (a.top > b.bottom || b.top > a.bottom) return false;
|
|
787
|
+
return true;
|
|
788
|
+
}
|
|
789
|
+
function $d27d541f9569d26d$var$isOverTarget(point, target) {
|
|
790
|
+
let rect = target.getBoundingClientRect();
|
|
791
|
+
let pointRect = $d27d541f9569d26d$var$getPointClientRect(point);
|
|
792
|
+
return $d27d541f9569d26d$var$areRectanglesOverlapping(rect, pointRect);
|
|
793
|
+
}
|
|
794
|
+
function $d27d541f9569d26d$var$shouldPreventDefaultUp(target) {
|
|
795
|
+
if (target instanceof HTMLInputElement) return false;
|
|
796
|
+
if (target instanceof HTMLButtonElement) return target.type !== "submit" && target.type !== "reset";
|
|
797
|
+
if ($d27d541f9569d26d$var$isHTMLAnchorLink(target)) return false;
|
|
798
|
+
return true;
|
|
799
|
+
}
|
|
800
|
+
function $d27d541f9569d26d$var$shouldPreventDefaultKeyboard(target, key) {
|
|
801
|
+
if (target instanceof HTMLInputElement) return !$d27d541f9569d26d$var$isValidInputKey(target, key);
|
|
802
|
+
return $d27d541f9569d26d$var$shouldPreventDefaultUp(target);
|
|
803
|
+
}
|
|
804
|
+
const $d27d541f9569d26d$var$nonTextInputTypes = /* @__PURE__ */ new Set([
|
|
805
|
+
"checkbox",
|
|
806
|
+
"radio",
|
|
807
|
+
"range",
|
|
808
|
+
"color",
|
|
809
|
+
"file",
|
|
810
|
+
"image",
|
|
811
|
+
"button",
|
|
812
|
+
"submit",
|
|
813
|
+
"reset"
|
|
814
|
+
]);
|
|
815
|
+
function $d27d541f9569d26d$var$isValidInputKey(target, key) {
|
|
816
|
+
return target.type === "checkbox" || target.type === "radio" ? key === " " : $d27d541f9569d26d$var$nonTextInputTypes.has(target.type);
|
|
817
|
+
}
|
|
818
|
+
export {
|
|
819
|
+
$1dfb119a85e764e5$export$cc77c4ff7e8673c5 as $,
|
|
820
|
+
$d27d541f9569d26d$export$45712eceda6fad21 as a,
|
|
821
|
+
$24f9a20f226ad820$export$5165eccb35aaadb5 as b,
|
|
822
|
+
$2b2d34ff061957fb$export$2b85b721e524d74b as c,
|
|
823
|
+
$cbf007e418543821$export$b0d6fa1ab32e3295 as d,
|
|
824
|
+
$cbf007e418543821$export$16a4697467175487 as e
|
|
825
|
+
};
|