@w-run/wdesign-ui 0.0.0-stage → 1.0.0
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/README.md +174 -2
- package/dist/index.d.ts +83 -0
- package/dist/style/ai-msg.css +187 -0
- package/dist/style/alert.css +64 -0
- package/dist/style/audio.css +1363 -0
- package/dist/style/avatar.css +88 -0
- package/dist/style/badge.css +48 -0
- package/dist/style/breadcrumb.css +54 -0
- package/dist/style/button.css +234 -0
- package/dist/style/card.css +71 -0
- package/dist/style/carousel.css +101 -0
- package/dist/style/checkbox.css +129 -0
- package/dist/style/chevron.css +33 -0
- package/dist/style/collapse.css +69 -0
- package/dist/style/command.css +201 -0
- package/dist/style/container.css +7 -0
- package/dist/style/datepicker.css +205 -0
- package/dist/style/descriptions.css +119 -0
- package/dist/style/divider.css +62 -0
- package/dist/style/dot.css +30 -0
- package/dist/style/drawer.css +145 -0
- package/dist/style/dropdown.css +83 -0
- package/dist/style/empty.css +36 -0
- package/dist/style/explorer.css +336 -0
- package/dist/style/file-list.css +92 -0
- package/dist/style/form.css +96 -0
- package/dist/style/grid.css +4 -0
- package/dist/style/group.css +478 -0
- package/dist/style/icon-btn.css +75 -0
- package/dist/style/image-preview.css +81 -0
- package/dist/style/input.css +119 -0
- package/dist/style/list.css +81 -0
- package/dist/style/markdown.css +312 -0
- package/dist/style/modal.css +164 -0
- package/dist/style/notification.css +52 -0
- package/dist/style/otp.css +139 -0
- package/dist/style/pagination.css +120 -0
- package/dist/style/popconfirm.css +87 -0
- package/dist/style/popover.css +110 -0
- package/dist/style/post-item.css +134 -0
- package/dist/style/progress.css +34 -0
- package/dist/style/radio.css +126 -0
- package/dist/style/rate.css +44 -0
- package/dist/style/result.css +54 -0
- package/dist/style/segmented-picker.css +120 -0
- package/dist/style/segmented.css +190 -0
- package/dist/style/select.css +281 -0
- package/dist/style/skeleton.css +31 -0
- package/dist/style/slider.css +81 -0
- package/dist/style/sortable.css +128 -0
- package/dist/style/space.css +25 -0
- package/dist/style/spinner.css +27 -0
- package/dist/style/statistic.css +44 -0
- package/dist/style/steps.css +100 -0
- package/dist/style/switch.css +95 -0
- package/dist/style/table.css +379 -0
- package/dist/style/tabs.css +167 -0
- package/dist/style/tag.css +97 -0
- package/dist/style/timeline.css +521 -0
- package/dist/style/toast.css +37 -0
- package/dist/style/tooltip.css +45 -0
- package/dist/style/tree.css +189 -0
- package/dist/style/typography.css +66 -0
- package/dist/style/upload.css +169 -0
- package/dist/style/vlist.css +49 -0
- package/dist/style/vplayer.css +846 -0
- package/dist/wdesign-ui.css +10300 -0
- package/dist/wdesign-ui.esm.js +16333 -0
- package/package.json +47 -3
- package/tokens.json +385 -0
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
@charset "UTF-8";
|
|
2
|
+
.wd-post-item {
|
|
3
|
+
position: relative;
|
|
4
|
+
display: block;
|
|
5
|
+
/* 卡片形态需要占满容器:display:block 在 flex 父级里会按内容收缩,
|
|
6
|
+
导致同一列表里长短不一的卡片宽窄参差 */
|
|
7
|
+
width: 100%;
|
|
8
|
+
box-sizing: border-box;
|
|
9
|
+
padding: 1.35rem 1.5rem;
|
|
10
|
+
border-radius: var(--wd-radius-md);
|
|
11
|
+
background: var(--wd-card);
|
|
12
|
+
box-shadow: var(--wd-shadow-sm);
|
|
13
|
+
transition: transform var(--wd-dur-slow) var(--wd-ease-spring-soft, cubic-bezier(0.34, 1.3, 0.64, 1)), box-shadow var(--wd-dur) var(--wd-ease-out), color var(--wd-dur-slow) var(--wd-ease-smooth, cubic-bezier(0.4, 0, 0.2, 1));
|
|
14
|
+
text-decoration: none;
|
|
15
|
+
color: inherit;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.wd-post-item + .wd-post-item {
|
|
19
|
+
margin-top: 12px;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/* 列表形态:无卡片底,只留底部细线 */
|
|
23
|
+
.wd-post-item--plain {
|
|
24
|
+
padding: 1.55rem 0;
|
|
25
|
+
border-radius: 0;
|
|
26
|
+
background: transparent;
|
|
27
|
+
box-shadow: none;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.wd-post-item--plain + .wd-post-item--plain {
|
|
31
|
+
margin-top: 0;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/* 分隔线(仅 plain 形态) */
|
|
35
|
+
.wd-post-item--plain::after {
|
|
36
|
+
content: "";
|
|
37
|
+
position: absolute;
|
|
38
|
+
left: 0;
|
|
39
|
+
right: 0;
|
|
40
|
+
bottom: 0;
|
|
41
|
+
height: 1px;
|
|
42
|
+
background: var(--wd-ink-5);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/* 红线下划(仅 plain 形态,hover 时从左绘制) */
|
|
46
|
+
.wd-post-item--plain::before {
|
|
47
|
+
content: "";
|
|
48
|
+
position: absolute;
|
|
49
|
+
left: 0;
|
|
50
|
+
bottom: 0;
|
|
51
|
+
width: 100%;
|
|
52
|
+
height: 1px;
|
|
53
|
+
z-index: 1;
|
|
54
|
+
background: var(--wd-red);
|
|
55
|
+
transform: scaleX(0);
|
|
56
|
+
transform-origin: left center;
|
|
57
|
+
transition: transform var(--wd-dur-reveal, 0.45s) var(--wd-ease-out, cubic-bezier(0.16, 1, 0.3, 1));
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
@media (hover: hover) {
|
|
61
|
+
.wd-post-item:hover {
|
|
62
|
+
transform: translateY(-2px);
|
|
63
|
+
box-shadow: var(--wd-shadow-hover);
|
|
64
|
+
}
|
|
65
|
+
.wd-post-item--plain:hover {
|
|
66
|
+
transform: translateX(4px);
|
|
67
|
+
box-shadow: none;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
/* JS 增强(addHover):同一份声明,由 .is-hover 驱动,不受 hover 媒体查询限制 */
|
|
71
|
+
.wd-post-item.is-hover {
|
|
72
|
+
transform: translateY(-2px);
|
|
73
|
+
box-shadow: var(--wd-shadow-hover);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.wd-post-item--plain.is-hover {
|
|
77
|
+
transform: translateX(4px);
|
|
78
|
+
box-shadow: none;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
@media (hover: hover) {
|
|
82
|
+
.wd-post-item:hover::before {
|
|
83
|
+
transform: scaleX(1);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
.wd-post-item.is-hover::before {
|
|
87
|
+
transform: scaleX(1);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
@media (hover: hover) {
|
|
91
|
+
.wd-post-item:hover .wd-post-item__title {
|
|
92
|
+
color: var(--wd-red-text);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
.wd-post-item.is-hover .wd-post-item__title {
|
|
96
|
+
color: var(--wd-red-text);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.wd-post-item:active {
|
|
100
|
+
transform: translateX(2px);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.wd-post-item__title {
|
|
104
|
+
margin: 0;
|
|
105
|
+
font-size: 17px;
|
|
106
|
+
font-weight: 700;
|
|
107
|
+
line-height: 1.45;
|
|
108
|
+
letter-spacing: -0.01em;
|
|
109
|
+
color: var(--wd-ink);
|
|
110
|
+
transition: color var(--wd-dur-slow) var(--wd-ease-smooth, cubic-bezier(0.4, 0, 0.2, 1));
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.wd-post-item__emoji {
|
|
114
|
+
margin-right: 0.45rem;
|
|
115
|
+
font-size: 16px;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.wd-post-item__summary {
|
|
119
|
+
margin: 0.45rem 0 0;
|
|
120
|
+
font-size: 13.5px;
|
|
121
|
+
line-height: 1.68;
|
|
122
|
+
color: var(--wd-ink-2);
|
|
123
|
+
display: -webkit-box;
|
|
124
|
+
-webkit-line-clamp: 2;
|
|
125
|
+
-webkit-box-orient: vertical;
|
|
126
|
+
overflow: hidden;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.wd-post-item__tags {
|
|
130
|
+
display: flex;
|
|
131
|
+
gap: 0.4rem;
|
|
132
|
+
margin-top: 0.75rem;
|
|
133
|
+
flex-wrap: wrap;
|
|
134
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
@charset "UTF-8";
|
|
2
|
+
/*
|
|
3
|
+
* 进度色可配置:`--wd-progress-color`,默认主题红。
|
|
4
|
+
* 派生色(深色卡内)也用 color-mix 从它算,换色时自动跟随。
|
|
5
|
+
*/
|
|
6
|
+
.wd-progress {
|
|
7
|
+
--wd-progress-color: var(--wd-red);
|
|
8
|
+
height: 10px;
|
|
9
|
+
width: 100%;
|
|
10
|
+
border-radius: var(--wd-radius-pill);
|
|
11
|
+
background: var(--wd-ink-5);
|
|
12
|
+
overflow: hidden;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.wd-progress--thin {
|
|
16
|
+
height: 6px;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.wd-progress__bar {
|
|
20
|
+
display: block;
|
|
21
|
+
height: 100%;
|
|
22
|
+
border-radius: var(--wd-radius-pill);
|
|
23
|
+
background: var(--wd-progress-color);
|
|
24
|
+
transition: width 0.3s ease;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.wd-progress--on-dark {
|
|
28
|
+
background: var(--wd-dark-track);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.wd-progress--on-dark .wd-progress__bar {
|
|
32
|
+
/* 深底上提亮,而不是换成固定的 --wd-red-on-dark —— 自定义色也要跟随 */
|
|
33
|
+
background: color-mix(in srgb, var(--wd-progress-color) 78%, #fff);
|
|
34
|
+
}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
@charset "UTF-8";
|
|
2
|
+
.wd-radio-group {
|
|
3
|
+
display: flex;
|
|
4
|
+
flex-wrap: wrap;
|
|
5
|
+
gap: 22px;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.wd-radio {
|
|
9
|
+
display: inline-flex;
|
|
10
|
+
align-items: center;
|
|
11
|
+
gap: 10px;
|
|
12
|
+
border: 0;
|
|
13
|
+
background: transparent;
|
|
14
|
+
padding: 0;
|
|
15
|
+
cursor: pointer;
|
|
16
|
+
font: inherit;
|
|
17
|
+
font-size: 14.5px;
|
|
18
|
+
color: var(--wd-ink);
|
|
19
|
+
user-select: none;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.wd-radio:focus-visible {
|
|
23
|
+
outline: none;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.wd-radio:focus-visible .wd-radio__dot {
|
|
27
|
+
box-shadow: 0 0 0 4px var(--wd-focus-ring-soft);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.wd-radio__dot {
|
|
31
|
+
width: 24px;
|
|
32
|
+
height: 24px;
|
|
33
|
+
flex: none;
|
|
34
|
+
border-radius: 50%;
|
|
35
|
+
background: var(--wd-field);
|
|
36
|
+
display: inline-flex;
|
|
37
|
+
align-items: center;
|
|
38
|
+
justify-content: center;
|
|
39
|
+
transition: background var(--wd-dur-fast) ease;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
@media (hover: hover) {
|
|
43
|
+
.wd-radio:hover .wd-radio__dot {
|
|
44
|
+
background: var(--wd-tint-1);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
/* JS 增强(addHover):同一份声明,由 .is-hover 驱动,不受 hover 媒体查询限制 */
|
|
48
|
+
.wd-radio.is-hover .wd-radio__dot {
|
|
49
|
+
background: var(--wd-tint-1);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.wd-radio__inner {
|
|
53
|
+
width: 11px;
|
|
54
|
+
height: 11px;
|
|
55
|
+
border-radius: 50%;
|
|
56
|
+
background: #fff;
|
|
57
|
+
transform: scale(0);
|
|
58
|
+
transition: transform var(--wd-dur-fast) ease;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/* 单选同样用深色:见 checkbox 的说明 */
|
|
62
|
+
/* 与 checkbox 共用同一套可配色变量约定 */
|
|
63
|
+
.wd-radio {
|
|
64
|
+
--wd-check-color: var(--wd-ink);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.wd-radio--checked .wd-radio__dot {
|
|
68
|
+
background: var(--wd-check-color);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
@media (hover: hover) {
|
|
72
|
+
.wd-radio--checked:hover .wd-radio__dot {
|
|
73
|
+
background: color-mix(in srgb, var(--wd-check-color) 82%, #000);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
.wd-radio--checked.is-hover .wd-radio__dot {
|
|
77
|
+
background: color-mix(in srgb, var(--wd-check-color) 82%, #000);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.wd-radio--checked .wd-radio__inner {
|
|
81
|
+
transform: scale(1);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.wd-radio--disabled {
|
|
85
|
+
cursor: default;
|
|
86
|
+
color: var(--wd-ink-3);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
@media (hover: hover) {
|
|
90
|
+
.wd-radio--disabled:hover .wd-radio__dot {
|
|
91
|
+
background: var(--wd-field);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
.wd-radio--disabled.is-hover .wd-radio__dot {
|
|
95
|
+
background: var(--wd-field);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.wd-radio--disabled .wd-radio__inner {
|
|
99
|
+
background: var(--wd-ink-3);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/* ---- 微交互(精致版)---- */
|
|
103
|
+
.wd-radio--checked .wd-radio__inner {
|
|
104
|
+
animation: wd-radio-dot var(--wd-dur-slow) var(--wd-ease-spring) forwards;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/* 选中瞬间:外圈轻震一下 */
|
|
108
|
+
.wd-radio--checked .wd-radio__dot {
|
|
109
|
+
animation: wd-ring-out var(--wd-dur-slow) var(--wd-ease-out);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.wd-radio__dot {
|
|
113
|
+
transition: background var(--wd-dur-fast) ease, transform var(--wd-dur) var(--wd-ease-out);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.wd-radio:active .wd-radio__dot {
|
|
117
|
+
transform: scale(0.94);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/* 单选项的文字标签(模板里一直在用,样式从未定义) */
|
|
121
|
+
.wd-radio__label {
|
|
122
|
+
min-width: 0;
|
|
123
|
+
overflow: hidden;
|
|
124
|
+
text-overflow: ellipsis;
|
|
125
|
+
white-space: nowrap;
|
|
126
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
@charset "UTF-8";
|
|
2
|
+
.wd-rate {
|
|
3
|
+
display: inline-flex;
|
|
4
|
+
align-items: center;
|
|
5
|
+
gap: 4px;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.wd-rate__item {
|
|
9
|
+
border: 0;
|
|
10
|
+
background: transparent;
|
|
11
|
+
padding: 2px;
|
|
12
|
+
cursor: pointer;
|
|
13
|
+
display: inline-flex;
|
|
14
|
+
/* 未选中色可配,默认中性灰 */
|
|
15
|
+
color: var(--rate-color-off, var(--wd-field-hover));
|
|
16
|
+
transition: transform var(--wd-dur) var(--wd-ease-out), color var(--wd-dur-fast) var(--wd-ease-out);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/* 悬停放大只对支持悬停的设备生效——触屏上 pointerenter 不会随手指离开复位,
|
|
20
|
+
放大态会粘住(移动端「点一下星就一直是放大的」的观感问题)。 */
|
|
21
|
+
@media (hover: hover) and (pointer: fine) {
|
|
22
|
+
.wd-rate__item:hover {
|
|
23
|
+
transform: scale(1.08);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
/* JS 增强(addHover):同一份声明,由 .is-hover 驱动,不受 hover 媒体查询限制 */
|
|
27
|
+
.wd-rate__item.is-hover {
|
|
28
|
+
transform: scale(1.08);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.wd-rate__item:focus-visible {
|
|
32
|
+
outline: none;
|
|
33
|
+
border-radius: var(--wd-radius-xs);
|
|
34
|
+
box-shadow: 0 0 0 3px var(--wd-focus-ring-soft);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.wd-rate__item--on {
|
|
38
|
+
color: var(--rate-color, var(--wd-red));
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.wd-rate--disabled {
|
|
42
|
+
pointer-events: none;
|
|
43
|
+
opacity: 0.6;
|
|
44
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
.wd-result {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
align-items: center;
|
|
5
|
+
text-align: center;
|
|
6
|
+
padding: 48px 24px;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.wd-result__icon {
|
|
10
|
+
width: 76px;
|
|
11
|
+
height: 76px;
|
|
12
|
+
margin-bottom: 18px;
|
|
13
|
+
border-radius: 50%;
|
|
14
|
+
display: flex;
|
|
15
|
+
align-items: center;
|
|
16
|
+
justify-content: center;
|
|
17
|
+
background: var(--wd-field);
|
|
18
|
+
color: var(--wd-ink-2);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.wd-result--success .wd-result__icon {
|
|
22
|
+
background: var(--wd-success-soft);
|
|
23
|
+
color: var(--wd-success-ink);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.wd-result--warning .wd-result__icon {
|
|
27
|
+
background: var(--wd-warning-soft);
|
|
28
|
+
color: var(--wd-warning-ink);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.wd-result--error .wd-result__icon {
|
|
32
|
+
background: var(--wd-tint-2);
|
|
33
|
+
color: var(--wd-red-text);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.wd-result__title {
|
|
37
|
+
font-size: 19px;
|
|
38
|
+
font-weight: 800;
|
|
39
|
+
letter-spacing: -0.01em;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.wd-result__desc {
|
|
43
|
+
margin-top: 8px;
|
|
44
|
+
font-size: 14px;
|
|
45
|
+
color: var(--wd-ink-2);
|
|
46
|
+
max-width: 440px;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.wd-result__extra {
|
|
50
|
+
margin-top: 22px;
|
|
51
|
+
display: flex;
|
|
52
|
+
gap: 10px;
|
|
53
|
+
justify-content: center;
|
|
54
|
+
}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
@charset "UTF-8";
|
|
2
|
+
.wd-segmented-picker {
|
|
3
|
+
position: relative;
|
|
4
|
+
display: inline-block;
|
|
5
|
+
min-width: 168px;
|
|
6
|
+
max-width: 100%;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.wd-segmented-picker__trigger {
|
|
10
|
+
display: inline-flex;
|
|
11
|
+
align-items: center;
|
|
12
|
+
gap: 0.55rem;
|
|
13
|
+
width: 100%;
|
|
14
|
+
padding: 0.65rem 0.9rem 0.65rem 1rem;
|
|
15
|
+
font: inherit;
|
|
16
|
+
font-size: 13.5px;
|
|
17
|
+
font-weight: 600;
|
|
18
|
+
color: var(--wd-ink);
|
|
19
|
+
background: var(--wd-field);
|
|
20
|
+
border: none;
|
|
21
|
+
border-radius: var(--wd-radius-pill);
|
|
22
|
+
cursor: pointer;
|
|
23
|
+
-webkit-tap-highlight-color: transparent;
|
|
24
|
+
transition: background-color var(--wd-dur-fast, 0.18s) var(--wd-ease-smooth, cubic-bezier(0.4, 0, 0.2, 1));
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
@media (hover: hover) {
|
|
28
|
+
.wd-segmented-picker__trigger:hover {
|
|
29
|
+
background: var(--wd-field-hover);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
.wd-segmented-picker__trigger.is-hover {
|
|
33
|
+
background: var(--wd-field-hover);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.wd-segmented-picker__trigger:focus-visible {
|
|
37
|
+
outline: 2px solid var(--wd-red);
|
|
38
|
+
outline-offset: 2px;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.wd-segmented-picker__label {
|
|
42
|
+
overflow: hidden;
|
|
43
|
+
text-overflow: ellipsis;
|
|
44
|
+
white-space: nowrap;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.wd-segmented-picker__meta {
|
|
48
|
+
font-size: 11px;
|
|
49
|
+
font-weight: 700;
|
|
50
|
+
color: var(--wd-ink-2);
|
|
51
|
+
font-variant-numeric: tabular-nums;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.wd-segmented-picker__caret {
|
|
55
|
+
margin-left: auto;
|
|
56
|
+
color: var(--wd-ink-2);
|
|
57
|
+
transition: transform var(--wd-dur-fast, 0.18s) var(--wd-ease-smooth, cubic-bezier(0.4, 0, 0.2, 1));
|
|
58
|
+
flex: none;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.wd-segmented-picker__caret.is-open {
|
|
62
|
+
transform: rotate(180deg);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/* 面板(跟 WdDropdown 视觉同源) */
|
|
66
|
+
.wd-segmented-picker__panel {
|
|
67
|
+
position: absolute;
|
|
68
|
+
top: calc(100% + 6px);
|
|
69
|
+
left: 0;
|
|
70
|
+
min-width: 100%;
|
|
71
|
+
max-width: min(320px, 88vw);
|
|
72
|
+
max-height: min(320px, 60vh);
|
|
73
|
+
overflow-y: auto;
|
|
74
|
+
overscroll-behavior: contain;
|
|
75
|
+
padding: 8px;
|
|
76
|
+
background: var(--wd-card);
|
|
77
|
+
border-radius: var(--wd-radius-md, 14px);
|
|
78
|
+
box-shadow: var(--wd-shadow-hover, 0 12px 32px rgba(14, 15, 19, 0.14));
|
|
79
|
+
z-index: 60;
|
|
80
|
+
scrollbar-width: thin;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.wd-segmented-picker__option {
|
|
84
|
+
display: flex;
|
|
85
|
+
align-items: center;
|
|
86
|
+
justify-content: space-between;
|
|
87
|
+
gap: 0.75rem;
|
|
88
|
+
width: 100%;
|
|
89
|
+
padding: 0.5rem 0.7rem;
|
|
90
|
+
font: inherit;
|
|
91
|
+
font-size: 13.5px;
|
|
92
|
+
font-weight: 500;
|
|
93
|
+
text-align: left;
|
|
94
|
+
color: var(--wd-ink);
|
|
95
|
+
background: none;
|
|
96
|
+
border: none;
|
|
97
|
+
border-radius: var(--wd-radius-xs);
|
|
98
|
+
cursor: pointer;
|
|
99
|
+
-webkit-tap-highlight-color: transparent;
|
|
100
|
+
transition: background-color var(--wd-dur-fast, 0.18s) var(--wd-ease-smooth, cubic-bezier(0.4, 0, 0.2, 1));
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
@media (hover: hover) {
|
|
104
|
+
.wd-segmented-picker__option:hover {
|
|
105
|
+
background: var(--wd-field);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
.wd-segmented-picker__option.is-hover {
|
|
109
|
+
background: var(--wd-field);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.wd-segmented-picker__option--active {
|
|
113
|
+
color: var(--wd-red);
|
|
114
|
+
font-weight: 700;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.wd-segmented-picker__option--active svg {
|
|
118
|
+
color: var(--wd-red);
|
|
119
|
+
flex: none;
|
|
120
|
+
}
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
@charset "UTF-8";
|
|
2
|
+
.wd-segmented {
|
|
3
|
+
position: relative;
|
|
4
|
+
display: inline-flex;
|
|
5
|
+
gap: 4px;
|
|
6
|
+
padding: 5px;
|
|
7
|
+
background: var(--wd-field);
|
|
8
|
+
border-radius: var(--wd-radius-pill);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.wd-segmented--block {
|
|
12
|
+
display: flex;
|
|
13
|
+
width: 100%;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.wd-segmented--block .wd-segmented__item {
|
|
17
|
+
flex: 1;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.wd-segmented__slider {
|
|
21
|
+
position: absolute;
|
|
22
|
+
top: 5px;
|
|
23
|
+
bottom: 5px;
|
|
24
|
+
left: 0;
|
|
25
|
+
z-index: 0;
|
|
26
|
+
border-radius: var(--wd-radius-pill);
|
|
27
|
+
background: var(--wd-card);
|
|
28
|
+
box-shadow: var(--wd-shadow-sm);
|
|
29
|
+
transition: transform var(--wd-dur-slow) cubic-bezier(0.25, 0.8, 0.35, 1), width var(--wd-dur-slow) cubic-bezier(0.25, 0.8, 0.35, 1), height var(--wd-dur-slow) cubic-bezier(0.25, 0.8, 0.35, 1);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/*
|
|
33
|
+
* 首帧落位:禁用过渡。
|
|
34
|
+
* 页面加载时滑块初始在 x=0,首次设置 transform 若有过渡,
|
|
35
|
+
* 会看到"从左滑进来"的动画 —— 那是初始状态,不该有过渡。
|
|
36
|
+
* 定位完成后由 JS 移除该类,后续切换恢复正常动画。
|
|
37
|
+
*/
|
|
38
|
+
.wd-segmented__slider.is-initial {
|
|
39
|
+
transition: none;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.wd-segmented--dark {
|
|
43
|
+
background: var(--wd-dark-2);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.wd-segmented--dark .wd-segmented__item {
|
|
47
|
+
color: var(--wd-on-dark);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
@media (hover: hover) {
|
|
51
|
+
.wd-segmented--dark .wd-segmented__item:hover {
|
|
52
|
+
color: #fff;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
/* JS 增强(addHover):同一份声明,由 .is-hover 驱动,不受 hover 媒体查询限制 */
|
|
56
|
+
.wd-segmented--dark .wd-segmented__item.is-hover {
|
|
57
|
+
color: #fff;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.wd-segmented--dark .wd-segmented__slider {
|
|
61
|
+
background: var(--wd-dark);
|
|
62
|
+
box-shadow: none;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.wd-segmented__item {
|
|
66
|
+
position: relative;
|
|
67
|
+
z-index: 1;
|
|
68
|
+
display: inline-flex;
|
|
69
|
+
align-items: center;
|
|
70
|
+
justify-content: center;
|
|
71
|
+
gap: 7px;
|
|
72
|
+
padding: 9px 18px;
|
|
73
|
+
border: 0;
|
|
74
|
+
border-radius: var(--wd-radius-pill);
|
|
75
|
+
background: transparent;
|
|
76
|
+
font: inherit;
|
|
77
|
+
font-size: 14px;
|
|
78
|
+
font-weight: 600;
|
|
79
|
+
color: var(--wd-ink-2);
|
|
80
|
+
cursor: pointer;
|
|
81
|
+
transition: color var(--wd-dur-fast) ease;
|
|
82
|
+
white-space: nowrap;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
@media (hover: hover) {
|
|
86
|
+
.wd-segmented__item:hover {
|
|
87
|
+
color: var(--wd-ink);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
.wd-segmented__item.is-hover {
|
|
91
|
+
color: var(--wd-ink);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.wd-segmented__item:focus-visible {
|
|
95
|
+
outline: none;
|
|
96
|
+
box-shadow: 0 0 0 4px var(--wd-focus-ring-soft);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.wd-segmented__item--active {
|
|
100
|
+
color: var(--wd-ink);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.wd-segmented--dark .wd-segmented__item--active {
|
|
104
|
+
color: var(--wd-dark-text);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
@media (hover: hover) {
|
|
108
|
+
.wd-segmented--dark .wd-segmented__item--active:hover {
|
|
109
|
+
color: var(--wd-dark-text);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
.wd-segmented--dark .wd-segmented__item--active.is-hover {
|
|
113
|
+
color: var(--wd-dark-text);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/* =============================================================
|
|
117
|
+
* 溢出模式:单行横向滚动(选项多时)
|
|
118
|
+
* · 隐藏滚动条
|
|
119
|
+
* · 两端渐隐提示(仅在对应方向还有内容时出现)
|
|
120
|
+
* · 选中项自动滚入视野(JS 负责)
|
|
121
|
+
* ============================================================= */
|
|
122
|
+
.wd-segmented-wrap {
|
|
123
|
+
display: inline-block;
|
|
124
|
+
max-width: 100%;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/* auto 模式:wrap 撑满容器宽度(块级),track 不超出 —— 供 JS 量取真实可用宽度 */
|
|
128
|
+
.wd-segmented-wrap--auto {
|
|
129
|
+
display: block;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
.wd-segmented-wrap--auto .wd-segmented {
|
|
133
|
+
max-width: 100%;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.wd-segmented-wrap--scroll {
|
|
137
|
+
display: block;
|
|
138
|
+
overflow: hidden; /* 裁掉滚动区的溢出,渐隐才贴合边缘 */
|
|
139
|
+
border-radius: var(--wd-radius-pill);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.wd-segmented-wrap--scroll .wd-segmented {
|
|
143
|
+
display: flex;
|
|
144
|
+
flex-wrap: nowrap;
|
|
145
|
+
overflow-x: auto;
|
|
146
|
+
overflow-y: hidden;
|
|
147
|
+
scrollbar-width: none; /* Firefox */
|
|
148
|
+
-webkit-overflow-scrolling: touch;
|
|
149
|
+
scroll-behavior: smooth;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.wd-segmented-wrap--scroll .wd-segmented::-webkit-scrollbar {
|
|
153
|
+
display: none; /* WebKit */
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/* 两端渐隐:用 mask 让内容淡出,而非盖一层色块(不挑背景色) */
|
|
157
|
+
.wd-segmented-wrap--scroll.wd-segmented-wrap--fade-l .wd-segmented {
|
|
158
|
+
mask-image: linear-gradient(to right, transparent 0, #000 28px);
|
|
159
|
+
-webkit-mask-image: linear-gradient(to right, transparent 0, #000 28px);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
.wd-segmented-wrap--scroll.wd-segmented-wrap--fade-r .wd-segmented {
|
|
163
|
+
mask-image: linear-gradient(to left, transparent 0, #000 28px);
|
|
164
|
+
-webkit-mask-image: linear-gradient(to left, transparent 0, #000 28px);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.wd-segmented-wrap--scroll.wd-segmented-wrap--fade-l.wd-segmented-wrap--fade-r .wd-segmented {
|
|
168
|
+
mask-image: linear-gradient(to right, transparent 0, #000 28px, #000 calc(100% - 28px), transparent 100%);
|
|
169
|
+
-webkit-mask-image: linear-gradient(to right, transparent 0, #000 28px, #000 calc(100% - 28px), transparent 100%);
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/* 滚动模式下不换行 */
|
|
173
|
+
.wd-segmented-wrap--scroll .wd-segmented__item {
|
|
174
|
+
flex: none;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/* =============================================================
|
|
178
|
+
* 下拉降级(auto 模式,选项过多)
|
|
179
|
+
* ============================================================= */
|
|
180
|
+
/* 测量态:track 移出视觉流但仍参与布局,供 JS 量取真实宽度 */
|
|
181
|
+
.wd-segmented-wrap--measuring .wd-segmented {
|
|
182
|
+
position: absolute;
|
|
183
|
+
left: 0;
|
|
184
|
+
right: 0;
|
|
185
|
+
top: 0;
|
|
186
|
+
height: 0;
|
|
187
|
+
overflow: hidden;
|
|
188
|
+
visibility: hidden;
|
|
189
|
+
pointer-events: none;
|
|
190
|
+
}
|