tabs.pcss.css
Same filename in this branch
/** * Tabs. */ :root { /** * Tabs. */ --tabs-border-radius-size: var(--base-border-radius); --tabs--hover-height: 3px; --tabs--focus-height: 3px; --tabs--active-height: 3px; --tabs-link-height: 3rem; /* 48px */ --tabs-secondary-link-height: 2.5rem; /* 40px */ --tabs-base-border: 1px solid var(--color-gray-200); --tabs-base-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); --tabs-trigger-border: 1px solid rgba(216, 217, 224, 0.8); --tabs--hover-bg-color: var(--color-bgblue-active); } .tabs-wrapper { & > nav { width: 100%; } } .tabs { display: flex; flex-direction: column; width: 100%; margin: 0 0 var(--space-l) 0; border: var(--tabs-base-border); border-radius: var(--tabs-border-radius-size); box-shadow: var(--tabs-base-shadow); } .tabs__tab { position: relative; border-bottom: var(--tabs-base-border); background-color: var(--color-gray-025); font-size: var(--font-size-s); font-weight: bold; &:not(.is-active) { display: none; } &:last-child { border-bottom: 0; } &.is-active { display: flex; justify-content: space-between; background-color: var(--color-white); box-shadow: var(--tabs-base-shadow); &:focus::before { top: calc(var(--tabs--focus-height) * -1); height: calc(var(--tabs-link-height) + 2px); } &::before { z-index: 2; top: -1px; inset-inline-start: -1px; width: var(--tabs--active-height); height: calc(100% + 2px); border-inline-start: var(--tabs--active-height) solid var(--color-absolutezero); border-top-left-radius: var(--tabs-border-radius-size); } } } .tabs__link { position: relative; display: flex; overflow: hidden; flex-grow: 1; align-items: center; box-sizing: border-box; min-height: var(--tabs-link-height); padding: var(--space-s) var(--space-l); text-decoration: none; color: var(--color-gray-800); line-height: 1.2rem; &:focus { min-height: calc(var(--tabs-link-height) + var(--tabs--focus-height) - 1px); margin: -1px; padding-inline-start: calc(var(--space-l) - var(--tabs--focus-height) + 1px); text-decoration: none; color: var(--color-gray-800); border: var(--tabs--focus-height) solid var(--color-focus); border-radius: var(--tabs-border-radius-size); outline: none; box-shadow: none; } &:hover { text-decoration: none; color: var(--color-text); } &.is-active { z-index: 1; flex-grow: 1; color: var(--color-absolutezero); &:focus { margin: -1px 0; padding-right: var(--space-l); padding-left: var(--space-l); border-inline-start: none; border-radius: 0; } &:hover { color: var(--color-text); } } &:not(.is-active):focus { z-index: 3; } } /* Active and hover indicator. */ .tabs__tab::before, .tabs__link::before { position: absolute; display: block; content: ""; } .tabs { &.is-open { & .tabs__tab.is-active::before { border-bottom-left-radius: 0; } } } .tabs--secondary { & .tabs__tab:not(.is-active) { display: block; } } .tabs.is-open > .tabs__tab { display: flex; } .tabs__trigger { display: flex; flex-shrink: 0; align-items: center; justify-content: center; width: var(--tabs-link-height); padding-right: 1px; text-align: center; border-inline-start: var(--tabs-trigger-border); &:focus { padding-right: 0; border: var(--tabs--focus-height) solid var(--color-focus); border-radius: var(--tabs-border-radius-size); box-shadow: none; } } @media screen and (min-width: 48em) { .tabs-wrapper { display: flex; } .tabs-wrapper--secondary { position: relative; } .is-horizontal { & .tabs { flex-direction: row; align-items: flex-end; width: auto; margin: 0; border: 0; box-shadow: none; } & .tabs--secondary { overflow: hidden; margin: calc(calc(var(--tabs--focus-height) + 3px) * -1) calc(calc(var(--tabs--focus-height) + 3px) * -1) 0; padding: calc(var(--tabs--focus-height) + 3px) calc(var(--tabs--focus-height) + 3px) 0; border-radius: 0; &::after { position: absolute; bottom: 0; left: 0; display: block; width: 100%; content: ""; border-bottom: 1px solid var(--color-gray-200); } & .tabs__tab { font-size: var(--font-size-s); } & .tabs__link { min-height: var(--tabs-secondary-link-height); padding-top: var(--space-xs); padding-bottom: var(--space-xs); &:focus { min-height: var(--tabs-secondary-link-height); } } } & .tabs__tab { display: block; border-top: none; border-bottom: none; background: none; font-size: var(--font-size-base); &.is-active { order: 0; background: none; box-shadow: none; &::before { content: none; } } & .tabs__link { &.is-active::before { border-radius: 0; } } } & .tabs__link { padding-right: 2rem; padding-left: 2rem; border-radius: var(--tabs-border-radius-size) var(--tabs-border-radius-size) 0 0; &:focus { min-height: var(--tabs-link-height); margin: 0; padding-right: 2rem; padding-left: 2rem; color: var(--color-text); border: none; border-radius: var(--tabs-border-radius-size) var(--tabs-border-radius-size) 0 0; outline: 2px dotted transparent; box-shadow: 0 0 0 2px var(--color-white), 0 0 0 calc(var(--tabs--focus-height) + 2px) var(--color-focus); } &:hover { color: var(--color-absolutezero-hover); background: var(--tabs--hover-bg-color); } &.is-active { &::before { top: auto; right: 0; bottom: 0; left: 0; width: 100%; height: var(--tabs--active-height); border-right: none; border-bottom: var(--tabs--active-height) solid var(--color-absolutezero); border-left: none; } } } & .tabs__trigger { display: none; } & .tabs--primary { & .tabs__link { &:focus { box-shadow: 0 0 0 2px var(--color-gray-050), 0 0 0 calc(var(--tabs--focus-height) + 2px) var(--color-focus); } } } } }
File
-
core/
themes/ claro/ css/ components/ tabs.pcss.css
View source
- /**
- * Tabs.
- */
-
- :root {
- /**
- * Tabs.
- */
- --tabs-border-radius-size: var(--base-border-radius);
- --tabs--hover-height: 3px;
- --tabs--focus-height: 3px;
- --tabs--active-height: 3px;
- --tabs-link-height: 3rem; /* 48px */
- --tabs-secondary-link-height: 2.5rem; /* 40px */
- --tabs-base-border: 1px solid var(--color-gray-200);
- --tabs-base-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
- --tabs-trigger-border: 1px solid rgba(216, 217, 224, 0.8);
- --tabs--hover-bg-color: var(--color-bgblue-active);
- }
-
- .tabs-wrapper {
- & > nav {
- width: 100%;
- }
- }
- .tabs {
- display: flex;
- flex-direction: column;
- width: 100%;
- margin: 0 0 var(--space-l) 0;
- border: var(--tabs-base-border);
- border-radius: var(--tabs-border-radius-size);
- box-shadow: var(--tabs-base-shadow);
- }
-
- .tabs__tab {
- position: relative;
- border-bottom: var(--tabs-base-border);
- background-color: var(--color-gray-025);
- font-size: var(--font-size-s);
- font-weight: bold;
- &:not(.is-active) {
- display: none;
- }
- &:last-child {
- border-bottom: 0;
- }
- &.is-active {
- display: flex;
- justify-content: space-between;
- background-color: var(--color-white);
- box-shadow: var(--tabs-base-shadow);
- &:focus::before {
- top: calc(var(--tabs--focus-height) * -1);
- height: calc(var(--tabs-link-height) + 2px);
- }
- &::before {
- z-index: 2;
- top: -1px;
- inset-inline-start: -1px;
- width: var(--tabs--active-height);
- height: calc(100% + 2px);
- border-inline-start: var(--tabs--active-height) solid var(--color-absolutezero);
- border-top-left-radius: var(--tabs-border-radius-size);
- }
- }
- }
-
- .tabs__link {
- position: relative;
- display: flex;
- overflow: hidden;
- flex-grow: 1;
- align-items: center;
- box-sizing: border-box;
- min-height: var(--tabs-link-height);
- padding: var(--space-s) var(--space-l);
- text-decoration: none;
- color: var(--color-gray-800);
- line-height: 1.2rem;
- &:focus {
- min-height: calc(var(--tabs-link-height) + var(--tabs--focus-height) - 1px);
- margin: -1px;
- padding-inline-start: calc(var(--space-l) - var(--tabs--focus-height) + 1px);
- text-decoration: none;
- color: var(--color-gray-800);
- border: var(--tabs--focus-height) solid var(--color-focus);
- border-radius: var(--tabs-border-radius-size);
- outline: none;
- box-shadow: none;
- }
- &:hover {
- text-decoration: none;
- color: var(--color-text);
- }
- &.is-active {
- z-index: 1;
- flex-grow: 1;
- color: var(--color-absolutezero);
- &:focus {
- margin: -1px 0;
- padding-right: var(--space-l);
- padding-left: var(--space-l);
- border-inline-start: none;
- border-radius: 0;
- }
- &:hover {
- color: var(--color-text);
- }
- }
- &:not(.is-active):focus {
- z-index: 3;
- }
- }
- /* Active and hover indicator. */
- .tabs__tab::before,
- .tabs__link::before {
- position: absolute;
- display: block;
- content: "";
- }
- .tabs {
- &.is-open {
- & .tabs__tab.is-active::before {
- border-bottom-left-radius: 0;
- }
- }
- }
- .tabs--secondary {
- & .tabs__tab:not(.is-active) {
- display: block;
- }
- }
- .tabs.is-open > .tabs__tab {
- display: flex;
- }
-
- .tabs__trigger {
- display: flex;
- flex-shrink: 0;
- align-items: center;
- justify-content: center;
- width: var(--tabs-link-height);
- padding-right: 1px;
- text-align: center;
- border-inline-start: var(--tabs-trigger-border);
- &:focus {
- padding-right: 0;
- border: var(--tabs--focus-height) solid var(--color-focus);
- border-radius: var(--tabs-border-radius-size);
- box-shadow: none;
- }
- }
-
- @media screen and (min-width: 48em) {
- .tabs-wrapper {
- display: flex;
- }
-
- .tabs-wrapper--secondary {
- position: relative;
- }
-
- .is-horizontal {
- & .tabs {
- flex-direction: row;
- align-items: flex-end;
- width: auto;
- margin: 0;
- border: 0;
- box-shadow: none;
- }
- & .tabs--secondary {
- overflow: hidden;
- margin: calc(calc(var(--tabs--focus-height) + 3px) * -1) calc(calc(var(--tabs--focus-height) + 3px) * -1) 0;
- padding: calc(var(--tabs--focus-height) + 3px) calc(var(--tabs--focus-height) + 3px) 0;
- border-radius: 0;
- &::after {
- position: absolute;
- bottom: 0;
- left: 0;
- display: block;
- width: 100%;
- content: "";
- border-bottom: 1px solid var(--color-gray-200);
- }
- & .tabs__tab {
- font-size: var(--font-size-s);
- }
- & .tabs__link {
- min-height: var(--tabs-secondary-link-height);
- padding-top: var(--space-xs);
- padding-bottom: var(--space-xs);
- &:focus {
- min-height: var(--tabs-secondary-link-height);
- }
- }
- }
- & .tabs__tab {
- display: block;
- border-top: none;
- border-bottom: none;
- background: none;
- font-size: var(--font-size-base);
- &.is-active {
- order: 0;
- background: none;
- box-shadow: none;
- &::before {
- content: none;
- }
- }
- & .tabs__link {
- &.is-active::before {
- border-radius: 0;
- }
- }
- }
- & .tabs__link {
- padding-right: 2rem;
- padding-left: 2rem;
- border-radius: var(--tabs-border-radius-size) var(--tabs-border-radius-size) 0 0;
- &:focus {
- min-height: var(--tabs-link-height);
- margin: 0;
- padding-right: 2rem;
- padding-left: 2rem;
- color: var(--color-text);
- border: none;
- border-radius: var(--tabs-border-radius-size) var(--tabs-border-radius-size) 0 0;
- outline: 2px dotted transparent;
- box-shadow:
- 0 0 0 2px var(--color-white),
- 0 0 0 calc(var(--tabs--focus-height) + 2px) var(--color-focus);
- }
- &:hover {
- color: var(--color-absolutezero-hover);
- background: var(--tabs--hover-bg-color);
- }
- &.is-active {
- &::before {
- top: auto;
- right: 0;
- bottom: 0;
- left: 0;
- width: 100%;
- height: var(--tabs--active-height);
- border-right: none;
- border-bottom: var(--tabs--active-height) solid var(--color-absolutezero);
- border-left: none;
- }
- }
- }
- & .tabs__trigger {
- display: none;
- }
- & .tabs--primary {
- & .tabs__link {
- &:focus {
- box-shadow:
- 0 0 0 2px var(--color-gray-050),
- 0 0 0 calc(var(--tabs--focus-height) + 2px) var(--color-focus);
- }
- }
- }
- }
- }