@brightspace-ui/core 2.15.3 → 2.16.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.
@@ -89,7 +89,12 @@ class DialogConfirm extends DialogMixin(LitElement) {
89
89
  const descId = (this.titleText && this.text) ? this._textId : undefined;
90
90
  return this._render(
91
91
  inner,
92
- { labelId: labelId, descId: descId, role: 'alertdialog' }
92
+ {
93
+ descId: descId,
94
+ fullscreenMobile: false,
95
+ labelId: labelId,
96
+ role: 'alertdialog'
97
+ }
93
98
  );
94
99
  }
95
100
 
@@ -154,11 +154,6 @@ class DialogFullscreen extends LocalizeCoreElement(AsyncContainerMixin(DialogMix
154
154
  padding-bottom: 15px;
155
155
  }
156
156
 
157
- .d2l-dialog-header > div > d2l-button-icon {
158
- flex: none;
159
- margin: -8px -13px 0 15px;
160
- }
161
-
162
157
  .d2l-dialog-footer.d2l-footer-no-content {
163
158
  padding: 0 0 5px 0;
164
159
  }
@@ -171,17 +166,6 @@ class DialogFullscreen extends LocalizeCoreElement(AsyncContainerMixin(DialogMix
171
166
  height: calc(100% - 1px);
172
167
  }
173
168
 
174
- :host([dir="rtl"]) .d2l-dialog-header > div > d2l-button-icon {
175
- margin-left: -13px;
176
- margin-right: 15px;
177
- }
178
-
179
- dialog.d2l-dialog-outer,
180
- div.d2l-dialog-outer {
181
- margin: 0 !important;
182
- min-width: calc(var(--d2l-vw, 1vw) * 100);
183
- top: 42px;
184
- }
185
169
  }
186
170
  `];
187
171
  }
@@ -226,9 +210,6 @@ class DialogFullscreen extends LocalizeCoreElement(AsyncContainerMixin(DialogMix
226
210
  : 0;
227
211
  const startTop = mediaQueryList.matches ? 42 : 0;
228
212
  topOverride = iframeTop + startTop;
229
- } else if (window.innerWidth <= 615 || (window.innerWidth <= 900 && window.innerHeight <= 420)) {
230
- heightOverride.height = `${window.innerHeight - 42 - 2}px`; // render full window height - 42px top padding - 2px border
231
- heightOverride.minHeight = heightOverride.height;
232
213
  }
233
214
 
234
215
  let loading = null;
@@ -269,7 +250,11 @@ class DialogFullscreen extends LocalizeCoreElement(AsyncContainerMixin(DialogMix
269
250
  `;
270
251
  return this._render(
271
252
  inner,
272
- { labelId: this._titleId, role: 'dialog' },
253
+ {
254
+ fullscreenMobile: true,
255
+ labelId: this._titleId,
256
+ role: 'dialog'
257
+ },
273
258
  topOverride
274
259
  );
275
260
  }
@@ -1,4 +1,5 @@
1
1
  import '../focus-trap/focus-trap.js';
2
+ import '../../helpers/viewport-size.js';
2
3
  import { allowBodyScroll, preventBodyScroll } from '../backdrop/backdrop.js';
3
4
  import { clearDismissible, setDismissible } from '../../helpers/dismissible.js';
4
5
  import { findComposedAncestor, isComposedAncestor } from '../../helpers/dom.js';
@@ -420,6 +421,7 @@ export const DialogMixin = superclass => class extends RtlMixin(superclass) {
420
421
  'd2l-dialog-outer-nested': !this._useNative && this._parentDialog,
421
422
  'd2l-dialog-outer-nested-showing': !this._useNative && this._nestedShowing,
422
423
  'd2l-dialog-outer-scroll': this._scroll,
424
+ 'd2l-dialog-fullscreen-mobile': info.fullscreenMobile,
423
425
  'd2l-dialog-fullscreen-within': this._fullscreenWithin !== 0
424
426
  };
425
427
 
@@ -154,12 +154,29 @@ export const dialogStyles = css`
154
154
  .d2l-dialog-header {
155
155
  padding: 14px 20px 16px 20px;
156
156
  }
157
+ .d2l-dialog-fullscreen-mobile .d2l-dialog-header > div > d2l-button-icon {
158
+ margin: -8px -13px 0 15px;
159
+ }
160
+ :host([dir="rtl"]) .d2l-dialog-fullscreen-mobile .d2l-dialog-header > div > d2l-button-icon {
161
+ margin-left: -13px;
162
+ margin-right: 15px;
163
+ }
157
164
  .d2l-dialog-content {
158
165
  padding: 0 20px;
159
166
  }
160
167
  .d2l-dialog-footer {
161
168
  padding: 20px 20px 2px 20px;
162
169
  }
170
+ .d2l-dialog-outer.d2l-dialog-fullscreen-mobile {
171
+ margin: 0 !important;
172
+ min-width: calc(var(--d2l-vw, 1vw) * 100);
173
+ top: 42px;
174
+ }
175
+ :host(:not([in-iframe])) dialog.d2l-dialog-outer.d2l-dialog-fullscreen-mobile,
176
+ :host(:not([in-iframe])) div.d2l-dialog-outer.d2l-dialog-fullscreen-mobile {
177
+ height: calc(var(--d2l-vh, 1vh) * 100 - 42px);
178
+ min-height: calc(var(--d2l-vh, 1vh) * 100 - 42px);
179
+ }
163
180
  }
164
181
 
165
182
  @media (prefers-reduced-motion: reduce) {
@@ -1,6 +1,5 @@
1
1
  import '../button/button-icon.js';
2
2
  import '../loading-spinner/loading-spinner.js';
3
- import '../../helpers/viewport-size.js';
4
3
  import { AsyncContainerMixin, asyncStates } from '../../mixins/async-container/async-container-mixin.js';
5
4
  import { css, html, LitElement } from 'lit';
6
5
  import { classMap } from 'lit/directives/class-map.js';
@@ -73,30 +72,6 @@ class Dialog extends LocalizeCoreElement(AsyncContainerMixin(DialogMixin(LitElem
73
72
  padding: 0 0 5px 0;
74
73
  }
75
74
 
76
- @media (max-width: 615px), (max-height: 420px) and (max-width: 900px) {
77
-
78
- .d2l-dialog-outer {
79
- margin: 0 !important;
80
- min-width: calc(var(--d2l-vw, 1vw) * 100);
81
- top: 42px;
82
- }
83
-
84
- .d2l-dialog-header > div > d2l-button-icon {
85
- margin: -8px -13px 0 15px;
86
- }
87
-
88
- :host([dir="rtl"]) .d2l-dialog-header > div > d2l-button-icon {
89
- margin-left: -13px;
90
- margin-right: 15px;
91
- }
92
-
93
- :host(:not([in-iframe])) dialog.d2l-dialog-outer,
94
- :host(:not([in-iframe])) div.d2l-dialog-outer {
95
- height: calc(var(--d2l-vh, 1vh) * 100 - 42px);
96
- min-height: calc(var(--d2l-vh, 1vh) * 100 - 42px);
97
- }
98
- }
99
-
100
75
  `];
101
76
  }
102
77
 
@@ -167,7 +142,7 @@ class Dialog extends LocalizeCoreElement(AsyncContainerMixin(DialogMixin(LitElem
167
142
 
168
143
  if (!this._titleId) this._titleId = getUniqueId();
169
144
  const inner = html`
170
- <div class="d2l-dialog-inner" style=${styleMap(heightOverride)}>
145
+ <div class="d2l-dialog-inner" style=${styleMap(heightOverride)}>
171
146
  <div class="d2l-dialog-header">
172
147
  <div>
173
148
  <h2 id="${this._titleId}" class="d2l-heading-3">${this.titleText}</h2>
@@ -184,7 +159,12 @@ class Dialog extends LocalizeCoreElement(AsyncContainerMixin(DialogMixin(LitElem
184
159
  const descId = (this.describeContent) ? this._textId : undefined;
185
160
  return this._render(
186
161
  inner,
187
- { labelId: this._titleId, descId: descId, role: 'dialog' },
162
+ {
163
+ descId: descId,
164
+ fullscreenMobile: true,
165
+ labelId: this._titleId,
166
+ role: 'dialog'
167
+ },
188
168
  topOverride
189
169
  );
190
170
  }
@@ -159,7 +159,8 @@ The filter will announce changes to filter selections, search results, and when
159
159
  | Property | Type | Description |
160
160
  |---|---|---|
161
161
  | `disabled` | Boolean, default: `false` | Disables the dropdown opener for the filter |
162
- | `opened` | Boolean, default: `false` | Whether or not the filter is open |
162
+ | `opened` | Boolean, default: `false` | Whether or not the filter is open |
163
+ | `text` | String | Optional override for the button text used for a multi-dimensional filter |
163
164
 
164
165
  ### Events
165
166
  * `d2l-filter-change`: dispatched when any filter value has changed (may contain info about multiple dimensions and multiple changes in each)
@@ -92,7 +92,7 @@
92
92
  <d2l-filter>
93
93
  <d2l-filter-dimension-set key="course" text="Course" loading select-all>
94
94
  <d2l-filter-dimension-set-value key="art" text="Art"></d2l-filter-dimension-set-value>
95
- <d2l-filter-dimension-set-value key="astronomy" text="Astronomy" selected></d2l-filter-dimension-set-value>
95
+ <d2l-filter-dimension-set-value key="astronomy" text="Astronomy"></d2l-filter-dimension-set-value>
96
96
  <d2l-filter-dimension-set-value key="biology" text="Biology"></d2l-filter-dimension-set-value>
97
97
  <d2l-filter-dimension-set-value key="chemistry" text="Chemistry"></d2l-filter-dimension-set-value>
98
98
  <d2l-filter-dimension-set-value key="drama" text="Drama"></d2l-filter-dimension-set-value>
@@ -105,9 +105,13 @@
105
105
  </d2l-filter-dimension-set>
106
106
 
107
107
  </d2l-filter>
108
- <d2l-filter>
108
+ <d2l-filter text="More Filters">
109
109
  <d2l-filter-dimension-set key="course" text="Course" loading select-all></d2l-filter-dimension-set>
110
- <d2l-filter-dimension-set key="role" text="Role" loading></d2l-filter-dimension-set>
110
+ <d2l-filter-dimension-set key="role" text="Role" loading>
111
+ <d2l-filter-dimension-set-value key="admin" text="Admin"></d2l-filter-dimension-set-value>
112
+ <d2l-filter-dimension-set-value key="instructor" text="Instructor"></d2l-filter-dimension-set-value>
113
+ <d2l-filter-dimension-set-value key="student" text="Student"></d2l-filter-dimension-set-value>
114
+ </d2l-filter-dimension-set>
111
115
  <d2l-filter-dimension-set key="semester" text="Semester" loading selection-single></d2l-filter-dimension-set>
112
116
  </d2l-filter>
113
117
  <d2l-button id="finish-loading">Finish loading (in 5 seconds)</d2l-button>
@@ -52,6 +52,11 @@ class Filter extends FocusMixin(LocalizeCoreElement(RtlMixin(LitElement))) {
52
52
  * @type {boolean}
53
53
  */
54
54
  opened: { type: Boolean, reflect: true },
55
+ /**
56
+ * Optional override for the button text used for a multi-dimensional filter
57
+ * @type {string}
58
+ */
59
+ text: { type: String },
55
60
  _activeDimensionKey: { type: String, attribute: false },
56
61
  _dimensions: { type: Array, attribute: false },
57
62
  _totalAppliedCount: { type: Number, attribute: false }
@@ -175,7 +180,7 @@ class Filter extends FocusMixin(LocalizeCoreElement(RtlMixin(LitElement))) {
175
180
  const dimensions = this._buildDimensions(singleDimension);
176
181
 
177
182
  const filterCount = this._formatFilterCount(this._totalAppliedCount);
178
- let buttonText = singleDimension ? this._dimensions[0].text : this.localize('components.filter.filters');
183
+ let buttonText = singleDimension ? this._dimensions[0].text : (this.text || this.localize('components.filter.filters'));
179
184
  if (filterCount) buttonText = `${buttonText} (${filterCount})`;
180
185
 
181
186
  let description = singleDimension ? this.localize('components.filter.singleDimensionDescription', { filterName: this._dimensions[0].text }) : this.localize('components.filter.filters');
@@ -3146,6 +3146,11 @@
3146
3146
  "path": "./components/filter/filter.js",
3147
3147
  "description": "A filter component that contains one or more dimensions a user can filter by.\nThis component is in charge of all rendering.",
3148
3148
  "attributes": [
3149
+ {
3150
+ "name": "text",
3151
+ "description": "Optional override for the button text used for a multi-dimensional filter",
3152
+ "type": "string"
3153
+ },
3149
3154
  {
3150
3155
  "name": "disabled",
3151
3156
  "description": "Disables the dropdown opener for the filter",
@@ -3160,6 +3165,12 @@
3160
3165
  }
3161
3166
  ],
3162
3167
  "properties": [
3168
+ {
3169
+ "name": "text",
3170
+ "attribute": "text",
3171
+ "description": "Optional override for the button text used for a multi-dimensional filter",
3172
+ "type": "string"
3173
+ },
3163
3174
  {
3164
3175
  "name": "disabled",
3165
3176
  "attribute": "disabled",
@@ -56,19 +56,24 @@ export class HtmlBlockMathRenderer {
56
56
 
57
57
  await loadMathJax(mathJaxConfig);
58
58
 
59
+ // MathJax 3 does not support newlines, but it does persist styles, so add custom styles to mimic a linebreak
60
+ // This work-around should be removed when linebreaks are natively supported.
61
+ // MathJax issue: https://github.com/mathjax/MathJax/issues/2312
62
+ // A duplicate that explains our exact issue: https://github.com/mathjax/MathJax/issues/2495
63
+ const lineBreakStyle = 'display: block; height: 0.5rem;';
64
+
59
65
  // If we're opting out of deferred rendering, we need to rely
60
66
  // on the global MathJax install for rendering.
61
67
  if (options.noDeferredRendering) {
68
+ elem.querySelectorAll('mspace[linebreak="newline"]').forEach(elm => {
69
+ elm.setAttribute('style', lineBreakStyle);
70
+ });
62
71
  await window.MathJax.startup.promise;
63
72
  window.MathJax.typeset([elem]);
64
73
  return elem;
65
74
  }
66
75
 
67
- // MathJax 3 does not support newlines, but it does persist styles, so add custom styles to mimic a linebreak
68
- // This work-around should be removed when linebreaks are natively supported.
69
- // MathJax issue: https://github.com/mathjax/MathJax/issues/2312
70
- // A duplicate that explains our exact issue: https://github.com/mathjax/MathJax/issues/2495
71
- const inner = elem.innerHTML.replaceAll('<mspace linebreak="newline">', '<mspace linebreak="newline" style="display: block; height: 0.5rem;">');
76
+ const inner = elem.innerHTML.replaceAll('<mspace linebreak="newline">', `<mspace linebreak="newline" style="${lineBreakStyle}">`);
72
77
 
73
78
  const temp = document.createElement('div');
74
79
  temp.style.display = 'none';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightspace-ui/core",
3
- "version": "2.15.3",
3
+ "version": "2.16.1",
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",