@douyinfe/semi-foundation 2.9.1 → 2.10.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/carousel/carousel.scss +425 -0
- package/carousel/constants.ts +32 -0
- package/carousel/foundation.ts +164 -0
- package/carousel/rtl.scss +47 -0
- package/carousel/variables.scss +46 -0
- package/cascader/foundation.ts +6 -6
- package/checkbox/checkboxGroupFoundation.ts +2 -2
- package/datePicker/_utils/getDefaultPickerDate.ts +3 -3
- package/datePicker/_utils/parser.ts +1 -1
- package/datePicker/foundation.ts +4 -4
- package/datePicker/monthsGridFoundation.ts +11 -11
- package/datePicker/yearAndMonthFoundation.ts +1 -1
- package/form/foundation.ts +9 -5
- package/form/interface.ts +1 -0
- package/input/textareaFoundation.ts +5 -5
- package/inputNumber/foundation.ts +25 -9
- package/lib/cjs/carousel/carousel.css +341 -0
- package/lib/cjs/carousel/carousel.scss +425 -0
- package/lib/cjs/carousel/constants.d.ts +27 -0
- package/lib/cjs/carousel/constants.js +41 -0
- package/lib/cjs/carousel/foundation.d.ts +29 -0
- package/lib/cjs/carousel/foundation.js +216 -0
- package/lib/cjs/carousel/rtl.scss +47 -0
- package/lib/cjs/carousel/variables.scss +46 -0
- package/lib/cjs/cascader/foundation.d.ts +2 -2
- package/lib/cjs/cascader/foundation.js +6 -6
- package/lib/cjs/checkbox/checkboxGroupFoundation.d.ts +1 -1
- package/lib/cjs/checkbox/checkboxGroupFoundation.js +2 -2
- package/lib/cjs/datePicker/_utils/getDefaultPickerDate.js +2 -2
- package/lib/cjs/datePicker/_utils/parser.d.ts +1 -1
- package/lib/cjs/datePicker/_utils/parser.js +2 -2
- package/lib/cjs/datePicker/foundation.js +3 -3
- package/lib/cjs/datePicker/monthsGridFoundation.js +9 -9
- package/lib/cjs/datePicker/yearAndMonthFoundation.d.ts +1 -1
- package/lib/cjs/datePicker/yearAndMonthFoundation.js +2 -2
- package/lib/cjs/form/foundation.d.ts +1 -0
- package/lib/cjs/form/foundation.js +9 -5
- package/lib/cjs/form/interface.d.ts +1 -0
- package/lib/cjs/input/textareaFoundation.d.ts +5 -5
- package/lib/cjs/inputNumber/foundation.d.ts +8 -0
- package/lib/cjs/inputNumber/foundation.js +20 -8
- package/lib/cjs/navigation/foundation.d.ts +3 -3
- package/lib/cjs/navigation/foundation.js +13 -13
- package/lib/cjs/switch/constants.d.ts +1 -0
- package/lib/cjs/switch/constants.js +1 -0
- package/lib/cjs/switch/foundation.d.ts +3 -0
- package/lib/cjs/switch/foundation.js +18 -0
- package/lib/cjs/switch/switch.css +3 -0
- package/lib/cjs/switch/switch.scss +4 -0
- package/lib/cjs/switch/variables.scss +2 -0
- package/lib/cjs/tabs/foundation.js +2 -2
- package/lib/cjs/timePicker/ComboxFoundation.js +1 -1
- package/lib/cjs/timePicker/constants.d.ts +1 -1
- package/lib/cjs/timePicker/constants.js +1 -1
- package/lib/cjs/timePicker/foundation.js +1 -1
- package/lib/cjs/transfer/foundation.js +3 -3
- package/lib/cjs/transfer/{transferUtlls.d.ts → transferUtils.d.ts} +0 -0
- package/lib/cjs/transfer/{transferUtlls.js → transferUtils.js} +0 -0
- package/lib/cjs/tree/foundation.d.ts +2 -2
- package/lib/cjs/tree/foundation.js +4 -4
- package/lib/cjs/tree/treeUtil.js +11 -11
- package/lib/cjs/treeSelect/constants.d.ts +1 -1
- package/lib/cjs/treeSelect/constants.js +1 -1
- package/lib/cjs/treeSelect/foundation.d.ts +2 -2
- package/lib/cjs/treeSelect/foundation.js +4 -4
- package/lib/cjs/upload/foundation.js +8 -8
- package/lib/cjs/upload/utils.js +1 -1
- package/lib/cjs/utils/isNullOrUndefined.d.ts +1 -1
- package/lib/cjs/utils/isNullOrUndefined.js +1 -1
- package/lib/cjs/utils/object.d.ts +6 -6
- package/lib/cjs/utils/object.js +2 -2
- package/lib/es/carousel/carousel.css +341 -0
- package/lib/es/carousel/carousel.scss +425 -0
- package/lib/es/carousel/constants.d.ts +27 -0
- package/lib/es/carousel/constants.js +28 -0
- package/lib/es/carousel/foundation.d.ts +29 -0
- package/lib/es/carousel/foundation.js +198 -0
- package/lib/es/carousel/rtl.scss +47 -0
- package/lib/es/carousel/variables.scss +46 -0
- package/lib/es/cascader/foundation.d.ts +2 -2
- package/lib/es/cascader/foundation.js +6 -6
- package/lib/es/checkbox/checkboxGroupFoundation.d.ts +1 -1
- package/lib/es/checkbox/checkboxGroupFoundation.js +2 -2
- package/lib/es/datePicker/_utils/getDefaultPickerDate.js +3 -3
- package/lib/es/datePicker/_utils/parser.d.ts +1 -1
- package/lib/es/datePicker/_utils/parser.js +1 -1
- package/lib/es/datePicker/foundation.js +4 -4
- package/lib/es/datePicker/monthsGridFoundation.js +10 -10
- package/lib/es/datePicker/yearAndMonthFoundation.d.ts +1 -1
- package/lib/es/datePicker/yearAndMonthFoundation.js +1 -1
- package/lib/es/form/foundation.d.ts +1 -0
- package/lib/es/form/foundation.js +9 -5
- package/lib/es/form/interface.d.ts +1 -0
- package/lib/es/input/textareaFoundation.d.ts +5 -5
- package/lib/es/inputNumber/foundation.d.ts +8 -0
- package/lib/es/inputNumber/foundation.js +18 -8
- package/lib/es/navigation/foundation.d.ts +3 -3
- package/lib/es/navigation/foundation.js +13 -13
- package/lib/es/switch/constants.d.ts +1 -0
- package/lib/es/switch/constants.js +1 -0
- package/lib/es/switch/foundation.d.ts +3 -0
- package/lib/es/switch/foundation.js +18 -0
- package/lib/es/switch/switch.css +3 -0
- package/lib/es/switch/switch.scss +4 -0
- package/lib/es/switch/variables.scss +2 -0
- package/lib/es/tabs/foundation.js +2 -2
- package/lib/es/timePicker/ComboxFoundation.js +1 -1
- package/lib/es/timePicker/constants.d.ts +1 -1
- package/lib/es/timePicker/constants.js +1 -1
- package/lib/es/timePicker/foundation.js +1 -1
- package/lib/es/transfer/foundation.js +1 -1
- package/lib/es/transfer/{transferUtlls.d.ts → transferUtils.d.ts} +0 -0
- package/lib/es/transfer/{transferUtlls.js → transferUtils.js} +0 -0
- package/lib/es/tree/foundation.d.ts +2 -2
- package/lib/es/tree/foundation.js +4 -4
- package/lib/es/tree/treeUtil.js +11 -11
- package/lib/es/treeSelect/constants.d.ts +1 -1
- package/lib/es/treeSelect/constants.js +1 -1
- package/lib/es/treeSelect/foundation.d.ts +2 -2
- package/lib/es/treeSelect/foundation.js +4 -4
- package/lib/es/upload/foundation.js +8 -8
- package/lib/es/upload/utils.js +1 -1
- package/lib/es/utils/isNullOrUndefined.d.ts +1 -1
- package/lib/es/utils/isNullOrUndefined.js +1 -1
- package/lib/es/utils/object.d.ts +6 -6
- package/lib/es/utils/object.js +2 -2
- package/navigation/foundation.ts +12 -12
- package/package.json +3 -3
- package/switch/constants.ts +1 -0
- package/switch/foundation.ts +16 -0
- package/switch/switch.scss +4 -0
- package/switch/variables.scss +2 -0
- package/tabs/foundation.ts +2 -2
- package/timePicker/ComboxFoundation.ts +1 -1
- package/timePicker/constants.ts +1 -1
- package/timePicker/foundation.ts +1 -1
- package/transfer/foundation.ts +1 -1
- package/transfer/{transferUtlls.ts → transferUtils.ts} +0 -0
- package/tree/foundation.ts +4 -4
- package/tree/treeUtil.ts +11 -11
- package/treeSelect/constants.ts +1 -1
- package/treeSelect/foundation.ts +4 -4
- package/upload/foundation.ts +8 -8
- package/upload/utils.ts +1 -1
- package/utils/isNullOrUndefined.ts +1 -1
- package/utils/object.ts +10 -10
|
@@ -0,0 +1,425 @@
|
|
|
1
|
+
@import "./variables.scss";
|
|
2
|
+
|
|
3
|
+
$module: #{$prefix}-carousel;
|
|
4
|
+
|
|
5
|
+
.#{$module} {
|
|
6
|
+
position: relative;
|
|
7
|
+
overflow: hidden;
|
|
8
|
+
|
|
9
|
+
&-content {
|
|
10
|
+
width: 100%;
|
|
11
|
+
height: 100%;
|
|
12
|
+
overflow: hidden;
|
|
13
|
+
position: relative;
|
|
14
|
+
|
|
15
|
+
&-item {
|
|
16
|
+
position: absolute;
|
|
17
|
+
left: 0;
|
|
18
|
+
top: 0;
|
|
19
|
+
width: 100%;
|
|
20
|
+
height: 100%;
|
|
21
|
+
overflow: hidden;
|
|
22
|
+
|
|
23
|
+
&-current {
|
|
24
|
+
z-index: 1;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
&-fade {
|
|
30
|
+
|
|
31
|
+
> * {
|
|
32
|
+
opacity: 0;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.#{$module}-content-item-current {
|
|
36
|
+
opacity: 1;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
&-slide {
|
|
41
|
+
&>*:not(.#{$module}-content-item-current) {
|
|
42
|
+
visibility: hidden;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.#{$module}-content-item-slide-out {
|
|
46
|
+
display: block;
|
|
47
|
+
animation: #{$module}-content-item-keyframe-slide-out;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.#{$module}-content-item-slide-in {
|
|
51
|
+
display: block;
|
|
52
|
+
animation: #{$module}-content-item-keyframe-slide-in;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
&-reverse {
|
|
58
|
+
.#{$module}-content-item-slide-out {
|
|
59
|
+
animation: #{$module}-content-item-keyframe-slide-out-reverse ;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.#{$module}-content-item-slide-in {
|
|
63
|
+
animation: #{$module}-content-item-keyframe-slide-in-reverse ;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
&-indicator {
|
|
69
|
+
display: flex;
|
|
70
|
+
align-items: flex-end;
|
|
71
|
+
z-index: 2;
|
|
72
|
+
|
|
73
|
+
&-left {
|
|
74
|
+
position: absolute;
|
|
75
|
+
left: $spacing-carousel_indicator-padding;
|
|
76
|
+
bottom: $spacing-carousel_indicator-padding;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
&-center {
|
|
80
|
+
position: absolute;
|
|
81
|
+
left: 50%;
|
|
82
|
+
bottom: $spacing-carousel_indicator-padding;
|
|
83
|
+
transform: translate(-50%);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
&-right {
|
|
87
|
+
position: absolute;
|
|
88
|
+
right: $spacing-carousel_indicator-padding;
|
|
89
|
+
bottom: $spacing-carousel_indicator-padding;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
&-dot {
|
|
94
|
+
.#{$module}-indicator-item {
|
|
95
|
+
border-radius: $radius-carousel_indicator_dot;
|
|
96
|
+
cursor: pointer;
|
|
97
|
+
|
|
98
|
+
&:not(:last-child) {
|
|
99
|
+
margin-right: $spacing-carousel_indicator_dot-marginX;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
&-small {
|
|
103
|
+
width: $width-carousel_indicator_dot_small;
|
|
104
|
+
height: $width-carousel_indicator_dot_small;
|
|
105
|
+
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
&-medium {
|
|
109
|
+
width: $width-carousel_indicator_dot_medium;
|
|
110
|
+
height: $width-carousel_indicator_dot_medium;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
&-primary {
|
|
114
|
+
background-color: $color-carousel_indicator_theme_primary-bg-default;
|
|
115
|
+
|
|
116
|
+
&.#{$module}-indicator-item-active {
|
|
117
|
+
background: $color-carousel_indicator_theme_primary-bg-active;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
&:hover {
|
|
121
|
+
background-color: $color-carousel_indicator_theme_primary-bg-hover;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
&:active {
|
|
125
|
+
background: $color-carousel_indicator_theme_primary-bg-active;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
&-light {
|
|
130
|
+
|
|
131
|
+
background-color: $color-carousel_indicator_theme_light-bg-default;
|
|
132
|
+
|
|
133
|
+
&.#{$module}-indicator-item-active {
|
|
134
|
+
background: $color-carousel_indicator_theme_light-bg-active;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
&:hover {
|
|
138
|
+
background-color: $color-carousel_indicator_theme_light-bg-hover;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
&:active {
|
|
142
|
+
background: $color-carousel_indicator_theme_light-bg-active;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
&-dark {
|
|
147
|
+
background-color: $color-carousel_indicator_theme_dark-bg-default;
|
|
148
|
+
|
|
149
|
+
&.#{$module}-indicator-item-active {
|
|
150
|
+
background-color: $color-carousel_indicator_theme_dark-bg-active;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
&:hover {
|
|
154
|
+
background-color: $color-carousel_indicator_theme_dark-bg-hover;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
&:active {
|
|
158
|
+
background: $color-carousel_indicator_theme_dark-bg-active;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
&-line {
|
|
166
|
+
width: $width-carousel_indicator_line;
|
|
167
|
+
|
|
168
|
+
.#{$module}-indicator-item {
|
|
169
|
+
flex: 1;
|
|
170
|
+
cursor: pointer;
|
|
171
|
+
|
|
172
|
+
&:not(:last-child) {
|
|
173
|
+
margin-right: $spacing-carousel_indicator_line-marginX;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
&-small {
|
|
177
|
+
height: $height-carousel_indicator_line_small;
|
|
178
|
+
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
&-medium {
|
|
182
|
+
height: $height-carousel_indicator_line_medium;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
&-primary {
|
|
186
|
+
background-color: $color-carousel_indicator_theme_primary-bg-default;
|
|
187
|
+
|
|
188
|
+
&.#{$module}-indicator-item-active {
|
|
189
|
+
background: $color-carousel_indicator_theme_primary-bg-active;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
&:hover {
|
|
193
|
+
background-color: $color-carousel_indicator_theme_primary-bg-hover;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
&:active {
|
|
197
|
+
background: $color-carousel_indicator_theme_primary-bg-active;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
&-light {
|
|
202
|
+
|
|
203
|
+
background-color: $color-carousel_indicator_theme_light-bg-default;
|
|
204
|
+
|
|
205
|
+
&.#{$module}-indicator-item-active {
|
|
206
|
+
background: $color-carousel_indicator_theme_light-bg-active;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
&:hover {
|
|
210
|
+
background-color: $color-carousel_indicator_theme_light-bg-hover;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
&:active {
|
|
214
|
+
background: $color-carousel_indicator_theme_light-bg-active;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
&-dark {
|
|
219
|
+
|
|
220
|
+
background-color: $color-carousel_indicator_theme_dark-bg-default;
|
|
221
|
+
|
|
222
|
+
&.#{$module}-indicator-item-active {
|
|
223
|
+
background: $color-carousel_indicator_theme_dark-bg-active;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
&:hover {
|
|
227
|
+
background-color: $color-carousel_indicator_theme_dark-bg-hover;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
&:active {
|
|
231
|
+
background: $color-carousel_indicator_theme_dark-bg-active;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
&-columnar {
|
|
240
|
+
.#{$module}-indicator-item {
|
|
241
|
+
cursor: pointer;
|
|
242
|
+
|
|
243
|
+
&:not(:last-child) {
|
|
244
|
+
margin-right: $spacing-carousel_indicator_columnar-marginX;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
&-small {
|
|
248
|
+
width: $width-carousel_indicator_columnar_small;
|
|
249
|
+
height: $height-carousel_indicator_columnar_small_default;
|
|
250
|
+
|
|
251
|
+
&.#{$module}-indicator-item-active {
|
|
252
|
+
height: $height-carousel_indicator_columnar_small_active;
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
&-medium {
|
|
257
|
+
width: $width-carousel_indicator_columnar_medium;
|
|
258
|
+
height: $height-carousel_indicator_columnar_medium_default;
|
|
259
|
+
|
|
260
|
+
&.#{$module}-indicator-item-active {
|
|
261
|
+
height: $height-carousel_indicator_columnar_medium_active;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
|
|
266
|
+
&-primary {
|
|
267
|
+
background-color: $color-carousel_indicator_theme_primary-bg-default;
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
&.#{$module}-indicator-item-active {
|
|
271
|
+
background: $color-carousel_indicator_theme_primary-bg-active;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
&:hover {
|
|
275
|
+
background-color: $color-carousel_indicator_theme_primary-bg-hover;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
&:active {
|
|
279
|
+
background: $color-carousel_indicator_theme_primary-bg-active;
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
&-light {
|
|
284
|
+
background-color: $color-carousel_indicator_theme_light-bg-default;
|
|
285
|
+
|
|
286
|
+
&.#{$module}-indicator-item-active {
|
|
287
|
+
background: $color-carousel_indicator_theme_light-bg-active;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
&:hover {
|
|
291
|
+
background-color: $color-carousel_indicator_theme_light-bg-hover;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
&:active {
|
|
295
|
+
background: $color-carousel_indicator_theme_light-bg-active;
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
&-dark {
|
|
300
|
+
background-color: $color-carousel_indicator_theme_dark-bg-default;
|
|
301
|
+
|
|
302
|
+
&.#{$module}-indicator-item-active {
|
|
303
|
+
background: $color-carousel_indicator_theme_dark-bg-active;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
&:hover {
|
|
307
|
+
background-color: $color-carousel_indicator_theme_dark-bg-hover;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
&:active {
|
|
311
|
+
background: $color-carousel_indicator_theme_dark-bg-active;
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
&-arrow {
|
|
321
|
+
display: flex;
|
|
322
|
+
font-size: $width-carousel_arrow;
|
|
323
|
+
cursor: pointer;
|
|
324
|
+
|
|
325
|
+
&-prev {
|
|
326
|
+
position: absolute;
|
|
327
|
+
top: 50%;
|
|
328
|
+
left: $spacing-carousel_arrow-left;
|
|
329
|
+
transform: translateY(-50%);
|
|
330
|
+
z-index: 2;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
&-next {
|
|
334
|
+
position: absolute;
|
|
335
|
+
top: 50%;
|
|
336
|
+
right: $spacing-carousel_arrow-right;
|
|
337
|
+
transform: translateY(-50%);
|
|
338
|
+
z-index: 2;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
&-light {
|
|
342
|
+
color: $color-carousel_arrow_theme_light-bg-default;
|
|
343
|
+
|
|
344
|
+
&:hover {
|
|
345
|
+
color: $color-carousel_arrow_theme_light-bg-hover;
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
|
|
350
|
+
&-primary {
|
|
351
|
+
color: $color-carousel_arrow_theme_primary-bg-default;
|
|
352
|
+
|
|
353
|
+
&:hover {
|
|
354
|
+
color: $color-carousel_arrow_theme_primary-bg-hover;
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
&-dark {
|
|
359
|
+
color: $color-carousel_arrow_theme_dark-bg-default;
|
|
360
|
+
|
|
361
|
+
&:hover {
|
|
362
|
+
color: $color-carousel_arrow_theme_dark-bg-hover;
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
&-arrow-hover div {
|
|
369
|
+
z-index: 2;
|
|
370
|
+
opacity: 0;
|
|
371
|
+
transition: all .3s;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
&:hover {
|
|
375
|
+
.#{$module}-arrow-hover div {
|
|
376
|
+
opacity: 1;
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
@keyframes #{$module}-content-item-keyframe-slide-in {
|
|
382
|
+
|
|
383
|
+
from {
|
|
384
|
+
transform: translateX(100%);
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
to {
|
|
388
|
+
transform: translateX(0);
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
@keyframes #{$module}-content-item-keyframe-slide-out {
|
|
393
|
+
|
|
394
|
+
from {
|
|
395
|
+
transform: translateX(0);
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
to {
|
|
399
|
+
transform: translateX(-100%);
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
@keyframes #{$module}-content-item-keyframe-slide-in-reverse {
|
|
404
|
+
|
|
405
|
+
from {
|
|
406
|
+
transform: translateX(-100%);
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
to {
|
|
410
|
+
transform: translateX(0);
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
@keyframes #{$module}-content-item-keyframe-slide-out-reverse {
|
|
415
|
+
|
|
416
|
+
from {
|
|
417
|
+
transform: translateX(0);
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
to {
|
|
421
|
+
transform: translateX(100%);
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
@import "./rtl.scss";
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { BASE_CLASS_PREFIX } from '../base/constants';
|
|
2
|
+
|
|
3
|
+
const cssClasses = {
|
|
4
|
+
CAROUSEL: `${BASE_CLASS_PREFIX}-carousel`,
|
|
5
|
+
CAROUSEL_INDICATOR: `${BASE_CLASS_PREFIX}-carousel-indicator`,
|
|
6
|
+
CAROUSEL_INDICATOR_LINE: `${BASE_CLASS_PREFIX}-carousel-indicator-line`,
|
|
7
|
+
CAROUSEL_INDICATOR_DOT: `${BASE_CLASS_PREFIX}-carousel-indicator-dot`,
|
|
8
|
+
CAROUSEL_INDICATOR_COLUMNAR: `${BASE_CLASS_PREFIX}-carousel-indicator-columnar`,
|
|
9
|
+
CAROUSEL_INDICATOR_INACTIVE: `${BASE_CLASS_PREFIX}-carousel-indicator-inactive`,
|
|
10
|
+
CAROUSEL_INDICATOR_ACTIVE: `${BASE_CLASS_PREFIX}-carousel-indicator-active`,
|
|
11
|
+
CAROUSEL_CONTENT: `${BASE_CLASS_PREFIX}-carousel-content`,
|
|
12
|
+
CAROUSEL_ARROW: `${BASE_CLASS_PREFIX}-carousel-arrow`,
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const numbers = {
|
|
16
|
+
DEFAULT_ACTIVE_INDEX: 0,
|
|
17
|
+
DEFAULT_INTERVAL: 2000,
|
|
18
|
+
DEFAULT_SPEED: 300,
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const strings = {
|
|
22
|
+
ANIMATION_MAP: ['slide', 'fade'],
|
|
23
|
+
DIRECTION: ['left', 'right'],
|
|
24
|
+
TYPE_MAP: ['columnar', 'line', 'dot'],
|
|
25
|
+
THEME_MAP: ['dark', 'primary', 'light'],
|
|
26
|
+
POSITION_MAP: ['left', 'center', 'right'],
|
|
27
|
+
ARROW_MAP: ['always', 'hover'],
|
|
28
|
+
SIZE: ['small', 'medium'],
|
|
29
|
+
TRIGGER: ['click', 'hover'],
|
|
30
|
+
} as const;
|
|
31
|
+
|
|
32
|
+
export { cssClasses, numbers, strings };
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import { isObject, get } from 'lodash';
|
|
2
|
+
import BaseFoundation, { DefaultAdapter } from '../base/foundation';
|
|
3
|
+
import { numbers } from './constants';
|
|
4
|
+
import { throttle } from 'lodash';
|
|
5
|
+
|
|
6
|
+
export interface CarouselAdapter<P = Record<string, any>, S = Record<string, any>> extends DefaultAdapter<P, S> {
|
|
7
|
+
notifyChange: (activeIndex: number, preIndex: number) => void;
|
|
8
|
+
setNewActiveIndex: (activeIndex: number) => void;
|
|
9
|
+
setPreActiveIndex: (activeIndex: number) => void;
|
|
10
|
+
setIsReverse: (isReverse: boolean) => void;
|
|
11
|
+
setIsInit: (isInit: boolean) => void;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
class CarouselFoundation<P = Record<string, any>, S = Record<string, any>> extends BaseFoundation<CarouselAdapter<P, S>, P, S> {
|
|
15
|
+
|
|
16
|
+
constructor(adapter: CarouselAdapter<P, S>) {
|
|
17
|
+
super({ ...adapter });
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
_interval = null;
|
|
21
|
+
|
|
22
|
+
play(interval: number): void {
|
|
23
|
+
if (this._interval) {
|
|
24
|
+
clearInterval(this._interval);
|
|
25
|
+
}
|
|
26
|
+
this._interval = setInterval(() => {
|
|
27
|
+
this.next();
|
|
28
|
+
}, interval);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
stop(): void {
|
|
32
|
+
if (this._interval){
|
|
33
|
+
clearInterval(this._interval);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
goTo(activeIndex: number): void {
|
|
38
|
+
const { activeIndex: stateActiveIndex } = this.getStates();
|
|
39
|
+
const targetIndex = this.getValidIndex(activeIndex);
|
|
40
|
+
this._adapter.setIsReverse(stateActiveIndex > targetIndex);
|
|
41
|
+
if (this.getIsControledComponent()) {
|
|
42
|
+
this._notifyChange(targetIndex);
|
|
43
|
+
} else {
|
|
44
|
+
this._notifyChange(targetIndex);
|
|
45
|
+
this.handleNewActiveIndex(targetIndex);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
next(): void {
|
|
50
|
+
const { activeIndex: stateActiveIndex } = this.getStates();
|
|
51
|
+
const targetIndex = this.getValidIndex(stateActiveIndex + 1);
|
|
52
|
+
this._adapter.setIsReverse(false);
|
|
53
|
+
if (this.getIsControledComponent()) {
|
|
54
|
+
this._notifyChange(targetIndex);
|
|
55
|
+
} else {
|
|
56
|
+
this._notifyChange(targetIndex);
|
|
57
|
+
this.handleNewActiveIndex(targetIndex);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
prev(): void {
|
|
62
|
+
const { activeIndex: stateActiveIndex } = this.getStates();
|
|
63
|
+
const targetIndex = this.getValidIndex(stateActiveIndex - 1);
|
|
64
|
+
this._adapter.setIsReverse(true);
|
|
65
|
+
if (this.getIsControledComponent()) {
|
|
66
|
+
this._notifyChange(targetIndex);
|
|
67
|
+
} else {
|
|
68
|
+
this._notifyChange(targetIndex);
|
|
69
|
+
this.handleNewActiveIndex(targetIndex);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
destroy(): void {
|
|
74
|
+
this._unregisterInterval();
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
_unregisterInterval() {
|
|
78
|
+
if (this._interval) {
|
|
79
|
+
clearInterval(this._interval);
|
|
80
|
+
this._interval = null;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
_notifyChange(activeIndex: number): void {
|
|
86
|
+
const { activeIndex: stateActiveIndex, isInit } = this.getStates();
|
|
87
|
+
if (isInit){
|
|
88
|
+
this._adapter.setIsInit(false);
|
|
89
|
+
}
|
|
90
|
+
if (stateActiveIndex !== activeIndex) {
|
|
91
|
+
this._adapter.setPreActiveIndex(stateActiveIndex);
|
|
92
|
+
this._adapter.notifyChange(activeIndex, stateActiveIndex);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
getValidIndex(index: number): number {
|
|
97
|
+
const { children } = this.getStates();
|
|
98
|
+
return (index + children.length) % children.length;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
getSwitchingTime(): number {
|
|
102
|
+
const { autoPlay, speed } = this.getProps();
|
|
103
|
+
const autoPlayType = typeof autoPlay;
|
|
104
|
+
if (autoPlayType === 'boolean' && autoPlay){
|
|
105
|
+
return numbers.DEFAULT_INTERVAL + speed;
|
|
106
|
+
}
|
|
107
|
+
if (isObject(autoPlay)){
|
|
108
|
+
return get(autoPlay, 'interval', numbers.DEFAULT_INTERVAL) + speed;
|
|
109
|
+
}
|
|
110
|
+
return speed;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
getIsControledComponent(): boolean {
|
|
114
|
+
return this._isInProps('activeIndex');
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
handleAutoPlay(): void {
|
|
118
|
+
const { autoPlay } = this.getProps();
|
|
119
|
+
const autoPlayType = typeof autoPlay;
|
|
120
|
+
if ((autoPlayType === 'boolean' && autoPlay) || isObject(autoPlay)){
|
|
121
|
+
this.play(this.getSwitchingTime());
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
handleKeyDown(event: any): void{
|
|
126
|
+
if (event.key === 'ArrowLeft') {
|
|
127
|
+
this.prev();
|
|
128
|
+
}
|
|
129
|
+
if (event.key === 'ArrowRight') {
|
|
130
|
+
this.next();
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
onIndicatorChange(activeIndex: number): void {
|
|
135
|
+
const { activeIndex: stateActiveIndex } = this.getStates();
|
|
136
|
+
this._adapter.setIsReverse(stateActiveIndex > activeIndex);
|
|
137
|
+
this._notifyChange(activeIndex);
|
|
138
|
+
if (!this.getIsControledComponent()) {
|
|
139
|
+
this.handleNewActiveIndex(activeIndex);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
handleNewActiveIndex(activeIndex: number): void {
|
|
145
|
+
const { activeIndex: stateActiveIndex } = this.getStates();
|
|
146
|
+
if (stateActiveIndex !== activeIndex) {
|
|
147
|
+
this._adapter.setNewActiveIndex(activeIndex);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
getDefaultActiveIndex(): number {
|
|
152
|
+
let activeIndex;
|
|
153
|
+
const props = this.getProps();
|
|
154
|
+
if ('activeIndex' in props) {
|
|
155
|
+
activeIndex = props.activeIndex;
|
|
156
|
+
} else if ('defaultActiveIndex' in props) {
|
|
157
|
+
activeIndex = props.defaultActiveIndex;
|
|
158
|
+
}
|
|
159
|
+
return activeIndex;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
export default CarouselFoundation;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
$module: #{$prefix}-carousel;
|
|
2
|
+
.#{$prefix}-rtl,
|
|
3
|
+
.#{$prefix}-portal-rtl {
|
|
4
|
+
.#{$module} {
|
|
5
|
+
direction: rtl;
|
|
6
|
+
|
|
7
|
+
&-indicator {
|
|
8
|
+
display: flex;
|
|
9
|
+
|
|
10
|
+
&-dot {
|
|
11
|
+
.#{$module}-indicator-item {
|
|
12
|
+
&:not(:last-child) {
|
|
13
|
+
margin-right: 0;
|
|
14
|
+
margin-left: $spacing-carousel_indicator_dot-marginX;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
&-columnar {
|
|
20
|
+
.#{$module}-indicator-item {
|
|
21
|
+
&:not(:last-child) {
|
|
22
|
+
margin-right: 0;
|
|
23
|
+
margin-left: $spacing-carousel_indicator_columnar-marginX;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
&-arrow {
|
|
30
|
+
flex-direction: row-reverse;
|
|
31
|
+
|
|
32
|
+
&-prev {
|
|
33
|
+
left: auto;
|
|
34
|
+
right: $spacing-carousel_arrow-right;
|
|
35
|
+
transform: scaleX(-1) translateY(-50%);
|
|
36
|
+
z-index: 2;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
&-next {
|
|
40
|
+
left: $spacing-carousel_arrow-left;
|
|
41
|
+
transform: scaleX(-1) translateY(-50%);
|
|
42
|
+
right: auto;
|
|
43
|
+
z-index: 2;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|