@graupl/graupl 1.0.0-beta.0 → 1.0.0-beta.10
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.
- package/.devcontainer/devcontainer.json +221 -0
- package/.env +3 -0
- package/.github/workflows/docs.yml +13 -6
- package/.github/workflows/prerelease.yml +125 -0
- package/.github/workflows/release.yml +111 -0
- package/.github/workflows/test.yml +54 -3
- package/.versionrc.cjs +12 -0
- package/.vscode/settings.json +10 -0
- package/CHANGELOG.md +203 -1
- package/build.js +4 -2
- package/combine-at-rules.cjs +61 -0
- package/container/.env +26 -0
- package/container/build/app.dockerfile +41 -0
- package/container/docker-compose.yml +27 -0
- package/dist/css/base/button.css +1 -1
- package/dist/css/base/button.css.map +1 -1
- package/dist/css/base/form.css +1 -1
- package/dist/css/base/form.css.map +1 -1
- package/dist/css/base/link.css +1 -1
- package/dist/css/base/link.css.map +1 -1
- package/dist/css/base/table.css +1 -1
- package/dist/css/base/table.css.map +1 -1
- package/dist/css/base.css +1 -1
- package/dist/css/base.css.map +1 -1
- package/dist/css/component/accordion.css +4 -1
- package/dist/css/component/accordion.css.map +1 -1
- package/dist/css/component/alert.css +1 -1
- package/dist/css/component/alert.css.map +1 -1
- package/dist/css/component/card.css +1 -1
- package/dist/css/component/card.css.map +1 -1
- package/dist/css/component/carousel.css +1 -1
- package/dist/css/component/carousel.css.map +1 -1
- package/dist/css/component/input-group.css +1 -1
- package/dist/css/component/input-group.css.map +1 -1
- package/dist/css/component/list.css +2 -0
- package/dist/css/component/list.css.map +1 -0
- package/dist/css/component/menu.css +1 -1
- package/dist/css/component/menu.css.map +1 -1
- package/dist/css/component/navigation.css +1 -1
- package/dist/css/component/navigation.css.map +1 -1
- package/dist/css/component.css +4 -1
- package/dist/css/component.css.map +1 -1
- package/dist/css/graupl.css +4 -1
- package/dist/css/graupl.css.map +1 -1
- package/dist/css/init.css.map +1 -1
- package/dist/css/layout/columns.css +1 -1
- package/dist/css/layout/columns.css.map +1 -1
- package/dist/css/layout/container.css +1 -1
- package/dist/css/layout/container.css.map +1 -1
- package/dist/css/layout/flex-columns.css +1 -1
- package/dist/css/layout/flex-columns.css.map +1 -1
- package/dist/css/layout.css +4 -1
- package/dist/css/layout.css.map +1 -1
- package/dist/css/normalize.css.map +1 -1
- package/dist/css/state/focus.css +1 -1
- package/dist/css/state/focus.css.map +1 -1
- package/dist/css/state.css +1 -1
- package/dist/css/state.css.map +1 -1
- package/dist/css/theme/color.css.map +1 -1
- package/dist/css/theme/typography.css +1 -1
- package/dist/css/theme/typography.css.map +1 -1
- package/dist/css/theme.css +1 -1
- package/dist/css/theme.css.map +1 -1
- package/dist/css/utilities/alignment.css.map +1 -1
- package/dist/css/utilities/background.css +2 -0
- package/dist/css/utilities/background.css.map +1 -0
- package/dist/css/utilities/border.css +2 -0
- package/dist/css/utilities/border.css.map +1 -0
- package/dist/css/utilities/color.css +1 -1
- package/dist/css/utilities/color.css.map +1 -1
- package/dist/css/utilities/container.css +2 -0
- package/dist/css/utilities/container.css.map +1 -0
- package/dist/css/utilities/display.css +1 -1
- package/dist/css/utilities/display.css.map +1 -1
- package/dist/css/utilities/flex.css +1 -1
- package/dist/css/utilities/flex.css.map +1 -1
- package/dist/css/utilities/gradient.css +2 -0
- package/dist/css/utilities/gradient.css.map +1 -0
- package/dist/css/utilities/height.css +1 -1
- package/dist/css/utilities/height.css.map +1 -1
- package/dist/css/utilities/inset.css +1 -1
- package/dist/css/utilities/inset.css.map +1 -1
- package/dist/css/utilities/justification.css.map +1 -1
- package/dist/css/utilities/list.css.map +1 -1
- package/dist/css/utilities/order.css.map +1 -1
- package/dist/css/utilities/position.css +2 -0
- package/dist/css/utilities/position.css.map +1 -0
- package/dist/css/utilities/ratio.css +1 -1
- package/dist/css/utilities/ratio.css.map +1 -1
- package/dist/css/utilities/spacing.css +1 -1
- package/dist/css/utilities/spacing.css.map +1 -1
- package/dist/css/utilities/typography.css +1 -1
- package/dist/css/utilities/typography.css.map +1 -1
- package/dist/css/utilities/visibility.css +1 -1
- package/dist/css/utilities/visibility.css.map +1 -1
- package/dist/css/utilities/visually-hidden.css +2 -0
- package/dist/css/utilities/visually-hidden.css.map +1 -0
- package/dist/css/utilities/width.css +1 -1
- package/dist/css/utilities/width.css.map +1 -1
- package/dist/css/utilities/z-index.css +2 -0
- package/dist/css/utilities/z-index.css.map +1 -0
- package/dist/css/utilities.css +1 -1
- package/dist/css/utilities.css.map +1 -1
- package/dist/js/graupl.cjs.js +5 -3
- package/dist/js/graupl.esm.js +1305 -206
- package/dist/js/graupl.iife.js +5 -3
- package/docs/.vitepress/config.js +31 -1
- package/docs/.vitepress/theme/custom.scss +16 -16
- package/docs/compiling-graupl.md +6 -5
- package/docs/components/alert.md +28 -28
- package/docs/components/button.md +36 -36
- package/docs/components/card.md +39 -39
- package/docs/components/inputgroup.md +12 -12
- package/docs/components/menu.md +112 -112
- package/docs/components/navigation.md +52 -52
- package/docs/content.md +86 -86
- package/docs/defaults.md +10 -10
- package/docs/forms.md +34 -34
- package/docs/layout.md +21 -21
- package/docs/state.md +8 -8
- package/docs/theme.md +58 -58
- package/docs/utilities/alignment.md +411 -0
- package/docs/utilities/background.md +192 -0
- package/docs/utilities/border.md +268 -0
- package/docs/utilities/color.md +348 -0
- package/docs/utilities/container.md +3 -0
- package/docs/utilities/display.md +3 -0
- package/docs/utilities/flex.md +3 -0
- package/docs/utilities/gradient.md +3 -0
- package/docs/utilities/height.md +3 -0
- package/docs/utilities/inset.md +3 -0
- package/docs/utilities/justification.md +3 -0
- package/docs/utilities/list.md +3 -0
- package/docs/utilities/order.md +3 -0
- package/docs/utilities/position.md +3 -0
- package/docs/utilities/ratio.md +3 -0
- package/docs/utilities/responsive-classes.md +3 -0
- package/docs/utilities/spacing.md +3 -0
- package/docs/utilities/typography.md +3 -0
- package/docs/utilities/visibility.md +3 -0
- package/docs/utilities/visually-hidden.md +3 -0
- package/docs/utilities/width.md +3 -0
- package/docs/utilities/z-index.md +3 -0
- package/docs/utilities.md +1 -1
- package/favicon.ico +0 -0
- package/index.html +418 -55
- package/logo.svg +296 -0
- package/package.json +33 -37
- package/packages/core/build.js +9 -0
- package/packages/core/dist/css/base/button.css +2 -0
- package/packages/core/dist/css/base/button.css.map +1 -0
- package/packages/core/dist/css/base/form.css +2 -0
- package/packages/core/dist/css/base/form.css.map +1 -0
- package/packages/core/dist/css/base/link.css +2 -0
- package/packages/core/dist/css/base/link.css.map +1 -0
- package/packages/core/dist/css/base/table.css +2 -0
- package/packages/core/dist/css/base/table.css.map +1 -0
- package/packages/core/dist/css/base.css +2 -0
- package/packages/core/dist/css/base.css.map +1 -0
- package/packages/core/dist/css/component/accordion.css +5 -0
- package/packages/core/dist/css/component/accordion.css.map +1 -0
- package/packages/core/dist/css/component/alert.css +2 -0
- package/packages/core/dist/css/component/alert.css.map +1 -0
- package/packages/core/dist/css/component/card.css +2 -0
- package/packages/core/dist/css/component/card.css.map +1 -0
- package/packages/core/dist/css/component/carousel.css +2 -0
- package/packages/core/dist/css/component/carousel.css.map +1 -0
- package/packages/core/dist/css/component/input-group.css +2 -0
- package/packages/core/dist/css/component/input-group.css.map +1 -0
- package/packages/core/dist/css/component/list.css +2 -0
- package/packages/core/dist/css/component/list.css.map +1 -0
- package/packages/core/dist/css/component/menu.css +2 -0
- package/packages/core/dist/css/component/menu.css.map +1 -0
- package/packages/core/dist/css/component/navigation.css +2 -0
- package/packages/core/dist/css/component/navigation.css.map +1 -0
- package/packages/core/dist/css/component.css +5 -0
- package/packages/core/dist/css/component.css.map +1 -0
- package/packages/core/dist/css/graupl.css +5 -0
- package/packages/core/dist/css/graupl.css.map +1 -0
- package/{src/scss/_init.scss → packages/core/dist/css/init.css} +1 -2
- package/packages/core/dist/css/init.css.map +1 -0
- package/packages/core/dist/css/layout/columns.css +2 -0
- package/packages/core/dist/css/layout/columns.css.map +1 -0
- package/packages/core/dist/css/layout/container.css +2 -0
- package/packages/core/dist/css/layout/container.css.map +1 -0
- package/packages/core/dist/css/layout/flex-columns.css +2 -0
- package/packages/core/dist/css/layout/flex-columns.css.map +1 -0
- package/packages/core/dist/css/layout.css +5 -0
- package/packages/core/dist/css/layout.css.map +1 -0
- package/packages/core/dist/css/normalize.css +2 -0
- package/packages/core/dist/css/normalize.css.map +1 -0
- package/packages/core/dist/css/state/focus.css +2 -0
- package/packages/core/dist/css/state/focus.css.map +1 -0
- package/packages/core/dist/css/state.css +2 -0
- package/packages/core/dist/css/state.css.map +1 -0
- package/packages/core/dist/css/theme/color.css +2 -0
- package/packages/core/dist/css/theme/color.css.map +1 -0
- package/packages/core/dist/css/theme/typography.css +2 -0
- package/packages/core/dist/css/theme/typography.css.map +1 -0
- package/packages/core/dist/css/theme.css +2 -0
- package/packages/core/dist/css/theme.css.map +1 -0
- package/packages/core/dist/css/utilities/alignment.css +2 -0
- package/packages/core/dist/css/utilities/alignment.css.map +1 -0
- package/packages/core/dist/css/utilities/background.css +2 -0
- package/packages/core/dist/css/utilities/background.css.map +1 -0
- package/packages/core/dist/css/utilities/border.css +2 -0
- package/packages/core/dist/css/utilities/border.css.map +1 -0
- package/packages/core/dist/css/utilities/color.css +2 -0
- package/packages/core/dist/css/utilities/color.css.map +1 -0
- package/packages/core/dist/css/utilities/container.css +2 -0
- package/packages/core/dist/css/utilities/container.css.map +1 -0
- package/packages/core/dist/css/utilities/display.css +2 -0
- package/packages/core/dist/css/utilities/display.css.map +1 -0
- package/packages/core/dist/css/utilities/flex.css +2 -0
- package/packages/core/dist/css/utilities/flex.css.map +1 -0
- package/packages/core/dist/css/utilities/gradient.css +2 -0
- package/packages/core/dist/css/utilities/gradient.css.map +1 -0
- package/packages/core/dist/css/utilities/height.css +2 -0
- package/packages/core/dist/css/utilities/height.css.map +1 -0
- package/packages/core/dist/css/utilities/inset.css +2 -0
- package/packages/core/dist/css/utilities/inset.css.map +1 -0
- package/packages/core/dist/css/utilities/justification.css +2 -0
- package/packages/core/dist/css/utilities/justification.css.map +1 -0
- package/packages/core/dist/css/utilities/list.css +2 -0
- package/packages/core/dist/css/utilities/list.css.map +1 -0
- package/packages/core/dist/css/utilities/order.css +2 -0
- package/packages/core/dist/css/utilities/order.css.map +1 -0
- package/packages/core/dist/css/utilities/position.css +2 -0
- package/packages/core/dist/css/utilities/position.css.map +1 -0
- package/packages/core/dist/css/utilities/ratio.css +2 -0
- package/packages/core/dist/css/utilities/ratio.css.map +1 -0
- package/packages/core/dist/css/utilities/spacing.css +2 -0
- package/packages/core/dist/css/utilities/spacing.css.map +1 -0
- package/packages/core/dist/css/utilities/typography.css +2 -0
- package/packages/core/dist/css/utilities/typography.css.map +1 -0
- package/packages/core/dist/css/utilities/visibility.css +2 -0
- package/packages/core/dist/css/utilities/visibility.css.map +1 -0
- package/packages/core/dist/css/utilities/visually-hidden.css +2 -0
- package/packages/core/dist/css/utilities/visually-hidden.css.map +1 -0
- package/packages/core/dist/css/utilities/width.css +2 -0
- package/packages/core/dist/css/utilities/width.css.map +1 -0
- package/packages/core/dist/css/utilities/z-index.css +2 -0
- package/packages/core/dist/css/utilities/z-index.css.map +1 -0
- package/packages/core/dist/css/utilities.css +2 -0
- package/packages/core/dist/css/utilities.css.map +1 -0
- package/packages/core/package.json +58 -0
- package/packages/core/scss/base/button.scss +3 -0
- package/packages/core/scss/base/form.scss +3 -0
- package/packages/core/scss/base/link.scss +3 -0
- package/packages/core/scss/base/table.scss +3 -0
- package/packages/core/scss/base.scss +3 -0
- package/packages/core/scss/component/accordion.scss +3 -0
- package/packages/core/scss/component/alert.scss +3 -0
- package/packages/core/scss/component/card.scss +3 -0
- package/packages/core/scss/component/carousel.scss +3 -0
- package/packages/core/scss/component/input-group.scss +3 -0
- package/packages/core/scss/component/list.scss +3 -0
- package/packages/core/scss/component/menu.scss +3 -0
- package/packages/core/scss/component/navigation.scss +3 -0
- package/packages/core/scss/component.scss +3 -0
- package/packages/core/scss/graupl.scss +3 -0
- package/packages/core/scss/init.scss +3 -0
- package/packages/core/scss/layout/columns.scss +3 -0
- package/packages/core/scss/layout/container.scss +3 -0
- package/packages/core/scss/layout/flex-columns.scss +3 -0
- package/packages/core/scss/layout.scss +3 -0
- package/packages/core/scss/normalize.scss +3 -0
- package/packages/core/scss/state/focus.scss +3 -0
- package/packages/core/scss/state.scss +3 -0
- package/packages/core/scss/theme/color.scss +3 -0
- package/packages/core/scss/theme/typography.scss +3 -0
- package/packages/core/scss/theme.scss +3 -0
- package/packages/core/scss/utilities/alignment.scss +3 -0
- package/packages/core/scss/utilities/background.scss +3 -0
- package/packages/core/scss/utilities/border.scss +3 -0
- package/packages/core/scss/utilities/color.scss +3 -0
- package/packages/core/scss/utilities/container.scss +3 -0
- package/packages/core/scss/utilities/display.scss +3 -0
- package/packages/core/scss/utilities/flex.scss +3 -0
- package/packages/core/scss/utilities/gradient.scss +3 -0
- package/packages/core/scss/utilities/height.scss +3 -0
- package/packages/core/scss/utilities/inset.scss +3 -0
- package/packages/core/scss/utilities/justification.scss +3 -0
- package/packages/core/scss/utilities/list.scss +3 -0
- package/packages/core/scss/utilities/order.scss +3 -0
- package/{scss/utilities/postion.scss → packages/core/scss/utilities/position.scss} +1 -1
- package/packages/core/scss/utilities/ratio.scss +3 -0
- package/packages/core/scss/utilities/spacing.scss +3 -0
- package/packages/core/scss/utilities/typography.scss +3 -0
- package/packages/core/scss/utilities/visibility.scss +3 -0
- package/packages/core/scss/utilities/visually-hidden.scss +3 -0
- package/packages/core/scss/utilities/width.scss +3 -0
- package/packages/core/scss/utilities/z-index.scss +3 -0
- package/packages/core/scss/utilities.scss +3 -0
- package/{src → packages/core/src}/scss/_defaults.scss +59 -11
- package/{src → packages/core/src}/scss/_index.scss +1 -1
- package/packages/core/src/scss/_init.scss +6 -0
- package/{src → packages/core/src}/scss/_normalize.scss +1 -1
- package/packages/core/src/scss/_variables.scss +95 -0
- package/{src → packages/core/src}/scss/base/_index.scss +1 -1
- package/{src → packages/core/src}/scss/base/button/_defaults.scss +13 -24
- package/packages/core/src/scss/base/button/_index.scss +206 -0
- package/packages/core/src/scss/base/button/_mixins.scss +104 -0
- package/packages/core/src/scss/base/button/_variables.scss +252 -0
- package/{src → packages/core/src}/scss/base/form/_defaults.scss +8 -1
- package/packages/core/src/scss/base/form/_index.scss +227 -0
- package/packages/core/src/scss/base/form/_variables.scss +245 -0
- package/packages/core/src/scss/base/link/_defaults.scss +35 -0
- package/packages/core/src/scss/base/link/_index.scss +245 -0
- package/packages/core/src/scss/base/link/_variables.scss +370 -0
- package/packages/core/src/scss/base/table/_defaults.scss +68 -0
- package/packages/core/src/scss/base/table/_index.scss +314 -0
- package/packages/core/src/scss/base/table/_variables.scss +309 -0
- package/{src → packages/core/src}/scss/component/_index.scss +2 -1
- package/{src → packages/core/src}/scss/component/accordion/_defaults.scss +1 -1
- package/{src → packages/core/src}/scss/component/accordion/_index.scss +78 -60
- package/{src → packages/core/src}/scss/component/accordion/_variables.scss +127 -87
- package/{src → packages/core/src}/scss/component/alert/_defaults.scss +1 -1
- package/{src → packages/core/src}/scss/component/alert/_index.scss +51 -50
- package/packages/core/src/scss/component/alert/_variables.scss +200 -0
- package/{src → packages/core/src}/scss/component/card/_defaults.scss +1 -1
- package/{src → packages/core/src}/scss/component/card/_index.scss +53 -19
- package/packages/core/src/scss/component/card/_variables.scss +216 -0
- package/{src → packages/core/src}/scss/component/carousel/_defaults.scss +1 -1
- package/{src → packages/core/src}/scss/component/carousel/_index.scss +32 -28
- package/{src → packages/core/src}/scss/component/carousel/_variables.scss +22 -22
- package/{src → packages/core/src}/scss/component/input-group/_defaults.scss +1 -1
- package/{src → packages/core/src}/scss/component/input-group/_index.scss +2 -2
- package/{src → packages/core/src}/scss/component/input-group/_variables.scss +13 -13
- package/{src/scss/utilities/order → packages/core/src/scss/component/list}/_defaults.scss +7 -14
- package/packages/core/src/scss/component/list/_index.scss +52 -0
- package/packages/core/src/scss/component/list/_variables.scss +236 -0
- package/{src → packages/core/src}/scss/component/menu/_defaults.scss +11 -20
- package/packages/core/src/scss/component/menu/_index.scss +308 -0
- package/packages/core/src/scss/component/menu/_variables.scss +642 -0
- package/packages/core/src/scss/component/navigation/_defaults.scss +23 -0
- package/packages/core/src/scss/component/navigation/_index.scss +190 -0
- package/packages/core/src/scss/component/navigation/_variables.scss +290 -0
- package/packages/core/src/scss/functions/_container.scss +38 -0
- package/packages/core/src/scss/functions/_important.scss +36 -0
- package/{src → packages/core/src}/scss/functions/_screen.scss +9 -1
- package/{src → packages/core/src}/scss/functions/_theme.scss +2 -2
- package/packages/core/src/scss/functions/_utility.scss +28 -0
- package/{src → packages/core/src}/scss/layout/_index.scss +1 -1
- package/{src → packages/core/src}/scss/layout/columns/_defaults.scss +9 -4
- package/packages/core/src/scss/layout/columns/_index.scss +137 -0
- package/{src → packages/core/src}/scss/layout/columns/_variables.scss +13 -9
- package/packages/core/src/scss/layout/container/_defaults.scss +35 -0
- package/packages/core/src/scss/layout/container/_index.scss +628 -0
- package/packages/core/src/scss/layout/container/_variables.scss +114 -0
- package/packages/core/src/scss/layout/flex-columns/_defaults.scss +28 -0
- package/packages/core/src/scss/layout/flex-columns/_index.scss +184 -0
- package/{src → packages/core/src}/scss/layout/flex-columns/_variables.scss +9 -5
- package/{src → packages/core/src}/scss/mixins/_animation.scss +1 -1
- package/packages/core/src/scss/mixins/_container.scss +80 -0
- package/{src → packages/core/src}/scss/mixins/_layer.scss +6 -2
- package/{src → packages/core/src}/scss/mixins/_screen.scss +25 -4
- package/packages/core/src/scss/mixins/_state.scss +18 -0
- package/packages/core/src/scss/mixins/_theme.scss +15 -0
- package/packages/core/src/scss/mixins/_utility.scss +185 -0
- package/packages/core/src/scss/mixins/_visually-hidden.scss +30 -0
- package/packages/core/src/scss/state/_index.scss +3 -0
- package/{src → packages/core/src}/scss/state/focus/_defaults.scss +1 -2
- package/packages/core/src/scss/state/focus/_index.scss +42 -0
- package/packages/core/src/scss/state/focus/_mixins.scss +13 -0
- package/packages/core/src/scss/state/focus/_variables.scss +50 -0
- package/{src → packages/core/src}/scss/theme/_index.scss +1 -1
- package/{src → packages/core/src}/scss/theme/color/_defaults.scss +1 -1
- package/{src → packages/core/src}/scss/theme/color/_index.scss +8 -8
- package/{src → packages/core/src}/scss/theme/color/_variables.scss +12 -8
- package/{src → packages/core/src}/scss/theme/typography/_defaults.scss +1 -1
- package/{src → packages/core/src}/scss/theme/typography/_index.scss +10 -1
- package/packages/core/src/scss/theme/typography/_variables.scss +248 -0
- package/{src → packages/core/src}/scss/utilities/_index.scss +7 -1
- package/packages/core/src/scss/utilities/_template/_defaults.scss +41 -0
- package/packages/core/src/scss/utilities/_template/_index.scss +171 -0
- package/{src/scss/utilities/alignment → packages/core/src/scss/utilities/_template}/_variables.scss +1 -1
- package/{src → packages/core/src}/scss/utilities/alignment/_defaults.scss +21 -7
- package/packages/core/src/scss/utilities/alignment/_index.scss +336 -0
- package/{src/scss/utilities/display → packages/core/src/scss/utilities/alignment}/_variables.scss +1 -1
- package/packages/core/src/scss/utilities/background/_defaults.scss +122 -0
- package/packages/core/src/scss/utilities/background/_index.scss +634 -0
- package/packages/core/src/scss/utilities/background/_variables.scss +6 -0
- package/packages/core/src/scss/utilities/border/_defaults.scss +73 -0
- package/packages/core/src/scss/utilities/border/_index.scss +558 -0
- package/{src/scss/utilities/list → packages/core/src/scss/utilities/border}/_variables.scss +1 -1
- package/packages/core/src/scss/utilities/color/_defaults.scss +49 -0
- package/packages/core/src/scss/utilities/color/_index.scss +469 -0
- package/{src/scss/utilities/flex → packages/core/src/scss/utilities/color}/_variables.scss +1 -1
- package/packages/core/src/scss/utilities/container/_defaults.scss +40 -0
- package/packages/core/src/scss/utilities/container/_index.scss +174 -0
- package/packages/core/src/scss/utilities/container/_variables.scss +6 -0
- package/packages/core/src/scss/utilities/display/_defaults.scss +47 -0
- package/packages/core/src/scss/utilities/display/_index.scss +184 -0
- package/{src/scss/utilities/inset → packages/core/src/scss/utilities/display}/_variables.scss +1 -1
- package/packages/core/src/scss/utilities/flex/_defaults.scss +99 -0
- package/packages/core/src/scss/utilities/flex/_index.scss +486 -0
- package/{src/scss/utilities/color → packages/core/src/scss/utilities/flex}/_variables.scss +1 -1
- package/packages/core/src/scss/utilities/gradient/_defaults.scss +70 -0
- package/packages/core/src/scss/utilities/gradient/_index.scss +696 -0
- package/packages/core/src/scss/utilities/gradient/_variables.scss +29 -0
- package/packages/core/src/scss/utilities/height/_defaults.scss +54 -0
- package/packages/core/src/scss/utilities/height/_index.scss +525 -0
- package/packages/core/src/scss/utilities/height/_variables.scss +6 -0
- package/packages/core/src/scss/utilities/inset/_defaults.scss +55 -0
- package/packages/core/src/scss/utilities/inset/_index.scss +258 -0
- package/packages/core/src/scss/utilities/inset/_variables.scss +6 -0
- package/{src → packages/core/src}/scss/utilities/justification/_defaults.scss +21 -7
- package/packages/core/src/scss/utilities/justification/_index.scss +333 -0
- package/packages/core/src/scss/utilities/justification/_variables.scss +6 -0
- package/packages/core/src/scss/utilities/list/_defaults.scss +53 -0
- package/packages/core/src/scss/utilities/list/_index.scss +253 -0
- package/packages/core/src/scss/utilities/list/_variables.scss +6 -0
- package/packages/core/src/scss/utilities/order/_defaults.scss +36 -0
- package/packages/core/src/scss/utilities/order/_index.scss +246 -0
- package/packages/core/src/scss/utilities/order/_variables.scss +6 -0
- package/packages/core/src/scss/utilities/position/_defaults.scss +41 -0
- package/packages/core/src/scss/utilities/position/_index.scss +178 -0
- package/{src/scss/utilities/height → packages/core/src/scss/utilities/position}/_variables.scss +1 -1
- package/packages/core/src/scss/utilities/ratio/_defaults.scss +42 -0
- package/packages/core/src/scss/utilities/ratio/_index.scss +188 -0
- package/{src → packages/core/src}/scss/utilities/ratio/_variables.scss +2 -2
- package/{src → packages/core/src}/scss/utilities/spacing/_defaults.scss +19 -4
- package/packages/core/src/scss/utilities/spacing/_index.scss +970 -0
- package/packages/core/src/scss/utilities/spacing/_variables.scss +6 -0
- package/packages/core/src/scss/utilities/typography/_defaults.scss +58 -0
- package/packages/core/src/scss/utilities/typography/_index.scss +1089 -0
- package/packages/core/src/scss/utilities/typography/_variables.scss +6 -0
- package/packages/core/src/scss/utilities/visibility/_defaults.scss +39 -0
- package/packages/core/src/scss/utilities/visibility/_index.scss +173 -0
- package/packages/core/src/scss/utilities/visibility/_variables.scss +6 -0
- package/packages/core/src/scss/utilities/visually-hidden/_defaults.scss +29 -0
- package/packages/core/src/scss/utilities/visually-hidden/_index.scss +189 -0
- package/packages/core/src/scss/utilities/visually-hidden/_variables.scss +6 -0
- package/packages/core/src/scss/utilities/width/_defaults.scss +54 -0
- package/packages/core/src/scss/utilities/width/_index.scss +525 -0
- package/packages/core/src/scss/utilities/width/_variables.scss +6 -0
- package/packages/core/src/scss/utilities/z-index/_defaults.scss +40 -0
- package/packages/core/src/scss/utilities/z-index/_index.scss +173 -0
- package/packages/core/src/scss/utilities/z-index/_variables.scss +6 -0
- package/packages/core/vite.config.js +28 -0
- package/packages/icons/dist/css/base/button.css +2 -0
- package/packages/icons/dist/css/base/button.css.map +1 -0
- package/packages/icons/dist/css/base/link.css +2 -0
- package/packages/icons/dist/css/base/link.css.map +1 -0
- package/packages/icons/dist/css/base.css +2 -0
- package/packages/icons/dist/css/base.css.map +1 -0
- package/packages/icons/dist/css/component/icon.css +2 -0
- package/packages/icons/dist/css/component/icon.css.map +1 -0
- package/packages/icons/dist/css/component.css +2 -0
- package/packages/icons/dist/css/component.css.map +1 -0
- package/packages/icons/dist/css/icon.css +2 -0
- package/packages/icons/dist/css/icon.css.map +1 -0
- package/packages/icons/package.json +48 -0
- package/packages/icons/scss/base/button.scss +3 -0
- package/packages/icons/scss/base/link.scss +3 -0
- package/packages/icons/scss/base.scss +3 -0
- package/packages/icons/scss/component/icon.scss +3 -0
- package/packages/icons/scss/component.scss +3 -0
- package/packages/icons/scss/icon.scss +3 -0
- package/packages/icons/src/scss/_index.scss +4 -0
- package/packages/icons/src/scss/base/_index.scss +4 -0
- package/packages/icons/src/scss/base/button/_defaults.scss +7 -0
- package/packages/icons/src/scss/base/button/_index.scss +58 -0
- package/packages/icons/src/scss/base/button/_variables.scss +7 -0
- package/packages/icons/src/scss/base/link/_defaults.scss +7 -0
- package/packages/icons/src/scss/base/link/_index.scss +58 -0
- package/packages/icons/src/scss/base/link/_variables.scss +7 -0
- package/packages/icons/src/scss/component/_index.scss +3 -0
- package/packages/icons/src/scss/component/icon/_defaults.scss +30 -0
- package/packages/icons/src/scss/component/icon/_index.scss +60 -0
- package/packages/icons/src/scss/component/icon/_mixins.scss +62 -0
- package/packages/icons/src/scss/component/icon/_variables.scss +24 -0
- package/postcss.config.cjs +2 -3
- package/scss/base/button.scss +1 -1
- package/scss/base/form.scss +1 -1
- package/scss/base/link.scss +1 -1
- package/scss/base/table.scss +1 -1
- package/scss/base.scss +1 -1
- package/scss/component/accordion.scss +1 -1
- package/scss/component/alert.scss +1 -1
- package/scss/component/card.scss +1 -1
- package/scss/component/carousel.scss +1 -1
- package/scss/component/input-group.scss +1 -1
- package/scss/component/list.scss +3 -0
- package/scss/component/menu.scss +1 -1
- package/scss/component/navigation.scss +1 -1
- package/scss/component.scss +1 -1
- package/scss/graupl.scss +1 -1
- package/scss/init.scss +1 -1
- package/scss/layout/columns.scss +1 -1
- package/scss/layout/container.scss +1 -1
- package/scss/layout/flex-columns.scss +1 -1
- package/scss/layout.scss +1 -1
- package/scss/normalize.scss +1 -1
- package/scss/state/focus.scss +1 -1
- package/scss/state.scss +1 -1
- package/scss/theme/color.scss +1 -1
- package/scss/theme/typography.scss +1 -1
- package/scss/theme.scss +1 -1
- package/scss/utilities/alignment.scss +1 -1
- package/scss/utilities/background.scss +3 -0
- package/scss/utilities/border.scss +3 -0
- package/scss/utilities/color.scss +1 -1
- package/scss/utilities/container.scss +3 -0
- package/scss/utilities/display.scss +1 -1
- package/scss/utilities/flex.scss +1 -1
- package/scss/utilities/gradient.scss +3 -0
- package/scss/utilities/height.scss +1 -1
- package/scss/utilities/inset.scss +1 -1
- package/scss/utilities/justification.scss +1 -1
- package/scss/utilities/list.scss +1 -1
- package/scss/utilities/order.scss +1 -1
- package/scss/utilities/position.scss +3 -0
- package/scss/utilities/ratio.scss +1 -1
- package/scss/utilities/spacing.scss +1 -1
- package/scss/utilities/typography.scss +1 -1
- package/scss/utilities/visibility.scss +1 -1
- package/scss/utilities/visually-hidden.scss +3 -0
- package/scss/utilities/width.scss +1 -1
- package/scss/utilities/z-index.scss +3 -0
- package/scss/utilities.scss +1 -1
- package/stylelint.config.js +1 -0
- package/vite.config.js +6 -35
- package/dist/css/utilities/postion.css +0 -2
- package/dist/css/utilities/postion.css.map +0 -1
- package/dist/js/component/accordion.cjs.js +0 -3
- package/dist/js/component/accordion.esm.js +0 -1289
- package/dist/js/component/accordion.iife.js +0 -3
- package/dist/js/component/alert.cjs.js +0 -3
- package/dist/js/component/alert.esm.js +0 -529
- package/dist/js/component/alert.iife.js +0 -3
- package/dist/js/component/carousel.cjs.js +0 -3
- package/dist/js/component/carousel.esm.js +0 -1110
- package/dist/js/component/carousel.iife.js +0 -3
- package/src/scss/_variables.scss +0 -53
- package/src/scss/base/button/_index.scss +0 -107
- package/src/scss/base/button/_mixins.scss +0 -166
- package/src/scss/base/button/_variables.scss +0 -176
- package/src/scss/base/form/_index.scss +0 -93
- package/src/scss/base/form/_variables.scss +0 -156
- package/src/scss/base/link/_defaults.scss +0 -50
- package/src/scss/base/link/_index.scss +0 -134
- package/src/scss/base/link/_variables.scss +0 -262
- package/src/scss/base/table/_defaults.scss +0 -53
- package/src/scss/base/table/_index.scss +0 -121
- package/src/scss/base/table/_variables.scss +0 -135
- package/src/scss/component/alert/_variables.scss +0 -173
- package/src/scss/component/card/_variables.scss +0 -186
- package/src/scss/component/menu/_index.scss +0 -305
- package/src/scss/component/menu/_variables.scss +0 -500
- package/src/scss/component/navigation/_defaults.scss +0 -29
- package/src/scss/component/navigation/_index.scss +0 -189
- package/src/scss/component/navigation/_variables.scss +0 -237
- package/src/scss/functions/_important.scss +0 -13
- package/src/scss/layout/columns/_index.scss +0 -58
- package/src/scss/layout/container/_defaults.scss +0 -17
- package/src/scss/layout/container/_index.scss +0 -41
- package/src/scss/layout/container/_variables.scss +0 -50
- package/src/scss/layout/flex-columns/_defaults.scss +0 -18
- package/src/scss/layout/flex-columns/_index.scss +0 -80
- package/src/scss/mixins/_utility.scss +0 -30
- package/src/scss/mixins/_visually-hidden.scss +0 -20
- package/src/scss/state/_index.scss +0 -3
- package/src/scss/state/focus/_index.scss +0 -13
- package/src/scss/state/focus/_mixins.scss +0 -15
- package/src/scss/state/focus/_variables.scss +0 -44
- package/src/scss/theme/typography/_variables.scss +0 -231
- package/src/scss/utilities/alignment/_index.scss +0 -75
- package/src/scss/utilities/color/_defaults.scss +0 -35
- package/src/scss/utilities/color/_index.scss +0 -91
- package/src/scss/utilities/display/_defaults.scss +0 -32
- package/src/scss/utilities/display/_index.scss +0 -61
- package/src/scss/utilities/flex/_defaults.scss +0 -63
- package/src/scss/utilities/flex/_index.scss +0 -71
- package/src/scss/utilities/height/_defaults.scss +0 -41
- package/src/scss/utilities/height/_index.scss +0 -98
- package/src/scss/utilities/inset/_defaults.scss +0 -41
- package/src/scss/utilities/inset/_index.scss +0 -37
- package/src/scss/utilities/justification/_index.scss +0 -75
- package/src/scss/utilities/justification/_variables.scss +0 -6
- package/src/scss/utilities/list/_defaults.scss +0 -39
- package/src/scss/utilities/list/_index.scss +0 -56
- package/src/scss/utilities/order/_index.scss +0 -63
- package/src/scss/utilities/order/_variables.scss +0 -6
- package/src/scss/utilities/position/_defaults.scss +0 -26
- package/src/scss/utilities/position/_index.scss +0 -37
- package/src/scss/utilities/position/_variables.scss +0 -6
- package/src/scss/utilities/ratio/_defaults.scss +0 -28
- package/src/scss/utilities/ratio/_index.scss +0 -52
- package/src/scss/utilities/spacing/_index.scss +0 -169
- package/src/scss/utilities/spacing/_variables.scss +0 -6
- package/src/scss/utilities/typography/_defaults.scss +0 -30
- package/src/scss/utilities/typography/_index.scss +0 -224
- package/src/scss/utilities/typography/_variables.scss +0 -6
- package/src/scss/utilities/visibility/_defaults.scss +0 -25
- package/src/scss/utilities/visibility/_index.scss +0 -36
- package/src/scss/utilities/visibility/_variables.scss +0 -6
- package/src/scss/utilities/width/_defaults.scss +0 -41
- package/src/scss/utilities/width/_index.scss +0 -98
- package/src/scss/utilities/width/_variables.scss +0 -6
- /package/{src → packages/core/src}/js/accordion/Accordion.js +0 -0
- /package/{src → packages/core/src}/js/accordion/AccordionItem.js +0 -0
- /package/{src → packages/core/src}/js/accordion/index.js +0 -0
- /package/{src → packages/core/src}/js/alert/Alert.js +0 -0
- /package/{src → packages/core/src}/js/alert/index.js +0 -0
- /package/{src → packages/core/src}/js/carousel/Carousel.js +0 -0
- /package/{src → packages/core/src}/js/carousel/index.js +0 -0
- /package/{src → packages/core/src}/js/domHelpers.js +0 -0
- /package/{src → packages/core/src}/js/eventHandlers.js +0 -0
- /package/{src → packages/core/src}/js/navigation/index.js +0 -0
- /package/{src → packages/core/src}/js/storage.js +0 -0
- /package/{src → packages/core/src}/js/validate.js +0 -0
package/dist/js/graupl.esm.js
CHANGED
|
@@ -1,72 +1,72 @@
|
|
|
1
1
|
var F = Object.defineProperty;
|
|
2
|
-
var
|
|
3
|
-
var r = (
|
|
4
|
-
function
|
|
2
|
+
var q = (s, t, e) => t in s ? F(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e;
|
|
3
|
+
var r = (s, t, e) => q(s, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
+
function C(s, t) {
|
|
5
5
|
try {
|
|
6
6
|
if (typeof t != "object") {
|
|
7
|
-
const
|
|
7
|
+
const e = typeof t;
|
|
8
8
|
throw new TypeError(
|
|
9
|
-
`Elements given to isValidInstance() must be inside of an object. "${
|
|
9
|
+
`Elements given to isValidInstance() must be inside of an object. "${e}" given.`
|
|
10
10
|
);
|
|
11
11
|
}
|
|
12
|
-
for (const
|
|
13
|
-
if (!(t[
|
|
14
|
-
const i = typeof t[
|
|
12
|
+
for (const e in t)
|
|
13
|
+
if (!(t[e] instanceof s)) {
|
|
14
|
+
const i = typeof t[e];
|
|
15
15
|
throw new TypeError(
|
|
16
|
-
`${
|
|
16
|
+
`${e} must be an instance of ${s.name}. "${i}" given.`
|
|
17
17
|
);
|
|
18
18
|
}
|
|
19
19
|
return {
|
|
20
20
|
status: !0,
|
|
21
21
|
error: null
|
|
22
22
|
};
|
|
23
|
-
} catch (
|
|
23
|
+
} catch (e) {
|
|
24
24
|
return {
|
|
25
25
|
status: !1,
|
|
26
|
-
error:
|
|
26
|
+
error: e
|
|
27
27
|
};
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
|
-
function
|
|
30
|
+
function o(s, t) {
|
|
31
31
|
try {
|
|
32
32
|
if (typeof t != "object") {
|
|
33
|
-
const
|
|
33
|
+
const e = typeof t;
|
|
34
34
|
throw new TypeError(
|
|
35
|
-
`Values given to isValidType() must be inside of an object. "${
|
|
35
|
+
`Values given to isValidType() must be inside of an object. "${e}" given.`
|
|
36
36
|
);
|
|
37
37
|
}
|
|
38
|
-
for (const
|
|
39
|
-
const i = typeof t[
|
|
40
|
-
if (i !==
|
|
41
|
-
throw new TypeError(`${
|
|
38
|
+
for (const e in t) {
|
|
39
|
+
const i = typeof t[e];
|
|
40
|
+
if (i !== s)
|
|
41
|
+
throw new TypeError(`${e} must be a ${s}. "${i}" given.`);
|
|
42
42
|
}
|
|
43
43
|
return {
|
|
44
44
|
status: !0,
|
|
45
45
|
error: null
|
|
46
46
|
};
|
|
47
|
-
} catch (
|
|
47
|
+
} catch (e) {
|
|
48
48
|
return {
|
|
49
49
|
status: !1,
|
|
50
|
-
error:
|
|
50
|
+
error: e
|
|
51
51
|
};
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
|
-
function
|
|
54
|
+
function D(s) {
|
|
55
55
|
try {
|
|
56
|
-
if (typeof
|
|
57
|
-
const t = typeof
|
|
56
|
+
if (typeof s != "object") {
|
|
57
|
+
const t = typeof s;
|
|
58
58
|
throw new TypeError(
|
|
59
59
|
`Values given to isQuerySelector() must be inside of an object. "${t}" given.`
|
|
60
60
|
);
|
|
61
61
|
}
|
|
62
|
-
for (const t in
|
|
62
|
+
for (const t in s)
|
|
63
63
|
try {
|
|
64
|
-
if (
|
|
64
|
+
if (s[t] === null)
|
|
65
65
|
throw new Error();
|
|
66
|
-
document.querySelector(
|
|
66
|
+
document.querySelector(s[t]);
|
|
67
67
|
} catch {
|
|
68
68
|
throw new TypeError(
|
|
69
|
-
`${t} must be a valid query selector. "${
|
|
69
|
+
`${t} must be a valid query selector. "${s[t]}" given.`
|
|
70
70
|
);
|
|
71
71
|
}
|
|
72
72
|
return {
|
|
@@ -80,19 +80,19 @@ function w(e) {
|
|
|
80
80
|
};
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
|
-
function h(
|
|
83
|
+
function h(s) {
|
|
84
84
|
try {
|
|
85
|
-
if (typeof
|
|
86
|
-
const t = typeof
|
|
85
|
+
if (typeof s != "object" || Array.isArray(s)) {
|
|
86
|
+
const t = typeof s;
|
|
87
87
|
throw new TypeError(
|
|
88
88
|
`Values given to isValidClassList() must be inside of an object. "${t}" given.`
|
|
89
89
|
);
|
|
90
90
|
}
|
|
91
|
-
for (const t in
|
|
92
|
-
const
|
|
93
|
-
if (
|
|
94
|
-
if (Array.isArray(
|
|
95
|
-
|
|
91
|
+
for (const t in s) {
|
|
92
|
+
const e = typeof s[t];
|
|
93
|
+
if (e !== "string")
|
|
94
|
+
if (Array.isArray(s[t]))
|
|
95
|
+
s[t].forEach((i) => {
|
|
96
96
|
if (typeof i != "string")
|
|
97
97
|
throw new TypeError(
|
|
98
98
|
`${t} must be a string or an array of strings. An array containing non-strings given.`
|
|
@@ -100,11 +100,11 @@ function h(e) {
|
|
|
100
100
|
});
|
|
101
101
|
else
|
|
102
102
|
throw new TypeError(
|
|
103
|
-
`${t} must be a string or an array of strings. "${
|
|
103
|
+
`${t} must be a string or an array of strings. "${e}" given.`
|
|
104
104
|
);
|
|
105
105
|
else {
|
|
106
106
|
const i = {};
|
|
107
|
-
i[t] =
|
|
107
|
+
i[t] = s[t], D(i);
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
110
|
return {
|
|
@@ -118,25 +118,310 @@ function h(e) {
|
|
|
118
118
|
};
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
|
-
function
|
|
122
|
-
if (
|
|
123
|
-
const
|
|
121
|
+
function y(s, t) {
|
|
122
|
+
if (o("string", { tagName: s }).status && C(HTMLElement, t).status) {
|
|
123
|
+
const e = s.toLowerCase();
|
|
124
124
|
let i = !0;
|
|
125
125
|
for (const n in t)
|
|
126
|
-
t[n].tagName.toLowerCase() !==
|
|
126
|
+
t[n].tagName.toLowerCase() !== e && (i = !1);
|
|
127
127
|
return i;
|
|
128
128
|
} else
|
|
129
129
|
return !1;
|
|
130
130
|
}
|
|
131
|
-
function u(
|
|
132
|
-
|
|
131
|
+
function u(s, t) {
|
|
132
|
+
s === "" || s.length === 0 || (typeof s == "string" ? t.classList.add(s) : t.classList.add(...s));
|
|
133
133
|
}
|
|
134
|
-
function
|
|
135
|
-
|
|
134
|
+
function d(s, t) {
|
|
135
|
+
s === "" || s.length === 0 || (typeof s == "string" ? t.classList.remove(s) : t.classList.remove(...s));
|
|
136
136
|
}
|
|
137
|
-
|
|
137
|
+
class v {
|
|
138
|
+
/**
|
|
139
|
+
* Constructs a new Accordion item object.
|
|
140
|
+
*
|
|
141
|
+
* @class
|
|
142
|
+
*
|
|
143
|
+
* @param {object} options - The options object.
|
|
144
|
+
* @param {HTMLElement} options.accordionItemElement - The accordion item element.
|
|
145
|
+
* @param {HTMLElement} options.accordionItemToggleElement - The toggle element.
|
|
146
|
+
* @param {HTMLElement} options.accordionItemHeaderElement - The header element.
|
|
147
|
+
* @param {HTMLElement} options.accordionItemContentElement - The content element.
|
|
148
|
+
* @param {Accordion} [options.parentAccordion = null] - The accordion containing this item.
|
|
149
|
+
*/
|
|
150
|
+
constructor({
|
|
151
|
+
accordionItemElement: t,
|
|
152
|
+
accordionItemToggleElement: e,
|
|
153
|
+
accordionItemHeaderElement: i,
|
|
154
|
+
accordionItemContentElement: n,
|
|
155
|
+
parentAccordion: a = null
|
|
156
|
+
}) {
|
|
157
|
+
/**
|
|
158
|
+
* The HTML elements for the accordion item in the DOM.
|
|
159
|
+
*
|
|
160
|
+
* @protected
|
|
161
|
+
*
|
|
162
|
+
* @type {Object<HTMLElement>}
|
|
163
|
+
*
|
|
164
|
+
* @property {HTMLElement} item - The accordion item element.
|
|
165
|
+
* @property {HTMLElement} toggle - The controller element.
|
|
166
|
+
* @property {HTMLElement} header - The header element.
|
|
167
|
+
* @property {HTMLElement} content - The content element.
|
|
168
|
+
*/
|
|
169
|
+
r(this, "_dom", {
|
|
170
|
+
item: null,
|
|
171
|
+
toggle: null,
|
|
172
|
+
header: null,
|
|
173
|
+
content: null
|
|
174
|
+
});
|
|
175
|
+
/**
|
|
176
|
+
* The declared graupl accordion elements within the accordion item.
|
|
177
|
+
*
|
|
178
|
+
* @protected
|
|
179
|
+
*
|
|
180
|
+
* @type {Object<Accordion>}
|
|
181
|
+
*
|
|
182
|
+
* @property {Accordion} parentAccordion - The parent accordion containing this item.
|
|
183
|
+
*/
|
|
184
|
+
r(this, "_elements", {
|
|
185
|
+
parentAccordion: null
|
|
186
|
+
});
|
|
187
|
+
/**
|
|
188
|
+
* The open state of the accordion.
|
|
189
|
+
*
|
|
190
|
+
* @protected
|
|
191
|
+
*
|
|
192
|
+
* @type {boolean}
|
|
193
|
+
*/
|
|
194
|
+
r(this, "_open", !1);
|
|
195
|
+
/**
|
|
196
|
+
* The locked state of the accordions item.
|
|
197
|
+
*
|
|
198
|
+
* If locked, the accordion item cannot be closed.
|
|
199
|
+
*
|
|
200
|
+
* @protected
|
|
201
|
+
*
|
|
202
|
+
* @type {boolean}
|
|
203
|
+
*/
|
|
204
|
+
r(this, "_locked", !1);
|
|
205
|
+
/**
|
|
206
|
+
* The event that is triggered when the accordion item is shown.
|
|
207
|
+
*
|
|
208
|
+
* @protected
|
|
209
|
+
*
|
|
210
|
+
* @event grauplAccordionItemExpand
|
|
211
|
+
*
|
|
212
|
+
* @type {CustomEvent}
|
|
213
|
+
*
|
|
214
|
+
* @property {boolean} bubbles - A flag to bubble the event.
|
|
215
|
+
* @property {Object<AccordionItem>} detail - The details object containing the Accordion item itself.
|
|
216
|
+
*/
|
|
217
|
+
r(this, "_expandEvent", new CustomEvent("grauplAccordionItemExpand", {
|
|
218
|
+
bubbles: !0,
|
|
219
|
+
detail: { item: this }
|
|
220
|
+
}));
|
|
221
|
+
/**
|
|
222
|
+
* The event that is triggered when the accordion item is hidden.
|
|
223
|
+
*
|
|
224
|
+
* @protected
|
|
225
|
+
*
|
|
226
|
+
* @event grauplAccordionItemCollapse
|
|
227
|
+
*
|
|
228
|
+
* @type {CustomEvent}
|
|
229
|
+
*
|
|
230
|
+
* @property {boolean} bubbles - A flag to bubble the event.
|
|
231
|
+
* @property {Object<AccordionItem>} detail - The details object containing the Accordion item itself.
|
|
232
|
+
*/
|
|
233
|
+
r(this, "_collapseEvent", new CustomEvent("grauplAccordionItemCollapse", {
|
|
234
|
+
bubbles: !0,
|
|
235
|
+
detail: { item: this }
|
|
236
|
+
}));
|
|
237
|
+
this._dom.item = t, this._dom.toggle = e, this._dom.header = i, this._dom.content = n, this._elements.parentAccordion = a;
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Initializes the accordion item.
|
|
241
|
+
*/
|
|
242
|
+
initialize() {
|
|
243
|
+
this._setIds(), this._setAriaAttributes(), this.dom.toggle.getAttribute("aria-expanded") === "true" ? this.show(!1, !1) : this.hide(!1, !1);
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* The HTML elements for the accordion item in the DOM.
|
|
247
|
+
*
|
|
248
|
+
* @readonly
|
|
249
|
+
*
|
|
250
|
+
* @type {object}
|
|
251
|
+
*
|
|
252
|
+
* @see _dom
|
|
253
|
+
*/
|
|
254
|
+
get dom() {
|
|
255
|
+
return this._dom;
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* The declared graupl accordion elements within the accordion item.
|
|
259
|
+
*
|
|
260
|
+
* @readonly
|
|
261
|
+
*
|
|
262
|
+
* @type {Object<Accordion>}
|
|
263
|
+
*
|
|
264
|
+
* @see _elements
|
|
265
|
+
*/
|
|
266
|
+
get elements() {
|
|
267
|
+
return this._elements;
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* The open state of the accordion.
|
|
271
|
+
*
|
|
272
|
+
* @readonly
|
|
273
|
+
*
|
|
274
|
+
* @type {object}
|
|
275
|
+
*
|
|
276
|
+
* @see _open
|
|
277
|
+
*/
|
|
278
|
+
get isOpen() {
|
|
279
|
+
return this._open;
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* The locked state of the accordions item.
|
|
283
|
+
*
|
|
284
|
+
* If locked, the accordion item cannot be closed.
|
|
285
|
+
*
|
|
286
|
+
* @readonly
|
|
287
|
+
*
|
|
288
|
+
* @type {boolean}
|
|
289
|
+
*
|
|
290
|
+
* @see _locked
|
|
291
|
+
*/
|
|
292
|
+
get isLocked() {
|
|
293
|
+
return this._locked;
|
|
294
|
+
}
|
|
295
|
+
set isOpen(t) {
|
|
296
|
+
o("boolean", { value: t }), this._open !== t && (this._open = t);
|
|
297
|
+
}
|
|
298
|
+
/**
|
|
299
|
+
* Sets the IDs for the accordion item and it's elements if they don't exist.
|
|
300
|
+
*
|
|
301
|
+
* The generated IDs use the parent accordion's key and follows the pattern:
|
|
302
|
+
* - Accordion item: `accordion-item-{key}-{index}`
|
|
303
|
+
* - Accordion item toggle: `accordion-item-toggle-{key}-{index}`
|
|
304
|
+
* - Accordion item content: `accordion-item-content-{key}-{index}`
|
|
305
|
+
*/
|
|
306
|
+
_setIds() {
|
|
307
|
+
const { key: t } = this.elements.parentAccordion, e = this.elements.parentAccordion.dom.accordionItems.indexOf(
|
|
308
|
+
this.dom.item
|
|
309
|
+
);
|
|
310
|
+
this.dom.item.id = this.dom.item.id || `accordion-item-${t}-${e}`, this.dom.toggle.id = this.dom.toggle.id || `accordion-item-toggle-${t}-${e}`, this.dom.header.id = this.dom.header.id || `accordion-item-header-${t}-${e}`, this.dom.content.id = this.dom.content.id || `accordion-item-content-${t}-${e}`;
|
|
311
|
+
}
|
|
312
|
+
/**
|
|
313
|
+
* Sets the ARIA attributes for the accordion item and it's elements.
|
|
314
|
+
*/
|
|
315
|
+
_setAriaAttributes() {
|
|
316
|
+
y("button", { toggle: this.dom.toggle }) || this.dom.toggle.setAttribute("role", "button"), this.dom.toggle.getAttribute("aria-expanded") !== "true" && this.dom.toggle.setAttribute("aria-expanded", "false"), this.dom.toggle.setAttribute("aria-controls", this.dom.content.id), y("section", { content: this.dom.content }) || this.dom.content.setAttribute("role", "region"), this.dom.content.setAttribute("aria-labelledby", this.dom.toggle.id);
|
|
317
|
+
}
|
|
318
|
+
/**
|
|
319
|
+
* Shows the accordion item.
|
|
320
|
+
*
|
|
321
|
+
* @public
|
|
322
|
+
*
|
|
323
|
+
* @fires grauplAccordionItemExpand
|
|
324
|
+
*
|
|
325
|
+
* @param {boolean} [emit = true] - Emit the show event once shown.
|
|
326
|
+
* @param {boolean} [transition = true] - Respect the transition class.
|
|
327
|
+
*/
|
|
328
|
+
show(t = !0, e = !0) {
|
|
329
|
+
if (this._open)
|
|
330
|
+
return;
|
|
331
|
+
const { closeClass: i, openClass: n, transitionClass: a, openDuration: c } = this.elements.parentAccordion;
|
|
332
|
+
this.dom.toggle.setAttribute("aria-expanded", "true"), e && a !== "" ? (u(a, this.dom.item), requestAnimationFrame(() => {
|
|
333
|
+
d(i, this.dom.item), this.dom.item.style.height = `${this.dom.header.getBoundingClientRect().height}px`, requestAnimationFrame(() => {
|
|
334
|
+
u(n, this.dom.item), this.dom.item.style.height = `${this.dom.header.getBoundingClientRect().height + this.dom.content.getBoundingClientRect().height}px`, requestAnimationFrame(() => {
|
|
335
|
+
setTimeout(() => {
|
|
336
|
+
d(a, this.dom.item), this.dom.item.style.height = "";
|
|
337
|
+
}, c);
|
|
338
|
+
});
|
|
339
|
+
});
|
|
340
|
+
})) : (u(n, this.dom.item), d(i, this.dom.item)), this._open = !0, this.elements.parentAccordion.allowMultipleExpand || (this.unlockSiblings(), this.closeSiblings()), this.elements.parentAccordion.allowNoExpand || (this.elements.parentAccordion.openAccordionItems.length <= 1 ? this.lock() : this.unlockSiblings()), t && this.dom.item.dispatchEvent(this._expandEvent);
|
|
341
|
+
}
|
|
342
|
+
/**
|
|
343
|
+
* Hides the accordion item.
|
|
344
|
+
*
|
|
345
|
+
* @public
|
|
346
|
+
*
|
|
347
|
+
* @fires grauplAccordionItemCollapse
|
|
348
|
+
*
|
|
349
|
+
* @param {boolean} [emit = true] - Emit the show event once shown.
|
|
350
|
+
* @param {boolean} [transition = true] - Respect the transition class.
|
|
351
|
+
*/
|
|
352
|
+
hide(t = !0, e = !0) {
|
|
353
|
+
if (!this._open || !this.elements.parentAccordion.allowNoExpand && this.elements.parentAccordion.openAccordionItems.length <= 1)
|
|
354
|
+
return;
|
|
355
|
+
const { closeClass: i, openClass: n, transitionClass: a, closeDuration: c } = this.elements.parentAccordion;
|
|
356
|
+
this.dom.toggle.setAttribute("aria-expanded", "false"), e && a !== "" ? (u(a, this.dom.item), this.dom.item.style.height = `${this.dom.item.getBoundingClientRect().height}px`, requestAnimationFrame(() => {
|
|
357
|
+
d(n, this.dom.item), this.dom.item.style.height = `${this.dom.header.getBoundingClientRect().height}px`, requestAnimationFrame(() => {
|
|
358
|
+
u(i, this.dom.item), requestAnimationFrame(() => {
|
|
359
|
+
setTimeout(() => {
|
|
360
|
+
d(a, this.dom.item), this.dom.item.style.height = "";
|
|
361
|
+
}, c);
|
|
362
|
+
});
|
|
363
|
+
});
|
|
364
|
+
})) : (u(i, this.dom.item), d(n, this.dom.item)), this._open = !1, !this.elements.parentAccordion.allowNoExpand && this.elements.parentAccordion.openAccordionItems.length === 1 && this.elements.parentAccordion.openAccordionItems[0].lock(), t && this.dom.item.dispatchEvent(this._collapseEvent);
|
|
365
|
+
}
|
|
366
|
+
/**
|
|
367
|
+
* Toggle the accordion item.
|
|
368
|
+
*
|
|
369
|
+
* @public
|
|
370
|
+
*/
|
|
371
|
+
toggle() {
|
|
372
|
+
this.isOpen ? this.hide() : this.show();
|
|
373
|
+
}
|
|
374
|
+
/**
|
|
375
|
+
* Focuses the accordion item.
|
|
376
|
+
*
|
|
377
|
+
* @public
|
|
378
|
+
*/
|
|
379
|
+
focus() {
|
|
380
|
+
this.dom.toggle.focus();
|
|
381
|
+
}
|
|
382
|
+
/**
|
|
383
|
+
* Blurs the accordion item.
|
|
384
|
+
*
|
|
385
|
+
* @public
|
|
386
|
+
*/
|
|
387
|
+
blur() {
|
|
388
|
+
this.dom.toggle.blur();
|
|
389
|
+
}
|
|
390
|
+
/**
|
|
391
|
+
* Locks the accordion item.
|
|
392
|
+
*
|
|
393
|
+
* @public
|
|
394
|
+
*/
|
|
395
|
+
lock() {
|
|
396
|
+
this._locked = !0, this.dom.toggle.setAttribute("disabled", "true");
|
|
397
|
+
}
|
|
398
|
+
/**
|
|
399
|
+
* Unlocks the accordion item.
|
|
400
|
+
*
|
|
401
|
+
* @public
|
|
402
|
+
*/
|
|
403
|
+
unlock() {
|
|
404
|
+
this._locked = !1, this.dom.toggle.removeAttribute("disabled");
|
|
405
|
+
}
|
|
406
|
+
closeSiblings() {
|
|
407
|
+
this.elements.parentAccordion && this.elements.parentAccordion.elements.accordionItems.forEach((t) => {
|
|
408
|
+
t !== this && t.hide();
|
|
409
|
+
});
|
|
410
|
+
}
|
|
411
|
+
/**
|
|
412
|
+
* Unlocks the siblings of the accordion item.
|
|
413
|
+
*
|
|
414
|
+
* @public
|
|
415
|
+
*/
|
|
416
|
+
unlockSiblings() {
|
|
417
|
+
this.elements.parentAccordion && this.elements.parentAccordion.elements.accordionItems.forEach((t) => {
|
|
418
|
+
t !== this && t.unlock();
|
|
419
|
+
});
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
function f(s) {
|
|
138
423
|
try {
|
|
139
|
-
const t =
|
|
424
|
+
const t = s.key || s.keyCode, e = {
|
|
140
425
|
Enter: t === "Enter" || t === 13,
|
|
141
426
|
Space: t === " " || t === "Spacebar" || t === 32,
|
|
142
427
|
Escape: t === "Escape" || t === "Esc" || t === 27,
|
|
@@ -148,45 +433,858 @@ function m(e) {
|
|
|
148
433
|
End: t === "End" || t === 35,
|
|
149
434
|
Tab: t === "Tab" || t === 9
|
|
150
435
|
};
|
|
151
|
-
return Object.keys(
|
|
436
|
+
return Object.keys(e).find((i) => e[i] === !0) || "";
|
|
152
437
|
} catch {
|
|
153
438
|
return "";
|
|
154
439
|
}
|
|
155
440
|
}
|
|
156
|
-
function
|
|
157
|
-
|
|
158
|
-
}
|
|
159
|
-
function
|
|
160
|
-
window.Graupl = window.Graupl || {},
|
|
161
|
-
}
|
|
162
|
-
function
|
|
163
|
-
return
|
|
164
|
-
}
|
|
165
|
-
function
|
|
166
|
-
|
|
167
|
-
}
|
|
168
|
-
function
|
|
169
|
-
|
|
170
|
-
}
|
|
171
|
-
function
|
|
172
|
-
|
|
173
|
-
}
|
|
174
|
-
function
|
|
175
|
-
return
|
|
176
|
-
}
|
|
177
|
-
function V(
|
|
178
|
-
|
|
179
|
-
}
|
|
180
|
-
const
|
|
181
|
-
initializeStorage:
|
|
182
|
-
getStorage:
|
|
183
|
-
setStorage:
|
|
184
|
-
clearStorage:
|
|
185
|
-
pushToStorage:
|
|
186
|
-
getFromStorage:
|
|
187
|
-
removeFromStorage: V
|
|
188
|
-
};
|
|
189
|
-
class R {
|
|
441
|
+
function p(s) {
|
|
442
|
+
s.preventDefault(), s.stopPropagation();
|
|
443
|
+
}
|
|
444
|
+
function H(s = null) {
|
|
445
|
+
window.Graupl = window.Graupl || {}, o("string", { type: s }) && (window.Graupl[s] = window.Graupl[s] || {});
|
|
446
|
+
}
|
|
447
|
+
function G(s = null) {
|
|
448
|
+
return o("string", { type: s }) ? window.Graupl[s] : window.Graupl;
|
|
449
|
+
}
|
|
450
|
+
function z(s, t = {}) {
|
|
451
|
+
o("string", { type: s }) && o("object", { data: t }) && (window.Graupl[s] = t);
|
|
452
|
+
}
|
|
453
|
+
function j(s) {
|
|
454
|
+
o("string", { type: s }) && (window.Graupl[s] = {});
|
|
455
|
+
}
|
|
456
|
+
function P(s, t, e) {
|
|
457
|
+
o("string", { type: s, key: t }) && (window.Graupl[s][t] = e);
|
|
458
|
+
}
|
|
459
|
+
function N(s, t) {
|
|
460
|
+
return o("string", { type: s, key: t }) ? window.Graupl[s][t] : null;
|
|
461
|
+
}
|
|
462
|
+
function V(s, t) {
|
|
463
|
+
o("string", { type: s, key: t }) && delete window.Graupl[s][t];
|
|
464
|
+
}
|
|
465
|
+
const g = {
|
|
466
|
+
initializeStorage: H,
|
|
467
|
+
getStorage: G,
|
|
468
|
+
setStorage: z,
|
|
469
|
+
clearStorage: j,
|
|
470
|
+
pushToStorage: P,
|
|
471
|
+
getFromStorage: N,
|
|
472
|
+
removeFromStorage: V
|
|
473
|
+
};
|
|
474
|
+
class R {
|
|
475
|
+
/**
|
|
476
|
+
* Constructs a new `Accordion`.
|
|
477
|
+
*
|
|
478
|
+
* @param {object} options - The options for generating the accordion.
|
|
479
|
+
* @param {HTMLElement} [options.accordionElement] - The accordion element in the DOM.
|
|
480
|
+
* @param {string} [options.accordionItemSelector = .accordion-item] - The query selector string for accordion items.
|
|
481
|
+
* @param {string} [options.accordionItemToggleSelector = .accordion-item-toggle] - The query selector string for accordion toggle.
|
|
482
|
+
* @param {string} [options.accordionItemHeaderSelector = .accordion-item-header] - The query selector string for accordion header.
|
|
483
|
+
* @param {string} [options.accordionItemContentSelector = .accordion-item-content] - The query selector string for accordion content.
|
|
484
|
+
* @param {?(string|string[])} [options.openClass = show] - The class to apply when a accordion is "open".
|
|
485
|
+
* @param {?(string|string[])} [options.closeClass = hide] - The class to apply when a accordion is "closed".
|
|
486
|
+
* @param {?(string|string[])} [options.transitionClass = transitioning] - The class to apply when a accordion is transitioning between "open" and "closed" states.
|
|
487
|
+
* @param {number} [options.transitionDuration = 300] - The duration of the transition between "open" and "closed" states (in milliseconds).
|
|
488
|
+
* @param {number} [options.openDuration = -1] - The duration of the transition from "closed" to "open" states (in milliseconds).
|
|
489
|
+
* @param {number} [options.closeDuration = -1] - The duration of the transition from "open" to "closed" states (in milliseconds).
|
|
490
|
+
* @param {boolean} [options.optionalKeySupport = false] - A flag to determine if accordions can be navigated with arrows.
|
|
491
|
+
* @param {boolean} [options.allowMultipleExpand = true] - A flag to determine if multiple accordions can be open at the same time.
|
|
492
|
+
* @param {boolean} [options.allowNoExpand = true] - A flag to determine if no accordions can be open at the same time.
|
|
493
|
+
* @param {?string} [options.prefix = graupl-] - The prefix to use for CSS custom properties.
|
|
494
|
+
* @param {?string} [options.key = null] - The key used to generate IDs throughout the accordion.
|
|
495
|
+
* @param {boolean} [options.initialize = false] - A flag to initialize the accordion immediately upon creation.
|
|
496
|
+
*/
|
|
497
|
+
constructor({
|
|
498
|
+
accordionElement: t,
|
|
499
|
+
accordionItemSelector: e = ".accordion-item",
|
|
500
|
+
accordionItemToggleSelector: i = ".accordion-item-toggle",
|
|
501
|
+
accordionItemHeaderSelector: n = ".accordion-item-header",
|
|
502
|
+
accordionItemContentSelector: a = ".accordion-item-content",
|
|
503
|
+
openClass: c = "show",
|
|
504
|
+
closeClass: _ = "hide",
|
|
505
|
+
transitionClass: l = "transitioning",
|
|
506
|
+
transitionDuration: m = 300,
|
|
507
|
+
openDuration: E = -1,
|
|
508
|
+
closeDuration: w = -1,
|
|
509
|
+
optionalKeySupport: I = !1,
|
|
510
|
+
allowMultipleExpand: b = !0,
|
|
511
|
+
allowNoExpand: k = !0,
|
|
512
|
+
prefix: A = "am-",
|
|
513
|
+
key: T = null,
|
|
514
|
+
initialize: x = !1
|
|
515
|
+
}) {
|
|
516
|
+
/**
|
|
517
|
+
* The DOM elements within the accordion.
|
|
518
|
+
*
|
|
519
|
+
* @protected
|
|
520
|
+
*
|
|
521
|
+
* @type {Object<HTMLElement, HTMLElement[]>}
|
|
522
|
+
*
|
|
523
|
+
* @property {HTMLElement} accordion - The accordion element.
|
|
524
|
+
* @property {HTMLElement[]} accordionItems - An array of accordion items.
|
|
525
|
+
* @property {HTMLElement[]} accordionItemToggles - An array of accordion item toggles.
|
|
526
|
+
* @property {HTMLElement[]} accordionItemHeaders - An array of accordion headers.
|
|
527
|
+
* @property {HTMLElement[]} accordionItemContents - An array of accordion item contents.
|
|
528
|
+
*/
|
|
529
|
+
r(this, "_dom", {
|
|
530
|
+
accordion: null,
|
|
531
|
+
accordionItems: [],
|
|
532
|
+
accordionItemToggles: [],
|
|
533
|
+
accordionItemHeaders: [],
|
|
534
|
+
accordionItemContents: []
|
|
535
|
+
});
|
|
536
|
+
/**
|
|
537
|
+
* The DOM elements within the accordion that cannot be reset or generated by the accordion.
|
|
538
|
+
*
|
|
539
|
+
* @protected
|
|
540
|
+
*
|
|
541
|
+
* @type {string[]}
|
|
542
|
+
*/
|
|
543
|
+
r(this, "_domLock", ["accordion"]);
|
|
544
|
+
/**
|
|
545
|
+
* The query selectors used by the accordion.
|
|
546
|
+
*
|
|
547
|
+
* @protected
|
|
548
|
+
*
|
|
549
|
+
* @type {Object<string>}
|
|
550
|
+
*
|
|
551
|
+
* @property {string} accordionItems - The query selector for accordion items.
|
|
552
|
+
* @property {string} accordionItemToggles - The query selector for accordion toggles.
|
|
553
|
+
* @property {string} accordionItemHeaders - The query selector for accordion headers.
|
|
554
|
+
* @property {string} accordionItemContents - The query selector for accordion contents.
|
|
555
|
+
*/
|
|
556
|
+
r(this, "_selectors", {
|
|
557
|
+
accordionItems: "",
|
|
558
|
+
accordionItemToggles: "",
|
|
559
|
+
accordionItemHeaders: "",
|
|
560
|
+
accordionItemContents: ""
|
|
561
|
+
});
|
|
562
|
+
/**
|
|
563
|
+
* The list of accordion items.
|
|
564
|
+
*
|
|
565
|
+
* @protected
|
|
566
|
+
*
|
|
567
|
+
* @type {Object<AccordionItem[]>}
|
|
568
|
+
*
|
|
569
|
+
* @property {AccordionItem[]} accordionItems - The list of accordion items.
|
|
570
|
+
*/
|
|
571
|
+
r(this, "_elements", {
|
|
572
|
+
accordionItems: []
|
|
573
|
+
});
|
|
574
|
+
/**
|
|
575
|
+
* The class(es) to apply when the accordion is open.
|
|
576
|
+
*
|
|
577
|
+
* @protected
|
|
578
|
+
*
|
|
579
|
+
* @type {string|string[]}
|
|
580
|
+
*/
|
|
581
|
+
r(this, "_openClass", "show");
|
|
582
|
+
/**
|
|
583
|
+
* The class(es) to apply when the accordion is closed.
|
|
584
|
+
*
|
|
585
|
+
* @protected
|
|
586
|
+
*
|
|
587
|
+
* @type {string|string[]}
|
|
588
|
+
*/
|
|
589
|
+
r(this, "_closeClass", "hide");
|
|
590
|
+
/**
|
|
591
|
+
* The class(es) to apply when the accordion is transitioning between states.
|
|
592
|
+
*
|
|
593
|
+
* @protected
|
|
594
|
+
*
|
|
595
|
+
* @type {string|string[]}
|
|
596
|
+
*/
|
|
597
|
+
r(this, "_transitionClass", "transitioning");
|
|
598
|
+
/**
|
|
599
|
+
* The duration time (in milliseconds) for the transition between open and closed states.
|
|
600
|
+
*
|
|
601
|
+
* @protected
|
|
602
|
+
*
|
|
603
|
+
* @type {number}
|
|
604
|
+
*/
|
|
605
|
+
r(this, "_transitionDuration", 300);
|
|
606
|
+
/**
|
|
607
|
+
* The duration time (in milliseconds) for the transition from closed to open states.
|
|
608
|
+
*
|
|
609
|
+
* @protected
|
|
610
|
+
*
|
|
611
|
+
* @type {number}
|
|
612
|
+
*/
|
|
613
|
+
r(this, "_openDuration", -1);
|
|
614
|
+
/**
|
|
615
|
+
* The duration time (in milliseconds) for the transition from open to closed states.
|
|
616
|
+
*
|
|
617
|
+
* @protected
|
|
618
|
+
*
|
|
619
|
+
* @type {number}
|
|
620
|
+
*/
|
|
621
|
+
r(this, "_closeDuration", -1);
|
|
622
|
+
/**
|
|
623
|
+
* A flag to decide if the accordion items can be navigated by arrows.
|
|
624
|
+
*
|
|
625
|
+
* @protected
|
|
626
|
+
*
|
|
627
|
+
* @type {boolean}
|
|
628
|
+
*/
|
|
629
|
+
r(this, "_optionalKeySupport", !0);
|
|
630
|
+
/**
|
|
631
|
+
* A flag to decide if multiple accordions can be open at the same time.
|
|
632
|
+
*
|
|
633
|
+
* If set to false, only one accordion can be open at a time.
|
|
634
|
+
*
|
|
635
|
+
* @protected
|
|
636
|
+
*
|
|
637
|
+
* @type {boolean}
|
|
638
|
+
*/
|
|
639
|
+
r(this, "_allowMultipleExpand", !0);
|
|
640
|
+
/**
|
|
641
|
+
* A flag to decide if no accordions can be opened at the same time.
|
|
642
|
+
*
|
|
643
|
+
* If set to false, at least one accordion must be open at all times.
|
|
644
|
+
*
|
|
645
|
+
* @protected
|
|
646
|
+
*
|
|
647
|
+
* @type {boolean}
|
|
648
|
+
*/
|
|
649
|
+
r(this, "_allowNoExpand", !0);
|
|
650
|
+
/**
|
|
651
|
+
* The index of the current child node.
|
|
652
|
+
*
|
|
653
|
+
* @protected
|
|
654
|
+
*
|
|
655
|
+
* @type {number}
|
|
656
|
+
*/
|
|
657
|
+
r(this, "_currentChild", 0);
|
|
658
|
+
/**
|
|
659
|
+
* The prefix to use for CSS custom properties.
|
|
660
|
+
*
|
|
661
|
+
* @protected
|
|
662
|
+
*
|
|
663
|
+
* @type {string}
|
|
664
|
+
*/
|
|
665
|
+
r(this, "_prefix", "graupl-");
|
|
666
|
+
/**
|
|
667
|
+
* The key used to generate IDs throughout the accordion.
|
|
668
|
+
*
|
|
669
|
+
* @protected
|
|
670
|
+
*
|
|
671
|
+
* @type {string}
|
|
672
|
+
*/
|
|
673
|
+
r(this, "_key", "");
|
|
674
|
+
/**
|
|
675
|
+
* errors - The list of errors found during validation.
|
|
676
|
+
*
|
|
677
|
+
* @protected
|
|
678
|
+
*
|
|
679
|
+
* @type {string[]}
|
|
680
|
+
*/
|
|
681
|
+
r(this, "_errors", []);
|
|
682
|
+
this._dom.accordion = t, this._selectors.accordionItems = e, this._selectors.accordionItemToggles = i, this._selectors.accordionItemHeaders = n, this._selectors.accordionItemContents = a, this._openClass = c || "", this._closeClass = _ || "", this._transitionClass = l || "", this._transitionDuration = m, this._openDuration = E, this._closeDuration = w, this._optionalKeySupport = I, this._allowMultipleExpand = b, this._allowNoExpand = k, this._prefix = A || "", this._key = T || "", x && this.initialize();
|
|
683
|
+
}
|
|
684
|
+
/**
|
|
685
|
+
* Initializes the accordion.
|
|
686
|
+
*/
|
|
687
|
+
initialize() {
|
|
688
|
+
try {
|
|
689
|
+
if (!this._validate())
|
|
690
|
+
throw new Error(
|
|
691
|
+
`Graupl Accordion: cannot initialize accordion. The following errors have been found:
|
|
692
|
+
- ${this.errors.join(
|
|
693
|
+
`
|
|
694
|
+
- `
|
|
695
|
+
)}`
|
|
696
|
+
);
|
|
697
|
+
this._generateKey(), this._setDOMElements(), this._setIds(), this._createChildElements(), this._handleFocus(), this._handleClick(), this._handleKeydown(), this._handleKeyup(), this._setTransitionDurations(), g.initializeStorage("accordions"), g.pushToStorage("accordions", this.dom.accordion.id, this);
|
|
698
|
+
} catch (t) {
|
|
699
|
+
console.error(t);
|
|
700
|
+
}
|
|
701
|
+
}
|
|
702
|
+
/**
|
|
703
|
+
* The class(es) to apply when the accordion is open.
|
|
704
|
+
*
|
|
705
|
+
* @type {string|string[]}
|
|
706
|
+
*
|
|
707
|
+
* @see _openClass
|
|
708
|
+
*/
|
|
709
|
+
get openClass() {
|
|
710
|
+
return this._openClass;
|
|
711
|
+
}
|
|
712
|
+
/**
|
|
713
|
+
* The class(es) to apply when the accordion is closed.
|
|
714
|
+
*
|
|
715
|
+
* @type {string|string[]}
|
|
716
|
+
*
|
|
717
|
+
* @see _closeClass
|
|
718
|
+
*/
|
|
719
|
+
get closeClass() {
|
|
720
|
+
return this._closeClass;
|
|
721
|
+
}
|
|
722
|
+
/**
|
|
723
|
+
* The class(es) to apply when the accordion is transitioning between open and closed.
|
|
724
|
+
*
|
|
725
|
+
* @type {string|string[]}
|
|
726
|
+
*
|
|
727
|
+
* @see _transitionClass
|
|
728
|
+
*/
|
|
729
|
+
get transitionClass() {
|
|
730
|
+
return this._transitionClass;
|
|
731
|
+
}
|
|
732
|
+
/**
|
|
733
|
+
* The duration time (in milliseconds) for the transition between open and closed states.
|
|
734
|
+
*
|
|
735
|
+
* @type {number}
|
|
736
|
+
*
|
|
737
|
+
* @see _transitionDuration
|
|
738
|
+
*/
|
|
739
|
+
get transitionDuration() {
|
|
740
|
+
return this._transitionDuration;
|
|
741
|
+
}
|
|
742
|
+
/**
|
|
743
|
+
* The duration time (in milliseconds) for the transition from closed to open states.
|
|
744
|
+
*
|
|
745
|
+
* If openDuration is set to -1, the transitionDuration will be used instead.
|
|
746
|
+
*
|
|
747
|
+
* @type {number}
|
|
748
|
+
*
|
|
749
|
+
* @see _openDuration
|
|
750
|
+
*/
|
|
751
|
+
get openDuration() {
|
|
752
|
+
return this._openDuration === -1 ? this.transitionDuration : this._openDuration;
|
|
753
|
+
}
|
|
754
|
+
/**
|
|
755
|
+
* The duration time (in milliseconds) for the transition from open to closed states.
|
|
756
|
+
*
|
|
757
|
+
* If closeDuration is set to -1, the transitionDuration will be used instead.
|
|
758
|
+
*
|
|
759
|
+
* @type {number}
|
|
760
|
+
*
|
|
761
|
+
* @see _closeDuration
|
|
762
|
+
*/
|
|
763
|
+
get closeDuration() {
|
|
764
|
+
return this._closeDuration === -1 ? this.transitionDuration : this._closeDuration;
|
|
765
|
+
}
|
|
766
|
+
/**
|
|
767
|
+
* The current index of the accordion item.
|
|
768
|
+
*
|
|
769
|
+
* @readonly
|
|
770
|
+
*
|
|
771
|
+
* @type {number}
|
|
772
|
+
*
|
|
773
|
+
* @see _currentChild
|
|
774
|
+
*/
|
|
775
|
+
get currentChild() {
|
|
776
|
+
return this._currentChild;
|
|
777
|
+
}
|
|
778
|
+
/**
|
|
779
|
+
* The dom elements of the accordion.
|
|
780
|
+
*
|
|
781
|
+
* @readonly
|
|
782
|
+
*
|
|
783
|
+
* @type {object}
|
|
784
|
+
*
|
|
785
|
+
* @see _dom
|
|
786
|
+
*/
|
|
787
|
+
get dom() {
|
|
788
|
+
return this._dom;
|
|
789
|
+
}
|
|
790
|
+
/**
|
|
791
|
+
* The elements of the accordion.
|
|
792
|
+
*
|
|
793
|
+
* @readonly
|
|
794
|
+
*
|
|
795
|
+
* @type {object}
|
|
796
|
+
*
|
|
797
|
+
* @see _elements
|
|
798
|
+
*/
|
|
799
|
+
get elements() {
|
|
800
|
+
return this._elements;
|
|
801
|
+
}
|
|
802
|
+
/**
|
|
803
|
+
* The selectors used for the accordion and accordion items.
|
|
804
|
+
*
|
|
805
|
+
* @readonly
|
|
806
|
+
*
|
|
807
|
+
* @type {boolean}
|
|
808
|
+
*
|
|
809
|
+
* @see _selectors
|
|
810
|
+
*/
|
|
811
|
+
get selectors() {
|
|
812
|
+
return this._selectors;
|
|
813
|
+
}
|
|
814
|
+
/**
|
|
815
|
+
* A flag to decide if the accordion items can be navigated by arrows.
|
|
816
|
+
*
|
|
817
|
+
* @readonly
|
|
818
|
+
*
|
|
819
|
+
* @type {boolean}
|
|
820
|
+
*
|
|
821
|
+
* @see _optionalKeySupport
|
|
822
|
+
*/
|
|
823
|
+
get optionalKeySupport() {
|
|
824
|
+
return this._optionalKeySupport;
|
|
825
|
+
}
|
|
826
|
+
/**
|
|
827
|
+
* The currently selected accordion item.
|
|
828
|
+
*
|
|
829
|
+
* @readonly
|
|
830
|
+
*
|
|
831
|
+
* @type {AccordionItem}
|
|
832
|
+
*/
|
|
833
|
+
get currentAccordionItem() {
|
|
834
|
+
return this.elements.accordionItems[this.currentChild];
|
|
835
|
+
}
|
|
836
|
+
/**
|
|
837
|
+
* The currently open accordion items.
|
|
838
|
+
*
|
|
839
|
+
* @readonly
|
|
840
|
+
*
|
|
841
|
+
* @type {AccordionItem[]}
|
|
842
|
+
*/
|
|
843
|
+
get openAccordionItems() {
|
|
844
|
+
return this.elements.accordionItems.filter((t) => t.isOpen);
|
|
845
|
+
}
|
|
846
|
+
/**
|
|
847
|
+
* A flag to decide if multiple accordions can be open at the same time.
|
|
848
|
+
*
|
|
849
|
+
* @type {boolean}
|
|
850
|
+
*
|
|
851
|
+
* @see _allowMultipleExpand
|
|
852
|
+
*/
|
|
853
|
+
get allowMultipleExpand() {
|
|
854
|
+
return this._allowMultipleExpand;
|
|
855
|
+
}
|
|
856
|
+
/**
|
|
857
|
+
* A flag to decide if no accordions can be opened at the same time.
|
|
858
|
+
*
|
|
859
|
+
* @type {boolean}
|
|
860
|
+
*
|
|
861
|
+
* @see _allowNoExpand
|
|
862
|
+
*/
|
|
863
|
+
get allowNoExpand() {
|
|
864
|
+
return this._allowNoExpand;
|
|
865
|
+
}
|
|
866
|
+
/**
|
|
867
|
+
* The prefix to use for CSS custom properties.
|
|
868
|
+
*
|
|
869
|
+
* @type {string}
|
|
870
|
+
*
|
|
871
|
+
* @see _prefix
|
|
872
|
+
*/
|
|
873
|
+
get prefix() {
|
|
874
|
+
return this._prefix;
|
|
875
|
+
}
|
|
876
|
+
/**
|
|
877
|
+
* The key used to generate IDs throughout the accordion.
|
|
878
|
+
*
|
|
879
|
+
* @type {string}
|
|
880
|
+
*
|
|
881
|
+
* @see _key
|
|
882
|
+
*/
|
|
883
|
+
get key() {
|
|
884
|
+
return this._key;
|
|
885
|
+
}
|
|
886
|
+
/**
|
|
887
|
+
* An array to hold error messages.
|
|
888
|
+
*
|
|
889
|
+
* @readonly
|
|
890
|
+
*
|
|
891
|
+
* @type {string[]}
|
|
892
|
+
*
|
|
893
|
+
* @see _errors
|
|
894
|
+
*/
|
|
895
|
+
get errors() {
|
|
896
|
+
return this._errors;
|
|
897
|
+
}
|
|
898
|
+
set openClass(t) {
|
|
899
|
+
h({ openClass: t }), this._openClass !== t && (this._openClass = t);
|
|
900
|
+
}
|
|
901
|
+
set closeClass(t) {
|
|
902
|
+
h({ closeClass: t }), this._closeClass !== t && (this._closeClass = t);
|
|
903
|
+
}
|
|
904
|
+
set transitionClass(t) {
|
|
905
|
+
h({ transitionClass: t }), this._transitionClass !== t && (this._transitionClass = t);
|
|
906
|
+
}
|
|
907
|
+
set transitionDuration(t) {
|
|
908
|
+
o("number", { value: t }), this._transitionDuration !== t && (this._transitionDuration = t, this._setTransitionDurations());
|
|
909
|
+
}
|
|
910
|
+
set openDuration(t) {
|
|
911
|
+
o("number", { value: t }), this._openDuration !== t && (this._openDuration = t, this._setTransitionDurations());
|
|
912
|
+
}
|
|
913
|
+
set closeDuration(t) {
|
|
914
|
+
o("number", { value: t }), this._closeDuration !== t && (this._closeDuration = t, this._setTransitionDurations());
|
|
915
|
+
}
|
|
916
|
+
set currentChild(t) {
|
|
917
|
+
o("number", { value: t }), this._currentChild !== t && t >= 0 && t < this.elements.accordionItems.length && (this._currentChild = t);
|
|
918
|
+
}
|
|
919
|
+
set accordionItems(t) {
|
|
920
|
+
o("object", { value: t }), t != null && t.isArray() && t.every((e) => e instanceof v) && (this._accordionItems = t);
|
|
921
|
+
}
|
|
922
|
+
set allowMultipleExpand(t) {
|
|
923
|
+
o("boolean", { value: t }), this._allowMultipleExpand !== t && (this._allowMultipleExpand = t);
|
|
924
|
+
}
|
|
925
|
+
set allowNoExpand(t) {
|
|
926
|
+
o("boolean", { value: t }), this._allowNoExpand !== t && (this._allowNoExpand = t);
|
|
927
|
+
}
|
|
928
|
+
set prefix(t) {
|
|
929
|
+
o("string", { value: t }), this._prefix !== t && (this._prefix = t);
|
|
930
|
+
}
|
|
931
|
+
set key(t) {
|
|
932
|
+
o("string", { value: t }), this._key !== t && (this._key = t);
|
|
933
|
+
}
|
|
934
|
+
/**
|
|
935
|
+
* Sets DOM elements.
|
|
936
|
+
*
|
|
937
|
+
* Elements listed in _domLock cannot be set using this method.
|
|
938
|
+
*
|
|
939
|
+
* @protected
|
|
940
|
+
*
|
|
941
|
+
* @param {string} elementType - The type of element to populate.
|
|
942
|
+
* @param {HTMLElement} [base = this.dom.accordion] - The element used as the base for the querySelect.
|
|
943
|
+
* @param {boolean} [overwrite = true] - A flag to set if the existing elements will be overwritten.
|
|
944
|
+
* @param {boolean} [strict = false] - A flag to set if the elements must be direct children of the base.
|
|
945
|
+
*/
|
|
946
|
+
_setDOMElementType(t, e = this.dom.accordion, i = !0, n = !1) {
|
|
947
|
+
if (typeof this.selectors[t] == "string") {
|
|
948
|
+
if (this._domLock.includes(t))
|
|
949
|
+
throw new Error(
|
|
950
|
+
`Graupl ${this.contructor.name}: "${t}" element cannot be set through _setDOMElementType.`
|
|
951
|
+
);
|
|
952
|
+
e !== this.dom.accordion && C(HTMLElement, { base: e });
|
|
953
|
+
const c = Array.from(
|
|
954
|
+
e.querySelectorAll(this.selectors[t])
|
|
955
|
+
).filter(
|
|
956
|
+
(_) => n ? _.parentElement === e : !0
|
|
957
|
+
);
|
|
958
|
+
i ? this._dom[t] = c : this._dom[t] = [
|
|
959
|
+
...this._dom[t],
|
|
960
|
+
...c
|
|
961
|
+
];
|
|
962
|
+
} else
|
|
963
|
+
throw new Error(
|
|
964
|
+
`Graupl ${this.contructor.name}: "${t}" is not a valid element type.`
|
|
965
|
+
);
|
|
966
|
+
}
|
|
967
|
+
/**
|
|
968
|
+
* Resets DOM elements.
|
|
969
|
+
*
|
|
970
|
+
* Elements listed in _domLock cannot be reset using this method.
|
|
971
|
+
*
|
|
972
|
+
* @protected
|
|
973
|
+
*
|
|
974
|
+
* @param {string} elementType - The type of element to clear.
|
|
975
|
+
*/
|
|
976
|
+
_resetDOMElementType(t) {
|
|
977
|
+
if (typeof this.selectors[t] == "string") {
|
|
978
|
+
if (this._domLock.includes(t))
|
|
979
|
+
throw new Error(
|
|
980
|
+
`Graupl ${this.contructor.name}: "${t}" element cannot be reset through _resetDOMElementType.`
|
|
981
|
+
);
|
|
982
|
+
Array.isArray(this._dom[t]) ? this._dom[t] = [] : this._dom[t] = null;
|
|
983
|
+
} else
|
|
984
|
+
throw new Error(
|
|
985
|
+
`Graupl ${this.contructor.name}: "${t}" is not a valid element type.`
|
|
986
|
+
);
|
|
987
|
+
}
|
|
988
|
+
/**
|
|
989
|
+
* Sets all DOM elements within the accordion.
|
|
990
|
+
*
|
|
991
|
+
* Utilizes _setDOMElementType and
|
|
992
|
+
* _resetDOMElementType.
|
|
993
|
+
*
|
|
994
|
+
* @protected
|
|
995
|
+
*/
|
|
996
|
+
_setDOMElements() {
|
|
997
|
+
this._setDOMElementType("accordionItems"), this._resetDOMElementType("accordionItemToggles"), this.dom.accordionItems.forEach((t) => {
|
|
998
|
+
this._setDOMElementType("accordionItemToggles", t, !1), this._setDOMElementType("accordionItemHeaders", t, !1), this._setDOMElementType("accordionItemContents", t, !1);
|
|
999
|
+
});
|
|
1000
|
+
}
|
|
1001
|
+
/**
|
|
1002
|
+
* Generates a key for the accordion.
|
|
1003
|
+
*
|
|
1004
|
+
* @param {boolean} [regenerate = false] - A flag to determine if the key should be regenerated.
|
|
1005
|
+
*/
|
|
1006
|
+
_generateKey(t = !1) {
|
|
1007
|
+
(this.key === "" || t) && (this.key = Math.random().toString(36).replace(/[^a-z]+/g, "").substring(0, 10));
|
|
1008
|
+
}
|
|
1009
|
+
/**
|
|
1010
|
+
* Sets the IDs of the accordion and it's children if they do not already exist.
|
|
1011
|
+
*
|
|
1012
|
+
* The generated IDs use the key and follow the format:
|
|
1013
|
+
* - accordion: `accordion-${key}`
|
|
1014
|
+
*
|
|
1015
|
+
* @protected
|
|
1016
|
+
*/
|
|
1017
|
+
_setIds() {
|
|
1018
|
+
this.dom.accordion.id = this.dom.accordion.id || `accordion-${this.key}`;
|
|
1019
|
+
}
|
|
1020
|
+
/**
|
|
1021
|
+
* Creates and initializes all accordion items.
|
|
1022
|
+
*
|
|
1023
|
+
* @protected
|
|
1024
|
+
*/
|
|
1025
|
+
_createChildElements() {
|
|
1026
|
+
this.dom.accordionItems.forEach((t, e) => {
|
|
1027
|
+
const i = new v({
|
|
1028
|
+
accordionItemElement: t,
|
|
1029
|
+
accordionItemToggleElement: this.dom.accordionItemToggles[e],
|
|
1030
|
+
accordionItemHeaderElement: this.dom.accordionItemHeaders[e],
|
|
1031
|
+
accordionItemContentElement: this.dom.accordionItemContents[e],
|
|
1032
|
+
parentAccordion: this
|
|
1033
|
+
});
|
|
1034
|
+
i.initialize(), this.elements.accordionItems.push(i);
|
|
1035
|
+
});
|
|
1036
|
+
}
|
|
1037
|
+
/**
|
|
1038
|
+
* Validates all aspects of the accordion item to ensure proper functionality.
|
|
1039
|
+
*
|
|
1040
|
+
* @protected
|
|
1041
|
+
*
|
|
1042
|
+
* @return {boolean} - The result of the validation.
|
|
1043
|
+
*/
|
|
1044
|
+
_validate() {
|
|
1045
|
+
let t = !0;
|
|
1046
|
+
const e = C(HTMLElement, {
|
|
1047
|
+
accordionElement: this.dom.accordion
|
|
1048
|
+
});
|
|
1049
|
+
e || (this._errors.push(e.message), t = !1);
|
|
1050
|
+
const i = D({
|
|
1051
|
+
accordionItemSelector: this._selectors.accordionItems,
|
|
1052
|
+
accordionItemToggleSelector: this._selectors.accordionItemToggles,
|
|
1053
|
+
accordionItemHeaderSelector: this._selectors.accordionItemHeaders,
|
|
1054
|
+
accordionItemContentSelector: this._selectors.accordionItemContents
|
|
1055
|
+
});
|
|
1056
|
+
if (i || (this._errors.push(i.message), t = !1), this._openClass !== "") {
|
|
1057
|
+
const m = h({ openClass: this._openClass });
|
|
1058
|
+
m.status || (this._errors.push(m.error.message), t = !1);
|
|
1059
|
+
}
|
|
1060
|
+
if (this._closeClass !== "") {
|
|
1061
|
+
const m = h({
|
|
1062
|
+
closeClass: this._closeClass
|
|
1063
|
+
});
|
|
1064
|
+
m.status || (this._errors.push(m.error.message), t = !1);
|
|
1065
|
+
}
|
|
1066
|
+
if (this._transitionClass !== "") {
|
|
1067
|
+
const m = h({
|
|
1068
|
+
transitionClass: this._transitionClass
|
|
1069
|
+
});
|
|
1070
|
+
m.status || (this._errors.push(m.error.message), t = !1);
|
|
1071
|
+
}
|
|
1072
|
+
const n = o("number", {
|
|
1073
|
+
transitionDuration: this._transitionDuration
|
|
1074
|
+
});
|
|
1075
|
+
n.status || (this._errors.push(n.error.message), t = !1);
|
|
1076
|
+
const a = o("number", {
|
|
1077
|
+
openDuration: this._openDuration
|
|
1078
|
+
});
|
|
1079
|
+
a.status || (this._errors.push(a.error.message), t = !1);
|
|
1080
|
+
const c = o("number", {
|
|
1081
|
+
closeDuration: this._closeDuration
|
|
1082
|
+
});
|
|
1083
|
+
c.status || (this._errors.push(c.error.message), t = !1);
|
|
1084
|
+
const _ = o("boolean", {
|
|
1085
|
+
optionalKeySupport: this._optionalKeySupport,
|
|
1086
|
+
allowMultipleExpand: this._allowMultipleExpand,
|
|
1087
|
+
allowNoExpand: this._allowNoExpand
|
|
1088
|
+
});
|
|
1089
|
+
if (_.status || (this._errors.push(_.error.message), t = !1), this._key !== "") {
|
|
1090
|
+
const m = o("string", { key: this._key });
|
|
1091
|
+
m.status || (this._errors.push(m.error.message), t = !1);
|
|
1092
|
+
}
|
|
1093
|
+
const l = o("string", { prefix: this._prefix });
|
|
1094
|
+
return l.status || (this._errors.push(l.error.message), t = !1), t;
|
|
1095
|
+
}
|
|
1096
|
+
/**
|
|
1097
|
+
* Handles focus events throughout the accordion for proper use.
|
|
1098
|
+
*
|
|
1099
|
+
* - Adds a `focus` listener to every accordion item so when it gains focus,
|
|
1100
|
+
* it will set the accordion's current child to the index of the item.
|
|
1101
|
+
*
|
|
1102
|
+
* @protected
|
|
1103
|
+
*/
|
|
1104
|
+
_handleFocus() {
|
|
1105
|
+
this.elements.accordionItems.forEach((t, e) => {
|
|
1106
|
+
t.dom.toggle.addEventListener("focus", () => {
|
|
1107
|
+
this.currentChild = e;
|
|
1108
|
+
});
|
|
1109
|
+
});
|
|
1110
|
+
}
|
|
1111
|
+
/**
|
|
1112
|
+
* Handles click events throughout the accordion item for proper use.
|
|
1113
|
+
*
|
|
1114
|
+
* - Adds a `pointerup` listener to the accordion item toggles that will toggle each accordion item.
|
|
1115
|
+
*
|
|
1116
|
+
* @protected
|
|
1117
|
+
*/
|
|
1118
|
+
_handleClick() {
|
|
1119
|
+
this.elements.accordionItems.forEach((t, e) => {
|
|
1120
|
+
t.dom.toggle.addEventListener("pointerup", () => {
|
|
1121
|
+
this.currentChild = e, t.toggle();
|
|
1122
|
+
});
|
|
1123
|
+
});
|
|
1124
|
+
}
|
|
1125
|
+
/**
|
|
1126
|
+
* Handles keydown events throughout the accordion item for proper use.
|
|
1127
|
+
*
|
|
1128
|
+
* This method exists to assist the _handleKeyup method.
|
|
1129
|
+
*
|
|
1130
|
+
* - Adds a `keydown` listener to all accordion item toggles.
|
|
1131
|
+
* - Blocks propagation on "Space" and "Enter" keys.
|
|
1132
|
+
* - _If_ optionalKeySupport is enabled, blocks propagation on the following keys:
|
|
1133
|
+
* - "ArrowDown", "ArrowUp", "Home", and "End".
|
|
1134
|
+
*/
|
|
1135
|
+
_handleKeydown() {
|
|
1136
|
+
this.dom.accordionItemToggles.forEach((t) => {
|
|
1137
|
+
t.addEventListener("keydown", (e) => {
|
|
1138
|
+
const i = f(e);
|
|
1139
|
+
(["Space", "Enter"].includes(i) || this.optionalKeySupport && ["ArrowDown", "ArrowUp", "Home", "End"].includes(i)) && p(e);
|
|
1140
|
+
});
|
|
1141
|
+
});
|
|
1142
|
+
}
|
|
1143
|
+
/**
|
|
1144
|
+
* Handles keyup events throughout the accordion item for proper use.
|
|
1145
|
+
*
|
|
1146
|
+
* Adds the follow keybindings (explanations are taken from the WAI ARIA Practices Guide Accordion Pattern):
|
|
1147
|
+
*
|
|
1148
|
+
* - `Enter` or `Space`:
|
|
1149
|
+
* - When focus is on the accordion header for a collapsed panel, expands the associated panel. If the implementation allows only one panel to be expanded, and if another panel is expanded, collapses that panel.
|
|
1150
|
+
* - When focus is on the accordion header for an expanded panel, collapses the panel if the implementation supports collapsing. Some implementations require one panel to be expanded at all times and allow only one panel to be expanded; so, they do not support a collapse function.
|
|
1151
|
+
* - `Tab`: Moves focus to the next focusable element; all focusable elements in the accordion are included in the page `Tab` sequence.
|
|
1152
|
+
* - `Shift + Tab`: Moves focus to the previous focusable element; all focusable elements in the accordion are included in the page `Tab` sequence.
|
|
1153
|
+
* - `Down Arrow` (Optional): If focus is on an accordion header, moves focus to the next accordion header. If focus is on the last accordion header, either does nothing or moves focus to the first accordion header.
|
|
1154
|
+
* - `Up Arrow` (Optional): If focus is on an accordion header, moves focus to the previous accordion header. If focus is on the first accordion header, either does nothing or moves focus to the last accordion header.
|
|
1155
|
+
* - `Home` (Optional): When focus is on an accordion header, moves focus to the first accordion header.
|
|
1156
|
+
* - `End` (Optional): When focus is on an accordion header, moves focus to the last accordion header.
|
|
1157
|
+
*
|
|
1158
|
+
* Note: When the above explanations mention "accordion header", they are referring to the accordion item toggle.
|
|
1159
|
+
*/
|
|
1160
|
+
_handleKeyup() {
|
|
1161
|
+
this.dom.accordionItemToggles.forEach((t) => {
|
|
1162
|
+
t.addEventListener("keyup", (e) => {
|
|
1163
|
+
const i = f(e);
|
|
1164
|
+
switch (i) {
|
|
1165
|
+
case "Space":
|
|
1166
|
+
case "Enter":
|
|
1167
|
+
p(e), this.currentAccordionItem.toggle();
|
|
1168
|
+
break;
|
|
1169
|
+
}
|
|
1170
|
+
if (this.optionalKeySupport)
|
|
1171
|
+
switch (i) {
|
|
1172
|
+
case "Home":
|
|
1173
|
+
p(e), this.focusFirstChild();
|
|
1174
|
+
break;
|
|
1175
|
+
case "End":
|
|
1176
|
+
p(e), this.focusLastChild();
|
|
1177
|
+
break;
|
|
1178
|
+
case "ArrowDown":
|
|
1179
|
+
p(e), this.focusNextChild();
|
|
1180
|
+
break;
|
|
1181
|
+
case "ArrowUp":
|
|
1182
|
+
p(e), this.focusPreviousChild();
|
|
1183
|
+
break;
|
|
1184
|
+
}
|
|
1185
|
+
});
|
|
1186
|
+
});
|
|
1187
|
+
}
|
|
1188
|
+
/**
|
|
1189
|
+
* Sets the transition durations of the accordion as a CSS custom properties.
|
|
1190
|
+
*
|
|
1191
|
+
* The custom properties are:
|
|
1192
|
+
* - `--graupl-accordion-transition-duration`,
|
|
1193
|
+
* - `--graupl-accordion-open-transition-duration`, and
|
|
1194
|
+
* - `--graupl-accordion-close-transition-duration`.
|
|
1195
|
+
*
|
|
1196
|
+
* The prefix of `graupl-` can be changed by setting the accordion's prefix value.
|
|
1197
|
+
*
|
|
1198
|
+
* @protected
|
|
1199
|
+
*/
|
|
1200
|
+
_setTransitionDurations() {
|
|
1201
|
+
this.dom.accordion.style.setProperty(
|
|
1202
|
+
`--${this.prefix}accordion-transition-duration`,
|
|
1203
|
+
`${this.transitionDuration}ms`
|
|
1204
|
+
), this.dom.accordion.style.setProperty(
|
|
1205
|
+
`--${this.prefix}accordion-open-transition-duration`,
|
|
1206
|
+
`${this.openDuration}ms`
|
|
1207
|
+
), this.dom.accordion.style.setProperty(
|
|
1208
|
+
`--${this.prefix}accordion-close-transition-duration`,
|
|
1209
|
+
`${this.closeDuration}ms`
|
|
1210
|
+
);
|
|
1211
|
+
}
|
|
1212
|
+
/**
|
|
1213
|
+
* Focus the accordion's current child.
|
|
1214
|
+
*
|
|
1215
|
+
* @public
|
|
1216
|
+
*/
|
|
1217
|
+
focusCurrentChild() {
|
|
1218
|
+
this.currentChild !== -1 && this.currentAccordionItem.focus();
|
|
1219
|
+
}
|
|
1220
|
+
/**
|
|
1221
|
+
* Focuses the accordion's child at a given index.
|
|
1222
|
+
*
|
|
1223
|
+
* @public
|
|
1224
|
+
*
|
|
1225
|
+
* @param {number} index - The index of the child to focus.
|
|
1226
|
+
*/
|
|
1227
|
+
focusChild(t) {
|
|
1228
|
+
this.blurCurrentChild(), this.currentChild = t, this.focusCurrentChild();
|
|
1229
|
+
}
|
|
1230
|
+
/**
|
|
1231
|
+
* Focuses the accordion's first child.
|
|
1232
|
+
*
|
|
1233
|
+
* @public
|
|
1234
|
+
*/
|
|
1235
|
+
focusFirstChild() {
|
|
1236
|
+
this.focusChild(0);
|
|
1237
|
+
}
|
|
1238
|
+
/**
|
|
1239
|
+
* Focus the accordion's last child.
|
|
1240
|
+
*
|
|
1241
|
+
* @public
|
|
1242
|
+
*/
|
|
1243
|
+
focusLastChild() {
|
|
1244
|
+
this.focusChild(this.elements.accordionItems.length - 1);
|
|
1245
|
+
}
|
|
1246
|
+
/**
|
|
1247
|
+
* Focus the accordion's next child.
|
|
1248
|
+
*
|
|
1249
|
+
* @public
|
|
1250
|
+
*/
|
|
1251
|
+
focusNextChild() {
|
|
1252
|
+
this.currentChild < this.elements.accordionItems.length - 1 ? this.focusChild(this.currentChild + 1) : this.focusCurrentChild();
|
|
1253
|
+
}
|
|
1254
|
+
/**
|
|
1255
|
+
* Focus the accordion's previous child.
|
|
1256
|
+
*
|
|
1257
|
+
* @public
|
|
1258
|
+
*/
|
|
1259
|
+
focusPreviousChild() {
|
|
1260
|
+
this.currentChild > 0 ? this.focusChild(this.currentChild - 1) : this.focusCurrentChild();
|
|
1261
|
+
}
|
|
1262
|
+
/**
|
|
1263
|
+
* Blurs the accordion's current child.
|
|
1264
|
+
*
|
|
1265
|
+
* @public
|
|
1266
|
+
*/
|
|
1267
|
+
blurCurrentChild() {
|
|
1268
|
+
this.currentChild !== -1 && this.currentAccordionItem.blur();
|
|
1269
|
+
}
|
|
1270
|
+
/**
|
|
1271
|
+
* Open all accordion items.
|
|
1272
|
+
*
|
|
1273
|
+
* @public
|
|
1274
|
+
*/
|
|
1275
|
+
openChildren() {
|
|
1276
|
+
this.elements.accordionItems.forEach((t) => t.show());
|
|
1277
|
+
}
|
|
1278
|
+
/**
|
|
1279
|
+
* Close all accordion items.
|
|
1280
|
+
*
|
|
1281
|
+
* @public
|
|
1282
|
+
*/
|
|
1283
|
+
closeChildren() {
|
|
1284
|
+
this.elements.accordionItems.forEach((t) => t.hide());
|
|
1285
|
+
}
|
|
1286
|
+
}
|
|
1287
|
+
class B {
|
|
190
1288
|
/**
|
|
191
1289
|
* Constructs a new `Alert`.
|
|
192
1290
|
*
|
|
@@ -203,14 +1301,14 @@ class R {
|
|
|
203
1301
|
*/
|
|
204
1302
|
constructor({
|
|
205
1303
|
alertElement: t,
|
|
206
|
-
controllerElement:
|
|
1304
|
+
controllerElement: e = null,
|
|
207
1305
|
showClass: i = "show",
|
|
208
1306
|
hideClass: n = "hide",
|
|
209
|
-
transitionClass:
|
|
210
|
-
transitionTimer:
|
|
211
|
-
isHidden:
|
|
212
|
-
key:
|
|
213
|
-
initialize:
|
|
1307
|
+
transitionClass: a = "transitioning",
|
|
1308
|
+
transitionTimer: c = 150,
|
|
1309
|
+
isHidden: _ = !1,
|
|
1310
|
+
key: l = null,
|
|
1311
|
+
initialize: m = !1
|
|
214
1312
|
}) {
|
|
215
1313
|
/**
|
|
216
1314
|
* The HTML elements for the alert in the DOM.
|
|
@@ -311,7 +1409,7 @@ class R {
|
|
|
311
1409
|
bubbles: !0,
|
|
312
1410
|
detail: { alert: this }
|
|
313
1411
|
}));
|
|
314
|
-
this._dom.alert = t, this._dom.controller =
|
|
1412
|
+
this._dom.alert = t, this._dom.controller = e, this._showClass = i || "", this._hideClass = n || "", this._transitionClass = a || "", this._transitionTimer = c, this._hidden = _, this._key = l || "", m && this.initialize();
|
|
315
1413
|
}
|
|
316
1414
|
/**
|
|
317
1415
|
* Initializes the alert.
|
|
@@ -326,7 +1424,7 @@ class R {
|
|
|
326
1424
|
- `
|
|
327
1425
|
)}`
|
|
328
1426
|
);
|
|
329
|
-
this._generateKey(), this._setIds(), this._handleClick(), this._handleKeydown(), this._handleKeyup(),
|
|
1427
|
+
this._generateKey(), this._setIds(), this._handleClick(), this._handleKeydown(), this._handleKeyup(), g.initializeStorage("alerts"), g.pushToStorage("alerts", this.dom.alert.id, this);
|
|
330
1428
|
} catch (t) {
|
|
331
1429
|
console.error(t);
|
|
332
1430
|
}
|
|
@@ -403,10 +1501,10 @@ class R {
|
|
|
403
1501
|
h({ transitionClass: t }), this._transitionClass !== t && (this._transitionClass = t);
|
|
404
1502
|
}
|
|
405
1503
|
set transitionTimer(t) {
|
|
406
|
-
|
|
1504
|
+
o("number", { transitionTimer: t }), this._transitionTimer !== t && (this._transitionTimer = t);
|
|
407
1505
|
}
|
|
408
1506
|
set key(t) {
|
|
409
|
-
|
|
1507
|
+
o("string", { value: t }), this._key !== t && (this._key = t);
|
|
410
1508
|
}
|
|
411
1509
|
/**
|
|
412
1510
|
* Validates all aspects of the alert to ensure proper functionality.
|
|
@@ -416,31 +1514,31 @@ class R {
|
|
|
416
1514
|
* @return {boolean} - The result of the validation.
|
|
417
1515
|
*/
|
|
418
1516
|
_validate() {
|
|
419
|
-
let t = !0,
|
|
420
|
-
if (this._dom.controller !== null ?
|
|
1517
|
+
let t = !0, e;
|
|
1518
|
+
if (this._dom.controller !== null ? e = C(HTMLElement, {
|
|
421
1519
|
alertElement: this._dom.alert,
|
|
422
1520
|
controllerElement: this._dom.controller
|
|
423
|
-
}) :
|
|
1521
|
+
}) : e = C(HTMLElement, {
|
|
424
1522
|
alertElement: this._dom.alert
|
|
425
|
-
}),
|
|
426
|
-
const
|
|
427
|
-
|
|
1523
|
+
}), e.status || (this._errors.push(e.message), t = !1), this._showClass !== "") {
|
|
1524
|
+
const a = h({ showClass: this._showClass });
|
|
1525
|
+
a.status || (this._errors.push(a.message), t = !1);
|
|
428
1526
|
}
|
|
429
1527
|
if (this._hideClass !== "") {
|
|
430
|
-
const
|
|
431
|
-
|
|
1528
|
+
const a = h({ hideClass: this._hideClass });
|
|
1529
|
+
a.status || (this._errors.push(a.message), t = !1);
|
|
432
1530
|
}
|
|
433
1531
|
if (this._transitionClass !== "") {
|
|
434
|
-
const
|
|
1532
|
+
const a = h({
|
|
435
1533
|
transitionClass: this._transitionClass
|
|
436
1534
|
});
|
|
437
|
-
|
|
1535
|
+
a.status || (this._errors.push(a.message), t = !1);
|
|
438
1536
|
}
|
|
439
|
-
const i =
|
|
1537
|
+
const i = o("number", {
|
|
440
1538
|
transitionTimer: this._transitionTimer
|
|
441
1539
|
});
|
|
442
1540
|
i.status || (this._errors.push(i.message), t = !1);
|
|
443
|
-
const n =
|
|
1541
|
+
const n = o("boolean", { isHidden: this._hidden });
|
|
444
1542
|
return n.status || (this._errors.push(n.message), t = !1), t;
|
|
445
1543
|
}
|
|
446
1544
|
/**
|
|
@@ -470,12 +1568,12 @@ class R {
|
|
|
470
1568
|
*/
|
|
471
1569
|
show(t = !0) {
|
|
472
1570
|
this._hidden && (this.transitionClass !== "" ? (u(this.transitionClass, this.dom.alert), requestAnimationFrame(() => {
|
|
473
|
-
this.hideClass !== "" &&
|
|
1571
|
+
this.hideClass !== "" && d(this.hideClass, this.dom.alert), requestAnimationFrame(() => {
|
|
474
1572
|
this.showClass !== "" && u(this.showClass, this.dom.alert), requestAnimationFrame(() => {
|
|
475
|
-
|
|
1573
|
+
d(this.transitionClass, this.dom.alert);
|
|
476
1574
|
});
|
|
477
1575
|
});
|
|
478
|
-
})) : (this.showClass !== "" && u(this.showClass, this.dom.alert), this.hideClass !== "" &&
|
|
1576
|
+
})) : (this.showClass !== "" && u(this.showClass, this.dom.alert), this.hideClass !== "" && d(this.hideClass, this.dom.alert)), this._hidden = !1, t && this.dom.alert.dispatchEvent(this._hideEvent));
|
|
479
1577
|
}
|
|
480
1578
|
/**
|
|
481
1579
|
* Hides the alert.
|
|
@@ -486,16 +1584,16 @@ class R {
|
|
|
486
1584
|
*/
|
|
487
1585
|
hide(t = !0) {
|
|
488
1586
|
this._hidden || (this.transitionClass !== "" ? (u(this.transitionClass, this.dom.alert), requestAnimationFrame(() => {
|
|
489
|
-
this.showClass !== "" &&
|
|
1587
|
+
this.showClass !== "" && d(this.showClass, this.dom.alert), requestAnimationFrame(() => {
|
|
490
1588
|
this.transitionTimer > 0 ? setTimeout(() => {
|
|
491
1589
|
this.hideClass !== "" && u(this.hideClass, this.dom.alert), requestAnimationFrame(() => {
|
|
492
|
-
|
|
1590
|
+
d(this.transitionClass, this.dom.alert);
|
|
493
1591
|
});
|
|
494
1592
|
}, this.transitionTimer) : (this.hideClass !== "" && u(this.hideClass, this.dom.alert), requestAnimationFrame(() => {
|
|
495
|
-
|
|
1593
|
+
d(this.transitionClass, this.dom.alert);
|
|
496
1594
|
}));
|
|
497
1595
|
});
|
|
498
|
-
})) : (this.hideClass !== "" && u(this.hideClass, this.dom.alert), this.showClass !== "" &&
|
|
1596
|
+
})) : (this.hideClass !== "" && u(this.hideClass, this.dom.alert), this.showClass !== "" && d(this.showClass, this.dom.alert)), this._hidden = !0, t && this.dom.alert.dispatchEvent(this._hideEvent));
|
|
499
1597
|
}
|
|
500
1598
|
/**
|
|
501
1599
|
* Handles click events throughout the alert for proper use.
|
|
@@ -517,8 +1615,8 @@ class R {
|
|
|
517
1615
|
*/
|
|
518
1616
|
_handleKeydown() {
|
|
519
1617
|
this.dom.controller !== null && this.dom.controller.addEventListener("keydown", (t) => {
|
|
520
|
-
const
|
|
521
|
-
(
|
|
1618
|
+
const e = f(t);
|
|
1619
|
+
(e === "Space" || e === "Enter") && p(t);
|
|
522
1620
|
});
|
|
523
1621
|
}
|
|
524
1622
|
/**
|
|
@@ -529,8 +1627,8 @@ class R {
|
|
|
529
1627
|
*/
|
|
530
1628
|
_handleKeyup() {
|
|
531
1629
|
this.dom.controller !== null && this.dom.controller.addEventListener("keyup", (t) => {
|
|
532
|
-
const
|
|
533
|
-
(
|
|
1630
|
+
const e = f(t);
|
|
1631
|
+
(e === "Space" || e === "Enter") && this.hide();
|
|
534
1632
|
});
|
|
535
1633
|
}
|
|
536
1634
|
}
|
|
@@ -565,28 +1663,28 @@ class U {
|
|
|
565
1663
|
*/
|
|
566
1664
|
constructor({
|
|
567
1665
|
carouselElement: t,
|
|
568
|
-
carouselItemSelector:
|
|
1666
|
+
carouselItemSelector: e = ".carousel-item",
|
|
569
1667
|
carouselItemContainerSelector: i = ".carousel-item-container",
|
|
570
1668
|
carouselControlSelector: n = ".carousel-control",
|
|
571
|
-
carouselControlContainerSelector:
|
|
572
|
-
carouselTabSelector:
|
|
573
|
-
carouselTabContainerSelector:
|
|
574
|
-
autoplaySelector:
|
|
575
|
-
nextSelector:
|
|
576
|
-
previousSelector:
|
|
577
|
-
activeClass:
|
|
578
|
-
previousClass:
|
|
579
|
-
nextClass:
|
|
1669
|
+
carouselControlContainerSelector: a = ".carousel-control-container",
|
|
1670
|
+
carouselTabSelector: c = ".carousel-tab",
|
|
1671
|
+
carouselTabContainerSelector: _ = ".carousel-tab-container",
|
|
1672
|
+
autoplaySelector: l = ".autoplay",
|
|
1673
|
+
nextSelector: m = ".next",
|
|
1674
|
+
previousSelector: E = ".previous",
|
|
1675
|
+
activeClass: w = "active",
|
|
1676
|
+
previousClass: I = "previous",
|
|
1677
|
+
nextClass: b = "next",
|
|
580
1678
|
playClass: k = "play",
|
|
581
|
-
pauseClass:
|
|
582
|
-
autoplay:
|
|
583
|
-
transitionDelay:
|
|
584
|
-
transitionDuration:
|
|
585
|
-
playText:
|
|
1679
|
+
pauseClass: A = "pause",
|
|
1680
|
+
autoplay: T = !0,
|
|
1681
|
+
transitionDelay: x = 1e4,
|
|
1682
|
+
transitionDuration: S = 500,
|
|
1683
|
+
playText: $ = "Play",
|
|
586
1684
|
pauseText: L = "Pause",
|
|
587
|
-
prefix:
|
|
588
|
-
key:
|
|
589
|
-
initialize:
|
|
1685
|
+
prefix: M = "graupl-",
|
|
1686
|
+
key: O = null,
|
|
1687
|
+
initialize: K = !1
|
|
590
1688
|
}) {
|
|
591
1689
|
/**
|
|
592
1690
|
* The DOM elements within the carousel.
|
|
@@ -774,7 +1872,7 @@ class U {
|
|
|
774
1872
|
* @type {string[]}
|
|
775
1873
|
*/
|
|
776
1874
|
r(this, "_errors", []);
|
|
777
|
-
this._dom.carousel = t, this._selectors.carouselItems =
|
|
1875
|
+
this._dom.carousel = t, this._selectors.carouselItems = e, this._selectors.carouselItemContainer = i, this._selectors.carouselControls = n, this._selectors.carouselControlContainer = a, this._selectors.carouselTabs = c, this._selectors.carouselTabContainer = _, this._selectors.autoplay = l, this._selectors.next = m, this._selectors.previous = E, this._activeClass = w || "", this._previousClass = I || "", this._nextClass = b || "", this._playClass = k || "", this._pauseClass = A || "", this._autoplay = T, this._transitionDelay = x, this._transitionDuration = S, this._playText = $ || "", this._pauseText = L || "", this._prefix = M || "", this._key = O || "", K && this.initialize();
|
|
778
1876
|
}
|
|
779
1877
|
/**
|
|
780
1878
|
* Initializes the carousel.
|
|
@@ -789,7 +1887,7 @@ class U {
|
|
|
789
1887
|
- `
|
|
790
1888
|
)}`
|
|
791
1889
|
);
|
|
792
|
-
this._generateKey(), this._setDOMElements(), this._setIds(), this._setAriaAttributes(), this.activateFirstItem(), this._handleAutoplay(), this._handleFocus(), this._handleClick(), this._handleHover(), this._handleKeydown(), this._handleKeyup(), this._setTransitionDuration(),
|
|
1890
|
+
this._generateKey(), this._setDOMElements(), this._setIds(), this._setAriaAttributes(), this.activateFirstItem(), this._handleAutoplay(), this._handleFocus(), this._handleClick(), this._handleHover(), this._handleKeydown(), this._handleKeyup(), this._setTransitionDuration(), g.initializeStorage("carousels"), g.pushToStorage("carousels", this.dom.carousel.id, this);
|
|
793
1891
|
} catch (t) {
|
|
794
1892
|
console.error(t);
|
|
795
1893
|
}
|
|
@@ -991,7 +2089,7 @@ class U {
|
|
|
991
2089
|
return this._errors;
|
|
992
2090
|
}
|
|
993
2091
|
set currentItem(t) {
|
|
994
|
-
if (
|
|
2092
|
+
if (o("number", { value: t }), t === this.currentItem)
|
|
995
2093
|
return;
|
|
996
2094
|
t < 0 ? this._currentItem = 0 : t >= this.dom.carouselItems.length ? this._currentItem = this.dom.carouselItems.length - 1 : this._currentItem = t, this._dom.carousel.querySelectorAll(
|
|
997
2095
|
this.selectors.carouselTab
|
|
@@ -1000,7 +2098,7 @@ class U {
|
|
|
1000
2098
|
});
|
|
1001
2099
|
}
|
|
1002
2100
|
set autoplay(t) {
|
|
1003
|
-
|
|
2101
|
+
o("boolean", { value: t }), this._autoplay !== t && (this._autoplay = t);
|
|
1004
2102
|
}
|
|
1005
2103
|
set activeClass(t) {
|
|
1006
2104
|
h({ activeClass: t }), this._activeClass !== t && (this._activeClass = t);
|
|
@@ -1018,22 +2116,22 @@ class U {
|
|
|
1018
2116
|
h({ pauseClass: t }), this._pauseClass !== t && (this._pauseClass = t);
|
|
1019
2117
|
}
|
|
1020
2118
|
set transitionDelay(t) {
|
|
1021
|
-
|
|
2119
|
+
o("number", { value: t }), t !== this.transitionDelay && t >= 0 && (this._currentItem = t);
|
|
1022
2120
|
}
|
|
1023
2121
|
set transitionDuration(t) {
|
|
1024
|
-
|
|
2122
|
+
o("number", { value: t }), this._transitionDuration !== t && t >= 0 && (this._transitionDuration = t, this._setTransitionDuration());
|
|
1025
2123
|
}
|
|
1026
2124
|
set playText(t) {
|
|
1027
|
-
|
|
2125
|
+
o("string", { value: t }), this._playText !== t && (this._playText = t);
|
|
1028
2126
|
}
|
|
1029
2127
|
set pauseText(t) {
|
|
1030
|
-
|
|
2128
|
+
o("string", { value: t }), this._pauseText !== t && (this._pauseText = t);
|
|
1031
2129
|
}
|
|
1032
2130
|
set prefix(t) {
|
|
1033
|
-
|
|
2131
|
+
o("string", { value: t }), this._prefix !== t && (this._prefix = t);
|
|
1034
2132
|
}
|
|
1035
2133
|
set key(t) {
|
|
1036
|
-
|
|
2134
|
+
o("string", { value: t }), this._key !== t && (this._key = t);
|
|
1037
2135
|
}
|
|
1038
2136
|
/**
|
|
1039
2137
|
* Validates all aspects of the carousel to ensure proper functionality.
|
|
@@ -1044,11 +2142,11 @@ class U {
|
|
|
1044
2142
|
*/
|
|
1045
2143
|
_validate() {
|
|
1046
2144
|
let t = !0;
|
|
1047
|
-
const
|
|
2145
|
+
const e = C(HTMLElement, {
|
|
1048
2146
|
carousel: this.dom.carousel
|
|
1049
2147
|
});
|
|
1050
|
-
|
|
1051
|
-
const i =
|
|
2148
|
+
e || (this._errors.push(e.message), t = !1);
|
|
2149
|
+
const i = D({
|
|
1052
2150
|
carouselItemsSelector: this._selectors.carouselItems,
|
|
1053
2151
|
carouselItemContainerSelector: this._selectors.carouselItemContainer,
|
|
1054
2152
|
carouselControlsSelector: this._selectors.carouselControls,
|
|
@@ -1060,59 +2158,59 @@ class U {
|
|
|
1060
2158
|
previousSelector: this._selectors.previous
|
|
1061
2159
|
});
|
|
1062
2160
|
i || (this._errors.push(i.message), t = !1);
|
|
1063
|
-
const n =
|
|
2161
|
+
const n = o("boolean", { autoplay: this.autoplay });
|
|
1064
2162
|
n || (this._errors.push(n.message), t = !1);
|
|
1065
|
-
const
|
|
2163
|
+
const a = o("number", {
|
|
1066
2164
|
transitionDelay: this._transitionDelay
|
|
1067
2165
|
});
|
|
1068
|
-
|
|
1069
|
-
const
|
|
2166
|
+
a || (this._errors.push(a.message), t = !1);
|
|
2167
|
+
const c = o("number", {
|
|
1070
2168
|
transitionDuration: this._transitionDuration
|
|
1071
2169
|
});
|
|
1072
|
-
if (
|
|
1073
|
-
const
|
|
2170
|
+
if (c || (this._errors.push(c.message), t = !1), this._activeClass !== "") {
|
|
2171
|
+
const l = h({
|
|
1074
2172
|
activeClass: this._activeClass
|
|
1075
2173
|
});
|
|
1076
|
-
|
|
2174
|
+
l || (this._errors.push(l.message), t = !1);
|
|
1077
2175
|
}
|
|
1078
2176
|
if (this._previousClass !== "") {
|
|
1079
|
-
const
|
|
2177
|
+
const l = h({
|
|
1080
2178
|
previousClass: this._previousClass
|
|
1081
2179
|
});
|
|
1082
|
-
|
|
2180
|
+
l || (this._errors.push(l.message), t = !1);
|
|
1083
2181
|
}
|
|
1084
2182
|
if (this._nextClass !== "") {
|
|
1085
|
-
const
|
|
2183
|
+
const l = h({
|
|
1086
2184
|
nextClass: this._nextClass
|
|
1087
2185
|
});
|
|
1088
|
-
|
|
2186
|
+
l || (this._errors.push(l.message), t = !1);
|
|
1089
2187
|
}
|
|
1090
2188
|
if (this._playClass !== "") {
|
|
1091
|
-
const
|
|
2189
|
+
const l = h({
|
|
1092
2190
|
playClass: this._playClass
|
|
1093
2191
|
});
|
|
1094
|
-
|
|
2192
|
+
l || (this._errors.push(l.message), t = !1);
|
|
1095
2193
|
}
|
|
1096
2194
|
if (this._pauseClass !== "") {
|
|
1097
|
-
const
|
|
2195
|
+
const l = h({
|
|
1098
2196
|
pauseClass: this._pauseClass
|
|
1099
2197
|
});
|
|
1100
|
-
|
|
2198
|
+
l || (this._errors.push(l.message), t = !1);
|
|
1101
2199
|
}
|
|
1102
2200
|
if (this._playText !== "") {
|
|
1103
|
-
const
|
|
2201
|
+
const l = o("string", {
|
|
1104
2202
|
playText: this._playText
|
|
1105
2203
|
});
|
|
1106
|
-
|
|
2204
|
+
l || (this._errors.push(l.message), t = !1);
|
|
1107
2205
|
}
|
|
1108
2206
|
if (this._pauseText !== "") {
|
|
1109
|
-
const
|
|
2207
|
+
const l = o("string", {
|
|
1110
2208
|
pauseText: this._pauseText
|
|
1111
2209
|
});
|
|
1112
|
-
|
|
2210
|
+
l || (this._errors.push(l.message), t = !1);
|
|
1113
2211
|
}
|
|
1114
|
-
const
|
|
1115
|
-
return
|
|
2212
|
+
const _ = o("string", { prefix: this._prefix });
|
|
2213
|
+
return _ || (this._errors.push(_.message), t = !1), t;
|
|
1116
2214
|
}
|
|
1117
2215
|
/**
|
|
1118
2216
|
* Sets DOM elements within the carousel.
|
|
@@ -1125,25 +2223,25 @@ class U {
|
|
|
1125
2223
|
* @param {HTMLElement} [base = this.dom.carousel] - The element used as the base for the querySelector.
|
|
1126
2224
|
* @param {boolean} [overwrite = true] - A flag to set if the existing elements will be overwritten.
|
|
1127
2225
|
*/
|
|
1128
|
-
_setDOMElementType(t,
|
|
2226
|
+
_setDOMElementType(t, e = this.dom.carousel, i = !0) {
|
|
1129
2227
|
if (typeof this.selectors[t] == "string") {
|
|
1130
2228
|
if (t === "carousel")
|
|
1131
2229
|
throw new Error(
|
|
1132
2230
|
`Graupl Carousel: "${t}" element cannot be set through _setDOMElementType.`
|
|
1133
2231
|
);
|
|
1134
|
-
if (
|
|
1135
|
-
const
|
|
1136
|
-
|
|
2232
|
+
if (e !== this.dom.carousel && C(HTMLElement, { base: e }), Array.isArray(this._dom[t])) {
|
|
2233
|
+
const a = Array.from(
|
|
2234
|
+
e.querySelectorAll(this.selectors[t])
|
|
1137
2235
|
).filter(
|
|
1138
|
-
(
|
|
2236
|
+
(c) => c.parentElement === e
|
|
1139
2237
|
);
|
|
1140
|
-
i ? this._dom[t] =
|
|
2238
|
+
i ? this._dom[t] = a : this._dom[t] = [
|
|
1141
2239
|
...this._dom[t],
|
|
1142
|
-
...
|
|
2240
|
+
...a
|
|
1143
2241
|
];
|
|
1144
2242
|
} else {
|
|
1145
|
-
const n =
|
|
1146
|
-
if (n && n.parentElement !==
|
|
2243
|
+
const n = e.querySelector(this.selectors[t]);
|
|
2244
|
+
if (n && n.parentElement !== e)
|
|
1147
2245
|
return;
|
|
1148
2246
|
i && (this._dom[t] = n);
|
|
1149
2247
|
}
|
|
@@ -1203,18 +2301,18 @@ class U {
|
|
|
1203
2301
|
* - carousel tabs: `carousel-tab-${key}-${index}`
|
|
1204
2302
|
*/
|
|
1205
2303
|
_setIds() {
|
|
1206
|
-
this.dom.carousel.id = this.dom.carousel.id || `carousel-${this.key}`, this.dom.carouselItems.forEach((t,
|
|
1207
|
-
t.id = t.id || `carousel-item-${this.key}-${
|
|
1208
|
-
}), this.dom.carouselTabs.forEach((t,
|
|
1209
|
-
t.id = t.id || `carousel-tab-${this.key}-${
|
|
2304
|
+
this.dom.carousel.id = this.dom.carousel.id || `carousel-${this.key}`, this.dom.carouselItems.forEach((t, e) => {
|
|
2305
|
+
t.id = t.id || `carousel-item-${this.key}-${e}`;
|
|
2306
|
+
}), this.dom.carouselTabs.forEach((t, e) => {
|
|
2307
|
+
t.id = t.id || `carousel-tab-${this.key}-${e}`;
|
|
1210
2308
|
});
|
|
1211
2309
|
}
|
|
1212
2310
|
/**
|
|
1213
2311
|
* Sets the aria attributes for the carousel.
|
|
1214
2312
|
*/
|
|
1215
2313
|
_setAriaAttributes() {
|
|
1216
|
-
!
|
|
1217
|
-
|
|
2314
|
+
!y("section", { carousel: this.dom.carousel }) && !this.dom.carousel.getAttribute("role") !== "region" && this.dom.carousel.setAttribute("role", "group"), this._dom.carousel.setAttribute("aria-roledescription", "carousel"), this.dom.carouselTabContainer && this.dom.carouselTabContainer.setAttribute("role", "tablist"), this.dom.carouselTabs.forEach((t, e) => {
|
|
2315
|
+
y("button", { tab: t }) || t.setAttribute("role", "button"), t.setAttribute("aria-selected", e === 0), t.setAttribute("aria-controls", this.dom.carouselItems[e].id);
|
|
1218
2316
|
});
|
|
1219
2317
|
}
|
|
1220
2318
|
/**
|
|
@@ -1247,7 +2345,7 @@ class U {
|
|
|
1247
2345
|
* @protected
|
|
1248
2346
|
*/
|
|
1249
2347
|
_handleAutoplay() {
|
|
1250
|
-
this.autoplay ? (u(this.pauseClass, this.dom.autoplay),
|
|
2348
|
+
this.autoplay ? (u(this.pauseClass, this.dom.autoplay), d(this.playClass, this.dom.autoplay), this.dom.autoplay.setAttribute("aria-label", this.pauseText), this.dom.carousel.setAttribute("aria-live", "off"), this._setInterval()) : (u(this.playClass, this.dom.autoplay), d(this.pauseClass, this.dom.autoplay), this.dom.autoplay.setAttribute("aria-label", this.playText), this.dom.carousel.setAttribute("aria-live", "polite"), this._clearInterval());
|
|
1251
2349
|
}
|
|
1252
2350
|
/**
|
|
1253
2351
|
* Handles the focus events throughout the carousel for proper use.
|
|
@@ -1277,9 +2375,9 @@ class U {
|
|
|
1277
2375
|
this.activatePreviousItem();
|
|
1278
2376
|
}), this.dom.autoplay.addEventListener("pointerup", () => {
|
|
1279
2377
|
this.toggleAutoplay();
|
|
1280
|
-
}), this.dom.carouselTabs.forEach((t,
|
|
2378
|
+
}), this.dom.carouselTabs.forEach((t, e) => {
|
|
1281
2379
|
t.addEventListener("pointerup", () => {
|
|
1282
|
-
this.currentItem >
|
|
2380
|
+
this.currentItem > e ? this._currentAction = "previous" : this._currentAction = "next", this.activateItem(e);
|
|
1283
2381
|
});
|
|
1284
2382
|
});
|
|
1285
2383
|
}
|
|
@@ -1306,20 +2404,20 @@ class U {
|
|
|
1306
2404
|
*/
|
|
1307
2405
|
_handleKeydown() {
|
|
1308
2406
|
this.dom.carouselControls.forEach((t) => {
|
|
1309
|
-
t.addEventListener("keydown", (
|
|
1310
|
-
switch (
|
|
2407
|
+
t.addEventListener("keydown", (e) => {
|
|
2408
|
+
switch (f(e)) {
|
|
1311
2409
|
case "Space":
|
|
1312
2410
|
case "Enter":
|
|
1313
|
-
|
|
2411
|
+
p(e);
|
|
1314
2412
|
break;
|
|
1315
2413
|
}
|
|
1316
2414
|
});
|
|
1317
2415
|
}), this.dom.carouselTabs.forEach((t) => {
|
|
1318
|
-
t.addEventListener("keydown", (
|
|
1319
|
-
switch (
|
|
2416
|
+
t.addEventListener("keydown", (e) => {
|
|
2417
|
+
switch (f(e)) {
|
|
1320
2418
|
case "Space":
|
|
1321
2419
|
case "Enter":
|
|
1322
|
-
|
|
2420
|
+
p(e);
|
|
1323
2421
|
break;
|
|
1324
2422
|
}
|
|
1325
2423
|
});
|
|
@@ -1335,32 +2433,32 @@ class U {
|
|
|
1335
2433
|
*/
|
|
1336
2434
|
_handleKeyup() {
|
|
1337
2435
|
this.dom.next.addEventListener("keyup", (t) => {
|
|
1338
|
-
switch (
|
|
2436
|
+
switch (f(t)) {
|
|
1339
2437
|
case "Space":
|
|
1340
2438
|
case "Enter":
|
|
1341
|
-
this.activateNextItem(),
|
|
2439
|
+
this.activateNextItem(), p(t);
|
|
1342
2440
|
break;
|
|
1343
2441
|
}
|
|
1344
2442
|
}), this.dom.previous.addEventListener("keyup", (t) => {
|
|
1345
|
-
switch (
|
|
2443
|
+
switch (f(t)) {
|
|
1346
2444
|
case "Space":
|
|
1347
2445
|
case "Enter":
|
|
1348
|
-
this.activatePreviousItem(),
|
|
2446
|
+
this.activatePreviousItem(), p(t);
|
|
1349
2447
|
break;
|
|
1350
2448
|
}
|
|
1351
2449
|
}), this.dom.autoplay.addEventListener("keyup", (t) => {
|
|
1352
|
-
switch (
|
|
2450
|
+
switch (f(t)) {
|
|
1353
2451
|
case "Space":
|
|
1354
2452
|
case "Enter":
|
|
1355
|
-
this.toggleAutoplay(),
|
|
2453
|
+
this.toggleAutoplay(), p(t);
|
|
1356
2454
|
break;
|
|
1357
2455
|
}
|
|
1358
|
-
}), this.dom.carouselTabs.forEach((t,
|
|
2456
|
+
}), this.dom.carouselTabs.forEach((t, e) => {
|
|
1359
2457
|
t.addEventListener("keyup", (i) => {
|
|
1360
|
-
switch (
|
|
2458
|
+
switch (f(i)) {
|
|
1361
2459
|
case "Space":
|
|
1362
2460
|
case "Enter":
|
|
1363
|
-
this.activateItem(
|
|
2461
|
+
this.activateItem(e), p(i);
|
|
1364
2462
|
break;
|
|
1365
2463
|
}
|
|
1366
2464
|
});
|
|
@@ -1393,7 +2491,7 @@ class U {
|
|
|
1393
2491
|
* @public
|
|
1394
2492
|
*/
|
|
1395
2493
|
deactivateCurrentItem() {
|
|
1396
|
-
|
|
2494
|
+
d(this.activeClass, this.currentCarouselItem), this.currentCarouselTab && (this.currentCarouselTab.setAttribute("aria-selected", !1), d(this.activeClass, this.currentCarouselTab));
|
|
1397
2495
|
}
|
|
1398
2496
|
/**
|
|
1399
2497
|
* Activates the carousel item at a given index.
|
|
@@ -1403,11 +2501,11 @@ class U {
|
|
|
1403
2501
|
* @param {number} index - The index of the carousel item to activate.
|
|
1404
2502
|
*/
|
|
1405
2503
|
activateItem(t) {
|
|
1406
|
-
const
|
|
2504
|
+
const e = this.currentItem;
|
|
1407
2505
|
this.dom.carousel.dataset.grauplAction = this._currentAction, this.autoplay && this._clearInterval(), u(this.previousClass, this.currentCarouselItem), u(this.nextClass, this.dom.carouselItems[t]), requestAnimationFrame(() => {
|
|
1408
2506
|
this.deactivateCurrentItem(), this.currentItem = t, this.activateCurrentItem(), requestAnimationFrame(() => {
|
|
1409
2507
|
setTimeout(() => {
|
|
1410
|
-
|
|
2508
|
+
d(this.previousClass, this.dom.carouselItems[e]), d(this.nextClass, this.currentCarouselItem);
|
|
1411
2509
|
}, this.transitionDuration);
|
|
1412
2510
|
});
|
|
1413
2511
|
}), this.autoplay && this._setInterval();
|
|
@@ -1453,10 +2551,11 @@ class U {
|
|
|
1453
2551
|
this.autoplay = !this.autoplay, this._handleAutoplay();
|
|
1454
2552
|
}
|
|
1455
2553
|
}
|
|
1456
|
-
const
|
|
1457
|
-
|
|
2554
|
+
const J = {
|
|
2555
|
+
Accordion: R,
|
|
2556
|
+
Alert: B,
|
|
1458
2557
|
Carousel: U
|
|
1459
2558
|
};
|
|
1460
2559
|
export {
|
|
1461
|
-
|
|
2560
|
+
J as default
|
|
1462
2561
|
};
|