@tylertech/forge 3.9.1 → 3.10.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 (93) hide show
  1. package/custom-elements.json +183 -25
  2. package/dist/badge/forge-badge.css +1 -1
  3. package/dist/forge.css +0 -1
  4. package/dist/lib.js +22 -22
  5. package/dist/lib.js.map +3 -3
  6. package/dist/table/forge-table.css +0 -1
  7. package/dist/vscode.html-custom-data.json +20 -0
  8. package/esm/autocomplete/autocomplete-core.js +9 -12
  9. package/esm/autocomplete/autocomplete-utils.js +3 -2
  10. package/esm/badge/badge.js +1 -1
  11. package/esm/button/base/base-button-adapter.js +6 -5
  12. package/esm/button/base/base-button-constants.d.ts +2 -2
  13. package/esm/button-area/button-area-adapter.d.ts +0 -2
  14. package/esm/button-area/button-area-adapter.js +5 -3
  15. package/esm/button-area/button-area-core.js +0 -1
  16. package/esm/button-area/button-area.js +1 -1
  17. package/esm/button-toggle/button-toggle-group/button-toggle-group-core.js +0 -1
  18. package/esm/calendar/calendar-core.js +6 -4
  19. package/esm/calendar/calendar-dropdown/calendar-dropdown.js +1 -1
  20. package/esm/calendar/calendar-utils.js +1 -3
  21. package/esm/calendar/calendar.js +1 -1
  22. package/esm/color-picker/color-picker-core.js +2 -2
  23. package/esm/core/configuration/global-configuration.js +0 -1
  24. package/esm/core/mask/date-input-mask.js +18 -1
  25. package/esm/core/mixins/form/with-form-associated.js +6 -2
  26. package/esm/core/utils/a11y-utils.d.ts +2 -2
  27. package/esm/core/utils/date-utils.d.ts +14 -5
  28. package/esm/core/utils/date-utils.js +229 -70
  29. package/esm/core/utils/dismissible-stack.js +0 -1
  30. package/esm/core/utils/feature-detection.js +2 -2
  31. package/esm/date-picker/base/base-date-picker-adapter.d.ts +2 -1
  32. package/esm/date-picker/base/base-date-picker-adapter.js +4 -0
  33. package/esm/date-picker/base/base-date-picker-constants.d.ts +19 -4
  34. package/esm/date-picker/base/base-date-picker-constants.js +20 -1
  35. package/esm/date-picker/base/base-date-picker-core.d.ts +11 -3
  36. package/esm/date-picker/base/base-date-picker-core.js +70 -17
  37. package/esm/date-picker/base/base-date-picker-utils.d.ts +2 -1
  38. package/esm/date-picker/base/base-date-picker.d.ts +10 -2
  39. package/esm/date-picker/base/base-date-picker.js +17 -1
  40. package/esm/date-picker/date-picker-adapter.js +1 -1
  41. package/esm/date-picker/date-picker-core.js +3 -2
  42. package/esm/date-range-picker/date-range-picker-adapter.d.ts +2 -1
  43. package/esm/date-range-picker/date-range-picker-adapter.js +1 -1
  44. package/esm/date-range-picker/date-range-picker-core.d.ts +1 -0
  45. package/esm/date-range-picker/date-range-picker-core.js +18 -9
  46. package/esm/deprecated/icon-button/deprecated-icon-button-component-delegate.js +2 -1
  47. package/esm/dialog/dialog.js +1 -1
  48. package/esm/expansion-panel/expansion-panel-core.d.ts +4 -0
  49. package/esm/expansion-panel/expansion-panel-core.js +19 -11
  50. package/esm/field/field-core.js +2 -1
  51. package/esm/field/field.js +1 -1
  52. package/esm/file-picker/file-picker-core.js +1 -3
  53. package/esm/floating-action-button/floating-action-button-adapter.d.ts +0 -4
  54. package/esm/floating-action-button/floating-action-button-adapter.js +3 -24
  55. package/esm/floating-action-button/floating-action-button-component-delegate.js +2 -1
  56. package/esm/floating-action-button/floating-action-button-core.d.ts +0 -1
  57. package/esm/floating-action-button/floating-action-button-core.js +0 -3
  58. package/esm/floating-action-button/floating-action-button.d.ts +0 -1
  59. package/esm/floating-action-button/floating-action-button.js +0 -3
  60. package/esm/icon/icon-core.js +1 -1
  61. package/esm/icon/icon-registry.js +1 -1
  62. package/esm/icon-button/icon-button-component-delegate.js +2 -1
  63. package/esm/label/label-aware.js +1 -3
  64. package/esm/list/list/list.js +1 -1
  65. package/esm/list/list-item/list-item.js +1 -1
  66. package/esm/list-dropdown/list-dropdown-core.js +4 -2
  67. package/esm/list-dropdown/list-dropdown-utils.js +5 -2
  68. package/esm/menu/menu-core.js +5 -6
  69. package/esm/overlay/overlay-constants.d.ts +1 -1
  70. package/esm/overlay/overlay-constants.js +1 -1
  71. package/esm/overlay/overlay.d.ts +2 -2
  72. package/esm/overlay/overlay.js +2 -2
  73. package/esm/select/core/base-select-adapter.js +0 -1
  74. package/esm/select/core/base-select-core.js +70 -74
  75. package/esm/select/core/select-utils.d.ts +1 -1
  76. package/esm/select/core/select-utils.js +2 -2
  77. package/esm/select/select-dropdown/select-dropdown-adapter.js +1 -3
  78. package/esm/split-view/split-view-panel/split-view-panel.js +1 -1
  79. package/esm/table/table-utils.js +10 -12
  80. package/esm/tabs/tab-bar/tab-bar-core.js +2 -1
  81. package/esm/text-field/text-field-adapter.js +1 -3
  82. package/esm/time-picker/time-picker-core.js +5 -5
  83. package/esm/toast/toast-adapter.js +1 -1
  84. package/esm/toast/toast-core.js +1 -1
  85. package/esm/toast/toast.js +2 -1
  86. package/esm/tooltip/tooltip.js +1 -1
  87. package/esm/view-switcher/view-switcher-core.js +2 -1
  88. package/package.json +1 -1
  89. package/sass/core/styles/tokens/badge/_tokens.scss +1 -1
  90. package/sass/list/list/list.scss +4 -2
  91. package/sass/list/list-item/list-item.scss +3 -1
  92. package/sass/table/forge-table.scss +0 -1
  93. package/sass/utils/_mixins.scss +7 -8
@@ -20,6 +20,7 @@ export class BaseDatePickerCore {
20
20
  this._masked = true;
21
21
  this._maskFormat = DEFAULT_DATE_MASK;
22
22
  this._showMaskFormat = false;
23
+ this._dateFormat = BASE_DATE_PICKER_CONSTANTS.defaults.DATE_FORMAT;
23
24
  this._valueMode = 'object';
24
25
  this._notifyInputValueChanges = true;
25
26
  this._allowInvalidDate = false;
@@ -160,6 +161,24 @@ export class BaseDatePickerCore {
160
161
  this._emitCloseEvent();
161
162
  }
162
163
  }
164
+ _getDefaultShortcuts() {
165
+ const handleTodayShortcut = () => {
166
+ this._onToday();
167
+ if (this._open) {
168
+ this._closeCalendar(true);
169
+ }
170
+ };
171
+ const formatAllowsMonthAbbreviations = this._dateFormat.toUpperCase().includes('MMM');
172
+ // We only allow "t" shortcut for today if the date format allows month abbreviations
173
+ // because otherwise it could conflict with the "n" shortcut for month names
174
+ if (formatAllowsMonthAbbreviations) {
175
+ return { t: handleTodayShortcut };
176
+ }
177
+ return {
178
+ n: handleTodayShortcut,
179
+ t: handleTodayShortcut
180
+ };
181
+ }
163
182
  _onInputKeydown(evt) {
164
183
  // Handle keyboard shortcuts that make use of the shift key first
165
184
  if (evt.shiftKey) {
@@ -188,6 +207,24 @@ export class BaseDatePickerCore {
188
207
  break;
189
208
  }
190
209
  }
210
+ // Handle date entry shortcuts
211
+ const shortcuts = Object.entries(this._shortcuts ?? this._getDefaultShortcuts());
212
+ if (shortcuts.length && !evt.shiftKey && evt.key.length === 1) {
213
+ const key = evt.key.toLowerCase();
214
+ const shortcut = shortcuts.find(([k]) => k === key);
215
+ if (shortcut) {
216
+ evt.preventDefault();
217
+ const [_k, callback] = shortcut;
218
+ if (typeof callback === 'function') {
219
+ const date = callback({ instance: this._adapter.hostElement });
220
+ if (isValidDate(date)) {
221
+ this._onDateSelected({ date, selected: true, type: 'date' });
222
+ }
223
+ }
224
+ return;
225
+ }
226
+ }
227
+ // Handle shortcuts that do not require the shift key
191
228
  switch (evt.key) {
192
229
  case 'Escape':
193
230
  if (this._open) {
@@ -230,14 +267,6 @@ export class BaseDatePickerCore {
230
267
  this._adapter.propagateCalendarKey(evt);
231
268
  }
232
269
  break;
233
- case 'n':
234
- case 't':
235
- evt.preventDefault();
236
- this._onToday();
237
- if (this._open) {
238
- this._closeCalendar(true);
239
- }
240
- break;
241
270
  case 'PageUp':
242
271
  case 'PageDown':
243
272
  if (this._open) {
@@ -260,7 +289,7 @@ export class BaseDatePickerCore {
260
289
  }
261
290
  }
262
291
  _getSanitizedDateString(value) {
263
- return value.replace(/_|[a-z]|[A-Z]/g, '').replace(/\/$|\/\/$/, '');
292
+ return value.replace(/_/g, '').replace(/\/$|\/\/$/, '');
264
293
  }
265
294
  _onToggleMousedown(evt) {
266
295
  if (this._disabled) {
@@ -312,16 +341,16 @@ export class BaseDatePickerCore {
312
341
  }
313
342
  _formatDate(date) {
314
343
  if (!isValidDate(date)) {
315
- return '';
344
+ return null;
316
345
  }
317
- return typeof this._formatCallback === 'function' ? this._formatCallback(date) : formatDate(date);
346
+ return typeof this._formatCallback === 'function' ? this._formatCallback(date) : formatDate(date, this._dateFormat);
318
347
  }
319
348
  _parseDateString(value) {
320
- value = value.replace(/_|\s/g, '');
349
+ value = value.replace(/_/g, '');
321
350
  if (!value || !value.length) {
322
351
  return null;
323
352
  }
324
- const parsedDate = typeof this._parseCallback === 'function' ? this._parseCallback(value) : parseDateString(value);
353
+ const parsedDate = typeof this._parseCallback === 'function' ? this._parseCallback(value) : parseDateString(value, this._dateFormat);
325
354
  return isValidDate(parsedDate) ? parsedDate : null;
326
355
  }
327
356
  _coerceDateValue(value) {
@@ -365,9 +394,7 @@ export class BaseDatePickerCore {
365
394
  onChange: (value) => this._handleInput(value)
366
395
  };
367
396
  if (this._prepareMaskCallback) {
368
- options.prepareCallback = (value, masked, flags, maskInstance) => {
369
- return this._prepareMaskCallback.call(null, value, masked, flags, maskInstance);
370
- };
397
+ options.prepareCallback = (value, masked, flags, maskInstance) => this._prepareMaskCallback.call(null, value, masked, flags, maskInstance);
371
398
  }
372
399
  this._adapter.initializeMask(options);
373
400
  }
@@ -410,13 +437,23 @@ export class BaseDatePickerCore {
410
437
  this._adapter.setHostAttribute(BASE_DATE_PICKER_CONSTANTS.observedAttributes.VALUE_MODE, this._valueMode);
411
438
  }
412
439
  }
440
+ get shortcuts() {
441
+ return this._shortcuts;
442
+ }
443
+ set shortcuts(value) {
444
+ if (value === 'off') {
445
+ this._shortcuts = {};
446
+ return;
447
+ }
448
+ this._shortcuts = Object.prototype.toString.call(value) === '[object Object]' ? value : undefined;
449
+ }
413
450
  get min() {
414
451
  return this._min ? new Date(this._min.getTime()) : null;
415
452
  }
416
453
  set min(value) {
417
454
  if (this._min !== value) {
418
455
  const date = this._coerceDateValue(value);
419
- this._min = !!date ? new Date(date.getTime()) : null;
456
+ this._min = date ? new Date(date.getTime()) : null;
420
457
  this._applyMin();
421
458
  if (this._isInitialized && this._open) {
422
459
  this._adapter.setCalendarMinDate(this._min);
@@ -538,6 +575,22 @@ export class BaseDatePickerCore {
538
575
  this._showMaskFormat = value;
539
576
  }
540
577
  }
578
+ get dateFormat() {
579
+ return this._dateFormat;
580
+ }
581
+ set dateFormat(value) {
582
+ if (typeof value !== 'string' || !BASE_DATE_PICKER_CONSTANTS.supportedDateFormats.includes(value)) {
583
+ this._dateFormat = BASE_DATE_PICKER_CONSTANTS.defaults.DATE_FORMAT;
584
+ }
585
+ if (this._dateFormat !== value) {
586
+ this._dateFormat = value;
587
+ // Automatically set the mask format based on the date format
588
+ this._maskFormat = value === BASE_DATE_PICKER_CONSTANTS.defaults.DATE_FORMAT ? DEFAULT_DATE_MASK : value;
589
+ if (this._isInitialized) {
590
+ this._applyMask();
591
+ }
592
+ }
593
+ }
541
594
  get notifyInputValueChanges() {
542
595
  return this._notifyInputValueChanges;
543
596
  }
@@ -3,4 +3,5 @@
3
3
  * Copyright Tyler Technologies, Inc.
4
4
  * License: Apache-2.0
5
5
  */
6
- export declare function createToggleElement(iconName: string): HTMLElement;
6
+ import { type IIconButtonComponent } from '../../icon-button/icon-button';
7
+ export declare function createToggleElement(iconName: string): IIconButtonComponent;
@@ -5,9 +5,9 @@
5
5
  */
6
6
  import { DayOfWeek } from '../../calendar/calendar-constants';
7
7
  import { BaseComponent, IBaseComponent } from '../../core/base/base-component';
8
- import { DatePickerFormatCallback, DatePickerParseCallback, DatePickerPrepareMaskCallback, DatePickerValueMode, IDatePickerCalendarDropdownText } from './base-date-picker-constants';
9
- import { BaseDatePickerCore } from './base-date-picker-core';
10
8
  import { IBaseDatePickerAdapter } from './base-date-picker-adapter';
9
+ import { DatePickerDateFormat, DatePickerFormatCallback, DatePickerParseCallback, DatePickerPrepareMaskCallback, DatePickerShortcuts, DatePickerValueMode, IDatePickerCalendarDropdownText } from './base-date-picker-constants';
10
+ import { BaseDatePickerCore } from './base-date-picker-core';
11
11
  export interface IBaseDatePickerComponent<TValue> extends IBaseComponent {
12
12
  value: TValue | null | undefined;
13
13
  min: Date | string | null | undefined;
@@ -23,7 +23,9 @@ export interface IBaseDatePickerComponent<TValue> extends IBaseComponent {
23
23
  masked: boolean;
24
24
  maskFormat: string;
25
25
  showMaskFormat: boolean;
26
+ dateFormat: DatePickerDateFormat;
26
27
  valueMode: DatePickerValueMode;
28
+ shortcuts: DatePickerShortcuts;
27
29
  notifyInputValueChanges: boolean;
28
30
  allowInvalidDate: boolean;
29
31
  showToday: boolean;
@@ -53,9 +55,11 @@ export interface IBaseDatePickerComponent<TValue> extends IBaseComponent {
53
55
  * @property {DatePickerPrepareMaskCallback} prepareMaskCallback - The callback to use when altering default mask entry.
54
56
  * @property {boolean} [showClear=false] - Whether the clear button is visible in the popup.
55
57
  * @property {boolean} [showMaskFormat=false] - Whether the mask format is displayed in the input or not. Only applies if `masked` is `true`.
58
+ * @property {DatePickerDateFormat} [dateFormat='MM/DD/YYYY'] - The date format to use for the date picker.
56
59
  * @property {boolean} [showToday=false] - Whether the today button is visible in the popup.
57
60
  * @property {TValue} value - The value of the date picker.
58
61
  * @property {DatePickerValueMode} valueMode - The type for the `value` property and `forge-date-picker-change` event.
62
+ * @property {DatePickerShortcuts} shortcuts - The shortcuts to use for the date picker. Can be an object with key-value pairs where the key is the shortcut name and the value is a function that returns a `Date` object.
59
63
  * @property {string} yearRange - The year range.
60
64
  *
61
65
  * @attribute {boolean} [allow-invalid-date=false] - Whether to allow an invalid date to be input. When true, the date picker will not clear out the value of the input if the date was invalid (i.e. could not be parsed).
@@ -71,8 +75,10 @@ export interface IBaseDatePickerComponent<TValue> extends IBaseComponent {
71
75
  * @attribute {string} [popup-classes] - The CSS classes that are applied to the popup element.
72
76
  * @attribute {boolean} [show-clear=false] - Whether the clear button is visible in the popup.
73
77
  * @attribute {boolean} [show-mask-format=false] - Whether the mask format is displayed in the input or not. Only applies if `masked` is `true`.
78
+ * @attribute {DatePickerDateFormat} [date-format=MM/DD/YYYY] - The date format to use for the date picker.
74
79
  * @attribute {boolean} [show-today=false] - Whether the today button is visible in the popup.
75
80
  * @attribute {DatePickerValueMode} [value-mode=string] - The type for the `value` property and `forge-date-picker-change` event.
81
+ * @attribute {DatePickerShortcuts} shortcuts - When specifies as an attribute you can only use the `off` value to disable shortcuts. Otherwise, you can use the `shortcuts` property to set your own shortcuts.
76
82
  * @attribute {string} [year-range] - The year range.
77
83
  */
78
84
  export declare abstract class BaseDatePickerComponent<TPublicValue, TPrivateValue, TCore extends BaseDatePickerCore<IBaseDatePickerAdapter, TPublicValue, TPrivateValue>> extends BaseComponent implements IBaseDatePickerComponent<TPublicValue> {
@@ -91,7 +97,9 @@ export declare abstract class BaseDatePickerComponent<TPublicValue, TPrivateValu
91
97
  masked: boolean;
92
98
  maskFormat: string;
93
99
  showMaskFormat: boolean;
100
+ dateFormat: DatePickerDateFormat;
94
101
  valueMode: DatePickerValueMode;
102
+ shortcuts: DatePickerShortcuts;
95
103
  notifyInputValueChanges: boolean;
96
104
  allowInvalidDate: boolean;
97
105
  showToday: boolean;
@@ -4,7 +4,7 @@
4
4
  * License: Apache-2.0
5
5
  */
6
6
  import { __decorate } from "tslib";
7
- import { coerceBoolean, ensureChild, coreProperty, coerceNumberArray } from '@tylertech/forge-core';
7
+ import { coerceBoolean, coerceNumberArray, coreProperty, ensureChild } from '@tylertech/forge-core';
8
8
  import { BaseComponent } from '../../core/base/base-component';
9
9
  import { BASE_DATE_PICKER_CONSTANTS } from './base-date-picker-constants';
10
10
  /**
@@ -27,9 +27,11 @@ import { BASE_DATE_PICKER_CONSTANTS } from './base-date-picker-constants';
27
27
  * @property {DatePickerPrepareMaskCallback} prepareMaskCallback - The callback to use when altering default mask entry.
28
28
  * @property {boolean} [showClear=false] - Whether the clear button is visible in the popup.
29
29
  * @property {boolean} [showMaskFormat=false] - Whether the mask format is displayed in the input or not. Only applies if `masked` is `true`.
30
+ * @property {DatePickerDateFormat} [dateFormat='MM/DD/YYYY'] - The date format to use for the date picker.
30
31
  * @property {boolean} [showToday=false] - Whether the today button is visible in the popup.
31
32
  * @property {TValue} value - The value of the date picker.
32
33
  * @property {DatePickerValueMode} valueMode - The type for the `value` property and `forge-date-picker-change` event.
34
+ * @property {DatePickerShortcuts} shortcuts - The shortcuts to use for the date picker. Can be an object with key-value pairs where the key is the shortcut name and the value is a function that returns a `Date` object.
33
35
  * @property {string} yearRange - The year range.
34
36
  *
35
37
  * @attribute {boolean} [allow-invalid-date=false] - Whether to allow an invalid date to be input. When true, the date picker will not clear out the value of the input if the date was invalid (i.e. could not be parsed).
@@ -45,8 +47,10 @@ import { BASE_DATE_PICKER_CONSTANTS } from './base-date-picker-constants';
45
47
  * @attribute {string} [popup-classes] - The CSS classes that are applied to the popup element.
46
48
  * @attribute {boolean} [show-clear=false] - Whether the clear button is visible in the popup.
47
49
  * @attribute {boolean} [show-mask-format=false] - Whether the mask format is displayed in the input or not. Only applies if `masked` is `true`.
50
+ * @attribute {DatePickerDateFormat} [date-format=MM/DD/YYYY] - The date format to use for the date picker.
48
51
  * @attribute {boolean} [show-today=false] - Whether the today button is visible in the popup.
49
52
  * @attribute {DatePickerValueMode} [value-mode=string] - The type for the `value` property and `forge-date-picker-change` event.
53
+ * @attribute {DatePickerShortcuts} shortcuts - When specifies as an attribute you can only use the `off` value to disable shortcuts. Otherwise, you can use the `shortcuts` property to set your own shortcuts.
50
54
  * @attribute {string} [year-range] - The year range.
51
55
  */
52
56
  export class BaseDatePickerComponent extends BaseComponent {
@@ -89,12 +93,18 @@ export class BaseDatePickerComponent extends BaseComponent {
89
93
  case BASE_DATE_PICKER_CONSTANTS.observedAttributes.SHOW_MASK_FORMAT:
90
94
  this.showMaskFormat = coerceBoolean(newValue);
91
95
  break;
96
+ case BASE_DATE_PICKER_CONSTANTS.observedAttributes.DATE_FORMAT:
97
+ this.dateFormat = newValue;
98
+ break;
92
99
  case BASE_DATE_PICKER_CONSTANTS.observedAttributes.MASK_FORMAT:
93
100
  this.maskFormat = newValue;
94
101
  break;
95
102
  case BASE_DATE_PICKER_CONSTANTS.observedAttributes.VALUE_MODE:
96
103
  this.valueMode = newValue;
97
104
  break;
105
+ case BASE_DATE_PICKER_CONSTANTS.observedAttributes.SHORTCUTS:
106
+ this.shortcuts = newValue === 'off' ? {} : undefined;
107
+ break;
98
108
  case BASE_DATE_PICKER_CONSTANTS.observedAttributes.ALLOW_INVALID_DATE:
99
109
  this.allowInvalidDate = coerceBoolean(newValue);
100
110
  break;
@@ -149,9 +159,15 @@ __decorate([
149
159
  __decorate([
150
160
  coreProperty()
151
161
  ], BaseDatePickerComponent.prototype, "showMaskFormat", void 0);
162
+ __decorate([
163
+ coreProperty()
164
+ ], BaseDatePickerComponent.prototype, "dateFormat", void 0);
152
165
  __decorate([
153
166
  coreProperty()
154
167
  ], BaseDatePickerComponent.prototype, "valueMode", void 0);
168
+ __decorate([
169
+ coreProperty()
170
+ ], BaseDatePickerComponent.prototype, "shortcuts", void 0);
155
171
  __decorate([
156
172
  coreProperty()
157
173
  ], BaseDatePickerComponent.prototype, "notifyInputValueChanges", void 0);
@@ -98,7 +98,7 @@ export class DatePickerAdapter extends BaseDatePickerAdapter {
98
98
  this._inputElement.setAttribute('aria-disabled', value.toString());
99
99
  if (this._toggleElement) {
100
100
  this._toggleElement.setAttribute('aria-disabled', value.toString());
101
- if (this._toggleElement.hasOwnProperty('disabled')) {
101
+ if (Object.prototype.hasOwnProperty.call(this._toggleElement, 'disabled')) {
102
102
  this._toggleElement.disabled = value;
103
103
  // The toggle element should never be in the tab order
104
104
  this._toggleElement.tabIndex = -1;
@@ -34,6 +34,7 @@ export class DatePickerCore extends BaseDatePickerCore {
34
34
  }
35
35
  _onToday() {
36
36
  const today = new Date();
37
+ today.setHours(0, 0, 0, 0);
37
38
  this._tryMergeCurrentTime(today);
38
39
  this._onDateSelected({ date: today, selected: true, type: 'date' });
39
40
  }
@@ -69,7 +70,7 @@ export class DatePickerCore extends BaseDatePickerCore {
69
70
  return;
70
71
  }
71
72
  const formattedValue = this._formatDate(value);
72
- this._adapter.setInputValue(formattedValue, this._notifyInputValueChanges);
73
+ this._adapter.setInputValue(formattedValue ?? '', this._notifyInputValueChanges);
73
74
  this._formatInputValue();
74
75
  if (!Platform.isMobile) {
75
76
  this._adapter.selectInputText();
@@ -78,7 +79,7 @@ export class DatePickerCore extends BaseDatePickerCore {
78
79
  _openCalendar(emitOpenEvent) {
79
80
  super._openCalendar(emitOpenEvent);
80
81
  const currentValue = this._getCurrentValue();
81
- if (!!currentValue) {
82
+ if (currentValue) {
82
83
  this._adapter.goToCalendarDate(new Date(currentValue));
83
84
  }
84
85
  }
@@ -8,6 +8,7 @@ import { IDateInputMaskOptions } from '../core/mask/date-input-mask';
8
8
  import { BaseDatePickerAdapter, IBaseDatePickerAdapter } from '../date-picker/base/base-date-picker-adapter';
9
9
  import { IDatePickerCalendarDropdownConfig } from '../date-picker/base/base-date-picker-constants';
10
10
  import { DateRangePickerComponent, IDateRangePickerComponent } from './date-range-picker';
11
+ import { IIconButtonComponent } from '../icon-button/icon-button';
11
12
  export interface IDateRangePickerAdapter extends IBaseDatePickerAdapter {
12
13
  initializeToMask(toOptions: IDateInputMaskOptions): void;
13
14
  addToInputListener(type: string, listener: (event: Event) => void): void;
@@ -58,7 +59,7 @@ export declare class DateRangePickerAdapter extends BaseDatePickerAdapter<IDateR
58
59
  setDisabled(isDisabled: boolean): void;
59
60
  emitInputEvent(type: string, data?: any): void;
60
61
  emitToInputEvent(type: string, data?: any): void;
61
- protected _createToggleElement(): HTMLElement;
62
+ protected _createToggleElement(): IIconButtonComponent;
62
63
  tryFocusInput(): void;
63
64
  tryBlurInput(): void;
64
65
  selectInputText(): void;
@@ -162,7 +162,7 @@ export class DateRangePickerAdapter extends BaseDatePickerAdapter {
162
162
  this._fromInputElement.setAttribute('aria-disabled', isDisabled.toString());
163
163
  if (this._toggleElement) {
164
164
  this._toggleElement.setAttribute('aria-disabled', isDisabled.toString());
165
- if (this._toggleElement.hasOwnProperty('disabled')) {
165
+ if (Object.prototype.hasOwnProperty.call(this._toggleElement, 'disabled')) {
166
166
  this._toggleElement.disabled = isDisabled;
167
167
  // The toggle element should never be in the tab order
168
168
  this._toggleElement.tabIndex = -1;
@@ -44,6 +44,7 @@ export declare class DateRangePickerCore extends BaseDatePickerCore<IDateRangePi
44
44
  protected _onDateSelected(event: ICalendarDateSelectEventData): void;
45
45
  protected _applyMin(): void;
46
46
  protected _applyMax(): void;
47
+ protected _applyMask(): void;
47
48
  protected _initializeToMask(): void;
48
49
  protected _applyDisabledDates(): void;
49
50
  protected _applyDisabledDaysOfWeek(): void;
@@ -55,10 +55,10 @@ export class DateRangePickerCore extends BaseDatePickerCore {
55
55
  this._formatToInputValue();
56
56
  super._openCalendar(emitOpenEvent);
57
57
  const currentValue = this._getCurrentValue();
58
- if (!!currentValue?.to) {
58
+ if (currentValue?.to) {
59
59
  this._adapter.goToCalendarDate(new Date(currentValue.to));
60
60
  }
61
- else if (!!currentValue?.from) {
61
+ else if (currentValue?.from) {
62
62
  this._adapter.goToCalendarDate(new Date(currentValue.from));
63
63
  }
64
64
  }
@@ -82,6 +82,7 @@ export class DateRangePickerCore extends BaseDatePickerCore {
82
82
  }
83
83
  _onToday() {
84
84
  const today = new Date();
85
+ today.setHours(0, 0, 0, 0);
85
86
  this._tryMergeCurrentTime({ from: today });
86
87
  const range = this._open ? new DateRange({ from: this._from || today, to: this._to || undefined }) : new DateRange({ from: today });
87
88
  if (!this._isDateRangeAcceptable(range)) {
@@ -125,14 +126,14 @@ export class DateRangePickerCore extends BaseDatePickerCore {
125
126
  }
126
127
  }
127
128
  _setFormattedInputValue(suppressValueChanges) {
128
- let formattedDate = this._formatDate(this._from);
129
+ let formattedDate = this._formatDate(this._from) ?? '';
129
130
  if (!formattedDate && !this._allowInvalidDate) {
130
131
  formattedDate = '';
131
132
  }
132
133
  this._adapter.setInputValue(formattedDate, suppressValueChanges ? false : this._notifyInputValueChanges);
133
134
  }
134
135
  _setFormattedToInputValue(suppressValueChanges) {
135
- let formattedDate = this._formatDate(this._to);
136
+ let formattedDate = this._formatDate(this._to) ?? '';
136
137
  if (!formattedDate && !this._allowInvalidDate) {
137
138
  formattedDate = '';
138
139
  }
@@ -180,8 +181,8 @@ export class DateRangePickerCore extends BaseDatePickerCore {
180
181
  }
181
182
  const formattedFromValue = this._formatDate((value && value.from) || null);
182
183
  const formattedToValue = this._formatDate((value && value.to) || null);
183
- this._adapter.setInputValue(formattedFromValue, this._notifyInputValueChanges);
184
- this._adapter.setToInputValue(formattedToValue, this._notifyInputValueChanges);
184
+ this._adapter.setInputValue(formattedFromValue ?? '', this._notifyInputValueChanges);
185
+ this._adapter.setToInputValue(formattedToValue ?? '', this._notifyInputValueChanges);
185
186
  this._formatInputValue();
186
187
  this._formatToInputValue();
187
188
  this._from = (value && value.from) || null;
@@ -217,6 +218,16 @@ export class DateRangePickerCore extends BaseDatePickerCore {
217
218
  }
218
219
  super._applyMax();
219
220
  }
221
+ _applyMask() {
222
+ super._applyMask();
223
+ if (this._masked) {
224
+ this._initializeToMask();
225
+ }
226
+ else {
227
+ this._adapter.destroyToMask();
228
+ this._formatToInputValue();
229
+ }
230
+ }
220
231
  _initializeToMask() {
221
232
  if (!this._masked) {
222
233
  return;
@@ -227,9 +238,7 @@ export class DateRangePickerCore extends BaseDatePickerCore {
227
238
  onChange: (value) => this._handleToInput(value)
228
239
  };
229
240
  if (this._prepareMaskCallback) {
230
- options.prepareCallback = (value, masked, flags, maskInstance) => {
231
- return this._prepareMaskCallback.call(null, value, masked, flags, maskInstance);
232
- };
241
+ options.prepareCallback = (value, masked, flags, maskInstance) => this._prepareMaskCallback.call(null, value, masked, flags, maskInstance);
233
242
  }
234
243
  this._adapter.initializeToMask(options);
235
244
  }
@@ -61,13 +61,14 @@ export class DeprecatedIconButtonComponentDelegate extends BaseComponentDelegate
61
61
  }
62
62
  const type = this._config.options?.iconType || 'component';
63
63
  switch (type) {
64
- case 'font':
64
+ case 'font': {
65
65
  const classes = Array.isArray(this._config.options.iconClass) ? this._config.options.iconClass : [ICON_CLASS_NAME];
66
66
  this._buttonElement?.classList.add(...classes);
67
67
  if (this._buttonElement) {
68
68
  this._buttonElement.textContent = this._config.options.iconName;
69
69
  }
70
70
  break;
71
+ }
71
72
  case 'component':
72
73
  this._iconElement = document.createElement(ICON_CONSTANTS.elementName);
73
74
  this._iconElement.name = this._config.options.iconName;
@@ -15,7 +15,7 @@ import { DialogAdapter } from './dialog-adapter';
15
15
  import { DIALOG_CONSTANTS, dialogStack, hideBackdrop, showBackdrop } from './dialog-constants';
16
16
  import { DialogCore } from './dialog-core';
17
17
  const template = '<template><dialog class=\"forge-dialog\" part=\"root\" aria-labelledby=\"forge-dialog-label\" aria-describedby=\"forge-dialog-description\"><div id=\"forge-dialog-label\" class=\"visually-hidden\"></div><div id=\"forge-dialog-description\" class=\"visually-hidden\"></div><forge-backdrop exportparts=\"root:backdrop\"></forge-backdrop><div class=\"surface\" part=\"surface\"><div class=\"move-handle-container\" part=\"move-handle-container\"><div class=\"move-handle\" part=\"move-handle\"><slot name=\"move-handle\"><svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\" aria-hidden=\"true\" part=\"move-handle-icon\"><path d=\"M3 15v-2h2v2H3m0-4V9h2v2H3m4 4v-2h2v2H7m0-4V9h2v2H7m4 4v-2h2v2h-2m0-4V9h2v2h-2m4 4v-2h2v2h-2m0-4V9h2v2h-2m4 4v-2h2v2h-2m0-4V9h2v2h-2z\"/></svg></slot></div></div><slot></slot></div></dialog></template>';
18
- const styles = '@keyframes forge-dialog-zoom-in{from{opacity:var(--_dialog-zoom-opacity);scale:var(--_dialog-zoom-scale)}to{opacity:1;scale:1}}@keyframes forge-dialog-zoom-out{from{opacity:1;scale:1}to{opacity:var(--_dialog-zoom-opacity);scale:var(--_dialog-zoom-scale)}}@keyframes forge-dialog-fade-in{from{opacity:var(--_dialog-fade-opacity)}to{opacity:1}}@keyframes forge-dialog-fade-out{from{opacity:1}to{opacity:var(--_dialog-fade-opacity)}}@keyframes forge-dialog-slide-in{from{opacity:var(--_dialog-slide-opacity);translate:var(--_dialog-slide-translate)}to{opacity:1;translate:0 0}}@keyframes forge-dialog-slide-out{from{opacity:1;translate:0 0}to{opacity:var(--_dialog-slide-opacity);translate:var(--_dialog-slide-translate)}}@layer base,nonmodal,animation,placement,size-strategy,preset,fullscreen,position-strategy,media; @layer base{:host{display:none;--forge-theme-surface:var(--forge-theme-surface-bright, #ffffff)}:host([hidden]){display:none}::slotted(forge-scaffold){height:auto}.forge-dialog{--_dialog-background:var(--forge-dialog-background, var(--forge-theme-surface-bright, #ffffff));--_dialog-shape:var(--forge-dialog-shape, calc(var(--forge-shape-medium, 4px) * var(--forge-shape-factor, 1)));--_dialog-elevation:var(--forge-dialog-elevation, 0px 11px 15px -7px rgba(0, 0, 0, 0.2), 0px 24px 38px 3px rgba(0, 0, 0, 0.14), 0px 9px 46px 8px rgba(0, 0, 0, 0.12));--_dialog-spacing:var(--forge-dialog-spacing, auto);--_dialog-block-start-spacing:var(--forge-dialog-block-start-spacing, var(--_dialog-spacing));--_dialog-block-end-spacing:var(--forge-dialog-block-end-spacing, var(--_dialog-spacing));--_dialog-inline-start-spacing:var(--forge-dialog-inline-start-spacing, var(--_dialog-spacing));--_dialog-inline-end-spacing:var(--forge-dialog-inline-end-spacing, var(--_dialog-spacing));--_dialog-padding:var(--forge-dialog-padding, 0);--_dialog-width:var(--forge-dialog-width, fit-content);--_dialog-height:var(--forge-dialog-height, fit-content);--_dialog-min-width:var(--forge-dialog-min-width, 0);--_dialog-max-width:var(--forge-dialog-max-width, calc(100% - var(--forge-spacing-xxlarge, 48px)));--_dialog-min-height:var(--forge-dialog-min-height, 0);--_dialog-max-height:var(--forge-dialog-max-height, calc(100% - var(--forge-spacing-xxlarge, 48px)));--_dialog-z-index:var(--forge-dialog-z-index, var(--forge-z-index-dialog, 8));--_dialog-move-handle-color:var(--forge-dialog-move-handle-color, currentColor);--_dialog-move-handle-size:var(--forge-dialog-move-handle-size, 24px);--_dialog-move-handle-hover-cursor:var(--forge-dialog-move-handle-hover-cursor, grab);--_dialog-move-handle-active-cursor:var(--forge-dialog-move-handle-active-cursor, grabbing);--_dialog-move-handle-spacing:var(--forge-dialog-move-handle-spacing, calc(var(--forge-spacing-xxsmall, 4px) * -1) 0 0);--_dialog-move-transition-duration:var(--forge-dialog-move-transition-duration, var(--forge-animation-duration-short4, 200ms));--_dialog-move-transition-easing:var(--forge-dialog-move-transition-easing, var(--forge-animation-easing-standard, cubic-bezier(0.2, 0, 0, 1)));--_dialog-moving-opacity:var(--forge-dialog-moving-opacity, 0.54);--_dialog-enter-animation-duration:var(--forge-dialog-enter-animation-duration, var(--forge-animation-duration-medium1, 250ms));--_dialog-enter-animation-easing:var(--forge-dialog-enter-animation-easing, var(--forge-animation-easing-standard, cubic-bezier(0.2, 0, 0, 1)));--_dialog-exit-animation-duration:var(--forge-dialog-exit-animation-duration, var(--forge-animation-duration-short2, 100ms));--_dialog-exit-animation-easing:var(--forge-dialog-exit-animation-easing, var(--forge-animation-easing-emphasized-accelerate, cubic-bezier(0.3, 0, 0.8, 0.15)));--_dialog-zoom-opacity:var(--forge-dialog-zoom-opacity, 0);--_dialog-zoom-scale:var(--forge-dialog-zoom-scale, 0.8);--_dialog-fade-opacity:var(--forge-dialog-fade-opacity, 0);--_dialog-slide-opacity:var(--forge-dialog-slide-opacity, 0);--_dialog-slide-translate:var(--forge-dialog-slide-translate, 0 -30%);--_dialog-backdrop-opacity:var(--forge-dialog-backdrop-opacity, var(--forge-backdrop-opacity, 0.54));--_dialog-nonmodal-elevation:var(--forge-dialog-nonmodal-elevation, 0px 2px 4px -1px rgba(0, 0, 0, 0.2), 0px 4px 5px 0px rgba(0, 0, 0, 0.14), 0px 1px 10px 0px rgba(0, 0, 0, 0.12));--_dialog-fullscreen-enter-animation-duration:var(--forge-dialog-fullscreen-enter-animation-duration, var(--forge-animation-duration-medium1, 250ms));--_dialog-fullscreen-exit-animation-duration:var(--forge-dialog-fullscreen-exit-animation-duration, var(--forge-animation-duration-short2, 100ms));--_dialog-position-x:var(--forge-dialog-position-x, 0);--_dialog-position-y:var(--forge-dialog-position-y, 0);--_dialog-preset-sheet-enter-animation-duration:var(--forge-dialog-preset-sheet-enter-animation-duration, var(--forge-animation-duration-medium1, 250ms));--_dialog-preset-sheet-exit-animation-duration:var(--forge-dialog-preset-sheet-exit-animation-duration, var(--forge-animation-duration-short3, 150ms))}.forge-dialog{position:fixed;inset:0;z-index:var(--_dialog-z-index);background-color:transparent;color:inherit;border:none;width:auto;height:auto;padding:0;margin:0;overflow:visible;max-width:100%;max-height:100%;box-sizing:border-box}.container{display:flex;justify-content:center;align-items:center;width:100%;height:100%}.surface{position:absolute;inset:0;display:flex;background:var(--_dialog-background);box-shadow:var(--_dialog-elevation);z-index:var(--_dialog-z-index);overflow:hidden;border-radius:var(--_dialog-shape);margin-block-start:var(--_dialog-block-start-spacing);margin-block-end:var(--_dialog-block-end-spacing);margin-inline-start:var(--_dialog-inline-start-spacing);margin-inline-end:var(--_dialog-inline-end-spacing);padding:var(--_dialog-padding);width:var(--_dialog-width);height:var(--_dialog-height);min-width:var(--_dialog-min-width);max-width:var(--_dialog-max-width);min-height:var(--_dialog-min-height);max-height:var(--_dialog-max-height);box-sizing:border-box}.visually-hidden{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:fixed;width:1px;outline:0;-webkit-appearance:none;-moz-appearance:none}dialog.forge-dialog::backdrop{display:none}forge-backdrop{--forge-backdrop-opacity:var(--_dialog-backdrop-opacity);--forge-backdrop-enter-animation-duration:var(--_dialog-enter-animation-duration);--forge-backdrop-enter-animation-easing:var(--_dialog-enter-animation-easing);--forge-backdrop-exit-animation-duration:var(--_dialog-exit-animation-duration);--forge-backdrop-exit-animation-easing:var(--_dialog-exit-animation-easing)}:host(:not([moveable])) .move-handle{display:none}:host([moveable]:not([fullscreen])) .surface{user-select:none;transition-property:opacity;transition-duration:var(--_dialog-move-transition-duration);transition-timing-function:var(--_dialog-move-transition-easing)}:host([moveable]:not([fullscreen])) .surface:not(:hover) .move-handle-container{display:none}:host([moveable]:not([fullscreen])) .surface.moved{margin:0}:host([moveable]:not([fullscreen])) .surface.moving{opacity:var(--_dialog-moving-opacity)}:host([moveable]:not([fullscreen])) .move-handle-container{position:absolute;top:0;z-index:1;display:flex;justify-content:center;width:100%}:host([moveable]:not([fullscreen])) .move-handle-container .move-handle{fill:var(--_dialog-move-handle-color);height:var(--_dialog-move-handle-size);width:var(--_dialog-move-handle-size);margin:var(--_dialog-move-handle-spacing);touch-action:none}:host([moveable]:not([fullscreen])) .move-handle-container .move-handle:hover{cursor:var(--_dialog-move-handle-hover-cursor)}:host([moveable]:not([fullscreen])) .move-handle-container .move-handle:active{cursor:var(--_dialog-move-handle-active-cursor)}:host([moveable]:not([fullscreen])) .move-handle-container .move-handle svg{fill:currentColor}:host([visible]){display:contents}}@layer nonmodal{:host([mode=nonmodal]) .forge-dialog{pointer-events:none}:host([mode=nonmodal]) .container{display:contents}:host([mode=nonmodal]) .surface{--_dialog-elevation:var(--_dialog-nonmodal-elevation);pointer-events:all}:host([mode=nonmodal]) forge-backdrop{display:none}}@layer animation{:host([visible]:not([animation-type=none])) dialog.forge-dialog[open] .surface{animation-duration:var(--_dialog-enter-animation-duration);animation-timing-function:var(--_dialog-enter-animation-easing)}:host([visible]:not([animation-type=none])) dialog.forge-dialog[open] .surface.exiting{animation-duration:var(--_dialog-exit-animation-duration);animation-timing-function:var(--_dialog-exit-animation-easing)}:host([visible]:not([animation-type=none]):is(:not([animation-type]),[animation-type=zoom])) dialog.forge-dialog[open] .surface{animation-name:forge-dialog-zoom-in}:host([visible]:not([animation-type=none]):is(:not([animation-type]),[animation-type=zoom])) dialog.forge-dialog[open] .surface.exiting{animation-name:forge-dialog-zoom-out}:host([visible]:not([animation-type=none])[animation-type=fade]) dialog.forge-dialog[open] .surface{animation-name:forge-dialog-fade-in}:host([visible]:not([animation-type=none])[animation-type=fade]) dialog.forge-dialog[open] .surface.exiting{animation-name:forge-dialog-fade-out}:host([visible]:not([animation-type=none])[animation-type=slide]) dialog.forge-dialog[open] .surface{animation-name:forge-dialog-slide-in}:host([visible]:not([animation-type=none])[animation-type=slide]) dialog.forge-dialog[open] .surface.exiting{animation-name:forge-dialog-slide-out}}@layer placement{:host([placement=custom]) .surface{margin:0;top:var(--_dialog-position-x);left:var(--_dialog-position-y)}:host([placement=top]) .surface{--_dialog-block-start-spacing:var(--forge-dialog-block-start-spacing, 0);top:0;bottom:auto}:host([placement=top-right]) .surface{--_dialog-spacing:var(--forge-dialog-spacing, 0);top:0;left:auto;right:0;bottom:auto}:host([placement=top-left]) .surface{--_dialog-spacing:var(--forge-dialog-spacing, 0);top:0;left:0;right:auto;bottom:auto}:host([placement=bottom]) .surface{--_dialog-block-end-spacing:var(--forge-dialog-block-end-spacing, 0);top:auto;bottom:0}:host([placement=bottom-right]) .surface{--_dialog-spacing:var(--forge-dialog-spacing, 0);top:auto;left:auto;right:0;bottom:0}:host([placement=bottom-left]) .surface{--_dialog-spacing:var(--forge-dialog-spacing, 0);top:auto;left:0;right:auto;bottom:0}}@layer size-strategy{:host([size-strategy=container-inline]) .surface{width:100%}:host([size-strategy=container-block]) .surface{height:100%}}@layer preset{:host([visible]:not([animation-type=none]):is([preset=left-sheet],[preset=right-sheet],[preset=top-sheet],[preset=bottom-sheet])) .forge-dialog{--_dialog-enter-animation-duration:var(--_dialog-preset-sheet-enter-animation-duration);--_dialog-exit-animation-duration:var(--_dialog-preset-sheet-exit-animation-duration)}:host([visible]:not([animation-type=none]):is([preset=left-sheet],[preset=right-sheet],[preset=top-sheet],[preset=bottom-sheet])) .surface{animation-name:forge-dialog-slide-in}:host([visible]:not([animation-type=none]):is([preset=left-sheet],[preset=right-sheet],[preset=top-sheet],[preset=bottom-sheet])) .surface.exiting{animation-name:forge-dialog-slide-out}:host(:is([preset=left-sheet],[preset=right-sheet],[preset=top-sheet],[preset=bottom-sheet])) .surface{--_dialog-max-width:var(--forge-dialog-max-width, none);--_dialog-max-height:var(--forge-dialog-max-height, none);inset:auto;display:inline-flex}:host([preset=left-sheet]) .forge-dialog{--_dialog-slide-translate:var(--forge-dialog-slide-translate, -100% 0)}:host([preset=left-sheet]) .surface{left:0;bottom:0;top:0;height:100%;border-top-left-radius:0;border-bottom-left-radius:0}:host([preset=right-sheet]) .forge-dialog{--_dialog-slide-translate:var(--forge-dialog-slide-translate, 100% 0)}:host([preset=right-sheet]) .surface{right:0;bottom:0;top:0;height:100%;border-top-right-radius:0;border-bottom-right-radius:0}:host([preset=top-sheet]) .forge-dialog{--_dialog-slide-translate:var(--forge-dialog-slide-translate, 0 -100%)}:host([preset=top-sheet]) .surface{top:0;left:0;right:0;border-top-left-radius:0;border-top-right-radius:0}:host([preset=bottom-sheet]) .forge-dialog{--_dialog-slide-translate:var(--forge-dialog-slide-translate, 0 100%)}:host([preset=bottom-sheet]) .surface{bottom:0;left:0;right:0;border-bottom-left-radius:0;border-bottom-right-radius:0}}@layer fullscreen{:host([fullscreen]) .forge-dialog{--_dialog-enter-animation-duration:var(--_dialog-fullscreen-enter-animation-duration);--_dialog-exit-animation-duration:var(--_dialog-fullscreen-exit-animation-duration)}:host([fullscreen]) .surface{height:100%;width:100%;max-width:none;max-height:none;border-radius:0;box-shadow:none}:host([fullscreen]) forge-backdrop{display:none}}@layer position-strategy{:host([position-strategy=viewport]) .forge-dialog{position:fixed}:host([position-strategy=container]) .forge-dialog{position:absolute}:host([position-strategy=container][preset$=-sheet]) .forge-dialog{contain:content}}@layer media{@media (prefers-reduced-motion:reduce){.surface{animation-name:forge-dialog-fade-in}.surface.exiting{animation-name:forge-dialog-fade-out}}}';
18
+ const styles = '@keyframes forge-dialog-zoom-in{from{opacity:var(--_dialog-zoom-opacity);scale:var(--_dialog-zoom-scale)}to{opacity:1;scale:1}}@keyframes forge-dialog-zoom-out{from{opacity:1;scale:1}to{opacity:var(--_dialog-zoom-opacity);scale:var(--_dialog-zoom-scale)}}@keyframes forge-dialog-fade-in{from{opacity:var(--_dialog-fade-opacity)}to{opacity:1}}@keyframes forge-dialog-fade-out{from{opacity:1}to{opacity:var(--_dialog-fade-opacity)}}@keyframes forge-dialog-slide-in{from{opacity:var(--_dialog-slide-opacity);translate:var(--_dialog-slide-translate)}to{opacity:1;translate:0 0}}@keyframes forge-dialog-slide-out{from{opacity:1;translate:0 0}to{opacity:var(--_dialog-slide-opacity);translate:var(--_dialog-slide-translate)}}@layer base,nonmodal,animation,placement,size-strategy,preset,fullscreen,position-strategy,media; @layer base{:host{display:none;--forge-theme-surface:var(--forge-theme-surface-bright, #ffffff)}:host([hidden]){display:none}::slotted(forge-scaffold){height:auto}.forge-dialog{--_dialog-background:var(--forge-dialog-background, var(--forge-theme-surface-bright, #ffffff));--_dialog-shape:var(--forge-dialog-shape, calc(var(--forge-shape-medium, 4px) * var(--forge-shape-factor, 1)));--_dialog-elevation:var(--forge-dialog-elevation, 0px 11px 15px -7px rgba(0, 0, 0, 0.2), 0px 24px 38px 3px rgba(0, 0, 0, 0.14), 0px 9px 46px 8px rgba(0, 0, 0, 0.12));--_dialog-spacing:var(--forge-dialog-spacing, auto);--_dialog-block-start-spacing:var(--forge-dialog-block-start-spacing, var(--_dialog-spacing));--_dialog-block-end-spacing:var(--forge-dialog-block-end-spacing, var(--_dialog-spacing));--_dialog-inline-start-spacing:var(--forge-dialog-inline-start-spacing, var(--_dialog-spacing));--_dialog-inline-end-spacing:var(--forge-dialog-inline-end-spacing, var(--_dialog-spacing));--_dialog-padding:var(--forge-dialog-padding, 0);--_dialog-width:var(--forge-dialog-width, fit-content);--_dialog-height:var(--forge-dialog-height, fit-content);--_dialog-min-width:var(--forge-dialog-min-width, 0);--_dialog-max-width:var(--forge-dialog-max-width, calc(100% - var(--forge-spacing-xxlarge, 48px)));--_dialog-min-height:var(--forge-dialog-min-height, 0);--_dialog-max-height:var(--forge-dialog-max-height, calc(100% - var(--forge-spacing-xxlarge, 48px)));--_dialog-z-index:var(--forge-dialog-z-index, var(--forge-z-index-dialog, 8));--_dialog-move-handle-color:var(--forge-dialog-move-handle-color, currentColor);--_dialog-move-handle-size:var(--forge-dialog-move-handle-size, 24px);--_dialog-move-handle-hover-cursor:var(--forge-dialog-move-handle-hover-cursor, grab);--_dialog-move-handle-active-cursor:var(--forge-dialog-move-handle-active-cursor, grabbing);--_dialog-move-handle-spacing:var(--forge-dialog-move-handle-spacing, calc(var(--forge-spacing-xxsmall, 4px) * -1) 0 0);--_dialog-move-transition-duration:var(--forge-dialog-move-transition-duration, var(--forge-animation-duration-short4, 200ms));--_dialog-move-transition-easing:var(--forge-dialog-move-transition-easing, var(--forge-animation-easing-standard, cubic-bezier(0.2, 0, 0, 1)));--_dialog-moving-opacity:var(--forge-dialog-moving-opacity, 0.54);--_dialog-enter-animation-duration:var(--forge-dialog-enter-animation-duration, var(--forge-animation-duration-medium1, 250ms));--_dialog-enter-animation-easing:var(--forge-dialog-enter-animation-easing, var(--forge-animation-easing-standard, cubic-bezier(0.2, 0, 0, 1)));--_dialog-exit-animation-duration:var(--forge-dialog-exit-animation-duration, var(--forge-animation-duration-short2, 100ms));--_dialog-exit-animation-easing:var(--forge-dialog-exit-animation-easing, var(--forge-animation-easing-emphasized-accelerate, cubic-bezier(0.3, 0, 0.8, 0.15)));--_dialog-zoom-opacity:var(--forge-dialog-zoom-opacity, 0);--_dialog-zoom-scale:var(--forge-dialog-zoom-scale, 0.8);--_dialog-fade-opacity:var(--forge-dialog-fade-opacity, 0);--_dialog-slide-opacity:var(--forge-dialog-slide-opacity, 0);--_dialog-slide-translate:var(--forge-dialog-slide-translate, 0 -30%);--_dialog-backdrop-opacity:var(--forge-dialog-backdrop-opacity, var(--forge-backdrop-opacity, 0.54));--_dialog-nonmodal-elevation:var(--forge-dialog-nonmodal-elevation, 0px 2px 4px -1px rgba(0, 0, 0, 0.2), 0px 4px 5px 0px rgba(0, 0, 0, 0.14), 0px 1px 10px 0px rgba(0, 0, 0, 0.12));--_dialog-fullscreen-enter-animation-duration:var(--forge-dialog-fullscreen-enter-animation-duration, var(--forge-animation-duration-medium1, 250ms));--_dialog-fullscreen-exit-animation-duration:var(--forge-dialog-fullscreen-exit-animation-duration, var(--forge-animation-duration-short2, 100ms));--_dialog-position-x:var(--forge-dialog-position-x, 0);--_dialog-position-y:var(--forge-dialog-position-y, 0);--_dialog-preset-sheet-enter-animation-duration:var(--forge-dialog-preset-sheet-enter-animation-duration, var(--forge-animation-duration-medium1, 250ms));--_dialog-preset-sheet-exit-animation-duration:var(--forge-dialog-preset-sheet-exit-animation-duration, var(--forge-animation-duration-short3, 150ms))}.forge-dialog{position:fixed;inset:0;z-index:var(--_dialog-z-index);background-color:transparent;color:inherit;border:none;width:auto;height:auto;padding:0;margin:0;overflow:visible;max-width:100%;max-height:100%;box-sizing:border-box}.container{display:flex;justify-content:center;align-items:center;width:100%;height:100%}.surface{position:absolute;inset:0;display:flex;background:var(--_dialog-background);box-shadow:var(--_dialog-elevation);z-index:var(--_dialog-z-index);overflow:hidden;border-radius:var(--_dialog-shape);margin-block-start:var(--_dialog-block-start-spacing);margin-block-end:var(--_dialog-block-end-spacing);margin-inline-start:var(--_dialog-inline-start-spacing);margin-inline-end:var(--_dialog-inline-end-spacing);padding:var(--_dialog-padding);width:var(--_dialog-width);height:var(--_dialog-height);min-width:var(--_dialog-min-width);max-width:var(--_dialog-max-width);min-height:var(--_dialog-min-height);max-height:var(--_dialog-max-height);box-sizing:border-box}.visually-hidden{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);clip-path:inset(50%);white-space:nowrap;border:0}dialog.forge-dialog::backdrop{display:none}forge-backdrop{--forge-backdrop-opacity:var(--_dialog-backdrop-opacity);--forge-backdrop-enter-animation-duration:var(--_dialog-enter-animation-duration);--forge-backdrop-enter-animation-easing:var(--_dialog-enter-animation-easing);--forge-backdrop-exit-animation-duration:var(--_dialog-exit-animation-duration);--forge-backdrop-exit-animation-easing:var(--_dialog-exit-animation-easing)}:host(:not([moveable])) .move-handle{display:none}:host([moveable]:not([fullscreen])) .surface{user-select:none;transition-property:opacity;transition-duration:var(--_dialog-move-transition-duration);transition-timing-function:var(--_dialog-move-transition-easing)}:host([moveable]:not([fullscreen])) .surface:not(:hover) .move-handle-container{display:none}:host([moveable]:not([fullscreen])) .surface.moved{margin:0}:host([moveable]:not([fullscreen])) .surface.moving{opacity:var(--_dialog-moving-opacity)}:host([moveable]:not([fullscreen])) .move-handle-container{position:absolute;top:0;z-index:1;display:flex;justify-content:center;width:100%}:host([moveable]:not([fullscreen])) .move-handle-container .move-handle{fill:var(--_dialog-move-handle-color);height:var(--_dialog-move-handle-size);width:var(--_dialog-move-handle-size);margin:var(--_dialog-move-handle-spacing);touch-action:none}:host([moveable]:not([fullscreen])) .move-handle-container .move-handle:hover{cursor:var(--_dialog-move-handle-hover-cursor)}:host([moveable]:not([fullscreen])) .move-handle-container .move-handle:active{cursor:var(--_dialog-move-handle-active-cursor)}:host([moveable]:not([fullscreen])) .move-handle-container .move-handle svg{fill:currentColor}:host([visible]){display:contents}}@layer nonmodal{:host([mode=nonmodal]) .forge-dialog{pointer-events:none}:host([mode=nonmodal]) .container{display:contents}:host([mode=nonmodal]) .surface{--_dialog-elevation:var(--_dialog-nonmodal-elevation);pointer-events:all}:host([mode=nonmodal]) forge-backdrop{display:none}}@layer animation{:host([visible]:not([animation-type=none])) dialog.forge-dialog[open] .surface{animation-duration:var(--_dialog-enter-animation-duration);animation-timing-function:var(--_dialog-enter-animation-easing)}:host([visible]:not([animation-type=none])) dialog.forge-dialog[open] .surface.exiting{animation-duration:var(--_dialog-exit-animation-duration);animation-timing-function:var(--_dialog-exit-animation-easing)}:host([visible]:not([animation-type=none]):is(:not([animation-type]),[animation-type=zoom])) dialog.forge-dialog[open] .surface{animation-name:forge-dialog-zoom-in}:host([visible]:not([animation-type=none]):is(:not([animation-type]),[animation-type=zoom])) dialog.forge-dialog[open] .surface.exiting{animation-name:forge-dialog-zoom-out}:host([visible]:not([animation-type=none])[animation-type=fade]) dialog.forge-dialog[open] .surface{animation-name:forge-dialog-fade-in}:host([visible]:not([animation-type=none])[animation-type=fade]) dialog.forge-dialog[open] .surface.exiting{animation-name:forge-dialog-fade-out}:host([visible]:not([animation-type=none])[animation-type=slide]) dialog.forge-dialog[open] .surface{animation-name:forge-dialog-slide-in}:host([visible]:not([animation-type=none])[animation-type=slide]) dialog.forge-dialog[open] .surface.exiting{animation-name:forge-dialog-slide-out}}@layer placement{:host([placement=custom]) .surface{margin:0;top:var(--_dialog-position-x);left:var(--_dialog-position-y)}:host([placement=top]) .surface{--_dialog-block-start-spacing:var(--forge-dialog-block-start-spacing, 0);top:0;bottom:auto}:host([placement=top-right]) .surface{--_dialog-spacing:var(--forge-dialog-spacing, 0);top:0;left:auto;right:0;bottom:auto}:host([placement=top-left]) .surface{--_dialog-spacing:var(--forge-dialog-spacing, 0);top:0;left:0;right:auto;bottom:auto}:host([placement=bottom]) .surface{--_dialog-block-end-spacing:var(--forge-dialog-block-end-spacing, 0);top:auto;bottom:0}:host([placement=bottom-right]) .surface{--_dialog-spacing:var(--forge-dialog-spacing, 0);top:auto;left:auto;right:0;bottom:0}:host([placement=bottom-left]) .surface{--_dialog-spacing:var(--forge-dialog-spacing, 0);top:auto;left:0;right:auto;bottom:0}}@layer size-strategy{:host([size-strategy=container-inline]) .surface{width:100%}:host([size-strategy=container-block]) .surface{height:100%}}@layer preset{:host([visible]:not([animation-type=none]):is([preset=left-sheet],[preset=right-sheet],[preset=top-sheet],[preset=bottom-sheet])) .forge-dialog{--_dialog-enter-animation-duration:var(--_dialog-preset-sheet-enter-animation-duration);--_dialog-exit-animation-duration:var(--_dialog-preset-sheet-exit-animation-duration)}:host([visible]:not([animation-type=none]):is([preset=left-sheet],[preset=right-sheet],[preset=top-sheet],[preset=bottom-sheet])) .surface{animation-name:forge-dialog-slide-in}:host([visible]:not([animation-type=none]):is([preset=left-sheet],[preset=right-sheet],[preset=top-sheet],[preset=bottom-sheet])) .surface.exiting{animation-name:forge-dialog-slide-out}:host(:is([preset=left-sheet],[preset=right-sheet],[preset=top-sheet],[preset=bottom-sheet])) .surface{--_dialog-max-width:var(--forge-dialog-max-width, none);--_dialog-max-height:var(--forge-dialog-max-height, none);inset:auto;display:inline-flex}:host([preset=left-sheet]) .forge-dialog{--_dialog-slide-translate:var(--forge-dialog-slide-translate, -100% 0)}:host([preset=left-sheet]) .surface{left:0;bottom:0;top:0;height:100%;border-top-left-radius:0;border-bottom-left-radius:0}:host([preset=right-sheet]) .forge-dialog{--_dialog-slide-translate:var(--forge-dialog-slide-translate, 100% 0)}:host([preset=right-sheet]) .surface{right:0;bottom:0;top:0;height:100%;border-top-right-radius:0;border-bottom-right-radius:0}:host([preset=top-sheet]) .forge-dialog{--_dialog-slide-translate:var(--forge-dialog-slide-translate, 0 -100%)}:host([preset=top-sheet]) .surface{top:0;left:0;right:0;border-top-left-radius:0;border-top-right-radius:0}:host([preset=bottom-sheet]) .forge-dialog{--_dialog-slide-translate:var(--forge-dialog-slide-translate, 0 100%)}:host([preset=bottom-sheet]) .surface{bottom:0;left:0;right:0;border-bottom-left-radius:0;border-bottom-right-radius:0}}@layer fullscreen{:host([fullscreen]) .forge-dialog{--_dialog-enter-animation-duration:var(--_dialog-fullscreen-enter-animation-duration);--_dialog-exit-animation-duration:var(--_dialog-fullscreen-exit-animation-duration)}:host([fullscreen]) .surface{height:100%;width:100%;max-width:none;max-height:none;border-radius:0;box-shadow:none}:host([fullscreen]) forge-backdrop{display:none}}@layer position-strategy{:host([position-strategy=viewport]) .forge-dialog{position:fixed}:host([position-strategy=container]) .forge-dialog{position:absolute}:host([position-strategy=container][preset$=-sheet]) .forge-dialog{contain:content}}@layer media{@media (prefers-reduced-motion:reduce){.surface{animation-name:forge-dialog-fade-in}.surface.exiting{animation-name:forge-dialog-fade-out}}}';
19
19
  /**
20
20
  * @tag forge-dialog
21
21
  *
@@ -21,6 +21,7 @@ export declare class ExpansionPanelCore implements IExpansionPanelCore {
21
21
  private _trigger;
22
22
  private _clickListener;
23
23
  private _keydownListener;
24
+ private _keyupListener;
24
25
  private _animationCompleteListener;
25
26
  private _slotListener;
26
27
  constructor(_adapter: IExpansionPanelAdapter);
@@ -31,6 +32,9 @@ export declare class ExpansionPanelCore implements IExpansionPanelCore {
31
32
  private _syncTrigger;
32
33
  private _onClick;
33
34
  private _onKeydown;
35
+ private _onKeyup;
36
+ private _tryToggle;
37
+ private _canIgnoreEvent;
34
38
  private _onAnimationComplete;
35
39
  private _togglePanel;
36
40
  dispatchToggleEvent(): void;
@@ -14,12 +14,14 @@ export class ExpansionPanelCore {
14
14
  this._trigger = '';
15
15
  this._clickListener = this._onClick.bind(this);
16
16
  this._keydownListener = this._onKeydown.bind(this);
17
+ this._keyupListener = this._onKeyup.bind(this);
17
18
  this._animationCompleteListener = this._onAnimationComplete.bind(this);
18
19
  this._slotListener = this._handleContentSlotChange.bind(this);
19
20
  }
20
21
  async initialize() {
21
22
  this._adapter.addHeaderListener('click', this._clickListener);
22
23
  this._adapter.addHeaderListener('keydown', this._keydownListener);
24
+ this._adapter.addHeaderListener('keyup', this._keyupListener);
23
25
  this._adapter.setAnimationCompleteListener(this._animationCompleteListener);
24
26
  this._adapter.addContentSlotListener(this._slotListener);
25
27
  this._adapter.setContentId();
@@ -54,25 +56,31 @@ export class ExpansionPanelCore {
54
56
  this._adapter.removeTriggerListeners({ reset: true });
55
57
  this._adapter.addTriggerListener('click', this._clickListener);
56
58
  this._adapter.addTriggerListener('keydown', this._keydownListener);
59
+ this._adapter.addTriggerListener('keyup', this._keyupListener);
57
60
  }
58
61
  _onClick(evt) {
59
- const fromIgnoredEl = evt
60
- .composedPath()
61
- .find((el) => el.nodeType === Node.ELEMENT_NODE && el.matches(EXPANSION_PANEL_CONSTANTS.selectors.IGNORE));
62
- if (fromIgnoredEl) {
62
+ this._tryToggle(evt);
63
+ }
64
+ _onKeydown(evt) {
65
+ if (evt.key === ' ' || evt.key === 'Enter') {
66
+ evt.preventDefault();
67
+ }
68
+ }
69
+ _onKeyup(evt) {
70
+ if (evt.key === ' ' || evt.key === 'Enter') {
71
+ this._tryToggle(evt);
72
+ }
73
+ }
74
+ _tryToggle(evt) {
75
+ if (this._canIgnoreEvent(evt)) {
63
76
  return;
64
77
  }
65
78
  evt.stopPropagation();
66
79
  this._toggle();
67
80
  this.dispatchToggleEvent();
68
81
  }
69
- _onKeydown(evt) {
70
- if (evt.key === ' ' || evt.key === 'Enter') {
71
- evt.stopPropagation();
72
- evt.preventDefault();
73
- this._toggle();
74
- this.dispatchToggleEvent();
75
- }
82
+ _canIgnoreEvent(evt) {
83
+ return evt.composedPath().some((el) => el.nodeType === Node.ELEMENT_NODE && el.matches(EXPANSION_PANEL_CONSTANTS.selectors.IGNORE));
76
84
  }
77
85
  _onAnimationComplete() {
78
86
  if (!this._open) {
@@ -46,8 +46,9 @@ export class FieldCore {
46
46
  _onPopoverIconMousedown(evt) {
47
47
  const popoverEvent = new CustomEvent(FIELD_CONSTANTS.events.POPOVER_ICON_MOUSEDOWN, { bubbles: true, composed: true, cancelable: true });
48
48
  this._adapter.dispatchHostEvent(popoverEvent);
49
- if (popoverEvent.defaultPrevented)
49
+ if (popoverEvent.defaultPrevented) {
50
50
  evt.preventDefault();
51
+ }
51
52
  }
52
53
  floatLabelWithoutAnimation(value) {
53
54
  if (this._floatLabel !== value) {