bootstrap-italia 2.12.0 → 2.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (380) hide show
  1. package/README.EN.md +1 -1
  2. package/README.md +1 -1
  3. package/dist/bootstrap-italia.esm.js +1 -1
  4. package/dist/css/bootstrap-italia.min.css +9 -1
  5. package/dist/css/bootstrap-italia.min.css.map +1 -1
  6. package/dist/js/bootstrap-italia.bundle.min.js +19 -23
  7. package/dist/js/bootstrap-italia.min.js +18 -2
  8. package/dist/plugins/accept-overlay.js +19 -9
  9. package/dist/plugins/accept-overlay.js.map +1 -1
  10. package/dist/plugins/accordion.js +19 -24
  11. package/dist/plugins/accordion.js.map +1 -1
  12. package/dist/plugins/alert.js +67 -2
  13. package/dist/plugins/alert.js.map +1 -1
  14. package/dist/plugins/{backToTop.js → back-to-top.js} +14 -5
  15. package/dist/plugins/back-to-top.js.map +1 -0
  16. package/dist/plugins/base-component.js +91 -0
  17. package/dist/plugins/base-component.js.map +1 -0
  18. package/dist/plugins/button.js +58 -2
  19. package/dist/plugins/button.js.map +1 -1
  20. package/dist/plugins/carousel-bi.js +19 -9
  21. package/dist/plugins/carousel-bi.js.map +1 -1
  22. package/dist/plugins/carousel.js +445 -2
  23. package/dist/plugins/carousel.js.map +1 -1
  24. package/dist/plugins/collapse.js +273 -2
  25. package/dist/plugins/collapse.js.map +1 -1
  26. package/dist/plugins/cookiebar.js +39 -52
  27. package/dist/plugins/cookiebar.js.map +1 -1
  28. package/dist/plugins/dimmer.js +19 -8
  29. package/dist/plugins/dimmer.js.map +1 -1
  30. package/dist/plugins/dom/data.js +61 -0
  31. package/dist/plugins/dom/data.js.map +1 -0
  32. package/dist/plugins/dom/event-handler.js +296 -0
  33. package/dist/plugins/dom/event-handler.js.map +1 -0
  34. package/dist/plugins/dom/manipulator.js +76 -0
  35. package/dist/plugins/dom/manipulator.js.map +1 -0
  36. package/dist/plugins/dom/selector-engine.js +82 -0
  37. package/dist/plugins/dom/selector-engine.js.map +1 -0
  38. package/dist/plugins/dropdown.js +433 -2
  39. package/dist/plugins/dropdown.js.map +1 -1
  40. package/dist/plugins/fonts-loader.js +9 -1
  41. package/dist/plugins/fonts-loader.js.map +1 -1
  42. package/dist/plugins/form-validate.js +22 -8
  43. package/dist/plugins/form-validate.js.map +1 -1
  44. package/dist/plugins/forward.js +21 -18
  45. package/dist/plugins/forward.js.map +1 -1
  46. package/dist/plugins/header-sticky.js +11 -2
  47. package/dist/plugins/header-sticky.js.map +1 -1
  48. package/dist/plugins/history-back.js +17 -17
  49. package/dist/plugins/history-back.js.map +1 -1
  50. package/dist/plugins/init.js +9 -0
  51. package/dist/plugins/init.js.map +1 -1
  52. package/dist/plugins/input-label.js +14 -3
  53. package/dist/plugins/input-label.js.map +1 -1
  54. package/dist/plugins/input-number.js +13 -4
  55. package/dist/plugins/input-number.js.map +1 -1
  56. package/dist/plugins/input-password.js +48 -37
  57. package/dist/plugins/input-password.js.map +1 -1
  58. package/dist/plugins/input-search-autocomplete.js +9 -11
  59. package/dist/plugins/input-search-autocomplete.js.map +1 -1
  60. package/dist/plugins/input.js +12 -3
  61. package/dist/plugins/input.js.map +1 -1
  62. package/dist/plugins/list.js +23 -12
  63. package/dist/plugins/list.js.map +1 -1
  64. package/dist/plugins/masonry.js +29 -29
  65. package/dist/plugins/masonry.js.map +1 -1
  66. package/dist/plugins/modal.js +358 -2
  67. package/dist/plugins/modal.js.map +1 -1
  68. package/dist/plugins/navbar-collapsible.js +55 -45
  69. package/dist/plugins/navbar-collapsible.js.map +1 -1
  70. package/dist/plugins/navscroll.js +16 -23
  71. package/dist/plugins/navscroll.js.map +1 -1
  72. package/dist/plugins/notification.js +34 -23
  73. package/dist/plugins/notification.js.map +1 -1
  74. package/dist/plugins/offcanvas.js +259 -2
  75. package/dist/plugins/offcanvas.js.map +1 -1
  76. package/dist/plugins/popover.js +76 -2
  77. package/dist/plugins/popover.js.map +1 -1
  78. package/dist/plugins/progress-donut.js +19 -12
  79. package/dist/plugins/progress-donut.js.map +1 -1
  80. package/dist/plugins/scrollspy.js +273 -2
  81. package/dist/plugins/scrollspy.js.map +1 -1
  82. package/dist/plugins/select-autocomplete.js +10 -1
  83. package/dist/plugins/select-autocomplete.js.map +1 -1
  84. package/dist/plugins/sticky.js +21 -18
  85. package/dist/plugins/sticky.js.map +1 -1
  86. package/dist/plugins/tab.js +244 -27
  87. package/dist/plugins/tab.js.map +1 -1
  88. package/dist/plugins/toast.js +203 -2
  89. package/dist/plugins/toast.js.map +1 -1
  90. package/dist/plugins/tooltip.js +602 -2
  91. package/dist/plugins/tooltip.js.map +1 -1
  92. package/dist/plugins/track-focus.js +8 -0
  93. package/dist/plugins/track-focus.js.map +1 -1
  94. package/dist/plugins/transfer.js +11 -16
  95. package/dist/plugins/transfer.js.map +1 -1
  96. package/dist/plugins/upload-dragdrop.js +13 -4
  97. package/dist/plugins/upload-dragdrop.js.map +1 -1
  98. package/dist/plugins/util/backdrop.js +155 -0
  99. package/dist/plugins/util/backdrop.js.map +1 -0
  100. package/dist/plugins/util/component-functions.js +38 -0
  101. package/dist/plugins/util/component-functions.js.map +1 -0
  102. package/dist/plugins/util/config.js +70 -0
  103. package/dist/plugins/util/config.js.map +1 -0
  104. package/dist/plugins/util/cookies.js +8 -0
  105. package/dist/plugins/util/cookies.js.map +1 -1
  106. package/dist/plugins/util/device.js +0 -3
  107. package/dist/plugins/util/device.js.map +1 -1
  108. package/dist/plugins/util/dom.js +8 -0
  109. package/dist/plugins/util/dom.js.map +1 -1
  110. package/dist/plugins/util/focustrap.js +121 -0
  111. package/dist/plugins/util/focustrap.js.map +1 -0
  112. package/dist/plugins/util/index.js +280 -0
  113. package/dist/plugins/util/index.js.map +1 -0
  114. package/dist/plugins/util/observer.js +8 -0
  115. package/dist/plugins/util/observer.js.map +1 -1
  116. package/dist/plugins/util/on-document-scroll.js +20 -9
  117. package/dist/plugins/util/on-document-scroll.js.map +1 -1
  118. package/dist/plugins/util/pageScroll.js +8 -0
  119. package/dist/plugins/util/pageScroll.js.map +1 -1
  120. package/dist/plugins/util/sanitizer.js +115 -0
  121. package/dist/plugins/util/sanitizer.js.map +1 -0
  122. package/dist/plugins/util/scrollbar.js +120 -0
  123. package/dist/plugins/util/scrollbar.js.map +1 -0
  124. package/dist/plugins/util/swipe.js +150 -0
  125. package/dist/plugins/util/swipe.js.map +1 -0
  126. package/dist/plugins/util/template-factory.js +166 -0
  127. package/dist/plugins/util/template-factory.js.map +1 -0
  128. package/dist/plugins/util/tween.js +10 -1
  129. package/dist/plugins/util/tween.js.map +1 -1
  130. package/dist/plugins/util/youtube-video.js +12 -21
  131. package/dist/plugins/util/youtube-video.js.map +1 -1
  132. package/dist/plugins/videoplayer.js +19 -8
  133. package/dist/plugins/videoplayer.js.map +1 -1
  134. package/dist/version.js +10 -3
  135. package/dist/version.js.map +1 -1
  136. package/package.json +6 -7
  137. package/src/js/bootstrap-italia.entry.js +8 -0
  138. package/src/js/bootstrap-italia.esm.js +9 -1
  139. package/src/js/icons.js +8 -0
  140. package/src/js/load-plugin.js +8 -0
  141. package/src/js/plugins/accept-overlay.js +18 -10
  142. package/src/js/plugins/accordion.js +16 -22
  143. package/src/js/plugins/alert.js +66 -2
  144. package/src/js/plugins/{backToTop.js → back-to-top.js} +12 -4
  145. package/src/js/plugins/base-component.js +89 -0
  146. package/src/js/plugins/button.js +57 -2
  147. package/src/js/plugins/carousel-bi.js +18 -9
  148. package/src/js/plugins/carousel.js +444 -2
  149. package/src/js/plugins/collapse.js +272 -2
  150. package/src/js/plugins/cookiebar.js +37 -60
  151. package/src/js/plugins/dimmer.js +18 -8
  152. package/src/js/plugins/dom/data.js +58 -0
  153. package/src/js/plugins/dom/event-handler.js +301 -0
  154. package/src/js/plugins/dom/manipulator.js +75 -0
  155. package/src/js/plugins/dom/selector-engine.js +80 -0
  156. package/src/js/plugins/dropdown.js +432 -2
  157. package/src/js/plugins/fonts-loader.js +9 -1
  158. package/src/js/plugins/form-validate.js +21 -8
  159. package/src/js/plugins/form.js +11 -3
  160. package/src/js/plugins/forward.js +18 -16
  161. package/src/js/plugins/header-sticky.js +10 -2
  162. package/src/js/plugins/history-back.js +14 -14
  163. package/src/js/plugins/init.js +8 -0
  164. package/src/js/plugins/input-label.js +13 -3
  165. package/src/js/plugins/input-number.js +12 -4
  166. package/src/js/plugins/input-password.js +46 -36
  167. package/src/js/plugins/input-search-autocomplete.js +9 -13
  168. package/src/js/plugins/input.js +11 -3
  169. package/src/js/plugins/list.js +22 -12
  170. package/src/js/plugins/masonry.js +26 -27
  171. package/src/js/plugins/modal.js +357 -2
  172. package/src/js/plugins/navbar-collapsible.js +55 -53
  173. package/src/js/plugins/navscroll.js +16 -23
  174. package/src/js/plugins/notification.js +33 -23
  175. package/src/js/plugins/offcanvas.js +258 -2
  176. package/src/js/plugins/popover.js +75 -2
  177. package/src/js/plugins/progress-donut.js +17 -13
  178. package/src/js/plugins/scrollspy.js +272 -2
  179. package/src/js/plugins/select-autocomplete.js +9 -1
  180. package/src/js/plugins/sticky.js +21 -23
  181. package/src/js/plugins/tab.js +243 -27
  182. package/src/js/plugins/toast.js +206 -2
  183. package/src/js/plugins/tooltip.js +601 -2
  184. package/src/js/plugins/track-focus.js +8 -0
  185. package/src/js/plugins/transfer.js +12 -24
  186. package/src/js/plugins/upload-dragdrop.js +12 -4
  187. package/src/js/plugins/util/backdrop.js +153 -0
  188. package/src/js/plugins/util/component-functions.js +36 -0
  189. package/src/js/plugins/util/config.js +68 -0
  190. package/src/js/plugins/util/cookies.js +8 -0
  191. package/src/js/plugins/util/device.js +0 -3
  192. package/src/js/plugins/util/dom.js +8 -0
  193. package/src/js/plugins/util/focustrap.js +119 -0
  194. package/src/js/plugins/util/index.js +317 -0
  195. package/src/js/plugins/util/observer.js +8 -0
  196. package/src/js/plugins/util/on-document-scroll.js +19 -9
  197. package/src/js/plugins/util/pageScroll.js +8 -0
  198. package/src/js/plugins/util/sanitizer.js +112 -0
  199. package/src/js/plugins/util/scrollbar.js +118 -0
  200. package/src/js/plugins/util/swipe.js +148 -0
  201. package/src/js/plugins/util/template-factory.js +164 -0
  202. package/src/js/plugins/util/tween.js +9 -1
  203. package/src/js/plugins/util/youtube-video.js +12 -21
  204. package/src/js/plugins/videoplayer.js +18 -8
  205. package/src/js/version.js +10 -3
  206. package/src/scss/base/_containers.scss +41 -0
  207. package/src/scss/base/_functions.scss +373 -0
  208. package/src/scss/base/_helpers.scss +10 -0
  209. package/src/scss/base/_maps.scss +54 -0
  210. package/src/scss/base/_mixins.scss +44 -0
  211. package/src/scss/base/_reboot.scss +590 -0
  212. package/src/scss/base/_root.scss +73 -0
  213. package/src/scss/base/_transitions.scss +27 -0
  214. package/src/scss/base/_utilities.scss +742 -0
  215. package/src/scss/base/_variables.scss +2123 -0
  216. package/src/scss/base/_version.scss +3 -0
  217. package/src/scss/base/helpers/_clearfix.scss +3 -0
  218. package/src/scss/base/helpers/_color-bg.scss +10 -0
  219. package/src/scss/base/helpers/_colored-links.scss +16 -0
  220. package/src/scss/base/helpers/_position.scss +36 -0
  221. package/src/scss/base/helpers/_ratio.scss +26 -0
  222. package/src/scss/base/helpers/_stacks.scss +15 -0
  223. package/src/scss/base/helpers/_stretched-link.scss +15 -0
  224. package/src/scss/base/helpers/_text-truncation.scss +7 -0
  225. package/src/scss/base/helpers/_visually-hidden.scss +8 -0
  226. package/src/scss/base/helpers/_vr.scss +8 -0
  227. package/src/scss/base/mixins/_alert.scss +15 -0
  228. package/src/scss/base/mixins/_backdrop.scss +18 -0
  229. package/src/scss/base/mixins/_banner.scss +11 -0
  230. package/src/scss/base/mixins/_border-radius.scss +77 -0
  231. package/src/scss/base/mixins/_box-shadow.scss +18 -0
  232. package/src/scss/base/mixins/_breakpoints.scss +127 -0
  233. package/src/scss/base/mixins/_buttons.scss +141 -0
  234. package/src/scss/base/mixins/_caret.scss +64 -0
  235. package/src/scss/base/mixins/_clearfix.scss +9 -0
  236. package/src/scss/base/mixins/_color-scheme.scss +7 -0
  237. package/src/scss/base/mixins/_container.scss +11 -0
  238. package/src/scss/base/mixins/_deprecate.scss +10 -0
  239. package/src/scss/base/mixins/_forms.scss +152 -0
  240. package/src/scss/base/mixins/_gradients.scss +47 -0
  241. package/src/scss/base/mixins/_grid.scss +151 -0
  242. package/src/scss/base/mixins/_image.scss +15 -0
  243. package/src/scss/base/mixins/_list-group.scss +24 -0
  244. package/src/scss/base/mixins/_lists.scss +7 -0
  245. package/src/scss/base/mixins/_pagination.scss +10 -0
  246. package/src/scss/base/mixins/_reset-text.scss +17 -0
  247. package/src/scss/base/mixins/_resize.scss +6 -0
  248. package/src/scss/base/mixins/_table-variants.scss +24 -0
  249. package/src/scss/base/mixins/_text-truncate.scss +8 -0
  250. package/src/scss/base/mixins/_transition.scss +26 -0
  251. package/src/scss/base/mixins/_utilities.scss +96 -0
  252. package/src/scss/base/mixins/_visually-hidden.scss +29 -0
  253. package/src/scss/base/utilities/_api.scss +45 -0
  254. package/src/scss/base/vendor/_rfs.scss +337 -0
  255. package/src/scss/bootstrap-italia.scss +137 -156
  256. package/src/scss/components/_accordion.scss +297 -0
  257. package/src/scss/{custom → components}/_avatar.scss +75 -35
  258. package/src/scss/components/_badge.scss +60 -0
  259. package/src/scss/components/_breadcrumb.scss +95 -0
  260. package/src/scss/components/_button-group.scss +143 -0
  261. package/src/scss/components/_buttons.scss +467 -0
  262. package/src/scss/{custom → components}/_card.scss +228 -0
  263. package/src/scss/{custom → components}/_carousel.scss +225 -3
  264. package/src/scss/components/_dropdown.scss +480 -0
  265. package/src/scss/{custom → components}/_grid.scss +33 -0
  266. package/src/scss/{custom → components}/_gridlist.scss +7 -0
  267. package/src/scss/{custom → components}/_hero.scss +23 -57
  268. package/src/scss/components/_images.scss +48 -0
  269. package/src/scss/{custom → components}/_linklist.scss +0 -1
  270. package/src/scss/components/_list-group.scss +190 -0
  271. package/src/scss/components/_modal.scss +475 -0
  272. package/src/scss/components/_nav.scss +169 -0
  273. package/src/scss/components/_navbar.scss +273 -0
  274. package/src/scss/components/_offcanvas.scss +144 -0
  275. package/src/scss/components/_pagination.scss +108 -0
  276. package/src/scss/components/_placeholders.scss +51 -0
  277. package/src/scss/components/_popover.scss +298 -0
  278. package/src/scss/components/_progress-bars.scss +126 -0
  279. package/src/scss/{custom → components}/_steppers.scss +2 -2
  280. package/src/scss/{custom → components}/_tab.scss +3 -7
  281. package/src/scss/components/_tables.scss +171 -0
  282. package/src/scss/components/_toasts.scss +73 -0
  283. package/src/scss/{custom → components}/_toolbar.scss +19 -12
  284. package/src/scss/components/_tooltip.scss +139 -0
  285. package/src/scss/{custom → components}/_type.scss +92 -0
  286. package/src/scss/forms/_accessible-autocomplete.scss +188 -0
  287. package/src/scss/forms/_floating-labels.scss +75 -0
  288. package/src/scss/forms/_form-check.scss +175 -0
  289. package/src/scss/forms/_form-control.scss +201 -0
  290. package/src/scss/forms/_form-range.scss +95 -0
  291. package/src/scss/{custom → forms}/_form-select.scss +72 -0
  292. package/src/scss/forms/_form-text.scss +11 -0
  293. package/src/scss/{custom → forms}/_forms.scss +8 -12
  294. package/src/scss/forms/_input-group.scss +129 -0
  295. package/src/scss/forms/_labels.scss +36 -0
  296. package/src/scss/forms/_validation.scss +12 -0
  297. package/src/scss/utilities/icons.scss +5 -5
  298. package/types/index.d.ts +4 -1
  299. package/types/plugins/video.ts +33 -0
  300. package/dist/plugins/backToTop.js.map +0 -1
  301. package/src/scss/_functions.scss +0 -38
  302. package/src/scss/_variables.scss +0 -639
  303. package/src/scss/custom/_accessible-autocomplete.scss +0 -30
  304. package/src/scss/custom/_accordion.scss +0 -176
  305. package/src/scss/custom/_badge.scss +0 -29
  306. package/src/scss/custom/_breadcrumb.scss +0 -51
  307. package/src/scss/custom/_buttons.scss +0 -235
  308. package/src/scss/custom/_componente-base.scss +0 -6
  309. package/src/scss/custom/_dropdown.scss +0 -248
  310. package/src/scss/custom/_form-datepicker.scss +0 -604
  311. package/src/scss/custom/_images.scss +0 -10
  312. package/src/scss/custom/_modal.scss +0 -248
  313. package/src/scss/custom/_popover.scss +0 -106
  314. package/src/scss/custom/_progress-bars.scss +0 -70
  315. package/src/scss/custom/_tables.scss +0 -11
  316. package/src/scss/custom/_timepicker.scss +0 -252
  317. package/src/scss/custom/_tooltip.scss +0 -33
  318. package/src/scss/custom/_version.scss +0 -3
  319. package/src/scss/custom/mixins/_buttons.scss +0 -67
  320. package/src/scss/utilities/colors_vars.scss +0 -426
  321. /package/src/scss/{custom → base}/mixins/_text-emphasis.scss +0 -0
  322. /package/src/scss/{custom → components}/_accept-overlay.scss +0 -0
  323. /package/src/scss/{custom → components}/_affix.scss +0 -0
  324. /package/src/scss/{custom → components}/_alert.scss +0 -0
  325. /package/src/scss/{custom → components}/_anchor.scss +0 -0
  326. /package/src/scss/{custom → components}/_back-to-top.scss +0 -0
  327. /package/src/scss/{custom → components}/_bottomnav.scss +0 -0
  328. /package/src/scss/{custom → components}/_calendar.scss +0 -0
  329. /package/src/scss/{custom → components}/_callout.scss +0 -0
  330. /package/src/scss/{custom → components}/_chips.scss +0 -0
  331. /package/src/scss/{custom → components}/_code.scss +0 -0
  332. /package/src/scss/{custom → components}/_cookiebar.scss +0 -0
  333. /package/src/scss/{custom → components}/_dimmer.scss +0 -0
  334. /package/src/scss/{custom → components}/_figcaption.scss +0 -0
  335. /package/src/scss/{custom → components}/_font.scss +0 -0
  336. /package/src/scss/{custom → components}/_footer.scss +0 -0
  337. /package/src/scss/{custom → components}/_forward.scss +0 -0
  338. /package/src/scss/{custom → components}/_header.scss +0 -0
  339. /package/src/scss/{custom → components}/_headercenter.scss +0 -0
  340. /package/src/scss/{custom → components}/_headercentertheme.scss +0 -0
  341. /package/src/scss/{custom → components}/_headernavbar.scss +0 -0
  342. /package/src/scss/{custom → components}/_headernavbartheme.scss +0 -0
  343. /package/src/scss/{custom → components}/_headerslim.scss +0 -0
  344. /package/src/scss/{custom → components}/_headerslimtheme.scss +0 -0
  345. /package/src/scss/{custom → components}/_imgresponsive.scss +0 -0
  346. /package/src/scss/{custom → components}/_list.scss +0 -0
  347. /package/src/scss/{custom → components}/_map.scss +0 -0
  348. /package/src/scss/{custom → components}/_masonry-loader.scss +0 -0
  349. /package/src/scss/{custom → components}/_megamenu.scss +0 -0
  350. /package/src/scss/{custom → components}/_navigation.scss +0 -0
  351. /package/src/scss/{custom → components}/_navigationtheme.scss +0 -0
  352. /package/src/scss/{custom → components}/_navscroll.scss +0 -0
  353. /package/src/scss/{custom → components}/_navscrolltheme.scss +0 -0
  354. /package/src/scss/{custom → components}/_notifications.scss +0 -0
  355. /package/src/scss/{custom → components}/_overlay-panel.scss +0 -0
  356. /package/src/scss/{custom → components}/_page-scroll.scss +0 -0
  357. /package/src/scss/{custom → components}/_pager.scss +0 -0
  358. /package/src/scss/{custom → components}/_point-list.scss +0 -0
  359. /package/src/scss/{custom → components}/_print.scss +0 -0
  360. /package/src/scss/{custom → components}/_progress-donuts.scss +0 -0
  361. /package/src/scss/{custom → components}/_progress-spinners.scss +0 -0
  362. /package/src/scss/{custom → components}/_rating-list.scss +0 -0
  363. /package/src/scss/{custom → components}/_rating.scss +0 -0
  364. /package/src/scss/{custom → components}/_sections.scss +0 -0
  365. /package/src/scss/{custom → components}/_sidebar.scss +0 -0
  366. /package/src/scss/{custom → components}/_sidebarthemes.scss +0 -0
  367. /package/src/scss/{custom → components}/_skiplinks.scss +0 -0
  368. /package/src/scss/{custom → components}/_sticky.scss +0 -0
  369. /package/src/scss/{custom → components}/_thumbnav.scss +0 -0
  370. /package/src/scss/{custom → components}/_timeline.scss +0 -0
  371. /package/src/scss/{custom → components}/_videoplayer.scss +0 -0
  372. /package/src/scss/{custom → forms}/_autocomplete.scss +0 -0
  373. /package/src/scss/{custom → forms}/_form-input-file.scss +0 -0
  374. /package/src/scss/{custom → forms}/_form-input-number.scss +0 -0
  375. /package/src/scss/{custom → forms}/_form-input-upload.scss +0 -0
  376. /package/src/scss/{custom → forms}/_form-password.scss +0 -0
  377. /package/src/scss/{custom → forms}/_form-toggles.scss +0 -0
  378. /package/src/scss/{custom → forms}/_form-transfer.scss +0 -0
  379. /package/src/scss/{custom → forms}/_just-validate.scss +0 -0
  380. /package/types/plugins/{backToTop.d.ts → back-to-top.d.ts} +0 -0
@@ -1,5 +1,275 @@
1
- import { default as BSScrollSpy } from 'bootstrap/js/src/scrollspy'
1
+ /**
2
+ * --------------------------------------------------------------------------
3
+ * Bootstrap Italia (https://italia.github.io/bootstrap-italia/)
4
+ * Authors: https://github.com/italia/bootstrap-italia/blob/main/AUTHORS
5
+ * Licensed under BSD-3-Clause license (https://github.com/italia/bootstrap-italia/blob/main/LICENSE)
6
+ * This a fork of Bootstrap: Initial license and original file name below
7
+ * Bootstrap (v5.2.3): scrollspy.js
8
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
9
+ * --------------------------------------------------------------------------
10
+ */
2
11
 
3
- class ScrollSpy extends BSScrollSpy {}
12
+ import { getElement, isDisabled, isVisible } from './util/index'
13
+ import EventHandler from './dom/event-handler'
14
+ import SelectorEngine from './dom/selector-engine'
15
+ import BaseComponent from './base-component'
16
+
17
+ /**
18
+ * Constants
19
+ */
20
+
21
+ const NAME = 'scrollspy'
22
+ const DATA_KEY = 'bs.scrollspy'
23
+ const EVENT_KEY = `.${DATA_KEY}`
24
+ const DATA_API_KEY = '.data-api'
25
+
26
+ const EVENT_ACTIVATE = `activate${EVENT_KEY}`
27
+ const EVENT_CLICK = `click${EVENT_KEY}`
28
+ const EVENT_LOAD_DATA_API = `load${EVENT_KEY}${DATA_API_KEY}`
29
+
30
+ const CLASS_NAME_DROPDOWN_ITEM = 'dropdown-item'
31
+ const CLASS_NAME_ACTIVE = 'active'
32
+
33
+ const SELECTOR_DATA_SPY = '[data-bs-spy="scroll"]'
34
+ const SELECTOR_TARGET_LINKS = '[href]'
35
+ const SELECTOR_NAV_LIST_GROUP = '.nav, .list-group'
36
+ const SELECTOR_NAV_LINKS = '.nav-link'
37
+ const SELECTOR_NAV_ITEMS = '.nav-item'
38
+ const SELECTOR_LIST_ITEMS = '.list-group-item'
39
+ const SELECTOR_LINK_ITEMS = `${SELECTOR_NAV_LINKS}, ${SELECTOR_NAV_ITEMS} > ${SELECTOR_NAV_LINKS}, ${SELECTOR_LIST_ITEMS}`
40
+ const SELECTOR_DROPDOWN = '.dropdown'
41
+ const SELECTOR_DROPDOWN_TOGGLE = '.dropdown-toggle'
42
+
43
+ const Default = {
44
+ offset: null, // TODO: v6 @deprecated, keep it for backwards compatibility reasons
45
+ rootMargin: '0px 0px -25%',
46
+ smoothScroll: false,
47
+ target: null,
48
+ threshold: [0.1, 0.5, 1],
49
+ }
50
+
51
+ const DefaultType = {
52
+ offset: '(number|null)', // TODO v6 @deprecated, keep it for backwards compatibility reasons
53
+ rootMargin: 'string',
54
+ smoothScroll: 'boolean',
55
+ target: 'element',
56
+ threshold: 'array',
57
+ }
58
+
59
+ /**
60
+ * Class definition
61
+ */
62
+
63
+ class ScrollSpy extends BaseComponent {
64
+ constructor(element, config) {
65
+ super(element, config)
66
+
67
+ // this._element is the observablesContainer and config.target the menu links wrapper
68
+ this._targetLinks = new Map()
69
+ this._observableSections = new Map()
70
+ this._rootElement = getComputedStyle(this._element).overflowY === 'visible' ? null : this._element
71
+ this._activeTarget = null
72
+ this._observer = null
73
+ this._previousScrollData = {
74
+ visibleEntryTop: 0,
75
+ parentScrollTop: 0,
76
+ }
77
+ this.refresh() // initialize
78
+ }
79
+
80
+ // Getters
81
+ static get Default() {
82
+ return Default
83
+ }
84
+
85
+ static get DefaultType() {
86
+ return DefaultType
87
+ }
88
+
89
+ static get NAME() {
90
+ return NAME
91
+ }
92
+
93
+ // Public
94
+ refresh() {
95
+ this._initializeTargetsAndObservables()
96
+ this._maybeEnableSmoothScroll()
97
+
98
+ if (this._observer) {
99
+ this._observer.disconnect()
100
+ } else {
101
+ this._observer = this._getNewObserver()
102
+ }
103
+
104
+ for (const section of this._observableSections.values()) {
105
+ this._observer.observe(section)
106
+ }
107
+ }
108
+
109
+ dispose() {
110
+ this._observer.disconnect()
111
+ super.dispose()
112
+ }
113
+
114
+ // Private
115
+ _configAfterMerge(config) {
116
+ // TODO: on v6 target should be given explicitly & remove the {target: 'ss-target'} case
117
+ config.target = getElement(config.target) || document.body
118
+
119
+ // TODO: v6 Only for backwards compatibility reasons. Use rootMargin only
120
+ config.rootMargin = config.offset ? `${config.offset}px 0px -30%` : config.rootMargin
121
+
122
+ if (typeof config.threshold === 'string') {
123
+ config.threshold = config.threshold.split(',').map((value) => Number.parseFloat(value))
124
+ }
125
+
126
+ return config
127
+ }
128
+
129
+ _maybeEnableSmoothScroll() {
130
+ if (!this._config.smoothScroll) {
131
+ return
132
+ }
133
+
134
+ // unregister any previous listeners
135
+ EventHandler.off(this._config.target, EVENT_CLICK)
136
+
137
+ EventHandler.on(this._config.target, EVENT_CLICK, SELECTOR_TARGET_LINKS, (event) => {
138
+ const observableSection = this._observableSections.get(event.target.hash)
139
+ if (observableSection) {
140
+ event.preventDefault()
141
+ const root = this._rootElement || window
142
+ const height = observableSection.offsetTop - this._element.offsetTop
143
+ if (root.scrollTo) {
144
+ root.scrollTo({ top: height, behavior: 'smooth' })
145
+ return
146
+ }
147
+
148
+ // Chrome 60 doesn't support `scrollTo`
149
+ root.scrollTop = height
150
+ }
151
+ })
152
+ }
153
+
154
+ _getNewObserver() {
155
+ const options = {
156
+ root: this._rootElement,
157
+ threshold: this._config.threshold,
158
+ rootMargin: this._config.rootMargin,
159
+ }
160
+
161
+ return new IntersectionObserver((entries) => this._observerCallback(entries), options)
162
+ }
163
+
164
+ // The logic of selection
165
+ _observerCallback(entries) {
166
+ const targetElement = (entry) => this._targetLinks.get(`#${entry.target.id}`)
167
+ const activate = (entry) => {
168
+ this._previousScrollData.visibleEntryTop = entry.target.offsetTop
169
+ this._process(targetElement(entry))
170
+ }
171
+
172
+ const parentScrollTop = (this._rootElement || document.documentElement).scrollTop
173
+ const userScrollsDown = parentScrollTop >= this._previousScrollData.parentScrollTop
174
+ this._previousScrollData.parentScrollTop = parentScrollTop
175
+
176
+ for (const entry of entries) {
177
+ if (!entry.isIntersecting) {
178
+ this._activeTarget = null
179
+ this._clearActiveClass(targetElement(entry))
180
+
181
+ continue
182
+ }
183
+
184
+ const entryIsLowerThanPrevious = entry.target.offsetTop >= this._previousScrollData.visibleEntryTop
185
+ // if we are scrolling down, pick the bigger offsetTop
186
+ if (userScrollsDown && entryIsLowerThanPrevious) {
187
+ activate(entry)
188
+ // if parent isn't scrolled, let's keep the first visible item, breaking the iteration
189
+ if (!parentScrollTop) {
190
+ return
191
+ }
192
+
193
+ continue
194
+ }
195
+
196
+ // if we are scrolling up, pick the smallest offsetTop
197
+ if (!userScrollsDown && !entryIsLowerThanPrevious) {
198
+ activate(entry)
199
+ }
200
+ }
201
+ }
202
+
203
+ _initializeTargetsAndObservables() {
204
+ this._targetLinks = new Map()
205
+ this._observableSections = new Map()
206
+
207
+ const targetLinks = SelectorEngine.find(SELECTOR_TARGET_LINKS, this._config.target)
208
+
209
+ for (const anchor of targetLinks) {
210
+ // ensure that the anchor has an id and is not disabled
211
+ if (!anchor.hash || isDisabled(anchor)) {
212
+ continue
213
+ }
214
+
215
+ const observableSection = SelectorEngine.findOne(anchor.hash, this._element)
216
+
217
+ // ensure that the observableSection exists & is visible
218
+ if (isVisible(observableSection)) {
219
+ this._targetLinks.set(anchor.hash, anchor)
220
+ this._observableSections.set(anchor.hash, observableSection)
221
+ }
222
+ }
223
+ }
224
+
225
+ _process(target) {
226
+ if (this._activeTarget === target) {
227
+ return
228
+ }
229
+
230
+ this._clearActiveClass(this._config.target)
231
+ this._activeTarget = target
232
+ target.classList.add(CLASS_NAME_ACTIVE)
233
+ this._activateParents(target)
234
+
235
+ EventHandler.trigger(this._element, EVENT_ACTIVATE, { relatedTarget: target })
236
+ }
237
+
238
+ _activateParents(target) {
239
+ // Activate dropdown parents
240
+ if (target.classList.contains(CLASS_NAME_DROPDOWN_ITEM)) {
241
+ SelectorEngine.findOne(SELECTOR_DROPDOWN_TOGGLE, target.closest(SELECTOR_DROPDOWN)).classList.add(CLASS_NAME_ACTIVE)
242
+ return
243
+ }
244
+
245
+ for (const listGroup of SelectorEngine.parents(target, SELECTOR_NAV_LIST_GROUP)) {
246
+ // Set triggered links parents as active
247
+ // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor
248
+ for (const item of SelectorEngine.prev(listGroup, SELECTOR_LINK_ITEMS)) {
249
+ item.classList.add(CLASS_NAME_ACTIVE)
250
+ }
251
+ }
252
+ }
253
+
254
+ _clearActiveClass(parent) {
255
+ parent.classList.remove(CLASS_NAME_ACTIVE)
256
+
257
+ const activeNodes = SelectorEngine.find(`${SELECTOR_TARGET_LINKS}.${CLASS_NAME_ACTIVE}`, parent)
258
+ for (const node of activeNodes) {
259
+ node.classList.remove(CLASS_NAME_ACTIVE)
260
+ }
261
+ }
262
+ }
263
+
264
+ /**
265
+ * Data API implementation
266
+ */
267
+ if (typeof window !== 'undefined' && typeof document !== 'undefined') {
268
+ EventHandler.on(window, EVENT_LOAD_DATA_API, () => {
269
+ for (const spy of SelectorEngine.find(SELECTOR_DATA_SPY)) {
270
+ ScrollSpy.getOrCreateInstance(spy)
271
+ }
272
+ })
273
+ }
4
274
 
5
275
  export default ScrollSpy
@@ -1,6 +1,14 @@
1
+ /**
2
+ * --------------------------------------------------------------------------
3
+ * Bootstrap Italia (https://italia.github.io/bootstrap-italia/)
4
+ * Authors: https://github.com/italia/bootstrap-italia/blob/main/AUTHORS
5
+ * Licensed under BSD-3-Clause license (https://github.com/italia/bootstrap-italia/blob/main/LICENSE)
6
+ * --------------------------------------------------------------------------
7
+ */
8
+
1
9
  import accessibleAutocomplete from 'accessible-autocomplete'
2
10
 
3
- import BaseComponent from 'bootstrap/js/src/base-component.js'
11
+ import BaseComponent from './base-component.js'
4
12
 
5
13
  const NAME = 'selectautocomplete'
6
14
 
@@ -1,16 +1,11 @@
1
- import BaseComponent from 'bootstrap/js/src/base-component.js'
1
+ import BaseComponent from './base-component.js'
2
2
 
3
3
  import {
4
- //defineJQueryPlugin,
5
- //getElementFromSelector,
6
- //isVisible,
7
- //reflow,
8
- //typeCheckConfig,
9
4
  getSelectorFromElement, //in base al bs-target
10
- } from 'bootstrap/js/src/util'
11
- import EventHandler from 'bootstrap/js/src/dom/event-handler'
12
- import SelectorEngine from 'bootstrap/js/src/dom/selector-engine'
13
- import Manipulator from 'bootstrap/js/src/dom/manipulator'
5
+ } from './util/index'
6
+ import EventHandler from './dom/event-handler'
7
+ import SelectorEngine from './dom/selector-engine'
8
+ import Manipulator from './dom/manipulator'
14
9
 
15
10
  import { isScreenMobile } from './util/device'
16
11
  import onDocumentScroll from './util/on-document-scroll'
@@ -18,9 +13,7 @@ import onDocumentScroll from './util/on-document-scroll'
18
13
  const NAME = 'sticky'
19
14
  const DATA_KEY = 'bs.sticky'
20
15
  const EVENT_KEY = `.${DATA_KEY}`
21
- //const DATA_API_KEY = '.data-api'
22
16
 
23
- //const EVENT_SCROLL = `scroll${EVENT_KEY}`
24
17
  const EVENT_RESIZE = `resize${EVENT_KEY}`
25
18
  const EVENT_STICKY_ON = `on${EVENT_KEY}`
26
19
  const EVENT_STICKY_OFF = `off${EVENT_KEY}`
@@ -66,10 +59,12 @@ class Sticky extends BaseComponent {
66
59
  }
67
60
 
68
61
  dispose() {
69
- EventHandler.off(window, EVENT_RESIZE)
70
- this._scrollCb.dispose()
62
+ if (typeof window !== 'undefined' && typeof document !== 'undefined') {
63
+ EventHandler.off(window, EVENT_RESIZE)
64
+ this._scrollCb.dispose()
71
65
 
72
- super.dispose()
66
+ super.dispose()
67
+ }
73
68
  }
74
69
  // Getters
75
70
 
@@ -90,9 +85,10 @@ class Sticky extends BaseComponent {
90
85
  }
91
86
 
92
87
  _bindEvents() {
93
- EventHandler.on(window, EVENT_RESIZE, () => this._onResize())
94
- //EventHandler.on(window, EVENT_SCROLL, () => this._onScroll())
95
- this._scrollCb = onDocumentScroll(() => this._onScroll())
88
+ if (typeof window !== 'undefined' && typeof document !== 'undefined') {
89
+ EventHandler.on(window, EVENT_RESIZE, () => this._onResize())
90
+ this._scrollCb = onDocumentScroll(() => this._onScroll())
91
+ }
96
92
  }
97
93
 
98
94
  _onResize() {
@@ -246,11 +242,13 @@ class Sticky extends BaseComponent {
246
242
  * ------------------------------------------------------------------------
247
243
  */
248
244
 
249
- onDocumentScroll(() => {
250
- const stickies = SelectorEngine.find(SELECTOR_DATA_TOGGLE)
251
- stickies.map((sticky) => {
252
- Sticky.getOrCreateInstance(sticky)
245
+ if (typeof window !== 'undefined' && typeof document !== 'undefined') {
246
+ onDocumentScroll(() => {
247
+ const stickies = SelectorEngine.find(SELECTOR_DATA_TOGGLE)
248
+ stickies.map((sticky) => {
249
+ Sticky.getOrCreateInstance(sticky)
250
+ })
253
251
  })
254
- })
252
+ }
255
253
 
256
254
  export default Sticky
@@ -1,30 +1,157 @@
1
- import { default as BSTab } from 'bootstrap/js/src/tab'
2
- import { defineJQueryPlugin, getNextActiveElement, isDisabled } from 'bootstrap/js/src/util/index.js'
3
- import EventHandler from 'bootstrap/js/src/dom/event-handler.js'
4
- import SelectorEngine from 'bootstrap/js/src/dom/selector-engine.js'
1
+ /**
2
+ * --------------------------------------------------------------------------
3
+ * Bootstrap Italia (https://italia.github.io/bootstrap-italia/)
4
+ * Authors: https://github.com/italia/bootstrap-italia/blob/main/AUTHORS
5
+ * Licensed under BSD-3-Clause license (https://github.com/italia/bootstrap-italia/blob/main/LICENSE)
6
+ * This a fork of Bootstrap: Initial license and original file name below
7
+ * Bootstrap (v5.2.3): tab.js
8
+ * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
9
+ * --------------------------------------------------------------------------
10
+ */
11
+
12
+ import { getElementFromSelector, getNextActiveElement, isDisabled } from './util/index'
13
+ import EventHandler from './dom/event-handler'
14
+ import SelectorEngine from './dom/selector-engine'
15
+ import BaseComponent from './base-component'
16
+
17
+ /**
18
+ * Constants
19
+ */
5
20
 
21
+ const NAME = 'tab'
6
22
  const DATA_KEY = 'bs.tab'
7
23
  const EVENT_KEY = `.${DATA_KEY}`
8
24
 
25
+ const EVENT_HIDE = `hide${EVENT_KEY}`
26
+ const EVENT_HIDDEN = `hidden${EVENT_KEY}`
27
+ const EVENT_SHOW = `show${EVENT_KEY}`
28
+ const EVENT_SHOWN = `shown${EVENT_KEY}`
9
29
  const EVENT_CLICK_DATA_API = `click${EVENT_KEY}`
30
+ const EVENT_KEYDOWN = `keydown${EVENT_KEY}`
10
31
  const EVENT_LOAD_DATA_API = `load${EVENT_KEY}`
11
32
 
12
33
  const ARROW_LEFT_KEY = 'ArrowLeft'
13
34
  const ARROW_RIGHT_KEY = 'ArrowRight'
14
35
  const ARROW_UP_KEY = 'ArrowUp'
15
36
  const ARROW_DOWN_KEY = 'ArrowDown'
37
+
16
38
  const ENTER_KEY = 'Enter'
17
39
  const SPACE_BAR_KEY = ' '
18
40
 
19
41
  const CLASS_NAME_ACTIVE = 'active'
42
+ const CLASS_NAME_FADE = 'fade'
43
+ const CLASS_NAME_SHOW = 'show'
44
+ const CLASS_DROPDOWN = 'dropdown'
45
+
46
+ const SELECTOR_DROPDOWN_TOGGLE = '.dropdown-toggle'
47
+ const SELECTOR_DROPDOWN_MENU = '.dropdown-menu'
48
+ const NOT_SELECTOR_DROPDOWN_TOGGLE = ':not(.dropdown-toggle)'
20
49
 
50
+ const SELECTOR_TAB_PANEL = '.list-group, .nav, [role="tablist"]'
51
+ const SELECTOR_OUTER = '.nav-item, .list-group-item'
52
+ const SELECTOR_INNER = `.nav-link${NOT_SELECTOR_DROPDOWN_TOGGLE}, .list-group-item${NOT_SELECTOR_DROPDOWN_TOGGLE}, [role="tab"]${NOT_SELECTOR_DROPDOWN_TOGGLE}`
21
53
  const SELECTOR_DATA_TOGGLE = '[data-bs-toggle="tab"], [data-bs-toggle="pill"], [data-bs-toggle="list"]' // todo:v6: could be only `tab`
54
+ const SELECTOR_INNER_ELEM = `${SELECTOR_INNER}, ${SELECTOR_DATA_TOGGLE}`
22
55
 
23
- const SELECTOR_DATA_TOGGLE_ACTIVE = `.${CLASS_NAME_ACTIVE}[data-bs-toggle="tab"], .${CLASS_NAME_ACTIVE}[data-bs-toggle="pill"], .${CLASS_NAME_ACTIVE}[data-bs-toggle="list"]`
56
+ /**
57
+ * Class definition
58
+ */
24
59
 
25
- class Tab extends BSTab {
60
+ class Tab extends BaseComponent {
26
61
  constructor(element) {
27
62
  super(element)
63
+ this._parent = this._element.closest(SELECTOR_TAB_PANEL)
64
+
65
+ if (!this._parent) {
66
+ return
67
+ // todo: should Throw exception on v6
68
+ // throw new TypeError(`${element.outerHTML} has not a valid parent ${SELECTOR_INNER_ELEM}`)
69
+ }
70
+
71
+ // Set up initial aria attributes
72
+ this._setInitialAttributes(this._parent, this._getChildren())
73
+
74
+ EventHandler.on(this._element, EVENT_KEYDOWN, (event) => this._keydown(event))
75
+ }
76
+
77
+ // Getters
78
+ static get NAME() {
79
+ return NAME
80
+ }
81
+
82
+ // Public
83
+ show() {
84
+ // Shows this elem and deactivate the active sibling if exists
85
+ const innerElem = this._element
86
+ if (this._elemIsActive(innerElem)) {
87
+ return
88
+ }
89
+
90
+ // Search for active tab on same parent to deactivate it
91
+ const active = this._getActiveElem()
92
+
93
+ const hideEvent = active ? EventHandler.trigger(active, EVENT_HIDE, { relatedTarget: innerElem }) : null
94
+
95
+ const showEvent = EventHandler.trigger(innerElem, EVENT_SHOW, { relatedTarget: active })
96
+
97
+ if (showEvent.defaultPrevented || (hideEvent && hideEvent.defaultPrevented)) {
98
+ return
99
+ }
100
+
101
+ this._deactivate(active, innerElem)
102
+ this._activate(innerElem, active)
103
+ }
104
+
105
+ // Private
106
+ _activate(element, relatedElem) {
107
+ if (!element) {
108
+ return
109
+ }
110
+
111
+ element.classList.add(CLASS_NAME_ACTIVE)
112
+
113
+ this._activate(getElementFromSelector(element)) // Search and activate/show the proper section
114
+
115
+ const complete = () => {
116
+ if (element.getAttribute('role') !== 'tab') {
117
+ element.classList.add(CLASS_NAME_SHOW)
118
+ return
119
+ }
120
+
121
+ element.removeAttribute('tabindex')
122
+ element.setAttribute('aria-selected', true)
123
+ this._toggleDropDown(element, true)
124
+ EventHandler.trigger(element, EVENT_SHOWN, {
125
+ relatedTarget: relatedElem,
126
+ })
127
+ }
128
+
129
+ this._queueCallback(complete, element, element.classList.contains(CLASS_NAME_FADE))
130
+ }
131
+
132
+ _deactivate(element, relatedElem) {
133
+ if (!element) {
134
+ return
135
+ }
136
+
137
+ element.classList.remove(CLASS_NAME_ACTIVE)
138
+ element.blur()
139
+
140
+ this._deactivate(getElementFromSelector(element)) // Search and deactivate the shown section too
141
+
142
+ const complete = () => {
143
+ if (element.getAttribute('role') !== 'tab') {
144
+ element.classList.remove(CLASS_NAME_SHOW)
145
+ return
146
+ }
147
+
148
+ element.setAttribute('aria-selected', false)
149
+ element.setAttribute('tabindex', '-1')
150
+ this._toggleDropDown(element, false)
151
+ EventHandler.trigger(element, EVENT_HIDDEN, { relatedTarget: relatedElem })
152
+ }
153
+
154
+ this._queueCallback(complete, element, element.classList.contains(CLASS_NAME_FADE))
28
155
  }
29
156
 
30
157
  _keydown(event) {
@@ -51,36 +178,125 @@ class Tab extends BSTab {
51
178
  nextActiveElement.focus({ preventScroll: true })
52
179
  }
53
180
  }
54
- }
55
181
 
56
- EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) {
57
- if (['A', 'AREA'].includes(this.tagName)) {
58
- event.preventDefault()
182
+ _getChildren() {
183
+ // collection of inner elements
184
+ return SelectorEngine.find(SELECTOR_INNER_ELEM, this._parent)
59
185
  }
60
186
 
61
- if (isDisabled(this)) {
62
- return
187
+ _getActiveElem() {
188
+ return this._getChildren().find((child) => this._elemIsActive(child)) || null
63
189
  }
64
190
 
65
- const t = Tab.getOrCreateInstance(this)
66
- t.dispose()
67
- Tab.getOrCreateInstance(this).show()
68
- })
191
+ _setInitialAttributes(parent, children) {
192
+ this._setAttributeIfNotExists(parent, 'role', 'tablist')
69
193
 
70
- /**
71
- * Initialize on focus
72
- */
73
- EventHandler.on(window, EVENT_LOAD_DATA_API, () => {
74
- for (const element of SelectorEngine.find(SELECTOR_DATA_TOGGLE_ACTIVE)) {
75
- const t = Tab.getOrCreateInstance(element)
76
- t.dispose()
77
- Tab.getOrCreateInstance(element)
194
+ for (const child of children) {
195
+ this._setInitialAttributesOnChild(child)
196
+ }
197
+ }
198
+
199
+ _setInitialAttributesOnChild(child) {
200
+ child = this._getInnerElement(child)
201
+ const isActive = this._elemIsActive(child)
202
+ const outerElem = this._getOuterElement(child)
203
+ child.setAttribute('aria-selected', isActive)
204
+
205
+ if (outerElem !== child) {
206
+ this._setAttributeIfNotExists(outerElem, 'role', 'presentation')
207
+ }
208
+
209
+ if (!isActive) {
210
+ child.setAttribute('tabindex', '-1')
211
+ }
212
+
213
+ this._setAttributeIfNotExists(child, 'role', 'tab')
214
+
215
+ // set attributes to the related panel too
216
+ this._setInitialAttributesOnTargetPanel(child)
217
+ }
218
+
219
+ _setInitialAttributesOnTargetPanel(child) {
220
+ const target = getElementFromSelector(child)
221
+
222
+ if (!target) {
223
+ return
224
+ }
225
+
226
+ this._setAttributeIfNotExists(target, 'role', 'tabpanel')
227
+
228
+ if (child.id) {
229
+ this._setAttributeIfNotExists(target, 'aria-labelledby', `#${child.id}`)
230
+ }
231
+ }
232
+
233
+ _toggleDropDown(element, open) {
234
+ const outerElem = this._getOuterElement(element)
235
+ if (!outerElem.classList.contains(CLASS_DROPDOWN)) {
236
+ return
237
+ }
238
+
239
+ const toggle = (selector, className) => {
240
+ const element = SelectorEngine.findOne(selector, outerElem)
241
+ if (element) {
242
+ element.classList.toggle(className, open)
243
+ }
244
+ }
245
+
246
+ toggle(SELECTOR_DROPDOWN_TOGGLE, CLASS_NAME_ACTIVE)
247
+ toggle(SELECTOR_DROPDOWN_MENU, CLASS_NAME_SHOW)
248
+ outerElem.setAttribute('aria-expanded', open)
249
+ }
250
+
251
+ _setAttributeIfNotExists(element, attribute, value) {
252
+ if (!element.hasAttribute(attribute)) {
253
+ element.setAttribute(attribute, value)
254
+ }
255
+ }
256
+
257
+ _elemIsActive(elem) {
258
+ return elem.classList.contains(CLASS_NAME_ACTIVE)
259
+ }
260
+
261
+ // Try to get the inner element (usually the .nav-link)
262
+ _getInnerElement(elem) {
263
+ return elem.matches(SELECTOR_INNER_ELEM) ? elem : SelectorEngine.findOne(SELECTOR_INNER_ELEM, elem)
78
264
  }
79
- })
265
+
266
+ // Try to get the outer element (usually the .nav-item)
267
+ _getOuterElement(elem) {
268
+ return elem.closest(SELECTOR_OUTER) || elem
269
+ }
270
+ }
271
+
80
272
  /**
81
- * jQuery
273
+ * Data API implementation
82
274
  */
83
275
 
84
- defineJQueryPlugin(Tab)
276
+ if (typeof window !== 'undefined' && typeof document !== 'undefined') {
277
+ EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) {
278
+ if (['A', 'AREA'].includes(this.tagName)) {
279
+ event.preventDefault()
280
+ }
281
+
282
+ if (isDisabled(this)) {
283
+ return
284
+ }
285
+ const t = Tab.getOrCreateInstance(this)
286
+ t.dispose()
287
+ Tab.getOrCreateInstance(this).show()
288
+ })
289
+
290
+ /**
291
+ * Initialize on focus
292
+ */
293
+ EventHandler.on(window, EVENT_LOAD_DATA_API, () => {
294
+ for (const element of SelectorEngine.find(SELECTOR_DATA_TOGGLE)) {
295
+ const t = Tab.getOrCreateInstance(element)
296
+ t.dispose()
297
+ Tab.getOrCreateInstance(element)
298
+ }
299
+ })
300
+ }
85
301
 
86
302
  export default Tab