@sebgroup/green-core 1.4.3 → 1.4.5

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.
@@ -78,4 +78,5 @@ export declare class GdsDatepicker extends GdsFormControlElement<Date> {
78
78
  connectedCallback(): void;
79
79
  render(): any;
80
80
  private _handleValueChange;
81
+ private _handleOpenChange;
81
82
  }
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 = "-ebe3ca";
142
+ var VER_SUFFIX = "-6cf221";
143
143
  var elementLookupTable = /* @__PURE__ */ new Map();
144
144
  var gdsCustomElement = (tagName) => {
145
145
  if (globalThis.GDS_DISABLE_VERSIONED_ELEMENTS) {
@@ -1907,6 +1907,9 @@ var GdsCalendar = class extends GdsElement {
1907
1907
  </tbody>
1908
1908
  </table>`;
1909
1909
  }
1910
+ _valueChanged() {
1911
+ this.focusedDate = this.value;
1912
+ }
1910
1913
  };
1911
1914
  _setSelectedDate = new WeakSet();
1912
1915
  setSelectedDate_fn = function(date) {
@@ -2003,6 +2006,9 @@ __decorateClass([
2003
2006
  __decorateClass([
2004
2007
  state8()
2005
2008
  ], GdsCalendar.prototype, "_tStyles", 2);
2009
+ __decorateClass([
2010
+ watch("value")
2011
+ ], GdsCalendar.prototype, "_valueChanged", 1);
2006
2012
  GdsCalendar = __decorateClass([
2007
2013
  gdsCustomElement("gds-calendar")
2008
2014
  ], GdsCalendar);
@@ -2203,7 +2209,7 @@ var dateConverter = {
2203
2209
  return value.toISOString();
2204
2210
  }
2205
2211
  };
2206
- 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, _isValueOutsideRange, isValueOutsideRange_get;
2212
+ var _renderBackToValidRangeButton, renderBackToValidRangeButton_fn, _focusDate, focusDate_fn, _getSpinnerLabel, getSpinnerLabel_fn, _getMinSpinnerValue, getMinSpinnerValue_fn, _getMaxSpinnerValue, getMaxSpinnerValue_fn, _dispatchChangeEvent2, dispatchChangeEvent_fn2, _handleFieldClick, _handleCalendarChange, _handleMonthChange, _handleYearChange, _handleIncrementFocusedMonth, _handleDecrementFocusedMonth, _handleFocusChange, _handlePopoverStateChange, _handleSpinnerKeydown, _parseDateFormat, parseDateFormat_fn, _handleSpinnerChange, _spinnerState, _years, years_get, _isValueOutsideRange, isValueOutsideRange_get;
2207
2213
  var GdsDatepicker = class extends GdsFormControlElement {
2208
2214
  constructor() {
2209
2215
  super(...arguments);
@@ -2230,6 +2236,9 @@ var GdsDatepicker = class extends GdsFormControlElement {
2230
2236
  this._focusedMonth = (/* @__PURE__ */ new Date()).getMonth();
2231
2237
  this._focusedYear = (/* @__PURE__ */ new Date()).getFullYear();
2232
2238
  this._dateFormatLayout = __privateMethod(this, _parseDateFormat, parseDateFormat_fn).call(this, "y-m-d");
2239
+ __privateAdd(this, _handleFieldClick, (e) => {
2240
+ this._elSpinners[0].focus();
2241
+ });
2233
2242
  __privateAdd(this, _handleCalendarChange, (e) => {
2234
2243
  e.stopPropagation();
2235
2244
  this.value = e.detail;
@@ -2336,7 +2345,7 @@ var GdsDatepicker = class extends GdsFormControlElement {
2336
2345
 
2337
2346
  <div class="form-info"><slot name="sub-label"></slot></div>
2338
2347
 
2339
- <div class="field" id="trigger">
2348
+ <div class="field" id="trigger" @click=${__privateGet(this, _handleFieldClick)}>
2340
2349
  <div class="input">
2341
2350
  ${join(
2342
2351
  map(
@@ -2483,6 +2492,10 @@ var GdsDatepicker = class extends GdsFormControlElement {
2483
2492
  const day = date.getDate().toString().padStart(2, "0");
2484
2493
  __privateSet(this, _spinnerState, { year, month, day });
2485
2494
  }
2495
+ _handleOpenChange() {
2496
+ if (this.open)
2497
+ this._elCalendar.then((el) => el.focus());
2498
+ }
2486
2499
  };
2487
2500
  _renderBackToValidRangeButton = new WeakSet();
2488
2501
  renderBackToValidRangeButton_fn = async function() {
@@ -2544,6 +2557,7 @@ dispatchChangeEvent_fn2 = function() {
2544
2557
  })
2545
2558
  );
2546
2559
  };
2560
+ _handleFieldClick = new WeakMap();
2547
2561
  _handleCalendarChange = new WeakMap();
2548
2562
  _handleMonthChange = new WeakMap();
2549
2563
  _handleYearChange = new WeakMap();
@@ -2644,6 +2658,9 @@ __decorateClass([
2644
2658
  __decorateClass([
2645
2659
  watch("value")
2646
2660
  ], GdsDatepicker.prototype, "_handleValueChange", 1);
2661
+ __decorateClass([
2662
+ watch("open")
2663
+ ], GdsDatepicker.prototype, "_handleOpenChange", 1);
2647
2664
  GdsDatepicker = __decorateClass([
2648
2665
  gdsCustomElement("gds-datepicker")
2649
2666
  ], GdsDatepicker);
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.3",
4
+ "version": "1.4.5",
5
5
  "main": "index.js",
6
6
  "module": "index.js",
7
7
  "type": "module",
@@ -24,7 +24,8 @@
24
24
  "@floating-ui/dom": "^1.5.4",
25
25
  "@lit/localize": "0.11.4",
26
26
  "lit": "^2.8.0",
27
- "reflect-metadata": "^0.1.13"
27
+ "reflect-metadata": "^0.1.13",
28
+ "date-fns": "^2.28.0"
28
29
  },
29
30
  "exports": {
30
31
  ".": {
@@ -51,4 +51,5 @@ export declare class GdsCalendar extends GdsElement {
51
51
  connectedCallback(): void;
52
52
  focus(): void;
53
53
  render(): import("lit").TemplateResult<1>;
54
+ private _valueChanged;
54
55
  }
@@ -2871,8 +2871,8 @@ var calendar_trans_styles_default = `/* stylelint-disable max-nesting-depth */
2871
2871
  :host table tbody tr td.today {
2872
2872
  background: transparent;
2873
2873
  border-radius: 4px;
2874
- box-shadow: inset 0 0 0 2px hsl(var(--sg-hsl-blue-2));
2875
2874
  color: hsl(var(--sg-hsl-blue-2));
2875
+ text-decoration: underline;
2876
2876
  }
2877
2877
  :host table tbody tr td:hover:not(.disabled) {
2878
2878
  background: hsl(var(--sg-hsl-blue-0));
@@ -2882,10 +2882,8 @@ var calendar_trans_styles_default = `/* stylelint-disable max-nesting-depth */
2882
2882
  cursor: pointer;
2883
2883
  }
2884
2884
  :host table tbody tr td:focus-visible:not(.disabled) {
2885
- background: hsl(var(--sg-hsl-blue-0));
2886
2885
  border: solid 1px var(--sg-bg-level-2);
2887
2886
  border-radius: 4px;
2888
- color: hsl(var(--sg-hsl-white));
2889
2887
  cursor: pointer;
2890
2888
  position: relative;
2891
2889
  z-index: 0;
@@ -2907,10 +2905,8 @@ var calendar_trans_styles_default = `/* stylelint-disable max-nesting-depth */
2907
2905
  color: hsl(var(--sg-hsl-white));
2908
2906
  }
2909
2907
  :host table tbody tr td[tabindex="0"] {
2910
- background: hsl(var(--sg-hsl-blue-2));
2911
- border: solid 1px var(--sg-bg-level-2);
2912
2908
  border-radius: 4px;
2913
- color: hsl(var(--sg-hsl-white));
2909
+ box-shadow: inset 0 0 0 2px hsl(var(--sg-hsl-blue-2));
2914
2910
  }
2915
2911
  :host table tbody tr td:hover:active:not(.disabled) {
2916
2912
  background: hsl(var(--sg-hsl-blue-2));
@@ -3216,7 +3212,7 @@ function register6() {
3216
3212
  // libs/core/src/utils/helpers/custom-element-scoping.ts
3217
3213
  import { html as litHtml } from "lit";
3218
3214
  import { customElement } from "lit/decorators.js";
3219
- var VER_SUFFIX = "-ebe3ca";
3215
+ var VER_SUFFIX = "-6cf221";
3220
3216
  var elementLookupTable = /* @__PURE__ */ new Map();
3221
3217
  var templateCache = /* @__PURE__ */ new WeakMap();
3222
3218
  function applyElementScoping(strings, ...values) {