ant-design/components/segmented/style/index.less
vagusX ae4e660a05
feat: add new component Segmented (#34319)
* feat: basic implements in antd

* feat: use rc-segmented

* feat: add some demos

* feat: support dark theme

* docs: add more demos

* feat: support `icon` in segmented

* docs: format content

* test: add test cases

* docs: update docs

* chore: update

* fix: lint issues

* style: add border-radius for selected effect

* style: change border-radius-base

* chore: update gitignore

* feat: segmented support block

* chore: update gitignore

* feat: support block

* feat: add test case

* feat: support size

* docs: update demos

* chore: update

* chore: update

* test: update

* style: update colors

* style: hover and focus styles

* doc: add version mark in docs

* fix: style lint issue

* fix: some lint issues

* doc: add version in demo mds

* doc: add version mark before api details

* Revert "doc: add version in demo mds"

This reverts commit 2a9e86f6ffc2331f7d73eae6edac7c889358a838.

* test: only test for thumb appear

* style: update color vars

* style: add transition

* style: text vertial align

* test: update snapshots

* feat: add preview svg and support dark theme

* fix: update test snapshot

* docs: update docs

* fix: remove useless z-index

* build: add 1kb for bundlesize of antd.variable.min.css

Co-authored-by: taian.lta <taian.lta@antgroup.com>
2022-04-11 11:13:16 +08:00

117 lines
2.4 KiB
Plaintext

@import '../../style/themes/index';
@import '../../style/mixins/index';
@import './mixins.less';
@segmented-prefix-cls: ~'@{ant-prefix}-segmented';
.@{segmented-prefix-cls} {
.reset-component();
position: relative;
display: inline-flex;
align-items: stretch;
justify-items: flex-start;
color: @segmented-label-color;
background-color: @segmented-bg;
border-radius: 2px;
box-shadow: 0 0 0 2px @segmented-bg;
transition: all 0.3s @ease-in-out;
// hover/focus styles
&:not(&-disabled) {
&:hover,
&:focus {
background-color: @segmented-hover-bg;
box-shadow: 0 0 0 2px @segmented-hover-bg;
}
}
// block styles
&&-block {
display: flex;
}
&&-block &-item {
flex: 1;
min-width: 0;
}
// item styles
&-item {
position: relative;
text-align: center;
cursor: pointer;
transition: color 0.3s @ease-in-out;
&-selected {
.segmented-item-selected();
color: @segmented-label-hover-color;
}
&:hover,
&:focus {
color: @segmented-label-hover-color;
}
&-label {
min-height: @input-height-base;
padding: @input-padding-vertical-base @input-padding-horizontal-base;
line-height: @input-height-base - @input-padding-vertical-base * 2;
.segmented-text-ellipsis();
}
// syntactic sugar to add `icon` for Segmented Item
&-icon {
margin-right: 6px;
}
&-input {
position: absolute;
top: 0;
left: 0;
width: 0;
height: 0;
opacity: 0;
pointer-events: none;
}
}
// size styles
&&-lg &-item-label {
min-height: @input-height-lg;
padding: @input-padding-vertical-lg @input-padding-horizontal-lg;
font-size: @font-size-lg;
line-height: @input-height-lg - @input-padding-vertical-lg * 2;
}
&&-sm &-item-label {
min-height: @input-height-sm;
padding: @input-padding-vertical-sm @input-padding-horizontal-sm;
line-height: @input-height-sm - @input-padding-vertical-sm * 2;
}
// disabled styles
&-disabled &-item,
&-item-disabled {
.segmented-disabled-item();
}
// thumb styles
&-thumb {
.segmented-item-selected();
position: absolute;
top: 0;
left: 0;
width: 0;
height: 100%;
padding: 4px 0;
}
// transition effect when `enter-active`
&-thumb-motion-enter-active {
transition: transform 0.3s @ease-in-out, width 0.3s @ease-in-out;
will-change: transform, width;
}
}