@brightspace-ui/core 2.107.4 → 2.108.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.
@@ -71,6 +71,7 @@ The `d2l-dialog` element is a generic dialog that provides a slot for arbitrary
71
71
  |--|--|--|
72
72
  | `title-text` | String, required | Text displayed in the header of the dialog |
73
73
  | `async` | Boolean | Whether to render a loading-spinner and wait for state changes via [AsyncContainerMixin](../../mixins/async-container) |
74
+ | `full-height` | Boolean | Whether to render the dialog at the maximum height |
74
75
  | `opened` | Boolean | Whether or not the dialog is open |
75
76
  | `width` | Number, default: `600` | The preferred width (unit-less) for the dialog |
76
77
 
@@ -43,10 +43,10 @@ export const DialogMixin = superclass => class extends RtlMixin(superclass) {
43
43
  */
44
44
  titleText: { type: String, attribute: 'title-text' },
45
45
  _autoSize: { state: true },
46
- _fullHeight: { state: true },
47
46
  _fullscreenWithin: { state: true },
48
47
  _height: { state: true },
49
48
  _inIframe: { type: Boolean, attribute: 'in-iframe', reflect: true },
49
+ _isFullHeight: { state: true },
50
50
  _left: { state: true },
51
51
  _margin: { state: true },
52
52
  _nestedShowing: { state: true },
@@ -66,24 +66,24 @@ export const DialogMixin = superclass => class extends RtlMixin(superclass) {
66
66
  this.opened = false;
67
67
  this._autoSize = true;
68
68
  this._dialogId = getUniqueId();
69
- this._fullHeight = false;
70
69
  this._fullscreenWithin = 0;
71
70
  this._handleMvcDialogOpen = this._handleMvcDialogOpen.bind(this);
72
71
  this._inIframe = false;
72
+ this._isFullHeight = false;
73
73
  this._height = 0;
74
+ this._left = 0;
74
75
  this._margin = { top: defaultMargin.top, right: defaultMargin.right, bottom: defaultMargin.bottom, left: defaultMargin.left };
75
- this._parentDialog = null;
76
76
  this._nestedShowing = false;
77
- this._state = null;
78
- this._left = 0;
79
77
  this._overflowBottom = false;
80
78
  this._overflowTop = false;
79
+ this._parentDialog = null;
81
80
  this._scroll = false;
81
+ this._state = null;
82
82
  this._top = 0;
83
- this._width = 0;
84
- this._useNative = (window.D2L.DialogMixin.hasNative && window.D2L.DialogMixin.preferNative);
85
- this._updateSize = this._updateSize.bind(this);
86
83
  this._updateOverflow = this._updateOverflow.bind(this);
84
+ this._updateSize = this._updateSize.bind(this);
85
+ this._useNative = (window.D2L.DialogMixin.hasNative && window.D2L.DialogMixin.preferNative);
86
+ this._width = 0;
87
87
  }
88
88
 
89
89
  async connectedCallback() {
@@ -252,24 +252,28 @@ export const DialogMixin = superclass => class extends RtlMixin(superclass) {
252
252
  : window.innerHeight - this._margin.top - this._margin.bottom;
253
253
  let preferredHeight = 2;
254
254
 
255
- const header = this.shadowRoot.querySelector('.d2l-dialog-header');
256
- if (header) preferredHeight += Math.ceil(header.getBoundingClientRect().height);
255
+ if (this.fullHeight) {
256
+ preferredHeight = 2 * this._width;
257
+ } else {
258
+ const header = this.shadowRoot.querySelector('.d2l-dialog-header');
259
+ if (header) preferredHeight += Math.ceil(header.getBoundingClientRect().height);
257
260
 
258
- const contentOuter = this.shadowRoot.querySelector('.d2l-dialog-content');
259
- const content = this.shadowRoot.querySelector('.d2l-dialog-content > div');
261
+ const contentOuter = this.shadowRoot.querySelector('.d2l-dialog-content');
262
+ const content = this.shadowRoot.querySelector('.d2l-dialog-content > div');
260
263
 
261
- /* required to properly calculate the preferred height when there are top
262
- margins at the beginning of slotted content */
263
- if (contentOuter && content) {
264
- const offsetDiff = content.offsetTop - contentOuter.offsetTop;
265
- preferredHeight += content.offsetHeight + offsetDiff;
266
- }
264
+ /* required to properly calculate the preferred height when there are top
265
+ margins at the beginning of slotted content */
266
+ if (contentOuter && content) {
267
+ const offsetDiff = content.offsetTop - contentOuter.offsetTop;
268
+ preferredHeight += content.offsetHeight + offsetDiff;
269
+ }
267
270
 
268
- const footer = this.shadowRoot.querySelector('.d2l-dialog-footer');
269
- if (footer) preferredHeight += Math.ceil(footer.getBoundingClientRect().height);
271
+ const footer = this.shadowRoot.querySelector('.d2l-dialog-footer');
272
+ if (footer) preferredHeight += Math.ceil(footer.getBoundingClientRect().height);
273
+ }
270
274
 
271
275
  const exceedsHeight = preferredHeight > availableHeight;
272
- this._fullHeight = !this._ifrauContextInfo && exceedsHeight;
276
+ this._isFullHeight = !this._ifrauContextInfo && exceedsHeight;
273
277
 
274
278
  const height = exceedsHeight ? availableHeight : preferredHeight;
275
279
  return height;
@@ -448,7 +452,7 @@ export const DialogMixin = superclass => class extends RtlMixin(superclass) {
448
452
  if (this._ifrauContextInfo) styles.top = `${this._top}px`;
449
453
  if (this._ifrauContextInfo) styles.bottom = 'auto';
450
454
  if (this._left) styles.left = `${this._left}px`;
451
- if (this._height && !this._fullHeight) styles.height = `${this._height}px`;
455
+ if (this._height && !this._isFullHeight) styles.height = `${this._height}px`;
452
456
  if (this._width) styles.width = `${this._width}px`;
453
457
  else styles.width = 'auto';
454
458
  } else if (iframeTopOverride && this._ifrauContextInfo) {
@@ -457,7 +461,7 @@ export const DialogMixin = superclass => class extends RtlMixin(superclass) {
457
461
 
458
462
  const dialogOuterClasses = {
459
463
  'd2l-dialog-outer': true,
460
- 'd2l-dialog-outer-full-height': this._autoSize && this._fullHeight,
464
+ 'd2l-dialog-outer-full-height': this._autoSize && this._isFullHeight,
461
465
  'd2l-dialog-outer-overflow-bottom': this._overflowBottom,
462
466
  'd2l-dialog-outer-overflow-top': this._overflowTop,
463
467
  'd2l-dialog-outer-nested': !this._useNative && this._parentDialog,
@@ -33,6 +33,11 @@ class Dialog extends LocalizeCoreElement(AsyncContainerMixin(DialogMixin(LitElem
33
33
  */
34
34
  describeContent: { type: Boolean, attribute: 'describe-content' },
35
35
 
36
+ /**
37
+ * Whether to render the dialog at the maximum height
38
+ */
39
+ fullHeight: { type: Boolean, attribute: 'full-height' },
40
+
36
41
  /**
37
42
  * The preferred width (unit-less) for the dialog
38
43
  */
@@ -79,6 +84,7 @@ class Dialog extends LocalizeCoreElement(AsyncContainerMixin(DialogMixin(LitElem
79
84
  super();
80
85
  this.async = false;
81
86
  this.describeContent = false;
87
+ this.fullHeight = false;
82
88
  this.width = 600;
83
89
  this._handleResize = this._handleResize.bind(this);
84
90
  }
@@ -2020,6 +2020,12 @@
2020
2020
  "type": "boolean",
2021
2021
  "default": "false"
2022
2022
  },
2023
+ {
2024
+ "name": "full-height",
2025
+ "description": "Whether to render the dialog at the maximum height",
2026
+ "type": "boolean",
2027
+ "default": "false"
2028
+ },
2023
2029
  {
2024
2030
  "name": "width",
2025
2031
  "description": "The preferred width (unit-less) for the dialog",
@@ -2053,6 +2059,13 @@
2053
2059
  "type": "boolean",
2054
2060
  "default": "false"
2055
2061
  },
2062
+ {
2063
+ "name": "fullHeight",
2064
+ "attribute": "full-height",
2065
+ "description": "Whether to render the dialog at the maximum height",
2066
+ "type": "boolean",
2067
+ "default": "false"
2068
+ },
2056
2069
  {
2057
2070
  "name": "width",
2058
2071
  "attribute": "width",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightspace-ui/core",
3
- "version": "2.107.4",
3
+ "version": "2.108.0",
4
4
  "description": "A collection of accessible, free, open-source web components for building Brightspace applications",
5
5
  "type": "module",
6
6
  "repository": "https://github.com/BrightspaceUI/core.git",