@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,9 @@ import { h } from "@stencil/core";
|
|
|
5
5
|
|
|
6
6
|
*/
|
|
7
7
|
export class DBButton {
|
|
8
|
+
constructor() {
|
|
9
|
+
this.observer = undefined;
|
|
10
|
+
}
|
|
8
11
|
getButtonType() {
|
|
9
12
|
if (this.type) {
|
|
10
13
|
return this.type;
|
|
@@ -14,6 +17,26 @@ export class DBButton {
|
|
|
14
17
|
}
|
|
15
18
|
return "submit";
|
|
16
19
|
}
|
|
20
|
+
setupObserver(element) {
|
|
21
|
+
if (!element)
|
|
22
|
+
return;
|
|
23
|
+
const parent = element.closest("db-button");
|
|
24
|
+
if (!parent || this.observer)
|
|
25
|
+
return;
|
|
26
|
+
this.observer = new MutationObserver((mutations) => {
|
|
27
|
+
if (mutations.some((mutation) => {
|
|
28
|
+
var _a;
|
|
29
|
+
const attr = mutation.target.attributes.getNamedItem((_a = mutation.attributeName) !== null && _a !== void 0 ? _a : "");
|
|
30
|
+
return (attr === null || attr === void 0 ? void 0 : attr.value) !== mutation.oldValue;
|
|
31
|
+
})) {
|
|
32
|
+
this.enableAttributePassing(element, "db-button");
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
this.observer.observe(parent, {
|
|
36
|
+
attributes: true,
|
|
37
|
+
attributeOldValue: true,
|
|
38
|
+
});
|
|
39
|
+
}
|
|
17
40
|
/**
|
|
18
41
|
* Passes `aria-*`, `data-*` & `class` attributes to correct child. Used in angular and stencil.
|
|
19
42
|
* @param element the ref for the component
|
|
@@ -27,10 +50,15 @@ export class DBButton {
|
|
|
27
50
|
const attr = attributes.item(i);
|
|
28
51
|
if (attr && attr.name !== 'data-density' &&
|
|
29
52
|
(attr.name.startsWith("data-") || attr.name.startsWith("aria-"))) {
|
|
30
|
-
|
|
53
|
+
if (attr.value) {
|
|
54
|
+
element.setAttribute(attr.name, attr.value);
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
element.removeAttribute(attr.name);
|
|
58
|
+
}
|
|
31
59
|
parent.removeAttribute(attr.name);
|
|
32
60
|
}
|
|
33
|
-
else if (attr &&
|
|
61
|
+
else if (attr && ["style"].includes(attr.name)) {
|
|
34
62
|
element.setAttribute(attr.name, attr.value);
|
|
35
63
|
parent.removeAttribute(attr.name);
|
|
36
64
|
}
|
|
@@ -38,7 +66,7 @@ export class DBButton {
|
|
|
38
66
|
const isWebComponent = attr.value.includes("hydrated");
|
|
39
67
|
const value = attr.value.replace("hydrated", "").trim();
|
|
40
68
|
const currentClass = element.getAttribute("class");
|
|
41
|
-
element.setAttribute(attr.name, `${currentClass ?
|
|
69
|
+
element.setAttribute(attr.name, `${currentClass ? currentClass : ""}${value ? ` ${value}` : ""}`);
|
|
42
70
|
if (isWebComponent) {
|
|
43
71
|
// Stencil is using this class for lazy loading component
|
|
44
72
|
parent.setAttribute("class", "hydrated");
|
|
@@ -58,13 +86,18 @@ export class DBButton {
|
|
|
58
86
|
}
|
|
59
87
|
}
|
|
60
88
|
this.enableAttributePassing(this._ref, "db-button");
|
|
89
|
+
this.setupObserver(this._ref);
|
|
90
|
+
}
|
|
91
|
+
disconnectedCallback() {
|
|
92
|
+
var _a;
|
|
93
|
+
(_a = this.observer) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
61
94
|
}
|
|
62
95
|
render() {
|
|
63
96
|
var _a, _b, _c;
|
|
64
|
-
return (h("button", { key: '
|
|
97
|
+
return (h("button", { key: 'b3c660955f667a8f8c93bb7c83360a44a5af3d1f', class: cls("db-button", this.className), ref: (el) => {
|
|
65
98
|
this._ref = el;
|
|
66
99
|
}, id: (_a = this.id) !== null && _a !== void 0 ? _a : (_b = this.propOverrides) === null || _b === void 0 ? void 0 : _b.id, type: this.getButtonType(), disabled: getBoolean(this.disabled, "disabled"), "data-icon": (_c = this.iconLeading) !== null && _c !== void 0 ? _c : this.icon, "data-show-icon": getBooleanAsString(this.showIconLeading, "showIconLeading") ||
|
|
67
|
-
getBooleanAsString(this.showIcon, "showIcon"), "data-icon-trailing": this.iconTrailing, "data-show-icon-trailing": getBooleanAsString(this.showIconTrailing, "showIconTrailing"), "data-size": this.size, "data-width": this.width, "data-variant": this.variant, "data-wrap": getBooleanAsString(this.wrap, "wrap"), "data-no-text": getBooleanAsString(this.noText, "noText"), name: this.name, form: this.form, value: this.value }, this.text ? this.text : null, h("slot", { key: '
|
|
100
|
+
getBooleanAsString(this.showIcon, "showIcon"), "data-icon-trailing": this.iconTrailing, "data-show-icon-trailing": getBooleanAsString(this.showIconTrailing, "showIconTrailing"), "data-size": this.size, "data-width": this.width, "data-variant": this.variant, "data-wrap": getBooleanAsString(this.wrap, "wrap"), "data-no-text": getBooleanAsString(this.noText, "noText"), name: this.name, form: this.form, value: this.value }, this.text ? this.text : null, h("slot", { key: 'eb9c13e9573f61cdb3e61b5614fec0ad656c02b8' })));
|
|
68
101
|
}
|
|
69
102
|
static get is() { return "db-button"; }
|
|
70
103
|
static get properties() {
|
|
@@ -589,6 +622,11 @@ export class DBButton {
|
|
|
589
622
|
}
|
|
590
623
|
};
|
|
591
624
|
}
|
|
625
|
+
static get states() {
|
|
626
|
+
return {
|
|
627
|
+
"observer": {}
|
|
628
|
+
};
|
|
629
|
+
}
|
|
592
630
|
static get events() {
|
|
593
631
|
return [{
|
|
594
632
|
"method": "click",
|
|
@@ -5,11 +5,34 @@ import { h } from "@stencil/core";
|
|
|
5
5
|
|
|
6
6
|
*/
|
|
7
7
|
export class DBCard {
|
|
8
|
+
constructor() {
|
|
9
|
+
this.observer = undefined;
|
|
10
|
+
}
|
|
8
11
|
handleClick(event) {
|
|
9
12
|
if (this.click) {
|
|
10
13
|
this.click.emit(event);
|
|
11
14
|
}
|
|
12
15
|
}
|
|
16
|
+
setupObserver(element) {
|
|
17
|
+
if (!element)
|
|
18
|
+
return;
|
|
19
|
+
const parent = element.closest("db-card");
|
|
20
|
+
if (!parent || this.observer)
|
|
21
|
+
return;
|
|
22
|
+
this.observer = new MutationObserver((mutations) => {
|
|
23
|
+
if (mutations.some((mutation) => {
|
|
24
|
+
var _a;
|
|
25
|
+
const attr = mutation.target.attributes.getNamedItem((_a = mutation.attributeName) !== null && _a !== void 0 ? _a : "");
|
|
26
|
+
return (attr === null || attr === void 0 ? void 0 : attr.value) !== mutation.oldValue;
|
|
27
|
+
})) {
|
|
28
|
+
this.enableAttributePassing(element, "db-card");
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
this.observer.observe(parent, {
|
|
32
|
+
attributes: true,
|
|
33
|
+
attributeOldValue: true,
|
|
34
|
+
});
|
|
35
|
+
}
|
|
13
36
|
/**
|
|
14
37
|
* Passes `aria-*`, `data-*` & `class` attributes to correct child. Used in angular and stencil.
|
|
15
38
|
* @param element the ref for the component
|
|
@@ -23,10 +46,15 @@ export class DBCard {
|
|
|
23
46
|
const attr = attributes.item(i);
|
|
24
47
|
if (attr && attr.name !== 'data-density' &&
|
|
25
48
|
(attr.name.startsWith("data-") || attr.name.startsWith("aria-"))) {
|
|
26
|
-
|
|
49
|
+
if (attr.value) {
|
|
50
|
+
element.setAttribute(attr.name, attr.value);
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
element.removeAttribute(attr.name);
|
|
54
|
+
}
|
|
27
55
|
parent.removeAttribute(attr.name);
|
|
28
56
|
}
|
|
29
|
-
else if (attr &&
|
|
57
|
+
else if (attr && ["style"].includes(attr.name)) {
|
|
30
58
|
element.setAttribute(attr.name, attr.value);
|
|
31
59
|
parent.removeAttribute(attr.name);
|
|
32
60
|
}
|
|
@@ -34,7 +62,7 @@ export class DBCard {
|
|
|
34
62
|
const isWebComponent = attr.value.includes("hydrated");
|
|
35
63
|
const value = attr.value.replace("hydrated", "").trim();
|
|
36
64
|
const currentClass = element.getAttribute("class");
|
|
37
|
-
element.setAttribute(attr.name, `${currentClass ?
|
|
65
|
+
element.setAttribute(attr.name, `${currentClass ? currentClass : ""}${value ? ` ${value}` : ""}`);
|
|
38
66
|
if (isWebComponent) {
|
|
39
67
|
// Stencil is using this class for lazy loading component
|
|
40
68
|
parent.setAttribute("class", "hydrated");
|
|
@@ -54,12 +82,17 @@ export class DBCard {
|
|
|
54
82
|
}
|
|
55
83
|
}
|
|
56
84
|
this.enableAttributePassing(this._ref, "db-card");
|
|
85
|
+
this.setupObserver(this._ref);
|
|
86
|
+
}
|
|
87
|
+
disconnectedCallback() {
|
|
88
|
+
var _a;
|
|
89
|
+
(_a = this.observer) === null || _a === void 0 ? void 0 : _a.disconnect();
|
|
57
90
|
}
|
|
58
91
|
render() {
|
|
59
92
|
var _a, _b;
|
|
60
|
-
return (h("div", { key: '
|
|
93
|
+
return (h("div", { key: '44419819c968f1a3882fc7618f9fa6627706e84d', class: cls("db-card", this.className), ref: (el) => {
|
|
61
94
|
this._ref = el;
|
|
62
|
-
}, id: (_a = this.id) !== null && _a !== void 0 ? _a : (_b = this.propOverrides) === null || _b === void 0 ? void 0 : _b.id, "data-behavior": this.behavior, "data-elevation-level": this.elevationLevel, "data-spacing": this.spacing, onClick: (event) => this.handleClick(event) }, h("slot", { key: '
|
|
95
|
+
}, id: (_a = this.id) !== null && _a !== void 0 ? _a : (_b = this.propOverrides) === null || _b === void 0 ? void 0 : _b.id, "data-behavior": this.behavior, "data-elevation-level": this.elevationLevel, "data-spacing": this.spacing, onClick: (event) => this.handleClick(event) }, h("slot", { key: '0854d0bbca92f6dd3bdea08f82872fbfb6567bfa' })));
|
|
63
96
|
}
|
|
64
97
|
static get is() { return "db-card"; }
|
|
65
98
|
static get properties() {
|
|
@@ -220,6 +253,11 @@ export class DBCard {
|
|
|
220
253
|
}
|
|
221
254
|
};
|
|
222
255
|
}
|
|
256
|
+
static get states() {
|
|
257
|
+
return {
|
|
258
|
+
"observer": {}
|
|
259
|
+
};
|
|
260
|
+
}
|
|
223
261
|
static get events() {
|
|
224
262
|
return [{
|
|
225
263
|
"method": "click",
|
|
@@ -17,6 +17,7 @@ export class DBCheckbox {
|
|
|
17
17
|
this._descByIds = undefined;
|
|
18
18
|
this._voiceOverFallback = "";
|
|
19
19
|
this.abortController = undefined;
|
|
20
|
+
this.observer = undefined;
|
|
20
21
|
}
|
|
21
22
|
hasValidState() {
|
|
22
23
|
var _a;
|
|
@@ -33,7 +34,7 @@ export class DBCheckbox {
|
|
|
33
34
|
DEFAULT_INVALID_MESSAGE;
|
|
34
35
|
if (hasVoiceOver()) {
|
|
35
36
|
this._voiceOverFallback = this._invalidMessage;
|
|
36
|
-
delay(() => (this._voiceOverFallback = ""), 1000);
|
|
37
|
+
void delay(() => (this._voiceOverFallback = ""), 1000);
|
|
37
38
|
}
|
|
38
39
|
}
|
|
39
40
|
else if (this.hasValidState() &&
|
|
@@ -42,7 +43,7 @@ export class DBCheckbox {
|
|
|
42
43
|
this._descByIds = this._validMessageId;
|
|
43
44
|
if (hasVoiceOver()) {
|
|
44
45
|
this._voiceOverFallback = (_d = this.validMessage) !== null && _d !== void 0 ? _d : DEFAULT_VALID_MESSAGE;
|
|
45
|
-
delay(() => (this._voiceOverFallback = ""), 1000);
|
|
46
|
+
void delay(() => (this._voiceOverFallback = ""), 1000);
|
|
46
47
|
}
|
|
47
48
|
}
|
|
48
49
|
else if (stringPropVisible(this.message, this.showMessage)) {
|
|
@@ -76,6 +77,26 @@ export class DBCheckbox {
|
|
|
76
77
|
this._validMessageId = mId + DEFAULT_VALID_MESSAGE_ID_SUFFIX;
|
|
77
78
|
this._invalidMessageId = mId + DEFAULT_INVALID_MESSAGE_ID_SUFFIX;
|
|
78
79
|
}
|
|
80
|
+
setupObserver(element) {
|
|
81
|
+
if (!element)
|
|
82
|
+
return;
|
|
83
|
+
const parent = element.closest("db-checkbox");
|
|
84
|
+
if (!parent || this.observer)
|
|
85
|
+
return;
|
|
86
|
+
this.observer = new MutationObserver((mutations) => {
|
|
87
|
+
if (mutations.some((mutation) => {
|
|
88
|
+
var _a;
|
|
89
|
+
const attr = mutation.target.attributes.getNamedItem((_a = mutation.attributeName) !== null && _a !== void 0 ? _a : "");
|
|
90
|
+
return (attr === null || attr === void 0 ? void 0 : attr.value) !== mutation.oldValue;
|
|
91
|
+
})) {
|
|
92
|
+
this.enableAttributePassing(element, "db-checkbox");
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
this.observer.observe(parent, {
|
|
96
|
+
attributes: true,
|
|
97
|
+
attributeOldValue: true,
|
|
98
|
+
});
|
|
99
|
+
}
|
|
79
100
|
/**
|
|
80
101
|
* Passes `aria-*`, `data-*` & `class` attributes to correct child. Used in angular and stencil.
|
|
81
102
|
* @param element the ref for the component
|
|
@@ -89,10 +110,15 @@ export class DBCheckbox {
|
|
|
89
110
|
const attr = attributes.item(i);
|
|
90
111
|
if (attr && attr.name !== 'data-density' &&
|
|
91
112
|
(attr.name.startsWith("data-") || attr.name.startsWith("aria-"))) {
|
|
92
|
-
|
|
113
|
+
if (attr.value) {
|
|
114
|
+
element.setAttribute(attr.name, attr.value);
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
element.removeAttribute(attr.name);
|
|
118
|
+
}
|
|
93
119
|
parent.removeAttribute(attr.name);
|
|
94
120
|
}
|
|
95
|
-
else if (attr &&
|
|
121
|
+
else if (attr && ["style"].includes(attr.name)) {
|
|
96
122
|
element.setAttribute(attr.name, attr.value);
|
|
97
123
|
parent.removeAttribute(attr.name);
|
|
98
124
|
}
|
|
@@ -100,7 +126,7 @@ export class DBCheckbox {
|
|
|
100
126
|
const isWebComponent = attr.value.includes("hydrated");
|
|
101
127
|
const value = attr.value.replace("hydrated", "").trim();
|
|
102
128
|
const currentClass = element.getAttribute("class");
|
|
103
|
-
element.setAttribute(attr.name, `${currentClass ?
|
|
129
|
+
element.setAttribute(attr.name, `${currentClass ? currentClass : ""}${value ? ` ${value}` : ""}`);
|
|
104
130
|
if (isWebComponent) {
|
|
105
131
|
// Stencil is using this class for lazy loading component
|
|
106
132
|
parent.setAttribute("class", "hydrated");
|
|
@@ -197,9 +223,16 @@ export class DBCheckbox {
|
|
|
197
223
|
}
|
|
198
224
|
}
|
|
199
225
|
this.enableAttributePassing(this._ref, "db-checkbox");
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
226
|
+
const onMountHook_0 = () => {
|
|
227
|
+
this.initialized = true;
|
|
228
|
+
this.resetIds();
|
|
229
|
+
this._invalidMessage = this.invalidMessage || DEFAULT_INVALID_MESSAGE;
|
|
230
|
+
};
|
|
231
|
+
onMountHook_0();
|
|
232
|
+
const onMountHook_1 = () => {
|
|
233
|
+
this.setupObserver(this._ref);
|
|
234
|
+
};
|
|
235
|
+
onMountHook_1();
|
|
203
236
|
this.watch0Fn();
|
|
204
237
|
this.watch1Fn();
|
|
205
238
|
this.watch2Fn();
|
|
@@ -208,14 +241,15 @@ export class DBCheckbox {
|
|
|
208
241
|
this.watch5Fn();
|
|
209
242
|
}
|
|
210
243
|
disconnectedCallback() {
|
|
211
|
-
var _a;
|
|
244
|
+
var _a, _b;
|
|
212
245
|
(_a = this.abortController) === null || _a === void 0 ? void 0 : _a.abort();
|
|
246
|
+
(_b = this.observer) === null || _b === void 0 ? void 0 : _b.disconnect();
|
|
213
247
|
}
|
|
214
248
|
render() {
|
|
215
249
|
var _a;
|
|
216
|
-
return (h("div", { key: '
|
|
250
|
+
return (h("div", { key: '669ca0c9e0f0a21581a88f7d95a2a338f1ac3be3', class: cls("db-checkbox", this.className), "data-size": this.size, "data-hide-asterisk": getHideProp(this.showRequiredAsterisk), "data-hide-label": getHideProp(this.showLabel) }, h("label", { key: '620ffa05d0288e333ce10b36e21680beeb7956c1', htmlFor: this._id }, h("input", { key: 'a06fd7e2f559940d18c869b02e758d3402e67783', type: "checkbox", "aria-invalid": this.validation === "invalid", "data-custom-validity": this.validation, ref: (el) => {
|
|
217
251
|
this._ref = el;
|
|
218
|
-
}, id: this._id, name: this.name, checked: getBoolean(this.checked, "checked"), disabled: getBoolean(this.disabled, "disabled"), value: this.value, required: getBoolean(this.required, "required"), onChange: (event) => this.handleChange(event), onBlur: (event) => this.handleBlur(event), onFocus: (event) => this.handleFocus(event), "aria-describedby": (_a = this.ariaDescribedBy) !== null && _a !== void 0 ? _a : this._descByIds }), this.label ? this.label : null, h("slot", { key: '
|
|
252
|
+
}, id: this._id, name: this.name, checked: getBoolean(this.checked, "checked"), disabled: getBoolean(this.disabled, "disabled"), value: this.value, required: getBoolean(this.required, "required"), onChange: (event) => this.handleChange(event), onBlur: (event) => this.handleBlur(event), onFocus: (event) => this.handleFocus(event), "aria-describedby": (_a = this.ariaDescribedBy) !== null && _a !== void 0 ? _a : this._descByIds }), this.label ? this.label : null, h("slot", { key: '5a02a316cd8a9bd2813ce278e5dfa31f7c8bc57a' })), 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: '7ec8ff76655cd5d26413cdad76049696453595ab', size: "small", semantic: "critical", id: this._invalidMessageId }, this._invalidMessage), h("span", { key: 'a177359aaca2aa58b9847373bfb197f0a87cf80b', "data-visually-hidden": "true", role: "status" }, this._voiceOverFallback)));
|
|
219
253
|
}
|
|
220
254
|
static get is() { return "db-checkbox"; }
|
|
221
255
|
static get properties() {
|
|
@@ -750,7 +784,8 @@ export class DBCheckbox {
|
|
|
750
784
|
"_invalidMessage": {},
|
|
751
785
|
"_descByIds": {},
|
|
752
786
|
"_voiceOverFallback": {},
|
|
753
|
-
"abortController": {}
|
|
787
|
+
"abortController": {},
|
|
788
|
+
"observer": {}
|
|
754
789
|
};
|
|
755
790
|
}
|
|
756
791
|
static get events() {
|
|
@@ -5,6 +5,29 @@ import { h } from "@stencil/core";
|
|
|
5
5
|
|
|
6
6
|
*/
|
|
7
7
|
export class DBCustomButton {
|
|
8
|
+
constructor() {
|
|
9
|
+
this.observer = undefined;
|
|
10
|
+
}
|
|
11
|
+
setupObserver(element) {
|
|
12
|
+
if (!element)
|
|
13
|
+
return;
|
|
14
|
+
const parent = element.closest("db-custom-button");
|
|
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-custom-button");
|
|
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 DBCustomButton {
|
|
|
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 DBCustomButton {
|
|
|
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,13 +77,18 @@ export class DBCustomButton {
|
|
|
49
77
|
}
|
|
50
78
|
}
|
|
51
79
|
this.enableAttributePassing(this._ref, "db-custom-button");
|
|
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("div", { key: '
|
|
88
|
+
return (h("div", { key: '6ef84eaa8f553eb89c921a9933fe0203df38f776', class: cls("db-custom-button", this.className), ref: (el) => {
|
|
56
89
|
this._ref = el;
|
|
57
90
|
}, id: (_a = this.id) !== null && _a !== void 0 ? _a : (_b = this.propOverrides) === null || _b === void 0 ? void 0 : _b.id, "data-icon": (_c = this.iconLeading) !== null && _c !== void 0 ? _c : this.icon, "data-show-icon": getBooleanAsString(this.showIconLeading, "showIconLeading") ||
|
|
58
|
-
getBooleanAsString(this.showIcon, "showIcon"), "data-icon-trailing": this.iconTrailing, "data-show-icon-trailing": getBooleanAsString(this.showIconTrailing, "showIconTrailing"), "data-size": this.size, "data-width": this.width, "data-variant": this.variant, "data-no-text": getBooleanAsString(this.noText, "noText") }, h("slot", { key: '
|
|
91
|
+
getBooleanAsString(this.showIcon, "showIcon"), "data-icon-trailing": this.iconTrailing, "data-show-icon-trailing": getBooleanAsString(this.showIconTrailing, "showIconTrailing"), "data-size": this.size, "data-width": this.width, "data-variant": this.variant, "data-no-text": getBooleanAsString(this.noText, "noText") }, h("slot", { key: 'efb921b78ebebd9b13e33893efedaeb2d0ba5f66' })));
|
|
59
92
|
}
|
|
60
93
|
static get is() { return "db-custom-button"; }
|
|
61
94
|
static get properties() {
|
|
@@ -398,5 +431,10 @@ export class DBCustomButton {
|
|
|
398
431
|
}
|
|
399
432
|
};
|
|
400
433
|
}
|
|
434
|
+
static get states() {
|
|
435
|
+
return {
|
|
436
|
+
"observer": {}
|
|
437
|
+
};
|
|
438
|
+
}
|
|
401
439
|
static get elementRef() { return "rootElement"; }
|
|
402
440
|
}
|
|
@@ -44,6 +44,7 @@ export class DBCustomSelect {
|
|
|
44
44
|
this._searchValue = undefined;
|
|
45
45
|
this.selectAllChecked = false;
|
|
46
46
|
this.selectAllIndeterminate = false;
|
|
47
|
+
this.observer = undefined;
|
|
47
48
|
this.satisfyReact = function satisfyReact(event) {
|
|
48
49
|
// This is a function to satisfy React
|
|
49
50
|
event.stopPropagation();
|
|
@@ -73,7 +74,7 @@ export class DBCustomSelect {
|
|
|
73
74
|
DEFAULT_INVALID_MESSAGE;
|
|
74
75
|
if (hasVoiceOver()) {
|
|
75
76
|
this._voiceOverFallback = this._invalidMessage;
|
|
76
|
-
delay(() => (this._voiceOverFallback = ""), 1000);
|
|
77
|
+
void delay(() => (this._voiceOverFallback = ""), 1000);
|
|
77
78
|
}
|
|
78
79
|
if (this._userInteraction) {
|
|
79
80
|
this._validity = (_c = this.validation) !== null && _c !== void 0 ? _c : "invalid";
|
|
@@ -85,7 +86,7 @@ export class DBCustomSelect {
|
|
|
85
86
|
this.setDescById(this._validMessageId);
|
|
86
87
|
if (hasVoiceOver()) {
|
|
87
88
|
this._voiceOverFallback = (_e = this.validMessage) !== null && _e !== void 0 ? _e : DEFAULT_VALID_MESSAGE;
|
|
88
|
-
delay(() => (this._voiceOverFallback = ""), 1000);
|
|
89
|
+
void delay(() => (this._voiceOverFallback = ""), 1000);
|
|
89
90
|
}
|
|
90
91
|
this._validity = (_f = this.validation) !== null && _f !== void 0 ? _f : "valid";
|
|
91
92
|
}
|
|
@@ -184,7 +185,7 @@ export class DBCustomSelect {
|
|
|
184
185
|
const dropdown = this.detailsRef.querySelector("article");
|
|
185
186
|
if (dropdown) {
|
|
186
187
|
// This is a workaround for Angular
|
|
187
|
-
delay(() => {
|
|
188
|
+
void delay(() => {
|
|
188
189
|
var _a;
|
|
189
190
|
handleFixedDropdown(dropdown, this.detailsRef, (_a = this.placement) !== null && _a !== void 0 ? _a : "bottom");
|
|
190
191
|
}, 1);
|
|
@@ -241,7 +242,7 @@ export class DBCustomSelect {
|
|
|
241
242
|
// or to the last checkbox
|
|
242
243
|
const search = getSearchInput(this.detailsRef);
|
|
243
244
|
if (search) {
|
|
244
|
-
delay(() => {
|
|
245
|
+
void delay(() => {
|
|
245
246
|
search.focus();
|
|
246
247
|
}, 100);
|
|
247
248
|
}
|
|
@@ -403,7 +404,7 @@ export class DBCustomSelect {
|
|
|
403
404
|
? checkboxes.at(1)
|
|
404
405
|
: first;
|
|
405
406
|
if (checkbox) {
|
|
406
|
-
delay(() => {
|
|
407
|
+
void delay(() => {
|
|
407
408
|
// Takes some time until element can be focused
|
|
408
409
|
checkbox.focus();
|
|
409
410
|
}, 1);
|
|
@@ -416,7 +417,7 @@ export class DBCustomSelect {
|
|
|
416
417
|
// Focus search if possible
|
|
417
418
|
const search = getSearchInput(this.detailsRef);
|
|
418
419
|
if (search) {
|
|
419
|
-
delay(() => {
|
|
420
|
+
void delay(() => {
|
|
420
421
|
// Takes some time until element can be focused
|
|
421
422
|
search.focus();
|
|
422
423
|
}, 1);
|
|
@@ -482,6 +483,26 @@ export class DBCustomSelect {
|
|
|
482
483
|
this._selectedLabelsId = mId + "-selected-labels";
|
|
483
484
|
this._infoTextId = mId + "-info";
|
|
484
485
|
}
|
|
486
|
+
setupObserver(element) {
|
|
487
|
+
if (!element)
|
|
488
|
+
return;
|
|
489
|
+
const parent = element.closest("db-custom-select");
|
|
490
|
+
if (!parent || this.observer)
|
|
491
|
+
return;
|
|
492
|
+
this.observer = new MutationObserver((mutations) => {
|
|
493
|
+
if (mutations.some((mutation) => {
|
|
494
|
+
var _a;
|
|
495
|
+
const attr = mutation.target.attributes.getNamedItem((_a = mutation.attributeName) !== null && _a !== void 0 ? _a : "");
|
|
496
|
+
return (attr === null || attr === void 0 ? void 0 : attr.value) !== mutation.oldValue;
|
|
497
|
+
})) {
|
|
498
|
+
this.enableAttributePassing(element, "db-custom-select");
|
|
499
|
+
}
|
|
500
|
+
});
|
|
501
|
+
this.observer.observe(parent, {
|
|
502
|
+
attributes: true,
|
|
503
|
+
attributeOldValue: true,
|
|
504
|
+
});
|
|
505
|
+
}
|
|
485
506
|
/**
|
|
486
507
|
* Passes `aria-*`, `data-*` & `class` attributes to correct child. Used in angular and stencil.
|
|
487
508
|
* @param element the ref for the component
|
|
@@ -495,10 +516,15 @@ export class DBCustomSelect {
|
|
|
495
516
|
const attr = attributes.item(i);
|
|
496
517
|
if (attr && attr.name !== 'data-density' &&
|
|
497
518
|
(attr.name.startsWith("data-") || attr.name.startsWith("aria-"))) {
|
|
498
|
-
|
|
519
|
+
if (attr.value) {
|
|
520
|
+
element.setAttribute(attr.name, attr.value);
|
|
521
|
+
}
|
|
522
|
+
else {
|
|
523
|
+
element.removeAttribute(attr.name);
|
|
524
|
+
}
|
|
499
525
|
parent.removeAttribute(attr.name);
|
|
500
526
|
}
|
|
501
|
-
else if (attr &&
|
|
527
|
+
else if (attr && ["style"].includes(attr.name)) {
|
|
502
528
|
element.setAttribute(attr.name, attr.value);
|
|
503
529
|
parent.removeAttribute(attr.name);
|
|
504
530
|
}
|
|
@@ -506,7 +532,7 @@ export class DBCustomSelect {
|
|
|
506
532
|
const isWebComponent = attr.value.includes("hydrated");
|
|
507
533
|
const value = attr.value.replace("hydrated", "").trim();
|
|
508
534
|
const currentClass = element.getAttribute("class");
|
|
509
|
-
element.setAttribute(attr.name, `${currentClass ?
|
|
535
|
+
element.setAttribute(attr.name, `${currentClass ? currentClass : ""}${value ? ` ${value}` : ""}`);
|
|
510
536
|
if (isWebComponent) {
|
|
511
537
|
// Stencil is using this class for lazy loading component
|
|
512
538
|
parent.setAttribute("class", "hydrated");
|
|
@@ -758,18 +784,25 @@ export class DBCustomSelect {
|
|
|
758
784
|
}
|
|
759
785
|
}
|
|
760
786
|
this.enableAttributePassing(this._ref, "db-custom-select");
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
this.detailsRef.open
|
|
787
|
+
const onMountHook_0 = () => {
|
|
788
|
+
this.resetIds();
|
|
789
|
+
this._invalidMessage = this.invalidMessage || DEFAULT_INVALID_MESSAGE;
|
|
790
|
+
if (typeof window !== "undefined" && "IntersectionObserver" in window) {
|
|
791
|
+
this._observer = new IntersectionObserver((payload) => {
|
|
792
|
+
if (this.detailsRef) {
|
|
793
|
+
const entry = payload.find(({ target }) => target === this.detailsRef);
|
|
794
|
+
if (entry && !entry.isIntersecting && this.detailsRef.open) {
|
|
795
|
+
this.detailsRef.open = false;
|
|
796
|
+
}
|
|
769
797
|
}
|
|
770
|
-
}
|
|
771
|
-
}
|
|
772
|
-
}
|
|
798
|
+
});
|
|
799
|
+
}
|
|
800
|
+
};
|
|
801
|
+
onMountHook_0();
|
|
802
|
+
const onMountHook_1 = () => {
|
|
803
|
+
this.setupObserver(this._ref);
|
|
804
|
+
};
|
|
805
|
+
onMountHook_1();
|
|
773
806
|
this.watch0Fn();
|
|
774
807
|
this.watch1Fn();
|
|
775
808
|
this.watch2Fn();
|
|
@@ -791,24 +824,25 @@ export class DBCustomSelect {
|
|
|
791
824
|
this.watch18Fn();
|
|
792
825
|
}
|
|
793
826
|
disconnectedCallback() {
|
|
794
|
-
var _a;
|
|
827
|
+
var _a, _b;
|
|
795
828
|
(_a = this.abortController) === null || _a === void 0 ? void 0 : _a.abort();
|
|
829
|
+
(_b = this.observer) === null || _b === void 0 ? void 0 : _b.disconnect();
|
|
796
830
|
}
|
|
797
831
|
render() {
|
|
798
832
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
799
|
-
return (h("div", { key: '
|
|
833
|
+
return (h("div", { key: '1089ddd1cfca85b7a04524de6430b3572ccb6453', class: cls("db-custom-select", this.className), id: this._id, ref: (el) => {
|
|
800
834
|
this._ref = el;
|
|
801
835
|
}, "aria-invalid": this._validity === "invalid", "data-custom-validity": this._validity, "data-width": this.formFieldWidth, "data-variant": this.variant === "floating" &&
|
|
802
836
|
this.selectedType === "tag" &&
|
|
803
837
|
this.multiple
|
|
804
838
|
? "above"
|
|
805
|
-
: this.variant, "data-required": getBooleanAsString(this.required, "required"), "data-hide-asterisk": getHideProp(this.showRequiredAsterisk), "data-placement": this.placement, "data-selected-type": this.multiple ? this.selectedType : "text", "data-hide-label": getHideProp(this.showLabel), "data-icon": this.icon, "data-show-icon": getBooleanAsString(this.showIcon, "showIcon") }, h("label", { key: '
|
|
839
|
+
: this.variant, "data-required": getBooleanAsString(this.required, "required"), "data-hide-asterisk": getHideProp(this.showRequiredAsterisk), "data-placement": this.placement, "data-selected-type": this.multiple ? this.selectedType : "text", "data-hide-label": getHideProp(this.showLabel), "data-icon": this.icon, "data-show-icon": getBooleanAsString(this.showIcon, "showIcon") }, h("label", { key: 'df6fe2735838356dc7cf9da1538e2d734089341a', id: this._labelId }, (_a = this.label) !== null && _a !== void 0 ? _a : DEFAULT_LABEL, h("select", { key: 'd952cedd05d4f5b1eb2a24d4362aa2b5e4064fd8', role: "none", hidden: true, id: this._selectId, tabIndex: -1, ref: (el) => {
|
|
806
840
|
this.selectRef = el;
|
|
807
841
|
}, form: this.form, name: this.name, "data-custom-validity": this._validity, multiple: getBoolean(this.multiple, "multiple"), disabled: getBoolean(this.disabled, "disabled"), required: getBoolean(this.required, "required"), onChange: (event) => this.satisfyReact(event) }, ((_b = this.options) === null || _b === void 0 ? void 0 : _b.length)
|
|
808
842
|
? (_c = this.options) === null || _c === void 0 ? void 0 : _c.map((option) => (h("option", { disabled: option.disabled, value: option.value, key: undefined }, this.getOptionLabel(option))))
|
|
809
|
-
: null)), h("details", { key: '
|
|
843
|
+
: null)), h("details", { key: '51e516f07db962d68494b5b012a33982df369392', ref: (el) => {
|
|
810
844
|
this.detailsRef = el;
|
|
811
|
-
}, open: this.open, onToggle: (event) => this.handleDropdownToggle(event), onKeyDown: (event) => this.handleKeyboardPress(event) }, h("slot", { key: '
|
|
845
|
+
}, open: this.open, onToggle: (event) => this.handleDropdownToggle(event), onKeyDown: (event) => this.handleKeyboardPress(event) }, h("slot", { key: '9d059be7ce413194177616d016f7babffb790f07' }), this.options ? (h(Fragment, null, h("summary", { class: "db-custom-select-form-field", id: this._summaryId, "aria-disabled": getBooleanAsString(this.disabled, "disabled"), tabIndex: this.disabled ? -1 : undefined, "aria-labelledby": this._labelId }, ((_d = this._selectedLabels) === null || _d === void 0 ? void 0 : _d.length) ? (h("span", { "data-visually-hidden": getBooleanAsString(this.selectedType === "tag", "selectedType"), id: this._selectedLabelsId }, this.selectedPrefix ? (h("span", { "data-visually-hidden": "true" }, this.selectedPrefix)) : null, this._selectedLabels)) : null, this.selectedType === "tag" ? (h("div", null, (_e = this._selectedOptions) === null || _e === void 0 ? void 0 : _e.map((option) => (h("db-tag", { emphasis: "strong", behavior: "removable", removeButton: this.getTagRemoveLabel(option), onRemove: (event) => this.handleTagRemove(option, event), key: undefined }, this.getOptionLabel(option)))))) : null), h("db-custom-select-dropdown", { width: this.dropdownWidth }, this.searchEnabled ? (h("div", null, h("db-input", { type: "search", ref: (el) => {
|
|
812
846
|
this.searchInputRef = el;
|
|
813
847
|
}, name: this._id, form: this._id, showLabel: false, value: this._searchValue, label: (_f = this.searchLabel) !== null && _f !== void 0 ? _f : DEFAULT_LABEL, placeholder: (_g = this.searchPlaceholder) !== null && _g !== void 0 ? _g : this.searchLabel, ariaDescribedBy: this._hasNoOptions || this.showLoading
|
|
814
848
|
? this._infoTextId
|
|
@@ -818,7 +852,7 @@ export class DBCustomSelect {
|
|
|
818
852
|
this.selectAllRef = el;
|
|
819
853
|
}, form: this._id, checked: this.selectAllChecked, onChange: (event) => this.handleSelectAll(event) }), this.getSelectAllLabel())))) : null, h("db-custom-select-list", { multiple: getBoolean(this.multiple, "multiple"), label: (_k = (_j = this.listLabel) !== null && _j !== void 0 ? _j : this.label) !== null && _k !== void 0 ? _k : DEFAULT_LABEL }, (_l = this._options) === null || _l === void 0 ? void 0 : _l.map((option) => (h("db-custom-select-list-item", { type: this.multiple ? "checkbox" : "radio", showDivider: option.showDivider, icon: option.icon, isGroupTitle: option.isGroupTitle, groupTitle: this.getOptionLabel(option), name: this._id, checked: this.getOptionChecked(option.value), disabled: option.disabled, value: option.value, onChange: () => this.handleSelect(option.value), key: undefined }, !option.isGroupTitle
|
|
820
854
|
? this.getOptionLabel(option)
|
|
821
|
-
: null)))))), h("div", null, h("db-button", { variant: "ghost", width: "full", icon: "cross", size: "small", name: this._id, form: this._id, onClick: () => this.handleClose(undefined, true) }, (_m = this.mobileCloseButtonText) !== null && _m !== void 0 ? _m : DEFAULT_CLOSE_BUTTON))))) : null), ((_o = this.showClearSelection) !== null && _o !== void 0 ? _o : true) && ((_p = this._values) === null || _p === void 0 ? void 0 : _p.length) ? (h("db-button", { icon: "cross", variant: "ghost", size: "small", noText: true, name: this._id, form: this._id, disabled: getBoolean(this.disabled, "disabled"), onClick: (event) => this.handleClearAll(event) }, this.clearSelectionText, h("db-tooltip", { placement: "top" }, this.clearSelectionText))) : null, h("span", { key: '
|
|
855
|
+
: null)))))), h("div", null, h("db-button", { variant: "ghost", width: "full", icon: "cross", size: "small", name: this._id, form: this._id, onClick: () => this.handleClose(undefined, true) }, (_m = this.mobileCloseButtonText) !== null && _m !== void 0 ? _m : DEFAULT_CLOSE_BUTTON))))) : null), ((_o = this.showClearSelection) !== null && _o !== void 0 ? _o : true) && ((_p = this._values) === null || _p === void 0 ? void 0 : _p.length) ? (h("db-button", { icon: "cross", variant: "ghost", size: "small", noText: true, name: this._id, form: this._id, disabled: getBoolean(this.disabled, "disabled"), onClick: (event) => this.handleClearAll(event) }, this.clearSelectionText, h("db-tooltip", { placement: "top" }, this.clearSelectionText))) : null, h("span", { key: '116d3a64ab4dc504badf8ae2298908022b807441', class: "db-custom-select-placeholder", "aria-hidden": "true", id: this._placeholderId }, (_q = this.placeholder) !== null && _q !== void 0 ? _q : this.label), 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: '3930c58d7e893751803157d1f23b6f9e7050adaa', size: "small", semantic: "critical", id: this._invalidMessageId }, this._invalidMessage), h("span", { key: 'efdbd668c7f5b2755bada6b174a0ed31a792dd31', "data-visually-hidden": "true", role: "status" }, this._voiceOverFallback)));
|
|
822
856
|
}
|
|
823
857
|
static get is() { return "db-custom-select"; }
|
|
824
858
|
static get properties() {
|
|
@@ -2121,7 +2155,8 @@ export class DBCustomSelect {
|
|
|
2121
2155
|
"_observer": {},
|
|
2122
2156
|
"_searchValue": {},
|
|
2123
2157
|
"selectAllChecked": {},
|
|
2124
|
-
"selectAllIndeterminate": {}
|
|
2158
|
+
"selectAllIndeterminate": {},
|
|
2159
|
+
"observer": {}
|
|
2125
2160
|
};
|
|
2126
2161
|
}
|
|
2127
2162
|
static get events() {
|