@uva-glass/component-library 1.38.0 → 1.40.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/Button.module-DfLXeuUK.js +14 -0
- package/dist/Button.module-DfLXeuUK.js.map +1 -0
- package/dist/{MenuLink-DzmKC6A7.js → MenuLink-CSnr2Az4.js} +3 -3
- package/dist/{MenuLink-DzmKC6A7.js.map → MenuLink-CSnr2Az4.js.map} +1 -1
- package/dist/{MultiSelect-Drcfmp0z.js → MultiSelect-Blc_VDxu.js} +2 -2
- package/dist/{MultiSelect-Drcfmp0z.js.map → MultiSelect-Blc_VDxu.js.map} +1 -1
- package/dist/MultiSelectItem-CPf7drsR.js +24 -0
- package/dist/MultiSelectItem-CPf7drsR.js.map +1 -0
- package/dist/assets/ActionList.css +1 -0
- package/dist/assets/Button.css +1 -1
- package/dist/assets/Container.css +1 -1
- package/dist/assets/CourseCard.css +1 -0
- package/dist/assets/CourseCardHeader.css +1 -0
- package/dist/assets/CourseCardOffering.css +1 -0
- package/dist/assets/MultiSelectItem.css +1 -1
- package/dist/assets/Periods.css +1 -1
- package/dist/assets/StatusPill.css +1 -1
- package/dist/components/ActionList/ActionList.d.ts +12 -0
- package/dist/components/ActionList/ActionList.js +76 -0
- package/dist/components/ActionList/ActionList.js.map +1 -0
- package/dist/components/ActionList/ActionList.stories.d.ts +6 -0
- package/dist/components/ActionList/ActionList.stories.js +29 -0
- package/dist/components/ActionList/ActionList.stories.js.map +1 -0
- package/dist/components/ActionList/index.d.ts +1 -0
- package/dist/components/ActionList/index.js +5 -0
- package/dist/components/ActionList/index.js.map +1 -0
- package/dist/components/Button/Button.js +14 -21
- package/dist/components/Button/Button.js.map +1 -1
- package/dist/components/Button/Button.stories.js +1 -1
- package/dist/components/Checkbox/Checkbox.stories.js +1 -1
- package/dist/components/CourseCard/CourseCard.d.ts +33 -0
- package/dist/components/CourseCard/CourseCard.js +50 -0
- package/dist/components/CourseCard/CourseCard.js.map +1 -0
- package/dist/components/CourseCard/CourseCard.stories.d.ts +7 -0
- package/dist/components/CourseCard/CourseCard.stories.js +461 -0
- package/dist/components/CourseCard/CourseCard.stories.js.map +1 -0
- package/dist/components/CourseCard/CourseCardHeader/CourseCardHeader.d.ts +13 -0
- package/dist/components/CourseCard/CourseCardHeader/CourseCardHeader.js +39 -0
- package/dist/components/CourseCard/CourseCardHeader/CourseCardHeader.js.map +1 -0
- package/dist/components/CourseCard/CourseCardHeader/index.d.ts +1 -0
- package/dist/components/CourseCard/CourseCardHeader/index.js +5 -0
- package/dist/components/CourseCard/CourseCardHeader/index.js.map +1 -0
- package/dist/components/CourseCard/CourseCardOffering/CourseCardOffering.d.ts +8 -0
- package/dist/components/CourseCard/CourseCardOffering/CourseCardOffering.js +24 -0
- package/dist/components/CourseCard/CourseCardOffering/CourseCardOffering.js.map +1 -0
- package/dist/components/CourseCard/CourseCardOffering/index.d.ts +1 -0
- package/dist/components/CourseCard/CourseCardOffering/index.js +5 -0
- package/dist/components/CourseCard/CourseCardOffering/index.js.map +1 -0
- package/dist/components/CourseCard/index.d.ts +1 -0
- package/dist/components/CourseCard/index.js +5 -0
- package/dist/components/CourseCard/index.js.map +1 -0
- package/dist/components/CourseCard/mockdata.d.ts +23 -0
- package/dist/components/Drawer/Drawer.js +1 -1
- package/dist/components/Drawer/Drawer.stories.js +2 -2
- package/dist/components/Icon/icons/index.d.ts +12 -0
- package/dist/components/Icon/icons/index.js +60 -56
- package/dist/components/Icon/icons/index.js.map +1 -1
- package/dist/components/IconButton/IconButton.stories.js +1 -1
- package/dist/components/InputField/InputField.stories.js +2 -2
- package/dist/components/MenuButton/MenuButton.d.ts +13 -0
- package/dist/components/MenuButton/MenuButton.js +621 -0
- package/dist/components/MenuButton/MenuButton.js.map +1 -0
- package/dist/components/MenuButton/MenuButton.stories.d.ts +8 -0
- package/dist/components/MenuButton/MenuButton.stories.js +58 -0
- package/dist/components/MenuButton/MenuButton.stories.js.map +1 -0
- package/dist/components/MenuButton/index.d.ts +1 -0
- package/dist/components/MenuButton/index.js +5 -0
- package/dist/components/MenuButton/index.js.map +1 -0
- package/dist/components/MenuLink/MenuLink.js +1 -1
- package/dist/components/MenuLink/MenuLink.stories.js +1 -1
- package/dist/components/MenuLink/index.js +1 -1
- package/dist/components/ModalDialog/ModalDialog.js +1 -1
- package/dist/components/ModalDialog/ModalDialog.stories.js +2 -2
- package/dist/components/MultiSelect/MultiSelect.js +2 -2
- package/dist/components/MultiSelect/MultiSelect.stories.js +25 -24
- package/dist/components/MultiSelect/MultiSelect.stories.js.map +1 -1
- package/dist/components/MultiSelect/components/MultiSelectHeader.js +2 -2
- package/dist/components/MultiSelect/components/MultiSelectItem.d.ts +2 -1
- package/dist/components/MultiSelect/components/MultiSelectItem.js +1 -1
- package/dist/components/MultiSelect/index.js +1 -1
- package/dist/components/OverlayCloseButton/OverlayCloseButton.stories.js +1 -1
- package/dist/components/Periods/Periods.d.ts +2 -2
- package/dist/components/Periods/Periods.js +27 -19
- package/dist/components/Periods/Periods.js.map +1 -1
- package/dist/components/Periods/Periods.stories.js.map +1 -1
- package/dist/components/ProgrammeCard/ProgrammeCard.stories.js +2 -2
- package/dist/components/SelectListbox/SelectListBox.stories.js +1 -1
- package/dist/components/StatusPill/StatusPill.d.ts +1 -1
- package/dist/components/StatusPill/StatusPill.js +8 -7
- package/dist/components/StatusPill/StatusPill.js.map +1 -1
- package/dist/components/index.d.ts +3 -0
- package/dist/components/index.js +71 -65
- package/dist/components/index.js.map +1 -1
- package/dist/components/storyComponents/Container/Container.js +12 -12
- package/dist/focusSafely-b94Glb9J.js +402 -0
- package/dist/focusSafely-b94Glb9J.js.map +1 -0
- package/dist/{index-CPfft0rG.js → index-0Faxlks_.js} +12 -11
- package/dist/index-0Faxlks_.js.map +1 -0
- package/dist/{index-DDSOrTSz.js → index-HuvfQN5H.js} +3 -3
- package/dist/{index-DDSOrTSz.js.map → index-HuvfQN5H.js.map} +1 -1
- package/dist/index.js +71 -65
- package/dist/index.js.map +1 -1
- package/dist/types/UserInterface.d.ts +4 -0
- package/dist/types/UserInterface.js +2 -0
- package/dist/types/UserInterface.js.map +1 -0
- package/dist/useDialog-DZhIlo2a.js +785 -0
- package/dist/useDialog-DZhIlo2a.js.map +1 -0
- package/package.json +24 -21
- package/dist/MultiSelectItem-CwKowz2B.js +0 -24
- package/dist/MultiSelectItem-CwKowz2B.js.map +0 -1
- package/dist/index-CPfft0rG.js.map +0 -1
- package/dist/useDialog-udvbFTBT.js +0 -1133
- package/dist/useDialog-udvbFTBT.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as e } from "react/jsx-runtime";
|
|
2
2
|
import { useState as d, useRef as g } from "react";
|
|
3
|
-
import { f as i } from "../../index-
|
|
3
|
+
import { f as i } from "../../index-0Faxlks_.js";
|
|
4
4
|
import { InputField as l } from "./InputField.js";
|
|
5
5
|
import { Container as u } from "../storyComponents/Container/Container.js";
|
|
6
6
|
import { Icon as f } from "../Icon/Icon.js";
|
|
@@ -9,7 +9,7 @@ import "../OverlayCloseButton/OverlayCloseButton.js";
|
|
|
9
9
|
import "../GridRow/GridRow.js";
|
|
10
10
|
import "../IconButton/IconButton.js";
|
|
11
11
|
import "../Input/Input.js";
|
|
12
|
-
import "../../MultiSelect-
|
|
12
|
+
import "../../MultiSelect-Blc_VDxu.js";
|
|
13
13
|
import "../SelectListbox/SelectListbox.js";
|
|
14
14
|
import "../SelectListbox/SelectProvider.js";
|
|
15
15
|
const C = (t) => {
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { PressEvent } from 'react-aria';
|
|
2
|
+
import { AriaButtonProps } from '@react-aria/button';
|
|
3
|
+
import { IconProps } from 'components/Icon';
|
|
4
|
+
import { RefObject } from 'react';
|
|
5
|
+
import { UIButtonVariant } from 'types/UserInterface';
|
|
6
|
+
|
|
7
|
+
export interface MenuButtonProps extends AriaButtonProps<'button'> {
|
|
8
|
+
buttonRef: RefObject<HTMLButtonElement>;
|
|
9
|
+
variant: UIButtonVariant;
|
|
10
|
+
iconName?: IconProps['name'];
|
|
11
|
+
onClick?: (event: PressEvent) => void;
|
|
12
|
+
}
|
|
13
|
+
export declare function MenuButton({ buttonRef, variant, iconName, children, ...restProps }: MenuButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,621 @@
|
|
|
1
|
+
import { jsxs as $e, jsx as Te } from "react/jsx-runtime";
|
|
2
|
+
import { g as le, k as he, l as me, m as V, n as Ee, o as Ke, p as I, d as xe, f as ue, b as w, q as Se, a as F, r as ke, s as ee, c as z, $ as we, e as Oe, j as Ce } from "../../focusSafely-b94Glb9J.js";
|
|
3
|
+
import { c as ce } from "../../clsx-OuTLNxxd.js";
|
|
4
|
+
import fe, { useRef as J, useCallback as L, useEffect as Q, useState as _e, useMemo as Me, useContext as de } from "react";
|
|
5
|
+
import { s as te } from "../../Button.module-DfLXeuUK.js";
|
|
6
|
+
import { Icon as De } from "../Icon/Icon.js";
|
|
7
|
+
function D(...t) {
|
|
8
|
+
let r = {
|
|
9
|
+
...t[0]
|
|
10
|
+
};
|
|
11
|
+
for (let a = 1; a < t.length; a++) {
|
|
12
|
+
let i = t[a];
|
|
13
|
+
for (let o in i) {
|
|
14
|
+
let c = r[o], u = i[o];
|
|
15
|
+
typeof c == "function" && typeof u == "function" && // This is a lot faster than a regex.
|
|
16
|
+
o[0] === "o" && o[1] === "n" && o.charCodeAt(2) >= /* 'A' */
|
|
17
|
+
65 && o.charCodeAt(2) <= /* 'Z' */
|
|
18
|
+
90 ? r[o] = le(c, u) : (o === "className" || o === "UNSAFE_className") && typeof c == "string" && typeof u == "string" ? r[o] = ce(c, u) : o === "id" && c && u ? r.id = he(c, u) : r[o] = u !== void 0 ? u : c;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return r;
|
|
22
|
+
}
|
|
23
|
+
function U(t, r, a = !0) {
|
|
24
|
+
var i, o;
|
|
25
|
+
let { metaKey: c, ctrlKey: u, altKey: p, shiftKey: d } = r;
|
|
26
|
+
me() && (!((o = window.event) === null || o === void 0 || (i = o.type) === null || i === void 0) && i.startsWith("key")) && t.target === "_blank" && (V() ? c = !0 : u = !0);
|
|
27
|
+
let y = Ee() && V() && !Ke() ? new KeyboardEvent("keydown", {
|
|
28
|
+
keyIdentifier: "Enter",
|
|
29
|
+
metaKey: c,
|
|
30
|
+
ctrlKey: u,
|
|
31
|
+
altKey: p,
|
|
32
|
+
shiftKey: d
|
|
33
|
+
}) : new MouseEvent("click", {
|
|
34
|
+
metaKey: c,
|
|
35
|
+
ctrlKey: u,
|
|
36
|
+
altKey: p,
|
|
37
|
+
shiftKey: d,
|
|
38
|
+
bubbles: !0,
|
|
39
|
+
cancelable: !0
|
|
40
|
+
});
|
|
41
|
+
U.isOpening = a, I(t), t.dispatchEvent(y), U.isOpening = !1;
|
|
42
|
+
}
|
|
43
|
+
U.isOpening = !1;
|
|
44
|
+
function Fe() {
|
|
45
|
+
let t = J(/* @__PURE__ */ new Map()), r = L((o, c, u, p) => {
|
|
46
|
+
let d = p != null && p.once ? (...y) => {
|
|
47
|
+
t.current.delete(u), u(...y);
|
|
48
|
+
} : u;
|
|
49
|
+
t.current.set(u, {
|
|
50
|
+
type: c,
|
|
51
|
+
eventTarget: o,
|
|
52
|
+
fn: d,
|
|
53
|
+
options: p
|
|
54
|
+
}), o.addEventListener(c, u, p);
|
|
55
|
+
}, []), a = L((o, c, u, p) => {
|
|
56
|
+
var d;
|
|
57
|
+
let y = ((d = t.current.get(u)) === null || d === void 0 ? void 0 : d.fn) || u;
|
|
58
|
+
o.removeEventListener(c, y, p), t.current.delete(u);
|
|
59
|
+
}, []), i = L(() => {
|
|
60
|
+
t.current.forEach((o, c) => {
|
|
61
|
+
a(o.eventTarget, o.type, c, o.options);
|
|
62
|
+
});
|
|
63
|
+
}, [
|
|
64
|
+
a
|
|
65
|
+
]);
|
|
66
|
+
return Q(() => i, [
|
|
67
|
+
i
|
|
68
|
+
]), {
|
|
69
|
+
addGlobalListener: r,
|
|
70
|
+
removeGlobalListener: a,
|
|
71
|
+
removeAllGlobalListeners: i
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
function pe(t, r) {
|
|
75
|
+
xe(() => {
|
|
76
|
+
if (t && t.ref && r)
|
|
77
|
+
return t.ref.current = r.current, () => {
|
|
78
|
+
t.ref && (t.ref.current = null);
|
|
79
|
+
};
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
let M = "default", q = "", H = /* @__PURE__ */ new WeakMap();
|
|
83
|
+
function re(t) {
|
|
84
|
+
if (ue()) {
|
|
85
|
+
if (M === "default") {
|
|
86
|
+
const r = w(t);
|
|
87
|
+
q = r.documentElement.style.webkitUserSelect, r.documentElement.style.webkitUserSelect = "none";
|
|
88
|
+
}
|
|
89
|
+
M = "disabled";
|
|
90
|
+
} else (t instanceof HTMLElement || t instanceof SVGElement) && (H.set(t, t.style.userSelect), t.style.userSelect = "none");
|
|
91
|
+
}
|
|
92
|
+
function X(t) {
|
|
93
|
+
if (ue()) {
|
|
94
|
+
if (M !== "disabled") return;
|
|
95
|
+
M = "restoring", setTimeout(() => {
|
|
96
|
+
Se(() => {
|
|
97
|
+
if (M === "restoring") {
|
|
98
|
+
const r = w(t);
|
|
99
|
+
r.documentElement.style.webkitUserSelect === "none" && (r.documentElement.style.webkitUserSelect = q || ""), q = "", M = "default";
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
}, 300);
|
|
103
|
+
} else if ((t instanceof HTMLElement || t instanceof SVGElement) && t && H.has(t)) {
|
|
104
|
+
let r = H.get(t);
|
|
105
|
+
t.style.userSelect === "none" && (t.style.userSelect = r), t.getAttribute("style") === "" && t.removeAttribute("style"), H.delete(t);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
const ge = fe.createContext({
|
|
109
|
+
register: () => {
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
ge.displayName = "PressResponderContext";
|
|
113
|
+
function Ie(t, r) {
|
|
114
|
+
return r.get ? r.get.call(t) : r.value;
|
|
115
|
+
}
|
|
116
|
+
function ve(t, r, a) {
|
|
117
|
+
if (!r.has(t)) throw new TypeError("attempted to " + a + " private field on non-instance");
|
|
118
|
+
return r.get(t);
|
|
119
|
+
}
|
|
120
|
+
function Le(t, r) {
|
|
121
|
+
var a = ve(t, r, "get");
|
|
122
|
+
return Ie(t, a);
|
|
123
|
+
}
|
|
124
|
+
function Ue(t, r) {
|
|
125
|
+
if (r.has(t))
|
|
126
|
+
throw new TypeError("Cannot initialize the same private elements twice on an object");
|
|
127
|
+
}
|
|
128
|
+
function Ae(t, r, a) {
|
|
129
|
+
Ue(t, r), r.set(t, a);
|
|
130
|
+
}
|
|
131
|
+
function Ye(t, r, a) {
|
|
132
|
+
if (r.set) r.set.call(t, a);
|
|
133
|
+
else {
|
|
134
|
+
if (!r.writable)
|
|
135
|
+
throw new TypeError("attempted to set read only private field");
|
|
136
|
+
r.value = a;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
function ne(t, r, a) {
|
|
140
|
+
var i = ve(t, r, "set");
|
|
141
|
+
return Ye(t, i, a), a;
|
|
142
|
+
}
|
|
143
|
+
function Xe(t) {
|
|
144
|
+
let r = de(ge);
|
|
145
|
+
if (r) {
|
|
146
|
+
let { register: a, ...i } = r;
|
|
147
|
+
t = D(i, t), a();
|
|
148
|
+
}
|
|
149
|
+
return pe(r, t.ref), t;
|
|
150
|
+
}
|
|
151
|
+
var G = /* @__PURE__ */ new WeakMap();
|
|
152
|
+
class B {
|
|
153
|
+
continuePropagation() {
|
|
154
|
+
ne(this, G, !1);
|
|
155
|
+
}
|
|
156
|
+
get shouldStopPropagation() {
|
|
157
|
+
return Le(this, G);
|
|
158
|
+
}
|
|
159
|
+
constructor(r, a, i, o) {
|
|
160
|
+
Ae(this, G, {
|
|
161
|
+
writable: !0,
|
|
162
|
+
value: void 0
|
|
163
|
+
}), ne(this, G, !0);
|
|
164
|
+
var c;
|
|
165
|
+
let u = (c = o == null ? void 0 : o.target) !== null && c !== void 0 ? c : i.currentTarget;
|
|
166
|
+
const p = u == null ? void 0 : u.getBoundingClientRect();
|
|
167
|
+
let d, y = 0, b, O = null;
|
|
168
|
+
i.clientX != null && i.clientY != null && (b = i.clientX, O = i.clientY), p && (b != null && O != null ? (d = b - p.left, y = O - p.top) : (d = p.width / 2, y = p.height / 2)), this.type = r, this.pointerType = a, this.target = i.currentTarget, this.shiftKey = i.shiftKey, this.metaKey = i.metaKey, this.ctrlKey = i.ctrlKey, this.altKey = i.altKey, this.x = d, this.y = y;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
const ae = Symbol("linkClicked");
|
|
172
|
+
function Pe(t) {
|
|
173
|
+
let {
|
|
174
|
+
onPress: r,
|
|
175
|
+
onPressChange: a,
|
|
176
|
+
onPressStart: i,
|
|
177
|
+
onPressEnd: o,
|
|
178
|
+
onPressUp: c,
|
|
179
|
+
isDisabled: u,
|
|
180
|
+
isPressed: p,
|
|
181
|
+
preventFocusOnPress: d,
|
|
182
|
+
shouldCancelOnPointerExit: y,
|
|
183
|
+
allowTextSelectionOnPress: b,
|
|
184
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
185
|
+
ref: O,
|
|
186
|
+
...R
|
|
187
|
+
} = Xe(t), [N, A] = _e(!1), m = J({
|
|
188
|
+
isPressed: !1,
|
|
189
|
+
ignoreEmulatedMouseEvents: !1,
|
|
190
|
+
ignoreClickAfterPress: !1,
|
|
191
|
+
didFirePressStart: !1,
|
|
192
|
+
isTriggeringEvent: !1,
|
|
193
|
+
activePointerId: null,
|
|
194
|
+
target: null,
|
|
195
|
+
isOverTarget: !1,
|
|
196
|
+
pointerType: null
|
|
197
|
+
}), { addGlobalListener: $, removeAllGlobalListeners: x } = Fe(), T = F((e, f) => {
|
|
198
|
+
let h = m.current;
|
|
199
|
+
if (u || h.didFirePressStart) return !1;
|
|
200
|
+
let l = !0;
|
|
201
|
+
if (h.isTriggeringEvent = !0, i) {
|
|
202
|
+
let g = new B("pressstart", f, e);
|
|
203
|
+
i(g), l = g.shouldStopPropagation;
|
|
204
|
+
}
|
|
205
|
+
return a && a(!0), h.isTriggeringEvent = !1, h.didFirePressStart = !0, A(!0), l;
|
|
206
|
+
}), P = F((e, f, h = !0) => {
|
|
207
|
+
let l = m.current;
|
|
208
|
+
if (!l.didFirePressStart) return !1;
|
|
209
|
+
l.ignoreClickAfterPress = !0, l.didFirePressStart = !1, l.isTriggeringEvent = !0;
|
|
210
|
+
let g = !0;
|
|
211
|
+
if (o) {
|
|
212
|
+
let n = new B("pressend", f, e);
|
|
213
|
+
o(n), g = n.shouldStopPropagation;
|
|
214
|
+
}
|
|
215
|
+
if (a && a(!1), A(!1), r && h && !u) {
|
|
216
|
+
let n = new B("press", f, e);
|
|
217
|
+
r(n), g && (g = n.shouldStopPropagation);
|
|
218
|
+
}
|
|
219
|
+
return l.isTriggeringEvent = !1, g;
|
|
220
|
+
}), S = F((e, f) => {
|
|
221
|
+
let h = m.current;
|
|
222
|
+
if (u) return !1;
|
|
223
|
+
if (c) {
|
|
224
|
+
h.isTriggeringEvent = !0;
|
|
225
|
+
let l = new B("pressup", f, e);
|
|
226
|
+
return c(l), h.isTriggeringEvent = !1, l.shouldStopPropagation;
|
|
227
|
+
}
|
|
228
|
+
return !0;
|
|
229
|
+
}), E = F((e) => {
|
|
230
|
+
let f = m.current;
|
|
231
|
+
f.isPressed && f.target && (f.isOverTarget && f.pointerType != null && P(K(f.target, e), f.pointerType, !1), f.isPressed = !1, f.isOverTarget = !1, f.activePointerId = null, f.pointerType = null, x(), b || X(f.target));
|
|
232
|
+
}), Y = F((e) => {
|
|
233
|
+
y && E(e);
|
|
234
|
+
}), be = Me(() => {
|
|
235
|
+
let e = m.current, f = {
|
|
236
|
+
onKeyDown(l) {
|
|
237
|
+
if (j(l.nativeEvent, l.currentTarget) && l.currentTarget.contains(l.target)) {
|
|
238
|
+
var g;
|
|
239
|
+
ie(l.target, l.key) && l.preventDefault();
|
|
240
|
+
let n = !0;
|
|
241
|
+
if (!e.isPressed && !l.repeat) {
|
|
242
|
+
e.target = l.currentTarget, e.isPressed = !0, n = T(l, "keyboard");
|
|
243
|
+
let s = l.currentTarget, v = (C) => {
|
|
244
|
+
j(C, s) && !C.repeat && s.contains(C.target) && e.target && S(K(e.target, C), "keyboard");
|
|
245
|
+
};
|
|
246
|
+
$(w(l.currentTarget), "keyup", le(v, h), !0);
|
|
247
|
+
}
|
|
248
|
+
n && l.stopPropagation(), l.metaKey && V() && ((g = e.metaKeyEvents) === null || g === void 0 || g.set(l.key, l.nativeEvent));
|
|
249
|
+
} else l.key === "Meta" && (e.metaKeyEvents = /* @__PURE__ */ new Map());
|
|
250
|
+
},
|
|
251
|
+
onClick(l) {
|
|
252
|
+
if (!(l && !l.currentTarget.contains(l.target)) && l && l.button === 0 && !e.isTriggeringEvent && !U.isOpening) {
|
|
253
|
+
let g = !0;
|
|
254
|
+
if (u && l.preventDefault(), !e.ignoreClickAfterPress && !e.ignoreEmulatedMouseEvents && !e.isPressed && (e.pointerType === "virtual" || ee(l.nativeEvent))) {
|
|
255
|
+
!u && !d && I(l.currentTarget);
|
|
256
|
+
let n = T(l, "virtual"), s = S(l, "virtual"), v = P(l, "virtual");
|
|
257
|
+
g = n && s && v;
|
|
258
|
+
}
|
|
259
|
+
e.ignoreEmulatedMouseEvents = !1, e.ignoreClickAfterPress = !1, g && l.stopPropagation();
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
}, h = (l) => {
|
|
263
|
+
var g;
|
|
264
|
+
if (e.isPressed && e.target && j(l, e.target)) {
|
|
265
|
+
var n;
|
|
266
|
+
ie(l.target, l.key) && l.preventDefault();
|
|
267
|
+
let v = l.target;
|
|
268
|
+
P(K(e.target, l), "keyboard", e.target.contains(v)), x(), l.key !== "Enter" && Z(e.target) && e.target.contains(v) && !l[ae] && (l[ae] = !0, U(e.target, l, !1)), e.isPressed = !1, (n = e.metaKeyEvents) === null || n === void 0 || n.delete(l.key);
|
|
269
|
+
} else if (l.key === "Meta" && (!((g = e.metaKeyEvents) === null || g === void 0) && g.size)) {
|
|
270
|
+
var s;
|
|
271
|
+
let v = e.metaKeyEvents;
|
|
272
|
+
e.metaKeyEvents = void 0;
|
|
273
|
+
for (let C of v.values()) (s = e.target) === null || s === void 0 || s.dispatchEvent(new KeyboardEvent("keyup", C));
|
|
274
|
+
}
|
|
275
|
+
};
|
|
276
|
+
if (typeof PointerEvent < "u") {
|
|
277
|
+
f.onPointerDown = (s) => {
|
|
278
|
+
if (s.button !== 0 || !s.currentTarget.contains(s.target)) return;
|
|
279
|
+
if (ke(s.nativeEvent)) {
|
|
280
|
+
e.pointerType = "virtual";
|
|
281
|
+
return;
|
|
282
|
+
}
|
|
283
|
+
W(s.currentTarget) && s.preventDefault(), e.pointerType = s.pointerType;
|
|
284
|
+
let v = !0;
|
|
285
|
+
e.isPressed || (e.isPressed = !0, e.isOverTarget = !0, e.activePointerId = s.pointerId, e.target = s.currentTarget, !u && !d && I(s.currentTarget), b || re(e.target), v = T(s, e.pointerType), $(w(s.currentTarget), "pointermove", l, !1), $(w(s.currentTarget), "pointerup", g, !1), $(w(s.currentTarget), "pointercancel", n, !1)), v && s.stopPropagation();
|
|
286
|
+
}, f.onMouseDown = (s) => {
|
|
287
|
+
s.currentTarget.contains(s.target) && s.button === 0 && (W(s.currentTarget) && s.preventDefault(), s.stopPropagation());
|
|
288
|
+
}, f.onPointerUp = (s) => {
|
|
289
|
+
!s.currentTarget.contains(s.target) || e.pointerType === "virtual" || s.button === 0 && _(s, s.currentTarget) && S(s, e.pointerType || s.pointerType);
|
|
290
|
+
};
|
|
291
|
+
let l = (s) => {
|
|
292
|
+
s.pointerId === e.activePointerId && (e.target && _(s, e.target) ? !e.isOverTarget && e.pointerType != null && (e.isOverTarget = !0, T(K(e.target, s), e.pointerType)) : e.target && e.isOverTarget && e.pointerType != null && (e.isOverTarget = !1, P(K(e.target, s), e.pointerType, !1), Y(s)));
|
|
293
|
+
}, g = (s) => {
|
|
294
|
+
s.pointerId === e.activePointerId && e.isPressed && s.button === 0 && e.target && (_(s, e.target) && e.pointerType != null ? P(K(e.target, s), e.pointerType) : e.isOverTarget && e.pointerType != null && P(K(e.target, s), e.pointerType, !1), e.isPressed = !1, e.isOverTarget = !1, e.activePointerId = null, e.pointerType = null, x(), b || X(e.target));
|
|
295
|
+
}, n = (s) => {
|
|
296
|
+
E(s);
|
|
297
|
+
};
|
|
298
|
+
f.onDragStart = (s) => {
|
|
299
|
+
s.currentTarget.contains(s.target) && E(s);
|
|
300
|
+
};
|
|
301
|
+
} else {
|
|
302
|
+
f.onMouseDown = (n) => {
|
|
303
|
+
if (n.button !== 0 || !n.currentTarget.contains(n.target)) return;
|
|
304
|
+
if (W(n.currentTarget) && n.preventDefault(), e.ignoreEmulatedMouseEvents) {
|
|
305
|
+
n.stopPropagation();
|
|
306
|
+
return;
|
|
307
|
+
}
|
|
308
|
+
e.isPressed = !0, e.isOverTarget = !0, e.target = n.currentTarget, e.pointerType = ee(n.nativeEvent) ? "virtual" : "mouse", !u && !d && I(n.currentTarget), T(n, e.pointerType) && n.stopPropagation(), $(w(n.currentTarget), "mouseup", l, !1);
|
|
309
|
+
}, f.onMouseEnter = (n) => {
|
|
310
|
+
if (!n.currentTarget.contains(n.target)) return;
|
|
311
|
+
let s = !0;
|
|
312
|
+
e.isPressed && !e.ignoreEmulatedMouseEvents && e.pointerType != null && (e.isOverTarget = !0, s = T(n, e.pointerType)), s && n.stopPropagation();
|
|
313
|
+
}, f.onMouseLeave = (n) => {
|
|
314
|
+
if (!n.currentTarget.contains(n.target)) return;
|
|
315
|
+
let s = !0;
|
|
316
|
+
e.isPressed && !e.ignoreEmulatedMouseEvents && e.pointerType != null && (e.isOverTarget = !1, s = P(n, e.pointerType, !1), Y(n)), s && n.stopPropagation();
|
|
317
|
+
}, f.onMouseUp = (n) => {
|
|
318
|
+
n.currentTarget.contains(n.target) && !e.ignoreEmulatedMouseEvents && n.button === 0 && S(n, e.pointerType || "mouse");
|
|
319
|
+
};
|
|
320
|
+
let l = (n) => {
|
|
321
|
+
if (n.button === 0) {
|
|
322
|
+
if (e.isPressed = !1, x(), e.ignoreEmulatedMouseEvents) {
|
|
323
|
+
e.ignoreEmulatedMouseEvents = !1;
|
|
324
|
+
return;
|
|
325
|
+
}
|
|
326
|
+
e.target && _(n, e.target) && e.pointerType != null ? P(K(e.target, n), e.pointerType) : e.target && e.isOverTarget && e.pointerType != null && P(K(e.target, n), e.pointerType, !1), e.isOverTarget = !1;
|
|
327
|
+
}
|
|
328
|
+
};
|
|
329
|
+
f.onTouchStart = (n) => {
|
|
330
|
+
if (!n.currentTarget.contains(n.target)) return;
|
|
331
|
+
let s = Ge(n.nativeEvent);
|
|
332
|
+
if (!s) return;
|
|
333
|
+
e.activePointerId = s.identifier, e.ignoreEmulatedMouseEvents = !0, e.isOverTarget = !0, e.isPressed = !0, e.target = n.currentTarget, e.pointerType = "touch", !u && !d && I(n.currentTarget), b || re(e.target), T(k(e.target, n), e.pointerType) && n.stopPropagation(), $(z(n.currentTarget), "scroll", g, !0);
|
|
334
|
+
}, f.onTouchMove = (n) => {
|
|
335
|
+
if (!n.currentTarget.contains(n.target)) return;
|
|
336
|
+
if (!e.isPressed) {
|
|
337
|
+
n.stopPropagation();
|
|
338
|
+
return;
|
|
339
|
+
}
|
|
340
|
+
let s = se(n.nativeEvent, e.activePointerId), v = !0;
|
|
341
|
+
s && _(s, n.currentTarget) ? !e.isOverTarget && e.pointerType != null && (e.isOverTarget = !0, v = T(k(e.target, n), e.pointerType)) : e.isOverTarget && e.pointerType != null && (e.isOverTarget = !1, v = P(k(e.target, n), e.pointerType, !1), Y(k(e.target, n))), v && n.stopPropagation();
|
|
342
|
+
}, f.onTouchEnd = (n) => {
|
|
343
|
+
if (!n.currentTarget.contains(n.target)) return;
|
|
344
|
+
if (!e.isPressed) {
|
|
345
|
+
n.stopPropagation();
|
|
346
|
+
return;
|
|
347
|
+
}
|
|
348
|
+
let s = se(n.nativeEvent, e.activePointerId), v = !0;
|
|
349
|
+
s && _(s, n.currentTarget) && e.pointerType != null ? (S(k(e.target, n), e.pointerType), v = P(k(e.target, n), e.pointerType)) : e.isOverTarget && e.pointerType != null && (v = P(k(e.target, n), e.pointerType, !1)), v && n.stopPropagation(), e.isPressed = !1, e.activePointerId = null, e.isOverTarget = !1, e.ignoreEmulatedMouseEvents = !0, e.target && !b && X(e.target), x();
|
|
350
|
+
}, f.onTouchCancel = (n) => {
|
|
351
|
+
n.currentTarget.contains(n.target) && (n.stopPropagation(), e.isPressed && E(k(e.target, n)));
|
|
352
|
+
};
|
|
353
|
+
let g = (n) => {
|
|
354
|
+
e.isPressed && n.target.contains(e.target) && E({
|
|
355
|
+
currentTarget: e.target,
|
|
356
|
+
shiftKey: !1,
|
|
357
|
+
ctrlKey: !1,
|
|
358
|
+
metaKey: !1,
|
|
359
|
+
altKey: !1
|
|
360
|
+
});
|
|
361
|
+
};
|
|
362
|
+
f.onDragStart = (n) => {
|
|
363
|
+
n.currentTarget.contains(n.target) && E(n);
|
|
364
|
+
};
|
|
365
|
+
}
|
|
366
|
+
return f;
|
|
367
|
+
}, [
|
|
368
|
+
$,
|
|
369
|
+
u,
|
|
370
|
+
d,
|
|
371
|
+
x,
|
|
372
|
+
b,
|
|
373
|
+
E,
|
|
374
|
+
Y,
|
|
375
|
+
P,
|
|
376
|
+
T,
|
|
377
|
+
S
|
|
378
|
+
]);
|
|
379
|
+
return Q(() => () => {
|
|
380
|
+
var e;
|
|
381
|
+
b || X((e = m.current.target) !== null && e !== void 0 ? e : void 0);
|
|
382
|
+
}, [
|
|
383
|
+
b
|
|
384
|
+
]), {
|
|
385
|
+
isPressed: p || N,
|
|
386
|
+
pressProps: D(R, be)
|
|
387
|
+
};
|
|
388
|
+
}
|
|
389
|
+
function Z(t) {
|
|
390
|
+
return t.tagName === "A" && t.hasAttribute("href");
|
|
391
|
+
}
|
|
392
|
+
function j(t, r) {
|
|
393
|
+
const { key: a, code: i } = t, o = r, c = o.getAttribute("role");
|
|
394
|
+
return (a === "Enter" || a === " " || a === "Spacebar" || i === "Space") && !(o instanceof z(o).HTMLInputElement && !ye(o, a) || o instanceof z(o).HTMLTextAreaElement || o.isContentEditable) && // Links should only trigger with Enter key
|
|
395
|
+
!((c === "link" || !c && Z(o)) && a !== "Enter");
|
|
396
|
+
}
|
|
397
|
+
function Ge(t) {
|
|
398
|
+
const { targetTouches: r } = t;
|
|
399
|
+
return r.length > 0 ? r[0] : null;
|
|
400
|
+
}
|
|
401
|
+
function se(t, r) {
|
|
402
|
+
const a = t.changedTouches;
|
|
403
|
+
for (let i = 0; i < a.length; i++) {
|
|
404
|
+
const o = a[i];
|
|
405
|
+
if (o.identifier === r) return o;
|
|
406
|
+
}
|
|
407
|
+
return null;
|
|
408
|
+
}
|
|
409
|
+
function k(t, r) {
|
|
410
|
+
let a = 0, i = 0;
|
|
411
|
+
return r.targetTouches && r.targetTouches.length === 1 && (a = r.targetTouches[0].clientX, i = r.targetTouches[0].clientY), {
|
|
412
|
+
currentTarget: t,
|
|
413
|
+
shiftKey: r.shiftKey,
|
|
414
|
+
ctrlKey: r.ctrlKey,
|
|
415
|
+
metaKey: r.metaKey,
|
|
416
|
+
altKey: r.altKey,
|
|
417
|
+
clientX: a,
|
|
418
|
+
clientY: i
|
|
419
|
+
};
|
|
420
|
+
}
|
|
421
|
+
function K(t, r) {
|
|
422
|
+
let a = r.clientX, i = r.clientY;
|
|
423
|
+
return {
|
|
424
|
+
currentTarget: t,
|
|
425
|
+
shiftKey: r.shiftKey,
|
|
426
|
+
ctrlKey: r.ctrlKey,
|
|
427
|
+
metaKey: r.metaKey,
|
|
428
|
+
altKey: r.altKey,
|
|
429
|
+
clientX: a,
|
|
430
|
+
clientY: i
|
|
431
|
+
};
|
|
432
|
+
}
|
|
433
|
+
function Be(t) {
|
|
434
|
+
let r = 0, a = 0;
|
|
435
|
+
return t.width !== void 0 ? r = t.width / 2 : t.radiusX !== void 0 && (r = t.radiusX), t.height !== void 0 ? a = t.height / 2 : t.radiusY !== void 0 && (a = t.radiusY), {
|
|
436
|
+
top: t.clientY - a,
|
|
437
|
+
right: t.clientX + r,
|
|
438
|
+
bottom: t.clientY + a,
|
|
439
|
+
left: t.clientX - r
|
|
440
|
+
};
|
|
441
|
+
}
|
|
442
|
+
function He(t, r) {
|
|
443
|
+
return !(t.left > r.right || r.left > t.right || t.top > r.bottom || r.top > t.bottom);
|
|
444
|
+
}
|
|
445
|
+
function _(t, r) {
|
|
446
|
+
let a = r.getBoundingClientRect(), i = Be(t);
|
|
447
|
+
return He(a, i);
|
|
448
|
+
}
|
|
449
|
+
function W(t) {
|
|
450
|
+
return !(t instanceof HTMLElement) || !t.hasAttribute("draggable");
|
|
451
|
+
}
|
|
452
|
+
function ie(t, r) {
|
|
453
|
+
return t instanceof HTMLInputElement ? !ye(t, r) : t instanceof HTMLButtonElement ? t.type !== "submit" && t.type !== "reset" : !Z(t);
|
|
454
|
+
}
|
|
455
|
+
const Re = /* @__PURE__ */ new Set([
|
|
456
|
+
"checkbox",
|
|
457
|
+
"radio",
|
|
458
|
+
"range",
|
|
459
|
+
"color",
|
|
460
|
+
"file",
|
|
461
|
+
"image",
|
|
462
|
+
"button",
|
|
463
|
+
"submit",
|
|
464
|
+
"reset"
|
|
465
|
+
]);
|
|
466
|
+
function ye(t, r) {
|
|
467
|
+
return t.type === "checkbox" || t.type === "radio" ? r === " " : Re.has(t.type);
|
|
468
|
+
}
|
|
469
|
+
function Ne(t) {
|
|
470
|
+
let { isDisabled: r, onFocus: a, onBlur: i, onFocusChange: o } = t;
|
|
471
|
+
const c = L((d) => {
|
|
472
|
+
if (d.target === d.currentTarget)
|
|
473
|
+
return i && i(d), o && o(!1), !0;
|
|
474
|
+
}, [
|
|
475
|
+
i,
|
|
476
|
+
o
|
|
477
|
+
]), u = we(c), p = L((d) => {
|
|
478
|
+
const y = w(d.target);
|
|
479
|
+
d.target === d.currentTarget && y.activeElement === d.target && (a && a(d), o && o(!0), u(d));
|
|
480
|
+
}, [
|
|
481
|
+
o,
|
|
482
|
+
a,
|
|
483
|
+
u
|
|
484
|
+
]);
|
|
485
|
+
return {
|
|
486
|
+
focusProps: {
|
|
487
|
+
onFocus: !r && (a || o || i) ? p : void 0,
|
|
488
|
+
onBlur: !r && (i || o) ? c : void 0
|
|
489
|
+
}
|
|
490
|
+
};
|
|
491
|
+
}
|
|
492
|
+
function oe(t) {
|
|
493
|
+
if (!t) return;
|
|
494
|
+
let r = !0;
|
|
495
|
+
return (a) => {
|
|
496
|
+
let i = {
|
|
497
|
+
...a,
|
|
498
|
+
preventDefault() {
|
|
499
|
+
a.preventDefault();
|
|
500
|
+
},
|
|
501
|
+
isDefaultPrevented() {
|
|
502
|
+
return a.isDefaultPrevented();
|
|
503
|
+
},
|
|
504
|
+
stopPropagation() {
|
|
505
|
+
console.error("stopPropagation is now the default behavior for events in React Spectrum. You can use continuePropagation() to revert this behavior.");
|
|
506
|
+
},
|
|
507
|
+
continuePropagation() {
|
|
508
|
+
r = !1;
|
|
509
|
+
}
|
|
510
|
+
};
|
|
511
|
+
t(i), r && a.stopPropagation();
|
|
512
|
+
};
|
|
513
|
+
}
|
|
514
|
+
function je(t) {
|
|
515
|
+
return {
|
|
516
|
+
keyboardProps: t.isDisabled ? {} : {
|
|
517
|
+
onKeyDown: oe(t.onKeyDown),
|
|
518
|
+
onKeyUp: oe(t.onKeyUp)
|
|
519
|
+
}
|
|
520
|
+
};
|
|
521
|
+
}
|
|
522
|
+
let We = /* @__PURE__ */ fe.createContext(null);
|
|
523
|
+
function Ve(t) {
|
|
524
|
+
let r = de(We) || {};
|
|
525
|
+
pe(r, t);
|
|
526
|
+
let { ref: a, ...i } = r;
|
|
527
|
+
return i;
|
|
528
|
+
}
|
|
529
|
+
function ze(t, r) {
|
|
530
|
+
let { focusProps: a } = Ne(t), { keyboardProps: i } = je(t), o = D(a, i), c = Ve(r), u = t.isDisabled ? {} : c, p = J(t.autoFocus);
|
|
531
|
+
return Q(() => {
|
|
532
|
+
p.current && r.current && Oe(r.current), p.current = !1;
|
|
533
|
+
}, [
|
|
534
|
+
r
|
|
535
|
+
]), {
|
|
536
|
+
focusableProps: D({
|
|
537
|
+
...o,
|
|
538
|
+
tabIndex: t.excludeFromTabOrder && !t.isDisabled ? -1 : void 0
|
|
539
|
+
}, u)
|
|
540
|
+
};
|
|
541
|
+
}
|
|
542
|
+
function qe(t, r) {
|
|
543
|
+
let {
|
|
544
|
+
elementType: a = "button",
|
|
545
|
+
isDisabled: i,
|
|
546
|
+
onPress: o,
|
|
547
|
+
onPressStart: c,
|
|
548
|
+
onPressEnd: u,
|
|
549
|
+
onPressUp: p,
|
|
550
|
+
onPressChange: d,
|
|
551
|
+
preventFocusOnPress: y,
|
|
552
|
+
allowFocusWhenDisabled: b,
|
|
553
|
+
// @ts-ignore
|
|
554
|
+
onClick: O,
|
|
555
|
+
href: R,
|
|
556
|
+
target: N,
|
|
557
|
+
rel: A,
|
|
558
|
+
type: m = "button"
|
|
559
|
+
} = t, $;
|
|
560
|
+
a === "button" ? $ = {
|
|
561
|
+
type: m,
|
|
562
|
+
disabled: i
|
|
563
|
+
} : $ = {
|
|
564
|
+
role: "button",
|
|
565
|
+
tabIndex: i ? void 0 : 0,
|
|
566
|
+
href: a === "a" && i ? void 0 : R,
|
|
567
|
+
target: a === "a" ? N : void 0,
|
|
568
|
+
type: a === "input" ? m : void 0,
|
|
569
|
+
disabled: a === "input" ? i : void 0,
|
|
570
|
+
"aria-disabled": !i || a === "input" ? void 0 : i,
|
|
571
|
+
rel: a === "a" ? A : void 0
|
|
572
|
+
};
|
|
573
|
+
let { pressProps: x, isPressed: T } = Pe({
|
|
574
|
+
onPressStart: c,
|
|
575
|
+
onPressEnd: u,
|
|
576
|
+
onPressChange: d,
|
|
577
|
+
onPress: o,
|
|
578
|
+
onPressUp: p,
|
|
579
|
+
isDisabled: i,
|
|
580
|
+
preventFocusOnPress: y,
|
|
581
|
+
ref: r
|
|
582
|
+
}), { focusableProps: P } = ze(t, r);
|
|
583
|
+
b && (P.tabIndex = i ? -1 : P.tabIndex);
|
|
584
|
+
let S = D(P, x, Ce(t, {
|
|
585
|
+
labelable: !0
|
|
586
|
+
}));
|
|
587
|
+
return {
|
|
588
|
+
isPressed: T,
|
|
589
|
+
buttonProps: D($, S, {
|
|
590
|
+
"aria-haspopup": t["aria-haspopup"],
|
|
591
|
+
"aria-expanded": t["aria-expanded"],
|
|
592
|
+
"aria-controls": t["aria-controls"],
|
|
593
|
+
"aria-pressed": t["aria-pressed"],
|
|
594
|
+
onClick: (E) => {
|
|
595
|
+
O && (O(E), console.warn("onClick is deprecated, please use onPress"));
|
|
596
|
+
}
|
|
597
|
+
})
|
|
598
|
+
};
|
|
599
|
+
}
|
|
600
|
+
function nt({ buttonRef: t, variant: r, iconName: a, children: i, ...o }) {
|
|
601
|
+
const { buttonProps: c } = qe(o, t), { pressProps: u } = Pe({
|
|
602
|
+
onPress: (p) => typeof o.onClick == "function" && o.onClick(p)
|
|
603
|
+
});
|
|
604
|
+
return /* @__PURE__ */ $e(
|
|
605
|
+
"button",
|
|
606
|
+
{
|
|
607
|
+
...c,
|
|
608
|
+
...u,
|
|
609
|
+
ref: t,
|
|
610
|
+
className: ce(te.button, te[`button--${r}`]),
|
|
611
|
+
children: [
|
|
612
|
+
i,
|
|
613
|
+
a && /* @__PURE__ */ Te(De, { name: a })
|
|
614
|
+
]
|
|
615
|
+
}
|
|
616
|
+
);
|
|
617
|
+
}
|
|
618
|
+
export {
|
|
619
|
+
nt as MenuButton
|
|
620
|
+
};
|
|
621
|
+
//# sourceMappingURL=MenuButton.js.map
|