@gov-design-system-ce/components 0.0.64 → 0.0.65

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/dist/cjs/gov-icon.cjs.entry.js +1 -1
  2. package/dist/cjs/gov-tooltip.cjs.entry.js +7 -4
  3. package/dist/cjs/gov-tooltip.cjs.entry.js.map +1 -1
  4. package/dist/collection/components/gov-tooltip/gov-tooltip.js +7 -4
  5. package/dist/collection/components/gov-tooltip/gov-tooltip.js.map +1 -1
  6. package/dist/components/gov-accordion-item.js +1 -1
  7. package/dist/components/gov-attachments-item.js +1 -1
  8. package/dist/components/gov-button.js +1 -1
  9. package/dist/components/gov-card.js +1 -1
  10. package/dist/components/gov-form-autocomplete.js +1 -1
  11. package/dist/components/gov-form-checkbox.js +1 -1
  12. package/dist/components/gov-form-file.js +1 -1
  13. package/dist/components/gov-form-input.js +1 -1
  14. package/dist/components/gov-form-multi-select.js +1 -1
  15. package/dist/components/gov-form-select.js +1 -1
  16. package/dist/components/gov-icon.js +1 -1
  17. package/dist/components/gov-infobar.js +1 -1
  18. package/dist/components/gov-loading.js +1 -1
  19. package/dist/components/gov-modal.js +1 -1
  20. package/dist/components/gov-pagination.js +1 -1
  21. package/dist/components/gov-prompt.js +1 -1
  22. package/dist/components/gov-side-nav-item.js +1 -1
  23. package/dist/components/gov-tabs.js +1 -1
  24. package/dist/components/gov-tile.js +1 -1
  25. package/dist/components/gov-toast.js +1 -1
  26. package/dist/components/gov-tooltip-content.js +1 -1
  27. package/dist/components/gov-tooltip.js +1 -1
  28. package/dist/components/gov-tooltip.js.map +1 -1
  29. package/dist/components/gov-wizard-item.js +1 -1
  30. package/dist/components/{p-8b53e056.js → p-20072d33.js} +2 -2
  31. package/dist/components/{p-e196ff42.js → p-9e0bf80f.js} +2 -2
  32. package/dist/components/{p-40b51fd3.js → p-9e3c2bf4.js} +2 -2
  33. package/dist/components/{p-71a4c88d.js → p-b9d84775.js} +2 -2
  34. package/dist/components/{p-ddf6db05.js → p-dc1e2f70.js} +2 -2
  35. package/dist/components/{p-202b7b42.js → p-f775857a.js} +2 -2
  36. package/dist/core/core.esm.js +1 -1
  37. package/dist/core/{p-05e4822a.entry.js → p-39d79238.entry.js} +2 -2
  38. package/dist/core/p-603a9d99.entry.js +2 -0
  39. package/dist/core/p-603a9d99.entry.js.map +1 -0
  40. package/dist/esm/gov-icon.entry.js +1 -1
  41. package/dist/esm/gov-tooltip.entry.js +7 -4
  42. package/dist/esm/gov-tooltip.entry.js.map +1 -1
  43. package/dist/hydrate/index.js +7 -4
  44. package/package.json +2 -2
  45. package/dist/core/p-b946cd3f.entry.js +0 -2
  46. package/dist/core/p-b946cd3f.entry.js.map +0 -1
  47. /package/dist/components/{p-8b53e056.js.map → p-20072d33.js.map} +0 -0
  48. /package/dist/components/{p-e196ff42.js.map → p-9e0bf80f.js.map} +0 -0
  49. /package/dist/components/{p-40b51fd3.js.map → p-9e3c2bf4.js.map} +0 -0
  50. /package/dist/components/{p-71a4c88d.js.map → p-b9d84775.js.map} +0 -0
  51. /package/dist/components/{p-ddf6db05.js.map → p-dc1e2f70.js.map} +0 -0
  52. /package/dist/components/{p-202b7b42.js.map → p-f775857a.js.map} +0 -0
  53. /package/dist/core/{p-05e4822a.entry.js.map → p-39d79238.entry.js.map} +0 -0
@@ -70,6 +70,9 @@ const GovTooltip = class {
70
70
  this.host.addEventListener("click", e => {
71
71
  e.preventDefault();
72
72
  this.persist = true;
73
+ if (this.content) {
74
+ this.content.setAttribute("persist", "true");
75
+ }
73
76
  this.showTooltip();
74
77
  });
75
78
  this.host.addEventListener("focus", e => {
@@ -163,14 +166,14 @@ const GovTooltip = class {
163
166
  this.content.setAttribute("position", TooltipPosition.BOTTOM);
164
167
  this.content.style.top = (triggerPos.top + (trgHeight + offset)) + "px";
165
168
  }
169
+ this.content.setAttribute("is-visible", "true");
170
+ this.content.style.opacity = '1';
166
171
  }
167
172
  showTooltip() {
168
173
  if (this.content) {
174
+ this.content.style.opacity = '0';
175
+ this.content.hidden = false;
169
176
  this.verifyPositionSpace();
170
- this.content.setAttribute("is-visible", "true");
171
- if (this.persist) {
172
- this.content.setAttribute("persist", "true");
173
- }
174
177
  }
175
178
  }
176
179
  hideTooltip() {
@@ -1 +1 @@
1
- {"file":"gov-tooltip.entry.js","mappings":";;;;;;;;;;AAAA,MAAM,aAAa,GAAG,4kBAA4kB;;MCoBrlB,UAAU;EAMrB;;IAHiB,qBAAgB,GAAG,SAAS,CAAA;IAC5B,cAAS,GAAG,SAAS,CAAA;mBAYU,cAAc,CAAC,OAAO;gBAI5B,WAAW,CAAC,EAAE;oBAID,OAAO;mBAI3B,SAAS;;gBAQI,SAAS;mBAEtC,KAAK;IA/BtB,IAAI,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IAC3B,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC,YAAY,CAAC,CAAA;IACvC,IAAI,CAAC,gBAAgB,GAAG,QAAQ,CAAC,mBAAmB,CAAC,CAAA;GACtD;EA+BD,eAAe,CAAC,QAAgB;IAC9B,YAAY,CAAC,cAAc,EAAE,QAAQ,EAAE,YAAY,CAAC,IAAI,CAAC,CAAA;GAC1D;EAGD,YAAY,CAAC,QAAgB;IAC3B,YAAY,CAAC,WAAW,EAAE,QAAQ,EAAE,YAAY,CAAC,IAAI,CAAC,CAAA;GACvD;EAGD,gBAAgB,CAAC,QAAgB;IAC/B,YAAY,CAAC,eAAe,EAAE,QAAQ,EAAE,YAAY,CAAC,IAAI,CAAC,CAAA;GAC3D;EAED,iBAAiB;IACf,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;IAClC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IAC5B,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;IAEpC,IAAI,CAAC,oBAAoB,EAAE,CAAA;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CAAC,YAAY,CAAC,YAAY,EAAE,MAAM,CAAC,CAAA;MAC/C,IAAI,IAAI,CAAC,OAAO,EAAE;QAChB,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,SAAS,EAAE,MAAM,CAAC,CAAA;OAC7C;KACF;GACF;EAEO,WAAW;IACjB,IAAI,IAAI,CAAC,OAAO,EAAE;MAChB,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,YAAY,EAAE,OAAO,CAAC,CAAA;MAChD,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,SAAS,EAAE,OAAO,CAAC,CAAA;KAC9C;GACF;EAEO,aAAa;IACnB,MAAM,SAAS,GAAG,QAAQ,CAAC,cAAc,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAA;IAChE,IAAI,SAAS,EAAE;MACb,SAAS,CAAC,MAAM,EAAE,CAAA;KACnB;GACF;EAED,MAAM;;IACJ,QACE,EAAC,IAAI,IACH,EAAE,EAAE,IAAI,CAAC,SAAS,EAClB,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,EACxC,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,QAAQ,EAAE,CAAC,sBACO,MAAA,IAAI,CAAC,UAAU,mCAAI,IAAI,CAAC,gBAAgB,IAC1D,eAAO,CACF,EACR;GACF;;;;EAMD,MAAM,IAAI;IACR,IAAI,CAAC,WAAW,EAAE,CAAA;GACnB;;;;EAMD,MAAM,IAAI;IACR,IAAI,CAAC,OAAO,GAAG,KAAK,CAAA;IACpB,IAAI,CAAC,WAAW,EAAE,CAAA;GACnB;;;;;;;;;;;;","names":[],"sources":["../../../packages/core/src/components/gov-tooltip/gov-tooltip.scss?tag=gov-tooltip","../../../packages/core/src/components/gov-tooltip/gov-tooltip.tsx"],"sourcesContent":["/*\n * Tooltip\n */\n\n$class: \".gov-tooltip\";\n\n#{$class} {\n\tposition: relative;\n\tdisplay: inline-block;\n\tborder-bottom: 1px dashed currentcolor;\n\tcolor: color(\"primary\");\n\tcursor: help;\n\n\t@include parameter(\"icon\") {\n\t\tdisplay: inline-flex;\n\t\tborder-bottom: 0;\n\t}\n}\n","import {Component, Element, h, Host, Method, Prop, State, Watch} from \"@stencil/core\"\nimport {validateProp} from \"../../helpers/Validate/props\"\nimport {\n TooltipClass,\n TooltipContentClass,\n TooltipPosition,\n TooltipPositionType,\n TooltipSize,\n TooltipSizeType,\n TooltipVariant,\n TooltipVariantType,\n} from \"./constants\"\nimport {createID} from \"../../utils/string.utils\"\nimport {govHost} from \"../../helpers/Dom/template\"\nimport {GovHost} from \"../../helpers/Dom/template.types\"\n\n@Component({\n tag: \"gov-tooltip\",\n styleUrl: \"gov-tooltip.scss\",\n})\nexport class GovTooltip {\n private h: GovHost\n private content: HTMLGovTooltipContentElement\n private readonly tooltipContentId = undefined\n private readonly tooltipId = undefined\n\n constructor() {\n this.h = govHost(this.host)\n this.tooltipId = createID(\"GovTooltip\")\n this.tooltipContentId = createID(\"GovContentTooltip\")\n }\n\n @Element() host: HTMLGovTooltipElement\n /**\n * Style variation of the tooltip\n */\n @Prop() readonly variant?: TooltipVariantType = TooltipVariant.PRIMARY\n /**\n * Tooltip’s size.\n */\n @Prop() readonly size?: TooltipSizeType = TooltipSize._M\n /**\n * Tooltip display position\n */\n @Prop({mutable: true}) position: TooltipPositionType = \"right\"\n /**\n * Information contained in the tooltip\n */\n @Prop() readonly message: string = undefined\n /**\n * Custom tooltip identifier.\n */\n @Prop({attribute: \"identifier\"}) readonly identifier: string\n /**\n * Trigger is just an icon\n */\n @Prop({reflect: true}) readonly icon: boolean = undefined\n\n @State() persist = false\n\n @Watch(\"variant\")\n validateVariant(newValue: string): void {\n validateProp(TooltipVariant, newValue, TooltipClass.root)\n }\n\n @Watch(\"size\")\n validateSize(newValue: string): void {\n validateProp(TooltipSize, newValue, TooltipClass.root)\n }\n\n @Watch(\"position\")\n validatePosition(newValue: string): void {\n validateProp(TooltipPosition, newValue, TooltipClass.root)\n }\n\n componentWillLoad(): void {\n this.validateVariant(this.variant)\n this.validateSize(this.size)\n this.validatePosition(this.position)\n\n this.createContentWrapper()\n this.registerListeners()\n }\n\n disconnectedCallback() {\n this.removeContent()\n }\n\n private createContentWrapper() {\n const hasContentInside = this.host.querySelector(TooltipContentClass.root) as HTMLGovTooltipContentElement\n if (hasContentInside) {\n this.content = hasContentInside\n } else {\n this.content = document.createElement(TooltipContentClass.root) as HTMLGovTooltipContentElement\n this.content.innerHTML = this.message\n this.host.appendChild(this.content)\n }\n\n const trigger = this.host.getBoundingClientRect()\n this.content.style.left = trigger.left + 'px'\n this.content.style.top = trigger.top + 'px'\n this.content.style.visibility = 'hidden'\n\n this.content.setAttribute(\"id\", this.identifier ?? this.tooltipContentId)\n this.content.setAttribute(\"parent-id\", this.tooltipId)\n this.content.setAttribute(\"variant\", this.variant)\n this.content.setAttribute(\"size\", this.size)\n document.body.appendChild(this.content)\n }\n\n private registerListeners() {\n this.host.addEventListener(\"click\", e => {\n e.preventDefault()\n this.persist = true\n this.showTooltip()\n })\n this.host.addEventListener(\"focus\", e => {\n e.preventDefault()\n this.showTooltip()\n })\n this.host.addEventListener(\"blur\", e => {\n e.preventDefault()\n if (this.persist === false) {\n this.hideTooltip()\n }\n })\n this.host.addEventListener(\"mouseenter\", e => {\n e.preventDefault()\n this.showTooltip()\n })\n this.host.addEventListener(\"mouseleave\", e => {\n e.preventDefault()\n if (this.persist === false) {\n this.hideTooltip()\n }\n })\n }\n\n private verifyPositionSpace() {\n const offset = 12\n const windowWidth = window.innerWidth\n const trigger = this.host.getBoundingClientRect()\n const trgWidth = this.host.offsetWidth\n const trgHeight = this.host.offsetHeight\n const contentWidth = this.content.offsetWidth\n const contentHeight = this.content.offsetHeight\n const triggerPos = {\n left: trigger.left + document.documentElement.scrollLeft,\n top: trigger.top + document.documentElement.scrollTop,\n }\n\n const isRightSpace = ((triggerPos.left + offset + trigger.width) + contentWidth) <= windowWidth;\n const isLeftSpace = triggerPos.left > contentWidth;\n\n // LEFT/RIGHT\n if (this.position === TooltipPosition.LEFT || this.position === TooltipPosition.RIGHT) {\n this.content.style.top = (triggerPos.top - ((contentHeight - trgHeight) / 2)) + \"px\";\n if (isRightSpace === false && isLeftSpace === false) {\n this.position = TooltipPosition.TOP\n this.content.setAttribute(\"position\", TooltipPosition.TOP)\n }\n if (isLeftSpace && isRightSpace === false && this.position === TooltipPosition.RIGHT) {\n this.position = TooltipPosition.LEFT\n }\n if (isRightSpace && isLeftSpace === false && this.position === TooltipPosition.LEFT) {\n this.position = TooltipPosition.RIGHT\n }\n }\n if (this.position === TooltipPosition.RIGHT) {\n this.content.setAttribute(\"position\", TooltipPosition.RIGHT)\n this.content.style.left = (triggerPos.left + offset + trigger.width) + \"px\"\n }\n if (this.position === TooltipPosition.LEFT) {\n this.content.setAttribute(\"position\", TooltipPosition.LEFT)\n this.content.style.left = (triggerPos.left - (contentWidth + offset)) + \"px\"\n }\n\n // LEFT/RIGHT FOR TOP/BOTTOM\n if (this.position === TooltipPosition.TOP || this.position === TooltipPosition.BOTTOM) {\n if (contentWidth > trgWidth) {\n let leftPosition = (triggerPos.left - ((contentWidth - trgWidth) / 2));\n const isNotLeftSpace = leftPosition < 0;\n const isNotRightSpace = (leftPosition + contentWidth) > windowWidth;\n if (isNotLeftSpace && isNotRightSpace) {\n this.content.style.width = \"auto\";\n this.content.style.left = offset + \"px\";\n this.content.style.right = offset + \"px\";\n } else {\n if (isNotLeftSpace) {\n leftPosition = offset\n }\n if (isNotRightSpace) {\n leftPosition = leftPosition - ((windowWidth - (leftPosition + contentWidth + offset)) * -1)\n }\n this.content.style.left = leftPosition + \"px\"\n }\n } else {\n const leftPosition = (triggerPos.left + ((trgWidth - contentWidth) / 2))\n\n this.content.style.left = leftPosition + \"px\"\n }\n }\n if (this.position === TooltipPosition.TOP) {\n this.content.setAttribute(\"position\", TooltipPosition.TOP)\n this.content.style.top = (triggerPos.top - (contentHeight + offset)) + \"px\"\n }\n if (this.position === TooltipPosition.BOTTOM) {\n this.content.setAttribute(\"position\", TooltipPosition.BOTTOM)\n this.content.style.top = (triggerPos.top + (trgHeight + offset)) + \"px\"\n }\n }\n\n private showTooltip() {\n if (this.content) {\n this.verifyPositionSpace()\n this.content.setAttribute(\"is-visible\", \"true\")\n if (this.persist) {\n this.content.setAttribute(\"persist\", \"true\")\n }\n }\n }\n\n private hideTooltip() {\n if (this.content) {\n this.content.setAttribute(\"is-visible\", \"false\")\n this.content.setAttribute(\"persist\", \"false\")\n }\n }\n\n private removeContent() {\n const contentEl = document.getElementById(this.tooltipContentId)\n if (contentEl) {\n contentEl.remove()\n }\n }\n\n render() {\n return (\n <Host\n id={this.tooltipId}\n class={this.h.classes(TooltipClass.root)}\n position={this.position}\n tabindex={0}\n aria-describedby={this.identifier ?? this.tooltipContentId}>\n <slot/>\n </Host>\n )\n }\n\n /**\n * Showing the modal\n */\n @Method()\n async show(): Promise<void> {\n this.showTooltip()\n }\n\n /**\n * Hiding the modal\n */\n @Method()\n async hide(): Promise<void> {\n this.persist = false\n this.hideTooltip()\n }\n}\n"],"version":3}
1
+ {"file":"gov-tooltip.entry.js","mappings":";;;;;;;;;;AAAA,MAAM,aAAa,GAAG,4kBAA4kB;;MCoBrlB,UAAU;EAMtB;;IAHiB,qBAAgB,GAAG,SAAS,CAAA;IAC5B,cAAS,GAAG,SAAS,CAAA;mBAYU,cAAc,CAAC,OAAO;gBAI5B,WAAW,CAAC,EAAE;oBAID,OAAO;mBAI3B,SAAS;;gBAQI,SAAS;mBAEtC,KAAK;IA/BvB,IAAI,CAAC,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IAC3B,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC,YAAY,CAAC,CAAA;IACvC,IAAI,CAAC,gBAAgB,GAAG,QAAQ,CAAC,mBAAmB,CAAC,CAAA;GACrD;EA+BD,eAAe,CAAC,QAAgB;IAC/B,YAAY,CAAC,cAAc,EAAE,QAAQ,EAAE,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;;IACL,QACC,EAAC,IAAI,IACJ,EAAE,EAAE,IAAI,CAAC,SAAS,EAClB,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,EACxC,QAAQ,EAAE,IAAI,CAAC,QAAQ,EACvB,QAAQ,EAAE,CAAC,sBACO,MAAA,IAAI,CAAC,UAAU,mCAAI,IAAI,CAAC,gBAAgB,IAC1D,eAAO,CACD,EACP;GACD;;;;EAMD,MAAM,IAAI;IACT,IAAI,CAAC,WAAW,EAAE,CAAA;GAClB;;;;EAMD,MAAM,IAAI;IACT,IAAI,CAAC,OAAO,GAAG,KAAK,CAAA;IACpB,IAAI,CAAC,WAAW,EAAE,CAAA;GAClB;;;;;;;;;;;;","names":[],"sources":["../../../packages/core/src/components/gov-tooltip/gov-tooltip.scss?tag=gov-tooltip","../../../packages/core/src/components/gov-tooltip/gov-tooltip.tsx"],"sourcesContent":["/*\n * Tooltip\n */\n\n$class: \".gov-tooltip\";\n\n#{$class} {\n\tposition: relative;\n\tdisplay: inline-block;\n\tborder-bottom: 1px dashed currentcolor;\n\tcolor: color(\"primary\");\n\tcursor: help;\n\n\t@include parameter(\"icon\") {\n\t\tdisplay: inline-flex;\n\t\tborder-bottom: 0;\n\t}\n}\n","import {Component, Element, h, Host, Method, Prop, State, Watch} from \"@stencil/core\"\nimport {validateProp} from \"../../helpers/Validate/props\"\nimport {\n\tTooltipClass,\n\tTooltipContentClass,\n\tTooltipPosition,\n\tTooltipPositionType,\n\tTooltipSize,\n\tTooltipSizeType,\n\tTooltipVariant,\n\tTooltipVariantType,\n} from \"./constants\"\nimport {createID} from \"../../utils/string.utils\"\nimport {govHost} from \"../../helpers/Dom/template\"\nimport {GovHost} from \"../../helpers/Dom/template.types\"\n\n@Component({\n\ttag: \"gov-tooltip\",\n\tstyleUrl: \"gov-tooltip.scss\",\n})\nexport class GovTooltip {\n\tprivate h: GovHost\n\tprivate content: HTMLGovTooltipContentElement\n\tprivate readonly tooltipContentId = undefined\n\tprivate readonly tooltipId = undefined\n\n\tconstructor() {\n\t\tthis.h = govHost(this.host)\n\t\tthis.tooltipId = createID(\"GovTooltip\")\n\t\tthis.tooltipContentId = createID(\"GovContentTooltip\")\n\t}\n\n\t@Element() host: HTMLGovTooltipElement\n\t/**\n\t * Style variation of the tooltip\n\t */\n\t@Prop() readonly variant?: TooltipVariantType = TooltipVariant.PRIMARY\n\t/**\n\t * Tooltip’s size.\n\t */\n\t@Prop() readonly size?: TooltipSizeType = TooltipSize._M\n\t/**\n\t * Tooltip display position\n\t */\n\t@Prop({mutable: true}) position: TooltipPositionType = \"right\"\n\t/**\n\t * Information contained in the tooltip\n\t */\n\t@Prop() readonly message: string = undefined\n\t/**\n\t * Custom tooltip identifier.\n\t */\n\t@Prop({attribute: \"identifier\"}) readonly identifier: string\n\t/**\n\t * Trigger is just an icon\n\t */\n\t@Prop({reflect: true}) readonly icon: boolean = undefined\n\n\t@State() persist = false\n\n\t@Watch(\"variant\")\n\tvalidateVariant(newValue: string): void {\n\t\tvalidateProp(TooltipVariant, newValue, TooltipClass.root)\n\t}\n\n\t@Watch(\"size\")\n\tvalidateSize(newValue: string): void {\n\t\tvalidateProp(TooltipSize, newValue, TooltipClass.root)\n\t}\n\n\t@Watch(\"position\")\n\tvalidatePosition(newValue: string): void {\n\t\tvalidateProp(TooltipPosition, newValue, TooltipClass.root)\n\t}\n\n\tcomponentWillLoad(): void {\n\t\tthis.validateVariant(this.variant)\n\t\tthis.validateSize(this.size)\n\t\tthis.validatePosition(this.position)\n\n\t\tthis.createContentWrapper()\n\t\tthis.registerListeners()\n\t}\n\n\tdisconnectedCallback() {\n\t\tthis.removeContent()\n\t}\n\n\tprivate createContentWrapper() {\n\t\tconst hasContentInside = this.host.querySelector(TooltipContentClass.root) as HTMLGovTooltipContentElement\n\t\tif (hasContentInside) {\n\t\t\tthis.content = hasContentInside\n\t\t} else {\n\t\t\tthis.content = document.createElement(TooltipContentClass.root) as HTMLGovTooltipContentElement\n\t\t\tthis.content.innerHTML = this.message\n\t\t\tthis.host.appendChild(this.content)\n\t\t}\n\n\t\tconst trigger = this.host.getBoundingClientRect()\n\t\tthis.content.style.left = trigger.left + 'px'\n\t\tthis.content.style.top = trigger.top + 'px'\n\t\tthis.content.style.visibility = 'hidden'\n\n\t\tthis.content.setAttribute(\"id\", this.identifier ?? this.tooltipContentId)\n\t\tthis.content.setAttribute(\"parent-id\", this.tooltipId)\n\t\tthis.content.setAttribute(\"variant\", this.variant)\n\t\tthis.content.setAttribute(\"size\", this.size)\n\t\tdocument.body.appendChild(this.content)\n\t}\n\n\tprivate registerListeners() {\n\t\tthis.host.addEventListener(\"click\", e => {\n\t\t\te.preventDefault()\n\t\t\tthis.persist = true\n\t\t\tif (this.content) {\n\t\t\t\tthis.content.setAttribute(\"persist\", \"true\")\n\t\t\t}\n\t\t\tthis.showTooltip()\n\t\t})\n\t\tthis.host.addEventListener(\"focus\", e => {\n\t\t\te.preventDefault()\n\t\t\tthis.showTooltip()\n\t\t})\n\t\tthis.host.addEventListener(\"blur\", e => {\n\t\t\te.preventDefault()\n\t\t\tif (this.persist === false) {\n\t\t\t\tthis.hideTooltip()\n\t\t\t}\n\t\t})\n\t\tthis.host.addEventListener(\"mouseenter\", e => {\n\t\t\te.preventDefault()\n\t\t\tthis.showTooltip()\n\t\t})\n\t\tthis.host.addEventListener(\"mouseleave\", e => {\n\t\t\te.preventDefault()\n\t\t\tif (this.persist === false) {\n\t\t\t\tthis.hideTooltip()\n\t\t\t}\n\t\t})\n\t}\n\n\tprivate verifyPositionSpace() {\n\t\tconst offset = 12\n\t\tconst windowWidth = window.innerWidth\n\t\tconst trigger = this.host.getBoundingClientRect()\n\t\tconst trgWidth = this.host.offsetWidth\n\t\tconst trgHeight = this.host.offsetHeight\n\t\tconst contentWidth = this.content.offsetWidth\n\t\tconst contentHeight = this.content.offsetHeight\n\t\tconst triggerPos = {\n\t\t\tleft: trigger.left + document.documentElement.scrollLeft,\n\t\t\ttop: trigger.top + document.documentElement.scrollTop,\n\t\t}\n\n\t\tconst isRightSpace = ((triggerPos.left + offset + trigger.width) + contentWidth) <= windowWidth;\n\t\tconst isLeftSpace = triggerPos.left > contentWidth;\n\n\t\t// LEFT/RIGHT\n\t\tif (this.position === TooltipPosition.LEFT || this.position === TooltipPosition.RIGHT) {\n\t\t\tthis.content.style.top = (triggerPos.top - ((contentHeight - trgHeight) / 2)) + \"px\";\n\t\t\tif (isRightSpace === false && isLeftSpace === false) {\n\t\t\t\tthis.position = TooltipPosition.TOP\n\t\t\t\tthis.content.setAttribute(\"position\", TooltipPosition.TOP)\n\t\t\t}\n\t\t\tif (isLeftSpace && isRightSpace === false && this.position === TooltipPosition.RIGHT) {\n\t\t\t\tthis.position = TooltipPosition.LEFT\n\t\t\t}\n\t\t\tif (isRightSpace && isLeftSpace === false && this.position === TooltipPosition.LEFT) {\n\t\t\t\tthis.position = TooltipPosition.RIGHT\n\t\t\t}\n\t\t}\n\t\tif (this.position === TooltipPosition.RIGHT) {\n\t\t\tthis.content.setAttribute(\"position\", TooltipPosition.RIGHT)\n\t\t\tthis.content.style.left = (triggerPos.left + offset + trigger.width) + \"px\"\n\t\t}\n\t\tif (this.position === TooltipPosition.LEFT) {\n\t\t\tthis.content.setAttribute(\"position\", TooltipPosition.LEFT)\n\t\t\tthis.content.style.left = (triggerPos.left - (contentWidth + offset)) + \"px\"\n\t\t}\n\n\t\t// LEFT/RIGHT FOR TOP/BOTTOM\n\t\tif (this.position === TooltipPosition.TOP || this.position === TooltipPosition.BOTTOM) {\n\t\t\tif (contentWidth > trgWidth) {\n\t\t\t\tlet leftPosition = (triggerPos.left - ((contentWidth - trgWidth) / 2));\n\t\t\t\tconst isNotLeftSpace = leftPosition < 0;\n\t\t\t\tconst isNotRightSpace = (leftPosition + contentWidth) > windowWidth;\n\t\t\t\tif (isNotLeftSpace && isNotRightSpace) {\n\t\t\t\t\tthis.content.style.width = \"auto\";\n\t\t\t\t\tthis.content.style.left = offset + \"px\";\n\t\t\t\t\tthis.content.style.right = offset + \"px\";\n\t\t\t\t} else {\n\t\t\t\t\tif (isNotLeftSpace) {\n\t\t\t\t\t\tleftPosition = offset\n\t\t\t\t\t}\n\t\t\t\t\tif (isNotRightSpace) {\n\t\t\t\t\t\tleftPosition = leftPosition - ((windowWidth - (leftPosition + contentWidth + offset)) * -1)\n\t\t\t\t\t}\n\t\t\t\t\tthis.content.style.left = leftPosition + \"px\"\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tconst leftPosition = (triggerPos.left + ((trgWidth - contentWidth) / 2))\n\n\t\t\t\tthis.content.style.left = leftPosition + \"px\"\n\t\t\t}\n\t\t}\n\t\tif (this.position === TooltipPosition.TOP) {\n\t\t\tthis.content.setAttribute(\"position\", TooltipPosition.TOP)\n\t\t\tthis.content.style.top = (triggerPos.top - (contentHeight + offset)) + \"px\"\n\t\t}\n\t\tif (this.position === TooltipPosition.BOTTOM) {\n\t\t\tthis.content.setAttribute(\"position\", TooltipPosition.BOTTOM)\n\t\t\tthis.content.style.top = (triggerPos.top + (trgHeight + offset)) + \"px\"\n\t\t}\n\n\t\tthis.content.setAttribute(\"is-visible\", \"true\")\n\t\tthis.content.style.opacity = '1'\n\n\t}\n\n\tprivate showTooltip() {\n\t\tif (this.content) {\n\t\t\tthis.content.style.opacity = '0'\n\t\t\tthis.content.hidden = false\n\t\t\tthis.verifyPositionSpace()\n\t\t}\n\t}\n\n\tprivate hideTooltip() {\n\t\tif (this.content) {\n\t\t\tthis.content.setAttribute(\"is-visible\", \"false\")\n\t\t\tthis.content.setAttribute(\"persist\", \"false\")\n\t\t}\n\t}\n\n\tprivate removeContent() {\n\t\tconst contentEl = document.getElementById(this.tooltipContentId)\n\t\tif (contentEl) {\n\t\t\tcontentEl.remove()\n\t\t}\n\t}\n\n\trender() {\n\t\treturn (\n\t\t\t<Host\n\t\t\t\tid={this.tooltipId}\n\t\t\t\tclass={this.h.classes(TooltipClass.root)}\n\t\t\t\tposition={this.position}\n\t\t\t\ttabindex={0}\n\t\t\t\taria-describedby={this.identifier ?? this.tooltipContentId}>\n\t\t\t\t<slot/>\n\t\t\t</Host>\n\t\t)\n\t}\n\n\t/**\n\t * Showing the modal\n\t */\n\t@Method()\n\tasync show(): Promise<void> {\n\t\tthis.showTooltip()\n\t}\n\n\t/**\n\t * Hiding the modal\n\t */\n\t@Method()\n\tasync hide(): Promise<void> {\n\t\tthis.persist = false\n\t\tthis.hideTooltip()\n\t}\n}\n"],"version":3}
@@ -20516,6 +20516,9 @@ class GovTooltip {
20516
20516
  this.host.addEventListener("click", e => {
20517
20517
  e.preventDefault();
20518
20518
  this.persist = true;
20519
+ if (this.content) {
20520
+ this.content.setAttribute("persist", "true");
20521
+ }
20519
20522
  this.showTooltip();
20520
20523
  });
20521
20524
  this.host.addEventListener("focus", e => {
@@ -20609,14 +20612,14 @@ class GovTooltip {
20609
20612
  this.content.setAttribute("position", TooltipPosition.BOTTOM);
20610
20613
  this.content.style.top = (triggerPos.top + (trgHeight + offset)) + "px";
20611
20614
  }
20615
+ this.content.setAttribute("is-visible", "true");
20616
+ this.content.style.opacity = '1';
20612
20617
  }
20613
20618
  showTooltip() {
20614
20619
  if (this.content) {
20620
+ this.content.style.opacity = '0';
20621
+ this.content.hidden = false;
20615
20622
  this.verifyPositionSpace();
20616
- this.content.setAttribute("is-visible", "true");
20617
- if (this.persist) {
20618
- this.content.setAttribute("persist", "true");
20619
- }
20620
20623
  }
20621
20624
  }
20622
20625
  hideTooltip() {
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@gov-design-system-ce/components",
3
3
  "description": "This package includes Gov Design System Web Components and related utilities.",
4
4
  "author": "Zdeněk Vítek",
5
- "version": "0.0.64",
5
+ "version": "0.0.65",
6
6
  "license": "EUPL v1.2 Licensed",
7
7
  "main": "./dist/index.cjs.js",
8
8
  "unpkg": "./dist/core/core.esm.js",
@@ -24,6 +24,6 @@
24
24
  "dependencies" : {
25
25
  "@gov-design-system-ce/icons": "0.0.12",
26
26
  "@gov-design-system-ce/fonts": "0.0.2",
27
- "@gov-design-system-ce/styles": "0.0.13"
27
+ "@gov-design-system-ce/styles": "0.0.14"
28
28
  }
29
29
  }
@@ -1,2 +0,0 @@
1
- import{r as i,h as t,a as s,g as o}from"./p-5bc604a3.js";import{v as e}from"./p-26acf964.js";import{T as h,a as n,b as a,c as r,d as p}from"./p-9a4c910d.js";import{c}from"./p-24636c53.js";import{g as l}from"./p-28e59384.js";import"./p-561fa17b.js";import"./p-ff7365ae.js";import"./p-55500e5a.js";import"./p-03990da5.js";const f='.gov-spin-animation,.gov-pseudo-spin-animation::before{animation:spin 4s linear infinite}@keyframes spin{100%{transform:rotate(360deg)}}@keyframes countdown{to{transform:scaleX(0)}}@keyframes progress{0%{background-position:-200px 0}100%{background-position:calc(200px + 100%) 0}}@keyframes pulse{0%{opacity:1}50%{opacity:0.4}100%{opacity:1}}.gov-tooltip{position:relative;display:inline-block;border-bottom:1px dashed currentcolor;color:var(--gov-color-primary);cursor:help}.gov-tooltip[icon=""],.gov-tooltip[icon=true i],.gov-tooltip[icon="1"]{display:inline-flex;border-bottom:0}';const d=class{constructor(t){i(this,t);this.tooltipContentId=undefined;this.tooltipId=undefined;this.variant=h.PRIMARY;this.size=n._M;this.position="right";this.message=undefined;this.identifier=undefined;this.icon=undefined;this.persist=false;this.h=l(this.host);this.tooltipId=c("GovTooltip");this.tooltipContentId=c("GovContentTooltip")}validateVariant(i){e(h,i,p.root)}validateSize(i){e(n,i,p.root)}validatePosition(i){e(r,i,p.root)}componentWillLoad(){this.validateVariant(this.variant);this.validateSize(this.size);this.validatePosition(this.position);this.createContentWrapper();this.registerListeners()}disconnectedCallback(){this.removeContent()}createContentWrapper(){var i;const t=this.host.querySelector(a.root);if(t){this.content=t}else{this.content=document.createElement(a.root);this.content.innerHTML=this.message;this.host.appendChild(this.content)}const s=this.host.getBoundingClientRect();this.content.style.left=s.left+"px";this.content.style.top=s.top+"px";this.content.style.visibility="hidden";this.content.setAttribute("id",(i=this.identifier)!==null&&i!==void 0?i:this.tooltipContentId);this.content.setAttribute("parent-id",this.tooltipId);this.content.setAttribute("variant",this.variant);this.content.setAttribute("size",this.size);document.body.appendChild(this.content)}registerListeners(){this.host.addEventListener("click",(i=>{i.preventDefault();this.persist=true;this.showTooltip()}));this.host.addEventListener("focus",(i=>{i.preventDefault();this.showTooltip()}));this.host.addEventListener("blur",(i=>{i.preventDefault();if(this.persist===false){this.hideTooltip()}}));this.host.addEventListener("mouseenter",(i=>{i.preventDefault();this.showTooltip()}));this.host.addEventListener("mouseleave",(i=>{i.preventDefault();if(this.persist===false){this.hideTooltip()}}))}verifyPositionSpace(){const i=12;const t=window.innerWidth;const s=this.host.getBoundingClientRect();const o=this.host.offsetWidth;const e=this.host.offsetHeight;const h=this.content.offsetWidth;const n=this.content.offsetHeight;const a={left:s.left+document.documentElement.scrollLeft,top:s.top+document.documentElement.scrollTop};const p=a.left+i+s.width+h<=t;const c=a.left>h;if(this.position===r.LEFT||this.position===r.RIGHT){this.content.style.top=a.top-(n-e)/2+"px";if(p===false&&c===false){this.position=r.TOP;this.content.setAttribute("position",r.TOP)}if(c&&p===false&&this.position===r.RIGHT){this.position=r.LEFT}if(p&&c===false&&this.position===r.LEFT){this.position=r.RIGHT}}if(this.position===r.RIGHT){this.content.setAttribute("position",r.RIGHT);this.content.style.left=a.left+i+s.width+"px"}if(this.position===r.LEFT){this.content.setAttribute("position",r.LEFT);this.content.style.left=a.left-(h+i)+"px"}if(this.position===r.TOP||this.position===r.BOTTOM){if(h>o){let s=a.left-(h-o)/2;const e=s<0;const n=s+h>t;if(e&&n){this.content.style.width="auto";this.content.style.left=i+"px";this.content.style.right=i+"px"}else{if(e){s=i}if(n){s=s-(t-(s+h+i))*-1}this.content.style.left=s+"px"}}else{const i=a.left+(o-h)/2;this.content.style.left=i+"px"}}if(this.position===r.TOP){this.content.setAttribute("position",r.TOP);this.content.style.top=a.top-(n+i)+"px"}if(this.position===r.BOTTOM){this.content.setAttribute("position",r.BOTTOM);this.content.style.top=a.top+(e+i)+"px"}}showTooltip(){if(this.content){this.verifyPositionSpace();this.content.setAttribute("is-visible","true");if(this.persist){this.content.setAttribute("persist","true")}}}hideTooltip(){if(this.content){this.content.setAttribute("is-visible","false");this.content.setAttribute("persist","false")}}removeContent(){const i=document.getElementById(this.tooltipContentId);if(i){i.remove()}}render(){var i;return t(s,{id:this.tooltipId,class:this.h.classes(p.root),position:this.position,tabindex:0,"aria-describedby":(i=this.identifier)!==null&&i!==void 0?i:this.tooltipContentId},t("slot",null))}async show(){this.showTooltip()}async hide(){this.persist=false;this.hideTooltip()}get host(){return o(this)}static get watchers(){return{variant:["validateVariant"],size:["validateSize"],position:["validatePosition"]}}};d.style=f;export{d as gov_tooltip};
2
- //# sourceMappingURL=p-b946cd3f.entry.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["govTooltipCss","GovTooltip","constructor","hostRef","this","tooltipContentId","undefined","tooltipId","TooltipVariant","PRIMARY","TooltipSize","_M","h","govHost","host","createID","validateVariant","newValue","validateProp","TooltipClass","root","validateSize","validatePosition","TooltipPosition","componentWillLoad","variant","size","position","createContentWrapper","registerListeners","disconnectedCallback","removeContent","hasContentInside","querySelector","TooltipContentClass","content","document","createElement","innerHTML","message","appendChild","trigger","getBoundingClientRect","style","left","top","visibility","setAttribute","_a","identifier","body","addEventListener","e","preventDefault","persist","showTooltip","hideTooltip","verifyPositionSpace","offset","windowWidth","window","innerWidth","trgWidth","offsetWidth","trgHeight","offsetHeight","contentWidth","contentHeight","triggerPos","documentElement","scrollLeft","scrollTop","isRightSpace","width","isLeftSpace","LEFT","RIGHT","TOP","BOTTOM","leftPosition","isNotLeftSpace","isNotRightSpace","right","contentEl","getElementById","remove","render","Host","id","class","classes","tabindex","show","hide"],"sources":["../../../packages/core/src/components/gov-tooltip/gov-tooltip.scss?tag=gov-tooltip","../../../packages/core/src/components/gov-tooltip/gov-tooltip.tsx"],"sourcesContent":["/*\n * Tooltip\n */\n\n$class: \".gov-tooltip\";\n\n#{$class} {\n\tposition: relative;\n\tdisplay: inline-block;\n\tborder-bottom: 1px dashed currentcolor;\n\tcolor: color(\"primary\");\n\tcursor: help;\n\n\t@include parameter(\"icon\") {\n\t\tdisplay: inline-flex;\n\t\tborder-bottom: 0;\n\t}\n}\n","import {Component, Element, h, Host, Method, Prop, State, Watch} from \"@stencil/core\"\nimport {validateProp} from \"../../helpers/Validate/props\"\nimport {\n TooltipClass,\n TooltipContentClass,\n TooltipPosition,\n TooltipPositionType,\n TooltipSize,\n TooltipSizeType,\n TooltipVariant,\n TooltipVariantType,\n} from \"./constants\"\nimport {createID} from \"../../utils/string.utils\"\nimport {govHost} from \"../../helpers/Dom/template\"\nimport {GovHost} from \"../../helpers/Dom/template.types\"\n\n@Component({\n tag: \"gov-tooltip\",\n styleUrl: \"gov-tooltip.scss\",\n})\nexport class GovTooltip {\n private h: GovHost\n private content: HTMLGovTooltipContentElement\n private readonly tooltipContentId = undefined\n private readonly tooltipId = undefined\n\n constructor() {\n this.h = govHost(this.host)\n this.tooltipId = createID(\"GovTooltip\")\n this.tooltipContentId = createID(\"GovContentTooltip\")\n }\n\n @Element() host: HTMLGovTooltipElement\n /**\n * Style variation of the tooltip\n */\n @Prop() readonly variant?: TooltipVariantType = TooltipVariant.PRIMARY\n /**\n * Tooltip’s size.\n */\n @Prop() readonly size?: TooltipSizeType = TooltipSize._M\n /**\n * Tooltip display position\n */\n @Prop({mutable: true}) position: TooltipPositionType = \"right\"\n /**\n * Information contained in the tooltip\n */\n @Prop() readonly message: string = undefined\n /**\n * Custom tooltip identifier.\n */\n @Prop({attribute: \"identifier\"}) readonly identifier: string\n /**\n * Trigger is just an icon\n */\n @Prop({reflect: true}) readonly icon: boolean = undefined\n\n @State() persist = false\n\n @Watch(\"variant\")\n validateVariant(newValue: string): void {\n validateProp(TooltipVariant, newValue, TooltipClass.root)\n }\n\n @Watch(\"size\")\n validateSize(newValue: string): void {\n validateProp(TooltipSize, newValue, TooltipClass.root)\n }\n\n @Watch(\"position\")\n validatePosition(newValue: string): void {\n validateProp(TooltipPosition, newValue, TooltipClass.root)\n }\n\n componentWillLoad(): void {\n this.validateVariant(this.variant)\n this.validateSize(this.size)\n this.validatePosition(this.position)\n\n this.createContentWrapper()\n this.registerListeners()\n }\n\n disconnectedCallback() {\n this.removeContent()\n }\n\n private createContentWrapper() {\n const hasContentInside = this.host.querySelector(TooltipContentClass.root) as HTMLGovTooltipContentElement\n if (hasContentInside) {\n this.content = hasContentInside\n } else {\n this.content = document.createElement(TooltipContentClass.root) as HTMLGovTooltipContentElement\n this.content.innerHTML = this.message\n this.host.appendChild(this.content)\n }\n\n const trigger = this.host.getBoundingClientRect()\n this.content.style.left = trigger.left + 'px'\n this.content.style.top = trigger.top + 'px'\n this.content.style.visibility = 'hidden'\n\n this.content.setAttribute(\"id\", this.identifier ?? this.tooltipContentId)\n this.content.setAttribute(\"parent-id\", this.tooltipId)\n this.content.setAttribute(\"variant\", this.variant)\n this.content.setAttribute(\"size\", this.size)\n document.body.appendChild(this.content)\n }\n\n private registerListeners() {\n this.host.addEventListener(\"click\", e => {\n e.preventDefault()\n this.persist = true\n this.showTooltip()\n })\n this.host.addEventListener(\"focus\", e => {\n e.preventDefault()\n this.showTooltip()\n })\n this.host.addEventListener(\"blur\", e => {\n e.preventDefault()\n if (this.persist === false) {\n this.hideTooltip()\n }\n })\n this.host.addEventListener(\"mouseenter\", e => {\n e.preventDefault()\n this.showTooltip()\n })\n this.host.addEventListener(\"mouseleave\", e => {\n e.preventDefault()\n if (this.persist === false) {\n this.hideTooltip()\n }\n })\n }\n\n private verifyPositionSpace() {\n const offset = 12\n const windowWidth = window.innerWidth\n const trigger = this.host.getBoundingClientRect()\n const trgWidth = this.host.offsetWidth\n const trgHeight = this.host.offsetHeight\n const contentWidth = this.content.offsetWidth\n const contentHeight = this.content.offsetHeight\n const triggerPos = {\n left: trigger.left + document.documentElement.scrollLeft,\n top: trigger.top + document.documentElement.scrollTop,\n }\n\n const isRightSpace = ((triggerPos.left + offset + trigger.width) + contentWidth) <= windowWidth;\n const isLeftSpace = triggerPos.left > contentWidth;\n\n // LEFT/RIGHT\n if (this.position === TooltipPosition.LEFT || this.position === TooltipPosition.RIGHT) {\n this.content.style.top = (triggerPos.top - ((contentHeight - trgHeight) / 2)) + \"px\";\n if (isRightSpace === false && isLeftSpace === false) {\n this.position = TooltipPosition.TOP\n this.content.setAttribute(\"position\", TooltipPosition.TOP)\n }\n if (isLeftSpace && isRightSpace === false && this.position === TooltipPosition.RIGHT) {\n this.position = TooltipPosition.LEFT\n }\n if (isRightSpace && isLeftSpace === false && this.position === TooltipPosition.LEFT) {\n this.position = TooltipPosition.RIGHT\n }\n }\n if (this.position === TooltipPosition.RIGHT) {\n this.content.setAttribute(\"position\", TooltipPosition.RIGHT)\n this.content.style.left = (triggerPos.left + offset + trigger.width) + \"px\"\n }\n if (this.position === TooltipPosition.LEFT) {\n this.content.setAttribute(\"position\", TooltipPosition.LEFT)\n this.content.style.left = (triggerPos.left - (contentWidth + offset)) + \"px\"\n }\n\n // LEFT/RIGHT FOR TOP/BOTTOM\n if (this.position === TooltipPosition.TOP || this.position === TooltipPosition.BOTTOM) {\n if (contentWidth > trgWidth) {\n let leftPosition = (triggerPos.left - ((contentWidth - trgWidth) / 2));\n const isNotLeftSpace = leftPosition < 0;\n const isNotRightSpace = (leftPosition + contentWidth) > windowWidth;\n if (isNotLeftSpace && isNotRightSpace) {\n this.content.style.width = \"auto\";\n this.content.style.left = offset + \"px\";\n this.content.style.right = offset + \"px\";\n } else {\n if (isNotLeftSpace) {\n leftPosition = offset\n }\n if (isNotRightSpace) {\n leftPosition = leftPosition - ((windowWidth - (leftPosition + contentWidth + offset)) * -1)\n }\n this.content.style.left = leftPosition + \"px\"\n }\n } else {\n const leftPosition = (triggerPos.left + ((trgWidth - contentWidth) / 2))\n\n this.content.style.left = leftPosition + \"px\"\n }\n }\n if (this.position === TooltipPosition.TOP) {\n this.content.setAttribute(\"position\", TooltipPosition.TOP)\n this.content.style.top = (triggerPos.top - (contentHeight + offset)) + \"px\"\n }\n if (this.position === TooltipPosition.BOTTOM) {\n this.content.setAttribute(\"position\", TooltipPosition.BOTTOM)\n this.content.style.top = (triggerPos.top + (trgHeight + offset)) + \"px\"\n }\n }\n\n private showTooltip() {\n if (this.content) {\n this.verifyPositionSpace()\n this.content.setAttribute(\"is-visible\", \"true\")\n if (this.persist) {\n this.content.setAttribute(\"persist\", \"true\")\n }\n }\n }\n\n private hideTooltip() {\n if (this.content) {\n this.content.setAttribute(\"is-visible\", \"false\")\n this.content.setAttribute(\"persist\", \"false\")\n }\n }\n\n private removeContent() {\n const contentEl = document.getElementById(this.tooltipContentId)\n if (contentEl) {\n contentEl.remove()\n }\n }\n\n render() {\n return (\n <Host\n id={this.tooltipId}\n class={this.h.classes(TooltipClass.root)}\n position={this.position}\n tabindex={0}\n aria-describedby={this.identifier ?? this.tooltipContentId}>\n <slot/>\n </Host>\n )\n }\n\n /**\n * Showing the modal\n */\n @Method()\n async show(): Promise<void> {\n this.showTooltip()\n }\n\n /**\n * Hiding the modal\n */\n @Method()\n async hide(): Promise<void> {\n this.persist = false\n this.hideTooltip()\n }\n}\n"],"mappings":"gUAAA,MAAMA,EAAgB,ykB,MCoBTC,EAAU,MAMrB,WAAAC,CAAAC,G,UAHiBC,KAAAC,iBAAmBC,UACnBF,KAAAG,UAAYD,U,aAYmBE,EAAeC,Q,UAIrBC,EAAYC,G,cAIC,Q,aAIpBL,U,oCAQaA,U,aAE7B,MA/BjBF,KAAKQ,EAAIC,EAAQT,KAAKU,MACtBV,KAAKG,UAAYQ,EAAS,cAC1BX,KAAKC,iBAAmBU,EAAS,oB,CAgCnC,eAAAC,CAAgBC,GACdC,EAAaV,EAAgBS,EAAUE,EAAaC,K,CAItD,YAAAC,CAAaJ,GACXC,EAAaR,EAAaO,EAAUE,EAAaC,K,CAInD,gBAAAE,CAAiBL,GACfC,EAAaK,EAAiBN,EAAUE,EAAaC,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