index.less 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. @import '../../style/themes/index';
  2. @import '../../style/mixins/index';
  3. @import './mixins.less';
  4. @segmented-prefix-cls: ~'@{ant-prefix}-segmented';
  5. @segmented-container-padding: 2px;
  6. .@{segmented-prefix-cls} {
  7. .reset-component();
  8. display: inline-block;
  9. padding: @segmented-container-padding;
  10. color: @segmented-label-color;
  11. background-color: @segmented-bg;
  12. border-radius: @border-radius-base;
  13. transition: all 0.3s @ease-in-out;
  14. &-group {
  15. position: relative;
  16. display: flex;
  17. align-items: stretch;
  18. justify-items: flex-start;
  19. width: 100%;
  20. }
  21. // block styles
  22. &&-block {
  23. display: flex;
  24. }
  25. &&-block &-item {
  26. flex: 1;
  27. min-width: 0;
  28. }
  29. // hover/focus styles
  30. &:not(&-disabled) {
  31. &:hover,
  32. &:focus {
  33. background-color: @segmented-hover-bg;
  34. }
  35. }
  36. // item styles
  37. &-item {
  38. position: relative;
  39. text-align: center;
  40. cursor: pointer;
  41. transition: color 0.3s @ease-in-out;
  42. &-selected {
  43. .segmented-item-selected();
  44. color: @segmented-label-hover-color;
  45. }
  46. &:hover,
  47. &:focus {
  48. color: @segmented-label-hover-color;
  49. }
  50. &-label {
  51. min-height: @input-height-base - @segmented-container-padding * 2;
  52. padding: 0 @input-padding-horizontal-base;
  53. line-height: @input-height-base - @segmented-container-padding * 2;
  54. .segmented-text-ellipsis();
  55. }
  56. // syntactic sugar to add `icon` for Segmented Item
  57. &-icon + * {
  58. margin-left: (@margin-sm / 2);
  59. }
  60. &-input {
  61. position: absolute;
  62. top: 0;
  63. left: 0;
  64. width: 0;
  65. height: 0;
  66. opacity: 0;
  67. pointer-events: none;
  68. }
  69. }
  70. // size styles
  71. &&-lg &-item-label {
  72. min-height: @input-height-lg - @segmented-container-padding * 2;
  73. padding: 0 @input-padding-horizontal-lg;
  74. font-size: @font-size-lg;
  75. line-height: @input-height-lg - @segmented-container-padding * 2;
  76. }
  77. &&-sm &-item-label {
  78. min-height: @input-height-sm - @segmented-container-padding * 2;
  79. padding: 0 @input-padding-horizontal-sm;
  80. line-height: @input-height-sm - @segmented-container-padding * 2;
  81. }
  82. // disabled styles
  83. &-item-disabled {
  84. .segmented-disabled-item();
  85. }
  86. // thumb styles
  87. &-thumb {
  88. .segmented-item-selected();
  89. position: absolute;
  90. top: 0;
  91. left: 0;
  92. width: 0;
  93. height: 100%;
  94. padding: 4px 0;
  95. }
  96. // transition effect when `appear-active`
  97. &-thumb-motion-appear-active {
  98. transition: transform 0.3s @ease-in-out, width 0.3s @ease-in-out;
  99. will-change: transform, width;
  100. }
  101. }
  102. @import './rtl';