@brightspace-ui/core 1.214.0 → 1.218.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.
Files changed (76) hide show
  1. package/components/button/button-mixin.js +1 -1
  2. package/components/calendar/calendar.js +5 -5
  3. package/components/card/card-footer-link.js +2 -2
  4. package/components/card/card.js +1 -1
  5. package/components/count-badge/count-badge-mixin.js +1 -1
  6. package/components/demo/code-view.js +4 -3
  7. package/components/demo/demo-snippet.js +5 -2
  8. package/components/dialog/dialog-confirm.js +1 -0
  9. package/components/dialog/dialog-mixin.js +7 -2
  10. package/components/dropdown/dropdown-button-subtle.js +1 -1
  11. package/components/dropdown/dropdown-button.js +1 -1
  12. package/components/dropdown/dropdown-content-mixin.js +6 -6
  13. package/components/dropdown/dropdown-context-menu.js +1 -1
  14. package/components/dropdown/dropdown-menu.js +1 -0
  15. package/components/dropdown/dropdown-more.js +1 -1
  16. package/components/dropdown/dropdown-opener-mixin.js +1 -0
  17. package/components/dropdown/dropdown-tabs.js +1 -0
  18. package/components/dropdown/dropdown.js +1 -0
  19. package/components/expand-collapse/expand-collapse-content.js +4 -4
  20. package/components/filter/README.md +1 -0
  21. package/components/filter/filter-dimension-set.js +7 -1
  22. package/components/filter/filter.js +63 -4
  23. package/components/focus-trap/focus-trap.js +6 -5
  24. package/components/form/demo/form-demo.js +1 -1
  25. package/components/form/demo/form-dialog-demo.js +4 -4
  26. package/components/form/demo/form-native-demo.js +1 -1
  27. package/components/form/form-element-mixin.js +12 -3
  28. package/components/form/form-errory-summary.js +2 -2
  29. package/components/form/form-native.js +1 -1
  30. package/components/form/form.js +1 -1
  31. package/components/hierarchical-view/hierarchical-view-mixin.js +7 -6
  32. package/components/html-block/html-block.js +1 -0
  33. package/components/inputs/demo/input-radio-solo-test.js +1 -1
  34. package/components/inputs/demo/input-radio-spacer-test.js +1 -1
  35. package/components/inputs/demo/input-select-test.js +1 -1
  36. package/components/inputs/input-checkbox.js +1 -1
  37. package/components/inputs/input-date-range.js +4 -3
  38. package/components/inputs/input-date-time-range-to.js +1 -1
  39. package/components/inputs/input-date-time-range.js +4 -3
  40. package/components/inputs/input-date-time.js +6 -5
  41. package/components/inputs/input-date.js +3 -0
  42. package/components/inputs/input-number.js +2 -1
  43. package/components/inputs/input-percent.js +2 -1
  44. package/components/inputs/input-search.js +3 -3
  45. package/components/inputs/input-text.js +8 -8
  46. package/components/inputs/input-textarea.js +5 -5
  47. package/components/inputs/input-time-range.js +4 -4
  48. package/components/inputs/input-time.js +1 -1
  49. package/components/link/link.js +1 -1
  50. package/components/list/demo/list-drag-and-drop.js +3 -1
  51. package/components/list/list-item-checkbox-mixin.js +1 -1
  52. package/components/list/list-item-drag-drop-mixin.js +10 -5
  53. package/components/list/list-item-generic-layout.js +5 -4
  54. package/components/list/list-item-mixin.js +1 -0
  55. package/components/list/list.js +2 -0
  56. package/components/menu/demo/custom-view.js +1 -1
  57. package/components/menu/menu-item-link.js +1 -1
  58. package/components/menu/menu-item-mixin.js +1 -1
  59. package/components/menu/menu.js +2 -2
  60. package/components/overflow-group/overflow-group.js +1 -1
  61. package/components/scroll-wrapper/demo/scroll-wrapper-test.js +1 -1
  62. package/components/selection/selection-action.js +1 -1
  63. package/components/selection/selection-input.js +1 -1
  64. package/components/selection/selection-select-all.js +1 -1
  65. package/components/switch/switch-mixin.js +1 -1
  66. package/components/table/table-col-sort-button.js +1 -1
  67. package/components/tabs/tabs.js +20 -15
  68. package/components/tooltip/tooltip.js +1 -1
  69. package/controllers/subscriber/README.md +3 -3
  70. package/controllers/subscriber/subscriberControllers.js +4 -4
  71. package/custom-elements.json +13 -0
  72. package/directives/animate/animate.js +35 -18
  73. package/helpers/demo/announce-test.js +1 -0
  74. package/mixins/arrow-keys-mixin.js +3 -1
  75. package/package.json +1 -1
  76. package/templates/primary-secondary/primary-secondary.js +2 -1
@@ -109,7 +109,7 @@ export const MenuItemMixin = superclass => class extends FocusVisiblePolyfillMix
109
109
  }
110
110
 
111
111
  __initializeItem() {
112
- const slot = this.shadowRoot.querySelector('slot:not([name])');
112
+ const slot = this.shadowRoot && this.shadowRoot.querySelector('slot:not([name])');
113
113
  if (!slot) {
114
114
  return;
115
115
  }
@@ -221,11 +221,11 @@ class Menu extends ThemeMixin(HierarchicalViewMixin(FocusVisiblePolyfillMixin(Li
221
221
  }
222
222
 
223
223
  _getMenuItemReturn() {
224
- return this.shadowRoot.querySelector('d2l-menu-item-return');
224
+ return this.shadowRoot && this.shadowRoot.querySelector('d2l-menu-item-return');
225
225
  }
226
226
 
227
227
  _getMenuItems() {
228
- const slot = this.shadowRoot.querySelector('slot');
228
+ const slot = this.shadowRoot && this.shadowRoot.querySelector('slot');
229
229
  if (!slot) return;
230
230
  const items = slot.assignedNodes({ flatten: true }).filter((node) => node.nodeType === Node.ELEMENT_NODE);
231
231
 
@@ -318,7 +318,7 @@ class OverflowGroup extends RtlMixin(LocalizeCoreElement(LitElement)) {
318
318
  }
319
319
 
320
320
  _chomp() {
321
- if (!this._itemLayouts) return;
321
+ if (!this.shadowRoot || !this._itemLayouts) return;
322
322
 
323
323
  this._overflowMenu = this.shadowRoot.querySelector('.d2l-overflow-dropdown');
324
324
  this._overflowMenuMini = this.shadowRoot.querySelector('.d2l-overflow-dropdown-mini');
@@ -53,7 +53,7 @@ class TestScrollWrapper extends RtlMixin(LitElement) {
53
53
  }
54
54
 
55
55
  focus() {
56
- forceFocusVisible(this.shadowRoot.querySelector('d2l-scroll-wrapper')._container);
56
+ if (this.shadowRoot) forceFocusVisible(this.shadowRoot.querySelector('d2l-scroll-wrapper')._container);
57
57
  }
58
58
 
59
59
  }
@@ -79,7 +79,7 @@ class Action extends LocalizeCoreElement(SelectionObserverMixin(ButtonMixin(RtlM
79
79
  }
80
80
 
81
81
  focus() {
82
- const elem = this.shadowRoot.querySelector('d2l-button-subtle');
82
+ const elem = this.shadowRoot && this.shadowRoot.querySelector('d2l-button-subtle');
83
83
  if (elem) elem.focus();
84
84
  }
85
85
 
@@ -142,7 +142,7 @@ class Input extends SkeletonMixin(LabelledMixin(LitElement)) {
142
142
  }
143
143
 
144
144
  focus() {
145
- const elem = this.shadowRoot.firstElementChild;
145
+ const elem = this.shadowRoot && this.shadowRoot.firstElementChild;
146
146
  if (elem) elem.focus();
147
147
  }
148
148
 
@@ -57,7 +57,7 @@ class SelectAll extends LocalizeCoreElement(SelectionObserverMixin(LitElement))
57
57
  }
58
58
 
59
59
  focus() {
60
- const elem = this.shadowRoot.querySelector('d2l-input-checkbox');
60
+ const elem = this.shadowRoot && this.shadowRoot.querySelector('d2l-input-checkbox');
61
61
  if (elem) elem.focus();
62
62
  }
63
63
 
@@ -213,7 +213,7 @@ export const SwitchMixin = superclass => class extends RtlMixin(FocusVisiblePoly
213
213
  }
214
214
 
215
215
  focus() {
216
- const elem = this.shadowRoot.querySelector('.d2l-switch-container');
216
+ const elem = this.shadowRoot && this.shadowRoot.querySelector('.d2l-switch-container');
217
217
  if (elem) elem.focus();
218
218
  }
219
219
 
@@ -71,7 +71,7 @@ export class TableColSortButton extends LitElement {
71
71
  }
72
72
 
73
73
  focus() {
74
- const button = this.shadowRoot.querySelector('button');
74
+ const button = this.shadowRoot && this.shadowRoot.querySelector('button');
75
75
  if (button) button.focus();
76
76
  }
77
77
 
@@ -374,34 +374,37 @@ class Tabs extends LocalizeCoreElement(ArrowKeysMixin(RtlMixin(FocusVisiblePolyf
374
374
  }
375
375
 
376
376
  getTabListRect() {
377
+ if (!this.shadowRoot) return undefined;
377
378
  return this.shadowRoot.querySelector('.d2l-tabs-container-list').getBoundingClientRect();
378
379
  }
379
380
 
380
381
  _animateTabAddition(tabInfo) {
381
- const tab = this.shadowRoot.querySelector(`d2l-tab-internal[controls-panel="${cssEscape(tabInfo.id)}"]`);
382
+ const tab = this.shadowRoot
383
+ && this.shadowRoot.querySelector(`d2l-tab-internal[controls-panel="${cssEscape(tabInfo.id)}"]`);
382
384
  return new Promise((resolve) => {
383
385
  const handleTransitionEnd = (e) => {
384
386
  if (e.propertyName !== 'max-width') return;
385
- tab.removeEventListener('transitionend', handleTransitionEnd);
387
+ if (tab) tab.removeEventListener('transitionend', handleTransitionEnd);
386
388
  resolve();
387
389
  };
388
- tab.addEventListener('transitionend', handleTransitionEnd);
390
+ if (tab) tab.addEventListener('transitionend', handleTransitionEnd);
389
391
  tabInfo.state = '';
390
392
  this.requestUpdate();
391
393
  });
392
394
  }
393
395
 
394
396
  _animateTabRemoval(tabInfo) {
395
- const tab = this.shadowRoot.querySelector(`d2l-tab-internal[controls-panel="${cssEscape(tabInfo.id)}"]`);
397
+ const tab = this.shadowRoot &&
398
+ this.shadowRoot.querySelector(`d2l-tab-internal[controls-panel="${cssEscape(tabInfo.id)}"]`);
396
399
  return new Promise((resolve) => {
397
400
  const handleTransitionEnd = (e) => {
398
401
  if (e.propertyName !== 'max-width') return;
399
- tab.removeEventListener('transitionend', handleTransitionEnd);
402
+ if (tab) tab.removeEventListener('transitionend', handleTransitionEnd);
400
403
  this._tabInfos.splice(this._tabInfos.findIndex(info => info.id === tabInfo.id), 1);
401
404
  this.requestUpdate();
402
405
  resolve();
403
406
  };
404
- tab.addEventListener('transitionend', handleTransitionEnd);
407
+ if (tab) tab.addEventListener('transitionend', handleTransitionEnd);
405
408
  });
406
409
  }
407
410
 
@@ -488,7 +491,7 @@ class Tabs extends LocalizeCoreElement(ArrowKeysMixin(RtlMixin(FocusVisiblePolyf
488
491
  }
489
492
 
490
493
  async _focusSelected() {
491
- const selectedTab = this.shadowRoot.querySelector('d2l-tab-internal[aria-selected="true"]');
494
+ const selectedTab = this.shadowRoot && this.shadowRoot.querySelector('d2l-tab-internal[aria-selected="true"]');
492
495
  if (!selectedTab) return;
493
496
 
494
497
  const selectedTabInfo = this._getTabInfo(selectedTab.controlsPanel);
@@ -517,6 +520,7 @@ class Tabs extends LocalizeCoreElement(ArrowKeysMixin(RtlMixin(FocusVisiblePolyf
517
520
  }
518
521
 
519
522
  _getPanel(id) {
523
+ if (!this.shadowRoot) return;
520
524
  // use simple selector for slot (Edge)
521
525
  const slot = this.shadowRoot.querySelector('.d2l-panels-container').querySelector('slot');
522
526
  const panels = this._getPanels(slot);
@@ -702,7 +706,7 @@ class Tabs extends LocalizeCoreElement(ArrowKeysMixin(RtlMixin(FocusVisiblePolyf
702
706
  await this._scrollToPosition(newTranslationValue);
703
707
  await this._updateScrollVisibility(newMeasures);
704
708
 
705
- if (!isOverflowingNext) {
709
+ if (!isOverflowingNext && this.shadowRoot) {
706
710
  this.shadowRoot.querySelector('.d2l-tabs-scroll-previous-container button').focus();
707
711
  }
708
712
 
@@ -735,7 +739,7 @@ class Tabs extends LocalizeCoreElement(ArrowKeysMixin(RtlMixin(FocusVisiblePolyf
735
739
  await this._scrollToPosition(newTranslationValue);
736
740
  await this._updateScrollVisibility(newMeasures);
737
741
 
738
- if (!isOverflowingPrevious) {
742
+ if (!isOverflowingPrevious && this.shadowRoot) {
739
743
  this.shadowRoot.querySelector('.d2l-tabs-scroll-next-container button').focus();
740
744
  }
741
745
 
@@ -777,7 +781,7 @@ class Tabs extends LocalizeCoreElement(ArrowKeysMixin(RtlMixin(FocusVisiblePolyf
777
781
  }
778
782
 
779
783
  this._translationValue = translationValue;
780
- if (reduceMotion) return this.updateComplete;
784
+ if (!this.shadowRoot || reduceMotion) return this.updateComplete;
781
785
 
782
786
  return new Promise((resolve) => {
783
787
  const tabList = this.shadowRoot.querySelector('.d2l-tabs-container-list');
@@ -805,13 +809,13 @@ class Tabs extends LocalizeCoreElement(ArrowKeysMixin(RtlMixin(FocusVisiblePolyf
805
809
  expandedPromise = this.updateComplete;
806
810
  } else {
807
811
  expandedPromise = new Promise((resolve) => {
808
- const tabsContainer = this.shadowRoot.querySelector('.d2l-tabs-container');
812
+ const tabsContainer = this.shadowRoot && this.shadowRoot.querySelector('.d2l-tabs-container');
809
813
  const handleTransitionEnd = (e) => {
810
814
  if (e.propertyName !== 'max-width') return;
811
- tabsContainer.removeEventListener('transitionend', handleTransitionEnd);
815
+ if (tabsContainer) tabsContainer.removeEventListener('transitionend', handleTransitionEnd);
812
816
  resolve();
813
817
  };
814
- tabsContainer.addEventListener('transitionend', handleTransitionEnd);
818
+ if (tabsContainer) tabsContainer.addEventListener('transitionend', handleTransitionEnd);
815
819
  this._scrollCollapsed = false;
816
820
  this._maxWidth = measures.totalTabsWidth + 50;
817
821
  });
@@ -828,7 +832,7 @@ class Tabs extends LocalizeCoreElement(ArrowKeysMixin(RtlMixin(FocusVisiblePolyf
828
832
  if (!this._allowScrollPrevious) {
829
833
  this._focusSelected();
830
834
  } else {
831
- this.shadowRoot.querySelector('.d2l-tabs-scroll-previous-container button').focus();
835
+ if (this.shadowRoot) this.shadowRoot.querySelector('.d2l-tabs-scroll-previous-container button').focus();
832
836
  }
833
837
  }
834
838
 
@@ -838,6 +842,7 @@ class Tabs extends LocalizeCoreElement(ArrowKeysMixin(RtlMixin(FocusVisiblePolyf
838
842
 
839
843
  _updateMeasures() {
840
844
  let totalTabsWidth = 0;
845
+ if (!this.shadowRoot) return;
841
846
  const tabs = [...this.shadowRoot.querySelectorAll('d2l-tab-internal')];
842
847
 
843
848
  const tabRects = tabs.map((tab) => {
@@ -894,7 +899,7 @@ class Tabs extends LocalizeCoreElement(ArrowKeysMixin(RtlMixin(FocusVisiblePolyf
894
899
  // don't animate the tabs list visibility if it's the inital render
895
900
  if (reduceMotion || !this._initialized) {
896
901
  this._state = 'hidden';
897
- } else {
902
+ } else if (this.shadowRoot) {
898
903
  const layout = this.shadowRoot.querySelector('.d2l-tabs-layout');
899
904
  const handleTransitionEnd = (e) => {
900
905
  if (e.propertyName !== 'max-height') return;
@@ -715,7 +715,7 @@ class Tooltip extends RtlMixin(LitElement) {
715
715
  }
716
716
 
717
717
  _getContent() {
718
- return this.shadowRoot.querySelector('.d2l-tooltip-content');
718
+ return this.shadowRoot && this.shadowRoot.querySelector('.d2l-tooltip-content');
719
719
  }
720
720
 
721
721
  _isAboveOrBelow() {
@@ -1,6 +1,6 @@
1
1
  # Subscriber Controllers
2
2
 
3
- The `SubscriberRegistryController` and the corresponding `*SubscriberController`s can be used to create a subscription system within your app. Components can setup a subscriber registry instance to keep track of all components subscribed to them with the `SubscriberRegistryController`. Whenever it makes sense to do so, they can iterate over their subscribers to perform some action, update them with new data, etc. Components can subscribe themselves to different registries using the `IdSubscriberController` or the `EventSubscriberController`. This system supports a many-to-many relationship - registry components can contain multiple registry instances with multiple subscribers in each, and subscriber components can subscribe to multiple different registries.
3
+ The `SubscriberRegistryController` and the corresponding `*SubscriberController`s can be used to create a subscription system within your app. Components can set up a subscriber registry instance to keep track of all components subscribed to them with the `SubscriberRegistryController`. Whenever it makes sense to do so, they can iterate over their subscribers to perform some action, update them with new data, etc. Components can subscribe themselves to different registries using the `IdSubscriberController` or the `EventSubscriberController`. This system supports a many-to-many relationship - registry components can contain multiple registry instances with multiple subscribers in each, and subscriber components can subscribe to multiple different registries.
4
4
 
5
5
  ## Usage
6
6
 
@@ -27,7 +27,7 @@ class CableSubscription extends LitElement {
27
27
  { onSubscribe: this._unlockKidsChannels.bind(this) }, {});
28
28
  }
29
29
 
30
- getController(controllerId) {
30
+ getSubscriberController(controllerId) {
31
31
  if (controllerId === 'sports') {
32
32
  return this._sportsSubscribers;
33
33
  } else if (controllerId === 'movies') {
@@ -51,7 +51,7 @@ class CableSubscription extends LitElement {
51
51
 
52
52
  When creating the controller, you can pass in callbacks to run whenever a subscriber is added, removed, or `updateSubscribers` is called (which handles request debouncing for you).
53
53
 
54
- The `*subscriberController`s will use a `getController` method that needs to be exposed on the registry component. If you only have one `SubscriberRegistryController` you can simple return that. If you have multiple, you will return the proper controller depending on the id the subscriber component passed to you.
54
+ The `*subscriberController`s will use a `getSubscriberController` method that needs to be exposed on the registry component. If you only have one `SubscriberRegistryController` you can simple return that. If you have multiple, you will return the proper controller depending on the id the subscriber component passed to you.
55
55
 
56
56
  Once this has been set up, components can subscribe to particular registries two different ways:
57
57
  1. Using a matching event name with `EventSubscriberController`. The component will need to be a child of the registry component for this to work.
@@ -90,7 +90,7 @@ export class EventSubscriberController {
90
90
  }
91
91
 
92
92
  hostDisconnected() {
93
- if (this._registry) this._registry.getController(this._controllerId).unsubscribe(this._host);
93
+ if (this._registry) this._registry.getSubscriberController(this._controllerId).unsubscribe(this._host);
94
94
  }
95
95
 
96
96
  }
@@ -114,7 +114,7 @@ export class IdSubscriberController {
114
114
  if (this._registryObserver) this._registryObserver.disconnect();
115
115
  this._timeouts.forEach(timeoutId => clearTimeout(timeoutId));
116
116
  this._registries.forEach(registry => {
117
- registry.getController(this._controllerId).unsubscribe(this._host);
117
+ registry.getSubscriberController(this._controllerId).unsubscribe(this._host);
118
118
  });
119
119
  }
120
120
 
@@ -123,7 +123,7 @@ export class IdSubscriberController {
123
123
 
124
124
  if (this._registryObserver) this._registryObserver.disconnect();
125
125
  this._registries.forEach(registry => {
126
- registry.getController(this._controllerId).unsubscribe(this._host);
126
+ registry.getSubscriberController(this._controllerId).unsubscribe(this._host);
127
127
  if (this._callbacks.onUnsubscribe) this._callbacks.onUnsubscribe(registry.id);
128
128
  });
129
129
  this._registries = new Map();
@@ -168,7 +168,7 @@ export class IdSubscriberController {
168
168
  if (this._registries.get(registryId) === registryComponent) return;
169
169
 
170
170
  if (registryComponent) {
171
- registryComponent.getController(this._controllerId).subscribe(this._host);
171
+ registryComponent.getSubscriberController(this._controllerId).subscribe(this._host);
172
172
  this._registries.set(registryId, registryComponent);
173
173
  if (this._callbacks.onSubscribe) this._callbacks.onSubscribe(registryComponent);
174
174
  } else {
@@ -2992,6 +2992,12 @@
2992
2992
  "description": "REQUIRED: The text that is displayed for the dimension title",
2993
2993
  "type": "string",
2994
2994
  "default": "\"\""
2995
+ },
2996
+ {
2997
+ "name": "value-only-active-filter-text",
2998
+ "description": "Whether to hide the dimension in the text sent to active filter subscribers",
2999
+ "type": "boolean",
3000
+ "default": "false"
2995
3001
  }
2996
3002
  ],
2997
3003
  "properties": [
@@ -3035,6 +3041,13 @@
3035
3041
  "description": "REQUIRED: The text that is displayed for the dimension title",
3036
3042
  "type": "string",
3037
3043
  "default": "\"\""
3044
+ },
3045
+ {
3046
+ "name": "valueOnlyActiveFilterText",
3047
+ "attribute": "value-only-active-filter-text",
3048
+ "description": "Whether to hide the dimension in the text sent to active filter subscribers",
3049
+ "type": "boolean",
3050
+ "default": "false"
3038
3051
  }
3039
3052
  ],
3040
3053
  "slots": [
@@ -1,6 +1,8 @@
1
- import { directive, PropertyPart } from 'lit-html';
1
+ import { directive, PartType } from 'lit-html/directive.js';
2
2
  import { getComposedActiveElement, getNextFocusable } from '../../helpers/focus.js';
3
+ import { AsyncDirective } from 'lit-html/async-directive.js';
3
4
  import { isComposedAncestor } from '../../helpers/dom.js';
5
+ import { noChange } from 'lit-html';
4
6
 
5
7
  const stateMap = new WeakMap();
6
8
  const reduceMotion = matchMedia('(prefers-reduced-motion: reduce)').matches;
@@ -10,15 +12,13 @@ const moveYValue = 20;
10
12
 
11
13
  class AnimationState {
12
14
 
13
- constructor(propertyPart) {
14
-
15
- if (!(propertyPart instanceof PropertyPart) || propertyPart.committer.name !== 'animate') {
16
- throw new Error('animation directives must be used with "animate" property');
15
+ constructor(partInfo) {
16
+ if (!(partInfo.type === PartType.PROPERTY) || partInfo.name !== 'animate') {
17
+ throw new Error('animate directives must be used with "animate" property');
17
18
  }
18
-
19
19
  this.id = 0;
20
20
  this.clone = null;
21
- this.elem = propertyPart.committer.element;
21
+ this.elem = partInfo.element;
22
22
  this.state = 'unknown';
23
23
  this.styleAttr = null;
24
24
  this.styleAttrUse = false;
@@ -289,20 +289,37 @@ class AnimationState {
289
289
 
290
290
  }
291
291
 
292
- async function helper(part, action, opts) {
293
- let state = stateMap.get(part);
294
- if (state === undefined) {
295
- state = new AnimationState(part);
296
- stateMap.set(part, state);
292
+ class Hide extends AsyncDirective {
293
+ render() {
294
+ return noChange;
297
295
  }
298
- opts = opts || {};
299
- if (action === 'show') {
300
- state.show(opts);
301
- } else if (action === 'hide') {
296
+ update(part, [opts]) {
297
+ opts = opts || {};
298
+ let state = stateMap.get(part.element);
299
+ if (state === undefined) {
300
+ state = new AnimationState(part);
301
+ stateMap.set(part.element, state);
302
+ }
302
303
  state.hide(opts);
304
+ return this.render();
303
305
  }
304
306
  }
305
307
 
306
- export const hide = directive((opts) => async(part) => helper(part, 'hide', opts));
308
+ class Show extends AsyncDirective {
309
+ render() {
310
+ return noChange;
311
+ }
312
+ update(part, [opts]) {
313
+ opts = opts || {};
314
+ let state = stateMap.get(part.element);
315
+ if (state === undefined) {
316
+ state = new AnimationState(part);
317
+ stateMap.set(part.element, state);
318
+ }
319
+ state.show(opts);
320
+ return this.render();
321
+ }
322
+ }
307
323
 
308
- export const show = directive((opts) => async(part) => helper(part, 'show', opts));
324
+ export const hide = directive(Hide);
325
+ export const show = directive(Show);
@@ -25,6 +25,7 @@ class AnnounceTest extends LitElement {
25
25
  }
26
26
 
27
27
  _handleAnnounce() {
28
+ if (!this.shadowRoot) return;
28
29
  const value1 = this.shadowRoot.querySelector('#msg1').value;
29
30
  if (value1.length > 0) announce(value1);
30
31
  const value2 = this.shadowRoot.querySelector('#msg2').value;
@@ -37,7 +37,9 @@ export const ArrowKeysMixin = superclass => class extends superclass {
37
37
  }
38
38
 
39
39
  async arrowKeysFocusablesProvider() {
40
- return [...this.shadowRoot.querySelectorAll('.d2l-arrowkeys-focusable')];
40
+ return this.shadowRoot ?
41
+ [...this.shadowRoot.querySelectorAll('.d2l-arrowkeys-focusable')]
42
+ : [];
41
43
  }
42
44
 
43
45
  async _focus(elem) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brightspace-ui/core",
3
- "version": "1.214.0",
3
+ "version": "1.218.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",
@@ -1014,6 +1014,7 @@ class TemplatePrimarySecondary extends FocusVisiblePolyfillMixin(RtlMixin(Locali
1014
1014
  }
1015
1015
 
1016
1016
  _computeContentBounds(contentRect) {
1017
+ if (!this.shadowRoot) return;
1017
1018
  const divider = this.shadowRoot.querySelector('.d2l-template-primary-secondary-divider');
1018
1019
  const desktopDividerSize = divider.offsetWidth;
1019
1020
  const mobileDividerSize = divider.offsetHeight;
@@ -1057,7 +1058,7 @@ class TemplatePrimarySecondary extends FocusVisiblePolyfillMixin(RtlMixin(Locali
1057
1058
  } else {
1058
1059
  if (this._isMobile) {
1059
1060
  this._size = this._contentBounds.minHeight;
1060
- } else {
1061
+ } else if (this.shadowRoot) {
1061
1062
  const divider = this.shadowRoot.querySelector('.d2l-template-primary-secondary-divider');
1062
1063
  const desktopDividerSize = contentRect.width - divider.offsetWidth;
1063
1064
  this._size = Math.max(desktopMinSize, desktopDividerSize * (1 / 3));