@sebgroup/green-core 1.31.0 → 1.33.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 (102) hide show
  1. package/chunks/{chunk.MZSK66DN.js → chunk.2BMJPIND.js} +62 -44
  2. package/chunks/{chunk.C3DZ5TYR.js → chunk.6GPKW7CQ.js} +4 -4
  3. package/chunks/chunk.A23HHQDO.js +0 -0
  4. package/chunks/{chunk.QVB7U5PX.js → chunk.B4PJKZ3W.js} +4 -4
  5. package/chunks/chunk.DCVDALVX.js +0 -0
  6. package/chunks/{chunk.WIA7QHCX.js → chunk.DD3PZZQL.js} +7 -2
  7. package/chunks/chunk.EN4BB5CC.js +336 -0
  8. package/chunks/{chunk.GA7DIQNG.js → chunk.EONTEKQO.js} +1 -1
  9. package/chunks/{chunk.6VYOPBWL.js → chunk.FOBESBRV.js} +1 -1
  10. package/chunks/{chunk.H2DROYO6.js → chunk.G47WF6H3.js} +1 -1
  11. package/chunks/{chunk.I2ZBV4TU.js → chunk.LIKF5UOW.js} +10 -4
  12. package/chunks/{chunk.P4WYUSGN.js → chunk.NF5O27GG.js} +6 -6
  13. package/chunks/{chunk.ZBJOM5ED.js → chunk.NIRW5HCW.js} +1 -1
  14. package/chunks/{chunk.EHAQQKN7.js → chunk.PMHM3R2E.js} +5 -5
  15. package/chunks/{chunk.YTLGGBXL.js → chunk.RICFAZT4.js} +1 -1
  16. package/chunks/{chunk.Y7ZUVKRP.js → chunk.RR57EBDU.js} +4 -4
  17. package/chunks/{chunk.FI7FECDT.js → chunk.SPY75SQX.js} +1 -1
  18. package/chunks/{chunk.CMBWSAV5.js → chunk.SZIIPFWH.js} +4 -4
  19. package/chunks/{chunk.N6P4NYWB.js → chunk.T2IMBVU6.js} +1 -1
  20. package/chunks/{chunk.NPXN7ELA.js → chunk.TAUCOID4.js} +3 -3
  21. package/chunks/chunk.UNXDEINN.js +86 -0
  22. package/chunks/chunk.US5K5OGQ.js +0 -0
  23. package/chunks/chunk.VOYMQ322.js +1 -1
  24. package/chunks/{chunk.C3SO7KTM.js → chunk.XMGKJ4R2.js} +7 -2
  25. package/chunks/chunk.YL55SGZC.js +0 -0
  26. package/chunks/{chunk.JG4R6KQ7.js → chunk.Z27WVNGN.js} +4 -1
  27. package/components/button/button.d.ts +3 -1
  28. package/components/button/button.js +5 -5
  29. package/components/button/index.js +5 -5
  30. package/components/calendar/calendar.js +2 -2
  31. package/components/calendar/index.js +2 -2
  32. package/components/coachmark/coachmark.d.ts +46 -0
  33. package/components/coachmark/coachmark.js +11 -0
  34. package/components/coachmark/coachmark.styles.d.ts +2 -0
  35. package/components/coachmark/index.d.ts +1 -0
  36. package/components/coachmark/index.js +11 -0
  37. package/components/content/divider/divider.js +4 -4
  38. package/components/content/divider/index.js +4 -4
  39. package/components/content/spacer/index.js +3 -3
  40. package/components/content/spacer/spacer.js +3 -3
  41. package/components/content/text/index.js +4 -4
  42. package/components/content/text/text.js +4 -4
  43. package/components/context-menu/context-menu.js +2 -2
  44. package/components/context-menu/index.js +5 -5
  45. package/components/datepicker/datepicker.d.ts +2 -1
  46. package/components/datepicker/datepicker.js +13 -13
  47. package/components/datepicker/index.js +13 -13
  48. package/components/dropdown/dropdown.d.ts +2 -1
  49. package/components/dropdown/dropdown.js +6 -6
  50. package/components/dropdown/index.js +9 -9
  51. package/components/filter-chips/filter-chip/filter-chip.js +5 -5
  52. package/components/filter-chips/filter-chip/index.js +5 -5
  53. package/components/filter-chips/filter-chips.d.ts +2 -1
  54. package/components/filter-chips/filter-chips.js +7 -7
  55. package/components/filter-chips/index.js +7 -7
  56. package/components/{form-control.d.ts → form/form-control.d.ts} +20 -8
  57. package/components/form/form-control.js +13 -0
  58. package/components/form/index.d.ts +1 -0
  59. package/components/form/index.js +28 -0
  60. package/components/form/summary/index.d.ts +1 -0
  61. package/components/form/summary/index.js +27 -0
  62. package/components/form/summary/summary.d.ts +13 -0
  63. package/components/form/summary/summary.js +26 -0
  64. package/components/icon/icons/index.js +197 -197
  65. package/components/index.d.ts +2 -0
  66. package/components/index.js +77 -64
  67. package/components/layout/card/card.js +5 -5
  68. package/components/layout/card/index.js +6 -5
  69. package/components/layout/container/container.js +3 -3
  70. package/components/layout/container/index.js +3 -3
  71. package/components/layout/flex/flex.js +5 -5
  72. package/components/layout/flex/index.js +6 -5
  73. package/components/layout/grid/grid.js +3 -3
  74. package/components/layout/grid/index.js +3 -3
  75. package/components/media/img/img.js +3 -3
  76. package/components/media/img/index.js +3 -3
  77. package/components/media/video/index.js +3 -3
  78. package/components/media/video/video.js +3 -3
  79. package/components/menu-button/index.js +2 -2
  80. package/components/menu-button/menu-button.js +2 -2
  81. package/components/popover/index.js +2 -2
  82. package/components/popover/popover.js +2 -2
  83. package/components/segmented-control/index.js +5 -5
  84. package/components/segmented-control/segment/index.js +2 -2
  85. package/components/segmented-control/segment/segment.js +2 -2
  86. package/components/segmented-control/segmented-control.js +5 -5
  87. package/generated/locales/sv.d.ts +3 -0
  88. package/index.js +77 -64
  89. package/localization.js +42 -37
  90. package/package.json +1 -1
  91. package/primitives/listbox/index.js +3 -3
  92. package/primitives/listbox/listbox.js +3 -3
  93. package/primitives/listbox/option.js +2 -2
  94. package/primitives/ripple/index.js +2 -2
  95. package/primitives/ripple/ripple.js +2 -2
  96. package/setup-jest.js +3 -0
  97. package/components/form-control.js +0 -13
  98. package/chunks/{chunk.65745UGT.js → chunk.2RSV625P.js} +0 -0
  99. package/chunks/{chunk.VGYE44DX.js → chunk.5E3XX4UM.js} +3 -3
  100. package/chunks/{chunk.DCXVWTKS.js → chunk.7NXTH3UK.js} +3 -3
  101. package/chunks/{chunk.WZUFNAAA.js → chunk.BX2ZVTGR.js} +3 -3
  102. package/chunks/{chunk.ZUYZBLHW.js → chunk.WE2J4MJA.js} +3 -3
@@ -1,32 +1,28 @@
1
- import {
2
- GdsElement
3
- } from "./chunk.ZQ4D5K7J.js";
4
1
  import {
5
2
  watch
6
3
  } from "./chunk.2WO4NHJ2.js";
4
+ import {
5
+ GdsElement
6
+ } from "./chunk.ZQ4D5K7J.js";
7
7
  import {
8
8
  __decorateClass,
9
9
  __privateAdd,
10
10
  __privateGet,
11
- __privateSet
11
+ __privateSet,
12
+ __spreadProps,
13
+ __spreadValues
12
14
  } from "./chunk.5VURDMKE.js";
13
15
 
14
- // libs/core/src/components/form-control.ts
16
+ // libs/core/src/components/form/form-control.ts
15
17
  import { property } from "lit/decorators.js";
18
+ import { msg } from "@lit/localize";
16
19
  var _internals;
17
20
  var GdsFormControlElement = class extends GdsElement {
18
21
  constructor() {
19
22
  super();
20
23
  __privateAdd(this, _internals, void 0);
21
- this.invalid = false;
24
+ this.required = false;
22
25
  this.name = "";
23
- /**
24
- * Event handler for the form reset event.
25
- * Can be overridden by subclasses to rcustomize the reset value.
26
- */
27
- this._handleFormReset = () => {
28
- this.value = void 0;
29
- };
30
26
  try {
31
27
  __privateSet(this, _internals, this.attachInternals());
32
28
  } catch (e) {
@@ -58,6 +54,23 @@ var GdsFormControlElement = class extends GdsElement {
58
54
  });
59
55
  }
60
56
  }
57
+ set invalid(value) {
58
+ const oldValue = this.invalid;
59
+ __privateGet(this, _internals).setValidity(
60
+ __spreadProps(__spreadValues({}, __privateGet(this, _internals).validity), {
61
+ customError: value,
62
+ valid: !value
63
+ }),
64
+ this.validationMessage || msg(`Validation error`),
65
+ // @ts-expect-error - setValidity actually takes an element as the third argument, but the type definition is wrong.
66
+ this._getValidityAnchor() || void 0
67
+ );
68
+ this.requestUpdate("invalid", oldValue);
69
+ __privateGet(this, _internals).checkValidity();
70
+ }
71
+ get invalid() {
72
+ return !__privateGet(this, _internals).validity.valid;
73
+ }
61
74
  /**
62
75
  * The form element that the form control is associated with.
63
76
  */
@@ -74,45 +87,50 @@ var GdsFormControlElement = class extends GdsElement {
74
87
  return __privateGet(this, _internals).willValidate;
75
88
  }
76
89
  checkValidity() {
90
+ const anchor = this._getValidityAnchor();
91
+ if (!anchor || !this.validator)
92
+ return true;
93
+ const oldValue = this.invalid;
94
+ const validity = this.validator.validate(this) || [
95
+ __spreadProps(__spreadValues({}, this.validity), { valid: true }),
96
+ ""
97
+ ];
98
+ __privateGet(this, _internals).setValidity(
99
+ validity[0],
100
+ validity[1],
101
+ // @ts-expect-error - setValidity actually takes an element as the third argument, but the type definition is wrong.
102
+ this._getValidityAnchor()
103
+ );
104
+ this.requestUpdate("invalid", oldValue);
77
105
  return __privateGet(this, _internals).checkValidity();
78
106
  }
79
107
  reportValidity() {
80
108
  return __privateGet(this, _internals).reportValidity();
81
109
  }
82
- connectedCallback() {
83
- var _a;
84
- super.connectedCallback();
85
- (_a = __privateGet(this, _internals).form) == null ? void 0 : _a.addEventListener("reset", this._handleFormReset);
110
+ __handleValueChange() {
111
+ __privateGet(this, _internals).setFormValue(this.value);
112
+ this.checkValidity();
86
113
  }
87
- disconnectedCallback() {
88
- var _a;
89
- super.disconnectedCallback();
90
- (_a = __privateGet(this, _internals).form) == null ? void 0 : _a.removeEventListener("reset", this._handleFormReset);
114
+ formResetCallback() {
115
+ this.value = void 0;
91
116
  }
92
- __handleValidityChange() {
93
- __privateGet(this, _internals).setValidity(
94
- {
95
- badInput: false,
96
- customError: this.invalid,
97
- patternMismatch: false,
98
- rangeOverflow: false,
99
- rangeUnderflow: false,
100
- stepMismatch: false,
101
- tooLong: false,
102
- tooShort: false,
103
- typeMismatch: false,
104
- valueMissing: false,
105
- valid: !this.invalid
106
- },
107
- this.validationMessage || "Error message"
108
- );
117
+ formAssociatedCallback(form) {
118
+ form.addEventListener("submit", this._handleFormSubmit.bind(this));
109
119
  }
110
- __handleValueChange() {
111
- __privateGet(this, _internals).setFormValue(this.value);
120
+ _handleFormSubmit(e) {
121
+ this.checkValidity();
122
+ if (!this.validity.valid)
123
+ e.preventDefault();
112
124
  }
113
125
  };
114
126
  _internals = new WeakMap();
115
127
  GdsFormControlElement.formAssociated = true;
128
+ __decorateClass([
129
+ property({ attribute: false })
130
+ ], GdsFormControlElement.prototype, "validator", 2);
131
+ __decorateClass([
132
+ property({ type: Boolean })
133
+ ], GdsFormControlElement.prototype, "required", 2);
116
134
  __decorateClass([
117
135
  property({
118
136
  type: Boolean,
@@ -123,16 +141,16 @@ __decorateClass([
123
141
  toAttribute: (value) => value == null ? void 0 : value.toString()
124
142
  }
125
143
  })
126
- ], GdsFormControlElement.prototype, "invalid", 2);
144
+ ], GdsFormControlElement.prototype, "invalid", 1);
145
+ __decorateClass([
146
+ property()
147
+ ], GdsFormControlElement.prototype, "label", 2);
127
148
  __decorateClass([
128
149
  property()
129
150
  ], GdsFormControlElement.prototype, "value", 2);
130
151
  __decorateClass([
131
152
  property({ reflect: true })
132
153
  ], GdsFormControlElement.prototype, "name", 2);
133
- __decorateClass([
134
- watch("invalid")
135
- ], GdsFormControlElement.prototype, "__handleValidityChange", 1);
136
154
  __decorateClass([
137
155
  watch("value")
138
156
  ], GdsFormControlElement.prototype, "__handleValueChange", 1);
@@ -1,15 +1,15 @@
1
- import {
2
- GdsContainer
3
- } from "./chunk.GA7DIQNG.js";
4
1
  import {
5
2
  card_style_css_default
6
3
  } from "./chunk.3ULLOORV.js";
4
+ import {
5
+ GdsContainer
6
+ } from "./chunk.EONTEKQO.js";
7
7
  import {
8
8
  styleExpressionProperty
9
9
  } from "./chunk.ADPMTWTS.js";
10
10
  import {
11
11
  tokens
12
- } from "./chunk.EHAQQKN7.js";
12
+ } from "./chunk.PMHM3R2E.js";
13
13
  import {
14
14
  gdsCustomElement,
15
15
  html
File without changes
@@ -1,9 +1,12 @@
1
+ import {
2
+ divider_style_css_default
3
+ } from "./chunk.VS5JKIZQ.js";
1
4
  import {
2
5
  styleExpressionProperty
3
6
  } from "./chunk.ADPMTWTS.js";
4
7
  import {
5
8
  tokens
6
- } from "./chunk.EHAQQKN7.js";
9
+ } from "./chunk.PMHM3R2E.js";
7
10
  import {
8
11
  GdsElement
9
12
  } from "./chunk.ZQ4D5K7J.js";
@@ -11,9 +14,6 @@ import {
11
14
  gdsCustomElement,
12
15
  html
13
16
  } from "./chunk.VOYMQ322.js";
14
- import {
15
- divider_style_css_default
16
- } from "./chunk.VS5JKIZQ.js";
17
17
  import {
18
18
  __decorateClass
19
19
  } from "./chunk.5VURDMKE.js";
File without changes
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  GdsFormControlElement
3
- } from "./chunk.MZSK66DN.js";
3
+ } from "./chunk.2BMJPIND.js";
4
4
  import {
5
5
  observeLightDOM
6
6
  } from "./chunk.WM7HBMMV.js";
@@ -253,9 +253,14 @@ var GdsDropdown = class extends GdsFormControlElement {
253
253
  </gds-listbox>
254
254
  </gds-popover>
255
255
 
256
- <span class="form-info"><slot name="message"></slot></span>
256
+ <span class="form-info"
257
+ ><slot name="message">${this.validationMessage}</slot></span
258
+ >
257
259
  `;
258
260
  }
261
+ _getValidityAnchor() {
262
+ return this._elTriggerBtn;
263
+ }
259
264
  _handleLightDOMChange() {
260
265
  var _a, _b;
261
266
  this.requestUpdate();
@@ -0,0 +1,336 @@
1
+ import {
2
+ GdsElement
3
+ } from "./chunk.ZQ4D5K7J.js";
4
+ import {
5
+ gdsCustomElement,
6
+ html
7
+ } from "./chunk.VOYMQ322.js";
8
+ import {
9
+ __decorateClass,
10
+ __privateAdd,
11
+ __privateGet,
12
+ __privateMethod,
13
+ __privateSet
14
+ } from "./chunk.5VURDMKE.js";
15
+
16
+ // libs/core/src/components/coachmark/coachmark.ts
17
+ import { property, state } from "lit/decorators.js";
18
+ import {
19
+ computePosition,
20
+ detectOverflow,
21
+ arrow,
22
+ shift,
23
+ offset,
24
+ hide,
25
+ flip,
26
+ autoUpdate
27
+ } from "@floating-ui/dom";
28
+ import { ref, createRef } from "lit/directives/ref.js";
29
+
30
+ // libs/core/src/components/coachmark/coachmark.styles.ts
31
+ import { css } from "lit";
32
+ var style = css`
33
+ .gds-coachmark {
34
+ visibility: hidden;
35
+ position: absolute;
36
+ z-index: 1060;
37
+ box-sizing: border-box;
38
+ padding: 1rem;
39
+ width: 20rem;
40
+ border-radius: 0.25rem;
41
+ background-color: #222;
42
+ color: #fff;
43
+ opacity: 0;
44
+ transition: opacity 0.3s;
45
+ }
46
+
47
+ #gds-arrow {
48
+ box-sizing: border-box;
49
+ z-index: -1;
50
+ position: absolute;
51
+ height: 1rem;
52
+ width: 1rem;
53
+ background-color: #222;
54
+ transform: rotate(45deg);
55
+ }
56
+
57
+ .arrow-top,
58
+ .arrow-top-start,
59
+ .arrow-top-end {
60
+ bottom: -0.5rem;
61
+ }
62
+
63
+ .arrow-bottom,
64
+ .arrow-bottom-start,
65
+ .arrow-bottom-end {
66
+ top: -0.5rem;
67
+ }
68
+
69
+ .arrow-left,
70
+ .arrow-left-start,
71
+ .arrow-left-end {
72
+ right: -0.5rem;
73
+ }
74
+
75
+ .arrow-right,
76
+ .arrow-right-start,
77
+ .arrow-right-end {
78
+ left: -0.5rem;
79
+ }
80
+ `;
81
+ var coachmark_styles_default = style;
82
+
83
+ // libs/core/src/components/coachmark/coachmark.ts
84
+ import { when } from "lit/directives/when.js";
85
+ var _cardRef, _arrowRef, _targetedElement, _autoUpdateCleanupFn, _closeCoachMark, closeCoachMark_fn, _findTarget, findTarget_fn, _checkBoundingRect, checkBoundingRect_fn, _checkOverlap, checkOverlap_fn, _isElementOutsideView, isElementOutsideView_fn, _computeTooltipPosition, computeTooltipPosition_fn, _shouldTooltipBeVisible, shouldTooltipBeVisible_fn, _updateCoachmarks, updateCoachmarks_fn;
86
+ var GdsCoachmark = class extends GdsElement {
87
+ constructor() {
88
+ super(...arguments);
89
+ __privateAdd(this, _closeCoachMark);
90
+ __privateAdd(this, _findTarget);
91
+ __privateAdd(this, _checkBoundingRect);
92
+ __privateAdd(this, _checkOverlap);
93
+ __privateAdd(this, _isElementOutsideView);
94
+ __privateAdd(this, _computeTooltipPosition);
95
+ __privateAdd(this, _shouldTooltipBeVisible);
96
+ __privateAdd(this, _updateCoachmarks);
97
+ __privateAdd(this, _cardRef, createRef());
98
+ __privateAdd(this, _arrowRef, createRef());
99
+ __privateAdd(this, _targetedElement, void 0);
100
+ __privateAdd(this, _autoUpdateCleanupFn, void 0);
101
+ this._isVisible = false;
102
+ this._preventClose = false;
103
+ this.placement = "bottom";
104
+ this.overlappedBy = [];
105
+ this.target = [];
106
+ }
107
+ connectedCallback() {
108
+ super.connectedCallback();
109
+ document.addEventListener("click", () => {
110
+ setTimeout(() => {
111
+ __privateMethod(this, _updateCoachmarks, updateCoachmarks_fn).call(this);
112
+ __privateMethod(this, _closeCoachMark, closeCoachMark_fn).call(this);
113
+ }, 400);
114
+ });
115
+ document.addEventListener("keydown", (event) => {
116
+ if (event.key === "Escape" && this._isVisible) {
117
+ __privateMethod(this, _closeCoachMark, closeCoachMark_fn).call(this);
118
+ }
119
+ });
120
+ }
121
+ disconnectedCallback() {
122
+ super.disconnectedCallback();
123
+ document.removeEventListener("click", __privateMethod(this, _closeCoachMark, closeCoachMark_fn));
124
+ document.removeEventListener("keydown", (event) => {
125
+ if (event.key === "Escape" && this._isVisible) {
126
+ __privateMethod(this, _closeCoachMark, closeCoachMark_fn).call(this);
127
+ }
128
+ });
129
+ }
130
+ firstUpdated() {
131
+ if (this.target.length > 0) {
132
+ __privateSet(this, _targetedElement, __privateMethod(this, _findTarget, findTarget_fn).call(this, this.target));
133
+ __privateMethod(this, _updateCoachmarks, updateCoachmarks_fn).call(this);
134
+ }
135
+ }
136
+ setPreventClose(preventClose) {
137
+ this._preventClose = preventClose;
138
+ }
139
+ render() {
140
+ return html`${when(
141
+ this.target.length > 0,
142
+ () => html`
143
+ <div
144
+ role="dialog"
145
+ class="gds-coachmark"
146
+ aria-label="Coachmark"
147
+ ${ref(__privateGet(this, _cardRef))}
148
+ >
149
+ <slot></slot>
150
+ <div id="gds-arrow" ${ref(__privateGet(this, _arrowRef))}></div>
151
+ </div>
152
+ `,
153
+ () => html``
154
+ )}`;
155
+ }
156
+ };
157
+ _cardRef = new WeakMap();
158
+ _arrowRef = new WeakMap();
159
+ _targetedElement = new WeakMap();
160
+ _autoUpdateCleanupFn = new WeakMap();
161
+ _closeCoachMark = new WeakSet();
162
+ closeCoachMark_fn = function() {
163
+ var _a, _b;
164
+ if (!this._isVisible)
165
+ return;
166
+ this._isVisible = false;
167
+ (_a = __privateGet(this, _cardRef).value) == null ? void 0 : _a.remove();
168
+ (_b = __privateGet(this, _autoUpdateCleanupFn)) == null ? void 0 : _b.call(this);
169
+ window.dispatchEvent(new CustomEvent("tooltipClosed"));
170
+ };
171
+ _findTarget = new WeakSet();
172
+ findTarget_fn = function(selectors) {
173
+ let shadow = false;
174
+ let el = void 0;
175
+ for (const selector of selectors) {
176
+ if (selector === "shadowRoot") {
177
+ shadow = true;
178
+ continue;
179
+ }
180
+ if (!el) {
181
+ el = document.querySelector(selector);
182
+ } else if (shadow && el.shadowRoot) {
183
+ el = el.shadowRoot.querySelector(selector);
184
+ shadow = false;
185
+ } else {
186
+ el = el.querySelector(selector);
187
+ }
188
+ }
189
+ return el;
190
+ };
191
+ _checkBoundingRect = new WeakSet();
192
+ checkBoundingRect_fn = function(element, overlappedElement) {
193
+ if (element == overlappedElement)
194
+ return;
195
+ const elementRect = element.getBoundingClientRect();
196
+ const overlappedElementRect = overlappedElement.getBoundingClientRect();
197
+ return elementRect.top < overlappedElementRect.bottom && elementRect.bottom > overlappedElementRect.top && elementRect.left < overlappedElementRect.right && elementRect.right > overlappedElementRect.left;
198
+ };
199
+ _checkOverlap = new WeakSet();
200
+ checkOverlap_fn = function(selectors) {
201
+ if (!selectors)
202
+ return false;
203
+ for (const selector of selectors) {
204
+ const el = document.querySelector(selector);
205
+ if (!el || getComputedStyle(el).visibility === "hidden")
206
+ continue;
207
+ if (__privateMethod(this, _checkBoundingRect, checkBoundingRect_fn).call(this, __privateGet(this, _targetedElement), el)) {
208
+ return true;
209
+ }
210
+ }
211
+ return false;
212
+ };
213
+ _isElementOutsideView = new WeakSet();
214
+ isElementOutsideView_fn = function(element) {
215
+ const elementRect = element.getBoundingClientRect();
216
+ const windowHeight = window.innerHeight || document.documentElement.clientHeight;
217
+ const windowWidth = window.innerWidth || document.documentElement.clientWidth;
218
+ return elementRect.top + elementRect.height < 0 || elementRect.top > windowHeight || elementRect.left + elementRect.width < 0 || elementRect.left > windowWidth;
219
+ };
220
+ _computeTooltipPosition = new WeakSet();
221
+ computeTooltipPosition_fn = async function(targetedEl, componentEl, arrowEl) {
222
+ return computePosition(targetedEl, componentEl, {
223
+ placement: this.placement,
224
+ middleware: [
225
+ offset(() => ({
226
+ mainAxis: 16,
227
+ alignmentAxis: 16
228
+ })),
229
+ {
230
+ name: "detectOverflow",
231
+ async fn(positionState) {
232
+ const overflow = await detectOverflow(positionState, {
233
+ boundary: document.querySelector("main"),
234
+ rootBoundary: "document",
235
+ altBoundary: true,
236
+ padding: {
237
+ top: 167,
238
+ left: 20
239
+ }
240
+ });
241
+ return {
242
+ data: overflow
243
+ };
244
+ }
245
+ },
246
+ shift({ padding: 16 }),
247
+ flip(),
248
+ hide(),
249
+ arrow({
250
+ padding: 16,
251
+ element: arrowEl
252
+ })
253
+ ]
254
+ });
255
+ };
256
+ _shouldTooltipBeVisible = new WeakSet();
257
+ shouldTooltipBeVisible_fn = function() {
258
+ if (!__privateGet(this, _targetedElement))
259
+ return false;
260
+ const isOutOfBound = __privateMethod(this, _isElementOutsideView, isElementOutsideView_fn).call(this, __privateGet(this, _targetedElement));
261
+ const isVisible = __privateGet(this, _targetedElement).checkVisibility();
262
+ const isOverlapping = this.overlappedBy.length === 0 ? false : __privateMethod(this, _checkOverlap, checkOverlap_fn).call(this, this.overlappedBy);
263
+ return !isOverlapping && !isOutOfBound && isVisible && window.innerWidth > 580;
264
+ };
265
+ _updateCoachmarks = new WeakSet();
266
+ updateCoachmarks_fn = async function() {
267
+ const targetEl = __privateGet(this, _targetedElement);
268
+ const componentEl = __privateGet(this, _cardRef).value;
269
+ const arrowEl = __privateGet(this, _arrowRef).value;
270
+ if (!targetEl || !componentEl || !arrowEl)
271
+ return;
272
+ try {
273
+ __privateSet(this, _autoUpdateCleanupFn, autoUpdate(targetEl, componentEl, () => {
274
+ __privateMethod(this, _computeTooltipPosition, computeTooltipPosition_fn).call(this, targetEl, componentEl, arrowEl).then(
275
+ ({ x, y, middlewareData, placement }) => {
276
+ if (__privateMethod(this, _shouldTooltipBeVisible, shouldTooltipBeVisible_fn).call(this)) {
277
+ this._isVisible = true;
278
+ Object.assign(componentEl.style, {
279
+ visibility: "visible",
280
+ opacity: 1,
281
+ left: `${x}px`,
282
+ top: `${y}px`
283
+ });
284
+ if (middlewareData.arrow) {
285
+ const { x: x2, y: y2 } = middlewareData.arrow;
286
+ arrowEl.removeAttribute("class");
287
+ arrowEl.classList.add("arrow-" + placement);
288
+ Object.assign(arrowEl.style, {
289
+ left: x2 != null ? `${x2}px` : "",
290
+ top: y2 != null ? `${y2}px` : ""
291
+ });
292
+ }
293
+ } else {
294
+ this._isVisible = false;
295
+ Object.assign(componentEl.style, {
296
+ visibility: "hidden",
297
+ opacity: 0
298
+ });
299
+ }
300
+ }
301
+ );
302
+ }));
303
+ } catch (error) {
304
+ console.warn("failed to render tooltips");
305
+ }
306
+ };
307
+ GdsCoachmark.styles = coachmark_styles_default;
308
+ /**
309
+ * @internal
310
+ */
311
+ GdsCoachmark.shadowRootOptions = {
312
+ mode: "open",
313
+ delegatesFocus: true
314
+ };
315
+ __decorateClass([
316
+ state()
317
+ ], GdsCoachmark.prototype, "_isVisible", 2);
318
+ __decorateClass([
319
+ state()
320
+ ], GdsCoachmark.prototype, "_preventClose", 2);
321
+ __decorateClass([
322
+ property()
323
+ ], GdsCoachmark.prototype, "placement", 2);
324
+ __decorateClass([
325
+ property({ attribute: false })
326
+ ], GdsCoachmark.prototype, "overlappedBy", 2);
327
+ __decorateClass([
328
+ property({ attribute: false })
329
+ ], GdsCoachmark.prototype, "target", 2);
330
+ GdsCoachmark = __decorateClass([
331
+ gdsCustomElement("gds-coachmark")
332
+ ], GdsCoachmark);
333
+
334
+ export {
335
+ GdsCoachmark
336
+ };
@@ -6,7 +6,7 @@ import {
6
6
  } from "./chunk.ADPMTWTS.js";
7
7
  import {
8
8
  tokens
9
- } from "./chunk.EHAQQKN7.js";
9
+ } from "./chunk.PMHM3R2E.js";
10
10
  import {
11
11
  GdsElement
12
12
  } from "./chunk.ZQ4D5K7J.js";
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk.KBYQYDL3.js";
4
4
  import {
5
5
  tokens
6
- } from "./chunk.EHAQQKN7.js";
6
+ } from "./chunk.PMHM3R2E.js";
7
7
  import {
8
8
  GdsElement
9
9
  } from "./chunk.ZQ4D5K7J.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  tokens
3
- } from "./chunk.EHAQQKN7.js";
3
+ } from "./chunk.PMHM3R2E.js";
4
4
  import {
5
5
  gdsCustomElement
6
6
  } from "./chunk.VOYMQ322.js";
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  GdsFormControlElement
3
- } from "./chunk.MZSK66DN.js";
3
+ } from "./chunk.2BMJPIND.js";
4
4
  import {
5
5
  constrainSlots
6
6
  } from "./chunk.KBYQYDL3.js";
7
+ import {
8
+ tokens
9
+ } from "./chunk.PMHM3R2E.js";
7
10
  import {
8
11
  TransitionalStyles
9
12
  } from "./chunk.UZLOEUQK.js";
10
- import {
11
- tokens
12
- } from "./chunk.EHAQQKN7.js";
13
13
  import {
14
14
  gdsCustomElement,
15
15
  html
@@ -470,6 +470,9 @@ var GdsButton = class extends GdsFormControlElement {
470
470
  </${tag}>
471
471
  `;
472
472
  }
473
+ _getValidityAnchor() {
474
+ return this._button;
475
+ }
473
476
  };
474
477
  _isIconButton = new WeakMap();
475
478
  _isLink = new WeakSet();
@@ -523,6 +526,9 @@ __decorateClass([
523
526
  __decorateClass([
524
527
  query("slot:not([name])")
525
528
  ], GdsButton.prototype, "_mainSlot", 2);
529
+ __decorateClass([
530
+ query(".button")
531
+ ], GdsButton.prototype, "_button", 2);
526
532
  GdsButton = __decorateClass([
527
533
  gdsCustomElement("gds-button")
528
534
  ], GdsButton);
@@ -1,21 +1,21 @@
1
1
  import {
2
2
  GdsSegment
3
- } from "./chunk.NPXN7ELA.js";
3
+ } from "./chunk.TAUCOID4.js";
4
4
  import {
5
5
  resizeObserver
6
6
  } from "./chunk.VHN4JEZC.js";
7
+ import {
8
+ tokens
9
+ } from "./chunk.PMHM3R2E.js";
7
10
  import {
8
11
  TransitionalStyles
9
12
  } from "./chunk.UZLOEUQK.js";
10
13
  import {
11
- tokens
12
- } from "./chunk.EHAQQKN7.js";
14
+ watch
15
+ } from "./chunk.2WO4NHJ2.js";
13
16
  import {
14
17
  GdsElement
15
18
  } from "./chunk.ZQ4D5K7J.js";
16
- import {
17
- watch
18
- } from "./chunk.2WO4NHJ2.js";
19
19
  import {
20
20
  gdsCustomElement,
21
21
  html
@@ -6,7 +6,7 @@ import {
6
6
  } from "./chunk.ADPMTWTS.js";
7
7
  import {
8
8
  tokens
9
- } from "./chunk.EHAQQKN7.js";
9
+ } from "./chunk.PMHM3R2E.js";
10
10
  import {
11
11
  GdsElement
12
12
  } from "./chunk.ZQ4D5K7J.js";