@redvars/peacock 3.5.1 → 3.6.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/{BaseButton-DuASuVth.js → BaseButton-BNFAYn-S.js} +2 -2
- package/dist/{BaseButton-DuASuVth.js.map → BaseButton-BNFAYn-S.js.map} +1 -1
- package/dist/BaseInput-14YmcfK7.js +27 -0
- package/dist/BaseInput-14YmcfK7.js.map +1 -0
- package/dist/banner.js +2 -3
- package/dist/banner.js.map +1 -1
- package/dist/{button-DouvOfEU.js → button-colors-Ccys3hvS.js} +5 -294
- package/dist/button-colors-Ccys3hvS.js.map +1 -0
- package/dist/button-group.js +226 -6
- package/dist/button-group.js.map +1 -1
- package/dist/button.js +294 -8
- package/dist/button.js.map +1 -1
- package/dist/calendar-column-view.js +634 -0
- package/dist/calendar-column-view.js.map +1 -0
- package/dist/calendar-event-BrQ_SEKD.js +199 -0
- package/dist/calendar-event-BrQ_SEKD.js.map +1 -0
- package/dist/calendar-month-view.js +376 -0
- package/dist/calendar-month-view.js.map +1 -0
- package/dist/calendar.js +339 -0
- package/dist/calendar.js.map +1 -0
- package/dist/canvas.js +361 -0
- package/dist/canvas.js.map +1 -0
- package/dist/cb-compound-expression.js +125 -0
- package/dist/cb-compound-expression.js.map +1 -0
- package/dist/cb-divider.js +150 -0
- package/dist/cb-divider.js.map +1 -0
- package/dist/cb-expression.js +75 -0
- package/dist/cb-expression.js.map +1 -0
- package/dist/cb-predicate.js +137 -0
- package/dist/cb-predicate.js.map +1 -0
- package/dist/code-editor.js +2 -1
- package/dist/code-editor.js.map +1 -1
- package/dist/condition-builder.js +58 -0
- package/dist/condition-builder.js.map +1 -0
- package/dist/custom-elements-jsdocs.json +7976 -4294
- package/dist/custom-elements.json +14358 -7589
- package/dist/dropdown-button.js +216 -0
- package/dist/dropdown-button.js.map +1 -0
- package/dist/event-manager-D-QCmUgR.js +113 -0
- package/dist/event-manager-D-QCmUgR.js.map +1 -0
- package/dist/fab.js +1 -1
- package/dist/flow-designer-dZnLJOQT.js +1656 -0
- package/dist/flow-designer-dZnLJOQT.js.map +1 -0
- package/dist/flow-designer-node-XMe-jlKg.js +548 -0
- package/dist/flow-designer-node-XMe-jlKg.js.map +1 -0
- package/dist/flow-designer-node.js +4 -0
- package/dist/flow-designer-node.js.map +1 -0
- package/dist/flow-designer.js +16 -0
- package/dist/flow-designer.js.map +1 -0
- package/dist/html-editor.js +358 -0
- package/dist/html-editor.js.map +1 -0
- package/dist/icon-button-CK1ZuE-2.js +247 -0
- package/dist/icon-button-CK1ZuE-2.js.map +1 -0
- package/dist/index.js +29 -6
- package/dist/index.js.map +1 -1
- package/dist/{is-dark-mode-DicqGkCJ.js → is-dark-mode-DOcaw4Yq.js} +2 -27
- package/dist/is-dark-mode-DOcaw4Yq.js.map +1 -0
- package/dist/modal.js +418 -0
- package/dist/modal.js.map +1 -0
- package/dist/{navigation-rail-Lxetd5-Z.js → navigation-rail-DyO0oAZU.js} +306 -2197
- package/dist/navigation-rail-DyO0oAZU.js.map +1 -0
- package/dist/notification-manager.js +268 -0
- package/dist/notification-manager.js.map +1 -0
- package/dist/peacock-loader.js +84 -8
- package/dist/peacock-loader.js.map +1 -1
- package/dist/popover-NC7b1lTq.js +1971 -0
- package/dist/popover-NC7b1lTq.js.map +1 -0
- package/dist/popover-content.js +125 -0
- package/dist/popover-content.js.map +1 -0
- package/dist/popover.js +4 -0
- package/dist/popover.js.map +1 -0
- package/dist/split-button.js +388 -0
- package/dist/split-button.js.map +1 -0
- package/dist/src/__controllers/floating-controller.d.ts +35 -0
- package/dist/src/calendar/base-event.d.ts +10 -0
- package/dist/src/calendar/calendar-column-view.d.ts +41 -0
- package/dist/src/calendar/calendar-event.d.ts +7 -0
- package/dist/src/calendar/calendar-month-view.d.ts +31 -0
- package/dist/src/calendar/calendar.d.ts +65 -0
- package/dist/src/calendar/event-manager.d.ts +17 -0
- package/dist/src/calendar/index.d.ts +4 -0
- package/dist/src/calendar/types.d.ts +13 -0
- package/dist/src/calendar/utils.d.ts +31 -0
- package/dist/src/canvas/canvas.d.ts +92 -0
- package/dist/src/canvas/index.d.ts +2 -0
- package/dist/src/condition-builder/cb-compound-expression.d.ts +31 -0
- package/dist/src/condition-builder/cb-divider.d.ts +26 -0
- package/dist/src/condition-builder/cb-expression.d.ts +31 -0
- package/dist/src/condition-builder/cb-predicate.d.ts +30 -0
- package/dist/src/condition-builder/condition-builder.d.ts +27 -0
- package/dist/src/condition-builder/index.d.ts +5 -0
- package/dist/src/dropdown-button/dropdown-button.d.ts +68 -0
- package/dist/src/dropdown-button/index.d.ts +1 -0
- package/dist/src/flow-designer/commands.d.ts +66 -0
- package/dist/src/flow-designer/flow-designer-node.d.ts +46 -0
- package/dist/src/flow-designer/flow-designer.d.ts +133 -0
- package/dist/src/flow-designer/index.d.ts +7 -0
- package/dist/src/flow-designer/layout.d.ts +30 -0
- package/dist/src/flow-designer/types.d.ts +142 -0
- package/dist/src/flow-designer/validation.d.ts +43 -0
- package/dist/src/flow-designer/workflow-utils.d.ts +40 -0
- package/dist/src/html-editor/html-editor.d.ts +56 -0
- package/dist/src/html-editor/index.d.ts +2 -0
- package/dist/src/index.d.ts +13 -0
- package/dist/src/menu/menu/menu.d.ts +5 -7
- package/dist/src/menu/menu-item/menu-item.d.ts +14 -13
- package/dist/src/modal/index.d.ts +1 -0
- package/dist/src/modal/modal.d.ts +63 -0
- package/dist/src/notification-manager/index.d.ts +1 -0
- package/dist/src/notification-manager/notification-manager.d.ts +44 -0
- package/dist/src/popover/index.d.ts +2 -0
- package/dist/src/popover/popover-content.d.ts +29 -0
- package/dist/src/popover/popover.d.ts +62 -0
- package/dist/src/split-button/index.d.ts +1 -0
- package/dist/src/split-button/split-button.d.ts +72 -0
- package/dist/src/tooltip/tooltip.d.ts +2 -15
- package/dist/test/flow-designer.test.d.ts +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -2
- package/readme.md +2 -2
- package/src/__controllers/floating-controller.ts +237 -0
- package/src/banner/banner.scss +2 -3
- package/src/button/button/button.ts +1 -0
- package/src/calendar/base-event.ts +49 -0
- package/src/calendar/calendar-column-view.scss +326 -0
- package/src/calendar/calendar-column-view.ts +392 -0
- package/src/calendar/calendar-event.ts +20 -0
- package/src/calendar/calendar-month-view.scss +192 -0
- package/src/calendar/calendar-month-view.ts +244 -0
- package/src/calendar/calendar.scss +71 -0
- package/src/calendar/calendar.ts +298 -0
- package/src/calendar/event-manager.ts +117 -0
- package/src/calendar/index.ts +4 -0
- package/src/calendar/types.ts +14 -0
- package/src/calendar/utils.ts +180 -0
- package/src/canvas/canvas.scss +60 -0
- package/src/canvas/canvas.ts +391 -0
- package/src/canvas/index.ts +2 -0
- package/src/condition-builder/cb-compound-expression.scss +37 -0
- package/src/condition-builder/cb-compound-expression.ts +80 -0
- package/src/condition-builder/cb-divider.scss +93 -0
- package/src/condition-builder/cb-divider.ts +56 -0
- package/src/condition-builder/cb-expression.scss +14 -0
- package/src/condition-builder/cb-expression.ts +49 -0
- package/src/condition-builder/cb-predicate.scss +35 -0
- package/src/condition-builder/cb-predicate.ts +102 -0
- package/src/condition-builder/condition-builder.scss +13 -0
- package/src/condition-builder/condition-builder.ts +38 -0
- package/src/condition-builder/index.ts +5 -0
- package/src/dropdown-button/demo/index.html +110 -0
- package/src/dropdown-button/dropdown-button.scss +22 -0
- package/src/dropdown-button/dropdown-button.ts +206 -0
- package/src/dropdown-button/index.ts +1 -0
- package/src/flow-designer/DEMO.md +239 -0
- package/src/flow-designer/commands.ts +278 -0
- package/src/flow-designer/flow-designer-node.ts +172 -0
- package/src/flow-designer/flow-designer.scss +457 -0
- package/src/flow-designer/flow-designer.ts +611 -0
- package/src/flow-designer/index.ts +41 -0
- package/src/flow-designer/layout.ts +357 -0
- package/src/flow-designer/types.ts +166 -0
- package/src/flow-designer/validation.ts +284 -0
- package/src/flow-designer/workflow-utils.ts +282 -0
- package/src/html-editor/html-editor.scss +146 -0
- package/src/html-editor/html-editor.ts +276 -0
- package/src/html-editor/index.ts +3 -0
- package/src/index.ts +25 -0
- package/src/menu/menu/menu.scss +2 -2
- package/src/menu/menu/menu.ts +91 -101
- package/src/menu/menu-item/menu-item.scss +4 -0
- package/src/menu/menu-item/menu-item.ts +82 -78
- package/src/modal/index.ts +1 -0
- package/src/modal/modal.scss +206 -0
- package/src/modal/modal.ts +201 -0
- package/src/notification-manager/index.ts +1 -0
- package/src/notification-manager/notification-manager.scss +113 -0
- package/src/notification-manager/notification-manager.ts +199 -0
- package/src/peacock-loader.ts +71 -0
- package/src/popover/index.ts +2 -0
- package/src/popover/popover-content.scss +69 -0
- package/src/popover/popover-content.ts +51 -0
- package/src/popover/popover.scss +7 -0
- package/src/popover/popover.ts +170 -0
- package/src/split-button/index.ts +1 -0
- package/src/split-button/split-button-colors.scss +56 -0
- package/src/split-button/split-button-sizes.scss +28 -0
- package/src/split-button/split-button.scss +79 -0
- package/src/split-button/split-button.ts +236 -0
- package/src/table/table.ts +2 -2
- package/src/tooltip/tooltip.scss +4 -3
- package/src/tooltip/tooltip.ts +46 -104
- package/dist/button-DouvOfEU.js.map +0 -1
- package/dist/button-group-CEdMwvJJ.js +0 -464
- package/dist/button-group-CEdMwvJJ.js.map +0 -1
- package/dist/is-dark-mode-DicqGkCJ.js.map +0 -1
- package/dist/navigation-rail-Lxetd5-Z.js.map +0 -1
- package/dist/src/menu/menu/MenuSurfaceController.d.ts +0 -18
- package/src/menu/menu/MenuSurfaceController.ts +0 -61
|
@@ -1,274 +1,23 @@
|
|
|
1
1
|
import { a as i, _ as __decorate, i as i$1, b, A, c as __classPrivateFieldGet, w } from './IndividualComponent-DUINtMGK.js';
|
|
2
2
|
import { n } from './property-1psGvXOq.js';
|
|
3
|
+
import { e as e$1 } from './class-map-YU7g0o3B.js';
|
|
3
4
|
import { r } from './state-DwbEjqVk.js';
|
|
4
|
-
import { e as e$1 } from './directive-ZPhl09Yt.js';
|
|
5
|
-
import { e as e$2, o as o$4 } from './unsafe-html-BsGUjx94.js';
|
|
6
|
-
import { e as e$3 } from './class-map-YU7g0o3B.js';
|
|
7
5
|
import { o as observerSlotChangesWithCallback } from './observe-slot-change-BGJfgg2E.js';
|
|
8
|
-
import { a as e, e as e$
|
|
6
|
+
import { a as e, e as e$2 } from './query-QBcUV-L_.js';
|
|
9
7
|
import { B as BaseHyperlinkMixin, t as throttle } from './BaseHyperlinkMixin-BNuwbiEf.js';
|
|
10
|
-
import { o as o$
|
|
8
|
+
import { o as o$1 } from './style-map-DVmWOuYy.js';
|
|
11
9
|
import { r as redispatchEvent, i as isActivationClick, d as dispatchActivationClick } from './dispatch-event-utils-CuEqjlPT.js';
|
|
12
|
-
import { s as spread, o as o$
|
|
13
|
-
import { B as BaseInput
|
|
10
|
+
import { s as spread, o as o$2, a as BaseButtonMixin } from './BaseButton-BNFAYn-S.js';
|
|
11
|
+
import { B as BaseInput } from './BaseInput-14YmcfK7.js';
|
|
12
|
+
import { F as FloatingController } from './popover-NC7b1lTq.js';
|
|
13
|
+
import { i as isDarkMode, o as observeThemeChange } from './is-dark-mode-DOcaw4Yq.js';
|
|
14
|
+
import { o as o$3 } from './unsafe-html-BsGUjx94.js';
|
|
14
15
|
|
|
15
16
|
/**
|
|
16
17
|
* @license
|
|
17
18
|
* Copyright 2021 Google LLC
|
|
18
19
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
19
|
-
*/function o
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* @license
|
|
23
|
-
* Copyright 2017 Google LLC
|
|
24
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
25
|
-
*/class t extends e$2{}t.directiveName="unsafeSVG",t.resultType=2;const o=e$1(t);
|
|
26
|
-
|
|
27
|
-
// Basic sanitization: remove <script>, <foreignObject>, event handler attributes (on*), and iframes
|
|
28
|
-
function sanitizeSvg(rawSvg) {
|
|
29
|
-
try {
|
|
30
|
-
const parser = new DOMParser();
|
|
31
|
-
const doc = parser.parseFromString(rawSvg, 'image/svg+xml');
|
|
32
|
-
const scripts = Array.from(doc.querySelectorAll('script'));
|
|
33
|
-
scripts.forEach(n => n.remove());
|
|
34
|
-
const foreigns = Array.from(doc.querySelectorAll('foreignObject, iframe'));
|
|
35
|
-
foreigns.forEach(n => n.remove());
|
|
36
|
-
const all = Array.from(doc.querySelectorAll('*'));
|
|
37
|
-
all.forEach(el => {
|
|
38
|
-
const attrs = Array.from(el.attributes).filter(a => /^on/i.test(a.name));
|
|
39
|
-
attrs.forEach(a => el.removeAttribute(a.name));
|
|
40
|
-
});
|
|
41
|
-
const el = doc.documentElement;
|
|
42
|
-
if (!el)
|
|
43
|
-
return '';
|
|
44
|
-
const serializer = new XMLSerializer();
|
|
45
|
-
return serializer.serializeToString(el);
|
|
46
|
-
}
|
|
47
|
-
catch (e) {
|
|
48
|
-
return '';
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
async function createCacheFetch(name) {
|
|
53
|
-
let cache = null;
|
|
54
|
-
// This map tracks requests currently being processed
|
|
55
|
-
const inFlightRequests = new Map();
|
|
56
|
-
try {
|
|
57
|
-
cache = await window.caches.open(name);
|
|
58
|
-
}
|
|
59
|
-
catch (e) {
|
|
60
|
-
console.warn('window.caches access not allowed');
|
|
61
|
-
}
|
|
62
|
-
return async (url) => {
|
|
63
|
-
if (inFlightRequests.has(url)) {
|
|
64
|
-
return inFlightRequests.get(url);
|
|
65
|
-
}
|
|
66
|
-
const fetchPromise = (async () => {
|
|
67
|
-
const request = new Request(url);
|
|
68
|
-
if (cache) {
|
|
69
|
-
const cachedResponse = await cache.match(request);
|
|
70
|
-
if (cachedResponse) {
|
|
71
|
-
return cachedResponse.text();
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
const urlObj = new URL(request.url);
|
|
75
|
-
const isSameOrigin = urlObj.origin === window.location.origin;
|
|
76
|
-
const response = await fetch(request.url, {
|
|
77
|
-
method: 'GET',
|
|
78
|
-
mode: isSameOrigin ? 'no-cors' : 'cors',
|
|
79
|
-
credentials: isSameOrigin ? 'same-origin' : 'omit',
|
|
80
|
-
});
|
|
81
|
-
if (response.status === 404) {
|
|
82
|
-
console.error(`[Fetch Error] Resource not found (404): ${url}`);
|
|
83
|
-
return '';
|
|
84
|
-
}
|
|
85
|
-
const result = await response.text();
|
|
86
|
-
if (cache && response.status === 200) {
|
|
87
|
-
await cache.put(request, new Response(result, {
|
|
88
|
-
status: response.status,
|
|
89
|
-
statusText: response.statusText,
|
|
90
|
-
headers: response.headers,
|
|
91
|
-
}));
|
|
92
|
-
}
|
|
93
|
-
return result;
|
|
94
|
-
})();
|
|
95
|
-
inFlightRequests.set(url, fetchPromise);
|
|
96
|
-
try {
|
|
97
|
-
return await fetchPromise;
|
|
98
|
-
}
|
|
99
|
-
finally {
|
|
100
|
-
inFlightRequests.delete(url);
|
|
101
|
-
}
|
|
102
|
-
};
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
const PROVIDERS = {
|
|
106
|
-
'material-symbols': (name) => `https://cdn.jsdelivr.net/npm/@material-symbols/svg-500@0.40.1/outlined/${name}.svg`,
|
|
107
|
-
carbon: (name) => `https://cdn.jsdelivr.net/npm/@carbon/icons@11.41.0/svg/32/${name}.svg`,
|
|
108
|
-
};
|
|
109
|
-
const cacheFetch = await createCacheFetch('svg-cache');
|
|
110
|
-
async function fetchSVG(url) {
|
|
111
|
-
if (!url)
|
|
112
|
-
return '';
|
|
113
|
-
return cacheFetch(url);
|
|
114
|
-
}
|
|
115
|
-
async function fetchIcon(name, provider = 'material-symbols') {
|
|
116
|
-
if (!name)
|
|
117
|
-
return '';
|
|
118
|
-
if (!PROVIDERS[provider]) {
|
|
119
|
-
throw new Error(`Provider '${provider}' not found`);
|
|
120
|
-
}
|
|
121
|
-
return fetchSVG(PROVIDERS[provider](name));
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
var css_248z$S = i`* {
|
|
125
|
-
box-sizing: border-box;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
.screen-reader-only {
|
|
129
|
-
display: none !important;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
:host {
|
|
133
|
-
display: inline-flex;
|
|
134
|
-
vertical-align: middle;
|
|
135
|
-
--icon-size: inherit;
|
|
136
|
-
--icon-color: inherit;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
.icon {
|
|
140
|
-
height: var(--icon-size, 1rem);
|
|
141
|
-
width: var(--icon-size, 1rem);
|
|
142
|
-
display: inline-flex;
|
|
143
|
-
align-items: center;
|
|
144
|
-
justify-content: center;
|
|
145
|
-
}
|
|
146
|
-
.icon svg {
|
|
147
|
-
fill: var(--icon-color);
|
|
148
|
-
height: 100%;
|
|
149
|
-
width: 100%;
|
|
150
|
-
}`;
|
|
151
|
-
|
|
152
|
-
/**
|
|
153
|
-
* @label Icon
|
|
154
|
-
* @tag wc-icon
|
|
155
|
-
* @rawTag icon
|
|
156
|
-
* @summary Icons are visual symbols used to represent ideas, objects, or actions.
|
|
157
|
-
* @overview Icons are visual symbols used to represent ideas, objects, or actions. They communicate messages at a glance, afford interactivity, and draw attention to important information.
|
|
158
|
-
*
|
|
159
|
-
* @cssprop --icon-color - Controls the color of the icon.
|
|
160
|
-
* @cssprop [--icon-size=1rem] - Controls the size of the icon. Defaults to "1rem"
|
|
161
|
-
*
|
|
162
|
-
* @example
|
|
163
|
-
* ```html
|
|
164
|
-
* <wc-icon name="home" style="--icon-size: 2rem;"></wc-icon>
|
|
165
|
-
* ```
|
|
166
|
-
*
|
|
167
|
-
*/
|
|
168
|
-
class Icon extends i$1 {
|
|
169
|
-
constructor() {
|
|
170
|
-
super(...arguments);
|
|
171
|
-
this.provider = 'material-symbols';
|
|
172
|
-
this.svgContent = '';
|
|
173
|
-
// loading + error states for consumers/tests
|
|
174
|
-
this.loading = false;
|
|
175
|
-
this.error = null;
|
|
176
|
-
// token to avoid race conditions when multiple fetches overlap
|
|
177
|
-
this._fetchId = 0;
|
|
178
|
-
}
|
|
179
|
-
firstUpdated() {
|
|
180
|
-
// perform initial fetch once component is connected and rendered
|
|
181
|
-
this.__scheduleUpdate();
|
|
182
|
-
}
|
|
183
|
-
updated(changedProperties) {
|
|
184
|
-
// only refetch when name or src changed
|
|
185
|
-
if (changedProperties.has('name') || changedProperties.has('src')) {
|
|
186
|
-
this.__scheduleUpdate();
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
render() {
|
|
190
|
-
// accessible wrapper; consumers can provide a fallback via <slot name="fallback">.
|
|
191
|
-
return b ` <div class="icon">
|
|
192
|
-
${this.svgContent
|
|
193
|
-
? o(this.svgContent)
|
|
194
|
-
: b `<slot name="fallback"></slot>`}
|
|
195
|
-
</div>`;
|
|
196
|
-
}
|
|
197
|
-
// small debounce to coalesce rapid changes (50ms)
|
|
198
|
-
__scheduleUpdate() {
|
|
199
|
-
if (this._debounceTimer) {
|
|
200
|
-
clearTimeout(this._debounceTimer);
|
|
201
|
-
}
|
|
202
|
-
// @ts-ignore - setTimeout in DOM returns number
|
|
203
|
-
this._debounceTimer = window.setTimeout(() => this.__updateSvg(), 50);
|
|
204
|
-
}
|
|
205
|
-
/**
|
|
206
|
-
* @internal
|
|
207
|
-
*/
|
|
208
|
-
async __updateSvg() {
|
|
209
|
-
this._fetchId += 1;
|
|
210
|
-
const currentId = this._fetchId;
|
|
211
|
-
this.loading = true;
|
|
212
|
-
this.error = null;
|
|
213
|
-
try {
|
|
214
|
-
let raw;
|
|
215
|
-
if (this.name) {
|
|
216
|
-
raw = await fetchIcon(this.name, this.provider);
|
|
217
|
-
}
|
|
218
|
-
else if (this.src) {
|
|
219
|
-
raw = await fetchSVG(this.src);
|
|
220
|
-
}
|
|
221
|
-
else {
|
|
222
|
-
raw = '';
|
|
223
|
-
}
|
|
224
|
-
// If another fetch started after this one, ignore this result
|
|
225
|
-
if (currentId !== this._fetchId)
|
|
226
|
-
return;
|
|
227
|
-
if (raw) {
|
|
228
|
-
this.svgContent = sanitizeSvg(raw);
|
|
229
|
-
}
|
|
230
|
-
else {
|
|
231
|
-
this.svgContent = '';
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
catch (err) {
|
|
235
|
-
// capture and surface error, but avoid throwing
|
|
236
|
-
this.error = err instanceof Error ? err : new Error(String(err));
|
|
237
|
-
this.svgContent = '';
|
|
238
|
-
// bubble an event so consumers can react
|
|
239
|
-
this.dispatchEvent(new CustomEvent('icon-error', {
|
|
240
|
-
detail: { name: this.name, src: this.src, error: this.error },
|
|
241
|
-
bubbles: true,
|
|
242
|
-
composed: true,
|
|
243
|
-
}));
|
|
244
|
-
}
|
|
245
|
-
finally {
|
|
246
|
-
// ensure loading is cleared unless another fetch started
|
|
247
|
-
if (currentId === this._fetchId) {
|
|
248
|
-
this.loading = false;
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
Icon.styles = [css_248z$S];
|
|
254
|
-
__decorate([
|
|
255
|
-
n({ type: String, reflect: true })
|
|
256
|
-
], Icon.prototype, "name", void 0);
|
|
257
|
-
__decorate([
|
|
258
|
-
n({ type: String, reflect: true })
|
|
259
|
-
], Icon.prototype, "src", void 0);
|
|
260
|
-
__decorate([
|
|
261
|
-
n({ type: String })
|
|
262
|
-
], Icon.prototype, "provider", void 0);
|
|
263
|
-
__decorate([
|
|
264
|
-
r()
|
|
265
|
-
], Icon.prototype, "svgContent", void 0);
|
|
266
|
-
__decorate([
|
|
267
|
-
r() // @ts-ignore
|
|
268
|
-
], Icon.prototype, "loading", void 0);
|
|
269
|
-
__decorate([
|
|
270
|
-
r()
|
|
271
|
-
], Icon.prototype, "error", void 0);
|
|
20
|
+
*/function o(o){return (e$1,n)=>{const{slot:r,selector:s}=o??{},c="slot"+(r?`[name=${r}]`:":not([name])");return e(e$1,n,{get(){const t=this.renderRoot?.querySelector(c),e=t?.assignedElements(o)??[];return void 0===s?e:e.filter(t=>t.matches(s))}})}}
|
|
272
21
|
|
|
273
22
|
var css_248z$R = i`* {
|
|
274
23
|
box-sizing: border-box;
|
|
@@ -344,7 +93,7 @@ class Avatar extends i$1 {
|
|
|
344
93
|
render() {
|
|
345
94
|
return b `<div class="avatar-container">
|
|
346
95
|
<div
|
|
347
|
-
class=${e$
|
|
96
|
+
class=${e$1({
|
|
348
97
|
avatar: true,
|
|
349
98
|
initials: !this.src,
|
|
350
99
|
image: !!this.src,
|
|
@@ -432,7 +181,7 @@ class Badge extends i$1 {
|
|
|
432
181
|
}
|
|
433
182
|
render() {
|
|
434
183
|
return b `<div
|
|
435
|
-
class=${e$
|
|
184
|
+
class=${e$1({
|
|
436
185
|
badge: true,
|
|
437
186
|
'has-value': !!this.value,
|
|
438
187
|
})}
|
|
@@ -541,7 +290,7 @@ class Divider extends i$1 {
|
|
|
541
290
|
}
|
|
542
291
|
render() {
|
|
543
292
|
return b `<div
|
|
544
|
-
class=${e$
|
|
293
|
+
class=${e$1({
|
|
545
294
|
divider: true,
|
|
546
295
|
vertical: this.vertical,
|
|
547
296
|
'slot-has-content': this.slotHasContent,
|
|
@@ -874,7 +623,7 @@ class SegmentedButton extends i$1 {
|
|
|
874
623
|
};
|
|
875
624
|
return b `
|
|
876
625
|
<div
|
|
877
|
-
class=${e$
|
|
626
|
+
class=${e$1(cssClasses)}
|
|
878
627
|
role="button"
|
|
879
628
|
tabindex=${this.disabled ? -1 : 0}
|
|
880
629
|
aria-pressed=${this.selected}
|
|
@@ -1320,7 +1069,7 @@ class Ripple extends i$1 {
|
|
|
1320
1069
|
'hovered': this.hovered,
|
|
1321
1070
|
'pressed': this.pressed,
|
|
1322
1071
|
};
|
|
1323
|
-
return b `<div class="surface ${e$
|
|
1072
|
+
return b `<div class="surface ${e$1(classes)}"></div>`;
|
|
1324
1073
|
}
|
|
1325
1074
|
update(changedProps) {
|
|
1326
1075
|
if (changedProps.has('disabled') && this.disabled) {
|
|
@@ -1632,7 +1381,7 @@ __decorate([
|
|
|
1632
1381
|
r()
|
|
1633
1382
|
], Ripple.prototype, "pressed", void 0);
|
|
1634
1383
|
__decorate([
|
|
1635
|
-
e$
|
|
1384
|
+
e$2('.surface')
|
|
1636
1385
|
], Ripple.prototype, "mdRoot", void 0);
|
|
1637
1386
|
|
|
1638
1387
|
var css_248z$K = i`* {
|
|
@@ -1876,7 +1625,7 @@ class AccordionItem extends i$1 {
|
|
|
1876
1625
|
render() {
|
|
1877
1626
|
return b `
|
|
1878
1627
|
<div
|
|
1879
|
-
class=${e$
|
|
1628
|
+
class=${e$1({
|
|
1880
1629
|
'expansion-panel': true,
|
|
1881
1630
|
open: this.open,
|
|
1882
1631
|
disabled: this.disabled,
|
|
@@ -1951,7 +1700,7 @@ __decorate([
|
|
|
1951
1700
|
r()
|
|
1952
1701
|
], AccordionItem.prototype, "_hasHeadingSlot", void 0);
|
|
1953
1702
|
__decorate([
|
|
1954
|
-
e$
|
|
1703
|
+
e$2('.header-button')
|
|
1955
1704
|
], AccordionItem.prototype, "buttonElement", void 0);
|
|
1956
1705
|
|
|
1957
1706
|
var css_248z$J = i`* {
|
|
@@ -2091,7 +1840,7 @@ __decorate([
|
|
|
2091
1840
|
n({ type: String, reflect: true, attribute: 'display-mode' })
|
|
2092
1841
|
], Accordion.prototype, "displayMode", void 0);
|
|
2093
1842
|
__decorate([
|
|
2094
|
-
o
|
|
1843
|
+
o({ selector: 'wc-accordion-item' })
|
|
2095
1844
|
], Accordion.prototype, "items", void 0);
|
|
2096
1845
|
|
|
2097
1846
|
var css_248z$I = i`* {
|
|
@@ -2147,7 +1896,7 @@ var css_248z$I = i`* {
|
|
|
2147
1896
|
class Link extends BaseHyperlinkMixin(i$1) {
|
|
2148
1897
|
render() {
|
|
2149
1898
|
return b `<a
|
|
2150
|
-
class=${e$
|
|
1899
|
+
class=${e$1({
|
|
2151
1900
|
link: true,
|
|
2152
1901
|
})}
|
|
2153
1902
|
href=${this.href}
|
|
@@ -2443,7 +2192,7 @@ class Tag extends i$1 {
|
|
|
2443
2192
|
[`size-${this.size}`]: true,
|
|
2444
2193
|
};
|
|
2445
2194
|
return b `
|
|
2446
|
-
<div class="${e$
|
|
2195
|
+
<div class="${e$1(classes)}">
|
|
2447
2196
|
<wc-elevation class="elevation"></wc-elevation>
|
|
2448
2197
|
<div class="background"></div>
|
|
2449
2198
|
<div class="outline"></div>
|
|
@@ -2739,7 +2488,7 @@ class Chip extends i$1 {
|
|
|
2739
2488
|
[`color-${this.color}`]: true,
|
|
2740
2489
|
};
|
|
2741
2490
|
return b `
|
|
2742
|
-
<div class="${e$
|
|
2491
|
+
<div class="${e$1(classes)}">
|
|
2743
2492
|
<wc-elevation class="elevation"></wc-elevation>
|
|
2744
2493
|
<div class="background"></div>
|
|
2745
2494
|
<div class="outline"></div>
|
|
@@ -2938,7 +2687,7 @@ class LinearProgress extends BaseProgress {
|
|
|
2938
2687
|
render() {
|
|
2939
2688
|
return b `
|
|
2940
2689
|
<div
|
|
2941
|
-
class="${e$
|
|
2690
|
+
class="${e$1({
|
|
2942
2691
|
'linear-progress': true,
|
|
2943
2692
|
indeterminate: this.indeterminate,
|
|
2944
2693
|
inline: this.inline,
|
|
@@ -2962,7 +2711,7 @@ class LinearProgress extends BaseProgress {
|
|
|
2962
2711
|
<div class="track track-start"></div>
|
|
2963
2712
|
<div
|
|
2964
2713
|
class="active-indicator"
|
|
2965
|
-
style="${o$
|
|
2714
|
+
style="${o$1({
|
|
2966
2715
|
width: `${this.__getPercentageValue()}%`,
|
|
2967
2716
|
})}"
|
|
2968
2717
|
></div>
|
|
@@ -3103,7 +2852,7 @@ class CircularProgress extends BaseProgress {
|
|
|
3103
2852
|
const offset = circumference - (percentage / 100) * circumference;
|
|
3104
2853
|
return b `
|
|
3105
2854
|
<div
|
|
3106
|
-
class="${e$
|
|
2855
|
+
class="${e$1({
|
|
3107
2856
|
'circular-progress': true,
|
|
3108
2857
|
indeterminate: this.indeterminate,
|
|
3109
2858
|
inline: this.inline,
|
|
@@ -3122,7 +2871,7 @@ class CircularProgress extends BaseProgress {
|
|
|
3122
2871
|
cx="8"
|
|
3123
2872
|
cy="8"
|
|
3124
2873
|
r="6"
|
|
3125
|
-
style="${o$
|
|
2874
|
+
style="${o$1({
|
|
3126
2875
|
strokeDasharray: `${circumference}`,
|
|
3127
2876
|
strokeDashoffset: this.indeterminate ? undefined : `${offset}`,
|
|
3128
2877
|
})}"
|
|
@@ -3485,7 +3234,7 @@ __decorate([
|
|
|
3485
3234
|
r()
|
|
3486
3235
|
], Input.prototype, "dirty", void 0);
|
|
3487
3236
|
__decorate([
|
|
3488
|
-
e$
|
|
3237
|
+
e$2('.input-element')
|
|
3489
3238
|
], Input.prototype, "inputElement", void 0);
|
|
3490
3239
|
|
|
3491
3240
|
var css_248z$x = i`* {
|
|
@@ -3768,7 +3517,7 @@ __decorate([
|
|
|
3768
3517
|
r()
|
|
3769
3518
|
], UrlField.prototype, "isValid", void 0);
|
|
3770
3519
|
__decorate([
|
|
3771
|
-
e$
|
|
3520
|
+
e$2('.url-input')
|
|
3772
3521
|
], UrlField.prototype, "inputElement", void 0);
|
|
3773
3522
|
|
|
3774
3523
|
var css_248z$w = i`* {
|
|
@@ -4079,7 +3828,7 @@ class Field extends i$1 {
|
|
|
4079
3828
|
populated: this.populated,
|
|
4080
3829
|
};
|
|
4081
3830
|
return b `
|
|
4082
|
-
<div class=${e$
|
|
3831
|
+
<div class=${e$1(classes)}>
|
|
4083
3832
|
${this.__renderFieldHeader()}
|
|
4084
3833
|
|
|
4085
3834
|
<div class="field-body" @click=${this.__handleClick}>
|
|
@@ -4089,7 +3838,7 @@ class Field extends i$1 {
|
|
|
4089
3838
|
|
|
4090
3839
|
<div class="field-content">
|
|
4091
3840
|
<div
|
|
4092
|
-
class=${e$
|
|
3841
|
+
class=${e$1({
|
|
4093
3842
|
'slot-start-wrapper': true,
|
|
4094
3843
|
'has-content': this.slotStartHasContent,
|
|
4095
3844
|
})}
|
|
@@ -4100,7 +3849,7 @@ class Field extends i$1 {
|
|
|
4100
3849
|
<div class="input-wrapper">${this.__renderInputSlot()}</div>
|
|
4101
3850
|
|
|
4102
3851
|
<div
|
|
4103
|
-
class=${e$
|
|
3852
|
+
class=${e$1({
|
|
4104
3853
|
'slot-end-wrapper': true,
|
|
4105
3854
|
'has-content': this.slotEndHasContent,
|
|
4106
3855
|
})}
|
|
@@ -4341,7 +4090,7 @@ class NumberField extends BaseInput {
|
|
|
4341
4090
|
label=${this.label}
|
|
4342
4091
|
?focused=${this.focused}
|
|
4343
4092
|
.host=${this}
|
|
4344
|
-
class=${e$
|
|
4093
|
+
class=${e$1(classes)}
|
|
4345
4094
|
>
|
|
4346
4095
|
${this.stepper && !this.disabled
|
|
4347
4096
|
? b `<wc-icon-button
|
|
@@ -4453,7 +4202,7 @@ __decorate([
|
|
|
4453
4202
|
r()
|
|
4454
4203
|
], NumberField.prototype, "dirty", void 0);
|
|
4455
4204
|
__decorate([
|
|
4456
|
-
e$
|
|
4205
|
+
e$2('.input-element')
|
|
4457
4206
|
], NumberField.prototype, "inputElement", void 0);
|
|
4458
4207
|
|
|
4459
4208
|
var css_248z$u = i`* {
|
|
@@ -4676,7 +4425,7 @@ __decorate([
|
|
|
4676
4425
|
r()
|
|
4677
4426
|
], DatePicker.prototype, "dirty", void 0);
|
|
4678
4427
|
__decorate([
|
|
4679
|
-
e$
|
|
4428
|
+
e$2('.input-element')
|
|
4680
4429
|
], DatePicker.prototype, "inputElement", void 0);
|
|
4681
4430
|
|
|
4682
4431
|
var css_248z$t = i`* {
|
|
@@ -4899,7 +4648,7 @@ __decorate([
|
|
|
4899
4648
|
r()
|
|
4900
4649
|
], TimePicker.prototype, "dirty", void 0);
|
|
4901
4650
|
__decorate([
|
|
4902
|
-
e$
|
|
4651
|
+
e$2('.input-element')
|
|
4903
4652
|
], TimePicker.prototype, "inputElement", void 0);
|
|
4904
4653
|
|
|
4905
4654
|
var css_248z$s = i`* {
|
|
@@ -5118,7 +4867,7 @@ __decorate([
|
|
|
5118
4867
|
r()
|
|
5119
4868
|
], Textarea.prototype, "dirty", void 0);
|
|
5120
4869
|
__decorate([
|
|
5121
|
-
e$
|
|
4870
|
+
e$2('.input-element')
|
|
5122
4871
|
], Textarea.prototype, "inputElement", void 0);
|
|
5123
4872
|
|
|
5124
4873
|
var css_248z$r = i`* {
|
|
@@ -5426,7 +5175,7 @@ class Switch extends BaseInput {
|
|
|
5426
5175
|
'has-content': this.slotHasContent,
|
|
5427
5176
|
};
|
|
5428
5177
|
return b `
|
|
5429
|
-
<label class=${e$
|
|
5178
|
+
<label class=${e$1(cssClasses)}>
|
|
5430
5179
|
<div
|
|
5431
5180
|
class="track"
|
|
5432
5181
|
tabindex=${this.tabindex || 0}
|
|
@@ -5500,10 +5249,10 @@ __decorate([
|
|
|
5500
5249
|
r()
|
|
5501
5250
|
], Switch.prototype, "slotHasContent", void 0);
|
|
5502
5251
|
__decorate([
|
|
5503
|
-
e$
|
|
5252
|
+
e$2('.track')
|
|
5504
5253
|
], Switch.prototype, "trackElement", void 0);
|
|
5505
5254
|
__decorate([
|
|
5506
|
-
e$
|
|
5255
|
+
e$2('.input-native')
|
|
5507
5256
|
], Switch.prototype, "nativeElement", void 0);
|
|
5508
5257
|
|
|
5509
5258
|
var css_248z$q = i`* {
|
|
@@ -5901,7 +5650,7 @@ class Checkbox extends i$1 {
|
|
|
5901
5650
|
'has-content': this.slotHasContent,
|
|
5902
5651
|
};
|
|
5903
5652
|
return b `
|
|
5904
|
-
<label class=${e$
|
|
5653
|
+
<label class=${e$1(cssClasses)}>
|
|
5905
5654
|
<div
|
|
5906
5655
|
id="container"
|
|
5907
5656
|
class="container"
|
|
@@ -6005,10 +5754,10 @@ __decorate([
|
|
|
6005
5754
|
r()
|
|
6006
5755
|
], Checkbox.prototype, "slotHasContent", void 0);
|
|
6007
5756
|
__decorate([
|
|
6008
|
-
e$
|
|
5757
|
+
e$2('.container')
|
|
6009
5758
|
], Checkbox.prototype, "containerElement", void 0);
|
|
6010
5759
|
__decorate([
|
|
6011
|
-
e$
|
|
5760
|
+
e$2('.input-native')
|
|
6012
5761
|
], Checkbox.prototype, "nativeElement", void 0);
|
|
6013
5762
|
|
|
6014
5763
|
var css_248z$p = i`* {
|
|
@@ -6208,7 +5957,7 @@ class Container extends i$1 {
|
|
|
6208
5957
|
[`size-${this.size}`]: true,
|
|
6209
5958
|
};
|
|
6210
5959
|
return b `
|
|
6211
|
-
<div class=${e$
|
|
5960
|
+
<div class=${e$1(wrapperClasses)}>
|
|
6212
5961
|
<div class="container">
|
|
6213
5962
|
<div class="content">
|
|
6214
5963
|
<slot></slot>
|
|
@@ -6368,7 +6117,7 @@ class EmptyState extends i$1 {
|
|
|
6368
6117
|
// Resolving asset paths in Lit typically uses import.meta.url or absolute paths
|
|
6369
6118
|
const illustrationPath = new URL(`./assets/images/empty-state/${this.illustration}.svg`, import.meta.url).href;
|
|
6370
6119
|
return b `
|
|
6371
|
-
<div class="${e$
|
|
6120
|
+
<div class="${e$1(classes)}">
|
|
6372
6121
|
<div class="empty-state-container">
|
|
6373
6122
|
<div class="illustration">
|
|
6374
6123
|
<wc-icon class="illustration-svg" src="${illustrationPath}"></wc-icon>
|
|
@@ -6408,13 +6157,15 @@ var css_248z$m = i`* {
|
|
|
6408
6157
|
display: none !important;
|
|
6409
6158
|
}
|
|
6410
6159
|
|
|
6160
|
+
:host(:not([preview])) {
|
|
6161
|
+
position: absolute;
|
|
6162
|
+
top: 0;
|
|
6163
|
+
left: 0;
|
|
6164
|
+
}
|
|
6411
6165
|
:host(:not([preview])) .tooltip {
|
|
6412
6166
|
pointer-events: none;
|
|
6413
6167
|
transition: transform var(--duration-short2) ease-in-out, opacity var(--duration-short2) ease-in-out;
|
|
6414
6168
|
transform: scale(0);
|
|
6415
|
-
position: absolute;
|
|
6416
|
-
top: 0;
|
|
6417
|
-
left: 0;
|
|
6418
6169
|
opacity: 0;
|
|
6419
6170
|
}
|
|
6420
6171
|
:host(:not([preview])) .tooltip.open {
|
|
@@ -6475,1571 +6226,6 @@ var css_248z$m = i`* {
|
|
|
6475
6226
|
gap: var(--spacing-100);
|
|
6476
6227
|
}`;
|
|
6477
6228
|
|
|
6478
|
-
/**
|
|
6479
|
-
* Custom positioning reference element.
|
|
6480
|
-
* @see https://floating-ui.com/docs/virtual-elements
|
|
6481
|
-
*/
|
|
6482
|
-
|
|
6483
|
-
const min = Math.min;
|
|
6484
|
-
const max = Math.max;
|
|
6485
|
-
const round = Math.round;
|
|
6486
|
-
const floor = Math.floor;
|
|
6487
|
-
const createCoords = v => ({
|
|
6488
|
-
x: v,
|
|
6489
|
-
y: v
|
|
6490
|
-
});
|
|
6491
|
-
const oppositeSideMap = {
|
|
6492
|
-
left: 'right',
|
|
6493
|
-
right: 'left',
|
|
6494
|
-
bottom: 'top',
|
|
6495
|
-
top: 'bottom'
|
|
6496
|
-
};
|
|
6497
|
-
function clamp(start, value, end) {
|
|
6498
|
-
return max(start, min(value, end));
|
|
6499
|
-
}
|
|
6500
|
-
function evaluate(value, param) {
|
|
6501
|
-
return typeof value === 'function' ? value(param) : value;
|
|
6502
|
-
}
|
|
6503
|
-
function getSide(placement) {
|
|
6504
|
-
return placement.split('-')[0];
|
|
6505
|
-
}
|
|
6506
|
-
function getAlignment(placement) {
|
|
6507
|
-
return placement.split('-')[1];
|
|
6508
|
-
}
|
|
6509
|
-
function getOppositeAxis(axis) {
|
|
6510
|
-
return axis === 'x' ? 'y' : 'x';
|
|
6511
|
-
}
|
|
6512
|
-
function getAxisLength(axis) {
|
|
6513
|
-
return axis === 'y' ? 'height' : 'width';
|
|
6514
|
-
}
|
|
6515
|
-
function getSideAxis(placement) {
|
|
6516
|
-
const firstChar = placement[0];
|
|
6517
|
-
return firstChar === 't' || firstChar === 'b' ? 'y' : 'x';
|
|
6518
|
-
}
|
|
6519
|
-
function getAlignmentAxis(placement) {
|
|
6520
|
-
return getOppositeAxis(getSideAxis(placement));
|
|
6521
|
-
}
|
|
6522
|
-
function getAlignmentSides(placement, rects, rtl) {
|
|
6523
|
-
if (rtl === void 0) {
|
|
6524
|
-
rtl = false;
|
|
6525
|
-
}
|
|
6526
|
-
const alignment = getAlignment(placement);
|
|
6527
|
-
const alignmentAxis = getAlignmentAxis(placement);
|
|
6528
|
-
const length = getAxisLength(alignmentAxis);
|
|
6529
|
-
let mainAlignmentSide = alignmentAxis === 'x' ? alignment === (rtl ? 'end' : 'start') ? 'right' : 'left' : alignment === 'start' ? 'bottom' : 'top';
|
|
6530
|
-
if (rects.reference[length] > rects.floating[length]) {
|
|
6531
|
-
mainAlignmentSide = getOppositePlacement(mainAlignmentSide);
|
|
6532
|
-
}
|
|
6533
|
-
return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)];
|
|
6534
|
-
}
|
|
6535
|
-
function getExpandedPlacements(placement) {
|
|
6536
|
-
const oppositePlacement = getOppositePlacement(placement);
|
|
6537
|
-
return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)];
|
|
6538
|
-
}
|
|
6539
|
-
function getOppositeAlignmentPlacement(placement) {
|
|
6540
|
-
return placement.includes('start') ? placement.replace('start', 'end') : placement.replace('end', 'start');
|
|
6541
|
-
}
|
|
6542
|
-
const lrPlacement = ['left', 'right'];
|
|
6543
|
-
const rlPlacement = ['right', 'left'];
|
|
6544
|
-
const tbPlacement = ['top', 'bottom'];
|
|
6545
|
-
const btPlacement = ['bottom', 'top'];
|
|
6546
|
-
function getSideList(side, isStart, rtl) {
|
|
6547
|
-
switch (side) {
|
|
6548
|
-
case 'top':
|
|
6549
|
-
case 'bottom':
|
|
6550
|
-
if (rtl) return isStart ? rlPlacement : lrPlacement;
|
|
6551
|
-
return isStart ? lrPlacement : rlPlacement;
|
|
6552
|
-
case 'left':
|
|
6553
|
-
case 'right':
|
|
6554
|
-
return isStart ? tbPlacement : btPlacement;
|
|
6555
|
-
default:
|
|
6556
|
-
return [];
|
|
6557
|
-
}
|
|
6558
|
-
}
|
|
6559
|
-
function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) {
|
|
6560
|
-
const alignment = getAlignment(placement);
|
|
6561
|
-
let list = getSideList(getSide(placement), direction === 'start', rtl);
|
|
6562
|
-
if (alignment) {
|
|
6563
|
-
list = list.map(side => side + "-" + alignment);
|
|
6564
|
-
if (flipAlignment) {
|
|
6565
|
-
list = list.concat(list.map(getOppositeAlignmentPlacement));
|
|
6566
|
-
}
|
|
6567
|
-
}
|
|
6568
|
-
return list;
|
|
6569
|
-
}
|
|
6570
|
-
function getOppositePlacement(placement) {
|
|
6571
|
-
const side = getSide(placement);
|
|
6572
|
-
return oppositeSideMap[side] + placement.slice(side.length);
|
|
6573
|
-
}
|
|
6574
|
-
function expandPaddingObject(padding) {
|
|
6575
|
-
return {
|
|
6576
|
-
top: 0,
|
|
6577
|
-
right: 0,
|
|
6578
|
-
bottom: 0,
|
|
6579
|
-
left: 0,
|
|
6580
|
-
...padding
|
|
6581
|
-
};
|
|
6582
|
-
}
|
|
6583
|
-
function getPaddingObject(padding) {
|
|
6584
|
-
return typeof padding !== 'number' ? expandPaddingObject(padding) : {
|
|
6585
|
-
top: padding,
|
|
6586
|
-
right: padding,
|
|
6587
|
-
bottom: padding,
|
|
6588
|
-
left: padding
|
|
6589
|
-
};
|
|
6590
|
-
}
|
|
6591
|
-
function rectToClientRect(rect) {
|
|
6592
|
-
const {
|
|
6593
|
-
x,
|
|
6594
|
-
y,
|
|
6595
|
-
width,
|
|
6596
|
-
height
|
|
6597
|
-
} = rect;
|
|
6598
|
-
return {
|
|
6599
|
-
width,
|
|
6600
|
-
height,
|
|
6601
|
-
top: y,
|
|
6602
|
-
left: x,
|
|
6603
|
-
right: x + width,
|
|
6604
|
-
bottom: y + height,
|
|
6605
|
-
x,
|
|
6606
|
-
y
|
|
6607
|
-
};
|
|
6608
|
-
}
|
|
6609
|
-
|
|
6610
|
-
function computeCoordsFromPlacement(_ref, placement, rtl) {
|
|
6611
|
-
let {
|
|
6612
|
-
reference,
|
|
6613
|
-
floating
|
|
6614
|
-
} = _ref;
|
|
6615
|
-
const sideAxis = getSideAxis(placement);
|
|
6616
|
-
const alignmentAxis = getAlignmentAxis(placement);
|
|
6617
|
-
const alignLength = getAxisLength(alignmentAxis);
|
|
6618
|
-
const side = getSide(placement);
|
|
6619
|
-
const isVertical = sideAxis === 'y';
|
|
6620
|
-
const commonX = reference.x + reference.width / 2 - floating.width / 2;
|
|
6621
|
-
const commonY = reference.y + reference.height / 2 - floating.height / 2;
|
|
6622
|
-
const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2;
|
|
6623
|
-
let coords;
|
|
6624
|
-
switch (side) {
|
|
6625
|
-
case 'top':
|
|
6626
|
-
coords = {
|
|
6627
|
-
x: commonX,
|
|
6628
|
-
y: reference.y - floating.height
|
|
6629
|
-
};
|
|
6630
|
-
break;
|
|
6631
|
-
case 'bottom':
|
|
6632
|
-
coords = {
|
|
6633
|
-
x: commonX,
|
|
6634
|
-
y: reference.y + reference.height
|
|
6635
|
-
};
|
|
6636
|
-
break;
|
|
6637
|
-
case 'right':
|
|
6638
|
-
coords = {
|
|
6639
|
-
x: reference.x + reference.width,
|
|
6640
|
-
y: commonY
|
|
6641
|
-
};
|
|
6642
|
-
break;
|
|
6643
|
-
case 'left':
|
|
6644
|
-
coords = {
|
|
6645
|
-
x: reference.x - floating.width,
|
|
6646
|
-
y: commonY
|
|
6647
|
-
};
|
|
6648
|
-
break;
|
|
6649
|
-
default:
|
|
6650
|
-
coords = {
|
|
6651
|
-
x: reference.x,
|
|
6652
|
-
y: reference.y
|
|
6653
|
-
};
|
|
6654
|
-
}
|
|
6655
|
-
switch (getAlignment(placement)) {
|
|
6656
|
-
case 'start':
|
|
6657
|
-
coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
|
|
6658
|
-
break;
|
|
6659
|
-
case 'end':
|
|
6660
|
-
coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
|
|
6661
|
-
break;
|
|
6662
|
-
}
|
|
6663
|
-
return coords;
|
|
6664
|
-
}
|
|
6665
|
-
|
|
6666
|
-
/**
|
|
6667
|
-
* Resolves with an object of overflow side offsets that determine how much the
|
|
6668
|
-
* element is overflowing a given clipping boundary on each side.
|
|
6669
|
-
* - positive = overflowing the boundary by that number of pixels
|
|
6670
|
-
* - negative = how many pixels left before it will overflow
|
|
6671
|
-
* - 0 = lies flush with the boundary
|
|
6672
|
-
* @see https://floating-ui.com/docs/detectOverflow
|
|
6673
|
-
*/
|
|
6674
|
-
async function detectOverflow(state, options) {
|
|
6675
|
-
var _await$platform$isEle;
|
|
6676
|
-
if (options === void 0) {
|
|
6677
|
-
options = {};
|
|
6678
|
-
}
|
|
6679
|
-
const {
|
|
6680
|
-
x,
|
|
6681
|
-
y,
|
|
6682
|
-
platform,
|
|
6683
|
-
rects,
|
|
6684
|
-
elements,
|
|
6685
|
-
strategy
|
|
6686
|
-
} = state;
|
|
6687
|
-
const {
|
|
6688
|
-
boundary = 'clippingAncestors',
|
|
6689
|
-
rootBoundary = 'viewport',
|
|
6690
|
-
elementContext = 'floating',
|
|
6691
|
-
altBoundary = false,
|
|
6692
|
-
padding = 0
|
|
6693
|
-
} = evaluate(options, state);
|
|
6694
|
-
const paddingObject = getPaddingObject(padding);
|
|
6695
|
-
const altContext = elementContext === 'floating' ? 'reference' : 'floating';
|
|
6696
|
-
const element = elements[altBoundary ? altContext : elementContext];
|
|
6697
|
-
const clippingClientRect = rectToClientRect(await platform.getClippingRect({
|
|
6698
|
-
element: ((_await$platform$isEle = await (platform.isElement == null ? void 0 : platform.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || (await (platform.getDocumentElement == null ? void 0 : platform.getDocumentElement(elements.floating))),
|
|
6699
|
-
boundary,
|
|
6700
|
-
rootBoundary,
|
|
6701
|
-
strategy
|
|
6702
|
-
}));
|
|
6703
|
-
const rect = elementContext === 'floating' ? {
|
|
6704
|
-
x,
|
|
6705
|
-
y,
|
|
6706
|
-
width: rects.floating.width,
|
|
6707
|
-
height: rects.floating.height
|
|
6708
|
-
} : rects.reference;
|
|
6709
|
-
const offsetParent = await (platform.getOffsetParent == null ? void 0 : platform.getOffsetParent(elements.floating));
|
|
6710
|
-
const offsetScale = (await (platform.isElement == null ? void 0 : platform.isElement(offsetParent))) ? (await (platform.getScale == null ? void 0 : platform.getScale(offsetParent))) || {
|
|
6711
|
-
x: 1,
|
|
6712
|
-
y: 1
|
|
6713
|
-
} : {
|
|
6714
|
-
x: 1,
|
|
6715
|
-
y: 1
|
|
6716
|
-
};
|
|
6717
|
-
const elementClientRect = rectToClientRect(platform.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform.convertOffsetParentRelativeRectToViewportRelativeRect({
|
|
6718
|
-
elements,
|
|
6719
|
-
rect,
|
|
6720
|
-
offsetParent,
|
|
6721
|
-
strategy
|
|
6722
|
-
}) : rect);
|
|
6723
|
-
return {
|
|
6724
|
-
top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
|
|
6725
|
-
bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
|
|
6726
|
-
left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
|
|
6727
|
-
right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
|
|
6728
|
-
};
|
|
6729
|
-
}
|
|
6730
|
-
|
|
6731
|
-
// Maximum number of resets that can occur before bailing to avoid infinite reset loops.
|
|
6732
|
-
const MAX_RESET_COUNT = 50;
|
|
6733
|
-
|
|
6734
|
-
/**
|
|
6735
|
-
* Computes the `x` and `y` coordinates that will place the floating element
|
|
6736
|
-
* next to a given reference element.
|
|
6737
|
-
*
|
|
6738
|
-
* This export does not have any `platform` interface logic. You will need to
|
|
6739
|
-
* write one for the platform you are using Floating UI with.
|
|
6740
|
-
*/
|
|
6741
|
-
const computePosition$1 = async (reference, floating, config) => {
|
|
6742
|
-
const {
|
|
6743
|
-
placement = 'bottom',
|
|
6744
|
-
strategy = 'absolute',
|
|
6745
|
-
middleware = [],
|
|
6746
|
-
platform
|
|
6747
|
-
} = config;
|
|
6748
|
-
const platformWithDetectOverflow = platform.detectOverflow ? platform : {
|
|
6749
|
-
...platform,
|
|
6750
|
-
detectOverflow
|
|
6751
|
-
};
|
|
6752
|
-
const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(floating));
|
|
6753
|
-
let rects = await platform.getElementRects({
|
|
6754
|
-
reference,
|
|
6755
|
-
floating,
|
|
6756
|
-
strategy
|
|
6757
|
-
});
|
|
6758
|
-
let {
|
|
6759
|
-
x,
|
|
6760
|
-
y
|
|
6761
|
-
} = computeCoordsFromPlacement(rects, placement, rtl);
|
|
6762
|
-
let statefulPlacement = placement;
|
|
6763
|
-
let resetCount = 0;
|
|
6764
|
-
const middlewareData = {};
|
|
6765
|
-
for (let i = 0; i < middleware.length; i++) {
|
|
6766
|
-
const currentMiddleware = middleware[i];
|
|
6767
|
-
if (!currentMiddleware) {
|
|
6768
|
-
continue;
|
|
6769
|
-
}
|
|
6770
|
-
const {
|
|
6771
|
-
name,
|
|
6772
|
-
fn
|
|
6773
|
-
} = currentMiddleware;
|
|
6774
|
-
const {
|
|
6775
|
-
x: nextX,
|
|
6776
|
-
y: nextY,
|
|
6777
|
-
data,
|
|
6778
|
-
reset
|
|
6779
|
-
} = await fn({
|
|
6780
|
-
x,
|
|
6781
|
-
y,
|
|
6782
|
-
initialPlacement: placement,
|
|
6783
|
-
placement: statefulPlacement,
|
|
6784
|
-
strategy,
|
|
6785
|
-
middlewareData,
|
|
6786
|
-
rects,
|
|
6787
|
-
platform: platformWithDetectOverflow,
|
|
6788
|
-
elements: {
|
|
6789
|
-
reference,
|
|
6790
|
-
floating
|
|
6791
|
-
}
|
|
6792
|
-
});
|
|
6793
|
-
x = nextX != null ? nextX : x;
|
|
6794
|
-
y = nextY != null ? nextY : y;
|
|
6795
|
-
middlewareData[name] = {
|
|
6796
|
-
...middlewareData[name],
|
|
6797
|
-
...data
|
|
6798
|
-
};
|
|
6799
|
-
if (reset && resetCount < MAX_RESET_COUNT) {
|
|
6800
|
-
resetCount++;
|
|
6801
|
-
if (typeof reset === 'object') {
|
|
6802
|
-
if (reset.placement) {
|
|
6803
|
-
statefulPlacement = reset.placement;
|
|
6804
|
-
}
|
|
6805
|
-
if (reset.rects) {
|
|
6806
|
-
rects = reset.rects === true ? await platform.getElementRects({
|
|
6807
|
-
reference,
|
|
6808
|
-
floating,
|
|
6809
|
-
strategy
|
|
6810
|
-
}) : reset.rects;
|
|
6811
|
-
}
|
|
6812
|
-
({
|
|
6813
|
-
x,
|
|
6814
|
-
y
|
|
6815
|
-
} = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
|
|
6816
|
-
}
|
|
6817
|
-
i = -1;
|
|
6818
|
-
}
|
|
6819
|
-
}
|
|
6820
|
-
return {
|
|
6821
|
-
x,
|
|
6822
|
-
y,
|
|
6823
|
-
placement: statefulPlacement,
|
|
6824
|
-
strategy,
|
|
6825
|
-
middlewareData
|
|
6826
|
-
};
|
|
6827
|
-
};
|
|
6828
|
-
|
|
6829
|
-
/**
|
|
6830
|
-
* Optimizes the visibility of the floating element by flipping the `placement`
|
|
6831
|
-
* in order to keep it in view when the preferred placement(s) will overflow the
|
|
6832
|
-
* clipping boundary. Alternative to `autoPlacement`.
|
|
6833
|
-
* @see https://floating-ui.com/docs/flip
|
|
6834
|
-
*/
|
|
6835
|
-
const flip$1 = function (options) {
|
|
6836
|
-
if (options === void 0) {
|
|
6837
|
-
options = {};
|
|
6838
|
-
}
|
|
6839
|
-
return {
|
|
6840
|
-
name: 'flip',
|
|
6841
|
-
options,
|
|
6842
|
-
async fn(state) {
|
|
6843
|
-
var _middlewareData$arrow, _middlewareData$flip;
|
|
6844
|
-
const {
|
|
6845
|
-
placement,
|
|
6846
|
-
middlewareData,
|
|
6847
|
-
rects,
|
|
6848
|
-
initialPlacement,
|
|
6849
|
-
platform,
|
|
6850
|
-
elements
|
|
6851
|
-
} = state;
|
|
6852
|
-
const {
|
|
6853
|
-
mainAxis: checkMainAxis = true,
|
|
6854
|
-
crossAxis: checkCrossAxis = true,
|
|
6855
|
-
fallbackPlacements: specifiedFallbackPlacements,
|
|
6856
|
-
fallbackStrategy = 'bestFit',
|
|
6857
|
-
fallbackAxisSideDirection = 'none',
|
|
6858
|
-
flipAlignment = true,
|
|
6859
|
-
...detectOverflowOptions
|
|
6860
|
-
} = evaluate(options, state);
|
|
6861
|
-
|
|
6862
|
-
// If a reset by the arrow was caused due to an alignment offset being
|
|
6863
|
-
// added, we should skip any logic now since `flip()` has already done its
|
|
6864
|
-
// work.
|
|
6865
|
-
// https://github.com/floating-ui/floating-ui/issues/2549#issuecomment-1719601643
|
|
6866
|
-
if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
|
|
6867
|
-
return {};
|
|
6868
|
-
}
|
|
6869
|
-
const side = getSide(placement);
|
|
6870
|
-
const initialSideAxis = getSideAxis(initialPlacement);
|
|
6871
|
-
const isBasePlacement = getSide(initialPlacement) === initialPlacement;
|
|
6872
|
-
const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
|
|
6873
|
-
const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement));
|
|
6874
|
-
const hasFallbackAxisSideDirection = fallbackAxisSideDirection !== 'none';
|
|
6875
|
-
if (!specifiedFallbackPlacements && hasFallbackAxisSideDirection) {
|
|
6876
|
-
fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl));
|
|
6877
|
-
}
|
|
6878
|
-
const placements = [initialPlacement, ...fallbackPlacements];
|
|
6879
|
-
const overflow = await platform.detectOverflow(state, detectOverflowOptions);
|
|
6880
|
-
const overflows = [];
|
|
6881
|
-
let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || [];
|
|
6882
|
-
if (checkMainAxis) {
|
|
6883
|
-
overflows.push(overflow[side]);
|
|
6884
|
-
}
|
|
6885
|
-
if (checkCrossAxis) {
|
|
6886
|
-
const sides = getAlignmentSides(placement, rects, rtl);
|
|
6887
|
-
overflows.push(overflow[sides[0]], overflow[sides[1]]);
|
|
6888
|
-
}
|
|
6889
|
-
overflowsData = [...overflowsData, {
|
|
6890
|
-
placement,
|
|
6891
|
-
overflows
|
|
6892
|
-
}];
|
|
6893
|
-
|
|
6894
|
-
// One or more sides is overflowing.
|
|
6895
|
-
if (!overflows.every(side => side <= 0)) {
|
|
6896
|
-
var _middlewareData$flip2, _overflowsData$filter;
|
|
6897
|
-
const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1;
|
|
6898
|
-
const nextPlacement = placements[nextIndex];
|
|
6899
|
-
if (nextPlacement) {
|
|
6900
|
-
const ignoreCrossAxisOverflow = checkCrossAxis === 'alignment' ? initialSideAxis !== getSideAxis(nextPlacement) : false;
|
|
6901
|
-
if (!ignoreCrossAxisOverflow ||
|
|
6902
|
-
// We leave the current main axis only if every placement on that axis
|
|
6903
|
-
// overflows the main axis.
|
|
6904
|
-
overflowsData.every(d => getSideAxis(d.placement) === initialSideAxis ? d.overflows[0] > 0 : true)) {
|
|
6905
|
-
// Try next placement and re-run the lifecycle.
|
|
6906
|
-
return {
|
|
6907
|
-
data: {
|
|
6908
|
-
index: nextIndex,
|
|
6909
|
-
overflows: overflowsData
|
|
6910
|
-
},
|
|
6911
|
-
reset: {
|
|
6912
|
-
placement: nextPlacement
|
|
6913
|
-
}
|
|
6914
|
-
};
|
|
6915
|
-
}
|
|
6916
|
-
}
|
|
6917
|
-
|
|
6918
|
-
// First, find the candidates that fit on the mainAxis side of overflow,
|
|
6919
|
-
// then find the placement that fits the best on the main crossAxis side.
|
|
6920
|
-
let resetPlacement = (_overflowsData$filter = overflowsData.filter(d => d.overflows[0] <= 0).sort((a, b) => a.overflows[1] - b.overflows[1])[0]) == null ? void 0 : _overflowsData$filter.placement;
|
|
6921
|
-
|
|
6922
|
-
// Otherwise fallback.
|
|
6923
|
-
if (!resetPlacement) {
|
|
6924
|
-
switch (fallbackStrategy) {
|
|
6925
|
-
case 'bestFit':
|
|
6926
|
-
{
|
|
6927
|
-
var _overflowsData$filter2;
|
|
6928
|
-
const placement = (_overflowsData$filter2 = overflowsData.filter(d => {
|
|
6929
|
-
if (hasFallbackAxisSideDirection) {
|
|
6930
|
-
const currentSideAxis = getSideAxis(d.placement);
|
|
6931
|
-
return currentSideAxis === initialSideAxis ||
|
|
6932
|
-
// Create a bias to the `y` side axis due to horizontal
|
|
6933
|
-
// reading directions favoring greater width.
|
|
6934
|
-
currentSideAxis === 'y';
|
|
6935
|
-
}
|
|
6936
|
-
return true;
|
|
6937
|
-
}).map(d => [d.placement, d.overflows.filter(overflow => overflow > 0).reduce((acc, overflow) => acc + overflow, 0)]).sort((a, b) => a[1] - b[1])[0]) == null ? void 0 : _overflowsData$filter2[0];
|
|
6938
|
-
if (placement) {
|
|
6939
|
-
resetPlacement = placement;
|
|
6940
|
-
}
|
|
6941
|
-
break;
|
|
6942
|
-
}
|
|
6943
|
-
case 'initialPlacement':
|
|
6944
|
-
resetPlacement = initialPlacement;
|
|
6945
|
-
break;
|
|
6946
|
-
}
|
|
6947
|
-
}
|
|
6948
|
-
if (placement !== resetPlacement) {
|
|
6949
|
-
return {
|
|
6950
|
-
reset: {
|
|
6951
|
-
placement: resetPlacement
|
|
6952
|
-
}
|
|
6953
|
-
};
|
|
6954
|
-
}
|
|
6955
|
-
}
|
|
6956
|
-
return {};
|
|
6957
|
-
}
|
|
6958
|
-
};
|
|
6959
|
-
};
|
|
6960
|
-
|
|
6961
|
-
const originSides = /*#__PURE__*/new Set(['left', 'top']);
|
|
6962
|
-
|
|
6963
|
-
// For type backwards-compatibility, the `OffsetOptions` type was also
|
|
6964
|
-
// Derivable.
|
|
6965
|
-
|
|
6966
|
-
async function convertValueToCoords(state, options) {
|
|
6967
|
-
const {
|
|
6968
|
-
placement,
|
|
6969
|
-
platform,
|
|
6970
|
-
elements
|
|
6971
|
-
} = state;
|
|
6972
|
-
const rtl = await (platform.isRTL == null ? void 0 : platform.isRTL(elements.floating));
|
|
6973
|
-
const side = getSide(placement);
|
|
6974
|
-
const alignment = getAlignment(placement);
|
|
6975
|
-
const isVertical = getSideAxis(placement) === 'y';
|
|
6976
|
-
const mainAxisMulti = originSides.has(side) ? -1 : 1;
|
|
6977
|
-
const crossAxisMulti = rtl && isVertical ? -1 : 1;
|
|
6978
|
-
const rawValue = evaluate(options, state);
|
|
6979
|
-
|
|
6980
|
-
// eslint-disable-next-line prefer-const
|
|
6981
|
-
let {
|
|
6982
|
-
mainAxis,
|
|
6983
|
-
crossAxis,
|
|
6984
|
-
alignmentAxis
|
|
6985
|
-
} = typeof rawValue === 'number' ? {
|
|
6986
|
-
mainAxis: rawValue,
|
|
6987
|
-
crossAxis: 0,
|
|
6988
|
-
alignmentAxis: null
|
|
6989
|
-
} : {
|
|
6990
|
-
mainAxis: rawValue.mainAxis || 0,
|
|
6991
|
-
crossAxis: rawValue.crossAxis || 0,
|
|
6992
|
-
alignmentAxis: rawValue.alignmentAxis
|
|
6993
|
-
};
|
|
6994
|
-
if (alignment && typeof alignmentAxis === 'number') {
|
|
6995
|
-
crossAxis = alignment === 'end' ? alignmentAxis * -1 : alignmentAxis;
|
|
6996
|
-
}
|
|
6997
|
-
return isVertical ? {
|
|
6998
|
-
x: crossAxis * crossAxisMulti,
|
|
6999
|
-
y: mainAxis * mainAxisMulti
|
|
7000
|
-
} : {
|
|
7001
|
-
x: mainAxis * mainAxisMulti,
|
|
7002
|
-
y: crossAxis * crossAxisMulti
|
|
7003
|
-
};
|
|
7004
|
-
}
|
|
7005
|
-
|
|
7006
|
-
/**
|
|
7007
|
-
* Modifies the placement by translating the floating element along the
|
|
7008
|
-
* specified axes.
|
|
7009
|
-
* A number (shorthand for `mainAxis` or distance), or an axes configuration
|
|
7010
|
-
* object may be passed.
|
|
7011
|
-
* @see https://floating-ui.com/docs/offset
|
|
7012
|
-
*/
|
|
7013
|
-
const offset$1 = function (options) {
|
|
7014
|
-
if (options === void 0) {
|
|
7015
|
-
options = 0;
|
|
7016
|
-
}
|
|
7017
|
-
return {
|
|
7018
|
-
name: 'offset',
|
|
7019
|
-
options,
|
|
7020
|
-
async fn(state) {
|
|
7021
|
-
var _middlewareData$offse, _middlewareData$arrow;
|
|
7022
|
-
const {
|
|
7023
|
-
x,
|
|
7024
|
-
y,
|
|
7025
|
-
placement,
|
|
7026
|
-
middlewareData
|
|
7027
|
-
} = state;
|
|
7028
|
-
const diffCoords = await convertValueToCoords(state, options);
|
|
7029
|
-
|
|
7030
|
-
// If the placement is the same and the arrow caused an alignment offset
|
|
7031
|
-
// then we don't need to change the positioning coordinates.
|
|
7032
|
-
if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) {
|
|
7033
|
-
return {};
|
|
7034
|
-
}
|
|
7035
|
-
return {
|
|
7036
|
-
x: x + diffCoords.x,
|
|
7037
|
-
y: y + diffCoords.y,
|
|
7038
|
-
data: {
|
|
7039
|
-
...diffCoords,
|
|
7040
|
-
placement
|
|
7041
|
-
}
|
|
7042
|
-
};
|
|
7043
|
-
}
|
|
7044
|
-
};
|
|
7045
|
-
};
|
|
7046
|
-
|
|
7047
|
-
/**
|
|
7048
|
-
* Optimizes the visibility of the floating element by shifting it in order to
|
|
7049
|
-
* keep it in view when it will overflow the clipping boundary.
|
|
7050
|
-
* @see https://floating-ui.com/docs/shift
|
|
7051
|
-
*/
|
|
7052
|
-
const shift$1 = function (options) {
|
|
7053
|
-
if (options === void 0) {
|
|
7054
|
-
options = {};
|
|
7055
|
-
}
|
|
7056
|
-
return {
|
|
7057
|
-
name: 'shift',
|
|
7058
|
-
options,
|
|
7059
|
-
async fn(state) {
|
|
7060
|
-
const {
|
|
7061
|
-
x,
|
|
7062
|
-
y,
|
|
7063
|
-
placement,
|
|
7064
|
-
platform
|
|
7065
|
-
} = state;
|
|
7066
|
-
const {
|
|
7067
|
-
mainAxis: checkMainAxis = true,
|
|
7068
|
-
crossAxis: checkCrossAxis = false,
|
|
7069
|
-
limiter = {
|
|
7070
|
-
fn: _ref => {
|
|
7071
|
-
let {
|
|
7072
|
-
x,
|
|
7073
|
-
y
|
|
7074
|
-
} = _ref;
|
|
7075
|
-
return {
|
|
7076
|
-
x,
|
|
7077
|
-
y
|
|
7078
|
-
};
|
|
7079
|
-
}
|
|
7080
|
-
},
|
|
7081
|
-
...detectOverflowOptions
|
|
7082
|
-
} = evaluate(options, state);
|
|
7083
|
-
const coords = {
|
|
7084
|
-
x,
|
|
7085
|
-
y
|
|
7086
|
-
};
|
|
7087
|
-
const overflow = await platform.detectOverflow(state, detectOverflowOptions);
|
|
7088
|
-
const crossAxis = getSideAxis(getSide(placement));
|
|
7089
|
-
const mainAxis = getOppositeAxis(crossAxis);
|
|
7090
|
-
let mainAxisCoord = coords[mainAxis];
|
|
7091
|
-
let crossAxisCoord = coords[crossAxis];
|
|
7092
|
-
if (checkMainAxis) {
|
|
7093
|
-
const minSide = mainAxis === 'y' ? 'top' : 'left';
|
|
7094
|
-
const maxSide = mainAxis === 'y' ? 'bottom' : 'right';
|
|
7095
|
-
const min = mainAxisCoord + overflow[minSide];
|
|
7096
|
-
const max = mainAxisCoord - overflow[maxSide];
|
|
7097
|
-
mainAxisCoord = clamp(min, mainAxisCoord, max);
|
|
7098
|
-
}
|
|
7099
|
-
if (checkCrossAxis) {
|
|
7100
|
-
const minSide = crossAxis === 'y' ? 'top' : 'left';
|
|
7101
|
-
const maxSide = crossAxis === 'y' ? 'bottom' : 'right';
|
|
7102
|
-
const min = crossAxisCoord + overflow[minSide];
|
|
7103
|
-
const max = crossAxisCoord - overflow[maxSide];
|
|
7104
|
-
crossAxisCoord = clamp(min, crossAxisCoord, max);
|
|
7105
|
-
}
|
|
7106
|
-
const limitedCoords = limiter.fn({
|
|
7107
|
-
...state,
|
|
7108
|
-
[mainAxis]: mainAxisCoord,
|
|
7109
|
-
[crossAxis]: crossAxisCoord
|
|
7110
|
-
});
|
|
7111
|
-
return {
|
|
7112
|
-
...limitedCoords,
|
|
7113
|
-
data: {
|
|
7114
|
-
x: limitedCoords.x - x,
|
|
7115
|
-
y: limitedCoords.y - y,
|
|
7116
|
-
enabled: {
|
|
7117
|
-
[mainAxis]: checkMainAxis,
|
|
7118
|
-
[crossAxis]: checkCrossAxis
|
|
7119
|
-
}
|
|
7120
|
-
}
|
|
7121
|
-
};
|
|
7122
|
-
}
|
|
7123
|
-
};
|
|
7124
|
-
};
|
|
7125
|
-
|
|
7126
|
-
function hasWindow() {
|
|
7127
|
-
return typeof window !== 'undefined';
|
|
7128
|
-
}
|
|
7129
|
-
function getNodeName(node) {
|
|
7130
|
-
if (isNode(node)) {
|
|
7131
|
-
return (node.nodeName || '').toLowerCase();
|
|
7132
|
-
}
|
|
7133
|
-
// Mocked nodes in testing environments may not be instances of Node. By
|
|
7134
|
-
// returning `#document` an infinite loop won't occur.
|
|
7135
|
-
// https://github.com/floating-ui/floating-ui/issues/2317
|
|
7136
|
-
return '#document';
|
|
7137
|
-
}
|
|
7138
|
-
function getWindow(node) {
|
|
7139
|
-
var _node$ownerDocument;
|
|
7140
|
-
return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
|
|
7141
|
-
}
|
|
7142
|
-
function getDocumentElement(node) {
|
|
7143
|
-
var _ref;
|
|
7144
|
-
return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement;
|
|
7145
|
-
}
|
|
7146
|
-
function isNode(value) {
|
|
7147
|
-
if (!hasWindow()) {
|
|
7148
|
-
return false;
|
|
7149
|
-
}
|
|
7150
|
-
return value instanceof Node || value instanceof getWindow(value).Node;
|
|
7151
|
-
}
|
|
7152
|
-
function isElement(value) {
|
|
7153
|
-
if (!hasWindow()) {
|
|
7154
|
-
return false;
|
|
7155
|
-
}
|
|
7156
|
-
return value instanceof Element || value instanceof getWindow(value).Element;
|
|
7157
|
-
}
|
|
7158
|
-
function isHTMLElement(value) {
|
|
7159
|
-
if (!hasWindow()) {
|
|
7160
|
-
return false;
|
|
7161
|
-
}
|
|
7162
|
-
return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
|
|
7163
|
-
}
|
|
7164
|
-
function isShadowRoot(value) {
|
|
7165
|
-
if (!hasWindow() || typeof ShadowRoot === 'undefined') {
|
|
7166
|
-
return false;
|
|
7167
|
-
}
|
|
7168
|
-
return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
|
|
7169
|
-
}
|
|
7170
|
-
function isOverflowElement(element) {
|
|
7171
|
-
const {
|
|
7172
|
-
overflow,
|
|
7173
|
-
overflowX,
|
|
7174
|
-
overflowY,
|
|
7175
|
-
display
|
|
7176
|
-
} = getComputedStyle$1(element);
|
|
7177
|
-
return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && display !== 'inline' && display !== 'contents';
|
|
7178
|
-
}
|
|
7179
|
-
function isTableElement(element) {
|
|
7180
|
-
return /^(table|td|th)$/.test(getNodeName(element));
|
|
7181
|
-
}
|
|
7182
|
-
function isTopLayer(element) {
|
|
7183
|
-
try {
|
|
7184
|
-
if (element.matches(':popover-open')) {
|
|
7185
|
-
return true;
|
|
7186
|
-
}
|
|
7187
|
-
} catch (_e) {
|
|
7188
|
-
// no-op
|
|
7189
|
-
}
|
|
7190
|
-
try {
|
|
7191
|
-
return element.matches(':modal');
|
|
7192
|
-
} catch (_e) {
|
|
7193
|
-
return false;
|
|
7194
|
-
}
|
|
7195
|
-
}
|
|
7196
|
-
const willChangeRe = /transform|translate|scale|rotate|perspective|filter/;
|
|
7197
|
-
const containRe = /paint|layout|strict|content/;
|
|
7198
|
-
const isNotNone = value => !!value && value !== 'none';
|
|
7199
|
-
let isWebKitValue;
|
|
7200
|
-
function isContainingBlock(elementOrCss) {
|
|
7201
|
-
const css = isElement(elementOrCss) ? getComputedStyle$1(elementOrCss) : elementOrCss;
|
|
7202
|
-
|
|
7203
|
-
// https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
|
|
7204
|
-
// https://drafts.csswg.org/css-transforms-2/#individual-transforms
|
|
7205
|
-
return isNotNone(css.transform) || isNotNone(css.translate) || isNotNone(css.scale) || isNotNone(css.rotate) || isNotNone(css.perspective) || !isWebKit() && (isNotNone(css.backdropFilter) || isNotNone(css.filter)) || willChangeRe.test(css.willChange || '') || containRe.test(css.contain || '');
|
|
7206
|
-
}
|
|
7207
|
-
function getContainingBlock(element) {
|
|
7208
|
-
let currentNode = getParentNode(element);
|
|
7209
|
-
while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) {
|
|
7210
|
-
if (isContainingBlock(currentNode)) {
|
|
7211
|
-
return currentNode;
|
|
7212
|
-
} else if (isTopLayer(currentNode)) {
|
|
7213
|
-
return null;
|
|
7214
|
-
}
|
|
7215
|
-
currentNode = getParentNode(currentNode);
|
|
7216
|
-
}
|
|
7217
|
-
return null;
|
|
7218
|
-
}
|
|
7219
|
-
function isWebKit() {
|
|
7220
|
-
if (isWebKitValue == null) {
|
|
7221
|
-
isWebKitValue = typeof CSS !== 'undefined' && CSS.supports && CSS.supports('-webkit-backdrop-filter', 'none');
|
|
7222
|
-
}
|
|
7223
|
-
return isWebKitValue;
|
|
7224
|
-
}
|
|
7225
|
-
function isLastTraversableNode(node) {
|
|
7226
|
-
return /^(html|body|#document)$/.test(getNodeName(node));
|
|
7227
|
-
}
|
|
7228
|
-
function getComputedStyle$1(element) {
|
|
7229
|
-
return getWindow(element).getComputedStyle(element);
|
|
7230
|
-
}
|
|
7231
|
-
function getNodeScroll(element) {
|
|
7232
|
-
if (isElement(element)) {
|
|
7233
|
-
return {
|
|
7234
|
-
scrollLeft: element.scrollLeft,
|
|
7235
|
-
scrollTop: element.scrollTop
|
|
7236
|
-
};
|
|
7237
|
-
}
|
|
7238
|
-
return {
|
|
7239
|
-
scrollLeft: element.scrollX,
|
|
7240
|
-
scrollTop: element.scrollY
|
|
7241
|
-
};
|
|
7242
|
-
}
|
|
7243
|
-
function getParentNode(node) {
|
|
7244
|
-
if (getNodeName(node) === 'html') {
|
|
7245
|
-
return node;
|
|
7246
|
-
}
|
|
7247
|
-
const result =
|
|
7248
|
-
// Step into the shadow DOM of the parent of a slotted node.
|
|
7249
|
-
node.assignedSlot ||
|
|
7250
|
-
// DOM Element detected.
|
|
7251
|
-
node.parentNode ||
|
|
7252
|
-
// ShadowRoot detected.
|
|
7253
|
-
isShadowRoot(node) && node.host ||
|
|
7254
|
-
// Fallback.
|
|
7255
|
-
getDocumentElement(node);
|
|
7256
|
-
return isShadowRoot(result) ? result.host : result;
|
|
7257
|
-
}
|
|
7258
|
-
function getNearestOverflowAncestor(node) {
|
|
7259
|
-
const parentNode = getParentNode(node);
|
|
7260
|
-
if (isLastTraversableNode(parentNode)) {
|
|
7261
|
-
return node.ownerDocument ? node.ownerDocument.body : node.body;
|
|
7262
|
-
}
|
|
7263
|
-
if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {
|
|
7264
|
-
return parentNode;
|
|
7265
|
-
}
|
|
7266
|
-
return getNearestOverflowAncestor(parentNode);
|
|
7267
|
-
}
|
|
7268
|
-
function getOverflowAncestors(node, list, traverseIframes) {
|
|
7269
|
-
var _node$ownerDocument2;
|
|
7270
|
-
if (list === void 0) {
|
|
7271
|
-
list = [];
|
|
7272
|
-
}
|
|
7273
|
-
if (traverseIframes === void 0) {
|
|
7274
|
-
traverseIframes = true;
|
|
7275
|
-
}
|
|
7276
|
-
const scrollableAncestor = getNearestOverflowAncestor(node);
|
|
7277
|
-
const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
|
|
7278
|
-
const win = getWindow(scrollableAncestor);
|
|
7279
|
-
if (isBody) {
|
|
7280
|
-
const frameElement = getFrameElement(win);
|
|
7281
|
-
return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
|
|
7282
|
-
} else {
|
|
7283
|
-
return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
|
|
7284
|
-
}
|
|
7285
|
-
}
|
|
7286
|
-
function getFrameElement(win) {
|
|
7287
|
-
return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
|
|
7288
|
-
}
|
|
7289
|
-
|
|
7290
|
-
function getCssDimensions(element) {
|
|
7291
|
-
const css = getComputedStyle$1(element);
|
|
7292
|
-
// In testing environments, the `width` and `height` properties are empty
|
|
7293
|
-
// strings for SVG elements, returning NaN. Fallback to `0` in this case.
|
|
7294
|
-
let width = parseFloat(css.width) || 0;
|
|
7295
|
-
let height = parseFloat(css.height) || 0;
|
|
7296
|
-
const hasOffset = isHTMLElement(element);
|
|
7297
|
-
const offsetWidth = hasOffset ? element.offsetWidth : width;
|
|
7298
|
-
const offsetHeight = hasOffset ? element.offsetHeight : height;
|
|
7299
|
-
const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
|
|
7300
|
-
if (shouldFallback) {
|
|
7301
|
-
width = offsetWidth;
|
|
7302
|
-
height = offsetHeight;
|
|
7303
|
-
}
|
|
7304
|
-
return {
|
|
7305
|
-
width,
|
|
7306
|
-
height,
|
|
7307
|
-
$: shouldFallback
|
|
7308
|
-
};
|
|
7309
|
-
}
|
|
7310
|
-
|
|
7311
|
-
function unwrapElement(element) {
|
|
7312
|
-
return !isElement(element) ? element.contextElement : element;
|
|
7313
|
-
}
|
|
7314
|
-
|
|
7315
|
-
function getScale(element) {
|
|
7316
|
-
const domElement = unwrapElement(element);
|
|
7317
|
-
if (!isHTMLElement(domElement)) {
|
|
7318
|
-
return createCoords(1);
|
|
7319
|
-
}
|
|
7320
|
-
const rect = domElement.getBoundingClientRect();
|
|
7321
|
-
const {
|
|
7322
|
-
width,
|
|
7323
|
-
height,
|
|
7324
|
-
$
|
|
7325
|
-
} = getCssDimensions(domElement);
|
|
7326
|
-
let x = ($ ? round(rect.width) : rect.width) / width;
|
|
7327
|
-
let y = ($ ? round(rect.height) : rect.height) / height;
|
|
7328
|
-
|
|
7329
|
-
// 0, NaN, or Infinity should always fallback to 1.
|
|
7330
|
-
|
|
7331
|
-
if (!x || !Number.isFinite(x)) {
|
|
7332
|
-
x = 1;
|
|
7333
|
-
}
|
|
7334
|
-
if (!y || !Number.isFinite(y)) {
|
|
7335
|
-
y = 1;
|
|
7336
|
-
}
|
|
7337
|
-
return {
|
|
7338
|
-
x,
|
|
7339
|
-
y
|
|
7340
|
-
};
|
|
7341
|
-
}
|
|
7342
|
-
|
|
7343
|
-
const noOffsets = /*#__PURE__*/createCoords(0);
|
|
7344
|
-
function getVisualOffsets(element) {
|
|
7345
|
-
const win = getWindow(element);
|
|
7346
|
-
if (!isWebKit() || !win.visualViewport) {
|
|
7347
|
-
return noOffsets;
|
|
7348
|
-
}
|
|
7349
|
-
return {
|
|
7350
|
-
x: win.visualViewport.offsetLeft,
|
|
7351
|
-
y: win.visualViewport.offsetTop
|
|
7352
|
-
};
|
|
7353
|
-
}
|
|
7354
|
-
function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
|
|
7355
|
-
if (isFixed === void 0) {
|
|
7356
|
-
isFixed = false;
|
|
7357
|
-
}
|
|
7358
|
-
if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) {
|
|
7359
|
-
return false;
|
|
7360
|
-
}
|
|
7361
|
-
return isFixed;
|
|
7362
|
-
}
|
|
7363
|
-
|
|
7364
|
-
function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
|
|
7365
|
-
if (includeScale === void 0) {
|
|
7366
|
-
includeScale = false;
|
|
7367
|
-
}
|
|
7368
|
-
if (isFixedStrategy === void 0) {
|
|
7369
|
-
isFixedStrategy = false;
|
|
7370
|
-
}
|
|
7371
|
-
const clientRect = element.getBoundingClientRect();
|
|
7372
|
-
const domElement = unwrapElement(element);
|
|
7373
|
-
let scale = createCoords(1);
|
|
7374
|
-
if (includeScale) {
|
|
7375
|
-
if (offsetParent) {
|
|
7376
|
-
if (isElement(offsetParent)) {
|
|
7377
|
-
scale = getScale(offsetParent);
|
|
7378
|
-
}
|
|
7379
|
-
} else {
|
|
7380
|
-
scale = getScale(element);
|
|
7381
|
-
}
|
|
7382
|
-
}
|
|
7383
|
-
const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
|
|
7384
|
-
let x = (clientRect.left + visualOffsets.x) / scale.x;
|
|
7385
|
-
let y = (clientRect.top + visualOffsets.y) / scale.y;
|
|
7386
|
-
let width = clientRect.width / scale.x;
|
|
7387
|
-
let height = clientRect.height / scale.y;
|
|
7388
|
-
if (domElement) {
|
|
7389
|
-
const win = getWindow(domElement);
|
|
7390
|
-
const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent;
|
|
7391
|
-
let currentWin = win;
|
|
7392
|
-
let currentIFrame = getFrameElement(currentWin);
|
|
7393
|
-
while (currentIFrame && offsetParent && offsetWin !== currentWin) {
|
|
7394
|
-
const iframeScale = getScale(currentIFrame);
|
|
7395
|
-
const iframeRect = currentIFrame.getBoundingClientRect();
|
|
7396
|
-
const css = getComputedStyle$1(currentIFrame);
|
|
7397
|
-
const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
|
|
7398
|
-
const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
|
|
7399
|
-
x *= iframeScale.x;
|
|
7400
|
-
y *= iframeScale.y;
|
|
7401
|
-
width *= iframeScale.x;
|
|
7402
|
-
height *= iframeScale.y;
|
|
7403
|
-
x += left;
|
|
7404
|
-
y += top;
|
|
7405
|
-
currentWin = getWindow(currentIFrame);
|
|
7406
|
-
currentIFrame = getFrameElement(currentWin);
|
|
7407
|
-
}
|
|
7408
|
-
}
|
|
7409
|
-
return rectToClientRect({
|
|
7410
|
-
width,
|
|
7411
|
-
height,
|
|
7412
|
-
x,
|
|
7413
|
-
y
|
|
7414
|
-
});
|
|
7415
|
-
}
|
|
7416
|
-
|
|
7417
|
-
// If <html> has a CSS width greater than the viewport, then this will be
|
|
7418
|
-
// incorrect for RTL.
|
|
7419
|
-
function getWindowScrollBarX(element, rect) {
|
|
7420
|
-
const leftScroll = getNodeScroll(element).scrollLeft;
|
|
7421
|
-
if (!rect) {
|
|
7422
|
-
return getBoundingClientRect(getDocumentElement(element)).left + leftScroll;
|
|
7423
|
-
}
|
|
7424
|
-
return rect.left + leftScroll;
|
|
7425
|
-
}
|
|
7426
|
-
|
|
7427
|
-
function getHTMLOffset(documentElement, scroll) {
|
|
7428
|
-
const htmlRect = documentElement.getBoundingClientRect();
|
|
7429
|
-
const x = htmlRect.left + scroll.scrollLeft - getWindowScrollBarX(documentElement, htmlRect);
|
|
7430
|
-
const y = htmlRect.top + scroll.scrollTop;
|
|
7431
|
-
return {
|
|
7432
|
-
x,
|
|
7433
|
-
y
|
|
7434
|
-
};
|
|
7435
|
-
}
|
|
7436
|
-
|
|
7437
|
-
function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
|
|
7438
|
-
let {
|
|
7439
|
-
elements,
|
|
7440
|
-
rect,
|
|
7441
|
-
offsetParent,
|
|
7442
|
-
strategy
|
|
7443
|
-
} = _ref;
|
|
7444
|
-
const isFixed = strategy === 'fixed';
|
|
7445
|
-
const documentElement = getDocumentElement(offsetParent);
|
|
7446
|
-
const topLayer = elements ? isTopLayer(elements.floating) : false;
|
|
7447
|
-
if (offsetParent === documentElement || topLayer && isFixed) {
|
|
7448
|
-
return rect;
|
|
7449
|
-
}
|
|
7450
|
-
let scroll = {
|
|
7451
|
-
scrollLeft: 0,
|
|
7452
|
-
scrollTop: 0
|
|
7453
|
-
};
|
|
7454
|
-
let scale = createCoords(1);
|
|
7455
|
-
const offsets = createCoords(0);
|
|
7456
|
-
const isOffsetParentAnElement = isHTMLElement(offsetParent);
|
|
7457
|
-
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
|
|
7458
|
-
if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
|
|
7459
|
-
scroll = getNodeScroll(offsetParent);
|
|
7460
|
-
}
|
|
7461
|
-
if (isOffsetParentAnElement) {
|
|
7462
|
-
const offsetRect = getBoundingClientRect(offsetParent);
|
|
7463
|
-
scale = getScale(offsetParent);
|
|
7464
|
-
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
|
7465
|
-
offsets.y = offsetRect.y + offsetParent.clientTop;
|
|
7466
|
-
}
|
|
7467
|
-
}
|
|
7468
|
-
const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
|
|
7469
|
-
return {
|
|
7470
|
-
width: rect.width * scale.x,
|
|
7471
|
-
height: rect.height * scale.y,
|
|
7472
|
-
x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x,
|
|
7473
|
-
y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y
|
|
7474
|
-
};
|
|
7475
|
-
}
|
|
7476
|
-
|
|
7477
|
-
function getClientRects(element) {
|
|
7478
|
-
return Array.from(element.getClientRects());
|
|
7479
|
-
}
|
|
7480
|
-
|
|
7481
|
-
// Gets the entire size of the scrollable document area, even extending outside
|
|
7482
|
-
// of the `<html>` and `<body>` rect bounds if horizontally scrollable.
|
|
7483
|
-
function getDocumentRect(element) {
|
|
7484
|
-
const html = getDocumentElement(element);
|
|
7485
|
-
const scroll = getNodeScroll(element);
|
|
7486
|
-
const body = element.ownerDocument.body;
|
|
7487
|
-
const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
|
|
7488
|
-
const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
|
|
7489
|
-
let x = -scroll.scrollLeft + getWindowScrollBarX(element);
|
|
7490
|
-
const y = -scroll.scrollTop;
|
|
7491
|
-
if (getComputedStyle$1(body).direction === 'rtl') {
|
|
7492
|
-
x += max(html.clientWidth, body.clientWidth) - width;
|
|
7493
|
-
}
|
|
7494
|
-
return {
|
|
7495
|
-
width,
|
|
7496
|
-
height,
|
|
7497
|
-
x,
|
|
7498
|
-
y
|
|
7499
|
-
};
|
|
7500
|
-
}
|
|
7501
|
-
|
|
7502
|
-
// Safety check: ensure the scrollbar space is reasonable in case this
|
|
7503
|
-
// calculation is affected by unusual styles.
|
|
7504
|
-
// Most scrollbars leave 15-18px of space.
|
|
7505
|
-
const SCROLLBAR_MAX = 25;
|
|
7506
|
-
function getViewportRect(element, strategy) {
|
|
7507
|
-
const win = getWindow(element);
|
|
7508
|
-
const html = getDocumentElement(element);
|
|
7509
|
-
const visualViewport = win.visualViewport;
|
|
7510
|
-
let width = html.clientWidth;
|
|
7511
|
-
let height = html.clientHeight;
|
|
7512
|
-
let x = 0;
|
|
7513
|
-
let y = 0;
|
|
7514
|
-
if (visualViewport) {
|
|
7515
|
-
width = visualViewport.width;
|
|
7516
|
-
height = visualViewport.height;
|
|
7517
|
-
const visualViewportBased = isWebKit();
|
|
7518
|
-
if (!visualViewportBased || visualViewportBased && strategy === 'fixed') {
|
|
7519
|
-
x = visualViewport.offsetLeft;
|
|
7520
|
-
y = visualViewport.offsetTop;
|
|
7521
|
-
}
|
|
7522
|
-
}
|
|
7523
|
-
const windowScrollbarX = getWindowScrollBarX(html);
|
|
7524
|
-
// <html> `overflow: hidden` + `scrollbar-gutter: stable` reduces the
|
|
7525
|
-
// visual width of the <html> but this is not considered in the size
|
|
7526
|
-
// of `html.clientWidth`.
|
|
7527
|
-
if (windowScrollbarX <= 0) {
|
|
7528
|
-
const doc = html.ownerDocument;
|
|
7529
|
-
const body = doc.body;
|
|
7530
|
-
const bodyStyles = getComputedStyle(body);
|
|
7531
|
-
const bodyMarginInline = doc.compatMode === 'CSS1Compat' ? parseFloat(bodyStyles.marginLeft) + parseFloat(bodyStyles.marginRight) || 0 : 0;
|
|
7532
|
-
const clippingStableScrollbarWidth = Math.abs(html.clientWidth - body.clientWidth - bodyMarginInline);
|
|
7533
|
-
if (clippingStableScrollbarWidth <= SCROLLBAR_MAX) {
|
|
7534
|
-
width -= clippingStableScrollbarWidth;
|
|
7535
|
-
}
|
|
7536
|
-
} else if (windowScrollbarX <= SCROLLBAR_MAX) {
|
|
7537
|
-
// If the <body> scrollbar is on the left, the width needs to be extended
|
|
7538
|
-
// by the scrollbar amount so there isn't extra space on the right.
|
|
7539
|
-
width += windowScrollbarX;
|
|
7540
|
-
}
|
|
7541
|
-
return {
|
|
7542
|
-
width,
|
|
7543
|
-
height,
|
|
7544
|
-
x,
|
|
7545
|
-
y
|
|
7546
|
-
};
|
|
7547
|
-
}
|
|
7548
|
-
|
|
7549
|
-
// Returns the inner client rect, subtracting scrollbars if present.
|
|
7550
|
-
function getInnerBoundingClientRect(element, strategy) {
|
|
7551
|
-
const clientRect = getBoundingClientRect(element, true, strategy === 'fixed');
|
|
7552
|
-
const top = clientRect.top + element.clientTop;
|
|
7553
|
-
const left = clientRect.left + element.clientLeft;
|
|
7554
|
-
const scale = isHTMLElement(element) ? getScale(element) : createCoords(1);
|
|
7555
|
-
const width = element.clientWidth * scale.x;
|
|
7556
|
-
const height = element.clientHeight * scale.y;
|
|
7557
|
-
const x = left * scale.x;
|
|
7558
|
-
const y = top * scale.y;
|
|
7559
|
-
return {
|
|
7560
|
-
width,
|
|
7561
|
-
height,
|
|
7562
|
-
x,
|
|
7563
|
-
y
|
|
7564
|
-
};
|
|
7565
|
-
}
|
|
7566
|
-
function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
|
|
7567
|
-
let rect;
|
|
7568
|
-
if (clippingAncestor === 'viewport') {
|
|
7569
|
-
rect = getViewportRect(element, strategy);
|
|
7570
|
-
} else if (clippingAncestor === 'document') {
|
|
7571
|
-
rect = getDocumentRect(getDocumentElement(element));
|
|
7572
|
-
} else if (isElement(clippingAncestor)) {
|
|
7573
|
-
rect = getInnerBoundingClientRect(clippingAncestor, strategy);
|
|
7574
|
-
} else {
|
|
7575
|
-
const visualOffsets = getVisualOffsets(element);
|
|
7576
|
-
rect = {
|
|
7577
|
-
x: clippingAncestor.x - visualOffsets.x,
|
|
7578
|
-
y: clippingAncestor.y - visualOffsets.y,
|
|
7579
|
-
width: clippingAncestor.width,
|
|
7580
|
-
height: clippingAncestor.height
|
|
7581
|
-
};
|
|
7582
|
-
}
|
|
7583
|
-
return rectToClientRect(rect);
|
|
7584
|
-
}
|
|
7585
|
-
function hasFixedPositionAncestor(element, stopNode) {
|
|
7586
|
-
const parentNode = getParentNode(element);
|
|
7587
|
-
if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) {
|
|
7588
|
-
return false;
|
|
7589
|
-
}
|
|
7590
|
-
return getComputedStyle$1(parentNode).position === 'fixed' || hasFixedPositionAncestor(parentNode, stopNode);
|
|
7591
|
-
}
|
|
7592
|
-
|
|
7593
|
-
// A "clipping ancestor" is an `overflow` element with the characteristic of
|
|
7594
|
-
// clipping (or hiding) child elements. This returns all clipping ancestors
|
|
7595
|
-
// of the given element up the tree.
|
|
7596
|
-
function getClippingElementAncestors(element, cache) {
|
|
7597
|
-
const cachedResult = cache.get(element);
|
|
7598
|
-
if (cachedResult) {
|
|
7599
|
-
return cachedResult;
|
|
7600
|
-
}
|
|
7601
|
-
let result = getOverflowAncestors(element, [], false).filter(el => isElement(el) && getNodeName(el) !== 'body');
|
|
7602
|
-
let currentContainingBlockComputedStyle = null;
|
|
7603
|
-
const elementIsFixed = getComputedStyle$1(element).position === 'fixed';
|
|
7604
|
-
let currentNode = elementIsFixed ? getParentNode(element) : element;
|
|
7605
|
-
|
|
7606
|
-
// https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
|
|
7607
|
-
while (isElement(currentNode) && !isLastTraversableNode(currentNode)) {
|
|
7608
|
-
const computedStyle = getComputedStyle$1(currentNode);
|
|
7609
|
-
const currentNodeIsContaining = isContainingBlock(currentNode);
|
|
7610
|
-
if (!currentNodeIsContaining && computedStyle.position === 'fixed') {
|
|
7611
|
-
currentContainingBlockComputedStyle = null;
|
|
7612
|
-
}
|
|
7613
|
-
const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && (currentContainingBlockComputedStyle.position === 'absolute' || currentContainingBlockComputedStyle.position === 'fixed') || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
|
|
7614
|
-
if (shouldDropCurrentNode) {
|
|
7615
|
-
// Drop non-containing blocks.
|
|
7616
|
-
result = result.filter(ancestor => ancestor !== currentNode);
|
|
7617
|
-
} else {
|
|
7618
|
-
// Record last containing block for next iteration.
|
|
7619
|
-
currentContainingBlockComputedStyle = computedStyle;
|
|
7620
|
-
}
|
|
7621
|
-
currentNode = getParentNode(currentNode);
|
|
7622
|
-
}
|
|
7623
|
-
cache.set(element, result);
|
|
7624
|
-
return result;
|
|
7625
|
-
}
|
|
7626
|
-
|
|
7627
|
-
// Gets the maximum area that the element is visible in due to any number of
|
|
7628
|
-
// clipping ancestors.
|
|
7629
|
-
function getClippingRect(_ref) {
|
|
7630
|
-
let {
|
|
7631
|
-
element,
|
|
7632
|
-
boundary,
|
|
7633
|
-
rootBoundary,
|
|
7634
|
-
strategy
|
|
7635
|
-
} = _ref;
|
|
7636
|
-
const elementClippingAncestors = boundary === 'clippingAncestors' ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);
|
|
7637
|
-
const clippingAncestors = [...elementClippingAncestors, rootBoundary];
|
|
7638
|
-
const firstRect = getClientRectFromClippingAncestor(element, clippingAncestors[0], strategy);
|
|
7639
|
-
let top = firstRect.top;
|
|
7640
|
-
let right = firstRect.right;
|
|
7641
|
-
let bottom = firstRect.bottom;
|
|
7642
|
-
let left = firstRect.left;
|
|
7643
|
-
for (let i = 1; i < clippingAncestors.length; i++) {
|
|
7644
|
-
const rect = getClientRectFromClippingAncestor(element, clippingAncestors[i], strategy);
|
|
7645
|
-
top = max(rect.top, top);
|
|
7646
|
-
right = min(rect.right, right);
|
|
7647
|
-
bottom = min(rect.bottom, bottom);
|
|
7648
|
-
left = max(rect.left, left);
|
|
7649
|
-
}
|
|
7650
|
-
return {
|
|
7651
|
-
width: right - left,
|
|
7652
|
-
height: bottom - top,
|
|
7653
|
-
x: left,
|
|
7654
|
-
y: top
|
|
7655
|
-
};
|
|
7656
|
-
}
|
|
7657
|
-
|
|
7658
|
-
function getDimensions(element) {
|
|
7659
|
-
const {
|
|
7660
|
-
width,
|
|
7661
|
-
height
|
|
7662
|
-
} = getCssDimensions(element);
|
|
7663
|
-
return {
|
|
7664
|
-
width,
|
|
7665
|
-
height
|
|
7666
|
-
};
|
|
7667
|
-
}
|
|
7668
|
-
|
|
7669
|
-
function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
|
|
7670
|
-
const isOffsetParentAnElement = isHTMLElement(offsetParent);
|
|
7671
|
-
const documentElement = getDocumentElement(offsetParent);
|
|
7672
|
-
const isFixed = strategy === 'fixed';
|
|
7673
|
-
const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
|
|
7674
|
-
let scroll = {
|
|
7675
|
-
scrollLeft: 0,
|
|
7676
|
-
scrollTop: 0
|
|
7677
|
-
};
|
|
7678
|
-
const offsets = createCoords(0);
|
|
7679
|
-
|
|
7680
|
-
// If the <body> scrollbar appears on the left (e.g. RTL systems). Use
|
|
7681
|
-
// Firefox with layout.scrollbar.side = 3 in about:config to test this.
|
|
7682
|
-
function setLeftRTLScrollbarOffset() {
|
|
7683
|
-
offsets.x = getWindowScrollBarX(documentElement);
|
|
7684
|
-
}
|
|
7685
|
-
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
|
|
7686
|
-
if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
|
|
7687
|
-
scroll = getNodeScroll(offsetParent);
|
|
7688
|
-
}
|
|
7689
|
-
if (isOffsetParentAnElement) {
|
|
7690
|
-
const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
|
|
7691
|
-
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
|
7692
|
-
offsets.y = offsetRect.y + offsetParent.clientTop;
|
|
7693
|
-
} else if (documentElement) {
|
|
7694
|
-
setLeftRTLScrollbarOffset();
|
|
7695
|
-
}
|
|
7696
|
-
}
|
|
7697
|
-
if (isFixed && !isOffsetParentAnElement && documentElement) {
|
|
7698
|
-
setLeftRTLScrollbarOffset();
|
|
7699
|
-
}
|
|
7700
|
-
const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
|
|
7701
|
-
const x = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x;
|
|
7702
|
-
const y = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y;
|
|
7703
|
-
return {
|
|
7704
|
-
x,
|
|
7705
|
-
y,
|
|
7706
|
-
width: rect.width,
|
|
7707
|
-
height: rect.height
|
|
7708
|
-
};
|
|
7709
|
-
}
|
|
7710
|
-
|
|
7711
|
-
function isStaticPositioned(element) {
|
|
7712
|
-
return getComputedStyle$1(element).position === 'static';
|
|
7713
|
-
}
|
|
7714
|
-
|
|
7715
|
-
function getTrueOffsetParent(element, polyfill) {
|
|
7716
|
-
if (!isHTMLElement(element) || getComputedStyle$1(element).position === 'fixed') {
|
|
7717
|
-
return null;
|
|
7718
|
-
}
|
|
7719
|
-
if (polyfill) {
|
|
7720
|
-
return polyfill(element);
|
|
7721
|
-
}
|
|
7722
|
-
let rawOffsetParent = element.offsetParent;
|
|
7723
|
-
|
|
7724
|
-
// Firefox returns the <html> element as the offsetParent if it's non-static,
|
|
7725
|
-
// while Chrome and Safari return the <body> element. The <body> element must
|
|
7726
|
-
// be used to perform the correct calculations even if the <html> element is
|
|
7727
|
-
// non-static.
|
|
7728
|
-
if (getDocumentElement(element) === rawOffsetParent) {
|
|
7729
|
-
rawOffsetParent = rawOffsetParent.ownerDocument.body;
|
|
7730
|
-
}
|
|
7731
|
-
return rawOffsetParent;
|
|
7732
|
-
}
|
|
7733
|
-
|
|
7734
|
-
// Gets the closest ancestor positioned element. Handles some edge cases,
|
|
7735
|
-
// such as table ancestors and cross browser bugs.
|
|
7736
|
-
function getOffsetParent(element, polyfill) {
|
|
7737
|
-
const win = getWindow(element);
|
|
7738
|
-
if (isTopLayer(element)) {
|
|
7739
|
-
return win;
|
|
7740
|
-
}
|
|
7741
|
-
if (!isHTMLElement(element)) {
|
|
7742
|
-
let svgOffsetParent = getParentNode(element);
|
|
7743
|
-
while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) {
|
|
7744
|
-
if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) {
|
|
7745
|
-
return svgOffsetParent;
|
|
7746
|
-
}
|
|
7747
|
-
svgOffsetParent = getParentNode(svgOffsetParent);
|
|
7748
|
-
}
|
|
7749
|
-
return win;
|
|
7750
|
-
}
|
|
7751
|
-
let offsetParent = getTrueOffsetParent(element, polyfill);
|
|
7752
|
-
while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) {
|
|
7753
|
-
offsetParent = getTrueOffsetParent(offsetParent, polyfill);
|
|
7754
|
-
}
|
|
7755
|
-
if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) {
|
|
7756
|
-
return win;
|
|
7757
|
-
}
|
|
7758
|
-
return offsetParent || getContainingBlock(element) || win;
|
|
7759
|
-
}
|
|
7760
|
-
|
|
7761
|
-
const getElementRects = async function (data) {
|
|
7762
|
-
const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
|
|
7763
|
-
const getDimensionsFn = this.getDimensions;
|
|
7764
|
-
const floatingDimensions = await getDimensionsFn(data.floating);
|
|
7765
|
-
return {
|
|
7766
|
-
reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),
|
|
7767
|
-
floating: {
|
|
7768
|
-
x: 0,
|
|
7769
|
-
y: 0,
|
|
7770
|
-
width: floatingDimensions.width,
|
|
7771
|
-
height: floatingDimensions.height
|
|
7772
|
-
}
|
|
7773
|
-
};
|
|
7774
|
-
};
|
|
7775
|
-
|
|
7776
|
-
function isRTL(element) {
|
|
7777
|
-
return getComputedStyle$1(element).direction === 'rtl';
|
|
7778
|
-
}
|
|
7779
|
-
|
|
7780
|
-
const platform = {
|
|
7781
|
-
convertOffsetParentRelativeRectToViewportRelativeRect,
|
|
7782
|
-
getDocumentElement,
|
|
7783
|
-
getClippingRect,
|
|
7784
|
-
getOffsetParent,
|
|
7785
|
-
getElementRects,
|
|
7786
|
-
getClientRects,
|
|
7787
|
-
getDimensions,
|
|
7788
|
-
getScale,
|
|
7789
|
-
isElement,
|
|
7790
|
-
isRTL
|
|
7791
|
-
};
|
|
7792
|
-
|
|
7793
|
-
function rectsAreEqual(a, b) {
|
|
7794
|
-
return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;
|
|
7795
|
-
}
|
|
7796
|
-
|
|
7797
|
-
// https://samthor.au/2021/observing-dom/
|
|
7798
|
-
function observeMove(element, onMove) {
|
|
7799
|
-
let io = null;
|
|
7800
|
-
let timeoutId;
|
|
7801
|
-
const root = getDocumentElement(element);
|
|
7802
|
-
function cleanup() {
|
|
7803
|
-
var _io;
|
|
7804
|
-
clearTimeout(timeoutId);
|
|
7805
|
-
(_io = io) == null || _io.disconnect();
|
|
7806
|
-
io = null;
|
|
7807
|
-
}
|
|
7808
|
-
function refresh(skip, threshold) {
|
|
7809
|
-
if (skip === void 0) {
|
|
7810
|
-
skip = false;
|
|
7811
|
-
}
|
|
7812
|
-
if (threshold === void 0) {
|
|
7813
|
-
threshold = 1;
|
|
7814
|
-
}
|
|
7815
|
-
cleanup();
|
|
7816
|
-
const elementRectForRootMargin = element.getBoundingClientRect();
|
|
7817
|
-
const {
|
|
7818
|
-
left,
|
|
7819
|
-
top,
|
|
7820
|
-
width,
|
|
7821
|
-
height
|
|
7822
|
-
} = elementRectForRootMargin;
|
|
7823
|
-
if (!skip) {
|
|
7824
|
-
onMove();
|
|
7825
|
-
}
|
|
7826
|
-
if (!width || !height) {
|
|
7827
|
-
return;
|
|
7828
|
-
}
|
|
7829
|
-
const insetTop = floor(top);
|
|
7830
|
-
const insetRight = floor(root.clientWidth - (left + width));
|
|
7831
|
-
const insetBottom = floor(root.clientHeight - (top + height));
|
|
7832
|
-
const insetLeft = floor(left);
|
|
7833
|
-
const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px";
|
|
7834
|
-
const options = {
|
|
7835
|
-
rootMargin,
|
|
7836
|
-
threshold: max(0, min(1, threshold)) || 1
|
|
7837
|
-
};
|
|
7838
|
-
let isFirstUpdate = true;
|
|
7839
|
-
function handleObserve(entries) {
|
|
7840
|
-
const ratio = entries[0].intersectionRatio;
|
|
7841
|
-
if (ratio !== threshold) {
|
|
7842
|
-
if (!isFirstUpdate) {
|
|
7843
|
-
return refresh();
|
|
7844
|
-
}
|
|
7845
|
-
if (!ratio) {
|
|
7846
|
-
// If the reference is clipped, the ratio is 0. Throttle the refresh
|
|
7847
|
-
// to prevent an infinite loop of updates.
|
|
7848
|
-
timeoutId = setTimeout(() => {
|
|
7849
|
-
refresh(false, 1e-7);
|
|
7850
|
-
}, 1000);
|
|
7851
|
-
} else {
|
|
7852
|
-
refresh(false, ratio);
|
|
7853
|
-
}
|
|
7854
|
-
}
|
|
7855
|
-
if (ratio === 1 && !rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) {
|
|
7856
|
-
// It's possible that even though the ratio is reported as 1, the
|
|
7857
|
-
// element is not actually fully within the IntersectionObserver's root
|
|
7858
|
-
// area anymore. This can happen under performance constraints. This may
|
|
7859
|
-
// be a bug in the browser's IntersectionObserver implementation. To
|
|
7860
|
-
// work around this, we compare the element's bounding rect now with
|
|
7861
|
-
// what it was at the time we created the IntersectionObserver. If they
|
|
7862
|
-
// are not equal then the element moved, so we refresh.
|
|
7863
|
-
refresh();
|
|
7864
|
-
}
|
|
7865
|
-
isFirstUpdate = false;
|
|
7866
|
-
}
|
|
7867
|
-
|
|
7868
|
-
// Older browsers don't support a `document` as the root and will throw an
|
|
7869
|
-
// error.
|
|
7870
|
-
try {
|
|
7871
|
-
io = new IntersectionObserver(handleObserve, {
|
|
7872
|
-
...options,
|
|
7873
|
-
// Handle <iframe>s
|
|
7874
|
-
root: root.ownerDocument
|
|
7875
|
-
});
|
|
7876
|
-
} catch (_e) {
|
|
7877
|
-
io = new IntersectionObserver(handleObserve, options);
|
|
7878
|
-
}
|
|
7879
|
-
io.observe(element);
|
|
7880
|
-
}
|
|
7881
|
-
refresh(true);
|
|
7882
|
-
return cleanup;
|
|
7883
|
-
}
|
|
7884
|
-
|
|
7885
|
-
/**
|
|
7886
|
-
* Automatically updates the position of the floating element when necessary.
|
|
7887
|
-
* Should only be called when the floating element is mounted on the DOM or
|
|
7888
|
-
* visible on the screen.
|
|
7889
|
-
* @returns cleanup function that should be invoked when the floating element is
|
|
7890
|
-
* removed from the DOM or hidden from the screen.
|
|
7891
|
-
* @see https://floating-ui.com/docs/autoUpdate
|
|
7892
|
-
*/
|
|
7893
|
-
function autoUpdate(reference, floating, update, options) {
|
|
7894
|
-
if (options === void 0) {
|
|
7895
|
-
options = {};
|
|
7896
|
-
}
|
|
7897
|
-
const {
|
|
7898
|
-
ancestorScroll = true,
|
|
7899
|
-
ancestorResize = true,
|
|
7900
|
-
elementResize = typeof ResizeObserver === 'function',
|
|
7901
|
-
layoutShift = typeof IntersectionObserver === 'function',
|
|
7902
|
-
animationFrame = false
|
|
7903
|
-
} = options;
|
|
7904
|
-
const referenceEl = unwrapElement(reference);
|
|
7905
|
-
const ancestors = ancestorScroll || ancestorResize ? [...(referenceEl ? getOverflowAncestors(referenceEl) : []), ...(floating ? getOverflowAncestors(floating) : [])] : [];
|
|
7906
|
-
ancestors.forEach(ancestor => {
|
|
7907
|
-
ancestorScroll && ancestor.addEventListener('scroll', update, {
|
|
7908
|
-
passive: true
|
|
7909
|
-
});
|
|
7910
|
-
ancestorResize && ancestor.addEventListener('resize', update);
|
|
7911
|
-
});
|
|
7912
|
-
const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update) : null;
|
|
7913
|
-
let reobserveFrame = -1;
|
|
7914
|
-
let resizeObserver = null;
|
|
7915
|
-
if (elementResize) {
|
|
7916
|
-
resizeObserver = new ResizeObserver(_ref => {
|
|
7917
|
-
let [firstEntry] = _ref;
|
|
7918
|
-
if (firstEntry && firstEntry.target === referenceEl && resizeObserver && floating) {
|
|
7919
|
-
// Prevent update loops when using the `size` middleware.
|
|
7920
|
-
// https://github.com/floating-ui/floating-ui/issues/1740
|
|
7921
|
-
resizeObserver.unobserve(floating);
|
|
7922
|
-
cancelAnimationFrame(reobserveFrame);
|
|
7923
|
-
reobserveFrame = requestAnimationFrame(() => {
|
|
7924
|
-
var _resizeObserver;
|
|
7925
|
-
(_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating);
|
|
7926
|
-
});
|
|
7927
|
-
}
|
|
7928
|
-
update();
|
|
7929
|
-
});
|
|
7930
|
-
if (referenceEl && !animationFrame) {
|
|
7931
|
-
resizeObserver.observe(referenceEl);
|
|
7932
|
-
}
|
|
7933
|
-
if (floating) {
|
|
7934
|
-
resizeObserver.observe(floating);
|
|
7935
|
-
}
|
|
7936
|
-
}
|
|
7937
|
-
let frameId;
|
|
7938
|
-
let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
|
|
7939
|
-
if (animationFrame) {
|
|
7940
|
-
frameLoop();
|
|
7941
|
-
}
|
|
7942
|
-
function frameLoop() {
|
|
7943
|
-
const nextRefRect = getBoundingClientRect(reference);
|
|
7944
|
-
if (prevRefRect && !rectsAreEqual(prevRefRect, nextRefRect)) {
|
|
7945
|
-
update();
|
|
7946
|
-
}
|
|
7947
|
-
prevRefRect = nextRefRect;
|
|
7948
|
-
frameId = requestAnimationFrame(frameLoop);
|
|
7949
|
-
}
|
|
7950
|
-
update();
|
|
7951
|
-
return () => {
|
|
7952
|
-
var _resizeObserver2;
|
|
7953
|
-
ancestors.forEach(ancestor => {
|
|
7954
|
-
ancestorScroll && ancestor.removeEventListener('scroll', update);
|
|
7955
|
-
ancestorResize && ancestor.removeEventListener('resize', update);
|
|
7956
|
-
});
|
|
7957
|
-
cleanupIo == null || cleanupIo();
|
|
7958
|
-
(_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect();
|
|
7959
|
-
resizeObserver = null;
|
|
7960
|
-
if (animationFrame) {
|
|
7961
|
-
cancelAnimationFrame(frameId);
|
|
7962
|
-
}
|
|
7963
|
-
};
|
|
7964
|
-
}
|
|
7965
|
-
|
|
7966
|
-
/**
|
|
7967
|
-
* Modifies the placement by translating the floating element along the
|
|
7968
|
-
* specified axes.
|
|
7969
|
-
* A number (shorthand for `mainAxis` or distance), or an axes configuration
|
|
7970
|
-
* object may be passed.
|
|
7971
|
-
* @see https://floating-ui.com/docs/offset
|
|
7972
|
-
*/
|
|
7973
|
-
const offset = offset$1;
|
|
7974
|
-
|
|
7975
|
-
/**
|
|
7976
|
-
* Optimizes the visibility of the floating element by shifting it in order to
|
|
7977
|
-
* keep it in view when it will overflow the clipping boundary.
|
|
7978
|
-
* @see https://floating-ui.com/docs/shift
|
|
7979
|
-
*/
|
|
7980
|
-
const shift = shift$1;
|
|
7981
|
-
|
|
7982
|
-
/**
|
|
7983
|
-
* Optimizes the visibility of the floating element by flipping the `placement`
|
|
7984
|
-
* in order to keep it in view when the preferred placement(s) will overflow the
|
|
7985
|
-
* clipping boundary. Alternative to `autoPlacement`.
|
|
7986
|
-
* @see https://floating-ui.com/docs/flip
|
|
7987
|
-
*/
|
|
7988
|
-
const flip = flip$1;
|
|
7989
|
-
|
|
7990
|
-
/**
|
|
7991
|
-
* Computes the `x` and `y` coordinates that will place the floating element
|
|
7992
|
-
* next to a given reference element.
|
|
7993
|
-
*/
|
|
7994
|
-
const computePosition = (reference, floating, options) => {
|
|
7995
|
-
// This caches the expensive `getClippingElementAncestors` function so that
|
|
7996
|
-
// multiple lifecycle resets re-use the same result. It only lives for a
|
|
7997
|
-
// single call. If other functions become expensive, we can add them as well.
|
|
7998
|
-
const cache = new Map();
|
|
7999
|
-
const mergedOptions = {
|
|
8000
|
-
platform,
|
|
8001
|
-
...options
|
|
8002
|
-
};
|
|
8003
|
-
const platformWithCache = {
|
|
8004
|
-
...mergedOptions.platform,
|
|
8005
|
-
_c: cache
|
|
8006
|
-
};
|
|
8007
|
-
return computePosition$1(reference, floating, {
|
|
8008
|
-
...mergedOptions,
|
|
8009
|
-
platform: platformWithCache
|
|
8010
|
-
});
|
|
8011
|
-
};
|
|
8012
|
-
|
|
8013
|
-
class PopoverController {
|
|
8014
|
-
constructor(host, options = { placement: 'bottom', offset: 6 }) {
|
|
8015
|
-
this.host = host;
|
|
8016
|
-
this.options = options;
|
|
8017
|
-
this.host.addController(this);
|
|
8018
|
-
}
|
|
8019
|
-
// Set up the floating logic
|
|
8020
|
-
async updatePosition(reference, floating, options) {
|
|
8021
|
-
if (!reference)
|
|
8022
|
-
return;
|
|
8023
|
-
this.cleanup?.();
|
|
8024
|
-
const placement = options?.placement ?? this.options.placement;
|
|
8025
|
-
const spacing = options?.offset ?? this.options.offset;
|
|
8026
|
-
this.cleanup = autoUpdate(reference, floating, async () => {
|
|
8027
|
-
const { x, y } = await computePosition(reference, floating, {
|
|
8028
|
-
placement,
|
|
8029
|
-
middleware: [offset(spacing), flip(), shift({ padding: 4 })],
|
|
8030
|
-
});
|
|
8031
|
-
Object.assign(floating.style, {
|
|
8032
|
-
left: `${x}px`,
|
|
8033
|
-
top: `${y}px`,
|
|
8034
|
-
position: 'absolute',
|
|
8035
|
-
});
|
|
8036
|
-
});
|
|
8037
|
-
}
|
|
8038
|
-
hostDisconnected() {
|
|
8039
|
-
this.cleanup?.();
|
|
8040
|
-
}
|
|
8041
|
-
}
|
|
8042
|
-
|
|
8043
6229
|
/**
|
|
8044
6230
|
* @label Tooltip
|
|
8045
6231
|
* @tag wc-tooltip
|
|
@@ -8066,84 +6252,30 @@ class Tooltip extends i$1 {
|
|
|
8066
6252
|
this.variant = 'plain';
|
|
8067
6253
|
this.preview = false;
|
|
8068
6254
|
this._target = null;
|
|
8069
|
-
this.
|
|
8070
|
-
|
|
8071
|
-
|
|
8072
|
-
|
|
8073
|
-
|
|
8074
|
-
|
|
8075
|
-
|
|
8076
|
-
|
|
8077
|
-
|
|
8078
|
-
|
|
8079
|
-
|
|
8080
|
-
|
|
8081
|
-
|
|
8082
|
-
|
|
8083
|
-
|
|
8084
|
-
|
|
8085
|
-
|
|
8086
|
-
|
|
8087
|
-
const isHoveringTarget = this._target?.matches(':hover');
|
|
8088
|
-
const isHoveringTooltip = this.floatingEl?.matches(':hover');
|
|
8089
|
-
if (!isHoveringTarget && !isHoveringTooltip) {
|
|
8090
|
-
this.hide();
|
|
8091
|
-
}
|
|
8092
|
-
}, 100); // 100ms is usually enough for a smooth transition
|
|
8093
|
-
};
|
|
8094
|
-
this._onFocusIn = () => this.preview && this.hasTrigger('focus') && this.show();
|
|
8095
|
-
this._onFocusOut = (e) => {
|
|
8096
|
-
if (this.preview || !this.hasTrigger('focus'))
|
|
8097
|
-
return;
|
|
8098
|
-
if (this._target && !this._target.contains(e.relatedTarget)) {
|
|
8099
|
-
this.hide();
|
|
8100
|
-
}
|
|
8101
|
-
};
|
|
8102
|
-
this._onClick = (e) => {
|
|
8103
|
-
if (this.preview || !this.hasTrigger('click'))
|
|
8104
|
-
return;
|
|
8105
|
-
e.stopPropagation();
|
|
8106
|
-
this.toggle();
|
|
8107
|
-
};
|
|
8108
|
-
this._handleGlobalOpen = (e) => {
|
|
8109
|
-
if (e.detail.invoker !== this)
|
|
8110
|
-
this.hide();
|
|
8111
|
-
};
|
|
8112
|
-
this._handleDocumentClick = (e) => {
|
|
8113
|
-
const path = e.composedPath();
|
|
8114
|
-
if (this._target && !path.includes(this._target)) {
|
|
8115
|
-
this.hide();
|
|
8116
|
-
}
|
|
8117
|
-
};
|
|
8118
|
-
}
|
|
8119
|
-
hasTrigger(type) {
|
|
8120
|
-
return this.trigger.split(' ').includes(type);
|
|
8121
|
-
}
|
|
8122
|
-
show() {
|
|
8123
|
-
if (this.open)
|
|
8124
|
-
return;
|
|
8125
|
-
window.dispatchEvent(new CustomEvent(Tooltip.CLOSE_OTHERS_EVENT, {
|
|
8126
|
-
detail: { invoker: this },
|
|
8127
|
-
}));
|
|
8128
|
-
this.open = true;
|
|
8129
|
-
}
|
|
8130
|
-
hide() {
|
|
8131
|
-
if (!this.open)
|
|
8132
|
-
return;
|
|
8133
|
-
this.open = false;
|
|
8134
|
-
}
|
|
8135
|
-
toggle() {
|
|
8136
|
-
// eslint-disable-next-line no-unused-expressions
|
|
8137
|
-
this.open ? this.hide() : this.show();
|
|
6255
|
+
this._floating = null;
|
|
6256
|
+
}
|
|
6257
|
+
resolveTrigger() {
|
|
6258
|
+
if (this.preview)
|
|
6259
|
+
return 'manual';
|
|
6260
|
+
const triggerTokens = this.trigger.split(' ');
|
|
6261
|
+
const hasHover = triggerTokens.includes('hover');
|
|
6262
|
+
const hasFocus = triggerTokens.includes('focus');
|
|
6263
|
+
const hasClick = triggerTokens.includes('click');
|
|
6264
|
+
if (hasClick)
|
|
6265
|
+
return 'click';
|
|
6266
|
+
if (hasHover && hasFocus)
|
|
6267
|
+
return 'hover-focus';
|
|
6268
|
+
if (hasFocus)
|
|
6269
|
+
return 'focus';
|
|
6270
|
+
if (hasHover)
|
|
6271
|
+
return 'hover';
|
|
6272
|
+
return 'manual';
|
|
8138
6273
|
}
|
|
8139
6274
|
detachListeners() {
|
|
8140
|
-
if (
|
|
8141
|
-
|
|
8142
|
-
|
|
8143
|
-
|
|
8144
|
-
this._target.removeEventListener('focusin', this._onFocusIn);
|
|
8145
|
-
this._target.removeEventListener('focusout', this._onFocusOut);
|
|
8146
|
-
this._target.removeEventListener('click', this._onClick);
|
|
6275
|
+
if (this._floating) {
|
|
6276
|
+
this._floating.close();
|
|
6277
|
+
this._floating = null;
|
|
6278
|
+
}
|
|
8147
6279
|
this._target = null;
|
|
8148
6280
|
}
|
|
8149
6281
|
set forElement(value) {
|
|
@@ -8165,7 +6297,7 @@ class Tooltip extends i$1 {
|
|
|
8165
6297
|
return this.parentElement;
|
|
8166
6298
|
}
|
|
8167
6299
|
attachListeners() {
|
|
8168
|
-
this.detachListeners();
|
|
6300
|
+
this.detachListeners();
|
|
8169
6301
|
// Resolve target: ID-based lookup or fallback to parent
|
|
8170
6302
|
const root = this.getRootNode();
|
|
8171
6303
|
this._target = this.for
|
|
@@ -8173,22 +6305,26 @@ class Tooltip extends i$1 {
|
|
|
8173
6305
|
: this.parentElement;
|
|
8174
6306
|
if (!this._target)
|
|
8175
6307
|
return;
|
|
8176
|
-
this.
|
|
8177
|
-
|
|
8178
|
-
|
|
8179
|
-
|
|
8180
|
-
|
|
6308
|
+
this._floating = new FloatingController(this, {
|
|
6309
|
+
placement: 'top',
|
|
6310
|
+
strategy: 'fixed',
|
|
6311
|
+
offset: 0,
|
|
6312
|
+
trigger: this.resolveTrigger(),
|
|
6313
|
+
closeOnClickOutside: true,
|
|
6314
|
+
onOpenChange: (isOpen) => {
|
|
6315
|
+
if (this.open === isOpen)
|
|
6316
|
+
return;
|
|
6317
|
+
this.open = isOpen;
|
|
6318
|
+
},
|
|
6319
|
+
});
|
|
6320
|
+
this._floating.setElements(this._target, this);
|
|
8181
6321
|
}
|
|
8182
6322
|
connectedCallback() {
|
|
8183
6323
|
super.connectedCallback();
|
|
8184
6324
|
this.attachListeners();
|
|
8185
|
-
window.addEventListener(Tooltip.CLOSE_OTHERS_EVENT, this._handleGlobalOpen);
|
|
8186
|
-
window.addEventListener('click', this._handleDocumentClick);
|
|
8187
6325
|
}
|
|
8188
6326
|
disconnectedCallback() {
|
|
8189
6327
|
this.detachListeners();
|
|
8190
|
-
window.removeEventListener(Tooltip.CLOSE_OTHERS_EVENT, this._handleGlobalOpen);
|
|
8191
|
-
window.removeEventListener('click', this._handleDocumentClick);
|
|
8192
6328
|
super.disconnectedCallback();
|
|
8193
6329
|
}
|
|
8194
6330
|
updated(changedProps) {
|
|
@@ -8196,21 +6332,28 @@ class Tooltip extends i$1 {
|
|
|
8196
6332
|
if (changedProps.has('for')) {
|
|
8197
6333
|
this.attachListeners();
|
|
8198
6334
|
}
|
|
8199
|
-
if (changedProps.has('
|
|
8200
|
-
this.
|
|
6335
|
+
if (changedProps.has('trigger') || changedProps.has('preview')) {
|
|
6336
|
+
this.attachListeners();
|
|
6337
|
+
}
|
|
6338
|
+
if (this._floating && this._target) {
|
|
6339
|
+
this._floating.setElements(this._target, this);
|
|
6340
|
+
if (changedProps.has('open') && this.open && !this._floating.isOpen) {
|
|
6341
|
+
this._floating.open();
|
|
6342
|
+
}
|
|
6343
|
+
if (changedProps.has('open') && !this.open && this._floating.isOpen) {
|
|
6344
|
+
this._floating.close();
|
|
6345
|
+
}
|
|
8201
6346
|
}
|
|
8202
6347
|
}
|
|
8203
6348
|
render() {
|
|
8204
6349
|
return b ` <div
|
|
8205
|
-
class=${e$
|
|
6350
|
+
class=${e$1({
|
|
8206
6351
|
tooltip: true,
|
|
8207
6352
|
open: this.open,
|
|
8208
6353
|
[`variant-${this.variant}`]: true,
|
|
8209
6354
|
})}
|
|
8210
6355
|
id="tooltip"
|
|
8211
6356
|
role="tooltip"
|
|
8212
|
-
@mouseenter=${this._onMouseEnter}
|
|
8213
|
-
@mouseleave=${this._onMouseLeave}
|
|
8214
6357
|
aria-hidden=${!this.open}
|
|
8215
6358
|
aria-labelledby="tooltip-labelledby"
|
|
8216
6359
|
>
|
|
@@ -8245,7 +6388,6 @@ class Tooltip extends i$1 {
|
|
|
8245
6388
|
}
|
|
8246
6389
|
}
|
|
8247
6390
|
Tooltip.styles = [css_248z$m];
|
|
8248
|
-
Tooltip.CLOSE_OTHERS_EVENT = 'tooltip--open';
|
|
8249
6391
|
__decorate([
|
|
8250
6392
|
n()
|
|
8251
6393
|
], Tooltip.prototype, "content", void 0);
|
|
@@ -8264,9 +6406,6 @@ __decorate([
|
|
|
8264
6406
|
__decorate([
|
|
8265
6407
|
n({ type: Boolean, reflect: true })
|
|
8266
6408
|
], Tooltip.prototype, "preview", void 0);
|
|
8267
|
-
__decorate([
|
|
8268
|
-
e$4('#tooltip')
|
|
8269
|
-
], Tooltip.prototype, "floatingEl", void 0);
|
|
8270
6409
|
|
|
8271
6410
|
var css_248z$l = i`* {
|
|
8272
6411
|
box-sizing: border-box;
|
|
@@ -8398,7 +6537,7 @@ class BreadcrumbItem extends i$1 {
|
|
|
8398
6537
|
render() {
|
|
8399
6538
|
return b `
|
|
8400
6539
|
<li
|
|
8401
|
-
class=${e$
|
|
6540
|
+
class=${e$1({ 'breadcrumb-item': true, active: this.active })}
|
|
8402
6541
|
itemprop="itemListElement"
|
|
8403
6542
|
itemscope
|
|
8404
6543
|
itemtype="https://schema.org/ListItem"
|
|
@@ -8413,8 +6552,8 @@ class BreadcrumbItem extends i$1 {
|
|
|
8413
6552
|
<a
|
|
8414
6553
|
class="breadcrumb-link"
|
|
8415
6554
|
itemprop="item"
|
|
8416
|
-
href=${o$
|
|
8417
|
-
target=${o$
|
|
6555
|
+
href=${o$2(this.href)}
|
|
6556
|
+
target=${o$2(this.target)}
|
|
8418
6557
|
${this.target === '_blank'
|
|
8419
6558
|
? b `rel="noopener noreferrer"`
|
|
8420
6559
|
: A}
|
|
@@ -8511,8 +6650,8 @@ var css_248z$j = i`* {
|
|
|
8511
6650
|
min-width: 112px;
|
|
8512
6651
|
padding-block: var(--spacing-050);
|
|
8513
6652
|
transform-origin: top center;
|
|
8514
|
-
--_menu-enter-duration: var(--duration-medium1
|
|
8515
|
-
--_menu-exit-duration: var(--duration-
|
|
6653
|
+
--_menu-enter-duration: var(--duration-medium1);
|
|
6654
|
+
--_menu-exit-duration: var(--duration-medium2);
|
|
8516
6655
|
--_menu-enter-easing: cubic-bezier(0.05, 0.7, 0.1, 1);
|
|
8517
6656
|
--_menu-exit-easing: cubic-bezier(0.3, 0, 0.8, 0.15);
|
|
8518
6657
|
transition-property: opacity, transform, visibility;
|
|
@@ -8694,6 +6833,9 @@ var css_248z$i = i`* {
|
|
|
8694
6833
|
.menu-item:hover:not(:where(.disabled, .selected)) {
|
|
8695
6834
|
--_container-state-opacity: 0.08;
|
|
8696
6835
|
}
|
|
6836
|
+
.menu-item.pressed:not(:where(.disabled)) {
|
|
6837
|
+
--_container-state-opacity: 0.12;
|
|
6838
|
+
}
|
|
8697
6839
|
.menu-item.selected {
|
|
8698
6840
|
--_container-color: var(--menu-item-container-selected-color);
|
|
8699
6841
|
--_label-text-color: var(--menu-item-label-selected-color);
|
|
@@ -8739,20 +6881,67 @@ var css_248z$h = i`:host-context([variant=standard]) {
|
|
|
8739
6881
|
* <wc-menu-item>Menu Item</wc-menu-item>
|
|
8740
6882
|
* ```
|
|
8741
6883
|
*/
|
|
8742
|
-
class MenuItem extends i$1 {
|
|
6884
|
+
class MenuItem extends BaseButtonMixin(BaseHyperlinkMixin(i$1)) {
|
|
8743
6885
|
constructor() {
|
|
8744
6886
|
super(...arguments);
|
|
8745
|
-
this.disabled = false;
|
|
8746
6887
|
this.value = '';
|
|
8747
6888
|
this.selected = false;
|
|
8748
6889
|
this.keepOpen = false;
|
|
8749
6890
|
this.hasSubmenu = false;
|
|
8750
6891
|
this.submenuOpen = false;
|
|
8751
|
-
/**
|
|
8752
|
-
* Sets or retrieves the window or frame at which to target content.
|
|
8753
|
-
*/
|
|
8754
|
-
this.target = '_self';
|
|
8755
6892
|
this.variant = 'standard';
|
|
6893
|
+
/**
|
|
6894
|
+
* States
|
|
6895
|
+
*/
|
|
6896
|
+
this.isPressed = false;
|
|
6897
|
+
this.__dispatchClickWithThrottle = event => {
|
|
6898
|
+
this.__dispatchClick(event);
|
|
6899
|
+
};
|
|
6900
|
+
this.__dispatchClick = (event) => {
|
|
6901
|
+
// If the button is soft-disabled or a disabled link, we need to explicitly
|
|
6902
|
+
// prevent the click from propagating to other event listeners as well as
|
|
6903
|
+
// prevent the default action.
|
|
6904
|
+
if (this.softDisabled || (this.disabled && this.href)) {
|
|
6905
|
+
event.stopImmediatePropagation();
|
|
6906
|
+
event.preventDefault();
|
|
6907
|
+
return;
|
|
6908
|
+
}
|
|
6909
|
+
if (!isActivationClick(event) || !this.itemElement) {
|
|
6910
|
+
return;
|
|
6911
|
+
}
|
|
6912
|
+
this.focus();
|
|
6913
|
+
dispatchActivationClick(this.itemElement);
|
|
6914
|
+
};
|
|
6915
|
+
this.__handleKeyDown = (event) => {
|
|
6916
|
+
this.__handlePress(event);
|
|
6917
|
+
if (this.disabled || this.softDisabled || !this.itemElement) {
|
|
6918
|
+
return;
|
|
6919
|
+
}
|
|
6920
|
+
if (event.key === ' ') {
|
|
6921
|
+
event.preventDefault();
|
|
6922
|
+
this.itemElement.click();
|
|
6923
|
+
return;
|
|
6924
|
+
}
|
|
6925
|
+
if (event.key === 'Enter' && !this.__isLink()) {
|
|
6926
|
+
event.preventDefault();
|
|
6927
|
+
this.itemElement.click();
|
|
6928
|
+
}
|
|
6929
|
+
};
|
|
6930
|
+
this.__handlePress = (event) => {
|
|
6931
|
+
if (this.disabled || this.softDisabled)
|
|
6932
|
+
return;
|
|
6933
|
+
if (event instanceof KeyboardEvent &&
|
|
6934
|
+
event.type === 'keydown' &&
|
|
6935
|
+
(event.key === 'Enter' || event.key === ' ')) {
|
|
6936
|
+
this.isPressed = true;
|
|
6937
|
+
}
|
|
6938
|
+
else if (event.type === 'mousedown') {
|
|
6939
|
+
this.isPressed = true;
|
|
6940
|
+
}
|
|
6941
|
+
else {
|
|
6942
|
+
this.isPressed = false;
|
|
6943
|
+
}
|
|
6944
|
+
};
|
|
8756
6945
|
}
|
|
8757
6946
|
connectedCallback() {
|
|
8758
6947
|
// eslint-disable-next-line wc/guard-super-call
|
|
@@ -8760,73 +6949,19 @@ class MenuItem extends i$1 {
|
|
|
8760
6949
|
if (!this.hasAttribute('role')) {
|
|
8761
6950
|
this.setAttribute('role', 'menuitem');
|
|
8762
6951
|
}
|
|
8763
|
-
|
|
8764
|
-
|
|
8765
|
-
}
|
|
8766
|
-
this.addEventListener('click', this._handleClick);
|
|
8767
|
-
this.addEventListener('keydown', this._handleKeyDown);
|
|
6952
|
+
this.addEventListener('click', this.__dispatchClickWithThrottle);
|
|
6953
|
+
window.addEventListener('mouseup', this.__handlePress);
|
|
8768
6954
|
}
|
|
8769
6955
|
disconnectedCallback() {
|
|
8770
|
-
|
|
8771
|
-
this.removeEventListener('
|
|
6956
|
+
window.removeEventListener('mouseup', this.__handlePress);
|
|
6957
|
+
this.removeEventListener('click', this.__dispatchClickWithThrottle);
|
|
8772
6958
|
super.disconnectedCallback();
|
|
8773
6959
|
}
|
|
8774
|
-
|
|
8775
|
-
this.
|
|
8776
|
-
bubbles: true,
|
|
8777
|
-
composed: true,
|
|
8778
|
-
detail: { item: this, source, key },
|
|
8779
|
-
}));
|
|
8780
|
-
}
|
|
8781
|
-
requestClose(source, key) {
|
|
8782
|
-
this.dispatchEvent(new CustomEvent('menu-item-request-close', {
|
|
8783
|
-
bubbles: true,
|
|
8784
|
-
composed: true,
|
|
8785
|
-
detail: {
|
|
8786
|
-
item: this,
|
|
8787
|
-
source,
|
|
8788
|
-
key,
|
|
8789
|
-
reason: source === 'click' ? 'click-selection' : 'keydown',
|
|
8790
|
-
},
|
|
8791
|
-
}));
|
|
8792
|
-
}
|
|
8793
|
-
requestSubmenuKey(key) {
|
|
8794
|
-
this.dispatchEvent(new CustomEvent('menu-item-submenu-keydown', {
|
|
8795
|
-
bubbles: true,
|
|
8796
|
-
composed: true,
|
|
8797
|
-
detail: { item: this, key },
|
|
8798
|
-
}));
|
|
8799
|
-
}
|
|
8800
|
-
_handleKeyDown(e) {
|
|
8801
|
-
if (this.disabled) {
|
|
8802
|
-
e.preventDefault();
|
|
8803
|
-
return;
|
|
8804
|
-
}
|
|
8805
|
-
if (e.key === 'ArrowRight' || e.key === 'ArrowLeft') {
|
|
8806
|
-
this.requestSubmenuKey(e.key);
|
|
8807
|
-
return;
|
|
8808
|
-
}
|
|
8809
|
-
if (e.key === 'Enter' || e.key === ' ') {
|
|
8810
|
-
e.preventDefault();
|
|
8811
|
-
this.emitActivate('keydown', e.key);
|
|
8812
|
-
if (!this.keepOpen) {
|
|
8813
|
-
this.requestClose('keydown', e.key);
|
|
8814
|
-
}
|
|
8815
|
-
}
|
|
8816
|
-
}
|
|
8817
|
-
_handleClick(e) {
|
|
8818
|
-
if (this.disabled) {
|
|
8819
|
-
e.preventDefault();
|
|
8820
|
-
e.stopPropagation();
|
|
8821
|
-
return;
|
|
8822
|
-
}
|
|
8823
|
-
this.emitActivate('click');
|
|
8824
|
-
if (!this.keepOpen) {
|
|
8825
|
-
this.requestClose('click');
|
|
8826
|
-
}
|
|
6960
|
+
focus() {
|
|
6961
|
+
this.itemElement?.focus();
|
|
8827
6962
|
}
|
|
8828
|
-
|
|
8829
|
-
|
|
6963
|
+
blur() {
|
|
6964
|
+
this.itemElement?.blur();
|
|
8830
6965
|
}
|
|
8831
6966
|
render() {
|
|
8832
6967
|
const isLink = this.__isLink();
|
|
@@ -8834,14 +6969,22 @@ class MenuItem extends i$1 {
|
|
|
8834
6969
|
'menu-item': true,
|
|
8835
6970
|
disabled: this.disabled,
|
|
8836
6971
|
selected: this.selected,
|
|
6972
|
+
pressed: this.isPressed,
|
|
8837
6973
|
};
|
|
8838
6974
|
const controls = this.getAttribute('aria-controls');
|
|
8839
6975
|
if (isLink) {
|
|
8840
6976
|
return b `<a
|
|
8841
6977
|
id="item"
|
|
8842
|
-
class=${e$
|
|
6978
|
+
class=${e$1(cssClasses)}
|
|
8843
6979
|
href=${this.href}
|
|
8844
6980
|
target=${this.target}
|
|
6981
|
+
tabindex=${this.disabled ? '-1' : '0'}
|
|
6982
|
+
|
|
6983
|
+
@click=${this.__dispatchClickWithThrottle}
|
|
6984
|
+
@mousedown=${this.__handlePress}
|
|
6985
|
+
@keydown=${this.__handleKeyDown}
|
|
6986
|
+
@keyup=${this.__handlePress}
|
|
6987
|
+
|
|
8845
6988
|
aria-disabled=${String(this.disabled)}
|
|
8846
6989
|
aria-haspopup=${this.hasSubmenu ? 'menu' : A}
|
|
8847
6990
|
aria-controls=${this.hasSubmenu && controls ? controls : A}
|
|
@@ -8852,7 +6995,14 @@ class MenuItem extends i$1 {
|
|
|
8852
6995
|
}
|
|
8853
6996
|
return b `<div
|
|
8854
6997
|
id="item"
|
|
8855
|
-
class=${e$
|
|
6998
|
+
class=${e$1(cssClasses)}
|
|
6999
|
+
tabindex=${this.disabled ? '-1' : '0'}
|
|
7000
|
+
|
|
7001
|
+
@click=${this.__dispatchClick}
|
|
7002
|
+
@mousedown=${this.__handlePress}
|
|
7003
|
+
@keydown=${this.__handleKeyDown}
|
|
7004
|
+
@keyup=${this.__handlePress}
|
|
7005
|
+
|
|
8856
7006
|
aria-disabled=${String(this.disabled)}
|
|
8857
7007
|
aria-haspopup=${this.hasSubmenu ? 'menu' : A}
|
|
8858
7008
|
aria-controls=${this.hasSubmenu && controls ? controls : A}
|
|
@@ -8867,7 +7017,7 @@ class MenuItem extends i$1 {
|
|
|
8867
7017
|
<div class="background"></div>
|
|
8868
7018
|
<wc-ripple class="ripple"></wc-ripple>
|
|
8869
7019
|
|
|
8870
|
-
<div class="menu-item-content">
|
|
7020
|
+
<div class="menu-item-content" data-variant=${this.variant}>
|
|
8871
7021
|
<slot name="leading-icon"></slot>
|
|
8872
7022
|
<div class="slot-container">
|
|
8873
7023
|
<slot></slot>
|
|
@@ -8878,9 +7028,6 @@ class MenuItem extends i$1 {
|
|
|
8878
7028
|
}
|
|
8879
7029
|
}
|
|
8880
7030
|
MenuItem.styles = [css_248z$i, css_248z$h];
|
|
8881
|
-
__decorate([
|
|
8882
|
-
n({ type: Boolean, reflect: true })
|
|
8883
|
-
], MenuItem.prototype, "disabled", void 0);
|
|
8884
7031
|
__decorate([
|
|
8885
7032
|
n({ type: String })
|
|
8886
7033
|
], MenuItem.prototype, "value", void 0);
|
|
@@ -8896,49 +7043,15 @@ __decorate([
|
|
|
8896
7043
|
__decorate([
|
|
8897
7044
|
n({ type: Boolean, attribute: 'submenu-open' })
|
|
8898
7045
|
], MenuItem.prototype, "submenuOpen", void 0);
|
|
8899
|
-
__decorate([
|
|
8900
|
-
n({ reflect: true })
|
|
8901
|
-
], MenuItem.prototype, "href", void 0);
|
|
8902
|
-
__decorate([
|
|
8903
|
-
n()
|
|
8904
|
-
], MenuItem.prototype, "target", void 0);
|
|
8905
7046
|
__decorate([
|
|
8906
7047
|
n({ type: String, reflect: true })
|
|
8907
7048
|
], MenuItem.prototype, "variant", void 0);
|
|
8908
|
-
|
|
8909
|
-
|
|
8910
|
-
|
|
8911
|
-
|
|
8912
|
-
|
|
8913
|
-
|
|
8914
|
-
});
|
|
8915
|
-
Object.assign(options.floating.style, {
|
|
8916
|
-
position: options.strategy,
|
|
8917
|
-
left: `${x}px`,
|
|
8918
|
-
top: `${y}px`,
|
|
8919
|
-
});
|
|
8920
|
-
}
|
|
8921
|
-
class MenuSurfaceController {
|
|
8922
|
-
constructor(host) {
|
|
8923
|
-
this.host = host;
|
|
8924
|
-
this.host.addController(this);
|
|
8925
|
-
}
|
|
8926
|
-
start(options) {
|
|
8927
|
-
this.stop();
|
|
8928
|
-
const strategy = options.strategy ?? 'fixed';
|
|
8929
|
-
this.cleanup = autoUpdate(options.reference, options.floating, () => {
|
|
8930
|
-
updateSurfacePosition({ ...options, strategy });
|
|
8931
|
-
});
|
|
8932
|
-
updateSurfacePosition({ ...options, strategy });
|
|
8933
|
-
}
|
|
8934
|
-
stop() {
|
|
8935
|
-
this.cleanup?.();
|
|
8936
|
-
this.cleanup = undefined;
|
|
8937
|
-
}
|
|
8938
|
-
hostDisconnected() {
|
|
8939
|
-
this.stop();
|
|
8940
|
-
}
|
|
8941
|
-
}
|
|
7049
|
+
__decorate([
|
|
7050
|
+
e$2('#item')
|
|
7051
|
+
], MenuItem.prototype, "itemElement", void 0);
|
|
7052
|
+
__decorate([
|
|
7053
|
+
r()
|
|
7054
|
+
], MenuItem.prototype, "isPressed", void 0);
|
|
8942
7055
|
|
|
8943
7056
|
/**
|
|
8944
7057
|
* @label Menu
|
|
@@ -8969,44 +7082,44 @@ class Menu extends i$1 {
|
|
|
8969
7082
|
this.offset = 6;
|
|
8970
7083
|
this.activeIndex = -1;
|
|
8971
7084
|
this.anchorElement = null;
|
|
8972
|
-
this.
|
|
7085
|
+
this._floatingController = new FloatingController(this, {
|
|
7086
|
+
trigger: 'manual',
|
|
7087
|
+
closeOnClickOutside: false,
|
|
7088
|
+
strategy: 'fixed',
|
|
7089
|
+
onOpenChange: (isOpen) => {
|
|
7090
|
+
if (isOpen || !this.open) {
|
|
7091
|
+
return;
|
|
7092
|
+
}
|
|
7093
|
+
this.close({ kind: 'outside-click' });
|
|
7094
|
+
},
|
|
7095
|
+
});
|
|
8973
7096
|
this._lastFocusedElement = null;
|
|
8974
7097
|
this._closeReason = { kind: 'programmatic' };
|
|
8975
|
-
this.
|
|
8976
|
-
|
|
8977
|
-
const { item } = customEvent.detail;
|
|
8978
|
-
const ownedItems = this.items;
|
|
8979
|
-
if (!ownedItems.includes(item)) {
|
|
8980
|
-
return;
|
|
8981
|
-
}
|
|
8982
|
-
const enabledItems = this._enabledItems();
|
|
8983
|
-
const nextIndex = enabledItems.indexOf(item);
|
|
8984
|
-
if (nextIndex >= 0) {
|
|
8985
|
-
this.activeIndex = nextIndex;
|
|
8986
|
-
this._syncRovingTabIndex();
|
|
8987
|
-
}
|
|
8988
|
-
};
|
|
8989
|
-
this._onItemRequestClose = (event) => {
|
|
8990
|
-
const customEvent = event;
|
|
8991
|
-
if (!this.items.includes(customEvent.detail.item)) {
|
|
7098
|
+
this._onClick = (event) => {
|
|
7099
|
+
if (!this.open) {
|
|
8992
7100
|
return;
|
|
8993
7101
|
}
|
|
8994
|
-
|
|
7102
|
+
const item = this._ownedItemFromEvent(event);
|
|
7103
|
+
if (!item) {
|
|
8995
7104
|
return;
|
|
8996
7105
|
}
|
|
8997
|
-
|
|
8998
|
-
|
|
7106
|
+
this._setActiveItem(item);
|
|
7107
|
+
if (item.keepOpen) {
|
|
8999
7108
|
return;
|
|
9000
7109
|
}
|
|
9001
|
-
this.close({ kind: '
|
|
7110
|
+
this.close({ kind: 'click-selection' });
|
|
9002
7111
|
};
|
|
9003
7112
|
this._onKeyDown = (event) => {
|
|
9004
7113
|
if (!this.open) {
|
|
9005
7114
|
return;
|
|
9006
7115
|
}
|
|
9007
|
-
if (!this.
|
|
7116
|
+
if (!this._isEventFromThisMenu(event)) {
|
|
9008
7117
|
return;
|
|
9009
7118
|
}
|
|
7119
|
+
const eventItem = this._ownedItemFromEvent(event);
|
|
7120
|
+
if (eventItem) {
|
|
7121
|
+
this._setActiveItem(eventItem);
|
|
7122
|
+
}
|
|
9010
7123
|
switch (event.key) {
|
|
9011
7124
|
case 'ArrowDown':
|
|
9012
7125
|
event.preventDefault();
|
|
@@ -9030,33 +7143,22 @@ class Menu extends i$1 {
|
|
|
9030
7143
|
event.preventDefault();
|
|
9031
7144
|
this.close({ kind: 'keydown', key: 'Escape' });
|
|
9032
7145
|
break;
|
|
7146
|
+
case 'Tab':
|
|
7147
|
+
this.close({ kind: 'keydown', key: 'Tab' });
|
|
7148
|
+
break;
|
|
7149
|
+
case 'Enter':
|
|
7150
|
+
case ' ': {
|
|
7151
|
+
event.preventDefault();
|
|
7152
|
+
const activeItem = this._getActiveItem() ?? this._getFirstEnabledItem();
|
|
7153
|
+
if (!activeItem) {
|
|
7154
|
+
return;
|
|
7155
|
+
}
|
|
7156
|
+
this._setActiveItem(activeItem);
|
|
7157
|
+
activeItem.click();
|
|
7158
|
+
break;
|
|
7159
|
+
}
|
|
9033
7160
|
}
|
|
9034
7161
|
};
|
|
9035
|
-
this._onWindowClick = (event) => {
|
|
9036
|
-
if (!this.open || this.stayOpenOnOutsideClick) {
|
|
9037
|
-
return;
|
|
9038
|
-
}
|
|
9039
|
-
const path = event.composedPath();
|
|
9040
|
-
const anchorEl = this._resolveAnchorElement();
|
|
9041
|
-
const inMenuTree = path.some(target => target === this || (target instanceof Node && this.contains(target)));
|
|
9042
|
-
if (inMenuTree || (anchorEl && path.includes(anchorEl))) {
|
|
9043
|
-
return;
|
|
9044
|
-
}
|
|
9045
|
-
this.close({ kind: 'outside-click' });
|
|
9046
|
-
};
|
|
9047
|
-
this._onFocusOut = (event) => {
|
|
9048
|
-
if (!this.open || this.stayOpenOnFocusout) {
|
|
9049
|
-
return;
|
|
9050
|
-
}
|
|
9051
|
-
const next = event.relatedTarget;
|
|
9052
|
-
if (!next) {
|
|
9053
|
-
return;
|
|
9054
|
-
}
|
|
9055
|
-
if (next instanceof Node && this._isWithinMenuTree(next)) {
|
|
9056
|
-
return;
|
|
9057
|
-
}
|
|
9058
|
-
this.close({ kind: 'focusout' });
|
|
9059
|
-
};
|
|
9060
7162
|
this._onSlotChange = () => {
|
|
9061
7163
|
this._syncRovingTabIndex();
|
|
9062
7164
|
};
|
|
@@ -9066,18 +7168,13 @@ class Menu extends i$1 {
|
|
|
9066
7168
|
super.connectedCallback();
|
|
9067
7169
|
this.setAttribute('role', 'menu');
|
|
9068
7170
|
this.addEventListener('keydown', this._onKeyDown);
|
|
9069
|
-
this.addEventListener('
|
|
9070
|
-
this.addEventListener('menu-item-activate', this._onItemActivate);
|
|
9071
|
-
this.addEventListener('menu-item-request-close', this._onItemRequestClose);
|
|
9072
|
-
window.addEventListener('click', this._onWindowClick, { capture: true });
|
|
7171
|
+
this.addEventListener('click', this._onClick);
|
|
9073
7172
|
this._syncAnchorAria();
|
|
9074
7173
|
}
|
|
9075
7174
|
disconnectedCallback() {
|
|
9076
7175
|
this.removeEventListener('keydown', this._onKeyDown);
|
|
9077
|
-
this.removeEventListener('
|
|
9078
|
-
this.
|
|
9079
|
-
this.removeEventListener('menu-item-request-close', this._onItemRequestClose);
|
|
9080
|
-
window.removeEventListener('click', this._onWindowClick, { capture: true });
|
|
7176
|
+
this.removeEventListener('click', this._onClick);
|
|
7177
|
+
this._floatingController.close();
|
|
9081
7178
|
super.disconnectedCallback();
|
|
9082
7179
|
}
|
|
9083
7180
|
get items() {
|
|
@@ -9144,7 +7241,11 @@ class Menu extends i$1 {
|
|
|
9144
7241
|
return this.items.filter(item => !item.disabled);
|
|
9145
7242
|
}
|
|
9146
7243
|
_syncRovingTabIndex() {
|
|
7244
|
+
const ownedItems = this.items;
|
|
9147
7245
|
const enabledItems = this._enabledItems();
|
|
7246
|
+
for (const item of ownedItems) {
|
|
7247
|
+
item.tabIndex = -1;
|
|
7248
|
+
}
|
|
9148
7249
|
if (!enabledItems.length) {
|
|
9149
7250
|
this.activeIndex = -1;
|
|
9150
7251
|
return;
|
|
@@ -9152,10 +7253,7 @@ class Menu extends i$1 {
|
|
|
9152
7253
|
if (this.activeIndex < 0 || this.activeIndex >= enabledItems.length) {
|
|
9153
7254
|
this.activeIndex = 0;
|
|
9154
7255
|
}
|
|
9155
|
-
|
|
9156
|
-
const currentItem = enabledItems[index];
|
|
9157
|
-
currentItem.tabIndex = index === this.activeIndex ? 0 : -1;
|
|
9158
|
-
}
|
|
7256
|
+
enabledItems[this.activeIndex].tabIndex = 0;
|
|
9159
7257
|
}
|
|
9160
7258
|
_setActiveByOffset(offset) {
|
|
9161
7259
|
const enabledItems = this._enabledItems();
|
|
@@ -9191,29 +7289,38 @@ class Menu extends i$1 {
|
|
|
9191
7289
|
_getFirstEnabledItem() {
|
|
9192
7290
|
return this._enabledItems()[0] ?? null;
|
|
9193
7291
|
}
|
|
9194
|
-
|
|
7292
|
+
_isEventFromThisMenu(event) {
|
|
9195
7293
|
const path = event.composedPath();
|
|
9196
|
-
const
|
|
9197
|
-
|
|
7294
|
+
const sourceMenu = path.find(target => target instanceof HTMLElement &&
|
|
7295
|
+
target.tagName.toLowerCase() === 'wc-menu');
|
|
7296
|
+
return sourceMenu === this;
|
|
9198
7297
|
}
|
|
9199
|
-
|
|
9200
|
-
if (!
|
|
9201
|
-
return
|
|
7298
|
+
_ownedItemFromEvent(event) {
|
|
7299
|
+
if (!this._isEventFromThisMenu(event)) {
|
|
7300
|
+
return null;
|
|
9202
7301
|
}
|
|
9203
|
-
|
|
9204
|
-
|
|
9205
|
-
|
|
9206
|
-
|
|
9207
|
-
|
|
9208
|
-
|
|
9209
|
-
|
|
9210
|
-
|
|
9211
|
-
|
|
9212
|
-
|
|
9213
|
-
current = null;
|
|
7302
|
+
const path = event.composedPath();
|
|
7303
|
+
const ownedItems = this.items;
|
|
7304
|
+
for (const target of path) {
|
|
7305
|
+
if (target instanceof HTMLElement) {
|
|
7306
|
+
if (target.tagName.toLowerCase() === 'wc-menu-item') {
|
|
7307
|
+
const ownedItem = ownedItems.find(item => item === target);
|
|
7308
|
+
if (ownedItem) {
|
|
7309
|
+
return ownedItem;
|
|
7310
|
+
}
|
|
7311
|
+
}
|
|
9214
7312
|
}
|
|
9215
7313
|
}
|
|
9216
|
-
return
|
|
7314
|
+
return null;
|
|
7315
|
+
}
|
|
7316
|
+
_setActiveItem(item) {
|
|
7317
|
+
const enabledItems = this._enabledItems();
|
|
7318
|
+
const nextIndex = enabledItems.indexOf(item);
|
|
7319
|
+
if (nextIndex < 0) {
|
|
7320
|
+
return;
|
|
7321
|
+
}
|
|
7322
|
+
this.activeIndex = nextIndex;
|
|
7323
|
+
this._syncRovingTabIndex();
|
|
9217
7324
|
}
|
|
9218
7325
|
_applyPositioning() {
|
|
9219
7326
|
if (!this.open || !this.menuListElement) {
|
|
@@ -9223,13 +7330,14 @@ class Menu extends i$1 {
|
|
|
9223
7330
|
if (!anchorEl) {
|
|
9224
7331
|
return;
|
|
9225
7332
|
}
|
|
9226
|
-
this.
|
|
9227
|
-
reference: anchorEl,
|
|
9228
|
-
floating: this.menuListElement,
|
|
7333
|
+
this._floatingController.setOptions({
|
|
9229
7334
|
placement: this.placement,
|
|
9230
7335
|
offset: this.offset,
|
|
9231
7336
|
strategy: 'fixed',
|
|
7337
|
+
closeOnClickOutside: !this.stayOpenOnOutsideClick,
|
|
9232
7338
|
});
|
|
7339
|
+
this._floatingController.setElements(anchorEl, this.menuListElement);
|
|
7340
|
+
this._floatingController.open();
|
|
9233
7341
|
}
|
|
9234
7342
|
updated(changedProperties) {
|
|
9235
7343
|
if (changedProperties.has('anchor') || changedProperties.has('open')) {
|
|
@@ -9246,7 +7354,7 @@ class Menu extends i$1 {
|
|
|
9246
7354
|
this._applyPositioning();
|
|
9247
7355
|
}
|
|
9248
7356
|
else {
|
|
9249
|
-
this.
|
|
7357
|
+
this._floatingController.close();
|
|
9250
7358
|
const reason = this._closeReason;
|
|
9251
7359
|
this.dispatchEvent(new CustomEvent('close-menu', {
|
|
9252
7360
|
bubbles: true,
|
|
@@ -9261,7 +7369,8 @@ class Menu extends i$1 {
|
|
|
9261
7369
|
composed: true,
|
|
9262
7370
|
detail: { reason },
|
|
9263
7371
|
}));
|
|
9264
|
-
|
|
7372
|
+
const shouldRestoreFocus = reason.kind !== 'keydown' || reason.key !== 'Tab';
|
|
7373
|
+
if (!this.isSubmenu && shouldRestoreFocus) {
|
|
9265
7374
|
this._lastFocusedElement?.focus();
|
|
9266
7375
|
}
|
|
9267
7376
|
}
|
|
@@ -9276,7 +7385,7 @@ class Menu extends i$1 {
|
|
|
9276
7385
|
}
|
|
9277
7386
|
render() {
|
|
9278
7387
|
return b `<div
|
|
9279
|
-
class=${e$
|
|
7388
|
+
class=${e$1({
|
|
9280
7389
|
'menu': true,
|
|
9281
7390
|
open: !this.preview && this.open,
|
|
9282
7391
|
closed: !this.preview && !this.open,
|
|
@@ -9327,7 +7436,7 @@ __decorate([
|
|
|
9327
7436
|
r()
|
|
9328
7437
|
], Menu.prototype, "activeIndex", void 0);
|
|
9329
7438
|
__decorate([
|
|
9330
|
-
e$
|
|
7439
|
+
e$2('.menu')
|
|
9331
7440
|
], Menu.prototype, "menuListElement", void 0);
|
|
9332
7441
|
|
|
9333
7442
|
var css_248z$g = i`* {
|
|
@@ -9539,10 +7648,10 @@ __decorate([
|
|
|
9539
7648
|
n({ type: String, attribute: 'menu-corner' })
|
|
9540
7649
|
], SubMenu.prototype, "menuCorner", void 0);
|
|
9541
7650
|
__decorate([
|
|
9542
|
-
o
|
|
7651
|
+
o({ slot: 'item' })
|
|
9543
7652
|
], SubMenu.prototype, "_items", void 0);
|
|
9544
7653
|
__decorate([
|
|
9545
|
-
o
|
|
7654
|
+
o({ slot: 'menu' })
|
|
9546
7655
|
], SubMenu.prototype, "_menus", void 0);
|
|
9547
7656
|
|
|
9548
7657
|
var css_248z$f = i`@charset "UTF-8";
|
|
@@ -10216,7 +8325,7 @@ class Tab extends i$1 {
|
|
|
10216
8325
|
if (!isLink) {
|
|
10217
8326
|
return b `<button
|
|
10218
8327
|
id="button"
|
|
10219
|
-
class=${e$
|
|
8328
|
+
class=${e$1(cssClasses)}
|
|
10220
8329
|
tabindex="0"
|
|
10221
8330
|
@mousedown=${this.__handlePress}
|
|
10222
8331
|
@keydown=${this.__handlePress}
|
|
@@ -10230,7 +8339,7 @@ class Tab extends i$1 {
|
|
|
10230
8339
|
</button>`;
|
|
10231
8340
|
}
|
|
10232
8341
|
return b `<a
|
|
10233
|
-
class=${e$
|
|
8342
|
+
class=${e$1(cssClasses)}
|
|
10234
8343
|
id="button"
|
|
10235
8344
|
tabindex="0"
|
|
10236
8345
|
href=${this.href}
|
|
@@ -10396,7 +8505,7 @@ __decorate([
|
|
|
10396
8505
|
r()
|
|
10397
8506
|
], Tab.prototype, "isPressed", void 0);
|
|
10398
8507
|
__decorate([
|
|
10399
|
-
e$
|
|
8508
|
+
e$2('.tab-element')
|
|
10400
8509
|
], Tab.prototype, "tabElement", void 0);
|
|
10401
8510
|
|
|
10402
8511
|
var css_248z$d = i`* {
|
|
@@ -11104,7 +9213,7 @@ class Slider extends i$1 {
|
|
|
11104
9213
|
@touchstart=${this.onMouseDown}
|
|
11105
9214
|
>
|
|
11106
9215
|
<div class="track">
|
|
11107
|
-
<div class="track-active" style=${o$
|
|
9216
|
+
<div class="track-active" style=${o$1({ width: `${percentage}%` })}></div>
|
|
11108
9217
|
</div>
|
|
11109
9218
|
|
|
11110
9219
|
<div
|
|
@@ -11116,7 +9225,7 @@ class Slider extends i$1 {
|
|
|
11116
9225
|
aria-valuemax=${this.max}
|
|
11117
9226
|
aria-valuenow=${this.value}
|
|
11118
9227
|
aria-disabled=${this.disabled}
|
|
11119
|
-
style=${o$
|
|
9228
|
+
style=${o$1({ left: `calc(${percentage}% - var(--thumb-half))` })}
|
|
11120
9229
|
@keydown=${this.handleKeyDown}
|
|
11121
9230
|
>
|
|
11122
9231
|
${this.labeled ? b `<div class="value-label">${this.value}</div>` : ''}
|
|
@@ -11154,10 +9263,10 @@ __decorate([
|
|
|
11154
9263
|
r()
|
|
11155
9264
|
], Slider.prototype, "isDragging", void 0);
|
|
11156
9265
|
__decorate([
|
|
11157
|
-
e$
|
|
9266
|
+
e$2('.slider-container')
|
|
11158
9267
|
], Slider.prototype, "container", void 0);
|
|
11159
9268
|
__decorate([
|
|
11160
|
-
e$
|
|
9269
|
+
e$2('.thumb')
|
|
11161
9270
|
], Slider.prototype, "thumbElement", void 0);
|
|
11162
9271
|
|
|
11163
9272
|
var css_248z$9 = i`* {
|
|
@@ -11457,7 +9566,7 @@ class Table extends i$1 {
|
|
|
11457
9566
|
return total;
|
|
11458
9567
|
}
|
|
11459
9568
|
getTotalItems() {
|
|
11460
|
-
if (this.paginate && !this.managed)
|
|
9569
|
+
if (this.paginate && !this.managed && this.data)
|
|
11461
9570
|
return this.data.length;
|
|
11462
9571
|
return this.totalItems ?? 0;
|
|
11463
9572
|
}
|
|
@@ -11509,7 +9618,7 @@ class Table extends i$1 {
|
|
|
11509
9618
|
: DEFAULT_CELL_WIDTH;
|
|
11510
9619
|
const colEl = b `
|
|
11511
9620
|
<div
|
|
11512
|
-
class=${e$
|
|
9621
|
+
class=${e$1({ col: true, sort: this.sortBy === col.name })}
|
|
11513
9622
|
style="width: ${colWidth}rem"
|
|
11514
9623
|
>
|
|
11515
9624
|
<div class="col-content">
|
|
@@ -11589,7 +9698,7 @@ class Table extends i$1 {
|
|
|
11589
9698
|
const colEl = b `
|
|
11590
9699
|
<div
|
|
11591
9700
|
tabindex="0"
|
|
11592
|
-
class=${e$
|
|
9701
|
+
class=${e$1({
|
|
11593
9702
|
col: true,
|
|
11594
9703
|
'col-hover': this.hoveredCell.row === row &&
|
|
11595
9704
|
this.hoveredCell.column === column,
|
|
@@ -11615,7 +9724,7 @@ class Table extends i$1 {
|
|
|
11615
9724
|
<div class="col-content">
|
|
11616
9725
|
${column.template
|
|
11617
9726
|
? b `<div class="col-template">
|
|
11618
|
-
${o$
|
|
9727
|
+
${o$3(column.template(row, column))}
|
|
11619
9728
|
</div>`
|
|
11620
9729
|
: b `<div class="col-text" title=${row?.[column.name] ?? ''}>
|
|
11621
9730
|
${row?.[column.name]}
|
|
@@ -11632,7 +9741,7 @@ class Table extends i$1 {
|
|
|
11632
9741
|
});
|
|
11633
9742
|
return b `
|
|
11634
9743
|
<div
|
|
11635
|
-
class=${e$
|
|
9744
|
+
class=${e$1({
|
|
11636
9745
|
row: true,
|
|
11637
9746
|
'row-hover': this.hoveredCell.row === row,
|
|
11638
9747
|
})}
|
|
@@ -11684,10 +9793,10 @@ class Table extends i$1 {
|
|
|
11684
9793
|
'horizontal-scrolled': this.isHorizontallyScrolled,
|
|
11685
9794
|
};
|
|
11686
9795
|
return b `
|
|
11687
|
-
<div class=${e$
|
|
9796
|
+
<div class=${e$1(tableClasses)}>
|
|
11688
9797
|
<div class="table-scroll-container" @scroll=${this.onScrollContainer}>
|
|
11689
9798
|
${this.renderHeader()}
|
|
11690
|
-
${this.data.length ? this.renderBody() : this.renderEmptyState()}
|
|
9799
|
+
${this.data && this.data.length ? this.renderBody() : this.renderEmptyState()}
|
|
11691
9800
|
</div>
|
|
11692
9801
|
<div class="table-footer">${this.renderPagination()}</div>
|
|
11693
9802
|
</div>
|
|
@@ -12164,7 +10273,7 @@ class SidebarMenuItem extends i$1 {
|
|
|
12164
10273
|
this._nativeElement?.blur();
|
|
12165
10274
|
}
|
|
12166
10275
|
render() {
|
|
12167
|
-
const classes = e$
|
|
10276
|
+
const classes = e$1({
|
|
12168
10277
|
'sidebar-menu-item': true,
|
|
12169
10278
|
disabled: this.disabled,
|
|
12170
10279
|
selected: this.selected,
|
|
@@ -12241,7 +10350,7 @@ __decorate([
|
|
|
12241
10350
|
n({ type: Number, reflect: true })
|
|
12242
10351
|
], SidebarMenuItem.prototype, "level", void 0);
|
|
12243
10352
|
__decorate([
|
|
12244
|
-
e$
|
|
10353
|
+
e$2('.sidebar-menu-item-content')
|
|
12245
10354
|
], SidebarMenuItem.prototype, "_nativeElement", void 0);
|
|
12246
10355
|
|
|
12247
10356
|
var css_248z$6 = i`* {
|
|
@@ -12452,15 +10561,15 @@ class SidebarSubMenu extends i$1 {
|
|
|
12452
10561
|
}
|
|
12453
10562
|
render() {
|
|
12454
10563
|
const hasChildren = this._getChildNodes().length > 0;
|
|
12455
|
-
const wrapperClasses = e$
|
|
10564
|
+
const wrapperClasses = e$1({
|
|
12456
10565
|
'sidebar-sub-menu': true,
|
|
12457
10566
|
});
|
|
12458
|
-
const innerClasses = e$
|
|
10567
|
+
const innerClasses = e$1({
|
|
12459
10568
|
'sidebar-sub-menu-inner': true,
|
|
12460
10569
|
disabled: this.disabled,
|
|
12461
10570
|
selected: this.selected,
|
|
12462
10571
|
});
|
|
12463
|
-
const inlineStyles = o$
|
|
10572
|
+
const inlineStyles = o$1({
|
|
12464
10573
|
paddingLeft: `calc(var(--sidebar-menu-item-height, 2.5rem) * ${this.level})`,
|
|
12465
10574
|
});
|
|
12466
10575
|
return b `
|
|
@@ -12525,7 +10634,7 @@ __decorate([
|
|
|
12525
10634
|
n({ type: Number, reflect: true })
|
|
12526
10635
|
], SidebarSubMenu.prototype, "level", void 0);
|
|
12527
10636
|
__decorate([
|
|
12528
|
-
e$
|
|
10637
|
+
e$2('.sidebar-sub-menu-inner')
|
|
12529
10638
|
], SidebarSubMenu.prototype, "_nativeElement", void 0);
|
|
12530
10639
|
|
|
12531
10640
|
var css_248z$5 = i`* {
|
|
@@ -12944,7 +11053,7 @@ class Snackbar extends i$1 {
|
|
|
12944
11053
|
const liveRole = this.actionLabel || this.showCloseIcon ? 'alert' : 'status';
|
|
12945
11054
|
return b `
|
|
12946
11055
|
<div
|
|
12947
|
-
class=${e$
|
|
11056
|
+
class=${e$1({
|
|
12948
11057
|
snackbar: true,
|
|
12949
11058
|
open: !this.preview && this.open,
|
|
12950
11059
|
preview: this.preview,
|
|
@@ -13372,7 +11481,7 @@ class Radio extends i$1 {
|
|
|
13372
11481
|
'has-content': this.slotHasContent,
|
|
13373
11482
|
};
|
|
13374
11483
|
return b `
|
|
13375
|
-
<label class=${e$
|
|
11484
|
+
<label class=${e$1(cssClasses)}>
|
|
13376
11485
|
<div
|
|
13377
11486
|
class="container"
|
|
13378
11487
|
tabindex=${this.isGroupFocusTarget
|
|
@@ -13455,10 +11564,10 @@ __decorate([
|
|
|
13455
11564
|
r()
|
|
13456
11565
|
], Radio.prototype, "isGroupFocusTarget", void 0);
|
|
13457
11566
|
__decorate([
|
|
13458
|
-
e$
|
|
11567
|
+
e$2('.container')
|
|
13459
11568
|
], Radio.prototype, "containerElement", void 0);
|
|
13460
11569
|
__decorate([
|
|
13461
|
-
e$
|
|
11570
|
+
e$2('.input-native')
|
|
13462
11571
|
], Radio.prototype, "nativeElement", void 0);
|
|
13463
11572
|
|
|
13464
11573
|
var css_248z$2 = i`@charset "UTF-8";
|
|
@@ -13708,7 +11817,7 @@ __decorate([
|
|
|
13708
11817
|
n({ type: Boolean, reflect: true })
|
|
13709
11818
|
], SelectOptionElement.prototype, "filtered", void 0);
|
|
13710
11819
|
__decorate([
|
|
13711
|
-
e$
|
|
11820
|
+
e$2('wc-menu-item')
|
|
13712
11821
|
], SelectOptionElement.prototype, "_menuItemEl", void 0);
|
|
13713
11822
|
|
|
13714
11823
|
/**
|
|
@@ -14080,7 +12189,7 @@ class Select extends BaseInput {
|
|
|
14080
12189
|
_renderFieldEnd() {
|
|
14081
12190
|
return b `
|
|
14082
12191
|
<wc-icon
|
|
14083
|
-
class=${e$
|
|
12192
|
+
class=${e$1({
|
|
14084
12193
|
'dropdown-icon': true,
|
|
14085
12194
|
'dropdown-icon--open': this._open,
|
|
14086
12195
|
})}
|
|
@@ -14190,10 +12299,10 @@ __decorate([
|
|
|
14190
12299
|
r()
|
|
14191
12300
|
], Select.prototype, "_noOptionsVisible", void 0);
|
|
14192
12301
|
__decorate([
|
|
14193
|
-
e$
|
|
12302
|
+
e$2('.select-trigger')
|
|
14194
12303
|
], Select.prototype, "_triggerEl", void 0);
|
|
14195
12304
|
__decorate([
|
|
14196
|
-
e$
|
|
12305
|
+
e$2('.search-input')
|
|
14197
12306
|
], Select.prototype, "_searchInputEl", void 0);
|
|
14198
12307
|
|
|
14199
12308
|
var css_248z$1 = i`* {
|
|
@@ -14611,7 +12720,7 @@ class NavigationRailItem extends i$1 {
|
|
|
14611
12720
|
if (!isLink) {
|
|
14612
12721
|
return b `<button
|
|
14613
12722
|
id="item"
|
|
14614
|
-
class=${e$
|
|
12723
|
+
class=${e$1(cssClasses)}
|
|
14615
12724
|
?disabled=${this.disabled}
|
|
14616
12725
|
aria-disabled=${`${this.disabled}`}
|
|
14617
12726
|
aria-current=${this.active ? 'page' : A}
|
|
@@ -14626,7 +12735,7 @@ class NavigationRailItem extends i$1 {
|
|
|
14626
12735
|
}
|
|
14627
12736
|
return b `<a
|
|
14628
12737
|
id="item"
|
|
14629
|
-
class=${e$
|
|
12738
|
+
class=${e$1(cssClasses)}
|
|
14630
12739
|
href=${this.href}
|
|
14631
12740
|
target=${this.target}
|
|
14632
12741
|
aria-current=${this.active ? 'page' : A}
|
|
@@ -14677,7 +12786,7 @@ __decorate([
|
|
|
14677
12786
|
r()
|
|
14678
12787
|
], NavigationRailItem.prototype, "_hasActiveIcon", void 0);
|
|
14679
12788
|
__decorate([
|
|
14680
|
-
e$
|
|
12789
|
+
e$2('.item-element')
|
|
14681
12790
|
], NavigationRailItem.prototype, "itemElement", void 0);
|
|
14682
12791
|
|
|
14683
12792
|
/**
|
|
@@ -14793,7 +12902,7 @@ class NavigationRail extends i$1 {
|
|
|
14793
12902
|
[`mode-${this.mode}`]: true,
|
|
14794
12903
|
};
|
|
14795
12904
|
return b `
|
|
14796
|
-
<div class=${e$
|
|
12905
|
+
<div class=${e$1(cssClasses)}>
|
|
14797
12906
|
<div class="header">
|
|
14798
12907
|
<slot name="header"></slot>
|
|
14799
12908
|
</div>
|
|
@@ -14817,5 +12926,5 @@ __decorate([
|
|
|
14817
12926
|
n({ type: Boolean, attribute: 'show-divider' })
|
|
14818
12927
|
], NavigationRail.prototype, "showDivider", void 0);
|
|
14819
12928
|
|
|
14820
|
-
export { Accordion as A, Badge as B, Checkbox as C, DatePicker as D, Elevation as E, Field as F,
|
|
14821
|
-
//# sourceMappingURL=navigation-rail-
|
|
12929
|
+
export { Accordion as A, Badge as B, Checkbox as C, DatePicker as D, Elevation as E, Field as F, Switch as G, TabGroup as H, Image as I, TabPanel as J, Table as K, LinearProgress as L, Menu as M, NavigationRail as N, Tabs as O, Pagination as P, Tag as Q, Radio as R, SegmentedButton as S, Tab as T, Textarea as U, TimePicker as V, Tooltip as W, UrlField as X, Avatar as a, Breadcrumb as b, BreadcrumbItem as c, Chip as d, CircularProgress as e, Container as f, Divider as g, EmptyState as h, FocusRing as i, Input as j, Link as k, MenuItem as l, NavigationRailItem as m, NumberField as n, Ripple as o, SegmentedButtonGroup as p, Select as q, SelectOptionElement as r, SidebarMenu as s, SidebarMenuItem as t, SidebarSubMenu as u, Skeleton as v, Slider as w, Snackbar as x, Spinner as y, SubMenu as z };
|
|
12930
|
+
//# sourceMappingURL=navigation-rail-DyO0oAZU.js.map
|