@brightspace-ui/core 1.230.1 → 1.231.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.
@@ -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) {
@@ -13,10 +13,10 @@
13
13
  import '../../menu/menu.js';
14
14
  import '../../menu/menu-item.js';
15
15
  import '../../selection/selection-action.js';
16
+ import '../../selection/selection-action-dropdown.js';
16
17
  import '../../selection/selection-action-menu-item.js';
17
18
  import '../../tooltip/tooltip.js';
18
19
  import '../list-header.js';
19
- import '../list-item-button.js';
20
20
  import '../list-item-content.js';
21
21
  import '../list-item.js';
22
22
  import '../list.js';
@@ -69,7 +69,20 @@
69
69
  <d2l-list id="allFeatures" item-count="50">
70
70
  <d2l-list-header slot="header" select-all-pages-allowed>
71
71
  <d2l-selection-action icon="tier1:plus-default" text="Add"></d2l-selection-action>
72
- <d2l-selection-action icon="tier1:delete" text="Delete" requires-selection></d2l-selection-action>
72
+ <d2l-selection-action-dropdown text="Move To" requires-selection>
73
+ <d2l-dropdown-menu>
74
+ <d2l-menu label="Move To Options">
75
+ <d2l-menu-item text="Top of Quiz"></d2l-menu-item>
76
+ <d2l-menu-item text="Bottom of Quiz"></d2l-menu-item>
77
+ <d2l-menu-item text="Section">
78
+ <d2l-menu>
79
+ <d2l-menu-item text="Option 1"></d2l-menu-item>
80
+ <d2l-menu-item text="Option 2"></d2l-menu-item>
81
+ </d2l-menu-item>
82
+ </d2l-menu-item>
83
+ </d2l-menu>
84
+ </d2l-dropdown-menu>
85
+ </d2l-selection-action-dropdown>
73
86
  <d2l-dropdown-button-subtle text="Actions">
74
87
  <d2l-dropdown-menu>
75
88
  <d2l-menu label="Actions">
@@ -78,7 +91,7 @@
78
91
  </d2l-menu>
79
92
  </d2l-dropdown-menu>
80
93
  </d2l-dropdown-button-subtle>
81
- <d2l-selection-action icon="tier1:gear" text="Settings"></d2l-selection-action>
94
+ <d2l-selection-action icon="tier1:gear" text="Settings" requires-selection></d2l-selection-action>
82
95
  </d2l-list-header>
83
96
  <d2l-list-item href="http://www.d2l.com" selectable key="1" label="Introductory Earth Sciences">
84
97
  <img slot="illustration" src="https://s.brightspace.com/course-images/images/38e839b1-37fa-470c-8830-b189ce4ae134/tile-high-density-max-size.jpg"></img>
@@ -226,11 +239,5 @@
226
239
 
227
240
  </d2l-demo-page>
228
241
 
229
- <script>
230
- document.body.addEventListener('d2l-list-item-button-click', (e) => {
231
- console.log('d2l-list-item-button clicked!', e);
232
- });
233
- </script>
234
-
235
242
  </body>
236
243
  </html>
@@ -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
  `;
@@ -32,7 +32,7 @@ const OPENER_STYLE = {
32
32
 
33
33
  function createMenuItem(node) {
34
34
  const childText = node.text || node.firstChild && (node.firstChild.label || node.firstChild.text || node.firstChild.textContent.trim());
35
- const disabled = node.disabled;
35
+ const disabled = !!node.disabled;
36
36
  const handleItemSelect = () => {
37
37
  node.dispatchEvent(new CustomEvent('d2l-button-ghost-click'));
38
38
  node.click();
@@ -67,11 +67,14 @@ function createMenuItemMenu(node) {
67
67
  || node.querySelector('d2l-dropdown-button-subtle');
68
68
 
69
69
  const openerText = node.text || menuOpener.text;
70
+ const disabled = !!node.disabled;
70
71
  const subMenu = node.querySelector('d2l-menu');
71
72
 
72
73
  const subItems = Array.from(subMenu.children).map((node) => convertToDropdownItem(node));
73
74
 
74
- return html`<d2l-menu-item text="${openerText}">
75
+ return html`<d2l-menu-item
76
+ ?disabled=${disabled}
77
+ text="${openerText}">
75
78
  <d2l-menu>
76
79
  ${subItems}
77
80
  </d2l-menu>
@@ -96,6 +99,7 @@ function convertToDropdownItem(node) {
96
99
  case 'd2l-dropdown-button-subtle':
97
100
  case 'd2l-dropdown-context-menu':
98
101
  case 'd2l-dropdown-more':
102
+ case 'd2l-selection-action-dropdown':
99
103
  return createMenuItemMenu(node);
100
104
  case 'd2l-menu-item':
101
105
  case 'd2l-selection-action-menu-item':
@@ -199,7 +203,9 @@ class OverflowGroup extends RtlMixin(LocalizeCoreElement(LitElement)) {
199
203
  .d2l-overflow-group-container ::slotted(d2l-dropdown-button),
200
204
  .d2l-overflow-group-container ::slotted(d2l-dropdown-button-subtle),
201
205
  .d2l-overflow-group-container ::slotted(d2l-dropdown-more),
202
- .d2l-overflow-group-container ::slotted(d2l-dropdown-context-menu) {
206
+ .d2l-overflow-group-container ::slotted(d2l-dropdown-context-menu),
207
+ .d2l-overflow-group-container ::slotted(d2l-selection-action),
208
+ .d2l-overflow-group-container ::slotted(d2l-selection-action-dropdown) {
203
209
  margin-right: 0.6rem;
204
210
  }
205
211
  :host([dir="rtl"]) .d2l-overflow-group-container ::slotted(d2l-button),
@@ -210,7 +216,9 @@ class OverflowGroup extends RtlMixin(LocalizeCoreElement(LitElement)) {
210
216
  :host([dir="rtl"]) .d2l-overflow-group-container ::slotted(d2l-dropdown-button),
211
217
  :host([dir="rtl"]) .d2l-overflow-group-container ::slotted(d2l-dropdown-button-subtle),
212
218
  :host([dir="rtl"]) .d2l-overflow-group-container ::slotted(d2l-dropdown-more),
213
- :host([dir="rtl"]) .d2l-overflow-group-container ::slotted(d2l-dropdown-context-menu) {
219
+ :host([dir="rtl"]) .d2l-overflow-group-container ::slotted(d2l-dropdown-context-menu),
220
+ :host([dir="rtl"]) .d2l-overflow-group-container ::slotted(d2l-selection-action),
221
+ :host([dir="rtl"]) .d2l-overflow-group-container ::slotted(d2l-selection-action-dropdown) {
214
222
  margin-left: 0.6rem;
215
223
  margin-right: 0;
216
224
  }
@@ -148,9 +148,41 @@ The `d2l-selection-action` is an optional component that provides a button for a
148
148
  | `d2l-selection-action-click` | Dispatched when the user clicks the action button. The `SelectionInfo` is provided as the event `detail`. If `requires-selection` was specified then the event will only be dispatched if items are selected. |
149
149
  <!-- docs: end hidden content -->
150
150
 
151
+ ## Selection Action Dropdown [d2l-selection-action-dropdown]
152
+
153
+ The `d2l-selection-action-dropdown` is an optional component that provides a button opener for dropdown content associated with the selection component (ex. bulk actions). The `requires-selection` attribute may be specified to indicate that the opener should be non-interactive if nothing is selected.
154
+
155
+ <!-- docs: demo live name:d2l-selection-action-dropdown -->
156
+ ```html
157
+ <script type="module">
158
+ import '@brightspace-ui/core/components/dropdown/dropdown-menu.js';
159
+ import '@brightspace-ui/core/components/menu/menu.js';
160
+ import '@brightspace-ui/core/components/menu/menu-item.js';
161
+ import '@brightspace-ui/core/components/selection/selection-action-dropdown.js';
162
+ </script>
163
+ <d2l-selection-action-dropdown text="Actions" requires-selection>
164
+ <d2l-dropdown-menu>
165
+ <d2l-menu label="Actions">
166
+ <d2l-menu-item text="Action 1"></d2l-menu-item>
167
+ <d2l-menu-item text="Action 2"></d2l-menu-item>
168
+ </d2l-menu>
169
+ </d2l-dropdown-menu>
170
+ </d2l-selection-action-dropdown>
171
+ ```
172
+
173
+ <!-- docs: start hidden content -->
174
+ ### Properties
175
+
176
+ | Property | Type | Description |
177
+ |---|---|---|
178
+ | `requires-selection` | Boolean | Whether the action dropdown opener requires one or more selected items. If no items are selected, the opener will be focusable and a hint displayed in a tooltip. |
179
+ | `selection-for` | String | Id of the corresponding `SelectionMixin` component, if not placed within it. |
180
+ | `text` | String, required | Text for the dropdown opener button. |
181
+ <!-- docs: end hidden content -->
182
+
151
183
  ## Selection Action Menu Item [d2l-selection-action-menu-item]
152
184
 
153
- The `d2l-selection-action-menu-item` is an optional component that is a menu item for actions associated with the selection component (ex. bulk actions). The `requires-selection` attribute may be specified to indicate that the button should be non-interactive if nothing is selected.
185
+ The `d2l-selection-action-menu-item` is an optional component that is a menu item for actions associated with the selection component (ex. bulk actions). The `requires-selection` attribute may be specified to indicate that the menu item should be non-interactive if nothing is selected. This component enables the app to define an opener that is enabled regardless of the selection state, while having a menu containing one or more menu items that `requires-selection`.
154
186
 
155
187
  <!-- docs: demo live name:d2l-selection-action-menu-item -->
156
188
  ```html
@@ -6,10 +6,10 @@
6
6
  <link rel="stylesheet" href="../../demo/styles.css" type="text/css">
7
7
  <script type="module">
8
8
  import '../../demo/demo-page.js';
9
- import '../../dropdown/dropdown-button-subtle.js';
10
9
  import '../../dropdown/dropdown-menu.js';
11
10
  import '../../menu/menu.js';
12
11
  import '../selection-action.js';
12
+ import '../selection-action-dropdown.js';
13
13
  import '../selection-action-menu-item.js';
14
14
  import '../selection-input.js';
15
15
  import '../selection-select-all.js';
@@ -61,14 +61,14 @@
61
61
  <d2l-selection-select-all></d2l-selection-select-all>
62
62
  <d2l-selection-action text="Bookmark" icon="tier1:bookmark-hollow" requires-selection></d2l-selection-action>
63
63
  <d2l-selection-action text="Settings" icon="tier1:gear"></d2l-selection-action>
64
- <d2l-dropdown-button-subtle text="Actions">
64
+ <d2l-selection-action-dropdown text="Actions 1" requires-selection>
65
65
  <d2l-dropdown-menu>
66
66
  <d2l-menu label="Actions">
67
- <d2l-selection-action-menu-item text="Action 1 (requires selection)" requires-selection></d2l-selection-action-menu-item>
67
+ <d2l-selection-action-menu-item text="Action 1"></d2l-selection-action-menu-item>
68
68
  <d2l-selection-action-menu-item text="Action 2"></d2l-selection-action-menu-item>
69
69
  </d2l-menu>
70
70
  </d2l-dropdown-menu>
71
- </d2l-dropdown-button-subtle>
71
+ </d2l-selection-action-dropdown>
72
72
  </div>
73
73
  <d2l-selection-summary style="flex: none;"></d2l-selection-summary>
74
74
  </div>
@@ -0,0 +1,55 @@
1
+ import '../button/button-subtle.js';
2
+ import { html, LitElement } from 'lit-element/lit-element.js';
3
+ import { DropdownOpenerMixin } from '../dropdown/dropdown-opener-mixin.js';
4
+ import { dropdownOpenerStyles } from '../dropdown/dropdown-opener-styles.js';
5
+ import { ifDefined } from 'lit-html/directives/if-defined.js';
6
+ import { LocalizeCoreElement } from '../../lang/localize-core-element.js';
7
+ import { SelectionActionMixin } from './selection-action-mixin.js';
8
+
9
+ /**
10
+ * A dropdown opener associated with a selection component.
11
+ * @slot - Dropdown content (e.g., "d2l-dropdown-content", "d2l-dropdown-menu" or "d2l-dropdown-tabs")
12
+ */
13
+ class ActionDropdown extends LocalizeCoreElement(SelectionActionMixin(DropdownOpenerMixin(LitElement))) {
14
+
15
+ static get properties() {
16
+ return {
17
+ /**
18
+ * REQUIRED: Text for the dropdown opener button
19
+ * @type {string}
20
+ */
21
+ text: { type: String }
22
+ };
23
+ }
24
+
25
+ static get styles() {
26
+ return dropdownOpenerStyles;
27
+ }
28
+
29
+ render() {
30
+ return html`
31
+ <d2l-button-subtle
32
+ ?disabled=${this.disabled}
33
+ disabled-tooltip="${ifDefined(this.disabled ? this.localize('components.selection.action-hint') : undefined)}"
34
+ icon="tier1:chevron-down"
35
+ icon-right
36
+ text=${this.text}></d2l-button-subtle>
37
+ <slot></slot>
38
+ `;
39
+ }
40
+
41
+ focus() {
42
+ const elem = this.shadowRoot && this.shadowRoot.querySelector('d2l-button-subtle');
43
+ if (elem) elem.focus();
44
+ }
45
+
46
+ /**
47
+ * Gets the opener element with class "d2l-dropdown-opener" (required by dropdown-opener-mixin).
48
+ * @return {HTMLElement}
49
+ */
50
+ getOpenerElement() {
51
+ return this.shadowRoot && this.shadowRoot.querySelector('d2l-button-subtle');
52
+ }
53
+
54
+ }
55
+ customElements.define('d2l-selection-action-dropdown', ActionDropdown);
@@ -1,3 +1,4 @@
1
+ import '../icons/icon.js';
1
2
  import { css, html, LitElement } from 'lit-element/lit-element.js';
2
3
  import { MenuItemMixin } from '../menu/menu-item-mixin.js';
3
4
  import { menuItemStyles } from '../menu/menu-item-styles.js';
@@ -10,7 +11,7 @@ import { SelectionInfo } from './selection-mixin.js';
10
11
  * @fires d2l-selection-action-click - Dispatched when the user clicks the action button. The `SelectionInfo` is provided as the event `detail`. If `requires-selection` was specified then the event will only be dispatched if items are selected.
11
12
  * @fires d2l-selection-observer-subscribe - Internal event
12
13
  */
13
- class MenuItem extends SelectionActionMixin(MenuItemMixin(LitElement)) {
14
+ class ActionMenuItem extends SelectionActionMixin(MenuItemMixin(LitElement)) {
14
15
 
15
16
  static get styles() {
16
17
  return [ menuItemStyles,
@@ -20,6 +21,10 @@ class MenuItem extends SelectionActionMixin(MenuItemMixin(LitElement)) {
20
21
  display: flex;
21
22
  padding: 0.75rem 1rem;
22
23
  }
24
+ d2l-icon {
25
+ flex: none;
26
+ margin-left: 6px;
27
+ }
23
28
  :host([dir="rtl"]) d2l-icon {
24
29
  margin-left: 0;
25
30
  margin-right: 6px;
@@ -39,9 +44,14 @@ class MenuItem extends SelectionActionMixin(MenuItemMixin(LitElement)) {
39
44
  }
40
45
 
41
46
  render() {
47
+ const icon = this.hasChildView ?
48
+ html`<d2l-icon icon="tier1:chevron-right"></d2l-icon>` : null;
49
+
42
50
  return html`
43
51
  <div class="d2l-menu-item-text">${this.text}</div>
44
52
  <div class="d2l-menu-item-supporting"><slot name="supporting"></slot></div>
53
+ ${icon}
54
+ <slot></slot>
45
55
  `;
46
56
  }
47
57
 
@@ -58,4 +68,4 @@ class MenuItem extends SelectionActionMixin(MenuItemMixin(LitElement)) {
58
68
 
59
69
  }
60
70
 
61
- customElements.define('d2l-selection-action-menu-item', MenuItem);
71
+ customElements.define('d2l-selection-action-menu-item', ActionMenuItem);
@@ -1,20 +1,17 @@
1
1
  import '../button/button-subtle.js';
2
- import '../icons/icon.js';
3
- import '../tooltip/tooltip.js';
4
2
  import { css, html, LitElement } from 'lit-element/lit-element.js';
5
3
  import { ButtonMixin } from '../button/button-mixin.js';
6
4
  import { ifDefined } from 'lit-html/directives/if-defined.js';
7
5
  import { LocalizeCoreElement } from '../../lang/localize-core-element.js';
8
- import { RtlMixin } from '../../mixins/rtl-mixin.js';
9
6
  import { SelectionActionMixin } from './selection-action-mixin.js';
10
7
  import { SelectionInfo } from './selection-mixin.js';
11
8
 
12
9
  /**
13
- * An action associated with a selection component.
10
+ * A button action associated with a selection component.
14
11
  * @fires d2l-selection-action-click - Dispatched when the user clicks the action button. The `SelectionInfo` is provided as the event `detail`. If `requires-selection` was specified then the event will only be dispatched if items are selected.
15
12
  * @fires d2l-selection-observer-subscribe - Internal event
16
13
  */
17
- class Action extends LocalizeCoreElement(SelectionActionMixin(ButtonMixin(RtlMixin(LitElement)))) {
14
+ class Action extends LocalizeCoreElement(SelectionActionMixin(ButtonMixin(LitElement))) {
18
15
 
19
16
  static get properties() {
20
17
  return {
@@ -8445,6 +8445,109 @@
8445
8445
  }
8446
8446
  ]
8447
8447
  },
8448
+ {
8449
+ "name": "d2l-selection-action-dropdown",
8450
+ "path": "./components/selection/selection-action-dropdown.js",
8451
+ "description": "A dropdown opener associated with a selection component.",
8452
+ "attributes": [
8453
+ {
8454
+ "name": "text",
8455
+ "description": "REQUIRED: Text for the dropdown opener button",
8456
+ "type": "string"
8457
+ },
8458
+ {
8459
+ "name": "requires-selection",
8460
+ "description": "Whether the action requires one or more selected items",
8461
+ "type": "boolean",
8462
+ "default": "false"
8463
+ },
8464
+ {
8465
+ "name": "selection-for",
8466
+ "description": "Id of the `SelectionMixin` component this component wants to observe (if not located within that component)",
8467
+ "type": "string"
8468
+ },
8469
+ {
8470
+ "name": "no-auto-open",
8471
+ "description": "Prevents the dropdown from opening automatically on or on key press",
8472
+ "type": "boolean",
8473
+ "default": "false"
8474
+ },
8475
+ {
8476
+ "name": "open-on-hover",
8477
+ "description": "Optionally open dropdown on click or hover action",
8478
+ "type": "boolean",
8479
+ "default": "false"
8480
+ },
8481
+ {
8482
+ "name": "disabled",
8483
+ "description": "Disables the dropdown opener",
8484
+ "type": "boolean",
8485
+ "default": "false"
8486
+ }
8487
+ ],
8488
+ "properties": [
8489
+ {
8490
+ "name": "text",
8491
+ "attribute": "text",
8492
+ "description": "REQUIRED: Text for the dropdown opener button",
8493
+ "type": "string"
8494
+ },
8495
+ {
8496
+ "name": "requiresSelection",
8497
+ "attribute": "requires-selection",
8498
+ "description": "Whether the action requires one or more selected items",
8499
+ "type": "boolean",
8500
+ "default": "false"
8501
+ },
8502
+ {
8503
+ "name": "selectionFor",
8504
+ "attribute": "selection-for",
8505
+ "description": "Id of the `SelectionMixin` component this component wants to observe (if not located within that component)",
8506
+ "type": "string"
8507
+ },
8508
+ {
8509
+ "name": "selectionInfo",
8510
+ "type": "SelectionInfo"
8511
+ },
8512
+ {
8513
+ "name": "dropdownOpener",
8514
+ "type": "boolean",
8515
+ "default": "true"
8516
+ },
8517
+ {
8518
+ "name": "noAutoOpen",
8519
+ "attribute": "no-auto-open",
8520
+ "description": "Prevents the dropdown from opening automatically on or on key press",
8521
+ "type": "boolean",
8522
+ "default": "false"
8523
+ },
8524
+ {
8525
+ "name": "openOnHover",
8526
+ "attribute": "open-on-hover",
8527
+ "description": "Optionally open dropdown on click or hover action",
8528
+ "type": "boolean",
8529
+ "default": "false"
8530
+ },
8531
+ {
8532
+ "name": "disabled",
8533
+ "attribute": "disabled",
8534
+ "description": "Disables the dropdown opener",
8535
+ "type": "boolean",
8536
+ "default": "false"
8537
+ }
8538
+ ],
8539
+ "events": [
8540
+ {
8541
+ "name": "d2l-selection-observer-subscribe"
8542
+ }
8543
+ ],
8544
+ "slots": [
8545
+ {
8546
+ "name": "",
8547
+ "description": "Dropdown content (e.g., \"d2l-dropdown-content\", \"d2l-dropdown-menu\" or \"d2l-dropdown-tabs\")"
8548
+ }
8549
+ ]
8550
+ },
8448
8551
  {
8449
8552
  "name": "d2l-selection-action-menu-item",
8450
8553
  "path": "./components/selection/selection-action-menu-item.js",
@@ -8544,7 +8647,7 @@
8544
8647
  {
8545
8648
  "name": "d2l-selection-action",
8546
8649
  "path": "./components/selection/selection-action.js",
8547
- "description": "An action associated with a selection component.",
8650
+ "description": "A button action associated with a selection component.",
8548
8651
  "attributes": [
8549
8652
  {
8550
8653
  "name": "icon",
@@ -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.1",
3
+ "version": "1.231.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",