@aquera/nile-elements 0.1.32-beta-1.2 → 0.1.32-beta-1.4

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 (192) hide show
  1. package/README.md +9 -23
  2. package/demo/index.html +263 -24
  3. package/dist/axe.min-2b379f29.cjs.js +12 -0
  4. package/dist/axe.min-2b379f29.cjs.js.map +1 -0
  5. package/dist/axe.min-c2cd8733.esm.js +12 -0
  6. package/dist/{fixture-3acb409b.cjs.js → fixture-d5b55278.cjs.js} +3 -3
  7. package/dist/fixture-d5b55278.cjs.js.map +1 -0
  8. package/dist/{fixture-db35a8ae.esm.js → fixture-df8b52d7.esm.js} +1 -1
  9. package/dist/index.cjs.js +1 -1
  10. package/dist/index.esm.js +1 -1
  11. package/dist/nile-accordion/nile-accordian.test.cjs.js +1 -1
  12. package/dist/nile-accordion/nile-accordian.test.esm.js +1 -1
  13. package/dist/nile-accordion/nile-accordion.cjs.js +1 -1
  14. package/dist/nile-accordion/nile-accordion.cjs.js.map +1 -1
  15. package/dist/nile-accordion/nile-accordion.css.cjs.js +1 -1
  16. package/dist/nile-accordion/nile-accordion.css.cjs.js.map +1 -1
  17. package/dist/nile-accordion/nile-accordion.css.esm.js +1 -1
  18. package/dist/nile-accordion/nile-accordion.esm.js +4 -4
  19. package/dist/nile-auto-complete/nile-auto-complete.test.cjs.js +1 -1
  20. package/dist/nile-auto-complete/nile-auto-complete.test.esm.js +1 -1
  21. package/dist/nile-avatar/nile-avatar.test.cjs.js +1 -1
  22. package/dist/nile-avatar/nile-avatar.test.esm.js +1 -1
  23. package/dist/nile-badge/nile-badge.test.cjs.js +1 -1
  24. package/dist/nile-badge/nile-badge.test.esm.js +1 -1
  25. package/dist/nile-button/nile-button.test.cjs.js +1 -1
  26. package/dist/nile-button/nile-button.test.esm.js +1 -1
  27. package/dist/nile-button-toggle-group/nile-button-toggle-group.test.cjs.js +1 -1
  28. package/dist/nile-button-toggle-group/nile-button-toggle-group.test.esm.js +1 -1
  29. package/dist/nile-calendar/nile-calendar.test.cjs.js +1 -1
  30. package/dist/nile-calendar/nile-calendar.test.esm.js +1 -1
  31. package/dist/nile-card/nile-card.test.cjs.js +1 -1
  32. package/dist/nile-card/nile-card.test.esm.js +1 -1
  33. package/dist/nile-checkbox/nile-checkbox.test.cjs.js +1 -1
  34. package/dist/nile-checkbox/nile-checkbox.test.esm.js +1 -1
  35. package/dist/nile-chip/nile-chip.test.cjs.js +1 -1
  36. package/dist/nile-chip/nile-chip.test.esm.js +1 -1
  37. package/dist/nile-circular-progressbar/nile-circular-progressbar.css.cjs.js +1 -1
  38. package/dist/nile-circular-progressbar/nile-circular-progressbar.css.cjs.js.map +1 -1
  39. package/dist/nile-circular-progressbar/nile-circular-progressbar.css.esm.js +49 -49
  40. package/dist/nile-code-editor/extensionSetup.cjs.js +7 -7
  41. package/dist/nile-code-editor/extensionSetup.cjs.js.map +1 -1
  42. package/dist/nile-code-editor/extensionSetup.esm.js +1 -1
  43. package/dist/nile-code-editor/nile-code-editor.cjs.js +2 -2
  44. package/dist/nile-code-editor/nile-code-editor.cjs.js.map +1 -1
  45. package/dist/nile-code-editor/nile-code-editor.esm.js +2 -2
  46. package/dist/nile-dialog/nile-dialog.test.cjs.js +1 -1
  47. package/dist/nile-dialog/nile-dialog.test.esm.js +1 -1
  48. package/dist/nile-drawer/nile-drawer.test.cjs.js +1 -1
  49. package/dist/nile-drawer/nile-drawer.test.esm.js +1 -1
  50. package/dist/nile-dropdown/nile-dropdown.test.cjs.js +1 -1
  51. package/dist/nile-dropdown/nile-dropdown.test.esm.js +1 -1
  52. package/dist/nile-empty-state/nile-empty-state.test.cjs.js +1 -1
  53. package/dist/nile-empty-state/nile-empty-state.test.esm.js +1 -1
  54. package/dist/nile-error-message/nile-error-message.test.cjs.js +1 -1
  55. package/dist/nile-error-message/nile-error-message.test.esm.js +1 -1
  56. package/dist/nile-form-group/nile-form-group.test.cjs.js +1 -1
  57. package/dist/nile-form-group/nile-form-group.test.esm.js +1 -1
  58. package/dist/nile-form-help-text/nile-form-help-text.test.cjs.js +1 -1
  59. package/dist/nile-form-help-text/nile-form-help-text.test.esm.js +1 -1
  60. package/dist/nile-hero/nile-hero.test.cjs.js +1 -1
  61. package/dist/nile-hero/nile-hero.test.esm.js +1 -1
  62. package/dist/nile-icon/nile-icon.test.cjs.js +1 -1
  63. package/dist/nile-icon/nile-icon.test.esm.js +1 -1
  64. package/dist/nile-input/nile-input.css.cjs.js +1 -1
  65. package/dist/nile-input/nile-input.css.cjs.js.map +1 -1
  66. package/dist/nile-input/nile-input.css.esm.js +8 -0
  67. package/dist/nile-input/nile-input.test.cjs.js +1 -1
  68. package/dist/nile-input/nile-input.test.esm.js +1 -1
  69. package/dist/nile-link/nile-link.test.cjs.js +1 -1
  70. package/dist/nile-link/nile-link.test.esm.js +1 -1
  71. package/dist/nile-loader/nile-loader.test.cjs.js +1 -1
  72. package/dist/nile-loader/nile-loader.test.esm.js +1 -1
  73. package/dist/nile-popover/nile-popover.test.cjs.js +1 -1
  74. package/dist/nile-popover/nile-popover.test.esm.js +1 -1
  75. package/dist/nile-popup/nile-popup.test.cjs.js +1 -1
  76. package/dist/nile-popup/nile-popup.test.esm.js +1 -1
  77. package/dist/nile-progress-bar/nile-progress-bar.test.cjs.js +1 -1
  78. package/dist/nile-progress-bar/nile-progress-bar.test.esm.js +1 -1
  79. package/dist/nile-radio/nile-radio.test.cjs.js +1 -1
  80. package/dist/nile-radio/nile-radio.test.esm.js +1 -1
  81. package/dist/nile-radio-group/nile-radio-group.test.cjs.js +1 -1
  82. package/dist/nile-radio-group/nile-radio-group.test.esm.js +1 -1
  83. package/dist/nile-select/nile-select.test.cjs.js +1 -1
  84. package/dist/nile-select/nile-select.test.esm.js +1 -1
  85. package/dist/nile-slide-toggle/nile-slide-toggle.test.cjs.js +1 -1
  86. package/dist/nile-slide-toggle/nile-slide-toggle.test.esm.js +1 -1
  87. package/dist/nile-tab-group/nile-tab-group.test.cjs.js +1 -1
  88. package/dist/nile-tab-group/nile-tab-group.test.esm.js +1 -1
  89. package/dist/nile-table-body/nile-table-body.cjs.js +1 -1
  90. package/dist/nile-table-body/nile-table-body.cjs.js.map +1 -1
  91. package/dist/nile-table-body/nile-table-body.esm.js +2 -2
  92. package/dist/nile-table-cell-item/nile-table-cell-item.css.cjs.js +1 -1
  93. package/dist/nile-table-cell-item/nile-table-cell-item.css.cjs.js.map +1 -1
  94. package/dist/nile-table-cell-item/nile-table-cell-item.css.esm.js +4 -8
  95. package/dist/nile-table-header-item/nile-table-header-item.cjs.js +1 -1
  96. package/dist/nile-table-header-item/nile-table-header-item.cjs.js.map +1 -1
  97. package/dist/nile-table-header-item/nile-table-header-item.css.cjs.js +1 -1
  98. package/dist/nile-table-header-item/nile-table-header-item.css.cjs.js.map +1 -1
  99. package/dist/nile-table-header-item/nile-table-header-item.css.esm.js +0 -5
  100. package/dist/nile-table-header-item/nile-table-header-item.esm.js +9 -9
  101. package/dist/nile-table-row/nile-table-row.cjs.js.map +1 -1
  102. package/dist/nile-textarea/nile-textarea.test.cjs.js +1 -1
  103. package/dist/nile-textarea/nile-textarea.test.esm.js +1 -1
  104. package/dist/nile-tooltip/index.cjs.js +1 -1
  105. package/dist/nile-tooltip/index.esm.js +1 -1
  106. package/dist/nile-tooltip/nile-tooltip-utils.cjs.js +2 -0
  107. package/dist/nile-tooltip/nile-tooltip-utils.cjs.js.map +1 -0
  108. package/dist/nile-tooltip/nile-tooltip-utils.esm.js +1 -0
  109. package/dist/nile-tooltip/nile-tooltip.cjs.js +1 -1
  110. package/dist/nile-tooltip/nile-tooltip.cjs.js.map +1 -1
  111. package/dist/nile-tooltip/nile-tooltip.css.cjs.js +1 -1
  112. package/dist/nile-tooltip/nile-tooltip.css.cjs.js.map +1 -1
  113. package/dist/nile-tooltip/nile-tooltip.css.esm.js +20 -76
  114. package/dist/nile-tooltip/nile-tooltip.esm.js +20 -8
  115. package/dist/nile-tooltip/nile-tooltip.test.cjs.js +2 -0
  116. package/dist/nile-tooltip/nile-tooltip.test.cjs.js.map +1 -0
  117. package/dist/nile-tooltip/nile-tooltip.test.esm.js +51 -0
  118. package/dist/src/index.d.ts +0 -1
  119. package/dist/src/index.js +0 -1
  120. package/dist/src/index.js.map +1 -1
  121. package/dist/src/nile-accordion/nile-accordion.css.js +1 -1
  122. package/dist/src/nile-accordion/nile-accordion.css.js.map +1 -1
  123. package/dist/src/nile-accordion/nile-accordion.d.ts +5 -6
  124. package/dist/src/nile-accordion/nile-accordion.js +8 -21
  125. package/dist/src/nile-accordion/nile-accordion.js.map +1 -1
  126. package/dist/src/nile-circular-progressbar/nile-circular-progressbar.css.js +49 -49
  127. package/dist/src/nile-circular-progressbar/nile-circular-progressbar.css.js.map +1 -1
  128. package/dist/src/nile-input/nile-input.css.js +8 -0
  129. package/dist/src/nile-input/nile-input.css.js.map +1 -1
  130. package/dist/src/nile-table-body/nile-table-body.d.ts +1 -3
  131. package/dist/src/nile-table-body/nile-table-body.js +1 -9
  132. package/dist/src/nile-table-body/nile-table-body.js.map +1 -1
  133. package/dist/src/nile-table-cell-item/nile-table-cell-item.css.js +2 -6
  134. package/dist/src/nile-table-cell-item/nile-table-cell-item.css.js.map +1 -1
  135. package/dist/src/nile-table-header-item/nile-table-header-item.css.js +0 -5
  136. package/dist/src/nile-table-header-item/nile-table-header-item.css.js.map +1 -1
  137. package/dist/src/nile-table-header-item/nile-table-header-item.js +1 -1
  138. package/dist/src/nile-table-header-item/nile-table-header-item.js.map +1 -1
  139. package/dist/src/nile-table-row/nile-table-row.js.map +1 -1
  140. package/dist/src/nile-tooltip/nile-tooltip-utils.d.ts +18 -0
  141. package/dist/src/nile-tooltip/nile-tooltip-utils.js +151 -0
  142. package/dist/src/nile-tooltip/nile-tooltip-utils.js.map +1 -0
  143. package/dist/src/nile-tooltip/nile-tooltip.css.js +19 -75
  144. package/dist/src/nile-tooltip/nile-tooltip.css.js.map +1 -1
  145. package/dist/src/nile-tooltip/nile-tooltip.d.ts +28 -9
  146. package/dist/src/nile-tooltip/nile-tooltip.js +111 -117
  147. package/dist/src/nile-tooltip/nile-tooltip.js.map +1 -1
  148. package/dist/src/nile-tooltip/nile-tooltip.test.d.ts +1 -0
  149. package/dist/src/nile-tooltip/nile-tooltip.test.js +158 -0
  150. package/dist/src/nile-tooltip/nile-tooltip.test.js.map +1 -0
  151. package/dist/tsconfig.tsbuildinfo +1 -1
  152. package/package.json +3 -3
  153. package/src/index.ts +1 -2
  154. package/src/nile-accordion/nile-accordion.css.ts +1 -1
  155. package/src/nile-accordion/nile-accordion.ts +4 -15
  156. package/src/nile-circular-progressbar/nile-circular-progressbar.css.ts +56 -55
  157. package/src/nile-input/nile-input.css.ts +8 -0
  158. package/src/nile-table-body/nile-table-body.ts +2 -8
  159. package/src/nile-table-cell-item/nile-table-cell-item.css.ts +2 -6
  160. package/src/nile-table-header-item/nile-table-header-item.css.ts +0 -5
  161. package/src/nile-table-header-item/nile-table-header-item.ts +1 -1
  162. package/src/nile-table-row/nile-table-row.ts +2 -1
  163. package/src/nile-tooltip/nile-tooltip-utils.ts +190 -0
  164. package/src/nile-tooltip/nile-tooltip.css.ts +20 -76
  165. package/src/nile-tooltip/nile-tooltip.test.ts +178 -0
  166. package/src/nile-tooltip/nile-tooltip.ts +142 -162
  167. package/vscode-html-custom-data.json +72 -90
  168. package/dist/axe.min-5bf06036.esm.js +0 -12
  169. package/dist/axe.min-ff35bfba.cjs.js +0 -12
  170. package/dist/axe.min-ff35bfba.cjs.js.map +0 -1
  171. package/dist/fixture-3acb409b.cjs.js.map +0 -1
  172. package/dist/nile-table/index.cjs.js +0 -2
  173. package/dist/nile-table/index.cjs.js.map +0 -1
  174. package/dist/nile-table/index.esm.js +0 -1
  175. package/dist/nile-table/nile-table.cjs.js +0 -2
  176. package/dist/nile-table/nile-table.cjs.js.map +0 -1
  177. package/dist/nile-table/nile-table.css.cjs.js +0 -2
  178. package/dist/nile-table/nile-table.css.cjs.js.map +0 -1
  179. package/dist/nile-table/nile-table.css.esm.js +0 -6
  180. package/dist/nile-table/nile-table.esm.js +0 -3
  181. package/dist/src/nile-table/index.d.ts +0 -1
  182. package/dist/src/nile-table/index.js +0 -2
  183. package/dist/src/nile-table/index.js.map +0 -1
  184. package/dist/src/nile-table/nile-table.css.d.ts +0 -12
  185. package/dist/src/nile-table/nile-table.css.js +0 -18
  186. package/dist/src/nile-table/nile-table.css.js.map +0 -1
  187. package/dist/src/nile-table/nile-table.d.ts +0 -48
  188. package/dist/src/nile-table/nile-table.js +0 -143
  189. package/dist/src/nile-table/nile-table.js.map +0 -1
  190. package/src/nile-table/index.ts +0 -1
  191. package/src/nile-table/nile-table.css.ts +0 -20
  192. package/src/nile-table/nile-table.ts +0 -161
@@ -1,2 +1,2 @@
1
- function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o;}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o;},_typeof(o);}System.register(["../fixture-3acb409b.cjs.js","lit/static-html.js","lit/html.js","lit/directive-helpers.js","lit","lit/directives/unsafe-html.js","./nile-textarea.cjs.js","tslib","lit/decorators.js","./nile-textarea.css.cjs.js","lit/directives/class-map.js","../internal/default-value.cjs.js","../internal/slot.cjs.js","lit/directives/if-defined.js","lit/directives/live.js","../internal/watch.cjs.js","../internal/nile-element.cjs.js"],function(_export,_context){"use strict";var e,t,a,i,_templateObject,_templateObject2,_templateObject3,_templateObject4,_templateObject5,_templateObject6,_templateObject7,_templateObject8,_templateObject9,_templateObject10;function _regeneratorRuntime(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */_regeneratorRuntime=function _regeneratorRuntime(){return e;};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value;},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function define(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e];}try{define({},"");}catch(t){define=function define(t,e,r){return t[e]=r;};}function wrap(t,e,r,n){var i=e&&e.prototype instanceof Generator?e:Generator,a=Object.create(i.prototype),c=new Context(n||[]);return o(a,"_invoke",{value:makeInvokeMethod(t,r,c)}),a;}function tryCatch(t,e,r){try{return{type:"normal",arg:t.call(e,r)};}catch(t){return{type:"throw",arg:t};}}e.wrap=wrap;var h="suspendedStart",l="suspendedYield",f="executing",s="completed",y={};function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}var p={};define(p,a,function(){return this;});var d=Object.getPrototypeOf,v=d&&d(d(values([])));v&&v!==r&&n.call(v,a)&&(p=v);var g=GeneratorFunctionPrototype.prototype=Generator.prototype=Object.create(p);function defineIteratorMethods(t){["next","throw","return"].forEach(function(e){define(t,e,function(t){return this._invoke(e,t);});});}function AsyncIterator(t,e){function invoke(r,o,i,a){var c=tryCatch(t[r],t,o);if("throw"!==c.type){var u=c.arg,h=u.value;return h&&"object"==_typeof(h)&&n.call(h,"__await")?e.resolve(h.__await).then(function(t){invoke("next",t,i,a);},function(t){invoke("throw",t,i,a);}):e.resolve(h).then(function(t){u.value=t,i(u);},function(t){return invoke("throw",t,i,a);});}a(c.arg);}var r;o(this,"_invoke",{value:function value(t,n){function callInvokeWithMethodAndArg(){return new e(function(e,r){invoke(t,n,e,r);});}return r=r?r.then(callInvokeWithMethodAndArg,callInvokeWithMethodAndArg):callInvokeWithMethodAndArg();}});}function makeInvokeMethod(e,r,n){var o=h;return function(i,a){if(o===f)throw Error("Generator is already running");if(o===s){if("throw"===i)throw a;return{value:t,done:!0};}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var u=maybeInvokeDelegate(c,n);if(u){if(u===y)continue;return u;}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===h)throw o=s,n.arg;n.dispatchException(n.arg);}else"return"===n.method&&n.abrupt("return",n.arg);o=f;var p=tryCatch(e,r,n);if("normal"===p.type){if(o=n.done?s:l,p.arg===y)continue;return{value:p.arg,done:n.done};}"throw"===p.type&&(o=s,n.method="throw",n.arg=p.arg);}};}function maybeInvokeDelegate(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator["return"]&&(r.method="return",r.arg=t,maybeInvokeDelegate(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),y;var i=tryCatch(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,y;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,y):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,y);}function pushTryEntry(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e);}function resetTryEntry(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e;}function Context(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(pushTryEntry,this),this.reset(!0);}function values(e){if(e||""===e){var r=e[a];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function next(){for(;++o<e.length;)if(n.call(e,o))return next.value=e[o],next.done=!1,next;return next.value=t,next.done=!0,next;};return i.next=i;}}throw new TypeError(_typeof(e)+" is not iterable");}return GeneratorFunction.prototype=GeneratorFunctionPrototype,o(g,"constructor",{value:GeneratorFunctionPrototype,configurable:!0}),o(GeneratorFunctionPrototype,"constructor",{value:GeneratorFunction,configurable:!0}),GeneratorFunction.displayName=define(GeneratorFunctionPrototype,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===GeneratorFunction||"GeneratorFunction"===(e.displayName||e.name));},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,GeneratorFunctionPrototype):(t.__proto__=GeneratorFunctionPrototype,define(t,u,"GeneratorFunction")),t.prototype=Object.create(g),t;},e.awrap=function(t){return{__await:t};},defineIteratorMethods(AsyncIterator.prototype),define(AsyncIterator.prototype,c,function(){return this;}),e.AsyncIterator=AsyncIterator,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new AsyncIterator(wrap(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then(function(t){return t.done?t.value:a.next();});},defineIteratorMethods(g),define(g,u,"Generator"),define(g,a,function(){return this;}),define(g,"toString",function(){return"[object Generator]";}),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function next(){for(;r.length;){var t=r.pop();if(t in e)return next.value=t,next.done=!1,next;}return next.done=!0,next;};},e.values=values,Context.prototype={constructor:Context,reset:function reset(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(resetTryEntry),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t);},stop:function stop(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval;},dispatchException:function dispatchException(e){if(this.done)throw e;var r=this;function handle(n,o){return a.type="throw",a.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o;}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return handle("end");if(i.tryLoc<=this.prev){var c=n.call(i,"catchLoc"),u=n.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return handle(i.catchLoc,!0);if(this.prev<i.finallyLoc)return handle(i.finallyLoc);}else if(c){if(this.prev<i.catchLoc)return handle(i.catchLoc,!0);}else{if(!u)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return handle(i.finallyLoc);}}}},abrupt:function abrupt(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break;}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,y):this.complete(a);},complete:function complete(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),y;},finish:function finish(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),resetTryEntry(r),y;}},"catch":function _catch(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;resetTryEntry(r);}return o;}}throw Error("illegal catch attempt");},delegateYield:function delegateYield(e,r,n){return this.delegate={iterator:values(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),y;}},e;}function _taggedTemplateLiteral(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}));}function asyncGeneratorStep(n,t,e,r,o,a,c){try{var i=n[a](c),u=i.value;}catch(n){return void e(n);}i.done?t(u):Promise.resolve(u).then(r,o);}function _asyncToGenerator(n){return function(){var t=this,e=arguments;return new Promise(function(r,o){var a=n.apply(t,e);function _next(n){asyncGeneratorStep(a,r,o,_next,_throw,"next",n);}function _throw(n){asyncGeneratorStep(a,r,o,_next,_throw,"throw",n);}_next(void 0);});};}return{setters:[function(_fixture001CjsJs){e=_fixture001CjsJs.f;t=_fixture001CjsJs.a;a=_fixture001CjsJs.o;},function(_litStaticHtmlJs){i=_litStaticHtmlJs.html;},function(_litHtmlJs){},function(_litDirectiveHelpersJs){},function(_lit){},function(_litDirectivesUnsafeHtmlJs){},function(_nileTextareaCjsJs){},function(_tslib){},function(_litDecoratorsJs){},function(_nileTextareaCssCjsJs){},function(_litDirectivesClassMapJs){},function(_internalDefaultValueCjsJs){},function(_internalSlotCjsJs){},function(_litDirectivesIfDefinedJs){},function(_litDirectivesLiveJs){},function(_internalWatchCjsJs){},function(_internalNileElementCjsJs){}],execute:function execute(){describe("<nile-textarea>",function(){it("should render the default properties correctly",/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(){var a;return _regeneratorRuntime().wrap(function _callee$(_context2){while(1)switch(_context2.prev=_context2.next){case 0:_context2.next=2;return e(i(_templateObject||(_templateObject=_taggedTemplateLiteral(["<nile-textarea></nile-textarea>"]))));case 2:a=_context2.sent;t(a.value).to.equal(""),t(a.size).to.equal("medium"),t(a.filled).to.be["false"],t(a.disabled).to.be["false"],t(a.readonly).to.be["false"],t(a.required).to.be["false"];case 4:case"end":return _context2.stop();}},_callee);}))),it("should reflect properties to attributes",/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(){var a;return _regeneratorRuntime().wrap(function _callee2$(_context3){while(1)switch(_context3.prev=_context3.next){case 0:_context3.next=2;return e(i(_templateObject2||(_templateObject2=_taggedTemplateLiteral(["<nile-textarea disabled readonly required></nile-textarea>"]))));case 2:a=_context3.sent;t(a.getAttribute("disabled")).to.equal(""),t(a.getAttribute("readonly")).to.equal(""),t(a.getAttribute("required")).to.equal("");case 4:case"end":return _context3.stop();}},_callee2);}))),it("should emit events correctly",/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(){var _r$shadowRoot$querySe,_r$shadowRoot;var r,s,_yield$a,n,_yield$a2,l,_yield$a3,o,_yield$a4,c;return _regeneratorRuntime().wrap(function _callee3$(_context4){while(1)switch(_context4.prev=_context4.next){case 0:_context4.next=2;return e(i(_templateObject3||(_templateObject3=_taggedTemplateLiteral(["<nile-textarea></nile-textarea>"]))));case 2:r=_context4.sent;s=(_r$shadowRoot$querySe=(_r$shadowRoot=r.shadowRoot)===null||_r$shadowRoot===void 0?void 0:_r$shadowRoot.querySelector("textarea"))!==null&&_r$shadowRoot$querySe!==void 0?_r$shadowRoot$querySe:{};setTimeout(function(){return s.dispatchEvent(new Event("focus"));});_context4.next=7;return a(r,"nile-focus");case 7:_yield$a=_context4.sent;n=_yield$a.detail;t(n.value).to.equal(""),s.value="test",setTimeout(function(){return s.dispatchEvent(new Event("input"));});_context4.next=12;return a(r,"nile-input");case 12:_yield$a2=_context4.sent;l=_yield$a2.detail;t(l.value).to.equal("test"),setTimeout(function(){return s.dispatchEvent(new Event("change"));});_context4.next=17;return a(r,"nile-change");case 17:_yield$a3=_context4.sent;o=_yield$a3.detail;t(o.value).to.equal("test"),setTimeout(function(){return s.dispatchEvent(new Event("blur"));});_context4.next=22;return a(r,"nile-blur");case 22:_yield$a4=_context4.sent;c=_yield$a4.detail;t(c.value).to.equal("test");case 25:case"end":return _context4.stop();}},_callee3);}))),it("should update value property on input event",/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4(){var _a$shadowRoot$querySe,_a$shadowRoot;var a,r;return _regeneratorRuntime().wrap(function _callee4$(_context5){while(1)switch(_context5.prev=_context5.next){case 0:_context5.next=2;return e(i(_templateObject4||(_templateObject4=_taggedTemplateLiteral(["<nile-textarea></nile-textarea>"]))));case 2:a=_context5.sent;r=(_a$shadowRoot$querySe=(_a$shadowRoot=a.shadowRoot)===null||_a$shadowRoot===void 0?void 0:_a$shadowRoot.querySelector("textarea"))!==null&&_a$shadowRoot$querySe!==void 0?_a$shadowRoot$querySe:{};r.value="new value",r.dispatchEvent(new Event("input")),t(a.value).to.equal("new value");case 5:case"end":return _context5.stop();}},_callee4);}))),it('should handle the "rows" property correctly',/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5(){var _a$shadowRoot$querySe2,_a$shadowRoot2;var a,r;return _regeneratorRuntime().wrap(function _callee5$(_context6){while(1)switch(_context6.prev=_context6.next){case 0:_context6.next=2;return e(i(_templateObject5||(_templateObject5=_taggedTemplateLiteral(["<nile-textarea rows=\"10\"></nile-textarea>"]))));case 2:a=_context6.sent;r=(_a$shadowRoot$querySe2=(_a$shadowRoot2=a.shadowRoot)===null||_a$shadowRoot2===void 0?void 0:_a$shadowRoot2.querySelector("textarea"))!==null&&_a$shadowRoot$querySe2!==void 0?_a$shadowRoot$querySe2:{};t(r.rows).to.equal(10);case 5:case"end":return _context6.stop();}},_callee5);}))),it('should handle the "resize" property correctly',/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6(){var _a$shadowRoot$querySe3,_a$shadowRoot3;var a,r;return _regeneratorRuntime().wrap(function _callee6$(_context7){while(1)switch(_context7.prev=_context7.next){case 0:_context7.next=2;return e(i(_templateObject6||(_templateObject6=_taggedTemplateLiteral(["<nile-textarea resize=\"none\"></nile-textarea>"]))));case 2:a=_context7.sent;r=(_a$shadowRoot$querySe3=(_a$shadowRoot3=a.shadowRoot)===null||_a$shadowRoot3===void 0?void 0:_a$shadowRoot3.querySelector(".textarea"))!==null&&_a$shadowRoot$querySe3!==void 0?_a$shadowRoot$querySe3:{};t(r.classList.contains("textarea--resize-none")).to.be["true"];case 5:case"end":return _context7.stop();}},_callee6);}))),it("should select all text when select() is called",/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee7(){var _a$shadowRoot$querySe4,_a$shadowRoot4;var a,r;return _regeneratorRuntime().wrap(function _callee7$(_context8){while(1)switch(_context8.prev=_context8.next){case 0:_context8.next=2;return e(i(_templateObject7||(_templateObject7=_taggedTemplateLiteral(["<nile-textarea value=\"test value\"></nile-textarea>"]))));case 2:a=_context8.sent;a.select();r=(_a$shadowRoot$querySe4=(_a$shadowRoot4=a.shadowRoot)===null||_a$shadowRoot4===void 0?void 0:_a$shadowRoot4.querySelector("textarea"))!==null&&_a$shadowRoot$querySe4!==void 0?_a$shadowRoot$querySe4:{};t(r.selectionStart).to.equal(0),t(r.selectionEnd).to.equal(a.value.length);case 6:case"end":return _context8.stop();}},_callee7);}))),it("should set selection range correctly",/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee8(){var _a$shadowRoot$querySe5,_a$shadowRoot5;var a,r;return _regeneratorRuntime().wrap(function _callee8$(_context9){while(1)switch(_context9.prev=_context9.next){case 0:_context9.next=2;return e(i(_templateObject8||(_templateObject8=_taggedTemplateLiteral(["<nile-textarea value=\"test value\"></nile-textarea>"]))));case 2:a=_context9.sent;a.setSelectionRange(0,4);r=(_a$shadowRoot$querySe5=(_a$shadowRoot5=a.shadowRoot)===null||_a$shadowRoot5===void 0?void 0:_a$shadowRoot5.querySelector("textarea"))!==null&&_a$shadowRoot$querySe5!==void 0?_a$shadowRoot$querySe5:{};t(r.selectionStart).to.equal(0),t(r.selectionEnd).to.equal(4);case 6:case"end":return _context9.stop();}},_callee8);}))),it("should handle non-printable characters",/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee9(){var a,r;return _regeneratorRuntime().wrap(function _callee9$(_context10){while(1)switch(_context10.prev=_context10.next){case 0:_context10.next=2;return e(i(_templateObject9||(_templateObject9=_taggedTemplateLiteral(["<nile-textarea checkNonPrintableChar></nile-textarea>"]))));case 2:a=_context10.sent;a.value="test乇乂丅尺卂";a.handleValueChange();_context10.next=7;return a.updateComplete;case 7:t(a.hasPrintableCharacters).to.be["true"];r=String("乇乂丅尺卂").split("").some(function(e){return-1!=a.markedValue.indexOf(e);});t(r).to.be["true"];case 10:case"end":return _context10.stop();}},_callee9);}))),it("should remove non-printable characters correctly",/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee10(){var a;return _regeneratorRuntime().wrap(function _callee10$(_context11){while(1)switch(_context11.prev=_context11.next){case 0:_context11.next=2;return e(i(_templateObject10||(_templateObject10=_taggedTemplateLiteral(["<nile-textarea></nile-textarea>"]))));case 2:a=_context11.sent;a.value="test乇乂丅尺卂",a.removeAllNonPrintableCharacters(),t(a.value).to.equal("test");case 4:case"end":return _context11.stop();}},_callee10);})));});}};});
1
+ function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o;}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o;},_typeof(o);}System.register(["../fixture-d5b55278.cjs.js","lit/static-html.js","lit/html.js","lit/directive-helpers.js","lit","lit/directives/unsafe-html.js","./nile-textarea.cjs.js","tslib","lit/decorators.js","./nile-textarea.css.cjs.js","lit/directives/class-map.js","../internal/default-value.cjs.js","../internal/slot.cjs.js","lit/directives/if-defined.js","lit/directives/live.js","../internal/watch.cjs.js","../internal/nile-element.cjs.js"],function(_export,_context){"use strict";var e,t,a,i,_templateObject,_templateObject2,_templateObject3,_templateObject4,_templateObject5,_templateObject6,_templateObject7,_templateObject8,_templateObject9,_templateObject10;function _regeneratorRuntime(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */_regeneratorRuntime=function _regeneratorRuntime(){return e;};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value;},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function define(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e];}try{define({},"");}catch(t){define=function define(t,e,r){return t[e]=r;};}function wrap(t,e,r,n){var i=e&&e.prototype instanceof Generator?e:Generator,a=Object.create(i.prototype),c=new Context(n||[]);return o(a,"_invoke",{value:makeInvokeMethod(t,r,c)}),a;}function tryCatch(t,e,r){try{return{type:"normal",arg:t.call(e,r)};}catch(t){return{type:"throw",arg:t};}}e.wrap=wrap;var h="suspendedStart",l="suspendedYield",f="executing",s="completed",y={};function Generator(){}function GeneratorFunction(){}function GeneratorFunctionPrototype(){}var p={};define(p,a,function(){return this;});var d=Object.getPrototypeOf,v=d&&d(d(values([])));v&&v!==r&&n.call(v,a)&&(p=v);var g=GeneratorFunctionPrototype.prototype=Generator.prototype=Object.create(p);function defineIteratorMethods(t){["next","throw","return"].forEach(function(e){define(t,e,function(t){return this._invoke(e,t);});});}function AsyncIterator(t,e){function invoke(r,o,i,a){var c=tryCatch(t[r],t,o);if("throw"!==c.type){var u=c.arg,h=u.value;return h&&"object"==_typeof(h)&&n.call(h,"__await")?e.resolve(h.__await).then(function(t){invoke("next",t,i,a);},function(t){invoke("throw",t,i,a);}):e.resolve(h).then(function(t){u.value=t,i(u);},function(t){return invoke("throw",t,i,a);});}a(c.arg);}var r;o(this,"_invoke",{value:function value(t,n){function callInvokeWithMethodAndArg(){return new e(function(e,r){invoke(t,n,e,r);});}return r=r?r.then(callInvokeWithMethodAndArg,callInvokeWithMethodAndArg):callInvokeWithMethodAndArg();}});}function makeInvokeMethod(e,r,n){var o=h;return function(i,a){if(o===f)throw Error("Generator is already running");if(o===s){if("throw"===i)throw a;return{value:t,done:!0};}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var u=maybeInvokeDelegate(c,n);if(u){if(u===y)continue;return u;}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===h)throw o=s,n.arg;n.dispatchException(n.arg);}else"return"===n.method&&n.abrupt("return",n.arg);o=f;var p=tryCatch(e,r,n);if("normal"===p.type){if(o=n.done?s:l,p.arg===y)continue;return{value:p.arg,done:n.done};}"throw"===p.type&&(o=s,n.method="throw",n.arg=p.arg);}};}function maybeInvokeDelegate(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator["return"]&&(r.method="return",r.arg=t,maybeInvokeDelegate(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),y;var i=tryCatch(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,y;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,y):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,y);}function pushTryEntry(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e);}function resetTryEntry(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e;}function Context(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(pushTryEntry,this),this.reset(!0);}function values(e){if(e||""===e){var r=e[a];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function next(){for(;++o<e.length;)if(n.call(e,o))return next.value=e[o],next.done=!1,next;return next.value=t,next.done=!0,next;};return i.next=i;}}throw new TypeError(_typeof(e)+" is not iterable");}return GeneratorFunction.prototype=GeneratorFunctionPrototype,o(g,"constructor",{value:GeneratorFunctionPrototype,configurable:!0}),o(GeneratorFunctionPrototype,"constructor",{value:GeneratorFunction,configurable:!0}),GeneratorFunction.displayName=define(GeneratorFunctionPrototype,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===GeneratorFunction||"GeneratorFunction"===(e.displayName||e.name));},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,GeneratorFunctionPrototype):(t.__proto__=GeneratorFunctionPrototype,define(t,u,"GeneratorFunction")),t.prototype=Object.create(g),t;},e.awrap=function(t){return{__await:t};},defineIteratorMethods(AsyncIterator.prototype),define(AsyncIterator.prototype,c,function(){return this;}),e.AsyncIterator=AsyncIterator,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new AsyncIterator(wrap(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then(function(t){return t.done?t.value:a.next();});},defineIteratorMethods(g),define(g,u,"Generator"),define(g,a,function(){return this;}),define(g,"toString",function(){return"[object Generator]";}),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function next(){for(;r.length;){var t=r.pop();if(t in e)return next.value=t,next.done=!1,next;}return next.done=!0,next;};},e.values=values,Context.prototype={constructor:Context,reset:function reset(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(resetTryEntry),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t);},stop:function stop(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval;},dispatchException:function dispatchException(e){if(this.done)throw e;var r=this;function handle(n,o){return a.type="throw",a.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o;}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return handle("end");if(i.tryLoc<=this.prev){var c=n.call(i,"catchLoc"),u=n.call(i,"finallyLoc");if(c&&u){if(this.prev<i.catchLoc)return handle(i.catchLoc,!0);if(this.prev<i.finallyLoc)return handle(i.finallyLoc);}else if(c){if(this.prev<i.catchLoc)return handle(i.catchLoc,!0);}else{if(!u)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return handle(i.finallyLoc);}}}},abrupt:function abrupt(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break;}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,y):this.complete(a);},complete:function complete(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),y;},finish:function finish(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),resetTryEntry(r),y;}},"catch":function _catch(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;resetTryEntry(r);}return o;}}throw Error("illegal catch attempt");},delegateYield:function delegateYield(e,r,n){return this.delegate={iterator:values(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),y;}},e;}function _taggedTemplateLiteral(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}));}function asyncGeneratorStep(n,t,e,r,o,a,c){try{var i=n[a](c),u=i.value;}catch(n){return void e(n);}i.done?t(u):Promise.resolve(u).then(r,o);}function _asyncToGenerator(n){return function(){var t=this,e=arguments;return new Promise(function(r,o){var a=n.apply(t,e);function _next(n){asyncGeneratorStep(a,r,o,_next,_throw,"next",n);}function _throw(n){asyncGeneratorStep(a,r,o,_next,_throw,"throw",n);}_next(void 0);});};}return{setters:[function(_fixture001CjsJs){e=_fixture001CjsJs.f;t=_fixture001CjsJs.a;a=_fixture001CjsJs.o;},function(_litStaticHtmlJs){i=_litStaticHtmlJs.html;},function(_litHtmlJs){},function(_litDirectiveHelpersJs){},function(_lit){},function(_litDirectivesUnsafeHtmlJs){},function(_nileTextareaCjsJs){},function(_tslib){},function(_litDecoratorsJs){},function(_nileTextareaCssCjsJs){},function(_litDirectivesClassMapJs){},function(_internalDefaultValueCjsJs){},function(_internalSlotCjsJs){},function(_litDirectivesIfDefinedJs){},function(_litDirectivesLiveJs){},function(_internalWatchCjsJs){},function(_internalNileElementCjsJs){}],execute:function execute(){describe("<nile-textarea>",function(){it("should render the default properties correctly",/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(){var a;return _regeneratorRuntime().wrap(function _callee$(_context2){while(1)switch(_context2.prev=_context2.next){case 0:_context2.next=2;return e(i(_templateObject||(_templateObject=_taggedTemplateLiteral(["<nile-textarea></nile-textarea>"]))));case 2:a=_context2.sent;t(a.value).to.equal(""),t(a.size).to.equal("medium"),t(a.filled).to.be["false"],t(a.disabled).to.be["false"],t(a.readonly).to.be["false"],t(a.required).to.be["false"];case 4:case"end":return _context2.stop();}},_callee);}))),it("should reflect properties to attributes",/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(){var a;return _regeneratorRuntime().wrap(function _callee2$(_context3){while(1)switch(_context3.prev=_context3.next){case 0:_context3.next=2;return e(i(_templateObject2||(_templateObject2=_taggedTemplateLiteral(["<nile-textarea disabled readonly required></nile-textarea>"]))));case 2:a=_context3.sent;t(a.getAttribute("disabled")).to.equal(""),t(a.getAttribute("readonly")).to.equal(""),t(a.getAttribute("required")).to.equal("");case 4:case"end":return _context3.stop();}},_callee2);}))),it("should emit events correctly",/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee3(){var _r$shadowRoot$querySe,_r$shadowRoot;var r,s,_yield$a,n,_yield$a2,l,_yield$a3,o,_yield$a4,c;return _regeneratorRuntime().wrap(function _callee3$(_context4){while(1)switch(_context4.prev=_context4.next){case 0:_context4.next=2;return e(i(_templateObject3||(_templateObject3=_taggedTemplateLiteral(["<nile-textarea></nile-textarea>"]))));case 2:r=_context4.sent;s=(_r$shadowRoot$querySe=(_r$shadowRoot=r.shadowRoot)===null||_r$shadowRoot===void 0?void 0:_r$shadowRoot.querySelector("textarea"))!==null&&_r$shadowRoot$querySe!==void 0?_r$shadowRoot$querySe:{};setTimeout(function(){return s.dispatchEvent(new Event("focus"));});_context4.next=7;return a(r,"nile-focus");case 7:_yield$a=_context4.sent;n=_yield$a.detail;t(n.value).to.equal(""),s.value="test",setTimeout(function(){return s.dispatchEvent(new Event("input"));});_context4.next=12;return a(r,"nile-input");case 12:_yield$a2=_context4.sent;l=_yield$a2.detail;t(l.value).to.equal("test"),setTimeout(function(){return s.dispatchEvent(new Event("change"));});_context4.next=17;return a(r,"nile-change");case 17:_yield$a3=_context4.sent;o=_yield$a3.detail;t(o.value).to.equal("test"),setTimeout(function(){return s.dispatchEvent(new Event("blur"));});_context4.next=22;return a(r,"nile-blur");case 22:_yield$a4=_context4.sent;c=_yield$a4.detail;t(c.value).to.equal("test");case 25:case"end":return _context4.stop();}},_callee3);}))),it("should update value property on input event",/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee4(){var _a$shadowRoot$querySe,_a$shadowRoot;var a,r;return _regeneratorRuntime().wrap(function _callee4$(_context5){while(1)switch(_context5.prev=_context5.next){case 0:_context5.next=2;return e(i(_templateObject4||(_templateObject4=_taggedTemplateLiteral(["<nile-textarea></nile-textarea>"]))));case 2:a=_context5.sent;r=(_a$shadowRoot$querySe=(_a$shadowRoot=a.shadowRoot)===null||_a$shadowRoot===void 0?void 0:_a$shadowRoot.querySelector("textarea"))!==null&&_a$shadowRoot$querySe!==void 0?_a$shadowRoot$querySe:{};r.value="new value",r.dispatchEvent(new Event("input")),t(a.value).to.equal("new value");case 5:case"end":return _context5.stop();}},_callee4);}))),it('should handle the "rows" property correctly',/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee5(){var _a$shadowRoot$querySe2,_a$shadowRoot2;var a,r;return _regeneratorRuntime().wrap(function _callee5$(_context6){while(1)switch(_context6.prev=_context6.next){case 0:_context6.next=2;return e(i(_templateObject5||(_templateObject5=_taggedTemplateLiteral(["<nile-textarea rows=\"10\"></nile-textarea>"]))));case 2:a=_context6.sent;r=(_a$shadowRoot$querySe2=(_a$shadowRoot2=a.shadowRoot)===null||_a$shadowRoot2===void 0?void 0:_a$shadowRoot2.querySelector("textarea"))!==null&&_a$shadowRoot$querySe2!==void 0?_a$shadowRoot$querySe2:{};t(r.rows).to.equal(10);case 5:case"end":return _context6.stop();}},_callee5);}))),it('should handle the "resize" property correctly',/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee6(){var _a$shadowRoot$querySe3,_a$shadowRoot3;var a,r;return _regeneratorRuntime().wrap(function _callee6$(_context7){while(1)switch(_context7.prev=_context7.next){case 0:_context7.next=2;return e(i(_templateObject6||(_templateObject6=_taggedTemplateLiteral(["<nile-textarea resize=\"none\"></nile-textarea>"]))));case 2:a=_context7.sent;r=(_a$shadowRoot$querySe3=(_a$shadowRoot3=a.shadowRoot)===null||_a$shadowRoot3===void 0?void 0:_a$shadowRoot3.querySelector(".textarea"))!==null&&_a$shadowRoot$querySe3!==void 0?_a$shadowRoot$querySe3:{};t(r.classList.contains("textarea--resize-none")).to.be["true"];case 5:case"end":return _context7.stop();}},_callee6);}))),it("should select all text when select() is called",/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee7(){var _a$shadowRoot$querySe4,_a$shadowRoot4;var a,r;return _regeneratorRuntime().wrap(function _callee7$(_context8){while(1)switch(_context8.prev=_context8.next){case 0:_context8.next=2;return e(i(_templateObject7||(_templateObject7=_taggedTemplateLiteral(["<nile-textarea value=\"test value\"></nile-textarea>"]))));case 2:a=_context8.sent;a.select();r=(_a$shadowRoot$querySe4=(_a$shadowRoot4=a.shadowRoot)===null||_a$shadowRoot4===void 0?void 0:_a$shadowRoot4.querySelector("textarea"))!==null&&_a$shadowRoot$querySe4!==void 0?_a$shadowRoot$querySe4:{};t(r.selectionStart).to.equal(0),t(r.selectionEnd).to.equal(a.value.length);case 6:case"end":return _context8.stop();}},_callee7);}))),it("should set selection range correctly",/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee8(){var _a$shadowRoot$querySe5,_a$shadowRoot5;var a,r;return _regeneratorRuntime().wrap(function _callee8$(_context9){while(1)switch(_context9.prev=_context9.next){case 0:_context9.next=2;return e(i(_templateObject8||(_templateObject8=_taggedTemplateLiteral(["<nile-textarea value=\"test value\"></nile-textarea>"]))));case 2:a=_context9.sent;a.setSelectionRange(0,4);r=(_a$shadowRoot$querySe5=(_a$shadowRoot5=a.shadowRoot)===null||_a$shadowRoot5===void 0?void 0:_a$shadowRoot5.querySelector("textarea"))!==null&&_a$shadowRoot$querySe5!==void 0?_a$shadowRoot$querySe5:{};t(r.selectionStart).to.equal(0),t(r.selectionEnd).to.equal(4);case 6:case"end":return _context9.stop();}},_callee8);}))),it("should handle non-printable characters",/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee9(){var a,r;return _regeneratorRuntime().wrap(function _callee9$(_context10){while(1)switch(_context10.prev=_context10.next){case 0:_context10.next=2;return e(i(_templateObject9||(_templateObject9=_taggedTemplateLiteral(["<nile-textarea checkNonPrintableChar></nile-textarea>"]))));case 2:a=_context10.sent;a.value="test乇乂丅尺卂";a.handleValueChange();_context10.next=7;return a.updateComplete;case 7:t(a.hasPrintableCharacters).to.be["true"];r=String("乇乂丅尺卂").split("").some(function(e){return-1!=a.markedValue.indexOf(e);});t(r).to.be["true"];case 10:case"end":return _context10.stop();}},_callee9);}))),it("should remove non-printable characters correctly",/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee10(){var a;return _regeneratorRuntime().wrap(function _callee10$(_context11){while(1)switch(_context11.prev=_context11.next){case 0:_context11.next=2;return e(i(_templateObject10||(_templateObject10=_taggedTemplateLiteral(["<nile-textarea></nile-textarea>"]))));case 2:a=_context11.sent;a.value="test乇乂丅尺卂",a.removeAllNonPrintableCharacters(),t(a.value).to.equal("test");case 4:case"end":return _context11.stop();}},_callee10);})));});}};});
2
2
  //# sourceMappingURL=nile-textarea.test.cjs.js.map
@@ -1 +1 @@
1
- import{f as e,a as t,o as a}from"../fixture-db35a8ae.esm.js";import{html as i}from"lit/static-html.js";import"lit/html.js";import"lit/directive-helpers.js";import"lit";import"lit/directives/unsafe-html.js";import"./nile-textarea.esm.js";import"tslib";import"lit/decorators.js";import"./nile-textarea.css.esm.js";import"lit/directives/class-map.js";import"../internal/default-value.esm.js";import"../internal/slot.esm.js";import"lit/directives/if-defined.js";import"lit/directives/live.js";import"../internal/watch.esm.js";import"../internal/nile-element.esm.js";describe("<nile-textarea>",(()=>{it("should render the default properties correctly",(async()=>{const a=await e(i`<nile-textarea></nile-textarea>`);t(a.value).to.equal(""),t(a.size).to.equal("medium"),t(a.filled).to.be.false,t(a.disabled).to.be.false,t(a.readonly).to.be.false,t(a.required).to.be.false})),it("should reflect properties to attributes",(async()=>{const a=await e(i`<nile-textarea disabled readonly required></nile-textarea>`);t(a.getAttribute("disabled")).to.equal(""),t(a.getAttribute("readonly")).to.equal(""),t(a.getAttribute("required")).to.equal("")})),it("should emit events correctly",(async()=>{const r=await e(i`<nile-textarea></nile-textarea>`),s=r.shadowRoot?.querySelector("textarea")??{};setTimeout((()=>s.dispatchEvent(new Event("focus"))));const{detail:n}=await a(r,"nile-focus");t(n.value).to.equal(""),s.value="test",setTimeout((()=>s.dispatchEvent(new Event("input"))));const{detail:l}=await a(r,"nile-input");t(l.value).to.equal("test"),setTimeout((()=>s.dispatchEvent(new Event("change"))));const{detail:o}=await a(r,"nile-change");t(o.value).to.equal("test"),setTimeout((()=>s.dispatchEvent(new Event("blur"))));const{detail:c}=await a(r,"nile-blur");t(c.value).to.equal("test")})),it("should update value property on input event",(async()=>{const a=await e(i`<nile-textarea></nile-textarea>`),r=a.shadowRoot?.querySelector("textarea")??{};r.value="new value",r.dispatchEvent(new Event("input")),t(a.value).to.equal("new value")})),it('should handle the "rows" property correctly',(async()=>{const a=await e(i`<nile-textarea rows="10"></nile-textarea>`),r=a.shadowRoot?.querySelector("textarea")??{};t(r.rows).to.equal(10)})),it('should handle the "resize" property correctly',(async()=>{const a=await e(i`<nile-textarea resize="none"></nile-textarea>`),r=a.shadowRoot?.querySelector(".textarea")??{};t(r.classList.contains("textarea--resize-none")).to.be.true})),it("should select all text when select() is called",(async()=>{const a=await e(i`<nile-textarea value="test value"></nile-textarea>`);a.select();const r=a.shadowRoot?.querySelector("textarea")??{};t(r.selectionStart).to.equal(0),t(r.selectionEnd).to.equal(a.value.length)})),it("should set selection range correctly",(async()=>{const a=await e(i`<nile-textarea value="test value"></nile-textarea>`);a.setSelectionRange(0,4);const r=a.shadowRoot?.querySelector("textarea")??{};t(r.selectionStart).to.equal(0),t(r.selectionEnd).to.equal(4)})),it("should handle non-printable characters",(async()=>{const a=await e(i`<nile-textarea checkNonPrintableChar></nile-textarea>`);a.value="test乇乂丅尺卂",a.handleValueChange(),await a.updateComplete,t(a.hasPrintableCharacters).to.be.true;const r=String("乇乂丅尺卂").split("").some((e=>-1!=a.markedValue.indexOf(e)));t(r).to.be.true})),it("should remove non-printable characters correctly",(async()=>{const a=await e(i`<nile-textarea></nile-textarea>`);a.value="test乇乂丅尺卂",a.removeAllNonPrintableCharacters(),t(a.value).to.equal("test")}))}));
1
+ import{f as e,a as t,o as a}from"../fixture-df8b52d7.esm.js";import{html as i}from"lit/static-html.js";import"lit/html.js";import"lit/directive-helpers.js";import"lit";import"lit/directives/unsafe-html.js";import"./nile-textarea.esm.js";import"tslib";import"lit/decorators.js";import"./nile-textarea.css.esm.js";import"lit/directives/class-map.js";import"../internal/default-value.esm.js";import"../internal/slot.esm.js";import"lit/directives/if-defined.js";import"lit/directives/live.js";import"../internal/watch.esm.js";import"../internal/nile-element.esm.js";describe("<nile-textarea>",(()=>{it("should render the default properties correctly",(async()=>{const a=await e(i`<nile-textarea></nile-textarea>`);t(a.value).to.equal(""),t(a.size).to.equal("medium"),t(a.filled).to.be.false,t(a.disabled).to.be.false,t(a.readonly).to.be.false,t(a.required).to.be.false})),it("should reflect properties to attributes",(async()=>{const a=await e(i`<nile-textarea disabled readonly required></nile-textarea>`);t(a.getAttribute("disabled")).to.equal(""),t(a.getAttribute("readonly")).to.equal(""),t(a.getAttribute("required")).to.equal("")})),it("should emit events correctly",(async()=>{const r=await e(i`<nile-textarea></nile-textarea>`),s=r.shadowRoot?.querySelector("textarea")??{};setTimeout((()=>s.dispatchEvent(new Event("focus"))));const{detail:n}=await a(r,"nile-focus");t(n.value).to.equal(""),s.value="test",setTimeout((()=>s.dispatchEvent(new Event("input"))));const{detail:l}=await a(r,"nile-input");t(l.value).to.equal("test"),setTimeout((()=>s.dispatchEvent(new Event("change"))));const{detail:o}=await a(r,"nile-change");t(o.value).to.equal("test"),setTimeout((()=>s.dispatchEvent(new Event("blur"))));const{detail:c}=await a(r,"nile-blur");t(c.value).to.equal("test")})),it("should update value property on input event",(async()=>{const a=await e(i`<nile-textarea></nile-textarea>`),r=a.shadowRoot?.querySelector("textarea")??{};r.value="new value",r.dispatchEvent(new Event("input")),t(a.value).to.equal("new value")})),it('should handle the "rows" property correctly',(async()=>{const a=await e(i`<nile-textarea rows="10"></nile-textarea>`),r=a.shadowRoot?.querySelector("textarea")??{};t(r.rows).to.equal(10)})),it('should handle the "resize" property correctly',(async()=>{const a=await e(i`<nile-textarea resize="none"></nile-textarea>`),r=a.shadowRoot?.querySelector(".textarea")??{};t(r.classList.contains("textarea--resize-none")).to.be.true})),it("should select all text when select() is called",(async()=>{const a=await e(i`<nile-textarea value="test value"></nile-textarea>`);a.select();const r=a.shadowRoot?.querySelector("textarea")??{};t(r.selectionStart).to.equal(0),t(r.selectionEnd).to.equal(a.value.length)})),it("should set selection range correctly",(async()=>{const a=await e(i`<nile-textarea value="test value"></nile-textarea>`);a.setSelectionRange(0,4);const r=a.shadowRoot?.querySelector("textarea")??{};t(r.selectionStart).to.equal(0),t(r.selectionEnd).to.equal(4)})),it("should handle non-printable characters",(async()=>{const a=await e(i`<nile-textarea checkNonPrintableChar></nile-textarea>`);a.value="test乇乂丅尺卂",a.handleValueChange(),await a.updateComplete,t(a.hasPrintableCharacters).to.be.true;const r=String("乇乂丅尺卂").split("").some((e=>-1!=a.markedValue.indexOf(e)));t(r).to.be.true})),it("should remove non-printable characters correctly",(async()=>{const a=await e(i`<nile-textarea></nile-textarea>`);a.value="test乇乂丅尺卂",a.removeAllNonPrintableCharacters(),t(a.value).to.equal("test")}))}));
@@ -1,2 +1,2 @@
1
- System.register(["./nile-tooltip.cjs.js","tslib","lit","lit/decorators.js","lit/directives/class-map.js","./nile-tooltip.css.cjs.js","../internal/nile-element.cjs.js"],function(_export,_context){"use strict";return{setters:[function(_nileTooltipCjsJs){_export("NileTooltip",_nileTooltipCjsJs.N);},function(_tslib){},function(_lit){},function(_litDecoratorsJs){},function(_litDirectivesClassMapJs){},function(_nileTooltipCssCjsJs){},function(_internalNileElementCjsJs){}],execute:function execute(){}};});
1
+ System.register(["./nile-tooltip.cjs.js","tslib","lit","lit/decorators.js","lit/directives/class-map.js","./nile-tooltip.css.cjs.js","../internal/nile-element.cjs.js","./nile-tooltip-utils.cjs.js"],function(_export,_context){"use strict";return{setters:[function(_nileTooltipCjsJs){_export("NileTooltip",_nileTooltipCjsJs.N);},function(_tslib){},function(_lit){},function(_litDecoratorsJs){},function(_litDirectivesClassMapJs){},function(_nileTooltipCssCjsJs){},function(_internalNileElementCjsJs){},function(_nileTooltipUtilsCjsJs){}],execute:function execute(){}};});
2
2
  //# sourceMappingURL=index.cjs.js.map
@@ -1 +1 @@
1
- export{N as NileTooltip}from"./nile-tooltip.esm.js";import"tslib";import"lit";import"lit/decorators.js";import"lit/directives/class-map.js";import"./nile-tooltip.css.esm.js";import"../internal/nile-element.esm.js";
1
+ export{N as NileTooltip}from"./nile-tooltip.esm.js";import"tslib";import"lit";import"lit/decorators.js";import"lit/directives/class-map.js";import"./nile-tooltip.css.esm.js";import"../internal/nile-element.esm.js";import"./nile-tooltip-utils.esm.js";
@@ -0,0 +1,2 @@
1
+ System.register([],function(_export,_context){"use strict";function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o;}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o;},_typeof(o);}function _slicedToArray(r,e){return _arrayWithHoles(r)||_iterableToArrayLimit(r,e)||_unsupportedIterableToArray(r,e)||_nonIterableRest();}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _unsupportedIterableToArray(r,a){if(r){if("string"==typeof r)return _arrayLikeToArray(r,a);var t={}.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(r,a):void 0;}}function _arrayLikeToArray(r,a){(null==a||a>r.length)&&(a=r.length);for(var e=0,n=Array(a);e<a;e++)n[e]=r[e];return n;}function _iterableToArrayLimit(r,l){var t=null==r?null:"undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(null!=t){var e,n,i,u,a=[],f=!0,o=!1;try{if(i=(t=t.call(r)).next,0===l){if(Object(t)!==t)return;f=!1;}else for(;!(f=(e=i.call(t)).done)&&(a.push(e.value),a.length!==l);f=!0);}catch(r){o=!0,n=r;}finally{try{if(!f&&null!=t["return"]&&(u=t["return"](),Object(u)!==u))return;}finally{if(o)throw n;}}return a;}}function _arrayWithHoles(r){if(Array.isArray(r))return r;}function ownKeys(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);r&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable;})),t.push.apply(t,o);}return t;}function _objectSpread(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?ownKeys(Object(t),!0).forEach(function(r){_defineProperty(e,r,t[r]);}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):ownKeys(Object(t)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r));});}return e;}function _defineProperty(e,r,t){return(r=_toPropertyKey(r))in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e;}function _toPropertyKey(t){var i=_toPrimitive(t,"string");return"symbol"==_typeof(i)?i:i+"";}function _toPrimitive(t,r){if("object"!=_typeof(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,r||"default");if("object"!=_typeof(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.");}return("string"===r?String:Number)(t);}function t(t){var e=t.getBoundingClientRect();return e.top>=0&&e.left>=0&&e.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&e.right<=(window.innerWidth||document.documentElement.clientWidth);}function e(t,e,a,r,c,o,s,n){var b=t.left+t.width/2,i=function i(a){var s=0,n=0;switch(a){case"top":default:s=t.top-e.height-r,n=t.left+(t.width-e.width)/2+c;break;case"top-start":s=t.top-e.height-r,n=b-o+c;break;case"top-end":s=t.top-e.height-r,n=b-e.width+o+10+c;break;case"bottom":s=t.bottom+r,n=t.left+(t.width-e.width)/2+c;break;case"bottom-start":s=t.bottom+r,n=b-o-10+c;break;case"bottom-end":s=t.bottom+r,n=b-(e.width-o)+10+c;break;case"left":s=t.top+(t.height-e.height)/2+c,n=t.left-e.width-r;break;case"left-start":s=t.top+c,n=t.left-e.width-r;break;case"left-end":s=t.bottom-e.height+c,n=t.left-e.width-r;break;case"right":s=t.top+(t.height-e.height)/2+c,n=t.right+r;break;case"right-start":s=t.top+c,n=t.right+r;break;case"right-end":s=t.bottom-e.height+c,n=t.right+r;}return{top:s,left:n};};var k=a,d=i(k);var l,f;return l=d.top,f=d.left,l>=0&&f>=0&&l+e.height<=n&&f+e.width<=s||k.startsWith("bottom")||(k="bottom",d=i(k)),d.left<0?d.left=5:d.left+e.width>s&&(d.left=s-e.width-5),d.top<0?d.top=5:d.top+e.height>n&&(d.top=n-e.height-5),_objectSpread(_objectSpread({},d),{},{placement:k});}function a(_ref){var t=_ref.placement,e=_ref.tooltipRect,a=_ref.triggerRect,r=_ref.caretSize,c=_ref.left,o=_ref.top;var s=a.left+a.width/2,n=a.top+a.height/2,_t$split=t.split("-"),_t$split2=_slicedToArray(_t$split,2),b=_t$split2[0],i=_t$split2[1];var k=0,d=0;switch(b){case"top":d=e.height-r,k=s-c-r,"top-end"===t||"start"===i?k=s-c-r:"end"===i&&(k=e.width-2*r+8),k=Math.max(r,Math.min(k,e.width-2*r));break;case"bottom":d=-r,k=s-c-r;break;case"left":k=e.width-r,d="start"===i?a.height/2-r:"end"===i?e.height-a.height/2-r:n-o-r,d=Math.max(r,Math.min(d,e.height-2*r));break;case"right":k=-r,d="start"===i?a.height/2-r:"end"===i?e.height-a.height/2-r:n-o-r,d=Math.max(r,Math.min(d,e.height-2*r));break;default:k=e.width/2-r,d=e.height/2-r;}return{caretLeft:k,caretTop:d};}_export({a:a,g:e,i:t});return{setters:[],execute:function execute(){}};});
2
+ //# sourceMappingURL=nile-tooltip-utils.cjs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nile-tooltip-utils.cjs.js","sources":["../../../src/nile-tooltip/nile-tooltip-utils.ts"],"sourcesContent":["export function isInViewport(element: HTMLElement): boolean {\n const rect = element.getBoundingClientRect();\n return (\n rect.top >= 0 &&\n rect.left >= 0 &&\n rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) &&\n rect.right <= (window.innerWidth || document.documentElement.clientWidth)\n );\n}\n\n\nexport function getValidTooltipPosition(\n triggerRect: DOMRect,\n tooltipRect: DOMRect,\n originalPlacement: string,\n distance: number,\n skidding: number,\n caretSize: number,\n viewportWidth: number,\n viewportHeight: number\n): { top: number; left: number; placement: string } {\n const triggerCenterX = triggerRect.left + triggerRect.width / 2;\n\n const getCandidatePosition = (placement: string) => {\n let top = 0;\n let left = 0;\n\n switch (placement) {\n case 'top':\n top = triggerRect.top - tooltipRect.height - distance;\n left = triggerRect.left + (triggerRect.width - tooltipRect.width) / 2 + skidding;\n break;\n case 'top-start':\n top = triggerRect.top - tooltipRect.height - distance;\n left = triggerCenterX - caretSize + skidding;\n break;\n case 'top-end':\n top = triggerRect.top - tooltipRect.height - distance;\n left = triggerCenterX - tooltipRect.width + caretSize + 10 + skidding;\n break;\n case 'bottom':\n top = triggerRect.bottom + distance;\n left = triggerRect.left + (triggerRect.width - tooltipRect.width) / 2 + skidding;\n break;\n case 'bottom-start':\n top = triggerRect.bottom + distance;\n left = triggerCenterX - caretSize - 10 + skidding;\n break;\n case 'bottom-end':\n top = triggerRect.bottom + distance;\n left = triggerCenterX - (tooltipRect.width - caretSize) + 10 + skidding;\n break;\n case 'left':\n top = triggerRect.top + (triggerRect.height - tooltipRect.height) / 2 + skidding;\n left = triggerRect.left - tooltipRect.width - distance;\n break;\n case 'left-start':\n top = triggerRect.top + skidding;\n left = triggerRect.left - tooltipRect.width - distance;\n break;\n case 'left-end':\n top = triggerRect.bottom - tooltipRect.height + skidding;\n left = triggerRect.left - tooltipRect.width - distance;\n break;\n case 'right':\n top = triggerRect.top + (triggerRect.height - tooltipRect.height) / 2 + skidding;\n left = triggerRect.right + distance;\n break;\n case 'right-start':\n top = triggerRect.top + skidding;\n left = triggerRect.right + distance;\n break;\n case 'right-end':\n top = triggerRect.bottom - tooltipRect.height + skidding;\n left = triggerRect.right + distance;\n break;\n default:\n top = triggerRect.top - tooltipRect.height - distance;\n left = triggerRect.left + (triggerRect.width - tooltipRect.width) / 2 + skidding;\n }\n\n return { top, left };\n };\n\n const candidateFits = (top: number, left: number) =>\n top >= 0 &&\n left >= 0 &&\n top + tooltipRect.height <= viewportHeight &&\n left + tooltipRect.width <= viewportWidth;\n\n let placement = originalPlacement;\n let candidate = getCandidatePosition(placement);\n\n if (!candidateFits(candidate.top, candidate.left)) {\n if (!placement.startsWith('bottom')) {\n placement = 'bottom';\n candidate = getCandidatePosition(placement);\n }\n }\n\n if (candidate.left < 0) {\n candidate.left = 5;\n } else if (candidate.left + tooltipRect.width > viewportWidth) {\n candidate.left = viewportWidth - tooltipRect.width - 5;\n }\n\n if (candidate.top < 0) {\n candidate.top = 5;\n } else if (candidate.top + tooltipRect.height > viewportHeight) {\n candidate.top = viewportHeight - tooltipRect.height - 5;\n }\n\n return { ...candidate, placement };\n}\n\nexport interface CaretPositionInput {\n placement: string;\n tooltipRect: DOMRect;\n triggerRect: DOMRect;\n caretSize: number;\n left: number;\n top: number;\n}\n\nexport function getCaretPosition({\n placement,\n tooltipRect,\n triggerRect,\n caretSize,\n left,\n top\n}: CaretPositionInput): { caretLeft: number; caretTop: number } {\n const triggerCenterX = triggerRect.left + triggerRect.width / 2;\n const triggerCenterY = triggerRect.top + triggerRect.height / 2;\n\n const [primaryPlacement, secondaryPlacement] = placement.split('-');\n\n let caretLeft = 0;\n let caretTop = 0;\n\n switch (primaryPlacement) {\n case 'top':\n caretTop = tooltipRect.height - caretSize;\n caretLeft = triggerCenterX - left - caretSize;\n if (placement === 'top-end') {\n caretLeft = triggerCenterX - left - caretSize;\n } else if (secondaryPlacement === 'start') {\n caretLeft = triggerCenterX - left - caretSize;\n } else if (secondaryPlacement === 'end') {\n caretLeft = tooltipRect.width - 2 * caretSize + 8;\n }\n caretLeft = Math.max(caretSize, Math.min(caretLeft, tooltipRect.width - 2 * caretSize));\n break;\n\n case 'bottom':\n caretTop = -caretSize;\n caretLeft = triggerCenterX - left - caretSize;\n break;\n\n case 'left':\n caretLeft = tooltipRect.width - caretSize;\n if (secondaryPlacement === 'start') {\n caretTop = triggerRect.height / 2 - caretSize;\n } else if (secondaryPlacement === 'end') {\n caretTop = tooltipRect.height - triggerRect.height / 2 - caretSize;\n } else {\n caretTop = triggerCenterY - top - caretSize;\n }\n caretTop = Math.max(caretSize, Math.min(caretTop, tooltipRect.height - 2 * caretSize));\n break;\n\n case 'right':\n caretLeft = -caretSize;\n if (secondaryPlacement === 'start') {\n caretTop = triggerRect.height / 2 - caretSize;\n } else if (secondaryPlacement === 'end') {\n caretTop = tooltipRect.height - triggerRect.height / 2 - caretSize;\n } else {\n caretTop = triggerCenterY - top - caretSize;\n }\n caretTop = Math.max(caretSize, Math.min(caretTop, tooltipRect.height - 2 * caretSize));\n break;\n\n default:\n caretLeft = tooltipRect.width / 2 - caretSize;\n caretTop = tooltipRect.height / 2 - caretSize;\n }\n\n return { caretLeft, caretTop };\n}"],"names":["isInViewport","element","rect","getBoundingClientRect","top","left","bottom","window","innerHeight","document","documentElement","clientHeight","right","innerWidth","clientWidth","getValidTooltipPosition","triggerRect","tooltipRect","originalPlacement","distance","skidding","caretSize","viewportWidth","viewportHeight","triggerCenterX","width","getCandidatePosition","placement","height","candidate","startsWith","_objectSpread","k","getCaretPosition","_ref","triggerCenterY","primaryPlacement","split","_t$split2","_slicedToArray","_t$split","secondaryPlacement","caretLeft","caretTop","Math","max","min"],"mappings":"srFAAM,QAAUA,CAAAA,CAAAA,CAAaC,CAC3B,CAAA,CAAA,GAAMC,CAAAA,CAAOD,CAAAA,CAAAA,CAAQE,qBACrB,CAAA,CAAA,CAAA,MACED,CAAAA,CAAKE,CAAAA,GAAAA,EAAO,CACZF,EAAAA,CAAAA,CAAKG,IAAQ,EAAA,CAAA,EACbH,EAAKI,MAAWC,GAAAA,MAAAA,CAAOC,WAAeC,EAAAA,QAAAA,CAASC,eAAgBC,CAAAA,YAAAA,CAAAA,EAC/DT,CAAKU,CAAAA,KAAAA,GAAUL,MAAOM,CAAAA,UAAAA,EAAcJ,QAASC,CAAAA,eAAAA,CAAgBI,WAEjE,CAAA,UAGgBC,CAAAA,CACdC,CAAAA,CAAAA,CACAC,CACAC,CAAAA,CAAAA,CACAC,CACAC,CAAAA,CAAAA,CACAC,CACAC,CAAAA,CAAAA,CACAC,CAEA,CAAA,CAAA,GAAMC,CAAAA,CAAiBR,CAAAA,CAAAA,CAAYX,IAAOW,CAAAA,CAAAA,CAAYS,MAAQ,CAExDC,CAAAA,CA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AA,CAAAA,QAAAA,CAAAA,CAAAA,CACtB"}
@@ -0,0 +1 @@
1
+ function t(t){const e=t.getBoundingClientRect();return e.top>=0&&e.left>=0&&e.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&e.right<=(window.innerWidth||document.documentElement.clientWidth)}function e(t,e,a,r,c,o,s,n){const b=t.left+t.width/2,i=a=>{let s=0,n=0;switch(a){case"top":default:s=t.top-e.height-r,n=t.left+(t.width-e.width)/2+c;break;case"top-start":s=t.top-e.height-r,n=b-o+c;break;case"top-end":s=t.top-e.height-r,n=b-e.width+o+10+c;break;case"bottom":s=t.bottom+r,n=t.left+(t.width-e.width)/2+c;break;case"bottom-start":s=t.bottom+r,n=b-o-10+c;break;case"bottom-end":s=t.bottom+r,n=b-(e.width-o)+10+c;break;case"left":s=t.top+(t.height-e.height)/2+c,n=t.left-e.width-r;break;case"left-start":s=t.top+c,n=t.left-e.width-r;break;case"left-end":s=t.bottom-e.height+c,n=t.left-e.width-r;break;case"right":s=t.top+(t.height-e.height)/2+c,n=t.right+r;break;case"right-start":s=t.top+c,n=t.right+r;break;case"right-end":s=t.bottom-e.height+c,n=t.right+r}return{top:s,left:n}};let k=a,d=i(k);var l,f;return l=d.top,f=d.left,l>=0&&f>=0&&l+e.height<=n&&f+e.width<=s||k.startsWith("bottom")||(k="bottom",d=i(k)),d.left<0?d.left=5:d.left+e.width>s&&(d.left=s-e.width-5),d.top<0?d.top=5:d.top+e.height>n&&(d.top=n-e.height-5),{...d,placement:k}}function a({placement:t,tooltipRect:e,triggerRect:a,caretSize:r,left:c,top:o}){const s=a.left+a.width/2,n=a.top+a.height/2,[b,i]=t.split("-");let k=0,d=0;switch(b){case"top":d=e.height-r,k=s-c-r,"top-end"===t||"start"===i?k=s-c-r:"end"===i&&(k=e.width-2*r+8),k=Math.max(r,Math.min(k,e.width-2*r));break;case"bottom":d=-r,k=s-c-r;break;case"left":k=e.width-r,d="start"===i?a.height/2-r:"end"===i?e.height-a.height/2-r:n-o-r,d=Math.max(r,Math.min(d,e.height-2*r));break;case"right":k=-r,d="start"===i?a.height/2-r:"end"===i?e.height-a.height/2-r:n-o-r,d=Math.max(r,Math.min(d,e.height-2*r));break;default:k=e.width/2-r,d=e.height/2-r}return{caretLeft:k,caretTop:d}}export{a,e as g,t as i};
@@ -1,2 +1,2 @@
1
- function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o;}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o;},_typeof(o);}System.register(["tslib","lit","lit/decorators.js","lit/directives/class-map.js","./nile-tooltip.css.cjs.js","../internal/nile-element.cjs.js"],function(_export,_context){"use strict";var t,i,s,e,o,h,r,l,_templateObject,n;function _taggedTemplateLiteral(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}));}function _classCallCheck(a,n){if(!(a instanceof n))throw new TypeError("Cannot call a class as a function");}function _defineProperties(e,r){for(var t=0;t<r.length;t++){var o=r[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,_toPropertyKey(o.key),o);}}function _createClass(e,r,t){return r&&_defineProperties(e.prototype,r),t&&_defineProperties(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e;}function _toPropertyKey(t){var i=_toPrimitive(t,"string");return"symbol"==_typeof(i)?i:i+"";}function _toPrimitive(t,r){if("object"!=_typeof(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,r||"default");if("object"!=_typeof(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.");}return("string"===r?String:Number)(t);}function _callSuper(t,o,e){return o=_getPrototypeOf(o),_possibleConstructorReturn(t,_isNativeReflectConstruct()?Reflect.construct(o,e||[],_getPrototypeOf(t).constructor):o.apply(t,e));}function _possibleConstructorReturn(t,e){if(e&&("object"==_typeof(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(t);}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e;}function _isNativeReflectConstruct(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch(t){}return(_isNativeReflectConstruct=function _isNativeReflectConstruct(){return!!t;})();}function _superPropGet(t,o,e,r){var p=_get(_getPrototypeOf(1&r?t.prototype:t),o,e);return 2&r&&"function"==typeof p?function(t){return p.apply(e,t);}:p;}function _get(){return _get="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var p=_superPropBase(e,t);if(p){var n=Object.getOwnPropertyDescriptor(p,t);return n.get?n.get.call(arguments.length<3?e:r):n.value;}},_get.apply(null,arguments);}function _superPropBase(t,o){for(;!{}.hasOwnProperty.call(t,o)&&null!==(t=_getPrototypeOf(t)););return t;}function _getPrototypeOf(t){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t);},_getPrototypeOf(t);}function _inherits(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&_setPrototypeOf(t,e);}function _setPrototypeOf(t,e){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t;},_setPrototypeOf(t,e);}return{setters:[function(_tslib){t=_tslib.__decorate;},function(_lit){i=_lit.html;},function(_litDecoratorsJs){s=_litDecoratorsJs.property;e=_litDecoratorsJs.query;o=_litDecoratorsJs.customElement;},function(_litDirectivesClassMapJs){h=_litDirectivesClassMapJs.classMap;},function(_nileTooltipCssCjsJs){r=_nileTooltipCssCjsJs.s;},function(_internalNileElementCjsJs){l=_internalNileElementCjsJs.N;}],execute:function execute(){_export("N",n=/*#__PURE__*/function(_l){function n(){var _this;_classCallCheck(this,n);_this=_callSuper(this,n,arguments),_this.content="",_this.size="small",_this.placement="top",_this.disabled=!1,_this.open=!1,_this.trigger="hover focus",_this.distance=8,_this.skidding=0,_this.hoist=!1,_this.updateTooltipPosition=function(){if(!_this.tooltip||!_this.open)return;var t=_this.slotElement.assignedElements()[0];if(!t)return;var i=t.getBoundingClientRect(),s=_this.tooltip.getBoundingClientRect(),e=window.innerWidth,o=window.innerHeight;var h=0,r=0,l=_this.placement;var _n=_this.getBasePlacement(_this.placement),c=_this.getAlignmentModifier(_this.placement),a=i.left-s.width-_this.distance>0,d=i.right+s.width+_this.distance<e,p=i.bottom+s.height+_this.distance<o,m=i.top-s.height-_this.distance>0;var u=_n;"left"===_n&&!a||"right"===_n&&!d?u=p?"bottom":m?"top":"bottom":"top"!==_n||m?"bottom"!==_n||p||(u=m?"top":a?"left":"right"):u=p?"bottom":a?"left":"right";var f=c;switch("left"!==_n&&"right"!==_n||"top"!==u&&"bottom"!==u||("start"===c?f="start":"end"===c&&(f="end")),u){case"left":h=i.top+(i.height-s.height)/2+_this.skidding,r=i.left-s.width-_this.distance;break;case"right":h=i.top+(i.height-s.height)/2+_this.skidding,r=i.right+_this.distance;break;case"top":h=i.top-s.height-_this.distance,r=i.left+(i.width-s.width)/2+_this.skidding;break;case"bottom":h=i.bottom+_this.distance,r=i.left+(i.width-s.width)/2+_this.skidding;}"top"!==u&&"bottom"!==u||!f||("start"===f?r=i.left+_this.skidding:"end"===f&&(r=i.right-s.width+_this.skidding)),"left"!==u&&"right"!==u||!f||("start"===f?h=i.top+_this.skidding:"end"===f&&(h=i.bottom-s.height+_this.skidding)),l=f?"".concat(u,"-").concat(f):u,r<0&&(r=5),r+s.width>e&&(r=e-s.width-5),h<0&&(h=5),h+s.height>o&&(h=o-s.height-5),_this.tooltip.style.top="".concat(h,"px"),_this.tooltip.style.left="".concat(r,"px"),_this.tooltip.setAttribute("data-placement",l);},_this.showTooltip=function(){_this.disabled||""===_this.content.trim()||(_this.open=!0,_this.emit("nile-show"),_this.updateComplete.then(function(){_this.updateTooltipPosition(),_this.tooltip.addEventListener("transitionend",_this.handleAfterShow,{once:!0});}));},_this.handleAfterShow=function(){_this.emit("nile-after-show");},_this.hideTooltip=function(){_this.open&&(_this.emit("nile-hide"),_this.open=!1,_this.tooltip.addEventListener("transitionend",_this.handleAfterHide,{once:!0}));},_this.handleAfterHide=function(){_this.emit("nile-after-hide");},_this.handleMouseOver=function(){_this.trigger.includes("hover")&&(clearTimeout(_this.hoverTimeout),_this.hoverTimeout=window.setTimeout(function(){return _this.showTooltip();},150));},_this.handleMouseOut=function(){_this.trigger.includes("hover")&&(clearTimeout(_this.hoverTimeout),_this.hoverTimeout=window.setTimeout(function(){return _this.hideTooltip();},0));},_this.handleClick=function(){_this.trigger.includes("click")&&(_this.open=!_this.open,_this.emit("nile-show"),_this.updateComplete.then(function(){return _this.updateTooltipPosition();}));},_this.handleFocus=function(){_this.trigger.includes("focus")&&_this.showTooltip();},_this.handleBlur=function(){_this.trigger.includes("focus")&&_this.hideTooltip();};return _this;}_inherits(n,_l);return _createClass(n,[{key:"connectedCallback",value:function connectedCallback(){_superPropGet(n,"connectedCallback",this,3)([]),window.addEventListener("resize",this.updateTooltipPosition),window.addEventListener("scroll",this.updateTooltipPosition,!0);}},{key:"disconnectedCallback",value:function disconnectedCallback(){_superPropGet(n,"disconnectedCallback",this,3)([]),window.removeEventListener("resize",this.updateTooltipPosition),window.removeEventListener("scroll",this.updateTooltipPosition,!0);}},{key:"getBasePlacement",value:function getBasePlacement(t){return t.split("-")[0];}},{key:"getAlignmentModifier",value:function getAlignmentModifier(t){var i=t.split("-");return i.length>1?i[1]:null;}},{key:"updated",value:function updated(t){_superPropGet(n,"updated",this,3)([t]),(t.has("open")||t.has("hoist"))&&this.open&&this.hoist;}},{key:"render",value:function render(){return i(_templateObject||(_templateObject=_taggedTemplateLiteral(["\n <div class=",">\n ","\n </div>\n <slot\n @mouseover=","\n @mouseout=","\n @click=","\n @focus=","\n @blur=","\n aria-describedby=\"tooltip\"\n ></slot>\n "])),h({tooltip:!0,"tooltip__body--large":"large"===this.size}),this.content,this.handleMouseOver,this.handleMouseOut,this.handleClick,this.handleFocus,this.handleBlur);}}],[{key:"styles",get:function get(){return[r];}}]);}(l));t([s({type:String})],n.prototype,"content",void 0),t([s({reflect:!0})],n.prototype,"size",void 0),t([s({type:String})],n.prototype,"placement",void 0),t([s({type:Boolean,reflect:!0})],n.prototype,"disabled",void 0),t([s({type:Boolean,reflect:!0})],n.prototype,"open",void 0),t([s()],n.prototype,"trigger",void 0),t([s({type:Number})],n.prototype,"distance",void 0),t([s({type:Number})],n.prototype,"skidding",void 0),t([s({type:Boolean})],n.prototype,"hoist",void 0),t([e(".tooltip")],n.prototype,"tooltip",void 0),t([e("slot")],n.prototype,"slotElement",void 0),_export("N",n=t([o("nile-tooltip")],n));}};});
1
+ function _typeof(o){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(o){return typeof o;}:function(o){return o&&"function"==typeof Symbol&&o.constructor===Symbol&&o!==Symbol.prototype?"symbol":typeof o;},_typeof(o);}System.register(["tslib","lit","lit/decorators.js","lit/directives/class-map.js","./nile-tooltip.css.cjs.js","../internal/nile-element.cjs.js","./nile-tooltip-utils.cjs.js"],function(_export,_context){"use strict";var t,i,s,o,e,h,l,r,n,c,a,_templateObject,_templateObject2,d;function _taggedTemplateLiteral(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}));}function _classCallCheck(a,n){if(!(a instanceof n))throw new TypeError("Cannot call a class as a function");}function _defineProperties(e,r){for(var t=0;t<r.length;t++){var o=r[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,_toPropertyKey(o.key),o);}}function _createClass(e,r,t){return r&&_defineProperties(e.prototype,r),t&&_defineProperties(e,t),Object.defineProperty(e,"prototype",{writable:!1}),e;}function _toPropertyKey(t){var i=_toPrimitive(t,"string");return"symbol"==_typeof(i)?i:i+"";}function _toPrimitive(t,r){if("object"!=_typeof(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var i=e.call(t,r||"default");if("object"!=_typeof(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.");}return("string"===r?String:Number)(t);}function _callSuper(t,o,e){return o=_getPrototypeOf(o),_possibleConstructorReturn(t,_isNativeReflectConstruct()?Reflect.construct(o,e||[],_getPrototypeOf(t).constructor):o.apply(t,e));}function _possibleConstructorReturn(t,e){if(e&&("object"==_typeof(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return _assertThisInitialized(t);}function _assertThisInitialized(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e;}function _isNativeReflectConstruct(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch(t){}return(_isNativeReflectConstruct=function _isNativeReflectConstruct(){return!!t;})();}function _superPropGet(t,o,e,r){var p=_get(_getPrototypeOf(1&r?t.prototype:t),o,e);return 2&r&&"function"==typeof p?function(t){return p.apply(e,t);}:p;}function _get(){return _get="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,r){var p=_superPropBase(e,t);if(p){var n=Object.getOwnPropertyDescriptor(p,t);return n.get?n.get.call(arguments.length<3?e:r):n.value;}},_get.apply(null,arguments);}function _superPropBase(t,o){for(;!{}.hasOwnProperty.call(t,o)&&null!==(t=_getPrototypeOf(t)););return t;}function _getPrototypeOf(t){return _getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t);},_getPrototypeOf(t);}function _inherits(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&_setPrototypeOf(t,e);}function _setPrototypeOf(t,e){return _setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t;},_setPrototypeOf(t,e);}return{setters:[function(_tslib){t=_tslib.__decorate;},function(_lit){i=_lit.html;},function(_litDecoratorsJs){s=_litDecoratorsJs.property;o=_litDecoratorsJs.query;e=_litDecoratorsJs.customElement;},function(_litDirectivesClassMapJs){h=_litDirectivesClassMapJs.classMap;},function(_nileTooltipCssCjsJs){l=_nileTooltipCssCjsJs.s;},function(_internalNileElementCjsJs){r=_internalNileElementCjsJs.N;},function(_nileTooltipUtilsCjsJs){n=_nileTooltipUtilsCjsJs.i;c=_nileTooltipUtilsCjsJs.g;a=_nileTooltipUtilsCjsJs.a;}],execute:function execute(){_export("N",d=/*#__PURE__*/function(_r){function d(){var _this;_classCallCheck(this,d);_this=_callSuper(this,d,arguments),_this.content="",_this.size="small",_this.placement="bottom",_this.disabled=!1,_this.open=!1,_this.trigger="hover focus",_this.distance=8,_this.SHIFT_OFFSET=16,_this.skidding=0,_this.hoist=!1,_this.hasTooltipSlot=!1,_this.hoverTimeout=0,_this.caretSize=6,_this.originalPlacement=_this.placement,_this.updateTooltipPosition=function(){if(!n(_this.triggerContainer))return void(_this.open=!1);var t=_this.triggerContainer.getBoundingClientRect(),i=_this.tooltip.getBoundingClientRect(),s=window.innerWidth,o=window.innerHeight,_c=c(t,i,_this.originalPlacement,_this.distance,_this.skidding,_this.caretSize,s,o),e=_c.top,h=_c.left,l=_c.placement;_this.setAttribute("placement",l),_this.tooltip.style.top="".concat(e,"px"),_this.tooltip.style.left="".concat(h,"px");var _a=a({placement:l,tooltipRect:i,triggerRect:t,caretSize:_this.caretSize,left:h,top:e}),r=_a.caretLeft,_d=_a.caretTop;_this.caret.style.left="".concat(r,"px"),_this.caret.style.top="".concat(_d,"px");},_this.showTooltip=function(){(_this.content.trim()||_this.hasTooltipSlot)&&(!_this.disabled&&n(_this.triggerContainer)?(_this.emit("nile-show"),_this.open=!0,_this.updateComplete.then(function(){_this.updateTooltipPosition(),_this.emit("nile-after-show");})):_this.open=!1);},_this.hideTooltip=function(){_this.emit("nile-hide"),_this.open=!1,setTimeout(function(){_this.emit("nile-after-hide");},200);},_this.handleMouseOver=function(){_this.trigger.includes("hover")&&(clearTimeout(_this.hoverTimeout),_this.hoverTimeout=window.setTimeout(function(){return _this.showTooltip();},150));},_this.handleMouseOut=function(){_this.trigger.includes("hover")&&(clearTimeout(_this.hoverTimeout),_this.hoverTimeout=window.setTimeout(function(){return _this.hideTooltip();},0));},_this.handleClick=function(){_this.trigger.includes("click")&&(!_this.open&&n(_this.triggerContainer)?_this.showTooltip():_this.hideTooltip());},_this.handleFocus=function(){_this.trigger.includes("focus")&&_this.showTooltip();},_this.handleBlur=function(){_this.trigger.includes("focus")&&_this.hideTooltip();};return _this;}_inherits(d,_r);return _createClass(d,[{key:"connectedCallback",value:function connectedCallback(){_superPropGet(d,"connectedCallback",this,3)([]),this.originalPlacement=this.placement,window.addEventListener("resize",this.updateTooltipPosition),window.addEventListener("scroll",this.updateTooltipPosition,!0);}},{key:"updated",value:function updated(t){var _superPropGet2;(_superPropGet2=_superPropGet(d,"updated",this,3))===null||_superPropGet2===void 0||_superPropGet2([t]);var i=["top","top-start","top-end","right","right-start","right-end","bottom","bottom-start","bottom-end","left","left-start","left-end"];i.includes(this.placement)||(console.warn("[nile-tooltip] Invalid placement \"".concat(this.placement,"\", defaulting to \"bottom\".")),this.placement="bottom"),i.includes(this.originalPlacement)||(this.originalPlacement="bottom");}},{key:"disconnectedCallback",value:function disconnectedCallback(){_superPropGet(d,"disconnectedCallback",this,3)([]),window.removeEventListener("resize",this.updateTooltipPosition),window.removeEventListener("scroll",this.updateTooltipPosition,!0);}},{key:"handleTooltipSlotChange",value:function handleTooltipSlotChange(){var t=this.tooltipSlot.assignedNodes({flatten:!0});this.hasTooltipSlot=t.length>0,this.requestUpdate();}},{key:"render",value:function render(){return i(_templateObject||(_templateObject=_taggedTemplateLiteral(["\n <div\n class=","\n id=\"tooltip\"\n >\n <div class=\"tooltip-content\" part=\"content\">\n <slot name=\"content\" @slotchange=","></slot>\n ","\n </div>\n <div class=\"tooltip-caret\" style=\"--caret-size: ","px;\"></div>\n </div>\n\n <div\n class=\"trigger-container\"\n tabindex=\"0\"\n @mouseover=","\n @mouseout=","\n @click=","\n @focusin=","\n @focusout=","\n aria-describedby=\"tooltip\"\n >\n <slot></slot>\n </div>\n "])),h({tooltip:!0,"tooltip__body--large":"large"===this.size}),this.handleTooltipSlotChange,this.hasTooltipSlot?null:i(_templateObject2||(_templateObject2=_taggedTemplateLiteral(["",""])),this.content),this.caretSize,this.handleMouseOver,this.handleMouseOut,this.handleClick,this.handleFocus,this.handleBlur);}}],[{key:"styles",get:function get(){return[l];}}]);}(r));t([s({type:String})],d.prototype,"content",void 0),t([s({reflect:!0})],d.prototype,"size",void 0),t([s({type:String})],d.prototype,"placement",void 0),t([s({type:Boolean,reflect:!0})],d.prototype,"disabled",void 0),t([s({type:Boolean,reflect:!0})],d.prototype,"open",void 0),t([s()],d.prototype,"trigger",void 0),t([s({type:Number})],d.prototype,"distance",void 0),t([s({type:Number})],d.prototype,"skidding",void 0),t([s({type:Boolean,reflect:!0})],d.prototype,"hoist",void 0),t([o(".tooltip")],d.prototype,"tooltip",void 0),t([o(".trigger-container")],d.prototype,"triggerContainer",void 0),t([o(".tooltip-caret")],d.prototype,"caret",void 0),t([o('slot[name="content"]')],d.prototype,"tooltipSlot",void 0),_export("N",d=t([e("nile-tooltip")],d));}};});
2
2
  //# sourceMappingURL=nile-tooltip.cjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"nile-tooltip.cjs.js","sources":["../../../src/nile-tooltip/nile-tooltip.ts"],"sourcesContent":["import { LitElement, html, css, CSSResultArray } from 'lit';\nimport { customElement, property, query } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { styles } from './nile-tooltip.css';\nimport NileElement from '../internal/nile-element';\n\ntype TooltipPlacement = \n | 'top' | 'top-start' | 'top-end' \n | 'right' | 'right-start' | 'right-end' \n | 'bottom' | 'bottom-start' | 'bottom-end' \n | 'left' | 'left-start' | 'left-end';\n\n// CSS Anchor positiong\n@customElement('nile-tooltip')\nexport class NileTooltip extends NileElement {\n @property({ type: String }) content = '';\n @property({ reflect: true }) size: 'small' | 'large' = 'small';\n @property({ type: String }) placement: TooltipPlacement = 'top';\n @property({ type: Boolean, reflect: true }) disabled = false;\n @property({ type: Boolean, reflect: true }) open = false;\n @property() trigger = 'hover focus';\n @property({ type: Number }) distance = 8;\n @property({ type: Number }) skidding = 0;\n @property({ type: Boolean }) hoist = false;\n\n @query('.tooltip') tooltip!: HTMLElement;\n @query('slot') slotElement!: HTMLSlotElement;\n\n private hoverTimeout: number;\n\n public static get styles(): CSSResultArray {\n return [styles];\n }\n \n\n \n \n connectedCallback() {\n super.connectedCallback();\n window.addEventListener('resize', this.updateTooltipPosition);\n window.addEventListener('scroll', this.updateTooltipPosition, true);\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n window.removeEventListener('resize', this.updateTooltipPosition);\n window.removeEventListener('scroll', this.updateTooltipPosition, true);\n }\n\n private getBasePlacement(placement: TooltipPlacement): 'top' | 'right' | 'bottom' | 'left' {\n return placement.split('-')[0] as 'top' | 'right' | 'bottom' | 'left';\n }\n\n private getAlignmentModifier(placement: TooltipPlacement): 'start' | 'end' | null {\n const parts = placement.split('-');\n return parts.length > 1 ? parts[1] as 'start' | 'end' : null;\n }\n\n private updateTooltipPosition = () => {\n if (!this.tooltip || !this.open) return;\n\n const triggerEl = this.slotElement.assignedElements()[0] as HTMLElement;\n if (!triggerEl) return;\n\n \n \n const triggerRect = triggerEl.getBoundingClientRect();\n const tooltipRect = this.tooltip.getBoundingClientRect();\n const viewportWidth = window.innerWidth;\n const viewportHeight = window.innerHeight;\n \n let top = 0, left = 0;\n let finalPlacement = this.placement;\n const basePlacement = this.getBasePlacement(this.placement);\n const alignment = this.getAlignmentModifier(this.placement);\n\n \n const fitsLeft = triggerRect.left - tooltipRect.width - this.distance > 0;\n const fitsRight = triggerRect.right + tooltipRect.width + this.distance < viewportWidth;\n const fitsBottom = triggerRect.bottom + tooltipRect.height + this.distance < viewportHeight;\n const fitsTop = triggerRect.top - tooltipRect.height - this.distance > 0;\n\n \n let finalBasePlacement = basePlacement;\n \n \n if ((basePlacement === 'left' && !fitsLeft) || (basePlacement === 'right' && !fitsRight)) {\n finalBasePlacement = fitsBottom ? 'bottom' : (fitsTop ? 'top' : 'bottom');\n } \n \n else if (basePlacement === 'top' && !fitsTop) {\n finalBasePlacement = fitsBottom ? 'bottom' : (fitsLeft ? 'left' : 'right');\n } else if (basePlacement === 'bottom' && !fitsBottom) {\n finalBasePlacement = fitsTop ? 'top' : (fitsLeft ? 'left' : 'right');\n }\n\n \n let finalAlignment = alignment;\n \n \n if ((basePlacement === 'left' || basePlacement === 'right') && \n (finalBasePlacement === 'top' || finalBasePlacement === 'bottom')) {\n \n if (alignment === 'start') {\n finalAlignment = 'start';\n } else if (alignment === 'end') {\n finalAlignment = 'end';\n }\n }\n\n \n switch (finalBasePlacement) {\n case 'left':\n top = triggerRect.top + (triggerRect.height - tooltipRect.height) / 2 + this.skidding;\n left = triggerRect.left - tooltipRect.width - this.distance;\n break;\n case 'right':\n top = triggerRect.top + (triggerRect.height - tooltipRect.height) / 2 + this.skidding;\n left = triggerRect.right + this.distance;\n break;\n case 'top':\n top = triggerRect.top - tooltipRect.height - this.distance;\n left = triggerRect.left + (triggerRect.width - tooltipRect.width) / 2 + this.skidding;\n break;\n case 'bottom':\n top = triggerRect.bottom + this.distance;\n left = triggerRect.left + (triggerRect.width - tooltipRect.width) / 2 + this.skidding;\n break;\n }\n\n \n if ((finalBasePlacement === 'top' || finalBasePlacement === 'bottom') && finalAlignment) {\n if (finalAlignment === 'start') {\n left = triggerRect.left + this.skidding;\n } else if (finalAlignment === 'end') {\n left = triggerRect.right - tooltipRect.width + this.skidding;\n }\n }\n \n \n if ((finalBasePlacement === 'left' || finalBasePlacement === 'right') && finalAlignment) {\n if (finalAlignment === 'start') {\n top = triggerRect.top + this.skidding;\n } else if (finalAlignment === 'end') {\n top = triggerRect.bottom - tooltipRect.height + this.skidding;\n }\n }\n\n \n finalPlacement = finalAlignment ? `${finalBasePlacement}-${finalAlignment}` : finalBasePlacement;\n\n \n if (left < 0) left = 5;\n if (left + tooltipRect.width > viewportWidth) left = viewportWidth - tooltipRect.width - 5;\n if (top < 0) top = 5;\n if (top + tooltipRect.height > viewportHeight) top = viewportHeight - tooltipRect.height - 5;\n\n \n this.tooltip.style.top = `${top}px`;\n this.tooltip.style.left = `${left}px`;\n this.tooltip.setAttribute('data-placement', finalPlacement as string);\n };\n\n private showTooltip = () => {\n if (!this.disabled && \n this.content.trim() !== '') {\n this.open = true;\n this.emit('nile-show');\n this.updateComplete.then(() => {\n this.updateTooltipPosition();\n \n \n this.tooltip.addEventListener('transitionend', this.handleAfterShow, { once: true });\n });\n }\n };\n \n private handleAfterShow = () => {\n this.emit('nile-after-show');\n };\n \n\n private hideTooltip = () => {\n if (!this.open) return;\n \n this.emit('nile-hide');\n this.open = false;\n \n this.tooltip.addEventListener('transitionend', this.handleAfterHide, { once: true });\n };\n \n private handleAfterHide = () => {\n this.emit('nile-after-hide');\n };\n \n private handleMouseOver = () => {\n if (this.trigger.includes('hover')) {\n clearTimeout(this.hoverTimeout);\n this.hoverTimeout = window.setTimeout(() => this.showTooltip(), 150);\n }\n };\n\n private handleMouseOut = () => {\n if (this.trigger.includes('hover')) {\n clearTimeout(this.hoverTimeout);\n this.hoverTimeout = window.setTimeout(() => this.hideTooltip(), 0);\n }\n };\n\n private handleClick = () => {\n if (this.trigger.includes('click')) {\n this.open = !this.open;\n this.emit('nile-show');\n this.updateComplete.then(() => this.updateTooltipPosition());\n }\n };\n\n updated(changedProperties: Map<string, any>) {\n super.updated(changedProperties);\n \n \n if (changedProperties.has('open') || changedProperties.has('hoist')) {\n if (this.open && this.hoist) {\n \n }\n }\n }\n\n private handleFocus = () => {\n if (this.trigger.includes('focus')) {\n this.showTooltip();\n }\n };\n\n private handleBlur = () => {\n if (this.trigger.includes('focus')) {\n this.hideTooltip();\n }\n };\n\n render() {\n return html`\n <div class=${classMap({ tooltip: true, 'tooltip__body--large': this.size === 'large' })}>\n ${this.content}\n </div>\n <slot\n @mouseover=${this.handleMouseOver}\n @mouseout=${this.handleMouseOut}\n @click=${this.handleClick}\n @focus=${this.handleFocus}\n @blur=${this.handleBlur}\n aria-describedby=\"tooltip\"\n ></slot>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nile-tooltip': NileTooltip;\n }\n}"],"names":["NileTooltip","_l","n","this","content","size","placement","disabled","open","trigger","distance","skidding","hoist","updateTooltipPosition","tooltip","triggerEl","slotElement","assignedElements","triggerRect","getBoundingClientRect","tooltipRect","viewportWidth","window","innerWidth","viewportHeight","innerHeight","top","left","finalPlacement","basePlacement","getBasePlacement","alignment","getAlignmentModifier","fitsLeft","width","fitsRight","right","fitsBottom","bottom","height","fitsTop","finalBasePlacement","finalAlignment","style","concat","setAttribute","showTooltip","trim","emit","updateComplete","then","addEventListener","handleAfterShow","once","hideTooltip","handleAfterHide","handleMouseOver","includes","clearTimeout","hoverTimeout","setTimeout","handleMouseOut","handleClick","handleFocus","handleBlur","_this","_inherits","_createClass","key","value","connectedCallback","super","disconnectedCallback","removeEventListener","split","parts","length","updated","changedProperties","has","render","html","_templateObject","_taggedTemplateLiteral","classMap","__decorate","get","styles","NileElement","property","type","String","prototype","reflect","Boolean","Number","query","customElement"],"mappings":"+wHAcaA,CAAN,uBAAAC,EAAA,EAAA,SAAAC,EAAA,qEACuBC,EAAAA,KAAAA,CAAOC,QAAG,EACTD,CAAAA,KAAAA,CAAIE,IAAsB,CAAA,OAAA,CAC3BF,KAAAA,CAASG,SAAAA,CAAqB,KACdH,CAAAA,KAAAA,CAAQI,UAAG,CACXJ,CAAAA,KAAAA,CAAIK,IAAG,CAAA,CAAA,CAA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CAAAA,CAAAA,CAAA4F,SAAA,CAAA,OAAA,CAAA,IAAA,EAExBP,CAAAA,CAAAA,CAAAA,CAAA,CAAlBW,CAAM,CAAA,UAAA,CAAA,CAAA,CAAkChG,CAAA4F,CAAAA,SAAAA,CAAA,SAAA,CAAA,IAAA,EAAA,CAAA,CAC1BP,EAAA,CAAdW,CAAAA,CAAM,MAAsChG,CAAAA,CAAAA,CAAAA,CAAAA,CAAA4F,SAAA,CAAA,aAAA,CAAA,IAAA,EAZlC5F,CAAAA,CAAAA,OAAAA,KAAAA,CAAAA,CAAWqF,CAAA,CAAA,CADvBY,CAAc,CAAA,cAAA,CAAA,CAAA,CACFjG"}
1
+ {"version":3,"file":"nile-tooltip.cjs.js","sources":["../../../src/nile-tooltip/nile-tooltip.ts"],"sourcesContent":["/**\n * Copyright Aquera Inc 2023\n *\n * This source code is licensed under the BSD-3-Clause license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { LitElement, html, css, CSSResultArray } from 'lit';\nimport { customElement, property, query } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { styles } from './nile-tooltip.css';\nimport NileElement from '../internal/nile-element';\nimport { isInViewport, getValidTooltipPosition, getCaretPosition } from './nile-tooltip-utils';\n/**\n * Nile icon component.\n *\n * @tag nile-tooltip\n *\n */\n\n@customElement('nile-tooltip')\nexport class NileTooltip extends NileElement {\n @property({ type: String }) content = '';\n @property({ reflect: true }) size: 'small' | 'large' = 'small';\n @property({ type: String })\n placement:\n | 'top'\n | 'top-start'\n | 'top-end'\n | 'right'\n | 'right-start'\n | 'right-end'\n | 'bottom'\n | 'bottom-start'\n | 'bottom-end'\n | 'left'\n | 'left-start'\n | 'left-end' = 'bottom';\n @property({ type: Boolean, reflect: true }) disabled = false;\n @property({ type: Boolean, reflect: true }) open = false;\n /**\n * Controls how the tooltip is activated. Possible options include `click`, `hover`, `focus`, and `manual`. Multiple\n * options can be passed by separating them with a space. When manual is used, the tooltip must be activated\n * programmatically.\n */\n @property() trigger = 'hover focus'; \n @property({ type: Number }) distance = 8;\n private readonly SHIFT_OFFSET = 16;\n/** The distance in pixels from which to offset the tooltip along its target. */\n @property({ type: Number }) skidding = 0;\n @property({ type: Boolean, reflect: true }) hoist = false;\n\n @query('.tooltip') tooltip!: HTMLElement;\n @query('.trigger-container') triggerContainer!: HTMLElement;\n @query('.tooltip-caret') caret!: HTMLElement;\n @query('slot[name=\"content\"]') tooltipSlot!: HTMLSlotElement;\n\n private hasTooltipSlot = false;\n private hoverTimeout: number = 0;\n private caretSize = 6;\n private originalPlacement: string = this.placement;\n\n public static get styles(): CSSResultArray {\n return [styles];\n }\n\n connectedCallback() {\n super.connectedCallback();\n this.originalPlacement = this.placement;\n window.addEventListener('resize', this.updateTooltipPosition);\n window.addEventListener('scroll', this.updateTooltipPosition, true);\n }\n\n updated(changedProps: Map<string, unknown>) {\n super.updated?.(changedProps);\n\n const validPlacements = [\n 'top', 'top-start', 'top-end',\n 'right', 'right-start', 'right-end',\n 'bottom', 'bottom-start', 'bottom-end',\n 'left', 'left-start', 'left-end'\n ];\n\n if (!validPlacements.includes(this.placement)) {\n console.warn(`[nile-tooltip] Invalid placement \"${this.placement}\", defaulting to \"bottom\".`);\n this.placement = 'bottom';\n }\n\n if (!validPlacements.includes(this.originalPlacement)) {\n this.originalPlacement = 'bottom';\n }\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n window.removeEventListener('resize', this.updateTooltipPosition);\n window.removeEventListener('scroll', this.updateTooltipPosition, true);\n }\n\n private handleTooltipSlotChange() {\n const nodes = this.tooltipSlot.assignedNodes({ flatten: true });\n this.hasTooltipSlot = nodes.length > 0;\n this.requestUpdate();\n }\n\n private updateTooltipPosition = () => {\n if (!isInViewport(this.triggerContainer)) {\n this.open = false;\n return;\n }\n\n const triggerRect = this.triggerContainer.getBoundingClientRect();\n const tooltipRect = this.tooltip.getBoundingClientRect();\n const viewportWidth = window.innerWidth;\n const viewportHeight = window.innerHeight;\n\n const { top, left, placement } = getValidTooltipPosition(\n triggerRect,\n tooltipRect,\n this.originalPlacement,\n this.distance,\n this.skidding,\n this.caretSize,\n viewportWidth,\n viewportHeight\n );\n\n this.setAttribute('placement', placement);\n this.tooltip.style.top = `${top}px`;\n this.tooltip.style.left = `${left}px`;\n\n const { caretLeft, caretTop } = getCaretPosition({\n placement,\n tooltipRect,\n triggerRect,\n caretSize: this.caretSize,\n left,\n top\n });\n\n this.caret.style.left = `${caretLeft}px`;\n this.caret.style.top = `${caretTop}px`;\n };\n\n private showTooltip = () => {\n const trimmedContent = this.content.trim();\n if (!trimmedContent && !this.hasTooltipSlot) {\n return;\n }\n if (!this.disabled && isInViewport(this.triggerContainer)) {\n this.emit('nile-show');\n this.open = true;\n this.updateComplete.then(() => {\n this.updateTooltipPosition();\n this.emit('nile-after-show');\n });\n } else {\n this.open = false;\n }\n };\n\n private hideTooltip = () => {\n this.emit('nile-hide');\n this.open = false;\n setTimeout(() => {\n this.emit('nile-after-hide');\n }, 200);\n };\n\n private handleMouseOver = () => {\n if (this.trigger.includes('hover')) {\n clearTimeout(this.hoverTimeout);\n this.hoverTimeout = window.setTimeout(() => this.showTooltip(), 150);\n }\n };\n\n private handleMouseOut = () => {\n if (this.trigger.includes('hover')) {\n clearTimeout(this.hoverTimeout);\n this.hoverTimeout = window.setTimeout(() => this.hideTooltip(), 0);\n }\n };\n\n private handleClick = () => {\n if (this.trigger.includes('click')) {\n if (!this.open && isInViewport(this.triggerContainer)) {\n this.showTooltip();\n } else {\n this.hideTooltip();\n }\n }\n };\n\n private handleFocus = () => {\n if (this.trigger.includes('focus')) {\n this.showTooltip();\n }\n };\n\n private handleBlur = () => {\n if (this.trigger.includes('focus')) {\n this.hideTooltip();\n }\n };\n\n render() {\n return html`\n <div\n class=${classMap({\n tooltip: true,\n 'tooltip__body--large': this.size === 'large',\n })}\n id=\"tooltip\"\n >\n <div class=\"tooltip-content\" part=\"content\">\n <slot name=\"content\" @slotchange=${this.handleTooltipSlotChange}></slot>\n ${!this.hasTooltipSlot ? html`${this.content}` : null}\n </div>\n <div class=\"tooltip-caret\" style=\"--caret-size: ${this.caretSize}px;\"></div>\n </div>\n\n <div\n class=\"trigger-container\"\n tabindex=\"0\"\n @mouseover=${this.handleMouseOver}\n @mouseout=${this.handleMouseOut}\n @click=${this.handleClick}\n @focusin=${this.handleFocus}\n @focusout=${this.handleBlur}\n aria-describedby=\"tooltip\"\n >\n <slot></slot>\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nile-tooltip': NileTooltip;\n }\n}\n\n"],"names":["NileTooltip","d","this","content","size","placement","disabled","open","trigger","distance","SHIFT_OFFSET","skidding","hoist","hasTooltipSlot","hoverTimeout","caretSize","originalPlacement","updateTooltipPosition","isInViewport","triggerContainer","triggerRect","getBoundingClientRect","tooltipRect","tooltip","viewportWidth","window","innerWidth","viewportHeight","innerHeight","top","getValidTooltipPosition","left","setAttribute","style","concat","_a","getCaretPosition","caretLeft","caretTop","caret","showTooltip","trim","emit","updateComplete","then","hideTooltip","setTimeout","handleMouseOver","includes","clearTimeout","handleMouseOut","handleClick","handleFocus","handleBlur","_this","_inherits","_r","_createClass","key","value","connectedCallback","super","addEventListener","updated","changedProps","validPlacements","console","warn","disconnectedCallback","removeEventListener","handleTooltipSlotChange","nodes","tooltipSlot","assignedNodes","flatten","length","requestUpdate","render","html","_templateObject","_taggedTemplateLiteral","classMap","_templateObject2","get","styles","NileElement","__decorate","property","type","String","prototype","reflect","Boolean","Number","query","_export","customElement"],"mappings":"w7HAoBaA,CAAAA,uBAAAA,EAAAA,EAAN,SAAAC,EAAA,uEACuBC,KAAAA,CAAOC,OAAG,CAAA,EAAA,CACTD,KAAAA,CAAIE,IAAsB,CAAA,OAAA,CAEvDF,KAAAA,CAASG,SAYQ,CAAA,QAAA,CAC2BH,KAAAA,CAAQI,QAAG,CAAA,CAAA,CAAA,CACXJ,KAAAA,CAAIK,IAAG,CAAA,CAAA,CAAA,CAMvCL,KAAAA,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AA,CAAA,kBAAA,CAAA,IAAA,EACnCJ,CAAAA,CAAAA,CAAAA,CAAA,CAAxBQ,CAAAA,CAAM,mBAAsC9F,CAAA0F,CAAAA,SAAAA,CAAA,OAAA,CAAA,IAAA,EAAA,CAAA,CACdJ,CAAA,CAAA,CAA9BQ,CAAM,CAAA,sBAAA,CAAA,CAAA,CAAsD9F,CAAA0F,CAAAA,SAAAA,CAAA,aAAA,CAAA,IAAA,EAAA,CAAA,CAAAK,OAAA,KAlClD/F,CAAWsF,CAAAA,CAAAA,CAAA,CADvBU,CAAAA,CAAc,iBACFhG"}
@@ -1,2 +1,2 @@
1
- System.register(["lit"],function(_export,_context){"use strict";var t,_templateObject,o;function _taggedTemplateLiteral(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}));}return{setters:[function(_lit){t=_lit.css;}],execute:function execute(){_export("s",o=t(_templateObject||(_templateObject=_taggedTemplateLiteral(["\n\n\n:host {\n position: relative;\n display: inline-block;\n }\n\n .tooltip {\n position: fixed;\n z-index: 1000;\n background-color: var(--nile-tooltip-color-background, #333);\n color: var(--nile-colors-white-base, #fff);\n padding: 6px 10px;\n border-radius: 4px;\n font-size: var(--nile-tooltip-font-size-sm, 14px);\n line-height: var(--nile-tooltip-line-height-sm, 1.5);\n opacity: 0;\n transition: opacity 0.2s, transform 0.2s;\n pointer-events: none;\n white-space: nowrap;\n visibility: hidden;\n transform: scale(0.95);\n transition: opacity 0.2s ease-out, transform 0.2s ease-out;\n }\n\n .tooltip[open] {\n opacity: 1;\n transform: scale(1);\n}\n\n :host([open]) .tooltip {\n opacity: 1;\n visibility: visible;\n pointer-events: auto;\n }\n\n .tooltip__body--large {\n font-size: var(--nile-type-scale-4, 16px);\n line-height: var(--nile-tooltip-line-height-lg, 1.75);\n }\n\n /* Tooltip Arrow */\n .tooltip::after {\n content: '';\n position: absolute;\n width: 0;\n height: 0;\n border-style: solid;\n }\n\n /* Basic Arrow Positions */\n .tooltip[data-placement^=\"top\"]::after {\n bottom: -6px;\n border-width: 6px 6px 0 6px;\n border-color: var(--nile-tooltip-color-background, #333) transparent transparent transparent;\n }\n\n .tooltip[data-placement^=\"bottom\"]::after {\n top: -6px;\n border-width: 0 6px 6px 6px;\n border-color: transparent transparent var(--nile-tooltip-color-background, #333) transparent;\n }\n\n .tooltip[data-placement^=\"left\"]::after {\n right: -6px;\n border-width: 6px 0 6px 6px;\n border-color: transparent transparent transparent var(--nile-tooltip-color-background, #333);\n }\n\n .tooltip[data-placement^=\"right\"]::after {\n left: -6px;\n border-width: 6px 6px 6px 0;\n border-color: transparent var(--nile-tooltip-color-background, #333) transparent transparent;\n }\n\n /* Arrow Horizontal Alignment for top/bottom placements */\n .tooltip[data-placement=\"top\"]::after,\n .tooltip[data-placement=\"bottom\"]::after {\n left: 50%;\n transform: translateX(-50%);\n }\n\n .tooltip[data-placement=\"top-start\"]::after,\n .tooltip[data-placement=\"bottom-start\"]::after {\n left: 12px;\n }\n\n .tooltip[data-placement=\"top-end\"]::after,\n .tooltip[data-placement=\"bottom-end\"]::after {\n right: 12px;\n left: auto;\n }\n\n /* Arrow Vertical Alignment for left/right placements */\n .tooltip[data-placement=\"left\"]::after,\n .tooltip[data-placement=\"right\"]::after {\n top: 50%;\n transform: translateY(-50%);\n }\n\n .tooltip[data-placement=\"left-start\"]::after,\n .tooltip[data-placement=\"right-start\"]::after {\n top: 12px;\n transform: none;\n }\n\n .tooltip[data-placement=\"left-end\"]::after,\n .tooltip[data-placement=\"right-end\"]::after {\n bottom: 12px;\n top: auto;\n transform: none;\n }\n \n"]))));}};});
1
+ System.register(["lit"],function(_export,_context){"use strict";var i,_templateObject,o;function _taggedTemplateLiteral(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}));}return{setters:[function(_lit){i=_lit.css;}],execute:function execute(){_export("s",o=i(_templateObject||(_templateObject=_taggedTemplateLiteral(["\n\n\n:host {\n position: relative;\n display: inline-block;\n }\n .tooltip {\n position: fixed;\n z-index: 1000;\n background-color: var(--nile-tooltip-color-background, #333);\n color: var(--nile-colors-white-base, #fff);\n padding: 6px 10px;\n border-radius: 4px;\n font-size: var(--nile-tooltip-font-size-sm, 14px);\n line-height: var(--nile-tooltip-line-height-sm, 1.5);\n opacity: 0;\n transition: opacity 0.2s, transform 0.2s;\n pointer-events: none;\n white-space: normal;\n visibility: hidden;\n overflow: visible;\n \n }\n :host([open]) .tooltip {\n opacity: 1;\n visibility: visible;\n pointer-events: auto;\n }\n .tooltip__body--large {\n font-size: var(--nile-tooltip-font-size-lg, 16px);\n line-height: var(--nile-tooltip-line-height-lg, 1.75);\n }\n .tooltip-content {\n overflow: auto;\n max-width: 252px;\n max-height: 116px;\n }\n .tooltip-caret {\n position: absolute;\n width: calc(2 * var(--caret-size, 6px));\n height: calc(2 * var(--caret-size, 6px));\n background-color: inherit;\n transform: rotate(45deg);\n z-index: -1;\n }\n .trigger-container {\n display: inline-block;\n }\n \n\n\n\n\n\n\n\n \n"]))));}};});
2
2
  //# sourceMappingURL=nile-tooltip.css.cjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"nile-tooltip.css.cjs.js","sources":["../../../src/nile-tooltip/nile-tooltip.css.ts"],"sourcesContent":["/**\n * Copyright Aquera Inc 2023\n *\n * This source code is licensed under the BSD-3-Clause license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { css } from 'lit';\n\n/**\n * Tooltip CSS\n */\nexport const styles = css`\n\n\n:host {\n position: relative;\n display: inline-block;\n }\n\n .tooltip {\n position: fixed;\n z-index: 1000;\n background-color: var(--nile-tooltip-color-background, #333);\n color: var(--nile-colors-white-base, #fff);\n padding: 6px 10px;\n border-radius: 4px;\n font-size: var(--nile-tooltip-font-size-sm, 14px);\n line-height: var(--nile-tooltip-line-height-sm, 1.5);\n opacity: 0;\n transition: opacity 0.2s, transform 0.2s;\n pointer-events: none;\n white-space: nowrap;\n visibility: hidden;\n transform: scale(0.95);\n transition: opacity 0.2s ease-out, transform 0.2s ease-out;\n }\n\n .tooltip[open] {\n opacity: 1;\n transform: scale(1);\n}\n\n :host([open]) .tooltip {\n opacity: 1;\n visibility: visible;\n pointer-events: auto;\n }\n\n .tooltip__body--large {\n font-size: var(--nile-type-scale-4, 16px);\n line-height: var(--nile-tooltip-line-height-lg, 1.75);\n }\n\n /* Tooltip Arrow */\n .tooltip::after {\n content: '';\n position: absolute;\n width: 0;\n height: 0;\n border-style: solid;\n }\n\n /* Basic Arrow Positions */\n .tooltip[data-placement^=\"top\"]::after {\n bottom: -6px;\n border-width: 6px 6px 0 6px;\n border-color: var(--nile-tooltip-color-background, #333) transparent transparent transparent;\n }\n\n .tooltip[data-placement^=\"bottom\"]::after {\n top: -6px;\n border-width: 0 6px 6px 6px;\n border-color: transparent transparent var(--nile-tooltip-color-background, #333) transparent;\n }\n\n .tooltip[data-placement^=\"left\"]::after {\n right: -6px;\n border-width: 6px 0 6px 6px;\n border-color: transparent transparent transparent var(--nile-tooltip-color-background, #333);\n }\n\n .tooltip[data-placement^=\"right\"]::after {\n left: -6px;\n border-width: 6px 6px 6px 0;\n border-color: transparent var(--nile-tooltip-color-background, #333) transparent transparent;\n }\n\n /* Arrow Horizontal Alignment for top/bottom placements */\n .tooltip[data-placement=\"top\"]::after,\n .tooltip[data-placement=\"bottom\"]::after {\n left: 50%;\n transform: translateX(-50%);\n }\n\n .tooltip[data-placement=\"top-start\"]::after,\n .tooltip[data-placement=\"bottom-start\"]::after {\n left: 12px;\n }\n\n .tooltip[data-placement=\"top-end\"]::after,\n .tooltip[data-placement=\"bottom-end\"]::after {\n right: 12px;\n left: auto;\n }\n\n /* Arrow Vertical Alignment for left/right placements */\n .tooltip[data-placement=\"left\"]::after,\n .tooltip[data-placement=\"right\"]::after {\n top: 50%;\n transform: translateY(-50%);\n }\n\n .tooltip[data-placement=\"left-start\"]::after,\n .tooltip[data-placement=\"right-start\"]::after {\n top: 12px;\n transform: none;\n }\n\n .tooltip[data-placement=\"left-end\"]::after,\n .tooltip[data-placement=\"right-end\"]::after {\n bottom: 12px;\n top: auto;\n transform: none;\n }\n \n`;\n\nexport default [styles];\n"],"names":["styles","css","_templateObject","_taggedTemplateLiteral"],"mappings":"oTAYaA,CAAAA,CAASC,CAAG,CAAAC,eAAA,GAAAA,eAAA,CAAAC,sBAAA"}
1
+ {"version":3,"file":"nile-tooltip.css.cjs.js","sources":["../../../src/nile-tooltip/nile-tooltip.css.ts"],"sourcesContent":["/**\n * Copyright Aquera Inc 2023\n *\n * This source code is licensed under the BSD-3-Clause license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { css } from 'lit';\n\n/**\n * Tooltip CSS\n */\nexport const styles = css`\n\n\n:host {\n position: relative;\n display: inline-block;\n }\n .tooltip {\n position: fixed;\n z-index: 1000;\n background-color: var(--nile-tooltip-color-background, #333);\n color: var(--nile-colors-white-base, #fff);\n padding: 6px 10px;\n border-radius: 4px;\n font-size: var(--nile-tooltip-font-size-sm, 14px);\n line-height: var(--nile-tooltip-line-height-sm, 1.5);\n opacity: 0;\n transition: opacity 0.2s, transform 0.2s;\n pointer-events: none;\n white-space: normal;\n visibility: hidden;\n overflow: visible;\n \n }\n :host([open]) .tooltip {\n opacity: 1;\n visibility: visible;\n pointer-events: auto;\n }\n .tooltip__body--large {\n font-size: var(--nile-tooltip-font-size-lg, 16px);\n line-height: var(--nile-tooltip-line-height-lg, 1.75);\n }\n .tooltip-content {\n overflow: auto;\n max-width: 252px;\n max-height: 116px;\n }\n .tooltip-caret {\n position: absolute;\n width: calc(2 * var(--caret-size, 6px));\n height: calc(2 * var(--caret-size, 6px));\n background-color: inherit;\n transform: rotate(45deg);\n z-index: -1;\n }\n .trigger-container {\n display: inline-block;\n }\n \n\n\n\n\n\n\n\n \n`;\n\nexport default [styles];"],"names":["styles","css","_templateObject","_taggedTemplateLiteral"],"mappings":"oTAYaA,CAAAA,CAASC,CAAG,CAAAC,eAAA,GAAAA,eAAA,CAAAC,sBAAA"}
@@ -1,11 +1,10 @@
1
- import{css as t}from"lit";const o=t`
1
+ import{css as i}from"lit";const o=i`
2
2
 
3
3
 
4
4
  :host {
5
5
  position: relative;
6
6
  display: inline-block;
7
7
  }
8
-
9
8
  .tooltip {
10
9
  position: fixed;
11
10
  z-index: 1000;
@@ -18,98 +17,43 @@ import{css as t}from"lit";const o=t`
18
17
  opacity: 0;
19
18
  transition: opacity 0.2s, transform 0.2s;
20
19
  pointer-events: none;
21
- white-space: nowrap;
20
+ white-space: normal;
22
21
  visibility: hidden;
23
- transform: scale(0.95);
24
- transition: opacity 0.2s ease-out, transform 0.2s ease-out;
22
+ overflow: visible;
23
+
25
24
  }
26
-
27
- .tooltip[open] {
28
- opacity: 1;
29
- transform: scale(1);
30
- }
31
-
32
25
  :host([open]) .tooltip {
33
26
  opacity: 1;
34
27
  visibility: visible;
35
28
  pointer-events: auto;
36
29
  }
37
-
38
30
  .tooltip__body--large {
39
- font-size: var(--nile-type-scale-4, 16px);
31
+ font-size: var(--nile-tooltip-font-size-lg, 16px);
40
32
  line-height: var(--nile-tooltip-line-height-lg, 1.75);
41
33
  }
42
-
43
- /* Tooltip Arrow */
44
- .tooltip::after {
45
- content: '';
46
- position: absolute;
47
- width: 0;
48
- height: 0;
49
- border-style: solid;
50
- }
51
-
52
- /* Basic Arrow Positions */
53
- .tooltip[data-placement^="top"]::after {
54
- bottom: -6px;
55
- border-width: 6px 6px 0 6px;
56
- border-color: var(--nile-tooltip-color-background, #333) transparent transparent transparent;
34
+ .tooltip-content {
35
+ overflow: auto;
36
+ max-width: 252px;
37
+ max-height: 116px;
57
38
  }
58
-
59
- .tooltip[data-placement^="bottom"]::after {
60
- top: -6px;
61
- border-width: 0 6px 6px 6px;
62
- border-color: transparent transparent var(--nile-tooltip-color-background, #333) transparent;
39
+ .tooltip-caret {
40
+ position: absolute;
41
+ width: calc(2 * var(--caret-size, 6px));
42
+ height: calc(2 * var(--caret-size, 6px));
43
+ background-color: inherit;
44
+ transform: rotate(45deg);
45
+ z-index: -1;
63
46
  }
64
-
65
- .tooltip[data-placement^="left"]::after {
66
- right: -6px;
67
- border-width: 6px 0 6px 6px;
68
- border-color: transparent transparent transparent var(--nile-tooltip-color-background, #333);
47
+ .trigger-container {
48
+ display: inline-block;
69
49
  }
50
+
70
51
 
71
- .tooltip[data-placement^="right"]::after {
72
- left: -6px;
73
- border-width: 6px 6px 6px 0;
74
- border-color: transparent var(--nile-tooltip-color-background, #333) transparent transparent;
75
- }
76
52
 
77
- /* Arrow Horizontal Alignment for top/bottom placements */
78
- .tooltip[data-placement="top"]::after,
79
- .tooltip[data-placement="bottom"]::after {
80
- left: 50%;
81
- transform: translateX(-50%);
82
- }
83
53
 
84
- .tooltip[data-placement="top-start"]::after,
85
- .tooltip[data-placement="bottom-start"]::after {
86
- left: 12px;
87
- }
88
54
 
89
- .tooltip[data-placement="top-end"]::after,
90
- .tooltip[data-placement="bottom-end"]::after {
91
- right: 12px;
92
- left: auto;
93
- }
94
55
 
95
- /* Arrow Vertical Alignment for left/right placements */
96
- .tooltip[data-placement="left"]::after,
97
- .tooltip[data-placement="right"]::after {
98
- top: 50%;
99
- transform: translateY(-50%);
100
- }
101
56
 
102
- .tooltip[data-placement="left-start"]::after,
103
- .tooltip[data-placement="right-start"]::after {
104
- top: 12px;
105
- transform: none;
106
- }
107
57
 
108
- .tooltip[data-placement="left-end"]::after,
109
- .tooltip[data-placement="right-end"]::after {
110
- bottom: 12px;
111
- top: auto;
112
- transform: none;
113
- }
114
-
58
+
115
59
  `;export{o as s};
@@ -1,13 +1,25 @@
1
- import{__decorate as t}from"tslib";import{html as i}from"lit";import{property as s,query as e,customElement as o}from"lit/decorators.js";import{classMap as h}from"lit/directives/class-map.js";import{s as r}from"./nile-tooltip.css.esm.js";import{N as l}from"../internal/nile-element.esm.js";let n=class extends l{constructor(){super(...arguments),this.content="",this.size="small",this.placement="top",this.disabled=!1,this.open=!1,this.trigger="hover focus",this.distance=8,this.skidding=0,this.hoist=!1,this.updateTooltipPosition=()=>{if(!this.tooltip||!this.open)return;const t=this.slotElement.assignedElements()[0];if(!t)return;const i=t.getBoundingClientRect(),s=this.tooltip.getBoundingClientRect(),e=window.innerWidth,o=window.innerHeight;let h=0,r=0,l=this.placement;const n=this.getBasePlacement(this.placement),a=this.getAlignmentModifier(this.placement),d=i.left-s.width-this.distance>0,c=i.right+s.width+this.distance<e,p=i.bottom+s.height+this.distance<o,m=i.top-s.height-this.distance>0;let u=n;"left"===n&&!d||"right"===n&&!c?u=p?"bottom":m?"top":"bottom":"top"!==n||m?"bottom"!==n||p||(u=m?"top":d?"left":"right"):u=p?"bottom":d?"left":"right";let f=a;switch("left"!==n&&"right"!==n||"top"!==u&&"bottom"!==u||("start"===a?f="start":"end"===a&&(f="end")),u){case"left":h=i.top+(i.height-s.height)/2+this.skidding,r=i.left-s.width-this.distance;break;case"right":h=i.top+(i.height-s.height)/2+this.skidding,r=i.right+this.distance;break;case"top":h=i.top-s.height-this.distance,r=i.left+(i.width-s.width)/2+this.skidding;break;case"bottom":h=i.bottom+this.distance,r=i.left+(i.width-s.width)/2+this.skidding}"top"!==u&&"bottom"!==u||!f||("start"===f?r=i.left+this.skidding:"end"===f&&(r=i.right-s.width+this.skidding)),"left"!==u&&"right"!==u||!f||("start"===f?h=i.top+this.skidding:"end"===f&&(h=i.bottom-s.height+this.skidding)),l=f?`${u}-${f}`:u,r<0&&(r=5),r+s.width>e&&(r=e-s.width-5),h<0&&(h=5),h+s.height>o&&(h=o-s.height-5),this.tooltip.style.top=`${h}px`,this.tooltip.style.left=`${r}px`,this.tooltip.setAttribute("data-placement",l)},this.showTooltip=()=>{this.disabled||""===this.content.trim()||(this.open=!0,this.emit("nile-show"),this.updateComplete.then((()=>{this.updateTooltipPosition(),this.tooltip.addEventListener("transitionend",this.handleAfterShow,{once:!0})})))},this.handleAfterShow=()=>{this.emit("nile-after-show")},this.hideTooltip=()=>{this.open&&(this.emit("nile-hide"),this.open=!1,this.tooltip.addEventListener("transitionend",this.handleAfterHide,{once:!0}))},this.handleAfterHide=()=>{this.emit("nile-after-hide")},this.handleMouseOver=()=>{this.trigger.includes("hover")&&(clearTimeout(this.hoverTimeout),this.hoverTimeout=window.setTimeout((()=>this.showTooltip()),150))},this.handleMouseOut=()=>{this.trigger.includes("hover")&&(clearTimeout(this.hoverTimeout),this.hoverTimeout=window.setTimeout((()=>this.hideTooltip()),0))},this.handleClick=()=>{this.trigger.includes("click")&&(this.open=!this.open,this.emit("nile-show"),this.updateComplete.then((()=>this.updateTooltipPosition())))},this.handleFocus=()=>{this.trigger.includes("focus")&&this.showTooltip()},this.handleBlur=()=>{this.trigger.includes("focus")&&this.hideTooltip()}}static get styles(){return[r]}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this.updateTooltipPosition),window.addEventListener("scroll",this.updateTooltipPosition,!0)}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("resize",this.updateTooltipPosition),window.removeEventListener("scroll",this.updateTooltipPosition,!0)}getBasePlacement(t){return t.split("-")[0]}getAlignmentModifier(t){const i=t.split("-");return i.length>1?i[1]:null}updated(t){super.updated(t),(t.has("open")||t.has("hoist"))&&this.open&&this.hoist}render(){return i`
2
- <div class=${h({tooltip:!0,"tooltip__body--large":"large"===this.size})}>
3
- ${this.content}
1
+ import{__decorate as t}from"tslib";import{html as i}from"lit";import{property as s,query as o,customElement as e}from"lit/decorators.js";import{classMap as h}from"lit/directives/class-map.js";import{s as l}from"./nile-tooltip.css.esm.js";import{N as r}from"../internal/nile-element.esm.js";import{i as n,g as a,a as c}from"./nile-tooltip-utils.esm.js";let d=class extends r{constructor(){super(...arguments),this.content="",this.size="small",this.placement="bottom",this.disabled=!1,this.open=!1,this.trigger="hover focus",this.distance=8,this.SHIFT_OFFSET=16,this.skidding=0,this.hoist=!1,this.hasTooltipSlot=!1,this.hoverTimeout=0,this.caretSize=6,this.originalPlacement=this.placement,this.updateTooltipPosition=()=>{if(!n(this.triggerContainer))return void(this.open=!1);const t=this.triggerContainer.getBoundingClientRect(),i=this.tooltip.getBoundingClientRect(),s=window.innerWidth,o=window.innerHeight,{top:e,left:h,placement:l}=a(t,i,this.originalPlacement,this.distance,this.skidding,this.caretSize,s,o);this.setAttribute("placement",l),this.tooltip.style.top=`${e}px`,this.tooltip.style.left=`${h}px`;const{caretLeft:r,caretTop:d}=c({placement:l,tooltipRect:i,triggerRect:t,caretSize:this.caretSize,left:h,top:e});this.caret.style.left=`${r}px`,this.caret.style.top=`${d}px`},this.showTooltip=()=>{(this.content.trim()||this.hasTooltipSlot)&&(!this.disabled&&n(this.triggerContainer)?(this.emit("nile-show"),this.open=!0,this.updateComplete.then((()=>{this.updateTooltipPosition(),this.emit("nile-after-show")}))):this.open=!1)},this.hideTooltip=()=>{this.emit("nile-hide"),this.open=!1,setTimeout((()=>{this.emit("nile-after-hide")}),200)},this.handleMouseOver=()=>{this.trigger.includes("hover")&&(clearTimeout(this.hoverTimeout),this.hoverTimeout=window.setTimeout((()=>this.showTooltip()),150))},this.handleMouseOut=()=>{this.trigger.includes("hover")&&(clearTimeout(this.hoverTimeout),this.hoverTimeout=window.setTimeout((()=>this.hideTooltip()),0))},this.handleClick=()=>{this.trigger.includes("click")&&(!this.open&&n(this.triggerContainer)?this.showTooltip():this.hideTooltip())},this.handleFocus=()=>{this.trigger.includes("focus")&&this.showTooltip()},this.handleBlur=()=>{this.trigger.includes("focus")&&this.hideTooltip()}}static get styles(){return[l]}connectedCallback(){super.connectedCallback(),this.originalPlacement=this.placement,window.addEventListener("resize",this.updateTooltipPosition),window.addEventListener("scroll",this.updateTooltipPosition,!0)}updated(t){super.updated?.(t);const i=["top","top-start","top-end","right","right-start","right-end","bottom","bottom-start","bottom-end","left","left-start","left-end"];i.includes(this.placement)||(console.warn(`[nile-tooltip] Invalid placement "${this.placement}", defaulting to "bottom".`),this.placement="bottom"),i.includes(this.originalPlacement)||(this.originalPlacement="bottom")}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("resize",this.updateTooltipPosition),window.removeEventListener("scroll",this.updateTooltipPosition,!0)}handleTooltipSlotChange(){const t=this.tooltipSlot.assignedNodes({flatten:!0});this.hasTooltipSlot=t.length>0,this.requestUpdate()}render(){return i`
2
+ <div
3
+ class=${h({tooltip:!0,"tooltip__body--large":"large"===this.size})}
4
+ id="tooltip"
5
+ >
6
+ <div class="tooltip-content" part="content">
7
+ <slot name="content" @slotchange=${this.handleTooltipSlotChange}></slot>
8
+ ${this.hasTooltipSlot?null:i`${this.content}`}
9
+ </div>
10
+ <div class="tooltip-caret" style="--caret-size: ${this.caretSize}px;"></div>
4
11
  </div>
5
- <slot
12
+
13
+ <div
14
+ class="trigger-container"
15
+ tabindex="0"
6
16
  @mouseover=${this.handleMouseOver}
7
17
  @mouseout=${this.handleMouseOut}
8
18
  @click=${this.handleClick}
9
- @focus=${this.handleFocus}
10
- @blur=${this.handleBlur}
19
+ @focusin=${this.handleFocus}
20
+ @focusout=${this.handleBlur}
11
21
  aria-describedby="tooltip"
12
- ></slot>
13
- `}};t([s({type:String})],n.prototype,"content",void 0),t([s({reflect:!0})],n.prototype,"size",void 0),t([s({type:String})],n.prototype,"placement",void 0),t([s({type:Boolean,reflect:!0})],n.prototype,"disabled",void 0),t([s({type:Boolean,reflect:!0})],n.prototype,"open",void 0),t([s()],n.prototype,"trigger",void 0),t([s({type:Number})],n.prototype,"distance",void 0),t([s({type:Number})],n.prototype,"skidding",void 0),t([s({type:Boolean})],n.prototype,"hoist",void 0),t([e(".tooltip")],n.prototype,"tooltip",void 0),t([e("slot")],n.prototype,"slotElement",void 0),n=t([o("nile-tooltip")],n);export{n as N};
22
+ >
23
+ <slot></slot>
24
+ </div>
25
+ `}};t([s({type:String})],d.prototype,"content",void 0),t([s({reflect:!0})],d.prototype,"size",void 0),t([s({type:String})],d.prototype,"placement",void 0),t([s({type:Boolean,reflect:!0})],d.prototype,"disabled",void 0),t([s({type:Boolean,reflect:!0})],d.prototype,"open",void 0),t([s()],d.prototype,"trigger",void 0),t([s({type:Number})],d.prototype,"distance",void 0),t([s({type:Number})],d.prototype,"skidding",void 0),t([s({type:Boolean,reflect:!0})],d.prototype,"hoist",void 0),t([o(".tooltip")],d.prototype,"tooltip",void 0),t([o(".trigger-container")],d.prototype,"triggerContainer",void 0),t([o(".tooltip-caret")],d.prototype,"caret",void 0),t([o('slot[name="content"]')],d.prototype,"tooltipSlot",void 0),d=t([e("nile-tooltip")],d);export{d as N};