@zhang_jifan/fanui 2.1.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/ACCESSIBILITY.md +61 -0
- package/CHANGELOG.md +112 -0
- package/COMMERCIAL-LICENSE.md +71 -0
- package/DESIGN-SYSTEM.md +294 -0
- package/LICENSE +661 -0
- package/README.md +348 -0
- package/USAGE.md +1926 -0
- package/_index.scss +20 -0
- package/dist/fanui.cjs +15 -0
- package/dist/fanui.css +28209 -0
- package/dist/fanui.d.ts +353 -0
- package/dist/fanui.esm.js +71 -0
- package/dist/fanui.js +4782 -0
- package/dist/fanui.min.css +1 -0
- package/dist/fanui.mjs +71 -0
- package/dist/modules/fanui-advanced.css +830 -0
- package/dist/modules/fanui-advanced.min.css +129 -0
- package/dist/modules/fanui-alert.css +575 -0
- package/dist/modules/fanui-alert.min.css +122 -0
- package/dist/modules/fanui-badge.css +426 -0
- package/dist/modules/fanui-badge.min.css +77 -0
- package/dist/modules/fanui-base.css +1394 -0
- package/dist/modules/fanui-base.min.css +236 -0
- package/dist/modules/fanui-blog.css +762 -0
- package/dist/modules/fanui-blog.min.css +108 -0
- package/dist/modules/fanui-button.css +526 -0
- package/dist/modules/fanui-button.min.css +56 -0
- package/dist/modules/fanui-card.css +291 -0
- package/dist/modules/fanui-card.min.css +52 -0
- package/dist/modules/fanui-choice.css +539 -0
- package/dist/modules/fanui-choice.min.css +83 -0
- package/dist/modules/fanui-dashboard.css +1057 -0
- package/dist/modules/fanui-dashboard.min.css +160 -0
- package/dist/modules/fanui-data.css +687 -0
- package/dist/modules/fanui-data.min.css +125 -0
- package/dist/modules/fanui-feedback.css +432 -0
- package/dist/modules/fanui-feedback.min.css +79 -0
- package/dist/modules/fanui-form.css +779 -0
- package/dist/modules/fanui-form.min.css +123 -0
- package/dist/modules/fanui-glass.css +497 -0
- package/dist/modules/fanui-glass.min.css +46 -0
- package/dist/modules/fanui-input-plus.css +799 -0
- package/dist/modules/fanui-input-plus.min.css +124 -0
- package/dist/modules/fanui-interactive.css +960 -0
- package/dist/modules/fanui-interactive.min.css +138 -0
- package/dist/modules/fanui-layout.css +4399 -0
- package/dist/modules/fanui-layout.min.css +1172 -0
- package/dist/modules/fanui-marketing.css +1125 -0
- package/dist/modules/fanui-marketing.min.css +144 -0
- package/dist/modules/fanui-nav.css +458 -0
- package/dist/modules/fanui-nav.min.css +76 -0
- package/dist/modules/fanui-overlay.css +547 -0
- package/dist/modules/fanui-overlay.min.css +91 -0
- package/dist/modules/fanui-table.css +290 -0
- package/dist/modules/fanui-table.min.css +62 -0
- package/dist/modules/fanui-tabs.css +333 -0
- package/dist/modules/fanui-tabs.min.css +58 -0
- package/dist/modules/fanui-themes.css +2728 -0
- package/dist/modules/fanui-themes.min.css +40 -0
- package/dist/modules/fanui-tokens.css +587 -0
- package/dist/modules/fanui-tokens.min.css +3 -0
- package/dist/modules/fanui-utilities.css +6557 -0
- package/dist/modules/fanui-utilities.min.css +1762 -0
- package/dist/modules/sizes.json +103 -0
- package/docs/MIGRATION-v2.md +179 -0
- package/examples/01-script-tag.html +149 -0
- package/examples/02-react/README.md +39 -0
- package/examples/02-react/index.html +12 -0
- package/examples/02-react/package.json +20 -0
- package/examples/02-react/src/App.jsx +108 -0
- package/examples/02-react/src/main.jsx +13 -0
- package/examples/02-react/src/useFanUI.js +87 -0
- package/examples/02-react/vite.config.js +6 -0
- package/examples/03-vue3/README.md +67 -0
- package/examples/03-vue3/index.html +12 -0
- package/examples/03-vue3/package.json +19 -0
- package/examples/03-vue3/src/App.vue +93 -0
- package/examples/03-vue3/src/main.js +8 -0
- package/examples/03-vue3/src/useFanUI.js +85 -0
- package/examples/03-vue3/vite.config.js +6 -0
- package/examples/04-vue2-cdn.html +93 -0
- package/examples/README.md +34 -0
- package/package.json +127 -0
- package/src/_functions.scss +319 -0
- package/src/_mixins.scss +1202 -0
- package/src/_tokens.scss +180 -0
- package/src/_variables.scss +491 -0
- package/src/base/_animations.scss +210 -0
- package/src/base/_reset.scss +359 -0
- package/src/base/_rtl.scss +133 -0
- package/src/base/_typography.scss +353 -0
- package/src/components/_advanced.scss +763 -0
- package/src/components/_alert.scss +322 -0
- package/src/components/_badge.scss +279 -0
- package/src/components/_blog.scss +693 -0
- package/src/components/_button.scss +351 -0
- package/src/components/_capabilities.scss +463 -0
- package/src/components/_card.scss +281 -0
- package/src/components/_choice.scss +444 -0
- package/src/components/_dashboard.scss +950 -0
- package/src/components/_data.scss +618 -0
- package/src/components/_feedback.scss +403 -0
- package/src/components/_form.scss +408 -0
- package/src/components/_glass.scss +374 -0
- package/src/components/_input-plus.scss +730 -0
- package/src/components/_interactive.scss +885 -0
- package/src/components/_marketing.scss +982 -0
- package/src/components/_nav.scss +480 -0
- package/src/components/_overlay.scss +517 -0
- package/src/components/_table.scss +276 -0
- package/src/components/_tabs.scss +338 -0
- package/src/fanui.d.ts +353 -0
- package/src/fanui.js +4782 -0
- package/src/fanui.scss +79 -0
- package/src/glass/_switches.scss +36 -0
- package/src/glass/_tokens.scss +259 -0
- package/src/layout/_container.scss +111 -0
- package/src/layout/_flex.scss +164 -0
- package/src/layout/_grid.scss +180 -0
- package/src/themes/_accents.scss +201 -0
- package/src/themes/_palettes.scss +180 -0
- package/src/utilities/_borders.scss +104 -0
- package/src/utilities/_display.scss +145 -0
- package/src/utilities/_effects.scss +210 -0
- package/src/utilities/_sizing.scss +123 -0
- package/src/utilities/_spacing.scss +118 -0
- package/src/utilities/_texture.scss +323 -0
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
// =============================================================================
|
|
2
|
+
// fanUI · 卡片 Card / 面板 Panel
|
|
3
|
+
// -----------------------------------------------------------------------------
|
|
4
|
+
// .fanui-card 基础卡片
|
|
5
|
+
// .fanui-card__header / __body / __footer / __media / __title / __subtitle
|
|
6
|
+
// .fanui-card--interactive 可点击卡片(hover 抬升)
|
|
7
|
+
// .fanui-card--flat|outlined|elevated|bordered
|
|
8
|
+
// .fanui-card--horizontal 图文左右布局
|
|
9
|
+
// .fanui-card--<semantic> 语义描边(primary/success/...)
|
|
10
|
+
// =============================================================================
|
|
11
|
+
|
|
12
|
+
@use "sass:map";
|
|
13
|
+
@use "../functions" as fn;
|
|
14
|
+
@use "../variables" as v;
|
|
15
|
+
@use "../mixins" as mx;
|
|
16
|
+
|
|
17
|
+
.fanui-card {
|
|
18
|
+
--fanui-card-padding: #{fn.fanui-var("space-5")};
|
|
19
|
+
--fanui-card-radius: #{fn.fanui-var("radius-lg")};
|
|
20
|
+
--fanui-card-bg: #{fn.fanui-var("color-surface")};
|
|
21
|
+
--fanui-card-border: #{fn.fanui-var("color-border")};
|
|
22
|
+
|
|
23
|
+
position: relative;
|
|
24
|
+
display: flex;
|
|
25
|
+
flex-direction: column;
|
|
26
|
+
min-width: 0;
|
|
27
|
+
background-color: var(--fanui-card-bg);
|
|
28
|
+
border: 1px solid var(--fanui-card-border);
|
|
29
|
+
border-radius: var(--fanui-card-radius);
|
|
30
|
+
box-shadow: fn.fanui-var("shadow-sm");
|
|
31
|
+
box-sizing: border-box;
|
|
32
|
+
@include mx.fanui-transition((box-shadow, border-color, transform, background-color), v.$fanui-duration-base);
|
|
33
|
+
|
|
34
|
+
// ---- 结构元素 ----
|
|
35
|
+
&__header {
|
|
36
|
+
display: flex;
|
|
37
|
+
align-items: center;
|
|
38
|
+
justify-content: space-between;
|
|
39
|
+
gap: fn.fanui-var("space-3");
|
|
40
|
+
padding: var(--fanui-card-padding);
|
|
41
|
+
border-bottom: 1px solid var(--fanui-card-border);
|
|
42
|
+
flex: 0 0 auto;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
&__title {
|
|
46
|
+
margin: 0;
|
|
47
|
+
font-size: fn.fanui-var("font-size-md");
|
|
48
|
+
font-weight: 600;
|
|
49
|
+
line-height: 1.4;
|
|
50
|
+
color: fn.fanui-var("color-text-strong");
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
&__subtitle {
|
|
54
|
+
margin: 2px 0 0;
|
|
55
|
+
font-size: fn.fanui-var("font-size-sm");
|
|
56
|
+
font-weight: 400;
|
|
57
|
+
color: fn.fanui-var("color-text-muted");
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
&__extra {
|
|
61
|
+
flex: 0 0 auto;
|
|
62
|
+
display: flex;
|
|
63
|
+
align-items: center;
|
|
64
|
+
gap: fn.fanui-var("space-2");
|
|
65
|
+
color: fn.fanui-var("color-text-muted");
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
&__body {
|
|
69
|
+
flex: 1 1 auto;
|
|
70
|
+
padding: var(--fanui-card-padding);
|
|
71
|
+
min-width: 0;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
&__footer {
|
|
75
|
+
display: flex;
|
|
76
|
+
align-items: center;
|
|
77
|
+
justify-content: flex-end;
|
|
78
|
+
gap: fn.fanui-var("space-3");
|
|
79
|
+
padding: var(--fanui-card-padding);
|
|
80
|
+
border-top: 1px solid var(--fanui-card-border);
|
|
81
|
+
flex: 0 0 auto;
|
|
82
|
+
|
|
83
|
+
&--start { justify-content: flex-start; }
|
|
84
|
+
&--between { justify-content: space-between; }
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
&__media {
|
|
88
|
+
position: relative;
|
|
89
|
+
flex: 0 0 auto;
|
|
90
|
+
overflow: hidden;
|
|
91
|
+
border-radius: var(--fanui-card-radius) var(--fanui-card-radius) 0 0;
|
|
92
|
+
background-color: fn.fanui-var("color-surface-sunken");
|
|
93
|
+
|
|
94
|
+
> img,
|
|
95
|
+
> video {
|
|
96
|
+
width: 100%;
|
|
97
|
+
height: 100%;
|
|
98
|
+
object-fit: cover;
|
|
99
|
+
display: block;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// 无内边距的结构体
|
|
104
|
+
&__body--flush { padding: 0; }
|
|
105
|
+
&__body--tight { padding: fn.fanui-var("space-3"); }
|
|
106
|
+
&__body--loose { padding: fn.fanui-var("space-8"); }
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// -----------------------------------------------------------------------------
|
|
110
|
+
// 1. 外观变体
|
|
111
|
+
// -----------------------------------------------------------------------------
|
|
112
|
+
|
|
113
|
+
.fanui-card--flat,
|
|
114
|
+
.fanui-card--bordered {
|
|
115
|
+
box-shadow: none;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.fanui-card--elevated {
|
|
119
|
+
border-color: transparent;
|
|
120
|
+
box-shadow: fn.fanui-var("shadow-md");
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.fanui-card--glass {
|
|
124
|
+
@include mx.fanui-glass(fn.fanui-alpha(#ffffff, 0.66));
|
|
125
|
+
border-color: fn.fanui-alpha(#ffffff, 0.5);
|
|
126
|
+
|
|
127
|
+
:root[data-fanui-theme="dark"] & {
|
|
128
|
+
@include mx.fanui-glass(fn.fanui-alpha(#0f172a, 0.6));
|
|
129
|
+
border-color: fn.fanui-alpha(#ffffff, 0.1);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.fanui-card--sunken {
|
|
134
|
+
--fanui-card-bg: #{fn.fanui-var("color-surface-sunken")};
|
|
135
|
+
box-shadow: none;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.fanui-card--ghost {
|
|
139
|
+
--fanui-card-bg: transparent;
|
|
140
|
+
--fanui-card-border: transparent;
|
|
141
|
+
box-shadow: none;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
// 顶部色条
|
|
145
|
+
.fanui-card--accent-bar {
|
|
146
|
+
overflow: hidden;
|
|
147
|
+
|
|
148
|
+
&::before {
|
|
149
|
+
content: "";
|
|
150
|
+
position: absolute;
|
|
151
|
+
inset: 0 0 auto 0;
|
|
152
|
+
height: 3px;
|
|
153
|
+
background-color: var(--fanui-card-accent, #{fn.fanui-var("primary")});
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
@each $name, $color in v.$fanui-theme-colors {
|
|
158
|
+
.fanui-card--#{$name} {
|
|
159
|
+
--fanui-card-border: #{fn.fanui-alpha($color, 0.35)};
|
|
160
|
+
--fanui-card-accent: #{fn.fanui-var("#{$name}", $color)};
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// -----------------------------------------------------------------------------
|
|
165
|
+
// 2. 交互态
|
|
166
|
+
// -----------------------------------------------------------------------------
|
|
167
|
+
|
|
168
|
+
.fanui-card--interactive {
|
|
169
|
+
cursor: pointer;
|
|
170
|
+
|
|
171
|
+
&:hover {
|
|
172
|
+
transform: translateY(-2px);
|
|
173
|
+
box-shadow: fn.fanui-var("shadow-lg");
|
|
174
|
+
border-color: fn.fanui-var("color-border-strong");
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
&:active { transform: translateY(0); }
|
|
178
|
+
|
|
179
|
+
&:focus-visible { @include mx.fanui-focus-ring(); }
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.fanui-card--selected {
|
|
183
|
+
border-color: fn.fanui-var("primary");
|
|
184
|
+
box-shadow: 0 0 0 1px fn.fanui-var("primary"), fn.fanui-var("shadow-md");
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
.fanui-card--disabled {
|
|
188
|
+
opacity: 0.6;
|
|
189
|
+
pointer-events: none;
|
|
190
|
+
filter: grayscale(0.3);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
// -----------------------------------------------------------------------------
|
|
194
|
+
// 3. 布局变体
|
|
195
|
+
// -----------------------------------------------------------------------------
|
|
196
|
+
|
|
197
|
+
.fanui-card--horizontal {
|
|
198
|
+
flex-direction: row;
|
|
199
|
+
align-items: stretch;
|
|
200
|
+
|
|
201
|
+
.fanui-card__media {
|
|
202
|
+
flex: 0 0 auto;
|
|
203
|
+
width: var(--fanui-card-media-width, 33.333%);
|
|
204
|
+
border-radius: var(--fanui-card-radius) 0 0 var(--fanui-card-radius);
|
|
205
|
+
|
|
206
|
+
> img, > video { height: 100%; }
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
@include mx.fanui-media-down("sm") {
|
|
210
|
+
flex-direction: column;
|
|
211
|
+
|
|
212
|
+
.fanui-card__media {
|
|
213
|
+
width: 100%;
|
|
214
|
+
border-radius: var(--fanui-card-radius) var(--fanui-card-radius) 0 0;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
.fanui-card--fill { height: 100%; }
|
|
220
|
+
.fanui-card--compact { --fanui-card-padding: #{fn.fanui-var("space-3")}; --fanui-card-radius: #{fn.fanui-var("radius-md")}; }
|
|
221
|
+
.fanui-card--roomy { --fanui-card-padding: #{fn.fanui-var("space-8")}; }
|
|
222
|
+
|
|
223
|
+
// 卡片网格
|
|
224
|
+
.fanui-card-grid {
|
|
225
|
+
@include mx.fanui-grid-auto(260px, fn.fanui-var("space-5"));
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
// 面板(无阴影、适合嵌套)
|
|
229
|
+
.fanui-panel {
|
|
230
|
+
padding: fn.fanui-var("space-5");
|
|
231
|
+
background-color: fn.fanui-var("color-surface");
|
|
232
|
+
border: 1px solid fn.fanui-var("color-border");
|
|
233
|
+
border-radius: fn.fanui-var("radius-md");
|
|
234
|
+
|
|
235
|
+
&__header {
|
|
236
|
+
display: flex;
|
|
237
|
+
align-items: center;
|
|
238
|
+
justify-content: space-between;
|
|
239
|
+
margin-bottom: fn.fanui-var("space-4");
|
|
240
|
+
padding-bottom: fn.fanui-var("space-3");
|
|
241
|
+
border-bottom: 1px solid fn.fanui-var("color-border-subtle");
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
&__title {
|
|
245
|
+
font-size: fn.fanui-var("font-size-base");
|
|
246
|
+
font-weight: 600;
|
|
247
|
+
color: fn.fanui-var("color-text-strong");
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
// 统计卡
|
|
252
|
+
.fanui-stat {
|
|
253
|
+
display: flex;
|
|
254
|
+
flex-direction: column;
|
|
255
|
+
gap: fn.fanui-var("space-2");
|
|
256
|
+
|
|
257
|
+
&__label {
|
|
258
|
+
font-size: fn.fanui-var("font-size-sm");
|
|
259
|
+
color: fn.fanui-var("color-text-muted");
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
&__value {
|
|
263
|
+
font-size: fn.fanui-var("font-size-3xl");
|
|
264
|
+
font-weight: 700;
|
|
265
|
+
line-height: 1.1;
|
|
266
|
+
color: fn.fanui-var("color-text-strong");
|
|
267
|
+
font-variant-numeric: tabular-nums;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
&__trend {
|
|
271
|
+
display: inline-flex;
|
|
272
|
+
align-items: center;
|
|
273
|
+
gap: 4px;
|
|
274
|
+
font-size: fn.fanui-var("font-size-sm");
|
|
275
|
+
font-weight: 500;
|
|
276
|
+
|
|
277
|
+
&--up { color: fn.fanui-var("danger"); } // 中国市场约定:涨 = 红
|
|
278
|
+
&--down { color: fn.fanui-var("success"); } // 跌 = 绿
|
|
279
|
+
&--flat { color: fn.fanui-var("color-text-muted"); }
|
|
280
|
+
}
|
|
281
|
+
}
|
|
@@ -0,0 +1,444 @@
|
|
|
1
|
+
// =============================================================================
|
|
2
|
+
// fanUI · 选择器 Select / 多选与开关 (Choice Controls)
|
|
3
|
+
// -----------------------------------------------------------------------------
|
|
4
|
+
// .fanui-select 原生 <select> 美化
|
|
5
|
+
// .fanui-checkbox 复选框
|
|
6
|
+
// .fanui-radio 单选框
|
|
7
|
+
// .fanui-switch 开关
|
|
8
|
+
// .fanui-choice-group 选项组(横/纵向)
|
|
9
|
+
// 统一使用「原生 input + 自定义外观」,保证可访问性与表单提交能力。
|
|
10
|
+
// =============================================================================
|
|
11
|
+
|
|
12
|
+
@use "sass:map";
|
|
13
|
+
@use "../functions" as fn;
|
|
14
|
+
@use "../variables" as v;
|
|
15
|
+
@use "../mixins" as mx;
|
|
16
|
+
|
|
17
|
+
// -----------------------------------------------------------------------------
|
|
18
|
+
// 1. Select
|
|
19
|
+
// -----------------------------------------------------------------------------
|
|
20
|
+
|
|
21
|
+
.fanui-select {
|
|
22
|
+
@include mx.fanui-form-control();
|
|
23
|
+
|
|
24
|
+
padding-inline-end: 32px;
|
|
25
|
+
cursor: pointer;
|
|
26
|
+
|
|
27
|
+
// 自绘箭头(内联 SVG,避免额外请求)
|
|
28
|
+
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
|
|
29
|
+
background-repeat: no-repeat;
|
|
30
|
+
background-position: right 10px center;
|
|
31
|
+
background-size: 16px;
|
|
32
|
+
appearance: none;
|
|
33
|
+
-webkit-appearance: none;
|
|
34
|
+
|
|
35
|
+
&[multiple],
|
|
36
|
+
&[size]:not([size="1"]) {
|
|
37
|
+
padding-inline-end: fn.fanui-var("control-px", 14px);
|
|
38
|
+
background-image: none;
|
|
39
|
+
height: auto;
|
|
40
|
+
min-height: 88px;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
&::-ms-expand { display: none; }
|
|
44
|
+
|
|
45
|
+
&:disabled { cursor: not-allowed; }
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// 多选列表
|
|
49
|
+
.fanui-select-multiple {
|
|
50
|
+
@extend .fanui-select;
|
|
51
|
+
min-height: 96px;
|
|
52
|
+
padding: 6px;
|
|
53
|
+
|
|
54
|
+
option {
|
|
55
|
+
padding: 4px 8px;
|
|
56
|
+
border-radius: fn.fanui-var("radius-sm");
|
|
57
|
+
|
|
58
|
+
&:checked {
|
|
59
|
+
background-color: fn.fanui-var("primary");
|
|
60
|
+
color: fn.fanui-var("primary-fg");
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// 带前缀图标的 select
|
|
66
|
+
.fanui-select-wrap {
|
|
67
|
+
position: relative;
|
|
68
|
+
display: block;
|
|
69
|
+
|
|
70
|
+
&__prefix {
|
|
71
|
+
position: absolute;
|
|
72
|
+
top: 50%;
|
|
73
|
+
left: 12px;
|
|
74
|
+
transform: translateY(-50%);
|
|
75
|
+
color: fn.fanui-var("color-text-subtle");
|
|
76
|
+
pointer-events: none;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.fanui-select { padding-inline-start: 36px; }
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// -----------------------------------------------------------------------------
|
|
83
|
+
// 2. 复选框 Checkbox
|
|
84
|
+
// -----------------------------------------------------------------------------
|
|
85
|
+
|
|
86
|
+
.fanui-checkbox,
|
|
87
|
+
.fanui-radio {
|
|
88
|
+
display: inline-flex;
|
|
89
|
+
align-items: flex-start;
|
|
90
|
+
gap: 8px;
|
|
91
|
+
position: relative;
|
|
92
|
+
font-size: fn.fanui-var("font-size-base");
|
|
93
|
+
line-height: 1.5;
|
|
94
|
+
color: fn.fanui-var("color-text");
|
|
95
|
+
cursor: pointer;
|
|
96
|
+
user-select: none;
|
|
97
|
+
|
|
98
|
+
&__input {
|
|
99
|
+
@include mx.fanui-visually-hidden();
|
|
100
|
+
|
|
101
|
+
// 让键盘聚焦时可显示焦点环
|
|
102
|
+
&:focus-visible + .fanui-checkbox__box,
|
|
103
|
+
&:focus-visible + .fanui-radio__box {
|
|
104
|
+
@include mx.fanui-focus-ring();
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
&__label {
|
|
109
|
+
flex: 1 1 auto;
|
|
110
|
+
min-width: 0;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
&__desc {
|
|
114
|
+
display: block;
|
|
115
|
+
margin-top: 2px;
|
|
116
|
+
font-size: fn.fanui-var("font-size-sm");
|
|
117
|
+
color: fn.fanui-var("color-text-muted");
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// ---- 禁用 ----
|
|
121
|
+
&.is-disabled,
|
|
122
|
+
&__input:disabled ~ &__label {
|
|
123
|
+
color: fn.fanui-var("color-disabled-text");
|
|
124
|
+
cursor: not-allowed;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
&__input:disabled + .fanui-checkbox__box,
|
|
128
|
+
&__input:disabled + .fanui-radio__box {
|
|
129
|
+
background-color: fn.fanui-var("color-disabled-bg");
|
|
130
|
+
border-color: fn.fanui-var("color-border");
|
|
131
|
+
cursor: not-allowed;
|
|
132
|
+
|
|
133
|
+
&::after { opacity: 0.45; }
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.fanui-checkbox__box {
|
|
138
|
+
position: relative;
|
|
139
|
+
flex: 0 0 auto;
|
|
140
|
+
width: 16px;
|
|
141
|
+
height: 16px;
|
|
142
|
+
margin-top: 3px;
|
|
143
|
+
background-color: fn.fanui-var("color-surface");
|
|
144
|
+
border: 1px solid fn.fanui-var("color-border-strong");
|
|
145
|
+
border-radius: fn.fanui-var("radius-sm");
|
|
146
|
+
box-sizing: border-box;
|
|
147
|
+
@include mx.fanui-transition((background-color, border-color, box-shadow), v.$fanui-duration-fast);
|
|
148
|
+
|
|
149
|
+
// 勾
|
|
150
|
+
&::after {
|
|
151
|
+
content: "";
|
|
152
|
+
position: absolute;
|
|
153
|
+
top: 50%;
|
|
154
|
+
left: 50%;
|
|
155
|
+
width: 4px;
|
|
156
|
+
height: 8px;
|
|
157
|
+
margin: -5px 0 0 -2px;
|
|
158
|
+
border: solid fn.fanui-var("color-text-inverse");
|
|
159
|
+
border-width: 0 2px 2px 0;
|
|
160
|
+
transform: rotate(45deg) scale(0.6);
|
|
161
|
+
opacity: 0;
|
|
162
|
+
@include mx.fanui-transition((opacity, transform), v.$fanui-duration-fast, v.$fanui-ease-spring);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
.fanui-checkbox:hover .fanui-checkbox__box {
|
|
167
|
+
border-color: fn.fanui-var("primary");
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
.fanui-checkbox__input:checked + .fanui-checkbox__box,
|
|
171
|
+
.fanui-checkbox.is-checked .fanui-checkbox__box {
|
|
172
|
+
background-color: fn.fanui-var("primary");
|
|
173
|
+
border-color: fn.fanui-var("primary");
|
|
174
|
+
|
|
175
|
+
&::after {
|
|
176
|
+
opacity: 1;
|
|
177
|
+
transform: rotate(45deg) scale(1);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
// 半选
|
|
182
|
+
.fanui-checkbox__input:indeterminate + .fanui-checkbox__box {
|
|
183
|
+
background-color: fn.fanui-var("primary");
|
|
184
|
+
border-color: fn.fanui-var("primary");
|
|
185
|
+
|
|
186
|
+
&::after {
|
|
187
|
+
width: 8px;
|
|
188
|
+
height: 0;
|
|
189
|
+
margin: -1px 0 0 -4px;
|
|
190
|
+
border-width: 0 0 2px 0;
|
|
191
|
+
transform: none;
|
|
192
|
+
opacity: 1;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
// -----------------------------------------------------------------------------
|
|
197
|
+
// 3. 单选框 Radio
|
|
198
|
+
// -----------------------------------------------------------------------------
|
|
199
|
+
|
|
200
|
+
.fanui-radio {
|
|
201
|
+
&__box {
|
|
202
|
+
position: relative;
|
|
203
|
+
flex: 0 0 auto;
|
|
204
|
+
width: 16px;
|
|
205
|
+
height: 16px;
|
|
206
|
+
margin-top: 3px;
|
|
207
|
+
background-color: fn.fanui-var("color-surface");
|
|
208
|
+
border: 1px solid fn.fanui-var("color-border-strong");
|
|
209
|
+
border-radius: 50%;
|
|
210
|
+
box-sizing: border-box;
|
|
211
|
+
@include mx.fanui-transition((background-color, border-color, box-shadow), v.$fanui-duration-fast);
|
|
212
|
+
|
|
213
|
+
&::after {
|
|
214
|
+
content: "";
|
|
215
|
+
position: absolute;
|
|
216
|
+
top: 50%;
|
|
217
|
+
left: 50%;
|
|
218
|
+
width: 6px;
|
|
219
|
+
height: 6px;
|
|
220
|
+
margin: -3px 0 0 -3px;
|
|
221
|
+
background-color: fn.fanui-var("color-text-inverse");
|
|
222
|
+
border-radius: 50%;
|
|
223
|
+
transform: scale(0);
|
|
224
|
+
opacity: 0;
|
|
225
|
+
@include mx.fanui-transition((opacity, transform), v.$fanui-duration-fast, v.$fanui-ease-spring);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
&:hover .fanui-radio__box { border-color: fn.fanui-var("primary"); }
|
|
230
|
+
|
|
231
|
+
&__input:checked + .fanui-radio__box,
|
|
232
|
+
&.is-checked .fanui-radio__box {
|
|
233
|
+
background-color: fn.fanui-var("primary");
|
|
234
|
+
border-color: fn.fanui-var("primary");
|
|
235
|
+
|
|
236
|
+
&::after { opacity: 1; transform: scale(1); }
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
// 复选框 / 单选 尺寸
|
|
241
|
+
.fanui-checkbox--sm,
|
|
242
|
+
.fanui-radio--sm {
|
|
243
|
+
.fanui-checkbox__box,
|
|
244
|
+
.fanui-radio__box { width: 14px; height: 14px; }
|
|
245
|
+
}
|
|
246
|
+
.fanui-checkbox--lg,
|
|
247
|
+
.fanui-radio--lg {
|
|
248
|
+
font-size: fn.fanui-var("font-size-md");
|
|
249
|
+
|
|
250
|
+
.fanui-checkbox__box,
|
|
251
|
+
.fanui-radio__box { width: 20px; height: 20px; border-radius: fn.fanui-var("radius-base"); }
|
|
252
|
+
|
|
253
|
+
.fanui-radio__box { border-radius: 50%; }
|
|
254
|
+
.fanui-radio__box::after { width: 8px; height: 8px; margin: -4px 0 0 -4px; }
|
|
255
|
+
.fanui-checkbox__box::after { width: 5px; height: 10px; margin: -6px 0 0 -2.5px; }
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
// 卡片式选项
|
|
259
|
+
.fanui-checkbox--card,
|
|
260
|
+
.fanui-radio--card {
|
|
261
|
+
display: flex;
|
|
262
|
+
align-items: flex-start;
|
|
263
|
+
gap: fn.fanui-var("space-3");
|
|
264
|
+
padding: fn.fanui-var("space-3") fn.fanui-var("space-4");
|
|
265
|
+
border: 1px solid fn.fanui-var("color-border");
|
|
266
|
+
border-radius: fn.fanui-var("radius-md");
|
|
267
|
+
@include mx.fanui-transition((border-color, background-color, box-shadow), v.$fanui-duration-fast);
|
|
268
|
+
|
|
269
|
+
&:hover { border-color: fn.fanui-var("color-border-strong"); background-color: fn.fanui-var("color-hover"); }
|
|
270
|
+
|
|
271
|
+
&:has(.fanui-checkbox__input:checked),
|
|
272
|
+
&:has(.fanui-radio__input:checked),
|
|
273
|
+
&.is-checked {
|
|
274
|
+
border-color: fn.fanui-var("primary");
|
|
275
|
+
background-color: fn.fanui-var("primary-soft");
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
// 纯按钮式选项(分段控制器)
|
|
280
|
+
.fanui-checkbox--button,
|
|
281
|
+
.fanui-radio--button {
|
|
282
|
+
padding: 6px 14px;
|
|
283
|
+
border: 1px solid fn.fanui-var("color-border");
|
|
284
|
+
border-radius: fn.fanui-var("radius-base");
|
|
285
|
+
font-size: fn.fanui-var("font-size-sm");
|
|
286
|
+
@include mx.fanui-transition((border-color, background-color, color), v.$fanui-duration-fast);
|
|
287
|
+
|
|
288
|
+
.fanui-checkbox__box,
|
|
289
|
+
.fanui-radio__box { display: none; }
|
|
290
|
+
|
|
291
|
+
&:has(.fanui-checkbox__input:checked),
|
|
292
|
+
&:has(.fanui-radio__input:checked) {
|
|
293
|
+
border-color: fn.fanui-var("primary");
|
|
294
|
+
background-color: fn.fanui-var("primary");
|
|
295
|
+
color: fn.fanui-var("primary-fg");
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
// -----------------------------------------------------------------------------
|
|
300
|
+
// 4. 选项组
|
|
301
|
+
// -----------------------------------------------------------------------------
|
|
302
|
+
|
|
303
|
+
.fanui-choice-group {
|
|
304
|
+
display: flex;
|
|
305
|
+
flex-wrap: wrap;
|
|
306
|
+
gap: fn.fanui-var("space-4");
|
|
307
|
+
|
|
308
|
+
&--vertical {
|
|
309
|
+
flex-direction: column;
|
|
310
|
+
gap: fn.fanui-var("space-3");
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
&--tight { gap: fn.fanui-var("space-2"); }
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
// 分段控制器(互斥按钮组)
|
|
317
|
+
.fanui-segmented {
|
|
318
|
+
display: inline-flex;
|
|
319
|
+
padding: 2px;
|
|
320
|
+
background-color: fn.fanui-var("color-surface-sunken");
|
|
321
|
+
border: 1px solid fn.fanui-var("color-border");
|
|
322
|
+
border-radius: fn.fanui-var("radius-md");
|
|
323
|
+
gap: 2px;
|
|
324
|
+
|
|
325
|
+
&__item {
|
|
326
|
+
position: relative;
|
|
327
|
+
display: inline-flex;
|
|
328
|
+
align-items: center;
|
|
329
|
+
justify-content: center;
|
|
330
|
+
gap: 6px;
|
|
331
|
+
padding: 6px 14px;
|
|
332
|
+
font-size: fn.fanui-var("font-size-sm");
|
|
333
|
+
font-weight: 500;
|
|
334
|
+
color: fn.fanui-var("color-text-muted");
|
|
335
|
+
border-radius: fn.fanui-var("radius-base");
|
|
336
|
+
cursor: pointer;
|
|
337
|
+
white-space: nowrap;
|
|
338
|
+
@include mx.fanui-transition((background-color, color, box-shadow), v.$fanui-duration-fast);
|
|
339
|
+
|
|
340
|
+
input { @include mx.fanui-visually-hidden(); }
|
|
341
|
+
|
|
342
|
+
&:hover { color: fn.fanui-var("color-text"); }
|
|
343
|
+
|
|
344
|
+
&:has(input:checked),
|
|
345
|
+
&.is-active,
|
|
346
|
+
&[aria-selected="true"] {
|
|
347
|
+
color: fn.fanui-var("color-text-strong");
|
|
348
|
+
background-color: fn.fanui-var("color-surface");
|
|
349
|
+
box-shadow: fn.fanui-var("shadow-xs");
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
// -----------------------------------------------------------------------------
|
|
355
|
+
// 5. 开关 Switch
|
|
356
|
+
// -----------------------------------------------------------------------------
|
|
357
|
+
|
|
358
|
+
.fanui-switch {
|
|
359
|
+
--fanui-switch-w: 40px;
|
|
360
|
+
--fanui-switch-h: 22px;
|
|
361
|
+
--fanui-switch-travel: calc(var(--fanui-switch-w) - var(--fanui-switch-h));
|
|
362
|
+
|
|
363
|
+
display: inline-flex;
|
|
364
|
+
align-items: center;
|
|
365
|
+
gap: 10px;
|
|
366
|
+
cursor: pointer;
|
|
367
|
+
user-select: none;
|
|
368
|
+
|
|
369
|
+
&__input { @include mx.fanui-visually-hidden(); }
|
|
370
|
+
|
|
371
|
+
&__track {
|
|
372
|
+
position: relative;
|
|
373
|
+
flex: 0 0 auto;
|
|
374
|
+
width: var(--fanui-switch-w);
|
|
375
|
+
height: var(--fanui-switch-h);
|
|
376
|
+
background-color: fn.fanui-var("color-border-strong");
|
|
377
|
+
border: 1px solid transparent;
|
|
378
|
+
border-radius: 9999px;
|
|
379
|
+
box-sizing: border-box;
|
|
380
|
+
@include mx.fanui-transition((background-color, border-color), v.$fanui-duration-base);
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
&__thumb {
|
|
384
|
+
position: absolute;
|
|
385
|
+
top: 2px;
|
|
386
|
+
left: 2px;
|
|
387
|
+
width: calc(var(--fanui-switch-h) - 4px);
|
|
388
|
+
height: calc(var(--fanui-switch-h) - 4px);
|
|
389
|
+
background-color: #ffffff;
|
|
390
|
+
border-radius: 50%;
|
|
391
|
+
box-shadow: 0 1px 3px rgba(15, 23, 42, 0.3);
|
|
392
|
+
@include mx.fanui-transition(transform, v.$fanui-duration-base, v.$fanui-ease-spring);
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
&__label { font-size: fn.fanui-var("font-size-base"); }
|
|
396
|
+
|
|
397
|
+
&__input:checked ~ .fanui-switch__track,
|
|
398
|
+
&.is-checked .fanui-switch__track {
|
|
399
|
+
background-color: fn.fanui-var("primary");
|
|
400
|
+
border-color: fn.fanui-var("primary");
|
|
401
|
+
|
|
402
|
+
.fanui-switch__thumb { transform: translateX(var(--fanui-switch-travel)); }
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
&__input:focus-visible ~ .fanui-switch__track {
|
|
406
|
+
@include mx.fanui-focus-ring();
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
&__input:disabled ~ .fanui-switch__track {
|
|
410
|
+
opacity: 0.5;
|
|
411
|
+
cursor: not-allowed;
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
// 语义变体
|
|
415
|
+
@each $name, $color in v.$fanui-theme-colors {
|
|
416
|
+
&--#{$name} {
|
|
417
|
+
$c: fn.fanui-var("#{$name}", $color);
|
|
418
|
+
--fanui-switch-checked: #{$c};
|
|
419
|
+
|
|
420
|
+
.fanui-switch__input:checked ~ .fanui-switch__track,
|
|
421
|
+
&.is-checked .fanui-switch__track {
|
|
422
|
+
background-color: $c;
|
|
423
|
+
border-color: $c;
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
// 尺寸
|
|
429
|
+
&--sm { --fanui-switch-w: 32px; --fanui-switch-h: 18px; }
|
|
430
|
+
&--lg { --fanui-switch-w: 52px; --fanui-switch-h: 28px; }
|
|
431
|
+
|
|
432
|
+
// 加载态
|
|
433
|
+
&--loading {
|
|
434
|
+
.fanui-switch__thumb::after {
|
|
435
|
+
content: "";
|
|
436
|
+
position: absolute;
|
|
437
|
+
inset: 3px;
|
|
438
|
+
border: 2px solid fn.fanui-var("color-text-subtle");
|
|
439
|
+
border-top-color: transparent;
|
|
440
|
+
border-radius: 50%;
|
|
441
|
+
animation: fanui-spin 700ms linear infinite;
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
}
|