{"version":3,"file":"icon-DNHpBTHs.mjs","sources":["../../../common/temp/node_modules/.pnpm/classnames@2.5.1/node_modules/classnames/bind.js","../src/icon.tsx"],"sourcesContent":["/*!\n\tCopyright (c) 2018 Jed Watson.\n\tLicensed under the MIT License (MIT), see\n\thttp://jedwatson.github.io/classnames\n*/\n/* global define */\n\n(function () {\n\t'use strict';\n\n\tvar hasOwn = {}.hasOwnProperty;\n\n\tfunction classNames () {\n\t\tvar classes = '';\n\n\t\tfor (var i = 0; i < arguments.length; i++) {\n\t\t\tvar arg = arguments[i];\n\t\t\tif (arg) {\n\t\t\t\tclasses = appendClass(classes, parseValue.call(this, arg));\n\t\t\t}\n\t\t}\n\n\t\treturn classes;\n\t}\n\n\tfunction parseValue (arg) {\n\t\tif (typeof arg === 'string' || typeof arg === 'number') {\n\t\t\treturn this && this[arg] || arg;\n\t\t}\n\n\t\tif (typeof arg !== 'object') {\n\t\t\treturn '';\n\t\t}\n\n\t\tif (Array.isArray(arg)) {\n\t\t\treturn classNames.apply(this, arg);\n\t\t}\n\n\t\tif (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes('[native code]')) {\n\t\t\treturn arg.toString();\n\t\t}\n\n\t\tvar classes = '';\n\n\t\tfor (var key in arg) {\n\t\t\tif (hasOwn.call(arg, key) && arg[key]) {\n\t\t\t\tclasses = appendClass(classes, this && this[key] || key);\n\t\t\t}\n\t\t}\n\n\t\treturn classes;\n\t}\n\n\tfunction appendClass (value, newClass) {\n\t\tif (!newClass) {\n\t\t\treturn value;\n\t\t}\n\t\n\t\tif (value) {\n\t\t\treturn value + ' ' + newClass;\n\t\t}\n\t\n\t\treturn value + newClass;\n\t}\n\n\tif (typeof module !== 'undefined' && module.exports) {\n\t\tclassNames.default = classNames;\n\t\tmodule.exports = classNames;\n\t} else if (typeof define === 'function' && typeof define.amd === 'object' && define.amd) {\n\t\t// register as 'classnames', consistent with npm package name\n\t\tdefine('classnames', [], function () {\n\t\t\treturn classNames;\n\t\t});\n\t} else {\n\t\twindow.classNames = classNames;\n\t}\n}());\n","import React from \"react\";\nimport type { BaseProps } from \"@purpurds/common-types\";\nimport c from \"classnames/bind\";\n\nimport styles from \"./icon.module.scss\";\nimport type { iconList } from \"./icon-imports\";\n\nexport declare type IconName = keyof typeof iconList;\n\nconst cx = c.bind(styles);\nconst rootClassName = \"purpur-icon\";\n\nexport const sizes = [\"xxs\", \"xs\", \"sm\", \"md\", \"lg\", \"xl\"] as const;\nexport const DEFAULT_SIZE = \"md\" as const;\n\nexport type Size = (typeof sizes)[number];\n\ntype CreateSvg = {\n  content?: string;\n  title?: string;\n  ariaHidden?: boolean;\n};\n\nexport type IconBaseProps = Omit<BaseProps<\"span\">, \"children\"> & {\n  size?: Size;\n  allyTitle?: string;\n};\n\nexport type IconProps = {\n  svg: { svg: string; name: string };\n} & IconBaseProps;\n\n// Create string from array of attributes\nconst getAttributesString = (attributeCollection: Record<string, unknown>[]) =>\n  attributeCollection\n    .filter((attr) => Object.keys(attr).length >= 1) // remove empty object\n    .map((item) => `${item.name}=\"${item.value}\"`)\n    .join(\" \");\n\nconst createSvg = ({ content = \"\", title }: CreateSvg = {}) => {\n  const attributeCollection = [\n    { name: \"xmlns\", value: \"http://www.w3.org/2000/svg\" },\n    { name: \"fill\", value: \"currentColor\" },\n    { name: \"viewBox\", value: \"0 0 24 24\" },\n    title ? { name: \"role\", value: \"img\" } : { name: \"aria-hidden\", value: \"true\" },\n  ];\n\n  const titleElement = title ? `<title>${title}</title>` : \"\";\n  return `<svg ${getAttributesString(attributeCollection)}>${titleElement}${content}</svg>`;\n};\n\n// Remove svg tags\nconst getSvgContent = (svg: string): string => svg.replace(/<(\\/?)svg([^>]*)>/g, \"\").trim();\n\nexport const Icon = ({ svg, allyTitle, className, size = DEFAULT_SIZE, ...props }: IconProps) => {\n  const svgString = createSvg({\n    content: getSvgContent(svg.svg),\n    title: allyTitle,\n  });\n\n  const classes = cx(rootClassName, `${rootClassName}--${size}`, className);\n\n  return <span className={classes} dangerouslySetInnerHTML={{ __html: svgString }} {...props} />;\n};\n\nIcon.displayName = \"Icon\";\n"],"names":["hasOwn","classNames","classes","i","arg","appendClass","parseValue","key","value","newClass","module","cx","c","styles","rootClassName","DEFAULT_SIZE","getAttributesString","attributeCollection","attr","item","createSvg","content","title","titleElement","getSvgContent","svg","Icon","allyTitle","className","size","props","svgString","jsx"],"mappings":";;;;;;;;AAOA,KAAC,WAAY;AAGZ,UAAIA,IAAS,CAAA,EAAG;AAEhB,eAASC,IAAc;AAGtB,iBAFIC,IAAU,IAELC,IAAI,GAAGA,IAAI,UAAU,QAAQA,KAAK;AAC1C,cAAIC,IAAM,UAAUD,CAAC;AACrB,UAAIC,MACHF,IAAUG,EAAYH,GAASI,EAAW,KAAK,MAAMF,CAAG,CAAC;AAAA,QAE7D;AAEE,eAAOF;AAAA,MACT;AAEC,eAASI,EAAYF,GAAK;AACzB,YAAI,OAAOA,KAAQ,YAAY,OAAOA,KAAQ;AAC7C,iBAAO,QAAQ,KAAKA,CAAG,KAAKA;AAG7B,YAAI,OAAOA,KAAQ;AAClB,iBAAO;AAGR,YAAI,MAAM,QAAQA,CAAG;AACpB,iBAAOH,EAAW,MAAM,MAAMG,CAAG;AAGlC,YAAIA,EAAI,aAAa,OAAO,UAAU,YAAY,CAACA,EAAI,SAAS,SAAQ,EAAG,SAAS,eAAe;AAClG,iBAAOA,EAAI,SAAQ;AAGpB,YAAIF,IAAU;AAEd,iBAASK,KAAOH;AACf,UAAIJ,EAAO,KAAKI,GAAKG,CAAG,KAAKH,EAAIG,CAAG,MACnCL,IAAUG,EAAYH,GAAS,QAAQ,KAAKK,CAAG,KAAKA,CAAG;AAIzD,eAAOL;AAAA,MACT;AAEC,eAASG,EAAaG,GAAOC,GAAU;AACtC,eAAKA,IAIDD,IACIA,IAAQ,MAAMC,IAGfD,IAAQC,IAPPD;AAAA,MAQV;AAEC,MAAqCE,EAAO,WAC3CT,EAAW,UAAUA,GACrBS,YAAiBT,KAOjB,OAAO,aAAa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