@cyberpunk-vue/theme-chalk 1.14.0 → 1.14.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.css +1 -1
- package/dist/index.css.map +1 -1
- package/package.json +1 -1
- package/src/common/var.scss +247 -247
- package/src/components/avatar-group.scss +113 -113
- package/src/components/avatar.scss +123 -123
- package/src/components/badge.scss +210 -210
- package/src/components/breadcrumb.scss +203 -203
- package/src/components/button.scss +975 -975
- package/src/components/card.scss +699 -696
- package/src/components/checkbox-group.scss +22 -22
- package/src/components/checkbox.scss +320 -320
- package/src/components/col.scss +43 -43
- package/src/components/dialog.scss +360 -360
- package/src/components/divider.scss +250 -250
- package/src/components/empty.scss +99 -99
- package/src/components/form-item.scss +189 -189
- package/src/components/form.scss +59 -59
- package/src/components/icon.scss +83 -83
- package/src/components/image-preview.scss +147 -147
- package/src/components/image.scss +351 -351
- package/src/components/input-number.scss +129 -129
- package/src/components/input.scss +362 -362
- package/src/components/loading.scss +64 -64
- package/src/components/notification.scss +348 -348
- package/src/components/pagination.scss +287 -280
- package/src/components/pattern-background.scss +18 -18
- package/src/components/popover.scss +438 -438
- package/src/components/progress.scss +438 -438
- package/src/components/radio-group.scss +22 -22
- package/src/components/radio.scss +286 -286
- package/src/components/row.scss +12 -12
- package/src/components/scrollbar.scss +40 -40
- package/src/components/segmented.scss +566 -566
- package/src/components/select.scss +15 -1
- package/src/components/slider.scss +421 -421
- package/src/components/status-indicator.scss +206 -206
- package/src/components/switch.scss +405 -405
- package/src/components/table.scss +474 -474
- package/src/components/tag.scss +416 -416
- package/src/components/text.scss +310 -271
- package/src/components/textarea.scss +106 -104
- package/src/components/timeline.scss +379 -379
- package/src/components/tree.scss +397 -397
- package/src/components/upload.scss +509 -509
- package/src/index.scss +60 -60
- package/src/mixins/mixins.scss +156 -156
|
@@ -1,99 +1,99 @@
|
|
|
1
|
-
// CpEmpty 组件样式
|
|
2
|
-
// 空状态组件 - 撑满父容器、水平+垂直居中
|
|
3
|
-
|
|
4
|
-
@use '../common/var' as *;
|
|
5
|
-
@use '../mixins/mixins' as *;
|
|
6
|
-
|
|
7
|
-
@include b(empty) {
|
|
8
|
-
display: flex;
|
|
9
|
-
align-items: center;
|
|
10
|
-
justify-content: center;
|
|
11
|
-
width: 100%;
|
|
12
|
-
height: 100%;
|
|
13
|
-
min-height: 120px;
|
|
14
|
-
|
|
15
|
-
// ===== 内容容器 =====
|
|
16
|
-
@include e(content) {
|
|
17
|
-
display: flex;
|
|
18
|
-
flex-direction: column;
|
|
19
|
-
align-items: center;
|
|
20
|
-
text-align: center;
|
|
21
|
-
user-select: none;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
// ===== 图标区域 =====
|
|
25
|
-
@include e(image) {
|
|
26
|
-
display: flex;
|
|
27
|
-
align-items: center;
|
|
28
|
-
justify-content: center;
|
|
29
|
-
margin-bottom: var(--cp-empty-image-margin, 8px);
|
|
30
|
-
|
|
31
|
-
svg {
|
|
32
|
-
width: var(--cp-empty-image-size, 64px);
|
|
33
|
-
height: var(--cp-empty-image-size, 64px);
|
|
34
|
-
color: var(--cp-empty-color, var(--cp-text-muted));
|
|
35
|
-
transition: color var(--cp-transition-normal);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
img {
|
|
39
|
-
object-fit: contain;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
// ===== 标题 =====
|
|
44
|
-
@include e(title) {
|
|
45
|
-
font-size: var(--cp-empty-title-font-size, 16px);
|
|
46
|
-
font-weight: var(--cp-font-weight-semibold);
|
|
47
|
-
color: var(--cp-empty-title-color, var(--cp-text-primary));
|
|
48
|
-
line-height: 1.4;
|
|
49
|
-
transition: color var(--cp-transition-normal);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
// ===== 描述 =====
|
|
53
|
-
@include e(description) {
|
|
54
|
-
font-size: var(--cp-empty-description-font-size, 14px);
|
|
55
|
-
color: var(--cp-empty-description-color, var(--cp-text-muted));
|
|
56
|
-
line-height: 1.5;
|
|
57
|
-
max-width: 360px;
|
|
58
|
-
margin-top: var(--cp-empty-description-margin-top, 8px);
|
|
59
|
-
margin-bottom: var(--cp-empty-description-margin-bottom, 8px);
|
|
60
|
-
transition: color var(--cp-transition-normal);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
// ===== 底部操作区 =====
|
|
64
|
-
@include e(bottom) {
|
|
65
|
-
margin-top: var(--cp-empty-bottom-margin-top, 8px);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
// ===== 颜色类型 =====
|
|
69
|
-
@include m(primary) {
|
|
70
|
-
--cp-empty-color: var(--cp-color-primary);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
@include m(success) {
|
|
74
|
-
--cp-empty-color: var(--cp-color-success);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
@include m(warning) {
|
|
78
|
-
--cp-empty-color: var(--cp-color-warning);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
@include m(error) {
|
|
82
|
-
--cp-empty-color: var(--cp-color-error);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
@include m(info) {
|
|
86
|
-
--cp-empty-color: var(--cp-color-info);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
@include m(default) {
|
|
90
|
-
// 默认使用 muted 色调,不设置 --cp-empty-color
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
// ===== 自定义颜色 =====
|
|
94
|
-
@include when(custom-color) {
|
|
95
|
-
.cp-empty__image svg {
|
|
96
|
-
color: var(--cp-empty-color);
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
}
|
|
1
|
+
// CpEmpty 组件样式
|
|
2
|
+
// 空状态组件 - 撑满父容器、水平+垂直居中
|
|
3
|
+
|
|
4
|
+
@use '../common/var' as *;
|
|
5
|
+
@use '../mixins/mixins' as *;
|
|
6
|
+
|
|
7
|
+
@include b(empty) {
|
|
8
|
+
display: flex;
|
|
9
|
+
align-items: center;
|
|
10
|
+
justify-content: center;
|
|
11
|
+
width: 100%;
|
|
12
|
+
height: 100%;
|
|
13
|
+
min-height: 120px;
|
|
14
|
+
|
|
15
|
+
// ===== 内容容器 =====
|
|
16
|
+
@include e(content) {
|
|
17
|
+
display: flex;
|
|
18
|
+
flex-direction: column;
|
|
19
|
+
align-items: center;
|
|
20
|
+
text-align: center;
|
|
21
|
+
user-select: none;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// ===== 图标区域 =====
|
|
25
|
+
@include e(image) {
|
|
26
|
+
display: flex;
|
|
27
|
+
align-items: center;
|
|
28
|
+
justify-content: center;
|
|
29
|
+
margin-bottom: var(--cp-empty-image-margin, 8px);
|
|
30
|
+
|
|
31
|
+
svg {
|
|
32
|
+
width: var(--cp-empty-image-size, 64px);
|
|
33
|
+
height: var(--cp-empty-image-size, 64px);
|
|
34
|
+
color: var(--cp-empty-color, var(--cp-text-muted));
|
|
35
|
+
transition: color var(--cp-transition-normal);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
img {
|
|
39
|
+
object-fit: contain;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// ===== 标题 =====
|
|
44
|
+
@include e(title) {
|
|
45
|
+
font-size: var(--cp-empty-title-font-size, 16px);
|
|
46
|
+
font-weight: var(--cp-font-weight-semibold);
|
|
47
|
+
color: var(--cp-empty-title-color, var(--cp-text-primary));
|
|
48
|
+
line-height: 1.4;
|
|
49
|
+
transition: color var(--cp-transition-normal);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// ===== 描述 =====
|
|
53
|
+
@include e(description) {
|
|
54
|
+
font-size: var(--cp-empty-description-font-size, 14px);
|
|
55
|
+
color: var(--cp-empty-description-color, var(--cp-text-muted));
|
|
56
|
+
line-height: 1.5;
|
|
57
|
+
max-width: 360px;
|
|
58
|
+
margin-top: var(--cp-empty-description-margin-top, 8px);
|
|
59
|
+
margin-bottom: var(--cp-empty-description-margin-bottom, 8px);
|
|
60
|
+
transition: color var(--cp-transition-normal);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// ===== 底部操作区 =====
|
|
64
|
+
@include e(bottom) {
|
|
65
|
+
margin-top: var(--cp-empty-bottom-margin-top, 8px);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// ===== 颜色类型 =====
|
|
69
|
+
@include m(primary) {
|
|
70
|
+
--cp-empty-color: var(--cp-color-primary);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
@include m(success) {
|
|
74
|
+
--cp-empty-color: var(--cp-color-success);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
@include m(warning) {
|
|
78
|
+
--cp-empty-color: var(--cp-color-warning);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
@include m(error) {
|
|
82
|
+
--cp-empty-color: var(--cp-color-error);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
@include m(info) {
|
|
86
|
+
--cp-empty-color: var(--cp-color-info);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
@include m(default) {
|
|
90
|
+
// 默认使用 muted 色调,不设置 --cp-empty-color
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// ===== 自定义颜色 =====
|
|
94
|
+
@include when(custom-color) {
|
|
95
|
+
.cp-empty__image svg {
|
|
96
|
+
color: var(--cp-empty-color);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
@@ -1,189 +1,189 @@
|
|
|
1
|
-
// CpFormItem 组件样式
|
|
2
|
-
|
|
3
|
-
@use '../common/var' as *;
|
|
4
|
-
@use '../mixins/mixins' as *;
|
|
5
|
-
|
|
6
|
-
@include b(form-item) {
|
|
7
|
-
display: flex;
|
|
8
|
-
flex-direction: row;
|
|
9
|
-
align-items: center;
|
|
10
|
-
|
|
11
|
-
// ===== Label =====
|
|
12
|
-
@include e(label) {
|
|
13
|
-
display: inline-flex;
|
|
14
|
-
align-items: center;
|
|
15
|
-
justify-content: var(--cp-form-label-align, flex-start);
|
|
16
|
-
flex-shrink: 0;
|
|
17
|
-
width: var(--cp-form-label-width, auto);
|
|
18
|
-
min-width: var(--cp-form-label-width, auto);
|
|
19
|
-
padding-right: var(--cp-form-item-gap, var(--cp-spacing-md));
|
|
20
|
-
|
|
21
|
-
color: var(--cp-form-label-color, var(--cp-text-secondary));
|
|
22
|
-
font-size: var(--cp-form-label-font-size, var(--cp-font-size-md));
|
|
23
|
-
font-weight: var(--cp-form-label-font-weight, 500);
|
|
24
|
-
font-family: var(--cp-font-family-ui);
|
|
25
|
-
transition: color 0.2s ease;
|
|
26
|
-
|
|
27
|
-
// 必填星号 (默认左侧)
|
|
28
|
-
&::before {
|
|
29
|
-
content: '';
|
|
30
|
-
margin-right: 0;
|
|
31
|
-
transition: all 0.2s ease;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
// ===== Content =====
|
|
36
|
-
@include e(content) {
|
|
37
|
-
display: flex;
|
|
38
|
-
flex-wrap: wrap;
|
|
39
|
-
align-items: center;
|
|
40
|
-
flex: 1;
|
|
41
|
-
min-width: 0;
|
|
42
|
-
position: relative;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
// ===== Error Message =====
|
|
46
|
-
@include e(error) {
|
|
47
|
-
width: 100%;
|
|
48
|
-
flex: none;
|
|
49
|
-
height: 0;
|
|
50
|
-
overflow: hidden;
|
|
51
|
-
margin-top: var(--cp-form-error-margin-top, 4px);
|
|
52
|
-
color: var(--cp-form-error-color, var(--cp-color-error));
|
|
53
|
-
font-size: var(--cp-form-error-font-size, var(--cp-font-size-sm));
|
|
54
|
-
font-family: var(--cp-font-family-ui);
|
|
55
|
-
transition: height 0.2s ease, opacity 0.2s ease;
|
|
56
|
-
opacity: 0;
|
|
57
|
-
|
|
58
|
-
// 激活状态(有错误)
|
|
59
|
-
&.is-active {
|
|
60
|
-
opacity: 1;
|
|
61
|
-
height: auto;
|
|
62
|
-
animation: cp-form-error-appear 0.3s ease;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
// ===== 必填状态 =====
|
|
67
|
-
@include when(required) {
|
|
68
|
-
> .cp-form-item__label {
|
|
69
|
-
&::before {
|
|
70
|
-
content: '*';
|
|
71
|
-
color: var(--cp-form-required-color, var(--cp-color-error));
|
|
72
|
-
margin-right: 4px;
|
|
73
|
-
font-weight: bold;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
// 星号在右侧
|
|
78
|
-
> .cp-form-item__label.is-asterisk-right {
|
|
79
|
-
&::before {
|
|
80
|
-
content: '';
|
|
81
|
-
margin-right: 0;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
&::after {
|
|
85
|
-
content: '*';
|
|
86
|
-
color: var(--cp-form-required-color, var(--cp-color-error));
|
|
87
|
-
margin-left: 4px;
|
|
88
|
-
font-weight: bold;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
// ===== 错误状态 =====
|
|
94
|
-
@include when(error) {
|
|
95
|
-
> .cp-form-item__label {
|
|
96
|
-
color: var(--cp-form-error-color, var(--cp-color-error));
|
|
97
|
-
|
|
98
|
-
// 为 label 同步占位,防止错误信息出现时 label 位置偏移
|
|
99
|
-
flex-wrap: wrap;
|
|
100
|
-
|
|
101
|
-
&::after {
|
|
102
|
-
content: '';
|
|
103
|
-
width: 100%;
|
|
104
|
-
// 使用与错误信息相同高度 + margin
|
|
105
|
-
height: calc(var(--cp-form-error-height, 20px) + var(--cp-form-error-margin-top, 4px));
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
// 给内部 Input 等控件加上错误边框色
|
|
110
|
-
.cp-input,
|
|
111
|
-
.cp-textarea,
|
|
112
|
-
.cp-select {
|
|
113
|
-
border-color: var(--cp-form-error-color, var(--cp-color-error));
|
|
114
|
-
|
|
115
|
-
&::after {
|
|
116
|
-
background: var(--cp-form-error-color, var(--cp-color-error));
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
// ===== 预留错误占位 =====
|
|
122
|
-
@include when(reserve-space) {
|
|
123
|
-
.cp-form-item__error {
|
|
124
|
-
height: var(--cp-form-error-height, 20px);
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
// 为 label 同步等高占位,使 align-items:center 仍然对齐控件而非控件+错误区
|
|
128
|
-
> .cp-form-item__label {
|
|
129
|
-
flex-wrap: wrap;
|
|
130
|
-
|
|
131
|
-
&::after {
|
|
132
|
-
content: '';
|
|
133
|
-
width: 100%;
|
|
134
|
-
height: calc(var(--cp-form-error-height, 20px) + var(--cp-form-error-margin-top, 4px));
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
// ===== Label 垂直对齐 =====
|
|
140
|
-
|
|
141
|
-
// 顶部对齐
|
|
142
|
-
@include m(label-v-top) {
|
|
143
|
-
align-items: flex-start;
|
|
144
|
-
|
|
145
|
-
> .cp-form-item__label {
|
|
146
|
-
padding-top: var(--cp-form-label-top-offset, 8px);
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
// 底部对齐
|
|
151
|
-
@include m(label-v-bottom) {
|
|
152
|
-
align-items: flex-end;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
// 自动模式:默认居中,JS 动态切换 is-label-v-top-active
|
|
156
|
-
@include m(label-v-auto) {
|
|
157
|
-
align-items: center;
|
|
158
|
-
|
|
159
|
-
&.is-label-v-top-active {
|
|
160
|
-
align-items: flex-start;
|
|
161
|
-
|
|
162
|
-
> .cp-form-item__label {
|
|
163
|
-
padding-top: var(--cp-form-label-auto-top-offset, 8px);
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
// ===== 动画 =====
|
|
170
|
-
@keyframes cp-form-error-appear {
|
|
171
|
-
0% {
|
|
172
|
-
opacity: 0;
|
|
173
|
-
transform: translateY(-4px);
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
50% {
|
|
177
|
-
opacity: 0.8;
|
|
178
|
-
transform: translateX(2px);
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
75% {
|
|
182
|
-
transform: translateX(-1px);
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
100% {
|
|
186
|
-
opacity: 1;
|
|
187
|
-
transform: translateY(0) translateX(0);
|
|
188
|
-
}
|
|
189
|
-
}
|
|
1
|
+
// CpFormItem 组件样式
|
|
2
|
+
|
|
3
|
+
@use '../common/var' as *;
|
|
4
|
+
@use '../mixins/mixins' as *;
|
|
5
|
+
|
|
6
|
+
@include b(form-item) {
|
|
7
|
+
display: flex;
|
|
8
|
+
flex-direction: row;
|
|
9
|
+
align-items: center;
|
|
10
|
+
|
|
11
|
+
// ===== Label =====
|
|
12
|
+
@include e(label) {
|
|
13
|
+
display: inline-flex;
|
|
14
|
+
align-items: center;
|
|
15
|
+
justify-content: var(--cp-form-label-align, flex-start);
|
|
16
|
+
flex-shrink: 0;
|
|
17
|
+
width: var(--cp-form-label-width, auto);
|
|
18
|
+
min-width: var(--cp-form-label-width, auto);
|
|
19
|
+
padding-right: var(--cp-form-item-gap, var(--cp-spacing-md));
|
|
20
|
+
|
|
21
|
+
color: var(--cp-form-label-color, var(--cp-text-secondary));
|
|
22
|
+
font-size: var(--cp-form-label-font-size, var(--cp-font-size-md));
|
|
23
|
+
font-weight: var(--cp-form-label-font-weight, 500);
|
|
24
|
+
font-family: var(--cp-font-family-ui);
|
|
25
|
+
transition: color 0.2s ease;
|
|
26
|
+
|
|
27
|
+
// 必填星号 (默认左侧)
|
|
28
|
+
&::before {
|
|
29
|
+
content: '';
|
|
30
|
+
margin-right: 0;
|
|
31
|
+
transition: all 0.2s ease;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// ===== Content =====
|
|
36
|
+
@include e(content) {
|
|
37
|
+
display: flex;
|
|
38
|
+
flex-wrap: wrap;
|
|
39
|
+
align-items: center;
|
|
40
|
+
flex: 1;
|
|
41
|
+
min-width: 0;
|
|
42
|
+
position: relative;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// ===== Error Message =====
|
|
46
|
+
@include e(error) {
|
|
47
|
+
width: 100%;
|
|
48
|
+
flex: none;
|
|
49
|
+
height: 0;
|
|
50
|
+
overflow: hidden;
|
|
51
|
+
margin-top: var(--cp-form-error-margin-top, 4px);
|
|
52
|
+
color: var(--cp-form-error-color, var(--cp-color-error));
|
|
53
|
+
font-size: var(--cp-form-error-font-size, var(--cp-font-size-sm));
|
|
54
|
+
font-family: var(--cp-font-family-ui);
|
|
55
|
+
transition: height 0.2s ease, opacity 0.2s ease;
|
|
56
|
+
opacity: 0;
|
|
57
|
+
|
|
58
|
+
// 激活状态(有错误)
|
|
59
|
+
&.is-active {
|
|
60
|
+
opacity: 1;
|
|
61
|
+
height: auto;
|
|
62
|
+
animation: cp-form-error-appear 0.3s ease;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// ===== 必填状态 =====
|
|
67
|
+
@include when(required) {
|
|
68
|
+
> .cp-form-item__label {
|
|
69
|
+
&::before {
|
|
70
|
+
content: '*';
|
|
71
|
+
color: var(--cp-form-required-color, var(--cp-color-error));
|
|
72
|
+
margin-right: 4px;
|
|
73
|
+
font-weight: bold;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// 星号在右侧
|
|
78
|
+
> .cp-form-item__label.is-asterisk-right {
|
|
79
|
+
&::before {
|
|
80
|
+
content: '';
|
|
81
|
+
margin-right: 0;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
&::after {
|
|
85
|
+
content: '*';
|
|
86
|
+
color: var(--cp-form-required-color, var(--cp-color-error));
|
|
87
|
+
margin-left: 4px;
|
|
88
|
+
font-weight: bold;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// ===== 错误状态 =====
|
|
94
|
+
@include when(error) {
|
|
95
|
+
> .cp-form-item__label {
|
|
96
|
+
color: var(--cp-form-error-color, var(--cp-color-error));
|
|
97
|
+
|
|
98
|
+
// 为 label 同步占位,防止错误信息出现时 label 位置偏移
|
|
99
|
+
flex-wrap: wrap;
|
|
100
|
+
|
|
101
|
+
&::after {
|
|
102
|
+
content: '';
|
|
103
|
+
width: 100%;
|
|
104
|
+
// 使用与错误信息相同高度 + margin
|
|
105
|
+
height: calc(var(--cp-form-error-height, 20px) + var(--cp-form-error-margin-top, 4px));
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// 给内部 Input 等控件加上错误边框色
|
|
110
|
+
.cp-input,
|
|
111
|
+
.cp-textarea,
|
|
112
|
+
.cp-select {
|
|
113
|
+
border-color: var(--cp-form-error-color, var(--cp-color-error));
|
|
114
|
+
|
|
115
|
+
&::after {
|
|
116
|
+
background: var(--cp-form-error-color, var(--cp-color-error));
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
// ===== 预留错误占位 =====
|
|
122
|
+
@include when(reserve-space) {
|
|
123
|
+
.cp-form-item__error {
|
|
124
|
+
height: var(--cp-form-error-height, 20px);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
// 为 label 同步等高占位,使 align-items:center 仍然对齐控件而非控件+错误区
|
|
128
|
+
> .cp-form-item__label {
|
|
129
|
+
flex-wrap: wrap;
|
|
130
|
+
|
|
131
|
+
&::after {
|
|
132
|
+
content: '';
|
|
133
|
+
width: 100%;
|
|
134
|
+
height: calc(var(--cp-form-error-height, 20px) + var(--cp-form-error-margin-top, 4px));
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// ===== Label 垂直对齐 =====
|
|
140
|
+
|
|
141
|
+
// 顶部对齐
|
|
142
|
+
@include m(label-v-top) {
|
|
143
|
+
align-items: flex-start;
|
|
144
|
+
|
|
145
|
+
> .cp-form-item__label {
|
|
146
|
+
padding-top: var(--cp-form-label-top-offset, 8px);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
// 底部对齐
|
|
151
|
+
@include m(label-v-bottom) {
|
|
152
|
+
align-items: flex-end;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
// 自动模式:默认居中,JS 动态切换 is-label-v-top-active
|
|
156
|
+
@include m(label-v-auto) {
|
|
157
|
+
align-items: center;
|
|
158
|
+
|
|
159
|
+
&.is-label-v-top-active {
|
|
160
|
+
align-items: flex-start;
|
|
161
|
+
|
|
162
|
+
> .cp-form-item__label {
|
|
163
|
+
padding-top: var(--cp-form-label-auto-top-offset, 8px);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
// ===== 动画 =====
|
|
170
|
+
@keyframes cp-form-error-appear {
|
|
171
|
+
0% {
|
|
172
|
+
opacity: 0;
|
|
173
|
+
transform: translateY(-4px);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
50% {
|
|
177
|
+
opacity: 0.8;
|
|
178
|
+
transform: translateX(2px);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
75% {
|
|
182
|
+
transform: translateX(-1px);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
100% {
|
|
186
|
+
opacity: 1;
|
|
187
|
+
transform: translateY(0) translateX(0);
|
|
188
|
+
}
|
|
189
|
+
}
|