@sebgroup/green-core 1.4.0 → 1.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -139,7 +139,7 @@ function watchMediaQuery(q) {
139
139
  // libs/core/src/utils/helpers/custom-element-scoping.ts
140
140
  import { html as litHtml } from "lit";
141
141
  import { customElement } from "lit/decorators.js";
142
- var VER_SUFFIX = "-98c004";
142
+ var VER_SUFFIX = "-c7f30b";
143
143
  var elementLookupTable = /* @__PURE__ */ new Map();
144
144
  var gdsCustomElement = (tagName) => {
145
145
  if (globalThis.GDS_DISABLE_VERSIONED_ELEMENTS) {
@@ -192,7 +192,7 @@ import { property } from "lit/decorators.js";
192
192
  import { createRef, ref } from "lit/directives/ref.js";
193
193
 
194
194
  // libs/core/src/utils/helpers/transitional-styles.ts
195
- var TransitionalStyles = class _TransitionalStyles {
195
+ var TransitionalStyles = class {
196
196
  constructor() {
197
197
  this.sheets = /* @__PURE__ */ new Map();
198
198
  this.elements = /* @__PURE__ */ new Map();
@@ -201,7 +201,7 @@ var TransitionalStyles = class _TransitionalStyles {
201
201
  if (!globalThis.__gdsTransitionalStyles?.[VER_SUFFIX])
202
202
  globalThis.__gdsTransitionalStyles = {
203
203
  ...globalThis.__gdsTransitionalStyles,
204
- [VER_SUFFIX]: new _TransitionalStyles()
204
+ [VER_SUFFIX]: new TransitionalStyles()
205
205
  };
206
206
  return globalThis.__gdsTransitionalStyles[VER_SUFFIX];
207
207
  }
@@ -1028,9 +1028,11 @@ GdsPopover = __decorateClass([
1028
1028
  // libs/core/src/components/form-control.ts
1029
1029
  import { LitElement as LitElement4 } from "lit";
1030
1030
  import { property as property4 } from "lit/decorators.js";
1031
+ var _internals;
1031
1032
  var GdsFormControlElement = class extends LitElement4 {
1032
1033
  constructor() {
1033
1034
  super();
1035
+ __privateAdd(this, _internals, void 0);
1034
1036
  this.invalid = false;
1035
1037
  this.name = "";
1036
1038
  /**
@@ -1040,43 +1042,39 @@ var GdsFormControlElement = class extends LitElement4 {
1040
1042
  this._handleFormReset = () => {
1041
1043
  this.value = void 0;
1042
1044
  };
1043
- this.#internals = this.attachInternals();
1044
- }
1045
- #internals;
1046
- static {
1047
- this.formAssociated = true;
1045
+ __privateSet(this, _internals, this.attachInternals());
1048
1046
  }
1049
1047
  get form() {
1050
- return this.#internals.form;
1048
+ return __privateGet(this, _internals).form;
1051
1049
  }
1052
1050
  get type() {
1053
1051
  return getUnscopedTagName(this.localName) || "gds-form-control";
1054
1052
  }
1055
1053
  get validity() {
1056
- return this.#internals.validity;
1054
+ return __privateGet(this, _internals).validity;
1057
1055
  }
1058
1056
  get validationMessage() {
1059
- return this.#internals.validationMessage;
1057
+ return __privateGet(this, _internals).validationMessage;
1060
1058
  }
1061
1059
  get willValidate() {
1062
- return this.#internals.willValidate;
1060
+ return __privateGet(this, _internals).willValidate;
1063
1061
  }
1064
1062
  checkValidity() {
1065
- return this.#internals.checkValidity();
1063
+ return __privateGet(this, _internals).checkValidity();
1066
1064
  }
1067
1065
  reportValidity() {
1068
- return this.#internals.reportValidity();
1066
+ return __privateGet(this, _internals).reportValidity();
1069
1067
  }
1070
1068
  connectedCallback() {
1071
1069
  super.connectedCallback();
1072
- this.#internals.form?.addEventListener("reset", this._handleFormReset);
1070
+ __privateGet(this, _internals).form?.addEventListener("reset", this._handleFormReset);
1073
1071
  }
1074
1072
  disconnectedCallback() {
1075
1073
  super.disconnectedCallback();
1076
- this.#internals.form?.removeEventListener("reset", this._handleFormReset);
1074
+ __privateGet(this, _internals).form?.removeEventListener("reset", this._handleFormReset);
1077
1075
  }
1078
1076
  __handleValidityChange() {
1079
- this.#internals.setValidity(
1077
+ __privateGet(this, _internals).setValidity(
1080
1078
  {
1081
1079
  badInput: false,
1082
1080
  customError: this.invalid,
@@ -1093,9 +1091,11 @@ var GdsFormControlElement = class extends LitElement4 {
1093
1091
  );
1094
1092
  }
1095
1093
  __handleValueChange() {
1096
- this.#internals.setFormValue(this.value);
1094
+ __privateGet(this, _internals).setFormValue(this.value);
1097
1095
  }
1098
1096
  };
1097
+ _internals = new WeakMap();
1098
+ GdsFormControlElement.formAssociated = true;
1099
1099
  __decorateClass([
1100
1100
  property4({
1101
1101
  type: Boolean,
@@ -1462,11 +1462,10 @@ import { property as property6, queryAsync as queryAsync2 } from "lit/decorators
1462
1462
  // libs/core/src/primitives/menu/menu.ts
1463
1463
  import { LitElement as LitElement5 } from "lit";
1464
1464
  import { createRef as createRef3, ref as ref3 } from "lit/directives/ref.js";
1465
- var _slotRef2;
1466
1465
  var GdsMenu = class extends LitElement5 {
1466
+ #slotRef = createRef3();
1467
1467
  constructor() {
1468
1468
  super();
1469
- __privateAdd(this, _slotRef2, createRef3());
1470
1469
  new ListboxKbNavController(this);
1471
1470
  }
1472
1471
  connectedCallback() {
@@ -1475,9 +1474,9 @@ var GdsMenu = class extends LitElement5 {
1475
1474
  TransitionalStyles.instance.apply(this, "gds-listbox");
1476
1475
  }
1477
1476
  get navigableItems() {
1478
- if (!__privateGet(this, _slotRef2).value)
1477
+ if (!this.#slotRef.value)
1479
1478
  return [];
1480
- return unwrap(__privateGet(this, _slotRef2).value).assignedElements().filter(
1479
+ return unwrap(this.#slotRef.value).assignedElements().filter(
1481
1480
  (o) => !o.hasAttribute("isplaceholder")
1482
1481
  ) || [];
1483
1482
  }
@@ -1488,10 +1487,9 @@ var GdsMenu = class extends LitElement5 {
1488
1487
  this.navigableItems[0]?.focus();
1489
1488
  }
1490
1489
  render() {
1491
- return html`<slot ${ref3(__privateGet(this, _slotRef2))}></slot>`;
1490
+ return html`<slot ${ref3(this.#slotRef)}></slot>`;
1492
1491
  }
1493
1492
  };
1494
- _slotRef2 = new WeakMap();
1495
1493
  GdsMenu = __decorateClass([
1496
1494
  gdsCustomElement("gds-menu")
1497
1495
  ], GdsMenu);
@@ -1579,19 +1577,7 @@ GdsContextMenu = __decorateClass([
1579
1577
 
1580
1578
  // libs/core/src/primitives/menu/menu-item.ts
1581
1579
  import { LitElement as LitElement7 } from "lit";
1582
- var _handleOnClick;
1583
1580
  var GdsMenuItem = class extends Focusable(LitElement7) {
1584
- constructor() {
1585
- super(...arguments);
1586
- __privateAdd(this, _handleOnClick, () => {
1587
- this.dispatchEvent(
1588
- new CustomEvent("gds-menu-item-click", {
1589
- bubbles: true,
1590
- composed: true
1591
- })
1592
- );
1593
- });
1594
- }
1595
1581
  connectedCallback() {
1596
1582
  super.connectedCallback();
1597
1583
  this.setAttribute("role", "menuitem");
@@ -1601,14 +1587,21 @@ var GdsMenuItem = class extends Focusable(LitElement7) {
1601
1587
  e.preventDefault();
1602
1588
  this.click();
1603
1589
  });
1604
- this.addEventListener("click", __privateGet(this, _handleOnClick));
1590
+ this.addEventListener("click", this.#handleOnClick);
1605
1591
  TransitionalStyles.instance.apply(this, "gds-option");
1606
1592
  }
1593
+ #handleOnClick = () => {
1594
+ this.dispatchEvent(
1595
+ new CustomEvent("gds-menu-item-click", {
1596
+ bubbles: true,
1597
+ composed: true
1598
+ })
1599
+ );
1600
+ };
1607
1601
  render() {
1608
1602
  return html`<slot></slot>`;
1609
1603
  }
1610
1604
  };
1611
- _handleOnClick = new WeakMap();
1612
1605
  GdsMenuItem = __decorateClass([
1613
1606
  gdsCustomElement("gds-menu-item")
1614
1607
  ], GdsMenuItem);
@@ -2059,7 +2052,7 @@ var dateConverter = {
2059
2052
  return value.toISOString();
2060
2053
  }
2061
2054
  };
2062
- var _renderBackToValidRangeButton, renderBackToValidRangeButton_fn, _focusDate, focusDate_fn, _getSpinnerLabel, getSpinnerLabel_fn, _getMinSpinnerValue, getMinSpinnerValue_fn, _getMaxSpinnerValue, getMaxSpinnerValue_fn, _dispatchChangeEvent2, dispatchChangeEvent_fn2, _handleIncrementFocusedMonth, _handleDecrementFocusedMonth, _handleFocusChange, _handlePopoverStateChange, _handleSpinnerKeydown, _parseDateFormat, parseDateFormat_fn, _handleSpinnerChange, _spinnerState, _years, years_get;
2055
+ var _renderBackToValidRangeButton, renderBackToValidRangeButton_fn, _focusDate, focusDate_fn, _getSpinnerLabel, getSpinnerLabel_fn, _getMinSpinnerValue, getMinSpinnerValue_fn, _getMaxSpinnerValue, getMaxSpinnerValue_fn, _dispatchChangeEvent2, dispatchChangeEvent_fn2, _handleCalendarChange, _handleMonthChange, _handleYearChange, _handleIncrementFocusedMonth, _handleDecrementFocusedMonth, _handleFocusChange, _handlePopoverStateChange, _handleSpinnerKeydown, _parseDateFormat, parseDateFormat_fn, _handleSpinnerChange, _spinnerState, _years, years_get;
2063
2056
  var GdsDatepicker = class extends GdsFormControlElement {
2064
2057
  constructor() {
2065
2058
  super(...arguments);
@@ -2086,6 +2079,20 @@ var GdsDatepicker = class extends GdsFormControlElement {
2086
2079
  this._focusedMonth = (/* @__PURE__ */ new Date()).getMonth();
2087
2080
  this._focusedYear = (/* @__PURE__ */ new Date()).getFullYear();
2088
2081
  this._dateFormatLayout = __privateMethod(this, _parseDateFormat, parseDateFormat_fn).call(this, "y-m-d");
2082
+ __privateAdd(this, _handleCalendarChange, (e) => {
2083
+ e.stopPropagation();
2084
+ this.value = e.detail;
2085
+ this.open = false;
2086
+ __privateMethod(this, _dispatchChangeEvent2, dispatchChangeEvent_fn2).call(this);
2087
+ });
2088
+ __privateAdd(this, _handleMonthChange, (e) => {
2089
+ e.stopPropagation();
2090
+ this._focusedMonth = e.target?.value;
2091
+ });
2092
+ __privateAdd(this, _handleYearChange, (e) => {
2093
+ e.stopPropagation();
2094
+ this._focusedYear = e.target?.value;
2095
+ });
2089
2096
  __privateAdd(this, _handleIncrementFocusedMonth, (_e) => {
2090
2097
  this._focusedMonth++;
2091
2098
  if (this._focusedMonth > 11) {
@@ -2241,7 +2248,7 @@ var GdsDatepicker = class extends GdsFormControlElement {
2241
2248
  </button>
2242
2249
  <gds-dropdown
2243
2250
  .value=${this._focusedMonth.toString()}
2244
- @change=${(e) => this._focusedMonth = e.target?.value}
2251
+ @change=${__privateGet(this, _handleMonthChange)}
2245
2252
  aria-label="${msg5("Month")}"
2246
2253
  >
2247
2254
  <gds-option value="0">${msg5("January")}</gds-option>
@@ -2259,7 +2266,7 @@ var GdsDatepicker = class extends GdsFormControlElement {
2259
2266
  </gds-dropdown>
2260
2267
  <gds-dropdown
2261
2268
  .value=${this._focusedYear.toString()}
2262
- @change=${(e) => this._focusedYear = e.target?.value}
2269
+ @change=${__privateGet(this, _handleYearChange)}
2263
2270
  aria-label="${msg5("Year")}"
2264
2271
  >
2265
2272
  ${repeat(
@@ -2275,12 +2282,7 @@ var GdsDatepicker = class extends GdsFormControlElement {
2275
2282
 
2276
2283
  <gds-calendar
2277
2284
  id="calendar"
2278
- @change=${(e) => {
2279
- e.stopPropagation();
2280
- this.value = e.detail;
2281
- this.open = false;
2282
- __privateMethod(this, _dispatchChangeEvent2, dispatchChangeEvent_fn2).call(this);
2283
- }}
2285
+ @change=${__privateGet(this, _handleCalendarChange)}
2284
2286
  @gds-date-focused=${__privateGet(this, _handleFocusChange)}
2285
2287
  .focusedMonth=${this._focusedMonth}
2286
2288
  .focusedYear=${this._focusedYear}
@@ -2392,6 +2394,9 @@ dispatchChangeEvent_fn2 = function() {
2392
2394
  })
2393
2395
  );
2394
2396
  };
2397
+ _handleCalendarChange = new WeakMap();
2398
+ _handleMonthChange = new WeakMap();
2399
+ _handleYearChange = new WeakMap();
2395
2400
  _handleIncrementFocusedMonth = new WeakMap();
2396
2401
  _handleDecrementFocusedMonth = new WeakMap();
2397
2402
  _handleFocusChange = new WeakMap();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sebgroup/green-core",
3
3
  "description": "A carefully crafted set of Web Components, laying the foundation of the Green Design System.",
4
- "version": "1.4.0",
4
+ "version": "1.4.1",
5
5
  "main": "index.js",
6
6
  "module": "index.js",
7
7
  "type": "module",
@@ -6775,7 +6775,7 @@ function register6() {
6775
6775
  // libs/core/src/utils/helpers/custom-element-scoping.ts
6776
6776
  import { html as litHtml } from "lit";
6777
6777
  import { customElement } from "lit/decorators.js";
6778
- var VER_SUFFIX = "-98c004";
6778
+ var VER_SUFFIX = "-c7f30b";
6779
6779
  var elementLookupTable = /* @__PURE__ */ new Map();
6780
6780
  var templateCache = /* @__PURE__ */ new WeakMap();
6781
6781
  function applyElementScoping(strings, ...values) {
@@ -6813,7 +6813,7 @@ var registerTransitionalStyles = () => {
6813
6813
  register5();
6814
6814
  register6();
6815
6815
  };
6816
- var TransitionalStyles = class _TransitionalStyles {
6816
+ var TransitionalStyles = class {
6817
6817
  constructor() {
6818
6818
  this.sheets = /* @__PURE__ */ new Map();
6819
6819
  this.elements = /* @__PURE__ */ new Map();
@@ -6822,7 +6822,7 @@ var TransitionalStyles = class _TransitionalStyles {
6822
6822
  if (!globalThis.__gdsTransitionalStyles?.[VER_SUFFIX])
6823
6823
  globalThis.__gdsTransitionalStyles = {
6824
6824
  ...globalThis.__gdsTransitionalStyles,
6825
- [VER_SUFFIX]: new _TransitionalStyles()
6825
+ [VER_SUFFIX]: new TransitionalStyles()
6826
6826
  };
6827
6827
  return globalThis.__gdsTransitionalStyles[VER_SUFFIX];
6828
6828
  }