@limetech/lime-elements 40.6.0 → 40.6.2

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 (457) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/cjs/{adapt-color-contrast-Beo1IEl_.js → adapt-color-contrast-h6iwOfZd.js} +1 -1
  3. package/dist/cjs/{checkbox.template-BPk8WkQF.js → checkbox.template-CoNVC4Nf.js} +2 -2
  4. package/dist/cjs/{component-CFk7Dfoi.js → component-Cz24PdGy.js} +3 -3
  5. package/dist/cjs/{component-BrNWuGdj.js → component-DNiVfYHV.js} +1 -1
  6. package/dist/cjs/{component-y8swlNNR.js → component-GW2n79GH.js} +1 -1
  7. package/dist/cjs/{component-UyqdiWGc.js → component-xiw46M1b.js} +1 -1
  8. package/dist/cjs/{files-DI4jItxi.js → files-DpGigQ8k.js} +1 -1
  9. package/dist/cjs/{format-bytes-CpUKKU86.js → format-bytes-WTHVI718.js} +1 -4
  10. package/dist/cjs/{hotkeys-BtR8uxvl.js → hotkeys-D761KWnZ.js} +1 -0
  11. package/dist/cjs/{image-resize-CG2fitJT.js → image-resize-JlRLB97I.js} +1 -0
  12. package/dist/cjs/{image.template-DY7qwbuy.js → image.template-DlF-f23b.js} +1 -1
  13. package/dist/cjs/{index--B6-r0uo.js → index-BlsqxTB1.js} +1 -7
  14. package/dist/cjs/index.cjs.js +1 -1
  15. package/dist/cjs/{keycodes-k-EdzcMX.js → keycodes-BQ_AERli.js} +4 -0
  16. package/dist/cjs/{language-CaqPKPyW.js → language-v-MMS6ym.js} +1 -1
  17. package/dist/cjs/lime-elements.cjs.js +2 -2
  18. package/dist/cjs/limel-3d-hover-effect-glow.cjs.entry.js +2 -2
  19. package/dist/cjs/limel-action-bar_3.cjs.entry.js +20 -18
  20. package/dist/cjs/limel-ai-avatar.cjs.entry.js +5 -5
  21. package/dist/cjs/limel-badge.cjs.entry.js +3 -3
  22. package/dist/cjs/limel-banner.cjs.entry.js +2 -2
  23. package/dist/cjs/limel-breadcrumbs_6.cjs.entry.js +86 -86
  24. package/dist/cjs/limel-button-group.cjs.entry.js +3 -3
  25. package/dist/cjs/limel-button.cjs.entry.js +4 -4
  26. package/dist/cjs/limel-callout.cjs.entry.js +6 -6
  27. package/dist/cjs/limel-card.cjs.entry.js +8 -7
  28. package/dist/cjs/limel-chart.cjs.entry.js +5 -5
  29. package/dist/cjs/limel-checkbox.cjs.entry.js +12 -10
  30. package/dist/cjs/limel-chip-set.cjs.entry.js +35 -44
  31. package/dist/cjs/limel-chip_2.cjs.entry.js +10 -10
  32. package/dist/cjs/limel-circular-progress.cjs.entry.js +2 -2
  33. package/dist/cjs/limel-code-diff.cjs.entry.js +25 -28
  34. package/dist/cjs/limel-code-editor.cjs.entry.js +17 -12
  35. package/dist/cjs/limel-collapsible-section.cjs.entry.js +8 -8
  36. package/dist/cjs/limel-color-picker-palette.cjs.entry.js +3 -3
  37. package/dist/cjs/limel-color-picker.cjs.entry.js +6 -5
  38. package/dist/cjs/limel-config.cjs.entry.js +3 -3
  39. package/dist/cjs/limel-date-picker.cjs.entry.js +12 -15
  40. package/dist/cjs/limel-dialog.cjs.entry.js +8 -11
  41. package/dist/cjs/limel-dock-button.cjs.entry.js +6 -11
  42. package/dist/cjs/limel-dock.cjs.entry.js +3 -3
  43. package/dist/cjs/limel-drag-handle.cjs.entry.js +6 -6
  44. package/dist/cjs/limel-dynamic-label.cjs.entry.js +1 -1
  45. package/dist/cjs/limel-email-viewer.cjs.entry.js +11 -17
  46. package/dist/cjs/limel-file-dropzone_2.cjs.entry.js +11 -12
  47. package/dist/cjs/limel-file-viewer.cjs.entry.js +1098 -1146
  48. package/dist/cjs/limel-file.cjs.entry.js +17 -16
  49. package/dist/cjs/limel-flatpickr-adapter.cjs.entry.js +100 -94
  50. package/dist/cjs/limel-flex-container.cjs.entry.js +2 -2
  51. package/dist/cjs/limel-form.cjs.entry.js +65 -50
  52. package/dist/cjs/limel-grid.cjs.entry.js +2 -2
  53. package/dist/cjs/limel-header.cjs.entry.js +2 -2
  54. package/dist/cjs/limel-help-content.cjs.entry.js +2 -2
  55. package/dist/cjs/limel-help.cjs.entry.js +3 -3
  56. package/dist/cjs/limel-helper-line_3.cjs.entry.js +14 -16
  57. package/dist/cjs/limel-hotkey_4.cjs.entry.js +23 -23
  58. package/dist/cjs/limel-icon-button.cjs.entry.js +4 -4
  59. package/dist/cjs/limel-icon.cjs.entry.js +15 -13
  60. package/dist/cjs/limel-info-tile.cjs.entry.js +10 -10
  61. package/dist/cjs/limel-list-item.cjs.entry.js +10 -10
  62. package/dist/cjs/limel-markdown.cjs.entry.js +25 -22
  63. package/dist/cjs/limel-masonry-layout.cjs.entry.js +6 -5
  64. package/dist/cjs/limel-menu-item-meta.cjs.entry.js +3 -3
  65. package/dist/cjs/limel-pagination-jump.cjs.entry.js +18 -16
  66. package/dist/cjs/limel-pagination.cjs.entry.js +10 -9
  67. package/dist/cjs/limel-picker.cjs.entry.js +32 -30
  68. package/dist/cjs/limel-popover_2.cjs.entry.js +26 -22
  69. package/dist/cjs/limel-profile-picture.cjs.entry.js +12 -11
  70. package/dist/cjs/limel-progress-flow-item.cjs.entry.js +1 -1
  71. package/dist/cjs/limel-progress-flow.cjs.entry.js +11 -10
  72. package/dist/cjs/limel-prosemirror-adapter.cjs.entry.js +475 -407
  73. package/dist/cjs/limel-radio-button-group.cjs.entry.js +2 -2
  74. package/dist/cjs/limel-radio-button.cjs.entry.js +3 -3
  75. package/dist/cjs/limel-scroller.cjs.entry.js +180 -0
  76. package/dist/cjs/limel-select.cjs.entry.js +20 -20
  77. package/dist/cjs/limel-shortcut.cjs.entry.js +1 -1
  78. package/dist/cjs/limel-slider.cjs.entry.js +18 -27
  79. package/dist/cjs/limel-snackbar.cjs.entry.js +5 -5
  80. package/dist/cjs/limel-split-button.cjs.entry.js +1 -1
  81. package/dist/cjs/limel-switch.cjs.entry.js +3 -3
  82. package/dist/cjs/limel-tab-bar.cjs.entry.js +235 -2036
  83. package/dist/cjs/limel-tab-panel.cjs.entry.js +12 -9
  84. package/dist/cjs/limel-table.cjs.entry.js +527 -106
  85. package/dist/cjs/limel-text-editor-link-menu.cjs.entry.js +16 -15
  86. package/dist/cjs/limel-text-editor.cjs.entry.js +3 -3
  87. package/dist/cjs/loader.cjs.js +2 -2
  88. package/dist/cjs/{make-enter-clickable-NuTMC9MU.js → make-enter-clickable-BZHEWIJD.js} +19 -12
  89. package/dist/cjs/{markdown-exporter-9p7d3Q76.js → markdown-exporter-C-UW43FF.js} +1 -1
  90. package/dist/cjs/{markdown-parser-Cgv5Y9Z4.js → markdown-parser-ssDij8_l.js} +24 -22
  91. package/dist/cjs/{moment-CqRdiK10.js → moment-Cfsz2WF1.js} +1062 -833
  92. package/dist/cjs/{ponyfill-BgIFyUG5.js → ponyfill-CHp7Zocr.js} +0 -1
  93. package/dist/cjs/{random-string-BTzDB2ee.js → random-string-CFCtFh5l.js} +1 -0
  94. package/dist/cjs/{render-list-component-5ZKWpCnM.js → render-list-component-BtAliHQp.js} +3 -5
  95. package/dist/cjs/{sv-BSR4W58y.js → sv-Co78RX70.js} +31 -3
  96. package/dist/cjs/{translations-DFFpR6AZ.js → translations-CNTWud2a.js} +5 -8
  97. package/dist/collection/collection-manifest.json +1 -0
  98. package/dist/collection/components/3d-hover-effect-glow/3d-hover-effect-glow.js +1 -1
  99. package/dist/collection/components/action-bar/action-bar-item/action-bar-item.js +8 -7
  100. package/dist/collection/components/action-bar/action-bar-item/action-bar-overflow-menu.js +1 -1
  101. package/dist/collection/components/action-bar/action-bar.js +6 -5
  102. package/dist/collection/components/ai-avatar/ai-avatar.js +1 -1
  103. package/dist/collection/components/badge/badge.js +2 -2
  104. package/dist/collection/components/banner/banner.js +1 -1
  105. package/dist/collection/components/breadcrumbs/breadcrumbs.js +2 -2
  106. package/dist/collection/components/button/button.js +2 -2
  107. package/dist/collection/components/button-group/button-group.js +1 -1
  108. package/dist/collection/components/callout/callout.js +1 -1
  109. package/dist/collection/components/card/card.js +6 -5
  110. package/dist/collection/components/checkbox/checkbox.js +9 -7
  111. package/dist/collection/components/checkbox/checkbox.template.js +1 -1
  112. package/dist/collection/components/chip/chip.js +1 -1
  113. package/dist/collection/components/chip-set/chip-set-input-helpers.js +18 -21
  114. package/dist/collection/components/chip-set/chip-set.js +7 -13
  115. package/dist/collection/components/circular-progress/circular-progress.js +1 -1
  116. package/dist/collection/components/code-diff/code-diff.js +19 -22
  117. package/dist/collection/components/code-diff/diff-engine.js +2 -2
  118. package/dist/collection/components/code-editor/code-editor.js +8 -3
  119. package/dist/collection/components/collapsible-section/collapsible-section.js +1 -1
  120. package/dist/collection/components/color-picker/color-picker-palette.js +2 -2
  121. package/dist/collection/components/color-picker/color-picker.js +5 -4
  122. package/dist/collection/components/config/config.js +2 -2
  123. package/dist/collection/components/date-picker/date-picker.js +3 -6
  124. package/dist/collection/components/date-picker/flatpickr-adapter/deferred-destroy.js +4 -3
  125. package/dist/collection/components/date-picker/flatpickr-adapter/flatpickr-adapter.js +1 -1
  126. package/dist/collection/components/date-picker/pickers/month-picker.js +40 -36
  127. package/dist/collection/components/date-picker/pickers/quarter-picker.js +35 -30
  128. package/dist/collection/components/date-picker/pickers/year-picker.js +16 -20
  129. package/dist/collection/components/dialog/dialog.js +4 -7
  130. package/dist/collection/components/dock/dock-button/dock-button.js +4 -9
  131. package/dist/collection/components/dock/dock.js +2 -2
  132. package/dist/collection/components/drag-handle/drag-handle.js +1 -1
  133. package/dist/collection/components/email-viewer/email-loader.js +14 -10
  134. package/dist/collection/components/email-viewer/email-viewer.js +1 -1
  135. package/dist/collection/components/email-viewer/sanitize-email-html.js +1 -4
  136. package/dist/collection/components/email-viewer/split-email-address-list.js +4 -10
  137. package/dist/collection/components/file/file.js +11 -10
  138. package/dist/collection/components/file-dropzone/file-dropzone.js +1 -1
  139. package/dist/collection/components/file-input/file-input.js +7 -8
  140. package/dist/collection/components/file-viewer/file-viewer.js +12 -9
  141. package/dist/collection/components/flex-container/flex-container.js +1 -1
  142. package/dist/collection/components/form/fields/schema-field.js +1 -1
  143. package/dist/collection/components/form/form.js +2 -5
  144. package/dist/collection/components/form/form.test-schemas.js +8 -10
  145. package/dist/collection/components/form/templates/array-field.js +7 -9
  146. package/dist/collection/components/form/templates/common.js +19 -19
  147. package/dist/collection/components/form/templates/object-field.js +1 -1
  148. package/dist/collection/components/form/validation-display.js +2 -2
  149. package/dist/collection/components/form/validators/format.js +1 -0
  150. package/dist/collection/components/form/widgets/code-editor.js +6 -9
  151. package/dist/collection/components/form/widgets/date-picker.js +1 -3
  152. package/dist/collection/components/grid/grid.js +1 -1
  153. package/dist/collection/components/header/header.js +1 -1
  154. package/dist/collection/components/help/help-content.js +1 -1
  155. package/dist/collection/components/help/help.js +2 -2
  156. package/dist/collection/components/helper-line/helper-line.js +3 -3
  157. package/dist/collection/components/hotkey/hotkey.js +1 -1
  158. package/dist/collection/components/icon/icon.js +11 -9
  159. package/dist/collection/components/icon-button/icon-button.js +1 -1
  160. package/dist/collection/components/info-tile/info-tile.js +9 -9
  161. package/dist/collection/components/input-field/input-field.js +11 -11
  162. package/dist/collection/components/list/list-renderer.js +5 -7
  163. package/dist/collection/components/list/list.js +2 -2
  164. package/dist/collection/components/list-item/list-item.js +2 -2
  165. package/dist/collection/components/list-item/menu-item-meta/menu-item-meta.js +1 -1
  166. package/dist/collection/components/markdown/hydrate-custom-elements.js +6 -5
  167. package/dist/collection/components/markdown/image-intersection-observer.js +9 -8
  168. package/dist/collection/components/markdown/image-markdown-plugin.js +9 -7
  169. package/dist/collection/components/markdown/link-markdown-plugin.js +11 -10
  170. package/dist/collection/components/markdown/markdown.js +6 -5
  171. package/dist/collection/components/markdown/remove-empty-paragraphs-plugin.js +4 -5
  172. package/dist/collection/components/masonry-layout/masonry-layout.js +5 -4
  173. package/dist/collection/components/menu/menu.js +48 -46
  174. package/dist/collection/components/menu-list/menu-list-renderer.js +8 -8
  175. package/dist/collection/components/menu-list/menu-list.js +1 -1
  176. package/dist/collection/components/menu-surface/menu-surface.js +6 -8
  177. package/dist/collection/components/notched-outline/notched-outline.js +1 -1
  178. package/dist/collection/components/pagination/jump/pagination-jump.js +13 -11
  179. package/dist/collection/components/pagination/pagination.js +5 -4
  180. package/dist/collection/components/picker/picker.js +25 -23
  181. package/dist/collection/components/popover/popover.js +13 -10
  182. package/dist/collection/components/popover-surface/popover-surface.js +1 -1
  183. package/dist/collection/components/portal/contains.js +9 -8
  184. package/dist/collection/components/portal/portal.js +16 -16
  185. package/dist/collection/components/profile-picture/profile-picture.js +4 -3
  186. package/dist/collection/components/progress-flow/progress-flow.js +10 -9
  187. package/dist/collection/components/radio-button-group/radio-button-group.js +1 -1
  188. package/dist/collection/components/radio-button-group/radio-button.js +2 -2
  189. package/dist/collection/components/scroller/scroller.css +317 -0
  190. package/dist/collection/components/scroller/scroller.js +284 -0
  191. package/dist/collection/components/select/select.js +13 -11
  192. package/dist/collection/components/select/select.template.js +1 -3
  193. package/dist/collection/components/slider/get-percentage-class.js +9 -18
  194. package/dist/collection/components/slider/slider.js +2 -2
  195. package/dist/collection/components/tab-bar/tab-bar.css +7 -289
  196. package/dist/collection/components/tab-bar/tab-bar.js +98 -128
  197. package/dist/collection/components/tab-panel/tab-panel.js +11 -8
  198. package/dist/collection/components/table/columns.js +1 -3
  199. package/dist/collection/components/table/element-pool.js +1 -1
  200. package/dist/collection/components/table/table-selection.js +6 -5
  201. package/dist/collection/components/table/table.css +15 -17
  202. package/dist/collection/components/table/table.js +44 -39
  203. package/dist/collection/components/text-editor/link-menu/editor-link-menu.js +11 -10
  204. package/dist/collection/components/text-editor/prosemirror-adapter/menu/menu-command-utils/list-utils.js +1 -1
  205. package/dist/collection/components/text-editor/prosemirror-adapter/menu/menu-commands.js +6 -10
  206. package/dist/collection/components/text-editor/prosemirror-adapter/plugins/image/inserter.js +37 -40
  207. package/dist/collection/components/text-editor/prosemirror-adapter/plugins/image/node.js +2 -1
  208. package/dist/collection/components/text-editor/prosemirror-adapter/plugins/link/link-plugin.js +21 -20
  209. package/dist/collection/components/text-editor/prosemirror-adapter/plugins/menu-state-tracking-plugin.js +6 -5
  210. package/dist/collection/components/text-editor/prosemirror-adapter/plugins/trigger/factory-helpers/detect-trigger-removal.js +15 -14
  211. package/dist/collection/components/text-editor/prosemirror-adapter/prosemirror-adapter.js +40 -34
  212. package/dist/collection/components/text-editor/text-editor.js +1 -1
  213. package/dist/collection/components/text-editor/utils/metadata-utils.js +1 -1
  214. package/dist/collection/components/text-editor/utils/plugin-factory.js +3 -3
  215. package/dist/collection/components/tooltip/tooltip-content.js +1 -1
  216. package/dist/collection/components/tooltip/tooltip.js +2 -2
  217. package/dist/collection/global/icon-cache/factory.js +2 -3
  218. package/dist/collection/global/icon-cache/in-memory-icon-cache.js +2 -0
  219. package/dist/collection/global/translations.js +1 -3
  220. package/dist/collection/translations/fr.js +3 -3
  221. package/dist/collection/util/adapt-color-contrast.js +1 -1
  222. package/dist/collection/util/files.js +1 -1
  223. package/dist/collection/util/format-bytes.js +1 -4
  224. package/dist/collection/util/hotkeys.js +1 -0
  225. package/dist/collection/util/image-resize.js +1 -0
  226. package/dist/collection/util/keyboard-navigation.js +144 -0
  227. package/dist/collection/util/keycodes.js +2 -0
  228. package/dist/collection/util/language.js +1 -1
  229. package/dist/collection/util/make-enter-clickable.js +19 -12
  230. package/dist/collection/util/random-string.js +1 -0
  231. package/dist/collection/util/render-list-component.js +2 -4
  232. package/dist/esm/{adapt-color-contrast-Dgcw_h7C.js → adapt-color-contrast-BQoih_t0.js} +1 -1
  233. package/dist/esm/{checkbox.template-Cx_3u92S.js → checkbox.template-IDyv2bgn.js} +2 -2
  234. package/dist/esm/{component-wGVqvUmL.js → component-CVihTrav.js} +3 -3
  235. package/dist/esm/{component-7QB0OUSF.js → component-CrjPGt1I.js} +1 -1
  236. package/dist/esm/{component-D4qgwaTf.js → component-CyFeUQ0l.js} +1 -1
  237. package/dist/esm/{component-B2Vy44Z3.js → component-kP1jCDLp.js} +1 -1
  238. package/dist/esm/{files-DnkFEKoB.js → files-CKnLqPDj.js} +1 -1
  239. package/dist/esm/{format-bytes-u_sd2HMb.js → format-bytes-24yUSW40.js} +1 -4
  240. package/dist/esm/{hotkeys-BxrRWYts.js → hotkeys-DjmlD0Mw.js} +1 -0
  241. package/dist/esm/{image-resize-BTSG--2-.js → image-resize-Dv2HOgWN.js} +1 -0
  242. package/dist/esm/{image.template-wqMwmOF-.js → image.template-BGjw97m_.js} +1 -1
  243. package/dist/esm/{index-Bnc9lzk2.js → index-BU9IJqli.js} +1 -7
  244. package/dist/esm/index.js +1 -1
  245. package/dist/esm/{keycodes-C4_9qUMP.js → keycodes-DQ5DmW_Y.js} +3 -1
  246. package/dist/esm/{language-C3hECvXE.js → language-ChagAaNf.js} +1 -1
  247. package/dist/esm/lime-elements.js +3 -3
  248. package/dist/esm/limel-3d-hover-effect-glow.entry.js +2 -2
  249. package/dist/esm/limel-action-bar_3.entry.js +20 -18
  250. package/dist/esm/limel-ai-avatar.entry.js +5 -5
  251. package/dist/esm/limel-badge.entry.js +3 -3
  252. package/dist/esm/limel-banner.entry.js +2 -2
  253. package/dist/esm/limel-breadcrumbs_6.entry.js +86 -86
  254. package/dist/esm/limel-button-group.entry.js +3 -3
  255. package/dist/esm/limel-button.entry.js +4 -4
  256. package/dist/esm/limel-callout.entry.js +6 -6
  257. package/dist/esm/limel-card.entry.js +8 -7
  258. package/dist/esm/limel-chart.entry.js +5 -5
  259. package/dist/esm/limel-checkbox.entry.js +12 -10
  260. package/dist/esm/limel-chip-set.entry.js +35 -44
  261. package/dist/esm/limel-chip_2.entry.js +10 -10
  262. package/dist/esm/limel-circular-progress.entry.js +2 -2
  263. package/dist/esm/limel-code-diff.entry.js +25 -28
  264. package/dist/esm/limel-code-editor.entry.js +17 -12
  265. package/dist/esm/limel-collapsible-section.entry.js +8 -8
  266. package/dist/esm/limel-color-picker-palette.entry.js +3 -3
  267. package/dist/esm/limel-color-picker.entry.js +6 -5
  268. package/dist/esm/limel-config.entry.js +3 -3
  269. package/dist/esm/limel-date-picker.entry.js +12 -15
  270. package/dist/esm/limel-dialog.entry.js +8 -11
  271. package/dist/esm/limel-dock-button.entry.js +6 -11
  272. package/dist/esm/limel-dock.entry.js +3 -3
  273. package/dist/esm/limel-drag-handle.entry.js +6 -6
  274. package/dist/esm/limel-dynamic-label.entry.js +1 -1
  275. package/dist/esm/limel-email-viewer.entry.js +11 -17
  276. package/dist/esm/limel-file-dropzone_2.entry.js +11 -12
  277. package/dist/esm/limel-file-viewer.entry.js +1098 -1146
  278. package/dist/esm/limel-file.entry.js +17 -16
  279. package/dist/esm/limel-flatpickr-adapter.entry.js +100 -94
  280. package/dist/esm/limel-flex-container.entry.js +2 -2
  281. package/dist/esm/limel-form.entry.js +65 -50
  282. package/dist/esm/limel-grid.entry.js +2 -2
  283. package/dist/esm/limel-header.entry.js +2 -2
  284. package/dist/esm/limel-help-content.entry.js +2 -2
  285. package/dist/esm/limel-help.entry.js +3 -3
  286. package/dist/esm/limel-helper-line_3.entry.js +14 -16
  287. package/dist/esm/limel-hotkey_4.entry.js +23 -23
  288. package/dist/esm/limel-icon-button.entry.js +4 -4
  289. package/dist/esm/limel-icon.entry.js +15 -13
  290. package/dist/esm/limel-info-tile.entry.js +10 -10
  291. package/dist/esm/limel-list-item.entry.js +10 -10
  292. package/dist/esm/limel-markdown.entry.js +25 -22
  293. package/dist/esm/limel-masonry-layout.entry.js +6 -5
  294. package/dist/esm/limel-menu-item-meta.entry.js +3 -3
  295. package/dist/esm/limel-pagination-jump.entry.js +18 -16
  296. package/dist/esm/limel-pagination.entry.js +10 -9
  297. package/dist/esm/limel-picker.entry.js +32 -30
  298. package/dist/esm/limel-popover_2.entry.js +26 -22
  299. package/dist/esm/limel-profile-picture.entry.js +12 -11
  300. package/dist/esm/limel-progress-flow-item.entry.js +1 -1
  301. package/dist/esm/limel-progress-flow.entry.js +11 -10
  302. package/dist/esm/limel-prosemirror-adapter.entry.js +475 -407
  303. package/dist/esm/limel-radio-button-group.entry.js +2 -2
  304. package/dist/esm/limel-radio-button.entry.js +3 -3
  305. package/dist/esm/limel-scroller.entry.js +178 -0
  306. package/dist/esm/limel-select.entry.js +20 -20
  307. package/dist/esm/limel-shortcut.entry.js +1 -1
  308. package/dist/esm/limel-slider.entry.js +18 -27
  309. package/dist/esm/limel-snackbar.entry.js +5 -5
  310. package/dist/esm/limel-split-button.entry.js +1 -1
  311. package/dist/esm/limel-switch.entry.js +3 -3
  312. package/dist/esm/limel-tab-bar.entry.js +235 -2036
  313. package/dist/esm/limel-tab-panel.entry.js +12 -9
  314. package/dist/esm/limel-table.entry.js +527 -106
  315. package/dist/esm/limel-text-editor-link-menu.entry.js +16 -15
  316. package/dist/esm/limel-text-editor.entry.js +3 -3
  317. package/dist/esm/loader.js +3 -3
  318. package/dist/esm/{make-enter-clickable-BgTwPGeH.js → make-enter-clickable-CIf8aGSd.js} +19 -12
  319. package/dist/esm/{markdown-exporter--3_MaqwD.js → markdown-exporter-DblYRMhY.js} +1 -1
  320. package/dist/esm/{markdown-parser-DCf-3dKZ.js → markdown-parser-CAPDx7i8.js} +24 -22
  321. package/dist/esm/{moment-DQRNe8qq.js → moment-_DadZLWp.js} +1062 -833
  322. package/dist/esm/{ponyfill-ChRGk668.js → ponyfill-6YuZiAPi.js} +1 -1
  323. package/dist/esm/{random-string-JbKhhoXs.js → random-string-BrjD-ITe.js} +1 -0
  324. package/dist/esm/{render-list-component-cicbMp0l.js → render-list-component-J1IzNpbv.js} +3 -5
  325. package/dist/esm/{sv-CY-6-yEp.js → sv-DpsDSi7k.js} +31 -3
  326. package/dist/esm/{translations-DMtX4tTX.js → translations-Y4i8PVc9.js} +5 -8
  327. package/dist/lime-elements/index.esm.js +1 -1
  328. package/dist/lime-elements/lime-elements.esm.js +1 -1
  329. package/dist/lime-elements/p-02a06cf7.entry.js +1 -0
  330. package/dist/lime-elements/{p-3916b316.entry.js → p-03cb609e.entry.js} +1 -1
  331. package/dist/lime-elements/p-05038bbb.entry.js +1 -0
  332. package/dist/lime-elements/{p-835149c4.entry.js → p-0d6925f4.entry.js} +1 -1
  333. package/dist/lime-elements/p-0e13ec91.entry.js +1 -0
  334. package/dist/lime-elements/p-0ece667e.entry.js +1 -0
  335. package/dist/lime-elements/{p-19344984.entry.js → p-107654bb.entry.js} +4 -4
  336. package/dist/lime-elements/p-120ca628.entry.js +1 -0
  337. package/dist/lime-elements/{p-BwJGg-WI.js → p-1CgnIGyd.js} +4 -4
  338. package/dist/lime-elements/p-22fd1c87.entry.js +1 -0
  339. package/dist/lime-elements/p-24yUSW40.js +1 -0
  340. package/dist/lime-elements/{p-f717cd7a.entry.js → p-271662d4.entry.js} +1 -1
  341. package/dist/lime-elements/{p-c2a60508.entry.js → p-29c73bdf.entry.js} +1 -1
  342. package/dist/lime-elements/{p-deceda00.entry.js → p-2a902e77.entry.js} +1 -1
  343. package/dist/lime-elements/{p-d0cec424.entry.js → p-2b033dfa.entry.js} +1 -1
  344. package/dist/lime-elements/{p-acba5700.entry.js → p-2b2253d4.entry.js} +1 -1
  345. package/dist/lime-elements/p-2e33d2a4.entry.js +1 -0
  346. package/dist/lime-elements/p-32a050a3.entry.js +1 -0
  347. package/dist/lime-elements/{p-3735111e.entry.js → p-3cfe0eaf.entry.js} +1 -1
  348. package/dist/lime-elements/{p-fbcd99a3.entry.js → p-3d3bdf45.entry.js} +1 -1
  349. package/dist/lime-elements/p-45461ec5.entry.js +1 -0
  350. package/dist/lime-elements/p-45c39fb4.entry.js +1 -0
  351. package/dist/lime-elements/p-45fde7a1.entry.js +1 -0
  352. package/dist/lime-elements/p-48afa6b7.entry.js +1 -0
  353. package/dist/lime-elements/{p-f04f7c8e.entry.js → p-4a88d365.entry.js} +1 -1
  354. package/dist/lime-elements/p-4b75e653.entry.js +1 -0
  355. package/dist/lime-elements/{p-5698e493.entry.js → p-4ecbc9f4.entry.js} +1 -1
  356. package/dist/lime-elements/{p-2e568c56.entry.js → p-54a9f48f.entry.js} +1 -1
  357. package/dist/lime-elements/{p-0fba64eb.entry.js → p-5df21b25.entry.js} +2 -2
  358. package/dist/lime-elements/p-5e448070.entry.js +1 -0
  359. package/dist/lime-elements/{p-408c4dcb.entry.js → p-5f5c6e7d.entry.js} +1 -1
  360. package/dist/lime-elements/{p-052c3bc6.entry.js → p-681cb6de.entry.js} +1 -1
  361. package/dist/lime-elements/{p-ChRGk668.js → p-6YuZiAPi.js} +3 -3
  362. package/dist/lime-elements/{p-90df3e1b.entry.js → p-6d9961f7.entry.js} +1 -1
  363. package/dist/lime-elements/p-74060535.entry.js +159 -0
  364. package/dist/lime-elements/{p-74bd0c1a.entry.js → p-7b4351f6.entry.js} +1 -1
  365. package/dist/lime-elements/{p-3fd7e8aa.entry.js → p-7eab1341.entry.js} +1 -1
  366. package/dist/lime-elements/p-7fa85785.entry.js +23 -0
  367. package/dist/lime-elements/{p-35fa1063.entry.js → p-85318636.entry.js} +1 -1
  368. package/dist/lime-elements/{p-4ffbfc79.entry.js → p-8ac79ef5.entry.js} +1 -1
  369. package/dist/lime-elements/{p-4902fb3f.entry.js → p-9218fa6a.entry.js} +1 -1
  370. package/dist/lime-elements/{p-38b09f87.entry.js → p-9415411e.entry.js} +1 -1
  371. package/dist/lime-elements/{p-be8610ff.entry.js → p-958396b5.entry.js} +1 -1
  372. package/dist/lime-elements/p-95ccd9e7.entry.js +1 -0
  373. package/dist/lime-elements/p-970e0810.entry.js +1 -0
  374. package/dist/lime-elements/{p-cb407bef.entry.js → p-9afa4721.entry.js} +1 -1
  375. package/dist/lime-elements/{p-54dcf46f.entry.js → p-9c8c2fb7.entry.js} +1 -1
  376. package/dist/lime-elements/p-9e084e7c.entry.js +1 -0
  377. package/dist/lime-elements/{p-B8hoCfhT.js → p-B3YP9GOq.js} +1 -1
  378. package/dist/lime-elements/{p-Dgcw_h7C.js → p-BQoih_t0.js} +1 -1
  379. package/dist/lime-elements/{p-Bnc9lzk2.js → p-BU9IJqli.js} +1 -1
  380. package/dist/lime-elements/{p-BN1-aIOw.js → p-BZXGwiAr.js} +1 -1
  381. package/dist/lime-elements/{p-CGVVDGcv.js → p-Bkvc4sus.js} +1 -1
  382. package/dist/lime-elements/{p-BPzhuHcl.js → p-Bvyt2bmV.js} +1 -1
  383. package/dist/lime-elements/{p-DZkKQUDM.js → p-C1FFnUvf.js} +3 -3
  384. package/dist/lime-elements/{p-BgTwPGeH.js → p-CIf8aGSd.js} +1 -1
  385. package/dist/lime-elements/{p-C3hECvXE.js → p-ChagAaNf.js} +1 -1
  386. package/dist/lime-elements/{p-C9yTLqR8.js → p-CmtleG1y.js} +1 -1
  387. package/dist/lime-elements/{p-C4_9qUMP.js → p-DQ5DmW_Y.js} +1 -1
  388. package/dist/lime-elements/p-DTcfed02.js +3 -0
  389. package/dist/lime-elements/{p-BY85K-4J.js → p-DqQOawxc.js} +1 -1
  390. package/dist/lime-elements/{p-CC4Usa-Q.js → p-I0PrvthC.js} +1 -1
  391. package/dist/lime-elements/p-N9vxZMhe.js +1 -0
  392. package/dist/lime-elements/{p-DsDkl4Sy.js → p-ZDFVISfu.js} +3 -3
  393. package/dist/lime-elements/p-a1c69e0c.entry.js +1 -0
  394. package/dist/lime-elements/{p-2daf0482.entry.js → p-a1d1470c.entry.js} +1 -1
  395. package/dist/lime-elements/{p-cef66e53.entry.js → p-a2e6f16e.entry.js} +1 -1
  396. package/dist/lime-elements/{p-36ce4fbc.entry.js → p-a42f8c2d.entry.js} +1 -1
  397. package/dist/lime-elements/p-a550ba18.entry.js +1 -0
  398. package/dist/lime-elements/{p-d146feda.entry.js → p-a65eb58e.entry.js} +1 -1
  399. package/dist/lime-elements/{p-03fb2603.entry.js → p-b22b52a1.entry.js} +1 -1
  400. package/dist/lime-elements/{p-c2a3ca7c.entry.js → p-b6d39581.entry.js} +1 -1
  401. package/dist/lime-elements/{p-8475a3b8.entry.js → p-c439b68b.entry.js} +1 -1
  402. package/dist/lime-elements/p-d19c7a3a.entry.js +1 -0
  403. package/dist/lime-elements/{p-d3bd4b80.entry.js → p-d1b7cc55.entry.js} +3 -3
  404. package/dist/lime-elements/{p-7cbf50fc.entry.js → p-d1e5dd12.entry.js} +1 -1
  405. package/dist/lime-elements/p-de4719a6.entry.js +1 -0
  406. package/dist/lime-elements/{p-b81a2728.entry.js → p-e02e2c5f.entry.js} +1 -1
  407. package/dist/lime-elements/{p-d351b9ae.entry.js → p-e6a34047.entry.js} +1 -1
  408. package/dist/lime-elements/p-eF09GxA_.js +1 -0
  409. package/dist/lime-elements/{p-8fa9c9ea.entry.js → p-ee719744.entry.js} +1 -1
  410. package/dist/lime-elements/p-f3cae1e7.entry.js +1 -0
  411. package/dist/lime-elements/{p-8115da75.entry.js → p-f4a0b1bc.entry.js} +1 -1
  412. package/dist/lime-elements/{p-4855dc9b.entry.js → p-f82f72e7.entry.js} +1 -1
  413. package/dist/lime-elements/{p-2d84ea04.entry.js → p-f97ec7a5.entry.js} +1 -1
  414. package/dist/lime-elements/{p-21109d9b.entry.js → p-fdd674fc.entry.js} +1 -1
  415. package/dist/lime-elements/{p-459eea13.entry.js → p-fdec09e9.entry.js} +1 -1
  416. package/dist/lime-elements/{p-2f57c3fa.entry.js → p-fe492ff3.entry.js} +1 -1
  417. package/dist/lime-elements/{p-65cded0e.entry.js → p-ff1a8b2e.entry.js} +1 -1
  418. package/dist/types/components/chip-set/chip-set-input-helpers.d.ts +1 -1
  419. package/dist/types/components/pagination/jump/pagination-jump.d.ts +1 -1
  420. package/dist/types/components/scroller/scroller.d.ts +67 -0
  421. package/dist/types/components/tab-bar/tab-bar.d.ts +23 -21
  422. package/dist/types/components.d.ts +132 -0
  423. package/dist/types/global/icon-cache/factory.d.ts +2 -2
  424. package/dist/types/global/translations.d.ts +2 -2
  425. package/dist/types/util/keyboard-navigation.d.ts +105 -0
  426. package/dist/types/util/keycodes.d.ts +2 -0
  427. package/package.json +12 -12
  428. package/dist/lime-elements/p-1e93473a.entry.js +0 -1
  429. package/dist/lime-elements/p-20658306.entry.js +0 -1
  430. package/dist/lime-elements/p-26c5c6b9.entry.js +0 -1
  431. package/dist/lime-elements/p-452b9b01.entry.js +0 -1
  432. package/dist/lime-elements/p-4aae63bd.entry.js +0 -1
  433. package/dist/lime-elements/p-507cc8a1.entry.js +0 -159
  434. package/dist/lime-elements/p-531b6a64.entry.js +0 -1
  435. package/dist/lime-elements/p-54793c06.entry.js +0 -1
  436. package/dist/lime-elements/p-5d974afa.entry.js +0 -1
  437. package/dist/lime-elements/p-66b125f2.entry.js +0 -1
  438. package/dist/lime-elements/p-7e212fa7.entry.js +0 -1
  439. package/dist/lime-elements/p-82696d24.entry.js +0 -1
  440. package/dist/lime-elements/p-9ac39039.entry.js +0 -1
  441. package/dist/lime-elements/p-9b631363.entry.js +0 -1
  442. package/dist/lime-elements/p-DQJU9gzh.js +0 -1
  443. package/dist/lime-elements/p-DpJgXIWf.js +0 -1
  444. package/dist/lime-elements/p-a1de9bbe.entry.js +0 -1
  445. package/dist/lime-elements/p-a71f6e87.entry.js +0 -67
  446. package/dist/lime-elements/p-bd7b3f8e.entry.js +0 -1
  447. package/dist/lime-elements/p-c72e5007.entry.js +0 -1
  448. package/dist/lime-elements/p-cafec335.entry.js +0 -1
  449. package/dist/lime-elements/p-d6dadc61.entry.js +0 -1
  450. package/dist/lime-elements/p-d93b7b9f.entry.js +0 -23
  451. package/dist/lime-elements/p-dc9cd793.entry.js +0 -1
  452. package/dist/lime-elements/p-dd62042a.entry.js +0 -1
  453. package/dist/lime-elements/p-u_sd2HMb.js +0 -1
  454. package/dist/lime-elements/p-zo6O9LC9.js +0 -3
  455. /package/dist/lime-elements/{p-JbKhhoXs.js → p-BrjD-ITe.js} +0 -0
  456. /package/dist/lime-elements/{p-BxrRWYts.js → p-DjmlD0Mw.js} +0 -0
  457. /package/dist/lime-elements/{p-BTSG--2-.js → p-Dv2HOgWN.js} +0 -0
@@ -1,12 +1,13 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index--B6-r0uo.js');
3
+ var index = require('./index-BlsqxTB1.js');
4
4
  var getIconProps = require('./get-icon-props-CwpDdQDI.js');
5
+ var keycodes = require('./keycodes-BQ_AERli.js');
5
6
  var isEqual = require('./isEqual-D3eFkhqd.js');
6
- var ponyfill = require('./ponyfill-BgIFyUG5.js');
7
- var component = require('./component-y8swlNNR.js');
7
+ var component = require('./component-GW2n79GH.js');
8
8
  var _baseIsEqual = require('./_baseIsEqual-zzV9DKMv.js');
9
9
  var isArrayLikeObject = require('./isArrayLikeObject-U2Ddbw4n.js');
10
+ require('./ponyfill-CHp7Zocr.js');
10
11
  require('./eq-DFcUoVzv.js');
11
12
  require('./_getTag-BC28Za7d.js');
12
13
  require('./isObject-B6Osvvqp.js');
@@ -99,1959 +100,173 @@ var difference = isArrayLikeObject.baseRest(function(array, values) {
99
100
  });
100
101
 
101
102
  /**
102
- * @license
103
- * Copyright 2018 Google Inc.
104
- *
105
- * Permission is hereby granted, free of charge, to any person obtaining a copy
106
- * of this software and associated documentation files (the "Software"), to deal
107
- * in the Software without restriction, including without limitation the rights
108
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
109
- * copies of the Software, and to permit persons to whom the Software is
110
- * furnished to do so, subject to the following conditions:
111
- *
112
- * The above copyright notice and this permission notice shall be included in
113
- * all copies or substantial portions of the Software.
114
- *
115
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
116
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
117
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
118
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
119
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
120
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
121
- * THE SOFTWARE.
122
- */
123
- var cssClasses$2 = {
124
- ANIMATING: 'mdc-tab-scroller--animating',
125
- SCROLL_AREA_SCROLL: 'mdc-tab-scroller__scroll-area--scroll',
126
- SCROLL_TEST: 'mdc-tab-scroller__test',
127
- };
128
- var strings$4 = {
129
- AREA_SELECTOR: '.mdc-tab-scroller__scroll-area',
130
- CONTENT_SELECTOR: '.mdc-tab-scroller__scroll-content',
131
- };
132
-
133
- /**
134
- * @license
135
- * Copyright 2018 Google Inc.
136
- *
137
- * Permission is hereby granted, free of charge, to any person obtaining a copy
138
- * of this software and associated documentation files (the "Software"), to deal
139
- * in the Software without restriction, including without limitation the rights
140
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
141
- * copies of the Software, and to permit persons to whom the Software is
142
- * furnished to do so, subject to the following conditions:
143
- *
144
- * The above copyright notice and this permission notice shall be included in
145
- * all copies or substantial portions of the Software.
146
- *
147
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
148
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
149
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
150
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
151
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
152
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
153
- * THE SOFTWARE.
154
- */
155
- var MDCTabScrollerRTL = /** @class */ (function () {
156
- function MDCTabScrollerRTL(adapter) {
157
- this.adapter = adapter;
158
- }
159
- return MDCTabScrollerRTL;
160
- }());
161
-
162
- /**
163
- * @license
164
- * Copyright 2018 Google Inc.
165
- *
166
- * Permission is hereby granted, free of charge, to any person obtaining a copy
167
- * of this software and associated documentation files (the "Software"), to deal
168
- * in the Software without restriction, including without limitation the rights
169
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
170
- * copies of the Software, and to permit persons to whom the Software is
171
- * furnished to do so, subject to the following conditions:
172
- *
173
- * The above copyright notice and this permission notice shall be included in
174
- * all copies or substantial portions of the Software.
175
- *
176
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
177
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
178
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
179
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
180
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
181
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
182
- * THE SOFTWARE.
183
- */
184
- var MDCTabScrollerRTLDefault = /** @class */ (function (_super) {
185
- ponyfill.__extends(MDCTabScrollerRTLDefault, _super);
186
- function MDCTabScrollerRTLDefault() {
187
- return _super !== null && _super.apply(this, arguments) || this;
188
- }
189
- MDCTabScrollerRTLDefault.prototype.getScrollPositionRTL = function () {
190
- var currentScrollLeft = this.adapter.getScrollAreaScrollLeft();
191
- var right = this.calculateScrollEdges().right;
192
- // Scroll values on most browsers are ints instead of floats so we round
193
- return Math.round(right - currentScrollLeft);
194
- };
195
- MDCTabScrollerRTLDefault.prototype.scrollToRTL = function (scrollX) {
196
- var edges = this.calculateScrollEdges();
197
- var currentScrollLeft = this.adapter.getScrollAreaScrollLeft();
198
- var clampedScrollLeft = this.clampScrollValue(edges.right - scrollX);
199
- return {
200
- finalScrollPosition: clampedScrollLeft,
201
- scrollDelta: clampedScrollLeft - currentScrollLeft,
202
- };
203
- };
204
- MDCTabScrollerRTLDefault.prototype.incrementScrollRTL = function (scrollX) {
205
- var currentScrollLeft = this.adapter.getScrollAreaScrollLeft();
206
- var clampedScrollLeft = this.clampScrollValue(currentScrollLeft - scrollX);
207
- return {
208
- finalScrollPosition: clampedScrollLeft,
209
- scrollDelta: clampedScrollLeft - currentScrollLeft,
210
- };
211
- };
212
- MDCTabScrollerRTLDefault.prototype.getAnimatingScrollPosition = function (scrollX) {
213
- return scrollX;
214
- };
215
- MDCTabScrollerRTLDefault.prototype.calculateScrollEdges = function () {
216
- var contentWidth = this.adapter.getScrollContentOffsetWidth();
217
- var rootWidth = this.adapter.getScrollAreaOffsetWidth();
218
- return {
219
- left: 0,
220
- right: contentWidth - rootWidth,
221
- };
222
- };
223
- MDCTabScrollerRTLDefault.prototype.clampScrollValue = function (scrollX) {
224
- var edges = this.calculateScrollEdges();
225
- return Math.min(Math.max(edges.left, scrollX), edges.right);
226
- };
227
- return MDCTabScrollerRTLDefault;
228
- }(MDCTabScrollerRTL));
229
-
230
- /**
231
- * @license
232
- * Copyright 2018 Google Inc.
233
- *
234
- * Permission is hereby granted, free of charge, to any person obtaining a copy
235
- * of this software and associated documentation files (the "Software"), to deal
236
- * in the Software without restriction, including without limitation the rights
237
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
238
- * copies of the Software, and to permit persons to whom the Software is
239
- * furnished to do so, subject to the following conditions:
240
- *
241
- * The above copyright notice and this permission notice shall be included in
242
- * all copies or substantial portions of the Software.
243
- *
244
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
245
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
246
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
247
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
248
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
249
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
250
- * THE SOFTWARE.
251
- */
252
- var MDCTabScrollerRTLNegative = /** @class */ (function (_super) {
253
- ponyfill.__extends(MDCTabScrollerRTLNegative, _super);
254
- function MDCTabScrollerRTLNegative() {
255
- return _super !== null && _super.apply(this, arguments) || this;
256
- }
257
- MDCTabScrollerRTLNegative.prototype.getScrollPositionRTL = function (translateX) {
258
- var currentScrollLeft = this.adapter.getScrollAreaScrollLeft();
259
- return Math.round(translateX - currentScrollLeft);
260
- };
261
- MDCTabScrollerRTLNegative.prototype.scrollToRTL = function (scrollX) {
262
- var currentScrollLeft = this.adapter.getScrollAreaScrollLeft();
263
- var clampedScrollLeft = this.clampScrollValue(-scrollX);
264
- return {
265
- finalScrollPosition: clampedScrollLeft,
266
- scrollDelta: clampedScrollLeft - currentScrollLeft,
267
- };
268
- };
269
- MDCTabScrollerRTLNegative.prototype.incrementScrollRTL = function (scrollX) {
270
- var currentScrollLeft = this.adapter.getScrollAreaScrollLeft();
271
- var clampedScrollLeft = this.clampScrollValue(currentScrollLeft - scrollX);
272
- return {
273
- finalScrollPosition: clampedScrollLeft,
274
- scrollDelta: clampedScrollLeft - currentScrollLeft,
275
- };
276
- };
277
- MDCTabScrollerRTLNegative.prototype.getAnimatingScrollPosition = function (scrollX, translateX) {
278
- return scrollX - translateX;
279
- };
280
- MDCTabScrollerRTLNegative.prototype.calculateScrollEdges = function () {
281
- var contentWidth = this.adapter.getScrollContentOffsetWidth();
282
- var rootWidth = this.adapter.getScrollAreaOffsetWidth();
283
- return {
284
- left: rootWidth - contentWidth,
285
- right: 0,
286
- };
287
- };
288
- MDCTabScrollerRTLNegative.prototype.clampScrollValue = function (scrollX) {
289
- var edges = this.calculateScrollEdges();
290
- return Math.max(Math.min(edges.right, scrollX), edges.left);
291
- };
292
- return MDCTabScrollerRTLNegative;
293
- }(MDCTabScrollerRTL));
294
-
295
- /**
296
- * @license
297
- * Copyright 2018 Google Inc.
298
- *
299
- * Permission is hereby granted, free of charge, to any person obtaining a copy
300
- * of this software and associated documentation files (the "Software"), to deal
301
- * in the Software without restriction, including without limitation the rights
302
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
303
- * copies of the Software, and to permit persons to whom the Software is
304
- * furnished to do so, subject to the following conditions:
305
- *
306
- * The above copyright notice and this permission notice shall be included in
307
- * all copies or substantial portions of the Software.
308
- *
309
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
310
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
311
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
312
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
313
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
314
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
315
- * THE SOFTWARE.
316
- */
317
- var MDCTabScrollerRTLReverse = /** @class */ (function (_super) {
318
- ponyfill.__extends(MDCTabScrollerRTLReverse, _super);
319
- function MDCTabScrollerRTLReverse() {
320
- return _super !== null && _super.apply(this, arguments) || this;
321
- }
322
- MDCTabScrollerRTLReverse.prototype.getScrollPositionRTL = function (translateX) {
323
- var currentScrollLeft = this.adapter.getScrollAreaScrollLeft();
324
- // Scroll values on most browsers are ints instead of floats so we round
325
- return Math.round(currentScrollLeft - translateX);
326
- };
327
- MDCTabScrollerRTLReverse.prototype.scrollToRTL = function (scrollX) {
328
- var currentScrollLeft = this.adapter.getScrollAreaScrollLeft();
329
- var clampedScrollLeft = this.clampScrollValue(scrollX);
330
- return {
331
- finalScrollPosition: clampedScrollLeft,
332
- scrollDelta: currentScrollLeft - clampedScrollLeft,
333
- };
334
- };
335
- MDCTabScrollerRTLReverse.prototype.incrementScrollRTL = function (scrollX) {
336
- var currentScrollLeft = this.adapter.getScrollAreaScrollLeft();
337
- var clampedScrollLeft = this.clampScrollValue(currentScrollLeft + scrollX);
338
- return {
339
- finalScrollPosition: clampedScrollLeft,
340
- scrollDelta: currentScrollLeft - clampedScrollLeft,
341
- };
342
- };
343
- MDCTabScrollerRTLReverse.prototype.getAnimatingScrollPosition = function (scrollX, translateX) {
344
- return scrollX + translateX;
345
- };
346
- MDCTabScrollerRTLReverse.prototype.calculateScrollEdges = function () {
347
- var contentWidth = this.adapter.getScrollContentOffsetWidth();
348
- var rootWidth = this.adapter.getScrollAreaOffsetWidth();
349
- return {
350
- left: contentWidth - rootWidth,
351
- right: 0,
352
- };
353
- };
354
- MDCTabScrollerRTLReverse.prototype.clampScrollValue = function (scrollX) {
355
- var edges = this.calculateScrollEdges();
356
- return Math.min(Math.max(edges.right, scrollX), edges.left);
357
- };
358
- return MDCTabScrollerRTLReverse;
359
- }(MDCTabScrollerRTL));
360
-
361
- /**
362
- * @license
363
- * Copyright 2018 Google Inc.
364
- *
365
- * Permission is hereby granted, free of charge, to any person obtaining a copy
366
- * of this software and associated documentation files (the "Software"), to deal
367
- * in the Software without restriction, including without limitation the rights
368
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
369
- * copies of the Software, and to permit persons to whom the Software is
370
- * furnished to do so, subject to the following conditions:
371
- *
372
- * The above copyright notice and this permission notice shall be included in
373
- * all copies or substantial portions of the Software.
374
- *
375
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
376
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
377
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
378
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
379
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
380
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
381
- * THE SOFTWARE.
382
- */
383
- var MDCTabScrollerFoundation = /** @class */ (function (_super) {
384
- ponyfill.__extends(MDCTabScrollerFoundation, _super);
385
- function MDCTabScrollerFoundation(adapter) {
386
- var _this = _super.call(this, ponyfill.__assign(ponyfill.__assign({}, MDCTabScrollerFoundation.defaultAdapter), adapter)) || this;
387
- /**
388
- * Controls whether we should handle the transitionend and interaction events during the animation.
389
- */
390
- _this.isAnimating = false;
391
- return _this;
392
- }
393
- Object.defineProperty(MDCTabScrollerFoundation, "cssClasses", {
394
- get: function () {
395
- return cssClasses$2;
396
- },
397
- enumerable: false,
398
- configurable: true
399
- });
400
- Object.defineProperty(MDCTabScrollerFoundation, "strings", {
401
- get: function () {
402
- return strings$4;
403
- },
404
- enumerable: false,
405
- configurable: true
406
- });
407
- Object.defineProperty(MDCTabScrollerFoundation, "defaultAdapter", {
408
- get: function () {
409
- // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
410
- return {
411
- eventTargetMatchesSelector: function () { return false; },
412
- addClass: function () { return undefined; },
413
- removeClass: function () { return undefined; },
414
- addScrollAreaClass: function () { return undefined; },
415
- setScrollAreaStyleProperty: function () { return undefined; },
416
- setScrollContentStyleProperty: function () { return undefined; },
417
- getScrollContentStyleValue: function () { return ''; },
418
- setScrollAreaScrollLeft: function () { return undefined; },
419
- getScrollAreaScrollLeft: function () { return 0; },
420
- getScrollContentOffsetWidth: function () { return 0; },
421
- getScrollAreaOffsetWidth: function () { return 0; },
422
- computeScrollAreaClientRect: function () {
423
- return ({ top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 });
424
- },
425
- computeScrollContentClientRect: function () {
426
- return ({ top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 });
427
- },
428
- computeHorizontalScrollbarHeight: function () { return 0; },
429
- };
430
- // tslint:enable:object-literal-sort-keys
431
- },
432
- enumerable: false,
433
- configurable: true
434
- });
435
- MDCTabScrollerFoundation.prototype.init = function () {
436
- // Compute horizontal scrollbar height on scroller with overflow initially hidden, then update overflow to scroll
437
- // and immediately adjust bottom margin to avoid the scrollbar initially appearing before JS runs.
438
- var horizontalScrollbarHeight = this.adapter.computeHorizontalScrollbarHeight();
439
- this.adapter.setScrollAreaStyleProperty('margin-bottom', -horizontalScrollbarHeight + 'px');
440
- this.adapter.addScrollAreaClass(MDCTabScrollerFoundation.cssClasses.SCROLL_AREA_SCROLL);
441
- };
442
- /**
443
- * Computes the current visual scroll position
444
- */
445
- MDCTabScrollerFoundation.prototype.getScrollPosition = function () {
446
- if (this.isRTL()) {
447
- return this.computeCurrentScrollPositionRTL();
448
- }
449
- var currentTranslateX = this.calculateCurrentTranslateX();
450
- var scrollLeft = this.adapter.getScrollAreaScrollLeft();
451
- return scrollLeft - currentTranslateX;
452
- };
453
- /**
454
- * Handles interaction events that occur during transition
455
- */
456
- MDCTabScrollerFoundation.prototype.handleInteraction = function () {
457
- // Early exit if we aren't animating
458
- if (!this.isAnimating) {
459
- return;
460
- }
461
- // Prevent other event listeners from handling this event
462
- this.stopScrollAnimation();
463
- };
464
- /**
465
- * Handles the transitionend event
466
- */
467
- MDCTabScrollerFoundation.prototype.handleTransitionEnd = function (evt) {
468
- // Early exit if we aren't animating or the event was triggered by a different element.
469
- var evtTarget = evt.target;
470
- if (!this.isAnimating ||
471
- !this.adapter.eventTargetMatchesSelector(evtTarget, MDCTabScrollerFoundation.strings.CONTENT_SELECTOR)) {
472
- return;
473
- }
474
- this.isAnimating = false;
475
- this.adapter.removeClass(MDCTabScrollerFoundation.cssClasses.ANIMATING);
476
- };
477
- /**
478
- * Increment the scroll value by the scrollXIncrement using animation.
479
- * @param scrollXIncrement The value by which to increment the scroll position
480
- */
481
- MDCTabScrollerFoundation.prototype.incrementScroll = function (scrollXIncrement) {
482
- // Early exit for non-operational increment values
483
- if (scrollXIncrement === 0) {
484
- return;
485
- }
486
- this.animate(this.getIncrementScrollOperation(scrollXIncrement));
487
- };
488
- /**
489
- * Increment the scroll value by the scrollXIncrement without animation.
490
- * @param scrollXIncrement The value by which to increment the scroll position
491
- */
492
- MDCTabScrollerFoundation.prototype.incrementScrollImmediate = function (scrollXIncrement) {
493
- // Early exit for non-operational increment values
494
- if (scrollXIncrement === 0) {
495
- return;
496
- }
497
- var operation = this.getIncrementScrollOperation(scrollXIncrement);
498
- if (operation.scrollDelta === 0) {
499
- return;
500
- }
501
- this.stopScrollAnimation();
502
- this.adapter.setScrollAreaScrollLeft(operation.finalScrollPosition);
503
- };
504
- /**
505
- * Scrolls to the given scrollX value
506
- */
507
- MDCTabScrollerFoundation.prototype.scrollTo = function (scrollX) {
508
- if (this.isRTL()) {
509
- this.scrollToImplRTL(scrollX);
510
- return;
511
- }
512
- this.scrollToImpl(scrollX);
513
- };
514
- /**
515
- * @return Browser-specific {@link MDCTabScrollerRTL} instance.
516
- */
517
- MDCTabScrollerFoundation.prototype.getRTLScroller = function () {
518
- if (!this.rtlScrollerInstance) {
519
- this.rtlScrollerInstance = this.rtlScrollerFactory();
520
- }
521
- return this.rtlScrollerInstance;
522
- };
523
- /**
524
- * @return translateX value from a CSS matrix transform function string.
525
- */
526
- MDCTabScrollerFoundation.prototype.calculateCurrentTranslateX = function () {
527
- var transformValue = this.adapter.getScrollContentStyleValue('transform');
528
- // Early exit if no transform is present
529
- if (transformValue === 'none') {
530
- return 0;
531
- }
532
- // The transform value comes back as a matrix transformation in the form
533
- // of `matrix(a, b, c, d, tx, ty)`. We only care about tx (translateX) so
534
- // we're going to grab all the parenthesized values, strip out tx, and
535
- // parse it.
536
- var match = /\((.+?)\)/.exec(transformValue);
537
- if (!match) {
538
- return 0;
539
- }
540
- var matrixParams = match[1];
541
- // tslint:disable-next-line:ban-ts-ignore "Unused vars" should be a linter warning, not a compiler error.
542
- // @ts-ignore These unused variables should retain their semantic names for clarity.
543
- var _a = ponyfill.__read(matrixParams.split(','), 6), tx = _a[4];
544
- return parseFloat(tx); // tslint:disable-line:ban
545
- };
546
- /**
547
- * Calculates a safe scroll value that is > 0 and < the max scroll value
548
- * @param scrollX The distance to scroll
549
- */
550
- MDCTabScrollerFoundation.prototype.clampScrollValue = function (scrollX) {
551
- var edges = this.calculateScrollEdges();
552
- return Math.min(Math.max(edges.left, scrollX), edges.right);
553
- };
554
- MDCTabScrollerFoundation.prototype.computeCurrentScrollPositionRTL = function () {
555
- var translateX = this.calculateCurrentTranslateX();
556
- return this.getRTLScroller().getScrollPositionRTL(translateX);
557
- };
558
- MDCTabScrollerFoundation.prototype.calculateScrollEdges = function () {
559
- var contentWidth = this.adapter.getScrollContentOffsetWidth();
560
- var rootWidth = this.adapter.getScrollAreaOffsetWidth();
561
- return {
562
- left: 0,
563
- right: contentWidth - rootWidth,
564
- };
565
- };
566
- /**
567
- * Internal scroll method
568
- * @param scrollX The new scroll position
569
- */
570
- MDCTabScrollerFoundation.prototype.scrollToImpl = function (scrollX) {
571
- var currentScrollX = this.getScrollPosition();
572
- var safeScrollX = this.clampScrollValue(scrollX);
573
- var scrollDelta = safeScrollX - currentScrollX;
574
- this.animate({
575
- finalScrollPosition: safeScrollX,
576
- scrollDelta: scrollDelta,
577
- });
578
- };
579
- /**
580
- * Internal RTL scroll method
581
- * @param scrollX The new scroll position
582
- */
583
- MDCTabScrollerFoundation.prototype.scrollToImplRTL = function (scrollX) {
584
- var animation = this.getRTLScroller().scrollToRTL(scrollX);
585
- this.animate(animation);
586
- };
587
- /**
588
- * Internal method to compute the increment scroll operation values.
589
- * @param scrollX The desired scroll position increment
590
- * @return MDCTabScrollerAnimation with the sanitized values for performing the scroll operation.
591
- */
592
- MDCTabScrollerFoundation.prototype.getIncrementScrollOperation = function (scrollX) {
593
- if (this.isRTL()) {
594
- return this.getRTLScroller().incrementScrollRTL(scrollX);
595
- }
596
- var currentScrollX = this.getScrollPosition();
597
- var targetScrollX = scrollX + currentScrollX;
598
- var safeScrollX = this.clampScrollValue(targetScrollX);
599
- var scrollDelta = safeScrollX - currentScrollX;
600
- return {
601
- finalScrollPosition: safeScrollX,
602
- scrollDelta: scrollDelta,
603
- };
604
- };
605
- /**
606
- * Animates the tab scrolling
607
- * @param animation The animation to apply
608
- */
609
- MDCTabScrollerFoundation.prototype.animate = function (animation) {
610
- var _this = this;
611
- // Early exit if translateX is 0, which means there's no animation to perform
612
- if (animation.scrollDelta === 0) {
613
- return;
614
- }
615
- this.stopScrollAnimation();
616
- // This animation uses the FLIP approach.
617
- // Read more here: https://aerotwist.com/blog/flip-your-animations/
618
- this.adapter.setScrollAreaScrollLeft(animation.finalScrollPosition);
619
- this.adapter.setScrollContentStyleProperty('transform', "translateX(" + animation.scrollDelta + "px)");
620
- // Force repaint
621
- this.adapter.computeScrollAreaClientRect();
622
- requestAnimationFrame(function () {
623
- _this.adapter.addClass(MDCTabScrollerFoundation.cssClasses.ANIMATING);
624
- _this.adapter.setScrollContentStyleProperty('transform', 'none');
625
- });
626
- this.isAnimating = true;
627
- };
628
- /**
629
- * Stops scroll animation
630
- */
631
- MDCTabScrollerFoundation.prototype.stopScrollAnimation = function () {
632
- this.isAnimating = false;
633
- var currentScrollPosition = this.getAnimatingScrollPosition();
634
- this.adapter.removeClass(MDCTabScrollerFoundation.cssClasses.ANIMATING);
635
- this.adapter.setScrollContentStyleProperty('transform', 'translateX(0px)');
636
- this.adapter.setScrollAreaScrollLeft(currentScrollPosition);
637
- };
638
- /**
639
- * Gets the current scroll position during animation
640
- */
641
- MDCTabScrollerFoundation.prototype.getAnimatingScrollPosition = function () {
642
- var currentTranslateX = this.calculateCurrentTranslateX();
643
- var scrollLeft = this.adapter.getScrollAreaScrollLeft();
644
- if (this.isRTL()) {
645
- return this.getRTLScroller().getAnimatingScrollPosition(scrollLeft, currentTranslateX);
646
- }
647
- return scrollLeft - currentTranslateX;
648
- };
649
- /**
650
- * Determines the RTL Scroller to use
651
- */
652
- MDCTabScrollerFoundation.prototype.rtlScrollerFactory = function () {
653
- // Browsers have three different implementations of scrollLeft in RTL mode,
654
- // dependent on the browser. The behavior is based off the max LTR
655
- // scrollLeft value and 0.
656
- //
657
- // * Default scrolling in RTL *
658
- // - Left-most value: 0
659
- // - Right-most value: Max LTR scrollLeft value
660
- //
661
- // * Negative scrolling in RTL *
662
- // - Left-most value: Negated max LTR scrollLeft value
663
- // - Right-most value: 0
664
- //
665
- // * Reverse scrolling in RTL *
666
- // - Left-most value: Max LTR scrollLeft value
667
- // - Right-most value: 0
668
- //
669
- // We use those principles below to determine which RTL scrollLeft
670
- // behavior is implemented in the current browser.
671
- var initialScrollLeft = this.adapter.getScrollAreaScrollLeft();
672
- this.adapter.setScrollAreaScrollLeft(initialScrollLeft - 1);
673
- var newScrollLeft = this.adapter.getScrollAreaScrollLeft();
674
- // If the newScrollLeft value is negative,then we know that the browser has
675
- // implemented negative RTL scrolling, since all other implementations have
676
- // only positive values.
677
- if (newScrollLeft < 0) {
678
- // Undo the scrollLeft test check
679
- this.adapter.setScrollAreaScrollLeft(initialScrollLeft);
680
- return new MDCTabScrollerRTLNegative(this.adapter);
681
- }
682
- var rootClientRect = this.adapter.computeScrollAreaClientRect();
683
- var contentClientRect = this.adapter.computeScrollContentClientRect();
684
- var rightEdgeDelta = Math.round(contentClientRect.right - rootClientRect.right);
685
- // Undo the scrollLeft test check
686
- this.adapter.setScrollAreaScrollLeft(initialScrollLeft);
687
- // By calculating the clientRect of the root element and the clientRect of
688
- // the content element, we can determine how much the scroll value changed
689
- // when we performed the scrollLeft subtraction above.
690
- if (rightEdgeDelta === newScrollLeft) {
691
- return new MDCTabScrollerRTLReverse(this.adapter);
692
- }
693
- return new MDCTabScrollerRTLDefault(this.adapter);
694
- };
695
- MDCTabScrollerFoundation.prototype.isRTL = function () {
696
- return this.adapter.getScrollContentStyleValue('direction') === 'rtl';
697
- };
698
- return MDCTabScrollerFoundation;
699
- }(ponyfill.MDCFoundation));
700
-
701
- /**
702
- * @license
703
- * Copyright 2018 Google Inc.
704
- *
705
- * Permission is hereby granted, free of charge, to any person obtaining a copy
706
- * of this software and associated documentation files (the "Software"), to deal
707
- * in the Software without restriction, including without limitation the rights
708
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
709
- * copies of the Software, and to permit persons to whom the Software is
710
- * furnished to do so, subject to the following conditions:
711
- *
712
- * The above copyright notice and this permission notice shall be included in
713
- * all copies or substantial portions of the Software.
103
+ * Set a tabs `active` state to true in a list of tabs. The previous tab with
104
+ * `active` set to true will have it set to `false` instead.
714
105
  *
715
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
716
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
717
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
718
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
719
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
720
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
721
- * THE SOFTWARE.
722
- */
723
- /**
724
- * Stores result from computeHorizontalScrollbarHeight to avoid redundant processing.
725
- */
726
- var horizontalScrollbarHeight_;
727
- /**
728
- * Computes the height of browser-rendered horizontal scrollbars using a self-created test element.
729
- * May return 0 (e.g. on OS X browsers under default configuration).
106
+ * @param tabs - list of tabs
107
+ * @param index - the index of the tab to set to active
108
+ * @returns a copy of the list of tabs with the changed tabs replaced
730
109
  */
731
- function computeHorizontalScrollbarHeight(documentObj, shouldCacheResult) {
732
- if (shouldCacheResult === void 0) { shouldCacheResult = true; }
733
- if (shouldCacheResult && typeof horizontalScrollbarHeight_ !== 'undefined') {
734
- return horizontalScrollbarHeight_;
735
- }
736
- var el = documentObj.createElement('div');
737
- el.classList.add(cssClasses$2.SCROLL_TEST);
738
- documentObj.body.appendChild(el);
739
- var horizontalScrollbarHeight = el.offsetHeight - el.clientHeight;
740
- documentObj.body.removeChild(el);
741
- if (shouldCacheResult) {
742
- horizontalScrollbarHeight_ = horizontalScrollbarHeight;
110
+ function setActiveTab(tabs, index) {
111
+ const oldSelectedTabIndex = tabs.findIndex((t) => t.active === true);
112
+ const result = [...tabs];
113
+ if (oldSelectedTabIndex !== -1) {
114
+ result[oldSelectedTabIndex] = Object.assign(Object.assign({}, tabs[oldSelectedTabIndex]), { active: false });
743
115
  }
744
- return horizontalScrollbarHeight;
116
+ result[index] = Object.assign(Object.assign({}, tabs[index]), { active: true });
117
+ return result;
745
118
  }
746
119
 
747
120
  /**
748
- * @license
749
- * Copyright 2018 Google Inc.
750
- *
751
- * Permission is hereby granted, free of charge, to any person obtaining a copy
752
- * of this software and associated documentation files (the "Software"), to deal
753
- * in the Software without restriction, including without limitation the rights
754
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
755
- * copies of the Software, and to permit persons to whom the Software is
756
- * furnished to do so, subject to the following conditions:
757
- *
758
- * The above copyright notice and this permission notice shall be included in
759
- * all copies or substantial portions of the Software.
760
- *
761
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
762
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
763
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
764
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
765
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
766
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
767
- * THE SOFTWARE.
768
- */
769
- var MDCTabScroller = /** @class */ (function (_super) {
770
- ponyfill.__extends(MDCTabScroller, _super);
771
- function MDCTabScroller() {
772
- return _super !== null && _super.apply(this, arguments) || this;
773
- }
774
- MDCTabScroller.attachTo = function (root) {
775
- return new MDCTabScroller(root);
776
- };
777
- // initialSyncWithDOM()
778
- MDCTabScroller.prototype.initialize = function () {
779
- this.area = this.root.querySelector(MDCTabScrollerFoundation.strings.AREA_SELECTOR);
780
- this.content = this.root.querySelector(MDCTabScrollerFoundation.strings.CONTENT_SELECTOR);
781
- };
782
- MDCTabScroller.prototype.initialSyncWithDOM = function () {
783
- var _this = this;
784
- this.handleInteraction = function () {
785
- _this.foundation.handleInteraction();
786
- };
787
- this.handleTransitionEnd = function (evt) {
788
- _this.foundation.handleTransitionEnd(evt);
789
- };
790
- this.area.addEventListener('wheel', this.handleInteraction, component.applyPassive());
791
- this.area.addEventListener('touchstart', this.handleInteraction, component.applyPassive());
792
- this.area.addEventListener('pointerdown', this.handleInteraction, component.applyPassive());
793
- this.area.addEventListener('mousedown', this.handleInteraction, component.applyPassive());
794
- this.area.addEventListener('keydown', this.handleInteraction, component.applyPassive());
795
- this.content.addEventListener('transitionend', this.handleTransitionEnd);
796
- };
797
- MDCTabScroller.prototype.destroy = function () {
798
- _super.prototype.destroy.call(this);
799
- this.area.removeEventListener('wheel', this.handleInteraction, component.applyPassive());
800
- this.area.removeEventListener('touchstart', this.handleInteraction, component.applyPassive());
801
- this.area.removeEventListener('pointerdown', this.handleInteraction, component.applyPassive());
802
- this.area.removeEventListener('mousedown', this.handleInteraction, component.applyPassive());
803
- this.area.removeEventListener('keydown', this.handleInteraction, component.applyPassive());
804
- this.content.removeEventListener('transitionend', this.handleTransitionEnd);
805
- };
806
- MDCTabScroller.prototype.getDefaultFoundation = function () {
807
- var _this = this;
808
- // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
809
- // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
810
- // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
811
- var adapter = {
812
- eventTargetMatchesSelector: function (evtTarget, selector) {
813
- return ponyfill.matches(evtTarget, selector);
814
- },
815
- addClass: function (className) {
816
- _this.root.classList.add(className);
817
- },
818
- removeClass: function (className) {
819
- _this.root.classList.remove(className);
820
- },
821
- addScrollAreaClass: function (className) {
822
- _this.area.classList.add(className);
823
- },
824
- setScrollAreaStyleProperty: function (prop, value) {
825
- _this.area.style.setProperty(prop, value);
826
- },
827
- setScrollContentStyleProperty: function (prop, value) {
828
- _this.content.style.setProperty(prop, value);
829
- },
830
- getScrollContentStyleValue: function (propName) {
831
- return window.getComputedStyle(_this.content).getPropertyValue(propName);
832
- },
833
- setScrollAreaScrollLeft: function (scrollX) { return _this.area.scrollLeft = scrollX; },
834
- getScrollAreaScrollLeft: function () { return _this.area.scrollLeft; },
835
- getScrollContentOffsetWidth: function () { return _this.content.offsetWidth; },
836
- getScrollAreaOffsetWidth: function () { return _this.area.offsetWidth; },
837
- computeScrollAreaClientRect: function () { return _this.area.getBoundingClientRect(); },
838
- computeScrollContentClientRect: function () {
839
- return _this.content.getBoundingClientRect();
840
- },
841
- computeHorizontalScrollbarHeight: function () {
842
- return computeHorizontalScrollbarHeight(document);
843
- },
844
- };
845
- // tslint:enable:object-literal-sort-keys
846
- return new MDCTabScrollerFoundation(adapter);
847
- };
848
- /**
849
- * Returns the current visual scroll position
850
- */
851
- MDCTabScroller.prototype.getScrollPosition = function () {
852
- return this.foundation.getScrollPosition();
853
- };
854
- /**
855
- * Returns the width of the scroll content
856
- */
857
- MDCTabScroller.prototype.getScrollContentWidth = function () {
858
- return this.content.offsetWidth;
859
- };
860
- /**
861
- * Increments the scroll value by the given amount
862
- * @param scrollXIncrement The pixel value by which to increment the scroll value
863
- */
864
- MDCTabScroller.prototype.incrementScroll = function (scrollXIncrement) {
865
- this.foundation.incrementScroll(scrollXIncrement);
866
- };
867
- /**
868
- * Scrolls to the given pixel position
869
- * @param scrollX The pixel value to scroll to
870
- */
871
- MDCTabScroller.prototype.scrollTo = function (scrollX) {
872
- this.foundation.scrollTo(scrollX);
873
- };
874
- return MDCTabScroller;
875
- }(ponyfill.MDCComponent));
876
-
877
- /**
878
- * @license
879
- * Copyright 2018 Google Inc.
880
- *
881
- * Permission is hereby granted, free of charge, to any person obtaining a copy
882
- * of this software and associated documentation files (the "Software"), to deal
883
- * in the Software without restriction, including without limitation the rights
884
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
885
- * copies of the Software, and to permit persons to whom the Software is
886
- * furnished to do so, subject to the following conditions:
887
- *
888
- * The above copyright notice and this permission notice shall be included in
889
- * all copies or substantial portions of the Software.
890
- *
891
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
892
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
893
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
894
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
895
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
896
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
897
- * THE SOFTWARE.
898
- */
899
- var cssClasses$1 = {
900
- ACTIVE: 'mdc-tab-indicator--active',
901
- FADE: 'mdc-tab-indicator--fade',
902
- NO_TRANSITION: 'mdc-tab-indicator--no-transition',
903
- };
904
- var strings$3 = {
905
- CONTENT_SELECTOR: '.mdc-tab-indicator__content',
906
- };
907
-
908
- /**
909
- * @license
910
- * Copyright 2018 Google Inc.
911
- *
912
- * Permission is hereby granted, free of charge, to any person obtaining a copy
913
- * of this software and associated documentation files (the "Software"), to deal
914
- * in the Software without restriction, including without limitation the rights
915
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
916
- * copies of the Software, and to permit persons to whom the Software is
917
- * furnished to do so, subject to the following conditions:
918
- *
919
- * The above copyright notice and this permission notice shall be included in
920
- * all copies or substantial portions of the Software.
921
- *
922
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
923
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
924
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
925
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
926
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
927
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
928
- * THE SOFTWARE.
121
+ * Returned when there is no item to move to.
929
122
  */
930
- var MDCTabIndicatorFoundation = /** @class */ (function (_super) {
931
- ponyfill.__extends(MDCTabIndicatorFoundation, _super);
932
- function MDCTabIndicatorFoundation(adapter) {
933
- return _super.call(this, ponyfill.__assign(ponyfill.__assign({}, MDCTabIndicatorFoundation.defaultAdapter), adapter)) || this;
934
- }
935
- Object.defineProperty(MDCTabIndicatorFoundation, "cssClasses", {
936
- get: function () {
937
- return cssClasses$1;
938
- },
939
- enumerable: false,
940
- configurable: true
941
- });
942
- Object.defineProperty(MDCTabIndicatorFoundation, "strings", {
943
- get: function () {
944
- return strings$3;
945
- },
946
- enumerable: false,
947
- configurable: true
948
- });
949
- Object.defineProperty(MDCTabIndicatorFoundation, "defaultAdapter", {
950
- get: function () {
951
- // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
952
- return {
953
- addClass: function () { return undefined; },
954
- removeClass: function () { return undefined; },
955
- computeContentClientRect: function () {
956
- return ({ top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 });
957
- },
958
- setContentStyleProperty: function () { return undefined; },
959
- };
960
- // tslint:enable:object-literal-sort-keys
961
- },
962
- enumerable: false,
963
- configurable: true
964
- });
965
- MDCTabIndicatorFoundation.prototype.computeContentClientRect = function () {
966
- return this.adapter.computeContentClientRect();
967
- };
968
- return MDCTabIndicatorFoundation;
969
- }(ponyfill.MDCFoundation));
970
-
971
- /**
972
- * @license
973
- * Copyright 2018 Google Inc.
974
- *
975
- * Permission is hereby granted, free of charge, to any person obtaining a copy
976
- * of this software and associated documentation files (the "Software"), to deal
977
- * in the Software without restriction, including without limitation the rights
978
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
979
- * copies of the Software, and to permit persons to whom the Software is
980
- * furnished to do so, subject to the following conditions:
981
- *
982
- * The above copyright notice and this permission notice shall be included in
983
- * all copies or substantial portions of the Software.
984
- *
985
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
986
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
987
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
988
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
989
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
990
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
991
- * THE SOFTWARE.
992
- */
993
- /* istanbul ignore next: subclass is not a branch statement */
994
- var MDCFadingTabIndicatorFoundation = /** @class */ (function (_super) {
995
- ponyfill.__extends(MDCFadingTabIndicatorFoundation, _super);
996
- function MDCFadingTabIndicatorFoundation() {
997
- return _super !== null && _super.apply(this, arguments) || this;
998
- }
999
- MDCFadingTabIndicatorFoundation.prototype.activate = function () {
1000
- this.adapter.addClass(MDCTabIndicatorFoundation.cssClasses.ACTIVE);
1001
- };
1002
- MDCFadingTabIndicatorFoundation.prototype.deactivate = function () {
1003
- this.adapter.removeClass(MDCTabIndicatorFoundation.cssClasses.ACTIVE);
1004
- };
1005
- return MDCFadingTabIndicatorFoundation;
1006
- }(MDCTabIndicatorFoundation));
1007
-
1008
- /**
1009
- * @license
1010
- * Copyright 2018 Google Inc.
1011
- *
1012
- * Permission is hereby granted, free of charge, to any person obtaining a copy
1013
- * of this software and associated documentation files (the "Software"), to deal
1014
- * in the Software without restriction, including without limitation the rights
1015
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1016
- * copies of the Software, and to permit persons to whom the Software is
1017
- * furnished to do so, subject to the following conditions:
1018
- *
1019
- * The above copyright notice and this permission notice shall be included in
1020
- * all copies or substantial portions of the Software.
1021
- *
1022
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1023
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1024
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1025
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1026
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1027
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1028
- * THE SOFTWARE.
1029
- */
1030
- /* istanbul ignore next: subclass is not a branch statement */
1031
- var MDCSlidingTabIndicatorFoundation = /** @class */ (function (_super) {
1032
- ponyfill.__extends(MDCSlidingTabIndicatorFoundation, _super);
1033
- function MDCSlidingTabIndicatorFoundation() {
1034
- return _super !== null && _super.apply(this, arguments) || this;
1035
- }
1036
- MDCSlidingTabIndicatorFoundation.prototype.activate = function (previousIndicatorClientRect) {
1037
- // Early exit if no indicator is present to handle cases where an indicator
1038
- // may be activated without a prior indicator state
1039
- if (!previousIndicatorClientRect) {
1040
- this.adapter.addClass(MDCTabIndicatorFoundation.cssClasses.ACTIVE);
1041
- return;
1042
- }
1043
- // This animation uses the FLIP approach. You can read more about it at the link below:
1044
- // https://aerotwist.com/blog/flip-your-animations/
1045
- // Calculate the dimensions based on the dimensions of the previous indicator
1046
- var currentClientRect = this.computeContentClientRect();
1047
- var widthDelta = previousIndicatorClientRect.width / currentClientRect.width;
1048
- var xPosition = previousIndicatorClientRect.left - currentClientRect.left;
1049
- this.adapter.addClass(MDCTabIndicatorFoundation.cssClasses.NO_TRANSITION);
1050
- this.adapter.setContentStyleProperty('transform', "translateX(" + xPosition + "px) scaleX(" + widthDelta + ")");
1051
- // Force repaint before updating classes and transform to ensure the transform properly takes effect
1052
- this.computeContentClientRect();
1053
- this.adapter.removeClass(MDCTabIndicatorFoundation.cssClasses.NO_TRANSITION);
1054
- this.adapter.addClass(MDCTabIndicatorFoundation.cssClasses.ACTIVE);
1055
- this.adapter.setContentStyleProperty('transform', '');
1056
- };
1057
- MDCSlidingTabIndicatorFoundation.prototype.deactivate = function () {
1058
- this.adapter.removeClass(MDCTabIndicatorFoundation.cssClasses.ACTIVE);
1059
- };
1060
- return MDCSlidingTabIndicatorFoundation;
1061
- }(MDCTabIndicatorFoundation));
1062
-
1063
- /**
1064
- * @license
1065
- * Copyright 2018 Google Inc.
1066
- *
1067
- * Permission is hereby granted, free of charge, to any person obtaining a copy
1068
- * of this software and associated documentation files (the "Software"), to deal
1069
- * in the Software without restriction, including without limitation the rights
1070
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1071
- * copies of the Software, and to permit persons to whom the Software is
1072
- * furnished to do so, subject to the following conditions:
1073
- *
1074
- * The above copyright notice and this permission notice shall be included in
1075
- * all copies or substantial portions of the Software.
1076
- *
1077
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1078
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1079
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1080
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1081
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1082
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1083
- * THE SOFTWARE.
1084
- */
1085
- var MDCTabIndicator = /** @class */ (function (_super) {
1086
- ponyfill.__extends(MDCTabIndicator, _super);
1087
- function MDCTabIndicator() {
1088
- return _super !== null && _super.apply(this, arguments) || this;
1089
- }
1090
- MDCTabIndicator.attachTo = function (root) {
1091
- return new MDCTabIndicator(root);
1092
- };
1093
- MDCTabIndicator.prototype.initialize = function () {
1094
- this.content = this.root.querySelector(MDCTabIndicatorFoundation.strings.CONTENT_SELECTOR);
1095
- };
1096
- MDCTabIndicator.prototype.computeContentClientRect = function () {
1097
- return this.foundation.computeContentClientRect();
1098
- };
1099
- MDCTabIndicator.prototype.getDefaultFoundation = function () {
1100
- var _this = this;
1101
- // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
1102
- // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
1103
- // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
1104
- var adapter = {
1105
- addClass: function (className) { return _this.root.classList.add(className); },
1106
- removeClass: function (className) { return _this.root.classList.remove(className); },
1107
- computeContentClientRect: function () { return _this.content.getBoundingClientRect(); },
1108
- setContentStyleProperty: function (prop, value) {
1109
- _this.content.style.setProperty(prop, value);
1110
- },
1111
- };
1112
- // tslint:enable:object-literal-sort-keys
1113
- if (this.root.classList.contains(MDCTabIndicatorFoundation.cssClasses.FADE)) {
1114
- return new MDCFadingTabIndicatorFoundation(adapter);
1115
- }
1116
- // Default to the sliding indicator
1117
- return new MDCSlidingTabIndicatorFoundation(adapter);
1118
- };
1119
- MDCTabIndicator.prototype.activate = function (previousIndicatorClientRect) {
1120
- this.foundation.activate(previousIndicatorClientRect);
1121
- };
1122
- MDCTabIndicator.prototype.deactivate = function () {
1123
- this.foundation.deactivate();
1124
- };
1125
- return MDCTabIndicator;
1126
- }(ponyfill.MDCComponent));
1127
-
1128
- /**
1129
- * @license
1130
- * Copyright 2018 Google Inc.
1131
- *
1132
- * Permission is hereby granted, free of charge, to any person obtaining a copy
1133
- * of this software and associated documentation files (the "Software"), to deal
1134
- * in the Software without restriction, including without limitation the rights
1135
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1136
- * copies of the Software, and to permit persons to whom the Software is
1137
- * furnished to do so, subject to the following conditions:
1138
- *
1139
- * The above copyright notice and this permission notice shall be included in
1140
- * all copies or substantial portions of the Software.
1141
- *
1142
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1143
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1144
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1145
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1146
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1147
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1148
- * THE SOFTWARE.
1149
- */
1150
- var cssClasses = {
1151
- ACTIVE: 'mdc-tab--active',
1152
- };
1153
- var strings$2 = {
1154
- ARIA_SELECTED: 'aria-selected',
1155
- CONTENT_SELECTOR: '.mdc-tab__content',
1156
- INTERACTED_EVENT: 'MDCTab:interacted',
1157
- RIPPLE_SELECTOR: '.mdc-tab__ripple',
1158
- TABINDEX: 'tabIndex',
1159
- TAB_INDICATOR_SELECTOR: '.mdc-tab-indicator',
123
+ const NO_NAVIGATION_TARGET = -1;
124
+ const MOVES = {
125
+ horizontal: new Map([
126
+ [keycodes.ARROW_LEFT, 'previous'],
127
+ [keycodes.ARROW_RIGHT, 'next'],
128
+ [keycodes.HOME, 'first'],
129
+ [keycodes.END, 'last'],
130
+ ]),
131
+ vertical: new Map([
132
+ [keycodes.ARROW_UP, 'previous'],
133
+ [keycodes.ARROW_DOWN, 'next'],
134
+ [keycodes.HOME, 'first'],
135
+ [keycodes.END, 'last'],
136
+ ]),
1160
137
  };
1161
-
1162
138
  /**
1163
- * @license
1164
- * Copyright 2018 Google Inc.
139
+ * Whether a keyboard event is one that moves between the items: an arrow key
140
+ * that goes along the orientation, or Home or End.
1165
141
  *
1166
- * Permission is hereby granted, free of charge, to any person obtaining a copy
1167
- * of this software and associated documentation files (the "Software"), to deal
1168
- * in the Software without restriction, including without limitation the rights
1169
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1170
- * copies of the Software, and to permit persons to whom the Software is
1171
- * furnished to do so, subject to the following conditions:
142
+ * A key that is pressed with Alt, Ctrl or Cmd is not, since the browser puts
143
+ * those to its own use, such as going back with Alt and the left arrow. Shift
144
+ * is allowed.
1172
145
  *
1173
- * The above copyright notice and this permission notice shall be included in
1174
- * all copies or substantial portions of the Software.
146
+ * When this returns `true`, the component should prevent the default action
147
+ * of the event, so that the page does not scroll. Also when there turns out to
148
+ * be nowhere to move to.
1175
149
  *
1176
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1177
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1178
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1179
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1180
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1181
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1182
- * THE SOFTWARE.
150
+ * @param event - the keyboard event to inspect
151
+ * @param options - the same options that are used to move between the items.
152
+ * Only the orientation matters here.
153
+ * @returns `true` when the event is for moving between the items
1183
154
  */
1184
- var MDCTabFoundation = /** @class */ (function (_super) {
1185
- ponyfill.__extends(MDCTabFoundation, _super);
1186
- function MDCTabFoundation(adapter) {
1187
- var _this = _super.call(this, ponyfill.__assign(ponyfill.__assign({}, MDCTabFoundation.defaultAdapter), adapter)) || this;
1188
- _this.focusOnActivate = true;
1189
- return _this;
155
+ function isNavigationKey(event, options) {
156
+ if (event.altKey || event.ctrlKey || event.metaKey) {
157
+ return false;
1190
158
  }
1191
- Object.defineProperty(MDCTabFoundation, "cssClasses", {
1192
- get: function () {
1193
- return cssClasses;
1194
- },
1195
- enumerable: false,
1196
- configurable: true
1197
- });
1198
- Object.defineProperty(MDCTabFoundation, "strings", {
1199
- get: function () {
1200
- return strings$2;
1201
- },
1202
- enumerable: false,
1203
- configurable: true
1204
- });
1205
- Object.defineProperty(MDCTabFoundation, "defaultAdapter", {
1206
- get: function () {
1207
- // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
1208
- return {
1209
- addClass: function () { return undefined; },
1210
- removeClass: function () { return undefined; },
1211
- hasClass: function () { return false; },
1212
- setAttr: function () { return undefined; },
1213
- activateIndicator: function () { return undefined; },
1214
- deactivateIndicator: function () { return undefined; },
1215
- notifyInteracted: function () { return undefined; },
1216
- getOffsetLeft: function () { return 0; },
1217
- getOffsetWidth: function () { return 0; },
1218
- getContentOffsetLeft: function () { return 0; },
1219
- getContentOffsetWidth: function () { return 0; },
1220
- focus: function () { return undefined; },
1221
- };
1222
- // tslint:enable:object-literal-sort-keys
1223
- },
1224
- enumerable: false,
1225
- configurable: true
1226
- });
1227
- MDCTabFoundation.prototype.handleClick = function () {
1228
- // It's up to the parent component to keep track of the active Tab and
1229
- // ensure we don't activate a Tab that's already active.
1230
- this.adapter.notifyInteracted();
1231
- };
1232
- MDCTabFoundation.prototype.isActive = function () {
1233
- return this.adapter.hasClass(cssClasses.ACTIVE);
1234
- };
1235
- /**
1236
- * Sets whether the tab should focus itself when activated
1237
- */
1238
- MDCTabFoundation.prototype.setFocusOnActivate = function (focusOnActivate) {
1239
- this.focusOnActivate = focusOnActivate;
1240
- };
1241
- /**
1242
- * Activates the Tab
1243
- */
1244
- MDCTabFoundation.prototype.activate = function (previousIndicatorClientRect) {
1245
- this.adapter.addClass(cssClasses.ACTIVE);
1246
- this.adapter.setAttr(strings$2.ARIA_SELECTED, 'true');
1247
- this.adapter.setAttr(strings$2.TABINDEX, '0');
1248
- this.adapter.activateIndicator(previousIndicatorClientRect);
1249
- if (this.focusOnActivate) {
1250
- this.adapter.focus();
1251
- }
1252
- };
1253
- /**
1254
- * Deactivates the Tab
1255
- */
1256
- MDCTabFoundation.prototype.deactivate = function () {
1257
- // Early exit
1258
- if (!this.isActive()) {
1259
- return;
1260
- }
1261
- this.adapter.removeClass(cssClasses.ACTIVE);
1262
- this.adapter.setAttr(strings$2.ARIA_SELECTED, 'false');
1263
- this.adapter.setAttr(strings$2.TABINDEX, '-1');
1264
- this.adapter.deactivateIndicator();
1265
- };
1266
- /**
1267
- * Returns the dimensions of the Tab
1268
- */
1269
- MDCTabFoundation.prototype.computeDimensions = function () {
1270
- var rootWidth = this.adapter.getOffsetWidth();
1271
- var rootLeft = this.adapter.getOffsetLeft();
1272
- var contentWidth = this.adapter.getContentOffsetWidth();
1273
- var contentLeft = this.adapter.getContentOffsetLeft();
1274
- return {
1275
- contentLeft: rootLeft + contentLeft,
1276
- contentRight: rootLeft + contentLeft + contentWidth,
1277
- rootLeft: rootLeft,
1278
- rootRight: rootLeft + rootWidth,
1279
- };
1280
- };
1281
- return MDCTabFoundation;
1282
- }(ponyfill.MDCFoundation));
1283
-
1284
- /**
1285
- * @license
1286
- * Copyright 2018 Google Inc.
1287
- *
1288
- * Permission is hereby granted, free of charge, to any person obtaining a copy
1289
- * of this software and associated documentation files (the "Software"), to deal
1290
- * in the Software without restriction, including without limitation the rights
1291
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1292
- * copies of the Software, and to permit persons to whom the Software is
1293
- * furnished to do so, subject to the following conditions:
1294
- *
1295
- * The above copyright notice and this permission notice shall be included in
1296
- * all copies or substantial portions of the Software.
1297
- *
1298
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1299
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1300
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1301
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1302
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1303
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1304
- * THE SOFTWARE.
1305
- */
1306
- var MDCTab = /** @class */ (function (_super) {
1307
- ponyfill.__extends(MDCTab, _super);
1308
- function MDCTab() {
1309
- return _super !== null && _super.apply(this, arguments) || this;
1310
- }
1311
- MDCTab.attachTo = function (root) {
1312
- return new MDCTab(root);
1313
- };
1314
- MDCTab.prototype.initialize = function (rippleFactory, tabIndicatorFactory) {
1315
- if (rippleFactory === void 0) { rippleFactory = function (el, foundation) { return new component.MDCRipple(el, foundation); }; }
1316
- if (tabIndicatorFactory === void 0) { tabIndicatorFactory = function (el) { return new MDCTabIndicator(el); }; }
1317
- this.id = this.root.id;
1318
- var rippleFoundation = new component.MDCRippleFoundation(component.MDCRipple.createAdapter(this));
1319
- this.ripple = rippleFactory(this.root, rippleFoundation);
1320
- var tabIndicatorElement = this.root.querySelector(MDCTabFoundation.strings.TAB_INDICATOR_SELECTOR);
1321
- this.tabIndicator = tabIndicatorFactory(tabIndicatorElement);
1322
- this.content = this.root.querySelector(MDCTabFoundation.strings.CONTENT_SELECTOR);
1323
- };
1324
- MDCTab.prototype.initialSyncWithDOM = function () {
1325
- var _this = this;
1326
- this.handleClick = function () {
1327
- _this.foundation.handleClick();
1328
- };
1329
- this.listen('click', this.handleClick);
1330
- };
1331
- MDCTab.prototype.destroy = function () {
1332
- this.unlisten('click', this.handleClick);
1333
- this.ripple.destroy();
1334
- _super.prototype.destroy.call(this);
1335
- };
1336
- MDCTab.prototype.getDefaultFoundation = function () {
1337
- var _this = this;
1338
- // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
1339
- // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
1340
- // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
1341
- var adapter = {
1342
- setAttr: function (attr, value) { return _this.root.setAttribute(attr, value); },
1343
- addClass: function (className) { return _this.root.classList.add(className); },
1344
- removeClass: function (className) { return _this.root.classList.remove(className); },
1345
- hasClass: function (className) { return _this.root.classList.contains(className); },
1346
- activateIndicator: function (previousIndicatorClientRect) {
1347
- _this.tabIndicator.activate(previousIndicatorClientRect);
1348
- },
1349
- deactivateIndicator: function () {
1350
- _this.tabIndicator.deactivate();
1351
- },
1352
- notifyInteracted: function () { return _this.emit(MDCTabFoundation.strings.INTERACTED_EVENT, { tabId: _this.id }, true /* bubble */); },
1353
- getOffsetLeft: function () { return _this.root.offsetLeft; },
1354
- getOffsetWidth: function () { return _this.root.offsetWidth; },
1355
- getContentOffsetLeft: function () { return _this.content.offsetLeft; },
1356
- getContentOffsetWidth: function () { return _this.content.offsetWidth; },
1357
- focus: function () { return _this.root.focus(); },
1358
- };
1359
- // tslint:enable:object-literal-sort-keys
1360
- return new MDCTabFoundation(adapter);
1361
- };
1362
- Object.defineProperty(MDCTab.prototype, "active", {
1363
- /**
1364
- * Getter for the active state of the tab
1365
- */
1366
- get: function () {
1367
- return this.foundation.isActive();
1368
- },
1369
- enumerable: false,
1370
- configurable: true
1371
- });
1372
- Object.defineProperty(MDCTab.prototype, "focusOnActivate", {
1373
- set: function (focusOnActivate) {
1374
- this.foundation.setFocusOnActivate(focusOnActivate);
1375
- },
1376
- enumerable: false,
1377
- configurable: true
1378
- });
1379
- /**
1380
- * Activates the tab
1381
- */
1382
- MDCTab.prototype.activate = function (computeIndicatorClientRect) {
1383
- this.foundation.activate(computeIndicatorClientRect);
1384
- };
1385
- /**
1386
- * Deactivates the tab
1387
- */
1388
- MDCTab.prototype.deactivate = function () {
1389
- this.foundation.deactivate();
1390
- };
1391
- /**
1392
- * Returns the indicator's client rect
1393
- */
1394
- MDCTab.prototype.computeIndicatorClientRect = function () {
1395
- return this.tabIndicator.computeContentClientRect();
1396
- };
1397
- MDCTab.prototype.computeDimensions = function () {
1398
- return this.foundation.computeDimensions();
1399
- };
1400
- /**
1401
- * Focuses the tab
1402
- */
1403
- MDCTab.prototype.focus = function () {
1404
- this.root.focus();
1405
- };
1406
- return MDCTab;
1407
- }(ponyfill.MDCComponent));
1408
-
159
+ return MOVES[options.orientation].has(event.key);
160
+ }
1409
161
  /**
1410
- * @license
1411
- * Copyright 2018 Google Inc.
1412
- *
1413
- * Permission is hereby granted, free of charge, to any person obtaining a copy
1414
- * of this software and associated documentation files (the "Software"), to deal
1415
- * in the Software without restriction, including without limitation the rights
1416
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1417
- * copies of the Software, and to permit persons to whom the Software is
1418
- * furnished to do so, subject to the following conditions:
1419
- *
1420
- * The above copyright notice and this permission notice shall be included in
1421
- * all copies or substantial portions of the Software.
1422
- *
1423
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1424
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1425
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1426
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1427
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1428
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1429
- * THE SOFTWARE.
162
+ * Find the item that a key press moves to.
163
+ *
164
+ * - The arrow keys that go along the orientation move to the next and the
165
+ * previous item. At the ends they stop, or continue at the other end when
166
+ * `options.wrap` is set.
167
+ * - Home and End move to the first and the last item.
168
+ * - Items that cannot be moved to are skipped.
169
+ * - Without a current item, moving forward starts at the first item, and
170
+ * moving back at the last one.
171
+ *
172
+ * @param items - the items, in the order that they are laid out in. Only their
173
+ * number matters, unless `options.isDisabled` is given.
174
+ * @param key - the `key` of the keyboard event
175
+ * @param currentIndex - the index of the item to move from, usually the one
176
+ * that has focus. Anything outside `items` is treated as "no current item".
177
+ * @param options - which keys move, and how
178
+ * @returns the index of the item to move to. That is `currentIndex` itself
179
+ * when there is nowhere to go from there, since the end is reached and it does
180
+ * not wrap, or since it is the only item that can be moved to. It is
181
+ * `NO_NAVIGATION_TARGET` when the key does not move in this orientation, and
182
+ * when none of the items can be moved to.
1430
183
  */
1431
- var strings$1 = {
1432
- ARROW_LEFT_KEY: 'ArrowLeft',
1433
- ARROW_RIGHT_KEY: 'ArrowRight',
1434
- END_KEY: 'End',
1435
- ENTER_KEY: 'Enter',
1436
- HOME_KEY: 'Home',
1437
- SPACE_KEY: 'Space',
1438
- TAB_ACTIVATED_EVENT: 'MDCTabBar:activated',
1439
- TAB_SCROLLER_SELECTOR: '.mdc-tab-scroller',
1440
- TAB_SELECTOR: '.mdc-tab',
1441
- };
1442
- var numbers = {
1443
- ARROW_LEFT_KEYCODE: 37,
1444
- ARROW_RIGHT_KEYCODE: 39,
1445
- END_KEYCODE: 35,
1446
- ENTER_KEYCODE: 13,
1447
- EXTRA_SCROLL_AMOUNT: 20,
1448
- HOME_KEYCODE: 36,
1449
- SPACE_KEYCODE: 32,
1450
- };
1451
-
184
+ function findNavigationTarget(items, key, currentIndex, options) {
185
+ const move = MOVES[options.orientation].get(key);
186
+ const count = items.length;
187
+ const canMoveTo = createReachableTest(items, options);
188
+ const first = findReachable(count, 0, 1, false, canMoveTo);
189
+ if (!move || first === NO_NAVIGATION_TARGET) {
190
+ return NO_NAVIGATION_TARGET;
191
+ }
192
+ if (move === 'first') {
193
+ return first;
194
+ }
195
+ const last = findReachable(count, count - 1, -1, false, canMoveTo);
196
+ if (move === 'last') {
197
+ return last;
198
+ }
199
+ if (!isWithin(currentIndex, count)) {
200
+ return move === 'next' ? first : last;
201
+ }
202
+ const step = move === 'next' ? 1 : -1;
203
+ const target = findReachable(count, currentIndex + step, step, Boolean(options.wrap), canMoveTo);
204
+ return target === NO_NAVIGATION_TARGET ? currentIndex : target;
205
+ }
1452
206
  /**
1453
- * @license
1454
- * Copyright 2018 Google Inc.
1455
- *
1456
- * Permission is hereby granted, free of charge, to any person obtaining a copy
1457
- * of this software and associated documentation files (the "Software"), to deal
1458
- * in the Software without restriction, including without limitation the rights
1459
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1460
- * copies of the Software, and to permit persons to whom the Software is
1461
- * furnished to do so, subject to the following conditions:
1462
- *
1463
- * The above copyright notice and this permission notice shall be included in
1464
- * all copies or substantial portions of the Software.
1465
- *
1466
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1467
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1468
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1469
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1470
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1471
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1472
- * THE SOFTWARE.
207
+ * Find the item that should be in the tab order, which is the one that Tab
208
+ * lands on when it enters the group. The rest of the items are left out of the
209
+ * tab order, and are reached with the arrow keys.
210
+ *
211
+ * That is the preferred item, if it can be moved to. Otherwise the first item
212
+ * that can.
213
+ *
214
+ * @param items - the items, in the order that they are laid out in. Only their
215
+ * number matters, unless `options.isDisabled` is given.
216
+ * @param preferredIndex - the index of the item that should be in the tab
217
+ * order if possible. For a group with a selection that is the selected item,
218
+ * and otherwise the item that last had focus, which the component has to keep
219
+ * track of. Anything outside `items` means that there is no preference.
220
+ * @param options - the same options that are used to move between the items
221
+ * @returns the index of the item to put in the tab order, or
222
+ * `NO_NAVIGATION_TARGET` when none of the items can be moved to
1473
223
  */
1474
- var ACCEPTABLE_KEYS = new Set();
1475
- // IE11 has no support for new Set with iterable so we need to initialize this by hand
1476
- ACCEPTABLE_KEYS.add(strings$1.ARROW_LEFT_KEY);
1477
- ACCEPTABLE_KEYS.add(strings$1.ARROW_RIGHT_KEY);
1478
- ACCEPTABLE_KEYS.add(strings$1.END_KEY);
1479
- ACCEPTABLE_KEYS.add(strings$1.HOME_KEY);
1480
- ACCEPTABLE_KEYS.add(strings$1.ENTER_KEY);
1481
- ACCEPTABLE_KEYS.add(strings$1.SPACE_KEY);
1482
- var KEYCODE_MAP = new Map();
1483
- // IE11 has no support for new Map with iterable so we need to initialize this by hand
1484
- KEYCODE_MAP.set(numbers.ARROW_LEFT_KEYCODE, strings$1.ARROW_LEFT_KEY);
1485
- KEYCODE_MAP.set(numbers.ARROW_RIGHT_KEYCODE, strings$1.ARROW_RIGHT_KEY);
1486
- KEYCODE_MAP.set(numbers.END_KEYCODE, strings$1.END_KEY);
1487
- KEYCODE_MAP.set(numbers.HOME_KEYCODE, strings$1.HOME_KEY);
1488
- KEYCODE_MAP.set(numbers.ENTER_KEYCODE, strings$1.ENTER_KEY);
1489
- KEYCODE_MAP.set(numbers.SPACE_KEYCODE, strings$1.SPACE_KEY);
1490
- var MDCTabBarFoundation = /** @class */ (function (_super) {
1491
- ponyfill.__extends(MDCTabBarFoundation, _super);
1492
- function MDCTabBarFoundation(adapter) {
1493
- var _this = _super.call(this, ponyfill.__assign(ponyfill.__assign({}, MDCTabBarFoundation.defaultAdapter), adapter)) || this;
1494
- _this.useAutomaticActivation = false;
1495
- return _this;
224
+ function findTabStop(items, preferredIndex, options) {
225
+ const count = items.length;
226
+ const canMoveTo = createReachableTest(items, options);
227
+ if (isWithin(preferredIndex, count) && canMoveTo(preferredIndex)) {
228
+ return preferredIndex;
1496
229
  }
1497
- Object.defineProperty(MDCTabBarFoundation, "strings", {
1498
- get: function () {
1499
- return strings$1;
1500
- },
1501
- enumerable: false,
1502
- configurable: true
1503
- });
1504
- Object.defineProperty(MDCTabBarFoundation, "numbers", {
1505
- get: function () {
1506
- return numbers;
1507
- },
1508
- enumerable: false,
1509
- configurable: true
1510
- });
1511
- Object.defineProperty(MDCTabBarFoundation, "defaultAdapter", {
1512
- get: function () {
1513
- // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
1514
- return {
1515
- scrollTo: function () { return undefined; },
1516
- incrementScroll: function () { return undefined; },
1517
- getScrollPosition: function () { return 0; },
1518
- getScrollContentWidth: function () { return 0; },
1519
- getOffsetWidth: function () { return 0; },
1520
- isRTL: function () { return false; },
1521
- setActiveTab: function () { return undefined; },
1522
- activateTabAtIndex: function () { return undefined; },
1523
- deactivateTabAtIndex: function () { return undefined; },
1524
- focusTabAtIndex: function () { return undefined; },
1525
- getTabIndicatorClientRectAtIndex: function () {
1526
- return ({ top: 0, right: 0, bottom: 0, left: 0, width: 0, height: 0 });
1527
- },
1528
- getTabDimensionsAtIndex: function () {
1529
- return ({ rootLeft: 0, rootRight: 0, contentLeft: 0, contentRight: 0 });
1530
- },
1531
- getPreviousActiveTabIndex: function () { return -1; },
1532
- getFocusedTabIndex: function () { return -1; },
1533
- getIndexOfTabById: function () { return -1; },
1534
- getTabListLength: function () { return 0; },
1535
- notifyTabActivated: function () { return undefined; },
1536
- };
1537
- // tslint:enable:object-literal-sort-keys
1538
- },
1539
- enumerable: false,
1540
- configurable: true
1541
- });
1542
- /**
1543
- * Switches between automatic and manual activation modes.
1544
- * See https://www.w3.org/TR/wai-aria-practices/#tabpanel for examples.
1545
- */
1546
- MDCTabBarFoundation.prototype.setUseAutomaticActivation = function (useAutomaticActivation) {
1547
- this.useAutomaticActivation = useAutomaticActivation;
1548
- };
1549
- MDCTabBarFoundation.prototype.activateTab = function (index) {
1550
- var previousActiveIndex = this.adapter.getPreviousActiveTabIndex();
1551
- if (!this.indexIsInRange(index) || index === previousActiveIndex) {
1552
- return;
1553
- }
1554
- var previousClientRect;
1555
- if (previousActiveIndex !== -1) {
1556
- this.adapter.deactivateTabAtIndex(previousActiveIndex);
1557
- previousClientRect =
1558
- this.adapter.getTabIndicatorClientRectAtIndex(previousActiveIndex);
1559
- }
1560
- this.adapter.activateTabAtIndex(index, previousClientRect);
1561
- this.scrollIntoView(index);
1562
- this.adapter.notifyTabActivated(index);
1563
- };
1564
- MDCTabBarFoundation.prototype.handleKeyDown = function (evt) {
1565
- // Get the key from the event
1566
- var key = this.getKeyFromEvent(evt);
1567
- // Early exit if the event key isn't one of the keyboard navigation keys
1568
- if (key === undefined) {
1569
- return;
1570
- }
1571
- // Prevent default behavior for movement keys, but not for activation keys, since :active is used to apply ripple
1572
- if (!this.isActivationKey(key)) {
1573
- evt.preventDefault();
1574
- }
1575
- if (this.useAutomaticActivation) {
1576
- if (this.isActivationKey(key)) {
1577
- return;
1578
- }
1579
- var index = this.determineTargetFromKey(this.adapter.getPreviousActiveTabIndex(), key);
1580
- this.adapter.setActiveTab(index);
1581
- this.scrollIntoView(index);
1582
- }
1583
- else {
1584
- var focusedTabIndex = this.adapter.getFocusedTabIndex();
1585
- if (this.isActivationKey(key)) {
1586
- this.adapter.setActiveTab(focusedTabIndex);
1587
- }
1588
- else {
1589
- var index = this.determineTargetFromKey(focusedTabIndex, key);
1590
- this.adapter.focusTabAtIndex(index);
1591
- this.scrollIntoView(index);
1592
- }
1593
- }
1594
- };
1595
- /**
1596
- * Handles the MDCTab:interacted event
1597
- */
1598
- MDCTabBarFoundation.prototype.handleTabInteraction = function (evt) {
1599
- this.adapter.setActiveTab(this.adapter.getIndexOfTabById(evt.detail.tabId));
1600
- };
1601
- /**
1602
- * Scrolls the tab at the given index into view
1603
- * @param index The tab index to make visible
1604
- */
1605
- MDCTabBarFoundation.prototype.scrollIntoView = function (index) {
1606
- // Early exit if the index is out of range
1607
- if (!this.indexIsInRange(index)) {
1608
- return;
1609
- }
1610
- // Always scroll to 0 if scrolling to the 0th index
1611
- if (index === 0) {
1612
- this.adapter.scrollTo(0);
1613
- return;
1614
- }
1615
- // Always scroll to the max value if scrolling to the Nth index
1616
- // MDCTabScroller.scrollTo() will never scroll past the max possible value
1617
- if (index === this.adapter.getTabListLength() - 1) {
1618
- this.adapter.scrollTo(this.adapter.getScrollContentWidth());
1619
- return;
1620
- }
1621
- if (this.isRTL()) {
1622
- this.scrollIntoViewImplRTL(index);
1623
- return;
1624
- }
1625
- this.scrollIntoViewImpl(index);
1626
- };
1627
- /**
1628
- * Private method for determining the index of the destination tab based on what key was pressed
1629
- * @param origin The original index from which to determine the destination
1630
- * @param key The name of the key
1631
- */
1632
- MDCTabBarFoundation.prototype.determineTargetFromKey = function (origin, key) {
1633
- var isRTL = this.isRTL();
1634
- var maxIndex = this.adapter.getTabListLength() - 1;
1635
- var shouldGoToEnd = key === strings$1.END_KEY;
1636
- var shouldDecrement = key === strings$1.ARROW_LEFT_KEY && !isRTL || key === strings$1.ARROW_RIGHT_KEY && isRTL;
1637
- var shouldIncrement = key === strings$1.ARROW_RIGHT_KEY && !isRTL || key === strings$1.ARROW_LEFT_KEY && isRTL;
1638
- var index = origin;
1639
- if (shouldGoToEnd) {
1640
- index = maxIndex;
1641
- }
1642
- else if (shouldDecrement) {
1643
- index -= 1;
1644
- }
1645
- else if (shouldIncrement) {
1646
- index += 1;
1647
- }
1648
- else {
1649
- index = 0;
1650
- }
1651
- if (index < 0) {
1652
- index = maxIndex;
1653
- }
1654
- else if (index > maxIndex) {
1655
- index = 0;
1656
- }
1657
- return index;
1658
- };
1659
- /**
1660
- * Calculates the scroll increment that will make the tab at the given index visible
1661
- * @param index The index of the tab
1662
- * @param nextIndex The index of the next tab
1663
- * @param scrollPosition The current scroll position
1664
- * @param barWidth The width of the Tab Bar
1665
- */
1666
- MDCTabBarFoundation.prototype.calculateScrollIncrement = function (index, nextIndex, scrollPosition, barWidth) {
1667
- var nextTabDimensions = this.adapter.getTabDimensionsAtIndex(nextIndex);
1668
- var relativeContentLeft = nextTabDimensions.contentLeft - scrollPosition - barWidth;
1669
- var relativeContentRight = nextTabDimensions.contentRight - scrollPosition;
1670
- var leftIncrement = relativeContentRight - numbers.EXTRA_SCROLL_AMOUNT;
1671
- var rightIncrement = relativeContentLeft + numbers.EXTRA_SCROLL_AMOUNT;
1672
- if (nextIndex < index) {
1673
- return Math.min(leftIncrement, 0);
1674
- }
1675
- return Math.max(rightIncrement, 0);
1676
- };
1677
- /**
1678
- * Calculates the scroll increment that will make the tab at the given index visible in RTL
1679
- * @param index The index of the tab
1680
- * @param nextIndex The index of the next tab
1681
- * @param scrollPosition The current scroll position
1682
- * @param barWidth The width of the Tab Bar
1683
- * @param scrollContentWidth The width of the scroll content
1684
- */
1685
- MDCTabBarFoundation.prototype.calculateScrollIncrementRTL = function (index, nextIndex, scrollPosition, barWidth, scrollContentWidth) {
1686
- var nextTabDimensions = this.adapter.getTabDimensionsAtIndex(nextIndex);
1687
- var relativeContentLeft = scrollContentWidth - nextTabDimensions.contentLeft - scrollPosition;
1688
- var relativeContentRight = scrollContentWidth - nextTabDimensions.contentRight - scrollPosition - barWidth;
1689
- var leftIncrement = relativeContentRight + numbers.EXTRA_SCROLL_AMOUNT;
1690
- var rightIncrement = relativeContentLeft - numbers.EXTRA_SCROLL_AMOUNT;
1691
- if (nextIndex > index) {
1692
- return Math.max(leftIncrement, 0);
1693
- }
1694
- return Math.min(rightIncrement, 0);
1695
- };
1696
- /**
1697
- * Determines the index of the adjacent tab closest to either edge of the Tab Bar
1698
- * @param index The index of the tab
1699
- * @param tabDimensions The dimensions of the tab
1700
- * @param scrollPosition The current scroll position
1701
- * @param barWidth The width of the tab bar
1702
- */
1703
- MDCTabBarFoundation.prototype.findAdjacentTabIndexClosestToEdge = function (index, tabDimensions, scrollPosition, barWidth) {
1704
- /**
1705
- * Tabs are laid out in the Tab Scroller like this:
1706
- *
1707
- * Scroll Position
1708
- * +---+
1709
- * | | Bar Width
1710
- * | +-----------------------------------+
1711
- * | | |
1712
- * | V V
1713
- * | +-----------------------------------+
1714
- * V | Tab Scroller |
1715
- * +------------+--------------+-------------------+
1716
- * | Tab | Tab | Tab |
1717
- * +------------+--------------+-------------------+
1718
- * | |
1719
- * +-----------------------------------+
1720
- *
1721
- * To determine the next adjacent index, we look at the Tab root left and
1722
- * Tab root right, both relative to the scroll position. If the Tab root
1723
- * left is less than 0, then we know it's out of view to the left. If the
1724
- * Tab root right minus the bar width is greater than 0, we know the Tab is
1725
- * out of view to the right. From there, we either increment or decrement
1726
- * the index.
1727
- */
1728
- var relativeRootLeft = tabDimensions.rootLeft - scrollPosition;
1729
- var relativeRootRight = tabDimensions.rootRight - scrollPosition - barWidth;
1730
- var relativeRootDelta = relativeRootLeft + relativeRootRight;
1731
- var leftEdgeIsCloser = relativeRootLeft < 0 || relativeRootDelta < 0;
1732
- var rightEdgeIsCloser = relativeRootRight > 0 || relativeRootDelta > 0;
1733
- if (leftEdgeIsCloser) {
1734
- return index - 1;
1735
- }
1736
- if (rightEdgeIsCloser) {
1737
- return index + 1;
1738
- }
1739
- return -1;
1740
- };
1741
- /**
1742
- * Determines the index of the adjacent tab closest to either edge of the Tab Bar in RTL
1743
- * @param index The index of the tab
1744
- * @param tabDimensions The dimensions of the tab
1745
- * @param scrollPosition The current scroll position
1746
- * @param barWidth The width of the tab bar
1747
- * @param scrollContentWidth The width of the scroller content
1748
- */
1749
- MDCTabBarFoundation.prototype.findAdjacentTabIndexClosestToEdgeRTL = function (index, tabDimensions, scrollPosition, barWidth, scrollContentWidth) {
1750
- var rootLeft = scrollContentWidth - tabDimensions.rootLeft - barWidth - scrollPosition;
1751
- var rootRight = scrollContentWidth - tabDimensions.rootRight - scrollPosition;
1752
- var rootDelta = rootLeft + rootRight;
1753
- var leftEdgeIsCloser = rootLeft > 0 || rootDelta > 0;
1754
- var rightEdgeIsCloser = rootRight < 0 || rootDelta < 0;
1755
- if (leftEdgeIsCloser) {
1756
- return index + 1;
1757
- }
1758
- if (rightEdgeIsCloser) {
1759
- return index - 1;
1760
- }
1761
- return -1;
1762
- };
1763
- /**
1764
- * Returns the key associated with a keydown event
1765
- * @param evt The keydown event
1766
- */
1767
- MDCTabBarFoundation.prototype.getKeyFromEvent = function (evt) {
1768
- if (ACCEPTABLE_KEYS.has(evt.key)) {
1769
- return evt.key;
1770
- }
1771
- return KEYCODE_MAP.get(evt.keyCode);
1772
- };
1773
- MDCTabBarFoundation.prototype.isActivationKey = function (key) {
1774
- return key === strings$1.SPACE_KEY || key === strings$1.ENTER_KEY;
1775
- };
1776
- /**
1777
- * Returns whether a given index is inclusively between the ends
1778
- * @param index The index to test
1779
- */
1780
- MDCTabBarFoundation.prototype.indexIsInRange = function (index) {
1781
- return index >= 0 && index < this.adapter.getTabListLength();
1782
- };
1783
- /**
1784
- * Returns the view's RTL property
1785
- */
1786
- MDCTabBarFoundation.prototype.isRTL = function () {
1787
- return this.adapter.isRTL();
1788
- };
1789
- /**
1790
- * Scrolls the tab at the given index into view for left-to-right user agents.
1791
- * @param index The index of the tab to scroll into view
1792
- */
1793
- MDCTabBarFoundation.prototype.scrollIntoViewImpl = function (index) {
1794
- var scrollPosition = this.adapter.getScrollPosition();
1795
- var barWidth = this.adapter.getOffsetWidth();
1796
- var tabDimensions = this.adapter.getTabDimensionsAtIndex(index);
1797
- var nextIndex = this.findAdjacentTabIndexClosestToEdge(index, tabDimensions, scrollPosition, barWidth);
1798
- if (!this.indexIsInRange(nextIndex)) {
1799
- return;
1800
- }
1801
- var scrollIncrement = this.calculateScrollIncrement(index, nextIndex, scrollPosition, barWidth);
1802
- this.adapter.incrementScroll(scrollIncrement);
1803
- };
1804
- /**
1805
- * Scrolls the tab at the given index into view in RTL
1806
- * @param index The tab index to make visible
1807
- */
1808
- MDCTabBarFoundation.prototype.scrollIntoViewImplRTL = function (index) {
1809
- var scrollPosition = this.adapter.getScrollPosition();
1810
- var barWidth = this.adapter.getOffsetWidth();
1811
- var tabDimensions = this.adapter.getTabDimensionsAtIndex(index);
1812
- var scrollWidth = this.adapter.getScrollContentWidth();
1813
- var nextIndex = this.findAdjacentTabIndexClosestToEdgeRTL(index, tabDimensions, scrollPosition, barWidth, scrollWidth);
1814
- if (!this.indexIsInRange(nextIndex)) {
1815
- return;
1816
- }
1817
- var scrollIncrement = this.calculateScrollIncrementRTL(index, nextIndex, scrollPosition, barWidth, scrollWidth);
1818
- this.adapter.incrementScroll(scrollIncrement);
1819
- };
1820
- return MDCTabBarFoundation;
1821
- }(ponyfill.MDCFoundation));
1822
-
230
+ return findReachable(count, 0, 1, false, canMoveTo);
231
+ }
232
+ function isWithin(index, count) {
233
+ return index >= 0 && index < count;
234
+ }
235
+ function createReachableTest(items, options) {
236
+ return (index) => { var _a; return !((_a = options === null || options === void 0 ? void 0 : options.isDisabled) === null || _a === void 0 ? void 0 : _a.call(options, items[index])); };
237
+ }
1823
238
  /**
1824
- * @license
1825
- * Copyright 2018 Google Inc.
1826
- *
1827
- * Permission is hereby granted, free of charge, to any person obtaining a copy
1828
- * of this software and associated documentation files (the "Software"), to deal
1829
- * in the Software without restriction, including without limitation the rights
1830
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
1831
- * copies of the Software, and to permit persons to whom the Software is
1832
- * furnished to do so, subject to the following conditions:
1833
- *
1834
- * The above copyright notice and this permission notice shall be included in
1835
- * all copies or substantial portions of the Software.
1836
- *
1837
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1838
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1839
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1840
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1841
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1842
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
1843
- * THE SOFTWARE.
239
+ * Look for an item that can be moved to, one item at a time.
240
+ *
241
+ * @param count - the number of items
242
+ * @param start - the index to start looking at
243
+ * @param step - the direction to look in, `1` for forward and `-1` for back
244
+ * @param wrap - whether to continue at the other end, instead of giving up at
245
+ * the end of the items. Every item is looked at once at most.
246
+ * @param canMoveTo - tells whether the item at an index can be moved to
247
+ * @returns the index of the first item that can be moved to, or
248
+ * `NO_NAVIGATION_TARGET` when there is none
1844
249
  */
1845
- var strings = MDCTabBarFoundation.strings;
1846
- var tabIdCounter = 0;
1847
- var MDCTabBar = /** @class */ (function (_super) {
1848
- ponyfill.__extends(MDCTabBar, _super);
1849
- function MDCTabBar() {
1850
- return _super !== null && _super.apply(this, arguments) || this;
1851
- }
1852
- MDCTabBar.attachTo = function (root) {
1853
- return new MDCTabBar(root);
1854
- };
1855
- Object.defineProperty(MDCTabBar.prototype, "focusOnActivate", {
1856
- set: function (focusOnActivate) {
1857
- var e_1, _a;
1858
- try {
1859
- for (var _b = ponyfill.__values(this.tabList), _c = _b.next(); !_c.done; _c = _b.next()) {
1860
- var tab = _c.value;
1861
- tab.focusOnActivate = focusOnActivate;
1862
- }
1863
- }
1864
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
1865
- finally {
1866
- try {
1867
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
1868
- }
1869
- finally { if (e_1) throw e_1.error; }
1870
- }
1871
- },
1872
- enumerable: false,
1873
- configurable: true
1874
- });
1875
- Object.defineProperty(MDCTabBar.prototype, "useAutomaticActivation", {
1876
- set: function (useAutomaticActivation) {
1877
- this.foundation.setUseAutomaticActivation(useAutomaticActivation);
1878
- },
1879
- enumerable: false,
1880
- configurable: true
1881
- });
1882
- MDCTabBar.prototype.initialize = function (tabFactory, tabScrollerFactory) {
1883
- if (tabFactory === void 0) { tabFactory = function (el) { return new MDCTab(el); }; }
1884
- if (tabScrollerFactory === void 0) { tabScrollerFactory = function (el) { return new MDCTabScroller(el); }; }
1885
- this.tabList = this.instantiateTabs(tabFactory);
1886
- this.tabScroller = this.instantiatetabScroller(tabScrollerFactory);
1887
- };
1888
- MDCTabBar.prototype.initialSyncWithDOM = function () {
1889
- var _this = this;
1890
- this.handleTabInteraction = function (evt) {
1891
- _this.foundation.handleTabInteraction(evt);
1892
- };
1893
- this.handleKeyDown = function (evt) {
1894
- _this.foundation.handleKeyDown(evt);
1895
- };
1896
- this.listen(MDCTabFoundation.strings.INTERACTED_EVENT, this.handleTabInteraction);
1897
- this.listen('keydown', this.handleKeyDown);
1898
- for (var i = 0; i < this.tabList.length; i++) {
1899
- if (this.tabList[i].active) {
1900
- this.scrollIntoView(i);
1901
- break;
1902
- }
250
+ function findReachable(count, start, step, wrap, canMoveTo) {
251
+ for (let distance = 0; distance < count; distance += 1) {
252
+ const position = start + step * distance;
253
+ if (!wrap && !isWithin(position, count)) {
254
+ break;
1903
255
  }
1904
- };
1905
- MDCTabBar.prototype.destroy = function () {
1906
- var e_2, _a;
1907
- _super.prototype.destroy.call(this);
1908
- this.unlisten(MDCTabFoundation.strings.INTERACTED_EVENT, this.handleTabInteraction);
1909
- this.unlisten('keydown', this.handleKeyDown);
1910
- try {
1911
- for (var _b = ponyfill.__values(this.tabList), _c = _b.next(); !_c.done; _c = _b.next()) {
1912
- var tab = _c.value;
1913
- tab.destroy();
1914
- }
256
+ const index = ((position % count) + count) % count;
257
+ if (canMoveTo(index)) {
258
+ return index;
1915
259
  }
1916
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
1917
- finally {
1918
- try {
1919
- if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
1920
- }
1921
- finally { if (e_2) throw e_2.error; }
1922
- }
1923
- if (this.tabScroller) {
1924
- this.tabScroller.destroy();
1925
- }
1926
- };
1927
- MDCTabBar.prototype.getDefaultFoundation = function () {
1928
- var _this = this;
1929
- // DO NOT INLINE this variable. For backward compatibility, foundations take a Partial<MDCFooAdapter>.
1930
- // To ensure we don't accidentally omit any methods, we need a separate, strongly typed adapter variable.
1931
- // tslint:disable:object-literal-sort-keys Methods should be in the same order as the adapter interface.
1932
- var adapter = {
1933
- scrollTo: function (scrollX) {
1934
- _this.tabScroller.scrollTo(scrollX);
1935
- },
1936
- incrementScroll: function (scrollXIncrement) {
1937
- _this.tabScroller.incrementScroll(scrollXIncrement);
1938
- },
1939
- getScrollPosition: function () { return _this.tabScroller.getScrollPosition(); },
1940
- getScrollContentWidth: function () { return _this.tabScroller.getScrollContentWidth(); },
1941
- getOffsetWidth: function () { return _this.root.offsetWidth; },
1942
- isRTL: function () { return window.getComputedStyle(_this.root).getPropertyValue('direction') === 'rtl'; },
1943
- setActiveTab: function (index) {
1944
- _this.foundation.activateTab(index);
1945
- },
1946
- activateTabAtIndex: function (index, clientRect) {
1947
- _this.tabList[index].activate(clientRect);
1948
- },
1949
- deactivateTabAtIndex: function (index) {
1950
- _this.tabList[index].deactivate();
1951
- },
1952
- focusTabAtIndex: function (index) {
1953
- _this.tabList[index].focus();
1954
- },
1955
- getTabIndicatorClientRectAtIndex: function (index) {
1956
- return _this.tabList[index].computeIndicatorClientRect();
1957
- },
1958
- getTabDimensionsAtIndex: function (index) {
1959
- return _this.tabList[index].computeDimensions();
1960
- },
1961
- getPreviousActiveTabIndex: function () {
1962
- for (var i = 0; i < _this.tabList.length; i++) {
1963
- if (_this.tabList[i].active) {
1964
- return i;
1965
- }
1966
- }
1967
- return -1;
1968
- },
1969
- getFocusedTabIndex: function () {
1970
- var tabElements = _this.getTabElements();
1971
- var activeElement = document.activeElement;
1972
- return tabElements.indexOf(activeElement);
1973
- },
1974
- getIndexOfTabById: function (id) {
1975
- for (var i = 0; i < _this.tabList.length; i++) {
1976
- if (_this.tabList[i].id === id) {
1977
- return i;
1978
- }
1979
- }
1980
- return -1;
1981
- },
1982
- getTabListLength: function () { return _this.tabList.length; },
1983
- notifyTabActivated: function (index) { return _this.emit(strings.TAB_ACTIVATED_EVENT, { index: index }, true); },
1984
- };
1985
- // tslint:enable:object-literal-sort-keys
1986
- return new MDCTabBarFoundation(adapter);
1987
- };
1988
- /**
1989
- * Activates the tab at the given index
1990
- * @param index The index of the tab
1991
- */
1992
- MDCTabBar.prototype.activateTab = function (index) {
1993
- this.foundation.activateTab(index);
1994
- };
1995
- /**
1996
- * Scrolls the tab at the given index into view
1997
- * @param index THe index of the tab
1998
- */
1999
- MDCTabBar.prototype.scrollIntoView = function (index) {
2000
- this.foundation.scrollIntoView(index);
2001
- };
2002
- /**
2003
- * Returns all the tab elements in a nice clean array
2004
- */
2005
- MDCTabBar.prototype.getTabElements = function () {
2006
- return [].slice.call(this.root.querySelectorAll(strings.TAB_SELECTOR));
2007
- };
2008
- /**
2009
- * Instantiates tab components on all child tab elements
2010
- */
2011
- MDCTabBar.prototype.instantiateTabs = function (tabFactory) {
2012
- return this.getTabElements().map(function (el) {
2013
- el.id = el.id || "mdc-tab-" + ++tabIdCounter;
2014
- return tabFactory(el);
2015
- });
2016
- };
2017
- /**
2018
- * Instantiates tab scroller component on the child tab scroller element
2019
- */
2020
- MDCTabBar.prototype.instantiatetabScroller = function (tabScrollerFactory) {
2021
- var tabScrollerElement = this.root.querySelector(strings.TAB_SCROLLER_SELECTOR);
2022
- if (tabScrollerElement) {
2023
- return tabScrollerFactory(tabScrollerElement);
2024
- }
2025
- return null;
2026
- };
2027
- return MDCTabBar;
2028
- }(ponyfill.MDCComponent));
2029
-
2030
- /**
2031
- * Set a tabs `active` state to true in a list of tabs. The previous tab with
2032
- * `active` set to true will have it set to `false` instead.
2033
- *
2034
- * @param tabs - list of tabs
2035
- * @param index - the index of the tab to set to active
2036
- * @returns a copy of the list of tabs with the changed tabs replaced
2037
- */
2038
- function setActiveTab(tabs, index) {
2039
- const oldSelectedTabIndex = tabs.findIndex((t) => t.active === true);
2040
- const result = [...tabs];
2041
- if (oldSelectedTabIndex !== -1) {
2042
- result[oldSelectedTabIndex] = Object.assign(Object.assign({}, tabs[oldSelectedTabIndex]), { active: false });
2043
260
  }
2044
- result[index] = Object.assign(Object.assign({}, tabs[index]), { active: true });
2045
- return result;
261
+ return NO_NAVIGATION_TARGET;
2046
262
  }
2047
263
 
2048
- const tabBarCss = () => `@charset "UTF-8";.scroll-fade,.scroll-button{position:absolute;transition-property:transform;transition-duration:0.3s;transition-timing-function:ease-out}.scroll-fade{top:0;height:100%;width:4rem;pointer-events:none}.scroll-fade.left{transform:translate3d(-4rem, 0, 0);left:0;background:linear-gradient(270deg, rgba(var(--limel-tab-background-color), 0) 0%, rgba(var(--limel-tab-background-color), 0.8) 40%, rgba(var(--limel-tab-background-color), 0.8) 100%)}.scroll-fade.right{transform:translate3d(4rem, 0, 0);right:0;background:linear-gradient(90deg, rgba(var(--limel-tab-background-color), 0) 0%, rgba(var(--limel-tab-background-color), 0.8) 40%, rgba(var(--limel-tab-background-color), 0.8) 100%)}.scroll-button{display:flex;align-items:center;top:0;bottom:0}.scroll-button.left{transform:translate3d(-4rem, 0, 0);left:0.25rem}.scroll-button.right{transform:translate3d(4rem, 0, 0);right:0.25rem}.scroll-button:hover{transform:translate3d(0, 0, 0)}.scroll-button button{appearance:none;background:none;border:none;padding:0;margin:0;font:inherit;color:inherit;text-align:inherit;display:flex;align-items:center;justify-content:center;width:1.25rem;height:calc(100% - 0.25rem * 2);border-radius:0.25rem}.scroll-button button:not(:disabled){transition:color var(--limel-clickable-transition-speed, 0.4s) ease, background-color var(--limel-clickable-transition-speed, 0.4s) ease, box-shadow var(--limel-clickable-transform-speed, 0.4s) ease, transform var(--limel-clickable-transform-speed, 0.4s) var(--limel-clickable-transform-timing-function, ease);cursor:pointer;color:var(--limel-theme-on-surface-color);background-color:var(--lime-elevated-surface-background-color);box-shadow:var(--button-shadow-normal)}.scroll-button button:not(:disabled):hover,.scroll-button button:not(:disabled):focus,.scroll-button button:not(:disabled):focus-visible{will-change:color, background-color, box-shadow, transform}.scroll-button button:not(:disabled):hover,.scroll-button button:not(:disabled):focus-visible{transform:translate3d(0, -0.04rem, 0);color:var(--limel-theme-on-surface-color);background-color:var(--lime-elevated-surface-background-color);box-shadow:var(--button-shadow-hovered)}.scroll-button button:not(:disabled):active{--limel-clickable-transform-timing-function:cubic-bezier( 0.83, -0.15, 0.49, 1.16 );transform:translate3d(0, 0.05rem, 0);box-shadow:var(--button-shadow-pressed)}.scroll-button button:not(:disabled):hover,.scroll-button button:not(:disabled):active{--limel-clickable-transition-speed:0.2s;--limel-clickable-transform-speed:0.16s}.scroll-button limel-icon{width:1rem}.mdc-tab-scroller{position:relative;overflow:hidden}.mdc-tab-scroller.can-scroll-left .scroll-fade.left,.mdc-tab-scroller.can-scroll-left .scroll-button.left,.mdc-tab-scroller.can-scroll-right .scroll-fade.right,.mdc-tab-scroller.can-scroll-right .scroll-button.right{transform:translate3d(0, 0, 0)}.mdc-tab-scroller.can-scroll-left:not(.can-scroll-right) .scroll-button.right,.mdc-tab-scroller.can-scroll-right:not(.can-scroll-left) .scroll-button.left{opacity:0.5;transition-delay:0.5s}.lime-hide-scrollbars{scrollbar-width:none;-ms-overflow-style:none}.mdc-tab-scroller__scroll-content{padding:0.25rem var(--limel-tab-active-outer-edge-curve-size) 0 var(--limel-tab-active-outer-edge-curve-size);background-color:rgb(var(--limel-tab-background-color))}.mdc-tab-bar{width:100%}.mdc-tab{height:48px}.mdc-tab--stacked{height:72px}.mdc-tab-scroller.mdc-tab-scroller--animating .mdc-tab-scroller__scroll-content{transition:250ms transform cubic-bezier(0.4, 0, 0.2, 1)}.mdc-tab-scroller{overflow-y:hidden}.mdc-tab-scroller__test{position:absolute;top:-9999px;width:100px;height:100px;overflow-x:scroll}.mdc-tab-scroller__scroll-area{-webkit-overflow-scrolling:touch;display:flex;overflow-x:hidden}.mdc-tab-scroller__scroll-area::-webkit-scrollbar,.mdc-tab-scroller__test::-webkit-scrollbar{display:none}.mdc-tab-scroller__scroll-area--scroll{overflow-x:scroll}.mdc-tab-scroller__scroll-content{position:relative;display:flex;flex:1 0 auto;transform:none;will-change:transform}.mdc-tab-scroller--align-start .mdc-tab-scroller__scroll-content{justify-content:flex-start}.mdc-tab-scroller--align-end .mdc-tab-scroller__scroll-content{justify-content:flex-end}.mdc-tab-scroller--align-center .mdc-tab-scroller__scroll-content{justify-content:center}.mdc-tab-scroller--animating .mdc-tab-scroller__scroll-area{-webkit-overflow-scrolling:auto}.mdc-tab-indicator .mdc-tab-indicator__content--underline{border-color:#6200ee;border-color:var(--mdc-theme-primary, #6200ee)}.mdc-tab-indicator .mdc-tab-indicator__content--icon{color:#018786;color:var(--mdc-theme-secondary, #018786)}.mdc-tab-indicator .mdc-tab-indicator__content--underline{border-top-width:2px}.mdc-tab-indicator .mdc-tab-indicator__content--icon{height:34px;font-size:34px}.mdc-tab-indicator{display:flex;position:absolute;top:0;left:0;justify-content:center;width:100%;height:100%;pointer-events:none;z-index:1}.mdc-tab-indicator__content{transform-origin:left;opacity:0}.mdc-tab-indicator__content--underline{align-self:flex-end;box-sizing:border-box;width:100%;border-top-style:solid}.mdc-tab-indicator__content--icon{align-self:center;margin:0 auto}.mdc-tab-indicator--active .mdc-tab-indicator__content{opacity:1}.mdc-tab-indicator .mdc-tab-indicator__content{transition:250ms transform cubic-bezier(0.4, 0, 0.2, 1)}.mdc-tab-indicator--no-transition .mdc-tab-indicator__content{transition:none}.mdc-tab-indicator--fade .mdc-tab-indicator__content{transition:150ms opacity linear}.mdc-tab-indicator--active.mdc-tab-indicator--fade .mdc-tab-indicator__content{transition-delay:100ms}.mdc-tab{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;font-family:Roboto, sans-serif;font-family:var(--mdc-typography-button-font-family, var(--mdc-typography-font-family, Roboto, sans-serif));font-size:0.875rem;font-size:var(--mdc-typography-button-font-size, 0.875rem);line-height:2.25rem;line-height:var(--mdc-typography-button-line-height, 2.25rem);font-weight:500;font-weight:var(--mdc-typography-button-font-weight, 500);letter-spacing:0.0892857143em;letter-spacing:var(--mdc-typography-button-letter-spacing, 0.0892857143em);text-decoration:none;text-decoration:var(--mdc-typography-button-text-decoration, none);text-transform:uppercase;text-transform:var(--mdc-typography-button-text-transform, uppercase)}.mdc-tab .mdc-tab__text-label{color:rgba(0, 0, 0, 0.6)}.mdc-tab .mdc-tab__icon{color:rgba(0, 0, 0, 0.54);fill:currentColor}.mdc-tab{position:relative}.mdc-tab__content{position:relative}.mdc-tab__icon{width:24px;height:24px;font-size:24px}.mdc-tab--active .mdc-tab__text-label{color:#6200ee;color:var(--mdc-theme-primary, #6200ee)}.mdc-tab--active .mdc-tab__icon{color:#6200ee;color:var(--mdc-theme-primary, #6200ee);fill:currentColor}.mdc-tab{background:none}.mdc-tab{min-width:90px;padding-right:24px;padding-left:24px;display:flex;flex:1 0 auto;justify-content:center;box-sizing:border-box;margin:0;padding-top:0;padding-bottom:0;border:none;outline:none;text-align:center;white-space:nowrap;cursor:pointer;-webkit-appearance:none;z-index:1}.mdc-tab::-moz-focus-inner{padding:0;border:0}.mdc-tab--min-width{flex:0 1 auto}.mdc-tab__content{display:flex;align-items:center;justify-content:center;height:inherit;pointer-events:none}.mdc-tab__text-label{transition:150ms color linear;display:inline-block;line-height:1;z-index:2}.mdc-tab__icon{transition:150ms color linear;z-index:2}.mdc-tab--stacked .mdc-tab__content{flex-direction:column;align-items:center;justify-content:center}.mdc-tab--stacked .mdc-tab__text-label{padding-top:6px;padding-bottom:4px}.mdc-tab--active .mdc-tab__text-label,.mdc-tab--active .mdc-tab__icon{transition-delay:100ms}.mdc-tab:not(.mdc-tab--stacked) .mdc-tab__icon+.mdc-tab__text-label{padding-left:8px;padding-right:0}[dir=rtl] .mdc-tab:not(.mdc-tab--stacked) .mdc-tab__icon+.mdc-tab__text-label,.mdc-tab:not(.mdc-tab--stacked) .mdc-tab__icon+.mdc-tab__text-label[dir=rtl]{padding-left:0;padding-right:8px;}@keyframes mdc-ripple-fg-radius-in{from{animation-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transform:translate(var(--mdc-ripple-fg-translate-start, 0)) scale(1)}to{transform:translate(var(--mdc-ripple-fg-translate-end, 0)) scale(var(--mdc-ripple-fg-scale, 1))}}@keyframes mdc-ripple-fg-opacity-in{from{animation-timing-function:linear;opacity:0}to{opacity:var(--mdc-ripple-fg-opacity, 0)}}@keyframes mdc-ripple-fg-opacity-out{from{animation-timing-function:linear;opacity:var(--mdc-ripple-fg-opacity, 0)}to{opacity:0}}.mdc-tab{--mdc-ripple-fg-size:0;--mdc-ripple-left:0;--mdc-ripple-top:0;--mdc-ripple-fg-scale:1;--mdc-ripple-fg-translate-end:0;--mdc-ripple-fg-translate-start:0;-webkit-tap-highlight-color:rgba(0, 0, 0, 0)}.mdc-tab .mdc-tab__ripple::before,.mdc-tab .mdc-tab__ripple::after{position:absolute;border-radius:50%;opacity:0;pointer-events:none;content:""}.mdc-tab .mdc-tab__ripple::before{transition:opacity 15ms linear, background-color 15ms linear;z-index:1;z-index:var(--mdc-ripple-z-index, 1)}.mdc-tab .mdc-tab__ripple::after{z-index:0;z-index:var(--mdc-ripple-z-index, 0)}.mdc-tab.mdc-ripple-upgraded .mdc-tab__ripple::before{transform:scale(var(--mdc-ripple-fg-scale, 1))}.mdc-tab.mdc-ripple-upgraded .mdc-tab__ripple::after{top:0;left:0;transform:scale(0);transform-origin:center center}.mdc-tab.mdc-ripple-upgraded--unbounded .mdc-tab__ripple::after{top:var(--mdc-ripple-top, 0);left:var(--mdc-ripple-left, 0)}.mdc-tab.mdc-ripple-upgraded--foreground-activation .mdc-tab__ripple::after{animation:mdc-ripple-fg-radius-in 225ms forwards, mdc-ripple-fg-opacity-in 75ms forwards}.mdc-tab.mdc-ripple-upgraded--foreground-deactivation .mdc-tab__ripple::after{animation:mdc-ripple-fg-opacity-out 150ms;transform:translate(var(--mdc-ripple-fg-translate-end, 0)) scale(var(--mdc-ripple-fg-scale, 1))}.mdc-tab .mdc-tab__ripple::before,.mdc-tab .mdc-tab__ripple::after{top:calc(50% - 100%);left:calc(50% - 100%);width:200%;height:200%}.mdc-tab.mdc-ripple-upgraded .mdc-tab__ripple::after{width:var(--mdc-ripple-fg-size, 100%);height:var(--mdc-ripple-fg-size, 100%)}.mdc-tab .mdc-tab__ripple::before,.mdc-tab .mdc-tab__ripple::after{background-color:#6200ee;background-color:var(--mdc-ripple-color, var(--mdc-theme-primary, #6200ee))}.mdc-tab:hover .mdc-tab__ripple::before,.mdc-tab.mdc-ripple-surface--hover .mdc-tab__ripple::before{opacity:0.04;opacity:var(--mdc-ripple-hover-opacity, 0.04)}.mdc-tab.mdc-ripple-upgraded--background-focused .mdc-tab__ripple::before,.mdc-tab:not(.mdc-ripple-upgraded):focus .mdc-tab__ripple::before{transition-duration:75ms;opacity:0.12;opacity:var(--mdc-ripple-focus-opacity, 0.12)}.mdc-tab:not(.mdc-ripple-upgraded) .mdc-tab__ripple::after{transition:opacity 150ms linear}.mdc-tab:not(.mdc-ripple-upgraded):active .mdc-tab__ripple::after{transition-duration:75ms;opacity:0.12;opacity:var(--mdc-ripple-press-opacity, 0.12)}.mdc-tab.mdc-ripple-upgraded{--mdc-ripple-fg-opacity:var(--mdc-ripple-press-opacity, 0.12)}.mdc-tab__ripple{position:absolute;top:0;left:0;width:100%;height:100%;overflow:hidden;will-change:transform, opacity}:host(limel-tab-bar){--limel-tab-background-color:var(--contrast-300);--limel-tab-border-radius:0.625rem;--limel-active-tab-background-color:var( --tab-panel-background-color, rgb(var(--contrast-100)) );--limel-tab-active-outer-edge-curve-size:0.75rem;--limel-tab-separator-width:0.125rem;--limel-tab-separator-background-color:rgb(var(--contrast-600));isolation:isolate;display:block;position:relative}:host(.has-tabs-with-equal-width) .mdc-tab{flex:1 0 auto}.mdc-tab{font-family:inherit;font-weight:400;letter-spacing:normal;font-size:var(--limel-theme-default-font-size);text-transform:none}.mdc-tab-indicator .mdc-tab-indicator__content{border:none}.mdc-tab__ripple{box-sizing:border-box;border-radius:var(--limel-tab-border-radius);border-style:solid;border-color:transparent;border-width:0.25rem;opacity:0.7}.mdc-tab__ripple:before,.mdc-tab__ripple:after{transition:background-color 0.5s ease}.mdc-tab{border-radius:0;padding-right:1rem;padding-left:1rem;min-width:2.5rem;background-color:transparent;flex:0 0 auto;height:2.5rem}.mdc-tab:not(.mdc-tab--active):after{content:"";display:block;background-color:var(--limel-tab-separator-background-color);width:var(--limel-tab-separator-width);height:1rem;margin:auto;position:absolute;top:0;bottom:0;border-radius:1rem;right:calc(-1 * var(--limel-tab-separator-width))}.mdc-tab:not(.mdc-tab--active):last-of-type:after{display:none}.mdc-tab .mdc-tab__icon{color:rgb(var(--contrast-800));margin-left:-0.25rem}.mdc-tab limel-badge{margin-right:-0.25rem;box-shadow:0 0 0 1px rgb(var(--contrast-600))}.mdc-tab--active{border-radius:var(--limel-tab-border-radius) var(--limel-tab-border-radius) 0 0;background-color:var(--limel-active-tab-background-color);z-index:2}.mdc-tab--active:before,.mdc-tab--active:after{content:"";display:block;width:var(--limel-tab-active-outer-edge-curve-size);height:var(--limel-tab-active-outer-edge-curve-size);position:absolute;bottom:0;background-color:var(--limel-active-tab-background-color);-webkit-mask-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20fill-rule='evenodd'%20stroke-linejoin='round'%20stroke-miterlimit='2'%20clip-rule='evenodd'%20viewBox='0%200%2050%2050'%3E%3Cdefs/%3E%3Cpath%20d='M0%200c0%2027.594%2022.406%2050%2050%2050H0V0z'/%3E%3C/svg%3E");mask-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20fill-rule='evenodd'%20stroke-linejoin='round'%20stroke-miterlimit='2'%20clip-rule='evenodd'%20viewBox='0%200%2050%2050'%3E%3Cdefs/%3E%3Cpath%20d='M0%200c0%2027.594%2022.406%2050%2050%2050H0V0z'/%3E%3C/svg%3E")}.mdc-tab--active:before{left:calc(-1 * var(--limel-tab-active-outer-edge-curve-size));transform:rotateY(180deg)}.mdc-tab--active:after{right:calc(-1 * var(--limel-tab-active-outer-edge-curve-size))}.mdc-tab--active .mdc-ripple-upgraded--background-focused:before{background-color:transparent;transition:background-color 1s ease}.mdc-tab--active .mdc-tab__icon{color:var(--mdc-theme-primary)}.mdc-tab__content{gap:0.375rem}.mdc-tab .mdc-tab__text-label{transition:color 0.2s ease;padding-left:0 !important;color:var(--limel-theme-on-surface-color)}.mdc-tab:hover .mdc-tab__text-label{color:var(--limel-theme-text-primary-on-background-color)}.mdc-tab.mdc-tab--active .mdc-tab__text-label{color:var(--lime-primary-color, var(--limel-theme-primary-color))}`;
264
+ const tabBarCss = () => `.mdc-tab-bar{width:100%}.mdc-tab{height:48px}.mdc-tab--stacked{height:72px}.mdc-tab-indicator .mdc-tab-indicator__content--underline{border-color:#6200ee;border-color:var(--mdc-theme-primary, #6200ee)}.mdc-tab-indicator .mdc-tab-indicator__content--icon{color:#018786;color:var(--mdc-theme-secondary, #018786)}.mdc-tab-indicator .mdc-tab-indicator__content--underline{border-top-width:2px}.mdc-tab-indicator .mdc-tab-indicator__content--icon{height:34px;font-size:34px}.mdc-tab-indicator{display:flex;position:absolute;top:0;left:0;justify-content:center;width:100%;height:100%;pointer-events:none;z-index:1}.mdc-tab-indicator__content{transform-origin:left;opacity:0}.mdc-tab-indicator__content--underline{align-self:flex-end;box-sizing:border-box;width:100%;border-top-style:solid}.mdc-tab-indicator__content--icon{align-self:center;margin:0 auto}.mdc-tab-indicator--active .mdc-tab-indicator__content{opacity:1}.mdc-tab-indicator .mdc-tab-indicator__content{transition:250ms transform cubic-bezier(0.4, 0, 0.2, 1)}.mdc-tab-indicator--no-transition .mdc-tab-indicator__content{transition:none}.mdc-tab-indicator--fade .mdc-tab-indicator__content{transition:150ms opacity linear}.mdc-tab-indicator--active.mdc-tab-indicator--fade .mdc-tab-indicator__content{transition-delay:100ms}.mdc-tab{-moz-osx-font-smoothing:grayscale;-webkit-font-smoothing:antialiased;font-family:Roboto, sans-serif;font-family:var(--mdc-typography-button-font-family, var(--mdc-typography-font-family, Roboto, sans-serif));font-size:0.875rem;font-size:var(--mdc-typography-button-font-size, 0.875rem);line-height:2.25rem;line-height:var(--mdc-typography-button-line-height, 2.25rem);font-weight:500;font-weight:var(--mdc-typography-button-font-weight, 500);letter-spacing:0.0892857143em;letter-spacing:var(--mdc-typography-button-letter-spacing, 0.0892857143em);text-decoration:none;text-decoration:var(--mdc-typography-button-text-decoration, none);text-transform:uppercase;text-transform:var(--mdc-typography-button-text-transform, uppercase)}.mdc-tab .mdc-tab__text-label{color:rgba(0, 0, 0, 0.6)}.mdc-tab .mdc-tab__icon{color:rgba(0, 0, 0, 0.54);fill:currentColor}.mdc-tab{position:relative}.mdc-tab__content{position:relative}.mdc-tab__icon{width:24px;height:24px;font-size:24px}.mdc-tab--active .mdc-tab__text-label{color:#6200ee;color:var(--mdc-theme-primary, #6200ee)}.mdc-tab--active .mdc-tab__icon{color:#6200ee;color:var(--mdc-theme-primary, #6200ee);fill:currentColor}.mdc-tab{background:none}.mdc-tab{min-width:90px;padding-right:24px;padding-left:24px;display:flex;flex:1 0 auto;justify-content:center;box-sizing:border-box;margin:0;padding-top:0;padding-bottom:0;border:none;outline:none;text-align:center;white-space:nowrap;cursor:pointer;-webkit-appearance:none;z-index:1}.mdc-tab::-moz-focus-inner{padding:0;border:0}.mdc-tab--min-width{flex:0 1 auto}.mdc-tab__content{display:flex;align-items:center;justify-content:center;height:inherit;pointer-events:none}.mdc-tab__text-label{transition:150ms color linear;display:inline-block;line-height:1;z-index:2}.mdc-tab__icon{transition:150ms color linear;z-index:2}.mdc-tab--stacked .mdc-tab__content{flex-direction:column;align-items:center;justify-content:center}.mdc-tab--stacked .mdc-tab__text-label{padding-top:6px;padding-bottom:4px}.mdc-tab--active .mdc-tab__text-label,.mdc-tab--active .mdc-tab__icon{transition-delay:100ms}.mdc-tab:not(.mdc-tab--stacked) .mdc-tab__icon+.mdc-tab__text-label{padding-left:8px;padding-right:0}[dir=rtl] .mdc-tab:not(.mdc-tab--stacked) .mdc-tab__icon+.mdc-tab__text-label,.mdc-tab:not(.mdc-tab--stacked) .mdc-tab__icon+.mdc-tab__text-label[dir=rtl]{padding-left:0;padding-right:8px;}@keyframes mdc-ripple-fg-radius-in{from{animation-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transform:translate(var(--mdc-ripple-fg-translate-start, 0)) scale(1)}to{transform:translate(var(--mdc-ripple-fg-translate-end, 0)) scale(var(--mdc-ripple-fg-scale, 1))}}@keyframes mdc-ripple-fg-opacity-in{from{animation-timing-function:linear;opacity:0}to{opacity:var(--mdc-ripple-fg-opacity, 0)}}@keyframes mdc-ripple-fg-opacity-out{from{animation-timing-function:linear;opacity:var(--mdc-ripple-fg-opacity, 0)}to{opacity:0}}.mdc-tab{--mdc-ripple-fg-size:0;--mdc-ripple-left:0;--mdc-ripple-top:0;--mdc-ripple-fg-scale:1;--mdc-ripple-fg-translate-end:0;--mdc-ripple-fg-translate-start:0;-webkit-tap-highlight-color:rgba(0, 0, 0, 0)}.mdc-tab .mdc-tab__ripple::before,.mdc-tab .mdc-tab__ripple::after{position:absolute;border-radius:50%;opacity:0;pointer-events:none;content:""}.mdc-tab .mdc-tab__ripple::before{transition:opacity 15ms linear, background-color 15ms linear;z-index:1;z-index:var(--mdc-ripple-z-index, 1)}.mdc-tab .mdc-tab__ripple::after{z-index:0;z-index:var(--mdc-ripple-z-index, 0)}.mdc-tab.mdc-ripple-upgraded .mdc-tab__ripple::before{transform:scale(var(--mdc-ripple-fg-scale, 1))}.mdc-tab.mdc-ripple-upgraded .mdc-tab__ripple::after{top:0;left:0;transform:scale(0);transform-origin:center center}.mdc-tab.mdc-ripple-upgraded--unbounded .mdc-tab__ripple::after{top:var(--mdc-ripple-top, 0);left:var(--mdc-ripple-left, 0)}.mdc-tab.mdc-ripple-upgraded--foreground-activation .mdc-tab__ripple::after{animation:mdc-ripple-fg-radius-in 225ms forwards, mdc-ripple-fg-opacity-in 75ms forwards}.mdc-tab.mdc-ripple-upgraded--foreground-deactivation .mdc-tab__ripple::after{animation:mdc-ripple-fg-opacity-out 150ms;transform:translate(var(--mdc-ripple-fg-translate-end, 0)) scale(var(--mdc-ripple-fg-scale, 1))}.mdc-tab .mdc-tab__ripple::before,.mdc-tab .mdc-tab__ripple::after{top:calc(50% - 100%);left:calc(50% - 100%);width:200%;height:200%}.mdc-tab.mdc-ripple-upgraded .mdc-tab__ripple::after{width:var(--mdc-ripple-fg-size, 100%);height:var(--mdc-ripple-fg-size, 100%)}.mdc-tab .mdc-tab__ripple::before,.mdc-tab .mdc-tab__ripple::after{background-color:#6200ee;background-color:var(--mdc-ripple-color, var(--mdc-theme-primary, #6200ee))}.mdc-tab:hover .mdc-tab__ripple::before,.mdc-tab.mdc-ripple-surface--hover .mdc-tab__ripple::before{opacity:0.04;opacity:var(--mdc-ripple-hover-opacity, 0.04)}.mdc-tab.mdc-ripple-upgraded--background-focused .mdc-tab__ripple::before,.mdc-tab:not(.mdc-ripple-upgraded):focus .mdc-tab__ripple::before{transition-duration:75ms;opacity:0.12;opacity:var(--mdc-ripple-focus-opacity, 0.12)}.mdc-tab:not(.mdc-ripple-upgraded) .mdc-tab__ripple::after{transition:opacity 150ms linear}.mdc-tab:not(.mdc-ripple-upgraded):active .mdc-tab__ripple::after{transition-duration:75ms;opacity:0.12;opacity:var(--mdc-ripple-press-opacity, 0.12)}.mdc-tab.mdc-ripple-upgraded{--mdc-ripple-fg-opacity:var(--mdc-ripple-press-opacity, 0.12)}.mdc-tab__ripple{position:absolute;top:0;left:0;width:100%;height:100%;overflow:hidden;will-change:transform, opacity}:host(limel-tab-bar){--limel-tab-background-color:var(--contrast-300);--limel-tab-border-radius:0.625rem;--limel-active-tab-background-color:var( --tab-panel-background-color, rgb(var(--contrast-100)) );--limel-tab-active-outer-edge-curve-size:0.75rem;--limel-tab-separator-width:0.125rem;--limel-tab-separator-background-color:rgb(var(--contrast-600));isolation:isolate;display:block;position:relative}limel-scroller{--limel-scroller-fade-color:var(--limel-tab-background-color);--limel-scroller-content-padding:0.25rem var(--limel-tab-active-outer-edge-curve-size) 0;background-color:rgb(var(--limel-tab-background-color))}:host(.has-tabs-with-equal-width) .mdc-tab{flex:1 0 auto}.mdc-tab{font-family:inherit;font-weight:400;letter-spacing:normal;font-size:var(--limel-theme-default-font-size);text-transform:none}.mdc-tab-indicator .mdc-tab-indicator__content{border:none}.mdc-tab__ripple{box-sizing:border-box;border-radius:var(--limel-tab-border-radius);border-style:solid;border-color:transparent;border-width:0.25rem;opacity:0.7}.mdc-tab__ripple:before,.mdc-tab__ripple:after{transition:background-color 0.5s ease}.mdc-tab{border-radius:0;padding-right:1rem;padding-left:1rem;min-width:2.5rem;background-color:transparent;flex:0 0 auto;height:2.5rem}.mdc-tab:not(.mdc-tab--active):after{content:"";display:block;background-color:var(--limel-tab-separator-background-color);width:var(--limel-tab-separator-width);height:1rem;margin:auto;position:absolute;top:0;bottom:0;border-radius:1rem;right:calc(-1 * var(--limel-tab-separator-width))}.mdc-tab:not(.mdc-tab--active):last-of-type:after{display:none}.mdc-tab .mdc-tab__icon{color:rgb(var(--contrast-800));margin-left:-0.25rem}.mdc-tab limel-badge{margin-right:-0.25rem;box-shadow:0 0 0 1px rgb(var(--contrast-600))}.mdc-tab--active{border-radius:var(--limel-tab-border-radius) var(--limel-tab-border-radius) 0 0;background-color:var(--limel-active-tab-background-color);z-index:2}.mdc-tab--active:before,.mdc-tab--active:after{content:"";display:block;width:var(--limel-tab-active-outer-edge-curve-size);height:var(--limel-tab-active-outer-edge-curve-size);position:absolute;bottom:0;background-color:var(--limel-active-tab-background-color);-webkit-mask-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20fill-rule='evenodd'%20stroke-linejoin='round'%20stroke-miterlimit='2'%20clip-rule='evenodd'%20viewBox='0%200%2050%2050'%3E%3Cdefs/%3E%3Cpath%20d='M0%200c0%2027.594%2022.406%2050%2050%2050H0V0z'/%3E%3C/svg%3E");mask-image:url("data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20fill-rule='evenodd'%20stroke-linejoin='round'%20stroke-miterlimit='2'%20clip-rule='evenodd'%20viewBox='0%200%2050%2050'%3E%3Cdefs/%3E%3Cpath%20d='M0%200c0%2027.594%2022.406%2050%2050%2050H0V0z'/%3E%3C/svg%3E")}.mdc-tab--active:before{left:calc(-1 * var(--limel-tab-active-outer-edge-curve-size));transform:rotateY(180deg)}.mdc-tab--active:after{right:calc(-1 * var(--limel-tab-active-outer-edge-curve-size))}.mdc-tab--active .mdc-ripple-upgraded--background-focused:before{background-color:transparent;transition:background-color 1s ease}.mdc-tab--active .mdc-tab__icon{color:var(--mdc-theme-primary)}.mdc-tab__content{gap:0.375rem}.mdc-tab .mdc-tab__text-label{transition:color 0.2s ease;padding-left:0 !important;color:var(--limel-theme-on-surface-color)}.mdc-tab:hover .mdc-tab__text-label{color:var(--limel-theme-text-primary-on-background-color)}.mdc-tab.mdc-tab--active .mdc-tab__text-label{color:var(--lime-primary-color, var(--limel-theme-primary-color))}`;
2049
265
 
2050
- const { TAB_ACTIVATED_EVENT } = strings$1;
2051
- const SCROLL_DISTANCE_ON_CLICK_PX = 150;
2052
- const HIDE_SCROLL_BUTTONS_WHEN_SCROLLED_LESS_THAN_PX = 40;
2053
- const TOTAL_WIDTH_PERCENTAGE = 100;
2054
- const OVERLAP_PERCENTAGE = 20;
266
+ const NAVIGATION = {
267
+ orientation: 'horizontal',
268
+ wrap: true,
269
+ };
2055
270
  const TabBar = class {
2056
271
  constructor(hostRef) {
2057
272
  index.registerInstance(this, hostRef);
@@ -2060,38 +275,34 @@ const TabBar = class {
2060
275
  * List of tabs to display
2061
276
  */
2062
277
  this.tabs = [];
2063
- this.canScrollLeft = false;
2064
- this.canScrollRight = false;
2065
- this.setupMdc = false;
2066
- this.handleTabActivated = this.handleTabActivated.bind(this);
2067
- this.handleScroll = this.handleScroll.bind(this);
2068
- this.handleLeftScrollClick = this.handleLeftScrollClick.bind(this);
2069
- this.handleRightScrollClick = this.handleRightScrollClick.bind(this);
2070
- this.renderTab = this.renderTab.bind(this);
2071
- }
2072
- connectedCallback() {
2073
- this.setup();
278
+ this.ripples = new Map();
279
+ this.hasLoaded = false;
280
+ this.handleKeyDown = this.handleKeyDown.bind(this);
281
+ }
282
+ async connectedCallback() {
283
+ // Connecting after the first render means that the bar was moved, which
284
+ // resets how far it is scrolled.
285
+ if (!this.hasLoaded) {
286
+ return;
287
+ }
288
+ this.updateRipples();
289
+ this.revealedTabId = undefined;
290
+ await this.revealActiveTab('auto');
2074
291
  }
2075
292
  componentDidLoad() {
2076
- this.setup();
293
+ this.hasLoaded = true;
2077
294
  this.triggerIconColorWarning();
2078
295
  }
2079
- componentDidUpdate() {
2080
- if (!this.setupMdc) {
2081
- return;
2082
- }
2083
- this.setup();
2084
- this.setupMdc = false;
296
+ async componentDidRender() {
297
+ this.updateRipples();
298
+ await this.revealActiveTab(this.hasLoaded ? undefined : 'auto');
2085
299
  }
2086
300
  disconnectedCallback() {
2087
- this.tearDown();
301
+ this.destroyRipples();
2088
302
  }
2089
303
  render() {
2090
- return (index.h("div", { key: 'b0a62a521861357770e12bc6183b9590c49760e0', class: "mdc-tab-bar", role: "tablist" }, index.h("div", { key: '97750d5ded531aee2fca5cd1f129fee4194b8f09', class: {
2091
- 'mdc-tab-scroller': true,
2092
- 'can-scroll-left': this.canScrollLeft,
2093
- 'can-scroll-right': this.canScrollRight,
2094
- } }, index.h("div", { key: '6547764cdcfc4f2f60e510863ede4d58d48b1b0e', class: "mdc-tab-scroller__scroll-area lime-hide-scrollbars" }, index.h("div", { key: 'b95453f5a1fe8b4aae7ebad439cfb795198623a8', class: "mdc-tab-scroller__scroll-content" }, this.tabs.map(this.renderTab))), index.h("div", { key: 'a4703fa681f371d69ab7a6994aa3457c803563bf', class: "scroll-fade left" }), index.h("div", { key: '6599c7035550249f81b5488deda63900363be953', class: "scroll-button left" }, index.h("button", { key: '09a0a7f41a8f0dfe458af7bb719aef0fb0e1b9d7', type: "button", tabindex: "-1", "aria-hidden": "true", disabled: !this.canScrollLeft, onClick: this.handleLeftScrollClick }, index.h("limel-icon", { key: 'dd5f4cf8562fd74148778d5414f98d4c1c949bd0', name: "angle_left" }))), index.h("div", { key: 'b380cf4e3679d35270453b6a8671e7de8d9a92a7', class: "scroll-fade right" }), index.h("div", { key: '3589c3bec4d29eee61da6bc0b293201412bd343f', class: "scroll-button right" }, index.h("button", { key: '8af680e4abefcf6920a602c269f9a937270d70f2', type: "button", tabindex: "-1", "aria-hidden": "true", disabled: !this.canScrollRight, onClick: this.handleRightScrollClick }, index.h("limel-icon", { key: 'be2dcc0f1ba494cce96eab05450ce8c9619981e0', name: "angle_right" }))))));
304
+ const tabStop = findTabStop(this.tabs, this.tabs.findIndex((tab) => tab.active), NAVIGATION);
305
+ return (index.h("div", { key: '7ab809d50e3605613f027a1782d54511e734de93', class: "mdc-tab-bar", role: "tablist", onKeyDown: this.handleKeyDown }, index.h("limel-scroller", { key: 'd6ac2c90e6da77a239292ac0e90288c3e70b62f8' }, this.tabs.map((tab, index) => this.renderTab(tab, index, index === tabStop)))));
2095
306
  }
2096
307
  tabsChanged(newTabs = [], oldTabs = []) {
2097
308
  const newIds = newTabs.map((tab) => tab.id);
@@ -2099,103 +310,91 @@ const TabBar = class {
2099
310
  if (isEqual.isEqual(newIds, oldIds)) {
2100
311
  return;
2101
312
  }
2102
- this.setupMdc = true;
2103
- this.tearDown();
313
+ this.revealedTabId = undefined;
2104
314
  }
2105
- handleWindowResize() {
2106
- if (!this.scrollArea) {
2107
- return;
315
+ getTabElements() {
316
+ return [
317
+ ...this.host.shadowRoot.querySelectorAll('button[role="tab"]'),
318
+ ];
319
+ }
320
+ /**
321
+ * Gives every tab MDC's ripple, which is the feedback when a tab is
322
+ * pressed. Tabs that are gone lose theirs.
323
+ */
324
+ updateRipples() {
325
+ const tabs = this.getTabElements();
326
+ for (const [tab, ripple] of this.ripples) {
327
+ if (tabs.includes(tab)) {
328
+ continue;
329
+ }
330
+ ripple.destroy();
331
+ this.ripples.delete(tab);
332
+ }
333
+ for (const tab of tabs) {
334
+ if (!this.ripples.has(tab)) {
335
+ this.ripples.set(tab, new component.MDCRipple(tab));
336
+ }
2108
337
  }
2109
- this.handleScroll();
2110
338
  }
2111
- setup() {
2112
- const element = this.host.shadowRoot.querySelector('.mdc-tab-bar');
2113
- if (!element) {
2114
- return;
339
+ destroyRipples() {
340
+ for (const ripple of this.ripples.values()) {
341
+ ripple.destroy();
2115
342
  }
2116
- this.mdcTabBar = new MDCTabBar(element);
2117
- this.mdcTabBar.focusOnActivate = true;
2118
- this.mdcTabBar.useAutomaticActivation = true;
2119
- this.scrollArea = element.querySelector('.mdc-tab-scroller__scroll-area');
2120
- this.scrollContent = element.querySelector('.mdc-tab-scroller__scroll-content');
2121
- this.setupListeners();
2122
- // Use timeout to avoid Stencil warning about re-renders. /Ads
2123
- setTimeout(this.handleScroll, 0);
343
+ this.ripples.clear();
2124
344
  }
2125
- tearDown() {
2126
- if (this.scrollArea) {
2127
- this.scrollArea.removeEventListener('scroll', this.handleScroll);
345
+ /**
346
+ * A tab that is activated by the user has focus, and the scroller reveals
347
+ * what has focus. This is for a tab that becomes active without it.
348
+ *
349
+ * @param behavior - `auto` to jump to the tab. Leave it out to let the
350
+ * scroller glide there.
351
+ */
352
+ async revealActiveTab(behavior) {
353
+ const index = this.tabs.findIndex((tab) => tab.active);
354
+ if (index === -1) {
355
+ this.revealedTabId = undefined;
356
+ return;
357
+ }
358
+ if (this.tabs[index].id === this.revealedTabId) {
359
+ return;
2128
360
  }
2129
- if (this.mdcTabBar) {
2130
- this.mdcTabBar.unlisten(TAB_ACTIVATED_EVENT, this.handleTabActivated);
2131
- this.mdcTabBar.destroy();
361
+ this.revealedTabId = this.tabs[index].id;
362
+ const element = this.getTabElements()[index];
363
+ const scroller = this.host.shadowRoot.querySelector('limel-scroller');
364
+ if (!element || !scroller || element.matches(':focus')) {
365
+ return;
2132
366
  }
367
+ await scroller.componentOnReady();
368
+ await scroller.reveal(element, behavior);
2133
369
  }
2134
- setupListeners() {
2135
- this.mdcTabBar.listen(TAB_ACTIVATED_EVENT, this.handleTabActivated);
2136
- this.scrollArea.addEventListener('scroll', this.handleScroll, {
2137
- passive: true,
2138
- });
370
+ handleKeyDown(event) {
371
+ if (!isNavigationKey(event, NAVIGATION)) {
372
+ return;
373
+ }
374
+ event.preventDefault();
375
+ const current = this.getTabElements().indexOf(event.target);
376
+ this.activateTab(findNavigationTarget(this.tabs, event.key, current, NAVIGATION));
2139
377
  }
2140
- handleTabActivated(event) {
2141
- const index = event.detail.index;
378
+ activateTab(index) {
379
+ if (index === NO_NAVIGATION_TARGET) {
380
+ return;
381
+ }
382
+ // Not every browser focuses a button that is clicked, and a key can
383
+ // lead to the selected tab from another tab that has focus.
384
+ this.getTabElements()[index].focus();
385
+ if (index === this.tabs.findIndex((tab) => tab.active)) {
386
+ return;
387
+ }
2142
388
  const newTabs = setActiveTab(this.tabs, index);
2143
- difference(newTabs, this.tabs)
2144
- .sort(this.sortByInactive)
2145
- // eslint-disable-next-line unicorn/no-array-for-each
2146
- .forEach((tab) => {
389
+ const changedTabs = difference(newTabs, this.tabs).sort(this.sortByInactive);
390
+ for (const tab of changedTabs) {
2147
391
  this.changeTab.emit(tab);
2148
- });
392
+ }
2149
393
  this.tabs = newTabs;
2150
394
  }
2151
395
  sortByInactive(a, b) {
2152
396
  return Number(a.active) - Number(b.active);
2153
397
  }
2154
- handleScroll() {
2155
- const scrollLeft = this.scrollArea.scrollLeft;
2156
- const scrollRight = Math.floor(this.scrollContent.getBoundingClientRect().width -
2157
- this.scrollArea.getBoundingClientRect().width -
2158
- scrollLeft);
2159
- if (scrollLeft > HIDE_SCROLL_BUTTONS_WHEN_SCROLLED_LESS_THAN_PX) {
2160
- this.canScrollLeft = true;
2161
- }
2162
- else {
2163
- this.canScrollLeft = false;
2164
- }
2165
- if (scrollRight > HIDE_SCROLL_BUTTONS_WHEN_SCROLLED_LESS_THAN_PX) {
2166
- this.canScrollRight = true;
2167
- }
2168
- else {
2169
- this.canScrollRight = false;
2170
- }
2171
- }
2172
- handleLeftScrollClick() {
2173
- const scrollDistance = this.getScrollDistance();
2174
- this.scrollArea.scroll({
2175
- left: this.scrollArea.scrollLeft - scrollDistance,
2176
- behavior: 'smooth',
2177
- });
2178
- }
2179
- handleRightScrollClick() {
2180
- const scrollDistance = this.getScrollDistance();
2181
- this.scrollArea.scroll({
2182
- left: this.scrollArea.scrollLeft + scrollDistance,
2183
- behavior: 'smooth',
2184
- });
2185
- }
2186
- /**
2187
- * Calculates how far to scroll when navigation buttons are clicked.
2188
- * Returns the visible width minus an overlap percentage to maintain context.
2189
- * Falls back to the constant value if something goes wrong.
2190
- */
2191
- getScrollDistance() {
2192
- if (!this.scrollArea) {
2193
- return SCROLL_DISTANCE_ON_CLICK_PX;
2194
- }
2195
- const containerWidth = this.scrollArea.getBoundingClientRect().width;
2196
- const scrollDistance = containerWidth * (1 - OVERLAP_PERCENTAGE / TOTAL_WIDTH_PERCENTAGE);
2197
- return Math.max(scrollDistance, SCROLL_DISTANCE_ON_CLICK_PX);
2198
- }
2199
398
  renderIcon(tab) {
2200
399
  if (!tab.icon) {
2201
400
  return;
@@ -2208,11 +407,11 @@ const TabBar = class {
2208
407
  }
2209
408
  return (index.h("limel-icon", { class: "mdc-tab__icon", name: name, style: style, size: "small", "aria-hidden": "true" }));
2210
409
  }
2211
- renderTab(tab) {
410
+ renderTab(tab, index$1, isTabStop) {
2212
411
  return (index.h("button", { class: {
2213
412
  'mdc-tab': true,
2214
413
  'mdc-tab--active': !!tab.active,
2215
- }, role: "tab", "aria-selected": tab.active ? 'true' : 'false', tabindex: tab.active ? 0 : -1 }, index.h("span", { class: "mdc-tab__content" }, this.renderIcon(tab), index.h("span", { class: "mdc-tab__text-label" }, tab.text), tab.badge ? index.h("limel-badge", { label: tab.badge }) : ''), index.h("span", { class: {
414
+ }, role: "tab", "aria-selected": tab.active ? 'true' : 'false', tabindex: isTabStop ? 0 : -1, onClick: () => this.activateTab(index$1) }, index.h("span", { class: "mdc-tab__content" }, this.renderIcon(tab), index.h("span", { class: "mdc-tab__text-label" }, tab.text), tab.badge ? index.h("limel-badge", { label: tab.badge }) : ''), index.h("span", { class: {
2216
415
  'mdc-tab-indicator': true,
2217
416
  'mdc-tab-indicator--active': !!tab.active,
2218
417
  } }, index.h("span", { class: "mdc-tab-indicator__content mdc-tab-indicator__content--underline" })), index.h("span", { class: "mdc-tab__ripple" })));