@sebgroup/green-core 1.31.0 → 1.32.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 (83) hide show
  1. package/chunks/{chunk.P4WYUSGN.js → chunk.2HUICVEB.js} +2 -2
  2. package/chunks/{chunk.CMBWSAV5.js → chunk.2YZSLAXQ.js} +1 -1
  3. package/chunks/{chunk.I2ZBV4TU.js → chunk.3NWU65G2.js} +8 -2
  4. package/chunks/{chunk.FI7FECDT.js → chunk.432YVDHB.js} +1 -1
  5. package/chunks/{chunk.C3DZ5TYR.js → chunk.BEYBLGU3.js} +2 -2
  6. package/chunks/chunk.BTI3F6RY.js +0 -0
  7. package/chunks/{chunk.N6P4NYWB.js → chunk.CF2FHRNR.js} +1 -1
  8. package/chunks/{chunk.GA7DIQNG.js → chunk.CIWHLTEC.js} +1 -1
  9. package/chunks/chunk.DCVDALVX.js +0 -0
  10. package/chunks/{chunk.ZBJOM5ED.js → chunk.DH47VYYQ.js} +1 -1
  11. package/chunks/{chunk.JG4R6KQ7.js → chunk.KJKUEZ33.js} +4 -1
  12. package/chunks/{chunk.YTLGGBXL.js → chunk.MR6N3VAU.js} +1 -1
  13. package/chunks/{chunk.C3SO7KTM.js → chunk.QVRZK3CQ.js} +7 -2
  14. package/chunks/{chunk.NPXN7ELA.js → chunk.RALLT724.js} +1 -1
  15. package/chunks/{chunk.Y7ZUVKRP.js → chunk.SIAKY7DM.js} +4 -4
  16. package/chunks/chunk.UNXDEINN.js +86 -0
  17. package/chunks/{chunk.WIA7QHCX.js → chunk.UOT5KPZH.js} +7 -2
  18. package/chunks/chunk.US5K5OGQ.js +0 -0
  19. package/chunks/chunk.VOYMQ322.js +1 -1
  20. package/chunks/{chunk.QVB7U5PX.js → chunk.X32AG3RQ.js} +1 -1
  21. package/chunks/{chunk.EHAQQKN7.js → chunk.Y4GPJIXU.js} +5 -5
  22. package/chunks/{chunk.6VYOPBWL.js → chunk.YDZD6ZMG.js} +1 -1
  23. package/chunks/chunk.YL55SGZC.js +0 -0
  24. package/chunks/{chunk.H2DROYO6.js → chunk.YRDSZC4U.js} +1 -1
  25. package/chunks/{chunk.MZSK66DN.js → chunk.YT5MTXP5.js} +59 -41
  26. package/components/button/button.d.ts +3 -1
  27. package/components/button/button.js +4 -4
  28. package/components/button/index.js +4 -4
  29. package/components/content/divider/divider.js +2 -2
  30. package/components/content/divider/index.js +2 -2
  31. package/components/content/spacer/index.js +2 -2
  32. package/components/content/spacer/spacer.js +2 -2
  33. package/components/content/text/index.js +2 -2
  34. package/components/content/text/text.js +2 -2
  35. package/components/datepicker/datepicker.d.ts +2 -1
  36. package/components/datepicker/datepicker.js +6 -6
  37. package/components/datepicker/index.js +6 -6
  38. package/components/dropdown/dropdown.d.ts +2 -1
  39. package/components/dropdown/dropdown.js +2 -2
  40. package/components/dropdown/index.js +2 -2
  41. package/components/filter-chips/filter-chip/filter-chip.js +4 -4
  42. package/components/filter-chips/filter-chip/index.js +4 -4
  43. package/components/filter-chips/filter-chips.d.ts +2 -1
  44. package/components/filter-chips/filter-chips.js +5 -5
  45. package/components/filter-chips/index.js +5 -5
  46. package/components/{form-control.d.ts → form/form-control.d.ts} +20 -8
  47. package/components/form/form-control.js +13 -0
  48. package/components/form/index.d.ts +1 -0
  49. package/components/form/index.js +28 -0
  50. package/components/form/summary/index.d.ts +1 -0
  51. package/components/form/summary/index.js +27 -0
  52. package/components/form/summary/summary.d.ts +13 -0
  53. package/components/form/summary/summary.js +26 -0
  54. package/components/icon/icons/index.js +195 -195
  55. package/components/index.d.ts +1 -0
  56. package/components/index.js +38 -29
  57. package/components/layout/card/card.js +4 -4
  58. package/components/layout/card/index.js +5 -4
  59. package/components/layout/container/container.js +2 -2
  60. package/components/layout/container/index.js +2 -2
  61. package/components/layout/flex/flex.js +4 -4
  62. package/components/layout/flex/index.js +5 -4
  63. package/components/layout/grid/grid.js +2 -2
  64. package/components/layout/grid/index.js +2 -2
  65. package/components/media/img/img.js +2 -2
  66. package/components/media/img/index.js +2 -2
  67. package/components/media/video/index.js +2 -2
  68. package/components/media/video/video.js +2 -2
  69. package/components/menu-button/index.js +2 -2
  70. package/components/menu-button/menu-button.js +2 -2
  71. package/components/segmented-control/index.js +3 -3
  72. package/components/segmented-control/segment/index.js +2 -2
  73. package/components/segmented-control/segment/segment.js +2 -2
  74. package/components/segmented-control/segmented-control.js +3 -3
  75. package/generated/locales/sv.d.ts +3 -0
  76. package/index.js +38 -29
  77. package/localization.js +42 -37
  78. package/package.json +1 -1
  79. package/primitives/ripple/index.js +2 -2
  80. package/primitives/ripple/ripple.js +2 -2
  81. package/setup-jest.js +3 -0
  82. package/components/form-control.js +0 -13
  83. /package/chunks/{chunk.65745UGT.js → chunk.A23HHQDO.js} +0 -0
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  GdsSegment
3
- } from "./chunk.NPXN7ELA.js";
3
+ } from "./chunk.RALLT724.js";
4
4
  import {
5
5
  resizeObserver
6
6
  } from "./chunk.VHN4JEZC.js";
@@ -9,7 +9,7 @@ import {
9
9
  } from "./chunk.UZLOEUQK.js";
10
10
  import {
11
11
  tokens
12
- } from "./chunk.EHAQQKN7.js";
12
+ } from "./chunk.Y4GPJIXU.js";
13
13
  import {
14
14
  GdsElement
15
15
  } from "./chunk.ZQ4D5K7J.js";
@@ -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.Y4GPJIXU.js";
10
10
  import {
11
11
  GdsElement
12
12
  } from "./chunk.ZQ4D5K7J.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  GdsFormControlElement
3
- } from "./chunk.MZSK66DN.js";
3
+ } from "./chunk.YT5MTXP5.js";
4
4
  import {
5
5
  constrainSlots
6
6
  } from "./chunk.KBYQYDL3.js";
@@ -9,7 +9,7 @@ import {
9
9
  } from "./chunk.UZLOEUQK.js";
10
10
  import {
11
11
  tokens
12
- } from "./chunk.EHAQQKN7.js";
12
+ } from "./chunk.Y4GPJIXU.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);
@@ -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.Y4GPJIXU.js";
10
10
  import {
11
11
  GdsElement
12
12
  } from "./chunk.ZQ4D5K7J.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  GdsContainer
3
- } from "./chunk.GA7DIQNG.js";
3
+ } from "./chunk.CIWHLTEC.js";
4
4
  import {
5
5
  card_style_css_default
6
6
  } from "./chunk.3ULLOORV.js";
@@ -9,7 +9,7 @@ import {
9
9
  } from "./chunk.ADPMTWTS.js";
10
10
  import {
11
11
  tokens
12
- } from "./chunk.EHAQQKN7.js";
12
+ } from "./chunk.Y4GPJIXU.js";
13
13
  import {
14
14
  gdsCustomElement,
15
15
  html
File without changes
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk.ADPMTWTS.js";
4
4
  import {
5
5
  tokens
6
- } from "./chunk.EHAQQKN7.js";
6
+ } from "./chunk.Y4GPJIXU.js";
7
7
  import {
8
8
  GdsElement
9
9
  } from "./chunk.ZQ4D5K7J.js";
@@ -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.Y4GPJIXU.js";
10
10
  import {
11
11
  GdsElement
12
12
  } from "./chunk.ZQ4D5K7J.js";
File without changes
@@ -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.Y4GPJIXU.js";
10
10
  import {
11
11
  GdsElement
12
12
  } from "./chunk.ZQ4D5K7J.js";
@@ -6,7 +6,7 @@ import {
6
6
  } from "./chunk.C3ECHGX7.js";
7
7
  import {
8
8
  GdsFormControlElement
9
- } from "./chunk.MZSK66DN.js";
9
+ } from "./chunk.YT5MTXP5.js";
10
10
  import {
11
11
  watch
12
12
  } from "./chunk.2WO4NHJ2.js";
@@ -121,6 +121,9 @@ var GdsFilterChips = class extends GdsFormControlElement {
121
121
  ></slot>
122
122
  </div>`;
123
123
  }
124
+ _getValidityAnchor() {
125
+ return this;
126
+ }
124
127
  _handleResize() {
125
128
  if (!this.rowCollapse)
126
129
  return;
@@ -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.Y4GPJIXU.js";
10
10
  import {
11
11
  GdsElement
12
12
  } from "./chunk.ZQ4D5K7J.js";
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk.C3ECHGX7.js";
5
5
  import {
6
6
  GdsFormControlElement
7
- } from "./chunk.MZSK66DN.js";
7
+ } from "./chunk.YT5MTXP5.js";
8
8
  import {
9
9
  TransitionalStyles
10
10
  } from "./chunk.UZLOEUQK.js";
@@ -327,7 +327,9 @@ var GdsDatepicker = class extends GdsFormControlElement {
327
327
  </button>
328
328
  </div>
329
329
 
330
- <div class="form-info"><slot name="message"></slot></div>
330
+ <div class="form-info">
331
+ <slot name="message">${this.validationMessage}</slot>
332
+ </div>
331
333
 
332
334
  <gds-popover
333
335
  .triggerRef=${this._elTrigger}
@@ -439,6 +441,9 @@ var GdsDatepicker = class extends GdsFormControlElement {
439
441
  </div>
440
442
  </gds-popover> `;
441
443
  }
444
+ _getValidityAnchor() {
445
+ return this._elSpinners[0];
446
+ }
442
447
  _handleValueChange() {
443
448
  if (!this.value) {
444
449
  __privateSet(this, _spinnerState, {
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk.UZLOEUQK.js";
4
4
  import {
5
5
  tokens
6
- } from "./chunk.EHAQQKN7.js";
6
+ } from "./chunk.Y4GPJIXU.js";
7
7
  import {
8
8
  GdsElement
9
9
  } from "./chunk.ZQ4D5K7J.js";
@@ -1,15 +1,15 @@
1
+ import {
2
+ GdsContainer
3
+ } from "./chunk.CIWHLTEC.js";
1
4
  import {
2
5
  flex_style_css_default
3
6
  } from "./chunk.54252E4T.js";
4
- import {
5
- GdsContainer
6
- } from "./chunk.GA7DIQNG.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.Y4GPJIXU.js";
13
13
  import {
14
14
  gdsCustomElement,
15
15
  html
@@ -0,0 +1,86 @@
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
+ } from "./chunk.5VURDMKE.js";
11
+
12
+ // libs/core/src/components/form/summary/summary.ts
13
+ import { when } from "lit/directives/when.js";
14
+ import { msg, str } from "@lit/localize";
15
+ import { css } from "lit";
16
+ var GdsFormSummary = class extends GdsElement {
17
+ connectedCallback() {
18
+ super.connectedCallback();
19
+ this.form = this.closest("form") || void 0;
20
+ if (this.form) {
21
+ this.formObserver = new MutationObserver(() => {
22
+ this.requestUpdate();
23
+ });
24
+ this.formObserver.observe(this.form, { attributes: true, subtree: true });
25
+ }
26
+ }
27
+ disconnectedCallback() {
28
+ var _a;
29
+ super.disconnectedCallback();
30
+ (_a = this.formObserver) == null ? void 0 : _a.disconnect();
31
+ }
32
+ render() {
33
+ var _a;
34
+ const formControlElements = Array.from(
35
+ ((_a = this.form) == null ? void 0 : _a.elements) || []
36
+ );
37
+ const errors = formControlElements.filter((e) => e.invalid);
38
+ return when(
39
+ errors.length > 0,
40
+ () => html`<gds-card border="4xs/error-text" radius="2xs" padding="m" color="error-text">
41
+ <gds-flex gap="s">
42
+ <gds-container>
43
+ <gds-icon-triangle-exclamation></gds-icon-triangle-exclamation>
44
+ </gds-container>
45
+ <gds-container>
46
+ ${msg(
47
+ str`There are ${errors.length} errors to correct before you can continue:`
48
+ )}
49
+ <ul>
50
+ ${errors.map(
51
+ (el) => html`<li><a href @click=${(e) => {
52
+ e.preventDefault();
53
+ el.focus();
54
+ }}>${el.label}</li>`
55
+ )}
56
+ </ul>
57
+ </gds-container>
58
+ <gds-flex>
59
+ </gds-card>`
60
+ );
61
+ }
62
+ };
63
+ GdsFormSummary.styles = css`
64
+ :host {
65
+ font-weight: 500;
66
+ }
67
+ ul {
68
+ list-style-type: none;
69
+ margin: 1rem 0 0;
70
+ padding: 0;
71
+ }
72
+ li {
73
+ margin: 0.5rem 0;
74
+ }
75
+ a {
76
+ color: var(--gds-sys-color-primary-text);
77
+ font-weight: 500;
78
+ }
79
+ `;
80
+ GdsFormSummary = __decorateClass([
81
+ gdsCustomElement("gds-form-summary")
82
+ ], GdsFormSummary);
83
+
84
+ export {
85
+ GdsFormSummary
86
+ };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  GdsFormControlElement
3
- } from "./chunk.MZSK66DN.js";
3
+ } from "./chunk.YT5MTXP5.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();
File without changes
@@ -1,7 +1,7 @@
1
1
  // libs/core/src/utils/helpers/custom-element-scoping.ts
2
2
  import { html as litHtml } from "lit";
3
3
  import { customElement } from "lit/decorators.js";
4
- var VER_SUFFIX = "-067182";
4
+ var VER_SUFFIX = "-3b89e7";
5
5
  var elementLookupTable = /* @__PURE__ */ new Map();
6
6
  var gdsCustomElement = (tagName) => {
7
7
  if (globalThis.GDS_DISABLE_VERSIONED_ELEMENTS) {
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk.ADPMTWTS.js";
4
4
  import {
5
5
  tokens
6
- } from "./chunk.EHAQQKN7.js";
6
+ } from "./chunk.Y4GPJIXU.js";
7
7
  import {
8
8
  GdsElement
9
9
  } from "./chunk.ZQ4D5K7J.js";
@@ -4,7 +4,7 @@ import { unsafeCSS } from "lit";
4
4
  // dist/libs/tokens/internal/pallet.css?inline
5
5
  var pallet_default = `/**
6
6
  * Do not edit directly
7
- * Generated on Fri, 12 Jul 2024 12:43:55 GMT
7
+ * Generated on Fri, 19 Jul 2024 16:10:23 GMT
8
8
  */
9
9
 
10
10
  :host {
@@ -165,7 +165,7 @@ var pallet_default = `/**
165
165
  // dist/libs/tokens/internal/theme/light.css?inline
166
166
  var light_default = `/**
167
167
  * Do not edit directly
168
- * Generated on Fri, 12 Jul 2024 12:43:55 GMT
168
+ * Generated on Fri, 19 Jul 2024 16:10:23 GMT
169
169
  */
170
170
 
171
171
  :host {
@@ -286,7 +286,7 @@ var light_default = `/**
286
286
  // dist/libs/tokens/internal/size.css?inline
287
287
  var size_default = `/**
288
288
  * Do not edit directly
289
- * Generated on Fri, 12 Jul 2024 12:43:55 GMT
289
+ * Generated on Fri, 19 Jul 2024 16:10:23 GMT
290
290
  */
291
291
 
292
292
  :host {
@@ -313,7 +313,7 @@ var size_default = `/**
313
313
  // dist/libs/tokens/internal/text.css?inline
314
314
  var text_default = `/**
315
315
  * Do not edit directly
316
- * Generated on Fri, 12 Jul 2024 12:43:55 GMT
316
+ * Generated on Fri, 19 Jul 2024 16:10:23 GMT
317
317
  */
318
318
 
319
319
  :host {
@@ -368,7 +368,7 @@ var text_default = `/**
368
368
  // dist/libs/tokens/internal/motion.css?inline
369
369
  var motion_default = `/**
370
370
  * Do not edit directly
371
- * Generated on Fri, 12 Jul 2024 12:43:55 GMT
371
+ * Generated on Fri, 19 Jul 2024 16:10:23 GMT
372
372
  */
373
373
 
374
374
  :host {
@@ -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.Y4GPJIXU.js";
7
7
  import {
8
8
  GdsElement
9
9
  } from "./chunk.ZQ4D5K7J.js";
File without changes
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  tokens
3
- } from "./chunk.EHAQQKN7.js";
3
+ } from "./chunk.Y4GPJIXU.js";
4
4
  import {
5
5
  gdsCustomElement
6
6
  } from "./chunk.VOYMQ322.js";
@@ -8,25 +8,21 @@ 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,5 +1,5 @@
1
1
  import '../../primitives/ripple';
2
- import { GdsFormControlElement } from '../../components/form-control';
2
+ import { GdsFormControlElement } from '../form/form-control';
3
3
  /**
4
4
  * @element gds-button
5
5
  * @summary A custom button element that can display a label, lead and trail icons, and a ripple effect on click.
@@ -59,7 +59,9 @@ export declare class GdsButton<ValueT = any> extends GdsFormControlElement<Value
59
59
  */
60
60
  download?: string;
61
61
  private _mainSlot?;
62
+ private _button?;
62
63
  constructor();
63
64
  connectedCallback(): void;
64
65
  render(): import("lit").TemplateResult;
66
+ protected _getValidityAnchor(): HTMLElement;
65
67
  }
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  GdsButton
3
- } from "../../chunks/chunk.I2ZBV4TU.js";
3
+ } from "../../chunks/chunk.3NWU65G2.js";
4
4
  import "../../chunks/chunk.TX64TTBN.js";
5
- import "../../chunks/chunk.H2DROYO6.js";
6
- import "../../chunks/chunk.MZSK66DN.js";
5
+ import "../../chunks/chunk.YRDSZC4U.js";
6
+ import "../../chunks/chunk.YT5MTXP5.js";
7
7
  import "../../chunks/chunk.WM7HBMMV.js";
8
8
  import "../../chunks/chunk.KBYQYDL3.js";
9
9
  import "../../chunks/chunk.UZLOEUQK.js";
10
- import "../../chunks/chunk.EHAQQKN7.js";
10
+ import "../../chunks/chunk.Y4GPJIXU.js";
11
11
  import "../../chunks/chunk.ZQ4D5K7J.js";
12
12
  import "../../chunks/chunk.W7CV3QYI.js";
13
13
  import "../../chunks/chunk.2WO4NHJ2.js";
@@ -1,14 +1,14 @@
1
1
  import "../../chunks/chunk.JGTSJ4J6.js";
2
2
  import {
3
3
  GdsButton
4
- } from "../../chunks/chunk.I2ZBV4TU.js";
4
+ } from "../../chunks/chunk.3NWU65G2.js";
5
5
  import "../../chunks/chunk.TX64TTBN.js";
6
- import "../../chunks/chunk.H2DROYO6.js";
7
- import "../../chunks/chunk.MZSK66DN.js";
6
+ import "../../chunks/chunk.YRDSZC4U.js";
7
+ import "../../chunks/chunk.YT5MTXP5.js";
8
8
  import "../../chunks/chunk.WM7HBMMV.js";
9
9
  import "../../chunks/chunk.KBYQYDL3.js";
10
10
  import "../../chunks/chunk.UZLOEUQK.js";
11
- import "../../chunks/chunk.EHAQQKN7.js";
11
+ import "../../chunks/chunk.Y4GPJIXU.js";
12
12
  import "../../chunks/chunk.ZQ4D5K7J.js";
13
13
  import "../../chunks/chunk.W7CV3QYI.js";
14
14
  import "../../chunks/chunk.2WO4NHJ2.js";
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  GdsDivider
3
- } from "../../../chunks/chunk.QVB7U5PX.js";
3
+ } from "../../../chunks/chunk.X32AG3RQ.js";
4
4
  import "../../../chunks/chunk.ADPMTWTS.js";
5
- import "../../../chunks/chunk.EHAQQKN7.js";
5
+ import "../../../chunks/chunk.Y4GPJIXU.js";
6
6
  import "../../../chunks/chunk.ZQ4D5K7J.js";
7
7
  import "../../../chunks/chunk.W7CV3QYI.js";
8
8
  import "../../../chunks/chunk.2WO4NHJ2.js";
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  GdsDivider
3
- } from "../../../chunks/chunk.QVB7U5PX.js";
3
+ } from "../../../chunks/chunk.X32AG3RQ.js";
4
4
  import "../../../chunks/chunk.ADPMTWTS.js";
5
- import "../../../chunks/chunk.EHAQQKN7.js";
5
+ import "../../../chunks/chunk.Y4GPJIXU.js";
6
6
  import "../../../chunks/chunk.ZQ4D5K7J.js";
7
7
  import "../../../chunks/chunk.W7CV3QYI.js";
8
8
  import "../../../chunks/chunk.2WO4NHJ2.js";
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  GdsSpacer
3
- } from "../../../chunks/chunk.N6P4NYWB.js";
3
+ } from "../../../chunks/chunk.CF2FHRNR.js";
4
4
  import "../../../chunks/chunk.ADPMTWTS.js";
5
- import "../../../chunks/chunk.EHAQQKN7.js";
5
+ import "../../../chunks/chunk.Y4GPJIXU.js";
6
6
  import "../../../chunks/chunk.ZQ4D5K7J.js";
7
7
  import "../../../chunks/chunk.W7CV3QYI.js";
8
8
  import "../../../chunks/chunk.2WO4NHJ2.js";