@db-ux/wc-core-components 4.2.0 → 4.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/dist/cjs/db-accordion-item.cjs.entry.js +1 -1
- package/dist/cjs/db-accordion.cjs.entry.js +1 -1
- package/dist/cjs/db-badge.cjs.entry.js +1 -1
- package/dist/cjs/db-brand.cjs.entry.js +1 -1
- package/dist/cjs/db-button.cjs.entry.js +1 -1
- package/dist/cjs/db-card.cjs.entry.js +1 -1
- package/dist/cjs/db-checkbox.cjs.entry.js +1 -1
- package/dist/cjs/db-custom-select-dropdown_5.cjs.entry.js +1 -1
- package/dist/cjs/db-custom-select-form-field.cjs.entry.js +1 -1
- package/dist/cjs/db-custom-select.cjs.entry.js +1 -1
- package/dist/cjs/db-divider.cjs.entry.js +1 -1
- package/dist/cjs/db-drawer.cjs.entry.js +1 -1
- package/dist/cjs/db-header.cjs.entry.js +1 -1
- package/dist/cjs/db-icon.cjs.entry.js +1 -1
- package/dist/cjs/db-infotext.cjs.entry.js +1 -1
- package/dist/cjs/db-link.cjs.entry.js +1 -1
- package/dist/cjs/db-navigation-item.cjs.entry.js +1 -1
- package/dist/cjs/db-navigation.cjs.entry.js +1 -1
- package/dist/cjs/db-notification.cjs.entry.js +1 -1
- package/dist/cjs/db-page.cjs.entry.js +1 -1
- package/dist/cjs/db-popover.cjs.entry.js +1 -1
- package/dist/cjs/db-radio.cjs.entry.js +1 -1
- package/dist/cjs/db-section.cjs.entry.js +1 -1
- package/dist/cjs/db-select.cjs.entry.js +1 -1
- package/dist/cjs/db-stack.cjs.entry.js +1 -1
- package/dist/cjs/db-switch.cjs.entry.js +14 -3
- package/dist/cjs/db-switch.entry.cjs.js.map +1 -1
- package/dist/cjs/db-tab-item.db-tab-list.db-tab-panel.entry.cjs.js.map +1 -1
- package/dist/cjs/db-tab-item_3.cjs.entry.js +31 -11
- package/dist/cjs/db-tabs.cjs.entry.js +3 -3
- package/dist/cjs/db-tabs.entry.cjs.js.map +1 -1
- package/dist/cjs/db-textarea.cjs.entry.js +1 -1
- package/dist/cjs/db-tooltip.cjs.entry.js +1 -1
- package/dist/cjs/db-ux.cjs.js +3 -3
- package/dist/cjs/db-ux.cjs.js.map +1 -1
- package/dist/cjs/{index-C6rF_KRf.js → index-Db5RdCbB.js} +39 -4
- package/dist/cjs/index-Db5RdCbB.js.map +1 -0
- package/dist/cjs/index.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/collection/collection-manifest.json +1 -1
- package/dist/collection/components/switch/model.js.map +1 -1
- package/dist/collection/components/switch/switch.js +38 -27
- package/dist/collection/components/switch/switch.js.map +1 -1
- package/dist/collection/components/tab-item/model.js.map +1 -1
- package/dist/collection/components/tab-item/tab-item.js +35 -11
- package/dist/collection/components/tab-item/tab-item.js.map +1 -1
- package/dist/collection/components/tabs/tabs.js +2 -2
- package/dist/collection/components/tabs/tabs.js.map +1 -1
- package/dist/custom-elements.json +77 -40
- package/dist/db-ux/db-switch.entry.esm.js.map +1 -1
- package/dist/db-ux/db-tab-item.db-tab-list.db-tab-panel.entry.esm.js.map +1 -1
- package/dist/db-ux/db-tabs.entry.esm.js.map +1 -1
- package/dist/db-ux/db-ux.esm.js +1 -1
- package/dist/db-ux/db-ux.esm.js.map +1 -1
- package/dist/db-ux/index.esm.js +1 -1
- package/dist/db-ux/p-129cbaa9.entry.js +2 -0
- package/dist/db-ux/{p-5cbbd49b.entry.js → p-162c989a.entry.js} +2 -2
- package/dist/db-ux/p-18f10b76.entry.js +2 -0
- package/dist/db-ux/p-18f10b76.entry.js.map +1 -0
- package/dist/db-ux/{p-16057f32.entry.js → p-1dcb2a08.entry.js} +2 -2
- package/dist/db-ux/p-2addb72d.entry.js +2 -0
- package/dist/db-ux/p-2addb72d.entry.js.map +1 -0
- package/dist/db-ux/{p-f99290da.entry.js → p-2f6afcbc.entry.js} +2 -2
- package/dist/db-ux/{p-249e06ff.entry.js → p-35bb2b0a.entry.js} +2 -2
- package/dist/db-ux/p-4318a6c7.entry.js +2 -0
- package/dist/db-ux/{p-f2265ef1.entry.js → p-45562afc.entry.js} +2 -2
- package/dist/db-ux/{p-7f3a0030.entry.js → p-49b9ab25.entry.js} +2 -2
- package/dist/db-ux/{p-4c2e8450.entry.js → p-4c944f45.entry.js} +2 -2
- package/dist/db-ux/{p-534cd3be.entry.js → p-4ff5ddf2.entry.js} +2 -2
- package/dist/db-ux/{p-ee527103.entry.js → p-5b15eef1.entry.js} +2 -2
- package/dist/db-ux/{p-b412ed52.entry.js → p-68c1dd8d.entry.js} +2 -2
- package/dist/db-ux/{p-256396bf.entry.js → p-78f062f6.entry.js} +2 -2
- package/dist/db-ux/{p-a6ac65be.entry.js → p-7c0eefb1.entry.js} +2 -2
- package/dist/db-ux/{p-68b70ec5.entry.js → p-7c46fd6c.entry.js} +2 -2
- package/dist/db-ux/p-7f894c65.entry.js +2 -0
- package/dist/db-ux/{p-59f30e71.entry.js → p-84ab3984.entry.js} +2 -2
- package/dist/db-ux/{p-1500dad2.entry.js → p-89e04100.entry.js} +2 -2
- package/dist/db-ux/p-BMAwJo5Z.js +3 -0
- package/dist/db-ux/p-BMAwJo5Z.js.map +1 -0
- package/dist/db-ux/{p-23d72611.entry.js → p-a34bf30b.entry.js} +2 -2
- package/dist/db-ux/{p-751434fa.entry.js → p-baeda9f2.entry.js} +2 -2
- package/dist/db-ux/{p-693724ef.entry.js → p-bc6b636e.entry.js} +2 -2
- package/dist/db-ux/p-c7bb7bea.entry.js +2 -0
- package/dist/db-ux/p-c7bb7bea.entry.js.map +1 -0
- package/dist/db-ux/{p-d59087c4.entry.js → p-d1b7a69c.entry.js} +2 -2
- package/dist/db-ux/{p-79b990e4.entry.js → p-d2e189a4.entry.js} +2 -2
- package/dist/db-ux/{p-39e09377.entry.js → p-e46f112c.entry.js} +2 -2
- package/dist/db-ux/p-e470d0a2.entry.js +2 -0
- package/dist/db-ux/{p-952cd568.entry.js.map → p-e470d0a2.entry.js.map} +1 -1
- package/dist/db-ux/{p-8f698fc9.entry.js → p-f7c1e940.entry.js} +2 -2
- package/dist/db-ux/{p-12070f78.entry.js → p-fedb9696.entry.js} +2 -2
- package/dist/esm/db-accordion-item.entry.js +1 -1
- package/dist/esm/db-accordion.entry.js +1 -1
- package/dist/esm/db-badge.entry.js +1 -1
- package/dist/esm/db-brand.entry.js +1 -1
- package/dist/esm/db-button.entry.js +1 -1
- package/dist/esm/db-card.entry.js +1 -1
- package/dist/esm/db-checkbox.entry.js +1 -1
- package/dist/esm/db-custom-select-dropdown_5.entry.js +1 -1
- package/dist/esm/db-custom-select-form-field.entry.js +1 -1
- package/dist/esm/db-custom-select.entry.js +1 -1
- package/dist/esm/db-divider.entry.js +1 -1
- package/dist/esm/db-drawer.entry.js +1 -1
- package/dist/esm/db-header.entry.js +1 -1
- package/dist/esm/db-icon.entry.js +1 -1
- package/dist/esm/db-infotext.entry.js +1 -1
- package/dist/esm/db-link.entry.js +1 -1
- package/dist/esm/db-navigation-item.entry.js +1 -1
- package/dist/esm/db-navigation.entry.js +1 -1
- package/dist/esm/db-notification.entry.js +1 -1
- package/dist/esm/db-page.entry.js +1 -1
- package/dist/esm/db-popover.entry.js +1 -1
- package/dist/esm/db-radio.entry.js +1 -1
- package/dist/esm/db-section.entry.js +1 -1
- package/dist/esm/db-select.entry.js +1 -1
- package/dist/esm/db-stack.entry.js +1 -1
- package/dist/esm/db-switch.entry.js +14 -3
- package/dist/esm/db-switch.entry.js.map +1 -1
- package/dist/esm/db-tab-item.db-tab-list.db-tab-panel.entry.js.map +1 -1
- package/dist/esm/db-tab-item_3.entry.js +31 -11
- package/dist/esm/db-tabs.entry.js +3 -3
- package/dist/esm/db-tabs.entry.js.map +1 -1
- package/dist/esm/db-textarea.entry.js +1 -1
- package/dist/esm/db-tooltip.entry.js +1 -1
- package/dist/esm/db-ux.js +4 -4
- package/dist/esm/db-ux.js.map +1 -1
- package/dist/esm/{index-C6WmMqtR.js → index-BMAwJo5Z.js} +39 -4
- package/dist/esm/index-BMAwJo5Z.js.map +1 -0
- package/dist/esm/index.js +1 -1
- package/dist/esm/loader.js +3 -3
- package/dist/types/components/switch/model.d.ts +4 -2
- package/dist/types/components/switch/switch.d.ts +3 -2
- package/dist/types/components/tab-item/model.d.ts +3 -0
- package/dist/types/components/tab-item/tab-item.d.ts +4 -0
- package/dist/types/stencil-public-runtime.d.ts +1 -1
- package/dist/vscode.html-custom-data.json +5 -5
- package/dist/web-types.json +14 -12
- package/package.json +5 -5
- package/dist/cjs/index-C6rF_KRf.js.map +0 -1
- package/dist/db-ux/p-01a606b9.entry.js +0 -2
- package/dist/db-ux/p-51d6c8b2.entry.js +0 -2
- package/dist/db-ux/p-51d6c8b2.entry.js.map +0 -1
- package/dist/db-ux/p-952cd568.entry.js +0 -2
- package/dist/db-ux/p-C6WmMqtR.js +0 -3
- package/dist/db-ux/p-C6WmMqtR.js.map +0 -1
- package/dist/db-ux/p-b1edf43c.entry.js +0 -2
- package/dist/db-ux/p-b70342cb.entry.js +0 -2
- package/dist/db-ux/p-b70342cb.entry.js.map +0 -1
- package/dist/db-ux/p-bc2e8a30.entry.js +0 -2
- package/dist/db-ux/p-bc2e8a30.entry.js.map +0 -1
- package/dist/db-ux/p-f2ab4d34.entry.js +0 -2
- package/dist/esm/index-C6WmMqtR.js.map +0 -1
- /package/dist/db-ux/{p-f2ab4d34.entry.js.map → p-129cbaa9.entry.js.map} +0 -0
- /package/dist/db-ux/{p-5cbbd49b.entry.js.map → p-162c989a.entry.js.map} +0 -0
- /package/dist/db-ux/{p-16057f32.entry.js.map → p-1dcb2a08.entry.js.map} +0 -0
- /package/dist/db-ux/{p-f99290da.entry.js.map → p-2f6afcbc.entry.js.map} +0 -0
- /package/dist/db-ux/{p-249e06ff.entry.js.map → p-35bb2b0a.entry.js.map} +0 -0
- /package/dist/db-ux/{p-01a606b9.entry.js.map → p-4318a6c7.entry.js.map} +0 -0
- /package/dist/db-ux/{p-f2265ef1.entry.js.map → p-45562afc.entry.js.map} +0 -0
- /package/dist/db-ux/{p-7f3a0030.entry.js.map → p-49b9ab25.entry.js.map} +0 -0
- /package/dist/db-ux/{p-4c2e8450.entry.js.map → p-4c944f45.entry.js.map} +0 -0
- /package/dist/db-ux/{p-534cd3be.entry.js.map → p-4ff5ddf2.entry.js.map} +0 -0
- /package/dist/db-ux/{p-ee527103.entry.js.map → p-5b15eef1.entry.js.map} +0 -0
- /package/dist/db-ux/{p-b412ed52.entry.js.map → p-68c1dd8d.entry.js.map} +0 -0
- /package/dist/db-ux/{p-256396bf.entry.js.map → p-78f062f6.entry.js.map} +0 -0
- /package/dist/db-ux/{p-a6ac65be.entry.js.map → p-7c0eefb1.entry.js.map} +0 -0
- /package/dist/db-ux/{p-68b70ec5.entry.js.map → p-7c46fd6c.entry.js.map} +0 -0
- /package/dist/db-ux/{p-b1edf43c.entry.js.map → p-7f894c65.entry.js.map} +0 -0
- /package/dist/db-ux/{p-59f30e71.entry.js.map → p-84ab3984.entry.js.map} +0 -0
- /package/dist/db-ux/{p-1500dad2.entry.js.map → p-89e04100.entry.js.map} +0 -0
- /package/dist/db-ux/{p-23d72611.entry.js.map → p-a34bf30b.entry.js.map} +0 -0
- /package/dist/db-ux/{p-751434fa.entry.js.map → p-baeda9f2.entry.js.map} +0 -0
- /package/dist/db-ux/{p-693724ef.entry.js.map → p-bc6b636e.entry.js.map} +0 -0
- /package/dist/db-ux/{p-d59087c4.entry.js.map → p-d1b7a69c.entry.js.map} +0 -0
- /package/dist/db-ux/{p-79b990e4.entry.js.map → p-d2e189a4.entry.js.map} +0 -0
- /package/dist/db-ux/{p-39e09377.entry.js.map → p-e46f112c.entry.js.map} +0 -0
- /package/dist/db-ux/{p-8f698fc9.entry.js.map → p-f7c1e940.entry.js.map} +0 -0
- /package/dist/db-ux/{p-12070f78.entry.js.map → p-fedb9696.entry.js.map} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @db-ux/wc-core-components
|
|
2
2
|
|
|
3
|
+
## 4.2.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- fix(form elements): `valid` background- and border-colors - [see commit 8f07e55](https://github.com/db-ux-design-system/core-web/commit/8f07e55f2155fcb619198857397ce354f90c4803)
|
|
8
|
+
|
|
9
|
+
- fix: set DBTabItem internal state `_selected` correctly - [see commit f7625cb](https://github.com/db-ux-design-system/core-web/commit/f7625cbd9d64513527e826c9d2c1ef42b2734a4b):
|
|
10
|
+
|
|
11
|
+
- Now also sets aria-selected=true|false correctly which improves screen reader behaviour
|
|
12
|
+
|
|
13
|
+
## 4.2.1
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- refactor(DBSwitch): Also toggle on pressing Enter key, not just Space - [see commit 95a7569](https://github.com/db-ux-design-system/core-web/commit/95a7569121ccf0fef318df4f23941c3f48a4a074)
|
|
18
|
+
|
|
3
19
|
## 4.2.0
|
|
4
20
|
|
|
5
21
|
### Minor Changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
3
|
+
var index = require('./index-Db5RdCbB.js');
|
|
4
4
|
var constants = require('./constants-CTtyzyuo.js');
|
|
5
5
|
var index$1 = require('./index-Bm2Cw2rz.js');
|
|
6
6
|
var formComponents = require('./form-components-CPqbzZwG.js');
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
3
|
+
var index = require('./index-Db5RdCbB.js');
|
|
4
4
|
var index$1 = require('./index-Bm2Cw2rz.js');
|
|
5
5
|
var constants = require('./constants-CTtyzyuo.js');
|
|
6
6
|
var formComponents = require('./form-components-CPqbzZwG.js');
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
3
|
+
var index = require('./index-Db5RdCbB.js');
|
|
4
4
|
var constants = require('./constants-CTtyzyuo.js');
|
|
5
5
|
var index$1 = require('./index-Bm2Cw2rz.js');
|
|
6
6
|
var documentClickListener = require('./document-click-listener-DGna8oDJ.js');
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
3
|
+
var index = require('./index-Db5RdCbB.js');
|
|
4
4
|
var index$1 = require('./index-Bm2Cw2rz.js');
|
|
5
5
|
var documentScrollListener = require('./document-scroll-listener-BBXRu9dN.js');
|
|
6
6
|
var floatingComponents = require('./floating-components-ogUqz72V.js');
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
3
|
+
var index = require('./index-Db5RdCbB.js');
|
|
4
4
|
var constants = require('./constants-CTtyzyuo.js');
|
|
5
5
|
var index$1 = require('./index-Bm2Cw2rz.js');
|
|
6
6
|
var formComponents = require('./form-components-CPqbzZwG.js');
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
3
|
+
var index = require('./index-Db5RdCbB.js');
|
|
4
4
|
var constants = require('./constants-CTtyzyuo.js');
|
|
5
5
|
var index$1 = require('./index-Bm2Cw2rz.js');
|
|
6
6
|
var formComponents = require('./form-components-CPqbzZwG.js');
|
|
@@ -73,6 +73,17 @@ const DBSwitch = class {
|
|
|
73
73
|
this.focus.emit(event);
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
|
+
handleKeyDown(event) {
|
|
77
|
+
var _a;
|
|
78
|
+
// Support ENTER key for toggling the switch (a11y requirement)
|
|
79
|
+
if (event.key === "Enter") {
|
|
80
|
+
event.preventDefault();
|
|
81
|
+
// Toggle the switch by clicking it programmatically
|
|
82
|
+
if (!this.disabled) {
|
|
83
|
+
(_a = this._ref) === null || _a === void 0 ? void 0 : _a.click();
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
76
87
|
/**
|
|
77
88
|
* Passes `aria-*`, `data-*` & `class` attributes to correct child. Used in angular and stencil.
|
|
78
89
|
* @param element the ref for the component
|
|
@@ -147,9 +158,9 @@ const DBSwitch = class {
|
|
|
147
158
|
}
|
|
148
159
|
render() {
|
|
149
160
|
var _a, _b, _c, _d;
|
|
150
|
-
return (index.h("div", { key: '
|
|
161
|
+
return (index.h("div", { key: 'f2dab897c89fa8aadd97abe59e81b4d7ef4561c5', class: index$1.cls("db-switch", this.className), "data-visual-aid": index$1.getBooleanAsString(this.visualAid), "data-size": this.size, "data-hide-label": index$1.getHideProp(this.showLabel), "data-variant": this.variant, "data-hide-asterisk": index$1.getHideProp(this.showRequiredAsterisk), "data-custom-validity": this.validation }, index.h("label", { key: '8d7c3e44a9f7c565224124d499abe6c3b96582f6', htmlFor: this._id }, index.h("input", { key: '1cba4d3dbe46c97cd9039442e61eb0d9baab0587', type: "checkbox", role: "switch", id: this._id, ref: (el) => {
|
|
151
162
|
this._ref = el;
|
|
152
|
-
}, checked: index$1.getBoolean(this.checked, "checked"), value: this.value, disabled: index$1.getBoolean(this.disabled, "disabled"), "aria-invalid": this.validation === "invalid" ? "true" : undefined, "aria-describedby": this._descByIds, name: this.name, required: index$1.getBoolean(this.required, "required"), "data-aid-icon": (_a = this.iconLeading) !== null && _a !== void 0 ? _a : this.icon, "data-aid-icon-trailing": this.iconTrailing, onChange: (event) => this.handleChange(event), onBlur: (event) => this.handleBlur(event), onFocus: (event) => this.handleFocus(event) }), this.label ? this.label : index.h("slot", null)), index$1.stringPropVisible(this.message, this.showMessage) ? (index.h("db-infotext", { size: "small", semantic: "adaptive", id: this._messageId, icon: this.messageIcon }, this.message)) : null, this.hasValidState() ? (index.h("db-infotext", { size: "small", semantic: "successful", id: this._validMessageId }, (_b = this.validMessage) !== null && _b !== void 0 ? _b : constants.DEFAULT_VALID_MESSAGE)) : null, index.h("db-infotext", { key: '
|
|
163
|
+
}, checked: index$1.getBoolean(this.checked, "checked"), value: this.value, disabled: index$1.getBoolean(this.disabled, "disabled"), "aria-invalid": this.validation === "invalid" ? "true" : undefined, "aria-describedby": this._descByIds, name: this.name, required: index$1.getBoolean(this.required, "required"), "data-aid-icon": (_a = this.iconLeading) !== null && _a !== void 0 ? _a : this.icon, "data-aid-icon-trailing": this.iconTrailing, onChange: (event) => this.handleChange(event), onBlur: (event) => this.handleBlur(event), onFocus: (event) => this.handleFocus(event), onKeyDown: (event) => this.handleKeyDown(event) }), this.label ? this.label : index.h("slot", null)), index$1.stringPropVisible(this.message, this.showMessage) ? (index.h("db-infotext", { size: "small", semantic: "adaptive", id: this._messageId, icon: this.messageIcon }, this.message)) : null, this.hasValidState() ? (index.h("db-infotext", { size: "small", semantic: "successful", id: this._validMessageId }, (_b = this.validMessage) !== null && _b !== void 0 ? _b : constants.DEFAULT_VALID_MESSAGE)) : null, index.h("db-infotext", { key: '9495dfc7fb2e3947f21b834792c4caeab411bbd0', size: "small", semantic: "critical", id: this._invalidMessageId }, (_d = (_c = this._invalidMessage) !== null && _c !== void 0 ? _c : this.invalidMessage) !== null && _d !== void 0 ? _d : constants.DEFAULT_INVALID_MESSAGE), index.h("span", { key: '6e6b325689130fc5cdeef86d3a4f59299b5f8450', "data-visually-hidden": "true", role: "status" }, this._voiceOverFallback)));
|
|
153
164
|
}
|
|
154
165
|
static get watchers() { return {
|
|
155
166
|
"validation": ["watch0"],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"db-switch.entry.cjs.js","sources":["src/components/switch/switch.tsx"],"sourcesContent":["import {\n DEFAULT_INVALID_MESSAGE,\n DEFAULT_INVALID_MESSAGE_ID_SUFFIX,\n DEFAULT_MESSAGE_ID_SUFFIX,\n DEFAULT_VALID_MESSAGE,\n DEFAULT_VALID_MESSAGE_ID_SUFFIX,\n} from \"../../shared/constants\";\nimport { ChangeEvent, InteractionEvent } from \"../../shared/model\";\nimport {\n cls,\n delay,\n getBoolean,\n getBooleanAsString,\n getHideProp,\n hasVoiceOver,\n stringPropVisible,\n uuid,\n} from \"../../utils\";\nimport {\n addCheckedResetEventListener,\n handleFrameworkEventAngular,\n handleFrameworkEventVue,\n} from \"../../utils/form-components\";\nimport { DBInfotext } from \"../infotext/infotext\";\nimport { DBSwitchProps, DBSwitchState } from \"./model\";\n\nimport {\n Component,\n h,\n Fragment,\n Watch,\n Event,\n EventEmitter,\n Prop,\n State,\n} from \"@stencil/core\";\n\n\n/**\n * @slot children - This is a default/unnamed slot\n\n */\n @Component({\n tag: \"db-switch\",\n})\nexport class DBSwitch {\n private _ref!: HTMLInputElement | any;\n @Prop() id: DBSwitchProps[\"id\"];\n @Prop() validation: DBSwitchProps[\"validation\"];\n @Prop() required: DBSwitchProps[\"required\"];\n @Prop() message: DBSwitchProps[\"message\"];\n @Prop() showMessage: DBSwitchProps[\"showMessage\"];\n @Prop() validMessage: DBSwitchProps[\"validMessage\"];\n @Prop() invalidMessage: DBSwitchProps[\"invalidMessage\"];\n @Prop() checked: DBSwitchProps[\"checked\"];\n @Event() change: EventEmitter<\n Parameters<Required<DBSwitchProps>[\"onChange\"]>[number]\n > | void;\n @Event() blur: EventEmitter<\n Parameters<Required<DBSwitchProps>[\"onBlur\"]>[number]\n > | void;\n @Event() focus: EventEmitter<\n Parameters<Required<DBSwitchProps>[\"onFocus\"]>[number]\n > | void;\n @Prop() visualAid: DBSwitchProps[\"visualAid\"];\n @Prop() size: DBSwitchProps[\"size\"];\n @Prop() showLabel: DBSwitchProps[\"showLabel\"];\n @Prop() variant: DBSwitchProps[\"variant\"];\n @Prop() showRequiredAsterisk: DBSwitchProps[\"showRequiredAsterisk\"];\n @Prop({attribute: \"classname\"}) className: DBSwitchProps[\"className\"];\n @Prop() value: DBSwitchProps[\"value\"];\n @Prop() disabled: DBSwitchProps[\"disabled\"];\n @Prop() name: DBSwitchProps[\"name\"];\n @Prop() iconLeading: DBSwitchProps[\"iconLeading\"];\n @Prop() icon: DBSwitchProps[\"icon\"];\n @Prop() iconTrailing: DBSwitchProps[\"iconTrailing\"];\n @Prop() label: DBSwitchProps[\"label\"];\n @Prop() messageIcon: DBSwitchProps[\"messageIcon\"];\n @State() _id = undefined;\n @State() _messageId = undefined;\n @State() _validMessageId = undefined;\n @State() _invalidMessageId = undefined;\n @State() _invalidMessage = undefined;\n @State() _descByIds = undefined;\n @State() _voiceOverFallback = \"\";\n @State() abortController = undefined;\n\n hasValidState() {\n return !!(this.validMessage ?? this.validation === \"valid\");\n }\n handleValidation() {\n if (!this._ref?.validity?.valid || this.validation === \"invalid\") {\n this._descByIds = this._invalidMessageId!;\n this._invalidMessage =\n this.invalidMessage ||\n this._ref?.validationMessage ||\n DEFAULT_INVALID_MESSAGE;\n if (hasVoiceOver()) {\n this._voiceOverFallback =\n this._invalidMessage || DEFAULT_INVALID_MESSAGE;\n delay(() => {\n this._voiceOverFallback = \"\";\n }, 1000);\n }\n return;\n }\n if (this.hasValidState() && this._ref?.validity?.valid && this.required) {\n this._descByIds = this._validMessageId!;\n if (hasVoiceOver()) {\n this._voiceOverFallback = this.validMessage ?? DEFAULT_VALID_MESSAGE;\n delay(() => {\n this._voiceOverFallback = \"\";\n }, 1000);\n }\n return;\n }\n if (stringPropVisible(this.message, this.showMessage)) {\n this._descByIds = this._messageId!;\n return;\n }\n this._descByIds = undefined;\n }\n handleChange(event: ChangeEvent<HTMLInputElement>, reset?: boolean) {\n if (this.change) {\n this.change.emit(event);\n }\n this.handleValidation();\n }\n handleBlur(event: InteractionEvent<HTMLInputElement>) {\n if (this.blur) {\n this.blur.emit(event);\n }\n }\n handleFocus(event: InteractionEvent<HTMLInputElement>) {\n if (this.focus) {\n this.focus.emit(event);\n }\n }\n\n /**\n * Passes `aria-*`, `data-*` & `class` attributes to correct child. Used in angular and stencil.\n * @param element the ref for the component\n * @param customElementSelector the custom element like `my-component`\n */\n private enableAttributePassing(\n element: HTMLInputElement | null,\n customElementSelector: string\n ) {\n const parent = element?.closest(customElementSelector);\n if (element && parent) {\n const attributes = parent.attributes;\n for (let i = 0; i < attributes.length; i++) {\n const attr = attributes.item(i);\n if (\n attr &&\n (attr.name.startsWith(\"data-\") || attr.name.startsWith(\"aria-\"))\n ) {\n element.setAttribute(attr.name, attr.value);\n parent.removeAttribute(attr.name);\n }\n if (attr && attr.name === \"class\") {\n const isWebComponent = attr.value.includes(\"hydrated\");\n const value = attr.value.replace(\"hydrated\", \"\").trim();\n const currentClass = element.getAttribute(\"class\");\n element.setAttribute(\n attr.name,\n `${currentClass ? `${currentClass} ` : \"\"}${value}`\n );\n if (isWebComponent) {\n // Stencil is using this class for lazy loading component\n parent.setAttribute(\"class\", \"hydrated\");\n } else {\n parent.removeAttribute(attr.name);\n }\n }\n }\n }\n }\n\n watch0Fn() {\n this.handleValidation();\n }\n\n @Watch(\"validation\")\n @Watch(\"required\")\n @Watch(\"message\")\n @Watch(\"showMessage\")\n @Watch(\"validMessage\")\n @Watch(\"invalidMessage\")\n @Watch(\"checked\")\n watch0() {\n this.watch0Fn();\n }\n\n watch1Fn() {\n if (this._ref) {\n const defaultChecked = undefined;\n let controller = this.abortController;\n if (!controller) {\n controller = new AbortController();\n this.abortController = controller;\n }\n addCheckedResetEventListener(\n this._ref,\n {\n checked: this.checked,\n defaultChecked,\n },\n (event) => {\n this.handleChange(event, true);\n },\n controller.signal\n );\n }\n }\n\n @Watch(\"_ref\")\n watch1() {\n this.watch1Fn();\n }\n\n componentDidLoad() {\n this.enableAttributePassing(this._ref, \"db-switch\");\n this._id = this.id ?? `switch-${uuid()}`;\n this._messageId = `${this._id}${DEFAULT_MESSAGE_ID_SUFFIX}`;\n this._validMessageId = `${this._id}${DEFAULT_VALID_MESSAGE_ID_SUFFIX}`;\n this._invalidMessageId = `${this._id}${DEFAULT_INVALID_MESSAGE_ID_SUFFIX}`;\n this.handleValidation();\n this.watch0Fn();\n this.watch1Fn();\n }\n disconnectedCallback() {\n this.abortController?.abort();\n }\n\n render() {\n return (\n <div\n class={cls(\"db-switch\", this.className)}\n data-visual-aid={getBooleanAsString(this.visualAid)}\n data-size={this.size}\n data-hide-label={getHideProp(this.showLabel)}\n data-variant={this.variant}\n data-hide-asterisk={getHideProp(this.showRequiredAsterisk)}\n data-custom-validity={this.validation}\n >\n <label htmlFor={this._id}>\n <input\n type=\"checkbox\"\n role=\"switch\"\n id={this._id}\n ref={(el: any) => {\n this._ref = el;\n }}\n checked={getBoolean(this.checked, \"checked\")}\n value={this.value}\n disabled={getBoolean(this.disabled, \"disabled\")}\n aria-invalid={this.validation === \"invalid\" ? \"true\" : undefined}\n aria-describedby={this._descByIds}\n name={this.name}\n required={getBoolean(this.required, \"required\")}\n data-aid-icon={this.iconLeading ?? this.icon}\n data-aid-icon-trailing={this.iconTrailing}\n onChange={(event) => this.handleChange(event)}\n onBlur={(event) => this.handleBlur(event)}\n onFocus={(event) => this.handleFocus(event)}\n />\n {this.label ? this.label : <slot></slot>}\n </label>\n {stringPropVisible(this.message, this.showMessage) ? (\n <db-infotext\n size=\"small\"\n semantic=\"adaptive\"\n id={this._messageId}\n icon={this.messageIcon}\n >\n {this.message}\n </db-infotext>\n ) : null}\n {this.hasValidState() ? (\n <db-infotext\n size=\"small\"\n semantic=\"successful\"\n id={this._validMessageId}\n >\n {this.validMessage ?? DEFAULT_VALID_MESSAGE}\n </db-infotext>\n ) : null}\n <db-infotext\n size=\"small\"\n semantic=\"critical\"\n id={this._invalidMessageId}\n >\n {this._invalidMessage ??\n this.invalidMessage ??\n DEFAULT_INVALID_MESSAGE}\n </db-infotext>\n <span data-visually-hidden=\"true\" role=\"status\">\n {this._voiceOverFallback}\n </span>\n </div>\n );\n }\n}\n"],"names":["DEFAULT_INVALID_MESSAGE","hasVoiceOver","delay","DEFAULT_VALID_MESSAGE","stringPropVisible","addCheckedResetEventListener","uuid","DEFAULT_MESSAGE_ID_SUFFIX","DEFAULT_VALID_MESSAGE_ID_SUFFIX","DEFAULT_INVALID_MESSAGE_ID_SUFFIX","h","cls","getBooleanA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AAA,GAAIP,+BAAqB,CAC/B,IACZ,IAAI,EACRO,OACE,CAAA,aAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAA,IAAI,EAAC,OAAO,EACZ,QAAQ,EAAC,UAAU,EACnB,EAAE,EAAE,IAAI,CAAC,iBAAiB,EAEzB,EAAA,CAAA,EAAA,GAAA,CAAA,EAAA,GAAA,IAAI,CAAC,eAAe,MACnB,IAAA,IAAA,EAAA,KAAA,MAAA,GAAA,EAAA,GAAA,IAAI,CAAC,cAAc,MACnB,IAAA,IAAA,EAAA,KAAA,MAAA,GAAA,EAAA,GAAAV,iCAAuB,CACb,EACdU,OAAA,CAAA,MAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAA,sBAAA,EAA2B,MAAM,EAAC,IAAI,EAAC,QAAQ,EAAA,EAC5C,IAAI,CAAC,kBAAkB,CACnB,CACH;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"db-switch.entry.cjs.js","sources":["src/components/switch/switch.tsx"],"sourcesContent":["import {\n DEFAULT_INVALID_MESSAGE,\n DEFAULT_INVALID_MESSAGE_ID_SUFFIX,\n DEFAULT_MESSAGE_ID_SUFFIX,\n DEFAULT_VALID_MESSAGE,\n DEFAULT_VALID_MESSAGE_ID_SUFFIX,\n} from \"../../shared/constants\";\nimport {\n ChangeEvent,\n GeneralKeyboardEvent,\n InteractionEvent,\n} from \"../../shared/model\";\nimport {\n cls,\n delay,\n getBoolean,\n getBooleanAsString,\n getHideProp,\n hasVoiceOver,\n stringPropVisible,\n uuid,\n} from \"../../utils\";\nimport {\n addCheckedResetEventListener,\n handleFrameworkEventAngular,\n handleFrameworkEventVue,\n} from \"../../utils/form-components\";\nimport { DBInfotext } from \"../infotext/infotext\";\nimport { DBSwitchProps, DBSwitchState } from \"./model\";\n\nimport {\n Component,\n h,\n Fragment,\n Watch,\n Event,\n EventEmitter,\n Prop,\n State,\n} from \"@stencil/core\";\n\n\n/**\n * @slot children - This is a default/unnamed slot\n\n */\n @Component({\n tag: \"db-switch\",\n})\nexport class DBSwitch {\n private _ref!: HTMLInputElement | any;\n @Prop() id: DBSwitchProps[\"id\"];\n @Prop() validation: DBSwitchProps[\"validation\"];\n @Prop() required: DBSwitchProps[\"required\"];\n @Prop() message: DBSwitchProps[\"message\"];\n @Prop() showMessage: DBSwitchProps[\"showMessage\"];\n @Prop() validMessage: DBSwitchProps[\"validMessage\"];\n @Prop() invalidMessage: DBSwitchProps[\"invalidMessage\"];\n @Prop() checked: DBSwitchProps[\"checked\"];\n @Event() change: EventEmitter<\n Parameters<Required<DBSwitchProps>[\"onChange\"]>[number]\n > | void;\n @Event() blur: EventEmitter<\n Parameters<Required<DBSwitchProps>[\"onBlur\"]>[number]\n > | void;\n @Event() focus: EventEmitter<\n Parameters<Required<DBSwitchProps>[\"onFocus\"]>[number]\n > | void;\n @Prop() disabled: DBSwitchProps[\"disabled\"];\n @Prop() visualAid: DBSwitchProps[\"visualAid\"];\n @Prop() size: DBSwitchProps[\"size\"];\n @Prop() showLabel: DBSwitchProps[\"showLabel\"];\n @Prop() variant: DBSwitchProps[\"variant\"];\n @Prop() showRequiredAsterisk: DBSwitchProps[\"showRequiredAsterisk\"];\n @Prop({attribute: \"classname\"}) className: DBSwitchProps[\"className\"];\n @Prop() value: DBSwitchProps[\"value\"];\n @Prop() name: DBSwitchProps[\"name\"];\n @Prop() iconLeading: DBSwitchProps[\"iconLeading\"];\n @Prop() icon: DBSwitchProps[\"icon\"];\n @Prop() iconTrailing: DBSwitchProps[\"iconTrailing\"];\n @Prop() label: DBSwitchProps[\"label\"];\n @Prop() messageIcon: DBSwitchProps[\"messageIcon\"];\n @State() _id = undefined;\n @State() _messageId = undefined;\n @State() _validMessageId = undefined;\n @State() _invalidMessageId = undefined;\n @State() _invalidMessage = undefined;\n @State() _descByIds = undefined;\n @State() _voiceOverFallback = \"\";\n @State() abortController = undefined;\n\n hasValidState() {\n return !!(this.validMessage ?? this.validation === \"valid\");\n }\n handleValidation() {\n if (!this._ref?.validity?.valid || this.validation === \"invalid\") {\n this._descByIds = this._invalidMessageId!;\n this._invalidMessage =\n this.invalidMessage ||\n this._ref?.validationMessage ||\n DEFAULT_INVALID_MESSAGE;\n if (hasVoiceOver()) {\n this._voiceOverFallback =\n this._invalidMessage || DEFAULT_INVALID_MESSAGE;\n delay(() => {\n this._voiceOverFallback = \"\";\n }, 1000);\n }\n return;\n }\n if (this.hasValidState() && this._ref?.validity?.valid && this.required) {\n this._descByIds = this._validMessageId!;\n if (hasVoiceOver()) {\n this._voiceOverFallback = this.validMessage ?? DEFAULT_VALID_MESSAGE;\n delay(() => {\n this._voiceOverFallback = \"\";\n }, 1000);\n }\n return;\n }\n if (stringPropVisible(this.message, this.showMessage)) {\n this._descByIds = this._messageId!;\n return;\n }\n this._descByIds = undefined;\n }\n handleChange(event: ChangeEvent<HTMLInputElement>, reset?: boolean) {\n if (this.change) {\n this.change.emit(event);\n }\n this.handleValidation();\n }\n handleBlur(event: InteractionEvent<HTMLInputElement>) {\n if (this.blur) {\n this.blur.emit(event);\n }\n }\n handleFocus(event: InteractionEvent<HTMLInputElement>) {\n if (this.focus) {\n this.focus.emit(event);\n }\n }\n handleKeyDown(event: GeneralKeyboardEvent<HTMLInputElement>) {\n // Support ENTER key for toggling the switch (a11y requirement)\n if (event.key === \"Enter\") {\n event.preventDefault();\n // Toggle the switch by clicking it programmatically\n if (!this.disabled) {\n (this._ref as HTMLInputElement)?.click();\n }\n }\n }\n\n /**\n * Passes `aria-*`, `data-*` & `class` attributes to correct child. Used in angular and stencil.\n * @param element the ref for the component\n * @param customElementSelector the custom element like `my-component`\n */\n private enableAttributePassing(\n element: HTMLInputElement | null,\n customElementSelector: string\n ) {\n const parent = element?.closest(customElementSelector);\n if (element && parent) {\n const attributes = parent.attributes;\n for (let i = 0; i < attributes.length; i++) {\n const attr = attributes.item(i);\n if (\n attr &&\n (attr.name.startsWith(\"data-\") || attr.name.startsWith(\"aria-\"))\n ) {\n element.setAttribute(attr.name, attr.value);\n parent.removeAttribute(attr.name);\n }\n if (attr && attr.name === \"class\") {\n const isWebComponent = attr.value.includes(\"hydrated\");\n const value = attr.value.replace(\"hydrated\", \"\").trim();\n const currentClass = element.getAttribute(\"class\");\n element.setAttribute(\n attr.name,\n `${currentClass ? `${currentClass} ` : \"\"}${value}`\n );\n if (isWebComponent) {\n // Stencil is using this class for lazy loading component\n parent.setAttribute(\"class\", \"hydrated\");\n } else {\n parent.removeAttribute(attr.name);\n }\n }\n }\n }\n }\n\n watch0Fn() {\n this.handleValidation();\n }\n\n @Watch(\"validation\")\n @Watch(\"required\")\n @Watch(\"message\")\n @Watch(\"showMessage\")\n @Watch(\"validMessage\")\n @Watch(\"invalidMessage\")\n @Watch(\"checked\")\n watch0() {\n this.watch0Fn();\n }\n\n watch1Fn() {\n if (this._ref) {\n const defaultChecked = undefined;\n let controller = this.abortController;\n if (!controller) {\n controller = new AbortController();\n this.abortController = controller;\n }\n addCheckedResetEventListener(\n this._ref,\n {\n checked: this.checked,\n defaultChecked,\n },\n (event) => {\n this.handleChange(event, true);\n },\n controller.signal\n );\n }\n }\n\n @Watch(\"_ref\")\n watch1() {\n this.watch1Fn();\n }\n\n componentDidLoad() {\n this.enableAttributePassing(this._ref, \"db-switch\");\n this._id = this.id ?? `switch-${uuid()}`;\n this._messageId = `${this._id}${DEFAULT_MESSAGE_ID_SUFFIX}`;\n this._validMessageId = `${this._id}${DEFAULT_VALID_MESSAGE_ID_SUFFIX}`;\n this._invalidMessageId = `${this._id}${DEFAULT_INVALID_MESSAGE_ID_SUFFIX}`;\n this.handleValidation();\n this.watch0Fn();\n this.watch1Fn();\n }\n disconnectedCallback() {\n this.abortController?.abort();\n }\n\n render() {\n return (\n <div\n class={cls(\"db-switch\", this.className)}\n data-visual-aid={getBooleanAsString(this.visualAid)}\n data-size={this.size}\n data-hide-label={getHideProp(this.showLabel)}\n data-variant={this.variant}\n data-hide-asterisk={getHideProp(this.showRequiredAsterisk)}\n data-custom-validity={this.validation}\n >\n <label htmlFor={this._id}>\n <input\n type=\"checkbox\"\n role=\"switch\"\n id={this._id}\n ref={(el: any) => {\n this._ref = el;\n }}\n checked={getBoolean(this.checked, \"checked\")}\n value={this.value}\n disabled={getBoolean(this.disabled, \"disabled\")}\n aria-invalid={this.validation === \"invalid\" ? \"true\" : undefined}\n aria-describedby={this._descByIds}\n name={this.name}\n required={getBoolean(this.required, \"required\")}\n data-aid-icon={this.iconLeading ?? this.icon}\n data-aid-icon-trailing={this.iconTrailing}\n onChange={(event) => this.handleChange(event)}\n onBlur={(event) => this.handleBlur(event)}\n onFocus={(event) => this.handleFocus(event)}\n onKeyDown={(event) => this.handleKeyDown(event)}\n />\n {this.label ? this.label : <slot></slot>}\n </label>\n {stringPropVisible(this.message, this.showMessage) ? (\n <db-infotext\n size=\"small\"\n semantic=\"adaptive\"\n id={this._messageId}\n icon={this.messageIcon}\n >\n {this.message}\n </db-infotext>\n ) : null}\n {this.hasValidState() ? (\n <db-infotext\n size=\"small\"\n semantic=\"successful\"\n id={this._validMessageId}\n >\n {this.validMessage ?? DEFAULT_VALID_MESSAGE}\n </db-infotext>\n ) : null}\n <db-infotext\n size=\"small\"\n semantic=\"critical\"\n id={this._invalidMessageId}\n >\n {this._invalidMessage ??\n this.invalidMessage ??\n DEFAULT_INVALID_MESSAGE}\n </db-infotext>\n <span data-visually-hidden=\"true\" role=\"status\">\n {this._voiceOverFallback}\n </span>\n </div>\n );\n }\n}\n"],"names":["DEFAULT_INVALID_MESSAGE","hasVoiceOver","delay","DEFAULT_VALID_MESSAGE","stringPropVisible","addCheckedResetEventListener","uuid","DEFAULT_MESSAGE_ID_SUFFIX","DEFAULT_VALID_MESSAGE_ID_SUFFIX","DEFAULT_INVALID_MESSAGE_ID_SUFFIX","h","cls","getBooleanAsString","getHideProp","getBoolean"],"mappings":";;;;;;;MAiDa,QAAQ,GAAA,MAAA;AAHpB,IAAA,WAAA,CAAA,OAAA,EAAA;;;;;AAoCU,QAAA,IAAG,CAAA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C,OAAO,CACD,IACZ,IAAI,EACP,IAAI,CAAC,aAAa,EAAE,IACnBA,OACE,CAAA,aAAA,EAAA,EAAA,IAAI,EAAC,OAAO,EACZ,QAAQ,EAAC,YAAY,EACrB,EAAE,EAAE,IAAI,CAAC,eAAe,EAAA,EAEvB,MAAA,IAAI,CAAC,YAAY,MAAA,IAAA,IAAA,EAAA,KAAA,MAAA,GAAA,EAAA,GAAIP,+BAAqB,CAC/B,IACZ,IAAI,EACRO,OACE,CAAA,aAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAA,IAAI,EAAC,OAAO,EACZ,QAAQ,EAAC,UAAU,EACnB,EAAE,EAAE,IAAI,CAAC,iBAAiB,EAEzB,EAAA,CAAA,EAAA,GAAA,CAAA,EAAA,GAAA,IAAI,CAAC,eAAe,MACnB,IAAA,IAAA,EAAA,KAAA,MAAA,GAAA,EAAA,GAAA,IAAI,CAAC,cAAc,MACnB,IAAA,IAAA,EAAA,KAAA,MAAA,GAAA,EAAA,GAAAV,iCAAuB,CACb,EACdU,OAAA,CAAA,MAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAA,sBAAA,EAA2B,MAAM,EAAC,IAAI,EAAC,QAAQ,EAAA,EAC5C,IAAI,CAAC,kBAAkB,CACnB,CACH;;;;;;;;;;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"db-tab-item.db-tab-list.db-tab-panel.entry.cjs.js","sources":["src/components/tab-item/tab-item.tsx","src/components/tab-list/tab-list.tsx","src/components/tab-panel/tab-panel.tsx"],"sourcesContent":["import { cls, getBoolean, getBooleanAsString } from \"../../utils\";\nimport {\n handleFrameworkEventAngular,\n handleFrameworkEventVue,\n} from \"../../utils/form-components\";\nimport type { DBTabItemProps, DBTabItemState } from \"./model\";\n\nimport {\n Component,\n h,\n Fragment,\n Watch,\n Event,\n EventEmitter,\n Prop,\n State,\n} from \"@stencil/core\";\n\n\n/**\n * @slot children - This is a default/unnamed slot\n\n */\n @Component({\n tag: \"db-tab-item\",\n})\nexport class DBTabItem {\n private _ref!: HTMLInputElement | any;\n @Prop() active: DBTabItemProps[\"active\"];\n @Prop() name: DBTabItemProps[\"name\"];\n @Event() change: EventEmitter<\n Parameters<Required<DBTabItemProps>[\"onChange\"]>[number]\n > | void;\n @Prop({attribute: \"classname\"}) className: DBTabItemProps[\"className\"];\n @Prop() id: DBTabItemProps[\"id\"];\n @Prop() iconLeading: DBTabItemProps[\"iconLeading\"];\n @Prop() icon: DBTabItemProps[\"icon\"];\n @Prop() iconTrailing: DBTabItemProps[\"iconTrailing\"];\n @Prop() showIconLeading: DBTabItemProps[\"showIconLeading\"];\n @Prop() showIcon: DBTabItemProps[\"showIcon\"];\n @Prop() showIconTrailing: DBTabItemProps[\"showIconTrailing\"];\n @Prop() noText: DBTabItemProps[\"noText\"];\n @Prop() disabled: DBTabItemProps[\"disabled\"];\n @Prop() checked: DBTabItemProps[\"checked\"];\n @Prop() label: DBTabItemProps[\"label\"];\n @State() _selected = false;\n @State() _name = undefined;\n @State() initialized = false;\n\n handleNameAttribute() {\n if (this._ref) {\n const setAttribute = this._ref.setAttribute;\n this._ref.setAttribute = (attribute: string, value: string) => {\n setAttribute.call(this._ref, attribute, value);\n if (attribute === \"name\") {\n this._name = value;\n }\n };\n }\n }\n handleChange(event: any) {\n event.stopPropagation();\n if (this.change) {\n this.change.emit(event);\n }\n\n // We have different ts types in different frameworks, so we need to use any here\n\n const selected = (event.target as any)?.[\"checked\"];\n this._selected = getBooleanAsString(selected);\n }\n\n /**\n * Passes `aria-*`, `data-*` & `class` attributes to correct child. Used in angular and stencil.\n * @param element the ref for the component\n * @param customElementSelector the custom element like `my-component`\n */\n private enableAttributePassing(\n element: HTMLElement | null,\n customElementSelector: string\n ) {\n const parent = element?.closest(customElementSelector);\n if (element && parent) {\n const attributes = parent.attributes;\n for (let i = 0; i < attributes.length; i++) {\n const attr = attributes.item(i);\n if (\n attr &&\n (attr.name.startsWith(\"data-\") || attr.name.startsWith(\"aria-\"))\n ) {\n element.setAttribute(attr.name, attr.value);\n parent.removeAttribute(attr.name);\n }\n if (attr && attr.name === \"class\") {\n const isWebComponent = attr.value.includes(\"hydrated\");\n const value = attr.value.replace(\"hydrated\", \"\").trim();\n const currentClass = element.getAttribute(\"class\");\n element.setAttribute(\n attr.name,\n `${currentClass ? `${currentClass} ` : \"\"}${value}`\n );\n if (isWebComponent) {\n // Stencil is using this class for lazy loading component\n parent.setAttribute(\"class\", \"hydrated\");\n } else {\n parent.removeAttribute(attr.name);\n }\n }\n }\n }\n }\n\n watch0Fn() {\n if (this.initialized && this._ref) {\n if (this.active) {\n this._ref.click();\n }\n this.initialized = false;\n }\n }\n\n @Watch(\"_ref\")\n @Watch(\"initialized\")\n watch0() {\n this.watch0Fn();\n }\n\n watch1Fn() {\n if (this.name) {\n this._name = this.name;\n }\n }\n\n @Watch(\"name\")\n watch1() {\n this.watch1Fn();\n }\n\n componentDidLoad() {\n this.enableAttributePassing(this._ref, \"db-tab-item\");\n this.initialized = true;\n this.watch0Fn();\n this.watch1Fn();\n }\n\n render() {\n return (\n <li class={cls(\"db-tab-item\", this.className)} role=\"none\">\n <label\n htmlFor={this.id}\n data-icon={this.iconLeading ?? this.icon}\n data-icon-trailing={this.iconTrailing}\n data-show-icon={getBooleanAsString(\n this.showIconLeading ?? this.showIcon\n )}\n data-show-icon-trailing={getBooleanAsString(this.showIconTrailing)}\n data-no-text={getBooleanAsString(this.noText)}\n >\n <input\n type=\"radio\"\n role=\"tab\"\n disabled={getBoolean(this.disabled, \"disabled\")}\n aria-selected={this._selected}\n checked={getBoolean(this.checked, \"checked\")}\n ref={(el: any) => {\n this._ref = el;\n }}\n name={this._name}\n id={this.id}\n onInput={(event) => this.handleChange(event)}\n />\n {this.label ? this.label : null}\n <slot></slot>\n </label>\n </li>\n );\n }\n}\n","import { DEFAULT_ID } from \"../../shared/constants\";\nimport { cls, uuid } from \"../../utils\";\nimport { DBTabListProps, DBTabListState } from \"./model\";\n\nimport { Component, h, Fragment, Prop, State } from \"@stencil/core\";\n\n\n/**\n * @slot children - This is a default/unnamed slot\n\n */\n @Component({\n tag: \"db-tab-list\",\n})\nexport class DBTabList {\n private _ref!: HTMLDivElement | any;\n @Prop() id: DBTabListProps[\"id\"];\n @Prop({attribute: \"classname\"}) className: DBTabListProps[\"className\"];\n @State() _id = DEFAULT_ID;\n\n /**\n * Passes `aria-*`, `data-*` & `class` attributes to correct child. Used in angular and stencil.\n * @param element the ref for the component\n * @param customElementSelector the custom element like `my-component`\n */\n private enableAttributePassing(\n element: HTMLElement | null,\n customElementSelector: string\n ) {\n const parent = element?.closest(customElementSelector);\n if (element && parent) {\n const attributes = parent.attributes;\n for (let i = 0; i < attributes.length; i++) {\n const attr = attributes.item(i);\n if (\n attr &&\n (attr.name.startsWith(\"data-\") || attr.name.startsWith(\"aria-\"))\n ) {\n element.setAttribute(attr.name, attr.value);\n parent.removeAttribute(attr.name);\n }\n if (attr && attr.name === \"class\") {\n const isWebComponent = attr.value.includes(\"hydrated\");\n const value = attr.value.replace(\"hydrated\", \"\").trim();\n const currentClass = element.getAttribute(\"class\");\n element.setAttribute(\n attr.name,\n `${currentClass ? `${currentClass} ` : \"\"}${value}`\n );\n if (isWebComponent) {\n // Stencil is using this class for lazy loading component\n parent.setAttribute(\"class\", \"hydrated\");\n } else {\n parent.removeAttribute(attr.name);\n }\n }\n }\n }\n }\n\n componentDidLoad() {\n this.enableAttributePassing(this._ref, \"db-tab-list\");\n this._id = this.id || \"tab-list-\" + uuid();\n }\n\n render() {\n return (\n <div\n class={cls(\"db-tab-list\", this.className)}\n ref={(el: any) => {\n this._ref = el;\n }}\n id={this._id}\n >\n <ul role=\"tablist\">\n <slot></slot>\n </ul>\n </div>\n );\n }\n}\n","import { cls } from \"../../utils\";\nimport { DBTabPanelProps, DBTabPanelState } from \"./model\";\n\nimport { Component, h, Fragment, Prop } from \"@stencil/core\";\n\n\n/**\n * @slot children - This is a default/unnamed slot\n\n */\n @Component({\n tag: \"db-tab-panel\",\n})\nexport class DBTabPanel {\n private _ref!: HTMLDivElement | any;\n @Prop({attribute: \"classname\"}) className: DBTabPanelProps[\"className\"];\n @Prop() id: DBTabPanelProps[\"id\"];\n @Prop() content: DBTabPanelProps[\"content\"];\n\n /**\n * Passes `aria-*`, `data-*` & `class` attributes to correct child. Used in angular and stencil.\n * @param element the ref for the component\n * @param customElementSelector the custom element like `my-component`\n */\n private enableAttributePassing(\n element: HTMLElement | null,\n customElementSelector: string\n ) {\n const parent = element?.closest(customElementSelector);\n if (element && parent) {\n const attributes = parent.attributes;\n for (let i = 0; i < attributes.length; i++) {\n const attr = attributes.item(i);\n if (\n attr &&\n (attr.name.startsWith(\"data-\") || attr.name.startsWith(\"aria-\"))\n ) {\n element.setAttribute(attr.name, attr.value);\n parent.removeAttribute(attr.name);\n }\n if (attr && attr.name === \"class\") {\n const isWebComponent = attr.value.includes(\"hydrated\");\n const value = attr.value.replace(\"hydrated\", \"\").trim();\n const currentClass = element.getAttribute(\"class\");\n element.setAttribute(\n attr.name,\n `${currentClass ? `${currentClass} ` : \"\"}${value}`\n );\n if (isWebComponent) {\n // Stencil is using this class for lazy loading component\n parent.setAttribute(\"class\", \"hydrated\");\n } else {\n parent.removeAttribute(attr.name);\n }\n }\n }\n }\n }\n\n componentDidLoad() {\n this.enableAttributePassing(this._ref, \"db-tab-panel\");\n }\n\n render() {\n return (\n <section\n class={cls(\"db-tab-panel\", this.className)}\n role=\"tabpanel\"\n ref={(el: any) => {\n this._ref = el;\n }}\n id={this.id}\n >\n {this.content ? this.content : null}\n <slot></slot>\n </section>\n );\n }\n}\n"],"names":["getBooleanAsString","h","cls","getBoolean","DEFAULT_ID","uuid"],"mappings":";;;;;;MA0Ba,SAAS,GAAA,MAAA;AAHrB,IAAA,WAAA,CAAA,OAAA,EAAA;;;AAsBU,QAAA,IAAS,CAAA,SAAA,GAAG,KAAK;AACjB,QAAA,IAAK,CAAA,KAAA,GAAG,SAAS;AACjB,QAAA,I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GAAG,CAAG,EAAA,YAAY,CAAG,CAAA,CAAA,GAAG,EAAE,CAAG,EAAA,KAAK,CAAE,CAAA,CACpD;oBACD,IAAI,cAAc,EAAE;;AAElB,wBAAA,MAAM,CAAC,YAAY,CAAC,OAAO,EAAE,UAAU,CAAC;;yBACnC;AACL,wBAAA,MAAM,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC;;;;;;IAO3C,gBAAgB,GAAA;QACd,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,IAAI,EAAE,cAAc,CAAC;;IAGxD,MAAM,GAAA;AACJ,QAAA,QACEA,sEACE,KAAK,EAAEC,WAAG,CAAC,cAAc,EAAE,IAAI,CAAC,SAAS,CAAC,EAC1C,IAAI,EAAC,UAAU,EACf,GAAG,EAAE,CAAC,EAAO,KAAI;AACf,gBAAA,IAAI,CAAC,IAAI,GAAG,EAAE;AAChB,aAAC,EACD,EAAE,EAAE,IAAI,CAAC,EAAE,EAAA,EAEV,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,GAAG,IAAI,EACnCD,OAAa,CAAA,MAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAA,CAAA,CACL;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"db-tab-item.db-tab-list.db-tab-panel.entry.cjs.js","sources":["src/components/tab-item/tab-item.tsx","src/components/tab-list/tab-list.tsx","src/components/tab-panel/tab-panel.tsx"],"sourcesContent":["import { cls, getBoolean, getBooleanAsString } from \"../../utils\";\nimport {\n handleFrameworkEventAngular,\n handleFrameworkEventVue,\n} from \"../../utils/form-components\";\nimport type { DBTabItemProps, DBTabItemState } from \"./model\";\n\nimport {\n Component,\n h,\n Fragment,\n Watch,\n Event,\n EventEmitter,\n Prop,\n State,\n} from \"@stencil/core\";\n\n\n/**\n * @slot children - This is a default/unnamed slot\n\n */\n @Component({\n tag: \"db-tab-item\",\n})\nexport class DBTabItem {\n private _ref!: HTMLInputElement | any;\n @Prop() active: DBTabItemProps[\"active\"];\n @Prop() name: DBTabItemProps[\"name\"];\n @Event() change: EventEmitter<\n Parameters<Required<DBTabItemProps>[\"onChange\"]>[number]\n > | void;\n @Prop({attribute: \"classname\"}) className: DBTabItemProps[\"className\"];\n @Prop() id: DBTabItemProps[\"id\"];\n @Prop() iconLeading: DBTabItemProps[\"iconLeading\"];\n @Prop() icon: DBTabItemProps[\"icon\"];\n @Prop() iconTrailing: DBTabItemProps[\"iconTrailing\"];\n @Prop() showIconLeading: DBTabItemProps[\"showIconLeading\"];\n @Prop() showIcon: DBTabItemProps[\"showIcon\"];\n @Prop() showIconTrailing: DBTabItemProps[\"showIconTrailing\"];\n @Prop() noText: DBTabItemProps[\"noText\"];\n @Prop() disabled: DBTabItemProps[\"disabled\"];\n @Prop() checked: DBTabItemProps[\"checked\"];\n @Prop() label: DBTabItemProps[\"label\"];\n @State() _selected = false;\n @State() _name = undefined;\n @State() initialized = false;\n @State() _listenerAdded = false;\n @State() boundSetSelectedOnChange = undefined;\n\n setSelectedOnChange(event: any) {\n event.stopPropagation();\n this._selected = getBooleanAsString(event.target === this._ref);\n }\n handleNameAttribute() {\n if (this._ref) {\n const setAttribute = this._ref.setAttribute;\n this._ref.setAttribute = (attribute: string, value: string) => {\n setAttribute.call(this._ref, attribute, value);\n if (attribute === \"name\") {\n this._name = value;\n }\n };\n }\n }\n handleChange(event: any) {\n if (this.change) {\n this.change.emit(event);\n }\n }\n\n /**\n * Passes `aria-*`, `data-*` & `class` attributes to correct child. Used in angular and stencil.\n * @param element the ref for the component\n * @param customElementSelector the custom element like `my-component`\n */\n private enableAttributePassing(\n element: HTMLElement | null,\n customElementSelector: string\n ) {\n const parent = element?.closest(customElementSelector);\n if (element && parent) {\n const attributes = parent.attributes;\n for (let i = 0; i < attributes.length; i++) {\n const attr = attributes.item(i);\n if (\n attr &&\n (attr.name.startsWith(\"data-\") || attr.name.startsWith(\"aria-\"))\n ) {\n element.setAttribute(attr.name, attr.value);\n parent.removeAttribute(attr.name);\n }\n if (attr && attr.name === \"class\") {\n const isWebComponent = attr.value.includes(\"hydrated\");\n const value = attr.value.replace(\"hydrated\", \"\").trim();\n const currentClass = element.getAttribute(\"class\");\n element.setAttribute(\n attr.name,\n `${currentClass ? `${currentClass} ` : \"\"}${value}`\n );\n if (isWebComponent) {\n // Stencil is using this class for lazy loading component\n parent.setAttribute(\"class\", \"hydrated\");\n } else {\n parent.removeAttribute(attr.name);\n }\n }\n }\n }\n }\n\n watch0Fn() {\n if (this._ref && this.initialized && this.boundSetSelectedOnChange) {\n this.initialized = false;\n\n // deselect this tab when another tab in tablist is selected\n if (!this._listenerAdded) {\n this._ref\n .closest(\"[role=tablist]\")\n ?.addEventListener(\"change\", this.boundSetSelectedOnChange);\n this._listenerAdded = true;\n }\n\n // Initialize selected state from either active prop (set by parent) or checked attribute\n if (this.active || this._ref.checked) {\n this._selected = getBooleanAsString(true);\n this._ref.click();\n }\n }\n }\n\n @Watch(\"_ref\")\n @Watch(\"initialized\")\n @Watch(\"boundSetSelectedOnChange\")\n watch0() {\n this.watch0Fn();\n }\n\n watch1Fn() {\n if (this.name) {\n this._name = this.name;\n }\n }\n\n @Watch(\"name\")\n watch1() {\n this.watch1Fn();\n }\n\n componentDidLoad() {\n this.enableAttributePassing(this._ref, \"db-tab-item\");\n this.boundSetSelectedOnChange = this.setSelectedOnChange.bind(this);\n this.initialized = true;\n this.watch0Fn();\n this.watch1Fn();\n }\n disconnectedCallback() {\n if (this._listenerAdded && this._ref && this.boundSetSelectedOnChange) {\n this._ref\n .closest(\"[role=tablist]\")\n ?.removeEventListener(\"change\", this.boundSetSelectedOnChange);\n this._listenerAdded = false;\n }\n }\n\n render() {\n return (\n <li class={cls(\"db-tab-item\", this.className)} role=\"none\">\n <label\n htmlFor={this.id}\n data-icon={this.iconLeading ?? this.icon}\n data-icon-trailing={this.iconTrailing}\n data-show-icon={getBooleanAsString(\n this.showIconLeading ?? this.showIcon\n )}\n data-show-icon-trailing={getBooleanAsString(this.showIconTrailing)}\n data-no-text={getBooleanAsString(this.noText)}\n >\n <input\n type=\"radio\"\n role=\"tab\"\n disabled={getBoolean(this.disabled, \"disabled\")}\n aria-selected={this._selected}\n checked={getBoolean(this.checked, \"checked\")}\n ref={(el: any) => {\n this._ref = el;\n }}\n name={this._name}\n id={this.id}\n onInput={(event) => this.handleChange(event)}\n />\n {this.label ? this.label : null}\n <slot></slot>\n </label>\n </li>\n );\n }\n}\n","import { DEFAULT_ID } from \"../../shared/constants\";\nimport { cls, uuid } from \"../../utils\";\nimport { DBTabListProps, DBTabListState } from \"./model\";\n\nimport { Component, h, Fragment, Prop, State } from \"@stencil/core\";\n\n\n/**\n * @slot children - This is a default/unnamed slot\n\n */\n @Component({\n tag: \"db-tab-list\",\n})\nexport class DBTabList {\n private _ref!: HTMLDivElement | any;\n @Prop() id: DBTabListProps[\"id\"];\n @Prop({attribute: \"classname\"}) className: DBTabListProps[\"className\"];\n @State() _id = DEFAULT_ID;\n\n /**\n * Passes `aria-*`, `data-*` & `class` attributes to correct child. Used in angular and stencil.\n * @param element the ref for the component\n * @param customElementSelector the custom element like `my-component`\n */\n private enableAttributePassing(\n element: HTMLElement | null,\n customElementSelector: string\n ) {\n const parent = element?.closest(customElementSelector);\n if (element && parent) {\n const attributes = parent.attributes;\n for (let i = 0; i < attributes.length; i++) {\n const attr = attributes.item(i);\n if (\n attr &&\n (attr.name.startsWith(\"data-\") || attr.name.startsWith(\"aria-\"))\n ) {\n element.setAttribute(attr.name, attr.value);\n parent.removeAttribute(attr.name);\n }\n if (attr && attr.name === \"class\") {\n const isWebComponent = attr.value.includes(\"hydrated\");\n const value = attr.value.replace(\"hydrated\", \"\").trim();\n const currentClass = element.getAttribute(\"class\");\n element.setAttribute(\n attr.name,\n `${currentClass ? `${currentClass} ` : \"\"}${value}`\n );\n if (isWebComponent) {\n // Stencil is using this class for lazy loading component\n parent.setAttribute(\"class\", \"hydrated\");\n } else {\n parent.removeAttribute(attr.name);\n }\n }\n }\n }\n }\n\n componentDidLoad() {\n this.enableAttributePassing(this._ref, \"db-tab-list\");\n this._id = this.id || \"tab-list-\" + uuid();\n }\n\n render() {\n return (\n <div\n class={cls(\"db-tab-list\", this.className)}\n ref={(el: any) => {\n this._ref = el;\n }}\n id={this._id}\n >\n <ul role=\"tablist\">\n <slot></slot>\n </ul>\n </div>\n );\n }\n}\n","import { cls } from \"../../utils\";\nimport { DBTabPanelProps, DBTabPanelState } from \"./model\";\n\nimport { Component, h, Fragment, Prop } from \"@stencil/core\";\n\n\n/**\n * @slot children - This is a default/unnamed slot\n\n */\n @Component({\n tag: \"db-tab-panel\",\n})\nexport class DBTabPanel {\n private _ref!: HTMLDivElement | any;\n @Prop({attribute: \"classname\"}) className: DBTabPanelProps[\"className\"];\n @Prop() id: DBTabPanelProps[\"id\"];\n @Prop() content: DBTabPanelProps[\"content\"];\n\n /**\n * Passes `aria-*`, `data-*` & `class` attributes to correct child. Used in angular and stencil.\n * @param element the ref for the component\n * @param customElementSelector the custom element like `my-component`\n */\n private enableAttributePassing(\n element: HTMLElement | null,\n customElementSelector: string\n ) {\n const parent = element?.closest(customElementSelector);\n if (element && parent) {\n const attributes = parent.attributes;\n for (let i = 0; i < attributes.length; i++) {\n const attr = attributes.item(i);\n if (\n attr &&\n (attr.name.startsWith(\"data-\") || attr.name.startsWith(\"aria-\"))\n ) {\n element.setAttribute(attr.name, attr.value);\n parent.removeAttribute(attr.name);\n }\n if (attr && attr.name === \"class\") {\n const isWebComponent = attr.value.includes(\"hydrated\");\n const value = attr.value.replace(\"hydrated\", \"\").trim();\n const currentClass = element.getAttribute(\"class\");\n element.setAttribute(\n attr.name,\n `${currentClass ? `${currentClass} ` : \"\"}${value}`\n );\n if (isWebComponent) {\n // Stencil is using this class for lazy loading component\n parent.setAttribute(\"class\", \"hydrated\");\n } else {\n parent.removeAttribute(attr.name);\n }\n }\n }\n }\n }\n\n componentDidLoad() {\n this.enableAttributePassing(this._ref, \"db-tab-panel\");\n }\n\n render() {\n return (\n <section\n class={cls(\"db-tab-panel\", this.className)}\n role=\"tabpanel\"\n ref={(el: any) => {\n this._ref = el;\n }}\n id={this.id}\n >\n {this.content ? this.content : null}\n <slot></slot>\n </section>\n );\n }\n}\n"],"names":["getBooleanAsString","h","cls","getBoolean","DEFAULT_ID","uuid"],"mappings":";;;;;;MA0Ba,SAAS,GAAA,MAAA;AAHrB,IAAA,WAAA,CAAA,OAAA,EAAA;;;AAsBU,QAAA,IAAS,CAAA,SAAA,GAAG,KAAK;AACjB,QAAA,IAAK,CAAA,KAAA,GAAG,SAAS;AACjB,QAAA,IAAW,CAAA,WAAA,GAAG,KAAK;AACnB,QAAA,IAAc,CAAA,cAAA,GAAG,KAAK;AACtB,QAAA,IAAwB,CAAA,wBAAA,GAAG,SAAS;AAqJ9C;AAnJC,IAAA,mBAAmB,CAAC,KAAU,EAAA;QAC5B,KAAK,CAAC,eAAe,EAAE;AACvB,QAAA,IAAI,CAAC,SAAS,GAAGA,0BAAkB,CAAC,KAAK,CAAC,MAAM,KAAK,IAAI,CAAC,IAAI,CAAC;;IAEjE,mBAAmB,GAAA;AACjB,QAAA,IAAI,IAAI,CAAC,IAAI,EAAE;AACb,YAAA,MAAM,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,YAAY;YAC3C,IAAI,CAAC,IAAI,CAAC,YAAY,GAAG,CAAC,SAAiB,EAAE,KAAa,KAAI;gBAC5D,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,SAAS,EAAE,KAAK,CAAC;AAC9C,gBAAA,IAAI,SAAS,KAAK,MAAM,EAAE;AACxB,oBAAA,IAAI,CAAC,KAAK,GAAG,KAAK;;AAEtB,aAAC;;;AAGL,IAAA,YAAY,CAAC,KAAU,EAAA;AACrB,QAAA,IAAI,IAAI,CAAC,MAAM,EAAE;AACf,YAAA,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC;;;AAI3B;;;;AAIG;IACK,sBAAsB,CAC5B,OAA2B,EAC3B,qBAA6B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,EAAA,YAAY,GAAG,CAAG,EAAA,YAAY,CAAG,CAAA,CAAA,GAAG,EAAE,CAAG,EAAA,KAAK,CAAE,CAAA,CACpD;oBACD,IAAI,cAAc,EAAE;;AAElB,wBAAA,MAAM,CAAC,YAAY,CAAC,OAAO,EAAE,UAAU,CAAC;;yBACnC;AACL,wBAAA,MAAM,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC;;;;;;IAO3C,gBAAgB,GAAA;QACd,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,IAAI,EAAE,cAAc,CAAC;;IAGxD,MAAM,GAAA;AACJ,QAAA,QACEA,sEACE,KAAK,EAAEC,WAAG,CAAC,cAAc,EAAE,IAAI,CAAC,SAAS,CAAC,EAC1C,IAAI,EAAC,UAAU,EACf,GAAG,EAAE,CAAC,EAAO,KAAI;AACf,gBAAA,IAAI,CAAC,IAAI,GAAG,EAAE;AAChB,aAAC,EACD,EAAE,EAAE,IAAI,CAAC,EAAE,EAAA,EAEV,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,GAAG,IAAI,EACnCD,OAAa,CAAA,MAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAA,CAAA,CACL;;;;;;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
3
|
+
var index = require('./index-Db5RdCbB.js');
|
|
4
4
|
var index$1 = require('./index-Bm2Cw2rz.js');
|
|
5
5
|
var constants = require('./constants-CTtyzyuo.js');
|
|
6
6
|
|
|
@@ -11,6 +11,12 @@ const DBTabItem = class {
|
|
|
11
11
|
this._selected = false;
|
|
12
12
|
this._name = undefined;
|
|
13
13
|
this.initialized = false;
|
|
14
|
+
this._listenerAdded = false;
|
|
15
|
+
this.boundSetSelectedOnChange = undefined;
|
|
16
|
+
}
|
|
17
|
+
setSelectedOnChange(event) {
|
|
18
|
+
event.stopPropagation();
|
|
19
|
+
this._selected = index$1.getBooleanAsString(event.target === this._ref);
|
|
14
20
|
}
|
|
15
21
|
handleNameAttribute() {
|
|
16
22
|
if (this._ref) {
|
|
@@ -24,14 +30,9 @@ const DBTabItem = class {
|
|
|
24
30
|
}
|
|
25
31
|
}
|
|
26
32
|
handleChange(event) {
|
|
27
|
-
var _a;
|
|
28
|
-
event.stopPropagation();
|
|
29
33
|
if (this.change) {
|
|
30
34
|
this.change.emit(event);
|
|
31
35
|
}
|
|
32
|
-
// We have different ts types in different frameworks, so we need to use any here
|
|
33
|
-
const selected = (_a = event.target) === null || _a === void 0 ? void 0 : _a["checked"];
|
|
34
|
-
this._selected = index$1.getBooleanAsString(selected);
|
|
35
36
|
}
|
|
36
37
|
/**
|
|
37
38
|
* Passes `aria-*`, `data-*` & `class` attributes to correct child. Used in angular and stencil.
|
|
@@ -66,11 +67,20 @@ const DBTabItem = class {
|
|
|
66
67
|
}
|
|
67
68
|
}
|
|
68
69
|
watch0Fn() {
|
|
69
|
-
|
|
70
|
-
|
|
70
|
+
var _a;
|
|
71
|
+
if (this._ref && this.initialized && this.boundSetSelectedOnChange) {
|
|
72
|
+
this.initialized = false;
|
|
73
|
+
// deselect this tab when another tab in tablist is selected
|
|
74
|
+
if (!this._listenerAdded) {
|
|
75
|
+
(_a = this._ref
|
|
76
|
+
.closest("[role=tablist]")) === null || _a === void 0 ? void 0 : _a.addEventListener("change", this.boundSetSelectedOnChange);
|
|
77
|
+
this._listenerAdded = true;
|
|
78
|
+
}
|
|
79
|
+
// Initialize selected state from either active prop (set by parent) or checked attribute
|
|
80
|
+
if (this.active || this._ref.checked) {
|
|
81
|
+
this._selected = index$1.getBooleanAsString(true);
|
|
71
82
|
this._ref.click();
|
|
72
83
|
}
|
|
73
|
-
this.initialized = false;
|
|
74
84
|
}
|
|
75
85
|
}
|
|
76
86
|
watch0() {
|
|
@@ -86,19 +96,29 @@ const DBTabItem = class {
|
|
|
86
96
|
}
|
|
87
97
|
componentDidLoad() {
|
|
88
98
|
this.enableAttributePassing(this._ref, "db-tab-item");
|
|
99
|
+
this.boundSetSelectedOnChange = this.setSelectedOnChange.bind(this);
|
|
89
100
|
this.initialized = true;
|
|
90
101
|
this.watch0Fn();
|
|
91
102
|
this.watch1Fn();
|
|
92
103
|
}
|
|
104
|
+
disconnectedCallback() {
|
|
105
|
+
var _a;
|
|
106
|
+
if (this._listenerAdded && this._ref && this.boundSetSelectedOnChange) {
|
|
107
|
+
(_a = this._ref
|
|
108
|
+
.closest("[role=tablist]")) === null || _a === void 0 ? void 0 : _a.removeEventListener("change", this.boundSetSelectedOnChange);
|
|
109
|
+
this._listenerAdded = false;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
93
112
|
render() {
|
|
94
113
|
var _a, _b;
|
|
95
|
-
return (index.h("li", { key: '
|
|
114
|
+
return (index.h("li", { key: '9bbc9bdc6c450f62ce790a2662b165f9fad484ea', class: index$1.cls("db-tab-item", this.className), role: "none" }, index.h("label", { key: 'e3a4e3afdd250587b5d0cef54eb7d8302980199f', htmlFor: this.id, "data-icon": (_a = this.iconLeading) !== null && _a !== void 0 ? _a : this.icon, "data-icon-trailing": this.iconTrailing, "data-show-icon": index$1.getBooleanAsString((_b = this.showIconLeading) !== null && _b !== void 0 ? _b : this.showIcon), "data-show-icon-trailing": index$1.getBooleanAsString(this.showIconTrailing), "data-no-text": index$1.getBooleanAsString(this.noText) }, index.h("input", { key: '372cd912646fd40dc31f49d344d60526442a0f7a', type: "radio", role: "tab", disabled: index$1.getBoolean(this.disabled, "disabled"), "aria-selected": this._selected, checked: index$1.getBoolean(this.checked, "checked"), ref: (el) => {
|
|
96
115
|
this._ref = el;
|
|
97
|
-
}, name: this._name, id: this.id, onInput: (event) => this.handleChange(event) }), this.label ? this.label : null, index.h("slot", { key: '
|
|
116
|
+
}, name: this._name, id: this.id, onInput: (event) => this.handleChange(event) }), this.label ? this.label : null, index.h("slot", { key: '843e696cad853b5ce9d582f210efe86f3d270cb8' }))));
|
|
98
117
|
}
|
|
99
118
|
static get watchers() { return {
|
|
100
119
|
"_ref": ["watch0"],
|
|
101
120
|
"initialized": ["watch0"],
|
|
121
|
+
"boundSetSelectedOnChange": ["watch0"],
|
|
102
122
|
"name": ["watch1"]
|
|
103
123
|
}; }
|
|
104
124
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var index = require('./index-
|
|
3
|
+
var index = require('./index-Db5RdCbB.js');
|
|
4
4
|
var index$1 = require('./index-Bm2Cw2rz.js');
|
|
5
5
|
|
|
6
6
|
const DBTabs = class {
|
|
@@ -123,9 +123,9 @@ const DBTabs = class {
|
|
|
123
123
|
if (tabItem) {
|
|
124
124
|
const list = tabItem.parentElement;
|
|
125
125
|
if (list) {
|
|
126
|
-
const
|
|
126
|
+
const tabIndex = Array.from(list.children).indexOf(tabItem);
|
|
127
127
|
if (this.indexChange) {
|
|
128
|
-
this.indexChange.emit(
|
|
128
|
+
this.indexChange.emit(tabIndex);
|
|
129
129
|
}
|
|
130
130
|
if (this.tabSelect) {
|
|
131
131
|
this.tabSelect.emit(event);
|