@douyinfe/semi-foundation 2.9.1 → 2.10.0-beta.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 +166 -0
- package/carousel/rtl.scss +47 -0
- package/carousel/variables.scss +46 -0
- 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 +30 -0
- package/lib/cjs/carousel/foundation.js +219 -0
- package/lib/cjs/carousel/rtl.scss +47 -0
- package/lib/cjs/carousel/variables.scss +46 -0
- 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/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 +30 -0
- package/lib/es/carousel/foundation.js +200 -0
- package/lib/es/carousel/rtl.scss +47 -0
- package/lib/es/carousel/variables.scss +46 -0
- 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/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
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
$color-carousel_indicator_theme_dark-bg-default: rgba(var(--semi-black), .5); // 深色主题指示器背景颜色 - 默认
|
|
2
|
+
$color-carousel_indicator_theme_dark-bg-hover: rgba(var(--semi-black), .7); // 深色主题指示器背景颜色 - 悬浮
|
|
3
|
+
$color-carousel_indicator_theme_dark-bg-active: rgba(var(--semi-black), 1); // 深色主题指示器背景颜色 - 选中
|
|
4
|
+
|
|
5
|
+
$color-carousel_indicator_theme_primary-bg-default: rgba(var(--semi-blue-6), .4); // 主要主题指示器背景颜色 - 默认
|
|
6
|
+
$color-carousel_indicator_theme_primary-bg-hover: rgba(var(--semi-blue-6), .7); // 主要主题指示器背景颜色 - 悬浮
|
|
7
|
+
$color-carousel_indicator_theme_primary-bg-active: rgba(var(--semi-blue-6), 1); // 主要主题指示器背景颜色 - 选中
|
|
8
|
+
|
|
9
|
+
$color-carousel_indicator_theme_light-bg-default: rgba(var(--semi-white), .4); // 浅色主题指示器背景颜色 - 默认
|
|
10
|
+
$color-carousel_indicator_theme_light-bg-hover: rgba(var(--semi-white), .7); // 浅色主题指示器背景颜色 - 悬浮
|
|
11
|
+
$color-carousel_indicator_theme_light-bg-active: rgba(var(--semi-white), 1); // 浅色主题指示器背景颜色 - 选中
|
|
12
|
+
|
|
13
|
+
$color-carousel_arrow_theme_dark-bg-default: rgba(var(--semi-black), .5); // 深色主题箭头背景颜色 - 默认
|
|
14
|
+
$color-carousel_arrow_theme_dark-bg-hover: rgba(var(--semi-black), 1); // 深色主题箭头背景颜色 - 悬浮
|
|
15
|
+
|
|
16
|
+
$color-carousel_arrow_theme_primary-bg-default: rgba(var(--semi-blue-6), .4); // 主要主题箭头背景颜色 - 默认
|
|
17
|
+
$color-carousel_arrow_theme_primary-bg-hover: rgba(var(--semi-blue-6), 1); // 主要主题箭头背景颜色 - 悬浮
|
|
18
|
+
|
|
19
|
+
$color-carousel_arrow_theme_light-bg-default: rgba(var(--semi-white), .4); // 浅色主题箭头背景颜色 - 默认
|
|
20
|
+
$color-carousel_arrow_theme_light-bg-hover: rgba(var(--semi-white), 1); // 浅色主题箭头背景颜色 - 悬浮
|
|
21
|
+
|
|
22
|
+
$width-carousel_indicator_line: 240px; // 条状指示器最大宽度
|
|
23
|
+
$width-carousel_indicator_columnar_small: 4px; // 小尺寸柱状指示器宽度
|
|
24
|
+
$width-carousel_indicator_columnar_medium: 6px; // 中等尺寸柱状指示器宽度
|
|
25
|
+
$width-carousel_indicator_dot_small:8px; // 小尺寸点状指示器宽度
|
|
26
|
+
$width-carousel_indicator_dot_medium: 12px; // 中等尺寸点状指示器宽度
|
|
27
|
+
$width-carousel_arrow: 32px; // 箭头宽度
|
|
28
|
+
|
|
29
|
+
$height-carousel_indicator_columnar_small_default: 12px; // 小尺寸柱状指示器高度 - 默认
|
|
30
|
+
$height-carousel_indicator_columnar_small_active: 20px; // 小尺寸柱状指示器高度 - 选中
|
|
31
|
+
$height-carousel_indicator_columnar_medium_default: 20px; // 中等尺寸柱状指示器高度 - 默认
|
|
32
|
+
$height-carousel_indicator_columnar_medium_active: 28px; // 中等尺寸柱状指示器高度 - 选中
|
|
33
|
+
|
|
34
|
+
$height-carousel_indicator_line_small: 4px; // 小尺寸条状指示器高度
|
|
35
|
+
$height-carousel_indicator_line_medium: 6px; // 中等尺寸条状指示器高度
|
|
36
|
+
|
|
37
|
+
$radius-carousel_indicator_dot: 50%; // 点状指示器圆角
|
|
38
|
+
|
|
39
|
+
$spacing-carousel_indicator-padding: 32px; // 指示器内边距
|
|
40
|
+
|
|
41
|
+
$spacing-carousel_indicator_columnar-marginX: 4px; // 柱状指示器水平外边距
|
|
42
|
+
$spacing-carousel_indicator_line-marginX: 4px; // 条状指示器水平外边距
|
|
43
|
+
$spacing-carousel_indicator_dot-marginX: 8px; // 点状指示器水平外边距
|
|
44
|
+
|
|
45
|
+
$spacing-carousel_arrow-left: 20px; // 左侧箭头绝对定位 - left
|
|
46
|
+
$spacing-carousel_arrow-right: 20px; // 右侧箭头绝对定位 - right
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { BASE_CLASS_PREFIX } from '../base/constants';
|
|
2
2
|
const cssClasses = {
|
|
3
3
|
PREFIX: "".concat(BASE_CLASS_PREFIX, "-switch"),
|
|
4
|
+
FOCUS: "".concat(BASE_CLASS_PREFIX, "-switch-focus"),
|
|
4
5
|
LARGE: "".concat(BASE_CLASS_PREFIX, "-switch-large"),
|
|
5
6
|
SMALL: "".concat(BASE_CLASS_PREFIX, "-switch-small"),
|
|
6
7
|
CHECKED: "".concat(BASE_CLASS_PREFIX, "-switch-checked"),
|
|
@@ -2,6 +2,7 @@ import BaseFoundation, { DefaultAdapter } from '../base/foundation';
|
|
|
2
2
|
export interface SwitchAdapter<P = Record<string, any>, S = Record<string, any>> extends DefaultAdapter<P, S> {
|
|
3
3
|
setNativeControlChecked: (nativeControlChecked: boolean | undefined) => void;
|
|
4
4
|
setNativeControlDisabled: (nativeControlDisabled: boolean | undefined) => void;
|
|
5
|
+
setFocusVisible: (focusVisible: boolean) => void;
|
|
5
6
|
notifyChange: (checked: boolean, e: any) => void;
|
|
6
7
|
}
|
|
7
8
|
export default class SwitchFoundation<P = Record<string, any>, S = Record<string, any>> extends BaseFoundation<SwitchAdapter<P, S>, P, S> {
|
|
@@ -10,5 +11,7 @@ export default class SwitchFoundation<P = Record<string, any>, S = Record<string
|
|
|
10
11
|
setChecked(checked: boolean | undefined): void;
|
|
11
12
|
setDisabled(disabled: boolean | undefined): void;
|
|
12
13
|
handleChange(checked: boolean, e: any): void;
|
|
14
|
+
handleFocusVisible: (event: any) => void;
|
|
15
|
+
handleBlur: () => void;
|
|
13
16
|
destroy(): void;
|
|
14
17
|
}
|
|
@@ -3,6 +3,24 @@ import BaseFoundation from '../base/foundation';
|
|
|
3
3
|
export default class SwitchFoundation extends BaseFoundation {
|
|
4
4
|
constructor(adapter) {
|
|
5
5
|
super(_Object$assign({}, adapter));
|
|
6
|
+
|
|
7
|
+
this.handleFocusVisible = event => {
|
|
8
|
+
const {
|
|
9
|
+
target
|
|
10
|
+
} = event;
|
|
11
|
+
|
|
12
|
+
try {
|
|
13
|
+
if (target.matches(':focus-visible')) {
|
|
14
|
+
this._adapter.setFocusVisible(true);
|
|
15
|
+
}
|
|
16
|
+
} catch (error) {
|
|
17
|
+
console.warn('The current browser does not support the focus-visible');
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
this.handleBlur = () => {
|
|
22
|
+
this._adapter.setFocusVisible(false);
|
|
23
|
+
};
|
|
6
24
|
}
|
|
7
25
|
|
|
8
26
|
init() {
|
package/lib/es/switch/switch.css
CHANGED
|
@@ -37,6 +37,7 @@ $color-switch_unchecked-text-default: var(--semi-color-text-2); // 关闭态开
|
|
|
37
37
|
$color-switch_loading_spin-default: var(--semi-color-white); // 加载态开关loading图标颜色
|
|
38
38
|
$color-switch_spin_checked-bg-default: var(--semi-color-success-hover); // 已开启开关加载态loading背景颜色
|
|
39
39
|
$color-switch_spin_unchecked-bg-default: var(--semi-color-fill-1); // 已关闭开关加载态loading背景颜色
|
|
40
|
+
$color-switch_primary-outline-focus: var(--semi-color-primary-light-active); // 开关轮廓 - 聚焦
|
|
40
41
|
|
|
41
42
|
// Width/Height
|
|
42
43
|
$width-switch: 40px; // 开关宽度
|
|
@@ -57,6 +58,7 @@ $width-switch_checked_unchecked_text: 26px; // 开关按钮文字宽度
|
|
|
57
58
|
$width-switch_spin-small: 10px; // 小尺寸开关加载 spin 宽度
|
|
58
59
|
$width-switch_spin-default: 18px; // 默认尺寸开关加载 spin 宽度
|
|
59
60
|
$width-switch_spin-large: 28px; // 大尺寸开关加载 spin 宽度
|
|
61
|
+
$width-switch-outline: 2px; // 开关轮廓宽度
|
|
60
62
|
|
|
61
63
|
|
|
62
64
|
// Spacing
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@douyinfe/semi-foundation",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.10.0-beta.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build:lib": "node ./scripts/compileLib.js",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
10
|
"@babel/runtime-corejs3": "^7.15.4",
|
|
11
|
-
"@douyinfe/semi-animation": "2.
|
|
11
|
+
"@douyinfe/semi-animation": "2.10.0-beta.0",
|
|
12
12
|
"async-validator": "^3.5.0",
|
|
13
13
|
"classnames": "^2.2.6",
|
|
14
14
|
"date-fns": "^2.9.0",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"*.scss",
|
|
25
25
|
"*.css"
|
|
26
26
|
],
|
|
27
|
-
"gitHead": "
|
|
27
|
+
"gitHead": "10c5eff42fe3144451fd73d9d542a710d165d456",
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@babel/plugin-proposal-decorators": "^7.15.8",
|
|
30
30
|
"@babel/plugin-transform-runtime": "^7.15.8",
|
package/switch/constants.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { BASE_CLASS_PREFIX } from '../base/constants';
|
|
|
2
2
|
|
|
3
3
|
const cssClasses = {
|
|
4
4
|
PREFIX: `${BASE_CLASS_PREFIX}-switch`,
|
|
5
|
+
FOCUS: `${BASE_CLASS_PREFIX}-switch-focus`,
|
|
5
6
|
LARGE: `${BASE_CLASS_PREFIX}-switch-large`,
|
|
6
7
|
SMALL: `${BASE_CLASS_PREFIX}-switch-small`,
|
|
7
8
|
CHECKED: `${BASE_CLASS_PREFIX}-switch-checked`,
|
package/switch/foundation.ts
CHANGED
|
@@ -3,6 +3,7 @@ import BaseFoundation, { DefaultAdapter } from '../base/foundation';
|
|
|
3
3
|
export interface SwitchAdapter<P = Record<string, any>, S = Record<string, any>> extends DefaultAdapter<P, S> {
|
|
4
4
|
setNativeControlChecked: (nativeControlChecked: boolean | undefined) => void;
|
|
5
5
|
setNativeControlDisabled: (nativeControlDisabled: boolean | undefined) => void;
|
|
6
|
+
setFocusVisible: (focusVisible: boolean) => void;
|
|
6
7
|
notifyChange: (checked: boolean, e: any) => void;
|
|
7
8
|
}
|
|
8
9
|
|
|
@@ -37,6 +38,21 @@ export default class SwitchFoundation<P = Record<string, any>, S = Record<string
|
|
|
37
38
|
}
|
|
38
39
|
}
|
|
39
40
|
|
|
41
|
+
handleFocusVisible = (event: any) => {
|
|
42
|
+
const { target } = event;
|
|
43
|
+
try {
|
|
44
|
+
if (target.matches(':focus-visible')) {
|
|
45
|
+
this._adapter.setFocusVisible(true);
|
|
46
|
+
}
|
|
47
|
+
} catch (error){
|
|
48
|
+
console.warn('The current browser does not support the focus-visible');
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
handleBlur = () => {
|
|
53
|
+
this._adapter.setFocusVisible(false);
|
|
54
|
+
}
|
|
55
|
+
|
|
40
56
|
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
41
57
|
destroy(): void {}
|
|
42
58
|
}
|
package/switch/switch.scss
CHANGED
package/switch/variables.scss
CHANGED
|
@@ -37,6 +37,7 @@ $color-switch_unchecked-text-default: var(--semi-color-text-2); // 关闭态开
|
|
|
37
37
|
$color-switch_loading_spin-default: var(--semi-color-white); // 加载态开关loading图标颜色
|
|
38
38
|
$color-switch_spin_checked-bg-default: var(--semi-color-success-hover); // 已开启开关加载态loading背景颜色
|
|
39
39
|
$color-switch_spin_unchecked-bg-default: var(--semi-color-fill-1); // 已关闭开关加载态loading背景颜色
|
|
40
|
+
$color-switch_primary-outline-focus: var(--semi-color-primary-light-active); // 开关轮廓 - 聚焦
|
|
40
41
|
|
|
41
42
|
// Width/Height
|
|
42
43
|
$width-switch: 40px; // 开关宽度
|
|
@@ -57,6 +58,7 @@ $width-switch_checked_unchecked_text: 26px; // 开关按钮文字宽度
|
|
|
57
58
|
$width-switch_spin-small: 10px; // 小尺寸开关加载 spin 宽度
|
|
58
59
|
$width-switch_spin-default: 18px; // 默认尺寸开关加载 spin 宽度
|
|
59
60
|
$width-switch_spin-large: 28px; // 大尺寸开关加载 spin 宽度
|
|
61
|
+
$width-switch-outline: 2px; // 开关轮廓宽度
|
|
60
62
|
|
|
61
63
|
|
|
62
64
|
// Spacing
|