@nanoporetech-digital/components 4.9.4 → 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 (240) hide show
  1. package/CHANGELOG.md +51 -0
  2. package/dist/cjs/drag-777bd8dd.js +74 -0
  3. package/dist/cjs/drag-777bd8dd.js.map +1 -0
  4. package/dist/cjs/{form-control-2e900f54.js → form-control-443e90bf.js} +2 -3
  5. package/dist/cjs/form-control-443e90bf.js.map +1 -0
  6. package/dist/cjs/index-71f899a7.js +10 -2
  7. package/dist/cjs/loader.cjs.js +1 -1
  8. package/dist/cjs/nano-components.cjs.js +1 -1
  9. package/dist/cjs/nano-global-nav-user-profile_3.cjs.entry.js +6 -6
  10. package/dist/cjs/nano-global-nav-user-profile_3.cjs.entry.js.map +1 -1
  11. package/dist/cjs/nano-grid-item.cjs.entry.js +29 -0
  12. package/dist/cjs/nano-grid-item.cjs.entry.js.map +1 -0
  13. package/dist/cjs/nano-grid_2.cjs.entry.js +436 -0
  14. package/dist/cjs/nano-grid_2.cjs.entry.js.map +1 -0
  15. package/dist/cjs/nano-hero.cjs.entry.js +4 -10
  16. package/dist/cjs/nano-hero.cjs.entry.js.map +1 -1
  17. package/dist/cjs/nano-icon-button_2.cjs.entry.js +40 -3
  18. package/dist/cjs/nano-icon-button_2.cjs.entry.js.map +1 -1
  19. package/dist/cjs/nano-input.cjs.entry.js +2 -2
  20. package/dist/cjs/nano-input.cjs.entry.js.map +1 -1
  21. package/dist/cjs/nano-range.cjs.entry.js +1 -1
  22. package/dist/cjs/nano-range.cjs.entry.js.map +1 -1
  23. package/dist/cjs/nano-sortable.cjs.entry.js +654 -0
  24. package/dist/cjs/nano-sortable.cjs.entry.js.map +1 -0
  25. package/dist/cjs/nano-split-pane.cjs.entry.js +30 -45
  26. package/dist/cjs/nano-split-pane.cjs.entry.js.map +1 -1
  27. package/dist/cjs/nano-tab-group.cjs.entry.js +39 -43
  28. package/dist/cjs/nano-tab-group.cjs.entry.js.map +1 -1
  29. package/dist/cjs/nano-tab.cjs.entry.js +3 -3
  30. package/dist/cjs/nano-tab.cjs.entry.js.map +1 -1
  31. package/dist/cjs/{nano-table-54a4ba34.js → nano-table-11052a34.js} +52 -172
  32. package/dist/cjs/nano-table-11052a34.js.map +1 -0
  33. package/dist/cjs/nano-table.cjs.entry.js +1 -1
  34. package/dist/cjs/{table.worker-20ed37a5.js → table.worker-83433a8b.js} +3 -3
  35. package/dist/cjs/table.worker-83433a8b.js.map +1 -0
  36. package/dist/cjs/{table.worker-f820b411.js → table.worker-bd51e29f.js} +1 -1
  37. package/dist/collection/collection-manifest.json +1 -0
  38. package/dist/collection/components/form-control/form-control.js +1 -2
  39. package/dist/collection/components/form-control/form-control.js.map +1 -1
  40. package/dist/collection/components/grid/grid-item.js +11 -136
  41. package/dist/collection/components/grid/grid-item.js.map +1 -1
  42. package/dist/collection/components/grid/grid.css +9 -242
  43. package/dist/collection/components/grid/grid.js +248 -240
  44. package/dist/collection/components/grid/grid.js.map +1 -1
  45. package/dist/collection/components/hero/hero.css +42 -89
  46. package/dist/collection/components/hero/hero.js +4 -11
  47. package/dist/collection/components/hero/hero.js.map +1 -1
  48. package/dist/collection/components/icon-button/icon-button.css +18 -4
  49. package/dist/collection/components/icon-button/icon-button.js +83 -4
  50. package/dist/collection/components/icon-button/icon-button.js.map +1 -1
  51. package/dist/collection/components/input/input.css +8 -9
  52. package/dist/collection/components/nav-item/nav-item.js +4 -4
  53. package/dist/collection/components/nav-item/nav-item.js.map +1 -1
  54. package/dist/collection/components/range/range.css +0 -3
  55. package/dist/collection/components/select/select.css +8 -9
  56. package/dist/collection/components/sortable/sortable.css +28 -0
  57. package/dist/collection/components/sortable/sortable.js +1181 -0
  58. package/dist/collection/components/sortable/sortable.js.map +1 -0
  59. package/dist/collection/components/split-pane/split-pane.js +29 -27
  60. package/dist/collection/components/split-pane/split-pane.js.map +1 -1
  61. package/dist/collection/components/table/table-interface.js.map +1 -1
  62. package/dist/collection/components/table/table.css +18 -38
  63. package/dist/collection/components/table/table.header.js +3 -86
  64. package/dist/collection/components/table/table.header.js.map +1 -1
  65. package/dist/collection/components/table/table.js +27 -108
  66. package/dist/collection/components/table/table.js.map +1 -1
  67. package/dist/collection/components/table/table.row.js +7 -7
  68. package/dist/collection/components/table/table.row.js.map +1 -1
  69. package/dist/collection/components/table/table.store.js +1 -1
  70. package/dist/collection/components/table/table.store.js.map +1 -1
  71. package/dist/collection/components/table/table.worker.js +3 -3
  72. package/dist/collection/components/table/table.worker.js.map +1 -1
  73. package/dist/collection/components/tabs/tab-group.css +9 -13
  74. package/dist/collection/components/tabs/tab-group.js +39 -43
  75. package/dist/collection/components/tabs/tab-group.js.map +1 -1
  76. package/dist/collection/components/tabs/tab.css +53 -14
  77. package/dist/collection/components/tabs/tab.js +8 -2
  78. package/dist/collection/components/tabs/tab.js.map +1 -1
  79. package/dist/collection/utils/constructible-style.js +129 -0
  80. package/dist/collection/utils/constructible-style.js.map +1 -0
  81. package/dist/collection/utils/drag.js +52 -4
  82. package/dist/collection/utils/drag.js.map +1 -1
  83. package/dist/components/drag.js +72 -0
  84. package/dist/components/drag.js.map +1 -0
  85. package/dist/components/form-control.js +1 -2
  86. package/dist/components/form-control.js.map +1 -1
  87. package/dist/components/grid.js +268 -183
  88. package/dist/components/grid.js.map +1 -1
  89. package/dist/components/icon-button.js +45 -5
  90. package/dist/components/icon-button.js.map +1 -1
  91. package/dist/components/index.d.ts +1 -0
  92. package/dist/components/index.js +1 -0
  93. package/dist/components/index.js.map +1 -1
  94. package/dist/components/input.js +1 -1
  95. package/dist/components/input.js.map +1 -1
  96. package/dist/components/nano-grid-item.js +33 -1
  97. package/dist/components/nano-grid-item.js.map +1 -1
  98. package/dist/components/nano-hero.js +6 -19
  99. package/dist/components/nano-hero.js.map +1 -1
  100. package/dist/components/nano-range.js +1 -1
  101. package/dist/components/nano-range.js.map +1 -1
  102. package/dist/components/nano-sortable.d.ts +11 -0
  103. package/dist/components/nano-sortable.js +692 -0
  104. package/dist/components/nano-sortable.js.map +1 -0
  105. package/dist/components/nano-split-pane.js +30 -45
  106. package/dist/components/nano-split-pane.js.map +1 -1
  107. package/dist/components/nano-tab-group.js +40 -44
  108. package/dist/components/nano-tab-group.js.map +1 -1
  109. package/dist/components/nano-tab.js +3 -3
  110. package/dist/components/nano-tab.js.map +1 -1
  111. package/dist/components/nav-item.js +4 -4
  112. package/dist/components/nav-item.js.map +1 -1
  113. package/dist/components/select.js +1 -1
  114. package/dist/components/select.js.map +1 -1
  115. package/dist/components/table.js +52 -173
  116. package/dist/components/table.js.map +1 -1
  117. package/dist/components/table.worker.js +1 -1
  118. package/dist/esm/drag-1723a4cc.js +72 -0
  119. package/dist/esm/drag-1723a4cc.js.map +1 -0
  120. package/dist/esm/{form-control-269ba84f.js → form-control-e8739b2e.js} +2 -3
  121. package/dist/esm/form-control-e8739b2e.js.map +1 -0
  122. package/dist/esm/index-dad5627b.js +10 -2
  123. package/dist/esm/loader.js +1 -1
  124. package/dist/esm/nano-components.js +1 -1
  125. package/dist/esm/nano-global-nav-user-profile_3.entry.js +6 -6
  126. package/dist/esm/nano-global-nav-user-profile_3.entry.js.map +1 -1
  127. package/dist/esm/nano-grid-item.entry.js +25 -0
  128. package/dist/esm/nano-grid-item.entry.js.map +1 -0
  129. package/dist/esm/nano-grid_2.entry.js +431 -0
  130. package/dist/esm/nano-grid_2.entry.js.map +1 -0
  131. package/dist/esm/nano-hero.entry.js +4 -10
  132. package/dist/esm/nano-hero.entry.js.map +1 -1
  133. package/dist/esm/nano-icon-button_2.entry.js +41 -4
  134. package/dist/esm/nano-icon-button_2.entry.js.map +1 -1
  135. package/dist/esm/nano-input.entry.js +2 -2
  136. package/dist/esm/nano-input.entry.js.map +1 -1
  137. package/dist/esm/nano-range.entry.js +1 -1
  138. package/dist/esm/nano-range.entry.js.map +1 -1
  139. package/dist/esm/nano-sortable.entry.js +650 -0
  140. package/dist/esm/nano-sortable.entry.js.map +1 -0
  141. package/dist/esm/nano-split-pane.entry.js +30 -45
  142. package/dist/esm/nano-split-pane.entry.js.map +1 -1
  143. package/dist/esm/nano-tab-group.entry.js +39 -43
  144. package/dist/esm/nano-tab-group.entry.js.map +1 -1
  145. package/dist/esm/nano-tab.entry.js +3 -3
  146. package/dist/esm/nano-tab.entry.js.map +1 -1
  147. package/dist/esm/{nano-table-929ac4d9.js → nano-table-ba637f26.js} +53 -173
  148. package/dist/esm/nano-table-ba637f26.js.map +1 -0
  149. package/dist/esm/nano-table.entry.js +1 -1
  150. package/dist/esm/{table.worker-2425382a.js → table.worker-1cae39c9.js} +3 -3
  151. package/dist/esm/table.worker-1cae39c9.js.map +1 -0
  152. package/dist/{nano-components/p-f820b411.js → esm/table.worker-bd51e29f.js} +1 -1
  153. package/dist/nano-components/nano-components.css +1 -1
  154. package/dist/nano-components/nano-components.esm.js +1 -1
  155. package/dist/nano-components/nano-components.esm.js.map +1 -1
  156. package/dist/nano-components/p-00cf8021.entry.js +5 -0
  157. package/dist/nano-components/p-00cf8021.entry.js.map +1 -0
  158. package/dist/nano-components/{p-906de5a2.entry.js → p-158c73b0.entry.js} +2 -2
  159. package/dist/nano-components/p-365c997a.js +5 -0
  160. package/dist/nano-components/p-553acf24.entry.js +5 -0
  161. package/dist/nano-components/p-553acf24.entry.js.map +1 -0
  162. package/dist/nano-components/p-6975f110.entry.js +5 -0
  163. package/dist/nano-components/p-6975f110.entry.js.map +1 -0
  164. package/dist/nano-components/p-71057181.js +5 -0
  165. package/dist/nano-components/p-71057181.js.map +1 -0
  166. package/dist/nano-components/p-842cf127.js +5 -0
  167. package/dist/nano-components/p-842cf127.js.map +1 -0
  168. package/dist/nano-components/p-ad6209ec.entry.js +5 -0
  169. package/dist/nano-components/p-ad6209ec.entry.js.map +1 -0
  170. package/dist/nano-components/p-b8e76fdf.entry.js +5 -0
  171. package/dist/nano-components/p-b8e76fdf.entry.js.map +1 -0
  172. package/dist/{esm/table.worker-f820b411.js → nano-components/p-bd51e29f.js} +1 -1
  173. package/dist/nano-components/p-bdef618c.entry.js +5 -0
  174. package/dist/nano-components/p-bdef618c.entry.js.map +1 -0
  175. package/dist/nano-components/p-d79c6862.entry.js +5 -0
  176. package/dist/nano-components/p-d79c6862.entry.js.map +1 -0
  177. package/dist/nano-components/p-deb0799c.entry.js +5 -0
  178. package/dist/nano-components/{p-6a3a29c6.entry.js.map → p-deb0799c.entry.js.map} +1 -1
  179. package/dist/nano-components/p-ebb98a9e.entry.js +5 -0
  180. package/dist/nano-components/p-ebb98a9e.entry.js.map +1 -0
  181. package/dist/nano-components/p-f60fe933.entry.js +5 -0
  182. package/dist/nano-components/p-f60fe933.entry.js.map +1 -0
  183. package/dist/nano-components/p-f7535f45.entry.js +5 -0
  184. package/dist/nano-components/p-f7535f45.entry.js.map +1 -0
  185. package/dist/nano-components/p-fc585ea2.js +5 -0
  186. package/dist/nano-components/p-fc585ea2.js.map +1 -0
  187. package/dist/types/components/grid/grid-item.d.ts +3 -11
  188. package/dist/types/components/grid/grid.d.ts +44 -68
  189. package/dist/types/components/hero/hero.d.ts +1 -3
  190. package/dist/types/components/icon-button/icon-button.d.ts +14 -0
  191. package/dist/types/components/sortable/sortable.d.ts +204 -0
  192. package/dist/types/components/table/table-interface.d.ts +2 -4
  193. package/dist/types/components/table/table.d.ts +5 -30
  194. package/dist/types/components/table/table.header.d.ts +0 -3
  195. package/dist/types/components/tabs/tab-group.d.ts +0 -1
  196. package/dist/types/components/tabs/tab.d.ts +6 -0
  197. package/dist/types/components.d.ts +333 -89
  198. package/dist/types/utils/constructible-style.d.ts +31 -0
  199. package/dist/types/utils/drag.d.ts +21 -1
  200. package/docs-json.json +743 -168
  201. package/docs-vscode.json +102 -26
  202. package/hydrate/index.js +1210 -552
  203. package/package.json +2 -2
  204. package/dist/cjs/form-control-2e900f54.js.map +0 -1
  205. package/dist/cjs/nano-grid_3.cjs.entry.js +0 -431
  206. package/dist/cjs/nano-grid_3.cjs.entry.js.map +0 -1
  207. package/dist/cjs/nano-table-54a4ba34.js.map +0 -1
  208. package/dist/cjs/table.worker-20ed37a5.js.map +0 -1
  209. package/dist/collection/components/grid/grid-item.css +0 -15
  210. package/dist/components/grid-item.js +0 -107
  211. package/dist/components/grid-item.js.map +0 -1
  212. package/dist/esm/form-control-269ba84f.js.map +0 -1
  213. package/dist/esm/nano-grid_3.entry.js +0 -425
  214. package/dist/esm/nano-grid_3.entry.js.map +0 -1
  215. package/dist/esm/nano-table-929ac4d9.js.map +0 -1
  216. package/dist/esm/table.worker-2425382a.js.map +0 -1
  217. package/dist/nano-components/p-068bdd89.entry.js +0 -5
  218. package/dist/nano-components/p-068bdd89.entry.js.map +0 -1
  219. package/dist/nano-components/p-107d4549.entry.js +0 -5
  220. package/dist/nano-components/p-107d4549.entry.js.map +0 -1
  221. package/dist/nano-components/p-239d343a.entry.js +0 -5
  222. package/dist/nano-components/p-239d343a.entry.js.map +0 -1
  223. package/dist/nano-components/p-4f260028.js +0 -5
  224. package/dist/nano-components/p-4f260028.js.map +0 -1
  225. package/dist/nano-components/p-5381c118.js +0 -5
  226. package/dist/nano-components/p-58b53239.entry.js +0 -5
  227. package/dist/nano-components/p-58b53239.entry.js.map +0 -1
  228. package/dist/nano-components/p-5ac74848.js +0 -5
  229. package/dist/nano-components/p-5ac74848.js.map +0 -1
  230. package/dist/nano-components/p-64b56ee6.entry.js +0 -5
  231. package/dist/nano-components/p-64b56ee6.entry.js.map +0 -1
  232. package/dist/nano-components/p-6a3a29c6.entry.js +0 -5
  233. package/dist/nano-components/p-a5a560e7.entry.js +0 -5
  234. package/dist/nano-components/p-a5a560e7.entry.js.map +0 -1
  235. package/dist/nano-components/p-a761ac89.entry.js +0 -5
  236. package/dist/nano-components/p-a761ac89.entry.js.map +0 -1
  237. package/dist/nano-components/p-d792f692.entry.js +0 -5
  238. package/dist/nano-components/p-d792f692.entry.js.map +0 -1
  239. /package/dist/nano-components/{p-5381c118.js.map → p-158c73b0.entry.js.map} +0 -0
  240. /package/dist/nano-components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encil/core';\nimport { debounce } from '../../utils/throttle';\nimport type { GridSizes } from '../../interface';\n\nconst STATEOPTS = ['col-span', 'col-start', 'row-span', 'row-start'];\n\n/**\n * A context-aware CSS grid implementation.\n * Uses it's own width to choose column number - not screen width.\n */\n@Component({\n tag: 'nano-grid',\n styleUrl: 'grid.scss',\n shadow: true,\n})\nexport class Grid {\n @Element() private el: HTMLNanoGridElement;\n private ro: ResizeObserver;\n private generalClasses: Array<string> = [''];\n private gridClass: string = null;\n private isSizes: GridSizes[] = [null];\n private currentWidth: number;\n\n constructor() {\n this.stateChange = debounce(this.stateChange.bind(this), 100);\n }\n\n @State() ready: boolean = false;\n @State() isSmall = false;\n @State() isMedium = false;\n @State() isLarge = false;\n @State() isXL = false;\n @State() isXXL = false;\n\n /**\n * the component's small breakpoint. Note - all breakpoints are based on component width, not screen width.\n */\n @Prop() sSize: number = 300;\n\n /**\n * the component's medium breakpoint. Note - all breakpoints are based on component width, not screen width.\n */\n @Prop() mSize: number = 550;\n\n /**\n * the component's large breakpoint. Note - all breakpoints are based on component width, not screen width.\n */\n @Prop() lSize: number = 800;\n\n /**\n * the component's xl breakpoint. Note - all breakpoints are based on component width, not screen width.\n */\n @Prop() xlSize: number = 1000;\n\n /**\n * the number of columns the grid has at the small breakpoint.\n */\n @Prop() sCols: number;\n\n /**\n * the number of columns the grid has at the medium breakpoint.\n */\n @Prop() mCols: number;\n\n /**\n * the number of columns the grid has at the large breakpoint.\n */\n @Prop() lCols: number;\n\n /**\n * the number of columns the grid has at the xl breakpoint.\n */\n @Prop() xlCols: number;\n\n /**\n * the number of columns the grid has at the xxl breakpoint (anything greater than the xl breakpoint)\n */\n @Prop() xxlCols: number;\n\n /**\n * shows a grid helper to visualise where columns are\n */\n @Prop({ reflect: true }) showHelper: boolean = false;\n\n /**\n * shortcut for a traditional website like grid (requires more than one row). The second row will auto expand to fill the grid height. The first row and > 2nd row will be the size of their content. e.g. header, body and footer.\n */\n @Prop({ reflect: true }) contentPanel: boolean = false;\n\n /**\n * Helper to make grid items expand to full height in IE11\n */\n @Prop({ reflect: true }) fullHeight: boolean = false;\n\n /**\n * Emitted when the `nano-grid` changes breakpoint\n */\n @Event() nanoBpChange: EventEmitter<string[]>;\n\n @Watch('sSize')\n @Watch('mSize')\n @Watch('lSize')\n @Watch('xlSize')\n @Watch('sCols')\n @Watch('mCols')\n @Watch('lCols')\n @Watch('xlCols')\n @Watch('xxlCols')\n propChanged() {\n this.applySizeClasses();\n }\n\n private applySizeClasses() {\n const size = this.currentWidth;\n\n this.isSmall = false;\n this.isMedium = false;\n this.isLarge = false;\n this.isXL = false;\n this.isXXL = false;\n\n this.generalClasses = [];\n this.gridClass = null;\n this.isSizes = [null];\n\n this.isSmall = true;\n this.generalClasses.push('is-small');\n if (this.sCols) this.gridClass = `nano-grid-${this.sCols}`;\n this.isSizes.push({ size: 's', active: true });\n\n if (size > this.sSize) {\n this.isMedium = true;\n this.generalClasses.push('is-medium');\n if (this.mCols) this.gridClass = `nano-grid-${this.mCols}`;\n this.isSizes.push({ size: 'm', active: true });\n }\n\n if (size > this.mSize) {\n this.isLarge = true;\n this.generalClasses.push('is-large');\n if (this.lCols) this.gridClass = `nano-grid-${this.lCols}`;\n this.isSizes.push({ size: 'l', active: true });\n }\n\n if (size > this.lSize) {\n this.isXL = true;\n this.generalClasses.push('is-xl');\n if (this.xlCols) this.gridClass = `nano-grid-${this.xlCols}`;\n this.isSizes.push({ size: 'xl', active: true });\n }\n\n if (size > this.xlSize) {\n this.isXXL = true;\n this.generalClasses.push('is-xxl');\n if (this.xxlCols) this.gridClass = `nano-grid-${this.xxlCols}`;\n this.isSizes.push({ size: 'xxl', active: true });\n }\n\n this.el.style.setProperty(\n '--current-grid-size',\n `'grid size: ${this.isSizes.slice().pop().size}'`\n );\n this.applyChildrenClasses();\n setTimeout(() => (this.ready = true), 0);\n }\n\n @Watch('isSmall')\n @Watch('isMedium')\n @Watch('isLarge')\n @Watch('isXL')\n @Watch('isXXL')\n stateChange() {\n this.nanoBpChange.emit(this.generalClasses);\n }\n\n private applyChildrenClasses() {\n const gridItems = this.el.querySelectorAll('nano-grid-item');\n if (gridItems.length) {\n gridItems.forEach((gridItem: HTMLNanoGridItemElement) => {\n gridItem.changeBP(this.isSizes);\n });\n return;\n }\n\n // this logic has been put into grid-item. Keep here for legacy for now\n let stateArr: Array<string> = [''];\n let itemState: string = '';\n let found: any;\n let classes: Array<string>;\n\n const ctx = this.el;\n\n // item states come in 4 possible flavours at every breakpoint. E.g.\n // xl-col-span-2\n // xl-col-start-2\n // xl-row-span-2\n // xl-row-start-2\n\n // loop through all grid items with states.\n [].map.call(ctx.children, (gItem: HTMLElement) => {\n if (!gItem.hasAttribute('grid-states')) return;\n\n // gridItems.forEach(gItem => {\n\n // clear all previous grid state classnames\n classes = gItem.className\n .split(' ')\n .filter((c) => !c.startsWith('nano-grid-'));\n gItem.className = classes.join(' ').trim();\n\n // get all potential states this element can have\n const itemStates = gItem.getAttribute('grid-states').split(' ');\n\n // loop through all potential state options: col & row span & start\n STATEOPTS.forEach((stateOpt) => {\n // reset found flag\n found = false;\n\n // loop through all the current valid breakpoints / sizes backwards because\n // we only care about the item's state at the largest current breakpoint.\n this.isSizes\n .slice()\n .reverse()\n .forEach(function (size) {\n if (found || !size) return;\n found = itemStates.find(\n (state) => state.indexOf(`${size.size}-${stateOpt}`) === 0\n );\n\n // found a state at this current size. apply class.\n if (found) {\n // clear previous grid state classname\n classes = gItem.className\n .split(' ')\n .filter((c) => !c.includes('nano-grid-${stateOpt}'));\n gItem.className = classes.join(' ').trim();\n\n stateArr = found.split('-');\n\n // remove the size of the state\n stateArr.shift();\n itemState = stateArr.join('-');\n\n // add new class\n gItem.classList.add(`nano-grid-${itemState}`);\n }\n });\n });\n });\n }\n\n componentWillLoad() {\n const ctx = this.el;\n [].map.call(ctx.children, (ele: HTMLElement) =>\n ele.classList.add('nano-griditem')\n );\n }\n\n componentDidLoad() {\n if (!window['ResizeObserver']) return;\n\n this.ro = new ResizeObserver((entries) => {\n for (const entry of entries) {\n if (!entry.contentRect.width) return;\n this.currentWidth = entry.contentRect.width;\n this.applySizeClasses();\n }\n });\n this.ro.observe(this.el);\n }\n\n disconnectedCallback() {\n if (this.ro) this.ro.disconnect();\n }\n\n render() {\n return (\n <Host\n class={{\n [this.generalClasses.join(' ')]: true,\n 'has-grid': !!this.gridClass,\n ready: this.ready,\n [this.gridClass]: true,\n }}\n >\n <div\n class={{\n grid: true,\n }}\n >\n <slot />\n </div>\n </Host>\n );\n }\n}\n"]}
1
+ {"version":3,"file":"grid.js","sourceRoot":"","sources":["../../../src/components/grid/grid.tsx"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACvE,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAErE;;;;;;;;;;;;;GAaG;AAMH,MAAM,OAAO,IAAI;;IACP,UAAK,GAKP,EAAE,CAAC;IAkHuD,WAAM,GACpE,GAAG,EAAE;MACH,MAAM,GAAG,GAAG,SAAS,CAAC;QACpB,IAAI,CAAC,KAAK;SACT,GAAG,CACF,CAAC,EAAE,EAAE,EAAE,CAAC,SAAS,CAAC;mCAEhB,OAAO,EAAE,CAAC,UAAU,KAAK,QAAQ;QAC/B,CAAC,CAAC,EAAE,CAAC,UAAU,GAAG,CAAC,GAAG,IAAI;QAC1B,CAAC,CAAC,EAAE,CAAC,UACT;;iDAEuC,EAAE,CAAC,IAAI;gBAExC,EAAE,CAAC,QAAQ;QACT,CAAC,CAAC,kBAAkB,EAAE,CAAC,QAAQ,GAAG;QAClC,CAAC,CAAC,iCAAiC,EAAE,CAAC,IAAI,SAC9C;;cAEA,CAAC,GAAG,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC;SAClB,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;QACZ,MAAM,IAA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,GAAG,CAAC,GAAG,EAAE,CAAC,CACxB,WAAK,KAAK,EAAC,mBAAmB,GAAG,CAClC,CAAC,CACE,CACP,CACI,CACR,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF;AA9EC;EAAC,kBAAkB,CAAC,EAAE,gBAAgB,EAAE,UAAU,EAAE,CAAC;;oCAwDjD","sourcesContent":["import { Component, h, Prop, Host, State, Watch } from '@stencil/core';\nimport { ConstructibleStyle } from '../../utils/constructible-style';\n\n/**\n * A lightweight, context-aware CSS grid implementation.\n *\n * - Define multiple grids templates at different breakpoints\n * - Uses `@container` queries to select the correct grid depending on the current dimensions\n * - Use `grid-states=\"...\"` on direct descendants for `column` / `row` - `start` / `end`\n * - SSR optimised\n\n * @part grid - the main grid element.\n * Use this to set css such as `justify-items|content` / `align-items|content` / `place-content`\n * @part helper - a replica grid showed when `show-helper` is true\n *\n * @slot - default slot. Use this to place grid items. Use `grid-states=\"...\"` attribute to opt-out of auto / sequential placement.\n */\n@Component({\n tag: 'nano-grid',\n styleUrl: 'grid.scss',\n shadow: true,\n})\nexport class Grid {\n private grids: {\n cols: number;\n breakpoint: number | string;\n name: string;\n template?: string;\n }[] = [];\n @State() cacheKey: string;\n\n /** the component's small breakpoint. Note - all breakpoints are based on component width, not screen width.\n * Will default to `px` if no unit supplied e.g. `20rem` */\n @Prop() sSize: number | string = 300;\n\n /** the component's medium breakpoint. Note - all breakpoints are based on component width, not screen width.\n * Will default to `px` if no unit supplied e.g. `20rem` */\n @Prop() mSize: number | string = 550;\n\n /** the component's large breakpoint. Note - all breakpoints are based on component width, not screen width.\n * Will default to `px` if no unit supplied e.g. `20rem` */\n @Prop() lSize: number | string = 800;\n\n /** the component's xl breakpoint. Note - all breakpoints are based on component width, not screen width.\n * Will default to `px` if no unit supplied e.g. `20rem` */\n @Prop() xlSize: number | string = 1000;\n\n /** the number of columns the grid has at the small breakpoint. */\n @Prop() sCols: number;\n\n /** the number of columns the grid has at the medium breakpoint. */\n @Prop() mCols: number;\n\n /** the number of columns the grid has at the large breakpoint. */\n @Prop() lCols: number;\n\n /** the number of columns the grid has at the xl breakpoint. */\n @Prop() xlCols: number;\n\n /** the number of columns the grid has at the xxl breakpoint (anything greater than the xl breakpoint) */\n @Prop() xxlCols: number;\n\n /** Optional small `grid-template`. *Note* - you must set `sCols` for this to take affect */\n @Prop() sTpl?: string;\n\n /** Optional medium `grid-template`. *Note* - you must set `mCols` for this to take affect */\n @Prop() mTpl?: string;\n\n /** Optional large `grid-template`. *Note* - you must set `lCols` for this to take affect */\n @Prop() lTpl?: string;\n\n /** Optional xl `grid-template`. *Note* - you must set `xlCols` for this to take affect */\n @Prop() xlTpl?: string;\n\n /** Optional xxl `grid-template`. *Note* - you must set `xxlCols` for this to take affect */\n @Prop() xxlTpl?: string;\n\n /** shows a grid helper to visualise where columns are */\n @Prop({ reflect: true }) showHelper: boolean = false;\n\n @Watch('sTpl')\n @Watch('mTpl')\n @Watch('lTpl')\n @Watch('xlTpl')\n @Watch('xxlTpl')\n @Watch('sSize')\n @Watch('mSize')\n @Watch('lSize')\n @Watch('xlSize')\n @Watch('sCols')\n @Watch('mCols')\n @Watch('lCols')\n @Watch('xlCols')\n @Watch('xxlCols')\n @Watch('showHelper')\n constructSizeArray() {\n this.grids = [];\n\n if (this.sCols)\n this.grids.push({\n cols: this.sCols,\n breakpoint: 0,\n name: 's',\n template: this.sTpl,\n });\n if (this.mCols)\n this.grids.push({\n cols: this.mCols,\n breakpoint: this.sSize,\n name: 'm',\n template: this.mTpl,\n });\n if (this.lSize)\n this.grids.push({\n cols: this.lCols,\n breakpoint: this.mSize,\n name: 'l',\n template: this.lTpl,\n });\n if (this.xlCols)\n this.grids.push({\n cols: this.xlCols,\n breakpoint: this.lSize,\n name: 'xl',\n template: this.xlTpl,\n });\n if (this.xxlCols)\n this.grids.push({\n cols: this.xxlCols,\n breakpoint: this.xlSize,\n name: 'xxl',\n template: this.xxlTpl,\n });\n\n this.cacheKey =\n this.grids\n .map((bp) => `${bp.cols}-${bp.breakpoint}-${bp.template || ''}`)\n .join('') +\n '-helper-' +\n this.showHelper;\n }\n\n @ConstructibleStyle({ cacheKeyProperty: 'cacheKey' }) protected styles =\n () => {\n const css = /* css */ `\n ${this.grids\n .map(\n (bp) => /* css */ `\n @container (min-width: ${\n typeof bp.breakpoint === 'number'\n ? bp.breakpoint + 1 + 'px'\n : bp.breakpoint\n }) {\n .grid {\n --current-grid-size: \"grid size: ${bp.name}\";\n ${\n bp.template\n ? `grid-template: ${bp.template};`\n : `grid-template-columns: repeat(${bp.cols}, 1fr);`\n }\n }\n ${[...Array(bp.cols)]\n .map((_, i) => {\n const gItm = i + 1;\n return /* css */ `\n .grid > [grid-states~=\"${bp.name}-col-start-${gItm}\"],\n ::slotted([grid-states~=\"${bp.name}-col-start-${gItm}\"]) {\n grid-column-start: ${gItm} !important;\n }\n .grid > [grid-states~=\"${bp.name}-row-start-${gItm}\"],\n ::slotted([grid-states~=\"${bp.name}-row-start-${gItm}\"]) {\n grid-row-start: ${gItm} !important;\n }\n .grid > [grid-states~=\"${bp.name}-col-span-${gItm}\"],\n ::slotted([grid-states~=\"${bp.name}-col-span-${gItm}\"]) {\n grid-column-end: span ${gItm} !important;\n }\n .grid > [grid-states~=\"${bp.name}-row-span-${gItm}\"],\n ::slotted([grid-states~=\"${bp.name}-row-span-${gItm}\"]) {\n grid-row-end: span ${gItm} !important;\n }\n `;\n })\n .join('')}\n ${\n this.showHelper &&\n /* css */ `\n .grid--helper :nth-child(-n+${bp.cols}) {\n display: block !important;\n }\n `\n }\n }\n `\n )\n .join('')}\n `;\n return css;\n };\n\n componentWillLoad() {\n this.constructSizeArray();\n }\n\n render() {\n return (\n <Host>\n <div part=\"grid\" class=\"grid\">\n <slot />\n </div>\n {this.showHelper && (\n <div class=\"grid grid--helper\" part=\"helper\">\n {[...Array(24)].map(() => (\n <div class=\"grid__helper-item\" />\n ))}\n </div>\n )}\n </Host>\n );\n }\n}\n"]}
@@ -25,7 +25,6 @@ TODO - as soon as container queries hits everywhere, strip out reliance on nano-
25
25
  * @prop --scrim-opacity-to: Final opactiy of the gradient covering the background. Default depends on `theme`;
26
26
  * @prop --quote-size: Font size of the quote. Defaults to 1.3em and grows to 3rem on the xl breakpoint;
27
27
  */
28
- display: block;
29
28
  --nano-loader-base: #4a4a4a;
30
29
  --nano-loader-tint: #7d7d7d;
31
30
  --theme-color: #fff;
@@ -37,10 +36,8 @@ TODO - as soon as container queries hits everywhere, strip out reliance on nano-
37
36
  --padding: 0;
38
37
  --quote-size: 1.3rem;
39
38
  color: var(--theme-color);
40
- }
41
-
42
- :host(.is-xl) {
43
- --quote-size: 3rem;
39
+ display: block;
40
+ container-type: inline-size;
44
41
  }
45
42
 
46
43
  :host([theme=light]) {
@@ -60,6 +57,11 @@ TODO - as soon as container queries hits everywhere, strip out reliance on nano-
60
57
  .hero {
61
58
  position: relative;
62
59
  }
60
+ @container (min-width: 800px) {
61
+ .hero {
62
+ --quote-size: 3rem;
63
+ }
64
+ }
63
65
  .hero--rtl {
64
66
  --scrim-direction: 270deg;
65
67
  }
@@ -103,7 +105,6 @@ TODO - as soon as container queries hits everywhere, strip out reliance on nano-
103
105
  }
104
106
  .hero__img {
105
107
  display: block;
106
- container-type: inline-size;
107
108
  --padding: inherit;
108
109
  }
109
110
  .hero__breadcrumbs {
@@ -115,11 +116,6 @@ TODO - as soon as container queries hits everywhere, strip out reliance on nano-
115
116
  .hero--breadcrumb .hero__breadcrumbs {
116
117
  display: block;
117
118
  }
118
- .is-xl .hero__breadcrumbs {
119
- margin-block: 0;
120
- margin-inline: 50px;
121
- max-inline-size: 50%;
122
- }
123
119
  @container (min-width: 800px) {
124
120
  .hero__breadcrumbs {
125
121
  margin-block: 0;
@@ -127,10 +123,6 @@ TODO - as soon as container queries hits everywhere, strip out reliance on nano-
127
123
  max-inline-size: 50%;
128
124
  }
129
125
  }
130
- .is-xxl .hero__breadcrumbs {
131
- margin-block: 0;
132
- margin-inline: 83px;
133
- }
134
126
  @container (min-width: 900px) {
135
127
  .hero__breadcrumbs {
136
128
  margin-block: 0;
@@ -180,22 +172,12 @@ TODO - as soon as container queries hits everywhere, strip out reliance on nano-
180
172
  margin-inline: auto;
181
173
  position: relative;
182
174
  }
183
- .hero__content.is-xl {
184
- -webkit-margin-before: 50px;
185
- margin-block-start: 50px;
186
- max-inline-size: 1540px;
187
- }
188
175
  @container (min-width: 800px) {
189
176
  .hero__content {
190
177
  margin-block: 50px 0 !important;
191
178
  max-inline-size: 1540px !important;
192
179
  }
193
180
  }
194
- .hero__content.is-xxl {
195
- -webkit-margin-before: 83px;
196
- margin-block-start: 83px;
197
- max-inline-size: 1606px;
198
- }
199
181
  @container (min-width: 900px) {
200
182
  .hero__content {
201
183
  margin-block: 83px 0 !important;
@@ -216,14 +198,6 @@ TODO - as soon as container queries hits everywhere, strip out reliance on nano-
216
198
  .hero__primary ::slotted(nano-icon-button[slot=back-btn]) {
217
199
  font-size: 2rem;
218
200
  }
219
- .is-xl .hero__primary {
220
- margin-block: 0 50px;
221
- margin-inline: 50px 0;
222
- }
223
- .is-xl .hero__primary ::slotted(nano-icon-button[slot=back-btn]) {
224
- margin-block: 0;
225
- margin-inline: -3rem 0;
226
- }
227
201
  @container (min-width: 800px) {
228
202
  .hero__primary {
229
203
  margin-block: 0 50px !important;
@@ -234,10 +208,6 @@ TODO - as soon as container queries hits everywhere, strip out reliance on nano-
234
208
  margin-inline: -3rem 0 !important;
235
209
  }
236
210
  }
237
- .is-xxl .hero__primary {
238
- margin-block: 0 83px !important;
239
- margin-inline: 83px 0 !important;
240
- }
241
211
  @container (min-width: 900px) {
242
212
  .hero__primary {
243
213
  margin-block: 0 83px !important;
@@ -258,15 +228,6 @@ TODO - as soon as container queries hits everywhere, strip out reliance on nano-
258
228
  margin-block: 0 18px !important;
259
229
  font-size: 2rem !important;
260
230
  }
261
- .is-xl .hero__primary-content ::slotted(h1[slot=primary-content]) {
262
- line-height: 31px !important;
263
- -webkit-margin-after: 30px !important;
264
- margin-block-end: 30px !important;
265
- }
266
- .is-xl .hero__primary-content ::slotted(.button[slot=primary-content]) {
267
- -webkit-margin-before: 20px !important;
268
- margin-block-start: 20px !important;
269
- }
270
231
  @container (min-width: 800px) {
271
232
  .hero__primary-content ::slotted(h1[slot=primary-content]) {
272
233
  line-height: 31px !important;
@@ -288,11 +249,6 @@ TODO - as soon as container queries hits everywhere, strip out reliance on nano-
288
249
  display: flex;
289
250
  align-items: center;
290
251
  }
291
- .is-xl .hero__secondary {
292
- padding-block: 0 50px;
293
- padding-inline: 50px;
294
- justify-content: flex-end;
295
- }
296
252
  @container (min-width: 800px) {
297
253
  .hero__secondary {
298
254
  padding-block: 0 50px;
@@ -300,10 +256,6 @@ TODO - as soon as container queries hits everywhere, strip out reliance on nano-
300
256
  justify-content: flex-end;
301
257
  }
302
258
  }
303
- .is-xxl .hero__secondary {
304
- padding-block: 0 83px;
305
- padding-inline: 83px;
306
- }
307
259
  @container (min-width: 900px) {
308
260
  .hero__secondary {
309
261
  padding-block: 0 83px;
@@ -320,9 +272,11 @@ TODO - as soon as container queries hits everywhere, strip out reliance on nano-
320
272
  flex-direction: column;
321
273
  color: white;
322
274
  }
323
- .is-xl .hero__icon-box {
324
- max-inline-size: 410px;
325
- flex: 0 1 410px;
275
+ @container (min-width: 800px) {
276
+ .hero__icon-box {
277
+ max-inline-size: 410px;
278
+ flex: 0 1 410px;
279
+ }
326
280
  }
327
281
  .hero__icon-box ::slotted([slot=icon-box-item]) {
328
282
  --nano-color-base: var(--theme-tint-color);
@@ -344,11 +298,6 @@ TODO - as soon as container queries hits everywhere, strip out reliance on nano-
344
298
  text-align: center;
345
299
  inline-size: 100%;
346
300
  }
347
- .is-xl .hero__quote-content {
348
- max-inline-size: 500px;
349
- flex: 0 1 500px;
350
- text-align: initial;
351
- }
352
301
  @container (min-width: 800px) {
353
302
  .hero__quote-content {
354
303
  max-inline-size: 500px;
@@ -377,31 +326,35 @@ TODO - as soon as container queries hits everywhere, strip out reliance on nano-
377
326
  font-size: 1rem;
378
327
  opacity: 0.8;
379
328
  }
380
- .hero--sub .hero__content.is-xl {
381
- -webkit-margin-before: 40px;
382
- margin-block-start: 40px;
383
- }
384
- .hero--sub .hero__content.is-xl .hero__primary {
385
- margin-block: 0 40px;
386
- margin-inline: 50px 0;
387
- }
388
- .hero--sub .hero__content.is-xl .hero__secondary {
389
- padding-block: 0 50px;
390
- padding-inline: 40px 50px;
391
- }
392
- .hero--sub .hero__content.is-xl ::slotted(.button[slot=primary-content]) {
393
- -webkit-margin-before: 8px !important;
394
- margin-block-start: 8px !important;
395
- }
396
- .hero--sub .hero__content.is-xl ::slotted(h1[slot=primary-content]) {
397
- -webkit-margin-after: 18px !important;
398
- margin-block-end: 18px !important;
399
- }
400
- .hero--sub .hero__content.is-xxl .hero__primary {
401
- margin-block: 0 40px;
402
- margin-inline: 83px 0;
329
+ @container (min-width: 800px) {
330
+ .hero--sub .hero__content {
331
+ -webkit-margin-before: 40px;
332
+ margin-block-start: 40px;
333
+ }
334
+ .hero--sub .hero__content .hero__primary {
335
+ margin-block: 0 40px;
336
+ margin-inline: 50px 0;
337
+ }
338
+ .hero--sub .hero__content .hero__secondary {
339
+ padding-block: 0 50px;
340
+ padding-inline: 40px 50px;
341
+ }
342
+ .hero--sub .hero__content ::slotted(.button[slot=primary-content]) {
343
+ -webkit-margin-before: 8px !important;
344
+ margin-block-start: 8px !important;
345
+ }
346
+ .hero--sub .hero__content ::slotted(h1[slot=primary-content]) {
347
+ -webkit-margin-after: 18px !important;
348
+ margin-block-end: 18px !important;
349
+ }
403
350
  }
404
- .hero--sub .hero__content.is-xxl .hero__secondary {
405
- padding-block: 0 83px;
406
- padding-inline: 40px 83px;
351
+ @container (min-width: 900px) {
352
+ .hero--sub .hero__content .hero__primary {
353
+ margin-block: 0 40px;
354
+ margin-inline: 83px 0;
355
+ }
356
+ .hero--sub .hero__content .hero__secondary {
357
+ padding-block: 0 83px;
358
+ padding-inline: 40px 83px;
359
+ }
407
360
  }
@@ -18,19 +18,15 @@ import { h, Host, } from '@stencil/core';
18
18
  */
19
19
  export class Hero {
20
20
  constructor() {
21
- this.handleGridChange = (e) => {
22
- this.gridSizes = e.detail;
23
- };
24
21
  this.HeroContent = () => {
25
22
  return [
26
23
  !this.hasIconBox && this.hasCtas ? (h("div", { class: "hero__ctas" }, h("slot", { name: "secondary-ctas" }))) : (''),
27
24
  h("div", { class: "hero__scrim" }, h("slot", { name: "scrim" })),
28
- h("nano-grid", { onNanoBpChange: this.handleGridChange, class: "hero__content", xlCols: 2, xlSize: this.largeScreenBP }, h("nano-grid-item", { gridStates: "xl-col-span-2" }, h("div", { class: "hero__breadcrumbs" }, h("slot", { name: "breadcrumb" }))), h("nano-grid-item", { gridStates: this.hasSecondaryContent
25
+ h("nano-grid", { class: "hero__content", xlCols: 2, xlSize: this.largeScreenBP }, h("div", { "grid-states": "xl-col-span-2" }, h("div", { class: "hero__breadcrumbs" }, h("slot", { name: "breadcrumb" }))), h("div", { "grid-states": this.hasSecondaryContent
29
26
  ? 'xl-col-span-1 xl-col-start-1 xl-row-start-2'
30
- : 'xl-col-span-2 xl-col-start-1 xl-row-start-2' }, h("div", { class: "hero__primary" }, h("div", { class: "hero__primary-content" }, h("slot", { name: "back-btn" }), h("div", null, h("slot", { name: "primary-content" }))))), this.hasSecondaryContent && (h("nano-grid-item", { gridStates: "xl-col-span-1 xl-col-start-2 xl-row-start-2" }, h("div", { class: "hero__secondary" }, h("slot", { name: "secondary-content" }), this.hasIconBox && (h("div", { class: "hero__icon-box" }, h("slot", { name: "icon-box" }), h("slot", { name: "icon-box-item" }))), this.hasQuote && (h("div", { class: "hero__quote-content" }, h("span", { class: "hero__quote" }, h("slot", { name: "quote" })), h("div", { class: "hero__quote-author" }, h("slot", { name: "quote-author" })))))))),
27
+ : 'xl-col-span-2 xl-col-start-1 xl-row-start-2' }, h("div", { class: "hero__primary" }, h("div", { class: "hero__primary-content" }, h("slot", { name: "back-btn" }), h("div", null, h("slot", { name: "primary-content" }))))), this.hasSecondaryContent && (h("div", { "grid-states": "xl-col-span-1 xl-col-start-2 xl-row-start-2" }, h("div", { class: "hero__secondary" }, h("slot", { name: "secondary-content" }), this.hasIconBox && (h("div", { class: "hero__icon-box" }, h("slot", { name: "icon-box" }), h("slot", { name: "icon-box-item" }))), this.hasQuote && (h("div", { class: "hero__quote-content" }, h("span", { class: "hero__quote" }, h("slot", { name: "quote" })), h("div", { class: "hero__quote-author" }, h("slot", { name: "quote-author" })))))))),
31
28
  ];
32
29
  };
33
- this.gridSizes = [];
34
30
  this.hasIconBox = undefined;
35
31
  this.hasScrim = undefined;
36
32
  this.hasSecondaryContent = undefined;
@@ -102,9 +98,7 @@ export class Hero {
102
98
  render() {
103
99
  const rtl = this.host.dir === 'rtl' ||
104
100
  this.host.ownerDocument.dir === 'rtl';
105
- return (h(Host, { class: {
106
- [this.gridSizes.join(' ')]: true,
107
- } }, h("div", { class: {
101
+ return (h(Host, null, h("div", { class: {
108
102
  hero: true,
109
103
  'hero--light': this.theme === 'light',
110
104
  'hero--secondary': this.hasSecondaryContent,
@@ -146,7 +140,7 @@ export class Hero {
146
140
  "optional": true,
147
141
  "docs": {
148
142
  "tags": [],
149
- "text": "src for backgronund image. For more control use the `background` slot instead."
143
+ "text": "src for background image. For more control use the `background` slot instead."
150
144
  },
151
145
  "getter": false,
152
146
  "setter": false,
@@ -237,7 +231,6 @@ export class Hero {
237
231
  }
238
232
  static get states() {
239
233
  return {
240
- "gridSizes": {},
241
234
  "hasIconBox": {},
242
235
  "hasScrim": {},
243
236
  "hasSecondaryContent": {},
@@ -1 +1 @@
1
- {"version":3,"file":"hero.js","sourceRoot":"","sources":["../../../src/components/hero/hero.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,IAAI,EACJ,CAAC,EAGD,KAAK,EACL,OAAO,EACP,KAAK,EACL,IAAI,GACL,MAAM,eAAe,CAAC;AACvB;;;;;;;;;;;;;GAaG;AAMH,MAAM,OAAO,IAAI;;IA4FP,qBAAgB,GAAG,CAAC,CAAqC,EAAE,EAAE;MACnE,IAAI,CAAC,SAAS,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5B,CAAC,CAAC;IAgBM,gBAAW,GAAG,GAAY,EAAE;MAClC,OAAO;QACL,CAAC,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CACjC,WAAK,KAAK,EAAC,YAAY;UACrB,YAAM,IAAI,EAAC,gBAAgB,GAAG,CAC1B,CACP,CAAC,CAAC,CAAC,CACF,EAAE,CACH;QACD,WAAK,KAAK,EAAC,aAAa;UACtB,YAAM,IAAI,EAAC,OAAO,GAAG,CACjB;QACN,iBACE,cAAc,EAAE,IAAI,CAAC,gBAAgB,EACrC,KAAK,EAAC,eAAe,EACrB,MAAM,EAAE,CAAC,EACT,MAAM,EAAE,IAAI,CAAC,aAAa;UAE1B,sBAAgB,UAAU,EAAC,eAAe;YACxC,WAAK,KAAK,EAAC,mBAAmB;cAC5B,YAAM,IAAI,EAAC,YAAY,GAAG,CACtB,CACS;UACjB,sBACE,UAAU,EACR,IAAI,CAAC,mBAAmB;cACtB,CAAC,CAAC,6CAA6C;cAC/C,CAAC,CAAC,6CAA6C;YAGnD,WAAK,KAAK,EAAC,eAAe;cACxB,WAAK,KAAK,EAAC,uBAAuB;gBAChC,YA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IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI;OACjC;MAED,WACE,KAAK,EAAE;UACL,IAAI,EAAE,IAAI;UACV,aAAa,EAAE,IAAI,CAAC,KAAK,KAAK,OAAO;UACrC,iBAAiB,EAAE,IAAI,CAAC,mBAAmB;UAC3C,eAAe,EAAE,IAAI,CAAC,UAAU;UAChC,WAAW,EAAE,GAAG;UAChB,aAAa,EAAE,IAAI,CAAC,QAAQ;UAC5B,kBAAkB,EAAE,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM;UAC7C,aAAa,EAAE,IAAI,CAAC,KAAK;UACzB,eAAe,EAAE,IAAI,CAAC,UAAU;UAChC,WAAW,EAAE,IAAI,CAAC,KAAK,KAAK,KAAK;SAClC;QAED,WAAK,KAAK,EAAC,eAAe;UACvB,CAAC,CAAC,IAAI,CAAC,MAAM,IAAI,CAChB,gBACE,KAAK,EAAC,WAAW,EACjB,IAAI,EAAE,KAAK,EACX,UAAU,QACV,MAAM,EAAE,IAAI,CAAC,SAAS,EACtB,GAAG,EAAE,IAAI,CAAC,MAAM;YAEhB,EAAC,IAAI,CAAC,WAAW,OAAG,CACX,CACZ;UACA,CAAC,IAAI,CAAC,MAAM,IAAI;YACf,WAAK,KAAK,EAAC,eAAe;cACxB,YAAM,IAAI,EAAC,YAAY,GAAG,CACtB;YACN,EAAC,IAAI,CAAC,WAAW,OAAG;WACrB,CACG,CACF,CACD,CACR,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["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() gridSizes: string[] = [];\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 backgronund 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 private handleGridChange = (e: CustomEvent & { detail: string[] }) => {\n this.gridSizes = e.detail;\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\n onNanoBpChange={this.handleGridChange}\n class=\"hero__content\"\n xlCols={2}\n xlSize={this.largeScreenBP}\n >\n <nano-grid-item gridStates=\"xl-col-span-2\">\n <div class=\"hero__breadcrumbs\">\n <slot name=\"breadcrumb\" />\n </div>\n </nano-grid-item>\n <nano-grid-item\n gridStates={\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 </nano-grid-item>\n {this.hasSecondaryContent && (\n <nano-grid-item gridStates=\"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 </nano-grid-item>\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 class={{\n [this.gridSizes.join(' ')]: true,\n }}\n >\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"]}
1
+ {"version":3,"file":"hero.js","sourceRoot":"","sources":["../../../src/components/hero/hero.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,IAAI,EACJ,CAAC,EAGD,KAAK,EACL,OAAO,EACP,KAAK,EACL,IAAI,GACL,MAAM,eAAe,CAAC;AACvB;;;;;;;;;;;;;GAaG;AAMH,MAAM,OAAO,IAAI;;IAyGP,gBAAW,GAAG,GAAY,EAAE;MAClC,OAAO;QACL,CAAC,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CACjC,WAAK,KAAK,EAAC,YAAY;UACrB,YAAM,IAAI,EAAC,gBAAgB,GAAG,CAC1B,CACP,CAAC,CAAC,CAAC,CACF,EAAE,CACH;QACD,WAAK,KAAK,EAAC,aAAa;UACtB,YAAM,IAAI,EAAC,OAAO,GAAG,CACjB;QACN,iBAAW,KAAK,EAAC,eAAe,EAAC,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,aAAa;UACpE,0BAAiB,eAAe;YAC9B,WAAK,KAAK,EAAC,mBAAmB;cAC5B,YAAM,IAAI,EAAC,YAAY,GAAG,CACtB,CACF;UACN,0BAEI,IAAI,CAAC,mBAAmB;cACtB,CAAC,CAAC,6CAA6C;cAC/C,CAAC,CAAC,6CAA6C;YAGnD,WAAK,KAAK,EAAC,eAAe;cACxB,WAAK,KAAK,EAAC,uBAAuB;gBAChC,YAAM,IAAI,EAAC,UAAU,GAAG;gBACxB;kBACE,YAAM,IAAI,EAAC,iBAAiB,GAAG,CAC3B,CACF,CACF,CACF;UACL,IA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AAE,GAAG;UAChB,aAAa,EAAE,IAAI,CAAC,QAAQ;UAC5B,kBAAkB,EAAE,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM;UAC7C,aAAa,EAAE,IAAI,CAAC,KAAK;UACzB,eAAe,EAAE,IAAI,CAAC,UAAU;UAChC,WAAW,EAAE,IAAI,CAAC,KAAK,KAAK,KAAK;SAClC;QAED,WAAK,KAAK,EAAC,eAAe;UACvB,CAAC,CAAC,IAAI,CAAC,MAAM,IAAI,CAChB,gBACE,KAAK,EAAC,WAAW,EACjB,IAAI,EAAE,KAAK,EACX,UAAU,QACV,MAAM,EAAE,IAAI,CAAC,SAAS,EACtB,GAAG,EAAE,IAAI,CAAC,MAAM;YAEhB,EAAC,IAAI,CAAC,WAAW,OAAG,CACX,CACZ;UACA,CAAC,IAAI,CAAC,MAAM,IAAI;YACf,WAAK,KAAK,EAAC,eAAe;cACxB,YAAM,IAAI,EAAC,YAAY,GAAG,CACtB;YACN,EAAC,IAAI,CAAC,WAAW,OAAG;WACrB,CACG,CACF,CACD,CACR,CAAC;EACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["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"]}
@@ -12,21 +12,22 @@
12
12
  }
13
13
  :host {
14
14
  /**
15
- * @prop --border-radius: defaults to var(--nano-border-radius-medium, 4px);
16
- * @prop --border-radius: defaults to var(--nano-border-radius-medium, 4px);
17
15
  * @prop --color: defaults to #b5aea7;
18
16
  * @prop --active-color: defaults to #005c75;
19
17
  * @prop --hover-color: defaults to #007495;
20
18
  * @prop --background: defaults to transparent;
21
19
  * @prop --padding: defaults to var(--nano-spacing-small, 8px);
20
+ * @prop --box-shadow: defaults to none;
22
21
  */
23
- display: inline-block;
24
22
  --border-radius: var(--nano-border-radius-medium, 4px);
25
23
  --active-color: #005c75;
26
24
  --hover-color: #007495;
27
25
  --nano-color-base: var(--color, #687576);
28
26
  --background: transparent;
29
27
  --padding: var(--nano-spacing-small, 8px);
28
+ --box-shadow: none;
29
+ border-radius: var(--border-radius);
30
+ display: inline-block;
30
31
  }
31
32
 
32
33
  .icon-button {
@@ -34,7 +35,7 @@
34
35
  display: flex;
35
36
  align-items: center;
36
37
  border: none;
37
- border-radius: var(--border-radius);
38
+ border-radius: inherit;
38
39
  background: var(--background);
39
40
  font-size: inherit;
40
41
  color: var(--color);
@@ -43,6 +44,7 @@
43
44
  -webkit-appearance: none;
44
45
  appearance: none;
45
46
  transition: box-shadow var(--nano-transition-fast, 0.1s) ease-in-out;
47
+ box-shadow: var(--box-shadow);
46
48
  }
47
49
  .icon-button:hover:not(.icon-button--disabled), .icon-button:focus:not(.icon-button--disabled) {
48
50
  color: var(--hover-color);
@@ -56,6 +58,18 @@
56
58
  outline: none;
57
59
  }
58
60
 
61
+ .icon-button__label {
62
+ clip: rect(1px, 1px, 1px, 1px);
63
+ -webkit-clip-path: inset(50%);
64
+ clip-path: inset(50%);
65
+ block-size: 1px;
66
+ inline-size: 1px;
67
+ margin: -1px;
68
+ overflow: hidden;
69
+ padding: 0;
70
+ position: absolute;
71
+ }
72
+
59
73
  .icon-button--disabled {
60
74
  opacity: 0.5;
61
75
  cursor: not-allowed;
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * Web Components for Nanopore digital Web Apps
3
3
  */
4
- import { h } from '@stencil/core';
4
+ import { h, Host, } from '@stencil/core';
5
5
  import { focusVisible } from '../../utils/focus-visible';
6
6
  /** Icons buttons are simple, icon-only buttons that can be used for actions and in toolbars.
7
7
  *
@@ -10,6 +10,20 @@ import { focusVisible } from '../../utils/focus-visible';
10
10
  */
11
11
  export class IconButton {
12
12
  constructor() {
13
+ this.handleClick = (ev) => {
14
+ if (this.type === 'button')
15
+ return;
16
+ const formEl = this.findForm();
17
+ if (formEl) {
18
+ ev.preventDefault();
19
+ const fakeButton = document.createElement('button');
20
+ fakeButton.type = this.type;
21
+ fakeButton.style.display = 'none';
22
+ formEl.appendChild(fakeButton);
23
+ fakeButton.click();
24
+ fakeButton.remove();
25
+ }
26
+ };
13
27
  this.iconName = undefined;
14
28
  this.iconSrc = undefined;
15
29
  this.type = 'button';
@@ -19,12 +33,34 @@ export class IconButton {
19
33
  this.showTooltip = false;
20
34
  this.disabled = false;
21
35
  this.href = undefined;
36
+ this.rel = undefined;
22
37
  this.target = undefined;
38
+ this.form = undefined;
23
39
  }
24
40
  /** Sets focus on the internal button */
25
41
  async setFocus() {
26
42
  this.button.focus();
27
43
  }
44
+ /**
45
+ * Finds the form element based on the provided `form` selector
46
+ * or element reference provided.
47
+ * @returns the found form element (if found)
48
+ */
49
+ findForm() {
50
+ const { form, host } = this;
51
+ if (!form)
52
+ return host.closest('form');
53
+ if (form instanceof HTMLFormElement) {
54
+ return form;
55
+ }
56
+ if (typeof form === 'string') {
57
+ const el = document.getElementById(form);
58
+ if (el instanceof HTMLFormElement) {
59
+ return el;
60
+ }
61
+ }
62
+ return null;
63
+ }
28
64
  componentDidLoad() {
29
65
  focusVisible.observe(this.button);
30
66
  }
@@ -37,10 +73,10 @@ export class IconButton {
37
73
  }
38
74
  content() {
39
75
  const TagType = this.href === undefined ? 'button' : 'a';
40
- return (h(TagType, { part: "base", ref: (el) => (this.button = el), class: {
76
+ return (h(Host, { "aria-disabled": this.disabled ? 'true' : null }, h(TagType, { onClick: this.handleClick, part: "base", ref: (el) => (this.button = el), class: {
41
77
  'icon-button': true,
42
78
  'icon-button--disabled': this.disabled,
43
- }, "aria-label": this.label, name: this.name, value: this.value, href: this.href || undefined, target: this.href && this.target ? this.target : undefined, type: !this.href && this.type ? this.type : undefined }, h("nano-icon", { name: this.iconName, src: this.iconSrc, "aria-hidden": "true", lazy: false, part: "icon" })));
79
+ }, 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 }, h("span", { class: "icon-button__label" }, this.label), h("nano-icon", { name: this.iconName, src: this.iconSrc, "aria-hidden": "true", lazy: false, part: "icon" }))));
44
80
  }
45
81
  render() {
46
82
  if (this.showTooltip) {
@@ -49,7 +85,7 @@ export class IconButton {
49
85
  return this.content();
50
86
  }
51
87
  static get is() { return "nano-icon-button"; }
52
- static get encapsulation() { return "scoped"; }
88
+ static get encapsulation() { return "shadow"; }
53
89
  static get originalStyleUrls() {
54
90
  return {
55
91
  "$": ["icon-button.scss"]
@@ -236,6 +272,25 @@ export class IconButton {
236
272
  "attribute": "href",
237
273
  "reflect": false
238
274
  },
275
+ "rel": {
276
+ "type": "string",
277
+ "mutable": false,
278
+ "complexType": {
279
+ "original": "string | undefined",
280
+ "resolved": "string",
281
+ "references": {}
282
+ },
283
+ "required": false,
284
+ "optional": false,
285
+ "docs": {
286
+ "tags": [],
287
+ "text": "Specifies the relationship of the target object to the link object.\nThe value is a space-separated list of [link types](https://developer.mozilla.org/en-US/docs/Web/HTML/Link_types)"
288
+ },
289
+ "getter": false,
290
+ "setter": false,
291
+ "attribute": "rel",
292
+ "reflect": false
293
+ },
239
294
  "target": {
240
295
  "type": "string",
241
296
  "mutable": false,
@@ -254,6 +309,29 @@ export class IconButton {
254
309
  "setter": false,
255
310
  "attribute": "target",
256
311
  "reflect": false
312
+ },
313
+ "form": {
314
+ "type": "string",
315
+ "mutable": false,
316
+ "complexType": {
317
+ "original": "HTMLFormElement | string",
318
+ "resolved": "HTMLFormElement | string",
319
+ "references": {
320
+ "HTMLFormElement": {
321
+ "location": "global"
322
+ }
323
+ }
324
+ },
325
+ "required": false,
326
+ "optional": false,
327
+ "docs": {
328
+ "tags": [],
329
+ "text": "The HTML form element or form element id.\nUsed to submit a form when the button is not a child of the form."
330
+ },
331
+ "getter": false,
332
+ "setter": false,
333
+ "attribute": "form",
334
+ "reflect": false
257
335
  }
258
336
  };
259
337
  }
@@ -277,5 +355,6 @@ export class IconButton {
277
355
  }
278
356
  };
279
357
  }
358
+ static get elementRef() { return "host"; }
280
359
  }
281
360
  //# sourceMappingURL=icon-button.js.map