@sebgroup/green-core 2.6.5 → 2.6.6

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.
@@ -51,6 +51,13 @@ declare class Datepicker extends GdsFormControlElement<Date> {
51
51
  * Whether to hide the Today button under the calendar.
52
52
  */
53
53
  hideTodayButton: boolean;
54
+ /**
55
+ * Controls the time component of dates selected in the calendar popover or spinbuttons in the field.
56
+ *
57
+ * The time will be set in UTC.
58
+ */
59
+ get utcHours(): number;
60
+ set utcHours(value: number);
54
61
  /**
55
62
  * The date format to use. Accepts a string with the characters `y`, `m` and `d` in any order, separated by a delimiter.
56
63
  * For example, `y-m-d` or `d/m/y`. All three characters must be present.
@@ -5,7 +5,7 @@ import {
5
5
  __privateMethod,
6
6
  __privateSet
7
7
  } from "../../chunks/chunk.QU3DSPNU.js";
8
- var _valueOnOpen, _Datepicker_instances, shouldShowFooter_fn, renderBackToValidRangeButton_fn, focusDate_fn, getSpinnerLabel_fn, getMinSpinnerValue_fn, getMaxSpinnerValue_fn, dispatchChangeEvent_fn, dispatchInputEvent_fn, _handleFieldFocusOut, _handleSpinnerFocus, _handleClipboardCopy, _handleClipboardPaste, _handleFieldClick, _handleCalendarChange, _handleMonthChange, _handleYearChange, _handleIncrementFocusedMonth, _handleDecrementFocusedMonth, _handleCalendarFocusChange, _handlePopoverStateChange, _handleSpinnerKeydown, parseDateFormat_fn, _handleSpinnerChange, _spinnerState, years_get, isValueOutsideRange_get;
8
+ var _utcHours, _valueOnOpen, _Datepicker_instances, shouldShowFooter_fn, renderBackToValidRangeButton_fn, focusDate_fn, getSpinnerLabel_fn, getMinSpinnerValue_fn, getMaxSpinnerValue_fn, dispatchChangeEvent_fn, dispatchInputEvent_fn, _handleFieldFocusOut, _handleSpinnerFocus, _handleClipboardCopy, _handleClipboardPaste, _handleFieldClick, _handleCalendarChange, _handleMonthChange, _handleYearChange, _handleIncrementFocusedMonth, _handleDecrementFocusedMonth, _handleCalendarFocusChange, _handlePopoverStateChange, _handleSpinnerKeydown, parseDateFormat_fn, _handleSpinnerChange, _spinnerState, years_get, isValueOutsideRange_get;
9
9
  import { localized, msg } from "@lit/localize";
10
10
  import { nothing } from "lit";
11
11
  import { property, query, queryAll, queryAsync, state } from "lit/decorators.js";
@@ -55,6 +55,7 @@ let Datepicker = class extends GdsFormControlElement {
55
55
  this.hideLabel = false;
56
56
  this.clearable = false;
57
57
  this.hideTodayButton = false;
58
+ __privateAdd(this, _utcHours, 12);
58
59
  this.disabledWeekends = false;
59
60
  this.showExtendedSupportingText = false;
60
61
  this._focusedMonth = (/* @__PURE__ */ new Date()).getMonth();
@@ -117,7 +118,9 @@ let Datepicker = class extends GdsFormControlElement {
117
118
  });
118
119
  __privateAdd(this, _handleCalendarChange, (e) => {
119
120
  e.stopPropagation();
120
- this.value = new Date(e.detail);
121
+ const date = new Date(e.detail);
122
+ date.setUTCHours(this.utcHours, 0, 0, 0);
123
+ this.value = date;
121
124
  this.open = false;
122
125
  __privateMethod(this, _Datepicker_instances, dispatchChangeEvent_fn).call(this);
123
126
  __privateMethod(this, _Datepicker_instances, dispatchInputEvent_fn).call(this);
@@ -200,7 +203,7 @@ let Datepicker = class extends GdsFormControlElement {
200
203
  newDate.setFullYear(parseInt(__privateGet(this, _spinnerState).year));
201
204
  newDate.setMonth(parseInt(__privateGet(this, _spinnerState).month) - 1);
202
205
  newDate.setDate(parseInt(__privateGet(this, _spinnerState).day));
203
- newDate.setHours(12, 0, 0, 0);
206
+ newDate.setUTCHours(this.utcHours, 0, 0, 0);
204
207
  if (newDate.toString() === "Invalid Date") return;
205
208
  this.value = newDate;
206
209
  __privateMethod(this, _Datepicker_instances, dispatchChangeEvent_fn).call(this);
@@ -225,6 +228,13 @@ let Datepicker = class extends GdsFormControlElement {
225
228
  set value(value) {
226
229
  super.value = value;
227
230
  }
231
+ get utcHours() {
232
+ return __privateGet(this, _utcHours);
233
+ }
234
+ set utcHours(value) {
235
+ __privateSet(this, _utcHours, value);
236
+ this._internalValue?.setUTCHours(value, 0, 0, 0);
237
+ }
228
238
  get dateformat() {
229
239
  return this._dateFormatLayout.layout.map((f) => f.token).join(this._dateFormatLayout.delimiter);
230
240
  }
@@ -535,6 +545,7 @@ let Datepicker = class extends GdsFormControlElement {
535
545
  }
536
546
  }
537
547
  };
548
+ _utcHours = new WeakMap();
538
549
  _valueOnOpen = new WeakMap();
539
550
  _Datepicker_instances = new WeakSet();
540
551
  shouldShowFooter_fn = function() {
@@ -692,6 +703,9 @@ __decorateClass([
692
703
  __decorateClass([
693
704
  property({ type: Boolean, attribute: "hide-today-button" })
694
705
  ], Datepicker.prototype, "hideTodayButton", 2);
706
+ __decorateClass([
707
+ property({ type: Number, attribute: "utc-hours" })
708
+ ], Datepicker.prototype, "utcHours", 1);
695
709
  __decorateClass([
696
710
  property()
697
711
  ], Datepicker.prototype, "dateformat", 1);
@@ -16,6 +16,7 @@ export * from '../../primitives/listbox/option.component';
16
16
  * @event input - Fired when the value of the dropdown is changed through user interaction.
17
17
  * @event gds-ui-state - Fired when the dropdown is opened or closed by the user. Can be cancelled to prevent the dropdown from opening or closing.
18
18
  * @event gds-filter-input - Fired when the user types in the search field. The event is cancellable, and the consumer is expected to handle filtering and updating the options list if the event is cancelled.
19
+ * @event gds-input-cleared - Fired when the user clears the input using the clear button.
19
20
  */
20
21
  export declare class GdsDropdown<ValueT = any> extends GdsFormControlElement<ValueT | ValueT[]> implements OptionsContainer {
21
22
  #private;
@@ -148,9 +149,6 @@ export declare class GdsDropdown<ValueT = any> extends GdsFormControlElement<Val
148
149
  * Update value assignment and request update when the light DOM changes.
149
150
  */
150
151
  private _handleLightDOMChange;
151
- /**
152
- * Called whenever the `value` property changes
153
- */
154
152
  private _handleValueChange;
155
153
  /**
156
154
  * Emits `gds-ui-state`event and does some other house-keeping when the open state changes.
@@ -139,11 +139,15 @@ let GdsDropdown = class extends GdsFormControlElement {
139
139
  e.preventDefault();
140
140
  e.stopPropagation();
141
141
  this.value = void 0;
142
+ this.dispatchCustomEvent("gds-input-cleared", {
143
+ bubbles: true,
144
+ composed: true
145
+ });
146
+ __privateGet(this, _dispatchInputEvent).call(this);
147
+ __privateGet(this, _dispatchChangeEvent).call(this);
142
148
  });
143
149
  /**
144
150
  * Event handler for filtering the options in the dropdown.
145
- *
146
- * @param e The input event.
147
151
  */
148
152
  __privateAdd(this, _handleSearchFieldInput, (e) => {
149
153
  if (!e.currentTarget) return;
@@ -463,11 +467,6 @@ _handleSearchFieldInput = new WeakMap();
463
467
  _handleSearchFieldKeyDown = new WeakMap();
464
468
  _handleListboxKeyDown = new WeakMap();
465
469
  _handleOptionFocusChange = new WeakMap();
466
- /**
467
- * Selects an option in the dropdown.
468
- *
469
- * @fires change
470
- */
471
470
  handleSelectionChange_fn = function() {
472
471
  this._elListbox.then((listbox) => {
473
472
  if (this.multiple) this.value = listbox.selection.map((s) => s.value);
package/gds-element.js CHANGED
@@ -14,7 +14,7 @@ class GdsElement extends LitElement {
14
14
  /**
15
15
  * The semantic version of this element. Can be used for troubleshooting to verify the version being used.
16
16
  */
17
- this.semanticVersion = "2.6.5";
17
+ this.semanticVersion = "2.6.6";
18
18
  this._isUsingTransitionalStyles = false;
19
19
  this._dynamicStylesController = new DynamicStylesController(this);
20
20
  }
@@ -29,6 +29,7 @@ export declare const GdsDatepicker: (props: React.ComponentProps<ReturnType<type
29
29
  hideLabel?: boolean | undefined;
30
30
  clearable?: boolean | undefined;
31
31
  hideTodayButton?: boolean | undefined;
32
+ utcHours?: number | undefined;
32
33
  dateformat?: string | undefined;
33
34
  disabledWeekends?: boolean | undefined;
34
35
  disabledDates?: Date[] | undefined;
@@ -16,8 +16,8 @@ export * from './divider/index.js';
16
16
  export * from './dropdown/index.js';
17
17
  export * from './fab/index.js';
18
18
  export * from './filter-chips/index.js';
19
- export * from './flex/index.js';
20
19
  export * from './form-summary/index.js';
20
+ export * from './flex/index.js';
21
21
  export * from './grid/index.js';
22
22
  export * from './grouped-list/index.js';
23
23
  export * from './list-item/index.js';
@@ -16,8 +16,8 @@ export * from "./divider/index.js";
16
16
  export * from "./dropdown/index.js";
17
17
  export * from "./fab/index.js";
18
18
  export * from "./filter-chips/index.js";
19
- export * from "./flex/index.js";
20
19
  export * from "./form-summary/index.js";
20
+ export * from "./flex/index.js";
21
21
  export * from "./grid/index.js";
22
22
  export * from "./grouped-list/index.js";
23
23
  export * from "./list-item/index.js";
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": "2.6.5",
4
+ "version": "2.6.6",
5
5
  "main": "index.js",
6
6
  "module": "index.js",
7
7
  "type": "module",
@@ -1,6 +1,6 @@
1
1
  import "../../chunks/chunk.QU3DSPNU.js";
2
2
  import { html as litHtml } from "lit";
3
- const VER_SUFFIX = "-3d32ce";
3
+ const VER_SUFFIX = "-eaa8fd";
4
4
  class ScopedElementRegistry {
5
5
  static get instance() {
6
6
  if (!globalThis.__gdsElementLookupTable?.[VER_SUFFIX])