@content-blocks/js 0.7.1 → 0.7.2
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/dist/cjs/content-accordion_11.cjs.entry.js +45 -1545
- package/dist/cjs/content-accordion_11.cjs.entry.js.map +1 -1
- package/dist/cjs/content-blocks.cjs.js +1 -1
- package/dist/cjs/content-carousel.cjs.entry.js +6 -5
- package/dist/cjs/content-carousel.cjs.entry.js.map +1 -1
- package/dist/cjs/content-navigation-block.cjs.entry.js +41 -24
- package/dist/cjs/content-navigation-block.cjs.entry.js.map +1 -1
- package/dist/cjs/focus-trap.esm-a1e3774c.js +1509 -0
- package/dist/cjs/focus-trap.esm-a1e3774c.js.map +1 -0
- package/dist/cjs/index-f38d389e.js +5224 -0
- package/dist/cjs/index-f38d389e.js.map +1 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{swiper-4fade542.js → swiper-e5a68ae2.js} +68 -469
- package/dist/cjs/swiper-e5a68ae2.js.map +1 -0
- package/dist/cjs/utils-c04e978e.js +457 -0
- package/dist/cjs/utils-c04e978e.js.map +1 -0
- package/dist/cjs/window-resize-service-ac5c2012.js.map +1 -1
- package/dist/collection/components/content-carousel/content-carousel.js +5 -4
- package/dist/collection/components/content-carousel/content-carousel.js.map +1 -1
- package/dist/collection/components/content-navigation-block/content-navigation-block.css +55 -13
- package/dist/collection/components/content-navigation-block/content-navigation-block.js +51 -24
- package/dist/collection/components/content-navigation-block/content-navigation-block.js.map +1 -1
- package/dist/collection/components/content-overlay/content-overlay.css +11 -6
- package/dist/collection/components/content-overlay/content-overlay.js +69 -34
- package/dist/collection/components/content-overlay/content-overlay.js.map +1 -1
- package/dist/collection/elements/content-image/content-image.js +4 -4
- package/dist/collection/elements/content-image/content-image.js.map +1 -1
- package/dist/collection/formatters/content-grid-formatter/content-grid-formatter.css +4 -3
- package/dist/collection/formatters/content-grid-formatter/content-grid-formatter.js +37 -0
- package/dist/collection/formatters/content-grid-formatter/content-grid-formatter.js.map +1 -1
- package/dist/collection/formatters/content-spacer/content-spacer.css +3 -4
- package/dist/collection/formatters/content-spacer/content-spacer.js +13 -5
- package/dist/collection/formatters/content-spacer/content-spacer.js.map +1 -1
- package/dist/collection/services/window-resize-service.js.map +1 -1
- package/dist/collection/stories/ContentNavigationBlock.stories.js +1 -1
- package/dist/collection/stories/ContentNavigationBlock.stories.js.map +1 -1
- package/dist/collection/stories/ContentTextBlock.stories.js +5 -5
- package/dist/collection/stories/ContentTextBlock.stories.js.map +1 -1
- package/dist/collection/stories/FullPageExample.stories.js +164 -214
- package/dist/collection/stories/FullPageExample.stories.js.map +1 -1
- package/dist/components/content-carousel.js +5 -4
- package/dist/components/content-carousel.js.map +1 -1
- package/dist/components/content-grid-formatter2.js +9 -1
- package/dist/components/content-grid-formatter2.js.map +1 -1
- package/dist/components/content-image.js +4 -4
- package/dist/components/content-image.js.map +1 -1
- package/dist/components/content-navigation-block.js +48 -25
- package/dist/components/content-navigation-block.js.map +1 -1
- package/dist/components/content-overlay.js +32 -1538
- package/dist/components/content-overlay.js.map +1 -1
- package/dist/components/content-spacer.js +3 -3
- package/dist/components/content-spacer.js.map +1 -1
- package/dist/components/focus-trap.esm.js +1507 -0
- package/dist/components/focus-trap.esm.js.map +1 -0
- package/dist/components/index2.js +5200 -0
- package/dist/components/index2.js.map +1 -0
- package/dist/components/swiper.js +1 -402
- package/dist/components/swiper.js.map +1 -1
- package/dist/components/utils2.js +433 -0
- package/dist/components/utils2.js.map +1 -0
- package/dist/components/window-resize-service.js.map +1 -1
- package/dist/content-blocks/content-blocks.esm.js +1 -1
- package/dist/content-blocks/content-blocks.esm.js.map +1 -1
- package/dist/content-blocks/p-75ac85e9.js +2 -0
- package/dist/content-blocks/p-75ac85e9.js.map +1 -0
- package/dist/content-blocks/p-7ff352fe.entry.js +2 -0
- package/dist/content-blocks/p-7ff352fe.entry.js.map +1 -0
- package/dist/content-blocks/p-878dc806.js +10 -0
- package/dist/content-blocks/p-878dc806.js.map +1 -0
- package/dist/content-blocks/p-97c4ca9d.js +2 -0
- package/dist/content-blocks/p-97c4ca9d.js.map +1 -0
- package/dist/content-blocks/{p-271fb304.entry.js → p-cbc1dd73.entry.js} +2 -2
- package/dist/content-blocks/p-cbc1dd73.entry.js.map +1 -0
- package/dist/content-blocks/p-cfb4593f.js.map +1 -1
- package/dist/content-blocks/p-e2907508.js +2 -0
- package/dist/content-blocks/p-e2907508.js.map +1 -0
- package/dist/content-blocks/p-ef45f146.entry.js +2 -0
- package/dist/content-blocks/p-ef45f146.entry.js.map +1 -0
- package/dist/esm/content-accordion_11.entry.js +45 -1545
- package/dist/esm/content-accordion_11.entry.js.map +1 -1
- package/dist/esm/content-blocks.js +1 -1
- package/dist/esm/content-carousel.entry.js +6 -5
- package/dist/esm/content-carousel.entry.js.map +1 -1
- package/dist/esm/content-navigation-block.entry.js +41 -24
- package/dist/esm/content-navigation-block.entry.js.map +1 -1
- package/dist/esm/focus-trap.esm-49c9613c.js +1507 -0
- package/dist/esm/focus-trap.esm-49c9613c.js.map +1 -0
- package/dist/esm/index-d9f353de.js +5200 -0
- package/dist/esm/index-d9f353de.js.map +1 -0
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{swiper-3e7be625.js → swiper-3394f7fd.js} +2 -403
- package/dist/esm/swiper-3394f7fd.js.map +1 -0
- package/dist/esm/utils-075121ec.js +433 -0
- package/dist/esm/utils-075121ec.js.map +1 -0
- package/dist/esm/window-resize-service-f40ec51c.js.map +1 -1
- package/dist/types/components/content-carousel/content-carousel.d.ts +3 -3
- package/dist/types/components/content-navigation-block/content-navigation-block.d.ts +11 -0
- package/dist/types/components/content-overlay/content-overlay.d.ts +9 -0
- package/dist/types/components.d.ts +34 -2
- package/dist/types/formatters/content-grid-formatter/content-grid-formatter.d.ts +8 -1
- package/dist/types/formatters/content-spacer/content-spacer.d.ts +2 -1
- package/dist/types/stories/ContentNavigationBlock.stories.d.ts +1 -3
- package/dist/types/stories/ContentTextBlock.stories.d.ts +1 -7
- package/package.json +2 -2
- package/dist/cjs/swiper-4fade542.js.map +0 -1
- package/dist/content-blocks/p-10819bfa.js +0 -2
- package/dist/content-blocks/p-10819bfa.js.map +0 -1
- package/dist/content-blocks/p-24657e66.entry.js +0 -10
- package/dist/content-blocks/p-24657e66.entry.js.map +0 -1
- package/dist/content-blocks/p-271fb304.entry.js.map +0 -1
- package/dist/content-blocks/p-6a177aef.entry.js +0 -2
- package/dist/content-blocks/p-6a177aef.entry.js.map +0 -1
- package/dist/esm/swiper-3e7be625.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FullPageExample.stories.js","sourceRoot":"","sources":["../../../src/stories/FullPageExample.stories.ts"],"names":[],"mappings":"AACA,MAAM,IAAI,GAAS;IACjB,KAAK,EAAE,oBAAoB;IAC3B,IAAI,EAAE,CAAC,UAAU,CAAC;IAClB,UAAU,EAAE;QACV,IAAI,EAAE;YACJ,WAAW,EAAE;gBACX,SAAS,EAAE,8CAA8C;aAC1D;SACF;KACF;CACF,CAAC;AAEF,eAAe,IAAI,CAAC;AAGpB;;;GAGG;AACH,MAAM,CAAC,MAAM,YAAY,GAAU;IACjC,UAAU,EAAE;QACV,IAAI,EAAE;YACJ,WAAW,EAAE;gBACX,KAAK,EAAE,2DAA2D;aACnE;SACF;KACF;IACD,MAAM,EAAE,GAAG,EAAE,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAucP;CACR,CAAC","sourcesContent":["import type { Meta, StoryObj } from '@storybook/web-components';\nconst meta: Meta = {\n title: 'Full Page Examples',\n tags: ['autodocs'],\n parameters: {\n docs: {\n description: {\n component: 'Another description, overriding the comments',\n },\n },\n },\n};\n\nexport default meta;\ntype Story = StoryObj;\n\n/**\n * # Primary Button\n * This is the primary button\n */\nexport const BasicExample: Story = {\n parameters: {\n docs: {\n description: {\n story: 'Another description on the story, overriding the comments',\n },\n },\n },\n render: () => `<style>\n html,body {\n font-size: 14px;\n font-family: \"Helvetica Neue\", \"Arial\", sans-serif;\n line-height: 1\n }\n \n @media screen and (min-width: 768px) {\n html,body {\n font-size:16px\n }\n }\n \n .page-wrapper {\n max-width: 1366px;\n margin: auto\n }\n \n .text-style--header-1 {\n font-weight: bold;\n text-transform: uppercase;\n line-height: .88;\n font-size: 72px\n }\n \n @media screen and (min-width: 768px) {\n .text-style--header-1 {\n font-size:80px\n }\n }\n \n @media screen and (min-width: 1024px) {\n .text-style--header-1 {\n font-size:224px\n }\n }\n \n .text-style--header-2 {\n font-size: 24px;\n text-transform: uppercase;\n font-weight: bold\n }\n \n @media screen and (min-width: 768px) {\n .text-style--header-2 {\n font-size:32px\n }\n }\n \n @media screen and (min-width: 1024px) {\n .text-style--header-2 {\n font-size:36px\n }\n }\n \n .text-style--header {\n font-weight: bold;\n text-transform: uppercase;\n line-height: 1;\n font-size: 60px\n }\n \n .text-style--subheader {\n font-size: 24px;\n line-height: 1\n }\n \n @media screen and (min-width: 768px) {\n .text-style--subheader {\n font-size:32px\n }\n }\n \n @media screen and (min-width: 1024px) {\n .text-style--subheader {\n font-size:36px\n }\n }\n \n .text-style--small-copy {\n font-size: 12px;\n text-transform: uppercase\n }\n \n .text-style--tout-media-content {\n color: white;\n font-size: 12px\n }\n \n .button {\n display: inline-flex;\n text-decoration: none;\n }\n \n .button a {\n color: inherit;\n font-size: inherit;\n text-decoration: inherit; \n }\n .button--primary {\n background: black;\n color: white;\n height: 50px;\n padding: 0 30px\n }\n \n .button--primary:hover {\n background: #333\n }\n \n .button--play {\n color: white;\n font-size: 32px;\n font-weight: bold\n }\n \n .link a {\n text-decoration: none;\n color: inherit\n }\n \n .link:hover a {\n color: red\n }\n \n .link--large a {\n font-weight: bold;\n font-size: 32px\n }\n \n .grid--spaced .content-grid-formatter-grid {\n grid-column-gap: 15px;\n grid-row-gap: 15px\n }\n \n .grid--cast .content-grid-formatter-grid>content-tout-block {\n margin-bottom: 20px\n }\n \n .text-style--large-copy {\n font-size: 24px;\n line-height: 1.3\n }\n \n .content-block--40 {\n max-width: 100%\n }\n \n @media screen and (min-width: 768px) {\n .content-block--40 {\n max-width:40%\n }\n }\n \n .content-block--35 {\n max-width: 100%\n }\n \n @media screen and (min-width: 768px) {\n .content-block--35 {\n max-width:35%\n }\n }\n \n .swiper-button-prev {\n left: 0\n }\n \n .swiper-button-next {\n right: 0\n }\n \n .swiper-button-next,.swiper-button-prev {\n width: 64px;\n height: 64px;\n background: rgba(0,0,0,0.6)\n }\n \n .swiper-button-next:after,.swiper-button-prev:after {\n color: white\n }\n \n .swiper-scrollbar {\n display: none\n }\n \n content-spacer,content-text-block,content-tout-block, content-hero-block, content-image {\n opacity: 0;\n transition: all 1s\n }\n \n content-spacer.hydrated,content-text-block.hydrated,content-tout-block.hydrated, content-hero-block.hydrated, content-image.hydrated {\n opacity: 1;\n transform: translateY(0)\n }\n \n .content-image {\n transition: all 1s\n }\n </style>\n <div class=\"page-wrapper\">\n <content-spacer max-width=\"150px\">\n <content-image width=\"172\" height=\"54\" src=\"https://picsum.photos/172/54?random=1&grayscale\n \"></content-image>\n </content-spacer>\n <content-text-block slot=\"header\">\n <content-spacer max-width=\"90\" horizontal=\"left\" text-align=\"left\">\n <content-line classes=\"text-style--header-1\">Invent Yourself</content-line>\n </content-spacer>\n </content-text-block>\n <content-grid-formatter class=\"grid--cast\" columns=\"1|2|4\" type=\"grid\">\n <content-tout-block hover=\"false\">\n <content-image slot=\"background\" alt=\"Test Alt Text\" lazy-load=\"false\" width=\"2\" height=\"3\" src=\"https://picsum.photos/200/300?random=1&grayscale\"></content-image>\n <content-text-block slot=\"mediaContent\" vertical=\"bottom\">\n <content-spacer text-align=\"left\" left-offset=\"4\" bottom-offset=\"4\">\n <content-line classes=\"text-style--tout-media-content\">Cast Name</content-line>\n <content-line classes=\"text-style--tout-media-content\">Proession/Aspiration</content-line>\n </content-spacer>\n </content-text-block> \n </content-tout-block>\n <content-tout-block hover=\"false\">\n <content-image slot=\"background\" alt=\"Test Alt Text\" lazy-load=\"false\" width=\"2\" height=\"3\" src=\"https://picsum.photos/200/300?random=2&grayscale\"></content-image>\n <content-text-block slot=\"mediaContent\" vertical=\"bottom\">\n <content-spacer text-align=\"left\" left-offset=\"4\" bottom-offset=\"4\">\n <content-line classes=\"text-style--tout-media-content\">Cast Name</content-line>\n <content-line classes=\"text-style--tout-media-content\">Proession/Aspiration</content-line>\n </content-spacer>\n </content-text-block> \n </content-tout-block>\n <content-tout-block hover=\"false\">\n <content-image slot=\"background\" alt=\"Test Alt Text\" lazy-load=\"false\" width=\"2\" height=\"3\" src=\"https://picsum.photos/200/300?random=3&grayscale\"></content-image>\n <content-text-block slot=\"mediaContent\" vertical=\"bottom\">\n <content-spacer text-align=\"left\" left-offset=\"4\" bottom-offset=\"4\">\n <content-line classes=\"text-style--tout-media-content\">Cast Name</content-line>\n <content-line classes=\"text-style--tout-media-content\">Proession/Aspiration</content-line>\n </content-spacer>\n </content-text-block> \n </content-tout-block>\n <content-tout-block hover=\"false\">\n <content-image slot=\"background\" alt=\"Test Alt Text\" lazy-load=\"false\" width=\"2\" height=\"3\" src=\"https://picsum.photos/200/300?random=4&grayscale\"></content-image>\n <content-text-block slot=\"mediaContent\" vertical=\"bottom\">\n <content-spacer text-align=\"left\" left-offset=\"4\" bottom-offset=\"4\">\n <content-line classes=\"text-style--tout-media-content\">Cast Name</content-line>\n <content-line classes=\"text-style--tout-media-content\">Proession/Aspiration</content-line>\n </content-spacer>\n </content-text-block> \n </content-tout-block>\n \n </content-grid-formatter>\n \n <content-spacer top-offset=\"5\" bottom-offset=\"5\">\n <content-hero-block>\n <content-image slot=\"background\" src=\"https://picsum.photos/1600/900?random=1&grayscale\"></content-image>\n <content-text-block slot=\"content\">\n <content-spacer max-width=\"100|50\" left-offset=\"2\" top-offset=\"2\">\n <content-line classes=\"text-style--header\" max-width=\"100|70\">Lorem Ipsum</content-line>\n <content-line classes=\"text-style--subheader\">Benefit copy goes here.</content-line>\n <content-spacer top-offset=\"2\">\n <content-button classes=\"button button--primary\">START NOW</content-button>\n </content-spacer>\n </content-spacer>\n </content-text-block>\n </content-hero-block>\n </content-spacer>\n \n <content-grid-formatter type=\"flex\" flex-grow=\"true\" columns=\"1|2\">\n <content-text-block class=\"content-block--40\">\n <content-spacer left-offset=\"2\" right-offset=\"2\" top-offset=\"2\"> \n <content-line classes=\"text-style--header\">GET THE COVETED BOX-BAG</content-line>\n <content-line classes=\"text-style--subheader\">No time to wait</content-line>\n <content-spacer top-offset=\"2\">\n <content-button classes=\"button button--primary\">SHOP NOW</content-button>\n </content-spacer>\n </content-spacer>\n </content-text-block>\n <content-image src=\"https://picsum.photos/1600/900?random=2&grayscale\"></content-image>\n </content-grid-formatter>\n \n <content-spacer top-offset=\"5\" bottom-offset=\"5\">\n <content-hero-block>\n <content-image slot=\"background\" src=\"https://picsum.photos/1600/900?random=3&grayscale\"></content-image>\n <content-text-block slot=\"content\">\n <content-spacer left-offset=\"2\">\n <content-line classes=\"text-style--header\">Daily Rescue</content-line>\n <content-line classes=\"text-style--subheader\">Benefit copy goes here.</content-line>\n <content-spacer top-offset=\"2\">\n <content-button classes=\"button button--primary\">SHOP NOW</content-button>\n </content-spacer>\n </content-spacer>\n </content-text-block>\n </content-hero-block>\n </content-spacer>\n \n <content-spacer top-offset=\"1\" bottom-offset=\"1\">\n <content-hero-block>\n <content-image slot=\"background\" src=\"https://picsum.photos/1600/900?random=4&grayscale\"></content-image>\n <content-text-block slot=\"content\" vertical=\"center\">\n <content-spacer left-offset=\"4\" max-width=\"100|75|65\">\n <content-line classes=\"text-style--header\">Get Down WIth The Best Daily Routine</content-line>\n <content-spacer top-offset=\"4\">\n <content-button classes=\"button button--play\" href=\"#heroVideoOverlay\">PLAY</content-button>\n </content-spacer>\n </content-spacer>\n <content-overlay id=\"heroVideoOverlay\" target=\"#\" full-screen=\"false\">\n <content-video slot=\"content\" fit-container=\"true\" src=\"https://www.youtube.com/watch?v=IY4x85zqoJM\" autoplay=\"true\"></content-video>\n <script slot=\"content\" type=\"text/template\">\n </script>\n </content-overlay>\n </content-text-block>\n </content-hero-block>\n </content-spacer>\n \n <content-grid-formatter columns=\"1|3\" type=\"grid\" class=\"grid--spaced\">\n <content-image src=\"https://picsum.photos/400/300?random=1&grayscale\"></content-image>\n <content-image src=\"https://picsum.photos/400/300?random=2&grayscale\"></content-image>\n <content-image src=\"https://picsum.photos/400/300?random=3&grayscale\"></content-image>\n </content-grid-formatter>\n \n <content-spacer top-offset=\"5\" bottom-offset=\"5\">\n <content-grid-formatter columns=\"1|2\">\n <content-spacer>\n <content-line classes=\"text-style--header\">Expert Chat</content-line>\n </content-spacer>\n <content-spacer>\n <content-line classes=\"text-style--large-copy\">We know shopping for your skincare needs can be overwhelming. Let us help! There's no such thing as a silly question! <content-button classes=\"link\">Give it a try ></content-button></content-line>\n </content-spacer>\n </content-grid-formatter>\n </content-spacer>\n \n <content-spacer top-offset=\"5\" bottom-offset=\"5\">\n <content-hero-block>\n <content-image slot=\"background\" src=\"https://picsum.photos/1600/900?random=4&grayscale\"></content-image>\n <content-text-block slot=\"content\">\n <content-spacer max-width=\"100|50\" left-offset=\"2\" top-offset=\"2\">\n <content-line classes=\"text-style--header\" max-width=\"100|50\">Lorem Ipsum</content-line>\n <content-line classes=\"text-style--subheader\">Benefit copy goes here.</content-line>\n <content-spacer top-offset=\"2\">\n <content-button classes=\"link link--large\">Learn more ></content-button>\n </content-spacer>\n </content-spacer>\n </content-text-block>\n </content-hero-block>\n </content-spacer>\n \n <content-text-block slot=\"header\">\n <content-line classes=\"text-style--header-2\">By Series</content-line>\n </content-text-block>\n <content-carousel init-method=\"load\">\n <content-hero-block>\n <content-image slot=\"background\" src=\"https://picsum.photos/1600/900?random=5&grayscale\"></content-image>\n <content-text-block slot=\"content\">\n <content-spacer left-offset=\"2\">\n <content-line classes=\"text-style--header\">Daily Rescue</content-line>\n <content-line classes=\"text-style--subheader\">Benefit copy goes here.</content-line>\n <content-spacer top-offset=\"2\">\n <content-button classes=\"button button--primary\">SHOP NOW</content-button>\n </content-spacer>\n </content-spacer>\n </content-text-block>\n </content-hero-block>\n <content-hero-block>\n <content-image slot=\"background\" src=\"https://picsum.photos/1600/900?random=6&grayscale\"></content-image>\n <content-text-block slot=\"content\">\n <content-spacer left-offset=\"2\">\n <content-line classes=\"text-style--header\">Daily Rescue</content-line>\n <content-line classes=\"text-style--subheader\">Benefit copy goes here.</content-line>\n <content-spacer top-offset=\"2\">\n <content-button classes=\"button button--primary\">SHOP NOW</content-button>\n </content-spacer>\n </content-spacer>\n </content-text-block>\n </content-hero-block>\n <content-hero-block>\n <content-image slot=\"background\" src=\"https://picsum.photos/1600/900?random=7&grayscale\"></content-image>\n <content-text-block slot=\"content\">\n <content-spacer left-offset=\"2\">\n <content-line classes=\"text-style--header\">Daily Rescue</content-line>\n <content-line classes=\"text-style--subheader\">Benefit copy goes here.</content-line>\n <content-spacer top-offset=\"2\">\n <content-button classes=\"button button--primary\">SHOP NOW</content-button>\n </content-spacer>\n </content-spacer>\n </content-text-block>\n </content-hero-block>\n </content-carousel>\n <content-spacer top-offset=\"5\" bottom-offset=\"5\">\n <content-grid-formatter type=\"flex\" flex-grow=\"true\" columns=\"1|2\">\n <content-tout-block hover=\"false\">\n <content-image slot=\"background\" src=\"https://picsum.photos/1600/900?random=8&grayscale\"></content-image>\n <content-spacer slot=\"mediaContent\" top-offset=\"8\" bottom-offset=\"5\" left-offset=\"6\" right-offset=\"4\">\n <content-text-block color-class=\"light\">\n <content-line classes=\"text-style--header-2\">/Instructions</content-line>\n <content-spacer slot=\"footer\">\n <content-line classes=\"text-style--small-copy\">/01 Twist base of bottle counter-clockwise to lock</content-line>\n <content-line classes=\"text-style--small-copy\">/01 Twist base of bottle counter-clockwise to lock</content-line>\n <content-line classes=\"text-style--small-copy\">/01 Twist base of bottle counter-clockwise to lock</content-line>\n <content-line classes=\"text-style--small-copy\">/01 Twist base of bottle counter-clockwise to lock</content-line>\n </content-spacer>\n </content-text-block>\n </content-tout-block>\n </content-tout-block>\n <content-spacer left-offset=\"4\" class=\"content-block--35\">\n <content-text-block>\n <content-line classes=\"text-style--header\">BE PART OF THE CHANGE</content-line>\n <content-line classes=\"text-style--subheader\">Sustainability is our priority and we are the first men's skincare brand to introduce refillable packaging.</content-line>\n <content-spacer top-offset=\"2\">\n <content-button classes=\"link link--large\">Learn more ></content-button>\n </content-spacer>\n </content-text-block>\n </content-spacer>\n </content-grid-formatter>\n </content-spacer>\n <content-hero-block>\n <content-image slot=\"background\" src=\"https://picsum.photos/1600/900?random=9&grayscale\"></content-image>\n <content-text-block slot=\"content\">\n <content-spacer max-width=\"90|75|55|35\" top-offset=\"2|8\" left-offset=\"2\" right-offset=\"2|7\" horizontal=\"left|right\">\n <content-line classes=\"text-style--header\">Just The Tip</content-line>\n <content-line classes=\"text-style--subheader\">Master your skills on how to up your skincare game.</content-line>\n <content-spacer top-offset=\"2\">\n <content-button classes=\"link link--large\">Sign up ></content-button>\n </content-spacer>\n </content-spacer>\n </content-text-block>\n </content-hero-block>\n \n <content-spacer top-offset=\"5\" bottom-offset=\"5\">\n <content-hero-block>\n <content-image slot=\"background\" src=\"https://picsum.photos/1600/900?random=10&grayscale\"></content-image>\n <content-text-block slot=\"content\" vertical=\"center\">\n <content-spacer max-width=\"90|75|55|35\" left-offset=\"2\" right-offset=\"10\" horizontal=\"left\">\n <content-line classes=\"text-style--header\">THE DROP:</content-line>\n <content-line classes=\"text-style--subheader\">BE THBE FIRST TO OWN OUR NEW MAXELLENCE MATTE BLACK PACKAGING ></content-line>\n <content-line classes=\"text-style--header\">09/01/21</content-line>\n <content-spacer top-offset=\"2\">\n <content-button classes=\"link link--large\">Learn more ></content-button>\n </content-spacer>\n </content-spacer>\n </content-text-block>\n </content-hero-block>\n </content-spacer>\n \n <content-spacer bottom-offset=\"2\">\n <content-hero-block>\n <content-image slot=\"background\" src=\"https://picsum.photos/1600/900?random=11&grayscale\"></content-image>\n <content-text-block slot=\"content\" vertical=\"top\">\n <content-spacer max-width=\"90|75|55|45\" left-offset=\"2|0\" top-offset=\"2\" right-offset=\"0\" horizontal=\"left|right\">\n <content-line classes=\"text-style--header\">Invigorate Yourself</content-line>\n <content-line classes=\"text-style--subheader\" max-width=\"100|82\">Shop our Molecule Shop products</content-line>\n <content-spacer top-offset=\"2\">\n <content-button classes=\"button button--primary\">SHOP NOW</content-button>\n </content-spacer>\n </content-spacer>\n </content-text-block>\n </content-hero-block>\n </content-spacer>\n </div>`,\n};\n"]}
|
|
1
|
+
{"version":3,"file":"FullPageExample.stories.js","sourceRoot":"","sources":["../../../src/stories/FullPageExample.stories.ts"],"names":[],"mappings":"AACA,MAAM,IAAI,GAAS;IACjB,KAAK,EAAE,oBAAoB;IAC3B,IAAI,EAAE,CAAC,UAAU,CAAC;IAClB,UAAU,EAAE;QACV,IAAI,EAAE;YACJ,WAAW,EAAE;gBACX,SAAS,EAAE,8CAA8C;aAC1D;SACF;KACF;CACF,CAAC;AAEF,eAAe,IAAI,CAAC;AAGpB;;;GAGG;AACH,MAAM,CAAC,MAAM,YAAY,GAAU;IACjC,UAAU,EAAE;QACV,IAAI,EAAE;YACJ,WAAW,EAAE;gBACX,KAAK,EAAE,2DAA2D;aACnE;SACF;KACF;IACD,MAAM,EAAE,GAAG,EAAE,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;SAqZP;CACR,CAAC","sourcesContent":["import type { Meta, StoryObj } from '@storybook/web-components';\nconst meta: Meta = {\n title: 'Full Page Examples',\n tags: ['autodocs'],\n parameters: {\n docs: {\n description: {\n component: 'Another description, overriding the comments',\n },\n },\n },\n};\n\nexport default meta;\ntype Story = StoryObj;\n\n/**\n * # Primary Button\n * This is the primary button\n */\nexport const BasicExample: Story = {\n parameters: {\n docs: {\n description: {\n story: 'Another description on the story, overriding the comments',\n },\n },\n },\n render: () => `<style>\n html,body {\n font-size: 14px;\n font-family: \"Helvetica\", \"Arial\", sans-serif;\n line-height: 1.2;\n }\n \n @media screen and (min-width: 768px) {\n html,body {\n font-size:16px\n }\n }\n\n content-navigation-block ul,\n content-navigation-block ol,\n content-navigation-block li {\n padding: 0;\n list-style: none;\n display: block;\n }\n\n content-navigation-block .nav-level-1 a {\n font-size: 1.15rem;\n line-height:2;\n text-decoration: none;\n font-weight: bold;\n }\n \n .logo {\n width: 100px;\n height: 100px;\n background: #888;\n color: #FFF;\n display: flex;\n align-items: center;\n justify-content: center;\n border-radius: 50%;\n overflow: hidden;\n }\n \n .page-wrapper {\n max-width: 1366px;\n margin: auto\n }\n \n .text-style--header-1 {\n font-weight: bold;\n text-transform: uppercase;\n line-height: 1.2;\n font-size: 3.5rem;\n }\n \n .text-style--header-2 {\n font-size: 24px;\n text-transform: uppercase;\n font-weight: bold\n }\n\n .text-style--header {\n font-weight: bold;\n text-transform: uppercase;\n line-height: 1;\n font-size: 2.5rem;\n }\n \n .text-style--subheader {\n font-size: 24px;\n line-height: 1\n }\n \n \n .text-style--small-copy {\n font-size: 12px;\n text-transform: uppercase\n }\n \n .text-style--tout-media-content {\n color: white;\n font-size: 12px\n }\n \n .button {\n display: inline-flex;\n text-decoration: none;\n }\n \n .button a {\n color: inherit;\n font-size: inherit;\n text-decoration: inherit; \n }\n \n content-button a {\n width: auto;\n }\n .button--primary a {\n background: black;\n color: white;\n height: 50px;\n padding: 0 30px;\n width: auto;\n }\n \n .button--primary a:hover {\n background: #333\n }\n \n .button--play {\n color: white;\n font-size: 32px;\n font-weight: bold\n }\n \n .link a {\n text-decoration: none;\n color: inherit\n }\n \n .link:hover a {\n color: red\n }\n \n .link--large a {\n font-weight: bold;\n font-size: 32px\n }\n \n .grid--spaced .content-grid-formatter-grid {\n grid-column-gap: 15px;\n grid-row-gap: 15px\n }\n \n .grid--cast .content-grid-formatter-grid>content-tout-block {\n margin-bottom: 20px\n }\n \n .text-style--large-copy {\n font-size: 24px;\n line-height: 1.3\n }\n\n .swiper-button-prev {\n left: 0\n }\n \n .swiper-button-next {\n right: 0\n }\n \n .swiper-button-next,.swiper-button-prev {\n width: 64px;\n height: 64px;\n background: rgba(0,0,0,0.6)\n }\n \n .swiper-button-next:after,.swiper-button-prev:after {\n color: white\n }\n \n .swiper-scrollbar {\n display: none\n }\n \n \n content-spacer.hydrated,content-text-block.hydrated,content-tout-block.hydrated, content-hero-block.hydrated, content-image.hydrated {\n opacity: 1;\n }\n .relative {\n position: relative;\n }\n content-navigation-block[aria-expanded=\"true\"] .logo {\n display: none;\n }\n\n </style>\n <div class=\"page-wrapper\">\n <div class=\"\">\n <content-spacer max-width=\"1440px\" horizontal=\"center\">\n <content-navigation-block hamburger=\"fixed|none\" flex-shrink=\"true\">\n <content-button slot=\"skipContent\">Skip to main content</content-button>\n <div slot=\"content\">\n <nav>\n <content-spacer left-offset=\"40px|0\">\n <content-grid-formatter class=\"nav-level-1\" columns=\"1|5\" vertical=\"center\" type=\"flex|grid\" horizontal=\"flex-start|flex-end\">\n <div style=\"margin-right: auto;\"><content-line classes=\"logo\">Logo</content-line></div>\n <div><content-button href=\"#link1\" target=\"_blank\">Link 1\n </content-button>\n <content-overlay id=\"link1\" full-screen=\"false\" position=\"static|absolute\">\n <content-spacer left-offset=\"20px\" right-offset=\"20px\">\n <content-grid-formatter columns=\"1|3\">\n <ul class=\"nav-level-2\">\n <li><a href=\"#\">Link</a></li>\n <li><a href=\"#\">Link</a></li>\n <li><a href=\"#\">Link</a></li>\n </ul>\n <ul class=\"nav-level-2\">\n <li><a href=\"#\">Link</a></li>\n <li><a href=\"#\">Link</a></li>\n <li><a href=\"#\">Link</a></li>\n </ul>\n <ul class=\"nav-level-2\">\n <li><a href=\"#\">Link</a></li>\n <li><a href=\"#\">Link</a></li>\n <li><a href=\"#\">Link</a></li>\n </ul>\n </content-grid-formatter>\n </content-spacer>\n </content-overlay>\n </div>\n <div>\n <content-button href=\"#link2\" target=\"_blank\">Link 2</content-button>\n </div>\n </content-grid-formatter>\n </content-spacer>\n </nav>\n </div>\n </content-navigation-block>\n </content-spacer>\n </div>\n <content-text-block slot=\"header\">\n <content-spacer max-width=\"90\" horizontal=\"left\" text-align=\"left\">\n <content-line classes=\"text-style--header-1\">Latest Works</content-line>\n </content-spacer>\n </content-text-block>\n \n <content-spacer top-offset=\"1\" bottom-offset=\"20px\">\n <content-hero-block content-position=\"above\">\n <content-image slot=\"background\" src=\"https://picsum.photos/1600/900?random=4&grayscale\"></content-image>\n <content-text-block slot=\"content\" vertical=\"center\">\n <content-spacer left-offset=\"4\" right-offset=\"4\" max-width=\"100|75|65\">\n <content-line classes=\"text-style--header\">Watch Travel Video</content-line>\n <content-spacer top-offset=\"4\">\n <content-button classes=\"button button--play\" href=\"#heroVideoOverlay\">PLAY</content-button>\n </content-spacer>\n </content-spacer>\n </content-text-block>\n <content-overlay id=\"heroVideoOverlay\" position=\"absolute\">\n Hello World\n <script slot=\"content\" type=\"text/template\">\n <content-video fit-container=\"true\" src=\"https://www.youtube.com/watch?v=IY4x85zqoJM\" autoplay=\"true\"></content-video>\n </script>\n </content-overlay>\n </content-hero-block>\n </content-spacer>\n\n <content-grid-formatter class=\"grid--cast\" columns=\"2|4\" type=\"grid\" column-gap=\"10px\" row-gap=\"10px\">\n <content-tout-block hover=\"false\">\n <content-image slot=\"media\" alt=\"Test Alt Text\" lazy-load=\"false\" width=\"2\" height=\"3\" aspect-ratio=\"2/3\" src=\"http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerJoyrides.mp4\"></content-image>\n <content-text-block slot=\"mediaContent\" vertical=\"bottom\">\n <content-spacer text-align=\"left\" left-offset=\"4\" bottom-offset=\"4\">\n <content-line classes=\"text-style--tout-media-content\">Tourist Destination</content-line>\n <content-line classes=\"text-style--tout-media-content\">Malaysia</content-line>\n </content-spacer>\n </content-text-block> \n </content-tout-block>\n <content-tout-block hover=\"false\">\n <content-image slot=\"media\" alt=\"Test Alt Text\" lazy-load=\"false\" width=\"2\" height=\"3\" aspect-ratio=\"2/3\" src=\"http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerFun.mp4\" aspect-ratio=\"2/3\"></content-image>\n <content-text-block slot=\"mediaContent\" vertical=\"bottom\">\n <content-spacer text-align=\"left\" left-offset=\"4\" bottom-offset=\"4\">\n <content-line classes=\"text-style--tout-media-content\">Tourist Destination</content-line>\n <content-line classes=\"text-style--tout-media-content\">Malaysia</content-line>\n </content-spacer>\n </content-text-block> \n </content-tout-block>\n <content-tout-block hover=\"false\">\n <content-image slot=\"media\" alt=\"Test Alt Text\" lazy-load=\"false\" width=\"2\" height=\"3\" aspect-ratio=\"2/3\" src=\"http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerEscapes.mp4\"></content-image>\n <content-text-block slot=\"mediaContent\" vertical=\"bottom\">\n <content-spacer text-align=\"left\" left-offset=\"4\" bottom-offset=\"4\">\n <content-line classes=\"text-style--tout-media-content\">Tourist Destination</content-line>\n <content-line classes=\"text-style--tout-media-content\">Malaysia</content-line>\n </content-spacer>\n </content-text-block> \n </content-tout-block>\n <content-tout-block hover=\"false\">\n <content-image slot=\"media\" alt=\"Test Alt Text\" lazy-load=\"false\" width=\"2\" height=\"3\" aspect-ratio=\"2/3\" src=\"http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ForBiggerBlazes.mp4\"></content-image>\n <content-text-block slot=\"mediaContent\" vertical=\"bottom\">\n <content-spacer text-align=\"left\" left-offset=\"4\" bottom-offset=\"4\">\n <content-line classes=\"text-style--tout-media-content\">Tourist Destination</content-line>\n <content-line classes=\"text-style--tout-media-content\">Malaysia</content-line>\n </content-spacer>\n </content-text-block> \n </content-tout-block>\n \n </content-grid-formatter>\n \n <content-spacer top-offset=\"5\" bottom-offset=\"5\">\n <content-hero-block>\n <content-image slot=\"background\" aspect-ratio=\"3/4|4/1\" src=\"http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4\"></content-image>\n <content-text-block slot=\"content\">\n <content-spacer max-width=\"100|400px\" left-offset=\"2\" top-offset=\"2\">\n <content-line classes=\"text-style--header\">Travel Vlog</content-line>\n <content-line classes=\"text-style--subheader\">Follow along with my guide to the best of this travel destination.</content-line>\n <content-spacer top-offset=\"2\">\n <content-button classes=\"button button--primary\">Explore</content-button>\n </content-spacer>\n </content-spacer>\n </content-text-block>\n </content-hero-block>\n </content-spacer>\n \n <content-grid-formatter type=\"flex\" flex-grow=\"true\" columns=\"1|2\">\n <content-text-block class=\"content-block--40\">\n <content-spacer left-offset=\"2\" right-offset=\"2\" top-offset=\"2\" bottom-offset=\"4\"> \n <content-line classes=\"text-style--header\">Favorite Destinations</content-line>\n <content-line classes=\"text-style--subheader\">No time to wait</content-line>\n <content-spacer top-offset=\"2\">\n <content-button classes=\"button button--primary\">Travel With Me</content-button>\n </content-spacer>\n </content-spacer>\n </content-text-block>\n <content-image src=\"https://picsum.photos/1600/900?random=2&grayscale\"></content-image>\n </content-grid-formatter>\n\n \n <content-grid-formatter columns=\"1|3\" type=\"grid\" class=\"grid--spaced\" row-gap=\"20px\" row-gap=\"20px\">\n <content-image src=\"https://picsum.photos/400/300?random=1&grayscale\"></content-image>\n <content-image src=\"https://picsum.photos/400/300?random=2&grayscale\"></content-image>\n <content-image src=\"https://picsum.photos/400/300?random=3&grayscale\"></content-image>\n </content-grid-formatter>\n\n \n <content-text-block slot=\"header\">\n <content-spacer bottom-offset=\"20px\"><content-line classes=\"text-style--header-2\">Carousel</content-line></content-spacer>\n </content-text-block>\n <content-carousel init-method=\"load\">\n <content-hero-block>\n <content-image slot=\"background\" src=\"https://picsum.photos/1600/900?random=5&grayscale\"></content-image>\n <content-text-block slot=\"content\">\n <content-spacer left-offset=\"2\" top-offset=\"20px\">\n <content-line classes=\"text-style--header\">Japan</content-line>\n <content-line classes=\"text-style--subheader\">Taken amongst the Cherry Blossom trees of Tokyo.</content-line>\n <content-spacer top-offset=\"2\">\n <content-button classes=\"button button--primary\">SHOP NOW</content-button>\n </content-spacer>\n </content-spacer>\n </content-text-block>\n </content-hero-block>\n\n <content-hero-block>\n <content-image slot=\"background\" src=\"https://picsum.photos/1600/900?random=5&grayscale\"></content-image>\n <content-text-block slot=\"content\">\n <content-spacer left-offset=\"2\" top-offset=\"20px\">\n <content-line classes=\"text-style--header\">Norway</content-line>\n <content-line classes=\"text-style--subheader\">Explore the Northern Lights.</content-line>\n <content-spacer top-offset=\"2\">\n <content-button classes=\"button button--primary\">SHOP NOW</content-button>\n </content-spacer>\n </content-spacer>\n </content-text-block>\n </content-hero-block>\n </content-carousel>\n <content-spacer top-offset=\"5\" bottom-offset=\"5\">\n <content-grid-formatter type=\"flex\" flex-grow=\"true\" columns=\"1|2\">\n <content-tout-block hover=\"false\">\n <content-image slot=\"background\" src=\"https://picsum.photos/1600/900?random=8&grayscale\"></content-image>\n <content-spacer slot=\"mediaContent\" top-offset=\"8\" bottom-offset=\"5\" left-offset=\"6\" right-offset=\"4\">\n <content-text-block color-class=\"light\">\n <content-line classes=\"text-style--header-2\">/Instructions</content-line>\n <content-spacer slot=\"footer\">\n <content-line classes=\"text-style--small-copy\">/01 Twist base of bottle counter-clockwise to lock</content-line>\n <content-line classes=\"text-style--small-copy\">/01 Twist base of bottle counter-clockwise to lock</content-line>\n <content-line classes=\"text-style--small-copy\">/01 Twist base of bottle counter-clockwise to lock</content-line>\n <content-line classes=\"text-style--small-copy\">/01 Twist base of bottle counter-clockwise to lock</content-line>\n </content-spacer>\n </content-text-block>\n </content-tout-block>\n </content-tout-block>\n <content-spacer left-offset=\"4\" class=\"content-block--35\">\n <content-text-block>\n <content-line classes=\"text-style--header\">Editorial Content</content-line>\n <content-line classes=\"text-style--subheader\">Donec sed odio dui. Vivamus sagittis lacus vel augue laoreet rutrum faucibus dolor auctor.</content-line>\n <content-spacer top-offset=\"2\">\n <div><content-button classes=\"link link--large\">Learn more ></content-button></div>\n </content-spacer>\n </content-text-block>\n </content-spacer>\n </content-grid-formatter>\n </content-spacer>\n <content-hero-block>\n <content-image slot=\"background\" src=\"https://picsum.photos/1600/900?random=9&grayscale\"></content-image>\n <content-text-block slot=\"content\">\n <content-spacer max-width=\"90|75|55|35\" top-offset=\"2|8\" left-offset=\"2\" right-offset=\"2|7\" horizontal=\"left|right\">\n <content-line classes=\"text-style--header\">Editorial Content</content-line>\n <content-line classes=\"text-style--subheader\">Freeform text layouts.</content-line>\n <content-spacer top-offset=\"2\">\n <div><content-button classes=\"link link--large\">Example CTA</content-button></div>\n </content-spacer>\n </content-spacer>\n </content-text-block>\n </content-hero-block>\n \n <content-spacer top-offset=\"5\" bottom-offset=\"5\">\n <content-hero-block>\n <content-image slot=\"background\" src=\"https://picsum.photos/1600/900?random=10&grayscale\"></content-image>\n <content-text-block slot=\"content\" vertical=\"center\">\n <content-spacer max-width=\"90|75|55|35\" left-offset=\"2\" right-offset=\"10\" horizontal=\"left\">\n <content-line classes=\"text-style--header\">Editorial Content</content-line>\n <content-line classes=\"text-style--subheader\">Donec sed odio dui.</content-line>\n <content-spacer top-offset=\"2\">\n <div><content-button classes=\"link link--large\">Learn more ></content-button></div>\n </content-spacer>\n </content-spacer>\n </content-text-block>\n </content-hero-block>\n </content-spacer>\n </div>`,\n};\n"]}
|
|
@@ -12,7 +12,6 @@ const ContentCarousel$1 = /*@__PURE__*/ proxyCustomElement(class ContentCarousel
|
|
|
12
12
|
this.swiperOptions = '{"slidesPerView": 1, "slidesPerGroup": 1, "autoplay": true, "loop": false}';
|
|
13
13
|
}
|
|
14
14
|
getSwiperOptions(newOptions) {
|
|
15
|
-
console.log(this.swiperNextElement);
|
|
16
15
|
return Object.assign({
|
|
17
16
|
observer: true,
|
|
18
17
|
observeParents: true,
|
|
@@ -38,7 +37,7 @@ const ContentCarousel$1 = /*@__PURE__*/ proxyCustomElement(class ContentCarousel
|
|
|
38
37
|
rootMargin: '0px',
|
|
39
38
|
threshold: 0.1,
|
|
40
39
|
};
|
|
41
|
-
let observer = new IntersectionObserver(
|
|
40
|
+
let observer = new IntersectionObserver(entries => {
|
|
42
41
|
entries.forEach(async (entry) => {
|
|
43
42
|
if (entry.isIntersecting && !this.loadStatus.getValue()) {
|
|
44
43
|
await this.initSwiper();
|
|
@@ -60,16 +59,18 @@ const ContentCarousel$1 = /*@__PURE__*/ proxyCustomElement(class ContentCarousel
|
|
|
60
59
|
}
|
|
61
60
|
async initSwiper() {
|
|
62
61
|
let Swiper = await import('./swiper.js');
|
|
62
|
+
let SwiperModules = await import('./index2.js');
|
|
63
63
|
for (const slide of this.swiperWrapper.children) {
|
|
64
64
|
slide.classList.add('swiper-slide');
|
|
65
65
|
}
|
|
66
|
+
console.log(this.swiperOptionsFinal);
|
|
66
67
|
// configure Swiper to use modules
|
|
67
68
|
this.swiperCarousel = new Swiper.Swiper(this.swiper, Object.assign(Object.assign({}, this.swiperOptionsFinal), {
|
|
68
|
-
|
|
69
|
+
modules: [SwiperModules.A11y, SwiperModules.Navigation, SwiperModules.Pagination],
|
|
69
70
|
}));
|
|
70
71
|
}
|
|
71
72
|
render() {
|
|
72
|
-
return (h(Host, null, h("div", { class: "swiper", ref: el => this.swiper = el }, h("div", { class: "swiper-wrapper", ref: el => this.swiperWrapper = el }, h("slot", { name: "content" }), h("slot", null)), h("div", { class: "swiper-pagination", ref: el => this.swiperPagination = el }), h("
|
|
73
|
+
return (h(Host, null, h("div", { class: "swiper", ref: el => (this.swiper = el) }, h("div", { class: "swiper-wrapper", ref: el => (this.swiperWrapper = el) }, h("slot", { name: "content" }), h("slot", null)), h("div", { class: "swiper-pagination", ref: el => (this.swiperPagination = el) }), h("button", { class: "swiper-button-prev", ref: el => (this.swiperPrevElement = el) }), h("button", { class: "swiper-button-next", ref: el => (this.swiperNextElement = el) }), h("div", { class: "swiper-scrollbar", ref: el => (this.swiperScrollbar = el) }))));
|
|
73
74
|
}
|
|
74
75
|
get hostElement() { return this; }
|
|
75
76
|
static get style() { return contentCarouselCss; }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"content-carousel.js","mappings":";;;AAAA,MAAM,kBAAkB,GAAG,20jBAA20jB;;MCez1jBA,iBAAe;;;;QAsB1B,eAAU,GAA6B,IAAI,eAAe,CAAC,KAAK,CAAC,CAAC;0BAf7B,MAAM;6BAKX,4EAA4E;;IAY5G,gBAAgB,CAAC,UAAkB;QACjC,OAAO,
|
|
1
|
+
{"file":"content-carousel.js","mappings":";;;AAAA,MAAM,kBAAkB,GAAG,20jBAA20jB;;MCez1jBA,iBAAe;;;;QAsB1B,eAAU,GAA6B,IAAI,eAAe,CAAC,KAAK,CAAC,CAAC;0BAf7B,MAAM;6BAKX,4EAA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,IAAI,CAAC,iBAAiB,GAAG,EAAuB,CAAC,GAAW,EAC3G,cAAQ,KAAK,EAAC,oBAAoB,EAAC,GAAG,EAAE,EAAE,KAAK,IAAI,CAAC,iBAAiB,GAAG,EAAuB,CAAC,GAAW,EAE3G,WAAK,KAAK,EAAC,kBAAkB,EAAC,GAAG,EAAE,EAAE,KAAK,IAAI,CAAC,eAAe,GAAG,EAAoB,CAAC,GAAQ,CAC1F,CACD,EACP;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["ContentCarousel"],"sources":["src/components/content-carousel/content-carousel.scss?tag=content-carousel","src/components/content-carousel/content-carousel.tsx"],"sourcesContent":["@import \"~swiper/swiper-bundle.min.css\";\ncontent-carousel {\n display: block;\n overflow: hidden;\n}","import { Component, h, Host, Prop, Listen, Element } from '@stencil/core';\nimport { HTMLStencilElement } from '@stencil/core/internal';\nimport { BehaviorSubject } from 'rxjs';\n// import { A11y, Navigation, Pagination } from 'swiper/modules';\n\n/**\n * @slot content - This slot will usually serve a content hero block or image.\n * @slot - Default slot, same as content slot.\n */\nexport type InitMethodType = 'load' | 'event';\n@Component({\n tag: 'content-carousel',\n styleUrl: 'content-carousel.scss',\n shadow: false,\n})\nexport class ContentCarousel {\n @Element() hostElement: HTMLStencilElement;\n /**\n * @type Select\n * @options load\n * @options init\n */\n @Prop() initMethod: InitMethodType = 'load';\n /**\n * @type JSON\n * @schema Swiper Options\n */\n @Prop() swiperOptions: string = '{\"slidesPerView\": 1, \"slidesPerGroup\": 1, \"autoplay\": true, \"loop\": false}';\n public swiperCarousel: any;\n public swiper?: HTMLDivElement;\n public swiperWrapper?: HTMLDivElement;\n public swiperPagination?: HTMLDivElement;\n public swiperPrevElement?: HTMLButtonElement;\n public swiperNextElement?: HTMLButtonElement;\n public swiperScrollbar?: HTMLDivElement;\n public swiperOptionsFinal;\n\n loadStatus: BehaviorSubject<boolean> = new BehaviorSubject(false);\n\n getSwiperOptions(newOptions: string): object {\n return Object.assign(\n {\n observer: true,\n observeParents: true,\n pagination: {\n el: this.swiperPagination,\n },\n navigation: {\n nextEl: this.swiperNextElement,\n prevEl: this.swiperPrevElement,\n },\n scrollbar: {\n el: this.swiperScrollbar,\n },\n },\n newOptions,\n );\n }\n componentDidLoad() {\n if (this.initMethod === 'load') {\n if (this.swiperOptions) {\n this.swiperOptionsFinal = this.getSwiperOptions(JSON.parse((this.swiperOptions as string) || ''));\n }\n\n let options = {\n root: null,\n rootMargin: '0px',\n threshold: 0.1,\n };\n\n let observer = new IntersectionObserver(entries => {\n entries.forEach(async entry => {\n if (entry.isIntersecting && !this.loadStatus.getValue()) {\n await this.initSwiper();\n this.loadStatus.next(true);\n }\n });\n }, options);\n observer.observe(this.hostElement);\n }\n }\n\n @Listen('setSwiperOptions')\n setSwiperOptionsCallback(event: CustomEvent) {\n this.loadStatus.subscribe(async () => {\n let loaded = this.loadStatus.value;\n if (loaded) {\n this.swiperOptionsFinal = this.getSwiperOptions(event.detail);\n await this.initSwiper();\n }\n });\n }\n\n async initSwiper() {\n let Swiper = await import('swiper');\n let SwiperModules = await import('swiper/modules');\n\n for (const slide of this.swiperWrapper.children as any) {\n slide.classList.add('swiper-slide');\n }\n console.log(this.swiperOptionsFinal);\n // configure Swiper to use modules\n this.swiperCarousel = new Swiper.Swiper(this.swiper, {\n ...this.swiperOptionsFinal,\n ...{\n modules: [SwiperModules.A11y, SwiperModules.Navigation, SwiperModules.Pagination],\n },\n });\n }\n\n render() {\n return (\n <Host>\n <div class=\"swiper\" ref={el => (this.swiper = el as HTMLDivElement)}>\n <div class=\"swiper-wrapper\" ref={el => (this.swiperWrapper = el as HTMLDivElement)}>\n <slot name=\"content\"></slot>\n <slot></slot>\n </div>\n <div class=\"swiper-pagination\" ref={el => (this.swiperPagination = el as HTMLDivElement)}></div>\n\n <button class=\"swiper-button-prev\" ref={el => (this.swiperPrevElement = el as HTMLButtonElement)}></button>\n <button class=\"swiper-button-next\" ref={el => (this.swiperNextElement = el as HTMLButtonElement)}></button>\n\n <div class=\"swiper-scrollbar\" ref={el => (this.swiperScrollbar = el as HTMLDivElement)}></div>\n </div>\n </Host>\n );\n }\n}\n"],"version":3}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
|
|
2
2
|
import { W as WindowResizeService } from './window-resize-service.js';
|
|
3
3
|
|
|
4
|
-
const contentGridFormatterCss = "*{box-sizing:border-box}content-grid-formatter{width:100%;overflow:auto}content-grid-formatter *{box-sizing:border-box}content-grid-formatter[type=grid]{display:grid;grid-template-columns:repeat(var(--columns), 1fr);column-gap:var(--column-gap)}content-grid-formatter[type=flex]{display:flex;
|
|
4
|
+
const contentGridFormatterCss = "*{box-sizing:border-box}content-grid-formatter{width:100%;overflow:auto;align-items:var(--align-items, flex-start);justify-content:var(--justify-content)}content-grid-formatter *{box-sizing:border-box}content-grid-formatter[type=grid]{display:grid;grid-template-columns:repeat(var(--columns), 1fr);column-gap:var(--column-gap, 0);row-gap:var(--row-gap, 0)}content-grid-formatter[type=flex]{display:flex;flex-wrap:wrap}content-grid-formatter[type=flex]>*{overflow:auto;flex:0 0 auto;width:calc(100% / var(--columns))}content-grid-formatter>[flex-shrink=true]{width:auto;flex-shrink:1}content-grid-formatter[flex-shrink=true]>*{flex-shrink:1}content-grid-formatter[flex-grow=true]>*{flex-grow:1}content-grid-formatter>[flex-grow=true]{width:auto;flex-grow:1}";
|
|
5
5
|
|
|
6
6
|
const ContentGridFormatter = /*@__PURE__*/ proxyCustomElement(class ContentGridFormatter extends HTMLElement {
|
|
7
7
|
constructor() {
|
|
@@ -16,6 +16,7 @@ const ContentGridFormatter = /*@__PURE__*/ proxyCustomElement(class ContentGridF
|
|
|
16
16
|
this.horizontal = 'space-between';
|
|
17
17
|
this.columns = '1';
|
|
18
18
|
this.columnGap = '0';
|
|
19
|
+
this.rowGap = '0';
|
|
19
20
|
this.activeClassString = undefined;
|
|
20
21
|
this.inlineStyle = {};
|
|
21
22
|
}
|
|
@@ -33,6 +34,7 @@ const ContentGridFormatter = /*@__PURE__*/ proxyCustomElement(class ContentGridF
|
|
|
33
34
|
WindowResizeService.registerProp(this.flexShrink).subscribe(newValue => (this.flexShrink = newValue)),
|
|
34
35
|
WindowResizeService.registerProp(this.flexGrow).subscribe(newValue => (this.flexGrow = newValue)),
|
|
35
36
|
WindowResizeService.registerProp(this.columns).subscribe(newValue => {
|
|
37
|
+
console.log(this.hostElement, this.columns);
|
|
36
38
|
this.columns = newValue;
|
|
37
39
|
this.inlineStyle = Object.assign(Object.assign({}, this.inlineStyle), { '--columns': newValue });
|
|
38
40
|
}),
|
|
@@ -40,12 +42,17 @@ const ContentGridFormatter = /*@__PURE__*/ proxyCustomElement(class ContentGridF
|
|
|
40
42
|
this.columnGap = newValue;
|
|
41
43
|
this.inlineStyle = Object.assign(Object.assign({}, this.inlineStyle), { '--column-gap': newValue });
|
|
42
44
|
}),
|
|
45
|
+
WindowResizeService.registerProp(this.rowGap).subscribe(newValue => {
|
|
46
|
+
this.rowGap = newValue;
|
|
47
|
+
this.inlineStyle = Object.assign(Object.assign({}, this.inlineStyle), { '--row-gap': newValue });
|
|
48
|
+
}),
|
|
43
49
|
WindowResizeService.registerProp(this.classes).subscribe(newValue => (this.classString = newValue)),
|
|
44
50
|
]);
|
|
45
51
|
}
|
|
46
52
|
render() {
|
|
47
53
|
return (h(Host, { class: this.classString, style: this.inlineStyle }, h("slot", null)));
|
|
48
54
|
}
|
|
55
|
+
get hostElement() { return this; }
|
|
49
56
|
static get style() { return contentGridFormatterCss; }
|
|
50
57
|
}, [4, "content-grid-formatter", {
|
|
51
58
|
"classes": [1],
|
|
@@ -56,6 +63,7 @@ const ContentGridFormatter = /*@__PURE__*/ proxyCustomElement(class ContentGridF
|
|
|
56
63
|
"horizontal": [1537],
|
|
57
64
|
"columns": [1537],
|
|
58
65
|
"columnGap": [1537, "column-gap"],
|
|
66
|
+
"rowGap": [1537, "row-gap"],
|
|
59
67
|
"classString": [32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QAAQ,KAAK,IAAI,CAAC,QAAQ,GAAG,QAAkB,CAAC,CAAC;YAC3G,mBAAmB,CAAC,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,SAAS,CAAC,QAAQ;gBAC/D,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;gBAC5C,IAAI,CAAC,OAAO,GAAG,QAAkB,CAAC;gBAClC,IAAI,CAAC,WAAW,mCACX,IAAI,CAAC,WAAW,KACnB,WAAW,EAAE,QAAkB,GAChC,CAAC;aACH,CAAC;YACF,mBAAmB,CAAC,YAAY,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,QAAQ;gBACjE,IAAI,CAAC,SAAS,GAAG,QAAkB,CAAC;gBACpC,IAAI,CAAC,WAAW,mCACX,IAAI,CAAC,WAAW,KACnB,cAAc,EAAE,QAAkB,GACnC,CAAC;aACH,CAAC;YACF,mBAAmB,CAAC,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,QAAQ;gBAC9D,IAAI,CAAC,MAAM,GAAG,QAAkB,CAAC;gBACjC,IAAI,CAAC,WAAW,mCACX,IAAI,CAAC,WAAW,KACnB,WAAW,EAAE,QAAkB,GAChC,CAAC;aACH,CAAC;YACF,mBAAmB,CAAC,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,SAAS,CAAC,QAAQ,KAAK,IAAI,CAAC,WAAW,GAAG,QAAkB,CAAC,CAAC;SAC9G,CAAC,CAAC;KACJ;IAED,MAAM;QACJ,QACE,EAAC,IAAI,IAAC,KAAK,EAAE,IAAI,CAAC,WAAW,EAAE,KAAK,EAAE,IAAI,CAAC,WAAW,IACpD,eAAQ,CACH,EACP;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":[],"sources":["src/formatters/content-grid-formatter/content-grid-formatter.scss?tag=content-grid-formatter","src/formatters/content-grid-formatter/content-grid-formatter.tsx"],"sourcesContent":["content-grid-formatter {\n width: 100%;\n overflow: auto;\n align-items: var(--align-items, flex-start);\n justify-content: var(--justify-content);\n * {\n box-sizing: border-box;\n }\n &[type=\"grid\"] {\n display: grid;\n grid-template-columns: repeat(var(--columns), 1fr);\n column-gap: var(--column-gap, 0);\n row-gap: var(--row-gap, 0);\n }\n\n &[type=\"flex\"] {\n display: flex;\n flex-wrap: wrap; \n > * {\n overflow: auto;\n flex: 0 0 auto;\n width: calc(100%/var(--columns));\n }\n }\n > [flex-shrink=\"true\"] {\n width: auto;\n flex-shrink: 1;\n }\n &[flex-shrink=\"true\"] > * {\n flex-shrink: 1;\n }\n &[flex-grow=\"true\"] > * {\n flex-grow: 1;\n }\n > [flex-grow=\"true\"] {\n width: auto;\n flex-grow: 1;\n }\n}","import { Component, h, Host, Prop, State } from '@stencil/core';\nimport { WindowResizeService } from '../../services/window-resize-service';\nimport { FLEX_JUSTIFY_OPTIONS, GRID_TYPES, ResponsiveBoolean, ResponsiveNumber, ResponsiveString } from '../../typings';\nimport { Element, HTMLStencilElement } from '@stencil/core/internal';\n\n/**\n * @slot media - This slot can either be a video or image component.\n * @slot content - This slot will usually serve a content text block.\n */\n@Component({\n tag: 'content-grid-formatter',\n styleUrl: 'content-grid-formatter.scss',\n shadow: false,\n})\nexport class ContentGridFormatter {\n /**\n * @type String\n * @responsive\n */\n @Prop() classes: ResponsiveString;\n @State() classString;\n /**\n * Flex or grid\n * @type Select\n * @options none\n * @options flex\n * @options grid\n * @responsive\n */\n @Prop({\n mutable: true,\n reflect: true,\n })\n type: GRID_TYPES | ResponsiveString = 'flex';\n /**\n * Setting this true to will grow all children. Alternatively, add the attribute [flex-grow=\"true\"] to a specific grid child and that child will grow.\n * @type Boolean\n * @responsive\n */\n @Prop({\n mutable: true,\n reflect: true,\n })\n flexGrow: ResponsiveBoolean = 'false';\n /**\n * Setting this true to will shrink all children. Alternatively, add the attribute [flex-shrink=\"true\"] to a specific grid child and that child will shrink.\n * @type Boolean\n * @responsive\n */\n @Prop({\n mutable: true,\n reflect: true,\n })\n flexShrink: ResponsiveBoolean = 'false';\n /**\n * Vertical axis alignment\n * @type Select\n * @options flex-start\n * @options space-between\n * @options center\n * @options space-evenly\n * @responsive\n */\n @Prop({\n mutable: true,\n reflect: true,\n })\n vertical: FLEX_JUSTIFY_OPTIONS = 'space-between';\n\n /**\n * Horizontal axis alignment\n * @type Select\n * @options flex-start\n * @options space-between\n * @options center\n * @options space-evenly\n * @responsive\n */\n @Prop({\n mutable: true,\n reflect: true,\n })\n horizontal: FLEX_JUSTIFY_OPTIONS = 'space-between';\n /**\n * @type Number\n * @responsive\n */\n @Prop({\n mutable: true,\n reflect: true,\n })\n columns: ResponsiveNumber = '1';\n\n /**\n * @type Number\n * @responsive\n */\n @Prop({\n mutable: true,\n reflect: true,\n })\n columnGap: ResponsiveNumber = '0';\n\n /**\n * @type Number\n * @responsive\n */\n @Prop({\n mutable: true,\n reflect: true,\n })\n rowGap: ResponsiveNumber = '0';\n\n @Element() hostElement: HTMLStencilElement;\n @State() activeClassString: string;\n @State() inlineStyle: { [key: string]: string } = {};\n\n componentWillLoad() {\n return Promise.allSettled([\n WindowResizeService.registerProp(this.type).subscribe(newValue => (this.type = newValue as GRID_TYPES)),\n WindowResizeService.registerProp(this.vertical).subscribe(newValue => {\n this.vertical = newValue as FLEX_JUSTIFY_OPTIONS;\n this.inlineStyle = {\n ...this.inlineStyle,\n '--align-items': this.vertical,\n };\n }),\n WindowResizeService.registerProp(this.horizontal).subscribe(newValue => {\n this.horizontal = newValue as FLEX_JUSTIFY_OPTIONS;\n this.inlineStyle = {\n ...this.inlineStyle,\n '--justify-content': this.horizontal,\n };\n }),\n WindowResizeService.registerProp(this.flexShrink).subscribe(newValue => (this.flexShrink = newValue as string)),\n WindowResizeService.registerProp(this.flexGrow).subscribe(newValue => (this.flexGrow = newValue as string)),\n WindowResizeService.registerProp(this.columns).subscribe(newValue => {\n console.log(this.hostElement, this.columns);\n this.columns = newValue as string;\n this.inlineStyle = {\n ...this.inlineStyle,\n '--columns': newValue as string,\n };\n }),\n WindowResizeService.registerProp(this.columnGap).subscribe(newValue => {\n this.columnGap = newValue as string;\n this.inlineStyle = {\n ...this.inlineStyle,\n '--column-gap': newValue as string,\n };\n }),\n WindowResizeService.registerProp(this.rowGap).subscribe(newValue => {\n this.rowGap = newValue as string;\n this.inlineStyle = {\n ...this.inlineStyle,\n '--row-gap': newValue as string,\n };\n }),\n WindowResizeService.registerProp(this.classes).subscribe(newValue => (this.classString = newValue as string)),\n ]);\n }\n\n render() {\n return (\n <Host class={this.classString} style={this.inlineStyle}>\n <slot />\n </Host>\n );\n }\n}\n"],"version":3}
|
|
@@ -64,9 +64,9 @@ const ContentImage$1 = /*@__PURE__*/ proxyCustomElement(class ContentImage exten
|
|
|
64
64
|
});
|
|
65
65
|
}, {
|
|
66
66
|
root: null,
|
|
67
|
-
|
|
68
|
-
rootMargin: `0px`,
|
|
69
|
-
threshold: 0
|
|
67
|
+
rootMargin: `${Math.max(100, window.innerHeight * 1)}px`,
|
|
68
|
+
// rootMargin: `0px`,
|
|
69
|
+
threshold: 0,
|
|
70
70
|
});
|
|
71
71
|
observer.observe(this.hostElement);
|
|
72
72
|
}
|
|
@@ -84,7 +84,7 @@ const ContentImage$1 = /*@__PURE__*/ proxyCustomElement(class ContentImage exten
|
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
86
|
render() {
|
|
87
|
-
return (h(Host, { class: `${this.activeLazyLoadClass} ${this.classString}`, style: this.inlineStyle, content: this.showContent }, this.hasMediaContent && (h("div", { class: "content-image__media-content" }, h("slot", { name: "mediaContent" }))), this.showVideoAsGif
|
|
87
|
+
return (h(Host, { class: `${this.activeLazyLoadClass} ${this.classString}`, style: this.inlineStyle, content: this.showContent }, this.hasMediaContent && (h("div", { class: "content-image__media-content" }, h("slot", { name: "mediaContent" }))), this.showVideoAsGif && (h("video", { autoplay: true, muted: true, loop: true, preload: "none", playsinline: true, width: this.width, height: this.height }, h("source", { src: this.lazyLoadIsComplete ? this.pictureImageSrc : null, type: this.videoType }))), this.pictureImageSrc && !this.showVideoAsGif && h("img", { width: this.width, height: this.height, src: this.pictureImageSrc, alt: this.alt })));
|
|
88
88
|
}
|
|
89
89
|
get hostElement() { return this; }
|
|
90
90
|
static get watchers() { return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"file":"content-image.js","mappings":";;;;AAAA,MAAM,eAAe,GAAG,uwBAAuwB;;MCclxBA,cAAY;;;;;wBAcK,IAAI;;;;qBA4BN,IAAI;sBASH,GAAG;;oBAgBK,OAAO;yBAMb,WAAW;2BAWP,YAAY;kCAEN,KAAK;8BACT,KAAK;mCACT,EAAE;2BACV,EAAE;2BAC0B,EAAE;+BACjB,KAAK;;;IAEzC,YAAY,CAAC,GAAG;QACd,OAAO,IAAI,OAAO,CAAC,CAAC;YAClB,MAAM,KAAK,GAAG,IAAI,KAAK,EAAE,CAAC;YAC1B,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;YACjB,KAAK,CAAC,OAAO,GAAG,CAAC,CAAC;YAClB,KAAK,CAAC,GAAG,GAAG,GAAG,CAAC;SACjB,CAAC,CAAC;KACJ;IAED,iBAAiB;QACf,IAAI,CAAC,eAAe,GAAG,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC,uBAAuB,CAAC,CAAC;QACjF,mBAAmB,CAAC,YAAY,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,SAAS,CAAC,QAAQ;YACnE,IAAI,CAAC,WAAW,mCAAQ,IAAI,CAAC,WAAW,KAAE,gBAAgB,EAAE,GAAG,QAAQ,EAAE,GAAE,CAAC;SAC7E,CAAC,CAAC;QACH,mBAAmB,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,SAAS,CAAC,QAAQ;YAC3D,IAAI,CAAC,GAAG,GAAG,QAAkB,CAAC;SAC/B,CAAC,CAAC;QACH,mBAAmB,CAAC,YAAY,CAAC,IAAI,CAA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AAE,MAAM,EAAE,IAAI,CAAC,MAAM,IAC1F,cAAQ,GAAG,EAAE,IAAI,CAAC,kBAAkB,GAAG,IAAI,CAAC,eAAe,GAAG,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,GAAI,CACtF,CACT,EACA,IAAI,CAAC,eAAe,IAAI,CAAC,IAAI,CAAC,cAAc,IAAI,WAAK,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,IAAI,CAAC,eAAe,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,GAAI,CACrI,EACP;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["ContentImage"],"sources":["src/elements/content-image/content-image.scss?tag=content-image","src/elements/content-image/content-image.tsx"],"sourcesContent":["content-image {\n display: block;\n height: auto;\n transition: opacity .3s;\n position: relative;\n &.content-image-loading {\n opacity: 0;\n }\n &.content-image-loaded {\n opacity: 1;\n }\n\n &[aspect-ratio] {\n img, picture, video {\n aspect-ratio: var(--aspect-ratio);\n object-fit: cover;\n }\n }\n img,\n picture,\n video {\n display: block;\n width: 100%;\n height: 100%;\n }\n\n .content-image__media-content {\n display: none;\n position: absolute;\n width: 100%;\n height: 100%;\n top: 0;\n left: 0;\n align-items: center;\n justify-content: center;\n overflow: hidden;\n [slot=\"mediaContent\"] {\n height: 100%;\n width: 100%;\n }\n }\n &[content=\"true\"] .content-image__media-content {\n display: flex;\n }\n}\n","import { Component, h, Host, Element, Prop, State, Watch } from '@stencil/core';\nimport { HostElement } from '@stencil/core/internal';\nimport { WindowResizeService } from '../../services/window-resize-service';\nimport { ResponsiveBoolean, ResponsiveNumber, ResponsiveString } from '../../typings';\nimport { breakpointValues, getCurrentValue, getValueAtIndex } from '../../utils/utils';\n\n/**\n * @slot mediaContent - Content displayed over media. If you want to reveal content on hover, use a tout block\n */\n@Component({\n tag: 'content-image',\n styleUrl: 'content-image.scss',\n shadow: false,\n})\nexport class ContentImage {\n @Element() hostElement: HostElement;\n /**\n * @type String\n * @responsive\n */\n @Prop({\n mutable: true,\n reflect: true,\n })\n classes: ResponsiveString;\n /**\n * @type Boolean\n */\n @Prop() lazyLoad: boolean = true;\n /**\n * @type Media\n * @responsive\n */\n @Prop({\n mutable: true,\n reflect: false,\n })\n src!: ResponsiveString;\n @State() activeSrc;\n /**\n * @type String\n * @responsive\n */\n @Prop({\n mutable: true,\n reflect: true,\n })\n alt: ResponsiveString;\n /**\n * @type Number\n * @responsive\n */\n @Prop({\n mutable: true,\n reflect: false,\n })\n width: ResponsiveNumber = '16';\n /**\n * @type Number\n * @responsive\n */\n @Prop({\n mutable: true,\n reflect: false,\n })\n height: ResponsiveNumber = '9';\n\n /**\n * @type String\n * @responsive\n */\n @Prop({\n mutable: true,\n reflect: false,\n })\n aspectRatio: ResponsiveString;\n /**\n * @type Select\n * @options image\n * @options video\n */\n @Prop() type?: 'image' | 'video' = 'image';\n\n /**\n * @type Select\n * @options video/mp4\n */\n @Prop() videoType?: string = 'video/mp4';\n\n /**\n * If true, the content in the mediaContent slot will be visible.\n * @type Boolean\n * @responsive\n */\n @Prop({\n mutable: true,\n reflect: true,\n })\n showContent: ResponsiveBoolean = 'false|true';\n\n @State() lazyLoadIsComplete: boolean = false;\n @State() showVideoAsGif: boolean = false;\n @State() activeLazyLoadClass = '';\n @State() classString = '';\n @State() inlineStyle?: { [key: string]: string } = {};\n @State() hasMediaContent: boolean = false;\n @State() pictureImageSrc: string;\n preloadImage(src) {\n return new Promise(r => {\n const image = new Image();\n image.onload = r;\n image.onerror = r;\n image.src = src;\n });\n }\n\n componentWillLoad() {\n this.hasMediaContent = !!this.hostElement.querySelector('[slot=\"mediaContent\"]');\n WindowResizeService.registerProp(this.aspectRatio).subscribe(newValue => {\n this.inlineStyle = { ...this.inlineStyle, '--aspect-ratio': `${newValue}` };\n });\n WindowResizeService.registerProp(this.alt).subscribe(newValue => {\n this.alt = newValue as string;\n });\n WindowResizeService.registerProp(this.height).subscribe(newValue => {\n this.height = newValue as string;\n });\n WindowResizeService.registerProp(this.showContent).subscribe(newValue => {\n this.showContent = newValue as string;\n });\n WindowResizeService.registerProp(this.classes).subscribe(newValue => {\n this.classString = `${newValue}`;\n });\n }\n\n componentDidLoad() {\n let observer = new IntersectionObserver(\n entries => {\n entries.forEach(async entry => {\n if (entry.isIntersecting) {\n this.lazyLoadIsComplete = true;\n this.pictureImageSrc = getCurrentValue(this.src);\n this.showVideoAsGif = this.pictureImageSrc.indexOf('.mp4') >= 0 || getCurrentValue(this.type) === 'video';\n }\n });\n },\n {\n root: null,\n rootMargin: `${Math.max(100, window.innerHeight * 1)}px`,\n // rootMargin: `0px`,\n threshold: 0,\n },\n );\n observer.observe(this.hostElement);\n }\n\n @Watch('lazyLoadIsComplete')\n watchLazyLoadIsComplete(newValue: boolean) {\n if (newValue === true) {\n this.activeLazyLoadClass = 'content-image-loaded';\n } else {\n if (!this.lazyLoad) {\n this.activeLazyLoadClass = 'content-image-no-lazyload';\n } else {\n this.activeLazyLoadClass = 'content-image-loading';\n }\n }\n }\n\n render() {\n return (\n <Host class={`${this.activeLazyLoadClass} ${this.classString}`} style={this.inlineStyle} content={this.showContent}>\n {this.hasMediaContent && (\n <div class=\"content-image__media-content\">\n <slot name=\"mediaContent\"></slot>\n </div>\n )}\n {this.showVideoAsGif && (\n <video autoplay muted loop preload=\"none\" playsinline width={this.width} height={this.height}>\n <source src={this.lazyLoadIsComplete ? this.pictureImageSrc : null} type={this.videoType} />\n </video>\n )}\n {this.pictureImageSrc && !this.showVideoAsGif && <img width={this.width} height={this.height} src={this.pictureImageSrc} alt={this.alt} />}\n </Host>\n );\n }\n}\n"],"version":3}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, h, Host } from '@stencil/core/internal/client';
|
|
2
2
|
import { W as WindowResizeService } from './window-resize-service.js';
|
|
3
|
+
import { c as createFocusTrap } from './focus-trap.esm.js';
|
|
3
4
|
|
|
4
|
-
const contentNavigationBlockCss = "*{box-sizing:border-box}body.content-navigation-block-open{overflow:hidden}content-navigation-block[hamburger=fixed],content-navigation-block[hamburger=absolute],content-navigation-block[hamburger=static]{display:inline-block}content-navigation-block[hamburger=fixed][aria-expanded=false]
|
|
5
|
+
const contentNavigationBlockCss = "*{box-sizing:border-box}body.content-navigation-block-open{overflow:hidden}content-navigation-block button{appearance:none;border:none;background:transparent;cursor:pointer}content-navigation-block .content-navigation-block__skip-content a,content-navigation-block .content-navigation-block__skip-content button,content-navigation-block .content-navigation-block__skip-content a:visited,content-navigation-block .content-navigation-block__skip-content button:visited{border:2px solid rgb(0, 0, 0);border-radius:2px;color:purple;cursor:pointer;display:inline-block;font-size:14px;line-height:20px;margin:6px 11px;min-height:32px;text-decoration:underline;text-align:center;width:106px;z-index:1000}content-navigation-block .content-navigation-block__skip-content a:not(:focus),content-navigation-block .content-navigation-block__skip-content button:not(:focus),content-navigation-block .content-navigation-block__skip-content a:visited:not(:focus),content-navigation-block .content-navigation-block__skip-content button:visited:not(:focus){position:absolute;clip:rect(1px, 1px, 1px, 1px);overflow:hidden;padding:0}content-navigation-block svg.default-icon{display:inline-block;width:32px}content-navigation-block[hamburger=fixed],content-navigation-block[hamburger=absolute],content-navigation-block[hamburger=static]{display:inline-block}content-navigation-block[hamburger=fixed][aria-expanded=false] .content-navigation__close,content-navigation-block[hamburger=absolute][aria-expanded=false] .content-navigation__close,content-navigation-block[hamburger=static][aria-expanded=false] .content-navigation__close{display:none}content-navigation-block[hamburger=fixed] .content-navigation__open,content-navigation-block[hamburger=fixed] .content-navigation__close,content-navigation-block[hamburger=absolute] .content-navigation__open,content-navigation-block[hamburger=absolute] .content-navigation__close,content-navigation-block[hamburger=static] .content-navigation__open,content-navigation-block[hamburger=static] .content-navigation__close{cursor:pointer}content-navigation-block[hamburger=fixed] .content-navigation__content-wrapper,content-navigation-block[hamburger=absolute] .content-navigation__content-wrapper,content-navigation-block[hamburger=static] .content-navigation__content-wrapper{display:none;background:white}content-navigation-block[hamburger=fixed] .content-navigation__content-wrapper[hidden=false],content-navigation-block[hamburger=absolute] .content-navigation__content-wrapper[hidden=false],content-navigation-block[hamburger=static] .content-navigation__content-wrapper[hidden=false]{display:block}content-navigation-block[hamburger=fixed] .content-navigation__content-wrapper{position:fixed;left:0;top:0;width:100vw;height:100vh;z-index:100}content-navigation-block[hamburger=sticky] .content-navigation__content-wrapper{position:sticky;left:0;top:0;width:100vw;height:100vh;z-index:100}content-navigation-block[hamburger=absolute] .content-navigation__content-wrapper{position:absolute;z-index:100}content-navigation-block[hamburger=static] .content-navigation__content-wrapper{position:static}content-navigation-block[hamburger=none]{display:block}content-navigation-block[hamburger=none] .content-navigation__open,content-navigation-block[hamburger=none] .content-navigation__close{display:none}content-navigation-block[aria-expanded=true] .content-navigation__content-wrapper{display:block}";
|
|
5
6
|
|
|
6
7
|
const ContentNavigationBlock$1 = /*@__PURE__*/ proxyCustomElement(class ContentNavigationBlock extends HTMLElement {
|
|
7
8
|
constructor() {
|
|
@@ -12,6 +13,12 @@ const ContentNavigationBlock$1 = /*@__PURE__*/ proxyCustomElement(class ContentN
|
|
|
12
13
|
this.classString = undefined;
|
|
13
14
|
this.ariaExpanded = 'false';
|
|
14
15
|
this.bodyToggle = false;
|
|
16
|
+
this.skipAccessibilityMessage = undefined;
|
|
17
|
+
this.hasOpenButton = false;
|
|
18
|
+
this.hasCloseButton = false;
|
|
19
|
+
this.openButton = undefined;
|
|
20
|
+
this.closeButton = undefined;
|
|
21
|
+
this.contentSlot = undefined;
|
|
15
22
|
}
|
|
16
23
|
componentWillLoad() {
|
|
17
24
|
WindowResizeService.registerProp(this.hamburger).subscribe(newValue => {
|
|
@@ -24,33 +31,43 @@ const ContentNavigationBlock$1 = /*@__PURE__*/ proxyCustomElement(class ContentN
|
|
|
24
31
|
});
|
|
25
32
|
}
|
|
26
33
|
componentDidLoad() {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
34
|
+
this.hasOpenButton = !!this.hostElement.querySelector('[slot="openButton"]');
|
|
35
|
+
this.hasCloseButton = !!this.hostElement.querySelector('content-navigation-block-close');
|
|
36
|
+
this.openButton.onclick = () => {
|
|
37
|
+
this.openMenu();
|
|
38
|
+
};
|
|
39
|
+
this.closeButton.onclick = () => {
|
|
40
|
+
this.closeMenu();
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
openMenu() {
|
|
44
|
+
this.ariaExpanded = this.ariaExpanded === 'true' ? 'false' : 'true';
|
|
45
|
+
if (this.ariaExpanded === 'false') {
|
|
46
|
+
document.body.classList.remove('content-navigation-block-open');
|
|
47
|
+
}
|
|
48
|
+
else if (this.bodyToggle) {
|
|
49
|
+
document.body.classList.add('content-navigation-block-open');
|
|
42
50
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
51
|
+
this.focusTrap = createFocusTrap(this.contentSlot.parentElement, {
|
|
52
|
+
fallbackFocus: this.hostElement,
|
|
53
|
+
clickOutsideDeactivates: true,
|
|
54
|
+
onDeactivate: () => {
|
|
55
|
+
this.closeMenu();
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
setTimeout(() => this.closeButton.focus(), 1);
|
|
59
|
+
}
|
|
60
|
+
closeMenu() {
|
|
61
|
+
if (this.focusTrap) {
|
|
62
|
+
this.focusTrap.deactivate();
|
|
63
|
+
this.focusTrap = null;
|
|
50
64
|
}
|
|
65
|
+
this.ariaExpanded = 'false';
|
|
66
|
+
document.body.classList.remove('content-navigation-block-open');
|
|
67
|
+
setTimeout(() => this.openButton.focus(), 1);
|
|
51
68
|
}
|
|
52
69
|
render() {
|
|
53
|
-
return (h(Host, { class: this.classString, "aria-expanded": this.ariaExpanded }, h("slot", { name: "openButton" }), h("slot", { name: "closeButton" }), h("div", { class: "content-
|
|
70
|
+
return (h(Host, { class: this.classString, "aria-expanded": this.ariaExpanded }, h("div", { class: "content-navigation-block__skip-content" }, h("slot", { name: "skipContent" })), h("div", { ref: el => (this.openButton = el), class: "content-navigation__open" }, !this.hasOpenButton && (h("button", null, h("svg", { class: "default-icon", xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", "stroke-width": "1.5", stroke: "currentColor" }, h("path", { "stroke-linecap": "round", "stroke-linejoin": "round", d: "M3.75 6.75h16.5M3.75 12h16.5m-16.5 5.25h16.5" })))), h("slot", { name: "openButton" })), h("div", { class: "content-navigation__content-wrapper" }, h("div", { ref: el => (this.closeButton = el), class: "content-navigation__close" }, !this.hasCloseButton && (h("button", null, h("svg", { class: "default-icon", xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", "stroke-width": "1.5", stroke: "currentColor" }, h("path", { "stroke-linecap": "round", "stroke-linejoin": "round", d: "M6 18 18 6M6 6l12 12" }))))), h("div", { class: "content-navigation__content", ref: el => (this.contentSlot = el) }, h("slot", { name: "closeButton" }), h("slot", { name: "content" }), h("slot", null)))));
|
|
54
71
|
}
|
|
55
72
|
get hostElement() { return this; }
|
|
56
73
|
static get style() { return contentNavigationBlockCss; }
|
|
@@ -59,7 +76,13 @@ const ContentNavigationBlock$1 = /*@__PURE__*/ proxyCustomElement(class ContentN
|
|
|
59
76
|
"classes": [1537],
|
|
60
77
|
"classString": [32],
|
|
61
78
|
"ariaExpanded": [32],
|
|
62
|
-
"bodyToggle": [32]
|
|
79
|
+
"bodyToggle": [32],
|
|
80
|
+
"skipAccessibilityMessage": [32],
|
|
81
|
+
"hasOpenButton": [32],
|
|
82
|
+
"hasCloseButton": [32],
|
|
83
|
+
"openButton": [32],
|
|
84
|
+
"closeButton": [32],
|
|
85
|
+
"contentSlot": [32]
|
|
63
86
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O,EAAE;oBACjC,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,+BAA+B,CAAC,CAAC;iBACjE;qBAAM,IAAI,IAAI,CAAC,UAAU,EAAE;oBAC1B,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,+BAA+B,CAAC,CAAC;iBAC9D;gBACD,UAAU,CAAC,MAAM,WAAW,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC;aAC1C,CAAC;SACH;QACD,IAAI,WAAW,EAAE;YACf,WAAW,CAAC,OAAO,GAAG;gBACpB,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC;gBAC5B,OAAO,CAAC,YAAY,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;gBACvC,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,+BAA+B,CAAC,CAAC;gBAChE,UAAU,CAAC,MAAM,UAAU,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC;aACzC,CAAC;SACH;KACF;IAED,MAAM;QACJ,QACE,EAAC,IAAI,IAAC,KAAK,EAAE,IAAI,CAAC,WAAW,mBAAiB,IAAI,CAAC,YAAY,IAC7D,YAAM,IAAI,EAAC,YAAY,GAAQ,EAC/B,YAAM,IAAI,EAAC,aAAa,GAAQ,EAChC,WAAK,KAAK,EAAC,0BAA0B,IACnC,YAAM,IAAI,EAAC,SAAS,GAAQ,EAC5B,eAAa,CACT,CACD,EACP;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["ContentNavigationBlock"],"sources":["src/components/content-navigation-block/content-navigation-block.scss?tag=content-navigation-block","src/components/content-navigation-block/content-navigation-block.tsx"],"sourcesContent":["body.content-navigation-block-open {\n overflow: hidden;\n}\ncontent-navigation-block {\n &[hamburger=\"fixed\"],\n &[hamburger=\"absolute\"],\n &[hamburger=\"static\"] {\n display: inline-block;\n &[aria-expanded=\"false\"] {\n [slot=\"closeButton\"] {\n display: none;\n }\n }\n [slot=\"openButton\"],\n [slot=\"closeButton\"] {\n cursor: pointer;\n }\n \n [slot=\"content\"] {\n display: none;\n background: white;\n &[hidden=\"false\"] {\n display: block;\n }\n }\n }\n\n &[hamburger=\"fixed\"] {\n [slot=\"content\"] {\n position: fixed;\n left: 0;\n top: 0;\n width: 100vw;\n height: 100%;\n z-index: 100;\n }\n }\n &[hamburger=\"absolute\"] {\n [slot=\"content\"] {\n position: absolute;\n z-index: 100;\n }\n }\n &[hamburger=\"static\"] {\n [slot=\"content\"] {\n position: static;\n }\n }\n \n &[hamburger=\"none\"] {\n display: block;\n [slot=\"openButton\"],\n [slot=\"closeButton\"] {\n display: none;\n }\n }\n}","import { Component, Prop, Host, h, State, Element } from '@stencil/core';\nimport { HTMLStencilElement } from '@stencil/core/internal';\nimport { WindowResizeService } from '../../services/window-resize-service';\nimport { ResponsiveString } from '../../typings';\n\n/**\n * @slot openButton - This slot will expand the navigation when clicked.\n * @slot closeButton - This slot will close the navigation when clicked.\n * @slot content - Default slot\n */\n@Component({\n tag: 'content-navigation-block',\n styleUrl: 'content-navigation-block.scss',\n shadow: false,\n})\nexport class ContentNavigationBlock {\n /**\n * @type Select\n * @responsive\n * @options fixed\n * @options absolute\n * @options static\n * @options none\n */\n @Prop({\n mutable: true,\n reflect: true,\n })\n hamburger: ResponsiveString = 'fixed|none';\n\n /**\n * @type String\n * @responsive\n */\n @Prop({\n mutable: true,\n reflect: true,\n })\n classes: ResponsiveString;\n @State() classString;\n @Element() hostElement: HTMLStencilElement;\n @State() ariaExpanded: string = 'false';\n @State() bodyToggle: boolean = false;\n\n componentWillLoad() {\n WindowResizeService.registerProp(this.hamburger).subscribe(newValue => {\n this.hamburger = newValue as string;\n this.bodyToggle = this.hamburger === 'fixed';\n document.body.classList.remove('content-navigation-block-open');\n });\n WindowResizeService.registerProp(this.classes).subscribe(newValue => {\n this.classString = newValue as string;\n });\n }\n\n componentDidLoad() {\n let openButton = this.hostElement.querySelector('[slot=\"openButton\"]') as HTMLElement;\n let closeButton = this.hostElement.querySelector('[slot=\"closeButton\"]') as HTMLElement;\n let content = this.hostElement.querySelector('[slot=\"content\"]') as HTMLElement;\n if (openButton) {\n openButton.onclick = () => {\n this.ariaExpanded = this.ariaExpanded === 'true' ? 'false' : 'true';\n content.setAttribute('hidden', this.ariaExpanded === 'false' ? 'true' : 'false');\n if (this.ariaExpanded === 'false') {\n document.body.classList.remove('content-navigation-block-open');\n } else if (this.bodyToggle) {\n document.body.classList.add('content-navigation-block-open');\n }\n setTimeout(() => closeButton.focus(), 1);\n };\n }\n if (closeButton) {\n closeButton.onclick = () => {\n this.ariaExpanded = 'false';\n content.setAttribute('hidden', 'true');\n document.body.classList.remove('content-navigation-block-open');\n setTimeout(() => openButton.focus(), 1);\n };\n }\n }\n\n render() {\n return (\n <Host class={this.classString} aria-expanded={this.ariaExpanded}>\n <slot name=\"openButton\"></slot>\n <slot name=\"closeButton\"></slot>\n <div class=\"content-navigation__menu\">\n <slot name=\"content\"></slot>\n <slot></slot>\n </div>\n </Host>\n );\n }\n}\n"],"version":3}
|
|
1
|
+
{"file":"content-navigation-block.js","mappings":";;;;AAAA,MAAM,yBAAyB,GAAG,k2GAAk2G;;MCiBv3GA,wBAAsB;;;;yBAcH,YAAY;;;4BAaV,OAAO;0BACR,KAAK;;6BAGF,KAAK;8BACJ,KAAK;;;;;IAMxC,iBAAiB;QACf,mBAAmB,CAAC,YAAY,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,QAAQ;YACjE,IAAI,CAAC,SAAS,GAAG,QAAkB,CAAC;YACpC,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,SAAS,KAAK,OAAO,CAAC;YAC7C,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,+BAA+B,CAAC,CAAC;SACjE,CAAC,CAAC;QACH,mBAAmB,CAAC,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,SAAS,CAAC,QAAQ;YAC/D,IAAI,CAAC,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6B,EAAC,GAAG,EAAE,EAAE,KAAK,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC,IACzE,YAAM,IAAI,EAAC,aAAa,GAAQ,EAChC,YAAM,IAAI,EAAC,SAAS,GAAQ,EAC5B,eAAa,CACT,CACF,CACD,EACP;KACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","names":["ContentNavigationBlock"],"sources":["src/components/content-navigation-block/content-navigation-block.scss?tag=content-navigation-block","src/components/content-navigation-block/content-navigation-block.tsx"],"sourcesContent":["body.content-navigation-block-open {\n overflow: hidden;\n}\ncontent-navigation-block {\n button {\n appearance: none;\n border: none;\n background: transparent;\n cursor: pointer;\n }\n \n .content-navigation-block__skip-content a, .content-navigation-block__skip-content button, .content-navigation-block__skip-content a:visited, .content-navigation-block__skip-content button:visited{\n border: 2px solid rgba(0,0,0, 1);\n border-radius: 2px;\n color: purple;\n cursor: pointer;\n display: inline-block;\n font-size: 14px;\n line-height: 20px;\n margin: 6px 11px;\n min-height: 32px;\n text-decoration: underline;\n text-align: center;\n width: 106px;\n z-index: 1000;\n &:not(:focus) {\n position: absolute;\n // z-index: -1;\n\n clip: rect(1px,1px,1px,1px);\n overflow: hidden;\n padding: 0;\n }\n }\n\n svg.default-icon {\n display: inline-block;\n width: 32px;\n }\n &[hamburger=\"fixed\"],\n &[hamburger=\"absolute\"],\n &[hamburger=\"static\"] {\n display: inline-block;\n &[aria-expanded=\"false\"] {\n .content-navigation__close {\n display: none;\n }\n }\n .content-navigation__open,\n .content-navigation__close {\n cursor: pointer;\n }\n \n .content-navigation__content-wrapper {\n display: none;\n background: white;\n &[hidden=\"false\"] {\n display: block;\n }\n }\n }\n\n &[hamburger=\"fixed\"] {\n .content-navigation__content-wrapper {\n position: fixed;\n left: 0;\n top: 0;\n width: 100vw;\n height: 100vh;\n z-index: 100;\n }\n }\n &[hamburger=\"sticky\"] {\n .content-navigation__content-wrapper {\n position: sticky;\n left: 0;\n top: 0;\n width: 100vw;\n height: 100vh;\n z-index: 100;\n }\n }\n &[hamburger=\"absolute\"] {\n .content-navigation__content-wrapper {\n position: absolute;\n z-index: 100;\n }\n }\n &[hamburger=\"static\"] {\n .content-navigation__content-wrapper {\n position: static;\n }\n }\n \n &[hamburger=\"none\"] {\n display: block;\n .content-navigation__open,\n .content-navigation__close {\n display: none;\n }\n }\n\n &[aria-expanded=\"true\"] {\n .content-navigation__content-wrapper {\n display: block;\n }\n }\n}","import { Component, Prop, Host, h, State, Element } from '@stencil/core';\nimport { HTMLStencilElement } from '@stencil/core/internal';\nimport { WindowResizeService } from '../../services/window-resize-service';\nimport { ResponsiveString } from '../../typings';\nimport { createFocusTrap } from 'focus-trap';\n\n/**\n * @slot openButton - This slot will expand the navigation when clicked.\n * @slot closeButton - This slot will close the navigation when clicked.\n * @slot skipContent - This slot is a keyboard-focus link that lets a screen-reader or keyboard user skip the navigation block and scroll to the end.\n * @slot content - Default slot\n */\n@Component({\n tag: 'content-navigation-block',\n styleUrl: 'content-navigation-block.scss',\n shadow: false,\n})\nexport class ContentNavigationBlock {\n /**\n * @type Select\n * @responsive\n * @options fixed\n * @options absolute\n * @options sticky\n * @options static\n * @options none\n */\n @Prop({\n mutable: true,\n reflect: true,\n })\n hamburger: ResponsiveString = 'fixed|none';\n\n /**\n * @type String\n * @responsive\n */\n @Prop({\n mutable: true,\n reflect: true,\n })\n classes: ResponsiveString;\n @State() classString;\n @Element() hostElement: HTMLStencilElement;\n @State() ariaExpanded: string = 'false';\n @State() bodyToggle: boolean = false;\n @State() skipAccessibilityMessage: HTMLElement;\n\n @State() hasOpenButton: boolean = false;\n @State() hasCloseButton: boolean = false;\n\n @State() openButton: HTMLElement;\n @State() closeButton: HTMLElement;\n @State() contentSlot: HTMLElement;\n focusTrap;\n componentWillLoad() {\n WindowResizeService.registerProp(this.hamburger).subscribe(newValue => {\n this.hamburger = newValue as string;\n this.bodyToggle = this.hamburger === 'fixed';\n document.body.classList.remove('content-navigation-block-open');\n });\n WindowResizeService.registerProp(this.classes).subscribe(newValue => {\n this.classString = newValue as string;\n });\n }\n\n componentDidLoad() {\n this.hasOpenButton = !!this.hostElement.querySelector('[slot=\"openButton\"]');\n this.hasCloseButton = !!this.hostElement.querySelector('content-navigation-block-close');\n this.openButton.onclick = () => {\n this.openMenu();\n };\n this.closeButton.onclick = () => {\n this.closeMenu();\n };\n }\n\n openMenu() {\n this.ariaExpanded = this.ariaExpanded === 'true' ? 'false' : 'true';\n if (this.ariaExpanded === 'false') {\n document.body.classList.remove('content-navigation-block-open');\n } else if (this.bodyToggle) {\n document.body.classList.add('content-navigation-block-open');\n }\n this.focusTrap = createFocusTrap(this.contentSlot.parentElement, {\n fallbackFocus: this.hostElement,\n clickOutsideDeactivates: true,\n onDeactivate: () => {\n this.closeMenu();\n },\n });\n\n setTimeout(() => this.closeButton.focus(), 1);\n }\n closeMenu() {\n if (this.focusTrap) {\n this.focusTrap.deactivate();\n this.focusTrap = null;\n }\n this.ariaExpanded = 'false';\n document.body.classList.remove('content-navigation-block-open');\n setTimeout(() => this.openButton.focus(), 1);\n }\n\n render() {\n return (\n <Host class={this.classString} aria-expanded={this.ariaExpanded}>\n <div class=\"content-navigation-block__skip-content\">\n <slot name=\"skipContent\"></slot>\n </div>\n <div ref={el => (this.openButton = el)} class=\"content-navigation__open\">\n {!this.hasOpenButton && (\n <button>\n <svg class=\"default-icon\" xmlns=\"http://www.w3.org/2000/svg\" fill=\"none\" viewBox=\"0 0 24 24\" stroke-width=\"1.5\" stroke=\"currentColor\">\n <path stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M3.75 6.75h16.5M3.75 12h16.5m-16.5 5.25h16.5\" />\n </svg>\n </button>\n )}\n <slot name=\"openButton\"></slot>\n </div>\n <div class=\"content-navigation__content-wrapper\">\n <div ref={el => (this.closeButton = el)} class=\"content-navigation__close\">\n {!this.hasCloseButton && (\n <button>\n <svg class=\"default-icon\" xmlns=\"http://www.w3.org/2000/svg\" fill=\"none\" viewBox=\"0 0 24 24\" stroke-width=\"1.5\" stroke=\"currentColor\">\n <path stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M6 18 18 6M6 6l12 12\" />\n </svg>\n </button>\n )}\n </div>\n <div class=\"content-navigation__content\" ref={el => (this.contentSlot = el)}>\n <slot name=\"closeButton\"></slot>\n <slot name=\"content\"></slot>\n <slot></slot>\n </div>\n </div>\n </Host>\n );\n }\n}\n"],"version":3}
|