@douyinfe/semi-ui 2.3.0-beta.0 → 2.3.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.
@@ -22,7 +22,6 @@ body[data-page="a11y"] {
22
22
  }
23
23
 
24
24
  .grid {
25
-
26
25
  .semi-row,
27
26
  .semi-row-flex {
28
27
  text-align: center;
@@ -7,9 +7,6 @@ body {
7
7
 
8
8
 
9
9
  // 给每个组件的 story 区域加个 padding,如果需要更大的 padding 可以在组件内自定义样式
10
- .sb-show-main.sb-main-padded {
11
-
12
- #root {
13
- padding: 20px;
14
- }
10
+ .sb-show-main.sb-main-padded > #root {
11
+ padding: 20px;
15
12
  }
@@ -76,6 +76,6 @@ export default class AvatarGroup extends PureComponent<AvatarGroupProps> {
76
76
 
77
77
  }
78
78
 
79
- return <div className={groupCls} aria-label="avatar group">{inner}</div>;
79
+ return <div className={groupCls}>{inner}</div>;
80
80
  }
81
81
  }
package/avatar/index.tsx CHANGED
@@ -136,24 +136,20 @@ export default class Avatar extends BaseComponent<AvatarProps, AvatarState> {
136
136
  );
137
137
  let content = children;
138
138
  const hoverRender = hoverContent ? (<div className={`${prefixCls}-hover`}>{hoverContent}</div>) : null;
139
- let ariaLabel;
140
139
  if (isImg) {
141
140
  content = (
142
141
  <img src={src} srcSet={srcSet} onError={this.handleError} alt={alt} {...imgAttr} />
143
142
  );
144
- ariaLabel = 'avatar';
145
143
  } else if (typeof children === 'string') {
146
144
  content = (
147
145
  <span className={`${prefixCls}-content`}>
148
146
  <span className={`${prefixCls}-label`}>{children}</span>
149
147
  </span>
150
148
  );
151
- ariaLabel = `avatar of ${children}`;
152
149
  }
153
150
  return (
154
151
  // eslint-disable-next-line jsx-a11y/no-static-element-interactions,jsx-a11y/click-events-have-key-events
155
152
  <span
156
- aria-label={ariaLabel}
157
153
  {...(others as any)}
158
154
  style={style}
159
155
  className={avatarCls}
@@ -29,7 +29,7 @@ describe('Button', () => {
29
29
 
30
30
  it(`test loading`, () => {
31
31
  const elem = mount(<Button icon={<IconEdit />} loading />);
32
- expect(elem.find({ 'aria-label': 'spin' }).length).toBe(1);
32
+ expect(elem.find({ 'data-icon': 'spin' }).length).toBe(1);
33
33
  });
34
34
 
35
35
  it('test button type',()=>{
@@ -578,9 +578,9 @@ export const CheckboxGroupCardStyle = () => (
578
578
  </CheckboxGroup>
579
579
  <br />
580
580
  <br />
581
- <div>radio disabled</div>
581
+ <div>Checkbox disabled</div>
582
582
  <CheckboxGroup key={getUuidShort({ prefix: '' })} aria-label='group demo' type="card" direction="horizontal" defaultValue={['1']}>
583
- <Checkbox value="1" disabled extra="Semi Design" style={{ width: 280 }}>
583
+ <Checkbox value="1" disabled extra="disabled+checked" style={{ width: 280 }}>
584
584
  多选框标题
585
585
  </Checkbox>
586
586
  <Checkbox value="2" disabled extra="disabled+unchecked" style={{ width: 280 }}>
@@ -97,7 +97,7 @@ class Collapse extends BaseComponent<CollapseReactProps, CollapseState> {
97
97
  const clsPrefix = cls(cssClasses.PREFIX, className);
98
98
  const { activeSet } = this.state;
99
99
  return (
100
- <div className={clsPrefix} style={style} aria-label={`Collapse`}>
100
+ <div className={clsPrefix} style={style}>
101
101
  <CollapseContext.Provider
102
102
  value={{
103
103
  activeSet,
package/collapse/item.tsx CHANGED
@@ -65,7 +65,7 @@ export default class CollapsePanel extends PureComponent<CollapsePanelProps> {
65
65
  {iconPosLeft ? icon : null}
66
66
  <span>{header}</span>
67
67
  <span className={`${cssClasses.PREFIX}-header-right`}>
68
- <span aria-label={'Extra of collapse header'}>{extra}</span>
68
+ <span>{extra}</span>
69
69
  {iconPosLeft ? null : icon}
70
70
  </span>
71
71
  </>
@@ -108,7 +108,6 @@ export default class CollapsePanel extends PureComponent<CollapsePanelProps> {
108
108
  });
109
109
  return (
110
110
  <div
111
- aria-label={'Collapse panel'}
112
111
  className={itemCls}
113
112
  {...restProps}
114
113
  >
@@ -129,7 +128,6 @@ export default class CollapsePanel extends PureComponent<CollapsePanelProps> {
129
128
  reCalcKey={reCalcKey}>
130
129
  <div
131
130
  className={contentCls}
132
- aria-label={'Collapse content'}
133
131
  aria-hidden={!active}
134
132
  id={this.ariaID}
135
133
  >
@@ -24579,13 +24579,14 @@ function getUuidv4() {
24579
24579
  */
24580
24580
 
24581
24581
 
24582
- function getUuidShort(_ref) {
24582
+ function getUuidShort() {
24583
24583
  var _context3;
24584
24584
 
24585
- let {
24585
+ let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
24586
+ const {
24586
24587
  prefix = '',
24587
24588
  length = 7
24588
- } = _ref;
24589
+ } = options;
24589
24590
  const characters = '0123456789abcdefghijklmnopqrstuvwxyz';
24590
24591
  const total = characters.length;
24591
24592
  let randomId = '';
@@ -26917,7 +26918,7 @@ class tooltip_Tooltip extends baseComponent_BaseComponent {
26917
26918
  placement: props.position || 'top',
26918
26919
  transitionStyle: {},
26919
26920
  isPositionUpdated: false,
26920
- id: getUuidv4() // auto generate id, will be used by children.aria-descriptionby & content.id, improve a11y
26921
+ id: getUuidShort() // auto generate id, will be used by children.aria-describedby & content.id, improve a11y
26921
26922
 
26922
26923
  };
26923
26924
  this.foundation = new foundation_Tooltip(this.adapter);
@@ -32715,7 +32716,8 @@ function icon_Icon() {
32715
32716
  viewBox: "0 0 36 36",
32716
32717
  version: "1.1",
32717
32718
  xmlns: "http://www.w3.org/2000/svg",
32718
- "aria-label": "spin"
32719
+ "aria-hidden": true,
32720
+ "data-icon": "spin"
32719
32721
  }), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("defs", null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("linearGradient", {
32720
32722
  x1: "0%",
32721
32723
  y1: "100%",
@@ -34694,7 +34696,6 @@ class avatar_Avatar extends baseComponent_BaseComponent {
34694
34696
  const hoverRender = hoverContent ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("div", {
34695
34697
  className: "".concat(avatar_prefixCls, "-hover")
34696
34698
  }, hoverContent) : null;
34697
- let ariaLabel;
34698
34699
 
34699
34700
  if (isImg) {
34700
34701
  content = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("img", assign_default()({
@@ -34703,22 +34704,18 @@ class avatar_Avatar extends baseComponent_BaseComponent {
34703
34704
  onError: this.handleError,
34704
34705
  alt: alt
34705
34706
  }, imgAttr));
34706
- ariaLabel = 'avatar';
34707
34707
  } else if (typeof children === 'string') {
34708
34708
  content = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("span", {
34709
34709
  className: "".concat(avatar_prefixCls, "-content")
34710
34710
  }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("span", {
34711
34711
  className: "".concat(avatar_prefixCls, "-label")
34712
34712
  }, children));
34713
- ariaLabel = "avatar of ".concat(children);
34714
34713
  }
34715
34714
 
34716
34715
  return (
34717
34716
  /*#__PURE__*/
34718
34717
  // eslint-disable-next-line jsx-a11y/no-static-element-interactions,jsx-a11y/click-events-have-key-events
34719
- external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("span", assign_default()({
34720
- "aria-label": ariaLabel
34721
- }, others, {
34718
+ external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("span", assign_default()({}, others, {
34722
34719
  style: style,
34723
34720
  className: avatarCls,
34724
34721
  onClick: onClick,
@@ -34872,8 +34869,7 @@ class avatarGroup_AvatarGroup extends external_root_React_commonjs2_react_common
34872
34869
  }
34873
34870
 
34874
34871
  return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("div", {
34875
- className: groupCls,
34876
- "aria-label": "avatar group"
34872
+ className: groupCls
34877
34873
  }, inner);
34878
34874
  }
34879
34875
 
@@ -48118,9 +48114,7 @@ class item_CollapsePanel extends external_root_React_commonjs2_react_commonjs_re
48118
48114
  if (typeof header === 'string') {
48119
48115
  return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement(external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.Fragment, null, iconPosLeft ? icon : null, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("span", null, header), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("span", {
48120
48116
  className: "".concat(collapse_constants_cssClasses.PREFIX, "-header-right")
48121
- }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("span", {
48122
- "aria-label": 'Extra of collapse header'
48123
- }, extra), iconPosLeft ? null : icon));
48117
+ }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("span", null, extra), iconPosLeft ? null : icon));
48124
48118
  }
48125
48119
 
48126
48120
  return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement(external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.Fragment, null, iconPosLeft ? icon : null, header, iconPosLeft ? null : icon);
@@ -48155,7 +48149,6 @@ class item_CollapsePanel extends external_root_React_commonjs2_react_commonjs_re
48155
48149
  ["".concat(collapse_constants_cssClasses.PREFIX, "-content")]: true
48156
48150
  });
48157
48151
  return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("div", assign_default()({
48158
- "aria-label": 'Collapse panel',
48159
48152
  className: itemCls
48160
48153
  }, restProps), /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("div", {
48161
48154
  role: "button",
@@ -48171,7 +48164,6 @@ class item_CollapsePanel extends external_root_React_commonjs2_react_commonjs_re
48171
48164
  reCalcKey: reCalcKey
48172
48165
  }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("div", {
48173
48166
  className: contentCls,
48174
- "aria-label": 'Collapse content',
48175
48167
  "aria-hidden": !active,
48176
48168
  id: this.ariaID
48177
48169
  }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("div", {
@@ -48295,8 +48287,7 @@ class collapse_Collapse extends baseComponent_BaseComponent {
48295
48287
  } = this.state;
48296
48288
  return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("div", {
48297
48289
  className: clsPrefix,
48298
- style: style,
48299
- "aria-label": "Collapse"
48290
+ style: style
48300
48291
  }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement(collapse_context.Provider, {
48301
48292
  value: {
48302
48293
  activeSet,
@@ -60448,8 +60439,7 @@ class empty_Empty extends baseComponent_BaseComponent {
60448
60439
  };
60449
60440
  return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("div", {
60450
60441
  className: wrapperCls,
60451
- style: style,
60452
- "aria-label": "empty placeholder image"
60442
+ style: style
60453
60443
  }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("div", {
60454
60444
  className: "".concat(empty_prefixCls, "-image"),
60455
60445
  style: imageStyle
@@ -67464,7 +67454,7 @@ class notificationListFoundation_NotificationListFoundation extends foundation {
67464
67454
  // }
67465
67455
 
67466
67456
 
67467
- this._adapter.updateNotices([...notices, opts]); // return id;
67457
+ this._adapter.updateNotices([opts, ...notices]); // return id;
67468
67458
 
67469
67459
  }
67470
67460
 
@@ -76680,8 +76670,7 @@ class SideSheetContent_SideSheetContent extends external_root_React_commonjs2_re
76680
76670
 
76681
76671
  if (title) {
76682
76672
  header = /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("div", {
76683
- className: "".concat(SideSheetContent_prefixCls, "-title"),
76684
- "aria-label": 'Sidesheet title'
76673
+ className: "".concat(SideSheetContent_prefixCls, "-title")
76685
76674
  }, this.props.title);
76686
76675
  }
76687
76676
 
@@ -76700,6 +76689,7 @@ class SideSheetContent_SideSheetContent extends external_root_React_commonjs2_re
76700
76689
  return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("div", {
76701
76690
  className: "".concat(SideSheetContent_prefixCls, "-header"),
76702
76691
  role: 'heading',
76692
+ "aria-level": 1,
76703
76693
  style: assign_default()({}, headerStyle)
76704
76694
  }, header, closer);
76705
76695
  }
@@ -76732,15 +76722,12 @@ class SideSheetContent_SideSheetContent extends external_root_React_commonjs2_re
76732
76722
  // onMouseDown={this.onDialogMouseDown}
76733
76723
  style: assign_default()(assign_default()({}, props.style), style)
76734
76724
  }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("div", {
76735
- className: "".concat(SideSheetContent_prefixCls, "-content"),
76736
- "aria-label": "Sidesheet content"
76725
+ className: "".concat(SideSheetContent_prefixCls, "-content")
76737
76726
  }, header, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("div", {
76738
76727
  className: "".concat(SideSheetContent_prefixCls, "-body"),
76739
- "aria-label": "Sidesheet body",
76740
76728
  style: props.bodyStyle
76741
76729
  }, props.children), props.footer ? /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("div", {
76742
- className: "".concat(SideSheetContent_prefixCls, "-footer"),
76743
- "aria-label": "Sidesheet footer"
76730
+ className: "".concat(SideSheetContent_prefixCls, "-footer")
76744
76731
  }, props.footer) : null));
76745
76732
  return dialogElement;
76746
76733
  }
@@ -76762,8 +76749,7 @@ class SideSheetContent_SideSheetContent extends external_root_React_commonjs2_re
76762
76749
 
76763
76750
  return /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("div", {
76764
76751
  className: wrapperCls,
76765
- style: wrapperStyle,
76766
- "aria-label": this.props['aria-label']
76752
+ style: wrapperStyle
76767
76753
  }, this.getMaskElement(), this.getDialogElement());
76768
76754
  }
76769
76755
 
@@ -96503,12 +96489,12 @@ class fileCard_FileCard extends external_root_React_commonjs2_react_commonjs_rea
96503
96489
  orbitStroke: '#FFF',
96504
96490
  "aria-label": "uploading file progress"
96505
96491
  }) : null, showRetry ? retry : null, showReplace && replace, showPicInfo && picInfo, !disabled && /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement("div", {
96506
- className: closeCls
96492
+ className: closeCls,
96493
+ onClick: e => this.onRemove(e)
96507
96494
  }, /*#__PURE__*/external_root_React_commonjs2_react_commonjs_react_amd_react_default.a.createElement(IconClose, {
96508
96495
  tabIndex: 0,
96509
96496
  role: "button",
96510
- size: "extra-small",
96511
- onClick: e => this.onRemove(e)
96497
+ size: "extra-small"
96512
96498
  })), this.renderPicValidateMsg());
96513
96499
  }
96514
96500