UNPKG

@dnb/eufemia

Version:

DNB Eufemia Design System UI Library

490 lines (489 loc) 21.3 kB
/* * Button theme * */ /* * Utilities */ /* * Utilities */ /* * Button mixins * */ /* * Utilities */ /* * Utilities */ /* * Button mixins * */ .dnb-button--tertiary { --button-tertiary-focus-left: -0.5rem; --button-tertiary-focus-right: -0.5rem; --button-tertiary-focus-overflow--icon-top: -0.5rem; --button-tertiary-underline-left: var( --button-tertiary-underline-overflow ); --button-tertiary-underline-right: var( --button-tertiary-underline-overflow ); --button-tertiary-underline-overflow: 0; --button-tertiary-underline-overflow--icon: calc( (var(--button-icon-gutter) + var(--button-icon-size)) * -1 ); } .dnb-button--tertiary .dnb-button__text { position: relative; } .dnb-button--tertiary .dnb-button__text::after { content: ""; position: absolute; z-index: 1; left: 0; right: 0; bottom: 0; width: auto; height: 0.095rem; border-radius: 0.0475rem; color: var(--color-sea-green); background-color: currentcolor; bottom: -0.0625rem; color: transparent; transition: color 250ms ease-in-out; } [data-visual-test-wrapper] .dnb-button--tertiary .dnb-button__text::after { transition: none; } .dnb-button--tertiary .dnb-button__text::after { left: var(--button-tertiary-underline-left); right: var(--button-tertiary-underline-right); } .dnb-skeleton .dnb-button--tertiary .dnb-button__text::after { content: none; } html:not([data-whatintent=touch]) .dnb-button--tertiary:focus-visible[disabled] { cursor: not-allowed; } html:not([data-whatintent=touch]) .dnb-button--tertiary:focus-visible:not([disabled]) { outline: none; } html:not([data-whatintent=touch]) .dnb-button--tertiary:focus-visible:not([disabled])::before { content: ""; position: absolute; z-index: 1; top: 0; left: var(--button-tertiary-focus-left); bottom: 0; right: var(--button-tertiary-focus-right); height: inherit; border-radius: inherit; outline: none; --border-color: var(--focus-ring-color); --border-width: var(--focus-ring-width); box-shadow: 0 0 0 var(--border-width) var(--border-color); border-color: transparent; } html:not([data-whatintent=touch]) .dnb-button--tertiary:focus-visible:not([disabled]) .dnb-button__text::after { visibility: hidden; } html:not([data-whatintent=touch]) .dnb-button--tertiary:hover[disabled] { cursor: not-allowed; } html:not([data-whatintent=touch]) .dnb-button--tertiary:hover:not([disabled]) .dnb-button__text::after { visibility: visible; } .dnb-button--tertiary:active[disabled], html:not([data-whatintent=touch]) .dnb-button--tertiary:active[disabled] { cursor: not-allowed; } .dnb-button--tertiary:active:not([disabled]), html:not([data-whatintent=touch]) .dnb-button--tertiary:active:not([disabled]) { outline: initial; } html[data-whatinput=keyboard] .dnb-button--tertiary:active:not([disabled]), html[data-whatinput=keyboard] html:not([data-whatintent=touch]) .dnb-button--tertiary:active:not([disabled]) { box-shadow: none; } html[data-whatintent=touch] .dnb-button--tertiary:active:not([disabled]) .dnb-button__text::after, html[data-whatintent=touch] html:not([data-whatintent=touch]) .dnb-button--tertiary:active:not([disabled]) .dnb-button__text::after { transition: none; visibility: visible; opacity: 1; } html:not([data-whatintent=touch]) .dnb-button--tertiary:active:not([disabled]) .dnb-button__text::after, html:not([data-whatintent=touch]) html:not([data-whatintent=touch]) .dnb-button--tertiary:active:not([disabled]) .dnb-button__text::after { visibility: hidden; } .dnb-button--tertiary.dnb-button--has-text { --button-padding-left: 0; --button-padding-right: 0; --button-icon-margin-top: calc( (var(--button-height) - var(--button-icon-size)) / 2 ); } .dnb-button--tertiary.dnb-button--has-text .dnb-button__icon { align-self: flex-start; } .dnb-button--tertiary.dnb-button--icon-position-top { --button-tertiary-focus-left: var( --button-tertiary-focus-overflow--icon-top ); --button-tertiary-focus-right: var( --button-tertiary-focus-overflow--icon-top ); flex-direction: column; border-radius: 0.5rem; vertical-align: middle; } .dnb-button--tertiary.dnb-button--icon-position-top.dnb-button--has-text { --button-icon-margin-top: 0.5rem; } .dnb-button--tertiary.dnb-button--icon-position-top.dnb-button--has-text .dnb-button__icon { align-self: center; } .dnb-button--tertiary.dnb-button--icon-position-top .dnb-button__text { margin-top: 0; margin-bottom: 0.25rem; font-size: var(--font-size-x-small); } .dnb-button--tertiary.dnb-button--icon-position-top.dnb-button--size-large .dnb-button__text { font-size: var(--font-size-small); } .dnb-button--tertiary.dnb-button--icon-position-top .dnb-button__alignment { order: 3; height: 0; } .dnb-button--tertiary.dnb-button--has-icon.dnb-button--has-text.dnb-button--icon-size-medium, .dnb-button--tertiary.dnb-button--has-icon.dnb-button--has-text.dnb-button--icon-size-large { --button-tertiary-underline-overflow--icon: var( --button-tertiary-underline-overflow ); } .dnb-button--tertiary.dnb-button--has-icon.dnb-button--has-text.dnb-button--icon-position-left { --button-tertiary-focus-right: -1rem; --button-tertiary-underline-left: var( --button-tertiary-underline-overflow--icon ); } .dnb-button--tertiary.dnb-button--has-icon.dnb-button--has-text.dnb-button--icon-position-right { --button-tertiary-focus-left: -1rem; --button-tertiary-underline-right: var( --button-tertiary-underline-overflow--icon ); } .dnb-button--tertiary.dnb-button--has-icon:not(.dnb-button--has-text) { --button-tertiary-focus-left: 0; --button-tertiary-focus-right: 0; } html[data-whatinput=keyboard] .dnb-button--tertiary:hover:focus .dnb-button__text::after { visibility: hidden; } .dnb-button--primary { color: var(--color-white); background-color: var(--color-sea-green); } html:not([data-whatintent=touch]) .dnb-button--primary:hover[disabled] { cursor: not-allowed; } html:not([data-whatintent=touch]) .dnb-button--primary:hover:not([disabled]) { color: var(--color-sea-green); background-color: var(--color-white); --border-color: var(--color-emerald-green); --border-width: 0.125rem; box-shadow: 0 0 0 var(--border-width) var(--border-color); border-color: transparent; } .dnb-button--primary:focus[disabled], html:not([data-whatintent=touch]) .dnb-button--primary:focus[disabled] { cursor: not-allowed; } html[data-whatinput=keyboard] .dnb-button--primary:focus:not([disabled]), html[data-whatinput=keyboard] html:not([data-whatintent=touch]) .dnb-button--primary:focus:not([disabled]) { color: var(--color-sea-green); background-color: var(--color-white); } .dnb-button--primary:focus:not([disabled]), html:not([data-whatintent=touch]) .dnb-button--primary:focus:not([disabled]) { outline: none; } html[data-whatinput=keyboard] .dnb-button--primary:focus:not([disabled]), html[data-whatinput=keyboard] html:not([data-whatintent=touch]) .dnb-button--primary:focus:not([disabled]) { --border-color: var(--focus-ring-color); --border-width: var(--focus-ring-width); box-shadow: inset 0 0 0 var(--border-width) var(--border-color); border-color: transparent; } .dnb-button--primary:active[disabled], html:not([data-whatintent=touch]) .dnb-button--primary:active[disabled] { cursor: not-allowed; } .dnb-button--primary:active:not([disabled]), html:not([data-whatintent=touch]) .dnb-button--primary:active:not([disabled]) { color: var(--color-sea-green); background-color: var(--color-mint-green-50); --border-color: transparent; --border-width: 0.0625rem; box-shadow: 0 0 0 var(--border-width) var(--border-color); border-color: transparent; } .dnb-button--primary[disabled] { color: var(--color-white); background-color: var(--color-sea-green-30); } .dnb-button:not([disabled]).dnb-button--primary.dnb-button__status--error { color: var(--color-white); background-color: var(--color-fire-red); } .dnb-button--secondary { color: var(--color-sea-green); background-color: var(--color-white); --border-color: var(--color-sea-green); --border-width: 0.0625rem; box-shadow: inset 0 0 0 var(--border-width) var(--border-color); border-color: transparent; } html:not([data-whatintent=touch]) .dnb-button--secondary:hover[disabled] { cursor: not-allowed; } html:not([data-whatintent=touch]) .dnb-button--secondary:hover:not([disabled]) { color: var(--color-sea-green); background-color: var(--color-white); --border-color: var(--color-emerald-green); --border-width: 0.125rem; box-shadow: 0 0 0 var(--border-width) var(--border-color); border-color: transparent; } .dnb-button--secondary:focus[disabled], html:not([data-whatintent=touch]) .dnb-button--secondary:focus[disabled] { cursor: not-allowed; } html[data-whatinput=keyboard] .dnb-button--secondary:focus:not([disabled]), html[data-whatinput=keyboard] html:not([data-whatintent=touch]) .dnb-button--secondary:focus:not([disabled]) { color: var(--color-sea-green); background-color: var(--color-white); } .dnb-button--secondary:focus:not([disabled]), html:not([data-whatintent=touch]) .dnb-button--secondary:focus:not([disabled]) { outline: none; } html[data-whatinput=keyboard] .dnb-button--secondary:focus:not([disabled]), html[data-whatinput=keyboard] html:not([data-whatintent=touch]) .dnb-button--secondary:focus:not([disabled]) { --border-color: var(--focus-ring-color); --border-width: var(--focus-ring-width); box-shadow: inset 0 0 0 var(--border-width) var(--border-color); border-color: transparent; } .dnb-button--secondary:active[disabled], html:not([data-whatintent=touch]) .dnb-button--secondary:active[disabled] { cursor: not-allowed; } .dnb-button--secondary:active:not([disabled]), html:not([data-whatintent=touch]) .dnb-button--secondary:active:not([disabled]) { color: var(--color-sea-green); background-color: var(--color-mint-green-50); --border-color: transparent; --border-width: 0.0625rem; box-shadow: 0 0 0 var(--border-width) var(--border-color); border-color: transparent; } .dnb-button--secondary[disabled], .dnb-button--secondary[disabled]:focus { color: var(--color-sea-green-30); background-color: var(--color-white); --border-color: var(--color-sea-green-30); --border-width: 0.0625rem; box-shadow: inset 0 0 0 var(--border-width) var(--border-color); border-color: transparent; } .dnb-button:not([disabled]).dnb-button--secondary.dnb-button__status--error { color: var(--color-fire-red); --border-color: var(--color-fire-red); --border-width: 0.0625rem; box-shadow: inset 0 0 0 var(--border-width) var(--border-color); border-color: transparent; } .dnb-button:not([disabled]).dnb-button--secondary.dnb-button__status--error .dnb-button__icon { color: inherit; } html:not([data-whatintent=touch]) .dnb-button--secondary:not(.dnb-button--has-text):hover[disabled] { cursor: not-allowed; } html:not([data-whatintent=touch]) .dnb-button--secondary:not(.dnb-button--has-text):hover:not([disabled]) { color: var(--color-emerald-green); background-color: var(--color-white); --border-color: var(--color-emerald-green); --border-width: 0.125rem; box-shadow: 0 0 0 var(--border-width) var(--border-color); border-color: transparent; } .dnb-button--secondary:not(.dnb-button--has-text):focus[disabled], html:not([data-whatintent=touch]) .dnb-button--secondary:not(.dnb-button--has-text):focus[disabled] { cursor: not-allowed; } html[data-whatinput=keyboard] .dnb-button--secondary:not(.dnb-button--has-text):focus:not([disabled]), html[data-whatinput=keyboard] html:not([data-whatintent=touch]) .dnb-button--secondary:not(.dnb-button--has-text):focus:not([disabled]) { color: var(--color-emerald-green); background-color: var(--color-white); } .dnb-button--secondary:not(.dnb-button--has-text):focus:not([disabled]), html:not([data-whatintent=touch]) .dnb-button--secondary:not(.dnb-button--has-text):focus:not([disabled]) { outline: none; } html[data-whatinput=keyboard] .dnb-button--secondary:not(.dnb-button--has-text):focus:not([disabled]), html[data-whatinput=keyboard] html:not([data-whatintent=touch]) .dnb-button--secondary:not(.dnb-button--has-text):focus:not([disabled]) { --border-color: var(--focus-ring-color); --border-width: var(--focus-ring-width); box-shadow: inset 0 0 0 var(--border-width) var(--border-color); border-color: transparent; } .dnb-button--secondary:not(.dnb-button--has-text):active[disabled], html:not([data-whatintent=touch]) .dnb-button--secondary:not(.dnb-button--has-text):active[disabled] { cursor: not-allowed; } .dnb-button--secondary:not(.dnb-button--has-text):active:not([disabled]), html:not([data-whatintent=touch]) .dnb-button--secondary:not(.dnb-button--has-text):active:not([disabled]) { color: var(--color-emerald-green); background-color: var(--color-mint-green-50); --border-color: transparent; --border-width: 0.0625rem; box-shadow: 0 0 0 var(--border-width) var(--border-color); border-color: transparent; } .dnb-button--secondary:not(.dnb-button--has-text):not(.dnb-button--input-button):not(.dnb-button--control-before):not(.dnb-button--control-after).dnb-button--size-large { width: calc(var(--button-width--large) - 0.5rem); line-height: calc(var(--button-height) - 0.5rem); } .dnb-button--secondary:not(.dnb-button--has-text).dnb-button--control-before, .dnb-button--secondary:not(.dnb-button--has-text).dnb-button--control-after { box-shadow: none; border: none; } html:not([data-whatintent=touch]) .dnb-button--secondary:not(.dnb-button--has-text).dnb-button--control-before:hover[disabled], html:not([data-whatintent=touch]) .dnb-button--secondary:not(.dnb-button--has-text).dnb-button--control-after:hover[disabled] { cursor: not-allowed; } html:not([data-whatintent=touch]) .dnb-button--secondary:not(.dnb-button--has-text).dnb-button--control-before:hover:not([disabled]), html:not([data-whatintent=touch]) .dnb-button--secondary:not(.dnb-button--has-text).dnb-button--control-after:hover:not([disabled]) { box-shadow: none; border: none; } .dnb-button--active { --border-color: var(--color-emerald-green); --border-width: 0.125rem; box-shadow: 0 0 0 var(--border-width) var(--border-color); border-color: transparent; } .dnb-button--tertiary { color: var(--color-sea-green); background-color: transparent; } html:not([data-whatintent=touch]) .dnb-button--tertiary:hover[disabled] { cursor: not-allowed; } html:not([data-whatintent=touch]) .dnb-button--tertiary:hover:not([disabled]) { color: var(--color-sea-green); } html:not([data-whatintent=touch]) .dnb-button--tertiary:hover:not([disabled]) .dnb-button__text::after { color: var(--color-emerald-green); } .dnb-button--tertiary:active[disabled], html:not([data-whatintent=touch]) .dnb-button--tertiary:active[disabled] { cursor: not-allowed; } .dnb-button--tertiary:active:not([disabled]), html:not([data-whatintent=touch]) .dnb-button--tertiary:active:not([disabled]) { color: var(--color-sea-green); } html[data-whatintent=touch] .dnb-button--tertiary:active:not([disabled]) .dnb-button__text::after, html[data-whatintent=touch] html:not([data-whatintent=touch]) .dnb-button--tertiary:active:not([disabled]) .dnb-button__text::after { color: var(--color-emerald-green); } html:not([data-whatintent=touch]) .dnb-button--tertiary:focus-visible[disabled] { cursor: not-allowed; } html:not([data-whatintent=touch]) .dnb-button--tertiary:focus-visible:not([disabled]) { color: var(--color-sea-green); } .dnb-button--tertiary.dnb-button--icon-position-top .dnb-button__text { font-size: var(--font-size-x-small); } .dnb-button--tertiary.dnb-button--icon-position-top.dnb-button--size-large .dnb-button__text { font-size: var(--font-size-small); } .dnb-button--tertiary[disabled] { color: var(--color-sea-green-30); } .dnb-button:not([disabled]).dnb-button--tertiary.dnb-button__status--error { color: var(--color-fire-red); } .dnb-button--signal { color: var(--color-ocean-green); background-color: var(--color-accent-yellow); } html:not([data-whatintent=touch]) .dnb-button--signal:hover[disabled] { cursor: not-allowed; } html:not([data-whatintent=touch]) .dnb-button--signal:hover:not([disabled]) { color: var(--color-ocean-green); background-color: var(--color-accent-yellow); --border-color: var(--color-ocean-green); --border-width: 0.125rem; box-shadow: 0 0 0 var(--border-width) var(--border-color); border-color: transparent; } html[data-whatintent=touch] .dnb-button--signal:active[disabled], html:not([data-whatintent=touch]) html[data-whatintent=touch] .dnb-button--signal:active[disabled] { cursor: not-allowed; } html[data-whatintent=touch] .dnb-button--signal:active:not([disabled]), html:not([data-whatintent=touch]) html[data-whatintent=touch] .dnb-button--signal:active:not([disabled]) { color: var(--color-ocean-green); background-color: var(--color-accent-yellow); --border-color: var(--color-ocean-green); --border-width: 0.125rem; box-shadow: 0 0 0 var(--border-width) var(--border-color); border-color: transparent; } .dnb-button--signal:focus[disabled], html:not([data-whatintent=touch]) .dnb-button--signal:focus[disabled] { cursor: not-allowed; } html[data-whatinput=keyboard] .dnb-button--signal:focus:not([disabled]), html[data-whatinput=keyboard] html:not([data-whatintent=touch]) .dnb-button--signal:focus:not([disabled]) { color: var(--color-ocean-green); background-color: var(--color-accent-yellow); } .dnb-button--signal:focus:not([disabled]), html:not([data-whatintent=touch]) .dnb-button--signal:focus:not([disabled]) { outline: none; } html[data-whatinput=keyboard] .dnb-button--signal:focus:not([disabled]), html[data-whatinput=keyboard] html:not([data-whatintent=touch]) .dnb-button--signal:focus:not([disabled]) { --border-color: var(--focus-ring-color); --border-width: var(--focus-ring-width); box-shadow: inset 0 0 0 var(--border-width) var(--border-color); border-color: transparent; } .dnb-button--signal:active[disabled], html:not([data-whatintent=touch]) .dnb-button--signal:active[disabled] { cursor: not-allowed; } .dnb-button--signal:active:not([disabled]), html:not([data-whatintent=touch]) .dnb-button--signal:active:not([disabled]) { color: var(--color-ocean-green); background-color: var(--color-accent-yellow); --border-color: transparent; --border-width: 0.0625rem; box-shadow: 0 0 0 var(--border-width) var(--border-color); border-color: transparent; } .dnb-button--signal[disabled] { color: var(--color-black-20); background-color: var(--color-accent-yellow-30); } .dnb-button--input-button.dnb-button--secondary:not(.dnb-button--has-text):not([disabled]) { background-color: transparent; box-shadow: none; } .dnb-button--input-button.dnb-button--secondary:not(.dnb-button--has-text):not([disabled])::after { content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: var(--input-border-width); background-color: currentcolor; } html:not([data-whatintent=touch]) .dnb-button--input-button.dnb-button--secondary:not(.dnb-button--has-text):not([disabled]):focus-visible, html:not([data-whatintent=touch]) .dnb-button--input-button.dnb-button--secondary:not(.dnb-button--has-text):not([disabled]):hover { color: var(--color-white); } html:not([data-whatintent=touch]) .dnb-button--input-button.dnb-button--secondary:not(.dnb-button--has-text):not([disabled]):focus-visible, html:not([data-whatintent=touch]) .dnb-button--input-button.dnb-button--secondary:not(.dnb-button--has-text):not([disabled]):focus-visible::after, html:not([data-whatintent=touch]) .dnb-button--input-button.dnb-button--secondary:not(.dnb-button--has-text):not([disabled]):hover, html:not([data-whatintent=touch]) .dnb-button--input-button.dnb-button--secondary:not(.dnb-button--has-text):not([disabled]):hover::after { background-color: var(--color-sea-green); } html:not([data-whatintent=touch]) .dnb-button--input-button.dnb-button--secondary:not(.dnb-button--has-text):not([disabled]):focus-visible, html:not([data-whatintent=touch]) .dnb-button--input-button.dnb-button--secondary:not(.dnb-button--has-text):not([disabled]):hover { box-shadow: none; } html:not([data-whatintent=touch]) .dnb-button--input-button.dnb-button--secondary:not(.dnb-button--has-text):not([disabled]):active { color: var(--color-sea-green); } html:not([data-whatintent=touch]) .dnb-button--input-button.dnb-button--secondary:not(.dnb-button--has-text):not([disabled]):active, html:not([data-whatintent=touch]) .dnb-button--input-button.dnb-button--secondary:not(.dnb-button--has-text):not([disabled]):active::after { background-color: var(--color-mint-green-50); } html:not([data-whatintent=touch]) .dnb-button--input-button.dnb-button--secondary:not(.dnb-button--has-text):not([disabled]):active::after { top: var(--input-border-width); bottom: var(--input-border-width); } html:not([data-whatintent=touch]) .dnb-button--input-button.dnb-button--secondary:not(.dnb-button--has-text)[disabled] { color: var(--color-black-55); background-color: var(--color-black-3); --border-color: var(--color-black-55); --border-width: var(--input-border-width); box-shadow: inset 0 0 0 var(--border-width) var(--border-color); border-color: transparent; }