@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
|
@@ -5,6 +5,29 @@ import { h } from "@stencil/core";
|
|
|
5
5
|
|
|
6
6
|
*/
|
|
7
7
|
export class DBIcon {
|
|
8
|
+
constructor() {
|
|
9
|
+
this.observer = undefined;
|
|
10
|
+
}
|
|
11
|
+
setupObserver(element) {
|
|
12
|
+
if (!element)
|
|
13
|
+
return;
|
|
14
|
+
const parent = element.closest("db-icon");
|
|
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-icon");
|
|
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 DBIcon {
|
|
|
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 DBIcon {
|
|
|
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 DBIcon {
|
|
|
49
77
|
}
|
|
50
78
|
}
|
|
51
79
|
this.enableAttributePassing(this._ref, "db-icon");
|
|
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("span", { key: '
|
|
88
|
+
return (h("span", { key: '167039453ffa0b206221a521e52e889beeab0d43', class: cls("db-icon", this.className), "aria-hidden": "true", 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-icon": this.icon, "data-icon-weight": this.weight, "data-icon-variant": this.variant }, this.text ? this.text : null, 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-icon": this.icon, "data-icon-weight": this.weight, "data-icon-variant": this.variant }, this.text ? this.text : null, h("slot", { key: 'abea7d517b9dcf61ff53fd70bbbb0cad3da1daa2' })));
|
|
58
91
|
}
|
|
59
92
|
static get is() { return "db-icon"; }
|
|
60
93
|
static get properties() {
|
|
@@ -241,5 +274,10 @@ export class DBIcon {
|
|
|
241
274
|
}
|
|
242
275
|
};
|
|
243
276
|
}
|
|
277
|
+
static get states() {
|
|
278
|
+
return {
|
|
279
|
+
"observer": {}
|
|
280
|
+
};
|
|
281
|
+
}
|
|
244
282
|
static get elementRef() { return "rootElement"; }
|
|
245
283
|
}
|
|
@@ -5,6 +5,29 @@ import { h } from "@stencil/core";
|
|
|
5
5
|
|
|
6
6
|
*/
|
|
7
7
|
export class DBInfotext {
|
|
8
|
+
constructor() {
|
|
9
|
+
this.observer = undefined;
|
|
10
|
+
}
|
|
11
|
+
setupObserver(element) {
|
|
12
|
+
if (!element)
|
|
13
|
+
return;
|
|
14
|
+
const parent = element.closest("db-infotext");
|
|
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-infotext");
|
|
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 DBInfotext {
|
|
|
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 DBInfotext {
|
|
|
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 DBInfotext {
|
|
|
49
77
|
}
|
|
50
78
|
}
|
|
51
79
|
this.enableAttributePassing(this._ref, "db-infotext");
|
|
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, _c;
|
|
55
|
-
return (h("span", { key: '
|
|
88
|
+
return (h("span", { key: 'e1a06bb9c2d0f88953a7281cdda505b392db609c', class: cls("db-infotext", 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-icon": this.icon, "data-semantic": this.semantic, "data-size": this.size, "data-wrap": getBooleanAsString(this.wrap, "wrap"), "data-show-icon-leading": getBooleanAsString((_c = this.showIcon) !== null && _c !== void 0 ? _c : true, "showIcon") }, this.text ? this.text : null, 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-icon": this.icon, "data-semantic": this.semantic, "data-size": this.size, "data-wrap": getBooleanAsString(this.wrap, "wrap"), "data-show-icon-leading": getBooleanAsString((_c = this.showIcon) !== null && _c !== void 0 ? _c : true, "showIcon") }, this.text ? this.text : null, h("slot", { key: '68b5e9bc974cf49e25470cba30b142495e06c72f' })));
|
|
58
91
|
}
|
|
59
92
|
static get is() { return "db-infotext"; }
|
|
60
93
|
static get properties() {
|
|
@@ -293,5 +326,10 @@ export class DBInfotext {
|
|
|
293
326
|
}
|
|
294
327
|
};
|
|
295
328
|
}
|
|
329
|
+
static get states() {
|
|
330
|
+
return {
|
|
331
|
+
"observer": {}
|
|
332
|
+
};
|
|
333
|
+
}
|
|
296
334
|
static get elementRef() { return "rootElement"; }
|
|
297
335
|
}
|
|
@@ -18,6 +18,7 @@ export class DBInput {
|
|
|
18
18
|
this._value = "";
|
|
19
19
|
this._voiceOverFallback = "";
|
|
20
20
|
this.abortController = undefined;
|
|
21
|
+
this.observer = undefined;
|
|
21
22
|
}
|
|
22
23
|
hasValidState() {
|
|
23
24
|
var _a;
|
|
@@ -34,7 +35,7 @@ export class DBInput {
|
|
|
34
35
|
DEFAULT_INVALID_MESSAGE;
|
|
35
36
|
if (hasVoiceOver()) {
|
|
36
37
|
this._voiceOverFallback = this._invalidMessage;
|
|
37
|
-
delay(() => (this._voiceOverFallback = ""), 1000);
|
|
38
|
+
void delay(() => (this._voiceOverFallback = ""), 1000);
|
|
38
39
|
}
|
|
39
40
|
}
|
|
40
41
|
else if (this.hasValidState() &&
|
|
@@ -43,7 +44,7 @@ export class DBInput {
|
|
|
43
44
|
this._descByIds = this._validMessageId;
|
|
44
45
|
if (hasVoiceOver()) {
|
|
45
46
|
this._voiceOverFallback = (_d = this.validMessage) !== null && _d !== void 0 ? _d : DEFAULT_VALID_MESSAGE;
|
|
46
|
-
delay(() => (this._voiceOverFallback = ""), 1000);
|
|
47
|
+
void delay(() => (this._voiceOverFallback = ""), 1000);
|
|
47
48
|
}
|
|
48
49
|
}
|
|
49
50
|
else if (stringPropVisible(this.message, this.showMessage)) {
|
|
@@ -93,6 +94,26 @@ export class DBInput {
|
|
|
93
94
|
this._invalidMessageId = mId + DEFAULT_INVALID_MESSAGE_ID_SUFFIX;
|
|
94
95
|
this._dataListId = mId + DEFAULT_DATALIST_ID_SUFFIX;
|
|
95
96
|
}
|
|
97
|
+
setupObserver(element) {
|
|
98
|
+
if (!element)
|
|
99
|
+
return;
|
|
100
|
+
const parent = element.closest("db-input");
|
|
101
|
+
if (!parent || this.observer)
|
|
102
|
+
return;
|
|
103
|
+
this.observer = new MutationObserver((mutations) => {
|
|
104
|
+
if (mutations.some((mutation) => {
|
|
105
|
+
var _a;
|
|
106
|
+
const attr = mutation.target.attributes.getNamedItem((_a = mutation.attributeName) !== null && _a !== void 0 ? _a : "");
|
|
107
|
+
return (attr === null || attr === void 0 ? void 0 : attr.value) !== mutation.oldValue;
|
|
108
|
+
})) {
|
|
109
|
+
this.enableAttributePassing(element, "db-input");
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
this.observer.observe(parent, {
|
|
113
|
+
attributes: true,
|
|
114
|
+
attributeOldValue: true,
|
|
115
|
+
});
|
|
116
|
+
}
|
|
96
117
|
/**
|
|
97
118
|
* Passes `aria-*`, `data-*` & `class` attributes to correct child. Used in angular and stencil.
|
|
98
119
|
* @param element the ref for the component
|
|
@@ -106,10 +127,15 @@ export class DBInput {
|
|
|
106
127
|
const attr = attributes.item(i);
|
|
107
128
|
if (attr && attr.name !== 'data-density' &&
|
|
108
129
|
(attr.name.startsWith("data-") || attr.name.startsWith("aria-"))) {
|
|
109
|
-
|
|
130
|
+
if (attr.value) {
|
|
131
|
+
element.setAttribute(attr.name, attr.value);
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
element.removeAttribute(attr.name);
|
|
135
|
+
}
|
|
110
136
|
parent.removeAttribute(attr.name);
|
|
111
137
|
}
|
|
112
|
-
else if (attr &&
|
|
138
|
+
else if (attr && ["style"].includes(attr.name)) {
|
|
113
139
|
element.setAttribute(attr.name, attr.value);
|
|
114
140
|
parent.removeAttribute(attr.name);
|
|
115
141
|
}
|
|
@@ -117,7 +143,7 @@ export class DBInput {
|
|
|
117
143
|
const isWebComponent = attr.value.includes("hydrated");
|
|
118
144
|
const value = attr.value.replace("hydrated", "").trim();
|
|
119
145
|
const currentClass = element.getAttribute("class");
|
|
120
|
-
element.setAttribute(attr.name, `${currentClass ?
|
|
146
|
+
element.setAttribute(attr.name, `${currentClass ? currentClass : ""}${value ? ` ${value}` : ""}`);
|
|
121
147
|
if (isWebComponent) {
|
|
122
148
|
// Stencil is using this class for lazy loading component
|
|
123
149
|
parent.setAttribute("class", "hydrated");
|
|
@@ -203,8 +229,15 @@ export class DBInput {
|
|
|
203
229
|
}
|
|
204
230
|
}
|
|
205
231
|
this.enableAttributePassing(this._ref, "db-input");
|
|
206
|
-
|
|
207
|
-
|
|
232
|
+
const onMountHook_0 = () => {
|
|
233
|
+
this.resetIds();
|
|
234
|
+
this._invalidMessage = this.invalidMessage || DEFAULT_INVALID_MESSAGE;
|
|
235
|
+
};
|
|
236
|
+
onMountHook_0();
|
|
237
|
+
const onMountHook_1 = () => {
|
|
238
|
+
this.setupObserver(this._ref);
|
|
239
|
+
};
|
|
240
|
+
onMountHook_1();
|
|
208
241
|
this.watch0Fn();
|
|
209
242
|
this.watch1Fn();
|
|
210
243
|
this.watch2Fn();
|
|
@@ -212,16 +245,18 @@ export class DBInput {
|
|
|
212
245
|
this.watch4Fn();
|
|
213
246
|
}
|
|
214
247
|
disconnectedCallback() {
|
|
215
|
-
var _a;
|
|
248
|
+
var _a, _b;
|
|
216
249
|
(_a = this.abortController) === null || _a === void 0 ? void 0 : _a.abort();
|
|
250
|
+
(_b = this.observer) === null || _b === void 0 ? void 0 : _b.disconnect();
|
|
217
251
|
}
|
|
218
252
|
render() {
|
|
219
253
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
220
|
-
return (h("div", { key: '
|
|
221
|
-
getBooleanAsString(this.showIcon, "showIcon"), "data-icon": (_a = this.iconLeading) !== null && _a !== void 0 ? _a : this.icon, "data-icon-trailing": this.iconTrailing, "data-hide-asterisk": getHideProp(this.showRequiredAsterisk), "data-show-icon-trailing": getBooleanAsString(this.showIconTrailing, "showIconTrailing") }, h("label", { key: '
|
|
254
|
+
return (h("div", { key: 'c8140e1e7d447fd4d65829dde8090110d0e421dc', class: cls("db-input", this.className), "data-variant": this.variant, "data-hide-label": getHideProp(this.showLabel), "data-show-icon": getBooleanAsString(this.showIconLeading, "showIconLeading") ||
|
|
255
|
+
getBooleanAsString(this.showIcon, "showIcon"), "data-icon": (_a = this.iconLeading) !== null && _a !== void 0 ? _a : this.icon, "data-icon-trailing": this.iconTrailing, "data-hide-asterisk": getHideProp(this.showRequiredAsterisk), "data-show-icon-trailing": getBooleanAsString(this.showIconTrailing, "showIconTrailing") }, h("label", { key: '7ce81ede48602af85d5bf770c01ef0731d1774ec', htmlFor: this._id }, (_b = this.label) !== null && _b !== void 0 ? _b : DEFAULT_LABEL), h("input", { key: '880aea669e5decea1d0c865bd27981ab082c9fec', "aria-invalid": this.validation === "invalid", "data-custom-validity": this.validation, "data-field-sizing": this.fieldSizing, ref: (el) => {
|
|
222
256
|
this._ref = el;
|
|
223
257
|
}, id: this._id, name: this.name, type: this.type || "text", multiple: getBoolean(this.multiple, "multiple"), accept: this.accept, placeholder: (_c = this.placeholder) !== null && _c !== void 0 ? _c : DEFAULT_PLACEHOLDER, disabled: getBoolean(this.disabled, "disabled"), required: getBoolean(this.required, "required"), step: getStep(this.step), value: (_e = (_d = this.value) !== null && _d !== void 0 ? _d : this._value) !== null && _e !== void 0 ? _e : "", maxLength: getNumber(this.maxLength, this.maxlength), minLength: getNumber(this.minLength, this.minlength), max: getInputValue(this.max, this.type), min: getInputValue(this.min, this.type), readOnly: getBoolean(this.readOnly, "readOnly") ||
|
|
224
|
-
getBoolean(this.readonly, "readonly")
|
|
258
|
+
getBoolean(this.readonly, "readonly") ||
|
|
259
|
+
undefined, form: this.form, pattern: this.pattern, size: this.size, autoComplete: this.autocomplete, autoFocus: getBoolean(this.autofocus, "autofocus"), enterKeyHint: this.enterkeyhint, inputMode: this.inputmode, onInput: (event) => this.handleInput(event), onChange: (event) => this.handleChange(event), onBlur: (event) => this.handleBlur(event), onFocus: (event) => this.handleFocus(event), list: this.dataList && this._dataListId, "aria-describedby": (_f = this.ariaDescribedBy) !== null && _f !== void 0 ? _f : this._descByIds, role: [
|
|
225
260
|
"datetime-local",
|
|
226
261
|
"date",
|
|
227
262
|
"time",
|
|
@@ -230,7 +265,7 @@ export class DBInput {
|
|
|
230
265
|
"color",
|
|
231
266
|
].includes((_g = this.type) !== null && _g !== void 0 ? _g : "") && isIOSSafari()
|
|
232
267
|
? "textbox"
|
|
233
|
-
: undefined }), this.dataList ? (h("datalist", { id: this._dataListId }, (_h = this.getDataList()) === null || _h === void 0 ? void 0 : _h.map((option) => (h("option", { key: this._dataListId + "-option-" + option.value, value: option.value }, option.label))))) : null, h("slot", { key: '
|
|
268
|
+
: undefined }), this.dataList ? (h("datalist", { id: this._dataListId }, (_h = this.getDataList()) === null || _h === void 0 ? void 0 : _h.map((option) => (h("option", { key: this._dataListId + "-option-" + option.value, value: option.value }, option.label))))) : null, h("slot", { key: 'c119d0f17fc00de285fba88f3748235b914691ff' }), stringPropVisible(this.message, this.showMessage) ? (h("db-infotext", { size: this.messageSize || "small", icon: this.messageIcon, id: this._messageId }, this.message)) : null, this.hasValidState() ? (h("db-infotext", { semantic: "successful", id: this._validMessageId, size: this.validMessageSize || "small" }, this.validMessage || DEFAULT_VALID_MESSAGE)) : null, h("db-infotext", { key: '2ee3dc9555e0a21f6645807077c0b1af6dd08043', semantic: "critical", id: this._invalidMessageId, size: this.invalidMessageSize || "small" }, this._invalidMessage), h("span", { key: '5a3a55b62468522a3198957be4b5a72c818316b4', "data-visually-hidden": "true", role: "status" }, this._voiceOverFallback)));
|
|
234
269
|
}
|
|
235
270
|
static get is() { return "db-input"; }
|
|
236
271
|
static get properties() {
|
|
@@ -1544,7 +1579,8 @@ export class DBInput {
|
|
|
1544
1579
|
"_descByIds": {},
|
|
1545
1580
|
"_value": {},
|
|
1546
1581
|
"_voiceOverFallback": {},
|
|
1547
|
-
"abortController": {}
|
|
1582
|
+
"abortController": {},
|
|
1583
|
+
"observer": {}
|
|
1548
1584
|
};
|
|
1549
1585
|
}
|
|
1550
1586
|
static get events() {
|
|
@@ -5,6 +5,29 @@ import { h } from "@stencil/core";
|
|
|
5
5
|
|
|
6
6
|
*/
|
|
7
7
|
export class DBLink {
|
|
8
|
+
constructor() {
|
|
9
|
+
this.observer = undefined;
|
|
10
|
+
}
|
|
11
|
+
setupObserver(element) {
|
|
12
|
+
if (!element)
|
|
13
|
+
return;
|
|
14
|
+
const parent = element.closest("db-link");
|
|
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-link");
|
|
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 DBLink {
|
|
|
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 DBLink {
|
|
|
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 DBLink {
|
|
|
49
77
|
}
|
|
50
78
|
}
|
|
51
79
|
this.enableAttributePassing(this._ref, "db-link");
|
|
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, _c, _d;
|
|
55
|
-
return (h("a", { key: '
|
|
88
|
+
return (h("a", { key: 'a5c2e75c4243fa0d64c60b974c522347469e75b3', class: cls("db-link", 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, href: this.href, target: this.target, rel: this.rel, role: this.role, referrerPolicy: (_c = this.referrerpolicy) !== null && _c !== void 0 ? _c : this.referrerPolicy, hrefLang: this.hreflang, "aria-disabled": getBooleanAsString(this.disabled, "disabled"), tabIndex: this.disabled ? -1 : 0, "data-size": this.size, "data-show-icon-trailing": getBooleanAsString((_d = this.showIcon) !== null && _d !== void 0 ? _d : true, "showIcon"), "data-variant": this.variant, "data-content": this.content || "internal", "data-wrap": getBooleanAsString(this.wrap, "wrap") }, this.text ? this.text : null, h("slot", { key: '
|
|
90
|
+
}, id: (_a = this.id) !== null && _a !== void 0 ? _a : (_b = this.propOverrides) === null || _b === void 0 ? void 0 : _b.id, href: this.href, target: this.target, rel: this.rel, role: this.role, referrerPolicy: (_c = this.referrerpolicy) !== null && _c !== void 0 ? _c : this.referrerPolicy, hrefLang: this.hreflang, "aria-disabled": getBooleanAsString(this.disabled, "disabled"), tabIndex: this.disabled ? -1 : 0, "data-size": this.size, "data-show-icon-trailing": getBooleanAsString((_d = this.showIcon) !== null && _d !== void 0 ? _d : true, "showIcon"), "data-variant": this.variant, "data-content": this.content || "internal", "data-wrap": getBooleanAsString(this.wrap, "wrap") }, this.text ? this.text : null, h("slot", { key: '7cac380bf21256a51a3815e922687ddf4ad7b425' })));
|
|
58
91
|
}
|
|
59
92
|
static get is() { return "db-link"; }
|
|
60
93
|
static get properties() {
|
|
@@ -501,5 +534,10 @@ export class DBLink {
|
|
|
501
534
|
}
|
|
502
535
|
};
|
|
503
536
|
}
|
|
537
|
+
static get states() {
|
|
538
|
+
return {
|
|
539
|
+
"observer": {}
|
|
540
|
+
};
|
|
541
|
+
}
|
|
504
542
|
static get elementRef() { return "rootElement"; }
|
|
505
543
|
}
|
|
@@ -5,6 +5,29 @@ import { h } from "@stencil/core";
|
|
|
5
5
|
|
|
6
6
|
*/
|
|
7
7
|
export class DBNavigation {
|
|
8
|
+
constructor() {
|
|
9
|
+
this.observer = undefined;
|
|
10
|
+
}
|
|
11
|
+
setupObserver(element) {
|
|
12
|
+
if (!element)
|
|
13
|
+
return;
|
|
14
|
+
const parent = element.closest("db-navigation");
|
|
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-navigation");
|
|
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 DBNavigation {
|
|
|
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 DBNavigation {
|
|
|
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 DBNavigation {
|
|
|
49
77
|
}
|
|
50
78
|
}
|
|
51
79
|
this.enableAttributePassing(this._ref, "db-navigation");
|
|
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("nav", { key: '
|
|
88
|
+
return (h("nav", { key: '9ab5982a120092e6df3de4b17d1750950d2e1667', class: cls("db-navigation", 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 }, h("menu", { key: '
|
|
90
|
+
}, id: (_a = this.id) !== null && _a !== void 0 ? _a : (_b = this.propOverrides) === null || _b === void 0 ? void 0 : _b.id }, h("menu", { key: 'c23027e91896d0cce880bb7527dcf576ba58b513' }, h("slot", { key: '0f7aa08fca229cbceae8bb4c1e91ab4fc5608242' }))));
|
|
58
91
|
}
|
|
59
92
|
static get is() { return "db-navigation"; }
|
|
60
93
|
static get properties() {
|
|
@@ -137,5 +170,10 @@ export class DBNavigation {
|
|
|
137
170
|
}
|
|
138
171
|
};
|
|
139
172
|
}
|
|
173
|
+
static get states() {
|
|
174
|
+
return {
|
|
175
|
+
"observer": {}
|
|
176
|
+
};
|
|
177
|
+
}
|
|
140
178
|
static get elementRef() { return "rootElement"; }
|
|
141
179
|
}
|
|
@@ -16,6 +16,7 @@ export class DBNavigationItem {
|
|
|
16
16
|
this.navigationItemSafeTriangle = undefined;
|
|
17
17
|
this.subNavigationId = undefined;
|
|
18
18
|
this.subNavigationToggleId = undefined;
|
|
19
|
+
this.observer = undefined;
|
|
19
20
|
}
|
|
20
21
|
handleNavigationItemClick(event) {
|
|
21
22
|
var _a;
|
|
@@ -39,6 +40,26 @@ export class DBNavigationItem {
|
|
|
39
40
|
event.stopPropagation();
|
|
40
41
|
this.isSubNavigationExpanded = false;
|
|
41
42
|
}
|
|
43
|
+
setupObserver(element) {
|
|
44
|
+
if (!element)
|
|
45
|
+
return;
|
|
46
|
+
const parent = element.closest("db-navigation-item");
|
|
47
|
+
if (!parent || this.observer)
|
|
48
|
+
return;
|
|
49
|
+
this.observer = new MutationObserver((mutations) => {
|
|
50
|
+
if (mutations.some((mutation) => {
|
|
51
|
+
var _a;
|
|
52
|
+
const attr = mutation.target.attributes.getNamedItem((_a = mutation.attributeName) !== null && _a !== void 0 ? _a : "");
|
|
53
|
+
return (attr === null || attr === void 0 ? void 0 : attr.value) !== mutation.oldValue;
|
|
54
|
+
})) {
|
|
55
|
+
this.enableAttributePassing(element, "db-navigation-item");
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
this.observer.observe(parent, {
|
|
59
|
+
attributes: true,
|
|
60
|
+
attributeOldValue: true,
|
|
61
|
+
});
|
|
62
|
+
}
|
|
42
63
|
/**
|
|
43
64
|
* Passes `aria-*`, `data-*` & `class` attributes to correct child. Used in angular and stencil.
|
|
44
65
|
* @param element the ref for the component
|
|
@@ -52,10 +73,15 @@ export class DBNavigationItem {
|
|
|
52
73
|
const attr = attributes.item(i);
|
|
53
74
|
if (attr && attr.name !== 'data-density' &&
|
|
54
75
|
(attr.name.startsWith("data-") || attr.name.startsWith("aria-"))) {
|
|
55
|
-
|
|
76
|
+
if (attr.value) {
|
|
77
|
+
element.setAttribute(attr.name, attr.value);
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
element.removeAttribute(attr.name);
|
|
81
|
+
}
|
|
56
82
|
parent.removeAttribute(attr.name);
|
|
57
83
|
}
|
|
58
|
-
else if (attr &&
|
|
84
|
+
else if (attr && ["style"].includes(attr.name)) {
|
|
59
85
|
element.setAttribute(attr.name, attr.value);
|
|
60
86
|
parent.removeAttribute(attr.name);
|
|
61
87
|
}
|
|
@@ -63,7 +89,7 @@ export class DBNavigationItem {
|
|
|
63
89
|
const isWebComponent = attr.value.includes("hydrated");
|
|
64
90
|
const value = attr.value.replace("hydrated", "").trim();
|
|
65
91
|
const currentClass = element.getAttribute("class");
|
|
66
|
-
element.setAttribute(attr.name, `${currentClass ?
|
|
92
|
+
element.setAttribute(attr.name, `${currentClass ? currentClass : ""}${value ? ` ${value}` : ""}`);
|
|
67
93
|
if (isWebComponent) {
|
|
68
94
|
// Stencil is using this class for lazy loading component
|
|
69
95
|
parent.setAttribute("class", "hydrated");
|
|
@@ -104,7 +130,6 @@ export class DBNavigationItem {
|
|
|
104
130
|
this.watch1Fn();
|
|
105
131
|
}
|
|
106
132
|
componentDidLoad() {
|
|
107
|
-
var _a;
|
|
108
133
|
if (typeof document !== "undefined" && this.rootElement && this.rootElement.dataset.connect) {
|
|
109
134
|
const connectedElement = document.querySelector(`[data-connect-id="${this.rootElement.dataset.connect}"]`);
|
|
110
135
|
if (connectedElement) {
|
|
@@ -112,16 +137,28 @@ export class DBNavigationItem {
|
|
|
112
137
|
}
|
|
113
138
|
}
|
|
114
139
|
this.enableAttributePassing(this._ref, "db-navigation-item");
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
140
|
+
const onMountHook_0 = () => {
|
|
141
|
+
var _a;
|
|
142
|
+
this.initialized = true;
|
|
143
|
+
const subNavId = `sub-nav-${(_a = this.id) !== null && _a !== void 0 ? _a : uuid()}`;
|
|
144
|
+
this.subNavigationId = subNavId;
|
|
145
|
+
this.subNavigationToggleId = `${subNavId}-toggle`;
|
|
146
|
+
};
|
|
147
|
+
onMountHook_0();
|
|
148
|
+
const onMountHook_1 = () => {
|
|
149
|
+
this.setupObserver(this._ref);
|
|
150
|
+
};
|
|
151
|
+
onMountHook_1();
|
|
119
152
|
this.watch0Fn();
|
|
120
153
|
this.watch1Fn();
|
|
121
154
|
}
|
|
155
|
+
disconnectedCallback() {
|
|
156
|
+
var _a;
|
|
157
|
+
(_a = this.observer) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
158
|
+
}
|
|
122
159
|
render() {
|
|
123
160
|
var _a, _b, _c;
|
|
124
|
-
return (h("li", { key: '
|
|
161
|
+
return (h("li", { key: '0c375eaa62e5b989c6c891d46e5a66fa8c11eed3', class: cls("db-navigation-item", this.className), ref: (el) => {
|
|
125
162
|
this._ref = el;
|
|
126
163
|
}, id: (_a = this.id) !== null && _a !== void 0 ? _a : (_b = this.propOverrides) === null || _b === void 0 ? void 0 : _b.id, onMouseOver: () => { var _a; return (_a = this.navigationItemSafeTriangle) === null || _a === void 0 ? void 0 : _a.enableFollow(); }, onMouseLeave: () => { var _a; return (_a = this.navigationItemSafeTriangle) === null || _a === void 0 ? void 0 : _a.disableFollow(); }, onMouseMove: (event) => { var _a; return (_a = this.navigationItemSafeTriangle) === null || _a === void 0 ? void 0 : _a.followByMouseEvent(event); }, "data-width": this.width, "data-icon": this.icon, "data-show-icon": getBooleanAsString(this.showIcon, "showIcon"), "data-active": this.active, "data-wrap": getBooleanAsString(this.wrap, "wrap"), "aria-disabled": getBooleanAsString(this.disabled, "disabled") }, !getBoolean(this.hideSubNavigation, "hideSubNavigation") &&
|
|
127
164
|
this.hasSubNavigation ? (h(Fragment, null, h("button", { class: "db-navigation-item-expand-button", id: this.subNavigationToggleId, "aria-haspopup": this.hasAreaPopup ? "true" : undefined, "aria-expanded": this.isSubNavigationExpanded, "aria-controls": this.subNavigationId, disabled: getBoolean(this.disabled, "disabled"), onClick: (event) => this.handleClick(event) }, this.text ? this.text : h("slot", { name: "expandButton" })), h("menu", { class: "db-sub-navigation", id: this.subNavigationId, "aria-labelledby": this.subNavigationToggleId, "data-force-close": this.autoClose, onClick: (event) => this.handleNavigationItemClick(event) }, this.hasAreaPopup ? (h("div", { class: "db-mobile-navigation-back" }, h("db-button", { icon: "arrow_left", variant: "ghost", id: this.backButtonId, onClick: (event) => this.handleBackClick(event) }, (_c = this.backButtonText) !== null && _c !== void 0 ? _c : DEFAULT_BACK))) : null, h("slot", { name: "subNavigation" })))) : this.text ? (this.text) : (h("slot", null))));
|
|
@@ -502,7 +539,8 @@ export class DBNavigationItem {
|
|
|
502
539
|
"autoClose": {},
|
|
503
540
|
"navigationItemSafeTriangle": {},
|
|
504
541
|
"subNavigationId": {},
|
|
505
|
-
"subNavigationToggleId": {}
|
|
542
|
+
"subNavigationToggleId": {},
|
|
543
|
+
"observer": {}
|
|
506
544
|
};
|
|
507
545
|
}
|
|
508
546
|
static get events() {
|