@roadtrip/css
Version:
CSS framework for Roadtrip Design System
149 lines (121 loc) • 2.51 kB
CSS
/*
* Chip
*
* Index
* - Outline
* - Icon
* - Close
* - Size
* - Color
*/
.chip {
box-sizing: border-box;
display: inline-flex;
align-items: center;
height: 1.5rem;
padding: 0.25rem 1rem;
margin-bottom: 0.5rem;
font-size: var(--road-font-size-14);
cursor: pointer;
border: 0;
border-radius: 1.625rem;
outline: 0;
transition: background 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms, border 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
}
/* OUTLINE
-------------------- */
.chip-outline {
border-style: solid;
border-width: 1px;
}
/* ICON
-------------------- */
.chip-icon {
width: 1.25rem;
height: 1.25rem;
margin-right: 0.5rem;
margin-left: -0.5rem;
fill: var(--road-icon);
}
/* CLOSE
-------------------- */
.chip-close {
width: 1rem;
height: 1rem;
margin-right: -0.75rem;
margin-left: 0.5rem;
background: var(--road-on-surface-weak);
border-radius: 50%;
transition: background 250ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
fill: var(--road-surface);
}
.chip-outline.chip-inverse .chip-close {
background: var(--road-surface);
fill: var(--road-icon);
}
/* SIZE
-------------------- */
.chip-lg {
height: 2.5rem;
padding: 0 1.5rem;
font-size: var(--road-font-size-16);
}
.chip-lg .chip-icon {
width: 1.5rem;
height: 1.5rem;
margin-right: 0.75rem;
margin-left: -0.75rem;
}
.chip-lg .chip-close {
width: 1.5rem;
height: 1.5rem;
margin-right: -1rem;
margin-left: 0.75rem;
}
/* COLOR
-------------------- */
.chip-default {
color: var(--road-on-surface);
background: var(--road-grey-200);
}
.chip-outline.chip-default {
background: var(--road-surface);
border-color: var(--road-input-outline);
}
.chip-outline.chip-inverse {
color: var(--road-on-primary);
background: none;
border-color: var(--road-on-primary);
}
.chip-secondary {
color: var(--road-surface-inverse);
background: var(--road-button-primary);
border-color: transparent;
}
.chip-secondary .chip-close {
background: var(--road-surface);
fill: var(--road-icon);
}
/**
* Hover state
*/
@media (any-hover: hover) {
.chip-outline:hover {
border-color: var(--road-outline-variant);
}
.chip-secondary:hover {
background: var(--road-button-primary-variant);
}
.chip-secondary:hover .chip-close {
color: var(--road-icon);
}
}
/**
* Focus state
*/
.chip-outline:hover {
border-color: var(--road-outline-variant);
}
.chip-secondary.focus-visible {
background: var(--road-button-primary-variant);
}