@nanoporetech-digital/components 5.2.1 → 5.3.1

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 (262) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/dist/cjs/{_commonjsHelpers-9f2314fc.js → _commonjsHelpers-29614748.js} +1 -17
  3. package/dist/cjs/_commonjsHelpers-29614748.js.map +1 -0
  4. package/dist/cjs/algoliasearch-lite.esm.browser-992a2eff.js +922 -0
  5. package/dist/cjs/algoliasearch-lite.esm.browser-992a2eff.js.map +1 -0
  6. package/dist/cjs/component-store-21cb4901.js +328 -0
  7. package/dist/cjs/component-store-21cb4901.js.map +1 -0
  8. package/dist/cjs/events-db0a42ee.js +39 -0
  9. package/dist/cjs/events-db0a42ee.js.map +1 -0
  10. package/dist/cjs/loader.cjs.js +1 -1
  11. package/dist/cjs/nano-alert.cjs.entry.js +9 -2
  12. package/dist/cjs/nano-alert.cjs.entry.js.map +1 -1
  13. package/dist/cjs/nano-algolia-filter.cjs.entry.js +1 -2
  14. package/dist/cjs/nano-algolia-filter.cjs.entry.js.map +1 -1
  15. package/dist/cjs/nano-algolia-input.cjs.entry.js +8 -4
  16. package/dist/cjs/nano-algolia-input.cjs.entry.js.map +1 -1
  17. package/dist/cjs/nano-algolia.cjs.entry.js +4 -4
  18. package/dist/cjs/nano-algolia.cjs.entry.js.map +1 -1
  19. package/dist/cjs/nano-components.cjs.js +1 -1
  20. package/dist/cjs/nano-datalist_3.cjs.entry.js +1 -1
  21. package/dist/cjs/nano-dialog.cjs.entry.js +23 -22
  22. package/dist/cjs/nano-dialog.cjs.entry.js.map +1 -1
  23. package/dist/cjs/nano-drawer.cjs.entry.js +169 -111
  24. package/dist/cjs/nano-drawer.cjs.entry.js.map +1 -1
  25. package/dist/cjs/nano-dropdown.cjs.entry.js +16 -2
  26. package/dist/cjs/nano-dropdown.cjs.entry.js.map +1 -1
  27. package/dist/cjs/nano-global-nav.cjs.entry.js +5 -6
  28. package/dist/cjs/nano-global-nav.cjs.entry.js.map +1 -1
  29. package/dist/cjs/nano-global-search-results.cjs.entry.js +2 -1
  30. package/dist/cjs/nano-global-search-results.cjs.entry.js.map +1 -1
  31. package/dist/cjs/nano-slides.cjs.entry.js +1 -1
  32. package/dist/cjs/nano-sortable.cjs.entry.js +3 -15
  33. package/dist/cjs/nano-sortable.cjs.entry.js.map +1 -1
  34. package/dist/cjs/nano-sticker.cjs.entry.js +16 -9
  35. package/dist/cjs/nano-sticker.cjs.entry.js.map +1 -1
  36. package/dist/cjs/nano-tab-group.cjs.entry.js +1 -2
  37. package/dist/cjs/nano-tab-group.cjs.entry.js.map +1 -1
  38. package/dist/cjs/{nano-table-10a40ab3.js → nano-table-3bfe9c30.js} +9 -10
  39. package/dist/cjs/nano-table-3bfe9c30.js.map +1 -0
  40. package/dist/cjs/nano-table.cjs.entry.js +1 -1
  41. package/dist/cjs/{slot-a448c1a7.js → slot-2dd6ed1d.js} +20 -15
  42. package/dist/cjs/slot-2dd6ed1d.js.map +1 -0
  43. package/dist/cjs/{table.worker-f04588c1.js → table.worker-b3818c42.js} +2 -2
  44. package/dist/cjs/table.worker-b3818c42.js.map +1 -0
  45. package/dist/collection/components/alert/alert.css +15 -0
  46. package/dist/collection/components/alert/alert.js +10 -2
  47. package/dist/collection/components/alert/alert.js.map +1 -1
  48. package/dist/collection/components/algolia/algolia-interface.js.map +1 -1
  49. package/dist/collection/components/algolia/algolia.js +1 -1
  50. package/dist/collection/components/algolia/algolia.js.map +1 -1
  51. package/dist/collection/components/dialog/dialog.css +1 -17
  52. package/dist/collection/components/dialog/dialog.js +31 -20
  53. package/dist/collection/components/dialog/dialog.js.map +1 -1
  54. package/dist/collection/components/drawer/drawer.css +136 -67
  55. package/dist/collection/components/drawer/drawer.js +282 -154
  56. package/dist/collection/components/drawer/drawer.js.map +1 -1
  57. package/dist/collection/components/dropdown/dropdown.css +10 -0
  58. package/dist/collection/components/dropdown/dropdown.js +15 -1
  59. package/dist/collection/components/dropdown/dropdown.js.map +1 -1
  60. package/dist/collection/components/global-nav/global-nav.js +2 -2
  61. package/dist/collection/components/global-nav/global-nav.js.map +1 -1
  62. package/dist/collection/components/global-nav/style/global-nav.css +5 -1
  63. package/dist/collection/components/global-search-results/global-search-results.js +2 -1
  64. package/dist/collection/components/global-search-results/global-search-results.js.map +1 -1
  65. package/dist/collection/components/sticker/sticker.js +16 -9
  66. package/dist/collection/components/sticker/sticker.js.map +1 -1
  67. package/dist/collection/components/table/table.css +21 -12
  68. package/dist/collection/components/table/table.js +0 -1
  69. package/dist/collection/components/table/table.js.map +1 -1
  70. package/dist/collection/components/table/table.pin-service.js +6 -6
  71. package/dist/collection/components/table/table.pin-service.js.map +1 -1
  72. package/dist/collection/utils/events.js +17 -0
  73. package/dist/collection/utils/events.js.map +1 -1
  74. package/dist/collection/utils/slot.js +19 -14
  75. package/dist/collection/utils/slot.js.map +1 -1
  76. package/dist/collection/utils/store/get-set.js +6 -12
  77. package/dist/collection/utils/store/get-set.js.map +1 -1
  78. package/dist/components/_commonjsHelpers.js +1 -16
  79. package/dist/components/_commonjsHelpers.js.map +1 -1
  80. package/dist/components/algolia.js +2 -2
  81. package/dist/components/algolia.js.map +1 -1
  82. package/dist/components/algoliasearch-lite.esm.browser.js +920 -0
  83. package/dist/components/algoliasearch-lite.esm.browser.js.map +1 -0
  84. package/dist/components/component-store.js +68 -2001
  85. package/dist/components/component-store.js.map +1 -1
  86. package/dist/components/dropdown.js +16 -2
  87. package/dist/components/dropdown.js.map +1 -1
  88. package/dist/components/events.js +36 -0
  89. package/dist/components/events.js.map +1 -0
  90. package/dist/components/nano-alert.js +10 -2
  91. package/dist/components/nano-alert.js.map +1 -1
  92. package/dist/components/nano-algolia-input.js +6 -1
  93. package/dist/components/nano-algolia-input.js.map +1 -1
  94. package/dist/components/nano-dialog.js +21 -20
  95. package/dist/components/nano-dialog.js.map +1 -1
  96. package/dist/components/nano-drawer.js +205 -122
  97. package/dist/components/nano-drawer.js.map +1 -1
  98. package/dist/components/nano-global-nav.js +4 -4
  99. package/dist/components/nano-global-nav.js.map +1 -1
  100. package/dist/components/nano-global-search-results.js +2 -1
  101. package/dist/components/nano-global-search-results.js.map +1 -1
  102. package/dist/components/nano-sortable.js +1 -13
  103. package/dist/components/nano-sortable.js.map +1 -1
  104. package/dist/components/slot.js +19 -14
  105. package/dist/components/slot.js.map +1 -1
  106. package/dist/components/sticker.js +16 -9
  107. package/dist/components/sticker.js.map +1 -1
  108. package/dist/components/table.js +7 -8
  109. package/dist/components/table.js.map +1 -1
  110. package/dist/esm/{_commonjsHelpers-e401b2a2.js → _commonjsHelpers-04a0e019.js} +2 -17
  111. package/dist/esm/_commonjsHelpers-04a0e019.js.map +1 -0
  112. package/dist/esm/algoliasearch-lite.esm.browser-04891fdc.js +920 -0
  113. package/dist/esm/algoliasearch-lite.esm.browser-04891fdc.js.map +1 -0
  114. package/dist/esm/component-store-65d7e36a.js +326 -0
  115. package/dist/esm/component-store-65d7e36a.js.map +1 -0
  116. package/dist/esm/events-6a805b42.js +36 -0
  117. package/dist/esm/events-6a805b42.js.map +1 -0
  118. package/dist/esm/loader.js +1 -1
  119. package/dist/esm/nano-alert.entry.js +9 -2
  120. package/dist/esm/nano-alert.entry.js.map +1 -1
  121. package/dist/esm/nano-algolia-filter.entry.js +1 -2
  122. package/dist/esm/nano-algolia-filter.entry.js.map +1 -1
  123. package/dist/esm/nano-algolia-input.entry.js +7 -3
  124. package/dist/esm/nano-algolia-input.entry.js.map +1 -1
  125. package/dist/esm/nano-algolia.entry.js +4 -4
  126. package/dist/esm/nano-algolia.entry.js.map +1 -1
  127. package/dist/esm/nano-components.js +1 -1
  128. package/dist/esm/nano-datalist_3.entry.js +1 -1
  129. package/dist/esm/nano-dialog.entry.js +23 -22
  130. package/dist/esm/nano-dialog.entry.js.map +1 -1
  131. package/dist/esm/nano-drawer.entry.js +171 -113
  132. package/dist/esm/nano-drawer.entry.js.map +1 -1
  133. package/dist/esm/nano-dropdown.entry.js +16 -2
  134. package/dist/esm/nano-dropdown.entry.js.map +1 -1
  135. package/dist/esm/nano-global-nav.entry.js +5 -6
  136. package/dist/esm/nano-global-nav.entry.js.map +1 -1
  137. package/dist/esm/nano-global-search-results.entry.js +2 -1
  138. package/dist/esm/nano-global-search-results.entry.js.map +1 -1
  139. package/dist/esm/nano-slides.entry.js +1 -1
  140. package/dist/esm/nano-sortable.entry.js +1 -13
  141. package/dist/esm/nano-sortable.entry.js.map +1 -1
  142. package/dist/esm/nano-sticker.entry.js +16 -9
  143. package/dist/esm/nano-sticker.entry.js.map +1 -1
  144. package/dist/esm/nano-tab-group.entry.js +1 -2
  145. package/dist/esm/nano-tab-group.entry.js.map +1 -1
  146. package/dist/esm/{nano-table-2bbcaa8d.js → nano-table-7fb21169.js} +9 -10
  147. package/dist/esm/nano-table-7fb21169.js.map +1 -0
  148. package/dist/esm/nano-table.entry.js +1 -1
  149. package/dist/esm/{slot-a4f6e2af.js → slot-8126e238.js} +20 -15
  150. package/dist/esm/slot-8126e238.js.map +1 -0
  151. package/dist/esm/{table.worker-7324ad73.js → table.worker-a37fa949.js} +2 -2
  152. package/dist/esm/table.worker-a37fa949.js.map +1 -0
  153. package/dist/nano-components/nano-components.css +1 -1
  154. package/dist/nano-components/nano-components.esm.js +1 -1
  155. package/dist/nano-components/nano-components.esm.js.map +1 -1
  156. package/dist/nano-components/p-00a18187.js +5 -0
  157. package/dist/nano-components/p-00a18187.js.map +1 -0
  158. package/dist/nano-components/p-0301e8f7.entry.js +5 -0
  159. package/dist/nano-components/p-0301e8f7.entry.js.map +1 -0
  160. package/dist/nano-components/p-27422aa9.entry.js +5 -0
  161. package/dist/nano-components/{p-6920ad69.entry.js.map → p-27422aa9.entry.js.map} +1 -1
  162. package/dist/nano-components/{p-0697795a.entry.js → p-31c23d6e.entry.js} +2 -2
  163. package/dist/nano-components/p-31c23d6e.entry.js.map +1 -0
  164. package/dist/nano-components/{p-39aec880.entry.js → p-35d3072e.entry.js} +2 -2
  165. package/dist/nano-components/p-487de04d.entry.js.map +1 -1
  166. package/dist/nano-components/p-570d2e50.entry.js +5 -0
  167. package/dist/nano-components/p-570d2e50.entry.js.map +1 -0
  168. package/dist/nano-components/{p-3eb6d833.entry.js → p-5a4b3fa9.entry.js} +2 -2
  169. package/dist/nano-components/p-653ae985.js +5 -0
  170. package/dist/nano-components/p-653ae985.js.map +1 -0
  171. package/dist/nano-components/p-676a4744.entry.js +5 -0
  172. package/dist/nano-components/{p-d0eefd52.entry.js.map → p-676a4744.entry.js.map} +1 -1
  173. package/dist/nano-components/p-8fe51abf.js +5 -0
  174. package/dist/nano-components/{p-4884b65a.entry.js → p-90cd4f56.entry.js} +2 -2
  175. package/dist/nano-components/p-90cd4f56.entry.js.map +1 -0
  176. package/dist/nano-components/p-9bfdee71.js +5 -0
  177. package/dist/nano-components/p-9bfdee71.js.map +1 -0
  178. package/dist/nano-components/p-a8d6ca38.entry.js +5 -0
  179. package/dist/nano-components/p-a8d6ca38.entry.js.map +1 -0
  180. package/dist/nano-components/p-ace7743c.entry.js +5 -0
  181. package/dist/nano-components/p-ace7743c.entry.js.map +1 -0
  182. package/dist/nano-components/p-bdb5b6fc.entry.js +5 -0
  183. package/dist/nano-components/p-bdb5b6fc.entry.js.map +1 -0
  184. package/dist/nano-components/{p-52ae36ec.js → p-c579d9aa.js} +2 -2
  185. package/dist/nano-components/p-cad86fb8.js +5 -0
  186. package/dist/nano-components/p-cad86fb8.js.map +1 -0
  187. package/dist/nano-components/p-dc565459.js +5 -0
  188. package/dist/nano-components/p-dc565459.js.map +1 -0
  189. package/dist/nano-components/p-ede12d35.entry.js +5 -0
  190. package/dist/nano-components/p-ede12d35.entry.js.map +1 -0
  191. package/dist/nano-components/p-f504b1df.entry.js +7 -0
  192. package/dist/nano-components/p-f504b1df.entry.js.map +1 -0
  193. package/dist/nano-components/{p-db370094.entry.js → p-f7a4c62b.entry.js} +2 -2
  194. package/dist/themes/london-calling.css.map +1 -1
  195. package/dist/themes/nanopore.cn.css.map +1 -1
  196. package/dist/themes/nanopore.css.map +1 -1
  197. package/dist/types/components/alert/alert.d.ts +1 -0
  198. package/dist/types/components/algolia/algolia-interface.d.ts +1 -1
  199. package/dist/types/components/algolia/algolia.d.ts +1 -1
  200. package/dist/types/components/dialog/dialog.d.ts +15 -4
  201. package/dist/types/components/drawer/drawer.d.ts +69 -50
  202. package/dist/types/components/sticker/sticker.d.ts +4 -4
  203. package/dist/types/components.d.ts +50 -28
  204. package/dist/types/types/algolia.d.ts +4 -0
  205. package/dist/types/types/scss.vars.d.ts +4 -0
  206. package/dist/types/utils/events.d.ts +7 -0
  207. package/dist/types/utils/slot.d.ts +3 -3
  208. package/docs-json.json +268 -61
  209. package/docs-vscode.json +28 -11
  210. package/hydrate/index.js +1338 -2240
  211. package/package.json +4 -4
  212. package/dist/cjs/_commonjsHelpers-9f2314fc.js.map +0 -1
  213. package/dist/cjs/algoliasearch.umd-689c1560.js +0 -15
  214. package/dist/cjs/algoliasearch.umd-689c1560.js.map +0 -1
  215. package/dist/cjs/component-store-f1dc1276.js +0 -2261
  216. package/dist/cjs/component-store-f1dc1276.js.map +0 -1
  217. package/dist/cjs/nano-table-10a40ab3.js.map +0 -1
  218. package/dist/cjs/slot-a448c1a7.js.map +0 -1
  219. package/dist/cjs/table.worker-f04588c1.js.map +0 -1
  220. package/dist/components/algoliasearch.umd.js +0 -13
  221. package/dist/components/algoliasearch.umd.js.map +0 -1
  222. package/dist/esm/_commonjsHelpers-e401b2a2.js.map +0 -1
  223. package/dist/esm/algoliasearch.umd-4f7efa84.js +0 -13
  224. package/dist/esm/algoliasearch.umd-4f7efa84.js.map +0 -1
  225. package/dist/esm/component-store-c23ebc9c.js +0 -2259
  226. package/dist/esm/component-store-c23ebc9c.js.map +0 -1
  227. package/dist/esm/nano-table-2bbcaa8d.js.map +0 -1
  228. package/dist/esm/slot-a4f6e2af.js.map +0 -1
  229. package/dist/esm/table.worker-7324ad73.js.map +0 -1
  230. package/dist/nano-components/p-0697795a.entry.js.map +0 -1
  231. package/dist/nano-components/p-17b099cc.entry.js +0 -5
  232. package/dist/nano-components/p-17b099cc.entry.js.map +0 -1
  233. package/dist/nano-components/p-1a0b5bc3.js +0 -5
  234. package/dist/nano-components/p-1a0b5bc3.js.map +0 -1
  235. package/dist/nano-components/p-4884b65a.entry.js.map +0 -1
  236. package/dist/nano-components/p-58cf5446.js +0 -5
  237. package/dist/nano-components/p-58cf5446.js.map +0 -1
  238. package/dist/nano-components/p-6920ad69.entry.js +0 -5
  239. package/dist/nano-components/p-69a3e911.js +0 -5
  240. package/dist/nano-components/p-7baa9e14.entry.js +0 -5
  241. package/dist/nano-components/p-7baa9e14.entry.js.map +0 -1
  242. package/dist/nano-components/p-9b533dc3.js +0 -5
  243. package/dist/nano-components/p-9b533dc3.js.map +0 -1
  244. package/dist/nano-components/p-a362bd23.entry.js +0 -5
  245. package/dist/nano-components/p-a362bd23.entry.js.map +0 -1
  246. package/dist/nano-components/p-b04fd7ca.entry.js +0 -5
  247. package/dist/nano-components/p-b04fd7ca.entry.js.map +0 -1
  248. package/dist/nano-components/p-b72df1aa.entry.js +0 -5
  249. package/dist/nano-components/p-b72df1aa.entry.js.map +0 -1
  250. package/dist/nano-components/p-ce5efc3f.entry.js +0 -5
  251. package/dist/nano-components/p-ce5efc3f.entry.js.map +0 -1
  252. package/dist/nano-components/p-d0eefd52.entry.js +0 -5
  253. package/dist/nano-components/p-e2b2b015.entry.js +0 -5
  254. package/dist/nano-components/p-e2b2b015.entry.js.map +0 -1
  255. package/dist/nano-components/p-ed6adde2.js +0 -7
  256. package/dist/nano-components/p-ed6adde2.js.map +0 -1
  257. package/dist/types/dom.ie.d.ts +0 -3
  258. /package/dist/nano-components/{p-39aec880.entry.js.map → p-35d3072e.entry.js.map} +0 -0
  259. /package/dist/nano-components/{p-3eb6d833.entry.js.map → p-5a4b3fa9.entry.js.map} +0 -0
  260. /package/dist/nano-components/{p-52ae36ec.js.map → p-8fe51abf.js.map} +0 -0
  261. /package/dist/nano-components/{p-69a3e911.js.map → p-c579d9aa.js.map} +0 -0
  262. /package/dist/nano-components/{p-db370094.entry.js.map → p-f7a4c62b.entry.js.map} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"drawer.js","sourceRoot":"","sources":["../../../src/components/drawer/drawer.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,OAAO,EACP,KAAK,EAEL,MAAM,EACN,IAAI,EACJ,KAAK,EACL,KAAK,EACL,CAAC,EACD,IAAI,GACL,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,MAAM,mBAAmB,CAAC;AACtC,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAE5E,IAAI,EAAE,GAAG,CAAC,CAAC;AAEX;;;;;GAKG;AAMH,MAAM,OAAO,MAAM;;IACT,gBAAW,GAAG,UAAU,EAAE,EAAE,EAAE,CAAC;qBAOlB,KAAK;qBACL,KAAK;gBAKqB,KAAK;iBAMpC,EAAE;qBAGsC,KAAK;qBAMzC,KAAK;oBAMN,KAAK;gBAKsB,SAAS;;;EAWvD,gBAAgB;IACd,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;EACxC,CAAC;EAGD,gBAAgB;IACd,IAAI,IAAI,CAAC,IAAI,KAAK,MAAM,IAAI,IAAI,CAAC,IAAI,KAAK,QAAQ;MAAE,OAAO;IAC3D,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE;MACpB,IAAI,CAAC,IAAI,GAAG,SAAS,CAAC;MACtB,OAAO,CAAC,IAAI,CAAC,qCAAqC,CAAC,CAAC;MACpD,OAAO;KACR;EACH,CAAC;EAGD,qBAAqB;IACnB,IAAI,CAAC,IAAI,CAAC,eAAe;MAAE,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC;;MAEhD,IAAI,CAAC,UAAU,GAAI,I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;YAC1C,YACE,IAAI,EAAC,OAAO,EACZ,KAAK,EAAC,eAAe,EACrB,EAAE,EAAE,GAAG,IAAI,CAAC,WAAW,QAAQ;cAE/B,YAAM,IAAI,EAAC,OAAO,IAEf,IAAI,CAAC,KAAK,IAAI,MAAM,CAAC,YAAY,CAAC,KAAK,CAAC,CACpC,CACF,CAEA,CACV;UAED,WAAK,IAAI,EAAC,MAAM,EAAC,KAAK,EAAC,cAAc;YACnC,eAAQ,CACJ;UAEN,cAAQ,IAAI,EAAC,QAAQ,EAAC,KAAK,EAAC,gBAAgB;YAC1C,YAAM,IAAI,EAAC,QAAQ,EAAC,YAAY,EAAE,IAAI,CAAC,gBAAgB,GAAI,CACpD,CACL,CACF,CACD,CACR,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import {\n Component,\n Element,\n Event,\n EventEmitter,\n Method,\n Prop,\n State,\n Watch,\n h,\n Host,\n} from '@stencil/core';\nimport Modal from '../../utils/modal';\nimport { lockBodyScrolling, unlockBodyScrolling } from '../../utils/scroll';\n\nlet id = 0;\n\n/**\n * WIP / TODO. https://git.oxfordnanolabs.local/Digital/nano-components/-/issues/24\n * @slot - The drawer's content.\n * @slot label - The dialog's label. Alternatively, you can use the label prop.\n * @slot footer - The drawer's footer, usually one or more buttons representing various options.\n */\n@Component({\n tag: 'nano-drawer',\n styleUrl: 'drawer.scss',\n shadow: true,\n})\nexport class Drawer {\n private componentId = `drawer-${++id}`;\n private modal: Modal;\n private panel: HTMLElement;\n private contentEle: HTMLElement;\n\n @Element() host: HTMLNanoDrawerElement;\n\n @State() hasFooter = false;\n @State() isVisible = false;\n\n /**\n * Indicates whether or not the drawer is open. You can use this in lieu of the show/hide methods.\n */\n @Prop({ mutable: true, reflect: true }) open = false;\n\n /**\n * The drawer's label as displayed in the header. You should always include a relevant label even when using\n * `no-header`, as it is required for proper accessibility.\n */\n @Prop() label = '';\n\n /** The direction from which the drawer will open. */\n @Prop() placement: 'top' | 'end' | 'bottom' | 'start' = 'end';\n\n /**\n * By default, the drawer slides out of its containing block (usually the viewport). To make the drawer slide out of\n * its parent element, set this prop and add `position: relative` to the parent.\n */\n @Prop() contained = false;\n\n /**\n * Removes the header. This will also remove the default close button, so please ensure you provide an easy,\n * accessible way for users to dismiss the drawer.\n */\n @Prop() noHeader = false;\n\n /**\n * The display type of the drawer\n */\n @Prop() type: 'overlay' | 'reveal' | 'push' = 'overlay';\n\n /**\n * Required for 'reveal' and 'push' types\n * A valid DOM selector of the content element that this drawer will push or reveal underneath\n * Please remember - elements wrapping the content element must be 'overflow: hidden'\n * otherwise menus will be shown when closed\n */\n @Prop() contentSelector: string;\n\n @Watch('open')\n handleOpenChange() {\n this.open ? this.show() : this.hide();\n }\n\n @Watch('type')\n handleTypeChange() {\n if (this.type !== 'push' && this.type !== 'reveal') return;\n if (!this.contentEle) {\n this.type = 'overlay';\n console.warn('a valid contentSelector must be set');\n return;\n }\n }\n\n @Watch('contentSelector')\n handleContentSelector() {\n if (!this.contentSelector) this.contentEle = null;\n else\n this.contentEle = (this.host.ownerDocument as Document).querySelector(\n this.contentSelector\n );\n }\n\n /**\n * Emitted when the drawer opens. Calling `event.preventDefault()` will prevent it from being opened.\n */\n @Event() nanoShow: EventEmitter;\n\n /**\n * Emitted after the drawer opens and all transitions are complete.\n */\n @Event() nanoAfterShow: EventEmitter;\n\n /**\n * Emitted when the drawer closes. Calling `event.preventDefault()` will prevent it from being closed.\n */\n @Event() nanoHide: EventEmitter;\n\n /**\n * Emitted after the drawer closes and all transitions are complete.\n */\n @Event() nanoAfterHide: EventEmitter;\n\n /**\n * Emitted when the overlay is clicked. Calling `event.preventDefault()` will prevent the drawer from closing.\n */\n @Event() nanoOverlayDismiss: EventEmitter;\n\n connectedCallback() {\n this.handleCloseClick = this.handleCloseClick.bind(this);\n this.handleTransitionEnd = this.handleTransitionEnd.bind(this);\n this.handleKeyDown = this.handleKeyDown.bind(this);\n this.handleOverlayClick = this.handleOverlayClick.bind(this);\n this.handleSlotChange = this.handleSlotChange.bind(this);\n\n this.modal = new Modal(this.host);\n }\n\n componentWillLoad() {\n // Show on init if open\n if (this.open) {\n this.show();\n }\n this.handleContentSelector();\n }\n\n disconnectedCallback() {\n unlockBodyScrolling(this.host);\n }\n\n /** Shows the drawer */\n @Method()\n async show() {\n // Prevent subsequent calls to the method, whether manually or triggered by the `open` watcher\n if (this.isVisible) {\n return;\n }\n\n const nanoShow = this.nanoShow.emit();\n if (nanoShow.defaultPrevented) {\n this.open = false;\n return;\n }\n\n this.isVisible = true;\n this.open = true;\n\n // Lock body scrolling only if the drawer isn't contained\n if (!this.contained) {\n this.modal.activate();\n lockBodyScrolling(this.host);\n }\n\n if (!this.contentEle || (this.type !== 'push' && this.type !== 'reveal'))\n return;\n this.contentEle.style.right = '0';\n this.contentEle.style.transition = 'all ease 250ms';\n this.contentEle.style.position = 'relative';\n this.contentEle.style.overflow = 'hidden';\n setTimeout((_) => (this.contentEle.style.right = '25rem'), 0);\n }\n\n /** Hides the drawer */\n @Method()\n async hide() {\n // Prevent subsequent calls to the method, whether manually or triggered by the `open` watcher\n if (!this.isVisible) {\n return;\n }\n\n const nanoHide = this.nanoHide.emit();\n if (nanoHide.defaultPrevented) {\n this.open = true;\n return;\n }\n\n this.open = false;\n this.modal.deactivate();\n\n unlockBodyScrolling(this.host);\n\n if (!this.contentEle) return;\n this.contentEle.style.transition = '';\n this.contentEle.style.position = '';\n this.contentEle.style.overflow = '';\n this.contentEle.style.right = '';\n }\n\n private handleCloseClick() {\n this.hide();\n }\n\n private handleKeyDown(event: KeyboardEvent) {\n if (event.key === 'Escape') {\n this.hide();\n }\n }\n\n private handleOverlayClick() {\n const slOverlayDismiss = this.nanoOverlayDismiss.emit();\n\n if (!slOverlayDismiss.defaultPrevented) {\n this.hide();\n }\n }\n\n private handleSlotChange() {\n this.hasFooter = !!this.host.querySelector('[slot=\"footer\"]');\n }\n\n private handleTransitionEnd(event: TransitionEvent) {\n const target = event.target as HTMLElement;\n\n // Ensure we only emit one event when the target element is no longer visible\n if (\n event.propertyName === 'transform' &&\n target.classList.contains('drawer__panel')\n ) {\n this.isVisible = this.open;\n this.open ? this.nanoAfterShow.emit() : this.nanoAfterHide.emit();\n\n if (this.open) {\n this.panel.focus();\n }\n }\n }\n\n render() {\n const placementClass = 'drawer--' + this.placement;\n const typeClass = 'drawer--' + this.type;\n\n return (\n <Host>\n <div\n part=\"base\"\n class={{\n drawer: true,\n 'drawer--open': this.open,\n 'drawer--visible': this.isVisible,\n [typeClass]: true,\n [placementClass]: true,\n 'drawer--contained': this.contained,\n 'drawer--fixed': !this.contained,\n 'drawer--has-footer': this.hasFooter,\n }}\n onKeyDown={this.handleKeyDown}\n onTransitionEnd={this.handleTransitionEnd}\n >\n <div\n part=\"overlay\"\n class=\"drawer__overlay\"\n onClick={this.handleOverlayClick}\n />\n\n <div\n ref={(el) => (this.panel = el)}\n part=\"panel\"\n class=\"drawer__panel\"\n role=\"dialog\"\n aria-modal=\"true\"\n aria-hidden={this.open ? 'false' : 'true'}\n aria-label={this.noHeader ? this.label : null}\n aria-labelledby={\n !this.noHeader ? `${this.componentId}-title` : null\n }\n tabIndex={0}\n >\n {!this.noHeader && (\n <header part=\"header\" class=\"drawer__header\">\n <span\n part=\"title\"\n class=\"drawer__title\"\n id={`${this.componentId}-title`}\n >\n <slot name=\"label\">\n {/* If there's no label, use an invisible character to prevent the heading from collapsing */}\n {this.label || String.fromCharCode(65279)}\n </slot>\n </span>\n {/* <sl-icon-button part=\"close-button\" class=\"drawer__close\" name=\"x\" onClick={this.handleCloseClick} /> */}\n </header>\n )}\n\n <div part=\"body\" class=\"drawer__body\">\n <slot />\n </div>\n\n <footer part=\"footer\" class=\"drawer__footer\">\n <slot name=\"footer\" onSlotchange={this.handleSlotChange} />\n </footer>\n </div>\n </div>\n </Host>\n );\n }\n}\n"]}
1
+ {"version":3,"file":"drawer.js","sourceRoot":"","sources":["../../../src/components/drawer/drawer.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,OAAO,EACP,KAAK,EAEL,IAAI,EACJ,KAAK,EACL,KAAK,EACL,CAAC,EAED,MAAM,GACP,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,MAAM,mBAAmB,CAAC;AACtC,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAC5E,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EACL,cAAc,GAEf,MAAM,mCAAmC,CAAC;AAE3C;;;;;;;;;;;;;;;;;;GAkBG;AAOH,MAAM,OAAO,MAAM;;IA+NT,0BAAqB,GAAG,CAAC,KAAoB,EAAE,EAAE;MACvD,sEAAsE;MACtE,IAAI,IAAI,CAAC,SAAS,EAAE;QAClB,OAAO;OACR;MAED,IAAI,KAAK,CAAC,GAAG,KAAK,QAAQ,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,IAAI,IAAI,CAAC,IAAI,EAAE;QAChE,KAAK,CAAC,wBAAwB,EAAE,CAAC;QACjC,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC;OAC/B;IACH,CAAC,CAAC;IAEM,wBAAmB,GAAG,CAAC,KAAsB,EAAE,EAAE;MACvD,IACE,KAAK,CAAC,YAAY,KAAK,SAAS;QAChC,KAAK;WACF,YAAY,EAAE;WACd,IAAI,CAAC,CAAC,IAAI,E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C,cAAc;YACnC,eAAQ,CACJ;UAEN,oBAAc,QAAQ,EAAC,QAAQ;YAC7B,cAAQ,IAAI,EAAC,QAAQ,EAAC,KAAK,EAAC,gBAAgB;cAC1C,YAAM,IAAI,EAAC,QAAQ,EAAC,YAAY,EAAE,IAAI,CAAC,gBAAgB,GAAI,CACpD,CACI,CACX,CACF,CACF,CACP,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import {\n Component,\n Element,\n Event,\n EventEmitter,\n Prop,\n State,\n Watch,\n h,\n ComponentInterface,\n Method,\n} from '@stencil/core';\nimport Modal from '../../utils/modal';\nimport { lockBodyScrolling, unlockBodyScrolling } from '../../utils/scroll';\nimport { hasSlot } from '../../utils/slot';\nimport { waitForEvent } from '../../utils/events';\nimport {\n ComponentStore,\n StorageMethods,\n} from '../../utils/store/component-store';\n\n/**\n * Drawers slide in from a container to expose additional options and information.\n *\n * @slot - The drawer's main content\n * @slot label - The drawer's label. Alternatively, you can use the `label` attribute\n * @slot header-actions - Optional actions to add to the header. Works best with `<nano-icon-button>`\n * @slot footer - The drawer's footer, usually one or more buttons representing various options\n *\n * @part base - The component's base wrapper\n * @part overlay - The overlay that covers the screen behind the drawer\n * @part panel - The drawer's panel (where the drawer and its content are rendered)\n * @part header - The drawer's header. This element wraps the title and header actions\n * @part header-actions - Optional actions to add to the header. Works best with `<nano-icon-button>`\n * @part title - The drawer's title\n * @part close-button - The close button, an `<nano-icon-button>`\n * @part close-button__base - The close button's exported `base` part\n * @part body - The drawer's body\n * @part footer - The drawer's footer\n */\n\n@Component({\n tag: 'nano-drawer',\n shadow: true,\n styleUrl: 'drawer.scss',\n})\nexport class Drawer implements ComponentInterface {\n // Private State\n\n @Element() host: HTMLNanoDrawerElement;\n\n private originalTrigger: HTMLElement | null;\n private drawer: HTMLElement;\n private overlay: HTMLElement;\n private modal: Modal;\n\n get panel() {\n return this._panel;\n }\n set panel(ele: HTMLElement) {\n if (this._panel) {\n this.panel.removeEventListener('animationend', this.handleTransitionEnd);\n }\n if (!ele) return;\n\n ele.addEventListener('transitionend', this.handleTransitionEnd);\n this._panel = ele;\n }\n private _panel: HTMLElement;\n\n @State() noDismiss = false;\n @State() hasFooter: boolean;\n\n // Public API\n\n /**\n * Indicates whether or not the drawer is open. You can toggle this attribute to show and hide the drawer, or you can\n * use the `show()` and `hide()` methods and this attribute will reflect the drawer's open state.\n */\n @Prop({ reflect: true }) open = false;\n\n /**\n * The drawer's label as displayed in the header. You should always include a relevant label even when using\n * `no-header`, as it is required for proper accessibility. If you need to display HTML, use the `label` slot instead.\n */\n @Prop({ reflect: true }) label!: string;\n\n /** The direction from which the drawer will open. */\n @Prop({ reflect: true }) placement: 'top' | 'end' | 'bottom' | 'start' =\n 'end';\n\n /**\n * By default, the drawer slides out of its containing block (usually the viewport). To make the drawer slide out of\n * its parent element, set this attribute and add `position: relative` to the parent.\n */\n @Prop({ reflect: true }) contained = false;\n\n /**\n * Removes the header. This will also remove the default close button, so please ensure you provide an easy,\n * accessible way for users to dismiss the drawer.\n */\n @Prop({ reflect: true }) noHeader = false;\n\n /** Store search queries (against this ID) to the component store. Use in conjunction with storeMethod */\n @Prop() storeId?: string;\n\n /** The method of storage. Either session storage, url hash (after the '#') or url query (after the '?'). */\n @Prop() storeMethod: StorageMethods = 'url-hash';\n\n /** An alternative to `preventDefault()` on the `nanoRequestClose` event. This will hide the close button and disable clicks on the overlay or presses the `Escape` key */\n @Prop() noUserDismiss = false;\n\n /** Relocate the dialog to the root of the DOM. Useful for elements bound via css `transform: ...` */\n @Prop() hoist = false;\n\n @Watch('hoist')\n handleHoistChange() {\n if (!this.hoist || Array.from(document.body.children).includes(this.host))\n return;\n document.body.prepend(this.host);\n }\n\n /** Emitted when the drawer opens. */\n @Event() nanoShow: EventEmitter;\n\n /** Emitted when the drawer closes. */\n @Event() nanoHide: EventEmitter;\n\n /** Emitted after the drawer closes and all animations are complete. */\n @Event() nanoAfterHide: EventEmitter;\n\n /** Emitted after the drawer opens and all animations are complete. */\n @Event() nanoAfterShow: EventEmitter;\n\n /**\n * Emitted when the drawer opens and is ready to receive focus. Calling\n * `event.preventDefault()` will prevent focusing and allow you to set it on a different element, such as an input.\n */\n @Event() nanoInitialFocus: EventEmitter;\n\n /**\n * Emitted when the user attempts to\n * close the drawer by clicking the close button, clicking the overlay, or pressing escape. Calling\n * `event.preventDefault()` will keep the drawer open. Avoid using this unless closing the drawer will result in\n * destructive behavior such as data loss.\n */\n @Event() nanoRquestClose: EventEmitter<{\n source: 'close-button' | 'keyboard' | 'overlay';\n }>;\n\n /** Shows the drawer. */\n @Method()\n async show() {\n if (this.open) return undefined;\n\n this.open = true;\n return waitForEvent(this.host, 'nanoAfterShow');\n }\n\n /** Hides the drawer */\n @Method()\n async hide() {\n if (!this.open) return undefined;\n\n this.open = false;\n return waitForEvent(this.host, 'nanoAfterHide');\n }\n\n private requestClose(source: 'close-button' | 'keyboard' | 'overlay') {\n const nanoRequestClose = this.nanoRquestClose.emit({ source });\n\n if (nanoRequestClose.defaultPrevented || this.noUserDismiss) {\n this.noDismiss = true;\n setTimeout(() => (this.noDismiss = false), 250);\n return;\n }\n\n this.hide();\n }\n\n // Prop Change Handlers\n\n @Watch('contained')\n handleNoModalChange() {\n if (this.open && !this.contained) {\n this.modal.activate();\n lockBodyScrolling(this.host);\n }\n\n if (this.open && this.contained) {\n this.modal.deactivate();\n unlockBodyScrolling(this.host);\n }\n }\n\n @Watch('open')\n async handleOpenChange() {\n if (this.open) {\n // Show\n this.nanoShow.emit();\n this.addOpenListeners();\n this.originalTrigger = document.activeElement as HTMLElement;\n\n // Lock body scrolling only if the drawer isn't contained\n if (!this.contained) {\n this.modal.activate();\n lockBodyScrolling(this.host);\n }\n\n // When the drawer is shown, Safari will attempt to set focus on whatever element has autofocus. This causes the\n // drawer's animation to jitter, so we'll temporarily remove the attribute, call `focus({ preventScroll: true })`\n // ourselves, and add the attribute back afterwards.\n const autoFocusTarget = this.host.querySelector('[autofocus]');\n if (autoFocusTarget) {\n autoFocusTarget.removeAttribute('autofocus');\n }\n this.drawer.hidden = false;\n\n // Set initial focus\n requestAnimationFrame(() => {\n const nanoInitialFocus = this.nanoInitialFocus.emit();\n\n if (!nanoInitialFocus.defaultPrevented) {\n // Set focus to the autofocus target and restore the attribute\n if (autoFocusTarget) {\n (autoFocusTarget as HTMLInputElement).focus({\n preventScroll: true,\n });\n } else {\n this.panel.focus({ preventScroll: true });\n }\n }\n\n // Restore the autofocus attribute\n if (autoFocusTarget) {\n autoFocusTarget.setAttribute('autofocus', '');\n }\n });\n\n this.nanoAfterShow.emit();\n return;\n }\n\n // Hide\n this.nanoHide.emit();\n this.removeOpenListeners();\n\n if (!this.contained) {\n this.modal.deactivate();\n unlockBodyScrolling(this.host);\n }\n\n // Restore focus to the original trigger\n const trigger = this.originalTrigger;\n if (typeof trigger?.focus === 'function') {\n setTimeout(() => trigger.focus());\n }\n }\n\n // Event Handling\n\n private addOpenListeners() {\n document.addEventListener('keydown', this.handleDocumentKeyDown);\n }\n\n private removeOpenListeners() {\n document.removeEventListener('keydown', this.handleDocumentKeyDown);\n }\n\n private handleDocumentKeyDown = (event: KeyboardEvent) => {\n // Contained drawers aren't modal and don't response to the escape key\n if (this.contained) {\n return;\n }\n\n if (event.key === 'Escape' && this.modal.isActive() && this.open) {\n event.stopImmediatePropagation();\n this.requestClose('keyboard');\n }\n };\n\n private handleTransitionEnd = (event: TransitionEvent) => {\n if (\n event.propertyName === 'opacity' &&\n event\n .composedPath()\n .find((node) => node === this.panel || node === this.overlay)\n ) {\n if (!this.open) {\n this.drawer.hidden = true;\n // Now that the dialog is hidden, restore the overlay and panel for next time\n this.overlay.hidden = false;\n this.panel.hidden = false;\n }\n this.open ? this.nanoAfterShow.emit() : this.nanoAfterHide.emit();\n }\n };\n\n private handleSlotChange = () => {\n this.hasFooter = hasSlot(this.host, 'footer');\n };\n\n // Component Lifecycle\n\n connectedCallback() {\n this.handleHoistChange();\n this.modal = new Modal(this.host);\n }\n\n disconnectedCallback() {\n unlockBodyScrolling(this.host);\n }\n\n componentWillLoad() {\n this.handleSlotChange();\n // Show on init if open\n if (this.open) this.show();\n if (this.storeId)\n ComponentStore.init(this, ['open'], this.storeMethod, this.storeId);\n }\n\n componentDidLoad() {\n this.drawer.hidden = !this.open;\n\n if (this.open) {\n this.addOpenListeners();\n\n if (!this.contained) {\n this.modal.activate();\n lockBodyScrolling(this.host);\n }\n }\n }\n\n render() {\n return (\n <div\n ref={(ele) => (this.drawer = ele)}\n part=\"base\"\n class={{\n drawer: true,\n 'drawer--open': this.open,\n [`drawer--${this.placement}`]: true,\n 'drawer--contained': this.contained,\n 'drawer--fixed': !this.contained,\n 'drawer--has-footer': hasSlot(this.host, 'footer'),\n 'drawer--has-header': !this.noHeader,\n 'drawer--nodismiss': this.noDismiss,\n }}\n >\n <div\n ref={(ele) => (this.overlay = ele)}\n part=\"overlay\"\n class=\"drawer__overlay\"\n onClick={() => this.requestClose('overlay')}\n tabindex=\"-1\"\n />\n\n <div\n ref={(ele) => (this.panel = ele)}\n part=\"panel\"\n class=\"drawer__panel\"\n role=\"dialog\"\n aria-modal=\"true\"\n aria-hidden={this.open ? 'false' : 'true'}\n aria-label={this.noHeader ? this.label : undefined}\n aria-labelledby={!this.noHeader ? 'title' : undefined}\n tabindex=\"0\"\n >\n <div class=\"drawer__main\">\n {!this.noHeader && (\n <nano-sticker>\n <header part=\"header\" class=\"drawer__header\">\n <h2 part=\"title\" class=\"drawer__title\" id=\"title\">\n {/* If there's no label, use an invisible character to prevent the header from collapsing */}\n <slot name=\"label\">\n {this.label.length > 0\n ? this.label\n : String.fromCharCode(65279)}\n </slot>\n </h2>\n <div part=\"header-actions\" class=\"drawer__header-actions\">\n <slot name=\"header-actions\" />\n\n {!this.noUserDismiss && (\n <nano-icon-button\n part=\"close-button\"\n exportparts=\"base:close-button__base\"\n class=\"drawer__close\"\n iconName=\"light/times\"\n label=\"Close\"\n onClick={() => this.requestClose('close-button')}\n />\n )}\n </div>\n </header>\n </nano-sticker>\n )}\n\n <div part=\"body\" class=\"drawer__body\">\n <slot />\n </div>\n\n <nano-sticker position=\"bottom\">\n <footer part=\"footer\" class=\"drawer__footer\">\n <slot name=\"footer\" onSlotchange={this.handleSlotChange} />\n </footer>\n </nano-sticker>\n </div>\n </div>\n </div>\n );\n }\n}\n"]}
@@ -46,6 +46,16 @@
46
46
  position: absolute;
47
47
  z-index: var(--dropdown-z-index);
48
48
  min-inline-size: var(--min-width);
49
+ border: 0;
50
+ background: none;
51
+ padding: 0;
52
+ overflow: visible;
53
+ }
54
+ .dropdown__positioner::backdrop {
55
+ display: none;
56
+ }
57
+ .dropdown__positioner[popover], .dropdown__positioner:popover-open {
58
+ inset: unset;
49
59
  }
50
60
  @media (max-width: 35.9375em) {
51
61
  .dropdown__positioner {
@@ -105,6 +105,7 @@ export class Dropdown {
105
105
  // Methods
106
106
  /** Shows the dropdown panel */
107
107
  async show() {
108
+ var _a;
108
109
  this.ignoreOpenWatcher = true;
109
110
  this.open = true;
110
111
  const nanoShow = this.nanoShow.emit();
@@ -114,12 +115,18 @@ export class Dropdown {
114
115
  return;
115
116
  }
116
117
  this.popover.show();
118
+ // @ts-expect-error
119
+ if (typeof ((_a = this.positioner) === null || _a === void 0 ? void 0 : _a.showPopover) === 'function') {
120
+ // @ts-expect-error
121
+ this.positioner.showPopover();
122
+ }
117
123
  this.ignoreOpenWatcher = false;
118
124
  document.addEventListener('mousedown', this.handleDocumentMouseDown);
119
125
  document.addEventListener('keydown', this.handleDocumentKeyDown);
120
126
  }
121
127
  /** Hides the dropdown panel */
122
128
  async hide() {
129
+ var _a;
123
130
  this.ignoreOpenWatcher = true;
124
131
  this.open = false;
125
132
  const nanoHide = this.nanoHide.emit();
@@ -131,6 +138,11 @@ export class Dropdown {
131
138
  if (this.popover)
132
139
  this.popover.hide();
133
140
  this.ignoreOpenWatcher = false;
141
+ // @ts-expect-error
142
+ if (typeof ((_a = this.positioner) === null || _a === void 0 ? void 0 : _a.hidePopover) === 'function') {
143
+ // @ts-expect-error
144
+ this.positioner.hidePopover();
145
+ }
134
146
  document.removeEventListener('mousedown', this.handleDocumentMouseDown);
135
147
  document.removeEventListener('keydown', this.handleDocumentKeyDown);
136
148
  if (this.accessibleTrigger && this.focusEleInDropDwn()) {
@@ -270,7 +282,9 @@ export class Dropdown {
270
282
  return (h("div", { part: "base", id: this.dropdownId, class: {
271
283
  dropdown: true,
272
284
  'dropdown--open': this.open,
273
- } }, h("span", { part: "trigger", class: "dropdown__trigger", ref: (el) => (this.trigger = el), onKeyDown: this.handleTriggerKeyDown, onClick: this.togglePanel }, h("slot", { name: "trigger", onSlotchange: this.handleTriggerSlotChange })), h("div", { ref: (el) => (this.positioner = el), class: "dropdown__positioner" }, h("div", { ref: (el) => (this.panel = el), part: "panel", class: `dropdown__panel ${this.placement.split('-').join(' ')}`, "aria-hidden": !this.open, role: this.host.getAttribute('role') === 'group' ? 'group' : 'dialog', "aria-modal": this.host.getAttribute('role') === 'group' ? undefined : 'true', "aria-labelledby": this.dialogTitle ? this.labelId : undefined }, this.dialogTitle && (h("span", { id: this.labelId, class: "dropdown__accessible-title", "aria-live": this.host.getAttribute('role') === 'group'
285
+ } }, h("span", { part: "trigger", class: "dropdown__trigger", ref: (el) => (this.trigger = el), onKeyDown: this.handleTriggerKeyDown, onClick: this.togglePanel }, h("slot", { name: "trigger", onSlotchange: this.handleTriggerSlotChange })), h("div", { ref: (el) => (this.positioner = el), class: "dropdown__positioner",
286
+ // @ts-ignore
287
+ popover: "manual", id: this.dropdownId + '-positioner' }, h("div", { ref: (el) => (this.panel = el), part: "panel", class: `dropdown__panel ${this.placement.split('-').join(' ')}`, "aria-hidden": !this.open, role: this.host.getAttribute('role') === 'group' ? 'group' : 'dialog', "aria-modal": this.host.getAttribute('role') === 'group' ? undefined : 'true', "aria-labelledby": this.dialogTitle ? this.labelId : undefined }, this.dialogTitle && (h("span", { id: this.labelId, class: "dropdown__accessible-title", "aria-live": this.host.getAttribute('role') === 'group'
274
288
  ? undefined
275
289
  : 'polite' }, this.dialogTitle)), h("slot", null)))));
276
290
  }
@@ -1 +1 @@
1
- {"version":3,"file":"dropdown.js","sourceRoot":"","sources":["../../../src/components/dropdown/dropdown.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,OAAO,EACP,KAAK,EACL,MAAM,EACN,IAAI,EACJ,KAAK,EACL,CAAC,EACD,MAAM,GAGP,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,OAA6B,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC;AAGjE,IAAI,WAAW,GAAG,CAAC,CAAC;AAEpB;;;;;GAKG;AAMH,MAAM,OAAO,QAAQ;;IACX,eAAU,GAAG,YAAY,WAAW,EAAE,EAAE,CAAC;IACzC,YAAO,GAAG,IAAI,CAAC,UAAU,GAAG,QAAQ,CAAC;IACrC,sBAAiB,GAAG,KAAK,CAAC;IAM1B,YAAO,GAAG,KAAK,CAAC;IAuOhB,gBAAW,GAAG,GAAG,EAAE;MACzB,IAAI,CAAC,IAAI,CAAC,QAAQ;QAAE,OAAO;MAC3B,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,C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,EAAE,IAAI,CAAC,OAAO,EAChB,KAAK,EAAC,4BAA4B,eAEhC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,KAAK,OAAO;cACxC,CAAC,CAAC,SAAS;cACX,CAAC,CAAC,QAAQ,IAGb,IAAI,CAAC,WAAW,CACZ,CACR;UACD,eAAQ,CACJ,CACF,CACF,CACP,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import {\n Component,\n Element,\n Event,\n Method,\n Prop,\n Watch,\n h,\n Listen,\n ComponentInterface,\n EventEmitter,\n} from '@stencil/core';\nimport { getActiveElement } from '../../utils/active-element';\nimport Popover, { PopoverPlacement } from '../../utils/popover';\nimport { getNearestTabbableElement } from '../../utils/tabbable';\nimport type { NavItemEventDetail } from '../../interface';\n\nlet dropDownIds = 0;\n\n/**\n * Dropdowns show additional content in a panel.\n * Designed to work well with nano-menu components to provide a list of options (`nano-nav-items` / `nano-option`).\n * @slot trigger - The dropdown's trigger.\n * @slot - The dropdown's content.\n */\n@Component({\n tag: 'nano-dropdown',\n styleUrl: 'dropdown.scss',\n shadow: true,\n})\nexport class Dropdown implements ComponentInterface {\n private dropdownId = `dropdown-${dropDownIds++}`;\n private labelId = this.dropdownId + '-title';\n private ignoreOpenWatcher = false;\n private panel: HTMLElement;\n private popover: Popover;\n private trigger: HTMLElement;\n private positioner: HTMLElement;\n private accessibleTrigger: HTMLElement;\n private didLoad = false;\n private get menu() {\n return this.host.querySelector('nano-menu') as HTMLNanoMenuElement;\n }\n\n @Element() host: HTMLNanoDropdownElement;\n\n /** Determines if the dropdown should open automatically when the trigger is clicked */\n @Prop() autoOpen = true;\n\n /** Indicates whether or not the dropdown is open. You can use this in lieu of the show/hide methods. */\n @Prop({ mutable: true, reflect: true }) open = false;\n\n @Watch('open')\n handleOpenChange() {\n if (this.ignoreOpenWatcher) return;\n\n this.open ? this.show() : this.hide();\n\n if (this.accessibleTrigger) {\n this.accessibleTrigger.setAttribute(\n 'aria-expanded',\n this.open.toString()\n );\n return;\n }\n\n this.updateAccessibleTrigger();\n }\n\n /**\n * Determines whether the dropdown should hide when a menu item is selected.\n */\n @Prop() closeOnSelect = true;\n\n /**\n * The dropdown will close when the user interacts outside of this element (e.g. clicking).\n */\n @Prop({ mutable: true }) containingElement: HTMLElement;\n\n /**\n * If you don't want to use the trigger slot, you can use this to 'tether' the dropdown to another element.\n * And you will still need to control when the component is opened (using show() / hide() or the `open` prop)\n */\n @Prop() tetherTo: HTMLElement = null;\n\n @Watch('tetherTo')\n handleTetherToChange() {\n this.createPopover();\n this.updateAccessibleTrigger();\n }\n\n /**\n * The preferred placement of the dropdown panel. Note that the actual placement may vary as needed to keep the panel\n * inside of the viewport.\n */\n @Prop() placement: PopoverPlacement = 'bottom-start';\n\n /**\n * The distance in pixels from which to offset the panel away from its trigger.\n */\n @Prop() distance = 2;\n\n /**\n * The distance in pixels from which to offset the panel along its trigger.\n */\n @Prop() skidding = 0;\n\n /**\n * Enable this option to prevent the panel from being clipped when the component is placed inside a container with\n * `overflow: auto|scroll`.\n */\n @Prop() hoist = false;\n\n @Watch('placement')\n @Watch('distance')\n @Watch('skidding')\n @Watch('hoist')\n handlePopoverOptionsChange() {\n if (!this.popover) return;\n\n this.popover.setOptions({\n strategy: this.hoist ? 'fixed' : 'absolute',\n placement: this.placement,\n skidding: this.skidding,\n distance: this.distance,\n });\n }\n\n /**\n * Title used to describe the dropdown content for accessibility\n */\n @Prop() dialogTitle!: string;\n\n // Events\n\n /**\n * Emitted when the dropdown opens. Calling `event.preventDefault()` will prevent it from being opened.\n */\n @Event() nanoShow: EventEmitter;\n\n /**\n * Emitted after the dropdown opens and all transitions are complete.\n */\n @Event() nanoAfterShow: EventEmitter;\n\n /**\n * Emitted when the dropdown closes. Calling `event.preventDefault()` will prevent it from being closed.\n */\n @Event() nanoHide: EventEmitter;\n\n /**\n * Emitted after the dropdown closes and all transitions are complete.\n */\n @Event() nanoAfterHide: EventEmitter;\n\n // this is a massive hack to make stencil expose the `EventEmitter` type in the final build\n // because the `Dropdown` class is used as a type in `nano-datalist`\n /** @internal */\n @Prop() eventType: EventEmitter;\n\n // Listeners\n\n @Listen('nanoOpen')\n secondaryOpen(ev: CustomEvent) {\n if (!(ev.detail as NavItemEventDetail).secondaryMenu) return;\n ev.stopPropagation();\n\n this.panel.classList.add('loading');\n this.panel.addEventListener(\n 'transitionend',\n () => {\n this.panel.classList.remove('loading');\n },\n { once: true }\n );\n\n this.panel.style.minHeight =\n (ev.detail as NavItemEventDetail).secondaryMenu.scrollHeight + 'px';\n }\n\n @Listen('nanoClose')\n secondaryClose(ev: CustomEvent) {\n if (!(ev.detail as NavItemEventDetail).secondaryMenu) return;\n ev.stopPropagation();\n if (!(ev.target as HTMLElement).parentElement) return;\n this.panel.style.minHeight =\n (ev.target as HTMLElement).parentElement.scrollHeight + 'px';\n }\n\n @Listen('nanoSelect')\n handlePanelSelect(event: CustomEvent) {\n const target = event.target as HTMLElement;\n\n // Hide the dropdown when a menu item is selected\n if (this.closeOnSelect && target.tagName.toLowerCase() === 'nano-menu')\n this.hide();\n }\n\n // Methods\n\n /** Shows the dropdown panel */\n @Method()\n async show() {\n this.ignoreOpenWatcher = true;\n this.open = true;\n\n const nanoShow = this.nanoShow.emit();\n\n if (nanoShow.defaultPrevented) {\n this.open = false;\n this.ignoreOpenWatcher = false;\n return;\n }\n\n this.popover.show();\n this.ignoreOpenWatcher = false;\n\n document.addEventListener('mousedown', this.handleDocumentMouseDown);\n document.addEventListener('keydown', this.handleDocumentKeyDown);\n }\n\n /** Hides the dropdown panel */\n @Method()\n async hide() {\n this.ignoreOpenWatcher = true;\n this.open = false;\n\n const nanoHide = this.nanoHide.emit();\n\n if (nanoHide.defaultPrevented) {\n this.open = true;\n this.ignoreOpenWatcher = false;\n return;\n }\n\n if (this.popover) this.popover.hide();\n this.ignoreOpenWatcher = false;\n\n document.removeEventListener('mousedown', this.handleDocumentMouseDown);\n document.removeEventListener('keydown', this.handleDocumentKeyDown);\n\n if (this.accessibleTrigger && this.focusEleInDropDwn()) {\n this.accessibleTrigger.focus();\n }\n }\n\n // Private methods\n\n /**\n * Decides if the current active element or element\n * connected to the current event is connected to the Dropdown\n * @param e\n * @returns whether the current focus is within the dropdown\n */\n private focusEleInDropDwn(e?: Event) {\n const activeElement = getActiveElement();\n\n if (e && e.composedPath()?.length) {\n const ddInPath = e.composedPath().includes(this.containingElement);\n return !e.composedPath().includes(this.accessibleTrigger) && ddInPath;\n }\n\n return (\n activeElement &&\n activeElement.closest(this.containingElement.tagName.toLowerCase()) ===\n this.containingElement &&\n activeElement !== this.accessibleTrigger\n );\n }\n\n private togglePanel = () => {\n if (!this.autoOpen) return;\n this.open ? this.hide() : this.show();\n };\n\n // Slotted triggers can be arbitrary content, but we need to link them to the dropdown panel with `aria-haspopup` and\n // `aria-expanded`. These must be applied to the \"accessible trigger\" (the tabbable portion of the trigger element\n // that gets slotted in) so screen readers will understand them. The accessible trigger could be the slotted element,\n private updateAccessibleTrigger() {\n if (!this.didLoad) return;\n\n let accessibleTrigger: HTMLElement;\n this.accessibleTrigger = null;\n\n if (!this.tetherTo) {\n const assignedElements = Array.from(\n this.host.querySelectorAll('[slot=\"trigger\"]')\n );\n accessibleTrigger = assignedElements.map(getNearestTabbableElement)[0];\n } else {\n accessibleTrigger = getNearestTabbableElement(this.tetherTo);\n }\n\n if (accessibleTrigger) {\n accessibleTrigger.setAttribute('aria-haspopup', 'true');\n accessibleTrigger.setAttribute(\n 'aria-expanded',\n this.open ? 'true' : 'false'\n );\n this.accessibleTrigger = accessibleTrigger;\n }\n }\n\n // Handlers\n\n private handleDocumentKeyDown(event: KeyboardEvent) {\n // Close when escape is pressed\n if (event.key === 'Escape') {\n this.hide();\n return;\n }\n\n // Close when tabbing results in the focus leaving the close element\n if (event.key === 'Tab') {\n setTimeout(() => {\n if (\n document.activeElement &&\n document.activeElement.closest(\n this.containingElement.tagName.toLowerCase()\n ) !== this.containingElement\n ) {\n this.hide();\n return;\n }\n });\n }\n\n // If a menu is present, focus on it when certain keys are pressed\n if (this.menu && ['ArrowDown', 'ArrowUp'].includes(event.key)) {\n // must have menu item, must have pressed down, must be open and must not have focus within dd\n if (!this.open || this.focusEleInDropDwn(event)) return;\n event.preventDefault();\n this.menu.setFocus();\n return;\n }\n\n // All other keys focus the menu and pass the event through to menu (necessary for type-to-search to work)\n const ePath = event.composedPath();\n if (this.menu && ePath.length && !ePath.find((el) => el !== this.menu)) {\n this.menu.dispatchEvent(new KeyboardEvent(event.type, event));\n return;\n }\n }\n\n private handleDocumentMouseDown(event: MouseEvent) {\n // Close when clicking outside of the close element\n\n if (!this.focusEleInDropDwn(event)) {\n this.hide();\n return;\n }\n }\n\n private handleTriggerKeyDown = (event: KeyboardEvent) => {\n // Open the panel when pressing down or up while focused on the trigger\n if (['ArrowDown', 'ArrowUp', ' '].includes(event.key)) {\n this.show();\n event.preventDefault();\n event.stopPropagation();\n\n if (this.menu) this.menu.setFocus();\n }\n };\n\n private handleTriggerSlotChange = () => {\n this.updateAccessibleTrigger();\n };\n\n private createPopover() {\n if ((!this.tetherTo && !this.trigger) || !this.positioner) return;\n\n if (this.popover) {\n if (this.open) this.hide();\n this.popover.destroy();\n this.popover = null;\n }\n\n this.popover = new Popover(this.tetherTo || this.trigger, this.positioner, {\n strategy: this.hoist ? 'fixed' : 'absolute',\n placement: this.placement,\n distance: this.distance,\n skidding: this.skidding,\n transitionElement: this.panel,\n onAfterHide: () => this.nanoAfterHide.emit(),\n onAfterShow: () => this.nanoAfterShow.emit(),\n onTransitionEnd: () => {\n if (!this.open) {\n this.panel.scrollTop = 0;\n } else if (this.menu) {\n this.menu.showActiveElement();\n }\n },\n });\n // Show on init if open\n if (this.open) {\n this.show();\n }\n }\n\n // Stencil hooks\n\n connectedCallback() {\n this.handleDocumentKeyDown = this.handleDocumentKeyDown.bind(this);\n this.handleDocumentMouseDown = this.handleDocumentMouseDown.bind(this);\n\n if (!this.containingElement) this.containingElement = this.host;\n }\n\n componentDidLoad() {\n this.didLoad = true;\n this.createPopover();\n setTimeout(() => this.updateAccessibleTrigger(), 100);\n }\n\n disconnectedCallback() {\n if (this.host.isConnected) this.hide();\n if (this.popover) this.popover.destroy();\n }\n\n render() {\n return (\n <div\n part=\"base\"\n id={this.dropdownId}\n class={{\n dropdown: true,\n 'dropdown--open': this.open,\n }}\n >\n <span\n part=\"trigger\"\n class=\"dropdown__trigger\"\n ref={(el) => (this.trigger = el)}\n onKeyDown={this.handleTriggerKeyDown}\n onClick={this.togglePanel}\n >\n <slot name=\"trigger\" onSlotchange={this.handleTriggerSlotChange} />\n </span>\n\n <div ref={(el) => (this.positioner = el)} class=\"dropdown__positioner\">\n <div\n ref={(el) => (this.panel = el)}\n part=\"panel\"\n class={`dropdown__panel ${this.placement.split('-').join(' ')}`}\n aria-hidden={!this.open}\n role={\n this.host.getAttribute('role') === 'group' ? 'group' : 'dialog'\n }\n aria-modal={\n this.host.getAttribute('role') === 'group' ? undefined : 'true'\n }\n aria-labelledby={this.dialogTitle ? this.labelId : undefined}\n >\n {this.dialogTitle && (\n <span\n id={this.labelId}\n class=\"dropdown__accessible-title\"\n aria-live={\n this.host.getAttribute('role') === 'group'\n ? undefined\n : 'polite'\n }\n >\n {this.dialogTitle}\n </span>\n )}\n <slot />\n </div>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EAAE,IAAI,CAAC,OAAO,EAChB,KAAK,EAAC,4BAA4B,eAEhC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,KAAK,OAAO;cACxC,CAAC,CAAC,SAAS;cACX,CAAC,CAAC,QAAQ,IAGb,IAAI,CAAC,WAAW,CACZ,CACR;UACD,eAAQ,CACJ,CACF,CACF,CACP,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import {\n Component,\n Element,\n Event,\n Method,\n Prop,\n Watch,\n h,\n Listen,\n ComponentInterface,\n EventEmitter,\n} from '@stencil/core';\nimport { getActiveElement } from '../../utils/active-element';\nimport Popover, { PopoverPlacement } from '../../utils/popover';\nimport { getNearestTabbableElement } from '../../utils/tabbable';\nimport type { NavItemEventDetail } from '../../interface';\n\nlet dropDownIds = 0;\n\n/**\n * Dropdowns show additional content in a panel.\n * Designed to work well with nano-menu components to provide a list of options (`nano-nav-items` / `nano-option`).\n * @slot trigger - The dropdown's trigger.\n * @slot - The dropdown's content.\n */\n@Component({\n tag: 'nano-dropdown',\n styleUrl: 'dropdown.scss',\n shadow: true,\n})\nexport class Dropdown implements ComponentInterface {\n private dropdownId = `dropdown-${dropDownIds++}`;\n private labelId = this.dropdownId + '-title';\n private ignoreOpenWatcher = false;\n private panel: HTMLElement;\n private popover: Popover;\n private trigger: HTMLElement;\n private positioner: HTMLElement;\n private accessibleTrigger: HTMLElement;\n private didLoad = false;\n private get menu() {\n return this.host.querySelector('nano-menu') as HTMLNanoMenuElement;\n }\n\n @Element() host: HTMLNanoDropdownElement;\n\n /** Determines if the dropdown should open automatically when the trigger is clicked */\n @Prop() autoOpen = true;\n\n /** Indicates whether or not the dropdown is open. You can use this in lieu of the show/hide methods. */\n @Prop({ mutable: true, reflect: true }) open = false;\n\n @Watch('open')\n handleOpenChange() {\n if (this.ignoreOpenWatcher) return;\n\n this.open ? this.show() : this.hide();\n\n if (this.accessibleTrigger) {\n this.accessibleTrigger.setAttribute(\n 'aria-expanded',\n this.open.toString()\n );\n return;\n }\n\n this.updateAccessibleTrigger();\n }\n\n /**\n * Determines whether the dropdown should hide when a menu item is selected.\n */\n @Prop() closeOnSelect = true;\n\n /**\n * The dropdown will close when the user interacts outside of this element (e.g. clicking).\n */\n @Prop({ mutable: true }) containingElement: HTMLElement;\n\n /**\n * If you don't want to use the trigger slot, you can use this to 'tether' the dropdown to another element.\n * And you will still need to control when the component is opened (using show() / hide() or the `open` prop)\n */\n @Prop() tetherTo: HTMLElement = null;\n\n @Watch('tetherTo')\n handleTetherToChange() {\n this.createPopover();\n this.updateAccessibleTrigger();\n }\n\n /**\n * The preferred placement of the dropdown panel. Note that the actual placement may vary as needed to keep the panel\n * inside of the viewport.\n */\n @Prop() placement: PopoverPlacement = 'bottom-start';\n\n /**\n * The distance in pixels from which to offset the panel away from its trigger.\n */\n @Prop() distance = 2;\n\n /**\n * The distance in pixels from which to offset the panel along its trigger.\n */\n @Prop() skidding = 0;\n\n /**\n * Enable this option to prevent the panel from being clipped when the component is placed inside a container with\n * `overflow: auto|scroll`.\n */\n @Prop() hoist = false;\n\n @Watch('placement')\n @Watch('distance')\n @Watch('skidding')\n @Watch('hoist')\n handlePopoverOptionsChange() {\n if (!this.popover) return;\n\n this.popover.setOptions({\n strategy: this.hoist ? 'fixed' : 'absolute',\n placement: this.placement,\n skidding: this.skidding,\n distance: this.distance,\n });\n }\n\n /**\n * Title used to describe the dropdown content for accessibility\n */\n @Prop() dialogTitle!: string;\n\n // Events\n\n /**\n * Emitted when the dropdown opens. Calling `event.preventDefault()` will prevent it from being opened.\n */\n @Event() nanoShow: EventEmitter;\n\n /**\n * Emitted after the dropdown opens and all transitions are complete.\n */\n @Event() nanoAfterShow: EventEmitter;\n\n /**\n * Emitted when the dropdown closes. Calling `event.preventDefault()` will prevent it from being closed.\n */\n @Event() nanoHide: EventEmitter;\n\n /**\n * Emitted after the dropdown closes and all transitions are complete.\n */\n @Event() nanoAfterHide: EventEmitter;\n\n // this is a massive hack to make stencil expose the `EventEmitter` type in the final build\n // because the `Dropdown` class is used as a type in `nano-datalist`\n /** @internal */\n @Prop() eventType: EventEmitter;\n\n // Listeners\n\n @Listen('nanoOpen')\n secondaryOpen(ev: CustomEvent) {\n if (!(ev.detail as NavItemEventDetail).secondaryMenu) return;\n ev.stopPropagation();\n\n this.panel.classList.add('loading');\n this.panel.addEventListener(\n 'transitionend',\n () => {\n this.panel.classList.remove('loading');\n },\n { once: true }\n );\n\n this.panel.style.minHeight =\n (ev.detail as NavItemEventDetail).secondaryMenu.scrollHeight + 'px';\n }\n\n @Listen('nanoClose')\n secondaryClose(ev: CustomEvent) {\n if (!(ev.detail as NavItemEventDetail).secondaryMenu) return;\n ev.stopPropagation();\n if (!(ev.target as HTMLElement).parentElement) return;\n this.panel.style.minHeight =\n (ev.target as HTMLElement).parentElement.scrollHeight + 'px';\n }\n\n @Listen('nanoSelect')\n handlePanelSelect(event: CustomEvent) {\n const target = event.target as HTMLElement;\n\n // Hide the dropdown when a menu item is selected\n if (this.closeOnSelect && target.tagName.toLowerCase() === 'nano-menu')\n this.hide();\n }\n\n // Methods\n\n /** Shows the dropdown panel */\n @Method()\n async show() {\n this.ignoreOpenWatcher = true;\n this.open = true;\n\n const nanoShow = this.nanoShow.emit();\n\n if (nanoShow.defaultPrevented) {\n this.open = false;\n this.ignoreOpenWatcher = false;\n return;\n }\n\n this.popover.show();\n\n // @ts-expect-error\n if (typeof this.positioner?.showPopover === 'function') {\n // @ts-expect-error\n this.positioner.showPopover();\n }\n\n this.ignoreOpenWatcher = false;\n document.addEventListener('mousedown', this.handleDocumentMouseDown);\n document.addEventListener('keydown', this.handleDocumentKeyDown);\n }\n\n /** Hides the dropdown panel */\n @Method()\n async hide() {\n this.ignoreOpenWatcher = true;\n this.open = false;\n\n const nanoHide = this.nanoHide.emit();\n\n if (nanoHide.defaultPrevented) {\n this.open = true;\n this.ignoreOpenWatcher = false;\n return;\n }\n\n if (this.popover) this.popover.hide();\n this.ignoreOpenWatcher = false;\n\n // @ts-expect-error\n if (typeof this.positioner?.hidePopover === 'function') {\n // @ts-expect-error\n this.positioner.hidePopover();\n }\n\n document.removeEventListener('mousedown', this.handleDocumentMouseDown);\n document.removeEventListener('keydown', this.handleDocumentKeyDown);\n\n if (this.accessibleTrigger && this.focusEleInDropDwn()) {\n this.accessibleTrigger.focus();\n }\n }\n\n // Private methods\n\n /**\n * Decides if the current active element or element\n * connected to the current event is connected to the Dropdown\n * @param e\n * @returns whether the current focus is within the dropdown\n */\n private focusEleInDropDwn(e?: Event) {\n const activeElement = getActiveElement();\n\n if (e && e.composedPath()?.length) {\n const ddInPath = e.composedPath().includes(this.containingElement);\n return !e.composedPath().includes(this.accessibleTrigger) && ddInPath;\n }\n\n return (\n activeElement &&\n activeElement.closest(this.containingElement.tagName.toLowerCase()) ===\n this.containingElement &&\n activeElement !== this.accessibleTrigger\n );\n }\n\n private togglePanel = () => {\n if (!this.autoOpen) return;\n this.open ? this.hide() : this.show();\n };\n\n // Slotted triggers can be arbitrary content, but we need to link them to the dropdown panel with `aria-haspopup` and\n // `aria-expanded`. These must be applied to the \"accessible trigger\" (the tabbable portion of the trigger element\n // that gets slotted in) so screen readers will understand them. The accessible trigger could be the slotted element,\n private updateAccessibleTrigger() {\n if (!this.didLoad) return;\n\n let accessibleTrigger: HTMLElement;\n this.accessibleTrigger = null;\n\n if (!this.tetherTo) {\n const assignedElements = Array.from(\n this.host.querySelectorAll('[slot=\"trigger\"]')\n );\n accessibleTrigger = assignedElements.map(getNearestTabbableElement)[0];\n } else {\n accessibleTrigger = getNearestTabbableElement(this.tetherTo);\n }\n\n if (accessibleTrigger) {\n accessibleTrigger.setAttribute('aria-haspopup', 'true');\n accessibleTrigger.setAttribute(\n 'aria-expanded',\n this.open ? 'true' : 'false'\n );\n this.accessibleTrigger = accessibleTrigger;\n }\n }\n\n // Handlers\n\n private handleDocumentKeyDown(event: KeyboardEvent) {\n // Close when escape is pressed\n if (event.key === 'Escape') {\n this.hide();\n return;\n }\n\n // Close when tabbing results in the focus leaving the close element\n if (event.key === 'Tab') {\n setTimeout(() => {\n if (\n document.activeElement &&\n document.activeElement.closest(\n this.containingElement.tagName.toLowerCase()\n ) !== this.containingElement\n ) {\n this.hide();\n return;\n }\n });\n }\n\n // If a menu is present, focus on it when certain keys are pressed\n if (this.menu && ['ArrowDown', 'ArrowUp'].includes(event.key)) {\n // must have menu item, must have pressed down, must be open and must not have focus within dd\n if (!this.open || this.focusEleInDropDwn(event)) return;\n event.preventDefault();\n this.menu.setFocus();\n return;\n }\n\n // All other keys focus the menu and pass the event through to menu (necessary for type-to-search to work)\n const ePath = event.composedPath();\n if (this.menu && ePath.length && !ePath.find((el) => el !== this.menu)) {\n this.menu.dispatchEvent(new KeyboardEvent(event.type, event));\n return;\n }\n }\n\n private handleDocumentMouseDown(event: MouseEvent) {\n // Close when clicking outside of the close element\n\n if (!this.focusEleInDropDwn(event)) {\n this.hide();\n return;\n }\n }\n\n private handleTriggerKeyDown = (event: KeyboardEvent) => {\n // Open the panel when pressing down or up while focused on the trigger\n if (['ArrowDown', 'ArrowUp', ' '].includes(event.key)) {\n this.show();\n event.preventDefault();\n event.stopPropagation();\n\n if (this.menu) this.menu.setFocus();\n }\n };\n\n private handleTriggerSlotChange = () => {\n this.updateAccessibleTrigger();\n };\n\n private createPopover() {\n if ((!this.tetherTo && !this.trigger) || !this.positioner) return;\n\n if (this.popover) {\n if (this.open) this.hide();\n this.popover.destroy();\n this.popover = null;\n }\n\n this.popover = new Popover(this.tetherTo || this.trigger, this.positioner, {\n strategy: this.hoist ? 'fixed' : 'absolute',\n placement: this.placement,\n distance: this.distance,\n skidding: this.skidding,\n transitionElement: this.panel,\n onAfterHide: () => this.nanoAfterHide.emit(),\n onAfterShow: () => this.nanoAfterShow.emit(),\n onTransitionEnd: () => {\n if (!this.open) {\n this.panel.scrollTop = 0;\n } else if (this.menu) {\n this.menu.showActiveElement();\n }\n },\n });\n // Show on init if open\n if (this.open) {\n this.show();\n }\n }\n\n // Stencil hooks\n\n connectedCallback() {\n this.handleDocumentKeyDown = this.handleDocumentKeyDown.bind(this);\n this.handleDocumentMouseDown = this.handleDocumentMouseDown.bind(this);\n\n if (!this.containingElement) this.containingElement = this.host;\n }\n\n componentDidLoad() {\n this.didLoad = true;\n this.createPopover();\n setTimeout(() => this.updateAccessibleTrigger(), 100);\n }\n\n disconnectedCallback() {\n if (this.host.isConnected) this.hide();\n if (this.popover) this.popover.destroy();\n }\n\n render() {\n return (\n <div\n part=\"base\"\n id={this.dropdownId}\n class={{\n dropdown: true,\n 'dropdown--open': this.open,\n }}\n >\n <span\n part=\"trigger\"\n class=\"dropdown__trigger\"\n ref={(el) => (this.trigger = el)}\n onKeyDown={this.handleTriggerKeyDown}\n onClick={this.togglePanel}\n >\n <slot name=\"trigger\" onSlotchange={this.handleTriggerSlotChange} />\n </span>\n\n <div\n ref={(el) => (this.positioner = el)}\n class=\"dropdown__positioner\"\n // @ts-ignore\n popover=\"manual\"\n id={this.dropdownId + '-positioner'}\n >\n <div\n ref={(el) => (this.panel = el)}\n part=\"panel\"\n class={`dropdown__panel ${this.placement.split('-').join(' ')}`}\n aria-hidden={!this.open}\n role={\n this.host.getAttribute('role') === 'group' ? 'group' : 'dialog'\n }\n aria-modal={\n this.host.getAttribute('role') === 'group' ? undefined : 'true'\n }\n aria-labelledby={this.dialogTitle ? this.labelId : undefined}\n >\n {this.dialogTitle && (\n <span\n id={this.labelId}\n class=\"dropdown__accessible-title\"\n aria-live={\n this.host.getAttribute('role') === 'group'\n ? undefined\n : 'polite'\n }\n >\n {this.dialogTitle}\n </span>\n )}\n <slot />\n </div>\n </div>\n </div>\n );\n }\n}\n"]}
@@ -2,7 +2,7 @@
2
2
  * Web Components for Nanopore digital Web Apps
3
3
  */
4
4
  import { h, Host, Build, getAssetPath, readTask, writeTask, } from '@stencil/core';
5
- import algoliasearch from 'algoliasearch';
5
+ import algoliasearch from 'algoliasearch/dist/algoliasearch-lite.esm.browser';
6
6
  import { clientFetch } from '../../utils/fetch';
7
7
  import { ComponentStore } from '../../utils/store/component-store';
8
8
  import { debounce } from '../../utils/throttle';
@@ -238,7 +238,7 @@ export class GlobalNav {
238
238
  };
239
239
  });
240
240
  try {
241
- this.algoliaSearchResults = this.processSearchResults((await this.algoliaClient.multipleQueries(queries)));
241
+ this.algoliaSearchResults = this.processSearchResults((await this.algoliaClient.search(queries)));
242
242
  }
243
243
  catch (e) {
244
244
  this.nanoSearchError.emit(e);