@aquera/nile-elements 0.0.92 → 0.0.93

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 (151) hide show
  1. package/README.md +6 -0
  2. package/demo/variables.css +1 -0
  3. package/demo/variables_v2.css +1 -0
  4. package/dist/{angular-ts-da0fd838.cjs.js → angular-ts-a95c67aa.cjs.js} +2 -2
  5. package/dist/{angular-ts-da0fd838.cjs.js.map → angular-ts-a95c67aa.cjs.js.map} +1 -1
  6. package/dist/{asciidoc-de6540f7.esm.js → asciidoc-b8046ce8.esm.js} +1 -1
  7. package/dist/{asciidoc-b383cc2e.cjs.js → asciidoc-c0ae04c3.cjs.js} +2 -2
  8. package/dist/{asciidoc-b383cc2e.cjs.js.map → asciidoc-c0ae04c3.cjs.js.map} +1 -1
  9. package/dist/{astro-05e2da78.cjs.js → astro-97602850.cjs.js} +2 -2
  10. package/dist/{astro-05e2da78.cjs.js.map → astro-97602850.cjs.js.map} +1 -1
  11. package/dist/{astro-1223c814.esm.js → astro-de938e80.esm.js} +1 -1
  12. package/dist/{crystal-00fdf85b.esm.js → crystal-5e351a7d.esm.js} +1 -1
  13. package/dist/{crystal-ae510520.cjs.js → crystal-bfe435a1.cjs.js} +2 -2
  14. package/dist/{crystal-ae510520.cjs.js.map → crystal-bfe435a1.cjs.js.map} +1 -1
  15. package/dist/dotenv-2978380a.esm.js +1 -0
  16. package/dist/dotenv-6a845f3d.cjs.js +2 -0
  17. package/dist/dotenv-6a845f3d.cjs.js.map +1 -0
  18. package/dist/{edge-9983b50e.cjs.js → edge-f122fee4.cjs.js} +2 -2
  19. package/dist/{edge-9983b50e.cjs.js.map → edge-f122fee4.cjs.js.map} +1 -1
  20. package/dist/{erb-6afdf0fc.cjs.js → erb-4ff167eb.cjs.js} +2 -2
  21. package/dist/{erb-6afdf0fc.cjs.js.map → erb-4ff167eb.cjs.js.map} +1 -1
  22. package/dist/{erb-e26dd182.esm.js → erb-baff1e72.esm.js} +1 -1
  23. package/dist/everforest-dark-0ddfeebd.cjs.js +2 -0
  24. package/dist/everforest-dark-0ddfeebd.cjs.js.map +1 -0
  25. package/dist/everforest-dark-c8bfaab7.esm.js +1 -0
  26. package/dist/everforest-light-d4dc4485.esm.js +1 -0
  27. package/dist/everforest-light-eee329e3.cjs.js +2 -0
  28. package/dist/everforest-light-eee329e3.cjs.js.map +1 -0
  29. package/dist/{fortran-fixed-form-dc511aa4.cjs.js → fortran-fixed-form-48ce1631.cjs.js} +2 -2
  30. package/dist/{fortran-fixed-form-dc511aa4.cjs.js.map → fortran-fixed-form-48ce1631.cjs.js.map} +1 -1
  31. package/dist/{fsharp-33f71ce3.esm.js → fsharp-941d0410.esm.js} +1 -1
  32. package/dist/{fsharp-2716dc4e.cjs.js → fsharp-9f65d045.cjs.js} +2 -2
  33. package/dist/{fsharp-2716dc4e.cjs.js.map → fsharp-9f65d045.cjs.js.map} +1 -1
  34. package/dist/{gdresource-10e5a92c.cjs.js → gdresource-f69c4269.cjs.js} +2 -2
  35. package/dist/{gdresource-10e5a92c.cjs.js.map → gdresource-f69c4269.cjs.js.map} +1 -1
  36. package/dist/{git-rebase-3af101f6.esm.js → git-rebase-a164f4f3.esm.js} +1 -1
  37. package/dist/{git-rebase-6c8a29e3.cjs.js → git-rebase-d4b1bf1e.cjs.js} +2 -2
  38. package/dist/{git-rebase-6c8a29e3.cjs.js.map → git-rebase-d4b1bf1e.cjs.js.map} +1 -1
  39. package/dist/{haml-0a4f1779.esm.js → haml-2548eb67.esm.js} +1 -1
  40. package/dist/{haml-9562b9cb.cjs.js → haml-a62722ee.cjs.js} +2 -2
  41. package/dist/{haml-9562b9cb.cjs.js.map → haml-a62722ee.cjs.js.map} +1 -1
  42. package/dist/{http-fbb08279.cjs.js → http-243ce707.cjs.js} +2 -2
  43. package/dist/{http-fbb08279.cjs.js.map → http-243ce707.cjs.js.map} +1 -1
  44. package/dist/{http-93fe835e.esm.js → http-5eea627d.esm.js} +1 -1
  45. package/dist/{hxml-84e30280.cjs.js → hxml-36e954b2.cjs.js} +2 -2
  46. package/dist/{hxml-84e30280.cjs.js.map → hxml-36e954b2.cjs.js.map} +1 -1
  47. package/dist/julia-289248e3.esm.js +1 -0
  48. package/dist/julia-e6d02a84.cjs.js +2 -0
  49. package/dist/julia-e6d02a84.cjs.js.map +1 -0
  50. package/dist/kotlin-0426de90.cjs.js +2 -0
  51. package/dist/kotlin-0426de90.cjs.js.map +1 -0
  52. package/dist/kotlin-9232cba2.esm.js +1 -0
  53. package/dist/latex-1732805a.cjs.js +2 -0
  54. package/dist/latex-1732805a.cjs.js.map +1 -0
  55. package/dist/latex-d31ca0af.esm.js +1 -0
  56. package/dist/less-263f5e43.esm.js +1 -0
  57. package/dist/less-d05a73ab.cjs.js +2 -0
  58. package/dist/less-d05a73ab.cjs.js.map +1 -0
  59. package/dist/{marko-6fdf941d.cjs.js → marko-5bdb0e54.cjs.js} +2 -2
  60. package/dist/{marko-6fdf941d.cjs.js.map → marko-5bdb0e54.cjs.js.map} +1 -1
  61. package/dist/{marko-f6122312.esm.js → marko-b0214c2c.esm.js} +1 -1
  62. package/dist/{mdc-34a9ac72.cjs.js → mdc-a3ab9285.cjs.js} +2 -2
  63. package/dist/{mdc-34a9ac72.cjs.js.map → mdc-a3ab9285.cjs.js.map} +1 -1
  64. package/dist/nile-code-editor/extensionSetup.cjs.js +2 -2
  65. package/dist/nile-code-editor/extensionSetup.esm.js +1 -1
  66. package/dist/nile-code-editor/nile-code-editor.cjs.js +2 -2
  67. package/dist/nile-code-editor/nile-code-editor.cjs.js.map +1 -1
  68. package/dist/nile-code-editor/nile-code-editor.esm.js +3 -3
  69. package/dist/nile-highlighter/nile-highlighter.cjs.js +1 -1
  70. package/dist/nile-highlighter/nile-highlighter.cjs.js.map +1 -1
  71. package/dist/nile-highlighter/nile-highlighter.esm.js +1 -1
  72. package/dist/nile-menu/index.cjs.js +1 -1
  73. package/dist/nile-menu/index.esm.js +1 -1
  74. package/dist/nile-menu/nile-menu.cjs.js +1 -1
  75. package/dist/nile-menu/nile-menu.cjs.js.map +1 -1
  76. package/dist/nile-menu/nile-menu.css.cjs.js +1 -1
  77. package/dist/nile-menu/nile-menu.css.cjs.js.map +1 -1
  78. package/dist/nile-menu/nile-menu.css.esm.js +24 -2
  79. package/dist/nile-menu/nile-menu.esm.js +7 -3
  80. package/dist/nile-select/nile-select.cjs.js +1 -1
  81. package/dist/nile-select/nile-select.cjs.js.map +1 -1
  82. package/dist/nile-select/nile-select.esm.js +2 -2
  83. package/dist/nile-stepper/nile-stepper.cjs.js +1 -1
  84. package/dist/nile-stepper/nile-stepper.cjs.js.map +1 -1
  85. package/dist/nile-stepper/nile-stepper.esm.js +3 -3
  86. package/dist/{nim-808435cb.cjs.js → nim-df5f9efe.cjs.js} +2 -2
  87. package/dist/{nim-808435cb.cjs.js.map → nim-df5f9efe.cjs.js.map} +1 -1
  88. package/dist/{rst-98199db8.esm.js → rst-32451dee.esm.js} +1 -1
  89. package/dist/{rst-a41b2bdd.cjs.js → rst-64e995dc.cjs.js} +2 -2
  90. package/dist/{rst-a41b2bdd.cjs.js.map → rst-64e995dc.cjs.js.map} +1 -1
  91. package/dist/{ruby-44a4045d.cjs.js → ruby-82bc8c10.cjs.js} +2 -2
  92. package/dist/{ruby-44a4045d.cjs.js.map → ruby-82bc8c10.cjs.js.map} +1 -1
  93. package/dist/{ruby-ed20df8b.esm.js → ruby-b8bcac40.esm.js} +1 -1
  94. package/dist/{shaderlab-75efb6b5.cjs.js → shaderlab-8f7349ac.cjs.js} +2 -2
  95. package/dist/{shaderlab-75efb6b5.cjs.js.map → shaderlab-8f7349ac.cjs.js.map} +1 -1
  96. package/dist/{shellscript-95a6b265.esm.js → shellscript-9a12df8f.esm.js} +1 -1
  97. package/dist/{shellscript-ada948c5.cjs.js → shellscript-9c815bf4.cjs.js} +2 -2
  98. package/dist/shellscript-9c815bf4.cjs.js.map +1 -0
  99. package/dist/{shellsession-c69f0eea.esm.js → shellsession-a931a3f3.esm.js} +1 -1
  100. package/dist/{shellsession-c26f94d1.cjs.js → shellsession-c07da9ea.cjs.js} +2 -2
  101. package/dist/{shellsession-c26f94d1.cjs.js.map → shellsession-c07da9ea.cjs.js.map} +1 -1
  102. package/dist/{sparql-933afbfc.cjs.js → sparql-cd3386f5.cjs.js} +2 -2
  103. package/dist/{sparql-933afbfc.cjs.js.map → sparql-cd3386f5.cjs.js.map} +1 -1
  104. package/dist/src/nile-code-editor/nile-code-editor.d.ts +9 -9
  105. package/dist/src/nile-code-editor/nile-code-editor.js +49 -50
  106. package/dist/src/nile-code-editor/nile-code-editor.js.map +1 -1
  107. package/dist/src/nile-menu/nile-menu.css.js +22 -0
  108. package/dist/src/nile-menu/nile-menu.css.js.map +1 -1
  109. package/dist/src/nile-menu/nile-menu.d.ts +1 -0
  110. package/dist/src/nile-menu/nile-menu.js +9 -3
  111. package/dist/src/nile-menu/nile-menu.js.map +1 -1
  112. package/dist/src/nile-select/nile-select.d.ts +1 -0
  113. package/dist/src/nile-select/nile-select.js +14 -0
  114. package/dist/src/nile-select/nile-select.js.map +1 -1
  115. package/dist/src/nile-stepper/nile-stepper.js +4 -4
  116. package/dist/src/nile-stepper/nile-stepper.js.map +1 -1
  117. package/dist/{svelte-03aa9546.esm.js → svelte-00ac1b62.esm.js} +1 -1
  118. package/dist/{svelte-4fa7ff17.cjs.js → svelte-eaee6dea.cjs.js} +2 -2
  119. package/dist/{svelte-4fa7ff17.cjs.js.map → svelte-eaee6dea.cjs.js.map} +1 -1
  120. package/dist/tsconfig.tsbuildinfo +1 -1
  121. package/dist/{twig-78fca8e5.esm.js → twig-25cabcad.esm.js} +1 -1
  122. package/dist/{twig-585d978b.cjs.js → twig-ef3a2f8e.cjs.js} +2 -2
  123. package/dist/{twig-585d978b.cjs.js.map → twig-ef3a2f8e.cjs.js.map} +1 -1
  124. package/dist/{vue-29da39c3.esm.js → vue-711d75a4.esm.js} +1 -1
  125. package/dist/{vue-0e328a24.cjs.js → vue-d4c63178.cjs.js} +2 -2
  126. package/dist/{vue-0e328a24.cjs.js.map → vue-d4c63178.cjs.js.map} +1 -1
  127. package/dist/{vue-html-fa1c51e6.cjs.js → vue-html-13711be2.cjs.js} +2 -2
  128. package/dist/{vue-html-fa1c51e6.cjs.js.map → vue-html-13711be2.cjs.js.map} +1 -1
  129. package/dist/{vue-html-c781b090.esm.js → vue-html-b805e078.esm.js} +1 -1
  130. package/dist/{wikitext-4b6b7007.esm.js → wikitext-724303c6.esm.js} +1 -1
  131. package/dist/{wikitext-6feef894.cjs.js → wikitext-d4ad7e43.cjs.js} +2 -2
  132. package/dist/{wikitext-6feef894.cjs.js.map → wikitext-d4ad7e43.cjs.js.map} +1 -1
  133. package/package.json +1 -2
  134. package/src/nile-code-editor/nile-code-editor.ts +71 -65
  135. package/src/nile-menu/nile-menu.css.ts +22 -0
  136. package/src/nile-menu/nile-menu.ts +14 -3
  137. package/src/nile-select/nile-select.ts +13 -1
  138. package/src/nile-stepper/nile-stepper.ts +4 -4
  139. package/dist/julia-1cad9870.esm.js +0 -1
  140. package/dist/julia-b0cea839.cjs.js +0 -2
  141. package/dist/julia-b0cea839.cjs.js.map +0 -1
  142. package/dist/kotlin-6283300f.esm.js +0 -1
  143. package/dist/kotlin-a0fd9eaf.cjs.js +0 -2
  144. package/dist/kotlin-a0fd9eaf.cjs.js.map +0 -1
  145. package/dist/latex-90a1da91.cjs.js +0 -2
  146. package/dist/latex-90a1da91.cjs.js.map +0 -1
  147. package/dist/latex-9439b9a5.esm.js +0 -1
  148. package/dist/less-cab2de0f.cjs.js +0 -2
  149. package/dist/less-cab2de0f.cjs.js.map +0 -1
  150. package/dist/less-fa4eebf7.esm.js +0 -1
  151. package/dist/shellscript-ada948c5.cjs.js.map +0 -1
@@ -1,2 +1,2 @@
1
- System.register(["./nile-menu.cjs.js","tslib","lit","lit/decorators.js","../internal/nile-element.cjs.js","./nile-menu.css.cjs.js","../index-c7ad3b47.cjs.js"],function(_export,_context){"use strict";return{setters:[function(_nileMenuCjsJs){_export("NileMenu",_nileMenuCjsJs.N);},function(_tslib){},function(_lit){},function(_litDecoratorsJs){},function(_internalNileElementCjsJs){},function(_nileMenuCssCjsJs){},function(_index001CjsJs){}],execute:function execute(){}};});
1
+ System.register(["./nile-menu.cjs.js","tslib","lit","lit/decorators.js","../internal/nile-element.cjs.js","./nile-menu.css.cjs.js","../index-c7ad3b47.cjs.js","../internal/slot.cjs.js"],function(_export,_context){"use strict";return{setters:[function(_nileMenuCjsJs){_export("NileMenu",_nileMenuCjsJs.N);},function(_tslib){},function(_lit){},function(_litDecoratorsJs){},function(_internalNileElementCjsJs){},function(_nileMenuCssCjsJs){},function(_index001CjsJs){},function(_internalSlotCjsJs){}],execute:function execute(){}};});
2
2
  //# sourceMappingURL=index.cjs.js.map
@@ -1 +1 @@
1
- export{N as NileMenu}from"./nile-menu.esm.js";import"tslib";import"lit";import"lit/decorators.js";import"../internal/nile-element.esm.js";import"./nile-menu.css.esm.js";import"../index-0a3007c5.esm.js";
1
+ export{N as NileMenu}from"./nile-menu.esm.js";import"tslib";import"lit";import"lit/decorators.js";import"../internal/nile-element.esm.js";import"./nile-menu.css.esm.js";import"../index-0a3007c5.esm.js";import"../internal/slot.esm.js";
@@ -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","../internal/nile-element.cjs.js","./nile-menu.css.cjs.js","../index-c7ad3b47.cjs.js"],function(_export,_context){"use strict";var e,t,i,s,n,r,o,l,_templateObject,_templateObject2,_templateObject3,_templateObject4,h;function _taggedTemplateLiteral(strings,raw){if(!raw){raw=strings.slice(0);}return Object.freeze(Object.defineProperties(strings,{raw:{value:Object.freeze(raw)}}));}function _toConsumableArray(arr){return _arrayWithoutHoles(arr)||_iterableToArray(arr)||_unsupportedIterableToArray(arr)||_nonIterableSpread();}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _unsupportedIterableToArray(o,minLen){if(!o)return;if(typeof o==="string")return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor)n=o.constructor.name;if(n==="Map"||n==="Set")return Array.from(o);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray(o,minLen);}function _iterableToArray(iter){if(typeof Symbol!=="undefined"&&iter[Symbol.iterator]!=null||iter["@@iterator"]!=null)return Array.from(iter);}function _arrayWithoutHoles(arr){if(Array.isArray(arr))return _arrayLikeToArray(arr);}function _arrayLikeToArray(arr,len){if(len==null||len>arr.length)len=arr.length;for(var i=0,arr2=new Array(len);i<len;i++)arr2[i]=arr[i];return arr2;}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,_toPropertyKey(descriptor.key),descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);Object.defineProperty(Constructor,"prototype",{writable:false});return Constructor;}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(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}else if(call!==void 0){throw new TypeError("Derived constructors may only return object or undefined");}return _assertThisInitialized(self);}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _isNativeReflectConstruct(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch(t){}return(_isNativeReflectConstruct=function _isNativeReflectConstruct(){return!!t;})();}function _get(){if(typeof Reflect!=="undefined"&&Reflect.get){_get=Reflect.get.bind();}else{_get=function _get(target,property,receiver){var base=_superPropBase(target,property);if(!base)return;var desc=Object.getOwnPropertyDescriptor(base,property);if(desc.get){return desc.get.call(arguments.length<3?target:receiver);}return desc.value;};}return _get.apply(this,arguments);}function _superPropBase(object,property){while(!Object.prototype.hasOwnProperty.call(object,property)){object=_getPrototypeOf(object);if(object===null)break;}return object;}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});Object.defineProperty(subClass,"prototype",{writable:false});if(superClass)_setPrototypeOf(subClass,superClass);}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}return{setters:[function(_tslib){e=_tslib.__decorate;},function(_lit){t=_lit.html;},function(_litDecoratorsJs){i=_litDecoratorsJs.state;s=_litDecoratorsJs.property;n=_litDecoratorsJs.query;r=_litDecoratorsJs.customElement;},function(_internalNileElementCjsJs){o=_internalNileElementCjsJs.N;},function(_nileMenuCssCjsJs){l=_nileMenuCssCjsJs.s;},function(_index001CjsJs){}],execute:function execute(){_export("N",h=/*#__PURE__*/function(_o){function h(){var _this;_classCallCheck(this,h);_this=_callSuper(this,h,arguments),_this.searchValue="",_this.searchWidth=0,_this.searchEnabled=!1,_this.customSearch=!1,_this.showNoResults=!1,_this.noResultsMessage="No results found";return _this;}_inherits(h,_o);return _createClass(h,[{key:"connectedCallback",value:function connectedCallback(){_get(_getPrototypeOf(h.prototype),"connectedCallback",this).call(this),this.setAttribute("role","menu");}},{key:"handleClick",value:function handleClick(e){var t=e.target.closest("nile-menu-item");(t===null||t===void 0?void 0:t.hasSubMenu)||t&&!t.disabled&&("checkbox"===t.type&&(t.checked=!t.checked),this.emit("nile-select",{value:t.value}));}},{key:"handleKeyDown",value:function handleKeyDown(e){if("Enter"===e.key){var _t=this.getCurrentItem();e.preventDefault(),_t===null||_t===void 0?void 0:_t.click();}if(" "===e.key&&e.preventDefault(),["ArrowDown","ArrowUp","Home","End"].includes(e.key)){var _t2=this.getAllItems(),_i=this.getCurrentItem();var _s=_i?_t2.indexOf(_i):0;_t2.length>0&&(e.preventDefault(),"ArrowDown"===e.key?_s++:"ArrowUp"===e.key?_s--:"Home"===e.key?_s=0:"End"===e.key&&(_s=_t2.length-1),_s<0&&(_s=_t2.length-1),_s>_t2.length-1&&(_s=0),this.setCurrentItem(_t2[_s]),_t2[_s].focus());}}},{key:"handleMouseDown",value:function handleMouseDown(e){var t=e.target;this.isMenuItem(t)&&this.setCurrentItem(t);}},{key:"handleSlotChange",value:function handleSlotChange(){var e=this.getAllItems();e.length>0&&this.setCurrentItem(e[0]);}},{key:"isMenuItem",value:function isMenuItem(e){var _e$getAttribute;return"nile-menu-item"===e.tagName.toLowerCase()||["menuitem","menuitemcheckbox","menuitemradio"].includes((_e$getAttribute=e.getAttribute("role"))!==null&&_e$getAttribute!==void 0?_e$getAttribute:"");}},{key:"getAllItems",value:function getAllItems(){var _this2=this;return _toConsumableArray(this.defaultSlot.assignedElements({flatten:!0})).filter(function(e){return!!_this2.isMenuItem(e);});}},{key:"getCurrentItem",value:function getCurrentItem(){return this.getAllItems().find(function(e){return"0"===e.getAttribute("tabindex");});}},{key:"setCurrentItem",value:function setCurrentItem(e){this.getAllItems().forEach(function(t){t.setAttribute("tabindex",t===e?"0":"-1");});}},{key:"handleSearchChange",value:function handleSearchChange(e){var _this3=this;var t=this.getAllItems(),i=e.target.value;if(this.customSearch)return void this.emit("nile-search-value",{value:i});var s=0;t.map(function(t){_this3.searchWidth=Math.max(_this3.searchWidth,t.offsetWidth),t.innerText.toLowerCase().includes(e.target.value.toLowerCase())?(t.style.display="block",s++):t.style.display="none";}),this.showNoResults=0===s;}},{key:"render",value:function render(){return t(_templateObject||(_templateObject=_taggedTemplateLiteral(["\n ","\n <div part=\"menu__items-wrapper\" class=\"menu__items-wrapper\">\n ","\n\n <slot\n name=\"menu__header\"\n part=\"menu__header\"\n @click=","\n ></slot>\n <slot\n class=\"menu__item-wrapper\"\n @slotchange=","\n @click=","\n @keydown=","\n @mousedown=","\n ></slot>\n </div>\n "])),this.searchEnabled?t(_templateObject2||(_templateObject2=_taggedTemplateLiteral(["<div class=\"search__wrapper\" part=\"search__wrapper\">\n <nile-input\n size=\"medium\"\n style=","\n .value=","\n placeholder=\"Search...\"\n @nile-input=","\n part=\"menu__input\"\n clearable\n >\n <nile-icon name=\"search\" slot=\"suffix\"> </nile-icon>\n </nile-input>\n </div>"])),this.searchWidth?"width: ".concat(this.searchWidth,"px;"):"width: 100%;",this.searchValue,this.handleSearchChange):t(_templateObject3||(_templateObject3=_taggedTemplateLiteral([""]))),this.showNoResults?t(_templateObject4||(_templateObject4=_taggedTemplateLiteral([" <nile-menu-item>","</nile-menu-item> "])),this.noResultsMessage):"",function(e){e.stopPropagation();},this.handleSlotChange,this.handleClick,this.handleKeyDown,this.handleMouseDown);}}]);}(o));h.styles=l,e([i()],h.prototype,"searchValue",void 0),e([i()],h.prototype,"searchWidth",void 0),e([s({type:Boolean,reflect:!0})],h.prototype,"searchEnabled",void 0),e([s({type:Boolean,reflect:!0})],h.prototype,"customSearch",void 0),e([s({type:Boolean})],h.prototype,"showNoResults",void 0),e([s({type:String})],h.prototype,"noResultsMessage",void 0),e([n("slot:not([name])")],h.prototype,"defaultSlot",void 0),_export("N",h=e([r("nile-menu")],h));}};});
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","../internal/nile-element.cjs.js","./nile-menu.css.cjs.js","../internal/slot.cjs.js","../index-c7ad3b47.cjs.js"],function(_export,_context){"use strict";var e,t,s,i,n,o,r,l,a,_templateObject,_templateObject2,_templateObject3,_templateObject4,_templateObject5,h;function _taggedTemplateLiteral(strings,raw){if(!raw){raw=strings.slice(0);}return Object.freeze(Object.defineProperties(strings,{raw:{value:Object.freeze(raw)}}));}function _toConsumableArray(arr){return _arrayWithoutHoles(arr)||_iterableToArray(arr)||_unsupportedIterableToArray(arr)||_nonIterableSpread();}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");}function _unsupportedIterableToArray(o,minLen){if(!o)return;if(typeof o==="string")return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor)n=o.constructor.name;if(n==="Map"||n==="Set")return Array.from(o);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray(o,minLen);}function _iterableToArray(iter){if(typeof Symbol!=="undefined"&&iter[Symbol.iterator]!=null||iter["@@iterator"]!=null)return Array.from(iter);}function _arrayWithoutHoles(arr){if(Array.isArray(arr))return _arrayLikeToArray(arr);}function _arrayLikeToArray(arr,len){if(len==null||len>arr.length)len=arr.length;for(var i=0,arr2=new Array(len);i<len;i++)arr2[i]=arr[i];return arr2;}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,_toPropertyKey(descriptor.key),descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);Object.defineProperty(Constructor,"prototype",{writable:false});return Constructor;}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(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}else if(call!==void 0){throw new TypeError("Derived constructors may only return object or undefined");}return _assertThisInitialized(self);}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _isNativeReflectConstruct(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch(t){}return(_isNativeReflectConstruct=function _isNativeReflectConstruct(){return!!t;})();}function _get(){if(typeof Reflect!=="undefined"&&Reflect.get){_get=Reflect.get.bind();}else{_get=function _get(target,property,receiver){var base=_superPropBase(target,property);if(!base)return;var desc=Object.getOwnPropertyDescriptor(base,property);if(desc.get){return desc.get.call(arguments.length<3?target:receiver);}return desc.value;};}return _get.apply(this,arguments);}function _superPropBase(object,property){while(!Object.prototype.hasOwnProperty.call(object,property)){object=_getPrototypeOf(object);if(object===null)break;}return object;}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf.bind():function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});Object.defineProperty(subClass,"prototype",{writable:false});if(superClass)_setPrototypeOf(subClass,superClass);}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}return{setters:[function(_tslib){e=_tslib.__decorate;},function(_lit){t=_lit.html;},function(_litDecoratorsJs){s=_litDecoratorsJs.state;i=_litDecoratorsJs.property;n=_litDecoratorsJs.query;o=_litDecoratorsJs.customElement;},function(_internalNileElementCjsJs){r=_internalNileElementCjsJs.N;},function(_nileMenuCssCjsJs){l=_nileMenuCssCjsJs.s;},function(_internalSlotCjsJs){a=_internalSlotCjsJs.H;},function(_index001CjsJs){}],execute:function execute(){_export("N",h=/*#__PURE__*/function(_r){function h(){var _this;_classCallCheck(this,h);_this=_callSuper(this,h,arguments),_this.searchValue="",_this.searchWidth=0,_this.searchEnabled=!1,_this.customSearch=!1,_this.showNoResults=!1,_this.noResultsMessage="No results found",_this.hasSlotController=new a(_assertThisInitialized(_this),"menu__footer","menu__header");return _this;}_inherits(h,_r);return _createClass(h,[{key:"connectedCallback",value:function connectedCallback(){_get(_getPrototypeOf(h.prototype),"connectedCallback",this).call(this),this.setAttribute("role","menu");}},{key:"handleClick",value:function handleClick(e){var t=e.target.closest("nile-menu-item");(t===null||t===void 0?void 0:t.hasSubMenu)||t&&!t.disabled&&("checkbox"===t.type&&(t.checked=!t.checked),this.emit("nile-select",{value:t.value}));}},{key:"handleKeyDown",value:function handleKeyDown(e){if("Enter"===e.key){var _t=this.getCurrentItem();e.preventDefault(),_t===null||_t===void 0?void 0:_t.click();}if(" "===e.key&&e.preventDefault(),["ArrowDown","ArrowUp","Home","End"].includes(e.key)){var _t2=this.getAllItems(),_s=this.getCurrentItem();var _i=_s?_t2.indexOf(_s):0;_t2.length>0&&(e.preventDefault(),"ArrowDown"===e.key?_i++:"ArrowUp"===e.key?_i--:"Home"===e.key?_i=0:"End"===e.key&&(_i=_t2.length-1),_i<0&&(_i=_t2.length-1),_i>_t2.length-1&&(_i=0),this.setCurrentItem(_t2[_i]),_t2[_i].focus());}}},{key:"handleMouseDown",value:function handleMouseDown(e){var t=e.target;this.isMenuItem(t)&&this.setCurrentItem(t);}},{key:"handleSlotChange",value:function handleSlotChange(){var e=this.getAllItems();e.length>0&&this.setCurrentItem(e[0]);}},{key:"isMenuItem",value:function isMenuItem(e){var _e$getAttribute;return"nile-menu-item"===e.tagName.toLowerCase()||["menuitem","menuitemcheckbox","menuitemradio"].includes((_e$getAttribute=e.getAttribute("role"))!==null&&_e$getAttribute!==void 0?_e$getAttribute:"");}},{key:"getAllItems",value:function getAllItems(){var _this2=this;return _toConsumableArray(this.defaultSlot.assignedElements({flatten:!0})).filter(function(e){return!!_this2.isMenuItem(e);});}},{key:"getCurrentItem",value:function getCurrentItem(){return this.getAllItems().find(function(e){return"0"===e.getAttribute("tabindex");});}},{key:"setCurrentItem",value:function setCurrentItem(e){this.getAllItems().forEach(function(t){t.setAttribute("tabindex",t===e?"0":"-1");});}},{key:"handleSearchChange",value:function handleSearchChange(e){var _this3=this;var t=this.getAllItems(),s=e.target.value;if(this.customSearch)return void this.emit("nile-search-value",{value:s});var i=0;t.map(function(t){_this3.searchWidth=Math.max(_this3.searchWidth,t.offsetWidth),t.innerText.toLowerCase().includes(e.target.value.toLowerCase())?(t.style.display="block",i++):t.style.display="none";}),this.showNoResults=0===i;}},{key:"render",value:function render(){return t(_templateObject||(_templateObject=_taggedTemplateLiteral(["\n ","\n <div part=\"menu__items-wrapper\" class=\"menu__items-wrapper\">\n ","\n\n <slot\n name=\"menu__header\"\n part=\"menu__header\"\n @click=","\n ></slot>\n <slot\n class=\"menu__item-wrapper\"\n @slotchange=","\n @click=","\n @keydown=","\n @mousedown=","\n ></slot>\n ","\n </div>\n "])),this.searchEnabled?t(_templateObject2||(_templateObject2=_taggedTemplateLiteral(["<div class=\"search__wrapper\" part=\"search__wrapper\">\n <nile-input\n size=\"medium\"\n .value=","\n placeholder=\"Search...\"\n @nile-input=","\n part=\"menu__input\"\n clearable\n >\n <nile-icon name=\"search\" slot=\"suffix\"> </nile-icon>\n </nile-input>\n </div>"])),this.searchValue,this.handleSearchChange):t(_templateObject3||(_templateObject3=_taggedTemplateLiteral([""]))),this.showNoResults?t(_templateObject4||(_templateObject4=_taggedTemplateLiteral([" <nile-menu-item>","</nile-menu-item> "])),this.noResultsMessage):"",function(e){e.stopPropagation();},this.handleSlotChange,this.handleClick,this.handleKeyDown,this.handleMouseDown,this.hasSlotController.test("menu__footer")?t(_templateObject5||(_templateObject5=_taggedTemplateLiteral([" <slot\n part=\"menu__footer\"\n name=\"menu__footer\"\n class=\"menu__footer\"\n ></slot>"]))):null);}}]);}(r));h.styles=l,e([s()],h.prototype,"searchValue",void 0),e([s()],h.prototype,"searchWidth",void 0),e([i({type:Boolean,reflect:!0})],h.prototype,"searchEnabled",void 0),e([i({type:Boolean,reflect:!0})],h.prototype,"customSearch",void 0),e([i({type:Boolean})],h.prototype,"showNoResults",void 0),e([i({type:String})],h.prototype,"noResultsMessage",void 0),e([n("slot:not([name])")],h.prototype,"defaultSlot",void 0),_export("N",h=e([o("nile-menu")],h));}};});
2
2
  //# sourceMappingURL=nile-menu.cjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"nile-menu.cjs.js","sources":["../../../src/nile-menu/nile-menu.ts"],"sourcesContent":["import { LitElement, html, css } from 'lit';\nimport { customElement, property, state } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { query } from 'lit/decorators.js';\nimport NileElement from '../internal/nile-element';\nimport type { CSSResultGroup } from 'lit';\nimport type NileMenuItem from '../nile-menu-item/nile-menu-item';\nimport { styles } from './nile-menu.css';\n\n/**\n * An nile-menu element.\n * @summary Menus provide a list of options for the user to choose from.\n *\n * @slot - The menu's content, including menu items, menu labels, and dividers.\n *\n * @event nile-select - Emitted when a menu item is selected.\n * @fires count-changed - Indicates when the count changes\n * @slot - This element has a slot\n * @csspart button - The button\n */\n\n@customElement('nile-menu')\nexport class NileMenu extends NileElement {\n static styles: CSSResultGroup = styles;\n @state() searchValue: string = '';\n @state() searchWidth: number = 0;\n\n @property({ type: Boolean, reflect: true }) searchEnabled = false;\n @property({ type: Boolean, reflect: true }) customSearch = false;\n\n @property({ type: Boolean }) showNoResults: boolean = false;\n\n @property({ type: String }) noResultsMessage: string = 'No results found';\n\n @query('slot:not([name])') defaultSlot!: HTMLSlotElement;\n\n connectedCallback() {\n super.connectedCallback();\n this.setAttribute('role', 'menu');\n }\n\n private handleClick(event: MouseEvent) {\n const target = event.target as HTMLElement;\n const item = target.closest('nile-menu-item');\n\n if (item?.hasSubMenu) {\n return;\n }\n\n // if (!item || item.disabled || item.inert) {\n if (!item || item.disabled) {\n return;\n }\n\n if (item.type === 'checkbox') {\n item.checked = !item.checked;\n }\n\n this.emit('nile-select', { value: item.value });\n }\n\n private handleKeyDown(event: KeyboardEvent) {\n // Make a selection when pressing enter\n if (event.key === 'Enter') {\n const item = this.getCurrentItem();\n event.preventDefault();\n\n // Simulate a click to support @click handlers on menu items that also work with the keyboard\n item?.click();\n }\n\n // Prevent scrolling when space is pressed\n if (event.key === ' ') {\n event.preventDefault();\n }\n\n // Move the selection when pressing down or up\n if (['ArrowDown', 'ArrowUp', 'Home', 'End'].includes(event.key)) {\n const items = this.getAllItems();\n const activeItem = this.getCurrentItem();\n let index = activeItem ? items.indexOf(activeItem) : 0;\n\n if (items.length > 0) {\n event.preventDefault();\n\n if (event.key === 'ArrowDown') {\n index++;\n } else if (event.key === 'ArrowUp') {\n index--;\n } else if (event.key === 'Home') {\n index = 0;\n } else if (event.key === 'End') {\n index = items.length - 1;\n }\n\n if (index < 0) {\n index = items.length - 1;\n }\n if (index > items.length - 1) {\n index = 0;\n }\n\n this.setCurrentItem(items[index]);\n items[index].focus();\n }\n }\n }\n\n private handleMouseDown(event: MouseEvent) {\n const target = event.target as HTMLElement;\n\n if (this.isMenuItem(target)) {\n this.setCurrentItem(target as NileMenuItem);\n }\n }\n\n private handleSlotChange() {\n const items = this.getAllItems();\n\n // Reset the roving tab index when the slotted items change\n if (items.length > 0) {\n this.setCurrentItem(items[0]);\n }\n }\n\n private isMenuItem(item: HTMLElement) {\n return (\n item.tagName.toLowerCase() === 'nile-menu-item' ||\n ['menuitem', 'menuitemcheckbox', 'menuitemradio'].includes(\n item.getAttribute('role') ?? ''\n )\n );\n }\n\n /** @internal Gets all slotted menu items, ignoring dividers, headers, and other elements. */\n getAllItems() {\n return [...this.defaultSlot.assignedElements({ flatten: true })].filter(\n (el: HTMLElement) => {\n if (!this.isMenuItem(el)) {\n // if (el.inert || !this.isMenuItem(el)) {\n return false;\n }\n return true;\n }\n ) as NileMenuItem[];\n }\n\n /**\n * @internal Gets the current menu item, which is the menu item that has `tabindex=\"0\"` within the roving tab index.\n * The menu item may or may not have focus, but for keyboard interaction purposes it's considered the \"active\" item.\n */\n getCurrentItem() {\n return this.getAllItems().find(i => i.getAttribute('tabindex') === '0');\n }\n\n /**\n * @internal Sets the current menu item to the specified element. This sets `tabindex=\"0\"` on the target element and\n * `tabindex=\"-1\"` to all other items. This method must be called prior to setting focus on a menu item.\n */\n setCurrentItem(item: NileMenuItem) {\n const items = this.getAllItems();\n\n // Update tab indexes\n items.forEach(i => {\n i.setAttribute('tabindex', i === item ? '0' : '-1');\n });\n }\n\n private handleSearchChange(e: any) {\n let items = this.getAllItems();\n let searchValue = e.target.value;\n if (this.customSearch) {\n this.emit('nile-search-value', { value: searchValue });\n return;\n }\n\n let counter = 0;\n items.map(curr_item => {\n this.searchWidth = Math.max(this.searchWidth, curr_item.offsetWidth);\n if (\n curr_item.innerText.toLowerCase().includes(e.target.value.toLowerCase())\n ) {\n curr_item.style.display = 'block';\n counter++;\n } else {\n curr_item.style.display = 'none';\n }\n });\n this.showNoResults = counter === 0;\n }\n\n render() {\n return html`\n ${this.searchEnabled\n ? html`<div class=\"search__wrapper\" part=\"search__wrapper\">\n <nile-input\n size=\"medium\"\n style=${this.searchWidth\n ? `width: ${this.searchWidth}px;`\n : 'width: 100%;'}\n .value=${this.searchValue}\n placeholder=\"Search...\"\n @nile-input=${this.handleSearchChange}\n part=\"menu__input\"\n clearable\n >\n <nile-icon name=\"search\" slot=\"suffix\"> </nile-icon>\n </nile-input>\n </div>`\n : html``}\n <div part=\"menu__items-wrapper\" class=\"menu__items-wrapper\">\n ${this.showNoResults\n ? html` <nile-menu-item>${this.noResultsMessage}</nile-menu-item> `\n : ''}\n\n <slot\n name=\"menu__header\"\n part=\"menu__header\"\n @click=${(e: Event) => {\n e.stopPropagation();\n }}\n ></slot>\n <slot\n class=\"menu__item-wrapper\"\n @slotchange=${this.handleSlotChange}\n @click=${this.handleClick}\n @keydown=${this.handleKeyDown}\n @mousedown=${this.handleMouseDown}\n ></slot>\n </div>\n `;\n }\n}\nexport default NileMenu;\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nile-menu': NileMenu;\n }\n}\n"],"names":["NileMenu","h","this","searchValue","searchWidth","searchEnabled","customSearch","showNoResults","noResultsMessage","_this","_inherits","_o","_createClass","key","value","connectedCallback","super","setAttribute","handleClick","event","item","target","closest","hasSubMenu","disabled","type","checked","emit","handleKeyDown","getCurrentItem","preventDefault","click","includes","items","getAllItems","activeItem","index","indexOf","length","setCurrentItem","focus","handleMouseDown","isMenuItem","handleSlotChange","_e$getAttribute","tagName","toLowerCase","getAttribute","_toConsumableArray","defaultSlot","assignedElements","flatten","filter","el","find","i","forEach","handleSearchChange","e","counter","map","curr_item","Math","max","offsetWidth","innerText","style","display","render","html","_templateObject","_taggedTemplateLiteral","_templateObject2","_templateObject3","_templateObject4","stopPropagation","NileElement","styles","__decorate","state","prototype","property","Boolean","reflect","String","query","customElement"],"mappings":"00KAsBaA,CAAAA,uBAAAA,EAAAA,EAAN,SAAAC,EAAA,uEAEIC,KAAAA,CAAWC,WAAAA,CAAW,EACtBD,CAAAA,KAAAA,CAAWE,YAAW,CAEaF,CAAAA,KAAAA,CAAaG,aAAG,CAAA,CAAA,CAAA,CAChBH,KAAAA,CAAYI,YAAG,CAAA,CAAA,CAAA,CAE9BJ,KAAAA,CAAaK,aAAAA,CAAAA,CAAY,EAE1BL,KAAAA,CAAgBM,gBAAAA,CAAW,kBAwMxD,QAAAC,KAAA,EApMCC,SAAA,CAAAT,CAAA,CAAAU,EAAA,SAAAC,YAAA,CAAAX,CAAA,GAAAY,GAAA,qBAAAC,KAAA,UAAAC,kBAAA,CACEC,CAAAA,IAAAA,CAAAA,eAAAA,CAAAA,CAAAA,CAAAA,SAAAA,4BAAAA,IAAAA,OACAd,IAAAA,CAAKe,aAAa,MAAQ,CAAA,MAAA,CAC3B,EAEO,GAAAJ,GAAA,eAAAC,KAAA,UAAAI,YAAYC,CAClB,CAAA,CAAA,GACMC,CAAAA,CADSD,CAAAA,CAAAA,CAAME,OACDC,OAAQ,CAAA,gBAAA,CAAA,CAExBF,CAAAA,CAAMG,SAANH,CAAMG,iBAANH,CAAMG,CAAAA,UAAAA,GAKLH,IAAQA,CAAKI,CAAAA,QAAAA,GAIA,UAAdJ,GAAAA,CAAAA,CAAKK,OACPL,CAAKM,CAAAA,OAAAA,CAAAA,CAAWN,CAAKM,CAAAA,OAAAA,CAAAA,CAGvBxB,KAAKyB,IAAK,CAAA,aAAA,CAAe,CAAEb,KAAOM,CAAAA,CAAAA,CAAKN,QACxC,EAEO,GAAAD,GAAA,iBAAAC,KAAA,UAAAc,cAAcT,CAAAA,CA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AAS,CAAExD,IAAAA,CAAMyD,OAA0ClF,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAgF,UAAA,eAAA,CAAA,IAAA,EAAA,CAAA,CAEhCF,CAAA,CAAA,CAA3BG,EAAS,CAAExD,IAAAA,CAAM2D,MAAwDpF,CAAAA,CAAAA,CAAAA,CAAAA,CAAAA,CAAAgF,UAAA,kBAAA,CAAA,IAAA,EAAA,CAAA,CAE/CF,CAAA,CAAA,CAA1BO,EAAM,kBAAkDrF,CAAAA,CAAAA,CAAAA,CAAAA,CAAAgF,SAAA,CAAA,aAAA,CAAA,IAAA,gBAZ9ChF,CAAQ8E,CAAAA,CAAAA,CAAA,CADpBQ,CAAAA,CAAc,cACFtF"}
1
+ {"version":3,"file":"nile-menu.cjs.js","sources":["../../../src/nile-menu/nile-menu.ts"],"sourcesContent":["import { LitElement, html, css } from 'lit';\nimport { customElement, property, state } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { query } from 'lit/decorators.js';\nimport NileElement from '../internal/nile-element';\nimport type { CSSResultGroup } from 'lit';\nimport type NileMenuItem from '../nile-menu-item/nile-menu-item';\nimport { styles } from './nile-menu.css';\nimport { HasSlotController } from '../internal/slot';\n\n/**\n * An nile-menu element.\n * @summary Menus provide a list of options for the user to choose from.\n *\n * @slot - The menu's content, including menu items, menu labels, and dividers.\n *\n * @event nile-select - Emitted when a menu item is selected.\n * @fires count-changed - Indicates when the count changes\n * @slot - This element has a slot\n * @csspart button - The button\n */\n\n@customElement('nile-menu')\nexport class NileMenu extends NileElement {\n static styles: CSSResultGroup = styles;\n @state() searchValue: string = '';\n @state() searchWidth: number = 0;\n\n @property({ type: Boolean, reflect: true }) searchEnabled = false;\n @property({ type: Boolean, reflect: true }) customSearch = false;\n\n @property({ type: Boolean }) showNoResults: boolean = false;\n\n @property({ type: String }) noResultsMessage: string = 'No results found';\n\n @query('slot:not([name])') defaultSlot!: HTMLSlotElement;\n\n private readonly hasSlotController = new HasSlotController(\n this,\n 'menu__footer',\n 'menu__header'\n );\n\n connectedCallback() {\n super.connectedCallback();\n this.setAttribute('role', 'menu');\n }\n\n private handleClick(event: MouseEvent) {\n const target = event.target as HTMLElement;\n const item = target.closest('nile-menu-item');\n\n if (item?.hasSubMenu) {\n return;\n }\n\n // if (!item || item.disabled || item.inert) {\n if (!item || item.disabled) {\n return;\n }\n\n if (item.type === 'checkbox') {\n item.checked = !item.checked;\n }\n\n this.emit('nile-select', { value: item.value });\n }\n\n private handleKeyDown(event: KeyboardEvent) {\n // Make a selection when pressing enter\n if (event.key === 'Enter') {\n const item = this.getCurrentItem();\n event.preventDefault();\n\n // Simulate a click to support @click handlers on menu items that also work with the keyboard\n item?.click();\n }\n\n // Prevent scrolling when space is pressed\n if (event.key === ' ') {\n event.preventDefault();\n }\n\n // Move the selection when pressing down or up\n if (['ArrowDown', 'ArrowUp', 'Home', 'End'].includes(event.key)) {\n const items = this.getAllItems();\n const activeItem = this.getCurrentItem();\n let index = activeItem ? items.indexOf(activeItem) : 0;\n\n if (items.length > 0) {\n event.preventDefault();\n\n if (event.key === 'ArrowDown') {\n index++;\n } else if (event.key === 'ArrowUp') {\n index--;\n } else if (event.key === 'Home') {\n index = 0;\n } else if (event.key === 'End') {\n index = items.length - 1;\n }\n\n if (index < 0) {\n index = items.length - 1;\n }\n if (index > items.length - 1) {\n index = 0;\n }\n\n this.setCurrentItem(items[index]);\n items[index].focus();\n }\n }\n }\n\n private handleMouseDown(event: MouseEvent) {\n const target = event.target as HTMLElement;\n\n if (this.isMenuItem(target)) {\n this.setCurrentItem(target as NileMenuItem);\n }\n }\n\n private handleSlotChange() {\n const items = this.getAllItems();\n\n // Reset the roving tab index when the slotted items change\n if (items.length > 0) {\n this.setCurrentItem(items[0]);\n }\n }\n\n private isMenuItem(item: HTMLElement) {\n return (\n item.tagName.toLowerCase() === 'nile-menu-item' ||\n ['menuitem', 'menuitemcheckbox', 'menuitemradio'].includes(\n item.getAttribute('role') ?? ''\n )\n );\n }\n\n /** @internal Gets all slotted menu items, ignoring dividers, headers, and other elements. */\n getAllItems() {\n return [...this.defaultSlot.assignedElements({ flatten: true })].filter(\n (el: HTMLElement) => {\n if (!this.isMenuItem(el)) {\n // if (el.inert || !this.isMenuItem(el)) {\n return false;\n }\n return true;\n }\n ) as NileMenuItem[];\n }\n\n /**\n * @internal Gets the current menu item, which is the menu item that has `tabindex=\"0\"` within the roving tab index.\n * The menu item may or may not have focus, but for keyboard interaction purposes it's considered the \"active\" item.\n */\n getCurrentItem() {\n return this.getAllItems().find(i => i.getAttribute('tabindex') === '0');\n }\n\n /**\n * @internal Sets the current menu item to the specified element. This sets `tabindex=\"0\"` on the target element and\n * `tabindex=\"-1\"` to all other items. This method must be called prior to setting focus on a menu item.\n */\n setCurrentItem(item: NileMenuItem) {\n const items = this.getAllItems();\n\n // Update tab indexes\n items.forEach(i => {\n i.setAttribute('tabindex', i === item ? '0' : '-1');\n });\n }\n\n private handleSearchChange(e: any) {\n let items = this.getAllItems();\n let searchValue = e.target.value;\n if (this.customSearch) {\n this.emit('nile-search-value', { value: searchValue });\n return;\n }\n\n let counter = 0;\n items.map(curr_item => {\n this.searchWidth = Math.max(this.searchWidth, curr_item.offsetWidth);\n if (\n curr_item.innerText.toLowerCase().includes(e.target.value.toLowerCase())\n ) {\n curr_item.style.display = 'block';\n counter++;\n } else {\n curr_item.style.display = 'none';\n }\n });\n this.showNoResults = counter === 0;\n }\n\n render() {\n return html`\n ${this.searchEnabled\n ? html`<div class=\"search__wrapper\" part=\"search__wrapper\">\n <nile-input\n size=\"medium\"\n .value=${this.searchValue}\n placeholder=\"Search...\"\n @nile-input=${this.handleSearchChange}\n part=\"menu__input\"\n clearable\n >\n <nile-icon name=\"search\" slot=\"suffix\"> </nile-icon>\n </nile-input>\n </div>`\n : html``}\n <div part=\"menu__items-wrapper\" class=\"menu__items-wrapper\">\n ${this.showNoResults\n ? html` <nile-menu-item>${this.noResultsMessage}</nile-menu-item> `\n : ''}\n\n <slot\n name=\"menu__header\"\n part=\"menu__header\"\n @click=${(e: Event) => {\n e.stopPropagation();\n }}\n ></slot>\n <slot\n class=\"menu__item-wrapper\"\n @slotchange=${this.handleSlotChange}\n @click=${this.handleClick}\n @keydown=${this.handleKeyDown}\n @mousedown=${this.handleMouseDown}\n ></slot>\n ${this.hasSlotController.test('menu__footer')\n ? html` <slot\n part=\"menu__footer\"\n name=\"menu__footer\"\n class=\"menu__footer\"\n ></slot>`\n : null}\n </div>\n `;\n }\n}\nexport default NileMenu;\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nile-menu': NileMenu;\n }\n}\n"],"names":["NileMenu","_r","h","this","searchValue","searchWidth","searchEnabled","customSearch","showNoResults","noResultsMessage","hasSlotController","HasSlotController","_this","_inherits","_createClass","key","value","connectedCallback","super","setAttribute","handleClick","event","item","target","closest","hasSubMenu","disabled","type","checked","emit","handleKeyDown","getCurrentItem","preventDefault","click","includes","items","getAllItems","activeItem","index","indexOf","length","setCurrentItem","focus","handleMouseDown","isMenuItem","handleSlotChange","_e$getAttribute","tagName","toLowerCase","getAttribute","_toConsumableArray","defaultSlot","assignedElements","flatten","filter","el","find","i","forEach","handleSearchChange","e","counter","map","curr_item","Math","max","offsetWidth","innerText","style","display","render","html","_templateObject","_taggedTemplateLiteral","_templateObject2","_templateObject3","_templateObject4","stopPropagation","test","_templateObject5","NileElement","styles","__decorate","state","prototype","property","Boolean","reflect","String","query","customElement"],"mappings":"66KAuBaA,CAAN,uBAAAC,EAAA,EAAA,SAAAC,EAAA,uEAEIC,KAAAA,CAAWC,WAAAA,CAAW,GACtBD,KAAAA,CAAWE,WAAAA,CAAW,CAEaF,CAAAA,KAAAA,CAAaG,eAAG,CAChBH,CAAAA,KAAAA,CAAYI,cAAG,CAE9BJ,CAAAA,KAAAA,CAAaK,eAAY,CAE1BL,CAAAA,KAAAA,CAAgBM,gBAAW,CAAA,kBAAA,CAItCN,KAAAA,CAAiBO,iBAAG,CAAA,GAAIC,CAAAA,CACv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AAA,CAAA,CADpBQ,CAAAA,CAAc,cACF1F"}
@@ -1,2 +1,2 @@
1
- System.register(["../index-c7ad3b47.cjs.js"],function(_export,_context){"use strict";var o,_templateObject,e;function _taggedTemplateLiteral(strings,raw){if(!raw){raw=strings.slice(0);}return Object.freeze(Object.defineProperties(strings,{raw:{value:Object.freeze(raw)}}));}return{setters:[function(_index001CjsJs){o=_index001CjsJs.i;}],execute:function execute(){_export("s",e=o(_templateObject||(_templateObject=_taggedTemplateLiteral(["\n :host {\n display: block;\n position: relative;\n background: hsl(0, 0%, 100%);\n border: solid 1px hsl(240 5.9% 90%);\n border-radius: 6px;\n overflow: hidden;\n height: 100%;\n box-shadow: 0px 20px 24px -4px rgba(16, 24, 40, 0.08),\n 0px 8px 8px -4px rgba(16, 24, 40, 0.03);\n /* overscroll-behavior: none; */\n /* -ms-overflow-style: none; */\n /* scrollbar-width: none; */\n }\n\n .search__wrapper {\n box-sizing: border-box;\n padding: 12px 6px;\n position: sticky;\n z-index: 999;\n top: 0px;\n background: hsl(0, 0%, 100%);\n height: 64px;\n }\n\n .menu__items-wrapper {\n overflow: auto;\n max-height: calc(100vh - 64px);\n }\n\n ::slotted(nile-divider) {\n --spacing: 0.5rem;\n }\n"]))));}};});
1
+ System.register(["../index-c7ad3b47.cjs.js"],function(_export,_context){"use strict";var r,_templateObject,e;function _taggedTemplateLiteral(strings,raw){if(!raw){raw=strings.slice(0);}return Object.freeze(Object.defineProperties(strings,{raw:{value:Object.freeze(raw)}}));}return{setters:[function(_index001CjsJs){r=_index001CjsJs.i;}],execute:function execute(){_export("s",e=r(_templateObject||(_templateObject=_taggedTemplateLiteral(["\n :host {\n display: block;\n position: relative;\n background: hsl(0, 0%, 100%);\n border: solid 1px hsl(240 5.9% 90%);\n border-radius: 6px;\n overflow: hidden;\n height: 100%;\n box-shadow: 0px 20px 24px -4px rgba(16, 24, 40, 0.08),\n 0px 8px 8px -4px rgba(16, 24, 40, 0.03);\n /* overscroll-behavior: none; */\n /* -ms-overflow-style: none; */\n /* scrollbar-width: none; */\n }\n\n .search__wrapper {\n box-sizing: border-box;\n padding: 12px 6px;\n position: sticky;\n z-index: 999;\n top: 0px;\n background: hsl(0, 0%, 100%);\n height: 64px;\n }\n\n .menu__items-wrapper {\n overflow: auto;\n max-height: calc(100vh - 64px);\n }\n\n ::slotted(nile-divider) {\n --spacing: 0.5rem;\n }\n\n .menu__footer {\n display: flex;\n border-radius: var(--nile-radius-radius-sm);\n align-items: stretch;\n font-size: 1rem;\n font-weight: var(--nile-font-weight-regular);\n line-height: 180%;\n letter-spacing: normal;\n color: var(--nile-colors-primary-600);\n min-height: 40px;\n transition: 150ms fill;\n user-select: none;\n white-space: nowrap;\n cursor: pointer;\n padding: 0 var(--nile-spacing-spacing-xl);\n margin: auto 0;\n }\n\n .menu__footer:hover {\n background-color:var(--nile-menu-item-background-color);\n }\n"]))));}};});
2
2
  //# sourceMappingURL=nile-menu.css.cjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"nile-menu.css.cjs.js","sources":["../../../src/nile-menu/nile-menu.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-element';\n\n/**\n * Menu CSS\n */\nexport const styles = css`\n :host {\n display: block;\n position: relative;\n background: hsl(0, 0%, 100%);\n border: solid 1px hsl(240 5.9% 90%);\n border-radius: 6px;\n overflow: hidden;\n height: 100%;\n box-shadow: 0px 20px 24px -4px rgba(16, 24, 40, 0.08),\n 0px 8px 8px -4px rgba(16, 24, 40, 0.03);\n /* overscroll-behavior: none; */\n /* -ms-overflow-style: none; */\n /* scrollbar-width: none; */\n }\n\n .search__wrapper {\n box-sizing: border-box;\n padding: 12px 6px;\n position: sticky;\n z-index: 999;\n top: 0px;\n background: hsl(0, 0%, 100%);\n height: 64px;\n }\n\n .menu__items-wrapper {\n overflow: auto;\n max-height: calc(100vh - 64px);\n }\n\n ::slotted(nile-divider) {\n --spacing: 0.5rem;\n }\n`;\n\nexport default [styles];\n"],"names":["styles","css","_templateObject","_taggedTemplateLiteral"],"mappings":"wXAYaA,CAAAA,CAASC,CAAG,CAAAC,eAAA,GAAAA,eAAA,CAAAC,sBAAA"}
1
+ {"version":3,"file":"nile-menu.css.cjs.js","sources":["../../../src/nile-menu/nile-menu.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-element';\n\n/**\n * Menu CSS\n */\nexport const styles = css`\n :host {\n display: block;\n position: relative;\n background: hsl(0, 0%, 100%);\n border: solid 1px hsl(240 5.9% 90%);\n border-radius: 6px;\n overflow: hidden;\n height: 100%;\n box-shadow: 0px 20px 24px -4px rgba(16, 24, 40, 0.08),\n 0px 8px 8px -4px rgba(16, 24, 40, 0.03);\n /* overscroll-behavior: none; */\n /* -ms-overflow-style: none; */\n /* scrollbar-width: none; */\n }\n\n .search__wrapper {\n box-sizing: border-box;\n padding: 12px 6px;\n position: sticky;\n z-index: 999;\n top: 0px;\n background: hsl(0, 0%, 100%);\n height: 64px;\n }\n\n .menu__items-wrapper {\n overflow: auto;\n max-height: calc(100vh - 64px);\n }\n\n ::slotted(nile-divider) {\n --spacing: 0.5rem;\n }\n\n .menu__footer {\n display: flex;\n border-radius: var(--nile-radius-radius-sm);\n align-items: stretch;\n font-size: 1rem;\n font-weight: var(--nile-font-weight-regular);\n line-height: 180%;\n letter-spacing: normal;\n color: var(--nile-colors-primary-600);\n min-height: 40px;\n transition: 150ms fill;\n user-select: none;\n white-space: nowrap;\n cursor: pointer;\n padding: 0 var(--nile-spacing-spacing-xl);\n margin: auto 0;\n }\n\n .menu__footer:hover {\n background-color:var(--nile-menu-item-background-color);\n }\n`;\n\nexport default [styles];\n"],"names":["styles","css","_templateObject","_taggedTemplateLiteral"],"mappings":"wXAYaA,CAAAA,CAASC,CAAG,CAAAC,eAAA,GAAAA,eAAA,CAAAC,sBAAA"}
@@ -1,4 +1,4 @@
1
- import{i as o}from"../index-0a3007c5.esm.js";const e=o`
1
+ import{i as e}from"../index-0a3007c5.esm.js";const r=e`
2
2
  :host {
3
3
  display: block;
4
4
  position: relative;
@@ -32,4 +32,26 @@ import{i as o}from"../index-0a3007c5.esm.js";const e=o`
32
32
  ::slotted(nile-divider) {
33
33
  --spacing: 0.5rem;
34
34
  }
35
- `;export{e as s};
35
+
36
+ .menu__footer {
37
+ display: flex;
38
+ border-radius: var(--nile-radius-radius-sm);
39
+ align-items: stretch;
40
+ font-size: 1rem;
41
+ font-weight: var(--nile-font-weight-regular);
42
+ line-height: 180%;
43
+ letter-spacing: normal;
44
+ color: var(--nile-colors-primary-600);
45
+ min-height: 40px;
46
+ transition: 150ms fill;
47
+ user-select: none;
48
+ white-space: nowrap;
49
+ cursor: pointer;
50
+ padding: 0 var(--nile-spacing-spacing-xl);
51
+ margin: auto 0;
52
+ }
53
+
54
+ .menu__footer:hover {
55
+ background-color:var(--nile-menu-item-background-color);
56
+ }
57
+ `;export{r as s};
@@ -1,8 +1,7 @@
1
- import{__decorate as e}from"tslib";import{html as t}from"lit";import{state as i,property as s,query as n,customElement as r}from"lit/decorators.js";import{N as o}from"../internal/nile-element.esm.js";import{s as l}from"./nile-menu.css.esm.js";import"../index-0a3007c5.esm.js";let h=class extends o{constructor(){super(...arguments),this.searchValue="",this.searchWidth=0,this.searchEnabled=!1,this.customSearch=!1,this.showNoResults=!1,this.noResultsMessage="No results found"}connectedCallback(){super.connectedCallback(),this.setAttribute("role","menu")}handleClick(e){const t=e.target.closest("nile-menu-item");t?.hasSubMenu||t&&!t.disabled&&("checkbox"===t.type&&(t.checked=!t.checked),this.emit("nile-select",{value:t.value}))}handleKeyDown(e){if("Enter"===e.key){const t=this.getCurrentItem();e.preventDefault(),t?.click()}if(" "===e.key&&e.preventDefault(),["ArrowDown","ArrowUp","Home","End"].includes(e.key)){const t=this.getAllItems(),i=this.getCurrentItem();let s=i?t.indexOf(i):0;t.length>0&&(e.preventDefault(),"ArrowDown"===e.key?s++:"ArrowUp"===e.key?s--:"Home"===e.key?s=0:"End"===e.key&&(s=t.length-1),s<0&&(s=t.length-1),s>t.length-1&&(s=0),this.setCurrentItem(t[s]),t[s].focus())}}handleMouseDown(e){const t=e.target;this.isMenuItem(t)&&this.setCurrentItem(t)}handleSlotChange(){const e=this.getAllItems();e.length>0&&this.setCurrentItem(e[0])}isMenuItem(e){return"nile-menu-item"===e.tagName.toLowerCase()||["menuitem","menuitemcheckbox","menuitemradio"].includes(e.getAttribute("role")??"")}getAllItems(){return[...this.defaultSlot.assignedElements({flatten:!0})].filter((e=>!!this.isMenuItem(e)))}getCurrentItem(){return this.getAllItems().find((e=>"0"===e.getAttribute("tabindex")))}setCurrentItem(e){this.getAllItems().forEach((t=>{t.setAttribute("tabindex",t===e?"0":"-1")}))}handleSearchChange(e){let t=this.getAllItems(),i=e.target.value;if(this.customSearch)return void this.emit("nile-search-value",{value:i});let s=0;t.map((t=>{this.searchWidth=Math.max(this.searchWidth,t.offsetWidth),t.innerText.toLowerCase().includes(e.target.value.toLowerCase())?(t.style.display="block",s++):t.style.display="none"})),this.showNoResults=0===s}render(){return t`
1
+ import{__decorate as e}from"tslib";import{html as t}from"lit";import{state as s,property as i,query as n,customElement as o}from"lit/decorators.js";import{N as r}from"../internal/nile-element.esm.js";import{s as l}from"./nile-menu.css.esm.js";import{H as a}from"../internal/slot.esm.js";import"../index-0a3007c5.esm.js";let h=class extends r{constructor(){super(...arguments),this.searchValue="",this.searchWidth=0,this.searchEnabled=!1,this.customSearch=!1,this.showNoResults=!1,this.noResultsMessage="No results found",this.hasSlotController=new a(this,"menu__footer","menu__header")}connectedCallback(){super.connectedCallback(),this.setAttribute("role","menu")}handleClick(e){const t=e.target.closest("nile-menu-item");t?.hasSubMenu||t&&!t.disabled&&("checkbox"===t.type&&(t.checked=!t.checked),this.emit("nile-select",{value:t.value}))}handleKeyDown(e){if("Enter"===e.key){const t=this.getCurrentItem();e.preventDefault(),t?.click()}if(" "===e.key&&e.preventDefault(),["ArrowDown","ArrowUp","Home","End"].includes(e.key)){const t=this.getAllItems(),s=this.getCurrentItem();let i=s?t.indexOf(s):0;t.length>0&&(e.preventDefault(),"ArrowDown"===e.key?i++:"ArrowUp"===e.key?i--:"Home"===e.key?i=0:"End"===e.key&&(i=t.length-1),i<0&&(i=t.length-1),i>t.length-1&&(i=0),this.setCurrentItem(t[i]),t[i].focus())}}handleMouseDown(e){const t=e.target;this.isMenuItem(t)&&this.setCurrentItem(t)}handleSlotChange(){const e=this.getAllItems();e.length>0&&this.setCurrentItem(e[0])}isMenuItem(e){return"nile-menu-item"===e.tagName.toLowerCase()||["menuitem","menuitemcheckbox","menuitemradio"].includes(e.getAttribute("role")??"")}getAllItems(){return[...this.defaultSlot.assignedElements({flatten:!0})].filter((e=>!!this.isMenuItem(e)))}getCurrentItem(){return this.getAllItems().find((e=>"0"===e.getAttribute("tabindex")))}setCurrentItem(e){this.getAllItems().forEach((t=>{t.setAttribute("tabindex",t===e?"0":"-1")}))}handleSearchChange(e){let t=this.getAllItems(),s=e.target.value;if(this.customSearch)return void this.emit("nile-search-value",{value:s});let i=0;t.map((t=>{this.searchWidth=Math.max(this.searchWidth,t.offsetWidth),t.innerText.toLowerCase().includes(e.target.value.toLowerCase())?(t.style.display="block",i++):t.style.display="none"})),this.showNoResults=0===i}render(){return t`
2
2
  ${this.searchEnabled?t`<div class="search__wrapper" part="search__wrapper">
3
3
  <nile-input
4
4
  size="medium"
5
- style=${this.searchWidth?`width: ${this.searchWidth}px;`:"width: 100%;"}
6
5
  .value=${this.searchValue}
7
6
  placeholder="Search..."
8
7
  @nile-input=${this.handleSearchChange}
@@ -27,5 +26,10 @@ import{__decorate as e}from"tslib";import{html as t}from"lit";import{state as i,
27
26
  @keydown=${this.handleKeyDown}
28
27
  @mousedown=${this.handleMouseDown}
29
28
  ></slot>
29
+ ${this.hasSlotController.test("menu__footer")?t` <slot
30
+ part="menu__footer"
31
+ name="menu__footer"
32
+ class="menu__footer"
33
+ ></slot>`:null}
30
34
  </div>
31
- `}};h.styles=l,e([i()],h.prototype,"searchValue",void 0),e([i()],h.prototype,"searchWidth",void 0),e([s({type:Boolean,reflect:!0})],h.prototype,"searchEnabled",void 0),e([s({type:Boolean,reflect:!0})],h.prototype,"customSearch",void 0),e([s({type:Boolean})],h.prototype,"showNoResults",void 0),e([s({type:String})],h.prototype,"noResultsMessage",void 0),e([n("slot:not([name])")],h.prototype,"defaultSlot",void 0),h=e([r("nile-menu")],h);export{h as N};
35
+ `}};h.styles=l,e([s()],h.prototype,"searchValue",void 0),e([s()],h.prototype,"searchWidth",void 0),e([i({type:Boolean,reflect:!0})],h.prototype,"searchEnabled",void 0),e([i({type:Boolean,reflect:!0})],h.prototype,"customSearch",void 0),e([i({type:Boolean})],h.prototype,"showNoResults",void 0),e([i({type:String})],h.prototype,"noResultsMessage",void 0),e([n("slot:not([name])")],h.prototype,"defaultSlot",void 0),h=e([o("nile-menu")],h);export{h as N};