@sebgroup/green-core 1.21.2 → 1.22.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/chunks/{chunk.RR73DCKW.js → chunk.3NDQ53OL.js} +1 -1
- package/chunks/{chunk.T47FZ32J.js → chunk.5IFR5NGK.js} +1 -1
- package/chunks/{chunk.KDQIFEAP.js → chunk.A5T4P7QS.js} +1 -1
- package/chunks/{chunk.3SXUKXZV.js → chunk.AB2OQWFX.js} +1 -1
- package/chunks/{chunk.MU5DFDDU.js → chunk.AEGZCLBR.js} +2 -2
- package/chunks/{chunk.77RANRZR.js → chunk.C2MXNUCE.js} +1 -1
- package/chunks/{chunk.FHNY57AB.js → chunk.DFW523YG.js} +3 -3
- package/chunks/{chunk.4ZZYYAX4.js → chunk.DHSXS2A3.js} +149 -67
- package/chunks/{chunk.2QXAOTCS.js → chunk.EOQOGT7K.js} +1 -1
- package/chunks/{chunk.XFKEBTU3.js → chunk.HL2NDSAL.js} +1 -1
- package/chunks/{chunk.CNYIFSDX.js → chunk.IA3JFKY2.js} +57 -25
- package/chunks/{chunk.VRM45KID.js → chunk.KPUOGILQ.js} +1 -1
- package/chunks/{chunk.SXNGHD2S.js → chunk.LR3W2NRF.js} +31 -22
- package/chunks/{chunk.W2GCNYHE.js → chunk.OODZSCCL.js} +19 -23
- package/chunks/{chunk.Q3IGOBT4.js → chunk.OQYSWRQN.js} +1 -1
- package/chunks/{chunk.SSRI6BF6.js → chunk.SCB55JEL.js} +146 -2130
- package/chunks/{chunk.ZWAAQYUP.js → chunk.TIBYVWJK.js} +2 -2
- package/chunks/{chunk.2IV2CDG3.js → chunk.UKBROSFM.js} +1 -1
- package/chunks/{chunk.PFIA4S5N.js → chunk.UTJQOQMU.js} +1 -1
- package/chunks/{chunk.HT7H7ZIV.js → chunk.VH7TVVFL.js} +4 -4
- package/chunks/chunk.VOYMQ322.js +1 -1
- package/components/button/button.d.ts +17 -1
- package/components/button/button.js +4 -4
- package/components/button/button.trans.styles.js +1 -1
- package/components/button/index.js +4 -4
- package/components/context-menu/context-menu.d.ts +1 -1
- package/components/context-menu/context-menu.js +9 -6
- package/components/context-menu/context-menu.trans.styles.js +2 -2
- package/components/context-menu/index.js +10 -7
- package/components/datepicker/datepicker.d.ts +6 -1
- package/components/datepicker/datepicker.js +20 -9
- package/components/datepicker/datepicker.trans.styles.js +2 -2
- package/components/datepicker/index.js +20 -9
- package/components/dropdown/dropdown.d.ts +2 -3
- package/components/dropdown/dropdown.js +9 -6
- package/components/dropdown/dropdown.trans.styles.js +2 -2
- package/components/dropdown/index.js +10 -7
- package/components/filter-chips/filter-chip/filter-chip.js +7 -7
- package/components/filter-chips/filter-chip/filter-chip.trans.styles.js +2 -2
- package/components/filter-chips/filter-chip/index.js +7 -7
- package/components/filter-chips/filter-chips.js +8 -8
- package/components/filter-chips/filter-chips.trans.styles.js +2 -2
- package/components/filter-chips/index.js +8 -8
- package/components/grid/grid.js +2 -2
- package/components/grid/index.js +2 -2
- package/components/grouped-list/grouped-list.js +2 -2
- package/components/grouped-list/grouped-list.trans.styles.js +2 -2
- package/components/grouped-list/index.js +2 -2
- package/components/icon/icons/index.js +12 -12
- package/components/index.js +35 -31
- package/{primitives → components}/popover/index.js +6 -3
- package/{primitives → components}/popover/popover.d.ts +27 -6
- package/{primitives → components}/popover/popover.js +5 -2
- package/components/popover/popover.trans.styles.js +11 -0
- package/components/segmented-control/index.js +4 -4
- package/components/segmented-control/segment/index.js +3 -3
- package/components/segmented-control/segment/segment.js +3 -3
- package/components/segmented-control/segment/segment.trans.styles.js +2 -2
- package/components/segmented-control/segmented-control.js +4 -4
- package/components/segmented-control/segmented-control.trans.styles.js +2 -2
- package/components/theme/index.js +2 -2
- package/components/theme/theme.js +2 -2
- package/components/theme/theme.trans.styles.js +2 -2
- package/index.js +35 -31
- package/package.json +1 -1
- package/primitives/calendar/calendar.js +2 -2
- package/primitives/calendar/index.js +2 -2
- package/primitives/listbox/index.js +3 -3
- package/primitives/listbox/listbox.js +3 -3
- package/primitives/listbox/option.js +2 -2
- package/primitives/menu/index.js +3 -3
- package/primitives/menu/menu-heading.js +2 -2
- package/primitives/menu/menu-item.js +2 -2
- package/primitives/menu/menu.js +3 -3
- package/primitives/ripple/index.js +2 -2
- package/primitives/ripple/ripple.js +2 -2
- package/transitional-styles.js +1 -1
- /package/chunks/{chunk.XU4HZLJL.js → chunk.4HJGQCBX.js} +0 -0
- /package/{primitives → components}/popover/index.d.ts +0 -0
- /package/{primitives → components}/popover/popover.styles.d.ts +0 -0
- /package/{primitives → components}/popover/popover.trans.styles.d.ts +0 -0
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk.KBYQYDL3.js";
|
|
4
4
|
import {
|
|
5
5
|
TransitionalStyles
|
|
6
|
-
} from "./chunk.
|
|
6
|
+
} from "./chunk.SCB55JEL.js";
|
|
7
7
|
import {
|
|
8
8
|
GdsElement
|
|
9
9
|
} from "./chunk.ZQ4D5K7J.js";
|
|
@@ -80,7 +80,6 @@ var GdsContextMenu = class extends GdsElement {
|
|
|
80
80
|
aria-haspopup="menu"
|
|
81
81
|
aria-controls="menu"
|
|
82
82
|
aria-expanded=${this.open}
|
|
83
|
-
@click=${() => this.open = !this.open}
|
|
84
83
|
>
|
|
85
84
|
<slot name="trigger">
|
|
86
85
|
${this.showLabel ? (_b = this.buttonLabel) != null ? _b : this.label : nothing}
|
|
@@ -96,6 +95,7 @@ var GdsContextMenu = class extends GdsElement {
|
|
|
96
95
|
id="menu"
|
|
97
96
|
.open=${this.open}
|
|
98
97
|
.triggerRef=${this.elTriggerBtn}
|
|
98
|
+
.anchorRef=${this.elTriggerBtn}
|
|
99
99
|
.label=${this.label}
|
|
100
100
|
.placement=${this.placement}
|
|
101
101
|
@gds-ui-state=${(e) => this.open = e.detail.open}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
GdsSegment
|
|
3
|
-
} from "./chunk.
|
|
3
|
+
} from "./chunk.TIBYVWJK.js";
|
|
4
4
|
import {
|
|
5
5
|
resizeObserver
|
|
6
6
|
} from "./chunk.VHN4JEZC.js";
|
|
7
7
|
import {
|
|
8
8
|
tokens
|
|
9
|
-
} from "./chunk.
|
|
9
|
+
} from "./chunk.VH7TVVFL.js";
|
|
10
10
|
import {
|
|
11
11
|
TransitionalStyles
|
|
12
|
-
} from "./chunk.
|
|
12
|
+
} from "./chunk.SCB55JEL.js";
|
|
13
13
|
import {
|
|
14
14
|
GdsElement
|
|
15
15
|
} from "./chunk.ZQ4D5K7J.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
TransitionalStyles
|
|
3
|
-
} from "./chunk.
|
|
3
|
+
} from "./chunk.SCB55JEL.js";
|
|
4
4
|
import {
|
|
5
5
|
watchMediaQuery
|
|
6
6
|
} from "./chunk.WM7HBMMV.js";
|
|
@@ -21,12 +21,11 @@ import {
|
|
|
21
21
|
__privateSet
|
|
22
22
|
} from "./chunk.5VURDMKE.js";
|
|
23
23
|
|
|
24
|
-
// libs/core/src/
|
|
24
|
+
// libs/core/src/components/popover/popover.ts
|
|
25
25
|
import { html, unsafeCSS } from "lit";
|
|
26
|
-
import { property, state } from "lit/decorators.js";
|
|
26
|
+
import { property, query, state } from "lit/decorators.js";
|
|
27
27
|
import { classMap } from "lit/directives/class-map.js";
|
|
28
28
|
import { msg } from "@lit/localize";
|
|
29
|
-
import { createRef, ref } from "lit/directives/ref.js";
|
|
30
29
|
import {
|
|
31
30
|
computePosition,
|
|
32
31
|
autoUpdate,
|
|
@@ -34,11 +33,15 @@ import {
|
|
|
34
33
|
flip
|
|
35
34
|
} from "@floating-ui/dom";
|
|
36
35
|
|
|
37
|
-
// libs/core/src/
|
|
36
|
+
// libs/core/src/components/popover/popover.styles.ts
|
|
38
37
|
import { css } from "lit";
|
|
39
38
|
var style = css`
|
|
40
39
|
@layer base, reset, transitional-styles;
|
|
41
40
|
@layer base {
|
|
41
|
+
:host {
|
|
42
|
+
display: contents;
|
|
43
|
+
}
|
|
44
|
+
|
|
42
45
|
:host([open]) dialog {
|
|
43
46
|
opacity: 1;
|
|
44
47
|
box-sizing: border-box;
|
|
@@ -74,26 +77,28 @@ var style = css`
|
|
|
74
77
|
`;
|
|
75
78
|
var popover_styles_default = style;
|
|
76
79
|
|
|
77
|
-
// libs/core/src/
|
|
78
|
-
var
|
|
80
|
+
// libs/core/src/components/popover/popover.ts
|
|
81
|
+
var _handleTriggerSlotChange, handleTriggerSlotChange_fn, _autoPositionCleanupFn, _isMobileViewport, _dispatchUiStateEvent, _handleCloseButton, _registerTriggerEvents, registerTriggerEvents_fn, _unregisterTriggerEvents, unregisterTriggerEvents_fn, _setupTriggerAttributes, setupTriggerAttributes_fn, _registerAutoPositioning, registerAutoPositioning_fn, _handleTriggerKeyDown, _handleTriggerClick, _focusFirstSlottedChild, _handleClickOutside;
|
|
79
82
|
var GdsPopover = class extends GdsElement {
|
|
80
83
|
constructor() {
|
|
81
84
|
super(...arguments);
|
|
85
|
+
__privateAdd(this, _handleTriggerSlotChange);
|
|
82
86
|
__privateAdd(this, _registerTriggerEvents);
|
|
83
87
|
__privateAdd(this, _unregisterTriggerEvents);
|
|
88
|
+
__privateAdd(this, _setupTriggerAttributes);
|
|
84
89
|
__privateAdd(this, _registerAutoPositioning);
|
|
85
90
|
this.open = false;
|
|
86
|
-
this.
|
|
91
|
+
this.popupRole = "dialog";
|
|
87
92
|
this.label = void 0;
|
|
88
93
|
this.placement = "bottom-start";
|
|
94
|
+
this.useModalInMobileView = false;
|
|
89
95
|
this.calcMinWidth = (referenceEl) => `${referenceEl.offsetWidth}px`;
|
|
90
96
|
this.calcMaxWidth = (_referenceEl) => `auto`;
|
|
91
|
-
this.calcMinHeight = (
|
|
97
|
+
this.calcMinHeight = (_referenceEl) => `auto`;
|
|
92
98
|
this.calcMaxHeight = (_referenceEl) => `500px`;
|
|
93
99
|
this._trigger = void 0;
|
|
100
|
+
this._anchor = void 0;
|
|
94
101
|
this._isVirtKbVisible = false;
|
|
95
|
-
// A reference to the dialog element used to make the popover modal
|
|
96
|
-
__privateAdd(this, _dialogElementRef, createRef());
|
|
97
102
|
// A function that removes the Floating UI auto positioning. This gets called when we switch to mobile view layout.
|
|
98
103
|
__privateAdd(this, _autoPositionCleanupFn, void 0);
|
|
99
104
|
__privateAdd(this, _isMobileViewport, false);
|
|
@@ -117,10 +122,10 @@ var GdsPopover = class extends GdsElement {
|
|
|
117
122
|
}, 250);
|
|
118
123
|
});
|
|
119
124
|
/**
|
|
120
|
-
* ArrowDown on the trigger element will trigger the popover by default, and escape will close it.
|
|
125
|
+
* ArrowDown or ArrowUp on the trigger element will trigger the popover by default, and escape will close it.
|
|
121
126
|
*/
|
|
122
|
-
__privateAdd(this,
|
|
123
|
-
if (e.key === "ArrowDown") {
|
|
127
|
+
__privateAdd(this, _handleTriggerKeyDown, (e) => {
|
|
128
|
+
if (e.key === "ArrowDown" || e.key === "ArrowUp") {
|
|
124
129
|
e.preventDefault();
|
|
125
130
|
this.open = true;
|
|
126
131
|
__privateGet(this, _dispatchUiStateEvent).call(this, "show");
|
|
@@ -130,19 +135,24 @@ var GdsPopover = class extends GdsElement {
|
|
|
130
135
|
__privateGet(this, _dispatchUiStateEvent).call(this, "cancel");
|
|
131
136
|
}
|
|
132
137
|
});
|
|
138
|
+
__privateAdd(this, _handleTriggerClick, (e) => {
|
|
139
|
+
e.preventDefault();
|
|
140
|
+
this.open = !this.open;
|
|
141
|
+
__privateGet(this, _dispatchUiStateEvent).call(this, this.open ? "show" : "close");
|
|
142
|
+
});
|
|
133
143
|
/**
|
|
134
144
|
* Move focus to the first slotted child.
|
|
135
145
|
*/
|
|
136
146
|
__privateAdd(this, _focusFirstSlottedChild, () => {
|
|
137
|
-
var _a
|
|
138
|
-
const firstSlottedChild = (
|
|
147
|
+
var _a;
|
|
148
|
+
const firstSlottedChild = (_a = this._elDefaultSlot) == null ? void 0 : _a.assignedElements()[0];
|
|
139
149
|
this.updateComplete.then(() => {
|
|
140
150
|
firstSlottedChild == null ? void 0 : firstSlottedChild.focus();
|
|
141
151
|
});
|
|
142
152
|
});
|
|
143
|
-
__privateAdd(this,
|
|
153
|
+
__privateAdd(this, _handleClickOutside, (evt) => {
|
|
144
154
|
const e = evt;
|
|
145
|
-
const dialog =
|
|
155
|
+
const dialog = this._elDialog;
|
|
146
156
|
const isNotEnterKey = e.clientX > 0 || e.clientY > 0;
|
|
147
157
|
if (isNotEnterKey && dialog && this.open) {
|
|
148
158
|
const rect = dialog.getBoundingClientRect();
|
|
@@ -156,13 +166,24 @@ var GdsPopover = class extends GdsElement {
|
|
|
156
166
|
});
|
|
157
167
|
}
|
|
158
168
|
_handleTriggerRefChanged() {
|
|
159
|
-
|
|
169
|
+
var _a;
|
|
170
|
+
(_a = this.triggerRef) == null ? void 0 : _a.then((el) => {
|
|
160
171
|
if (el)
|
|
161
172
|
this._trigger = el;
|
|
162
173
|
});
|
|
163
174
|
}
|
|
175
|
+
_handleAnchorRefChanged() {
|
|
176
|
+
var _a;
|
|
177
|
+
(_a = this.anchorRef) == null ? void 0 : _a.then((el) => {
|
|
178
|
+
if (el)
|
|
179
|
+
this._anchor = el;
|
|
180
|
+
});
|
|
181
|
+
}
|
|
164
182
|
_handleTriggerChanged() {
|
|
165
183
|
__privateMethod(this, _registerTriggerEvents, registerTriggerEvents_fn).call(this);
|
|
184
|
+
__privateMethod(this, _setupTriggerAttributes, setupTriggerAttributes_fn).call(this);
|
|
185
|
+
}
|
|
186
|
+
_handleAnchorChanged() {
|
|
166
187
|
__privateMethod(this, _registerAutoPositioning, registerAutoPositioning_fn).call(this);
|
|
167
188
|
}
|
|
168
189
|
connectedCallback() {
|
|
@@ -195,62 +216,67 @@ var GdsPopover = class extends GdsElement {
|
|
|
195
216
|
__privateMethod(this, _unregisterTriggerEvents, unregisterTriggerEvents_fn).call(this);
|
|
196
217
|
}
|
|
197
218
|
render() {
|
|
198
|
-
return html`<
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
<
|
|
203
|
-
<
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
219
|
+
return html`<slot
|
|
220
|
+
name="trigger"
|
|
221
|
+
@slotchange=${__privateMethod(this, _handleTriggerSlotChange, handleTriggerSlotChange_fn)}
|
|
222
|
+
></slot>
|
|
223
|
+
<div ?hidden="${!this.open}">
|
|
224
|
+
<dialog
|
|
225
|
+
class="${classMap({
|
|
226
|
+
"v-kb-visible": this._isVirtKbVisible,
|
|
227
|
+
"use-modal-in-mobile": this.useModalInMobileView
|
|
228
|
+
})}"
|
|
229
|
+
aria-hidden="${String(!this.open)}"
|
|
230
|
+
@close=${() => this.open = false}
|
|
208
231
|
>
|
|
209
|
-
<
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
232
|
+
<header>
|
|
233
|
+
<h2>${this.label}</h2>
|
|
234
|
+
<gds-button
|
|
235
|
+
@click=${__privateGet(this, _handleCloseButton)}
|
|
236
|
+
class="close"
|
|
237
|
+
label="${msg("Close")}"
|
|
238
|
+
size="small"
|
|
239
|
+
rank="tertiary"
|
|
240
|
+
>
|
|
241
|
+
<gds-icon-cross-small></icon-cross-small>
|
|
242
|
+
</gds-button>
|
|
243
|
+
</header>
|
|
244
|
+
<slot></slot>
|
|
245
|
+
</dialog>
|
|
246
|
+
</div>`;
|
|
214
247
|
}
|
|
215
248
|
_handleOpenChange() {
|
|
216
|
-
this.setAttribute("aria-hidden", String(!this.open));
|
|
217
|
-
this.hidden = !this.open;
|
|
218
249
|
this.updateComplete.then(() => {
|
|
219
|
-
var _a, _b, _c;
|
|
250
|
+
var _a, _b, _c, _d;
|
|
251
|
+
(_a = this._trigger) == null ? void 0 : _a.setAttribute("aria-expanded", String(this.open));
|
|
220
252
|
if (this.open) {
|
|
221
|
-
(
|
|
253
|
+
(_b = this._elDialog) == null ? void 0 : _b.showModal();
|
|
222
254
|
__privateGet(this, _focusFirstSlottedChild).call(this);
|
|
223
255
|
setTimeout(
|
|
224
256
|
() => {
|
|
225
257
|
var _a2;
|
|
226
|
-
return (_a2 =
|
|
227
|
-
"click",
|
|
228
|
-
__privateGet(this, _clickOutsideListener)
|
|
229
|
-
);
|
|
258
|
+
return (_a2 = this._elDialog) == null ? void 0 : _a2.addEventListener("click", __privateGet(this, _handleClickOutside));
|
|
230
259
|
},
|
|
231
260
|
0
|
|
232
261
|
);
|
|
233
262
|
} else {
|
|
234
|
-
(
|
|
235
|
-
(
|
|
236
|
-
"click",
|
|
237
|
-
__privateGet(this, _clickOutsideListener)
|
|
238
|
-
);
|
|
263
|
+
(_c = this._elDialog) == null ? void 0 : _c.close();
|
|
264
|
+
(_d = this._elDialog) == null ? void 0 : _d.removeEventListener("click", __privateGet(this, _handleClickOutside));
|
|
239
265
|
}
|
|
240
266
|
});
|
|
241
267
|
}
|
|
242
268
|
_handleMobileLayout(matches) {
|
|
243
269
|
var _a, _b, _c, _d;
|
|
244
270
|
__privateSet(this, _isMobileViewport, matches);
|
|
245
|
-
if (matches) {
|
|
271
|
+
if (matches && this.useModalInMobileView) {
|
|
246
272
|
(_a = __privateGet(this, _autoPositionCleanupFn)) == null ? void 0 : _a.call(this);
|
|
247
|
-
(_b =
|
|
248
|
-
(_c =
|
|
249
|
-
(_d =
|
|
273
|
+
(_b = this._elDialog) == null ? void 0 : _b.style.removeProperty("left");
|
|
274
|
+
(_c = this._elDialog) == null ? void 0 : _c.style.removeProperty("top");
|
|
275
|
+
(_d = this._elDialog) == null ? void 0 : _d.style.removeProperty("minWidth");
|
|
250
276
|
this.updateComplete.then(() => {
|
|
251
277
|
var _a2;
|
|
252
278
|
if (this.open)
|
|
253
|
-
(_a2 =
|
|
279
|
+
(_a2 = this._elDialog) == null ? void 0 : _a2.showModal();
|
|
254
280
|
});
|
|
255
281
|
} else {
|
|
256
282
|
this.updateComplete.then(() => {
|
|
@@ -259,27 +285,55 @@ var GdsPopover = class extends GdsElement {
|
|
|
259
285
|
}
|
|
260
286
|
}
|
|
261
287
|
};
|
|
262
|
-
|
|
288
|
+
_handleTriggerSlotChange = new WeakSet();
|
|
289
|
+
handleTriggerSlotChange_fn = function() {
|
|
290
|
+
if (this._elTriggerSlot && this._elTriggerSlot.assignedElements()[0]) {
|
|
291
|
+
this._trigger = this._elTriggerSlot.assignedElements()[0];
|
|
292
|
+
this._anchor = this._elTriggerSlot.assignedElements()[0];
|
|
293
|
+
}
|
|
294
|
+
};
|
|
263
295
|
_autoPositionCleanupFn = new WeakMap();
|
|
264
296
|
_isMobileViewport = new WeakMap();
|
|
265
297
|
_dispatchUiStateEvent = new WeakMap();
|
|
266
298
|
_handleCloseButton = new WeakMap();
|
|
267
299
|
_registerTriggerEvents = new WeakSet();
|
|
268
300
|
registerTriggerEvents_fn = function() {
|
|
269
|
-
var _a;
|
|
270
|
-
(_a = this._trigger) == null ? void 0 : _a.addEventListener("keydown", __privateGet(this,
|
|
301
|
+
var _a, _b;
|
|
302
|
+
(_a = this._trigger) == null ? void 0 : _a.addEventListener("keydown", __privateGet(this, _handleTriggerKeyDown));
|
|
303
|
+
(_b = this._trigger) == null ? void 0 : _b.addEventListener("click", __privateGet(this, _handleTriggerClick));
|
|
271
304
|
};
|
|
272
305
|
_unregisterTriggerEvents = new WeakSet();
|
|
273
306
|
unregisterTriggerEvents_fn = function() {
|
|
274
|
-
var _a, _b;
|
|
275
|
-
(_a = this._trigger) == null ? void 0 : _a.removeEventListener("keydown", __privateGet(this,
|
|
276
|
-
(_b =
|
|
307
|
+
var _a, _b, _c;
|
|
308
|
+
(_a = this._trigger) == null ? void 0 : _a.removeEventListener("keydown", __privateGet(this, _handleTriggerKeyDown));
|
|
309
|
+
(_b = this._trigger) == null ? void 0 : _b.removeEventListener("click", __privateGet(this, _handleTriggerClick));
|
|
310
|
+
(_c = __privateGet(this, _autoPositionCleanupFn)) == null ? void 0 : _c.call(this);
|
|
311
|
+
};
|
|
312
|
+
_setupTriggerAttributes = new WeakSet();
|
|
313
|
+
setupTriggerAttributes_fn = function() {
|
|
314
|
+
var _a;
|
|
315
|
+
if (this._trigger) {
|
|
316
|
+
(_a = this._trigger) == null ? void 0 : _a.setAttribute("aria-expanded", String(this.open));
|
|
317
|
+
const focusableNodeNames = ["A", "BUTTON", "INPUT", "TEXTAREA"];
|
|
318
|
+
const isProbablyFocusable = this._trigger.nodeName.startsWith("GDS-") || focusableNodeNames.includes(this._trigger.nodeName);
|
|
319
|
+
if (!isProbablyFocusable) {
|
|
320
|
+
this._trigger.setAttribute("tabindex", "0");
|
|
321
|
+
this._trigger.setAttribute("role", "button");
|
|
322
|
+
}
|
|
323
|
+
const ariaHasPopupAttr = this._trigger.nodeName.startsWith("GDS-") ? "gds-aria-haspopup" : "aria-haspopup";
|
|
324
|
+
if (this._trigger.getAttribute(ariaHasPopupAttr) === null) {
|
|
325
|
+
this._trigger.setAttribute(ariaHasPopupAttr, this.popupRole);
|
|
326
|
+
}
|
|
327
|
+
}
|
|
277
328
|
};
|
|
278
329
|
_registerAutoPositioning = new WeakSet();
|
|
279
330
|
registerAutoPositioning_fn = function() {
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
331
|
+
if (!this._anchor || !this._elDialog) {
|
|
332
|
+
return;
|
|
333
|
+
}
|
|
334
|
+
const referenceEl = this._anchor;
|
|
335
|
+
const floatingEl = this._elDialog;
|
|
336
|
+
if (!referenceEl || !floatingEl || __privateGet(this, _isMobileViewport) && this.useModalInMobileView)
|
|
283
337
|
return;
|
|
284
338
|
if (__privateGet(this, _autoPositionCleanupFn)) {
|
|
285
339
|
__privateGet(this, _autoPositionCleanupFn).call(this);
|
|
@@ -301,16 +355,23 @@ registerAutoPositioning_fn = function() {
|
|
|
301
355
|
);
|
|
302
356
|
}));
|
|
303
357
|
};
|
|
304
|
-
|
|
358
|
+
_handleTriggerKeyDown = new WeakMap();
|
|
359
|
+
_handleTriggerClick = new WeakMap();
|
|
305
360
|
_focusFirstSlottedChild = new WeakMap();
|
|
306
|
-
|
|
361
|
+
_handleClickOutside = new WeakMap();
|
|
307
362
|
GdsPopover.styles = unsafeCSS(popover_styles_default);
|
|
308
363
|
__decorateClass([
|
|
309
364
|
property({ type: Boolean, reflect: true })
|
|
310
365
|
], GdsPopover.prototype, "open", 2);
|
|
311
366
|
__decorateClass([
|
|
312
|
-
property()
|
|
367
|
+
property({ attribute: "popup-role" })
|
|
368
|
+
], GdsPopover.prototype, "popupRole", 2);
|
|
369
|
+
__decorateClass([
|
|
370
|
+
property({ attribute: false })
|
|
313
371
|
], GdsPopover.prototype, "triggerRef", 2);
|
|
372
|
+
__decorateClass([
|
|
373
|
+
property({ attribute: false })
|
|
374
|
+
], GdsPopover.prototype, "anchorRef", 2);
|
|
314
375
|
__decorateClass([
|
|
315
376
|
property()
|
|
316
377
|
], GdsPopover.prototype, "label", 2);
|
|
@@ -319,28 +380,49 @@ __decorateClass([
|
|
|
319
380
|
], GdsPopover.prototype, "placement", 2);
|
|
320
381
|
__decorateClass([
|
|
321
382
|
property()
|
|
383
|
+
], GdsPopover.prototype, "useModalInMobileView", 2);
|
|
384
|
+
__decorateClass([
|
|
385
|
+
property({ attribute: false })
|
|
322
386
|
], GdsPopover.prototype, "calcMinWidth", 2);
|
|
323
387
|
__decorateClass([
|
|
324
|
-
property()
|
|
388
|
+
property({ attribute: false })
|
|
325
389
|
], GdsPopover.prototype, "calcMaxWidth", 2);
|
|
326
390
|
__decorateClass([
|
|
327
|
-
property()
|
|
391
|
+
property({ attribute: false })
|
|
328
392
|
], GdsPopover.prototype, "calcMinHeight", 2);
|
|
329
393
|
__decorateClass([
|
|
330
|
-
property()
|
|
394
|
+
property({ attribute: false })
|
|
331
395
|
], GdsPopover.prototype, "calcMaxHeight", 2);
|
|
332
396
|
__decorateClass([
|
|
333
397
|
state()
|
|
334
398
|
], GdsPopover.prototype, "_trigger", 2);
|
|
399
|
+
__decorateClass([
|
|
400
|
+
state()
|
|
401
|
+
], GdsPopover.prototype, "_anchor", 2);
|
|
335
402
|
__decorateClass([
|
|
336
403
|
state()
|
|
337
404
|
], GdsPopover.prototype, "_isVirtKbVisible", 2);
|
|
405
|
+
__decorateClass([
|
|
406
|
+
query("slot:not([name])")
|
|
407
|
+
], GdsPopover.prototype, "_elDefaultSlot", 2);
|
|
408
|
+
__decorateClass([
|
|
409
|
+
query('slot[name="trigger"]')
|
|
410
|
+
], GdsPopover.prototype, "_elTriggerSlot", 2);
|
|
411
|
+
__decorateClass([
|
|
412
|
+
query("dialog")
|
|
413
|
+
], GdsPopover.prototype, "_elDialog", 2);
|
|
338
414
|
__decorateClass([
|
|
339
415
|
watch("triggerRef")
|
|
340
416
|
], GdsPopover.prototype, "_handleTriggerRefChanged", 1);
|
|
417
|
+
__decorateClass([
|
|
418
|
+
watch("anchorRef")
|
|
419
|
+
], GdsPopover.prototype, "_handleAnchorRefChanged", 1);
|
|
341
420
|
__decorateClass([
|
|
342
421
|
watch("_trigger")
|
|
343
422
|
], GdsPopover.prototype, "_handleTriggerChanged", 1);
|
|
423
|
+
__decorateClass([
|
|
424
|
+
watch("_anchor")
|
|
425
|
+
], GdsPopover.prototype, "_handleAnchorChanged", 1);
|
|
344
426
|
__decorateClass([
|
|
345
427
|
watch("open")
|
|
346
428
|
], GdsPopover.prototype, "_handleOpenChange", 1);
|