baseui 0.0.0-next-c5a5559 → 0.0.0-next-908fcae

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.
@@ -39,13 +39,28 @@ const ListItem = /*#__PURE__*/React.forwardRef((props, ref) => {
39
39
  }
40
40
  }, [props.artworkSize, props.sublist]);
41
41
  const isTapTarget = Boolean(props.onClick);
42
+
43
+ const getMainTextFromChild = child => {
44
+ if (typeof child === 'string') {
45
+ return child;
46
+ } else if ( /*#__PURE__*/React.isValidElement(child)) {
47
+ return getMainTextFromChild(child.props.children);
48
+ } else {
49
+ return 'List item';
50
+ }
51
+ };
52
+
53
+ const listItemName = React.Children.count(props.children) === 0 ? ['List item'] : React.Children.map(props.children, child => {
54
+ return getMainTextFromChild(child);
55
+ });
56
+ const ariaLabel = props.hasOwnProperty('aria-label') ? props['aria-label'] : listItemName[0];
42
57
  return /*#__PURE__*/React.createElement(Root // eslint-disable-next-line @typescript-eslint/no-explicit-any
43
58
  , _extends({
44
59
  ref: ref,
45
60
  $shape: props.shape || SHAPE.DEFAULT,
46
61
  $as: isTapTarget ? 'button' : 'li',
47
62
  $isTapTarget: isTapTarget,
48
- "aria-label": props['aria-label'],
63
+ "aria-label": props.role !== 'presentation' ? ariaLabel : null,
49
64
  "aria-selected": props['aria-selected'],
50
65
  id: props.id,
51
66
  role: props.role,
@@ -807,7 +807,6 @@ class Select extends React.Component {
807
807
  "aria-controls": this.state.isOpen ? listboxId : null,
808
808
  "aria-describedby": this.props['aria-describedby'],
809
809
  "aria-errormessage": this.props['aria-errormessage'],
810
- "aria-disabled": this.props.disabled || null,
811
810
  "aria-expanded": isOpen,
812
811
  "aria-haspopup": "listbox",
813
812
  "aria-label": label,
@@ -67,13 +67,28 @@ var ListItem = /*#__PURE__*/React.forwardRef(function (props, ref) {
67
67
  }
68
68
  }, [props.artworkSize, props.sublist]);
69
69
  var isTapTarget = Boolean(props.onClick);
70
+
71
+ var getMainTextFromChild = function getMainTextFromChild(child) {
72
+ if (typeof child === 'string') {
73
+ return child;
74
+ } else if ( /*#__PURE__*/React.isValidElement(child)) {
75
+ return getMainTextFromChild(child.props.children);
76
+ } else {
77
+ return 'List item';
78
+ }
79
+ };
80
+
81
+ var listItemName = React.Children.count(props.children) === 0 ? ['List item'] : React.Children.map(props.children, function (child) {
82
+ return getMainTextFromChild(child);
83
+ });
84
+ var ariaLabel = props.hasOwnProperty('aria-label') ? props['aria-label'] : listItemName[0];
70
85
  return /*#__PURE__*/React.createElement(Root // eslint-disable-next-line @typescript-eslint/no-explicit-any
71
86
  , _extends({
72
87
  ref: ref,
73
88
  $shape: props.shape || SHAPE.DEFAULT,
74
89
  $as: isTapTarget ? 'button' : 'li',
75
90
  $isTapTarget: isTapTarget,
76
- "aria-label": props['aria-label'],
91
+ "aria-label": props.role !== 'presentation' ? ariaLabel : null,
77
92
  "aria-selected": props['aria-selected'],
78
93
  id: props.id,
79
94
  role: props.role,
@@ -944,7 +944,6 @@ var Select = /*#__PURE__*/function (_React$Component) {
944
944
  "aria-controls": this.state.isOpen ? listboxId : null,
945
945
  "aria-describedby": this.props['aria-describedby'],
946
946
  "aria-errormessage": this.props['aria-errormessage'],
947
- "aria-disabled": this.props.disabled || null,
948
947
  "aria-expanded": isOpen,
949
948
  "aria-haspopup": "listbox",
950
949
  "aria-label": label,
package/list/list-item.js CHANGED
@@ -76,13 +76,28 @@ var ListItem = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
76
76
  }, [props.artworkSize, props.sublist]);
77
77
 
78
78
  var isTapTarget = Boolean(props.onClick);
79
+
80
+ var getMainTextFromChild = function getMainTextFromChild(child) {
81
+ if (typeof child === 'string') {
82
+ return child;
83
+ } else if ( /*#__PURE__*/_react.default.isValidElement(child)) {
84
+ return getMainTextFromChild(child.props.children);
85
+ } else {
86
+ return 'List item';
87
+ }
88
+ };
89
+
90
+ var listItemName = _react.default.Children.count(props.children) === 0 ? ['List item'] : _react.default.Children.map(props.children, function (child) {
91
+ return getMainTextFromChild(child);
92
+ });
93
+ var ariaLabel = props.hasOwnProperty('aria-label') ? props['aria-label'] : listItemName[0];
79
94
  return /*#__PURE__*/_react.default.createElement(Root // eslint-disable-next-line @typescript-eslint/no-explicit-any
80
95
  , _extends({
81
96
  ref: ref,
82
97
  $shape: props.shape || _constants.SHAPE.DEFAULT,
83
98
  $as: isTapTarget ? 'button' : 'li',
84
99
  $isTapTarget: isTapTarget,
85
- "aria-label": props['aria-label'],
100
+ "aria-label": props.role !== 'presentation' ? ariaLabel : null,
86
101
  "aria-selected": props['aria-selected'],
87
102
  id: props.id,
88
103
  role: props.role,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "baseui",
3
- "version": "0.0.0-next-c5a5559",
3
+ "version": "0.0.0-next-908fcae",
4
4
  "description": "A React Component library implementing the Base design language",
5
5
  "keywords": [
6
6
  "react",
@@ -965,7 +965,6 @@ var Select = /*#__PURE__*/function (_React$Component) {
965
965
  "aria-controls": this.state.isOpen ? listboxId : null,
966
966
  "aria-describedby": this.props['aria-describedby'],
967
967
  "aria-errormessage": this.props['aria-errormessage'],
968
- "aria-disabled": this.props.disabled || null,
969
968
  "aria-expanded": isOpen,
970
969
  "aria-haspopup": "listbox",
971
970
  "aria-label": label,
@@ -755,7 +755,6 @@ class Select extends React.Component<PropsT, SelectStateT> {
755
755
  aria-controls={this.state.isOpen ? listboxId : null}
756
756
  aria-describedby={this.props['aria-describedby']}
757
757
  aria-errormessage={this.props['aria-errormessage']}
758
- aria-disabled={this.props.disabled || null}
759
758
  aria-expanded={isOpen}
760
759
  aria-haspopup="listbox"
761
760
  aria-label={label}