@telesign/boreal-web-components 0.1.0-alpha.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/LICENSE +21 -0
- package/components-build/bds-banner.d.ts +11 -0
- package/components-build/bds-banner.js +1 -0
- package/components-build/bds-typography.d.ts +11 -0
- package/components-build/bds-typography.js +1 -0
- package/components-build/index.d.ts +35 -0
- package/components-build/index.js +1 -0
- package/components-build/my-component.d.ts +11 -0
- package/components-build/my-component.js +1 -0
- package/components-build/p-B9wshZ_4.js +1 -0
- package/components-build/p-noyWJ11s.js +1 -0
- package/custom-elements.json +764 -0
- package/dist/boreal-web-components/boreal-web-components.css +1 -0
- package/dist/boreal-web-components/boreal-web-components.esm.js +1 -0
- package/dist/boreal-web-components/boreal-web-components.js +127 -0
- package/dist/boreal-web-components/css/boreal.css +1594 -0
- package/dist/boreal-web-components/css/global.css +682 -0
- package/dist/boreal-web-components/css/theme-connect.css +227 -0
- package/dist/boreal-web-components/css/theme-engage.css +227 -0
- package/dist/boreal-web-components/css/theme-protect.css +227 -0
- package/dist/boreal-web-components/css/theme-proximus.css +227 -0
- package/dist/boreal-web-components/index.esm.js +0 -0
- package/dist/boreal-web-components/p-412d037b.system.entry.js +1 -0
- package/dist/boreal-web-components/p-527a761b.entry.js +1 -0
- package/dist/boreal-web-components/p-5666a22a.system.entry.js +1 -0
- package/dist/boreal-web-components/p-B-PpI2Xv.system.js +1 -0
- package/dist/boreal-web-components/p-B9wshZ_4.js +1 -0
- package/dist/boreal-web-components/p-BQdH0ijK.system.js +2 -0
- package/dist/boreal-web-components/p-BbPAtVJG.system.js +1 -0
- package/dist/boreal-web-components/p-CMd-Mv-5.system.js +1 -0
- package/dist/boreal-web-components/p-CaVEtaG3.system.js +1 -0
- package/dist/boreal-web-components/p-DQuL1Twl.js +1 -0
- package/dist/boreal-web-components/p-DgFiTd6X.js +2 -0
- package/dist/boreal-web-components/p-YWpyar7R.system.js +1 -0
- package/dist/boreal-web-components/p-b818618b.entry.js +1 -0
- package/dist/boreal-web-components/p-d596406b.entry.js +1 -0
- package/dist/boreal-web-components/p-e37e7dba.system.entry.js +1 -0
- package/dist/boreal-web-components/p-noyWJ11s.js +1 -0
- package/dist/boreal-web-components/scss/global/_fonts.scss +1 -0
- package/dist/boreal-web-components/scss/global/_index.scss +3 -0
- package/dist/boreal-web-components/scss/global/_reset.scss +50 -0
- package/dist/boreal-web-components/scss/global/_typography.scss +156 -0
- package/dist/boreal-web-components/scss/maps/_primitives.scss +461 -0
- package/dist/boreal-web-components/scss/maps/_theme-connect.scss +227 -0
- package/dist/boreal-web-components/scss/maps/_theme-engage.scss +227 -0
- package/dist/boreal-web-components/scss/maps/_theme-protect.scss +227 -0
- package/dist/boreal-web-components/scss/maps/_theme-proximus.scss +227 -0
- package/dist/boreal-web-components/scss/variables/_primitives.scss +459 -0
- package/dist/boreal-web-components/scss/variables/_theme-connect.scss +225 -0
- package/dist/boreal-web-components/scss/variables/_theme-engage.scss +225 -0
- package/dist/boreal-web-components/scss/variables/_theme-protect.scss +225 -0
- package/dist/boreal-web-components/scss/variables/_theme-proximus.scss +225 -0
- package/dist/cjs/app-globals-V2Kpy_OQ.js +5 -0
- package/dist/cjs/attributes-RPVEtBdj.js +90 -0
- package/dist/cjs/bds-banner.cjs.entry.js +130 -0
- package/dist/cjs/bds-typography.cjs.entry.js +167 -0
- package/dist/cjs/boreal-web-components.cjs.js +46 -0
- package/dist/cjs/index-CD9v53WJ.js +133 -0
- package/dist/cjs/index-Cdb66Tqj.js +2342 -0
- package/dist/cjs/index.cjs.js +2 -0
- package/dist/cjs/loader.cjs.js +13 -0
- package/dist/cjs/my-component.cjs.entry.js +29 -0
- package/dist/collection/collection-manifest.json +14 -0
- package/dist/collection/components/feedback/bds-banner/bds-banner.css +101 -0
- package/dist/collection/components/feedback/bds-banner/bds-banner.js +266 -0
- package/dist/collection/components/feedback/bds-banner/types/IBanner.js +1 -0
- package/dist/collection/components/my-component/my-component.css +3 -0
- package/dist/collection/components/my-component/my-component.js +95 -0
- package/dist/collection/components/titles-text/bds-typography/bds-typography.css +183 -0
- package/dist/collection/components/titles-text/bds-typography/bds-typography.js +577 -0
- package/dist/collection/components/titles-text/bds-typography/types/ITypography.js +1 -0
- package/dist/collection/components/titles-text/bds-typography/types/enum.js +23 -0
- package/dist/collection/components/titles-text/bds-typography/types/types.js +1 -0
- package/dist/collection/components/titles-text/bds-typography/utils/bds-typography-utils.js +41 -0
- package/dist/collection/css/boreal.css +1594 -0
- package/dist/collection/css/global.css +682 -0
- package/dist/collection/css/theme-connect.css +227 -0
- package/dist/collection/css/theme-engage.css +227 -0
- package/dist/collection/css/theme-protect.css +227 -0
- package/dist/collection/css/theme-proximus.css +227 -0
- package/dist/collection/index.js +1 -0
- package/dist/collection/mixins/anchored.mixin.js +272 -0
- package/dist/collection/mixins/floating.mixin.js +181 -0
- package/dist/collection/mixins/form-associated.mixin.js +95 -0
- package/dist/collection/mixins/index.js +3 -0
- package/dist/collection/scss/global/_fonts.scss +1 -0
- package/dist/collection/scss/global/_index.scss +3 -0
- package/dist/collection/scss/global/_reset.scss +50 -0
- package/dist/collection/scss/global/_typography.scss +156 -0
- package/dist/collection/scss/maps/_primitives.scss +461 -0
- package/dist/collection/scss/maps/_theme-connect.scss +227 -0
- package/dist/collection/scss/maps/_theme-engage.scss +227 -0
- package/dist/collection/scss/maps/_theme-protect.scss +227 -0
- package/dist/collection/scss/maps/_theme-proximus.scss +227 -0
- package/dist/collection/scss/variables/_primitives.scss +459 -0
- package/dist/collection/scss/variables/_theme-connect.scss +225 -0
- package/dist/collection/scss/variables/_theme-engage.scss +225 -0
- package/dist/collection/scss/variables/_theme-protect.scss +225 -0
- package/dist/collection/scss/variables/_theme-proximus.scss +225 -0
- package/dist/collection/services/floating/interfaces/Floating.js +1 -0
- package/dist/collection/services/floating/interfaces/Positioning.js +1 -0
- package/dist/collection/services/floating/interfaces/Props.js +1 -0
- package/dist/collection/services/floating/positioning.service.js +71 -0
- package/dist/collection/services/floating/types/Arrow.js +1 -0
- package/dist/collection/services/logger/Logger.js +47 -0
- package/dist/collection/types/alignment.js +6 -0
- package/dist/collection/types/form.js +1 -0
- package/dist/collection/types/index.js +5 -0
- package/dist/collection/types/position.js +11 -0
- package/dist/collection/types/size.js +7 -0
- package/dist/collection/types/states.js +22 -0
- package/dist/collection/types/stylesMap.js +1 -0
- package/dist/collection/utils/a11y/attributes.js +80 -0
- package/dist/collection/utils/a11y/index.js +1 -0
- package/dist/collection/utils/constants/common/Events.js +10 -0
- package/dist/collection/utils/constants/common/Keys.js +16 -0
- package/dist/collection/utils/dom/elements.js +22 -0
- package/dist/collection/utils/dom/index.js +1 -0
- package/dist/collection/utils/form/index.js +1 -0
- package/dist/collection/utils/form/internals.js +79 -0
- package/dist/collection/utils/helpers/common/BaseAttributes.js +17 -0
- package/dist/collection/utils/index.js +3 -0
- package/dist/css/boreal.css +1594 -0
- package/dist/css/global.css +682 -0
- package/dist/css/theme-connect.css +227 -0
- package/dist/css/theme-engage.css +227 -0
- package/dist/css/theme-protect.css +227 -0
- package/dist/css/theme-proximus.css +227 -0
- package/dist/esm/app-globals-DQuL1Twl.js +3 -0
- package/dist/esm/attributes-B9wshZ_4.js +86 -0
- package/dist/esm/bds-banner.entry.js +128 -0
- package/dist/esm/bds-typography.entry.js +165 -0
- package/dist/esm/boreal-web-components.js +42 -0
- package/dist/esm/index-DgFiTd6X.js +2332 -0
- package/dist/esm/index-noyWJ11s.js +131 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/loader.js +11 -0
- package/dist/esm/my-component.entry.js +27 -0
- package/dist/esm/polyfills/core-js.js +11 -0
- package/dist/esm/polyfills/dom.js +79 -0
- package/dist/esm/polyfills/es5-html-element.js +1 -0
- package/dist/esm/polyfills/index.js +34 -0
- package/dist/esm/polyfills/system.js +6 -0
- package/dist/esm-es5/app-globals-DQuL1Twl.js +1 -0
- package/dist/esm-es5/attributes-B9wshZ_4.js +1 -0
- package/dist/esm-es5/bds-banner.entry.js +1 -0
- package/dist/esm-es5/bds-typography.entry.js +1 -0
- package/dist/esm-es5/boreal-web-components.js +1 -0
- package/dist/esm-es5/index-DgFiTd6X.js +2 -0
- package/dist/esm-es5/index-noyWJ11s.js +1 -0
- package/dist/esm-es5/index.js +0 -0
- package/dist/esm-es5/loader.js +1 -0
- package/dist/esm-es5/my-component.entry.js +1 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/scss/global/_fonts.scss +1 -0
- package/dist/scss/global/_index.scss +3 -0
- package/dist/scss/global/_reset.scss +50 -0
- package/dist/scss/global/_typography.scss +156 -0
- package/dist/scss/maps/_primitives.scss +461 -0
- package/dist/scss/maps/_theme-connect.scss +227 -0
- package/dist/scss/maps/_theme-engage.scss +227 -0
- package/dist/scss/maps/_theme-protect.scss +227 -0
- package/dist/scss/maps/_theme-proximus.scss +227 -0
- package/dist/scss/variables/_primitives.scss +459 -0
- package/dist/scss/variables/_theme-connect.scss +225 -0
- package/dist/scss/variables/_theme-engage.scss +225 -0
- package/dist/scss/variables/_theme-protect.scss +225 -0
- package/dist/scss/variables/_theme-proximus.scss +225 -0
- package/dist/types/components/feedback/bds-banner/bds-banner.d.ts +71 -0
- package/dist/types/components/feedback/bds-banner/types/IBanner.d.ts +10 -0
- package/dist/types/components/my-component/my-component.d.ts +16 -0
- package/dist/types/components/titles-text/bds-typography/bds-typography.d.ts +99 -0
- package/dist/types/components/titles-text/bds-typography/types/ITypography.d.ts +22 -0
- package/dist/types/components/titles-text/bds-typography/types/enum.d.ts +24 -0
- package/dist/types/components/titles-text/bds-typography/types/types.d.ts +4 -0
- package/dist/types/components/titles-text/bds-typography/utils/bds-typography-utils.d.ts +15 -0
- package/dist/types/components.d.ts +565 -0
- package/dist/types/index.d.ts +11 -0
- package/dist/types/mixins/anchored.mixin.d.ts +228 -0
- package/dist/types/mixins/floating.mixin.d.ts +158 -0
- package/dist/types/mixins/form-associated.mixin.d.ts +127 -0
- package/dist/types/mixins/index.d.ts +4 -0
- package/dist/types/services/floating/interfaces/Floating.d.ts +38 -0
- package/dist/types/services/floating/interfaces/Positioning.d.ts +22 -0
- package/dist/types/services/floating/interfaces/Props.d.ts +35 -0
- package/dist/types/services/floating/positioning.service.d.ts +45 -0
- package/dist/types/services/floating/types/Arrow.d.ts +7 -0
- package/dist/types/services/logger/Logger.d.ts +50 -0
- package/dist/types/stencil-public-runtime.d.ts +1858 -0
- package/dist/types/types/alignment.d.ts +8 -0
- package/dist/types/types/form.d.ts +7 -0
- package/dist/types/types/index.d.ts +6 -0
- package/dist/types/types/position.d.ts +13 -0
- package/dist/types/types/size.d.ts +9 -0
- package/dist/types/types/states.d.ts +26 -0
- package/dist/types/types/stylesMap.d.ts +2 -0
- package/dist/types/utils/a11y/attributes.d.ts +13 -0
- package/dist/types/utils/a11y/index.d.ts +2 -0
- package/dist/types/utils/constants/common/Events.d.ts +14 -0
- package/dist/types/utils/constants/common/Keys.d.ts +18 -0
- package/dist/types/utils/dom/elements.d.ts +12 -0
- package/dist/types/utils/dom/index.d.ts +2 -0
- package/dist/types/utils/form/index.d.ts +2 -0
- package/dist/types/utils/form/internals.d.ts +66 -0
- package/dist/types/utils/helpers/common/BaseAttributes.d.ts +16 -0
- package/dist/types/utils/index.d.ts +4 -0
- package/loader/cdn.js +2 -0
- package/loader/index.cjs.js +2 -0
- package/loader/index.d.ts +24 -0
- package/loader/index.es2017.js +2 -0
- package/loader/index.js +3 -0
- package/package.json +96 -0
- package/readme.md +111 -0
- package/scripts/copy-styles.js +18 -0
- package/scripts/postbuild.js +21 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var index = require('./index-Cdb66Tqj.js');
|
|
4
|
+
var appGlobals = require('./app-globals-V2Kpy_OQ.js');
|
|
5
|
+
|
|
6
|
+
const defineCustomElements = async (win, options) => {
|
|
7
|
+
if (typeof window === 'undefined') return undefined;
|
|
8
|
+
await appGlobals.globalScripts();
|
|
9
|
+
return index.bootstrapLazy([["bds-banner.cjs",[[260,"bds-banner",{"idComponent":[1,"id-component"],"variant":[1],"enableClose":[4,"enable-close"],"isClosing":[32],"isOpen":[32],"closeBanner":[64]}]]],["bds-typography.cjs",[[260,"bds-typography",{"variant":[513],"size":[513],"state":[513],"customClass":[1,"custom-class"],"element":[1],"align":[1],"ellipsis":[4],"maxLines":[2,"max-lines"],"tooltipText":[1,"tooltip-text"],"isRequired":[516,"is-required"],"htmlFor":[1,"html-for"],"href":[1],"target":[1],"isDownloadable":[4,"is-downloadable"],"filename":[1],"sanitizedHref":[32]},null,{"href":[{"updateSanitizedHref":0}]}]]],["my-component.cjs",[[0,"my-component",{"first":[1],"middle":[1],"last":[1]}]]]], options);
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
exports.setNonce = index.setNonce;
|
|
13
|
+
exports.defineCustomElements = defineCustomElements;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var index = require('./index-Cdb66Tqj.js');
|
|
4
|
+
|
|
5
|
+
const myComponentCss = () => `:host{display:block}`;
|
|
6
|
+
|
|
7
|
+
const MyComponent = class {
|
|
8
|
+
constructor(hostRef) {
|
|
9
|
+
index.registerInstance(this, hostRef);
|
|
10
|
+
/**
|
|
11
|
+
* The first name
|
|
12
|
+
*/
|
|
13
|
+
this.first = '';
|
|
14
|
+
/**
|
|
15
|
+
* The middle name
|
|
16
|
+
*/
|
|
17
|
+
this.middle = '';
|
|
18
|
+
/**
|
|
19
|
+
* The last name
|
|
20
|
+
*/
|
|
21
|
+
this.last = '';
|
|
22
|
+
}
|
|
23
|
+
render() {
|
|
24
|
+
return index.h("div", { key: '2f3775c7b3d8475826a01101110bd2876a57f2cb' }, " Hello, World! I'm Stencil 'Don't call me a framework' JS");
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
MyComponent.style = myComponentCss();
|
|
28
|
+
|
|
29
|
+
exports.my_component = MyComponent;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"entries": [
|
|
3
|
+
"components/feedback/bds-banner/bds-banner.js",
|
|
4
|
+
"components/my-component/my-component.js",
|
|
5
|
+
"components/titles-text/bds-typography/bds-typography.js"
|
|
6
|
+
],
|
|
7
|
+
"compiler": {
|
|
8
|
+
"name": "@stencil/core",
|
|
9
|
+
"version": "4.42.1",
|
|
10
|
+
"typescriptVersion": "5.8.3"
|
|
11
|
+
},
|
|
12
|
+
"collections": [],
|
|
13
|
+
"bundles": []
|
|
14
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
.bds-banner {
|
|
2
|
+
position: relative;
|
|
3
|
+
display: flex;
|
|
4
|
+
border: var(--boreal-spacing-4xs) solid var(--boreal-stroke-info-base);
|
|
5
|
+
border-radius: var(--boreal-radius-xs);
|
|
6
|
+
border-left: 0;
|
|
7
|
+
font-family: var(--boreal-typography-font-family-primary);
|
|
8
|
+
height: 100%;
|
|
9
|
+
transition: all 0.3s ease-out;
|
|
10
|
+
}
|
|
11
|
+
.bds-banner__vertical-line {
|
|
12
|
+
width: var(--boreal-spacing-2xs);
|
|
13
|
+
border-top-left-radius: var(--boreal-radius-xs);
|
|
14
|
+
border-bottom-left-radius: var(--boreal-radius-xs);
|
|
15
|
+
background-color: var(--boreal-stroke-info-base);
|
|
16
|
+
}
|
|
17
|
+
.bds-banner__container {
|
|
18
|
+
display: flex;
|
|
19
|
+
justify-content: space-between;
|
|
20
|
+
width: 100%;
|
|
21
|
+
gap: var(--boreal-spacing-xs);
|
|
22
|
+
padding: var(--boreal-spacing-s);
|
|
23
|
+
}
|
|
24
|
+
.bds-banner__content {
|
|
25
|
+
width: 100%;
|
|
26
|
+
}
|
|
27
|
+
.bds-banner__title {
|
|
28
|
+
font-weight: var(--boreal-typography-font-weight-semibold);
|
|
29
|
+
font-size: var(--boreal-typography-font-size-md);
|
|
30
|
+
line-height: var(--boreal-typography-line-height-md);
|
|
31
|
+
}
|
|
32
|
+
.bds-banner__body {
|
|
33
|
+
padding-top: var(--boreal-spacing-2xs);
|
|
34
|
+
font-size: var(--boreal-typography-font-size-sm);
|
|
35
|
+
line-height: var(--boreal-typography-line-height-sm);
|
|
36
|
+
}
|
|
37
|
+
.bds-banner__actions {
|
|
38
|
+
padding-top: var(--boreal-spacing-s);
|
|
39
|
+
min-height: 0px;
|
|
40
|
+
}
|
|
41
|
+
.bds-banner__actions:empty {
|
|
42
|
+
display: none;
|
|
43
|
+
}
|
|
44
|
+
.bds-banner__status-icon {
|
|
45
|
+
font-size: var(--boreal-typography-font-size-md);
|
|
46
|
+
line-height: var(--boreal-typography-line-height-md);
|
|
47
|
+
margin-top: var(--boreal-spacing-3xs);
|
|
48
|
+
}
|
|
49
|
+
.bds-banner__close-icon {
|
|
50
|
+
background: none;
|
|
51
|
+
border: none;
|
|
52
|
+
align-self: start;
|
|
53
|
+
font-size: var(--boreal-typography-font-size-md);
|
|
54
|
+
line-height: var(--boreal-typography-line-height-md);
|
|
55
|
+
color: var(--boreal-neutral-base);
|
|
56
|
+
cursor: pointer;
|
|
57
|
+
}
|
|
58
|
+
.bds-banner--info {
|
|
59
|
+
border-color: var(--boreal-stroke-info-base);
|
|
60
|
+
background-color: var(--boreal-ui-info-lighter);
|
|
61
|
+
}
|
|
62
|
+
.bds-banner--info .bds-banner__vertical-line {
|
|
63
|
+
background-color: var(--boreal-stroke-info-base);
|
|
64
|
+
}
|
|
65
|
+
.bds-banner--info .bds-banner__status-icon {
|
|
66
|
+
color: var(--boreal-stroke-info-base);
|
|
67
|
+
}
|
|
68
|
+
.bds-banner--success {
|
|
69
|
+
border-color: var(--boreal-stroke-success-base);
|
|
70
|
+
background-color: var(--boreal-ui-success-lighter);
|
|
71
|
+
}
|
|
72
|
+
.bds-banner--success .bds-banner__vertical-line {
|
|
73
|
+
background-color: var(--boreal-stroke-success-base);
|
|
74
|
+
}
|
|
75
|
+
.bds-banner--success .bds-banner__status-icon {
|
|
76
|
+
color: var(--boreal-stroke-success-base);
|
|
77
|
+
}
|
|
78
|
+
.bds-banner--warning {
|
|
79
|
+
border-color: var(--boreal-stroke-warning);
|
|
80
|
+
background-color: var(--boreal-ui-warning-lighter);
|
|
81
|
+
}
|
|
82
|
+
.bds-banner--warning .bds-banner__vertical-line {
|
|
83
|
+
background-color: var(--boreal-stroke-warning);
|
|
84
|
+
}
|
|
85
|
+
.bds-banner--warning .bds-banner__status-icon {
|
|
86
|
+
color: var(--boreal-stroke-warning);
|
|
87
|
+
}
|
|
88
|
+
.bds-banner--danger {
|
|
89
|
+
border-color: var(--boreal-stroke-danger-base);
|
|
90
|
+
background-color: var(--boreal-ui-danger-lighter);
|
|
91
|
+
}
|
|
92
|
+
.bds-banner--danger .bds-banner__vertical-line {
|
|
93
|
+
background-color: var(--boreal-stroke-danger-base);
|
|
94
|
+
}
|
|
95
|
+
.bds-banner--danger .bds-banner__status-icon {
|
|
96
|
+
color: var(--boreal-stroke-danger-base);
|
|
97
|
+
}
|
|
98
|
+
.bds-banner--closing {
|
|
99
|
+
opacity: 0;
|
|
100
|
+
height: 0;
|
|
101
|
+
}
|
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
import { Host, h } from "@stencil/core";
|
|
2
|
+
import { STATUS_VARIANT } from "../../../types/index";
|
|
3
|
+
import { inheritAriaAttributes } from "../../../utils/a11y/attributes";
|
|
4
|
+
import { getBaseAttributes } from "../../../utils/helpers/common/BaseAttributes";
|
|
5
|
+
/**
|
|
6
|
+
* Banner component used to display important messages with different status variants.
|
|
7
|
+
*
|
|
8
|
+
* @summary Displays a dismissible banner with an icon, title, body content, and optional actions.
|
|
9
|
+
*
|
|
10
|
+
* @slot title - Slot for the banner title text.
|
|
11
|
+
* @slot - Default slot for the main body content of the banner.
|
|
12
|
+
* @slot actions - Slot for action buttons or links displayed at the end of the banner.
|
|
13
|
+
*
|
|
14
|
+
* @attr {"info"|"success"|"warning"|"danger"} variant - Status variant of the banner, affects color and icon. Defaults to "info".
|
|
15
|
+
* @attr {boolean} enable-close - When true, renders a close button that triggers the close event.
|
|
16
|
+
* @attr {string} idComponent - Unique identifier for the banner element.
|
|
17
|
+
*
|
|
18
|
+
* @property {string} idComponent - Unique identifier for the banner element.
|
|
19
|
+
* @property {"info"|"success"|"warning"|"danger"} variant - Visual style variant: 'info', 'success', 'warning', or 'danger'. Defaults to "info".
|
|
20
|
+
* @property {boolean} enableClose - Shows a close button that allows users to dismiss the banner. Defaults to false.
|
|
21
|
+
*
|
|
22
|
+
* @fires close - Emitted when the banner is closed via the close button or `closeBanner` method.
|
|
23
|
+
*
|
|
24
|
+
* @method closeBanner - Programmatic method to close the banner and emit the `close` event.
|
|
25
|
+
*
|
|
26
|
+
*/
|
|
27
|
+
export class BdsBanner {
|
|
28
|
+
constructor() {
|
|
29
|
+
this.inheritedAttributes = {};
|
|
30
|
+
/**
|
|
31
|
+
* Internal state tracking the banner's closing animation.
|
|
32
|
+
*/
|
|
33
|
+
this.isClosing = false;
|
|
34
|
+
/**
|
|
35
|
+
* Controls the visibility of the banner. Set to false to hide the banner.
|
|
36
|
+
*/
|
|
37
|
+
this.isOpen = true;
|
|
38
|
+
/**
|
|
39
|
+
* Unique identifier for the banner element.
|
|
40
|
+
*/
|
|
41
|
+
this.idComponent = '';
|
|
42
|
+
/**
|
|
43
|
+
* Visual style variant: 'info', 'success', 'warning', or 'danger'.
|
|
44
|
+
* @default "info"
|
|
45
|
+
*/
|
|
46
|
+
this.variant = STATUS_VARIANT.INFO;
|
|
47
|
+
/**
|
|
48
|
+
* Shows a close button that allows users to dismiss the banner.
|
|
49
|
+
* @default false
|
|
50
|
+
*/
|
|
51
|
+
this.enableClose = false;
|
|
52
|
+
this.handleAnimationEnd = () => {
|
|
53
|
+
if (this.isClosing)
|
|
54
|
+
requestAnimationFrame(() => {
|
|
55
|
+
this.isClosing = false;
|
|
56
|
+
this.isOpen = false;
|
|
57
|
+
});
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
componentWillLoad() {
|
|
61
|
+
this.inheritedAttributes = {
|
|
62
|
+
...inheritAriaAttributes(this.el),
|
|
63
|
+
...getBaseAttributes(this),
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Programmatic method to close the banner and emit the `close` event
|
|
68
|
+
*/
|
|
69
|
+
async closeBanner() {
|
|
70
|
+
this.handleCloseBanner();
|
|
71
|
+
}
|
|
72
|
+
handleCloseBanner(e) {
|
|
73
|
+
if (e !== undefined)
|
|
74
|
+
e.preventDefault();
|
|
75
|
+
this.isClosing = true;
|
|
76
|
+
this.close.emit();
|
|
77
|
+
}
|
|
78
|
+
handleEscapeKeyClose(e) {
|
|
79
|
+
if (!this.enableClose)
|
|
80
|
+
return;
|
|
81
|
+
if (e.key === 'Escape')
|
|
82
|
+
this.handleCloseBanner();
|
|
83
|
+
}
|
|
84
|
+
getIconName() {
|
|
85
|
+
const iconMap = {
|
|
86
|
+
info: 'bds-icon-info-circle-fill',
|
|
87
|
+
success: 'bds-icon-check-circle-fill',
|
|
88
|
+
warning: 'bds-icon-info-major-triangle-up-fill',
|
|
89
|
+
danger: 'bds-icon-alert-circle-fill',
|
|
90
|
+
};
|
|
91
|
+
if (iconMap[this.variant] === undefined)
|
|
92
|
+
return iconMap['info'];
|
|
93
|
+
return iconMap[this.variant];
|
|
94
|
+
}
|
|
95
|
+
getAttributes() {
|
|
96
|
+
return {
|
|
97
|
+
...this.inheritedAttributes,
|
|
98
|
+
role: 'alert',
|
|
99
|
+
'aria-describedby': this.isOpen ? 'bds-banner__content' : null,
|
|
100
|
+
'aria-live': 'polite',
|
|
101
|
+
'aria-hidden': `${!this.isOpen}`,
|
|
102
|
+
tabIndex: this.isOpen ? 0 : -1,
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
getStyles() {
|
|
106
|
+
return {
|
|
107
|
+
'bds-banner': true,
|
|
108
|
+
[`bds-banner--${this.variant}`]: true,
|
|
109
|
+
'bds-banner--closing': this.isClosing,
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
renderCloseIcon() {
|
|
113
|
+
return (
|
|
114
|
+
// TODO how to pass this inner aria attr from outside?
|
|
115
|
+
h("button", { role: "close-button", class: "bds-banner__close-icon", "aria-label": "Alert close button", onClick: e => this.handleCloseBanner(e) }, h("em", { class: "bds-icon-close" })));
|
|
116
|
+
}
|
|
117
|
+
render() {
|
|
118
|
+
if (!this.isOpen)
|
|
119
|
+
return;
|
|
120
|
+
const closeIcon = this.renderCloseIcon();
|
|
121
|
+
const classes = this.getStyles();
|
|
122
|
+
const iconName = this.getIconName();
|
|
123
|
+
return (h(Host, { class: classes, ...this.getAttributes(), onTransitionEnd: this.handleAnimationEnd, onKeyDown: (e) => this.handleEscapeKeyClose(e) }, h("div", { class: "bds-banner__vertical-line" }), h("div", { class: "bds-banner__container" }, h("div", { class: "bds-banner__status-icon", role: "status", "aria-live": "polite", "aria-label": `status ${this.variant}` }, h("em", { "aria-hidden": "true", class: iconName })), h("div", { class: "bds-banner__content" }, h("div", { class: "bds-banner__title" }, h("slot", { name: "title" })), h("div", { class: "bds-banner__body" }, h("slot", null)), h("div", { class: "bds-banner__actions" }, h("slot", { name: "actions" }))), this.enableClose && closeIcon)));
|
|
124
|
+
}
|
|
125
|
+
static get is() { return "bds-banner"; }
|
|
126
|
+
static get originalStyleUrls() {
|
|
127
|
+
return {
|
|
128
|
+
"$": ["bds-banner.scss"]
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
static get styleUrls() {
|
|
132
|
+
return {
|
|
133
|
+
"$": ["bds-banner.css"]
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
static get properties() {
|
|
137
|
+
return {
|
|
138
|
+
"idComponent": {
|
|
139
|
+
"type": "string",
|
|
140
|
+
"mutable": false,
|
|
141
|
+
"complexType": {
|
|
142
|
+
"original": "string",
|
|
143
|
+
"resolved": "string",
|
|
144
|
+
"references": {}
|
|
145
|
+
},
|
|
146
|
+
"required": false,
|
|
147
|
+
"optional": false,
|
|
148
|
+
"docs": {
|
|
149
|
+
"tags": [],
|
|
150
|
+
"text": "Unique identifier for the banner element."
|
|
151
|
+
},
|
|
152
|
+
"getter": false,
|
|
153
|
+
"setter": false,
|
|
154
|
+
"reflect": false,
|
|
155
|
+
"attribute": "id-component",
|
|
156
|
+
"defaultValue": "''"
|
|
157
|
+
},
|
|
158
|
+
"variant": {
|
|
159
|
+
"type": "string",
|
|
160
|
+
"mutable": false,
|
|
161
|
+
"complexType": {
|
|
162
|
+
"original": "IBanner['variant']",
|
|
163
|
+
"resolved": "\"danger\" | \"info\" | \"success\" | \"warning\"",
|
|
164
|
+
"references": {
|
|
165
|
+
"IBanner": {
|
|
166
|
+
"location": "import",
|
|
167
|
+
"path": "./types/IBanner",
|
|
168
|
+
"id": "src/components/feedback/bds-banner/types/IBanner.ts::IBanner",
|
|
169
|
+
"referenceLocation": "IBanner"
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
"required": false,
|
|
174
|
+
"optional": false,
|
|
175
|
+
"docs": {
|
|
176
|
+
"tags": [{
|
|
177
|
+
"name": "default",
|
|
178
|
+
"text": "\"info\""
|
|
179
|
+
}],
|
|
180
|
+
"text": "Visual style variant: 'info', 'success', 'warning', or 'danger'."
|
|
181
|
+
},
|
|
182
|
+
"getter": false,
|
|
183
|
+
"setter": false,
|
|
184
|
+
"reflect": false,
|
|
185
|
+
"attribute": "variant",
|
|
186
|
+
"defaultValue": "STATUS_VARIANT.INFO"
|
|
187
|
+
},
|
|
188
|
+
"enableClose": {
|
|
189
|
+
"type": "boolean",
|
|
190
|
+
"mutable": false,
|
|
191
|
+
"complexType": {
|
|
192
|
+
"original": "IBanner['enableClose']",
|
|
193
|
+
"resolved": "boolean",
|
|
194
|
+
"references": {
|
|
195
|
+
"IBanner": {
|
|
196
|
+
"location": "import",
|
|
197
|
+
"path": "./types/IBanner",
|
|
198
|
+
"id": "src/components/feedback/bds-banner/types/IBanner.ts::IBanner",
|
|
199
|
+
"referenceLocation": "IBanner"
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
},
|
|
203
|
+
"required": false,
|
|
204
|
+
"optional": false,
|
|
205
|
+
"docs": {
|
|
206
|
+
"tags": [{
|
|
207
|
+
"name": "default",
|
|
208
|
+
"text": "false"
|
|
209
|
+
}],
|
|
210
|
+
"text": "Shows a close button that allows users to dismiss the banner."
|
|
211
|
+
},
|
|
212
|
+
"getter": false,
|
|
213
|
+
"setter": false,
|
|
214
|
+
"reflect": false,
|
|
215
|
+
"attribute": "enable-close",
|
|
216
|
+
"defaultValue": "false"
|
|
217
|
+
}
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
static get states() {
|
|
221
|
+
return {
|
|
222
|
+
"isClosing": {},
|
|
223
|
+
"isOpen": {}
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
static get events() {
|
|
227
|
+
return [{
|
|
228
|
+
"method": "close",
|
|
229
|
+
"name": "close",
|
|
230
|
+
"bubbles": true,
|
|
231
|
+
"cancelable": true,
|
|
232
|
+
"composed": true,
|
|
233
|
+
"docs": {
|
|
234
|
+
"tags": [],
|
|
235
|
+
"text": "Emitted when the banner is closed via the close button or handleClose method."
|
|
236
|
+
},
|
|
237
|
+
"complexType": {
|
|
238
|
+
"original": "void",
|
|
239
|
+
"resolved": "void",
|
|
240
|
+
"references": {}
|
|
241
|
+
}
|
|
242
|
+
}];
|
|
243
|
+
}
|
|
244
|
+
static get methods() {
|
|
245
|
+
return {
|
|
246
|
+
"closeBanner": {
|
|
247
|
+
"complexType": {
|
|
248
|
+
"signature": "() => Promise<void>",
|
|
249
|
+
"parameters": [],
|
|
250
|
+
"references": {
|
|
251
|
+
"Promise": {
|
|
252
|
+
"location": "global",
|
|
253
|
+
"id": "global::Promise"
|
|
254
|
+
}
|
|
255
|
+
},
|
|
256
|
+
"return": "Promise<void>"
|
|
257
|
+
},
|
|
258
|
+
"docs": {
|
|
259
|
+
"text": "Programmatic method to close the banner and emit the `close` event",
|
|
260
|
+
"tags": []
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
static get elementRef() { return "el"; }
|
|
266
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { h } from "@stencil/core";
|
|
2
|
+
export class MyComponent {
|
|
3
|
+
constructor() {
|
|
4
|
+
/**
|
|
5
|
+
* The first name
|
|
6
|
+
*/
|
|
7
|
+
this.first = '';
|
|
8
|
+
/**
|
|
9
|
+
* The middle name
|
|
10
|
+
*/
|
|
11
|
+
this.middle = '';
|
|
12
|
+
/**
|
|
13
|
+
* The last name
|
|
14
|
+
*/
|
|
15
|
+
this.last = '';
|
|
16
|
+
}
|
|
17
|
+
render() {
|
|
18
|
+
return h("div", { key: '2f3775c7b3d8475826a01101110bd2876a57f2cb' }, " Hello, World! I'm Stencil 'Don't call me a framework' JS");
|
|
19
|
+
}
|
|
20
|
+
static get is() { return "my-component"; }
|
|
21
|
+
static get originalStyleUrls() {
|
|
22
|
+
return {
|
|
23
|
+
"$": ["my-component.css"]
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
static get styleUrls() {
|
|
27
|
+
return {
|
|
28
|
+
"$": ["my-component.css"]
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
static get properties() {
|
|
32
|
+
return {
|
|
33
|
+
"first": {
|
|
34
|
+
"type": "string",
|
|
35
|
+
"mutable": false,
|
|
36
|
+
"complexType": {
|
|
37
|
+
"original": "string",
|
|
38
|
+
"resolved": "string",
|
|
39
|
+
"references": {}
|
|
40
|
+
},
|
|
41
|
+
"required": false,
|
|
42
|
+
"optional": false,
|
|
43
|
+
"docs": {
|
|
44
|
+
"tags": [],
|
|
45
|
+
"text": "The first name"
|
|
46
|
+
},
|
|
47
|
+
"getter": false,
|
|
48
|
+
"setter": false,
|
|
49
|
+
"reflect": false,
|
|
50
|
+
"attribute": "first",
|
|
51
|
+
"defaultValue": "''"
|
|
52
|
+
},
|
|
53
|
+
"middle": {
|
|
54
|
+
"type": "string",
|
|
55
|
+
"mutable": false,
|
|
56
|
+
"complexType": {
|
|
57
|
+
"original": "string",
|
|
58
|
+
"resolved": "string",
|
|
59
|
+
"references": {}
|
|
60
|
+
},
|
|
61
|
+
"required": false,
|
|
62
|
+
"optional": false,
|
|
63
|
+
"docs": {
|
|
64
|
+
"tags": [],
|
|
65
|
+
"text": "The middle name"
|
|
66
|
+
},
|
|
67
|
+
"getter": false,
|
|
68
|
+
"setter": false,
|
|
69
|
+
"reflect": false,
|
|
70
|
+
"attribute": "middle",
|
|
71
|
+
"defaultValue": "''"
|
|
72
|
+
},
|
|
73
|
+
"last": {
|
|
74
|
+
"type": "string",
|
|
75
|
+
"mutable": false,
|
|
76
|
+
"complexType": {
|
|
77
|
+
"original": "string",
|
|
78
|
+
"resolved": "string",
|
|
79
|
+
"references": {}
|
|
80
|
+
},
|
|
81
|
+
"required": false,
|
|
82
|
+
"optional": false,
|
|
83
|
+
"docs": {
|
|
84
|
+
"tags": [],
|
|
85
|
+
"text": "The last name"
|
|
86
|
+
},
|
|
87
|
+
"getter": false,
|
|
88
|
+
"setter": false,
|
|
89
|
+
"reflect": false,
|
|
90
|
+
"attribute": "last",
|
|
91
|
+
"defaultValue": "''"
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
}
|