@nanoporetech-digital/components 4.10.0 → 5.0.0

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 (164) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/dist/cjs/{form-control-2e900f54.js → form-control-443e90bf.js} +2 -3
  3. package/dist/cjs/form-control-443e90bf.js.map +1 -0
  4. package/dist/cjs/index-71f899a7.js +6 -2
  5. package/dist/cjs/loader.cjs.js +1 -1
  6. package/dist/cjs/nano-components.cjs.js +1 -1
  7. package/dist/cjs/nano-global-nav-user-profile_3.cjs.entry.js +2 -2
  8. package/dist/cjs/nano-global-nav-user-profile_3.cjs.entry.js.map +1 -1
  9. package/dist/cjs/nano-grid-item.cjs.entry.js +29 -0
  10. package/dist/cjs/nano-grid-item.cjs.entry.js.map +1 -0
  11. package/dist/cjs/nano-grid_2.cjs.entry.js +436 -0
  12. package/dist/cjs/nano-grid_2.cjs.entry.js.map +1 -0
  13. package/dist/cjs/nano-hero.cjs.entry.js +4 -10
  14. package/dist/cjs/nano-hero.cjs.entry.js.map +1 -1
  15. package/dist/cjs/nano-icon-button_2.cjs.entry.js +2 -2
  16. package/dist/cjs/nano-icon-button_2.cjs.entry.js.map +1 -1
  17. package/dist/cjs/nano-input.cjs.entry.js +2 -2
  18. package/dist/cjs/nano-input.cjs.entry.js.map +1 -1
  19. package/dist/cjs/nano-range.cjs.entry.js +1 -1
  20. package/dist/cjs/nano-range.cjs.entry.js.map +1 -1
  21. package/dist/cjs/nano-sortable.cjs.entry.js +1 -0
  22. package/dist/cjs/nano-sortable.cjs.entry.js.map +1 -1
  23. package/dist/cjs/{nano-table-ff33dc43.js → nano-table-11052a34.js} +37 -30
  24. package/dist/cjs/nano-table-11052a34.js.map +1 -0
  25. package/dist/cjs/nano-table.cjs.entry.js +1 -1
  26. package/dist/cjs/{table.worker-0a6bc962.js → table.worker-83433a8b.js} +2 -2
  27. package/dist/cjs/table.worker-83433a8b.js.map +1 -0
  28. package/dist/collection/components/form-control/form-control.js +1 -2
  29. package/dist/collection/components/form-control/form-control.js.map +1 -1
  30. package/dist/collection/components/grid/grid-item.js +11 -136
  31. package/dist/collection/components/grid/grid-item.js.map +1 -1
  32. package/dist/collection/components/grid/grid.css +9 -242
  33. package/dist/collection/components/grid/grid.js +248 -240
  34. package/dist/collection/components/grid/grid.js.map +1 -1
  35. package/dist/collection/components/hero/hero.css +42 -89
  36. package/dist/collection/components/hero/hero.js +4 -11
  37. package/dist/collection/components/hero/hero.js.map +1 -1
  38. package/dist/collection/components/icon-button/icon-button.css +12 -0
  39. package/dist/collection/components/icon-button/icon-button.js +1 -1
  40. package/dist/collection/components/icon-button/icon-button.js.map +1 -1
  41. package/dist/collection/components/input/input.css +8 -9
  42. package/dist/collection/components/range/range.css +0 -3
  43. package/dist/collection/components/select/select.css +8 -9
  44. package/dist/collection/components/sortable/sortable.js +2 -1
  45. package/dist/collection/components/sortable/sortable.js.map +1 -1
  46. package/dist/collection/components/table/table.css +6 -0
  47. package/dist/collection/components/table/table.js +25 -18
  48. package/dist/collection/components/table/table.js.map +1 -1
  49. package/dist/collection/components/table/table.row.js +7 -7
  50. package/dist/collection/components/table/table.row.js.map +1 -1
  51. package/dist/collection/utils/constructible-style.js +129 -0
  52. package/dist/collection/utils/constructible-style.js.map +1 -0
  53. package/dist/components/form-control.js +1 -2
  54. package/dist/components/form-control.js.map +1 -1
  55. package/dist/components/grid.js +268 -183
  56. package/dist/components/grid.js.map +1 -1
  57. package/dist/components/icon-button.js +2 -2
  58. package/dist/components/icon-button.js.map +1 -1
  59. package/dist/components/input.js +1 -1
  60. package/dist/components/input.js.map +1 -1
  61. package/dist/components/nano-grid-item.js +33 -1
  62. package/dist/components/nano-grid-item.js.map +1 -1
  63. package/dist/components/nano-hero.js +6 -19
  64. package/dist/components/nano-hero.js.map +1 -1
  65. package/dist/components/nano-range.js +1 -1
  66. package/dist/components/nano-range.js.map +1 -1
  67. package/dist/components/nano-sortable.js +1 -0
  68. package/dist/components/nano-sortable.js.map +1 -1
  69. package/dist/components/select.js +1 -1
  70. package/dist/components/select.js.map +1 -1
  71. package/dist/components/table.js +36 -29
  72. package/dist/components/table.js.map +1 -1
  73. package/dist/esm/{form-control-269ba84f.js → form-control-e8739b2e.js} +2 -3
  74. package/dist/esm/form-control-e8739b2e.js.map +1 -0
  75. package/dist/esm/index-dad5627b.js +6 -2
  76. package/dist/esm/loader.js +1 -1
  77. package/dist/esm/nano-components.js +1 -1
  78. package/dist/esm/nano-global-nav-user-profile_3.entry.js +2 -2
  79. package/dist/esm/nano-global-nav-user-profile_3.entry.js.map +1 -1
  80. package/dist/esm/nano-grid-item.entry.js +25 -0
  81. package/dist/esm/nano-grid-item.entry.js.map +1 -0
  82. package/dist/esm/nano-grid_2.entry.js +431 -0
  83. package/dist/esm/nano-grid_2.entry.js.map +1 -0
  84. package/dist/esm/nano-hero.entry.js +4 -10
  85. package/dist/esm/nano-hero.entry.js.map +1 -1
  86. package/dist/esm/nano-icon-button_2.entry.js +2 -2
  87. package/dist/esm/nano-icon-button_2.entry.js.map +1 -1
  88. package/dist/esm/nano-input.entry.js +2 -2
  89. package/dist/esm/nano-input.entry.js.map +1 -1
  90. package/dist/esm/nano-range.entry.js +1 -1
  91. package/dist/esm/nano-range.entry.js.map +1 -1
  92. package/dist/esm/nano-sortable.entry.js +1 -0
  93. package/dist/esm/nano-sortable.entry.js.map +1 -1
  94. package/dist/esm/{nano-table-ec980076.js → nano-table-ba637f26.js} +37 -30
  95. package/dist/esm/nano-table-ba637f26.js.map +1 -0
  96. package/dist/esm/nano-table.entry.js +1 -1
  97. package/dist/esm/{table.worker-b53db58e.js → table.worker-1cae39c9.js} +2 -2
  98. package/dist/esm/table.worker-1cae39c9.js.map +1 -0
  99. package/dist/nano-components/nano-components.css +1 -1
  100. package/dist/nano-components/nano-components.esm.js +1 -1
  101. package/dist/nano-components/nano-components.esm.js.map +1 -1
  102. package/dist/nano-components/p-00cf8021.entry.js +5 -0
  103. package/dist/nano-components/p-00cf8021.entry.js.map +1 -0
  104. package/dist/nano-components/{p-f591400b.entry.js → p-158c73b0.entry.js} +2 -2
  105. package/dist/nano-components/p-365c997a.js +5 -0
  106. package/dist/nano-components/p-553acf24.entry.js +5 -0
  107. package/dist/nano-components/{p-58b53239.entry.js.map → p-553acf24.entry.js.map} +1 -1
  108. package/dist/nano-components/p-6975f110.entry.js +5 -0
  109. package/dist/nano-components/p-6975f110.entry.js.map +1 -0
  110. package/dist/nano-components/p-71057181.js +5 -0
  111. package/dist/nano-components/p-71057181.js.map +1 -0
  112. package/dist/nano-components/p-ad6209ec.entry.js +5 -0
  113. package/dist/nano-components/p-ad6209ec.entry.js.map +1 -0
  114. package/dist/nano-components/p-bdef618c.entry.js +5 -0
  115. package/dist/nano-components/p-bdef618c.entry.js.map +1 -0
  116. package/dist/nano-components/{p-241baff8.entry.js → p-d79c6862.entry.js} +2 -2
  117. package/dist/nano-components/p-d79c6862.entry.js.map +1 -0
  118. package/dist/nano-components/p-deb0799c.entry.js +5 -0
  119. package/dist/nano-components/{p-6a3a29c6.entry.js.map → p-deb0799c.entry.js.map} +1 -1
  120. package/dist/nano-components/p-ebb98a9e.entry.js +5 -0
  121. package/dist/nano-components/p-ebb98a9e.entry.js.map +1 -0
  122. package/dist/nano-components/p-fc585ea2.js +5 -0
  123. package/dist/nano-components/p-fc585ea2.js.map +1 -0
  124. package/dist/types/components/grid/grid-item.d.ts +3 -11
  125. package/dist/types/components/grid/grid.d.ts +44 -68
  126. package/dist/types/components/hero/hero.d.ts +1 -3
  127. package/dist/types/components/table/table.d.ts +5 -0
  128. package/dist/types/components.d.ts +85 -61
  129. package/dist/types/utils/constructible-style.d.ts +31 -0
  130. package/docs-json.json +147 -88
  131. package/docs-vscode.json +28 -21
  132. package/hydrate/index.js +340 -306
  133. package/package.json +2 -2
  134. package/dist/cjs/form-control-2e900f54.js.map +0 -1
  135. package/dist/cjs/nano-grid_3.cjs.entry.js +0 -431
  136. package/dist/cjs/nano-grid_3.cjs.entry.js.map +0 -1
  137. package/dist/cjs/nano-table-ff33dc43.js.map +0 -1
  138. package/dist/cjs/table.worker-0a6bc962.js.map +0 -1
  139. package/dist/collection/components/grid/grid-item.css +0 -15
  140. package/dist/components/grid-item.js +0 -107
  141. package/dist/components/grid-item.js.map +0 -1
  142. package/dist/esm/form-control-269ba84f.js.map +0 -1
  143. package/dist/esm/nano-grid_3.entry.js +0 -425
  144. package/dist/esm/nano-grid_3.entry.js.map +0 -1
  145. package/dist/esm/nano-table-ec980076.js.map +0 -1
  146. package/dist/esm/table.worker-b53db58e.js.map +0 -1
  147. package/dist/nano-components/p-064af7d0.js +0 -5
  148. package/dist/nano-components/p-064af7d0.js.map +0 -1
  149. package/dist/nano-components/p-107d4549.entry.js +0 -5
  150. package/dist/nano-components/p-107d4549.entry.js.map +0 -1
  151. package/dist/nano-components/p-239d343a.entry.js +0 -5
  152. package/dist/nano-components/p-239d343a.entry.js.map +0 -1
  153. package/dist/nano-components/p-241baff8.entry.js.map +0 -1
  154. package/dist/nano-components/p-58b53239.entry.js +0 -5
  155. package/dist/nano-components/p-5ac74848.js +0 -5
  156. package/dist/nano-components/p-5ac74848.js.map +0 -1
  157. package/dist/nano-components/p-6a3a29c6.entry.js +0 -5
  158. package/dist/nano-components/p-806bcd46.js +0 -5
  159. package/dist/nano-components/p-d3de231c.entry.js +0 -5
  160. package/dist/nano-components/p-d3de231c.entry.js.map +0 -1
  161. package/dist/nano-components/p-d792f692.entry.js +0 -5
  162. package/dist/nano-components/p-d792f692.entry.js.map +0 -1
  163. /package/dist/nano-components/{p-806bcd46.js.map → p-158c73b0.entry.js.map} +0 -0
  164. /package/dist/nano-components/{p-f591400b.entry.js.map → p-365c997a.js.map} +0 -0
@@ -0,0 +1,5 @@
1
+ /*!
2
+ * Web Components for Nanopore digital Web Apps
3
+ */
4
+ import{r as n,h as t,a as o,g as e}from"./p-f6a8467a.js";const i=":host {\n box-sizing: border-box;\n}\n\n*,\n*::before,\n*::after {\n box-sizing: border-box;\n}\n[hidden] {\n display: none !important;\n}\n/**\nTODO - as soon as container queries hits everywhere, strip out reliance on nano-grid breakpoints\n**/\n:host {\n /**\n * @prop --nano-loader-base: Base colour of nano-skeleton. Default depends on theme;\n * @prop --nano-loader-tint: Tint colour of nano-skeleton. Default depends on theme;\n * @prop --theme-color: Text color. Default depends on theme;\n * @prop --theme-tint-color: Color used for bread crumbs and icons. Defaults to #90c6e7;\n * @prop --scrim-color: Color of the gradient covering the background. Default depends on theme;\n * @prop --scrim-direction: Direction of the gradient covering the background. Default what content slots are present;\n * @prop --scrim-opacity-from: Starting opactiy of the gradient covering the background. Default .25;\n * @prop --scrim-opacity-to: Final opactiy of the gradient covering the background. Default depends on `theme`;\n * @prop --quote-size: Font size of the quote. Defaults to 1.3em and grows to 3rem on the xl breakpoint;\n */\n --nano-loader-base: #4a4a4a;\n --nano-loader-tint: #7d7d7d;\n --theme-color: #fff;\n --theme-tint-color: #90c6e7;\n --scrim-color: 0 0 0;\n --scrim-direction: 90deg;\n --scrim-opacity-from: 0.25;\n --scrim-opacity-to: 0.7;\n --padding: 0;\n --quote-size: 1.3rem;\n color: var(--theme-color);\n display: block;\n container-type: inline-size;\n}\n\n:host([theme=light]) {\n --nano-loader-base: #fff;\n --nano-loader-tint: white;\n --theme-color: #4a4a4a;\n --scrim-color: 255 255 255;\n --scrim-opacity-from: 0.25;\n --scrim-opacity-to: 1;\n --scrim-direction: 270deg;\n color: var(--theme-color);\n}\n:host([theme=light]) .hero__primary-content {\n --color: #4a4a4a;\n}\n\n.hero {\n position: relative;\n}\n@container (min-width: 800px) {\n .hero {\n --quote-size: 3rem;\n }\n}\n.hero--rtl {\n --scrim-direction: 270deg;\n}\n.hero--secondary:not(.hero--iconbox) {\n --scrim-direction: 0deg;\n}\n.hero__bg-wrap {\n overflow: hidden;\n}\n.hero__bg-slot {\n position: absolute;\n inset: 0;\n}\n.hero__ctas {\n display: flex;\n justify-content: flex-end;\n padding-block: 32px 0;\n padding-inline: 32px;\n -webkit-margin-after: -64px;\n margin-block-end: -64px;\n position: relative;\n z-index: 1;\n}\n@media (max-width: 52em) {\n .hero__ctas {\n display: none;\n }\n}\n@media (max-width: 58em) {\n .hero__ctas {\n -webkit-margin-after: -48px;\n margin-block-end: -48px;\n }\n}\n.hero__ctas ::slotted(a.button[slot=secondary-ctas]) {\n padding-block: 0.25rem !important;\n padding-inline: 0.5rem !important;\n font-size: 0.875rem !important;\n margin-block: 0 !important;\n margin-inline: 0.25rem !important;\n}\n.hero__img {\n display: block;\n --padding: inherit;\n}\n.hero__breadcrumbs {\n display: none;\n margin-block: 20px 0;\n margin-inline: 14px;\n line-height: 14px;\n}\n.hero--breadcrumb .hero__breadcrumbs {\n display: block;\n}\n@container (min-width: 800px) {\n .hero__breadcrumbs {\n margin-block: 0;\n margin-inline: 50px;\n max-inline-size: 50%;\n }\n}\n@container (min-width: 900px) {\n .hero__breadcrumbs {\n margin-block: 0;\n margin-inline: 83px;\n }\n}\n.hero__breadcrumbs ::slotted(*[slot=breadcrumb]) {\n font-size: 0.85rem;\n text-transform: uppercase;\n letter-spacing: 1.5px;\n font-weight: 600;\n font-stretch: 125%;\n display: inline-block;\n -webkit-margin-after: 16px;\n margin-block-end: 16px;\n position: relative;\n z-index: 2;\n}\n.hero--hasbg .hero__breadcrumbs ::slotted(*[slot=breadcrumb]) {\n text-shadow: 1px 1px rgba(0, 0, 0, 0.15);\n}\n.hero__breadcrumbs ::slotted(a[slot=breadcrumb]) {\n color: var(--theme-tint-color) !important;\n cursor: pointer;\n}\n.hero__breadcrumbs ::slotted(.slash[slot=breadcrumb]) {\n color: var(--theme-color);\n position: relative;\n margin-block: 0;\n margin-inline: 0.5rem;\n display: inline-block;\n}\n.hero__scrim {\n position: absolute;\n inset: 0;\n z-index: 0;\n background: linear-gradient(var(--scrim-direction), rgb(var(--scrim-color)/var(--scrim-opacity-from)) 0%, rgb(var(--scrim-color)/var(--scrim-opacity-to)) 100%);\n}\n.hero--scrim .hero__scrim {\n background: none;\n}\n.hero__content {\n max-inline-size: 1440px;\n display: block;\n --grid-row-gap: 0;\n margin-block: 0;\n margin-inline: auto;\n position: relative;\n}\n@container (min-width: 800px) {\n .hero__content {\n margin-block: 50px 0 !important;\n max-inline-size: 1540px !important;\n }\n}\n@container (min-width: 900px) {\n .hero__content {\n margin-block: 83px 0 !important;\n max-inline-size: 1606px !important;\n }\n}\n.hero__primary {\n margin: 16px;\n}\n.hero--breadcrumb .hero__primary {\n margin-block: 0;\n margin-inline: 16px;\n}\n.hero--backbtn .hero__primary {\n -webkit-margin-start: 0;\n margin-inline-start: 0;\n}\n.hero__primary ::slotted(nano-icon-button[slot=back-btn]) {\n font-size: 2rem;\n}\n@container (min-width: 800px) {\n .hero__primary {\n margin-block: 0 50px !important;\n margin-inline: 50px 0 !important;\n }\n .hero__primary ::slotted(nano-icon-button[slot=back-btn]) {\n margin-block: 0 !important;\n margin-inline: -3rem 0 !important;\n }\n}\n@container (min-width: 900px) {\n .hero__primary {\n margin-block: 0 83px !important;\n margin-inline: 83px 0 !important;\n }\n}\n.hero__primary-content {\n max-inline-size: 45rem;\n --color: #fff;\n display: flex;\n}\n.hero--backbtn .hero__primary-content > div {\n padding-block: 10px 0;\n padding-inline: 0;\n}\n.hero__primary-content ::slotted(h1[slot=primary-content]) {\n line-height: 26px !important;\n margin-block: 0 18px !important;\n font-size: 2rem !important;\n}\n@container (min-width: 800px) {\n .hero__primary-content ::slotted(h1[slot=primary-content]) {\n line-height: 31px !important;\n -webkit-margin-after: 30px !important;\n margin-block-end: 30px !important;\n }\n .hero__primary-content ::slotted(.button[slot=primary-content]) {\n -webkit-margin-before: 20px !important;\n margin-block-start: 20px !important;\n }\n}\n.hero__secondary {\n display: none;\n block-size: 100%;\n padding-block: 0 20px;\n padding-inline: 14px;\n}\n.hero--secondary .hero__secondary {\n display: flex;\n align-items: center;\n}\n@container (min-width: 800px) {\n .hero__secondary {\n padding-block: 0 50px;\n padding-inline: 50px;\n justify-content: flex-end;\n }\n}\n@container (min-width: 900px) {\n .hero__secondary {\n padding-block: 0 83px;\n padding-inline: 83px;\n }\n}\n.hero__icon-box {\n background: rgba(0, 0, 0, 0.7);\n padding: 24px;\n inline-size: 100%;\n -webkit-margin-after: auto;\n margin-block-end: auto;\n display: flex;\n flex-direction: column;\n color: white;\n}\n@container (min-width: 800px) {\n .hero__icon-box {\n max-inline-size: 410px;\n flex: 0 1 410px;\n }\n}\n.hero__icon-box ::slotted([slot=icon-box-item]) {\n --nano-color-base: var(--theme-tint-color);\n --nano-icon-size: 32px;\n --nano-icon-margin-end: 20px;\n display: flex;\n align-items: center;\n font-size: 0.8125rem;\n -webkit-margin-after: 20px;\n margin-block-end: 20px;\n}\n.hero__icon-box ::slotted(.last[slot=icon-box-item]) {\n -webkit-margin-after: 0;\n margin-block-end: 0;\n}\n.hero__quote-content {\n -webkit-margin-before: auto;\n margin-block-start: auto;\n text-align: center;\n inline-size: 100%;\n}\n@container (min-width: 800px) {\n .hero__quote-content {\n max-inline-size: 500px;\n flex: 0 1 500px;\n text-align: initial;\n }\n}\n.hero__quote::before, .hero__quote::after {\n content: '\"';\n font-size: var(--quote-size);\n font-weight: 700;\n font-style: italic;\n line-height: 0;\n color: #abb6b8;\n display: inline;\n position: relative;\n}\n.hero__quote ::slotted([slot=quote]) {\n font-size: var(--quote-size);\n font-weight: 300;\n font-style: italic;\n display: inline;\n}\n.hero__quote-author {\n text-align: end;\n font-size: 1rem;\n opacity: 0.8;\n}\n@container (min-width: 800px) {\n .hero--sub .hero__content {\n -webkit-margin-before: 40px;\n margin-block-start: 40px;\n }\n .hero--sub .hero__content .hero__primary {\n margin-block: 0 40px;\n margin-inline: 50px 0;\n }\n .hero--sub .hero__content .hero__secondary {\n padding-block: 0 50px;\n padding-inline: 40px 50px;\n }\n .hero--sub .hero__content ::slotted(.button[slot=primary-content]) {\n -webkit-margin-before: 8px !important;\n margin-block-start: 8px !important;\n }\n .hero--sub .hero__content ::slotted(h1[slot=primary-content]) {\n -webkit-margin-after: 18px !important;\n margin-block-end: 18px !important;\n }\n}\n@container (min-width: 900px) {\n .hero--sub .hero__content .hero__primary {\n margin-block: 0 40px;\n margin-inline: 83px 0;\n }\n .hero--sub .hero__content .hero__secondary {\n padding-block: 0 83px;\n padding-inline: 40px 83px;\n }\n}";const r=class{constructor(o){n(this,o);this.HeroContent=()=>[!this.hasIconBox&&this.hasCtas?t("div",{class:"hero__ctas"},t("slot",{name:"secondary-ctas"})):"",t("div",{class:"hero__scrim"},t("slot",{name:"scrim"})),t("nano-grid",{class:"hero__content",xlCols:2,xlSize:this.largeScreenBP},t("div",{"grid-states":"xl-col-span-2"},t("div",{class:"hero__breadcrumbs"},t("slot",{name:"breadcrumb"}))),t("div",{"grid-states":this.hasSecondaryContent?"xl-col-span-1 xl-col-start-1 xl-row-start-2":"xl-col-span-2 xl-col-start-1 xl-row-start-2"},t("div",{class:"hero__primary"},t("div",{class:"hero__primary-content"},t("slot",{name:"back-btn"}),t("div",null,t("slot",{name:"primary-content"}))))),this.hasSecondaryContent&&t("div",{"grid-states":"xl-col-span-1 xl-col-start-2 xl-row-start-2"},t("div",{class:"hero__secondary"},t("slot",{name:"secondary-content"}),this.hasIconBox&&t("div",{class:"hero__icon-box"},t("slot",{name:"icon-box"}),t("slot",{name:"icon-box-item"})),this.hasQuote&&t("div",{class:"hero__quote-content"},t("span",{class:"hero__quote"},t("slot",{name:"quote"})),t("div",{class:"hero__quote-author"},t("slot",{name:"quote-author"}))))))];this.hasIconBox=undefined;this.hasScrim=undefined;this.hasSecondaryContent=undefined;this.hasQuote=undefined;this.hasBg=undefined;this.hasBackBtn=undefined;this.hasCtas=undefined;this.breadCrumbs=undefined;this.iconBoxItems=undefined;this.imgSrc=undefined;this.imgSrcSet=null;this.largeScreenBP=900;this.theme="dark";this.level="top"}breadCrumbChange(){this.breadCrumbs.filter((n=>n.tagName==="A"&&!n.nextElementSibling.classList.contains("slash"))).forEach((n=>{n.insertAdjacentHTML("afterend",'<span slot="breadcrumb" class="slash">/</span>')}))}iconBoxItemChange(){this.iconBoxItems.forEach((n=>n.classList.remove("last")));if(this.iconBoxItems[this.iconBoxItems.length-1]&&this.iconBoxItems[this.iconBoxItems.length-1].classList)this.iconBoxItems[this.iconBoxItems.length-1].classList.add("last")}slotChangeObserver(){if(!window["MutationObserver"])return;if(this.mo)this.mo.disconnect();const n=this.mo=new MutationObserver((()=>this.processSlottedContent()));n.observe(this.host,{childList:true})}processSlottedContent(){this.hasCtas=!!this.host.querySelector('[slot="secondary-ctas"]');this.iconBoxItems=Array.from(this.host.querySelectorAll('[slot="icon-box-item"]'));this.hasIconBox=!!this.host.querySelector('[slot="icon-box"]')||!!this.iconBoxItems.length;this.hasScrim=!!this.host.querySelector('[slot="scrim"]');this.breadCrumbs=Array.from(this.host.querySelectorAll('[slot="breadcrumb"]'));this.hasSecondaryContent=!!this.host.querySelector('[slot="icon-box"]')||!!this.host.querySelector('[slot="quote"]')||!!this.host.querySelector('[slot="icon-box-item"]')||!!this.host.querySelector('[slot="secondary-content"]');this.hasBg=!!this.host.querySelector('[slot="background"]')||!!this.imgSrc;this.hasBackBtn=!!this.host.querySelector('[slot="back-btn"]');this.hasQuote=!!this.host.querySelector('[slot="quote"]')}disconnectedCallback(){if(this.mo)this.mo.disconnect()}componentDidLoad(){this.slotChangeObserver()}componentWillLoad(){this.processSlottedContent()}render(){const n=this.host.dir==="rtl"||this.host.ownerDocument.dir==="rtl";return t(o,null,t("div",{class:{hero:true,"hero--light":this.theme==="light","hero--secondary":this.hasSecondaryContent,"hero--iconbox":this.hasIconBox,"hero--rtl":n,"hero--scrim":this.hasScrim,"hero--breadcrumb":!!this.breadCrumbs.length,"hero--hasbg":this.hasBg,"hero--backbtn":this.hasBackBtn,"hero--sub":this.level==="sub"}},t("div",{class:"hero__bg-wrap"},!!this.imgSrc&&t("nano-img",{class:"hero__img",lazy:false,background:true,srcSet:this.imgSrcSet,src:this.imgSrc},t(this.HeroContent,null)),!this.imgSrc&&[t("div",{class:"hero__bg-slot"},t("slot",{name:"background"})),t(this.HeroContent,null)])))}get host(){return e(this)}static get watchers(){return{breadCrumbs:["breadCrumbChange"],iconBoxItems:["iconBoxItemChange"]}}};r.style=i;export{r as nano_hero};
5
+ //# sourceMappingURL=p-ad6209ec.entry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["heroCss","Hero","this","HeroContent","hasIconBox","hasCtas","h","class","name","xlCols","xlSize","largeScreenBP","hasSecondaryContent","hasQuote","breadCrumbChange","breadCrumbs","filter","crumb","tagName","nextElementSibling","classList","contains","forEach","insertAdjacentHTML","iconBoxItemChange","iconBoxItems","item","remove","length","add","slotChangeObserver","window","mo","disconnect","MutationObserver","processSlottedContent","observe","host","childList","querySelector","Array","from","querySelectorAll","hasScrim","hasBg","imgSrc","hasBackBtn","disconnectedCallback","componentDidLoad","componentWillLoad","render","rtl","dir","ownerDocument","Host","hero","theme","level","lazy","background","srcSet","imgSrcSet","src"],"sources":["./src/components/hero/hero.scss?tag=nano-hero&encapsulation=shadow","./src/components/hero/hero.tsx"],"sourcesContent":["@use 'sass:map';\n@use 'sass:list';\n\n@import '../../global/style/utilities/globals';\n@import '../../global/style/nano-theme/colours';\n\n/**\nTODO - as soon as container queries hits everywhere, strip out reliance on nano-grid breakpoints\n**/\n\n:host {\n /**\n * @prop --nano-loader-base: Base colour of nano-skeleton. Default depends on theme;\n * @prop --nano-loader-tint: Tint colour of nano-skeleton. Default depends on theme;\n * @prop --theme-color: Text color. Default depends on theme;\n * @prop --theme-tint-color: Color used for bread crumbs and icons. Defaults to #{map.get($colors, lightblue)};\n * @prop --scrim-color: Color of the gradient covering the background. Default depends on theme;\n * @prop --scrim-direction: Direction of the gradient covering the background. Default what content slots are present;\n * @prop --scrim-opacity-from: Starting opactiy of the gradient covering the background. Default .25;\n * @prop --scrim-opacity-to: Final opactiy of the gradient covering the background. Default depends on `theme`;\n * @prop --quote-size: Font size of the quote. Defaults to 1.3em and grows to 3rem on the xl breakpoint;\n */\n\n --nano-loader-base: #{map.get($colors, black)};\n --nano-loader-tint: #{lighten(map.get($colors, black), 20%)};\n --theme-color: #{map.get($colors, white)};\n --theme-tint-color: #{map.get($colors, lightblue)};\n --scrim-color: 0 0 0;\n --scrim-direction: 90deg;\n --scrim-opacity-from: 0.25;\n --scrim-opacity-to: 0.7;\n --padding: 0;\n --quote-size: 1.3rem;\n\n color: var(--theme-color);\n display: block;\n container-type: inline-size;\n}\n\n:host([theme='light']) {\n --nano-loader-base: #{map.get($colors, white)};\n --nano-loader-tint: #{lighten(map.get($colors, white), 20%)};\n --theme-color: #{map.get($colors, black)};\n --scrim-color: 255 255 255;\n --scrim-opacity-from: 0.25;\n --scrim-opacity-to: 1;\n --scrim-direction: 270deg;\n\n color: var(--theme-color);\n\n .hero__primary-content {\n --color: #{map.get($colors, black)};\n }\n}\n\n.hero {\n position: relative;\n\n @container (min-width: 800px) {\n --quote-size: 3rem;\n }\n\n &--rtl {\n --scrim-direction: 270deg;\n }\n\n &--secondary:not(.hero--iconbox) {\n --scrim-direction: 0deg;\n }\n\n &__bg-wrap {\n overflow: hidden;\n }\n\n &__bg-slot {\n position: absolute;\n inset: 0;\n }\n\n &__ctas {\n @media (max-width: 52em) {\n display: none;\n }\n\n @media (max-width: 58em) {\n margin-block-end: -48px;\n }\n\n display: flex;\n justify-content: flex-end;\n padding-block: 32px 0;\n padding-inline: 32px;\n margin-block-end: -64px;\n position: relative;\n z-index: 1;\n\n ::slotted(a.button[slot='secondary-ctas']) {\n padding-block: 0.25rem !important;\n padding-inline: 0.5rem !important;\n font-size: 0.875rem !important;\n margin-block: 0 !important;\n margin-inline: 0.25rem !important;\n }\n }\n\n &__img {\n display: block;\n\n --padding: inherit;\n }\n\n &__breadcrumbs {\n display: none;\n margin-block: 20px 0;\n margin-inline: 14px;\n line-height: 14px;\n\n .hero--breadcrumb & {\n display: block;\n }\n\n @container (min-width: 800px) {\n margin-block: 0;\n margin-inline: 50px;\n max-inline-size: 50%;\n }\n\n @container (min-width: 900px) {\n margin-block: 0;\n margin-inline: 83px;\n }\n\n ::slotted(*[slot='breadcrumb']) {\n font-size: 0.85rem;\n text-transform: uppercase;\n letter-spacing: 1.5px;\n font-weight: 600;\n font-stretch: 125%;\n display: inline-block;\n margin-block-end: 16px;\n position: relative;\n z-index: 2;\n\n .hero--hasbg & {\n text-shadow: 1px 1px rgb(0 0 0 / 15%);\n }\n }\n\n ::slotted(a[slot='breadcrumb']) {\n color: var(--theme-tint-color) !important;\n cursor: pointer;\n }\n\n ::slotted(.slash[slot='breadcrumb']) {\n color: var(--theme-color);\n position: relative;\n margin-block: 0;\n margin-inline: 0.5rem;\n display: inline-block;\n }\n }\n\n &__scrim {\n position: absolute;\n inset: 0;\n z-index: 0;\n background:\n linear-gradient(\n var(--scrim-direction),\n rgb(var(--scrim-color) / var(--scrim-opacity-from)) 0%,\n rgb(var(--scrim-color) / var(--scrim-opacity-to)) 100%\n );\n\n .hero--scrim & {\n background: none;\n }\n }\n\n &__content {\n max-inline-size: 1440px;\n display: block;\n\n --grid-row-gap: 0;\n\n margin-block: 0;\n margin-inline: auto;\n position: relative;\n\n @container (min-width: 800px) {\n margin-block: 50px 0 !important;\n max-inline-size: 1540px !important;\n }\n\n @container (min-width: 900px) {\n margin-block: 83px 0 !important;\n max-inline-size: 1606px !important;\n }\n }\n\n &__primary {\n margin: 16px;\n\n .hero--breadcrumb & {\n margin-block: 0;\n margin-inline: 16px;\n }\n\n .hero--backbtn & {\n margin-inline-start: 0;\n }\n\n ::slotted(nano-icon-button[slot='back-btn']) {\n font-size: 2rem;\n }\n\n @container (min-width: 800px) {\n margin-block: 0 50px !important;\n margin-inline: 50px 0 !important;\n\n ::slotted(nano-icon-button[slot='back-btn']) {\n margin-block: 0 !important;\n margin-inline: -3rem 0 !important;\n }\n }\n\n @container (min-width: 900px) {\n margin-block: 0 83px !important;\n margin-inline: 83px 0 !important;\n }\n }\n\n &__primary-content {\n max-inline-size: 45rem;\n\n --color: #fff;\n\n display: flex;\n\n .hero--backbtn & {\n > div {\n padding-block: 10px 0;\n padding-inline: 0;\n }\n }\n\n ::slotted(h1[slot='primary-content']) {\n line-height: 26px !important;\n margin-block: 0 18px !important;\n font-size: 2rem !important;\n }\n\n @container (min-width: 800px) {\n ::slotted(h1[slot='primary-content']) {\n line-height: 31px !important;\n margin-block-end: 30px !important;\n }\n\n ::slotted(.button[slot='primary-content']) {\n margin-block-start: 20px !important;\n }\n }\n }\n\n &__secondary {\n display: none;\n block-size: 100%;\n padding-block: 0 20px;\n padding-inline: 14px;\n\n .hero--secondary & {\n display: flex;\n align-items: center;\n }\n\n @container (min-width: 800px) {\n padding-block: 0 50px;\n padding-inline: 50px;\n justify-content: flex-end;\n }\n\n @container (min-width: 900px) {\n padding-block: 0 83px;\n padding-inline: 83px;\n }\n }\n\n &__icon-box {\n background: rgb(0 0 0 / 70%);\n padding: 24px;\n inline-size: 100%;\n margin-block-end: auto;\n display: flex;\n flex-direction: column;\n color: white;\n\n @container (min-width: 800px) {\n max-inline-size: 410px;\n flex: 0 1 410px;\n }\n\n ::slotted([slot='icon-box-item']) {\n --nano-color-base: var(--theme-tint-color);\n --nano-icon-size: 32px;\n --nano-icon-margin-end: 20px;\n\n display: flex;\n align-items: center;\n font-size: 0.8125rem;\n margin-block-end: 20px;\n }\n\n ::slotted(.last[slot='icon-box-item']) {\n margin-block-end: 0;\n }\n }\n\n &__quote-content {\n margin-block-start: auto;\n text-align: center;\n inline-size: 100%;\n\n @container (min-width: 800px) {\n max-inline-size: 500px;\n flex: 0 1 500px;\n text-align: initial;\n }\n }\n\n &__quote {\n &::before,\n &::after {\n content: '\"';\n font-size: var(--quote-size);\n font-weight: 700;\n font-style: italic;\n line-height: 0;\n color: #abb6b8;\n display: inline;\n position: relative;\n }\n\n ::slotted([slot='quote']) {\n font-size: var(--quote-size);\n font-weight: 300;\n font-style: italic;\n display: inline;\n }\n }\n\n &__quote-author {\n text-align: end;\n font-size: 1rem;\n opacity: 0.8;\n }\n\n &--sub {\n .hero__content {\n @container (min-width: 800px) {\n margin-block-start: 40px;\n\n .hero__primary {\n margin-block: 0 40px;\n margin-inline: 50px 0;\n }\n\n .hero__secondary {\n padding-block: 0 50px;\n padding-inline: 40px 50px;\n }\n\n ::slotted(.button[slot='primary-content']) {\n margin-block-start: 8px !important;\n }\n\n ::slotted(h1[slot='primary-content']) {\n margin-block-end: 18px !important;\n }\n }\n\n @container (min-width: 900px) {\n .hero__primary {\n margin-block: 0 40px;\n margin-inline: 83px 0;\n }\n\n .hero__secondary {\n padding-block: 0 83px;\n padding-inline: 40px 83px;\n }\n }\n }\n }\n}\n","import {\n Component,\n Prop,\n h,\n ComponentInterface,\n VNode,\n State,\n Element,\n Watch,\n Host,\n} from '@stencil/core';\n/**\n * Hero components are designed to be used once per content page to add visual impact to the introductory section of a page.\n * @slot primary-content - title, leading paragraph and CTA\n * @slot breadcrumb - each individual bread crumb should be assigned seperately\n * @slot secondary-content - free form secondary content.\n * @slot icon-box - free form icon box container\n * @slot icon-box-item - seperate icon box items. Designed to contain 1 icon and 1 text element.\n * @slot secondary-ctas - CTAs. each individual button should be assigned seperately\n * @slot quote - quote content\n * @slot quote-author - quote author\n * @slot scrim - optional background overlay (e.g. faded colour or gradient)\n * @slot background - custom background. Only active when img-src is empty\n * @slot back-btn - a back button.\n */\n@Component({\n tag: 'nano-hero',\n styleUrl: 'hero.scss',\n shadow: true,\n})\nexport class Hero implements ComponentInterface {\n private mo?: MutationObserver;\n\n @Element() host: HTMLNanoHeroElement;\n\n @State() hasIconBox: boolean;\n @State() hasScrim: boolean;\n @State() hasSecondaryContent: boolean;\n @State() hasQuote: boolean;\n @State() hasBg: boolean;\n @State() hasBackBtn: boolean;\n @State() hasCtas: boolean;\n @State() breadCrumbs: Element[];\n @Watch('breadCrumbs')\n breadCrumbChange() {\n // safari doesn't support ::slotted()::after ... so this :/\n this.breadCrumbs\n .filter(\n (crumb) =>\n crumb.tagName === 'A' &&\n !crumb.nextElementSibling.classList.contains('slash')\n )\n .forEach((crumb) => {\n crumb.insertAdjacentHTML(\n 'afterend',\n '<span slot=\"breadcrumb\" class=\"slash\">/</span>'\n );\n });\n }\n @State() iconBoxItems: Element[];\n @Watch('iconBoxItems')\n iconBoxItemChange() {\n this.iconBoxItems.forEach((item) => item.classList.remove('last'));\n if (\n this.iconBoxItems[this.iconBoxItems.length - 1] &&\n this.iconBoxItems[this.iconBoxItems.length - 1].classList\n )\n this.iconBoxItems[this.iconBoxItems.length - 1].classList.add('last');\n }\n\n /** src for background image. For more control use the `background` slot instead. */\n @Prop() imgSrc?: string;\n\n /** Optional list string providing media sizes with corresponding image srcs.\n * i.e. show img-x at 300px wide. Format `srcSet=\"200w src/imgSmall.jpg, 500h src/imgMed.png\"` */\n @Prop() imgSrcSet?: string = null;\n\n /** The Break Point width that the hero component will change to the large view. Defaults to the XL grid size (900px) */\n @Prop() largeScreenBP: number = 900;\n\n /** Base style for the hero. Either 'light' (white bg / dark text), or 'dark' (dark bg / white text) */\n @Prop() theme: 'dark' | 'light' = 'dark';\n\n /** Set the content structure level of the hero. Defaults to 'top' */\n @Prop() level: 'top' | 'sub' = 'top';\n\n private slotChangeObserver() {\n if (!window['MutationObserver']) return;\n\n if (this.mo) this.mo.disconnect();\n const mo = (this.mo = new MutationObserver(() =>\n this.processSlottedContent()\n ));\n mo.observe(this.host, { childList: true });\n }\n\n // Event handlers\n\n private processSlottedContent() {\n this.hasCtas = !!this.host.querySelector('[slot=\"secondary-ctas\"]');\n this.iconBoxItems = Array.from(\n this.host.querySelectorAll('[slot=\"icon-box-item\"]')\n );\n this.hasIconBox =\n !!this.host.querySelector('[slot=\"icon-box\"]') ||\n !!this.iconBoxItems.length;\n this.hasScrim = !!this.host.querySelector('[slot=\"scrim\"]');\n this.breadCrumbs = Array.from(\n this.host.querySelectorAll('[slot=\"breadcrumb\"]')\n );\n this.hasSecondaryContent =\n !!this.host.querySelector('[slot=\"icon-box\"]') ||\n !!this.host.querySelector('[slot=\"quote\"]') ||\n !!this.host.querySelector('[slot=\"icon-box-item\"]') ||\n !!this.host.querySelector('[slot=\"secondary-content\"]');\n this.hasBg =\n !!this.host.querySelector('[slot=\"background\"]') || !!this.imgSrc;\n this.hasBackBtn = !!this.host.querySelector('[slot=\"back-btn\"]');\n this.hasQuote = !!this.host.querySelector('[slot=\"quote\"]');\n }\n\n // Component lifecycle\n\n disconnectedCallback() {\n if (this.mo) this.mo.disconnect();\n }\n\n componentDidLoad() {\n this.slotChangeObserver();\n }\n\n componentWillLoad() {\n this.processSlottedContent();\n }\n\n private HeroContent = (): VNode[] => {\n return [\n !this.hasIconBox && this.hasCtas ? (\n <div class=\"hero__ctas\">\n <slot name=\"secondary-ctas\" />\n </div>\n ) : (\n ''\n ),\n <div class=\"hero__scrim\">\n <slot name=\"scrim\" />\n </div>,\n <nano-grid class=\"hero__content\" xlCols={2} xlSize={this.largeScreenBP}>\n <div grid-states=\"xl-col-span-2\">\n <div class=\"hero__breadcrumbs\">\n <slot name=\"breadcrumb\" />\n </div>\n </div>\n <div\n grid-states={\n this.hasSecondaryContent\n ? 'xl-col-span-1 xl-col-start-1 xl-row-start-2'\n : 'xl-col-span-2 xl-col-start-1 xl-row-start-2'\n }\n >\n <div class=\"hero__primary\">\n <div class=\"hero__primary-content\">\n <slot name=\"back-btn\" />\n <div>\n <slot name=\"primary-content\" />\n </div>\n </div>\n </div>\n </div>\n {this.hasSecondaryContent && (\n <div grid-states=\"xl-col-span-1 xl-col-start-2 xl-row-start-2\">\n <div class=\"hero__secondary\">\n <slot name=\"secondary-content\" />\n {this.hasIconBox && (\n <div class=\"hero__icon-box\">\n <slot name=\"icon-box\" />\n <slot name=\"icon-box-item\" />\n </div>\n )}\n {this.hasQuote && (\n <div class=\"hero__quote-content\">\n <span class=\"hero__quote\">\n <slot name=\"quote\" />\n </span>\n <div class=\"hero__quote-author\">\n <slot name=\"quote-author\" />\n </div>\n </div>\n )}\n </div>\n </div>\n )}\n </nano-grid>,\n ];\n };\n\n render() {\n const rtl =\n this.host.dir === 'rtl' ||\n (this.host.ownerDocument as Document).dir === 'rtl';\n\n return (\n <Host>\n <div\n class={{\n hero: true,\n 'hero--light': this.theme === 'light',\n 'hero--secondary': this.hasSecondaryContent,\n 'hero--iconbox': this.hasIconBox,\n 'hero--rtl': rtl,\n 'hero--scrim': this.hasScrim,\n 'hero--breadcrumb': !!this.breadCrumbs.length,\n 'hero--hasbg': this.hasBg,\n 'hero--backbtn': this.hasBackBtn,\n 'hero--sub': this.level === 'sub',\n }}\n >\n <div class=\"hero__bg-wrap\">\n {!!this.imgSrc && (\n <nano-img\n class=\"hero__img\"\n lazy={false}\n background\n srcSet={this.imgSrcSet}\n src={this.imgSrc}\n >\n <this.HeroContent />\n </nano-img>\n )}\n {!this.imgSrc && [\n <div class=\"hero__bg-slot\">\n <slot name=\"background\" />\n </div>,\n <this.HeroContent />,\n ]}\n </div>\n </div>\n </Host>\n );\n }\n}\n"],"mappings":";;;yDAAA,MAAMA,EAAU,o8R,MC8BHC,EAAI,M,yBAyGPC,KAAAC,YAAc,IACb,EACJD,KAAKE,YAAcF,KAAKG,QACvBC,EAAA,OAAKC,MAAM,cACTD,EAAA,QAAME,KAAK,oBACP,GAIRF,EAAA,OAAKC,MAAM,eACTD,EAAA,QAAME,KAAK,WAEbF,EAAA,aAAWC,MAAM,gBAAgBE,OAAQ,EAAGC,OAAQR,KAAKS,eACvDL,EAAA,qBAAiB,iBACfA,EAAA,OAAKC,MAAM,qBACTD,EAAA,QAAME,KAAK,iBAGfF,EAAA,qBAEIJ,KAAKU,oBACD,8CACA,+CAGNN,EAAA,OAAKC,MAAM,iBACTD,EAAA,OAAKC,MAAM,yBACTD,EAAA,QAAME,KAAK,aACXF,EAAA,WACEA,EAAA,QAAME,KAAK,wBAKlBN,KAAKU,qBACJN,EAAA,qBAAiB,+CACfA,EAAA,OAAKC,MAAM,mBACTD,EAAA,QAAME,KAAK,sBACVN,KAAKE,YACJE,EAAA,OAAKC,MAAM,kBACTD,EAAA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KmC,KAAKE,cAAc,8BAC5BrC,KAAK0C,QACD1C,KAAKmC,KAAKE,cAAc,0BAA4BrC,KAAK2C,OAC7D3C,KAAK4C,aAAe5C,KAAKmC,KAAKE,cAAc,qBAC5CrC,KAAKW,WAAaX,KAAKmC,KAAKE,cAAc,iB,CAK5CQ,uBACE,GAAI7C,KAAK8B,GAAI9B,KAAK8B,GAAGC,Y,CAGvBe,mBACE9C,KAAK4B,oB,CAGPmB,oBACE/C,KAAKiC,uB,CAgEPe,SACE,MAAMC,EACJjD,KAAKmC,KAAKe,MAAQ,OACjBlD,KAAKmC,KAAKgB,cAA2BD,MAAQ,MAEhD,OACE9C,EAACgD,EAAI,KACHhD,EAAA,OACEC,MAAO,CACLgD,KAAM,KACN,cAAerD,KAAKsD,QAAU,QAC9B,kBAAmBtD,KAAKU,oBACxB,gBAAiBV,KAAKE,WACtB,YAAa+C,EACb,cAAejD,KAAKyC,SACpB,qBAAsBzC,KAAKa,YAAYa,OACvC,cAAe1B,KAAK0C,MACpB,gBAAiB1C,KAAK4C,WACtB,YAAa5C,KAAKuD,QAAU,QAG9BnD,EAAA,OAAKC,MAAM,mBACNL,KAAK2C,QACNvC,EAAA,YACEC,MAAM,YACNmD,KAAM,MACNC,WAAU,KACVC,OAAQ1D,KAAK2D,UACbC,IAAK5D,KAAK2C,QAEVvC,EAACJ,KAAKC,YAAW,QAGnBD,KAAK2C,QAAU,CACfvC,EAAA,OAAKC,MAAM,iBACTD,EAAA,QAAME,KAAK,gBAEbF,EAACJ,KAAKC,YAAW,S"}
@@ -0,0 +1,5 @@
1
+ /*!
2
+ * Web Components for Nanopore digital Web Apps
3
+ */
4
+ import{r,h as s}from"./p-f6a8467a.js";const o=class{constructor(s){r(this,s)}render(){return s("slot",null)}};o.style=":host { display: inline-block; }";export{o as nano_grid_item};
5
+ //# sourceMappingURL=p-bdef618c.entry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["GridItem","render","h"],"sources":["./src/components/grid/grid-item.tsx"],"sourcesContent":["import { Component, h } from '@stencil/core';\n// import type { GridSizes } from '../../interface';\n\n// const STATEOPTS = ['col-span', 'col-start', 'row-span', 'row-start'];\n\n/**\n * @deprecated - you can now use `grid-states=\"...\"`\n * on any direct `nano-grid` descendent without limitation rendering `nano-grid-item` obsolete.\n *\n * Grid items to be used with [grid](/story/nano-components-grid) elements\n */\n@Component({\n tag: 'nano-grid-item',\n styles: /* css */ `:host { display: inline-block; }`,\n shadow: true,\n})\nexport class GridItem {\n /**\n * How to position this item within it's parent grid at different break points. Examples:\n * xl-col-span-2\n * l-col-start-2\n * xxl-row-span-2\n * m-row-start-2\n */\n\n render() {\n return <slot />;\n }\n}\n"],"mappings":";;;4CAgBaA,EAAQ,M,yBASnBC,SACE,OAAOC,EAAA,Y"}
@@ -1,5 +1,5 @@
1
1
  /*!
2
2
  * Web Components for Nanopore digital Web Apps
3
3
  */
4
- import{w as t,r as i,c as s,d as e,h,a as n,g as r}from"./p-f6a8467a.js";import{d as o}from"./p-842cf127.js";import{d as a}from"./p-9746b0a5.js";const l=":host{box-sizing:border-box}*,*::before,*::after{box-sizing:border-box}[hidden]{display:none !important}:host{position:relative;display:block}.sortable__live-region{clip:rect(1px, 1px, 1px, 1px);-webkit-clip-path:inset(50%);clip-path:inset(50%);block-size:1px;inline-size:1px;margin:-1px;overflow:hidden;padding:0;position:absolute}";const d={horizontal:{x:1,y:0},vertical:{x:0,y:1}};let f=0;const c=class{handleItemSelectorChange(){this.refreshKeyboardHandles()}handleHandleSelectorChange(){this.refreshKeyboardHandles();this.attachMutationObserver()}handleCreateKeyboardHandleChange(){this.refreshKeyboardHandles()}handleSortableHostElement(t,i){if(i)this.removeEventHandlers(i);this.addEventHandlers();this.refreshKeyboardHandles();this.attachMutationObserver();if(this.sortableHostElement){this.sortableHostElement.style.position="relative"}}async refreshKeyboardHandles(){var t,i,s;if(this.handleSelector){if((t=this.keyboardHandleMap)===null||t===void 0?void 0:t.size){this.keyboardHandleMap.clear()}this.sortableHost.querySelectorAll(this.handleSelector).forEach((t=>{if(!t.getAttribute("aria-describedby"))t.setAttribute("aria-describedby",this.sortableId);const i=t.closest(this.itemSelector);if(i)this.keyboardHandleMap.set(t,i)}));return}if((i=this.keyboardHandleMap)===null||i===void 0?void 0:i.size){(s=this.keyboardHandleMap)===null||s===void 0?void 0:s.forEach(((t,i)=>i.remove()));this.keyboardHandleMap.clear()}this.sortableHost.querySelectorAll(this.itemSelector).forEach(((t,i)=>{const s=this.createKeyboardHandle(i,t);if(!s){console.error("`createKeyboardHandle` *must* return the handle element it creates");return}this.keyboardHandleMap.set(s,t);s.setAttribute("aria-describedby",this.sortableId)}))}get sortableHost(){if(this.sortableHostElement)return this.sortableHostElement;return this.host}addAriaMsg(t){this.ariaTextList=[...this.ariaTextList,t];setTimeout((()=>{const i=this.ariaTextList.indexOf(t);this.ariaTextList.splice(i,1);this.ariaTextList=[...this.ariaTextList]}),1e4)}updateUserSelectStyle(t){this.host.style.userSelect=t;this.host.style.MozUserSelect=t;this.host.style.msUserSelect=t;this.host.style.webkitUserSelect=t}hitTest(t,i){const{left:s,top:e,width:h,height:n}=t.getBoundingClientRect();const r=s+h/2;const o=e+n/2;return i.filter((t=>{const{left:i,right:s,top:e,bottom:h}=t.getBoundingClientRect();return!(r<i||r>s||o<e||o>h)}))}isAnimating(t){return this.animatedElements.indexOf(t)!==-1}animateNode(i,s=0,e=0){if(!i.animate){return}this.animatedElements.push(i);i.style.willChange="transform";t((()=>{this.animationPromise=new Promise((t=>{i.animate([{transform:`translate3d(${s}px, ${e}px, 0)`},{transform:"none"}],this.animationTiming).addEventListener("finish",(()=>{const s=this.animatedElements.indexOf(i);i.style.willChange="";if(s!==-1){this.animatedElements.splice(s,1)}t();delete this.animationPromise}),{once:true})}))}))}insertAtTarget(t,i){if(!t||!i)return;let s=[];if(this.animationEnabled){s=this.sortableNodes.map((t=>({x:t.offsetLeft,y:t.offsetTop})))}if(!t.isConnected||!i.isConnected)return;if(this.dropzoneNodes.indexOf(i)>-1){i.append(t)}else{const s=t.compareDocumentPosition(i);let e;if(s&this.host.DOCUMENT_POSITION_FOLLOWING){e=i.parentNode===t.parentNode?"afterend":"beforebegin"}if(s&this.host.DOCUMENT_POSITION_PRECEDING){e=i.parentNode===t.parentNode?"beforebegin":"afterend"}if(e)i.insertAdjacentElement(e,t)}if(this.animationEnabled){this.sortableNodes.forEach(((t,i)=>{const{x:e,y:h}=s[i];const n=e-t.offsetLeft;const r=h-t.offsetTop;if(n!==0||r!==0){this.animateNode(t,n,r)}}))}}reset(){if(this.draggedElementClone!==undefined&&this.draggedElementClone.parentNode!==null){this.draggedElementClone.parentNode.removeChild(this.draggedElementClone)}if(this.draggedElement&&this.draggedElement.parentNode&&this.draggedElementOrigin){this.draggedElement.classList.remove(this.placeholderClass)}if(this.dropzoneActiveClass&&this.dropzoneNodes.length){this.dropzoneNodes.forEach((t=>t.classList.remove(this.dropzoneActiveClass)))}delete this.draggedElementClone;delete this.draggedElement;this.dropzoneNodes=[];this.sortableNodes=[];this.animatedElements=[];this.dragRequestPending=false;this.updateUserSelectStyle("")}createClone(t){const i=t.cloneNode(true);if(t.id)i.id="clone__"+i.id;Array.from(i.children).forEach(((i,s)=>{const e=i;const h=t.children.item(s);if(h){e.style.width=`${h.offsetWidth}px`}}));const{offsetLeft:s,offsetTop:e,offsetWidth:h,offsetHeight:n}=t;Object.assign(i.style,{position:"absolute",left:`calc(${s}px - var(--grab-offset-x, 0px))`,top:`calc(${e}px - var(--grab-offset-y, 0px))`,height:this.dragResize?`${n}px`:undefined,width:this.dragResize?`${h}px`:undefined,willChange:"transform,opacity"});i.classList.add(this.draggedClass);return t.parentNode.appendChild(i)}removeEventHandlers(t){t=t||this.sortableHost;t.removeEventListener("mousedown",this.handleTrack);t.removeEventListener("touchstart",this.handleTrack);t.removeEventListener("keydown",this.handleKeydown)}addEventHandlers(t){t=t||this.sortableHost;t.addEventListener("mousedown",this.handleTrack);t.addEventListener("touchstart",this.handleTrack);t.addEventListener("keydown",this.handleKeydown)}attachMutationObserver(){if(this.mutationObserver){this.mutationObserver.disconnect();this.mutationObserver=undefined}this.mutationObserver=new MutationObserver((()=>{const t=Array.from(this.keyboardHandleMap.values());const i=Array.from(this.sortableHost.querySelectorAll(this.itemSelector));if(t.length!==i.length||!!i.find((i=>!t.includes(i)))){this.refreshKeyboardHandles()}}));this.mutationObserver.observe(this.sortableHost,{subtree:true,childList:true})}handleKeydown(t){const i=t.target;let s;let e;if(this.handleSelector){s=i.closest(this.handleSelector);e=i.closest(this.itemSelector)}else{e=this.keyboardHandleMap.get(i);s=i}if(!s||!e)return;const h=t=>{this.keyboardSortActive=t;this.draggedElement=t?e:undefined;e.classList.toggle(this.draggedClass,t);s.classList.toggle(this.handleDraggedClass,t);if(t){this.addAriaMsg(this.grabbedHelperText(e));document.addEventListener("mousedown",(()=>h(false)),{once:true})}else{this.addAriaMsg(this.droppedHelperText(e))}};if([" ","Space","Enter"].includes(t.key)){t.preventDefault();if(!this.keyboardSortActive){h(true);this.sortableNodes=Array.from(this.sortableHost.querySelectorAll(this.itemSelector))||[];const t=this.nanoGrabbed.emit({element:e,index:this.sortableNodes.indexOf(e)});if(t.defaultPrevented){h(false);return}}else{h(false);this.nanoDropped.emit({element:e})}return}if(!this.keyboardSortActive)return;if(["Escape","Tab"].includes(t.key))h(false);let n=["Home","End"];if(!this.orientation||this.orientation==="horizontal")n=[...n,"ArrowRight","ArrowLeft"];if(!this.orientation||this.orientation==="vertical")n=[...n,"ArrowUp","ArrowDown"];if(!n.includes(t.key))return;t.preventDefault();this.sortableNodes=Array.from(this.sortableHost.querySelectorAll(this.itemSelector))||[];this.dropzoneNodes=Array.from(this.sortableHost.querySelectorAll(this.dropzoneSelector))||[];const r=this.sortableNodes.indexOf(this.draggedElement);let o=-1;if(this.dropzoneNodes.length){const t=this.draggedElement.closest(this.dropzoneSelector);o=this.dropzoneNodes.indexOf(t);o=o>-1?o:-1}const a=r-1<0&&o>-1?this.dropzoneNodes[o-1]:this.sortableNodes[r-1];const l=r+1===this.sortableNodes.length&&o>-1?this.dropzoneNodes[o+1]:this.sortableNodes[r+1];if(t.key==="Home"){this.insertAtTarget(this.draggedElement,this.sortableNodes[0])}if(t.key==="End"){this.insertAtTarget(this.draggedElement,this.sortableNodes[this.sortableNodes.length-1])}if(["ArrowRight","ArrowDown"].includes(t.key)){this.insertAtTarget(this.draggedElement,l)}if(["ArrowLeft","ArrowUp"].includes(t.key)){this.insertAtTarget(this.draggedElement,a)}this.finishOrder();this.draggedElement=e;const d=()=>{requestAnimationFrame((()=>{typeof s["setFocus"]==="function"?s.setFocus():s.focus()}))};if(this.animationPromise)this.animationPromise.then((()=>d()));else d()}handleTrack(t){if(this.dragRequestPending||t.button&&t.button!==1)return;clearTimeout(this.mouseDownTimer);this.mouseDownTimer=window===null||window===void 0?void 0:window.setTimeout((()=>{if(!this.trackStart(t))return;this.addAriaMsg(this.grabbedHelperText(this.draggedElement));o(this.sortableHost,{initialEvent:t,relative:true,onMove:(t,i)=>{this.trackMove(t,i)},onStop:()=>{this.nanoDropped.emit({element:this.draggedElement});const t=()=>{this.addAriaMsg(this.droppedHelperText(this.draggedElement));requestAnimationFrame((()=>this.finishOrder()))};if(this.animationPromise){this.animationPromise.then((()=>t()))}else t()}})}),100);document.addEventListener("mouseup",(()=>clearTimeout(this.mouseDownTimer)),{once:true})}trackStart(t){const i=t.target;let s;if(this.handleSelector){s=i.closest(this.handleSelector);if(!s)return;s.classList.add(this.handleDraggedClass)}const e=i.closest(this.itemSelector);if(!e)return false;this.sortableNodes=Array.from(this.sortableHost.querySelectorAll(this.itemSelector))||[];const h=this.nanoGrabbed.emit({element:e,index:this.sortableNodes.indexOf(e)});if(h.defaultPrevented)return false;t.preventDefault();this.updateUserSelectStyle("none");this.dragRequestPending=true;this.draggedElement=e;this.dropzoneNodes=Array.from(this.sortableHost.querySelectorAll(this.dropzoneSelector))||[];this.draggedElementClone=this.createClone(e);this.draggedElementOrigin=e.nextSibling;this.animatedElements=[];this.draggedElement.classList.add(this.placeholderClass);return true}finishOrder(){if(!this.draggedElement)return;const t=Array.from(this.sortableHost.querySelectorAll(this.itemSelector)).filter((t=>t!==this.draggedElementClone));const i=this.sortableNodes.indexOf(this.draggedElement);const s=t.indexOf(this.draggedElement);if(this.handleSelector){const t=this.draggedElement.querySelector(this.handleSelector);t.classList.remove(this.handleDraggedClass)}if(i!==s){const e=this.nanoOrderChange.emit({element:this.draggedElement,originalIndex:i,targetIndex:s});if(e.defaultPrevented){this.animationPromise=new Promise((s=>{setTimeout((()=>{this.insertAtTarget(this.draggedElement,t[i]);this.reset();this.dragRequestPending=false;s()}),200)}));return}this.addAriaMsg(this.reorderHelperText(this.draggedElement,t,s+1))}this.reset();this.dragRequestPending=false}constructor(h){i(this,h);this.nanoOrderChange=s(this,"nanoOrderChange",7);this.nanoGrabbed=s(this,"nanoGrabbed",7);this.nanoDropped=s(this,"nanoDropped",7);this.dragRequestPending=false;this.sortableNodes=[];this.dropzoneNodes=[];this.animatedElements=[];this.keyboardHandleMap=new Map;this.sortableId=`nano-sortable-${f++}`;this.trackMove=(i,s)=>{if(!this.draggedElementClone){return}if(this.orientation){i=i*d[this.orientation].x;s=s*d[this.orientation].y}t((()=>{Object.assign(this.draggedElementClone.style,{transform:`translate3d(${i}px, ${s}px, 0)`})}));let h=this.hitTest(this.draggedElementClone,this.sortableNodes)[0];let n;if(this.dropzoneSelector&&this.dropzoneActiveClass){e((()=>{n=this.draggedElement.closest(this.dropzoneSelector);t((()=>{this.dropzoneNodes.filter((t=>t!==n)).forEach((t=>t.classList.remove(this.dropzoneActiveClass)));n.classList.add(this.dropzoneActiveClass)}))}))}if(!h&&this.dropzoneNodes.length){h=this.hitTest(this.draggedElementClone,this.dropzoneNodes)[0];if(this.draggedElement.closest(this.dropzoneSelector)===h)return}if(h&&h!==this.draggedElement&&!this.isAnimating(h)){this.insertAtTarget(this.draggedElement,h)}};this.itemSelector="li";this.handleSelector=undefined;this.dropzoneSelector=undefined;this.helperText='Press "Space" or "Enter" to enable element reordering and use the arrow keys to reorder items.'+'Press "Escape" to cancel reordering. Alternatively, use your mouse to drag / reorder.';this.itemDescriptor=t=>`"${t.textContent.trim()}"`;this.grabbedHelperText=t=>`${this.itemDescriptor(t)} grabbed`;this.droppedHelperText=t=>`${this.itemDescriptor(t)} dropped`;this.reorderHelperText=(t,i,s)=>`The list has been reordered, ${this.itemDescriptor(t)} is now item ${s} of ${i.length}`;this.createKeyboardHandle=(t,i)=>{const s=`\n <nano-icon-button\n slot="end"\n icon-name="light/arrows"\n class="nano-sortable__keyboard-handle visually-hidden"\n ></nano-icon-button>`;const e=globalThis.document.createElement("div");e.innerHTML=s;const h=e.children[0];i.append(h);return h};this.sortableHostElement=undefined;this.animationEnabled=true;this.draggedClass="nano-sortable__dragged";this.handleDraggedClass="nano-sortable__handle-dragged";this.placeholderClass="nano-sortable__placeholder";this.dropzoneActiveClass="";this.animationTiming={duration:200,easing:"ease-out"};this.orientation=undefined;this.dragResize=false;this.keyboardSortActive=false;this.ariaTextList=[];this.handleTrack=this.handleTrack.bind(this);this.handleKeydown=this.handleKeydown.bind(this);this.refreshKeyboardHandles=this.refreshKeyboardHandles.bind(this);this.refreshKeyboardHandles=a(this.refreshKeyboardHandles,500)}connectedCallback(){this.addEventHandlers();this.refreshKeyboardHandles();this.attachMutationObserver();if(!this.host.querySelector(`#${this.sortableId}`)){this.host.insertAdjacentHTML("beforeend",`<div class="visually-hidden" id="${this.sortableId}">${this.helperText}</div>`)}}disconnectedCallback(){var t;this.removeEventHandlers();(t=this.host.querySelector(`#${this.sortableId}`))===null||t===void 0?void 0:t.remove();if(this.mutationObserver){this.mutationObserver.disconnect();this.mutationObserver=undefined}}render(){return h(n,null,h("div",{class:"sortable__live-region","aria-live":"polite","aria-relevant":"additions","aria-atomic":"true",role:"log",part:"announcements"},this.ariaTextList.map((t=>h("div",null,t)))),h("slot",null))}get host(){return r(this)}static get watchers(){return{itemSelector:["handleItemSelectorChange"],handleSelector:["handleHandleSelectorChange"],createKeyboardHandle:["handleCreateKeyboardHandleChange"],sortableHostElement:["handleSortableHostElement"]}}};c.style=l;export{c as nano_sortable};
5
- //# sourceMappingURL=p-241baff8.entry.js.map
4
+ import{w as t,r as i,c as s,d as e,h,a as n,g as r}from"./p-f6a8467a.js";import{d as o}from"./p-842cf127.js";import{d as a}from"./p-9746b0a5.js";const l=":host{box-sizing:border-box}*,*::before,*::after{box-sizing:border-box}[hidden]{display:none !important}:host{position:relative;display:block}.sortable__live-region{clip:rect(1px, 1px, 1px, 1px);-webkit-clip-path:inset(50%);clip-path:inset(50%);block-size:1px;inline-size:1px;margin:-1px;overflow:hidden;padding:0;position:absolute}";const d={horizontal:{x:1,y:0},vertical:{x:0,y:1}};let f=0;const c=class{handleItemSelectorChange(){this.refreshKeyboardHandles()}handleHandleSelectorChange(){this.refreshKeyboardHandles();this.attachMutationObserver()}handleCreateKeyboardHandleChange(){this.refreshKeyboardHandles()}handleSortableHostElement(t,i){if(i)this.removeEventHandlers(i);this.addEventHandlers();this.refreshKeyboardHandles();this.attachMutationObserver();if(this.sortableHostElement){this.sortableHostElement.style.position="relative"}}async refreshKeyboardHandles(){var t,i,s;if(this.handleSelector){if((t=this.keyboardHandleMap)===null||t===void 0?void 0:t.size){this.keyboardHandleMap.clear()}this.sortableHost.querySelectorAll(this.handleSelector).forEach((t=>{if(!t.getAttribute("aria-describedby"))t.setAttribute("aria-describedby",this.sortableId);const i=t.closest(this.itemSelector);if(i)this.keyboardHandleMap.set(t,i)}));return}if((i=this.keyboardHandleMap)===null||i===void 0?void 0:i.size){(s=this.keyboardHandleMap)===null||s===void 0?void 0:s.forEach(((t,i)=>i.remove()));this.keyboardHandleMap.clear()}this.sortableHost.querySelectorAll(this.itemSelector).forEach(((t,i)=>{const s=this.createKeyboardHandle(i,t);if(!s){console.error("`createKeyboardHandle` *must* return the handle element it creates");return}this.keyboardHandleMap.set(s,t);s.setAttribute("aria-describedby",this.sortableId)}))}get sortableHost(){if(this.sortableHostElement)return this.sortableHostElement;return this.host}addAriaMsg(t){this.ariaTextList=[...this.ariaTextList,t];setTimeout((()=>{const i=this.ariaTextList.indexOf(t);this.ariaTextList.splice(i,1);this.ariaTextList=[...this.ariaTextList]}),1e4)}updateUserSelectStyle(t){this.host.style.userSelect=t;this.host.style.MozUserSelect=t;this.host.style.msUserSelect=t;this.host.style.webkitUserSelect=t}hitTest(t,i){const{left:s,top:e,width:h,height:n}=t.getBoundingClientRect();const r=s+h/2;const o=e+n/2;return i.filter((t=>{const{left:i,right:s,top:e,bottom:h}=t.getBoundingClientRect();return!(r<i||r>s||o<e||o>h)}))}isAnimating(t){return this.animatedElements.indexOf(t)!==-1}animateNode(i,s=0,e=0){if(!i.animate){return}this.animatedElements.push(i);i.style.willChange="transform";t((()=>{this.animationPromise=new Promise((t=>{i.animate([{transform:`translate3d(${s}px, ${e}px, 0)`},{transform:"none"}],this.animationTiming).addEventListener("finish",(()=>{const s=this.animatedElements.indexOf(i);i.style.willChange="";if(s!==-1){this.animatedElements.splice(s,1)}t();delete this.animationPromise}),{once:true})}))}))}insertAtTarget(t,i){if(!t||!i)return;let s=[];if(this.animationEnabled){s=this.sortableNodes.map((t=>({x:t.offsetLeft,y:t.offsetTop})))}if(!t.isConnected||!i.isConnected)return;if(this.dropzoneNodes.indexOf(i)>-1){i.append(t)}else{const s=t.compareDocumentPosition(i);let e;if(s&this.host.DOCUMENT_POSITION_FOLLOWING){e=i.parentNode===t.parentNode?"afterend":"beforebegin"}if(s&this.host.DOCUMENT_POSITION_PRECEDING){e=i.parentNode===t.parentNode?"beforebegin":"afterend"}if(e)i.insertAdjacentElement(e,t)}if(this.animationEnabled){this.sortableNodes.forEach(((t,i)=>{const{x:e,y:h}=s[i];const n=e-t.offsetLeft;const r=h-t.offsetTop;if(n!==0||r!==0){this.animateNode(t,n,r)}}))}}reset(){if(this.draggedElementClone!==undefined&&this.draggedElementClone.parentNode!==null){this.draggedElementClone.parentNode.removeChild(this.draggedElementClone)}if(this.draggedElement&&this.draggedElement.parentNode&&this.draggedElementOrigin){this.draggedElement.classList.remove(this.placeholderClass)}if(this.dropzoneActiveClass&&this.dropzoneNodes.length){this.dropzoneNodes.forEach((t=>t.classList.remove(this.dropzoneActiveClass)))}delete this.draggedElementClone;delete this.draggedElement;this.dropzoneNodes=[];this.sortableNodes=[];this.animatedElements=[];this.dragRequestPending=false;this.updateUserSelectStyle("")}createClone(t){const i=t.cloneNode(true);if(t.id)i.id="clone__"+i.id;Array.from(i.children).forEach(((i,s)=>{const e=i;const h=t.children.item(s);if(h){e.style.width=`${h.offsetWidth}px`}}));const{offsetLeft:s,offsetTop:e,offsetWidth:h,offsetHeight:n}=t;Object.assign(i.style,{position:"absolute",left:`calc(${s}px - var(--grab-offset-x, 0px))`,top:`calc(${e}px - var(--grab-offset-y, 0px))`,height:this.dragResize?`${n}px`:undefined,width:this.dragResize?`${h}px`:undefined,willChange:"transform,opacity"});i.classList.add(this.draggedClass);return t.parentNode.appendChild(i)}removeEventHandlers(t){t=t||this.sortableHost;t.removeEventListener("mousedown",this.handleTrack);t.removeEventListener("touchstart",this.handleTrack);t.removeEventListener("keydown",this.handleKeydown)}addEventHandlers(t){t=t||this.sortableHost;t.addEventListener("mousedown",this.handleTrack);t.addEventListener("touchstart",this.handleTrack);t.addEventListener("keydown",this.handleKeydown)}attachMutationObserver(){if(this.mutationObserver){this.mutationObserver.disconnect();this.mutationObserver=undefined}this.mutationObserver=new MutationObserver((()=>{const t=Array.from(this.keyboardHandleMap.values());const i=Array.from(this.sortableHost.querySelectorAll(this.itemSelector));if(t.length!==i.length||!!i.find((i=>!t.includes(i)))){this.refreshKeyboardHandles()}}));this.mutationObserver.observe(this.sortableHost,{subtree:true,childList:true})}handleKeydown(t){const i=t.target;let s;let e;if(this.handleSelector){s=i.closest(this.handleSelector);e=i.closest(this.itemSelector)}else{e=this.keyboardHandleMap.get(i);s=i}if(!s||!e)return;const h=t=>{this.keyboardSortActive=t;this.draggedElement=t?e:undefined;e.classList.toggle(this.draggedClass,t);s.classList.toggle(this.handleDraggedClass,t);if(t){this.addAriaMsg(this.grabbedHelperText(e));document.addEventListener("mousedown",(()=>h(false)),{once:true})}else{this.addAriaMsg(this.droppedHelperText(e))}};if([" ","Space","Enter"].includes(t.key)){t.preventDefault();if(!this.keyboardSortActive){h(true);this.sortableNodes=Array.from(this.sortableHost.querySelectorAll(this.itemSelector))||[];const t=this.nanoGrabbed.emit({element:e,index:this.sortableNodes.indexOf(e)});if(t.defaultPrevented){h(false);return}}else{h(false);this.nanoDropped.emit({element:e})}return}if(!this.keyboardSortActive)return;if(["Escape","Tab"].includes(t.key))h(false);let n=["Home","End"];if(!this.orientation||this.orientation==="horizontal")n=[...n,"ArrowRight","ArrowLeft"];if(!this.orientation||this.orientation==="vertical")n=[...n,"ArrowUp","ArrowDown"];if(!n.includes(t.key))return;t.preventDefault();this.sortableNodes=Array.from(this.sortableHost.querySelectorAll(this.itemSelector))||[];this.dropzoneNodes=Array.from(this.sortableHost.querySelectorAll(this.dropzoneSelector))||[];const r=this.sortableNodes.indexOf(this.draggedElement);let o=-1;if(this.dropzoneNodes.length){const t=this.draggedElement.closest(this.dropzoneSelector);o=this.dropzoneNodes.indexOf(t);o=o>-1?o:-1}const a=r-1<0&&o>-1?this.dropzoneNodes[o-1]:this.sortableNodes[r-1];const l=r+1===this.sortableNodes.length&&o>-1?this.dropzoneNodes[o+1]:this.sortableNodes[r+1];if(t.key==="Home"){this.insertAtTarget(this.draggedElement,this.sortableNodes[0])}if(t.key==="End"){this.insertAtTarget(this.draggedElement,this.sortableNodes[this.sortableNodes.length-1])}if(["ArrowRight","ArrowDown"].includes(t.key)){this.insertAtTarget(this.draggedElement,l)}if(["ArrowLeft","ArrowUp"].includes(t.key)){this.insertAtTarget(this.draggedElement,a)}this.finishOrder();this.draggedElement=e;const d=()=>{requestAnimationFrame((()=>{typeof s["setFocus"]==="function"?s.setFocus():s.focus()}))};if(this.animationPromise)this.animationPromise.then((()=>d()));else d()}handleTrack(t){if(this.dragRequestPending||t.button&&t.button!==1)return;clearTimeout(this.mouseDownTimer);this.mouseDownTimer=window===null||window===void 0?void 0:window.setTimeout((()=>{if(!this.trackStart(t))return;this.addAriaMsg(this.grabbedHelperText(this.draggedElement));o(this.sortableHost,{initialEvent:t,relative:true,onMove:(t,i)=>{this.trackMove(t,i)},onStop:()=>{this.nanoDropped.emit({element:this.draggedElement});const t=()=>{this.addAriaMsg(this.droppedHelperText(this.draggedElement));requestAnimationFrame((()=>this.finishOrder()))};if(this.animationPromise){this.animationPromise.then((()=>t()))}else t()}})}),100);document.addEventListener("mouseup",(()=>clearTimeout(this.mouseDownTimer)),{once:true})}trackStart(t){const i=t.target;let s;if(this.handleSelector){s=i.closest(this.handleSelector);if(!s)return;s.classList.add(this.handleDraggedClass)}const e=i.closest(this.itemSelector);if(!e)return false;this.sortableNodes=Array.from(this.sortableHost.querySelectorAll(this.itemSelector))||[];const h=this.nanoGrabbed.emit({element:e,index:this.sortableNodes.indexOf(e)});if(h.defaultPrevented)return false;t.preventDefault();this.updateUserSelectStyle("none");this.dragRequestPending=true;this.draggedElement=e;this.dropzoneNodes=Array.from(this.sortableHost.querySelectorAll(this.dropzoneSelector))||[];this.draggedElementClone=this.createClone(e);this.draggedElementOrigin=e.nextSibling;this.animatedElements=[];this.draggedElement.classList.add(this.placeholderClass);return true}finishOrder(){if(!this.draggedElement)return;const t=Array.from(this.sortableHost.querySelectorAll(this.itemSelector)).filter((t=>t!==this.draggedElementClone));const i=this.sortableNodes.indexOf(this.draggedElement);const s=t.indexOf(this.draggedElement);if(this.handleSelector){const t=this.draggedElement.querySelector(this.handleSelector);t.classList.remove(this.handleDraggedClass)}if(i!==s){const e=this.nanoOrderChange.emit({element:this.draggedElement,originalIndex:i,targetIndex:s});if(e.defaultPrevented){this.animationPromise=new Promise((s=>{setTimeout((()=>{this.insertAtTarget(this.draggedElement,t[i]);this.reset();this.dragRequestPending=false;s()}),200)}));return}this.addAriaMsg(this.reorderHelperText(this.draggedElement,t,s+1))}this.reset();this.dragRequestPending=false}constructor(h){i(this,h);this.nanoOrderChange=s(this,"nanoOrderChange",7);this.nanoGrabbed=s(this,"nanoGrabbed",7);this.nanoDropped=s(this,"nanoDropped",7);this.dragRequestPending=false;this.sortableNodes=[];this.dropzoneNodes=[];this.animatedElements=[];this.keyboardHandleMap=new Map;this.sortableId=`nano-sortable-${f++}`;this.trackMove=(i,s)=>{if(!this.draggedElementClone){return}if(this.orientation){i=i*d[this.orientation].x;s=s*d[this.orientation].y}t((()=>{Object.assign(this.draggedElementClone.style,{transform:`translate3d(${i}px, ${s}px, 0)`})}));let h=this.hitTest(this.draggedElementClone,this.sortableNodes)[0];let n;if(this.dropzoneSelector&&this.dropzoneActiveClass){e((()=>{n=this.draggedElement.closest(this.dropzoneSelector);t((()=>{this.dropzoneNodes.filter((t=>t!==n)).forEach((t=>t.classList.remove(this.dropzoneActiveClass)));n.classList.add(this.dropzoneActiveClass)}))}))}if(!h&&this.dropzoneNodes.length){h=this.hitTest(this.draggedElementClone,this.dropzoneNodes)[0];if(this.draggedElement.closest(this.dropzoneSelector)===h)return}if(h&&h!==this.draggedElement&&!this.isAnimating(h)){this.insertAtTarget(this.draggedElement,h)}};this.itemSelector="li";this.handleSelector=undefined;this.dropzoneSelector=undefined;this.helperText='Press "Space" or "Enter" to enable element reordering and use the arrow keys to reorder items.'+'Press "Escape" to cancel reordering. Alternatively, use your mouse to drag / reorder.';this.itemDescriptor=t=>`"${t.textContent.trim()}"`;this.grabbedHelperText=t=>`${this.itemDescriptor(t)} grabbed`;this.droppedHelperText=t=>`${this.itemDescriptor(t)} dropped`;this.reorderHelperText=(t,i,s)=>`The list has been reordered, ${this.itemDescriptor(t)} is now item ${s} of ${i.length}`;this.createKeyboardHandle=(t,i)=>{const s=`\n <nano-icon-button\n slot="end"\n icon-name="light/arrows"\n class="nano-sortable__keyboard-handle visually-hidden"\n label="Re-order this item"\n ></nano-icon-button>`;const e=globalThis.document.createElement("div");e.innerHTML=s;const h=e.children[0];i.append(h);return h};this.sortableHostElement=undefined;this.animationEnabled=true;this.draggedClass="nano-sortable__dragged";this.handleDraggedClass="nano-sortable__handle-dragged";this.placeholderClass="nano-sortable__placeholder";this.dropzoneActiveClass="";this.animationTiming={duration:200,easing:"ease-out"};this.orientation=undefined;this.dragResize=false;this.keyboardSortActive=false;this.ariaTextList=[];this.handleTrack=this.handleTrack.bind(this);this.handleKeydown=this.handleKeydown.bind(this);this.refreshKeyboardHandles=this.refreshKeyboardHandles.bind(this);this.refreshKeyboardHandles=a(this.refreshKeyboardHandles,500)}connectedCallback(){this.addEventHandlers();this.refreshKeyboardHandles();this.attachMutationObserver();if(!this.host.querySelector(`#${this.sortableId}`)){this.host.insertAdjacentHTML("beforeend",`<div class="visually-hidden" id="${this.sortableId}">${this.helperText}</div>`)}}disconnectedCallback(){var t;this.removeEventHandlers();(t=this.host.querySelector(`#${this.sortableId}`))===null||t===void 0?void 0:t.remove();if(this.mutationObserver){this.mutationObserver.disconnect();this.mutationObserver=undefined}}render(){return h(n,null,h("div",{class:"sortable__live-region","aria-live":"polite","aria-relevant":"additions","aria-atomic":"true",role:"log",part:"announcements"},this.ariaTextList.map((t=>h("div",null,t)))),h("slot",null))}get host(){return r(this)}static get watchers(){return{itemSelector:["handleItemSelectorChange"],handleSelector:["handleHandleSelectorChange"],createKeyboardHandle:["handleCreateKeyboardHandleChange"],sortableHostElement:["handleSortableHostElement"]}}};c.style=l;export{c as nano_sortable};
5
+ //# sourceMappingURL=p-d79c6862.entry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["sortableCss","orientationMap","horizontal","x","y","vertical","sortableIds","Sortable","handleItemSelectorChange","this","refreshKeyboardHandles","handleHandleSelectorChange","attachMutationObserver","handleCreateKeyboardHandleChange","handleSortableHostElement","_newVal","oldVal","removeEventHandlers","addEventHandlers","sortableHostElement","style","position","async","handleSelector","_a","keyboardHandleMap","size","clear","sortableHost","querySelectorAll","forEach","handle","getAttribute","setAttribute","sortableId","sortEle","closest","itemSelector","set","_b","_c","_ele","remove","ele","i","createKeyboardHandle","console","error","host","addAriaMsg","msg","ariaTextList","setTimeout","mIdx","indexOf","splice","updateUserSelectStyle","userSelect","MozUserSelect","msUserSelect","webkitUserSelect","hitTest","node","targets","left","l","top","t","width","w","height","h","getBoundingClientRect","filter","item","right","bottom","isAnimating","animatedElements","animateNode","dx","dy","animate","push","willChange","writeTask","animationPromise","Promise","resolve","transform","animationTiming","addEventListener","index","once","insertAtTarget","target","offsets","animationEnabled","sortableNodes","map","offsetLeft","offsetTop","isConnected","dropzoneNodes","append","nodeComparison","compareDocumentPosition","DOCUMENT_POSITION_FOLLOWING","parentNode","DOCUMENT_POSITION_PRECEDING","insertAdjacentElement","sortableNode","reset","draggedElementClone","undefined","removeChild","draggedElement","draggedElementOrigin","classList","placeholderClass","dropzoneActiveClass","length","dze","dragRequestPending","createClone","clone","cloneNode","id","Array","from","children","nodeChild","clonedNodeChild","originalNodeChild","offsetWidth","offsetHeight","Object","assign","dragResize","add","draggedClass","appendChild","removeEventListener","handleTrack","handleKeydown","mutationObserver","disconnect","MutationObserver","currHandles","values","newHandles","find","includes","observe","subtree","childList","e","targetElement","foundHandle","get","activateSort","isActive","keyboardSortActive","toggle","handleDraggedClass","grabbedHelperText","document","droppedHelperText","key","preventDefault","nanoGrabbedEv","nanoGrabbed","emit","element","defaultPrevented","nanoDropped","moveKeys","orientation","dropzoneSelector","currIdx","curDzIdx","curDropzone","prevEle","nextEle","finishOrder","focus","requestAnimationFrame","setFocus","then","button","clearTimeout","mouseDownTimer","window","trackStart","drag","initialEvent","relative","onMove","trackMove","onStop","didStop","targetHandle","nextSibling","updated","originalIndex","targetIndex","querySelector","orderChangeEv","nanoOrderChange","reorderHelperText","constructor","hostRef","Map","activeDropzone","readTask","el","textContent","trim","itemDescriptor","elements","_number","_element","handleTpl","div","globalThis","createElement","innerHTML","duration","easing","bind","nanoDebounce","connectedCallback","insertAdjacentHTML","helperText","disconnectedCallback","render","Host","class","role","part","str"],"sources":["./src/components/sortable/sortable.scss?tag=nano-sortable&encapsulation=shadow","./src/components/sortable/sortable.tsx"],"sourcesContent":["@use '../../global/style/utilities/globals' as g;\n\n:host {\n position: relative;\n display: block;\n}\n\n.sortable__live-region {\n @include g.visually-hide();\n}\n","import {\n Prop,\n Element,\n Event,\n EventEmitter,\n h,\n Component,\n ComponentInterface,\n Watch,\n Method,\n State,\n Host,\n readTask,\n writeTask,\n Build,\n} from '@stencil/core';\nimport { drag } from '../../utils/drag';\nimport { nanoDebounce } from '../..';\n\n// Orientation map to limit dragging to horizontal or vertical.\nconst orientationMap = {\n horizontal: { x: 1, y: 0 },\n vertical: { x: 0, y: 1 },\n};\n\nlet sortableIds = 0;\n\n/**\n * An accessible and flexible re-order / sort utility component.\n *\n *- Drag and drop via mouse, touch or keyboard\n *- Live announcements for screen readers\n *- Works with or without an explicit handle (although with is preferable)\n\n * @part announcements - the a11y, live region. Visually hidden by default\n *\n * @slot - The default slot containing any items you might want to sort\n */\n@Component({\n tag: 'nano-sortable',\n shadow: true,\n styleUrl: 'sortable.scss',\n})\nexport class Sortable implements ComponentInterface {\n /// Public API & surface ///\n\n /** A css query selector which matches a set of elements that should be sortable. e.g. `<li>` or `<tr>` */\n @Prop() itemSelector = 'li';\n @Watch('itemSelector')\n handleItemSelectorChange() {\n this.refreshKeyboardHandles();\n }\n\n /** A css query selector which matches an element *within* the `itemSelector` element\n * which will act like a drag handle. **Note** For keyboard a11y it's recommended\n * to use `handleSelector` when possible. Alternatively, the `createKeyboardHandle` prop will be used */\n @Prop() handleSelector?: string;\n @Watch('handleSelector')\n handleHandleSelectorChange() {\n this.refreshKeyboardHandles();\n this.attachMutationObserver();\n }\n\n /** When dragging between grouped collections of items, it is possible to drag all sortable items from one group to another.\n * At that point, you will not be able to drag items back to the original group.\n * A `dropzoneSelector` allows you to define a placeholder area where items can always be dropped.\n */\n @Prop() dropzoneSelector?: string;\n\n /** Accessibility helper text applied to handle controls */\n @Prop() helperText =\n 'Press \"Space\" or \"Enter\" to enable element reordering and use the arrow keys to reorder items.' +\n 'Press \"Escape\" to cancel reordering. Alternatively, use your mouse to drag / reorder.';\n\n /**\n * As a sortable element is interacted with, announcements are made to screen readers\n * - informing the user what is changing.\n * By default, the text from the element is extracted to describe the interacted with element.\n * Use this function to provide a more meaningful, concise item descriptor\n * @param el the element being interacted with\n * @returns a string, describing the element being interacted with\n */\n @Prop() itemDescriptor = (el: Element) => `\"${el.textContent.trim()}\"`;\n\n /**\n * Used to generate a screen reader live update, informing the user of the current element being grabbed.\n * @param el the element that has been grabbed by the user\n * @returns a string, describing the element being grabbed\n */\n @Prop() grabbedHelperText = (el: Element) =>\n `${this.itemDescriptor(el)} grabbed`;\n\n /**\n * Used to generate a screen reader live update, informing the user of the current element being dropped.\n * @param el the element that has been dropped by the user\n * @returns a string, describing the element that has been dropped\n */\n @Prop() droppedHelperText = (el: Element) =>\n `${this.itemDescriptor(el)} dropped`;\n\n /**\n * Used to generate a screen reader live update, informing the user when items have been reordered.\n * @param el the element that has been reordered by the user\n * @param elements the elements in the sortable list\n * @param position the new position of the dropped element\n * @returns a string, describing the element being dropped\n */\n @Prop() reorderHelperText = (\n el: Element,\n elements: Element[],\n position: number\n ) =>\n `The list has been reordered, ${this.itemDescriptor(\n el\n )} is now item ${position} of ${elements.length}`;\n\n /**\n * A function that should attach a keyboard accessible control.\n * When a `handleSelector` is not used - to allow keyboard accessibility -\n * `createKeyboardHandle` should render a focusable element.\n *\n * If your sortable item is itself focusable,\n * you must use this function to render a control *outside* of the focusable element.\n * @param _number\n * @param _element\n * @returns a function that attaches a keyboard accessible handle control element.\n * The function itself *must* return the handle element.\n */\n @Prop() createKeyboardHandle = (_number: number, _element: Element) => {\n const handleTpl = /* html */ `\n <nano-icon-button\n slot=\"end\"\n icon-name=\"light/arrows\"\n class=\"nano-sortable__keyboard-handle visually-hidden\"\n label=\"Re-order this item\"\n ></nano-icon-button>`;\n const div = globalThis.document.createElement('div');\n div.innerHTML = handleTpl;\n\n const handle = div.children[0] as HTMLElement;\n _element.append(handle);\n return handle;\n };\n @Watch('createKeyboardHandle')\n handleCreateKeyboardHandleChange() {\n this.refreshKeyboardHandles();\n }\n\n /** use `sortableHostElement` to watch a sortable list without needing to wrap in `nano-sortable`.\n * Note that the `sortableHostElement` element css `position` will be set to `relative` */\n @Prop() sortableHostElement?: HTMLElement;\n @Watch('sortableHostElement')\n handleSortableHostElement(_newVal?, oldVal?: HTMLElement) {\n if (oldVal) this.removeEventHandlers(oldVal);\n\n this.addEventHandlers();\n this.refreshKeyboardHandles();\n this.attachMutationObserver();\n\n if (this.sortableHostElement) {\n // sortable host must have position relative\n this.sortableHostElement.style.position = 'relative';\n }\n }\n\n /** Items being sorted will animate into place */\n @Prop() animationEnabled = true;\n\n /** Use this class to change how the element looks whilst being sorted */\n @Prop() draggedClass = 'nano-sortable__dragged';\n\n /** Use this class to change how the handle looks whilst being sorted */\n @Prop() handleDraggedClass = 'nano-sortable__handle-dragged';\n\n /** Use this class to change how the element looks when acting as a placeholder */\n @Prop() placeholderClass = 'nano-sortable__placeholder';\n\n /** Used in-conjunction with `dropzoneSelector`, applied when a dropzone is dragged over */\n @Prop() dropzoneActiveClass?: string = '';\n\n /** The css animation timing applied when `animationEnabled` is `true` */\n @Prop() animationTiming: any = { duration: 200, easing: 'ease-out' };\n\n /** The axis to lock dragging elements to. `undefined` means any axis */\n @Prop() orientation?: 'horizontal' | 'vertical';\n\n /** Dragged items by default, will take whatever default css is applied in situ.\n * When sortable items' dimensions are dynamic (i.e they can shrink / grow via the space allowed) dragging items can look 'wrong'.\n * Apply `dragResize` to read & recreate the dragged items current dimensions when dragged. */\n @Prop() dragResize = false;\n\n /** Fired when an the order changes. Use this to update any underlying data model.\n * `event.preventDefault()` to prevent the element being moved; will revert to original position. */\n @Event() nanoOrderChange: EventEmitter<{\n element: HTMLElement;\n originalIndex: number;\n targetIndex: number;\n }>;\n\n /** Fired when a sortable element is picked-up; via keyboard, mouse or touch.\n * `event.preventDefault()` to prevent the element being picked-up. */\n @Event() nanoGrabbed: EventEmitter<{ element: HTMLElement; index: number }>;\n\n /** Fired when a sortable element is dropped after having been picked up. */\n @Event() nanoDropped: EventEmitter<{ element: HTMLElement }>;\n\n /** If sortable elements change dynamically, use this method to add handle controls to new elements */\n @Method()\n async refreshKeyboardHandles() {\n if (this.handleSelector) {\n if (this.keyboardHandleMap?.size) {\n this.keyboardHandleMap.clear();\n }\n\n this.sortableHost\n .querySelectorAll<HTMLElement>(this.handleSelector)\n .forEach((handle) => {\n if (!handle.getAttribute('aria-describedby'))\n handle.setAttribute('aria-describedby', this.sortableId);\n const sortEle = handle.closest<HTMLElement>(this.itemSelector);\n if (sortEle) this.keyboardHandleMap.set(handle, sortEle);\n });\n return;\n }\n\n if (this.keyboardHandleMap?.size) {\n this.keyboardHandleMap?.forEach((_ele, handle) => handle.remove());\n this.keyboardHandleMap.clear();\n }\n this.sortableHost\n .querySelectorAll<HTMLElement>(this.itemSelector)\n .forEach((ele, i) => {\n const handle = this.createKeyboardHandle(i, ele);\n if (!handle) {\n console.error(\n '`createKeyboardHandle` *must* return the handle element it creates'\n );\n return;\n }\n this.keyboardHandleMap.set(handle, ele);\n handle.setAttribute('aria-describedby', this.sortableId);\n });\n }\n\n /// Private state & logic ///\n\n @Element() host: HTMLNanoSortableElement;\n private dragRequestPending = false;\n private draggedElement?: HTMLElement;\n private draggedElementClone?: HTMLElement;\n private draggedElementOrigin?: HTMLElement;\n private sortableNodes: HTMLElement[] = [];\n private dropzoneNodes: HTMLElement[] = [];\n private animatedElements: HTMLElement[] = [];\n private animationPromise?: Promise<void>;\n private keyboardHandleMap: Map<HTMLElement, HTMLElement> = new Map();\n private sortableId = `nano-sortable-${sortableIds++}`;\n private mouseDownTimer: number;\n private mutationObserver: MutationObserver;\n\n @State() keyboardSortActive = false;\n @State() ariaTextList: string[] = [];\n\n /**\n * Get instance of sortable host.\n * By default it is `nano-sortable` which can be overridden by property `sortableHostElement`\n */\n get sortableHost() {\n if (this.sortableHostElement) return this.sortableHostElement;\n return this.host;\n }\n\n /**\n * Queues aria messages which are then displayed in a 'live' region.\n * Messages are cleared after 10s\n * @param msg aria message to announce\n */\n private addAriaMsg(msg: string) {\n this.ariaTextList = [...this.ariaTextList, msg];\n\n setTimeout(() => {\n const mIdx = this.ariaTextList.indexOf(msg);\n this.ariaTextList.splice(mIdx, 1);\n this.ariaTextList = [...this.ariaTextList];\n }, 10000);\n }\n\n /**\n * Try to stop text highlight whilst dragging\n * @param userSelect\n */\n private updateUserSelectStyle(userSelect: '' | 'none') {\n this.host.style.userSelect = userSelect;\n // @ts-ignore\n this.host.style.MozUserSelect = userSelect;\n // @ts-ignore\n this.host.style.msUserSelect = userSelect;\n this.host.style.webkitUserSelect = userSelect;\n }\n\n /**\n * Fast and simple hit test to check whether the center of a node intersects with the rectangle of any of the\n * given targets. Returns an array of matches.\n * @param node\n * @param targets\n * @returns all the items that currently intersect with the target node\n */\n private hitTest(node: HTMLElement, targets: HTMLElement[]): HTMLElement[] {\n const {\n left: l,\n top: t,\n width: w,\n height: h,\n } = node.getBoundingClientRect();\n const x = l + w / 2;\n const y = t + h / 2;\n\n return targets.filter((item) => {\n const { left, right, top, bottom } = item.getBoundingClientRect();\n return !(x < left || x > right || y < top || y > bottom);\n });\n }\n\n /**\n * Returns a boolean indicating whether the node is currently in an animation.\n * @param node\n * @returns whether a node is currently animating or not\n */\n private isAnimating(node: HTMLElement) {\n return this.animatedElements.indexOf(node) !== -1;\n }\n\n /**\n * Triggers a CSS animation on a node with the given dx and dy. Used following dom updates to make it appear as\n * if nodes animate from their old to their new position in the dom. */\n private animateNode(node: HTMLElement, dx = 0, dy = 0) {\n if (!node.animate) {\n return;\n }\n\n // keep a stack of currently animating nodes to exclude as drag & drop targets.\n this.animatedElements.push(node);\n\n node.style.willChange = 'transform';\n\n // animate from dx/dy (old node position) to none (new node position)\n writeTask(() => {\n this.animationPromise = new Promise((resolve) => {\n node\n .animate(\n [\n { transform: `translate3d(${dx}px, ${dy}px, 0)` },\n { transform: 'none' },\n ],\n this.animationTiming\n )\n .addEventListener(\n 'finish',\n () => {\n const index = this.animatedElements.indexOf(node);\n node.style.willChange = '';\n\n if (index !== -1) {\n // splice out when done to unlock as a valid target\n this.animatedElements.splice(index, 1);\n }\n\n resolve();\n delete this.animationPromise;\n },\n { once: true }\n );\n });\n });\n }\n\n /**\n * Inserts node at target to update sibling sorting. If the node precedes the target, it is inserted after it;\n * If it follows the target, it is inserted before it. This ensures any node can be dragged from the very\n * beginning to the very end and vice versa. The animateNode function is called for all nodes that moved because\n * of this dom update */\n private insertAtTarget(node: Element, target: HTMLElement) {\n if (!node || !target) return;\n\n let offsets: any[] = [];\n if (this.animationEnabled) {\n offsets = this.sortableNodes.map((item) => ({\n x: item.offsetLeft,\n y: item.offsetTop,\n }));\n }\n\n if (!node.isConnected || !target.isConnected) return;\n\n if (this.dropzoneNodes.indexOf(target) > -1) {\n target.append(node);\n } else {\n const nodeComparison = node.compareDocumentPosition(target);\n let position;\n\n if (nodeComparison & this.host.DOCUMENT_POSITION_FOLLOWING) {\n position =\n target.parentNode === node.parentNode ? 'afterend' : 'beforebegin';\n }\n if (nodeComparison & this.host.DOCUMENT_POSITION_PRECEDING) {\n position =\n target.parentNode === node.parentNode ? 'beforebegin' : 'afterend';\n }\n if (position) target.insertAdjacentElement(position, node);\n }\n\n if (this.animationEnabled) {\n this.sortableNodes.forEach((sortableNode, i) => {\n const { x, y } = offsets[i];\n const dx = x - sortableNode.offsetLeft;\n const dy = y - sortableNode.offsetTop;\n if (dx !== 0 || dy !== 0) {\n this.animateNode(sortableNode, dx, dy);\n }\n });\n }\n }\n\n private reset() {\n if (\n this.draggedElementClone !== undefined &&\n this.draggedElementClone.parentNode !== null\n ) {\n this.draggedElementClone.parentNode.removeChild(this.draggedElementClone);\n }\n\n if (\n this.draggedElement &&\n this.draggedElement.parentNode &&\n this.draggedElementOrigin\n ) {\n this.draggedElement.classList.remove(this.placeholderClass);\n }\n\n if (this.dropzoneActiveClass && this.dropzoneNodes.length) {\n this.dropzoneNodes.forEach((dze) =>\n dze.classList.remove(this.dropzoneActiveClass)\n );\n }\n\n delete this.draggedElementClone;\n delete this.draggedElement;\n\n this.dropzoneNodes = [];\n this.sortableNodes = [];\n this.animatedElements = [];\n this.dragRequestPending = false;\n this.updateUserSelectStyle('');\n }\n\n /**\n * Clones a given node to visually drag around. The original node is left in the same flow as its siblings.\n * Clone styles are added onto the style object directly, since the ::slotted()\n * selector can't universally target nodes that may be nested an unknown amount of shadow dom levels deep\n * @param node html node to clone\n * @returns the cloned html node\n */\n private createClone(node: HTMLElement): HTMLElement {\n const clone = node.cloneNode(true) as HTMLElement;\n if (node.id) clone.id = 'clone__' + clone.id;\n\n /**\n * Bugfix for table row sorting.\n * During dragging table rows shrink, so we manually set them width of original node.\n */\n Array.from(clone.children).forEach((nodeChild: HTMLElement, index) => {\n const clonedNodeChild = nodeChild;\n const originalNodeChild = node.children.item(index) as HTMLElement;\n\n if (originalNodeChild) {\n clonedNodeChild.style.width = `${originalNodeChild.offsetWidth}px`;\n }\n });\n const {\n offsetLeft: x,\n offsetTop: y,\n offsetWidth: w,\n offsetHeight: h,\n } = node;\n\n Object.assign(clone.style, {\n position: 'absolute',\n left: `calc(${x}px - var(--grab-offset-x, 0px))`,\n top: `calc(${y}px - var(--grab-offset-y, 0px))`,\n height: this.dragResize ? `${h}px` : undefined,\n width: this.dragResize ? `${w}px` : undefined,\n willChange: 'transform,opacity',\n });\n\n clone.classList.add(this.draggedClass);\n\n return node.parentNode!.appendChild(clone);\n }\n\n /// Event handlers ///\n\n private removeEventHandlers(ele?: HTMLElement) {\n ele = ele || this.sortableHost;\n ele.removeEventListener('mousedown', this.handleTrack);\n ele.removeEventListener('touchstart', this.handleTrack);\n ele.removeEventListener('keydown', this.handleKeydown);\n }\n\n private addEventHandlers(ele?: HTMLElement) {\n ele = ele || this.sortableHost;\n ele.addEventListener('mousedown', this.handleTrack);\n ele.addEventListener('touchstart', this.handleTrack);\n ele.addEventListener('keydown', this.handleKeydown);\n }\n\n /**\n * Watch for any changes in grab-able handle elements.\n */\n private attachMutationObserver() {\n if (!Build.isBrowser) return;\n\n if (this.mutationObserver) {\n this.mutationObserver.disconnect();\n this.mutationObserver = undefined;\n }\n\n this.mutationObserver = new MutationObserver(() => {\n const currHandles = Array.from(this.keyboardHandleMap.values());\n const newHandles = Array.from(\n this.sortableHost.querySelectorAll<HTMLElement>(this.itemSelector)\n );\n\n // simple test for equality\n if (\n currHandles.length !== newHandles.length ||\n !!newHandles.find((h) => !currHandles.includes(h))\n ) {\n this.refreshKeyboardHandles();\n }\n });\n this.mutationObserver.observe(this.sortableHost, {\n subtree: true,\n childList: true,\n });\n }\n\n private handleKeydown(e: KeyboardEvent) {\n const targetElement = e.target as HTMLElement;\n let foundHandle: HTMLElement;\n let sortEle: HTMLElement;\n\n if (this.handleSelector) {\n foundHandle = targetElement.closest(this.handleSelector);\n sortEle = targetElement.closest(this.itemSelector);\n } else {\n sortEle = this.keyboardHandleMap.get(targetElement);\n foundHandle = targetElement;\n }\n\n // have we found a handle and matching sort element from the keydown element\n if (!foundHandle || !sortEle) return;\n\n const activateSort = (isActive: boolean) => {\n this.keyboardSortActive = isActive;\n this.draggedElement = isActive ? sortEle : undefined;\n sortEle.classList.toggle(this.draggedClass, isActive);\n foundHandle.classList.toggle(this.handleDraggedClass, isActive);\n\n if (isActive) {\n this.addAriaMsg(this.grabbedHelperText(sortEle));\n document.addEventListener('mousedown', () => activateSort(false), {\n once: true,\n });\n } else {\n this.addAriaMsg(this.droppedHelperText(sortEle));\n }\n };\n\n // start editing this element's order?\n if ([' ', 'Space', 'Enter'].includes(e.key)) {\n e.preventDefault();\n\n if (!this.keyboardSortActive) {\n // grabbed the element\n activateSort(true);\n\n this.sortableNodes =\n Array.from(this.sortableHost.querySelectorAll(this.itemSelector)) ||\n [];\n const nanoGrabbedEv = this.nanoGrabbed.emit({\n element: sortEle,\n index: this.sortableNodes.indexOf(sortEle),\n });\n\n if (nanoGrabbedEv.defaultPrevented) {\n activateSort(false);\n return;\n }\n } else {\n // dropped the element\n activateSort(false);\n this.nanoDropped.emit({ element: sortEle });\n }\n return;\n }\n if (!this.keyboardSortActive) return;\n\n // Tabbing away from this handle - deactivate\n if (['Escape', 'Tab'].includes(e.key)) activateSort(false);\n\n let moveKeys = ['Home', 'End'];\n if (!this.orientation || this.orientation === 'horizontal')\n moveKeys = [...moveKeys, 'ArrowRight', 'ArrowLeft'];\n if (!this.orientation || this.orientation === 'vertical')\n moveKeys = [...moveKeys, 'ArrowUp', 'ArrowDown'];\n\n if (!moveKeys.includes(e.key)) return;\n\n // move the element with the keyboard\n e.preventDefault();\n\n /** Collect all elements that have drag positions.\n * Both sortable elements and 'dropzones' (placeholders where items can always be placed) */\n\n this.sortableNodes =\n Array.from(this.sortableHost.querySelectorAll(this.itemSelector)) || [];\n this.dropzoneNodes =\n Array.from(this.sortableHost.querySelectorAll(this.dropzoneSelector)) ||\n [];\n const currIdx = this.sortableNodes.indexOf(this.draggedElement);\n let curDzIdx: number = -1;\n\n if (this.dropzoneNodes.length) {\n const curDropzone = this.draggedElement.closest<HTMLElement>(\n this.dropzoneSelector\n );\n curDzIdx = this.dropzoneNodes.indexOf(curDropzone);\n curDzIdx = curDzIdx > -1 ? curDzIdx : -1;\n }\n\n /** If we don't have a next / prev sortable element in our list, test to see if there's a dropzone instead */\n const prevEle =\n currIdx - 1 < 0 && curDzIdx > -1\n ? this.dropzoneNodes[curDzIdx - 1]\n : this.sortableNodes[currIdx - 1];\n const nextEle =\n currIdx + 1 === this.sortableNodes.length && curDzIdx > -1\n ? this.dropzoneNodes[curDzIdx + 1]\n : this.sortableNodes[currIdx + 1];\n\n if (e.key === 'Home') {\n this.insertAtTarget(this.draggedElement, this.sortableNodes[0]);\n }\n if (e.key === 'End') {\n this.insertAtTarget(\n this.draggedElement,\n this.sortableNodes[this.sortableNodes.length - 1]\n );\n }\n if (['ArrowRight', 'ArrowDown'].includes(e.key)) {\n this.insertAtTarget(this.draggedElement, nextEle);\n }\n if (['ArrowLeft', 'ArrowUp'].includes(e.key)) {\n this.insertAtTarget(this.draggedElement, prevEle);\n }\n\n this.finishOrder();\n this.draggedElement = sortEle;\n\n const focus = () => {\n requestAnimationFrame(() => {\n typeof foundHandle['setFocus'] === 'function'\n ? (foundHandle as HTMLNanoIconButtonElement).setFocus()\n : foundHandle.focus();\n });\n };\n\n // replace focus to handle so we don't 'drop' the element\n if (this.animationPromise) this.animationPromise.then(() => focus());\n else focus();\n }\n\n /**\n * Tracks a pointer from touchstart/mousedown to touchend/mouseup. Note that the start state is fired following\n * the first actual move event following a touchstart/mousedown */\n private handleTrack(e: PointerEvent) {\n if (this.dragRequestPending || (e.button && e.button !== 1)) return;\n\n clearTimeout(this.mouseDownTimer);\n this.mouseDownTimer = window?.setTimeout(() => {\n if (!this.trackStart(e)) return;\n\n this.addAriaMsg(this.grabbedHelperText(this.draggedElement));\n\n drag(this.sortableHost, {\n initialEvent: e,\n relative: true,\n onMove: (x, y) => {\n this.trackMove(x, y);\n },\n onStop: () => {\n this.nanoDropped.emit({ element: this.draggedElement });\n\n const didStop = () => {\n this.addAriaMsg(this.droppedHelperText(this.draggedElement));\n requestAnimationFrame(() => this.finishOrder());\n };\n if (this.animationPromise) {\n this.animationPromise.then(() => didStop());\n } else didStop();\n },\n });\n }, 100);\n document.addEventListener(\n 'mouseup',\n () => clearTimeout(this.mouseDownTimer),\n { once: true }\n );\n }\n\n /**\n * Initialized a drag and drop sequence if a child node was clicked that matches the itemSelector property.\n * OR If a handleSelector is defined, a node matching this selector must be clicked instead\n * @returns boolean - whether tracking for this event should continue or not\n */\n private trackStart(e: Event) {\n const targetElement = e.target as HTMLElement;\n let targetHandle: HTMLElement;\n\n // If we have a handle set, return now if not being pressed\n if (this.handleSelector) {\n targetHandle = targetElement.closest(this.handleSelector);\n\n if (!targetHandle) return;\n targetHandle.classList.add(this.handleDraggedClass);\n }\n\n // Check that we've found the target element via itemSelector\n const node = targetElement.closest<HTMLElement>(this.itemSelector);\n if (!node) return false;\n\n this.sortableNodes =\n Array.from(this.sortableHost.querySelectorAll(this.itemSelector)) || [];\n const nanoGrabbedEv = this.nanoGrabbed.emit({\n element: node,\n index: this.sortableNodes.indexOf(node),\n });\n if (nanoGrabbedEv.defaultPrevented) return false;\n\n // Element found... start everything\n e.preventDefault();\n this.updateUserSelectStyle('none');\n this.dragRequestPending = true;\n this.draggedElement = node;\n this.dropzoneNodes =\n Array.from(this.sortableHost.querySelectorAll(this.dropzoneSelector)) ||\n [];\n this.draggedElementClone = this.createClone(node);\n this.draggedElementOrigin = node.nextSibling as HTMLElement;\n this.animatedElements = [];\n this.draggedElement!.classList.add(this.placeholderClass);\n return true;\n }\n\n /** Ends re-ordering */\n private finishOrder() {\n if (!this.draggedElement) return;\n\n const updated = Array.from(\n this.sortableHost.querySelectorAll<HTMLElement>(this.itemSelector)\n ).filter((ele) => ele !== this.draggedElementClone);\n const originalIndex = this.sortableNodes.indexOf(this.draggedElement);\n const targetIndex = updated.indexOf(this.draggedElement);\n\n if (this.handleSelector) {\n const targetHandle = this.draggedElement.querySelector(\n this.handleSelector\n );\n targetHandle.classList.remove(this.handleDraggedClass);\n }\n\n if (originalIndex !== targetIndex) {\n const orderChangeEv = this.nanoOrderChange.emit({\n element: this.draggedElement,\n originalIndex,\n targetIndex,\n });\n\n if (orderChangeEv.defaultPrevented) {\n /** Event was prevented, wait a moment to send element back to whence it came - gives a nicer visual queue */\n this.animationPromise = new Promise((resolve) => {\n setTimeout(() => {\n this.insertAtTarget(this.draggedElement, updated[originalIndex]);\n this.reset();\n this.dragRequestPending = false;\n resolve();\n }, 200);\n });\n return;\n }\n this.addAriaMsg(\n this.reorderHelperText(this.draggedElement, updated, targetIndex + 1)\n );\n }\n\n this.reset();\n this.dragRequestPending = false;\n }\n\n /**\n * Moves the active node's clone to follow the pointer. The node that the clone intersects with (via hitTest) is\n * the insert point for updated sorting */\n private trackMove = (x: number, y: number) => {\n if (!this.draggedElementClone) {\n return;\n }\n\n if (this.orientation) {\n x = x * orientationMap[this.orientation].x;\n y = y * orientationMap[this.orientation].y;\n }\n\n writeTask(() => {\n Object.assign(this.draggedElementClone!.style, {\n transform: `translate3d(${x}px, ${y}px, 0)`,\n });\n });\n\n let target = this.hitTest(this.draggedElementClone!, this.sortableNodes)[0];\n let activeDropzone: HTMLElement;\n\n if (this.dropzoneSelector && this.dropzoneActiveClass) {\n readTask(() => {\n activeDropzone = this.draggedElement.closest(this.dropzoneSelector);\n\n writeTask(() => {\n this.dropzoneNodes\n .filter((dze) => dze !== activeDropzone)\n .forEach((dze) => dze.classList.remove(this.dropzoneActiveClass));\n activeDropzone.classList.add(this.dropzoneActiveClass);\n });\n });\n }\n\n // didn't find a target - let's test to see if we can use a drop-zone instead\n if (!target && this.dropzoneNodes.length) {\n target = this.hitTest(this.draggedElementClone!, this.dropzoneNodes)[0];\n if (this.draggedElement.closest(this.dropzoneSelector) === target) return;\n }\n\n if (\n // if clone intersects with a valid target,\n target &&\n // other than its own origin,\n target !== this.draggedElement &&\n // and the target isn't currently animating, which causes false hit tests,\n !this.isAnimating(target)\n ) {\n this.insertAtTarget(this.draggedElement!, target);\n }\n };\n\n /// Component lifecycle ///\n\n constructor() {\n this.handleTrack = this.handleTrack.bind(this);\n this.handleKeydown = this.handleKeydown.bind(this);\n this.refreshKeyboardHandles = this.refreshKeyboardHandles.bind(this);\n this.refreshKeyboardHandles = nanoDebounce(\n this.refreshKeyboardHandles,\n 500\n );\n }\n\n connectedCallback() {\n this.addEventHandlers();\n this.refreshKeyboardHandles();\n this.attachMutationObserver();\n\n if (Build.isBrowser && !this.host.querySelector(`#${this.sortableId}`)) {\n // inject a light-dom / a11y description that we can connect sortable items to\n this.host.insertAdjacentHTML(\n 'beforeend',\n `<div class=\"visually-hidden\" id=\"${this.sortableId}\">${this.helperText}</div>`\n );\n }\n }\n\n disconnectedCallback() {\n this.removeEventHandlers();\n this.host.querySelector(`#${this.sortableId}`)?.remove();\n\n if (this.mutationObserver) {\n this.mutationObserver.disconnect();\n this.mutationObserver = undefined;\n }\n }\n\n render() {\n return (\n <Host>\n <div\n class=\"sortable__live-region\"\n aria-live=\"polite\"\n aria-relevant=\"additions\"\n aria-atomic=\"true\"\n role=\"log\"\n part=\"announcements\"\n >\n {this.ariaTextList.map((str) => (\n <div>{str}</div>\n ))}\n </div>\n <slot />\n </Host>\n );\n }\n}\n"],"mappings":";;;iJAAA,MAAMA,EAAc,+UCoBpB,MAAMC,EAAiB,CACrBC,WAAY,CAAEC,EAAG,EAAGC,EAAG,GACvBC,SAAU,CAAEF,EAAG,EAAGC,EAAG,IAGvB,IAAIE,EAAc,E,MAkBLC,EAAQ,MAMnBC,2BACEC,KAAKC,wB,CAQPC,6BACEF,KAAKC,yBACLD,KAAKG,wB,CAoFPC,mCACEJ,KAAKC,wB,CAOPI,0BAA0BC,EAAUC,GAClC,GAAIA,EAAQP,KAAKQ,oBAAoBD,GAErCP,KAAKS,mBACLT,KAAKC,yBACLD,KAAKG,yBAEL,GAAIH,KAAKU,oBAAqB,CAE5BV,KAAKU,oBAAoBC,MAAMC,SAAW,U,EA+C9CC,+B,UACE,GAAIb,KAAKc,eAAgB,CACvB,IAAIC,EAAAf,KAAKgB,qBAAiB,MAAAD,SAAA,SAAAA,EAAEE,KAAM,CAChCjB,KAAKgB,kBAAkBE,O,CAGzBlB,KAAKmB,aACFC,iBAA8BpB,KAAKc,gBACnCO,SAASC,IACR,IAAKA,EAAOC,aAAa,oBACvBD,EAAOE,aAAa,mBAAoBxB,KAAKyB,YAC/C,MAAMC,EAAUJ,EAAOK,QAAqB3B,KAAK4B,cACjD,GAAIF,EAAS1B,KAAKgB,kBAAkBa,IAAIP,EAAQI,EAAQ,IAE5D,M,CAGF,IAAII,EAAA9B,KAAKgB,qBAAiB,MAAAc,SAAA,SAAAA,EAAEb,KAAM,EAChCc,EAAA/B,KAAKgB,qBAAiB,MAAAe,SAAA,SAAAA,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ACqK,EAAI,KACHrK,EAAA,OACEsK,MAAM,wBAAuB,YACnB,SAAQ,gBACJ,YAAW,cACb,OACZC,KAAK,MACLC,KAAK,iBAEJtO,KAAK0C,aAAagD,KAAK6I,GACtBzK,EAAA,WAAMyK,MAGVzK,EAAA,a"}
@@ -0,0 +1,5 @@
1
+ /*!
2
+ * Web Components for Nanopore digital Web Apps
3
+ */
4
+ import{r as n,c as t,h as i,a,g as e}from"./p-f6a8467a.js";import{c as o}from"./p-257432ff.js";import{c as r}from"./p-411bb8f1.js";import{d as s,a as l}from"./p-9746b0a5.js";import{F as c,a as p}from"./p-71057181.js";const d='.sc-nano-input-h {\n box-sizing: border-box;\n}\n\n*.sc-nano-input, *.sc-nano-input::before, *.sc-nano-input::after {\n box-sizing: border-box;\n}\n[hidden].sc-nano-input {\n display: none !important;\n}\n[disabled].sc-nano-input-h:not([disabled=false]) {\n opacity: 0.5;\n}\n\n.form-ctrl.sc-nano-input {\n container-type: inline-size;\n min-inline-size: 100%;\n display: block;\n}\n.form-ctrl.has-helper-end.sc-nano-input {\n display: flex;\n gap: 1rem;\n}\n.form-ctrl.has-helper-end.sc-nano-input .form-ctrl__wrapper.sc-nano-input {\n flex: 1 1 100%;\n}\n.form-ctrl.has-helper-end.sc-nano-input .form-ctrl__helper-end.sc-nano-input {\n display: none;\n}\n@container (min-width: 350px) {\n .form-ctrl.has-helper-end .form-ctrl__helper-end {\n display: block !important;\n }\n .form-ctrl.has-helper-end .form-ctrl__helper {\n display: none !important;\n }\n}\n\n.form-ctrl__wrapper.sc-nano-input {\n display: block;\n}\n\nlabel.sc-nano-input, .form-ctrl__more.sc-nano-input, .form-ctrl__error.sc-nano-input, .form-ctrl__helper.sc-nano-input {\n display: block;\n inline-size: 100%;\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n}\nlabel.visually-hide.sc-nano-input, .form-ctrl__more.visually-hide.sc-nano-input, .form-ctrl__error.visually-hide.sc-nano-input, .form-ctrl__helper.visually-hide.sc-nano-input {\n clip: rect(1px, 1px, 1px, 1px);\n -webkit-clip-path: inset(50%);\n clip-path: inset(50%);\n block-size: 1px;\n inline-size: 1px;\n margin: -1px;\n overflow: hidden;\n padding: 0;\n position: absolute;\n}\n\n.form-ctrl__float-label.sc-nano-input {\n padding-block: 0;\n -webkit-padding-end: 0;\n padding-inline-end: 0;\n -webkit-padding-start: var(--padding-start);\n padding-inline-start: var(--padding-start);\n color: var(--label-color);\n position: absolute;\n font-size: 1.15em;\n transform: translateY(-50%);\n transform-origin: top left;\n inset-block-start: 50%;\n transition: all 0.125s ease-in;\n opacity: 1;\n}\n.has-focus.sc-nano-input-h .form-ctrl__float-label.sc-nano-input, .has-value.sc-nano-input-h .form-ctrl__float-label.sc-nano-input {\n transform: translateY(-110%);\n font-size: 0.8em;\n opacity: 0.7;\n}\n.form-ctrl__float-label.sc-nano-input .form-ctrl__label-charcount.sc-nano-input {\n opacity: 0;\n transition: opacity 0.125s ease-in;\n}\n.has-focus.sc-nano-input-h .form-ctrl__float-label.sc-nano-input .form-ctrl__label-charcount.sc-nano-input, .has-value.sc-nano-input-h .form-ctrl__float-label.sc-nano-input .form-ctrl__label-charcount.sc-nano-input {\n opacity: 1;\n}\n.form-ctrl__textarea.sc-nano-input .form-ctrl__float-label.sc-nano-input {\n inset-block-start: 50%;\n}\n.has-focus.sc-nano-input-h .form-ctrl__textarea.sc-nano-input .form-ctrl__float-label.sc-nano-input {\n inset-block-start: 0;\n transform: translateY(38%);\n}\n.has-value.sc-nano-input-h .form-ctrl__textarea.sc-nano-input .form-ctrl__float-label.sc-nano-input {\n inset-block-start: 0;\n transform: translateY(38%);\n}\n\n.form-ctrl__label.sc-nano-input {\n color: var(--label-color);\n font-size: var(--label-font-size);\n -webkit-padding-after: var(--padding-bottom);\n padding-block-end: var(--padding-bottom);\n line-height: 1;\n display: flex;\n}\n.form-ctrl__label.sc-nano-input .form-ctrl__label-wrap.sc-nano-input {\n flex: 1;\n overflow: hidden;\n white-space: nowrap;\n text-overflow: ellipsis;\n}\n.form-ctrl__label.sc-nano-input .form-ctrl__label-placeholder.sc-nano-input {\n margin-block: unset;\n -webkit-margin-end: 5px;\n margin-inline-end: 5px;\n -webkit-margin-start: 0;\n margin-inline-start: 0;\n opacity: 0;\n -webkit-appearance: none;\n appearance: none;\n transition: 0.3s ease opacity;\n font-size: 0.9em;\n}\n.form-ctrl__label.sc-nano-input .form-ctrl__label-charcount.sc-nano-input {\n margin-block: unset;\n -webkit-margin-end: 0;\n margin-inline-end: 0;\n -webkit-margin-start: auto;\n margin-inline-start: auto;\n font-size: 0.9em;\n opacity: 0.5;\n}\n.has-value.sc-nano-input-h .form-ctrl__label.sc-nano-input .form-ctrl__label-placeholder.sc-nano-input {\n opacity: 0.5;\n}\n.has-focus.sc-nano-input-h .form-ctrl__label.sc-nano-input {\n color: var(--label-color--focus);\n}\n.is-invalid.sc-nano-input-h:not([disabled]) .form-ctrl__label.sc-nano-input {\n color: var(--label-color--invalid);\n}\n\n.has-float-label.sc-nano-input .select__multi-input.sc-nano-input, .has-float-label.sc-nano-input .select__native-input.sc-nano-input, .has-float-label.sc-nano-input .input__native-ctrl.sc-nano-input {\n opacity: 0;\n transition: opacity 0.125s ease-in;\n}\n.has-focus.sc-nano-input-h .has-float-label.sc-nano-input .select__multi-input.sc-nano-input, .has-value.sc-nano-input-h .has-float-label.sc-nano-input .select__multi-input.sc-nano-input, .has-focus.sc-nano-input-h .has-float-label.sc-nano-input .select__native-input.sc-nano-input, .has-value.sc-nano-input-h .has-float-label.sc-nano-input .select__native-input.sc-nano-input, .has-focus.sc-nano-input-h .has-float-label.sc-nano-input .input__native-ctrl.sc-nano-input, .has-value.sc-nano-input-h .has-float-label.sc-nano-input .input__native-ctrl.sc-nano-input {\n opacity: 1;\n}\n\n.form-ctrl__more.sc-nano-input {\n block-size: 1em;\n position: relative;\n margin-block: 4px var(--padding-bottom);\n margin-inline: 3px 0;\n}\n\n.form-ctrl__helper.sc-nano-input, .form-ctrl__error.sc-nano-input {\n inset-block-start: 0;\n inset-inline-start: 0;\n position: absolute;\n font-size: var(--invalid-msg-font-size);\n line-height: 1.2;\n transition: 0.3s ease-out opacity;\n}\n\n.form-ctrl__helper.sc-nano-input {\n font-style: italic;\n color: var(--help-msg-color);\n}\n[show-inline-error].sc-nano-input-h:not([show-inline-error=false]):not([disabled]).is-invalid .form-ctrl__helper.sc-nano-input {\n opacity: 0;\n}\n\n.form-ctrl__helper-end.sc-nano-input {\n flex: 1 1 30%;\n min-inline-size: 150px;\n font-size: var(--invalid-msg-font-size);\n color: var(--help-msg-color);\n font-style: italic;\n}\n\n.form-ctrl__error.sc-nano-input {\n opacity: 0;\n color: var(--invalid-msg-color);\n font-stretch: condensed;\n}\n.is-invalid.sc-nano-input-h:not([disabled]) .form-ctrl__error.sc-nano-input {\n opacity: 1;\n}\n\n.form-ctrl__input.sc-nano-input {\n font-family: inherit;\n font-size: inherit;\n font-stretch: inherit;\n font-style: inherit;\n font-weight: inherit;\n letter-spacing: inherit;\n text-decoration: inherit;\n text-overflow: inherit;\n text-transform: inherit;\n text-align: inherit;\n white-space: inherit;\n color: inherit;\n border-radius: var(--input-border-radius);\n inline-size: 100%;\n padding: 0 !important;\n position: relative;\n flex: 1 0 auto;\n display: flex;\n background: var(--input-bg-color);\n border: var(--input-border-style);\n border-width: var(--input-border-width);\n font-size: var(--input-font-size);\n -webkit-padding-start: calc(var(--input-border-hint-width) - var(--input-border-width)) !important;\n padding-inline-start: calc(var(--input-border-hint-width) - var(--input-border-width)) !important;\n}\n.has-focus.sc-nano-input-h .form-ctrl__input.sc-nano-input {\n background: var(--input-bg-color--focus);\n border: var(--input-border-style--focus);\n border-width: var(--input-border-width);\n -webkit-padding-start: calc(var(--input-border-hint-width) - var(--input-border-width)) !important;\n padding-inline-start: calc(var(--input-border-hint-width) - var(--input-border-width)) !important;\n}\n.is-invalid.sc-nano-input-h:not([disabled]) .form-ctrl__input.sc-nano-input {\n background: var(--input-bg-color--invalid);\n border: var(--input-border-style--invalid);\n border-width: var(--input-border-width);\n -webkit-border-start: var(--input-border-style--invalid-focus) var(--input-border-hint-width);\n border-inline-start: var(--input-border-style--invalid-focus) var(--input-border-hint-width);\n -webkit-padding-start: 0 !important;\n padding-inline-start: 0 !important;\n}\n.is-invalid.has-focus.sc-nano-input-h:not([disabled]) .form-ctrl__input.sc-nano-input {\n background: var(--input-bg-color--invalid);\n border: var(--input-border-style--invalid-focus);\n border-width: var(--input-border-width);\n -webkit-border-start: var(--input-border-style--invalid-focus) var(--input-border-hint-width);\n border-inline-start: var(--input-border-style--invalid-focus) var(--input-border-hint-width);\n -webkit-padding-start: 0 !important;\n padding-inline-start: 0 !important;\n}\n\n.form-ctrl__input-wrap.sc-nano-input {\n display: flex;\n align-items: stretch;\n flex: 1;\n max-inline-size: 100%;\n}\n\n.form-ctrl__clear-btn.sc-nano-input, .form-ctrl__slot-end.sc-nano-input, .form-ctrl__slot-start.sc-nano-input, .form-ctrl__slot-value-end.sc-nano-input {\n --nano-icon-size: 1.4em;\n margin-block: 0;\n margin-inline: 0;\n font-size: 1em;\n border: 0;\n outline: none;\n background-color: transparent;\n background-repeat: no-repeat;\n display: flex;\n align-items: stretch;\n inline-size: auto;\n}\n\n.has-float-label.sc-nano-input .form-ctrl__slot-start.sc-nano-input {\n display: none;\n}\n\n.form-ctrl__slot-start.sc-nano-input-s > *, .form-ctrl__slot-start .sc-nano-input-s > *, .form-ctrl__slot-end.sc-nano-input-s > *, .form-ctrl__slot-end .sc-nano-input-s > *, .form-ctrl__slot-value-end.sc-nano-input-s > *, .form-ctrl__slot-value-end .sc-nano-input-s > *, .form-ctrl__slot-value-end.sc-nano-input *.sc-nano-input {\n --nano-icon-size: 1.4em;\n padding-inline: unset;\n -webkit-padding-start: var(--padding-start);\n padding-inline-start: var(--padding-start);\n -webkit-padding-end: var(--padding-end);\n padding-inline-end: var(--padding-end);\n font-size: 1em;\n align-items: center;\n display: flex;\n block-size: 100%;\n z-index: 1;\n}\n.sc-nano-input-h[disabled]:not([disabled=false]) .form-ctrl__slot-start.sc-nano-input-s > *, .sc-nano-input-h[disabled]:not([disabled=false]) .form-ctrl__slot-start .sc-nano-input-s > *, .sc-nano-input-h[disabled]:not([disabled=false]) .form-ctrl__slot-end.sc-nano-input-s > *, .sc-nano-input-h[disabled]:not([disabled=false]) .form-ctrl__slot-end .sc-nano-input-s > *, .sc-nano-input-h[disabled]:not([disabled=false]) .form-ctrl__slot-value-end.sc-nano-input-s > *, .sc-nano-input-h[disabled]:not([disabled=false]) .form-ctrl__slot-value-end .sc-nano-input-s > *, [disabled].sc-nano-input-h:not([disabled=false]) .form-ctrl__slot-value-end.sc-nano-input *.sc-nano-input {\n pointer-events: none;\n}\n\n.form-ctrl__slot-value-end.sc-nano-input-s > *, .form-ctrl__slot-value-end .sc-nano-input-s > *, .form-ctrl__slot-value-end.sc-nano-input *.sc-nano-input {\n pointer-events: none;\n}\n\n.form-ctrl__clear-btn.sc-nano-input {\n color: var(--clear-btn-color);\n padding: 0;\n opacity: 0;\n inline-size: 0;\n -webkit-appearance: none;\n appearance: none;\n align-items: center;\n overflow: hidden;\n}\n.is-invalid.sc-nano-input-h .form-ctrl__clear-btn.sc-nano-input {\n color: var(--clear-btn-color--invalid);\n}\n.has-value.sc-nano-input-h .form-ctrl__clear-btn.sc-nano-input {\n padding-block: 0;\n padding-inline: var(--padding-start) var(--padding-end);\n opacity: 1;\n inline-size: auto;\n}\n.form-ctrl__clear-btn.sc-nano-input:hover {\n color: var(--clear-btn-color--hover);\n}\n\n.sc-nano-input-h {\n \n --placeholder-color: var(--nano-input-placeholder-color, initial);\n --placeholder-font-style: var(--nano-input-placeholder-style, initial);\n --placeholder-font-weight: var(--nano-input-placeholder-weight, initial);\n --placeholder-opacity: var(--nano-input-placeholder-opacity, 0.5);\n --padding-top: var(--nano-input-padding-top, var(--nano-input-padding, 8px));\n --padding-end: var(--nano-input-padding-end, var(--nano-input-padding, 8px));\n --padding-bottom: var(--nano-input-padding-bottom, var(--nano-input-padding, 6px));\n --padding-start: var(--nano-input-padding-start, var(--nano-input-padding, 8px));\n --color-invalid: var(--nano-color-danger-rgb, 239 65 53);\n --color--focus-rgb:\n var(\n --nano-color-base-rgb,\n var(--nano-color-primary-rgb, 0 116 149)\n );\n --input-font-size: var(--nano-input-font-size, 0.87em);\n --input-text-color: var(--nano-input-text-color, #4a4a4a);\n --input-border-width: var(--nano-input-border-width, 1px);\n --input-border-hint-width: 3px;\n --input-border-color: var(--nano-input-border-color, #e4e6e8);\n --input-border-radius: var(--nano-input-border-radius, 0);\n --input-border-style: var(--nano-input-border-style, solid) var(--nano-input-border-color, #e4e6e8);\n --input-border-style--focus: var(--nano-input-border-style, solid) var(--nano-input-border-color--focus, #90c6e7);\n --input-border-style--invalid: var(--nano-input-border-style, solid) var(--nano-input-border-color--invalid, #e4e6e8);\n --input-border-style--invalid-focus: var(--nano-input-border-style, solid) var(--nano-input-border-color--invalid, #ef4135);\n --input-bg-color: var(--nano-input-background-color, #fff);\n --input-bg-color--focus: var(--input-bg-color);\n --input-bg-color--invalid: var(--nano-input-background-color, white);\n --invalid-msg-color: rgb(var(--color-invalid) / 100%);\n --invalid-msg-font-size: var(--nano-input-help-font-size, 0.75em);\n --help-msg-color: var(--nano-input-help-color, #616d6e);\n --clear-btn-color: var(--nano-clear-btn-color, rgba(0, 0, 0, 0.3));\n --clear-btn-color--hover: rgb(var(--color--focus-rgb) / 100%);\n --clear-btn-color--invalid: rgb(var(--color-invalid) / 100%);\n --label-color: var(--nano-input-label-color, "currentcolor");\n --label-color--focus: var(--label-color);\n --label-color--invalid: var(--nano-input-label-color-invalid, "currentcolor");\n --label-font-size: var(--nano-input-label-color, 1em);\n --multi-input-value-bg: var(--nano-input-tag-bg, 186 220 240);\n --multi-input-value-text-color: var(--nano-input-tag-color, #455556);\n --multi-input-value-border: var(--nano-input-tag-color, #badcf0);\n position: relative;\n inline-size: 100%;\n padding: 0 !important;\n color: currentcolor;\n display: block;\n}\n\n.nano-color.sc-nano-input-h {\n color: var(--nano-color-base);\n --input-border-style--focus:\n var(--nano-input-border-style, solid) var(\n --nano-color-tint,\n var(--nano-color-primary-tint, #2689a5)\n );\n}\n\n.input__native-ctrl.sc-nano-input {\n font-family: inherit;\n font-size: inherit;\n font-stretch: inherit;\n font-style: inherit;\n font-weight: inherit;\n letter-spacing: inherit;\n text-decoration: inherit;\n text-overflow: inherit;\n text-transform: inherit;\n text-align: inherit;\n white-space: inherit;\n color: inherit;\n padding-block: 0;\n padding-inline: var(--padding-start) var(--padding-end);\n border-radius: var(--input-border-radius);\n text-overflow: ellipsis;\n color: var(--input-text-color);\n display: inline-block;\n flex: 1;\n inline-size: 100%;\n max-inline-size: 100%;\n max-block-size: 100%;\n border: 0;\n outline: none;\n background: transparent;\n -webkit-appearance: none;\n appearance: none;\n margin: 0;\n box-sizing: border-box;\n resize: none;\n overflow: hidden;\n line-height: 2.5em;\n \n}\n.has-float-label.sc-nano-input .input__native-ctrl.sc-nano-input {\n line-height: 2.1em;\n min-height: 2.1em;\n -webkit-padding-before: 1.4em;\n padding-block-start: 1.4em;\n}\n.input__native-ctrl.sc-nano-input::placeholder {\n color: var(--placeholder-color);\n font-family: inherit;\n font-style: var(--placeholder-font-style);\n font-weight: var(--placeholder-font-weight);\n opacity: var(--placeholder-opacity);\n line-height: inherit;\n min-height: initial;\n}\n.input__native-ctrl.sc-nano-input::-moz-placeholder {\n line-height: 2.8em;\n text-overflow: ellipsis;\n}\n.input__native-ctrl.sc-nano-input:-webkit-autofill {\n background-color: transparent;\n}\n.input__native-ctrl.sc-nano-input::-webkit-search-decoration, .input__native-ctrl.sc-nano-input::-webkit-search-cancel-button, .input__native-ctrl.sc-nano-input::-webkit-search-results-button, .input__native-ctrl.sc-nano-input::-webkit-search-results-decoration {\n -webkit-appearance: none;\n appearance: none;\n}\n.input__native-ctrl.sc-nano-input:invalid {\n box-shadow: none;\n}\n.input__native-ctrl.sc-nano-input::-ms-clear, .input__native-ctrl.sc-nano-input::-ms-reveal {\n display: none;\n}\n.input__native-ctrl.input__resizable.sc-nano-input {\n resize: vertical;\n overflow: auto;\n}\n.form-ctrl__textarea.sc-nano-input .input__native-ctrl.sc-nano-input {\n line-height: 1.5em;\n padding-block: var(--padding-top) 0.25em;\n white-space: pre-wrap;\n}\n.form-ctrl__textarea.sc-nano-input .input__native-ctrl.sc-nano-input::placeholder {\n line-height: 1.5em;\n}\n.has-float-label.sc-nano-input .form-ctrl__textarea.sc-nano-input .input__native-ctrl.sc-nano-input {\n -webkit-padding-before: 1.75em;\n padding-block-start: 1.75em;\n}\n[readonly].sc-nano-input-h:not([readonly=false]) .input__native-ctrl.sc-nano-input {\n -webkit-user-select: none;\n user-select: none;\n}';let h=0;const u=class{get nativeInputWrap(){return this._nativeInputWrap}set nativeInputWrap(n){if(this._nativeInputWrap===n)return;this._nativeInputWrap=n;this.setDataListOpts()}constructor(i){n(this,i);this.nanoInput=t(this,"nanoInput",7);this.nanoChange=t(this,"nanoChange",7);this.nanoBlur=t(this,"nanoBlur",7);this.nanoFocus=t(this,"nanoFocus",7);this.nanoDidLoad=t(this,"nanoDidLoad",7);this.nanoDidUnload=t(this,"nanoDidUnload",7);this.nanoValidate=t(this,"nanoValidate",7);this.inputId=`nano-input-${h++}`;this.didBlurAfterEdit=false;this.rtl=false;this.charCount=0;this.hasRendered=false;this.validate=n=>{if(this.validateOn==="submitThenDirty")this.validateOn="dirty";if(!this.nativeInput.validity.valid){if(this.showInlineError){if(n)n.preventDefault();this.errorMessage=this.nativeInput.validationMessage}this._invalid=true}else this._invalid=false;this.nanoValidate.emit({isValid:!this._invalid,errorMessage:this.nativeInput.validationMessage,originalEvent:n})};this.onInput=n=>{const t=n.target;this.value=(t===null||t===void 0?void 0:t.value)||"";this.nanoInput.emit(n)};this.onBlur=()=>{this.hasFocus=false;this.focusChanged();if(this.validateOn==="dirty")this.validate();this.nanoBlur.emit()};this.onFocus=()=>{this.hasFocus=true;this.focusChanged();this.nanoFocus.emit()};this.onKeydown=()=>{if(this.shouldClearOnEdit()){if(this.didBlurAfterEdit&&this.hasValue()){this.clearTextInput()}this.didBlurAfterEdit=false}};this.clearTextInput=n=>{if(this.clearInput&&!this.readonly&&!this.disabled&&n){n.preventDefault();n.stopPropagation()}this.value="";this.nativeInput.value="";const t=new window.Event("change");this.nativeInput.dispatchEvent(t)};this.hasFocus=false;this.hasLabelSlot=false;this.hasHelperSlot=false;this.hasHelperEndSlot=false;this.errorMessage="";this.datalist=null;this._invalid=false;this.color=undefined;this.accept=undefined;this.autocapitalise="none";this.autocomplete="off";this.autocorrect="off";this.autofocus=false;this.clearInput=false;this.clearOnEdit=undefined;this.debounce=0;this.disabled=false;this.inputmode=undefined;this.validateOn="submitThenDirty";this.showInlineError=true;this.label=undefined;this.hideLabel=false;this.floatLabel=false;this.max=undefined;this.maxlength=undefined;this.min=undefined;this.minlength=undefined;this.multiple=undefined;this.name=this.inputId;this.pattern=undefined;this.placeholder=undefined;this.readonly=false;this.required=false;this.spellcheck=false;this.step=undefined;this.size=undefined;this.type="text";this.form=undefined;this.value="";this.resize="auto";this.rows=2;this.showCharCount=false;this.validate=s(this.validate,50);this.handleBlur=this.handleBlur.bind(this)}setDataListOpts(){if(!this.datalist)return;const n=this.datalist.dropDownConfig||{};this.datalist.dropDownConfig=Object.assign(Object.assign({},n),{skidding:-1,tetherTo:this.nativeInputWrap})}get invalid(){return this._invalid}get validityMessage(){if(!this.nativeInput)return"";return this.nativeInput.validationMessage}shouldValidate(){if(!this.hasRendered)return;requestAnimationFrame((()=>{if(this.validateOn==="dirty")this.validate()}))}valueChanged(){this.nanoChange.emit({value:this.value});this.charCount=this.value.length;if(this.type==="textarea"&&this.resize==="auto"){this.nativeInput.style.height="auto";if(this.value.length)this.nativeInput.style.height=this.nativeInput.scrollHeight+"px"}requestAnimationFrame((()=>{if(this.validateOn==="dirty")this.validate()}))}debounceChanged(){this.nanoChange=l(this.nanoChange,this.debounce)}async reportValidity(n){return new Promise((t=>{if(n)this.validate();setTimeout((()=>{t({isValid:!this._invalid,errorMessage:this.nativeInput.validationMessage})}),50)}))}async setFocus(){if(this.nativeInput){this.nativeInput.focus();this.nativeInput.click()}}async select(){if(this.nativeInput){this.nativeInput.select()}}getInputElement(){return Promise.resolve(this.nativeInput)}async showError(n){if(this.nativeInput){this.nativeInput.setCustomValidity(n);this.validate()}}onReset(n){const t=this.form?document.querySelector("#"+this.form):this.el.closest("form");if(!t||n.target!==this.el.closest("form"))return;this.value=""}handleBlur(n){if(!this.hasFocus)return;const t=n;let i;requestAnimationFrame((()=>{if(n instanceof KeyboardEvent&&t.key){if(t.key!=="Tab")return;i=document.activeElement}else if(n instanceof FocusEvent){i=document.activeElement}else i=n.target;if(o(this.el.tagName.toLowerCase(),i)!==this.el){this.onBlur()}}))}shouldClearOnEdit(){const{type:n,clearOnEdit:t}=this;return t===undefined?n==="password":t}getValue(){return this.value||""}focusChanged(){if(!this.hasFocus&&this.shouldClearOnEdit()&&this.hasValue()){this.didBlurAfterEdit=true}}hasValue(){return this.getValue().length>0}slotChangeObserver(){if(this.mo)this.mo.disconnect();const n=this.mo=new MutationObserver((()=>this.processSlottedContent()));n.observe(this.el,{childList:true,subtree:true})}processSlottedContent(){this.hasLabelSlot=!!this.el.querySelectorAll('[slot="label"]');this.hasHelperSlot=!!this.el.querySelector('[slot="helper"]');this.hasHelperEndSlot=!!this.el.querySelector('[slot="helper-end"]');this.datalist=this.el.querySelector("nano-datalist:not([slot])");if(!!this.el.querySelector('[slot="inline-button"]')){console.warn("The `inline-button` slot was renamed to `end` in v2 - please update your code",this.el)}}connectedCallback(){this.debounceChanged();{this.el.dispatchEvent(new CustomEvent("nanoDidLoad",{detail:this.el}))}}disconnectedCallback(){{document.dispatchEvent(new CustomEvent("nanoDidUnload",{detail:this.el}))}if(this.mo)this.mo.disconnect()}componentDidLoad(){this.slotChangeObserver();this.hasRendered=true;if(this.autofocus)setTimeout((n=>this.setFocus()),300)}componentWillLoad(){this.processSlottedContent()}render(){const n=this.getValue();const t=this.inputId+"-lbl";const e=this.showInlineError||this.hasHelperSlot?this.inputId+"-more":"";const o=this.hasHelperEndSlot?this.inputId+"-helper":"";this.rtl=this.el.ownerDocument.dir==="rtl";const s=(({el:n,floatLabel:t,label:i,errorMessage:a,type:e,showInlineError:o,hasHelperSlot:r,hasLabelSlot:s,hideLabel:l,placeholder:c,maxlength:p,charCount:d,showCharCount:h,rtl:u,hasHelperEndSlot:f})=>({el:n,floatLabel:t,label:i,errorMessage:a,type:e,showInlineError:o,hasHelperSlot:r,hasLabelSlot:s,hideLabel:l,placeholder:c,maxlength:p,charCount:d,showCharCount:h,rtl:u,hasHelperEndSlot:f}))(this);const l=Object.assign(Object.assign({},s),{labelId:t,moreId:e,helperEndId:o,hasValue:this.hasValue(),controlId:this.inputId});const d=(({clearInput:n,readonly:t,disabled:i})=>({clearInput:n,readonly:t,disabled:i,clearControl:this.clearInput}))(this);return i(a,{"aria-disabled":this.disabled?"true":null,dir:this.rtl?"rtl":null,class:Object.assign(Object.assign({},r(this.color)),{"has-value":this.hasValue(),"has-focus":this.hasFocus,"is-invalid":this._invalid})},i(c,Object.assign({},l),i(p,Object.assign({},d,{onClearText:this.clearTextInput,control:this.el,ref:n=>this.nativeInputWrap=n}),this.type!=="textarea"&&i("input",{id:this.inputId,class:"input__native-ctrl",ref:n=>this.nativeInput=n,"aria-labelledby":t+" "+e+" "+o,disabled:this.disabled,accept:this.accept,autoCapitalize:this.autocapitalise,autoComplete:this.autocomplete,autoCorrect:this.autocorrect,autoFocus:this.autofocus,inputMode:this.inputmode,form:this.form,min:this.min,max:this.max,minLength:this.minlength,maxLength:this.maxlength,multiple:this.multiple,name:this.name,pattern:this.pattern,placeholder:this.placeholder,readOnly:this.readonly,required:this.required,spellcheck:this.spellcheck,step:this.step,size:this.size,type:this.type,value:n,onInput:this.onInput,onChange:this.onInput,onFocus:this.onFocus,onBlur:this.handleBlur,onKeyDown:this.onKeydown,onInvalid:this.validate}),this.type==="textarea"&&i("textarea",{rows:this.floatLabel?1:this.rows,id:this.inputId,class:{"input__native-ctrl":true,input__resizable:this.resize==="true"},ref:n=>this.nativeInput=n,"aria-labelledby":t+" "+e+" "+o,disabled:this.disabled,autoCapitalize:this.autocapitalise,autoCorrect:this.autocorrect,autoFocus:this.autofocus,inputMode:this.inputmode,form:this.form,minLength:this.minlength,maxLength:this.maxlength,name:this.name,placeholder:this.placeholder,readOnly:this.readonly,required:this.required,spellcheck:this.spellcheck,value:n,onInput:this.onInput,onChange:this.onInput,onFocus:this.onFocus,onKeyDown:this.onKeydown,onInvalid:this.validate,onBlur:this.handleBlur})),i("slot",null)))}get el(){return e(this)}static get watchers(){return{datalist:["setDataListOpts"],minlength:["shouldValidate"],maxlength:["shouldValidate"],min:["shouldValidate"],max:["shouldValidate"],required:["shouldValidate"],disabled:["shouldValidate"],readonly:["shouldValidate"],pattern:["shouldValidate"],inputmode:["shouldValidate"],value:["valueChanged"],debounce:["debounceChanged"]}}};u.style=d;export{u as nano_input};
5
+ //# sourceMappingURL=p-deb0799c.entry.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["inputCss","inputIds","Input","nativeInputWrap","this","_nativeInputWrap","ele","setDataListOpts","constructor","hostRef","inputId","didBlurAfterEdit","rtl","charCount","hasRendered","validate","ev","validateOn","nativeInput","validity","valid","showInlineError","preventDefault","errorMessage","validationMessage","_invalid","nanoValidate","emit","isValid","originalEvent","onInput","input","target","value","nanoInput","onBlur","hasFocus","focusChanged","nanoBlur","onFocus","nanoFocus","onKeydown","shouldClearOnEdit","hasValue","clearTextInput","clearInput","readonly","disabled","stopPropagation","event","window","Event","dispatchEvent","debounce","handleBlur","bind","datalist","currDWConfig","dropDownConfig","Object","assign","skidding","tetherTo","invalid","validityMessage","shouldValidate","requestAnimationFrame","valueChanged","nanoChange","length","type","resize","style","height","scrollHeight","debounceChanged","debounceEvent","async","validateFirst","Promise","resolve","setTimeout","focus","click","select","getInputElement","message","setCustomValidity","onReset","e","form","document","querySelector","el","closest","kev","KeyboardEvent","key","activeElement","FocusEvent","closestElement","tagName","toLowerCase","clearOnEdit","undefined","getValue","slotChangeObserver","mo","disconnect","MutationObserver","processSlottedContent","observe","childList","subtree","hasLabelSlot","querySelectorAll","hasHelperSlot","hasHelperEndSlot","console","warn","connectedCallback","CustomEvent","detail","disconnectedCallback","componentDidLoad","autofocus","_","setFocus","componentWillLoad","render","labelId","moreId","helperEndId","ownerDocument","dir","compWrapOptions","floatLabel","label","hideLabel","placeholder","maxlength","showCharCount","wrapOptions","controlId","controlOptions","clearControl","h","Host","class","createColorClasses","color","FormControlWrap","FormControl","onClearText","control","ref","id","accept","autoCapitalize","autocapitalise","autoComplete","autocomplete","autoCorrect","autocorrect","autoFocus","inputMode","inputmode","min","max","minLength","minlength","maxLength","multiple","name","pattern","readOnly","required","spellcheck","step","size","onChange","onKeyDown","onInvalid","rows","input__resizable"],"sources":["./src/components/input/input.scss?tag=nano-input&encapsulation=scoped","./src/components/input/input.tsx"],"sourcesContent":["@import '../../global/style/utilities/globals';\n@import '../../global/style/nano-theme/form';\n@import '../form-control/form-control';\n@import '../form-control/form-control-vars';\n\n:host {\n @include formControlVars;\n\n position: relative;\n inline-size: 100%;\n padding: 0 !important;\n color: currentcolor;\n display: block;\n}\n\n:host(.nano-color) {\n color: current-color(base);\n\n --input-border-style--focus:\n #{$input-border-style} var(\n --nano-color-tint,\n #{nano-color(\n primary,\n tint\n )}\n );\n}\n\n.input__native-ctrl {\n @include text-inherit();\n\n padding-block: 0;\n padding-inline: var(--padding-start) var(--padding-end);\n border-radius: var(--input-border-radius);\n text-overflow: ellipsis;\n color: var(--input-text-color);\n display: inline-block;\n flex: 1;\n inline-size: 100%;\n max-inline-size: 100%;\n max-block-size: 100%;\n border: 0;\n outline: none;\n background: transparent;\n appearance: none;\n margin: 0;\n box-sizing: border-box;\n resize: none;\n overflow: hidden;\n line-height: 2.5em;\n // min-height: 2.5em;\n\n .has-float-label & {\n line-height: 2.1em;\n min-height: 2.1em;\n padding-block-start: 1.4em;\n }\n\n &::placeholder {\n color: var(--placeholder-color);\n font-family: inherit;\n font-style: var(--placeholder-font-style);\n font-weight: var(--placeholder-font-weight);\n opacity: var(--placeholder-opacity);\n line-height: inherit;\n min-height: initial;\n }\n\n /* stylelint-disable-next-line selector-no-vendor-prefix */\n &::-moz-placeholder {\n line-height: 2.8em;\n text-overflow: ellipsis;\n }\n\n &:-webkit-autofill {\n background-color: transparent;\n }\n\n &::-webkit-search-decoration,\n &::-webkit-search-cancel-button,\n &::-webkit-search-results-button,\n &::-webkit-search-results-decoration {\n appearance: none;\n }\n\n &:invalid {\n box-shadow: none;\n }\n\n &::-ms-clear,\n &::-ms-reveal {\n display: none;\n }\n\n &.input__resizable {\n resize: vertical;\n overflow: auto;\n }\n\n .form-ctrl__textarea & {\n line-height: 1.5em;\n padding-block: var(--padding-top) 0.25em;\n white-space: pre-wrap;\n\n &::placeholder {\n line-height: 1.5em;\n }\n\n .has-float-label & {\n padding-block-start: 1.75em;\n }\n }\n\n :host([readonly]:not([readonly='false'])) & {\n user-select: none;\n }\n}\n","import {\n Build,\n Component,\n ComponentInterface,\n Element,\n Event,\n EventEmitter,\n Host,\n Method,\n Prop,\n State,\n Watch,\n h,\n Listen,\n} from '@stencil/core';\n\nimport { closestElement } from '../../utils/dom';\nimport { createColorClasses } from '../../utils/theme';\nimport { debounceEvent, debounce } from '../../utils/throttle';\nimport { FormControl, FormControlWrap } from '../form-control/form-control';\nimport type {\n Color,\n ControlValidity,\n ControlValidityEventDetail,\n InputChangeEventDetail,\n TextFieldTypes,\n} from '../../interface';\n\nlet inputIds = 0;\n\n/**\n * The input component is a wrapper to the HTML input element with custom styling and additional functionality. It accepts most of the same properties as the HTML [input](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input).\n *\nIt is meant for text type inputs only, such as \"text\", \"password\", \"email\", \"number\", \"search\", \"tel\", and \"url\". It supports all standard text input events including keyup, keydown, keypress, and more.\nThe default styling reference comes from the [ONT styleguide](https://nanoporetech.zeroheight.com/styleguide/s/31282/p/230c74-text-input--textarea/b/942ee4)\n * @slot start - suitable for inline action buttons or icons that may add extra contextual information\n * @slot end - suitable for inline action buttons or icons that may add extra contextual information\n * @slot value-start - similar to 'start', however clicking elements using this slot will activate the input control. This would be suitable to show a secodary 'value' for context or to show a dropdown arrow if using a datalist\n * @slot value-end - similar to 'end', however clicking elements using this slot will activate the input control. This would be suitable to show a secodary 'value' for context or to show a dropdown arrow if using a datalist\n * @slot label - if you do not set a label attribute, you can use this slot for more complex markup\n * @slot helper - helper text to accompany the form field underneath.\n * @slot helper-end - helper text to accompany the form field on the side.\n * @slot - can be used with a `nano-datalist`. See the `nano-datalist` docs for more information\n */\n@Component({\n tag: 'nano-input',\n styleUrl: 'input.scss',\n scoped: true,\n})\nexport class Input implements ComponentInterface {\n private nativeInput?: HTMLInputElement | HTMLTextAreaElement;\n private inputId = `nano-input-${inputIds++}`;\n private didBlurAfterEdit = false;\n private rtl: boolean = false;\n private mo?: MutationObserver;\n private charCount = 0;\n private hasRendered = false;\n\n // we don't want these rendered eles decorated with @State\n // because that will cause re-renders. User get/set to set datalist options\n private _nativeInputWrap: HTMLElement;\n private get nativeInputWrap() {\n return this._nativeInputWrap;\n }\n private set nativeInputWrap(ele: HTMLElement) {\n if (this._nativeInputWrap === ele) return;\n this._nativeInputWrap = ele;\n this.setDataListOpts();\n }\n\n constructor() {\n this.validate = debounce(this.validate, 50);\n this.handleBlur = this.handleBlur.bind(this);\n }\n\n @State() hasFocus = false;\n @State() hasLabelSlot = false;\n @State() hasHelperSlot = false;\n @State() hasHelperEndSlot = false;\n @State() errorMessage: string = '';\n @State() datalist: HTMLNanoDatalistElement = null;\n\n @Watch('datalist')\n setDataListOpts() {\n if (!this.datalist) return;\n const currDWConfig = this.datalist.dropDownConfig || {};\n this.datalist.dropDownConfig = {\n ...currDWConfig,\n skidding: -1,\n tetherTo: this.nativeInputWrap,\n };\n }\n\n @Element() el!: HTMLNanoInputElement;\n\n /**\n * This will be true when the control is in an invalid state.\n * Validity is determined by the `required` prop. Or if custom validity message is set. @readonly\n */\n @Prop({ reflect: true })\n get invalid() {\n return this._invalid;\n }\n @State() _invalid = false;\n\n /**\n * Current validation message - if any. @readonly\n */\n @Prop()\n get validityMessage() {\n if (!this.nativeInput) return '';\n return this.nativeInput.validationMessage;\n }\n\n /**\n * The color to use from the application's color palette.\n */\n @Prop() color?: Color;\n\n /**\n * If the value of the type attribute is `\"file\"`, then this attribute will indicate the types of files that the server accepts, otherwise it will be ignored. The value must be a comma-separated list of unique content type specifiers.\n */\n @Prop() accept?: string;\n\n /**\n * Indicates whether and how the text value should be automatically capitalized as it is entered/edited by the user.\n */\n @Prop() autocapitalise: 'none' | 'sentences' | 'words' | 'characters' =\n 'none';\n\n /**\n * Indicates whether the value of the control can be automatically completed by the browser.\n */\n @Prop() autocomplete: 'on' | 'off' = 'off';\n\n /**\n * Whether auto correction should be enabled when the user is entering/editing the text value.\n */\n @Prop() autocorrect: 'on' | 'off' = 'off';\n\n /**\n * This Boolean attribute lets you specify that a form control should have input focus when the page loads.\n */\n @Prop() autofocus = false;\n\n /**\n * If `true`, a clear icon will appear in the input when there is a value. Clicking it clears the input.\n */\n @Prop() clearInput = false;\n\n /**\n * If `true`, the value will be cleared after focus upon edit. Defaults to `true` when `type` is `\"password\"`, `false` for all other types.\n */\n @Prop() clearOnEdit?: boolean;\n\n /**\n * Set the amount of time, in milliseconds, to wait to trigger the `nanoChange` event after each keystroke.\n */\n @Prop() debounce = 0;\n\n /**\n * If `true`, the user cannot interact with the input.\n */\n @Prop({ reflect: true }) disabled = false;\n\n /**\n * A hint to the browser for which keyboard to display.\n * Possible values: `\"none\"`, `\"text\"`, `\"tel\"`, `\"url\"`,\n * `\"email\"`, `\"numeric\"`, `\"decimal\"`, and `\"search\"`.\n */\n @Prop() inputmode?:\n | 'none'\n | 'text'\n | 'tel'\n | 'url'\n | 'email'\n | 'numeric'\n | 'decimal'\n | 'search';\n\n /**\n * When should the field perform validation\n */\n @Prop({ mutable: true }) validateOn: 'dirty' | 'submit' | 'submitThenDirty' =\n 'submitThenDirty';\n\n /**\n * Whether to show validation errors underneath input\n */\n @Prop({ reflect: true }) showInlineError = true;\n\n /**\n * String to place within a label element. Alternatively you may use a label slot.\n */\n @Prop() label!: string;\n\n /**\n * Visually hide the label - but make it accessible.\n */\n @Prop() hideLabel?: boolean = false;\n\n /**\n * Enable floating label behaviour. Will disable placeholder if set.\n */\n @Prop() floatLabel: boolean = false;\n\n /**\n * The maximum value, which must not be less than its minimum (min attribute) value.\n */\n @Prop() max?: string;\n\n /**\n * If the value of the type attribute is `text`, `email`, `search`, `password`, `tel`, or `url`, this attribute specifies the maximum number of characters that the user can enter.\n */\n @Prop() maxlength?: number;\n\n /**\n * The minimum value, which must not be greater than its maximum (max attribute) value.\n */\n @Prop() min?: string;\n\n /**\n * If the value of the type attribute is `text`, `email`, `search`, `password`, `tel`, or `url`, this attribute specifies the minimum number of characters that the user can enter.\n */\n @Prop() minlength?: number;\n\n /**\n * If `true`, the user can enter more than one value. This attribute applies when the type attribute is set to `\"email\"` or `\"file\"`, otherwise it is ignored.\n */\n @Prop() multiple?: boolean;\n\n /**\n * The name of the control, which is submitted with the form data.\n */\n @Prop() name: string = this.inputId;\n\n /**\n * A regular expression that the value is checked against. The pattern must match the entire value, not just some subset. Use the title attribute to describe the pattern to help the user. This attribute applies when the value of the type attribute is `\"text\"`, `\"search\"`, `\"tel\"`, `\"url\"`, `\"email\"`, or `\"password\"`, otherwise it is ignored.\n */\n @Prop() pattern?: string;\n\n /**\n * Instructional text that shows before the input has a value.\n */\n @Prop() placeholder?: string | null;\n\n /**\n * If `true`, the user cannot modify the value.\n */\n @Prop({ reflect: true }) readonly = false;\n\n /**\n * If `true`, the user must fill in a value before submitting a form.\n */\n @Prop() required = false;\n\n /**\n * If `true`, the element will have its spelling and grammar checked.\n */\n @Prop() spellcheck = false;\n\n /**\n * Works with the min and max attributes to limit the increments at which a value can be set.\n * Possible values are: `\"any\"` or a positive floating point number.\n */\n @Prop() step?: string;\n\n /**\n * The initial size of the control. This value is in pixels unless the value of the type attribute is `\"text\"` or `\"password\"`, in which case it is an integer number of characters. This attribute applies only when the `type` attribute is set to `\"text\"`, `\"search\"`, `\"tel\"`, `\"url\"`, `\"email\"`, or `\"password\"`, otherwise it is ignored.\n */\n @Prop() size?: number;\n\n /**\n * The type of control to display. The default type is text.\n */\n @Prop({ reflect: true }) type: TextFieldTypes = 'text';\n\n /**\n * The form element to associate the input with (its form owner). Must be the id of a form.\n */\n @Prop() form?: string | null;\n\n /**\n * The value of the input.\n */\n @Prop({ mutable: true }) value?: string | null = '';\n\n /**\n * relevant to type=\"textarea\". Vertical resizing - enable / disable or make automatic.\n */\n @Prop() resize: 'true' | 'false' | 'auto' = 'auto';\n\n /**\n * relevant to type=\"textarea\". Default number of rows to show\n */\n @Prop() rows = 2;\n\n /**\n * relevant to type=\"textarea\".\n */\n @Prop() showCharCount = false;\n\n @Watch('minlength')\n @Watch('maxlength')\n @Watch('min')\n @Watch('max')\n @Watch('required')\n @Watch('disabled')\n @Watch('readonly')\n @Watch('pattern')\n @Watch('inputmode')\n protected shouldValidate() {\n if (!this.hasRendered) return;\n requestAnimationFrame(() => {\n if (this.validateOn === 'dirty') this.validate();\n });\n }\n\n /**\n * Update the native input element when the value changes\n */\n @Watch('value')\n protected valueChanged() {\n this.nanoChange.emit({ value: this.value });\n this.charCount = this.value.length;\n\n if (this.type === 'textarea' && this.resize === 'auto') {\n this.nativeInput.style.height = 'auto';\n if (this.value.length)\n this.nativeInput.style.height = this.nativeInput.scrollHeight + 'px';\n }\n\n requestAnimationFrame(() => {\n if (this.validateOn === 'dirty') this.validate();\n });\n }\n\n @Watch('debounce')\n protected debounceChanged() {\n this.nanoChange = debounceEvent(this.nanoChange, this.debounce);\n }\n\n /**\n * Emitted when a keyboard input occurred.\n */\n @Event() nanoInput!: EventEmitter<InputEvent>;\n\n /**\n * Emitted when the value has changed.\n */\n @Event() nanoChange!: EventEmitter<InputChangeEventDetail>;\n\n /**\n * Emitted when the input loses focus.\n */\n @Event() nanoBlur!: EventEmitter<void>;\n\n /**\n * Emitted when the input has focus.\n */\n @Event() nanoFocus!: EventEmitter<void>;\n\n /**\n * Emitted when the input has been created.\n * @internal\n */\n @Event() nanoDidLoad!: EventEmitter<void>;\n\n /**\n * Emitted when the input has been removed.\n * @internal\n */\n @Event() nanoDidUnload!: EventEmitter<void>;\n\n /**\n * Called when validation is performed (which depends on `validateOn`).\n * @returns event.detail: `{ isValid: boolean, errorMessage: string, originalEvent: Event }`.\n */\n @Event() nanoValidate: EventEmitter<ControlValidityEventDetail>;\n\n /**\n * Get the current state of the control.\n * @param validateFirst - perform validation first before reporting\n * @returns `{ isValid: boolean, errorMessage: string }`\n */\n @Method()\n async reportValidity(validateFirst: boolean): Promise<ControlValidity> {\n return new Promise((resolve) => {\n if (validateFirst) this.validate();\n setTimeout(() => {\n resolve({\n isValid: !this._invalid,\n errorMessage: this.nativeInput.validationMessage,\n });\n }, 50);\n });\n }\n\n /**\n * Sets focus on the specified `nano-input`. Use this method instead of the global\n * `input.focus()`.\n */\n @Method()\n async setFocus() {\n if (this.nativeInput) {\n this.nativeInput.focus();\n this.nativeInput.click();\n }\n }\n\n /**\n * Sets focus and select the text on the specified `nano-input`. Use this method instead of the global\n * `input.select()`.\n */\n @Method()\n async select() {\n if (this.nativeInput) {\n this.nativeInput.select();\n }\n }\n\n /**\n * @returns the native `<input>` element used under the hood.\n */\n @Method()\n getInputElement(): Promise<HTMLInputElement | HTMLTextAreaElement> {\n return Promise.resolve(this.nativeInput);\n }\n\n /**\n * Invalidate the field and show a custom error message. To clear the error you will need to re-call this method with an empty string.\n */\n @Method()\n async showError(message: string) {\n if (this.nativeInput) {\n this.nativeInput.setCustomValidity(message);\n this.validate();\n }\n }\n\n @Listen('reset', { target: 'body' })\n onReset(e) {\n const form = this.form\n ? document.querySelector('#' + this.form)\n : this.el.closest('form');\n if (!form || e.target !== this.el.closest('form')) return;\n\n this.value = '';\n }\n\n @Listen('mousedown', { target: 'body' })\n @Listen('keydown')\n handleBlur(e: KeyboardEvent | MouseEvent | FocusEvent) {\n if (!this.hasFocus) return;\n\n const kev = e as KeyboardEvent;\n let target: Element;\n\n requestAnimationFrame(() => {\n if (e instanceof KeyboardEvent && kev.key) {\n if (kev.key !== 'Tab') return;\n target = document.activeElement;\n } else if (e instanceof FocusEvent) {\n target = document.activeElement;\n } else target = e.target as Element;\n\n if (closestElement(this.el.tagName.toLowerCase(), target) !== this.el) {\n this.onBlur();\n }\n });\n }\n\n private shouldClearOnEdit() {\n const { type, clearOnEdit } = this;\n return clearOnEdit === undefined ? type === 'password' : clearOnEdit;\n }\n\n private getValue(): string {\n return this.value || '';\n }\n\n private validate = (ev?: Event) => {\n if (this.validateOn === 'submitThenDirty') this.validateOn = 'dirty';\n\n if (!this.nativeInput.validity.valid) {\n if (this.showInlineError) {\n if (ev) ev.preventDefault();\n this.errorMessage = this.nativeInput.validationMessage;\n }\n this._invalid = true;\n } else this._invalid = false;\n\n this.nanoValidate.emit({\n isValid: !this._invalid,\n errorMessage: this.nativeInput.validationMessage,\n originalEvent: ev,\n });\n };\n\n private onInput = (ev: InputEvent) => {\n const input = ev.target as HTMLInputElement | null;\n this.value = input?.value || '';\n this.nanoInput.emit(ev);\n };\n\n private onBlur = () => {\n this.hasFocus = false;\n this.focusChanged();\n if (this.validateOn === 'dirty') this.validate();\n this.nanoBlur.emit();\n };\n\n private onFocus = () => {\n this.hasFocus = true;\n this.focusChanged();\n this.nanoFocus.emit();\n };\n\n private onKeydown = () => {\n if (this.shouldClearOnEdit()) {\n // Did the input value change after it was blurred and edited?\n if (this.didBlurAfterEdit && this.hasValue()) {\n // Clear the input\n this.clearTextInput();\n }\n\n // Reset the flag\n this.didBlurAfterEdit = false;\n }\n };\n\n private clearTextInput = (ev?: Event) => {\n if (this.clearInput && !this.readonly && !this.disabled && ev) {\n ev.preventDefault();\n ev.stopPropagation();\n }\n\n this.value = '';\n this.nativeInput.value = '';\n const event = new window.Event('change');\n this.nativeInput.dispatchEvent(event);\n };\n\n private focusChanged() {\n // If clearOnEdit is enabled and the input blurred but has a value, set a flag\n if (!this.hasFocus && this.shouldClearOnEdit() && this.hasValue()) {\n this.didBlurAfterEdit = true;\n }\n }\n\n private hasValue(): boolean {\n return this.getValue().length > 0;\n }\n\n private slotChangeObserver() {\n if (!Build.isBrowser) return;\n\n if (this.mo) this.mo.disconnect();\n const mo = (this.mo = new MutationObserver(() =>\n this.processSlottedContent()\n ));\n mo.observe(this.el, { childList: true, subtree: true });\n }\n\n private processSlottedContent() {\n // see if we have label / button content\n this.hasLabelSlot = !!this.el.querySelectorAll('[slot=\"label\"]');\n this.hasHelperSlot = !!this.el.querySelector('[slot=\"helper\"]');\n this.hasHelperEndSlot = !!this.el.querySelector('[slot=\"helper-end\"]');\n this.datalist = this.el.querySelector('nano-datalist:not([slot])');\n\n // breaking change introduced in v2. Rm in v3\n if (!!this.el.querySelector('[slot=\"inline-button\"]')) {\n console.warn(\n 'The `inline-button` slot was renamed to `end` in v2 - please update your code',\n this.el\n );\n }\n }\n\n connectedCallback() {\n this.debounceChanged();\n if (Build.isBrowser) {\n this.el.dispatchEvent(\n new CustomEvent('nanoDidLoad', {\n detail: this.el,\n })\n );\n }\n }\n\n disconnectedCallback() {\n if (Build.isBrowser) {\n document.dispatchEvent(\n new CustomEvent('nanoDidUnload', {\n detail: this.el,\n })\n );\n }\n if (this.mo) this.mo.disconnect();\n }\n\n componentDidLoad() {\n this.slotChangeObserver();\n this.hasRendered = true;\n if (this.autofocus) setTimeout((_) => this.setFocus(), 300);\n }\n\n componentWillLoad() {\n this.processSlottedContent();\n }\n\n render() {\n const value = this.getValue();\n const labelId = this.inputId + '-lbl';\n const moreId =\n this.showInlineError || this.hasHelperSlot ? this.inputId + '-more' : '';\n const helperEndId = this.hasHelperEndSlot ? this.inputId + '-helper' : '';\n this.rtl = (this.el.ownerDocument as Document).dir === 'rtl';\n\n const compWrapOptions = (({\n el,\n floatLabel,\n label,\n errorMessage,\n type,\n showInlineError,\n hasHelperSlot,\n hasLabelSlot,\n hideLabel,\n placeholder,\n maxlength,\n charCount,\n showCharCount,\n rtl,\n hasHelperEndSlot,\n }) => ({\n el,\n floatLabel,\n label,\n errorMessage,\n type,\n showInlineError,\n hasHelperSlot,\n hasLabelSlot,\n hideLabel,\n placeholder,\n maxlength,\n charCount,\n showCharCount,\n rtl,\n hasHelperEndSlot,\n }))(this);\n const wrapOptions = {\n ...compWrapOptions,\n labelId,\n moreId,\n helperEndId,\n hasValue: this.hasValue(),\n controlId: this.inputId,\n };\n\n const controlOptions = (({ clearInput, readonly, disabled }) => ({\n clearInput,\n readonly,\n disabled,\n clearControl: this.clearInput,\n }))(this);\n\n return (\n <Host\n aria-disabled={this.disabled ? 'true' : null}\n dir={this.rtl ? 'rtl' : null}\n class={{\n ...createColorClasses(this.color),\n 'has-value': this.hasValue(),\n 'has-focus': this.hasFocus,\n 'is-invalid': this._invalid,\n }}\n >\n <FormControlWrap {...wrapOptions}>\n <FormControl\n {...controlOptions}\n onClearText={this.clearTextInput}\n control={this.el}\n ref={(el) => (this.nativeInputWrap = el)}\n >\n {this.type !== 'textarea' && (\n <input\n id={this.inputId}\n class=\"input__native-ctrl\"\n ref={(input) => (this.nativeInput = input)}\n aria-labelledby={labelId + ' ' + moreId + ' ' + helperEndId}\n disabled={this.disabled}\n accept={this.accept}\n autoCapitalize={this.autocapitalise}\n autoComplete={this.autocomplete}\n autoCorrect={this.autocorrect}\n autoFocus={this.autofocus}\n inputMode={this.inputmode}\n form={this.form}\n min={this.min}\n max={this.max}\n minLength={this.minlength}\n maxLength={this.maxlength}\n multiple={this.multiple}\n name={this.name}\n pattern={this.pattern}\n placeholder={this.placeholder}\n readOnly={this.readonly}\n required={this.required}\n spellcheck={this.spellcheck}\n step={this.step}\n size={this.size}\n type={this.type}\n value={value}\n onInput={this.onInput}\n onChange={this.onInput}\n onFocus={this.onFocus}\n onBlur={this.handleBlur}\n onKeyDown={this.onKeydown}\n onInvalid={this.validate}\n />\n )}\n {this.type === 'textarea' && (\n <textarea\n rows={this.floatLabel ? 1 : this.rows}\n id={this.inputId}\n class={{\n 'input__native-ctrl': true,\n input__resizable: this.resize === 'true',\n }}\n ref={(input) => (this.nativeInput = input)}\n aria-labelledby={labelId + ' ' + moreId + ' ' + helperEndId}\n disabled={this.disabled}\n autoCapitalize={this.autocapitalise}\n autoCorrect={this.autocorrect}\n autoFocus={this.autofocus}\n inputMode={this.inputmode}\n form={this.form}\n minLength={this.minlength}\n maxLength={this.maxlength}\n name={this.name}\n placeholder={this.placeholder}\n readOnly={this.readonly}\n required={this.required}\n spellcheck={this.spellcheck}\n value={value}\n onInput={this.onInput}\n onChange={this.onInput}\n onFocus={this.onFocus}\n onKeyDown={this.onKeydown}\n onInvalid={this.validate}\n onBlur={this.handleBlur}\n ></textarea>\n )}\n </FormControl>\n <slot />\n </FormControlWrap>\n </Host>\n );\n }\n}\n"],"mappings":";;;yNAAA,MAAMA,EAAW,uzdC4BjB,IAAIC,EAAW,E,MAqBFC,EAAK,MAYJC,sBACV,OAAOC,KAAKC,gB,CAEFF,oBAAgBG,GAC1B,GAAIF,KAAKC,mBAAqBC,EAAK,OACnCF,KAAKC,iBAAmBC,EACxBF,KAAKG,iB,CAGPC,YAAAC,G,+RAnBQL,KAAAM,QAAU,cAAcT,MACxBG,KAAAO,iBAAmB,MACnBP,KAAAQ,IAAe,MAEfR,KAAAS,UAAY,EACZT,KAAAU,YAAc,MAyadV,KAAAW,SAAYC,IAClB,GAAIZ,KAAKa,aAAe,kBAAmBb,KAAKa,WAAa,QAE7D,IAAKb,KAAKc,YAAYC,SAASC,MAAO,CACpC,GAAIhB,KAAKiB,gBAAiB,CACxB,GAAIL,EAAIA,EAAGM,iBACXlB,KAAKmB,aAAenB,KAAKc,YAAYM,iB,CAEvCpB,KAAKqB,SAAW,I,MACXrB,KAAKqB,SAAW,MAEvBrB,KAAKsB,aAAaC,KAAK,CACrBC,SAAU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PH,QAAS1B,KAAK0B,QACdsJ,SAAUhL,KAAK0B,QACfS,QAASnC,KAAKmC,QACdJ,OAAQ/B,KAAKkD,WACb+H,UAAWjL,KAAKqC,UAChB6I,UAAWlL,KAAKW,WAGnBX,KAAKkE,OAAS,YACb4E,EAAA,YACEqC,KAAMnL,KAAKoI,WAAa,EAAIpI,KAAKmL,KACjC3B,GAAIxJ,KAAKM,QACT0I,MAAO,CACL,qBAAsB,KACtBoC,iBAAkBpL,KAAKmE,SAAW,QAEpCoF,IAAM5H,GAAW3B,KAAKc,YAAca,EAAM,kBACzBmG,EAAU,IAAMC,EAAS,IAAMC,EAChDrF,SAAU3C,KAAK2C,SACf+G,eAAgB1J,KAAK2J,eACrBG,YAAa9J,KAAK+J,YAClBC,UAAWhK,KAAKyH,UAChBwC,UAAWjK,KAAKkK,UAChB5E,KAAMtF,KAAKsF,KACX+E,UAAWrK,KAAKsK,UAChBC,UAAWvK,KAAKwI,UAChBiC,KAAMzK,KAAKyK,KACXlC,YAAavI,KAAKuI,YAClBoC,SAAU3K,KAAK0C,SACfkI,SAAU5K,KAAK4K,SACfC,WAAY7K,KAAK6K,WACjBhJ,MAAOA,EACPH,QAAS1B,KAAK0B,QACdsJ,SAAUhL,KAAK0B,QACfS,QAASnC,KAAKmC,QACd8I,UAAWjL,KAAKqC,UAChB6I,UAAWlL,KAAKW,SAChBoB,OAAQ/B,KAAKkD,cAInB4F,EAAA,c"}
1
+ {"version":3,"names":["inputCss","inputIds","Input","nativeInputWrap","this","_nativeInputWrap","ele","setDataListOpts","constructor","hostRef","inputId","didBlurAfterEdit","rtl","charCount","hasRendered","validate","ev","validateOn","nativeInput","validity","valid","showInlineError","preventDefault","errorMessage","validationMessage","_invalid","nanoValidate","emit","isValid","originalEvent","onInput","input","target","value","nanoInput","onBlur","hasFocus","focusChanged","nanoBlur","onFocus","nanoFocus","onKeydown","shouldClearOnEdit","hasValue","clearTextInput","clearInput","readonly","disabled","stopPropagation","event","window","Event","dispatchEvent","debounce","handleBlur","bind","datalist","currDWConfig","dropDownConfig","Object","assign","skidding","tetherTo","invalid","validityMessage","shouldValidate","requestAnimationFrame","valueChanged","nanoChange","length","type","resize","style","height","scrollHeight","debounceChanged","debounceEvent","async","validateFirst","Promise","resolve","setTimeout","focus","click","select","getInputElement","message","setCustomValidity","onReset","e","form","document","querySelector","el","closest","kev","KeyboardEvent","key","activeElement","FocusEvent","closestElement","tagName","toLowerCase","clearOnEdit","undefined","getValue","slotChangeObserver","mo","disconnect","MutationObserver","processSlottedContent","observe","childList","subtree","hasLabelSlot","querySelectorAll","hasHelperSlot","hasHelperEndSlot","console","warn","connectedCallback","CustomEvent","detail","disconnectedCallback","componentDidLoad","autofocus","_","setFocus","componentWillLoad","render","labelId","moreId","helperEndId","ownerDocument","dir","compWrapOptions","floatLabel","label","hideLabel","placeholder","maxlength","showCharCount","wrapOptions","controlId","controlOptions","clearControl","h","Host","class","createColorClasses","color","FormControlWrap","FormControl","onClearText","control","ref","id","accept","autoCapitalize","autocapitalise","autoComplete","autocomplete","autoCorrect","autocorrect","autoFocus","inputMode","inputmode","min","max","minLength","minlength","maxLength","multiple","name","pattern","readOnly","required","spellcheck","step","size","onChange","onKeyDown","onInvalid","rows","input__resizable"],"sources":["./src/components/input/input.scss?tag=nano-input&encapsulation=scoped","./src/components/input/input.tsx"],"sourcesContent":["@import '../../global/style/utilities/globals';\n@import '../../global/style/nano-theme/form';\n@import '../form-control/form-control';\n@import '../form-control/form-control-vars';\n\n:host {\n @include formControlVars;\n\n position: relative;\n inline-size: 100%;\n padding: 0 !important;\n color: currentcolor;\n display: block;\n}\n\n:host(.nano-color) {\n color: current-color(base);\n\n --input-border-style--focus:\n #{$input-border-style} var(\n --nano-color-tint,\n #{nano-color(\n primary,\n tint\n )}\n );\n}\n\n.input__native-ctrl {\n @include text-inherit();\n\n padding-block: 0;\n padding-inline: var(--padding-start) var(--padding-end);\n border-radius: var(--input-border-radius);\n text-overflow: ellipsis;\n color: var(--input-text-color);\n display: inline-block;\n flex: 1;\n inline-size: 100%;\n max-inline-size: 100%;\n max-block-size: 100%;\n border: 0;\n outline: none;\n background: transparent;\n appearance: none;\n margin: 0;\n box-sizing: border-box;\n resize: none;\n overflow: hidden;\n line-height: 2.5em;\n // min-height: 2.5em;\n\n .has-float-label & {\n line-height: 2.1em;\n min-height: 2.1em;\n padding-block-start: 1.4em;\n }\n\n &::placeholder {\n color: var(--placeholder-color);\n font-family: inherit;\n font-style: var(--placeholder-font-style);\n font-weight: var(--placeholder-font-weight);\n opacity: var(--placeholder-opacity);\n line-height: inherit;\n min-height: initial;\n }\n\n /* stylelint-disable-next-line selector-no-vendor-prefix */\n &::-moz-placeholder {\n line-height: 2.8em;\n text-overflow: ellipsis;\n }\n\n &:-webkit-autofill {\n background-color: transparent;\n }\n\n &::-webkit-search-decoration,\n &::-webkit-search-cancel-button,\n &::-webkit-search-results-button,\n &::-webkit-search-results-decoration {\n appearance: none;\n }\n\n &:invalid {\n box-shadow: none;\n }\n\n &::-ms-clear,\n &::-ms-reveal {\n display: none;\n }\n\n &.input__resizable {\n resize: vertical;\n overflow: auto;\n }\n\n .form-ctrl__textarea & {\n line-height: 1.5em;\n padding-block: var(--padding-top) 0.25em;\n white-space: pre-wrap;\n\n &::placeholder {\n line-height: 1.5em;\n }\n\n .has-float-label & {\n padding-block-start: 1.75em;\n }\n }\n\n :host([readonly]:not([readonly='false'])) & {\n user-select: none;\n }\n}\n","import {\n Build,\n Component,\n ComponentInterface,\n Element,\n Event,\n EventEmitter,\n Host,\n Method,\n Prop,\n State,\n Watch,\n h,\n Listen,\n} from '@stencil/core';\n\nimport { closestElement } from '../../utils/dom';\nimport { createColorClasses } from '../../utils/theme';\nimport { debounceEvent, debounce } from '../../utils/throttle';\nimport { FormControl, FormControlWrap } from '../form-control/form-control';\nimport type {\n Color,\n ControlValidity,\n ControlValidityEventDetail,\n InputChangeEventDetail,\n TextFieldTypes,\n} from '../../interface';\n\nlet inputIds = 0;\n\n/**\n * The input component is a wrapper to the HTML input element with custom styling and additional functionality. It accepts most of the same properties as the HTML [input](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input).\n *\nIt is meant for text type inputs only, such as \"text\", \"password\", \"email\", \"number\", \"search\", \"tel\", and \"url\". It supports all standard text input events including keyup, keydown, keypress, and more.\nThe default styling reference comes from the [ONT styleguide](https://nanoporetech.zeroheight.com/styleguide/s/31282/p/230c74-text-input--textarea/b/942ee4)\n * @slot start - suitable for inline action buttons or icons that may add extra contextual information\n * @slot end - suitable for inline action buttons or icons that may add extra contextual information\n * @slot value-start - similar to 'start', however clicking elements using this slot will activate the input control. This would be suitable to show a secodary 'value' for context or to show a dropdown arrow if using a datalist\n * @slot value-end - similar to 'end', however clicking elements using this slot will activate the input control. This would be suitable to show a secodary 'value' for context or to show a dropdown arrow if using a datalist\n * @slot label - if you do not set a label attribute, you can use this slot for more complex markup\n * @slot helper - helper text to accompany the form field underneath.\n * @slot helper-end - helper text to accompany the form field on the side.\n * @slot - can be used with a `nano-datalist`. See the `nano-datalist` docs for more information\n */\n@Component({\n tag: 'nano-input',\n styleUrl: 'input.scss',\n scoped: true,\n})\nexport class Input implements ComponentInterface {\n private nativeInput?: HTMLInputElement | HTMLTextAreaElement;\n private inputId = `nano-input-${inputIds++}`;\n private didBlurAfterEdit = false;\n private rtl: boolean = false;\n private mo?: MutationObserver;\n private charCount = 0;\n private hasRendered = false;\n\n // we don't want these rendered eles decorated with @State\n // because that will cause re-renders. User get/set to set datalist options\n private _nativeInputWrap: HTMLElement;\n private get nativeInputWrap() {\n return this._nativeInputWrap;\n }\n private set nativeInputWrap(ele: HTMLElement) {\n if (this._nativeInputWrap === ele) return;\n this._nativeInputWrap = ele;\n this.setDataListOpts();\n }\n\n constructor() {\n this.validate = debounce(this.validate, 50);\n this.handleBlur = this.handleBlur.bind(this);\n }\n\n @State() hasFocus = false;\n @State() hasLabelSlot = false;\n @State() hasHelperSlot = false;\n @State() hasHelperEndSlot = false;\n @State() errorMessage: string = '';\n @State() datalist: HTMLNanoDatalistElement = null;\n\n @Watch('datalist')\n setDataListOpts() {\n if (!this.datalist) return;\n const currDWConfig = this.datalist.dropDownConfig || {};\n this.datalist.dropDownConfig = {\n ...currDWConfig,\n skidding: -1,\n tetherTo: this.nativeInputWrap,\n };\n }\n\n @Element() el!: HTMLNanoInputElement;\n\n /**\n * This will be true when the control is in an invalid state.\n * Validity is determined by the `required` prop. Or if custom validity message is set. @readonly\n */\n @Prop({ reflect: true })\n get invalid() {\n return this._invalid;\n }\n @State() _invalid = false;\n\n /**\n * Current validation message - if any. @readonly\n */\n @Prop()\n get validityMessage() {\n if (!this.nativeInput) return '';\n return this.nativeInput.validationMessage;\n }\n\n /**\n * The color to use from the application's color palette.\n */\n @Prop() color?: Color;\n\n /**\n * If the value of the type attribute is `\"file\"`, then this attribute will indicate the types of files that the server accepts, otherwise it will be ignored. The value must be a comma-separated list of unique content type specifiers.\n */\n @Prop() accept?: string;\n\n /**\n * Indicates whether and how the text value should be automatically capitalized as it is entered/edited by the user.\n */\n @Prop() autocapitalise: 'none' | 'sentences' | 'words' | 'characters' =\n 'none';\n\n /**\n * Indicates whether the value of the control can be automatically completed by the browser.\n */\n @Prop() autocomplete: 'on' | 'off' = 'off';\n\n /**\n * Whether auto correction should be enabled when the user is entering/editing the text value.\n */\n @Prop() autocorrect: 'on' | 'off' = 'off';\n\n /**\n * This Boolean attribute lets you specify that a form control should have input focus when the page loads.\n */\n @Prop() autofocus = false;\n\n /**\n * If `true`, a clear icon will appear in the input when there is a value. Clicking it clears the input.\n */\n @Prop() clearInput = false;\n\n /**\n * If `true`, the value will be cleared after focus upon edit. Defaults to `true` when `type` is `\"password\"`, `false` for all other types.\n */\n @Prop() clearOnEdit?: boolean;\n\n /**\n * Set the amount of time, in milliseconds, to wait to trigger the `nanoChange` event after each keystroke.\n */\n @Prop() debounce = 0;\n\n /**\n * If `true`, the user cannot interact with the input.\n */\n @Prop({ reflect: true }) disabled = false;\n\n /**\n * A hint to the browser for which keyboard to display.\n * Possible values: `\"none\"`, `\"text\"`, `\"tel\"`, `\"url\"`,\n * `\"email\"`, `\"numeric\"`, `\"decimal\"`, and `\"search\"`.\n */\n @Prop() inputmode?:\n | 'none'\n | 'text'\n | 'tel'\n | 'url'\n | 'email'\n | 'numeric'\n | 'decimal'\n | 'search';\n\n /**\n * When should the field perform validation\n */\n @Prop({ mutable: true }) validateOn: 'dirty' | 'submit' | 'submitThenDirty' =\n 'submitThenDirty';\n\n /**\n * Whether to show validation errors underneath input\n */\n @Prop({ reflect: true }) showInlineError = true;\n\n /**\n * String to place within a label element. Alternatively you may use a label slot.\n */\n @Prop() label!: string;\n\n /**\n * Visually hide the label - but make it accessible.\n */\n @Prop() hideLabel?: boolean = false;\n\n /**\n * Enable floating label behaviour. Will disable placeholder if set.\n */\n @Prop() floatLabel: boolean = false;\n\n /**\n * The maximum value, which must not be less than its minimum (min attribute) value.\n */\n @Prop() max?: string;\n\n /**\n * If the value of the type attribute is `text`, `email`, `search`, `password`, `tel`, or `url`, this attribute specifies the maximum number of characters that the user can enter.\n */\n @Prop() maxlength?: number;\n\n /**\n * The minimum value, which must not be greater than its maximum (max attribute) value.\n */\n @Prop() min?: string;\n\n /**\n * If the value of the type attribute is `text`, `email`, `search`, `password`, `tel`, or `url`, this attribute specifies the minimum number of characters that the user can enter.\n */\n @Prop() minlength?: number;\n\n /**\n * If `true`, the user can enter more than one value. This attribute applies when the type attribute is set to `\"email\"` or `\"file\"`, otherwise it is ignored.\n */\n @Prop() multiple?: boolean;\n\n /**\n * The name of the control, which is submitted with the form data.\n */\n @Prop() name: string = this.inputId;\n\n /**\n * A regular expression that the value is checked against. The pattern must match the entire value, not just some subset. Use the title attribute to describe the pattern to help the user. This attribute applies when the value of the type attribute is `\"text\"`, `\"search\"`, `\"tel\"`, `\"url\"`, `\"email\"`, or `\"password\"`, otherwise it is ignored.\n */\n @Prop() pattern?: string;\n\n /**\n * Instructional text that shows before the input has a value.\n */\n @Prop() placeholder?: string | null;\n\n /**\n * If `true`, the user cannot modify the value.\n */\n @Prop({ reflect: true }) readonly = false;\n\n /**\n * If `true`, the user must fill in a value before submitting a form.\n */\n @Prop() required = false;\n\n /**\n * If `true`, the element will have its spelling and grammar checked.\n */\n @Prop() spellcheck = false;\n\n /**\n * Works with the min and max attributes to limit the increments at which a value can be set.\n * Possible values are: `\"any\"` or a positive floating point number.\n */\n @Prop() step?: string;\n\n /**\n * The initial size of the control. This value is in pixels unless the value of the type attribute is `\"text\"` or `\"password\"`, in which case it is an integer number of characters. This attribute applies only when the `type` attribute is set to `\"text\"`, `\"search\"`, `\"tel\"`, `\"url\"`, `\"email\"`, or `\"password\"`, otherwise it is ignored.\n */\n @Prop() size?: number;\n\n /**\n * The type of control to display. The default type is text.\n */\n @Prop({ reflect: true }) type: TextFieldTypes = 'text';\n\n /**\n * The form element to associate the input with (its form owner). Must be the id of a form.\n */\n @Prop() form?: string | null;\n\n /**\n * The value of the input.\n */\n @Prop({ mutable: true }) value?: string | null = '';\n\n /**\n * relevant to type=\"textarea\". Vertical resizing - enable / disable or make automatic.\n */\n @Prop() resize: 'true' | 'false' | 'auto' = 'auto';\n\n /**\n * relevant to type=\"textarea\". Default number of rows to show\n */\n @Prop() rows = 2;\n\n /**\n * relevant to type=\"textarea\".\n */\n @Prop() showCharCount = false;\n\n @Watch('minlength')\n @Watch('maxlength')\n @Watch('min')\n @Watch('max')\n @Watch('required')\n @Watch('disabled')\n @Watch('readonly')\n @Watch('pattern')\n @Watch('inputmode')\n protected shouldValidate() {\n if (!this.hasRendered) return;\n requestAnimationFrame(() => {\n if (this.validateOn === 'dirty') this.validate();\n });\n }\n\n /**\n * Update the native input element when the value changes\n */\n @Watch('value')\n protected valueChanged() {\n this.nanoChange.emit({ value: this.value });\n this.charCount = this.value.length;\n\n if (this.type === 'textarea' && this.resize === 'auto') {\n this.nativeInput.style.height = 'auto';\n if (this.value.length)\n this.nativeInput.style.height = this.nativeInput.scrollHeight + 'px';\n }\n\n requestAnimationFrame(() => {\n if (this.validateOn === 'dirty') this.validate();\n });\n }\n\n @Watch('debounce')\n protected debounceChanged() {\n this.nanoChange = debounceEvent(this.nanoChange, this.debounce);\n }\n\n /**\n * Emitted when a keyboard input occurred.\n */\n @Event() nanoInput!: EventEmitter<InputEvent>;\n\n /**\n * Emitted when the value has changed.\n */\n @Event() nanoChange!: EventEmitter<InputChangeEventDetail>;\n\n /**\n * Emitted when the input loses focus.\n */\n @Event() nanoBlur!: EventEmitter<void>;\n\n /**\n * Emitted when the input has focus.\n */\n @Event() nanoFocus!: EventEmitter<void>;\n\n /**\n * Emitted when the input has been created.\n * @internal\n */\n @Event() nanoDidLoad!: EventEmitter<void>;\n\n /**\n * Emitted when the input has been removed.\n * @internal\n */\n @Event() nanoDidUnload!: EventEmitter<void>;\n\n /**\n * Called when validation is performed (which depends on `validateOn`).\n * @returns event.detail: `{ isValid: boolean, errorMessage: string, originalEvent: Event }`.\n */\n @Event() nanoValidate: EventEmitter<ControlValidityEventDetail>;\n\n /**\n * Get the current state of the control.\n * @param validateFirst - perform validation first before reporting\n * @returns `{ isValid: boolean, errorMessage: string }`\n */\n @Method()\n async reportValidity(validateFirst: boolean): Promise<ControlValidity> {\n return new Promise((resolve) => {\n if (validateFirst) this.validate();\n setTimeout(() => {\n resolve({\n isValid: !this._invalid,\n errorMessage: this.nativeInput.validationMessage,\n });\n }, 50);\n });\n }\n\n /**\n * Sets focus on the specified `nano-input`. Use this method instead of the global\n * `input.focus()`.\n */\n @Method()\n async setFocus() {\n if (this.nativeInput) {\n this.nativeInput.focus();\n this.nativeInput.click();\n }\n }\n\n /**\n * Sets focus and select the text on the specified `nano-input`. Use this method instead of the global\n * `input.select()`.\n */\n @Method()\n async select() {\n if (this.nativeInput) {\n this.nativeInput.select();\n }\n }\n\n /**\n * @returns the native `<input>` element used under the hood.\n */\n @Method()\n getInputElement(): Promise<HTMLInputElement | HTMLTextAreaElement> {\n return Promise.resolve(this.nativeInput);\n }\n\n /**\n * Invalidate the field and show a custom error message. To clear the error you will need to re-call this method with an empty string.\n */\n @Method()\n async showError(message: string) {\n if (this.nativeInput) {\n this.nativeInput.setCustomValidity(message);\n this.validate();\n }\n }\n\n @Listen('reset', { target: 'body' })\n onReset(e) {\n const form = this.form\n ? document.querySelector('#' + this.form)\n : this.el.closest('form');\n if (!form || e.target !== this.el.closest('form')) return;\n\n this.value = '';\n }\n\n @Listen('mousedown', { target: 'body' })\n @Listen('keydown')\n handleBlur(e: KeyboardEvent | MouseEvent | FocusEvent) {\n if (!this.hasFocus) return;\n\n const kev = e as KeyboardEvent;\n let target: Element;\n\n requestAnimationFrame(() => {\n if (e instanceof KeyboardEvent && kev.key) {\n if (kev.key !== 'Tab') return;\n target = document.activeElement;\n } else if (e instanceof FocusEvent) {\n target = document.activeElement;\n } else target = e.target as Element;\n\n if (closestElement(this.el.tagName.toLowerCase(), target) !== this.el) {\n this.onBlur();\n }\n });\n }\n\n private shouldClearOnEdit() {\n const { type, clearOnEdit } = this;\n return clearOnEdit === undefined ? type === 'password' : clearOnEdit;\n }\n\n private getValue(): string {\n return this.value || '';\n }\n\n private validate = (ev?: Event) => {\n if (this.validateOn === 'submitThenDirty') this.validateOn = 'dirty';\n\n if (!this.nativeInput.validity.valid) {\n if (this.showInlineError) {\n if (ev) ev.preventDefault();\n this.errorMessage = this.nativeInput.validationMessage;\n }\n this._invalid = true;\n } else this._invalid = false;\n\n this.nanoValidate.emit({\n isValid: !this._invalid,\n errorMessage: this.nativeInput.validationMessage,\n originalEvent: ev,\n });\n };\n\n private onInput = (ev: InputEvent) => {\n const input = ev.target as HTMLInputElement | null;\n this.value = input?.value || '';\n this.nanoInput.emit(ev);\n };\n\n private onBlur = () => {\n this.hasFocus = false;\n this.focusChanged();\n if (this.validateOn === 'dirty') this.validate();\n this.nanoBlur.emit();\n };\n\n private onFocus = () => {\n this.hasFocus = true;\n this.focusChanged();\n this.nanoFocus.emit();\n };\n\n private onKeydown = () => {\n if (this.shouldClearOnEdit()) {\n // Did the input value change after it was blurred and edited?\n if (this.didBlurAfterEdit && this.hasValue()) {\n // Clear the input\n this.clearTextInput();\n }\n\n // Reset the flag\n this.didBlurAfterEdit = false;\n }\n };\n\n private clearTextInput = (ev?: Event) => {\n if (this.clearInput && !this.readonly && !this.disabled && ev) {\n ev.preventDefault();\n ev.stopPropagation();\n }\n\n this.value = '';\n this.nativeInput.value = '';\n const event = new window.Event('change');\n this.nativeInput.dispatchEvent(event);\n };\n\n private focusChanged() {\n // If clearOnEdit is enabled and the input blurred but has a value, set a flag\n if (!this.hasFocus && this.shouldClearOnEdit() && this.hasValue()) {\n this.didBlurAfterEdit = true;\n }\n }\n\n private hasValue(): boolean {\n return this.getValue().length > 0;\n }\n\n private slotChangeObserver() {\n if (!Build.isBrowser) return;\n\n if (this.mo) this.mo.disconnect();\n const mo = (this.mo = new MutationObserver(() =>\n this.processSlottedContent()\n ));\n mo.observe(this.el, { childList: true, subtree: true });\n }\n\n private processSlottedContent() {\n // see if we have label / button content\n this.hasLabelSlot = !!this.el.querySelectorAll('[slot=\"label\"]');\n this.hasHelperSlot = !!this.el.querySelector('[slot=\"helper\"]');\n this.hasHelperEndSlot = !!this.el.querySelector('[slot=\"helper-end\"]');\n this.datalist = this.el.querySelector('nano-datalist:not([slot])');\n\n // breaking change introduced in v2. Rm in v3\n if (!!this.el.querySelector('[slot=\"inline-button\"]')) {\n console.warn(\n 'The `inline-button` slot was renamed to `end` in v2 - please update your code',\n this.el\n );\n }\n }\n\n connectedCallback() {\n this.debounceChanged();\n if (Build.isBrowser) {\n this.el.dispatchEvent(\n new CustomEvent('nanoDidLoad', {\n detail: this.el,\n })\n );\n }\n }\n\n disconnectedCallback() {\n if (Build.isBrowser) {\n document.dispatchEvent(\n new CustomEvent('nanoDidUnload', {\n detail: this.el,\n })\n );\n }\n if (this.mo) this.mo.disconnect();\n }\n\n componentDidLoad() {\n this.slotChangeObserver();\n this.hasRendered = true;\n if (this.autofocus) setTimeout((_) => this.setFocus(), 300);\n }\n\n componentWillLoad() {\n this.processSlottedContent();\n }\n\n render() {\n const value = this.getValue();\n const labelId = this.inputId + '-lbl';\n const moreId =\n this.showInlineError || this.hasHelperSlot ? this.inputId + '-more' : '';\n const helperEndId = this.hasHelperEndSlot ? this.inputId + '-helper' : '';\n this.rtl = (this.el.ownerDocument as Document).dir === 'rtl';\n\n const compWrapOptions = (({\n el,\n floatLabel,\n label,\n errorMessage,\n type,\n showInlineError,\n hasHelperSlot,\n hasLabelSlot,\n hideLabel,\n placeholder,\n maxlength,\n charCount,\n showCharCount,\n rtl,\n hasHelperEndSlot,\n }) => ({\n el,\n floatLabel,\n label,\n errorMessage,\n type,\n showInlineError,\n hasHelperSlot,\n hasLabelSlot,\n hideLabel,\n placeholder,\n maxlength,\n charCount,\n showCharCount,\n rtl,\n hasHelperEndSlot,\n }))(this);\n const wrapOptions = {\n ...compWrapOptions,\n labelId,\n moreId,\n helperEndId,\n hasValue: this.hasValue(),\n controlId: this.inputId,\n };\n\n const controlOptions = (({ clearInput, readonly, disabled }) => ({\n clearInput,\n readonly,\n disabled,\n clearControl: this.clearInput,\n }))(this);\n\n return (\n <Host\n aria-disabled={this.disabled ? 'true' : null}\n dir={this.rtl ? 'rtl' : null}\n class={{\n ...createColorClasses(this.color),\n 'has-value': this.hasValue(),\n 'has-focus': this.hasFocus,\n 'is-invalid': this._invalid,\n }}\n >\n <FormControlWrap {...wrapOptions}>\n <FormControl\n {...controlOptions}\n onClearText={this.clearTextInput}\n control={this.el}\n ref={(el) => (this.nativeInputWrap = el)}\n >\n {this.type !== 'textarea' && (\n <input\n id={this.inputId}\n class=\"input__native-ctrl\"\n ref={(input) => (this.nativeInput = input)}\n aria-labelledby={labelId + ' ' + moreId + ' ' + helperEndId}\n disabled={this.disabled}\n accept={this.accept}\n autoCapitalize={this.autocapitalise}\n autoComplete={this.autocomplete}\n autoCorrect={this.autocorrect}\n autoFocus={this.autofocus}\n inputMode={this.inputmode}\n form={this.form}\n min={this.min}\n max={this.max}\n minLength={this.minlength}\n maxLength={this.maxlength}\n multiple={this.multiple}\n name={this.name}\n pattern={this.pattern}\n placeholder={this.placeholder}\n readOnly={this.readonly}\n required={this.required}\n spellcheck={this.spellcheck}\n step={this.step}\n size={this.size}\n type={this.type}\n value={value}\n onInput={this.onInput}\n onChange={this.onInput}\n onFocus={this.onFocus}\n onBlur={this.handleBlur}\n onKeyDown={this.onKeydown}\n onInvalid={this.validate}\n />\n )}\n {this.type === 'textarea' && (\n <textarea\n rows={this.floatLabel ? 1 : this.rows}\n id={this.inputId}\n class={{\n 'input__native-ctrl': true,\n input__resizable: this.resize === 'true',\n }}\n ref={(input) => (this.nativeInput = input)}\n aria-labelledby={labelId + ' ' + moreId + ' ' + helperEndId}\n disabled={this.disabled}\n autoCapitalize={this.autocapitalise}\n autoCorrect={this.autocorrect}\n autoFocus={this.autofocus}\n inputMode={this.inputmode}\n form={this.form}\n minLength={this.minlength}\n maxLength={this.maxlength}\n name={this.name}\n placeholder={this.placeholder}\n readOnly={this.readonly}\n required={this.required}\n spellcheck={this.spellcheck}\n value={value}\n onInput={this.onInput}\n onChange={this.onInput}\n onFocus={this.onFocus}\n onKeyDown={this.onKeydown}\n onInvalid={this.validate}\n onBlur={this.handleBlur}\n ></textarea>\n )}\n </FormControl>\n <slot />\n </FormControlWrap>\n </Host>\n );\n }\n}\n"],"mappings":";;;yNAAA,MAAMA,EAAW,83hBC4BjB,IAAIC,EAAW,E,MAqBFC,EAAK,MAYJC,sBACV,OAAOC,KAAKC,gB,CAEFF,oBAAgBG,GAC1B,GAAIF,KAAKC,mBAAqBC,EAAK,OACnCF,KAAKC,iBAAmBC,EACxBF,KAAKG,iB,CAGPC,YAAAC,G,+RAnBQL,KAAAM,QAAU,cAAcT,MACxBG,KAAAO,iBAAmB,MACnBP,KAAAQ,IAAe,MAEfR,KAAAS,UAAY,EACZT,KAAAU,YAAc,MAyadV,KAAAW,SAAYC,IAClB,GAAIZ,KAAKa,aAAe,kBAAmBb,KAAKa,WAAa,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js";import{f as s}from"./p-f8f89998.js";import{P as r}from"./p-51bc8b59.js";const a=":host{box-sizing:border-box}*,*::before,*::after{box-sizing:border-box}[hidden]{display:none !important}:host{--border-radius:var(--nano-border-radius-medium, 4px);--active-color:#005c75;--hover-color:#007495;--nano-color-base:var(--color, #687576);--background:transparent;--padding:var(--nano-spacing-small, 8px);--box-shadow:none;border-radius:var(--border-radius);display:inline-block}.icon-button{flex:0 0 auto;display:flex;align-items:center;border:none;border-radius:inherit;background:var(--background);font-size:inherit;color:var(--color);padding:var(--padding);cursor:pointer;-webkit-appearance:none;appearance:none;transition:box-shadow var(--nano-transition-fast, 0.1s) ease-in-out;box-shadow:var(--box-shadow)}.icon-button:hover:not(.icon-button--disabled),.icon-button:focus:not(.icon-button--disabled){color:var(--hover-color);--nano-color-base:var(--hover-color)}.icon-button:active:not(.icon-button--disabled){color:var(--active-color);--nano-color-base:var(--active-color)}.icon-button:focus{outline:none}.icon-button__label{clip:rect(1px, 1px, 1px, 1px);-webkit-clip-path:inset(50%);clip-path:inset(50%);block-size:1px;inline-size:1px;margin:-1px;overflow:hidden;padding:0;position:absolute}.icon-button--disabled{opacity:0.5;cursor:not-allowed;pointer-events:none}.focus-visible.icon-button:focus{box-shadow:var(--nano-control-focus-shadow, 0 0 0 0.1875rem var(--nano-control-focus-color, rgba(144, 198, 231, 0.8)))}";const p=class{constructor(o){t(this,o);this.handleClick=t=>{if(this.type==="button")return;const o=this.findForm();if(o){t.preventDefault();const i=document.createElement("button");i.type=this.type;i.style.display="none";o.appendChild(i);i.click();i.remove()}};this.iconName=undefined;this.iconSrc=undefined;this.type="button";this.name=undefined;this.value=undefined;this.label=undefined;this.showTooltip=false;this.disabled=false;this.href=undefined;this.rel=undefined;this.target=undefined;this.form=undefined}async setFocus(){this.button.focus()}findForm(){const{form:t,host:o}=this;if(!t)return o.closest("form");if(t instanceof HTMLFormElement){return t}if(typeof t==="string"){const o=document.getElementById(t);if(o instanceof HTMLFormElement){return o}}return null}componentDidLoad(){s.observe(this.button)}connectedCallback(){if(this.button)s.observe(this.button)}disconnectedCallback(){s.unobserve(this.button)}content(){const t=this.href===undefined?"button":"a";return o(i,{"aria-disabled":this.disabled?"true":null},o(t,{onClick:this.handleClick,part:"base",ref:t=>this.button=t,class:{"icon-button":true,"icon-button--disabled":this.disabled},name:this.name,value:this.value,href:this.href||undefined,target:this.href&&this.target?this.target:undefined,rel:this.rel||undefined,type:!this.href&&this.type?this.type:undefined},o("span",{class:"icon-button__label"},this.label),o("nano-icon",{name:this.iconName,src:this.iconSrc,"aria-hidden":"true",lazy:false,part:"icon"})))}render(){if(this.showTooltip){return o("nano-tooltip",{content:this.label},this.content())}return this.content()}get host(){return n(this)}};p.style=a;const l=':host{box-sizing:border-box}*,*::before,*::after{box-sizing:border-box}[hidden]{display:none !important}:host{--max-width:20rem;--hide-delay:0s;--hide-duration:0.125s;--hide-timing-function:ease;--show-delay:0.125s;--show-duration:0.125s;--show-timing-function:ease;display:contents}.tooltip{max-inline-size:var(--max-width);border-radius:var(--nano-tooltip-border-radius, var(--nano-border-radius-small, 2px));background-color:black;font-size:var(--nano-fontsize-small, 0.875rem);line-height:1.5;color:white;opacity:0;padding:var(--nano-tooltip-padding, var(--nano-spacing-xsmall, 4px) var(--nano-spacing-small, 8px));transform:translateY(10px) translateZ(0);transform-origin:bottom;transition:opacity, transform var(--hide-duration) var(--hide-timing-function) var(--hide-delay);white-space:normal}.tooltip-arrow{content:"";position:absolute;inline-size:0;block-size:0;color:black;transition:0.2s ease transform}.tooltip-positioner{position:absolute;z-index:var(--nano-layer-index-tooltip, 1000)}.tooltip-positioner[data-popper-placement^=top] .tooltip{transform-origin:bottom;transform:translateY(-10px) translateZ(0)}.tooltip-positioner[data-popper-placement^=bottom] .tooltip{transform-origin:top}.tooltip-positioner[data-popper-placement^=left] .tooltip{transform-origin:right}.tooltip-positioner[data-popper-placement^=right] .tooltip{transform-origin:left}.tooltip-positioner.popover-visible .tooltip{opacity:1;transform:none;transition-delay:var(--show-delay);transition-duration:var(--show-duration);transition-timing-function:var(--show-timing-function)}.tooltip-positioner[data-popper-placement^=bottom] .tooltip-arrow{inset-block-end:100%;inset-inline-start:calc(50% - 5px);-webkit-border-after:5px solid;border-block-end:5px solid;-webkit-border-start:5px solid transparent;border-inline-start:5px solid transparent;-webkit-border-end:5px solid transparent;border-inline-end:5px solid transparent}.tooltip-positioner[data-popper-placement=bottom-start] .tooltip-arrow{inset-inline-start:5px}.tooltip-positioner[data-popper-placement=bottom-end] .tooltip-arrow{inset-inline:auto 5px}.tooltip-positioner[data-popper-placement^=top] .tooltip-arrow{inset-block-start:100%;inset-inline-start:calc(50% - 5px);-webkit-border-before:5px solid;border-block-start:5px solid;-webkit-border-start:5px solid transparent;border-inline-start:5px solid transparent;-webkit-border-end:5px solid transparent;border-inline-end:5px solid transparent}.tooltip-positioner[data-popper-placement=top-start] .tooltip-arrow{inset-inline-start:5px}.tooltip-positioner[data-popper-placement=top-end] .tooltip-arrow{inset-inline:auto 5px}.tooltip-positioner[data-popper-placement^=left] .tooltip-arrow{inset-block-start:calc(50% - 5px);inset-inline-start:100%;-webkit-border-start:5px solid;border-inline-start:5px solid;-webkit-border-before:5px solid transparent;border-block-start:5px solid transparent;-webkit-border-after:5px solid transparent;border-block-end:5px solid transparent}.tooltip-positioner[data-popper-placement=left-start] .tooltip-arrow{inset-block-start:5px}.tooltip-positioner[data-popper-placement=left-end] .tooltip-arrow{inset-block:auto 5px}.tooltip-positioner[data-popper-placement^=right] .tooltip-arrow{inset-block-start:calc(50% - 5px);inset-inline-end:100%;-webkit-border-end:5px solid;border-inline-end:5px solid;-webkit-border-before:5px solid transparent;border-block-start:5px solid transparent;-webkit-border-after:5px solid transparent;border-block-end:5px solid transparent}.tooltip-positioner[data-popper-placement=right-start] .tooltip-arrow{inset-block-start:5px}.tooltip-positioner[data-popper-placement=right-end] .tooltip-arrow{inset-block:auto 5px}';const d=class{constructor(o){t(this,o);this.nanoShow=e(this,"nanoShow",7);this.nanoAfterShow=e(this,"nanoAfterShow",7);this.nanoHide=e(this,"nanoHide",7);this.nanoAfterHide=e(this,"nanoAfterHide",7);this.isVisible=false;this.label="";this.handleBlur=()=>{if(this.hasTrigger("focus")){this.hide()}};this.handleClick=()=>{if(this.hasTrigger("click")){this.open?this.hide():this.show()}};this.handleFocus=()=>{if(this.hasTrigger("focus")){this.show()}};this.handleKeyDown=t=>{if(this.open&&t.key==="Escape"){t.stopPropagation();this.hide()}};this.handleMouseOver=()=>{if(this.hasTrigger("hover")){this.show()}};this.handleMouseOut=()=>{if(this.hasTrigger("hover")){this.hide()}};this.handleSlotChange=()=>{this.target=this.getTarget()};this.content="";this.placement="top";this.disabled=false;this.distance=10;this.open=false;this.skidding=0;this.hoist=false;this.trigger="hover focus"}get target(){return this._target}set target(t){if(t!==this._target&&this._target){this._target.removeAttribute("aria-label")}t.setAttribute("aria-label",this.label);this._target=t}setLabel(){const t=Array.from(this.host.querySelectorAll('[slot="content"]'));const o=t.map((t=>t.textContent)).join(" ").trim();if(!this.target){this.target=this.getTarget();if(!this.target)return}this.label=o||this.content;this.target.setAttribute("aria-label",this.label)}handleOpenChange(){this.open?this.show():this.hide()}async show(){if(this.isVisible||this.disabled){return}const t=this.nanoShow.emit();if(t.defaultPrevented){this.open=false;return}this.isVisible=true;this.open=true;this.popover.show()}async hide(){if(!this.isVisible){return}const t=this.nanoHide.emit();if(t.defaultPrevented){this.open=true;return}this.isVisible=false;this.open=false;this.popover.hide()}getTarget(){const t=[...Array.from(this.host.children)].find((t=>t.tagName.toLowerCase()!=="style"&&t.getAttribute("slot")!=="content"));if(!t){throw new Error("Invalid tooltip target: no child element was found.")}return t}hasTrigger(t){const o=this.trigger.split(" ");return o.includes(t)}syncOptions(){this.popover.setOptions({strategy:this.hoist?"fixed":"absolute",placement:this.placement,distance:this.distance,skidding:this.skidding,transitionElement:this.tooltip,onAfterHide:()=>this.nanoAfterHide.emit(),onAfterShow:()=>this.nanoAfterShow.emit()})}componentDidLoad(){this.target=this.getTarget();this.popover=new r(this.target,this.tooltipPositioner);this.syncOptions();this.setLabel();this.tooltipPositioner.hidden=!this.open;if(this.open){this.show()}}componentDidUpdate(){this.syncOptions()}disconnectedCallback(){if(this.popover)this.popover.destroy()}render(){return o(i,{onKeyDown:this.handleKeyDown,onMouseOver:this.handleMouseOver,onMouseOut:this.handleMouseOut,onBlur:this.handleBlur,onFocus:this.handleFocus,onClick:this.handleClick},o("slot",{onSlotchange:this.handleSlotChange}),o("div",{ref:t=>this.tooltipPositioner=t,class:"tooltip-positioner"},o("div",{part:"base",ref:t=>this.tooltip=t,class:{tooltip:true,"tooltip--open":this.open},role:"tooltip","aria-hidden":this.open?"false":"true"},o("slot",{name:"content",onSlotchange:()=>this.setLabel()},this.content),o("div",{class:"tooltip-arrow","data-popper-arrow":true}))))}get host(){return n(this)}static get watchers(){return{content:["setLabel"],open:["handleOpenChange"]}}};d.style=l;export{p as nano_icon_button,d as nano_tooltip};
5
+ //# sourceMappingURL=p-ebb98a9e.entry.js.map