@douyinfe/semi-foundation 2.15.1 → 2.16.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/input/input.scss +39 -9
- package/input/textarea.scss +2 -2
- package/lib/cjs/input/input.css +29 -1
- package/lib/cjs/input/input.scss +39 -9
- package/lib/cjs/input/textarea.css +2 -2
- package/lib/cjs/input/textarea.scss +2 -2
- package/lib/cjs/select/select.css +2 -2
- package/lib/cjs/select/variables.scss +4 -4
- package/lib/cjs/slider/foundation.d.ts +9 -2
- package/lib/cjs/slider/foundation.js +195 -5
- package/lib/cjs/slider/slider.css +3 -0
- package/lib/cjs/slider/slider.scss +7 -5
- package/lib/cjs/slider/variables.scss +4 -4
- package/lib/cjs/tooltip/variables.scss +1 -1
- package/lib/cjs/treeSelect/treeSelect.css +2 -0
- package/lib/cjs/treeSelect/treeSelect.scss +2 -0
- package/lib/es/input/input.css +29 -1
- package/lib/es/input/input.scss +39 -9
- package/lib/es/input/textarea.css +2 -2
- package/lib/es/input/textarea.scss +2 -2
- package/lib/es/select/select.css +2 -2
- package/lib/es/select/variables.scss +4 -4
- package/lib/es/slider/foundation.d.ts +9 -2
- package/lib/es/slider/foundation.js +192 -5
- package/lib/es/slider/slider.css +3 -0
- package/lib/es/slider/slider.scss +7 -5
- package/lib/es/slider/variables.scss +4 -4
- package/lib/es/tooltip/variables.scss +1 -1
- package/lib/es/treeSelect/treeSelect.css +2 -0
- package/lib/es/treeSelect/treeSelect.scss +2 -0
- package/package.json +2 -2
- package/select/variables.scss +4 -4
- package/slider/foundation.ts +141 -9
- package/slider/slider.scss +7 -5
- package/slider/variables.scss +4 -4
- package/tooltip/variables.scss +1 -1
- package/treeSelect/treeSelect.scss +2 -0
- package/utils/a11y.ts +2 -2
|
@@ -11,9 +11,10 @@ $color-slider_handle_disabled-border-hover: var(--semi-color-white); // 禁用
|
|
|
11
11
|
$color-slider_handle_disabled-border: var(--semi-color-border); // 禁用滑动条圆形描边颜色 - 默认态
|
|
12
12
|
$color-slider_mark-text-default: var(--semi-color-text-2); // 滑动条刻度文字颜色
|
|
13
13
|
$color-slider_rail-bg-default: var(--semi-color-fill-0); // 滑动条轨道颜色 - 未填充
|
|
14
|
-
$color-slider_rail: rgba(0, 0, 0, .65);
|
|
14
|
+
$color-slider_rail: rgba(0, 0, 0, 0.65);
|
|
15
15
|
$color-slider_track-bg-default: var(--semi-color-primary); // 滑动条轨道颜色 - 已填充
|
|
16
16
|
$color-slider_track_disabled-bg: var(--semi-color-primary-disabled); // 禁用滑动条轨道颜色 - 已填充
|
|
17
|
+
$color-slider_handle-focus: var(--semi-color-primary-light-active); // 圆形按钮轮廓 - 聚焦
|
|
17
18
|
|
|
18
19
|
// Spacing
|
|
19
20
|
$spacing-slider-paddingX: 13px; // 滑动条整体水平内边距
|
|
@@ -33,7 +34,7 @@ $spacing-slider_boundary_min-left: 0;
|
|
|
33
34
|
$spacing-slider_boundary_max-right: 0;
|
|
34
35
|
$spacing-slider_vertical_marks-marginTop: -30px; // 垂直滑动条刻度标签顶部外边距
|
|
35
36
|
$spacing-slider_vertical_marks-marginLeft: 29px; // 垂直滑动条刻度标签左侧外边距
|
|
36
|
-
$spacing-slider_vertical_marks-reverse-marginLeft: -26px
|
|
37
|
+
$spacing-slider_vertical_marks-reverse-marginLeft: -26px; // 垂直滑动条刻度标签左侧外边距(标签在左侧时)
|
|
37
38
|
$spacing-slider_vertical_rail-top: 0; // 垂直滑动条轨道顶部距离
|
|
38
39
|
$spacing-slider_vertical_handle-marginTop: 0; // 垂直滑动条原型按钮顶部外边距
|
|
39
40
|
$spacing-slider_vertical_handle-marginLeft: -10px; // 垂直滑动条原型按钮左侧外边距
|
|
@@ -42,7 +43,6 @@ $spacing-slider_vertical_handle-marginLeft: -10px; // 垂直滑动条原型按
|
|
|
42
43
|
$radius-slider_rail: var(--semi-border-radius-small); // 滚动条未填充轨道圆角
|
|
43
44
|
$radius-slider_track: var(--semi-border-radius-small); // 滚动条已填充轨道圆角
|
|
44
45
|
|
|
45
|
-
|
|
46
46
|
// Width/Height
|
|
47
47
|
$height-slider_wrapper: 32px; // 滚动条容器整体高度
|
|
48
48
|
$height-slider_vertical_wrapper: 4px; // 垂直滚动条整体宽度
|
|
@@ -52,7 +52,7 @@ $width-slider_handle_clicked: 1px; // 滚动条圆形按钮按下后描边宽度
|
|
|
52
52
|
$height-slider_track: 4px; // 滚动条已填充轨道高度
|
|
53
53
|
$width-slider_dot: 4px; // 滚动条圆形刻度点宽度
|
|
54
54
|
$width-slider_handle_border_disabled: 1px; // 禁用滚动条圆形按钮按下后描边宽度
|
|
55
|
-
|
|
55
|
+
$width-slider_handle-focus: 2px; // 圆形按钮轮廓 - 聚焦
|
|
56
56
|
|
|
57
57
|
// Font
|
|
58
58
|
$font-slider_rail-fontSize: 14px; // 滚动条轨道文本字号
|
|
@@ -19,7 +19,7 @@ $spacing-tooltip_content-paddingBottom: $spacing-tight; // 工具提示内容底
|
|
|
19
19
|
|
|
20
20
|
$font-tooltip-fontSize: $font-size-regular; // 工具提示文本字号
|
|
21
21
|
$width-tooltip: 240px; // 工具提示宽度 - 默认
|
|
22
|
-
$width-tooltip_arrow: 24px; // 工具提示小三角箭头宽度 - 水平
|
|
22
|
+
$width-tooltip_arrow: 24px; // 工具提示小三角箭头宽度 - 水平 ignore-semi-css-trans
|
|
23
23
|
$height-tooltip_arrow: 7px; // 工具提示小三角箭头高度 - 水平
|
|
24
24
|
|
|
25
25
|
$height-tooltip_arrow_vertical: 24px; // 工具提示小三角箭头高度 - 垂直
|
|
@@ -188,6 +188,7 @@
|
|
|
188
188
|
.semi-tree-select-arrow {
|
|
189
189
|
display: inline-flex;
|
|
190
190
|
align-items: center;
|
|
191
|
+
flex-shrink: 0;
|
|
191
192
|
height: 100%;
|
|
192
193
|
justify-content: center;
|
|
193
194
|
width: 32px;
|
|
@@ -212,6 +213,7 @@
|
|
|
212
213
|
display: inline-flex;
|
|
213
214
|
align-items: center;
|
|
214
215
|
height: 100%;
|
|
216
|
+
flex-shrink: 0;
|
|
215
217
|
justify-content: center;
|
|
216
218
|
width: 32px;
|
|
217
219
|
color: var(--semi-color-text-2);
|
|
@@ -239,6 +239,7 @@ $module: #{$prefix}-tree-select;
|
|
|
239
239
|
// right: 0;
|
|
240
240
|
display: inline-flex;
|
|
241
241
|
align-items: center;
|
|
242
|
+
flex-shrink: 0;
|
|
242
243
|
height: 100%;
|
|
243
244
|
justify-content: center;
|
|
244
245
|
width: $width-treeSelect_arrow;
|
|
@@ -265,6 +266,7 @@ $module: #{$prefix}-tree-select;
|
|
|
265
266
|
display: inline-flex;
|
|
266
267
|
align-items: center;
|
|
267
268
|
height: 100%;
|
|
269
|
+
flex-shrink: 0;
|
|
268
270
|
justify-content: center;
|
|
269
271
|
width: $width-treeSelect_arrow;
|
|
270
272
|
color: $color-treeSelect_default-icon-default;
|
package/lib/es/input/input.css
CHANGED
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
border-color: var(--semi-color-focus-border);
|
|
69
69
|
}
|
|
70
70
|
.semi-input-wrapper-focus:active {
|
|
71
|
-
background-color: var(--semi-color-fill-
|
|
71
|
+
background-color: var(--semi-color-fill-2);
|
|
72
72
|
border-color: var(--semi-color-focus-border);
|
|
73
73
|
}
|
|
74
74
|
.semi-input-wrapper.semi-input-readonly {
|
|
@@ -86,6 +86,10 @@
|
|
|
86
86
|
background-color: var(--semi-color-danger-light-default);
|
|
87
87
|
border-color: var(--semi-color-danger);
|
|
88
88
|
}
|
|
89
|
+
.semi-input-wrapper-error:active {
|
|
90
|
+
background-color: var(--semi-color-danger-light-active);
|
|
91
|
+
border-color: var(--semi-color-danger);
|
|
92
|
+
}
|
|
89
93
|
.semi-input-wrapper-warning {
|
|
90
94
|
background-color: var(--semi-color-warning-light-default);
|
|
91
95
|
border-color: var(--semi-color-warning-light-default);
|
|
@@ -98,6 +102,10 @@
|
|
|
98
102
|
background-color: var(--semi-color-warning-light-default);
|
|
99
103
|
border-color: var(--semi-color-warning);
|
|
100
104
|
}
|
|
105
|
+
.semi-input-wrapper-warning:active {
|
|
106
|
+
background-color: var(--semi-color-warning-light-active);
|
|
107
|
+
border-color: var(--semi-color-warning);
|
|
108
|
+
}
|
|
101
109
|
.semi-input-wrapper__with-prefix {
|
|
102
110
|
display: inline-flex;
|
|
103
111
|
align-items: center;
|
|
@@ -218,6 +226,12 @@
|
|
|
218
226
|
.semi-input-wrapper.semi-input-wrapper__with-prepend .semi-input:focus ~ .semi-input-modebtn:not(:last-child), .semi-input-wrapper.semi-input-wrapper__with-append .semi-input:focus ~ .semi-input-modebtn:not(:last-child) {
|
|
219
227
|
border-radius: 0;
|
|
220
228
|
}
|
|
229
|
+
.semi-input-wrapper.semi-input-wrapper__with-prepend .semi-input:active, .semi-input-wrapper.semi-input-wrapper__with-append .semi-input:active {
|
|
230
|
+
background-color: var(--semi-color-fill-2);
|
|
231
|
+
}
|
|
232
|
+
.semi-input-wrapper.semi-input-wrapper__with-prepend .semi-input:active + .semi-input-clearbtn, .semi-input-wrapper.semi-input-wrapper__with-prepend .semi-input:active ~ .semi-input-modebtn, .semi-input-wrapper.semi-input-wrapper__with-append .semi-input:active + .semi-input-clearbtn, .semi-input-wrapper.semi-input-wrapper__with-append .semi-input:active ~ .semi-input-modebtn {
|
|
233
|
+
background-color: var(--semi-color-fill-2);
|
|
234
|
+
}
|
|
221
235
|
.semi-input-wrapper.semi-input-wrapper__with-prepend .semi-input-clearbtn, .semi-input-wrapper.semi-input-wrapper__with-prepend .semi-input-modebtn, .semi-input-wrapper.semi-input-wrapper__with-prepend .semi-input-clearbtn:hover, .semi-input-wrapper.semi-input-wrapper__with-prepend .semi-input-modebtn:hover, .semi-input-wrapper.semi-input-wrapper__with-append .semi-input-clearbtn, .semi-input-wrapper.semi-input-wrapper__with-append .semi-input-modebtn, .semi-input-wrapper.semi-input-wrapper__with-append .semi-input-clearbtn:hover, .semi-input-wrapper.semi-input-wrapper__with-append .semi-input-modebtn:hover {
|
|
222
236
|
background-color: var(--semi-color-fill-0);
|
|
223
237
|
}
|
|
@@ -246,6 +260,13 @@
|
|
|
246
260
|
background-color: var(--semi-color-danger-light-default);
|
|
247
261
|
border-color: var(--semi-color-danger);
|
|
248
262
|
}
|
|
263
|
+
.semi-input-wrapper.semi-input-wrapper__with-prepend.semi-input-wrapper-error .semi-input:active, .semi-input-wrapper.semi-input-wrapper__with-append.semi-input-wrapper-error .semi-input:active {
|
|
264
|
+
background-color: var(--semi-color-danger-light-active);
|
|
265
|
+
}
|
|
266
|
+
.semi-input-wrapper.semi-input-wrapper__with-prepend.semi-input-wrapper-error .semi-input:active + .semi-input-clearbtn, .semi-input-wrapper.semi-input-wrapper__with-prepend.semi-input-wrapper-error .semi-input:active + .semi-input-modebtn, .semi-input-wrapper.semi-input-wrapper__with-append.semi-input-wrapper-error .semi-input:active + .semi-input-clearbtn, .semi-input-wrapper.semi-input-wrapper__with-append.semi-input-wrapper-error .semi-input:active + .semi-input-modebtn {
|
|
267
|
+
background-color: var(--semi-color-danger-light-active);
|
|
268
|
+
border-color: var(--semi-color-danger);
|
|
269
|
+
}
|
|
249
270
|
.semi-input-wrapper.semi-input-wrapper__with-prepend.semi-input-wrapper-error .semi-input-clearbtn, .semi-input-wrapper.semi-input-wrapper__with-prepend.semi-input-wrapper-error .semi-input-modebtn, .semi-input-wrapper.semi-input-wrapper__with-prepend.semi-input-wrapper-error .semi-input-clearbtn:hover, .semi-input-wrapper.semi-input-wrapper__with-prepend.semi-input-wrapper-error .semi-input-modebtn:hover, .semi-input-wrapper.semi-input-wrapper__with-append.semi-input-wrapper-error .semi-input-clearbtn, .semi-input-wrapper.semi-input-wrapper__with-append.semi-input-wrapper-error .semi-input-modebtn, .semi-input-wrapper.semi-input-wrapper__with-append.semi-input-wrapper-error .semi-input-clearbtn:hover, .semi-input-wrapper.semi-input-wrapper__with-append.semi-input-wrapper-error .semi-input-modebtn:hover {
|
|
250
271
|
background-color: var(--semi-color-danger-light-default);
|
|
251
272
|
}
|
|
@@ -274,6 +295,13 @@
|
|
|
274
295
|
background-color: var(--semi-color-warning-light-default);
|
|
275
296
|
border-color: var(--semi-color-warning);
|
|
276
297
|
}
|
|
298
|
+
.semi-input-wrapper.semi-input-wrapper__with-prepend.semi-input-wrapper-warning .semi-input:active, .semi-input-wrapper.semi-input-wrapper__with-append.semi-input-wrapper-warning .semi-input:active {
|
|
299
|
+
background-color: var(--semi-color-warning-light-active);
|
|
300
|
+
}
|
|
301
|
+
.semi-input-wrapper.semi-input-wrapper__with-prepend.semi-input-wrapper-warning .semi-input:active + .semi-input-clearbtn, .semi-input-wrapper.semi-input-wrapper__with-prepend.semi-input-wrapper-warning .semi-input:active + .semi-input-modebtn, .semi-input-wrapper.semi-input-wrapper__with-append.semi-input-wrapper-warning .semi-input:active + .semi-input-clearbtn, .semi-input-wrapper.semi-input-wrapper__with-append.semi-input-wrapper-warning .semi-input:active + .semi-input-modebtn {
|
|
302
|
+
background-color: var(--semi-color-warning-light-active);
|
|
303
|
+
border-color: var(--semi-color-warning);
|
|
304
|
+
}
|
|
277
305
|
.semi-input-wrapper.semi-input-wrapper__with-prepend.semi-input-wrapper-warning .semi-input-clearbtn, .semi-input-wrapper.semi-input-wrapper__with-prepend.semi-input-wrapper-warning .semi-input-modebtn, .semi-input-wrapper.semi-input-wrapper__with-prepend.semi-input-wrapper-warning .semi-input-clearbtn:hover, .semi-input-wrapper.semi-input-wrapper__with-prepend.semi-input-wrapper-warning .semi-input-modebtn:hover, .semi-input-wrapper.semi-input-wrapper__with-append.semi-input-wrapper-warning .semi-input-clearbtn, .semi-input-wrapper.semi-input-wrapper__with-append.semi-input-wrapper-warning .semi-input-modebtn, .semi-input-wrapper.semi-input-wrapper__with-append.semi-input-wrapper-warning .semi-input-clearbtn:hover, .semi-input-wrapper.semi-input-wrapper__with-append.semi-input-wrapper-warning .semi-input-modebtn:hover {
|
|
278
306
|
background-color: var(--semi-color-warning-light-default);
|
|
279
307
|
}
|
package/lib/es/input/input.scss
CHANGED
|
@@ -77,7 +77,7 @@ $module: #{$prefix}-input;
|
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
&:active {
|
|
80
|
-
background-color: $color-input_default-bg-
|
|
80
|
+
background-color: $color-input_default-bg-active;
|
|
81
81
|
border-color: $color-input_default-border-focus;
|
|
82
82
|
}
|
|
83
83
|
}
|
|
@@ -100,10 +100,10 @@ $module: #{$prefix}-input;
|
|
|
100
100
|
border-color: $color-input_danger-border-focus;
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
103
|
+
&:active {
|
|
104
|
+
background-color: $color-input_danger-bg-active;
|
|
105
|
+
border-color: $color-input_danger-border-focus;
|
|
106
|
+
}
|
|
107
107
|
}
|
|
108
108
|
|
|
109
109
|
&-warning {
|
|
@@ -120,10 +120,10 @@ $module: #{$prefix}-input;
|
|
|
120
120
|
border-color: $color-input_warning-border-focus;
|
|
121
121
|
}
|
|
122
122
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
123
|
+
&:active {
|
|
124
|
+
background-color: $color-input_warning-bg-active;
|
|
125
|
+
border-color: $color-input_warning-border-focus;
|
|
126
|
+
}
|
|
127
127
|
}
|
|
128
128
|
|
|
129
129
|
&__with-prefix {
|
|
@@ -288,6 +288,16 @@ $module: #{$prefix}-input;
|
|
|
288
288
|
}
|
|
289
289
|
}
|
|
290
290
|
|
|
291
|
+
// when have prepend and append, only make the input have active bg color
|
|
292
|
+
&:active {
|
|
293
|
+
background-color: $color-input_default-bg-active;
|
|
294
|
+
|
|
295
|
+
& + .#{$module}-clearbtn,
|
|
296
|
+
& ~ .#{$module}-modebtn {
|
|
297
|
+
background-color: $color-input_default-bg-active;
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
|
|
291
301
|
&-clearbtn,
|
|
292
302
|
&-modebtn,
|
|
293
303
|
&-clearbtn:hover,
|
|
@@ -328,6 +338,16 @@ $module: #{$prefix}-input;
|
|
|
328
338
|
}
|
|
329
339
|
}
|
|
330
340
|
|
|
341
|
+
&:active {
|
|
342
|
+
background-color: $color-input_danger-bg-active;
|
|
343
|
+
|
|
344
|
+
& + .#{$module}-clearbtn,
|
|
345
|
+
& + .#{$module}-modebtn {
|
|
346
|
+
background-color: $color-input_danger-bg-active;
|
|
347
|
+
border-color: $color-input_danger-border-focus;
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
|
|
331
351
|
&-clearbtn,
|
|
332
352
|
&-modebtn,
|
|
333
353
|
&-clearbtn:hover,
|
|
@@ -369,6 +389,16 @@ $module: #{$prefix}-input;
|
|
|
369
389
|
}
|
|
370
390
|
}
|
|
371
391
|
|
|
392
|
+
&:active {
|
|
393
|
+
background-color: $color-input_warning-bg-active;
|
|
394
|
+
|
|
395
|
+
& + .#{$module}-clearbtn,
|
|
396
|
+
& + .#{$module}-modebtn {
|
|
397
|
+
background-color: $color-input_warning-bg-active;
|
|
398
|
+
border-color: $color-input_warning-border-focus;
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
|
|
372
402
|
&-clearbtn,
|
|
373
403
|
&-modebtn,
|
|
374
404
|
&-clearbtn:hover,
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
}
|
|
73
73
|
.semi-input-textarea-wrapper-error:active {
|
|
74
74
|
background-color: var(--semi-color-danger-light-active);
|
|
75
|
-
border-color: var(--semi-color-danger
|
|
75
|
+
border-color: var(--semi-color-danger);
|
|
76
76
|
}
|
|
77
77
|
.semi-input-textarea-wrapper-warning {
|
|
78
78
|
background-color: var(--semi-color-warning-light-default);
|
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
}
|
|
89
89
|
.semi-input-textarea-wrapper-warning:active {
|
|
90
90
|
background-color: var(--semi-color-warning-light-active);
|
|
91
|
-
border-color: var(--semi-color-warning
|
|
91
|
+
border-color: var(--semi-color-warning);
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
.semi-input-textarea {
|
|
@@ -90,7 +90,7 @@ $module: #{$prefix}-input;
|
|
|
90
90
|
|
|
91
91
|
&:active {
|
|
92
92
|
background-color: $color-input_danger-bg-active;
|
|
93
|
-
border-color: $color-input_danger-border-
|
|
93
|
+
border-color: $color-input_danger-border-focus;
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
96
|
|
|
@@ -110,7 +110,7 @@ $module: #{$prefix}-input;
|
|
|
110
110
|
|
|
111
111
|
&:active {
|
|
112
112
|
background-color: $color-input_warning-bg-active;
|
|
113
|
-
border-color: $color-input_warning-border-
|
|
113
|
+
border-color: $color-input_warning-border-focus;
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
116
|
|
package/lib/es/select/select.css
CHANGED
|
@@ -283,11 +283,11 @@
|
|
|
283
283
|
align-items: center;
|
|
284
284
|
}
|
|
285
285
|
.semi-select-prefix-text, .semi-select-suffix-text {
|
|
286
|
-
margin:
|
|
286
|
+
margin: 0px 12px;
|
|
287
287
|
}
|
|
288
288
|
.semi-select-prefix-icon, .semi-select-suffix-icon {
|
|
289
289
|
color: var(--semi-color-text-2);
|
|
290
|
-
margin:
|
|
290
|
+
margin: 0px 8px;
|
|
291
291
|
}
|
|
292
292
|
.semi-select-suffix {
|
|
293
293
|
display: flex;
|
|
@@ -58,16 +58,16 @@ $width-select_arrow: 32px; // 选择器输入框下拉箭头宽度
|
|
|
58
58
|
$width-select_arrow_empty: 12px; // 选择器输入框下拉箭头为空时(有suffix icon)宽度
|
|
59
59
|
$width-select_clear-icon: 32px; // 选择器输入框清空按钮宽度
|
|
60
60
|
$width-select_group_top-border: $border-thickness-control; // 选择器菜单分组标题描边宽度
|
|
61
|
-
$height-select_multiple_content_wrapper-minHeight: $height-select_default -
|
|
61
|
+
$height-select_multiple_content_wrapper-minHeight: $height-select_default - 2px; // 多项选择器标签组最小宽度
|
|
62
62
|
$width-select-border-hover: $width-select-border; // 选择器输入框描边宽度 - 悬浮
|
|
63
63
|
$width-select-border-focus: $width-select-border-hover; // 选择器输入框描边宽度 - 按下
|
|
64
64
|
$width-select-border-active: $width-select-border-focus; // 选择器输入框描边宽度 - 选中
|
|
65
65
|
// Spacing
|
|
66
66
|
$spacing-select_option_tick-marginRight: $spacing-tight; // 选择器菜单选中对勾右侧外边距
|
|
67
67
|
$spacing-select_prefix_suffix_text-marginX: $spacing-base-tight; // 选择器输入框前后缀文本水平内边距
|
|
68
|
-
$spacing-select_prefix_suffix_text-marginY:
|
|
68
|
+
$spacing-select_prefix_suffix_text-marginY: 0px; // 选择器输入框前后缀文本垂直内边距
|
|
69
69
|
$spacing-select_prefix_suffix_icon-marginX: $spacing-tight; // 选择器输入框前后缀图标水平内边距
|
|
70
|
-
$spacing-select_prefix_suffix_icon-marginY:
|
|
70
|
+
$spacing-select_prefix_suffix_icon-marginY: 0px; // 选择器输入框前后缀图标垂直内边距
|
|
71
71
|
$spacing-select_create_tips-marginRight: $spacing-extra-tight; // 创建新选项右侧外边距
|
|
72
72
|
$spacing-select_group-marginTop: $spacing-extra-tight; // 选择器菜单分组标题顶部外边距
|
|
73
73
|
$spacing-select_group-paddingTop: $spacing-base-tight; // 选择器菜单分组标题顶部内边距
|
|
@@ -106,5 +106,5 @@ $font-select_inset_label-fontWeight: 600; // 选择器内嵌标签文本字重
|
|
|
106
106
|
$font-select_keyword-fontWeight: 600; // 选择器搜索结果命关键词中文本字重
|
|
107
107
|
|
|
108
108
|
// Other
|
|
109
|
-
$opacity-select_selection_text_inactive: .4;
|
|
109
|
+
$opacity-select_selection_text_inactive: 0.4;
|
|
110
110
|
|
|
@@ -26,7 +26,7 @@ export interface SliderProps {
|
|
|
26
26
|
'aria-label'?: string;
|
|
27
27
|
'aria-labelledby'?: string;
|
|
28
28
|
'aria-valuetext'?: string;
|
|
29
|
-
getAriaValueText?: (value: number) => string;
|
|
29
|
+
getAriaValueText?: (value: number, index?: number) => string;
|
|
30
30
|
}
|
|
31
31
|
export interface SliderState {
|
|
32
32
|
currentValue: number | number[];
|
|
@@ -40,6 +40,8 @@ export interface SliderState {
|
|
|
40
40
|
clickValue: 0;
|
|
41
41
|
showBoundary: boolean;
|
|
42
42
|
isInRenderTree: boolean;
|
|
43
|
+
firstDotFocusVisible: boolean;
|
|
44
|
+
secondDotFocusVisible: boolean;
|
|
43
45
|
}
|
|
44
46
|
export interface SliderLengths {
|
|
45
47
|
sliderX: number;
|
|
@@ -53,7 +55,6 @@ export interface ScrollParentVal {
|
|
|
53
55
|
}
|
|
54
56
|
export interface OverallVars {
|
|
55
57
|
dragging: boolean[];
|
|
56
|
-
chooseMovePos: 'min' | 'max';
|
|
57
58
|
}
|
|
58
59
|
export interface SliderAdapter extends DefaultAdapter<SliderProps, SliderState> {
|
|
59
60
|
getSliderLengths: () => SliderLengths;
|
|
@@ -189,7 +190,13 @@ export default class SliderFoundation extends BaseFoundation<SliderAdapter> {
|
|
|
189
190
|
onHandleEnter: (pos: SliderState['focusPos']) => void;
|
|
190
191
|
onHandleLeave: () => void;
|
|
191
192
|
onHandleUp: (e: any) => boolean;
|
|
193
|
+
_handleValueDecreaseWithKeyBoard: (step: number, handler: 'min' | 'max') => number | any[];
|
|
194
|
+
_handleValueIncreaseWithKeyBoard: (step: number, handler: 'min' | 'max') => any;
|
|
195
|
+
_handleHomeKey: (handler: 'min' | 'max') => any;
|
|
196
|
+
_handleEndKey: (handler: 'min' | 'max') => any;
|
|
197
|
+
handleKeyDown: (event: any, handler: 'min' | 'max') => void;
|
|
192
198
|
onFocus: (e: any, handler: 'min' | 'max') => void;
|
|
199
|
+
onBlur: (e: any, handler: 'min' | 'max') => void;
|
|
193
200
|
handleWrapClick: (e: any) => void;
|
|
194
201
|
/**
|
|
195
202
|
* Move the slider to the current click position
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
|
|
2
2
|
import _Array$isArray from "@babel/runtime-corejs3/core-js-stable/array/is-array";
|
|
3
|
+
import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/includes";
|
|
3
4
|
|
|
4
5
|
/* eslint-disable no-param-reassign */
|
|
5
6
|
|
|
@@ -8,6 +9,8 @@ import _Array$isArray from "@babel/runtime-corejs3/core-js-stable/array/is-array
|
|
|
8
9
|
/* eslint-disable no-nested-ternary */
|
|
9
10
|
import BaseFoundation from '../base/foundation';
|
|
10
11
|
import touchEventPolyfill from '../utils/touchPolyfill';
|
|
12
|
+
import warning from '../utils/warning';
|
|
13
|
+
import { handlePrevent } from '../utils/a11y';
|
|
11
14
|
export default class SliderFoundation extends BaseFoundation {
|
|
12
15
|
constructor(adapter) {
|
|
13
16
|
var _this;
|
|
@@ -532,8 +535,7 @@ export default class SliderFoundation extends BaseFoundation {
|
|
|
532
535
|
const handleMaxDom = this._adapter.getMaxHandleEl().current;
|
|
533
536
|
|
|
534
537
|
if (e.target === handleMinDom || e.target === handleMaxDom) {
|
|
535
|
-
e
|
|
536
|
-
e.stopPropagation();
|
|
538
|
+
handlePrevent(e);
|
|
537
539
|
const touch = touchEventPolyfill(e.touches[0], e);
|
|
538
540
|
this.onHandleDown(touch, handler);
|
|
539
541
|
}
|
|
@@ -597,18 +599,203 @@ export default class SliderFoundation extends BaseFoundation {
|
|
|
597
599
|
this._adapter.setDragging([dragging[0], false]);
|
|
598
600
|
}
|
|
599
601
|
|
|
600
|
-
this._adapter.setStateVal('isDrag', false);
|
|
601
|
-
|
|
602
|
+
this._adapter.setStateVal('isDrag', false);
|
|
602
603
|
|
|
603
604
|
this._adapter.onHandleLeave();
|
|
604
605
|
|
|
605
606
|
this._adapter.onHandleUpAfter();
|
|
606
607
|
|
|
607
608
|
return true;
|
|
609
|
+
};
|
|
610
|
+
|
|
611
|
+
this._handleValueDecreaseWithKeyBoard = (step, handler) => {
|
|
612
|
+
const {
|
|
613
|
+
min,
|
|
614
|
+
currentValue
|
|
615
|
+
} = this.getStates();
|
|
616
|
+
const {
|
|
617
|
+
range
|
|
618
|
+
} = this.getProps();
|
|
619
|
+
|
|
620
|
+
if (handler === 'min') {
|
|
621
|
+
if (range) {
|
|
622
|
+
let newMinValue = currentValue[0] - step;
|
|
623
|
+
newMinValue = newMinValue < min ? min : newMinValue;
|
|
624
|
+
return [newMinValue, currentValue[1]];
|
|
625
|
+
} else {
|
|
626
|
+
let newMinValue = currentValue - step;
|
|
627
|
+
newMinValue = newMinValue < min ? min : newMinValue;
|
|
628
|
+
return newMinValue;
|
|
629
|
+
}
|
|
630
|
+
} else {
|
|
631
|
+
let newMaxValue = currentValue[1] - step;
|
|
632
|
+
newMaxValue = newMaxValue < currentValue[0] ? currentValue[0] : newMaxValue;
|
|
633
|
+
return [currentValue[0], newMaxValue];
|
|
634
|
+
}
|
|
635
|
+
};
|
|
636
|
+
|
|
637
|
+
this._handleValueIncreaseWithKeyBoard = (step, handler) => {
|
|
638
|
+
const {
|
|
639
|
+
max,
|
|
640
|
+
currentValue
|
|
641
|
+
} = this.getStates();
|
|
642
|
+
const {
|
|
643
|
+
range
|
|
644
|
+
} = this.getProps();
|
|
645
|
+
|
|
646
|
+
if (handler === 'min') {
|
|
647
|
+
if (range) {
|
|
648
|
+
let newMinValue = currentValue[0] + step;
|
|
649
|
+
newMinValue = newMinValue > currentValue[1] ? currentValue[1] : newMinValue;
|
|
650
|
+
return [newMinValue, currentValue[1]];
|
|
651
|
+
} else {
|
|
652
|
+
let newMinValue = currentValue + step;
|
|
653
|
+
newMinValue = newMinValue > max ? max : newMinValue;
|
|
654
|
+
return newMinValue;
|
|
655
|
+
}
|
|
656
|
+
} else {
|
|
657
|
+
let newMaxValue = currentValue[1] + step;
|
|
658
|
+
newMaxValue = newMaxValue > max ? max : newMaxValue;
|
|
659
|
+
return [currentValue[0], newMaxValue];
|
|
660
|
+
}
|
|
661
|
+
};
|
|
662
|
+
|
|
663
|
+
this._handleHomeKey = handler => {
|
|
664
|
+
const {
|
|
665
|
+
min,
|
|
666
|
+
currentValue
|
|
667
|
+
} = this.getStates();
|
|
668
|
+
const {
|
|
669
|
+
range
|
|
670
|
+
} = this.getProps();
|
|
671
|
+
|
|
672
|
+
if (handler === 'min') {
|
|
673
|
+
if (range) {
|
|
674
|
+
return [min, currentValue[1]];
|
|
675
|
+
} else {
|
|
676
|
+
return min;
|
|
677
|
+
}
|
|
678
|
+
} else {
|
|
679
|
+
return [currentValue[0], currentValue[0]];
|
|
680
|
+
}
|
|
681
|
+
};
|
|
682
|
+
|
|
683
|
+
this._handleEndKey = handler => {
|
|
684
|
+
const {
|
|
685
|
+
max,
|
|
686
|
+
currentValue
|
|
687
|
+
} = this.getStates();
|
|
688
|
+
const {
|
|
689
|
+
range
|
|
690
|
+
} = this.getProps();
|
|
691
|
+
|
|
692
|
+
if (handler === 'min') {
|
|
693
|
+
if (range) {
|
|
694
|
+
return [currentValue[1], currentValue[1]];
|
|
695
|
+
} else {
|
|
696
|
+
return max;
|
|
697
|
+
}
|
|
698
|
+
} else {
|
|
699
|
+
return [currentValue[0], max];
|
|
700
|
+
}
|
|
701
|
+
};
|
|
702
|
+
|
|
703
|
+
this.handleKeyDown = (event, handler) => {
|
|
704
|
+
var _context;
|
|
705
|
+
|
|
706
|
+
const {
|
|
707
|
+
min,
|
|
708
|
+
max,
|
|
709
|
+
currentValue
|
|
710
|
+
} = this.getStates();
|
|
711
|
+
const {
|
|
712
|
+
step,
|
|
713
|
+
range
|
|
714
|
+
} = this.getProps();
|
|
715
|
+
let outputValue;
|
|
716
|
+
|
|
717
|
+
switch (event.key) {
|
|
718
|
+
case "ArrowLeft":
|
|
719
|
+
case "ArrowDown":
|
|
720
|
+
outputValue = this._handleValueDecreaseWithKeyBoard(step, handler);
|
|
721
|
+
break;
|
|
722
|
+
|
|
723
|
+
case "ArrowRight":
|
|
724
|
+
case "ArrowUp":
|
|
725
|
+
outputValue = this._handleValueIncreaseWithKeyBoard(step, handler);
|
|
726
|
+
break;
|
|
727
|
+
|
|
728
|
+
case "PageUp":
|
|
729
|
+
outputValue = this._handleValueIncreaseWithKeyBoard(10 * step, handler);
|
|
730
|
+
break;
|
|
731
|
+
|
|
732
|
+
case "PageDown":
|
|
733
|
+
outputValue = this._handleValueDecreaseWithKeyBoard(10 * step, handler);
|
|
734
|
+
break;
|
|
735
|
+
|
|
736
|
+
case "Home":
|
|
737
|
+
outputValue = this._handleHomeKey(handler);
|
|
738
|
+
break;
|
|
739
|
+
|
|
740
|
+
case "End":
|
|
741
|
+
outputValue = this._handleEndKey(handler);
|
|
742
|
+
break;
|
|
743
|
+
|
|
744
|
+
case 'default':
|
|
745
|
+
break;
|
|
746
|
+
}
|
|
747
|
+
|
|
748
|
+
if (_includesInstanceProperty(_context = ["ArrowLeft", "ArrowDown", "ArrowRight", "ArrowUp", "PageUp", "PageDown", "Home", "End"]).call(_context, event.key)) {
|
|
749
|
+
let update = true;
|
|
750
|
+
|
|
751
|
+
if (_Array$isArray(currentValue)) {
|
|
752
|
+
update = !(currentValue[0] === outputValue[0] && currentValue[1] === outputValue[1]);
|
|
753
|
+
} else {
|
|
754
|
+
update = currentValue !== outputValue;
|
|
755
|
+
}
|
|
756
|
+
|
|
757
|
+
if (update) {
|
|
758
|
+
this._adapter.updateCurrentValue(outputValue);
|
|
759
|
+
|
|
760
|
+
this._adapter.notifyChange(outputValue);
|
|
761
|
+
}
|
|
762
|
+
|
|
763
|
+
handlePrevent(event);
|
|
764
|
+
}
|
|
608
765
|
}; // eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
609
766
|
|
|
610
767
|
|
|
611
|
-
this.onFocus = (e, handler) => {
|
|
768
|
+
this.onFocus = (e, handler) => {
|
|
769
|
+
handlePrevent(e);
|
|
770
|
+
const {
|
|
771
|
+
target
|
|
772
|
+
} = e;
|
|
773
|
+
|
|
774
|
+
try {
|
|
775
|
+
if (target.matches(':focus-visible')) {
|
|
776
|
+
if (handler === 'min') {
|
|
777
|
+
this._adapter.setStateVal('firstDotFocusVisible', true);
|
|
778
|
+
} else {
|
|
779
|
+
this._adapter.setStateVal('secondDotFocusVisible', true);
|
|
780
|
+
}
|
|
781
|
+
}
|
|
782
|
+
} catch (error) {
|
|
783
|
+
warning(true, 'Warning: [Semi Slider] The current browser does not support the focus-visible');
|
|
784
|
+
}
|
|
785
|
+
};
|
|
786
|
+
|
|
787
|
+
this.onBlur = (e, handler) => {
|
|
788
|
+
const {
|
|
789
|
+
firstDotFocusVisible,
|
|
790
|
+
secondDotFocusVisible
|
|
791
|
+
} = this.getStates();
|
|
792
|
+
|
|
793
|
+
if (handler === 'min') {
|
|
794
|
+
firstDotFocusVisible && this._adapter.setStateVal('firstDotFocusVisible', false);
|
|
795
|
+
} else {
|
|
796
|
+
secondDotFocusVisible && this._adapter.setStateVal('secondDotFocusVisible', false);
|
|
797
|
+
}
|
|
798
|
+
};
|
|
612
799
|
|
|
613
800
|
this.handleWrapClick = e => {
|
|
614
801
|
const {
|
package/lib/es/slider/slider.css
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//@import '../theme/variables.scss';
|
|
2
|
-
@import
|
|
2
|
+
@import './variables.scss';
|
|
3
3
|
|
|
4
4
|
$module: #{$prefix}-slider;
|
|
5
5
|
|
|
@@ -29,7 +29,7 @@ $module: #{$prefix}-slider;
|
|
|
29
29
|
font-variant: tabular-nums;
|
|
30
30
|
line-height: $font-slider_rail-lineHeight;
|
|
31
31
|
list-style: none;
|
|
32
|
-
font-feature-settings:
|
|
32
|
+
font-feature-settings: 'tnum';
|
|
33
33
|
position: absolute;
|
|
34
34
|
height: $height-slider_rail;
|
|
35
35
|
cursor: pointer;
|
|
@@ -54,7 +54,11 @@ $module: #{$prefix}-slider;
|
|
|
54
54
|
border: none;
|
|
55
55
|
border-radius: 50%;
|
|
56
56
|
cursor: pointer;
|
|
57
|
-
transition: #fff .3s;
|
|
57
|
+
transition: #fff 0.3s;
|
|
58
|
+
|
|
59
|
+
&:focus-visible {
|
|
60
|
+
outline: $width-slider_handle-focus solid $color-slider_handle-focus;
|
|
61
|
+
}
|
|
58
62
|
}
|
|
59
63
|
|
|
60
64
|
&-handle:hover {
|
|
@@ -133,10 +137,8 @@ $module: #{$prefix}-slider;
|
|
|
133
137
|
text-align: center;
|
|
134
138
|
cursor: pointer;
|
|
135
139
|
transform: translate(-50%, 0) rotate(-180deg);
|
|
136
|
-
|
|
137
140
|
}
|
|
138
141
|
|
|
139
|
-
|
|
140
142
|
&-boundary {
|
|
141
143
|
position: relative;
|
|
142
144
|
font-size: $font-size-small;
|