@douyinfe/semi-foundation 2.5.0 → 2.6.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.
Files changed (65) hide show
  1. package/button/button.scss +11 -0
  2. package/button/constants.ts +2 -2
  3. package/button/variables.scss +4 -0
  4. package/cascader/cascader.scss +2 -2
  5. package/cascader/foundation.ts +19 -0
  6. package/cascader/variables.scss +2 -1
  7. package/datePicker/foundation.ts +4 -4
  8. package/datePicker/inputFoundation.ts +0 -1
  9. package/datePicker/monthFoundation.ts +1 -0
  10. package/form/form.scss +7 -1
  11. package/form/foundation.ts +40 -36
  12. package/form/interface.ts +1 -1
  13. package/input/input.scss +2 -1
  14. package/lib/cjs/button/button.css +9 -0
  15. package/lib/cjs/button/button.scss +11 -0
  16. package/lib/cjs/button/constants.d.ts +9 -1
  17. package/lib/cjs/button/variables.scss +4 -0
  18. package/lib/cjs/cascader/cascader.css +1 -1
  19. package/lib/cjs/cascader/cascader.scss +2 -2
  20. package/lib/cjs/cascader/foundation.d.ts +19 -0
  21. package/lib/cjs/cascader/foundation.js +22 -0
  22. package/lib/cjs/cascader/variables.scss +2 -1
  23. package/lib/cjs/datePicker/foundation.d.ts +4 -4
  24. package/lib/cjs/datePicker/inputFoundation.d.ts +0 -1
  25. package/lib/cjs/datePicker/monthFoundation.d.ts +1 -0
  26. package/lib/cjs/form/form.css +4 -0
  27. package/lib/cjs/form/form.scss +7 -1
  28. package/lib/cjs/form/foundation.d.ts +6 -6
  29. package/lib/cjs/form/foundation.js +51 -52
  30. package/lib/cjs/form/interface.d.ts +1 -1
  31. package/lib/cjs/input/input.css +1 -0
  32. package/lib/cjs/input/input.scss +2 -1
  33. package/lib/cjs/table/table.css +1 -2
  34. package/lib/cjs/table/table.scss +4 -5
  35. package/lib/cjs/table/variables.scss +1 -0
  36. package/lib/cjs/tag/tag.css +1 -0
  37. package/lib/cjs/tag/tag.scss +1 -0
  38. package/lib/es/button/button.css +9 -0
  39. package/lib/es/button/button.scss +11 -0
  40. package/lib/es/button/constants.d.ts +9 -1
  41. package/lib/es/button/variables.scss +4 -0
  42. package/lib/es/cascader/cascader.css +1 -1
  43. package/lib/es/cascader/cascader.scss +2 -2
  44. package/lib/es/cascader/foundation.d.ts +19 -0
  45. package/lib/es/cascader/foundation.js +22 -1
  46. package/lib/es/cascader/variables.scss +2 -1
  47. package/lib/es/datePicker/foundation.d.ts +4 -4
  48. package/lib/es/datePicker/inputFoundation.d.ts +0 -1
  49. package/lib/es/datePicker/monthFoundation.d.ts +1 -0
  50. package/lib/es/form/form.css +4 -0
  51. package/lib/es/form/form.scss +7 -1
  52. package/lib/es/form/foundation.d.ts +6 -6
  53. package/lib/es/form/foundation.js +51 -52
  54. package/lib/es/form/interface.d.ts +1 -1
  55. package/lib/es/input/input.css +1 -0
  56. package/lib/es/input/input.scss +2 -1
  57. package/lib/es/table/table.css +1 -2
  58. package/lib/es/table/table.scss +4 -5
  59. package/lib/es/table/variables.scss +1 -0
  60. package/lib/es/tag/tag.css +1 -0
  61. package/lib/es/tag/tag.scss +1 -0
  62. package/package.json +3 -3
  63. package/table/table.scss +4 -5
  64. package/table/variables.scss +1 -0
  65. package/tag/tag.scss +1 -0
@@ -23,6 +23,11 @@ $module: #{$prefix}-button;
23
23
  outline: none;
24
24
  vertical-align: middle;
25
25
  white-space: nowrap;
26
+
27
+ &:focus {
28
+ outline: $width-button-outline solid $color-button_primary-outline-focus;
29
+ }
30
+
26
31
  &-danger {
27
32
  background-color: $color-button_danger-bg-default;
28
33
  color: $color-button_danger-text-default;
@@ -36,6 +41,9 @@ $module: #{$prefix}-button;
36
41
  &.#{$module}-borderless {
37
42
  color: $color-button_danger-bg-default;
38
43
  }
44
+ &:not(.#{$module}-borderless):not(.#{$module}-light):focus {
45
+ outline-color: $color-button_danger-outline-focus;
46
+ }
39
47
  }
40
48
  &-warning {
41
49
  background-color: $color-button_warning-bg-default;
@@ -50,6 +58,9 @@ $module: #{$prefix}-button;
50
58
  &.#{$module}-borderless {
51
59
  color: $color-button_warning-bg-default;
52
60
  }
61
+ &:not(.#{$module}-borderless):not(.#{$module}-light):focus {
62
+ outline-color: $color-button_warning-outline-focus;
63
+ }
53
64
  }
54
65
  &-tertiary {
55
66
  background-color: $color-button_tertiary-bg-default;
@@ -4,7 +4,7 @@ const cssClasses = {
4
4
  PREFIX: `${BASE_CLASS_PREFIX}-button`,
5
5
  };
6
6
 
7
- const strings: Record<string, any> = {
7
+ const strings = {
8
8
  sizes: ['default', 'small', 'large'],
9
9
  iconPositions: ['left', 'right'],
10
10
  htmlTypes: ['button', 'reset', 'submit'],
@@ -12,7 +12,7 @@ const strings: Record<string, any> = {
12
12
  themes: ['solid', 'borderless', 'light'],
13
13
  DEFAULT_ICON_SIZE: 'default',
14
14
  DEFAULT_ICON_POSITION: 'left',
15
- };
15
+ } as const;
16
16
 
17
17
  const numbers = {};
18
18
 
@@ -10,6 +10,7 @@ $color-button_primary-text-hover: white; // 主要按钮文字颜色 - 悬浮
10
10
  $color-button_primary-bg-active: var(--semi-color-primary-active); // 主要按钮背景颜色 - 按下
11
11
  $color-button_primary-border-active: var(--semi-color-primary-active); // 主要按钮描边颜色 - 按下
12
12
  $color-button_primary-text-active: white; // 主要按钮文字颜色 - 按下
13
+ $color-button_primary-outline-focus: var(--semi-color-primary-light-active); // 主要按钮轮廓 - 聚焦
13
14
 
14
15
  // secondary
15
16
  $color-button_secondary-bg-default: var(--semi-color-secondary); // 次要按钮背景颜色
@@ -36,6 +37,7 @@ $color-button_danger-text-hover: white; // 危险按钮文字颜色 - 悬浮
36
37
  $color-button_danger-bg-active: var(--semi-color-danger-active); // 危险按钮背景颜色 - 按下
37
38
  $color-button_danger-border-active: var(--semi-color-danger-active); // 危险按钮描边颜色 - 按下
38
39
  $color-button_danger-text-active: white; // 危险按钮文字颜色 - 按下
40
+ $color-button_danger-outline-focus: var(--semi-color-danger-light-active); // 危险按钮轮廓 - 聚焦
39
41
 
40
42
  // warning
41
43
  $color-button_warning-bg-default: var(--semi-color-warning); // 警告按钮背景颜色
@@ -49,6 +51,7 @@ $color-button_warning-text-hover: white; // 警告按钮文字颜色 - 悬浮
49
51
  $color-button_warning-bg-active: var(--semi-color-warning-active); // 警告按钮背景颜色 - 按下
50
52
  $color-button_warning-border-active: var(--semi-color-warning-active); // 警告按钮描边颜色 - 按下
51
53
  $color-button_warning-text-active: white; // 警告按钮文字颜色 - 按下
54
+ $color-button_warning-outline-focus: var(--semi-color-warning-light-active); // 警告按钮轮廓 - 聚焦
52
55
 
53
56
  // tertiary
54
57
  $color-button_tertiary-bg-default: var(--semi-color-tertiary); // 第三按钮背景颜色
@@ -134,3 +137,4 @@ $height-button_default: $height-control-default; // 按钮高度 - 默认
134
137
  $width-button-border: $border-thickness; // 按钮描边宽度
135
138
  $radius-button: var(--semi-border-radius-small); // 按钮圆角大小
136
139
  $radius-button_group: $radius-button; // 按钮组圆角大小
140
+ $width-button-outline: 2px; // 按钮轮廓宽度
@@ -111,7 +111,7 @@ $module: #{$prefix}-cascader;
111
111
  }
112
112
 
113
113
  &-tag {
114
- margin: $spacing-cascader_selection_tag-marginY $spacing-cascader_selection_tag-marginX;
114
+ margin: $spacing-cascader_selection_tag-marginY $spacing-cascader_selection_tag-marginRight $spacing-cascader_selection_tag-marginY $spacing-cascader_selection_tag-marginLeft;
115
115
 
116
116
  &:first-child {
117
117
  margin-left: 0;
@@ -120,7 +120,7 @@ $module: #{$prefix}-cascader;
120
120
  &-disabled.#{$prefix}-tag {
121
121
  color: $color-cascader_input_disabled-text-default;
122
122
  cursor: not-allowed;
123
-
123
+
124
124
  .#{$prefix}-tag-close {
125
125
  color: $color-cascader_input_disabled-text-default;
126
126
  cursor: not-allowed;
@@ -18,6 +18,7 @@ import {
18
18
  calcMergeType
19
19
  } from './util';
20
20
  import { strings } from './constants';
21
+ import isEnterPress from '../utils/isEnterPress';
21
22
 
22
23
  export interface BasicData {
23
24
  data: BasicCascaderData;
@@ -602,6 +603,15 @@ export default class CascaderFoundation extends BaseFoundation<CascaderAdapter,
602
603
  }
603
604
  }
604
605
 
606
+ /**
607
+ * A11y: simulate selection click
608
+ */
609
+ handleSelectionEnterPress(keyboardEvent: any) {
610
+ if (isEnterPress(keyboardEvent)) {
611
+ this.handleClick(keyboardEvent);
612
+ }
613
+ }
614
+
605
615
  toggleHoverState(bool: boolean) {
606
616
  this._adapter.toggleHovering(bool);
607
617
  }
@@ -911,6 +921,15 @@ export default class CascaderFoundation extends BaseFoundation<CascaderAdapter,
911
921
  this._adapter.rePositionDropdown();
912
922
  }
913
923
 
924
+ /**
925
+ * A11y: simulate clear button click
926
+ */
927
+ handleClearEnterPress(keyboardEvent: any) {
928
+ if (isEnterPress(keyboardEvent)) {
929
+ this.handleClear();
930
+ }
931
+ }
932
+
914
933
  getRenderData() {
915
934
  const { keyEntities, isSearching } = this.getStates();
916
935
  const isFilterable = this._isFilterable();
@@ -44,7 +44,8 @@ $spacing-cascader_selection-paddingLeft: 12px; // 级联选择触发器左侧内
44
44
  $spacing-cascader_selection-paddingRight: 12px; // 级联选择触发器右侧内边距
45
45
  $spacing-cascader_selection_multiple-paddingLeft: $spacing-extra-tight; // 级联选择触发器多选时左侧内边距
46
46
  $spacing-cascader_selection_multiple-paddingRight: $spacing-extra-tight; // 级联选择触发器多选时右侧内边距
47
- $spacing-cascader_selection_tag-marginX: $spacing-super-tight; // 级联选择触发器多选时标签的水平外边距
47
+ $spacing-cascader_selection_tag-marginLeft: $spacing-none; // 级联选择触发器多选时标签的水平左外边距
48
+ $spacing-cascader_selection_tag-marginRight: $spacing-super-tight; // 级联选择触发器多选时标签的水平右外边距
48
49
  $spacing-cascader_selection_tag-marginY: 1px; // 级联选择触发器多选时标签的垂直外边距
49
50
  $spacing-cascader_selection_tagInput-marginLeft: - $spacing-extra-tight; // 级联选择触发器多选搜索时 TagInput 的左外边距
50
51
  $spacing-cascader_selection_input-marginLeft: $spacing-extra-tight; // 级联选择触发器多选搜索时输入框的左外边距
@@ -163,8 +163,8 @@ export interface DatePickerFoundationState {
163
163
  panelShow: boolean;
164
164
  isRange: boolean;
165
165
  inputValue: string;
166
- value: ValueType;
167
- cachedSelectedValue: ValueType;
166
+ value: Date[];
167
+ cachedSelectedValue: Date[];
168
168
  prevTimeZone: string | number;
169
169
  motionEnd: boolean;
170
170
  rangeInputFocus: 'rangeStart' | 'rangeEnd' | boolean;
@@ -185,9 +185,9 @@ export interface DatePickerAdapter extends DefaultAdapter<DatePickerFoundationPr
185
185
  notifyConfirm: DatePickerFoundationProps['onConfirm'];
186
186
  notifyOpenChange: DatePickerFoundationProps['onOpenChange'];
187
187
  notifyPresetsClick: DatePickerFoundationProps['onPresetClick'];
188
- updateValue: (value: ValueType) => void;
188
+ updateValue: (value: Date[]) => void;
189
189
  updatePrevTimezone: (prevTimeZone: string | number) => void;
190
- updateCachedSelectedValue: (cachedSelectedValue: ValueType) => void;
190
+ updateCachedSelectedValue: (cachedSelectedValue: Date[]) => void;
191
191
  updateInputValue: (inputValue: string) => void;
192
192
  needConfirm: () => boolean;
193
193
  typeIsYearOrMonth: () => boolean;
@@ -32,7 +32,6 @@ export interface DateInputFoundationProps extends DateInputElementProps, DateInp
32
32
  value?: ValueType;
33
33
  disabled?: boolean;
34
34
  type?: Type;
35
- multiple?: boolean;
36
35
  showClear?: boolean;
37
36
  format?: string;
38
37
  inputStyle?: React.CSSProperties;
@@ -28,6 +28,7 @@ export interface MonthFoundationProps {
28
28
  focusRecordsRef: any;
29
29
  locale: any;
30
30
  localeCode: string;
31
+ multiple: boolean;
31
32
  }
32
33
 
33
34
  export type MonthDayInfo = {
package/form/form.scss CHANGED
@@ -8,6 +8,8 @@ $col: #{$form}-col;
8
8
 
9
9
  $checkboxGroup: #{$prefix}-checkboxGroup;
10
10
  $radioGroup: #{$prefix}-radioGroup;
11
+ $buttonRadioGroup: #{$prefix}-radioGroup-buttonRadio;
12
+
11
13
  $switch: #{$prefix}-switch;
12
14
  $rating: #{$prefix}-rating;
13
15
 
@@ -154,7 +156,6 @@ $rating: #{$prefix}-rating;
154
156
  padding-top: $spacing-form_label_posTop-paddingTop;
155
157
  padding-bottom: $spacing-form_label_posTop-paddingBottom;
156
158
  }
157
-
158
159
  }
159
160
 
160
161
  &[x-label-pos="left"] {
@@ -173,6 +174,11 @@ $rating: #{$prefix}-rating;
173
174
  padding-top: $spacing-form_label-paddingTop;
174
175
  padding-bottom: $spacing-form_label-paddingTop;
175
176
  }
177
+ // no need to adjust height for button radio, already 32px
178
+ .#{$buttonRadioGroup} {
179
+ padding-top: 0;
180
+ padding-bottom: 0;
181
+ }
176
182
  .#{$switch},
177
183
  .#{$rating} {
178
184
  vertical-align: middle;
@@ -410,7 +410,7 @@ export default class FormFoundation extends BaseFoundation<BaseFormAdapter> {
410
410
  }
411
411
 
412
412
  // update formState value
413
- updateStateValue(field: string, value: any, opts: CallOpts): void {
413
+ updateStateValue(field: string, value: any, opts: CallOpts, callback?: () => void): void {
414
414
  const notNotify = opts && opts.notNotify;
415
415
  const notUpdate = opts && opts.notUpdate;
416
416
  const fieldAllowEmpty = opts && opts.fieldAllowEmpty;
@@ -442,7 +442,7 @@ export default class FormFoundation extends BaseFoundation<BaseFormAdapter> {
442
442
  }
443
443
 
444
444
  if (!notUpdate) {
445
- this._adapter.forceUpdate();
445
+ this._adapter.forceUpdate(callback);
446
446
  }
447
447
  }
448
448
 
@@ -455,7 +455,7 @@ export default class FormFoundation extends BaseFoundation<BaseFormAdapter> {
455
455
  }
456
456
 
457
457
  // update formState touched
458
- updateStateTouched(field: string, isTouched: boolean, opts?: CallOpts): void {
458
+ updateStateTouched(field: string, isTouched: boolean, opts?: CallOpts, callback?: () => void): void {
459
459
  const notNotify = opts && opts.notNotify;
460
460
  const notUpdate = opts && opts.notUpdate;
461
461
  ObjectUtil.set(this.data.touched, field, isTouched);
@@ -464,7 +464,7 @@ export default class FormFoundation extends BaseFoundation<BaseFormAdapter> {
464
464
  this._adapter.notifyChange(this.data);
465
465
  }
466
466
  if (!notUpdate) {
467
- this._adapter.forceUpdate();
467
+ this._adapter.forceUpdate(callback);
468
468
  }
469
469
  }
470
470
 
@@ -477,7 +477,7 @@ export default class FormFoundation extends BaseFoundation<BaseFormAdapter> {
477
477
  }
478
478
 
479
479
  // update formState error
480
- updateStateError(field: string, error: any, opts: CallOpts): void {
480
+ updateStateError(field: string, error: any, opts: CallOpts, callback?: () => void): void {
481
481
  const notNotify = opts && opts.notNotify;
482
482
  const notUpdate = opts && opts.notUpdate;
483
483
  ObjectUtil.set(this.data.errors, field, error);
@@ -488,7 +488,7 @@ export default class FormFoundation extends BaseFoundation<BaseFormAdapter> {
488
488
  }
489
489
 
490
490
  if (!notUpdate) {
491
- this._adapter.forceUpdate();
491
+ this._adapter.forceUpdate(callback);
492
492
  }
493
493
  }
494
494
 
@@ -506,16 +506,18 @@ export default class FormFoundation extends BaseFoundation<BaseFormAdapter> {
506
506
  // At this time, first modify formState directly, then find out the subordinate fields and drive them to update
507
507
  // Eg: peoples: [0, 2, 3]. Each value of the peoples array corresponds to an Input Field
508
508
  // When the user directly calls formA pi.set Value ('peoples', [2,3])
509
- this.updateStateValue(field, newValue, opts);
510
- let nestedFields = this._getNestedField(field);
511
- if (nestedFields.size) {
512
- nestedFields.forEach(fieldStaff => {
513
- let fieldPath = fieldStaff.field;
514
- let newFieldVal = ObjectUtil.get(this.data.values, fieldPath);
515
- let nestedBatchUpdateOpts = { notNotify: true, notUpdate: true };
516
- fieldStaff.fieldApi.setValue(newFieldVal, nestedBatchUpdateOpts);
517
- });
518
- }
509
+ this.updateStateValue(field, newValue, opts, () => {
510
+ let nestedFields = this._getNestedField(field);
511
+ if (nestedFields.size) {
512
+ nestedFields.forEach(fieldStaff => {
513
+ let fieldPath = fieldStaff.field;
514
+ let newFieldVal = ObjectUtil.get(this.data.values, fieldPath);
515
+ let nestedBatchUpdateOpts = { notNotify: true, notUpdate: true };
516
+ fieldStaff.fieldApi.setValue(newFieldVal, nestedBatchUpdateOpts);
517
+ });
518
+ }
519
+ });
520
+
519
521
  // If the reset happens to be, then update the updateKey corresponding to ArrayField to render it again
520
522
  if (this.getArrayField(field)) {
521
523
  this.updateArrayField(field, { updateKey: new Date().valueOf() });
@@ -528,16 +530,17 @@ export default class FormFoundation extends BaseFoundation<BaseFormAdapter> {
528
530
  if (fieldApi) {
529
531
  fieldApi.setError(newError, opts);
530
532
  } else {
531
- this.updateStateError(field, newError, opts);
532
- let nestedFields = this._getNestedField(field);
533
- if (nestedFields.size) {
534
- nestedFields.forEach(fieldStaff => {
535
- let fieldPath = fieldStaff.field;
536
- let newFieldError = ObjectUtil.get(this.data.errors, fieldPath);
537
- let nestedBatchUpdateOpts = { notNotify: true, notUpdate: true };
538
- fieldStaff.fieldApi.setError(newFieldError, nestedBatchUpdateOpts);
539
- });
540
- }
533
+ this.updateStateError(field, newError, opts, () => {
534
+ let nestedFields = this._getNestedField(field);
535
+ if (nestedFields.size) {
536
+ nestedFields.forEach(fieldStaff => {
537
+ let fieldPath = fieldStaff.field;
538
+ let newFieldError = ObjectUtil.get(this.data.errors, fieldPath);
539
+ let nestedBatchUpdateOpts = { notNotify: true, notUpdate: true };
540
+ fieldStaff.fieldApi.setError(newFieldError, nestedBatchUpdateOpts);
541
+ });
542
+ }
543
+ });
541
544
  if (this.getArrayField(field)) {
542
545
  this.updateArrayField(field, { updateKey: new Date().valueOf() });
543
546
  }
@@ -549,16 +552,17 @@ export default class FormFoundation extends BaseFoundation<BaseFormAdapter> {
549
552
  if (fieldApi) {
550
553
  fieldApi.setTouched(isTouched, opts);
551
554
  } else {
552
- this.updateStateTouched(field, isTouched, opts);
553
- let nestedFields = this._getNestedField(field);
554
- if (nestedFields.size) {
555
- nestedFields.forEach(fieldStaff => {
556
- let fieldPath = fieldStaff.field;
557
- let newFieldTouch = ObjectUtil.get(this.data.touched, fieldPath);
558
- let nestedBatchUpdateOpts = { notNotify: true, notUpdate: true };
559
- fieldStaff.fieldApi.setTouched(newFieldTouch, nestedBatchUpdateOpts);
560
- });
561
- }
555
+ this.updateStateTouched(field, isTouched, opts, () => {
556
+ let nestedFields = this._getNestedField(field);
557
+ if (nestedFields.size) {
558
+ nestedFields.forEach(fieldStaff => {
559
+ let fieldPath = fieldStaff.field;
560
+ let newFieldTouch = ObjectUtil.get(this.data.touched, fieldPath);
561
+ let nestedBatchUpdateOpts = { notNotify: true, notUpdate: true };
562
+ fieldStaff.fieldApi.setTouched(newFieldTouch, nestedBatchUpdateOpts);
563
+ });
564
+ }
565
+ });
562
566
  if (this.getArrayField(field)) {
563
567
  this.updateArrayField(field, { updateKey: new Date().valueOf() });
564
568
  }
package/form/interface.ts CHANGED
@@ -12,7 +12,7 @@ export interface BaseFormAdapter<P = Record<string, any>, S = Record<string, any
12
12
  cloneDeep: (val: any, ...rest: any[]) => any;
13
13
  notifySubmit: (values: any) => void;
14
14
  notifySubmitFail: (errors: Record<string, any>, values: any) => void;
15
- forceUpdate: () => void;
15
+ forceUpdate: (callback?: () => void) => void;
16
16
  notifyChange: (formState: FormState) => void;
17
17
  notifyValueChange: (values: any, changedValues: any) => void;
18
18
  notifyReset: () => void;
package/input/input.scss CHANGED
@@ -382,7 +382,8 @@ $module: #{$prefix}-input;
382
382
  // border: $border-thickness-control $color-input_disabled-border-default solid;
383
383
  color: $color-input_disabled-text-default;
384
384
  background-color: $color-input_disabled-bg-default;
385
-
385
+ // fix issue 670 in safari
386
+ -webkit-text-fill-color: $color-input_disabled-text-default;
386
387
  &:hover {
387
388
  background-color: $color-input_disabled-bg-default;
388
389
  }
@@ -44,6 +44,9 @@
44
44
  vertical-align: middle;
45
45
  white-space: nowrap;
46
46
  }
47
+ .semi-button:focus {
48
+ outline: 2px solid var(--semi-color-primary-light-active);
49
+ }
47
50
  .semi-button-danger {
48
51
  background-color: var(--semi-color-danger);
49
52
  color: white;
@@ -57,6 +60,9 @@
57
60
  .semi-button-danger.semi-button-light, .semi-button-danger.semi-button-borderless {
58
61
  color: var(--semi-color-danger);
59
62
  }
63
+ .semi-button-danger:not(.semi-button-borderless):not(.semi-button-light):focus {
64
+ outline-color: var(--semi-color-danger-light-active);
65
+ }
60
66
  .semi-button-warning {
61
67
  background-color: var(--semi-color-warning);
62
68
  color: white;
@@ -70,6 +76,9 @@
70
76
  .semi-button-warning.semi-button-light, .semi-button-warning.semi-button-borderless {
71
77
  color: var(--semi-color-warning);
72
78
  }
79
+ .semi-button-warning:not(.semi-button-borderless):not(.semi-button-light):focus {
80
+ outline-color: var(--semi-color-warning-light-active);
81
+ }
73
82
  .semi-button-tertiary {
74
83
  background-color: var(--semi-color-tertiary);
75
84
  color: white;
@@ -23,6 +23,11 @@ $module: #{$prefix}-button;
23
23
  outline: none;
24
24
  vertical-align: middle;
25
25
  white-space: nowrap;
26
+
27
+ &:focus {
28
+ outline: $width-button-outline solid $color-button_primary-outline-focus;
29
+ }
30
+
26
31
  &-danger {
27
32
  background-color: $color-button_danger-bg-default;
28
33
  color: $color-button_danger-text-default;
@@ -36,6 +41,9 @@ $module: #{$prefix}-button;
36
41
  &.#{$module}-borderless {
37
42
  color: $color-button_danger-bg-default;
38
43
  }
44
+ &:not(.#{$module}-borderless):not(.#{$module}-light):focus {
45
+ outline-color: $color-button_danger-outline-focus;
46
+ }
39
47
  }
40
48
  &-warning {
41
49
  background-color: $color-button_warning-bg-default;
@@ -50,6 +58,9 @@ $module: #{$prefix}-button;
50
58
  &.#{$module}-borderless {
51
59
  color: $color-button_warning-bg-default;
52
60
  }
61
+ &:not(.#{$module}-borderless):not(.#{$module}-light):focus {
62
+ outline-color: $color-button_warning-outline-focus;
63
+ }
53
64
  }
54
65
  &-tertiary {
55
66
  background-color: $color-button_tertiary-bg-default;
@@ -1,6 +1,14 @@
1
1
  declare const cssClasses: {
2
2
  PREFIX: string;
3
3
  };
4
- declare const strings: Record<string, any>;
4
+ declare const strings: {
5
+ readonly sizes: readonly ["default", "small", "large"];
6
+ readonly iconPositions: readonly ["left", "right"];
7
+ readonly htmlTypes: readonly ["button", "reset", "submit"];
8
+ readonly btnTypes: readonly ["primary", "secondary", "tertiary", "warning", "danger"];
9
+ readonly themes: readonly ["solid", "borderless", "light"];
10
+ readonly DEFAULT_ICON_SIZE: "default";
11
+ readonly DEFAULT_ICON_POSITION: "left";
12
+ };
5
13
  declare const numbers: {};
6
14
  export { cssClasses, strings, numbers };
@@ -10,6 +10,7 @@ $color-button_primary-text-hover: white; // 主要按钮文字颜色 - 悬浮
10
10
  $color-button_primary-bg-active: var(--semi-color-primary-active); // 主要按钮背景颜色 - 按下
11
11
  $color-button_primary-border-active: var(--semi-color-primary-active); // 主要按钮描边颜色 - 按下
12
12
  $color-button_primary-text-active: white; // 主要按钮文字颜色 - 按下
13
+ $color-button_primary-outline-focus: var(--semi-color-primary-light-active); // 主要按钮轮廓 - 聚焦
13
14
 
14
15
  // secondary
15
16
  $color-button_secondary-bg-default: var(--semi-color-secondary); // 次要按钮背景颜色
@@ -36,6 +37,7 @@ $color-button_danger-text-hover: white; // 危险按钮文字颜色 - 悬浮
36
37
  $color-button_danger-bg-active: var(--semi-color-danger-active); // 危险按钮背景颜色 - 按下
37
38
  $color-button_danger-border-active: var(--semi-color-danger-active); // 危险按钮描边颜色 - 按下
38
39
  $color-button_danger-text-active: white; // 危险按钮文字颜色 - 按下
40
+ $color-button_danger-outline-focus: var(--semi-color-danger-light-active); // 危险按钮轮廓 - 聚焦
39
41
 
40
42
  // warning
41
43
  $color-button_warning-bg-default: var(--semi-color-warning); // 警告按钮背景颜色
@@ -49,6 +51,7 @@ $color-button_warning-text-hover: white; // 警告按钮文字颜色 - 悬浮
49
51
  $color-button_warning-bg-active: var(--semi-color-warning-active); // 警告按钮背景颜色 - 按下
50
52
  $color-button_warning-border-active: var(--semi-color-warning-active); // 警告按钮描边颜色 - 按下
51
53
  $color-button_warning-text-active: white; // 警告按钮文字颜色 - 按下
54
+ $color-button_warning-outline-focus: var(--semi-color-warning-light-active); // 警告按钮轮廓 - 聚焦
52
55
 
53
56
  // tertiary
54
57
  $color-button_tertiary-bg-default: var(--semi-color-tertiary); // 第三按钮背景颜色
@@ -134,3 +137,4 @@ $height-button_default: $height-control-default; // 按钮高度 - 默认
134
137
  $width-button-border: $border-thickness; // 按钮描边宽度
135
138
  $radius-button: var(--semi-border-radius-small); // 按钮圆角大小
136
139
  $radius-button_group: $radius-button; // 按钮组圆角大小
140
+ $width-button-outline: 2px; // 按钮轮廓宽度
@@ -95,7 +95,7 @@
95
95
  color: var(--semi-color-text-2);
96
96
  }
97
97
  .semi-cascader-selection-tag {
98
- margin: 1px 2px;
98
+ margin: 1px 2px 1px 0;
99
99
  }
100
100
  .semi-cascader-selection-tag:first-child {
101
101
  margin-left: 0;
@@ -111,7 +111,7 @@ $module: #{$prefix}-cascader;
111
111
  }
112
112
 
113
113
  &-tag {
114
- margin: $spacing-cascader_selection_tag-marginY $spacing-cascader_selection_tag-marginX;
114
+ margin: $spacing-cascader_selection_tag-marginY $spacing-cascader_selection_tag-marginRight $spacing-cascader_selection_tag-marginY $spacing-cascader_selection_tag-marginLeft;
115
115
 
116
116
  &:first-child {
117
117
  margin-left: 0;
@@ -120,7 +120,7 @@ $module: #{$prefix}-cascader;
120
120
  &-disabled.#{$prefix}-tag {
121
121
  color: $color-cascader_input_disabled-text-default;
122
122
  cursor: not-allowed;
123
-
123
+
124
124
  .#{$prefix}-tag-close {
125
125
  color: $color-cascader_input_disabled-text-default;
126
126
  cursor: not-allowed;
@@ -193,6 +193,10 @@ export default class CascaderFoundation extends BaseFoundation<CascaderAdapter,
193
193
  handleShowNextByHover(item: BasicEntity): void;
194
194
  onItemCheckboxClick(item: BasicEntity | BasicData): void;
195
195
  handleClick(e: any): void;
196
+ /**
197
+ * A11y: simulate selection click
198
+ */
199
+ handleSelectionEnterPress(keyboardEvent: any): void;
196
200
  toggleHoverState(bool: boolean): void;
197
201
  _defaultRenderText(path: any[], displayRender?: BasicCascaderProps['displayRender']): any;
198
202
  renderDisplayText(targetKey: string, keyEntities?: BasicEntities): any;
@@ -201,6 +205,17 @@ export default class CascaderFoundation extends BaseFoundation<CascaderAdapter,
201
205
  handleSingleSelect(e: any, item: BasicEntity | BasicData): void;
202
206
  _handleMultipleSelect(item: BasicEntity | BasicData): void;
203
207
  calcNonDisabedCheckedKeys(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
+ */
204
219
  checkedKeys: Set<string>;
205
220
  halfCheckedKeys: Set<any>;
206
221
  };
@@ -217,6 +232,10 @@ export default class CascaderFoundation extends BaseFoundation<CascaderAdapter,
217
232
  };
218
233
  handleInputChange(sugInput: string): void;
219
234
  handleClear(): void;
235
+ /**
236
+ * A11y: simulate clear button click
237
+ */
238
+ handleClearEnterPress(keyboardEvent: any): void;
220
239
  getRenderData(): BasicEntity[] | BasicData[];
221
240
  getFilteredData(): BasicData[];
222
241
  handleListScroll(e: any, ind: number): void;
@@ -64,6 +64,8 @@ var _util = require("./util");
64
64
 
65
65
  var _constants = require("./constants");
66
66
 
67
+ var _isEnterPress = _interopRequireDefault(require("../utils/isEnterPress"));
68
+
67
69
  // eslint-disable-next-line max-len
68
70
  class CascaderFoundation extends _foundation.default {
69
71
  constructor(adapter) {
@@ -564,6 +566,16 @@ class CascaderFoundation extends _foundation.default {
564
566
  this.close(e);
565
567
  }
566
568
  }
569
+ /**
570
+ * A11y: simulate selection click
571
+ */
572
+
573
+
574
+ handleSelectionEnterPress(keyboardEvent) {
575
+ if ((0, _isEnterPress.default)(keyboardEvent)) {
576
+ this.handleClick(keyboardEvent);
577
+ }
578
+ }
567
579
 
568
580
  toggleHoverState(bool) {
569
581
  this._adapter.toggleHovering(bool);
@@ -986,6 +998,16 @@ class CascaderFoundation extends _foundation.default {
986
998
 
987
999
  this._adapter.rePositionDropdown();
988
1000
  }
1001
+ /**
1002
+ * A11y: simulate clear button click
1003
+ */
1004
+
1005
+
1006
+ handleClearEnterPress(keyboardEvent) {
1007
+ if ((0, _isEnterPress.default)(keyboardEvent)) {
1008
+ this.handleClear();
1009
+ }
1010
+ }
989
1011
 
990
1012
  getRenderData() {
991
1013
  var _context9, _context10;
@@ -44,7 +44,8 @@ $spacing-cascader_selection-paddingLeft: 12px; // 级联选择触发器左侧内
44
44
  $spacing-cascader_selection-paddingRight: 12px; // 级联选择触发器右侧内边距
45
45
  $spacing-cascader_selection_multiple-paddingLeft: $spacing-extra-tight; // 级联选择触发器多选时左侧内边距
46
46
  $spacing-cascader_selection_multiple-paddingRight: $spacing-extra-tight; // 级联选择触发器多选时右侧内边距
47
- $spacing-cascader_selection_tag-marginX: $spacing-super-tight; // 级联选择触发器多选时标签的水平外边距
47
+ $spacing-cascader_selection_tag-marginLeft: $spacing-none; // 级联选择触发器多选时标签的水平左外边距
48
+ $spacing-cascader_selection_tag-marginRight: $spacing-super-tight; // 级联选择触发器多选时标签的水平右外边距
48
49
  $spacing-cascader_selection_tag-marginY: 1px; // 级联选择触发器多选时标签的垂直外边距
49
50
  $spacing-cascader_selection_tagInput-marginLeft: - $spacing-extra-tight; // 级联选择触发器多选搜索时 TagInput 的左外边距
50
51
  $spacing-cascader_selection_input-marginLeft: $spacing-extra-tight; // 级联选择触发器多选搜索时输入框的左外边距
@@ -135,8 +135,8 @@ export interface DatePickerFoundationState {
135
135
  panelShow: boolean;
136
136
  isRange: boolean;
137
137
  inputValue: string;
138
- value: ValueType;
139
- cachedSelectedValue: ValueType;
138
+ value: Date[];
139
+ cachedSelectedValue: Date[];
140
140
  prevTimeZone: string | number;
141
141
  motionEnd: boolean;
142
142
  rangeInputFocus: 'rangeStart' | 'rangeEnd' | boolean;
@@ -155,9 +155,9 @@ export interface DatePickerAdapter extends DefaultAdapter<DatePickerFoundationPr
155
155
  notifyConfirm: DatePickerFoundationProps['onConfirm'];
156
156
  notifyOpenChange: DatePickerFoundationProps['onOpenChange'];
157
157
  notifyPresetsClick: DatePickerFoundationProps['onPresetClick'];
158
- updateValue: (value: ValueType) => void;
158
+ updateValue: (value: Date[]) => void;
159
159
  updatePrevTimezone: (prevTimeZone: string | number) => void;
160
- updateCachedSelectedValue: (cachedSelectedValue: ValueType) => void;
160
+ updateCachedSelectedValue: (cachedSelectedValue: Date[]) => void;
161
161
  updateInputValue: (inputValue: string) => void;
162
162
  needConfirm: () => boolean;
163
163
  typeIsYearOrMonth: () => boolean;
@@ -22,7 +22,6 @@ export interface DateInputFoundationProps extends DateInputElementProps, DateInp
22
22
  value?: ValueType;
23
23
  disabled?: boolean;
24
24
  type?: Type;
25
- multiple?: boolean;
26
25
  showClear?: boolean;
27
26
  format?: string;
28
27
  inputStyle?: React.CSSProperties;
@@ -26,6 +26,7 @@ export interface MonthFoundationProps {
26
26
  focusRecordsRef: any;
27
27
  locale: any;
28
28
  localeCode: string;
29
+ multiple: boolean;
29
30
  }
30
31
  export declare type MonthDayInfo = {
31
32
  dayNumber: number;