Skip to content

Commit

Permalink
Apply automatic changes
Browse files Browse the repository at this point in the history
Signed-off-by: VF-WP GitHub Actions Bot <[email protected]>
  • Loading branch information
VF-WP GitHub Actions Bot authored and VF-WP GitHub Actions Bot committed Nov 5, 2024
1 parent 8221dd4 commit 1793434
Show file tree
Hide file tree
Showing 14 changed files with 78 additions and 152 deletions.
2 changes: 1 addition & 1 deletion vf-components/vf-componenet-rollup/package.variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ $componentInfo: (
version: "1.0.0-beta.4",
location: "components/vf-componenet-rollup",
vfCoreVersion: "2.2.47",
buildTimeStamp: "Mon, 04 Nov 2024 20:18:20 GMT"
buildTimeStamp: "Tue, 05 Nov 2024 11:50:12 GMT"
);
2 changes: 1 addition & 1 deletion vf-components/vfwp-admin/package.variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ $componentInfo: (
version: "0.0.1",
location: "components/vfwp-admin",
vfCoreVersion: "2.2.47",
buildTimeStamp: "Mon, 04 Nov 2024 20:18:20 GMT"
buildTimeStamp: "Tue, 05 Nov 2024 11:50:12 GMT"
);
2 changes: 1 addition & 1 deletion vf-components/vfwp-autocomplete/package.variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ $componentInfo: (
version: "0.0.1",
location: "components/vfwp-autocomplete",
vfCoreVersion: "2.2.47",
buildTimeStamp: "Mon, 04 Nov 2024 20:18:20 GMT"
buildTimeStamp: "Tue, 05 Nov 2024 11:50:12 GMT"
);
2 changes: 1 addition & 1 deletion vf-components/vfwp-gutenberg-blocks/package.variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ $componentInfo: (
version: "0.0.1",
location: "components/vfwp-gutenberg-blocks",
vfCoreVersion: "2.2.47",
buildTimeStamp: "Mon, 04 Nov 2024 20:18:20 GMT"
buildTimeStamp: "Tue, 05 Nov 2024 11:50:12 GMT"
);
2 changes: 1 addition & 1 deletion vf-components/vfwp-gutenberg-iframe/package.variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ $componentInfo: (
version: "0.0.1",
location: "components/vfwp-gutenberg-iframe",
vfCoreVersion: "2.2.47",
buildTimeStamp: "Mon, 04 Nov 2024 20:18:20 GMT"
buildTimeStamp: "Tue, 05 Nov 2024 11:50:12 GMT"
);
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
* Component: @visual-framework/vf-back-to-top
* Version: 1.0.2
* Location: components/vf-core-components/vf-back-to-top
* Build time: Mon, 04 Nov 2024 20:18:01 GMT
* Build time: Tue, 05 Nov 2024 11:49:52 GMT
*/
.vf-back-to-top {
display: inline;
Expand Down
2 changes: 1 addition & 1 deletion wp-content/themes/vf-wp/assets/assets/vf-flag/vf-flag.css
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
* Component: @visual-framework/vf-flag
* Version: 1.0.0-alpha.2
* Location: components/vf-core-components/vf-flag
* Build time: Mon, 04 Nov 2024 20:18:01 GMT
* Build time: Tue, 05 Nov 2024 11:49:52 GMT
*/
.vf-flag {
display: table;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
* Component: @visual-framework/vf-mega-menu
* Version: 1.0.2
* Location: components/vf-core-components/vf-mega-menu
* Build time: Mon, 04 Nov 2024 20:18:01 GMT
* Build time: Tue, 05 Nov 2024 11:49:52 GMT
*/
.vf-mega-menu__link {
display: -webkit-box;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
* Component: @visual-framework/vf-sidebar
* Version: 1.0.0-alpha.2
* Location: components/vf-core-components/vf-sidebar
* Build time: Mon, 04 Nov 2024 20:18:01 GMT
* Build time: Tue, 05 Nov 2024 11:49:52 GMT
*/
.vf-sidebar {
overflow: hidden;
Expand Down
2 changes: 1 addition & 1 deletion wp-content/themes/vf-wp/assets/assets/vf-tabs/vf-tabs.css
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
/* stylelint-enable */
/*!
* Component: @visual-framework/vf-tabs
* Version: 2.1.7
* Version: 2.1.4
* Location: components/vf-core-components/vf-tabs
*/
.vf-tabs__list {
Expand Down
71 changes: 31 additions & 40 deletions wp-content/themes/vf-wp/assets/assets/vf-tabs/vf-tabs.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* @param {boolean} [activateDeepLinkOnLoad] - if deep linked tabs should be activated on page load, defaults to true
* @example vfTabs(document.querySelectorAll('.vf-component__container')[0]);
*/
function vfTabs(scope) {
function vfTabs(scope, activateDeepLinkOnLoad) {
/* eslint-disable no-redeclare */
var scope = scope || document;
var activateDeepLinkOnLoad = activateDeepLinkOnLoad || true;
Expand All @@ -18,7 +18,6 @@ function vfTabs(scope) {
"[data-vf-js-tabs-content] [id^='vf-tabs__section']"
);
const tabs = scope.querySelectorAll("[data-vf-js-tabs] .vf-tabs__link");

if (!tabsList || !panels || !tabs) {
// exit: either tabs or tabbed content not found
return;
Expand All @@ -41,10 +40,11 @@ function vfTabs(scope) {
tab.removeAttribute("aria-selected");
tab.setAttribute("tabindex", "-1");
tab.classList.remove("is-active");

// Handle clicking of tabs for mouse users
tab.addEventListener("click", e => {
e.preventDefault();
vfTabsSwitch(e.currentTarget);
vfTabsSwitch(e.currentTarget, panels);
});

// Handle keydown events for keyboard users
Expand All @@ -68,7 +68,7 @@ function vfTabs(scope) {
dir === "down"
? panels[i].focus({ preventScroll: true })
: tabs[dir]
? vfTabsSwitch(tabs[dir])
? vfTabsSwitch(tabs[dir], panels)
: void 0;
}
});
Expand Down Expand Up @@ -100,44 +100,33 @@ function vfTabs(scope) {

// activate any deeplinks to a specific tab
if (activateDeepLinkOnLoad) {
Array.prototype.forEach.call(panels, panel => {
let links = panel.querySelectorAll("[href*='vf-tabs__section']");
links.forEach(link => {
link.addEventListener("click", e => {
e.preventDefault();
let href = e.currentTarget.getAttribute("href");
vfTabsDeepLinkOnLoad(tabs, href);
});
});
});
vfTabsDeepLinkOnLoad(tabs, panels);
}
}

// The tab switching function
const vfTabsSwitch = newTab => {
const vfTabsSwitch = (newTab, panels) => {
// Update url based on tab id
const data = newTab.getAttribute("id");
const url = "#" + data;
window.history.replaceState(data, null, url);

// get the parent ul of the clicked tab
let parentTabSet = newTab.closest(".vf-tabs");
let parentPanelSet = parentTabSet.nextElementSibling || newTab.closest(".vf-tabs__list").nextElementSibling;
let tabs = parentTabSet.querySelectorAll("[data-vf-js-tabs] .vf-tabs__link");
let panels = parentPanelSet.querySelectorAll(
"[data-vf-js-tabs-content] [id^='vf-tabs__section']"
);

tabs.forEach(tab => {
if (tab.getAttribute("aria-selected")) {
tab.removeAttribute("aria-selected");
tab.setAttribute("tabindex", "-1");
tab.classList.remove("is-active");

panels.forEach(panel => {
if (panel.id === tab.id) {
panel.hidden = true;
}
});
let parentTabSet = newTab.closest(".vf-tabs__list");
let oldTab = parentTabSet.querySelector("[aria-selected]");
if (oldTab) {
oldTab.removeAttribute("aria-selected");
oldTab.setAttribute("tabindex", "-1");
oldTab.classList.remove("is-active");

for (let item = 0; item < panels.length; item++) {
const panel = panels[item];
if (panel.id === oldTab.id) {
panel.hidden = true;
break;
}
}
});
}

newTab.focus({ preventScroll: true });
// Make the active tab focusable by the user (Tab key)
Expand All @@ -147,17 +136,19 @@ const vfTabsSwitch = newTab => {
newTab.classList.add("is-active");
// Get the indices of the new tab to find the correct
// tab panel to show
panels.forEach(panel => {
for (let item = 0; item < panels.length; item++) {
const panel = panels[item];
if (panel.id === newTab.id) {
panel.hidden = false;
break;
}
});
}
};

function vfTabsDeepLinkOnLoad(tabs, href) {
function vfTabsDeepLinkOnLoad(tabs, panels) {
// 1. See if there is a `#vf-tabs__section--88888`
if (href) {
var hash = href.substring(href.indexOf("#") + 1);
if (window.location.hash) {
var hash = window.location.hash.substring(1); //Puts hash in variable, and removes the # character
} else {
// No hash found
return false;
Expand All @@ -168,7 +159,7 @@ function vfTabsDeepLinkOnLoad(tabs, href) {
Array.prototype.forEach.call(tabs, tab => {
let tabId = tab.getAttribute("data-tabs__item");
if (tabId == hash) {
vfTabsSwitch(tab);
vfTabsSwitch(tab, panels);
}
});
}
Expand Down
60 changes: 0 additions & 60 deletions wp-content/themes/vf-wp/assets/assets/vf-tabs/vf-tabs.react.js

This file was deleted.

10 changes: 5 additions & 5 deletions wp-content/themes/vf-wp/assets/css/styles.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 1793434

Please sign in to comment.