tntd
Version:
tntd是基于 TNT Design 设计体系的 React UI 组件库,主要用于研发企业级中后台产品。
153 lines (135 loc) • 3.47 kB
text/less
.tntd-segmented {
box-sizing: border-box;
margin: 0;
font-size: 14px;
line-height: 1.5715;
list-style: none;
display: inline-block;
padding: 2px;
color: #17233D;
text-overflow: ellipsis;
// background-color: rgba(0,0,0,.04);
// border-radius: 2px;
border-radius: var(---, 8px);
background: var(---, #F8F9FB);
transition: all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
font-family: initial;
font-weight: 400;
.tntd-segmented-group {
position: relative;
display: flex;
align-items: stretch;
justify-items: flex-start;
width: 100%;
}
// item styles
.tntd-segmented-item {
position: relative;
text-align: center;
cursor: pointer;
transition: color 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
border-radius: var(---, 8px);
&-selected {
background-color: #fff;
border-radius: var(---, 8px);
box-shadow: 0 2px 8px -2px rgba(0,0,0,.05), 0 1px 4px -1px rgba(0,0,0,.07),
0 0 1px rgba(0,0,0,.08);
color: #262626;
position: relative;
z-index: 20;
}
&:hover:not(&-selected),
&:focus:not(&-selected) {
background: var(---, #E9EDF3);
}
&:active:not(&-selected) {
background: var(---300, #E1E6EE);
}
&-label {
min-height: 28px;
padding: 0 12px;
line-height: 28px;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
word-break: keep-all;
}
// syntactic sugar to add `icon` for Segmented Item
&-icon + * {
margin-left: 6px;
}
&-input {
position: absolute;
top: 0;
left: 0;
width: 0;
height: 0;
opacity: 0;
pointer-events: none;
}
}
// disabled styles
.tntd-segmented-item-disabled {
&,
&:hover,
&:focus {
cursor: not-allowed;
background-color: transparent ;
color: #BABDC5;
}
}
// thumb styles
.tntd-segmented-thumb {
background-color: #fff;
border-radius: var(---, 8px);
box-shadow: 0 2px 8px -2px rgba(0,0,0,.05), 0 1px 4px -1px rgba(0,0,0,.07),
0 0 1px rgba(0,0,0,.08);
position: absolute;
inset-block-start: 0;
inset-inline-start: 0;
top: 0;
left: 0;
width: 0;
height: 100%;
padding: 4px 0;
~.tntd-segmented-item:not(.tntd-segmented-item-selected):not(.tntd-segmented-item-disabled) {
background-color: transparent;
}
}
// transition effect when `appear-active`
.tntd-segmented-thumb-motion-appear-active {
transition: transform 0.3s cubic-bezier(0.645, 0.045, 0.355, 1), width 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
transition-property: all ;
will-change: transform, width;
}
// hover/focus styles
// &:not(&-disabled) {
// &:hover,
// &:focus {
// background-color: rgba(0,0,0,.06);
// }
// }
}
.tntd-segmented-block {
display: flex;
.tntd-segmented-item {
flex: 1;
min-width: 0;
}
}
// size styles
.tntd-segmented-lg {
.tntd-segmented-item-label {
min-height: 36px;
padding: 0 12px;
font-size: 16px;
line-height: 36px;
}
}
.tntd-segmented-sm {
.tntd-segmented-item-label {
min-height: 22px;
line-height: 22px;
padding: 0 7px;
}
}