UNPKG

@stories-js/core

Version:

Stories web components to build stories

297 lines (267 loc) 7.75 kB
:host { /** * @prop --background: Background of the button * @prop --background-activated: Background of the button when pressed. Note: setting this will interfere with the Material Design ripple. * @prop --background-activated-opacity: Opacity of the button when pressed * @prop --background-focused: Background of the button when focused with the tab key * @prop --background-focused-opacity: Opacity of the button when focused with the tab key * @prop --background-hover: Background of the button on hover * @prop --background-hover-opacity: Opacity of the background on hover * * @prop --color: Text color of the button * @prop --color-activated: Text color of the button when pressed * @prop --color-focused: Text color of the button when focused with the tab key * @prop --color-hover: Text color of the button when hover * * @prop --transition: Transition of the button * * @prop --border-radius: Border radius of the button * @prop --border-width: Border width of the button * @prop --border-style: Border style of the button * @prop --border-color: Border color of the button * * @prop --ripple-color: Color of the button ripple effect * * @prop --box-shadow: Box shadow of the button * @prop --opacity: Opacity of the button * * @prop --padding-top: Top padding of the button * @prop --padding-end: Right padding if direction is left-to-right, and left padding if direction is right-to-left of the button * @prop --padding-bottom: Bottom padding of the button * @prop --padding-start: Left padding if direction is left-to-right, and right padding if direction is right-to-left of the button */ --overflow: hidden; --ripple-color: currentColor; --border-width: initial; --border-color: initial; --border-style: initial; --color-activated: var(--color); --color-focused: var(--color); --color-hover: var(--color); --box-shadow: none; display: inline-block; width: auto; color: var(--color); font-family: var(--stories-font-family, inherit); text-align: center; text-decoration: none; text-overflow: ellipsis; white-space: nowrap; user-select: none; vertical-align: top; vertical-align: -webkit-baseline-middle; font-kerning: none; } :host(.button-disabled) { cursor: default; opacity: 0.5; pointer-events: none; } :host(.button-solid) { --background: var(--stories-color-primary, #3880ff); --color: var(--stories-color-primary-contrast, #fff); } :host(.button-outline) { --border-color: var(--stories-color-primary, #3880ff); --background: transparent; --color: var(--stories-color-primary, #3880ff); } :host(.button-clear) { --border-width: 0; --background: transparent; --color: var(--stories-color-primary, #3880ff); } :host(.button-block) { display: block; } :host(.button-block) .button-native { margin-left: 0; margin-right: 0; display: block; width: 100%; clear: both; contain: content; } :host(.button-block) .button-native::after { clear: both; } :host(.button-full) { display: block; } :host(.button-full) .button-native { margin-left: 0; margin-right: 0; display: block; width: 100%; contain: content; } :host(.button-full:not(.button-round)) .button-native { border-radius: 0; border-right-width: 0; border-left-width: 0; } .button-native { border-radius: var(--border-radius); -moz-osx-font-smoothing: grayscale; -webkit-font-smoothing: antialiased; margin-left: 0; margin-right: 0; margin-top: 0; margin-bottom: 0; padding-left: var(--padding-start); padding-right: var(--padding-end); padding-top: var(--padding-top); padding-bottom: var(--padding-bottom); font-family: inherit; font-size: inherit; font-style: inherit; font-weight: inherit; letter-spacing: inherit; text-decoration: inherit; text-indent: inherit; text-overflow: inherit; text-transform: inherit; text-align: inherit; white-space: inherit; color: inherit; display: block; position: relative; width: 100%; height: 100%; transition: var(--transition); border-width: var(--border-width); border-style: var(--border-style); border-color: var(--border-color); outline: none; background: var(--background); line-height: 1; box-shadow: var(--box-shadow); contain: layout style; cursor: pointer; opacity: var(--opacity); overflow: var(--overflow); z-index: 0; box-sizing: border-box; appearance: none; } @supports (margin-inline-start: 0) or (-webkit-margin-start: 0) { .button-native { padding-left: unset; padding-right: unset; -webkit-padding-start: var(--padding-start); padding-inline-start: var(--padding-start); -webkit-padding-end: var(--padding-end); padding-inline-end: var(--padding-end); } } .button-native::-moz-focus-inner { border: 0; } .button-inner { display: flex; position: relative; flex-flow: row nowrap; flex-shrink: 0; align-items: center; justify-content: center; width: 100%; height: 100%; z-index: 1; } ::slotted(stories-icon) { font-size: 1.4em; pointer-events: none; } ::slotted(stories-icon[slot=start]) { margin-left: -0.3em; margin-right: 0.3em; margin-top: 0; margin-bottom: 0; } @supports (margin-inline-start: 0) or (-webkit-margin-start: 0) { ::slotted(stories-icon[slot=start]) { margin-left: unset; margin-right: unset; -webkit-margin-start: -0.3em; margin-inline-start: -0.3em; -webkit-margin-end: 0.3em; margin-inline-end: 0.3em; } } ::slotted(stories-icon[slot=end]) { margin-left: 0.3em; margin-right: -0.2em; margin-top: 0; margin-bottom: 0; } @supports (margin-inline-start: 0) or (-webkit-margin-start: 0) { ::slotted(stories-icon[slot=end]) { margin-left: unset; margin-right: unset; -webkit-margin-start: 0.3em; margin-inline-start: 0.3em; -webkit-margin-end: -0.2em; margin-inline-end: -0.2em; } } ::slotted(stories-icon[slot=icon-only]) { font-size: 1.8em; } stories-ripple-effect { color: var(--ripple-color); } .button-native::after { left: 0; right: 0; top: 0; bottom: 0; position: absolute; content: ""; opacity: 0; } :host(.stories-activated) { color: var(--color-activated); } :host(.stories-activated) .button-native::after { background: var(--background-activated); opacity: var(--background-activated-opacity); } :host(.stories-focused) { color: var(--color-focused); } :host(.stories-focused) .button-native::after { background: var(--background-focused); opacity: var(--background-focused-opacity); } @media (any-hover: hover) { :host(:hover) { color: var(--color-hover); } :host(:hover) .button-native::after { background: var(--background-hover); opacity: var(--background-hover-opacity); } } :host(.button-solid.stories-color) .button-native { background: var(--stories-color-base); color: var(--stories-color-contrast); } :host(.button-outline.stories-color) .button-native { border-color: var(--stories-color-base); background: transparent; color: var(--stories-color-base); } :host(.button-clear.stories-color) .button-native { background: transparent; color: var(--stories-color-base); } :host(.in-toolbar:not(.stories-color):not(.in-toolbar-color)) .button-native { color: var(--stories-toolbar-color, var(--color)); } :host(.button-outline.in-toolbar:not(.stories-color):not(.in-toolbar-color)) .button-native { border-color: var(--stories-toolbar-color, var(--color, var(--border-color))); } :host(.button-solid.in-toolbar:not(.stories-color):not(.in-toolbar-color)) .button-native { background: var(--stories-toolbar-color, var(--background)); color: var(--stories-toolbar-background, var(--color)); }