@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
@@ -0,0 +1,193 @@
1
+ import {
2
+ watch
3
+ } from "./chunk.2WO4NHJ2.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/datepicker/date-part-spinner.ts
17
+ import { LitElement } from "lit";
18
+ import { property, state } from "lit/decorators.js";
19
+ var _inputBuffer, _increment, _decrement, _handleClick, _handleFocus, _handleBlur, _handleWheel, _handleKeyDown, _focusNextSpinner, focusNextSpinner_fn, _dispatchChangeEvent, dispatchChangeEvent_fn, _formatNumber, formatNumber_fn, _clamp, clamp_fn, _clearInputBuffer, clearInputBuffer_fn;
20
+ var GdsDatePartSpinner = class extends LitElement {
21
+ constructor() {
22
+ super(...arguments);
23
+ __privateAdd(this, _focusNextSpinner);
24
+ __privateAdd(this, _dispatchChangeEvent);
25
+ __privateAdd(this, _formatNumber);
26
+ __privateAdd(this, _clamp);
27
+ __privateAdd(this, _clearInputBuffer);
28
+ this.value = 0;
29
+ this.length = 2;
30
+ this.min = 0;
31
+ this.max = Number.MAX_SAFE_INTEGER;
32
+ this.displayValue = __privateMethod(this, _formatNumber, formatNumber_fn).call(this, this.value, this.length);
33
+ __privateAdd(this, _inputBuffer, "");
34
+ __privateAdd(this, _increment, () => {
35
+ let current = parseInt(this.value.toString());
36
+ if (Number.isNaN(current))
37
+ current = this.length === 2 ? this.min : (/* @__PURE__ */ new Date()).getFullYear() - 1;
38
+ this.value = __privateMethod(this, _clamp, clamp_fn).call(this, current + 1);
39
+ __privateMethod(this, _dispatchChangeEvent, dispatchChangeEvent_fn).call(this);
40
+ });
41
+ __privateAdd(this, _decrement, () => {
42
+ let current = parseInt(this.value.toString());
43
+ if (Number.isNaN(current))
44
+ current = this.length === 2 ? this.max : (/* @__PURE__ */ new Date()).getFullYear() + 1;
45
+ this.value = __privateMethod(this, _clamp, clamp_fn).call(this, current - 1);
46
+ __privateMethod(this, _dispatchChangeEvent, dispatchChangeEvent_fn).call(this);
47
+ });
48
+ __privateAdd(this, _handleClick, (e) => {
49
+ e.stopPropagation();
50
+ e.preventDefault();
51
+ this.focus();
52
+ });
53
+ __privateAdd(this, _handleFocus, () => {
54
+ __privateMethod(this, _clearInputBuffer, clearInputBuffer_fn).call(this);
55
+ });
56
+ __privateAdd(this, _handleBlur, () => {
57
+ if (__privateGet(this, _inputBuffer) === "")
58
+ return;
59
+ __privateMethod(this, _clearInputBuffer, clearInputBuffer_fn).call(this);
60
+ this.value = __privateMethod(this, _clamp, clamp_fn).call(this, parseInt(this.value.toString()));
61
+ __privateMethod(this, _dispatchChangeEvent, dispatchChangeEvent_fn).call(this);
62
+ });
63
+ __privateAdd(this, _handleWheel, (e) => {
64
+ e.stopPropagation();
65
+ e.preventDefault();
66
+ if (e.deltaY > 0) {
67
+ __privateGet(this, _decrement).call(this);
68
+ } else {
69
+ __privateGet(this, _increment).call(this);
70
+ }
71
+ });
72
+ __privateAdd(this, _handleKeyDown, (e) => {
73
+ let handled = false;
74
+ if (e.key === "ArrowUp") {
75
+ __privateGet(this, _increment).call(this);
76
+ handled = true;
77
+ } else if (e.key === "ArrowDown") {
78
+ __privateGet(this, _decrement).call(this);
79
+ handled = true;
80
+ } else {
81
+ const key = parseInt(e.key);
82
+ if (!isNaN(key)) {
83
+ if (__privateGet(this, _inputBuffer).length < this.length) {
84
+ __privateSet(this, _inputBuffer, __privateGet(this, _inputBuffer) + key.toString());
85
+ this.value = parseInt(__privateGet(this, _inputBuffer));
86
+ }
87
+ if (__privateGet(this, _inputBuffer).length === this.length) {
88
+ this.value = __privateMethod(this, _clamp, clamp_fn).call(this, this.value);
89
+ __privateMethod(this, _clearInputBuffer, clearInputBuffer_fn).call(this);
90
+ __privateMethod(this, _focusNextSpinner, focusNextSpinner_fn).call(this);
91
+ __privateMethod(this, _dispatchChangeEvent, dispatchChangeEvent_fn).call(this);
92
+ }
93
+ handled = true;
94
+ }
95
+ }
96
+ if (handled) {
97
+ e.preventDefault();
98
+ e.stopPropagation();
99
+ }
100
+ });
101
+ }
102
+ // No need for a shadow root here
103
+ createRenderRoot() {
104
+ return this;
105
+ }
106
+ connectedCallback() {
107
+ super.connectedCallback();
108
+ this.setAttribute("role", "spinbutton");
109
+ this.setAttribute("tabindex", "0");
110
+ this.addEventListener("wheel", __privateGet(this, _handleWheel));
111
+ this.addEventListener("keydown", __privateGet(this, _handleKeyDown));
112
+ this.addEventListener("blur", __privateGet(this, _handleBlur));
113
+ this.addEventListener("focus", __privateGet(this, _handleFocus));
114
+ this.addEventListener("click", __privateGet(this, _handleClick));
115
+ this.addEventListener("mousedown", __privateGet(this, _handleClick));
116
+ }
117
+ focus(options) {
118
+ super.focus(options);
119
+ __privateGet(this, _handleFocus).call(this);
120
+ }
121
+ render() {
122
+ return html`${this.displayValue}`;
123
+ }
124
+ _refreshDisplayValue() {
125
+ this.displayValue = __privateMethod(this, _formatNumber, formatNumber_fn).call(this, this.value, this.length);
126
+ this.setAttribute("aria-valuetext", this.value.toString());
127
+ }
128
+ };
129
+ _inputBuffer = new WeakMap();
130
+ _increment = new WeakMap();
131
+ _decrement = new WeakMap();
132
+ _handleClick = new WeakMap();
133
+ _handleFocus = new WeakMap();
134
+ _handleBlur = new WeakMap();
135
+ _handleWheel = new WeakMap();
136
+ _handleKeyDown = new WeakMap();
137
+ _focusNextSpinner = new WeakSet();
138
+ focusNextSpinner_fn = function() {
139
+ let nextSpinner = this.nextElementSibling;
140
+ while (nextSpinner) {
141
+ if (nextSpinner instanceof GdsDatePartSpinner) {
142
+ nextSpinner.focus();
143
+ break;
144
+ }
145
+ nextSpinner = nextSpinner.nextElementSibling;
146
+ }
147
+ };
148
+ _dispatchChangeEvent = new WeakSet();
149
+ dispatchChangeEvent_fn = function() {
150
+ this.dispatchEvent(
151
+ new CustomEvent("change", {
152
+ detail: { value: this.value.toString() }
153
+ })
154
+ );
155
+ };
156
+ _formatNumber = new WeakSet();
157
+ formatNumber_fn = function(num, padZeros) {
158
+ return String(num).padStart(padZeros, "0");
159
+ };
160
+ _clamp = new WeakSet();
161
+ clamp_fn = function(value) {
162
+ return Math.max(this.min, Math.min(this.max, value));
163
+ };
164
+ _clearInputBuffer = new WeakSet();
165
+ clearInputBuffer_fn = function() {
166
+ __privateSet(this, _inputBuffer, "");
167
+ };
168
+ GdsDatePartSpinner.formAssociated = true;
169
+ __decorateClass([
170
+ property({ type: Number })
171
+ ], GdsDatePartSpinner.prototype, "value", 2);
172
+ __decorateClass([
173
+ property({ type: Number })
174
+ ], GdsDatePartSpinner.prototype, "length", 2);
175
+ __decorateClass([
176
+ property({ type: Number, attribute: "aria-valuemin" })
177
+ ], GdsDatePartSpinner.prototype, "min", 2);
178
+ __decorateClass([
179
+ property({ type: Number, attribute: "aria-valuemax" })
180
+ ], GdsDatePartSpinner.prototype, "max", 2);
181
+ __decorateClass([
182
+ state()
183
+ ], GdsDatePartSpinner.prototype, "displayValue", 2);
184
+ __decorateClass([
185
+ watch("value")
186
+ ], GdsDatePartSpinner.prototype, "_refreshDisplayValue", 1);
187
+ GdsDatePartSpinner = __decorateClass([
188
+ gdsCustomElement("gds-date-part-spinner")
189
+ ], GdsDatePartSpinner);
190
+
191
+ export {
192
+ GdsDatePartSpinner
193
+ };
@@ -0,0 +1,54 @@
1
+ // libs/core/src/utils/decorators/observe-light-dom.ts
2
+ function observeLightDOM(observerConfig = {
3
+ attributes: true,
4
+ childList: true,
5
+ subtree: false,
6
+ characterData: true
7
+ }) {
8
+ return (proto, _propertyKey, descriptor) => {
9
+ let observer;
10
+ const connectedCallback = proto.connectedCallback;
11
+ const disconnectedCallback = proto.disconnectedCallback;
12
+ proto.connectedCallback = function() {
13
+ connectedCallback == null ? void 0 : connectedCallback.call(this);
14
+ const callback = (_mutationList, _observer) => {
15
+ var _a;
16
+ (_a = descriptor.value) == null ? void 0 : _a.call(this);
17
+ };
18
+ observer = new MutationObserver(callback);
19
+ observer.observe(this, observerConfig);
20
+ };
21
+ proto.disconnectedCallback = function() {
22
+ disconnectedCallback == null ? void 0 : disconnectedCallback.call(this);
23
+ observer.disconnect();
24
+ };
25
+ };
26
+ }
27
+
28
+ // libs/core/src/utils/decorators/watch-media-query.ts
29
+ function watchMediaQuery(q) {
30
+ return (proto, _propertyKey, descriptor) => {
31
+ const mediaQuery = window.matchMedia(q);
32
+ const connectedCallback = proto.connectedCallback;
33
+ const disconnectedCallback = proto.disconnectedCallback;
34
+ proto.connectedCallback = function() {
35
+ var _a;
36
+ connectedCallback == null ? void 0 : connectedCallback.call(this);
37
+ const listener = (e) => {
38
+ var _a2;
39
+ (_a2 = descriptor.value) == null ? void 0 : _a2.call(this, e.matches);
40
+ };
41
+ mediaQuery.addEventListener("change", listener);
42
+ this.disconnectedCallback = function() {
43
+ disconnectedCallback == null ? void 0 : disconnectedCallback.call(this);
44
+ mediaQuery.removeEventListener("change", listener);
45
+ };
46
+ (_a = descriptor.value) == null ? void 0 : _a.call(this, mediaQuery.matches);
47
+ };
48
+ };
49
+ }
50
+
51
+ export {
52
+ observeLightDOM,
53
+ watchMediaQuery
54
+ };
@@ -0,0 +1,140 @@
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
+ watch
13
+ } from "./chunk.2WO4NHJ2.js";
14
+ import {
15
+ gdsCustomElement
16
+ } from "./chunk.VOYMQ322.js";
17
+ import {
18
+ __decorateClass,
19
+ __privateAdd,
20
+ __privateGet,
21
+ __privateMethod,
22
+ __privateSet
23
+ } from "./chunk.5VURDMKE.js";
24
+
25
+ // libs/core/src/primitives/listbox/option.ts
26
+ import { html } from "lit";
27
+ import { property, state } from "lit/decorators.js";
28
+ import { when } from "lit/directives/when.js";
29
+ import { classMap } from "lit/directives/class-map.js";
30
+ import "reflect-metadata";
31
+ var _hidden, _emitSelect, emitSelect_fn;
32
+ var GdsOption = class extends Focusable(GdsElement) {
33
+ constructor() {
34
+ super();
35
+ __privateAdd(this, _emitSelect);
36
+ __privateAdd(this, _hidden, false);
37
+ this.selected = false;
38
+ this.isPlaceholder = false;
39
+ this.addEventListener("click", __privateMethod(this, _emitSelect, emitSelect_fn));
40
+ this.addEventListener("keydown", (e) => {
41
+ if (e.key !== "Enter" && e.key !== " ")
42
+ return;
43
+ e.preventDefault();
44
+ __privateMethod(this, _emitSelect, emitSelect_fn).call(this, e);
45
+ });
46
+ }
47
+ get hidden() {
48
+ return __privateGet(this, _hidden);
49
+ }
50
+ set hidden(value) {
51
+ if (this.isPlaceholder)
52
+ return;
53
+ __privateSet(this, _hidden, value === "true" || value === true);
54
+ this.setAttribute("aria-hidden", value.toString());
55
+ }
56
+ connectedCallback() {
57
+ super.connectedCallback();
58
+ this.setAttribute("role", "option");
59
+ if (this.isPlaceholder) {
60
+ __privateSet(this, _hidden, true);
61
+ this.setAttribute("aria-hidden", "true");
62
+ }
63
+ this.updateComplete.then(
64
+ () => TransitionalStyles.instance.apply(this, "gds-option")
65
+ );
66
+ }
67
+ get parentElement() {
68
+ return super.parentElement;
69
+ }
70
+ _handlePlaceholderStatusChange() {
71
+ if (this.isPlaceholder) {
72
+ __privateSet(this, _hidden, true);
73
+ this.setAttribute("aria-hidden", "true");
74
+ } else {
75
+ __privateSet(this, _hidden, false);
76
+ this.setAttribute("aria-hidden", "false");
77
+ }
78
+ }
79
+ render() {
80
+ var _a;
81
+ const isMultiple = (_a = this.parentElement) == null ? void 0 : _a.multiple;
82
+ const checkbox = html` <span
83
+ class="checkbox ${classMap({ checked: this.selected })}"
84
+ ></span>`;
85
+ if (!isMultiple) {
86
+ if (this.selected)
87
+ this.setAttribute("highlighted", "");
88
+ else
89
+ this.removeAttribute("highlighted");
90
+ }
91
+ return html`${this._tStyles}
92
+ <div>${when(isMultiple, () => checkbox)} <slot></slot></div>`;
93
+ }
94
+ };
95
+ _hidden = new WeakMap();
96
+ _emitSelect = new WeakSet();
97
+ emitSelect_fn = function(e) {
98
+ e.stopPropagation();
99
+ this.dispatchEvent(
100
+ new CustomEvent("gds-select", {
101
+ bubbles: true,
102
+ composed: true,
103
+ detail: {
104
+ value: this.value
105
+ }
106
+ })
107
+ );
108
+ };
109
+ GdsOption.styles = option_styles_default;
110
+ __decorateClass([
111
+ property()
112
+ ], GdsOption.prototype, "value", 2);
113
+ __decorateClass([
114
+ property({
115
+ attribute: "aria-hidden",
116
+ reflect: true
117
+ })
118
+ ], GdsOption.prototype, "hidden", 1);
119
+ __decorateClass([
120
+ property({
121
+ attribute: "aria-selected",
122
+ reflect: true
123
+ })
124
+ ], GdsOption.prototype, "selected", 2);
125
+ __decorateClass([
126
+ property({ type: Boolean, reflect: true })
127
+ ], GdsOption.prototype, "isPlaceholder", 2);
128
+ __decorateClass([
129
+ state()
130
+ ], GdsOption.prototype, "_tStyles", 2);
131
+ __decorateClass([
132
+ watch("isplaceholder")
133
+ ], GdsOption.prototype, "_handlePlaceholderStatusChange", 1);
134
+ GdsOption = __decorateClass([
135
+ gdsCustomElement("gds-option")
136
+ ], GdsOption);
137
+
138
+ export {
139
+ GdsOption
140
+ };
@@ -0,0 +1,39 @@
1
+ import {
2
+ TransitionalStyles
3
+ } from "./chunk.QONSFT2N.js";
4
+ import {
5
+ GdsElement
6
+ } from "./chunk.2LQSDOD4.js";
7
+ import {
8
+ gdsCustomElement,
9
+ html
10
+ } from "./chunk.VOYMQ322.js";
11
+ import {
12
+ __decorateClass
13
+ } from "./chunk.5VURDMKE.js";
14
+
15
+ // libs/core/src/components/theme/theme.ts
16
+ import { property } from "lit/decorators.js";
17
+ var GdsTheme = class extends GdsElement {
18
+ constructor() {
19
+ super(...arguments);
20
+ this.colorScheme = "light";
21
+ }
22
+ connectedCallback() {
23
+ super.connectedCallback();
24
+ TransitionalStyles.instance.apply(this, "gds-theme");
25
+ }
26
+ render() {
27
+ return html` <slot></slot> `;
28
+ }
29
+ };
30
+ __decorateClass([
31
+ property({ reflect: true, attribute: "color-scheme" })
32
+ ], GdsTheme.prototype, "colorScheme", 2);
33
+ GdsTheme = __decorateClass([
34
+ gdsCustomElement("gds-theme")
35
+ ], GdsTheme);
36
+
37
+ export {
38
+ GdsTheme
39
+ };
File without changes
@@ -0,0 +1,139 @@
1
+ import {
2
+ GdsElement
3
+ } from "./chunk.2LQSDOD4.js";
4
+ import {
5
+ watch
6
+ } from "./chunk.2WO4NHJ2.js";
7
+ import {
8
+ __decorateClass,
9
+ __privateAdd,
10
+ __privateGet,
11
+ __privateSet
12
+ } from "./chunk.5VURDMKE.js";
13
+
14
+ // libs/core/src/components/form-control.ts
15
+ import { property } from "lit/decorators.js";
16
+ var _internals;
17
+ var GdsFormControlElement = class extends GdsElement {
18
+ constructor() {
19
+ super();
20
+ __privateAdd(this, _internals, void 0);
21
+ this.invalid = false;
22
+ 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
+ try {
31
+ __privateSet(this, _internals, this.attachInternals());
32
+ } catch (e) {
33
+ __privateSet(this, _internals, {
34
+ form: this.closest("form"),
35
+ setFormValue: (value) => {
36
+ this.value = value;
37
+ },
38
+ setValidity: (validity, validationMessage) => {
39
+ this.invalid = validity.customError;
40
+ },
41
+ validationMessage: "",
42
+ validity: {
43
+ badInput: false,
44
+ customError: false,
45
+ patternMismatch: false,
46
+ rangeOverflow: false,
47
+ rangeUnderflow: false,
48
+ stepMismatch: false,
49
+ tooLong: false,
50
+ tooShort: false,
51
+ typeMismatch: false,
52
+ valueMissing: false,
53
+ valid: true
54
+ },
55
+ willValidate: true,
56
+ checkValidity: () => true,
57
+ reportValidity: () => true
58
+ });
59
+ }
60
+ }
61
+ get form() {
62
+ return __privateGet(this, _internals).form;
63
+ }
64
+ get validity() {
65
+ return __privateGet(this, _internals).validity;
66
+ }
67
+ get validationMessage() {
68
+ return __privateGet(this, _internals).validationMessage;
69
+ }
70
+ get willValidate() {
71
+ return __privateGet(this, _internals).willValidate;
72
+ }
73
+ checkValidity() {
74
+ return __privateGet(this, _internals).checkValidity();
75
+ }
76
+ reportValidity() {
77
+ return __privateGet(this, _internals).reportValidity();
78
+ }
79
+ connectedCallback() {
80
+ var _a;
81
+ super.connectedCallback();
82
+ (_a = __privateGet(this, _internals).form) == null ? void 0 : _a.addEventListener("reset", this._handleFormReset);
83
+ }
84
+ disconnectedCallback() {
85
+ var _a;
86
+ super.disconnectedCallback();
87
+ (_a = __privateGet(this, _internals).form) == null ? void 0 : _a.removeEventListener("reset", this._handleFormReset);
88
+ }
89
+ __handleValidityChange() {
90
+ __privateGet(this, _internals).setValidity(
91
+ {
92
+ badInput: false,
93
+ customError: this.invalid,
94
+ patternMismatch: false,
95
+ rangeOverflow: false,
96
+ rangeUnderflow: false,
97
+ stepMismatch: false,
98
+ tooLong: false,
99
+ tooShort: false,
100
+ typeMismatch: false,
101
+ valueMissing: false,
102
+ valid: !this.invalid
103
+ },
104
+ this.validationMessage || "Error message"
105
+ );
106
+ }
107
+ __handleValueChange() {
108
+ __privateGet(this, _internals).setFormValue(this.value);
109
+ }
110
+ };
111
+ _internals = new WeakMap();
112
+ GdsFormControlElement.formAssociated = true;
113
+ __decorateClass([
114
+ property({
115
+ type: Boolean,
116
+ reflect: true,
117
+ attribute: "aria-invalid",
118
+ converter: {
119
+ fromAttribute: Boolean,
120
+ toAttribute: (value) => value == null ? void 0 : value.toString()
121
+ }
122
+ })
123
+ ], GdsFormControlElement.prototype, "invalid", 2);
124
+ __decorateClass([
125
+ property()
126
+ ], GdsFormControlElement.prototype, "value", 2);
127
+ __decorateClass([
128
+ property({ reflect: true })
129
+ ], GdsFormControlElement.prototype, "name", 2);
130
+ __decorateClass([
131
+ watch("invalid")
132
+ ], GdsFormControlElement.prototype, "__handleValidityChange", 1);
133
+ __decorateClass([
134
+ watch("value")
135
+ ], GdsFormControlElement.prototype, "__handleValueChange", 1);
136
+
137
+ export {
138
+ GdsFormControlElement
139
+ };
@@ -0,0 +1,54 @@
1
+ import {
2
+ TransitionalStyles
3
+ } from "./chunk.QONSFT2N.js";
4
+ import {
5
+ GdsElement
6
+ } from "./chunk.2LQSDOD4.js";
7
+ import {
8
+ gdsCustomElement
9
+ } from "./chunk.VOYMQ322.js";
10
+ import {
11
+ __decorateClass
12
+ } from "./chunk.5VURDMKE.js";
13
+
14
+ // libs/core/src/primitives/menu/menu-heading.ts
15
+ import { html } from "lit";
16
+
17
+ // libs/core/src/primitives/menu/menu-heading.styles.ts
18
+ import { css } from "lit";
19
+ var style = css`
20
+ @layer base, reset, transitional-styles;
21
+ @layer base {
22
+ :host {
23
+ padding: 0.5 1rem;
24
+ cursor: pointer;
25
+ }
26
+
27
+ :host(:hover) {
28
+ background-color: grey;
29
+ }
30
+ }
31
+ `;
32
+ var menu_heading_styles_default = style;
33
+
34
+ // libs/core/src/primitives/menu/menu-heading.ts
35
+ var GdsMenuHeading = class extends GdsElement {
36
+ connectedCallback() {
37
+ super.connectedCallback();
38
+ this.setAttribute("inert", "true");
39
+ this.updateComplete.then(
40
+ () => TransitionalStyles.instance.apply(this, "gds-menu-heading")
41
+ );
42
+ }
43
+ render() {
44
+ return html`<slot></slot>`;
45
+ }
46
+ };
47
+ GdsMenuHeading.styles = menu_heading_styles_default;
48
+ GdsMenuHeading = __decorateClass([
49
+ gdsCustomElement("gds-menu-heading")
50
+ ], GdsMenuHeading);
51
+
52
+ export {
53
+ GdsMenuHeading
54
+ };
File without changes