@sebgroup/green-core 1.15.0 → 1.16.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.
Files changed (124) hide show
  1. package/README.md +101 -7
  2. package/chunks/chunk.274BU2AI.js +244 -0
  3. package/chunks/chunk.2LQSDOD4.js +29 -0
  4. package/chunks/chunk.2ND5EWHE.js +65 -0
  5. package/chunks/chunk.2OOTOCUG.js +420 -0
  6. package/chunks/chunk.2WO4NHJ2.js +34 -0
  7. package/chunks/chunk.2Y3BHFKO.js +154 -0
  8. package/chunks/chunk.375BWME4.js +29 -0
  9. package/chunks/chunk.3SEVAGLE.js +96 -0
  10. package/chunks/chunk.522C22QY.js +460 -0
  11. package/chunks/chunk.5VURDMKE.js +75 -0
  12. package/chunks/chunk.6NM7ENKA.js +31 -0
  13. package/chunks/chunk.6UA66KQU.js +153 -0
  14. package/chunks/chunk.7P5N6NZL.js +560 -0
  15. package/chunks/chunk.7TCXY7BP.js +0 -0
  16. package/chunks/chunk.D7H7CUS4.js +55 -0
  17. package/chunks/chunk.DFYMYEGD.js +78 -0
  18. package/chunks/chunk.HS7ICQNA.js +0 -0
  19. package/chunks/chunk.IYCENQZG.js +28 -0
  20. package/chunks/chunk.J2A6J77W.js +81 -0
  21. package/chunks/chunk.KC32OWZE.js +274 -0
  22. package/chunks/chunk.KV4SDMFS.js +101 -0
  23. package/chunks/chunk.LUHCF4BJ.js +64 -0
  24. package/chunks/chunk.MAD5DQMN.js +161 -0
  25. package/chunks/chunk.MI4A2C2A.js +0 -0
  26. package/chunks/chunk.NOYHINYP.js +467 -0
  27. package/chunks/chunk.Q2T57HE7.js +0 -0
  28. package/chunks/chunk.QONSFT2N.js +4653 -0
  29. package/chunks/chunk.TMBQL2RO.js +0 -0
  30. package/chunks/chunk.TN6ZYAH3.js +74 -0
  31. package/chunks/chunk.TSDZQZBY.js +0 -0
  32. package/chunks/chunk.TX64TTBN.js +0 -0
  33. package/chunks/chunk.UF6IEONX.js +0 -0
  34. package/chunks/chunk.VOYMQ322.js +61 -0
  35. package/chunks/chunk.VYK7D6QO.js +64 -0
  36. package/chunks/chunk.WDZ2JTCP.js +360 -0
  37. package/chunks/chunk.WJDR7FTS.js +193 -0
  38. package/chunks/chunk.WM7HBMMV.js +54 -0
  39. package/chunks/chunk.XHTJVQUJ.js +140 -0
  40. package/chunks/chunk.XI4H54TV.js +39 -0
  41. package/chunks/chunk.XU4HZLJL.js +0 -0
  42. package/chunks/chunk.YIQIH4RW.js +139 -0
  43. package/chunks/chunk.YJHAKLGR.js +54 -0
  44. package/chunks/chunk.YO24ZYAD.js +0 -0
  45. package/chunks/chunk.ZTE73BY2.js +655 -0
  46. package/components/badge/badge.js +245 -0
  47. package/components/button/button.d.ts +5 -5
  48. package/components/button/button.js +18 -0
  49. package/components/button/button.trans.styles.d.ts +2 -0
  50. package/components/button/index.d.ts +1 -0
  51. package/components/button/index.js +18 -0
  52. package/components/checkbox/checkbox.js +219 -0
  53. package/components/context-menu/context-menu.d.ts +2 -1
  54. package/components/context-menu/context-menu.js +22 -0
  55. package/components/context-menu/index.d.ts +3 -0
  56. package/components/context-menu/index.js +29 -0
  57. package/components/datepicker/date-part-spinner.js +10 -0
  58. package/components/datepicker/datepicker.d.ts +3 -2
  59. package/components/datepicker/datepicker.js +29 -0
  60. package/components/datepicker/index.d.ts +1 -0
  61. package/components/datepicker/index.js +29 -0
  62. package/components/dropdown/dropdown.d.ts +2 -2
  63. package/components/dropdown/dropdown.js +22 -0
  64. package/components/dropdown/index.d.ts +3 -0
  65. package/components/dropdown/index.js +30 -0
  66. package/components/form-control.js +12 -0
  67. package/components/grid/grid.d.ts +2 -2
  68. package/components/grid/grid.js +11 -0
  69. package/components/grid/grid.style.css.js +7 -0
  70. package/components/grid/index.d.ts +1 -0
  71. package/components/grid/index.js +11 -0
  72. package/components/grouped-list/grouped-list.js +14 -0
  73. package/components/grouped-list/index.d.ts +2 -0
  74. package/components/grouped-list/index.js +17 -0
  75. package/components/grouped-list/list-item.js +10 -0
  76. package/components/icon/icon.d.ts +2 -2
  77. package/components/icon/icon.js +10 -0
  78. package/components/icon/index.d.ts +1 -0
  79. package/components/icon/index.js +10 -0
  80. package/components/index.d.ts +4 -3
  81. package/components/index.js +81 -0
  82. package/components/input/input.js +682 -0
  83. package/components/radio/radio-group.js +9 -0
  84. package/components/radio/radio.js +240 -0
  85. package/components/segmented-control/index.d.ts +1 -0
  86. package/components/segmented-control/index.js +15 -0
  87. package/components/segmented-control/segment/index.d.ts +1 -0
  88. package/components/segmented-control/segment/index.js +13 -0
  89. package/components/segmented-control/segment/segment.js +12 -0
  90. package/components/segmented-control/segmented-control.d.ts +1 -1
  91. package/components/segmented-control/segmented-control.js +15 -0
  92. package/components/switch/switch.js +164 -0
  93. package/components/theme/index.d.ts +1 -0
  94. package/components/theme/index.js +11 -0
  95. package/components/theme/theme.js +11 -0
  96. package/components/tooltip/tooltip.js +252 -0
  97. package/index.js +72 -4278
  98. package/localization.js +40 -44
  99. package/package.json +7 -16
  100. package/primitives/calendar/calendar.js +13 -0
  101. package/primitives/calendar/functions.js +7 -0
  102. package/primitives/calendar/index.d.ts +1 -0
  103. package/primitives/calendar/index.js +14 -0
  104. package/primitives/listbox/index.d.ts +0 -1
  105. package/primitives/listbox/index.js +17 -0
  106. package/primitives/listbox/listbox.d.ts +2 -1
  107. package/primitives/listbox/listbox.js +16 -0
  108. package/primitives/listbox/option.js +14 -0
  109. package/primitives/menu/index.d.ts +1 -0
  110. package/primitives/menu/index.js +15 -0
  111. package/primitives/menu/menu-heading.js +11 -0
  112. package/primitives/menu/menu-item.d.ts +1 -2
  113. package/primitives/menu/menu-item.js +12 -0
  114. package/primitives/menu/menu.d.ts +2 -1
  115. package/primitives/menu/menu.js +14 -0
  116. package/primitives/popover/index.js +14 -0
  117. package/primitives/popover/popover.js +13 -0
  118. package/primitives/ripple/index.d.ts +1 -0
  119. package/primitives/ripple/index.js +11 -0
  120. package/primitives/ripple/ripple.d.ts +1 -1
  121. package/primitives/ripple/ripple.js +10 -0
  122. package/scoping.d.ts +1 -0
  123. package/scoping.js +18 -0
  124. package/transitional-styles.js +6 -4275
File without changes
@@ -0,0 +1,74 @@
1
+ import {
2
+ constrainSlots
3
+ } from "./chunk.6NM7ENKA.js";
4
+ import {
5
+ __decorateClass,
6
+ __privateAdd,
7
+ __privateSet
8
+ } from "./chunk.5VURDMKE.js";
9
+
10
+ // libs/core/src/components/radio/radio-group.ts
11
+ import { LitElement, html } from "lit";
12
+ import { customElement, property } from "lit/decorators.js";
13
+ var _internals;
14
+ var GdsRadioGroup = class extends LitElement {
15
+ constructor() {
16
+ super();
17
+ // Private members
18
+ __privateAdd(this, _internals, void 0);
19
+ this.label = "Label";
20
+ this.inputElement = null;
21
+ this.exludeAttr = ["id", "label"];
22
+ __privateSet(this, _internals, this.attachInternals());
23
+ constrainSlots(this);
24
+ }
25
+ reflectAttributesToInput() {
26
+ if (this.inputElement) {
27
+ const attributes = this.attributes;
28
+ for (let i = 0; i < attributes.length; i++) {
29
+ const attribute = attributes[i];
30
+ if (!this.exludeAttr.includes(attribute.name)) {
31
+ this.inputElement.setAttribute(attribute.name, attribute.value);
32
+ }
33
+ }
34
+ }
35
+ }
36
+ update(changedProperties) {
37
+ var _a;
38
+ super.update(changedProperties);
39
+ if (!this.inputElement) {
40
+ this.inputElement = (_a = this.shadowRoot) == null ? void 0 : _a.getElementById(
41
+ "radio"
42
+ );
43
+ }
44
+ this.reflectAttributesToInput();
45
+ }
46
+ render() {
47
+ return html`
48
+ <fieldset
49
+ class="gds-radio-group"
50
+ role="radiogroup"
51
+ aria-labelledby="label"
52
+ >
53
+ <label>${this.label}</label>
54
+ <slot></slot>
55
+ </fieldset>
56
+ `;
57
+ }
58
+ };
59
+ _internals = new WeakMap();
60
+ // static styles = unsafeCSS(styles)
61
+ GdsRadioGroup.shadowRootOptions = {
62
+ mode: "open",
63
+ delegatesFocus: true
64
+ };
65
+ __decorateClass([
66
+ property({ type: String, reflect: true, attribute: "label" })
67
+ ], GdsRadioGroup.prototype, "label", 2);
68
+ GdsRadioGroup = __decorateClass([
69
+ customElement("gds-radio-group")
70
+ ], GdsRadioGroup);
71
+
72
+ export {
73
+ GdsRadioGroup
74
+ };
File without changes
File without changes
File without changes
@@ -0,0 +1,61 @@
1
+ // libs/core/src/utils/helpers/custom-element-scoping.ts
2
+ import { html as litHtml } from "lit";
3
+ import { customElement } from "lit/decorators.js";
4
+ var VER_SUFFIX = "-482aa6";
5
+ var elementLookupTable = /* @__PURE__ */ new Map();
6
+ var gdsCustomElement = (tagName) => {
7
+ if (globalThis.GDS_DISABLE_VERSIONED_ELEMENTS) {
8
+ elementLookupTable.set(tagName, tagName);
9
+ return customElement(tagName);
10
+ }
11
+ const versionedTagName = tagName + VER_SUFFIX;
12
+ elementLookupTable.set(tagName, versionedTagName);
13
+ if (customElements.get(versionedTagName))
14
+ return (_classOrDescriptor) => false;
15
+ return customElement(versionedTagName);
16
+ };
17
+ var templateCache = /* @__PURE__ */ new WeakMap();
18
+ function applyElementScoping(strings, ...values) {
19
+ let modstrings = templateCache.get(strings);
20
+ if (!modstrings) {
21
+ modstrings = replaceTags(strings);
22
+ modstrings.raw = replaceTags(strings.raw);
23
+ templateCache.set(strings, modstrings);
24
+ }
25
+ return [modstrings, ...values];
26
+ }
27
+ var replaceTags = (inStr) => inStr.map((s) => {
28
+ for (const [key, value] of elementLookupTable.entries()) {
29
+ s = s.replace(new RegExp(`${key}(?![-a-z])`, "mg"), value);
30
+ }
31
+ return s;
32
+ });
33
+ function htmlTemplateTagFactory(extendedTag) {
34
+ return (strings, ...values) => {
35
+ if (globalThis.GDS_DISABLE_VERSIONED_ELEMENTS) {
36
+ return extendedTag(strings, ...values);
37
+ }
38
+ const [modstrings, ...modvalues] = applyElementScoping(strings, ...values);
39
+ return extendedTag(modstrings, ...modvalues);
40
+ };
41
+ }
42
+ var html = htmlTemplateTagFactory(litHtml);
43
+ function getScopedTagName(tagName) {
44
+ var _a;
45
+ return (_a = elementLookupTable.get(tagName)) != null ? _a : tagName;
46
+ }
47
+ function getUnscopedTagName(tagName) {
48
+ var _a;
49
+ return (_a = [...elementLookupTable.entries()].find(
50
+ ([, value]) => value === tagName
51
+ )) == null ? void 0 : _a[0];
52
+ }
53
+
54
+ export {
55
+ VER_SUFFIX,
56
+ gdsCustomElement,
57
+ htmlTemplateTagFactory,
58
+ html,
59
+ getScopedTagName,
60
+ getUnscopedTagName
61
+ };
@@ -0,0 +1,64 @@
1
+ import {
2
+ Focusable,
3
+ option_styles_default
4
+ } from "./chunk.2ND5EWHE.js";
5
+ import {
6
+ TransitionalStyles
7
+ } from "./chunk.QONSFT2N.js";
8
+ import {
9
+ GdsElement
10
+ } from "./chunk.2LQSDOD4.js";
11
+ import {
12
+ gdsCustomElement,
13
+ html
14
+ } from "./chunk.VOYMQ322.js";
15
+ import {
16
+ __decorateClass,
17
+ __privateAdd,
18
+ __privateGet
19
+ } from "./chunk.5VURDMKE.js";
20
+
21
+ // libs/core/src/primitives/menu/menu-item.ts
22
+ import { state } from "lit/decorators.js";
23
+ var _handleOnClick;
24
+ var GdsMenuItem = class extends Focusable(GdsElement) {
25
+ constructor() {
26
+ super(...arguments);
27
+ __privateAdd(this, _handleOnClick, () => {
28
+ this.dispatchEvent(
29
+ new CustomEvent("gds-menu-item-click", {
30
+ bubbles: true,
31
+ composed: true
32
+ })
33
+ );
34
+ });
35
+ }
36
+ connectedCallback() {
37
+ super.connectedCallback();
38
+ this.setAttribute("role", "menuitem");
39
+ this.addEventListener("keydown", (e) => {
40
+ if (e.key !== "Enter" && e.key !== " ")
41
+ return;
42
+ e.preventDefault();
43
+ this.click();
44
+ });
45
+ this.addEventListener("click", __privateGet(this, _handleOnClick));
46
+ TransitionalStyles.instance.apply(this, "gds-option");
47
+ }
48
+ render() {
49
+ return html`${this._tStyles}
50
+ <div><slot></slot></div>`;
51
+ }
52
+ };
53
+ _handleOnClick = new WeakMap();
54
+ GdsMenuItem.styles = [option_styles_default];
55
+ __decorateClass([
56
+ state()
57
+ ], GdsMenuItem.prototype, "_tStyles", 2);
58
+ GdsMenuItem = __decorateClass([
59
+ gdsCustomElement("gds-menu-item")
60
+ ], GdsMenuItem);
61
+
62
+ export {
63
+ GdsMenuItem
64
+ };
@@ -0,0 +1,360 @@
1
+ import {
2
+ TransitionalStyles
3
+ } from "./chunk.QONSFT2N.js";
4
+ import {
5
+ watchMediaQuery
6
+ } from "./chunk.WM7HBMMV.js";
7
+ import {
8
+ GdsElement
9
+ } from "./chunk.2LQSDOD4.js";
10
+ import {
11
+ watch
12
+ } from "./chunk.2WO4NHJ2.js";
13
+ import {
14
+ gdsCustomElement
15
+ } from "./chunk.VOYMQ322.js";
16
+ import {
17
+ __decorateClass,
18
+ __privateAdd,
19
+ __privateGet,
20
+ __privateMethod,
21
+ __privateSet
22
+ } from "./chunk.5VURDMKE.js";
23
+
24
+ // libs/core/src/primitives/popover/popover.ts
25
+ import { html, unsafeCSS } from "lit";
26
+ import { property, state } from "lit/decorators.js";
27
+ import { classMap } from "lit/directives/class-map.js";
28
+ import { msg } from "@lit/localize";
29
+ import { createRef, ref } from "lit/directives/ref.js";
30
+ import {
31
+ computePosition,
32
+ autoUpdate,
33
+ offset,
34
+ flip
35
+ } from "@floating-ui/dom";
36
+
37
+ // libs/core/src/primitives/popover/popover.styles.ts
38
+ import { css } from "lit";
39
+ var style = css`
40
+ @layer base, reset, transitional-styles;
41
+ @layer base {
42
+ :host([open]) dialog {
43
+ opacity: 1;
44
+ box-sizing: border-box;
45
+ transform: translate3d(0, 0, 0);
46
+ visibility: visible;
47
+ }
48
+
49
+ dialog {
50
+ inset: auto;
51
+ position: fixed;
52
+ overflow: hidden;
53
+ padding: 0px;
54
+ box-sizing: border-box;
55
+ right: 0;
56
+ margin: 0;
57
+ box-shadow:
58
+ 0 0 0 1px rgba(0, 0, 0, 0.2),
59
+ 0 1rem 28px rgba(0, 0, 0, 0.15);
60
+ border-width: 0;
61
+ border-radius: 0.5rem;
62
+ }
63
+
64
+ header {
65
+ display: none;
66
+ }
67
+
68
+ dialog::backdrop {
69
+ background-color: transparent;
70
+ display: block;
71
+ position: fixed;
72
+ }
73
+ }
74
+ `;
75
+ var popover_styles_default = style;
76
+
77
+ // libs/core/src/primitives/popover/popover.ts
78
+ var _dialogElementRef, _autoPositionCleanupFn, _isMobileViewport, _dispatchUiStateEvent, _handleCloseButton, _registerTriggerEvents, registerTriggerEvents_fn, _unregisterTriggerEvents, unregisterTriggerEvents_fn, _registerAutoPositioning, registerAutoPositioning_fn, _triggerKeyDownListener, _focusFirstSlottedChild, _clickOutsideListener;
79
+ var GdsPopover = class extends GdsElement {
80
+ constructor() {
81
+ super(...arguments);
82
+ __privateAdd(this, _registerTriggerEvents);
83
+ __privateAdd(this, _unregisterTriggerEvents);
84
+ __privateAdd(this, _registerAutoPositioning);
85
+ this.open = false;
86
+ this.triggerRef = Promise.resolve(void 0);
87
+ this.label = void 0;
88
+ this.placement = "bottom-start";
89
+ this.calcMinWidth = (referenceEl) => `${referenceEl.offsetWidth}px`;
90
+ this.calcMaxWidth = (_referenceEl) => `auto`;
91
+ this.calcMinHeight = (referenceEl) => `auto`;
92
+ this.calcMaxHeight = (_referenceEl) => `500px`;
93
+ this._trigger = void 0;
94
+ this._isVirtKbVisible = false;
95
+ // A reference to the dialog element used to make the popover modal
96
+ __privateAdd(this, _dialogElementRef, createRef());
97
+ // A function that removes the Floating UI auto positioning. This gets called when we switch to mobile view layout.
98
+ __privateAdd(this, _autoPositionCleanupFn, void 0);
99
+ __privateAdd(this, _isMobileViewport, false);
100
+ __privateAdd(this, _dispatchUiStateEvent, (reason) => {
101
+ this.dispatchEvent(
102
+ new CustomEvent("gds-ui-state", {
103
+ detail: { open: this.open, reason },
104
+ bubbles: false,
105
+ composed: false
106
+ })
107
+ );
108
+ });
109
+ __privateAdd(this, _handleCloseButton, (e) => {
110
+ e.stopPropagation();
111
+ e.preventDefault();
112
+ this.open = false;
113
+ __privateGet(this, _dispatchUiStateEvent).call(this, "close");
114
+ setTimeout(() => {
115
+ var _a;
116
+ return (_a = this._trigger) == null ? void 0 : _a.focus();
117
+ }, 250);
118
+ });
119
+ /**
120
+ * ArrowDown on the trigger element will trigger the popover by default, and escape will close it.
121
+ */
122
+ __privateAdd(this, _triggerKeyDownListener, (e) => {
123
+ if (e.key === "ArrowDown") {
124
+ e.preventDefault();
125
+ this.open = true;
126
+ __privateGet(this, _dispatchUiStateEvent).call(this, "show");
127
+ }
128
+ if (e.key === "Escape") {
129
+ this.open = false;
130
+ __privateGet(this, _dispatchUiStateEvent).call(this, "cancel");
131
+ }
132
+ });
133
+ /**
134
+ * Move focus to the first slotted child.
135
+ */
136
+ __privateAdd(this, _focusFirstSlottedChild, () => {
137
+ var _a, _b;
138
+ const firstSlottedChild = (_b = (_a = this.shadowRoot) == null ? void 0 : _a.querySelector("slot")) == null ? void 0 : _b.assignedElements()[0];
139
+ this.updateComplete.then(() => {
140
+ firstSlottedChild == null ? void 0 : firstSlottedChild.focus();
141
+ });
142
+ });
143
+ __privateAdd(this, _clickOutsideListener, (evt) => {
144
+ const e = evt;
145
+ const dialog = __privateGet(this, _dialogElementRef).value;
146
+ const isNotEnterKey = e.clientX > 0 || e.clientY > 0;
147
+ if (isNotEnterKey && dialog && this.open) {
148
+ const rect = dialog.getBoundingClientRect();
149
+ const isInDialog = rect.top <= e.clientY && e.clientY <= rect.top + rect.height && rect.left <= e.clientX && e.clientX <= rect.left + rect.width;
150
+ if (!isInDialog) {
151
+ e.stopPropagation();
152
+ this.open = false;
153
+ __privateGet(this, _dispatchUiStateEvent).call(this, "close");
154
+ }
155
+ }
156
+ });
157
+ }
158
+ _handleTriggerRefChanged() {
159
+ this.triggerRef.then((el) => {
160
+ if (el)
161
+ this._trigger = el;
162
+ });
163
+ }
164
+ _handleTriggerChanged() {
165
+ __privateMethod(this, _registerTriggerEvents, registerTriggerEvents_fn).call(this);
166
+ __privateMethod(this, _registerAutoPositioning, registerAutoPositioning_fn).call(this);
167
+ }
168
+ connectedCallback() {
169
+ super.connectedCallback();
170
+ TransitionalStyles.instance.apply(this, "gds-popover");
171
+ __privateMethod(this, _registerTriggerEvents, registerTriggerEvents_fn).call(this);
172
+ this._handleOpenChange();
173
+ this.addEventListener("keydown", (e) => {
174
+ if (e.key === "Escape") {
175
+ this.open = false;
176
+ __privateGet(this, _dispatchUiStateEvent).call(this, "cancel");
177
+ e.stopPropagation();
178
+ e.preventDefault();
179
+ }
180
+ });
181
+ this.addEventListener("focusin", (e) => {
182
+ const t = e.target;
183
+ if (t.tagName === "INPUT" || t.tagName === "TEXTAREA") {
184
+ this._isVirtKbVisible = true;
185
+ } else {
186
+ this._isVirtKbVisible = false;
187
+ }
188
+ });
189
+ this.addEventListener("blurin", (_) => {
190
+ this._isVirtKbVisible = false;
191
+ });
192
+ }
193
+ disconnectedCallback() {
194
+ super.disconnectedCallback();
195
+ __privateMethod(this, _unregisterTriggerEvents, unregisterTriggerEvents_fn).call(this);
196
+ }
197
+ render() {
198
+ return html`${this._tStyles}
199
+ <dialog
200
+ class="${classMap({ "v-kb-visible": this._isVirtKbVisible })}"
201
+ ${ref(__privateGet(this, _dialogElementRef))}
202
+ >
203
+ <header>
204
+ <h2>${this.label}</h2>
205
+ <button
206
+ class="close"
207
+ @click=${__privateGet(this, _handleCloseButton)}
208
+ aria-label="${msg("Close")}"
209
+ >
210
+ <i></i>
211
+ </button>
212
+ </header>
213
+ <slot></slot>
214
+ </dialog>`;
215
+ }
216
+ _handleOpenChange() {
217
+ this.setAttribute("aria-hidden", String(!this.open));
218
+ this.hidden = !this.open;
219
+ this.updateComplete.then(() => {
220
+ var _a, _b, _c;
221
+ if (this.open) {
222
+ (_a = __privateGet(this, _dialogElementRef).value) == null ? void 0 : _a.showModal();
223
+ __privateGet(this, _focusFirstSlottedChild).call(this);
224
+ setTimeout(
225
+ () => {
226
+ var _a2;
227
+ return (_a2 = __privateGet(this, _dialogElementRef).value) == null ? void 0 : _a2.addEventListener(
228
+ "click",
229
+ __privateGet(this, _clickOutsideListener)
230
+ );
231
+ },
232
+ 0
233
+ );
234
+ } else {
235
+ (_b = __privateGet(this, _dialogElementRef).value) == null ? void 0 : _b.close();
236
+ (_c = __privateGet(this, _dialogElementRef).value) == null ? void 0 : _c.removeEventListener(
237
+ "click",
238
+ __privateGet(this, _clickOutsideListener)
239
+ );
240
+ }
241
+ });
242
+ }
243
+ _handleMobileLayout(matches) {
244
+ var _a, _b, _c, _d;
245
+ __privateSet(this, _isMobileViewport, matches);
246
+ if (matches) {
247
+ (_a = __privateGet(this, _autoPositionCleanupFn)) == null ? void 0 : _a.call(this);
248
+ (_b = __privateGet(this, _dialogElementRef).value) == null ? void 0 : _b.style.removeProperty("left");
249
+ (_c = __privateGet(this, _dialogElementRef).value) == null ? void 0 : _c.style.removeProperty("top");
250
+ (_d = __privateGet(this, _dialogElementRef).value) == null ? void 0 : _d.style.removeProperty("minWidth");
251
+ this.updateComplete.then(() => {
252
+ var _a2;
253
+ if (this.open)
254
+ (_a2 = __privateGet(this, _dialogElementRef).value) == null ? void 0 : _a2.showModal();
255
+ });
256
+ } else {
257
+ this.updateComplete.then(() => {
258
+ __privateMethod(this, _registerAutoPositioning, registerAutoPositioning_fn).call(this);
259
+ });
260
+ }
261
+ }
262
+ };
263
+ _dialogElementRef = new WeakMap();
264
+ _autoPositionCleanupFn = new WeakMap();
265
+ _isMobileViewport = new WeakMap();
266
+ _dispatchUiStateEvent = new WeakMap();
267
+ _handleCloseButton = new WeakMap();
268
+ _registerTriggerEvents = new WeakSet();
269
+ registerTriggerEvents_fn = function() {
270
+ var _a;
271
+ (_a = this._trigger) == null ? void 0 : _a.addEventListener("keydown", __privateGet(this, _triggerKeyDownListener));
272
+ };
273
+ _unregisterTriggerEvents = new WeakSet();
274
+ unregisterTriggerEvents_fn = function() {
275
+ var _a, _b;
276
+ (_a = this._trigger) == null ? void 0 : _a.removeEventListener("keydown", __privateGet(this, _triggerKeyDownListener));
277
+ (_b = __privateGet(this, _autoPositionCleanupFn)) == null ? void 0 : _b.call(this);
278
+ };
279
+ _registerAutoPositioning = new WeakSet();
280
+ registerAutoPositioning_fn = function() {
281
+ const referenceEl = this._trigger;
282
+ const floatingEl = __privateGet(this, _dialogElementRef).value;
283
+ if (!referenceEl || !floatingEl || __privateGet(this, _isMobileViewport))
284
+ return;
285
+ if (__privateGet(this, _autoPositionCleanupFn)) {
286
+ __privateGet(this, _autoPositionCleanupFn).call(this);
287
+ }
288
+ __privateSet(this, _autoPositionCleanupFn, autoUpdate(referenceEl, floatingEl, () => {
289
+ computePosition(referenceEl, floatingEl, {
290
+ placement: this.placement,
291
+ middleware: [offset(8), flip()],
292
+ strategy: "fixed"
293
+ }).then(
294
+ ({ x, y }) => Object.assign(floatingEl.style, {
295
+ left: `${x}px`,
296
+ top: `${y}px`,
297
+ minWidth: this.calcMinWidth(referenceEl),
298
+ maxWidth: this.calcMaxWidth(referenceEl),
299
+ minHeight: this.calcMinHeight(referenceEl),
300
+ maxHeight: this.calcMaxHeight(referenceEl)
301
+ })
302
+ );
303
+ }));
304
+ };
305
+ _triggerKeyDownListener = new WeakMap();
306
+ _focusFirstSlottedChild = new WeakMap();
307
+ _clickOutsideListener = new WeakMap();
308
+ GdsPopover.styles = unsafeCSS(popover_styles_default);
309
+ __decorateClass([
310
+ property({ type: Boolean, reflect: true })
311
+ ], GdsPopover.prototype, "open", 2);
312
+ __decorateClass([
313
+ property()
314
+ ], GdsPopover.prototype, "triggerRef", 2);
315
+ __decorateClass([
316
+ property()
317
+ ], GdsPopover.prototype, "label", 2);
318
+ __decorateClass([
319
+ property()
320
+ ], GdsPopover.prototype, "placement", 2);
321
+ __decorateClass([
322
+ property()
323
+ ], GdsPopover.prototype, "calcMinWidth", 2);
324
+ __decorateClass([
325
+ property()
326
+ ], GdsPopover.prototype, "calcMaxWidth", 2);
327
+ __decorateClass([
328
+ property()
329
+ ], GdsPopover.prototype, "calcMinHeight", 2);
330
+ __decorateClass([
331
+ property()
332
+ ], GdsPopover.prototype, "calcMaxHeight", 2);
333
+ __decorateClass([
334
+ state()
335
+ ], GdsPopover.prototype, "_trigger", 2);
336
+ __decorateClass([
337
+ state()
338
+ ], GdsPopover.prototype, "_isVirtKbVisible", 2);
339
+ __decorateClass([
340
+ watch("triggerRef")
341
+ ], GdsPopover.prototype, "_handleTriggerRefChanged", 1);
342
+ __decorateClass([
343
+ watch("_trigger")
344
+ ], GdsPopover.prototype, "_handleTriggerChanged", 1);
345
+ __decorateClass([
346
+ state()
347
+ ], GdsPopover.prototype, "_tStyles", 2);
348
+ __decorateClass([
349
+ watch("open")
350
+ ], GdsPopover.prototype, "_handleOpenChange", 1);
351
+ __decorateClass([
352
+ watchMediaQuery("(max-width: 576px)")
353
+ ], GdsPopover.prototype, "_handleMobileLayout", 1);
354
+ GdsPopover = __decorateClass([
355
+ gdsCustomElement("gds-popover")
356
+ ], GdsPopover);
357
+
358
+ export {
359
+ GdsPopover
360
+ };