@freshworks/crayons
Version:
Crayons Web Components library
325 lines (296 loc) • 7.58 kB
CSS
/* Need to check with designer */
/* Need to check with designer */
:host {
font-family: var(--fw-font-family, -apple-system, blinkmacsystemfont, "Segoe UI", roboto, oxygen, ubuntu, cantarell, "Open Sans", "Helvetica Neue", sans-serif);
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
box-sizing: border-box;
}
/**
@prop --fw-button-min-width: minimum width for the button
@prop --fw-button-label-vertical-padding: vertical padding for the button label
*/
@media screen and (prefers-reduced-motion: reduce) {
.fw-btn,
.fw-btn--label,
.fw-btn--loader {
transition: none;
}
}
:host {
display: inline-block;
width: auto;
cursor: pointer;
}
.fw-btn {
display: inline-flex;
align-content: center;
align-items: stretch;
justify-content: center;
width: 100%;
border-style: solid;
border-width: 1px;
font-weight: 600;
font-family: inherit;
text-decoration: none;
user-select: none;
white-space: nowrap;
vertical-align: middle;
padding: 0;
cursor: inherit;
letter-spacing: 0;
outline: 0;
border-radius: 4px;
--fw-icon-color: currentColor;
}
.fw-btn .fw-btn--label {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
display: flex;
align-items: center;
}
.fw-btn:active:not(.fw-btn--loading) {
box-shadow: inset 0 0 4px 0 rgba(0, 0, 0, 0.25);
}
.fw-btn:focus {
border: 1px solid #2c5cc5;
box-shadow: 0 0 0 1px #2c5cc5;
}
.fw-btn.disabled, .fw-btn[disabled] {
cursor: not-allowed;
}
.fw-btn--primary {
background-color: #264966;
color: #fff;
border-color: #12344d;
background-image: linear-gradient(to bottom, #264966, #12344d);
}
.fw-btn--primary:active {
border-color: #264966;
}
.fw-btn--primary:focus:not([disabled]), .fw-btn--primary:hover:not([disabled]) {
background-color: #12344d;
background-image: none;
}
.fw-btn--primary.disabled, .fw-btn--primary[disabled] {
background-image: linear-gradient(to bottom, #92a2b1, #7b8e9f);
border-color: #7b8e9f;
color: rgba(255, 255, 255, 0.5);
}
.fw-btn--secondary {
background-color: #f5f7f9;
color: #12344d;
border-color: #cfd7df;
background-image: linear-gradient(to bottom, #fff, #f5f7f9);
}
.fw-btn--secondary:active {
border-color: #ebeff3;
}
.fw-btn--secondary:focus:not([disabled]), .fw-btn--secondary:hover:not([disabled]) {
background-color: #f5f7f9;
background-image: none;
}
.fw-btn--secondary.disabled, .fw-btn--secondary[disabled] {
background: #ebeff3;
border-color: #cfd7df;
color: #92a2b1;
}
.fw-btn--danger {
color: #fff;
background-color: #d72d30;
border-color: #c82124;
background-image: linear-gradient(to bottom, #d72d30, #c82124);
}
.fw-btn--danger:focus:not([disabled]), .fw-btn--danger:hover:not([disabled]) {
background-color: #c82124;
background-image: none;
}
.fw-btn--danger.disabled, .fw-btn--danger[disabled] {
background-image: linear-gradient(to bottom, #f89fa1, #f2797b);
border-color: #f2797b;
color: rgba(255, 255, 255, 0.5);
}
.fw-btn--link {
background-color: transparent;
background-image: none;
border: 1px solid transparent;
color: #2c5cc5;
}
.fw-btn--text {
background-color: transparent;
background-image: none;
border: 1px solid transparent;
color: #264966;
}
.fw-btn--text:focus:not([disabled]), .fw-btn--text:hover:not([disabled]) {
background-color: #ebeff3;
}
.fw-btn--text:focus:not([disabled]), .fw-btn--text:hover:not([disabled]), .fw-btn--link:focus:not([disabled]), .fw-btn--link:hover:not([disabled]) {
border-color: #2c5cc5;
box-shadow: 0 0 0 1px #2c5cc5;
}
.fw-btn--text.disabled, .fw-btn--text[disabled], .fw-btn--link.disabled, .fw-btn--link[disabled] {
opacity: 0.5;
}
.fw-btn--mini {
height: 16px;
line-height: calc(16px - 1px * 2);
}
.fw-btn--mini .fw-btn--label {
font-size: 10px;
}
.fw-btn--mini fw-spinner {
transform: scale(0.5);
}
.fw-btn--small {
height: 24px;
line-height: calc(24px - 1px * 2);
}
.fw-btn--small .fw-btn--label {
font-size: 12px;
}
.fw-btn--small fw-spinner {
transform: scale(0.75);
}
.fw-btn--normal {
min-width: var(--fw-button-min-width, 80px);
height: 32px;
line-height: calc(32px - 1px * 2);
}
.fw-btn--icon {
min-width: 32px;
width: 32px;
height: 32px;
padding: 0;
line-height: calc(32px - 1px * 2);
}
.fw-btn--icon-small {
min-width: 24px;
width: 24px;
height: 22px;
padding: 0;
line-height: calc(22px - 1px * 2);
}
.fw-btn--before,
.fw-btn--after,
.fw-btn--caret {
flex: 0 0 auto;
display: flex;
align-items: center;
}
.fw-btn--normal ::slotted(fw-icon) {
--fw-icon-size: 12px;
}
.fw-btn--small ::slotted(fw-icon) {
--fw-icon-size: 10px;
}
.fw-btn--mini ::slotted(fw-icon) {
--fw-icon-size: 8px;
}
.fw-btn--has-label.fw-btn--normal .fw-btn--label {
padding: 0 var(--fw-button-label-vertical-padding, 12px);
}
.fw-btn--has-before.fw-btn--normal {
padding-left: 8px;
}
.fw-btn--has-before.fw-btn--normal .fw-btn--label {
padding-left: 8px;
}
.fw-btn--has-after.fw-btn--normal,
.fw-btn--caret.fw-btn--normal {
padding-right: 8px;
}
.fw-btn--has-after.fw-btn--normal .fw-btn--label,
.fw-btn--caret.fw-btn--normal .fw-btn--label {
padding-right: 8px;
}
.fw-btn--has-label.fw-btn--small .fw-btn--label {
padding: 0 var(--fw-button-label-vertical-padding, 8px);
}
.fw-btn--has-before.fw-btn--small {
padding-left: 6px;
}
.fw-btn--has-before.fw-btn--small .fw-btn--label {
padding-left: 6px;
}
.fw-btn--has-after.fw-btn--small,
.fw-btn--caret.fw-btn--small {
padding-right: 6px;
}
.fw-btn--has-after.fw-btn--small .fw-btn--label,
.fw-btn--caret.fw-btn--small .fw-btn--label {
padding-right: 6px;
}
.fw-btn--has-label.fw-btn--mini .fw-btn--label {
padding: 0 var(--fw-button-label-vertical-padding, 6px);
}
.fw-btn--has-before.fw-btn--mini {
padding-left: 4px;
}
.fw-btn--has-before.fw-btn--mini .fw-btn--label {
padding-left: 4px;
}
.fw-btn--has-after.fw-btn--mini,
.fw-btn--caret.fw-btn--mini {
padding-right: 4px;
}
.fw-btn--has-after.fw-btn--mini .fw-btn--label,
.fw-btn--caret.fw-btn--mini .fw-btn--label {
padding-right: 4px;
}
.fw-btn--caret fw-icon {
--fw-icon-size: 9px;
}
.fw-btn--caret.fw-btn--mini fw-icon {
--fw-icon-size: 6px;
}
.fw-btn--loading {
position: relative;
cursor: wait;
}
.fw-btn--loading .fw-btn--label,
.fw-btn--loading .fw-btn--before,
.fw-btn--loading .fw-btn--after,
.fw-btn--loading .fw-btn--caret {
opacity: 0;
}
.fw-btn--loading .fw-btn--loader {
--fw-spinner-color: currentColor;
opacity: 1;
line-height: 0;
}
.fw-btn--label,
.fw-btn--loader {
transition: opacity 0.3s ease-out;
}
.fw-btn--loader {
opacity: 0;
position: absolute;
font-size: 1em;
height: 1em;
width: 1em;
top: calc(50% - 0.5em);
left: calc(50% - 0.5em);
margin-top: -1px;
margin-left: -1px;
}
/*
* Button groups support a variety of button types (e.g. buttons with tooltips, buttons as dropdown triggers, etc.).
* This means buttons aren't always direct descendants of the button group, thus we can't target them with the
* ::slotted selector. To work around this, the button group component does some magic to add these special classes to
* buttons and we style them here instead.
*/
:host(.fw-button-group__button--first:not(.fw-button-group__button--last)) .fw-btn {
border-top-right-radius: 0;
border-bottom-right-radius: 0;
}
:host(.fw-button-group__button--inner) .fw-btn {
border-radius: 0;
border-left: 0;
}
:host(.fw-button-group__button--last:not(.fw-button-group__button--first)) .fw-btn {
border-top-left-radius: 0;
border-bottom-left-radius: 0;
border-left: 0;
}