{"version":3,"file":"index.es.min.js","sources":["../../../packages/helpers/src/props.helpers.js","../../../packages/components/src/card-labels/cardLabels.js"],"sourcesContent":["const getData = attributes => attributes.find(attribute => attribute.nodeName === 'data')\n\nconst createProps = attributes => {\n const data = getData([...attributes])\n const props = [...attributes]\n .filter(attribute => attribute.nodeName !== 'data')\n .reduce((all, attr) => {\n return { ...all, [attr.nodeName]: attr.nodeValue }\n }, {})\n\n if (isNil(data)) {\n return props\n }\n\n try {\n return { ...props, ...JSON.parse(data.nodeValue) }\n } catch (error) {\n console.log('ERROR: No data', error, data?.nodeValue)\n }\n}\n\nconst isNil = obj => obj === undefined || obj === null\n\nexport const parseBool = value => (!value || value === 'false' ? false : true)\n\nexport default createProps\n","import createProps from '@kissui/helpers/src/props.helpers'\n\nclass CardLabels extends HTMLElement {\n constructor() {\n super()\n this.props = {}\n this.labels = []\n }\n\n connectedCallback() {\n this.props = createProps(this.attributes)\n this.render()\n }\n\n render() {\n const { labels = [], direction = 'column' } = this.props\n this.classList.add(`${direction === 'row' ? 'direction-row' : 'direction-' + direction}`)\n\n if (labels.length === 0) {\n return ''\n }\n this.labels = labels\n\n this.innerHTML = `${this.renderLabels()}`\n }\n\n renderLabels() {\n return this.labels\n .map(label => {\n const { name = '', bgColor = '', color = '' } = label\n return `<mark class=\"t-3xs-500-caps-sl\"\n ${\n bgColor &&\n color &&\n `style=\"background: ${bgColor}; color: ${color}\"`\n }>\n <span>${name}</span>\n </mark>`\n })\n .join('')\n }\n}\n\ncustomElements.get('nb-card-labels') || customElements.define('nb-card-labels', CardLabels)\n\nexport default CardLabels\n"],"names":["isNil","obj","CardLabels","HTMLElement","constructor","super","this","props","labels","connectedCallback","attributes","data","find","attribute","nodeName","getData","filter","reduce","all","attr","nodeValue","JSON","parse","error","console","log","createProps","render","direction","classList","add","length","innerHTML","renderLabels","map","label","name","bgColor","color","join","customElements","get","define"],"mappings":"AAAA,MAqBMA,EAAQC,GAAoC,MAARA,ECnB1C,MAAMC,UAAmBC,YACrBC,WAAAA,GACIC,QACAC,KAAKC,MAAQ,GACbD,KAAKE,OAAS,EAClB,CAEAC,iBAAAA,GACIH,KAAKC,MDROG,CAAAA,IACVC,MAAAA,EAHMD,CAAAA,GAAcA,EAAWE,MAAKC,GAAoC,SAAvBA,EAAUC,WAGpDC,CAAQ,IAAIL,IACnBH,EAAQ,IAAIG,GACbM,QAAOH,GAAoC,SAAvBA,EAAUC,WAC9BG,QAAO,CAACC,EAAKC,KACH,IAAKD,EAAK,CAACC,EAAKL,UAAWK,EAAKC,aACxC,CAAE,GAET,GAAIpB,EAAMW,GACCJ,OAAAA,EAGP,IACO,MAAA,IAAKA,KAAUc,KAAKC,MAAMX,EAAKS,WACzC,OAAQG,GACLC,QAAQC,IAAI,iBAAkBF,EAAOZ,GAAMS,UAC/C,GCRiBM,CAAYpB,KAAKI,YAC9BJ,KAAKqB,QACT,CAEAA,MAAAA,GACU,MAAEnB,OAAAA,EAAS,GAAIoB,UAAAA,EAAY,UAAatB,KAAKC,MAGnD,GAFAD,KAAKuB,UAAUC,IAAI,IAAiB,QAAdF,EAAsB,gBAAkB,aAAeA,IAEvD,IAAlBpB,EAAOuB,OACA,MAAA,GAEXzB,KAAKE,OAASA,EAEdF,KAAK0B,UAAY,GAAG1B,KAAK2B,gBAC7B,CAEAA,YAAAA,GACI,OAAO3B,KAAKE,OACP0B,KAAIC,IACK,MAAEC,KAAAA,EAAO,GAAIC,QAAAA,EAAU,GAAIC,MAAAA,EAAQ,IAAOH,EACzC,MAAA,gEAESE,GACAC,GACA,sBAAsBD,aAAmBC,4CAErCF,2CAAI,IAG3BG,KAAK,GACd,EAGJC,eAAeC,IAAI,mBAAqBD,eAAeE,OAAO,iBAAkBxC"}