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AG,OAAO,CAAC,MAAM,CAAC;KACpC;SAAM,IAAI,WAAW,KAAK,OAAO,EAAE;QACnC,gBAAgB,GAAG,YAAY,CAAC,UAAU,CAAC;QAC3C,kBAAkB,GAAG,OAAO,CAAC,KAAK,CAAC;KACnC;SAAM,IAAI,WAAW,KAAK,MAAM,EAAE;QAClC,gBAAgB,GAAG,YAAY,CAAC,SAAS,CAAC;QAC1C,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC;KAClC;SAAM,IAAI,WAAW,KAAK,KAAK,EAAE;QACjC,gBAAgB,GAAG,YAAY,CAAC,QAAQ,CAAC;QACzC,kBAAkB,GAAG,OAAO,CAAC,GAAG,CAAC;KACjC;IAED,OAAO,CACN,aACC,OAAO,EAAE;YACR,KAAK,CAAC,OAAO,EAAE;YACf,kBAAkB;YAClB,YAAY,CAAC,SAAS;YACtB,gBAAgB;SAChB;QAED,aAAK,GAAG,EAAC,QAAQ;YACf,OAAO;YACP,IAAI,CAAC,CAAC,CAAC,CACP,2BACC,GAAG,EAAC,SAAS,IACT,oBAAoB,CAAC,IAAI,CAAC,IAC9B,OAAO,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE,YAAY,CAAC,YAAY,CAAC,KAEpD,OAAO,CACH,CACN,CAAC,CAAC,CAAC,IAAI,CACH,CACD,CACN,CAAC;AACH,CAAC,CAAC,CAAC;AAEH,eAAe,OAAO,CAAC","sourcesContent":["import { create, tsx } from '@dojo/framework/core/vdom';\nimport theme from '../middleware/theme';\n\nimport * as fixedCss from './styles/tooltip.m.css';\nimport * as css from '../theme/default/tooltip.m.css';\nimport { formatAriaProperties } from '../common/util';\nimport { RenderResult } from '@dojo/framework/core/interfaces';\n\nexport interface TooltipProperties {\n\t/** Custom aria attributes */\n\taria?: { [key: string]: string | null };\n\t/** Determines if this tooltip is visible */\n\topen?: boolean;\n\t/** Where this tooltip should render relative to its child */\n\torientation?: 'bottom' | 'left' | 'right' | 'top' | Orientation;\n}\n\nexport interface TooltipChildren {\n\ttrigger?: RenderResult;\n\tcontent: RenderResult;\n}\n\n/**\n * @deprecated this enum will be removed in the next major release\n */\nexport enum Orientation {\n\tbottom = 'bottom',\n\tleft = 'left',\n\tright = 'right',\n\ttop = 'top'\n}\n\nconst factory = create({ theme })\n\t.properties<TooltipProperties>()\n\t.children<TooltipChildren>();\n\nexport const Tooltip = factory(function Tooltip({ children, properties, middleware: { theme } }) {\n\tconst { open, aria = {}, orientation = 'right' } = properties();\n\tconst classes = theme.classes(css);\n\tconst fixedClasses = theme.classes(fixedCss);\n\tconst [{ trigger, content }] = children();\n\n\tlet fixedOrientation;\n\tlet classesOrientation;\n\n\tif (orientation === 'bottom') {\n\t\tfixedOrientation = fixedClasses.bottomFixed;\n\t\tclassesOrientation = classes.bottom;\n\t} else if (orientation === 'right') {\n\t\tfixedOrientation = fixedClasses.rightFixed;\n\t\tclassesOrientation = classes.right;\n\t} else if (orientation === 'left') {\n\t\tfixedOrientation = fixedClasses.leftFixed;\n\t\tclassesOrientation = classes.left;\n\t} else if (orientation === 'top') {\n\t\tfixedOrientation = fixedClasses.topFixed;\n\t\tclassesOrientation = classes.top;\n\t}\n\n\treturn (\n\t\t<div\n\t\t\tclasses={[\n\t\t\t\ttheme.variant(),\n\t\t\t\tclassesOrientation,\n\t\t\t\tfixedClasses.rootFixed,\n\t\t\t\tfixedOrientation\n\t\t\t]}\n\t\t>\n\t\t\t<div key=\"target\">\n\t\t\t\t{trigger}\n\t\t\t\t{open ? (\n\t\t\t\t\t<div\n\t\t\t\t\t\tkey=\"content\"\n\t\t\t\t\t\t{...formatAriaProperties(aria)}\n\t\t\t\t\t\tclasses={[classes.content, fixedClasses.contentFixed]}\n\t\t\t\t\t>\n\t\t\t\t\t\t{content}\n\t\t\t\t\t</div>\n\t\t\t\t) : null}\n\t\t\t</div>\n\t\t</div>\n\t);\n});\n\nexport default Tooltip;\n"]}