From c57d04b5e699fa74ba4539b160a35f0ba048e0e9 Mon Sep 17 00:00:00 2001 From: "Nichols, Kieran" Date: Fri, 17 May 2024 13:39:44 -0400 Subject: [PATCH 1/2] feat(tab): deprecate leading/trailing slots in favor of start/end --- src/dev/pages/tabs/tabs.html | 4 ++-- src/dev/pages/tabs/tabs.ts | 16 ++++++++-------- src/lib/tabs/tab/tab.html | 8 ++++++-- src/lib/tabs/tab/tab.scss | 4 ++++ src/lib/tabs/tab/tab.ts | 4 ++++ 5 files changed, 24 insertions(+), 12 deletions(-) diff --git a/src/dev/pages/tabs/tabs.html b/src/dev/pages/tabs/tabs.html index 9906f99da..1f8e4bc74 100644 --- a/src/dev/pages/tabs/tabs.html +++ b/src/dev/pages/tabs/tabs.html @@ -12,8 +12,8 @@ { type: 'switch', label: 'Inverted', id: 'opt-inverted' }, { type: 'switch', label: 'Auto activate', id: 'opt-auto-activate' }, { type: 'switch', label: 'Scroll buttons', id: 'opt-scroll-buttons' }, - { type: 'switch', label: 'Show leading icon', id: 'opt-show-leading' }, - { type: 'switch', label: 'Show trailing icon', id: 'opt-show-trailing' }, + { type: 'switch', label: 'Show start icon', id: 'opt-show-start' }, + { type: 'switch', label: 'Show end icon', id: 'opt-show-end' }, { type: 'select', label: 'Clustered alignment', diff --git a/src/dev/pages/tabs/tabs.ts b/src/dev/pages/tabs/tabs.ts index 06f0b8901..134998c89 100644 --- a/src/dev/pages/tabs/tabs.ts +++ b/src/dev/pages/tabs/tabs.ts @@ -71,26 +71,26 @@ scrollButtonsToggle.addEventListener('forge-switch-change', ({ detail: selected tabBar.scrollButtons = selected; }); -const showLeadingToggle = document.getElementById('opt-show-leading') as ISwitchComponent; -showLeadingToggle.addEventListener('forge-switch-change', ({ detail: selected }) => { +const showStartToggle = document.getElementById('opt-show-start') as ISwitchComponent; +showStartToggle.addEventListener('forge-switch-change', ({ detail: selected }) => { const tabElements = tabBar.querySelectorAll('forge-tab'); tabElements.forEach(tab => { if (selected) { - tab.appendChild(createIcon('favorite', 'leading')); + tab.appendChild(createIcon('favorite', 'start')); } else { - tab.removeChild(tab.querySelector('forge-icon[slot=leading]')); + tab.removeChild(tab.querySelector('forge-icon[slot=start]')); } }); }); -const showTrailingToggle = document.getElementById('opt-show-trailing') as ISwitchComponent; -showTrailingToggle.addEventListener('forge-switch-change', ({ detail: selected }) => { +const showEndToggle = document.getElementById('opt-show-end') as ISwitchComponent; +showEndToggle.addEventListener('forge-switch-change', ({ detail: selected }) => { const tabElements = tabBar.querySelectorAll('forge-tab'); tabElements.forEach(tab => { if (selected) { - tab.appendChild(createIcon('favorite', 'trailing')); + tab.appendChild(createIcon('favorite', 'end')); } else { - tab.removeChild(tab.querySelector('forge-icon[slot=trailing]')); + tab.removeChild(tab.querySelector('forge-icon[slot=end]')); } }); }); diff --git a/src/lib/tabs/tab/tab.html b/src/lib/tabs/tab/tab.html index 4ac34293b..2f4f28ec9 100644 --- a/src/lib/tabs/tab/tab.html +++ b/src/lib/tabs/tab/tab.html @@ -1,11 +1,15 @@