@fluentui/web-components 3.0.0-beta.32 → 3.0.0-beta.34
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/CHANGELOG.md +20 -2
- package/dist/dts/menu/menu.d.ts +55 -39
- package/dist/dts/menu-item/menu-item.d.ts +11 -57
- package/dist/dts/menu-list/menu-list.d.ts +5 -10
- package/dist/esm/menu/menu.js +98 -127
- package/dist/esm/menu/menu.js.map +1 -1
- package/dist/esm/menu/menu.styles.js +22 -8
- package/dist/esm/menu/menu.styles.js.map +1 -1
- package/dist/esm/menu/menu.template.js +3 -10
- package/dist/esm/menu/menu.template.js.map +1 -1
- package/dist/esm/menu-item/menu-item.js +59 -121
- package/dist/esm/menu-item/menu-item.js.map +1 -1
- package/dist/esm/menu-item/menu-item.styles.js +88 -116
- package/dist/esm/menu-item/menu-item.styles.js.map +1 -1
- package/dist/esm/menu-item/menu-item.template.js +17 -47
- package/dist/esm/menu-item/menu-item.template.js.map +1 -1
- package/dist/esm/menu-list/menu-list.js +12 -48
- package/dist/esm/menu-list/menu-list.js.map +1 -1
- package/dist/web-components.d.ts +71 -106
- package/dist/web-components.js +119 -1209
- package/dist/web-components.min.js +337 -334
- package/package.json +5 -3
package/dist/web-components.js
CHANGED
|
@@ -2233,26 +2233,6 @@ HTMLDirective.define(RefDirective);
|
|
|
2233
2233
|
*/
|
|
2234
2234
|
const ref = propertyName => new RefDirective(propertyName);
|
|
2235
2235
|
|
|
2236
|
-
const noTemplate = () => null;
|
|
2237
|
-
function normalizeBinding(value) {
|
|
2238
|
-
return value === undefined ? noTemplate : isFunction(value) ? value : () => value;
|
|
2239
|
-
}
|
|
2240
|
-
/**
|
|
2241
|
-
* A directive that enables basic conditional rendering in a template.
|
|
2242
|
-
* @param condition - The condition to test for rendering.
|
|
2243
|
-
* @param templateOrTemplateBinding - The template or a binding that gets
|
|
2244
|
-
* the template to render when the condition is true.
|
|
2245
|
-
* @param elseTemplateOrTemplateBinding - Optional template or binding that that
|
|
2246
|
-
* gets the template to render when the conditional is false.
|
|
2247
|
-
* @public
|
|
2248
|
-
*/
|
|
2249
|
-
function when(condition, templateOrTemplateBinding, elseTemplateOrTemplateBinding) {
|
|
2250
|
-
const dataBinding = isFunction(condition) ? condition : () => condition;
|
|
2251
|
-
const templateBinding = normalizeBinding(templateOrTemplateBinding);
|
|
2252
|
-
const elseBinding = normalizeBinding(elseTemplateOrTemplateBinding);
|
|
2253
|
-
return (source, context) => dataBinding(source, context) ? templateBinding(source, context) : elseBinding(source, context);
|
|
2254
|
-
}
|
|
2255
|
-
|
|
2256
2236
|
const selectElements = value => value.nodeType === 1;
|
|
2257
2237
|
/**
|
|
2258
2238
|
* Creates a function that can be used to filter a Node array, selecting only elements.
|
|
@@ -6762,921 +6742,6 @@ const definition$f = MenuButton.compose({
|
|
|
6762
6742
|
|
|
6763
6743
|
definition$f.define(FluentDesignSystem.registry);
|
|
6764
6744
|
|
|
6765
|
-
function t(t) {
|
|
6766
|
-
return t.split("-")[1];
|
|
6767
|
-
}
|
|
6768
|
-
function e(t) {
|
|
6769
|
-
return "y" === t ? "height" : "width";
|
|
6770
|
-
}
|
|
6771
|
-
function n$1(t) {
|
|
6772
|
-
return t.split("-")[0];
|
|
6773
|
-
}
|
|
6774
|
-
function o$1(t) {
|
|
6775
|
-
return ["top", "bottom"].includes(n$1(t)) ? "x" : "y";
|
|
6776
|
-
}
|
|
6777
|
-
function r$1(r, i, a) {
|
|
6778
|
-
let {
|
|
6779
|
-
reference: l,
|
|
6780
|
-
floating: s
|
|
6781
|
-
} = r;
|
|
6782
|
-
const c = l.x + l.width / 2 - s.width / 2,
|
|
6783
|
-
f = l.y + l.height / 2 - s.height / 2,
|
|
6784
|
-
u = o$1(i),
|
|
6785
|
-
m = e(u),
|
|
6786
|
-
g = l[m] / 2 - s[m] / 2,
|
|
6787
|
-
d = "x" === u;
|
|
6788
|
-
let p;
|
|
6789
|
-
switch (n$1(i)) {
|
|
6790
|
-
case "top":
|
|
6791
|
-
p = {
|
|
6792
|
-
x: c,
|
|
6793
|
-
y: l.y - s.height
|
|
6794
|
-
};
|
|
6795
|
-
break;
|
|
6796
|
-
case "bottom":
|
|
6797
|
-
p = {
|
|
6798
|
-
x: c,
|
|
6799
|
-
y: l.y + l.height
|
|
6800
|
-
};
|
|
6801
|
-
break;
|
|
6802
|
-
case "right":
|
|
6803
|
-
p = {
|
|
6804
|
-
x: l.x + l.width,
|
|
6805
|
-
y: f
|
|
6806
|
-
};
|
|
6807
|
-
break;
|
|
6808
|
-
case "left":
|
|
6809
|
-
p = {
|
|
6810
|
-
x: l.x - s.width,
|
|
6811
|
-
y: f
|
|
6812
|
-
};
|
|
6813
|
-
break;
|
|
6814
|
-
default:
|
|
6815
|
-
p = {
|
|
6816
|
-
x: l.x,
|
|
6817
|
-
y: l.y
|
|
6818
|
-
};
|
|
6819
|
-
}
|
|
6820
|
-
switch (t(i)) {
|
|
6821
|
-
case "start":
|
|
6822
|
-
p[u] -= g * (a && d ? -1 : 1);
|
|
6823
|
-
break;
|
|
6824
|
-
case "end":
|
|
6825
|
-
p[u] += g * (a && d ? -1 : 1);
|
|
6826
|
-
}
|
|
6827
|
-
return p;
|
|
6828
|
-
}
|
|
6829
|
-
const i$1 = async (t, e, n) => {
|
|
6830
|
-
const {
|
|
6831
|
-
placement: o = "bottom",
|
|
6832
|
-
strategy: i = "absolute",
|
|
6833
|
-
middleware: a = [],
|
|
6834
|
-
platform: l
|
|
6835
|
-
} = n,
|
|
6836
|
-
s = a.filter(Boolean),
|
|
6837
|
-
c = await (null == l.isRTL ? void 0 : l.isRTL(e));
|
|
6838
|
-
let f = await l.getElementRects({
|
|
6839
|
-
reference: t,
|
|
6840
|
-
floating: e,
|
|
6841
|
-
strategy: i
|
|
6842
|
-
}),
|
|
6843
|
-
{
|
|
6844
|
-
x: u,
|
|
6845
|
-
y: m
|
|
6846
|
-
} = r$1(f, o, c),
|
|
6847
|
-
g = o,
|
|
6848
|
-
d = {},
|
|
6849
|
-
p = 0;
|
|
6850
|
-
for (let n = 0; n < s.length; n++) {
|
|
6851
|
-
const {
|
|
6852
|
-
name: a,
|
|
6853
|
-
fn: h
|
|
6854
|
-
} = s[n],
|
|
6855
|
-
{
|
|
6856
|
-
x: y,
|
|
6857
|
-
y: x,
|
|
6858
|
-
data: w,
|
|
6859
|
-
reset: v
|
|
6860
|
-
} = await h({
|
|
6861
|
-
x: u,
|
|
6862
|
-
y: m,
|
|
6863
|
-
initialPlacement: o,
|
|
6864
|
-
placement: g,
|
|
6865
|
-
strategy: i,
|
|
6866
|
-
middlewareData: d,
|
|
6867
|
-
rects: f,
|
|
6868
|
-
platform: l,
|
|
6869
|
-
elements: {
|
|
6870
|
-
reference: t,
|
|
6871
|
-
floating: e
|
|
6872
|
-
}
|
|
6873
|
-
});
|
|
6874
|
-
u = null != y ? y : u, m = null != x ? x : m, d = {
|
|
6875
|
-
...d,
|
|
6876
|
-
[a]: {
|
|
6877
|
-
...d[a],
|
|
6878
|
-
...w
|
|
6879
|
-
}
|
|
6880
|
-
}, v && p <= 50 && (p++, "object" == typeof v && (v.placement && (g = v.placement), v.rects && (f = !0 === v.rects ? await l.getElementRects({
|
|
6881
|
-
reference: t,
|
|
6882
|
-
floating: e,
|
|
6883
|
-
strategy: i
|
|
6884
|
-
}) : v.rects), ({
|
|
6885
|
-
x: u,
|
|
6886
|
-
y: m
|
|
6887
|
-
} = r$1(f, g, c))), n = -1);
|
|
6888
|
-
}
|
|
6889
|
-
return {
|
|
6890
|
-
x: u,
|
|
6891
|
-
y: m,
|
|
6892
|
-
placement: g,
|
|
6893
|
-
strategy: i,
|
|
6894
|
-
middlewareData: d
|
|
6895
|
-
};
|
|
6896
|
-
};
|
|
6897
|
-
function a$1(t) {
|
|
6898
|
-
return "number" != typeof t ? function (t) {
|
|
6899
|
-
return {
|
|
6900
|
-
top: 0,
|
|
6901
|
-
right: 0,
|
|
6902
|
-
bottom: 0,
|
|
6903
|
-
left: 0,
|
|
6904
|
-
...t
|
|
6905
|
-
};
|
|
6906
|
-
}(t) : {
|
|
6907
|
-
top: t,
|
|
6908
|
-
right: t,
|
|
6909
|
-
bottom: t,
|
|
6910
|
-
left: t
|
|
6911
|
-
};
|
|
6912
|
-
}
|
|
6913
|
-
function l$1(t) {
|
|
6914
|
-
return {
|
|
6915
|
-
...t,
|
|
6916
|
-
top: t.y,
|
|
6917
|
-
left: t.x,
|
|
6918
|
-
right: t.x + t.width,
|
|
6919
|
-
bottom: t.y + t.height
|
|
6920
|
-
};
|
|
6921
|
-
}
|
|
6922
|
-
async function s$1(t, e) {
|
|
6923
|
-
var n;
|
|
6924
|
-
void 0 === e && (e = {});
|
|
6925
|
-
const {
|
|
6926
|
-
x: o,
|
|
6927
|
-
y: r,
|
|
6928
|
-
platform: i,
|
|
6929
|
-
rects: s,
|
|
6930
|
-
elements: c,
|
|
6931
|
-
strategy: f
|
|
6932
|
-
} = t,
|
|
6933
|
-
{
|
|
6934
|
-
boundary: u = "clippingAncestors",
|
|
6935
|
-
rootBoundary: m = "viewport",
|
|
6936
|
-
elementContext: g = "floating",
|
|
6937
|
-
altBoundary: d = !1,
|
|
6938
|
-
padding: p = 0
|
|
6939
|
-
} = e,
|
|
6940
|
-
h = a$1(p),
|
|
6941
|
-
y = c[d ? "floating" === g ? "reference" : "floating" : g],
|
|
6942
|
-
x = l$1(await i.getClippingRect({
|
|
6943
|
-
element: null == (n = await (null == i.isElement ? void 0 : i.isElement(y))) || n ? y : y.contextElement || (await (null == i.getDocumentElement ? void 0 : i.getDocumentElement(c.floating))),
|
|
6944
|
-
boundary: u,
|
|
6945
|
-
rootBoundary: m,
|
|
6946
|
-
strategy: f
|
|
6947
|
-
})),
|
|
6948
|
-
w = "floating" === g ? {
|
|
6949
|
-
...s.floating,
|
|
6950
|
-
x: o,
|
|
6951
|
-
y: r
|
|
6952
|
-
} : s.reference,
|
|
6953
|
-
v = await (null == i.getOffsetParent ? void 0 : i.getOffsetParent(c.floating)),
|
|
6954
|
-
b = (await (null == i.isElement ? void 0 : i.isElement(v))) && (await (null == i.getScale ? void 0 : i.getScale(v))) || {
|
|
6955
|
-
x: 1,
|
|
6956
|
-
y: 1
|
|
6957
|
-
},
|
|
6958
|
-
R = l$1(i.convertOffsetParentRelativeRectToViewportRelativeRect ? await i.convertOffsetParentRelativeRectToViewportRelativeRect({
|
|
6959
|
-
rect: w,
|
|
6960
|
-
offsetParent: v,
|
|
6961
|
-
strategy: f
|
|
6962
|
-
}) : w);
|
|
6963
|
-
return {
|
|
6964
|
-
top: (x.top - R.top + h.top) / b.y,
|
|
6965
|
-
bottom: (R.bottom - x.bottom + h.bottom) / b.y,
|
|
6966
|
-
left: (x.left - R.left + h.left) / b.x,
|
|
6967
|
-
right: (R.right - x.right + h.right) / b.x
|
|
6968
|
-
};
|
|
6969
|
-
}
|
|
6970
|
-
const c$1 = Math.min,
|
|
6971
|
-
f$1 = Math.max;
|
|
6972
|
-
function u$1(t, e, n) {
|
|
6973
|
-
return f$1(t, c$1(e, n));
|
|
6974
|
-
}
|
|
6975
|
-
const g$1 = ["top", "right", "bottom", "left"];
|
|
6976
|
-
g$1.reduce((t, e) => t.concat(e, e + "-start", e + "-end"), []);
|
|
6977
|
-
const p$1 = {
|
|
6978
|
-
left: "right",
|
|
6979
|
-
right: "left",
|
|
6980
|
-
bottom: "top",
|
|
6981
|
-
top: "bottom"
|
|
6982
|
-
};
|
|
6983
|
-
function h$1(t) {
|
|
6984
|
-
return t.replace(/left|right|bottom|top/g, t => p$1[t]);
|
|
6985
|
-
}
|
|
6986
|
-
function y$1(n, r, i) {
|
|
6987
|
-
void 0 === i && (i = !1);
|
|
6988
|
-
const a = t(n),
|
|
6989
|
-
l = o$1(n),
|
|
6990
|
-
s = e(l);
|
|
6991
|
-
let c = "x" === l ? a === (i ? "end" : "start") ? "right" : "left" : "start" === a ? "bottom" : "top";
|
|
6992
|
-
return r.reference[s] > r.floating[s] && (c = h$1(c)), {
|
|
6993
|
-
main: c,
|
|
6994
|
-
cross: h$1(c)
|
|
6995
|
-
};
|
|
6996
|
-
}
|
|
6997
|
-
const x$1 = {
|
|
6998
|
-
start: "end",
|
|
6999
|
-
end: "start"
|
|
7000
|
-
};
|
|
7001
|
-
function w$1(t) {
|
|
7002
|
-
return t.replace(/start|end/g, t => x$1[t]);
|
|
7003
|
-
}
|
|
7004
|
-
const b$1 = function (e) {
|
|
7005
|
-
return void 0 === e && (e = {}), {
|
|
7006
|
-
name: "flip",
|
|
7007
|
-
options: e,
|
|
7008
|
-
async fn(o) {
|
|
7009
|
-
var r;
|
|
7010
|
-
const {
|
|
7011
|
-
placement: i,
|
|
7012
|
-
middlewareData: a,
|
|
7013
|
-
rects: l,
|
|
7014
|
-
initialPlacement: c,
|
|
7015
|
-
platform: f,
|
|
7016
|
-
elements: u
|
|
7017
|
-
} = o,
|
|
7018
|
-
{
|
|
7019
|
-
mainAxis: m = !0,
|
|
7020
|
-
crossAxis: g = !0,
|
|
7021
|
-
fallbackPlacements: d,
|
|
7022
|
-
fallbackStrategy: p = "bestFit",
|
|
7023
|
-
fallbackAxisSideDirection: x = "none",
|
|
7024
|
-
flipAlignment: v = !0,
|
|
7025
|
-
...b
|
|
7026
|
-
} = e,
|
|
7027
|
-
R = n$1(i),
|
|
7028
|
-
A = n$1(c) === c,
|
|
7029
|
-
P = await (null == f.isRTL ? void 0 : f.isRTL(u.floating)),
|
|
7030
|
-
T = d || (A || !v ? [h$1(c)] : function (t) {
|
|
7031
|
-
const e = h$1(t);
|
|
7032
|
-
return [w$1(t), e, w$1(e)];
|
|
7033
|
-
}(c));
|
|
7034
|
-
d || "none" === x || T.push(...function (e, o, r, i) {
|
|
7035
|
-
const a = t(e);
|
|
7036
|
-
let l = function (t, e, n) {
|
|
7037
|
-
const o = ["left", "right"],
|
|
7038
|
-
r = ["right", "left"],
|
|
7039
|
-
i = ["top", "bottom"],
|
|
7040
|
-
a = ["bottom", "top"];
|
|
7041
|
-
switch (t) {
|
|
7042
|
-
case "top":
|
|
7043
|
-
case "bottom":
|
|
7044
|
-
return n ? e ? r : o : e ? o : r;
|
|
7045
|
-
case "left":
|
|
7046
|
-
case "right":
|
|
7047
|
-
return e ? i : a;
|
|
7048
|
-
default:
|
|
7049
|
-
return [];
|
|
7050
|
-
}
|
|
7051
|
-
}(n$1(e), "start" === r, i);
|
|
7052
|
-
return a && (l = l.map(t => t + "-" + a), o && (l = l.concat(l.map(w$1)))), l;
|
|
7053
|
-
}(c, v, x, P));
|
|
7054
|
-
const O = [c, ...T],
|
|
7055
|
-
D = await s$1(o, b),
|
|
7056
|
-
E = [];
|
|
7057
|
-
let L = (null == (r = a.flip) ? void 0 : r.overflows) || [];
|
|
7058
|
-
if (m && E.push(D[R]), g) {
|
|
7059
|
-
const {
|
|
7060
|
-
main: t,
|
|
7061
|
-
cross: e
|
|
7062
|
-
} = y$1(i, l, P);
|
|
7063
|
-
E.push(D[t], D[e]);
|
|
7064
|
-
}
|
|
7065
|
-
if (L = [...L, {
|
|
7066
|
-
placement: i,
|
|
7067
|
-
overflows: E
|
|
7068
|
-
}], !E.every(t => t <= 0)) {
|
|
7069
|
-
var k, B;
|
|
7070
|
-
const t = ((null == (k = a.flip) ? void 0 : k.index) || 0) + 1,
|
|
7071
|
-
e = O[t];
|
|
7072
|
-
if (e) return {
|
|
7073
|
-
data: {
|
|
7074
|
-
index: t,
|
|
7075
|
-
overflows: L
|
|
7076
|
-
},
|
|
7077
|
-
reset: {
|
|
7078
|
-
placement: e
|
|
7079
|
-
}
|
|
7080
|
-
};
|
|
7081
|
-
let n = null == (B = L.filter(t => t.overflows[0] <= 0).sort((t, e) => t.overflows[1] - e.overflows[1])[0]) ? void 0 : B.placement;
|
|
7082
|
-
if (!n) switch (p) {
|
|
7083
|
-
case "bestFit":
|
|
7084
|
-
{
|
|
7085
|
-
var C;
|
|
7086
|
-
const t = null == (C = L.map(t => [t.placement, t.overflows.filter(t => t > 0).reduce((t, e) => t + e, 0)]).sort((t, e) => t[1] - e[1])[0]) ? void 0 : C[0];
|
|
7087
|
-
t && (n = t);
|
|
7088
|
-
break;
|
|
7089
|
-
}
|
|
7090
|
-
case "initialPlacement":
|
|
7091
|
-
n = c;
|
|
7092
|
-
}
|
|
7093
|
-
if (i !== n) return {
|
|
7094
|
-
reset: {
|
|
7095
|
-
placement: n
|
|
7096
|
-
}
|
|
7097
|
-
};
|
|
7098
|
-
}
|
|
7099
|
-
return {};
|
|
7100
|
-
}
|
|
7101
|
-
};
|
|
7102
|
-
};
|
|
7103
|
-
function R$1(t, e) {
|
|
7104
|
-
return {
|
|
7105
|
-
top: t.top - e.height,
|
|
7106
|
-
right: t.right - e.width,
|
|
7107
|
-
bottom: t.bottom - e.height,
|
|
7108
|
-
left: t.left - e.width
|
|
7109
|
-
};
|
|
7110
|
-
}
|
|
7111
|
-
function A$1(t) {
|
|
7112
|
-
return g$1.some(e => t[e] >= 0);
|
|
7113
|
-
}
|
|
7114
|
-
const P$1 = function (t) {
|
|
7115
|
-
return void 0 === t && (t = {}), {
|
|
7116
|
-
name: "hide",
|
|
7117
|
-
options: t,
|
|
7118
|
-
async fn(e) {
|
|
7119
|
-
const {
|
|
7120
|
-
strategy: n = "referenceHidden",
|
|
7121
|
-
...o
|
|
7122
|
-
} = t,
|
|
7123
|
-
{
|
|
7124
|
-
rects: r
|
|
7125
|
-
} = e;
|
|
7126
|
-
switch (n) {
|
|
7127
|
-
case "referenceHidden":
|
|
7128
|
-
{
|
|
7129
|
-
const t = R$1(await s$1(e, {
|
|
7130
|
-
...o,
|
|
7131
|
-
elementContext: "reference"
|
|
7132
|
-
}), r.reference);
|
|
7133
|
-
return {
|
|
7134
|
-
data: {
|
|
7135
|
-
referenceHiddenOffsets: t,
|
|
7136
|
-
referenceHidden: A$1(t)
|
|
7137
|
-
}
|
|
7138
|
-
};
|
|
7139
|
-
}
|
|
7140
|
-
case "escaped":
|
|
7141
|
-
{
|
|
7142
|
-
const t = R$1(await s$1(e, {
|
|
7143
|
-
...o,
|
|
7144
|
-
altBoundary: !0
|
|
7145
|
-
}), r.floating);
|
|
7146
|
-
return {
|
|
7147
|
-
data: {
|
|
7148
|
-
escapedOffsets: t,
|
|
7149
|
-
escaped: A$1(t)
|
|
7150
|
-
}
|
|
7151
|
-
};
|
|
7152
|
-
}
|
|
7153
|
-
default:
|
|
7154
|
-
return {};
|
|
7155
|
-
}
|
|
7156
|
-
}
|
|
7157
|
-
};
|
|
7158
|
-
};
|
|
7159
|
-
function D$1(t) {
|
|
7160
|
-
return "x" === t ? "y" : "x";
|
|
7161
|
-
}
|
|
7162
|
-
const E$1 = function (t) {
|
|
7163
|
-
return void 0 === t && (t = {}), {
|
|
7164
|
-
name: "shift",
|
|
7165
|
-
options: t,
|
|
7166
|
-
async fn(e) {
|
|
7167
|
-
const {
|
|
7168
|
-
x: r,
|
|
7169
|
-
y: i,
|
|
7170
|
-
placement: a
|
|
7171
|
-
} = e,
|
|
7172
|
-
{
|
|
7173
|
-
mainAxis: l = !0,
|
|
7174
|
-
crossAxis: c = !1,
|
|
7175
|
-
limiter: f = {
|
|
7176
|
-
fn: t => {
|
|
7177
|
-
let {
|
|
7178
|
-
x: e,
|
|
7179
|
-
y: n
|
|
7180
|
-
} = t;
|
|
7181
|
-
return {
|
|
7182
|
-
x: e,
|
|
7183
|
-
y: n
|
|
7184
|
-
};
|
|
7185
|
-
}
|
|
7186
|
-
},
|
|
7187
|
-
...m
|
|
7188
|
-
} = t,
|
|
7189
|
-
g = {
|
|
7190
|
-
x: r,
|
|
7191
|
-
y: i
|
|
7192
|
-
},
|
|
7193
|
-
d = await s$1(e, m),
|
|
7194
|
-
p = o$1(n$1(a)),
|
|
7195
|
-
h = D$1(p);
|
|
7196
|
-
let y = g[p],
|
|
7197
|
-
x = g[h];
|
|
7198
|
-
if (l) {
|
|
7199
|
-
const t = "y" === p ? "bottom" : "right";
|
|
7200
|
-
y = u$1(y + d["y" === p ? "top" : "left"], y, y - d[t]);
|
|
7201
|
-
}
|
|
7202
|
-
if (c) {
|
|
7203
|
-
const t = "y" === h ? "bottom" : "right";
|
|
7204
|
-
x = u$1(x + d["y" === h ? "top" : "left"], x, x - d[t]);
|
|
7205
|
-
}
|
|
7206
|
-
const w = f.fn({
|
|
7207
|
-
...e,
|
|
7208
|
-
[p]: y,
|
|
7209
|
-
[h]: x
|
|
7210
|
-
});
|
|
7211
|
-
return {
|
|
7212
|
-
...w,
|
|
7213
|
-
data: {
|
|
7214
|
-
x: w.x - r,
|
|
7215
|
-
y: w.y - i
|
|
7216
|
-
}
|
|
7217
|
-
};
|
|
7218
|
-
}
|
|
7219
|
-
};
|
|
7220
|
-
},
|
|
7221
|
-
k = function (e) {
|
|
7222
|
-
return void 0 === e && (e = {}), {
|
|
7223
|
-
name: "size",
|
|
7224
|
-
options: e,
|
|
7225
|
-
async fn(r) {
|
|
7226
|
-
const {
|
|
7227
|
-
placement: i,
|
|
7228
|
-
rects: a,
|
|
7229
|
-
platform: l,
|
|
7230
|
-
elements: u
|
|
7231
|
-
} = r,
|
|
7232
|
-
{
|
|
7233
|
-
apply: m = () => {},
|
|
7234
|
-
...g
|
|
7235
|
-
} = e,
|
|
7236
|
-
d = await s$1(r, g),
|
|
7237
|
-
p = n$1(i),
|
|
7238
|
-
h = t(i),
|
|
7239
|
-
y = "x" === o$1(i),
|
|
7240
|
-
{
|
|
7241
|
-
width: x,
|
|
7242
|
-
height: w
|
|
7243
|
-
} = a.floating;
|
|
7244
|
-
let v, b;
|
|
7245
|
-
"top" === p || "bottom" === p ? (v = p, b = h === ((await (null == l.isRTL ? void 0 : l.isRTL(u.floating))) ? "start" : "end") ? "left" : "right") : (b = p, v = "end" === h ? "top" : "bottom");
|
|
7246
|
-
const R = w - d[v],
|
|
7247
|
-
A = x - d[b];
|
|
7248
|
-
let P = R,
|
|
7249
|
-
T = A;
|
|
7250
|
-
if (y ? T = c$1(x - d.right - d.left, A) : P = c$1(w - d.bottom - d.top, R), !r.middlewareData.shift && !h) {
|
|
7251
|
-
const t = f$1(d.left, 0),
|
|
7252
|
-
e = f$1(d.right, 0),
|
|
7253
|
-
n = f$1(d.top, 0),
|
|
7254
|
-
o = f$1(d.bottom, 0);
|
|
7255
|
-
y ? T = x - 2 * (0 !== t || 0 !== e ? t + e : f$1(d.left, d.right)) : P = w - 2 * (0 !== n || 0 !== o ? n + o : f$1(d.top, d.bottom));
|
|
7256
|
-
}
|
|
7257
|
-
await m({
|
|
7258
|
-
...r,
|
|
7259
|
-
availableWidth: T,
|
|
7260
|
-
availableHeight: P
|
|
7261
|
-
});
|
|
7262
|
-
const O = await l.getDimensions(u.floating);
|
|
7263
|
-
return x !== O.width || w !== O.height ? {
|
|
7264
|
-
reset: {
|
|
7265
|
-
rects: !0
|
|
7266
|
-
}
|
|
7267
|
-
} : {};
|
|
7268
|
-
}
|
|
7269
|
-
};
|
|
7270
|
-
};
|
|
7271
|
-
|
|
7272
|
-
function n(t) {
|
|
7273
|
-
var e;
|
|
7274
|
-
return (null == (e = t.ownerDocument) ? void 0 : e.defaultView) || window;
|
|
7275
|
-
}
|
|
7276
|
-
function o(t) {
|
|
7277
|
-
return n(t).getComputedStyle(t);
|
|
7278
|
-
}
|
|
7279
|
-
const i = Math.min,
|
|
7280
|
-
r = Math.max,
|
|
7281
|
-
l = Math.round;
|
|
7282
|
-
function c(t) {
|
|
7283
|
-
const e = o(t);
|
|
7284
|
-
let n = parseFloat(e.width),
|
|
7285
|
-
i = parseFloat(e.height);
|
|
7286
|
-
const r = t.offsetWidth,
|
|
7287
|
-
c = t.offsetHeight,
|
|
7288
|
-
s = l(n) !== r || l(i) !== c;
|
|
7289
|
-
return s && (n = r, i = c), {
|
|
7290
|
-
width: n,
|
|
7291
|
-
height: i,
|
|
7292
|
-
fallback: s
|
|
7293
|
-
};
|
|
7294
|
-
}
|
|
7295
|
-
function s(t) {
|
|
7296
|
-
return h(t) ? (t.nodeName || "").toLowerCase() : "";
|
|
7297
|
-
}
|
|
7298
|
-
let f;
|
|
7299
|
-
function u() {
|
|
7300
|
-
if (f) return f;
|
|
7301
|
-
const t = navigator.userAgentData;
|
|
7302
|
-
return t && Array.isArray(t.brands) ? (f = t.brands.map(t => t.brand + "/" + t.version).join(" "), f) : navigator.userAgent;
|
|
7303
|
-
}
|
|
7304
|
-
function a(t) {
|
|
7305
|
-
return t instanceof n(t).HTMLElement;
|
|
7306
|
-
}
|
|
7307
|
-
function d(t) {
|
|
7308
|
-
return t instanceof n(t).Element;
|
|
7309
|
-
}
|
|
7310
|
-
function h(t) {
|
|
7311
|
-
return t instanceof n(t).Node;
|
|
7312
|
-
}
|
|
7313
|
-
function p(t) {
|
|
7314
|
-
if ("undefined" == typeof ShadowRoot) return !1;
|
|
7315
|
-
return t instanceof n(t).ShadowRoot || t instanceof ShadowRoot;
|
|
7316
|
-
}
|
|
7317
|
-
function g(t) {
|
|
7318
|
-
const {
|
|
7319
|
-
overflow: e,
|
|
7320
|
-
overflowX: n,
|
|
7321
|
-
overflowY: i,
|
|
7322
|
-
display: r
|
|
7323
|
-
} = o(t);
|
|
7324
|
-
return /auto|scroll|overlay|hidden|clip/.test(e + i + n) && !["inline", "contents"].includes(r);
|
|
7325
|
-
}
|
|
7326
|
-
function m(t) {
|
|
7327
|
-
return ["table", "td", "th"].includes(s(t));
|
|
7328
|
-
}
|
|
7329
|
-
function y(t) {
|
|
7330
|
-
const e = /firefox/i.test(u()),
|
|
7331
|
-
n = o(t),
|
|
7332
|
-
i = n.backdropFilter || n.WebkitBackdropFilter;
|
|
7333
|
-
return "none" !== n.transform || "none" !== n.perspective || !!i && "none" !== i || e && "filter" === n.willChange || e && !!n.filter && "none" !== n.filter || ["transform", "perspective"].some(t => n.willChange.includes(t)) || ["paint", "layout", "strict", "content"].some(t => {
|
|
7334
|
-
const e = n.contain;
|
|
7335
|
-
return null != e && e.includes(t);
|
|
7336
|
-
});
|
|
7337
|
-
}
|
|
7338
|
-
function x() {
|
|
7339
|
-
return /^((?!chrome|android).)*safari/i.test(u());
|
|
7340
|
-
}
|
|
7341
|
-
function w(t) {
|
|
7342
|
-
return ["html", "body", "#document"].includes(s(t));
|
|
7343
|
-
}
|
|
7344
|
-
function v(t) {
|
|
7345
|
-
return d(t) ? t : t.contextElement;
|
|
7346
|
-
}
|
|
7347
|
-
const b = {
|
|
7348
|
-
x: 1,
|
|
7349
|
-
y: 1
|
|
7350
|
-
};
|
|
7351
|
-
function L(t) {
|
|
7352
|
-
const e = v(t);
|
|
7353
|
-
if (!a(e)) return b;
|
|
7354
|
-
const n = e.getBoundingClientRect(),
|
|
7355
|
-
{
|
|
7356
|
-
width: o,
|
|
7357
|
-
height: i,
|
|
7358
|
-
fallback: r
|
|
7359
|
-
} = c(e);
|
|
7360
|
-
let s = (r ? l(n.width) : n.width) / o,
|
|
7361
|
-
f = (r ? l(n.height) : n.height) / i;
|
|
7362
|
-
return s && Number.isFinite(s) || (s = 1), f && Number.isFinite(f) || (f = 1), {
|
|
7363
|
-
x: s,
|
|
7364
|
-
y: f
|
|
7365
|
-
};
|
|
7366
|
-
}
|
|
7367
|
-
function E(t, e, o, i) {
|
|
7368
|
-
var r, l;
|
|
7369
|
-
void 0 === e && (e = !1), void 0 === o && (o = !1);
|
|
7370
|
-
const c = t.getBoundingClientRect(),
|
|
7371
|
-
s = v(t);
|
|
7372
|
-
let f = b;
|
|
7373
|
-
e && (i ? d(i) && (f = L(i)) : f = L(t));
|
|
7374
|
-
const u = s ? n(s) : window,
|
|
7375
|
-
a = x() && o;
|
|
7376
|
-
let h = (c.left + (a && (null == (r = u.visualViewport) ? void 0 : r.offsetLeft) || 0)) / f.x,
|
|
7377
|
-
p = (c.top + (a && (null == (l = u.visualViewport) ? void 0 : l.offsetTop) || 0)) / f.y,
|
|
7378
|
-
g = c.width / f.x,
|
|
7379
|
-
m = c.height / f.y;
|
|
7380
|
-
if (s) {
|
|
7381
|
-
const t = n(s),
|
|
7382
|
-
e = i && d(i) ? n(i) : i;
|
|
7383
|
-
let o = t.frameElement;
|
|
7384
|
-
for (; o && i && e !== t;) {
|
|
7385
|
-
const t = L(o),
|
|
7386
|
-
e = o.getBoundingClientRect(),
|
|
7387
|
-
i = getComputedStyle(o);
|
|
7388
|
-
e.x += (o.clientLeft + parseFloat(i.paddingLeft)) * t.x, e.y += (o.clientTop + parseFloat(i.paddingTop)) * t.y, h *= t.x, p *= t.y, g *= t.x, m *= t.y, h += e.x, p += e.y, o = n(o).frameElement;
|
|
7389
|
-
}
|
|
7390
|
-
}
|
|
7391
|
-
return {
|
|
7392
|
-
width: g,
|
|
7393
|
-
height: m,
|
|
7394
|
-
top: p,
|
|
7395
|
-
right: h + g,
|
|
7396
|
-
bottom: p + m,
|
|
7397
|
-
left: h,
|
|
7398
|
-
x: h,
|
|
7399
|
-
y: p
|
|
7400
|
-
};
|
|
7401
|
-
}
|
|
7402
|
-
function R(t) {
|
|
7403
|
-
return ((h(t) ? t.ownerDocument : t.document) || window.document).documentElement;
|
|
7404
|
-
}
|
|
7405
|
-
function T(t) {
|
|
7406
|
-
return d(t) ? {
|
|
7407
|
-
scrollLeft: t.scrollLeft,
|
|
7408
|
-
scrollTop: t.scrollTop
|
|
7409
|
-
} : {
|
|
7410
|
-
scrollLeft: t.pageXOffset,
|
|
7411
|
-
scrollTop: t.pageYOffset
|
|
7412
|
-
};
|
|
7413
|
-
}
|
|
7414
|
-
function C(t) {
|
|
7415
|
-
return E(R(t)).left + T(t).scrollLeft;
|
|
7416
|
-
}
|
|
7417
|
-
function F(t) {
|
|
7418
|
-
if ("html" === s(t)) return t;
|
|
7419
|
-
const e = t.assignedSlot || t.parentNode || p(t) && t.host || R(t);
|
|
7420
|
-
return p(e) ? e.host : e;
|
|
7421
|
-
}
|
|
7422
|
-
function W(t) {
|
|
7423
|
-
const e = F(t);
|
|
7424
|
-
return w(e) ? e.ownerDocument.body : a(e) && g(e) ? e : W(e);
|
|
7425
|
-
}
|
|
7426
|
-
function D(t, e) {
|
|
7427
|
-
var o;
|
|
7428
|
-
void 0 === e && (e = []);
|
|
7429
|
-
const i = W(t),
|
|
7430
|
-
r = i === (null == (o = t.ownerDocument) ? void 0 : o.body),
|
|
7431
|
-
l = n(i);
|
|
7432
|
-
return r ? e.concat(l, l.visualViewport || [], g(i) ? i : []) : e.concat(i, D(i));
|
|
7433
|
-
}
|
|
7434
|
-
function S(e, i, l) {
|
|
7435
|
-
let c;
|
|
7436
|
-
if ("viewport" === i) c = function (t, e) {
|
|
7437
|
-
const o = n(t),
|
|
7438
|
-
i = R(t),
|
|
7439
|
-
r = o.visualViewport;
|
|
7440
|
-
let l = i.clientWidth,
|
|
7441
|
-
c = i.clientHeight,
|
|
7442
|
-
s = 0,
|
|
7443
|
-
f = 0;
|
|
7444
|
-
if (r) {
|
|
7445
|
-
l = r.width, c = r.height;
|
|
7446
|
-
const t = x();
|
|
7447
|
-
(!t || t && "fixed" === e) && (s = r.offsetLeft, f = r.offsetTop);
|
|
7448
|
-
}
|
|
7449
|
-
return {
|
|
7450
|
-
width: l,
|
|
7451
|
-
height: c,
|
|
7452
|
-
x: s,
|
|
7453
|
-
y: f
|
|
7454
|
-
};
|
|
7455
|
-
}(e, l);else if ("document" === i) c = function (t) {
|
|
7456
|
-
const e = R(t),
|
|
7457
|
-
n = T(t),
|
|
7458
|
-
i = t.ownerDocument.body,
|
|
7459
|
-
l = r(e.scrollWidth, e.clientWidth, i.scrollWidth, i.clientWidth),
|
|
7460
|
-
c = r(e.scrollHeight, e.clientHeight, i.scrollHeight, i.clientHeight);
|
|
7461
|
-
let s = -n.scrollLeft + C(t);
|
|
7462
|
-
const f = -n.scrollTop;
|
|
7463
|
-
return "rtl" === o(i).direction && (s += r(e.clientWidth, i.clientWidth) - l), {
|
|
7464
|
-
width: l,
|
|
7465
|
-
height: c,
|
|
7466
|
-
x: s,
|
|
7467
|
-
y: f
|
|
7468
|
-
};
|
|
7469
|
-
}(R(e));else if (d(i)) c = function (t, e) {
|
|
7470
|
-
const n = E(t, !0, "fixed" === e),
|
|
7471
|
-
o = n.top + t.clientTop,
|
|
7472
|
-
i = n.left + t.clientLeft,
|
|
7473
|
-
r = a(t) ? L(t) : {
|
|
7474
|
-
x: 1,
|
|
7475
|
-
y: 1
|
|
7476
|
-
};
|
|
7477
|
-
return {
|
|
7478
|
-
width: t.clientWidth * r.x,
|
|
7479
|
-
height: t.clientHeight * r.y,
|
|
7480
|
-
x: i * r.x,
|
|
7481
|
-
y: o * r.y
|
|
7482
|
-
};
|
|
7483
|
-
}(i, l);else {
|
|
7484
|
-
const t = {
|
|
7485
|
-
...i
|
|
7486
|
-
};
|
|
7487
|
-
if (x()) {
|
|
7488
|
-
var s, f;
|
|
7489
|
-
const o = n(e);
|
|
7490
|
-
t.x -= (null == (s = o.visualViewport) ? void 0 : s.offsetLeft) || 0, t.y -= (null == (f = o.visualViewport) ? void 0 : f.offsetTop) || 0;
|
|
7491
|
-
}
|
|
7492
|
-
c = t;
|
|
7493
|
-
}
|
|
7494
|
-
return l$1(c);
|
|
7495
|
-
}
|
|
7496
|
-
function A(t, e) {
|
|
7497
|
-
return a(t) && "fixed" !== o(t).position ? e ? e(t) : t.offsetParent : null;
|
|
7498
|
-
}
|
|
7499
|
-
function H(t, e) {
|
|
7500
|
-
const i = n(t);
|
|
7501
|
-
let r = A(t, e);
|
|
7502
|
-
for (; r && m(r) && "static" === o(r).position;) r = A(r, e);
|
|
7503
|
-
return r && ("html" === s(r) || "body" === s(r) && "static" === o(r).position && !y(r)) ? i : r || function (t) {
|
|
7504
|
-
let e = F(t);
|
|
7505
|
-
for (; a(e) && !w(e);) {
|
|
7506
|
-
if (y(e)) return e;
|
|
7507
|
-
e = F(e);
|
|
7508
|
-
}
|
|
7509
|
-
return null;
|
|
7510
|
-
}(t) || i;
|
|
7511
|
-
}
|
|
7512
|
-
function V(t, e, n) {
|
|
7513
|
-
const o = a(e),
|
|
7514
|
-
i = R(e),
|
|
7515
|
-
r = E(t, !0, "fixed" === n, e);
|
|
7516
|
-
let l = {
|
|
7517
|
-
scrollLeft: 0,
|
|
7518
|
-
scrollTop: 0
|
|
7519
|
-
};
|
|
7520
|
-
const c = {
|
|
7521
|
-
x: 0,
|
|
7522
|
-
y: 0
|
|
7523
|
-
};
|
|
7524
|
-
if (o || !o && "fixed" !== n) if (("body" !== s(e) || g(i)) && (l = T(e)), a(e)) {
|
|
7525
|
-
const t = E(e, !0);
|
|
7526
|
-
c.x = t.x + e.clientLeft, c.y = t.y + e.clientTop;
|
|
7527
|
-
} else i && (c.x = C(i));
|
|
7528
|
-
return {
|
|
7529
|
-
x: r.left + l.scrollLeft - c.x,
|
|
7530
|
-
y: r.top + l.scrollTop - c.y,
|
|
7531
|
-
width: r.width,
|
|
7532
|
-
height: r.height
|
|
7533
|
-
};
|
|
7534
|
-
}
|
|
7535
|
-
const O = {
|
|
7536
|
-
getClippingRect: function (t) {
|
|
7537
|
-
let {
|
|
7538
|
-
element: e,
|
|
7539
|
-
boundary: n,
|
|
7540
|
-
rootBoundary: l,
|
|
7541
|
-
strategy: c
|
|
7542
|
-
} = t;
|
|
7543
|
-
const f = "clippingAncestors" === n ? function (t, e) {
|
|
7544
|
-
const n = e.get(t);
|
|
7545
|
-
if (n) return n;
|
|
7546
|
-
let i = D(t).filter(t => d(t) && "body" !== s(t)),
|
|
7547
|
-
r = null;
|
|
7548
|
-
const l = "fixed" === o(t).position;
|
|
7549
|
-
let c = l ? F(t) : t;
|
|
7550
|
-
for (; d(c) && !w(c);) {
|
|
7551
|
-
const t = o(c),
|
|
7552
|
-
e = y(c);
|
|
7553
|
-
(l ? e || r : e || "static" !== t.position || !r || !["absolute", "fixed"].includes(r.position)) ? r = t : i = i.filter(t => t !== c), c = F(c);
|
|
7554
|
-
}
|
|
7555
|
-
return e.set(t, i), i;
|
|
7556
|
-
}(e, this._c) : [].concat(n),
|
|
7557
|
-
u = [...f, l],
|
|
7558
|
-
a = u[0],
|
|
7559
|
-
h = u.reduce((t, n) => {
|
|
7560
|
-
const o = S(e, n, c);
|
|
7561
|
-
return t.top = r(o.top, t.top), t.right = i(o.right, t.right), t.bottom = i(o.bottom, t.bottom), t.left = r(o.left, t.left), t;
|
|
7562
|
-
}, S(e, a, c));
|
|
7563
|
-
return {
|
|
7564
|
-
width: h.right - h.left,
|
|
7565
|
-
height: h.bottom - h.top,
|
|
7566
|
-
x: h.left,
|
|
7567
|
-
y: h.top
|
|
7568
|
-
};
|
|
7569
|
-
},
|
|
7570
|
-
convertOffsetParentRelativeRectToViewportRelativeRect: function (t) {
|
|
7571
|
-
let {
|
|
7572
|
-
rect: e,
|
|
7573
|
-
offsetParent: n,
|
|
7574
|
-
strategy: o
|
|
7575
|
-
} = t;
|
|
7576
|
-
const i = a(n),
|
|
7577
|
-
r = R(n);
|
|
7578
|
-
if (n === r) return e;
|
|
7579
|
-
let l = {
|
|
7580
|
-
scrollLeft: 0,
|
|
7581
|
-
scrollTop: 0
|
|
7582
|
-
},
|
|
7583
|
-
c = {
|
|
7584
|
-
x: 1,
|
|
7585
|
-
y: 1
|
|
7586
|
-
};
|
|
7587
|
-
const f = {
|
|
7588
|
-
x: 0,
|
|
7589
|
-
y: 0
|
|
7590
|
-
};
|
|
7591
|
-
if ((i || !i && "fixed" !== o) && (("body" !== s(n) || g(r)) && (l = T(n)), a(n))) {
|
|
7592
|
-
const t = E(n);
|
|
7593
|
-
c = L(n), f.x = t.x + n.clientLeft, f.y = t.y + n.clientTop;
|
|
7594
|
-
}
|
|
7595
|
-
return {
|
|
7596
|
-
width: e.width * c.x,
|
|
7597
|
-
height: e.height * c.y,
|
|
7598
|
-
x: e.x * c.x - l.scrollLeft * c.x + f.x,
|
|
7599
|
-
y: e.y * c.y - l.scrollTop * c.y + f.y
|
|
7600
|
-
};
|
|
7601
|
-
},
|
|
7602
|
-
isElement: d,
|
|
7603
|
-
getDimensions: function (t) {
|
|
7604
|
-
return a(t) ? c(t) : t.getBoundingClientRect();
|
|
7605
|
-
},
|
|
7606
|
-
getOffsetParent: H,
|
|
7607
|
-
getDocumentElement: R,
|
|
7608
|
-
getScale: L,
|
|
7609
|
-
async getElementRects(t) {
|
|
7610
|
-
let {
|
|
7611
|
-
reference: e,
|
|
7612
|
-
floating: n,
|
|
7613
|
-
strategy: o
|
|
7614
|
-
} = t;
|
|
7615
|
-
const i = this.getOffsetParent || H,
|
|
7616
|
-
r = this.getDimensions;
|
|
7617
|
-
return {
|
|
7618
|
-
reference: V(e, await i(n), o),
|
|
7619
|
-
floating: {
|
|
7620
|
-
x: 0,
|
|
7621
|
-
y: 0,
|
|
7622
|
-
...(await r(n))
|
|
7623
|
-
}
|
|
7624
|
-
};
|
|
7625
|
-
},
|
|
7626
|
-
getClientRects: t => Array.from(t.getClientRects()),
|
|
7627
|
-
isRTL: t => "rtl" === o(t).direction
|
|
7628
|
-
};
|
|
7629
|
-
function P(t, e, n, o) {
|
|
7630
|
-
void 0 === o && (o = {});
|
|
7631
|
-
const {
|
|
7632
|
-
ancestorScroll: i = !0,
|
|
7633
|
-
ancestorResize: r = !0,
|
|
7634
|
-
elementResize: l = !0,
|
|
7635
|
-
animationFrame: c = !1
|
|
7636
|
-
} = o,
|
|
7637
|
-
s = i && !c,
|
|
7638
|
-
f = s || r ? [...(d(t) ? D(t) : t.contextElement ? D(t.contextElement) : []), ...D(e)] : [];
|
|
7639
|
-
f.forEach(t => {
|
|
7640
|
-
s && t.addEventListener("scroll", n, {
|
|
7641
|
-
passive: !0
|
|
7642
|
-
}), r && t.addEventListener("resize", n);
|
|
7643
|
-
});
|
|
7644
|
-
let u,
|
|
7645
|
-
a = null;
|
|
7646
|
-
if (l) {
|
|
7647
|
-
let o = !0;
|
|
7648
|
-
a = new ResizeObserver(() => {
|
|
7649
|
-
o || n(), o = !1;
|
|
7650
|
-
}), d(t) && !c && a.observe(t), d(t) || !t.contextElement || c || a.observe(t.contextElement), a.observe(e);
|
|
7651
|
-
}
|
|
7652
|
-
let h = c ? E(t) : null;
|
|
7653
|
-
return c && function e() {
|
|
7654
|
-
const o = E(t);
|
|
7655
|
-
!h || o.x === h.x && o.y === h.y && o.width === h.width && o.height === h.height || n();
|
|
7656
|
-
h = o, u = requestAnimationFrame(e);
|
|
7657
|
-
}(), n(), () => {
|
|
7658
|
-
var t;
|
|
7659
|
-
f.forEach(t => {
|
|
7660
|
-
s && t.removeEventListener("scroll", n), r && t.removeEventListener("resize", n);
|
|
7661
|
-
}), null == (t = a) || t.disconnect(), a = null, c && cancelAnimationFrame(u);
|
|
7662
|
-
};
|
|
7663
|
-
}
|
|
7664
|
-
const z = (t, n, o) => {
|
|
7665
|
-
const i = new Map(),
|
|
7666
|
-
r = {
|
|
7667
|
-
platform: O,
|
|
7668
|
-
...o
|
|
7669
|
-
},
|
|
7670
|
-
l = {
|
|
7671
|
-
...r.platform,
|
|
7672
|
-
_c: i
|
|
7673
|
-
};
|
|
7674
|
-
return i$1(t, n, {
|
|
7675
|
-
...r,
|
|
7676
|
-
platform: l
|
|
7677
|
-
});
|
|
7678
|
-
};
|
|
7679
|
-
|
|
7680
6745
|
const MenuItemRole = {
|
|
7681
6746
|
/**
|
|
7682
6747
|
* The menu item has a "menuitem" role
|
|
@@ -7710,7 +6775,6 @@ class MenuItem extends FASTElement {
|
|
|
7710
6775
|
super(...arguments);
|
|
7711
6776
|
this.role = MenuItemRole.menuitem;
|
|
7712
6777
|
this.checked = false;
|
|
7713
|
-
this.focusSubmenuOnLoad = false;
|
|
7714
6778
|
/**
|
|
7715
6779
|
* @internal
|
|
7716
6780
|
*/
|
|
@@ -7724,19 +6788,16 @@ class MenuItem extends FASTElement {
|
|
|
7724
6788
|
this.invoke();
|
|
7725
6789
|
return false;
|
|
7726
6790
|
case keyArrowRight:
|
|
7727
|
-
|
|
7728
|
-
|
|
7729
|
-
|
|
7730
|
-
if (this.expanded) {
|
|
7731
|
-
this.closeSubMenu();
|
|
7732
|
-
return false;
|
|
6791
|
+
if (!this.disabled) {
|
|
6792
|
+
this.submenu?.togglePopover(true);
|
|
6793
|
+
this.submenu?.focus();
|
|
7733
6794
|
}
|
|
7734
|
-
|
|
6795
|
+
return false;
|
|
7735
6796
|
case keyArrowLeft:
|
|
7736
|
-
if (this.
|
|
7737
|
-
this.
|
|
7738
|
-
return false;
|
|
6797
|
+
if (this.parentElement?.hasAttribute("popover")) {
|
|
6798
|
+
this.parentElement.togglePopover(false);
|
|
7739
6799
|
}
|
|
6800
|
+
return false;
|
|
7740
6801
|
}
|
|
7741
6802
|
return true;
|
|
7742
6803
|
};
|
|
@@ -7750,55 +6811,40 @@ class MenuItem extends FASTElement {
|
|
|
7750
6811
|
this.invoke();
|
|
7751
6812
|
return false;
|
|
7752
6813
|
};
|
|
7753
|
-
/**
|
|
7754
|
-
* @internal
|
|
7755
|
-
*/
|
|
7756
|
-
this.submenuLoaded = () => {
|
|
7757
|
-
if (!this.focusSubmenuOnLoad) {
|
|
7758
|
-
return;
|
|
7759
|
-
}
|
|
7760
|
-
this.focusSubmenuOnLoad = false;
|
|
7761
|
-
if (this.submenu) {
|
|
7762
|
-
this.submenu.focus();
|
|
7763
|
-
this.setAttribute("tabindex", "-1");
|
|
7764
|
-
}
|
|
7765
|
-
};
|
|
7766
6814
|
/**
|
|
7767
6815
|
* @internal
|
|
7768
6816
|
*/
|
|
7769
6817
|
this.handleMouseOver = e => {
|
|
7770
|
-
if (this.disabled
|
|
6818
|
+
if (this.disabled) {
|
|
7771
6819
|
return false;
|
|
7772
6820
|
}
|
|
7773
|
-
this.
|
|
6821
|
+
this.submenu?.togglePopover(true);
|
|
7774
6822
|
return false;
|
|
7775
6823
|
};
|
|
7776
6824
|
/**
|
|
7777
6825
|
* @internal
|
|
7778
6826
|
*/
|
|
7779
6827
|
this.handleMouseOut = e => {
|
|
7780
|
-
if (
|
|
6828
|
+
if (this.contains(document.activeElement)) {
|
|
7781
6829
|
return false;
|
|
7782
6830
|
}
|
|
7783
|
-
this.
|
|
6831
|
+
this.submenu?.togglePopover(false);
|
|
7784
6832
|
return false;
|
|
7785
6833
|
};
|
|
7786
6834
|
/**
|
|
6835
|
+
* Setup required ARIA on open/close
|
|
7787
6836
|
* @internal
|
|
7788
6837
|
*/
|
|
7789
|
-
this.
|
|
7790
|
-
|
|
7791
|
-
|
|
7792
|
-
|
|
7793
|
-
|
|
7794
|
-
|
|
7795
|
-
|
|
7796
|
-
|
|
7797
|
-
|
|
7798
|
-
return;
|
|
6838
|
+
this.toggleHandler = e => {
|
|
6839
|
+
if (e instanceof ToggleEvent && e.newState === "open") {
|
|
6840
|
+
this.setAttribute("tabindex", "-1");
|
|
6841
|
+
this.setAttribute("aria-expanded", "true");
|
|
6842
|
+
this.setSubmenuPosition();
|
|
6843
|
+
}
|
|
6844
|
+
if (e instanceof ToggleEvent && e.newState === "closed") {
|
|
6845
|
+
this.setAttribute("aria-expanded", "false");
|
|
6846
|
+
this.setAttribute("tabindex", "0");
|
|
7799
6847
|
}
|
|
7800
|
-
this.focusSubmenuOnLoad = true;
|
|
7801
|
-
this.expanded = true;
|
|
7802
6848
|
};
|
|
7803
6849
|
/**
|
|
7804
6850
|
* @internal
|
|
@@ -7812,8 +6858,9 @@ class MenuItem extends FASTElement {
|
|
|
7812
6858
|
this.checked = !this.checked;
|
|
7813
6859
|
break;
|
|
7814
6860
|
case MenuItemRole.menuitem:
|
|
7815
|
-
if (this.
|
|
7816
|
-
this.
|
|
6861
|
+
if (!!this.submenu) {
|
|
6862
|
+
this.submenu.togglePopover(true);
|
|
6863
|
+
this.submenu.focus();
|
|
7817
6864
|
break;
|
|
7818
6865
|
}
|
|
7819
6866
|
this.$emit("change");
|
|
@@ -7825,94 +6872,49 @@ class MenuItem extends FASTElement {
|
|
|
7825
6872
|
break;
|
|
7826
6873
|
}
|
|
7827
6874
|
};
|
|
7828
|
-
|
|
7829
|
-
|
|
7830
|
-
|
|
7831
|
-
|
|
7832
|
-
|
|
6875
|
+
/**
|
|
6876
|
+
* Set fallback position of menu on open when CSS anchor not supported
|
|
6877
|
+
* @internal
|
|
6878
|
+
*/
|
|
6879
|
+
this.setSubmenuPosition = () => {
|
|
6880
|
+
if (!CSS.supports("anchor-name", "--anchor") && !!this.submenu) {
|
|
6881
|
+
const thisRect = this.getBoundingClientRect();
|
|
6882
|
+
const thisSubmenuRect = this.submenu.getBoundingClientRect();
|
|
6883
|
+
const inlineEnd = getComputedStyle(this).direction === "ltr" ? "right" : "left";
|
|
6884
|
+
if (thisRect.width + thisSubmenuRect.width > window.innerWidth * 0.75) {
|
|
6885
|
+
this.submenu.style.translate = "0 -100%";
|
|
6886
|
+
return;
|
|
6887
|
+
}
|
|
6888
|
+
if (thisRect[inlineEnd] + thisSubmenuRect.width > window.innerWidth) {
|
|
6889
|
+
this.submenu.style.translate = "-100% 0";
|
|
6890
|
+
return;
|
|
6891
|
+
}
|
|
6892
|
+
this.submenu.style.translate = `${thisRect.width - 8}px 0`;
|
|
7833
6893
|
}
|
|
7834
|
-
|
|
7835
|
-
bubbles: false
|
|
7836
|
-
});
|
|
7837
|
-
}
|
|
6894
|
+
};
|
|
7838
6895
|
}
|
|
7839
6896
|
checkedChanged(oldValue, newValue) {
|
|
7840
6897
|
if (this.$fastController.isConnected) {
|
|
7841
6898
|
this.$emit("change");
|
|
7842
6899
|
}
|
|
7843
6900
|
}
|
|
7844
|
-
/**
|
|
7845
|
-
* @internal
|
|
7846
|
-
*/
|
|
7847
|
-
get hasSubmenu() {
|
|
7848
|
-
return !!this.submenu;
|
|
7849
|
-
}
|
|
7850
6901
|
/**
|
|
7851
6902
|
* Sets the submenu and updates its position.
|
|
7852
6903
|
*
|
|
7853
6904
|
* @internal
|
|
7854
6905
|
*/
|
|
7855
6906
|
slottedSubmenuChanged(prev, next) {
|
|
6907
|
+
this.submenu?.removeEventListener("toggle", this.toggleHandler);
|
|
7856
6908
|
if (next.length) {
|
|
7857
6909
|
this.submenu = next[0];
|
|
7858
|
-
this.
|
|
6910
|
+
this.submenu.toggleAttribute("popover", true);
|
|
6911
|
+
this.submenu.addEventListener("toggle", this.toggleHandler);
|
|
7859
6912
|
}
|
|
7860
6913
|
}
|
|
7861
|
-
/**
|
|
7862
|
-
* @internal
|
|
7863
|
-
*/
|
|
7864
|
-
disconnectedCallback() {
|
|
7865
|
-
this.cleanup?.();
|
|
7866
|
-
super.disconnectedCallback();
|
|
7867
|
-
}
|
|
7868
|
-
/**
|
|
7869
|
-
* Calculate and apply submenu positioning.
|
|
7870
|
-
*
|
|
7871
|
-
* @public
|
|
7872
|
-
*/
|
|
7873
|
-
updateSubmenu() {
|
|
7874
|
-
this.cleanup?.();
|
|
7875
|
-
if (!this.submenu || !this.expanded) {
|
|
7876
|
-
return;
|
|
7877
|
-
}
|
|
7878
|
-
Updates.enqueue(() => {
|
|
7879
|
-
this.cleanup = P(this, this.submenuContainer, async () => {
|
|
7880
|
-
const fallbackPlacements = ["left-start", "right-start"];
|
|
7881
|
-
const {
|
|
7882
|
-
x,
|
|
7883
|
-
y
|
|
7884
|
-
} = await z(this, this.submenuContainer, {
|
|
7885
|
-
middleware: [E$1(), k({
|
|
7886
|
-
apply: ({
|
|
7887
|
-
availableWidth,
|
|
7888
|
-
rects
|
|
7889
|
-
}) => {
|
|
7890
|
-
if (availableWidth < rects.floating.width) {
|
|
7891
|
-
fallbackPlacements.push("bottom-end", "top-end");
|
|
7892
|
-
}
|
|
7893
|
-
}
|
|
7894
|
-
}), b$1({
|
|
7895
|
-
fallbackPlacements
|
|
7896
|
-
})],
|
|
7897
|
-
placement: "right-start",
|
|
7898
|
-
strategy: "fixed"
|
|
7899
|
-
});
|
|
7900
|
-
Object.assign(this.submenuContainer.style, {
|
|
7901
|
-
left: `${x}px`,
|
|
7902
|
-
position: "fixed",
|
|
7903
|
-
top: `${y}px`
|
|
7904
|
-
});
|
|
7905
|
-
this.submenuLoaded();
|
|
7906
|
-
});
|
|
7907
|
-
});
|
|
7908
|
-
}
|
|
7909
6914
|
}
|
|
7910
6915
|
__decorateClass$c([attr({
|
|
7911
6916
|
mode: "boolean"
|
|
7912
6917
|
})], MenuItem.prototype, "disabled", 2);
|
|
7913
|
-
__decorateClass$c([attr({
|
|
7914
|
-
mode: "boolean"
|
|
7915
|
-
})], MenuItem.prototype, "expanded", 2);
|
|
7916
6918
|
__decorateClass$c([attr], MenuItem.prototype, "role", 2);
|
|
7917
6919
|
__decorateClass$c([attr({
|
|
7918
6920
|
mode: "boolean"
|
|
@@ -7927,20 +6929,20 @@ applyMixins(MenuItem, StartEnd);
|
|
|
7927
6929
|
const styles$e = css`
|
|
7928
6930
|
${display("grid")}
|
|
7929
6931
|
|
|
7930
|
-
:host{
|
|
6932
|
+
:host{--indent:0;align-items:center;background:${colorNeutralBackground1};border-radius:${borderRadiusMedium};color:${colorNeutralForeground2};contain:layout;cursor:pointer;flex-shrink:0;font:${fontWeightRegular} ${fontSizeBase300} / ${lineHeightBase300} ${fontFamilyBase};grid-gap:4px;grid-template-columns:20px 20px auto 20px;height:32px;overflow:visible;padding:0 10px}:host(:hover){background:${colorNeutralBackground1Hover};color:${colorNeutralForeground2Hover}}:host([icon]:hover) ::slotted([slot='start']){color:${colorCompoundBrandForeground1Hover}}:host(:active){background-color:${colorNeutralBackground1Selected};color:${colorNeutralForeground2Pressed}}:host(:active) ::slotted([slot='start']){color:${colorCompoundBrandForeground1Pressed}}:host([disabled]){background-color:${colorNeutralBackgroundDisabled};color:${colorNeutralForegroundDisabled}}:host([disabled]) ::slotted([slot='start']),:host([disabled]) ::slotted([slot='end']){color:${colorNeutralForegroundDisabled}}:host(:focus-visible){border-radius:${borderRadiusMedium};outline:2px solid ${colorStrokeFocus2}}.content{white-space:nowrap;flex-grow:1;grid-column:auto / span 2;padding:0 2px}:host(:not([checked])) .indicator,:host(:not([checked])) ::slotted([slot='indicator']),:host(:not([aria-haspopup='menu'])) .submenu-glyph,:host(:not([aria-haspopup='menu'])) ::slotted([slot='submenu-glyph']){display:none}::slotted([slot='end']){color:${colorNeutralForeground3};font:${fontWeightRegular} ${fontSizeBase200} / ${lineHeightBase200} ${fontFamilyBase};white-space:nowrap}:host([data-indent='1']){--indent:1}:host([data-indent='2']){--indent:2;grid-template-columns:20px 20px auto auto}:host([aria-haspopup='menu']){grid-template-columns:20px auto auto 20px}:host([data-indent='2'][aria-haspopup='menu']){grid-template-columns:20px 20px auto auto 20px}.indicator,::slotted([slot='indicator']){grid-column:1 / span 1;width:20px}::slotted([slot='start']){display:inline-flex;grid-column:calc(var(--indent)) / span 1}.content{grid-column:calc(var(--indent) + 1) / span 1}::slotted([slot='end']){grid-column:calc(var(--indent) + 2) / span 1;justify-self:end}.submenu-glyph,::slotted([slot='submenu-glyph']){grid-column:-2 / span 1;justify-self:end}@layer popover{:host{anchor-name:--menu-trigger;position:relative}::slotted([popover]){inset-area:inline-end span-block-end;margin:0;max-height:var(--menu-max-height,auto);position:absolute;position-anchor:--menu-trigger;position-try-options:flip-inline,inset-area(block-start);z-index:1}::slotted([popover]:not(:popover-open)){display:none}::slotted([popover]:popover-open){inset:unset}}`.withBehaviors(forcedColorsStylesheetBehavior(css`
|
|
6933
|
+
:host([disabled]),:host([disabled]) ::slotted([slot='start']),:host([disabled]) ::slotted([slot='end']){color:GrayText}`));
|
|
7931
6934
|
|
|
7932
|
-
const Checkmark16Filled = html.partial(`<svg
|
|
7933
|
-
const chevronRight16Filled = html.partial(`<svg
|
|
6935
|
+
const Checkmark16Filled = html.partial(`<svg class="indicator" fill="currentColor" aria-hidden="true" width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><path d="M14.05 3.49c.28.3.27.77-.04 1.06l-7.93 7.47A.85.85 0 014.9 12L2.22 9.28a.75.75 0 111.06-1.06l2.24 2.27 7.47-7.04a.75.75 0 011.06.04z" fill="currentColor"></path></svg>`);
|
|
6936
|
+
const chevronRight16Filled = html.partial(`<svg class="submenu-glyph" fill="currentColor" aria-hidden="true" width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><path d="M5.74 3.2a.75.75 0 00-.04 1.06L9.23 8 5.7 11.74a.75.75 0 101.1 1.02l4-4.25a.75.75 0 000-1.02l-4-4.25a.75.75 0 00-1.06-.04z" fill="currentColor"></path></svg>`);
|
|
7934
6937
|
function menuItemTemplate(options = {}) {
|
|
7935
|
-
return html`<template aria-haspopup="${x => x.
|
|
6938
|
+
return html`<template aria-haspopup="${x => !!x.submenu ? "menu" : void 0}" aria-checked="${x => x.role !== MenuItemRole.menuitem ? x.checked : void 0}" aria-disabled="${x => x.disabled}" aria-expanded="${x => !!x.submenu ? "false" : void 0}" @keydown="${(x, c) => x.handleMenuItemKeyDown(c.event)}" @click="${(x, c) => x.handleMenuItemClick(c.event)}" @mouseover="${(x, c) => x.handleMouseOver(c.event)}" @mouseout="${(x, c) => x.handleMouseOut(c.event)}" @toggle="${(x, c) => x.toggleHandler(c.event)}"><slot name="indicator">${staticallyCompose(options.indicator)}</slot>${startSlotTemplate(options)}<div part="content" class="content"><slot></slot></div>${endSlotTemplate(options)}<slot name="submenu-glyph">${staticallyCompose(options.submenuGlyph)}</slot><slot name="submenu" ${slotted({
|
|
7936
6939
|
property: "slottedSubmenu",
|
|
7937
6940
|
filter: elements("[role='menu']")
|
|
7938
|
-
})}></slot></
|
|
6941
|
+
})}></slot></template>`;
|
|
7939
6942
|
}
|
|
7940
6943
|
const template$e = menuItemTemplate({
|
|
7941
|
-
|
|
7942
|
-
|
|
7943
|
-
radioIndicator: Checkmark16Filled
|
|
6944
|
+
indicator: Checkmark16Filled,
|
|
6945
|
+
submenuGlyph: chevronRight16Filled
|
|
7944
6946
|
});
|
|
7945
6947
|
|
|
7946
6948
|
const definition$e = MenuItem.compose({
|
|
@@ -7962,7 +6964,6 @@ var __decorateClass$b = (decorators, target, key, kind) => {
|
|
|
7962
6964
|
const _MenuList = class _MenuList extends FASTElement {
|
|
7963
6965
|
constructor() {
|
|
7964
6966
|
super(...arguments);
|
|
7965
|
-
this.expandedItem = null;
|
|
7966
6967
|
/**
|
|
7967
6968
|
* The index of the focusable element in the items array
|
|
7968
6969
|
* defaults to -1
|
|
@@ -7980,7 +6981,6 @@ const _MenuList = class _MenuList extends FASTElement {
|
|
|
7980
6981
|
*/
|
|
7981
6982
|
this.handleFocusOut = e => {
|
|
7982
6983
|
if (!this.contains(e.relatedTarget) && this.menuItems !== void 0) {
|
|
7983
|
-
this.collapseExpandedItem();
|
|
7984
6984
|
const focusIndex = this.menuItems.findIndex(this.isFocusableElement);
|
|
7985
6985
|
this.menuItems[this.focusIndex].setAttribute("tabindex", "-1");
|
|
7986
6986
|
this.menuItems[focusIndex].setAttribute("tabindex", "0");
|
|
@@ -7995,30 +6995,10 @@ const _MenuList = class _MenuList extends FASTElement {
|
|
|
7995
6995
|
targetItem.setAttribute("tabindex", "0");
|
|
7996
6996
|
}
|
|
7997
6997
|
};
|
|
7998
|
-
this.handleExpandedChanged = e => {
|
|
7999
|
-
if (e.defaultPrevented || e.target === null || this.menuItems === void 0 || this.menuItems.indexOf(e.target) < 0) {
|
|
8000
|
-
return;
|
|
8001
|
-
}
|
|
8002
|
-
e.preventDefault();
|
|
8003
|
-
const changedItem = e.target;
|
|
8004
|
-
if (this.expandedItem !== null && changedItem === this.expandedItem && changedItem.expanded === false) {
|
|
8005
|
-
this.expandedItem = null;
|
|
8006
|
-
return;
|
|
8007
|
-
}
|
|
8008
|
-
if (changedItem.expanded) {
|
|
8009
|
-
if (this.expandedItem !== null && this.expandedItem !== changedItem) {
|
|
8010
|
-
this.expandedItem.expanded = false;
|
|
8011
|
-
}
|
|
8012
|
-
this.menuItems[this.focusIndex].setAttribute("tabindex", "-1");
|
|
8013
|
-
this.expandedItem = changedItem;
|
|
8014
|
-
this.focusIndex = this.menuItems.indexOf(changedItem);
|
|
8015
|
-
changedItem.setAttribute("tabindex", "0");
|
|
8016
|
-
}
|
|
8017
|
-
};
|
|
8018
6998
|
/**
|
|
8019
|
-
*
|
|
6999
|
+
* Handle change from child MenuItem element and set radio group behavior
|
|
8020
7000
|
*/
|
|
8021
|
-
this.
|
|
7001
|
+
this.changedMenuItemHandler = e => {
|
|
8022
7002
|
if (this.menuItems === void 0) {
|
|
8023
7003
|
return;
|
|
8024
7004
|
}
|
|
@@ -8077,7 +7057,7 @@ const _MenuList = class _MenuList extends FASTElement {
|
|
|
8077
7057
|
Updates.enqueue(() => {
|
|
8078
7058
|
this.setItems();
|
|
8079
7059
|
});
|
|
8080
|
-
this.addEventListener("change", this.
|
|
7060
|
+
this.addEventListener("change", this.changedMenuItemHandler);
|
|
8081
7061
|
}
|
|
8082
7062
|
/**
|
|
8083
7063
|
* @internal
|
|
@@ -8086,7 +7066,7 @@ const _MenuList = class _MenuList extends FASTElement {
|
|
|
8086
7066
|
super.disconnectedCallback();
|
|
8087
7067
|
this.removeItemListeners();
|
|
8088
7068
|
this.menuItems = void 0;
|
|
8089
|
-
this.removeEventListener("change", this.
|
|
7069
|
+
this.removeEventListener("change", this.changedMenuItemHandler);
|
|
8090
7070
|
}
|
|
8091
7071
|
/**
|
|
8092
7072
|
* Focuses the first item in the menu.
|
|
@@ -8096,17 +7076,6 @@ const _MenuList = class _MenuList extends FASTElement {
|
|
|
8096
7076
|
focus() {
|
|
8097
7077
|
this.setFocus(0, 1);
|
|
8098
7078
|
}
|
|
8099
|
-
/**
|
|
8100
|
-
* Collapses any expanded menu items.
|
|
8101
|
-
*
|
|
8102
|
-
* @public
|
|
8103
|
-
*/
|
|
8104
|
-
collapseExpandedItem() {
|
|
8105
|
-
if (this.expandedItem !== null) {
|
|
8106
|
-
this.expandedItem.expanded = false;
|
|
8107
|
-
this.expandedItem = null;
|
|
8108
|
-
}
|
|
8109
|
-
}
|
|
8110
7079
|
/**
|
|
8111
7080
|
* @internal
|
|
8112
7081
|
*/
|
|
@@ -8134,7 +7103,6 @@ const _MenuList = class _MenuList extends FASTElement {
|
|
|
8134
7103
|
removeItemListeners(items = this.items) {
|
|
8135
7104
|
items.forEach(item => {
|
|
8136
7105
|
item.removeEventListener("focus", this.handleItemFocus);
|
|
8137
|
-
item.removeEventListener("expanded-changed", this.handleExpandedChanged);
|
|
8138
7106
|
Observable.getNotifier(item).unsubscribe(this, "hidden");
|
|
8139
7107
|
});
|
|
8140
7108
|
}
|
|
@@ -8158,20 +7126,22 @@ const _MenuList = class _MenuList extends FASTElement {
|
|
|
8158
7126
|
}
|
|
8159
7127
|
menuItems.forEach((item, index) => {
|
|
8160
7128
|
item.setAttribute("tabindex", index === 0 ? "0" : "-1");
|
|
8161
|
-
item.addEventListener("expanded-change", this.handleExpandedChanged);
|
|
8162
7129
|
item.addEventListener("focus", this.handleItemFocus);
|
|
8163
7130
|
});
|
|
8164
7131
|
const filteredMenuListItems = this.menuItems?.filter(this.isMenuItemElement);
|
|
8165
|
-
filteredMenuListItems?.
|
|
8166
|
-
const
|
|
8167
|
-
|
|
8168
|
-
|
|
8169
|
-
|
|
7132
|
+
const indent = filteredMenuListItems?.reduce((accum, current) => {
|
|
7133
|
+
const elementValue = _MenuList.elementIndent(current);
|
|
7134
|
+
return Math.max(accum, elementValue);
|
|
7135
|
+
}, 0);
|
|
7136
|
+
filteredMenuListItems?.forEach(item => {
|
|
8170
7137
|
if (item instanceof MenuItem) {
|
|
8171
7138
|
item.setAttribute("data-indent", `${indent}`);
|
|
8172
7139
|
}
|
|
8173
7140
|
});
|
|
8174
7141
|
}
|
|
7142
|
+
/**
|
|
7143
|
+
* Method for Observable changes to the hidden attribute of child elements
|
|
7144
|
+
*/
|
|
8175
7145
|
handleChange(source, propertyName) {
|
|
8176
7146
|
if (propertyName === "hidden") {
|
|
8177
7147
|
this.setItems();
|
|
@@ -8233,26 +7203,26 @@ class Menu extends FASTElement {
|
|
|
8233
7203
|
this.openOnContext = false;
|
|
8234
7204
|
this.closeOnScroll = false;
|
|
8235
7205
|
this.persistOnItemClick = false;
|
|
8236
|
-
this.open = false;
|
|
8237
7206
|
this.slottedMenuList = [];
|
|
8238
7207
|
this.slottedTriggers = [];
|
|
7208
|
+
/**
|
|
7209
|
+
* Defines whether the menu is open or not.
|
|
7210
|
+
* @internal
|
|
7211
|
+
*/
|
|
7212
|
+
this._open = false;
|
|
8239
7213
|
/**
|
|
8240
7214
|
* Toggles the open state of the menu.
|
|
8241
7215
|
* @public
|
|
8242
7216
|
*/
|
|
8243
7217
|
this.toggleMenu = () => {
|
|
8244
|
-
|
|
8245
|
-
this.closeMenu();
|
|
8246
|
-
} else {
|
|
8247
|
-
this.openMenu();
|
|
8248
|
-
}
|
|
7218
|
+
this._menuList?.togglePopover(!this._open);
|
|
8249
7219
|
};
|
|
8250
7220
|
/**
|
|
8251
7221
|
* Closes the menu.
|
|
8252
7222
|
* @public
|
|
8253
7223
|
*/
|
|
8254
7224
|
this.closeMenu = () => {
|
|
8255
|
-
this.
|
|
7225
|
+
this._menuList?.togglePopover(false);
|
|
8256
7226
|
if (this.closeOnScroll) {
|
|
8257
7227
|
document.removeEventListener("scroll", this.closeMenu);
|
|
8258
7228
|
}
|
|
@@ -8262,7 +7232,7 @@ class Menu extends FASTElement {
|
|
|
8262
7232
|
* @public
|
|
8263
7233
|
*/
|
|
8264
7234
|
this.openMenu = e => {
|
|
8265
|
-
this.
|
|
7235
|
+
this._menuList?.togglePopover(true);
|
|
8266
7236
|
if (e && this.openOnContext) {
|
|
8267
7237
|
e.preventDefault();
|
|
8268
7238
|
}
|
|
@@ -8271,11 +7241,18 @@ class Menu extends FASTElement {
|
|
|
8271
7241
|
}
|
|
8272
7242
|
};
|
|
8273
7243
|
/**
|
|
8274
|
-
*
|
|
8275
|
-
* @
|
|
7244
|
+
* Handles the 'toggle' event on the popover.
|
|
7245
|
+
* @public
|
|
7246
|
+
* @param e - the event
|
|
7247
|
+
* @returns void
|
|
8276
7248
|
*/
|
|
8277
|
-
this.
|
|
8278
|
-
|
|
7249
|
+
this.toggleHandler = e => {
|
|
7250
|
+
if (e instanceof ToggleEvent) {
|
|
7251
|
+
const newState = e.newState === "open" ? true : false;
|
|
7252
|
+
this._trigger?.setAttribute("aria-expanded", `${newState}`);
|
|
7253
|
+
this._open = newState;
|
|
7254
|
+
this.focusMenuList();
|
|
7255
|
+
}
|
|
8279
7256
|
};
|
|
8280
7257
|
/**
|
|
8281
7258
|
* Handles keyboard interaction for the trigger. Toggles the menu when the Space or Enter key is pressed. If the menu
|
|
@@ -8284,7 +7261,7 @@ class Menu extends FASTElement {
|
|
|
8284
7261
|
* @param e - the keyboard event
|
|
8285
7262
|
* @public
|
|
8286
7263
|
*/
|
|
8287
|
-
this.
|
|
7264
|
+
this.triggerKeydownHandler = e => {
|
|
8288
7265
|
if (e.defaultPrevented) {
|
|
8289
7266
|
return;
|
|
8290
7267
|
}
|
|
@@ -8294,21 +7271,18 @@ class Menu extends FASTElement {
|
|
|
8294
7271
|
case keyEnter:
|
|
8295
7272
|
e.preventDefault();
|
|
8296
7273
|
this.toggleMenu();
|
|
8297
|
-
if (this.open) {
|
|
8298
|
-
this.focusMenuList();
|
|
8299
|
-
}
|
|
8300
7274
|
break;
|
|
8301
7275
|
default:
|
|
8302
7276
|
return true;
|
|
8303
7277
|
}
|
|
8304
7278
|
};
|
|
8305
7279
|
/**
|
|
8306
|
-
* Handles document click events to close
|
|
7280
|
+
* Handles document click events to close a menu opened with contextmenu in popover="manual" mode.
|
|
8307
7281
|
* @internal
|
|
8308
7282
|
* @param e - The event triggered on document click.
|
|
8309
7283
|
*/
|
|
8310
|
-
this.
|
|
8311
|
-
if (
|
|
7284
|
+
this.documentClickHandler = e => {
|
|
7285
|
+
if (!e.composedPath().some(el => el === this._trigger || el === this._menuList)) {
|
|
8312
7286
|
this.closeMenu();
|
|
8313
7287
|
}
|
|
8314
7288
|
};
|
|
@@ -8329,7 +7303,6 @@ class Menu extends FASTElement {
|
|
|
8329
7303
|
*/
|
|
8330
7304
|
disconnectedCallback() {
|
|
8331
7305
|
super.disconnectedCallback();
|
|
8332
|
-
this.cleanup?.();
|
|
8333
7306
|
this.removeListeners();
|
|
8334
7307
|
}
|
|
8335
7308
|
/**
|
|
@@ -8342,7 +7315,8 @@ class Menu extends FASTElement {
|
|
|
8342
7315
|
this._trigger = this.slottedTriggers[0];
|
|
8343
7316
|
this._menuList = this.slottedMenuList[0];
|
|
8344
7317
|
this._trigger.setAttribute("aria-haspopup", "true");
|
|
8345
|
-
this._trigger.setAttribute("aria-expanded", `${this.
|
|
7318
|
+
this._trigger.setAttribute("aria-expanded", `${this._open}`);
|
|
7319
|
+
this._menuList.setAttribute("popover", this.openOnContext ? "manual" : "");
|
|
8346
7320
|
this.addListeners();
|
|
8347
7321
|
}
|
|
8348
7322
|
}
|
|
@@ -8351,43 +7325,17 @@ class Menu extends FASTElement {
|
|
|
8351
7325
|
* @public
|
|
8352
7326
|
*/
|
|
8353
7327
|
focusMenuList() {
|
|
8354
|
-
|
|
8355
|
-
|
|
8356
|
-
|
|
8357
|
-
});
|
|
8358
|
-
}
|
|
7328
|
+
Updates.enqueue(() => {
|
|
7329
|
+
this._menuList.focus();
|
|
7330
|
+
});
|
|
8359
7331
|
}
|
|
8360
7332
|
/**
|
|
8361
7333
|
* Focuses on the menu trigger.
|
|
8362
7334
|
* @public
|
|
8363
7335
|
*/
|
|
8364
7336
|
focusTrigger() {
|
|
8365
|
-
|
|
8366
|
-
|
|
8367
|
-
this._trigger.focus();
|
|
8368
|
-
});
|
|
8369
|
-
}
|
|
8370
|
-
}
|
|
8371
|
-
/**
|
|
8372
|
-
* Called whenever the open state changes.
|
|
8373
|
-
* Updates the 'aria-expanded' attribute and sets the positioning of the menu.
|
|
8374
|
-
* Sets menu list position
|
|
8375
|
-
* emits openChanged event
|
|
8376
|
-
*
|
|
8377
|
-
* @param oldValue - The previous value of 'open'.
|
|
8378
|
-
* @param newValue - The new value of 'open'.
|
|
8379
|
-
* @public
|
|
8380
|
-
*/
|
|
8381
|
-
openChanged(oldValue, newValue) {
|
|
8382
|
-
if (this.$fastController.isConnected && this._trigger instanceof HTMLElement) {
|
|
8383
|
-
this._trigger.setAttribute("aria-expanded", `${this.open}`);
|
|
8384
|
-
if (this._menuList && this.open) {
|
|
8385
|
-
Updates.enqueue(this.setPositioningTask);
|
|
8386
|
-
}
|
|
8387
|
-
}
|
|
8388
|
-
this.cleanup?.();
|
|
8389
|
-
this.$emit("onOpenChange", {
|
|
8390
|
-
open: newValue
|
|
7337
|
+
Updates.enqueue(() => {
|
|
7338
|
+
this._trigger.focus();
|
|
8391
7339
|
});
|
|
8392
7340
|
}
|
|
8393
7341
|
/**
|
|
@@ -8447,54 +7395,17 @@ class Menu extends FASTElement {
|
|
|
8447
7395
|
document.removeEventListener("scroll", this.closeMenu);
|
|
8448
7396
|
}
|
|
8449
7397
|
}
|
|
8450
|
-
/**
|
|
8451
|
-
* Sets the positioning of the menu.
|
|
8452
|
-
* @internal
|
|
8453
|
-
*/
|
|
8454
|
-
setPositioning() {
|
|
8455
|
-
if (this.$fastController.isConnected && this._menuList && this.open && this._trigger) {
|
|
8456
|
-
this.cleanup = P(this, this.positioningContainer, async () => {
|
|
8457
|
-
const {
|
|
8458
|
-
middlewareData,
|
|
8459
|
-
x,
|
|
8460
|
-
y
|
|
8461
|
-
} = await z(this._trigger, this.positioningContainer, {
|
|
8462
|
-
placement: "bottom",
|
|
8463
|
-
strategy: "fixed",
|
|
8464
|
-
middleware: [b$1(), k({
|
|
8465
|
-
apply: ({
|
|
8466
|
-
availableHeight,
|
|
8467
|
-
rects
|
|
8468
|
-
}) => {
|
|
8469
|
-
this.positioningContainer?.style && Object.assign(this.positioningContainer.style, {
|
|
8470
|
-
maxHeight: `${availableHeight}px`,
|
|
8471
|
-
width: `${rects.reference.width}px`
|
|
8472
|
-
});
|
|
8473
|
-
}
|
|
8474
|
-
}), P$1()]
|
|
8475
|
-
});
|
|
8476
|
-
if (middlewareData.hide?.referenceHidden) {
|
|
8477
|
-
this.open = false;
|
|
8478
|
-
return;
|
|
8479
|
-
}
|
|
8480
|
-
this.positioningContainer?.style && Object.assign(this.positioningContainer.style, {
|
|
8481
|
-
position: "fixed",
|
|
8482
|
-
top: "0",
|
|
8483
|
-
left: "0",
|
|
8484
|
-
transform: `translate(${x}px, ${y}px)`
|
|
8485
|
-
});
|
|
8486
|
-
});
|
|
8487
|
-
}
|
|
8488
|
-
}
|
|
8489
7398
|
/**
|
|
8490
7399
|
* Adds event listeners.
|
|
8491
|
-
* Adds click and keydown event listeners to the trigger
|
|
7400
|
+
* Adds click and keydown event listeners to the trigger.
|
|
7401
|
+
* Adds a 'toggle' event listener to the menu list.
|
|
8492
7402
|
* If 'openOnHover' is true, adds a 'mouseover' event listener to the trigger.
|
|
8493
|
-
*
|
|
7403
|
+
* If 'openOnContext' is true, adds a 'contextmenu' event listener to the trigger and a document 'click' event listener.
|
|
7404
|
+
* @internal
|
|
8494
7405
|
*/
|
|
8495
7406
|
addListeners() {
|
|
8496
|
-
|
|
8497
|
-
this._trigger?.addEventListener("keydown", this.
|
|
7407
|
+
this._menuList?.addEventListener("toggle", this.toggleHandler);
|
|
7408
|
+
this._trigger?.addEventListener("keydown", this.triggerKeydownHandler);
|
|
8498
7409
|
if (!this.persistOnItemClick) {
|
|
8499
7410
|
this._menuList?.addEventListener("click", this.closeMenu);
|
|
8500
7411
|
}
|
|
@@ -8502,19 +7413,22 @@ class Menu extends FASTElement {
|
|
|
8502
7413
|
this._trigger?.addEventListener("mouseover", this.openMenu);
|
|
8503
7414
|
} else if (this.openOnContext) {
|
|
8504
7415
|
this._trigger?.addEventListener("contextmenu", this.openMenu);
|
|
7416
|
+
document.addEventListener("click", this.documentClickHandler);
|
|
8505
7417
|
} else {
|
|
8506
7418
|
this._trigger?.addEventListener("click", this.toggleMenu);
|
|
8507
7419
|
}
|
|
8508
7420
|
}
|
|
8509
7421
|
/**
|
|
8510
7422
|
* Removes event listeners.
|
|
8511
|
-
* Removes click and keydown event listeners from the trigger
|
|
7423
|
+
* Removes click and keydown event listeners from the trigger.
|
|
7424
|
+
* Also removes toggle event listener from the menu list.
|
|
8512
7425
|
* Also removes 'mouseover' event listeners from the trigger.
|
|
7426
|
+
* Also removes 'contextmenu' event listeners from the trigger and document 'click' event listeners.
|
|
8513
7427
|
* @internal
|
|
8514
7428
|
*/
|
|
8515
7429
|
removeListeners() {
|
|
8516
|
-
|
|
8517
|
-
this._trigger?.removeEventListener("keydown", this.
|
|
7430
|
+
this._menuList?.removeEventListener("toggle", this.toggleHandler);
|
|
7431
|
+
this._trigger?.removeEventListener("keydown", this.triggerKeydownHandler);
|
|
8518
7432
|
if (!this.persistOnItemClick) {
|
|
8519
7433
|
this._menuList?.removeEventListener("click", this.closeMenu);
|
|
8520
7434
|
}
|
|
@@ -8523,6 +7437,7 @@ class Menu extends FASTElement {
|
|
|
8523
7437
|
}
|
|
8524
7438
|
if (this.openOnContext) {
|
|
8525
7439
|
this._trigger?.removeEventListener("contextmenu", this.openMenu);
|
|
7440
|
+
document.removeEventListener("click", this.documentClickHandler);
|
|
8526
7441
|
} else {
|
|
8527
7442
|
this._trigger?.removeEventListener("click", this.toggleMenu);
|
|
8528
7443
|
}
|
|
@@ -8534,7 +7449,7 @@ class Menu extends FASTElement {
|
|
|
8534
7449
|
* @param e - the keyboard event
|
|
8535
7450
|
* @public
|
|
8536
7451
|
*/
|
|
8537
|
-
|
|
7452
|
+
menuKeydownHandler(e) {
|
|
8538
7453
|
if (e.defaultPrevented) {
|
|
8539
7454
|
return;
|
|
8540
7455
|
}
|
|
@@ -8542,18 +7457,14 @@ class Menu extends FASTElement {
|
|
|
8542
7457
|
switch (key) {
|
|
8543
7458
|
case keyEscape:
|
|
8544
7459
|
e.preventDefault();
|
|
8545
|
-
if (this.
|
|
7460
|
+
if (this._open) {
|
|
8546
7461
|
this.closeMenu();
|
|
8547
7462
|
this.focusTrigger();
|
|
8548
7463
|
}
|
|
8549
7464
|
break;
|
|
8550
7465
|
case keyTab:
|
|
8551
|
-
if (this.
|
|
8552
|
-
|
|
8553
|
-
}
|
|
8554
|
-
if (e.shiftKey) {
|
|
8555
|
-
this.focusTrigger();
|
|
8556
|
-
}
|
|
7466
|
+
if (this._open) this.closeMenu();
|
|
7467
|
+
if (e.shiftKey) this.focusTrigger();
|
|
8557
7468
|
default:
|
|
8558
7469
|
return true;
|
|
8559
7470
|
}
|
|
@@ -8575,23 +7486,22 @@ __decorateClass$a([observable, attr({
|
|
|
8575
7486
|
attribute: "persist-on-item-click",
|
|
8576
7487
|
mode: "boolean"
|
|
8577
7488
|
})], Menu.prototype, "persistOnItemClick", 2);
|
|
8578
|
-
__decorateClass$a([observable, attr({
|
|
8579
|
-
mode: "boolean"
|
|
8580
|
-
})], Menu.prototype, "open", 2);
|
|
8581
7489
|
__decorateClass$a([observable], Menu.prototype, "slottedMenuList", 2);
|
|
8582
7490
|
__decorateClass$a([observable], Menu.prototype, "slottedTriggers", 2);
|
|
8583
7491
|
|
|
8584
7492
|
const styles$c = css`
|
|
8585
|
-
|
|
7493
|
+
${display("inline-block")}
|
|
7494
|
+
|
|
7495
|
+
::slotted([slot='trigger']){anchor-name:--menu-trigger}::slotted([popover]){inset-area:block-end span-inline-end;margin:0;max-height:var(--menu-max-height,auto);position-anchor:--menu-trigger;position-try-options:flip-block;position:absolute;z-index:1}::slotted([popover]:popover-open){inset:unset}::slotted([popover]:not(:popover-open)){display:none}`;
|
|
8586
7496
|
|
|
8587
7497
|
function menuTemplate() {
|
|
8588
|
-
return html`<template ?open-on-hover="${x => x.openOnHover}" ?open-on-context="${x => x.openOnContext}" ?close-on-scroll="${x => x.closeOnScroll}" ?persist-on-item-click="${x => x.persistOnItemClick}" @keydown="${(x, c) => x.
|
|
7498
|
+
return html`<template ?open-on-hover="${x => x.openOnHover}" ?open-on-context="${x => x.openOnContext}" ?close-on-scroll="${x => x.closeOnScroll}" ?persist-on-item-click="${x => x.persistOnItemClick}" @keydown="${(x, c) => x.menuKeydownHandler(c.event)}"><slot name="trigger" ${slotted({
|
|
8589
7499
|
property: "slottedTriggers",
|
|
8590
7500
|
filter: elements()
|
|
8591
|
-
})}></slot><
|
|
7501
|
+
})}></slot><slot ${slotted({
|
|
8592
7502
|
property: "slottedMenuList",
|
|
8593
7503
|
filter: elements()
|
|
8594
|
-
})}></slot></
|
|
7504
|
+
})}></slot></template>`;
|
|
8595
7505
|
}
|
|
8596
7506
|
const template$c = menuTemplate();
|
|
8597
7507
|
|