amis/packages/amis-ui/scss/_mixins.scss
qinhaoyan 3ac4097dc4
styles:主题二期合入 (#6023)
* style: button主题适配 (#5780)

* feat: button增加font-weight (#5781)

* feat: button增加font-weight

* fix: button-fix

* fix: button-fix

Co-authored-by: hongyang03 <hongyang03@baidu.com>

* style: font

* feat: input输入框变量样式&切换图标方案 (#5847)

* feat: input输入框变量样式&切换图标方案

* fix: 去掉多余代码

* fix: 去掉多余代码

Co-authored-by: hongyang03 <hongyang03@baidu.com>

* style: input外观

* fix: 修复选择图标没选中 (#5858)

* fix: 修复选择图标没选中

* fix: 代码格式

Co-authored-by: hongyang03 <hongyang03@baidu.com>

* style: link组件

* style: form

* inputNumber输入输入框 组件css变量 (#5874)

* inputNumber输入输入框 组件css变量

* inputNumber组件 兼容变量

* inputNumber组件 css变量文件迁移

* inputNumber组件 删除变量

* 去除无用变量

Co-authored-by: xujiahao01 <xujiahao01@baidu.com>

* style: form

* style: form

* InputNumber组件 变量修改 (#5879)

* inputNumber输入输入框 组件css变量

* inputNumber组件 兼容变量

* inputNumber组件 css变量文件迁移

* inputNumber组件 删除变量

* 去除无用变量

* InputNumber组件 变量修改

Co-authored-by: xujiahao01 <xujiahao01@baidu.com>

* style: form

* style: input

* inputNumber组件 加强版分别配置 (#5887)

Co-authored-by: xujiahao01 <xujiahao01@baidu.com>

* style: input-range

* inputNumber组件 加强版图标 (#5888)

* inputNumber组件 加强版分别配置

* inputNumber组件 加强版图标

* 修改图标变量

Co-authored-by: xujiahao01 <xujiahao01@baidu.com>

* style: rating

* checkbox组件变量 (#5902)

* inputNumber组件 加强版分别配置

* inputNumber组件 加强版图标

* 修改图标变量

* checkbox组件变量

* 修改checkbox-size

* 修改checkbox-size变量

* 优化

* 优化

Co-authored-by: xujiahao01 <xujiahao01@baidu.com>

* checkbox边框 背景分别配置变量 (#5904)

* inputNumber组件 加强版分别配置

* inputNumber组件 加强版图标

* 修改图标变量

* checkbox组件变量

* 修改checkbox-size

* 修改checkbox-size变量

* 优化

* 优化

* checkbox边框 背景分别配置变量

Co-authored-by: xujiahao01 <xujiahao01@baidu.com>

* listSelect组件变量 (#5917)

* listSelect组件变量

* 优化

Co-authored-by: xujiahao01 <xujiahao01@baidu.com>

* feat: radio&switch样式变量适配 (#5924)

* feat: radio&switch样式变量适配

* fix:修复变量

* fix: 变量修复

* fix: 变量修复

Co-authored-by: hongyang03 <hongyang03@baidu.com>

* style: 兼容style

* feat: Collapse变量适配 (#5934)

Co-authored-by: hongyang03 <hongyang03@baidu.com>

* 组件自定义变量补充 (#5947)

Co-authored-by: xujiahao01 <xujiahao01@baidu.com>

* inputNumber加强版背景覆盖普通版 (#5951)

* 组件自定义变量补充

* inputNumber加强版背景覆盖普通版

Co-authored-by: xujiahao01 <xujiahao01@baidu.com>

* pref: 已修改组件变量迁移到components (#5952)

* pref: 将变量冲properties迁移到components

* pref: 已修改组件变量迁移到components

Co-authored-by: hongyang03 <hongyang03@baidu.com>

* pref: 优化变量位置 (#5953)

Co-authored-by: hongyang03 <hongyang03@baidu.com>

* theme: 面板\分割线\选项卡

* theme: 选项卡

* theme: link

* feat: inputFile&inputImage组件变量 (#5982)

Co-authored-by: hongyang03 <hongyang03@baidu.com>

* fix: 图标选择修复和兼容处理 (#5984)

Co-authored-by: hongyang03 <hongyang03@baidu.com>

* theme: bugfix

* theme: bugfix

* fix: 去掉input的size&修复collapse样式 (#5985)

Co-authored-by: hongyang03 <hongyang03@baidu.com>

* theme: 样式调整

* theme: 样式调整

* pref: 折叠器样式变量修改 (#5991)

Co-authored-by: hongyang03 <hongyang03@baidu.com>

* theme: 样式调整

* theme: 样式调整

* theme: 样式调整

* theme: 样式调整

* styles: 主题变量bugfix

* checkbox&number组件变量修复 (#6019)

Co-authored-by: xujiahao01 <xujiahao01@baidu.com>

* fix: 输入框图标样式修复 (#6021)

Co-authored-by: hongyang03 <hongyang03@baidu.com>

* 回滚注释

* 更新快照

* fix: 修复评分组件报错问题

Co-authored-by: HongYang <33488114+hy993658052@users.noreply.github.com>
Co-authored-by: hongyang03 <hongyang03@baidu.com>
Co-authored-by: 徐佳豪 <1440054388@qq.com>
Co-authored-by: xujiahao01 <xujiahao01@baidu.com>
2023-01-06 20:36:45 +08:00

588 lines
16 KiB
SCSS
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// 媒体查询最小阈值
@mixin media-breakpoint-up($name, $breakpoints: $breakpoints) {
$min: breakpoint-min($name, $breakpoints);
@if $min {
@media (min-width: $min) {
@content;
}
} @else {
@content;
}
}
//媒体查询最大阈值
@mixin media-breakpoint-down($name, $breakpoints: $breakpoints) {
$max: breakpoint-max($name, $breakpoints);
@if $max {
@media (max-width: $max) {
@content;
}
} @else {
@content;
}
}
//媒体查询中间阈值
@mixin media-breakpoint-between($min, $max, $breakpoints: $breakpoints) {
$min: breakpoint-min($min, $breakpoints);
$max: breakpoint-max($max, $breakpoints);
@media (min-width: $min) and (max-width: $max) {
@content;
}
}
@mixin media-device($name, $devices: $devices) {
$n: map-get($devices, $name);
@media #{$n} {
@content;
}
}
@mixin clearfix() {
&::before,
&::after {
display: table;
content: '';
}
&::after {
clear: both;
}
}
// @deprecated 不建议用了
@mixin color-schema($bg-color: #555, $percent: 15%, $sat-percent: 100%) {
background: saturate(darken($bg-color, $percent), $sat-percent);
}
// @deprecated 不建议用了
@mixin color-schema-lt($bg-color: #555, $percent: 15%, $sat-percent: 100%) {
background: desaturate(lighten($bg-color, $percent), $sat-percent);
}
// @deprecated 不建议用了
@mixin color-variant(
$bg-color: #555,
$lt-percent: 10%,
$lter-percent: 15%,
$dk-percent: 10%,
$dker-percent: 15%
) {
background-color: $bg-color;
&.lt,
& .lt {
@include color-schema-lt($bg-color, $lt-percent, 2.5%);
}
&.lter,
& .lter {
@include color-schema-lt($bg-color, $lter-percent, 5%);
}
&.dk,
& .dk {
@include color-schema($bg-color, $dk-percent, 2.5%);
}
&.dker,
& .dker {
@include color-schema($bg-color, $dker-percent, 5%);
}
&.bg,
& .bg {
background-color: $bg-color;
}
}
// @deprecated 不建议用了
@mixin font-variant($bg-color) {
$font-color: desaturate(lighten($bg-color, 40%), 10%);
$link-color: desaturate(lighten($bg-color, 50%), 10%);
$hover-color: #fff;
color: $font-color;
& a,
& .#{$ns}Button--link {
color: $link-color;
&:hover {
color: $hover-color;
}
}
& .open > a {
&,
&:hover,
&:focus {
color: $hover-color;
}
}
& .text-muted {
color: darken($text-color, 10%) !important;
}
& .text-lt {
color: lighten($text-color, 25%) !important;
}
// &.auto,
// & .auto {
// & .list-group-item {
// border-color: darken($bg-color, 5%) !important;
// background: transparent;
// &:hover,
// &:focus,
// &:active,
// &.active {
// @include color-schema($bg-color, 5%, 2.5% !important);
// }
// }
// }
}
// @deprecated 不建议用了
@mixin text-wariant($bg-color, $name) {
a.bg-#{'' + $name}:hover {
background: darken($bg-color, 5%);
}
a.text-#{'' + $name}:hover {
color: darken($bg-color, 5%);
}
.text-#{'' + $name} {
color: $bg-color;
}
.text-#{'' + $name}-lt {
color: darken($bg-color, 5%);
}
.text-#{'' + $name}-lter {
color: darken($bg-color, 10%);
}
.text-#{'' + $name}-dk {
color: darken($bg-color, 5%);
}
.text-#{'' + $name}-dker {
color: darken($bg-color, 10%);
}
}
@mixin hover {
&:hover {
@content;
}
&.hover {
@content;
}
}
@mixin focus {
&:focus {
@content;
}
}
@mixin hover-focus {
&:hover:focus {
@content;
}
}
@mixin hover-active {
&:hover:active {
@content;
}
&.active {
@content;
}
}
@mixin button-size(
$font-size: var(--button-size-default-fontSize),
$font-weight: var(--button-size-default-fontWeight),
$line-height: var(--button-size-default-lineHeight),
$border-radius-top-right: var(--button-size-default-top-right-border-radius),
$border-radius-top-left: var(--button-size-default-top-left-border-radius),
$border-radius-bottom-right:
var(--button-size-default-bottom-right-border-radius),
$border-radius-bottom-left:
var(--button-size-default-bottom-left-border-radius),
$height: var(--button-size-default-height),
$paddingTop: var(--button-size-default-paddingTop),
$paddingBottom: var(--button-size-default-paddingBottom),
$paddingLeft: var(--button-size-default-paddingLeft),
$paddingRight: var(--button-size-default-paddingRight),
$marginTop: var(--button-size-default-marginTop),
$marginBottom: var(--button-size-default-marginBottom),
$marginLeft: var(--button-size-default-marginLeft),
$marginRight: var(--button-size-default-marginRight),
$minWidth: var(--button-size-default-minWidth),
$iconSize: var(--button-size-default-icon-size),
$iconMargin: var(--button-size-default-icon-margin)
) {
font-size: $font-size;
font-weight: $font-weight;
line-height: $line-height;
border-radius: $border-radius-top-left $border-radius-top-right
$border-radius-bottom-right $border-radius-bottom-left;
height: $height;
padding: $paddingTop $paddingRight $paddingBottom $paddingLeft;
margin: $marginTop $marginRight $marginBottom $marginLeft;
.#{$ns}Button-icon:first-child:not(:last-child):not(.pull-right),
> svg.icon:not(:last-child):not(.pull-right),
> .pull-left {
margin-right: $iconMargin;
font-size: $iconSize;
}
.#{$ns}Button-icon:last-child:not(:first-child):not(.pull-left),
> .pull-right {
font-size: $iconSize;
margin-left: $iconMargin;
}
.#{$ns}Button--loading:first-child:not(:last-child):not(.pull-right),
> svg.icon:not(:last-child):not(.pull-right),
> .pull-left {
font-size: $iconSize;
margin-right: $iconMargin;
}
.#{$ns}Button--loading:last-child:not(:first-child):not(.pull-left),
> .pull-right {
font-size: $iconSize;
margin-left: $iconMargin;
}
// img 需要加一下高度限制
img.#{$ns}Button-icon {
height: $iconSize;
vertical-align: middle;
}
}
@mixin button-loading-icon() {
transition: --Button-transition;
svg {
@include animation-svg(var(--Button-animation-spin));
}
}
@mixin animation-svg($animation) {
animation: $animation;
}
@mixin button-variant(
// 常规
$bg-color: var(--button-default-default-bg-color),
$font-color: var(--button-default-default-font-color),
$border-color-top: var(--button-default-default-top-border-color),
$border-color-right: var(--button-default-default-right-border-color),
$border-color-bottom: var(--button-default-default-bottom-border-color),
$border-color-left: var(--button-default-default-left-border-color),
$border-width-top: var(--button-default-default-top-border-width),
$border-width-right: var(--button-default-default-right-border-width),
$border-width-bottom: var(--button-default-default-bottom-border-width),
$border-width-left: var(--button-default-default-left-border-width),
$border-style-top: var(--button-default-default-top-border-style),
$border-style-right: var(--button-default-default-right-border-style),
$border-style-bottom: var(--button-default-default-bottom-border-style),
$border-style-left: var(--button-default-default-left-border-style),
$shadow: var(--button-default-default-shadow),
// 悬浮
$hover-bg-color: var(--button-default-hover-bg-color),
$hover-font-color: var(--button-default-hover-font-color),
$hover-border-color-top: var(--button-default-hover-top-border-color),
$hover-border-color-right: var(--button-default-hover-right-border-color),
$hover-border-color-bottom: var(--button-default-hover-bottom-border-color),
$hover-border-color-left: var(--button-default-hover-left-border-color),
$hover-border-width-top: var(--button-default-hover-top-border-width),
$hover-border-width-right: var(--button-default-hover-right-border-width),
$hover-border-width-bottom: var(--button-default-hover-bottom-border-width),
$hover-border-width-left: var(--button-default-hover-left-border-width),
$hover-border-style-top: var(--button-default-hover-top-border-style),
$hover-border-style-right: var(--button-default-hover-right-border-style),
$hover-border-style-bottom: var(--button-default-hover-bottom-border-style),
$hover-border-style-left: var(--button-default-hover-left-border-style),
$hover-shadow: var(--button-default-hover-shadow),
// 点击
$active-bg-color: var(--button-default-active-bg-color),
$active-font-color: var(--button-default-active-font-color),
$active-border-color-top: var(--button-default-active-top-border-color),
$active-border-color-right: var(--button-default-active-right-border-color),
$active-border-color-bottom: var(--button-default-active-bottom-border-color),
$active-border-color-left: var(--button-default-active-left-border-color),
$active-border-width-top: var(--button-default-active-top-border-width),
$active-border-width-right: var(--button-default-active-right-border-width),
$active-border-width-bottom: var(--button-default-active-bottom-border-width),
$active-border-width-left: var(--button-default-active-left-border-width),
$active-border-style-top: var(--button-default-active-top-border-style),
$active-border-style-right: var(--button-default-active-right-border-style),
$active-border-style-bottom: var(--button-default-active-bottom-border-style),
$active-border-style-left: var(--button-default-active-left-border-style),
$active-shadow: var(--button-default-active-shadow),
// 禁用
$disabled-bg-color: var(--button-default-disabled-bg-color),
$disabled-font-color: var(--button-default-disabled-font-color),
$disabled-border-color-top: var(--button-default-disabled-top-border-color),
$disabled-border-color-right:
var(--button-default-disabled-right-border-color),
$disabled-border-color-bottom:
var(--button-default-disabled-bottom-border-color),
$disabled-border-color-left: var(--button-default-disabled-left-border-color),
$disabled-border-width-top: var(--button-default-disabled-top-border-width),
$disabled-border-width-right:
var(--button-default-disabled-right-border-width),
$disabled-border-width-bottom:
var(--button-default-disabled-bottom-border-width),
$disabled-border-width-left: var(--button-default-disabled-left-border-width),
$disabled-border-style-top: var(--button-default-disabled-top-border-style),
$disabled-border-style-right:
var(--button-default-disabled-right-border-style),
$disabled-border-style-bottom:
var(--button-default-disabled-bottom-border-style),
$disabled-border-style-left: var(--button-default-disabled-left-border-style),
$disabled-shadow: var(--button-default-disabled-shadow)
) {
color: $font-color;
background: $bg-color;
border-color: $border-color-top $border-color-right $border-color-bottom
$border-color-left;
border-width: $border-width-top $border-width-right $border-width-bottom
$border-width-left;
border-style: $border-style-top $border-style-right $border-style-bottom
$border-style-left;
box-shadow: $shadow;
// text-shadow: var(--Button-textShadow);
&:not(:disabled):not(.is-disabled) {
@include hover {
color: $hover-font-color;
background: $hover-bg-color;
border-color: $hover-border-color-top $hover-border-color-right
$hover-border-color-bottom $hover-border-color-left;
border-width: $hover-border-width-top $hover-border-width-right
$hover-border-width-bottom $hover-border-width-left;
border-style: $hover-border-style-top $hover-border-style-right
$hover-border-style-bottom $hover-border-style-left;
box-shadow: $hover-shadow;
}
@include hover-active {
color: $active-font-color;
background: $active-bg-color;
border-color: $active-border-color-top $active-border-color-right
$active-border-color-bottom $active-border-color-left;
border-width: $active-border-width-top $active-border-width-right
$active-border-width-bottom $active-border-width-left;
border-style: $active-border-style-top $active-border-style-right
$active-border-style-bottom $active-border-style-left;
box-shadow: $active-shadow;
}
}
&:disabled,
&.is-disabled {
color: $disabled-font-color;
background: $disabled-bg-color;
border-color: $disabled-border-color-top $disabled-border-color-right
$disabled-border-color-bottom $disabled-border-color-left;
border-width: $disabled-border-width-top $disabled-border-width-right
$disabled-border-width-bottom $disabled-border-width-left;
border-style: $disabled-border-style-top $disabled-border-style-right
$disabled-border-style-bottom $disabled-border-style-left;
box-shadow: $disabled-shadow;
}
}
@mixin input-clear {
padding: var(--Form-input-clearBtn-padding);
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
margin-left: auto;
text-decoration: none;
svg {
fill: var(--Form-input-clearBtn-color);
top: 0;
width: var(--Form-input-clearBtn-size);
height: var(--Form-input-clearBtn-size);
}
&:hover svg {
fill: var(--Form-input-clearBtn-color-onHover);
}
&:active svg {
fill: var(--Form-input-clearBtn-color-onActive);
}
}
@mixin input-input {
display: flex;
background: var(--Form-input-bg);
border: var(--Form-input-borderWidth) solid var(--Form-input-borderColor);
border-radius: var(--Form-input-borderRadius);
// height: var(--Form-input-height);
line-height: var(--Form-input-lineHeight);
padding: var(--Form-input-paddingY) var(--Form-input-paddingX);
font-size: var(--Form-input-fontSize);
flex-wrap: wrap;
justify-content: flex-start;
input {
flex-basis: px2rem(30px);
flex-grow: 1;
outline: none;
background: transparent;
border: none;
color: var(--Form-input-color);
width: 100%;
height: calc(var(--Form-input-lineHeight) * var(--Form-input-fontSize));
&::placeholder {
color: var(--Form-input-placeholderColor);
user-select: none;
}
}
&:hover {
border-color: var(--Form-input-onFocused-borderColor);
}
}
@mixin input-border {
&--borderHalf {
border-left-color: transparent !important;
border-right-color: transparent !important;
border-top-color: transparent !important;
}
&--borderNone {
border-color: transparent !important;
}
}
@mixin input-text {
position: relative;
max-width: 100%;
&.is-inline {
display: inline-block;
width: var(--Form-control-widthBase);
}
&-input {
@include input-input();
@include input-border();
}
&.is-error > &-input {
border-color: var(--Form-item-onError-borderColor);
background: var(--Form-item-onError-bg);
transition: all var(--animation-duration);
}
&.is-focused > &-input {
border-color: var(--Form-input-onFocused-borderColor);
box-shadow: var(--Form-input-boxShadow);
background: var(--Form-input-onFocused-bg);
transition: all var(--animation-duration);
}
&.is-error.is-focused > &-input {
border-color: var(--Form-item-onError-borderColor);
background: var(--Form-item-onError-bg);
}
&.is-disabled > &-input {
color: var(--text--muted-color);
background: var(--Form-input-onDisabled-bg);
border-color: var(--Form-input-onDisabled-borderColor);
transition: all var(--animation-duration);
& > input {
color: var(--text--muted-color);
}
}
&-spinner {
line-height: calc(
var(--Form-input-lineHeight) * var(--Form-input-fontSize)
);
}
&-clear {
@include input-clear();
}
&-revealPassword {
cursor: pointer;
color: var(--text--muted-color);
}
// 需要能撑开
@include media-breakpoint-up(sm) {
&.#{$ns}Form-control--sizeXs > &-input,
&.#{$ns}Form-control--sizeSm > &-input,
&.#{$ns}Form-control--sizeMd > &-input,
&.#{$ns}Form-control--sizeLg > &-input {
min-width: 100%;
display: inline-flex;
}
}
}
@mixin checkboxes-placeholder {
height: var(--Form-input-height);
line-height: var(--Form-input-lineHeight);
font-size: var(--Form-input-fontSize);
padding: calc(
(
var(--Form-input-height) - var(--Form-input-lineHeight) *
var(--Form-input-fontSize)
) / 2
)
var(--gap-sm);
color: var(--text--muted-color);
}
@mixin label-variant($color) {
background: $color;
// todo不支持了
// &[href] {
// &:hover,
// &:focus {
// background: darken($color, 10%);
// }
// }
}
@mixin icon-color {
color: var(--icon-color);
&:hover {
color: var(--icon-onHover-color);
}
}
@mixin truncate {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}