@db-ux/wc-core-components 4.11.0 → 4.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/bundle/db-accordion-item.js +1 -1
- package/bundle/db-accordion.js +1 -1
- package/bundle/db-badge.js +1 -1
- package/bundle/db-brand.js +1 -1
- package/bundle/db-button.js +1 -1
- package/bundle/db-card.js +1 -1
- package/bundle/db-checkbox.js +1 -1
- package/bundle/db-custom-button.js +1 -1
- package/bundle/db-custom-select-dropdown.js +1 -1
- package/bundle/db-custom-select-form-field.js +1 -1
- package/bundle/db-custom-select-list-item.js +1 -1
- package/bundle/db-custom-select-list.js +1 -1
- package/bundle/db-custom-select.js +1 -1
- package/bundle/db-divider.js +1 -1
- package/bundle/db-drawer.js +1 -1
- package/bundle/db-header.js +1 -1
- package/bundle/db-icon.js +1 -1
- package/bundle/db-infotext.js +1 -1
- package/bundle/db-input.js +1 -1
- package/bundle/db-link.js +1 -1
- package/bundle/db-navigation-item.js +1 -1
- package/bundle/db-navigation.js +1 -1
- package/bundle/db-notification.js +1 -1
- package/bundle/db-page.js +1 -1
- package/bundle/db-popover.js +1 -1
- package/bundle/db-radio.js +1 -1
- package/bundle/db-section.js +1 -1
- package/bundle/db-select.js +1 -1
- package/bundle/db-stack.js +1 -1
- package/bundle/db-switch.js +1 -1
- package/bundle/db-tab-item.js +1 -1
- package/bundle/db-tab-list.js +1 -1
- package/bundle/db-tab-panel.js +1 -1
- package/bundle/db-table-body.js +1 -1
- package/bundle/db-table-caption.js +1 -1
- package/bundle/db-table-data-cell.js +1 -1
- package/bundle/db-table-footer.js +1 -1
- package/bundle/db-table-head.js +1 -1
- package/bundle/db-table-header-cell.js +1 -1
- package/bundle/db-table-row.js +1 -1
- package/bundle/db-table.js +1 -1
- package/bundle/db-tabs.js +1 -1
- package/bundle/db-tag.js +1 -1
- package/bundle/db-textarea.js +1 -1
- package/bundle/db-tooltip.js +1 -1
- package/bundle/p-3Da4lo5j.js +1 -0
- package/bundle/p-BEcb3EOO.js +1 -0
- package/bundle/p-BEolc6Da.js +1 -0
- package/bundle/p-BekmqY3B.js +1 -0
- package/bundle/p-BmRO4X-P.js +1 -0
- package/bundle/p-BrQIYm5N.js +1 -0
- package/bundle/p-BxZ0zFXf.js +1 -0
- package/bundle/p-C2viXF7U.js +1 -0
- package/bundle/p-C4iD-won.js +1 -0
- package/bundle/p-CHg_VPD9.js +1 -0
- package/bundle/p-CZ9SsTOA.js +1 -0
- package/bundle/p-CewqZGHg.js +1 -0
- package/bundle/p-CotiEHZi.js +1 -0
- package/bundle/p-D1orcIJf.js +1 -0
- package/bundle/p-D9RSX1St.js +1 -0
- package/bundle/p-DbgzEek1.js +1 -0
- package/bundle/p-DqNXsduK.js +1 -0
- package/bundle/p-Duacd-NX.js +1 -0
- package/bundle/p-k5Hci0ok.js +1 -0
- package/bundle/p-mk64Fltq.js +1 -0
- package/dist/cjs/db-accordion-item.cjs.entry.js +46 -9
- package/dist/cjs/db-accordion.cjs.entry.js +43 -6
- package/dist/cjs/db-badge.cjs.entry.js +43 -6
- package/dist/cjs/db-brand.cjs.entry.js +36 -5
- package/dist/cjs/db-button.cjs.entry.js +36 -5
- package/dist/cjs/db-card.cjs.entry.js +36 -5
- package/dist/cjs/db-checkbox.cjs.entry.js +45 -11
- package/dist/cjs/db-custom-button.cjs.entry.js +36 -5
- package/dist/cjs/db-custom-select-dropdown_5.cjs.entry.js +190 -31
- package/dist/cjs/db-custom-select-form-field.cjs.entry.js +36 -5
- package/dist/cjs/db-custom-select.cjs.entry.js +60 -26
- package/dist/cjs/db-divider.cjs.entry.js +35 -4
- package/dist/cjs/db-drawer.cjs.entry.js +45 -8
- package/dist/cjs/db-header.cjs.entry.js +43 -6
- package/dist/cjs/db-icon.cjs.entry.js +36 -5
- package/dist/cjs/db-infotext.cjs.entry.js +36 -5
- package/dist/cjs/db-link_4.cjs.entry.js +65 -19
- package/dist/cjs/db-navigation-item.cjs.entry.js +46 -9
- package/dist/cjs/db-navigation.cjs.entry.js +36 -5
- package/dist/cjs/db-notification.cjs.entry.js +36 -5
- package/dist/cjs/db-page.cjs.entry.js +48 -13
- package/dist/cjs/db-popover.cjs.entry.js +43 -6
- package/dist/cjs/db-radio.cjs.entry.js +42 -8
- package/dist/cjs/db-section.cjs.entry.js +36 -5
- package/dist/cjs/db-select.cjs.entry.js +45 -11
- package/dist/cjs/db-stack.cjs.entry.js +36 -5
- package/dist/cjs/db-switch.cjs.entry.js +45 -11
- package/dist/cjs/db-tab-item_3.cjs.entry.js +118 -19
- package/dist/cjs/db-table-body_3.cjs.entry.js +53 -12
- package/dist/cjs/db-table-caption.cjs.entry.js +36 -5
- package/dist/cjs/db-table.cjs.entry.js +35 -4
- package/dist/cjs/db-tabs.cjs.entry.js +42 -8
- package/dist/cjs/db-textarea.cjs.entry.js +45 -10
- package/dist/cjs/db-tooltip.cjs.entry.js +144 -20
- package/dist/cjs/db-ux.cjs.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/accordion/accordion.js +45 -7
- package/dist/collection/components/accordion-item/accordion-item.js +48 -10
- package/dist/collection/components/badge/badge.js +45 -7
- package/dist/collection/components/brand/brand.js +43 -5
- package/dist/collection/components/button/button.js +43 -5
- package/dist/collection/components/card/card.js +43 -5
- package/dist/collection/components/checkbox/checkbox.js +47 -12
- package/dist/collection/components/custom-button/custom-button.js +43 -5
- package/dist/collection/components/custom-select/custom-select.js +62 -27
- package/dist/collection/components/custom-select-dropdown/custom-select-dropdown.js +41 -5
- package/dist/collection/components/custom-select-form-field/custom-select-form-field.js +43 -5
- package/dist/collection/components/custom-select-list/custom-select-list.js +43 -5
- package/dist/collection/components/custom-select-list-item/custom-select-list-item.js +37 -5
- package/dist/collection/components/divider/divider.js +42 -4
- package/dist/collection/components/drawer/drawer.js +47 -9
- package/dist/collection/components/header/header.js +45 -7
- package/dist/collection/components/icon/icon.js +43 -5
- package/dist/collection/components/infotext/infotext.js +43 -5
- package/dist/collection/components/input/input.js +49 -13
- package/dist/collection/components/link/link.js +43 -5
- package/dist/collection/components/navigation/navigation.js +43 -5
- package/dist/collection/components/navigation-item/navigation-item.js +48 -10
- package/dist/collection/components/notification/notification.js +43 -5
- package/dist/collection/components/page/page.js +50 -14
- package/dist/collection/components/popover/popover.js +45 -7
- package/dist/collection/components/radio/radio.js +44 -9
- package/dist/collection/components/section/section.js +43 -5
- package/dist/collection/components/select/select.js +47 -12
- package/dist/collection/components/stack/stack.js +43 -5
- package/dist/collection/components/switch/switch.js +47 -12
- package/dist/collection/components/tab-item/tab-item.js +45 -10
- package/dist/collection/components/tab-list/tab-list.js +43 -5
- package/dist/collection/components/tab-panel/tab-panel.js +48 -5
- package/dist/collection/components/table/table.js +37 -5
- package/dist/collection/components/table-body/table-body.js +9 -4
- package/dist/collection/components/table-caption/table-caption.js +43 -5
- package/dist/collection/components/table-data-cell/table-data-cell.js +10 -5
- package/dist/collection/components/table-footer/table-footer.js +9 -4
- package/dist/collection/components/table-head/table-head.js +42 -4
- package/dist/collection/components/table-header-cell/table-header-cell.js +10 -5
- package/dist/collection/components/table-row/table-row.js +9 -4
- package/dist/collection/components/tabs/tabs.js +44 -9
- package/dist/collection/components/tag/tag.js +43 -5
- package/dist/collection/components/textarea/textarea.js +47 -11
- package/dist/collection/components/tooltip/tooltip.js +150 -21
- package/dist/custom-elements.json +710 -0
- package/dist/db-ux/db-ux.esm.js +1 -1
- package/dist/db-ux/p-0123ee1b.entry.js +1 -0
- package/dist/db-ux/p-090b1797.entry.js +1 -0
- package/dist/db-ux/p-0e17c5a0.entry.js +1 -0
- package/dist/db-ux/p-194e851c.entry.js +1 -0
- package/dist/db-ux/p-281f5e3e.entry.js +1 -0
- package/dist/db-ux/p-2ae377e6.entry.js +1 -0
- package/dist/db-ux/p-2cf4345f.entry.js +1 -0
- package/dist/db-ux/p-2e6c8304.entry.js +1 -0
- package/dist/db-ux/p-335391d4.entry.js +1 -0
- package/dist/db-ux/p-34235204.entry.js +1 -0
- package/dist/db-ux/p-3569bb3c.entry.js +1 -0
- package/dist/db-ux/p-398f9165.entry.js +1 -0
- package/dist/db-ux/p-5070470f.entry.js +1 -0
- package/dist/db-ux/p-5e08712d.entry.js +1 -0
- package/dist/db-ux/p-63d98f9d.entry.js +1 -0
- package/dist/db-ux/p-6aa92091.entry.js +1 -0
- package/dist/db-ux/p-78b7e6f6.entry.js +1 -0
- package/dist/db-ux/p-7ca4bc82.entry.js +1 -0
- package/dist/db-ux/p-8f989150.entry.js +1 -0
- package/dist/db-ux/p-8fa7a578.entry.js +1 -0
- package/dist/db-ux/p-91052c75.entry.js +1 -0
- package/dist/db-ux/p-9ccd42b1.entry.js +1 -0
- package/dist/db-ux/p-a4d9f6e2.entry.js +1 -0
- package/dist/db-ux/p-af248e57.entry.js +1 -0
- package/dist/db-ux/p-ba82a0b0.entry.js +1 -0
- package/dist/db-ux/p-c2ce6ecd.entry.js +1 -0
- package/dist/db-ux/p-d7b5748d.entry.js +1 -0
- package/dist/db-ux/p-dfbbe502.entry.js +1 -0
- package/dist/db-ux/p-e7a400a2.entry.js +1 -0
- package/dist/db-ux/p-ef1aa878.entry.js +1 -0
- package/dist/db-ux/p-f1daaefa.entry.js +1 -0
- package/dist/db-ux/p-f6312d2c.entry.js +1 -0
- package/dist/db-ux/p-fbf09569.entry.js +1 -0
- package/dist/db-ux/p-ff11c071.entry.js +1 -0
- package/dist/esm/db-accordion-item.entry.js +46 -9
- package/dist/esm/db-accordion.entry.js +43 -6
- package/dist/esm/db-badge.entry.js +43 -6
- package/dist/esm/db-brand.entry.js +36 -5
- package/dist/esm/db-button.entry.js +36 -5
- package/dist/esm/db-card.entry.js +36 -5
- package/dist/esm/db-checkbox.entry.js +45 -11
- package/dist/esm/db-custom-button.entry.js +36 -5
- package/dist/esm/db-custom-select-dropdown_5.entry.js +190 -31
- package/dist/esm/db-custom-select-form-field.entry.js +36 -5
- package/dist/esm/db-custom-select.entry.js +60 -26
- package/dist/esm/db-divider.entry.js +35 -4
- package/dist/esm/db-drawer.entry.js +45 -8
- package/dist/esm/db-header.entry.js +43 -6
- package/dist/esm/db-icon.entry.js +36 -5
- package/dist/esm/db-infotext.entry.js +36 -5
- package/dist/esm/db-link_4.entry.js +65 -19
- package/dist/esm/db-navigation-item.entry.js +47 -10
- package/dist/esm/db-navigation.entry.js +36 -5
- package/dist/esm/db-notification.entry.js +36 -5
- package/dist/esm/db-page.entry.js +48 -13
- package/dist/esm/db-popover.entry.js +43 -6
- package/dist/esm/db-radio.entry.js +42 -8
- package/dist/esm/db-section.entry.js +36 -5
- package/dist/esm/db-select.entry.js +45 -11
- package/dist/esm/db-stack.entry.js +36 -5
- package/dist/esm/db-switch.entry.js +45 -11
- package/dist/esm/db-tab-item_3.entry.js +118 -19
- package/dist/esm/db-table-body_3.entry.js +53 -12
- package/dist/esm/db-table-caption.entry.js +36 -5
- package/dist/esm/db-table.entry.js +35 -4
- package/dist/esm/db-tabs.entry.js +43 -9
- package/dist/esm/db-textarea.entry.js +45 -10
- package/dist/esm/db-tooltip.entry.js +144 -20
- package/dist/esm/db-ux.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/types/components/accordion/accordion.d.ts +3 -0
- package/dist/types/components/accordion-item/accordion-item.d.ts +3 -0
- package/dist/types/components/badge/badge.d.ts +3 -0
- package/dist/types/components/brand/brand.d.ts +3 -0
- package/dist/types/components/button/button.d.ts +3 -0
- package/dist/types/components/card/card.d.ts +3 -0
- package/dist/types/components/checkbox/checkbox.d.ts +2 -0
- package/dist/types/components/custom-button/custom-button.d.ts +3 -0
- package/dist/types/components/custom-select/custom-select.d.ts +2 -0
- package/dist/types/components/custom-select-dropdown/custom-select-dropdown.d.ts +3 -0
- package/dist/types/components/custom-select-form-field/custom-select-form-field.d.ts +3 -0
- package/dist/types/components/custom-select-list/custom-select-list.d.ts +3 -0
- package/dist/types/components/custom-select-list-item/custom-select-list-item.d.ts +3 -0
- package/dist/types/components/divider/divider.d.ts +3 -0
- package/dist/types/components/drawer/drawer.d.ts +3 -0
- package/dist/types/components/header/header.d.ts +3 -0
- package/dist/types/components/icon/icon.d.ts +3 -0
- package/dist/types/components/infotext/infotext.d.ts +3 -0
- package/dist/types/components/input/input.d.ts +2 -0
- package/dist/types/components/link/link.d.ts +3 -0
- package/dist/types/components/navigation/navigation.d.ts +3 -0
- package/dist/types/components/navigation-item/navigation-item.d.ts +3 -0
- package/dist/types/components/notification/notification.d.ts +3 -0
- package/dist/types/components/page/page.d.ts +2 -0
- package/dist/types/components/popover/popover.d.ts +3 -0
- package/dist/types/components/radio/radio.d.ts +2 -0
- package/dist/types/components/section/section.d.ts +3 -0
- package/dist/types/components/select/select.d.ts +2 -0
- package/dist/types/components/stack/stack.d.ts +3 -0
- package/dist/types/components/switch/switch.d.ts +2 -0
- package/dist/types/components/tab-item/tab-item.d.ts +2 -0
- package/dist/types/components/tab-list/tab-list.d.ts +3 -0
- package/dist/types/components/tab-panel/tab-panel.d.ts +3 -0
- package/dist/types/components/table/table.d.ts +3 -0
- package/dist/types/components/table-caption/table-caption.d.ts +3 -0
- package/dist/types/components/table-head/table-head.d.ts +3 -0
- package/dist/types/components/tabs/tabs.d.ts +2 -0
- package/dist/types/components/tag/tag.d.ts +3 -0
- package/dist/types/components/textarea/textarea.d.ts +2 -0
- package/dist/types/components/tooltip/model.d.ts +9 -0
- package/dist/types/components/tooltip/tooltip.d.ts +8 -0
- package/dist/web-types.json +84 -40
- package/package.json +6 -6
- package/bundle/p-B5ANMEnQ.js +0 -1
- package/bundle/p-BJwvv-yT.js +0 -1
- package/bundle/p-BNiKxu3y.js +0 -1
- package/bundle/p-B_bPnncM.js +0 -1
- package/bundle/p-BnLhi6Lz.js +0 -1
- package/bundle/p-BrBlnLrn.js +0 -1
- package/bundle/p-CByFfoSH.js +0 -1
- package/bundle/p-CQo0C7QE.js +0 -1
- package/bundle/p-CR2ZbfYe.js +0 -1
- package/bundle/p-CeDu282h.js +0 -1
- package/bundle/p-CfLPOLHz.js +0 -1
- package/bundle/p-CoOxyQb2.js +0 -1
- package/bundle/p-CqED0CfD.js +0 -1
- package/bundle/p-Cr_z1Jfi.js +0 -1
- package/bundle/p-D-XzX0R7.js +0 -1
- package/bundle/p-DMSIvqcA.js +0 -1
- package/bundle/p-DUiroUyR.js +0 -1
- package/bundle/p-DdyMClpj.js +0 -1
- package/bundle/p-DjVjS2Tb.js +0 -1
- package/bundle/p-in4Kv88F.js +0 -1
- package/dist/db-ux/p-08271c80.entry.js +0 -1
- package/dist/db-ux/p-105ffa74.entry.js +0 -1
- package/dist/db-ux/p-15adca91.entry.js +0 -1
- package/dist/db-ux/p-1a322a0c.entry.js +0 -1
- package/dist/db-ux/p-1f7232c0.entry.js +0 -1
- package/dist/db-ux/p-27e2f6f2.entry.js +0 -1
- package/dist/db-ux/p-2907f214.entry.js +0 -1
- package/dist/db-ux/p-2ff958e4.entry.js +0 -1
- package/dist/db-ux/p-3423b7af.entry.js +0 -1
- package/dist/db-ux/p-365e6edf.entry.js +0 -1
- package/dist/db-ux/p-42516007.entry.js +0 -1
- package/dist/db-ux/p-5045182c.entry.js +0 -1
- package/dist/db-ux/p-5e1d42e5.entry.js +0 -1
- package/dist/db-ux/p-61b28212.entry.js +0 -1
- package/dist/db-ux/p-6850a53c.entry.js +0 -1
- package/dist/db-ux/p-6bff55b4.entry.js +0 -1
- package/dist/db-ux/p-6e7c5e42.entry.js +0 -1
- package/dist/db-ux/p-76adf385.entry.js +0 -1
- package/dist/db-ux/p-78f7b353.entry.js +0 -1
- package/dist/db-ux/p-7fa5d304.entry.js +0 -1
- package/dist/db-ux/p-95b69e71.entry.js +0 -1
- package/dist/db-ux/p-99ebe6ec.entry.js +0 -1
- package/dist/db-ux/p-a5dc355d.entry.js +0 -1
- package/dist/db-ux/p-a6113789.entry.js +0 -1
- package/dist/db-ux/p-b9c0feaf.entry.js +0 -1
- package/dist/db-ux/p-c14fa91a.entry.js +0 -1
- package/dist/db-ux/p-c65b807e.entry.js +0 -1
- package/dist/db-ux/p-dd9cedbe.entry.js +0 -1
- package/dist/db-ux/p-e3f705fd.entry.js +0 -1
- package/dist/db-ux/p-e4cddc9f.entry.js +0 -1
- package/dist/db-ux/p-e7a8612c.entry.js +0 -1
- package/dist/db-ux/p-ee8c3243.entry.js +0 -1
- package/dist/db-ux/p-f0d0acfc.entry.js +0 -1
- package/dist/db-ux/p-f15748ea.entry.js +0 -1
|
@@ -7,6 +7,9 @@ import { h } from "@stencil/core";
|
|
|
7
7
|
* @slot link - TODO: Add description for slotLink
|
|
8
8
|
*/
|
|
9
9
|
export class DBNotification {
|
|
10
|
+
constructor() {
|
|
11
|
+
this.observer = undefined;
|
|
12
|
+
}
|
|
10
13
|
handleClose(event) {
|
|
11
14
|
if (!event)
|
|
12
15
|
return;
|
|
@@ -15,6 +18,26 @@ export class DBNotification {
|
|
|
15
18
|
this.close.emit(event);
|
|
16
19
|
}
|
|
17
20
|
}
|
|
21
|
+
setupObserver(element) {
|
|
22
|
+
if (!element)
|
|
23
|
+
return;
|
|
24
|
+
const parent = element.closest("db-notification");
|
|
25
|
+
if (!parent || this.observer)
|
|
26
|
+
return;
|
|
27
|
+
this.observer = new MutationObserver((mutations) => {
|
|
28
|
+
if (mutations.some((mutation) => {
|
|
29
|
+
var _a;
|
|
30
|
+
const attr = mutation.target.attributes.getNamedItem((_a = mutation.attributeName) !== null && _a !== void 0 ? _a : "");
|
|
31
|
+
return (attr === null || attr === void 0 ? void 0 : attr.value) !== mutation.oldValue;
|
|
32
|
+
})) {
|
|
33
|
+
this.enableAttributePassing(element, "db-notification");
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
this.observer.observe(parent, {
|
|
37
|
+
attributes: true,
|
|
38
|
+
attributeOldValue: true,
|
|
39
|
+
});
|
|
40
|
+
}
|
|
18
41
|
/**
|
|
19
42
|
* Passes `aria-*`, `data-*` & `class` attributes to correct child. Used in angular and stencil.
|
|
20
43
|
* @param element the ref for the component
|
|
@@ -28,10 +51,15 @@ export class DBNotification {
|
|
|
28
51
|
const attr = attributes.item(i);
|
|
29
52
|
if (attr && attr.name !== 'data-density' &&
|
|
30
53
|
(attr.name.startsWith("data-") || attr.name.startsWith("aria-"))) {
|
|
31
|
-
|
|
54
|
+
if (attr.value) {
|
|
55
|
+
element.setAttribute(attr.name, attr.value);
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
element.removeAttribute(attr.name);
|
|
59
|
+
}
|
|
32
60
|
parent.removeAttribute(attr.name);
|
|
33
61
|
}
|
|
34
|
-
else if (attr &&
|
|
62
|
+
else if (attr && ["style"].includes(attr.name)) {
|
|
35
63
|
element.setAttribute(attr.name, attr.value);
|
|
36
64
|
parent.removeAttribute(attr.name);
|
|
37
65
|
}
|
|
@@ -39,7 +67,7 @@ export class DBNotification {
|
|
|
39
67
|
const isWebComponent = attr.value.includes("hydrated");
|
|
40
68
|
const value = attr.value.replace("hydrated", "").trim();
|
|
41
69
|
const currentClass = element.getAttribute("class");
|
|
42
|
-
element.setAttribute(attr.name, `${currentClass ?
|
|
70
|
+
element.setAttribute(attr.name, `${currentClass ? currentClass : ""}${value ? ` ${value}` : ""}`);
|
|
43
71
|
if (isWebComponent) {
|
|
44
72
|
// Stencil is using this class for lazy loading component
|
|
45
73
|
parent.setAttribute("class", "hydrated");
|
|
@@ -59,16 +87,21 @@ export class DBNotification {
|
|
|
59
87
|
}
|
|
60
88
|
}
|
|
61
89
|
this.enableAttributePassing(this._ref, "db-notification");
|
|
90
|
+
this.setupObserver(this._ref);
|
|
91
|
+
}
|
|
92
|
+
disconnectedCallback() {
|
|
93
|
+
var _a;
|
|
94
|
+
(_a = this.observer) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
62
95
|
}
|
|
63
96
|
render() {
|
|
64
97
|
var _a, _b, _c;
|
|
65
|
-
return (h("div", { key: '
|
|
98
|
+
return (h("div", { key: '6700e43e45a2c0c18a0216fb12afd5d31820dcf9', class: cls("db-notification", this.className), ref: (el) => {
|
|
66
99
|
this._ref = el;
|
|
67
100
|
}, id: (_a = this.id) !== null && _a !== void 0 ? _a : (_b = this.propOverrides) === null || _b === void 0 ? void 0 : _b.id, role: getNotificationRole({
|
|
68
101
|
semantic: this.semantic,
|
|
69
102
|
role: this.role,
|
|
70
103
|
ariaLive: this.ariaLive,
|
|
71
|
-
}), "aria-live": this.ariaLive, "data-semantic": this.semantic, "data-variant": this.variant, "data-icon": getBoolean(this.showIcon) !== false ? this.icon : undefined, "data-show-icon": getBooleanAsString(this.showIcon, "showIcon"), "data-link-variant": this.linkVariant }, h("slot", { key: '
|
|
104
|
+
}), "aria-live": this.ariaLive, "data-semantic": this.semantic, "data-variant": this.variant, "data-icon": getBoolean(this.showIcon) !== false ? this.icon : undefined, "data-show-icon": getBooleanAsString(this.showIcon, "showIcon"), "data-link-variant": this.linkVariant }, h("slot", { key: '9ea4d9427f7e34dbf5fd9b187f4dce5df9b39d34', name: "image" }), stringPropVisible(this.headline, this.showHeadline) ? (h("header", { "data-area": "head" }, this.headline)) : null, h("div", { key: '4f9c9a95f7c6bd8f4b5bfb0acf69f02dbc789856', "data-area": "content" }, this.text ? this.text : null, h("slot", { key: '2d9007bdc99c163fd6af4b12cc7210b60ab11319' })), stringPropVisible(this.timestamp, this.showTimestamp) ? (h("time", { "data-area": "timestamp", dateTime: this.timestampDatetime }, this.timestamp)) : null, h("slot", { key: 'f5505f81bdf36d9dd1aeb825a2af06dcd0214372', name: "link" }), getBoolean(this.closeable, "closeable") ? (h("db-button", { icon: "cross", variant: "ghost", size: "small", id: this.closeButtonId, noText: true, onClick: (event) => this.handleClose(event) }, (_c = this.closeButtonText) !== null && _c !== void 0 ? _c : DEFAULT_CLOSE_BUTTON)) : null));
|
|
72
105
|
}
|
|
73
106
|
static get is() { return "db-notification"; }
|
|
74
107
|
static get properties() {
|
|
@@ -567,6 +600,11 @@ export class DBNotification {
|
|
|
567
600
|
}
|
|
568
601
|
};
|
|
569
602
|
}
|
|
603
|
+
static get states() {
|
|
604
|
+
return {
|
|
605
|
+
"observer": {}
|
|
606
|
+
};
|
|
607
|
+
}
|
|
570
608
|
static get events() {
|
|
571
609
|
return [{
|
|
572
610
|
"method": "close",
|
|
@@ -8,6 +8,27 @@ import { h } from "@stencil/core";
|
|
|
8
8
|
export class DBPage {
|
|
9
9
|
constructor() {
|
|
10
10
|
this.fontsLoaded = false;
|
|
11
|
+
this.observer = undefined;
|
|
12
|
+
}
|
|
13
|
+
setupObserver(element) {
|
|
14
|
+
if (!element)
|
|
15
|
+
return;
|
|
16
|
+
const parent = element.closest("db-page");
|
|
17
|
+
if (!parent || this.observer)
|
|
18
|
+
return;
|
|
19
|
+
this.observer = new MutationObserver((mutations) => {
|
|
20
|
+
if (mutations.some((mutation) => {
|
|
21
|
+
var _a;
|
|
22
|
+
const attr = mutation.target.attributes.getNamedItem((_a = mutation.attributeName) !== null && _a !== void 0 ? _a : "");
|
|
23
|
+
return (attr === null || attr === void 0 ? void 0 : attr.value) !== mutation.oldValue;
|
|
24
|
+
})) {
|
|
25
|
+
this.enableAttributePassing(element, "db-page");
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
this.observer.observe(parent, {
|
|
29
|
+
attributes: true,
|
|
30
|
+
attributeOldValue: true,
|
|
31
|
+
});
|
|
11
32
|
}
|
|
12
33
|
/**
|
|
13
34
|
* Passes `aria-*`, `data-*` & `class` attributes to correct child. Used in angular and stencil.
|
|
@@ -22,10 +43,15 @@ export class DBPage {
|
|
|
22
43
|
const attr = attributes.item(i);
|
|
23
44
|
if (attr && attr.name !== 'data-density' &&
|
|
24
45
|
(attr.name.startsWith("data-") || attr.name.startsWith("aria-"))) {
|
|
25
|
-
|
|
46
|
+
if (attr.value) {
|
|
47
|
+
element.setAttribute(attr.name, attr.value);
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
element.removeAttribute(attr.name);
|
|
51
|
+
}
|
|
26
52
|
parent.removeAttribute(attr.name);
|
|
27
53
|
}
|
|
28
|
-
else if (attr &&
|
|
54
|
+
else if (attr && ["style"].includes(attr.name)) {
|
|
29
55
|
element.setAttribute(attr.name, attr.value);
|
|
30
56
|
parent.removeAttribute(attr.name);
|
|
31
57
|
}
|
|
@@ -33,7 +59,7 @@ export class DBPage {
|
|
|
33
59
|
const isWebComponent = attr.value.includes("hydrated");
|
|
34
60
|
const value = attr.value.replace("hydrated", "").trim();
|
|
35
61
|
const currentClass = element.getAttribute("class");
|
|
36
|
-
element.setAttribute(attr.name, `${currentClass ?
|
|
62
|
+
element.setAttribute(attr.name, `${currentClass ? currentClass : ""}${value ? ` ${value}` : ""}`);
|
|
37
63
|
if (isWebComponent) {
|
|
38
64
|
// Stencil is using this class for lazy loading component
|
|
39
65
|
parent.setAttribute("class", "hydrated");
|
|
@@ -53,28 +79,37 @@ export class DBPage {
|
|
|
53
79
|
}
|
|
54
80
|
}
|
|
55
81
|
this.enableAttributePassing(this._ref, "db-page");
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
document.
|
|
82
|
+
const onMountHook_0 = () => {
|
|
83
|
+
this.fontsLoaded = !this.fadeIn;
|
|
84
|
+
if (document && this.fadeIn) {
|
|
85
|
+
document.fonts.ready.then(() => {
|
|
86
|
+
this.fontsLoaded = true;
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
59
90
|
this.fontsLoaded = true;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
onMountHook_0();
|
|
94
|
+
const onMountHook_1 = () => {
|
|
95
|
+
this.setupObserver(this._ref);
|
|
96
|
+
};
|
|
97
|
+
onMountHook_1();
|
|
65
98
|
}
|
|
66
99
|
disconnectedCallback() {
|
|
100
|
+
var _a;
|
|
67
101
|
if (typeof window !== "undefined" &&
|
|
68
102
|
document.documentElement.classList.contains("db-page-document")) {
|
|
69
103
|
// remove document styles set by this
|
|
70
104
|
document.documentElement.classList.remove("db-page-document");
|
|
71
105
|
}
|
|
106
|
+
(_a = this.observer) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
72
107
|
}
|
|
73
108
|
render() {
|
|
74
109
|
var _a, _b;
|
|
75
|
-
return (h("div", { key: '
|
|
110
|
+
return (h("div", { key: '0d09488c8caa9ca9fbd1fa55e9ba913b10510b2a', class: cls("db-page", this.className), ref: (el) => {
|
|
76
111
|
this._ref = el;
|
|
77
|
-
}, id: (_a = this.id) !== null && _a !== void 0 ? _a : (_b = this.propOverrides) === null || _b === void 0 ? void 0 : _b.id, "data-variant": this.variant, "data-fade-in": getBooleanAsString(this.fadeIn, "fadeIn"), "data-fonts-loaded": getBooleanAsString(this.fontsLoaded, "fontsLoaded") }, h("slot", { key: '
|
|
112
|
+
}, id: (_a = this.id) !== null && _a !== void 0 ? _a : (_b = this.propOverrides) === null || _b === void 0 ? void 0 : _b.id, "data-variant": this.variant, "data-fade-in": getBooleanAsString(this.fadeIn, "fadeIn"), "data-fonts-loaded": getBooleanAsString(this.fontsLoaded, "fontsLoaded") }, h("slot", { key: '667a0153fca3111a897356f90110aa6d5e068171', name: "header" }), h("main", { key: '92184cba49dc26836ed103d2254b5c319df29832', class: cls("db-main", this.mainClass) }, h("slot", { key: '2d4d37de47023d7fc1dfb321f64d92c90c9b80b8' })), h("slot", { key: 'fb7fb41cbdfdf8e722aa9dde7080379a8083cf45', name: "footer" })));
|
|
78
113
|
}
|
|
79
114
|
static get is() { return "db-page"; }
|
|
80
115
|
static get properties() {
|
|
@@ -263,7 +298,8 @@ export class DBPage {
|
|
|
263
298
|
}
|
|
264
299
|
static get states() {
|
|
265
300
|
return {
|
|
266
|
-
"fontsLoaded": {}
|
|
301
|
+
"fontsLoaded": {},
|
|
302
|
+
"observer": {}
|
|
267
303
|
};
|
|
268
304
|
}
|
|
269
305
|
static get elementRef() { return "rootElement"; }
|
|
@@ -12,6 +12,7 @@ export class DBPopover {
|
|
|
12
12
|
this.isExpanded = false;
|
|
13
13
|
this._documentScrollListenerCallbackId = undefined;
|
|
14
14
|
this._observer = undefined;
|
|
15
|
+
this.observer = undefined;
|
|
15
16
|
}
|
|
16
17
|
handleEscape(event) {
|
|
17
18
|
if (!event || event.key === "Escape") {
|
|
@@ -87,6 +88,26 @@ export class DBPopover {
|
|
|
87
88
|
}
|
|
88
89
|
return null;
|
|
89
90
|
}
|
|
91
|
+
setupObserver(element) {
|
|
92
|
+
if (!element)
|
|
93
|
+
return;
|
|
94
|
+
const parent = element.closest("db-popover");
|
|
95
|
+
if (!parent || this.observer)
|
|
96
|
+
return;
|
|
97
|
+
this.observer = new MutationObserver((mutations) => {
|
|
98
|
+
if (mutations.some((mutation) => {
|
|
99
|
+
var _a;
|
|
100
|
+
const attr = mutation.target.attributes.getNamedItem((_a = mutation.attributeName) !== null && _a !== void 0 ? _a : "");
|
|
101
|
+
return (attr === null || attr === void 0 ? void 0 : attr.value) !== mutation.oldValue;
|
|
102
|
+
})) {
|
|
103
|
+
this.enableAttributePassing(element, "db-popover");
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
this.observer.observe(parent, {
|
|
107
|
+
attributes: true,
|
|
108
|
+
attributeOldValue: true,
|
|
109
|
+
});
|
|
110
|
+
}
|
|
90
111
|
/**
|
|
91
112
|
* Passes `aria-*`, `data-*` & `class` attributes to correct child. Used in angular and stencil.
|
|
92
113
|
* @param element the ref for the component
|
|
@@ -100,10 +121,15 @@ export class DBPopover {
|
|
|
100
121
|
const attr = attributes.item(i);
|
|
101
122
|
if (attr && attr.name !== 'data-density' &&
|
|
102
123
|
(attr.name.startsWith("data-") || attr.name.startsWith("aria-"))) {
|
|
103
|
-
|
|
124
|
+
if (attr.value) {
|
|
125
|
+
element.setAttribute(attr.name, attr.value);
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
element.removeAttribute(attr.name);
|
|
129
|
+
}
|
|
104
130
|
parent.removeAttribute(attr.name);
|
|
105
131
|
}
|
|
106
|
-
else if (attr &&
|
|
132
|
+
else if (attr && ["style"].includes(attr.name)) {
|
|
107
133
|
element.setAttribute(attr.name, attr.value);
|
|
108
134
|
parent.removeAttribute(attr.name);
|
|
109
135
|
}
|
|
@@ -111,7 +137,7 @@ export class DBPopover {
|
|
|
111
137
|
const isWebComponent = attr.value.includes("hydrated");
|
|
112
138
|
const value = attr.value.replace("hydrated", "").trim();
|
|
113
139
|
const currentClass = element.getAttribute("class");
|
|
114
|
-
element.setAttribute(attr.name, `${currentClass ?
|
|
140
|
+
element.setAttribute(attr.name, `${currentClass ? currentClass : ""}${value ? ` ${value}` : ""}`);
|
|
115
141
|
if (isWebComponent) {
|
|
116
142
|
// Stencil is using this class for lazy loading component
|
|
117
143
|
parent.setAttribute("class", "hydrated");
|
|
@@ -170,15 +196,26 @@ export class DBPopover {
|
|
|
170
196
|
}
|
|
171
197
|
}
|
|
172
198
|
this.enableAttributePassing(this._ref, "db-popover");
|
|
173
|
-
|
|
199
|
+
const onMountHook_0 = () => {
|
|
200
|
+
this.initialized = true;
|
|
201
|
+
};
|
|
202
|
+
onMountHook_0();
|
|
203
|
+
const onMountHook_1 = () => {
|
|
204
|
+
this.setupObserver(this._ref);
|
|
205
|
+
};
|
|
206
|
+
onMountHook_1();
|
|
174
207
|
this.watch0Fn();
|
|
175
208
|
this.watch1Fn();
|
|
176
209
|
}
|
|
210
|
+
disconnectedCallback() {
|
|
211
|
+
var _a;
|
|
212
|
+
(_a = this.observer) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
213
|
+
}
|
|
177
214
|
render() {
|
|
178
215
|
var _a, _b, _c;
|
|
179
|
-
return (h("div", { key: '
|
|
216
|
+
return (h("div", { key: '09a8f5d4aedc314e07a184c3e41d232073b4ffc9', class: cls("db-popover", this.className), ref: (el) => {
|
|
180
217
|
this._ref = el;
|
|
181
|
-
}, id: (_a = this.id) !== null && _a !== void 0 ? _a : (_b = this.propOverrides) === null || _b === void 0 ? void 0 : _b.id }, h("slot", { key: '
|
|
218
|
+
}, id: (_a = this.id) !== null && _a !== void 0 ? _a : (_b = this.propOverrides) === null || _b === void 0 ? void 0 : _b.id }, h("slot", { key: 'eeee6e2e8d94272e91d275fb6799c7f781f8210a', name: "trigger" }), h("article", { key: 'cbbdd13d730291ec06059334c47be4c4bb8ffa71', class: "db-popover-content", "data-spacing": this.spacing, "data-gap": getBooleanAsString(this.gap, "gap"), "data-animation": getBooleanAsString((_c = this.animation) !== null && _c !== void 0 ? _c : true, "animation"), "data-open": getBooleanAsString(this.open, "open"), "data-delay": this.delay, "data-width": this.width, "data-placement": this.placement }, h("slot", { key: '7ae19bc9f8ba3130c107fcf826a8ca9bcf8d9f88' }))));
|
|
182
219
|
}
|
|
183
220
|
static get is() { return "db-popover"; }
|
|
184
221
|
static get properties() {
|
|
@@ -448,7 +485,8 @@ export class DBPopover {
|
|
|
448
485
|
"initialized": {},
|
|
449
486
|
"isExpanded": {},
|
|
450
487
|
"_documentScrollListenerCallbackId": {},
|
|
451
|
-
"_observer": {}
|
|
488
|
+
"_observer": {},
|
|
489
|
+
"observer": {}
|
|
452
490
|
};
|
|
453
491
|
}
|
|
454
492
|
static get elementRef() { return "rootElement"; }
|
|
@@ -10,6 +10,7 @@ export class DBRadio {
|
|
|
10
10
|
this.initialized = false;
|
|
11
11
|
this._id = undefined;
|
|
12
12
|
this.abortController = undefined;
|
|
13
|
+
this.observer = undefined;
|
|
13
14
|
}
|
|
14
15
|
handleInput(event, reset) {
|
|
15
16
|
if (this.input) {
|
|
@@ -35,6 +36,26 @@ export class DBRadio {
|
|
|
35
36
|
var _a, _b, _c;
|
|
36
37
|
this._id = (_c = (_a = this.id) !== null && _a !== void 0 ? _a : (_b = this.propOverrides) === null || _b === void 0 ? void 0 : _b.id) !== null && _c !== void 0 ? _c : `radio-${uuid()}`;
|
|
37
38
|
}
|
|
39
|
+
setupObserver(element) {
|
|
40
|
+
if (!element)
|
|
41
|
+
return;
|
|
42
|
+
const parent = element.closest("db-radio");
|
|
43
|
+
if (!parent || this.observer)
|
|
44
|
+
return;
|
|
45
|
+
this.observer = new MutationObserver((mutations) => {
|
|
46
|
+
if (mutations.some((mutation) => {
|
|
47
|
+
var _a;
|
|
48
|
+
const attr = mutation.target.attributes.getNamedItem((_a = mutation.attributeName) !== null && _a !== void 0 ? _a : "");
|
|
49
|
+
return (attr === null || attr === void 0 ? void 0 : attr.value) !== mutation.oldValue;
|
|
50
|
+
})) {
|
|
51
|
+
this.enableAttributePassing(element, "db-radio");
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
this.observer.observe(parent, {
|
|
55
|
+
attributes: true,
|
|
56
|
+
attributeOldValue: true,
|
|
57
|
+
});
|
|
58
|
+
}
|
|
38
59
|
/**
|
|
39
60
|
* Passes `aria-*`, `data-*` & `class` attributes to correct child. Used in angular and stencil.
|
|
40
61
|
* @param element the ref for the component
|
|
@@ -48,10 +69,15 @@ export class DBRadio {
|
|
|
48
69
|
const attr = attributes.item(i);
|
|
49
70
|
if (attr && attr.name !== 'data-density' &&
|
|
50
71
|
(attr.name.startsWith("data-") || attr.name.startsWith("aria-"))) {
|
|
51
|
-
|
|
72
|
+
if (attr.value) {
|
|
73
|
+
element.setAttribute(attr.name, attr.value);
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
element.removeAttribute(attr.name);
|
|
77
|
+
}
|
|
52
78
|
parent.removeAttribute(attr.name);
|
|
53
79
|
}
|
|
54
|
-
else if (attr &&
|
|
80
|
+
else if (attr && ["style"].includes(attr.name)) {
|
|
55
81
|
element.setAttribute(attr.name, attr.value);
|
|
56
82
|
parent.removeAttribute(attr.name);
|
|
57
83
|
}
|
|
@@ -59,7 +85,7 @@ export class DBRadio {
|
|
|
59
85
|
const isWebComponent = attr.value.includes("hydrated");
|
|
60
86
|
const value = attr.value.replace("hydrated", "").trim();
|
|
61
87
|
const currentClass = element.getAttribute("class");
|
|
62
|
-
element.setAttribute(attr.name, `${currentClass ?
|
|
88
|
+
element.setAttribute(attr.name, `${currentClass ? currentClass : ""}${value ? ` ${value}` : ""}`);
|
|
63
89
|
if (isWebComponent) {
|
|
64
90
|
// Stencil is using this class for lazy loading component
|
|
65
91
|
parent.setAttribute("class", "hydrated");
|
|
@@ -121,20 +147,28 @@ export class DBRadio {
|
|
|
121
147
|
}
|
|
122
148
|
}
|
|
123
149
|
this.enableAttributePassing(this._ref, "db-radio");
|
|
124
|
-
|
|
125
|
-
|
|
150
|
+
const onMountHook_0 = () => {
|
|
151
|
+
this.initialized = true;
|
|
152
|
+
this.resetIds();
|
|
153
|
+
};
|
|
154
|
+
onMountHook_0();
|
|
155
|
+
const onMountHook_1 = () => {
|
|
156
|
+
this.setupObserver(this._ref);
|
|
157
|
+
};
|
|
158
|
+
onMountHook_1();
|
|
126
159
|
this.watch0Fn();
|
|
127
160
|
this.watch1Fn();
|
|
128
161
|
this.watch2Fn();
|
|
129
162
|
}
|
|
130
163
|
disconnectedCallback() {
|
|
131
|
-
var _a;
|
|
164
|
+
var _a, _b;
|
|
132
165
|
(_a = this.abortController) === null || _a === void 0 ? void 0 : _a.abort();
|
|
166
|
+
(_b = this.observer) === null || _b === void 0 ? void 0 : _b.disconnect();
|
|
133
167
|
}
|
|
134
168
|
render() {
|
|
135
|
-
return (h("label", { key: '
|
|
169
|
+
return (h("label", { key: '85734ed463718801789a9dea9c0febcc4c2e8266', class: cls("db-radio", this.className), "data-size": this.size, "data-hide-label": getHideProp(this.showLabel), "data-hide-asterisk": getHideProp(this.showRequiredAsterisk), htmlFor: this._id }, h("input", { key: '7906add8b0074893bbffaaa0963284de1f89836c', type: "radio", "aria-invalid": this.validation === "invalid", "data-custom-validity": this.validation, ref: (el) => {
|
|
136
170
|
this._ref = el;
|
|
137
|
-
}, id: this._id, name: this.name, checked: getBoolean(this.checked, "checked"), disabled: getBoolean(this.disabled, "disabled"), value: this.value, required: getBoolean(this.required, "required"), onInput: (event) => this.handleInput(event), onChange: (event) => this.handleChange(event), onBlur: (event) => this.handleBlur(event), onFocus: (event) => this.handleFocus(event) }), this.label ? this.label : null, h("slot", { key: '
|
|
171
|
+
}, id: this._id, name: this.name, checked: getBoolean(this.checked, "checked"), disabled: getBoolean(this.disabled, "disabled"), value: this.value, required: getBoolean(this.required, "required"), onInput: (event) => this.handleInput(event), onChange: (event) => this.handleChange(event), onBlur: (event) => this.handleBlur(event), onFocus: (event) => this.handleFocus(event) }), this.label ? this.label : null, h("slot", { key: '7c35400883fd27d67bb2932cd646492fe137ccd9' })));
|
|
138
172
|
}
|
|
139
173
|
static get is() { return "db-radio"; }
|
|
140
174
|
static get properties() {
|
|
@@ -481,7 +515,8 @@ export class DBRadio {
|
|
|
481
515
|
return {
|
|
482
516
|
"initialized": {},
|
|
483
517
|
"_id": {},
|
|
484
|
-
"abortController": {}
|
|
518
|
+
"abortController": {},
|
|
519
|
+
"observer": {}
|
|
485
520
|
};
|
|
486
521
|
}
|
|
487
522
|
static get events() {
|
|
@@ -5,6 +5,29 @@ import { h } from "@stencil/core";
|
|
|
5
5
|
|
|
6
6
|
*/
|
|
7
7
|
export class DBSection {
|
|
8
|
+
constructor() {
|
|
9
|
+
this.observer = undefined;
|
|
10
|
+
}
|
|
11
|
+
setupObserver(element) {
|
|
12
|
+
if (!element)
|
|
13
|
+
return;
|
|
14
|
+
const parent = element.closest("db-section");
|
|
15
|
+
if (!parent || this.observer)
|
|
16
|
+
return;
|
|
17
|
+
this.observer = new MutationObserver((mutations) => {
|
|
18
|
+
if (mutations.some((mutation) => {
|
|
19
|
+
var _a;
|
|
20
|
+
const attr = mutation.target.attributes.getNamedItem((_a = mutation.attributeName) !== null && _a !== void 0 ? _a : "");
|
|
21
|
+
return (attr === null || attr === void 0 ? void 0 : attr.value) !== mutation.oldValue;
|
|
22
|
+
})) {
|
|
23
|
+
this.enableAttributePassing(element, "db-section");
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
this.observer.observe(parent, {
|
|
27
|
+
attributes: true,
|
|
28
|
+
attributeOldValue: true,
|
|
29
|
+
});
|
|
30
|
+
}
|
|
8
31
|
/**
|
|
9
32
|
* Passes `aria-*`, `data-*` & `class` attributes to correct child. Used in angular and stencil.
|
|
10
33
|
* @param element the ref for the component
|
|
@@ -18,10 +41,15 @@ export class DBSection {
|
|
|
18
41
|
const attr = attributes.item(i);
|
|
19
42
|
if (attr && attr.name !== 'data-density' &&
|
|
20
43
|
(attr.name.startsWith("data-") || attr.name.startsWith("aria-"))) {
|
|
21
|
-
|
|
44
|
+
if (attr.value) {
|
|
45
|
+
element.setAttribute(attr.name, attr.value);
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
element.removeAttribute(attr.name);
|
|
49
|
+
}
|
|
22
50
|
parent.removeAttribute(attr.name);
|
|
23
51
|
}
|
|
24
|
-
else if (attr &&
|
|
52
|
+
else if (attr && ["style"].includes(attr.name)) {
|
|
25
53
|
element.setAttribute(attr.name, attr.value);
|
|
26
54
|
parent.removeAttribute(attr.name);
|
|
27
55
|
}
|
|
@@ -29,7 +57,7 @@ export class DBSection {
|
|
|
29
57
|
const isWebComponent = attr.value.includes("hydrated");
|
|
30
58
|
const value = attr.value.replace("hydrated", "").trim();
|
|
31
59
|
const currentClass = element.getAttribute("class");
|
|
32
|
-
element.setAttribute(attr.name, `${currentClass ?
|
|
60
|
+
element.setAttribute(attr.name, `${currentClass ? currentClass : ""}${value ? ` ${value}` : ""}`);
|
|
33
61
|
if (isWebComponent) {
|
|
34
62
|
// Stencil is using this class for lazy loading component
|
|
35
63
|
parent.setAttribute("class", "hydrated");
|
|
@@ -49,12 +77,17 @@ export class DBSection {
|
|
|
49
77
|
}
|
|
50
78
|
}
|
|
51
79
|
this.enableAttributePassing(this._ref, "db-section");
|
|
80
|
+
this.setupObserver(this._ref);
|
|
81
|
+
}
|
|
82
|
+
disconnectedCallback() {
|
|
83
|
+
var _a;
|
|
84
|
+
(_a = this.observer) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
52
85
|
}
|
|
53
86
|
render() {
|
|
54
87
|
var _a, _b;
|
|
55
|
-
return (h("section", { key: '
|
|
88
|
+
return (h("section", { key: 'e33119ea38ff1f66b56792cb1a5a57e47d87d370', class: cls("db-section", this.className), ref: (el) => {
|
|
56
89
|
this._ref = el;
|
|
57
|
-
}, id: (_a = this.id) !== null && _a !== void 0 ? _a : (_b = this.propOverrides) === null || _b === void 0 ? void 0 : _b.id, "data-spacing": this.spacing || "medium", "data-width": this.width }, h("slot", { key: '
|
|
90
|
+
}, id: (_a = this.id) !== null && _a !== void 0 ? _a : (_b = this.propOverrides) === null || _b === void 0 ? void 0 : _b.id, "data-spacing": this.spacing || "medium", "data-width": this.width }, h("slot", { key: '0ac9622c130f2a896b334e65025f16365fe50ea5' })));
|
|
58
91
|
}
|
|
59
92
|
static get is() { return "db-section"; }
|
|
60
93
|
static get properties() {
|
|
@@ -189,5 +222,10 @@ export class DBSection {
|
|
|
189
222
|
}
|
|
190
223
|
};
|
|
191
224
|
}
|
|
225
|
+
static get states() {
|
|
226
|
+
return {
|
|
227
|
+
"observer": {}
|
|
228
|
+
};
|
|
229
|
+
}
|
|
192
230
|
static get elementRef() { return "rootElement"; }
|
|
193
231
|
}
|
|
@@ -19,6 +19,7 @@ export class DBSelect {
|
|
|
19
19
|
this.initialized = false;
|
|
20
20
|
this._voiceOverFallback = "";
|
|
21
21
|
this.abortController = undefined;
|
|
22
|
+
this.observer = undefined;
|
|
22
23
|
}
|
|
23
24
|
hasValidState() {
|
|
24
25
|
var _a;
|
|
@@ -35,7 +36,7 @@ export class DBSelect {
|
|
|
35
36
|
DEFAULT_INVALID_MESSAGE;
|
|
36
37
|
if (hasVoiceOver()) {
|
|
37
38
|
this._voiceOverFallback = this._invalidMessage;
|
|
38
|
-
delay(() => (this._voiceOverFallback = ""), 1000);
|
|
39
|
+
void delay(() => (this._voiceOverFallback = ""), 1000);
|
|
39
40
|
}
|
|
40
41
|
}
|
|
41
42
|
else if (this.hasValidState() &&
|
|
@@ -44,7 +45,7 @@ export class DBSelect {
|
|
|
44
45
|
this._descByIds = this._validMessageId;
|
|
45
46
|
if (hasVoiceOver()) {
|
|
46
47
|
this._voiceOverFallback = (_d = this.validMessage) !== null && _d !== void 0 ? _d : DEFAULT_VALID_MESSAGE;
|
|
47
|
-
delay(() => (this._voiceOverFallback = ""), 1000);
|
|
48
|
+
void delay(() => (this._voiceOverFallback = ""), 1000);
|
|
48
49
|
}
|
|
49
50
|
}
|
|
50
51
|
else if (stringPropVisible(this.message, this.showMessage)) {
|
|
@@ -108,6 +109,26 @@ export class DBSelect {
|
|
|
108
109
|
this._invalidMessageId = mId + DEFAULT_INVALID_MESSAGE_ID_SUFFIX;
|
|
109
110
|
this._placeholderId = mId + DEFAULT_PLACEHOLDER_ID_SUFFIX;
|
|
110
111
|
}
|
|
112
|
+
setupObserver(element) {
|
|
113
|
+
if (!element)
|
|
114
|
+
return;
|
|
115
|
+
const parent = element.closest("db-select");
|
|
116
|
+
if (!parent || this.observer)
|
|
117
|
+
return;
|
|
118
|
+
this.observer = new MutationObserver((mutations) => {
|
|
119
|
+
if (mutations.some((mutation) => {
|
|
120
|
+
var _a;
|
|
121
|
+
const attr = mutation.target.attributes.getNamedItem((_a = mutation.attributeName) !== null && _a !== void 0 ? _a : "");
|
|
122
|
+
return (attr === null || attr === void 0 ? void 0 : attr.value) !== mutation.oldValue;
|
|
123
|
+
})) {
|
|
124
|
+
this.enableAttributePassing(element, "db-select");
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
this.observer.observe(parent, {
|
|
128
|
+
attributes: true,
|
|
129
|
+
attributeOldValue: true,
|
|
130
|
+
});
|
|
131
|
+
}
|
|
111
132
|
/**
|
|
112
133
|
* Passes `aria-*`, `data-*` & `class` attributes to correct child. Used in angular and stencil.
|
|
113
134
|
* @param element the ref for the component
|
|
@@ -121,10 +142,15 @@ export class DBSelect {
|
|
|
121
142
|
const attr = attributes.item(i);
|
|
122
143
|
if (attr && attr.name !== 'data-density' &&
|
|
123
144
|
(attr.name.startsWith("data-") || attr.name.startsWith("aria-"))) {
|
|
124
|
-
|
|
145
|
+
if (attr.value) {
|
|
146
|
+
element.setAttribute(attr.name, attr.value);
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
element.removeAttribute(attr.name);
|
|
150
|
+
}
|
|
125
151
|
parent.removeAttribute(attr.name);
|
|
126
152
|
}
|
|
127
|
-
else if (attr &&
|
|
153
|
+
else if (attr && ["style"].includes(attr.name)) {
|
|
128
154
|
element.setAttribute(attr.name, attr.value);
|
|
129
155
|
parent.removeAttribute(attr.name);
|
|
130
156
|
}
|
|
@@ -132,7 +158,7 @@ export class DBSelect {
|
|
|
132
158
|
const isWebComponent = attr.value.includes("hydrated");
|
|
133
159
|
const value = attr.value.replace("hydrated", "").trim();
|
|
134
160
|
const currentClass = element.getAttribute("class");
|
|
135
|
-
element.setAttribute(attr.name, `${currentClass ?
|
|
161
|
+
element.setAttribute(attr.name, `${currentClass ? currentClass : ""}${value ? ` ${value}` : ""}`);
|
|
136
162
|
if (isWebComponent) {
|
|
137
163
|
// Stencil is using this class for lazy loading component
|
|
138
164
|
parent.setAttribute("class", "hydrated");
|
|
@@ -224,9 +250,16 @@ export class DBSelect {
|
|
|
224
250
|
}
|
|
225
251
|
}
|
|
226
252
|
this.enableAttributePassing(this._ref, "db-select");
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
253
|
+
const onMountHook_0 = () => {
|
|
254
|
+
this.initialized = true;
|
|
255
|
+
this.resetIds();
|
|
256
|
+
this._invalidMessage = this.invalidMessage || DEFAULT_INVALID_MESSAGE;
|
|
257
|
+
};
|
|
258
|
+
onMountHook_0();
|
|
259
|
+
const onMountHook_1 = () => {
|
|
260
|
+
this.setupObserver(this._ref);
|
|
261
|
+
};
|
|
262
|
+
onMountHook_1();
|
|
230
263
|
this.watch0Fn();
|
|
231
264
|
this.watch1Fn();
|
|
232
265
|
this.watch2Fn();
|
|
@@ -234,19 +267,20 @@ export class DBSelect {
|
|
|
234
267
|
this.watch4Fn();
|
|
235
268
|
}
|
|
236
269
|
disconnectedCallback() {
|
|
237
|
-
var _a;
|
|
270
|
+
var _a, _b;
|
|
238
271
|
(_a = this.abortController) === null || _a === void 0 ? void 0 : _a.abort();
|
|
272
|
+
(_b = this.observer) === null || _b === void 0 ? void 0 : _b.disconnect();
|
|
239
273
|
}
|
|
240
274
|
render() {
|
|
241
275
|
var _a, _b, _c, _d, _e, _f;
|
|
242
|
-
return (h("div", { key: '
|
|
276
|
+
return (h("div", { key: '71200b34c84ae3c90e4990b11e55e8dea4c16e55', class: cls("db-select", this.className), "data-variant": this.variant, "data-hide-label": getHideProp(this.showLabel), "data-hide-asterisk": getHideProp(this.showRequiredAsterisk), "data-icon": this.icon, "data-show-icon": getBooleanAsString(this.showIcon, "showIcon") }, h("label", { key: '3633f34f827d53ee4b4d15e5b230307984fcbd09', htmlFor: this._id }, (_a = this.label) !== null && _a !== void 0 ? _a : DEFAULT_LABEL), h("select", { key: 'ff177d80acfa3519df6467892fb5f97f4ad6872b', "aria-invalid": this.validation === "invalid", "data-custom-validity": this.validation, ref: (el) => {
|
|
243
277
|
this._ref = el;
|
|
244
278
|
}, required: getBoolean(this.required, "required"), disabled: getBoolean(this.disabled, "disabled"), id: this._id, name: this.name, size: this.size,
|
|
245
279
|
/* @ts-ignore */
|
|
246
280
|
value: (_c = (_b = this.value) !== null && _b !== void 0 ? _b : this._value) !== null && _c !== void 0 ? _c : undefined, autocomplete: this.autocomplete, multiple: this.multiple, onInput: (event) => this.handleInput(event), onClick: (event) => this.handleClick(event), onChange: (event) => this.handleChange(event), onBlur: (event) => this.handleBlur(event), onFocus: (event) => this.handleFocus(event), "aria-describedby": (_d = this.ariaDescribedBy) !== null && _d !== void 0 ? _d : this._descByIds }, this.variant === "floating" || !!this.placeholder ? (h("option", { class: "placeholder", value: "", "data-show-empty-option": getBooleanAsString(this.shouldShowEmptyOption(), "showEmptyOption") })) : null, ((_e = this.options) === null || _e === void 0 ? void 0 : _e.length) ? ((_f = this.options) === null || _f === void 0 ? void 0 : _f.map((option) => {
|
|
247
281
|
var _a;
|
|
248
282
|
return (h(Fragment, null, option.options ? (h("optgroup", { label: this.getOptionLabel(option), key: undefined }, (_a = option.options) === null || _a === void 0 ? void 0 : _a.map((optgroupOption) => (h("option", { value: optgroupOption.value, selected: optgroupOption.selected, disabled: optgroupOption.disabled, key: undefined }, this.getOptionLabel(optgroupOption)))))) : (h("option", { value: option.value, disabled: option.disabled, selected: option.selected, key: undefined }, this.getOptionLabel(option)))));
|
|
249
|
-
})) : (h("slot", null))), this.placeholder ? (h("span", { class: "db-select-placeholder", id: this._placeholderId }, this.placeholder)) : null, stringPropVisible(this.message, this.showMessage) ? (h("db-infotext", { size: "small", icon: this.messageIcon, id: this._messageId }, this.message)) : null, this.hasValidState() ? (h("db-infotext", { size: "small", semantic: "successful", id: this._validMessageId }, this.validMessage || DEFAULT_VALID_MESSAGE)) : null, h("db-infotext", { key: '
|
|
283
|
+
})) : (h("slot", null))), this.placeholder ? (h("span", { class: "db-select-placeholder", id: this._placeholderId }, this.placeholder)) : null, stringPropVisible(this.message, this.showMessage) ? (h("db-infotext", { size: "small", icon: this.messageIcon, id: this._messageId }, this.message)) : null, this.hasValidState() ? (h("db-infotext", { size: "small", semantic: "successful", id: this._validMessageId }, this.validMessage || DEFAULT_VALID_MESSAGE)) : null, h("db-infotext", { key: '5baf4a0984f8d71776cda0d0d9c12e62f08f434b', size: "small", semantic: "critical", id: this._invalidMessageId }, this._invalidMessage), h("span", { key: '2b7c6895a1de8e77daba33de6923a33b7c43bee1', "data-visually-hidden": "true", role: "status" }, this._voiceOverFallback)));
|
|
250
284
|
}
|
|
251
285
|
static get is() { return "db-select"; }
|
|
252
286
|
static get properties() {
|
|
@@ -937,7 +971,8 @@ export class DBSelect {
|
|
|
937
971
|
"_value": {},
|
|
938
972
|
"initialized": {},
|
|
939
973
|
"_voiceOverFallback": {},
|
|
940
|
-
"abortController": {}
|
|
974
|
+
"abortController": {},
|
|
975
|
+
"observer": {}
|
|
941
976
|
};
|
|
942
977
|
}
|
|
943
978
|
static get events() {
|