@ionic/core
Version:
Base components for Ionic
4 lines • 1.21 kB
JavaScript
/*!
* (C) Ionic http://ionicframework.com - MIT License
*/
import{h as t}from"./p-Ct2aBEue.js";import{s as e}from"./p-DHo45oj7.js";const s=(e,n,o)=>{if(e.nodeType===Node.TEXT_NODE)return e.textContent??"";if(e.nodeType!==Node.ELEMENT_NODE)return null;const r=e,c=r.tagName.toLowerCase(),i=`${n}-${o}`,l={key:i};for(let t=0;t<r.attributes.length;t++){const e=r.attributes.item(t);l[e.name]=e.value}const $=Array.from(r.childNodes).map(((t,e)=>s(t,i,e))).filter((t=>null!==t));return t(c,l,$)},n=(n,o,r,c=!1)=>{const i=c?"span":"div",l=`${r}-${n}`;return e(o),t(i,{class:r,key:l},Array.from(o.childNodes).map(((t,e)=>s(t,l,e))))},o=(e,s,o=!1)=>{const{id:r,label:c,startContent:i,endContent:l,description:$}=e,a=!!i||!!l||!!$,p=o?"span":"div";if(!(a||"string"!=typeof c&&c))return t(p,{class:s,key:`${s}-${r}`},c);const y="string"!=typeof c&&c?n(r,c,`${s}-text`,o):t(p,{key:`${s}-label-${r}`},c);return a?t(p,{class:`${s} ${s}-has-rich-content`,key:`${s}-${r}`},i&&n(r,i,"select-option-start",o),t(p,{class:"select-option-content",key:`${s}-content-${r}`},y,$&&t(p,{class:"select-option-description",key:`${s}-desc-${r}`},$)),l&&n(r,l,"select-option-end",o)):t(p,{class:s,key:`${s}-${r}`},y)};export{o as r}