| 30 | rendered: title, |
| 31 | 'aria-label': props['aria-label'], |
| 32 | *childNodes() { |
| 33 | if (typeof children === 'function') { |
| 34 | if (!items) { |
| 35 | throw new Error('props.children was a function but props.items is missing'); |
| 36 | } |
| 37 | |
| 38 | for (let item of items) { |
| 39 | yield { |
| 40 | type: 'item', |
| 41 | value: item, |
| 42 | renderer: children |
| 43 | }; |
| 44 | } |
| 45 | } else { |
| 46 | let items: PartialNode<T>[] = []; |
| 47 | React.Children.forEach(children, child => { |
| 48 | items.push({ |
| 49 | type: 'item', |
| 50 | element: child |
| 51 | }); |
| 52 | }); |
| 53 | |
| 54 | yield* items; |
| 55 | } |
| 56 | } |
| 57 | }; |
| 58 | }; |
| 59 | |