@brightspace-ui-labs/facet-filter-sort 6.7.0 → 6.7.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.
|
@@ -2,9 +2,9 @@ import '@brightspace-ui/core/components/button/button-subtle.js';
|
|
|
2
2
|
import '@brightspace-ui/core/components/colors/colors.js';
|
|
3
3
|
import '@brightspace-ui/core/components/dropdown/dropdown-button-subtle.js';
|
|
4
4
|
import '@brightspace-ui/core/components/dropdown/dropdown-tabs.js';
|
|
5
|
-
import '@brightspace-ui/core/components/tabs/tabs.js';
|
|
6
5
|
import '@brightspace-ui/core/components/tabs/tab.js';
|
|
7
6
|
import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
|
|
7
|
+
import { getUseNewTabsStructureFlag } from '@brightspace-ui/core/components/tabs/tabs.js';
|
|
8
8
|
import { LocalizeBehavior } from '../localize-behavior.js';
|
|
9
9
|
import { mixinBehaviors } from '@polymer/polymer/lib/legacy/class.js';
|
|
10
10
|
|
|
@@ -211,12 +211,17 @@ class D2LLabsFilterDropdown extends mixinBehaviors([LocalizeBehavior], PolymerEl
|
|
|
211
211
|
|
|
212
212
|
if (!tabsContainer || !categories || categories.length === 0) return;
|
|
213
213
|
|
|
214
|
+
// Clean up when GAUD-8299-core-tabs-use-new-structure flag is removed
|
|
215
|
+
const useNewTabsStructureFlag = getUseNewTabsStructureFlag();
|
|
216
|
+
|
|
214
217
|
// Build tabInfos which is used to render d2l-tab components
|
|
215
218
|
const tabInfos = [];
|
|
216
219
|
categories.forEach((category, index) => {
|
|
217
220
|
const key = category.getAttribute('key') || `category-${index}`;
|
|
218
221
|
const text = category.getAttribute('text');
|
|
219
|
-
|
|
222
|
+
|
|
223
|
+
// Clean up when GAUD-8299-core-tabs-use-new-structure flag is removed
|
|
224
|
+
const isSelected = useNewTabsStructureFlag ? category._selected : category.hasAttribute('selected');
|
|
220
225
|
|
|
221
226
|
category.setAttribute('labelled-by', key);
|
|
222
227
|
tabInfos.push({ key, text, selected: isSelected });
|
|
@@ -224,7 +229,10 @@ class D2LLabsFilterDropdown extends mixinBehaviors([LocalizeBehavior], PolymerEl
|
|
|
224
229
|
if (!category.__tabInfoObserver) {
|
|
225
230
|
category.__tabInfoObserver = new MutationObserver(() => {
|
|
226
231
|
const newText = category.getAttribute('text');
|
|
227
|
-
|
|
232
|
+
|
|
233
|
+
// Clean up when GAUD-8299-core-tabs-use-new-structure flag is removed
|
|
234
|
+
const newSelected = useNewTabsStructureFlag ? category._selected : category.hasAttribute('selected');
|
|
235
|
+
|
|
228
236
|
this._tabInfos = this._tabInfos.map(info => {
|
|
229
237
|
return info.key === key
|
|
230
238
|
? { ...info, text: newText, selected: newSelected }
|