@wix/editor-react-components 1.2345.0 → 1.2347.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/AnimatedIcon/types.d.ts +1 -1
- package/dist/site/components/AudioPlayer/component.js +3 -4
- package/dist/site/components/Breadcrumbs/component.js +1 -1
- package/dist/site/components/Button/component.js +1 -1
- package/dist/site/components/Checkbox/css.css +4 -4
- package/dist/site/components/CheckboxGroup/css.css +4 -4
- package/dist/site/components/CollapsibleText/component.js +1 -1
- package/dist/site/components/DatePicker/DatePicker.types.d.ts +6 -1
- package/dist/site/components/DatePicker/component.js +61 -11
- package/dist/site/components/DatePicker/components/DatePickerLabel.d.ts +2 -1
- package/dist/site/components/DatePicker/constants.d.ts +8 -0
- package/dist/site/components/DatePicker/css.css +13 -0
- package/dist/site/components/DatePicker/hooks/useDatePickerValue.d.ts +1 -1
- package/dist/site/components/DatePicker/manifest.js +12 -1
- package/dist/site/components/Lottie/component.js +1 -1
- package/dist/site/components/Menu/Menu.types.d.ts +1 -33
- package/dist/site/components/Menu/component.js +8 -160
- package/dist/site/components/Menu/constants.d.ts +0 -18
- package/dist/site/components/Menu/css.css +21 -34
- package/dist/site/components/Menu/manifest.js +4 -68
- package/dist/site/components/Menu/manifestConfigs/itemConfig.d.ts +1 -4
- package/dist/site/components/Menu/manifestConfigs/overrides/horizontalHugNavbarConfig.d.ts +0 -2
- package/dist/site/components/Menu/manifestConfigs/overrides/horizontalScrollNavbarConfig.d.ts +0 -2
- package/dist/site/components/Menu/manifestConfigs/overrides/verticalNavbarConfig.d.ts +1 -3
- package/dist/site/components/Slideshow/component.js +1 -1
- package/dist/site/components/TextInput/TextInput.types.d.ts +3 -1
- package/dist/site/components/TextInput/component.js +86 -19
- package/dist/site/components/TextInput/constants.d.ts +13 -0
- package/dist/site/components/TextInput/css.css +47 -4
- package/dist/site/components/TextInput/manifest.js +8 -1
- package/dist/site/components/TimePicker/TimePicker.types.d.ts +7 -1
- package/dist/site/components/TimePicker/component.js +61 -11
- package/dist/site/components/TimePicker/constants.d.ts +7 -0
- package/dist/site/components/TimePicker/css.css +13 -0
- package/dist/site/components/TimePicker/hooks/useTimePickerValue.d.ts +1 -1
- package/dist/site/components/TimePicker/manifest.js +8 -1
- package/dist/site/components/chunks/Button.js +347 -1057
- package/dist/site/components/chunks/{Tooltip.js → DateField.js} +52 -1018
- package/dist/site/components/chunks/Group.js +970 -46
- package/dist/site/components/chunks/NumberFormatter.js +140 -0
- package/dist/site/components/chunks/VisuallyHidden.js +1 -1
- package/dist/site/components/chunks/constants2.js +9 -2
- package/dist/site/components/chunks/constants26.js +4 -23
- package/dist/site/components/chunks/constants3.js +10 -1
- package/dist/site/components/chunks/constants33.js +10 -2
- package/dist/site/components/chunks/filterDOMProps.js +139 -18
- package/dist/site/components/chunks/manifest2.js +73 -0
- package/dist/site/components/chunks/useLocalizedStringFormatter.js +1 -1
- package/dist/site/components/chunks/useValidatedField.js +1411 -0
- package/package.json +2 -2
- package/dist/site/components/Menu/components/MenuContent/MenuItem/useIconAnimation.d.ts +0 -17
- package/dist/site/components/Menu/manifestConfigs/animatedIconConfig.d.ts +0 -2
- package/dist/site/components/chunks/Button2.js +0 -365
- package/dist/site/components/chunks/I18nProvider.js +0 -125
- package/dist/site/components/chunks/Input.js +0 -341
|
@@ -1,1075 +1,365 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef, useRef, useCallback, useState, useEffect, useMemo } from "react";
|
|
3
|
+
import { c as clsx } from "./clsx.js";
|
|
4
|
+
import { d as directionStyles } from "./direction.module.js";
|
|
5
|
+
import { p as presetWrapperStyles } from "./presetWrapper.module.js";
|
|
6
|
+
import { a as getDataAttributes, g as getQaDataAttributes } from "./dataUtils.js";
|
|
7
|
+
import { f as formatClassNames } from "./classNames.js";
|
|
8
|
+
import { I as IconAnimationTriggers } from "./Button.types.js";
|
|
9
|
+
import AnimatedIconWithReducedMotion from "../AnimatedIcon/component.js";
|
|
10
|
+
import { T as TRANSITION_DURATION, S as SEMANTIC_CLASS_NAMES, a as TestIds } from "./constants20.js";
|
|
11
|
+
import { d as activateByEnterButton, a as activateBySpaceOrEnterButton, r as removeAriaPrefix, g as getAccessibilityAttributesSpread } from "./a11y.js";
|
|
12
|
+
import { i as isValidLink } from "./Link.js";
|
|
13
|
+
const root = "root__IB9QF";
|
|
14
|
+
const active = "active__lpoVO";
|
|
15
|
+
const label = "label__EtLji";
|
|
16
|
+
const link = "link__0rDnC";
|
|
17
|
+
const icon = "icon__ZzsS5";
|
|
18
|
+
const button = "button__i8gkO";
|
|
19
|
+
const styles = {
|
|
20
|
+
root,
|
|
21
|
+
active,
|
|
22
|
+
label,
|
|
23
|
+
link,
|
|
24
|
+
icon,
|
|
25
|
+
button
|
|
3
26
|
};
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const $319e236875307eab$var$LIVEREGION_TIMEOUT_DELAY = 7e3;
|
|
14
|
-
let $319e236875307eab$var$liveAnnouncer = null;
|
|
15
|
-
function $319e236875307eab$export$a9b970dcc4ae71a9(message, assertiveness = "assertive", timeout = $319e236875307eab$var$LIVEREGION_TIMEOUT_DELAY) {
|
|
16
|
-
if (!$319e236875307eab$var$liveAnnouncer) {
|
|
17
|
-
$319e236875307eab$var$liveAnnouncer = new $319e236875307eab$var$LiveAnnouncer();
|
|
18
|
-
if (!(typeof IS_REACT_ACT_ENVIRONMENT === "boolean" ? IS_REACT_ACT_ENVIRONMENT : typeof jest !== "undefined")) setTimeout(() => {
|
|
19
|
-
if ($319e236875307eab$var$liveAnnouncer === null || $319e236875307eab$var$liveAnnouncer === void 0 ? void 0 : $319e236875307eab$var$liveAnnouncer.isAttached()) $319e236875307eab$var$liveAnnouncer === null || $319e236875307eab$var$liveAnnouncer === void 0 ? void 0 : $319e236875307eab$var$liveAnnouncer.announce(message, assertiveness, timeout);
|
|
20
|
-
}, 100);
|
|
21
|
-
else $319e236875307eab$var$liveAnnouncer.announce(message, assertiveness, timeout);
|
|
22
|
-
} else $319e236875307eab$var$liveAnnouncer.announce(message, assertiveness, timeout);
|
|
23
|
-
}
|
|
24
|
-
class $319e236875307eab$var$LiveAnnouncer {
|
|
25
|
-
isAttached() {
|
|
26
|
-
var _this_node;
|
|
27
|
-
return (_this_node = this.node) === null || _this_node === void 0 ? void 0 : _this_node.isConnected;
|
|
28
|
-
}
|
|
29
|
-
createLog(ariaLive) {
|
|
30
|
-
let node = document.createElement("div");
|
|
31
|
-
node.setAttribute("role", "log");
|
|
32
|
-
node.setAttribute("aria-live", ariaLive);
|
|
33
|
-
node.setAttribute("aria-relevant", "additions");
|
|
34
|
-
return node;
|
|
35
|
-
}
|
|
36
|
-
destroy() {
|
|
37
|
-
if (!this.node) return;
|
|
38
|
-
document.body.removeChild(this.node);
|
|
39
|
-
this.node = null;
|
|
40
|
-
}
|
|
41
|
-
announce(message, assertiveness = "assertive", timeout = $319e236875307eab$var$LIVEREGION_TIMEOUT_DELAY) {
|
|
42
|
-
var _this_assertiveLog, _this_politeLog;
|
|
43
|
-
if (!this.node) return;
|
|
44
|
-
let node = document.createElement("div");
|
|
45
|
-
if (typeof message === "object") {
|
|
46
|
-
node.setAttribute("role", "img");
|
|
47
|
-
node.setAttribute("aria-labelledby", message["aria-labelledby"]);
|
|
48
|
-
} else node.textContent = message;
|
|
49
|
-
if (assertiveness === "assertive") (_this_assertiveLog = this.assertiveLog) === null || _this_assertiveLog === void 0 ? void 0 : _this_assertiveLog.appendChild(node);
|
|
50
|
-
else (_this_politeLog = this.politeLog) === null || _this_politeLog === void 0 ? void 0 : _this_politeLog.appendChild(node);
|
|
51
|
-
if (message !== "") setTimeout(() => {
|
|
52
|
-
node.remove();
|
|
53
|
-
}, timeout);
|
|
54
|
-
}
|
|
55
|
-
clear(assertiveness) {
|
|
56
|
-
if (!this.node) return;
|
|
57
|
-
if ((!assertiveness || assertiveness === "assertive") && this.assertiveLog) this.assertiveLog.innerHTML = "";
|
|
58
|
-
if ((!assertiveness || assertiveness === "polite") && this.politeLog) this.politeLog.innerHTML = "";
|
|
59
|
-
}
|
|
60
|
-
constructor() {
|
|
61
|
-
this.node = null;
|
|
62
|
-
this.assertiveLog = null;
|
|
63
|
-
this.politeLog = null;
|
|
64
|
-
if (typeof document !== "undefined") {
|
|
65
|
-
this.node = document.createElement("div");
|
|
66
|
-
this.node.dataset.liveAnnouncer = "true";
|
|
67
|
-
Object.assign(this.node.style, {
|
|
68
|
-
border: 0,
|
|
69
|
-
clip: "rect(0 0 0 0)",
|
|
70
|
-
clipPath: "inset(50%)",
|
|
71
|
-
height: "1px",
|
|
72
|
-
margin: "-1px",
|
|
73
|
-
overflow: "hidden",
|
|
74
|
-
padding: 0,
|
|
75
|
-
position: "absolute",
|
|
76
|
-
width: "1px",
|
|
77
|
-
whiteSpace: "nowrap"
|
|
78
|
-
});
|
|
79
|
-
this.assertiveLog = this.createLog("assertive");
|
|
80
|
-
this.node.appendChild(this.assertiveLog);
|
|
81
|
-
this.politeLog = this.createLog("polite");
|
|
82
|
-
this.node.appendChild(this.politeLog);
|
|
83
|
-
document.body.prepend(this.node);
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
let $1dfb119a85e764e5$var$formatterCache = /* @__PURE__ */ new Map();
|
|
88
|
-
let $1dfb119a85e764e5$var$supportsSignDisplay = false;
|
|
89
|
-
try {
|
|
90
|
-
$1dfb119a85e764e5$var$supportsSignDisplay = new Intl.NumberFormat("de-DE", {
|
|
91
|
-
signDisplay: "exceptZero"
|
|
92
|
-
}).resolvedOptions().signDisplay === "exceptZero";
|
|
93
|
-
} catch {
|
|
94
|
-
}
|
|
95
|
-
let $1dfb119a85e764e5$var$supportsUnit = false;
|
|
96
|
-
try {
|
|
97
|
-
$1dfb119a85e764e5$var$supportsUnit = new Intl.NumberFormat("de-DE", {
|
|
98
|
-
style: "unit",
|
|
99
|
-
unit: "degree"
|
|
100
|
-
}).resolvedOptions().style === "unit";
|
|
101
|
-
} catch {
|
|
102
|
-
}
|
|
103
|
-
const $1dfb119a85e764e5$var$UNITS = {
|
|
104
|
-
degree: {
|
|
105
|
-
narrow: {
|
|
106
|
-
default: "°",
|
|
107
|
-
"ja-JP": " 度",
|
|
108
|
-
"zh-TW": "度",
|
|
109
|
-
"sl-SI": " °"
|
|
27
|
+
const AnimatedButtonIcon = forwardRef(
|
|
28
|
+
({ svg, duration }, ref) => /* @__PURE__ */ jsx(
|
|
29
|
+
AnimatedIconWithReducedMotion,
|
|
30
|
+
{
|
|
31
|
+
id: "animated-icon",
|
|
32
|
+
duration,
|
|
33
|
+
svg,
|
|
34
|
+
className: clsx("animated-icon", styles.icon),
|
|
35
|
+
ref
|
|
110
36
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
this.options = options;
|
|
117
|
-
}
|
|
118
|
-
/** Formats a number value as a string, according to the locale and options provided to the constructor. */
|
|
119
|
-
format(value) {
|
|
37
|
+
)
|
|
38
|
+
);
|
|
39
|
+
function useIconAnimation(isDisabled) {
|
|
40
|
+
const iconAnimatedRef = useRef(null);
|
|
41
|
+
const onAnimationForward = useCallback(() => {
|
|
120
42
|
var _a;
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
...startParts.map((p) => ({
|
|
150
|
-
...p,
|
|
151
|
-
source: "startRange"
|
|
152
|
-
})),
|
|
153
|
-
{
|
|
154
|
-
type: "literal",
|
|
155
|
-
value: " – ",
|
|
156
|
-
source: "shared"
|
|
157
|
-
},
|
|
158
|
-
...endParts.map((p) => ({
|
|
159
|
-
...p,
|
|
160
|
-
source: "endRange"
|
|
161
|
-
}))
|
|
162
|
-
];
|
|
163
|
-
}
|
|
164
|
-
/** Returns the resolved formatting options based on the values passed to the constructor. */
|
|
165
|
-
resolvedOptions() {
|
|
166
|
-
let options = this.numberFormatter.resolvedOptions();
|
|
167
|
-
if (!$1dfb119a85e764e5$var$supportsSignDisplay && this.options.signDisplay != null) options = {
|
|
168
|
-
...options,
|
|
169
|
-
signDisplay: this.options.signDisplay
|
|
170
|
-
};
|
|
171
|
-
if (!$1dfb119a85e764e5$var$supportsUnit && this.options.style === "unit") options = {
|
|
172
|
-
...options,
|
|
173
|
-
style: "unit",
|
|
174
|
-
unit: this.options.unit,
|
|
175
|
-
unitDisplay: this.options.unitDisplay
|
|
176
|
-
};
|
|
177
|
-
return options;
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
function $1dfb119a85e764e5$var$getCachedNumberFormatter(locale, options = {}) {
|
|
181
|
-
var _a;
|
|
182
|
-
let { numberingSystem } = options;
|
|
183
|
-
if (numberingSystem && locale.includes("-nu-")) {
|
|
184
|
-
if (!locale.includes("-u-")) locale += "-u-";
|
|
185
|
-
locale += `-nu-${numberingSystem}`;
|
|
186
|
-
}
|
|
187
|
-
if (options.style === "unit" && !$1dfb119a85e764e5$var$supportsUnit) {
|
|
188
|
-
let { unit, unitDisplay = "short" } = options;
|
|
189
|
-
if (!unit) throw new Error('unit option must be provided with style: "unit"');
|
|
190
|
-
if (!((_a = $1dfb119a85e764e5$var$UNITS[unit]) == null ? void 0 : _a[unitDisplay])) throw new Error(`Unsupported unit ${unit} with unitDisplay = ${unitDisplay}`);
|
|
191
|
-
options = {
|
|
192
|
-
...options,
|
|
193
|
-
style: "decimal"
|
|
43
|
+
!isDisabled && ((_a = iconAnimatedRef.current) == null ? void 0 : _a.runAnimationForward());
|
|
44
|
+
}, [isDisabled]);
|
|
45
|
+
const onAnimationBackward = useCallback(() => {
|
|
46
|
+
var _a;
|
|
47
|
+
!isDisabled && ((_a = iconAnimatedRef.current) == null ? void 0 : _a.runAnimationBackward());
|
|
48
|
+
}, [isDisabled]);
|
|
49
|
+
return { iconAnimatedRef, onAnimationForward, onAnimationBackward };
|
|
50
|
+
}
|
|
51
|
+
function useButtonInteractionState(iconAnimationTriggers, onAnimationForward, onAnimationBackward, propsOnMouseEnter, propsOnMouseLeave) {
|
|
52
|
+
const [active2, setActive] = useState(false);
|
|
53
|
+
const animationTimeoutRef = useRef(
|
|
54
|
+
null
|
|
55
|
+
);
|
|
56
|
+
const isForwardRef = useRef(false);
|
|
57
|
+
const hasHoverTrigger = iconAnimationTriggers.includes(
|
|
58
|
+
IconAnimationTriggers.HOVER
|
|
59
|
+
);
|
|
60
|
+
const hasClickTrigger = iconAnimationTriggers.includes(
|
|
61
|
+
IconAnimationTriggers.CLICK
|
|
62
|
+
);
|
|
63
|
+
useEffect(() => {
|
|
64
|
+
isForwardRef.current = false;
|
|
65
|
+
}, [hasClickTrigger, hasHoverTrigger]);
|
|
66
|
+
useEffect(() => {
|
|
67
|
+
return () => {
|
|
68
|
+
if (animationTimeoutRef.current) {
|
|
69
|
+
clearTimeout(animationTimeoutRef.current);
|
|
70
|
+
}
|
|
194
71
|
};
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
}
|
|
202
|
-
function $1dfb119a85e764e5$export$711b50b3c525e0f2(numberFormat, signDisplay, num) {
|
|
203
|
-
if (signDisplay === "auto") return numberFormat.format(num);
|
|
204
|
-
else if (signDisplay === "never") return numberFormat.format(Math.abs(num));
|
|
205
|
-
else {
|
|
206
|
-
let needsPositiveSign = false;
|
|
207
|
-
if (signDisplay === "always") needsPositiveSign = num > 0 || Object.is(num, 0);
|
|
208
|
-
else if (signDisplay === "exceptZero") {
|
|
209
|
-
if (Object.is(num, -0) || Object.is(num, 0)) num = Math.abs(num);
|
|
210
|
-
else needsPositiveSign = num > 0;
|
|
211
|
-
}
|
|
212
|
-
if (needsPositiveSign) {
|
|
213
|
-
let negative = numberFormat.format(-num);
|
|
214
|
-
let noSign = numberFormat.format(num);
|
|
215
|
-
let minus = negative.replace(noSign, "").replace(/\u200e|\u061C/, "");
|
|
216
|
-
if ([
|
|
217
|
-
...minus
|
|
218
|
-
].length !== 1) console.warn("@react-aria/i18n polyfill for NumberFormat signDisplay: Unsupported case");
|
|
219
|
-
let positive = negative.replace(noSign, "!!!").replace(minus, "+").replace("!!!", noSign);
|
|
220
|
-
return positive;
|
|
221
|
-
} else return numberFormat.format(num);
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
let $cbf007e418543821$var$state = "default";
|
|
225
|
-
let $cbf007e418543821$var$savedUserSelect = "";
|
|
226
|
-
let $cbf007e418543821$var$modifiedElementMap = /* @__PURE__ */ new WeakMap();
|
|
227
|
-
function $cbf007e418543821$export$16a4697467175487(target) {
|
|
228
|
-
if ($2add3ce32c6007eb$export$fedb369cb70207f1()) {
|
|
229
|
-
if ($cbf007e418543821$var$state === "default") {
|
|
230
|
-
const documentObject = $d447af545b77c9f1$export$b204af158042fbac(target);
|
|
231
|
-
$cbf007e418543821$var$savedUserSelect = documentObject.documentElement.style.webkitUserSelect;
|
|
232
|
-
documentObject.documentElement.style.webkitUserSelect = "none";
|
|
233
|
-
}
|
|
234
|
-
$cbf007e418543821$var$state = "disabled";
|
|
235
|
-
} else if (target instanceof HTMLElement || target instanceof SVGElement) {
|
|
236
|
-
let property = "userSelect" in target.style ? "userSelect" : "webkitUserSelect";
|
|
237
|
-
$cbf007e418543821$var$modifiedElementMap.set(target, target.style[property]);
|
|
238
|
-
target.style[property] = "none";
|
|
239
|
-
}
|
|
240
|
-
}
|
|
241
|
-
function $cbf007e418543821$export$b0d6fa1ab32e3295(target) {
|
|
242
|
-
if ($2add3ce32c6007eb$export$fedb369cb70207f1()) {
|
|
243
|
-
if ($cbf007e418543821$var$state !== "disabled") return;
|
|
244
|
-
$cbf007e418543821$var$state = "restoring";
|
|
245
|
-
setTimeout(() => {
|
|
246
|
-
$081cb5757e08788e$export$24490316f764c430(() => {
|
|
247
|
-
if ($cbf007e418543821$var$state === "restoring") {
|
|
248
|
-
const documentObject = $d447af545b77c9f1$export$b204af158042fbac(target);
|
|
249
|
-
if (documentObject.documentElement.style.webkitUserSelect === "none") documentObject.documentElement.style.webkitUserSelect = $cbf007e418543821$var$savedUserSelect || "";
|
|
250
|
-
$cbf007e418543821$var$savedUserSelect = "";
|
|
251
|
-
$cbf007e418543821$var$state = "default";
|
|
252
|
-
}
|
|
253
|
-
});
|
|
254
|
-
}, 300);
|
|
255
|
-
} else if (target instanceof HTMLElement || target instanceof SVGElement) {
|
|
256
|
-
if (target && $cbf007e418543821$var$modifiedElementMap.has(target)) {
|
|
257
|
-
let targetOldUserSelect = $cbf007e418543821$var$modifiedElementMap.get(target);
|
|
258
|
-
let property = "userSelect" in target.style ? "userSelect" : "webkitUserSelect";
|
|
259
|
-
if (target.style[property] === "none") target.style[property] = targetOldUserSelect;
|
|
260
|
-
if (target.getAttribute("style") === "") target.removeAttribute("style");
|
|
261
|
-
$cbf007e418543821$var$modifiedElementMap.delete(target);
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
function $2b2d34ff061957fb$var$getWebpackNonce(doc) {
|
|
266
|
-
let ownerWindow = doc == null ? void 0 : doc.defaultView;
|
|
267
|
-
return (ownerWindow == null ? void 0 : ownerWindow.__webpack_nonce__) || globalThis["__webpack_nonce__"] || void 0;
|
|
268
|
-
}
|
|
269
|
-
let $2b2d34ff061957fb$var$nonceCache = /* @__PURE__ */ new WeakMap();
|
|
270
|
-
function $2b2d34ff061957fb$export$2b85b721e524d74b(doc) {
|
|
271
|
-
let d = doc ?? (typeof document !== "undefined" ? document : void 0);
|
|
272
|
-
if (!d) return $2b2d34ff061957fb$var$getWebpackNonce(d);
|
|
273
|
-
if ($2b2d34ff061957fb$var$nonceCache.has(d)) return $2b2d34ff061957fb$var$nonceCache.get(d);
|
|
274
|
-
let meta = d.querySelector('meta[property="csp-nonce"]');
|
|
275
|
-
let nonce = meta && meta instanceof $d447af545b77c9f1$export$f21a1ffae260145a(meta).HTMLMetaElement && (meta.nonce || meta.content) || $2b2d34ff061957fb$var$getWebpackNonce(d) || void 0;
|
|
276
|
-
if (nonce !== void 0) $2b2d34ff061957fb$var$nonceCache.set(d, nonce);
|
|
277
|
-
return nonce;
|
|
278
|
-
}
|
|
279
|
-
const $24f9a20f226ad820$export$5165eccb35aaadb5 = React__default.createContext({
|
|
280
|
-
register: () => {
|
|
281
|
-
}
|
|
282
|
-
});
|
|
283
|
-
$24f9a20f226ad820$export$5165eccb35aaadb5.displayName = "PressResponderContext";
|
|
284
|
-
function $d27d541f9569d26d$var$usePressResponderContext(props) {
|
|
285
|
-
let context = useContext($24f9a20f226ad820$export$5165eccb35aaadb5);
|
|
286
|
-
if (context) {
|
|
287
|
-
let { register, ref, ...contextProps } = context;
|
|
288
|
-
props = $bbaa08b3cd72f041$export$9d1611c77c2fe928(contextProps, props);
|
|
289
|
-
register();
|
|
290
|
-
}
|
|
291
|
-
$b7115c395c64f7b5$export$4debdb1a3f0fa79e(context, props.ref);
|
|
292
|
-
return props;
|
|
293
|
-
}
|
|
294
|
-
class $d27d541f9569d26d$var$PressEvent {
|
|
295
|
-
constructor(type, pointerType, originalEvent, state) {
|
|
296
|
-
__privateAdd(this, _shouldStopPropagation);
|
|
297
|
-
__privateSet(this, _shouldStopPropagation, true);
|
|
298
|
-
let currentTarget = (state == null ? void 0 : state.target) ?? originalEvent.currentTarget;
|
|
299
|
-
const rect = currentTarget == null ? void 0 : currentTarget.getBoundingClientRect();
|
|
300
|
-
let x, y = 0;
|
|
301
|
-
let clientX, clientY = null;
|
|
302
|
-
if (originalEvent.clientX != null && originalEvent.clientY != null) {
|
|
303
|
-
clientX = originalEvent.clientX;
|
|
304
|
-
clientY = originalEvent.clientY;
|
|
305
|
-
}
|
|
306
|
-
if (rect) {
|
|
307
|
-
if (clientX != null && clientY != null) {
|
|
308
|
-
x = clientX - rect.left;
|
|
309
|
-
y = clientY - rect.top;
|
|
310
|
-
} else {
|
|
311
|
-
x = rect.width / 2;
|
|
312
|
-
y = rect.height / 2;
|
|
72
|
+
}, []);
|
|
73
|
+
const onMouseEnter = useCallback(
|
|
74
|
+
(event) => {
|
|
75
|
+
if (animationTimeoutRef.current) {
|
|
76
|
+
clearTimeout(animationTimeoutRef.current);
|
|
77
|
+
animationTimeoutRef.current = null;
|
|
313
78
|
}
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
this.target = originalEvent.currentTarget;
|
|
318
|
-
this.shiftKey = originalEvent.shiftKey;
|
|
319
|
-
this.metaKey = originalEvent.metaKey;
|
|
320
|
-
this.ctrlKey = originalEvent.ctrlKey;
|
|
321
|
-
this.altKey = originalEvent.altKey;
|
|
322
|
-
this.x = x;
|
|
323
|
-
this.y = y;
|
|
324
|
-
this.key = originalEvent.key;
|
|
325
|
-
}
|
|
326
|
-
continuePropagation() {
|
|
327
|
-
__privateSet(this, _shouldStopPropagation, false);
|
|
328
|
-
}
|
|
329
|
-
get shouldStopPropagation() {
|
|
330
|
-
return __privateGet(this, _shouldStopPropagation);
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
_shouldStopPropagation = new WeakMap();
|
|
334
|
-
const $d27d541f9569d26d$var$LINK_CLICKED = Symbol("linkClicked");
|
|
335
|
-
const $d27d541f9569d26d$var$STYLE_ID = "react-aria-pressable-style";
|
|
336
|
-
const $d27d541f9569d26d$var$PRESSABLE_ATTRIBUTE = "data-react-aria-pressable";
|
|
337
|
-
function $d27d541f9569d26d$export$45712eceda6fad21(props) {
|
|
338
|
-
let { onPress, onPressChange, onPressStart, onPressEnd, onPressUp, onClick, isDisabled, isPressed: isPressedProp, preventFocusOnPress, shouldCancelOnPointerExit, allowTextSelectionOnPress, ref: domRef, ...domProps } = $d27d541f9569d26d$var$usePressResponderContext(props);
|
|
339
|
-
let [isPressed, setPressed] = useState(false);
|
|
340
|
-
let ref = useRef({
|
|
341
|
-
isPressed: false,
|
|
342
|
-
ignoreEmulatedMouseEvents: false,
|
|
343
|
-
didFirePressStart: false,
|
|
344
|
-
isTriggeringEvent: false,
|
|
345
|
-
activePointerId: null,
|
|
346
|
-
target: null,
|
|
347
|
-
isOverTarget: false,
|
|
348
|
-
pointerType: null,
|
|
349
|
-
disposables: []
|
|
350
|
-
});
|
|
351
|
-
let { addGlobalListener, removeAllGlobalListeners } = $48a7d519b337145d$export$4eaf04e54aa8eed6();
|
|
352
|
-
let triggerPressStart = useCallback((originalEvent, pointerType) => {
|
|
353
|
-
let state = ref.current;
|
|
354
|
-
if (isDisabled || state.didFirePressStart) return false;
|
|
355
|
-
let shouldStopPropagation = true;
|
|
356
|
-
state.isTriggeringEvent = true;
|
|
357
|
-
if (onPressStart) {
|
|
358
|
-
let event = new $d27d541f9569d26d$var$PressEvent("pressstart", pointerType, originalEvent);
|
|
359
|
-
onPressStart(event);
|
|
360
|
-
shouldStopPropagation = event.shouldStopPropagation;
|
|
361
|
-
}
|
|
362
|
-
if (onPressChange) onPressChange(true);
|
|
363
|
-
state.isTriggeringEvent = false;
|
|
364
|
-
state.didFirePressStart = true;
|
|
365
|
-
setPressed(true);
|
|
366
|
-
return shouldStopPropagation;
|
|
367
|
-
}, [
|
|
368
|
-
isDisabled,
|
|
369
|
-
onPressStart,
|
|
370
|
-
onPressChange
|
|
371
|
-
]);
|
|
372
|
-
let triggerPressEnd = useCallback((originalEvent, pointerType, wasPressed = true) => {
|
|
373
|
-
let state = ref.current;
|
|
374
|
-
if (!state.didFirePressStart) return false;
|
|
375
|
-
state.didFirePressStart = false;
|
|
376
|
-
state.isTriggeringEvent = true;
|
|
377
|
-
let shouldStopPropagation = true;
|
|
378
|
-
if (onPressEnd) {
|
|
379
|
-
let event = new $d27d541f9569d26d$var$PressEvent("pressend", pointerType, originalEvent);
|
|
380
|
-
onPressEnd(event);
|
|
381
|
-
shouldStopPropagation = event.shouldStopPropagation;
|
|
382
|
-
}
|
|
383
|
-
if (onPressChange) onPressChange(false);
|
|
384
|
-
setPressed(false);
|
|
385
|
-
if (onPress && wasPressed && !isDisabled) {
|
|
386
|
-
let event = new $d27d541f9569d26d$var$PressEvent("press", pointerType, originalEvent);
|
|
387
|
-
onPress(event);
|
|
388
|
-
shouldStopPropagation && (shouldStopPropagation = event.shouldStopPropagation);
|
|
389
|
-
}
|
|
390
|
-
state.isTriggeringEvent = false;
|
|
391
|
-
return shouldStopPropagation;
|
|
392
|
-
}, [
|
|
393
|
-
isDisabled,
|
|
394
|
-
onPressEnd,
|
|
395
|
-
onPressChange,
|
|
396
|
-
onPress
|
|
397
|
-
]);
|
|
398
|
-
let triggerPressEndEvent = $fe16bffc7a557bf0$export$7f54fc3180508a52(triggerPressEnd);
|
|
399
|
-
let triggerPressUp = useCallback((originalEvent, pointerType) => {
|
|
400
|
-
let state = ref.current;
|
|
401
|
-
if (isDisabled) return false;
|
|
402
|
-
if (onPressUp) {
|
|
403
|
-
state.isTriggeringEvent = true;
|
|
404
|
-
let event = new $d27d541f9569d26d$var$PressEvent("pressup", pointerType, originalEvent);
|
|
405
|
-
onPressUp(event);
|
|
406
|
-
state.isTriggeringEvent = false;
|
|
407
|
-
return event.shouldStopPropagation;
|
|
408
|
-
}
|
|
409
|
-
return true;
|
|
410
|
-
}, [
|
|
411
|
-
isDisabled,
|
|
412
|
-
onPressUp
|
|
413
|
-
]);
|
|
414
|
-
let triggerPressUpEvent = $fe16bffc7a557bf0$export$7f54fc3180508a52(triggerPressUp);
|
|
415
|
-
let cancel = useCallback((e) => {
|
|
416
|
-
let state = ref.current;
|
|
417
|
-
if (state.isPressed && state.target) {
|
|
418
|
-
if (state.didFirePressStart && state.pointerType != null) triggerPressEnd($d27d541f9569d26d$var$createEvent(state.target, e), state.pointerType, false);
|
|
419
|
-
state.isPressed = false;
|
|
420
|
-
state.isOverTarget = false;
|
|
421
|
-
state.activePointerId = null;
|
|
422
|
-
state.pointerType = null;
|
|
423
|
-
removeAllGlobalListeners();
|
|
424
|
-
if (!allowTextSelectionOnPress) $cbf007e418543821$export$b0d6fa1ab32e3295(state.target);
|
|
425
|
-
for (let dispose of state.disposables) dispose();
|
|
426
|
-
state.disposables = [];
|
|
427
|
-
}
|
|
428
|
-
}, [
|
|
429
|
-
allowTextSelectionOnPress,
|
|
430
|
-
removeAllGlobalListeners,
|
|
431
|
-
triggerPressEnd
|
|
432
|
-
]);
|
|
433
|
-
let cancelEvent = $fe16bffc7a557bf0$export$7f54fc3180508a52(cancel);
|
|
434
|
-
let cancelOnPointerExit = useCallback((e) => {
|
|
435
|
-
if (shouldCancelOnPointerExit) cancel(e);
|
|
436
|
-
}, [
|
|
437
|
-
shouldCancelOnPointerExit,
|
|
438
|
-
cancel
|
|
439
|
-
]);
|
|
440
|
-
let triggerClick = useCallback((e) => {
|
|
441
|
-
if (isDisabled) return;
|
|
442
|
-
onClick == null ? void 0 : onClick(e);
|
|
443
|
-
}, [
|
|
444
|
-
isDisabled,
|
|
445
|
-
onClick
|
|
446
|
-
]);
|
|
447
|
-
let triggerSyntheticClick = useCallback((e, target) => {
|
|
448
|
-
if (isDisabled) return;
|
|
449
|
-
if (onClick) {
|
|
450
|
-
let event = new MouseEvent("click", e);
|
|
451
|
-
$a92dc41f639950be$export$c2b7abe5d61ec696(event, target);
|
|
452
|
-
onClick($a92dc41f639950be$export$525bc4921d56d4a(event));
|
|
453
|
-
}
|
|
454
|
-
}, [
|
|
455
|
-
isDisabled,
|
|
456
|
-
onClick
|
|
457
|
-
]);
|
|
458
|
-
let pressProps = useMemo(() => {
|
|
459
|
-
let state = ref.current;
|
|
460
|
-
let pressProps2 = {
|
|
461
|
-
onKeyDown(e) {
|
|
462
|
-
var _a;
|
|
463
|
-
if ($d27d541f9569d26d$var$isValidKeyboardEvent(e.nativeEvent, e.currentTarget) && $23f2114a1b82827e$export$4282f70798064fe0(e.currentTarget, $23f2114a1b82827e$export$e58f029f0fbfdb29(e))) {
|
|
464
|
-
if ($d27d541f9569d26d$var$shouldPreventDefaultKeyboard($23f2114a1b82827e$export$e58f029f0fbfdb29(e), e.key)) e.preventDefault();
|
|
465
|
-
let shouldStopPropagation = true;
|
|
466
|
-
if (!state.isPressed && !e.repeat) {
|
|
467
|
-
state.target = e.currentTarget;
|
|
468
|
-
state.isPressed = true;
|
|
469
|
-
state.pointerType = "keyboard";
|
|
470
|
-
shouldStopPropagation = triggerPressStart(e, "keyboard");
|
|
471
|
-
}
|
|
472
|
-
let originalTarget = e.currentTarget;
|
|
473
|
-
let pressUp = (e2) => {
|
|
474
|
-
if ($d27d541f9569d26d$var$isValidKeyboardEvent(e2, originalTarget) && !e2.repeat && $23f2114a1b82827e$export$4282f70798064fe0(originalTarget, $23f2114a1b82827e$export$e58f029f0fbfdb29(e2)) && state.target)
|
|
475
|
-
triggerPressUpEvent($d27d541f9569d26d$var$createEvent(state.target, e2), "keyboard");
|
|
476
|
-
};
|
|
477
|
-
addGlobalListener($d447af545b77c9f1$export$b204af158042fbac(e.currentTarget), "keyup", $a4e76a5424781910$export$e08e3b67e392101e(pressUp, onKeyUp), true);
|
|
478
|
-
if (shouldStopPropagation) e.stopPropagation();
|
|
479
|
-
if (e.metaKey && $2add3ce32c6007eb$export$9ac100e40613ea10()) (_a = state.metaKeyEvents) == null ? void 0 : _a.set(e.key, e.nativeEvent);
|
|
480
|
-
} else if (e.key === "Meta") state.metaKeyEvents = /* @__PURE__ */ new Map();
|
|
481
|
-
},
|
|
482
|
-
onClick(e) {
|
|
483
|
-
if (e && !$23f2114a1b82827e$export$4282f70798064fe0(e.currentTarget, $23f2114a1b82827e$export$e58f029f0fbfdb29(e))) return;
|
|
484
|
-
if (e && e.button === 0 && !state.isTriggeringEvent && !$caaf0dd3060ed57c$export$95185d699e05d4d7.isOpening) {
|
|
485
|
-
let shouldStopPropagation = true;
|
|
486
|
-
if (isDisabled) e.preventDefault();
|
|
487
|
-
if (!state.ignoreEmulatedMouseEvents && !state.isPressed && (state.pointerType === "virtual" || $b5c62b033c25b96d$export$60278871457622de(e.nativeEvent))) {
|
|
488
|
-
let stopPressStart = triggerPressStart(e, "virtual");
|
|
489
|
-
let stopPressUp = triggerPressUpEvent(e, "virtual");
|
|
490
|
-
let stopPressEnd = triggerPressEndEvent(e, "virtual");
|
|
491
|
-
triggerClick(e);
|
|
492
|
-
shouldStopPropagation = stopPressStart && stopPressUp && stopPressEnd;
|
|
493
|
-
} else if (state.isPressed && state.pointerType !== "keyboard") {
|
|
494
|
-
let pointerType = state.pointerType || e.nativeEvent.pointerType || "virtual";
|
|
495
|
-
let stopPressUp = triggerPressUpEvent($d27d541f9569d26d$var$createEvent(e.currentTarget, e), pointerType);
|
|
496
|
-
let stopPressEnd = triggerPressEndEvent($d27d541f9569d26d$var$createEvent(e.currentTarget, e), pointerType, true);
|
|
497
|
-
shouldStopPropagation = stopPressUp && stopPressEnd;
|
|
498
|
-
state.isOverTarget = false;
|
|
499
|
-
triggerClick(e);
|
|
500
|
-
cancelEvent(e);
|
|
501
|
-
}
|
|
502
|
-
state.ignoreEmulatedMouseEvents = false;
|
|
503
|
-
if (shouldStopPropagation) e.stopPropagation();
|
|
504
|
-
}
|
|
79
|
+
setActive(true);
|
|
80
|
+
if (hasHoverTrigger) {
|
|
81
|
+
onAnimationForward();
|
|
505
82
|
}
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
e[$d27d541f9569d26d$var$LINK_CLICKED] = true;
|
|
518
|
-
$caaf0dd3060ed57c$export$95185d699e05d4d7(state.target, e, false);
|
|
519
|
-
}
|
|
520
|
-
state.isPressed = false;
|
|
521
|
-
(_a = state.metaKeyEvents) == null ? void 0 : _a.delete(e.key);
|
|
522
|
-
} else if (e.key === "Meta" && ((_b = state.metaKeyEvents) == null ? void 0 : _b.size)) {
|
|
523
|
-
let events = state.metaKeyEvents;
|
|
524
|
-
state.metaKeyEvents = void 0;
|
|
525
|
-
for (let event of events.values()) (_c = state.target) == null ? void 0 : _c.dispatchEvent(new KeyboardEvent("keyup", event));
|
|
83
|
+
propsOnMouseEnter == null ? void 0 : propsOnMouseEnter(event);
|
|
84
|
+
},
|
|
85
|
+
[hasHoverTrigger, onAnimationForward, propsOnMouseEnter]
|
|
86
|
+
);
|
|
87
|
+
const onMouseLeave = useCallback(
|
|
88
|
+
(event) => {
|
|
89
|
+
animationTimeoutRef.current = setTimeout(() => {
|
|
90
|
+
setActive(false);
|
|
91
|
+
}, TRANSITION_DURATION);
|
|
92
|
+
if (hasHoverTrigger) {
|
|
93
|
+
onAnimationBackward();
|
|
526
94
|
}
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
}
|
|
535
|
-
state.pointerType = e.pointerType;
|
|
536
|
-
let shouldStopPropagation = true;
|
|
537
|
-
if (!state.isPressed) {
|
|
538
|
-
state.isPressed = true;
|
|
539
|
-
state.isOverTarget = true;
|
|
540
|
-
state.activePointerId = e.pointerId;
|
|
541
|
-
state.target = e.currentTarget;
|
|
542
|
-
if (!allowTextSelectionOnPress) $cbf007e418543821$export$16a4697467175487(state.target);
|
|
543
|
-
shouldStopPropagation = triggerPressStart(e, state.pointerType);
|
|
544
|
-
let target = $23f2114a1b82827e$export$e58f029f0fbfdb29(e);
|
|
545
|
-
if ("releasePointerCapture" in target) {
|
|
546
|
-
if ("hasPointerCapture" in target) {
|
|
547
|
-
if (target.hasPointerCapture(e.pointerId)) target.releasePointerCapture(e.pointerId);
|
|
548
|
-
} else target.releasePointerCapture(e.pointerId);
|
|
549
|
-
}
|
|
550
|
-
addGlobalListener($d447af545b77c9f1$export$b204af158042fbac(e.currentTarget), "pointerup", onPointerUp, false);
|
|
551
|
-
addGlobalListener($d447af545b77c9f1$export$b204af158042fbac(e.currentTarget), "pointercancel", onPointerCancel, false);
|
|
552
|
-
}
|
|
553
|
-
if (shouldStopPropagation) e.stopPropagation();
|
|
554
|
-
};
|
|
555
|
-
pressProps2.onMouseDown = (e) => {
|
|
556
|
-
if (!$23f2114a1b82827e$export$4282f70798064fe0(e.currentTarget, $23f2114a1b82827e$export$e58f029f0fbfdb29(e))) return;
|
|
557
|
-
if (e.button === 0) {
|
|
558
|
-
if (preventFocusOnPress) {
|
|
559
|
-
let dispose = $a92dc41f639950be$export$cabe61c495ee3649(e.target);
|
|
560
|
-
if (dispose) state.disposables.push(dispose);
|
|
561
|
-
}
|
|
562
|
-
e.stopPropagation();
|
|
563
|
-
}
|
|
564
|
-
};
|
|
565
|
-
pressProps2.onPointerUp = (e) => {
|
|
566
|
-
if (!$23f2114a1b82827e$export$4282f70798064fe0(e.currentTarget, $23f2114a1b82827e$export$e58f029f0fbfdb29(e)) || state.pointerType === "virtual") return;
|
|
567
|
-
if (e.button === 0 && !state.isPressed)
|
|
568
|
-
triggerPressUpEvent(e, state.pointerType || e.pointerType);
|
|
569
|
-
};
|
|
570
|
-
pressProps2.onPointerEnter = (e) => {
|
|
571
|
-
if (e.pointerId === state.activePointerId && state.target && !state.isOverTarget && state.pointerType != null) {
|
|
572
|
-
state.isOverTarget = true;
|
|
573
|
-
triggerPressStart($d27d541f9569d26d$var$createEvent(state.target, e), state.pointerType);
|
|
574
|
-
}
|
|
575
|
-
};
|
|
576
|
-
pressProps2.onPointerLeave = (e) => {
|
|
577
|
-
if (e.pointerId === state.activePointerId && state.target && state.isOverTarget && state.pointerType != null) {
|
|
578
|
-
state.isOverTarget = false;
|
|
579
|
-
triggerPressEndEvent($d27d541f9569d26d$var$createEvent(state.target, e), state.pointerType, false);
|
|
580
|
-
cancelOnPointerExit(e);
|
|
581
|
-
}
|
|
582
|
-
};
|
|
583
|
-
let onPointerUp = (e) => {
|
|
584
|
-
if (e.pointerId === state.activePointerId && state.isPressed && e.button === 0 && state.target) {
|
|
585
|
-
if ($23f2114a1b82827e$export$4282f70798064fe0(state.target, $23f2114a1b82827e$export$e58f029f0fbfdb29(e)) && state.pointerType != null) {
|
|
586
|
-
let clicked = false;
|
|
587
|
-
let timeout = setTimeout(() => {
|
|
588
|
-
if (state.isPressed && state.target instanceof HTMLElement) {
|
|
589
|
-
if (clicked)
|
|
590
|
-
cancelEvent(e);
|
|
591
|
-
else {
|
|
592
|
-
$1969ac565cfec8d0$export$de79e2c695e052f3(state.target);
|
|
593
|
-
state.target.click();
|
|
594
|
-
}
|
|
595
|
-
}
|
|
596
|
-
}, 80);
|
|
597
|
-
addGlobalListener(e.currentTarget, "click", () => clicked = true, true);
|
|
598
|
-
state.disposables.push(() => clearTimeout(timeout));
|
|
599
|
-
} else
|
|
600
|
-
cancelEvent(e);
|
|
601
|
-
state.isOverTarget = false;
|
|
602
|
-
}
|
|
603
|
-
};
|
|
604
|
-
let onPointerCancel = (e) => {
|
|
605
|
-
cancelEvent(e);
|
|
606
|
-
};
|
|
607
|
-
pressProps2.onDragStart = (e) => {
|
|
608
|
-
if (!$23f2114a1b82827e$export$4282f70798064fe0(e.currentTarget, $23f2114a1b82827e$export$e58f029f0fbfdb29(e))) return;
|
|
609
|
-
cancelEvent(e);
|
|
610
|
-
};
|
|
611
|
-
} else if (process.env.NODE_ENV === "test") {
|
|
612
|
-
pressProps2.onMouseDown = (e) => {
|
|
613
|
-
if (e.button !== 0 || !$23f2114a1b82827e$export$4282f70798064fe0(e.currentTarget, $23f2114a1b82827e$export$e58f029f0fbfdb29(e))) return;
|
|
614
|
-
if (state.ignoreEmulatedMouseEvents) {
|
|
615
|
-
e.stopPropagation();
|
|
616
|
-
return;
|
|
617
|
-
}
|
|
618
|
-
state.isPressed = true;
|
|
619
|
-
state.isOverTarget = true;
|
|
620
|
-
state.target = e.currentTarget;
|
|
621
|
-
state.pointerType = $b5c62b033c25b96d$export$60278871457622de(e.nativeEvent) ? "virtual" : "mouse";
|
|
622
|
-
let shouldStopPropagation = flushSync(() => triggerPressStart(e, state.pointerType));
|
|
623
|
-
if (shouldStopPropagation) e.stopPropagation();
|
|
624
|
-
if (preventFocusOnPress) {
|
|
625
|
-
let dispose = $a92dc41f639950be$export$cabe61c495ee3649(e.target);
|
|
626
|
-
if (dispose) state.disposables.push(dispose);
|
|
627
|
-
}
|
|
628
|
-
addGlobalListener($d447af545b77c9f1$export$b204af158042fbac(e.currentTarget), "mouseup", onMouseUp, false);
|
|
629
|
-
};
|
|
630
|
-
pressProps2.onMouseEnter = (e) => {
|
|
631
|
-
if (!$23f2114a1b82827e$export$4282f70798064fe0(e.currentTarget, $23f2114a1b82827e$export$e58f029f0fbfdb29(e))) return;
|
|
632
|
-
let shouldStopPropagation = true;
|
|
633
|
-
if (state.isPressed && !state.ignoreEmulatedMouseEvents && state.pointerType != null) {
|
|
634
|
-
state.isOverTarget = true;
|
|
635
|
-
shouldStopPropagation = triggerPressStart(e, state.pointerType);
|
|
636
|
-
}
|
|
637
|
-
if (shouldStopPropagation) e.stopPropagation();
|
|
638
|
-
};
|
|
639
|
-
pressProps2.onMouseLeave = (e) => {
|
|
640
|
-
if (!$23f2114a1b82827e$export$4282f70798064fe0(e.currentTarget, $23f2114a1b82827e$export$e58f029f0fbfdb29(e))) return;
|
|
641
|
-
let shouldStopPropagation = true;
|
|
642
|
-
if (state.isPressed && !state.ignoreEmulatedMouseEvents && state.pointerType != null) {
|
|
643
|
-
state.isOverTarget = false;
|
|
644
|
-
shouldStopPropagation = triggerPressEndEvent(e, state.pointerType, false);
|
|
645
|
-
cancelOnPointerExit(e);
|
|
646
|
-
}
|
|
647
|
-
if (shouldStopPropagation) e.stopPropagation();
|
|
648
|
-
};
|
|
649
|
-
pressProps2.onMouseUp = (e) => {
|
|
650
|
-
if (!$23f2114a1b82827e$export$4282f70798064fe0(e.currentTarget, $23f2114a1b82827e$export$e58f029f0fbfdb29(e))) return;
|
|
651
|
-
if (!state.ignoreEmulatedMouseEvents && e.button === 0 && !state.isPressed)
|
|
652
|
-
triggerPressUpEvent(e, state.pointerType || "mouse");
|
|
653
|
-
};
|
|
654
|
-
let onMouseUp = (e) => {
|
|
655
|
-
if (e.button !== 0) return;
|
|
656
|
-
if (state.ignoreEmulatedMouseEvents) {
|
|
657
|
-
state.ignoreEmulatedMouseEvents = false;
|
|
658
|
-
return;
|
|
659
|
-
}
|
|
660
|
-
if (state.target && $23f2114a1b82827e$export$4282f70798064fe0(state.target, $23f2114a1b82827e$export$e58f029f0fbfdb29(e)) && state.pointerType != null) ;
|
|
661
|
-
else
|
|
662
|
-
cancelEvent(e);
|
|
663
|
-
state.isOverTarget = false;
|
|
664
|
-
};
|
|
665
|
-
pressProps2.onTouchStart = (e) => {
|
|
666
|
-
if (!$23f2114a1b82827e$export$4282f70798064fe0(e.currentTarget, $23f2114a1b82827e$export$e58f029f0fbfdb29(e))) return;
|
|
667
|
-
let touch = $d27d541f9569d26d$var$getTouchFromEvent(e.nativeEvent);
|
|
668
|
-
if (!touch) return;
|
|
669
|
-
state.activePointerId = touch.identifier;
|
|
670
|
-
state.ignoreEmulatedMouseEvents = true;
|
|
671
|
-
state.isOverTarget = true;
|
|
672
|
-
state.isPressed = true;
|
|
673
|
-
state.target = e.currentTarget;
|
|
674
|
-
state.pointerType = "touch";
|
|
675
|
-
if (!allowTextSelectionOnPress) $cbf007e418543821$export$16a4697467175487(state.target);
|
|
676
|
-
let shouldStopPropagation = triggerPressStart($d27d541f9569d26d$var$createTouchEvent(state.target, e), state.pointerType);
|
|
677
|
-
if (shouldStopPropagation) e.stopPropagation();
|
|
678
|
-
addGlobalListener($d447af545b77c9f1$export$f21a1ffae260145a(e.currentTarget), "scroll", onScroll, true);
|
|
679
|
-
};
|
|
680
|
-
pressProps2.onTouchMove = (e) => {
|
|
681
|
-
if (!$23f2114a1b82827e$export$4282f70798064fe0(e.currentTarget, $23f2114a1b82827e$export$e58f029f0fbfdb29(e))) return;
|
|
682
|
-
if (!state.isPressed) {
|
|
683
|
-
e.stopPropagation();
|
|
684
|
-
return;
|
|
685
|
-
}
|
|
686
|
-
let touch = $d27d541f9569d26d$var$getTouchById(e.nativeEvent, state.activePointerId);
|
|
687
|
-
let shouldStopPropagation = true;
|
|
688
|
-
if (touch && $d27d541f9569d26d$var$isOverTarget(touch, e.currentTarget)) {
|
|
689
|
-
if (!state.isOverTarget && state.pointerType != null) {
|
|
690
|
-
state.isOverTarget = true;
|
|
691
|
-
shouldStopPropagation = triggerPressStart($d27d541f9569d26d$var$createTouchEvent(state.target, e), state.pointerType);
|
|
692
|
-
}
|
|
693
|
-
} else if (state.isOverTarget && state.pointerType != null) {
|
|
694
|
-
state.isOverTarget = false;
|
|
695
|
-
shouldStopPropagation = triggerPressEndEvent($d27d541f9569d26d$var$createTouchEvent(state.target, e), state.pointerType, false);
|
|
696
|
-
cancelOnPointerExit($d27d541f9569d26d$var$createTouchEvent(state.target, e));
|
|
697
|
-
}
|
|
698
|
-
if (shouldStopPropagation) e.stopPropagation();
|
|
699
|
-
};
|
|
700
|
-
pressProps2.onTouchEnd = (e) => {
|
|
701
|
-
if (!$23f2114a1b82827e$export$4282f70798064fe0(e.currentTarget, $23f2114a1b82827e$export$e58f029f0fbfdb29(e))) return;
|
|
702
|
-
if (!state.isPressed) {
|
|
703
|
-
e.stopPropagation();
|
|
704
|
-
return;
|
|
705
|
-
}
|
|
706
|
-
let touch = $d27d541f9569d26d$var$getTouchById(e.nativeEvent, state.activePointerId);
|
|
707
|
-
let shouldStopPropagation = true;
|
|
708
|
-
if (touch && $d27d541f9569d26d$var$isOverTarget(touch, e.currentTarget) && state.pointerType != null) {
|
|
709
|
-
triggerPressUpEvent($d27d541f9569d26d$var$createTouchEvent(state.target, e), state.pointerType);
|
|
710
|
-
shouldStopPropagation = triggerPressEndEvent($d27d541f9569d26d$var$createTouchEvent(state.target, e), state.pointerType);
|
|
711
|
-
triggerSyntheticClick(e.nativeEvent, state.target);
|
|
712
|
-
} else if (state.isOverTarget && state.pointerType != null)
|
|
713
|
-
shouldStopPropagation = triggerPressEndEvent($d27d541f9569d26d$var$createTouchEvent(state.target, e), state.pointerType, false);
|
|
714
|
-
if (shouldStopPropagation) e.stopPropagation();
|
|
715
|
-
state.isPressed = false;
|
|
716
|
-
state.activePointerId = null;
|
|
717
|
-
state.isOverTarget = false;
|
|
718
|
-
state.ignoreEmulatedMouseEvents = true;
|
|
719
|
-
if (state.target && !allowTextSelectionOnPress) $cbf007e418543821$export$b0d6fa1ab32e3295(state.target);
|
|
720
|
-
removeAllGlobalListeners();
|
|
721
|
-
};
|
|
722
|
-
pressProps2.onTouchCancel = (e) => {
|
|
723
|
-
if (!$23f2114a1b82827e$export$4282f70798064fe0(e.currentTarget, $23f2114a1b82827e$export$e58f029f0fbfdb29(e))) return;
|
|
724
|
-
e.stopPropagation();
|
|
725
|
-
if (state.isPressed)
|
|
726
|
-
cancelEvent($d27d541f9569d26d$var$createTouchEvent(state.target, e));
|
|
727
|
-
};
|
|
728
|
-
let onScroll = (e) => {
|
|
729
|
-
if (state.isPressed && $23f2114a1b82827e$export$4282f70798064fe0($23f2114a1b82827e$export$e58f029f0fbfdb29(e), state.target))
|
|
730
|
-
cancelEvent({
|
|
731
|
-
currentTarget: state.target,
|
|
732
|
-
shiftKey: false,
|
|
733
|
-
ctrlKey: false,
|
|
734
|
-
metaKey: false,
|
|
735
|
-
altKey: false
|
|
736
|
-
});
|
|
737
|
-
};
|
|
738
|
-
pressProps2.onDragStart = (e) => {
|
|
739
|
-
if (!$23f2114a1b82827e$export$4282f70798064fe0(e.currentTarget, $23f2114a1b82827e$export$e58f029f0fbfdb29(e))) return;
|
|
740
|
-
cancelEvent(e);
|
|
741
|
-
};
|
|
95
|
+
propsOnMouseLeave == null ? void 0 : propsOnMouseLeave(event);
|
|
96
|
+
},
|
|
97
|
+
[hasHoverTrigger, onAnimationBackward, propsOnMouseLeave]
|
|
98
|
+
);
|
|
99
|
+
const onIconAnimationClick = useCallback(() => {
|
|
100
|
+
if (!hasClickTrigger) {
|
|
101
|
+
return;
|
|
742
102
|
}
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
cancelOnPointerExit,
|
|
751
|
-
triggerPressStart,
|
|
752
|
-
triggerClick,
|
|
753
|
-
triggerSyntheticClick
|
|
754
|
-
]);
|
|
755
|
-
useEffect(() => {
|
|
756
|
-
if (!domRef || process.env.NODE_ENV === "test") return;
|
|
757
|
-
const ownerDocument = $d447af545b77c9f1$export$b204af158042fbac(domRef.current);
|
|
758
|
-
if (!ownerDocument || !ownerDocument.head || ownerDocument.getElementById($d27d541f9569d26d$var$STYLE_ID)) return;
|
|
759
|
-
const style = ownerDocument.createElement("style");
|
|
760
|
-
style.id = $d27d541f9569d26d$var$STYLE_ID;
|
|
761
|
-
let nonce = $2b2d34ff061957fb$export$2b85b721e524d74b(ownerDocument);
|
|
762
|
-
if (nonce) style.nonce = nonce;
|
|
763
|
-
style.textContent = `
|
|
764
|
-
@layer {
|
|
765
|
-
[${$d27d541f9569d26d$var$PRESSABLE_ATTRIBUTE}] {
|
|
766
|
-
touch-action: pan-x pan-y pinch-zoom;
|
|
767
|
-
}
|
|
768
|
-
}
|
|
769
|
-
`.trim();
|
|
770
|
-
ownerDocument.head.prepend(style);
|
|
771
|
-
}, [
|
|
772
|
-
domRef
|
|
773
|
-
]);
|
|
774
|
-
useEffect(() => {
|
|
775
|
-
let state = ref.current;
|
|
776
|
-
return () => {
|
|
777
|
-
if (!allowTextSelectionOnPress) $cbf007e418543821$export$b0d6fa1ab32e3295(state.target ?? void 0);
|
|
778
|
-
for (let dispose of state.disposables) dispose();
|
|
779
|
-
state.disposables = [];
|
|
780
|
-
};
|
|
781
|
-
}, [
|
|
782
|
-
allowTextSelectionOnPress
|
|
783
|
-
]);
|
|
784
|
-
return {
|
|
785
|
-
isPressed: isPressedProp || isPressed,
|
|
786
|
-
pressProps: $bbaa08b3cd72f041$export$9d1611c77c2fe928(domProps, pressProps, {
|
|
787
|
-
[$d27d541f9569d26d$var$PRESSABLE_ATTRIBUTE]: true
|
|
788
|
-
})
|
|
789
|
-
};
|
|
790
|
-
}
|
|
791
|
-
function $d27d541f9569d26d$var$isHTMLAnchorLink(target) {
|
|
792
|
-
return target.tagName === "A" && target.hasAttribute("href");
|
|
793
|
-
}
|
|
794
|
-
function $d27d541f9569d26d$var$isValidKeyboardEvent(event, currentTarget) {
|
|
795
|
-
const { key, code } = event;
|
|
796
|
-
const element = currentTarget;
|
|
797
|
-
const role = element.getAttribute("role");
|
|
798
|
-
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
|
|
799
|
-
!((role === "link" || !role && $d27d541f9569d26d$var$isHTMLAnchorLink(element)) && key !== "Enter");
|
|
800
|
-
}
|
|
801
|
-
function $d27d541f9569d26d$var$getTouchFromEvent(event) {
|
|
802
|
-
const { targetTouches } = event;
|
|
803
|
-
if (targetTouches.length > 0) return targetTouches[0];
|
|
804
|
-
return null;
|
|
805
|
-
}
|
|
806
|
-
function $d27d541f9569d26d$var$getTouchById(event, pointerId) {
|
|
807
|
-
const changedTouches = event.changedTouches;
|
|
808
|
-
for (let i = 0; i < changedTouches.length; i++) {
|
|
809
|
-
const touch = changedTouches[i];
|
|
810
|
-
if (touch.identifier === pointerId) return touch;
|
|
811
|
-
}
|
|
812
|
-
return null;
|
|
813
|
-
}
|
|
814
|
-
function $d27d541f9569d26d$var$createTouchEvent(target, e) {
|
|
815
|
-
let clientX = 0;
|
|
816
|
-
let clientY = 0;
|
|
817
|
-
if (e.targetTouches && e.targetTouches.length === 1) {
|
|
818
|
-
clientX = e.targetTouches[0].clientX;
|
|
819
|
-
clientY = e.targetTouches[0].clientY;
|
|
820
|
-
}
|
|
821
|
-
return {
|
|
822
|
-
currentTarget: target,
|
|
823
|
-
shiftKey: e.shiftKey,
|
|
824
|
-
ctrlKey: e.ctrlKey,
|
|
825
|
-
metaKey: e.metaKey,
|
|
826
|
-
altKey: e.altKey,
|
|
827
|
-
clientX,
|
|
828
|
-
clientY
|
|
829
|
-
};
|
|
830
|
-
}
|
|
831
|
-
function $d27d541f9569d26d$var$createEvent(target, e) {
|
|
832
|
-
let clientX = e.clientX;
|
|
833
|
-
let clientY = e.clientY;
|
|
834
|
-
return {
|
|
835
|
-
currentTarget: target,
|
|
836
|
-
shiftKey: e.shiftKey,
|
|
837
|
-
ctrlKey: e.ctrlKey,
|
|
838
|
-
metaKey: e.metaKey,
|
|
839
|
-
altKey: e.altKey,
|
|
840
|
-
clientX,
|
|
841
|
-
clientY,
|
|
842
|
-
key: e.key
|
|
843
|
-
};
|
|
844
|
-
}
|
|
845
|
-
function $d27d541f9569d26d$var$getPointClientRect(point) {
|
|
846
|
-
let offsetX = 0;
|
|
847
|
-
let offsetY = 0;
|
|
848
|
-
if (point.width !== void 0) offsetX = point.width / 2;
|
|
849
|
-
else if (point.radiusX !== void 0) offsetX = point.radiusX;
|
|
850
|
-
if (point.height !== void 0) offsetY = point.height / 2;
|
|
851
|
-
else if (point.radiusY !== void 0) offsetY = point.radiusY;
|
|
103
|
+
if (isForwardRef.current) {
|
|
104
|
+
onAnimationBackward();
|
|
105
|
+
} else {
|
|
106
|
+
onAnimationForward();
|
|
107
|
+
}
|
|
108
|
+
isForwardRef.current = !isForwardRef.current;
|
|
109
|
+
}, [hasClickTrigger, onAnimationBackward, onAnimationForward]);
|
|
852
110
|
return {
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
111
|
+
active: active2,
|
|
112
|
+
onMouseEnter,
|
|
113
|
+
onMouseLeave,
|
|
114
|
+
onIconAnimationClick: hasClickTrigger ? onIconAnimationClick : void 0
|
|
857
115
|
};
|
|
858
116
|
}
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
117
|
+
const useAnalyticsReportClicks = ({
|
|
118
|
+
reportBiOnClick,
|
|
119
|
+
onClick: propsOnClick
|
|
120
|
+
}) => {
|
|
121
|
+
return useCallback(
|
|
122
|
+
(event) => {
|
|
123
|
+
reportBiOnClick == null ? void 0 : reportBiOnClick(event);
|
|
124
|
+
propsOnClick == null ? void 0 : propsOnClick(event);
|
|
125
|
+
},
|
|
126
|
+
[reportBiOnClick, propsOnClick]
|
|
127
|
+
);
|
|
128
|
+
};
|
|
129
|
+
function useButtonEventHandlers({
|
|
130
|
+
isDisabled,
|
|
131
|
+
link: link2,
|
|
132
|
+
propsOnClick,
|
|
133
|
+
preventLinkNavigation,
|
|
134
|
+
reportBiOnClick,
|
|
135
|
+
onMouseEnter,
|
|
136
|
+
onMouseLeave,
|
|
137
|
+
onIconAnimationClick,
|
|
138
|
+
onDblClick,
|
|
139
|
+
onFocus,
|
|
140
|
+
onBlur
|
|
141
|
+
}) {
|
|
142
|
+
const isLink = isValidLink(link2);
|
|
143
|
+
const shouldPreventLinkNavigation = preventLinkNavigation && isLink;
|
|
144
|
+
const shouldHaveOnClick = !isDisabled && propsOnClick || shouldPreventLinkNavigation;
|
|
145
|
+
const onClick = useAnalyticsReportClicks({
|
|
146
|
+
reportBiOnClick,
|
|
147
|
+
onClick: shouldHaveOnClick || onIconAnimationClick ? (event) => {
|
|
148
|
+
onIconAnimationClick == null ? void 0 : onIconAnimationClick(event);
|
|
149
|
+
if (shouldHaveOnClick) {
|
|
150
|
+
shouldPreventLinkNavigation && event.preventDefault();
|
|
151
|
+
!isDisabled && (propsOnClick == null ? void 0 : propsOnClick());
|
|
152
|
+
}
|
|
153
|
+
} : void 0
|
|
154
|
+
});
|
|
155
|
+
const eventHandlers = useMemo(
|
|
156
|
+
() => ({
|
|
157
|
+
onClick,
|
|
158
|
+
onMouseEnter,
|
|
159
|
+
onMouseLeave,
|
|
160
|
+
onKeyDown: isLink ? activateByEnterButton : activateBySpaceOrEnterButton,
|
|
161
|
+
onDoubleClick: !isDisabled && onDblClick ? onDblClick : void 0,
|
|
162
|
+
onFocus: !isDisabled && onFocus ? onFocus : void 0,
|
|
163
|
+
onBlur: !isDisabled && onBlur ? onBlur : void 0
|
|
164
|
+
}),
|
|
165
|
+
[
|
|
166
|
+
onClick,
|
|
167
|
+
onMouseEnter,
|
|
168
|
+
onMouseLeave,
|
|
169
|
+
isLink,
|
|
170
|
+
isDisabled,
|
|
171
|
+
onDblClick,
|
|
172
|
+
onFocus,
|
|
173
|
+
onBlur
|
|
174
|
+
]
|
|
175
|
+
);
|
|
176
|
+
return { isLink, eventHandlers };
|
|
177
|
+
}
|
|
178
|
+
function useButtonA11y({
|
|
179
|
+
propsA11y,
|
|
180
|
+
ariaAttributes,
|
|
181
|
+
label: label2
|
|
182
|
+
}) {
|
|
183
|
+
const normalizedA11y = useMemo(
|
|
184
|
+
() => removeAriaPrefix(propsA11y ?? {}),
|
|
185
|
+
[propsA11y]
|
|
186
|
+
);
|
|
187
|
+
const a11yAttr = useMemo(
|
|
188
|
+
() => getAccessibilityAttributesSpread({
|
|
189
|
+
ariaAttributes: {
|
|
190
|
+
...ariaAttributes,
|
|
191
|
+
...normalizedA11y,
|
|
192
|
+
label: (ariaAttributes == null ? void 0 : ariaAttributes.label) ?? (normalizedA11y.label || label2)
|
|
193
|
+
},
|
|
194
|
+
tabindex: normalizedA11y == null ? void 0 : normalizedA11y.tabindex
|
|
195
|
+
}),
|
|
196
|
+
[normalizedA11y, label2, ariaAttributes]
|
|
197
|
+
);
|
|
198
|
+
return a11yAttr;
|
|
199
|
+
}
|
|
200
|
+
const Button = (props) => {
|
|
201
|
+
const {
|
|
202
|
+
id,
|
|
203
|
+
link: link2,
|
|
204
|
+
type = "button",
|
|
205
|
+
label: label2 = "",
|
|
206
|
+
labelContent,
|
|
207
|
+
disabled: isDisabled = false,
|
|
208
|
+
onClick: propsOnClick,
|
|
209
|
+
className,
|
|
210
|
+
corvid,
|
|
211
|
+
a11y: propsA11y,
|
|
212
|
+
direction,
|
|
213
|
+
elementProps,
|
|
214
|
+
compPreviewState,
|
|
215
|
+
isQaMode,
|
|
216
|
+
fullNameCompType,
|
|
217
|
+
lang,
|
|
218
|
+
ariaAttributes,
|
|
219
|
+
onDblClick,
|
|
220
|
+
onFocus,
|
|
221
|
+
onBlur,
|
|
222
|
+
reportBiOnClick,
|
|
223
|
+
preventLinkNavigation,
|
|
224
|
+
onMouseEnter: propsOnMouseEnter,
|
|
225
|
+
onMouseLeave: propsOnMouseLeave,
|
|
226
|
+
wix
|
|
227
|
+
} = props;
|
|
228
|
+
const presetsWrapperProps = (wix == null ? void 0 : wix.presetsWrapperProps) || {};
|
|
229
|
+
const animatedIconProps = elementProps == null ? void 0 : elementProps.animatedIcon;
|
|
230
|
+
const corvidIconAnimationTriggers = (corvid == null ? void 0 : corvid.iconAnimationTriggers) ?? [];
|
|
231
|
+
const defaultTrigger = (animatedIconProps == null ? void 0 : animatedIconProps.trigger) === IconAnimationTriggers.CLICK ? IconAnimationTriggers.CLICK : IconAnimationTriggers.HOVER;
|
|
232
|
+
const iconAnimationTriggers = corvidIconAnimationTriggers.length > 0 ? corvidIconAnimationTriggers : [defaultTrigger];
|
|
233
|
+
const { iconAnimatedRef, onAnimationForward, onAnimationBackward } = useIconAnimation(isDisabled);
|
|
234
|
+
const { active: active2, onMouseEnter, onMouseLeave, onIconAnimationClick } = useButtonInteractionState(
|
|
235
|
+
iconAnimationTriggers,
|
|
236
|
+
onAnimationForward,
|
|
237
|
+
onAnimationBackward,
|
|
238
|
+
propsOnMouseEnter,
|
|
239
|
+
propsOnMouseLeave
|
|
240
|
+
);
|
|
241
|
+
const buttonOrLinkRef = useRef(null);
|
|
242
|
+
const semanticClassNames = SEMANTIC_CLASS_NAMES;
|
|
243
|
+
const rootClassName = clsx(
|
|
244
|
+
styles.root,
|
|
245
|
+
className,
|
|
246
|
+
styles.button,
|
|
247
|
+
"button",
|
|
248
|
+
!direction && directionStyles.fallbackDirection,
|
|
249
|
+
formatClassNames(semanticClassNames.root),
|
|
250
|
+
{
|
|
251
|
+
disabled: isDisabled,
|
|
252
|
+
[styles.active]: active2
|
|
253
|
+
}
|
|
254
|
+
);
|
|
255
|
+
const labelClassName = clsx(
|
|
256
|
+
"label",
|
|
257
|
+
styles.label,
|
|
258
|
+
formatClassNames(semanticClassNames.buttonLabel)
|
|
259
|
+
);
|
|
260
|
+
const linkClassName = styles.link;
|
|
261
|
+
const { isLink, eventHandlers } = useButtonEventHandlers({
|
|
924
262
|
isDisabled,
|
|
925
|
-
|
|
926
|
-
|
|
263
|
+
link: link2,
|
|
264
|
+
propsOnClick,
|
|
265
|
+
preventLinkNavigation,
|
|
266
|
+
reportBiOnClick,
|
|
267
|
+
onMouseEnter,
|
|
268
|
+
onMouseLeave,
|
|
269
|
+
onIconAnimationClick,
|
|
270
|
+
onDblClick,
|
|
271
|
+
onFocus,
|
|
272
|
+
onBlur
|
|
927
273
|
});
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
"aria-expanded": props["aria-expanded"],
|
|
938
|
-
"aria-controls": props["aria-controls"],
|
|
939
|
-
"aria-pressed": props["aria-pressed"],
|
|
940
|
-
"aria-current": props["aria-current"],
|
|
941
|
-
"aria-disabled": props["aria-disabled"]
|
|
942
|
-
})
|
|
274
|
+
const a11yAttr = useButtonA11y({ propsA11y, ariaAttributes, label: label2 });
|
|
275
|
+
const renderedLabel = labelContent ?? label2;
|
|
276
|
+
const wrapperAttributes = {
|
|
277
|
+
id,
|
|
278
|
+
...getDataAttributes(props),
|
|
279
|
+
...getQaDataAttributes(isQaMode, fullNameCompType),
|
|
280
|
+
"data-semantic-classname": semanticClassNames.root,
|
|
281
|
+
lang,
|
|
282
|
+
...direction && { dir: direction }
|
|
943
283
|
};
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
284
|
+
const renderButtonContent = () => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
285
|
+
renderedLabel && /* @__PURE__ */ jsx("span", { className: labelClassName, "data-testid": TestIds.buttonLabel, children: renderedLabel }),
|
|
286
|
+
/* @__PURE__ */ jsx(
|
|
287
|
+
AnimatedButtonIcon,
|
|
288
|
+
{
|
|
289
|
+
ref: iconAnimatedRef,
|
|
290
|
+
svg: animatedIconProps == null ? void 0 : animatedIconProps.svg,
|
|
291
|
+
duration: animatedIconProps == null ? void 0 : animatedIconProps.duration
|
|
292
|
+
}
|
|
293
|
+
)
|
|
294
|
+
] });
|
|
295
|
+
const renderButton = () => /* @__PURE__ */ jsx(
|
|
296
|
+
"button",
|
|
297
|
+
{
|
|
298
|
+
type,
|
|
299
|
+
disabled: isDisabled,
|
|
300
|
+
className: rootClassName,
|
|
301
|
+
"data-testid": TestIds.buttonContent,
|
|
302
|
+
...wrapperAttributes,
|
|
303
|
+
...a11yAttr,
|
|
304
|
+
...eventHandlers,
|
|
305
|
+
ref: buttonOrLinkRef,
|
|
306
|
+
"data-preview": compPreviewState,
|
|
307
|
+
children: renderButtonContent()
|
|
308
|
+
}
|
|
309
|
+
);
|
|
310
|
+
const renderLinkedButton = () => {
|
|
311
|
+
const linkHref = isDisabled ? void 0 : link2.href;
|
|
312
|
+
const linkRel = link2.rel;
|
|
313
|
+
const linkTarget = link2.target;
|
|
314
|
+
const linkPopupId = link2.linkPopupId;
|
|
315
|
+
const anchorDataId = link2.anchorDataId;
|
|
316
|
+
const anchorCompId = link2.anchorCompId;
|
|
317
|
+
return /* @__PURE__ */ jsx(
|
|
318
|
+
"a",
|
|
319
|
+
{
|
|
320
|
+
href: linkHref,
|
|
321
|
+
rel: linkRel,
|
|
322
|
+
target: linkTarget,
|
|
323
|
+
"data-popupid": linkPopupId,
|
|
324
|
+
"data-anchor": anchorDataId,
|
|
325
|
+
"data-anchor-comp-id": anchorCompId,
|
|
326
|
+
className: clsx(linkClassName, rootClassName),
|
|
327
|
+
"data-testid": TestIds.buttonContent,
|
|
328
|
+
...wrapperAttributes,
|
|
329
|
+
...a11yAttr,
|
|
330
|
+
...eventHandlers,
|
|
331
|
+
role: a11yAttr.role,
|
|
332
|
+
tabIndex: a11yAttr.tabIndex,
|
|
333
|
+
ref: buttonOrLinkRef,
|
|
334
|
+
"data-preview": compPreviewState,
|
|
335
|
+
children: renderButtonContent()
|
|
336
|
+
}
|
|
337
|
+
);
|
|
997
338
|
};
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
let message = {
|
|
1013
|
-
"aria-labelledby": ariaLabelledby || buttonId
|
|
1014
|
-
};
|
|
1015
|
-
if (!wasPending.current && isFocused && isPending) $319e236875307eab$export$a9b970dcc4ae71a9(message, "assertive");
|
|
1016
|
-
else if (wasPending.current && isFocused && !isPending) $319e236875307eab$export$a9b970dcc4ae71a9(message, "assertive");
|
|
1017
|
-
wasPending.current = isPending;
|
|
1018
|
-
}, [
|
|
1019
|
-
isPending,
|
|
1020
|
-
isFocused,
|
|
1021
|
-
ariaLabelledby,
|
|
1022
|
-
buttonId
|
|
1023
|
-
]);
|
|
1024
|
-
let DOMProps = $65484d02dcb7eb3e$export$457c3d6518dd4c6f(props, {
|
|
1025
|
-
global: true
|
|
1026
|
-
});
|
|
1027
|
-
delete DOMProps.onClick;
|
|
1028
|
-
return /* @__PURE__ */ React__default.createElement("button", {
|
|
1029
|
-
...$bbaa08b3cd72f041$export$9d1611c77c2fe928(DOMProps, renderProps, buttonProps, focusProps, hoverProps),
|
|
1030
|
-
// When the button is in a pending state, we want to stop implicit form submission (ie. when the user presses enter on a text input).
|
|
1031
|
-
// We do this by changing the button's type to button.
|
|
1032
|
-
type: buttonProps.type === "submit" && isPending ? "button" : buttonProps.type,
|
|
1033
|
-
id: buttonId,
|
|
1034
|
-
ref,
|
|
1035
|
-
"aria-labelledby": ariaLabelledby,
|
|
1036
|
-
slot: props.slot || void 0,
|
|
1037
|
-
"aria-disabled": isPending ? "true" : buttonProps["aria-disabled"],
|
|
1038
|
-
"data-disabled": props.isDisabled || void 0,
|
|
1039
|
-
"data-pressed": renderValues.isPressed || void 0,
|
|
1040
|
-
"data-hovered": isHovered || void 0,
|
|
1041
|
-
"data-focused": isFocused || void 0,
|
|
1042
|
-
"data-pending": isPending || void 0,
|
|
1043
|
-
"data-focus-visible": isFocusVisible || void 0
|
|
1044
|
-
}, /* @__PURE__ */ React__default.createElement($0393f8ab869a0f1a$export$e9f3bf65a26ce129.Provider, {
|
|
1045
|
-
value: {
|
|
1046
|
-
id: progressId
|
|
339
|
+
const renderDisabledLinkAsButton = () => /* @__PURE__ */ jsx(
|
|
340
|
+
"button",
|
|
341
|
+
{
|
|
342
|
+
type,
|
|
343
|
+
disabled: isDisabled,
|
|
344
|
+
className: clsx(rootClassName),
|
|
345
|
+
"data-testid": TestIds.buttonContent,
|
|
346
|
+
...wrapperAttributes,
|
|
347
|
+
...a11yAttr,
|
|
348
|
+
...eventHandlers,
|
|
349
|
+
role: "link",
|
|
350
|
+
ref: buttonOrLinkRef,
|
|
351
|
+
"data-preview": compPreviewState,
|
|
352
|
+
children: renderButtonContent()
|
|
1047
353
|
}
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
props.onKeyDown = void 0;
|
|
1058
|
-
props.onKeyUp = void 0;
|
|
1059
|
-
props.onClick = void 0;
|
|
1060
|
-
props.href = void 0;
|
|
1061
|
-
}
|
|
1062
|
-
return props;
|
|
1063
|
-
}
|
|
354
|
+
);
|
|
355
|
+
const renderContent = () => {
|
|
356
|
+
if (isDisabled && isLink) {
|
|
357
|
+
return renderDisabledLinkAsButton();
|
|
358
|
+
}
|
|
359
|
+
return isLink ? renderLinkedButton() : renderButton();
|
|
360
|
+
};
|
|
361
|
+
return /* @__PURE__ */ jsx("div", { className: presetWrapperStyles.presetWrapper, ...presetsWrapperProps, children: renderContent() });
|
|
362
|
+
};
|
|
1064
363
|
export {
|
|
1065
|
-
|
|
1066
|
-
$1dfb119a85e764e5$export$cc77c4ff7e8673c5 as a,
|
|
1067
|
-
$d27d541f9569d26d$export$45712eceda6fad21 as b,
|
|
1068
|
-
$240e9101ba2842f5$export$7d15b64cf5a3a4c4 as c,
|
|
1069
|
-
$24f9a20f226ad820$export$5165eccb35aaadb5 as d,
|
|
1070
|
-
$2b2d34ff061957fb$export$2b85b721e524d74b as e,
|
|
1071
|
-
$d2b4bc8c273e7be6$export$24d547caef80ccd1 as f,
|
|
1072
|
-
$cbf007e418543821$export$b0d6fa1ab32e3295 as g,
|
|
1073
|
-
$cbf007e418543821$export$16a4697467175487 as h,
|
|
1074
|
-
$240e9101ba2842f5$export$cb6e0bb50bc19463 as i
|
|
364
|
+
Button as B
|
|
1075
365
|
};
|