@douyinfe/semi-foundation 2.13.0 → 2.14.0-beta.1
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/anchor/foundation.ts +1 -2
- package/autoComplete/foundation.ts +29 -18
- package/avatar/avatar.scss +14 -0
- package/avatar/foundation.ts +17 -0
- package/avatar/variables.scss +3 -0
- package/base/foundation.ts +6 -0
- package/calendar/foundation.ts +2 -1
- package/cascader/cascader.scss +3 -0
- package/cascader/foundation.ts +3 -0
- package/checkbox/checkboxFoundation.ts +2 -1
- package/datePicker/foundation.ts +3 -3
- package/datePicker/inputFoundation.ts +1 -1
- package/datePicker/monthsGridFoundation.ts +8 -4
- package/form/utils.ts +5 -1
- package/input/foundation.ts +3 -11
- package/input/input.scss +6 -0
- package/input/textareaFoundation.ts +0 -9
- package/input/variables.scss +3 -0
- package/lib/cjs/anchor/foundation.d.ts +1 -2
- package/lib/cjs/autoComplete/foundation.d.ts +0 -1
- package/lib/cjs/autoComplete/foundation.js +35 -23
- package/lib/cjs/avatar/avatar.css +9 -0
- package/lib/cjs/avatar/avatar.scss +14 -0
- package/lib/cjs/avatar/foundation.d.ts +3 -0
- package/lib/cjs/avatar/foundation.js +20 -0
- package/lib/cjs/avatar/variables.scss +3 -0
- package/lib/cjs/base/foundation.js +12 -0
- package/lib/cjs/calendar/eventUtil.d.ts +1 -1
- package/lib/cjs/calendar/foundation.d.ts +1 -2
- package/lib/cjs/cascader/cascader.css +5 -0
- package/lib/cjs/cascader/cascader.scss +3 -0
- package/lib/cjs/cascader/foundation.d.ts +0 -11
- package/lib/cjs/cascader/foundation.js +5 -0
- package/lib/cjs/checkbox/checkboxFoundation.js +3 -1
- package/lib/cjs/datePicker/foundation.d.ts +3 -4
- package/lib/cjs/datePicker/inputFoundation.d.ts +1 -2
- package/lib/cjs/datePicker/monthsGridFoundation.d.ts +4 -5
- package/lib/cjs/form/utils.d.ts +5 -2
- package/lib/cjs/form/utils.js +4 -0
- package/lib/cjs/input/foundation.d.ts +0 -4
- package/lib/cjs/input/foundation.js +7 -13
- package/lib/cjs/input/input.css +6 -0
- package/lib/cjs/input/input.scss +6 -0
- package/lib/cjs/input/textareaFoundation.d.ts +0 -4
- package/lib/cjs/input/textareaFoundation.js +0 -12
- package/lib/cjs/input/variables.scss +3 -0
- package/lib/cjs/overflowList/foundation.d.ts +1 -0
- package/lib/cjs/overflowList/foundation.js +25 -0
- package/lib/cjs/radio/radio.css +6 -0
- package/lib/cjs/radio/radio.scss +8 -0
- package/lib/cjs/radio/radioFoundation.d.ts +3 -0
- package/lib/cjs/radio/radioFoundation.js +24 -0
- package/lib/cjs/radio/variables.scss +4 -0
- package/lib/cjs/select/foundation.js +2 -0
- package/lib/cjs/select/select.css +5 -0
- package/lib/cjs/select/select.scss +3 -0
- package/lib/cjs/switch/foundation.js +3 -1
- package/lib/cjs/tagInput/foundation.js +2 -0
- package/lib/cjs/tagInput/tagInput.css +1 -1
- package/lib/cjs/tagInput/variables.scss +1 -1
- package/lib/cjs/timePicker/foundation.js +4 -0
- package/lib/cjs/timePicker/utils/localeDate.js +5 -0
- package/lib/cjs/tree/tree.css +0 -20
- package/lib/cjs/tree/tree.scss +0 -20
- package/lib/cjs/tree/treeUtil.js +2 -0
- package/lib/cjs/tree/variables.scss +0 -18
- package/lib/cjs/treeSelect/foundation.js +10 -1
- package/lib/cjs/treeSelect/treeSelect.css +5 -0
- package/lib/cjs/treeSelect/treeSelect.scss +3 -0
- package/lib/cjs/utils/Logger.js +8 -0
- package/lib/cjs/utils/Store.js +1 -0
- package/lib/cjs/utils/date-fns-extra.js +4 -0
- package/lib/cjs/utils/isElement.js +1 -0
- package/lib/cjs/utils/isEscPress.js +1 -0
- package/lib/cjs/utils/set.js +1 -0
- package/lib/es/anchor/foundation.d.ts +1 -2
- package/lib/es/autoComplete/foundation.d.ts +0 -1
- package/lib/es/autoComplete/foundation.js +35 -23
- package/lib/es/avatar/avatar.css +9 -0
- package/lib/es/avatar/avatar.scss +14 -0
- package/lib/es/avatar/foundation.d.ts +3 -0
- package/lib/es/avatar/foundation.js +19 -0
- package/lib/es/avatar/variables.scss +3 -0
- package/lib/es/base/foundation.js +12 -0
- package/lib/es/calendar/eventUtil.d.ts +1 -1
- package/lib/es/calendar/foundation.d.ts +1 -2
- package/lib/es/cascader/cascader.css +5 -0
- package/lib/es/cascader/cascader.scss +3 -0
- package/lib/es/cascader/foundation.d.ts +0 -11
- package/lib/es/cascader/foundation.js +5 -0
- package/lib/es/checkbox/checkboxFoundation.js +2 -1
- package/lib/es/datePicker/foundation.d.ts +3 -4
- package/lib/es/datePicker/inputFoundation.d.ts +1 -2
- package/lib/es/datePicker/monthsGridFoundation.d.ts +4 -5
- package/lib/es/form/utils.d.ts +5 -2
- package/lib/es/form/utils.js +5 -0
- package/lib/es/input/foundation.d.ts +0 -4
- package/lib/es/input/foundation.js +6 -12
- package/lib/es/input/input.css +6 -0
- package/lib/es/input/input.scss +6 -0
- package/lib/es/input/textareaFoundation.d.ts +0 -4
- package/lib/es/input/textareaFoundation.js +0 -11
- package/lib/es/input/variables.scss +3 -0
- package/lib/es/overflowList/foundation.d.ts +1 -0
- package/lib/es/overflowList/foundation.js +25 -0
- package/lib/es/radio/radio.css +6 -0
- package/lib/es/radio/radio.scss +8 -0
- package/lib/es/radio/radioFoundation.d.ts +3 -0
- package/lib/es/radio/radioFoundation.js +23 -0
- package/lib/es/radio/variables.scss +4 -0
- package/lib/es/select/foundation.js +2 -0
- package/lib/es/select/select.css +5 -0
- package/lib/es/select/select.scss +3 -0
- package/lib/es/switch/foundation.js +2 -1
- package/lib/es/tagInput/foundation.js +2 -0
- package/lib/es/tagInput/tagInput.css +1 -1
- package/lib/es/tagInput/variables.scss +1 -1
- package/lib/es/timePicker/foundation.js +4 -0
- package/lib/es/timePicker/utils/localeDate.js +5 -0
- package/lib/es/tree/tree.css +0 -20
- package/lib/es/tree/tree.scss +0 -20
- package/lib/es/tree/treeUtil.js +2 -0
- package/lib/es/tree/variables.scss +0 -18
- package/lib/es/treeSelect/foundation.js +10 -1
- package/lib/es/treeSelect/treeSelect.css +5 -0
- package/lib/es/treeSelect/treeSelect.scss +3 -0
- package/lib/es/utils/Logger.js +8 -0
- package/lib/es/utils/Store.js +1 -0
- package/lib/es/utils/date-fns-extra.js +4 -0
- package/lib/es/utils/isElement.js +1 -0
- package/lib/es/utils/isEscPress.js +1 -0
- package/lib/es/utils/set.js +2 -0
- package/overflowList/foundation.ts +20 -0
- package/package.json +2 -2
- package/radio/radio.scss +8 -0
- package/radio/radioFoundation.ts +17 -0
- package/radio/variables.scss +4 -0
- package/select/foundation.ts +1 -0
- package/select/select.scss +3 -0
- package/switch/foundation.ts +2 -1
- package/tagInput/foundation.ts +1 -0
- package/tagInput/variables.scss +1 -1
- package/timePicker/foundation.ts +2 -1
- package/timePicker/utils/localeDate.ts +3 -0
- package/tree/tree.scss +0 -20
- package/tree/treeUtil.ts +1 -0
- package/tree/variables.scss +0 -18
- package/treeSelect/foundation.ts +7 -0
- package/treeSelect/treeSelect.scss +3 -0
- package/utils/Logger.ts +4 -0
- package/utils/Store.ts +1 -0
- package/utils/date-fns-extra.ts +2 -0
- package/utils/isElement.ts +1 -0
- package/utils/isEscPress.ts +1 -0
- package/utils/set.ts +1 -0
|
@@ -14,9 +14,29 @@ var _assign = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-sta
|
|
|
14
14
|
|
|
15
15
|
var _foundation = _interopRequireDefault(require("../base/foundation"));
|
|
16
16
|
|
|
17
|
+
var _warning = _interopRequireDefault(require("../utils/warning"));
|
|
18
|
+
|
|
17
19
|
class AvatarFoundation extends _foundation.default {
|
|
18
20
|
constructor(adapter) {
|
|
19
21
|
super((0, _assign.default)({}, adapter));
|
|
22
|
+
|
|
23
|
+
this.handleFocusVisible = event => {
|
|
24
|
+
const {
|
|
25
|
+
target
|
|
26
|
+
} = event;
|
|
27
|
+
|
|
28
|
+
try {
|
|
29
|
+
if (target.matches(':focus-visible')) {
|
|
30
|
+
this._adapter.setFocusVisible(true);
|
|
31
|
+
}
|
|
32
|
+
} catch (error) {
|
|
33
|
+
(0, _warning.default)(true, 'Warning: [Semi Avatar] The current browser does not support the focus-visible');
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
this.handleBlur = () => {
|
|
38
|
+
this._adapter.setFocusVisible(false);
|
|
39
|
+
};
|
|
20
40
|
}
|
|
21
41
|
|
|
22
42
|
init() {} // eslint-disable-line
|
|
@@ -2,6 +2,7 @@ $z-avatar-default: 100; // 头像 z-index
|
|
|
2
2
|
// color
|
|
3
3
|
$color-avatar_default-border-default: var(--semi-color-bg-1); // 头像描边颜色
|
|
4
4
|
$color-avatar_more_default-bg-default: rgba(var(--semi-grey-5), 1); // 「更多」描边颜色
|
|
5
|
+
$color-avatar-outline-focus: var(--semi-color-primary-light-active); // 头像聚焦轮廓颜色
|
|
5
6
|
|
|
6
7
|
|
|
7
8
|
$width-avatar_extra_extra_small: 20px; // 头像尺寸 - 极小
|
|
@@ -43,3 +44,5 @@ $spacing-avatar_extra_small-marginLeft: -10px; // 头像左侧外边距 - 超小
|
|
|
43
44
|
|
|
44
45
|
$width-avatar_extra_extra_small-border: 1px; // 头像描边尺寸 - 极小
|
|
45
46
|
$spacing-avatar_extra_extra_small-marginLeft: -4px; // 头像左侧外边距 - 极小
|
|
47
|
+
|
|
48
|
+
$width-avatar-outline: 2px; //头像聚焦轮廓宽度
|
|
@@ -27,6 +27,8 @@ class BaseFoundation {
|
|
|
27
27
|
}
|
|
28
28
|
/** @return enum{css className} */
|
|
29
29
|
|
|
30
|
+
/* istanbul ignore next */
|
|
31
|
+
|
|
30
32
|
|
|
31
33
|
static get cssClasses() {
|
|
32
34
|
// Classes extending Foundation should implement this method to return an object which exports every
|
|
@@ -35,6 +37,8 @@ class BaseFoundation {
|
|
|
35
37
|
}
|
|
36
38
|
/** @return enum{strings} */
|
|
37
39
|
|
|
40
|
+
/* istanbul ignore next */
|
|
41
|
+
|
|
38
42
|
|
|
39
43
|
static get strings() {
|
|
40
44
|
// Classes extending Foundation should implement this method to return an object which exports all
|
|
@@ -43,6 +47,8 @@ class BaseFoundation {
|
|
|
43
47
|
}
|
|
44
48
|
/** @return enum{numbers} */
|
|
45
49
|
|
|
50
|
+
/* istanbul ignore next */
|
|
51
|
+
|
|
46
52
|
|
|
47
53
|
static get numbers() {
|
|
48
54
|
// Classes extending Foundation should implement this method to return an object which exports all
|
|
@@ -89,10 +95,14 @@ class BaseFoundation {
|
|
|
89
95
|
getContext(key) {
|
|
90
96
|
return this._adapter.getContext(key);
|
|
91
97
|
}
|
|
98
|
+
/* istanbul ignore next */
|
|
99
|
+
|
|
92
100
|
|
|
93
101
|
getContexts() {
|
|
94
102
|
return this._adapter.getContexts();
|
|
95
103
|
}
|
|
104
|
+
/* istanbul ignore next */
|
|
105
|
+
|
|
96
106
|
|
|
97
107
|
getCaches() {
|
|
98
108
|
return this._adapter.getCaches();
|
|
@@ -129,6 +139,8 @@ class BaseFoundation {
|
|
|
129
139
|
|
|
130
140
|
destroy() {// Subclasses should override this method to perform de-initialization routines (de-registering events, etc.)
|
|
131
141
|
}
|
|
142
|
+
/* istanbul ignore next */
|
|
143
|
+
|
|
132
144
|
|
|
133
145
|
log(text) {
|
|
134
146
|
for (var _len = arguments.length, rest = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
@@ -88,6 +88,6 @@ export declare const collectDailyEvents: (events: ParsedRangeEvent[][]) => Parse
|
|
|
88
88
|
export declare const renderDailyEvent: (event: EventObject) => {
|
|
89
89
|
startPos: number;
|
|
90
90
|
endPos: number;
|
|
91
|
-
children:
|
|
91
|
+
children: any;
|
|
92
92
|
allDay: boolean;
|
|
93
93
|
};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import BaseFoundation, { DefaultAdapter } from '../base/foundation';
|
|
3
2
|
import { Locale } from 'date-fns';
|
|
4
3
|
import { DateObj } from './eventUtil';
|
|
@@ -8,7 +7,7 @@ export interface EventObject {
|
|
|
8
7
|
allDay?: boolean;
|
|
9
8
|
start?: Date;
|
|
10
9
|
end?: Date;
|
|
11
|
-
children?:
|
|
10
|
+
children?: any;
|
|
12
11
|
}
|
|
13
12
|
export interface ParsedEventsWithArray {
|
|
14
13
|
day: Array<any>;
|
|
@@ -29,6 +29,11 @@
|
|
|
29
29
|
min-height: 40px;
|
|
30
30
|
line-height: 40px;
|
|
31
31
|
}
|
|
32
|
+
.semi-cascader-large .semi-cascader-selection {
|
|
33
|
+
font-size: 16px;
|
|
34
|
+
line-height: 22px;
|
|
35
|
+
font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
|
36
|
+
}
|
|
32
37
|
.semi-cascader-focus {
|
|
33
38
|
border: 1px solid var(--semi-color-focus-border);
|
|
34
39
|
outline: 0;
|
|
@@ -205,17 +205,6 @@ export default class CascaderFoundation extends BaseFoundation<CascaderAdapter,
|
|
|
205
205
|
handleSingleSelect(e: any, item: BasicEntity | BasicData): void;
|
|
206
206
|
_handleMultipleSelect(item: BasicEntity | BasicData): void;
|
|
207
207
|
calcNonDisabledCheckedKeys(eventKey: string, targetStatus: boolean): {
|
|
208
|
-
/**
|
|
209
|
-
* The typical scenario is: suppose we select the 0-0 node, at this time
|
|
210
|
-
* selectedKeys=Set('0-0'), the input box will display a 0-0 label. When
|
|
211
|
-
* treeData is updated, assuming 0-0 does not exist in treeData at this
|
|
212
|
-
* time, then selectedKeys=Set('not-exist-0-0'), at this time the input
|
|
213
|
-
* box displays 0-0, which means not-exist -After the content. When treeData
|
|
214
|
-
* is updated again, assuming that 0-0 exists in treeData at this time,
|
|
215
|
-
* then selectedKeys=Set('0-0'), and the input box displays a label of
|
|
216
|
-
* 0-0 at this time. The operation done here is for the 0-0 label to be
|
|
217
|
-
* displayed normally after the second update in the example.
|
|
218
|
-
*/
|
|
219
208
|
checkedKeys: Set<string>;
|
|
220
209
|
halfCheckedKeys: Set<any>;
|
|
221
210
|
};
|
|
@@ -570,6 +570,8 @@ class CascaderFoundation extends _foundation.default {
|
|
|
570
570
|
* A11y: simulate selection click
|
|
571
571
|
*/
|
|
572
572
|
|
|
573
|
+
/* istanbul ignore next */
|
|
574
|
+
|
|
573
575
|
|
|
574
576
|
handleSelectionEnterPress(keyboardEvent) {
|
|
575
577
|
if ((0, _isEnterPress.default)(keyboardEvent)) {
|
|
@@ -1002,6 +1004,8 @@ class CascaderFoundation extends _foundation.default {
|
|
|
1002
1004
|
* A11y: simulate clear button click
|
|
1003
1005
|
*/
|
|
1004
1006
|
|
|
1007
|
+
/* istanbul ignore next */
|
|
1008
|
+
|
|
1005
1009
|
|
|
1006
1010
|
handleClearEnterPress(keyboardEvent) {
|
|
1007
1011
|
if ((0, _isEnterPress.default)(keyboardEvent)) {
|
|
@@ -1084,6 +1088,7 @@ class CascaderFoundation extends _foundation.default {
|
|
|
1084
1088
|
} = this.getProps();
|
|
1085
1089
|
|
|
1086
1090
|
if (disabled) {
|
|
1091
|
+
/* istanbul ignore next */
|
|
1087
1092
|
return;
|
|
1088
1093
|
}
|
|
1089
1094
|
|
|
@@ -18,6 +18,8 @@ var _foundation = _interopRequireDefault(require("../base/foundation"));
|
|
|
18
18
|
|
|
19
19
|
var _isEnterPress = _interopRequireDefault(require("../utils/isEnterPress"));
|
|
20
20
|
|
|
21
|
+
var _warning = _interopRequireDefault(require("../utils/warning"));
|
|
22
|
+
|
|
21
23
|
class CheckboxFoundation extends _foundation.default {
|
|
22
24
|
constructor(adapter) {
|
|
23
25
|
super((0, _assign.default)({}, adapter));
|
|
@@ -38,7 +40,7 @@ class CheckboxFoundation extends _foundation.default {
|
|
|
38
40
|
this._adapter.setFocusVisible(true);
|
|
39
41
|
}
|
|
40
42
|
} catch (error) {
|
|
41
|
-
|
|
43
|
+
(0, _warning.default)(true, 'Warning: [Semi Checkbox] The current browser does not support the focus-visible');
|
|
42
44
|
}
|
|
43
45
|
};
|
|
44
46
|
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import BaseFoundation, { DefaultAdapter } from '../base/foundation';
|
|
3
2
|
import { strings } from './constants';
|
|
4
3
|
import { Type, DateInputFoundationProps, InsetInputValue } from './inputFoundation';
|
|
@@ -95,12 +94,12 @@ export interface DatePickerFoundationProps extends ElementProps, RenderProps, Ev
|
|
|
95
94
|
disabledDate?: DisabledDateType;
|
|
96
95
|
disabledTime?: DisabledTimeType;
|
|
97
96
|
dropdownClassName?: string;
|
|
98
|
-
dropdownStyle?:
|
|
97
|
+
dropdownStyle?: Record<string, any>;
|
|
99
98
|
endDateOffset?: DateOffsetType;
|
|
100
99
|
format?: string;
|
|
101
100
|
getPopupContainer?: () => HTMLElement;
|
|
102
101
|
inputReadOnly?: boolean;
|
|
103
|
-
inputStyle?:
|
|
102
|
+
inputStyle?: Record<string, any>;
|
|
104
103
|
max?: number;
|
|
105
104
|
motion?: Motion;
|
|
106
105
|
multiple?: boolean;
|
|
@@ -116,7 +115,7 @@ export interface DatePickerFoundationProps extends ElementProps, RenderProps, Ev
|
|
|
116
115
|
spacing?: number;
|
|
117
116
|
startDateOffset?: DateOffsetType;
|
|
118
117
|
stopPropagation?: boolean | string;
|
|
119
|
-
style?:
|
|
118
|
+
style?: Record<string, any>;
|
|
120
119
|
timePickerOpts?: any;
|
|
121
120
|
timeZone?: string | number;
|
|
122
121
|
type?: Type;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import BaseFoundation, { DefaultAdapter } from '../base/foundation';
|
|
3
2
|
import { BaseValueType, ValidateStatus, ValueType } from './foundation';
|
|
4
3
|
import { strings } from './constants';
|
|
@@ -27,7 +26,7 @@ export interface DateInputFoundationProps extends DateInputElementProps, DateInp
|
|
|
27
26
|
type?: Type;
|
|
28
27
|
showClear?: boolean;
|
|
29
28
|
format?: string;
|
|
30
|
-
inputStyle?:
|
|
29
|
+
inputStyle?: Record<string, any>;
|
|
31
30
|
inputReadOnly?: boolean;
|
|
32
31
|
validateStatus?: ValidateStatus;
|
|
33
32
|
prefixCls?: string;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import BaseFoundation, { DefaultAdapter } from '../base/foundation';
|
|
3
2
|
import { strings } from './constants';
|
|
4
3
|
import { WeekStartNumber } from './_utils/getMonthTable';
|
|
@@ -7,10 +6,10 @@ import { MonthDayInfo } from './monthFoundation';
|
|
|
7
6
|
import { ArrayElement } from '../utils/type';
|
|
8
7
|
declare type Type = ArrayElement<typeof strings.TYPE_SET>;
|
|
9
8
|
interface MonthsGridElementProps {
|
|
10
|
-
navPrev?:
|
|
11
|
-
navNext?:
|
|
12
|
-
renderDate?: () =>
|
|
13
|
-
renderFullDate?: () =>
|
|
9
|
+
navPrev?: any;
|
|
10
|
+
navNext?: any;
|
|
11
|
+
renderDate?: () => any;
|
|
12
|
+
renderFullDate?: () => any;
|
|
14
13
|
}
|
|
15
14
|
export declare type PanelType = 'left' | 'right';
|
|
16
15
|
export declare type YearMonthChangeType = 'prevMonth' | 'nextMonth' | 'prevYear' | 'nextYear';
|
package/lib/cjs/form/utils.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import AsyncValidator from 'async-validator';
|
|
3
2
|
import { ComponentProps, WithFieldOption } from './interface';
|
|
4
|
-
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* @param WrappedComponent React.ComponentType | any
|
|
6
|
+
*/
|
|
7
|
+
export declare function getDisplayName(WrappedComponent: any): string;
|
|
5
8
|
export declare function generateValidatesFromRules(field: string, rules?: any[]): AsyncValidator;
|
|
6
9
|
export declare function isRequired(rules?: any[] | Record<string, any>): boolean;
|
|
7
10
|
export declare function isValid(errors: any): boolean;
|
package/lib/cjs/form/utils.js
CHANGED
|
@@ -48,6 +48,10 @@ var __rest = void 0 && (void 0).__rest || function (s, e) {
|
|
|
48
48
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
49
49
|
|
|
50
50
|
|
|
51
|
+
/**
|
|
52
|
+
*
|
|
53
|
+
* @param WrappedComponent React.ComponentType | any
|
|
54
|
+
*/
|
|
51
55
|
function getDisplayName(WrappedComponent) {
|
|
52
56
|
const originName = WrappedComponent.displayName || WrappedComponent.name;
|
|
53
57
|
return originName ? "SemiField".concat(originName) : 'SemiField';
|
|
@@ -75,10 +75,6 @@ declare class InputFoundation extends BaseFoundation<InputAdapter> {
|
|
|
75
75
|
* @param {Event} e
|
|
76
76
|
*/
|
|
77
77
|
handlePreventMouseDown(e: any): void;
|
|
78
|
-
/**
|
|
79
|
-
* A11y: simulate clear button click
|
|
80
|
-
*/
|
|
81
|
-
handleClearEnterPress(e: any): void;
|
|
82
78
|
/**
|
|
83
79
|
* A11y: simulate password button click
|
|
84
80
|
*/
|
|
@@ -14,6 +14,8 @@ var _assign = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-sta
|
|
|
14
14
|
|
|
15
15
|
var _slice = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/slice"));
|
|
16
16
|
|
|
17
|
+
var _includes = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/includes"));
|
|
18
|
+
|
|
17
19
|
var _isFunction2 = _interopRequireDefault(require("lodash/isFunction"));
|
|
18
20
|
|
|
19
21
|
var _isString2 = _interopRequireDefault(require("lodash/isString"));
|
|
@@ -28,8 +30,6 @@ var _foundation = _interopRequireDefault(require("../base/foundation"));
|
|
|
28
30
|
|
|
29
31
|
var _constants = require("./constants");
|
|
30
32
|
|
|
31
|
-
var _isEnterPress = _interopRequireDefault(require("../utils/isEnterPress"));
|
|
32
|
-
|
|
33
33
|
var _keyCode = require("./../utils/keyCode");
|
|
34
34
|
|
|
35
35
|
class InputFoundation extends _foundation.default {
|
|
@@ -374,23 +374,17 @@ class InputFoundation extends _foundation.default {
|
|
|
374
374
|
e.preventDefault();
|
|
375
375
|
}
|
|
376
376
|
}
|
|
377
|
-
/**
|
|
378
|
-
* A11y: simulate clear button click
|
|
379
|
-
*/
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
handleClearEnterPress(e) {
|
|
383
|
-
if ((0, _isEnterPress.default)(e)) {
|
|
384
|
-
this.handleClear(e);
|
|
385
|
-
}
|
|
386
|
-
}
|
|
387
377
|
/**
|
|
388
378
|
* A11y: simulate password button click
|
|
389
379
|
*/
|
|
390
380
|
|
|
391
381
|
|
|
392
382
|
handleModeEnterPress(e) {
|
|
393
|
-
|
|
383
|
+
var _context;
|
|
384
|
+
|
|
385
|
+
// trigger by Enter or Space key
|
|
386
|
+
if ((0, _includes.default)(_context = ['Enter', ' ']).call(_context, e === null || e === void 0 ? void 0 : e.key)) {
|
|
387
|
+
this.handlePreventMouseDown(e);
|
|
394
388
|
this.handleClickEye(e);
|
|
395
389
|
}
|
|
396
390
|
}
|
package/lib/cjs/input/input.css
CHANGED
|
@@ -138,6 +138,12 @@
|
|
|
138
138
|
.semi-input-wrapper .semi-input-modebtn:hover .semi-icon {
|
|
139
139
|
color: var(--semi-color-primary-hover);
|
|
140
140
|
}
|
|
141
|
+
.semi-input-wrapper .semi-input-clearbtn:focus-visible,
|
|
142
|
+
.semi-input-wrapper .semi-input-modebtn:focus-visible {
|
|
143
|
+
border-radius: var(--semi-border-radius-small);
|
|
144
|
+
outline: 2px solid var(--semi-color-primary-light-active);
|
|
145
|
+
outline-offset: -1px;
|
|
146
|
+
}
|
|
141
147
|
.semi-input-wrapper__with-suffix-icon.semi-input-wrapper-clearable:not(.semi-input-wrapper__with-suffix-hidden) .semi-input-clearbtn {
|
|
142
148
|
min-width: 24px;
|
|
143
149
|
justify-content: flex-end;
|
package/lib/cjs/input/input.scss
CHANGED
|
@@ -173,6 +173,12 @@ $module: #{$prefix}-input;
|
|
|
173
173
|
color: $color-input-icon-hover;
|
|
174
174
|
}
|
|
175
175
|
}
|
|
176
|
+
|
|
177
|
+
&:focus-visible {
|
|
178
|
+
border-radius: $radius-input_wrapper;
|
|
179
|
+
outline: $width-input_icon-outline solid $color-input_icon-outline;
|
|
180
|
+
outline-offset: $width-input_icon-outlineOffset;
|
|
181
|
+
}
|
|
176
182
|
}
|
|
177
183
|
|
|
178
184
|
&__with-suffix-icon.#{$module}-wrapper-clearable:not(.#{$module}-wrapper__with-suffix-hidden) {
|
|
@@ -60,8 +60,4 @@ export default class TextAreaFoundation extends BaseFoundation<TextAreaAdapter>
|
|
|
60
60
|
handleMouseLeave(e: any): void;
|
|
61
61
|
isAllowClear(): boolean;
|
|
62
62
|
handleClear(e: any): void;
|
|
63
|
-
/**
|
|
64
|
-
* A11y: simulate clear button click
|
|
65
|
-
*/
|
|
66
|
-
handleClearEnterPress(e: any): void;
|
|
67
63
|
}
|
|
@@ -28,8 +28,6 @@ var _calculateNodeHeight = _interopRequireDefault(require("./util/calculateNodeH
|
|
|
28
28
|
|
|
29
29
|
var _getSizingData = _interopRequireDefault(require("./util/getSizingData"));
|
|
30
30
|
|
|
31
|
-
var _isEnterPress = _interopRequireDefault(require("../utils/isEnterPress"));
|
|
32
|
-
|
|
33
31
|
class TextAreaFoundation extends _foundation.default {
|
|
34
32
|
constructor(adapter) {
|
|
35
33
|
super((0, _assign.default)((0, _assign.default)({}, TextAreaFoundation.textAreaDefaultAdapter), adapter));
|
|
@@ -295,16 +293,6 @@ class TextAreaFoundation extends _foundation.default {
|
|
|
295
293
|
|
|
296
294
|
this.stopPropagation(e);
|
|
297
295
|
}
|
|
298
|
-
/**
|
|
299
|
-
* A11y: simulate clear button click
|
|
300
|
-
*/
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
handleClearEnterPress(e) {
|
|
304
|
-
if ((0, _isEnterPress.default)(e)) {
|
|
305
|
-
this.handleClear(e);
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
296
|
|
|
309
297
|
}
|
|
310
298
|
|
|
@@ -11,6 +11,7 @@ $color-input_default-border-active: $color-input_default-bg-active; // 输入框
|
|
|
11
11
|
|
|
12
12
|
$color-input_default-bg-focus: var(--semi-color-fill-0); // 输入框背景颜色 - 选中
|
|
13
13
|
$color-input_default-border-focus: var(--semi-color-focus-border); // 输入框描边颜色 - 选中
|
|
14
|
+
$color-input_icon-outline: var(--semi-color-primary-light-active); // 输入框 icon outline 颜色
|
|
14
15
|
|
|
15
16
|
// error
|
|
16
17
|
$color-input_danger-bg-default: var(--semi-color-danger-light-default); // 错误输入框背景颜色 - 默认
|
|
@@ -75,6 +76,8 @@ $width-input_prepend-border: $border-thickness-control; // 前置标签描边宽
|
|
|
75
76
|
$width-input_group_pseudo-border: $border-thickness-control;
|
|
76
77
|
$width-input_wrapper-border: $border-thickness-control-focus; // 输入框描边宽度
|
|
77
78
|
$width-input_wrapper_focus-border: $border-thickness-control-focus; // 输入框描边宽度 - 选中态
|
|
79
|
+
$width-input_icon-outline: 2px; // 输入框 icon outline 宽度
|
|
80
|
+
$width-input_icon-outlineOffset: -1px; // 输入框 icon outline-offset 宽度
|
|
78
81
|
|
|
79
82
|
$radius-input_wrapper: var(--semi-border-radius-small); // 输入框圆角大小
|
|
80
83
|
$spacing-input_icon-marginLeft: -$spacing-base-tight; // 输入框图标左侧内边距
|
|
@@ -6,6 +6,7 @@ export interface OverflowListAdapter extends DefaultAdapter {
|
|
|
6
6
|
}
|
|
7
7
|
declare class OverflowListFoundation extends BaseFoundation<OverflowListAdapter> {
|
|
8
8
|
constructor(adapter: OverflowListAdapter);
|
|
9
|
+
previousY: any;
|
|
9
10
|
isScrollMode: () => boolean;
|
|
10
11
|
getOverflowItem(): Array<Array<Record<string, any>>>;
|
|
11
12
|
handleIntersect(entries: Array<IntersectionObserverEntry>): void;
|
|
@@ -22,6 +22,8 @@ var _slice = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stab
|
|
|
22
22
|
|
|
23
23
|
var _forEach = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/for-each"));
|
|
24
24
|
|
|
25
|
+
var _values = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/values"));
|
|
26
|
+
|
|
25
27
|
var _cloneDeep2 = _interopRequireDefault(require("lodash/cloneDeep"));
|
|
26
28
|
|
|
27
29
|
var _get2 = _interopRequireDefault(require("lodash/get"));
|
|
@@ -36,6 +38,7 @@ const OverflowDirection = _constants.strings.OVERFLOW_DIR;
|
|
|
36
38
|
class OverflowListFoundation extends _foundation.default {
|
|
37
39
|
constructor(adapter) {
|
|
38
40
|
super((0, _assign.default)({}, adapter));
|
|
41
|
+
this.previousY = undefined;
|
|
39
42
|
|
|
40
43
|
this.isScrollMode = () => {
|
|
41
44
|
const {
|
|
@@ -81,6 +84,28 @@ class OverflowListFoundation extends _foundation.default {
|
|
|
81
84
|
res[itemKey] = entry;
|
|
82
85
|
visibleState.set(itemKey, visible);
|
|
83
86
|
});
|
|
87
|
+
let someItemVisible = false;
|
|
88
|
+
|
|
89
|
+
for (const value of (0, _values.default)(visibleState).call(visibleState)) {
|
|
90
|
+
if (value) {
|
|
91
|
+
someItemVisible = true;
|
|
92
|
+
break;
|
|
93
|
+
}
|
|
94
|
+
} // Any item is visible, indicating that the List is visible
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
const wholeListVisible = someItemVisible; // If scrolling in the vertical direction makes the List invisible, no processing is required.
|
|
98
|
+
// If this.previousY is undefined, it means that the List is mounted for the first time and will not be processed.
|
|
99
|
+
|
|
100
|
+
const [entry1] = entries;
|
|
101
|
+
const currentY = entry1.boundingClientRect.y;
|
|
102
|
+
|
|
103
|
+
if (!wholeListVisible && this.previousY !== undefined && currentY !== this.previousY) {
|
|
104
|
+
this.previousY = currentY;
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
this.previousY = currentY;
|
|
84
109
|
|
|
85
110
|
this._adapter.updateVisibleState(visibleState);
|
|
86
111
|
|
package/lib/cjs/radio/radio.css
CHANGED
|
@@ -280,6 +280,12 @@
|
|
|
280
280
|
padding-left: 24px;
|
|
281
281
|
box-sizing: border-box;
|
|
282
282
|
}
|
|
283
|
+
.semi-radio-focus {
|
|
284
|
+
outline: 2px solid var(--semi-color-primary-light-active);
|
|
285
|
+
}
|
|
286
|
+
.semi-radio-focus-border {
|
|
287
|
+
border: solid 1px var(--semi-color-focus-border);
|
|
288
|
+
}
|
|
283
289
|
|
|
284
290
|
.semi-radioGroup {
|
|
285
291
|
font-size: 14px;
|
package/lib/cjs/radio/radio.scss
CHANGED
|
@@ -379,6 +379,14 @@ $inner-width: $width-icon-medium;
|
|
|
379
379
|
padding-left: $spacing-radio_extra-paddingLeft;
|
|
380
380
|
box-sizing: border-box;
|
|
381
381
|
}
|
|
382
|
+
|
|
383
|
+
&-focus {
|
|
384
|
+
outline: $width-radio-outline solid $color-radio_primary-outline-focus;
|
|
385
|
+
|
|
386
|
+
&-border {
|
|
387
|
+
border: solid $width-radio_hover-border $color-radio_default-border-hover;
|
|
388
|
+
}
|
|
389
|
+
}
|
|
382
390
|
}
|
|
383
391
|
|
|
384
392
|
.#{$module}Group {
|
|
@@ -3,8 +3,11 @@ export interface RadioAdapter extends DefaultAdapter {
|
|
|
3
3
|
setHover: (hover: boolean) => void;
|
|
4
4
|
setAddonId: () => void;
|
|
5
5
|
setExtraId: () => void;
|
|
6
|
+
setFocusVisible: (focusVisible: boolean) => void;
|
|
6
7
|
}
|
|
7
8
|
export default class RadioFoundation extends BaseFoundation<RadioAdapter> {
|
|
8
9
|
init(): void;
|
|
9
10
|
setHover(hover: boolean): void;
|
|
11
|
+
handleFocusVisible: (event: any) => void;
|
|
12
|
+
handleBlur: () => void;
|
|
10
13
|
}
|
|
@@ -12,7 +12,31 @@ exports.default = void 0;
|
|
|
12
12
|
|
|
13
13
|
var _foundation = _interopRequireDefault(require("../base/foundation"));
|
|
14
14
|
|
|
15
|
+
var _warning = _interopRequireDefault(require("../utils/warning"));
|
|
16
|
+
|
|
15
17
|
class RadioFoundation extends _foundation.default {
|
|
18
|
+
constructor() {
|
|
19
|
+
super(...arguments);
|
|
20
|
+
|
|
21
|
+
this.handleFocusVisible = event => {
|
|
22
|
+
const {
|
|
23
|
+
target
|
|
24
|
+
} = event;
|
|
25
|
+
|
|
26
|
+
try {
|
|
27
|
+
if (target.matches(':focus-visible')) {
|
|
28
|
+
this._adapter.setFocusVisible(true);
|
|
29
|
+
}
|
|
30
|
+
} catch (error) {
|
|
31
|
+
(0, _warning.default)(true, 'Warning: [Semi Radio] The current browser does not support the focus-visible');
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
this.handleBlur = () => {
|
|
36
|
+
this._adapter.setFocusVisible(false);
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
|
|
16
40
|
init() {
|
|
17
41
|
const {
|
|
18
42
|
children,
|
|
@@ -48,6 +48,8 @@ $color-radio_card-bg-hover: var(--semi-color-white); // 单选圆点颜色
|
|
|
48
48
|
$color-radio_card-bg-active: var(--semi-color-white); // 单选圆点颜色 - 按下态
|
|
49
49
|
$color-radio_card-bg-default: var(--semi-color-white); // 单选圆点颜色 - 悬浮态
|
|
50
50
|
|
|
51
|
+
$color-radio_primary-outline-focus: var(--semi-color-primary-light-active); // 轮廓颜色 - 按键聚焦
|
|
52
|
+
|
|
51
53
|
$radius-radio_cardRadioGroup: var(--semi-border-radius-small); // 卡片式单选圆角大小
|
|
52
54
|
$radius-radio_addon_buttonRadio: var(--semi-border-radius-small); // 按钮式单选圆点圆角大小
|
|
53
55
|
$radius-radio_buttonRadio: var(--semi-border-radius-small); // 按钮式单选圆角大小
|
|
@@ -58,6 +60,8 @@ $width-radio_hover-border: $border-thickness-control; // 描边宽度 - 悬浮
|
|
|
58
60
|
$width-radio_disabled-border: $border-thickness-control; // 描边宽度 - 禁用态
|
|
59
61
|
$width-radio_innder-border: $border-thickness-control; // 描边宽度 - 禁用态
|
|
60
62
|
|
|
63
|
+
$width-radio-outline: 2px; // 单选框轮廓宽度
|
|
64
|
+
|
|
61
65
|
$height-radio_inner_min: 20px; // 单选按钮高度
|
|
62
66
|
$width-radio_inner: $width-icon-medium; // 单选按钮宽度
|
|
63
67
|
$spacing-radio_addon-paddingLeft: $spacing-tight; //单选标题到单选按钮左侧边距
|
|
@@ -109,6 +109,11 @@
|
|
|
109
109
|
min-height: 40px;
|
|
110
110
|
line-height: 40px;
|
|
111
111
|
}
|
|
112
|
+
.semi-select-large .semi-select-selection {
|
|
113
|
+
font-size: 16px;
|
|
114
|
+
line-height: 22px;
|
|
115
|
+
font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
|
|
116
|
+
}
|
|
112
117
|
.semi-select-open, .semi-select-focus {
|
|
113
118
|
border: 1px solid var(--semi-color-focus-border);
|
|
114
119
|
outline: 0;
|
|
@@ -14,6 +14,8 @@ var _assign = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-sta
|
|
|
14
14
|
|
|
15
15
|
var _foundation = _interopRequireDefault(require("../base/foundation"));
|
|
16
16
|
|
|
17
|
+
var _warning = _interopRequireDefault(require("../utils/warning"));
|
|
18
|
+
|
|
17
19
|
class SwitchFoundation extends _foundation.default {
|
|
18
20
|
constructor(adapter) {
|
|
19
21
|
super((0, _assign.default)({}, adapter));
|
|
@@ -28,7 +30,7 @@ class SwitchFoundation extends _foundation.default {
|
|
|
28
30
|
this._adapter.setFocusVisible(true);
|
|
29
31
|
}
|
|
30
32
|
} catch (error) {
|
|
31
|
-
|
|
33
|
+
(0, _warning.default)(true, 'Warning: [Semi Switch] The current browser does not support the focus-visible');
|
|
32
34
|
}
|
|
33
35
|
};
|
|
34
36
|
|