{"version":3,"file":"kendo.html.icon.js","names":["__meta__","id","name","category","description","depends","$","undefined$1","kendo","window","extend","HTMLBase","html","KI_PREFFIX","KSVG_PREFFIX","FLIP_PREFIX","FLIP_HORIZONTAL","FLIP_VERTICAL","ICON_TYPES","svg","element","options","HTMLSvgIcon","font","HTMLFontIcon","FLIP_CLASSES","default","horizontal","vertical","both","HTMLBaseIcon","init","fn","call","this","_wrapper","size","themeColor","flip","iconClass","stylingOptions","_addClasses","that","previouslyAddedClasses","wrapper","data","map","option","cssProperties","getValidClass","widget","propName","value","prefix","fill","fillMode","removeClass","filter","x","_className","join","concat","addClass","icon","currentIconClass","className","split","find","includes","startsWith","empty","svgElm","regex","iconNameMatch","match","replace","isString","toUpperCase","ui","svgIcons","attr","isPlainObject","viewBox","focusable","xmlns","content","append","outerHTML","renderIcon","isPresent","type","defaults","iconType","isFunction","getIconRenderer","registerPrefix","registerValues","prop","values","sizeValues","jQuery","kendo$1"],"sources":["kendo.html.icon.js"],"mappings":"MAAO,uBAEP,IAAIA,SAAW,CACXC,GAAI,YACJC,KAAM,YACNC,SAAU,MACVC,YAAa,4DACbC,QAAS,CAAC,eAGd,SAAUC,EAAGC,GACT,IAAIC,EAAQC,OAAOD,MACfE,EAASJ,EAAEI,OACXC,EAAWH,EAAMI,KAAKD,SAGtBE,EAAa,OAEbC,EAAe,WAEfC,EAAc,UACdC,EAAkB,GAAGD,KACrBE,EAAgB,GAAGF,KAInBG,EAAa,CACbC,IAAO,CAACC,EAASC,IAAY,IAAIC,EAAYF,EAASC,GACtDE,KAAQ,CAACH,EAASC,IAAY,IAAIG,EAAaJ,EAASC,IAGxDI,EAAe,CACfC,QAAS,GACTC,WAAYX,EACZY,SAAUX,EACVY,KAAM,GAAGb,KAAmBC,KA8B5Ba,EAAenB,EAASD,OAAO,CAC/BqB,KAAM,SAASX,EAASC,GAEpBV,EAASqB,GAAGD,KAAKE,KADNC,KACiBd,EAASC,GAD1Ba,KAENC,UACT,EACAd,QAAS,CACLn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U,MAAO,CAAC,UAAW,OAAQ,CAAC,WAAY,WACrH,CACCoC,KAAM,aACNC,OAAQ,CAAC,UAAW,YAAa,WAAY,UAAW,OAAQ,UAAW,UAAW,QAAS,OAAQ,QAAS,aAEvH,CA/ND,CA+NGzF,OAAOD,MAAM4F,QAChB,IAAIC,QAAU7F,aAEL6F","sourcesContent":["import './kendo.html.base.js';\n\nvar __meta__ = {\n id: \"html.icon\",\n name: \"Html.Icon\",\n category: \"web\",\n description: \"HTML font icon rendering utility for Kendo UI for jQuery.\",\n depends: [\"html.base\"]\n};\n\n(function($, undefined$1) {\n var kendo = window.kendo,\n extend = $.extend,\n HTMLBase = kendo.html.HTMLBase;\n\n var KFONTICON = 'k-icon k-font-icon';\n var KI_PREFFIX = 'k-i-';\n var KSVGICON = 'k-icon k-svg-icon';\n var KSVG_PREFFIX = 'k-svg-i-';\n\n var FLIP_PREFIX = 'k-flip-';\n var FLIP_HORIZONTAL = `${FLIP_PREFIX}h`;\n var FLIP_VERTICAL = `${FLIP_PREFIX}v`;\n\n var THEME_COLOR_PREFIX = 'k-color-';\n\n var ICON_TYPES = {\n 'svg': (element, options) => new HTMLSvgIcon(element, options),\n 'font': (element, options) => new HTMLFontIcon(element, options)\n };\n\n var FLIP_CLASSES = {\n default: '',\n horizontal: FLIP_HORIZONTAL,\n vertical: FLIP_VERTICAL,\n both: `${FLIP_HORIZONTAL} ${FLIP_VERTICAL}`\n };\n\n var renderIcon = function(element, options) {\n if (!element || $.isPlainObject(element) || kendo.isString(element)) {\n options = element;\n element = $(\"\");\n }\n\n if (kendo.isString(options)) {\n options = {\n icon: options\n };\n }\n\n if (!kendo.isPresent(options.type)) {\n options.type = kendo.defaults.iconType ? kendo.defaults.iconType : 'svg';\n }\n\n if (kendo.isFunction(options.type)) {\n return options.type(element, options);\n }\n\n if (!kendo.isFunction(ICON_TYPES[options.type])) {\n return null;\n }\n\n return (ICON_TYPES[options.type](element, options)).html();\n };\n\n var HTMLBaseIcon = HTMLBase.extend({\n init: function(element, options) {\n var that = this;\n HTMLBase.fn.init.call(that, element, options);\n that._wrapper();\n },\n options: {\n name: 'HTMLIcon',\n size: 'none',\n themeColor: 'none',\n flip: 'default',\n iconClass: '',\n stylingOptions: [ 'size', 'themeColor', 'fill' ]\n },\n _wrapper: function() {\n var that = this;\n\n that._addClasses();\n },\n _addClasses: function() {\n var that = this,\n options = that.options,\n stylingOptions = options.stylingOptions,\n previouslyAddedClasses = that.wrapper.data(\"added-classes\");\n\n stylingOptions = stylingOptions.map(function(option) {\n if (option === 'themeColor') {\n return kendo.cssProperties.getValidClass({\n widget: options.name,\n propName: option,\n value: options[option],\n prefix: THEME_COLOR_PREFIX\n });\n }\n\n if (option === 'fill') {\n return FLIP_CLASSES[options.flip];\n }\n\n return kendo.cssProperties.getValidClass({\n widget: options.name,\n propName: option,\n value: options[option],\n fill: options.fillMode\n });\n });\n\n if (previouslyAddedClasses) {\n that.wrapper.removeClass(previouslyAddedClasses.filter(x => x !== that._className).join(\" \"));\n }\n\n that.wrapper.data(\"added-classes\", stylingOptions.concat([that._className]));\n that.wrapper.addClass(stylingOptions.join(\" \"));\n }\n });\n\n var HTMLFontIcon = HTMLBaseIcon.extend({\n init: function(element, options) {\n HTMLBaseIcon.fn.init.call(this, element, options);\n },\n options: extend({}, HTMLBaseIcon.fn.options, {\n name: 'HTMLFontIcon',\n icon: null\n }),\n _wrapper: function() {\n var that = this,\n // Find if there is an existing k-i- class appended to the element.\n currentIconClass = that.element[0].className.split(\" \").find(x => x.includes(KI_PREFFIX)),\n className = that.options.icon ? `${that.options.icon.startsWith(KI_PREFFIX) ? \"\" : KI_PREFFIX}${that.options.icon}` : \"\";\n\n that._className = className;\n that.wrapper = that.element\n .addClass(KFONTICON)\n .removeClass(currentIconClass) // Remove any existing icons.\n .addClass(className)\n .addClass(that.options.iconClass || '');\n\n HTMLBaseIcon.fn._wrapper.call(this);\n }\n });\n\n var HTMLSvgIcon = HTMLBaseIcon.extend({\n init: function(element, options) {\n // Ensure that the inner contents of the wrapping span element are always removed for re-rendering purposes.\n element.empty();\n HTMLBaseIcon.fn.init.call(this, element, options);\n },\n options: extend({}, HTMLBaseIcon.fn.options, {\n name: 'HTMLSVGIcon',\n icon: null\n }),\n _wrapper: function() {\n var that = this,\n icon = that.options.icon,\n iconClass = that.options.iconClass,\n // Find if there is an existing k-svg-i- class appended to the element.\n currentIconClass = that.element[0].className.split(\" \").find(x => x.includes(KSVG_PREFFIX)),\n svgElm = $(''),\n className;\n\n if (!icon && iconClass) {\n // match k-i-(some-icon-name)\n const regex = /k-i-(\\w+(?:-\\w+)*)/;\n let iconNameMatch = iconClass.match(regex);\n if (iconNameMatch) {\n icon = iconNameMatch[1];\n iconClass = iconClass.replace(iconNameMatch[0], \"\");\n }\n }\n\n if (kendo.isString(icon)) {\n // remove k-i- and convert kebab-case-icon to camelCaseIcon\n icon = icon.replace('k-i-', '').replace(/-./g, x=>x[1].toUpperCase());\n icon = kendo.ui.svgIcons[icon] || kendo.ui.svgIcons[`${icon}Icon`];\n }\n\n className = icon && icon.name ? `${KSVG_PREFFIX}${icon.name}` : '';\n that._className = className;\n\n that.wrapper = that.element\n .addClass(KSVGICON)\n .removeClass(currentIconClass) // Remove any existing icons.\n .addClass(className)\n .addClass(iconClass || '')\n .attr(\"aria-hidden\", true);\n\n if ($.isPlainObject(icon)) {\n svgElm.attr('viewBox', icon.viewBox || '')\n .attr({\n 'viewBox': icon.viewBox || '',\n 'focusable': 'false',\n 'xmlns': 'http://www.w3.org/2000/svg'\n })\n .html(icon.content || '');\n\n that.wrapper.append(svgElm[0].outerHTML);\n }\n\n HTMLBaseIcon.fn._wrapper.call(this);\n }\n });\n\n $.extend(kendo.html, {\n renderIcon: renderIcon,\n HTMLFontIcon: HTMLFontIcon,\n HTMLSvgIcon: HTMLSvgIcon,\n getIconRenderer: (type) => ICON_TYPES[type]\n });\n\n kendo.cssProperties.registerPrefix(\"HTMLFontIcon\", \"k-icon-\");\n\n kendo.cssProperties.registerValues(\"HTMLFontIcon\", [{\n prop: \"size\",\n values: kendo.cssProperties.sizeValues.concat([['xsmall', 'xs'], ['xlarge', 'xl'], ['xxlarge', 'xxl'], ['xxxlarge', 'xxxl']])\n }, {\n prop: \"themeColor\",\n values: ['primary', 'secondary', 'tertiary', 'inherit', 'info', 'success', 'warning', 'error', 'dark', 'light', 'inverse']\n }]);\n\n kendo.cssProperties.registerPrefix(\"HTMLSVGIcon\", \"k-icon-\");\n\n kendo.cssProperties.registerValues(\"HTMLSVGIcon\", [{\n prop: \"size\",\n values: kendo.cssProperties.sizeValues.concat([['xsmall', 'xs'], ['xlarge', 'xl'], ['xxlarge', 'xxl'], ['xxxlarge', 'xxxl']])\n }, {\n prop: \"themeColor\",\n values: ['primary', 'secondary', 'tertiary', 'inherit', 'info', 'success', 'warning', 'error', 'dark', 'light', 'inverse']\n }]);\n})(window.kendo.jQuery);\nvar kendo$1 = kendo;\n\nexport { kendo$1 as default };\n"]}