@veltra/mobile 1.1.4 → 1.1.6

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.
Files changed (48) hide show
  1. package/dist/components/button/style2.css +43 -6
  2. package/dist/components/cascade/style2.css +30 -3
  3. package/dist/components/checkbox/style2.css +36 -9
  4. package/dist/components/checkbox-group/style2.css +3 -3
  5. package/dist/components/date-picker/style2.css +30 -3
  6. package/dist/components/input/input.js +4 -1
  7. package/dist/components/input/input.js.map +1 -1
  8. package/dist/components/input/style2.css +50 -4
  9. package/dist/components/list/style2.css +30 -3
  10. package/dist/components/multi-select/style2.css +30 -3
  11. package/dist/components/number-input/style2.css +10 -0
  12. package/dist/components/password-input/style2.css +10 -0
  13. package/dist/components/progress/progress.js +4 -1
  14. package/dist/components/progress/progress.js.map +1 -1
  15. package/dist/components/radio/style2.css +36 -9
  16. package/dist/components/segment/style2.css +30 -6
  17. package/dist/components/select/style2.css +30 -3
  18. package/dist/components/steps/style2.css +6 -6
  19. package/dist/components/switch/style2.css +30 -3
  20. package/dist/components/tabs/style2.css +27 -3
  21. package/dist/components/textarea/style2.css +27 -4
  22. package/dist/components/textarea/textarea.js +2 -1
  23. package/dist/components/textarea/textarea.js.map +1 -1
  24. package/dist/components/time-picker/style2.css +30 -3
  25. package/dist/types/progress.d.ts +1 -1
  26. package/package.json +1 -1
  27. package/src/components/button/style.scss +23 -8
  28. package/src/components/cascade/style.scss +16 -2
  29. package/src/components/checkbox/style.scss +18 -6
  30. package/src/components/checkbox-group/style.scss +2 -2
  31. package/src/components/date-picker/style.scss +16 -2
  32. package/src/components/input/input.vue +1 -1
  33. package/src/components/input/style.scss +43 -5
  34. package/src/components/list/style.scss +18 -3
  35. package/src/components/multi-select/style.scss +16 -2
  36. package/src/components/number-input/style.scss +13 -1
  37. package/src/components/password-input/style.scss +13 -1
  38. package/src/components/progress/progress.vue +1 -1
  39. package/src/components/radio/style.scss +18 -6
  40. package/src/components/segment/style.scss +15 -3
  41. package/src/components/select/style.scss +16 -2
  42. package/src/components/steps/style.scss +4 -5
  43. package/src/components/switch/style.scss +15 -3
  44. package/src/components/tabs/style.scss +15 -2
  45. package/src/components/textarea/style.scss +12 -3
  46. package/src/components/textarea/textarea.vue +1 -1
  47. package/src/components/time-picker/style.scss +16 -2
  48. package/src/types/progress.ts +1 -1
@@ -14,17 +14,31 @@ $root-name: input;
14
14
  transition:
15
15
  border-color fn.use-var(transition, fast) fn.use-var(transition, ease),
16
16
  box-shadow fn.use-var(transition, fast) fn.use-var(transition, ease);
17
- overflow: hidden;
18
17
  width: 100%;
19
18
 
20
19
  @include m.flex($display: inline-flex);
21
20
 
22
21
  @include m.size using ($size) {
23
- // 密度全部取移动端 token:高度不小于 44px 触控热区,字号 16px(iOS 聚焦防缩放)
24
- height: max(t.control-height($size), t.use-var('touch-target'));
22
+ // 视觉高度按档生效;字号 16px(iOS 聚焦防缩放)
23
+ $height: t.control-height($size);
24
+ $hit-offset: calc((#{t.use-var('touch-target')} - #{$height}) / -2);
25
+
26
+ position: relative;
27
+ height: $height;
25
28
  border-radius: t.control-radius($size);
26
29
  padding: 0 t.use-var('spacing-md');
27
30
 
31
+ // 触控热区不足 44px 时由 ::before 上下外扩补足命中区域,不抬高视觉高度
32
+ // (伪元素位于子元素之下,不拦截前后缀 / 清除等内部可点元素)
33
+ &::before {
34
+ content: '';
35
+ position: absolute;
36
+ top: $hit-offset;
37
+ bottom: $hit-offset;
38
+ left: 0;
39
+ right: 0;
40
+ }
41
+
28
42
  @include m.bem($root-name, native) {
29
43
  font-size: t.use-var('font-size-main');
30
44
  line-height: t.use-var('text-line-height');
@@ -68,15 +82,28 @@ $root-name: input;
68
82
  text-align: center;
69
83
  @include m.flex(inline-flex, $justify: center, $align: center);
70
84
 
71
- // 前后缀可点击时保证 44px 宽热区
85
+ // 前后缀可点击时保证 44px 热区
72
86
  @include m.is(clickable) {
87
+ position: relative;
73
88
  min-width: t.use-var('touch-target');
74
89
  cursor: pointer;
90
+
91
+ // 垂直居中的 44px 命中层:行高随密度档变化时热区高度不塌缩
92
+ &::after {
93
+ content: '';
94
+ position: absolute;
95
+ top: 50%;
96
+ height: t.use-var('touch-target');
97
+ transform: translateY(-50%);
98
+ left: 0;
99
+ right: 0;
100
+ }
75
101
  }
76
102
  }
77
103
 
78
104
  @include m.e(clear) {
79
- // 清除按钮:宽度 44px、高度撑满输入行内容盒(行高 ≥44px)
105
+ // 清除按钮:宽度 44px;高度撑满输入行内容盒
106
+ position: relative;
80
107
  min-width: t.use-var('touch-target');
81
108
  align-self: stretch;
82
109
  border: none;
@@ -91,6 +118,17 @@ $root-name: input;
91
118
  cursor: pointer;
92
119
  -webkit-tap-highlight-color: transparent;
93
120
 
121
+ // 垂直居中的 44px 命中层:行高随密度档变化时热区高度不塌缩
122
+ &::after {
123
+ content: '';
124
+ position: absolute;
125
+ top: 50%;
126
+ height: t.use-var('touch-target');
127
+ transform: translateY(-50%);
128
+ left: 0;
129
+ right: 0;
130
+ }
131
+
94
132
  svg {
95
133
  width: 1em;
96
134
  height: 1em;
@@ -6,7 +6,7 @@ $root-name: list;
6
6
  $item-name: $root-name + '-item';
7
7
 
8
8
  // 移动端列表:无滚动包装层,原生 ul/li 直接承载滚动;
9
- // 行高、字号、行间距走 --um-* 密度 token,行高保底 44px 触控热区
9
+ // 行高、字号、行间距走 --um-* 密度 token,行高按控件高度档生效
10
10
  @include m.b($root-name) {
11
11
  margin: 0;
12
12
  padding: 0;
@@ -29,7 +29,8 @@ $item-name: $root-name + '-item';
29
29
  }
30
30
  }
31
31
 
32
- // 尺寸档:行高取控件高度档并保底 44px,横向内边距走间距刻度
32
+ // 尺寸档:行高按控件高度档生效,不足 44px 触控热区由 ::before 上下外扩
33
+ // 补足命中区域,不抬高视觉行高
33
34
  @include m.size using ($size) {
34
35
  @include m.bem($item-name) {
35
36
  $padding: t.use-var(spacing-lg);
@@ -42,9 +43,23 @@ $item-name: $root-name + '-item';
42
43
  $padding: t.use-var(spacing-xl);
43
44
  }
44
45
 
46
+ $height: t.control-height($size);
47
+ $hit-offset: calc((#{t.use-var(touch-target)} - #{$height}) / -2);
48
+
49
+ position: relative;
45
50
  padding: 0 $padding;
46
51
  border-radius: t.control-radius($size);
47
- min-height: max(t.control-height($size), t.use-var(touch-target));
52
+ min-height: $height;
53
+
54
+ // 伪元素位于子元素之下,不拦截行内可点元素
55
+ &::before {
56
+ content: '';
57
+ position: absolute;
58
+ top: $hit-offset;
59
+ bottom: $hit-offset;
60
+ left: 0;
61
+ right: 0;
62
+ }
48
63
  }
49
64
  }
50
65
  }
@@ -22,9 +22,23 @@ $root-name: multi-select;
22
22
  border-color fn.use-var(transition, fast) fn.use-var(transition, ease),
23
23
  box-shadow fn.use-var(transition, fast) fn.use-var(transition, ease);
24
24
 
25
- // 触控热区:任何尺寸的可点击区域不小于 44×44,高度走移动端密度 token
25
+ // 视觉高度按档生效;触控热区不足 44px 时由 ::before 上下外扩补足命中区域,
26
+ // 不抬高视觉高度(伪元素位于子元素之下,不拦截标签关闭 / 清除等内部可点元素)
26
27
  @include m.size using ($size) {
27
- min-height: max(t.control-height($size), t.use-var('touch-target'));
28
+ $height: t.control-height($size);
29
+ $hit-offset: calc((#{t.use-var('touch-target')} - #{$height}) / -2);
30
+
31
+ position: relative;
32
+ min-height: $height;
33
+
34
+ &::before {
35
+ content: '';
36
+ position: absolute;
37
+ top: $hit-offset;
38
+ bottom: $hit-offset;
39
+ left: 0;
40
+ right: 0;
41
+ }
28
42
  }
29
43
 
30
44
  &:active {
@@ -29,7 +29,8 @@ $root-name: number-input;
29
29
  }
30
30
 
31
31
  @include m.e(clear) {
32
- // 清除按钮:宽度 44px、高度撑满输入行内容盒(行高 ≥44px)
32
+ // 清除按钮:宽度 44px;高度撑满输入行内容盒
33
+ position: relative;
33
34
  min-width: t.use-var('touch-target');
34
35
  align-self: stretch;
35
36
  display: inline-flex;
@@ -44,6 +45,17 @@ $root-name: number-input;
44
45
  cursor: pointer;
45
46
  -webkit-tap-highlight-color: transparent;
46
47
 
48
+ // 垂直居中的 44px 命中层:行高随密度档变化时热区高度不塌缩
49
+ &::after {
50
+ content: '';
51
+ position: absolute;
52
+ top: 50%;
53
+ height: t.use-var('touch-target');
54
+ transform: translateY(-50%);
55
+ left: 0;
56
+ right: 0;
57
+ }
58
+
47
59
  svg {
48
60
  width: 1em;
49
61
  height: 1em;
@@ -12,7 +12,8 @@ $root-name: password-input;
12
12
  }
13
13
 
14
14
  @include m.e(clear, visibility-toggle) {
15
- // 清除与明文切换按钮:宽度 44px、高度撑满输入行内容盒(行高 ≥44px)
15
+ // 清除与明文切换按钮:宽度 44px;高度撑满输入行内容盒
16
+ position: relative;
16
17
  min-width: t.use-var('touch-target');
17
18
  align-self: stretch;
18
19
  display: inline-flex;
@@ -27,6 +28,17 @@ $root-name: password-input;
27
28
  cursor: pointer;
28
29
  -webkit-tap-highlight-color: transparent;
29
30
 
31
+ // 垂直居中的 44px 命中层:行高随密度档变化时热区高度不塌缩
32
+ &::after {
33
+ content: '';
34
+ position: absolute;
35
+ top: 50%;
36
+ height: t.use-var('touch-target');
37
+ transform: translateY(-50%);
38
+ left: 0;
39
+ right: 0;
40
+ }
41
+
30
42
  svg {
31
43
  width: 1em;
32
44
  height: 1em;
@@ -52,7 +52,7 @@ import type { ProgressProps } from '../../types/progress'
52
52
 
53
53
  defineOptions({ name: 'UProgress' })
54
54
 
55
- const props = defineProps<ProgressProps>()
55
+ const props = withDefaults(defineProps<ProgressProps>(), { type: 'primary' })
56
56
 
57
57
  defineSlots<{
58
58
  default: (props: {
@@ -4,9 +4,6 @@
4
4
 
5
5
  $root-name: radio;
6
6
 
7
- // 移动端单选框指示器下限:过小难以辨认选中状态
8
- $indicator-min: 20px;
9
-
10
7
  @include m.b($root-name) {
11
8
  vertical-align: middle;
12
9
  user-select: none;
@@ -16,12 +13,27 @@ $indicator-min: 20px;
16
13
  gap: t.spacing(default);
17
14
 
18
15
  @include m.size using ($size) {
19
- // 触控热区:整个 label 可点,不小于触控下限
20
- min-height: max(t.control-height($size), t.use-var(touch-target));
16
+ // 视觉高度按档生效;触控热区不足 44px 时由 ::before 上下外扩补足命中区域
17
+ // (根是 label,外扩区点击照常选中;伪元素位于子元素之下不拦截点击)
18
+ $height: t.control-height($size);
19
+ $hit-offset: calc((#{t.use-var(touch-target)} - #{$height}) / -2);
20
+
21
+ position: relative;
22
+ min-height: $height;
21
23
  min-width: t.use-var(touch-target);
22
24
 
25
+ &::before {
26
+ content: '';
27
+ position: absolute;
28
+ top: $hit-offset;
29
+ bottom: $hit-offset;
30
+ left: 0;
31
+ right: 0;
32
+ }
33
+
23
34
  @include m.bem($root-name, indicator) {
24
- $indicator: max(calc(t.control-height($size) / 2), $indicator-min);
35
+ // 指示器按高度档的一半缩放(16 / 20 / 24),不设下限避免 small 与 default 等大
36
+ $indicator: calc(t.control-height($size) / 2);
25
37
 
26
38
  width: $indicator;
27
39
  height: $indicator;
@@ -34,13 +34,25 @@
34
34
  border-radius: t.control-radius($size);
35
35
 
36
36
  @include m.bem(segment, item) {
37
- // 密度走移动端 token:视觉高度 ≥32px、触控热区 ≥44×44
37
+ // 视觉尺寸按档生效(容器内缩 4px);触控热区不足 44px 时由 ::before
38
+ // 上下外扩补足命中区域,不抬高视觉高度
38
39
  // (block 形态由更高特异性保持 min-width: 0 的弹性分配)
39
- min-height: max(calc(#{t.control-height($size)} - 4px), t.use-var('touch-target'));
40
- min-width: max(calc(#{t.control-height($size)} - 4px), t.use-var('touch-target'));
40
+ $hit-offset: calc((#{t.use-var('touch-target')} - (#{t.control-height($size)} - 4px)) / -2);
41
+
42
+ min-height: calc(#{t.control-height($size)} - 4px);
43
+ min-width: calc(#{t.control-height($size)} - 4px);
41
44
  padding: 0 calc(#{t.spacing($size)} * 1.5);
42
45
  border-radius: calc(#{t.control-radius($size)} - 2px);
43
46
  font-size: t.use-var('font-size-main');
47
+
48
+ &::before {
49
+ content: '';
50
+ position: absolute;
51
+ top: $hit-offset;
52
+ bottom: $hit-offset;
53
+ left: 0;
54
+ right: 0;
55
+ }
44
56
  }
45
57
  }
46
58
 
@@ -22,9 +22,23 @@ $root-name: select;
22
22
  border-color fn.use-var(transition, fast) fn.use-var(transition, ease),
23
23
  box-shadow fn.use-var(transition, fast) fn.use-var(transition, ease);
24
24
 
25
- // 触控热区:任何尺寸的可点击区域不小于 44×44,高度走移动端密度 token
25
+ // 视觉高度按档生效;触控热区不足 44px 时由 ::before 上下外扩补足命中区域,
26
+ // 不抬高视觉高度(伪元素位于子元素之下,不拦截清除 / 箭头等内部可点元素)
26
27
  @include m.size using ($size) {
27
- min-height: max(t.control-height($size), t.use-var('touch-target'));
28
+ $height: t.control-height($size);
29
+ $hit-offset: calc((#{t.use-var('touch-target')} - #{$height}) / -2);
30
+
31
+ position: relative;
32
+ min-height: $height;
33
+
34
+ &::before {
35
+ content: '';
36
+ position: absolute;
37
+ top: $hit-offset;
38
+ bottom: $hit-offset;
39
+ left: 0;
40
+ right: 0;
41
+ }
28
42
  }
29
43
 
30
44
  &:active {
@@ -6,9 +6,6 @@
6
6
  // 方便拼接
7
7
  $root-name: steps;
8
8
 
9
- // 触控可读的下限:圆圈直径与点击热区不小于该值
10
- $icon-min: 40px;
11
-
12
9
  @include m.b($root-name) {
13
10
  padding: 0;
14
11
  margin: 0;
@@ -224,8 +221,10 @@ $icon-min: 40px;
224
221
  @include m.size using ($size) {
225
222
  @include m.bem($root-name, icon) {
226
223
  font-size: t.use-var('font-size-main');
227
- width: max(t.control-height($size), $icon-min);
228
- height: max(t.control-height($size), $icon-min);
224
+ // 圆圈直径按高度档生效(32 / 40 / 48);点击热区由整个 item 保证 ≥44px,
225
+ // 图标本身不承担热区职责,不设下限避免 small 与 default 等大
226
+ width: t.control-height($size);
227
+ height: t.control-height($size);
229
228
  }
230
229
  }
231
230
  }
@@ -13,13 +13,25 @@ $root-name: switch;
13
13
  gap: t.spacing(default);
14
14
 
15
15
  @include m.size using ($size) {
16
- // 拨动热区:整个 label 可点,不小于触控下限;轨道尺寸走 --um-* 移动档
17
- $touch-size: max(t.control-height($size), t.use-var(touch-target));
16
+ // 视觉行高按档生效;触控热区不足 44px 时由 ::before 上下外扩补足命中区域
17
+ // (整个 label 可点,根是 label 外扩区点击照常切换;轨道尺寸走 --um-* 移动档)
18
+ $height: t.control-height($size);
18
19
  $track: t.switch-track($size);
20
+ $hit-offset: calc((#{t.use-var(touch-target)} - #{$height}) / -2);
19
21
 
20
- min-height: $touch-size;
22
+ position: relative;
23
+ min-height: $height;
21
24
  min-width: t.use-var(touch-target);
22
25
 
26
+ &::before {
27
+ content: '';
28
+ position: absolute;
29
+ top: $hit-offset;
30
+ bottom: $hit-offset;
31
+ left: 0;
32
+ right: 0;
33
+ }
34
+
23
35
  @include m.bem($root-name, button) {
24
36
  height: $track;
25
37
  width: calc($track * 2);
@@ -249,13 +249,26 @@ $indicator-height: 3px;
249
249
  align-self: stretch;
250
250
  }
251
251
 
252
- // 触控热区:任何尺寸的标签可点击区域不小于 44×44,字号 / 高度走移动端密度 token
252
+ // 视觉高度按档生效;触控热区不足 44px 时由 ::before 上下外扩补足命中区域,
253
+ // 不抬高视觉高度(::after 已被激活下划线占用,热区伪元素用 ::before)
253
254
  @include m.size using ($size) {
254
255
  @include m.bem(tabs-bar, item) {
255
- min-height: max(t.control-height($size), t.use-var('touch-target'));
256
+ $height: t.control-height($size);
257
+ $hit-offset: calc((#{t.use-var('touch-target')} - #{$height}) / -2);
258
+
259
+ min-height: $height;
256
260
  min-width: t.use-var('touch-target');
257
261
  padding: 0 t.spacing($size);
258
262
  font-size: t.use-var('font-size-main');
263
+
264
+ &::before {
265
+ content: '';
266
+ position: absolute;
267
+ top: $hit-offset;
268
+ bottom: $hit-offset;
269
+ left: 0;
270
+ right: 0;
271
+ }
259
272
  }
260
273
  }
261
274
 
@@ -14,17 +14,26 @@ $root-name: textarea;
14
14
  transition:
15
15
  border-color fn.use-var(transition, fast) fn.use-var(transition, ease),
16
16
  box-shadow fn.use-var(transition, fast) fn.use-var(transition, ease);
17
- overflow: hidden;
18
17
  vertical-align: middle;
19
18
 
20
19
  @include m.size using ($size) {
21
20
  border-radius: t.control-radius($size);
22
21
 
22
+ // 触控热区不足 44px 时由 ::before 上下外扩补足命中区域,不抬高视觉高度
23
+ &::before {
24
+ content: '';
25
+ position: absolute;
26
+ top: calc((#{t.use-var('touch-target')} - #{t.control-height($size)}) / -2);
27
+ bottom: calc((#{t.use-var('touch-target')} - #{t.control-height($size)}) / -2);
28
+ left: 0;
29
+ right: 0;
30
+ }
31
+
23
32
  @include m.bem($root-name, native) {
24
33
  // 行高、内边距走移动端 token;右侧让位计数/清除 44px 热区
25
34
  padding: t.spacing($size) t.use-var('touch-target') t.spacing($size) t.spacing($size);
26
- // 触控热区:文本域高度不小于 44px;字号 16px(iOS 聚焦防视口缩放)
27
- min-height: max(t.control-height($size), t.use-var('touch-target'));
35
+ // 视觉高度按档生效;字号 16px(iOS 聚焦防视口缩放)
36
+ min-height: t.control-height($size);
28
37
  font-size: t.use-var('font-size-main');
29
38
  line-height: t.use-var('text-line-height');
30
39
  }
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div v-if="!readonly" :class="textareaClass">
2
+ <div v-if="!readonly" :class="textareaClass" @click="textareaRef?.focus()">
3
3
  <textarea
4
4
  :class="cls.e('native')"
5
5
  :placeholder="placeholder"
@@ -22,9 +22,23 @@ $root-name: time-picker;
22
22
  border-color fn.use-var(transition, fast) fn.use-var(transition, ease),
23
23
  box-shadow fn.use-var(transition, fast) fn.use-var(transition, ease);
24
24
 
25
- // 触控热区:任何尺寸的可点击区域不小于 44×44,高度走移动端密度 token
25
+ // 视觉高度按档生效;触控热区不足 44px 时由 ::before 上下外扩补足命中区域,
26
+ // 不抬高视觉高度(伪元素位于子元素之下,不拦截清除 / 箭头等内部可点元素)
26
27
  @include m.size using ($size) {
27
- min-height: max(t.control-height($size), t.use-var('touch-target'));
28
+ $height: t.control-height($size);
29
+ $hit-offset: calc((#{t.use-var('touch-target')} - #{$height}) / -2);
30
+
31
+ position: relative;
32
+ min-height: $height;
33
+
34
+ &::before {
35
+ content: '';
36
+ position: absolute;
37
+ top: $hit-offset;
38
+ bottom: $hit-offset;
39
+ left: 0;
40
+ right: 0;
41
+ }
28
42
  }
29
43
 
30
44
  &:active {
@@ -3,7 +3,7 @@ import type { ColorType, DeconstructValue } from '@veltra/utils'
3
3
  /** progress组件属性 */
4
4
  export interface ProgressProps {
5
5
  /** 类型 */
6
- type: ColorType | ((percentage: number) => ColorType)
6
+ type?: ColorType | ((percentage: number) => ColorType)
7
7
  /** 圆形进度条尺寸 */
8
8
  size?: number | string
9
9
  /** 进度百分比 */