@brightspace-ui/core 1.230.0 → 1.230.4

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.
@@ -264,14 +264,13 @@ class InputNumber extends LabelledMixin(SkeletonMixin(FormElementMixin(LocalizeC
264
264
  countDecimalDigits(this._valueTrailingZeroes, false),
265
265
  this.maxFractionDigits
266
266
  );
267
- let valueTrailingZeroes = this.value.toString();
268
- const decimalDiff = (numDecimals - countDecimalDigits(valueTrailingZeroes, false));
269
- if (decimalDiff > 0) {
270
- if (decimalDiff === numDecimals) {
271
- valueTrailingZeroes += '.';
267
+ const valueTrailingZeroes = new Intl.NumberFormat(
268
+ 'en-US',
269
+ {
270
+ minimumFractionDigits: numDecimals,
271
+ useGrouping: false
272
272
  }
273
- valueTrailingZeroes = valueTrailingZeroes.padEnd(valueTrailingZeroes.length + decimalDiff, '0');
274
- }
273
+ ).format(this.value);
275
274
  return valueTrailingZeroes;
276
275
  }
277
276
  set valueTrailingZeroes(val) {
@@ -105,15 +105,9 @@ export const ListItemMixin = superclass => class extends LocalizeCoreElement(Lis
105
105
  filter: grayscale(75%);
106
106
  opacity: 0.4;
107
107
  }
108
- :host([draggable]) .d2l-list-item-drag-image {
109
- transform: rotate(-1deg);
110
- }
111
108
  :host([dragging]) .d2l-list-item-drag-image {
112
109
  background: white;
113
110
  }
114
- :host([draggable]) d2l-list-item-generic-layout {
115
- transform: rotate(1deg);
116
- }
117
111
  d2l-list-item-generic-layout {
118
112
  border-bottom: 1px solid var(--d2l-color-mica);
119
113
  border-top: 1px solid var(--d2l-color-mica);
@@ -281,10 +275,6 @@ export const ListItemMixin = superclass => class extends LocalizeCoreElement(Lis
281
275
  width: 100%;
282
276
  z-index: 5;
283
277
  }
284
- :host([draggable][selected]:not([disabled])) .d2l-list-item-active-border,
285
- :host([draggable][selected]:not([disabled])) d2l-list-item-generic-layout.d2l-focusing + .d2l-list-item-active-border {
286
- transform: rotate(1deg);
287
- }
288
278
  d2l-tooltip > div {
289
279
  font-weight: 700;
290
280
  }
@@ -466,52 +456,54 @@ export const ListItemMixin = superclass => class extends LocalizeCoreElement(Lis
466
456
  const primaryAction = this._renderPrimaryAction ? this._renderPrimaryAction(this._contentId) : null;
467
457
  const tooltipForId = (primaryAction ? this._primaryActionId : (this.selectable ? this._checkboxId : null));
468
458
 
459
+ const innerView = html`
460
+ <d2l-list-item-generic-layout
461
+ @focusin="${this._onFocusIn}"
462
+ @focusout="${this._onFocusOut}"
463
+ class="${classMap(classes)}"
464
+ data-breakpoint="${this._breakpoint}"
465
+ data-separators="${ifDefined(this._separators)}"
466
+ ?grid-active="${this.role === 'rowgroup'}">
467
+ ${this._renderDropTarget()}
468
+ ${this._renderDragHandle(this._renderOutsideControl)}
469
+ ${this._renderDragTarget(this.dragTargetHandleOnly ? this._renderOutsideControlHandleOnly : this._renderOutsideControlAction)}
470
+ ${this.selectable ? html`
471
+ <div slot="control">${this._renderCheckbox()}</div>
472
+ <div slot="control-action"
473
+ @mouseenter="${this._onMouseEnter}"
474
+ @mouseleave="${this._onMouseLeave}">
475
+ ${this._renderCheckboxAction('')}
476
+ </div>` : nothing }
477
+ ${primaryAction ? html`
478
+ <div slot="content-action"
479
+ @focusin="${this._onFocusInPrimaryAction}"
480
+ @focusout="${this._onFocusOutPrimaryAction}"
481
+ @mouseenter="${this._onMouseEnterPrimaryAction}"
482
+ @mouseleave="${this._onMouseLeavePrimaryAction}">
483
+ ${primaryAction}
484
+ </div>` : nothing}
485
+ <div slot="content"
486
+ class="${classMap(contentClasses)}"
487
+ id="${this._contentId}">
488
+ <slot name="illustration" class="d2l-list-item-illustration">${illustration}</slot>
489
+ <slot>${content}</slot>
490
+ </div>
491
+ <div slot="actions"
492
+ @mouseenter="${this._onMouseEnter}"
493
+ @mouseleave="${this._onMouseLeave}"
494
+ class="d2l-list-item-actions-container">
495
+ <slot name="actions" class="d2l-list-item-actions">${actions}</slot>
496
+ </div>
497
+ <div slot="nested" @d2l-selection-provider-connected="${this._onSelectionProviderConnected}">
498
+ <slot name="nested" @slotchange="${this._onNestedSlotChange}">${nested}</slot>
499
+ </div>
500
+ </d2l-list-item-generic-layout>
501
+ <div class="d2l-list-item-active-border"></div>
502
+ `;
503
+
469
504
  return html`
470
505
  ${this._renderTopPlacementMarker(html`<d2l-list-item-placement-marker></d2l-list-item-placement-marker>`)}
471
- <div class="d2l-list-item-drag-image">
472
- <d2l-list-item-generic-layout
473
- @focusin="${this._onFocusIn}"
474
- @focusout="${this._onFocusOut}"
475
- class="${classMap(classes)}"
476
- data-breakpoint="${this._breakpoint}"
477
- data-separators="${ifDefined(this._separators)}"
478
- ?grid-active="${this.role === 'rowgroup'}">
479
- ${this._renderDropTarget()}
480
- ${this._renderDragHandle(this._renderOutsideControl)}
481
- ${this._renderDragTarget(this.dragTargetHandleOnly ? this._renderOutsideControlHandleOnly : this._renderOutsideControlAction)}
482
- ${this.selectable ? html`
483
- <div slot="control">${this._renderCheckbox()}</div>
484
- <div slot="control-action"
485
- @mouseenter="${this._onMouseEnter}"
486
- @mouseleave="${this._onMouseLeave}">
487
- ${this._renderCheckboxAction('')}
488
- </div>` : nothing }
489
- ${primaryAction ? html`
490
- <div slot="content-action"
491
- @focusin="${this._onFocusInPrimaryAction}"
492
- @focusout="${this._onFocusOutPrimaryAction}"
493
- @mouseenter="${this._onMouseEnterPrimaryAction}"
494
- @mouseleave="${this._onMouseLeavePrimaryAction}">
495
- ${primaryAction}
496
- </div>` : nothing}
497
- <div slot="content"
498
- class="${classMap(contentClasses)}"
499
- id="${this._contentId}">
500
- <slot name="illustration" class="d2l-list-item-illustration">${illustration}</slot>
501
- <slot>${content}</slot>
502
- </div>
503
- <div slot="actions"
504
- @mouseenter="${this._onMouseEnter}"
505
- @mouseleave="${this._onMouseLeave}"
506
- class="d2l-list-item-actions-container">
507
- <slot name="actions" class="d2l-list-item-actions">${actions}</slot>
508
- </div>
509
- <div slot="nested" @d2l-selection-provider-connected="${this._onSelectionProviderConnected}">
510
- <slot name="nested" @slotchange="${this._onNestedSlotChange}">${nested}</slot>
511
- </div>
512
- </d2l-list-item-generic-layout>
513
- <div class="d2l-list-item-active-border"></div>
514
- </div>
506
+ ${this.draggable ? html`<div class="d2l-list-item-drag-image">${innerView}</div>` : innerView}
515
507
  ${this._renderBottomPlacementMarker(html`<d2l-list-item-placement-marker></d2l-list-item-placement-marker>`)}
516
508
  ${this._displayKeyboardTooltip && tooltipForId ? html`<d2l-tooltip align="start" announced for="${tooltipForId}" for-type="descriptor">${this._renderTooltipContent()}</d2l-tooltip>` : ''}
517
509
  `;
@@ -1,6 +1,4 @@
1
-
2
- import { FocusVisiblePolyfillMixin } from '../../mixins/focus-visible-polyfill-mixin.js';
3
- export const MenuItemMixin = superclass => class extends FocusVisiblePolyfillMixin(superclass) {
1
+ export const MenuItemMixin = superclass => class extends superclass {
4
2
 
5
3
  static get properties() {
6
4
  return {
@@ -17,8 +17,8 @@ export const menuItemStyles = css`
17
17
  }
18
18
 
19
19
  :host(:hover),
20
- :host(.focus-visible),
21
- :host(.focus-visible[first]),
20
+ :host(:focus-visible),
21
+ :host(:focus-visible[first]),
22
22
  :host([first]:hover) {
23
23
  background-color: var(--d2l-menu-background-color-hover);
24
24
  border-bottom: 1px solid var(--d2l-menu-border-color-hover);
@@ -27,7 +27,7 @@ export const menuItemStyles = css`
27
27
  z-index: 2;
28
28
  }
29
29
 
30
- :host([disabled]), :host([disabled]:hover), :host([disabled].focus-visible) {
30
+ :host([disabled]), :host([disabled]:hover), :host([disabled]:focus-visible) {
31
31
  cursor: default;
32
32
  opacity: 0.75;
33
33
  }
@@ -40,7 +40,7 @@ export const menuItemStyles = css`
40
40
  border-top-color: transparent;
41
41
  }
42
42
 
43
- :host([last].focus-visible),
43
+ :host([last]:focus-visible),
44
44
  :host([last]:hover) {
45
45
  border-bottom-color: var(--d2l-menu-border-color-hover);
46
46
  }
@@ -2,7 +2,6 @@ import '../colors/colors.js';
2
2
  import '../icons/icon.js';
3
3
  import './menu-item-return.js';
4
4
  import { css, html, LitElement } from 'lit-element/lit-element.js';
5
- import { FocusVisiblePolyfillMixin } from '../../mixins/focus-visible-polyfill-mixin.js';
6
5
  import { HierarchicalViewMixin } from '../hierarchical-view/hierarchical-view-mixin.js';
7
6
  import { ThemeMixin } from '../../mixins/theme-mixin.js';
8
7
 
@@ -21,7 +20,7 @@ const keyCodes = {
21
20
  * @slot - Menu items
22
21
  * @fires d2l-menu-resize - Dispatched when size of menu changes (e.g., when nested menu of a different size is opened)
23
22
  */
24
- class Menu extends ThemeMixin(HierarchicalViewMixin(FocusVisiblePolyfillMixin(LitElement))) {
23
+ class Menu extends ThemeMixin(HierarchicalViewMixin(LitElement)) {
25
24
 
26
25
  static get properties() {
27
26
  return {
@@ -1,4 +1,34 @@
1
+ /* When updating MathJax, update mathjaxBaseUrl to use the new version
2
+ * and verify that the font mappings included in mathjaxFontMappings
3
+ * match what's present in the MathJax-src repo.
4
+ */
5
+
1
6
  const mathjaxContextAttribute = 'data-mathjax-context';
7
+ const mathjaxBaseUrl = 'https://s.brightspace.com/lib/mathjax/3.1.2';
8
+
9
+ const mathjaxFontMappings = new Map([
10
+ ['MJXTEX', 'MathJax_Main-Regular'],
11
+ ['MJXTEX-B', 'MathJax_Main-Bold'],
12
+ ['MJXTEX-I', 'MathJax_Math-Italic'],
13
+ ['MJXTEX-MI', 'MathJax_Main-Italic'],
14
+ ['MJXTEX-BI', 'MathJax_Math-BoldItalic'],
15
+ ['MJXTEX-S1', 'MathJax_Size1-Regular'],
16
+ ['MJXTEX-S2', 'MathJax_Size2-Regular'],
17
+ ['MJXTEX-S3', 'MathJax_Size3-Regular'],
18
+ ['MJXTEX-S4', 'MathJax_Size4-Regular'],
19
+ ['MJXTEX-A', 'MathJax_AMS-Regular'],
20
+ ['MJXTEX-C', 'MathJax_Calligraphic-Regular'],
21
+ ['MJXTEX-CB', 'MathJax_Calligraphic-Bold'],
22
+ ['MJXTEX-FR', 'MathJax_Fraktur-Regular'],
23
+ ['MJXTEX-FRB', 'MathJax_Fraktur-Bold'],
24
+ ['MJXTEX-SS', 'MathJax_SansSerif-Regular'],
25
+ ['MJXTEX-SSB', 'MathJax_SansSerif-Bold'],
26
+ ['MJXTEX-SSI', 'MathJax_SansSerif-Italic'],
27
+ ['MJXTEX-SC', 'MathJax_Script-Regular'],
28
+ ['MJXTEX-T', 'MathJax_Typewriter-Regular'],
29
+ ['MJXTEX-V', 'MathJax_Vector-Regular'],
30
+ ['MJXTEX-VB', 'MathJax_Vector-Bold']
31
+ ]);
2
32
 
3
33
  let mathJaxLoaded;
4
34
 
@@ -158,6 +188,23 @@ export function loadMathJax(mathJaxConfig) {
158
188
  }
159
189
  };
160
190
 
191
+ if (mathJaxConfig && mathJaxConfig.deferTypeset && !document.head.querySelector('#d2l-mathjax-fonts') && !document.head.querySelector('#MJX-CHTML-styles')) {
192
+ const styleElem = document.createElement('style');
193
+ styleElem.id = 'd2l-mathjax-fonts';
194
+
195
+ let fontImportStyles = '';
196
+ mathjaxFontMappings.forEach((font, family) => {
197
+ fontImportStyles +=
198
+ `\n@font-face {
199
+ font-family: ${family};
200
+ src: url("${mathjaxBaseUrl}/output/chtml/fonts/woff-v2/${font}.woff") format("woff");
201
+ }`;
202
+ });
203
+
204
+ styleElem.textContent = fontImportStyles;
205
+ document.head.appendChild(styleElem);
206
+ }
207
+
161
208
  mathJaxLoaded = new Promise(resolve => {
162
209
  const script = document.createElement('script');
163
210
  script.async = 'async';
@@ -167,7 +214,7 @@ export function loadMathJax(mathJaxConfig) {
167
214
  ? 'tex-mml-chtml'
168
215
  : 'mml-chtml';
169
216
 
170
- script.src = `https://s.brightspace.com/lib/mathjax/3.1.2/${component}.js`;
217
+ script.src = `${mathjaxBaseUrl}/${component}.js`;
171
218
  document.head.appendChild(script);
172
219
  });
173
220
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightspace-ui/core",
3
- "version": "1.230.0",
3
+ "version": "1.230.4",
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",