@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,129 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CivicTheme Table component stories.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import Component from './table.twig';
|
|
6
|
+
import Link from '../link/link.twig';
|
|
7
|
+
|
|
8
|
+
const getRows = function (theme) {
|
|
9
|
+
return [
|
|
10
|
+
[
|
|
11
|
+
Link({ theme, text: 'Row 1 with link', url: '#', title: 'Row 1 with link' }),
|
|
12
|
+
'Description summary on odd row with vertical spacing',
|
|
13
|
+
'Another column',
|
|
14
|
+
'One more column column',
|
|
15
|
+
],
|
|
16
|
+
[
|
|
17
|
+
Link({ theme, text: 'Row 2 with link', url: '#', title: 'Row 2 with link' }),
|
|
18
|
+
Link({ theme, text: 'Row 2 with link', url: '#', title: 'Row 2 with link' }),
|
|
19
|
+
'Description summary on even row',
|
|
20
|
+
'Another column',
|
|
21
|
+
],
|
|
22
|
+
[
|
|
23
|
+
Link({ theme, text: 'Row 3 with link', url: '#', title: 'Row 3 with link' }),
|
|
24
|
+
'Description summary on odd row with vertical spacing',
|
|
25
|
+
'Another column',
|
|
26
|
+
'One more column column',
|
|
27
|
+
],
|
|
28
|
+
[
|
|
29
|
+
Link({ theme, text: 'Row 4 with link', url: '#', title: 'Row 4 with link' }),
|
|
30
|
+
'Description summary on even row',
|
|
31
|
+
'Another column',
|
|
32
|
+
'One more column column',
|
|
33
|
+
],
|
|
34
|
+
[
|
|
35
|
+
'Row 5 without a link',
|
|
36
|
+
'Description summary on odd row with vertical spacing',
|
|
37
|
+
'Another column',
|
|
38
|
+
'One more column column',
|
|
39
|
+
],
|
|
40
|
+
[
|
|
41
|
+
'Row 6 with larger amount of content',
|
|
42
|
+
'<p>Paragraph 1 of row 6. Lorem Ipsum is simply dummy text of the printing and typesetting industry.</p><p>Paragraph 2 of row 6. Lorem Ipsum has been the industry\'s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.</p><p>Paragraph 3 of row 6. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged.</p><p>Paragraph 4 of row 6. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>',
|
|
43
|
+
'Another column',
|
|
44
|
+
'One more column column',
|
|
45
|
+
],
|
|
46
|
+
[
|
|
47
|
+
'Row 7 with small amount of content',
|
|
48
|
+
'<p>Paragraph 1 of row 7. Lorem Ipsum is simply dummy text of the printing and typesetting industry.</p>',
|
|
49
|
+
'Another column',
|
|
50
|
+
'One more column column',
|
|
51
|
+
],
|
|
52
|
+
];
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
const meta = {
|
|
56
|
+
title: 'Atoms/Table',
|
|
57
|
+
component: Component,
|
|
58
|
+
argTypes: {
|
|
59
|
+
theme: {
|
|
60
|
+
control: { type: 'radio' },
|
|
61
|
+
options: ['light', 'dark'],
|
|
62
|
+
},
|
|
63
|
+
caption: {
|
|
64
|
+
control: { type: 'text' },
|
|
65
|
+
},
|
|
66
|
+
caption_position: {
|
|
67
|
+
control: { type: 'radio' },
|
|
68
|
+
options: ['before', 'after'],
|
|
69
|
+
},
|
|
70
|
+
header: {
|
|
71
|
+
control: { type: 'array' },
|
|
72
|
+
},
|
|
73
|
+
rows: {
|
|
74
|
+
control: { type: 'array' },
|
|
75
|
+
},
|
|
76
|
+
footer: {
|
|
77
|
+
control: { type: 'array' },
|
|
78
|
+
},
|
|
79
|
+
is_striped: {
|
|
80
|
+
control: { type: 'boolean' },
|
|
81
|
+
},
|
|
82
|
+
is_data_table: {
|
|
83
|
+
control: { type: 'boolean' },
|
|
84
|
+
},
|
|
85
|
+
modifier_class: {
|
|
86
|
+
control: { type: 'text' },
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
export default meta;
|
|
92
|
+
|
|
93
|
+
export const Table = {
|
|
94
|
+
parameters: {
|
|
95
|
+
layout: 'centered',
|
|
96
|
+
},
|
|
97
|
+
args: {
|
|
98
|
+
theme: 'light',
|
|
99
|
+
caption: 'Table caption',
|
|
100
|
+
caption_position: 'before',
|
|
101
|
+
header: [
|
|
102
|
+
'Header 1',
|
|
103
|
+
'<span>Header 2</span>',
|
|
104
|
+
'<span class="demo-class">Header 3</span>',
|
|
105
|
+
'<span class="ct-visually-hidden">Header 4</span>',
|
|
106
|
+
],
|
|
107
|
+
header_sanitized: [
|
|
108
|
+
'Header 1',
|
|
109
|
+
'Header 2',
|
|
110
|
+
'Header 3',
|
|
111
|
+
'Header 4',
|
|
112
|
+
],
|
|
113
|
+
rows: getRows('light'),
|
|
114
|
+
footer: [
|
|
115
|
+
'Footer 1',
|
|
116
|
+
'Footer 2',
|
|
117
|
+
'Footer 3',
|
|
118
|
+
'Footer 4',
|
|
119
|
+
],
|
|
120
|
+
is_striped: '',
|
|
121
|
+
is_data_table: '',
|
|
122
|
+
attributes: null,
|
|
123
|
+
modifier_class: '',
|
|
124
|
+
},
|
|
125
|
+
render: (args) => Component({
|
|
126
|
+
...args,
|
|
127
|
+
rows: getRows(args.theme),
|
|
128
|
+
}),
|
|
129
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import DrupalAttribute from 'drupal-attribute';
|
|
2
|
+
|
|
3
|
+
const template = 'components/01-atoms/table/table.twig';
|
|
4
|
+
|
|
5
|
+
describe('Table Component', () => {
|
|
6
|
+
test('renders with required attributes', async () => {
|
|
7
|
+
const c = await dom(template, {
|
|
8
|
+
rows: [
|
|
9
|
+
['Row 1, Col 1', 'Row 1, Col 2'],
|
|
10
|
+
['Row 2, Col 1', 'Row 2, Col 2'],
|
|
11
|
+
],
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
expect(c.querySelectorAll('.ct-table')).toHaveLength(1);
|
|
15
|
+
expect(c.querySelectorAll('tbody tr')).toHaveLength(2);
|
|
16
|
+
expect(c.querySelector('tbody tr').textContent.trim()).toContain('Row 1, Col 1');
|
|
17
|
+
expect(c.querySelector('tbody tr').textContent.trim()).toContain('Row 1, Col 2');
|
|
18
|
+
|
|
19
|
+
assertUniqueCssClasses(c);
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
test('renders with optional attributes', async () => {
|
|
23
|
+
const c = await dom(template, {
|
|
24
|
+
caption: 'Sample Table Caption',
|
|
25
|
+
caption_position: 'after',
|
|
26
|
+
header: ['Header 1', 'Header 2'],
|
|
27
|
+
rows: [
|
|
28
|
+
['Row 1, Col 1', 'Row 1, Col 2'],
|
|
29
|
+
['Row 2, Col 1', 'Row 2, Col 2'],
|
|
30
|
+
],
|
|
31
|
+
footer: ['Footer 1', 'Footer 2'],
|
|
32
|
+
is_striped: true,
|
|
33
|
+
attributes: new DrupalAttribute().setAttribute('data-test', 'true'),
|
|
34
|
+
modifier_class: 'custom-class',
|
|
35
|
+
theme: 'dark',
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
expect(c.querySelectorAll('.ct-table.custom-class.ct-theme-dark.ct-table--caption-after.ct-table--striped')).toHaveLength(1);
|
|
39
|
+
expect(c.querySelector('caption').textContent.trim()).toEqual('Sample Table Caption');
|
|
40
|
+
expect(c.querySelectorAll('thead tr th')).toHaveLength(2);
|
|
41
|
+
expect(c.querySelector('thead tr th').textContent.trim()).toContain('Header 1');
|
|
42
|
+
expect(c.querySelectorAll('tbody tr')).toHaveLength(2);
|
|
43
|
+
expect(c.querySelector('tbody tr').textContent.trim()).toContain('Row 1, Col 1');
|
|
44
|
+
expect(c.querySelector('tfoot tr th').textContent.trim()).toContain('Footer 1');
|
|
45
|
+
expect(c.querySelector('.ct-table').getAttribute('data-test')).toEqual('true');
|
|
46
|
+
|
|
47
|
+
assertUniqueCssClasses(c);
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
test('does not render when all content arrays are empty', async () => {
|
|
51
|
+
const c = await dom(template, {
|
|
52
|
+
rows: [],
|
|
53
|
+
header: [],
|
|
54
|
+
footer: [],
|
|
55
|
+
caption: '',
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
expect(c.querySelectorAll('.ct-table')).toHaveLength(0);
|
|
59
|
+
});
|
|
60
|
+
});
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
{#
|
|
2
|
+
/**
|
|
3
|
+
* @file
|
|
4
|
+
* CivicTheme Table component.
|
|
5
|
+
*
|
|
6
|
+
* Props:
|
|
7
|
+
* - theme: [string] Theme variation (light or dark).
|
|
8
|
+
* - caption: [string,null] Table caption.
|
|
9
|
+
* - caption_position: [string] Caption position (before, after).
|
|
10
|
+
* - header: [array] Header cells.
|
|
11
|
+
* Each item contains:
|
|
12
|
+
* - items [string,null,integer,object]
|
|
13
|
+
* - header_sanitized: [array] Provide no-HTML header column names. Used for mobile header labels.
|
|
14
|
+
* Each item contains:
|
|
15
|
+
* - items [string,null,integer,object]
|
|
16
|
+
* - rows: [array] Table rows.
|
|
17
|
+
* Each item contains:
|
|
18
|
+
* [any] items
|
|
19
|
+
* - footer: [array] Footer cells.
|
|
20
|
+
* Each item contains:
|
|
21
|
+
* - items [string,null,integer,object]
|
|
22
|
+
* - is_striped: [boolean,null] Whether to show table with striped rows.
|
|
23
|
+
* - is_data_table: [boolean,null] Whether to show as a data table.
|
|
24
|
+
* - modifier_class: [string] Additional CSS classes.
|
|
25
|
+
* - attributes: [Drupal\Core\Template\Attribute] Additional HTML attributes.
|
|
26
|
+
*/
|
|
27
|
+
#}
|
|
28
|
+
|
|
29
|
+
{% set striped_class = is_striped ? 'ct-table--%s'|format('striped') : '' %}
|
|
30
|
+
{% set data_table_class = is_data_table ? 'ct-table--%s'|format('data') : '' %}
|
|
31
|
+
{% set caption_position_class = caption_position == 'after' ? 'ct-table--caption-after' : 'ct-table--caption-before' %}
|
|
32
|
+
{% set theme_class = 'ct-theme-%s'|format(theme|default('light')) %}
|
|
33
|
+
{% set modifier_class = '%s %s %s %s %s'|format(theme_class, caption_position_class, striped_class, data_table_class, modifier_class|default('')) %}
|
|
34
|
+
|
|
35
|
+
{% if rows is not empty or header is not empty or footer is not empty or caption is not empty %}
|
|
36
|
+
<table class="ct-table {{ modifier_class -}}" {% if attributes is defined and attributes is not null %}{{- attributes -}}{% endif %}>
|
|
37
|
+
{% if caption %}
|
|
38
|
+
<caption>{{ caption }}</caption>
|
|
39
|
+
{% endif %}
|
|
40
|
+
|
|
41
|
+
{% if header is not empty %}
|
|
42
|
+
<thead>
|
|
43
|
+
<tr>
|
|
44
|
+
{% for item in header %}
|
|
45
|
+
<th scope="col">{{ item }}</th>
|
|
46
|
+
{% endfor %}
|
|
47
|
+
</tr>
|
|
48
|
+
</thead>
|
|
49
|
+
{% endif %}
|
|
50
|
+
|
|
51
|
+
{% if rows is not empty %}
|
|
52
|
+
<tbody>
|
|
53
|
+
{% for row in rows %}
|
|
54
|
+
<tr {{ create_attribute(row.attributes|default({})) }}>
|
|
55
|
+
{% for col in row.cols|default(row) %}
|
|
56
|
+
{% if header is not empty %}
|
|
57
|
+
{% if header_sanitized is not empty and header_sanitized[loop.index0] is defined %}
|
|
58
|
+
{% set data_title = header_sanitized[loop.index0] %}
|
|
59
|
+
{% else %}
|
|
60
|
+
{% set data_title = header[loop.index0] is defined ? header[loop.index0] : '' %}
|
|
61
|
+
{% endif %}
|
|
62
|
+
{% endif %}
|
|
63
|
+
<td {{ create_attribute(col.attributes|default({})) }}{% if data_title is defined %} data-title="{{ data_title|striptags }}"{% endif %}>
|
|
64
|
+
{{ col.content|default(col) }}
|
|
65
|
+
</td>
|
|
66
|
+
{% endfor %}
|
|
67
|
+
</tr>
|
|
68
|
+
{% endfor %}
|
|
69
|
+
</tbody>
|
|
70
|
+
{% endif %}
|
|
71
|
+
|
|
72
|
+
{% if footer is not empty %}
|
|
73
|
+
<tfoot>
|
|
74
|
+
{% if footer[0] is defined and footer[0].cols is defined %}
|
|
75
|
+
{# Drupal format: footer is list of rows with .attributes and .cols #}
|
|
76
|
+
{% for row in footer %}
|
|
77
|
+
<tr {{ create_attribute(row.attributes|default({})) }}>
|
|
78
|
+
{% for col in row.cols %}
|
|
79
|
+
<th {{ create_attribute(col.attributes|default({})) }}>{{ col.content|default(col) }}</th>
|
|
80
|
+
{% endfor %}
|
|
81
|
+
</tr>
|
|
82
|
+
{% endfor %}
|
|
83
|
+
{% else %}
|
|
84
|
+
{# Legacy format: single row (footer = [cell, cell]) or multiple rows (footer = [[cell, cell], ...]) #}
|
|
85
|
+
{% if footer[0] is defined and footer[0] is iterable %}
|
|
86
|
+
{% for row in footer %}
|
|
87
|
+
<tr>
|
|
88
|
+
{% for col in row %}
|
|
89
|
+
<th>{{ col }}</th>
|
|
90
|
+
{% endfor %}
|
|
91
|
+
</tr>
|
|
92
|
+
{% endfor %}
|
|
93
|
+
{% else %}
|
|
94
|
+
<tr>
|
|
95
|
+
{% for item in footer %}
|
|
96
|
+
<th scope="col">{{ item }}</th>
|
|
97
|
+
{% endfor %}
|
|
98
|
+
</tr>
|
|
99
|
+
{% endif %}
|
|
100
|
+
{% endif %}
|
|
101
|
+
</tfoot>
|
|
102
|
+
{% endif %}
|
|
103
|
+
</table>
|
|
104
|
+
{% endif %}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
+
|
|
3
|
+
exports[`Tag Component does not render when content is empty 1`] = `
|
|
4
|
+
<div>
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
</div>
|
|
9
|
+
`;
|
|
10
|
+
|
|
11
|
+
exports[`Tag Component renders with optional attributes 1`] = `
|
|
12
|
+
<div>
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
<a
|
|
20
|
+
aria-label="Opens in a new tab"
|
|
21
|
+
class="ct-tag ct-theme-dark ct-tag--secondary ct-tag--with-icon ct-tag--icon-before ct-tag--external custom-class"
|
|
22
|
+
data-test="true"
|
|
23
|
+
href="https://example.com"
|
|
24
|
+
target="_blank"
|
|
25
|
+
title="Sample Tag"
|
|
26
|
+
>
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
<svg
|
|
30
|
+
aria-hidden="true"
|
|
31
|
+
class="ct-icon ct-tag__icon"
|
|
32
|
+
height="24"
|
|
33
|
+
role="img"
|
|
34
|
+
viewBox="0 0 24 24"
|
|
35
|
+
width="24"
|
|
36
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
37
|
+
>
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
<path
|
|
41
|
+
d="M19.4097 13C19.1897 13 18.9597 12.93 18.7397 12.88C18.2945 12.7805 17.8568 12.6501 17.4297 12.49C16.9658 12.3212 16.4558 12.33 15.998 12.5146C15.5402 12.6992 15.1668 13.0466 14.9497 13.49L14.7297 13.95C13.7585 13.3992 12.8613 12.7271 12.0597 11.95C11.2825 11.1484 10.6105 10.2512 10.0597 9.28L10.5197 9.07C10.963 8.85292 11.3105 8.47953 11.4951 8.02169C11.6797 7.56385 11.6885 7.05391 11.5197 6.59C11.3609 6.15903 11.2306 5.71808 11.1297 5.27C11.0797 5.05 11.0397 4.82 11.0097 4.6C10.8882 3.89562 10.5193 3.25774 9.96931 2.80124C9.4193 2.34474 8.72438 2.09961 8.00968 2.11H4.99968C4.57693 2.10945 4.15883 2.19825 3.7728 2.37058C3.38677 2.54292 3.04152 2.7949 2.75968 3.11C2.472 3.43365 2.2578 3.81575 2.13179 4.23004C2.00577 4.64432 1.97094 5.08098 2.02968 5.51C2.57327 9.67214 4.47489 13.5387 7.43968 16.51C10.411 19.4748 14.2775 21.3764 18.4397 21.92C18.5695 21.9299 18.6999 21.9299 18.8297 21.92C19.5671 21.9211 20.2791 21.6505 20.8297 21.16C21.1448 20.8782 21.3968 20.5329 21.5691 20.1469C21.7414 19.7609 21.8302 19.3428 21.8297 18.92V15.92C21.8243 15.229 21.5805 14.5611 21.1396 14.0291C20.6987 13.4971 20.0876 13.1336 19.4097 13ZM19.8997 19C19.8994 19.1395 19.8698 19.2775 19.813 19.4049C19.7562 19.5324 19.6733 19.6465 19.5697 19.74C19.4601 19.8399 19.3297 19.9141 19.1878 19.9573C19.046 20.0006 18.8963 20.0117 18.7497 19.99C15.018 19.5026 11.5499 17.802 8.87968 15.15C6.20716 12.4775 4.49171 8.99737 3.99968 5.25C3.97796 5.10333 3.98912 4.95367 4.03236 4.81185C4.0756 4.67003 4.14983 4.5396 4.24968 4.43C4.3443 4.32515 4.46006 4.24154 4.58933 4.18466C4.7186 4.12778 4.85846 4.09892 4.99968 4.1H7.99968C8.23085 4.09435 8.45682 4.16898 8.63915 4.3112C8.82147 4.45341 8.94888 4.65442 8.99968 4.88C8.99968 5.15 9.08968 5.43 9.14968 5.7C9.26526 6.22386 9.419 6.73857 9.60968 7.24L8.20968 7.9C7.96905 8.01046 7.78204 8.21185 7.68968 8.46C7.58967 8.70346 7.58967 8.97654 7.68968 9.22C9.12888 12.3028 11.6069 14.7808 14.6897 16.22C14.9331 16.32 15.2062 16.32 15.4497 16.22C15.6978 16.1276 15.8992 15.9406 16.0097 15.7L16.6397 14.3C17.1556 14.4881 17.6834 14.6418 18.2197 14.76C18.4797 14.82 18.7597 14.87 19.0297 14.91C19.2553 14.9608 19.4563 15.0882 19.5985 15.2705C19.7407 15.4529 19.8153 15.6788 19.8097 15.91L19.8997 19ZM13.9997 2C13.7697 2 13.5297 2 13.2997 2C13.0345 2.02254 12.7891 2.14952 12.6175 2.353C12.4459 2.55647 12.3621 2.81978 12.3847 3.085C12.4072 3.35022 12.5342 3.59562 12.7377 3.76721C12.9412 3.93881 13.2045 4.02254 13.4697 4H13.9997C15.591 4 17.1171 4.63214 18.2423 5.75736C19.3675 6.88258 19.9997 8.4087 19.9997 10C19.9997 10.18 19.9997 10.35 19.9997 10.53C19.9775 10.7938 20.0609 11.0556 20.2314 11.2581C20.402 11.4606 20.6459 11.5871 20.9097 11.61H20.9897C21.24 11.611 21.4816 11.5181 21.6668 11.3496C21.8519 11.1811 21.9672 10.9493 21.9897 10.7C21.9897 10.47 21.9897 10.23 21.9897 10C21.9897 7.88 21.1482 5.84668 19.6501 4.34668C18.1519 2.84667 16.1197 2.00265 13.9997 2ZM15.9997 10C15.9997 10.2652 16.105 10.5196 16.2926 10.7071C16.4801 10.8946 16.7345 11 16.9997 11C17.2649 11 17.5193 10.8946 17.7068 10.7071C17.8943 10.5196 17.9997 10.2652 17.9997 10C17.9997 8.93913 17.5783 7.92172 16.8281 7.17157C16.078 6.42143 15.0605 6 13.9997 6C13.7345 6 13.4801 6.10536 13.2926 6.29289C13.105 6.48043 12.9997 6.73478 12.9997 7C12.9997 7.26522 13.105 7.51957 13.2926 7.70711C13.4801 7.89464 13.7345 8 13.9997 8C14.5301 8 15.0388 8.21071 15.4139 8.58579C15.789 8.96086 15.9997 9.46957 15.9997 10Z"
|
|
42
|
+
/>
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
</svg>
|
|
46
|
+
|
|
47
|
+
Sample Tag
|
|
48
|
+
|
|
49
|
+
<span
|
|
50
|
+
class="ct-visually-hidden"
|
|
51
|
+
>
|
|
52
|
+
(Opens in a new tab/window)
|
|
53
|
+
</span>
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
<svg
|
|
57
|
+
aria-hidden="true"
|
|
58
|
+
class="ct-icon"
|
|
59
|
+
height="24"
|
|
60
|
+
role="img"
|
|
61
|
+
viewBox="0 0 24 24"
|
|
62
|
+
width="24"
|
|
63
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
64
|
+
>
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
<path
|
|
68
|
+
d="M17.9199 6.62C17.8185 6.37565 17.6243 6.18147 17.3799 6.08C17.2597 6.02876 17.1306 6.00158 16.9999 6H6.99994C6.73472 6 6.48037 6.10536 6.29283 6.29289C6.1053 6.48043 5.99994 6.73478 5.99994 7C5.99994 7.26522 6.1053 7.51957 6.29283 7.70711C6.48037 7.89464 6.73472 8 6.99994 8H14.5899L6.28994 16.29C6.19621 16.383 6.12182 16.4936 6.07105 16.6154C6.02028 16.7373 5.99414 16.868 5.99414 17C5.99414 17.132 6.02028 17.2627 6.07105 17.3846C6.12182 17.5064 6.19621 17.617 6.28994 17.71C6.3829 17.8037 6.4935 17.8781 6.61536 17.9289C6.73722 17.9797 6.86793 18.0058 6.99994 18.0058C7.13195 18.0058 7.26266 17.9797 7.38452 17.9289C7.50638 17.8781 7.61698 17.8037 7.70994 17.71L15.9999 9.41V17C15.9999 17.2652 16.1053 17.5196 16.2928 17.7071C16.4804 17.8946 16.7347 18 16.9999 18C17.2652 18 17.5195 17.8946 17.707 17.7071C17.8946 17.5196 17.9999 17.2652 17.9999 17V7C17.9984 6.86932 17.9712 6.74022 17.9199 6.62Z"
|
|
69
|
+
/>
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
</svg>
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
</a>
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
</div>
|
|
79
|
+
`;
|
|
80
|
+
|
|
81
|
+
exports[`Tag Component renders with required attributes 1`] = `
|
|
82
|
+
<div>
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
<span
|
|
90
|
+
class="ct-tag ct-theme-light ct-tag--primary "
|
|
91
|
+
>
|
|
92
|
+
Sample Tag
|
|
93
|
+
</span>
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
</div>
|
|
97
|
+
`;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
//
|
|
2
|
+
// CivicTheme Tag component styles.
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
.ct-tag {
|
|
6
|
+
$root: &;
|
|
7
|
+
|
|
8
|
+
border-radius: var(--ct-tag-border-radius);
|
|
9
|
+
border-style: solid;
|
|
10
|
+
border-width: var(--ct-tag-border-width);
|
|
11
|
+
display: inline-block;
|
|
12
|
+
|
|
13
|
+
@include ct-typography('label-extra-small');
|
|
14
|
+
@include ct-link-no-decoration();
|
|
15
|
+
|
|
16
|
+
&--icon-before {
|
|
17
|
+
.ct-icon {
|
|
18
|
+
@include ct-icon-size('small');
|
|
19
|
+
|
|
20
|
+
& {
|
|
21
|
+
margin-right: ct-spacing(0.25);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
&--icon-after {
|
|
27
|
+
.ct-icon {
|
|
28
|
+
@include ct-icon-size('small');
|
|
29
|
+
|
|
30
|
+
& {
|
|
31
|
+
margin-left: ct-spacing(0.25);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
&#{$root}--primary {
|
|
37
|
+
padding: ct-spacing(0.5) ct-spacing();
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
&#{$root}--secondary {
|
|
41
|
+
padding: ct-spacing(0.5) ct-spacing();
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
@include ct-component-theme($root) using($root, $theme) {
|
|
45
|
+
&#{$root}--primary {
|
|
46
|
+
@include ct-component-property($root, $theme, primary, background-color);
|
|
47
|
+
@include ct-component-property($root, $theme, primary, border-color);
|
|
48
|
+
@include ct-component-property($root, $theme, primary, color);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
&#{$root}--secondary {
|
|
52
|
+
@include ct-component-property($root, $theme, secondary, background-color);
|
|
53
|
+
@include ct-component-property($root, $theme, secondary, border-color);
|
|
54
|
+
@include ct-component-property($root, $theme, secondary, color);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
&#{$root}--tertiary {
|
|
58
|
+
@include ct-component-property($root, $theme, tertiary, background-color);
|
|
59
|
+
@include ct-component-property($root, $theme, tertiary, border-color);
|
|
60
|
+
@include ct-component-property($root, $theme, tertiary, color);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CivicTheme Tag component stories.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import Component from './tag.twig';
|
|
6
|
+
import Constants from '../../../dist/constants.json';
|
|
7
|
+
|
|
8
|
+
const meta = {
|
|
9
|
+
title: 'Atoms/Tag',
|
|
10
|
+
component: Component,
|
|
11
|
+
argTypes: {
|
|
12
|
+
theme: {
|
|
13
|
+
control: { type: 'radio' },
|
|
14
|
+
options: ['light', 'dark'],
|
|
15
|
+
},
|
|
16
|
+
type: {
|
|
17
|
+
control: { type: 'radio' },
|
|
18
|
+
options: ['primary', 'secondary', 'tertiary'],
|
|
19
|
+
},
|
|
20
|
+
content: {
|
|
21
|
+
control: { type: 'text' },
|
|
22
|
+
},
|
|
23
|
+
icon: {
|
|
24
|
+
control: { type: 'select' },
|
|
25
|
+
options: Constants.ICONS,
|
|
26
|
+
},
|
|
27
|
+
icon_placement: {
|
|
28
|
+
control: { type: 'radio' },
|
|
29
|
+
options: ['before', 'after'],
|
|
30
|
+
},
|
|
31
|
+
modifier_class: {
|
|
32
|
+
control: { type: 'text' },
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export default meta;
|
|
38
|
+
|
|
39
|
+
export const Tag = {
|
|
40
|
+
parameters: {
|
|
41
|
+
layout: 'centered',
|
|
42
|
+
},
|
|
43
|
+
args: {
|
|
44
|
+
theme: 'light',
|
|
45
|
+
type: 'primary',
|
|
46
|
+
content: 'Tag content',
|
|
47
|
+
icon: '',
|
|
48
|
+
icon_placement: 'before',
|
|
49
|
+
url: 'https://www.example.com',
|
|
50
|
+
is_new_window: false,
|
|
51
|
+
is_external: false,
|
|
52
|
+
attributes: null,
|
|
53
|
+
modifier_class: '',
|
|
54
|
+
},
|
|
55
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import DrupalAttribute from 'drupal-attribute';
|
|
2
|
+
|
|
3
|
+
const template = 'components/01-atoms/tag/tag.twig';
|
|
4
|
+
|
|
5
|
+
describe('Tag Component', () => {
|
|
6
|
+
test('renders with required attributes', async () => {
|
|
7
|
+
const c = await dom(template, {
|
|
8
|
+
content: 'Sample Tag',
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
expect(c.querySelectorAll('.ct-tag')).toHaveLength(1);
|
|
12
|
+
expect(c.querySelector('.ct-tag').textContent.trim()).toEqual('Sample Tag');
|
|
13
|
+
|
|
14
|
+
assertUniqueCssClasses(c);
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
test('renders with optional attributes', async () => {
|
|
18
|
+
const c = await dom(template, {
|
|
19
|
+
content: 'Sample Tag',
|
|
20
|
+
type: 'secondary',
|
|
21
|
+
icon: 'call',
|
|
22
|
+
icon_placement: 'before',
|
|
23
|
+
url: 'https://example.com',
|
|
24
|
+
is_new_window: true,
|
|
25
|
+
is_external: true,
|
|
26
|
+
attributes: new DrupalAttribute().setAttribute('data-test', 'true'),
|
|
27
|
+
modifier_class: 'custom-class',
|
|
28
|
+
theme: 'dark',
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
expect(c.querySelectorAll('.ct-tag.custom-class.ct-theme-dark.ct-tag--secondary.ct-tag--with-icon.ct-tag--icon-before.ct-tag--external')).toHaveLength(1);
|
|
32
|
+
expect(c.querySelector('.ct-tag').textContent.trim()).toContain('Sample Tag');
|
|
33
|
+
expect(c.querySelector('.ct-tag').getAttribute('href')).toEqual('https://example.com');
|
|
34
|
+
expect(c.querySelector('.ct-tag').getAttribute('target')).toEqual('_blank');
|
|
35
|
+
expect(c.querySelector('.ct-tag').getAttribute('aria-label')).toEqual('Opens in a new tab');
|
|
36
|
+
expect(c.querySelector('.ct-tag').getAttribute('data-test')).toEqual('true');
|
|
37
|
+
expect(c.querySelector('.ct-tag .ct-tag__icon')).toBeTruthy();
|
|
38
|
+
|
|
39
|
+
assertUniqueCssClasses(c);
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
test('does not render when content is empty', async () => {
|
|
43
|
+
const c = await dom(template, {
|
|
44
|
+
content: '',
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
expect(c.querySelectorAll('.ct-tag')).toHaveLength(0);
|
|
48
|
+
});
|
|
49
|
+
});
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
{#
|
|
2
|
+
/**
|
|
3
|
+
* @file
|
|
4
|
+
* CivicTheme Tag component.
|
|
5
|
+
*
|
|
6
|
+
* Props:
|
|
7
|
+
* - theme: [string] Theme variation (light or dark).
|
|
8
|
+
* - type: [string] Tag type (primary, secondary, tertiary).
|
|
9
|
+
* - content: [string] Tag content.
|
|
10
|
+
* - icon: [string,null] Icon name.
|
|
11
|
+
* - icon_placement: [string] Icon position (before, after).
|
|
12
|
+
* - url: [string] Optional URL to convert to a link.
|
|
13
|
+
* - is_new_window: [boolean] Whether to open in a new window (only if URL is provided).
|
|
14
|
+
* - is_external: [boolean] Whether the link is external.
|
|
15
|
+
* - modifier_class: [string] Additional CSS classes.
|
|
16
|
+
* - attributes: [Drupal\Core\Template\Attribute] Additional HTML attributes.
|
|
17
|
+
*/
|
|
18
|
+
#}
|
|
19
|
+
|
|
20
|
+
{% set type = type in ['primary', 'secondary', 'tertiary'] ? type : 'primary' %}
|
|
21
|
+
{% set type_class = 'ct-tag--%s'|format(type) %}
|
|
22
|
+
{% set icon_class = icon is not empty ? 'ct-tag--with-icon' : '' %}
|
|
23
|
+
{% set icon_placement = icon_placement in ['before', 'after'] ? icon_placement : 'after' %}
|
|
24
|
+
{% set icon_placement_class = icon ? 'ct-tag--icon-%s'|format(icon_placement|default('before')) : '' %}
|
|
25
|
+
{% set is_external = is_external ? 'ct-tag--external' : '' %}
|
|
26
|
+
{% set theme_class = 'ct-theme-%s'|format(theme|default('light')) %}
|
|
27
|
+
{% set modifier_class = '%s %s %s %s %s %s'|format(theme_class, type_class, icon_class, icon_placement_class, is_external, modifier_class|default('')) %}
|
|
28
|
+
|
|
29
|
+
{% if content|trim is not empty %}
|
|
30
|
+
{% set content_markup %}
|
|
31
|
+
{% if icon %}
|
|
32
|
+
{% set icon_markup %}
|
|
33
|
+
{% include '@base/icon/icon.twig' with {
|
|
34
|
+
symbol: icon,
|
|
35
|
+
modifier_class: 'ct-tag__icon',
|
|
36
|
+
} only %}
|
|
37
|
+
{% endset %}
|
|
38
|
+
|
|
39
|
+
{% if icon_placement == 'before' %}
|
|
40
|
+
{{- icon_markup -}}{{- content -}}
|
|
41
|
+
{% else %}
|
|
42
|
+
{{- content -}}{{- icon_markup -}}
|
|
43
|
+
{% endif %}
|
|
44
|
+
|
|
45
|
+
{% else %}
|
|
46
|
+
{{- content -}}
|
|
47
|
+
{% endif %}
|
|
48
|
+
{% endset %}
|
|
49
|
+
|
|
50
|
+
{% if is_new_window %}
|
|
51
|
+
{% set is_new_window_content %}
|
|
52
|
+
<span class="ct-visually-hidden">(Opens in a new tab/window)</span>
|
|
53
|
+
{% endset %}
|
|
54
|
+
{% endif %}
|
|
55
|
+
|
|
56
|
+
{% if is_external %}
|
|
57
|
+
{% set is_external_content %}
|
|
58
|
+
{% include '@base/icon/icon.twig' with {
|
|
59
|
+
symbol: 'upper-right-arrow',
|
|
60
|
+
} only %}
|
|
61
|
+
{% endset %}
|
|
62
|
+
{% endif %}
|
|
63
|
+
|
|
64
|
+
{% set tag = url is not empty ? 'a' : 'span' %}
|
|
65
|
+
<{{ tag }}
|
|
66
|
+
class="ct-tag {{ modifier_class -}}"
|
|
67
|
+
{% if url is not empty %}href="{{ url }}"{% endif %}
|
|
68
|
+
{% if url is not empty %}title="{{- content -}}"{% endif %}
|
|
69
|
+
{% if url is not empty and is_new_window %}target="_blank" aria-label="Opens in a new tab"{% endif %}
|
|
70
|
+
{% if attributes is defined and attributes is not null %}{{- attributes -}}{% endif %}
|
|
71
|
+
>
|
|
72
|
+
{{- content_markup -}}{{- is_new_window_content -}}{{- is_external_content -}}
|
|
73
|
+
</{{ tag }}>
|
|
74
|
+
{% endif %}
|