@tylertech/forge 2.13.0-next.0 → 2.13.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.
Files changed (128) hide show
  1. package/README.md +1 -1
  2. package/custom-elements.json +117 -108
  3. package/dist/esm/app-bar/help-button/index.js +1 -1
  4. package/dist/esm/app-bar/index.js +1 -1
  5. package/dist/esm/autocomplete/index.js +1 -1
  6. package/dist/esm/bottom-sheet/index.js +1 -1
  7. package/dist/esm/chip-field/index.js +1 -1
  8. package/dist/esm/chunks/{chunk.32SMESZX.js → chunk.4RNKUXN3.js} +2 -2
  9. package/dist/esm/chunks/{chunk.32SMESZX.js.map → chunk.4RNKUXN3.js.map} +0 -0
  10. package/dist/esm/chunks/{chunk.Z5P6EA5L.js → chunk.6QMDYUVT.js} +2 -2
  11. package/dist/esm/chunks/{chunk.Z5P6EA5L.js.map → chunk.6QMDYUVT.js.map} +0 -0
  12. package/dist/esm/chunks/{chunk.WUIIZZQD.js → chunk.6VYFW76H.js} +2 -2
  13. package/dist/esm/chunks/{chunk.WUIIZZQD.js.map → chunk.6VYFW76H.js.map} +0 -0
  14. package/dist/esm/chunks/{chunk.D3DLVPPE.js → chunk.73G2CH2D.js} +2 -2
  15. package/dist/esm/chunks/{chunk.D3DLVPPE.js.map → chunk.73G2CH2D.js.map} +0 -0
  16. package/dist/esm/chunks/chunk.75LTLEZ7.js +7 -0
  17. package/dist/esm/chunks/chunk.75LTLEZ7.js.map +7 -0
  18. package/dist/esm/chunks/{chunk.G5Q2CUUE.js → chunk.AVIF5W7A.js} +2 -2
  19. package/dist/esm/chunks/{chunk.G5Q2CUUE.js.map → chunk.AVIF5W7A.js.map} +0 -0
  20. package/dist/esm/chunks/{chunk.KGW63HJX.js → chunk.CNL6EUCO.js} +2 -2
  21. package/dist/esm/chunks/{chunk.KGW63HJX.js.map → chunk.CNL6EUCO.js.map} +0 -0
  22. package/dist/esm/chunks/{chunk.K32ME33N.js → chunk.D3LMXSX6.js} +2 -2
  23. package/dist/esm/chunks/{chunk.K32ME33N.js.map → chunk.D3LMXSX6.js.map} +0 -0
  24. package/dist/esm/chunks/{chunk.E4ZTNVXI.js → chunk.DPCNIOLL.js} +2 -2
  25. package/dist/esm/chunks/{chunk.E4ZTNVXI.js.map → chunk.DPCNIOLL.js.map} +0 -0
  26. package/dist/esm/chunks/chunk.EJ4ASQET.js +7 -0
  27. package/dist/esm/chunks/chunk.EJ4ASQET.js.map +7 -0
  28. package/dist/esm/chunks/{chunk.F3W3XMGT.js → chunk.ELS7SQAV.js} +2 -2
  29. package/dist/esm/chunks/{chunk.F3W3XMGT.js.map → chunk.ELS7SQAV.js.map} +0 -0
  30. package/dist/esm/chunks/{chunk.DML4YNQF.js → chunk.HSJQA42U.js} +2 -2
  31. package/dist/esm/chunks/{chunk.DML4YNQF.js.map → chunk.HSJQA42U.js.map} +2 -2
  32. package/dist/esm/chunks/{chunk.DGOV5RDW.js → chunk.HUWXZ4ZN.js} +2 -2
  33. package/dist/esm/chunks/{chunk.DGOV5RDW.js.map → chunk.HUWXZ4ZN.js.map} +2 -2
  34. package/dist/esm/chunks/chunk.KLK2FBDP.js +7 -0
  35. package/dist/esm/chunks/chunk.KLK2FBDP.js.map +7 -0
  36. package/dist/esm/chunks/{chunk.NTFA7FCB.js → chunk.LV7GGIUI.js} +2 -2
  37. package/dist/esm/chunks/{chunk.NTFA7FCB.js.map → chunk.LV7GGIUI.js.map} +0 -0
  38. package/dist/esm/chunks/{chunk.VH3PVW2V.js → chunk.NLZKJ53B.js} +2 -2
  39. package/dist/esm/chunks/{chunk.VH3PVW2V.js.map → chunk.NLZKJ53B.js.map} +0 -0
  40. package/dist/esm/chunks/chunk.NNGE722W.js +7 -0
  41. package/dist/esm/chunks/chunk.NNGE722W.js.map +7 -0
  42. package/dist/esm/chunks/{chunk.2ZSAAJDN.js → chunk.O4Y6QT46.js} +2 -2
  43. package/dist/esm/chunks/{chunk.2ZSAAJDN.js.map → chunk.O4Y6QT46.js.map} +0 -0
  44. package/dist/esm/chunks/chunk.QOZLQPKE.js +7 -0
  45. package/dist/esm/chunks/chunk.QOZLQPKE.js.map +7 -0
  46. package/dist/esm/chunks/{chunk.SZL74RTY.js → chunk.VWSC3NDJ.js} +2 -2
  47. package/dist/esm/chunks/{chunk.SZL74RTY.js.map → chunk.VWSC3NDJ.js.map} +0 -0
  48. package/dist/esm/chunks/chunk.WQE6OCJR.js +7 -0
  49. package/dist/esm/chunks/chunk.WQE6OCJR.js.map +7 -0
  50. package/dist/esm/chunks/{chunk.V7P3QPNM.js → chunk.Y7Q6QI5V.js} +2 -2
  51. package/dist/esm/chunks/{chunk.V7P3QPNM.js.map → chunk.Y7Q6QI5V.js.map} +2 -2
  52. package/dist/esm/chunks/chunk.YPUWII7L.js +7 -0
  53. package/dist/esm/chunks/{chunk.5PQTSZ7G.js.map → chunk.YPUWII7L.js.map} +2 -2
  54. package/dist/esm/chunks/chunk.ZMH4OL2E.js +7 -0
  55. package/dist/esm/chunks/{chunk.CYJBOJMX.js.map → chunk.ZMH4OL2E.js.map} +2 -2
  56. package/dist/esm/date-picker/index.js +1 -1
  57. package/dist/esm/date-range-picker/index.js +1 -1
  58. package/dist/esm/dialog/index.js +1 -1
  59. package/dist/esm/file-picker/index.js +1 -1
  60. package/dist/esm/index.js +1 -1
  61. package/dist/esm/list/index.js +1 -1
  62. package/dist/esm/list/list/index.js +1 -1
  63. package/dist/esm/list/list-item/index.js +1 -1
  64. package/dist/esm/list-dropdown/index.js +1 -1
  65. package/dist/esm/menu/index.js +1 -1
  66. package/dist/esm/paginator/index.js +1 -1
  67. package/dist/esm/select/core/index.js +1 -1
  68. package/dist/esm/select/index.js +1 -1
  69. package/dist/esm/select/option/index.js +1 -1
  70. package/dist/esm/select/select/index.js +1 -1
  71. package/dist/esm/select/select-dropdown/index.js +1 -1
  72. package/dist/esm/split-view/index.js +1 -1
  73. package/dist/esm/split-view/split-view/index.js +1 -1
  74. package/dist/esm/split-view/split-view-panel/index.js +1 -1
  75. package/dist/esm/switch/index.js +1 -1
  76. package/dist/esm/text-field/index.js +1 -1
  77. package/dist/esm/time-picker/index.js +1 -1
  78. package/esm/chip-field/chip-field.js +1 -1
  79. package/esm/date-range-picker/date-range-picker-foundation.d.ts +1 -0
  80. package/esm/date-range-picker/date-range-picker-foundation.js +13 -1
  81. package/esm/dialog/dialog-adapter.d.ts +5 -5
  82. package/esm/dialog/dialog-adapter.js +31 -30
  83. package/esm/dialog/dialog-foundation.d.ts +2 -4
  84. package/esm/dialog/dialog-foundation.js +38 -55
  85. package/esm/dialog/dialog.d.ts +0 -4
  86. package/esm/dialog/dialog.js +1 -7
  87. package/esm/file-picker/file-picker.js +1 -1
  88. package/esm/list/list-item/list-item-adapter.d.ts +10 -2
  89. package/esm/list/list-item/list-item-adapter.js +14 -4
  90. package/esm/list/list-item/list-item-foundation.js +17 -4
  91. package/esm/list/list-item/list-item.d.ts +1 -1
  92. package/esm/list/list-item/list-item.js +1 -1
  93. package/esm/select/core/base-select-adapter.js +11 -1
  94. package/esm/select/core/base-select-foundation.js +7 -3
  95. package/esm/select/option/option-constants.d.ts +3 -0
  96. package/esm/select/option/option-constants.js +5 -1
  97. package/esm/select/option/option-foundation.d.ts +2 -2
  98. package/esm/select/option/option-foundation.js +1 -0
  99. package/esm/select/select/select.js +1 -1
  100. package/esm/split-view/split-view/split-view-constants.d.ts +0 -1
  101. package/esm/split-view/split-view-panel/split-view-panel-adapter.d.ts +4 -1
  102. package/esm/split-view/split-view-panel/split-view-panel-adapter.js +17 -6
  103. package/esm/split-view/split-view-panel/split-view-panel-constants.d.ts +1 -0
  104. package/esm/split-view/split-view-panel/split-view-panel-constants.js +2 -1
  105. package/esm/split-view/split-view-panel/split-view-panel-foundation.js +1 -4
  106. package/esm/split-view/split-view-panel/split-view-panel-utils.d.ts +6 -0
  107. package/esm/split-view/split-view-panel/split-view-panel-utils.js +17 -0
  108. package/esm/split-view/split-view-panel/split-view-panel.js +1 -1
  109. package/esm/switch/switch.d.ts +1 -0
  110. package/esm/switch/switch.js +13 -9
  111. package/esm/text-field/text-field.js +1 -1
  112. package/package.json +1 -1
  113. package/styles/field/_base.scss +4 -2
  114. package/styles/field/_variables.scss +0 -3
  115. package/dist/esm/chunks/chunk.5D6UB4DL.js +0 -7
  116. package/dist/esm/chunks/chunk.5D6UB4DL.js.map +0 -7
  117. package/dist/esm/chunks/chunk.5PQTSZ7G.js +0 -7
  118. package/dist/esm/chunks/chunk.7JTKKFL4.js +0 -7
  119. package/dist/esm/chunks/chunk.7JTKKFL4.js.map +0 -7
  120. package/dist/esm/chunks/chunk.CYJBOJMX.js +0 -7
  121. package/dist/esm/chunks/chunk.IGMTMR3D.js +0 -7
  122. package/dist/esm/chunks/chunk.IGMTMR3D.js.map +0 -7
  123. package/dist/esm/chunks/chunk.TCCPCDJK.js +0 -7
  124. package/dist/esm/chunks/chunk.TCCPCDJK.js.map +0 -7
  125. package/dist/esm/chunks/chunk.VQKRN5IQ.js +0 -7
  126. package/dist/esm/chunks/chunk.VQKRN5IQ.js.map +0 -7
  127. package/dist/esm/chunks/chunk.YK2PXI6D.js +0 -7
  128. package/dist/esm/chunks/chunk.YK2PXI6D.js.map +0 -7
@@ -36,6 +36,7 @@ export declare class DateRangePickerFoundation extends BaseDatePickerFoundation<
36
36
  private _formatToInputValue;
37
37
  protected _setFormattedInputValue(suppressValueChanges?: boolean): void;
38
38
  private _setFormattedToInputValue;
39
+ protected _isDateRangeAcceptable(value?: DateRange | null | undefined): boolean;
39
40
  protected _setValue(value: Date | null | undefined): void;
40
41
  private _setToValue;
41
42
  protected _onDateSelected(event: ICalendarDateSelectEventData): void;
@@ -77,7 +77,10 @@ export class DateRangePickerFoundation extends BaseDatePickerFoundation {
77
77
  }
78
78
  _onToday() {
79
79
  const today = new Date();
80
- const range = new DateRange({ from: today });
80
+ const range = this._open ? new DateRange({ from: this._from || today, to: this._to || undefined }) : new DateRange({ from: today });
81
+ if (!this._isDateRangeAcceptable(range)) {
82
+ return;
83
+ }
81
84
  this.value = range;
82
85
  this._onDateSelected({ date: today, range, selected: true, type: 'date' });
83
86
  this._adapter.setCalendarActiveDate(today);
@@ -120,6 +123,15 @@ export class DateRangePickerFoundation extends BaseDatePickerFoundation {
120
123
  }
121
124
  this._adapter.setToInputValue(formattedDate, suppressValueChanges ? false : this._notifyInputValueChanges);
122
125
  }
126
+ _isDateRangeAcceptable(value) {
127
+ if (!(value === null || value === void 0 ? void 0 : value.to)) {
128
+ return true;
129
+ }
130
+ const passesMinDate = () => this._isDateValueAcceptable(value.from);
131
+ const passesMaxDate = () => this._isDateValueAcceptable(value.to);
132
+ const passesDateRange = () => (value === null || value === void 0 ? void 0 : value.from) && (value === null || value === void 0 ? void 0 : value.to) ? value.from.getTime() <= value.to.getTime() : true;
133
+ return passesMinDate() && passesMaxDate() && passesDateRange();
134
+ }
123
135
  _setValue(value) {
124
136
  if (this._isDateValueAcceptable(value)) {
125
137
  this._from = value || null;
@@ -10,7 +10,7 @@ export interface IDialogAdapter extends IBaseAdapter {
10
10
  initializeAccessibility(): void;
11
11
  setAnimating(animating: boolean): void;
12
12
  setVisibility(visible: boolean): void;
13
- attach(parent?: HTMLElement): void;
13
+ attach(): void;
14
14
  detach(): void;
15
15
  setDocumentListener(type: string, listener: (evt: Event) => void): void;
16
16
  removeDocumentListener(type: string, listener: (evt: Event) => void): void;
@@ -31,7 +31,7 @@ export interface IDialogAdapter extends IBaseAdapter {
31
31
  setMoveTargetHandler(type: string, listener: (evt: MouseEvent) => void): void;
32
32
  removeDragTargetHandler(type: string, listener: (evt: MouseEvent) => void): void;
33
33
  getSurfaceBounds(): DOMRect;
34
- setSurfacePosition(x: string | null, y: string | null, positionType: DialogPositionType | null): void;
34
+ setSurfacePosition(x: string | null, y: string | null, positionType: DialogPositionType): void;
35
35
  captureActiveElement(): void;
36
36
  tryRestoreActiveElement(): void;
37
37
  }
@@ -39,7 +39,7 @@ export interface IDialogAdapter extends IBaseAdapter {
39
39
  * Provides facilities for interacting with the internal DOM of `DialogComponent`.
40
40
  */
41
41
  export declare class DialogAdapter extends BaseAdapter<IDialogComponent> implements IDialogAdapter {
42
- private _backdropElement?;
42
+ private _backdropElement;
43
43
  private _containerElement;
44
44
  private _surfaceElement;
45
45
  private _moveTargetElement;
@@ -48,7 +48,7 @@ export declare class DialogAdapter extends BaseAdapter<IDialogComponent> impleme
48
48
  initializeAccessibility(): void;
49
49
  setAnimating(animating: boolean): void;
50
50
  setVisibility(visible: boolean): void;
51
- attach(parent?: HTMLElement): void;
51
+ attach(): void;
52
52
  detach(): void;
53
53
  registerTransitionEndHandler(handler: (evt: TransitionEvent) => void): void;
54
54
  deregisterTransitionEndHandler(handler: (evt: TransitionEvent) => void): void;
@@ -69,7 +69,7 @@ export declare class DialogAdapter extends BaseAdapter<IDialogComponent> impleme
69
69
  setMoveTargetHandler(type: string, listener: (evt: MouseEvent) => void): void;
70
70
  removeDragTargetHandler(type: string, listener: (evt: MouseEvent) => void): void;
71
71
  getSurfaceBounds(): DOMRect;
72
- setSurfacePosition(x: string | null, y: string | null, positionType: DialogPositionType | null): void;
72
+ setSurfacePosition(x: string | null, y: string | null, positionType: DialogPositionType): void;
73
73
  captureActiveElement(): void;
74
74
  tryRestoreActiveElement(): void;
75
75
  }
@@ -17,6 +17,7 @@ import { DIALOG_CONSTANTS } from './dialog-constants';
17
17
  export class DialogAdapter extends BaseAdapter {
18
18
  constructor(component) {
19
19
  super(component);
20
+ this._backdropElement = getShadowElement(component, DIALOG_CONSTANTS.selectors.BACKDROP);
20
21
  this._containerElement = getShadowElement(component, DIALOG_CONSTANTS.selectors.CONTAINER);
21
22
  this._surfaceElement = getShadowElement(component, DIALOG_CONSTANTS.selectors.SURFACE);
22
23
  }
@@ -27,24 +28,23 @@ export class DialogAdapter extends BaseAdapter {
27
28
  this._component.setAttribute('aria-modal', 'true');
28
29
  }
29
30
  setAnimating(animating) {
30
- toggleClass(this._containerElement, animating, DIALOG_CONSTANTS.classes.ANIMATING);
31
+ if (animating) {
32
+ this._containerElement.classList.add(DIALOG_CONSTANTS.classes.ANIMATING);
33
+ }
34
+ else {
35
+ this._containerElement.classList.remove(DIALOG_CONSTANTS.classes.ANIMATING);
36
+ }
31
37
  }
32
38
  setVisibility(visible) {
33
- toggleClass(this._containerElement, visible, DIALOG_CONSTANTS.classes.OPEN);
34
- if (!this._backdropElement) {
35
- this._backdropElement = document.createElement('forge-backdrop');
36
- this._backdropElement.setAttribute('part', 'scrim');
37
- this._containerElement.appendChild(this._backdropElement);
38
- }
39
39
  if (visible) {
40
- this._backdropElement.fadeIn();
40
+ this._containerElement.classList.add(DIALOG_CONSTANTS.classes.OPEN);
41
41
  }
42
42
  else {
43
- this._backdropElement.fadeOut();
43
+ this._containerElement.classList.remove(DIALOG_CONSTANTS.classes.OPEN);
44
44
  }
45
45
  }
46
- attach(parent = document.body) {
47
- parent.appendChild(this._component);
46
+ attach() {
47
+ document.body.appendChild(this._component);
48
48
  }
49
49
  detach() {
50
50
  if (this._activeElement) {
@@ -65,12 +65,10 @@ export class DialogAdapter extends BaseAdapter {
65
65
  document.removeEventListener(type, listener);
66
66
  }
67
67
  registerBackdropClickHandler(handler) {
68
- var _a;
69
- (_a = this._backdropElement) === null || _a === void 0 ? void 0 : _a.addEventListener(BACKDROP_CONSTANTS.events.BACKDROP_CLICK, handler);
68
+ this._backdropElement.addEventListener(BACKDROP_CONSTANTS.events.BACKDROP_CLICK, handler);
70
69
  }
71
70
  deregisterBackdropClickHandler(handler) {
72
- var _a;
73
- (_a = this._backdropElement) === null || _a === void 0 ? void 0 : _a.removeEventListener(BACKDROP_CONSTANTS.events.BACKDROP_CLICK, handler);
71
+ this._backdropElement.removeEventListener(BACKDROP_CONSTANTS.events.BACKDROP_CLICK, handler);
74
72
  }
75
73
  getOpenDialogs(selector) {
76
74
  return document.querySelectorAll(selector);
@@ -99,7 +97,12 @@ export class DialogAdapter extends BaseAdapter {
99
97
  this._component.classList.add(name);
100
98
  }
101
99
  setFullscreen(value) {
102
- toggleClass(this._containerElement, value, DIALOG_CONSTANTS.classes.FULLSCREEN);
100
+ if (value) {
101
+ this._containerElement.classList.add(DIALOG_CONSTANTS.classes.FULLSCREEN);
102
+ }
103
+ else {
104
+ this._containerElement.classList.remove(DIALOG_CONSTANTS.classes.FULLSCREEN);
105
+ }
103
106
  }
104
107
  setMoveable(value) {
105
108
  toggleClass(this._containerElement, value, DIALOG_CONSTANTS.classes.MOVEABLE);
@@ -117,30 +120,27 @@ export class DialogAdapter extends BaseAdapter {
117
120
  return !!this._moveTargetElement;
118
121
  }
119
122
  setMoveTargetHandler(type, listener) {
120
- var _a;
121
- (_a = this._moveTargetElement) === null || _a === void 0 ? void 0 : _a.addEventListener(type, listener);
123
+ if (this._moveTargetElement) {
124
+ this._moveTargetElement.addEventListener(type, listener);
125
+ }
122
126
  }
123
127
  removeDragTargetHandler(type, listener) {
124
- var _a;
125
- (_a = this._moveTargetElement) === null || _a === void 0 ? void 0 : _a.removeEventListener(type, listener);
128
+ if (this._moveTargetElement) {
129
+ this._moveTargetElement.removeEventListener(type, listener);
130
+ }
126
131
  }
127
132
  getSurfaceBounds() {
128
133
  return this._surfaceElement.getBoundingClientRect();
129
134
  }
130
135
  setSurfacePosition(x, y, positionType) {
131
- if (positionType) {
132
- this._surfaceElement.style.position = positionType === 'absolute' ? positionType : 'relative';
133
- }
134
- else {
135
- this._surfaceElement.style.removeProperty('position');
136
- }
137
- if (y !== null) {
136
+ this._surfaceElement.style.position = positionType === 'absolute' ? positionType : 'relative';
137
+ if (y != null) {
138
138
  this._surfaceElement.style.top = y;
139
139
  }
140
140
  else {
141
141
  this._surfaceElement.style.removeProperty('top');
142
142
  }
143
- if (x !== null) {
143
+ if (x != null) {
144
144
  this._surfaceElement.style.left = x;
145
145
  }
146
146
  else {
@@ -148,9 +148,10 @@ export class DialogAdapter extends BaseAdapter {
148
148
  }
149
149
  }
150
150
  captureActiveElement() {
151
- var _a;
152
151
  this._activeElement = getActiveElement();
153
- (_a = this._activeElement) === null || _a === void 0 ? void 0 : _a.blur();
152
+ if (this._activeElement) {
153
+ this._activeElement.blur();
154
+ }
154
155
  }
155
156
  tryRestoreActiveElement() {
156
157
  if (this._activeElement) {
@@ -21,8 +21,6 @@ export interface IDialogFoundation extends ICustomElementFoundation {
21
21
  moveTarget: string;
22
22
  initializeMoveTarget(): void;
23
23
  resetPosition(): void;
24
- show(parent?: HTMLElement): Promise<void>;
25
- hide(remove?: boolean): Promise<void>;
26
24
  }
27
25
  export declare class DialogFoundation implements IDialogFoundation {
28
26
  _adapter: IDialogAdapter;
@@ -48,6 +46,8 @@ export declare class DialogFoundation implements IDialogFoundation {
48
46
  private _moveTargetMouseDownHandler;
49
47
  private _moveTargetMouseMoveHandler;
50
48
  private _moveTargetMouseUpHandler;
49
+ private _attachedDocumentKeydownHandler;
50
+ private _attachedBackdropClickHandler;
51
51
  constructor(_adapter: IDialogAdapter);
52
52
  initialize(): void;
53
53
  destroy(): void;
@@ -56,8 +56,6 @@ export declare class DialogFoundation implements IDialogFoundation {
56
56
  private _executeCloseCallback;
57
57
  initializeMoveTarget(): void;
58
58
  resetPosition(): void;
59
- show(parent?: HTMLElement): Promise<void>;
60
- hide(remove?: boolean): Promise<void>;
61
59
  private _normalizePositionValue;
62
60
  private _openDialog;
63
61
  private _closeDialog;
@@ -20,6 +20,9 @@ export class DialogFoundation {
20
20
  this._moveTarget = DIALOG_CONSTANTS.selectors.DFEAULT_MOVE_TARGET;
21
21
  this._isAnimating = false;
22
22
  this._isMoving = false;
23
+ // Event handler states
24
+ this._attachedDocumentKeydownHandler = false;
25
+ this._attachedBackdropClickHandler = false;
23
26
  this._transitionEndHandler = (evt) => this._onTransitionEnd();
24
27
  this._documentKeydownHandler = (evt) => this._onDocumentKeydown(evt);
25
28
  this._backdropClickHandler = (evt) => this._onBackdropClick(evt);
@@ -40,8 +43,12 @@ export class DialogFoundation {
40
43
  if (this._open) {
41
44
  this._removeDragHandlers();
42
45
  this._adapter.deregisterTransitionEndHandler(this._transitionEndHandler);
43
- this._adapter.removeDocumentListener('keydown', this._documentKeydownHandler);
44
- this._adapter.deregisterBackdropClickHandler(this._backdropClickHandler);
46
+ if (this._attachedDocumentKeydownHandler) {
47
+ this._adapter.removeDocumentListener('keydown', this._documentKeydownHandler);
48
+ }
49
+ if (this._attachedBackdropClickHandler) {
50
+ this._adapter.deregisterBackdropClickHandler(this._backdropClickHandler);
51
+ }
45
52
  }
46
53
  }
47
54
  async _applyOpen(value) {
@@ -86,26 +93,6 @@ export class DialogFoundation {
86
93
  resetPosition() {
87
94
  this._adapter.setSurfacePosition(this._positionX, this._positionY, this._positionType);
88
95
  }
89
- async show(parent) {
90
- if (this._open) {
91
- return;
92
- }
93
- this._open = true;
94
- if (!this._adapter.isConnected) {
95
- this._adapter.attach(parent);
96
- }
97
- await this._openDialog();
98
- }
99
- async hide(remove) {
100
- if (!this._open) {
101
- return;
102
- }
103
- this._open = false;
104
- await this._closeDialog();
105
- if (remove) {
106
- this._adapter.detach();
107
- }
108
- }
109
96
  _normalizePositionValue(value) {
110
97
  if (isNumber(value)) {
111
98
  return `${value}px`;
@@ -116,24 +103,25 @@ export class DialogFoundation {
116
103
  return null;
117
104
  }
118
105
  _openDialog() {
106
+ this._adapter.attach();
119
107
  if (!this._fullscreen) {
120
108
  if (this._moveable) {
121
109
  this._adapter.setMoveable(this._moveable);
122
110
  }
123
- if (this._positionX !== null || this._positionY !== null) {
111
+ if (this._positionX != null || this._positionY != null) {
124
112
  this._adapter.setSurfacePosition(this._positionX, this._positionY, this._positionType);
125
113
  }
126
114
  }
127
115
  this._adapter.setBodyAttribute(DIALOG_CONSTANTS.attributes.OPEN, 'true');
128
116
  this._adapter.registerTransitionEndHandler(this._transitionEndHandler);
129
117
  this._setDocumentKeydownListener(this._escapeClose);
118
+ this._setBackdropClickListener(this._backdropClose);
130
119
  this._adapter.setAnimating(true);
131
120
  this._isAnimating = true;
132
121
  // Ensure transitions are triggered properly
133
122
  window.requestAnimationFrame(() => {
134
123
  window.requestAnimationFrame(() => {
135
124
  this._adapter.setVisibility(true);
136
- this._setBackdropClickListener(this._backdropClose); // Must come after setting visibility because the backdrop may not yet exist
137
125
  this._adapter.emitHostEvent(DIALOG_CONSTANTS.events.OPEN);
138
126
  this._adapter.trySetInitialFocus();
139
127
  if (this._adapter.isScrollable()) {
@@ -141,46 +129,37 @@ export class DialogFoundation {
141
129
  }
142
130
  });
143
131
  });
144
- return new Promise(resolve => {
145
- // Wait for the dialog to finish animating open, then emit the ready event and attach any listeners
146
- window.setTimeout(() => {
147
- window.requestAnimationFrame(() => {
148
- if (this._open && this._isAnimating) {
149
- this._onTransitionEnd();
150
- resolve();
151
- }
152
- });
153
- }, DIALOG_CONSTANTS.numbers.ANIMATION_DURATION);
154
- });
132
+ // Wait for the dialog to finish animating open, then emit the ready event and attach any listeners
133
+ setTimeout(() => {
134
+ window.requestAnimationFrame(() => {
135
+ if (this._open && this._isAnimating) {
136
+ this._onTransitionEnd();
137
+ }
138
+ });
139
+ }, DIALOG_CONSTANTS.numbers.ANIMATION_DURATION);
155
140
  }
156
141
  _closeDialog() {
157
142
  if (this._moveTarget) {
158
143
  this._removeDragHandlers();
159
144
  }
160
145
  this._adapter.deregisterTransitionEndHandler(this._transitionEndHandler);
161
- if (this._escapeClose) {
146
+ if (this._attachedDocumentKeydownHandler) {
162
147
  this._adapter.removeDocumentListener('keydown', this._documentKeydownHandler);
163
148
  }
164
- if (this._backdropClose) {
149
+ if (this._attachedBackdropClickHandler) {
165
150
  this._adapter.deregisterBackdropClickHandler(this._backdropClickHandler);
166
151
  }
167
152
  this._isAnimating = false;
168
- this._moveContext = undefined;
169
- this._lastPosition = undefined;
170
153
  this._adapter.setAnimating(true);
171
154
  this._adapter.setVisibility(false);
172
- this._adapter.setSurfacePosition(null, null, null);
173
- return new Promise(resolve => {
174
- setTimeout(() => {
175
- this._adapter.emitHostEvent(DIALOG_CONSTANTS.events.CLOSE);
176
- const openDialogs = this._adapter.getOpenDialogs(`${DIALOG_CONSTANTS.elementName}[${DIALOG_CONSTANTS.attributes.OPEN}]`);
177
- if (!openDialogs.length) {
178
- this._adapter.removeBodyAttribute(DIALOG_CONSTANTS.attributes.OPEN);
179
- }
180
- this._adapter.setAnimating(false);
181
- resolve();
182
- }, DIALOG_CONSTANTS.numbers.ANIMATION_DURATION);
183
- });
155
+ setTimeout(() => {
156
+ this._adapter.emitHostEvent(DIALOG_CONSTANTS.events.CLOSE);
157
+ this._adapter.detach();
158
+ const openDialogs = this._adapter.getOpenDialogs(DIALOG_CONSTANTS.elementName);
159
+ if (!openDialogs.length) {
160
+ this._adapter.removeBodyAttribute(DIALOG_CONSTANTS.attributes.OPEN);
161
+ }
162
+ }, DIALOG_CONSTANTS.numbers.ANIMATION_DURATION);
184
163
  }
185
164
  _onTransitionEnd() {
186
165
  if (!this._isAnimating) {
@@ -291,22 +270,26 @@ export class DialogFoundation {
291
270
  if (!this._open) {
292
271
  return;
293
272
  }
294
- if (attach && this._backdropClose) {
273
+ if (attach && !this._attachedBackdropClickHandler) {
295
274
  this._adapter.registerBackdropClickHandler(this._backdropClickHandler);
275
+ this._attachedBackdropClickHandler = true;
296
276
  }
297
- else if (!attach) {
277
+ else if (!attach && this._attachedBackdropClickHandler) {
298
278
  this._adapter.deregisterBackdropClickHandler(this._backdropClickHandler);
279
+ this._attachedBackdropClickHandler = false;
299
280
  }
300
281
  }
301
282
  _setDocumentKeydownListener(attach) {
302
283
  if (!this._open) {
303
284
  return;
304
285
  }
305
- if (attach && this._escapeClose) {
286
+ if (attach && !this._attachedDocumentKeydownHandler) {
306
287
  this._adapter.setDocumentListener('keydown', this._documentKeydownHandler);
288
+ this._attachedDocumentKeydownHandler = true;
307
289
  }
308
- else if (!attach) {
290
+ else if (!attach && this._attachedDocumentKeydownHandler) {
309
291
  this._adapter.removeDocumentListener('keydown', this._documentKeydownHandler);
292
+ this._attachedDocumentKeydownHandler = false;
310
293
  }
311
294
  }
312
295
  _calculateOffsetPosition(pageX, pageY, context) {
@@ -20,8 +20,6 @@ export interface IDialogComponent extends IBaseComponent {
20
20
  moveTarget: string;
21
21
  initializeMoveTarget(): void;
22
22
  resetPosition(): void;
23
- show(parent?: HTMLElement): Promise<void>;
24
- hide(remove?: boolean): Promise<void>;
25
23
  }
26
24
  declare global {
27
25
  interface HTMLElementTagNameMap {
@@ -75,6 +73,4 @@ export declare class DialogComponent extends BaseComponent implements IDialogCom
75
73
  moveTarget: string;
76
74
  initializeMoveTarget(): void;
77
75
  resetPosition(): void;
78
- show(parent?: HTMLElement): Promise<void>;
79
- hide(remove?: boolean): Promise<void>;
80
76
  }
@@ -10,7 +10,7 @@ import { DialogAdapter } from './dialog-adapter';
10
10
  import { DIALOG_CONSTANTS } from './dialog-constants';
11
11
  import { BackdropComponent } from '../backdrop';
12
12
  import { BaseComponent } from '../core/base/base-component';
13
- const template = '<template><div class=\"forge-dialog\" part=\"root\"><div class=\"forge-dialog__surface\" part=\"surface\"><slot></slot></div></div></template>';
13
+ const template = '<template><div class=\"forge-dialog\" part=\"root\"><forge-backdrop part=\"scrim\"></forge-backdrop><div class=\"forge-dialog__surface\" part=\"surface\"><slot></slot></div></div></template>';
14
14
  const styles = '.forge-dialog{position:fixed;top:0;bottom:0;left:0;right:0;z-index:8;z-index:var(--forge-z-index-dialog,8);-webkit-box-align:center;align-items:center;-webkit-box-align:var(--forge-dialog-align-items,center);align-items:var(--forge-dialog-align-items,center);top:0;top:var(--forge-dialog-top,0);padding:24px;padding:var(--forge-dialog-padding,24px);display:-webkit-box;display:flex;-webkit-box-pack:center;justify-content:center;visibility:hidden}@media (max-width:599px){.forge-dialog{padding:0}}.forge-dialog--moveable:not(.forge-dialog--fullscreen) ::slotted([forge-dialog-move-target]){cursor:move}.forge-dialog--animating{visibility:visible}.forge-dialog--animating .forge-dialog--open .forge-dialog__surface{-webkit-transition:-webkit-transform 150ms 0s cubic-bezier(0, 0, .2, 1);transition:-webkit-transform 150ms 0s cubic-bezier(0, 0, .2, 1);transition:transform 150ms 0s cubic-bezier(0, 0, .2, 1);transition:transform 150ms 0s cubic-bezier(0, 0, .2, 1),-webkit-transform 150ms 0s cubic-bezier(0, 0, .2, 1)}.forge-dialog--animating .forge-dialog__surface{-webkit-transition:-webkit-transform 150ms 0s cubic-bezier(0, 0, .2, 1);transition:-webkit-transform 150ms 0s cubic-bezier(0, 0, .2, 1);transition:transform 150ms 0s cubic-bezier(0, 0, .2, 1);transition:transform 150ms 0s cubic-bezier(0, 0, .2, 1),-webkit-transform 150ms 0s cubic-bezier(0, 0, .2, 1)}.forge-dialog--scrollable .forge-dialog__footer,.forge-dialog--scrollable .forge-dialog__title{border-color:rgba(0,0,0,.12)}.forge-dialog--open{visibility:visible!important}.forge-dialog--open .forge-dialog__surface{-webkit-transform:scale(1);transform:scale(1);opacity:1}.forge-dialog__surface{-webkit-box-shadow:0 11px 15px -7px rgba(0,0,0,.2),0 24px 38px 3px rgba(0,0,0,.14),0 9px 46px 8px rgba(0,0,0,.12);box-shadow:0 11px 15px -7px rgba(0,0,0,.2),0 24px 38px 3px rgba(0,0,0,.14),0 9px 46px 8px rgba(0,0,0,.12);background-color:#fff;background-color:var(--mdc-theme-surface,#fff);width:auto;width:var(--forge-dialog-width,auto);height:auto;height:var(--forge-dialog-height,auto);min-width:280px;min-width:var(--forge-dialog-min-width,280px);max-width:100%;max-width:var(--forge-dialog-max-width,100%);max-height:100%;max-height:var(--forge-dialog-max-height,100%);border-radius:4px;border-radius:var(--forge-dialog-border-radius,var(--mdc-shape-medium,4px));display:-webkit-inline-box;display:inline-flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;flex-direction:column;-webkit-box-sizing:border-box;box-sizing:border-box;-webkit-transform:scale(.8);transform:scale(.8);opacity:0;overflow:hidden;z-index:inherit}.forge-dialog__header{margin:0;padding:0 24px 9px;border-bottom:1px solid transparent}.forge-dialog__title{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;font-size:1.25rem;font-size:var(--forge-typography-title-font-size, 1.25rem);line-height:2rem;line-height:var(--forge-typography-title-line-height, 2rem);font-weight:400;font-weight:var(--forge-typography-title-font-weight,400);letter-spacing:.0125em;letter-spacing:var(--forge-typography-title-letter-spacing, .0125em);text-decoration:inherit;-webkit-text-decoration:var(--forge-typography-title-text-decoration,inherit);text-decoration:var(--forge-typography-title-text-decoration,inherit);text-transform:inherit;text-transform:var(--forge-typography-title-text-transform,inherit);-webkit-box-sizing:border-box;box-sizing:border-box;margin:0}.forge-dialog__title::before{display:inline-block;width:0;height:40px;content:\"\";vertical-align:0}.forge-dialog__body{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;font-family:Roboto,sans-serif;font-family:var(--mdc-typography-body1-font-family, var(--mdc-typography-font-family, Roboto, sans-serif));font-size:1rem;font-size:var(--mdc-typography-body1-font-size, 1rem);line-height:1.5rem;line-height:var(--mdc-typography-body1-line-height, 1.5rem);font-weight:400;font-weight:var(--mdc-typography-body1-font-weight,400);letter-spacing:.03125em;letter-spacing:var(--mdc-typography-body1-letter-spacing, .03125em);text-decoration:inherit;-webkit-text-decoration:var(--mdc-typography-body1-text-decoration,inherit);text-decoration:var(--mdc-typography-body1-text-decoration,inherit);text-transform:inherit;text-transform:var(--mdc-typography-body1-text-transform,inherit);padding-top:20px;padding:0 24px 24px;overflow:auto}.forge-dialog__body--scrollable{max-height:195px;border-top:1px solid rgba(0,0,0,.1);border-bottom:1px solid rgba(0,0,0,.1);overflow-x:auto;overflow-y:scroll;-webkit-overflow-scrolling:touch}.forge-dialog__footer{display:-webkit-box;display:flex;position:relative;flex-shrink:0;flex-wrap:wrap;-webkit-box-align:center;align-items:center;-webkit-box-pack:end;justify-content:flex-end;-webkit-box-sizing:border-box;box-sizing:border-box;min-height:52px;margin:0;padding:8px;border-top:1px solid transparent}.forge-dialog--fullscreen{padding:0}.forge-dialog--fullscreen .forge-dialog__surface{height:100%;width:100%;min-width:auto;max-width:100%;border-radius:0}:host{display:block}:host([hidden]){display:none}';
15
15
  /**
16
16
  * The web component class behind the `<forge-dialog>` custom element.
@@ -79,12 +79,6 @@ let DialogComponent = class DialogComponent extends BaseComponent {
79
79
  resetPosition() {
80
80
  this._foundation.resetPosition();
81
81
  }
82
- show(parent) {
83
- return this._foundation.show(parent);
84
- }
85
- hide(remove) {
86
- return this._foundation.hide(remove);
87
- }
88
82
  };
89
83
  __decorate([
90
84
  FoundationProperty()
@@ -11,7 +11,7 @@ import { FilePickerAdapter } from './file-picker-adapter';
11
11
  import { FILE_PICKER_CONSTANTS } from './file-picker-constants';
12
12
  import { FilePickerFoundation } from './file-picker-foundation';
13
13
  const template = '<template><form class=\"forge-file-picker\" id=\"container\" part=\"form\"><div class=\"forge-file-picker__primary\" id=\"primary\" part=\"primary\"><slot name=\"primary\"></slot></div><slot id=\"button-slot\"></slot><div class=\"forge-file-picker__secondary\" id=\"secondary\" part=\"secondary\"><slot name=\"secondary\"></slot></div><input type=\"file\" class=\"forge-file-picker__input\" id=\"input\" part=\"input\"></form><div class=\"forge-file-picker__helper-text\" part=\"helper-text-container\"><slot name=\"helper-text\"></slot></div></template>';
14
- const styles = '.forge-file-picker{-webkit-box-sizing:border-box;box-sizing:border-box;width:100%;height:100%;background-color:rgba(189,189,189,.12);border:1px dashed #e0e0e0;display:grid;-webkit-box-pack:center;justify-content:center;align-content:center;gap:16px;padding:16px;text-align:center;cursor:pointer}.forge-file-picker__primary{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;font-family:Roboto,sans-serif;font-family:var(--mdc-typography-subtitle1-font-family, var(--mdc-typography-font-family, Roboto, sans-serif));font-size:1rem;font-size:var(--mdc-typography-subtitle1-font-size, 1rem);line-height:1.75rem;line-height:var(--mdc-typography-subtitle1-line-height, 1.75rem);font-weight:400;font-weight:var(--mdc-typography-subtitle1-font-weight,400);letter-spacing:.009375em;letter-spacing:var(--mdc-typography-subtitle1-letter-spacing, .009375em);text-decoration:inherit;-webkit-text-decoration:var(--mdc-typography-subtitle1-text-decoration,inherit);text-decoration:var(--mdc-typography-subtitle1-text-decoration,inherit);text-transform:inherit;text-transform:var(--mdc-typography-subtitle1-text-transform,inherit);color:rgba(0,0,0,.87);color:var(--mdc-theme-text-primary-on-background,rgba(0,0,0,.87));max-width:auto;max-width:var(--forge-file-picker-max-content-width,auto)}.forge-file-picker__secondary{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;font-size:.875rem;font-size:var(--forge-typography-subtitle2-secondary-font-size, .875rem);line-height:1.375rem;line-height:var(--forge-typography-subtitle2-secondary-line-height, 1.375rem);font-weight:400;font-weight:var(--forge-typography-subtitle2-secondary-font-weight,400);letter-spacing:.0087500001em;letter-spacing:var(--forge-typography-subtitle2-secondary-letter-spacing, .0087500001em);text-decoration:inherit;-webkit-text-decoration:var(--forge-typography-subtitle2-secondary-text-decoration,inherit);text-decoration:var(--forge-typography-subtitle2-secondary-text-decoration,inherit);text-transform:inherit;text-transform:var(--forge-typography-subtitle2-secondary-text-transform,inherit);color:var(--mdc-theme-text-secondary-on-background);color:var(--forge-typography-subtitle2-secondary-color,var(--mdc-theme-text-secondary-on-background));color:rgba(0,0,0,.87);color:var(--mdc-theme-text-primary-on-background,rgba(0,0,0,.87));max-width:auto;max-width:var(--forge-file-picker-max-content-width,auto)}.forge-file-picker__input{display:none}.forge-file-picker__helper-text ::slotted([slot=helper-text]){-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;font-family:Roboto,sans-serif;font-family:var(--mdc-typography-caption-font-family, var(--mdc-typography-font-family, Roboto, sans-serif));line-height:1.25rem;line-height:var(--mdc-typography-caption-line-height, 1.25rem);font-weight:400;font-weight:var(--mdc-typography-caption-font-weight,400);letter-spacing:.0333333333em;letter-spacing:var(--mdc-typography-caption-letter-spacing, .0333333333em);text-decoration:inherit;-webkit-text-decoration:var(--mdc-typography-caption-text-decoration,inherit);text-decoration:var(--mdc-typography-caption-text-decoration,inherit);text-transform:inherit;text-transform:var(--mdc-typography-caption-text-transform,inherit);display:block;height:auto;color:rgba(0,0,0,.54);color:var(--mdc-theme-text-secondary-on-background,rgba(0,0,0,.54));margin-left:12px;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;font-family:Roboto,sans-serif;font-family:var(--mdc-typography-caption-font-family, var(--mdc-typography-font-family, Roboto, sans-serif));font-size:.75rem;font-size:var(--mdc-typography-caption-font-size, .75rem);line-height:1.25rem;line-height:var(--mdc-typography-caption-line-height, 1.25rem);font-weight:400;font-weight:var(--mdc-typography-caption-font-weight,400);letter-spacing:.0333333333em;letter-spacing:var(--mdc-typography-caption-letter-spacing, .0333333333em);text-decoration:inherit;text-decoration:var(--mdc-typography-caption-text-decoration,inherit);text-transform:inherit;text-transform:var(--mdc-typography-caption-text-transform,inherit);text-align:start}.forge-file-picker__helper-text ::slotted([slot=helper-text])::before{display:inline-block;width:0;height:16px;content:\"\";vertical-align:0}.forge-file-picker[disabled]{background-color:#fafafa;background-color:var(--mdc-theme-background,#fafafa);border-color:#e0e0e0;border-color:var(--forge-theme-border-color,#e0e0e0);opacity:.38;cursor:unset}.forge-file-picker.compact{height:-webkit-fit-content;height:-moz-fit-content;height:fit-content;width:-webkit-fit-content;width:-moz-fit-content;width:fit-content;background-color:transparent;border:none;padding:0}.forge-file-picker.compact .forge-file-picker__primary,.forge-file-picker.compact .forge-file-picker__secondary{display:none}.forge-file-picker.compact .forge-file-picker__button>button{width:auto;width:var(--forge-file-picker-width,auto);background-color:transparent}.forge-file-picker:not(.compact).highlight{border-color:#3f51b5;border-color:var(--mdc-theme-primary,#3f51b5);background-color:rgba(63,81,181,.12);border-width:1px;border-style:solid}.forge-file-picker.borderless{--forge-file-picker-width:100%;border:none}.forge-file-picker.borderless:not(.compact).highlight{border:none}.forge-file-picker.borderless+.forge-file-picker__helper-text{display:none}:host{width:auto;width:var(--forge-file-picker-width,auto);height:auto;height:var(--forge-file-picker-height,auto);display:inline-block}:host([hidden]){display:none}';
14
+ const styles = '.forge-file-picker{-webkit-box-sizing:border-box;box-sizing:border-box;width:100%;height:100%;background-color:rgba(189,189,189,.12);border:1px dashed #e0e0e0;display:grid;-webkit-box-pack:center;justify-content:center;align-content:center;gap:16px;padding:16px;text-align:center;cursor:pointer}.forge-file-picker__primary{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;font-family:Roboto,sans-serif;font-family:var(--mdc-typography-subtitle1-font-family, var(--mdc-typography-font-family, Roboto, sans-serif));font-size:1rem;font-size:var(--mdc-typography-subtitle1-font-size, 1rem);line-height:1.75rem;line-height:var(--mdc-typography-subtitle1-line-height, 1.75rem);font-weight:400;font-weight:var(--mdc-typography-subtitle1-font-weight,400);letter-spacing:.009375em;letter-spacing:var(--mdc-typography-subtitle1-letter-spacing, .009375em);text-decoration:inherit;-webkit-text-decoration:var(--mdc-typography-subtitle1-text-decoration,inherit);text-decoration:var(--mdc-typography-subtitle1-text-decoration,inherit);text-transform:inherit;text-transform:var(--mdc-typography-subtitle1-text-transform,inherit);color:rgba(0,0,0,.87);color:var(--mdc-theme-text-primary-on-background,rgba(0,0,0,.87));max-width:auto;max-width:var(--forge-file-picker-max-content-width,auto)}.forge-file-picker__secondary{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;font-size:.875rem;font-size:var(--forge-typography-subtitle2-secondary-font-size, .875rem);line-height:1.375rem;line-height:var(--forge-typography-subtitle2-secondary-line-height, 1.375rem);font-weight:400;font-weight:var(--forge-typography-subtitle2-secondary-font-weight,400);letter-spacing:.0087500001em;letter-spacing:var(--forge-typography-subtitle2-secondary-letter-spacing, .0087500001em);text-decoration:inherit;-webkit-text-decoration:var(--forge-typography-subtitle2-secondary-text-decoration,inherit);text-decoration:var(--forge-typography-subtitle2-secondary-text-decoration,inherit);text-transform:inherit;text-transform:var(--forge-typography-subtitle2-secondary-text-transform,inherit);color:var(--mdc-theme-text-secondary-on-background);color:var(--forge-typography-subtitle2-secondary-color,var(--mdc-theme-text-secondary-on-background));color:rgba(0,0,0,.87);color:var(--mdc-theme-text-primary-on-background,rgba(0,0,0,.87));max-width:auto;max-width:var(--forge-file-picker-max-content-width,auto)}.forge-file-picker__input{display:none}.forge-file-picker__helper-text ::slotted([slot=helper-text]){-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;font-family:Roboto,sans-serif;font-family:var(--mdc-typography-caption-font-family, var(--mdc-typography-font-family, Roboto, sans-serif));line-height:1.25rem;line-height:var(--mdc-typography-caption-line-height, 1.25rem);font-weight:400;font-weight:var(--mdc-typography-caption-font-weight,400);letter-spacing:.0333333333em;letter-spacing:var(--mdc-typography-caption-letter-spacing, .0333333333em);text-decoration:inherit;-webkit-text-decoration:var(--mdc-typography-caption-text-decoration,inherit);text-decoration:var(--mdc-typography-caption-text-decoration,inherit);text-transform:inherit;text-transform:var(--mdc-typography-caption-text-transform,inherit);display:block;min-height:1.5rem;line-height:normal;padding-top:4px;-webkit-box-sizing:border-box;box-sizing:border-box;color:rgba(0,0,0,.54);color:var(--mdc-theme-text-secondary-on-background,rgba(0,0,0,.54));margin-left:12px;-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;font-family:Roboto,sans-serif;font-family:var(--mdc-typography-caption-font-family, var(--mdc-typography-font-family, Roboto, sans-serif));font-size:.75rem;font-size:var(--mdc-typography-caption-font-size, .75rem);line-height:1.25rem;line-height:var(--mdc-typography-caption-line-height, 1.25rem);font-weight:400;font-weight:var(--mdc-typography-caption-font-weight,400);letter-spacing:.0333333333em;letter-spacing:var(--mdc-typography-caption-letter-spacing, .0333333333em);text-decoration:inherit;text-decoration:var(--mdc-typography-caption-text-decoration,inherit);text-transform:inherit;text-transform:var(--mdc-typography-caption-text-transform,inherit);text-align:start}.forge-file-picker[disabled]{background-color:#fafafa;background-color:var(--mdc-theme-background,#fafafa);border-color:#e0e0e0;border-color:var(--forge-theme-border-color,#e0e0e0);opacity:.38;cursor:unset}.forge-file-picker.compact{height:-webkit-fit-content;height:-moz-fit-content;height:fit-content;width:-webkit-fit-content;width:-moz-fit-content;width:fit-content;background-color:transparent;border:none;padding:0}.forge-file-picker.compact .forge-file-picker__primary,.forge-file-picker.compact .forge-file-picker__secondary{display:none}.forge-file-picker.compact .forge-file-picker__button>button{width:auto;width:var(--forge-file-picker-width,auto);background-color:transparent}.forge-file-picker:not(.compact).highlight{border-color:#3f51b5;border-color:var(--mdc-theme-primary,#3f51b5);background-color:rgba(63,81,181,.12);border-width:1px;border-style:solid}.forge-file-picker.borderless{--forge-file-picker-width:100%;border:none}.forge-file-picker.borderless:not(.compact).highlight{border:none}.forge-file-picker.borderless+.forge-file-picker__helper-text{display:none}:host{width:auto;width:var(--forge-file-picker-width,auto);height:auto;height:var(--forge-file-picker-height,auto);display:inline-block}:host([hidden]){display:none}';
15
15
  /**
16
16
  * The web component class behind the `<forge-file-picker>` custom element.
17
17
  *
@@ -4,6 +4,7 @@
4
4
  * License: Apache-2.0
5
5
  */
6
6
  import { BaseAdapter, IBaseAdapter } from '../../core/base/base-adapter';
7
+ import { userInteractionListener } from '../../core/utils';
7
8
  import { IListItemComponent } from './list-item';
8
9
  export interface IListItemAdapter extends IBaseAdapter {
9
10
  initializeAccessibility(): void;
@@ -25,7 +26,8 @@ export interface IListItemAdapter extends IBaseAdapter {
25
26
  setDense(dense: boolean): void;
26
27
  setIndented(indented: boolean): void;
27
28
  setWrap(value: boolean): void;
28
- trySelect(value: unknown): void;
29
+ trySelect(value: unknown): boolean | null;
30
+ userInteractionListener(): ReturnType<typeof userInteractionListener>;
29
31
  }
30
32
  export declare class ListItemAdapter extends BaseAdapter<IListItemComponent> implements IListItemAdapter {
31
33
  private _listItemElement;
@@ -97,5 +99,11 @@ export declare class ListItemAdapter extends BaseAdapter<IListItemComponent> imp
97
99
  setDense(dense: boolean): void;
98
100
  setIndented(indented: boolean): void;
99
101
  setWrap(value: boolean): void;
100
- trySelect(value: unknown): void;
102
+ /**
103
+ * Attempts to set the selected state of the list item element and it's visual indicators
104
+ * @param value The value to compare to the parent list element's selected value
105
+ * @returns Returns whether the list item is selected or not
106
+ */
107
+ trySelect(value: unknown): boolean | null;
108
+ userInteractionListener(): ReturnType<typeof userInteractionListener>;
101
109
  }
@@ -5,6 +5,7 @@
5
5
  */
6
6
  import { addClass, getShadowElement, removeClass, requireParent, isDeepEqual, toggleClass } from '@tylertech/forge-core';
7
7
  import { BaseAdapter } from '../../core/base/base-adapter';
8
+ import { userInteractionListener } from '../../core/utils';
8
9
  import { LIST_CONSTANTS } from '../list/list-constants';
9
10
  import { LIST_ITEM_CONSTANTS } from './list-item-constants';
10
11
  import { ForgeRipple } from '../../ripple';
@@ -162,14 +163,23 @@ export class ListItemAdapter extends BaseAdapter {
162
163
  setWrap(value) {
163
164
  toggleClass(this._listItemElement, value, LIST_ITEM_CONSTANTS.classes.WRAP);
164
165
  }
166
+ /**
167
+ * Attempts to set the selected state of the list item element and it's visual indicators
168
+ * @param value The value to compare to the parent list element's selected value
169
+ * @returns Returns whether the list item is selected or not
170
+ */
165
171
  trySelect(value) {
166
172
  const list = requireParent(this._component, LIST_CONSTANTS.elementName);
167
173
  if (!list || list.selectedValue === undefined) {
168
- return;
174
+ return null;
169
175
  }
170
176
  const listValues = list.selectedValue instanceof Array ? list.selectedValue : [list.selectedValue];
171
- if (listValues.some(v => isDeepEqual(v, value))) {
172
- this.setSelected(true);
173
- }
177
+ const isSelected = listValues.some(v => isDeepEqual(v, value));
178
+ this.setSelected(isSelected);
179
+ this.tryToggleCheckboxRadio(isSelected);
180
+ return isSelected;
181
+ }
182
+ userInteractionListener() {
183
+ return userInteractionListener(this._listItemElement);
174
184
  }
175
185
  }
@@ -45,7 +45,10 @@ export class ListItemFoundation {
45
45
  else if (this.twoLine) {
46
46
  this._adapter.setTwoLine(this._twoLine);
47
47
  }
48
- this._adapter.trySelect(this._value);
48
+ const isSelected = this._adapter.trySelect(this._value);
49
+ if (isSelected != null) {
50
+ this._selected = isSelected;
51
+ }
49
52
  }
50
53
  disconnect() {
51
54
  if (this._rippleInstance) {
@@ -210,7 +213,10 @@ export class ListItemFoundation {
210
213
  }
211
214
  set value(value) {
212
215
  this._value = value;
213
- this._adapter.trySelect(this._value);
216
+ const isSelected = this._adapter.trySelect(this._value);
217
+ if (isSelected != null) {
218
+ this._selected = isSelected;
219
+ }
214
220
  }
215
221
  /** Gets/sets the href link that this list item will send the browser to when clicked. */
216
222
  get href() {
@@ -287,9 +293,16 @@ export class ListItemFoundation {
287
293
  this._adapter.toggleHostAttribute(LIST_ITEM_CONSTANTS.attributes.WRAP, this._wrap);
288
294
  }
289
295
  }
290
- _setRipple() {
296
+ async _setRipple() {
291
297
  if (this._ripple && !this._static && !this._rippleInstance) {
292
- this._rippleInstance = this._adapter.createRipple();
298
+ const type = await this._adapter.userInteractionListener();
299
+ if (this._ripple && !this._static && !this._rippleInstance) { // need to re-check after await
300
+ this._rippleInstance = this._adapter.createRipple();
301
+ if (type === 'focusin') {
302
+ // eslint-disable-next-line @typescript-eslint/dot-notation
303
+ this._rippleInstance['foundation'].handleFocus();
304
+ }
305
+ }
293
306
  }
294
307
  else if ((!this._ripple || this._static) && this._rippleInstance) {
295
308
  this._rippleInstance.destroy();
@@ -39,7 +39,7 @@ export declare class ListItemComponent extends BaseComponent implements IListIte
39
39
  static get observedAttributes(): string[];
40
40
  private _foundation;
41
41
  constructor();
42
- initializedCallback(): void;
42
+ connectedCallback(): void;
43
43
  disconnectedCallback(): void;
44
44
  attributeChangedCallback(name: string, oldValue: string, newValue: string): void;
45
45
  private _inheritParentListProps;
@@ -41,7 +41,7 @@ let ListItemComponent = class ListItemComponent extends BaseComponent {
41
41
  LIST_ITEM_CONSTANTS.attributes.WRAP
42
42
  ];
43
43
  }
44
- initializedCallback() {
44
+ connectedCallback() {
45
45
  // To simulate the :host-context() selector for Firefox until they implement it, we need to determine if the
46
46
  // list item is within a drawer for auto-styling the list item when included within a drawer. Check to see if
47
47
  // any of the parents of this element are a drawer.
@@ -102,9 +102,19 @@ export class BaseSelectAdapter extends BaseAdapter {
102
102
  (_a = this._listDropdown) === null || _a === void 0 ? void 0 : _a.setSelectedValues(selectedValues);
103
103
  }
104
104
  setOptionsListener(listener) {
105
+ // Watch for option value property changes
106
+ const optionValueChangeListener = evt => {
107
+ evt.stopPropagation();
108
+ listener(this.getOptions());
109
+ };
110
+ this._component.addEventListener(OPTION_CONSTANTS.events.VALUE_CHANGE, optionValueChangeListener);
111
+ // Watch for DOM changes
105
112
  const observer = new MutationObserver(() => listener(this.getOptions()));
106
113
  observer.observe(this._component, { childList: true, subtree: true });
107
- return () => observer.disconnect();
114
+ return () => {
115
+ this._component.removeEventListener(OPTION_CONSTANTS.events.VALUE_CHANGE, optionValueChangeListener);
116
+ observer.disconnect();
117
+ };
108
118
  }
109
119
  setOptions(options, clear = true) {
110
120
  if (clear) {