@brightspace-ui/core 3.219.6 → 3.219.7

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.
@@ -1,127 +1,59 @@
1
1
  import { css, LitElement } from 'lit';
2
- import { DropdownPopoverMixin, usePopoverMixin } from './dropdown-popover-mixin.js';
3
- import { DropdownContentMixin } from './dropdown-content-mixin.js';
4
- import { dropdownContentStyles } from './dropdown-content-styles.js';
5
-
6
- if (usePopoverMixin) {
7
-
8
- /**
9
- * A container for a "d2l-tabs" component. It provides additional support on top of "d2l-dropdown-content" for automatic resizing when the tab changes.
10
- * @slot - Anything inside of "d2l-dropdown-content" that isn't in the "header" or "footer" slots appears as regular content
11
- * @slot header - Sticky container at the top of the dropdown
12
- * @slot footer - Sticky container at the bottom of the dropdown
13
- * @fires d2l-dropdown-open - Dispatched when the dropdown is opened
14
- */
15
- class DropdownTabs extends DropdownPopoverMixin(LitElement) {
16
-
17
- static get styles() {
18
- return [super.styles, css`
19
- ::slotted(d2l-tabs) {
20
- margin-bottom: 0;
21
- }
22
- `];
23
- }
24
-
25
- firstUpdated(changedProperties) {
26
- super.firstUpdated(changedProperties);
27
-
28
- this.addEventListener('d2l-dropdown-open', this.#handleOpen);
29
- this.addEventListener('d2l-menu-resize', this.#handleMenuResize);
30
- this.addEventListener('d2l-tab-panel-selected', this.#handleTabSelected);
31
- }
32
-
33
- #initializingHeight;
34
-
35
- #handleMenuResize(e) {
36
-
37
- const tabs = this.shadowRoot?.querySelector('.dropdown-content > slot')
38
- .assignedNodes()
39
- .filter(node => node.hasAttribute && node.tagName === 'D2L-TABS')[0];
40
-
41
- if (!tabs) return;
42
- const tabListRect = tabs.getTabListRect();
43
-
44
- // need to include height of tablist, dropdown padding, tab margins
45
- const rect = {
46
- height: e.detail.height + tabListRect.height + 52,
47
- width: e.detail.width
48
- };
49
- this.position(rect, { updateLocation: this.#initializingHeight });
50
- this.#initializingHeight = false;
51
- }
52
-
53
- #handleOpen(e) {
54
- if (e.target !== this) return;
55
- this.#initializingHeight = true;
56
- }
57
-
58
- #handleTabSelected() {
59
- this.position();
60
- }
61
-
2
+ import { DropdownPopoverMixin } from './dropdown-popover-mixin.js';
3
+
4
+ /**
5
+ * A container for a "d2l-tabs" component. It provides additional support on top of "d2l-dropdown-content" for automatic resizing when the tab changes.
6
+ * @slot - Anything inside of "d2l-dropdown-content" that isn't in the "header" or "footer" slots appears as regular content
7
+ * @slot header - Sticky container at the top of the dropdown
8
+ * @slot footer - Sticky container at the bottom of the dropdown
9
+ * @fires d2l-dropdown-open - Dispatched when the dropdown is opened
10
+ */
11
+ class DropdownTabs extends DropdownPopoverMixin(LitElement) {
12
+
13
+ static get styles() {
14
+ return [super.styles, css`
15
+ ::slotted(d2l-tabs) {
16
+ margin-bottom: 0;
17
+ }
18
+ `];
62
19
  }
63
- customElements.define('d2l-dropdown-tabs', DropdownTabs);
64
-
65
- } else {
66
20
 
67
- /**
68
- * A container for a "d2l-tabs" component. It provides additional support on top of "d2l-dropdown-content" for automatic resizing when the tab changes.
69
- * @slot - Anything inside of "d2l-dropdown-content" that isn't in the "header" or "footer" slots appears as regular content
70
- * @slot header - Sticky container at the top of the dropdown
71
- * @slot footer - Sticky container at the bottom of the dropdown
72
- * @fires d2l-dropdown-open - Dispatched when the dropdown is opened
73
- */
74
- class DropdownTabs extends DropdownContentMixin(LitElement) {
21
+ firstUpdated(changedProperties) {
22
+ super.firstUpdated(changedProperties);
75
23
 
76
- static get styles() {
77
- return [ dropdownContentStyles, css`
78
- ::slotted(d2l-tabs) {
79
- margin-bottom: 0;
80
- }
81
- `];
82
- }
83
-
84
- firstUpdated(changedProperties) {
85
- super.firstUpdated(changedProperties);
24
+ this.addEventListener('d2l-dropdown-open', this.#handleOpen);
25
+ this.addEventListener('d2l-menu-resize', this.#handleMenuResize);
26
+ this.addEventListener('d2l-tab-panel-selected', this.#handleTabSelected);
27
+ }
86
28
 
87
- this.addEventListener('d2l-dropdown-open', this._onOpen);
88
- this.addEventListener('d2l-menu-resize', this._onMenuResize);
89
- this.addEventListener('d2l-tab-panel-selected', this._onTabSelected);
90
- }
29
+ #initializingHeight;
91
30
 
92
- render() {
93
- return this._renderContent();
94
- }
31
+ #handleMenuResize(e) {
95
32
 
96
- _getTabsElement() {
97
- if (!this.shadowRoot) return undefined;
98
- return this.shadowRoot.querySelector('.d2l-dropdown-content-container > slot')
99
- .assignedNodes()
100
- .filter(node => node.hasAttribute && node.tagName === 'D2L-TABS')[0];
101
- }
33
+ const tabs = this.shadowRoot?.querySelector('.dropdown-content > slot')
34
+ .assignedNodes()
35
+ .filter(node => node.hasAttribute && node.tagName === 'D2L-TABS')[0];
102
36
 
103
- _onMenuResize(e) {
104
- const tabs = this._getTabsElement();
105
- const tabListRect = tabs.getTabListRect();
106
- // need to include height of tablist, dropdown padding, tab margins
107
- const rect = {
108
- height: e.detail.height + tabListRect.height + 52,
109
- width: e.detail.width
110
- };
111
- this.__position(rect, { updateAboveBelow: this._initializingHeight });
112
- this._initializingHeight = false;
113
- }
37
+ if (!tabs) return;
38
+ const tabListRect = tabs.getTabListRect();
114
39
 
115
- _onOpen(e) {
116
- if (e.target !== this) return;
117
- this._initializingHeight = true;
118
- }
40
+ // need to include height of tablist, dropdown padding, tab margins
41
+ const rect = {
42
+ height: e.detail.height + tabListRect.height + 52,
43
+ width: e.detail.width
44
+ };
45
+ this.position(rect, { updateLocation: this.#initializingHeight });
46
+ this.#initializingHeight = false;
47
+ }
119
48
 
120
- _onTabSelected() {
121
- this.__position();
122
- }
49
+ #handleOpen(e) {
50
+ if (e.target !== this) return;
51
+ this.#initializingHeight = true;
52
+ }
123
53
 
54
+ #handleTabSelected() {
55
+ this.position();
124
56
  }
125
- customElements.define('d2l-dropdown-tabs', DropdownTabs);
126
57
 
127
58
  }
59
+ customElements.define('d2l-dropdown-tabs', DropdownTabs);
@@ -821,8 +821,7 @@ class Filter extends FocusMixin(LocalizeCoreElement(LitElement)) {
821
821
 
822
822
  let shouldUpdate = false,
823
823
  shouldSearch = false,
824
- shouldRecount = false,
825
- shouldResizeDropdown = false;
824
+ shouldRecount = false;
826
825
  changes.forEach((newValue, prop) => {
827
826
  if (toUpdate[prop] === newValue) return;
828
827
 
@@ -841,10 +840,7 @@ class Filter extends FocusMixin(LocalizeCoreElement(LitElement)) {
841
840
  } else if (prop === 'values') {
842
841
  if (dimension.searchValue || dimension.searchType === 'manual') shouldSearch = true;
843
842
  shouldRecount = true;
844
- shouldResizeDropdown = true;
845
843
  this._activeFiltersSubscribers.updateSubscribers();
846
- } else if (prop === 'loading') {
847
- shouldResizeDropdown = true;
848
844
  } else if (prop === 'text') {
849
845
  this._activeFiltersSubscribers.updateSubscribers();
850
846
  }
@@ -853,10 +849,6 @@ class Filter extends FocusMixin(LocalizeCoreElement(LitElement)) {
853
849
  if (shouldSearch) this._performDimensionSearch(dimension);
854
850
  if (shouldRecount) this._setFilterCounts(dimension);
855
851
  if (shouldUpdate) this.requestUpdate();
856
- if (shouldResizeDropdown) {
857
- // todo: remove this when removing GAUD-7472-dropdown-popover flag (this request is no longer needed)
858
- this._requestDropdownResize();
859
- }
860
852
  if (e.detail.dispatchChangeEvent) this._dispatchChangeEventValueDataChange(dimension, value, e.detail.valueKey);
861
853
  }
862
854
 
@@ -1070,20 +1062,9 @@ class Filter extends FocusMixin(LocalizeCoreElement(LitElement)) {
1070
1062
  break;
1071
1063
  }
1072
1064
 
1073
- // todo: remove this when removing GAUD-7472-dropdown-popover flag (this request is no longer needed)
1074
- this._requestDropdownResize();
1075
1065
  this.requestUpdate();
1076
1066
  }
1077
1067
 
1078
- // todo: remove this method when removing GAUD-7472-dropdown-popover flag (d2l-filter calls requestRepositionNextResize)
1079
- _requestDropdownResize() {
1080
- const singleDimension = this._dimensions.length === 1;
1081
- if (singleDimension && this.opened) {
1082
- const dropdown = this.shadowRoot.querySelector('d2l-dropdown-content');
1083
- dropdown.requestRepositionNextResize(this.shadowRoot.querySelector('.d2l-filter-container'));
1084
- }
1085
- }
1086
-
1087
1068
  _search(dimension) {
1088
1069
  if (dimension.searchType === 'automatic') {
1089
1070
  this._performDimensionSearch(dimension);
@@ -10,7 +10,6 @@ import { getFocusRingStyles } from '../../helpers/focus.js';
10
10
  import { getUniqueId } from '../../helpers/uniqueId.js';
11
11
  import { ifDefined } from 'lit/directives/if-defined.js';
12
12
  import { LocalizeCoreElement } from '../../helpers/localize-core-element.js';
13
- import { usePopoverMixin } from '../dropdown/dropdown-popover-mixin.js';
14
13
 
15
14
  /**
16
15
  * Button for sorting a table column in ascending/descending order.
@@ -185,7 +184,7 @@ export class TableColSortButton extends LocalizeCoreElement(FocusMixin(LitElemen
185
184
  if (this._hasDropdownItems) {
186
185
  return html`<d2l-dropdown>
187
186
  ${button}
188
- <d2l-dropdown-menu no-pointer align="start" vertical-offset="${usePopoverMixin ? '0' : '4'}">
187
+ <d2l-dropdown-menu no-pointer align="start" vertical-offset="0">
189
188
  <d2l-menu label="${ifDefined(this._label)}" @d2l-table-col-sort-button-item-change="${this._handleTablColSortButtonItemChange}">
190
189
  <slot name="items" @slotchange="${this._handleSlotChange}"></slot>
191
190
  </d2l-menu>
@@ -8,10 +8,9 @@ import { isPopoverSupported } from '../popover/popover-mixin.js';
8
8
  import { PageableMixin } from '../paging/pageable-mixin.js';
9
9
  import ResizeObserver from 'resize-observer-polyfill/dist/ResizeObserver.es.js';
10
10
  import { SelectionMixin } from '../selection/selection-mixin.js';
11
- import { usePopoverMixin as useDropdownPopover } from '../dropdown/dropdown-popover-mixin.js';
12
11
  import { usePopoverMixin as useTooltipPopover } from '../tooltip/tooltip.js';
13
12
 
14
- export const isUsingNativePopover = isPopoverSupported && useDropdownPopover && useTooltipPopover;
13
+ export const isUsingNativePopover = isPopoverSupported && useTooltipPopover;
15
14
 
16
15
  export const tableStyles = css`
17
16
  .d2l-table {