@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,139 +1,139 @@
|
|
|
1
|
-
// CpSegmented 组件样式
|
|
2
|
-
// 赛博朋克风格分段选择器
|
|
3
|
-
|
|
4
|
-
@use '../common/var' as *;
|
|
5
|
-
@use '../mixins/mixins' as *;
|
|
6
|
-
|
|
7
|
-
// ===== 类型颜色列表(用于批量生成) =====
|
|
8
|
-
$segmented-types: (primary, success, warning, error, info);
|
|
9
|
-
|
|
10
|
-
@include b(segmented) {
|
|
11
|
-
// ===== CSS 变量默认值 =====
|
|
12
|
-
--cp-segmented-bg: var(--cp-bg-elevated);
|
|
13
|
-
--cp-segmented-border-color: var(--cp-border);
|
|
14
|
-
--cp-segmented-padding: 3px;
|
|
15
|
-
--cp-segmented-padding-x: 4px;
|
|
16
|
-
--cp-segmented-gap: 2px;
|
|
17
|
-
--cp-segmented-item-color: var(--cp-text-secondary);
|
|
18
|
-
--cp-segmented-item-hover-bg: var(--cp-state-hover);
|
|
19
|
-
--cp-segmented-item-padding: 0 12px;
|
|
20
|
-
--cp-segmented-indicator-bg: var(--cp-surface-bright);
|
|
21
|
-
--cp-segmented-indicator-border: transparent;
|
|
22
|
-
--cp-segmented-indicator-shadow: none;
|
|
23
|
-
--cp-segmented-active-color: var(--cp-text-primary);
|
|
24
|
-
--cp-segmented-transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
|
25
|
-
--cp-segmented-height: 36px;
|
|
26
|
-
--cp-segmented-font-size: var(--cp-font-size-md);
|
|
27
|
-
--cp-segmented-font-weight: var(--cp-font-weight-semibold);
|
|
28
|
-
--cp-segmented-active-font-weight: var(--cp-font-weight-bold);
|
|
29
|
-
--cp-segmented-font-weight-transition: var(--cp-font-weight-transition-fast);
|
|
30
|
-
--cp-segmented-indicator-offset: 0px;
|
|
31
|
-
|
|
32
|
-
// ===== 基础样式 =====
|
|
33
|
-
position: relative;
|
|
34
|
-
display: inline-flex;
|
|
35
|
-
align-items: center;
|
|
36
|
-
padding: var(--cp-segmented-padding) var(--cp-segmented-padding-x);
|
|
37
|
-
background: var(--cp-segmented-bg);
|
|
38
|
-
border: 1px solid var(--cp-segmented-border-color);
|
|
39
|
-
gap: var(--cp-segmented-gap);
|
|
40
|
-
font-family: var(--cp-font-family-display);
|
|
41
|
-
user-select: none;
|
|
42
|
-
|
|
43
|
-
// 默认 clip 形状
|
|
44
|
-
clip-path: polygon(
|
|
45
|
-
8px 0, 100% 0,
|
|
46
|
-
100% calc(100% - 8px), calc(100% - 8px) 100%,
|
|
47
|
-
0 100%, 0 8px
|
|
48
|
-
);
|
|
49
|
-
|
|
50
|
-
// ===== 滑块指示器 =====
|
|
51
|
-
@include e(indicator) {
|
|
52
|
-
position: absolute;
|
|
53
|
-
top: 0;
|
|
54
|
-
left: 0;
|
|
55
|
-
background: var(--cp-segmented-indicator-bg);
|
|
56
|
-
border: 1px solid var(--cp-segmented-indicator-border);
|
|
57
|
-
box-shadow: var(--cp-segmented-indicator-shadow);
|
|
58
|
-
// height 由 JS 注入(offsetHeight),避免选项换行时被拉伸到整个容器高度
|
|
59
|
-
transition:
|
|
60
|
-
transform var(--cp-segmented-transition),
|
|
61
|
-
width var(--cp-segmented-transition),
|
|
62
|
-
height var(--cp-segmented-transition),
|
|
63
|
-
opacity var(--cp-segmented-transition);
|
|
64
|
-
pointer-events: none;
|
|
65
|
-
z-index: 0;
|
|
66
|
-
opacity: 0;
|
|
67
|
-
|
|
68
|
-
// clip 形状下滑块也带切角
|
|
69
|
-
clip-path: polygon(
|
|
70
|
-
6px 0, 100% 0,
|
|
71
|
-
100% calc(100% - 6px), calc(100% - 6px) 100%,
|
|
72
|
-
0 100%, 0 6px
|
|
73
|
-
);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
// ===== 选项按钮 =====
|
|
77
|
-
@include e(item) {
|
|
78
|
-
--cp-segmented-item-font-weight: var(--cp-segmented-font-weight);
|
|
79
|
-
position: relative;
|
|
80
|
-
z-index: 1;
|
|
81
|
-
display: inline-flex;
|
|
82
|
-
align-items: center;
|
|
83
|
-
justify-content: center;
|
|
84
|
-
gap: 6px;
|
|
85
|
-
height: var(--cp-segmented-height);
|
|
86
|
-
padding: var(--cp-segmented-item-padding);
|
|
87
|
-
background: transparent;
|
|
88
|
-
border: none;
|
|
89
|
-
outline: none;
|
|
90
|
-
color: var(--cp-segmented-item-color);
|
|
91
|
-
font-family: inherit;
|
|
92
|
-
font-size: var(--cp-segmented-font-size);
|
|
93
|
-
font-weight: var(--cp-segmented-item-font-weight);
|
|
94
|
-
font-variation-settings: 'wght' var(--cp-segmented-item-font-weight);
|
|
95
|
-
text-transform: uppercase;
|
|
96
|
-
letter-spacing: 0.05em;
|
|
97
|
-
cursor: pointer;
|
|
98
|
-
transition:
|
|
99
|
-
color 0.2s ease,
|
|
100
|
-
text-shadow 0.2s ease,
|
|
101
|
-
font-weight var(--cp-segmented-font-weight-transition),
|
|
102
|
-
font-variation-settings var(--cp-segmented-font-weight-transition);
|
|
103
|
-
white-space: nowrap;
|
|
104
|
-
|
|
105
|
-
&:hover:not(.is-disabled):not(.is-active) {
|
|
106
|
-
background: var(--cp-segmented-item-hover-bg);
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
// 默认 clip 形状下 item 也带切角 (用于 hover 背景)
|
|
110
|
-
clip-path: polygon(
|
|
111
|
-
6px 0, 100% 0,
|
|
112
|
-
100% calc(100% - 6px), calc(100% - 6px) 100%,
|
|
113
|
-
0 100%, 0 6px
|
|
114
|
-
);
|
|
115
|
-
|
|
116
|
-
// 选中态文字色
|
|
117
|
-
&.is-active {
|
|
118
|
-
--cp-segmented-item-font-weight: var(--cp-segmented-active-font-weight);
|
|
119
|
-
color: var(--cp-segmented-active-color);
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
// 禁用态
|
|
123
|
-
&.is-disabled {
|
|
124
|
-
cursor: not-allowed;
|
|
125
|
-
opacity: 0.4;
|
|
126
|
-
filter: grayscale(0.5);
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
// 图标
|
|
131
|
-
@include e(item-icon) {
|
|
132
|
-
display: inline-flex;
|
|
133
|
-
align-items: center;
|
|
134
|
-
font-size: 1.1em;
|
|
135
|
-
}
|
|
136
|
-
|
|
1
|
+
// CpSegmented 组件样式
|
|
2
|
+
// 赛博朋克风格分段选择器
|
|
3
|
+
|
|
4
|
+
@use '../common/var' as *;
|
|
5
|
+
@use '../mixins/mixins' as *;
|
|
6
|
+
|
|
7
|
+
// ===== 类型颜色列表(用于批量生成) =====
|
|
8
|
+
$segmented-types: (primary, success, warning, error, info);
|
|
9
|
+
|
|
10
|
+
@include b(segmented) {
|
|
11
|
+
// ===== CSS 变量默认值 =====
|
|
12
|
+
--cp-segmented-bg: var(--cp-bg-elevated);
|
|
13
|
+
--cp-segmented-border-color: var(--cp-border);
|
|
14
|
+
--cp-segmented-padding: 3px;
|
|
15
|
+
--cp-segmented-padding-x: 4px;
|
|
16
|
+
--cp-segmented-gap: 2px;
|
|
17
|
+
--cp-segmented-item-color: var(--cp-text-secondary);
|
|
18
|
+
--cp-segmented-item-hover-bg: var(--cp-state-hover);
|
|
19
|
+
--cp-segmented-item-padding: 0 12px;
|
|
20
|
+
--cp-segmented-indicator-bg: var(--cp-surface-bright);
|
|
21
|
+
--cp-segmented-indicator-border: transparent;
|
|
22
|
+
--cp-segmented-indicator-shadow: none;
|
|
23
|
+
--cp-segmented-active-color: var(--cp-text-primary);
|
|
24
|
+
--cp-segmented-transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
|
25
|
+
--cp-segmented-height: 36px;
|
|
26
|
+
--cp-segmented-font-size: var(--cp-font-size-md);
|
|
27
|
+
--cp-segmented-font-weight: var(--cp-font-weight-semibold);
|
|
28
|
+
--cp-segmented-active-font-weight: var(--cp-font-weight-bold);
|
|
29
|
+
--cp-segmented-font-weight-transition: var(--cp-font-weight-transition-fast);
|
|
30
|
+
--cp-segmented-indicator-offset: 0px;
|
|
31
|
+
|
|
32
|
+
// ===== 基础样式 =====
|
|
33
|
+
position: relative;
|
|
34
|
+
display: inline-flex;
|
|
35
|
+
align-items: center;
|
|
36
|
+
padding: var(--cp-segmented-padding) var(--cp-segmented-padding-x);
|
|
37
|
+
background: var(--cp-segmented-bg);
|
|
38
|
+
border: 1px solid var(--cp-segmented-border-color);
|
|
39
|
+
gap: var(--cp-segmented-gap);
|
|
40
|
+
font-family: var(--cp-font-family-display);
|
|
41
|
+
user-select: none;
|
|
42
|
+
|
|
43
|
+
// 默认 clip 形状
|
|
44
|
+
clip-path: polygon(
|
|
45
|
+
8px 0, 100% 0,
|
|
46
|
+
100% calc(100% - 8px), calc(100% - 8px) 100%,
|
|
47
|
+
0 100%, 0 8px
|
|
48
|
+
);
|
|
49
|
+
|
|
50
|
+
// ===== 滑块指示器 =====
|
|
51
|
+
@include e(indicator) {
|
|
52
|
+
position: absolute;
|
|
53
|
+
top: 0;
|
|
54
|
+
left: 0;
|
|
55
|
+
background: var(--cp-segmented-indicator-bg);
|
|
56
|
+
border: 1px solid var(--cp-segmented-indicator-border);
|
|
57
|
+
box-shadow: var(--cp-segmented-indicator-shadow);
|
|
58
|
+
// height 由 JS 注入(offsetHeight),避免选项换行时被拉伸到整个容器高度
|
|
59
|
+
transition:
|
|
60
|
+
transform var(--cp-segmented-transition),
|
|
61
|
+
width var(--cp-segmented-transition),
|
|
62
|
+
height var(--cp-segmented-transition),
|
|
63
|
+
opacity var(--cp-segmented-transition);
|
|
64
|
+
pointer-events: none;
|
|
65
|
+
z-index: 0;
|
|
66
|
+
opacity: 0;
|
|
67
|
+
|
|
68
|
+
// clip 形状下滑块也带切角
|
|
69
|
+
clip-path: polygon(
|
|
70
|
+
6px 0, 100% 0,
|
|
71
|
+
100% calc(100% - 6px), calc(100% - 6px) 100%,
|
|
72
|
+
0 100%, 0 6px
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// ===== 选项按钮 =====
|
|
77
|
+
@include e(item) {
|
|
78
|
+
--cp-segmented-item-font-weight: var(--cp-segmented-font-weight);
|
|
79
|
+
position: relative;
|
|
80
|
+
z-index: 1;
|
|
81
|
+
display: inline-flex;
|
|
82
|
+
align-items: center;
|
|
83
|
+
justify-content: center;
|
|
84
|
+
gap: 6px;
|
|
85
|
+
height: var(--cp-segmented-height);
|
|
86
|
+
padding: var(--cp-segmented-item-padding);
|
|
87
|
+
background: transparent;
|
|
88
|
+
border: none;
|
|
89
|
+
outline: none;
|
|
90
|
+
color: var(--cp-segmented-item-color);
|
|
91
|
+
font-family: inherit;
|
|
92
|
+
font-size: var(--cp-segmented-font-size);
|
|
93
|
+
font-weight: var(--cp-segmented-item-font-weight);
|
|
94
|
+
font-variation-settings: 'wght' var(--cp-segmented-item-font-weight);
|
|
95
|
+
text-transform: uppercase;
|
|
96
|
+
letter-spacing: 0.05em;
|
|
97
|
+
cursor: pointer;
|
|
98
|
+
transition:
|
|
99
|
+
color 0.2s ease,
|
|
100
|
+
text-shadow 0.2s ease,
|
|
101
|
+
font-weight var(--cp-segmented-font-weight-transition),
|
|
102
|
+
font-variation-settings var(--cp-segmented-font-weight-transition);
|
|
103
|
+
white-space: nowrap;
|
|
104
|
+
|
|
105
|
+
&:hover:not(.is-disabled):not(.is-active) {
|
|
106
|
+
background: var(--cp-segmented-item-hover-bg);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// 默认 clip 形状下 item 也带切角 (用于 hover 背景)
|
|
110
|
+
clip-path: polygon(
|
|
111
|
+
6px 0, 100% 0,
|
|
112
|
+
100% calc(100% - 6px), calc(100% - 6px) 100%,
|
|
113
|
+
0 100%, 0 6px
|
|
114
|
+
);
|
|
115
|
+
|
|
116
|
+
// 选中态文字色
|
|
117
|
+
&.is-active {
|
|
118
|
+
--cp-segmented-item-font-weight: var(--cp-segmented-active-font-weight);
|
|
119
|
+
color: var(--cp-segmented-active-color);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// 禁用态
|
|
123
|
+
&.is-disabled {
|
|
124
|
+
cursor: not-allowed;
|
|
125
|
+
opacity: 0.4;
|
|
126
|
+
filter: grayscale(0.5);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
// 图标
|
|
131
|
+
@include e(item-icon) {
|
|
132
|
+
display: inline-flex;
|
|
133
|
+
align-items: center;
|
|
134
|
+
font-size: 1.1em;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
137
|
// 文本
|
|
138
138
|
@include e(item-label) {
|
|
139
139
|
display: inline-grid;
|
|
@@ -144,420 +144,420 @@ $segmented-types: (primary, success, warning, error, info);
|
|
|
144
144
|
@include e(item-label-text) {
|
|
145
145
|
grid-area: 1 / 1;
|
|
146
146
|
}
|
|
147
|
-
|
|
148
|
-
// ===== 尺寸 =====
|
|
149
|
-
@include m(sm) {
|
|
150
|
-
--cp-segmented-height: 24px;
|
|
151
|
-
--cp-segmented-font-size: var(--cp-font-size-sm);
|
|
152
|
-
--cp-segmented-item-padding: 0 8px;
|
|
153
|
-
--cp-segmented-padding: 2px;
|
|
154
|
-
--cp-segmented-padding-x: 3px;
|
|
155
|
-
|
|
156
|
-
clip-path: polygon(
|
|
157
|
-
6px 0, 100% 0,
|
|
158
|
-
100% calc(100% - 6px), calc(100% - 6px) 100%,
|
|
159
|
-
0 100%, 0 6px
|
|
160
|
-
);
|
|
161
|
-
|
|
162
|
-
.cp-segmented__indicator {
|
|
163
|
-
clip-path: polygon(
|
|
164
|
-
4px 0, 100% 0,
|
|
165
|
-
100% calc(100% - 4px), calc(100% - 4px) 100%,
|
|
166
|
-
0 100%, 0 4px
|
|
167
|
-
);
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
.cp-segmented__item {
|
|
171
|
-
clip-path: polygon(
|
|
172
|
-
4px 0, 100% 0,
|
|
173
|
-
100% calc(100% - 4px), calc(100% - 4px) 100%,
|
|
174
|
-
0 100%, 0 4px
|
|
175
|
-
);
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
@include m(md) {
|
|
180
|
-
--cp-segmented-height: 32px;
|
|
181
|
-
--cp-segmented-font-size: var(--cp-font-size-md);
|
|
182
|
-
--cp-segmented-item-padding: 0 12px;
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
@include m(lg) {
|
|
186
|
-
--cp-segmented-height: 40px;
|
|
187
|
-
--cp-segmented-font-size: var(--cp-font-size-lg);
|
|
188
|
-
--cp-segmented-item-padding: 0 20px;
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
// 自定义尺寸
|
|
192
|
-
@include when(custom-size) {
|
|
193
|
-
// height 通过 CSS 变量注入
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
// ===== Solid 变体 =====
|
|
197
|
-
@include m(solid) {
|
|
198
|
-
@each $type in $segmented-types {
|
|
199
|
-
&.cp-segmented--#{$type} {
|
|
200
|
-
.cp-segmented__indicator {
|
|
201
|
-
background: var(--cp-color-#{$type});
|
|
202
|
-
border-color: var(--cp-color-#{$type});
|
|
203
|
-
box-shadow: 0 0 8px var(--cp-color-#{$type}-light),
|
|
204
|
-
0 0 16px var(--cp-color-#{$type}-light);
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
.cp-segmented__item.is-active {
|
|
208
|
-
color: var(--cp-color-#{$type}-text);
|
|
209
|
-
text-shadow: none;
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
&.cp-segmented--default {
|
|
215
|
-
.cp-segmented__indicator {
|
|
216
|
-
background: var(--cp-surface-bright);
|
|
217
|
-
border-color: var(--cp-border);
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
.cp-segmented__item.is-active {
|
|
221
|
-
color: var(--cp-text-primary);
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
// ===== Outline 变体 =====
|
|
227
|
-
@include m(outline) {
|
|
228
|
-
background: transparent;
|
|
229
|
-
|
|
230
|
-
.cp-segmented__indicator {
|
|
231
|
-
background: transparent;
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
@each $type in $segmented-types {
|
|
235
|
-
&.cp-segmented--#{$type} {
|
|
236
|
-
border-color: var(--cp-color-#{$type});
|
|
237
|
-
|
|
238
|
-
.cp-segmented__indicator {
|
|
239
|
-
border-color: var(--cp-color-#{$type});
|
|
240
|
-
background: var(--cp-color-#{$type}-light);
|
|
241
|
-
box-shadow: 0 0 8px var(--cp-color-#{$type}-light);
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
.cp-segmented__item {
|
|
245
|
-
color: var(--cp-color-#{$type});
|
|
246
|
-
|
|
247
|
-
&.is-active {
|
|
248
|
-
color: var(--cp-color-#{$type});
|
|
249
|
-
text-shadow: 0 0 5px var(--cp-color-#{$type});
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
&.cp-segmented--default {
|
|
256
|
-
border-color: var(--cp-border);
|
|
257
|
-
|
|
258
|
-
.cp-segmented__indicator {
|
|
259
|
-
border-color: var(--cp-border);
|
|
260
|
-
background: var(--cp-bg-elevated);
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
.cp-segmented__item.is-active {
|
|
264
|
-
color: var(--cp-text-primary);
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
// ===== Semi 变体 =====
|
|
270
|
-
@include m(semi) {
|
|
271
|
-
background: transparent;
|
|
272
|
-
border-color: transparent;
|
|
273
|
-
|
|
274
|
-
@each $type in $segmented-types {
|
|
275
|
-
&.cp-segmented--#{$type} {
|
|
276
|
-
background: var(--cp-color-#{$type}-light);
|
|
277
|
-
border-color: var(--cp-color-#{$type});
|
|
278
|
-
|
|
279
|
-
.cp-segmented__indicator {
|
|
280
|
-
background: var(--cp-color-#{$type});
|
|
281
|
-
border-color: var(--cp-color-#{$type});
|
|
282
|
-
box-shadow: 0 0 8px var(--cp-color-#{$type}-light);
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
.cp-segmented__item {
|
|
286
|
-
color: var(--cp-color-#{$type});
|
|
287
|
-
|
|
288
|
-
&.is-active {
|
|
289
|
-
color: var(--cp-color-#{$type}-text);
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
&.cp-segmented--default {
|
|
296
|
-
background: color-mix(in srgb, var(--cp-border) 30%, transparent);
|
|
297
|
-
border-color: var(--cp-border);
|
|
298
|
-
|
|
299
|
-
.cp-segmented__indicator {
|
|
300
|
-
background: var(--cp-surface-bright);
|
|
301
|
-
border-color: var(--cp-border);
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
.cp-segmented__item.is-active {
|
|
305
|
-
color: var(--cp-text-primary);
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
// ===== Ghost 变体 =====
|
|
311
|
-
@include m(ghost) {
|
|
312
|
-
background: transparent;
|
|
313
|
-
border-color: transparent;
|
|
314
|
-
clip-path: none;
|
|
315
|
-
padding: 0;
|
|
316
|
-
|
|
317
|
-
.cp-segmented__indicator {
|
|
318
|
-
clip-path: none;
|
|
319
|
-
background: transparent;
|
|
320
|
-
border: none;
|
|
321
|
-
box-shadow: none;
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
@each $type in $segmented-types {
|
|
325
|
-
&.cp-segmented--#{$type} {
|
|
326
|
-
.cp-segmented__indicator {
|
|
327
|
-
background: var(--cp-color-#{$type}-light);
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
.cp-segmented__item {
|
|
331
|
-
color: var(--cp-text-secondary);
|
|
332
|
-
|
|
333
|
-
&.is-active {
|
|
334
|
-
color: var(--cp-color-#{$type});
|
|
335
|
-
text-shadow: 0 0 5px var(--cp-color-#{$type});
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
&:hover:not(.is-disabled):not(.is-active) {
|
|
339
|
-
color: var(--cp-color-#{$type});
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
&.cp-segmented--default {
|
|
346
|
-
.cp-segmented__indicator {
|
|
347
|
-
background: var(--cp-bg-elevated);
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
.cp-segmented__item.is-active {
|
|
351
|
-
color: var(--cp-text-primary);
|
|
352
|
-
}
|
|
353
|
-
}
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
// ===== Neon 变体 =====
|
|
357
|
-
@include m(neon) {
|
|
358
|
-
background: transparent;
|
|
359
|
-
|
|
360
|
-
@each $type in $segmented-types {
|
|
361
|
-
&.cp-segmented--#{$type} {
|
|
362
|
-
border-color: var(--cp-color-#{$type});
|
|
363
|
-
box-shadow: 0 0 4px var(--cp-color-#{$type}-light),
|
|
364
|
-
inset 0 0 4px var(--cp-color-#{$type}-light);
|
|
365
|
-
|
|
366
|
-
.cp-segmented__indicator {
|
|
367
|
-
background: var(--cp-color-#{$type}-light);
|
|
368
|
-
border-color: var(--cp-color-#{$type});
|
|
369
|
-
box-shadow:
|
|
370
|
-
0 0 8px var(--cp-color-#{$type}),
|
|
371
|
-
0 0 20px var(--cp-color-#{$type}-light),
|
|
372
|
-
inset 0 0 6px var(--cp-color-#{$type}-light);
|
|
373
|
-
}
|
|
374
|
-
|
|
375
|
-
.cp-segmented__item {
|
|
376
|
-
color: var(--cp-color-#{$type});
|
|
377
|
-
text-shadow: 0 0 3px var(--cp-color-#{$type});
|
|
378
|
-
|
|
379
|
-
&.is-active {
|
|
380
|
-
color: var(--cp-color-#{$type});
|
|
381
|
-
text-shadow: 0 0 8px var(--cp-color-#{$type});
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
|
-
}
|
|
385
|
-
}
|
|
386
|
-
|
|
387
|
-
&.cp-segmented--default {
|
|
388
|
-
border-color: var(--cp-border);
|
|
389
|
-
box-shadow: 0 0 4px var(--cp-border);
|
|
390
|
-
|
|
391
|
-
.cp-segmented__indicator {
|
|
392
|
-
background: var(--cp-bg-elevated);
|
|
393
|
-
border-color: var(--cp-border);
|
|
394
|
-
box-shadow: 0 0 8px var(--cp-border);
|
|
395
|
-
}
|
|
396
|
-
|
|
397
|
-
.cp-segmented__item.is-active {
|
|
398
|
-
color: var(--cp-text-primary);
|
|
399
|
-
}
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
// ===== 形状 =====
|
|
404
|
-
// clip 为默认(在基础样式中定义)
|
|
405
|
-
|
|
406
|
-
@include m(shape-no-clip) {
|
|
407
|
-
clip-path: none;
|
|
408
|
-
border-radius: 0;
|
|
409
|
-
|
|
410
|
-
.cp-segmented__indicator {
|
|
411
|
-
clip-path: none;
|
|
412
|
-
border-radius: 0;
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
.cp-segmented__item {
|
|
416
|
-
clip-path: none;
|
|
417
|
-
border-radius: 0;
|
|
418
|
-
}
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
@include m(shape-round) {
|
|
422
|
-
clip-path: none;
|
|
423
|
-
border-radius: var(--cp-radius-lg);
|
|
424
|
-
|
|
425
|
-
.cp-segmented__indicator {
|
|
426
|
-
clip-path: none;
|
|
427
|
-
border-radius: var(--cp-radius-md);
|
|
428
|
-
}
|
|
429
|
-
|
|
430
|
-
.cp-segmented__item {
|
|
431
|
-
clip-path: none;
|
|
432
|
-
border-radius: var(--cp-radius-md);
|
|
433
|
-
}
|
|
434
|
-
}
|
|
435
|
-
|
|
436
|
-
@include m(shape-circle) {
|
|
437
|
-
clip-path: none;
|
|
438
|
-
border-radius: 9999px;
|
|
439
|
-
|
|
440
|
-
.cp-segmented__indicator {
|
|
441
|
-
clip-path: none;
|
|
442
|
-
border-radius: 9999px;
|
|
443
|
-
}
|
|
444
|
-
|
|
445
|
-
.cp-segmented__item {
|
|
446
|
-
clip-path: none;
|
|
447
|
-
border-radius: 9999px;
|
|
448
|
-
}
|
|
449
|
-
}
|
|
450
|
-
|
|
451
|
-
// ===== 自定义颜色 =====
|
|
452
|
-
@include when(custom-color) {
|
|
453
|
-
// Solid
|
|
454
|
-
&.cp-segmented--solid {
|
|
455
|
-
.cp-segmented__indicator {
|
|
456
|
-
background: var(--cp-segmented-color);
|
|
457
|
-
border-color: var(--cp-segmented-color);
|
|
458
|
-
box-shadow: 0 0 8px var(--cp-segmented-color-light),
|
|
459
|
-
0 0 16px var(--cp-segmented-color-light);
|
|
460
|
-
}
|
|
461
|
-
.cp-segmented__item.is-active {
|
|
462
|
-
color: var(--cp-bg-deep);
|
|
463
|
-
}
|
|
464
|
-
}
|
|
465
|
-
|
|
466
|
-
// Outline
|
|
467
|
-
&.cp-segmented--outline {
|
|
468
|
-
border-color: var(--cp-segmented-color);
|
|
469
|
-
|
|
470
|
-
.cp-segmented__indicator {
|
|
471
|
-
border-color: var(--cp-segmented-color);
|
|
472
|
-
background: var(--cp-segmented-color-light);
|
|
473
|
-
box-shadow: 0 0 8px var(--cp-segmented-color-light);
|
|
474
|
-
}
|
|
475
|
-
.cp-segmented__item {
|
|
476
|
-
color: var(--cp-segmented-color);
|
|
477
|
-
}
|
|
478
|
-
}
|
|
479
|
-
|
|
480
|
-
// Semi
|
|
481
|
-
&.cp-segmented--semi {
|
|
482
|
-
background: var(--cp-segmented-color-light);
|
|
483
|
-
border-color: var(--cp-segmented-color);
|
|
484
|
-
|
|
485
|
-
.cp-segmented__indicator {
|
|
486
|
-
background: var(--cp-segmented-color);
|
|
487
|
-
border-color: var(--cp-segmented-color);
|
|
488
|
-
}
|
|
489
|
-
.cp-segmented__item {
|
|
490
|
-
color: var(--cp-segmented-color);
|
|
491
|
-
&.is-active {
|
|
492
|
-
color: var(--cp-bg-deep);
|
|
493
|
-
}
|
|
494
|
-
}
|
|
495
|
-
}
|
|
496
|
-
|
|
497
|
-
// Ghost
|
|
498
|
-
&.cp-segmented--ghost {
|
|
499
|
-
.cp-segmented__indicator {
|
|
500
|
-
background: var(--cp-segmented-color-light);
|
|
501
|
-
}
|
|
502
|
-
.cp-segmented__item.is-active {
|
|
503
|
-
color: var(--cp-segmented-color);
|
|
504
|
-
text-shadow: 0 0 5px var(--cp-segmented-color);
|
|
505
|
-
}
|
|
506
|
-
}
|
|
507
|
-
|
|
508
|
-
// Neon
|
|
509
|
-
&.cp-segmented--neon {
|
|
510
|
-
border-color: var(--cp-segmented-color);
|
|
511
|
-
box-shadow: 0 0 4px var(--cp-segmented-color-light),
|
|
512
|
-
inset 0 0 4px var(--cp-segmented-color-light);
|
|
513
|
-
|
|
514
|
-
.cp-segmented__indicator {
|
|
515
|
-
background: var(--cp-segmented-color-light);
|
|
516
|
-
border-color: var(--cp-segmented-color);
|
|
517
|
-
box-shadow:
|
|
518
|
-
0 0 8px var(--cp-segmented-color),
|
|
519
|
-
0 0 20px var(--cp-segmented-color-light),
|
|
520
|
-
inset 0 0 6px var(--cp-segmented-color-light);
|
|
521
|
-
}
|
|
522
|
-
.cp-segmented__item {
|
|
523
|
-
color: var(--cp-segmented-color);
|
|
524
|
-
text-shadow: 0 0 3px var(--cp-segmented-color);
|
|
525
|
-
}
|
|
526
|
-
}
|
|
527
|
-
}
|
|
528
|
-
|
|
529
|
-
// ===== Block 模式 =====
|
|
530
|
-
@include when(block) {
|
|
531
|
-
display: flex;
|
|
532
|
-
width: 100%;
|
|
533
|
-
|
|
534
|
-
.cp-segmented__item {
|
|
535
|
-
flex: 1;
|
|
536
|
-
}
|
|
537
|
-
}
|
|
538
|
-
|
|
539
|
-
// ===== 换行模式(横向) =====
|
|
540
|
-
@include when(wrap) {
|
|
541
|
-
flex-wrap: wrap;
|
|
542
|
-
row-gap: var(--cp-segmented-gap);
|
|
543
|
-
}
|
|
544
|
-
|
|
545
|
-
// ===== 垂直布局 =====
|
|
546
|
-
@include when(vertical) {
|
|
547
|
-
flex-direction: column;
|
|
548
|
-
align-items: stretch;
|
|
549
|
-
|
|
550
|
-
.cp-segmented__item {
|
|
551
|
-
// 垂直布局下选项左对齐,宽度占满
|
|
552
|
-
justify-content: flex-start;
|
|
553
|
-
width: 100%;
|
|
554
|
-
}
|
|
555
|
-
}
|
|
556
|
-
|
|
557
|
-
// ===== 字重切换防止宽度抖动 =====
|
|
558
|
-
// font-variation-settings 的 wght 切换会让文字宽度细微变化,
|
|
559
|
-
// 进而触发 indicator transition 期间宽度计算反复抖动。
|
|
560
|
-
// 用 ::after 隐藏一份激活态字重的同文本,预先撑开稳定占位。
|
|
147
|
+
|
|
148
|
+
// ===== 尺寸 =====
|
|
149
|
+
@include m(sm) {
|
|
150
|
+
--cp-segmented-height: 24px;
|
|
151
|
+
--cp-segmented-font-size: var(--cp-font-size-sm);
|
|
152
|
+
--cp-segmented-item-padding: 0 8px;
|
|
153
|
+
--cp-segmented-padding: 2px;
|
|
154
|
+
--cp-segmented-padding-x: 3px;
|
|
155
|
+
|
|
156
|
+
clip-path: polygon(
|
|
157
|
+
6px 0, 100% 0,
|
|
158
|
+
100% calc(100% - 6px), calc(100% - 6px) 100%,
|
|
159
|
+
0 100%, 0 6px
|
|
160
|
+
);
|
|
161
|
+
|
|
162
|
+
.cp-segmented__indicator {
|
|
163
|
+
clip-path: polygon(
|
|
164
|
+
4px 0, 100% 0,
|
|
165
|
+
100% calc(100% - 4px), calc(100% - 4px) 100%,
|
|
166
|
+
0 100%, 0 4px
|
|
167
|
+
);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
.cp-segmented__item {
|
|
171
|
+
clip-path: polygon(
|
|
172
|
+
4px 0, 100% 0,
|
|
173
|
+
100% calc(100% - 4px), calc(100% - 4px) 100%,
|
|
174
|
+
0 100%, 0 4px
|
|
175
|
+
);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
@include m(md) {
|
|
180
|
+
--cp-segmented-height: 32px;
|
|
181
|
+
--cp-segmented-font-size: var(--cp-font-size-md);
|
|
182
|
+
--cp-segmented-item-padding: 0 12px;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
@include m(lg) {
|
|
186
|
+
--cp-segmented-height: 40px;
|
|
187
|
+
--cp-segmented-font-size: var(--cp-font-size-lg);
|
|
188
|
+
--cp-segmented-item-padding: 0 20px;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
// 自定义尺寸
|
|
192
|
+
@include when(custom-size) {
|
|
193
|
+
// height 通过 CSS 变量注入
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
// ===== Solid 变体 =====
|
|
197
|
+
@include m(solid) {
|
|
198
|
+
@each $type in $segmented-types {
|
|
199
|
+
&.cp-segmented--#{$type} {
|
|
200
|
+
.cp-segmented__indicator {
|
|
201
|
+
background: var(--cp-color-#{$type});
|
|
202
|
+
border-color: var(--cp-color-#{$type});
|
|
203
|
+
box-shadow: 0 0 8px var(--cp-color-#{$type}-light),
|
|
204
|
+
0 0 16px var(--cp-color-#{$type}-light);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
.cp-segmented__item.is-active {
|
|
208
|
+
color: var(--cp-color-#{$type}-text);
|
|
209
|
+
text-shadow: none;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
&.cp-segmented--default {
|
|
215
|
+
.cp-segmented__indicator {
|
|
216
|
+
background: var(--cp-surface-bright);
|
|
217
|
+
border-color: var(--cp-border);
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
.cp-segmented__item.is-active {
|
|
221
|
+
color: var(--cp-text-primary);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
// ===== Outline 变体 =====
|
|
227
|
+
@include m(outline) {
|
|
228
|
+
background: transparent;
|
|
229
|
+
|
|
230
|
+
.cp-segmented__indicator {
|
|
231
|
+
background: transparent;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
@each $type in $segmented-types {
|
|
235
|
+
&.cp-segmented--#{$type} {
|
|
236
|
+
border-color: var(--cp-color-#{$type});
|
|
237
|
+
|
|
238
|
+
.cp-segmented__indicator {
|
|
239
|
+
border-color: var(--cp-color-#{$type});
|
|
240
|
+
background: var(--cp-color-#{$type}-light);
|
|
241
|
+
box-shadow: 0 0 8px var(--cp-color-#{$type}-light);
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
.cp-segmented__item {
|
|
245
|
+
color: var(--cp-color-#{$type});
|
|
246
|
+
|
|
247
|
+
&.is-active {
|
|
248
|
+
color: var(--cp-color-#{$type});
|
|
249
|
+
text-shadow: 0 0 5px var(--cp-color-#{$type});
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
&.cp-segmented--default {
|
|
256
|
+
border-color: var(--cp-border);
|
|
257
|
+
|
|
258
|
+
.cp-segmented__indicator {
|
|
259
|
+
border-color: var(--cp-border);
|
|
260
|
+
background: var(--cp-bg-elevated);
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
.cp-segmented__item.is-active {
|
|
264
|
+
color: var(--cp-text-primary);
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
// ===== Semi 变体 =====
|
|
270
|
+
@include m(semi) {
|
|
271
|
+
background: transparent;
|
|
272
|
+
border-color: transparent;
|
|
273
|
+
|
|
274
|
+
@each $type in $segmented-types {
|
|
275
|
+
&.cp-segmented--#{$type} {
|
|
276
|
+
background: var(--cp-color-#{$type}-light);
|
|
277
|
+
border-color: var(--cp-color-#{$type});
|
|
278
|
+
|
|
279
|
+
.cp-segmented__indicator {
|
|
280
|
+
background: var(--cp-color-#{$type});
|
|
281
|
+
border-color: var(--cp-color-#{$type});
|
|
282
|
+
box-shadow: 0 0 8px var(--cp-color-#{$type}-light);
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
.cp-segmented__item {
|
|
286
|
+
color: var(--cp-color-#{$type});
|
|
287
|
+
|
|
288
|
+
&.is-active {
|
|
289
|
+
color: var(--cp-color-#{$type}-text);
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
&.cp-segmented--default {
|
|
296
|
+
background: color-mix(in srgb, var(--cp-border) 30%, transparent);
|
|
297
|
+
border-color: var(--cp-border);
|
|
298
|
+
|
|
299
|
+
.cp-segmented__indicator {
|
|
300
|
+
background: var(--cp-surface-bright);
|
|
301
|
+
border-color: var(--cp-border);
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
.cp-segmented__item.is-active {
|
|
305
|
+
color: var(--cp-text-primary);
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
// ===== Ghost 变体 =====
|
|
311
|
+
@include m(ghost) {
|
|
312
|
+
background: transparent;
|
|
313
|
+
border-color: transparent;
|
|
314
|
+
clip-path: none;
|
|
315
|
+
padding: 0;
|
|
316
|
+
|
|
317
|
+
.cp-segmented__indicator {
|
|
318
|
+
clip-path: none;
|
|
319
|
+
background: transparent;
|
|
320
|
+
border: none;
|
|
321
|
+
box-shadow: none;
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
@each $type in $segmented-types {
|
|
325
|
+
&.cp-segmented--#{$type} {
|
|
326
|
+
.cp-segmented__indicator {
|
|
327
|
+
background: var(--cp-color-#{$type}-light);
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
.cp-segmented__item {
|
|
331
|
+
color: var(--cp-text-secondary);
|
|
332
|
+
|
|
333
|
+
&.is-active {
|
|
334
|
+
color: var(--cp-color-#{$type});
|
|
335
|
+
text-shadow: 0 0 5px var(--cp-color-#{$type});
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
&:hover:not(.is-disabled):not(.is-active) {
|
|
339
|
+
color: var(--cp-color-#{$type});
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
&.cp-segmented--default {
|
|
346
|
+
.cp-segmented__indicator {
|
|
347
|
+
background: var(--cp-bg-elevated);
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
.cp-segmented__item.is-active {
|
|
351
|
+
color: var(--cp-text-primary);
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
// ===== Neon 变体 =====
|
|
357
|
+
@include m(neon) {
|
|
358
|
+
background: transparent;
|
|
359
|
+
|
|
360
|
+
@each $type in $segmented-types {
|
|
361
|
+
&.cp-segmented--#{$type} {
|
|
362
|
+
border-color: var(--cp-color-#{$type});
|
|
363
|
+
box-shadow: 0 0 4px var(--cp-color-#{$type}-light),
|
|
364
|
+
inset 0 0 4px var(--cp-color-#{$type}-light);
|
|
365
|
+
|
|
366
|
+
.cp-segmented__indicator {
|
|
367
|
+
background: var(--cp-color-#{$type}-light);
|
|
368
|
+
border-color: var(--cp-color-#{$type});
|
|
369
|
+
box-shadow:
|
|
370
|
+
0 0 8px var(--cp-color-#{$type}),
|
|
371
|
+
0 0 20px var(--cp-color-#{$type}-light),
|
|
372
|
+
inset 0 0 6px var(--cp-color-#{$type}-light);
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
.cp-segmented__item {
|
|
376
|
+
color: var(--cp-color-#{$type});
|
|
377
|
+
text-shadow: 0 0 3px var(--cp-color-#{$type});
|
|
378
|
+
|
|
379
|
+
&.is-active {
|
|
380
|
+
color: var(--cp-color-#{$type});
|
|
381
|
+
text-shadow: 0 0 8px var(--cp-color-#{$type});
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
&.cp-segmented--default {
|
|
388
|
+
border-color: var(--cp-border);
|
|
389
|
+
box-shadow: 0 0 4px var(--cp-border);
|
|
390
|
+
|
|
391
|
+
.cp-segmented__indicator {
|
|
392
|
+
background: var(--cp-bg-elevated);
|
|
393
|
+
border-color: var(--cp-border);
|
|
394
|
+
box-shadow: 0 0 8px var(--cp-border);
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
.cp-segmented__item.is-active {
|
|
398
|
+
color: var(--cp-text-primary);
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
// ===== 形状 =====
|
|
404
|
+
// clip 为默认(在基础样式中定义)
|
|
405
|
+
|
|
406
|
+
@include m(shape-no-clip) {
|
|
407
|
+
clip-path: none;
|
|
408
|
+
border-radius: 0;
|
|
409
|
+
|
|
410
|
+
.cp-segmented__indicator {
|
|
411
|
+
clip-path: none;
|
|
412
|
+
border-radius: 0;
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
.cp-segmented__item {
|
|
416
|
+
clip-path: none;
|
|
417
|
+
border-radius: 0;
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
@include m(shape-round) {
|
|
422
|
+
clip-path: none;
|
|
423
|
+
border-radius: var(--cp-radius-lg);
|
|
424
|
+
|
|
425
|
+
.cp-segmented__indicator {
|
|
426
|
+
clip-path: none;
|
|
427
|
+
border-radius: var(--cp-radius-md);
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
.cp-segmented__item {
|
|
431
|
+
clip-path: none;
|
|
432
|
+
border-radius: var(--cp-radius-md);
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
@include m(shape-circle) {
|
|
437
|
+
clip-path: none;
|
|
438
|
+
border-radius: 9999px;
|
|
439
|
+
|
|
440
|
+
.cp-segmented__indicator {
|
|
441
|
+
clip-path: none;
|
|
442
|
+
border-radius: 9999px;
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
.cp-segmented__item {
|
|
446
|
+
clip-path: none;
|
|
447
|
+
border-radius: 9999px;
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
// ===== 自定义颜色 =====
|
|
452
|
+
@include when(custom-color) {
|
|
453
|
+
// Solid
|
|
454
|
+
&.cp-segmented--solid {
|
|
455
|
+
.cp-segmented__indicator {
|
|
456
|
+
background: var(--cp-segmented-color);
|
|
457
|
+
border-color: var(--cp-segmented-color);
|
|
458
|
+
box-shadow: 0 0 8px var(--cp-segmented-color-light),
|
|
459
|
+
0 0 16px var(--cp-segmented-color-light);
|
|
460
|
+
}
|
|
461
|
+
.cp-segmented__item.is-active {
|
|
462
|
+
color: var(--cp-bg-deep);
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
// Outline
|
|
467
|
+
&.cp-segmented--outline {
|
|
468
|
+
border-color: var(--cp-segmented-color);
|
|
469
|
+
|
|
470
|
+
.cp-segmented__indicator {
|
|
471
|
+
border-color: var(--cp-segmented-color);
|
|
472
|
+
background: var(--cp-segmented-color-light);
|
|
473
|
+
box-shadow: 0 0 8px var(--cp-segmented-color-light);
|
|
474
|
+
}
|
|
475
|
+
.cp-segmented__item {
|
|
476
|
+
color: var(--cp-segmented-color);
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
// Semi
|
|
481
|
+
&.cp-segmented--semi {
|
|
482
|
+
background: var(--cp-segmented-color-light);
|
|
483
|
+
border-color: var(--cp-segmented-color);
|
|
484
|
+
|
|
485
|
+
.cp-segmented__indicator {
|
|
486
|
+
background: var(--cp-segmented-color);
|
|
487
|
+
border-color: var(--cp-segmented-color);
|
|
488
|
+
}
|
|
489
|
+
.cp-segmented__item {
|
|
490
|
+
color: var(--cp-segmented-color);
|
|
491
|
+
&.is-active {
|
|
492
|
+
color: var(--cp-bg-deep);
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
// Ghost
|
|
498
|
+
&.cp-segmented--ghost {
|
|
499
|
+
.cp-segmented__indicator {
|
|
500
|
+
background: var(--cp-segmented-color-light);
|
|
501
|
+
}
|
|
502
|
+
.cp-segmented__item.is-active {
|
|
503
|
+
color: var(--cp-segmented-color);
|
|
504
|
+
text-shadow: 0 0 5px var(--cp-segmented-color);
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
// Neon
|
|
509
|
+
&.cp-segmented--neon {
|
|
510
|
+
border-color: var(--cp-segmented-color);
|
|
511
|
+
box-shadow: 0 0 4px var(--cp-segmented-color-light),
|
|
512
|
+
inset 0 0 4px var(--cp-segmented-color-light);
|
|
513
|
+
|
|
514
|
+
.cp-segmented__indicator {
|
|
515
|
+
background: var(--cp-segmented-color-light);
|
|
516
|
+
border-color: var(--cp-segmented-color);
|
|
517
|
+
box-shadow:
|
|
518
|
+
0 0 8px var(--cp-segmented-color),
|
|
519
|
+
0 0 20px var(--cp-segmented-color-light),
|
|
520
|
+
inset 0 0 6px var(--cp-segmented-color-light);
|
|
521
|
+
}
|
|
522
|
+
.cp-segmented__item {
|
|
523
|
+
color: var(--cp-segmented-color);
|
|
524
|
+
text-shadow: 0 0 3px var(--cp-segmented-color);
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
// ===== Block 模式 =====
|
|
530
|
+
@include when(block) {
|
|
531
|
+
display: flex;
|
|
532
|
+
width: 100%;
|
|
533
|
+
|
|
534
|
+
.cp-segmented__item {
|
|
535
|
+
flex: 1;
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
// ===== 换行模式(横向) =====
|
|
540
|
+
@include when(wrap) {
|
|
541
|
+
flex-wrap: wrap;
|
|
542
|
+
row-gap: var(--cp-segmented-gap);
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
// ===== 垂直布局 =====
|
|
546
|
+
@include when(vertical) {
|
|
547
|
+
flex-direction: column;
|
|
548
|
+
align-items: stretch;
|
|
549
|
+
|
|
550
|
+
.cp-segmented__item {
|
|
551
|
+
// 垂直布局下选项左对齐,宽度占满
|
|
552
|
+
justify-content: flex-start;
|
|
553
|
+
width: 100%;
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
// ===== 字重切换防止宽度抖动 =====
|
|
558
|
+
// font-variation-settings 的 wght 切换会让文字宽度细微变化,
|
|
559
|
+
// 进而触发 indicator transition 期间宽度计算反复抖动。
|
|
560
|
+
// 用 ::after 隐藏一份激活态字重的同文本,预先撑开稳定占位。
|
|
561
561
|
@include e(item-label) {
|
|
562
562
|
position: relative;
|
|
563
563
|
|
|
@@ -566,19 +566,19 @@ $segmented-types: (primary, success, warning, error, info);
|
|
|
566
566
|
content: attr(data-label);
|
|
567
567
|
display: block;
|
|
568
568
|
height: 0;
|
|
569
|
-
overflow: hidden;
|
|
570
|
-
visibility: hidden;
|
|
571
|
-
pointer-events: none;
|
|
572
|
-
font-weight: var(--cp-segmented-active-font-weight);
|
|
573
|
-
font-variation-settings: 'wght' var(--cp-segmented-active-font-weight);
|
|
574
|
-
}
|
|
575
|
-
}
|
|
576
|
-
|
|
577
|
-
// ===== 禁用状态 =====
|
|
578
|
-
@include when(disabled) {
|
|
579
|
-
cursor: not-allowed;
|
|
580
|
-
opacity: 0.5;
|
|
581
|
-
filter: grayscale(0.5);
|
|
582
|
-
pointer-events: none;
|
|
583
|
-
}
|
|
584
|
-
}
|
|
569
|
+
overflow: hidden;
|
|
570
|
+
visibility: hidden;
|
|
571
|
+
pointer-events: none;
|
|
572
|
+
font-weight: var(--cp-segmented-active-font-weight);
|
|
573
|
+
font-variation-settings: 'wght' var(--cp-segmented-active-font-weight);
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
// ===== 禁用状态 =====
|
|
578
|
+
@include when(disabled) {
|
|
579
|
+
cursor: not-allowed;
|
|
580
|
+
opacity: 0.5;
|
|
581
|
+
filter: grayscale(0.5);
|
|
582
|
+
pointer-events: none;
|
|
583
|
+
}
|
|
584
|
+
}
|