@graupl/graupl 1.0.0-beta.10 → 1.0.0-beta.12

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 (480) hide show
  1. package/dist/js/accordion.js +5 -0
  2. package/dist/js/accordion.js.map +1 -0
  3. package/dist/js/alert.js +5 -0
  4. package/dist/js/alert.js.map +1 -0
  5. package/dist/js/carousel.js +5 -0
  6. package/dist/js/carousel.js.map +1 -0
  7. package/dist/js/component/accordion.cjs.js +5 -0
  8. package/dist/js/component/accordion.cjs.js.map +1 -0
  9. package/dist/js/component/accordion.es.js +5 -0
  10. package/dist/js/component/accordion.es.js.map +1 -0
  11. package/dist/js/component/accordion.iife.js +5 -0
  12. package/dist/js/component/accordion.iife.js.map +1 -0
  13. package/dist/js/component/alert.cjs.js +5 -0
  14. package/dist/js/component/alert.cjs.js.map +1 -0
  15. package/dist/js/component/alert.es.js +5 -0
  16. package/dist/js/component/alert.es.js.map +1 -0
  17. package/dist/js/component/alert.iife.js +5 -0
  18. package/dist/js/component/alert.iife.js.map +1 -0
  19. package/dist/js/component/carousel.cjs.js +5 -0
  20. package/dist/js/component/carousel.cjs.js.map +1 -0
  21. package/dist/js/component/carousel.es.js +5 -0
  22. package/dist/js/component/carousel.es.js.map +1 -0
  23. package/dist/js/component/carousel.iife.js +5 -0
  24. package/dist/js/component/carousel.iife.js.map +1 -0
  25. package/dist/js/generator/accordion.cjs.js +5 -0
  26. package/dist/js/generator/accordion.cjs.js.map +1 -0
  27. package/dist/js/generator/accordion.es.js +5 -0
  28. package/dist/js/generator/accordion.es.js.map +1 -0
  29. package/dist/js/generator/accordion.iife.js +5 -0
  30. package/dist/js/generator/accordion.iife.js.map +1 -0
  31. package/dist/js/generator/alert.cjs.js +5 -0
  32. package/dist/js/generator/alert.cjs.js.map +1 -0
  33. package/dist/js/generator/alert.es.js +5 -0
  34. package/dist/js/generator/alert.es.js.map +1 -0
  35. package/dist/js/generator/alert.iife.js +5 -0
  36. package/dist/js/generator/alert.iife.js.map +1 -0
  37. package/dist/js/generator/carousel.cjs.js +5 -0
  38. package/dist/js/generator/carousel.cjs.js.map +1 -0
  39. package/dist/js/generator/carousel.es.js +5 -0
  40. package/dist/js/generator/carousel.es.js.map +1 -0
  41. package/dist/js/generator/carousel.iife.js +5 -0
  42. package/dist/js/generator/carousel.iife.js.map +1 -0
  43. package/dist/js/generator/navigation.cjs.js +3 -0
  44. package/dist/js/generator/navigation.cjs.js.map +1 -0
  45. package/dist/js/generator/navigation.es.js +3 -0
  46. package/dist/js/generator/navigation.es.js.map +1 -0
  47. package/dist/js/generator/navigation.iife.js +3 -0
  48. package/dist/js/generator/navigation.iife.js.map +1 -0
  49. package/dist/js/graupl.js +9 -0
  50. package/dist/js/graupl.js.map +1 -0
  51. package/dist/js/navigation.js +3 -0
  52. package/dist/js/navigation.js.map +1 -0
  53. package/package.json +24 -14
  54. package/.browserslistrc +0 -3
  55. package/.czrc +0 -3
  56. package/.devcontainer/devcontainer.json +0 -221
  57. package/.editorconfig +0 -13
  58. package/.env +0 -3
  59. package/.github/CODE_OF_CONDUCT.md +0 -73
  60. package/.github/COMMIT_CONVENTION.md +0 -17
  61. package/.github/CONTRIBUTING.md +0 -86
  62. package/.github/ISSUE_TEMPLATE/bug_report.md +0 -30
  63. package/.github/ISSUE_TEMPLATE/documentation.md +0 -20
  64. package/.github/ISSUE_TEMPLATE/feature_request.md +0 -20
  65. package/.github/SECURITY.md +0 -26
  66. package/.github/dependabot.yml +0 -17
  67. package/.github/pull_request_template.md +0 -5
  68. package/.github/workflows/codeql-analysis.yml +0 -71
  69. package/.github/workflows/docs.yml +0 -66
  70. package/.github/workflows/prerelease.yml +0 -125
  71. package/.github/workflows/release.yml +0 -111
  72. package/.github/workflows/test.yml +0 -78
  73. package/.husky/commit-msg +0 -3
  74. package/.husky/pre-commit +0 -4
  75. package/.prettierignore +0 -12
  76. package/.stylelintignore +0 -9
  77. package/.versionrc.cjs +0 -73
  78. package/.vscode/settings.json +0 -10
  79. package/CHANGELOG.md +0 -559
  80. package/build.js +0 -9
  81. package/combine-at-rules.cjs +0 -61
  82. package/commitlint.config.js +0 -5
  83. package/container/.env +0 -26
  84. package/container/build/app.dockerfile +0 -41
  85. package/container/docker-compose.yml +0 -27
  86. package/dist/js/graupl.cjs.js +0 -7
  87. package/dist/js/graupl.esm.js +0 -2561
  88. package/dist/js/graupl.iife.js +0 -7
  89. package/docs/.vitepress/config.js +0 -108
  90. package/docs/.vitepress/theme/custom.scss +0 -35
  91. package/docs/.vitepress/theme/index.js +0 -4
  92. package/docs/compiling-graupl.md +0 -57
  93. package/docs/components/alert.md +0 -130
  94. package/docs/components/button.md +0 -84
  95. package/docs/components/card.md +0 -369
  96. package/docs/components/index.md +0 -1
  97. package/docs/components/inputgroup.md +0 -159
  98. package/docs/components/menu.md +0 -326
  99. package/docs/components/navigation.md +0 -158
  100. package/docs/content.md +0 -237
  101. package/docs/defaults.md +0 -121
  102. package/docs/forms.md +0 -79
  103. package/docs/functions.md +0 -9
  104. package/docs/getting-started.md +0 -1
  105. package/docs/index.md +0 -1
  106. package/docs/introduction.md +0 -25
  107. package/docs/layout.md +0 -200
  108. package/docs/mixins.md +0 -47
  109. package/docs/state.md +0 -67
  110. package/docs/theme.md +0 -258
  111. package/docs/utilities/alignment.md +0 -411
  112. package/docs/utilities/background.md +0 -192
  113. package/docs/utilities/border.md +0 -268
  114. package/docs/utilities/color.md +0 -348
  115. package/docs/utilities/container.md +0 -3
  116. package/docs/utilities/display.md +0 -3
  117. package/docs/utilities/flex.md +0 -3
  118. package/docs/utilities/gradient.md +0 -3
  119. package/docs/utilities/height.md +0 -3
  120. package/docs/utilities/inset.md +0 -3
  121. package/docs/utilities/justification.md +0 -3
  122. package/docs/utilities/list.md +0 -3
  123. package/docs/utilities/order.md +0 -3
  124. package/docs/utilities/position.md +0 -3
  125. package/docs/utilities/ratio.md +0 -3
  126. package/docs/utilities/responsive-classes.md +0 -3
  127. package/docs/utilities/spacing.md +0 -3
  128. package/docs/utilities/typography.md +0 -3
  129. package/docs/utilities/visibility.md +0 -3
  130. package/docs/utilities/visually-hidden.md +0 -3
  131. package/docs/utilities/width.md +0 -3
  132. package/docs/utilities/z-index.md +0 -3
  133. package/docs/utilities.md +0 -357
  134. package/eslint.config.js +0 -74
  135. package/favicon.ico +0 -0
  136. package/index.html +0 -1214
  137. package/index.js +0 -12
  138. package/lint-staged.config.js +0 -6
  139. package/logo.svg +0 -296
  140. package/packages/core/build.js +0 -9
  141. package/packages/core/dist/css/base/button.css +0 -2
  142. package/packages/core/dist/css/base/button.css.map +0 -1
  143. package/packages/core/dist/css/base/form.css +0 -2
  144. package/packages/core/dist/css/base/form.css.map +0 -1
  145. package/packages/core/dist/css/base/link.css +0 -2
  146. package/packages/core/dist/css/base/link.css.map +0 -1
  147. package/packages/core/dist/css/base/table.css +0 -2
  148. package/packages/core/dist/css/base/table.css.map +0 -1
  149. package/packages/core/dist/css/base.css +0 -2
  150. package/packages/core/dist/css/base.css.map +0 -1
  151. package/packages/core/dist/css/component/accordion.css +0 -5
  152. package/packages/core/dist/css/component/accordion.css.map +0 -1
  153. package/packages/core/dist/css/component/alert.css +0 -2
  154. package/packages/core/dist/css/component/alert.css.map +0 -1
  155. package/packages/core/dist/css/component/card.css +0 -2
  156. package/packages/core/dist/css/component/card.css.map +0 -1
  157. package/packages/core/dist/css/component/carousel.css +0 -2
  158. package/packages/core/dist/css/component/carousel.css.map +0 -1
  159. package/packages/core/dist/css/component/input-group.css +0 -2
  160. package/packages/core/dist/css/component/input-group.css.map +0 -1
  161. package/packages/core/dist/css/component/list.css +0 -2
  162. package/packages/core/dist/css/component/list.css.map +0 -1
  163. package/packages/core/dist/css/component/menu.css +0 -2
  164. package/packages/core/dist/css/component/menu.css.map +0 -1
  165. package/packages/core/dist/css/component/navigation.css +0 -2
  166. package/packages/core/dist/css/component/navigation.css.map +0 -1
  167. package/packages/core/dist/css/component.css +0 -5
  168. package/packages/core/dist/css/component.css.map +0 -1
  169. package/packages/core/dist/css/graupl.css +0 -5
  170. package/packages/core/dist/css/graupl.css.map +0 -1
  171. package/packages/core/dist/css/init.css +0 -2
  172. package/packages/core/dist/css/init.css.map +0 -1
  173. package/packages/core/dist/css/layout/columns.css +0 -2
  174. package/packages/core/dist/css/layout/columns.css.map +0 -1
  175. package/packages/core/dist/css/layout/container.css +0 -2
  176. package/packages/core/dist/css/layout/container.css.map +0 -1
  177. package/packages/core/dist/css/layout/flex-columns.css +0 -2
  178. package/packages/core/dist/css/layout/flex-columns.css.map +0 -1
  179. package/packages/core/dist/css/layout.css +0 -5
  180. package/packages/core/dist/css/layout.css.map +0 -1
  181. package/packages/core/dist/css/normalize.css +0 -2
  182. package/packages/core/dist/css/normalize.css.map +0 -1
  183. package/packages/core/dist/css/state/focus.css +0 -2
  184. package/packages/core/dist/css/state/focus.css.map +0 -1
  185. package/packages/core/dist/css/state.css +0 -2
  186. package/packages/core/dist/css/state.css.map +0 -1
  187. package/packages/core/dist/css/theme/color.css +0 -2
  188. package/packages/core/dist/css/theme/color.css.map +0 -1
  189. package/packages/core/dist/css/theme/typography.css +0 -2
  190. package/packages/core/dist/css/theme/typography.css.map +0 -1
  191. package/packages/core/dist/css/theme.css +0 -2
  192. package/packages/core/dist/css/theme.css.map +0 -1
  193. package/packages/core/dist/css/utilities/alignment.css +0 -2
  194. package/packages/core/dist/css/utilities/alignment.css.map +0 -1
  195. package/packages/core/dist/css/utilities/background.css +0 -2
  196. package/packages/core/dist/css/utilities/background.css.map +0 -1
  197. package/packages/core/dist/css/utilities/border.css +0 -2
  198. package/packages/core/dist/css/utilities/border.css.map +0 -1
  199. package/packages/core/dist/css/utilities/color.css +0 -2
  200. package/packages/core/dist/css/utilities/color.css.map +0 -1
  201. package/packages/core/dist/css/utilities/container.css +0 -2
  202. package/packages/core/dist/css/utilities/container.css.map +0 -1
  203. package/packages/core/dist/css/utilities/display.css +0 -2
  204. package/packages/core/dist/css/utilities/display.css.map +0 -1
  205. package/packages/core/dist/css/utilities/flex.css +0 -2
  206. package/packages/core/dist/css/utilities/flex.css.map +0 -1
  207. package/packages/core/dist/css/utilities/gradient.css +0 -2
  208. package/packages/core/dist/css/utilities/gradient.css.map +0 -1
  209. package/packages/core/dist/css/utilities/height.css +0 -2
  210. package/packages/core/dist/css/utilities/height.css.map +0 -1
  211. package/packages/core/dist/css/utilities/inset.css +0 -2
  212. package/packages/core/dist/css/utilities/inset.css.map +0 -1
  213. package/packages/core/dist/css/utilities/justification.css +0 -2
  214. package/packages/core/dist/css/utilities/justification.css.map +0 -1
  215. package/packages/core/dist/css/utilities/list.css +0 -2
  216. package/packages/core/dist/css/utilities/list.css.map +0 -1
  217. package/packages/core/dist/css/utilities/order.css +0 -2
  218. package/packages/core/dist/css/utilities/order.css.map +0 -1
  219. package/packages/core/dist/css/utilities/position.css +0 -2
  220. package/packages/core/dist/css/utilities/position.css.map +0 -1
  221. package/packages/core/dist/css/utilities/ratio.css +0 -2
  222. package/packages/core/dist/css/utilities/ratio.css.map +0 -1
  223. package/packages/core/dist/css/utilities/spacing.css +0 -2
  224. package/packages/core/dist/css/utilities/spacing.css.map +0 -1
  225. package/packages/core/dist/css/utilities/typography.css +0 -2
  226. package/packages/core/dist/css/utilities/typography.css.map +0 -1
  227. package/packages/core/dist/css/utilities/visibility.css +0 -2
  228. package/packages/core/dist/css/utilities/visibility.css.map +0 -1
  229. package/packages/core/dist/css/utilities/visually-hidden.css +0 -2
  230. package/packages/core/dist/css/utilities/visually-hidden.css.map +0 -1
  231. package/packages/core/dist/css/utilities/width.css +0 -2
  232. package/packages/core/dist/css/utilities/width.css.map +0 -1
  233. package/packages/core/dist/css/utilities/z-index.css +0 -2
  234. package/packages/core/dist/css/utilities/z-index.css.map +0 -1
  235. package/packages/core/dist/css/utilities.css +0 -2
  236. package/packages/core/dist/css/utilities.css.map +0 -1
  237. package/packages/core/package.json +0 -58
  238. package/packages/core/scss/base/button.scss +0 -3
  239. package/packages/core/scss/base/form.scss +0 -3
  240. package/packages/core/scss/base/link.scss +0 -3
  241. package/packages/core/scss/base/table.scss +0 -3
  242. package/packages/core/scss/base.scss +0 -3
  243. package/packages/core/scss/component/accordion.scss +0 -3
  244. package/packages/core/scss/component/alert.scss +0 -3
  245. package/packages/core/scss/component/card.scss +0 -3
  246. package/packages/core/scss/component/carousel.scss +0 -3
  247. package/packages/core/scss/component/input-group.scss +0 -3
  248. package/packages/core/scss/component/list.scss +0 -3
  249. package/packages/core/scss/component/menu.scss +0 -3
  250. package/packages/core/scss/component/navigation.scss +0 -3
  251. package/packages/core/scss/component.scss +0 -3
  252. package/packages/core/scss/graupl.scss +0 -3
  253. package/packages/core/scss/init.scss +0 -3
  254. package/packages/core/scss/layout/columns.scss +0 -3
  255. package/packages/core/scss/layout/container.scss +0 -3
  256. package/packages/core/scss/layout/flex-columns.scss +0 -3
  257. package/packages/core/scss/layout.scss +0 -3
  258. package/packages/core/scss/normalize.scss +0 -3
  259. package/packages/core/scss/state/focus.scss +0 -3
  260. package/packages/core/scss/state.scss +0 -3
  261. package/packages/core/scss/theme/color.scss +0 -3
  262. package/packages/core/scss/theme/typography.scss +0 -3
  263. package/packages/core/scss/theme.scss +0 -3
  264. package/packages/core/scss/utilities/alignment.scss +0 -3
  265. package/packages/core/scss/utilities/background.scss +0 -3
  266. package/packages/core/scss/utilities/border.scss +0 -3
  267. package/packages/core/scss/utilities/color.scss +0 -3
  268. package/packages/core/scss/utilities/container.scss +0 -3
  269. package/packages/core/scss/utilities/display.scss +0 -3
  270. package/packages/core/scss/utilities/flex.scss +0 -3
  271. package/packages/core/scss/utilities/gradient.scss +0 -3
  272. package/packages/core/scss/utilities/height.scss +0 -3
  273. package/packages/core/scss/utilities/inset.scss +0 -3
  274. package/packages/core/scss/utilities/justification.scss +0 -3
  275. package/packages/core/scss/utilities/list.scss +0 -3
  276. package/packages/core/scss/utilities/order.scss +0 -3
  277. package/packages/core/scss/utilities/position.scss +0 -3
  278. package/packages/core/scss/utilities/ratio.scss +0 -3
  279. package/packages/core/scss/utilities/spacing.scss +0 -3
  280. package/packages/core/scss/utilities/typography.scss +0 -3
  281. package/packages/core/scss/utilities/visibility.scss +0 -3
  282. package/packages/core/scss/utilities/visually-hidden.scss +0 -3
  283. package/packages/core/scss/utilities/width.scss +0 -3
  284. package/packages/core/scss/utilities/z-index.scss +0 -3
  285. package/packages/core/scss/utilities.scss +0 -3
  286. package/packages/core/src/js/accordion/Accordion.js +0 -1163
  287. package/packages/core/src/js/accordion/AccordionItem.js +0 -496
  288. package/packages/core/src/js/accordion/index.js +0 -10
  289. package/packages/core/src/js/alert/Alert.js +0 -581
  290. package/packages/core/src/js/alert/index.js +0 -11
  291. package/packages/core/src/js/carousel/Carousel.js +0 -1427
  292. package/packages/core/src/js/carousel/index.js +0 -10
  293. package/packages/core/src/js/domHelpers.js +0 -37
  294. package/packages/core/src/js/eventHandlers.js +0 -39
  295. package/packages/core/src/js/navigation/index.js +0 -36
  296. package/packages/core/src/js/storage.js +0 -106
  297. package/packages/core/src/js/validate.js +0 -225
  298. package/packages/core/src/scss/_defaults.scss +0 -184
  299. package/packages/core/src/scss/_index.scss +0 -15
  300. package/packages/core/src/scss/_init.scss +0 -6
  301. package/packages/core/src/scss/_normalize.scss +0 -197
  302. package/packages/core/src/scss/_variables.scss +0 -95
  303. package/packages/core/src/scss/base/_index.scss +0 -6
  304. package/packages/core/src/scss/base/button/_defaults.scss +0 -49
  305. package/packages/core/src/scss/base/button/_index.scss +0 -206
  306. package/packages/core/src/scss/base/button/_mixins.scss +0 -104
  307. package/packages/core/src/scss/base/button/_variables.scss +0 -252
  308. package/packages/core/src/scss/base/form/_defaults.scss +0 -24
  309. package/packages/core/src/scss/base/form/_index.scss +0 -227
  310. package/packages/core/src/scss/base/form/_variables.scss +0 -245
  311. package/packages/core/src/scss/base/link/_defaults.scss +0 -35
  312. package/packages/core/src/scss/base/link/_index.scss +0 -245
  313. package/packages/core/src/scss/base/link/_variables.scss +0 -370
  314. package/packages/core/src/scss/base/table/_defaults.scss +0 -68
  315. package/packages/core/src/scss/base/table/_index.scss +0 -314
  316. package/packages/core/src/scss/base/table/_variables.scss +0 -309
  317. package/packages/core/src/scss/component/_index.scss +0 -10
  318. package/packages/core/src/scss/component/accordion/_defaults.scss +0 -40
  319. package/packages/core/src/scss/component/accordion/_index.scss +0 -198
  320. package/packages/core/src/scss/component/accordion/_variables.scss +0 -356
  321. package/packages/core/src/scss/component/alert/_defaults.scss +0 -49
  322. package/packages/core/src/scss/component/alert/_index.scss +0 -119
  323. package/packages/core/src/scss/component/alert/_variables.scss +0 -200
  324. package/packages/core/src/scss/component/card/_defaults.scss +0 -32
  325. package/packages/core/src/scss/component/card/_index.scss +0 -212
  326. package/packages/core/src/scss/component/card/_variables.scss +0 -216
  327. package/packages/core/src/scss/component/carousel/_defaults.scss +0 -43
  328. package/packages/core/src/scss/component/carousel/_index.scss +0 -192
  329. package/packages/core/src/scss/component/carousel/_variables.scss +0 -104
  330. package/packages/core/src/scss/component/input-group/_defaults.scss +0 -30
  331. package/packages/core/src/scss/component/input-group/_index.scss +0 -47
  332. package/packages/core/src/scss/component/input-group/_variables.scss +0 -66
  333. package/packages/core/src/scss/component/list/_defaults.scss +0 -15
  334. package/packages/core/src/scss/component/list/_index.scss +0 -52
  335. package/packages/core/src/scss/component/list/_variables.scss +0 -236
  336. package/packages/core/src/scss/component/menu/_defaults.scss +0 -57
  337. package/packages/core/src/scss/component/menu/_index.scss +0 -308
  338. package/packages/core/src/scss/component/menu/_variables.scss +0 -642
  339. package/packages/core/src/scss/component/navigation/_defaults.scss +0 -23
  340. package/packages/core/src/scss/component/navigation/_index.scss +0 -190
  341. package/packages/core/src/scss/component/navigation/_variables.scss +0 -290
  342. package/packages/core/src/scss/functions/_container.scss +0 -38
  343. package/packages/core/src/scss/functions/_important.scss +0 -36
  344. package/packages/core/src/scss/functions/_screen.scss +0 -38
  345. package/packages/core/src/scss/functions/_theme.scss +0 -39
  346. package/packages/core/src/scss/functions/_utility.scss +0 -28
  347. package/packages/core/src/scss/layout/_index.scss +0 -5
  348. package/packages/core/src/scss/layout/columns/_defaults.scss +0 -24
  349. package/packages/core/src/scss/layout/columns/_index.scss +0 -137
  350. package/packages/core/src/scss/layout/columns/_variables.scss +0 -55
  351. package/packages/core/src/scss/layout/container/_defaults.scss +0 -35
  352. package/packages/core/src/scss/layout/container/_index.scss +0 -628
  353. package/packages/core/src/scss/layout/container/_variables.scss +0 -114
  354. package/packages/core/src/scss/layout/flex-columns/_defaults.scss +0 -28
  355. package/packages/core/src/scss/layout/flex-columns/_index.scss +0 -184
  356. package/packages/core/src/scss/layout/flex-columns/_variables.scss +0 -30
  357. package/packages/core/src/scss/mixins/_animation.scss +0 -15
  358. package/packages/core/src/scss/mixins/_container.scss +0 -80
  359. package/packages/core/src/scss/mixins/_layer.scss +0 -16
  360. package/packages/core/src/scss/mixins/_screen.scss +0 -77
  361. package/packages/core/src/scss/mixins/_state.scss +0 -18
  362. package/packages/core/src/scss/mixins/_theme.scss +0 -15
  363. package/packages/core/src/scss/mixins/_utility.scss +0 -185
  364. package/packages/core/src/scss/mixins/_visually-hidden.scss +0 -30
  365. package/packages/core/src/scss/state/_index.scss +0 -3
  366. package/packages/core/src/scss/state/focus/_defaults.scss +0 -9
  367. package/packages/core/src/scss/state/focus/_index.scss +0 -42
  368. package/packages/core/src/scss/state/focus/_mixins.scss +0 -13
  369. package/packages/core/src/scss/state/focus/_variables.scss +0 -50
  370. package/packages/core/src/scss/theme/_index.scss +0 -4
  371. package/packages/core/src/scss/theme/color/_defaults.scss +0 -143
  372. package/packages/core/src/scss/theme/color/_index.scss +0 -42
  373. package/packages/core/src/scss/theme/color/_variables.scss +0 -133
  374. package/packages/core/src/scss/theme/typography/_defaults.scss +0 -54
  375. package/packages/core/src/scss/theme/typography/_index.scss +0 -120
  376. package/packages/core/src/scss/theme/typography/_variables.scss +0 -248
  377. package/packages/core/src/scss/utilities/_index.scss +0 -23
  378. package/packages/core/src/scss/utilities/_template/_defaults.scss +0 -41
  379. package/packages/core/src/scss/utilities/_template/_index.scss +0 -171
  380. package/packages/core/src/scss/utilities/_template/_variables.scss +0 -6
  381. package/packages/core/src/scss/utilities/alignment/_defaults.scss +0 -76
  382. package/packages/core/src/scss/utilities/alignment/_index.scss +0 -336
  383. package/packages/core/src/scss/utilities/alignment/_variables.scss +0 -6
  384. package/packages/core/src/scss/utilities/background/_defaults.scss +0 -122
  385. package/packages/core/src/scss/utilities/background/_index.scss +0 -634
  386. package/packages/core/src/scss/utilities/background/_variables.scss +0 -6
  387. package/packages/core/src/scss/utilities/border/_defaults.scss +0 -73
  388. package/packages/core/src/scss/utilities/border/_index.scss +0 -558
  389. package/packages/core/src/scss/utilities/border/_variables.scss +0 -6
  390. package/packages/core/src/scss/utilities/color/_defaults.scss +0 -49
  391. package/packages/core/src/scss/utilities/color/_index.scss +0 -469
  392. package/packages/core/src/scss/utilities/color/_variables.scss +0 -6
  393. package/packages/core/src/scss/utilities/container/_defaults.scss +0 -40
  394. package/packages/core/src/scss/utilities/container/_index.scss +0 -174
  395. package/packages/core/src/scss/utilities/container/_variables.scss +0 -6
  396. package/packages/core/src/scss/utilities/display/_defaults.scss +0 -47
  397. package/packages/core/src/scss/utilities/display/_index.scss +0 -184
  398. package/packages/core/src/scss/utilities/display/_variables.scss +0 -6
  399. package/packages/core/src/scss/utilities/flex/_defaults.scss +0 -99
  400. package/packages/core/src/scss/utilities/flex/_index.scss +0 -486
  401. package/packages/core/src/scss/utilities/flex/_variables.scss +0 -6
  402. package/packages/core/src/scss/utilities/gradient/_defaults.scss +0 -70
  403. package/packages/core/src/scss/utilities/gradient/_index.scss +0 -696
  404. package/packages/core/src/scss/utilities/gradient/_variables.scss +0 -29
  405. package/packages/core/src/scss/utilities/height/_defaults.scss +0 -54
  406. package/packages/core/src/scss/utilities/height/_index.scss +0 -525
  407. package/packages/core/src/scss/utilities/height/_variables.scss +0 -6
  408. package/packages/core/src/scss/utilities/inset/_defaults.scss +0 -55
  409. package/packages/core/src/scss/utilities/inset/_index.scss +0 -258
  410. package/packages/core/src/scss/utilities/inset/_variables.scss +0 -6
  411. package/packages/core/src/scss/utilities/justification/_defaults.scss +0 -73
  412. package/packages/core/src/scss/utilities/justification/_index.scss +0 -333
  413. package/packages/core/src/scss/utilities/justification/_variables.scss +0 -6
  414. package/packages/core/src/scss/utilities/list/_defaults.scss +0 -53
  415. package/packages/core/src/scss/utilities/list/_index.scss +0 -253
  416. package/packages/core/src/scss/utilities/list/_variables.scss +0 -6
  417. package/packages/core/src/scss/utilities/order/_defaults.scss +0 -36
  418. package/packages/core/src/scss/utilities/order/_index.scss +0 -246
  419. package/packages/core/src/scss/utilities/order/_variables.scss +0 -6
  420. package/packages/core/src/scss/utilities/position/_defaults.scss +0 -41
  421. package/packages/core/src/scss/utilities/position/_index.scss +0 -178
  422. package/packages/core/src/scss/utilities/position/_variables.scss +0 -6
  423. package/packages/core/src/scss/utilities/ratio/_defaults.scss +0 -42
  424. package/packages/core/src/scss/utilities/ratio/_index.scss +0 -188
  425. package/packages/core/src/scss/utilities/ratio/_variables.scss +0 -9
  426. package/packages/core/src/scss/utilities/spacing/_defaults.scss +0 -64
  427. package/packages/core/src/scss/utilities/spacing/_index.scss +0 -970
  428. package/packages/core/src/scss/utilities/spacing/_variables.scss +0 -6
  429. package/packages/core/src/scss/utilities/typography/_defaults.scss +0 -58
  430. package/packages/core/src/scss/utilities/typography/_index.scss +0 -1089
  431. package/packages/core/src/scss/utilities/typography/_variables.scss +0 -6
  432. package/packages/core/src/scss/utilities/visibility/_defaults.scss +0 -39
  433. package/packages/core/src/scss/utilities/visibility/_index.scss +0 -173
  434. package/packages/core/src/scss/utilities/visibility/_variables.scss +0 -6
  435. package/packages/core/src/scss/utilities/visually-hidden/_defaults.scss +0 -29
  436. package/packages/core/src/scss/utilities/visually-hidden/_index.scss +0 -189
  437. package/packages/core/src/scss/utilities/visually-hidden/_variables.scss +0 -6
  438. package/packages/core/src/scss/utilities/width/_defaults.scss +0 -54
  439. package/packages/core/src/scss/utilities/width/_index.scss +0 -525
  440. package/packages/core/src/scss/utilities/width/_variables.scss +0 -6
  441. package/packages/core/src/scss/utilities/z-index/_defaults.scss +0 -40
  442. package/packages/core/src/scss/utilities/z-index/_index.scss +0 -173
  443. package/packages/core/src/scss/utilities/z-index/_variables.scss +0 -6
  444. package/packages/core/vite.config.js +0 -28
  445. package/packages/icons/dist/css/base/button.css +0 -2
  446. package/packages/icons/dist/css/base/button.css.map +0 -1
  447. package/packages/icons/dist/css/base/link.css +0 -2
  448. package/packages/icons/dist/css/base/link.css.map +0 -1
  449. package/packages/icons/dist/css/base.css +0 -2
  450. package/packages/icons/dist/css/base.css.map +0 -1
  451. package/packages/icons/dist/css/component/icon.css +0 -2
  452. package/packages/icons/dist/css/component/icon.css.map +0 -1
  453. package/packages/icons/dist/css/component.css +0 -2
  454. package/packages/icons/dist/css/component.css.map +0 -1
  455. package/packages/icons/dist/css/icon.css +0 -2
  456. package/packages/icons/dist/css/icon.css.map +0 -1
  457. package/packages/icons/package.json +0 -48
  458. package/packages/icons/scss/base/button.scss +0 -3
  459. package/packages/icons/scss/base/link.scss +0 -3
  460. package/packages/icons/scss/base.scss +0 -3
  461. package/packages/icons/scss/component/icon.scss +0 -3
  462. package/packages/icons/scss/component.scss +0 -3
  463. package/packages/icons/scss/icon.scss +0 -3
  464. package/packages/icons/src/scss/_index.scss +0 -4
  465. package/packages/icons/src/scss/base/_index.scss +0 -4
  466. package/packages/icons/src/scss/base/button/_defaults.scss +0 -7
  467. package/packages/icons/src/scss/base/button/_index.scss +0 -58
  468. package/packages/icons/src/scss/base/button/_variables.scss +0 -7
  469. package/packages/icons/src/scss/base/link/_defaults.scss +0 -7
  470. package/packages/icons/src/scss/base/link/_index.scss +0 -58
  471. package/packages/icons/src/scss/base/link/_variables.scss +0 -7
  472. package/packages/icons/src/scss/component/_index.scss +0 -3
  473. package/packages/icons/src/scss/component/icon/_defaults.scss +0 -30
  474. package/packages/icons/src/scss/component/icon/_index.scss +0 -60
  475. package/packages/icons/src/scss/component/icon/_mixins.scss +0 -62
  476. package/packages/icons/src/scss/component/icon/_variables.scss +0 -24
  477. package/postcss.config.cjs +0 -11
  478. package/prettier.config.js +0 -16
  479. package/stylelint.config.js +0 -22
  480. package/vite.config.js +0 -28
@@ -1,1427 +0,0 @@
1
- /**
2
- * @file
3
- * The carousel class.
4
- */
5
-
6
- import { addClass, removeClass } from "../domHelpers.js";
7
- import { preventEvent, keyPress } from "../eventHandlers.js";
8
- import storage from "../storage.js";
9
- import {
10
- isQuerySelector,
11
- isTag,
12
- isValidClassList,
13
- isValidInstance,
14
- isValidType,
15
- } from "../validate.js";
16
-
17
- class Carousel {
18
- /**
19
- * The DOM elements within the carousel.
20
- *
21
- * @protected
22
- *
23
- * @type {Object<HTMLElement, HTMLElement[]>}
24
- *
25
- * @property {HTMLElement} carousel - The carousel element.
26
- * @property {HTMLElement[]} carouselItems - The carousel items.
27
- * @property {HTMLElement} carouselItemContainer - The carousel item container.
28
- * @property {HTMLElement[]} carouselControls - The carousel controls.
29
- * @property {HTMLElement} carouselControlContainer - The carousel control container.
30
- * @property {HTMLElement[]} carouselTabs - The carousel tabs.
31
- * @property {HTMLElement} carouselTabContainer - The carousel tab container.
32
- * @property {HTMLElement} autoplay - The autoplay button.
33
- * @property {HTMLElement} next - The next button.
34
- * @property {HTMLElement} previous - The previous button.
35
- */
36
- _dom = {
37
- carousel: null,
38
- carouselItems: [],
39
- carouselItemContainer: null,
40
- carouselControls: [],
41
- carouselControlContainer: null,
42
- carouselTabs: [],
43
- carouselTabContainer: null,
44
- autoplay: null,
45
- next: null,
46
- previous: null,
47
- };
48
-
49
- /**
50
- * The query selectors used by the carousel to populate the dom.
51
- *
52
- * @protected
53
- *
54
- * @type {Object<string>}
55
- *
56
- * @property {string} carouselItems - The query selector string for carousel items.
57
- * @property {string} carouselItemContainer - The query selector string for the carousel item container.
58
- * @property {string} carouselControls - The query selector string for carousel controls.
59
- * @property {string} carouselControlContainer - The query selector string for carousel control container.
60
- * @property {string} carouselTabs - The query selector string for the carousel tabs.
61
- * @property {string} carouselTabContainer - The query selector string for the carousel tab container.
62
- * @property {string} autoplay - The query selector string for the autoplay button.
63
- * @property {string} next - The query selector string for the next button.
64
- * @property {string} previous - The query selector string for the previous button.
65
- */
66
- _selectors = {
67
- carouselItems: "",
68
- carouselItemContainer: "",
69
- carouselControls: "",
70
- carouselControlContainer: "",
71
- carouselTabs: "",
72
- carouselTabContainer: "",
73
- autoplay: "",
74
- next: "",
75
- previous: "",
76
- };
77
-
78
- /**
79
- * The class(es) to apply when a carousel item is active.
80
- *
81
- * @protected
82
- *
83
- * @type {string|string[]}
84
- */
85
- _activeClass = "active";
86
-
87
- /**
88
- * The class(es) to apply to a carousel item that is the previously active item.
89
- *
90
- * @protected
91
- *
92
- * @type {string|string[]}
93
- */
94
- _previousClass = "previous";
95
-
96
- /**
97
- * The class(es) to apply to a carousel item that is the next active item.
98
- *
99
- * @protected
100
- *
101
- * @type {string|string[]}
102
- */
103
- _nextClass = "next";
104
-
105
- /**
106
- * The class(es) to apply to the autoplay button when the carousel is paused.
107
- *
108
- * @protected
109
- *
110
- * @type {string|string[]}
111
- */
112
- _playClass = "play";
113
-
114
- /**
115
- * The class(es) to apply to the autoplay button when the carousel is playing.
116
- *
117
- * @protected
118
- *
119
- * @type {string|string[]}
120
- */
121
- _pauseClass = "pause";
122
-
123
- /**
124
- * The index of the currently active carousel item.
125
- *
126
- * @protected
127
- *
128
- * @type {number}
129
- */
130
- _currentItem = 0;
131
-
132
- /**
133
- * A flag to indicate if the carousel is currently playing.
134
- *
135
- * @protected
136
- *
137
- * @type {boolean}
138
- */
139
- _autoplay = true;
140
-
141
- /**
142
- * A variable to delay transition slides in milliseconds.
143
- *
144
- * @protected
145
- *
146
- * @type {number}
147
- */
148
- _transitionDelay = 10000;
149
-
150
- /**
151
- * The duration time (in milliseconds) for the transition between carousel items.
152
- *
153
- * @protected
154
- *
155
- * @type {number}
156
- */
157
- _transitionDuration = 500;
158
-
159
- /**
160
- * The label for the autoplay button when the carousel is paused.
161
- *
162
- * @protected
163
- *
164
- * @type {string}
165
- */
166
- _playText = "Play";
167
-
168
- /**
169
- * The label for the autoplay button when the carousel is playing.
170
- *
171
- * @protected
172
- *
173
- * @type {string}
174
- */
175
- _pauseText = "Pause";
176
-
177
- /**
178
- * The current action being performed by the carousel.
179
- *
180
- * @protected
181
- *
182
- * @type {string}
183
- */
184
- _currentAction = "next";
185
-
186
- /**
187
- * The stored interval callback for autoplaying the carousel.
188
- *
189
- * @protected
190
- *
191
- * @type {?Function}
192
- */
193
- _autoplayInterval = null;
194
-
195
- /**
196
- * The prefix to use for CSS custom properties.
197
- *
198
- * @protected
199
- *
200
- * @type {string}
201
- */
202
- _prefix = "graupl-";
203
-
204
- /**
205
- * The key used to generate IDs throughout the carousel.
206
- *
207
- * @protected
208
- *
209
- * @type {string}
210
- */
211
- _key = "";
212
-
213
- /**
214
- * An array of error messages generated by the carousel.
215
- *
216
- * @protected
217
- *
218
- * @type {string[]}
219
- */
220
- _errors = [];
221
-
222
- /**
223
- * Contructs a new `Carousel`.
224
- *
225
- * @param {object} options - The options for the generated carousel.
226
- * @param {HTMLElement} options.carouselElement - The carousel element in the DOM.
227
- * @param {string} [options.carouselItemSelector = .carousel-item] - The query selector string for carousel items.
228
- * @param {string} [options.carouselItemContainerSelector = .carousel-item-container] - The query selector string for the carousel item container.
229
- * @param {string} [options.carouselControlSelector = .carousel-control] - The query selector string for carousel controls.
230
- * @param {string} [options.carouselControlContainerSelector = .carousel-control-container] - The query selector string for carousel control container.
231
- * @param {string} [options.carouselTabSelector = .carousel-tab] - The query selector string for carousel tabs.
232
- * @param {string} [options.carouselTabContainerSelector = .carousel-tab-container] - The query selector string for the carousel tab container.
233
- * @param {string} [options.autoplaySelector = .autoplay] - The query selector string for the autoplay button.
234
- * @param {string} [options.nextSelector = .next] - The query selector string for the next button.
235
- * @param {string} [options.previousSelector = .previous] - The query selector string for the previous button.
236
- * @param {?(string|string[])} [options.activeClass = active] - The class(es) to apply when a carousel item is active.
237
- * @param {?(string|string[])} [options.previousClass = previous] - The class(es) to apply to a carousel item that is the previously active item.
238
- * @param {?(string|string[])} [options.nextClass = next] - The class(es) to apply to a carousel item that is the next active item.
239
- * @param {?(string|string[])} [options.playClass = play] - The class(es) to apply to the autoplay button when the carousel is paused.
240
- * @param {?(string|string[])} [options.pauseClass = pause] - The class(es) to apply to the autoplay button when the carousel is playing.
241
- * @param {boolean} [options.autoplay = true] - A flag to indicate if the carousel should autoplay.
242
- * @param {number} [options.transitionDelay = 10000] - A flag to initialize the carousel immediately upon creation.
243
- * @param {number} [options.transitionDuration = 500] - The duration time (in milliseconds) for the transition between carousel items.
244
- * @param {?string} [options.playText = Play] - The text to use for the play button.
245
- * @param {?string} [options.pauseText = Pause] - The text to use for the pause button.
246
- * @param {?string} [options.prefix = graupl-] - The prefix to use for CSS custom properties.
247
- * @param {?string} [options.key = null] - The key used to generate IDs throughout the carousel.
248
- * @param {boolean} [options.initialize = false] - A flag to initialize the carousel immediately upon creation.
249
- */
250
- constructor({
251
- carouselElement,
252
- carouselItemSelector = ".carousel-item",
253
- carouselItemContainerSelector = ".carousel-item-container",
254
- carouselControlSelector = ".carousel-control",
255
- carouselControlContainerSelector = ".carousel-control-container",
256
- carouselTabSelector = ".carousel-tab",
257
- carouselTabContainerSelector = ".carousel-tab-container",
258
- autoplaySelector = ".autoplay",
259
- nextSelector = ".next",
260
- previousSelector = ".previous",
261
- activeClass = "active",
262
- previousClass = "previous",
263
- nextClass = "next",
264
- playClass = "play",
265
- pauseClass = "pause",
266
- autoplay = true,
267
- transitionDelay = 10000,
268
- transitionDuration = 500,
269
- playText = "Play",
270
- pauseText = "Pause",
271
- prefix = "graupl-",
272
- key = null,
273
- initialize = false,
274
- }) {
275
- // Set DOM elements.
276
- this._dom.carousel = carouselElement;
277
-
278
- // Set query selectors.
279
- this._selectors.carouselItems = carouselItemSelector;
280
- this._selectors.carouselItemContainer = carouselItemContainerSelector;
281
- this._selectors.carouselControls = carouselControlSelector;
282
- this._selectors.carouselControlContainer = carouselControlContainerSelector;
283
- this._selectors.carouselTabs = carouselTabSelector;
284
- this._selectors.carouselTabContainer = carouselTabContainerSelector;
285
- this._selectors.autoplay = autoplaySelector;
286
- this._selectors.next = nextSelector;
287
- this._selectors.previous = previousSelector;
288
-
289
- // Set class names.
290
- this._activeClass = activeClass || "";
291
- this._previousClass = previousClass || "";
292
- this._nextClass = nextClass || "";
293
- this._playClass = playClass || "";
294
- this._pauseClass = pauseClass || "";
295
-
296
- // Set flags.
297
- this._autoplay = autoplay;
298
-
299
- // Set transition options.
300
- this._transitionDelay = transitionDelay;
301
- this._transitionDuration = transitionDuration;
302
-
303
- // Set labels.
304
- this._playText = playText || "";
305
- this._pauseText = pauseText || "";
306
-
307
- // Set prefix.
308
- this._prefix = prefix || "";
309
-
310
- // Set the key.
311
- this._key = key || "";
312
-
313
- if (initialize) {
314
- this.initialize();
315
- }
316
- }
317
-
318
- /**
319
- * Initializes the carousel.
320
- */
321
- initialize() {
322
- try {
323
- if (!this._validate()) {
324
- throw new Error(
325
- `Graupl Carousel: cannot initialize carousel. The following errors have been found:\n - ${this.errors.join(
326
- "\n - "
327
- )}`
328
- );
329
- }
330
-
331
- // Set up the DOM.
332
- this._generateKey();
333
- this._setDOMElements();
334
- this._setIds();
335
- this._setAriaAttributes();
336
-
337
- // Activate the first item.
338
- this.activateFirstItem();
339
-
340
- // Handle events.
341
- this._handleAutoplay();
342
- this._handleFocus();
343
- this._handleClick();
344
- this._handleHover();
345
- this._handleKeydown();
346
- this._handleKeyup();
347
-
348
- // Set the custom props.
349
- this._setTransitionDuration();
350
-
351
- // Set up the storage.
352
- storage.initializeStorage("carousels");
353
- storage.pushToStorage("carousels", this.dom.carousel.id, this);
354
- } catch (error) {
355
- console.error(error);
356
- }
357
- }
358
-
359
- /**
360
- * The HTML elements for the carousel in the DOM.
361
- *
362
- * @readonly
363
- *
364
- * @type {Object<HTMLElement>}
365
- *
366
- * @see _dom
367
- */
368
- get dom() {
369
- return this._dom;
370
- }
371
-
372
- /**
373
- * The query selectors used by the carousel to populate the dom.
374
- *
375
- * @readonly
376
- *
377
- * @type {Object<string>}
378
- *
379
- * @see _selectors
380
- */
381
- get selectors() {
382
- return this._selectors;
383
- }
384
-
385
- /**
386
- * The class(es) to apply when a carousel item is active.
387
- *
388
- * @type {string|string[]}
389
- *
390
- * @see _activeClass
391
- */
392
- get activeClass() {
393
- return this._activeClass;
394
- }
395
-
396
- /**
397
- * The class(es) to apply to a carousel item that is the next active item.
398
- *
399
- * @type {string|string[]}
400
- *
401
- * @see _previousClass
402
- */
403
- get previousClass() {
404
- return this._previousClass;
405
- }
406
-
407
- /**
408
- * The class(es) to apply to a carousel item that is the next active item.
409
- *
410
- * @type {string|string[]}
411
- *
412
- * @see _nextClass
413
- */
414
- get nextClass() {
415
- return this._nextClass;
416
- }
417
-
418
- /**
419
- * The class(es) to apply to the autoplay button when the carousel is paused.
420
- *
421
- * @type {string|string[]}
422
- *
423
- * @see _playClass
424
- */
425
- get playClass() {
426
- return this._playClass;
427
- }
428
-
429
- /**
430
- * The class(es) to apply to the autoplay button when the carousel is playing.
431
- *
432
- * @type {string|string[]}
433
- *
434
- * @see _pauseClass
435
- */
436
- get pauseClass() {
437
- return this._pauseClass;
438
- }
439
-
440
- /**
441
- * The index of the currently active carousel item.
442
- *
443
- * @type {number}
444
- *
445
- * @see _currentItem
446
- */
447
- get currentItem() {
448
- return this._currentItem;
449
- }
450
-
451
- /**
452
- * The currently active carousel item.
453
- *
454
- * @readonly
455
- *
456
- * @type {HTMLElement}
457
- */
458
- get currentCarouselItem() {
459
- return this.dom.carouselItems[this.currentItem];
460
- }
461
-
462
- /**
463
- * The currently active carousel tab.
464
- *
465
- * @readonly
466
- *
467
- * @type {HTMLElement}
468
- */
469
- get currentCarouselTab() {
470
- return this.dom.carouselTabs[this.currentItem];
471
- }
472
-
473
- /**
474
- * A flag to indicate if the carousel is currently playing.
475
- *
476
- * @type {boolean}
477
- *
478
- * @see _autoplay
479
- */
480
- get autoplay() {
481
- return this._autoplay;
482
- }
483
-
484
- /**
485
- * The delay in milliseconds before transitioning slides.
486
- *
487
- * @type {number}
488
- *
489
- * @see _transitionDelay
490
- */
491
- get transitionDelay() {
492
- return this._transitionDelay;
493
- }
494
-
495
- /**
496
- * The duration time (in milliseconds) for the transition between carousel items.
497
- *
498
- * @type {number}
499
- *
500
- * @see _transitionDuration
501
- */
502
- get transitionDuration() {
503
- return this._transitionDuration;
504
- }
505
-
506
- /**
507
- * The label for the autoplay button when the carousel is paused.
508
- *
509
- * @type {string}
510
- *
511
- * @see _playText
512
- */
513
- get playText() {
514
- return this._playText;
515
- }
516
-
517
- /**
518
- * The label for the autoplay button when the carousel is playing.
519
- *
520
- * @type {string}
521
- *
522
- * @see _pauseText
523
- */
524
- get pauseText() {
525
- return this._pauseText;
526
- }
527
-
528
- /**
529
- * The prefix to use for CSS custom properties.
530
- *
531
- * @type {string}
532
- *
533
- * @see _prefix
534
- */
535
- get prefix() {
536
- return this._prefix;
537
- }
538
-
539
- /**
540
- * The key used to generate IDs throughout the accordion.
541
- *
542
- * @type {string}
543
- *
544
- * @see _key
545
- */
546
- get key() {
547
- return this._key;
548
- }
549
-
550
- /**
551
- * The current action being performed by the carousel.
552
- *
553
- * @type {string}
554
- *
555
- * @see _currentAction
556
- */
557
- get currentAction() {
558
- return this._currentAction;
559
- }
560
-
561
- /**
562
- * An array of error messages generated by the carousel.
563
- *
564
- * @readonly
565
- *
566
- * @type {string[]}
567
- *
568
- * @see _errors
569
- */
570
- get errors() {
571
- return this._errors;
572
- }
573
-
574
- set currentItem(value) {
575
- isValidType("number", { value });
576
-
577
- if (value === this.currentItem) {
578
- return;
579
- }
580
-
581
- if (value < 0) {
582
- this._currentItem = 0;
583
- } else if (value >= this.dom.carouselItems.length) {
584
- this._currentItem = this.dom.carouselItems.length - 1;
585
- } else {
586
- this._currentItem = value;
587
- }
588
-
589
- // Keep the aria selected in sync with the current item.
590
- const tabs = this._dom.carousel.querySelectorAll(
591
- this.selectors.carouselTab
592
- );
593
- if (tabs) {
594
- this.dom.carouselItems.forEach((item, index) => {
595
- item.setAttribute("aria-selected", index === this._currentItem);
596
- });
597
- }
598
- }
599
-
600
- set autoplay(value) {
601
- isValidType("boolean", { value });
602
-
603
- if (this._autoplay !== value) {
604
- this._autoplay = value;
605
- }
606
- }
607
-
608
- set activeClass(value) {
609
- isValidClassList({ activeClass: value });
610
-
611
- if (this._activeClass !== value) {
612
- this._activeClass = value;
613
- }
614
- }
615
-
616
- set previousClass(value) {
617
- isValidClassList({ previousClass: value });
618
-
619
- if (this._previousClass !== value) {
620
- this._previousClass = value;
621
- }
622
- }
623
-
624
- set nextClass(value) {
625
- isValidClassList({ nextClass: value });
626
-
627
- if (this._nextClass !== value) {
628
- this._nextClass = value;
629
- }
630
- }
631
-
632
- set playClass(value) {
633
- isValidClassList({ playClass: value });
634
-
635
- if (this._playClass !== value) {
636
- this._playClass = value;
637
- }
638
- }
639
-
640
- set pauseClass(value) {
641
- isValidClassList({ pauseClass: value });
642
-
643
- if (this._pauseClass !== value) {
644
- this._pauseClass = value;
645
- }
646
- }
647
-
648
- set transitionDelay(value) {
649
- isValidType("number", { value });
650
-
651
- if (value !== this.transitionDelay && value >= 0) {
652
- this._currentItem = value;
653
- }
654
- }
655
-
656
- set transitionDuration(value) {
657
- isValidType("number", { value });
658
-
659
- if (this._transitionDuration !== value && value >= 0) {
660
- this._transitionDuration = value;
661
- this._setTransitionDuration();
662
- }
663
- }
664
-
665
- set playText(value) {
666
- isValidType("string", { value });
667
-
668
- if (this._playText !== value) {
669
- this._playText = value;
670
- }
671
- }
672
-
673
- set pauseText(value) {
674
- isValidType("string", { value });
675
-
676
- if (this._pauseText !== value) {
677
- this._pauseText = value;
678
- }
679
- }
680
-
681
- set prefix(value) {
682
- isValidType("string", { value });
683
-
684
- if (this._prefix !== value) {
685
- this._prefix = value;
686
- }
687
- }
688
-
689
- set key(value) {
690
- isValidType("string", { value });
691
-
692
- if (this._key !== value) {
693
- this._key = value;
694
- }
695
- }
696
-
697
- /**
698
- * Validates all aspects of the carousel to ensure proper functionality.
699
- *
700
- * @protected
701
- *
702
- * @return {boolean} - The results of the validation.
703
- */
704
- _validate() {
705
- let check = true;
706
-
707
- // HTML element checks.
708
- const htmlElementChecks = isValidInstance(HTMLElement, {
709
- carousel: this.dom.carousel,
710
- });
711
-
712
- if (!htmlElementChecks) {
713
- this._errors.push(htmlElementChecks.message);
714
- check = false;
715
- }
716
-
717
- // Query selector checks.
718
- const querySelectorChecks = isQuerySelector({
719
- carouselItemsSelector: this._selectors.carouselItems,
720
- carouselItemContainerSelector: this._selectors.carouselItemContainer,
721
- carouselControlsSelector: this._selectors.carouselControls,
722
- carouselControlContainerSelector:
723
- this._selectors.carouselControlContainer,
724
- carouselTabsSelector: this._selectors.carouselTabs,
725
- carouselTabContainerSelector: this._selectors.carouselTabContainer,
726
- autoplaySelector: this._selectors.autoplay,
727
- nextSelector: this._selectors.next,
728
- previousSelector: this._selectors.previous,
729
- });
730
-
731
- if (!querySelectorChecks) {
732
- this._errors.push(querySelectorChecks.message);
733
- check = false;
734
- }
735
-
736
- // Autoplay checks.
737
- const autoplayChecks = isValidType("boolean", { autoplay: this.autoplay });
738
-
739
- if (!autoplayChecks) {
740
- this._errors.push(autoplayChecks.message);
741
- check = false;
742
- }
743
-
744
- // Check delay is a valid value.
745
- const delayCheck = isValidType("number", {
746
- transitionDelay: this._transitionDelay,
747
- });
748
-
749
- if (!delayCheck) {
750
- this._errors.push(delayCheck.message);
751
- check = false;
752
- }
753
-
754
- // Check duration is a valid value.
755
- const durationCheck = isValidType("number", {
756
- transitionDuration: this._transitionDuration,
757
- });
758
-
759
- if (!durationCheck) {
760
- this._errors.push(durationCheck.message);
761
- check = false;
762
- }
763
-
764
- // Active class checks.
765
- if (this._activeClass !== "") {
766
- const activeClassChecks = isValidClassList({
767
- activeClass: this._activeClass,
768
- });
769
-
770
- if (!activeClassChecks) {
771
- this._errors.push(activeClassChecks.message);
772
- check = false;
773
- }
774
- }
775
-
776
- // Previous class checks.
777
- if (this._previousClass !== "") {
778
- const previousClassChecks = isValidClassList({
779
- previousClass: this._previousClass,
780
- });
781
-
782
- if (!previousClassChecks) {
783
- this._errors.push(previousClassChecks.message);
784
- check = false;
785
- }
786
- }
787
-
788
- // Next class checks.
789
- if (this._nextClass !== "") {
790
- const nextClassChecks = isValidClassList({
791
- nextClass: this._nextClass,
792
- });
793
-
794
- if (!nextClassChecks) {
795
- this._errors.push(nextClassChecks.message);
796
- check = false;
797
- }
798
- }
799
-
800
- // Play class checks.
801
- if (this._playClass !== "") {
802
- const playClassChecks = isValidClassList({
803
- playClass: this._playClass,
804
- });
805
-
806
- if (!playClassChecks) {
807
- this._errors.push(playClassChecks.message);
808
- check = false;
809
- }
810
- }
811
-
812
- // Pause class checks.
813
- if (this._pauseClass !== "") {
814
- const pauseClassChecks = isValidClassList({
815
- pauseClass: this._pauseClass,
816
- });
817
-
818
- if (!pauseClassChecks) {
819
- this._errors.push(pauseClassChecks.message);
820
- check = false;
821
- }
822
- }
823
-
824
- // Play text checks.
825
- if (this._playText !== "") {
826
- const playTextChecks = isValidType("string", {
827
- playText: this._playText,
828
- });
829
-
830
- if (!playTextChecks) {
831
- this._errors.push(playTextChecks.message);
832
- check = false;
833
- }
834
- }
835
-
836
- // Pause text checks.
837
- if (this._pauseText !== "") {
838
- const pauseTextChecks = isValidType("string", {
839
- pauseText: this._pauseText,
840
- });
841
-
842
- if (!pauseTextChecks) {
843
- this._errors.push(pauseTextChecks.message);
844
- check = false;
845
- }
846
- }
847
-
848
- // Prefix checks.
849
- const prefixChecks = isValidType("string", { prefix: this._prefix });
850
-
851
- if (!prefixChecks) {
852
- this._errors.push(prefixChecks.message);
853
- check = false;
854
- }
855
-
856
- return check;
857
- }
858
-
859
- /**
860
- * Sets DOM elements within the carousel.
861
- *
862
- * The carousel element _cannot_ be set through this method.
863
- *
864
- * @protected
865
- *
866
- * @param {string} elementType - The type of element to populate.
867
- * @param {HTMLElement} [base = this.dom.carousel] - The element used as the base for the querySelector.
868
- * @param {boolean} [overwrite = true] - A flag to set if the existing elements will be overwritten.
869
- */
870
- _setDOMElementType(elementType, base = this.dom.carousel, overwrite = true) {
871
- if (typeof this.selectors[elementType] === "string") {
872
- if (elementType === "carousel") {
873
- throw new Error(
874
- `Graupl Carousel: "${elementType}" element cannot be set through _setDOMElementType.`
875
- );
876
- }
877
-
878
- if (base !== this.dom.carousel) isValidInstance(HTMLElement, { base });
879
-
880
- if (Array.isArray(this._dom[elementType])) {
881
- // Get all the elements matching the selector in the base.
882
- const domElements = Array.from(
883
- base.querySelectorAll(this.selectors[elementType])
884
- );
885
-
886
- // Filter the elements so only direct children of the base are kept.
887
- const filteredElements = domElements.filter(
888
- (item) => item.parentElement === base
889
- );
890
-
891
- if (overwrite) {
892
- this._dom[elementType] = filteredElements;
893
- } else {
894
- this._dom[elementType] = [
895
- ...this._dom[elementType],
896
- ...filteredElements,
897
- ];
898
- }
899
- } else {
900
- // Get the single element matching the selector in the base.
901
- const domElement = base.querySelector(this.selectors[elementType]);
902
-
903
- // Ensure the element is a direct child of the base.
904
- if (domElement && domElement.parentElement !== base) {
905
- return;
906
- }
907
-
908
- if (overwrite) {
909
- this._dom[elementType] = domElement;
910
- }
911
- }
912
- } else {
913
- throw new Error(
914
- `Graupl Carousel: "${elementType}" is not a valid element type within the carousel.`
915
- );
916
- }
917
- }
918
-
919
- /**
920
- * Resets DOM elements within the menu.
921
- *
922
- * The carousel element _cannot_ be reset through this method.
923
- *
924
- * @protected
925
- *
926
- * @param {string} elementType - The type of element to clear.
927
- */
928
- _resetDOMElementType(elementType) {
929
- if (typeof this.selectors[elementType] === "string") {
930
- if (elementType === "carousel") {
931
- throw new Error(
932
- `Graupl Carousel: "${elementType}" element cannot be reset through _resetDOMElementType.`
933
- );
934
- }
935
-
936
- if (Array.isArray(this._dom[elementType])) {
937
- this._dom[elementType] = [];
938
- } else {
939
- this._dom[elementType] = null;
940
- }
941
- } else {
942
- throw new Error(
943
- `Graupl Carousel: "${elementType}" is not a valid element type within the carousel.`
944
- );
945
- }
946
- }
947
-
948
- /**
949
- * Sets all DOM elements within the carousel.
950
- *
951
- * Utilizes _setDOMElementType and _resetDOMElementType.
952
- *
953
- * @protected
954
- */
955
- _setDOMElements() {
956
- this._setDOMElementType("carouselItemContainer");
957
- this._setDOMElementType("carouselControlContainer");
958
- this._setDOMElementType("carouselTabContainer");
959
-
960
- if (this.dom.carouselItemContainer) {
961
- this._setDOMElementType("carouselItems", this.dom.carouselItemContainer);
962
- }
963
- if (this.dom.carouselControlContainer) {
964
- this._setDOMElementType(
965
- "carouselControls",
966
- this.dom.carouselControlContainer
967
- );
968
- this._setDOMElementType("autoplay", this.dom.carouselControlContainer);
969
- this._setDOMElementType("next", this.dom.carouselControlContainer);
970
- this._setDOMElementType("previous", this.dom.carouselControlContainer);
971
- }
972
-
973
- if (this._dom.carouselTabContainer) {
974
- this._setDOMElementType("carouselTabs", this.dom.carouselTabContainer);
975
- }
976
- }
977
-
978
- /**
979
- * Generates a key for the carousel.
980
- *
981
- * @param {boolean} [regenerate = false] - A flag to determine if the key should be regenerated.
982
- */
983
- _generateKey(regenerate = false) {
984
- if (this.key === "" || regenerate) {
985
- this.key = Math.random()
986
- .toString(36)
987
- .replace(/[^a-z]+/g, "")
988
- .substring(0, 10);
989
- }
990
- }
991
-
992
- /**
993
- * Sets the IDs of the carousel and it's children if they do not already exist.
994
- *
995
- * The generated IDs use the key and follow the format:
996
- * - carousel: `carousel-${key}`
997
- * - carousel items: `carousel-item-${key}-${index}`
998
- * - carousel tabs: `carousel-tab-${key}-${index}`
999
- */
1000
- _setIds() {
1001
- this.dom.carousel.id = this.dom.carousel.id || `carousel-${this.key}`;
1002
-
1003
- this.dom.carouselItems.forEach((item, index) => {
1004
- item.id = item.id || `carousel-item-${this.key}-${index}`;
1005
- });
1006
-
1007
- this.dom.carouselTabs.forEach((tab, index) => {
1008
- tab.id = tab.id || `carousel-tab-${this.key}-${index}`;
1009
- });
1010
- }
1011
-
1012
- /**
1013
- * Sets the aria attributes for the carousel.
1014
- */
1015
- _setAriaAttributes() {
1016
- // Make sure the carousel has a proper role.
1017
- // Sections and role="region" are acceptable in certain cases, so
1018
- // we only need to fallback to role="group" if neither of those are present.
1019
- if (
1020
- !isTag("section", { carousel: this.dom.carousel }) &&
1021
- !this.dom.carousel.getAttribute("role") !== "region"
1022
- ) {
1023
- this.dom.carousel.setAttribute("role", "group");
1024
- }
1025
-
1026
- // Set the role description for the carousel.
1027
- this._dom.carousel.setAttribute("aria-roledescription", "carousel");
1028
-
1029
- if (this.dom.carouselTabContainer) {
1030
- this.dom.carouselTabContainer.setAttribute("role", "tablist");
1031
- }
1032
-
1033
- this.dom.carouselTabs.forEach((tab, index) => {
1034
- if (!isTag("button", { tab: tab })) {
1035
- tab.setAttribute("role", "button");
1036
- }
1037
-
1038
- tab.setAttribute("aria-selected", index === 0);
1039
- tab.setAttribute("aria-controls", this.dom.carouselItems[index].id);
1040
- });
1041
- }
1042
-
1043
- /**
1044
- * Sets the interval for autoplaying the carousel.
1045
- *
1046
- * @protected
1047
- */
1048
- _setInterval() {
1049
- this._clearInterval();
1050
-
1051
- this._autoplayInterval = setInterval(() => {
1052
- this.activateNextItem();
1053
- }, this.transitionDelay);
1054
- }
1055
-
1056
- /**
1057
- * Clears the interval for autoplaying the carousel.
1058
- *
1059
- * @protected
1060
- */
1061
- _clearInterval() {
1062
- clearInterval(this._autoplayInterval);
1063
- }
1064
-
1065
- /**
1066
- * Handles the autoplay functionality of the carousel.
1067
- *
1068
- * - Adds the appropriate class to the autoplay button.
1069
- * - Removes the appropriate class from the autoplay button.
1070
- * - Sets the appropriate aria-label for the autoplay button.
1071
- * - Sets the appropriate aria-live for the carousel.
1072
- * - Sets/clears the interval for autoplaying the carousel.
1073
- *
1074
- * @protected
1075
- */
1076
- _handleAutoplay() {
1077
- if (this.autoplay) {
1078
- addClass(this.pauseClass, this.dom.autoplay);
1079
- removeClass(this.playClass, this.dom.autoplay);
1080
-
1081
- this.dom.autoplay.setAttribute("aria-label", this.pauseText);
1082
- this.dom.carousel.setAttribute("aria-live", "off");
1083
-
1084
- this._setInterval();
1085
- } else {
1086
- addClass(this.playClass, this.dom.autoplay);
1087
- removeClass(this.pauseClass, this.dom.autoplay);
1088
-
1089
- this.dom.autoplay.setAttribute("aria-label", this.playText);
1090
- this.dom.carousel.setAttribute("aria-live", "polite");
1091
-
1092
- this._clearInterval();
1093
- }
1094
- }
1095
-
1096
- /**
1097
- * Handles the focus events throughout the carousel for proper use.
1098
- *
1099
- * - Adds a `focusin` listener to the carousel element to pause autoplay.
1100
- * - Adds a `focusout` listener to the carousel element to resume autoplay.
1101
- */
1102
- _handleFocus() {
1103
- // Pause autoplay when anything in the carousel is focused.
1104
- this.dom.carousel.addEventListener("focusin", () => {
1105
- if (this.autoplay) {
1106
- this._clearInterval();
1107
- }
1108
- });
1109
-
1110
- this.dom.carousel.addEventListener("focusout", () => {
1111
- if (this.autoplay) {
1112
- this._setInterval();
1113
- }
1114
- });
1115
- }
1116
-
1117
- /**
1118
- * Handles the click events throughout the carousel.
1119
- *
1120
- * - Adds a `pointerup` listener to the next control to activate the next item.
1121
- * - Adds a `pointerup` listener to the previous control to activate the previous item.
1122
- * - Adds a `pointerup` listener to the autoplay control to toggle autoplay.
1123
- * - Adds a `pointerup` listener to each tab control to activate the corresponding item.
1124
- */
1125
- _handleClick() {
1126
- this.dom.next.addEventListener("pointerup", () => {
1127
- this.activateNextItem();
1128
- });
1129
-
1130
- this.dom.previous.addEventListener("pointerup", () => {
1131
- this.activatePreviousItem();
1132
- });
1133
-
1134
- this.dom.autoplay.addEventListener("pointerup", () => {
1135
- this.toggleAutoplay();
1136
- });
1137
-
1138
- this.dom.carouselTabs.forEach((tab, index) => {
1139
- tab.addEventListener("pointerup", () => {
1140
- if (this.currentItem > index) {
1141
- this._currentAction = "previous";
1142
- } else {
1143
- this._currentAction = "next";
1144
- }
1145
-
1146
- this.activateItem(index);
1147
- });
1148
- });
1149
- }
1150
-
1151
- /**
1152
- * Handles the hover events throughout the carousel for proper use.
1153
- *
1154
- * - Adds a `pointerover` listener to the carousel to pause autoplay.
1155
- * - Adds a `pointerleave` listener to the carousel to resume autoplay.
1156
- */
1157
- _handleHover() {
1158
- // Pause autoplay when anything in the carousel is hovered.
1159
- this.dom.carousel.addEventListener("pointerover", () => {
1160
- if (this.autoplay) {
1161
- this._clearInterval();
1162
- }
1163
- });
1164
-
1165
- this.dom.carousel.addEventListener("pointerleave", () => {
1166
- if (this.autoplay) {
1167
- this._setInterval();
1168
- }
1169
- });
1170
- }
1171
-
1172
- /**
1173
- * Handles keydown events throughout the carousel item for proper use.
1174
- *
1175
- * - Adds a `keydown` listener to all control elements.
1176
- * - Prevents Space and Enter key events.
1177
- * - Adds a `keydown` listener to all tab elements.
1178
- * - Prevents Space and Enter key events.
1179
- */
1180
- _handleKeydown() {
1181
- this.dom.carouselControls.forEach((control) => {
1182
- control.addEventListener("keydown", (event) => {
1183
- const key = keyPress(event);
1184
-
1185
- switch (key) {
1186
- case "Space":
1187
- case "Enter":
1188
- // Prevent the default action of the event.
1189
- preventEvent(event);
1190
-
1191
- break;
1192
- }
1193
- });
1194
- });
1195
-
1196
- this.dom.carouselTabs.forEach((tab) => {
1197
- tab.addEventListener("keydown", (event) => {
1198
- const key = keyPress(event);
1199
-
1200
- switch (key) {
1201
- case "Space":
1202
- case "Enter":
1203
- // Prevent the default action of the event.
1204
- preventEvent(event);
1205
-
1206
- break;
1207
- }
1208
- });
1209
- });
1210
- }
1211
-
1212
- /**
1213
- * Handles keyup events throughout the carousel item for proper use.
1214
- *
1215
- * - Adds a `keyup` listener to all control elements.
1216
- * - Activates the next/previous item depending on which control is pressed.
1217
- * - Toggles autoplay if the autoplay control is pressed.
1218
- *
1219
- */
1220
- _handleKeyup() {
1221
- // Activate the next item if the space or enter key on the next control.
1222
- this.dom.next.addEventListener("keyup", (event) => {
1223
- const key = keyPress(event);
1224
-
1225
- switch (key) {
1226
- case "Space":
1227
- case "Enter":
1228
- this.activateNextItem();
1229
-
1230
- // Prevent the default action of the event.
1231
- preventEvent(event);
1232
-
1233
- break;
1234
- }
1235
- });
1236
-
1237
- // Activate the previous item if the space or enter key on the previous control.
1238
- this.dom.previous.addEventListener("keyup", (event) => {
1239
- const key = keyPress(event);
1240
-
1241
- switch (key) {
1242
- case "Space":
1243
- case "Enter":
1244
- this.activatePreviousItem();
1245
-
1246
- // Prevent the default action of the event.
1247
- preventEvent(event);
1248
-
1249
- break;
1250
- }
1251
- });
1252
-
1253
- // Toggle autoplay if the space or enter key on the autoplay control.
1254
- this.dom.autoplay.addEventListener("keyup", (event) => {
1255
- const key = keyPress(event);
1256
-
1257
- switch (key) {
1258
- case "Space":
1259
- case "Enter":
1260
- this.toggleAutoplay();
1261
-
1262
- // Prevent the default action of the event.
1263
- preventEvent(event);
1264
-
1265
- break;
1266
- }
1267
- });
1268
-
1269
- // Activate the item if the space or enter key on the tab control.
1270
- this.dom.carouselTabs.forEach((tab, index) => {
1271
- tab.addEventListener("keyup", (event) => {
1272
- const key = keyPress(event);
1273
-
1274
- switch (key) {
1275
- case "Space":
1276
- case "Enter":
1277
- this.activateItem(index);
1278
-
1279
- // Prevent the default action of the event.
1280
- preventEvent(event);
1281
-
1282
- break;
1283
- }
1284
- });
1285
- });
1286
- }
1287
-
1288
- /**
1289
- * Sets the transition duration for the carousel as a CSS custom property.
1290
- *
1291
- * The custom property is set as `--graupl-carousel-transition-duration`.
1292
- *
1293
- * @protected
1294
- */
1295
- _setTransitionDuration() {
1296
- this.dom.carousel.style.setProperty(
1297
- `--${this.prefix}carousel-transition-duration`,
1298
- `${this.transitionDuration}ms`
1299
- );
1300
- }
1301
-
1302
- /**
1303
- * Activates the current carousel item.
1304
- *
1305
- * @public
1306
- */
1307
- activateCurrentItem() {
1308
- addClass(this.activeClass, this.currentCarouselItem);
1309
-
1310
- if (this.currentCarouselTab) {
1311
- this.currentCarouselTab.setAttribute("aria-selected", true);
1312
- addClass(this.activeClass, this.currentCarouselTab);
1313
- }
1314
- }
1315
-
1316
- /**
1317
- * Deactivates the current carousel item.
1318
- *
1319
- * @public
1320
- */
1321
- deactivateCurrentItem() {
1322
- removeClass(this.activeClass, this.currentCarouselItem);
1323
-
1324
- if (this.currentCarouselTab) {
1325
- this.currentCarouselTab.setAttribute("aria-selected", false);
1326
- removeClass(this.activeClass, this.currentCarouselTab);
1327
- }
1328
- }
1329
-
1330
- /**
1331
- * Activates the carousel item at a given index.
1332
- *
1333
- * @public
1334
- *
1335
- * @param {number} index - The index of the carousel item to activate.
1336
- */
1337
- activateItem(index) {
1338
- const currentIndex = this.currentItem;
1339
-
1340
- this.dom.carousel.dataset.grauplAction = this._currentAction;
1341
-
1342
- if (this.autoplay) {
1343
- this._clearInterval();
1344
- }
1345
-
1346
- addClass(this.previousClass, this.currentCarouselItem);
1347
- addClass(this.nextClass, this.dom.carouselItems[index]);
1348
-
1349
- requestAnimationFrame(() => {
1350
- this.deactivateCurrentItem();
1351
- this.currentItem = index;
1352
- this.activateCurrentItem();
1353
-
1354
- requestAnimationFrame(() => {
1355
- setTimeout(() => {
1356
- removeClass(this.previousClass, this.dom.carouselItems[currentIndex]);
1357
- removeClass(this.nextClass, this.currentCarouselItem);
1358
- }, this.transitionDuration);
1359
- });
1360
- });
1361
-
1362
- if (this.autoplay) {
1363
- this._setInterval();
1364
- }
1365
- }
1366
-
1367
- /**
1368
- * Activates the first carousel item.
1369
- *
1370
- * @public
1371
- */
1372
- activateFirstItem() {
1373
- this.activateItem(0);
1374
- }
1375
-
1376
- /**
1377
- * Activates the last carousel item.
1378
- *
1379
- * @public
1380
- */
1381
- activateLastItem() {
1382
- this.activateItem(this.dom.carouselItems.length - 1);
1383
- }
1384
-
1385
- /**
1386
- * Activates the next carousel item.
1387
- *
1388
- * @public
1389
- */
1390
- activateNextItem() {
1391
- this._currentAction = "next";
1392
-
1393
- if (this.currentItem + 1 >= this.dom.carouselItems.length) {
1394
- this.activateFirstItem();
1395
- } else {
1396
- this.activateItem(this.currentItem + 1);
1397
- }
1398
- }
1399
-
1400
- /**
1401
- * Activates the previous carousel item.
1402
- *
1403
- * @public
1404
- */
1405
- activatePreviousItem() {
1406
- this._currentAction = "previous";
1407
-
1408
- if (this.currentItem - 1 < 0) {
1409
- this.activateLastItem();
1410
- } else {
1411
- this.activateItem(this.currentItem - 1);
1412
- }
1413
- }
1414
-
1415
- /**
1416
- * Toggles autoplay on the carousel.
1417
- *
1418
- * @public
1419
- */
1420
- toggleAutoplay() {
1421
- this.autoplay = !this.autoplay;
1422
-
1423
- this._handleAutoplay();
1424
- }
1425
- }
1426
-
1427
- export default Carousel;