baseui 0.0.0-next-62005d4 → 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.
- package/es/list/list-item.js +16 -1
- package/esm/list/list-item.js +16 -1
- package/list/list-item.js +16 -1
- package/package.json +1 -1
package/es/list/list-item.js
CHANGED
|
@@ -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
|
|
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,
|
package/esm/list/list-item.js
CHANGED
|
@@ -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
|
|
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,
|
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
|
|
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,
|