@veltra/mobile 1.0.0 → 1.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/package.json +32 -6
- package/src/components/_internal/bottom-sheet/bottom-sheet.vue +81 -0
- package/src/components/_internal/bottom-sheet/index.ts +1 -0
- package/src/components/_internal/bottom-sheet/style.scss +116 -0
- package/src/components/_internal/bottom-sheet/style.ts +1 -0
- package/src/components/_internal/overlay-container.ts +34 -0
- package/src/components/avatar/avatar.vue +44 -0
- package/src/components/avatar/index.ts +1 -0
- package/src/components/avatar/style.scss +53 -0
- package/src/components/avatar/style.ts +1 -0
- package/src/components/badge/badge.vue +59 -0
- package/src/components/badge/index.ts +1 -0
- package/src/components/badge/style.scss +62 -0
- package/src/components/badge/style.ts +1 -0
- package/src/components/button/button.vue +76 -0
- package/src/components/button/index.ts +1 -0
- package/src/components/button/style.scss +207 -0
- package/src/components/button/style.ts +1 -0
- package/src/components/card/card.vue +24 -0
- package/src/components/card/index.ts +1 -0
- package/src/components/card/style.scss +35 -0
- package/src/components/card/style.ts +1 -0
- package/src/components/cascade/cascade.vue +595 -0
- package/src/components/cascade/index.ts +1 -0
- package/src/components/cascade/node.ts +29 -0
- package/src/components/cascade/style.scss +424 -0
- package/src/components/cascade/style.ts +2 -0
- package/src/components/check-tag/check-tag.vue +35 -0
- package/src/components/check-tag/index.ts +1 -0
- package/src/components/check-tag/style.scss +46 -0
- package/src/components/check-tag/style.ts +1 -0
- package/src/components/checkbox/checkbox.vue +67 -0
- package/src/components/checkbox/index.ts +1 -0
- package/src/components/checkbox/style.scss +132 -0
- package/src/components/checkbox/style.ts +2 -0
- package/src/components/checkbox-group/checkbox-group.vue +94 -0
- package/src/components/checkbox-group/index.ts +1 -0
- package/src/components/checkbox-group/style.scss +57 -0
- package/src/components/checkbox-group/style.ts +2 -0
- package/src/components/collapse/collapse-item.vue +134 -0
- package/src/components/collapse/collapse.vue +117 -0
- package/src/components/collapse/di.ts +18 -0
- package/src/components/collapse/index.ts +3 -0
- package/src/components/collapse/style.scss +157 -0
- package/src/components/collapse/style.ts +1 -0
- package/src/components/date-picker/date-picker.vue +326 -0
- package/src/components/date-picker/index.ts +1 -0
- package/src/components/date-picker/style.scss +236 -0
- package/src/components/date-picker/style.ts +2 -0
- package/src/components/descriptions/descriptions-item.vue +12 -0
- package/src/components/descriptions/descriptions.vue +50 -0
- package/src/components/descriptions/index.ts +2 -0
- package/src/components/descriptions/style.scss +120 -0
- package/src/components/descriptions/style.ts +1 -0
- package/src/components/dialog/dialog.vue +143 -0
- package/src/components/dialog/index.ts +1 -0
- package/src/components/dialog/style.scss +163 -0
- package/src/components/dialog/style.ts +4 -0
- package/src/components/divider/divider.vue +29 -0
- package/src/components/divider/index.ts +1 -0
- package/src/components/divider/style.scss +91 -0
- package/src/components/divider/style.ts +1 -0
- package/src/components/drawer/drawer.vue +168 -0
- package/src/components/drawer/index.ts +1 -0
- package/src/components/drawer/style.scss +240 -0
- package/src/components/drawer/style.ts +2 -0
- package/src/components/empty/empty.vue +22 -0
- package/src/components/empty/index.ts +1 -0
- package/src/components/empty/style.scss +36 -0
- package/src/components/empty/style.ts +1 -0
- package/src/components/form/form.vue +119 -0
- package/src/components/form/index.ts +1 -0
- package/src/components/form/is-field-modified.ts +16 -0
- package/src/components/form/style.scss +58 -0
- package/src/components/form/style.ts +2 -0
- package/src/components/form/use-form-fields.ts +115 -0
- package/src/components/form/use-node-interceptor.ts +101 -0
- package/src/components/form-item/form-item.vue +171 -0
- package/src/components/form-item/helper.ts +9 -0
- package/src/components/form-item/index.ts +1 -0
- package/src/components/form-item/style.scss +121 -0
- package/src/components/form-item/style.ts +1 -0
- package/src/components/form-item/validate.ts +131 -0
- package/src/components/icon/icon.vue +23 -0
- package/src/components/icon/index.ts +1 -0
- package/src/components/icon/style.scss +37 -0
- package/src/components/icon/style.ts +1 -0
- package/src/components/input/index.ts +1 -0
- package/src/components/input/input.vue +187 -0
- package/src/components/input/style.scss +121 -0
- package/src/components/input/style.ts +1 -0
- package/src/components/list/index.ts +3 -0
- package/src/components/list/list-item.vue +20 -0
- package/src/components/list/list.vue +20 -0
- package/src/components/list/style.scss +50 -0
- package/src/components/list/style.ts +1 -0
- package/src/components/loading/directive.ts +34 -0
- package/src/components/loading/index.ts +3 -0
- package/src/components/loading/loading.vue +25 -0
- package/src/components/loading/style.scss +179 -0
- package/src/components/loading/style.ts +2 -0
- package/src/components/message/helper.ts +28 -0
- package/src/components/message/index.ts +3 -0
- package/src/components/message/message-box.vue +31 -0
- package/src/components/message/message.ts +122 -0
- package/src/components/message/message.vue +54 -0
- package/src/components/message/style.scss +130 -0
- package/src/components/message/style.ts +1 -0
- package/src/components/message-confirm/index.ts +3 -0
- package/src/components/message-confirm/message-confirm-box.vue +36 -0
- package/src/components/message-confirm/message-confirm.ts +139 -0
- package/src/components/message-confirm/message-confirm.vue +53 -0
- package/src/components/message-confirm/style.scss +138 -0
- package/src/components/message-confirm/style.ts +1 -0
- package/src/components/multi-select/index.ts +1 -0
- package/src/components/multi-select/multi-select.vue +410 -0
- package/src/components/multi-select/style.scss +376 -0
- package/src/components/multi-select/style.ts +2 -0
- package/src/components/number-input/index.ts +1 -0
- package/src/components/number-input/number-input.vue +407 -0
- package/src/components/number-input/style.scss +118 -0
- package/src/components/number-input/style.ts +2 -0
- package/src/components/password-input/index.ts +1 -0
- package/src/components/password-input/password-input.vue +134 -0
- package/src/components/password-input/style.scss +40 -0
- package/src/components/password-input/style.ts +2 -0
- package/src/components/progress/index.ts +1 -0
- package/src/components/progress/progress.vue +90 -0
- package/src/components/progress/style.scss +73 -0
- package/src/components/progress/style.ts +1 -0
- package/src/components/radio/index.ts +1 -0
- package/src/components/radio/radio.vue +57 -0
- package/src/components/radio/style.scss +113 -0
- package/src/components/radio/style.ts +1 -0
- package/src/components/radio-group/index.ts +1 -0
- package/src/components/radio-group/radio-group.vue +60 -0
- package/src/components/radio-group/style.scss +29 -0
- package/src/components/radio-group/style.ts +2 -0
- package/src/components/segment/index.ts +1 -0
- package/src/components/segment/segment.vue +121 -0
- package/src/components/segment/style.scss +118 -0
- package/src/components/segment/style.ts +1 -0
- package/src/components/select/index.ts +1 -0
- package/src/components/select/select.vue +278 -0
- package/src/components/select/style.scss +237 -0
- package/src/components/select/style.ts +2 -0
- package/src/components/select/use-options.ts +195 -0
- package/src/components/skeleton/index.ts +1 -0
- package/src/components/skeleton/skeleton.vue +37 -0
- package/src/components/skeleton/style.scss +95 -0
- package/src/components/skeleton/style.ts +1 -0
- package/src/components/space/index.ts +1 -0
- package/src/components/space/space.vue +45 -0
- package/src/components/space/style.scss +41 -0
- package/src/components/space/style.ts +1 -0
- package/src/components/steps/index.ts +1 -0
- package/src/components/steps/steps.vue +114 -0
- package/src/components/steps/style.scss +231 -0
- package/src/components/steps/style.ts +1 -0
- package/src/components/switch/index.ts +1 -0
- package/src/components/switch/style.scss +137 -0
- package/src/components/switch/style.ts +1 -0
- package/src/components/switch/switch.vue +63 -0
- package/src/components/tabs/index.ts +1 -0
- package/src/components/tabs/style.scss +285 -0
- package/src/components/tabs/style.ts +1 -0
- package/src/components/tabs/tabs.vue +127 -0
- package/src/components/tag/index.ts +1 -0
- package/src/components/tag/style.scss +114 -0
- package/src/components/tag/style.ts +1 -0
- package/src/components/tag/tag.vue +49 -0
- package/src/components/text/index.ts +1 -0
- package/src/components/text/style.scss +63 -0
- package/src/components/text/style.ts +1 -0
- package/src/components/text/text.vue +63 -0
- package/src/components/textarea/index.ts +1 -0
- package/src/components/textarea/style.scss +124 -0
- package/src/components/textarea/style.ts +1 -0
- package/src/components/textarea/textarea.vue +121 -0
- package/src/components/textarea/utils.ts +11 -0
- package/src/components/time-picker/index.ts +1 -0
- package/src/components/time-picker/style.scss +216 -0
- package/src/components/time-picker/style.ts +2 -0
- package/src/components/time-picker/time-picker.vue +263 -0
- package/src/components/timeline/index.ts +2 -0
- package/src/components/timeline/style.scss +107 -0
- package/src/components/timeline/style.ts +1 -0
- package/src/components/timeline/timeline-item.vue +43 -0
- package/src/components/timeline/timeline.vue +16 -0
- package/src/components/uploader/index.ts +1 -0
- package/src/components/uploader/style.scss +220 -0
- package/src/components/uploader/style.ts +1 -0
- package/src/components/uploader/uploader.vue +306 -0
- package/src/env.d.ts +7 -0
- package/src/index.ts +99 -1
- package/src/shared/bem.ts +12 -0
- package/src/shared/use-scroll-lock.ts +111 -0
- package/src/shared/use-touch-gesture.ts +150 -0
- package/src/styles/_tokens.scss +129 -0
- package/src/types/avatar.ts +31 -0
- package/src/types/badge.ts +28 -0
- package/src/types/button.ts +48 -0
- package/src/types/card.ts +16 -0
- package/src/types/cascade.ts +87 -0
- package/src/types/check-tag.ts +24 -0
- package/src/types/checkbox-group.ts +20 -0
- package/src/types/checkbox.ts +15 -0
- package/src/types/collapse.ts +79 -0
- package/src/types/date-picker.ts +39 -0
- package/src/types/descriptions.ts +22 -0
- package/src/types/dialog.ts +54 -0
- package/src/types/divider.ts +14 -0
- package/src/types/drawer.ts +38 -0
- package/src/types/empty.ts +19 -0
- package/src/types/form-item.ts +22 -0
- package/src/types/form.ts +54 -0
- package/src/types/icon.ts +10 -0
- package/src/types/input.ts +51 -0
- package/src/types/list.ts +13 -0
- package/src/types/loading.ts +20 -0
- package/src/types/message-confirm.ts +72 -0
- package/src/types/message.ts +71 -0
- package/src/types/multi-select.ts +38 -0
- package/src/types/number-input.ts +32 -0
- package/src/types/password-input.ts +19 -0
- package/src/types/progress.ts +22 -0
- package/src/types/radio-group.ts +33 -0
- package/src/types/radio.ts +18 -0
- package/src/types/segment.ts +42 -0
- package/src/types/select.ts +63 -0
- package/src/types/skeleton.ts +29 -0
- package/src/types/space.ts +22 -0
- package/src/types/steps.ts +67 -0
- package/src/types/switch.ts +17 -0
- package/src/types/tabs.ts +63 -0
- package/src/types/tag.ts +19 -0
- package/src/types/text.ts +28 -0
- package/src/types/textarea.ts +76 -0
- package/src/types/time-picker.ts +40 -0
- package/src/types/timeline.ts +15 -0
- package/src/types/uploader.ts +50 -0
- package/.turbo/turbo-build.log +0 -2
- package/.turbo/turbo-check-types.log +0 -1
- package/tsconfig.json +0 -12
- package/tsconfig.tsbuildinfo +0 -1
|
@@ -0,0 +1,424 @@
|
|
|
1
|
+
@use 'pkg:@veltra/styles/mixins' as m with (
|
|
2
|
+
$namespace: um
|
|
3
|
+
);
|
|
4
|
+
@use 'pkg:@veltra/styles/functions' as fn;
|
|
5
|
+
@use '../../styles/tokens' as t;
|
|
6
|
+
|
|
7
|
+
$root-name: cascade;
|
|
8
|
+
|
|
9
|
+
@include m.b($root-name) {
|
|
10
|
+
display: flex;
|
|
11
|
+
align-items: center;
|
|
12
|
+
width: 100%;
|
|
13
|
+
box-sizing: border-box;
|
|
14
|
+
gap: t.use-var('spacing-sm');
|
|
15
|
+
padding: 0 t.use-var('spacing-md');
|
|
16
|
+
border: fn.use-var(border);
|
|
17
|
+
border-radius: t.control-radius(default);
|
|
18
|
+
background-color: fn.use-var(bg-color, top);
|
|
19
|
+
color: fn.use-var(text-color, main);
|
|
20
|
+
font-size: t.use-var('font-size-main');
|
|
21
|
+
cursor: pointer;
|
|
22
|
+
-webkit-tap-highlight-color: transparent;
|
|
23
|
+
transition:
|
|
24
|
+
border-color fn.use-var(transition, fast) fn.use-var(transition, ease),
|
|
25
|
+
box-shadow fn.use-var(transition, fast) fn.use-var(transition, ease);
|
|
26
|
+
|
|
27
|
+
// 触控热区:任何尺寸的可点击区域不小于 44×44,高度走移动端密度 token
|
|
28
|
+
@include m.size using ($size) {
|
|
29
|
+
min-height: max(t.control-height($size), t.use-var('touch-target'));
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
&:active {
|
|
33
|
+
border-color: fn.use-var(color, primary);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
&:focus-visible {
|
|
37
|
+
box-shadow: fn.use-var(focus-ring);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
@include m.is(active) {
|
|
41
|
+
border-color: fn.use-var(color, primary);
|
|
42
|
+
|
|
43
|
+
@include m.bem($root-name, arrow) {
|
|
44
|
+
transform: rotate(180deg);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
@include m.is(disabled) {
|
|
49
|
+
cursor: not-allowed;
|
|
50
|
+
color: fn.use-var(text-color, disabled);
|
|
51
|
+
background-color: fn.use-var(bg-color, middle);
|
|
52
|
+
|
|
53
|
+
@include m.bem($root-name, arrow) {
|
|
54
|
+
color: fn.use-var(text-color, disabled);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
@include m.e(value) {
|
|
59
|
+
flex: 1;
|
|
60
|
+
min-width: 0;
|
|
61
|
+
@include m.ellipsis;
|
|
62
|
+
|
|
63
|
+
@include m.is(placeholder) {
|
|
64
|
+
color: fn.use-var(text-color, placeholder);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// 触发器标签:单行呈现,超出由标签省略与 +N 计数兜底,不撑高表单行
|
|
69
|
+
@include m.e(tags) {
|
|
70
|
+
flex: 1;
|
|
71
|
+
min-width: 0;
|
|
72
|
+
display: flex;
|
|
73
|
+
flex-wrap: nowrap;
|
|
74
|
+
align-items: center;
|
|
75
|
+
gap: t.use-var('spacing-xs');
|
|
76
|
+
overflow: hidden;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// 只读态是纯展示(无 +N 计数兜底):恢复换行并补纵向呼吸空间,不裁剪标签
|
|
80
|
+
&.is-readonly {
|
|
81
|
+
padding: 0;
|
|
82
|
+
border: none;
|
|
83
|
+
background: transparent;
|
|
84
|
+
cursor: default;
|
|
85
|
+
|
|
86
|
+
@include m.bem($root-name, tags) {
|
|
87
|
+
flex-wrap: wrap;
|
|
88
|
+
overflow: visible;
|
|
89
|
+
padding-block: t.use-var('spacing-xs');
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
@include m.e(tag) {
|
|
94
|
+
display: inline-flex;
|
|
95
|
+
align-items: center;
|
|
96
|
+
min-width: 0;
|
|
97
|
+
box-sizing: border-box;
|
|
98
|
+
padding: t.use-var('spacing-xs') t.use-var('spacing-sm');
|
|
99
|
+
border-radius: t.control-radius(small);
|
|
100
|
+
background-color: fn.use-var(bg-color, middle);
|
|
101
|
+
color: fn.use-var(text-color, main);
|
|
102
|
+
font-size: t.use-var('font-size-secondary');
|
|
103
|
+
|
|
104
|
+
@include m.is(rest) {
|
|
105
|
+
flex-shrink: 0;
|
|
106
|
+
color: fn.use-var(text-color, second);
|
|
107
|
+
background-color: fn.use-var(bg-color, middle);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
@include m.e(tag-label) {
|
|
112
|
+
min-width: 0;
|
|
113
|
+
@include m.ellipsis;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
@include m.e(tag-close) {
|
|
117
|
+
// 关闭热区外扩补足(≥44×44 过大会挤占标签,取折中值并扩大点击域)
|
|
118
|
+
position: relative;
|
|
119
|
+
display: inline-flex;
|
|
120
|
+
align-items: center;
|
|
121
|
+
justify-content: center;
|
|
122
|
+
flex-shrink: 0;
|
|
123
|
+
width: 20px;
|
|
124
|
+
height: 20px;
|
|
125
|
+
margin-left: t.use-var('spacing-xs');
|
|
126
|
+
// 外扩量与 spacing-xs 同源,收回关闭钮在标签内边距中的占位
|
|
127
|
+
margin-right: calc(-1 * #{t.use-var('spacing-xs')});
|
|
128
|
+
border: none;
|
|
129
|
+
background: none;
|
|
130
|
+
padding: 0;
|
|
131
|
+
font-size: t.use-var('font-size-auxiliary');
|
|
132
|
+
color: fn.use-var(text-color, second);
|
|
133
|
+
cursor: pointer;
|
|
134
|
+
|
|
135
|
+
// 扩大点击域,不占据布局空间
|
|
136
|
+
&::before {
|
|
137
|
+
content: '';
|
|
138
|
+
position: absolute;
|
|
139
|
+
inset: -12px;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
svg {
|
|
143
|
+
width: 1em;
|
|
144
|
+
height: 1em;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
&:active {
|
|
148
|
+
color: fn.use-var(text-color, title);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
@include m.e(icons) {
|
|
153
|
+
display: inline-flex;
|
|
154
|
+
align-items: center;
|
|
155
|
+
align-self: stretch;
|
|
156
|
+
flex-shrink: 0;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
@include m.e(clear) {
|
|
160
|
+
// 清除热区 ≥44×44(高度受行高约束,用外扩补足)
|
|
161
|
+
display: inline-flex;
|
|
162
|
+
align-items: center;
|
|
163
|
+
justify-content: center;
|
|
164
|
+
min-width: t.use-var('touch-target');
|
|
165
|
+
min-height: t.use-var('touch-target');
|
|
166
|
+
// 热区外扩量(spacing-sm):补偿清除钮居中图标的两侧留白,不挤压视觉边距
|
|
167
|
+
margin: calc(-1 * #{t.use-var('spacing-sm')}) calc(-1 * #{t.use-var('spacing-sm')})
|
|
168
|
+
calc(-1 * #{t.use-var('spacing-sm')}) 0;
|
|
169
|
+
padding: 0;
|
|
170
|
+
border: none;
|
|
171
|
+
background: none;
|
|
172
|
+
font-size: t.use-var('font-size-main');
|
|
173
|
+
color: fn.use-var(text-color, second);
|
|
174
|
+
cursor: pointer;
|
|
175
|
+
|
|
176
|
+
svg {
|
|
177
|
+
width: 1em;
|
|
178
|
+
height: 1em;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
&:active {
|
|
182
|
+
color: fn.use-var(text-color, title);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
@include m.e(arrow) {
|
|
187
|
+
// 箭头热区 ≥44×44:随行高拉伸、宽度不小于触控热区下限
|
|
188
|
+
display: inline-flex;
|
|
189
|
+
align-items: center;
|
|
190
|
+
justify-content: center;
|
|
191
|
+
align-self: stretch;
|
|
192
|
+
min-width: t.use-var('touch-target');
|
|
193
|
+
color: fn.use-var(text-color, second);
|
|
194
|
+
font-size: t.use-var('font-size-secondary');
|
|
195
|
+
transition: transform fn.use-var(transition, fast) fn.use-var(transition, ease);
|
|
196
|
+
|
|
197
|
+
svg {
|
|
198
|
+
width: 1em;
|
|
199
|
+
height: 1em;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
// 面板头部(取消 / 标题 / 确定):操作钮热区外扩量与 spacing-sm 同源
|
|
204
|
+
@include m.e(cancel, confirm) {
|
|
205
|
+
flex-shrink: 0;
|
|
206
|
+
min-width: t.use-var('touch-target');
|
|
207
|
+
min-height: t.use-var('touch-target');
|
|
208
|
+
margin: calc(-1 * #{t.use-var('spacing-sm')}) 0;
|
|
209
|
+
padding: 0;
|
|
210
|
+
border: none;
|
|
211
|
+
background: none;
|
|
212
|
+
font-size: t.use-var('font-size-main');
|
|
213
|
+
cursor: pointer;
|
|
214
|
+
-webkit-tap-highlight-color: transparent;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
@include m.e(cancel) {
|
|
218
|
+
margin-left: calc(-1 * #{t.use-var('spacing-sm')});
|
|
219
|
+
color: fn.use-var(text-color, second);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
@include m.e(confirm) {
|
|
223
|
+
margin-right: calc(-1 * #{t.use-var('spacing-sm')});
|
|
224
|
+
font-weight: 600;
|
|
225
|
+
color: fn.use-var(color, primary);
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
@include m.e(title) {
|
|
229
|
+
flex: 1;
|
|
230
|
+
min-width: 0;
|
|
231
|
+
font-size: t.use-var('font-size-title');
|
|
232
|
+
font-weight: 600;
|
|
233
|
+
color: fn.use-var(text-color, title);
|
|
234
|
+
text-align: center;
|
|
235
|
+
@include m.ellipsis;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
// 面板内搜索行
|
|
239
|
+
@include m.e(search) {
|
|
240
|
+
padding: t.use-var('spacing-sm') 0;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
@include m.e(search-input) {
|
|
244
|
+
// 字号 ≥16px(placeholder 继承同字号):iOS Safari 聚焦不触发页面缩放
|
|
245
|
+
width: 100%;
|
|
246
|
+
box-sizing: border-box;
|
|
247
|
+
min-height: t.use-var('touch-target');
|
|
248
|
+
padding: 0 t.use-var('spacing-md');
|
|
249
|
+
border: fn.use-var(border);
|
|
250
|
+
border-radius: t.control-radius(default);
|
|
251
|
+
background-color: fn.use-var(bg-color, middle);
|
|
252
|
+
color: fn.use-var(text-color, main);
|
|
253
|
+
font-size: t.use-var('font-size-main');
|
|
254
|
+
outline: none;
|
|
255
|
+
-webkit-appearance: none;
|
|
256
|
+
|
|
257
|
+
&::placeholder {
|
|
258
|
+
color: fn.use-var(text-color, placeholder);
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
&:focus {
|
|
262
|
+
border-color: fn.use-var(color, primary);
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
// 面包屑层级:可横向滚动,点任意一级回跳
|
|
267
|
+
@include m.e(tabs) {
|
|
268
|
+
display: flex;
|
|
269
|
+
align-items: stretch;
|
|
270
|
+
gap: t.use-var('spacing-sm');
|
|
271
|
+
margin-bottom: t.use-var('spacing-sm');
|
|
272
|
+
overflow-x: auto;
|
|
273
|
+
scrollbar-width: none;
|
|
274
|
+
|
|
275
|
+
&::-webkit-scrollbar {
|
|
276
|
+
display: none;
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
@include m.e(tab) {
|
|
281
|
+
position: relative;
|
|
282
|
+
flex-shrink: 0;
|
|
283
|
+
min-height: t.use-var('touch-target');
|
|
284
|
+
padding: 0;
|
|
285
|
+
border: none;
|
|
286
|
+
border-bottom: 2px solid transparent;
|
|
287
|
+
background: none;
|
|
288
|
+
color: fn.use-var(text-color, second);
|
|
289
|
+
font-size: t.use-var('font-size-main');
|
|
290
|
+
white-space: nowrap;
|
|
291
|
+
cursor: pointer;
|
|
292
|
+
-webkit-tap-highlight-color: transparent;
|
|
293
|
+
|
|
294
|
+
@include m.is(active) {
|
|
295
|
+
border-bottom-color: fn.use-var(color, primary);
|
|
296
|
+
color: fn.use-var(color, primary);
|
|
297
|
+
font-weight: 600;
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
// 选项列表
|
|
302
|
+
@include m.e(options) {
|
|
303
|
+
list-style: none;
|
|
304
|
+
margin: 0;
|
|
305
|
+
padding: 0;
|
|
306
|
+
display: flex;
|
|
307
|
+
flex-direction: column;
|
|
308
|
+
gap: t.use-var('spacing-xs');
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
@include m.e(option) {
|
|
312
|
+
// 选项整行热区 ≥44×44
|
|
313
|
+
display: flex;
|
|
314
|
+
align-items: center;
|
|
315
|
+
min-height: t.use-var('touch-target');
|
|
316
|
+
gap: t.use-var('spacing-md');
|
|
317
|
+
padding: 0 t.use-var('spacing-md');
|
|
318
|
+
border-radius: t.control-radius(default);
|
|
319
|
+
color: fn.use-var(text-color, main);
|
|
320
|
+
user-select: none;
|
|
321
|
+
cursor: pointer;
|
|
322
|
+
|
|
323
|
+
&:active {
|
|
324
|
+
background-color: fn.use-var(bg-color, hover);
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
// 选中态:底色强调 + 对钩
|
|
328
|
+
@include m.is(active) {
|
|
329
|
+
color: fn.component-var(cascade, option-selected-color, fn.use-var(color, primary));
|
|
330
|
+
font-weight: 600;
|
|
331
|
+
background-color: fn.component-var(
|
|
332
|
+
cascade,
|
|
333
|
+
option-selected-bg,
|
|
334
|
+
fn.use-var(color, primary, light-9)
|
|
335
|
+
);
|
|
336
|
+
|
|
337
|
+
&:active {
|
|
338
|
+
background-color: fn.use-var(color, primary, light-7);
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
@include m.e(option-main) {
|
|
344
|
+
flex: 1;
|
|
345
|
+
min-width: 0;
|
|
346
|
+
display: flex;
|
|
347
|
+
flex-direction: column;
|
|
348
|
+
padding-block: t.use-var('spacing-sm');
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
@include m.e(option-label) {
|
|
352
|
+
flex: 1;
|
|
353
|
+
min-width: 0;
|
|
354
|
+
@include m.ellipsis;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
@include m.e(option-path) {
|
|
358
|
+
min-width: 0;
|
|
359
|
+
color: fn.use-var(text-color, second);
|
|
360
|
+
font-size: t.use-var('font-size-auxiliary');
|
|
361
|
+
font-weight: 400;
|
|
362
|
+
@include m.ellipsis;
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
// 勾选框视觉(内部实现,非 checkbox 组件):20px 下限与 checkbox 指示器同规格
|
|
366
|
+
@include m.e(checkbox) {
|
|
367
|
+
position: relative;
|
|
368
|
+
display: inline-flex;
|
|
369
|
+
align-items: center;
|
|
370
|
+
justify-content: center;
|
|
371
|
+
flex-shrink: 0;
|
|
372
|
+
width: 20px;
|
|
373
|
+
height: 20px;
|
|
374
|
+
border: 1px solid fn.use-var(border-color);
|
|
375
|
+
border-radius: t.control-radius(small);
|
|
376
|
+
color: fn.use-var(text-color, white);
|
|
377
|
+
font-size: t.use-var('font-size-secondary');
|
|
378
|
+
transition:
|
|
379
|
+
background-color fn.use-var(transition, fast) fn.use-var(transition, ease),
|
|
380
|
+
border-color fn.use-var(transition, fast) fn.use-var(transition, ease);
|
|
381
|
+
|
|
382
|
+
svg {
|
|
383
|
+
width: 1em;
|
|
384
|
+
height: 1em;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
&::before {
|
|
388
|
+
content: '';
|
|
389
|
+
position: absolute;
|
|
390
|
+
inset: -12px;
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
@include m.is(checked) {
|
|
394
|
+
border-color: fn.use-var(color, primary);
|
|
395
|
+
background-color: fn.use-var(color, primary);
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
@include m.e(arrow-right, check) {
|
|
400
|
+
display: inline-flex;
|
|
401
|
+
align-items: center;
|
|
402
|
+
flex-shrink: 0;
|
|
403
|
+
font-size: t.use-var('font-size-main');
|
|
404
|
+
|
|
405
|
+
svg {
|
|
406
|
+
width: 1em;
|
|
407
|
+
height: 1em;
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
@include m.e(arrow-right) {
|
|
412
|
+
color: fn.use-var(text-color, second);
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
@include m.e(check) {
|
|
416
|
+
color: fn.use-var(color, primary);
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
@include m.e(empty) {
|
|
420
|
+
padding: t.use-var('spacing-lg') 0;
|
|
421
|
+
text-align: center;
|
|
422
|
+
color: fn.use-var(text-color, second);
|
|
423
|
+
}
|
|
424
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="classList" @click="handleChange">
|
|
3
|
+
<slot />
|
|
4
|
+
</div>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script lang="ts" setup>
|
|
8
|
+
import { computed } from 'vue'
|
|
9
|
+
|
|
10
|
+
import { bem } from '../../shared/bem'
|
|
11
|
+
import type { CheckTagEmits, CheckTagProps } from '../../types/check-tag'
|
|
12
|
+
|
|
13
|
+
defineOptions({ name: 'UCheckTag' })
|
|
14
|
+
|
|
15
|
+
const cls = bem('check-tag')
|
|
16
|
+
|
|
17
|
+
const props = defineProps<CheckTagProps>()
|
|
18
|
+
|
|
19
|
+
const emits = defineEmits<CheckTagEmits>()
|
|
20
|
+
|
|
21
|
+
const classList = computed(() => {
|
|
22
|
+
return [
|
|
23
|
+
cls.b,
|
|
24
|
+
bem.is('checked', props.modelValue ?? props.checked),
|
|
25
|
+
bem.is('disabled', props.disabled)
|
|
26
|
+
]
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
const handleChange = () => {
|
|
30
|
+
if (props.disabled) return
|
|
31
|
+
const next = !(props.modelValue ?? props.checked)
|
|
32
|
+
emits('update:modelValue', next)
|
|
33
|
+
emits('change', next)
|
|
34
|
+
}
|
|
35
|
+
</script>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as UCheckTag } from './check-tag.vue'
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
@use 'pkg:@veltra/styles/mixins' as m with ($namespace: um);
|
|
2
|
+
@use 'pkg:@veltra/styles/functions' as fn;
|
|
3
|
+
@use '../../styles/tokens' as t;
|
|
4
|
+
|
|
5
|
+
@include m.b(check-tag) {
|
|
6
|
+
@include m.flex(inline-flex, center, center);
|
|
7
|
+
vertical-align: middle;
|
|
8
|
+
box-sizing: border-box;
|
|
9
|
+
cursor: pointer;
|
|
10
|
+
user-select: none;
|
|
11
|
+
-webkit-tap-highlight-color: transparent;
|
|
12
|
+
|
|
13
|
+
// 触控热区不小于 44×44
|
|
14
|
+
min-height: t.use-var('touch-target');
|
|
15
|
+
min-width: t.use-var('touch-target');
|
|
16
|
+
padding: 0 t.use-var('spacing-md');
|
|
17
|
+
|
|
18
|
+
color: fn.use-var(text-color, main);
|
|
19
|
+
border: 1px solid fn.use-var(color, primary);
|
|
20
|
+
border-radius: t.control-radius(default);
|
|
21
|
+
background-color: fn.use-var(color, primary, light-9);
|
|
22
|
+
transition:
|
|
23
|
+
background-color fn.use-var(transition, fast) fn.use-var(transition, ease),
|
|
24
|
+
border-color fn.use-var(transition, fast) fn.use-var(transition, ease),
|
|
25
|
+
color fn.use-var(transition, fast) fn.use-var(transition, ease);
|
|
26
|
+
|
|
27
|
+
// 移动端无 hover,用 :active 提供触控反馈;禁用态无按压反馈
|
|
28
|
+
&:active:not(.is-disabled) {
|
|
29
|
+
background-color: fn.use-var(color, primary, light-7);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
@include m.is(checked) {
|
|
33
|
+
color: fn.use-var(text-color, white);
|
|
34
|
+
border-color: fn.use-var(color, primary, dark-3);
|
|
35
|
+
background-color: fn.use-var(color, primary, dark-3);
|
|
36
|
+
|
|
37
|
+
&:active:not(.is-disabled) {
|
|
38
|
+
background-color: fn.use-var(color, primary, dark-5);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
@include m.is(disabled) {
|
|
43
|
+
cursor: not-allowed;
|
|
44
|
+
opacity: 0.5;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import './style.scss'
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<label :class="className">
|
|
3
|
+
<input
|
|
4
|
+
type="checkbox"
|
|
5
|
+
:class="cls.e('native')"
|
|
6
|
+
:checked="checked"
|
|
7
|
+
:disabled="disabled"
|
|
8
|
+
@click="handleInput"
|
|
9
|
+
/>
|
|
10
|
+
|
|
11
|
+
<span :class="cls.e('indicator')">
|
|
12
|
+
<svg viewBox="0 0 64 64" v-if="checked" fill="currentColor">
|
|
13
|
+
<path
|
|
14
|
+
d="M50.42,16.76L22.34,39.45l-8.1-11.46c-1.12-1.58-3.3-1.96-4.88-0.84c-1.58,1.12-1.95,3.3-0.84,4.88l10.26,14.51 c0.56,0.79,1.42,1.31,2.38,1.45c0.16,0.02,0.32,0.03,0.48,0.03c0.8,0,1.57-0.27,2.2-0.78l30.99-25.03c1.5-1.21,1.74-3.42,0.52-4.92 C54.13,15.78,51.93,15.55,50.42,16.76z"
|
|
15
|
+
></path>
|
|
16
|
+
</svg>
|
|
17
|
+
<span v-else-if="indeterminate" :class="cls.m('indeterminate')"></span>
|
|
18
|
+
</span>
|
|
19
|
+
|
|
20
|
+
<span :class="cls.e('label')" v-if="$slots.default"><slot /> </span>
|
|
21
|
+
</label>
|
|
22
|
+
</template>
|
|
23
|
+
|
|
24
|
+
<script lang="ts" setup>
|
|
25
|
+
import { useFormFallbackProps } from '@veltra/compositions'
|
|
26
|
+
import { injectFormContext } from '@veltra/utils'
|
|
27
|
+
import { computed } from 'vue'
|
|
28
|
+
|
|
29
|
+
import { bem } from '../../shared/bem'
|
|
30
|
+
import type { CheckboxEmits, CheckboxProps } from '../../types/checkbox'
|
|
31
|
+
|
|
32
|
+
defineOptions({ name: 'UCheckbox' })
|
|
33
|
+
const props = withDefaults(defineProps<CheckboxProps>(), {
|
|
34
|
+
disabled: undefined,
|
|
35
|
+
readonly: undefined
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
const emit = defineEmits<CheckboxEmits>()
|
|
39
|
+
const cls = bem('checkbox')
|
|
40
|
+
|
|
41
|
+
const checked = defineModel<boolean>()
|
|
42
|
+
|
|
43
|
+
const { formProps } = injectFormContext()
|
|
44
|
+
|
|
45
|
+
const { size, disabled, readonly } = useFormFallbackProps([formProps ?? {}, props], {
|
|
46
|
+
size: 'default',
|
|
47
|
+
disabled: false,
|
|
48
|
+
readonly: false
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
const className = computed(() => {
|
|
52
|
+
return [
|
|
53
|
+
cls.b,
|
|
54
|
+
cls.m(size.value),
|
|
55
|
+
bem.is('disabled', disabled.value),
|
|
56
|
+
bem.is('readonly', readonly.value),
|
|
57
|
+
bem.is('checked', checked.value || props.indeterminate)
|
|
58
|
+
]
|
|
59
|
+
})
|
|
60
|
+
|
|
61
|
+
const handleInput = (e: MouseEvent) => {
|
|
62
|
+
if (readonly.value) return
|
|
63
|
+
const target = e.target as HTMLInputElement
|
|
64
|
+
checked.value = target.checked
|
|
65
|
+
emit('change', target.checked, e)
|
|
66
|
+
}
|
|
67
|
+
</script>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default as UCheckbox } from './checkbox.vue'
|