@content-blocks/js 0.4.4 → 0.6.0
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 +97 -84
- package/dist/cjs/content-accordion_11.cjs.entry.js.map +1 -1
- package/dist/cjs/content-blocks.cjs.js +3 -3
- package/dist/cjs/content-blocks.cjs.js.map +1 -1
- package/dist/cjs/content-carousel.cjs.entry.js +3 -2
- package/dist/cjs/content-carousel.cjs.entry.js.map +1 -1
- package/dist/cjs/content-navigation-block.cjs.entry.js +31 -29
- package/dist/cjs/content-navigation-block.cjs.entry.js.map +1 -1
- package/dist/cjs/content-split-block.cjs.entry.js +6 -6
- package/dist/cjs/content-split-block.cjs.entry.js.map +1 -1
- package/dist/cjs/content-tabs.cjs.entry.js +8 -6
- package/dist/cjs/content-tabs.cjs.entry.js.map +1 -1
- package/dist/cjs/{index-66c390bf.js → index-9f20d89a.js} +34 -14
- package/dist/cjs/index-9f20d89a.js.map +1 -0
- package/dist/cjs/index.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/{utils-dbda9bbc.js → utils-db61cd70.js} +12 -4
- package/dist/cjs/utils-db61cd70.js.map +1 -0
- package/dist/cjs/{window-resize-service-35e2ab31.js → window-resize-service-ac5c2012.js} +4 -3
- package/dist/cjs/window-resize-service-ac5c2012.js.map +1 -0
- package/dist/collection/blocks/content-hero-block/content-hero-block.css +6 -4
- package/dist/collection/blocks/content-hero-block/content-hero-block.js +2 -4
- package/dist/collection/blocks/content-hero-block/content-hero-block.js.map +1 -1
- package/dist/collection/blocks/content-split-block/content-split-block.css +0 -4
- package/dist/collection/blocks/content-split-block/content-split-block.js +2 -2
- package/dist/collection/blocks/content-split-block/content-split-block.js.map +1 -1
- package/dist/collection/blocks/content-text-block/content-text-block.css +0 -4
- package/dist/collection/blocks/content-text-block/content-text-block.js +7 -7
- package/dist/collection/blocks/content-text-block/content-text-block.js.map +1 -1
- package/dist/collection/blocks/content-tout-block/content-tout-block.css +0 -6
- package/dist/collection/blocks/content-tout-block/content-tout-block.js +0 -2
- package/dist/collection/blocks/content-tout-block/content-tout-block.js.map +1 -1
- package/dist/collection/collection-manifest.json +2 -2
- package/dist/collection/components/content-accordion/content-accordion.js +2 -2
- package/dist/collection/components/content-accordion/content-accordion.js.map +1 -1
- package/dist/collection/components/content-accordion/libraries/w3_disclosure_button.js.map +1 -1
- package/dist/collection/components/content-carousel/content-carousel.css +0 -4
- package/dist/collection/components/content-carousel/content-carousel.js +2 -1
- package/dist/collection/components/content-carousel/content-carousel.js.map +1 -1
- package/dist/collection/components/content-navigation-block/content-navigation-block.css +0 -6
- package/dist/collection/components/content-navigation-block/content-navigation-block.js +27 -25
- package/dist/collection/components/content-navigation-block/content-navigation-block.js.map +1 -1
- package/dist/collection/components/content-overlay/content-overlay.css +6 -9
- package/dist/collection/components/content-overlay/content-overlay.js +34 -16
- package/dist/collection/components/content-overlay/content-overlay.js.map +1 -1
- package/dist/collection/components/content-overlay/libraries/aria-dialog.js.map +1 -1
- package/dist/collection/components/content-overlay/libraries/aria-utilities.js.map +1 -1
- package/dist/collection/components/content-tabs/content-tabs.css +0 -4
- package/dist/collection/components/content-tabs/content-tabs.js +4 -2
- package/dist/collection/components/content-tabs/content-tabs.js.map +1 -1
- package/dist/collection/components/content-tabs/libraries/w3_tabs.js.map +1 -1
- package/dist/collection/elements/content-button/content-button.css +0 -4
- package/dist/collection/elements/content-button/content-button.js +12 -11
- package/dist/collection/elements/content-button/content-button.js.map +1 -1
- package/dist/collection/elements/content-image/content-image.css +4 -11
- package/dist/collection/elements/content-image/content-image.js +81 -23
- package/dist/collection/elements/content-image/content-image.js.map +1 -1
- package/dist/collection/elements/content-line/content-line.js +10 -14
- package/dist/collection/elements/content-line/content-line.js.map +1 -1
- package/dist/collection/elements/content-video/content-video.css +1 -5
- package/dist/collection/elements/content-video/content-video.js +1 -1
- package/dist/collection/elements/content-video/content-video.js.map +1 -1
- package/dist/collection/formatters/content-grid-formatter/content-grid-formatter.css +1 -4
- package/dist/collection/formatters/content-grid-formatter/content-grid-formatter.js +46 -3
- package/dist/collection/formatters/content-grid-formatter/content-grid-formatter.js.map +1 -1
- package/dist/collection/formatters/content-spacer/content-spacer.css +0 -3
- package/dist/collection/formatters/content-spacer/content-spacer.js +4 -3
- package/dist/collection/formatters/content-spacer/content-spacer.js.map +1 -1
- package/dist/collection/services/content-events-service.js.map +1 -1
- package/dist/collection/services/window-resize-service.js +2 -1
- package/dist/collection/services/window-resize-service.js.map +1 -1
- package/dist/collection/stories/ContentHeroBlock.stories.js +22 -18
- package/dist/collection/stories/ContentHeroBlock.stories.js.map +1 -1
- package/dist/collection/stories/ContentNavigationBlock.stories.js +26 -0
- package/dist/collection/stories/ContentNavigationBlock.stories.js.map +1 -0
- package/dist/collection/stories/ContentSpacer.stories.js +20 -0
- package/dist/collection/stories/ContentSpacer.stories.js.map +1 -0
- package/dist/collection/stories/ContentTextBlock.stories.js +17 -0
- package/dist/collection/stories/ContentTextBlock.stories.js.map +1 -0
- package/dist/collection/stories/ContentToutBlock.stories.js +17 -0
- package/dist/collection/stories/ContentToutBlock.stories.js.map +1 -0
- package/dist/collection/stories/FullPageExample.stories.js +482 -0
- package/dist/collection/stories/FullPageExample.stories.js.map +1 -0
- package/dist/collection/utils/utils.js +9 -0
- package/dist/collection/utils/utils.js.map +1 -1
- package/dist/components/content-accordion.js +1 -1
- package/dist/components/content-accordion.js.map +1 -1
- package/dist/components/content-button.js +13 -12
- package/dist/components/content-button.js.map +1 -1
- package/dist/components/content-carousel.js +2 -1
- package/dist/components/content-carousel.js.map +1 -1
- package/dist/components/content-grid-formatter2.js +8 -2
- package/dist/components/content-grid-formatter2.js.map +1 -1
- package/dist/components/content-hero-block.js +2 -4
- package/dist/components/content-hero-block.js.map +1 -1
- package/dist/components/content-image.js +28 -24
- package/dist/components/content-image.js.map +1 -1
- package/dist/components/content-line.js +8 -12
- package/dist/components/content-line.js.map +1 -1
- package/dist/components/content-navigation-block.js +28 -26
- package/dist/components/content-navigation-block.js.map +1 -1
- package/dist/components/content-overlay.js +32 -14
- 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/content-split-block.js +3 -3
- package/dist/components/content-split-block.js.map +1 -1
- package/dist/components/content-tabs.js +5 -3
- package/dist/components/content-tabs.js.map +1 -1
- package/dist/components/content-text-block.js +8 -8
- package/dist/components/content-text-block.js.map +1 -1
- package/dist/components/content-tout-block.js +1 -3
- package/dist/components/content-tout-block.js.map +1 -1
- package/dist/components/content-video.js +1 -1
- package/dist/components/content-video.js.map +1 -1
- package/dist/components/utils.js +12 -2
- package/dist/components/utils.js.map +1 -1
- package/dist/components/window-resize-service.js +2 -1
- 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/index.esm.js +1 -1
- package/dist/content-blocks/p-167a9155.entry.js +2 -0
- package/dist/content-blocks/p-167a9155.entry.js.map +1 -0
- package/dist/content-blocks/{p-3d21ae2b.entry.js → p-271fb304.entry.js} +2 -2
- package/dist/content-blocks/p-271fb304.entry.js.map +1 -0
- package/dist/content-blocks/p-288eace9.js +3 -0
- package/dist/content-blocks/p-288eace9.js.map +1 -0
- package/dist/content-blocks/p-4038cd42.entry.js +10 -0
- package/dist/content-blocks/p-4038cd42.entry.js.map +1 -0
- package/dist/content-blocks/p-4bfbd7ef.entry.js +2 -0
- package/dist/content-blocks/p-4bfbd7ef.entry.js.map +1 -0
- package/dist/content-blocks/p-8cc22c1e.entry.js +2 -0
- package/dist/content-blocks/p-8cc22c1e.entry.js.map +1 -0
- package/dist/content-blocks/{p-070bc93d.js → p-b04fe808.js} +2 -2
- package/dist/content-blocks/p-b04fe808.js.map +1 -0
- package/dist/content-blocks/{p-451e7694.js → p-cfb4593f.js} +2 -2
- package/dist/content-blocks/p-cfb4593f.js.map +1 -0
- package/dist/esm/content-accordion_11.entry.js +97 -84
- package/dist/esm/content-accordion_11.entry.js.map +1 -1
- package/dist/esm/content-blocks.js +4 -4
- package/dist/esm/content-blocks.js.map +1 -1
- package/dist/esm/content-carousel.entry.js +3 -2
- package/dist/esm/content-carousel.entry.js.map +1 -1
- package/dist/esm/content-navigation-block.entry.js +31 -29
- package/dist/esm/content-navigation-block.entry.js.map +1 -1
- package/dist/esm/content-split-block.entry.js +6 -6
- package/dist/esm/content-split-block.entry.js.map +1 -1
- package/dist/esm/content-tabs.entry.js +8 -6
- package/dist/esm/content-tabs.entry.js.map +1 -1
- package/dist/esm/{index-2674652b.js → index-e848c048.js} +34 -14
- package/dist/esm/index-e848c048.js.map +1 -0
- package/dist/esm/index.js +1 -1
- package/dist/esm/loader.js +3 -3
- package/dist/esm/{utils-72b3a8bd.js → utils-4f78228e.js} +13 -3
- package/dist/esm/utils-4f78228e.js.map +1 -0
- package/dist/esm/{window-resize-service-8419bd19.js → window-resize-service-f40ec51c.js} +4 -3
- package/dist/esm/window-resize-service-f40ec51c.js.map +1 -0
- package/dist/types/blocks/content-hero-block/content-hero-block.d.ts +0 -1
- package/dist/types/blocks/content-split-block/content-split-block.d.ts +1 -1
- package/dist/types/blocks/content-text-block/content-text-block.d.ts +1 -1
- package/dist/types/blocks/content-tout-block/content-tout-block.d.ts +0 -1
- package/dist/types/components/content-accordion/content-accordion.d.ts +6 -6
- package/dist/types/components/content-navigation-block/content-navigation-block.d.ts +2 -2
- package/dist/types/components/content-overlay/content-overlay.d.ts +4 -3
- package/dist/types/components/content-tabs/content-tabs.d.ts +1 -0
- package/dist/types/components.d.ts +37 -3
- package/dist/types/elements/content-button/content-button.d.ts +1 -1
- package/dist/types/elements/content-image/content-image.d.ts +13 -1
- package/dist/types/elements/content-line/content-line.d.ts +1 -1
- package/dist/types/formatters/content-grid-formatter/content-grid-formatter.d.ts +8 -2
- package/dist/types/formatters/content-spacer/content-spacer.d.ts +1 -1
- package/dist/types/stories/ContentHeroBlock.stories.d.ts +4 -5
- package/dist/types/stories/ContentNavigationBlock.stories.d.ts +11 -0
- package/dist/types/stories/ContentSpacer.stories.d.ts +15 -0
- package/dist/types/stories/ContentTextBlock.stories.d.ts +15 -0
- package/dist/types/stories/ContentToutBlock.stories.d.ts +9 -0
- package/dist/types/stories/FullPageExample.stories.d.ts +10 -0
- package/dist/types/typings.d.ts +3 -3
- package/dist/types/utils/utils.d.ts +1 -0
- package/package.json +6 -3
- package/dist/cjs/index-66c390bf.js.map +0 -1
- package/dist/cjs/utils-dbda9bbc.js.map +0 -1
- package/dist/cjs/window-resize-service-35e2ab31.js.map +0 -1
- package/dist/content-blocks/p-070bc93d.js.map +0 -1
- package/dist/content-blocks/p-171693ef.js +0 -3
- package/dist/content-blocks/p-171693ef.js.map +0 -1
- package/dist/content-blocks/p-3d21ae2b.entry.js.map +0 -1
- package/dist/content-blocks/p-3e27514e.entry.js +0 -10
- package/dist/content-blocks/p-3e27514e.entry.js.map +0 -1
- package/dist/content-blocks/p-451e7694.js.map +0 -1
- package/dist/content-blocks/p-6ddbb176.entry.js +0 -2
- package/dist/content-blocks/p-6ddbb176.entry.js.map +0 -1
- package/dist/content-blocks/p-a78f9c91.entry.js +0 -2
- package/dist/content-blocks/p-a78f9c91.entry.js.map +0 -1
- package/dist/content-blocks/p-dac292e3.entry.js +0 -2
- package/dist/content-blocks/p-dac292e3.entry.js.map +0 -1
- package/dist/esm/index-2674652b.js.map +0 -1
- package/dist/esm/utils-72b3a8bd.js.map +0 -1
- package/dist/esm/window-resize-service-8419bd19.js.map +0 -1
|
@@ -13,39 +13,41 @@ export class ContentNavigationBlock {
|
|
|
13
13
|
this.ariaExpanded = 'false';
|
|
14
14
|
this.bodyToggle = false;
|
|
15
15
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
promises.push(WindowResizeService.registerProp(this.classes).subscribe(newValue => {
|
|
19
|
-
this.classString = newValue;
|
|
20
|
-
}));
|
|
21
|
-
promises.push(WindowResizeService.registerProp(this.hamburger).subscribe(newValue => {
|
|
16
|
+
componentWillLoad() {
|
|
17
|
+
WindowResizeService.registerProp(this.hamburger).subscribe(newValue => {
|
|
22
18
|
this.hamburger = newValue;
|
|
23
19
|
this.bodyToggle = this.hamburger === 'fixed';
|
|
24
20
|
document.body.classList.remove('content-navigation-block-open');
|
|
25
|
-
})
|
|
26
|
-
|
|
21
|
+
});
|
|
22
|
+
WindowResizeService.registerProp(this.classes).subscribe(newValue => {
|
|
23
|
+
this.classString = newValue;
|
|
24
|
+
});
|
|
27
25
|
}
|
|
28
|
-
|
|
26
|
+
componentDidLoad() {
|
|
29
27
|
let openButton = this.hostElement.querySelector('[slot="openButton"]');
|
|
30
28
|
let closeButton = this.hostElement.querySelector('[slot="closeButton"]');
|
|
31
29
|
let content = this.hostElement.querySelector('[slot="content"]');
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
30
|
+
if (openButton) {
|
|
31
|
+
openButton.onclick = () => {
|
|
32
|
+
this.ariaExpanded = this.ariaExpanded === 'true' ? 'false' : 'true';
|
|
33
|
+
content.setAttribute('hidden', this.ariaExpanded === 'false' ? 'true' : 'false');
|
|
34
|
+
if (this.ariaExpanded === 'false') {
|
|
35
|
+
document.body.classList.remove('content-navigation-block-open');
|
|
36
|
+
}
|
|
37
|
+
else if (this.bodyToggle) {
|
|
38
|
+
document.body.classList.add('content-navigation-block-open');
|
|
39
|
+
}
|
|
40
|
+
setTimeout(() => closeButton.focus(), 1);
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
if (closeButton) {
|
|
44
|
+
closeButton.onclick = () => {
|
|
45
|
+
this.ariaExpanded = 'false';
|
|
46
|
+
content.setAttribute('hidden', 'true');
|
|
36
47
|
document.body.classList.remove('content-navigation-block-open');
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
41
|
-
setTimeout(() => closeButton.focus(), 1);
|
|
42
|
-
};
|
|
43
|
-
closeButton.onclick = () => {
|
|
44
|
-
this.ariaExpanded = 'false';
|
|
45
|
-
content.setAttribute('hidden', 'true');
|
|
46
|
-
document.body.classList.remove('content-navigation-block-open');
|
|
47
|
-
setTimeout(() => openButton.focus(), 1);
|
|
48
|
-
};
|
|
48
|
+
setTimeout(() => openButton.focus(), 1);
|
|
49
|
+
};
|
|
50
|
+
}
|
|
49
51
|
}
|
|
50
52
|
render() {
|
|
51
53
|
return (h(Host, { class: this.classString, "aria-expanded": this.ariaExpanded }, h("slot", null), h("slot", { name: "openButton" }), h("slot", { name: "closeButton" }), h("slot", { name: "content" })));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"content-navigation-block.js","sourceRoot":"","sources":["../../../../src/components/content-navigation-block/content-navigation-block.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAEzE,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAG3E;;;;GAIG;AAMH,MAAM,OAAO,sBAAsB;;yBAaH,YAAY;;;4BAaV,OAAO;0BACR,KAAK;;IAEpC,
|
|
1
|
+
{"version":3,"file":"content-navigation-block.js","sourceRoot":"","sources":["../../../../src/components/content-navigation-block/content-navigation-block.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAEzE,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAG3E;;;;GAIG;AAMH,MAAM,OAAO,sBAAsB;;yBAaH,YAAY;;;4BAaV,OAAO;0BACR,KAAK;;IAEpC,iBAAiB;QACf,mBAAmB,CAAC,YAAY,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,QAAQ,CA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AAC;gBAC/D,CAAC;gBACD,UAAU,CAAC,GAAG,EAAE,CAAC,WAAW,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC;YAC3C,CAAC,CAAC;QACJ,CAAC;QACD,IAAI,WAAW,EAAE,CAAC;YAChB,WAAW,CAAC,OAAO,GAAG,GAAG,EAAE;gBACzB,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,GAAG,EAAE,CAAC,UAAU,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC;YAC1C,CAAC,CAAC;QACJ,CAAC;IACH,CAAC;IAED,MAAM;QACJ,OAAO,CACL,EAAC,IAAI,IAAC,KAAK,EAAE,IAAI,CAAC,WAAW,mBAAiB,IAAI,CAAC,YAAY;YAC7D,eAAa;YACb,YAAM,IAAI,EAAC,YAAY,GAAQ;YAC/B,YAAM,IAAI,EAAC,aAAa,GAAQ;YAChC,YAAM,IAAI,EAAC,SAAS,GAAQ,CACvB,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["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></slot>\n <slot name=\"openButton\"></slot>\n <slot name=\"closeButton\"></slot>\n <slot name=\"content\"></slot>\n </Host>\n );\n }\n}\n"]}
|
|
@@ -5,23 +5,19 @@
|
|
|
5
5
|
.content-block-overlay-container {
|
|
6
6
|
position: relative;
|
|
7
7
|
display: block;
|
|
8
|
+
height: 100%;
|
|
8
9
|
}
|
|
9
10
|
|
|
10
11
|
content-overlay {
|
|
11
|
-
display:
|
|
12
|
+
display: none;
|
|
12
13
|
position: relative;
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
content-overlay.hydrated {
|
|
16
|
-
visibility: inherit;
|
|
14
|
+
flex: 0;
|
|
17
15
|
}
|
|
18
16
|
content-overlay .content-overlay__content > *[slot=content] {
|
|
19
17
|
height: 100%;
|
|
18
|
+
overflow: auto;
|
|
20
19
|
}
|
|
21
|
-
content-overlay
|
|
22
|
-
display: none;
|
|
23
|
-
}
|
|
24
|
-
content-overlay[open=true] {
|
|
20
|
+
content-overlay.content-overlay-active {
|
|
25
21
|
display: block;
|
|
26
22
|
}
|
|
27
23
|
content-overlay[vertical-position=left] {
|
|
@@ -66,6 +62,7 @@ content-overlay .content-overlay__close {
|
|
|
66
62
|
appearance: none;
|
|
67
63
|
background: none;
|
|
68
64
|
border: none;
|
|
65
|
+
min-width: 16px;
|
|
69
66
|
}
|
|
70
67
|
content-overlay.content-overlay--fullscreen .content-overlay-background {
|
|
71
68
|
position: fixed;
|
|
@@ -20,22 +20,35 @@ export class ContentOverlay {
|
|
|
20
20
|
this.isActive = false;
|
|
21
21
|
this.activeClass = '';
|
|
22
22
|
this.classString = '';
|
|
23
|
+
this.contentSlot = undefined;
|
|
23
24
|
this.isFullScreen = false;
|
|
25
|
+
this.hasCloseButton = false;
|
|
26
|
+
this.originalMarkup = undefined;
|
|
24
27
|
}
|
|
25
28
|
onContentBlockActivated(event) {
|
|
26
29
|
if (this.hostElement.getAttribute('id') === event.detail.getAttribute('id')) {
|
|
27
30
|
event.preventDefault();
|
|
28
|
-
this.
|
|
31
|
+
if (!this.isActive) {
|
|
32
|
+
this.openOverlay();
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
this.closeOverlay();
|
|
36
|
+
}
|
|
29
37
|
}
|
|
30
38
|
}
|
|
31
39
|
async openOverlay() {
|
|
32
|
-
if (this.isActive) {
|
|
33
|
-
|
|
40
|
+
// if (this.isActive) {
|
|
41
|
+
// return false;
|
|
42
|
+
// }
|
|
43
|
+
this.isActive = true;
|
|
44
|
+
if (!this.originalMarkup) {
|
|
45
|
+
this.originalMarkup = this.contentSlot.querySelector('[slot="content"]').innerHTML;
|
|
34
46
|
}
|
|
35
47
|
if (this.target) {
|
|
36
48
|
let targetElement = document.getElementById(this.target);
|
|
37
49
|
if (targetElement) {
|
|
38
50
|
targetElement.classList.add('content-block-overlay-container');
|
|
51
|
+
targetElement.appendChild(this.hostElement);
|
|
39
52
|
}
|
|
40
53
|
}
|
|
41
54
|
else if (this.isFullScreen) {
|
|
@@ -44,10 +57,11 @@ export class ContentOverlay {
|
|
|
44
57
|
}
|
|
45
58
|
}
|
|
46
59
|
if (this.contentSlot) {
|
|
47
|
-
this.
|
|
60
|
+
this.contentSlot.innerHTML = this.originalMarkup;
|
|
48
61
|
this.setComputedActiveClass();
|
|
49
62
|
if (this.isFullScreen) {
|
|
50
63
|
this.focusTrap = focusTrap.createFocusTrap(this.hostElement, {
|
|
64
|
+
fallbackFocus: this.hostElement,
|
|
51
65
|
onDeactivate: () => {
|
|
52
66
|
this.isActive = false;
|
|
53
67
|
this.setComputedActiveClass();
|
|
@@ -58,6 +72,9 @@ export class ContentOverlay {
|
|
|
58
72
|
this.contentOverlayActivated.emit(this.hostElement);
|
|
59
73
|
}
|
|
60
74
|
async closeOverlay() {
|
|
75
|
+
this.contentSlot.innerHTML = '';
|
|
76
|
+
this.isActive = false;
|
|
77
|
+
this.activeClass = '';
|
|
61
78
|
if (this.focusTrap) {
|
|
62
79
|
try {
|
|
63
80
|
this.focusTrap.deactivate();
|
|
@@ -75,30 +92,28 @@ export class ContentOverlay {
|
|
|
75
92
|
if (this.isFullScreen) {
|
|
76
93
|
positioningValue = 'fullscreen';
|
|
77
94
|
}
|
|
78
|
-
this.activeClass = `content-overlay ${this.isActive ? 'content-overlay-active' : 'content-overlay-inactive'} content-overlay--${positioningValue}
|
|
95
|
+
this.activeClass = `content-overlay ${this.isActive ? 'content-overlay-active' : 'content-overlay-inactive'} content-overlay--${positioningValue}`;
|
|
79
96
|
}
|
|
80
97
|
componentWillLoad() {
|
|
81
|
-
this.contentSlot = this.hostElement.querySelector('[slot="content"]');
|
|
82
98
|
this.contentElement = this.hostElement.querySelector('.js-content-overlay-content');
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
WindowResizeService.registerProp(this.
|
|
86
|
-
WindowResizeService.registerProp(this.horizontalAlignment).subscribe(newValue => (this.horizontalAlignment = newValue));
|
|
87
|
-
WindowResizeService.registerProp(this.verticalAlignment).subscribe(newValue => (this.verticalAlignment = newValue));
|
|
99
|
+
WindowResizeService.registerProp(this.classes).subscribe(newValue => (this.classString = `${newValue}`));
|
|
100
|
+
WindowResizeService.registerProp(this.horizontalAlignment).subscribe(newValue => this.hostElement.setAttribute('horizontal-alignment', newValue));
|
|
101
|
+
WindowResizeService.registerProp(this.verticalAlignment).subscribe(newValue => this.hostElement.setAttribute('vertical-alignment', newValue));
|
|
88
102
|
WindowResizeService.registerProp(this.fullScreen).subscribe(newValue => {
|
|
89
103
|
if (!this.target)
|
|
90
104
|
this.isFullScreen = newValue === 'true';
|
|
91
105
|
});
|
|
92
106
|
WindowResizeService.registerProp(this.open).subscribe(newValue => {
|
|
93
|
-
this.open
|
|
107
|
+
this.hostElement.setAttribute('open', newValue);
|
|
94
108
|
});
|
|
109
|
+
this.hasCloseButton = !!this.hostElement.querySelector('[slot="closeButton"]');
|
|
95
110
|
}
|
|
96
111
|
closeOverlayButtonClicked(event) {
|
|
97
112
|
event.preventDefault();
|
|
98
113
|
this.closeOverlay();
|
|
99
114
|
}
|
|
100
115
|
render() {
|
|
101
|
-
return (h(Host, { class: this.classString }, h("div", { class: "content-block-overlay-container" }, h("div", { class: `content-overlay-background ${this.isActive ? 'active' : ''}` }, h("div", { ref: element => (this.dialogElement = element), role: "dialog", "aria-modal": "true", class: this.isActive ? 'active' : 'hidden', "aria-expanded": this.isActive }, h("div", { class: "content-overlay__header" }, h("button", { onClick: e => this.closeOverlayButtonClicked(e), class: "content-overlay__close", title: this.closeTitle }, h("slot", { name: "closeButton" })), h("slot", { name: "header" })), h("div", { class: "
|
|
116
|
+
return (h(Host, { class: `${this.activeClass} ${this.classString}` }, h("div", { class: "content-block-overlay-container" }, h("div", { class: `content-overlay-background ${this.isActive ? 'active' : ''}` }, h("div", { ref: element => (this.dialogElement = element), role: "dialog", "aria-modal": "true", class: this.isActive ? 'active' : 'hidden', "aria-expanded": this.isActive }, h("div", { class: "content-overlay__header" }, h("button", { onClick: e => this.closeOverlayButtonClicked(e), class: "content-overlay__close", title: this.closeTitle }, !this.hasCloseButton && (h("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", width: "16", height: "16", 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("slot", { name: "closeButton" })), h("slot", { name: "header" })), h("div", { class: "content-overlay__content", ref: (el) => (this.contentSlot = el) }, h("slot", { name: "content" })))))));
|
|
102
117
|
}
|
|
103
118
|
componentDidRender() {
|
|
104
119
|
if (this.open === 'true') {
|
|
@@ -344,7 +359,10 @@ export class ContentOverlay {
|
|
|
344
359
|
"isActive": {},
|
|
345
360
|
"activeClass": {},
|
|
346
361
|
"classString": {},
|
|
347
|
-
"
|
|
362
|
+
"contentSlot": {},
|
|
363
|
+
"isFullScreen": {},
|
|
364
|
+
"hasCloseButton": {},
|
|
365
|
+
"originalMarkup": {}
|
|
348
366
|
};
|
|
349
367
|
}
|
|
350
368
|
static get events() {
|
|
@@ -374,7 +392,7 @@ export class ContentOverlay {
|
|
|
374
392
|
return {
|
|
375
393
|
"openOverlay": {
|
|
376
394
|
"complexType": {
|
|
377
|
-
"signature": "() => Promise<
|
|
395
|
+
"signature": "() => Promise<void>",
|
|
378
396
|
"parameters": [],
|
|
379
397
|
"references": {
|
|
380
398
|
"Promise": {
|
|
@@ -382,7 +400,7 @@ export class ContentOverlay {
|
|
|
382
400
|
"id": "global::Promise"
|
|
383
401
|
}
|
|
384
402
|
},
|
|
385
|
-
"return": "Promise<
|
|
403
|
+
"return": "Promise<void>"
|
|
386
404
|
},
|
|
387
405
|
"docs": {
|
|
388
406
|
"text": "",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"content-overlay.js","sourceRoot":"","sources":["../../../../src/components/content-overlay/content-overlay.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACjF,OAAO,EAAE,KAAK,EAAoC,MAAM,EAAS,MAAM,wBAAwB,CAAC;AAChG,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAG3E,OAAO,KAAK,SAAS,MAAM,YAAY,CAAC;AACxC,OAAO,4BAA4B,CAAC;AACpC,OAAO,yBAAyB,CAAC;AACjC;;;;GAIG;AAMH,MAAM,OAAO,cAAc;;;oBAgBC,OAAO;0BAKO,MAAM;;mCAmBK,QAAQ;iCAYZ,QAAQ;0BAM1B,eAAe;wBAEf,KAAK;2BACH,EAAE;2BACF,EAAE;4BAWA,KAAK;;IAItC,uBAAuB,CAAC,KAAkB;QACxC,IAAI,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,KAAK,KAAK,CAAC,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE;YAC3E,KAAK,CAAC,cAAc,EAAE,CAAC;YACvB,IAAI,CAAC,WAAW,EAAE,CAAC;SACpB;IACH,CAAC;IAGD,KAAK,CAAC,WAAW;QACf,IAAI,IAAI,CAAC,QAAQ,EAAE;YACjB,OAAO,KAAK,CAAC;SACd;QACD,IAAI,IAAI,CAAC,MAAM,EAAE;YACf,IAAI,aAAa,GAAG,QAAQ,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,CA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E;YAC7D,IAAI;gBACF,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,CAAC;aAC3B;YAAC,OAAO,CAAC,EAAE;gBACV,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;aAChB;SACF;IACH,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Host, h, Prop, State, Listen, Element } from '@stencil/core';\nimport { Event, EventEmitter, HTMLStencilElement, Method, Watch } from '@stencil/core/internal';\nimport { WindowResizeService } from '../../services/window-resize-service';\nimport { ContentLineTextAlignOptions, ContentVerticalAlignments, ResponsiveBoolean, ResponsiveString } from '../../typings';\nimport { getCurrentValue } from '../../utils/utils';\nimport * as focusTrap from 'focus-trap';\nimport './libraries/aria-utilities';\nimport './libraries/aria-dialog';\n/**\n * @slot closeButton - Contents of the overlay close button.\n * @slot header - This is adjacent to the close button, usually a header or title for the overlay.\n * @slot content - Contents that sit inside the overlay.\n */\n@Component({\n tag: 'content-overlay',\n styleUrl: 'content-overlay.scss',\n shadow: false,\n})\nexport class ContentOverlay {\n @Element() hostElement: HTMLStencilElement;\n /**\n * @type String\n * @responsive\n */\n @Prop() target: string;\n\n /**\n * @type Boolean\n * @responsive\n */\n @Prop({\n mutable: true,\n reflect: true,\n })\n open: ResponsiveBoolean = 'false';\n /**\n * @type Boolean\n * @responsive\n */\n @Prop() fullScreen: ResponsiveBoolean = 'true';\n /**\n * @type String\n * @responsive\n */\n @Prop() classes: ResponsiveString;\n /**\n * A pipe delimited setting for horizontal alignment. This only applies when fullscreen mode is activated.\n * @type Select\n * @options default\n * @options left\n * @options center\n * @options right\n * @responsive\n */\n @Prop({\n reflect: true,\n mutable: true,\n })\n horizontalAlignment: ContentLineTextAlignOptions = 'center';\n /**\n * A pipe delimited setting for vertical alignment. This only applies when fullscreen mode is activated.\n * @type Select\n * @options top\n * @options center\n * @options bottom\n */\n @Prop({\n reflect: true,\n mutable: true,\n })\n verticalAlignment: ContentVerticalAlignments = 'center';\n\n /**\n * Title attribute value for the close button.\n * @type String\n */\n @Prop() closeTitle: string = 'Close Overlay';\n\n @State() isActive: boolean = false;\n @State() activeClass: string = '';\n @State() classString: string = '';\n @Event({\n bubbles: true,\n })\n contentOverlayActivated: EventEmitter<HTMLElement>;\n\n private contentSlot: HTMLTemplateElement;\n\n dialogElement: HTMLDivElement;\n contentElement: HTMLDivElement;\n\n @State() isFullScreen: boolean = false;\n ariaDialog;\n focusTrap;\n @Listen('contentBlockActivated')\n onContentBlockActivated(event: CustomEvent) {\n if (this.hostElement.getAttribute('id') === event.detail.getAttribute('id')) {\n event.preventDefault();\n this.openOverlay();\n }\n }\n\n @Method()\n async openOverlay() {\n if (this.isActive) {\n return false;\n }\n if (this.target) {\n let targetElement = document.getElementById(this.target);\n if (targetElement) {\n targetElement.classList.add('content-block-overlay-container');\n }\n } else if (this.isFullScreen) {\n if (document.querySelectorAll(`#${this.hostElement.getAttribute('id')}`).length === 1) {\n document.body.appendChild(this.hostElement);\n }\n }\n if (this.contentSlot) {\n this.isActive = true;\n this.setComputedActiveClass();\n if (this.isFullScreen) {\n this.focusTrap = focusTrap.createFocusTrap(this.hostElement, {\n onDeactivate: () => {\n this.isActive = false;\n this.setComputedActiveClass();\n },\n });\n }\n }\n this.contentOverlayActivated.emit(this.hostElement);\n }\n\n @Method()\n async closeOverlay() {\n if (this.focusTrap) {\n try {\n this.focusTrap.deactivate();\n } catch (e) {\n console.log(e);\n }\n }\n }\n\n setComputedActiveClass() {\n let positioningValue = 'static';\n if (this.target) {\n positioningValue = 'absolute';\n }\n if (this.isFullScreen) {\n positioningValue = 'fullscreen';\n }\n this.activeClass = `content-overlay ${this.isActive ? 'content-overlay-active' : 'content-overlay-inactive'} content-overlay--${positioningValue}}`;\n }\n\n componentWillLoad() {\n this.contentSlot = this.hostElement.querySelector('[slot=\"content\"]');\n this.contentElement = this.hostElement.querySelector('.js-content-overlay-content');\n }\n\n componentDidLoad() {\n WindowResizeService.registerProp(this.classes).subscribe(newValue => (this.classString = `${this.activeClass} ${newValue}`));\n\n WindowResizeService.registerProp(this.horizontalAlignment).subscribe(newValue => (this.horizontalAlignment = newValue as ContentLineTextAlignOptions));\n WindowResizeService.registerProp(this.verticalAlignment).subscribe(newValue => (this.verticalAlignment = newValue as ContentVerticalAlignments));\n WindowResizeService.registerProp(this.fullScreen).subscribe(newValue => {\n if (!this.target) this.isFullScreen = (newValue as string) === 'true';\n });\n WindowResizeService.registerProp(this.open).subscribe(newValue => {\n this.open = newValue as string;\n });\n }\n\n closeOverlayButtonClicked(event) {\n event.preventDefault();\n this.closeOverlay();\n }\n\n render() {\n return (\n <Host class={this.classString}>\n <div class=\"content-block-overlay-container\">\n <div class={`content-overlay-background ${this.isActive ? 'active' : ''}`}>\n <div ref={element => (this.dialogElement = element)} role=\"dialog\" aria-modal=\"true\" class={this.isActive ? 'active' : 'hidden'} aria-expanded={this.isActive}>\n <div class=\"content-overlay__header\">\n <button onClick={e => this.closeOverlayButtonClicked(e)} class=\"content-overlay__close\" title={this.closeTitle}>\n <slot name=\"closeButton\"></slot>\n </button>\n <slot name=\"header\"></slot>\n </div>\n <div class=\"js-content-overlay-content content-overlay__content\">\n <slot name=\"content\"></slot>\n </div>\n </div>\n </div>\n </div>\n </Host>\n );\n }\n\n componentDidRender() {\n if (this.open === 'true') {\n this.openOverlay();\n }\n if (this.isActive && this.focusTrap && !this.focusTrap.active) {\n try {\n this.focusTrap.activate();\n } catch (e) {\n console.log(e);\n }\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"content-overlay.js","sourceRoot":"","sources":["../../../../src/components/content-overlay/content-overlay.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACjF,OAAO,EAAE,KAAK,EAAoC,MAAM,EAAS,MAAM,wBAAwB,CAAC;AAChG,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAG3E,OAAO,KAAK,SAAS,MAAM,YAAY,CAAC;AACxC,OAAO,4BAA4B,CAAC;AACpC,OAAO,yBAAyB,CAAC;AACjC;;;;GAIG;AAMH,MAAM,OAAO,cAAc;;;oBAgBC,OAAO;0BAKO,MAAM;;mCAmBK,QAAQ;iCAYZ,QAAQ;0BAM1B,eAAe;wBAEf,KAAK;2BACH,EAAE;2BACF,EAAE;;4BAWA,KAAK;8BACH,KAAK;;;IAKxC,uBAAuB,CAAC,KAAkB;QACxC,IAAI,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,IAAI,CAAC,KAAK,KAAK,CAAC,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC;YAC5E,KAAK,CAAC,cAAc,EAAE,CAAC;YACvB,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;gBACnB,IAAI,CAAC,WAAW,EAAE,CAAC;YACrB,CAAC;iBAAM,CAAC;gBACN,IAAI,CAAC,YAAY,EAAE,CAAC;YACtB,CAAC;QACH,CAAC;IACH,CAAC;IAGD,KAAK,CAAC,WAAW;QACf,uBAAuB;QACvB,kBAAkB;QAClB,IAAI;QACJ,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACrB,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC;YACzB,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC,kBAAkB,CAAC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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, Host, h, Prop, State, Listen, Element } from '@stencil/core';\nimport { Event, EventEmitter, HTMLStencilElement, Method, Watch } from '@stencil/core/internal';\nimport { WindowResizeService } from '../../services/window-resize-service';\nimport { ContentLineTextAlignOptions, ContentVerticalAlignments, ResponsiveBoolean, ResponsiveString } from '../../typings';\nimport { getCurrentValue } from '../../utils/utils';\nimport * as focusTrap from 'focus-trap';\nimport './libraries/aria-utilities';\nimport './libraries/aria-dialog';\n/**\n * @slot closeButton - Contents of the overlay close button.\n * @slot header - This is adjacent to the close button, usually a header or title for the overlay.\n * @slot content - Contents that sit inside the overlay.\n */\n@Component({\n tag: 'content-overlay',\n styleUrl: 'content-overlay.scss',\n shadow: false,\n})\nexport class ContentOverlay {\n @Element() hostElement: HTMLStencilElement;\n /**\n * @type String\n * @responsive\n */\n @Prop() target: string;\n\n /**\n * @type Boolean\n * @responsive\n */\n @Prop({\n mutable: true,\n reflect: true,\n })\n open: ResponsiveBoolean = 'false';\n /**\n * @type Boolean\n * @responsive\n */\n @Prop() fullScreen: ResponsiveBoolean = 'true';\n /**\n * @type String\n * @responsive\n */\n @Prop() classes: ResponsiveString;\n /**\n * A pipe delimited setting for horizontal alignment. This only applies when fullscreen mode is activated.\n * @type Select\n * @options default\n * @options left\n * @options center\n * @options right\n * @responsive\n */\n @Prop({\n reflect: true,\n mutable: true,\n })\n horizontalAlignment: ContentLineTextAlignOptions = 'center';\n /**\n * A pipe delimited setting for vertical alignment. This only applies when fullscreen mode is activated.\n * @type Select\n * @options top\n * @options center\n * @options bottom\n */\n @Prop({\n reflect: true,\n mutable: true,\n })\n verticalAlignment: ContentVerticalAlignments = 'center';\n\n /**\n * Title attribute value for the close button.\n * @type String\n */\n @Prop() closeTitle: string = 'Close Overlay';\n\n @State() isActive: boolean = false;\n @State() activeClass: string = '';\n @State() classString: string = '';\n @Event({\n bubbles: true,\n })\n contentOverlayActivated: EventEmitter<HTMLElement>;\n\n @State() contentSlot: HTMLElement;\n\n dialogElement: HTMLDivElement;\n contentElement: HTMLDivElement;\n\n @State() isFullScreen: boolean = false;\n @State() hasCloseButton: boolean = false;\n @State() originalMarkup: string;\n ariaDialog;\n focusTrap;\n @Listen('contentBlockActivated')\n onContentBlockActivated(event: CustomEvent) {\n if (this.hostElement.getAttribute('id') === event.detail.getAttribute('id')) {\n event.preventDefault();\n if (!this.isActive) {\n this.openOverlay();\n } else {\n this.closeOverlay();\n }\n }\n }\n\n @Method()\n async openOverlay() {\n // if (this.isActive) {\n // return false;\n // }\n this.isActive = true;\n if (!this.originalMarkup) {\n this.originalMarkup = this.contentSlot.querySelector('[slot=\"content\"]').innerHTML;\n }\n if (this.target) {\n let targetElement = document.getElementById(this.target);\n if (targetElement) {\n targetElement.classList.add('content-block-overlay-container');\n targetElement.appendChild(this.hostElement);\n }\n } else if (this.isFullScreen) {\n if (document.querySelectorAll(`#${this.hostElement.getAttribute('id')}`).length === 1) {\n document.body.appendChild(this.hostElement);\n }\n }\n if (this.contentSlot) {\n this.contentSlot.innerHTML = this.originalMarkup;\n this.setComputedActiveClass();\n if (this.isFullScreen) {\n this.focusTrap = focusTrap.createFocusTrap(this.hostElement, {\n fallbackFocus: this.hostElement,\n onDeactivate: () => {\n this.isActive = false;\n this.setComputedActiveClass();\n },\n });\n }\n }\n this.contentOverlayActivated.emit(this.hostElement);\n }\n\n @Method()\n async closeOverlay() {\n this.contentSlot.innerHTML = '';\n this.isActive = false;\n this.activeClass = '';\n if (this.focusTrap) {\n try {\n this.focusTrap.deactivate();\n } catch (e) {\n console.log(e);\n }\n }\n }\n\n setComputedActiveClass() {\n let positioningValue = 'static';\n if (this.target) {\n positioningValue = 'absolute';\n }\n if (this.isFullScreen) {\n positioningValue = 'fullscreen';\n }\n this.activeClass = `content-overlay ${this.isActive ? 'content-overlay-active' : 'content-overlay-inactive'} content-overlay--${positioningValue}`;\n }\n\n componentWillLoad() {\n this.contentElement = this.hostElement.querySelector('.js-content-overlay-content');\n\n WindowResizeService.registerProp(this.classes).subscribe(newValue => (this.classString = `${newValue}`));\n\n WindowResizeService.registerProp(this.horizontalAlignment).subscribe(newValue =>\n this.hostElement.setAttribute('horizontal-alignment', newValue as ContentLineTextAlignOptions),\n );\n WindowResizeService.registerProp(this.verticalAlignment).subscribe(newValue => this.hostElement.setAttribute('vertical-alignment', newValue as ContentVerticalAlignments));\n WindowResizeService.registerProp(this.fullScreen).subscribe(newValue => {\n if (!this.target) this.isFullScreen = (newValue as string) === 'true';\n });\n WindowResizeService.registerProp(this.open).subscribe(newValue => {\n this.hostElement.setAttribute('open', newValue as string);\n });\n this.hasCloseButton = !!this.hostElement.querySelector('[slot=\"closeButton\"]');\n }\n\n closeOverlayButtonClicked(event) {\n event.preventDefault();\n this.closeOverlay();\n }\n\n render() {\n return (\n <Host class={`${this.activeClass} ${this.classString}`}>\n <div class=\"content-block-overlay-container\">\n <div class={`content-overlay-background ${this.isActive ? 'active' : ''}`}>\n <div ref={element => (this.dialogElement = element)} role=\"dialog\" aria-modal=\"true\" class={this.isActive ? 'active' : 'hidden'} aria-expanded={this.isActive}>\n <div class=\"content-overlay__header\">\n <button onClick={e => this.closeOverlayButtonClicked(e)} class=\"content-overlay__close\" title={this.closeTitle}>\n {!this.hasCloseButton && (\n <svg xmlns=\"http://www.w3.org/2000/svg\" fill=\"none\" width=\"16\" height=\"16\" 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 )}\n <slot name=\"closeButton\"></slot>\n </button>\n <slot name=\"header\"></slot>\n </div>\n <div class=\"content-overlay__content\" ref={(el: HTMLDivElement) => (this.contentSlot = el)}>\n <slot name=\"content\"></slot>\n </div>\n </div>\n </div>\n </div>\n </Host>\n );\n }\n\n componentDidRender() {\n if (this.open === 'true') {\n this.openOverlay();\n }\n if (this.isActive && this.focusTrap && !this.focusTrap.active) {\n try {\n this.focusTrap.activate();\n } catch (e) {\n console.log(e);\n }\n }\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aria-dialog.js","sourceRoot":"","sources":["../../../../../src/components/content-overlay/libraries/aria-dialog.ts"],"names":[],"mappings":"AAAA;;;EAGE;AACF;;GAEG;AAEF,IAAI,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC;AACtB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC;AAE9B,gFAAgF;AAChF,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,UAAU,OAAO,EAAE,QAAQ;IAC9C,OAAO,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;AACnC,CAAC,CAAC;AAEF,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,UAAU,IAAI;IAChC,IAAI,IAAI,CAAC,MAAM,IAAI,OAAO,IAAI,CAAC,MAAM,KAAK,UAAU,EAAE;QACpD,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC;KACtB;IACD,IAAI,IAAI,CAAC,UAAU;QACf,IAAI,CAAC,UAAU,CAAC,WAAW;QAC3B,OAAO,IAAI,CAAC,UAAU,CAAC,WAAW,KAAK,UAAU,EAAE;QACrD,OAAO,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;KAC1C;IACD,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAEF,IAAI,CAAC,KAAK,CAAC,WAAW,GAAG,U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B;AACH,CAAC,CAAC,CAAC,kBAAkB;AAErB,IAAI,CAAC,aAAa,GAAG,UAAU,WAAW,EAAE,mBAAmB,EAC7D,aAAa;IACb,IAAI,SAAS,GAAG,IAAI,CAAC,gBAAgB,EAAE,CAAC;IACxC,IAAI,SAAS,CAAC,UAAU,CAAC,QAAQ,CAAC,QAAQ,CAAC,aAAa,CAAC,EAAE;QACzD,SAAS,CAAC,OAAO,CAAC,WAAW,EAAE,mBAAmB,EAAE,aAAa,CAAC,CAAC;KACpE;AACH,CAAC,CAAC,CAAC,oBAAoB;AAEvB,MAAM,CAAC,IAAI,GAAG,IAAI,CAAC","sourcesContent":["/*\n* This content is licensed according to the W3C Software License at\n* https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document\n*/\n/**\n * @namespace aria\n */\n\n var aria = aria || {};\n aria.Utils = aria.Utils || {};\n \n // Polyfill src https://developer.mozilla.org/en-US/docs/Web/API/Element/matches\n aria.Utils.matches = function (element, selector) {\n return element.matches(selector);\n };\n \n aria.Utils.remove = function (item) {\n if (item.remove && typeof item.remove === 'function') {\n return item.remove();\n }\n if (item.parentNode &&\n item.parentNode.removeChild &&\n typeof item.parentNode.removeChild === 'function') {\n return item.parentNode.removeChild(item);\n }\n return false;\n };\n \n aria.Utils.isFocusable = function (element) {\n if (element.tabIndex > 0 || (element.tabIndex === 0 && element.getAttribute('tabIndex') !== null)) {\n return true;\n }\n \n if (element.disabled) {\n return false;\n }\n \n switch (element.nodeName) {\n case 'A':\n return !!element.href && element.rel != 'ignore';\n case 'INPUT':\n return element.type != 'hidden' && element.type != 'file';\n case 'BUTTON':\n case 'SELECT':\n case 'TEXTAREA':\n return true;\n default:\n return false;\n }\n };\n \n aria.Utils.getAncestorBySelector = function (element, selector) {\n if (!aria.Utils.matches(element, selector + ' ' + element.tagName)) {\n // Element is not inside an element that matches selector\n return null;\n }\n \n // Move up the DOM tree until a parent matching the selector is found\n var currentNode = element;\n var ancestor = null;\n while (ancestor === null) {\n if (aria.Utils.matches(currentNode.parentNode, selector)) {\n ancestor = currentNode.parentNode;\n }\n else {\n currentNode = currentNode.parentNode;\n }\n }\n \n return ancestor;\n };\n \n aria.Utils.hasClass = function (element, className) {\n return (new RegExp('(\\\\s|^)' + className + '(\\\\s|$)')).test(element.className);\n };\n \n aria.Utils.addClass = function (element, className) {\n if (!aria.Utils.hasClass(element, className)) {\n element.className += ' ' + className;\n }\n };\n \n aria.Utils.removeClass = function (element, className) {\n var classRegex = new RegExp('(\\\\s|^)' + className + '(\\\\s|$)');\n element.className = element.className.replace(classRegex, ' ').trim();\n };\n \n aria.Utils.bindMethods = function (object) {\n var methodNames = Array.prototype.slice.call(arguments, 1);\n methodNames.forEach(function (method) {\n object[method] = object[method].bind(object);\n });\n };\n \n \n /*\n * When util functions move focus around, set this true so the focus listener\n * can ignore the events.\n */\naria.Utils.IgnoreUtilFocusChanges = false;\n\naria.Utils.dialogOpenClass = 'has-dialog';\n\n/**\n * @desc Set focus on descendant nodes until the first focusable element is\n * found.\n * @param element\n * DOM node for which to find the first focusable descendant.\n * @returns\n * true if a focusable element is found and focus is set.\n */\naria.Utils.focusFirstDescendant = function (element) {\n for (var i = 0; i < element.childNodes.length; i++) {\n var child = element.childNodes[i];\n if (aria.Utils.attemptFocus(child) ||\n aria.Utils.focusFirstDescendant(child)) {\n return true;\n }\n }\n return false;\n}; // end focusFirstDescendant\n\n/**\n * @desc Find the last descendant node that is focusable.\n * @param element\n * DOM node for which to find the last focusable descendant.\n * @returns\n * true if a focusable element is found and focus is set.\n */\naria.Utils.focusLastDescendant = function (element) {\n for (var i = element.childNodes.length - 1; i >= 0; i--) {\n var child = element.childNodes[i];\n if (aria.Utils.attemptFocus(child) ||\n aria.Utils.focusLastDescendant(child)) {\n return true;\n }\n }\n return false;\n}; // end focusLastDescendant\n\n/**\n * @desc Set Attempt to set focus on the current node.\n * @param element\n * The node to attempt to focus on.\n * @returns\n * true if element is focused.\n */\naria.Utils.attemptFocus = function (element) {\n if (!aria.Utils.isFocusable(element)) {\n return false;\n }\n \n aria.Utils.IgnoreUtilFocusChanges = true;\n try {\n element.focus();\n }\n catch (e) {\n }\n aria.Utils.IgnoreUtilFocusChanges = false;\n return (document.activeElement === element);\n}; // end attemptFocus\n\n/* Modals can open modals. Keep track of them with this array. */\naria.OpenDialogList = aria.OpenDialogList || new Array(0);\n\n/**\n * @returns the last opened dialog (the current dialog)\n */\naria.getCurrentDialog = function () {\n if (aria.OpenDialogList && aria.OpenDialogList.length) {\n return aria.OpenDialogList[aria.OpenDialogList.length - 1];\n }\n};\n\naria.closeCurrentDialog = function () {\n var currentDialog = aria.getCurrentDialog();\n if (currentDialog) {\n currentDialog.close();\n return true;\n }\n \n return false;\n};\n\n aria.handleEscape = function (event) {\n if (event.key === 'Escape' && aria.closeCurrentDialog()) {\n event.stopPropagation();\n }\n };\n\n document.addEventListener('keyup', aria.handleEscape);\n\n /**\n * @constructor\n * @desc Dialog object providing modal focus management.\n *\n * Assumptions: The element serving as the dialog container is present in the\n * DOM and hidden. The dialog container has role='dialog'.\n *\n * @param dialogNode\n * The element serving as the dialog container.\n * @param focusAfterClosed\n * Either the DOM node or the ID of the DOM node to focus when the\n * dialog closes.\n * @param focusFirst\n * Optional parameter containing either the DOM node or the ID of the\n * DOM node to focus when the dialog opens. If not specified, the\n * first focusable element in the dialog will receive focus.\n */\n aria.Dialog = function (dialogNode, focusAfterClosed, focusFirst, isFullScreen) {\n this.dialogNode = dialogNode;\n if (this.dialogNode === null) {\n throw new Error('No element found');\n }\n\n var validRoles = ['dialog', 'alertdialog'];\n var isDialog = (this.dialogNode.getAttribute('role') || '')\n .trim()\n .split(/\\s+/g)\n .some(function (token) {\n return validRoles.some(function (role) {\n return token === role;\n });\n });\n if (!isDialog) {\n throw new Error(\n 'Dialog() requires a DOM element with ARIA role of dialog or alertdialog.');\n }\n\n // Wrap in an individual backdrop element if one doesn't exist\n // Native <dialog> elements use the ::backdrop pseudo-element, which\n // works similarly.\n var backdropClass = 'content-overlay-background';\n if (this.dialogNode.parentNode.classList.contains(backdropClass)) {\n this.backdropNode = this.dialogNode.parentNode;\n }\n else {\n this.backdropNode = document.createElement('div');\n this.backdropNode.className = backdropClass;\n this.dialogNode.parentNode.insertBefore(this.backdropNode, this.dialogNode);\n this.backdropNode.appendChild(this.dialogNode);\n }\n this.backdropNode.classList.add('active');\n setTimeout(() => {\n this.backdropNode.classList.add('transition');\n }, 1);\n\n // Disable scroll on the body element\n this.isFullscreen = isFullScreen;\n if (isFullScreen) {\n document.body.classList.add(aria.Utils.dialogOpenClass);\n }\n\n if (typeof focusAfterClosed === 'string') {\n this.focusAfterClosed = document.getElementById(focusAfterClosed);\n }\n else if (typeof focusAfterClosed === 'object') {\n this.focusAfterClosed = focusAfterClosed;\n }\n else {\n throw new Error(\n 'the focusAfterClosed parameter is required for the aria.Dialog constructor.');\n }\n\n if (typeof focusFirst === 'string') {\n this.focusFirst = document.getElementById(focusFirst);\n }\n else if (typeof focusFirst === 'object') {\n this.focusFirst = focusFirst;\n }\n else {\n this.focusFirst = null;\n }\n\n // Bracket the dialog node with two invisible, focusable nodes.\n // While this dialog is open, we use these to make sure that focus never\n // leaves the document even if dialogNode is the first or last node.\n var preDiv = document.createElement('div');\n this.preNode = this.dialogNode.parentNode.insertBefore(preDiv,\n this.dialogNode);\n this.preNode.tabIndex = 0;\n var postDiv = document.createElement('div');\n this.postNode = this.dialogNode.parentNode.insertBefore(postDiv,\n this.dialogNode.nextSibling);\n this.postNode.tabIndex = 0;\n\n // If this modal is opening on top of one that is already open,\n // get rid of the document focus listener of the open dialog.\n if (aria.OpenDialogList.length > 0) {\n aria.getCurrentDialog().removeListeners();\n }\n\n if (isFullScreen) {\n this.addListeners();\n }\n aria.OpenDialogList.push(this);\n this.dialogNode.className = 'content-overlay-dialog'; // make visible\n\n if (this.focusFirst) {\n this.focusFirst.focus();\n }\n else {\n aria.Utils.focusFirstDescendant(this.dialogNode);\n }\n\n this.lastFocus = document.activeElement;\n }; // end Dialog constructor\n\n\n /**\n * @desc\n * Hides the current top dialog,\n * removes listeners of the top dialog,\n * restore listeners of a parent dialog if one was open under the one that just closed,\n * and sets focus on the element specified for focusAfterClosed.\n */\n aria.Dialog.prototype.close = function () {\n aria.OpenDialogList.pop();\n this.removeListeners();\n aria.Utils.remove(this.preNode);\n aria.Utils.remove(this.postNode);\n this.dialogNode.className = 'hidden';\n this.backdropNode.classList.remove('active');\n this.backdropNode.classList.remove('transition');\n this.focusAfterClosed.focus();\n\n // If a dialog was open underneath this one, restore its listeners.\n if (aria.OpenDialogList.length > 0 && aria.OpenDialogList.filter(dialog => dialog.isFullscreen === true).length) {\n aria.getCurrentDialog().addListeners();\n }\n else {\n document.body.classList.remove(aria.Utils.dialogOpenClass);\n }\n this.dialogNode.dispatchEvent(new CustomEvent(\"ariaDialog.closed\", {\n bubbles: true,\n \"detail\": {}\n }));\n }; // end close\n\n /**\n * @desc\n * Hides the current dialog and replaces it with another.\n *\n * @param newDialogId\n * ID of the dialog that will replace the currently open top dialog.\n * @param newFocusAfterClosed\n * Optional ID or DOM node specifying where to place focus when the new dialog closes.\n * If not specified, focus will be placed on the element specified by the dialog being replaced.\n * @param newFocusFirst\n * Optional ID or DOM node specifying where to place focus in the new dialog when it opens.\n * If not specified, the first focusable element will receive focus.\n */\n aria.Dialog.prototype.replace = function (newDialogId, newFocusAfterClosed,\n newFocusFirst) {\n // var closedDialog = aria.getCurrentDialog();\n aria.OpenDialogList.pop();\n this.removeListeners();\n aria.Utils.remove(this.preNode);\n aria.Utils.remove(this.postNode);\n this.dialogNode.className = 'hidden';\n this.backdropNode.classList.remove('active');\n this.backdropNode.classList.remove('transition');\n\n var focusAfterClosed = newFocusAfterClosed || this.focusAfterClosed;\n new aria.Dialog(newDialogId, focusAfterClosed, newFocusFirst);\n // var dialog = new aria.Dialog(newDialogId, focusAfterClosed, newFocusFirst);\n }; // end replace\n\n aria.Dialog.prototype.addListeners = function () {\n document.addEventListener('focus', this.trapFocus, true);\n }; // end addListeners\n\n aria.Dialog.prototype.removeListeners = function () {\n document.removeEventListener('focus', this.trapFocus, true);\n }; // end removeListeners\n\n aria.Dialog.prototype.trapFocus = function (event) {\n if (aria.Utils.IgnoreUtilFocusChanges) {\n return;\n }\n var currentDialog = aria.getCurrentDialog();\n if (currentDialog.dialogNode.contains(event.target)) {\n currentDialog.lastFocus = event.target;\n }\n else {\n aria.Utils.focusFirstDescendant(currentDialog.dialogNode);\n if (currentDialog.lastFocus == document.activeElement) {\n aria.Utils.focusLastDescendant(currentDialog.dialogNode);\n }\n currentDialog.lastFocus = document.activeElement;\n }\n }; // end trapFocus\n\n aria.closeDialog = function (closeButton) {\n var topDialog = aria.getCurrentDialog();\n if (topDialog.dialogNode.contains(closeButton)) {\n topDialog.close();\n }\n }; // end closeDialog\n\n aria.replaceDialog = function (newDialogId, newFocusAfterClosed,\n newFocusFirst) {\n var topDialog = aria.getCurrentDialog();\n if (topDialog.dialogNode.contains(document.activeElement)) {\n topDialog.replace(newDialogId, newFocusAfterClosed, newFocusFirst);\n }\n }; // end replaceDialog\n\n window.aria = aria;"]}
|
|
1
|
+
{"version":3,"file":"aria-dialog.js","sourceRoot":"","sources":["../../../../../src/components/content-overlay/libraries/aria-dialog.ts"],"names":[],"mappings":"AAAA;;;EAGE;AACF;;GAEG;AAEF,IAAI,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC;AACtB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC;AAE9B,gFAAgF;AAChF,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,UAAU,OAAO,EAAE,QAAQ;IAC9C,OAAO,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;AACnC,CAAC,CAAC;AAEF,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,UAAU,IAAI;IAChC,IAAI,IAAI,CAAC,MAAM,IAAI,OAAO,IAAI,CAAC,MAAM,KAAK,UAAU,EAAE,CAAC;QACrD,OAAO,IAAI,CAAC,M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*\n* This content is licensed according to the W3C Software License at\n* https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document\n*/\n/**\n * @namespace aria\n */\n\n var aria = aria || {};\n aria.Utils = aria.Utils || {};\n \n // Polyfill src https://developer.mozilla.org/en-US/docs/Web/API/Element/matches\n aria.Utils.matches = function (element, selector) {\n return element.matches(selector);\n };\n \n aria.Utils.remove = function (item) {\n if (item.remove && typeof item.remove === 'function') {\n return item.remove();\n }\n if (item.parentNode &&\n item.parentNode.removeChild &&\n typeof item.parentNode.removeChild === 'function') {\n return item.parentNode.removeChild(item);\n }\n return false;\n };\n \n aria.Utils.isFocusable = function (element) {\n if (element.tabIndex > 0 || (element.tabIndex === 0 && element.getAttribute('tabIndex') !== null)) {\n return true;\n }\n \n if (element.disabled) {\n return false;\n }\n \n switch (element.nodeName) {\n case 'A':\n return !!element.href && element.rel != 'ignore';\n case 'INPUT':\n return element.type != 'hidden' && element.type != 'file';\n case 'BUTTON':\n case 'SELECT':\n case 'TEXTAREA':\n return true;\n default:\n return false;\n }\n };\n \n aria.Utils.getAncestorBySelector = function (element, selector) {\n if (!aria.Utils.matches(element, selector + ' ' + element.tagName)) {\n // Element is not inside an element that matches selector\n return null;\n }\n \n // Move up the DOM tree until a parent matching the selector is found\n var currentNode = element;\n var ancestor = null;\n while (ancestor === null) {\n if (aria.Utils.matches(currentNode.parentNode, selector)) {\n ancestor = currentNode.parentNode;\n }\n else {\n currentNode = currentNode.parentNode;\n }\n }\n \n return ancestor;\n };\n \n aria.Utils.hasClass = function (element, className) {\n return (new RegExp('(\\\\s|^)' + className + '(\\\\s|$)')).test(element.className);\n };\n \n aria.Utils.addClass = function (element, className) {\n if (!aria.Utils.hasClass(element, className)) {\n element.className += ' ' + className;\n }\n };\n \n aria.Utils.removeClass = function (element, className) {\n var classRegex = new RegExp('(\\\\s|^)' + className + '(\\\\s|$)');\n element.className = element.className.replace(classRegex, ' ').trim();\n };\n \n aria.Utils.bindMethods = function (object) {\n var methodNames = Array.prototype.slice.call(arguments, 1);\n methodNames.forEach(function (method) {\n object[method] = object[method].bind(object);\n });\n };\n \n \n /*\n * When util functions move focus around, set this true so the focus listener\n * can ignore the events.\n */\naria.Utils.IgnoreUtilFocusChanges = false;\n\naria.Utils.dialogOpenClass = 'has-dialog';\n\n/**\n * @desc Set focus on descendant nodes until the first focusable element is\n * found.\n * @param element\n * DOM node for which to find the first focusable descendant.\n * @returns\n * true if a focusable element is found and focus is set.\n */\naria.Utils.focusFirstDescendant = function (element) {\n for (var i = 0; i < element.childNodes.length; i++) {\n var child = element.childNodes[i];\n if (aria.Utils.attemptFocus(child) ||\n aria.Utils.focusFirstDescendant(child)) {\n return true;\n }\n }\n return false;\n}; // end focusFirstDescendant\n\n/**\n * @desc Find the last descendant node that is focusable.\n * @param element\n * DOM node for which to find the last focusable descendant.\n * @returns\n * true if a focusable element is found and focus is set.\n */\naria.Utils.focusLastDescendant = function (element) {\n for (var i = element.childNodes.length - 1; i >= 0; i--) {\n var child = element.childNodes[i];\n if (aria.Utils.attemptFocus(child) ||\n aria.Utils.focusLastDescendant(child)) {\n return true;\n }\n }\n return false;\n}; // end focusLastDescendant\n\n/**\n * @desc Set Attempt to set focus on the current node.\n * @param element\n * The node to attempt to focus on.\n * @returns\n * true if element is focused.\n */\naria.Utils.attemptFocus = function (element) {\n if (!aria.Utils.isFocusable(element)) {\n return false;\n }\n \n aria.Utils.IgnoreUtilFocusChanges = true;\n try {\n element.focus();\n }\n catch (e) {\n }\n aria.Utils.IgnoreUtilFocusChanges = false;\n return (document.activeElement === element);\n}; // end attemptFocus\n\n/* Modals can open modals. Keep track of them with this array. */\naria.OpenDialogList = aria.OpenDialogList || new Array(0);\n\n/**\n * @returns the last opened dialog (the current dialog)\n */\naria.getCurrentDialog = function () {\n if (aria.OpenDialogList && aria.OpenDialogList.length) {\n return aria.OpenDialogList[aria.OpenDialogList.length - 1];\n }\n};\n\naria.closeCurrentDialog = function () {\n var currentDialog = aria.getCurrentDialog();\n if (currentDialog) {\n currentDialog.close();\n return true;\n }\n \n return false;\n};\n\n aria.handleEscape = function (event) {\n if (event.key === 'Escape' && aria.closeCurrentDialog()) {\n event.stopPropagation();\n }\n };\n\n document.addEventListener('keyup', aria.handleEscape);\n\n /**\n * @constructor\n * @desc Dialog object providing modal focus management.\n *\n * Assumptions: The element serving as the dialog container is present in the\n * DOM and hidden. The dialog container has role='dialog'.\n *\n * @param dialogNode\n * The element serving as the dialog container.\n * @param focusAfterClosed\n * Either the DOM node or the ID of the DOM node to focus when the\n * dialog closes.\n * @param focusFirst\n * Optional parameter containing either the DOM node or the ID of the\n * DOM node to focus when the dialog opens. If not specified, the\n * first focusable element in the dialog will receive focus.\n */\n aria.Dialog = function (dialogNode, focusAfterClosed, focusFirst, isFullScreen) {\n this.dialogNode = dialogNode;\n if (this.dialogNode === null) {\n throw new Error('No element found');\n }\n\n var validRoles = ['dialog', 'alertdialog'];\n var isDialog = (this.dialogNode.getAttribute('role') || '')\n .trim()\n .split(/\\s+/g)\n .some(function (token) {\n return validRoles.some(function (role) {\n return token === role;\n });\n });\n if (!isDialog) {\n throw new Error(\n 'Dialog() requires a DOM element with ARIA role of dialog or alertdialog.');\n }\n\n // Wrap in an individual backdrop element if one doesn't exist\n // Native <dialog> elements use the ::backdrop pseudo-element, which\n // works similarly.\n var backdropClass = 'content-overlay-background';\n if (this.dialogNode.parentNode.classList.contains(backdropClass)) {\n this.backdropNode = this.dialogNode.parentNode;\n }\n else {\n this.backdropNode = document.createElement('div');\n this.backdropNode.className = backdropClass;\n this.dialogNode.parentNode.insertBefore(this.backdropNode, this.dialogNode);\n this.backdropNode.appendChild(this.dialogNode);\n }\n this.backdropNode.classList.add('active');\n setTimeout(() => {\n this.backdropNode.classList.add('transition');\n }, 1);\n\n // Disable scroll on the body element\n this.isFullscreen = isFullScreen;\n if (isFullScreen) {\n document.body.classList.add(aria.Utils.dialogOpenClass);\n }\n\n if (typeof focusAfterClosed === 'string') {\n this.focusAfterClosed = document.getElementById(focusAfterClosed);\n }\n else if (typeof focusAfterClosed === 'object') {\n this.focusAfterClosed = focusAfterClosed;\n }\n else {\n throw new Error(\n 'the focusAfterClosed parameter is required for the aria.Dialog constructor.');\n }\n\n if (typeof focusFirst === 'string') {\n this.focusFirst = document.getElementById(focusFirst);\n }\n else if (typeof focusFirst === 'object') {\n this.focusFirst = focusFirst;\n }\n else {\n this.focusFirst = null;\n }\n\n // Bracket the dialog node with two invisible, focusable nodes.\n // While this dialog is open, we use these to make sure that focus never\n // leaves the document even if dialogNode is the first or last node.\n var preDiv = document.createElement('div');\n this.preNode = this.dialogNode.parentNode.insertBefore(preDiv,\n this.dialogNode);\n this.preNode.tabIndex = 0;\n var postDiv = document.createElement('div');\n this.postNode = this.dialogNode.parentNode.insertBefore(postDiv,\n this.dialogNode.nextSibling);\n this.postNode.tabIndex = 0;\n\n // If this modal is opening on top of one that is already open,\n // get rid of the document focus listener of the open dialog.\n if (aria.OpenDialogList.length > 0) {\n aria.getCurrentDialog().removeListeners();\n }\n\n if (isFullScreen) {\n this.addListeners();\n }\n aria.OpenDialogList.push(this);\n this.dialogNode.className = 'content-overlay-dialog'; // make visible\n\n if (this.focusFirst) {\n this.focusFirst.focus();\n }\n else {\n aria.Utils.focusFirstDescendant(this.dialogNode);\n }\n\n this.lastFocus = document.activeElement;\n }; // end Dialog constructor\n\n\n /**\n * @desc\n * Hides the current top dialog,\n * removes listeners of the top dialog,\n * restore listeners of a parent dialog if one was open under the one that just closed,\n * and sets focus on the element specified for focusAfterClosed.\n */\n aria.Dialog.prototype.close = function () {\n aria.OpenDialogList.pop();\n this.removeListeners();\n aria.Utils.remove(this.preNode);\n aria.Utils.remove(this.postNode);\n this.dialogNode.className = 'hidden';\n this.backdropNode.classList.remove('active');\n this.backdropNode.classList.remove('transition');\n this.focusAfterClosed.focus();\n\n // If a dialog was open underneath this one, restore its listeners.\n if (aria.OpenDialogList.length > 0 && aria.OpenDialogList.filter(dialog => dialog.isFullscreen === true).length) {\n aria.getCurrentDialog().addListeners();\n }\n else {\n document.body.classList.remove(aria.Utils.dialogOpenClass);\n }\n this.dialogNode.dispatchEvent(new CustomEvent(\"ariaDialog.closed\", {\n bubbles: true,\n \"detail\": {}\n }));\n }; // end close\n\n /**\n * @desc\n * Hides the current dialog and replaces it with another.\n *\n * @param newDialogId\n * ID of the dialog that will replace the currently open top dialog.\n * @param newFocusAfterClosed\n * Optional ID or DOM node specifying where to place focus when the new dialog closes.\n * If not specified, focus will be placed on the element specified by the dialog being replaced.\n * @param newFocusFirst\n * Optional ID or DOM node specifying where to place focus in the new dialog when it opens.\n * If not specified, the first focusable element will receive focus.\n */\n aria.Dialog.prototype.replace = function (newDialogId, newFocusAfterClosed,\n newFocusFirst) {\n // var closedDialog = aria.getCurrentDialog();\n aria.OpenDialogList.pop();\n this.removeListeners();\n aria.Utils.remove(this.preNode);\n aria.Utils.remove(this.postNode);\n this.dialogNode.className = 'hidden';\n this.backdropNode.classList.remove('active');\n this.backdropNode.classList.remove('transition');\n\n var focusAfterClosed = newFocusAfterClosed || this.focusAfterClosed;\n new aria.Dialog(newDialogId, focusAfterClosed, newFocusFirst);\n // var dialog = new aria.Dialog(newDialogId, focusAfterClosed, newFocusFirst);\n }; // end replace\n\n aria.Dialog.prototype.addListeners = function () {\n document.addEventListener('focus', this.trapFocus, true);\n }; // end addListeners\n\n aria.Dialog.prototype.removeListeners = function () {\n document.removeEventListener('focus', this.trapFocus, true);\n }; // end removeListeners\n\n aria.Dialog.prototype.trapFocus = function (event) {\n if (aria.Utils.IgnoreUtilFocusChanges) {\n return;\n }\n var currentDialog = aria.getCurrentDialog();\n if (currentDialog.dialogNode.contains(event.target)) {\n currentDialog.lastFocus = event.target;\n }\n else {\n aria.Utils.focusFirstDescendant(currentDialog.dialogNode);\n if (currentDialog.lastFocus == document.activeElement) {\n aria.Utils.focusLastDescendant(currentDialog.dialogNode);\n }\n currentDialog.lastFocus = document.activeElement;\n }\n }; // end trapFocus\n\n aria.closeDialog = function (closeButton) {\n var topDialog = aria.getCurrentDialog();\n if (topDialog.dialogNode.contains(closeButton)) {\n topDialog.close();\n }\n }; // end closeDialog\n\n aria.replaceDialog = function (newDialogId, newFocusAfterClosed,\n newFocusFirst) {\n var topDialog = aria.getCurrentDialog();\n if (topDialog.dialogNode.contains(document.activeElement)) {\n topDialog.replace(newDialogId, newFocusAfterClosed, newFocusFirst);\n }\n }; // end replaceDialog\n\n window.aria = aria;"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aria-utilities.js","sourceRoot":"","sources":["../../../../../src/components/content-overlay/libraries/aria-utilities.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,IAAI,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC;AACtB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC;AAE9B,gFAAgF;AAChF,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,UAAU,OAAO,EAAE,QAAQ;IAC9C,OAAO,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;AACnC,CAAC,CAAC;AAEF,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,UAAU,IAAI;IAChC,IAAI,IAAI,CAAC,MAAM,IAAI,OAAO,IAAI,CAAC,MAAM,KAAK,UAAU,EAAE;
|
|
1
|
+
{"version":3,"file":"aria-utilities.js","sourceRoot":"","sources":["../../../../../src/components/content-overlay/libraries/aria-utilities.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,IAAI,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC;AACtB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC;AAE9B,gFAAgF;AAChF,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,UAAU,OAAO,EAAE,QAAQ;IAC9C,OAAO,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;AACnC,CAAC,CAAC;AAEF,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,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C,CAAC,IAAI,EAAE,CAAC;AACxE,CAAC,CAAC;AAEF,IAAI,CAAC,KAAK,CAAC,WAAW,GAAG,UAAU,MAAM;IACvC,IAAI,WAAW,GAAG,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC;IAC3D,WAAW,CAAC,OAAO,CAAC,UAAU,MAAM;QAClC,MAAM,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC/C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,MAAM,CAAC,IAAI,GAAG,IAAI,CAAC","sourcesContent":["/**\n * @namespace aria\n */\n\nvar aria = aria || {};\naria.Utils = aria.Utils || {};\n\n// Polyfill src https://developer.mozilla.org/en-US/docs/Web/API/Element/matches\naria.Utils.matches = function (element, selector) {\n return element.matches(selector);\n};\n\naria.Utils.remove = function (item) {\n if (item.remove && typeof item.remove === 'function') {\n return item.remove();\n }\n if (item.parentNode &&\n item.parentNode.removeChild &&\n typeof item.parentNode.removeChild === 'function') {\n return item.parentNode.removeChild(item);\n }\n return false;\n};\n\naria.Utils.isFocusable = function (element) {\n if (element.tabIndex > 0 || (element.tabIndex === 0 && element.getAttribute('tabIndex') !== null)) {\n return true;\n }\n\n if (element.disabled) {\n return false;\n }\n\n switch (element.nodeName) {\n case 'A':\n return !!element.href && element.rel != 'ignore';\n case 'INPUT':\n return element.type != 'hidden' && element.type != 'file';\n case 'BUTTON':\n case 'SELECT':\n case 'TEXTAREA':\n return true;\n default:\n return false;\n }\n};\n\naria.Utils.getAncestorBySelector = function (element, selector) {\n if (!aria.Utils.matches(element, selector + ' ' + element.tagName)) {\n // Element is not inside an element that matches selector\n return null;\n }\n\n // Move up the DOM tree until a parent matching the selector is found\n var currentNode = element;\n var ancestor = null;\n while (ancestor === null) {\n if (aria.Utils.matches(currentNode.parentNode, selector)) {\n ancestor = currentNode.parentNode;\n }\n else {\n currentNode = currentNode.parentNode;\n }\n }\n\n return ancestor;\n};\n\naria.Utils.hasClass = function (element, className) {\n return (new RegExp('(\\\\s|^)' + className + '(\\\\s|$)')).test(element.className);\n};\n\naria.Utils.addClass = function (element, className) {\n if (!aria.Utils.hasClass(element, className)) {\n element.className += ' ' + className;\n }\n};\n\naria.Utils.removeClass = function (element, className) {\n var classRegex = new RegExp('(\\\\s|^)' + className + '(\\\\s|$)');\n element.className = element.className.replace(classRegex, ' ').trim();\n};\n\naria.Utils.bindMethods = function (object) {\n var methodNames = Array.prototype.slice.call(arguments, 1);\n methodNames.forEach(function (method) {\n object[method] = object[method].bind(object);\n });\n};\n\nwindow.aria = aria;"]}
|
|
@@ -10,12 +10,14 @@ export class ContentTabs {
|
|
|
10
10
|
this.classes = undefined;
|
|
11
11
|
this.classString = undefined;
|
|
12
12
|
}
|
|
13
|
-
|
|
14
|
-
new W3Tabs(this.element);
|
|
13
|
+
componentWillLoad() {
|
|
15
14
|
WindowResizeService.registerProp(this.classes).subscribe(newValue => {
|
|
16
15
|
this.classString = newValue;
|
|
17
16
|
});
|
|
18
17
|
}
|
|
18
|
+
componentDidLoad() {
|
|
19
|
+
new W3Tabs(this.element);
|
|
20
|
+
}
|
|
19
21
|
render() {
|
|
20
22
|
return (h(Host, { class: this.classString }, h("slot", { name: "content" }), h("slot", null)));
|
|
21
23
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"content-tabs.js","sourceRoot":"","sources":["../../../../src/components/content-tabs/content-tabs.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACzE,OAAO,MAAM,MAAM,qBAAqB,CAAC;AAEzC,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAE3E;;;GAGG;AAMH,MAAM,OAAO,WAAW;;;;;IActB,
|
|
1
|
+
{"version":3,"file":"content-tabs.js","sourceRoot":"","sources":["../../../../src/components/content-tabs/content-tabs.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACzE,OAAO,MAAM,MAAM,qBAAqB,CAAC;AAEzC,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAE3E;;;GAGG;AAMH,MAAM,OAAO,WAAW;;;;;IActB,iBAAiB;QACf,mBAAmB,CAAC,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAE;YAClE,IAAI,CAAC,WAAW,GAAG,QAAkB,CAAC;QACxC,CAAC,CAAC,CAAC;IACL,CAAC;IAED,gBAAgB;QACd,IAAI,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC3B,CAAC;IACD,MAAM;QACJ,OAAO,CACL,EAAC,IAAI,IAAC,KAAK,EAAE,IAAI,CAAC,WAAW;YAC3B,YAAM,IAAI,EAAC,SAAS,GAAQ;YAC5B,eAAa,CACR,CACR,CAAC;IACJ,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CACF","sourcesContent":["import { Component, h, Element, Host, Prop, State } from '@stencil/core';\nimport W3Tabs from './libraries/w3_tabs';\nimport { ResponsiveString } from '../../typings';\nimport { WindowResizeService } from '../../services/window-resize-service';\n\n/**\n * @slot content - This slot will usually serve specific markup to ensure tabs are accessible.\n * @slot - Default slot, same as content slot.\n */\n@Component({\n tag: 'content-tabs',\n styleUrl: 'content-tabs.scss',\n shadow: false,\n})\nexport class ContentTabs {\n @Element() private element: HTMLElement;\n /**\n * @type String\n * @responsive\n */\n @Prop({\n mutable: true,\n reflect: true,\n })\n classes: ResponsiveString;\n\n @State() classString: string;\n\n componentWillLoad() {\n WindowResizeService.registerProp(this.classes).subscribe(newValue => {\n this.classString = newValue as string;\n });\n }\n\n componentDidLoad() {\n new W3Tabs(this.element);\n }\n render() {\n return (\n <Host class={this.classString}>\n <slot name=\"content\"></slot>\n <slot></slot>\n </Host>\n );\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"w3_tabs.js","sourceRoot":"","sources":["../../../../../src/components/content-tabs/libraries/w3_tabs.ts"],"names":[],"mappings":"AAAA;;;EAGE;AACF,MAAM,CAAC,OAAO,OAAO,MAAM;IACzB,YAAY,cAA2B;QACrC,IAAI,OAAO,GAAG,cAAc,CAAC,gBAAgB,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC;QACrE,IAAI,IAAI,CAAC;QACT,IAAI,MAAM,CAAC;QAEX,cAAc,EAAE,CAAC;QAEjB,SAAS,cAAc;YACrB,IAAI,GAAG,cAAc,CAAC,gBAAgB,CAAC,cAAc,CAAC,CAAC;YACvD,MAAM,GAAG,cAAc,CAAC,gBAAgB,CAAC,mBAAmB,CAAC,CAAC;QAChE,CAAC;QAAA,CAAC;QAEF,qBAAqB;QACrB,IAAI,IAAI,GAAG;YACT,GAAG,EAAE,EAAE;YACP,IAAI,EAAE,EAAE;YACR,IAAI,EAAE,EAAE;YACR,EAAE,EAAE,EAAE;YACN,KAAK,EAAE,EAAE;YACT,IAAI,EAAE,EAAE;YACR,MAAM,EAAE,EAAE;YACV,KAAK,EAAE,EAAE;YACT,KAAK,EAAE,EAAE;SACV,CAAC;QAEF,2CAA2C;QAC3C,IAAI,SAAS,GAAG;YACd,EAAE,EAAE,CAAC,CAAC;YACN,EAAE,EAAE,CAAC,CAAC;YACN,EAAE,EAAE,CAAC;YACL,EAAE,EAAE,CAAC;SACN,CAAC;QAEF,iBAAiB;QACjB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC,EAAE;YACpC,YAAY,CAAC,CAAC,CAAC,CAAC;SACjB;QAAA,CAAC;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B;qBACI;oBACH,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC;iBACrC;gBAAA,CAAC;aACH;YAAA,CAAC;QACJ,CAAC;QAAA,CAAC;QAEF,8BAA8B;QAC9B,SAAS,SAAS,CAAC,KAAK;YACtB,IAAI,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;YAC1B,IAAI,KAAK,GAAG,QAAQ,CAAC,cAAc,CAAC,MAAM,CAAC,YAAY,CAAC,eAAe,CAAC,CAAC,CAAC;YAE1E,MAAM,CAAC,aAAa,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;YACzC,KAAK,CAAC,aAAa,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;QACzC,CAAC;QAAA,CAAC;IACJ,CAAC;CACF;AAAA,CAAC","sourcesContent":["/*\n* This content is licensed according to the W3C Software License at\n* https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document\n*/\nexport default class W3Tabs {\n constructor(stencilElement: HTMLElement) {\n var tablist = stencilElement.querySelectorAll('[role=\"tablist\"]')[0];\n var tabs;\n var panels;\n\n generateArrays();\n\n function generateArrays () {\n tabs = stencilElement.querySelectorAll('[role=\"tab\"]');\n panels = stencilElement.querySelectorAll('[role=\"tabpanel\"]');\n };\n\n // For easy reference\n var keys = {\n end: 35,\n home: 36,\n left: 37,\n up: 38,\n right: 39,\n down: 40,\n delete: 46,\n enter: 13,\n space: 32\n };\n\n // Add or subtract depending on key pressed\n var direction = {\n 37: -1,\n 38: -1,\n 39: 1,\n 40: 1\n };\n\n // Bind listeners\n for (var i = 0; i < tabs.length; ++i) {\n addListeners(i);\n };\n\n function addListeners (index) {\n tabs[index].addEventListener('click', clickEventListener);\n tabs[index].addEventListener('keydown', keydownEventListener);\n tabs[index].addEventListener('keyup', keyupEventListener);\n\n // Build an array with all tabs (<button>s) in it\n tabs[index].index = index;\n };\n\n // When a tab is clicked, activateTab is fired to activate it\n function clickEventListener (event) {\n let tab = event.target.closest('button');\n event.preventDefault();\n activateTab(tab, false);\n };\n\n // Handle keydown on tabs\n function keydownEventListener (event) {\n var key = event.keyCode;\n\n switch (key) {\n case keys.end:\n event.preventDefault();\n // Activate last tab\n focusLastTab();\n break;\n case keys.home:\n event.preventDefault();\n // Activate first tab\n focusFirstTab();\n break;\n\n // Up and down are in keydown\n // because we need to prevent page scroll >:)\n case keys.up:\n case keys.down:\n determineOrientation(event);\n break;\n };\n };\n\n // Handle keyup on tabs\n function keyupEventListener (event) {\n var key = event.keyCode;\n\n switch (key) {\n case keys.left:\n case keys.right:\n determineOrientation(event);\n break;\n case keys.delete:\n determineDeletable(event);\n break;\n case keys.enter:\n case keys.space:\n event.preventDefault();\n activateTab(event.target);\n break;\n };\n };\n\n // When a tablist’s aria-orientation is set to vertical,\n // only up and down arrow should function.\n // In all other cases only left and right arrow function.\n function determineOrientation (event) {\n var key = event.keyCode;\n var vertical = tablist.getAttribute('aria-orientation') == 'vertical';\n var proceed = false;\n\n if (vertical) {\n if (key === keys.up || key === keys.down) {\n event.preventDefault();\n proceed = true;\n };\n }\n else {\n if (key === keys.left || key === keys.right) {\n proceed = true;\n };\n };\n\n if (proceed) {\n switchTabOnArrowPress(event);\n };\n };\n\n // Either focus the next, previous, first, or last tab\n // depending on key pressed\n function switchTabOnArrowPress (event) {\n var pressed = event.keyCode;\n\n if (direction[pressed]) {\n var target = event.target;\n if (target.index !== undefined) {\n if (tabs[target.index + direction[pressed]]) {\n tabs[target.index + direction[pressed]].focus();\n }\n else if (pressed === keys.left || pressed === keys.up) {\n focusLastTab();\n }\n else if (pressed === keys.right || pressed == keys.down) {\n focusFirstTab();\n };\n };\n };\n };\n\n // Activates any given tab panel\n function activateTab (tab, setFocus?) {\n setFocus = setFocus || true;\n // Deactivate all other tabs\n deactivateTabs();\n\n // Remove tabindex attribute\n tab.removeAttribute('tabindex');\n\n // Set the tab as selected\n tab.setAttribute('aria-selected', 'true');\n\n // Get the value of aria-controls (which is an ID)\n var controls = tab.getAttribute('aria-controls');\n\n // Remove hidden attribute from tab panel to make it visible\n document.getElementById(controls).removeAttribute('hidden');\n\n // Set focus when required\n if (setFocus) {\n tab.focus();\n };\n };\n\n // Deactivate all tabs and tab panels\n function deactivateTabs () {\n for (var t = 0; t < tabs.length; t++) {\n tabs[t].setAttribute('tabindex', '-1');\n tabs[t].setAttribute('aria-selected', 'false');\n };\n\n for (var p = 0; p < panels.length; p++) {\n panels[p].setAttribute('hidden', 'hidden');\n };\n };\n\n // Make a guess\n function focusFirstTab () {\n tabs[0].focus();\n };\n\n // Make a guess\n function focusLastTab () {\n tabs[tabs.length - 1].focus();\n };\n\n // Detect if a tab is deletable\n function determineDeletable (event) {\n var target = event.target;\n\n if (target.getAttribute('data-deletable') !== null) {\n // Delete target tab\n deleteTab(event);\n\n // Update arrays related to tabs widget\n generateArrays();\n\n // Activate the closest tab to the one that was just deleted\n if (target.index - 1 < 0) {\n activateTab(tabs[0]);\n }\n else {\n activateTab(tabs[target.index - 1]);\n };\n };\n };\n\n // Deletes a tab and its panel\n function deleteTab(event) {\n var target = event.target;\n var panel = document.getElementById(target.getAttribute('aria-controls'));\n\n target.parentElement.removeChild(target);\n panel.parentElement.removeChild(panel);\n };\n }\n};"]}
|
|
1
|
+
{"version":3,"file":"w3_tabs.js","sourceRoot":"","sources":["../../../../../src/components/content-tabs/libraries/w3_tabs.ts"],"names":[],"mappings":"AAAA;;;EAGE;AACF,MAAM,CAAC,OAAO,OAAO,MAAM;IACzB,YAAY,cAA2B;QACrC,IAAI,OAAO,GAAG,cAAc,CAAC,gBAAgB,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC;QACrE,IAAI,IAAI,CAAC;QACT,IAAI,MAAM,CAAC;QAEX,cAAc,EAAE,CAAC;QAEjB,SAAS,cAAc;YACrB,IAAI,GAAG,cAAc,CAAC,gBAAgB,CAAC,cAAc,CAAC,CAAC;YACvD,MAAM,GAAG,cAAc,CAAC,gBAAgB,CAAC,mBAAmB,CA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AM,CAAC,CAAC;YACzC,KAAK,CAAC,aAAa,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;QACzC,CAAC;QAAA,CAAC;IACJ,CAAC;CACF;AAAA,CAAC","sourcesContent":["/*\n* This content is licensed according to the W3C Software License at\n* https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document\n*/\nexport default class W3Tabs {\n constructor(stencilElement: HTMLElement) {\n var tablist = stencilElement.querySelectorAll('[role=\"tablist\"]')[0];\n var tabs;\n var panels;\n\n generateArrays();\n\n function generateArrays () {\n tabs = stencilElement.querySelectorAll('[role=\"tab\"]');\n panels = stencilElement.querySelectorAll('[role=\"tabpanel\"]');\n };\n\n // For easy reference\n var keys = {\n end: 35,\n home: 36,\n left: 37,\n up: 38,\n right: 39,\n down: 40,\n delete: 46,\n enter: 13,\n space: 32\n };\n\n // Add or subtract depending on key pressed\n var direction = {\n 37: -1,\n 38: -1,\n 39: 1,\n 40: 1\n };\n\n // Bind listeners\n for (var i = 0; i < tabs.length; ++i) {\n addListeners(i);\n };\n\n function addListeners (index) {\n tabs[index].addEventListener('click', clickEventListener);\n tabs[index].addEventListener('keydown', keydownEventListener);\n tabs[index].addEventListener('keyup', keyupEventListener);\n\n // Build an array with all tabs (<button>s) in it\n tabs[index].index = index;\n };\n\n // When a tab is clicked, activateTab is fired to activate it\n function clickEventListener (event) {\n let tab = event.target.closest('button');\n event.preventDefault();\n activateTab(tab, false);\n };\n\n // Handle keydown on tabs\n function keydownEventListener (event) {\n var key = event.keyCode;\n\n switch (key) {\n case keys.end:\n event.preventDefault();\n // Activate last tab\n focusLastTab();\n break;\n case keys.home:\n event.preventDefault();\n // Activate first tab\n focusFirstTab();\n break;\n\n // Up and down are in keydown\n // because we need to prevent page scroll >:)\n case keys.up:\n case keys.down:\n determineOrientation(event);\n break;\n };\n };\n\n // Handle keyup on tabs\n function keyupEventListener (event) {\n var key = event.keyCode;\n\n switch (key) {\n case keys.left:\n case keys.right:\n determineOrientation(event);\n break;\n case keys.delete:\n determineDeletable(event);\n break;\n case keys.enter:\n case keys.space:\n event.preventDefault();\n activateTab(event.target);\n break;\n };\n };\n\n // When a tablist’s aria-orientation is set to vertical,\n // only up and down arrow should function.\n // In all other cases only left and right arrow function.\n function determineOrientation (event) {\n var key = event.keyCode;\n var vertical = tablist.getAttribute('aria-orientation') == 'vertical';\n var proceed = false;\n\n if (vertical) {\n if (key === keys.up || key === keys.down) {\n event.preventDefault();\n proceed = true;\n };\n }\n else {\n if (key === keys.left || key === keys.right) {\n proceed = true;\n };\n };\n\n if (proceed) {\n switchTabOnArrowPress(event);\n };\n };\n\n // Either focus the next, previous, first, or last tab\n // depending on key pressed\n function switchTabOnArrowPress (event) {\n var pressed = event.keyCode;\n\n if (direction[pressed]) {\n var target = event.target;\n if (target.index !== undefined) {\n if (tabs[target.index + direction[pressed]]) {\n tabs[target.index + direction[pressed]].focus();\n }\n else if (pressed === keys.left || pressed === keys.up) {\n focusLastTab();\n }\n else if (pressed === keys.right || pressed == keys.down) {\n focusFirstTab();\n };\n };\n };\n };\n\n // Activates any given tab panel\n function activateTab (tab, setFocus?) {\n setFocus = setFocus || true;\n // Deactivate all other tabs\n deactivateTabs();\n\n // Remove tabindex attribute\n tab.removeAttribute('tabindex');\n\n // Set the tab as selected\n tab.setAttribute('aria-selected', 'true');\n\n // Get the value of aria-controls (which is an ID)\n var controls = tab.getAttribute('aria-controls');\n\n // Remove hidden attribute from tab panel to make it visible\n document.getElementById(controls).removeAttribute('hidden');\n\n // Set focus when required\n if (setFocus) {\n tab.focus();\n };\n };\n\n // Deactivate all tabs and tab panels\n function deactivateTabs () {\n for (var t = 0; t < tabs.length; t++) {\n tabs[t].setAttribute('tabindex', '-1');\n tabs[t].setAttribute('aria-selected', 'false');\n };\n\n for (var p = 0; p < panels.length; p++) {\n panels[p].setAttribute('hidden', 'hidden');\n };\n };\n\n // Make a guess\n function focusFirstTab () {\n tabs[0].focus();\n };\n\n // Make a guess\n function focusLastTab () {\n tabs[tabs.length - 1].focus();\n };\n\n // Detect if a tab is deletable\n function determineDeletable (event) {\n var target = event.target;\n\n if (target.getAttribute('data-deletable') !== null) {\n // Delete target tab\n deleteTab(event);\n\n // Update arrays related to tabs widget\n generateArrays();\n\n // Activate the closest tab to the one that was just deleted\n if (target.index - 1 < 0) {\n activateTab(tabs[0]);\n }\n else {\n activateTab(tabs[target.index - 1]);\n };\n };\n };\n\n // Deletes a tab and its panel\n function deleteTab(event) {\n var target = event.target;\n var panel = document.getElementById(target.getAttribute('aria-controls'));\n\n target.parentElement.removeChild(target);\n panel.parentElement.removeChild(panel);\n };\n }\n};"]}
|