UNPKG

@esri/calcite-components

Version:

Web Components for Esri's Calcite Design System.

346 lines (290 loc) • 7.07 kB
/* mixins & extensions */ @keyframes in { 0% { opacity: 0; } 100% { opacity: 1; } } @keyframes in-down { 0% { opacity: 0; transform: translate3D(0, -5px, 0); } 100% { opacity: 1; transform: translate3D(0, 0, 0); } } @keyframes in-up { 0% { opacity: 0; transform: translate3D(0, 5px, 0); } 100% { opacity: 1; transform: translate3D(0, 0, 0); } } @keyframes in-scale { 0% { opacity: 0; transform: scale3D(0.95, 0.95, 1); } 100% { opacity: 1; transform: scale3D(1, 1, 1); } } /** * Currently only used in Checkbox. */ :host { /* Base ":host" styles for the component */ box-sizing: border-box; background-color: var(--calcite-ui-foreground-1); color: var(--calcite-ui-text-2); font-size: var(--calcite-font-size--1); } :host * { box-sizing: border-box; } :root { --calcite-popper-transition: 150ms ease-in-out; } :host([hidden]) { display: none; } :host { display: flex; background-color: transparent; } :host([disabled]) { pointer-events: none; } .button { background-color: var(--calcite-ui-foreground-1); border-style: none; cursor: pointer; fill: var(--calcite-ui-text-3); display: flex; outline-offset: 0; outline-color: transparent; transition: outline-offset 100ms ease-in-out, outline-color 100ms ease-in-out; align-items: center; justify-content: flex-start; margin: 0; position: relative; font-size: var(--calcite-font-size--2); line-height: 1rem; color: var(--calcite-ui-text-3); font-family: inherit; width: auto; text-align: unset; } .button:hover { background-color: var(--calcite-ui-foreground-2); color: var(--calcite-ui-text-1); fill: var(--calcite-ui-text-1); } .button:focus { background-color: var(--calcite-ui-foreground-2); color: var(--calcite-ui-text-1); fill: var(--calcite-ui-text-1); outline: 2px solid var(--calcite-ui-brand); outline-offset: -2px; } .button:active { background-color: var(--calcite-ui-foreground-3); } .button .icon-container { display: flex; align-items: center; justify-content: center; margin: 0; pointer-events: none; min-width: 1rem; min-height: 1rem; } .button .text-container { line-height: 1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin: 0; width: 0; opacity: 0; transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); transition-duration: 150ms; transition-property: opacity; transition-property: margin; transition-property: width; } .button .text-container--visible { flex: 1 1 auto; opacity: 1; width: auto; } :host([scale=s]) .button { padding: 0.5rem; } :host([scale=m]) .button { padding: 1rem; } :host([scale=l]) .button { padding: 1.25rem; font-size: var(--calcite-font-size--1); line-height: 1rem; } :host([alignment=center]) .button { justify-content: center; width: 100%; } :host([alignment=end]) .button { justify-content: flex-end; } :host([alignment=end]) .button .text-container--visible { flex: 0 1 auto; } :host([scale=s][compact]) .button, :host([scale=m][compact]) .button, :host([scale=l][compact]) .button { padding-left: 0; padding-right: 0; } .slot-container { display: flex; } .slot-container--hidden { display: none; } .button--text-visible { width: 100%; } .button--text-visible .icon-container { margin: 0; margin-right: 0.5rem; } .button--text-visible .text-container--visible { margin: 0; margin-right: 0.5rem; } .button--text-visible.calcite--rtl .icon-container { margin: 0; margin-left: 0.5rem; } .button--text-visible.calcite--rtl .text-container--visible { margin: 0; margin-left: 0.5rem; } :host([active]) .button, :host([active]) .button:hover, :host([active]) .button:focus, :host([active][loading]) .button { color: var(--calcite-ui-text-1); fill: var(--calcite-ui-text-1); background-color: var(--calcite-ui-foreground-3); } :host([appearance=clear]) .button { background-color: transparent; transition-property: box-shadow; transition-duration: 150ms; transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); } :host([appearance=clear]) .button:hover, :host([appearance=clear]) .button:focus { background-color: transparent; box-shadow: 0 0 0 2px var(--calcite-ui-border-1) inset; } :host([active][appearance=clear]) .button, :host([active][appearance=clear]) .button:hover, :host([active][appearance=clear]) .button:focus { color: var(--calcite-ui-text-1); fill: var(--calcite-ui-text-1); background-color: var(--calcite-ui-foreground-3); } :host([appearance=clear][loading]) .button, :host([appearance=clear][disabled]) .button { background-color: transparent; } :host([loading]) .button, :host([loading]) .button:hover, :host([loading]) .button:focus { background-color: var(--calcite-ui-foreground-1); } :host([loading]) .button .text-container, :host([loading]) .button:hover .text-container, :host([loading]) .button:focus .text-container { opacity: var(--calcite-ui-opacity-disabled); } :host([loading]) calcite-loader[inline] { margin-right: 0; color: var(--calcite-ui-text-3); } :host([disabled]) .button, :host([disabled]) .button:hover, :host([disabled]) .button:focus { cursor: default; opacity: var(--calcite-ui-opacity-disabled); background-color: var(--calcite-ui-foreground-1); } :host([disabled][active]) .button, :host([disabled][active]) .button:hover, :host([disabled][active]) .button:focus { opacity: var(--calcite-ui-opacity-disabled); background-color: var(--calcite-ui-foreground-3); } :host([indicator]) .button--text-visible, :host([indicator][scale=s]) .button--text-visible, :host([indicator][scale=l]) .button--text-visible { padding-right: 1rem; } :host([indicator]) .button::after { content: ""; position: absolute; border-width: 2px; background-color: var(--calcite-ui-brand); border-radius: 9999px; height: 0.5rem; width: 0.5rem; z-index: 10; border-color: var(--calcite-ui-foreground-1); bottom: 0.5rem; right: 0.5rem; } :host([indicator][scale=s]) .button::after { bottom: 0.25rem; right: 0.25rem; } :host([indicator][scale=l]) .button::after { bottom: 0.5rem; right: 0.5rem; } :host([indicator]) .calcite--rtl::after { right: auto; left: 0.25rem; } :host([indicator]) .button--text-visible.calcite--rtl { padding-right: 0.75rem; padding-left: 1rem; } :host([indicator]) .button:hover::after, :host([indicator]) .button:focus::after { border-color: var(--calcite-ui-foreground-1); } :host([indicator][active]) .button::after { border-color: var(--calcite-ui-foreground-3); } :host([indicator]) .button--text-visible::after, :host([indicator][scale=s]) .button--text-visible::after, :host([indicator][scale=l]) .button--text-visible::after { bottom: auto; right: 0.5rem; } :host([indicator]) .button--text-visible.calcite--rtl::after, :host([indicator][scale=s]) .button--text-visible.calcite--rtl::after, :host([indicator][scale=l]) .button--text-visible.calcite--rtl::after { right: auto; left: 0.5rem; }