@dta-au/civictheme-twig 1.13.1
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/assets/backgrounds/civictheme_background_1.png +0 -0
- package/assets/backgrounds/civictheme_background_2.png +0 -0
- package/assets/backgrounds/civictheme_background_3.png +0 -0
- package/assets/backgrounds/civictheme_background_4.png +0 -0
- package/assets/backgrounds/civictheme_background_5.png +0 -0
- package/assets/backgrounds/civictheme_background_6.png +0 -0
- package/assets/backgrounds/civictheme_background_7.png +0 -0
- package/assets/fonts/.gitkeep +0 -0
- package/assets/icons/account.svg +3 -0
- package/assets/icons/approve.svg +3 -0
- package/assets/icons/bars.svg +3 -0
- package/assets/icons/bullet.svg +3 -0
- package/assets/icons/calendar-1.svg +3 -0
- package/assets/icons/calendar-2.svg +3 -0
- package/assets/icons/call.svg +3 -0
- package/assets/icons/cancel.svg +3 -0
- package/assets/icons/checked.svg +4 -0
- package/assets/icons/close-outline.svg +3 -0
- package/assets/icons/close.svg +3 -0
- package/assets/icons/document.svg +4 -0
- package/assets/icons/down-arrow-1.svg +3 -0
- package/assets/icons/down-arrow-2.svg +3 -0
- package/assets/icons/download-file.svg +3 -0
- package/assets/icons/download.svg +3 -0
- package/assets/icons/exclamation-mark-1.svg +3 -0
- package/assets/icons/exclamation-mark-2.svg +3 -0
- package/assets/icons/exclamation-mark-3.svg +3 -0
- package/assets/icons/eye.svg +3 -0
- package/assets/icons/facebook.svg +3 -0
- package/assets/icons/help.svg +3 -0
- package/assets/icons/image.svg +5 -0
- package/assets/icons/information-mark.svg +3 -0
- package/assets/icons/instagram.svg +3 -0
- package/assets/icons/layer.svg +4 -0
- package/assets/icons/layers.svg +4 -0
- package/assets/icons/left-arrow-outline.svg +3 -0
- package/assets/icons/left-arrow.svg +3 -0
- package/assets/icons/linkedin.svg +3 -0
- package/assets/icons/lock-file.svg +4 -0
- package/assets/icons/lock-gallery.svg +4 -0
- package/assets/icons/magnifier.svg +3 -0
- package/assets/icons/map.svg +3 -0
- package/assets/icons/megaphone.svg +3 -0
- package/assets/icons/message.svg +3 -0
- package/assets/icons/mobile.svg +4 -0
- package/assets/icons/mortarboard.svg +3 -0
- package/assets/icons/newspaper.svg +3 -0
- package/assets/icons/open-source.svg +3 -0
- package/assets/icons/pdf-file.svg +4 -0
- package/assets/icons/progress.svg +3 -0
- package/assets/icons/right-arrow-1.svg +3 -0
- package/assets/icons/right-arrow-2.svg +3 -0
- package/assets/icons/select-box.svg +4 -0
- package/assets/icons/share.svg +3 -0
- package/assets/icons/square.svg +3 -0
- package/assets/icons/to-do.svg +3 -0
- package/assets/icons/twitter.svg +3 -0
- package/assets/icons/up-arrow.svg +3 -0
- package/assets/icons/upper-arrow.svg +3 -0
- package/assets/icons/upper-right-arrow.svg +3 -0
- package/assets/icons/users.svg +4 -0
- package/assets/icons/watch.svg +3 -0
- package/assets/icons/water-drop.svg +4 -0
- package/assets/icons/web.svg +4 -0
- package/assets/icons/word-file.svg +4 -0
- package/assets/icons/x.svg +3 -0
- package/assets/icons/youtube.svg +3 -0
- package/assets/logos/logo_custom_light_desktop_civictheme.svg +32 -0
- package/assets/logos/logo_custom_light_mobile_civictheme.svg +32 -0
- package/assets/logos/logo_primary_dark_desktop.png +0 -0
- package/assets/logos/logo_primary_dark_mobile.png +0 -0
- package/assets/logos/logo_primary_light_desktop.png +0 -0
- package/assets/logos/logo_primary_light_mobile.png +0 -0
- package/assets/logos/logo_secondary_dark_desktop.png +0 -0
- package/assets/logos/logo_secondary_dark_mobile.png +0 -0
- package/assets/logos/logo_secondary_light_desktop.png +0 -0
- package/assets/logos/logo_secondary_light_mobile.png +0 -0
- package/components/00-base/_variables.base.scss +482 -0
- package/components/00-base/_variables.components.scss +1315 -0
- package/components/00-base/about-civictheme/about-civictheme.stories.js +37 -0
- package/components/00-base/about-civictheme/about-civictheme.stories.scss +37 -0
- package/components/00-base/about-civictheme/about-civictheme.stories.twig +219 -0
- package/components/00-base/background/background.scss +12 -0
- package/components/00-base/background/background.stories.js +33 -0
- package/components/00-base/background/background.stories.scss +16 -0
- package/components/00-base/background/background.stories.twig +6 -0
- package/components/00-base/background/background.utils.js +23 -0
- package/components/00-base/collapsible/collapsible.js +452 -0
- package/components/00-base/collapsible/collapsible.scss +80 -0
- package/components/00-base/collapsible/collapsible.stories.js +17 -0
- package/components/00-base/collapsible/collapsible.stories.scss +38 -0
- package/components/00-base/collapsible/collapsible.stories.twig +497 -0
- package/components/00-base/collapsible/collapsible.test.js +186 -0
- package/components/00-base/colors/colors.stories.js +142 -0
- package/components/00-base/colors/colors.stories.scss +78 -0
- package/components/00-base/colors/colors.stories.twig +42 -0
- package/components/00-base/datetime/__snapshots__/datetime.test.js.snap +114 -0
- package/components/00-base/datetime/datetime.stories.js +47 -0
- package/components/00-base/datetime/datetime.test.js +75 -0
- package/components/00-base/datetime/datetime.twig +24 -0
- package/components/00-base/debug/_index.scss +24 -0
- package/components/00-base/elevation/elevation.stories.js +14 -0
- package/components/00-base/elevation/elevation.stories.scss +21 -0
- package/components/00-base/elevation/elevation.stories.twig +8 -0
- package/components/00-base/flex/_index.scss +37 -0
- package/components/00-base/flyout/flyout.js +207 -0
- package/components/00-base/flyout/flyout.scss +47 -0
- package/components/00-base/flyout/flyout.stories.js +34 -0
- package/components/00-base/flyout/flyout.stories.scss +38 -0
- package/components/00-base/flyout/flyout.stories.twig +101 -0
- package/components/00-base/fonts/_index.scss +15 -0
- package/components/00-base/fonts/fonts.stories.js +40 -0
- package/components/00-base/fonts/fonts.stories.scss +28 -0
- package/components/00-base/fonts/fonts.stories.twig +15 -0
- package/components/00-base/grid/__snapshots__/grid.test.js.snap +2113 -0
- package/components/00-base/grid/grid.scss +164 -0
- package/components/00-base/grid/grid.stories.js +570 -0
- package/components/00-base/grid/grid.stories.scss +184 -0
- package/components/00-base/grid/grid.test.js +386 -0
- package/components/00-base/grid/grid.twig +96 -0
- package/components/00-base/icon/__snapshots__/icon.test.js.snap +76 -0
- package/components/00-base/icon/icon.scss +21 -0
- package/components/00-base/icon/icon.stories.js +46 -0
- package/components/00-base/icon/icon.test.js +53 -0
- package/components/00-base/icon/icon.twig +35 -0
- package/components/00-base/icon/icon.utils.js +35 -0
- package/components/00-base/item-list/__snapshots__/item-list.test.js.snap +255 -0
- package/components/00-base/item-list/item-list.scss +66 -0
- package/components/00-base/item-list/item-list.stories.js +49 -0
- package/components/00-base/item-list/item-list.test.js +96 -0
- package/components/00-base/item-list/item-list.twig +35 -0
- package/components/00-base/layout/__snapshots__/layout.test.js.snap +520 -0
- package/components/00-base/layout/layout.js +97 -0
- package/components/00-base/layout/layout.scss +329 -0
- package/components/00-base/layout/layout.stories.data.js +22 -0
- package/components/00-base/layout/layout.stories.js +120 -0
- package/components/00-base/layout/layout.stories.scss +55 -0
- package/components/00-base/layout/layout.test.js +166 -0
- package/components/00-base/layout/layout.twig +115 -0
- package/components/00-base/menu/__snapshots__/menu.test.js.snap +1028 -0
- package/components/00-base/menu/menu.stories.js +107 -0
- package/components/00-base/menu/menu.stories.scss +11 -0
- package/components/00-base/menu/menu.test.js +231 -0
- package/components/00-base/menu/menu.twig +133 -0
- package/components/00-base/mixins/_background.scss +11 -0
- package/components/00-base/mixins/_breakpoint.scss +75 -0
- package/components/00-base/mixins/_button.scss +312 -0
- package/components/00-base/mixins/_color.scss +137 -0
- package/components/00-base/mixins/_component.scss +39 -0
- package/components/00-base/mixins/_content-link.scss +58 -0
- package/components/00-base/mixins/_content.scss +369 -0
- package/components/00-base/mixins/_cssgrid.scss +106 -0
- package/components/00-base/mixins/_debug.scss +29 -0
- package/components/00-base/mixins/_deprecations.scss +21 -0
- package/components/00-base/mixins/_disabled.scss +11 -0
- package/components/00-base/mixins/_elevation.scss +37 -0
- package/components/00-base/mixins/_font.scss +140 -0
- package/components/00-base/mixins/_form.scss +30 -0
- package/components/00-base/mixins/_generator.scss +35 -0
- package/components/00-base/mixins/_grid.scss +223 -0
- package/components/00-base/mixins/_highlight.scss +84 -0
- package/components/00-base/mixins/_icon.scss +118 -0
- package/components/00-base/mixins/_image.scss +149 -0
- package/components/00-base/mixins/_index.scss +25 -0
- package/components/00-base/mixins/_link.scss +163 -0
- package/components/00-base/mixins/_map.scss +90 -0
- package/components/00-base/mixins/_message.scss +11 -0
- package/components/00-base/mixins/_outline.scss +32 -0
- package/components/00-base/mixins/_particle.scss +40 -0
- package/components/00-base/mixins/_print.scss +26 -0
- package/components/00-base/mixins/_rem.scss +20 -0
- package/components/00-base/mixins/_reset.scss +85 -0
- package/components/00-base/mixins/_spacing.scss +57 -0
- package/components/00-base/mixins/_string.scss +76 -0
- package/components/00-base/mixins/_table.scss +254 -0
- package/components/00-base/mixins/_typography.scss +193 -0
- package/components/00-base/mixins/_visibility.scss +27 -0
- package/components/00-base/platform/platform.js +27 -0
- package/components/00-base/responsive/responsive.js +186 -0
- package/components/00-base/responsive/responsive.stories.js +17 -0
- package/components/00-base/responsive/responsive.stories.twig +121 -0
- package/components/00-base/scrollspy/scrollspy.js +36 -0
- package/components/00-base/scrollspy/scrollspy.scss +11 -0
- package/components/00-base/scrollspy/scrollspy.stories.js +18 -0
- package/components/00-base/scrollspy/scrollspy.stories.scss +51 -0
- package/components/00-base/scrollspy/scrollspy.stories.twig +9 -0
- package/components/00-base/skip-to-target/skip-to-target.js +27 -0
- package/components/00-base/spacing/spacing.scss +29 -0
- package/components/00-base/spacing/spacing.stories.js +16 -0
- package/components/00-base/spacing/spacing.stories.scss +51 -0
- package/components/00-base/spacing/spacing.stories.twig +64 -0
- package/components/00-base/storybook/storybook.container.utils.stories.scss +105 -0
- package/components/00-base/storybook/storybook.docs.utils.js +37 -0
- package/components/00-base/storybook/storybook.docs.utils.stories.scss +70 -0
- package/components/00-base/storybook/storybook.generators.utils.js +19 -0
- package/components/00-base/storybook/storybook.layout.utils.stories.scss +90 -0
- package/components/00-base/storybook/storybook.placeholder.utils.stories.scss +75 -0
- package/components/00-base/storybook/storybook.stories.scss +8 -0
- package/components/00-base/text-icon/text-icon.scss +9 -0
- package/components/00-base/text-icon/text-icon.stories.js +57 -0
- package/components/00-base/text-icon/text-icon.twig +81 -0
- package/components/00-base/typography/typography.scss +81 -0
- package/components/00-base/typography/typography.stories.js +17 -0
- package/components/00-base/typography/typography.stories.twig +228 -0
- package/components/00-base/variables.scss +41 -0
- package/components/00-base/visibility/_index.scss +42 -0
- package/components/00-base/welcome/welcome.stories.js +37 -0
- package/components/00-base/welcome/welcome.stories.scss +30 -0
- package/components/00-base/welcome/welcome.stories.twig +41 -0
- package/components/01-atoms/button/__snapshots__/button.test.js.snap +205 -0
- package/components/01-atoms/button/button.js +127 -0
- package/components/01-atoms/button/button.scss +82 -0
- package/components/01-atoms/button/button.stories.js +86 -0
- package/components/01-atoms/button/button.test.js +103 -0
- package/components/01-atoms/button/button.twig +82 -0
- package/components/01-atoms/checkbox/__snapshots__/checkbox.test.js.snap +65 -0
- package/components/01-atoms/checkbox/checkbox.scss +176 -0
- package/components/01-atoms/checkbox/checkbox.stories.js +63 -0
- package/components/01-atoms/checkbox/checkbox.test.js +67 -0
- package/components/01-atoms/checkbox/checkbox.twig +47 -0
- package/components/01-atoms/chip/__snapshots__/chip.test.js.snap +90 -0
- package/components/01-atoms/chip/chip.event.stories.js +25 -0
- package/components/01-atoms/chip/chip.js +104 -0
- package/components/01-atoms/chip/chip.scss +144 -0
- package/components/01-atoms/chip/chip.stories.js +74 -0
- package/components/01-atoms/chip/chip.test.js +53 -0
- package/components/01-atoms/chip/chip.twig +73 -0
- package/components/01-atoms/content-link/__snapshots__/content-link.test.js.snap +91 -0
- package/components/01-atoms/content-link/content-link.scss +16 -0
- package/components/01-atoms/content-link/content-link.stories.js +50 -0
- package/components/01-atoms/content-link/content-link.test.js +50 -0
- package/components/01-atoms/content-link/content-link.twig +40 -0
- package/components/01-atoms/field-description/__snapshots__/field-description.test.js.snap +49 -0
- package/components/01-atoms/field-description/field-description.scss +24 -0
- package/components/01-atoms/field-description/field-description.stories.js +41 -0
- package/components/01-atoms/field-description/field-description.test.js +51 -0
- package/components/01-atoms/field-description/field-description.twig +24 -0
- package/components/01-atoms/field-message/__snapshots__/field-message.test.js.snap +142 -0
- package/components/01-atoms/field-message/field-message.scss +108 -0
- package/components/01-atoms/field-message/field-message.stories.js +41 -0
- package/components/01-atoms/field-message/field-message.test.js +64 -0
- package/components/01-atoms/field-message/field-message.twig +37 -0
- package/components/01-atoms/fieldset/__snapshots__/fieldset.test.js.snap +358 -0
- package/components/01-atoms/fieldset/fieldset.scss +44 -0
- package/components/01-atoms/fieldset/fieldset.stories.js +79 -0
- package/components/01-atoms/fieldset/fieldset.test.js +102 -0
- package/components/01-atoms/fieldset/fieldset.twig +91 -0
- package/components/01-atoms/heading/__snapshots__/heading.test.js.snap +43 -0
- package/components/01-atoms/heading/heading.scss +13 -0
- package/components/01-atoms/heading/heading.stories.js +41 -0
- package/components/01-atoms/heading/heading.test.js +42 -0
- package/components/01-atoms/heading/heading.twig +24 -0
- package/components/01-atoms/iframe/__snapshots__/iframe.test.js.snap +34 -0
- package/components/01-atoms/iframe/iframe.scss +29 -0
- package/components/01-atoms/iframe/iframe.stories.js +53 -0
- package/components/01-atoms/iframe/iframe.test.js +37 -0
- package/components/01-atoms/iframe/iframe.twig +29 -0
- package/components/01-atoms/image/__snapshots__/image.test.js.snap +45 -0
- package/components/01-atoms/image/image.stories.js +48 -0
- package/components/01-atoms/image/image.test.js +45 -0
- package/components/01-atoms/image/image.twig +31 -0
- package/components/01-atoms/input/__snapshots__/input.test.js.snap +64 -0
- package/components/01-atoms/input/input.scss +112 -0
- package/components/01-atoms/input/input.stories.js +81 -0
- package/components/01-atoms/input/input.test.js +71 -0
- package/components/01-atoms/input/input.twig +38 -0
- package/components/01-atoms/label/__snapshots__/label.test.js.snap +69 -0
- package/components/01-atoms/label/label.scss +34 -0
- package/components/01-atoms/label/label.stories.js +65 -0
- package/components/01-atoms/label/label.test.js +76 -0
- package/components/01-atoms/label/label.twig +35 -0
- package/components/01-atoms/link/__snapshots__/link.test.js.snap +138 -0
- package/components/01-atoms/link/link.scss +53 -0
- package/components/01-atoms/link/link.stories.js +82 -0
- package/components/01-atoms/link/link.test.js +84 -0
- package/components/01-atoms/link/link.twig +62 -0
- package/components/01-atoms/paragraph/__snapshots__/paragraph.test.js.snap +36 -0
- package/components/01-atoms/paragraph/paragraph.scss +31 -0
- package/components/01-atoms/paragraph/paragraph.stories.js +45 -0
- package/components/01-atoms/paragraph/paragraph.test.js +40 -0
- package/components/01-atoms/paragraph/paragraph.twig +25 -0
- package/components/01-atoms/popover/__snapshots__/popover.test.js.snap +129 -0
- package/components/01-atoms/popover/popover.scss +44 -0
- package/components/01-atoms/popover/popover.stories.js +52 -0
- package/components/01-atoms/popover/popover.test.js +57 -0
- package/components/01-atoms/popover/popover.twig +69 -0
- package/components/01-atoms/radio/__snapshots__/radio.test.js.snap +83 -0
- package/components/01-atoms/radio/radio.scss +176 -0
- package/components/01-atoms/radio/radio.stories.js +64 -0
- package/components/01-atoms/radio/radio.test.js +76 -0
- package/components/01-atoms/radio/radio.twig +47 -0
- package/components/01-atoms/select/__snapshots__/select.test.js.snap +165 -0
- package/components/01-atoms/select/select.scss +105 -0
- package/components/01-atoms/select/select.stories.js +81 -0
- package/components/01-atoms/select/select.test.js +117 -0
- package/components/01-atoms/select/select.twig +63 -0
- package/components/01-atoms/table/__snapshots__/table.test.js.snap +206 -0
- package/components/01-atoms/table/table.js +79 -0
- package/components/01-atoms/table/table.scss +18 -0
- package/components/01-atoms/table/table.stories.js +129 -0
- package/components/01-atoms/table/table.test.js +60 -0
- package/components/01-atoms/table/table.twig +104 -0
- package/components/01-atoms/tag/__snapshots__/tag.test.js.snap +97 -0
- package/components/01-atoms/tag/tag.scss +63 -0
- package/components/01-atoms/tag/tag.stories.js +55 -0
- package/components/01-atoms/tag/tag.test.js +49 -0
- package/components/01-atoms/tag/tag.twig +74 -0
- package/components/01-atoms/textarea/__snapshots__/textarea.test.js.snap +64 -0
- package/components/01-atoms/textarea/textarea.scss +72 -0
- package/components/01-atoms/textarea/textarea.stories.js +64 -0
- package/components/01-atoms/textarea/textarea.test.js +68 -0
- package/components/01-atoms/textarea/textarea.twig +37 -0
- package/components/01-atoms/textfield/__snapshots__/textfield.test.js.snap +63 -0
- package/components/01-atoms/textfield/textfield.scss +70 -0
- package/components/01-atoms/textfield/textfield.stories.js +60 -0
- package/components/01-atoms/textfield/textfield.test.js +64 -0
- package/components/01-atoms/textfield/textfield.twig +37 -0
- package/components/01-atoms/video/__snapshots__/video.test.js.snap +75 -0
- package/components/01-atoms/video/video.stories.js +69 -0
- package/components/01-atoms/video/video.test.js +57 -0
- package/components/01-atoms/video/video.twig +59 -0
- package/components/02-molecules/accordion/__snapshots__/accordion.test.js.snap +651 -0
- package/components/02-molecules/accordion/accordion.scss +109 -0
- package/components/02-molecules/accordion/accordion.stories.js +73 -0
- package/components/02-molecules/accordion/accordion.test.js +84 -0
- package/components/02-molecules/accordion/accordion.twig +86 -0
- package/components/02-molecules/attachment/__snapshots__/attachment.test.js.snap +694 -0
- package/components/02-molecules/attachment/attachment.scss +54 -0
- package/components/02-molecules/attachment/attachment.stories.js +125 -0
- package/components/02-molecules/attachment/attachment.test.js +84 -0
- package/components/02-molecules/attachment/attachment.twig +139 -0
- package/components/02-molecules/back-to-top/__snapshots__/back-to-top.test.js.snap +172 -0
- package/components/02-molecules/back-to-top/back-to-top.scss +39 -0
- package/components/02-molecules/back-to-top/back-to-top.stories.js +26 -0
- package/components/02-molecules/back-to-top/back-to-top.stories.scss +20 -0
- package/components/02-molecules/back-to-top/back-to-top.stories.twig +6 -0
- package/components/02-molecules/back-to-top/back-to-top.test.js +31 -0
- package/components/02-molecules/back-to-top/back-to-top.twig +32 -0
- package/components/02-molecules/basic-content/__snapshots__/basic-content.test.js.snap +110 -0
- package/components/02-molecules/basic-content/basic-content.scss +39 -0
- package/components/02-molecules/basic-content/basic-content.stories.data.js +157 -0
- package/components/02-molecules/basic-content/basic-content.stories.js +56 -0
- package/components/02-molecules/basic-content/basic-content.test.js +59 -0
- package/components/02-molecules/basic-content/basic-content.twig +42 -0
- package/components/02-molecules/breadcrumb/__snapshots__/breadcrumb.test.js.snap +553 -0
- package/components/02-molecules/breadcrumb/breadcrumb.scss +23 -0
- package/components/02-molecules/breadcrumb/breadcrumb.stories.js +53 -0
- package/components/02-molecules/breadcrumb/breadcrumb.test.js +82 -0
- package/components/02-molecules/breadcrumb/breadcrumb.twig +85 -0
- package/components/02-molecules/callout/__snapshots__/callout.test.js.snap +384 -0
- package/components/02-molecules/callout/callout.scss +35 -0
- package/components/02-molecules/callout/callout.stories.js +70 -0
- package/components/02-molecules/callout/callout.test.js +73 -0
- package/components/02-molecules/callout/callout.twig +108 -0
- package/components/02-molecules/event-card/__snapshots__/event-card.test.js.snap +382 -0
- package/components/02-molecules/event-card/event-card.scss +153 -0
- package/components/02-molecules/event-card/event-card.stories.data.js +31 -0
- package/components/02-molecules/event-card/event-card.stories.js +68 -0
- package/components/02-molecules/event-card/event-card.test.js +74 -0
- package/components/02-molecules/event-card/event-card.twig +195 -0
- package/components/02-molecules/fast-fact-card/__snapshots__/fast-fact-card.test.js.snap +186 -0
- package/components/02-molecules/fast-fact-card/fast-fact-card.scss +104 -0
- package/components/02-molecules/fast-fact-card/fast-fact-card.stories.data.js +18 -0
- package/components/02-molecules/fast-fact-card/fast-fact-card.stories.js +44 -0
- package/components/02-molecules/fast-fact-card/fast-fact-card.test.js +90 -0
- package/components/02-molecules/fast-fact-card/fast-fact-card.twig +74 -0
- package/components/02-molecules/field/__snapshots__/field.test.js.snap +1526 -0
- package/components/02-molecules/field/field.scss +92 -0
- package/components/02-molecules/field/field.stories.data.js +52 -0
- package/components/02-molecules/field/field.stories.js +117 -0
- package/components/02-molecules/field/field.test.js +530 -0
- package/components/02-molecules/field/field.twig +206 -0
- package/components/02-molecules/figure/__snapshots__/figure.test.js.snap +104 -0
- package/components/02-molecules/figure/figure.scss +27 -0
- package/components/02-molecules/figure/figure.stories.js +52 -0
- package/components/02-molecules/figure/figure.test.js +60 -0
- package/components/02-molecules/figure/figure.twig +43 -0
- package/components/02-molecules/group-filter/__snapshots__/group-filter.test.js.snap +1466 -0
- package/components/02-molecules/group-filter/group-filter.js +33 -0
- package/components/02-molecules/group-filter/group-filter.scss +111 -0
- package/components/02-molecules/group-filter/group-filter.stories.data.js +83 -0
- package/components/02-molecules/group-filter/group-filter.stories.js +81 -0
- package/components/02-molecules/group-filter/group-filter.test.js +104 -0
- package/components/02-molecules/group-filter/group-filter.twig +192 -0
- package/components/02-molecules/inline-filter/inline-filter.scss +58 -0
- package/components/02-molecules/inline-filter/inline-filter.stories.data.js +24 -0
- package/components/02-molecules/inline-filter/inline-filter.stories.js +52 -0
- package/components/02-molecules/inline-filter/inline-filter.twig +48 -0
- package/components/02-molecules/logo/__snapshots__/logo.test.js.snap +191 -0
- package/components/02-molecules/logo/logo.scss +60 -0
- package/components/02-molecules/logo/logo.stories.data.js +34 -0
- package/components/02-molecules/logo/logo.stories.js +56 -0
- package/components/02-molecules/logo/logo.test.js +111 -0
- package/components/02-molecules/logo/logo.twig +71 -0
- package/components/02-molecules/logo/logo.utils.js +57 -0
- package/components/02-molecules/map/__snapshots__/map.test.js.snap +310 -0
- package/components/02-molecules/map/map.scss +35 -0
- package/components/02-molecules/map/map.stories.js +65 -0
- package/components/02-molecules/map/map.test.js +78 -0
- package/components/02-molecules/map/map.twig +86 -0
- package/components/02-molecules/navigation-card/__snapshots__/navigation-card.test.js.snap +507 -0
- package/components/02-molecules/navigation-card/navigation-card.scss +164 -0
- package/components/02-molecules/navigation-card/navigation-card.stories.data.js +26 -0
- package/components/02-molecules/navigation-card/navigation-card.stories.js +64 -0
- package/components/02-molecules/navigation-card/navigation-card.test.js +146 -0
- package/components/02-molecules/navigation-card/navigation-card.twig +165 -0
- package/components/02-molecules/next-step/__snapshots__/next-step.test.js.snap +331 -0
- package/components/02-molecules/next-step/next-step.scss +46 -0
- package/components/02-molecules/next-step/next-step.stories.js +61 -0
- package/components/02-molecules/next-step/next-step.test.js +74 -0
- package/components/02-molecules/next-step/next-step.twig +104 -0
- package/components/02-molecules/pagination/__snapshots__/pagination.test.js.snap +863 -0
- package/components/02-molecules/pagination/pagination.scss +103 -0
- package/components/02-molecules/pagination/pagination.stories.data.js +55 -0
- package/components/02-molecules/pagination/pagination.stories.js +56 -0
- package/components/02-molecules/pagination/pagination.test.js +121 -0
- package/components/02-molecules/pagination/pagination.twig +177 -0
- package/components/02-molecules/promo-card/__snapshots__/promo-card.test.js.snap +407 -0
- package/components/02-molecules/promo-card/promo-card.scss +149 -0
- package/components/02-molecules/promo-card/promo-card.stories.data.js +32 -0
- package/components/02-molecules/promo-card/promo-card.stories.js +62 -0
- package/components/02-molecules/promo-card/promo-card.test.js +98 -0
- package/components/02-molecules/promo-card/promo-card.twig +198 -0
- package/components/02-molecules/publication-card/__snapshots__/publication-card.test.js.snap +342 -0
- package/components/02-molecules/publication-card/publication-card.scss +148 -0
- package/components/02-molecules/publication-card/publication-card.stories.js +83 -0
- package/components/02-molecules/publication-card/publication-card.test.js +113 -0
- package/components/02-molecules/publication-card/publication-card.twig +162 -0
- package/components/02-molecules/search/__snapshots__/search.test.js.snap +161 -0
- package/components/02-molecules/search/search.scss +74 -0
- package/components/02-molecules/search/search.stories.js +40 -0
- package/components/02-molecules/search/search.test.js +58 -0
- package/components/02-molecules/search/search.twig +33 -0
- package/components/02-molecules/service-card/__snapshots__/service-card.test.js.snap +324 -0
- package/components/02-molecules/service-card/service-card.scss +42 -0
- package/components/02-molecules/service-card/service-card.stories.js +65 -0
- package/components/02-molecules/service-card/service-card.test.js +91 -0
- package/components/02-molecules/service-card/service-card.twig +89 -0
- package/components/02-molecules/single-filter/__snapshots__/single-filter.test.js.snap +694 -0
- package/components/02-molecules/single-filter/single-filter.js +33 -0
- package/components/02-molecules/single-filter/single-filter.scss +70 -0
- package/components/02-molecules/single-filter/single-filter.stories.data.js +35 -0
- package/components/02-molecules/single-filter/single-filter.stories.js +53 -0
- package/components/02-molecules/single-filter/single-filter.test.js +102 -0
- package/components/02-molecules/single-filter/single-filter.twig +139 -0
- package/components/02-molecules/snippet/__snapshots__/snippet.test.js.snap +367 -0
- package/components/02-molecules/snippet/snippet.scss +60 -0
- package/components/02-molecules/snippet/snippet.stories.data.js +20 -0
- package/components/02-molecules/snippet/snippet.stories.js +50 -0
- package/components/02-molecules/snippet/snippet.test.js +108 -0
- package/components/02-molecules/snippet/snippet.twig +109 -0
- package/components/02-molecules/social-links/__snapshots__/social-links.test.js.snap +311 -0
- package/components/02-molecules/social-links/social-links.scss +23 -0
- package/components/02-molecules/social-links/social-links.stories.js +77 -0
- package/components/02-molecules/social-links/social-links.test.js +82 -0
- package/components/02-molecules/social-links/social-links.twig +58 -0
- package/components/02-molecules/subject-card/__snapshots__/subject-card.test.js.snap +219 -0
- package/components/02-molecules/subject-card/subject-card.scss +112 -0
- package/components/02-molecules/subject-card/subject-card.stories.js +58 -0
- package/components/02-molecules/subject-card/subject-card.test.js +102 -0
- package/components/02-molecules/subject-card/subject-card.twig +81 -0
- package/components/02-molecules/table-of-contents/table-of-contents.js +152 -0
- package/components/02-molecules/table-of-contents/table-of-contents.scss +115 -0
- package/components/02-molecules/table-of-contents/table-of-contents.stories.js +88 -0
- package/components/02-molecules/table-of-contents/table-of-contents.twig +63 -0
- package/components/02-molecules/tabs/__snapshots__/tabs.test.js.snap +346 -0
- package/components/02-molecules/tabs/tabs.js +75 -0
- package/components/02-molecules/tabs/tabs.scss +66 -0
- package/components/02-molecules/tabs/tabs.stories.js +80 -0
- package/components/02-molecules/tabs/tabs.test.js +75 -0
- package/components/02-molecules/tabs/tabs.twig +81 -0
- package/components/02-molecules/tag-list/__snapshots__/tag-list.test.js.snap +255 -0
- package/components/02-molecules/tag-list/tag-list.stories.js +53 -0
- package/components/02-molecules/tag-list/tag-list.test.js +64 -0
- package/components/02-molecules/tag-list/tag-list.twig +68 -0
- package/components/02-molecules/tooltip/__snapshots__/tooltip.test.js.snap +321 -0
- package/components/02-molecules/tooltip/tooltip.js +143 -0
- package/components/02-molecules/tooltip/tooltip.scss +165 -0
- package/components/02-molecules/tooltip/tooltip.stories.js +59 -0
- package/components/02-molecules/tooltip/tooltip.test.js +59 -0
- package/components/02-molecules/tooltip/tooltip.twig +48 -0
- package/components/02-molecules/video-player/__snapshots__/video-player.test.js.snap +244 -0
- package/components/02-molecules/video-player/video-player.scss +75 -0
- package/components/02-molecules/video-player/video-player.stories.js +180 -0
- package/components/02-molecules/video-player/video-player.test.js +81 -0
- package/components/02-molecules/video-player/video-player.twig +130 -0
- package/components/03-organisms/alert/__snapshots__/alert.test.js.snap +356 -0
- package/components/03-organisms/alert/alert.js +268 -0
- package/components/03-organisms/alert/alert.scss +90 -0
- package/components/03-organisms/alert/alert.stories.js +104 -0
- package/components/03-organisms/alert/alert.test.js +59 -0
- package/components/03-organisms/alert/alert.twig +76 -0
- package/components/03-organisms/banner/__snapshots__/banner.test.js.snap +621 -0
- package/components/03-organisms/banner/banner.scss +118 -0
- package/components/03-organisms/banner/banner.stories.data.js +88 -0
- package/components/03-organisms/banner/banner.stories.js +87 -0
- package/components/03-organisms/banner/banner.test.js +94 -0
- package/components/03-organisms/banner/banner.twig +218 -0
- package/components/03-organisms/campaign/__snapshots__/campaign.test.js.snap +489 -0
- package/components/03-organisms/campaign/campaign.scss +64 -0
- package/components/03-organisms/campaign/campaign.stories.js +92 -0
- package/components/03-organisms/campaign/campaign.test.js +81 -0
- package/components/03-organisms/campaign/campaign.twig +152 -0
- package/components/03-organisms/footer/__snapshots__/footer.test.js.snap +354 -0
- package/components/03-organisms/footer/footer.scss +114 -0
- package/components/03-organisms/footer/footer.stories.data.js +42 -0
- package/components/03-organisms/footer/footer.stories.js +75 -0
- package/components/03-organisms/footer/footer.test.js +85 -0
- package/components/03-organisms/footer/footer.twig +157 -0
- package/components/03-organisms/header/__snapshots__/header.test.js.snap +411 -0
- package/components/03-organisms/header/header.scss +59 -0
- package/components/03-organisms/header/header.stories.data.js +132 -0
- package/components/03-organisms/header/header.stories.js +78 -0
- package/components/03-organisms/header/header.test.js +72 -0
- package/components/03-organisms/header/header.twig +141 -0
- package/components/03-organisms/list/__snapshots__/list.test.js.snap +454 -0
- package/components/03-organisms/list/list.scss +83 -0
- package/components/03-organisms/list/list.stories.data.js +98 -0
- package/components/03-organisms/list/list.stories.js +223 -0
- package/components/03-organisms/list/list.test.js +93 -0
- package/components/03-organisms/list/list.twig +263 -0
- package/components/03-organisms/message/__snapshots__/message.test.js.snap +517 -0
- package/components/03-organisms/message/message.scss +69 -0
- package/components/03-organisms/message/message.stories.js +58 -0
- package/components/03-organisms/message/message.test.js +158 -0
- package/components/03-organisms/message/message.twig +69 -0
- package/components/03-organisms/mobile-navigation/__snapshots__/mobile-navigation.test.js.snap +928 -0
- package/components/03-organisms/mobile-navigation/mobile-navigation-close.twig +31 -0
- package/components/03-organisms/mobile-navigation/mobile-navigation-menu.twig +138 -0
- package/components/03-organisms/mobile-navigation/mobile-navigation-trigger.twig +28 -0
- package/components/03-organisms/mobile-navigation/mobile-navigation.scss +236 -0
- package/components/03-organisms/mobile-navigation/mobile-navigation.stories.js +123 -0
- package/components/03-organisms/mobile-navigation/mobile-navigation.stories.scss +21 -0
- package/components/03-organisms/mobile-navigation/mobile-navigation.test.js +143 -0
- package/components/03-organisms/mobile-navigation/mobile-navigation.twig +86 -0
- package/components/03-organisms/navigation/__snapshots__/navigation.test.js.snap +561 -0
- package/components/03-organisms/navigation/navigation.scss +433 -0
- package/components/03-organisms/navigation/navigation.stories.data.js +60 -0
- package/components/03-organisms/navigation/navigation.stories.js +58 -0
- package/components/03-organisms/navigation/navigation.test.js +122 -0
- package/components/03-organisms/navigation/navigation.twig +106 -0
- package/components/03-organisms/promo/__snapshots__/promo.test.js.snap +415 -0
- package/components/03-organisms/promo/promo.scss +65 -0
- package/components/03-organisms/promo/promo.stories.js +70 -0
- package/components/03-organisms/promo/promo.test.js +125 -0
- package/components/03-organisms/promo/promo.twig +113 -0
- package/components/03-organisms/side-navigation/__snapshots__/side-navigation.test.js.snap +393 -0
- package/components/03-organisms/side-navigation/side-navigation.scss +215 -0
- package/components/03-organisms/side-navigation/side-navigation.stories.data.js +54 -0
- package/components/03-organisms/side-navigation/side-navigation.stories.js +39 -0
- package/components/03-organisms/side-navigation/side-navigation.test.js +87 -0
- package/components/03-organisms/side-navigation/side-navigation.twig +54 -0
- package/components/03-organisms/skip-link/__snapshots__/skip-link.test.js.snap +94 -0
- package/components/03-organisms/skip-link/skip-link.scss +28 -0
- package/components/03-organisms/skip-link/skip-link.stories.js +42 -0
- package/components/03-organisms/skip-link/skip-link.test.js +48 -0
- package/components/03-organisms/skip-link/skip-link.twig +31 -0
- package/components/03-organisms/slider/__snapshots__/slide.test.js.snap +265 -0
- package/components/03-organisms/slider/__snapshots__/slider.test.js.snap +638 -0
- package/components/03-organisms/slider/slide.test.js +55 -0
- package/components/03-organisms/slider/slide.twig +168 -0
- package/components/03-organisms/slider/slider.js +159 -0
- package/components/03-organisms/slider/slider.scss +158 -0
- package/components/03-organisms/slider/slider.stories.js +90 -0
- package/components/03-organisms/slider/slider.test.js +84 -0
- package/components/03-organisms/slider/slider.twig +116 -0
- package/components/03-organisms/webform/__snapshots__/webform.test.js.snap +145 -0
- package/components/03-organisms/webform/webform.js +36 -0
- package/components/03-organisms/webform/webform.scss +17 -0
- package/components/03-organisms/webform/webform.stories.js +45 -0
- package/components/03-organisms/webform/webform.test.js +63 -0
- package/components/03-organisms/webform/webform.twig +33 -0
- package/components/04-templates/event/.gitkeep +0 -0
- package/components/04-templates/page/__snapshots__/page.test.js.snap +1503 -0
- package/components/04-templates/page/page.scss +11 -0
- package/components/04-templates/page/page.stories.data.js +166 -0
- package/components/04-templates/page/page.stories.js +163 -0
- package/components/04-templates/page/page.test.js +170 -0
- package/components/04-templates/page/page.twig +138 -0
- package/components/style.css_variables.scss +129 -0
- package/components/style.scss +13 -0
- package/components/style.stories.scss +15 -0
- package/components/variables.base.scss +33 -0
- package/components/variables.components.scss +6 -0
- package/dist/assets/backgrounds/civictheme_background_1.png +0 -0
- package/dist/assets/backgrounds/civictheme_background_2.png +0 -0
- package/dist/assets/backgrounds/civictheme_background_3.png +0 -0
- package/dist/assets/backgrounds/civictheme_background_4.png +0 -0
- package/dist/assets/backgrounds/civictheme_background_5.png +0 -0
- package/dist/assets/backgrounds/civictheme_background_6.png +0 -0
- package/dist/assets/backgrounds/civictheme_background_7.png +0 -0
- package/dist/assets/icons/account.svg +3 -0
- package/dist/assets/icons/approve.svg +3 -0
- package/dist/assets/icons/bars.svg +3 -0
- package/dist/assets/icons/bullet.svg +3 -0
- package/dist/assets/icons/calendar-1.svg +3 -0
- package/dist/assets/icons/calendar-2.svg +3 -0
- package/dist/assets/icons/call.svg +3 -0
- package/dist/assets/icons/cancel.svg +3 -0
- package/dist/assets/icons/checked.svg +4 -0
- package/dist/assets/icons/close-outline.svg +3 -0
- package/dist/assets/icons/close.svg +3 -0
- package/dist/assets/icons/document.svg +4 -0
- package/dist/assets/icons/down-arrow-1.svg +3 -0
- package/dist/assets/icons/down-arrow-2.svg +3 -0
- package/dist/assets/icons/download-file.svg +3 -0
- package/dist/assets/icons/download.svg +3 -0
- package/dist/assets/icons/exclamation-mark-1.svg +3 -0
- package/dist/assets/icons/exclamation-mark-2.svg +3 -0
- package/dist/assets/icons/exclamation-mark-3.svg +3 -0
- package/dist/assets/icons/eye.svg +3 -0
- package/dist/assets/icons/facebook.svg +3 -0
- package/dist/assets/icons/help.svg +3 -0
- package/dist/assets/icons/image.svg +5 -0
- package/dist/assets/icons/information-mark.svg +3 -0
- package/dist/assets/icons/instagram.svg +3 -0
- package/dist/assets/icons/layer.svg +4 -0
- package/dist/assets/icons/layers.svg +4 -0
- package/dist/assets/icons/left-arrow-outline.svg +3 -0
- package/dist/assets/icons/left-arrow.svg +3 -0
- package/dist/assets/icons/linkedin.svg +3 -0
- package/dist/assets/icons/lock-file.svg +4 -0
- package/dist/assets/icons/lock-gallery.svg +4 -0
- package/dist/assets/icons/magnifier.svg +3 -0
- package/dist/assets/icons/map.svg +3 -0
- package/dist/assets/icons/megaphone.svg +3 -0
- package/dist/assets/icons/message.svg +3 -0
- package/dist/assets/icons/mobile.svg +4 -0
- package/dist/assets/icons/mortarboard.svg +3 -0
- package/dist/assets/icons/newspaper.svg +3 -0
- package/dist/assets/icons/open-source.svg +3 -0
- package/dist/assets/icons/pdf-file.svg +4 -0
- package/dist/assets/icons/progress.svg +3 -0
- package/dist/assets/icons/right-arrow-1.svg +3 -0
- package/dist/assets/icons/right-arrow-2.svg +3 -0
- package/dist/assets/icons/select-box.svg +4 -0
- package/dist/assets/icons/share.svg +3 -0
- package/dist/assets/icons/square.svg +3 -0
- package/dist/assets/icons/to-do.svg +3 -0
- package/dist/assets/icons/twitter.svg +3 -0
- package/dist/assets/icons/up-arrow.svg +3 -0
- package/dist/assets/icons/upper-arrow.svg +3 -0
- package/dist/assets/icons/upper-right-arrow.svg +3 -0
- package/dist/assets/icons/users.svg +4 -0
- package/dist/assets/icons/watch.svg +3 -0
- package/dist/assets/icons/water-drop.svg +4 -0
- package/dist/assets/icons/web.svg +4 -0
- package/dist/assets/icons/word-file.svg +4 -0
- package/dist/assets/icons/x.svg +3 -0
- package/dist/assets/icons/youtube.svg +3 -0
- package/dist/assets/logos/logo_custom_light_desktop_civictheme.svg +32 -0
- package/dist/assets/logos/logo_custom_light_mobile_civictheme.svg +32 -0
- package/dist/assets/logos/logo_primary_dark_desktop.png +0 -0
- package/dist/assets/logos/logo_primary_dark_mobile.png +0 -0
- package/dist/assets/logos/logo_primary_light_desktop.png +0 -0
- package/dist/assets/logos/logo_primary_light_mobile.png +0 -0
- package/dist/assets/logos/logo_secondary_dark_desktop.png +0 -0
- package/dist/assets/logos/logo_secondary_dark_mobile.png +0 -0
- package/dist/assets/logos/logo_secondary_light_desktop.png +0 -0
- package/dist/assets/logos/logo_secondary_light_mobile.png +0 -0
- package/dist/civictheme.css +12303 -0
- package/dist/civictheme.stories.css +2807 -0
- package/dist/civictheme.storybook.css +12303 -0
- package/dist/civictheme.storybook.js +4122 -0
- package/dist/civictheme.variables.css +1148 -0
- package/dist/constants.json +1562 -0
- package/package.json +80 -0
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CivicTheme Alert component.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
function CivicThemeAlert(el) {
|
|
6
|
+
// Use "data-alert"'s attribute value to identify if this
|
|
7
|
+
// component was already initialised.
|
|
8
|
+
if (el.getAttribute('data-alert') === 'true' || this.container) {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
this.container = el;
|
|
13
|
+
this.endpoint = this.container.getAttribute('data-alert-endpoint');
|
|
14
|
+
if (this.endpoint !== null) {
|
|
15
|
+
this.getAll();
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// Mark as initialized.
|
|
19
|
+
this.container.setAttribute('data-alert', 'true');
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Gets alerts from endpoint.
|
|
24
|
+
*/
|
|
25
|
+
CivicThemeAlert.prototype.getAll = function () {
|
|
26
|
+
const { endpoint } = this;
|
|
27
|
+
const request = new XMLHttpRequest();
|
|
28
|
+
request.open('get', endpoint);
|
|
29
|
+
request.onreadystatechange = () => {
|
|
30
|
+
if (request.readyState === 4 && request.status === 200) {
|
|
31
|
+
try {
|
|
32
|
+
const response = JSON.parse(request.responseText);
|
|
33
|
+
const html = this.filter(response);
|
|
34
|
+
this.insert(html);
|
|
35
|
+
} catch (e) {
|
|
36
|
+
// Do nothing.
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
request.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
|
|
41
|
+
request.send();
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Filters out alerts not to show ie dismissed, page-specific alerts.
|
|
46
|
+
*/
|
|
47
|
+
CivicThemeAlert.prototype.filter = function (response) {
|
|
48
|
+
let html = '';
|
|
49
|
+
|
|
50
|
+
if (response.length) {
|
|
51
|
+
for (let i = 0; i < response.length; i++) {
|
|
52
|
+
const item = response[i];
|
|
53
|
+
|
|
54
|
+
if (!this.isValidResponse(item)) {
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// Skip the alert hidden by the user session.
|
|
59
|
+
if (this.hasCookieValue(item.id, item.message)) {
|
|
60
|
+
continue;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// Skip the alert not matching visibility rules.
|
|
64
|
+
if (!this.isVisible(item.visibility)) {
|
|
65
|
+
continue;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
html += item.message;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return html;
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Checks whether an alert is to be shown on a specified page.
|
|
77
|
+
*/
|
|
78
|
+
CivicThemeAlert.prototype.isVisible = function (visibilityString) {
|
|
79
|
+
if ((typeof visibilityString === 'undefined') || visibilityString === false || visibilityString === '') {
|
|
80
|
+
return true;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
let pageVisibility = visibilityString.replace(/\*/g, '[^ ]*');
|
|
84
|
+
// Replace '<front>' with "/".
|
|
85
|
+
pageVisibility = pageVisibility.replace('<front>', '/');
|
|
86
|
+
// Replace all occurrences of '/' with '\/'.
|
|
87
|
+
// eslint-disable-next-line
|
|
88
|
+
pageVisibility = pageVisibility.replace('/', '\/');
|
|
89
|
+
|
|
90
|
+
const pageVisibilityRules = pageVisibility.split(/\r?\n/);
|
|
91
|
+
if (pageVisibilityRules.length !== 0) {
|
|
92
|
+
const path = this.urlPath();
|
|
93
|
+
|
|
94
|
+
for (let r = 0, rlen = pageVisibilityRules.length; r < rlen; r++) {
|
|
95
|
+
if (path === pageVisibilityRules[r]) {
|
|
96
|
+
return true;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
if (pageVisibilityRules[r].indexOf('*') !== -1 && path.match(new RegExp(`^${pageVisibilityRules[r]}`))) {
|
|
100
|
+
return true;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
return false;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
return true;
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Check if response object is valid.
|
|
111
|
+
*/
|
|
112
|
+
CivicThemeAlert.prototype.isValidResponse = function (item) {
|
|
113
|
+
return typeof item === 'object' && 'id' in item && 'message' in item && 'visibility' in item;
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Get the cookie name.
|
|
118
|
+
*/
|
|
119
|
+
CivicThemeAlert.prototype.getCookieName = function () {
|
|
120
|
+
return 'ct-alert-hide';
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Check if cookie has value.
|
|
125
|
+
*/
|
|
126
|
+
CivicThemeAlert.prototype.hasCookieValue = function (id, message) {
|
|
127
|
+
const cookie = this.getCookie();
|
|
128
|
+
return id in cookie && cookie[id] === this.hashString(this.removeHtml(message));
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Sets an cookie value.
|
|
133
|
+
*/
|
|
134
|
+
CivicThemeAlert.prototype.setCookieValue = function (id, message) {
|
|
135
|
+
const cookie = this.getCookie();
|
|
136
|
+
cookie[id] = this.hashString(this.removeHtml(message));
|
|
137
|
+
this.setCookie(cookie);
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Get cookie value.
|
|
142
|
+
*/
|
|
143
|
+
CivicThemeAlert.prototype.getCookie = function () {
|
|
144
|
+
let cookie = {};
|
|
145
|
+
|
|
146
|
+
const values = document.cookie.split(';').filter((item) => item.trim().startsWith(`${this.getCookieName()}=`));
|
|
147
|
+
if (values.length !== 1) {
|
|
148
|
+
return cookie;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
const stringValues = values[0].trim().replace(`${this.getCookieName()}=`, '');
|
|
152
|
+
if (typeof stringValues !== 'string') {
|
|
153
|
+
return cookie;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
try {
|
|
157
|
+
cookie = JSON.parse(stringValues);
|
|
158
|
+
} catch (e) {
|
|
159
|
+
cookie = {};
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
return cookie;
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Set a cookie.
|
|
167
|
+
*/
|
|
168
|
+
CivicThemeAlert.prototype.setCookie = function (value) {
|
|
169
|
+
document.cookie = `${this.getCookieName()}=${JSON.stringify(value)}; SameSite=Strict; Path=/`;
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Simple HTML remover.
|
|
174
|
+
*/
|
|
175
|
+
CivicThemeAlert.prototype.removeHtml = function (string) {
|
|
176
|
+
return string
|
|
177
|
+
.replace(/(\r\n|\n|\r)/g, '')
|
|
178
|
+
.replace(/\s/g, '')
|
|
179
|
+
.replace(/( |<([^>]+)>)/ig, '')
|
|
180
|
+
.trim();
|
|
181
|
+
};
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* Hash string.
|
|
185
|
+
*/
|
|
186
|
+
CivicThemeAlert.prototype.hashString = function (string) {
|
|
187
|
+
let hash = 0;
|
|
188
|
+
let i;
|
|
189
|
+
let
|
|
190
|
+
chr;
|
|
191
|
+
if (string.length === 0) return hash;
|
|
192
|
+
for (i = 0; i < string.length; i++) {
|
|
193
|
+
chr = string.charCodeAt(i);
|
|
194
|
+
// eslint-disable-next-line no-bitwise
|
|
195
|
+
hash = ((hash << 5) - hash) + chr;
|
|
196
|
+
// eslint-disable-next-line no-bitwise
|
|
197
|
+
hash |= 0;
|
|
198
|
+
}
|
|
199
|
+
return hash;
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* Insert alerts into container.
|
|
204
|
+
*/
|
|
205
|
+
CivicThemeAlert.prototype.insert = function (html) {
|
|
206
|
+
// Build the alert.
|
|
207
|
+
this.container.insertAdjacentHTML('afterbegin', html);
|
|
208
|
+
this.setDismissListeners();
|
|
209
|
+
};
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* Sets dismiss listeners to alerts.
|
|
213
|
+
*/
|
|
214
|
+
CivicThemeAlert.prototype.setDismissListeners = function () {
|
|
215
|
+
// Process the Close button of each alert.
|
|
216
|
+
document
|
|
217
|
+
.querySelectorAll('[data-alert-dismiss-trigger]')
|
|
218
|
+
.forEach((el) => {
|
|
219
|
+
el.addEventListener('click', (event) => {
|
|
220
|
+
event.stopPropagation();
|
|
221
|
+
const parent = this.getParentElement(event.currentTarget, '[data-component-name="ct-alert"]');
|
|
222
|
+
this.dismiss(parent);
|
|
223
|
+
});
|
|
224
|
+
});
|
|
225
|
+
};
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* Dismisses an alert and adds cookie to dismiss for session.
|
|
229
|
+
*/
|
|
230
|
+
CivicThemeAlert.prototype.dismiss = function (element) {
|
|
231
|
+
if (element !== null) {
|
|
232
|
+
const parent = this.getParentElement(element, '[data-component-name="ct-alerts"]');
|
|
233
|
+
if (parent) {
|
|
234
|
+
parent.removeChild(element);
|
|
235
|
+
}
|
|
236
|
+
const id = element.getAttribute('data-alert-id');
|
|
237
|
+
if (id) {
|
|
238
|
+
this.setCookieValue(id, element.outerHTML);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
};
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* Get a parent element matching a selector.
|
|
245
|
+
*/
|
|
246
|
+
CivicThemeAlert.prototype.getParentElement = function (element, selector) {
|
|
247
|
+
while (element !== null && !element.matches(selector)) {
|
|
248
|
+
element = element.parentNode;
|
|
249
|
+
}
|
|
250
|
+
return element;
|
|
251
|
+
};
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* Get current path from URL or data attribute.
|
|
255
|
+
*
|
|
256
|
+
* 'data-test-path' attribute is used for testing of this component within
|
|
257
|
+
* Storybook.
|
|
258
|
+
*/
|
|
259
|
+
CivicThemeAlert.prototype.urlPath = function () {
|
|
260
|
+
return this.container.getAttribute('data-test-path') || window.location.pathname;
|
|
261
|
+
};
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* Initialise component.
|
|
265
|
+
*/
|
|
266
|
+
document.querySelectorAll('[data-component-name="ct-alerts"]').forEach((el) => {
|
|
267
|
+
new CivicThemeAlert(el);
|
|
268
|
+
});
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
//
|
|
2
|
+
// CivicTheme Alert component styles.
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
@use 'sass:map';
|
|
6
|
+
|
|
7
|
+
.ct-alert {
|
|
8
|
+
$root: &;
|
|
9
|
+
|
|
10
|
+
position: relative;
|
|
11
|
+
padding: ct-spacing(2);
|
|
12
|
+
|
|
13
|
+
@include ct-breakpoint(m) {
|
|
14
|
+
padding: ct-spacing(3);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
@include ct-typography('label-extra-small');
|
|
18
|
+
|
|
19
|
+
#{$root}__title {
|
|
20
|
+
@include ct-typography('heading-6');
|
|
21
|
+
|
|
22
|
+
display: flex;
|
|
23
|
+
align-items: center;
|
|
24
|
+
|
|
25
|
+
@include ct-breakpoint-upto('m') {
|
|
26
|
+
margin-bottom: ct-spacing();
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
#{$root}__icon {
|
|
31
|
+
width: ct-particle(3);
|
|
32
|
+
margin-right: ct-spacing();
|
|
33
|
+
line-height: 100%;
|
|
34
|
+
|
|
35
|
+
@include ct-breakpoint(m) {
|
|
36
|
+
margin-right: ct-spacing(2);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
#{$root}__summary {
|
|
41
|
+
display: flex;
|
|
42
|
+
align-items: center;
|
|
43
|
+
|
|
44
|
+
@include ct-breakpoint(m) {
|
|
45
|
+
position: relative;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
p {
|
|
49
|
+
&:nth-last-child(-n+2) {
|
|
50
|
+
margin-bottom: 0;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
#{$root}__dismiss-button {
|
|
56
|
+
cursor: pointer;
|
|
57
|
+
margin-left: ct-spacing(3);
|
|
58
|
+
position: absolute;
|
|
59
|
+
top: ct-spacing(2);
|
|
60
|
+
right: ct-spacing(2);
|
|
61
|
+
background-color: transparent;
|
|
62
|
+
padding: 0;
|
|
63
|
+
|
|
64
|
+
@include ct-breakpoint(m) {
|
|
65
|
+
@include ct-typography('heading-6');
|
|
66
|
+
|
|
67
|
+
position: unset;
|
|
68
|
+
align-self: center;
|
|
69
|
+
margin-left: auto;
|
|
70
|
+
top: 50%;
|
|
71
|
+
bottom: 50%;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
@include ct-component-theme($root) using($root, $theme) {
|
|
76
|
+
$types: ('information', 'warning', 'error', 'success');
|
|
77
|
+
|
|
78
|
+
@each $type in $types {
|
|
79
|
+
&#{$root}--#{$type} {
|
|
80
|
+
@include ct-component-property($root, $theme, $type, background-color);
|
|
81
|
+
@include ct-component-property($root, $theme, $type, color);
|
|
82
|
+
|
|
83
|
+
#{$root}__dismiss-button,
|
|
84
|
+
#{$root}__icon {
|
|
85
|
+
@include ct-component-property($root, $theme, $type, icon, color);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CivicTheme Alert component stories.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import Component from './alert.twig';
|
|
6
|
+
|
|
7
|
+
const meta = {
|
|
8
|
+
title: 'Organisms/Alert',
|
|
9
|
+
component: Component,
|
|
10
|
+
argTypes: {
|
|
11
|
+
theme: {
|
|
12
|
+
control: { type: 'radio' },
|
|
13
|
+
options: ['light', 'dark'],
|
|
14
|
+
},
|
|
15
|
+
type: {
|
|
16
|
+
control: { type: 'radio' },
|
|
17
|
+
options: ['information', 'error', 'warning', 'success'],
|
|
18
|
+
},
|
|
19
|
+
id: {
|
|
20
|
+
control: { type: 'text' },
|
|
21
|
+
},
|
|
22
|
+
title: {
|
|
23
|
+
control: { type: 'text' },
|
|
24
|
+
},
|
|
25
|
+
description: {
|
|
26
|
+
control: { type: 'text' },
|
|
27
|
+
},
|
|
28
|
+
modifier_class: {
|
|
29
|
+
control: { type: 'text' },
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export default meta;
|
|
35
|
+
|
|
36
|
+
export const Alert = {
|
|
37
|
+
parameters: {
|
|
38
|
+
layout: 'fullscreen',
|
|
39
|
+
storyDocs: 'Dismiss alerts by clicking on [X] button.<br/><br/>Navigate to another component and return here to assert that dismissed alerts do not appear.<br/><br/>Dismissed alerts will be revealed if their content was updated. Change payload to "Updated" to see dismissed alerts appear again.',
|
|
40
|
+
storyDocsPlacement: 'after',
|
|
41
|
+
},
|
|
42
|
+
args: {
|
|
43
|
+
theme: 'light',
|
|
44
|
+
type: 'information',
|
|
45
|
+
id: 'alert-1',
|
|
46
|
+
title: 'Site information',
|
|
47
|
+
description: 'Alert description',
|
|
48
|
+
attributes: null,
|
|
49
|
+
modifier_class: '',
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export const AlertApi = {
|
|
54
|
+
parameters: {
|
|
55
|
+
layout: 'fullscreen',
|
|
56
|
+
},
|
|
57
|
+
argTypes: {
|
|
58
|
+
endpoint_type: {
|
|
59
|
+
control: { type: 'radio' },
|
|
60
|
+
options: ['default', 'updated', 'invalid'],
|
|
61
|
+
},
|
|
62
|
+
theme: {
|
|
63
|
+
table: { disable: true },
|
|
64
|
+
},
|
|
65
|
+
type: {
|
|
66
|
+
table: { disable: true },
|
|
67
|
+
},
|
|
68
|
+
id: {
|
|
69
|
+
table: { disable: true },
|
|
70
|
+
},
|
|
71
|
+
title: {
|
|
72
|
+
table: { disable: true },
|
|
73
|
+
},
|
|
74
|
+
description: {
|
|
75
|
+
table: { disable: true },
|
|
76
|
+
},
|
|
77
|
+
attributes: {
|
|
78
|
+
table: { disable: true },
|
|
79
|
+
},
|
|
80
|
+
modifier_class: {
|
|
81
|
+
table: { disable: true },
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
args: {
|
|
85
|
+
endpoint_type: 'default',
|
|
86
|
+
},
|
|
87
|
+
render: (args) => {
|
|
88
|
+
let endpoint = '';
|
|
89
|
+
switch (args.endpoint_type) {
|
|
90
|
+
case 'updated':
|
|
91
|
+
endpoint = 'api/alerts2.json';
|
|
92
|
+
break;
|
|
93
|
+
case 'invalid':
|
|
94
|
+
endpoint = 'api/alerts3.json';
|
|
95
|
+
break;
|
|
96
|
+
default:
|
|
97
|
+
endpoint = 'api/alerts1.json';
|
|
98
|
+
}
|
|
99
|
+
return `
|
|
100
|
+
<div data-component-name="ct-alerts" data-alert-endpoint="${endpoint}" data-test-path="/"></div>
|
|
101
|
+
<button style="margin-top: 24px;" onclick="document.cookie = 'ct-alert-hide=;expires=Thu, 01 Jan 1970 00:00:01 GMT;'; window.location.reload();">Clear cookie</button>
|
|
102
|
+
`;
|
|
103
|
+
},
|
|
104
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import DrupalAttribute from 'drupal-attribute';
|
|
2
|
+
|
|
3
|
+
const template = 'components/03-organisms/alert/alert.twig';
|
|
4
|
+
|
|
5
|
+
describe('Alert Component', () => {
|
|
6
|
+
test('renders with required attributes', async () => {
|
|
7
|
+
const c = await dom(template, {
|
|
8
|
+
description: 'This is an info alert.',
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
expect(c.querySelectorAll('.ct-alert')).toHaveLength(1);
|
|
12
|
+
expect(c.querySelector('.ct-alert__summary').textContent.trim()).toEqual('This is an info alert.');
|
|
13
|
+
assertUniqueCssClasses(c);
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
test('renders with optional attributes', async () => {
|
|
17
|
+
const c = await dom(template, {
|
|
18
|
+
description: 'This is a warning alert.',
|
|
19
|
+
theme: 'dark',
|
|
20
|
+
type: 'warning',
|
|
21
|
+
id: 'alert-1',
|
|
22
|
+
title: 'Warning Alert',
|
|
23
|
+
attributes: new DrupalAttribute().setAttribute('data-test', 'true'),
|
|
24
|
+
modifier_class: 'custom-class',
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
const element = c.querySelector('.ct-alert');
|
|
28
|
+
expect(element).not.toBeNull();
|
|
29
|
+
expect(element.classList.contains('ct-theme-dark')).toBe(true);
|
|
30
|
+
expect(element.classList.contains('ct-alert--warning')).toBe(true);
|
|
31
|
+
expect(element.classList.contains('custom-class')).toBe(true);
|
|
32
|
+
expect(element.getAttribute('data-test')).toEqual('true');
|
|
33
|
+
expect(element.getAttribute('data-alert-id')).toEqual('alert-1');
|
|
34
|
+
expect(element.getAttribute('data-alert-type')).toEqual('warning');
|
|
35
|
+
expect(c.querySelector('.ct-alert__title').textContent.trim()).toEqual('Warning Alert');
|
|
36
|
+
expect(c.querySelector('.ct-alert__summary').textContent.trim()).toEqual('This is a warning alert.');
|
|
37
|
+
expect(c.querySelector('.ct-alert__dismiss-button')).not.toBeNull();
|
|
38
|
+
assertUniqueCssClasses(c);
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
test('does not render when description is empty', async () => {
|
|
42
|
+
const c = await dom(template, {
|
|
43
|
+
description: '',
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
expect(c.querySelectorAll('.ct-alert')).toHaveLength(0);
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
test('renders with correct icon for alert type', async () => {
|
|
50
|
+
const c = await dom(template, {
|
|
51
|
+
description: 'This is a success alert.',
|
|
52
|
+
type: 'success',
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
expect(c.querySelector('.ct-alert--success')).not.toBeNull();
|
|
56
|
+
expect(c.querySelector('.ct-icon')).not.toBeNull();
|
|
57
|
+
assertUniqueCssClasses(c);
|
|
58
|
+
});
|
|
59
|
+
});
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
{#
|
|
2
|
+
/**
|
|
3
|
+
* @file
|
|
4
|
+
* CivicTheme Alert component.
|
|
5
|
+
*
|
|
6
|
+
* Props:
|
|
7
|
+
* - theme: [string] Theme variation (light or dark).
|
|
8
|
+
* - type: [string] Alert type (information, error, warning, success).
|
|
9
|
+
* - id: [string] Unique identifier for the alert.
|
|
10
|
+
* - modifier_class: [string] Additional CSS classes.
|
|
11
|
+
* - attributes: [Drupal\Core\Template\Attribute] Additional HTML attributes.
|
|
12
|
+
*
|
|
13
|
+
* Slots:
|
|
14
|
+
* - title: Alert title.
|
|
15
|
+
* - description: Alert description content.
|
|
16
|
+
*/
|
|
17
|
+
#}
|
|
18
|
+
|
|
19
|
+
{% set theme = theme|default('light') %}
|
|
20
|
+
{% set theme = theme in ['light', 'dark'] ? theme : 'light' %}
|
|
21
|
+
{% set theme_class = 'ct-theme-%s'|format(theme) %}
|
|
22
|
+
{% set type = type in ['information', 'error', 'warning', 'success'] ? type : 'information' %}
|
|
23
|
+
{% set type_class = 'ct-alert--%s'|format(type|default('information')) %}
|
|
24
|
+
{% set modifier_class = '%s %s %s'|format(theme_class, type_class, modifier_class|default('')) %}
|
|
25
|
+
|
|
26
|
+
{% set icons = {
|
|
27
|
+
information: 'information-mark',
|
|
28
|
+
warning: 'exclamation-mark-2',
|
|
29
|
+
error: 'exclamation-mark-1',
|
|
30
|
+
success: 'megaphone',
|
|
31
|
+
} %}
|
|
32
|
+
|
|
33
|
+
{% if description is not empty %}
|
|
34
|
+
<div
|
|
35
|
+
class="ct-alert {{ modifier_class -}}"
|
|
36
|
+
data-alert-id="{{ id }}"
|
|
37
|
+
data-alert-type="{{ type }}"
|
|
38
|
+
data-component-name="ct-alert"
|
|
39
|
+
role="alert"
|
|
40
|
+
{% if attributes is defined and attributes is not null %}{{- attributes -}}{% endif %}
|
|
41
|
+
>
|
|
42
|
+
<div class="container">
|
|
43
|
+
<div class="row">
|
|
44
|
+
<div class="ct-alert__title col-xxs-12 col-m-3">
|
|
45
|
+
{% if icons[type] is defined %}
|
|
46
|
+
<span class="ct-alert__icon">
|
|
47
|
+
{% include '@base/icon/icon.twig' with {
|
|
48
|
+
symbol: icons[type],
|
|
49
|
+
size: 'regular',
|
|
50
|
+
} only %}
|
|
51
|
+
</span>
|
|
52
|
+
{% endif %}
|
|
53
|
+
{{ title }}
|
|
54
|
+
</div>
|
|
55
|
+
|
|
56
|
+
<div class="ct-alert__summary col-xxs-12 col-m-9">
|
|
57
|
+
{{ description }}
|
|
58
|
+
{% include '@atoms/button/button.twig' with {
|
|
59
|
+
kind: 'button',
|
|
60
|
+
theme: theme,
|
|
61
|
+
type: 'tertiary',
|
|
62
|
+
modifier_class: 'ct-alert__dismiss-button',
|
|
63
|
+
text: '',
|
|
64
|
+
icon: 'cancel',
|
|
65
|
+
size: 'regular',
|
|
66
|
+
attributes: create_attribute({
|
|
67
|
+
id: 'dismiss-alert-' ~ id,
|
|
68
|
+
'data-alert-dismiss-trigger': '',
|
|
69
|
+
title: 'close ' ~ type ~ ' alert',
|
|
70
|
+
}),
|
|
71
|
+
} %}
|
|
72
|
+
</div>
|
|
73
|
+
</div>
|
|
74
|
+
</div>
|
|
75
|
+
</div>
|
|
76
|
+
{% endif %}
|