<section class="ps ps-tabs--steps">
<div class="ps__wrap">
<div class="ps__head">
<header class="ps__header">
<span class="ps__kicker">Lorem Ipsum</span>
<h2 class="ps__title" aria-level="">It's more than a budget manager</h2>
</header>
<div class="ps__desc">
<p>
Learn about Prismic by reading questions and answers. It’s almost like talking to a human – and maybe even better.
</p>
</div>
</div>
<div class="ps__main grid grid--12">
<div class="span-1-12">
<div class="c-tabs" data-tabs>
<div class="c-tabs__tablist c-tabs__tablist--steps span-1-12" data-tablist hidden>
<button class="c-tabs__tab" data-tab>
<svg width="32" height="32" viewBox="-2 -2 36 36">
<g fill="none" fill-rule="evenodd">
<circle fill="currentColor" stroke="inherit" stroke-width="2" cx="16" cy="16" r="16" />
<circle fill="#FFF" stroke="none" class="dot" cx="16" cy="16" r="5" />
</g>
</svg>
<span>Step 1 might be longer than the rest</span>
</button>
<button class="c-tabs__tab" data-tab>
<svg width="32" height="32" viewBox="-2 -2 36 36">
<g fill="none" fill-rule="evenodd">
<circle fill="currentColor" stroke="inherit" stroke-width="2" cx="16" cy="16" r="16" />
<circle fill="#FFF" stroke="none" class="dot" cx="16" cy="16" r="5" />
</g>
</svg>
<span>Step 2</span>
</button>
<button class="c-tabs__tab" data-tab>
<svg width="32" height="32" viewBox="-2 -2 36 36">
<g fill="none" fill-rule="evenodd">
<circle fill="currentColor" stroke="inherit" stroke-width="2" cx="16" cy="16" r="16" />
<circle fill="#FFF" stroke="none" class="dot" cx="16" cy="16" r="5" />
</g>
</svg>
<span>Step 3</span>
</button>
<button class="c-tabs__tab" data-tab>
<svg width="32" height="32" viewBox="-2 -2 36 36">
<g fill="none" fill-rule="evenodd">
<circle fill="currentColor" stroke="inherit" stroke-width="2" cx="16" cy="16" r="16" />
<circle fill="#FFF" stroke="none" class="dot" cx="16" cy="16" r="5" />
</g>
</svg>
<span>Step 4 might be too</span>
</button>
</div>
<section id="UNIQUE_LABEL_1" class="c-tabs__tabpanel span-1-12" data-tabpanel>
<div class="span-1-6">
<img class="ps__img" src=" ../../img/illustrations/reading-side.png" alt="" width="400" height="546" />
</div>
<div class="span-8-12">
<h3 class="text--xl">1. Collect accurate data</h3>
<p>
No matter what information is important to your business, get accurate customer and product data in real-time across mobile, web, and other platforms.
</p>
<ul class="ps__features-list" role="list">
<li>Figma and sketch files</li>
<li>Auto-updatable styles</li>
<li>Base elements</li>
<li>Page layouts</li>
<li>Accessible components</li>
</ul>
<div class="ps-tabs--steps">
<a href="#" class="ps-button ps-button--secondary">Call to Action</a>
</div>
</div>
</section>
<section id="UNIQUE_LABEL_2" class="c-tabs__tabpanel span-1-12" data-tabpanel>
<div class="span-1-6">
<img class="ps__img" src=" ../../img/illustrations/reading-side.png" alt="" width="400" height="546" />
</div>
<div class="span-8-12">
<h3 class="text--xl">2. Collect accurate data</h3>
<p>
No matter what information is important to your business, get accurate customer and product data in real-time across mobile, web, and other platforms.
</p>
<ul class="ps__features-list" role="list">
<li>Figma and sketch files</li>
<li>Auto-updatable styles</li>
<li>Base elements</li>
<li>Page layouts</li>
<li>Accessible components</li>
</ul>
<div class="ps-tabs--steps">
<a href="#" class="ps-button ps-button--secondary">Call to Action</a>
</div>
</div>
</section>
<section id="UNIQUE_LABEL_3" class="c-tabs__tabpanel span-1-12" data-tabpanel>
<div class="span-1-6">
<img class="ps__img" src=" ../../img/illustrations/reading-side.png" alt="" width="400" height="546" />
</div>
<div class="span-8-12">
<h3 class="text--xl">3. Collect accurate data</h3>
<p>
No matter what information is important to your business, get accurate customer and product data in real-time across mobile, web, and other platforms.
</p>
<ul class="ps__features-list" role="list">
<li>Figma and sketch files</li>
<li>Auto-updatable styles</li>
<li>Base elements</li>
<li>Page layouts</li>
<li>Accessible components</li>
</ul>
<div class="ps-tabs--steps">
<a href="#" class="ps-button ps-button--secondary">Call to Action</a>
</div>
</div>
</section>
<section id="UNIQUE_LABEL_4" class="c-tabs__tabpanel span-1-12" data-tabpanel>
<div class="span-1-6">
<img class="ps__img" src=" ../../img/illustrations/reading-side.png" alt="" width="400" height="546" />
</div>
<div class="span-8-12">
<h3 class="text--xl">4. Collect accurate data</h3>
<p>
No matter what information is important to your business, get accurate customer and product data in real-time across mobile, web, and other platforms.
</p>
<ul class="ps__features-list" role="list">
<li>Figma and sketch files</li>
<li>Auto-updatable styles</li>
<li>Base elements</li>
<li>Page layouts</li>
<li>Accessible components</li>
</ul>
<div class="ps-tabs--steps">
<a href="#" class="ps-button ps-button--secondary">Call to Action</a>
</div>
</div>
</section>
</div>
</div>
</div>
</div>
</section>
"use strict";
if (typeof Object.assign != "function") {
// Must be writable: true, enumerable: false, configurable: true
Object.defineProperty(Object, "assign", {
value: function assign(target, varArgs) {
// .length of function is 2
if (target == null) {
// TypeError if undefined or null
throw new TypeError(
"Cannot convert undefined or null to object"
);
}
var to = Object(target);
for (var index = 1; index < arguments.length; index++) {
var nextSource = arguments[index];
if (nextSource != null) {
// Skip over if undefined or null
for (var nextKey in nextSource) {
// Avoid bugs when hasOwnProperty is shadowed
if (
Object.prototype.hasOwnProperty.call(
nextSource,
nextKey
)
) {
to[nextKey] = nextSource[nextKey];
}
}
}
}
return to;
},
writable: true,
configurable: true
});
}
// add utilities; borrowed from: https://scottaohara.github.io/a11y_tab_widget/
var util = {
keyCodes: {
UP: 38,
DOWN: 40,
LEFT: 37,
RIGHT: 39,
HOME: 36,
END: 35,
ENTER: 13,
SPACE: 32,
DELETE: 46,
TAB: 9
},
generateID: function (base) {
return base + Math.floor(Math.random() * 999);
},
getUrlHash: function () {
return window.location.hash.replace('#', '');
},
/**
* Use history.replaceState so clicking through Tabs
* does not create dozens of new history entries.
* Browser back should navigate to the previous page
* regardless of how many Tabs were activated.
*
* @param {string} hash
*/
setUrlHash: function (hash) {
if (history.replaceState) {
history.replaceState(null, '', '#' + hash);
} else {
location.hash = hash;
}
}
};
(function (w, doc, undefined) {
var ARIAaccOptions = {
manual: true,
open: 0
}
var ARIAtabs = function (inst, options) {
var _options = Object.assign(ARIAaccOptions, options);
var el = inst;
var tablist = el.querySelector("[data-tablist]");
var tabs = Array.from(el.querySelectorAll("[data-tab]"));
var tabpanels = Array.from(el.querySelectorAll("[data-tabpanel]"));
var tabsID = util.generateID('ps__tabs-');
var orientation = el.getAttribute('data-tabs-orientation');
var currentIndex = _options.open;
var selectedTab = currentIndex;
var manual = _options.manual;
el.setAttribute('id', tabsID);
var init = function () {
el.classList.add('js-tabs');
tablist.removeAttribute('hidden');
setupTabList();
setupTabs();
setupTabPanels();
};
var setupTabList = function () {
tablist.setAttribute("role", "tablist");
if (orientation == 'vertical') tablist.setAttribute("aria-orientation", "vertical");
}
var setupTabs = function () {
tabs.forEach((tab, index) => {
tab.setAttribute('role', 'tab');
// each tab needs an ID that will be used to label its corresponding panel
tab.setAttribute('id', tabsID + '__tab-' + index);
tab.setAttribute('data-controls', tabpanels[index].getAttribute('id'));
// first tab is initially active
if (index === currentIndex) {
selectTab(tab);
// updateUrlHash();
}
if (tab.getAttribute('data-controls') === util.getUrlHash()) {
currentIndex = index;
selectedTab = index;
selectTab(tab);
}
tab.addEventListener('click', (e) => {
e.preventDefault();
currentIndex = index;
selectedTab = index;
focusCurrentTab();
selectTab(tab);
updateUrlHash();
}, false);
tab.addEventListener('keydown', (e) => {
tabKeyboardRespond(e, tab);
}, false);
});
}
var focusCurrentTab = function () {
tabs[currentIndex].focus();
}
var updateUrlHash = function () {
var active = tabs[selectedTab];
util.setUrlHash(active.getAttribute('data-controls'));
};
var selectTab = function (tab) {
// unactivate all other tabs
tabs.forEach(tab => {
tab.setAttribute('aria-selected', 'false');
tab.setAttribute('tabindex', '-1');
});
//activate current tab
tab.setAttribute('aria-selected', 'true');
tab.setAttribute('tabindex', '0');
// activate corresponding panel
showTabpanel(tab);
}
var setupTabPanels = function () {
tabpanels.forEach((tabpanel, index) => {
tabpanel.setAttribute('role', 'tabpanel');
tabpanel.setAttribute('tabindex', '-1');
tabpanel.setAttribute('hidden', '');
if (index == currentIndex) {
tabpanel.removeAttribute('hidden');
}
tabpanel.addEventListener('keydown', (e) => {
panelKeyboardRespond(e);
}, false);
tabpanel.addEventListener("blur", () => {
tabpanel.setAttribute('tabindex', '-1');
}, false);
});
}
var panelKeyboardRespond = function (e) {
var keyCode = e.keyCode || e.which;
switch (keyCode) {
case util.keyCodes.TAB:
tabpanels[currentIndex].setAttribute('tabindex', '-1');
break;
default:
break;
}
}
var showTabpanel = function (tab) {
tabpanels.forEach((tabpanel, index) => {
tabpanel.setAttribute('hidden', '');
tabpanel.removeAttribute('tabindex');
if (index == currentIndex) {
tabpanel.removeAttribute('hidden');
tabpanel.setAttribute('aria-labelledby', tabs[currentIndex].getAttribute('id'));
tabpanel.setAttribute('tabindex', '0');
}
});
}
var incrementcurrentIndex = function () {
if (currentIndex < tabs.length - 1) {
return ++currentIndex;
}
else {
currentIndex = 0;
return currentIndex;
}
};
var decrementcurrentIndex = function () {
if (currentIndex > 0) {
return --currentIndex;
}
else {
currentIndex = tabs.length - 1;
return currentIndex;
}
};
var tabKeyboardRespond = function (e, tab) {
var firstTab = tabs[0];
var lastTab = tabs[tabs.length - 1];
var keyCode = e.keyCode || e.which;
switch (keyCode) {
case util.keyCodes.UP:
case util.keyCodes.LEFT:
e.preventDefault();
decrementcurrentIndex();
focusCurrentTab();
if (!manual) {
selectedTab = currentIndex;
selectTab(tabs[selectedTab]);
updateUrlHash();
}
break;
case util.keyCodes.DOWN:
case util.keyCodes.RIGHT:
e.preventDefault();
incrementcurrentIndex();
focusCurrentTab();
if (!manual) {
selectedTab = currentIndex;
selectTab(tabs[selectedTab]);
updateUrlHash();
}
break;
case util.keyCodes.ENTER:
case util.keyCodes.SPACE:
e.preventDefault();
selectedTab = currentIndex;
selectTab(tabs[selectedTab]);
updateUrlHash();
break;
case util.keyCodes.TAB:
tabpanels[selectedTab].setAttribute('tabindex', '0');
currentIndex = selectedTab;
break;
case util.keyCodes.HOME:
e.preventDefault();
firstTab.focus();
updateUrlHash();
break;
case util.keyCodes.END:
e.preventDefault();
lastTab.focus();
updateUrlHash();
break;
}
}
init.call(this);
return this;
}; // ARIAtabs()
w.ARIAtabs = ARIAtabs;
})(window, document);
var tabsInstance = "[data-tabs]";
var els = document.querySelectorAll(tabsInstance);
var allTabs = [];
// Generate all tabs instances
for (var i = 0; i < els.length; i++) {
var nTabs = new ARIAtabs(els[i], { manual: true }); // if manual is set to false, the tabs open on focus without needing an ENTER or SPACE press
allTabs.push(nTabs);
}
{
"status": "ready"
}
/**************************************************\
* Tabs | Steps component-specific styles.
* Main general styles are in the _tabs.scss file
***************************************************/
.ps-tabs--steps .c-tabs__tablist {
background-image: url('../img/dashed-line.svg');
background-repeat: repeat no-repeat;
background-position: left 1rem top 1rem;
background-size: auto auto;
background-clip: content-box;
padding: 0 1rem;
align-items: flex-start;
min-height: auto;
}
.ps-tabs--steps .c-tabs__tab {
padding: 0;
max-width: 10rem;
text-align: center;
font-weight: bold;
position: relative;
margin-right: 1rem;
&:first-of-type() {
text-align: left;
left: -1rem;
}
&:last-of-type() {
text-align: right;
right: -2rem;
}
svg {
display: inline-block;
color: #fff;
stroke: #ccc;
width: 2rem;
height: 2rem;
.dot {
fill: #000;
}
}
span {
display: block;
margin-top: 1rem;
white-space: normal;
line-height: 1.3;
position: relative;
}
&[aria-selected="true"] {
color: var(--color--primary);
svg {
color: inherit;
stroke: var(--color--primary);
.dot {
fill: #fff;
}
}
}
&:hover {
color: var(--color--primary);
}
&:focus,
&.focus-visible {
outline: none;
svg {
color: #000;
stroke: #000;
.dot {
fill: #fff;
}
}
}
&:focus:not(:focus-visible) {
&[aria-selected="true"] {
color: var(--color--primary);
svg {
color: inherit;
stroke: var(--color--primary);
.dot {
fill: #fff;
}
}
}
}
.js-focus-visible &:focus:not(.focus-visible) {
&[aria-selected="true"] {
color: var(--color--primary);
svg {
color: inherit;
stroke: var(--color--primary);
.dot {
fill: #fff;
}
}
}
}
}
.ps-tabs--steps .c-tabs__tabpanel {
@media all and (min-width:50em) {
@supports (display:grid) {
display: grid;
grid-template-columns: subgrid;
grid-template-columns: repeat(12, 1fr);
grid-column-gap: var(--h-padding);
&[hidden] {
display: none; // we don't want the tabpanel to show up when it should be hidden
}
}
}
}
title: Tabs | Steps
# notes: "You can have a note here; it will override the README.md notes"
context:
text: