69 lines
2.9 KiB
Plaintext
69 lines
2.9 KiB
Plaintext
var $5Zch8$react = require("react");
|
|
|
|
|
|
function $parcel$interopDefault(a) {
|
|
return a && a.__esModule ? a.default : a;
|
|
}
|
|
|
|
function $parcel$export(e, n, v, s) {
|
|
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
}
|
|
|
|
$parcel$export(module.exports, "Item", () => $c870f3b549c61b6b$export$6d08773d2e66f8f2);
|
|
/*
|
|
* Copyright 2020 Adobe. All rights reserved.
|
|
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
* governing permissions and limitations under the License.
|
|
*/
|
|
function $c870f3b549c61b6b$var$Item(props) {
|
|
return null;
|
|
}
|
|
$c870f3b549c61b6b$var$Item.getCollectionNode = function* getCollectionNode(props, context) {
|
|
let { childItems: childItems, title: title, children: children } = props;
|
|
let rendered = props.title || props.children;
|
|
let textValue = props.textValue || (typeof rendered === 'string' ? rendered : '') || props['aria-label'] || '';
|
|
// suppressTextValueWarning is used in components like Tabs, which don't have type to select support.
|
|
if (!textValue && !(context === null || context === void 0 ? void 0 : context.suppressTextValueWarning) && process.env.NODE_ENV !== 'production') console.warn('<Item> with non-plain text contents is unsupported by type to select for accessibility. Please add a `textValue` prop.');
|
|
yield {
|
|
type: 'item',
|
|
props: props,
|
|
rendered: rendered,
|
|
textValue: textValue,
|
|
'aria-label': props['aria-label'],
|
|
hasChildNodes: $c870f3b549c61b6b$var$hasChildItems(props),
|
|
*childNodes () {
|
|
if (childItems) for (let child of childItems)yield {
|
|
type: 'item',
|
|
value: child
|
|
};
|
|
else if (title) {
|
|
let items = [];
|
|
(0, ($parcel$interopDefault($5Zch8$react))).Children.forEach(children, (child)=>{
|
|
items.push({
|
|
type: 'item',
|
|
element: child
|
|
});
|
|
});
|
|
yield* items;
|
|
}
|
|
}
|
|
};
|
|
};
|
|
function $c870f3b549c61b6b$var$hasChildItems(props) {
|
|
if (props.hasChildItems != null) return props.hasChildItems;
|
|
if (props.childItems) return true;
|
|
if (props.title && (0, ($parcel$interopDefault($5Zch8$react))).Children.count(props.children) > 0) return true;
|
|
return false;
|
|
}
|
|
// We don't want getCollectionNode to show up in the type definition
|
|
let $c870f3b549c61b6b$export$6d08773d2e66f8f2 = $c870f3b549c61b6b$var$Item;
|
|
|
|
|
|
//# sourceMappingURL=Item.main.js.map
|